@splinetool/viewer 2.0.31 → 2.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/hana-ui.js +28 -28
- package/build/hana-ui.wasm +0 -0
- package/build/spline-viewer.cjs +35 -35
- package/build/spline-viewer.js +35 -35
- package/build/spline-viewer.webgl.js +7 -7
- package/build/spline-viewer.webgpu.js +7 -7
- package/package.json +1 -1
|
@@ -32,7 +32,7 @@ property scaling ${t.scaling.method}
|
|
|
32
32
|
property quaternion ${t.quaternion.method}`;if(t.harmonics&&t.harmonics.length>0)for(let A=0;A<t.harmonics.length;A++)r=`${r}
|
|
33
33
|
property harmonics_${A} ${t.harmonics[A].method}`;r=`${r}
|
|
34
34
|
end_header
|
|
35
|
-
`;let s=new TextEncoder().encode(r),a=n*2*4,o=t.xyz.quantized.data.buffer.byteLength,l=t.xyz instanceof Yi?a:0,c=t.color.quantized.data.buffer.byteLength,h=t.color instanceof Yi?a:0,d=t.opacity.quantized.data.buffer.byteLength,u=t.opacity instanceof Yi?a:0,p=t.scaling.quantized.data.buffer.byteLength,f=t.scaling instanceof Yi?a:0,g=t.quaternion.quantized.data.buffer.byteLength,m=t.quaternion instanceof Yi?a:0,y=t.variableChunkSize?Uint16Array.from(t.variableChunkSize):void 0,v=y?y.byteLength:0,_=s.byteLength+v+o+l+c+h+d+u+p+f+g+m,b=0,x=0;if(t.harmonics&&t.harmonics.length>0)for(let A=0;A<t.harmonics.length;A++)b+=t.harmonics[A].quantized.data.buffer.byteLength,x+=t.harmonics[A]instanceof Yi?a:0;b=0,x=0,_+=b+x;let w=new Uint8Array(_),S=0;if(w.set(s,S),S+=s.byteLength,v>0&&(w.set(new Uint8Array(y.buffer),S),S+=v),t.xyz instanceof Yi&&(w.set(new Uint8Array(t.xyz.minmaxMatrix.data.buffer),S),S+=a),w.set(new Uint8Array(t.xyz.quantized.data.buffer),S),S+=o,t.color instanceof Yi&&(w.set(new Uint8Array(t.color.minmaxMatrix.data.buffer),S),S+=a),w.set(new Uint8Array(t.color.quantized.data.buffer),S),S+=c,t.opacity instanceof Yi&&(w.set(new Uint8Array(t.opacity.minmaxMatrix.data.buffer),S),S+=a),w.set(new Uint8Array(t.opacity.quantized.data.buffer),S),S+=d,t.scaling instanceof Yi&&(w.set(new Uint8Array(t.scaling.minmaxMatrix.data.buffer),S),S+=a),w.set(new Uint8Array(t.scaling.quantized.data.buffer),S),S+=p,t.quaternion instanceof Yi&&(w.set(new Uint8Array(t.quaternion.minmaxMatrix.data.buffer),S),S+=a),w.set(new Uint8Array(t.quaternion.quantized.data.buffer),S),S+=g,b>0&&t.harmonics&&t.harmonics.length>0)for(let A=0;A<t.harmonics.length;A++){let E=t.harmonics[A];E instanceof Yi&&(w.set(new Uint8Array(E.minmaxMatrix.data.buffer),S),S+=a),w.set(new Uint8Array(E.quantized.data.buffer),S),S+=E.quantized.data.byteLength}return new Nx(w.buffer)}}});async function NP(t){return createImageBitmap(new Blob([t]))}async function kP(t){return fetch(t).then(e=>{if(!e.ok)throw new Error(`Failed to fetch image: ${e.statusText}`);return e.blob()}).then(e=>createImageBitmap(e))}function LG(t){if(typeof t.requestVideoFrameCallback!="function"){t.hanaClockBase=++jx*RG;return}t.hanaPresentedFrames=++jx;let e=()=>{t.hanaDisposed||(t.hanaPresentedFrames=++jx)};t.addEventListener("seeked",e);let i=()=>{e(),!t.hanaDisposed&&(t.hanaFrameCallback=t.requestVideoFrameCallback(i))};t.hanaFrameCallback=t.requestVideoFrameCallback(i)}function VP(t){let e=t.hanaPresentedFrames;return e===void 0?t.hanaClockBase+t.currentTime:e}function BG(t,e){t.hanaObjectUrl=URL.createObjectURL(e),t.src=t.hanaObjectUrl}function Gx(t){if(t.hanaDisposed)return;t.hanaDisposed=!0;let e=t.hanaFrameCallback;e!==void 0&&(t.hanaFrameCallback=void 0,typeof t.cancelVideoFrameCallback=="function"&&t.cancelVideoFrameCallback(e));let i=t.hanaObjectUrl;i!==void 0&&(t.hanaObjectUrl=void 0,URL.revokeObjectURL(i)),t.pause(),t.removeAttribute("src"),t.load()}function UG(t){let e=n=>{let r=t.error;return new Error(r===null?n:`${n} (code ${r.code}: ${r.message})`)},i=n=>{let r=e(n);return Gx(t),r};return t.error!==null?Promise.reject(i("video failed to load")):t.readyState>=IG?Promise.resolve(t):new Promise((n,r)=>{let s=setTimeout(()=>a(r,i("video timed out before presenting a frame")),OG),a=(c,h)=>{clearTimeout(s),t.removeEventListener("loadeddata",o),t.removeEventListener("canplay",o),t.removeEventListener("error",l),c(h)},o=()=>a(n,t),l=()=>a(r,i("video failed to load"));t.addEventListener("loadeddata",o),t.addEventListener("canplay",o),t.addEventListener("error",l)})}function jP(t){return t.preload="auto",t.autoplay=!0,t.loop=!0,t.muted=!0,t.playsInline=!0,t.currentTime=.01,t.load(),t.onloadeddata=()=>{t.muted=!0;let e=t.play();e!==void 0&&e.then(i=>{}).catch(()=>{t.play()}).finally(()=>{t.pause()})},LG(t),UG(t)}async function GP(t){let e=document.createElement("video");return BG(e,new Blob([t])),jP(e)}async function HP(t){let e=document.createElement("video");return e.crossOrigin="anonymous",e.src=t,jP(e)}var jx,RG,IG,OG,WP=c0(()=>{"use strict";jx=0,RG=1e6,IG=2,OG=3e4});var rD={};lP(rD,{DeviceLostPromise:()=>vl,Engine:()=>yl,PixelReadPromise:()=>vo,SceneController:()=>ef,addRealizedChild:()=>zG,componentInstanceRefreshOps:()=>FG,default:()=>NH,dematerializeInstance:()=>NG,duplicateComponentInstance:()=>kG,initSync:()=>FH,overrideForRealizedEdit:()=>VG,realizeComponentInstance:()=>jG,removeRealizedNode:()=>GG,web_init:()=>HG});function zG(t,e,i,n,r){let s=K.addRealizedChild(H(t),H(e),H(i),H(n),H(r));return Kt(s)}function FG(t,e,i,n,r){let s=K.componentInstanceRefreshOps(H(t),H(e),H(i),H(n),H(r));return Kt(s)}function NG(t,e,i,n){let r=K.dematerializeInstance(H(t),H(e),H(i),H(n));return Kt(r)}function kG(t,e,i,n){let r=K.duplicateComponentInstance(H(t),H(e),H(i),H(n));return Kt(r)}function VG(t,e,i,n,r){let s=K.overrideForRealizedEdit(H(t),H(e),H(i),H(n),H(r));return Kt(s)}function jG(t,e,i){let n=K.realizeComponentInstance(H(t),H(e),H(i));return Kt(n)}function GG(t,e,i,n){let r=K.removeRealizedNode(H(t),H(e),H(i),H(n));return Kt(r)}function HG(){K.web_init()}function iD(){return{__proto__:null,"./hana_bg.js":{__proto__:null,__wbg_Error_ef53bc310eb298a0:function(e,i){let n=Error(Te(e,i));return H(n)},__wbg_Number_6b506e6536831eaa:function(e){return Number(M(e))},__wbg_Window_afcc911b2f9c92e2:function(e){let i=M(e).Window;return H(i)},__wbg_WorkerGlobalScope_5d19ebc889ff397e:function(e){let i=M(e).WorkerGlobalScope;return H(i)},__wbg___wbindgen_bigint_get_as_i64_38130e98eecd467d:function(e,i){let n=M(i),r=typeof n=="bigint"?n:void 0;ie().setBigInt64(e+8,ne(r)?BigInt(0):r,!0),ie().setInt32(e+0,!ne(r),!0)},__wbg___wbindgen_boolean_get_1a45e2c38d4d41b9:function(e){let i=M(e),n=typeof i=="boolean"?i:void 0;return ne(n)?16777215:n?1:0},__wbg___wbindgen_debug_string_0accd80f45e5faa2:function(e,i){let n=Jx(M(i)),r=Zi(n,K.__wbindgen_export,K.__wbindgen_export2),s=Si;ie().setInt32(e+4,s,!0),ie().setInt32(e+0,r,!0)},__wbg___wbindgen_in_70a403a56e771704:function(e,i){return M(e)in M(i)},__wbg___wbindgen_is_bigint_6ffd6468a9bc44b9:function(e){return typeof M(e)=="bigint"},__wbg___wbindgen_is_function_754e9f305ff6029e:function(e){return typeof M(e)=="function"},__wbg___wbindgen_is_null_87c3bfe968c6a5ad:function(e){return M(e)===null},__wbg___wbindgen_is_null_or_undefined_cf617b836541fad3:function(e){return M(e)==null},__wbg___wbindgen_is_object_56732c2bc353f41d:function(e){let i=M(e);return typeof i=="object"&&i!==null},__wbg___wbindgen_is_string_c236cabd84a4d769:function(e){return typeof M(e)=="string"},__wbg___wbindgen_is_undefined_67b456be8673d3d7:function(e){return M(e)===void 0},__wbg___wbindgen_jsval_eq_1068e624fa87f6ab:function(e,i){return M(e)===M(i)},__wbg___wbindgen_jsval_loose_eq_2c56564c75129511:function(e,i){return M(e)==M(i)},__wbg___wbindgen_number_get_9bb1761122181af2:function(e,i){let n=M(i),r=typeof n=="number"?n:void 0;ie().setFloat64(e+8,ne(r)?0:r,!0),ie().setInt32(e+0,!ne(r),!0)},__wbg___wbindgen_string_get_72bdf95d3ae505b1:function(e,i){let n=M(i),r=typeof n=="string"?n:void 0;var s=ne(r)?0:Zi(r,K.__wbindgen_export,K.__wbindgen_export2),a=Si;ie().setInt32(e+4,a,!0),ie().setInt32(e+0,s,!0)},__wbg___wbindgen_throw_1506f2235d1bdba0:function(e,i){throw new Error(Te(e,i))},__wbg__wbg_cb_unref_61db23ac97f16c31:function(e){M(e)._wbg_cb_unref()},__wbg_activeTexture_7a0d6fe7120979ce:function(e,i){M(e).activeTexture(i>>>0)},__wbg_activeTexture_dd15c31d50b73529:function(e,i){M(e).activeTexture(i>>>0)},__wbg_addEventListener_5593b0efd622abd6:function(){return Zt(function(e,i,n,r,s){M(e).addEventListener(Te(i,n),M(r),M(s))},arguments)},__wbg_arrayBuffer_05927079aabe6d46:function(){return Zt(function(e){let i=M(e).arrayBuffer();return H(i)},arguments)},__wbg_assign_551ec2d000f70c24:function(){return Zt(function(e,i,n){M(e).assign(Te(i,n))},arguments)},__wbg_attachShader_5c6a46e7c0fc637a:function(e,i,n){M(e).attachShader(M(i),M(n))},__wbg_attachShader_c2b12b36afa45936:function(e,i,n){M(e).attachShader(M(i),M(n))},__wbg_beginComputePass_431a159006c13c7c:function(e,i){let n=M(e).beginComputePass(M(i));return H(n)},__wbg_beginRenderPass_aa22c432e793359a:function(){return Zt(function(e,i){let n=M(e).beginRenderPass(M(i));return H(n)},arguments)},__wbg_bindBuffer_3841df88ccee4ed0:function(e,i,n){M(e).bindBuffer(i>>>0,M(n))},__wbg_bindBuffer_aa5dc7dc1c8ad1c8:function(e,i,n){M(e).bindBuffer(i>>>0,M(n))},__wbg_bindFramebuffer_10bbdf7040d89a17:function(e,i,n){M(e).bindFramebuffer(i>>>0,M(n))},__wbg_bindFramebuffer_ee8e42543c29c602:function(e,i,n){M(e).bindFramebuffer(i>>>0,M(n))},__wbg_bindRenderbuffer_7808d8eabbe18554:function(e,i,n){M(e).bindRenderbuffer(i>>>0,M(n))},__wbg_bindRenderbuffer_c0360bfb79c193c2:function(e,i,n){M(e).bindRenderbuffer(i>>>0,M(n))},__wbg_bindTexture_28d1d695d4801955:function(e,i,n){M(e).bindTexture(i>>>0,M(n))},__wbg_bindTexture_a1a012a31e1419d5:function(e,i,n){M(e).bindTexture(i>>>0,M(n))},__wbg_bindVertexArrayOES_15e48910a5d208b1:function(e,i){M(e).bindVertexArrayOES(M(i))},__wbg_bindVertexArray_4f2f0a7892280041:function(e,i){M(e).bindVertexArray(M(i))},__wbg_blendEquation_1ced323efc9ce0f8:function(e,i){M(e).blendEquation(i>>>0)},__wbg_blendEquation_a12f5acd9d14fb9b:function(e,i){M(e).blendEquation(i>>>0)},__wbg_blendFunc_d5202c7fe94c67ee:function(e,i,n){M(e).blendFunc(i>>>0,n>>>0)},__wbg_blendFunc_fbff85cd0fce280e:function(e,i,n){M(e).blendFunc(i>>>0,n>>>0)},__wbg_blitFramebuffer_acb954bfb30ed714:function(e,i,n,r,s,a,o,l,c,h,d){M(e).blitFramebuffer(i,n,r,s,a,o,l,c,h>>>0,d>>>0)},__wbg_bufferData_043a7e5da22f40d9:function(e,i,n,r){M(e).bufferData(i>>>0,n,r>>>0)},__wbg_bufferData_7b6881381d415425:function(e,i,n,r){M(e).bufferData(i>>>0,M(n),r>>>0)},__wbg_bufferData_9fddca30299e6114:function(e,i,n,r){M(e).bufferData(i>>>0,n,r>>>0)},__wbg_bufferData_f0837cec09725cc0:function(e,i,n,r){M(e).bufferData(i>>>0,M(n),r>>>0)},__wbg_bufferSubData_885e4f8d5833cf11:function(e,i,n,r){M(e).bufferSubData(i>>>0,n,M(r))},__wbg_bufferSubData_8fc824b6a9503f12:function(e,i,n,r){M(e).bufferSubData(i>>>0,n,M(r))},__wbg_call_8a89609d89f6608a:function(){return Zt(function(e,i){let n=M(e).call(M(i));return H(n)},arguments)},__wbg_call_9c758de292015997:function(){return Zt(function(e,i,n){let r=M(e).call(M(i),M(n));return H(r)},arguments)},__wbg_clearBufferfv_2e2858bd8bcf1715:function(e,i,n,r,s){M(e).clearBufferfv(i>>>0,n,ls(r,s))},__wbg_clearBufferiv_e356514eb1d165fe:function(e,i,n,r,s){M(e).clearBufferiv(i>>>0,n,tD(r,s))},__wbg_compileShader_8810a4868b23621b:function(e,i){M(e).compileShader(M(i))},__wbg_compileShader_ec8d5eb7f2b70a48:function(e,i){M(e).compileShader(M(i))},__wbg_configure_0e4789c0f6b35c8e:function(){return Zt(function(e,i){M(e).configure(M(i))},arguments)},__wbg_copyBufferSubData_9936fdf5e53e1832:function(e,i,n,r,s,a){M(e).copyBufferSubData(i>>>0,n>>>0,r,s,a)},__wbg_copyBufferToBuffer_5e2cd8f10ae78183:function(){return Zt(function(e,i,n,r,s){M(e).copyBufferToBuffer(M(i),n,M(r),s)},arguments)},__wbg_copyBufferToBuffer_ca30deb8de65f5d5:function(){return Zt(function(e,i,n,r,s,a){M(e).copyBufferToBuffer(M(i),n,M(r),s,a)},arguments)},__wbg_copyExternalImageToTexture_4df105bb39517948:function(){return Zt(function(e,i,n,r){M(e).copyExternalImageToTexture(M(i),M(n),M(r))},arguments)},__wbg_copyTextureToBuffer_ed6e67a77ecb768d:function(){return Zt(function(e,i,n,r){M(e).copyTextureToBuffer(M(i),M(n),M(r))},arguments)},__wbg_createBindGroupLayout_49a7e2b3d076afcf:function(){return Zt(function(e,i){let n=M(e).createBindGroupLayout(M(i));return H(n)},arguments)},__wbg_createBindGroup_655c6e6c0258530e:function(e,i){let n=M(e).createBindGroup(M(i));return H(n)},__wbg_createBuffer_0726dd2ab09ea1d2:function(){return Zt(function(e,i){let n=M(e).createBuffer(M(i));return H(n)},arguments)},__wbg_createBuffer_333d6aae40284594:function(e){let i=M(e).createBuffer();return ne(i)?0:H(i)},__wbg_createBuffer_3ae54605e5676c83:function(e){let i=M(e).createBuffer();return ne(i)?0:H(i)},__wbg_createCommandEncoder_ec1f40f0cb4d09df:function(e,i){let n=M(e).createCommandEncoder(M(i));return H(n)},__wbg_createComputePipelineAsync_afe7021ac5a02993:function(e,i){let n=M(e).createComputePipelineAsync(M(i));return H(n)},__wbg_createFramebuffer_6f42ff976bb98152:function(e){let i=M(e).createFramebuffer();return ne(i)?0:H(i)},__wbg_createFramebuffer_ef1247e8b2e9b09f:function(e){let i=M(e).createFramebuffer();return ne(i)?0:H(i)},__wbg_createPipelineLayout_2c8cd4528b06c108:function(e,i){let n=M(e).createPipelineLayout(M(i));return H(n)},__wbg_createProgram_b48c3323af547213:function(e){let i=M(e).createProgram();return ne(i)?0:H(i)},__wbg_createProgram_f6a8df4491031d57:function(e){let i=M(e).createProgram();return ne(i)?0:H(i)},__wbg_createQuerySet_cb7b21d1d405b890:function(){return Zt(function(e,i){let n=M(e).createQuerySet(M(i));return H(n)},arguments)},__wbg_createRenderPipelineAsync_eecad1e54ef27acf:function(e,i){let n=M(e).createRenderPipelineAsync(M(i));return H(n)},__wbg_createRenderPipeline_cf98d4d699bfb03c:function(){return Zt(function(e,i){let n=M(e).createRenderPipeline(M(i));return H(n)},arguments)},__wbg_createRenderbuffer_a2f947c7fa8c8bf0:function(e){let i=M(e).createRenderbuffer();return ne(i)?0:H(i)},__wbg_createRenderbuffer_c09d5809ac95924e:function(e){let i=M(e).createRenderbuffer();return ne(i)?0:H(i)},__wbg_createSampler_c8ffb3c8d565f704:function(e,i){let n=M(e).createSampler(M(i));return H(n)},__wbg_createShaderModule_2e44fc7677c6288b:function(e,i){let n=M(e).createShaderModule(M(i));return H(n)},__wbg_createShader_0e3f814b69e9e184:function(e,i){let n=M(e).createShader(i>>>0);return ne(n)?0:H(n)},__wbg_createShader_383b3295276271d2:function(e,i){let n=M(e).createShader(i>>>0);return ne(n)?0:H(n)},__wbg_createTexture_1bac74c999b8a48e:function(){return Zt(function(e,i){let n=M(e).createTexture(M(i));return H(n)},arguments)},__wbg_createTexture_461a3048c40e7175:function(e){let i=M(e).createTexture();return ne(i)?0:H(i)},__wbg_createTexture_d6e2c1f04a554a15:function(e){let i=M(e).createTexture();return ne(i)?0:H(i)},__wbg_createVertexArrayOES_2f67d3679ba9a29c:function(e){let i=M(e).createVertexArrayOES();return ne(i)?0:H(i)},__wbg_createVertexArray_febd1d11636d15ad:function(e){let i=M(e).createVertexArray();return ne(i)?0:H(i)},__wbg_createView_ceaf2f5881adbd34:function(){return Zt(function(e,i){let n=M(e).createView(M(i));return H(n)},arguments)},__wbg_cullFace_a4ee8b8c3c126388:function(e,i){M(e).cullFace(i>>>0)},__wbg_cullFace_c6b39a55ccade015:function(e,i){M(e).cullFace(i>>>0)},__wbg_currentTime_0b40b60bc76843cb:function(e){return M(e).currentTime},__wbg_debug_78b457f1effb3792:function(e){console.debug(M(e))},__wbg_deleteBuffer_520156dc8a1f81af:function(e,i){M(e).deleteBuffer(M(i))},__wbg_deleteBuffer_a925fdd1b590fbbc:function(e,i){M(e).deleteBuffer(M(i))},__wbg_deleteFramebuffer_aa4bf9f184123318:function(e,i){M(e).deleteFramebuffer(M(i))},__wbg_deleteFramebuffer_cc043e5a8cb9a556:function(e,i){M(e).deleteFramebuffer(M(i))},__wbg_deleteProgram_0c859ebcab2b7b5a:function(e,i){M(e).deleteProgram(M(i))},__wbg_deleteProgram_df6a6609c7d91a6e:function(e,i){M(e).deleteProgram(M(i))},__wbg_deleteRenderbuffer_37c079dbc257fcf9:function(e,i){M(e).deleteRenderbuffer(M(i))},__wbg_deleteRenderbuffer_4b7a888363766554:function(e,i){M(e).deleteRenderbuffer(M(i))},__wbg_deleteShader_170dea06bd074d01:function(e,i){M(e).deleteShader(M(i))},__wbg_deleteShader_944accd60733a9cb:function(e,i){M(e).deleteShader(M(i))},__wbg_deleteTexture_54dee8e15570751e:function(e,i){M(e).deleteTexture(M(i))},__wbg_deleteTexture_be3eaabebb89a85e:function(e,i){M(e).deleteTexture(M(i))},__wbg_deleteVertexArrayOES_4262d2d0e9fb77c5:function(e,i){M(e).deleteVertexArrayOES(M(i))},__wbg_deleteVertexArray_8f0fb3b3d54c7483:function(e,i){M(e).deleteVertexArray(M(i))},__wbg_depthMask_95332b64c5ef8b45:function(e,i){M(e).depthMask(i!==0)},__wbg_depthMask_f55bea4b6c3b9531:function(e,i){M(e).depthMask(i!==0)},__wbg_description_02485704e69b1e7f:function(e,i){let n=M(i).description,r=Zi(n,K.__wbindgen_export,K.__wbindgen_export2),s=Si;ie().setInt32(e+4,s,!0),ie().setInt32(e+0,r,!0)},__wbg_disable_2cf98ccb81612ef9:function(e,i){M(e).disable(i>>>0)},__wbg_disable_6b825656c54f5646:function(e,i){M(e).disable(i>>>0)},__wbg_dispatchWorkgroups_afb2344298c62227:function(e,i,n,r){M(e).dispatchWorkgroups(i>>>0,n>>>0,r>>>0)},__wbg_displayHeight_465673c1823a1db3:function(e){return M(e).displayHeight},__wbg_displayWidth_73729fd8eb965076:function(e){return M(e).displayWidth},__wbg_disposeVideo_c94c1ccd57a63f68:function(e){Gx(M(e))},__wbg_document_aceb08cd6489baf5:function(e){let i=M(e).document;return ne(i)?0:H(i)},__wbg_done_60cf307fcc680536:function(e){return M(e).done},__wbg_drawArrays_6eb87620c1dcbfb4:function(e,i,n,r){M(e).drawArrays(i>>>0,n,r)},__wbg_drawArrays_f332b526550a641e:function(e,i,n,r){M(e).drawArrays(i>>>0,n,r)},__wbg_drawBuffersWEBGL_10cdfe87c17cd93f:function(e,i){M(e).drawBuffersWEBGL(M(i))},__wbg_drawBuffers_c5a9ee312b2d6fa8:function(e,i){M(e).drawBuffers(M(i))},__wbg_drawElements_23ec4847dad548e0:function(e,i,n,r,s){M(e).drawElements(i>>>0,n,r>>>0,s)},__wbg_drawElements_fe4671e9c358058d:function(e,i,n,r,s){M(e).drawElements(i>>>0,n,r>>>0,s)},__wbg_drawIndexed_d31913e79d58fbac:function(e,i,n,r,s,a){M(e).drawIndexed(i>>>0,n>>>0,r>>>0,s,a>>>0)},__wbg_draw_6877f98847e1e36c:function(e,i,n,r,s){M(e).draw(i>>>0,n>>>0,r>>>0,s>>>0)},__wbg_duration_d6a6a568a0baf72d:function(e){return M(e).duration},__wbg_enableVertexAttribArray_cc09a0312b6adee5:function(e,i){M(e).enableVertexAttribArray(i>>>0)},__wbg_enableVertexAttribArray_f88d3d499ab40ea6:function(e,i){M(e).enableVertexAttribArray(i>>>0)},__wbg_enable_1928c361308989d5:function(e,i){M(e).enable(i>>>0)},__wbg_enable_2cc4ff32a0fd985f:function(e,i){M(e).enable(i>>>0)},__wbg_end_c36889de8ddef882:function(e){M(e).end()},__wbg_end_f99ebed53d4e198a:function(e){M(e).end()},__wbg_engine_new:function(e){let i=yl.__wrap(e);return H(i)},__wbg_entries_04b37a02507f1713:function(e){let i=Object.entries(M(e));return H(i)},__wbg_error_78ff5b3a29b770e0:function(e){console.error(M(e))},__wbg_error_a6fa202b58aa1cd3:function(e,i){let n,r;try{n=e,r=i,console.error(Te(e,i))}finally{K.__wbindgen_export4(n,r,1)}},__wbg_features_2b07a28fe18ad0ce:function(e){let i=M(e).features;return H(i)},__wbg_features_d4d2020319592cbe:function(e){let i=M(e).features;return H(i)},__wbg_fetch_ce1af4d1b59a60be:function(e,i){let n=M(e).fetch(M(i));return H(n)},__wbg_finish_4d91de5e927dd13f:function(e,i){let n=M(e).finish(M(i));return H(n)},__wbg_finish_6e06b68ab68cd9f6:function(e){let i=M(e).finish();return H(i)},__wbg_flush_2088ebca1fd13068:function(e){M(e).flush()},__wbg_flush_3be48fce9f195fa5:function(e){M(e).flush()},__wbg_framebufferRenderbuffer_0c9d0e5587497683:function(e,i,n,r,s){M(e).framebufferRenderbuffer(i>>>0,n>>>0,r>>>0,M(s))},__wbg_framebufferRenderbuffer_599e58ad30dcfeb3:function(e,i,n,r,s){M(e).framebufferRenderbuffer(i>>>0,n>>>0,r>>>0,M(s))},__wbg_framebufferTexture2D_44caed1725e57636:function(e,i,n,r,s,a){M(e).framebufferTexture2D(i>>>0,n>>>0,r>>>0,M(s),a)},__wbg_framebufferTexture2D_fbba21b750c2316a:function(e,i,n,r,s,a){M(e).framebufferTexture2D(i>>>0,n>>>0,r>>>0,M(s),a)},__wbg_from_d300fe49deab18f5:function(e){let i=Array.from(M(e));return H(i)},__wbg_generateMipmap_1403959fc241438f:function(e,i){M(e).generateMipmap(i>>>0)},__wbg_generateMipmap_b261c040d5707fe5:function(e,i){M(e).generateMipmap(i>>>0)},__wbg_getActiveUniform_3a275fd8fdf7a327:function(e,i,n){let r=M(e).getActiveUniform(M(i),n>>>0);return ne(r)?0:H(r)},__wbg_getActiveUniform_86f7a30e1a52aca4:function(e,i,n){let r=M(e).getActiveUniform(M(i),n>>>0);return ne(r)?0:H(r)},__wbg_getContext_469d34698d869fc1:function(){return Zt(function(e,i,n){let r=M(e).getContext(Te(i,n));return ne(r)?0:H(r)},arguments)},__wbg_getContext_5b39fff76491fded:function(){return Zt(function(e,i,n,r){let s=M(e).getContext(Te(i,n),M(r));return ne(s)?0:H(s)},arguments)},__wbg_getContext_7d3a8f461c828713:function(){return Zt(function(e,i,n){let r=M(e).getContext(Te(i,n));return ne(r)?0:H(r)},arguments)},__wbg_getCurrentTexture_20714d1bd9051cab:function(){return Zt(function(e){let i=M(e).getCurrentTexture();return H(i)},arguments)},__wbg_getExtension_454cdc5ffd07bf03:function(){return Zt(function(e,i,n){let r=M(e).getExtension(Te(i,n));return ne(r)?0:H(r)},arguments)},__wbg_getMappedRange_d0bf3141224111b6:function(){return Zt(function(e,i,n){let r=M(e).getMappedRange(i,n);return H(r)},arguments)},__wbg_getParameter_015942a7ad566b20:function(){return Zt(function(e,i){let n=M(e).getParameter(i>>>0);return H(n)},arguments)},__wbg_getParameter_1e77e23f5ccf0300:function(){return Zt(function(e,i){let n=M(e).getParameter(i>>>0);return H(n)},arguments)},__wbg_getPreferredCanvasFormat_8b57039d1801a506:function(e){let i=M(e).getPreferredCanvasFormat();return(Ch.indexOf(i)+1||102)-1},__wbg_getProgramInfoLog_2f9cfcecc4f772e1:function(e,i,n){let r=M(i).getProgramInfoLog(M(n));var s=ne(r)?0:Zi(r,K.__wbindgen_export,K.__wbindgen_export2),a=Si;ie().setInt32(e+4,a,!0),ie().setInt32(e+0,s,!0)},__wbg_getProgramInfoLog_f0d48f606547aed7:function(e,i,n){let r=M(i).getProgramInfoLog(M(n));var s=ne(r)?0:Zi(r,K.__wbindgen_export,K.__wbindgen_export2),a=Si;ie().setInt32(e+4,a,!0),ie().setInt32(e+0,s,!0)},__wbg_getProgramParameter_08beabb2736d5769:function(e,i,n){let r=M(e).getProgramParameter(M(i),n>>>0);return H(r)},__wbg_getProgramParameter_aee848e1db52b7cd:function(e,i,n){let r=M(e).getProgramParameter(M(i),n>>>0);return H(r)},__wbg_getRandomValues_3f44b700395062e5:function(){return Zt(function(e,i){globalThis.crypto.getRandomValues(gl(e,i))},arguments)},__wbg_getRandomValues_bf16787eede473f5:function(){return Zt(function(e,i){globalThis.crypto.getRandomValues(gl(e,i))},arguments)},__wbg_getShaderInfoLog_510365af17f29a35:function(e,i,n){let r=M(i).getShaderInfoLog(M(n));var s=ne(r)?0:Zi(r,K.__wbindgen_export,K.__wbindgen_export2),a=Si;ie().setInt32(e+4,a,!0),ie().setInt32(e+0,s,!0)},__wbg_getShaderInfoLog_cd77c7b7bdb9ce65:function(e,i,n){let r=M(i).getShaderInfoLog(M(n));var s=ne(r)?0:Zi(r,K.__wbindgen_export,K.__wbindgen_export2),a=Si;ie().setInt32(e+4,a,!0),ie().setInt32(e+0,s,!0)},__wbg_getSupportedExtensions_7a31b3412a25d9ba:function(e){let i=M(e).getSupportedExtensions();return ne(i)?0:H(i)},__wbg_getUniformLocation_010256f946f9a865:function(e,i,n,r){let s=M(e).getUniformLocation(M(i),Te(n,r));return ne(s)?0:H(s)},__wbg_getUniformLocation_f9774d4f157f5914:function(e,i,n,r){let s=M(e).getUniformLocation(M(i),Te(n,r));return ne(s)?0:H(s)},__wbg_get_1f8f054ddbaa7db2:function(){return Zt(function(e,i){let n=Reflect.get(M(e),M(i));return H(n)},arguments)},__wbg_get_2b48c7d0d006a781:function(e,i){let n=M(e)[i>>>0];return H(n)},__wbg_get_cb935c1402921898:function(e,i){let n=M(e)[i>>>0];return ne(n)?0:H(n)},__wbg_get_de6a0f7d4d18a304:function(){return Zt(function(e,i){let n=Reflect.get(M(e),M(i));return H(n)},arguments)},__wbg_get_index_ab123d64c89e3156:function(e,i){return M(e)[i>>>0]},__wbg_get_unchecked_33f6e5c9e2f2d6b2:function(e,i){let n=M(e)[i>>>0];return H(n)},__wbg_get_with_ref_key_6412cf3094599694:function(e,i){let n=M(e)[M(i)];return H(n)},__wbg_get_with_ref_key_7e638bba08a44478:function(e,i){let n=M(e)[M(i)];return H(n)},__wbg_gpu_2ccc250735d24a2a:function(e){let i=M(e).gpu;return H(i)},__wbg_has_0c97053e877f47cc:function(e,i,n){return M(e).has(Te(i,n))},__wbg_has_73740b27f436fed3:function(){return Zt(function(e,i){return Reflect.has(M(e),M(i))},arguments)},__wbg_height_4e7694e4e2110bdb:function(e){return M(e).height},__wbg_info_af7f45292ba9b0ea:function(e){console.info(M(e))},__wbg_info_cf0d9a286850cd24:function(e){let i=M(e).info;return H(i)},__wbg_innerHeight_8b6ee2571dbedb9d:function(){return Zt(function(e){let i=M(e).innerHeight;return H(i)},arguments)},__wbg_innerWidth_7475bec19f48fe43:function(){return Zt(function(e){let i=M(e).innerWidth;return H(i)},arguments)},__wbg_instanceof_ArrayBuffer_8f49811467741499:function(e){let i;try{i=M(e)instanceof ArrayBuffer}catch{i=!1}return i},__wbg_instanceof_GpuOutOfMemoryError_6429c750997f1c8d:function(e){let i;try{i=M(e)instanceof GPUOutOfMemoryError}catch{i=!1}return i},__wbg_instanceof_GpuValidationError_75fa3611f065f4df:function(e){let i;try{i=M(e)instanceof GPUValidationError}catch{i=!1}return i},__wbg_instanceof_HtmlVideoElement_95590e1ff107ba83:function(e){let i;try{i=M(e)instanceof HTMLVideoElement}catch{i=!1}return i},__wbg_instanceof_ImageBitmap_beed1259521cd66d:function(e){let i;try{i=M(e)instanceof ImageBitmap}catch{i=!1}return i},__wbg_instanceof_Response_cb984bd66d7bd408:function(e){let i;try{i=M(e)instanceof Response}catch{i=!1}return i},__wbg_instanceof_Uint8Array_86f30649f63ef9c2:function(e){let i;try{i=M(e)instanceof Uint8Array}catch{i=!1}return i},__wbg_instanceof_WebGl2RenderingContext_39d13e3f953130c7:function(e){let i;try{i=M(e)instanceof WebGL2RenderingContext}catch{i=!1}return i},__wbg_instanceof_Window_e093be59ee9a8e14:function(e){let i;try{i=M(e)instanceof Window}catch{i=!1}return i},__wbg_invalidateFramebuffer_6b8dae55a3debb1d:function(){return Zt(function(e,i,n){M(e).invalidateFramebuffer(i>>>0,M(n))},arguments)},__wbg_isArray_67c2c9c4313f4448:function(e){return Array.isArray(M(e))},__wbg_isFallbackAdapter_8ccb967428491dcb:function(e){return M(e).isFallbackAdapter},__wbg_isSafeInteger_66acec27e09e99a7:function(e){return Number.isSafeInteger(M(e))},__wbg_iterator_8732428d309e270e:function(){return H(Symbol.iterator)},__wbg_label_7ed42f25f841996b:function(e,i){let n=M(i).label,r=Zi(n,K.__wbindgen_export,K.__wbindgen_export2),s=Si;ie().setInt32(e+4,s,!0),ie().setInt32(e+0,r,!0)},__wbg_length_280688879ee7deb5:function(e){return M(e).length},__wbg_length_4a591ecaa01354d9:function(e){return M(e).length},__wbg_length_66f1a4b2e9026940:function(e){return M(e).length},__wbg_limits_20c6f56636df7d38:function(e){let i=M(e).limits;return H(i)},__wbg_limits_328c61cd41512420:function(e){let i=M(e).limits;return H(i)},__wbg_linkProgram_3ccc9beaa6dace28:function(e,i){M(e).linkProgram(M(i))},__wbg_linkProgram_fe2b1bf26336c4a5:function(e,i){M(e).linkProgram(M(i))},__wbg_loadImageFromBytes_3d42766b73aca4ca:function(e){let i=NP(Kt(e));return H(i)},__wbg_loadImageFromUrl_50be99dbf040255b:function(e,i){let n,r;try{n=e,r=i;let s=kP(Te(e,i));return H(s)}finally{K.__wbindgen_export4(n,r,1)}},__wbg_loadVideoFromBytes_3d884aadcf4d2139:function(e){let i=GP(Kt(e));return H(i)},__wbg_loadVideoFromUrl_7997ffb030d4b08b:function(e,i){let n,r;try{n=e,r=i;let s=HP(Te(e,i));return H(s)}finally{K.__wbindgen_export4(n,r,1)}},__wbg_location_efdf1fea18b5552a:function(e){let i=M(e).location;return H(i)},__wbg_log_cf2e968649f3384e:function(e){console.log(M(e))},__wbg_lost_0fa164c88f543338:function(e){let i=M(e).lost;return H(i)},__wbg_mapAsync_52b01fa9e8f765fd:function(e,i,n,r){let s=M(e).mapAsync(i>>>0,n,r);return H(s)},__wbg_maxBindGroupsPlusVertexBuffers_33e5006b23e20478:function(e){return M(e).maxBindGroupsPlusVertexBuffers},__wbg_maxBindGroups_f6d26f3a67826666:function(e){return M(e).maxBindGroups},__wbg_maxBindingsPerBindGroup_edab2e8dabbf6060:function(e){return M(e).maxBindingsPerBindGroup},__wbg_maxBufferSize_bbc69284c14aa7da:function(e){return M(e).maxBufferSize},__wbg_maxColorAttachmentBytesPerSample_63ebe4f81de2f34c:function(e){return M(e).maxColorAttachmentBytesPerSample},__wbg_maxColorAttachments_aed8c38beabf3a5c:function(e){return M(e).maxColorAttachments},__wbg_maxComputeInvocationsPerWorkgroup_2d964564c37f1c65:function(e){return M(e).maxComputeInvocationsPerWorkgroup},__wbg_maxComputeWorkgroupSizeX_a3e3206570da184f:function(e){return M(e).maxComputeWorkgroupSizeX},__wbg_maxComputeWorkgroupSizeY_dffa4a62244b7563:function(e){return M(e).maxComputeWorkgroupSizeY},__wbg_maxComputeWorkgroupSizeZ_976ebcb760f6d07d:function(e){return M(e).maxComputeWorkgroupSizeZ},__wbg_maxComputeWorkgroupStorageSize_2e8dbece6e532e2a:function(e){return M(e).maxComputeWorkgroupStorageSize},__wbg_maxComputeWorkgroupsPerDimension_bb7d36b4d20c80f4:function(e){return M(e).maxComputeWorkgroupsPerDimension},__wbg_maxDynamicStorageBuffersPerPipelineLayout_1ca859cb96a414e0:function(e){return M(e).maxDynamicStorageBuffersPerPipelineLayout},__wbg_maxDynamicUniformBuffersPerPipelineLayout_e968f2c8cd8f4d46:function(e){return M(e).maxDynamicUniformBuffersPerPipelineLayout},__wbg_maxInterStageShaderVariables_138ac882c4d6a3d3:function(e){return M(e).maxInterStageShaderVariables},__wbg_maxSampledTexturesPerShaderStage_bb3e6b2698321fa6:function(e){return M(e).maxSampledTexturesPerShaderStage},__wbg_maxSamplersPerShaderStage_98c00a1829fa414b:function(e){return M(e).maxSamplersPerShaderStage},__wbg_maxStorageBufferBindingSize_e500e31f479e669e:function(e){return M(e).maxStorageBufferBindingSize},__wbg_maxStorageBuffersPerShaderStage_eb663f6d7521b6a7:function(e){return M(e).maxStorageBuffersPerShaderStage},__wbg_maxStorageTexturesPerShaderStage_bb3ad93b53e618c0:function(e){return M(e).maxStorageTexturesPerShaderStage},__wbg_maxTextureArrayLayers_2a56d05fb261c99a:function(e){return M(e).maxTextureArrayLayers},__wbg_maxTextureDimension1D_84590c1d4770d319:function(e){return M(e).maxTextureDimension1D},__wbg_maxTextureDimension2D_7f2b5c8b2727e3fc:function(e){return M(e).maxTextureDimension2D},__wbg_maxTextureDimension3D_7f3babddf55c32a6:function(e){return M(e).maxTextureDimension3D},__wbg_maxUniformBufferBindingSize_d80a09e23c0b284c:function(e){return M(e).maxUniformBufferBindingSize},__wbg_maxUniformBuffersPerShaderStage_0b8b2de676fa740e:function(e){return M(e).maxUniformBuffersPerShaderStage},__wbg_maxVertexAttributes_a693dd921316649b:function(e){return M(e).maxVertexAttributes},__wbg_maxVertexBufferArrayStride_f256d91f281076cb:function(e){return M(e).maxVertexBufferArrayStride},__wbg_maxVertexBuffers_70ab564b25d5ac20:function(e){return M(e).maxVertexBuffers},__wbg_message_28959d6ca4d7dda0:function(e,i){let n=M(i).message,r=Zi(n,K.__wbindgen_export,K.__wbindgen_export2),s=Si;ie().setInt32(e+4,s,!0),ie().setInt32(e+0,r,!0)},__wbg_message_4ada57a3710f1502:function(e,i){let n=M(i).message,r=Zi(n,K.__wbindgen_export,K.__wbindgen_export2),s=Si;ie().setInt32(e+4,s,!0),ie().setInt32(e+0,r,!0)},__wbg_minStorageBufferOffsetAlignment_3248ed00dcdbf79f:function(e){return M(e).minStorageBufferOffsetAlignment},__wbg_minUniformBufferOffsetAlignment_3b9fa4caae03e903:function(e){return M(e).minUniformBufferOffsetAlignment},__wbg_name_b7fa2500fc153b89:function(e,i){let n=M(i).name,r=Zi(n,K.__wbindgen_export,K.__wbindgen_export2),s=Si;ie().setInt32(e+4,s,!0),ie().setInt32(e+0,r,!0)},__wbg_navigator_3833ecdbc19d2757:function(e){let i=M(e).navigator;return H(i)},__wbg_navigator_391291470f58c650:function(e){let i=M(e).navigator;return H(i)},__wbg_new_227d7c05414eb861:function(){let e=new Error;return H(e)},__wbg_new_3b242422c588a8f3:function(){return Zt(function(e,i){let n=new OffscreenCanvas(e>>>0,i>>>0);return H(n)},arguments)},__wbg_new_578aeef4b6b94378:function(e){let i=new Uint8Array(M(e));return H(i)},__wbg_new_b682b81e8eaaf027:function(e,i){try{var n={a:e,b:i},r=(a,o)=>{let l=n.a;n.a=0;try{return qP(l,n.b,a,o)}finally{n.a=l}};let s=new Promise(r);return H(s)}finally{n.a=0}},__wbg_new_ce1ab61c1c2b300d:function(){let e=new Object;return H(e)},__wbg_new_d90091b82fdf5b91:function(){let e=new Array;return H(e)},__wbg_new_from_slice_18fa1f71286d66b8:function(e,i){let n=new Uint8Array(gl(e,i));return H(n)},__wbg_new_from_slice_3c93d0bc613de8f0:function(e,i){let n=new Float64Array(wH(e,i));return H(n)},__wbg_new_from_slice_47be4219028de35d:function(e,i){let n=new Uint32Array(Gp(e,i));return H(n)},__wbg_new_from_slice_956df4f769fb782c:function(e,i){let n=new Float32Array(ls(e,i));return H(n)},__wbg_new_typed_41c97238ee4583e3:function(){let e=new Object;return H(e)},__wbg_new_typed_bf31d18f92484486:function(e,i){try{var n={a:e,b:i},r=(a,o)=>{let l=n.a;n.a=0;try{return qP(l,n.b,a,o)}finally{n.a=l}};let s=new Promise(r);return H(s)}finally{n.a=0}},__wbg_new_with_byte_offset_and_length_d836f26d916dd9ad:function(e,i,n){let r=new Uint8Array(M(e),i>>>0,n>>>0);return H(r)},__wbg_new_with_length_36a4998e27b014c5:function(e){let i=new Uint8Array(e>>>0);return H(i)},__wbg_new_with_length_b4a87ccced374381:function(e){let i=new Float64Array(e>>>0);return H(i)},__wbg_new_with_str_and_init_bcd02b79a793d27f:function(){return Zt(function(e,i,n){let r=new Request(Te(e,i),M(n));return H(r)},arguments)},__wbg_next_9e03acdf51c4960d:function(e){let i=M(e).next;return H(i)},__wbg_next_eb8ca7351fa27906:function(){return Zt(function(e){let i=M(e).next();return H(i)},arguments)},__wbg_now_f565250295e2d180:function(e){return M(e).now()},__wbg_of_57145fdec12d159f:function(e){let i=Array.of(M(e));return H(i)},__wbg_ok_fb13c30bc1893039:function(e){return M(e).ok},__wbg_onSubmittedWorkDone_270d6b5a45520e79:function(e){let i=M(e).onSubmittedWorkDone();return H(i)},__wbg_open_177ad1dcc06b9106:function(){return Zt(function(e,i,n,r,s,a,o){let l=M(e).open(Te(i,n),Te(r,s),Te(a,o));return ne(l)?0:H(l)},arguments)},__wbg_open_feb75fe4d9971c50:function(){return Zt(function(e,i,n,r,s){let a=M(e).open(Te(i,n),Te(r,s));return ne(a)?0:H(a)},arguments)},__wbg_ownKeys_0587b8fe286a40e6:function(){return Zt(function(e){let i=Reflect.ownKeys(M(e));return H(i)},arguments)},__wbg_pause_adce2b37e004ae49:function(){return Zt(function(e){M(e).pause()},arguments)},__wbg_performance_68499ca0718837f5:function(e){let i=M(e).performance;return ne(i)?0:H(i)},__wbg_pixelStorei_6e42d231aa75bd00:function(e,i,n){M(e).pixelStorei(i>>>0,n)},__wbg_pixelStorei_84dc1952dc699c94:function(e,i,n){M(e).pixelStorei(i>>>0,n)},__wbg_play_4ed9ece3cae2c100:function(){return Zt(function(e){let i=M(e).play();return H(i)},arguments)},__wbg_popErrorScope_8e7f4cbff8b758dd:function(e){let i=M(e).popErrorScope();return H(i)},__wbg_prototypesetcall_3249fc62a0fafa30:function(e,i,n){Uint8Array.prototype.set.call(gl(e,i),M(n))},__wbg_prototypesetcall_59640349d2c6d881:function(e,i,n){Uint32Array.prototype.set.call(Gp(e,i),M(n))},__wbg_provokingVertexWEBGL_0354dc7ad44d69bf:function(e,i){M(e).provokingVertexWEBGL(i>>>0)},__wbg_pushErrorScope_fa23d1206bc26dce:function(e,i){M(e).pushErrorScope(aH[i])},__wbg_push_a6822215aa43e71c:function(e,i){return M(e).push(M(i))},__wbg_querySelectorAll_4dcc230a2f8a2498:function(){return Zt(function(e,i,n){let r=M(e).querySelectorAll(Te(i,n));return H(r)},arguments)},__wbg_queueMicrotask_35c611f4a14830b2:function(e){queueMicrotask(M(e))},__wbg_queueMicrotask_404ed0a58e0b63cc:function(e){let i=M(e).queueMicrotask;return H(i)},__wbg_queue_adce34608fd0c893:function(e){let i=M(e).queue;return H(i)},__wbg_readBuffer_2027f7cdd7533f2d:function(e,i){M(e).readBuffer(i>>>0)},__wbg_readPixels_a04f5cf5019be695:function(){return Zt(function(e,i,n,r,s,a,o,l){M(e).readPixels(i,n,r,s,a>>>0,o>>>0,M(l))},arguments)},__wbg_readPixels_bf9ee726d9179d3c:function(){return Zt(function(e,i,n,r,s,a,o,l){M(e).readPixels(i,n,r,s,a>>>0,o>>>0,M(l))},arguments)},__wbg_readPixels_d00c1cae608273d8:function(){return Zt(function(e,i,n,r,s,a,o,l){M(e).readPixels(i,n,r,s,a>>>0,o>>>0,l)},arguments)},__wbg_readyState_77b1b1db1b8c2a5f:function(e){return M(e).readyState},__wbg_reason_b02cd587d1a09948:function(e){let i=M(e).reason;return(sH.indexOf(i)+1||3)-1},__wbg_renderbufferStorageMultisample_75bba97a8e59bc6e:function(e,i,n,r,s,a){M(e).renderbufferStorageMultisample(i>>>0,n,r>>>0,s,a)},__wbg_renderbufferStorage_3f5b0ec8fca2f9f8:function(e,i,n,r,s){M(e).renderbufferStorage(i>>>0,n>>>0,r,s)},__wbg_renderbufferStorage_c34a47cacbbc5fff:function(e,i,n,r,s){M(e).renderbufferStorage(i>>>0,n>>>0,r,s)},__wbg_requestAdapter_2e6718811c735a57:function(e,i){let n=M(e).requestAdapter(M(i));return H(n)},__wbg_requestDevice_ab46d0519ea1cc34:function(e,i){let n=M(e).requestDevice(M(i));return H(n)},__wbg_resolveQuerySet_0f32dc3de3f09701:function(e,i,n,r,s,a){M(e).resolveQuerySet(M(i),n>>>0,r>>>0,M(s),a>>>0)},__wbg_resolve_25a7e548d5881dca:function(e){let i=Promise.resolve(M(e));return H(i)},__wbg_scissor_079b7c4a5c9fcb63:function(e,i,n,r,s){M(e).scissor(i,n,r,s)},__wbg_scissor_e69faa631ab6fdc0:function(e,i,n,r,s){M(e).scissor(i,n,r,s)},__wbg_setBindGroup_268fd1714fff0ef5:function(){return Zt(function(e,i,n,r,s,a,o){M(e).setBindGroup(i>>>0,M(n),Gp(r,s),a,o>>>0)},arguments)},__wbg_setBindGroup_3e4ce136bc833ea1:function(){return Zt(function(e,i,n,r,s,a,o){M(e).setBindGroup(i>>>0,M(n),Gp(r,s),a,o>>>0)},arguments)},__wbg_setBindGroup_c22a1b95c0b17f37:function(e,i,n){M(e).setBindGroup(i>>>0,M(n))},__wbg_setBindGroup_f0de6cb2c7dbfc2c:function(e,i,n){M(e).setBindGroup(i>>>0,M(n))},__wbg_setIndexBuffer_2531a9103450445e:function(e,i,n,r){M(e).setIndexBuffer(M(i),qx[n],r)},__wbg_setIndexBuffer_7f3cf667b4d71566:function(e,i,n,r,s){M(e).setIndexBuffer(M(i),qx[n],r,s)},__wbg_setPipeline_c41bf46790f27f9e:function(e,i){M(e).setPipeline(M(i))},__wbg_setPipeline_d73f019e98c76d2d:function(e,i){M(e).setPipeline(M(i))},__wbg_setStencilReference_66c74be6232bb9da:function(e,i){M(e).setStencilReference(i>>>0)},__wbg_setTimeout_b5f25e402b6e8ff9:function(){return Zt(function(e,i,n){return M(e).setTimeout(M(i),n)},arguments)},__wbg_setVertexBuffer_1e448859663dd400:function(e,i,n,r){M(e).setVertexBuffer(i>>>0,M(n),r)},__wbg_setVertexBuffer_7cf533d694e747f3:function(e,i,n,r,s){M(e).setVertexBuffer(i>>>0,M(n),r,s)},__wbg_setViewport_d9fc3eac343de7d0:function(e,i,n,r,s,a,o){M(e).setViewport(i,n,r,s,a,o)},__wbg_set_29c99a8aac1c01e5:function(e,i,n){M(e).set(gl(i,n))},__wbg_set_6e30c9374c26414c:function(){return Zt(function(e,i,n){return Reflect.set(M(e),M(i),M(n))},arguments)},__wbg_set_6f7e2d6e41d9a122:function(e,i,n){M(e)[Kt(i)]=Kt(n)},__wbg_set_a_88262a42340d0b1c:function(e,i){M(e).a=i},__wbg_set_access_9a5092f05dc45fad:function(e,i){M(e).access=pH[i]},__wbg_set_address_mode_u_9e2695575a219e33:function(e,i){M(e).addressModeU=Hx[i]},__wbg_set_address_mode_v_f479b2e6cccbcac4:function(e,i){M(e).addressModeV=Hx[i]},__wbg_set_address_mode_w_46273e153230180d:function(e,i){M(e).addressModeW=Hx[i]},__wbg_set_alpha_bfd2df62e7bc581b:function(e,i){M(e).alpha=M(i)},__wbg_set_alpha_mode_df805952892caa9c:function(e,i){M(e).alphaMode=iH[i]},__wbg_set_alpha_to_coverage_enabled_8b5dc2b0a225b3b2:function(e,i){M(e).alphaToCoverageEnabled=i!==0},__wbg_set_array_layer_count_7312f0f31af94e7c:function(e,i){M(e).arrayLayerCount=i>>>0},__wbg_set_array_stride_f64_27ffaf4fffd74e61:function(e,i){M(e).arrayStride=i},__wbg_set_aspect_0d453bca3d012f02:function(e,i){M(e).aspect=Zx[i]},__wbg_set_aspect_210da747c9d77aba:function(e,i){M(e).aspect=Zx[i]},__wbg_set_aspect_4962514fe99e68e6:function(e,i){M(e).aspect=Zx[i]},__wbg_set_attributes_7537844a7e6dafdc:function(e,i,n){M(e).attributes=qs(i,n)},__wbg_set_b_c47befe0af3261eb:function(e,i){M(e).b=i},__wbg_set_base_array_layer_f176bb9f1b37b342:function(e,i){M(e).baseArrayLayer=i>>>0},__wbg_set_base_mip_level_1df145d9f8db32a9:function(e,i){M(e).baseMipLevel=i>>>0},__wbg_set_beginning_of_pass_write_index_0d4fa06109208ad7:function(e,i){M(e).beginningOfPassWriteIndex=i>>>0},__wbg_set_beginning_of_pass_write_index_e9f5d016947893bd:function(e,i){M(e).beginningOfPassWriteIndex=i>>>0},__wbg_set_bind_group_layouts_5a9cfea401c020ab:function(e,i,n){M(e).bindGroupLayouts=qs(i,n)},__wbg_set_binding_155b0440b4307793:function(e,i){M(e).binding=i>>>0},__wbg_set_binding_f74df3510792aba1:function(e,i){M(e).binding=i>>>0},__wbg_set_blend_7493c2066c3e9970:function(e,i){M(e).blend=M(i)},__wbg_set_buffer_9c01e3b6d6765ea2:function(e,i){M(e).buffer=M(i)},__wbg_set_buffer_c3410572051920ba:function(e,i){M(e).buffer=M(i)},__wbg_set_buffer_ef7f75306cf663ed:function(e,i){M(e).buffer=M(i)},__wbg_set_buffers_7d0d8f507699e956:function(e,i,n){M(e).buffers=qs(i,n)},__wbg_set_bytes_per_row_c54ca96953f35774:function(e,i){M(e).bytesPerRow=i>>>0},__wbg_set_bytes_per_row_d69b88eee3929c07:function(e,i){M(e).bytesPerRow=i>>>0},__wbg_set_c775d84916be79ea:function(e,i,n){M(e).set(M(i),n>>>0)},__wbg_set_clear_value_gpu_color_dict_6211425789c76e59:function(e,i){M(e).clearValue=M(i)},__wbg_set_code_b4f37f81f45b5b25:function(e,i,n){M(e).code=Te(i,n)},__wbg_set_color_83aa977526e88cbb:function(e,i){M(e).color=M(i)},__wbg_set_color_attachments_581fdb3310e4abfa:function(e,i,n){M(e).colorAttachments=qs(i,n)},__wbg_set_compare_cd9b62cdb92eb580:function(e,i){M(e).compare=Wx[i]},__wbg_set_compare_f36b34abfaa08ccb:function(e,i){M(e).compare=Wx[i]},__wbg_set_compute_d0c2d276b6d4b18d:function(e,i){M(e).compute=M(i)},__wbg_set_count_069a4eac409bac55:function(e,i){M(e).count=i>>>0},__wbg_set_count_3ab1c1220e4ceeb3:function(e,i){M(e).count=i>>>0},__wbg_set_cull_mode_fc649853947a3d0c:function(e,i){M(e).cullMode=rH[i]},__wbg_set_currentTime_7c37e2312e9d2687:function(e,i){M(e).currentTime=i},__wbg_set_depth_bias_clamp_1c0d695df7f092e5:function(e,i){M(e).depthBiasClamp=i},__wbg_set_depth_bias_d7cd16096242a657:function(e,i){M(e).depthBias=i},__wbg_set_depth_bias_slope_scale_c4e52ec743ef55ba:function(e,i){M(e).depthBiasSlopeScale=i},__wbg_set_depth_clear_value_beda3ec5b1a5c43a:function(e,i){M(e).depthClearValue=i},__wbg_set_depth_compare_0c8631eb2eae98e3:function(e,i){M(e).depthCompare=Wx[i]},__wbg_set_depth_fail_op_668155ae33d3c06f:function(e,i){M(e).depthFailOp=$x[i]},__wbg_set_depth_load_op_511c513eab4e56a9:function(e,i){M(e).depthLoadOp=Xx[i]},__wbg_set_depth_or_array_layers_89371305ed0bd962:function(e,i){M(e).depthOrArrayLayers=i>>>0},__wbg_set_depth_read_only_7f41a74741c144ec:function(e,i){M(e).depthReadOnly=i!==0},__wbg_set_depth_stencil_97506c7bea4f53da:function(e,i){M(e).depthStencil=M(i)},__wbg_set_depth_stencil_attachment_73b79e8b4e948222:function(e,i){M(e).depthStencilAttachment=M(i)},__wbg_set_depth_store_op_c89f33b39b43361c:function(e,i){M(e).depthStoreOp=Yx[i]},__wbg_set_depth_write_enabled_ce89750042940350:function(e,i){M(e).depthWriteEnabled=i!==0},__wbg_set_device_e275d1d4f3c9eb74:function(e,i){M(e).device=M(i)},__wbg_set_dimension_868eee80f4b90011:function(e,i){M(e).dimension=fH[i]},__wbg_set_dimension_e325282e613ca0a4:function(e,i){M(e).dimension=Kx[i]},__wbg_set_dst_factor_ec7407f19be1aff9:function(e,i){M(e).dstFactor=$P[i]},__wbg_set_end_of_pass_write_index_0d546e46b86ea069:function(e,i){M(e).endOfPassWriteIndex=i>>>0},__wbg_set_end_of_pass_write_index_49a6ddbb2b888bfa:function(e,i){M(e).endOfPassWriteIndex=i>>>0},__wbg_set_entries_86a29dd6291c95e7:function(e,i,n){M(e).entries=qs(i,n)},__wbg_set_entries_a12aca1e458b0456:function(e,i,n){M(e).entries=qs(i,n)},__wbg_set_entry_point_207540f042015ce5:function(e,i,n){M(e).entryPoint=Te(i,n)},__wbg_set_entry_point_5f26aacbe4c545eb:function(e,i,n){M(e).entryPoint=Te(i,n)},__wbg_set_entry_point_e87e79251dd3144f:function(e,i,n){M(e).entryPoint=Te(i,n)},__wbg_set_external_texture_386483d8dd82ab56:function(e,i){M(e).externalTexture=M(i)},__wbg_set_fail_op_92f716dbc88b6973:function(e,i){M(e).failOp=$x[i]},__wbg_set_flip_y_4e1632b36ad0413a:function(e,i){M(e).flipY=i!==0},__wbg_set_format_1fcaa7d60546b490:function(e,i){M(e).format=Ch[i]},__wbg_set_format_2c1414a817c213f8:function(e,i){M(e).format=Ch[i]},__wbg_set_format_533f9ffa7eef563d:function(e,i){M(e).format=Ch[i]},__wbg_set_format_5d2f25cc93654ecc:function(e,i){M(e).format=gH[i]},__wbg_set_format_5ff53724ed6cedf2:function(e,i){M(e).format=Ch[i]},__wbg_set_format_815efd4dc4817bbb:function(e,i){M(e).format=Ch[i]},__wbg_set_format_e52bdcca880d2c8e:function(e,i){M(e).format=Ch[i]},__wbg_set_fragment_8b780f00a0b0e6f3:function(e,i){M(e).fragment=M(i)},__wbg_set_front_face_28ffdf524eedce5b:function(e,i){M(e).frontFace=oH[i]},__wbg_set_g_5983abfc46e0cf4e:function(e,i){M(e).g=i},__wbg_set_has_dynamic_offset_62bc230bdb7c54d0:function(e,i){M(e).hasDynamicOffset=i!==0},__wbg_set_height_0739170de8653cc4:function(e,i){M(e).height=i>>>0},__wbg_set_height_14335c4047cf9c1b:function(e,i){M(e).height=i>>>0},__wbg_set_height_c661af0c0b5376f9:function(e,i){M(e).height=i>>>0},__wbg_set_label_08d9be3e4719c226:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_17eb9fe3a02f62b0:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_206558c8adc3780f:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_48e6b787d256f621:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_547d0d4aec39fbe9:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_5ee7427342869829:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_60ad96c811e0d109:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_6db0393d3fdc90a5:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_72bb4f41ef0cb893:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_79387decda299036:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_9556af8b5cda3c9d:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_d010f237b26f2c55:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_e16e2dbe51349c7f:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_e3944e54881b8c50:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_e922700240417ab5:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_ef44793ddf4455c5:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_layout_41021cfd2a2f62df:function(e,i){M(e).layout=M(i)},__wbg_set_layout_50ab727f44b38f26:function(e,i){M(e).layout=M(i)},__wbg_set_layout_913d53c17194c989:function(e,i){M(e).layout=M(i)},__wbg_set_layout_gpu_auto_layout_mode_0a5a185b3d52b726:function(e,i){M(e).layout=XP[i]},__wbg_set_layout_gpu_auto_layout_mode_aeba193938b47882:function(e,i){M(e).layout=XP[i]},__wbg_set_load_op_99661da6c4eab9b0:function(e,i){M(e).loadOp=Xx[i]},__wbg_set_lod_max_clamp_dd2d9f9f052f4f44:function(e,i){M(e).lodMaxClamp=i},__wbg_set_lod_min_clamp_6d20c97916baeb93:function(e,i){M(e).lodMinClamp=i},__wbg_set_loop_b622b726769860be:function(e,i){M(e).loop=i!==0},__wbg_set_mag_filter_b5adebc99cb938e1:function(e,i){M(e).magFilter=YP[i]},__wbg_set_mapped_at_creation_81b586dc90a50347:function(e,i){M(e).mappedAtCreation=i!==0},__wbg_set_mask_70a8a59ce09e5997:function(e,i){M(e).mask=i>>>0},__wbg_set_max_anisotropy_2beada0e2db62c45:function(e,i){M(e).maxAnisotropy=i},__wbg_set_method_7a6811dec7a4feff:function(e,i,n){M(e).method=Te(i,n)},__wbg_set_min_binding_size_f64_5005a6904cdf43da:function(e,i){M(e).minBindingSize=i},__wbg_set_min_filter_c72f17375e135f0a:function(e,i){M(e).minFilter=YP[i]},__wbg_set_mip_level_13253f3afc7aa58a:function(e,i){M(e).mipLevel=i>>>0},__wbg_set_mip_level_count_534caaa7e68e68b8:function(e,i){M(e).mipLevelCount=i>>>0},__wbg_set_mip_level_count_776c8c218b65bc08:function(e,i){M(e).mipLevelCount=i>>>0},__wbg_set_mip_level_f7ac79e8c54f59ad:function(e,i){M(e).mipLevel=i>>>0},__wbg_set_mipmap_filter_5bf66195a3639700:function(e,i){M(e).mipmapFilter=lH[i]},__wbg_set_mode_9990b3393ba469ae:function(e,i){M(e).mode=nH[i]},__wbg_set_mode_c90e3667002857d4:function(e,i){M(e).mode=yH[i]},__wbg_set_module_5db9b76ee2dd2a59:function(e,i){M(e).module=M(i)},__wbg_set_module_d0e2098713606cae:function(e,i){M(e).module=M(i)},__wbg_set_module_f02e076ca7e7daf8:function(e,i){M(e).module=M(i)},__wbg_set_multisample_37ddafe88b5cd466:function(e,i){M(e).multisample=M(i)},__wbg_set_multisampled_7913fd7183272840:function(e,i){M(e).multisampled=i!==0},__wbg_set_muted_16f1e7acd8244e28:function(e,i){M(e).muted=i!==0},__wbg_set_offset_f64_28c24dc15000932e:function(e,i){M(e).offset=i},__wbg_set_offset_f64_89f0ce01a689839e:function(e,i){M(e).offset=i},__wbg_set_offset_f64_b562d1367e34ef93:function(e,i){M(e).offset=i},__wbg_set_offset_f64_fa66068813376ca3:function(e,i){M(e).offset=i},__wbg_set_once_27df5233613a51cd:function(e,i){M(e).once=i!==0},__wbg_set_operation_62ce44e1728c4047:function(e,i){M(e).operation=tH[i]},__wbg_set_origin_gpu_origin_2d_dict_1240202973e56f92:function(e,i){M(e).origin=M(i)},__wbg_set_origin_gpu_origin_3d_dict_37222d7b3d238123:function(e,i){M(e).origin=M(i)},__wbg_set_origin_gpu_origin_3d_dict_631c04520718091f:function(e,i){M(e).origin=M(i)},__wbg_set_pass_op_cf02fa088d6352a7:function(e,i){M(e).passOp=$x[i]},__wbg_set_power_preference_8fdca0b7af640d49:function(e,i){M(e).powerPreference=hH[i]},__wbg_set_premultiplied_alpha_3f27816ad319d5a9:function(e,i){M(e).premultipliedAlpha=i!==0},__wbg_set_primitive_43c23761a55b4088:function(e,i){M(e).primitive=M(i)},__wbg_set_query_set_41de86d2401aee04:function(e,i){M(e).querySet=M(i)},__wbg_set_query_set_4889dd944d5ec0fd:function(e,i){M(e).querySet=M(i)},__wbg_set_r_c6f4c68f4804d655:function(e,i){M(e).r=i},__wbg_set_required_features_1baf274a8669db60:function(e,i,n){M(e).requiredFeatures=qs(i,n)},__wbg_set_required_limits_871ed33c68613dcb:function(e,i){M(e).requiredLimits=M(i)},__wbg_set_resolve_target_gpu_texture_view_b19a4f2debf79b96:function(e,i){M(e).resolveTarget=M(i)},__wbg_set_resource_5ae7b5e67924f234:function(e,i){M(e).resource=M(i)},__wbg_set_resource_gpu_buffer_binding_e5dbca063e7cb67b:function(e,i){M(e).resource=M(i)},__wbg_set_resource_gpu_texture_view_eb46c355d51ad7e5:function(e,i){M(e).resource=M(i)},__wbg_set_rows_per_image_5011f97318ee71af:function(e,i){M(e).rowsPerImage=i>>>0},__wbg_set_rows_per_image_59a813ac5006e10e:function(e,i){M(e).rowsPerImage=i>>>0},__wbg_set_sample_count_eb86a8b18545b54f:function(e,i){M(e).sampleCount=i>>>0},__wbg_set_sample_type_c32e1dfff94e63eb:function(e,i){M(e).sampleType=mH[i]},__wbg_set_sampler_c0e1258543a33bce:function(e,i){M(e).sampler=M(i)},__wbg_set_shader_location_7e1832a74f912217:function(e,i){M(e).shaderLocation=i>>>0},__wbg_set_size_f64_6bcd40704bf4cfdc:function(e,i){M(e).size=i},__wbg_set_size_f64_8b8f6bba5d678162:function(e,i){M(e).size=i},__wbg_set_size_gpu_extent_3d_dict_7e42e1c98fa36434:function(e,i){M(e).size=M(i)},__wbg_set_source_0c40b87cfdd5d704:function(e,i){M(e).source=M(i)},__wbg_set_source_html_canvas_element_f657e39507ba2fe5:function(e,i){M(e).source=M(i)},__wbg_set_source_html_image_element_fcc7cba0635adac1:function(e,i){M(e).source=M(i)},__wbg_set_source_html_video_element_e63a39653665f651:function(e,i){M(e).source=M(i)},__wbg_set_source_image_data_68478f1afce208b8:function(e,i){M(e).source=M(i)},__wbg_set_source_offscreen_canvas_266a3de949693e62:function(e,i){M(e).source=M(i)},__wbg_set_source_video_frame_3083c0ce54b9cb73:function(e,i){M(e).source=M(i)},__wbg_set_src_factor_9bfe84af9b7b5cac:function(e,i){M(e).srcFactor=$P[i]},__wbg_set_stencil_back_85b22f1db5b1940a:function(e,i){M(e).stencilBack=M(i)},__wbg_set_stencil_clear_value_42be608809151e2a:function(e,i){M(e).stencilClearValue=i>>>0},__wbg_set_stencil_front_525526164a798a44:function(e,i){M(e).stencilFront=M(i)},__wbg_set_stencil_load_op_31838c036993098a:function(e,i){M(e).stencilLoadOp=Xx[i]},__wbg_set_stencil_read_mask_5cc26495e8b3ae82:function(e,i){M(e).stencilReadMask=i>>>0},__wbg_set_stencil_read_only_bf1d0c1897e25c62:function(e,i){M(e).stencilReadOnly=i!==0},__wbg_set_stencil_store_op_e6be1cbc3a8fc210:function(e,i){M(e).stencilStoreOp=Yx[i]},__wbg_set_stencil_write_mask_d9cb40ec4b4bee5b:function(e,i){M(e).stencilWriteMask=i>>>0},__wbg_set_step_mode_a97bb24714da41a9:function(e,i){M(e).stepMode=vH[i]},__wbg_set_storage_texture_939a097db4b18bd4:function(e,i){M(e).storageTexture=M(i)},__wbg_set_store_op_b5fdf672436f13f3:function(e,i){M(e).storeOp=Yx[i]},__wbg_set_strip_index_format_9f787be6c5fc9e87:function(e,i){M(e).stripIndexFormat=qx[i]},__wbg_set_targets_c38bd200c836d66f:function(e,i,n){M(e).targets=qs(i,n)},__wbg_set_texture_016561d5911339e5:function(e,i){M(e).texture=M(i)},__wbg_set_texture_1f64653a5d2d7b4d:function(e,i){M(e).texture=M(i)},__wbg_set_texture_9dcedde1bb31eda6:function(e,i){M(e).texture=M(i)},__wbg_set_timestamp_writes_59c2d19ed8aecd97:function(e,i){M(e).timestampWrites=M(i)},__wbg_set_timestamp_writes_98bed1a8bbc6682d:function(e,i){M(e).timestampWrites=M(i)},__wbg_set_tone_mapping_b3464f1baa4cff92:function(e,i){M(e).toneMapping=M(i)},__wbg_set_topology_da25f2cc5af203d2:function(e,i){M(e).topology=cH[i]},__wbg_set_type_7f0457c6084dde9b:function(e,i){M(e).type=dH[i]},__wbg_set_type_ccf8472d40abcddf:function(e,i){M(e).type=uH[i]},__wbg_set_type_d09829f59932a0fc:function(e,i){M(e).type=eH[i]},__wbg_set_unclipped_depth_04524a2b44e1e3c1:function(e,i){M(e).unclippedDepth=i!==0},__wbg_set_usage_a137f82ca163b0a9:function(e,i){M(e).usage=i>>>0},__wbg_set_usage_b2a2935f37bf3d08:function(e,i){M(e).usage=i>>>0},__wbg_set_usage_ba5b0f8b333ab325:function(e,i){M(e).usage=i>>>0},__wbg_set_usage_ddd42599bbba7779:function(e,i){M(e).usage=i>>>0},__wbg_set_vertex_0be5d146f9ff6f36:function(e,i){M(e).vertex=M(i)},__wbg_set_view_dimension_0df554032f1f3a85:function(e,i){M(e).viewDimension=Kx[i]},__wbg_set_view_dimension_4818d4c18ce5815e:function(e,i){M(e).viewDimension=Kx[i]},__wbg_set_view_formats_4347dc8363331086:function(e,i,n){M(e).viewFormats=qs(i,n)},__wbg_set_view_formats_5797d2fff3c11808:function(e,i,n){M(e).viewFormats=qs(i,n)},__wbg_set_view_gpu_texture_view_9b2d86b6b99d9fd9:function(e,i){M(e).view=M(i)},__wbg_set_view_gpu_texture_view_c0f35f8857c25206:function(e,i){M(e).view=M(i)},__wbg_set_visibility_9570b037224c4cc2:function(e,i){M(e).visibility=i>>>0},__wbg_set_volume_520cdc6b7ada8f76:function(e,i){M(e).volume=i},__wbg_set_width_7ca43f32db1cfe8e:function(e,i){M(e).width=i>>>0},__wbg_set_width_87301412247f3343:function(e,i){M(e).width=i>>>0},__wbg_set_width_9f685402c2cbee70:function(e,i){M(e).width=i>>>0},__wbg_set_write_mask_d45279e56abbfcb5:function(e,i){M(e).writeMask=i>>>0},__wbg_set_x_232d24fdc32d8351:function(e,i){M(e).x=i>>>0},__wbg_set_x_876d592971db129a:function(e,i){M(e).x=i>>>0},__wbg_set_y_18fe375093e59dfb:function(e,i){M(e).y=i>>>0},__wbg_set_y_2b1f5ac0dd5586a5:function(e,i){M(e).y=i>>>0},__wbg_set_z_ef005d82bc9d24e3:function(e,i){M(e).z=i>>>0},__wbg_shaderSource_7d18b5a43a504f5c:function(e,i,n,r){M(e).shaderSource(M(i),Te(n,r))},__wbg_shaderSource_df5bb6320451f3cd:function(e,i,n,r){M(e).shaderSource(M(i),Te(n,r))},__wbg_size_211f88d386430781:function(e){return M(e).size},__wbg_src_f0e9281991fbd919:function(e,i){let n=M(i).src,r=Zi(n,K.__wbindgen_export,K.__wbindgen_export2),s=Si;ie().setInt32(e+4,s,!0),ie().setInt32(e+0,r,!0)},__wbg_stack_3b0d974bbf31e44f:function(e,i){let n=M(i).stack,r=Zi(n,K.__wbindgen_export,K.__wbindgen_export2),s=Si;ie().setInt32(e+4,s,!0),ie().setInt32(e+0,r,!0)},__wbg_static_accessor_GLOBAL_9d53f2689e622ca1:function(){let e=typeof global>"u"?null:global;return ne(e)?0:H(e)},__wbg_static_accessor_GLOBAL_THIS_a1a35cec07001a8a:function(){let e=typeof globalThis>"u"?null:globalThis;return ne(e)?0:H(e)},__wbg_static_accessor_SELF_4c59f6c7ea29a144:function(){let e=typeof self>"u"?null:self;return ne(e)?0:H(e)},__wbg_static_accessor_WINDOW_e70ae9f2eb052253:function(){let e=typeof window>"u"?null:window;return ne(e)?0:H(e)},__wbg_stencilFunc_8f53a5508560354d:function(e,i,n,r){M(e).stencilFunc(i>>>0,n,r>>>0)},__wbg_stencilFunc_c7553215f237ee38:function(e,i,n,r){M(e).stencilFunc(i>>>0,n,r>>>0)},__wbg_stencilOp_a844a4e9824eee70:function(e,i,n,r){M(e).stencilOp(i>>>0,n>>>0,r>>>0)},__wbg_stencilOp_e82bd7ea13f18adf:function(e,i,n,r){M(e).stencilOp(i>>>0,n>>>0,r>>>0)},__wbg_subgroupMaxSize_1527c5f7a8fe91bb:function(e){return M(e).subgroupMaxSize},__wbg_subgroupMinSize_d6c5ad4bddc828e9:function(e){return M(e).subgroupMinSize},__wbg_submit_ce44115121cd166c:function(e,i,n){M(e).submit(qs(i,n))},__wbg_texImage2D_01c22558517ee8db:function(){return Zt(function(e,i,n,r,s,a,o){M(e).texImage2D(i>>>0,n,r,s>>>0,a>>>0,M(o))},arguments)},__wbg_texImage2D_152e9dcd4bc3a464:function(){return Zt(function(e,i,n,r,s,a,o,l,c,h){M(e).texImage2D(i>>>0,n,r,s,a,o,l>>>0,c>>>0,M(h))},arguments)},__wbg_texImage2D_3704db20a16b6c35:function(){return Zt(function(e,i,n,r,s,a,o,l,c,h){M(e).texImage2D(i>>>0,n,r,s,a,o,l>>>0,c>>>0,M(h))},arguments)},__wbg_texImage2D_63d0b87d5ebe4a7f:function(){return Zt(function(e,i,n,r,s,a,o){M(e).texImage2D(i>>>0,n,r,s>>>0,a>>>0,M(o))},arguments)},__wbg_texImage2D_90633e994ded3d2b:function(){return Zt(function(e,i,n,r,s,a,o){M(e).texImage2D(i>>>0,n,r,s>>>0,a>>>0,M(o))},arguments)},__wbg_texImage2D_ea94e8a2df5f97e2:function(){return Zt(function(e,i,n,r,s,a,o,l,c,h){M(e).texImage2D(i>>>0,n,r,s,a,o,l>>>0,c>>>0,h)},arguments)},__wbg_texImage2D_facfa039fb461b66:function(){return Zt(function(e,i,n,r,s,a,o){M(e).texImage2D(i>>>0,n,r,s>>>0,a>>>0,M(o))},arguments)},__wbg_texParameteri_87ebfcefb0af2c50:function(e,i,n,r){M(e).texParameteri(i>>>0,n>>>0,r)},__wbg_texParameteri_e5ad2054e239066e:function(e,i,n,r){M(e).texParameteri(i>>>0,n>>>0,r)},__wbg_texStorage2D_bb2a1bd1ab0b9184:function(e,i,n,r,s,a){M(e).texStorage2D(i>>>0,n,r>>>0,s,a)},__wbg_texSubImage2D_3483ba5f10ee42c2:function(){return Zt(function(e,i,n,r,s,a,o,l){M(e).texSubImage2D(i>>>0,n,r,s,a>>>0,o>>>0,M(l))},arguments)},__wbg_texSubImage2D_4ca4c3faa4392438:function(){return Zt(function(e,i,n,r,s,a,o,l,c,h){M(e).texSubImage2D(i>>>0,n,r,s,a,o,l>>>0,c>>>0,M(h))},arguments)},__wbg_texSubImage2D_54d18572b1ba74ab:function(){return Zt(function(e,i,n,r,s,a,o,l,c,h){M(e).texSubImage2D(i>>>0,n,r,s,a,o,l>>>0,c>>>0,h)},arguments)},__wbg_texSubImage2D_5bebe93724e6ed61:function(){return Zt(function(e,i,n,r,s,a,o,l,c,h){M(e).texSubImage2D(i>>>0,n,r,s,a,o,l>>>0,c>>>0,M(h))},arguments)},__wbg_texSubImage2D_5e1594de0416e9f6:function(){return Zt(function(e,i,n,r,s,a,o,l){M(e).texSubImage2D(i>>>0,n,r,s,a>>>0,o>>>0,M(l))},arguments)},__wbg_then_18f476d590e58992:function(e,i,n){let r=M(e).then(M(i),M(n));return H(r)},__wbg_then_47213a40b6aeb86c:function(e,i){let n=M(e).then(M(i));return H(n)},__wbg_then_ac7b025999b52837:function(e,i){let n=M(e).then(M(i));return H(n)},__wbg_type_71742b859467fa3c:function(e){return M(e).type},__wbg_unconfigure_0a07a0a40de8988d:function(e){M(e).unconfigure()},__wbg_uniform1f_8c3b3e6e3723fe14:function(e,i,n){M(e).uniform1f(M(i),n)},__wbg_uniform1f_d6619faa73c2a45f:function(e,i,n){M(e).uniform1f(M(i),n)},__wbg_uniform1fv_11d5842aff79c8a3:function(e,i,n,r){M(e).uniform1fv(M(i),ls(n,r))},__wbg_uniform1fv_b4b087b4d6e2bb25:function(e,i,n,r){M(e).uniform1fv(M(i),ls(n,r))},__wbg_uniform1i_14982bb8438243b4:function(e,i,n){M(e).uniform1i(M(i),n)},__wbg_uniform1i_cf11d5b364eed1c8:function(e,i,n){M(e).uniform1i(M(i),n)},__wbg_uniform1ui_d177882f473d2afc:function(e,i,n){M(e).uniform1ui(M(i),n>>>0)},__wbg_uniform2f_19fb96222ae72e1a:function(e,i,n,r){M(e).uniform2f(M(i),n,r)},__wbg_uniform2f_44cee47e30b82f96:function(e,i,n,r){M(e).uniform2f(M(i),n,r)},__wbg_uniform2fv_2f06d989ec4b5d8f:function(e,i,n,r){M(e).uniform2fv(M(i),ls(n,r))},__wbg_uniform2fv_f022309b362a80c3:function(e,i,n,r){M(e).uniform2fv(M(i),ls(n,r))},__wbg_uniform2i_16e8a2c966614be6:function(e,i,n,r){M(e).uniform2i(M(i),n,r)},__wbg_uniform2i_d353da02172ea38d:function(e,i,n,r){M(e).uniform2i(M(i),n,r)},__wbg_uniform3f_360c1ea4c73cacef:function(e,i,n,r,s){M(e).uniform3f(M(i),n,r,s)},__wbg_uniform3f_b616f9e06266a25f:function(e,i,n,r,s){M(e).uniform3f(M(i),n,r,s)},__wbg_uniform4f_f1a670d511b34878:function(e,i,n,r,s,a){M(e).uniform4f(M(i),n,r,s,a)},__wbg_uniform4f_f97f3f59af09856f:function(e,i,n,r,s,a){M(e).uniform4f(M(i),n,r,s,a)},__wbg_uniformMatrix3fv_f45b91f173d7fbed:function(e,i,n,r,s){M(e).uniformMatrix3fv(M(i),n!==0,ls(r,s))},__wbg_uniformMatrix3fv_feab3f952d705f51:function(e,i,n,r,s){M(e).uniformMatrix3fv(M(i),n!==0,ls(r,s))},__wbg_uniformMatrix3x2fv_ab13f9742e5fcb2f:function(e,i,n,r,s){M(e).uniformMatrix3x2fv(M(i),n!==0,ls(r,s))},__wbg_uniformMatrix4fv_540dc6bf792eba8f:function(e,i,n,r,s){M(e).uniformMatrix4fv(M(i),n!==0,ls(r,s))},__wbg_uniformMatrix4fv_e3dac9dd429d6adc:function(e,i,n,r,s){M(e).uniformMatrix4fv(M(i),n!==0,ls(r,s))},__wbg_uniformMatrix4x3fv_115d029ad3124cef:function(e,i,n,r,s){M(e).uniformMatrix4x3fv(M(i),n!==0,ls(r,s))},__wbg_unmap_adaf93276fdf9aaf:function(e){M(e).unmap()},__wbg_useProgram_55a3e940abb19137:function(e,i){M(e).useProgram(M(i))},__wbg_useProgram_e24dadf4c06636f5:function(e,i){M(e).useProgram(M(i))},__wbg_userAgent_8def8135d886414b:function(){return Zt(function(e,i){let n=M(i).userAgent,r=Zi(n,K.__wbindgen_export,K.__wbindgen_export2),s=Si;ie().setInt32(e+4,s,!0),ie().setInt32(e+0,r,!0)},arguments)},__wbg_valueOf_41ae57308c1f031c:function(e){return M(e).valueOf()},__wbg_value_f3625092ee4b37f4:function(e){let i=M(e).value;return H(i)},__wbg_vertexAttrib4f_6444504b25f4d43e:function(e,i,n,r,s,a){M(e).vertexAttrib4f(i>>>0,n,r,s,a)},__wbg_vertexAttrib4f_aad41fe000407191:function(e,i,n,r,s,a){M(e).vertexAttrib4f(i>>>0,n,r,s,a)},__wbg_vertexAttribIPointer_ed1c3507e84527e2:function(e,i,n,r,s,a){M(e).vertexAttribIPointer(i>>>0,n,r>>>0,s,a)},__wbg_vertexAttribPointer_39eddea7c20e350c:function(e,i,n,r,s,a,o){M(e).vertexAttribPointer(i>>>0,n,r>>>0,s!==0,a,o)},__wbg_vertexAttribPointer_3bc50c0431082f73:function(e,i,n,r,s,a,o){M(e).vertexAttribPointer(i>>>0,n,r>>>0,s!==0,a,o)},__wbg_videoFrameToken_6f05524e85fa2b75:function(e){return VP(M(e))},__wbg_videoHeight_e267fd1e74bb1b06:function(e){return M(e).videoHeight},__wbg_videoWidth_670b8e775ea04b5d:function(e){return M(e).videoWidth},__wbg_viewport_14d947f2faf58e85:function(e,i,n,r,s){M(e).viewport(i,n,r,s)},__wbg_viewport_24055b0754803788:function(e,i,n,r,s){M(e).viewport(i,n,r,s)},__wbg_warn_410c3261e3c6d686:function(e){console.warn(M(e))},__wbg_width_f1791280fae1517a:function(e){return M(e).width},__wbg_writeTexture_53ba204c494b042c:function(){return Zt(function(e,i,n,r,s,a){M(e).writeTexture(M(i),gl(n,r),M(s),M(a))},arguments)},__wbindgen_cast_0000000000000001:function(e,i){let n=go(e,i,$G);return H(n)},__wbindgen_cast_0000000000000002:function(e,i){let n=go(e,i,qG);return H(n)},__wbindgen_cast_0000000000000003:function(e,i){let n=go(e,i,YG);return H(n)},__wbindgen_cast_0000000000000004:function(e,i){let n=go(e,i,ZG);return H(n)},__wbindgen_cast_0000000000000005:function(e,i){let n=go(e,i,XG);return H(n)},__wbindgen_cast_0000000000000006:function(e,i){let n=go(e,i,KG);return H(n)},__wbindgen_cast_0000000000000007:function(e,i){let n=go(e,i,QG);return H(n)},__wbindgen_cast_0000000000000008:function(e,i){let n=go(e,i,JG);return H(n)},__wbindgen_cast_0000000000000009:function(e,i){let n=go(e,i,WG);return H(n)},__wbindgen_cast_000000000000000a:function(e){return H(e)},__wbindgen_cast_000000000000000b:function(e,i){let n=ls(e,i);return H(n)},__wbindgen_cast_000000000000000c:function(e,i){let n=SH(e,i);return H(n)},__wbindgen_cast_000000000000000d:function(e,i){let n=tD(e,i);return H(n)},__wbindgen_cast_000000000000000e:function(e,i){let n=MH(e,i);return H(n)},__wbindgen_cast_000000000000000f:function(e,i){let n=EH(e,i);return H(n)},__wbindgen_cast_0000000000000010:function(e,i){let n=Gp(e,i);return H(n)},__wbindgen_cast_0000000000000011:function(e,i){let n=gl(e,i);return H(n)},__wbindgen_cast_0000000000000012:function(e,i){let n=Te(e,i);return H(n)},__wbindgen_cast_0000000000000013:function(e){let i=BigInt.asUintN(64,e);return H(i)},__wbindgen_cast_0000000000000014:function(e,i){var n=gl(e,i).slice();return K.__wbindgen_export4(e,i*1,1),H(n)},__wbindgen_object_clone_ref:function(e){let i=M(e);return H(i)},__wbindgen_object_drop_ref:function(e){Kt(e)}}}}function WG(t,e){K.__wasm_bindgen_func_elem_12547(t,e)}function qG(t,e,i){K.__wasm_bindgen_func_elem_5119(t,e,H(i))}function XG(t,e,i){K.__wasm_bindgen_func_elem_11141(t,e,H(i))}function $G(t,e,i){try{let s=K.__wbindgen_add_to_stack_pointer(-16);K.__wasm_bindgen_func_elem_14184(s,t,e,H(i));var n=ie().getInt32(s+4*0,!0),r=ie().getInt32(s+4*1,!0);if(r)throw Kt(n)}finally{K.__wbindgen_add_to_stack_pointer(16)}}function YG(t,e,i){try{let s=K.__wbindgen_add_to_stack_pointer(-16);K.__wasm_bindgen_func_elem_11140(s,t,e,H(i));var n=ie().getInt32(s+4*0,!0),r=ie().getInt32(s+4*1,!0);if(r)throw Kt(n)}finally{K.__wbindgen_add_to_stack_pointer(16)}}function ZG(t,e,i){try{let s=K.__wbindgen_add_to_stack_pointer(-16);K.__wasm_bindgen_func_elem_11140_3(s,t,e,H(i));var n=ie().getInt32(s+4*0,!0),r=ie().getInt32(s+4*1,!0);if(r)throw Kt(n)}finally{K.__wbindgen_add_to_stack_pointer(16)}}function KG(t,e,i){try{let s=K.__wbindgen_add_to_stack_pointer(-16);K.__wasm_bindgen_func_elem_11140_5(s,t,e,H(i));var n=ie().getInt32(s+4*0,!0),r=ie().getInt32(s+4*1,!0);if(r)throw Kt(n)}finally{K.__wbindgen_add_to_stack_pointer(16)}}function QG(t,e,i){try{let s=K.__wbindgen_add_to_stack_pointer(-16);K.__wasm_bindgen_func_elem_11140_6(s,t,e,H(i));var n=ie().getInt32(s+4*0,!0),r=ie().getInt32(s+4*1,!0);if(r)throw Kt(n)}finally{K.__wbindgen_add_to_stack_pointer(16)}}function JG(t,e,i){try{let s=K.__wbindgen_add_to_stack_pointer(-16);K.__wasm_bindgen_func_elem_11140_7(s,t,e,H(i));var n=ie().getInt32(s+4*0,!0),r=ie().getInt32(s+4*1,!0);if(r)throw Kt(n)}finally{K.__wbindgen_add_to_stack_pointer(16)}}function qP(t,e,i,n){K.__wasm_bindgen_func_elem_14186(t,e,H(i),H(n))}function H(t){Jp===Xs.length&&Xs.push(Xs.length+1);let e=Jp;return Jp=Xs[e],Xs[e]=t,e}function bH(t){if(m0==1)throw new Error("out of js stack");return Xs[--m0]=t,m0}function Jx(t){let e=typeof t;if(e=="number"||e=="boolean"||t==null)return`${t}`;if(e=="string")return`"${t}"`;if(e=="symbol"){let r=t.description;return r==null?"Symbol":`Symbol(${r})`}if(e=="function"){let r=t.name;return typeof r=="string"&&r.length>0?`Function(${r})`:"Function"}if(Array.isArray(t)){let r=t.length,s="[";r>0&&(s+=Jx(t[0]));for(let a=1;a<r;a++)s+=", "+Jx(t[a]);return s+="]",s}let i=/\[object ([^\]]+)\]/.exec(toString.call(t)),n;if(i&&i.length>1)n=i[1];else return toString.call(t);if(n=="Object")try{return"Object("+JSON.stringify(t)+")"}catch{return"Object"}return t instanceof Error?`${t.name}: ${t.message}
|
|
35
|
+
`;let s=new TextEncoder().encode(r),a=n*2*4,o=t.xyz.quantized.data.buffer.byteLength,l=t.xyz instanceof Yi?a:0,c=t.color.quantized.data.buffer.byteLength,h=t.color instanceof Yi?a:0,d=t.opacity.quantized.data.buffer.byteLength,u=t.opacity instanceof Yi?a:0,p=t.scaling.quantized.data.buffer.byteLength,f=t.scaling instanceof Yi?a:0,g=t.quaternion.quantized.data.buffer.byteLength,m=t.quaternion instanceof Yi?a:0,y=t.variableChunkSize?Uint16Array.from(t.variableChunkSize):void 0,v=y?y.byteLength:0,_=s.byteLength+v+o+l+c+h+d+u+p+f+g+m,b=0,x=0;if(t.harmonics&&t.harmonics.length>0)for(let A=0;A<t.harmonics.length;A++)b+=t.harmonics[A].quantized.data.buffer.byteLength,x+=t.harmonics[A]instanceof Yi?a:0;b=0,x=0,_+=b+x;let w=new Uint8Array(_),S=0;if(w.set(s,S),S+=s.byteLength,v>0&&(w.set(new Uint8Array(y.buffer),S),S+=v),t.xyz instanceof Yi&&(w.set(new Uint8Array(t.xyz.minmaxMatrix.data.buffer),S),S+=a),w.set(new Uint8Array(t.xyz.quantized.data.buffer),S),S+=o,t.color instanceof Yi&&(w.set(new Uint8Array(t.color.minmaxMatrix.data.buffer),S),S+=a),w.set(new Uint8Array(t.color.quantized.data.buffer),S),S+=c,t.opacity instanceof Yi&&(w.set(new Uint8Array(t.opacity.minmaxMatrix.data.buffer),S),S+=a),w.set(new Uint8Array(t.opacity.quantized.data.buffer),S),S+=d,t.scaling instanceof Yi&&(w.set(new Uint8Array(t.scaling.minmaxMatrix.data.buffer),S),S+=a),w.set(new Uint8Array(t.scaling.quantized.data.buffer),S),S+=p,t.quaternion instanceof Yi&&(w.set(new Uint8Array(t.quaternion.minmaxMatrix.data.buffer),S),S+=a),w.set(new Uint8Array(t.quaternion.quantized.data.buffer),S),S+=g,b>0&&t.harmonics&&t.harmonics.length>0)for(let A=0;A<t.harmonics.length;A++){let E=t.harmonics[A];E instanceof Yi&&(w.set(new Uint8Array(E.minmaxMatrix.data.buffer),S),S+=a),w.set(new Uint8Array(E.quantized.data.buffer),S),S+=E.quantized.data.byteLength}return new Nx(w.buffer)}}});async function NP(t){return createImageBitmap(new Blob([t]))}async function kP(t){return fetch(t).then(e=>{if(!e.ok)throw new Error(`Failed to fetch image: ${e.statusText}`);return e.blob()}).then(e=>createImageBitmap(e))}function LG(t){if(typeof t.requestVideoFrameCallback!="function"){t.hanaClockBase=++jx*RG;return}t.hanaPresentedFrames=++jx;let e=()=>{t.hanaDisposed||(t.hanaPresentedFrames=++jx)};t.addEventListener("seeked",e);let i=()=>{e(),!t.hanaDisposed&&(t.hanaFrameCallback=t.requestVideoFrameCallback(i))};t.hanaFrameCallback=t.requestVideoFrameCallback(i)}function VP(t){let e=t.hanaPresentedFrames;return e===void 0?t.hanaClockBase+t.currentTime:e}function BG(t,e){t.hanaObjectUrl=URL.createObjectURL(e),t.src=t.hanaObjectUrl}function Gx(t){if(t.hanaDisposed)return;t.hanaDisposed=!0;let e=t.hanaFrameCallback;e!==void 0&&(t.hanaFrameCallback=void 0,typeof t.cancelVideoFrameCallback=="function"&&t.cancelVideoFrameCallback(e));let i=t.hanaObjectUrl;i!==void 0&&(t.hanaObjectUrl=void 0,URL.revokeObjectURL(i)),t.pause(),t.removeAttribute("src"),t.load()}function UG(t){let e=n=>{let r=t.error;return new Error(r===null?n:`${n} (code ${r.code}: ${r.message})`)},i=n=>{let r=e(n);return Gx(t),r};return t.error!==null?Promise.reject(i("video failed to load")):t.readyState>=IG?Promise.resolve(t):new Promise((n,r)=>{let s=setTimeout(()=>a(r,i("video timed out before presenting a frame")),OG),a=(c,h)=>{clearTimeout(s),t.removeEventListener("loadeddata",o),t.removeEventListener("canplay",o),t.removeEventListener("error",l),c(h)},o=()=>a(n,t),l=()=>a(r,i("video failed to load"));t.addEventListener("loadeddata",o),t.addEventListener("canplay",o),t.addEventListener("error",l)})}function jP(t){return t.preload="auto",t.autoplay=!0,t.loop=!0,t.muted=!0,t.playsInline=!0,t.currentTime=.01,t.load(),t.onloadeddata=()=>{t.muted=!0;let e=t.play();e!==void 0&&e.then(i=>{}).catch(()=>{t.play()}).finally(()=>{t.pause()})},LG(t),UG(t)}async function GP(t){let e=document.createElement("video");return BG(e,new Blob([t])),jP(e)}async function HP(t){let e=document.createElement("video");return e.crossOrigin="anonymous",e.src=t,jP(e)}var jx,RG,IG,OG,WP=c0(()=>{"use strict";jx=0,RG=1e6,IG=2,OG=3e4});var rD={};lP(rD,{DeviceLostPromise:()=>vl,Engine:()=>yl,PixelReadPromise:()=>vo,SceneController:()=>ef,addRealizedChild:()=>zG,componentInstanceRefreshOps:()=>FG,default:()=>NH,dematerializeInstance:()=>NG,duplicateComponentInstance:()=>kG,initSync:()=>FH,overrideForRealizedEdit:()=>VG,realizeComponentInstance:()=>jG,removeRealizedNode:()=>GG,web_init:()=>HG});function zG(t,e,i,n,r){let s=K.addRealizedChild(H(t),H(e),H(i),H(n),H(r));return Kt(s)}function FG(t,e,i,n,r){let s=K.componentInstanceRefreshOps(H(t),H(e),H(i),H(n),H(r));return Kt(s)}function NG(t,e,i,n){let r=K.dematerializeInstance(H(t),H(e),H(i),H(n));return Kt(r)}function kG(t,e,i,n){let r=K.duplicateComponentInstance(H(t),H(e),H(i),H(n));return Kt(r)}function VG(t,e,i,n,r){let s=K.overrideForRealizedEdit(H(t),H(e),H(i),H(n),H(r));return Kt(s)}function jG(t,e,i){let n=K.realizeComponentInstance(H(t),H(e),H(i));return Kt(n)}function GG(t,e,i,n){let r=K.removeRealizedNode(H(t),H(e),H(i),H(n));return Kt(r)}function HG(){K.web_init()}function iD(){return{__proto__:null,"./hana_bg.js":{__proto__:null,__wbg_Error_ef53bc310eb298a0:function(e,i){let n=Error(Te(e,i));return H(n)},__wbg_Number_6b506e6536831eaa:function(e){return Number(M(e))},__wbg_Window_afcc911b2f9c92e2:function(e){let i=M(e).Window;return H(i)},__wbg_WorkerGlobalScope_5d19ebc889ff397e:function(e){let i=M(e).WorkerGlobalScope;return H(i)},__wbg___wbindgen_bigint_get_as_i64_38130e98eecd467d:function(e,i){let n=M(i),r=typeof n=="bigint"?n:void 0;ie().setBigInt64(e+8,ne(r)?BigInt(0):r,!0),ie().setInt32(e+0,!ne(r),!0)},__wbg___wbindgen_boolean_get_1a45e2c38d4d41b9:function(e){let i=M(e),n=typeof i=="boolean"?i:void 0;return ne(n)?16777215:n?1:0},__wbg___wbindgen_debug_string_0accd80f45e5faa2:function(e,i){let n=Jx(M(i)),r=Zi(n,K.__wbindgen_export,K.__wbindgen_export2),s=Si;ie().setInt32(e+4,s,!0),ie().setInt32(e+0,r,!0)},__wbg___wbindgen_in_70a403a56e771704:function(e,i){return M(e)in M(i)},__wbg___wbindgen_is_bigint_6ffd6468a9bc44b9:function(e){return typeof M(e)=="bigint"},__wbg___wbindgen_is_function_754e9f305ff6029e:function(e){return typeof M(e)=="function"},__wbg___wbindgen_is_null_87c3bfe968c6a5ad:function(e){return M(e)===null},__wbg___wbindgen_is_null_or_undefined_cf617b836541fad3:function(e){return M(e)==null},__wbg___wbindgen_is_object_56732c2bc353f41d:function(e){let i=M(e);return typeof i=="object"&&i!==null},__wbg___wbindgen_is_string_c236cabd84a4d769:function(e){return typeof M(e)=="string"},__wbg___wbindgen_is_undefined_67b456be8673d3d7:function(e){return M(e)===void 0},__wbg___wbindgen_jsval_eq_1068e624fa87f6ab:function(e,i){return M(e)===M(i)},__wbg___wbindgen_jsval_loose_eq_2c56564c75129511:function(e,i){return M(e)==M(i)},__wbg___wbindgen_number_get_9bb1761122181af2:function(e,i){let n=M(i),r=typeof n=="number"?n:void 0;ie().setFloat64(e+8,ne(r)?0:r,!0),ie().setInt32(e+0,!ne(r),!0)},__wbg___wbindgen_string_get_72bdf95d3ae505b1:function(e,i){let n=M(i),r=typeof n=="string"?n:void 0;var s=ne(r)?0:Zi(r,K.__wbindgen_export,K.__wbindgen_export2),a=Si;ie().setInt32(e+4,a,!0),ie().setInt32(e+0,s,!0)},__wbg___wbindgen_throw_1506f2235d1bdba0:function(e,i){throw new Error(Te(e,i))},__wbg__wbg_cb_unref_61db23ac97f16c31:function(e){M(e)._wbg_cb_unref()},__wbg_activeTexture_7a0d6fe7120979ce:function(e,i){M(e).activeTexture(i>>>0)},__wbg_activeTexture_dd15c31d50b73529:function(e,i){M(e).activeTexture(i>>>0)},__wbg_addEventListener_5593b0efd622abd6:function(){return Zt(function(e,i,n,r,s){M(e).addEventListener(Te(i,n),M(r),M(s))},arguments)},__wbg_arrayBuffer_05927079aabe6d46:function(){return Zt(function(e){let i=M(e).arrayBuffer();return H(i)},arguments)},__wbg_assign_551ec2d000f70c24:function(){return Zt(function(e,i,n){M(e).assign(Te(i,n))},arguments)},__wbg_attachShader_5c6a46e7c0fc637a:function(e,i,n){M(e).attachShader(M(i),M(n))},__wbg_attachShader_c2b12b36afa45936:function(e,i,n){M(e).attachShader(M(i),M(n))},__wbg_beginComputePass_431a159006c13c7c:function(e,i){let n=M(e).beginComputePass(M(i));return H(n)},__wbg_beginRenderPass_aa22c432e793359a:function(){return Zt(function(e,i){let n=M(e).beginRenderPass(M(i));return H(n)},arguments)},__wbg_bindBuffer_3841df88ccee4ed0:function(e,i,n){M(e).bindBuffer(i>>>0,M(n))},__wbg_bindBuffer_aa5dc7dc1c8ad1c8:function(e,i,n){M(e).bindBuffer(i>>>0,M(n))},__wbg_bindFramebuffer_10bbdf7040d89a17:function(e,i,n){M(e).bindFramebuffer(i>>>0,M(n))},__wbg_bindFramebuffer_ee8e42543c29c602:function(e,i,n){M(e).bindFramebuffer(i>>>0,M(n))},__wbg_bindRenderbuffer_7808d8eabbe18554:function(e,i,n){M(e).bindRenderbuffer(i>>>0,M(n))},__wbg_bindRenderbuffer_c0360bfb79c193c2:function(e,i,n){M(e).bindRenderbuffer(i>>>0,M(n))},__wbg_bindTexture_28d1d695d4801955:function(e,i,n){M(e).bindTexture(i>>>0,M(n))},__wbg_bindTexture_a1a012a31e1419d5:function(e,i,n){M(e).bindTexture(i>>>0,M(n))},__wbg_bindVertexArrayOES_15e48910a5d208b1:function(e,i){M(e).bindVertexArrayOES(M(i))},__wbg_bindVertexArray_4f2f0a7892280041:function(e,i){M(e).bindVertexArray(M(i))},__wbg_blendEquation_1ced323efc9ce0f8:function(e,i){M(e).blendEquation(i>>>0)},__wbg_blendEquation_a12f5acd9d14fb9b:function(e,i){M(e).blendEquation(i>>>0)},__wbg_blendFunc_d5202c7fe94c67ee:function(e,i,n){M(e).blendFunc(i>>>0,n>>>0)},__wbg_blendFunc_fbff85cd0fce280e:function(e,i,n){M(e).blendFunc(i>>>0,n>>>0)},__wbg_blitFramebuffer_acb954bfb30ed714:function(e,i,n,r,s,a,o,l,c,h,d){M(e).blitFramebuffer(i,n,r,s,a,o,l,c,h>>>0,d>>>0)},__wbg_bufferData_043a7e5da22f40d9:function(e,i,n,r){M(e).bufferData(i>>>0,n,r>>>0)},__wbg_bufferData_7b6881381d415425:function(e,i,n,r){M(e).bufferData(i>>>0,M(n),r>>>0)},__wbg_bufferData_9fddca30299e6114:function(e,i,n,r){M(e).bufferData(i>>>0,n,r>>>0)},__wbg_bufferData_f0837cec09725cc0:function(e,i,n,r){M(e).bufferData(i>>>0,M(n),r>>>0)},__wbg_bufferSubData_885e4f8d5833cf11:function(e,i,n,r){M(e).bufferSubData(i>>>0,n,M(r))},__wbg_bufferSubData_8fc824b6a9503f12:function(e,i,n,r){M(e).bufferSubData(i>>>0,n,M(r))},__wbg_call_8a89609d89f6608a:function(){return Zt(function(e,i){let n=M(e).call(M(i));return H(n)},arguments)},__wbg_call_9c758de292015997:function(){return Zt(function(e,i,n){let r=M(e).call(M(i),M(n));return H(r)},arguments)},__wbg_clearBufferfv_2e2858bd8bcf1715:function(e,i,n,r,s){M(e).clearBufferfv(i>>>0,n,ls(r,s))},__wbg_clearBufferiv_e356514eb1d165fe:function(e,i,n,r,s){M(e).clearBufferiv(i>>>0,n,tD(r,s))},__wbg_compileShader_8810a4868b23621b:function(e,i){M(e).compileShader(M(i))},__wbg_compileShader_ec8d5eb7f2b70a48:function(e,i){M(e).compileShader(M(i))},__wbg_configure_0e4789c0f6b35c8e:function(){return Zt(function(e,i){M(e).configure(M(i))},arguments)},__wbg_copyBufferSubData_9936fdf5e53e1832:function(e,i,n,r,s,a){M(e).copyBufferSubData(i>>>0,n>>>0,r,s,a)},__wbg_copyBufferToBuffer_5e2cd8f10ae78183:function(){return Zt(function(e,i,n,r,s){M(e).copyBufferToBuffer(M(i),n,M(r),s)},arguments)},__wbg_copyBufferToBuffer_ca30deb8de65f5d5:function(){return Zt(function(e,i,n,r,s,a){M(e).copyBufferToBuffer(M(i),n,M(r),s,a)},arguments)},__wbg_copyExternalImageToTexture_4df105bb39517948:function(){return Zt(function(e,i,n,r){M(e).copyExternalImageToTexture(M(i),M(n),M(r))},arguments)},__wbg_copyTextureToBuffer_ed6e67a77ecb768d:function(){return Zt(function(e,i,n,r){M(e).copyTextureToBuffer(M(i),M(n),M(r))},arguments)},__wbg_createBindGroupLayout_49a7e2b3d076afcf:function(){return Zt(function(e,i){let n=M(e).createBindGroupLayout(M(i));return H(n)},arguments)},__wbg_createBindGroup_655c6e6c0258530e:function(e,i){let n=M(e).createBindGroup(M(i));return H(n)},__wbg_createBuffer_0726dd2ab09ea1d2:function(){return Zt(function(e,i){let n=M(e).createBuffer(M(i));return H(n)},arguments)},__wbg_createBuffer_333d6aae40284594:function(e){let i=M(e).createBuffer();return ne(i)?0:H(i)},__wbg_createBuffer_3ae54605e5676c83:function(e){let i=M(e).createBuffer();return ne(i)?0:H(i)},__wbg_createCommandEncoder_ec1f40f0cb4d09df:function(e,i){let n=M(e).createCommandEncoder(M(i));return H(n)},__wbg_createComputePipelineAsync_afe7021ac5a02993:function(e,i){let n=M(e).createComputePipelineAsync(M(i));return H(n)},__wbg_createFramebuffer_6f42ff976bb98152:function(e){let i=M(e).createFramebuffer();return ne(i)?0:H(i)},__wbg_createFramebuffer_ef1247e8b2e9b09f:function(e){let i=M(e).createFramebuffer();return ne(i)?0:H(i)},__wbg_createPipelineLayout_2c8cd4528b06c108:function(e,i){let n=M(e).createPipelineLayout(M(i));return H(n)},__wbg_createProgram_b48c3323af547213:function(e){let i=M(e).createProgram();return ne(i)?0:H(i)},__wbg_createProgram_f6a8df4491031d57:function(e){let i=M(e).createProgram();return ne(i)?0:H(i)},__wbg_createQuerySet_cb7b21d1d405b890:function(){return Zt(function(e,i){let n=M(e).createQuerySet(M(i));return H(n)},arguments)},__wbg_createRenderPipelineAsync_eecad1e54ef27acf:function(e,i){let n=M(e).createRenderPipelineAsync(M(i));return H(n)},__wbg_createRenderPipeline_cf98d4d699bfb03c:function(){return Zt(function(e,i){let n=M(e).createRenderPipeline(M(i));return H(n)},arguments)},__wbg_createRenderbuffer_a2f947c7fa8c8bf0:function(e){let i=M(e).createRenderbuffer();return ne(i)?0:H(i)},__wbg_createRenderbuffer_c09d5809ac95924e:function(e){let i=M(e).createRenderbuffer();return ne(i)?0:H(i)},__wbg_createSampler_c8ffb3c8d565f704:function(e,i){let n=M(e).createSampler(M(i));return H(n)},__wbg_createShaderModule_2e44fc7677c6288b:function(e,i){let n=M(e).createShaderModule(M(i));return H(n)},__wbg_createShader_0e3f814b69e9e184:function(e,i){let n=M(e).createShader(i>>>0);return ne(n)?0:H(n)},__wbg_createShader_383b3295276271d2:function(e,i){let n=M(e).createShader(i>>>0);return ne(n)?0:H(n)},__wbg_createTexture_1bac74c999b8a48e:function(){return Zt(function(e,i){let n=M(e).createTexture(M(i));return H(n)},arguments)},__wbg_createTexture_461a3048c40e7175:function(e){let i=M(e).createTexture();return ne(i)?0:H(i)},__wbg_createTexture_d6e2c1f04a554a15:function(e){let i=M(e).createTexture();return ne(i)?0:H(i)},__wbg_createVertexArrayOES_2f67d3679ba9a29c:function(e){let i=M(e).createVertexArrayOES();return ne(i)?0:H(i)},__wbg_createVertexArray_febd1d11636d15ad:function(e){let i=M(e).createVertexArray();return ne(i)?0:H(i)},__wbg_createView_ceaf2f5881adbd34:function(){return Zt(function(e,i){let n=M(e).createView(M(i));return H(n)},arguments)},__wbg_cullFace_a4ee8b8c3c126388:function(e,i){M(e).cullFace(i>>>0)},__wbg_cullFace_c6b39a55ccade015:function(e,i){M(e).cullFace(i>>>0)},__wbg_currentTime_0b40b60bc76843cb:function(e){return M(e).currentTime},__wbg_debug_78b457f1effb3792:function(e){console.debug(M(e))},__wbg_deleteBuffer_520156dc8a1f81af:function(e,i){M(e).deleteBuffer(M(i))},__wbg_deleteBuffer_a925fdd1b590fbbc:function(e,i){M(e).deleteBuffer(M(i))},__wbg_deleteFramebuffer_aa4bf9f184123318:function(e,i){M(e).deleteFramebuffer(M(i))},__wbg_deleteFramebuffer_cc043e5a8cb9a556:function(e,i){M(e).deleteFramebuffer(M(i))},__wbg_deleteProgram_0c859ebcab2b7b5a:function(e,i){M(e).deleteProgram(M(i))},__wbg_deleteProgram_df6a6609c7d91a6e:function(e,i){M(e).deleteProgram(M(i))},__wbg_deleteRenderbuffer_37c079dbc257fcf9:function(e,i){M(e).deleteRenderbuffer(M(i))},__wbg_deleteRenderbuffer_4b7a888363766554:function(e,i){M(e).deleteRenderbuffer(M(i))},__wbg_deleteShader_170dea06bd074d01:function(e,i){M(e).deleteShader(M(i))},__wbg_deleteShader_944accd60733a9cb:function(e,i){M(e).deleteShader(M(i))},__wbg_deleteTexture_54dee8e15570751e:function(e,i){M(e).deleteTexture(M(i))},__wbg_deleteTexture_be3eaabebb89a85e:function(e,i){M(e).deleteTexture(M(i))},__wbg_deleteVertexArrayOES_4262d2d0e9fb77c5:function(e,i){M(e).deleteVertexArrayOES(M(i))},__wbg_deleteVertexArray_8f0fb3b3d54c7483:function(e,i){M(e).deleteVertexArray(M(i))},__wbg_depthMask_95332b64c5ef8b45:function(e,i){M(e).depthMask(i!==0)},__wbg_depthMask_f55bea4b6c3b9531:function(e,i){M(e).depthMask(i!==0)},__wbg_description_02485704e69b1e7f:function(e,i){let n=M(i).description,r=Zi(n,K.__wbindgen_export,K.__wbindgen_export2),s=Si;ie().setInt32(e+4,s,!0),ie().setInt32(e+0,r,!0)},__wbg_disable_2cf98ccb81612ef9:function(e,i){M(e).disable(i>>>0)},__wbg_disable_6b825656c54f5646:function(e,i){M(e).disable(i>>>0)},__wbg_dispatchWorkgroups_afb2344298c62227:function(e,i,n,r){M(e).dispatchWorkgroups(i>>>0,n>>>0,r>>>0)},__wbg_displayHeight_465673c1823a1db3:function(e){return M(e).displayHeight},__wbg_displayWidth_73729fd8eb965076:function(e){return M(e).displayWidth},__wbg_disposeVideo_c94c1ccd57a63f68:function(e){Gx(M(e))},__wbg_document_aceb08cd6489baf5:function(e){let i=M(e).document;return ne(i)?0:H(i)},__wbg_done_60cf307fcc680536:function(e){return M(e).done},__wbg_drawArrays_6eb87620c1dcbfb4:function(e,i,n,r){M(e).drawArrays(i>>>0,n,r)},__wbg_drawArrays_f332b526550a641e:function(e,i,n,r){M(e).drawArrays(i>>>0,n,r)},__wbg_drawBuffersWEBGL_10cdfe87c17cd93f:function(e,i){M(e).drawBuffersWEBGL(M(i))},__wbg_drawBuffers_c5a9ee312b2d6fa8:function(e,i){M(e).drawBuffers(M(i))},__wbg_drawElements_23ec4847dad548e0:function(e,i,n,r,s){M(e).drawElements(i>>>0,n,r>>>0,s)},__wbg_drawElements_fe4671e9c358058d:function(e,i,n,r,s){M(e).drawElements(i>>>0,n,r>>>0,s)},__wbg_drawIndexed_d31913e79d58fbac:function(e,i,n,r,s,a){M(e).drawIndexed(i>>>0,n>>>0,r>>>0,s,a>>>0)},__wbg_draw_6877f98847e1e36c:function(e,i,n,r,s){M(e).draw(i>>>0,n>>>0,r>>>0,s>>>0)},__wbg_duration_d6a6a568a0baf72d:function(e){return M(e).duration},__wbg_enableVertexAttribArray_cc09a0312b6adee5:function(e,i){M(e).enableVertexAttribArray(i>>>0)},__wbg_enableVertexAttribArray_f88d3d499ab40ea6:function(e,i){M(e).enableVertexAttribArray(i>>>0)},__wbg_enable_1928c361308989d5:function(e,i){M(e).enable(i>>>0)},__wbg_enable_2cc4ff32a0fd985f:function(e,i){M(e).enable(i>>>0)},__wbg_end_c36889de8ddef882:function(e){M(e).end()},__wbg_end_f99ebed53d4e198a:function(e){M(e).end()},__wbg_engine_new:function(e){let i=yl.__wrap(e);return H(i)},__wbg_entries_04b37a02507f1713:function(e){let i=Object.entries(M(e));return H(i)},__wbg_error_78ff5b3a29b770e0:function(e){console.error(M(e))},__wbg_error_a6fa202b58aa1cd3:function(e,i){let n,r;try{n=e,r=i,console.error(Te(e,i))}finally{K.__wbindgen_export4(n,r,1)}},__wbg_features_2b07a28fe18ad0ce:function(e){let i=M(e).features;return H(i)},__wbg_features_d4d2020319592cbe:function(e){let i=M(e).features;return H(i)},__wbg_fetch_ce1af4d1b59a60be:function(e,i){let n=M(e).fetch(M(i));return H(n)},__wbg_finish_4d91de5e927dd13f:function(e,i){let n=M(e).finish(M(i));return H(n)},__wbg_finish_6e06b68ab68cd9f6:function(e){let i=M(e).finish();return H(i)},__wbg_flush_2088ebca1fd13068:function(e){M(e).flush()},__wbg_flush_3be48fce9f195fa5:function(e){M(e).flush()},__wbg_framebufferRenderbuffer_0c9d0e5587497683:function(e,i,n,r,s){M(e).framebufferRenderbuffer(i>>>0,n>>>0,r>>>0,M(s))},__wbg_framebufferRenderbuffer_599e58ad30dcfeb3:function(e,i,n,r,s){M(e).framebufferRenderbuffer(i>>>0,n>>>0,r>>>0,M(s))},__wbg_framebufferTexture2D_44caed1725e57636:function(e,i,n,r,s,a){M(e).framebufferTexture2D(i>>>0,n>>>0,r>>>0,M(s),a)},__wbg_framebufferTexture2D_fbba21b750c2316a:function(e,i,n,r,s,a){M(e).framebufferTexture2D(i>>>0,n>>>0,r>>>0,M(s),a)},__wbg_from_d300fe49deab18f5:function(e){let i=Array.from(M(e));return H(i)},__wbg_generateMipmap_1403959fc241438f:function(e,i){M(e).generateMipmap(i>>>0)},__wbg_generateMipmap_b261c040d5707fe5:function(e,i){M(e).generateMipmap(i>>>0)},__wbg_getActiveUniform_3a275fd8fdf7a327:function(e,i,n){let r=M(e).getActiveUniform(M(i),n>>>0);return ne(r)?0:H(r)},__wbg_getActiveUniform_86f7a30e1a52aca4:function(e,i,n){let r=M(e).getActiveUniform(M(i),n>>>0);return ne(r)?0:H(r)},__wbg_getContext_469d34698d869fc1:function(){return Zt(function(e,i,n){let r=M(e).getContext(Te(i,n));return ne(r)?0:H(r)},arguments)},__wbg_getContext_5b39fff76491fded:function(){return Zt(function(e,i,n,r){let s=M(e).getContext(Te(i,n),M(r));return ne(s)?0:H(s)},arguments)},__wbg_getContext_7d3a8f461c828713:function(){return Zt(function(e,i,n){let r=M(e).getContext(Te(i,n));return ne(r)?0:H(r)},arguments)},__wbg_getCurrentTexture_20714d1bd9051cab:function(){return Zt(function(e){let i=M(e).getCurrentTexture();return H(i)},arguments)},__wbg_getExtension_454cdc5ffd07bf03:function(){return Zt(function(e,i,n){let r=M(e).getExtension(Te(i,n));return ne(r)?0:H(r)},arguments)},__wbg_getMappedRange_d0bf3141224111b6:function(){return Zt(function(e,i,n){let r=M(e).getMappedRange(i,n);return H(r)},arguments)},__wbg_getParameter_015942a7ad566b20:function(){return Zt(function(e,i){let n=M(e).getParameter(i>>>0);return H(n)},arguments)},__wbg_getParameter_1e77e23f5ccf0300:function(){return Zt(function(e,i){let n=M(e).getParameter(i>>>0);return H(n)},arguments)},__wbg_getPreferredCanvasFormat_8b57039d1801a506:function(e){let i=M(e).getPreferredCanvasFormat();return(Ch.indexOf(i)+1||102)-1},__wbg_getProgramInfoLog_2f9cfcecc4f772e1:function(e,i,n){let r=M(i).getProgramInfoLog(M(n));var s=ne(r)?0:Zi(r,K.__wbindgen_export,K.__wbindgen_export2),a=Si;ie().setInt32(e+4,a,!0),ie().setInt32(e+0,s,!0)},__wbg_getProgramInfoLog_f0d48f606547aed7:function(e,i,n){let r=M(i).getProgramInfoLog(M(n));var s=ne(r)?0:Zi(r,K.__wbindgen_export,K.__wbindgen_export2),a=Si;ie().setInt32(e+4,a,!0),ie().setInt32(e+0,s,!0)},__wbg_getProgramParameter_08beabb2736d5769:function(e,i,n){let r=M(e).getProgramParameter(M(i),n>>>0);return H(r)},__wbg_getProgramParameter_aee848e1db52b7cd:function(e,i,n){let r=M(e).getProgramParameter(M(i),n>>>0);return H(r)},__wbg_getRandomValues_3f44b700395062e5:function(){return Zt(function(e,i){globalThis.crypto.getRandomValues(gl(e,i))},arguments)},__wbg_getRandomValues_bf16787eede473f5:function(){return Zt(function(e,i){globalThis.crypto.getRandomValues(gl(e,i))},arguments)},__wbg_getShaderInfoLog_510365af17f29a35:function(e,i,n){let r=M(i).getShaderInfoLog(M(n));var s=ne(r)?0:Zi(r,K.__wbindgen_export,K.__wbindgen_export2),a=Si;ie().setInt32(e+4,a,!0),ie().setInt32(e+0,s,!0)},__wbg_getShaderInfoLog_cd77c7b7bdb9ce65:function(e,i,n){let r=M(i).getShaderInfoLog(M(n));var s=ne(r)?0:Zi(r,K.__wbindgen_export,K.__wbindgen_export2),a=Si;ie().setInt32(e+4,a,!0),ie().setInt32(e+0,s,!0)},__wbg_getSupportedExtensions_7a31b3412a25d9ba:function(e){let i=M(e).getSupportedExtensions();return ne(i)?0:H(i)},__wbg_getUniformLocation_010256f946f9a865:function(e,i,n,r){let s=M(e).getUniformLocation(M(i),Te(n,r));return ne(s)?0:H(s)},__wbg_getUniformLocation_f9774d4f157f5914:function(e,i,n,r){let s=M(e).getUniformLocation(M(i),Te(n,r));return ne(s)?0:H(s)},__wbg_get_1f8f054ddbaa7db2:function(){return Zt(function(e,i){let n=Reflect.get(M(e),M(i));return H(n)},arguments)},__wbg_get_2b48c7d0d006a781:function(e,i){let n=M(e)[i>>>0];return H(n)},__wbg_get_cb935c1402921898:function(e,i){let n=M(e)[i>>>0];return ne(n)?0:H(n)},__wbg_get_de6a0f7d4d18a304:function(){return Zt(function(e,i){let n=Reflect.get(M(e),M(i));return H(n)},arguments)},__wbg_get_index_ab123d64c89e3156:function(e,i){return M(e)[i>>>0]},__wbg_get_unchecked_33f6e5c9e2f2d6b2:function(e,i){let n=M(e)[i>>>0];return H(n)},__wbg_get_with_ref_key_6412cf3094599694:function(e,i){let n=M(e)[M(i)];return H(n)},__wbg_get_with_ref_key_7e638bba08a44478:function(e,i){let n=M(e)[M(i)];return H(n)},__wbg_gpu_2ccc250735d24a2a:function(e){let i=M(e).gpu;return H(i)},__wbg_has_0c97053e877f47cc:function(e,i,n){return M(e).has(Te(i,n))},__wbg_has_73740b27f436fed3:function(){return Zt(function(e,i){return Reflect.has(M(e),M(i))},arguments)},__wbg_height_4e7694e4e2110bdb:function(e){return M(e).height},__wbg_info_af7f45292ba9b0ea:function(e){console.info(M(e))},__wbg_info_cf0d9a286850cd24:function(e){let i=M(e).info;return H(i)},__wbg_innerHeight_8b6ee2571dbedb9d:function(){return Zt(function(e){let i=M(e).innerHeight;return H(i)},arguments)},__wbg_innerWidth_7475bec19f48fe43:function(){return Zt(function(e){let i=M(e).innerWidth;return H(i)},arguments)},__wbg_instanceof_ArrayBuffer_8f49811467741499:function(e){let i;try{i=M(e)instanceof ArrayBuffer}catch{i=!1}return i},__wbg_instanceof_GpuOutOfMemoryError_6429c750997f1c8d:function(e){let i;try{i=M(e)instanceof GPUOutOfMemoryError}catch{i=!1}return i},__wbg_instanceof_GpuValidationError_75fa3611f065f4df:function(e){let i;try{i=M(e)instanceof GPUValidationError}catch{i=!1}return i},__wbg_instanceof_HtmlVideoElement_95590e1ff107ba83:function(e){let i;try{i=M(e)instanceof HTMLVideoElement}catch{i=!1}return i},__wbg_instanceof_ImageBitmap_beed1259521cd66d:function(e){let i;try{i=M(e)instanceof ImageBitmap}catch{i=!1}return i},__wbg_instanceof_Response_cb984bd66d7bd408:function(e){let i;try{i=M(e)instanceof Response}catch{i=!1}return i},__wbg_instanceof_Uint8Array_86f30649f63ef9c2:function(e){let i;try{i=M(e)instanceof Uint8Array}catch{i=!1}return i},__wbg_instanceof_WebGl2RenderingContext_39d13e3f953130c7:function(e){let i;try{i=M(e)instanceof WebGL2RenderingContext}catch{i=!1}return i},__wbg_instanceof_Window_e093be59ee9a8e14:function(e){let i;try{i=M(e)instanceof Window}catch{i=!1}return i},__wbg_invalidateFramebuffer_6b8dae55a3debb1d:function(){return Zt(function(e,i,n){M(e).invalidateFramebuffer(i>>>0,M(n))},arguments)},__wbg_isArray_67c2c9c4313f4448:function(e){return Array.isArray(M(e))},__wbg_isFallbackAdapter_8ccb967428491dcb:function(e){return M(e).isFallbackAdapter},__wbg_isSafeInteger_66acec27e09e99a7:function(e){return Number.isSafeInteger(M(e))},__wbg_iterator_8732428d309e270e:function(){return H(Symbol.iterator)},__wbg_label_7ed42f25f841996b:function(e,i){let n=M(i).label,r=Zi(n,K.__wbindgen_export,K.__wbindgen_export2),s=Si;ie().setInt32(e+4,s,!0),ie().setInt32(e+0,r,!0)},__wbg_length_280688879ee7deb5:function(e){return M(e).length},__wbg_length_4a591ecaa01354d9:function(e){return M(e).length},__wbg_length_66f1a4b2e9026940:function(e){return M(e).length},__wbg_limits_20c6f56636df7d38:function(e){let i=M(e).limits;return H(i)},__wbg_limits_328c61cd41512420:function(e){let i=M(e).limits;return H(i)},__wbg_linkProgram_3ccc9beaa6dace28:function(e,i){M(e).linkProgram(M(i))},__wbg_linkProgram_fe2b1bf26336c4a5:function(e,i){M(e).linkProgram(M(i))},__wbg_loadImageFromBytes_3d42766b73aca4ca:function(e){let i=NP(Kt(e));return H(i)},__wbg_loadImageFromUrl_50be99dbf040255b:function(e,i){let n,r;try{n=e,r=i;let s=kP(Te(e,i));return H(s)}finally{K.__wbindgen_export4(n,r,1)}},__wbg_loadVideoFromBytes_3d884aadcf4d2139:function(e){let i=GP(Kt(e));return H(i)},__wbg_loadVideoFromUrl_7997ffb030d4b08b:function(e,i){let n,r;try{n=e,r=i;let s=HP(Te(e,i));return H(s)}finally{K.__wbindgen_export4(n,r,1)}},__wbg_location_efdf1fea18b5552a:function(e){let i=M(e).location;return H(i)},__wbg_log_cf2e968649f3384e:function(e){console.log(M(e))},__wbg_lost_0fa164c88f543338:function(e){let i=M(e).lost;return H(i)},__wbg_mapAsync_52b01fa9e8f765fd:function(e,i,n,r){let s=M(e).mapAsync(i>>>0,n,r);return H(s)},__wbg_maxBindGroupsPlusVertexBuffers_33e5006b23e20478:function(e){return M(e).maxBindGroupsPlusVertexBuffers},__wbg_maxBindGroups_f6d26f3a67826666:function(e){return M(e).maxBindGroups},__wbg_maxBindingsPerBindGroup_edab2e8dabbf6060:function(e){return M(e).maxBindingsPerBindGroup},__wbg_maxBufferSize_bbc69284c14aa7da:function(e){return M(e).maxBufferSize},__wbg_maxColorAttachmentBytesPerSample_63ebe4f81de2f34c:function(e){return M(e).maxColorAttachmentBytesPerSample},__wbg_maxColorAttachments_aed8c38beabf3a5c:function(e){return M(e).maxColorAttachments},__wbg_maxComputeInvocationsPerWorkgroup_2d964564c37f1c65:function(e){return M(e).maxComputeInvocationsPerWorkgroup},__wbg_maxComputeWorkgroupSizeX_a3e3206570da184f:function(e){return M(e).maxComputeWorkgroupSizeX},__wbg_maxComputeWorkgroupSizeY_dffa4a62244b7563:function(e){return M(e).maxComputeWorkgroupSizeY},__wbg_maxComputeWorkgroupSizeZ_976ebcb760f6d07d:function(e){return M(e).maxComputeWorkgroupSizeZ},__wbg_maxComputeWorkgroupStorageSize_2e8dbece6e532e2a:function(e){return M(e).maxComputeWorkgroupStorageSize},__wbg_maxComputeWorkgroupsPerDimension_bb7d36b4d20c80f4:function(e){return M(e).maxComputeWorkgroupsPerDimension},__wbg_maxDynamicStorageBuffersPerPipelineLayout_1ca859cb96a414e0:function(e){return M(e).maxDynamicStorageBuffersPerPipelineLayout},__wbg_maxDynamicUniformBuffersPerPipelineLayout_e968f2c8cd8f4d46:function(e){return M(e).maxDynamicUniformBuffersPerPipelineLayout},__wbg_maxInterStageShaderVariables_138ac882c4d6a3d3:function(e){return M(e).maxInterStageShaderVariables},__wbg_maxSampledTexturesPerShaderStage_bb3e6b2698321fa6:function(e){return M(e).maxSampledTexturesPerShaderStage},__wbg_maxSamplersPerShaderStage_98c00a1829fa414b:function(e){return M(e).maxSamplersPerShaderStage},__wbg_maxStorageBufferBindingSize_e500e31f479e669e:function(e){return M(e).maxStorageBufferBindingSize},__wbg_maxStorageBuffersPerShaderStage_eb663f6d7521b6a7:function(e){return M(e).maxStorageBuffersPerShaderStage},__wbg_maxStorageTexturesPerShaderStage_bb3ad93b53e618c0:function(e){return M(e).maxStorageTexturesPerShaderStage},__wbg_maxTextureArrayLayers_2a56d05fb261c99a:function(e){return M(e).maxTextureArrayLayers},__wbg_maxTextureDimension1D_84590c1d4770d319:function(e){return M(e).maxTextureDimension1D},__wbg_maxTextureDimension2D_7f2b5c8b2727e3fc:function(e){return M(e).maxTextureDimension2D},__wbg_maxTextureDimension3D_7f3babddf55c32a6:function(e){return M(e).maxTextureDimension3D},__wbg_maxUniformBufferBindingSize_d80a09e23c0b284c:function(e){return M(e).maxUniformBufferBindingSize},__wbg_maxUniformBuffersPerShaderStage_0b8b2de676fa740e:function(e){return M(e).maxUniformBuffersPerShaderStage},__wbg_maxVertexAttributes_a693dd921316649b:function(e){return M(e).maxVertexAttributes},__wbg_maxVertexBufferArrayStride_f256d91f281076cb:function(e){return M(e).maxVertexBufferArrayStride},__wbg_maxVertexBuffers_70ab564b25d5ac20:function(e){return M(e).maxVertexBuffers},__wbg_message_28959d6ca4d7dda0:function(e,i){let n=M(i).message,r=Zi(n,K.__wbindgen_export,K.__wbindgen_export2),s=Si;ie().setInt32(e+4,s,!0),ie().setInt32(e+0,r,!0)},__wbg_message_4ada57a3710f1502:function(e,i){let n=M(i).message,r=Zi(n,K.__wbindgen_export,K.__wbindgen_export2),s=Si;ie().setInt32(e+4,s,!0),ie().setInt32(e+0,r,!0)},__wbg_minStorageBufferOffsetAlignment_3248ed00dcdbf79f:function(e){return M(e).minStorageBufferOffsetAlignment},__wbg_minUniformBufferOffsetAlignment_3b9fa4caae03e903:function(e){return M(e).minUniformBufferOffsetAlignment},__wbg_name_b7fa2500fc153b89:function(e,i){let n=M(i).name,r=Zi(n,K.__wbindgen_export,K.__wbindgen_export2),s=Si;ie().setInt32(e+4,s,!0),ie().setInt32(e+0,r,!0)},__wbg_navigator_3833ecdbc19d2757:function(e){let i=M(e).navigator;return H(i)},__wbg_navigator_391291470f58c650:function(e){let i=M(e).navigator;return H(i)},__wbg_new_227d7c05414eb861:function(){let e=new Error;return H(e)},__wbg_new_3b242422c588a8f3:function(){return Zt(function(e,i){let n=new OffscreenCanvas(e>>>0,i>>>0);return H(n)},arguments)},__wbg_new_578aeef4b6b94378:function(e){let i=new Uint8Array(M(e));return H(i)},__wbg_new_b682b81e8eaaf027:function(e,i){try{var n={a:e,b:i},r=(a,o)=>{let l=n.a;n.a=0;try{return qP(l,n.b,a,o)}finally{n.a=l}};let s=new Promise(r);return H(s)}finally{n.a=0}},__wbg_new_ce1ab61c1c2b300d:function(){let e=new Object;return H(e)},__wbg_new_d90091b82fdf5b91:function(){let e=new Array;return H(e)},__wbg_new_from_slice_18fa1f71286d66b8:function(e,i){let n=new Uint8Array(gl(e,i));return H(n)},__wbg_new_from_slice_3c93d0bc613de8f0:function(e,i){let n=new Float64Array(wH(e,i));return H(n)},__wbg_new_from_slice_47be4219028de35d:function(e,i){let n=new Uint32Array(Gp(e,i));return H(n)},__wbg_new_from_slice_956df4f769fb782c:function(e,i){let n=new Float32Array(ls(e,i));return H(n)},__wbg_new_typed_41c97238ee4583e3:function(){let e=new Object;return H(e)},__wbg_new_typed_bf31d18f92484486:function(e,i){try{var n={a:e,b:i},r=(a,o)=>{let l=n.a;n.a=0;try{return qP(l,n.b,a,o)}finally{n.a=l}};let s=new Promise(r);return H(s)}finally{n.a=0}},__wbg_new_with_byte_offset_and_length_d836f26d916dd9ad:function(e,i,n){let r=new Uint8Array(M(e),i>>>0,n>>>0);return H(r)},__wbg_new_with_length_36a4998e27b014c5:function(e){let i=new Uint8Array(e>>>0);return H(i)},__wbg_new_with_length_b4a87ccced374381:function(e){let i=new Float64Array(e>>>0);return H(i)},__wbg_new_with_str_and_init_bcd02b79a793d27f:function(){return Zt(function(e,i,n){let r=new Request(Te(e,i),M(n));return H(r)},arguments)},__wbg_next_9e03acdf51c4960d:function(e){let i=M(e).next;return H(i)},__wbg_next_eb8ca7351fa27906:function(){return Zt(function(e){let i=M(e).next();return H(i)},arguments)},__wbg_now_f565250295e2d180:function(e){return M(e).now()},__wbg_of_57145fdec12d159f:function(e){let i=Array.of(M(e));return H(i)},__wbg_ok_fb13c30bc1893039:function(e){return M(e).ok},__wbg_onSubmittedWorkDone_270d6b5a45520e79:function(e){let i=M(e).onSubmittedWorkDone();return H(i)},__wbg_open_177ad1dcc06b9106:function(){return Zt(function(e,i,n,r,s,a,o){let l=M(e).open(Te(i,n),Te(r,s),Te(a,o));return ne(l)?0:H(l)},arguments)},__wbg_open_feb75fe4d9971c50:function(){return Zt(function(e,i,n,r,s){let a=M(e).open(Te(i,n),Te(r,s));return ne(a)?0:H(a)},arguments)},__wbg_ownKeys_0587b8fe286a40e6:function(){return Zt(function(e){let i=Reflect.ownKeys(M(e));return H(i)},arguments)},__wbg_pause_adce2b37e004ae49:function(){return Zt(function(e){M(e).pause()},arguments)},__wbg_performance_68499ca0718837f5:function(e){let i=M(e).performance;return ne(i)?0:H(i)},__wbg_pixelStorei_6e42d231aa75bd00:function(e,i,n){M(e).pixelStorei(i>>>0,n)},__wbg_pixelStorei_84dc1952dc699c94:function(e,i,n){M(e).pixelStorei(i>>>0,n)},__wbg_play_4ed9ece3cae2c100:function(){return Zt(function(e){let i=M(e).play();return H(i)},arguments)},__wbg_popErrorScope_8e7f4cbff8b758dd:function(e){let i=M(e).popErrorScope();return H(i)},__wbg_prototypesetcall_3249fc62a0fafa30:function(e,i,n){Uint8Array.prototype.set.call(gl(e,i),M(n))},__wbg_prototypesetcall_59640349d2c6d881:function(e,i,n){Uint32Array.prototype.set.call(Gp(e,i),M(n))},__wbg_provokingVertexWEBGL_0354dc7ad44d69bf:function(e,i){M(e).provokingVertexWEBGL(i>>>0)},__wbg_pushErrorScope_fa23d1206bc26dce:function(e,i){M(e).pushErrorScope(aH[i])},__wbg_push_a6822215aa43e71c:function(e,i){return M(e).push(M(i))},__wbg_querySelectorAll_4dcc230a2f8a2498:function(){return Zt(function(e,i,n){let r=M(e).querySelectorAll(Te(i,n));return H(r)},arguments)},__wbg_queueMicrotask_35c611f4a14830b2:function(e){queueMicrotask(M(e))},__wbg_queueMicrotask_404ed0a58e0b63cc:function(e){let i=M(e).queueMicrotask;return H(i)},__wbg_queue_adce34608fd0c893:function(e){let i=M(e).queue;return H(i)},__wbg_readBuffer_2027f7cdd7533f2d:function(e,i){M(e).readBuffer(i>>>0)},__wbg_readPixels_a04f5cf5019be695:function(){return Zt(function(e,i,n,r,s,a,o,l){M(e).readPixels(i,n,r,s,a>>>0,o>>>0,M(l))},arguments)},__wbg_readPixels_bf9ee726d9179d3c:function(){return Zt(function(e,i,n,r,s,a,o,l){M(e).readPixels(i,n,r,s,a>>>0,o>>>0,M(l))},arguments)},__wbg_readPixels_d00c1cae608273d8:function(){return Zt(function(e,i,n,r,s,a,o,l){M(e).readPixels(i,n,r,s,a>>>0,o>>>0,l)},arguments)},__wbg_readyState_77b1b1db1b8c2a5f:function(e){return M(e).readyState},__wbg_reason_b02cd587d1a09948:function(e){let i=M(e).reason;return(sH.indexOf(i)+1||3)-1},__wbg_renderbufferStorageMultisample_75bba97a8e59bc6e:function(e,i,n,r,s,a){M(e).renderbufferStorageMultisample(i>>>0,n,r>>>0,s,a)},__wbg_renderbufferStorage_3f5b0ec8fca2f9f8:function(e,i,n,r,s){M(e).renderbufferStorage(i>>>0,n>>>0,r,s)},__wbg_renderbufferStorage_c34a47cacbbc5fff:function(e,i,n,r,s){M(e).renderbufferStorage(i>>>0,n>>>0,r,s)},__wbg_requestAdapter_2e6718811c735a57:function(e,i){let n=M(e).requestAdapter(M(i));return H(n)},__wbg_requestDevice_ab46d0519ea1cc34:function(e,i){let n=M(e).requestDevice(M(i));return H(n)},__wbg_resolveQuerySet_0f32dc3de3f09701:function(e,i,n,r,s,a){M(e).resolveQuerySet(M(i),n>>>0,r>>>0,M(s),a>>>0)},__wbg_resolve_25a7e548d5881dca:function(e){let i=Promise.resolve(M(e));return H(i)},__wbg_scissor_079b7c4a5c9fcb63:function(e,i,n,r,s){M(e).scissor(i,n,r,s)},__wbg_scissor_e69faa631ab6fdc0:function(e,i,n,r,s){M(e).scissor(i,n,r,s)},__wbg_setBindGroup_268fd1714fff0ef5:function(){return Zt(function(e,i,n,r,s,a,o){M(e).setBindGroup(i>>>0,M(n),Gp(r,s),a,o>>>0)},arguments)},__wbg_setBindGroup_3e4ce136bc833ea1:function(){return Zt(function(e,i,n,r,s,a,o){M(e).setBindGroup(i>>>0,M(n),Gp(r,s),a,o>>>0)},arguments)},__wbg_setBindGroup_c22a1b95c0b17f37:function(e,i,n){M(e).setBindGroup(i>>>0,M(n))},__wbg_setBindGroup_f0de6cb2c7dbfc2c:function(e,i,n){M(e).setBindGroup(i>>>0,M(n))},__wbg_setIndexBuffer_2531a9103450445e:function(e,i,n,r){M(e).setIndexBuffer(M(i),qx[n],r)},__wbg_setIndexBuffer_7f3cf667b4d71566:function(e,i,n,r,s){M(e).setIndexBuffer(M(i),qx[n],r,s)},__wbg_setPipeline_c41bf46790f27f9e:function(e,i){M(e).setPipeline(M(i))},__wbg_setPipeline_d73f019e98c76d2d:function(e,i){M(e).setPipeline(M(i))},__wbg_setStencilReference_66c74be6232bb9da:function(e,i){M(e).setStencilReference(i>>>0)},__wbg_setTimeout_b5f25e402b6e8ff9:function(){return Zt(function(e,i,n){return M(e).setTimeout(M(i),n)},arguments)},__wbg_setVertexBuffer_1e448859663dd400:function(e,i,n,r){M(e).setVertexBuffer(i>>>0,M(n),r)},__wbg_setVertexBuffer_7cf533d694e747f3:function(e,i,n,r,s){M(e).setVertexBuffer(i>>>0,M(n),r,s)},__wbg_setViewport_d9fc3eac343de7d0:function(e,i,n,r,s,a,o){M(e).setViewport(i,n,r,s,a,o)},__wbg_set_29c99a8aac1c01e5:function(e,i,n){M(e).set(gl(i,n))},__wbg_set_6e30c9374c26414c:function(){return Zt(function(e,i,n){return Reflect.set(M(e),M(i),M(n))},arguments)},__wbg_set_6f7e2d6e41d9a122:function(e,i,n){M(e)[Kt(i)]=Kt(n)},__wbg_set_a_88262a42340d0b1c:function(e,i){M(e).a=i},__wbg_set_access_9a5092f05dc45fad:function(e,i){M(e).access=pH[i]},__wbg_set_address_mode_u_9e2695575a219e33:function(e,i){M(e).addressModeU=Hx[i]},__wbg_set_address_mode_v_f479b2e6cccbcac4:function(e,i){M(e).addressModeV=Hx[i]},__wbg_set_address_mode_w_46273e153230180d:function(e,i){M(e).addressModeW=Hx[i]},__wbg_set_alpha_bfd2df62e7bc581b:function(e,i){M(e).alpha=M(i)},__wbg_set_alpha_mode_df805952892caa9c:function(e,i){M(e).alphaMode=iH[i]},__wbg_set_alpha_to_coverage_enabled_8b5dc2b0a225b3b2:function(e,i){M(e).alphaToCoverageEnabled=i!==0},__wbg_set_array_layer_count_7312f0f31af94e7c:function(e,i){M(e).arrayLayerCount=i>>>0},__wbg_set_array_stride_f64_27ffaf4fffd74e61:function(e,i){M(e).arrayStride=i},__wbg_set_aspect_0d453bca3d012f02:function(e,i){M(e).aspect=Zx[i]},__wbg_set_aspect_210da747c9d77aba:function(e,i){M(e).aspect=Zx[i]},__wbg_set_aspect_4962514fe99e68e6:function(e,i){M(e).aspect=Zx[i]},__wbg_set_attributes_7537844a7e6dafdc:function(e,i,n){M(e).attributes=qs(i,n)},__wbg_set_b_c47befe0af3261eb:function(e,i){M(e).b=i},__wbg_set_base_array_layer_f176bb9f1b37b342:function(e,i){M(e).baseArrayLayer=i>>>0},__wbg_set_base_mip_level_1df145d9f8db32a9:function(e,i){M(e).baseMipLevel=i>>>0},__wbg_set_beginning_of_pass_write_index_0d4fa06109208ad7:function(e,i){M(e).beginningOfPassWriteIndex=i>>>0},__wbg_set_beginning_of_pass_write_index_e9f5d016947893bd:function(e,i){M(e).beginningOfPassWriteIndex=i>>>0},__wbg_set_bind_group_layouts_5a9cfea401c020ab:function(e,i,n){M(e).bindGroupLayouts=qs(i,n)},__wbg_set_binding_155b0440b4307793:function(e,i){M(e).binding=i>>>0},__wbg_set_binding_f74df3510792aba1:function(e,i){M(e).binding=i>>>0},__wbg_set_blend_7493c2066c3e9970:function(e,i){M(e).blend=M(i)},__wbg_set_buffer_9c01e3b6d6765ea2:function(e,i){M(e).buffer=M(i)},__wbg_set_buffer_c3410572051920ba:function(e,i){M(e).buffer=M(i)},__wbg_set_buffer_ef7f75306cf663ed:function(e,i){M(e).buffer=M(i)},__wbg_set_buffers_7d0d8f507699e956:function(e,i,n){M(e).buffers=qs(i,n)},__wbg_set_bytes_per_row_c54ca96953f35774:function(e,i){M(e).bytesPerRow=i>>>0},__wbg_set_bytes_per_row_d69b88eee3929c07:function(e,i){M(e).bytesPerRow=i>>>0},__wbg_set_c775d84916be79ea:function(e,i,n){M(e).set(M(i),n>>>0)},__wbg_set_clear_value_gpu_color_dict_6211425789c76e59:function(e,i){M(e).clearValue=M(i)},__wbg_set_code_b4f37f81f45b5b25:function(e,i,n){M(e).code=Te(i,n)},__wbg_set_color_83aa977526e88cbb:function(e,i){M(e).color=M(i)},__wbg_set_color_attachments_581fdb3310e4abfa:function(e,i,n){M(e).colorAttachments=qs(i,n)},__wbg_set_compare_cd9b62cdb92eb580:function(e,i){M(e).compare=Wx[i]},__wbg_set_compare_f36b34abfaa08ccb:function(e,i){M(e).compare=Wx[i]},__wbg_set_compute_d0c2d276b6d4b18d:function(e,i){M(e).compute=M(i)},__wbg_set_count_069a4eac409bac55:function(e,i){M(e).count=i>>>0},__wbg_set_count_3ab1c1220e4ceeb3:function(e,i){M(e).count=i>>>0},__wbg_set_cull_mode_fc649853947a3d0c:function(e,i){M(e).cullMode=rH[i]},__wbg_set_currentTime_7c37e2312e9d2687:function(e,i){M(e).currentTime=i},__wbg_set_depth_bias_clamp_1c0d695df7f092e5:function(e,i){M(e).depthBiasClamp=i},__wbg_set_depth_bias_d7cd16096242a657:function(e,i){M(e).depthBias=i},__wbg_set_depth_bias_slope_scale_c4e52ec743ef55ba:function(e,i){M(e).depthBiasSlopeScale=i},__wbg_set_depth_clear_value_beda3ec5b1a5c43a:function(e,i){M(e).depthClearValue=i},__wbg_set_depth_compare_0c8631eb2eae98e3:function(e,i){M(e).depthCompare=Wx[i]},__wbg_set_depth_fail_op_668155ae33d3c06f:function(e,i){M(e).depthFailOp=$x[i]},__wbg_set_depth_load_op_511c513eab4e56a9:function(e,i){M(e).depthLoadOp=Xx[i]},__wbg_set_depth_or_array_layers_89371305ed0bd962:function(e,i){M(e).depthOrArrayLayers=i>>>0},__wbg_set_depth_read_only_7f41a74741c144ec:function(e,i){M(e).depthReadOnly=i!==0},__wbg_set_depth_stencil_97506c7bea4f53da:function(e,i){M(e).depthStencil=M(i)},__wbg_set_depth_stencil_attachment_73b79e8b4e948222:function(e,i){M(e).depthStencilAttachment=M(i)},__wbg_set_depth_store_op_c89f33b39b43361c:function(e,i){M(e).depthStoreOp=Yx[i]},__wbg_set_depth_write_enabled_ce89750042940350:function(e,i){M(e).depthWriteEnabled=i!==0},__wbg_set_device_e275d1d4f3c9eb74:function(e,i){M(e).device=M(i)},__wbg_set_dimension_868eee80f4b90011:function(e,i){M(e).dimension=fH[i]},__wbg_set_dimension_e325282e613ca0a4:function(e,i){M(e).dimension=Kx[i]},__wbg_set_dst_factor_ec7407f19be1aff9:function(e,i){M(e).dstFactor=$P[i]},__wbg_set_end_of_pass_write_index_0d546e46b86ea069:function(e,i){M(e).endOfPassWriteIndex=i>>>0},__wbg_set_end_of_pass_write_index_49a6ddbb2b888bfa:function(e,i){M(e).endOfPassWriteIndex=i>>>0},__wbg_set_entries_86a29dd6291c95e7:function(e,i,n){M(e).entries=qs(i,n)},__wbg_set_entries_a12aca1e458b0456:function(e,i,n){M(e).entries=qs(i,n)},__wbg_set_entry_point_207540f042015ce5:function(e,i,n){M(e).entryPoint=Te(i,n)},__wbg_set_entry_point_5f26aacbe4c545eb:function(e,i,n){M(e).entryPoint=Te(i,n)},__wbg_set_entry_point_e87e79251dd3144f:function(e,i,n){M(e).entryPoint=Te(i,n)},__wbg_set_external_texture_386483d8dd82ab56:function(e,i){M(e).externalTexture=M(i)},__wbg_set_fail_op_92f716dbc88b6973:function(e,i){M(e).failOp=$x[i]},__wbg_set_flip_y_4e1632b36ad0413a:function(e,i){M(e).flipY=i!==0},__wbg_set_format_1fcaa7d60546b490:function(e,i){M(e).format=Ch[i]},__wbg_set_format_2c1414a817c213f8:function(e,i){M(e).format=Ch[i]},__wbg_set_format_533f9ffa7eef563d:function(e,i){M(e).format=Ch[i]},__wbg_set_format_5d2f25cc93654ecc:function(e,i){M(e).format=gH[i]},__wbg_set_format_5ff53724ed6cedf2:function(e,i){M(e).format=Ch[i]},__wbg_set_format_815efd4dc4817bbb:function(e,i){M(e).format=Ch[i]},__wbg_set_format_e52bdcca880d2c8e:function(e,i){M(e).format=Ch[i]},__wbg_set_fragment_8b780f00a0b0e6f3:function(e,i){M(e).fragment=M(i)},__wbg_set_front_face_28ffdf524eedce5b:function(e,i){M(e).frontFace=oH[i]},__wbg_set_g_5983abfc46e0cf4e:function(e,i){M(e).g=i},__wbg_set_has_dynamic_offset_62bc230bdb7c54d0:function(e,i){M(e).hasDynamicOffset=i!==0},__wbg_set_height_0739170de8653cc4:function(e,i){M(e).height=i>>>0},__wbg_set_height_14335c4047cf9c1b:function(e,i){M(e).height=i>>>0},__wbg_set_height_c661af0c0b5376f9:function(e,i){M(e).height=i>>>0},__wbg_set_label_08d9be3e4719c226:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_17eb9fe3a02f62b0:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_206558c8adc3780f:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_48e6b787d256f621:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_547d0d4aec39fbe9:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_5ee7427342869829:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_60ad96c811e0d109:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_6db0393d3fdc90a5:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_72bb4f41ef0cb893:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_79387decda299036:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_9556af8b5cda3c9d:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_d010f237b26f2c55:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_e16e2dbe51349c7f:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_e3944e54881b8c50:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_e922700240417ab5:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_ef44793ddf4455c5:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_layout_41021cfd2a2f62df:function(e,i){M(e).layout=M(i)},__wbg_set_layout_50ab727f44b38f26:function(e,i){M(e).layout=M(i)},__wbg_set_layout_913d53c17194c989:function(e,i){M(e).layout=M(i)},__wbg_set_layout_gpu_auto_layout_mode_0a5a185b3d52b726:function(e,i){M(e).layout=XP[i]},__wbg_set_layout_gpu_auto_layout_mode_aeba193938b47882:function(e,i){M(e).layout=XP[i]},__wbg_set_load_op_99661da6c4eab9b0:function(e,i){M(e).loadOp=Xx[i]},__wbg_set_lod_max_clamp_dd2d9f9f052f4f44:function(e,i){M(e).lodMaxClamp=i},__wbg_set_lod_min_clamp_6d20c97916baeb93:function(e,i){M(e).lodMinClamp=i},__wbg_set_loop_b622b726769860be:function(e,i){M(e).loop=i!==0},__wbg_set_mag_filter_b5adebc99cb938e1:function(e,i){M(e).magFilter=YP[i]},__wbg_set_mapped_at_creation_81b586dc90a50347:function(e,i){M(e).mappedAtCreation=i!==0},__wbg_set_mask_70a8a59ce09e5997:function(e,i){M(e).mask=i>>>0},__wbg_set_max_anisotropy_2beada0e2db62c45:function(e,i){M(e).maxAnisotropy=i},__wbg_set_method_7a6811dec7a4feff:function(e,i,n){M(e).method=Te(i,n)},__wbg_set_min_binding_size_f64_5005a6904cdf43da:function(e,i){M(e).minBindingSize=i},__wbg_set_min_filter_c72f17375e135f0a:function(e,i){M(e).minFilter=YP[i]},__wbg_set_mip_level_13253f3afc7aa58a:function(e,i){M(e).mipLevel=i>>>0},__wbg_set_mip_level_count_534caaa7e68e68b8:function(e,i){M(e).mipLevelCount=i>>>0},__wbg_set_mip_level_count_776c8c218b65bc08:function(e,i){M(e).mipLevelCount=i>>>0},__wbg_set_mip_level_f7ac79e8c54f59ad:function(e,i){M(e).mipLevel=i>>>0},__wbg_set_mipmap_filter_5bf66195a3639700:function(e,i){M(e).mipmapFilter=lH[i]},__wbg_set_mode_9990b3393ba469ae:function(e,i){M(e).mode=nH[i]},__wbg_set_mode_c90e3667002857d4:function(e,i){M(e).mode=yH[i]},__wbg_set_module_5db9b76ee2dd2a59:function(e,i){M(e).module=M(i)},__wbg_set_module_d0e2098713606cae:function(e,i){M(e).module=M(i)},__wbg_set_module_f02e076ca7e7daf8:function(e,i){M(e).module=M(i)},__wbg_set_multisample_37ddafe88b5cd466:function(e,i){M(e).multisample=M(i)},__wbg_set_multisampled_7913fd7183272840:function(e,i){M(e).multisampled=i!==0},__wbg_set_muted_16f1e7acd8244e28:function(e,i){M(e).muted=i!==0},__wbg_set_offset_f64_28c24dc15000932e:function(e,i){M(e).offset=i},__wbg_set_offset_f64_89f0ce01a689839e:function(e,i){M(e).offset=i},__wbg_set_offset_f64_b562d1367e34ef93:function(e,i){M(e).offset=i},__wbg_set_offset_f64_fa66068813376ca3:function(e,i){M(e).offset=i},__wbg_set_once_27df5233613a51cd:function(e,i){M(e).once=i!==0},__wbg_set_operation_62ce44e1728c4047:function(e,i){M(e).operation=tH[i]},__wbg_set_origin_gpu_origin_2d_dict_1240202973e56f92:function(e,i){M(e).origin=M(i)},__wbg_set_origin_gpu_origin_3d_dict_37222d7b3d238123:function(e,i){M(e).origin=M(i)},__wbg_set_origin_gpu_origin_3d_dict_631c04520718091f:function(e,i){M(e).origin=M(i)},__wbg_set_pass_op_cf02fa088d6352a7:function(e,i){M(e).passOp=$x[i]},__wbg_set_power_preference_8fdca0b7af640d49:function(e,i){M(e).powerPreference=hH[i]},__wbg_set_premultiplied_alpha_3f27816ad319d5a9:function(e,i){M(e).premultipliedAlpha=i!==0},__wbg_set_primitive_43c23761a55b4088:function(e,i){M(e).primitive=M(i)},__wbg_set_query_set_41de86d2401aee04:function(e,i){M(e).querySet=M(i)},__wbg_set_query_set_4889dd944d5ec0fd:function(e,i){M(e).querySet=M(i)},__wbg_set_r_c6f4c68f4804d655:function(e,i){M(e).r=i},__wbg_set_required_features_1baf274a8669db60:function(e,i,n){M(e).requiredFeatures=qs(i,n)},__wbg_set_required_limits_871ed33c68613dcb:function(e,i){M(e).requiredLimits=M(i)},__wbg_set_resolve_target_gpu_texture_view_b19a4f2debf79b96:function(e,i){M(e).resolveTarget=M(i)},__wbg_set_resource_5ae7b5e67924f234:function(e,i){M(e).resource=M(i)},__wbg_set_resource_gpu_buffer_binding_e5dbca063e7cb67b:function(e,i){M(e).resource=M(i)},__wbg_set_resource_gpu_texture_view_eb46c355d51ad7e5:function(e,i){M(e).resource=M(i)},__wbg_set_rows_per_image_5011f97318ee71af:function(e,i){M(e).rowsPerImage=i>>>0},__wbg_set_rows_per_image_59a813ac5006e10e:function(e,i){M(e).rowsPerImage=i>>>0},__wbg_set_sample_count_eb86a8b18545b54f:function(e,i){M(e).sampleCount=i>>>0},__wbg_set_sample_type_c32e1dfff94e63eb:function(e,i){M(e).sampleType=mH[i]},__wbg_set_sampler_c0e1258543a33bce:function(e,i){M(e).sampler=M(i)},__wbg_set_shader_location_7e1832a74f912217:function(e,i){M(e).shaderLocation=i>>>0},__wbg_set_size_f64_6bcd40704bf4cfdc:function(e,i){M(e).size=i},__wbg_set_size_f64_8b8f6bba5d678162:function(e,i){M(e).size=i},__wbg_set_size_gpu_extent_3d_dict_7e42e1c98fa36434:function(e,i){M(e).size=M(i)},__wbg_set_source_0c40b87cfdd5d704:function(e,i){M(e).source=M(i)},__wbg_set_source_html_canvas_element_f657e39507ba2fe5:function(e,i){M(e).source=M(i)},__wbg_set_source_html_image_element_fcc7cba0635adac1:function(e,i){M(e).source=M(i)},__wbg_set_source_html_video_element_e63a39653665f651:function(e,i){M(e).source=M(i)},__wbg_set_source_image_data_68478f1afce208b8:function(e,i){M(e).source=M(i)},__wbg_set_source_offscreen_canvas_266a3de949693e62:function(e,i){M(e).source=M(i)},__wbg_set_source_video_frame_3083c0ce54b9cb73:function(e,i){M(e).source=M(i)},__wbg_set_src_factor_9bfe84af9b7b5cac:function(e,i){M(e).srcFactor=$P[i]},__wbg_set_stencil_back_85b22f1db5b1940a:function(e,i){M(e).stencilBack=M(i)},__wbg_set_stencil_clear_value_42be608809151e2a:function(e,i){M(e).stencilClearValue=i>>>0},__wbg_set_stencil_front_525526164a798a44:function(e,i){M(e).stencilFront=M(i)},__wbg_set_stencil_load_op_31838c036993098a:function(e,i){M(e).stencilLoadOp=Xx[i]},__wbg_set_stencil_read_mask_5cc26495e8b3ae82:function(e,i){M(e).stencilReadMask=i>>>0},__wbg_set_stencil_read_only_bf1d0c1897e25c62:function(e,i){M(e).stencilReadOnly=i!==0},__wbg_set_stencil_store_op_e6be1cbc3a8fc210:function(e,i){M(e).stencilStoreOp=Yx[i]},__wbg_set_stencil_write_mask_d9cb40ec4b4bee5b:function(e,i){M(e).stencilWriteMask=i>>>0},__wbg_set_step_mode_a97bb24714da41a9:function(e,i){M(e).stepMode=vH[i]},__wbg_set_storage_texture_939a097db4b18bd4:function(e,i){M(e).storageTexture=M(i)},__wbg_set_store_op_b5fdf672436f13f3:function(e,i){M(e).storeOp=Yx[i]},__wbg_set_strip_index_format_9f787be6c5fc9e87:function(e,i){M(e).stripIndexFormat=qx[i]},__wbg_set_targets_c38bd200c836d66f:function(e,i,n){M(e).targets=qs(i,n)},__wbg_set_texture_016561d5911339e5:function(e,i){M(e).texture=M(i)},__wbg_set_texture_1f64653a5d2d7b4d:function(e,i){M(e).texture=M(i)},__wbg_set_texture_9dcedde1bb31eda6:function(e,i){M(e).texture=M(i)},__wbg_set_timestamp_writes_59c2d19ed8aecd97:function(e,i){M(e).timestampWrites=M(i)},__wbg_set_timestamp_writes_98bed1a8bbc6682d:function(e,i){M(e).timestampWrites=M(i)},__wbg_set_tone_mapping_b3464f1baa4cff92:function(e,i){M(e).toneMapping=M(i)},__wbg_set_topology_da25f2cc5af203d2:function(e,i){M(e).topology=cH[i]},__wbg_set_type_7f0457c6084dde9b:function(e,i){M(e).type=dH[i]},__wbg_set_type_ccf8472d40abcddf:function(e,i){M(e).type=uH[i]},__wbg_set_type_d09829f59932a0fc:function(e,i){M(e).type=eH[i]},__wbg_set_unclipped_depth_04524a2b44e1e3c1:function(e,i){M(e).unclippedDepth=i!==0},__wbg_set_usage_a137f82ca163b0a9:function(e,i){M(e).usage=i>>>0},__wbg_set_usage_b2a2935f37bf3d08:function(e,i){M(e).usage=i>>>0},__wbg_set_usage_ba5b0f8b333ab325:function(e,i){M(e).usage=i>>>0},__wbg_set_usage_ddd42599bbba7779:function(e,i){M(e).usage=i>>>0},__wbg_set_vertex_0be5d146f9ff6f36:function(e,i){M(e).vertex=M(i)},__wbg_set_view_dimension_0df554032f1f3a85:function(e,i){M(e).viewDimension=Kx[i]},__wbg_set_view_dimension_4818d4c18ce5815e:function(e,i){M(e).viewDimension=Kx[i]},__wbg_set_view_formats_4347dc8363331086:function(e,i,n){M(e).viewFormats=qs(i,n)},__wbg_set_view_formats_5797d2fff3c11808:function(e,i,n){M(e).viewFormats=qs(i,n)},__wbg_set_view_gpu_texture_view_9b2d86b6b99d9fd9:function(e,i){M(e).view=M(i)},__wbg_set_view_gpu_texture_view_c0f35f8857c25206:function(e,i){M(e).view=M(i)},__wbg_set_visibility_9570b037224c4cc2:function(e,i){M(e).visibility=i>>>0},__wbg_set_volume_520cdc6b7ada8f76:function(e,i){M(e).volume=i},__wbg_set_width_7ca43f32db1cfe8e:function(e,i){M(e).width=i>>>0},__wbg_set_width_87301412247f3343:function(e,i){M(e).width=i>>>0},__wbg_set_width_9f685402c2cbee70:function(e,i){M(e).width=i>>>0},__wbg_set_write_mask_d45279e56abbfcb5:function(e,i){M(e).writeMask=i>>>0},__wbg_set_x_232d24fdc32d8351:function(e,i){M(e).x=i>>>0},__wbg_set_x_876d592971db129a:function(e,i){M(e).x=i>>>0},__wbg_set_y_18fe375093e59dfb:function(e,i){M(e).y=i>>>0},__wbg_set_y_2b1f5ac0dd5586a5:function(e,i){M(e).y=i>>>0},__wbg_set_z_ef005d82bc9d24e3:function(e,i){M(e).z=i>>>0},__wbg_shaderSource_7d18b5a43a504f5c:function(e,i,n,r){M(e).shaderSource(M(i),Te(n,r))},__wbg_shaderSource_df5bb6320451f3cd:function(e,i,n,r){M(e).shaderSource(M(i),Te(n,r))},__wbg_size_211f88d386430781:function(e){return M(e).size},__wbg_src_f0e9281991fbd919:function(e,i){let n=M(i).src,r=Zi(n,K.__wbindgen_export,K.__wbindgen_export2),s=Si;ie().setInt32(e+4,s,!0),ie().setInt32(e+0,r,!0)},__wbg_stack_3b0d974bbf31e44f:function(e,i){let n=M(i).stack,r=Zi(n,K.__wbindgen_export,K.__wbindgen_export2),s=Si;ie().setInt32(e+4,s,!0),ie().setInt32(e+0,r,!0)},__wbg_static_accessor_GLOBAL_9d53f2689e622ca1:function(){let e=typeof global>"u"?null:global;return ne(e)?0:H(e)},__wbg_static_accessor_GLOBAL_THIS_a1a35cec07001a8a:function(){let e=typeof globalThis>"u"?null:globalThis;return ne(e)?0:H(e)},__wbg_static_accessor_SELF_4c59f6c7ea29a144:function(){let e=typeof self>"u"?null:self;return ne(e)?0:H(e)},__wbg_static_accessor_WINDOW_e70ae9f2eb052253:function(){let e=typeof window>"u"?null:window;return ne(e)?0:H(e)},__wbg_stencilFunc_8f53a5508560354d:function(e,i,n,r){M(e).stencilFunc(i>>>0,n,r>>>0)},__wbg_stencilFunc_c7553215f237ee38:function(e,i,n,r){M(e).stencilFunc(i>>>0,n,r>>>0)},__wbg_stencilOp_a844a4e9824eee70:function(e,i,n,r){M(e).stencilOp(i>>>0,n>>>0,r>>>0)},__wbg_stencilOp_e82bd7ea13f18adf:function(e,i,n,r){M(e).stencilOp(i>>>0,n>>>0,r>>>0)},__wbg_subgroupMaxSize_1527c5f7a8fe91bb:function(e){return M(e).subgroupMaxSize},__wbg_subgroupMinSize_d6c5ad4bddc828e9:function(e){return M(e).subgroupMinSize},__wbg_submit_ce44115121cd166c:function(e,i,n){M(e).submit(qs(i,n))},__wbg_texImage2D_01c22558517ee8db:function(){return Zt(function(e,i,n,r,s,a,o){M(e).texImage2D(i>>>0,n,r,s>>>0,a>>>0,M(o))},arguments)},__wbg_texImage2D_152e9dcd4bc3a464:function(){return Zt(function(e,i,n,r,s,a,o,l,c,h){M(e).texImage2D(i>>>0,n,r,s,a,o,l>>>0,c>>>0,M(h))},arguments)},__wbg_texImage2D_3704db20a16b6c35:function(){return Zt(function(e,i,n,r,s,a,o,l,c,h){M(e).texImage2D(i>>>0,n,r,s,a,o,l>>>0,c>>>0,M(h))},arguments)},__wbg_texImage2D_63d0b87d5ebe4a7f:function(){return Zt(function(e,i,n,r,s,a,o){M(e).texImage2D(i>>>0,n,r,s>>>0,a>>>0,M(o))},arguments)},__wbg_texImage2D_90633e994ded3d2b:function(){return Zt(function(e,i,n,r,s,a,o){M(e).texImage2D(i>>>0,n,r,s>>>0,a>>>0,M(o))},arguments)},__wbg_texImage2D_ea94e8a2df5f97e2:function(){return Zt(function(e,i,n,r,s,a,o,l,c,h){M(e).texImage2D(i>>>0,n,r,s,a,o,l>>>0,c>>>0,h)},arguments)},__wbg_texImage2D_facfa039fb461b66:function(){return Zt(function(e,i,n,r,s,a,o){M(e).texImage2D(i>>>0,n,r,s>>>0,a>>>0,M(o))},arguments)},__wbg_texParameteri_87ebfcefb0af2c50:function(e,i,n,r){M(e).texParameteri(i>>>0,n>>>0,r)},__wbg_texParameteri_e5ad2054e239066e:function(e,i,n,r){M(e).texParameteri(i>>>0,n>>>0,r)},__wbg_texStorage2D_bb2a1bd1ab0b9184:function(e,i,n,r,s,a){M(e).texStorage2D(i>>>0,n,r>>>0,s,a)},__wbg_texSubImage2D_3483ba5f10ee42c2:function(){return Zt(function(e,i,n,r,s,a,o,l){M(e).texSubImage2D(i>>>0,n,r,s,a>>>0,o>>>0,M(l))},arguments)},__wbg_texSubImage2D_4ca4c3faa4392438:function(){return Zt(function(e,i,n,r,s,a,o,l,c,h){M(e).texSubImage2D(i>>>0,n,r,s,a,o,l>>>0,c>>>0,M(h))},arguments)},__wbg_texSubImage2D_54d18572b1ba74ab:function(){return Zt(function(e,i,n,r,s,a,o,l,c,h){M(e).texSubImage2D(i>>>0,n,r,s,a,o,l>>>0,c>>>0,h)},arguments)},__wbg_texSubImage2D_5bebe93724e6ed61:function(){return Zt(function(e,i,n,r,s,a,o,l,c,h){M(e).texSubImage2D(i>>>0,n,r,s,a,o,l>>>0,c>>>0,M(h))},arguments)},__wbg_texSubImage2D_5e1594de0416e9f6:function(){return Zt(function(e,i,n,r,s,a,o,l){M(e).texSubImage2D(i>>>0,n,r,s,a>>>0,o>>>0,M(l))},arguments)},__wbg_then_18f476d590e58992:function(e,i,n){let r=M(e).then(M(i),M(n));return H(r)},__wbg_then_47213a40b6aeb86c:function(e,i){let n=M(e).then(M(i));return H(n)},__wbg_then_ac7b025999b52837:function(e,i){let n=M(e).then(M(i));return H(n)},__wbg_type_71742b859467fa3c:function(e){return M(e).type},__wbg_unconfigure_0a07a0a40de8988d:function(e){M(e).unconfigure()},__wbg_uniform1f_8c3b3e6e3723fe14:function(e,i,n){M(e).uniform1f(M(i),n)},__wbg_uniform1f_d6619faa73c2a45f:function(e,i,n){M(e).uniform1f(M(i),n)},__wbg_uniform1fv_11d5842aff79c8a3:function(e,i,n,r){M(e).uniform1fv(M(i),ls(n,r))},__wbg_uniform1fv_b4b087b4d6e2bb25:function(e,i,n,r){M(e).uniform1fv(M(i),ls(n,r))},__wbg_uniform1i_14982bb8438243b4:function(e,i,n){M(e).uniform1i(M(i),n)},__wbg_uniform1i_cf11d5b364eed1c8:function(e,i,n){M(e).uniform1i(M(i),n)},__wbg_uniform1ui_d177882f473d2afc:function(e,i,n){M(e).uniform1ui(M(i),n>>>0)},__wbg_uniform2f_19fb96222ae72e1a:function(e,i,n,r){M(e).uniform2f(M(i),n,r)},__wbg_uniform2f_44cee47e30b82f96:function(e,i,n,r){M(e).uniform2f(M(i),n,r)},__wbg_uniform2fv_2f06d989ec4b5d8f:function(e,i,n,r){M(e).uniform2fv(M(i),ls(n,r))},__wbg_uniform2fv_f022309b362a80c3:function(e,i,n,r){M(e).uniform2fv(M(i),ls(n,r))},__wbg_uniform2i_16e8a2c966614be6:function(e,i,n,r){M(e).uniform2i(M(i),n,r)},__wbg_uniform2i_d353da02172ea38d:function(e,i,n,r){M(e).uniform2i(M(i),n,r)},__wbg_uniform3f_360c1ea4c73cacef:function(e,i,n,r,s){M(e).uniform3f(M(i),n,r,s)},__wbg_uniform3f_b616f9e06266a25f:function(e,i,n,r,s){M(e).uniform3f(M(i),n,r,s)},__wbg_uniform4f_f1a670d511b34878:function(e,i,n,r,s,a){M(e).uniform4f(M(i),n,r,s,a)},__wbg_uniform4f_f97f3f59af09856f:function(e,i,n,r,s,a){M(e).uniform4f(M(i),n,r,s,a)},__wbg_uniformMatrix3fv_f45b91f173d7fbed:function(e,i,n,r,s){M(e).uniformMatrix3fv(M(i),n!==0,ls(r,s))},__wbg_uniformMatrix3fv_feab3f952d705f51:function(e,i,n,r,s){M(e).uniformMatrix3fv(M(i),n!==0,ls(r,s))},__wbg_uniformMatrix3x2fv_ab13f9742e5fcb2f:function(e,i,n,r,s){M(e).uniformMatrix3x2fv(M(i),n!==0,ls(r,s))},__wbg_uniformMatrix4fv_540dc6bf792eba8f:function(e,i,n,r,s){M(e).uniformMatrix4fv(M(i),n!==0,ls(r,s))},__wbg_uniformMatrix4fv_e3dac9dd429d6adc:function(e,i,n,r,s){M(e).uniformMatrix4fv(M(i),n!==0,ls(r,s))},__wbg_uniformMatrix4x3fv_115d029ad3124cef:function(e,i,n,r,s){M(e).uniformMatrix4x3fv(M(i),n!==0,ls(r,s))},__wbg_unmap_adaf93276fdf9aaf:function(e){M(e).unmap()},__wbg_useProgram_55a3e940abb19137:function(e,i){M(e).useProgram(M(i))},__wbg_useProgram_e24dadf4c06636f5:function(e,i){M(e).useProgram(M(i))},__wbg_userAgent_8def8135d886414b:function(){return Zt(function(e,i){let n=M(i).userAgent,r=Zi(n,K.__wbindgen_export,K.__wbindgen_export2),s=Si;ie().setInt32(e+4,s,!0),ie().setInt32(e+0,r,!0)},arguments)},__wbg_valueOf_41ae57308c1f031c:function(e){return M(e).valueOf()},__wbg_value_f3625092ee4b37f4:function(e){let i=M(e).value;return H(i)},__wbg_vertexAttrib4f_6444504b25f4d43e:function(e,i,n,r,s,a){M(e).vertexAttrib4f(i>>>0,n,r,s,a)},__wbg_vertexAttrib4f_aad41fe000407191:function(e,i,n,r,s,a){M(e).vertexAttrib4f(i>>>0,n,r,s,a)},__wbg_vertexAttribIPointer_ed1c3507e84527e2:function(e,i,n,r,s,a){M(e).vertexAttribIPointer(i>>>0,n,r>>>0,s,a)},__wbg_vertexAttribPointer_39eddea7c20e350c:function(e,i,n,r,s,a,o){M(e).vertexAttribPointer(i>>>0,n,r>>>0,s!==0,a,o)},__wbg_vertexAttribPointer_3bc50c0431082f73:function(e,i,n,r,s,a,o){M(e).vertexAttribPointer(i>>>0,n,r>>>0,s!==0,a,o)},__wbg_videoFrameToken_6f05524e85fa2b75:function(e){return VP(M(e))},__wbg_videoHeight_e267fd1e74bb1b06:function(e){return M(e).videoHeight},__wbg_videoWidth_670b8e775ea04b5d:function(e){return M(e).videoWidth},__wbg_viewport_14d947f2faf58e85:function(e,i,n,r,s){M(e).viewport(i,n,r,s)},__wbg_viewport_24055b0754803788:function(e,i,n,r,s){M(e).viewport(i,n,r,s)},__wbg_warn_410c3261e3c6d686:function(e){console.warn(M(e))},__wbg_width_f1791280fae1517a:function(e){return M(e).width},__wbg_writeTexture_53ba204c494b042c:function(){return Zt(function(e,i,n,r,s,a){M(e).writeTexture(M(i),gl(n,r),M(s),M(a))},arguments)},__wbindgen_cast_0000000000000001:function(e,i){let n=go(e,i,$G);return H(n)},__wbindgen_cast_0000000000000002:function(e,i){let n=go(e,i,qG);return H(n)},__wbindgen_cast_0000000000000003:function(e,i){let n=go(e,i,YG);return H(n)},__wbindgen_cast_0000000000000004:function(e,i){let n=go(e,i,ZG);return H(n)},__wbindgen_cast_0000000000000005:function(e,i){let n=go(e,i,XG);return H(n)},__wbindgen_cast_0000000000000006:function(e,i){let n=go(e,i,KG);return H(n)},__wbindgen_cast_0000000000000007:function(e,i){let n=go(e,i,QG);return H(n)},__wbindgen_cast_0000000000000008:function(e,i){let n=go(e,i,JG);return H(n)},__wbindgen_cast_0000000000000009:function(e,i){let n=go(e,i,WG);return H(n)},__wbindgen_cast_000000000000000a:function(e){return H(e)},__wbindgen_cast_000000000000000b:function(e,i){let n=ls(e,i);return H(n)},__wbindgen_cast_000000000000000c:function(e,i){let n=SH(e,i);return H(n)},__wbindgen_cast_000000000000000d:function(e,i){let n=tD(e,i);return H(n)},__wbindgen_cast_000000000000000e:function(e,i){let n=MH(e,i);return H(n)},__wbindgen_cast_000000000000000f:function(e,i){let n=EH(e,i);return H(n)},__wbindgen_cast_0000000000000010:function(e,i){let n=Gp(e,i);return H(n)},__wbindgen_cast_0000000000000011:function(e,i){let n=gl(e,i);return H(n)},__wbindgen_cast_0000000000000012:function(e,i){let n=Te(e,i);return H(n)},__wbindgen_cast_0000000000000013:function(e){let i=BigInt.asUintN(64,e);return H(i)},__wbindgen_cast_0000000000000014:function(e,i){var n=gl(e,i).slice();return K.__wbindgen_export4(e,i*1,1),H(n)},__wbindgen_object_clone_ref:function(e){let i=M(e);return H(i)},__wbindgen_object_drop_ref:function(e){Kt(e)}}}}function WG(t,e){K.__wasm_bindgen_func_elem_12552(t,e)}function qG(t,e,i){K.__wasm_bindgen_func_elem_5119(t,e,H(i))}function XG(t,e,i){K.__wasm_bindgen_func_elem_11146(t,e,H(i))}function $G(t,e,i){try{let s=K.__wbindgen_add_to_stack_pointer(-16);K.__wasm_bindgen_func_elem_14189(s,t,e,H(i));var n=ie().getInt32(s+4*0,!0),r=ie().getInt32(s+4*1,!0);if(r)throw Kt(n)}finally{K.__wbindgen_add_to_stack_pointer(16)}}function YG(t,e,i){try{let s=K.__wbindgen_add_to_stack_pointer(-16);K.__wasm_bindgen_func_elem_11145(s,t,e,H(i));var n=ie().getInt32(s+4*0,!0),r=ie().getInt32(s+4*1,!0);if(r)throw Kt(n)}finally{K.__wbindgen_add_to_stack_pointer(16)}}function ZG(t,e,i){try{let s=K.__wbindgen_add_to_stack_pointer(-16);K.__wasm_bindgen_func_elem_11145_3(s,t,e,H(i));var n=ie().getInt32(s+4*0,!0),r=ie().getInt32(s+4*1,!0);if(r)throw Kt(n)}finally{K.__wbindgen_add_to_stack_pointer(16)}}function KG(t,e,i){try{let s=K.__wbindgen_add_to_stack_pointer(-16);K.__wasm_bindgen_func_elem_11145_5(s,t,e,H(i));var n=ie().getInt32(s+4*0,!0),r=ie().getInt32(s+4*1,!0);if(r)throw Kt(n)}finally{K.__wbindgen_add_to_stack_pointer(16)}}function QG(t,e,i){try{let s=K.__wbindgen_add_to_stack_pointer(-16);K.__wasm_bindgen_func_elem_11145_6(s,t,e,H(i));var n=ie().getInt32(s+4*0,!0),r=ie().getInt32(s+4*1,!0);if(r)throw Kt(n)}finally{K.__wbindgen_add_to_stack_pointer(16)}}function JG(t,e,i){try{let s=K.__wbindgen_add_to_stack_pointer(-16);K.__wasm_bindgen_func_elem_11145_7(s,t,e,H(i));var n=ie().getInt32(s+4*0,!0),r=ie().getInt32(s+4*1,!0);if(r)throw Kt(n)}finally{K.__wbindgen_add_to_stack_pointer(16)}}function qP(t,e,i,n){K.__wasm_bindgen_func_elem_14191(t,e,H(i),H(n))}function H(t){Jp===Xs.length&&Xs.push(Xs.length+1);let e=Jp;return Jp=Xs[e],Xs[e]=t,e}function bH(t){if(m0==1)throw new Error("out of js stack");return Xs[--m0]=t,m0}function Jx(t){let e=typeof t;if(e=="number"||e=="boolean"||t==null)return`${t}`;if(e=="string")return`"${t}"`;if(e=="symbol"){let r=t.description;return r==null?"Symbol":`Symbol(${r})`}if(e=="function"){let r=t.name;return typeof r=="string"&&r.length>0?`Function(${r})`:"Function"}if(Array.isArray(t)){let r=t.length,s="[";r>0&&(s+=Jx(t[0]));for(let a=1;a<r;a++)s+=", "+Jx(t[a]);return s+="]",s}let i=/\[object ([^\]]+)\]/.exec(toString.call(t)),n;if(i&&i.length>1)n=i[1];else return toString.call(t);if(n=="Object")try{return"Object("+JSON.stringify(t)+")"}catch{return"Object"}return t instanceof Error?`${t.name}: ${t.message}
|
|
36
36
|
${t.stack}`:n}function xH(t){t<1028||(Xs[t]=Jp,Jp=t)}function ls(t,e){return t=t>>>0,AH().subarray(t/4,t/4+e)}function wH(t,e){return t=t>>>0,TH().subarray(t/8,t/8+e)}function SH(t,e){return t=t>>>0,CH().subarray(t/2,t/2+e)}function tD(t,e){return t=t>>>0,PH().subarray(t/4,t/4+e)}function MH(t,e){return t=t>>>0,DH().subarray(t/1,t/1+e)}function jp(t,e){t=t>>>0;let i=ie(),n=[];for(let r=t;r<t+4*e;r+=4)n.push(Kt(i.getUint32(r,!0)));return n}function qs(t,e){t=t>>>0;let i=ie(),n=[];for(let r=t;r<t+4*e;r+=4)n.push(M(i.getUint32(r,!0)));return n}function EH(t,e){return t=t>>>0,RH().subarray(t/2,t/2+e)}function Gp(t,e){return t=t>>>0,IH().subarray(t/4,t/4+e)}function gl(t,e){return t=t>>>0,Qp().subarray(t/1,t/1+e)}function ie(){return(Ph===null||Ph.buffer.detached===!0||Ph.buffer.detached===void 0&&Ph.buffer!==K.memory.buffer)&&(Ph=new DataView(K.memory.buffer)),Ph}function AH(){return(Hp===null||Hp.byteLength===0)&&(Hp=new Float32Array(K.memory.buffer)),Hp}function TH(){return(Wp===null||Wp.byteLength===0)&&(Wp=new Float64Array(K.memory.buffer)),Wp}function CH(){return(qp===null||qp.byteLength===0)&&(qp=new Int16Array(K.memory.buffer)),qp}function PH(){return(Xp===null||Xp.byteLength===0)&&(Xp=new Int32Array(K.memory.buffer)),Xp}function DH(){return($p===null||$p.byteLength===0)&&($p=new Int8Array(K.memory.buffer)),$p}function Te(t,e){return LH(t>>>0,e)}function RH(){return(Yp===null||Yp.byteLength===0)&&(Yp=new Uint16Array(K.memory.buffer)),Yp}function IH(){return(Zp===null||Zp.byteLength===0)&&(Zp=new Uint32Array(K.memory.buffer)),Zp}function Qp(){return(Kp===null||Kp.byteLength===0)&&(Kp=new Uint8Array(K.memory.buffer)),Kp}function M(t){return Xs[t]}function Zt(t,e){try{return t.apply(this,e)}catch(i){K.__wbindgen_export3(H(i))}}function ne(t){return t==null}function go(t,e,i){let n={a:t,b:e,cnt:1},r=(...s)=>{n.cnt++;let a=n.a;n.a=0;try{return i(a,n.b,...s)}finally{n.a=a,r._wbg_cb_unref()}};return r._wbg_cb_unref=()=>{--n.cnt===0&&(K.__wbindgen_export5(n.a,n.b),n.a=0,JP.unregister(n))},JP.register(r,n,n),r}function eD(t,e){let i=e(t.length*4,4)>>>0,n=ie();for(let r=0;r<t.length;r++)n.setUint32(i+4*r,H(t[r]),!0);return Si=t.length,i}function Zi(t,e,i){if(i===void 0){let o=tf.encode(t),l=e(o.length,1)>>>0;return Qp().subarray(l,l+o.length).set(o),Si=o.length,l}let n=t.length,r=e(n,1)>>>0,s=Qp(),a=0;for(;a<n;a++){let o=t.charCodeAt(a);if(o>127)break;s[r+a]=o}if(a!==n){a!==0&&(t=t.slice(a)),r=i(r,n,n=a+t.length*3,1)>>>0;let o=Qp().subarray(r+a,r+n),l=tf.encodeInto(t,o);a+=l.written,r=i(r,n,a,1)>>>0}return Si=a,r}function Kt(t){let e=M(t);return xH(t),e}function LH(t,e){return Qx+=e,Qx>=OH&&(g0=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),g0.decode(),Qx=e),g0.decode(Qp().subarray(t,t+e))}function nD(t,e){return UH=t,K=t.exports,BH=e,Ph=null,Hp=null,Wp=null,qp=null,Xp=null,$p=null,Yp=null,Zp=null,Kp=null,K.__wbindgen_start(),K}async function zH(t,e){if(typeof Response=="function"&&t instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(r){if(t.ok&&i(t.type)&&t.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",r);else throw r}let n=await t.arrayBuffer();return await WebAssembly.instantiate(n,e)}else{let n=await WebAssembly.instantiate(t,e);return n instanceof WebAssembly.Instance?{instance:n,module:t}:n}function i(n){switch(n){case"basic":case"cors":case"default":return!0}return!1}}function FH(t){if(K!==void 0)return K;t!==void 0&&(Object.getPrototypeOf(t)===Object.prototype?{module:t}=t:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let e=iD();t instanceof WebAssembly.Module||(t=new WebAssembly.Module(t));let i=new WebAssembly.Instance(t,e);return nD(i,t)}async function NH(t){if(K!==void 0)return K;t!==void 0&&(Object.getPrototypeOf(t)===Object.prototype?{module_or_path:t}=t:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),t===void 0&&(t=new URL("hana-ui.wasm",import.meta.url));let e=iD();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));let{instance:i,module:n}=await zH(await t,e);return nD(i,n)}var vl,yl,vo,ef,Hx,XP,$P,tH,eH,iH,nH,Wx,rH,sH,aH,YP,oH,qx,Xx,lH,hH,cH,dH,uH,$x,pH,Yx,Zx,fH,Ch,mH,Kx,gH,vH,yH,ZP,KP,QP,_H,JP,Ph,Hp,Wp,qp,Xp,$p,Yp,Zp,Kp,Xs,Jp,m0,g0,OH,Qx,tf,Si,BH,UH,K,sD=c0(()=>{"use strict";WP();vl=class{static __wrap(e){let i=Object.create(vl.prototype);return i.__wbg_ptr=e,ZP.register(i,i.__wbg_ptr,i),i}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,ZP.unregister(this),e}free(){let e=this.__destroy_into_raw();K.__wbg_devicelostpromise_free(e,0)}wait(){let e=this.__destroy_into_raw(),i=K.devicelostpromise_wait(e);return Kt(i)}};Symbol.dispose&&(vl.prototype[Symbol.dispose]=vl.prototype.free);yl=class{static __wrap(e){let i=Object.create(yl.prototype);return i.__wbg_ptr=e,KP.register(i,i.__wbg_ptr,i),i}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,KP.unregister(this),e}free(){let e=this.__destroy_into_raw();K.__wbg_engine_free(e,0)}static create(e,i,n){let r=K.engine_create(H(e),H(i),n);return Kt(r)}getDeviceLostPromise(){let e=K.engine_getDeviceLostPromise(this.__wbg_ptr);return e===0?void 0:vl.__wrap(e)}getGpuFrameTimeMs(){try{let n=K.__wbindgen_add_to_stack_pointer(-16);K.engine_getGpuFrameTimeMs(n,this.__wbg_ptr);var e=ie().getInt32(n+4*0,!0),i=ie().getFloat64(n+8*1,!0);return e===0?void 0:i}finally{K.__wbindgen_add_to_stack_pointer(16)}}isWebgpu(){return K.engine_isWebgpu(this.__wbg_ptr)!==0}onFrame(e){K.engine_onFrame(this.__wbg_ptr,!ne(e),ne(e)?0:e)}removeTexture(e){K.engine_removeTexture(this.__wbg_ptr,H(e))}renderRegion(e,i,n){let r=K.engine_renderRegion(this.__wbg_ptr,H(e),H(i),n);return vo.__wrap(r)}reset(e){K.engine_reset(this.__wbg_ptr,H(e))}resize(e,i){K.engine_resize(this.__wbg_ptr,H(e),i)}samplePixels(e,i){let n=K.engine_samplePixels(this.__wbg_ptr,H(e),H(i));return vo.__wrap(n)}};Symbol.dispose&&(yl.prototype[Symbol.dispose]=yl.prototype.free);vo=class{static __wrap(e){let i=Object.create(vo.prototype);return i.__wbg_ptr=e,QP.register(i,i.__wbg_ptr,i),i}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,QP.unregister(this),e}free(){let e=this.__destroy_into_raw();K.__wbg_pixelreadpromise_free(e,0)}wait(){let e=this.__destroy_into_raw(),i=K.pixelreadpromise_wait(e);return Kt(i)}};Symbol.dispose&&(vo.prototype[Symbol.dispose]=vo.prototype.free);ef=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,_H.unregister(this),e}free(){let e=this.__destroy_into_raw();K.__wbg_scenecontroller_free(e,0)}get is_play_mode(){return K.__wbg_get_scenecontroller_is_play_mode(this.__wbg_ptr)!==0}get needs_video_update(){return K.__wbg_get_scenecontroller_needs_video_update(this.__wbg_ptr)!==0}get show_pixel_grid(){return K.__wbg_get_scenecontroller_show_pixel_grid(this.__wbg_ptr)!==0}addEmojiArt(e,i){let n=Zi(e,K.__wbindgen_export,K.__wbindgen_export2),r=Si;K.scenecontroller_addEmojiArt(this.__wbg_ptr,n,r,H(i))}addImage(e,i){K.scenecontroller_addImage(this.__wbg_ptr,H(e),H(i))}addLocalFont(e,i,n,r,s){var a=ne(n)?0:Zi(n,K.__wbindgen_export,K.__wbindgen_export2),o=Si,l=ne(r)?0:Zi(r,K.__wbindgen_export,K.__wbindgen_export2),c=Si,h=ne(s)?0:Zi(s,K.__wbindgen_export,K.__wbindgen_export2),d=Si;K.scenecontroller_addLocalFont(this.__wbg_ptr,H(e),H(i),a,o,l,c,h,d)}addModel3DGeometry(e,i){K.scenecontroller_addModel3DGeometry(this.__wbg_ptr,H(e),H(i))}addVideo(e,i){K.scenecontroller_addVideo(this.__wbg_ptr,H(e),H(i))}addWebFont(e,i){let n=Zi(i,K.__wbindgen_export,K.__wbindgen_export2),r=Si,s=K.scenecontroller_addWebFont(this.__wbg_ptr,H(e),n,r);return Kt(s)}applyDeltaToVectorVertexPositionSelection(e,i,n){let r=K.scenecontroller_applyDeltaToVectorVertexPositionSelection(this.__wbg_ptr,H(e),H(i),H(n));return Kt(r)}axisAlignedBoundingBox(e){let i=K.scenecontroller_axisAlignedBoundingBox(this.__wbg_ptr,H(e));return Kt(i)}boundingBox(){let e=K.scenecontroller_boundingBox(this.__wbg_ptr);return Kt(e)}boxIntersectsObjects(e,i,n,r,s){try{let c=K.__wbindgen_add_to_stack_pointer(-16);K.scenecontroller_boxIntersectsObjects(c,this.__wbg_ptr,H(e),H(i),n,r,ne(s)?0:H(s));var a=ie().getInt32(c+4*0,!0),o=ie().getInt32(c+4*1,!0),l=jp(a,o).slice();return K.__wbindgen_export4(a,o*4,4),l}finally{K.__wbindgen_add_to_stack_pointer(16)}}calcTextAutoSize(e,i){let n=K.scenecontroller_calcTextAutoSize(this.__wbg_ptr,H(e),ne(i)?Number.MAX_SAFE_INTEGER:Math.fround(i));return Kt(n)}centerPencilData(e){let i=K.scenecontroller_centerPencilData(this.__wbg_ptr,H(e));return Kt(i)}centerVectorData(){let e=K.scenecontroller_centerVectorData(this.__wbg_ptr);return Kt(e)}clearVideoExportFrame(e){K.scenecontroller_clearVideoExportFrame(this.__wbg_ptr,H(e))}clearVideoExportFrames(){K.scenecontroller_clearVideoExportFrames(this.__wbg_ptr)}figmaVectorToVecNet(e,i){let n=K.scenecontroller_figmaVectorToVecNet(this.__wbg_ptr,H(e),H(i));return Kt(n)}flattenShape(e){let i=K.scenecontroller_flattenShape(this.__wbg_ptr,H(e));return Kt(i)}flushLayout(e){try{let s=K.__wbindgen_add_to_stack_pointer(-16);K.scenecontroller_flushLayout(s,this.__wbg_ptr,H(e));var i=ie().getInt32(s+4*0,!0),n=ie().getInt32(s+4*1,!0),r=jp(i,n).slice();return K.__wbindgen_export4(i,n*4,4),r}finally{K.__wbindgen_add_to_stack_pointer(16)}}getCurrentFrameIndex(){let e=K.scenecontroller_getCurrentFrameIndex(this.__wbg_ptr);return e===Number.MAX_SAFE_INTEGER?void 0:e}getTotalFramesAmount(){return K.scenecontroller_getTotalFramesAmount(this.__wbg_ptr)>>>0}getUpdatedPencilData(){let e=K.scenecontroller_getUpdatedPencilData(this.__wbg_ptr);return Kt(e)}getUpdatedVecNetData(){let e=K.scenecontroller_getUpdatedVecNetData(this.__wbg_ptr);return Kt(e)}getVectorBoxSelectionBoundsAndLocalMatrix(e){let i=K.scenecontroller_getVectorBoxSelectionBoundsAndLocalMatrix(this.__wbg_ptr,e);return Kt(i)}getVectorCursor(){let e=K.scenecontroller_getVectorCursor(this.__wbg_ptr);return Kt(e)}getVectorEditMode(){let e=K.scenecontroller_getVectorEditMode(this.__wbg_ptr);return Kt(e)}getVectorEditingState(){let e=K.scenecontroller_getVectorEditingState(this.__wbg_ptr);return Kt(e)}getVectorSelectedVerts(){let e=K.scenecontroller_getVectorSelectedVerts(this.__wbg_ptr);return Kt(e)}getVectorSelectionCount(){return K.scenecontroller_getVectorSelectionCount(this.__wbg_ptr)>>>0}hasFontAssetsChanges(){return K.scenecontroller_hasFontAssetsChanges(this.__wbg_ptr)!==0}hasSingleVectorSelectedSegment(){return K.scenecontroller_hasSingleVectorSelectedSegment(this.__wbg_ptr)!==0}instanceRootOf(e){let i=K.scenecontroller_instanceRootOf(this.__wbg_ptr,H(e));return Kt(i)}intersectsObject(e,i,n,r){return K.scenecontroller_intersectsObject(this.__wbg_ptr,H(e),H(i),ne(n)?Number.MAX_SAFE_INTEGER:Math.fround(n),ne(r)?16777215:r?1:0)!==0}intersectsObjects(e,i,n){try{let o=K.__wbindgen_add_to_stack_pointer(-16);K.scenecontroller_intersectsObjects(o,this.__wbg_ptr,H(e),ne(i)?16777215:i?1:0,ne(n)?Number.MAX_SAFE_INTEGER:Math.fround(n));var r=ie().getInt32(o+4*0,!0),s=ie().getInt32(o+4*1,!0),a=jp(r,s).slice();return K.__wbindgen_export4(r,s*4,4),a}finally{K.__wbindgen_add_to_stack_pointer(16)}}isEditedVectorEmpty(){return K.scenecontroller_isEditedVectorEmpty(this.__wbg_ptr)!==0}isObjectInViewport(e){return K.scenecontroller_isObjectInViewport(this.__wbg_ptr,H(e))!==0}isUiFontLoaded(){return K.scenecontroller_isUiFontLoaded(this.__wbg_ptr)!==0}isVectorBoxSelectAllowed(){return K.scenecontroller_isVectorBoxSelectAllowed(this.__wbg_ptr)!==0}isVectorPointUnderCursor(e){return K.scenecontroller_isVectorPointUnderCursor(this.__wbg_ptr,H(e))!==0}layout(){K.scenecontroller_layout(this.__wbg_ptr)}layoutFromResize(){try{let r=K.__wbindgen_add_to_stack_pointer(-16);K.scenecontroller_layoutFromResize(r,this.__wbg_ptr);var e=ie().getInt32(r+4*0,!0),i=ie().getInt32(r+4*1,!0),n=jp(e,i).slice();return K.__wbindgen_export4(e,i*4,4),n}finally{K.__wbindgen_add_to_stack_pointer(16)}}markNeedsLayoutResolve(e){K.scenecontroller_markNeedsLayoutResolve(this.__wbg_ptr,H(e))}measureTextNaturalSize(e){let i=K.scenecontroller_measureTextNaturalSize(this.__wbg_ptr,H(e));return Kt(i)}model3DAnimationClipIndex(e){let i=K.scenecontroller_model3DAnimationClipIndex(this.__wbg_ptr,H(e));return i===Number.MAX_SAFE_INTEGER?void 0:i}model3DAnimationIsPlaying(e){return K.scenecontroller_model3DAnimationIsPlaying(this.__wbg_ptr,H(e))!==0}model3DAnimationLocalTime(e){let i=K.scenecontroller_model3DAnimationLocalTime(this.__wbg_ptr,H(e));return i===Number.MAX_SAFE_INTEGER?void 0:i}moveVectorSelectionByDelta(e){K.scenecontroller_moveVectorSelectionByDelta(this.__wbg_ptr,H(e))}objectAlignedBoundingBox(e){let i=K.scenecontroller_objectAlignedBoundingBox(this.__wbg_ptr,H(e));return Kt(i)}objectData(e){let i=K.scenecontroller_objectData(this.__wbg_ptr,H(e));return Kt(i)}objectLocalMatrix(e){let i=K.scenecontroller_objectLocalMatrix(this.__wbg_ptr,H(e));return Kt(i)}objectWorldMatrix(e){let i=K.scenecontroller_objectWorldMatrix(this.__wbg_ptr,H(e));return Kt(i)}objectWorldMatrixWithChildrenOffset(e){let i=K.scenecontroller_objectWorldMatrixWithChildrenOffset(this.__wbg_ptr,H(e));return Kt(i)}onKeyDown(e){let i=Zi(e,K.__wbindgen_export,K.__wbindgen_export2),n=Si;K.scenecontroller_onKeyDown(this.__wbg_ptr,i,n)}onKeyUp(e){let i=Zi(e,K.__wbindgen_export,K.__wbindgen_export2),n=Si;K.scenecontroller_onKeyUp(this.__wbg_ptr,i,n)}onPointerDown(e,i,n){K.scenecontroller_onPointerDown(this.__wbg_ptr,H(e),i,n)}onPointerEnter(){K.scenecontroller_onPointerEnter(this.__wbg_ptr)}onPointerLeave(){K.scenecontroller_onPointerLeave(this.__wbg_ptr)}onPointerMove(e,i,n){K.scenecontroller_onPointerMove(this.__wbg_ptr,H(e),i,n)}onPointerUp(e,i,n){K.scenecontroller_onPointerUp(this.__wbg_ptr,H(e),i,n)}outermostInstanceRootOf(e){let i=K.scenecontroller_outermostInstanceRootOf(this.__wbg_ptr,H(e));return Kt(i)}parentAlignedBoundingBox(e,i){let n=K.scenecontroller_parentAlignedBoundingBox(this.__wbg_ptr,H(e),H(i));return Kt(n)}parseSvgPath(e,i){let n=Zi(e,K.__wbindgen_export,K.__wbindgen_export2),r=Si,s=K.scenecontroller_parseSvgPath(this.__wbg_ptr,n,r,i);return Kt(s)}pencilShiftDown(){K.scenecontroller_pencilShiftDown(this.__wbg_ptr)}pencilShiftUp(){K.scenecontroller_pencilShiftUp(this.__wbg_ptr)}pendingAssetLoads(){return K.scenecontroller_pendingAssetLoads(this.__wbg_ptr)>>>0}playInEditorFrame(e){K.scenecontroller_playInEditorFrame(this.__wbg_ptr,H(e))}present(e,i){K.scenecontroller_present(this.__wbg_ptr,ne(e)?0:H(e),ne(i)?16777215:i?1:0)}previewTransition(e,i,n){K.scenecontroller_previewTransition(this.__wbg_ptr,H(e),ne(i)?0:H(i),H(n))}projectionEffectBoundingBox(e){let i=K.scenecontroller_projectionEffectBoundingBox(this.__wbg_ptr,H(e));return Kt(i)}readVectorCornerRadiiForSelection(e,i){let n=K.scenecontroller_readVectorCornerRadiiForSelection(this.__wbg_ptr,H(e),H(i));return Kt(n)}readVectorCornerSmoothing(e){return K.scenecontroller_readVectorCornerSmoothing(this.__wbg_ptr,H(e))}readVectorVertexPositionsForSelection(e,i){let n=K.scenecontroller_readVectorVertexPositionsForSelection(this.__wbg_ptr,H(e),H(i));return Kt(n)}reanchorObject(e){K.scenecontroller_reanchorObject(this.__wbg_ptr,H(e))}resetAllStates(e,i){let n=eD(i,K.__wbindgen_export),r=Si;K.scenecontroller_resetAllStates(this.__wbg_ptr,ne(e)?0:H(e),n,r)}resizeGroup(e,i,n){try{let o=K.__wbindgen_add_to_stack_pointer(-16);K.scenecontroller_resizeGroup(o,this.__wbg_ptr,H(e),i,n);var r=ie().getInt32(o+4*0,!0),s=ie().getInt32(o+4*1,!0),a=jp(r,s).slice();return K.__wbindgen_export4(r,s*4,4),a}finally{K.__wbindgen_add_to_stack_pointer(16)}}saveVectorSelectionInitialPositions(){K.scenecontroller_saveVectorSelectionInitialPositions(this.__wbg_ptr)}screenToWorld(e){let i=K.scenecontroller_screenToWorld(this.__wbg_ptr,H(e));return Kt(i)}seekVideos(e){let i=K.scenecontroller_seekVideos(this.__wbg_ptr,e);return Kt(i)}setBytesForVectorCornerRadiusSelection(e,i,n){let r=K.scenecontroller_setBytesForVectorCornerRadiusSelection(this.__wbg_ptr,H(e),H(i),n);return Kt(r)}setBytesForVectorCornerSmoothing(e,i){let n=K.scenecontroller_setBytesForVectorCornerSmoothing(this.__wbg_ptr,H(e),i);return Kt(n)}setBytesForVectorVertexPositionSelection(e,i,n,r){let s=K.scenecontroller_setBytesForVectorVertexPositionSelection(this.__wbg_ptr,H(e),H(i),n,r);return Kt(s)}setModel3DAnimation(e,i,n){K.scenecontroller_setModel3DAnimation(this.__wbg_ptr,H(e),ne(i)?Number.MAX_SAFE_INTEGER:i>>>0,n)}setModel3DAnimationLocalTime(e,i){K.scenecontroller_setModel3DAnimationLocalTime(this.__wbg_ptr,H(e),i)}setPresentationPadding(e){K.scenecontroller_setPresentationPadding(this.__wbg_ptr,H(e))}setShowPixelGrid(e){K.scenecontroller_setShowPixelGrid(this.__wbg_ptr,e)}setVectorEditingState(e){try{K.scenecontroller_setVectorEditingState(this.__wbg_ptr,bH(e))}finally{Xs[m0++]=void 0}}setVectorTool(e){K.scenecontroller_setVectorTool(this.__wbg_ptr,H(e))}setVideoExportFrame(e,i){K.scenecontroller_setVideoExportFrame(this.__wbg_ptr,H(e),H(i))}snapVectorResizeHandle(e,i,n){let r=K.scenecontroller_snapVectorResizeHandle(this.__wbg_ptr,H(e),i,n);return Kt(r)}start(){K.scenecontroller_start(this.__wbg_ptr)}startPencil(e,i,n){K.scenecontroller_startPencil(this.__wbg_ptr,H(e),i,H(n))}startVectorEditing(e,i){K.scenecontroller_startVectorEditing(this.__wbg_ptr,H(e),i)}stopInEditorFrame(){K.scenecontroller_stopInEditorFrame(this.__wbg_ptr)}stopPencil(){K.scenecontroller_stopPencil(this.__wbg_ptr)}stopPresenting(){K.scenecontroller_stopPresenting(this.__wbg_ptr)}stopPreviewTransition(){K.scenecontroller_stopPreviewTransition(this.__wbg_ptr)}stopVectorEditing(){K.scenecontroller_stopVectorEditing(this.__wbg_ptr)}strokeShape(e){let i=K.scenecontroller_strokeShape(this.__wbg_ptr,H(e));return Kt(i)}switchScene(e){K.scenecontroller_switchScene(this.__wbg_ptr,H(e))}transformBoundingBoxByAlignObject(e,i,n,r){let s=K.scenecontroller_transformBoundingBoxByAlignObject(this.__wbg_ptr,H(e),H(i),H(n),H(r));return Kt(s)}transformVectorSelection(e,i,n,r){return K.scenecontroller_transformVectorSelection(this.__wbg_ptr,H(e),H(i),n,r)!==0}triggerEventForObjectIds(e){let i=eD(e,K.__wbindgen_export),n=Si;K.scenecontroller_triggerEventForObjectIds(this.__wbg_ptr,i,n)}updateByOp(e){K.scenecontroller_updateByOp(this.__wbg_ptr,H(e))}updateCached(){K.scenecontroller_updateCached(this.__wbg_ptr)}updateCamera(e){K.scenecontroller_updateCamera(this.__wbg_ptr,H(e))}updateComponents(e){K.scenecontroller_updateComponents(this.__wbg_ptr,H(e))}updatePublish(e){K.scenecontroller_updatePublish(this.__wbg_ptr,H(e))}updateSceneOp(e){K.scenecontroller_updateSceneOp(this.__wbg_ptr,H(e))}updateUiShapes(e){K.scenecontroller_updateUiShapes(this.__wbg_ptr,H(e))}vectorAllowMultiSelect(e){K.scenecontroller_vectorAllowMultiSelect(this.__wbg_ptr,e)}vectorBoxSelect(e,i){K.scenecontroller_vectorBoxSelect(this.__wbg_ptr,H(e),H(i))}vectorClearSnapping(){K.scenecontroller_vectorClearSnapping(this.__wbg_ptr)}vectorDeleteSelection(e){K.scenecontroller_vectorDeleteSelection(this.__wbg_ptr,e)}vectorResize(e,i){let n=K.scenecontroller_vectorResize(this.__wbg_ptr,H(e),H(i));return Kt(n)}vectorResizeWithCornerRadii(e,i,n){let r=K.scenecontroller_vectorResizeWithCornerRadii(this.__wbg_ptr,H(e),H(i),n);return Kt(r)}vectorSetIsAltPressed(e){K.scenecontroller_vectorSetIsAltPressed(this.__wbg_ptr,e)}vectorSetIsSnapping(e){K.scenecontroller_vectorSetIsSnapping(this.__wbg_ptr,e)}vectorSetIsSnappingControlAngles(e){K.scenecontroller_vectorSetIsSnappingControlAngles(this.__wbg_ptr,e)}vectorStopContinueSubpath(){K.scenecontroller_vectorStopContinueSubpath(this.__wbg_ptr)}videoFillSources(e){let i=K.scenecontroller_videoFillSources(this.__wbg_ptr,H(e));return Kt(i)}worldToScreen(e){let i=K.scenecontroller_worldToScreen(this.__wbg_ptr,H(e));return Kt(i)}set is_play_mode(e){K.__wbg_set_scenecontroller_is_play_mode(this.__wbg_ptr,e)}set needs_video_update(e){K.__wbg_set_scenecontroller_needs_video_update(this.__wbg_ptr,e)}set show_pixel_grid(e){K.__wbg_set_scenecontroller_show_pixel_grid(this.__wbg_ptr,e)}};Symbol.dispose&&(ef.prototype[Symbol.dispose]=ef.prototype.free);Hx=["clamp-to-edge","repeat","mirror-repeat"],XP=["auto"],$P=["zero","one","src","one-minus-src","src-alpha","one-minus-src-alpha","dst","one-minus-dst","dst-alpha","one-minus-dst-alpha","src-alpha-saturated","constant","one-minus-constant","src1","one-minus-src1","src1-alpha","one-minus-src1-alpha"],tH=["add","subtract","reverse-subtract","min","max"],eH=["uniform","storage","read-only-storage"],iH=["opaque","premultiplied"],nH=["standard","extended"],Wx=["never","less","equal","less-equal","greater","not-equal","greater-equal","always"],rH=["none","front","back"],sH=["unknown","destroyed"],aH=["validation","out-of-memory","internal"],YP=["nearest","linear"],oH=["ccw","cw"],qx=["uint16","uint32"],Xx=["load","clear"],lH=["nearest","linear"],hH=["low-power","high-performance"],cH=["point-list","line-list","line-strip","triangle-list","triangle-strip"],dH=["occlusion","timestamp"],uH=["filtering","non-filtering","comparison"],$x=["keep","zero","replace","invert","increment-clamp","decrement-clamp","increment-wrap","decrement-wrap"],pH=["write-only","read-only","read-write"],Yx=["store","discard"],Zx=["all","stencil-only","depth-only"],fH=["1d","2d","3d"],Ch=["r8unorm","r8snorm","r8uint","r8sint","r16unorm","r16snorm","r16uint","r16sint","r16float","rg8unorm","rg8snorm","rg8uint","rg8sint","r32uint","r32sint","r32float","rg16unorm","rg16snorm","rg16uint","rg16sint","rg16float","rgba8unorm","rgba8unorm-srgb","rgba8snorm","rgba8uint","rgba8sint","bgra8unorm","bgra8unorm-srgb","rgb9e5ufloat","rgb10a2uint","rgb10a2unorm","rg11b10ufloat","rg32uint","rg32sint","rg32float","rgba16unorm","rgba16snorm","rgba16uint","rgba16sint","rgba16float","rgba32uint","rgba32sint","rgba32float","stencil8","depth16unorm","depth24plus","depth24plus-stencil8","depth32float","depth32float-stencil8","bc1-rgba-unorm","bc1-rgba-unorm-srgb","bc2-rgba-unorm","bc2-rgba-unorm-srgb","bc3-rgba-unorm","bc3-rgba-unorm-srgb","bc4-r-unorm","bc4-r-snorm","bc5-rg-unorm","bc5-rg-snorm","bc6h-rgb-ufloat","bc6h-rgb-float","bc7-rgba-unorm","bc7-rgba-unorm-srgb","etc2-rgb8unorm","etc2-rgb8unorm-srgb","etc2-rgb8a1unorm","etc2-rgb8a1unorm-srgb","etc2-rgba8unorm","etc2-rgba8unorm-srgb","eac-r11unorm","eac-r11snorm","eac-rg11unorm","eac-rg11snorm","astc-4x4-unorm","astc-4x4-unorm-srgb","astc-5x4-unorm","astc-5x4-unorm-srgb","astc-5x5-unorm","astc-5x5-unorm-srgb","astc-6x5-unorm","astc-6x5-unorm-srgb","astc-6x6-unorm","astc-6x6-unorm-srgb","astc-8x5-unorm","astc-8x5-unorm-srgb","astc-8x6-unorm","astc-8x6-unorm-srgb","astc-8x8-unorm","astc-8x8-unorm-srgb","astc-10x5-unorm","astc-10x5-unorm-srgb","astc-10x6-unorm","astc-10x6-unorm-srgb","astc-10x8-unorm","astc-10x8-unorm-srgb","astc-10x10-unorm","astc-10x10-unorm-srgb","astc-12x10-unorm","astc-12x10-unorm-srgb","astc-12x12-unorm","astc-12x12-unorm-srgb"],mH=["float","unfilterable-float","depth","sint","uint"],Kx=["1d","2d","2d-array","cube","cube-array","3d"],gH=["uint8","uint8x2","uint8x4","sint8","sint8x2","sint8x4","unorm8","unorm8x2","unorm8x4","snorm8","snorm8x2","snorm8x4","uint16","uint16x2","uint16x4","sint16","sint16x2","sint16x4","unorm16","unorm16x2","unorm16x4","snorm16","snorm16x2","snorm16x4","float16","float16x2","float16x4","float32","float32x2","float32x3","float32x4","uint32","uint32x2","uint32x3","uint32x4","sint32","sint32x2","sint32x3","sint32x4","unorm10-10-10-2","unorm8x4-bgra"],vH=["vertex","instance"],yH=["same-origin","no-cors","cors","navigate"],ZP=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>K.__wbg_devicelostpromise_free(t,1)),KP=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>K.__wbg_engine_free(t,1)),QP=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>K.__wbg_pixelreadpromise_free(t,1)),_H=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>K.__wbg_scenecontroller_free(t,1));JP=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>K.__wbindgen_export5(t.a,t.b));Ph=null;Hp=null;Wp=null;qp=null;Xp=null;$p=null;Yp=null;Zp=null;Kp=null;Xs=new Array(1024).fill(void 0);Xs.push(void 0,null,!0,!1);Jp=Xs.length;m0=1024;g0=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});g0.decode();OH=2146435072,Qx=0;tf=new TextEncoder;"encodeInto"in tf||(tf.encodeInto=function(t,e){let i=tf.encode(t);return e.set(i),{read:t.length,written:i.length}});Si=0});var kH=Object.create,D1=Object.defineProperty,VH=Object.getOwnPropertyDescriptor,jH=Object.getOwnPropertyNames,GH=Object.getPrototypeOf,HH=Object.prototype.hasOwnProperty,F=(t,e)=>()=>(t&&(e=t(t=0)),e),mp=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),kg=(t,e)=>{for(var i in e)D1(t,i,{get:e[i],enumerable:!0})},gp=(t,e,i)=>(i=t!=null?kH(GH(t)):{},((n,r,s,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of jH(r))!HH.call(n,o)&&o!==void 0&&D1(n,o,{get:()=>r[o],enumerable:!(a=VH(r,o))||a.enumerable});return n})(!e&&t&&t.__esModule?i:D1(i,"default",{value:t,enumerable:!0}),t)),Ka=(t,e,i)=>(((n,r,s)=>{r in n?D1(n,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[r]=s})(t,typeof e!="symbol"?e+"":e,i),i);function v0(t,e){return new oz[t](e)}function Vm(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function WH(){let t=Vm("canvas");return t.style.display="block",t}function R1(...t){let e="THREE."+t.shift();kc?kc("log",e,...t):console.log(e,...t)}function SU(t){let e=t[0];if(typeof e=="string"&&e.startsWith("TSL:")){let i=t[1];i&&i.isStackTrace?t[0]+=" "+i.getLocation():t[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return t}function ce(...t){let e="THREE."+(t=SU(t)).shift();if(kc)kc("warn",e,...t);else{let i=t[0];i&&i.isStackTrace?console.warn(i.getError(e)):console.warn(e,...t)}}function fe(...t){let e="THREE."+(t=SU(t)).shift();if(kc)kc("error",e,...t);else{let i=t[0];i&&i.isStackTrace?console.error(i.getError(e)):console.error(e,...t)}}function pu(...t){let e=t.join(" ");e in YM||(YM[e]=!0,ce(...t))}function Es(){let t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,i=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return(dr[255&t]+dr[t>>8&255]+dr[t>>16&255]+dr[t>>24&255]+"-"+dr[255&e]+dr[e>>8&255]+"-"+dr[e>>16&15|64]+dr[e>>24&255]+"-"+dr[63&i|128]+dr[i>>8&255]+"-"+dr[i>>16&255]+dr[i>>24&255]+dr[255&n]+dr[n>>8&255]+dr[n>>16&255]+dr[n>>24&255]).toLowerCase()}function ge(t,e,i){return Math.max(e,Math.min(i,t))}function DM(t,e){return(t%e+e)%e}function qH(t,e,i,n,r){return n+(t-e)*(r-n)/(i-e)}function XH(t,e,i){return t!==e?(i-t)/(e-t):0}function dm(t,e,i){return(1-i)*t+i*e}function $H(t,e,i,n){return dm(t,e,1-Math.exp(-i*n))}function YH(t,e=1){return e-Math.abs(DM(t,2*e)-e)}function ZH(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*(3-2*t)}function KH(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*t*(t*(6*t-15)+10)}function QH(t,e){return t+Math.floor(Math.random()*(e-t+1))}function JH(t,e){return t+Math.random()*(e-t)}function tW(t){return t*(.5-Math.random())}function eW(t){t!==void 0&&(ZM=t);let e=ZM+=1831565813;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}function iW(t){return t*fu}function nW(t){return t*mu}function rW(t){return!(t&t-1)&&t!==0}function sW(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function aW(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function oW(t,e,i,n,r){let s=Math.cos,a=Math.sin,o=s(i/2),l=a(i/2),c=s((e+n)/2),h=a((e+n)/2),d=s((e-n)/2),u=a((e-n)/2),p=s((n-e)/2),f=a((n-e)/2);switch(r){case"XYX":t.set(o*h,l*d,l*u,o*c);break;case"YZY":t.set(l*u,o*h,l*d,o*c);break;case"ZXZ":t.set(l*d,l*u,o*h,o*c);break;case"XZX":t.set(o*h,l*f,l*p,o*c);break;case"YXY":t.set(l*p,o*h,l*f,o*c);break;case"ZYZ":t.set(l*f,l*p,o*h,o*c);break;default:ce("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function $s(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function mi(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function yo(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function gd(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}function tw(t){return typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap?hz.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(ce("Texture: Unable to serialize Texture."),{})}function ew(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}function iw(t,e,i,n,r){for(let s=0,a=t.length-3;s<=a;s+=3){Ll.fromArray(t,s);let o=r.x*Math.abs(Ll.x)+r.y*Math.abs(Ll.y)+r.z*Math.abs(Ll.z),l=e.dot(Ll),c=i.dot(Ll),h=n.dot(Ll);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>o)return!1}return!0}function y0(t,e,i,n,r,s,a,o,l,c){t.getVertexPosition(o,mm),t.getVertexPosition(l,gm),t.getVertexPosition(c,vm);let h=function(d,u,p,f,g,m,y,v){let _;if(_=u.side===Hn?f.intersectTriangle(y,m,g,!0,v):f.intersectTriangle(g,m,y,u.side===Vs,v),_===null)return null;ym.copy(v),ym.applyMatrix4(d.matrixWorld);let b=p.ray.origin.distanceTo(ym);return b<p.near||b>p.far?null:{distance:b,point:ym.clone(),object:d}}(t,e,i,n,mm,gm,vm,tE);if(h){let d=new C;un.getBarycoord(tE,mm,gm,vm,d),r&&(h.uv=un.getInterpolatedAttribute(r,o,l,c,d,new it)),s&&(h.uv1=un.getInterpolatedAttribute(s,o,l,c,d,new it)),a&&(h.normal=un.getInterpolatedAttribute(a,o,l,c,d,new C),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));let u={a:o,b:l,c,normal:new C,materialIndex:0};un.getNormal(mm,gm,vm,u.normal),h.face=u,h.barycoord=d}return h}function _0(t,e,i,n,r,s,a){let o=t.geometry.attributes.position;if(Xm.fromBufferAttribute(o,r),$m.fromBufferAttribute(o,s),i.distanceSqToSegment(Xm,$m,Jy,iE)>n)return;Jy.applyMatrix4(t.matrixWorld);let l=e.ray.origin.distanceTo(Jy);return l<e.near||l>e.far?void 0:{distance:l,point:iE.clone().applyMatrix4(t.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:t}}function nw(){let t=0,e=0,i=0,n=0;function r(s,a,o,l){t=s,e=o,i=-3*s+3*a-2*o-l,n=2*s-2*a+o+l}return{initCatmullRom:function(s,a,o,l,c){r(a,o,c*(o-s),c*(l-a))},initNonuniformCatmullRom:function(s,a,o,l,c,h,d){let u=(a-s)/c-(o-s)/(c+h)+(o-a)/h,p=(o-a)/h-(l-a)/(h+d)+(l-o)/d;u*=h,p*=h,r(a,o,u,p)},calc:function(s){let a=s*s;return t+e*s+i*a+n*(a*s)}}}function aD(t,e,i,n,r){let s=.5*(n-e),a=.5*(r-i),o=t*t;return(2*i-2*n+s+a)*(t*o)+(-3*i+3*n-2*s-a)*o+s*t+i}function nf(t,e,i,n){return function(r,s){let a=1-r;return a*a*s}(t,e)+function(r,s){return 2*(1-r)*r*s}(t,i)+function(r,s){return r*r*s}(t,n)}function rf(t,e,i,n,r){return function(s,a){let o=1-s;return o*o*o*a}(t,e)+function(s,a){let o=1-s;return 3*o*o*s*a}(t,i)+function(s,a){return 3*(1-s)*s*s*a}(t,n)+function(s,a){return s*s*s*a}(t,r)}function oD(t,e,i,n,r){let s;if(r===function(a,o,l,c){let h=0;for(let d=o,u=l-c;d<l;d+=c)h+=(a[u]-a[d])*(a[d+1]+a[u+1]),u=d;return h}(t,e,i,n)>0)for(let a=e;a<i;a+=n)s=lD(a/n|0,t[a],t[a+1],s);else for(let a=i-n;a>=e;a-=n)s=lD(a/n|0,t[a],t[a+1],s);return s&&rp(s,s.next)&&(yg(s),s=s.next),s}function Nc(t,e){if(!t)return t;e||(e=t);let i,n=t;do if(i=!1,n.steiner||!rp(n,n.next)&&Wi(n.prev,n,n.next)!==0)n=n.next;else{if(yg(n),n=e=n.prev,n===n.next)break;i=!0}while(i||n!==e);return e}function gg(t,e,i,n,r,s,a){if(!t)return;!a&&s&&function(l,c,h,d){let u=l;do u.z===0&&(u.z=RM(u.x,u.y,c,h,d)),u.prevZ=u.prev,u.nextZ=u.next,u=u.next;while(u!==l);u.prevZ.nextZ=null,u.prevZ=null,function(p){let f,g=1;do{let m,y=p;p=null;let v=null;for(f=0;y;){f++;let _=y,b=0;for(let w=0;w<g&&(b++,_=_.nextZ,_);w++);let x=g;for(;b>0||x>0&&_;)b!==0&&(x===0||!_||y.z<=_.z)?(m=y,y=y.nextZ,b--):(m=_,_=_.nextZ,x--),v?v.nextZ=m:p=m,m.prevZ=v,v=m;y=_}v.nextZ=null,g*=2}while(f>1)}(u)}(t,n,r,s);let o=t;for(;t.prev!==t.next;){let l=t.prev,c=t.next;if(s?hW(t,n,r,s):lW(t))e.push(l.i,t.i,c.i),yg(t),t=c.next,o=c.next;else if((t=c)===o){a?a===1?gg(t=cW(Nc(t),e),e,i,n,r,s,2):a===2&&dW(t,e,i,n,r,s):gg(Nc(t),e,i,n,r,s,1);break}}}function lW(t){let e=t.prev,i=t,n=t.next;if(Wi(e,i,n)>=0)return!1;let r=e.x,s=i.x,a=n.x,o=e.y,l=i.y,c=n.y,h=Math.min(r,s,a),d=Math.min(o,l,c),u=Math.max(r,s,a),p=Math.max(o,l,c),f=n.next;for(;f!==e;){if(f.x>=h&&f.x<=u&&f.y>=d&&f.y<=p&&um(r,o,s,l,a,c,f.x,f.y)&&Wi(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function hW(t,e,i,n){let r=t.prev,s=t,a=t.next;if(Wi(r,s,a)>=0)return!1;let o=r.x,l=s.x,c=a.x,h=r.y,d=s.y,u=a.y,p=Math.min(o,l,c),f=Math.min(h,d,u),g=Math.max(o,l,c),m=Math.max(h,d,u),y=RM(p,f,e,i,n),v=RM(g,m,e,i,n),_=t.prevZ,b=t.nextZ;for(;_&&_.z>=y&&b&&b.z<=v;){if(_.x>=p&&_.x<=g&&_.y>=f&&_.y<=m&&_!==r&&_!==a&&um(o,h,l,d,c,u,_.x,_.y)&&Wi(_.prev,_,_.next)>=0||(_=_.prevZ,b.x>=p&&b.x<=g&&b.y>=f&&b.y<=m&&b!==r&&b!==a&&um(o,h,l,d,c,u,b.x,b.y)&&Wi(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;_&&_.z>=y;){if(_.x>=p&&_.x<=g&&_.y>=f&&_.y<=m&&_!==r&&_!==a&&um(o,h,l,d,c,u,_.x,_.y)&&Wi(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;b&&b.z<=v;){if(b.x>=p&&b.x<=g&&b.y>=f&&b.y<=m&&b!==r&&b!==a&&um(o,h,l,d,c,u,b.x,b.y)&&Wi(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function cW(t,e){let i=t;do{let n=i.prev,r=i.next.next;!rp(n,r)&&EU(n,i,i.next,r)&&vg(n,r)&&vg(r,n)&&(e.push(n.i,i.i,r.i),yg(i),yg(i.next),i=t=r),i=i.next}while(i!==t);return Nc(i)}function dW(t,e,i,n,r,s){let a=t;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&gW(a,o)){let l=AU(a,o);return a=Nc(a,a.next),l=Nc(l,l.next),gg(a,e,i,n,r,s,0),void gg(l,e,i,n,r,s,0)}o=o.next}a=a.next}while(a!==t)}function uW(t,e){let i=t.x-e.x;return i===0&&(i=t.y-e.y,i===0)&&(i=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)),i}function pW(t,e){let i=function(r,s){let a,o=s,l=r.x,c=r.y,h=-1/0;if(rp(r,o))return o;do{if(rp(r,o.next))return o.next;if(c<=o.y&&c>=o.next.y&&o.next.y!==o.y){let g=o.x+(c-o.y)*(o.next.x-o.x)/(o.next.y-o.y);if(g<=l&&g>h&&(h=g,a=o.x<o.next.x?o:o.next,g===l))return a}o=o.next}while(o!==s);if(!a)return null;let d=a,u=a.x,p=a.y,f=1/0;o=a;do{if(l>=o.x&&o.x>=u&&l!==o.x&&MU(c<p?l:h,c,u,p,c<p?h:l,c,o.x,o.y)){let g=Math.abs(c-o.y)/(l-o.x);vg(o,r)&&(g<f||g===f&&(o.x>a.x||o.x===a.x&&fW(a,o)))&&(a=o,f=g)}o=o.next}while(o!==d);return a}(t,e);if(!i)return e;let n=AU(i,t);return Nc(n,n.next),Nc(i,i.next)}function fW(t,e){return Wi(t.prev,t,e.prev)<0&&Wi(e.next,t,t.next)<0}function RM(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function mW(t){let e=t,i=t;do(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next;while(e!==t);return i}function MU(t,e,i,n,r,s,a,o){return(r-a)*(e-o)>=(t-a)*(s-o)&&(t-a)*(n-o)>=(i-a)*(e-o)&&(i-a)*(s-o)>=(r-a)*(n-o)}function um(t,e,i,n,r,s,a,o){return!(t===a&&e===o)&&MU(t,e,i,n,r,s,a,o)}function gW(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(i,n){let r=i;do{if(r.i!==i.i&&r.next.i!==i.i&&r.i!==n.i&&r.next.i!==n.i&&EU(r,r.next,i,n))return!0;r=r.next}while(r!==i);return!1}(t,e)&&(vg(t,e)&&vg(e,t)&&function(i,n){let r=i,s=!1,a=(i.x+n.x)/2,o=(i.y+n.y)/2;do r.y>o!=r.next.y>o&&r.next.y!==r.y&&a<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(s=!s),r=r.next;while(r!==i);return s}(t,e)&&(Wi(t.prev,t,e.prev)||Wi(t,e.prev,e))||rp(t,e)&&Wi(t.prev,t,t.next)>0&&Wi(e.prev,e,e.next)>0)}function Wi(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function rp(t,e){return t.x===e.x&&t.y===e.y}function EU(t,e,i,n){let r=x0(Wi(t,e,i)),s=x0(Wi(t,e,n)),a=x0(Wi(i,n,t)),o=x0(Wi(i,n,e));return!!(r!==s&&a!==o||r===0&&b0(t,i,e)||s===0&&b0(t,n,e)||a===0&&b0(i,t,n)||o===0&&b0(i,e,n))}function b0(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function x0(t){return t>0?1:t<0?-1:0}function vg(t,e){return Wi(t.prev,t,t.next)<0?Wi(t,e,t.next)>=0&&Wi(t,t.prev,e)>=0:Wi(t,e,t.prev)<0||Wi(t,t.next,e)<0}function AU(t,e){let i=IM(t.i,t.x,t.y),n=IM(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,s.next=n,n.prev=s,n}function lD(t,e,i,n){let r=IM(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function yg(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function IM(t,e,i){return{i:t,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function hD(t){let e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function cD(t,e){for(let i=0;i<e.length;i++)t.push(e[i].x),t.push(e[i].y)}function sp(t){let e={};for(let i in t){e[i]={};for(let n in t[i]){let r=t[i][n];if(dD(r))r.isRenderTargetTexture?(ce("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[i][n]=null):e[i][n]=r.clone();else if(Array.isArray(r))if(dD(r[0])){let s=[];for(let a=0,o=r.length;a<o;a++)s[a]=r[a].clone();e[i][n]=s}else e[i][n]=r.slice();else e[i][n]=r}}return e}function Fr(t){let e={};for(let i=0;i<t.length;i++){let n=sp(t[i]);for(let r in n)e[r]=n[r]}return e}function dD(t){return t&&(t.isColor||t.isMatrix3||t.isMatrix4||t.isVector2||t.isVector3||t.isVector4||t.isTexture||t.isQuaternion)}function TU(t){let e=t.getRenderTarget();return e===null?t.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Ve.workingColorSpace}function w0(t,e){return t&&t.constructor!==e?typeof e.BYTES_PER_ELEMENT=="number"?new e(t):Array.prototype.slice.call(t):t}function vW(t){let e=t.length,i=new Array(e);for(let n=0;n!==e;++n)i[n]=n;return i.sort(function(n,r){return t[n]-t[r]}),i}function uD(t,e,i){let n=t.length,r=new t.constructor(n);for(let s=0,a=0;a!==n;++s){let o=i[s]*e;for(let l=0;l!==e;++l)r[a++]=t[o+l]}return r}function yW(t){if(t.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");let e=function(i){switch(i.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return cE;case"vector":case"vector2":case"vector3":case"vector4":return vz;case"color":return gz;case"quaternion":return dE;case"bool":case"boolean":return vu;case"string":return yu}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+i)}(t.type);if(t.times===void 0){let i=[],n=[];(function(r,s,a,o){let l=1,c=r[0];for(;c!==void 0&&c[o]===void 0;)c=r[l++];if(c===void 0)return;let h=c[o];if(h!==void 0)if(Array.isArray(h))do h=c[o],h!==void 0&&(s.push(c.time),a.push(...h)),c=r[l++];while(c!==void 0);else if(h.toArray!==void 0)do h=c[o],h!==void 0&&(s.push(c.time),h.toArray(a,a.length)),c=r[l++];while(c!==void 0);else do h=c[o],h!==void 0&&(s.push(c.time),a.push(h)),c=r[l++];while(c!==void 0)})(t.keys,i,n,"value"),t.times=i,t.values=n}return e.parse!==void 0?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}function pD(t){try{let e=t.slice(t.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}function _W(){this._document.hidden===!1&&this.reset()}function fD(t,e){return t.distance-e.distance}function OM(t,e,i,n){let r=!0;if(t.layers.test(e.layers)&&t.raycast(e,i)===!1&&(r=!1),r===!0&&n===!0){let s=t.children;for(let a=0,o=s.length;a<o;a++)OM(s[a],e,i,!0)}}function rn(t,e,i,n,r,s,a){xm.set(r,s,a).unproject(n);let o=e[t];if(o!==void 0){let l=i.getAttribute("position");for(let c=0,h=o.length;c<h;c++)l.setXYZ(o[c],xm.x,xm.y,xm.z)}}function mD(t,e,i,n){let r=function(s){switch(s){case cn:case WT:return{byteLength:1,components:1};case op:case qT:case qn:return{byteLength:2,components:1};case Tb:case Cb:return{byteLength:2,components:4};case js:case Ab:case $e:return{byteLength:4,components:1};case XT:case $T:return{byteLength:4,components:3}}throw new Error(`THREE.TextureUtils: Unknown texture type ${s}.`)}(n);switch(i){case YT:return t*e;case Rc:case Pb:return t*e/r.components*r.byteLength;case oo:case Db:return t*e*2/r.components*r.byteLength;case ZT:return t*e*3/r.components*r.byteLength;case qi:case jg:return t*e*4/r.components*r.byteLength;case jm:case Gm:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case Hm:case Wm:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case L1:case U1:return Math.max(t,16)*Math.max(e,8)/4;case O1:case B1:return Math.max(t,8)*Math.max(e,8)/2;case z1:case F1:case k1:case V1:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case N1:case _g:case j1:case G1:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case H1:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case W1:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case q1:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case X1:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case $1:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case Y1:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case Z1:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case K1:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case Q1:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case J1:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case t_:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case e_:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case i_:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case n_:case r_:case s_:return Math.ceil(t/4)*Math.ceil(e/4)*16;case a_:case o_:return Math.ceil(t/4)*Math.ceil(e/4)*8;case bg:case l_:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${i} format.`)}var el,us,CU,LM,PU,I1,Nu,DU,Pu,Vs,Hn,jn,Qn,ih,BM,UM,zM,RU,Nl,IU,OU,LU,BU,UU,zU,FU,NU,Ny,ky,kU,VU,jU,GU,HU,WU,qU,XU,$U,Vy,jy,Gy,vc,Hy,Wy,qy,Xy,FM,YU,ZU,ro,NM,kM,VM,jM,GM,HM,WM,Dc,ap,$y,Yy,Vg,jl,Di,Zy,De,KU,pm,de,Ky,Qa,cn,WT,qT,op,Ab,js,$e,qn,Tb,Cb,lp,XT,$T,YT,ZT,qi,Xo,Gl,Rc,Pb,oo,Db,jg,jm,Gm,Hm,Wm,O1,L1,B1,U1,z1,F1,N1,k1,V1,_g,j1,G1,H1,W1,q1,X1,$1,Y1,Z1,K1,Q1,J1,t_,e_,i_,n_,r_,s_,a_,o_,bg,l_,qM,XM,h_,sf,S0,M0,Dh,Rh,af,Ga,QU,$M,JU,jo,Ue,ku,qm,pi,Ih,tz,ez,iz,Rb,nz,rz,Ib,sz,E0,az,c_,sa,vd,oz,YM,kc,lz,Nn,dr,ZM,fu,mu,Ot,rw,it,$t,sw,C,A0,aw,gD,ue,T0,ow,lw,Ve,yd,hz,vD,C0,yD,P0,zi,hw,ve,_D,Ne,KT,cz,cw,At,Oh,As,bD,xD,_o,of,Jr,dw,uw,Ei,Qy,wD,pw,Lh,Ea,lf,_d,SD,MD,fw,mw,gw,vw,ED,Bh,D0,_i,vp,yw,bo,hf,Jt,cr,KM,rs,Ts,Aa,R0,Ta,Uh,zh,_w,I0,O0,L0,B0,U0,z0,un,ci,Ca,Cs,cf,Fh,Nh,kh,xo,wo,_l,bd,df,uf,Ll,Pa,Hl,sn,pf,AD,Ht,QM,nh,Nt,TD,xd,F0,vr,CD,hs,N0,Vh,ts,wd,Ln,Gt,JM,xr,fm,PD,jh,Da,k0,ff,So,V0,mf,j0,$o,Gs,bw,bl,gf,xw,mm,gm,vm,G0,vf,tE,ym,xi,eE,Tn,ww,DD,d_,Du,Gh,Sw,yf,Mw,RD,Sd,Md,Ob,H0,ID,OD,kr,xl,LD,_f,u_,zo,Xm,$m,Ew,Ed,bf,Jy,iE,_m,Aw,Tw,gu,dz,p_,uz,ma,pz,ga,Ym,f_,W0,nE,Ys,bm,BD,Cw,Pw,q0,X0,$0,UD,zs,Zm,ps,rE,Go,zD,t1,Dw,sE,Km,xg,FD,aE,oE,lE,lo,rh,m_,hE,fz,Wc,Xe,QT,JT,mz,Ad,ND,Rw,kD,VD,Zs,vu,gz,cE,jD,dE,yu,vz,e1,Td,yz,GD,dc,Ra,HD,Qm,Hh,WD,_z,bz,_u,xz,Y0,Iw,Ow,Z0,xf,wf,Ks,Wl,Mo,Lw,Bw,Vu,qD,wz,Cd,XD,Sz,hp,$D,Mz,i1,g_,tC,Ez,YD,K0,ZD,Q0,KD,QD,JD,tR,eR,iR,nR,rR,yi,sR,aR,Az,Ct,Uw,eC,uE,oR,zw,Lb,Fw,Sf,Wh,qh,J0,lR,hR,vs,Nw,Tz,Cz,kw,Mf,Vw,Pz,xm,Gi,wg,Sg,Dz,cR=F(()=>{el="185",us={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},CU=0,LM=1,PU=2,I1=0,Nu=1,DU=2,Pu=3,Vs=0,Hn=1,jn=2,Qn=0,ih=1,BM=2,UM=3,zM=4,RU=5,Nl=100,IU=101,OU=102,LU=103,BU=104,UU=200,zU=201,FU=202,NU=203,Ny=204,ky=205,kU=206,VU=207,jU=208,GU=209,HU=210,WU=211,qU=212,XU=213,$U=214,Vy=0,jy=1,Gy=2,vc=3,Hy=4,Wy=5,qy=6,Xy=7,FM=0,YU=1,ZU=2,ro=0,NM=1,kM=2,VM=3,jM=4,GM=5,HM=6,WM=7,Dc=301,ap=302,$y=303,Yy=304,Vg=306,jl=1e3,Di=1001,Zy=1002,De=1003,KU=1004,pm=1005,de=1006,Ky=1007,Qa=1008,cn=1009,WT=1010,qT=1011,op=1012,Ab=1013,js=1014,$e=1015,qn=1016,Tb=1017,Cb=1018,lp=1020,XT=35902,$T=35899,YT=1021,ZT=1022,qi=1023,Xo=1026,Gl=1027,Rc=1028,Pb=1029,oo=1030,Db=1031,jg=1033,jm=33776,Gm=33777,Hm=33778,Wm=33779,O1=35840,L1=35841,B1=35842,U1=35843,z1=36196,F1=37492,N1=37496,k1=37488,V1=37489,_g=37490,j1=37491,G1=37808,H1=37809,W1=37810,q1=37811,X1=37812,$1=37813,Y1=37814,Z1=37815,K1=37816,Q1=37817,J1=37818,t_=37819,e_=37820,i_=37821,n_=36492,r_=36494,s_=36495,a_=36283,o_=36284,bg=36285,l_=36286,qM=2200,XM=2201,h_=2202,sf=2300,S0=2301,M0=2302,Dh=2400,Rh=2401,af=2402,Ga=3200,QU=3201,$M=0,JU=1,jo="",Ue="srgb",ku="srgb-linear",qm="linear",pi="srgb",Ih=7680,tz=512,ez=513,iz=514,Rb=515,nz=516,rz=517,Ib=518,sz=519,E0=35044,az=35048,c_="300 es",sa=2e3,vd=2001,oz={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array},YM={},kc=null,lz={[Vy]:jy,[Gy]:qy,[Hy]:Xy,[vc]:Wy,[jy]:Vy,[qy]:Gy,[Xy]:Hy,[Wy]:vc},Nn=class{addEventListener(t,e){this._listeners===void 0&&(this._listeners={});let i=this._listeners;i[t]===void 0&&(i[t]=[]),i[t].indexOf(e)===-1&&i[t].push(e)}hasEventListener(t,e){let i=this._listeners;return i!==void 0&&i[t]!==void 0&&i[t].indexOf(e)!==-1}removeEventListener(t,e){let i=this._listeners;if(i===void 0)return;let n=i[t];if(n!==void 0){let r=n.indexOf(e);r!==-1&&n.splice(r,1)}}dispatchEvent(t){let e=this._listeners;if(e===void 0)return;let i=e[t.type];if(i!==void 0){t.target=this;let n=i.slice(0);for(let r=0,s=n.length;r<s;r++)n[r].call(this,t);t.target=null}}},dr=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],ZM=1234567,fu=Math.PI/180,mu=180/Math.PI,Ot={DEG2RAD:fu,RAD2DEG:mu,generateUUID:Es,clamp:ge,euclideanModulo:DM,mapLinear:qH,inverseLerp:XH,lerp:dm,damp:$H,pingpong:YH,smoothstep:ZH,smootherstep:KH,randInt:QH,randFloat:JH,randFloatSpread:tW,seededRandom:eW,degToRad:iW,radToDeg:nW,isPowerOfTwo:rW,ceilPowerOfTwo:sW,floorPowerOfTwo:aW,setQuaternionFromProperEuler:oW,normalize:mi,denormalize:$s},rw=class{constructor(t=0,e=0){this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("THREE.Vector2: index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){let e=this.x,i=this.y,n=t.elements;return this.x=n[0]*e+n[3]*i+n[6],this.y=n[1]*e+n[4]*i+n[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=ge(this.x,t.x,e.x),this.y=ge(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=ge(this.x,t,e),this.y=ge(this.y,t,e),this}clampLength(t,e){let i=this.length();return this.divideScalar(i||1).multiplyScalar(ge(i,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let i=this.dot(t)/e;return Math.acos(ge(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){let i=Math.cos(e),n=Math.sin(e),r=this.x-t.x,s=this.y-t.y;return this.x=r*i-s*n+t.x,this.y=r*n+s*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},it=rw,rw.prototype.isVector2=!0,$t=class{constructor(t=0,e=0,i=0,n=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=i,this._w=n}static slerpFlat(t,e,i,n,r,s,a){let o=i[n+0],l=i[n+1],c=i[n+2],h=i[n+3],d=r[s+0],u=r[s+1],p=r[s+2],f=r[s+3];if(h!==f||o!==d||l!==u||c!==p){let g=o*d+l*u+c*p+h*f;g<0&&(d=-d,u=-u,p=-p,f=-f,g=-g);let m=1-a;if(g<.9995){let y=Math.acos(g),v=Math.sin(y);m=Math.sin(m*y)/v,o=o*m+d*(a=Math.sin(a*y)/v),l=l*m+u*a,c=c*m+p*a,h=h*m+f*a}else{o=o*m+d*a,l=l*m+u*a,c=c*m+p*a,h=h*m+f*a;let y=1/Math.sqrt(o*o+l*l+c*c+h*h);o*=y,l*=y,c*=y,h*=y}}t[e]=o,t[e+1]=l,t[e+2]=c,t[e+3]=h}static multiplyQuaternionsFlat(t,e,i,n,r,s){let a=i[n],o=i[n+1],l=i[n+2],c=i[n+3],h=r[s],d=r[s+1],u=r[s+2],p=r[s+3];return t[e]=a*p+c*h+o*u-l*d,t[e+1]=o*p+c*d+l*h-a*u,t[e+2]=l*p+c*u+a*d-o*h,t[e+3]=c*p-a*h-o*d-l*u,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._w=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){let i=t._x,n=t._y,r=t._z,s=t._order,a=Math.cos,o=Math.sin,l=a(i/2),c=a(n/2),h=a(r/2),d=o(i/2),u=o(n/2),p=o(r/2);switch(s){case"XYZ":this._x=d*c*h+l*u*p,this._y=l*u*h-d*c*p,this._z=l*c*p+d*u*h,this._w=l*c*h-d*u*p;break;case"YXZ":this._x=d*c*h+l*u*p,this._y=l*u*h-d*c*p,this._z=l*c*p-d*u*h,this._w=l*c*h+d*u*p;break;case"ZXY":this._x=d*c*h-l*u*p,this._y=l*u*h+d*c*p,this._z=l*c*p+d*u*h,this._w=l*c*h-d*u*p;break;case"ZYX":this._x=d*c*h-l*u*p,this._y=l*u*h+d*c*p,this._z=l*c*p-d*u*h,this._w=l*c*h+d*u*p;break;case"YZX":this._x=d*c*h+l*u*p,this._y=l*u*h+d*c*p,this._z=l*c*p-d*u*h,this._w=l*c*h-d*u*p;break;case"XZY":this._x=d*c*h-l*u*p,this._y=l*u*h-d*c*p,this._z=l*c*p+d*u*h,this._w=l*c*h+d*u*p;break;default:ce("Quaternion: .setFromEuler() encountered an unknown order: "+s)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){let i=e/2,n=Math.sin(i);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){let e=t.elements,i=e[0],n=e[4],r=e[8],s=e[1],a=e[5],o=e[9],l=e[2],c=e[6],h=e[10],d=i+a+h;if(d>0){let u=.5/Math.sqrt(d+1);this._w=.25/u,this._x=(c-o)*u,this._y=(r-l)*u,this._z=(s-n)*u}else if(i>a&&i>h){let u=2*Math.sqrt(1+i-a-h);this._w=(c-o)/u,this._x=.25*u,this._y=(n+s)/u,this._z=(r+l)/u}else if(a>h){let u=2*Math.sqrt(1+a-i-h);this._w=(r-l)/u,this._x=(n+s)/u,this._y=.25*u,this._z=(o+c)/u}else{let u=2*Math.sqrt(1+h-i-a);this._w=(s-n)/u,this._x=(r+l)/u,this._y=(o+c)/u,this._z=.25*u}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<1e-8?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(ge(this.dot(t),-1,1)))}rotateTowards(t,e){let i=this.angleTo(t);if(i===0)return this;let n=Math.min(1,e/i);return this.slerp(t,n),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){let i=t._x,n=t._y,r=t._z,s=t._w,a=e._x,o=e._y,l=e._z,c=e._w;return this._x=i*c+s*a+n*l-r*o,this._y=n*c+s*o+r*a-i*l,this._z=r*c+s*l+i*o-n*a,this._w=s*c-i*a-n*o-r*l,this._onChangeCallback(),this}slerp(t,e){let i=t._x,n=t._y,r=t._z,s=t._w,a=this.dot(t);a<0&&(i=-i,n=-n,r=-r,s=-s,a=-a);let o=1-e;if(a<.9995){let l=Math.acos(a),c=Math.sin(l);o=Math.sin(o*l)/c,e=Math.sin(e*l)/c,this._x=this._x*o+i*e,this._y=this._y*o+n*e,this._z=this._z*o+r*e,this._w=this._w*o+s*e,this._onChangeCallback()}else this._x=this._x*o+i*e,this._y=this._y*o+n*e,this._z=this._z*o+r*e,this._w=this._w*o+s*e,this.normalize();return this}slerpQuaternions(t,e,i){return this.copy(t).slerp(e,i)}random(){let t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),i=Math.random(),n=Math.sqrt(1-i),r=Math.sqrt(i);return this.set(n*Math.sin(t),n*Math.cos(t),r*Math.sin(e),r*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},sw=class{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.z=i}set(t,e,i){return i===void 0&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("THREE.Vector3: index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("THREE.Vector3: index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(aw.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(aw.setFromAxisAngle(t,e))}applyMatrix3(t){let e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6]*n,this.y=r[1]*e+r[4]*i+r[7]*n,this.z=r[2]*e+r[5]*i+r[8]*n,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let e=this.x,i=this.y,n=this.z,r=t.elements,s=1/(r[3]*e+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*e+r[4]*i+r[8]*n+r[12])*s,this.y=(r[1]*e+r[5]*i+r[9]*n+r[13])*s,this.z=(r[2]*e+r[6]*i+r[10]*n+r[14])*s,this}applyQuaternion(t){let e=this.x,i=this.y,n=this.z,r=t.x,s=t.y,a=t.z,o=t.w,l=2*(s*n-a*i),c=2*(a*e-r*n),h=2*(r*i-s*e);return this.x=e+o*l+s*h-a*c,this.y=i+o*c+a*l-r*h,this.z=n+o*h+r*c-s*l,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){let e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*n,this.y=r[1]*e+r[5]*i+r[9]*n,this.z=r[2]*e+r[6]*i+r[10]*n,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=ge(this.x,t.x,e.x),this.y=ge(this.y,t.y,e.y),this.z=ge(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=ge(this.x,t,e),this.y=ge(this.y,t,e),this.z=ge(this.z,t,e),this}clampLength(t,e){let i=this.length();return this.divideScalar(i||1).multiplyScalar(ge(i,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){let i=t.x,n=t.y,r=t.z,s=e.x,a=e.y,o=e.z;return this.x=n*o-r*a,this.y=r*s-i*o,this.z=i*a-n*s,this}projectOnVector(t){let e=t.lengthSq();if(e===0)return this.set(0,0,0);let i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return A0.copy(this).projectOnVector(t),this.sub(A0)}reflect(t){return this.sub(A0.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let i=this.dot(t)/e;return Math.acos(ge(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return e*e+i*i+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,i){let n=Math.sin(e)*t;return this.x=n*Math.sin(i),this.y=Math.cos(e)*t,this.z=n*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){let e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=n,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let t=Math.random()*Math.PI*2,e=2*Math.random()-1,i=Math.sqrt(1-e*e);return this.x=i*Math.cos(t),this.y=e,this.z=i*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},C=sw,sw.prototype.isVector3=!0,A0=new C,aw=new $t,ue=gD=class{constructor(t,e,i,n,r,s,a,o,l){this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,i,n,r,s,a,o,l)}set(t,e,i,n,r,s,a,o,l){let c=this.elements;return c[0]=t,c[1]=n,c[2]=a,c[3]=e,c[4]=r,c[5]=o,c[6]=i,c[7]=s,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){let e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let i=t.elements,n=e.elements,r=this.elements,s=i[0],a=i[3],o=i[6],l=i[1],c=i[4],h=i[7],d=i[2],u=i[5],p=i[8],f=n[0],g=n[3],m=n[6],y=n[1],v=n[4],_=n[7],b=n[2],x=n[5],w=n[8];return r[0]=s*f+a*y+o*b,r[3]=s*g+a*v+o*x,r[6]=s*m+a*_+o*w,r[1]=l*f+c*y+h*b,r[4]=l*g+c*v+h*x,r[7]=l*m+c*_+h*w,r[2]=d*f+u*y+p*b,r[5]=d*g+u*v+p*x,r[8]=d*m+u*_+p*w,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){let t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],c=t[8];return e*s*c-e*a*l-i*r*c+i*a*o+n*r*l-n*s*o}invert(){let t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],c=t[8],h=c*s-a*l,d=a*o-c*r,u=l*r-s*o,p=e*h+i*d+n*u;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);let f=1/p;return t[0]=h*f,t[1]=(n*l-c*i)*f,t[2]=(a*i-n*s)*f,t[3]=d*f,t[4]=(c*e-n*o)*f,t[5]=(n*r-a*e)*f,t[6]=u*f,t[7]=(i*o-l*e)*f,t[8]=(s*e-i*r)*f,this}transpose(){let t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,i,n,r,s,a){let o=Math.cos(r),l=Math.sin(r);return this.set(i*o,i*l,-i*(o*s+l*a)+s+t,-n*l,n*o,-n*(-l*s+o*a)+a+e,0,0,1),this}scale(t,e){return pu("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(T0.makeScale(t,e)),this}rotate(t){return pu("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(T0.makeRotation(-t)),this}translate(t,e){return pu("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(T0.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){let e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,i,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){let e=this.elements,i=t.elements;for(let n=0;n<9;n++)if(e[n]!==i[n])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){let i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return new this.constructor().fromArray(this.elements)}},gD.prototype.isMatrix3=!0,T0=new ue,ow=new ue().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),lw=new ue().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715),Ve=function(){let t={enabled:!1,workingColorSpace:ku,spaces:{},convert:function(r,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===pi&&(r.r=yo(r.r),r.g=yo(r.g),r.b=yo(r.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===pi&&(r.r=gd(r.r),r.g=gd(r.g),r.b=gd(r.b))),r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===jo?qm:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,a){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return pu("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),t.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return pu("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),t.colorSpaceToWorking(r,s)}},e=[.64,.33,.3,.6,.15,.06],i=[.2126,.7152,.0722],n=[.3127,.329];return t.define({[ku]:{primaries:e,whitePoint:n,transfer:qm,toXYZ:ow,fromXYZ:lw,luminanceCoefficients:i,workingColorSpaceConfig:{unpackColorSpace:Ue},outputColorSpaceConfig:{drawingBufferColorSpace:Ue}},[Ue]:{primaries:e,whitePoint:n,transfer:pi,toXYZ:ow,fromXYZ:lw,luminanceCoefficients:i,outputColorSpaceConfig:{drawingBufferColorSpace:Ue}}}),t}(),hz=class{static getDataURL(t,e="image/png"){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement>"u")return t.src;let i;if(t instanceof HTMLCanvasElement)i=t;else{yd===void 0&&(yd=Vm("canvas")),yd.width=t.width,yd.height=t.height;let n=yd.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),i=yd}return i.toDataURL(e)}static sRGBToLinear(t){if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap){let e=Vm("canvas");e.width=t.width,e.height=t.height;let i=e.getContext("2d");i.drawImage(t,0,0,t.width,t.height);let n=i.getImageData(0,0,t.width,t.height),r=n.data;for(let s=0;s<r.length;s++)r[s]=255*yo(r[s]/255);return i.putImageData(n,0,0),e}if(t.data){let e=t.data.slice(0);for(let i=0;i<e.length;i++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[i]=Math.floor(255*yo(e[i]/255)):e[i]=yo(e[i]);return{data:e,width:t.width,height:t.height}}return ce("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}},vD=0,C0=class{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:vD++}),this.uuid=Es(),this.data=t,this.dataReady=!0,this.version=0}getSize(t){let e=this.data;return typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement?t.set(e.videoWidth,e.videoHeight,0):typeof VideoFrame<"u"&&e instanceof VideoFrame?t.set(e.displayWidth,e.displayHeight,0):e!==null?t.set(e.width,e.height,e.depth||0):t.set(0,0,0),t}set needsUpdate(t){t===!0&&this.version++}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.images[this.uuid]!==void 0)return t.images[this.uuid];let i={uuid:this.uuid,url:""},n=this.data;if(n!==null){let r;if(Array.isArray(n)){r=[];for(let s=0,a=n.length;s<a;s++)n[s].isDataTexture?r.push(tw(n[s].image)):r.push(tw(n[s]))}else r=tw(n);i.url=r}return e||(t.images[this.uuid]=i),i}},yD=0,P0=new C,(zi=class extends Nn{constructor(t=zi.DEFAULT_IMAGE,e=zi.DEFAULT_MAPPING,i=Di,n=Di,r=de,s=Qa,a=qi,o=cn,l=zi.DEFAULT_ANISOTROPY,c=jo){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:yD++}),this.uuid=Es(),this.name="",this.source=new C0(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=i,this.wrapT=n,this.magFilter=r,this.minFilter=s,this.anisotropy=l,this.format=a,this.internalFormat=null,this.type=o,this.offset=new it(0,0),this.repeat=new it(1,1),this.center=new it(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new ue,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=c,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(t&&t.depth&&t.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(P0).x}get height(){return this.source.getSize(P0).y}get depth(){return this.source.getSize(P0).z}get image(){return this.source.data}set image(t){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.normalized=t.normalized,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isArrayTexture=t.isArrayTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}setValues(t){for(let e in t){let i=t[e];if(i===void 0){ce(`Texture.setValues(): parameter '${e}' has value of undefined.`);continue}let n=this[e];n!==void 0?n&&i&&n.isVector2&&i.isVector2||n&&i&&n.isVector3&&i.isVector3||n&&i&&n.isMatrix3&&i.isMatrix3?n.copy(i):this[e]=i:ce(`Texture.setValues(): property '${e}' does not exist.`)}}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];let i={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),e||(t.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==300)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case jl:t.x=t.x-Math.floor(t.x);break;case Di:t.x=t.x<0?0:1;break;case Zy:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case jl:t.y=t.y-Math.floor(t.y);break;case Di:t.y=t.y<0?0:1;break;case Zy:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){t===!0&&this.pmremVersion++}}).DEFAULT_IMAGE=null,zi.DEFAULT_MAPPING=300,zi.DEFAULT_ANISOTROPY=1,hw=class{constructor(t=0,e=0,i=0,n=1){this.x=t,this.y=e,this.z=i,this.w=n}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,i,n){return this.x=t,this.y=e,this.z=i,this.w=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("THREE.Vector4: index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("THREE.Vector4: index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){let e=this.x,i=this.y,n=this.z,r=this.w,s=t.elements;return this.x=s[0]*e+s[4]*i+s[8]*n+s[12]*r,this.y=s[1]*e+s[5]*i+s[9]*n+s[13]*r,this.z=s[2]*e+s[6]*i+s[10]*n+s[14]*r,this.w=s[3]*e+s[7]*i+s[11]*n+s[15]*r,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);let e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,i,n,r,s=t.elements,a=s[0],o=s[4],l=s[8],c=s[1],h=s[5],d=s[9],u=s[2],p=s[6],f=s[10];if(Math.abs(o-c)<.01&&Math.abs(l-u)<.01&&Math.abs(d-p)<.01){if(Math.abs(o+c)<.1&&Math.abs(l+u)<.1&&Math.abs(d+p)<.1&&Math.abs(a+h+f-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;let m=(a+1)/2,y=(h+1)/2,v=(f+1)/2,_=(o+c)/4,b=(l+u)/4,x=(d+p)/4;return m>y&&m>v?m<.01?(i=0,n=.707106781,r=.707106781):(i=Math.sqrt(m),n=_/i,r=b/i):y>v?y<.01?(i=.707106781,n=0,r=.707106781):(n=Math.sqrt(y),i=_/n,r=x/n):v<.01?(i=.707106781,n=.707106781,r=0):(r=Math.sqrt(v),i=b/r,n=x/r),this.set(i,n,r,e),this}let g=Math.sqrt((p-d)*(p-d)+(l-u)*(l-u)+(c-o)*(c-o));return Math.abs(g)<.001&&(g=1),this.x=(p-d)/g,this.y=(l-u)/g,this.z=(c-o)/g,this.w=Math.acos((a+h+f-1)/2),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=ge(this.x,t.x,e.x),this.y=ge(this.y,t.y,e.y),this.z=ge(this.z,t.z,e.z),this.w=ge(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=ge(this.x,t,e),this.y=ge(this.y,t,e),this.z=ge(this.z,t,e),this.w=ge(this.w,t,e),this}clampLength(t,e){let i=this.length();return this.divideScalar(i||1).multiplyScalar(ge(i,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}},ve=hw,hw.prototype.isVector4=!0,_D=class extends Nn{constructor(t=1,e=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:de,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},i),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=i.depth,this.scissor=new ve(0,0,t,e),this.scissorTest=!1,this.viewport=new ve(0,0,t,e),this.textures=[];let n={width:t,height:e,depth:i.depth},r=new zi(n),s=i.count;for(let a=0;a<s;a++)this.textures[a]=r.clone(),this.textures[a].isRenderTargetTexture=!0,this.textures[a].renderTarget=this;this._setTextureOptions(i),this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=i.depthTexture,this.samples=i.samples,this.multiview=i.multiview,this.useArrayDepthTexture=i.useArrayDepthTexture}_setTextureOptions(t={}){let e={minFilter:de,generateMipmaps:!1,flipY:!1,internalFormat:null};t.mapping!==void 0&&(e.mapping=t.mapping),t.wrapS!==void 0&&(e.wrapS=t.wrapS),t.wrapT!==void 0&&(e.wrapT=t.wrapT),t.wrapR!==void 0&&(e.wrapR=t.wrapR),t.magFilter!==void 0&&(e.magFilter=t.magFilter),t.minFilter!==void 0&&(e.minFilter=t.minFilter),t.format!==void 0&&(e.format=t.format),t.type!==void 0&&(e.type=t.type),t.anisotropy!==void 0&&(e.anisotropy=t.anisotropy),t.colorSpace!==void 0&&(e.colorSpace=t.colorSpace),t.flipY!==void 0&&(e.flipY=t.flipY),t.generateMipmaps!==void 0&&(e.generateMipmaps=t.generateMipmaps),t.internalFormat!==void 0&&(e.internalFormat=t.internalFormat);for(let i=0;i<this.textures.length;i++)this.textures[i].setValues(e)}get texture(){return this.textures[0]}set texture(t){this.textures[0]=t}set depthTexture(t){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),t!==null&&(t.renderTarget=this),this._depthTexture=t}get depthTexture(){return this._depthTexture}setSize(t,e,i=1){if(this.width!==t||this.height!==e||this.depth!==i){this.width=t,this.height=e,this.depth=i;for(let n=0,r=this.textures.length;n<r;n++)this.textures[n].image.width=t,this.textures[n].image.height=e,this.textures[n].image.depth=i,this.textures[n].isData3DTexture!==!0&&(this.textures[n].isArrayTexture=this.textures[n].image.depth>1);this.dispose()}this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return new this.constructor().copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let e=0,i=t.textures.length;e<i;e++){this.textures[e]=t.textures[e].clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;let n=Object.assign({},t.textures[e].image);this.textures[e].source=new C0(n)}return this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.resolveDepthBuffer=t.resolveDepthBuffer,this.resolveStencilBuffer=t.resolveStencilBuffer,t.depthTexture!==null&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this.multiview=t.multiview,this.useArrayDepthTexture=t.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}},Ne=class extends _D{constructor(t=1,e=1,i={}){super(t,e,i),this.isWebGLRenderTarget=!0}},KT=class extends zi{constructor(t=null,e=1,i=1,n=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:i,depth:n},this.magFilter=De,this.minFilter=De,this.wrapR=Di,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}},cz=class extends zi{constructor(t=null,e=1,i=1,n=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:i,depth:n},this.magFilter=De,this.minFilter=De,this.wrapR=Di,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},At=cw=class{constructor(t,e,i,n,r,s,a,o,l,c,h,d,u,p,f,g){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,e,i,n,r,s,a,o,l,c,h,d,u,p,f,g)}set(t,e,i,n,r,s,a,o,l,c,h,d,u,p,f,g){let m=this.elements;return m[0]=t,m[4]=e,m[8]=i,m[12]=n,m[1]=r,m[5]=s,m[9]=a,m[13]=o,m[2]=l,m[6]=c,m[10]=h,m[14]=d,m[3]=u,m[7]=p,m[11]=f,m[15]=g,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new cw().fromArray(this.elements)}copy(t){let e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){let e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}setFromMatrix3(t){let e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,i){return this.determinantAffine()===0?(t.set(1,0,0),e.set(0,1,0),i.set(0,0,1),this):(t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this)}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){if(t.determinantAffine()===0)return this.identity();let e=this.elements,i=t.elements,n=1/Oh.setFromMatrixColumn(t,0).length(),r=1/Oh.setFromMatrixColumn(t,1).length(),s=1/Oh.setFromMatrixColumn(t,2).length();return e[0]=i[0]*n,e[1]=i[1]*n,e[2]=i[2]*n,e[3]=0,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=0,e[8]=i[8]*s,e[9]=i[9]*s,e[10]=i[10]*s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){let e=this.elements,i=t.x,n=t.y,r=t.z,s=Math.cos(i),a=Math.sin(i),o=Math.cos(n),l=Math.sin(n),c=Math.cos(r),h=Math.sin(r);if(t.order==="XYZ"){let d=s*c,u=s*h,p=a*c,f=a*h;e[0]=o*c,e[4]=-o*h,e[8]=l,e[1]=u+p*l,e[5]=d-f*l,e[9]=-a*o,e[2]=f-d*l,e[6]=p+u*l,e[10]=s*o}else if(t.order==="YXZ"){let d=o*c,u=o*h,p=l*c,f=l*h;e[0]=d+f*a,e[4]=p*a-u,e[8]=s*l,e[1]=s*h,e[5]=s*c,e[9]=-a,e[2]=u*a-p,e[6]=f+d*a,e[10]=s*o}else if(t.order==="ZXY"){let d=o*c,u=o*h,p=l*c,f=l*h;e[0]=d-f*a,e[4]=-s*h,e[8]=p+u*a,e[1]=u+p*a,e[5]=s*c,e[9]=f-d*a,e[2]=-s*l,e[6]=a,e[10]=s*o}else if(t.order==="ZYX"){let d=s*c,u=s*h,p=a*c,f=a*h;e[0]=o*c,e[4]=p*l-u,e[8]=d*l+f,e[1]=o*h,e[5]=f*l+d,e[9]=u*l-p,e[2]=-l,e[6]=a*o,e[10]=s*o}else if(t.order==="YZX"){let d=s*o,u=s*l,p=a*o,f=a*l;e[0]=o*c,e[4]=f-d*h,e[8]=p*h+u,e[1]=h,e[5]=s*c,e[9]=-a*c,e[2]=-l*c,e[6]=u*h+p,e[10]=d-f*h}else if(t.order==="XZY"){let d=s*o,u=s*l,p=a*o,f=a*l;e[0]=o*c,e[4]=-h,e[8]=l*c,e[1]=d*h+f,e[5]=s*c,e[9]=u*h-p,e[2]=p*h-u,e[6]=a*c,e[10]=f*h+d}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(bD,t,xD)}lookAt(t,e,i){let n=this.elements;return Jr.subVectors(t,e),Jr.lengthSq()===0&&(Jr.z=1),Jr.normalize(),_o.crossVectors(i,Jr),_o.lengthSq()===0&&(Math.abs(i.z)===1?Jr.x+=1e-4:Jr.z+=1e-4,Jr.normalize(),_o.crossVectors(i,Jr)),_o.normalize(),of.crossVectors(Jr,_o),n[0]=_o.x,n[4]=of.x,n[8]=Jr.x,n[1]=_o.y,n[5]=of.y,n[9]=Jr.y,n[2]=_o.z,n[6]=of.z,n[10]=Jr.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let i=t.elements,n=e.elements,r=this.elements,s=i[0],a=i[4],o=i[8],l=i[12],c=i[1],h=i[5],d=i[9],u=i[13],p=i[2],f=i[6],g=i[10],m=i[14],y=i[3],v=i[7],_=i[11],b=i[15],x=n[0],w=n[4],S=n[8],A=n[12],E=n[1],P=n[5],T=n[9],R=n[13],L=n[2],D=n[6],U=n[10],V=n[14],k=n[3],Y=n[7],$=n[11],nt=n[15];return r[0]=s*x+a*E+o*L+l*k,r[4]=s*w+a*P+o*D+l*Y,r[8]=s*S+a*T+o*U+l*$,r[12]=s*A+a*R+o*V+l*nt,r[1]=c*x+h*E+d*L+u*k,r[5]=c*w+h*P+d*D+u*Y,r[9]=c*S+h*T+d*U+u*$,r[13]=c*A+h*R+d*V+u*nt,r[2]=p*x+f*E+g*L+m*k,r[6]=p*w+f*P+g*D+m*Y,r[10]=p*S+f*T+g*U+m*$,r[14]=p*A+f*R+g*V+m*nt,r[3]=y*x+v*E+_*L+b*k,r[7]=y*w+v*P+_*D+b*Y,r[11]=y*S+v*T+_*U+b*$,r[15]=y*A+v*R+_*V+b*nt,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){let t=this.elements,e=t[0],i=t[4],n=t[8],r=t[12],s=t[1],a=t[5],o=t[9],l=t[13],c=t[2],h=t[6],d=t[10],u=t[14],p=t[3],f=t[7],g=t[11],m=t[15],y=o*u-l*d,v=a*u-l*h,_=a*d-o*h,b=s*u-l*c,x=s*d-o*c,w=s*h-a*c;return e*(f*y-g*v+m*_)-i*(p*y-g*b+m*x)+n*(p*v-f*b+m*w)-r*(p*_-f*x+g*w)}determinantAffine(){let t=this.elements,e=t[0],i=t[4],n=t[8],r=t[1],s=t[5],a=t[9],o=t[2],l=t[6],c=t[10];return e*(s*c-a*l)-i*(r*c-a*o)+n*(r*l-s*o)}transpose(){let t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(t,e,i){let n=this.elements;return t.isVector3?(n[12]=t.x,n[13]=t.y,n[14]=t.z):(n[12]=t,n[13]=e,n[14]=i),this}invert(){let t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],c=t[8],h=t[9],d=t[10],u=t[11],p=t[12],f=t[13],g=t[14],m=t[15],y=e*a-i*s,v=e*o-n*s,_=e*l-r*s,b=i*o-n*a,x=i*l-r*a,w=n*l-r*o,S=c*f-h*p,A=c*g-d*p,E=c*m-u*p,P=h*g-d*f,T=h*m-u*f,R=d*m-u*g,L=y*R-v*T+_*P+b*E-x*A+w*S;if(L===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let D=1/L;return t[0]=(a*R-o*T+l*P)*D,t[1]=(n*T-i*R-r*P)*D,t[2]=(f*w-g*x+m*b)*D,t[3]=(d*x-h*w-u*b)*D,t[4]=(o*E-s*R-l*A)*D,t[5]=(e*R-n*E+r*A)*D,t[6]=(g*_-p*w-m*v)*D,t[7]=(c*w-d*_+u*v)*D,t[8]=(s*T-a*E+l*S)*D,t[9]=(i*E-e*T-r*S)*D,t[10]=(p*x-f*_+m*y)*D,t[11]=(h*_-c*x-u*y)*D,t[12]=(a*A-s*P-o*S)*D,t[13]=(e*P-i*A+n*S)*D,t[14]=(f*v-p*b-g*y)*D,t[15]=(c*b-h*v+d*y)*D,this}scale(t){let e=this.elements,i=t.x,n=t.y,r=t.z;return e[0]*=i,e[4]*=n,e[8]*=r,e[1]*=i,e[5]*=n,e[9]*=r,e[2]*=i,e[6]*=n,e[10]*=r,e[3]*=i,e[7]*=n,e[11]*=r,this}getMaxScaleOnAxis(){let t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,n))}makeTranslation(t,e,i){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){let e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){let e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){let e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){let i=Math.cos(e),n=Math.sin(e),r=1-i,s=t.x,a=t.y,o=t.z,l=r*s,c=r*a;return this.set(l*s+i,l*a-n*o,l*o+n*a,0,l*a+n*o,c*a+i,c*o-n*s,0,l*o-n*a,c*o+n*s,r*o*o+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i,n,r,s){return this.set(1,i,r,0,t,1,s,0,e,n,1,0,0,0,0,1),this}compose(t,e,i){let n=this.elements,r=e._x,s=e._y,a=e._z,o=e._w,l=r+r,c=s+s,h=a+a,d=r*l,u=r*c,p=r*h,f=s*c,g=s*h,m=a*h,y=o*l,v=o*c,_=o*h,b=i.x,x=i.y,w=i.z;return n[0]=(1-(f+m))*b,n[1]=(u+_)*b,n[2]=(p-v)*b,n[3]=0,n[4]=(u-_)*x,n[5]=(1-(d+m))*x,n[6]=(g+y)*x,n[7]=0,n[8]=(p+v)*w,n[9]=(g-y)*w,n[10]=(1-(d+f))*w,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this}decompose(t,e,i){let n=this.elements;t.x=n[12],t.y=n[13],t.z=n[14];let r=this.determinantAffine();if(r===0)return i.set(1,1,1),e.identity(),this;let s=Oh.set(n[0],n[1],n[2]).length(),a=Oh.set(n[4],n[5],n[6]).length(),o=Oh.set(n[8],n[9],n[10]).length();r<0&&(s=-s),As.copy(this);let l=1/s,c=1/a,h=1/o;return As.elements[0]*=l,As.elements[1]*=l,As.elements[2]*=l,As.elements[4]*=c,As.elements[5]*=c,As.elements[6]*=c,As.elements[8]*=h,As.elements[9]*=h,As.elements[10]*=h,e.setFromRotationMatrix(As),i.x=s,i.y=a,i.z=o,this}makePerspective(t,e,i,n,r,s,a=sa,o=!1){let l,c,h=this.elements,d=2*r/(e-t),u=2*r/(i-n),p=(e+t)/(e-t),f=(i+n)/(i-n);if(o)l=r/(s-r),c=s*r/(s-r);else if(a===sa)l=-(s+r)/(s-r),c=-2*s*r/(s-r);else{if(a!==vd)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);l=-s/(s-r),c=-s*r/(s-r)}return h[0]=d,h[4]=0,h[8]=p,h[12]=0,h[1]=0,h[5]=u,h[9]=f,h[13]=0,h[2]=0,h[6]=0,h[10]=l,h[14]=c,h[3]=0,h[7]=0,h[11]=-1,h[15]=0,this}makeOrthographic(t,e,i,n,r,s,a=sa,o=!1){let l,c,h=this.elements,d=2/(e-t),u=2/(i-n),p=-(e+t)/(e-t),f=-(i+n)/(i-n);if(o)l=1/(s-r),c=s/(s-r);else if(a===sa)l=-2/(s-r),c=-(s+r)/(s-r);else{if(a!==vd)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);l=-1/(s-r),c=-r/(s-r)}return h[0]=d,h[4]=0,h[8]=0,h[12]=p,h[1]=0,h[5]=u,h[9]=0,h[13]=f,h[2]=0,h[6]=0,h[10]=l,h[14]=c,h[3]=0,h[7]=0,h[11]=0,h[15]=1,this}equals(t){let e=this.elements,i=t.elements;for(let n=0;n<16;n++)if(e[n]!==i[n])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){let i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}},cw.prototype.isMatrix4=!0,Oh=new C,As=new At,bD=new C(0,0,0),xD=new C(1,1,1),_o=new C,of=new C,Jr=new C,dw=new At,uw=new $t,(Ei=class{constructor(t=0,e=0,i=0,n=Ei.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=i,this._order=n}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,i,n=this._order){return this._x=t,this._y=e,this._z=i,this._order=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,i=!0){let n=t.elements,r=n[0],s=n[4],a=n[8],o=n[1],l=n[5],c=n[9],h=n[2],d=n[6],u=n[10];switch(e){case"XYZ":this._y=Math.asin(ge(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,u),this._z=Math.atan2(-s,r)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-ge(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(a,u),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(ge(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,u),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-ge(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,u),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-s,l));break;case"YZX":this._z=Math.asin(ge(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(a,u));break;case"XZY":this._z=Math.asin(-ge(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-c,u),this._y=0);break;default:ce("Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,i===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,i){return dw.makeRotationFromQuaternion(t),this.setFromRotationMatrix(dw,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return uw.setFromEuler(this),this.setFromQuaternion(uw,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}).DEFAULT_ORDER="XYZ",Qy=class{constructor(){this.mask=1}set(t){this.mask=1<<t>>>0}enable(t){this.mask|=1<<t}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t}disable(t){this.mask&=~(1<<t)}disableAll(){this.mask=0}test(t){return(this.mask&t.mask)!==0}isEnabled(t){return!!(this.mask&1<<t)}},wD=0,pw=new C,Lh=new $t,Ea=new At,lf=new C,_d=new C,SD=new C,MD=new $t,fw=new C(1,0,0),mw=new C(0,1,0),gw=new C(0,0,1),vw={type:"added"},ED={type:"removed"},Bh={type:"childadded",child:null},D0={type:"childremoved",child:null},(_i=class extends Nn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:wD++}),this.uuid=Es(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=_i.DEFAULT_UP.clone();let t=new C,e=new Ei,i=new $t,n=new C(1,1,1);e._onChange(function(){i.setFromEuler(e,!1)}),i._onChange(function(){e.setFromQuaternion(i,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:n},modelViewMatrix:{value:new At},normalMatrix:{value:new ue}}),this.matrix=new At,this.matrixWorld=new At,this.matrixAutoUpdate=_i.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=_i.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Qy,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return Lh.setFromAxisAngle(t,e),this.quaternion.multiply(Lh),this}rotateOnWorldAxis(t,e){return Lh.setFromAxisAngle(t,e),this.quaternion.premultiply(Lh),this}rotateX(t){return this.rotateOnAxis(fw,t)}rotateY(t){return this.rotateOnAxis(mw,t)}rotateZ(t){return this.rotateOnAxis(gw,t)}translateOnAxis(t,e){return pw.copy(t).applyQuaternion(this.quaternion),this.position.add(pw.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(fw,t)}translateY(t){return this.translateOnAxis(mw,t)}translateZ(t){return this.translateOnAxis(gw,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Ea.copy(this.matrixWorld).invert())}lookAt(t,e,i){t.isVector3?lf.copy(t):lf.set(t,e,i);let n=this.parent;this.updateWorldMatrix(!0,!1),_d.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Ea.lookAt(_d,lf,this.up):Ea.lookAt(lf,_d,this.up),this.quaternion.setFromRotationMatrix(Ea),n&&(Ea.extractRotation(n.matrixWorld),Lh.setFromRotationMatrix(Ea),this.quaternion.premultiply(Lh.invert()))}add(t){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(fe("Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(vw),Bh.child=t,this.dispatchEvent(Bh),Bh.child=null):fe("Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}let e=this.children.indexOf(t);return e!==-1&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(ED),D0.child=t,this.dispatchEvent(D0),D0.child=null),this}removeFromParent(){let t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),Ea.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),Ea.multiply(t.parent.matrixWorld)),t.applyMatrix4(Ea),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(vw),Bh.child=t,this.dispatchEvent(Bh),Bh.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let i=0,n=this.children.length;i<n;i++){let r=this.children[i].getObjectByProperty(t,e);if(r!==void 0)return r}}getObjectsByProperty(t,e,i=[]){this[t]===e&&i.push(this);let n=this.children;for(let r=0,s=n.length;r<s;r++)n[r].getObjectsByProperty(t,e,i);return i}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_d,t,SD),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_d,MD,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);let e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);let e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);let e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverseVisible(t)}traverseAncestors(t){let e=this.parent;e!==null&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let t=this.pivot;if(t!==null){let e=t.x,i=t.y,n=t.z,r=this.matrix.elements;r[12]+=e-r[0]*e-r[4]*i-r[8]*n,r[13]+=i-r[1]*e-r[5]*i-r[9]*n,r[14]+=n-r[2]*e-r[6]*i-r[10]*n}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);let e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].updateMatrixWorld(t)}updateWorldMatrix(t,e,i=!1){let n=this.parent;if(t===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||i)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,i=!0),e===!0){let r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].updateWorldMatrix(!1,!0,i)}}toJSON(t){let e=t===void 0||typeof t=="string",i={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let n={};function r(a,o){return a[o.uuid]===void 0&&(a[o.uuid]=o.toJSON(t)),o.uuid}if(n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.castShadow===!0&&(n.castShadow=!0),this.receiveShadow===!0&&(n.receiveShadow=!0),this.visible===!1&&(n.visible=!1),this.frustumCulled===!1&&(n.frustumCulled=!1),this.renderOrder!==0&&(n.renderOrder=this.renderOrder),this.static!==!1&&(n.static=this.static),Object.keys(this.userData).length>0&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),n.up=this.up.toArray(),this.pivot!==null&&(n.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(n.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(n.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(n.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(n.type="InstancedMesh",n.count=this.count,n.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(n.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(n.type="BatchedMesh",n.perObjectFrustumCulled=this.perObjectFrustumCulled,n.sortObjects=this.sortObjects,n.drawRanges=this._drawRanges,n.reservedRanges=this._reservedRanges,n.geometryInfo=this._geometryInfo.map(a=>({...a,boundingBox:a.boundingBox?a.boundingBox.toJSON():void 0,boundingSphere:a.boundingSphere?a.boundingSphere.toJSON():void 0})),n.instanceInfo=this._instanceInfo.map(a=>({...a})),n.availableInstanceIds=this._availableInstanceIds.slice(),n.availableGeometryIds=this._availableGeometryIds.slice(),n.nextIndexStart=this._nextIndexStart,n.nextVertexStart=this._nextVertexStart,n.geometryCount=this._geometryCount,n.maxInstanceCount=this._maxInstanceCount,n.maxVertexCount=this._maxVertexCount,n.maxIndexCount=this._maxIndexCount,n.geometryInitialized=this._geometryInitialized,n.matricesTexture=this._matricesTexture.toJSON(t),n.indirectTexture=this._indirectTexture.toJSON(t),this._colorsTexture!==null&&(n.colorsTexture=this._colorsTexture.toJSON(t)),this.boundingSphere!==null&&(n.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(n.boundingBox=this.boundingBox.toJSON())),this.isScene)this.background&&(this.background.isColor?n.background=this.background.toJSON():this.background.isTexture&&(n.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(n.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){n.geometry=r(t.geometries,this.geometry);let a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){let o=a.shapes;if(Array.isArray(o))for(let l=0,c=o.length;l<c;l++){let h=o[l];r(t.shapes,h)}else r(t.shapes,o)}}if(this.isSkinnedMesh&&(n.bindMode=this.bindMode,n.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(r(t.skeletons,this.skeleton),n.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let a=[];for(let o=0,l=this.material.length;o<l;o++)a.push(r(t.materials,this.material[o]));n.material=a}else n.material=r(t.materials,this.material);if(this.children.length>0){n.children=[];for(let a=0;a<this.children.length;a++)n.children.push(this.children[a].toJSON(t).object)}if(this.animations.length>0){n.animations=[];for(let a=0;a<this.animations.length;a++){let o=this.animations[a];n.animations.push(r(t.animations,o))}}if(e){let a=s(t.geometries),o=s(t.materials),l=s(t.textures),c=s(t.images),h=s(t.shapes),d=s(t.skeletons),u=s(t.animations),p=s(t.nodes);a.length>0&&(i.geometries=a),o.length>0&&(i.materials=o),l.length>0&&(i.textures=l),c.length>0&&(i.images=c),h.length>0&&(i.shapes=h),d.length>0&&(i.skeletons=d),u.length>0&&(i.animations=u),p.length>0&&(i.nodes=p)}return i.object=n,i;function s(a){let o=[];for(let l in a){let c=a[l];delete c.metadata,o.push(c)}return o}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!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.pivot=t.pivot!==null?t.pivot.clone():null,this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,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.static=t.static,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(let i=0;i<t.children.length;i++){let n=t.children[i];this.add(n.clone())}return this}}).DEFAULT_UP=new C(0,1,0),_i.DEFAULT_MATRIX_AUTO_UPDATE=!0,_i.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0,vp=class extends _i{constructor(){super(),this.isGroup=!0,this.type="Group"}},yw={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},bo={h:0,s:0,l:0},hf={h:0,s:0,l:0},Jt=class{constructor(t,e,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,i)}set(t,e,i){if(e===void 0&&i===void 0){let n=t;n&&n.isColor?this.copy(n):typeof n=="number"?this.setHex(n):typeof n=="string"&&this.setStyle(n)}else this.setRGB(t,e,i);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=Ue){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,Ve.colorSpaceToWorking(this,e),this}setRGB(t,e,i,n=Ve.workingColorSpace){return this.r=t,this.g=e,this.b=i,Ve.colorSpaceToWorking(this,n),this}setHSL(t,e,i,n=Ve.workingColorSpace){if(t=DM(t,1),e=ge(e,0,1),i=ge(i,0,1),e===0)this.r=this.g=this.b=i;else{let r=i<=.5?i*(1+e):i+e-i*e,s=2*i-r;this.r=ew(s,r,t+1/3),this.g=ew(s,r,t),this.b=ew(s,r,t-1/3)}return Ve.colorSpaceToWorking(this,n),this}setStyle(t,e=Ue){function i(r){r!==void 0&&parseFloat(r)<1&&ce("Color: Alpha component of "+t+" will be ignored.")}let n;if(n=/^(\w+)\(([^\)]*)\)/.exec(t)){let r,s=n[1],a=n[2];switch(s){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,e);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,e);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,e);break;default:ce("Color: Unknown color model "+t)}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(t)){let r=n[1],s=r.length;if(s===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,e);if(s===6)return this.setHex(parseInt(r,16),e);ce("Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=Ue){let i=yw[t.toLowerCase()];return i!==void 0?this.setHex(i,e):ce("Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=yo(t.r),this.g=yo(t.g),this.b=yo(t.b),this}copyLinearToSRGB(t){return this.r=gd(t.r),this.g=gd(t.g),this.b=gd(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=Ue){return Ve.workingToColorSpace(cr.copy(this),t),65536*Math.round(ge(255*cr.r,0,255))+256*Math.round(ge(255*cr.g,0,255))+Math.round(ge(255*cr.b,0,255))}getHexString(t=Ue){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Ve.workingColorSpace){Ve.workingToColorSpace(cr.copy(this),e);let i,n,r=cr.r,s=cr.g,a=cr.b,o=Math.max(r,s,a),l=Math.min(r,s,a),c=(l+o)/2;if(l===o)i=0,n=0;else{let h=o-l;switch(n=c<=.5?h/(o+l):h/(2-o-l),o){case r:i=(s-a)/h+(s<a?6:0);break;case s:i=(a-r)/h+2;break;case a:i=(r-s)/h+4}i/=6}return t.h=i,t.s=n,t.l=c,t}getRGB(t,e=Ve.workingColorSpace){return Ve.workingToColorSpace(cr.copy(this),e),t.r=cr.r,t.g=cr.g,t.b=cr.b,t}getStyle(t=Ue){Ve.workingToColorSpace(cr.copy(this),t);let e=cr.r,i=cr.g,n=cr.b;return t!==Ue?`color(${t} ${e.toFixed(3)} ${i.toFixed(3)} ${n.toFixed(3)})`:`rgb(${Math.round(255*e)},${Math.round(255*i)},${Math.round(255*n)})`}offsetHSL(t,e,i){return this.getHSL(bo),this.setHSL(bo.h+t,bo.s+e,bo.l+i)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,i){return this.r=t.r+(e.r-t.r)*i,this.g=t.g+(e.g-t.g)*i,this.b=t.b+(e.b-t.b)*i,this}lerpHSL(t,e){this.getHSL(bo),t.getHSL(hf);let i=dm(bo.h,hf.h,e),n=dm(bo.s,hf.s,e),r=dm(bo.l,hf.l,e);return this.setHSL(i,n,r),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){let e=this.r,i=this.g,n=this.b,r=t.elements;return this.r=r[0]*e+r[3]*i+r[6]*n,this.g=r[1]*e+r[4]*i+r[7]*n,this.b=r[2]*e+r[5]*i+r[8]*n,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},cr=new Jt,Jt.NAMES=yw,KM=class{constructor(t,e=1,i=1e3){this.isFog=!0,this.name="",this.color=new Jt(t),this.near=e,this.far=i}clone(){return new KM(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}},rs=class extends _i{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Ei,this.environmentIntensity=1,this.environmentRotation=new Ei,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),t.background!==null&&(this.background=t.background.clone()),t.environment!==null&&(this.environment=t.environment.clone()),t.fog!==null&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),t.overrideMaterial!==null&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){let e=super.toJSON(t);return this.fog!==null&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}},Ts=new C,Aa=new C,R0=new C,Ta=new C,Uh=new C,zh=new C,_w=new C,I0=new C,O0=new C,L0=new C,B0=new ve,U0=new ve,z0=new ve,un=class{constructor(t=new C,e=new C,i=new C){this.a=t,this.b=e,this.c=i}static getNormal(t,e,i,n){n.subVectors(i,e),Ts.subVectors(t,e),n.cross(Ts);let r=n.lengthSq();return r>0?n.multiplyScalar(1/Math.sqrt(r)):n.set(0,0,0)}static getBarycoord(t,e,i,n,r){Ts.subVectors(n,e),Aa.subVectors(i,e),R0.subVectors(t,e);let s=Ts.dot(Ts),a=Ts.dot(Aa),o=Ts.dot(R0),l=Aa.dot(Aa),c=Aa.dot(R0),h=s*l-a*a;if(h===0)return r.set(0,0,0),null;let d=1/h,u=(l*o-a*c)*d,p=(s*c-a*o)*d;return r.set(1-u-p,p,u)}static containsPoint(t,e,i,n){return this.getBarycoord(t,e,i,n,Ta)!==null&&Ta.x>=0&&Ta.y>=0&&Ta.x+Ta.y<=1}static getInterpolation(t,e,i,n,r,s,a,o){return this.getBarycoord(t,e,i,n,Ta)===null?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(r,Ta.x),o.addScaledVector(s,Ta.y),o.addScaledVector(a,Ta.z),o)}static getInterpolatedAttribute(t,e,i,n,r,s){return B0.setScalar(0),U0.setScalar(0),z0.setScalar(0),B0.fromBufferAttribute(t,e),U0.fromBufferAttribute(t,i),z0.fromBufferAttribute(t,n),s.setScalar(0),s.addScaledVector(B0,r.x),s.addScaledVector(U0,r.y),s.addScaledVector(z0,r.z),s}static isFrontFacing(t,e,i,n){return Ts.subVectors(i,e),Aa.subVectors(t,e),Ts.cross(Aa).dot(n)<0}set(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this}setFromPointsAndIndices(t,e,i,n){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[n]),this}setFromAttributeAndIndices(t,e,i,n){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,i),this.c.fromBufferAttribute(t,n),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Ts.subVectors(this.c,this.b),Aa.subVectors(this.a,this.b),.5*Ts.cross(Aa).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return un.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return un.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,i,n,r){return un.getInterpolation(t,this.a,this.b,this.c,e,i,n,r)}containsPoint(t){return un.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return un.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){let i,n,r=this.a,s=this.b,a=this.c;Uh.subVectors(s,r),zh.subVectors(a,r),I0.subVectors(t,r);let o=Uh.dot(I0),l=zh.dot(I0);if(o<=0&&l<=0)return e.copy(r);O0.subVectors(t,s);let c=Uh.dot(O0),h=zh.dot(O0);if(c>=0&&h<=c)return e.copy(s);let d=o*h-c*l;if(d<=0&&o>=0&&c<=0)return i=o/(o-c),e.copy(r).addScaledVector(Uh,i);L0.subVectors(t,a);let u=Uh.dot(L0),p=zh.dot(L0);if(p>=0&&u<=p)return e.copy(a);let f=u*l-o*p;if(f<=0&&l>=0&&p<=0)return n=l/(l-p),e.copy(r).addScaledVector(zh,n);let g=c*p-u*h;if(g<=0&&h-c>=0&&u-p>=0)return _w.subVectors(a,s),n=(h-c)/(h-c+(u-p)),e.copy(s).addScaledVector(_w,n);let m=1/(g+f+d);return i=f*m,n=d*m,e.copy(r).addScaledVector(Uh,i).addScaledVector(zh,n)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},ci=class{constructor(t=new C(1/0,1/0,1/0),e=new C(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e+=3)this.expandByPoint(Cs.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,i=t.count;e<i;e++)this.expandByPoint(Cs.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){let i=Cs.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);let i=t.geometry;if(i!==void 0){let r=i.getAttribute("position");if(e===!0&&r!==void 0&&t.isInstancedMesh!==!0)for(let s=0,a=r.count;s<a;s++)t.isMesh===!0?t.getVertexPosition(s,Cs):Cs.fromBufferAttribute(r,s),Cs.applyMatrix4(t.matrixWorld),this.expandByPoint(Cs);else t.boundingBox!==void 0?(t.boundingBox===null&&t.computeBoundingBox(),cf.copy(t.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),cf.copy(i.boundingBox)),cf.applyMatrix4(t.matrixWorld),this.union(cf)}let n=t.children;for(let r=0,s=n.length;r<s;r++)this.expandByObject(n[r],e);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,Cs),Cs.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(bd),df.subVectors(this.max,bd),Fh.subVectors(t.a,bd),Nh.subVectors(t.b,bd),kh.subVectors(t.c,bd),xo.subVectors(Nh,Fh),wo.subVectors(kh,Nh),_l.subVectors(Fh,kh);let e=[0,-xo.z,xo.y,0,-wo.z,wo.y,0,-_l.z,_l.y,xo.z,0,-xo.x,wo.z,0,-wo.x,_l.z,0,-_l.x,-xo.y,xo.x,0,-wo.y,wo.x,0,-_l.y,_l.x,0];return!(!iw(e,Fh,Nh,kh,df)||(e=[1,0,0,0,1,0,0,0,1],!iw(e,Fh,Nh,kh,df)))&&(uf.crossVectors(xo,wo),e=[uf.x,uf.y,uf.z],iw(e,Fh,Nh,kh,df))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Cs).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(Cs).length()),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(Ca[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Ca[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Ca[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Ca[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Ca[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Ca[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Ca[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Ca[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Ca)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(t){return this.min.fromArray(t.min),this.max.fromArray(t.max),this}},Ca=[new C,new C,new C,new C,new C,new C,new C,new C],Cs=new C,cf=new ci,Fh=new C,Nh=new C,kh=new C,xo=new C,wo=new C,_l=new C,bd=new C,df=new C,uf=new C,Ll=new C,Pa=function(){let t=new ArrayBuffer(4),e=new Float32Array(t),i=new Uint32Array(t),n=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){let c=l-127;c<-27?(n[l]=0,n[256|l]=32768,r[l]=24,r[256|l]=24):c<-14?(n[l]=1024>>-c-14,n[256|l]=1024>>-c-14|32768,r[l]=-c-1,r[256|l]=-c-1):c<=15?(n[l]=c+15<<10,n[256|l]=c+15<<10|32768,r[l]=13,r[256|l]=13):c<128?(n[l]=31744,n[256|l]=64512,r[l]=24,r[256|l]=24):(n[l]=31744,n[256|l]=64512,r[l]=13,r[256|l]=13)}let s=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,h=0;for(;!(8388608&c);)c<<=1,h-=8388608;c&=-8388609,h+=947912704,s[l]=c|h}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)a[l]=l<<23;a[31]=1199570944,a[32]=2147483648;for(let l=33;l<63;++l)a[l]=2147483648+(l-32<<23);a[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(o[l]=1024);return{floatView:e,uint32View:i,baseTable:n,shiftTable:r,mantissaTable:s,exponentTable:a,offsetTable:o}}(),Hl=class{static toHalfFloat(t){return function(e){Math.abs(e)>65504&&ce("DataUtils.toHalfFloat(): Value out of range."),e=ge(e,-65504,65504),Pa.floatView[0]=e;let i=Pa.uint32View[0],n=i>>23&511;return Pa.baseTable[n]+((8388607&i)>>Pa.shiftTable[n])}(t)}static fromHalfFloat(t){return function(e){let i=e>>10;return Pa.uint32View[0]=Pa.mantissaTable[Pa.offsetTable[i]+(1023&e)]+Pa.exponentTable[i],Pa.floatView[0]}(t)}},sn=new C,pf=new it,AD=0,Ht=class extends Nn{constructor(t,e,i=!1){if(super(),Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:AD++}),this.name="",this.array=t,this.itemSize=e,this.count=t!==void 0?t.length/e:0,this.normalized=i,this.usage=E0,this.updateRanges=[],this.gpuType=$e,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,i){t*=this.itemSize,i*=e.itemSize;for(let n=0,r=this.itemSize;n<r;n++)this.array[t+n]=e.array[i+n];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(this.itemSize===2)for(let e=0,i=this.count;e<i;e++)pf.fromBufferAttribute(this,e),pf.applyMatrix3(t),this.setXY(e,pf.x,pf.y);else if(this.itemSize===3)for(let e=0,i=this.count;e<i;e++)sn.fromBufferAttribute(this,e),sn.applyMatrix3(t),this.setXYZ(e,sn.x,sn.y,sn.z);return this}applyMatrix4(t){for(let e=0,i=this.count;e<i;e++)sn.fromBufferAttribute(this,e),sn.applyMatrix4(t),this.setXYZ(e,sn.x,sn.y,sn.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)sn.fromBufferAttribute(this,e),sn.applyNormalMatrix(t),this.setXYZ(e,sn.x,sn.y,sn.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)sn.fromBufferAttribute(this,e),sn.transformDirection(t),this.setXYZ(e,sn.x,sn.y,sn.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let i=this.array[t*this.itemSize+e];return this.normalized&&(i=$s(i,this.array)),i}setComponent(t,e,i){return this.normalized&&(i=mi(i,this.array)),this.array[t*this.itemSize+e]=i,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=$s(e,this.array)),e}setX(t,e){return this.normalized&&(e=mi(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=$s(e,this.array)),e}setY(t,e){return this.normalized&&(e=mi(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=$s(e,this.array)),e}setZ(t,e){return this.normalized&&(e=mi(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=$s(e,this.array)),e}setW(t,e){return this.normalized&&(e=mi(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,i){return t*=this.itemSize,this.normalized&&(e=mi(e,this.array),i=mi(i,this.array)),this.array[t+0]=e,this.array[t+1]=i,this}setXYZ(t,e,i,n){return t*=this.itemSize,this.normalized&&(e=mi(e,this.array),i=mi(i,this.array),n=mi(n,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this}setXYZW(t,e,i,n,r){return t*=this.itemSize,this.normalized&&(e=mi(e,this.array),i=mi(i,this.array),n=mi(n,this.array),r=mi(r,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this.array[t+3]=r,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(t.name=this.name),this.usage!==E0&&(t.usage=this.usage),t}dispose(){this.dispatchEvent({type:"dispose"})}},QM=class extends Ht{constructor(t,e,i){super(new Uint16Array(t),e,i)}},nh=class extends Ht{constructor(t,e,i){super(new Uint32Array(t),e,i)}},Nt=class extends Ht{constructor(t,e,i){super(new Float32Array(t),e,i)}},TD=new ci,xd=new C,F0=new C,vr=class{constructor(t=new C,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){let i=this.center;e!==void 0?i.copy(e):TD.setFromPoints(t).getCenter(i);let n=0;for(let r=0,s=t.length;r<s;r++)n=Math.max(n,i.distanceToSquared(t[r]));return this.radius=Math.sqrt(n),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){let e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){let i=this.center.distanceToSquared(t);return e.copy(t),i>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;xd.subVectors(t,this.center);let e=xd.lengthSq();if(e>this.radius*this.radius){let i=Math.sqrt(e),n=.5*(i-this.radius);this.center.addScaledVector(xd,n/i),this.radius+=n}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):(F0.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(xd.copy(t.center).add(F0)),this.expandByPoint(xd.copy(t.center).sub(F0))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(t){return this.radius=t.radius,this.center.fromArray(t.center),this}},CD=0,hs=new At,N0=new _i,Vh=new C,ts=new ci,wd=new ci,Ln=new C,Gt=class extends Nn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:CD++}),this.uuid=Es(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(function(e){for(let i=e.length-1;i>=0;--i)if(e[i]>=65535)return!0;return!1}(t)?nh:QM)(t,1):this.index=t,this}setIndirect(t,e=0){return this.indirect=t,this.indirectOffset=e,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return this.attributes[t]!==void 0}addGroup(t,e,i=0){this.groups.push({start:t,count:e,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){let e=this.attributes.position;e!==void 0&&(e.applyMatrix4(t),e.needsUpdate=!0);let i=this.attributes.normal;if(i!==void 0){let r=new ue().getNormalMatrix(t);i.applyNormalMatrix(r),i.needsUpdate=!0}let n=this.attributes.tangent;return n!==void 0&&(n.transformDirection(t),n.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(t){return hs.makeRotationFromQuaternion(t),this.applyMatrix4(hs),this}rotateX(t){return hs.makeRotationX(t),this.applyMatrix4(hs),this}rotateY(t){return hs.makeRotationY(t),this.applyMatrix4(hs),this}rotateZ(t){return hs.makeRotationZ(t),this.applyMatrix4(hs),this}translate(t,e,i){return hs.makeTranslation(t,e,i),this.applyMatrix4(hs),this}scale(t,e,i){return hs.makeScale(t,e,i),this.applyMatrix4(hs),this}lookAt(t){return N0.lookAt(t),N0.updateMatrix(),this.applyMatrix4(N0.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Vh).negate(),this.translate(Vh.x,Vh.y,Vh.z),this}setFromPoints(t){let e=this.getAttribute("position");if(e===void 0){let i=[];for(let n=0,r=t.length;n<r;n++){let s=t[n];i.push(s.x,s.y,s.z||0)}this.setAttribute("position",new Nt(i,3))}else{let i=Math.min(t.length,e.count);for(let n=0;n<i;n++){let r=t[n];e.setXYZ(n,r.x,r.y,r.z||0)}t.length>e.count&&ce("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new ci);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return fe("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),void this.boundingBox.set(new C(-1/0,-1/0,-1/0),new C(1/0,1/0,1/0));if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),e)for(let i=0,n=e.length;i<n;i++){let r=e[i];ts.setFromBufferAttribute(r),this.morphTargetsRelative?(Ln.addVectors(this.boundingBox.min,ts.min),this.boundingBox.expandByPoint(Ln),Ln.addVectors(this.boundingBox.max,ts.max),this.boundingBox.expandByPoint(Ln)):(this.boundingBox.expandByPoint(ts.min),this.boundingBox.expandByPoint(ts.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&fe('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new vr);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return fe("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),void this.boundingSphere.set(new C,1/0);if(t){let i=this.boundingSphere.center;if(ts.setFromBufferAttribute(t),e)for(let r=0,s=e.length;r<s;r++){let a=e[r];wd.setFromBufferAttribute(a),this.morphTargetsRelative?(Ln.addVectors(ts.min,wd.min),ts.expandByPoint(Ln),Ln.addVectors(ts.max,wd.max),ts.expandByPoint(Ln)):(ts.expandByPoint(wd.min),ts.expandByPoint(wd.max))}ts.getCenter(i);let n=0;for(let r=0,s=t.count;r<s;r++)Ln.fromBufferAttribute(t,r),n=Math.max(n,i.distanceToSquared(Ln));if(e)for(let r=0,s=e.length;r<s;r++){let a=e[r],o=this.morphTargetsRelative;for(let l=0,c=a.count;l<c;l++)Ln.fromBufferAttribute(a,l),o&&(Vh.fromBufferAttribute(t,l),Ln.add(Vh)),n=Math.max(n,i.distanceToSquared(Ln))}this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&fe('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let t=this.index,e=this.attributes;if(t===null||e.position===void 0||e.normal===void 0||e.uv===void 0)return void fe("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");let i=e.position,n=e.normal,r=e.uv,s=this.getAttribute("tangent");(s===void 0||s.count!==i.count)&&(s=new Ht(new Float32Array(4*i.count),4),this.setAttribute("tangent",s));let a=[],o=[];for(let S=0;S<i.count;S++)a[S]=new C,o[S]=new C;let l=new C,c=new C,h=new C,d=new it,u=new it,p=new it,f=new C,g=new C;function m(S,A,E){l.fromBufferAttribute(i,S),c.fromBufferAttribute(i,A),h.fromBufferAttribute(i,E),d.fromBufferAttribute(r,S),u.fromBufferAttribute(r,A),p.fromBufferAttribute(r,E),c.sub(l),h.sub(l),u.sub(d),p.sub(d);let P=1/(u.x*p.y-p.x*u.y);!isFinite(P)||(f.copy(c).multiplyScalar(p.y).addScaledVector(h,-u.y).multiplyScalar(P),g.copy(h).multiplyScalar(u.x).addScaledVector(c,-p.x).multiplyScalar(P),a[S].add(f),a[A].add(f),a[E].add(f),o[S].add(g),o[A].add(g),o[E].add(g))}let y=this.groups;y.length===0&&(y=[{start:0,count:t.count}]);for(let S=0,A=y.length;S<A;++S){let E=y[S],P=E.start;for(let T=P,R=P+E.count;T<R;T+=3)m(t.getX(T+0),t.getX(T+1),t.getX(T+2))}let v=new C,_=new C,b=new C,x=new C;function w(S){b.fromBufferAttribute(n,S),x.copy(b);let A=a[S];v.copy(A),v.sub(b.multiplyScalar(b.dot(A))).normalize(),_.crossVectors(x,A);let E=_.dot(o[S])<0?-1:1;s.setXYZW(S,v.x,v.y,v.z,E)}for(let S=0,A=y.length;S<A;++S){let E=y[S],P=E.start;for(let T=P,R=P+E.count;T<R;T+=3)w(t.getX(T+0)),w(t.getX(T+1)),w(t.getX(T+2))}this._transformed=!0}computeVertexNormals(){let t=this.index,e=this.getAttribute("position");if(e!==void 0){let i=this.getAttribute("normal");if(i===void 0||i.count!==e.count)i=new Ht(new Float32Array(3*e.count),3),this.setAttribute("normal",i);else for(let d=0,u=i.count;d<u;d++)i.setXYZ(d,0,0,0);let n=new C,r=new C,s=new C,a=new C,o=new C,l=new C,c=new C,h=new C;if(t)for(let d=0,u=t.count;d<u;d+=3){let p=t.getX(d+0),f=t.getX(d+1),g=t.getX(d+2);n.fromBufferAttribute(e,p),r.fromBufferAttribute(e,f),s.fromBufferAttribute(e,g),c.subVectors(s,r),h.subVectors(n,r),c.cross(h),a.fromBufferAttribute(i,p),o.fromBufferAttribute(i,f),l.fromBufferAttribute(i,g),a.add(c),o.add(c),l.add(c),i.setXYZ(p,a.x,a.y,a.z),i.setXYZ(f,o.x,o.y,o.z),i.setXYZ(g,l.x,l.y,l.z)}else for(let d=0,u=e.count;d<u;d+=3)n.fromBufferAttribute(e,d+0),r.fromBufferAttribute(e,d+1),s.fromBufferAttribute(e,d+2),c.subVectors(s,r),h.subVectors(n,r),c.cross(h),i.setXYZ(d+0,c.x,c.y,c.z),i.setXYZ(d+1,c.x,c.y,c.z),i.setXYZ(d+2,c.x,c.y,c.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){let t=this.attributes.normal;for(let e=0,i=t.count;e<i;e++)Ln.fromBufferAttribute(t,e),Ln.normalize(),t.setXYZ(e,Ln.x,Ln.y,Ln.z)}toNonIndexed(){function t(a,o){let l=a.array,c=a.itemSize,h=a.normalized,d=new l.constructor(o.length*c),u=0,p=0;for(let f=0,g=o.length;f<g;f++){u=a.isInterleavedBufferAttribute?o[f]*a.data.stride+a.offset:o[f]*c;for(let m=0;m<c;m++)d[p++]=l[u++]}return new Ht(d,c,h)}if(this.index===null)return ce("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let e=new Gt,i=this.index.array,n=this.attributes;for(let a in n){let o=t(n[a],i);e.setAttribute(a,o)}let r=this.morphAttributes;for(let a in r){let o=[],l=r[a];for(let c=0,h=l.length;c<h;c++){let d=t(l[c],i);o.push(d)}e.morphAttributes[a]=o}e.morphTargetsRelative=this.morphTargetsRelative;let s=this.groups;for(let a=0,o=s.length;a<o;a++){let l=s[a];e.addGroup(l.start,l.count,l.materialIndex)}return e}toJSON(){let t={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,this.name!==""&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){let o=this.parameters;for(let l in o)o[l]!==void 0&&(t[l]=o[l]);return t}t.data={attributes:{}};let e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});let i=this.attributes;for(let o in i){let l=i[o];t.data.attributes[o]=l.toJSON(t.data)}let n={},r=!1;for(let o in this.morphAttributes){let l=this.morphAttributes[o],c=[];for(let h=0,d=l.length;h<d;h++){let u=l[h];c.push(u.toJSON(t.data))}c.length>0&&(n[o]=c,r=!0)}r&&(t.data.morphAttributes=n,t.data.morphTargetsRelative=this.morphTargetsRelative);let s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));let a=this.boundingSphere;return a!==null&&(t.data.boundingSphere=a.toJSON()),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let e={};this.name=t.name;let i=t.index;i!==null&&this.setIndex(i.clone());let n=t.attributes;for(let l in n){let c=n[l];this.setAttribute(l,c.clone(e))}let r=t.morphAttributes;for(let l in r){let c=[],h=r[l];for(let d=0,u=h.length;d<u;d++)c.push(h[d].clone(e));this.morphAttributes[l]=c}this.morphTargetsRelative=t.morphTargetsRelative;let s=t.groups;for(let l=0,c=s.length;l<c;l++){let h=s[l];this.addGroup(h.start,h.count,h.materialIndex)}let a=t.boundingBox;a!==null&&(this.boundingBox=a.clone());let o=t.boundingSphere;return o!==null&&(this.boundingSphere=o.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this._transformed=t._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}},JM=class{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=t!==void 0?t.length/e:0,this.usage=E0,this.updateRanges=[],this.version=0,this.uuid=Es()}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,i){t*=this.stride,i*=e.stride;for(let n=0,r=this.stride;n<r;n++)this.array[t+n]=e.array[i+n];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Es()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(e,this.stride);return i.setUsage(this.usage),i}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Es()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}},xr=new C,fm=class{constructor(t,e,i,n=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=e,this.offset=i,this.normalized=n}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,i=this.data.count;e<i;e++)xr.fromBufferAttribute(this,e),xr.applyMatrix4(t),this.setXYZ(e,xr.x,xr.y,xr.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)xr.fromBufferAttribute(this,e),xr.applyNormalMatrix(t),this.setXYZ(e,xr.x,xr.y,xr.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)xr.fromBufferAttribute(this,e),xr.transformDirection(t),this.setXYZ(e,xr.x,xr.y,xr.z);return this}getComponent(t,e){let i=this.array[t*this.data.stride+this.offset+e];return this.normalized&&(i=$s(i,this.array)),i}setComponent(t,e,i){return this.normalized&&(i=mi(i,this.array)),this.data.array[t*this.data.stride+this.offset+e]=i,this}setX(t,e){return this.normalized&&(e=mi(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.normalized&&(e=mi(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.normalized&&(e=mi(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.normalized&&(e=mi(e,this.array)),this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){let e=this.data.array[t*this.data.stride+this.offset];return this.normalized&&(e=$s(e,this.array)),e}getY(t){let e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=$s(e,this.array)),e}getZ(t){let e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=$s(e,this.array)),e}getW(t){let e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=$s(e,this.array)),e}setXY(t,e,i){return t=t*this.data.stride+this.offset,this.normalized&&(e=mi(e,this.array),i=mi(i,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=i,this}setXYZ(t,e,i,n){return t=t*this.data.stride+this.offset,this.normalized&&(e=mi(e,this.array),i=mi(i,this.array),n=mi(n,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=n,this}setXYZW(t,e,i,n,r){return t=t*this.data.stride+this.offset,this.normalized&&(e=mi(e,this.array),i=mi(i,this.array),n=mi(n,this.array),r=mi(r,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=n,this.data.array[t+3]=r,this}clone(t){if(t===void 0){R1("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let i=0;i<this.count;i++){let n=i*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)e.push(this.data.array[n+r])}return new Ht(new this.array.constructor(e),this.itemSize,this.normalized)}return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new fm(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(t===void 0){R1("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let i=0;i<this.count;i++){let n=i*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)e.push(this.data.array[n+r])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}},PD=0,jh=class extends Nn{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:PD++}),this.uuid=Es(),this.name="",this.type="Material",this.blending=ih,this.side=Vs,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Ny,this.blendDst=ky,this.blendEquation=Nl,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Jt(0,0,0),this.blendAlpha=0,this.depthFunc=vc,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Ih,this.stencilZFail=Ih,this.stencilZPass=Ih,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(t!==void 0)for(let e in t){let i=t[e];if(i===void 0){ce(`Material: parameter '${e}' has value of undefined.`);continue}let n=this[e];n!==void 0?n&&n.isColor?n.set(i):n&&n.isVector2&&i&&i.isVector2||n&&n.isEuler&&i&&i.isEuler||n&&n.isVector3&&i&&i.isVector3?n.copy(i):this[e]=i:ce(`Material: '${e}' is not a property of THREE.${this.type}.`)}}toJSON(t){let e=t===void 0||typeof t=="string";e&&(t={textures:{},images:{}});let i={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};function n(r){let s=[];for(let a in r){let o=r[a];delete o.metadata,s.push(o)}return s}if(i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(t).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(t).uuid),this.dispersion!==void 0&&(i.dispersion=this.dispersion),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(t).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(t).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(t).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(t).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==ih&&(i.blending=this.blending),this.side!==Vs&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==Ny&&(i.blendSrc=this.blendSrc),this.blendDst!==ky&&(i.blendDst=this.blendDst),this.blendEquation!==Nl&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==vc&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==519&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Ih&&(i.stencilFail=this.stencilFail),this.stencilZFail!==Ih&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==Ih&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.allowOverride===!1&&(i.allowOverride=!1),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData),e){let r=n(t.textures),s=n(t.images);r.length>0&&(i.textures=r),s.length>0&&(i.images=s)}return i}fromJSON(t,e){if(t.uuid!==void 0&&(this.uuid=t.uuid),t.name!==void 0&&(this.name=t.name),t.color!==void 0&&this.color!==void 0&&this.color.setHex(t.color),t.roughness!==void 0&&(this.roughness=t.roughness),t.metalness!==void 0&&(this.metalness=t.metalness),t.sheen!==void 0&&(this.sheen=t.sheen),t.sheenColor!==void 0&&(this.sheenColor=new Jt().setHex(t.sheenColor)),t.sheenRoughness!==void 0&&(this.sheenRoughness=t.sheenRoughness),t.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(t.emissive),t.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(t.specular),t.specularIntensity!==void 0&&(this.specularIntensity=t.specularIntensity),t.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(t.specularColor),t.shininess!==void 0&&(this.shininess=t.shininess),t.clearcoat!==void 0&&(this.clearcoat=t.clearcoat),t.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=t.clearcoatRoughness),t.dispersion!==void 0&&(this.dispersion=t.dispersion),t.iridescence!==void 0&&(this.iridescence=t.iridescence),t.iridescenceIOR!==void 0&&(this.iridescenceIOR=t.iridescenceIOR),t.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=t.iridescenceThicknessRange),t.transmission!==void 0&&(this.transmission=t.transmission),t.thickness!==void 0&&(this.thickness=t.thickness),t.attenuationDistance!==void 0&&(this.attenuationDistance=t.attenuationDistance),t.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(t.attenuationColor),t.anisotropy!==void 0&&(this.anisotropy=t.anisotropy),t.anisotropyRotation!==void 0&&(this.anisotropyRotation=t.anisotropyRotation),t.fog!==void 0&&(this.fog=t.fog),t.flatShading!==void 0&&(this.flatShading=t.flatShading),t.blending!==void 0&&(this.blending=t.blending),t.combine!==void 0&&(this.combine=t.combine),t.side!==void 0&&(this.side=t.side),t.shadowSide!==void 0&&(this.shadowSide=t.shadowSide),t.opacity!==void 0&&(this.opacity=t.opacity),t.transparent!==void 0&&(this.transparent=t.transparent),t.alphaTest!==void 0&&(this.alphaTest=t.alphaTest),t.alphaHash!==void 0&&(this.alphaHash=t.alphaHash),t.depthFunc!==void 0&&(this.depthFunc=t.depthFunc),t.depthTest!==void 0&&(this.depthTest=t.depthTest),t.depthWrite!==void 0&&(this.depthWrite=t.depthWrite),t.colorWrite!==void 0&&(this.colorWrite=t.colorWrite),t.blendSrc!==void 0&&(this.blendSrc=t.blendSrc),t.blendDst!==void 0&&(this.blendDst=t.blendDst),t.blendEquation!==void 0&&(this.blendEquation=t.blendEquation),t.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=t.blendSrcAlpha),t.blendDstAlpha!==void 0&&(this.blendDstAlpha=t.blendDstAlpha),t.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=t.blendEquationAlpha),t.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(t.blendColor),t.blendAlpha!==void 0&&(this.blendAlpha=t.blendAlpha),t.stencilWriteMask!==void 0&&(this.stencilWriteMask=t.stencilWriteMask),t.stencilFunc!==void 0&&(this.stencilFunc=t.stencilFunc),t.stencilRef!==void 0&&(this.stencilRef=t.stencilRef),t.stencilFuncMask!==void 0&&(this.stencilFuncMask=t.stencilFuncMask),t.stencilFail!==void 0&&(this.stencilFail=t.stencilFail),t.stencilZFail!==void 0&&(this.stencilZFail=t.stencilZFail),t.stencilZPass!==void 0&&(this.stencilZPass=t.stencilZPass),t.stencilWrite!==void 0&&(this.stencilWrite=t.stencilWrite),t.wireframe!==void 0&&(this.wireframe=t.wireframe),t.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=t.wireframeLinewidth),t.wireframeLinecap!==void 0&&(this.wireframeLinecap=t.wireframeLinecap),t.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=t.wireframeLinejoin),t.rotation!==void 0&&(this.rotation=t.rotation),t.linewidth!==void 0&&(this.linewidth=t.linewidth),t.dashSize!==void 0&&(this.dashSize=t.dashSize),t.gapSize!==void 0&&(this.gapSize=t.gapSize),t.scale!==void 0&&(this.scale=t.scale),t.polygonOffset!==void 0&&(this.polygonOffset=t.polygonOffset),t.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=t.polygonOffsetFactor),t.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=t.polygonOffsetUnits),t.dithering!==void 0&&(this.dithering=t.dithering),t.alphaToCoverage!==void 0&&(this.alphaToCoverage=t.alphaToCoverage),t.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=t.premultipliedAlpha),t.forceSinglePass!==void 0&&(this.forceSinglePass=t.forceSinglePass),t.allowOverride!==void 0&&(this.allowOverride=t.allowOverride),t.visible!==void 0&&(this.visible=t.visible),t.toneMapped!==void 0&&(this.toneMapped=t.toneMapped),t.userData!==void 0&&(this.userData=t.userData),t.vertexColors!==void 0&&(typeof t.vertexColors=="number"?this.vertexColors=t.vertexColors>0:this.vertexColors=t.vertexColors),t.size!==void 0&&(this.size=t.size),t.sizeAttenuation!==void 0&&(this.sizeAttenuation=t.sizeAttenuation),t.map!==void 0&&(this.map=e[t.map]||null),t.matcap!==void 0&&(this.matcap=e[t.matcap]||null),t.alphaMap!==void 0&&(this.alphaMap=e[t.alphaMap]||null),t.bumpMap!==void 0&&(this.bumpMap=e[t.bumpMap]||null),t.bumpScale!==void 0&&(this.bumpScale=t.bumpScale),t.normalMap!==void 0&&(this.normalMap=e[t.normalMap]||null),t.normalMapType!==void 0&&(this.normalMapType=t.normalMapType),t.normalScale!==void 0){let i=t.normalScale;Array.isArray(i)===!1&&(i=[i,i]),this.normalScale=new it().fromArray(i)}return t.displacementMap!==void 0&&(this.displacementMap=e[t.displacementMap]||null),t.displacementScale!==void 0&&(this.displacementScale=t.displacementScale),t.displacementBias!==void 0&&(this.displacementBias=t.displacementBias),t.roughnessMap!==void 0&&(this.roughnessMap=e[t.roughnessMap]||null),t.metalnessMap!==void 0&&(this.metalnessMap=e[t.metalnessMap]||null),t.emissiveMap!==void 0&&(this.emissiveMap=e[t.emissiveMap]||null),t.emissiveIntensity!==void 0&&(this.emissiveIntensity=t.emissiveIntensity),t.specularMap!==void 0&&(this.specularMap=e[t.specularMap]||null),t.specularIntensityMap!==void 0&&(this.specularIntensityMap=e[t.specularIntensityMap]||null),t.specularColorMap!==void 0&&(this.specularColorMap=e[t.specularColorMap]||null),t.envMap!==void 0&&(this.envMap=e[t.envMap]||null),t.envMapRotation!==void 0&&this.envMapRotation.fromArray(t.envMapRotation),t.envMapIntensity!==void 0&&(this.envMapIntensity=t.envMapIntensity),t.reflectivity!==void 0&&(this.reflectivity=t.reflectivity),t.refractionRatio!==void 0&&(this.refractionRatio=t.refractionRatio),t.lightMap!==void 0&&(this.lightMap=e[t.lightMap]||null),t.lightMapIntensity!==void 0&&(this.lightMapIntensity=t.lightMapIntensity),t.aoMap!==void 0&&(this.aoMap=e[t.aoMap]||null),t.aoMapIntensity!==void 0&&(this.aoMapIntensity=t.aoMapIntensity),t.gradientMap!==void 0&&(this.gradientMap=e[t.gradientMap]||null),t.clearcoatMap!==void 0&&(this.clearcoatMap=e[t.clearcoatMap]||null),t.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=e[t.clearcoatRoughnessMap]||null),t.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=e[t.clearcoatNormalMap]||null),t.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new it().fromArray(t.clearcoatNormalScale)),t.iridescenceMap!==void 0&&(this.iridescenceMap=e[t.iridescenceMap]||null),t.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=e[t.iridescenceThicknessMap]||null),t.transmissionMap!==void 0&&(this.transmissionMap=e[t.transmissionMap]||null),t.thicknessMap!==void 0&&(this.thicknessMap=e[t.thicknessMap]||null),t.anisotropyMap!==void 0&&(this.anisotropyMap=e[t.anisotropyMap]||null),t.sheenColorMap!==void 0&&(this.sheenColorMap=e[t.sheenColorMap]||null),t.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=e[t.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;let e=t.clippingPlanes,i=null;if(e!==null){let n=e.length;i=new Array(n);for(let r=0;r!==n;++r)i[r]=e[r].clone()}return this.clippingPlanes=i,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.allowOverride=t.allowOverride,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){t===!0&&this.version++}},Da=new C,k0=new C,ff=new C,So=new C,V0=new C,mf=new C,j0=new C,$o=class{constructor(t=new C,e=new C(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,Da)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);let i=e.dot(this.direction);return i<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){let e=Da.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Da.copy(this.origin).addScaledVector(this.direction,e),Da.distanceToSquared(t))}distanceSqToSegment(t,e,i,n){k0.copy(t).add(e).multiplyScalar(.5),ff.copy(e).sub(t).normalize(),So.copy(this.origin).sub(k0);let r,s,a,o,l=.5*t.distanceTo(e),c=-this.direction.dot(ff),h=So.dot(this.direction),d=-So.dot(ff),u=So.lengthSq(),p=Math.abs(1-c*c);if(p>0)if(r=c*d-h,s=c*h-d,o=l*p,r>=0)if(s>=-o)if(s<=o){let f=1/p;r*=f,s*=f,a=r*(r+c*s+2*h)+s*(c*r+s+2*d)+u}else s=l,r=Math.max(0,-(c*s+h)),a=-r*r+s*(s+2*d)+u;else s=-l,r=Math.max(0,-(c*s+h)),a=-r*r+s*(s+2*d)+u;else s<=-o?(r=Math.max(0,-(-c*l+h)),s=r>0?-l:Math.min(Math.max(-l,-d),l),a=-r*r+s*(s+2*d)+u):s<=o?(r=0,s=Math.min(Math.max(-l,-d),l),a=s*(s+2*d)+u):(r=Math.max(0,-(c*l+h)),s=r>0?l:Math.min(Math.max(-l,-d),l),a=-r*r+s*(s+2*d)+u);else s=c>0?-l:l,r=Math.max(0,-(c*s+h)),a=-r*r+s*(s+2*d)+u;return i&&i.copy(this.origin).addScaledVector(this.direction,r),n&&n.copy(k0).addScaledVector(ff,s),a}intersectSphere(t,e){Da.subVectors(t.center,this.origin);let i=Da.dot(this.direction),n=Da.dot(Da)-i*i,r=t.radius*t.radius;if(n>r)return null;let s=Math.sqrt(r-n),a=i-s,o=i+s;return o<0?null:a<0?this.at(o,e):this.at(a,e)}intersectsSphere(t){return!(t.radius<0)&&this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){let e=t.normal.dot(this.direction);if(e===0)return t.distanceToPoint(this.origin)===0?0:null;let i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null}intersectPlane(t,e){let i=this.distanceToPlane(t);return i===null?null:this.at(i,e)}intersectsPlane(t){let e=t.distanceToPoint(this.origin);return e===0||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let i,n,r,s,a,o,l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,d=this.origin;return l>=0?(i=(t.min.x-d.x)*l,n=(t.max.x-d.x)*l):(i=(t.max.x-d.x)*l,n=(t.min.x-d.x)*l),c>=0?(r=(t.min.y-d.y)*c,s=(t.max.y-d.y)*c):(r=(t.max.y-d.y)*c,s=(t.min.y-d.y)*c),i>s||r>n||((r>i||isNaN(i))&&(i=r),(s<n||isNaN(n))&&(n=s),h>=0?(a=(t.min.z-d.z)*h,o=(t.max.z-d.z)*h):(a=(t.max.z-d.z)*h,o=(t.min.z-d.z)*h),i>o||a>n)||((a>i||i!=i)&&(i=a),(o<n||n!=n)&&(n=o),n<0)?null:this.at(i>=0?i:n,e)}intersectsBox(t){return this.intersectBox(t,Da)!==null}intersectTriangle(t,e,i,n,r){V0.subVectors(e,t),mf.subVectors(i,t),j0.crossVectors(V0,mf);let s,a=this.direction.dot(j0);if(a>0){if(n)return null;s=1}else{if(!(a<0))return null;s=-1,a=-a}So.subVectors(this.origin,t);let o=s*this.direction.dot(mf.crossVectors(So,mf));if(o<0)return null;let l=s*this.direction.dot(V0.cross(So));if(l<0||o+l>a)return null;let c=-s*So.dot(j0);return c<0?null:this.at(c/a,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},Gs=class extends jh{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Jt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ei,this.combine=FM,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}},bw=new At,bl=new $o,gf=new vr,xw=new C,mm=new C,gm=new C,vm=new C,G0=new C,vf=new C,tE=new C,ym=new C,xi=class extends _i{constructor(t=new Gt,e=new Gs){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),t.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),t.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){let t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){let i=t[e[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let n=0,r=i.length;n<r;n++){let s=i[n].name||String(n);this.morphTargetInfluences.push(0),this.morphTargetDictionary[s]=n}}}}getVertexPosition(t,e){let i=this.geometry,n=i.attributes.position,r=i.morphAttributes.position,s=i.morphTargetsRelative;e.fromBufferAttribute(n,t);let a=this.morphTargetInfluences;if(r&&a){vf.set(0,0,0);for(let o=0,l=r.length;o<l;o++){let c=a[o],h=r[o];c!==0&&(G0.fromBufferAttribute(h,t),s?vf.addScaledVector(G0,c):vf.addScaledVector(G0.sub(e),c))}e.add(vf)}return e}raycast(t,e){let i=this.geometry,n=this.material,r=this.matrixWorld;n!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),gf.copy(i.boundingSphere),gf.applyMatrix4(r),bl.copy(t.ray).recast(t.near),(gf.containsPoint(bl.origin)!==!1||!(bl.intersectSphere(gf,xw)===null||bl.origin.distanceToSquared(xw)>(t.far-t.near)**2))&&(bw.copy(r).invert(),bl.copy(t.ray).applyMatrix4(bw),(i.boundingBox===null||bl.intersectsBox(i.boundingBox)!==!1)&&this._computeIntersections(t,e,bl)))}_computeIntersections(t,e,i){let n,r=this.geometry,s=this.material,a=r.index,o=r.attributes.position,l=r.attributes.uv,c=r.attributes.uv1,h=r.attributes.normal,d=r.groups,u=r.drawRange;if(a!==null)if(Array.isArray(s))for(let p=0,f=d.length;p<f;p++){let g=d[p],m=s[g.materialIndex];for(let y=Math.max(g.start,u.start),v=Math.min(a.count,Math.min(g.start+g.count,u.start+u.count));y<v;y+=3)n=y0(this,m,t,i,l,c,h,a.getX(y),a.getX(y+1),a.getX(y+2)),n&&(n.faceIndex=Math.floor(y/3),n.face.materialIndex=g.materialIndex,e.push(n))}else for(let p=Math.max(0,u.start),f=Math.min(a.count,u.start+u.count);p<f;p+=3)n=y0(this,s,t,i,l,c,h,a.getX(p),a.getX(p+1),a.getX(p+2)),n&&(n.faceIndex=Math.floor(p/3),e.push(n));else if(o!==void 0)if(Array.isArray(s))for(let p=0,f=d.length;p<f;p++){let g=d[p],m=s[g.materialIndex];for(let y=Math.max(g.start,u.start),v=Math.min(o.count,Math.min(g.start+g.count,u.start+u.count));y<v;y+=3)n=y0(this,m,t,i,l,c,h,y,y+1,y+2),n&&(n.faceIndex=Math.floor(y/3),n.face.materialIndex=g.materialIndex,e.push(n))}else for(let p=Math.max(0,u.start),f=Math.min(o.count,u.start+u.count);p<f;p+=3)n=y0(this,s,t,i,l,c,h,p,p+1,p+2),n&&(n.faceIndex=Math.floor(p/3),e.push(n))}},eE=class extends _i{constructor(){super(),this.isBone=!0,this.type="Bone"}},Tn=class extends zi{constructor(t=null,e=1,i=1,n,r,s,a,o,l=De,c=De,h,d){super(null,s,a,o,l,c,n,r,h,d),this.isDataTexture=!0,this.image={data:t,width:e,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},ww=new At,DD=new At,d_=class{constructor(t=[],e=[]){this.uuid=Es(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){let t=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(16*t.length),e.length===0)this.calculateInverses();else if(t.length!==e.length){ce("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let i=0,n=this.bones.length;i<n;i++)this.boneInverses.push(new At)}}calculateInverses(){this.boneInverses.length=0;for(let t=0,e=this.bones.length;t<e;t++){let i=new At;this.bones[t]&&i.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(i)}}pose(){for(let t=0,e=this.bones.length;t<e;t++){let i=this.bones[t];i&&i.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,e=this.bones.length;t<e;t++){let i=this.bones[t];i&&(i.parent&&i.parent.isBone?(i.matrix.copy(i.parent.matrixWorld).invert(),i.matrix.multiply(i.matrixWorld)):i.matrix.copy(i.matrixWorld),i.matrix.decompose(i.position,i.quaternion,i.scale))}}update(){let t=this.bones,e=this.boneInverses,i=this.boneMatrices,n=this.boneTexture;for(let r=0,s=t.length;r<s;r++){let a=t[r]?t[r].matrixWorld:DD;ww.multiplyMatrices(a,e[r]),ww.toArray(i,16*r)}n!==null&&(n.needsUpdate=!0)}clone(){return new d_(this.bones,this.boneInverses)}computeBoneTexture(){let t=Math.sqrt(4*this.bones.length);t=4*Math.ceil(t/4),t=Math.max(t,4);let e=new Float32Array(t*t*4);e.set(this.boneMatrices);let i=new Tn(e,t,t,qi,$e);return i.needsUpdate=!0,this.boneMatrices=e,this.boneTexture=i,this}getBoneByName(t){for(let e=0,i=this.bones.length;e<i;e++){let n=this.bones[e];if(n.name===t)return n}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(t,e){this.uuid=t.uuid;for(let i=0,n=t.bones.length;i<n;i++){let r=t.bones[i],s=e[r];s===void 0&&(ce("Skeleton: No bone found with UUID:",r),s=new eE),this.bones.push(s),this.boneInverses.push(new At().fromArray(t.boneInverses[i]))}return this.init(),this}toJSON(){let t={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;let e=this.bones,i=this.boneInverses;for(let n=0,r=e.length;n<r;n++){let s=e[n];t.bones.push(s.uuid);let a=i[n];t.boneInverses.push(a.toArray())}return t}},Du=class extends Ht{constructor(t,e,i,n=1){super(t,e,i),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=n}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){let t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}},Gh=new At,Sw=new At,yf=[],Mw=new ci,RD=new At,Sd=new xi,Md=new vr,Ob=class extends xi{constructor(t,e,i){super(t,e),this.isInstancedMesh=!0,this.instanceMatrix=new Du(new Float32Array(16*i),16),this.instanceColor=null,this.morphTexture=null,this.count=i,this.boundingBox=null,this.boundingSphere=null;for(let n=0;n<i;n++)this.setMatrixAt(n,RD)}computeBoundingBox(){let t=this.geometry,e=this.count;this.boundingBox===null&&(this.boundingBox=new ci),t.boundingBox===null&&t.computeBoundingBox(),this.boundingBox.makeEmpty();for(let i=0;i<e;i++)this.getMatrixAt(i,Gh),Mw.copy(t.boundingBox).applyMatrix4(Gh),this.boundingBox.union(Mw)}computeBoundingSphere(){let t=this.geometry,e=this.count;this.boundingSphere===null&&(this.boundingSphere=new vr),t.boundingSphere===null&&t.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let i=0;i<e;i++)this.getMatrixAt(i,Gh),Md.copy(t.boundingSphere).applyMatrix4(Gh),this.boundingSphere.union(Md)}copy(t,e){return super.copy(t,e),this.instanceMatrix.copy(t.instanceMatrix),t.morphTexture!==null&&(this.morphTexture=t.morphTexture.clone()),t.instanceColor!==null&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone()),t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),this}getColorAt(t,e){return this.instanceColor===null?e.setRGB(1,1,1):e.fromArray(this.instanceColor.array,3*t)}getMatrixAt(t,e){return e.fromArray(this.instanceMatrix.array,16*t)}getMorphAt(t,e){let i=e.morphTargetInfluences,n=this.morphTexture.source.data.data,r=t*(i.length+1)+1;for(let s=0;s<i.length;s++)i[s]=n[r+s]}raycast(t,e){let i=this.matrixWorld,n=this.count;if(Sd.geometry=this.geometry,Sd.material=this.material,Sd.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Md.copy(this.boundingSphere),Md.applyMatrix4(i),t.ray.intersectsSphere(Md)!==!1))for(let r=0;r<n;r++){this.getMatrixAt(r,Gh),Sw.multiplyMatrices(i,Gh),Sd.matrixWorld=Sw,Sd.raycast(t,yf);for(let s=0,a=yf.length;s<a;s++){let o=yf[s];o.instanceId=r,o.object=this,e.push(o)}yf.length=0}}setColorAt(t,e){return this.instanceColor===null&&(this.instanceColor=new Du(new Float32Array(3*this.instanceMatrix.count).fill(1),3)),e.toArray(this.instanceColor.array,3*t),this}setMatrixAt(t,e){return e.toArray(this.instanceMatrix.array,16*t),this}setMorphAt(t,e){let i=e.morphTargetInfluences,n=i.length+1;this.morphTexture===null&&(this.morphTexture=new Tn(new Float32Array(n*this.count),n,this.count,Rc,$e));let r=this.morphTexture.source.data.data,s=0;for(let l=0;l<i.length;l++)s+=i[l];let a=this.geometry.morphTargetsRelative?1:1-s,o=n*t;return r[o]=a,r.set(i,o+1),this}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}},H0=new C,ID=new C,OD=new ue,kr=class{constructor(t=new C(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,i,n){return this.normal.set(t,e,i),this.constant=n,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,i){let n=H0.subVectors(i,e).cross(ID.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(n,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){let t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e,i=!0){let n=t.delta(H0),r=this.normal.dot(n);if(r===0)return this.distanceToPoint(t.start)===0?e.copy(t.start):null;let s=-(t.start.dot(this.normal)+this.constant)/r;return i===!0&&(s<0||s>1)?null:e.copy(t.start).addScaledVector(n,s)}intersectsLine(t){let e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){let i=e||OD.getNormalMatrix(t),n=this.coplanarPoint(H0).applyMatrix4(t),r=this.normal.applyMatrix3(i).normalize();return this.constant=-n.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}},xl=new vr,LD=new it(.5,.5),_f=new C,u_=class{constructor(t=new kr,e=new kr,i=new kr,n=new kr,r=new kr,s=new kr){this.planes=[t,e,i,n,r,s]}set(t,e,i,n,r,s){let a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(i),a[3].copy(n),a[4].copy(r),a[5].copy(s),this}copy(t){let e=this.planes;for(let i=0;i<6;i++)e[i].copy(t.planes[i]);return this}setFromProjectionMatrix(t,e=sa,i=!1){let n=this.planes,r=t.elements,s=r[0],a=r[1],o=r[2],l=r[3],c=r[4],h=r[5],d=r[6],u=r[7],p=r[8],f=r[9],g=r[10],m=r[11],y=r[12],v=r[13],_=r[14],b=r[15];if(n[0].setComponents(l-s,u-c,m-p,b-y).normalize(),n[1].setComponents(l+s,u+c,m+p,b+y).normalize(),n[2].setComponents(l+a,u+h,m+f,b+v).normalize(),n[3].setComponents(l-a,u-h,m-f,b-v).normalize(),i)n[4].setComponents(o,d,g,_).normalize(),n[5].setComponents(l-o,u-d,m-g,b-_).normalize();else if(n[4].setComponents(l-o,u-d,m-g,b-_).normalize(),e===sa)n[5].setComponents(l+o,u+d,m+g,b+_).normalize();else{if(e!==vd)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);n[5].setComponents(o,d,g,_).normalize()}return this}intersectsObject(t){if(t.boundingSphere!==void 0)t.boundingSphere===null&&t.computeBoundingSphere(),xl.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{let e=t.geometry;e.boundingSphere===null&&e.computeBoundingSphere(),xl.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(xl)}intersectsSprite(t){xl.center.set(0,0,0);let e=LD.distanceTo(t.center);return xl.radius=.7071067811865476+e,xl.applyMatrix4(t.matrixWorld),this.intersectsSphere(xl)}intersectsSphere(t){let e=this.planes,i=t.center,n=-t.radius;for(let r=0;r<6;r++)if(e[r].distanceToPoint(i)<n)return!1;return!0}intersectsBox(t){let e=this.planes;for(let i=0;i<6;i++){let n=e[i];if(_f.x=n.normal.x>0?t.max.x:t.min.x,_f.y=n.normal.y>0?t.max.y:t.min.y,_f.z=n.normal.z>0?t.max.z:t.min.z,n.distanceToPoint(_f)<0)return!1}return!0}containsPoint(t){let e=this.planes;for(let i=0;i<6;i++)if(e[i].distanceToPoint(t)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},zo=class extends jh{constructor(t){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Jt(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.fog=t.fog,this}},Xm=new C,$m=new C,Ew=new At,Ed=new $o,bf=new vr,Jy=new C,iE=new C,_m=class extends _i{constructor(t=new Gt,e=new zo){super(),this.isLine=!0,this.type="Line",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}computeLineDistances(){let t=this.geometry;if(t.index===null){let e=t.attributes.position,i=[0];for(let n=1,r=e.count;n<r;n++)Xm.fromBufferAttribute(e,n-1),$m.fromBufferAttribute(e,n),i[n]=i[n-1],i[n]+=Xm.distanceTo($m);t.setAttribute("lineDistance",new Nt(i,1))}else ce("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(t,e){let i=this.geometry,n=this.matrixWorld,r=t.params.Line.threshold,s=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),bf.copy(i.boundingSphere),bf.applyMatrix4(n),bf.radius+=r,t.ray.intersectsSphere(bf)===!1)return;Ew.copy(n).invert(),Ed.copy(t.ray).applyMatrix4(Ew);let a=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,l=this.isLineSegments?2:1,c=i.index,h=i.attributes.position;if(c!==null){let d=Math.max(0,s.start),u=Math.min(c.count,s.start+s.count);for(let p=d,f=u-1;p<f;p+=l){let g=c.getX(p),m=c.getX(p+1),y=_0(this,t,Ed,o,g,m,p);y&&e.push(y)}if(this.isLineLoop){let p=c.getX(u-1),f=c.getX(d),g=_0(this,t,Ed,o,p,f,u-1);g&&e.push(g)}}else{let d=Math.max(0,s.start),u=Math.min(h.count,s.start+s.count);for(let p=d,f=u-1;p<f;p+=l){let g=_0(this,t,Ed,o,p,p+1,p);g&&e.push(g)}if(this.isLineLoop){let p=_0(this,t,Ed,o,u-1,d,u-1);p&&e.push(p)}}}updateMorphTargets(){let t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){let i=t[e[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let n=0,r=i.length;n<r;n++){let s=i[n].name||String(n);this.morphTargetInfluences.push(0),this.morphTargetDictionary[s]=n}}}}},Aw=new C,Tw=new C,gu=class extends _m{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let t=this.geometry;if(t.index===null){let e=t.attributes.position,i=[];for(let n=0,r=e.count;n<r;n+=2)Aw.fromBufferAttribute(e,n),Tw.fromBufferAttribute(e,n+1),i[n]=n===0?0:i[n-1],i[n+1]=i[n]+Aw.distanceTo(Tw);t.setAttribute("lineDistance",new Nt(i,1))}else ce("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}},dz=class extends zi{constructor(t,e,i,n,r=de,s=de,a,o,l){super(t,e,i,n,r,s,a,o,l),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;let c=this;"requestVideoFrameCallback"in t&&(this._requestVideoFrameCallbackId=t.requestVideoFrameCallback(function h(){c.needsUpdate=!0,c._requestVideoFrameCallbackId=t.requestVideoFrameCallback(h)}))}clone(){return new this.constructor(this.image).copy(this)}update(){let t=this.image;"requestVideoFrameCallback"in t==0&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}},p_=class extends zi{constructor(t=[],e=Dc,i,n,r,s,a,o,l,c){super(t,e,i,n,r,s,a,o,l,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}},uz=class extends zi{constructor(t,e,i,n,r,s,a,o,l){super(t,e,i,n,r,s,a,o,l),this.isCanvasTexture=!0,this.needsUpdate=!0}},ma=class extends zi{constructor(t,e,i=js,n,r,s,a=De,o=De,l,c=Xo,h=1){if(c!==Xo&&c!==Gl)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super({width:t,height:e,depth:h},n,r,s,a,o,c,i,l),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.source=new C0(Object.assign({},t.image)),this.compareFunction=t.compareFunction,this}toJSON(t){let e=super.toJSON(t);return this.compareFunction!==null&&(e.compareFunction=this.compareFunction),e}},pz=class extends ma{constructor(t,e=js,i=Dc,n,r,s=De,a=De,o,l=Xo){let c={width:t,height:t,depth:1},h=[c,c,c,c,c,c];super(t,t,e,i,n,r,s,a,o,l),this.image=h,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(t){this.image=t}},ga=class extends Gt{constructor(t=1,e=1,i=1,n=1,r=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:n,heightSegments:r,depthSegments:s};let a=this;n=Math.floor(n),r=Math.floor(r),s=Math.floor(s);let o=[],l=[],c=[],h=[],d=0,u=0;function p(f,g,m,y,v,_,b,x,w,S,A){let E=_/w,P=b/S,T=_/2,R=b/2,L=x/2,D=w+1,U=S+1,V=0,k=0,Y=new C;for(let $=0;$<U;$++){let nt=$*P-R;for(let Q=0;Q<D;Q++){let rt=Q*E-T;Y[f]=rt*y,Y[g]=nt*v,Y[m]=L,l.push(Y.x,Y.y,Y.z),Y[f]=0,Y[g]=0,Y[m]=x>0?1:-1,c.push(Y.x,Y.y,Y.z),h.push(Q/w),h.push(1-$/S),V+=1}}for(let $=0;$<S;$++)for(let nt=0;nt<w;nt++){let Q=d+nt+D*$,rt=d+nt+D*($+1),gt=d+(nt+1)+D*($+1),at=d+(nt+1)+D*$;o.push(Q,rt,at),o.push(rt,gt,at),k+=6}a.addGroup(u,k,A),u+=k,d+=V}p("z","y","x",-1,-1,i,e,t,s,r,0),p("z","y","x",1,-1,i,e,-t,s,r,1),p("x","z","y",1,1,t,i,e,n,s,2),p("x","z","y",1,-1,t,i,-e,n,s,3),p("x","y","z",1,-1,t,e,i,n,r,4),p("x","y","z",-1,-1,t,e,-i,n,r,5),this.setIndex(o),this.setAttribute("position",new Nt(l,3)),this.setAttribute("normal",new Nt(c,3)),this.setAttribute("uv",new Nt(h,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new ga(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}},Ym=class extends Gt{constructor(t=1,e=1,i=1,n=32,r=1,s=!1,a=0,o=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:i,radialSegments:n,heightSegments:r,openEnded:s,thetaStart:a,thetaLength:o};let l=this;n=Math.floor(n),r=Math.floor(r);let c=[],h=[],d=[],u=[],p=0,f=[],g=i/2,m=0;function y(v){let _=p,b=new it,x=new C,w=0,S=v===!0?t:e,A=v===!0?1:-1;for(let P=1;P<=n;P++)h.push(0,g*A,0),d.push(0,A,0),u.push(.5,.5),p++;let E=p;for(let P=0;P<=n;P++){let T=P/n*o+a,R=Math.cos(T),L=Math.sin(T);x.x=S*L,x.y=g*A,x.z=S*R,h.push(x.x,x.y,x.z),d.push(0,A,0),b.x=.5*R+.5,b.y=.5*L*A+.5,u.push(b.x,b.y),p++}for(let P=0;P<n;P++){let T=_+P,R=E+P;v===!0?c.push(R,R+1,T):c.push(R+1,R,T),w+=3}l.addGroup(m,w,v===!0?1:2),m+=w}(function(){let v=new C,_=new C,b=0,x=(e-t)/i;for(let w=0;w<=r;w++){let S=[],A=w/r,E=A*(e-t)+t;for(let P=0;P<=n;P++){let T=P/n,R=T*o+a,L=Math.sin(R),D=Math.cos(R);_.x=E*L,_.y=-A*i+g,_.z=E*D,h.push(_.x,_.y,_.z),v.set(L,x,D).normalize(),d.push(v.x,v.y,v.z),u.push(T,1-A),S.push(p++)}f.push(S)}for(let w=0;w<n;w++)for(let S=0;S<r;S++){let A=f[S][w],E=f[S+1][w],P=f[S+1][w+1],T=f[S][w+1];(t>0||S!==0)&&(c.push(A,E,T),b+=3),(e>0||S!==r-1)&&(c.push(E,P,T),b+=3)}l.addGroup(m,b,0),m+=b})(),s===!1&&(t>0&&y(!0),e>0&&y(!1)),this.setIndex(c),this.setAttribute("position",new Nt(h,3)),this.setAttribute("normal",new Nt(d,3)),this.setAttribute("uv",new Nt(u,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Ym(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}},f_=class extends Ym{constructor(t=1,e=1,i=32,n=1,r=!1,s=0,a=2*Math.PI){super(0,t,e,i,n,r,s,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:n,openEnded:r,thetaStart:s,thetaLength:a}}static fromJSON(t){return new f_(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}},W0=class extends Gt{constructor(t=[],e=[],i=1,n=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:i,detail:n};let r=[],s=[];function a(u,p,f,g){let m=g+1,y=[];for(let v=0;v<=m;v++){y[v]=[];let _=u.clone().lerp(f,v/m),b=p.clone().lerp(f,v/m),x=m-v;for(let w=0;w<=x;w++)y[v][w]=w===0&&v===m?_:_.clone().lerp(b,w/x)}for(let v=0;v<m;v++)for(let _=0;_<2*(m-v)-1;_++){let b=Math.floor(_/2);_%2==0?(o(y[v][b+1]),o(y[v+1][b]),o(y[v][b])):(o(y[v][b+1]),o(y[v+1][b+1]),o(y[v+1][b]))}}function o(u){r.push(u.x,u.y,u.z)}function l(u,p){let f=3*u;p.x=t[f+0],p.y=t[f+1],p.z=t[f+2]}function c(u,p,f,g){g<0&&u.x===1&&(s[p]=u.x-1),f.x===0&&f.z===0&&(s[p]=g/2/Math.PI+.5)}function h(u){return Math.atan2(u.z,-u.x)}function d(u){return Math.atan2(-u.y,Math.sqrt(u.x*u.x+u.z*u.z))}(function(u){let p=new C,f=new C,g=new C;for(let m=0;m<e.length;m+=3)l(e[m+0],p),l(e[m+1],f),l(e[m+2],g),a(p,f,g,u)})(n),function(u){let p=new C;for(let f=0;f<r.length;f+=3)p.x=r[f+0],p.y=r[f+1],p.z=r[f+2],p.normalize().multiplyScalar(u),r[f+0]=p.x,r[f+1]=p.y,r[f+2]=p.z}(i),function(){let u=new C;for(let p=0;p<r.length;p+=3){u.x=r[p+0],u.y=r[p+1],u.z=r[p+2];let f=h(u)/2/Math.PI+.5,g=d(u)/Math.PI+.5;s.push(f,1-g)}(function(){let p=new C,f=new C,g=new C,m=new C,y=new it,v=new it,_=new it;for(let b=0,x=0;b<r.length;b+=9,x+=6){p.set(r[b+0],r[b+1],r[b+2]),f.set(r[b+3],r[b+4],r[b+5]),g.set(r[b+6],r[b+7],r[b+8]),y.set(s[x+0],s[x+1]),v.set(s[x+2],s[x+3]),_.set(s[x+4],s[x+5]),m.copy(p).add(f).add(g).divideScalar(3);let w=h(m);c(y,x+0,p,w),c(v,x+2,f,w),c(_,x+4,g,w)}})(),function(){for(let p=0;p<s.length;p+=6){let f=s[p+0],g=s[p+2],m=s[p+4],y=Math.max(f,g,m),v=Math.min(f,g,m);y>.9&&v<.1&&(f<.2&&(s[p+0]+=1),g<.2&&(s[p+2]+=1),m<.2&&(s[p+4]+=1))}}()}(),this.setAttribute("position",new Nt(r,3)),this.setAttribute("normal",new Nt(r.slice(),3)),this.setAttribute("uv",new Nt(s,2)),n===0?this.computeVertexNormals():this.normalizeNormals()}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new W0(t.vertices,t.indices,t.radius,t.detail)}},nE=class extends W0{constructor(t=1,e=0){let i=(1+Math.sqrt(5))/2,n=1/i;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-n,-i,0,-n,i,0,n,-i,0,n,i,-n,-i,0,-n,i,0,n,-i,0,n,i,0,-i,0,-n,i,0,-n,-i,0,n,i,0,n],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new nE(t.radius,t.detail)}},Ys=class{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){ce("Curve: .getPoint() not implemented.")}getPointAt(t,e){let i=this.getUtoTmapping(t);return this.getPoint(i,e)}getPoints(t=5){let e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return e}getSpacedPoints(t=5){let e=[];for(let i=0;i<=t;i++)e.push(this.getPointAt(i/t));return e}getLength(){let t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let e,i=[],n=this.getPoint(0),r=0;i.push(0);for(let s=1;s<=t;s++)e=this.getPoint(s/t),r+=e.distanceTo(n),i.push(r),n=e;return this.cacheArcLengths=i,i}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e=null){let i,n=this.getLengths(),r=0,s=n.length;i=e||t*n[s-1];let a,o=0,l=s-1;for(;o<=l;)if(r=Math.floor(o+(l-o)/2),a=n[r]-i,a<0)o=r+1;else{if(!(a>0)){l=r;break}l=r-1}if(r=l,n[r]===i)return r/(s-1);let c=n[r];return(r+(i-c)/(n[r+1]-c))/(s-1)}getTangent(t,e){let i=t-1e-4,n=t+1e-4;i<0&&(i=0),n>1&&(n=1);let r=this.getPoint(i),s=this.getPoint(n),a=e||(r.isVector2?new it:new C);return a.copy(s).sub(r).normalize(),a}getTangentAt(t,e){let i=this.getUtoTmapping(t);return this.getTangent(i,e)}computeFrenetFrames(t,e=!1){let i=new C,n=[],r=[],s=[],a=new C,o=new At;for(let u=0;u<=t;u++){let p=u/t;n[u]=this.getTangentAt(p,new C)}r[0]=new C,s[0]=new C;let l=Number.MAX_VALUE,c=Math.abs(n[0].x),h=Math.abs(n[0].y),d=Math.abs(n[0].z);c<=l&&(l=c,i.set(1,0,0)),h<=l&&(l=h,i.set(0,1,0)),d<=l&&i.set(0,0,1),a.crossVectors(n[0],i).normalize(),r[0].crossVectors(n[0],a),s[0].crossVectors(n[0],r[0]);for(let u=1;u<=t;u++){if(r[u]=r[u-1].clone(),s[u]=s[u-1].clone(),a.crossVectors(n[u-1],n[u]),a.length()>Number.EPSILON){a.normalize();let p=Math.acos(ge(n[u-1].dot(n[u]),-1,1));r[u].applyMatrix4(o.makeRotationAxis(a,p))}s[u].crossVectors(n[u],r[u])}if(e===!0){let u=Math.acos(ge(r[0].dot(r[t]),-1,1));u/=t,n[0].dot(a.crossVectors(r[0],r[t]))>0&&(u=-u);for(let p=1;p<=t;p++)r[p].applyMatrix4(o.makeRotationAxis(n[p],u*p)),s[p].crossVectors(n[p],r[p])}return{tangents:n,normals:r,binormals:s}}clone(){return new this.constructor().copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){let t={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}},bm=class extends Ys{constructor(t=0,e=0,i=1,n=1,r=0,s=2*Math.PI,a=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=i,this.yRadius=n,this.aStartAngle=r,this.aEndAngle=s,this.aClockwise=a,this.aRotation=o}getPoint(t,e=new it){let i=e,n=2*Math.PI,r=this.aEndAngle-this.aStartAngle,s=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=n;for(;r>n;)r-=n;r<Number.EPSILON&&(r=s?0:n),this.aClockwise===!0&&!s&&(r===n?r=-n:r-=n);let a=this.aStartAngle+t*r,o=this.aX+this.xRadius*Math.cos(a),l=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){let c=Math.cos(this.aRotation),h=Math.sin(this.aRotation),d=o-this.aX,u=l-this.aY;o=d*c-u*h+this.aX,l=d*h+u*c+this.aY}return i.set(o,l)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){let t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}},BD=class extends bm{constructor(t,e,i,n,r,s){super(t,e,i,i,n,r,s),this.isArcCurve=!0,this.type="ArcCurve"}},Cw=new C,Pw=new C,q0=new nw,X0=new nw,$0=new nw,UD=class extends Ys{constructor(t=[],e=!1,i="centripetal",n=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=i,this.tension=n}getPoint(t,e=new C){let i,n,r=e,s=this.points,a=s.length,o=(a-(this.closed?0:1))*t,l=Math.floor(o),c=o-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/a)+1)*a:c===0&&l===a-1&&(l=a-2,c=1),this.closed||l>0?i=s[(l-1)%a]:(Pw.subVectors(s[0],s[1]).add(s[0]),i=Pw);let h=s[l%a],d=s[(l+1)%a];if(this.closed||l+2<a?n=s[(l+2)%a]:(Cw.subVectors(s[a-1],s[a-2]).add(s[a-1]),n=Cw),this.curveType==="centripetal"||this.curveType==="chordal"){let u=this.curveType==="chordal"?.5:.25,p=Math.pow(i.distanceToSquared(h),u),f=Math.pow(h.distanceToSquared(d),u),g=Math.pow(d.distanceToSquared(n),u);f<1e-4&&(f=1),p<1e-4&&(p=f),g<1e-4&&(g=f),q0.initNonuniformCatmullRom(i.x,h.x,d.x,n.x,p,f,g),X0.initNonuniformCatmullRom(i.y,h.y,d.y,n.y,p,f,g),$0.initNonuniformCatmullRom(i.z,h.z,d.z,n.z,p,f,g)}else this.curveType==="catmullrom"&&(q0.initCatmullRom(i.x,h.x,d.x,n.x,this.tension),X0.initCatmullRom(i.y,h.y,d.y,n.y,this.tension),$0.initCatmullRom(i.z,h.z,d.z,n.z,this.tension));return r.set(q0.calc(c),X0.calc(c),$0.calc(c)),r}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){let n=t.points[e];this.points.push(n.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){let t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){let n=this.points[e];t.points.push(n.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){let n=t.points[e];this.points.push(new C().fromArray(n))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}},zs=class extends Ys{constructor(t=new it,e=new it,i=new it,n=new it){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=i,this.v3=n}getPoint(t,e=new it){let i=e,n=this.v0,r=this.v1,s=this.v2,a=this.v3;return i.set(rf(t,n.x,r.x,s.x,a.x),rf(t,n.y,r.y,s.y,a.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}},Zm=class extends Ys{constructor(t=new C,e=new C,i=new C,n=new C){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=i,this.v3=n}getPoint(t,e=new C){let i=e,n=this.v0,r=this.v1,s=this.v2,a=this.v3;return i.set(rf(t,n.x,r.x,s.x,a.x),rf(t,n.y,r.y,s.y,a.y),rf(t,n.z,r.z,s.z,a.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}},ps=class extends Ys{constructor(t=new it,e=new it){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new it){let i=e;return t===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new it){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},rE=class extends Ys{constructor(t=new C,e=new C){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new C){let i=e;return t===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new C){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},Go=class extends Ys{constructor(t=new it,e=new it,i=new it){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new it){let i=e,n=this.v0,r=this.v1,s=this.v2;return i.set(nf(t,n.x,r.x,s.x),nf(t,n.y,r.y,s.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},zD=class extends Ys{constructor(t=new C,e=new C,i=new C){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new C){let i=e,n=this.v0,r=this.v1,s=this.v2;return i.set(nf(t,n.x,r.x,s.x),nf(t,n.y,r.y,s.y),nf(t,n.z,r.z,s.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},t1=class extends Ys{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new it){let i=e,n=this.points,r=(n.length-1)*t,s=Math.floor(r),a=r-s,o=n[s===0?s:s-1],l=n[s],c=n[s>n.length-2?n.length-1:s+1],h=n[s>n.length-3?n.length-1:s+2];return i.set(aD(a,o.x,l.x,c.x,h.x),aD(a,o.y,l.y,c.y,h.y)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){let n=t.points[e];this.points.push(n.clone())}return this}toJSON(){let t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){let n=this.points[e];t.points.push(n.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){let n=t.points[e];this.points.push(new it().fromArray(n))}return this}},Dw=Object.freeze({__proto__:null,ArcCurve:BD,CatmullRomCurve3:UD,CubicBezierCurve:zs,CubicBezierCurve3:Zm,EllipseCurve:bm,LineCurve:ps,LineCurve3:rE,QuadraticBezierCurve:Go,QuadraticBezierCurve3:zD,SplineCurve:t1}),sE=class extends Ys{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){let t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);if(!t.equals(e)){let i=t.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new Dw[i](e,t))}return this}getPoint(t,e){let i=t*this.getLength(),n=this.getCurveLengths(),r=0;for(;r<n.length;){if(n[r]>=i){let s=n[r]-i,a=this.curves[r],o=a.getLength(),l=o===0?0:1-s/o;return a.getPointAt(l,e)}r++}return null}getLength(){let t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let t=[],e=0;for(let i=0,n=this.curves.length;i<n;i++)e+=this.curves[i].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){let e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){let e,i=[];for(let n=0,r=this.curves;n<r.length;n++){let s=r[n],a=s.isEllipseCurve?2*t:s.isLineCurve||s.isLineCurve3?1:s.isSplineCurve?t*s.points.length:t,o=s.getPoints(a);for(let l=0;l<o.length;l++){let c=o[l];e&&e.equals(c)||(i.push(c),e=c)}}return this.autoClose&&i.length>1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}copy(t){super.copy(t),this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){let n=t.curves[e];this.curves.push(n.clone())}return this.autoClose=t.autoClose,this}toJSON(){let t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,i=this.curves.length;e<i;e++){let n=this.curves[e];t.curves.push(n.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){let n=t.curves[e];this.curves.push(new Dw[n.type]().fromJSON(n))}return this}},Km=class extends sE{constructor(t){super(),this.type="Path",this.currentPoint=new it,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,i=t.length;e<i;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){let i=new ps(this.currentPoint.clone(),new it(t,e));return this.curves.push(i),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,i,n){let r=new Go(this.currentPoint.clone(),new it(t,e),new it(i,n));return this.curves.push(r),this.currentPoint.set(i,n),this}bezierCurveTo(t,e,i,n,r,s){let a=new zs(this.currentPoint.clone(),new it(t,e),new it(i,n),new it(r,s));return this.curves.push(a),this.currentPoint.set(r,s),this}splineThru(t){let e=[this.currentPoint.clone()].concat(t),i=new t1(e);return this.curves.push(i),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,i,n,r,s){let a=this.currentPoint.x,o=this.currentPoint.y;return this.absarc(t+a,e+o,i,n,r,s),this}absarc(t,e,i,n,r,s){return this.absellipse(t,e,i,i,n,r,s),this}ellipse(t,e,i,n,r,s,a,o){let l=this.currentPoint.x,c=this.currentPoint.y;return this.absellipse(t+l,e+c,i,n,r,s,a,o),this}absellipse(t,e,i,n,r,s,a,o){let l=new bm(t,e,i,n,r,s,a,o);if(this.curves.length>0){let h=l.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(l);let c=l.getPoint(1);return this.currentPoint.copy(c),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){let t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}},xg=class extends Km{constructor(t){super(t),this.uuid=Es(),this.type="Shape",this.holes=[]}getPointsHoles(t){let e=[];for(let i=0,n=this.holes.length;i<n;i++)e[i]=this.holes[i].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){let n=t.holes[e];this.holes.push(n.clone())}return this}toJSON(){let t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,i=this.holes.length;e<i;e++){let n=this.holes[e];t.holes.push(n.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){let n=t.holes[e];this.holes.push(new Km().fromJSON(n))}return this}},FD=class{static triangulate(t,e,i=2){return function(n,r,s=2){let a,o,l,c=r&&r.length,h=c?r[0]*s:n.length,d=oD(n,0,h,s,!0),u=[];if(!d||d.next===d.prev)return u;if(c&&(d=function(p,f,g,m){let y=[];for(let v=0,_=f.length;v<_;v++){let b=oD(p,f[v]*m,v<_-1?f[v+1]*m:p.length,m,!1);b===b.next&&(b.steiner=!0),y.push(mW(b))}y.sort(uW);for(let v=0;v<y.length;v++)g=pW(y[v],g);return g}(n,r,d,s)),n.length>80*s){a=n[0],o=n[1];let p=a,f=o;for(let g=s;g<h;g+=s){let m=n[g],y=n[g+1];m<a&&(a=m),y<o&&(o=y),m>p&&(p=m),y>f&&(f=y)}l=Math.max(p-a,f-o),l=l!==0?32767/l:0}return gg(d,u,s,a,o,l,0),u}(t,e,i)}},aE=class{static area(t){let e=t.length,i=0;for(let n=e-1,r=0;r<e;n=r++)i+=t[n].x*t[r].y-t[r].x*t[n].y;return .5*i}static isClockWise(t){return aE.area(t)<0}static triangulateShape(t,e){let i=[],n=[],r=[];hD(t),cD(i,t);let s=t.length;e.forEach(hD);for(let o=0;o<e.length;o++)n.push(s),s+=e[o].length,cD(i,e[o]);let a=FD.triangulate(i,n);for(let o=0;o<a.length;o+=3)r.push(a.slice(o,o+3));return r}},oE=class extends W0{constructor(t=1,e=0){let i=(1+Math.sqrt(5))/2;super([-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],t,e),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new oE(t.radius,t.detail)}},lE=class extends Gt{constructor(t=[new it(0,-.5),new it(.5,0),new it(0,.5)],e=12,i=0,n=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:i,phiLength:n},e=Math.floor(e),n=ge(n,0,2*Math.PI);let r=[],s=[],a=[],o=[],l=[],c=1/e,h=new C,d=new it,u=new C,p=new C,f=new C,g=0,m=0;for(let y=0;y<=t.length-1;y++)switch(y){case 0:g=t[y+1].x-t[y].x,m=t[y+1].y-t[y].y,u.x=1*m,u.y=-g,u.z=0*m,f.copy(u),u.normalize(),o.push(u.x,u.y,u.z);break;case t.length-1:o.push(f.x,f.y,f.z);break;default:g=t[y+1].x-t[y].x,m=t[y+1].y-t[y].y,u.x=1*m,u.y=-g,u.z=0*m,p.copy(u),u.x+=f.x,u.y+=f.y,u.z+=f.z,u.normalize(),o.push(u.x,u.y,u.z),f.copy(p)}for(let y=0;y<=e;y++){let v=i+y*c*n,_=Math.sin(v),b=Math.cos(v);for(let x=0;x<=t.length-1;x++){h.x=t[x].x*_,h.y=t[x].y,h.z=t[x].x*b,s.push(h.x,h.y,h.z),d.x=y/e,d.y=x/(t.length-1),a.push(d.x,d.y);let w=o[3*x+0]*_,S=o[3*x+1],A=o[3*x+0]*b;l.push(w,S,A)}}for(let y=0;y<e;y++)for(let v=0;v<t.length-1;v++){let _=v+y*t.length,b=_,x=_+t.length,w=_+t.length+1,S=_+1;r.push(b,x,S),r.push(w,S,x)}this.setIndex(r),this.setAttribute("position",new Nt(s,3)),this.setAttribute("uv",new Nt(a,2)),this.setAttribute("normal",new Nt(l,3))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new lE(t.points,t.segments,t.phiStart,t.phiLength)}},lo=class extends Gt{constructor(t=1,e=1,i=1,n=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:n};let r=t/2,s=e/2,a=Math.floor(i),o=Math.floor(n),l=a+1,c=o+1,h=t/a,d=e/o,u=[],p=[],f=[],g=[];for(let m=0;m<c;m++){let y=m*d-s;for(let v=0;v<l;v++){let _=v*h-r;p.push(_,-y,0),f.push(0,0,1),g.push(v/a),g.push(1-m/o)}}for(let m=0;m<o;m++)for(let y=0;y<a;y++){let v=y+l*m,_=y+l*(m+1),b=y+1+l*(m+1),x=y+1+l*m;u.push(v,_,x),u.push(_,b,x)}this.setIndex(u),this.setAttribute("position",new Nt(p,3)),this.setAttribute("normal",new Nt(f,3)),this.setAttribute("uv",new Nt(g,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new lo(t.width,t.height,t.widthSegments,t.heightSegments)}},rh=class extends Gt{constructor(t=1,e=32,i=16,n=0,r=2*Math.PI,s=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:n,phiLength:r,thetaStart:s,thetaLength:a},e=Math.max(3,Math.floor(e)),i=Math.max(2,Math.floor(i));let o=Math.min(s+a,Math.PI),l=0,c=[],h=new C,d=new C,u=[],p=[],f=[],g=[];for(let m=0;m<=i;m++){let y=[],v=m/i,_=s+v*a,b=t*Math.cos(_),x=Math.sqrt(t*t-b*b),w=0;m===0&&s===0?w=.5/e:m===i&&o===Math.PI&&(w=-.5/e);for(let S=0;S<=e;S++){let A=S/e,E=n+A*r;h.x=-x*Math.cos(E),h.y=b,h.z=x*Math.sin(E),p.push(h.x,h.y,h.z),d.copy(h).normalize(),f.push(d.x,d.y,d.z),g.push(A+w,1-v),y.push(l++)}c.push(y)}for(let m=0;m<i;m++)for(let y=0;y<e;y++){let v=c[m][y+1],_=c[m][y],b=c[m+1][y],x=c[m+1][y+1];(m!==0||s>0)&&u.push(v,_,x),(m!==i-1||o<Math.PI)&&u.push(_,b,x)}this.setIndex(u),this.setAttribute("position",new Nt(p,3)),this.setAttribute("normal",new Nt(f,3)),this.setAttribute("uv",new Nt(g,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new rh(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}},m_=class extends Gt{constructor(t=1,e=.4,i=12,n=48,r=2*Math.PI,s=0,a=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:i,tubularSegments:n,arc:r,thetaStart:s,thetaLength:a},i=Math.floor(i),n=Math.floor(n);let o=[],l=[],c=[],h=[],d=new C,u=new C,p=new C;for(let f=0;f<=i;f++){let g=s+f/i*a;for(let m=0;m<=n;m++){let y=m/n*r;u.x=(t+e*Math.cos(g))*Math.cos(y),u.y=(t+e*Math.cos(g))*Math.sin(y),u.z=e*Math.sin(g),l.push(u.x,u.y,u.z),d.x=t*Math.cos(y),d.y=t*Math.sin(y),p.subVectors(u,d).normalize(),c.push(p.x,p.y,p.z),h.push(m/n),h.push(f/i)}}for(let f=1;f<=i;f++)for(let g=1;g<=n;g++){let m=(n+1)*f+g-1,y=(n+1)*(f-1)+g-1,v=(n+1)*(f-1)+g,_=(n+1)*f+g;o.push(m,y,_),o.push(y,v,_)}this.setIndex(o),this.setAttribute("position",new Nt(l,3)),this.setAttribute("normal",new Nt(c,3)),this.setAttribute("uv",new Nt(h,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new m_(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}},hE=class extends Gt{constructor(t=1,e=.4,i=64,n=8,r=2,s=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:i,radialSegments:n,p:r,q:s},i=Math.floor(i),n=Math.floor(n);let a=[],o=[],l=[],c=[],h=new C,d=new C,u=new C,p=new C,f=new C,g=new C,m=new C;for(let v=0;v<=i;++v){let _=v/i*r*Math.PI*2;y(_,r,s,t,u),y(_+.01,r,s,t,p),g.subVectors(p,u),m.addVectors(p,u),f.crossVectors(g,m),m.crossVectors(f,g),f.normalize(),m.normalize();for(let b=0;b<=n;++b){let x=b/n*Math.PI*2,w=-e*Math.cos(x),S=e*Math.sin(x);h.x=u.x+(w*m.x+S*f.x),h.y=u.y+(w*m.y+S*f.y),h.z=u.z+(w*m.z+S*f.z),o.push(h.x,h.y,h.z),d.subVectors(h,u).normalize(),l.push(d.x,d.y,d.z),c.push(v/i),c.push(b/n)}}for(let v=1;v<=i;v++)for(let _=1;_<=n;_++){let b=(n+1)*(v-1)+(_-1),x=(n+1)*v+(_-1),w=(n+1)*v+_,S=(n+1)*(v-1)+_;a.push(b,x,S),a.push(x,w,S)}function y(v,_,b,x,w){let S=Math.cos(v),A=Math.sin(v),E=b/_*v,P=Math.cos(E);w.x=x*(2+P)*.5*S,w.y=x*(2+P)*A*.5,w.z=x*Math.sin(E)*.5}this.setIndex(a),this.setAttribute("position",new Nt(o,3)),this.setAttribute("normal",new Nt(l,3)),this.setAttribute("uv",new Nt(c,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new hE(t.radius,t.tube,t.tubularSegments,t.radialSegments,t.p,t.q)}},fz=class extends jh{constructor(t){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Jt(0),this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.fog=t.fog,this}},Wc={clone:sp,merge:Fr},Xe=class extends jh{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=`void main() {
|
|
37
37
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
38
38
|
}`,this.fragmentShader=`void main() {
|
|
@@ -4159,14 +4159,14 @@ void main() {
|
|
|
4159
4159
|
}
|
|
4160
4160
|
post({ kind: 'ready' });
|
|
4161
4161
|
}, 250);
|
|
4162
|
-
})();`}),aF=F(()=>{lC=class{constructor(t,e,i){this.deps=t,this.onConsole=e,this.onEvent=i,this.disposed=!1,this.eventUnsubs=new Map,this.variablePollHandle=null,this.lastVariables=null}dispose(){this.disposed=!0;for(let t of this.eventUnsubs.values())t();this.eventUnsubs.clear(),this.stopVariablePolling()}execute(t,e){let i=this.deps;switch(t){case"setVariable":{let n=i.setVariable(String(e[0]),e[1]);return n.warning&&this.onConsole("warn",n.warning),n.ok}case"setVariables":{let n=e[0]??{},r=!0;for(let[s,a]of Object.entries(n)){let o=i.setVariable(s,a);o.warning&&this.onConsole("warn",o.warning),r=r&&o.ok}return r}case"getVariable":return i.getVariable(String(e[0]));case"getVariables":return i.getVariables();case"getAllObjects":return i.getAllObjects();case"findObjectByName":case"findObjectById":return i.findObject(String(e[0]));case"getGeometry":{let n=i.getGeometry(String(e[0]),e[1]??{});return n.warning&&this.onConsole("warn",n.warning),n.data}case"updateObject":return i.updateObject(String(e[0]),e[1]??{});case"createObject":return i.createObject(String(e[0]),e[1]??{});case"createCustomMaterial":if(i.createCustomMaterial===void 0)throw new Error("createCustomMaterial: not available on this surface \u2014 custom three.js/TSL materials need the inline HTML-content mode (editor Preview/Play and web exports).");return i.createCustomMaterial(e[0]);case"setMaterial":if(i.setMaterial===void 0)throw new Error("setMaterial: not available on this surface \u2014 custom three.js/TSL materials need the inline HTML-content mode (editor Preview/Play and web exports).");return i.setMaterial(String(e[0]),e[1]);case"cloneObject":return i.cloneObject(String(e[0]),e[1]??{});case"removeObject":return i.removeObject(String(e[0]));case"spawnObject":{let n=i.spawnObject(String(e[0]),e[1]??{});return n.warning&&this.onConsole("warn",n.warning),n.object}case"destroyObject":return i.destroyObject(String(e[0]));case"setInstanceTransforms":{let n=e[1]===null||e[1]===void 0?null:e[1],r=i.setInstanceTransforms(String(e[0]),n);return r<0&&this.onConsole("warn",`spline.setInstanceTransforms: "${String(e[0])}" has no cloner \u2014 make the object a cloner first (its copies are what this drives).`),r}case"emitEvent":case"emitEventReverse":{let n=i.emitEvent(String(e[0]),String(e[1]),t==="emitEventReverse");return n.warning&&this.onConsole("warn",n.warning),n.ok}case"requestRender":return i.requestRender(),!0;case"listenEvent":{let n=String(e[0]);return n==="variableChange"?this.startVariablePolling():this.eventUnsubs.has(n)||this.eventUnsubs.set(n,i.addSplineEventListener(n,r=>{this.onEvent(n,r)})),!0}case"unlistenEvent":{let n=String(e[0]);return n==="variableChange"?this.stopVariablePolling():(this.eventUnsubs.get(n)?.(),this.eventUnsubs.delete(n)),!0}default:throw new Error(`Unknown spline bridge method: ${t}`)}}startVariablePolling(){this.variablePollHandle===null&&(this.lastVariables=this.deps.getVariables(),this.variablePollHandle=window.setInterval(()=>{if(this.disposed)return;let t=this.deps.getVariables(),e=function(i,n){let r=[];for(let s of Object.keys(n))i[s]!==n[s]&&r.push({name:s,value:n[s]});return r}(this.lastVariables??{},t);this.lastVariables=t;for(let i of e)this.onEvent("variableChange",i)},100))}stopVariablePolling(){this.variablePollHandle!==null&&(window.clearInterval(this.variablePollHandle),this.variablePollHandle=null),this.lastVariables=null}}});function tX(t,e,i,n){return[t[0]*e+t[4]*i+t[8]*n+t[12],t[1]*e+t[5]*i+t[9]*n+t[13],t[2]*e+t[6]*i+t[10]*n+t[14]]}var eX=F(()=>{}),oF,iX=F(()=>{}),nX=F(()=>{hC(),aF(),oF=class{constructor(t,e,i){this.iframe=t,this.deps=e,this.onConsole=i,this.disposed=!1,this.handshakeSeen=!1,this.handshakeTimer=null,this.onMessage=n=>{if(this.disposed||n.source!==this.iframe.contentWindow)return;let r=n.data;var s;typeof(s=r)!="object"||s===null||s[Ul]!==!0||typeof s.kind!="string"||this.handleMessage(r)},this.host=new lC(e,i,(n,r)=>{this.sendEvent(n,r)})}attach(){window.addEventListener("message",this.onMessage),this.send({[Ul]:!0,kind:"ready-ack"}),this.handshakeTimer=window.setTimeout(()=>{this.handshakeTimer=null,!this.handshakeSeen&&!this.disposed&&this.onConsole("warn","The HTML content frame has not initialized (no signal from its scripts yet) \u2014 if the page looks frozen, check for errors in its code.")},6e3)}dispose(){this.disposed=!0,window.removeEventListener("message",this.onMessage),this.host.dispose(),this.handshakeTimer!==null&&(window.clearTimeout(this.handshakeTimer),this.handshakeTimer=null)}handleMessage(t){switch(t.kind){case"ready":this.handshakeSeen=!0,this.send({[Ul]:!0,kind:"ready-ack"});break;case"console":this.onConsole(t.level,t.text);break;case"call":{let e;try{e=Promise.resolve(this.host.execute(t.method,t.args))}catch(i){e=Promise.reject(i)}e.then(i=>{this.send({[Ul]:!0,kind:"result",id:t.id,ok:!0,value:i,error:void 0})},i=>{let n=i instanceof Error?i.message:String(i);this.send({[Ul]:!0,kind:"result",id:t.id,ok:!1,value:void 0,error:n}),this.onConsole("error",n)});break}case"input":this.dispatchInput(t.event)}}send(t){this.iframe.contentWindow?.postMessage(t,"*")}sendEvent(t,e){this.send({[Ul]:!0,kind:"event",eventName:t,payload:e})}dispatchInput(t){let e=this.deps.getCanvas();if(!e)return;let i=this.iframe.getBoundingClientRect(),n={bubbles:!0,cancelable:!0,view:window,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey};switch(t.type){case"pointerdown":case"pointermove":case"pointerup":case"pointercancel":e.dispatchEvent(new PointerEvent(t.type,{...n,clientX:(t.x??0)+i.left,clientY:(t.y??0)+i.top,button:t.button,buttons:t.buttons,pointerId:t.pointerId,pointerType:t.pointerType,isPrimary:t.isPrimary,movementX:t.movementX,movementY:t.movementY}));break;case"click":case"dblclick":e.dispatchEvent(new MouseEvent(t.type,{...n,clientX:(t.x??0)+i.left,clientY:(t.y??0)+i.top,button:t.button,buttons:t.buttons}));break;case"wheel":{let r=new WheelEvent("wheel",{...n,clientX:(t.x??0)+i.left,clientY:(t.y??0)+i.top,deltaX:t.deltaX,deltaY:t.deltaY,deltaMode:t.deltaMode});typeof t.wheelDeltaX=="number"&&Object.defineProperty(r,"wheelDeltaX",{value:t.wheelDeltaX}),typeof t.wheelDeltaY=="number"&&Object.defineProperty(r,"wheelDeltaY",{value:t.wheelDeltaY}),e.dispatchEvent(r);break}case"keydown":case"keyup":e.dispatchEvent(new KeyboardEvent(t.type,{...n,key:t.key,code:t.code,repeat:t.repeat}))}}}}),ii=F(()=>{oC(),Nq(),kq(),Vq(),Gq(),Hq(),Wq(),qq(),Xq(),$q(),Yq(),Qq(),hC(),Jq(),aF(),eX(),iX(),nX()}),rX=F(()=>{});function lF(t){return Array.isArray(t)?t:[t]}function y_(t,e){let i=0;for(;i<t.length&&i<e.length;){if(t[i]<e[i])return-1;if(t[i]>e[i])return 1;i+=1}return i!==e.length?-1:i!==t.length?1:0}var sX=F(()=>{});function Er(t,e){return Object.setPrototypeOf(t,e),t}function Gw(t){let e={...t};return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),e}function ql(t,e,i){if(t===void 0?e===void 0?(t=0,e=10):t=e-10:e===void 0&&(e=t+10),t>e){let s=t;t=e,e=s}let n=[],r=1/(i+1);for(let s=0;s<i;s++){let a=t+(e-t)*(s+.75+.5*Math.random())*r;n.push(a)}return n}function cC(t){return t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Uint32Array||t instanceof Int8Array||t instanceof Int16Array||t instanceof Int32Array||t instanceof Float32Array||t instanceof Float64Array}var aX=F(()=>{});function dC(t){if(t.deepFreeze!==void 0)return void t.deepFreeze(t);let e=Object.getOwnPropertyNames(t);for(let i of e){let n=t[i];n&&typeof n=="object"&&dC(n)}return Object.freeze(t)}function hF(t){for(let e of Object.keys(t))t[e]===void 0&&delete t[e];return t}var Hw,__,EE,te,uC,oX=F(()=>{}),ar=F(()=>{rX(),sX(),aX(),oX()}),pC=F(()=>{Hw=class{},__=class extends Hw{constructor(t){super(),this.id=t}},EE=class extends Hw{constructor(t){super(),this.data=t}}}),lX=F(()=>{}),zb=F(()=>{te=class{modifyById(t,e){let i=this;if(i[t]===void 0)throw new Error("not expected");{let n={...i,[t]:e};return Object.setPrototypeOf(n,te.prototype),n}}add(t,e){return this.runOp({type:1,id:t,data:e})?.data??this}runOp(t){let e=this;if(t.type===1){let i,n=e[t.id];i=n===void 0?{type:2,id:t.id}:{type:1,id:t.id,data:n};let{id:r,data:s}=t,a={...e,[r]:s};return Object.setPrototypeOf(a,te.prototype),{data:a,actual:t,reverse:i}}if(t.type===2){let{id:i}=t,n=e[i];if(n===void 0)return null;{let r={...e};return Object.setPrototypeOf(r,te.prototype),delete r[i],{data:r,actual:t,reverse:{type:1,id:i,data:n}}}}return null}}}),fC=F(()=>{uC=class extends Error{}});function cF(t,e){for(let i of t)e(i.id,i.data)!==!0&&cF(i.children,e)}function dF(t,e){if(e(t.id,t.data)!==!0)for(let i of t.children)dF(i,e)}var Wn,ev,cp,Vt,Xc=F(()=>{ar(),fC(),ar(),Wn=class extends Array{constructor(...t){super(...t),Ka(this,"partialObjectCaches"),Ka(this,"objCaches"),Ka(this,"parentCaches"),Object.setPrototypeOf(this,Wn.prototype)}deepFreeze(){let t=0;for(;t<this.length;)dC(this[t]),t++}fillCaches0(t,e){this.objCaches.set(t.id,t),this.parentCaches.set(t.id,e);for(let i of t.children)this.fillCaches0(i,t.id)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,this.parentCaches=new Map;for(let t of this)this.fillCaches0(t,null)}}randomId(){this.fillCaches();let t=Array.from(this.objCaches.keys());if(t.length!==0)return t[Math.max(0,Math.floor(Math.random()*t.length)-1)]}nonExistOrDescendantOf(t,e){if(!this.has(t))return!0;for(;t;){let i=this.parent(t);if(i===e)return!0;t=i}return!1}rootAcestor(t){for(;t;){let e=this.parent(t);if(!e)return t;t=e}return t}isDescendantOf(t,e){for(;t;){let i=this.parent(t);if(i===e)return!0;t=i}return!1}data(t){return this.get(t)?.data}has(t){return this.childrenOf(t)!==void 0}partialCache(t){this.partialObjectCaches===void 0&&(this.partialObjectCaches=new Map);let e=this.get(t);e!==void 0&&this.partialObjectCaches.set(t,e)}get(t){if(this.partialObjectCaches!==void 0){let e=this.partialObjectCaches.get(t);if(e!==void 0)return e}return this.fillCaches(),this.objCaches.get(t)}childrenOf(t){return t===null?this:this.get(t)?.children}traverseFrom(t,e){if(t===null)this.traverse(e);else{let i=this.get(t);i&&dF(i,e)}}traverse(t){cF(this,t)}totalSize(){return this.fillCaches(),this.objCaches.size}parent(t){return this.fillCaches(),this.parentCaches.get(t)}childrenArray(t){return t===null?this:this.get(t).children}modifyById(t,e){if(this.get(t)===void 0)throw new Error("not expected");{let i=this.parent(t),n=this.childrenArray(i),r=n.findIndex(o=>o.id===t);if(r<0)throw new Error("not expected");let s=n[r];n=[...n],n[r]={...s,data:e};let a=new Map;return a.set(t,n[r]),this.modifyArrayBy(i,n,a)}}modifyArrayBy(t,e,i=void 0){let n=t,r=e;for(;n!==null;){let a=r,o=n;if(n=this.parent(n),n===void 0)throw new Error;r=this.childrenArray(n);let l=r.findIndex(c=>c.id===o);if(l<0)throw new Error;r=[...r],r[l]={...r[l],children:a},i&&i.set(o,r[l])}Object.setPrototypeOf(r,Wn.prototype);let s=r;if(i&&this.objCaches!==void 0&&this.parentCaches!==void 0){s.objCaches=this.objCaches;for(let[a,o]of i)s.objCaches.set(a,o);s.parentCaches=this.parentCaches,this.objCaches=void 0,this.parentCaches=void 0}else s.fillCaches();return s}runOp(t){switch(t.type){case 7:return this.addOp(t);case 8:return this.deleteOp(t);case 9:return this.moveOp(t)}return null}checkDuplicatedIdRec({id:t,children:e}){if(this.get(t)!==void 0)return!0;for(let i of e)if(this.checkDuplicatedIdRec(i))return!0;return!1}addOp(t){let{parent:e,fi:i,id:n,data:r,children:s}=t;if(e!==null&&this.get(e)===void 0||this.checkDuplicatedIdRec(t))return null;{let a=e,o=this.childrenArray(a),l={fi:i,id:n,data:r,children:s};return o=[...o,l],o.sort((c,h)=>c.fi-h.fi),t.localIndex=o.indexOf(l),{data:this.modifyArrayBy(a,o),actual:t,reverse:{type:8,id:n}}}}deleteOp(t){let{id:e}=t;if(this.get(e)===null)return null;{let i=this.parent(e);if(i===void 0)return null;let n=this.childrenArray(i),r=n.findIndex(a=>a.id===e);t.localIndex=r,n=[...n];let s=n.splice(r,1)[0];return{data:this.modifyArrayBy(i,n),actual:t,reverse:{type:7,...s,parent:i}}}}moveOp(t){let{parent:e,fi:i,id:n}=t;if(e!==null&&this.get(e)===void 0)return this.deleteOp({type:8,id:n});if(e!==null){let d=e;for(;d!==null;){if(d===void 0)throw new Error;if(d===n)throw new uC("cyclic tree");d=this.parent(d)}}let r=this.parent(n);if(r===void 0)return null;let s=r,a=this.childrenArray(r),o=a.findIndex(d=>d.id===n);a=[...a];let l=a.splice(o,1)[0],c=this.modifyArrayBy(r,a);r=e,a=c.childrenArray(r);let h=l.fi;return l={...l,fi:i},a=[...a,l],a.sort((d,u)=>d.fi-u.fi),t.localIndex=a.indexOf(l),c=c.modifyArrayBy(r,a),{data:c,actual:t,reverse:{type:9,parent:s,fi:h,id:n}}}previous(t,e){if(e===null){let n=this.childrenArray(t);return n.length===0?null:n[n.length-1].id}let i=null;for(let n of this.childrenArray(t)){if(n.id===e)return i;i=n.id}return null}traverseSortNext(t){let e=this.parent(t);if(e!==void 0){let i=this.childrenArray(e),n=i.findIndex(r=>r.id===t)+1;if(n<i.length)return i[n].id;if(e)return this.traverseSortNext(e)}}sortNext(t){let e=this.childrenArray(t);return e.length>0?e[0].id:this.traverseSortNext(t)}traverseSortPrevious(t){let e=this.childrenArray(t);return e.length>0?this.traverseSortPrevious(e[e.length-1].id):t}sortPrevious(t){let e=this.parent(t);if(e!==void 0){let i=this.childrenArray(e),n=i.findIndex(r=>r.id===t)-1;return n>=0?this.traverseSortPrevious(i[n].id):e}}getAllSorted(t){let e=[];for(let i of t){let n=this.getWithSortKey(i.id);n!==void 0&&e.push({...i,...n})}e.sort((i,n)=>y_(i.sortKey,n.sortKey));for(let i of e)delete i.sortKey;return e}getAllIdSorted(t){let e=[];for(let i of t){let n=this.getWithSortKey(i);n!==void 0&&e.push(n)}e.sort((i,n)=>y_(i.sortKey,n.sortKey));for(let i of e)delete i.sortKey;return e.map(i=>i.id)}getWithSortKey(t){let e=t,i=[],n=this.get(e),r=n;if(n!==void 0){for(;e;)i.splice(0,0,n.fi),e=this.parent(e),e!==null&&(n=this.get(e));return{...r,sortKey:i}}}insertBeforeHelper(t,e,i){return this.insertAfterHelper(t,this.previous(t,e),i)}insertAfterHelper(t,e,i){let n=this.childrenArray(t);if(e===null){if(n.length===0)return ql(0,i,i);{let r=n[0].fi;return ql(r-i,r,i)}}{let r=this.get(e);if(r===void 0||this.parent(e)!==t)throw new Error("illegal args");let s=n.find(a=>a.fi>r.fi);if(s===void 0){let a=n[n.length-1].fi;return ql(a,a+i,i)}return ql(r.fi,s.fi,i)}}}}),mC=F(()=>{var t;ev=null,(t=cp||(cp={})).setPreservePrototype=function(e){ev=e},t.tryPreservePrototype=function(e,i){return Object.getPrototypeOf(e)===ev&&Object.setPrototypeOf(i,ev),i},t.runOp=function(e,i){if(i.type!==0)return null;if(Array.isArray(e)){let n=i.props,r={},s=[...e],a=!1;if(n)for(let o of Object.keys(n)){let l=parseInt(o);if(isNaN(l))throw new Error("wrong index");r[o]=s[l],s[l]=n[o],a=!0}return a?{data:s,actual:i,reverse:{type:0,props:r}}:null}{let n=i.props,r={},s={...e},a=!1;if(n)for(let o of Object.keys(n)){r[o]=s[o];let l=n[o];l===void 0?delete s[o]:s[o]=l,a=!0}return a?{data:t.tryPreservePrototype(e,s),actual:i,reverse:{type:0,props:r}}:null}}}),$c=F(()=>{ar(),ar(),Vt=class extends Array{constructor(...t){super(...t),Ka(this,"objCaches"),Object.setPrototypeOf(this,Vt.prototype)}deepFreeze(){let t=0;for(;t<this.length;)dC(this[t]),t++}fillCaches0(t){this.objCaches.set(t.id,t)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,Object.getOwnPropertyDescriptor(this,"objCaches").enumerable=!1;for(let t of this)this.fillCaches0(t)}}randomId(){this.fillCaches();let t=Array.from(this.objCaches.keys());if(t.length!==0)return t[Math.max(0,Math.floor(Math.random()*t.length)-1)]}data(t){return this.get(t)?.data}get(t){return this.fillCaches(),this.objCaches.get(t)}modifyById(t,e){if(this.get(t)===void 0)throw new Error("not expected");{let i=this,n=i.findIndex(s=>s.id===t);if(n<0)throw new Error("not expected");let r=i[n];return i=[...i],i[n]={...r,data:e},this.modifyArrayBy(i)}}modifyArrayBy(t){Object.setPrototypeOf(t,Vt.prototype);let e=t;return typeof process<"u"||e.fillCaches(),e}runOp(t){switch(t.type){case 4:return this.addOp(t);case 5:return this.deleteOp(t);case 6:return this.moveOp(t)}return null}addOp(t){let{fi:e,id:i,data:n}=t,r=this,s={fi:e,id:i,data:n};return r=[...r,s],r.sort((a,o)=>a.fi-o.fi),t.localIndex=r.indexOf(s),{data:this.modifyArrayBy(r),actual:t,reverse:{type:5,id:i}}}deleteOp(t){let{id:e}=t,i=this,n=i.findIndex(s=>s.id===e);if(n===-1)return null;t.localIndex=n,i=[...i];let r=i.splice(n,1)[0];return{data:this.modifyArrayBy(i),actual:t,reverse:{type:4,...r}}}moveOp(t){let{fi:e,id:i}=t,n=this;n=[...n];let r=n.findIndex(o=>o.id===i);if(r===-1)return null;let s=n[r].fi,a={...n[r],fi:e};return n[r]=a,n.sort((o,l)=>o.fi-l.fi),t.localIndex=n.indexOf(a),{data:this.modifyArrayBy(n),actual:t,reverse:{type:6,fi:s,id:i}}}previous(t){if(t===null)return this.length===0?null:this[this.length-1].id;let e=null;for(let i of this){if(i.id===t)return e;e=i.id}return null}insertBeforeHelper(t,e){return this.insertAfterHelper(this.previous(t),e)}insertAfterHelper(t,e){let i=this;if(t===null){if(i.length===0)return ql(0,e,e);{let n=i[0].fi;return ql(n-e,n,e)}}{let n=this.get(t);if(n===void 0)throw new Error("illegal args");let r=i.find(s=>s.fi>n.fi);if(r===void 0){let s=i[i.length-1].fi;return ql(s,s+e,e)}return ql(n.fi,r.fi,e)}}}});function hX(t,e){let i={cur:[],result:[],len:0};return[t=Gu(t,e,i)??t,i.result]}function s1(t,e){return t===null?null:(t.cur[t.len]=e,t.len+=1,t)}function a1(t){t&&(t.len-=1)}function uF(t,e,i){let n=!1,r=t.map(s=>{let a=s.id,o=e[a];if(o!==void 0&&typeof o=="string"&&(n=!0,a=o,i!==null))throw new Error("not supported");let l=Gu(s.data,e,s1(i,a));a1(i),n=n||l!==void 0,l===void 0&&(l=s.data);let c=uF(s.children,e,i);return c!==void 0?n=!0:c=s.children,{...s,id:a,data:l,children:c}});if(n)return r}function Gu(t,e,i){if(t instanceof Wn){let n=uF(t,e,i);return n!==void 0&&Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n}if(t instanceof Vt)return function(n,r,s){let a=!1,o=n.map(l=>{let c=l.id,h=r[c];if(h!==void 0&&typeof h=="string"&&(a=!0,c=h,s!==null))throw new Error("not supported");let d=Gu(l.data,r,s1(s,c));return a1(s),a=a||d!==void 0,d===void 0&&(d=l.data),{...l,id:c,data:d}});if(a)return Object.setPrototypeOf(o,Object.getPrototypeOf(n)),o}(t,e,i);if(Array.isArray(t)){let n=!1,r=t.map((s,a)=>{let o=Gu(s,e,s1(i,a));return a1(i),n=n||o!==void 0,o===void 0&&(o=s),o});return n?(Object.setPrototypeOf(r,Object.getPrototypeOf(t)),r):void 0}if(t&&typeof t=="object"&&!cC(t)){let n={},r=!1;for(let[s,a]of Object.entries(t))if(s!=="name"&&s!=="variableId"){let o=e[s];if(typeof o=="string"){if(i!==null)throw new Error("not supported");r=!0,s=o}let l=Gu(a,e,s1(i,s));a1(i),r=r||l!==void 0,l===void 0&&(l=a),n[s]=l}else n[s]=a;return r?(Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n):void 0}if(typeof t=="string"){let n=e[t];return n!==void 0&&function(r){if(r===null)return null;r.result.push(r.cur.slice(0,r.len))}(i),n}}var pF=F(()=>{Xc(),$c(),ar()});function Hu(t){return t&&typeof t=="object"&&t instanceof fn}function gC(t,e){if(e===void 0)return;let i=!1,n=t.map(r=>{let s=r.id,a=tg(r.data,e[s]);if(i=i||a!==void 0,a===void 0&&(a=r.data),r.children){let o=gC(r.children,e);return o!==void 0?i=!0:o=r.children,{...r,id:s,data:a,children:o}}return{...r,id:s,data:a}});return i?n:void 0}function tg(t,e){if(!Hu(e))return e;if(t instanceof Wn){let i=gC(t,e);return i!==void 0&&Object.setPrototypeOf(i,Object.getPrototypeOf(t)),i}if(t instanceof Vt)return function(i,n){if(n===void 0)return;let r=!1,s=i.map(a=>{let o=a.id,l=tg(a.data,n[o]);return r=r||l!==void 0,l===void 0&&(l=a.data),{...a,id:o,data:l}});return r?(Object.setPrototypeOf(s,Object.getPrototypeOf(i)),s):void 0}(t,e);if(Array.isArray(t)){let i=!1,n=t.map((r,s)=>{let a=tg(r,e[s]);return i=i||a!==void 0,a===void 0&&(a=r),a});return i?(Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n):void 0}if(t instanceof fn)return vC(t,e);if(t&&typeof t=="object"){let i={},n=!1;for(let[r,s]of Object.entries(t)){let a=tg(s,e[r]);n=n||a!==void 0,a===void 0&&(a=s),i[r]=a}return n?(Object.setPrototypeOf(i,Object.getPrototypeOf(t)),i):void 0}}function vC(t,e){if(t===void 0)return e;if(e===void 0)return t;if(!Hu(e))return e;if(!Hu(t))return sh.apply(t,e);let i=new Set;for(let r of Object.keys(t))i.add(r);for(let r of Object.keys(e))i.add(r);let n=new fn;for(let r of i){let s=vC(t===void 0?void 0:t[r],e===void 0?void 0:e[r]);n[r]=s}return n}var fn,sh,b_,Jn,BR,yC=F(()=>{var t;Xc(),$c(),kb(),ar(),fn=class{unusedFunOverridesTable(e){}runOp(e){let i=[],n=this,r=0,s={};for(;r<e.path.length;){if(i.push(n),n=n===void 0?void 0:n[e.path[r]],n!==void 0&&!Hu(n))return null;r+=1}n=n?Gw(n):new fn;for(let[a,o]of Object.entries(e.props)){let l=n[a];s[a]=l,o===void 0?delete n[a]:n[a]=o}for(;r>0;){if(Object.keys(n).length===0){let a=i[r-1];a&&(n=Gw(a),delete n[e.path[r-1]])}else{let a=i[r-1];if(a){let o=Gw(a);o[e.path[r-1]]=n,n=o}else{let o=new fn;o[e.path[r-1]]=n,n=o}}r-=1}return{data:Object.setPrototypeOf(n,fn.prototype),actual:e,reverse:{...e,props:s}}}},(t=sh||(sh={})).apply=function(e,i){return tg(e,i)??e},t.merge=function(e,i){return vC(e,i)},t.filterOp=function(e,i){let n=0,r=i.path,s=e;for(;n<r.length&&s!==void 0;){if(s=kn.zoomOnce(s,r[n]),s===void 0)return i;if(!Hu(s))return;n+=1}if(s===void 0)return i;if(Hu(s)){if(i.type===0){let a={...i.props};for(let o of Object.keys(s))delete a[o];return{...i,props:a}}if(i.type===1||i.type===4||i.type===7){let a=gC([i],s);return a?a[0]:i}return i}}}),cX=F(()=>{kb(),zb(),Xc(),fC(),mC(),$c(),pF(),yC(),(b_||(b_={})).replaceProps=function(t,e){let i=kn.zoom(e,t.path);if(typeof i=="object"){let n={};for(let r of Object.keys(t.props))n[r]=i[r];return{...t,props:n}}return{...t,props:{}}},(t=>{function e(r,s){let a=s.path,o=[];for(;;){let l;if(r instanceof fn&&s.type===0&&(l=r.runOp({...s,path:a.slice(o.length)}),l===null&&(l=void 0)),l===void 0&&o.length===a.length&&(l=r instanceof Wn||r instanceof Vt||r instanceof te?r.runOp(s):cp.runOp(r,s)),l!==void 0){if(l!==null){let d=l.data;for(let u=o.length-1;u>=0;u--){let p=a[u],f=o[u];if(f instanceof Wn){if(typeof p=="number")throw new Error("illegal arg");d=f.modifyById(p,d)}else if(f instanceof Vt){if(typeof p=="number")throw new Error("illegal arg");d=f.modifyById(p,d)}else if(f instanceof te){if(typeof p=="number")throw new Error("illegal arg");d=f.modifyById(p,d)}else if(f instanceof fn){let g={...f,[p]:d};d=Object.setPrototypeOf(g,fn.prototype)}else{if(typeof f!="object")return null;if(Array.isArray(f)){if(typeof p=="string"&&(p=parseInt(p),isNaN(p)))throw new Error("Invalid path");let g=d;d=[...f],d[p]=g}else d=cp.tryPreservePrototype(f,{...f,[p]:d})}}return{data:d,actual:{...l.actual,path:a},reverse:{...l.reverse,path:a}}}return null}let c,h=a[o.length];if(r instanceof Wn){if(typeof h=="number")throw new Error("");c=r.get(h)?.data}else if(r instanceof Vt){if(typeof h=="number")throw new Error("");c=r.get(h)?.data}else r!==null&&(c=r[h]);if(c===void 0)return null;o.push(r),r=c}}function i(r,s){for(let a=0;a<r.length&&a<s.length;a++)if(r[a]!==s[a])return!0;return!1}function n(r,s){if(r.length!==s.length)return!1;for(let a=0;a<r.length;a++)if(r[a]!==s[a])return!1;return!0}t.drop=function(r,s){return{...r,path:r.path.slice(s)}},t.applySimple=function(r,s){return e(r,s)?.data??r},t.apply=e,t.pathDisjoint=i,t.pathEq=n,t.commutative=function(r,s){return i(r.path,s.path)},t.subsumed=function(r,s){return!(r.type!==0||s.type!==0||!n(r.path,s.path))&&Object.keys(r.props).every(a=>s.props[a]!==void 0)}})(Jn||(Jn={})),(t=>{function e(i,n){let r=i,s=[],a=[];for(let o of n)try{if(o.type===3||o.type===5&&o.path[o.path.length-1]==="variables"){let l,c,h;if(o.type===3?(l=kn.zoom(r,[...o.path,o.id]),h=Jn.apply(r,{...o,type:2})):(l=kn.zoom(r,[...o.path,o.id,"value"]),h=Jn.apply(r,o)),h!==null){r=h.data;let[d,u]=hX(r,{[o.id]:l});r=d;for(let p=0;p<u.length;p++){let f=u[p],g=f.pop();if(typeof g=="number"){let m=[g];for(let v=p+1;v<u.length;v++){let _=u[v],b=_[_.length-1];if(typeof b!="number"||!kn.equal(f,_.slice(0,_.length-1)))break;m.push(b),u.splice(v,1)}let y=kn.zoom(r,f);c=y.map((v,_)=>m.includes(_)?o.id:v),l=y,g=f.pop()}else{if(g==="alphaOverride"||g==="alpha"){l/=100;let m=l,y=kn.zoom(r,f.slice(0,f.length-2)),v=y.layers.map(_=>_.id===f[f.length-1]?{..._,data:{..._.data,[g]:m}}:_);Object.setPrototypeOf(v,Object.getPrototypeOf(y.layers)),y.layers=v}c=o.id}s.push({type:0,path:f,props:{[g]:l}}),a.push({type:0,path:f,props:{[g]:c}})}a.push(h.reverse),s.push(h.actual)}}else{let l=Jn.apply(r,o);l!==null&&(s.push(l.actual),r=l.data,a.push(l.reverse))}}catch(l){if(l instanceof uC)return null;throw l}return{data:r,actual:s,reverse:a.reverse()}}t.empty=function(){return[]},t.removePrefix=function(i,n){let r=[];for(let s of i){let[a,...o]=s.path;a===n&&r.push({...s,path:o})}return r},t.addPrefix=function(i,n){return i.map(r=>({...r,path:[n,...r.path]}))},t.concat=function(i,n){return[...i,...n]},t.compress=function(i,n){return[...i.filter(r=>!n.some(s=>Jn.subsumed(r,s))),...n]},t.commutative=function(i,n){return i.every(r=>n.every(s=>Jn.commutative(r,s)))},t.applyAll=function(i,n){for(let r of n){let s=e(i,r);s!==null&&(i=s.data)}return i},t.apply=e})(BR||(BR={}))});function Ww(t,e,i){if(t.length>0){let n=t[t.length-1];if(n.type===0&&e.type===0&&kn.equal(n.path,i))return void Object.assign(n.props,e.props)}t.push({...e,path:i})}function o1(t,e,i){return i instanceof Wn?new Fb(t,e,i):i instanceof Vt?new Nb(t,e,i):i instanceof te?new Proxy(new mF(t,e,i),vF):i!==null&&typeof i=="object"?cC(i)?i:new Proxy(new fF(t,e,i),gF):i}function Em(t){let e=new TE(t);return[o1(e,"",t),e]}function x_(t,e){let[i,n]=Em(t);return e(i),n.result()}function ln(t){return t instanceof Fb||t instanceof Nb?t._current:t!==null&&typeof t=="object"?t[AE]:t}var AE,UR,Tf,Dd,fF,mF,qw,gF,vF,Fb,Nb,TE,kn,yF=F(()=>{zb(),Xc(),mC(),$c(),ar(),kb(),AE=Symbol(),UR=Symbol(),Tf=Symbol(),Dd=class{reportOp(t,e,i=[]){let n=this;if(e===null)return;n._current=e.data;let r=i;for(;!(n instanceof TE);){let s=n._path,a=n._current;if(s!==""&&r.splice(0,0,s),n=n._parent,n===null)return;n.update(s,a)}n.push(r,t,e.actual,e.reverse)}deleteChildren(t){if(this._children){let e=this._children[t];if(e){let i=e[Tf];i&&i(),delete this._children[t]}}}},fF=class extends Dd{constructor(t,e,i){super(),this._parent=t,this._path=e,this._current=i}update(t,e){if(Array.isArray(this._current)){if(typeof t=="string"&&(t=parseInt(t),isNaN(t)))throw new Error("Invalid path");this._current=[...this._current],this._current[t]=e}else this._current=cp.tryPreservePrototype(this._current,{...this._current,[t]:e})}runOp(t){this.reportOp(t,cp.runOp(this._current,t),t.path)}},mF=class extends Dd{constructor(t,e,i){super(),this._parent=t,this._path=e,this._current=i}update(t,e){this._current={...this._current,[t]:e},Object.setPrototypeOf(this._current,te.prototype)}runOp(t){this.reportOp(t,this._current.runOp(t))}},qw={get(t,e){if(e===Tf)return()=>{t._parent=null};if(e===AE)return t._current;if(e===UR)return t;let{_current:i,_children:n}=t;if(e==="push"&&Array.isArray(i))throw new Error("not supported to expand array");let r=n===void 0?void 0:n[e];if(r!==void 0)return r;let s=i[e],a=o1(t,e,s);return a!==s?(n===void 0&&(n={},t._children=n),n[e]=a,a):s},has:(t,e)=>e in t._current,ownKeys:t=>Reflect.ownKeys(t._current),defineProperty(){throw Error("not supported")},getPrototypeOf:t=>Object.getPrototypeOf(t._current),setPrototypeOf(){throw Error("not supported")},getOwnPropertyDescriptor(t,e){let i=t._current,n=Reflect.getOwnPropertyDescriptor(i,e);return n&&{writable:!0,configurable:!0,enumerable:n.enumerable,value:i[e]}}},gF={...qw,set(t,e,i){let n={type:0,props:{[e]:ln(i)??i}};return t.deleteChildren(e),t.runOp(n),!0},deleteProperty(t,e){let i={type:0,props:{[e]:void 0}};return t.deleteChildren(e),t.runOp(i),!0}},vF={...qw,set(t,e,i){return i===void 0?this.deleteProperty(t,e):(t.deleteChildren(e),t.runOp({type:1,id:e,data:i})),!0},deleteProperty:(t,e)=>(t.runOp({type:2,id:e}),!0)},Fb=class extends Dd{constructor(t,e,i){super(),this._children={},this._parent=t,this._path=e,this._current=i,this[Tf]=()=>{this._parent=null}}unproxy(){return this._current}update(t,e){this._current=this._current.modifyById(t,e)}runOp(t){this.reportOp(t,this._current.runOp(t))}randomId(){return this._current.randomId()}isDescendantOf(t,e){return this._current.isDescendantOf(t,e)}childrenOf(t){return this._current.childrenOf(t)}get(t){return this._current.get(t)}parent(t){return this._current.parent(t)}traverse(t){this._current.traverse((e,i)=>{t(e,this.data(e))})}data(t){let{_current:e,_children:i}=this,n=i===void 0?void 0:i[t];if(n!==void 0)return n;let r=e.get(t)?.data,s=o1(this,t,r);return s!==r?(i===void 0&&(i={},this._children=i),i[t]=s,s):r}add(t,e,i,n,r){this.runOp({type:7,parent:t,fi:e,id:i,data:n,children:r})}move(t,e,i){this.runOp({type:9,parent:t,fi:e,id:i})}insertAfter(t,e,i){let n=this._current.insertAfterHelper(t,e,i.length);for(let r=0;r<i.length;r++){let s=i[r];this.add(t,n[r],s.id,s.data,s.children)}}insertBefore(t,e,i){let n=this._current.insertBeforeHelper(t,e,i.length);for(let r=0;r<i.length;r++){let s=i[r];this.add(t,n[r],s.id,s.data,s.children)}}moveAfter(t,e,i){let n=this._current.insertAfterHelper(t,e,i.length);for(let r=0;r<i.length;r++){let s=i[r];this.move(t,n[r],s)}}moveBefore(t,e,i){let n=this._current.insertBeforeHelper(t,e,i.length);for(let r=0;r<i.length;r++){let s=i[r];this.move(t,n[r],s)}}delete(t){this.deleteChildren(t),this.runOp({type:8,id:t})}sortNext(t){return this._current.sortNext(t)}sortPrevious(t){return this._current.sortPrevious(t)}getAllSorted(t){return this._current.getAllSorted(t)}},Nb=class extends Dd{constructor(t,e,i){super(),this._children={},this._parent=t,this._path=e,this._current=i,this[Tf]=()=>{this._parent=null}}unproxy(){return this._current}get length(){return this._current.length}forEach(t){let e=this.length;for(let i=0;i<e;i++){let n=this._current[i].id,r=this._current[i].fi;t(this.data(this._current[i].id),n,r,i)}}find(t){let e=this.length;for(let i=0;i<e;i++){let n=this._current[i].id;if(t(this.data(n),n))return this.get(n)}}update(t,e){this._current=this._current.modifyById(t,e)}randomId(){return this._current.randomId()}get(t){return{...this._current.get(t),data:this.data(t)}}at(t){let{id:e,fi:i}=this._current.at(t);return{id:e,fi:i,data:this.data(e)}}data(t){let{_current:e,_children:i}=this,n=i===void 0?void 0:i[t];if(n!==void 0)return n;let r=e.get(t)?.data,s=o1(this,t,r);return s!==r?(i===void 0&&(i={},this._children=i),i[t]=s,s):r}runOp(t){this.reportOp(t,this._current.runOp(t))}add(t,e,i){this.runOp({type:4,fi:t,id:e,data:i})}move(t,e){this.runOp({type:6,fi:t,id:e})}insertAfter(t,e){let i=this._current.insertAfterHelper(t,e.length);for(let n=0;n<e.length;n++){let r=e[n];this.add(i[n],r.id,r.data)}}insertBefore(t,e){let i=this._current.insertBeforeHelper(t,e.length);for(let n=0;n<e.length;n++){let r=e[n];this.add(i[n],r.id,r.data)}}moveAfter(t,e){let i=this._current.insertAfterHelper(t,e.length);for(let n=0;n<e.length;n++){let r=e[n];this.move(i[n],r)}}moveBefore(t,e){let i=this._current.insertBeforeHelper(t,e.length);for(let n=0;n<e.length;n++){let r=e[n];this.move(i[n],r)}}delete(t){this.deleteChildren(t),this.runOp({type:5,id:t})}},TE=class extends Dd{constructor(t){super(),this.ts=[],this.actual=[],this.reverse=[],this._current=t}update(t,e){if(t!=="")throw new Error("");this._current=e}push(t,e,i,n){Ww(this.ts,e,t),Ww(this.actual,i,t),Ww(this.reverse,n,t)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}}}),kb=F(()=>{pC(),yF(),$c(),Xc(),ar(),(t=>{function e(n,r){return(n instanceof Wn||n instanceof Fb)&&typeof r=="string"||(n instanceof Vt||n instanceof Nb)&&typeof r=="string"?n.data(r):typeof r=="number"&&Array.isArray(n)||typeof r=="string"&&typeof n=="object"&&n!==null?n[r]:void 0}function i(n,r,s=0){for(;s<r.length&&n!==void 0;)n=e(n,r[s]),s+=1;return n}t.equal=function(n,r){if(r.length!==n.length)return!1;{let s=0;for(;s<n.length;){if(n[s]!==r[s])return!1;s+=1}}return!0},t.removeOverridden=function(n,r,s){let a=i(s,n);if(a!==void 0&&typeof a=="object"&&a!==null){let o={...r};return Object.keys(a).forEach(l=>{delete o[l]}),o}return r},t.zoomOnce=e,t.zoom=i,t.findPathes=function(n,r){let s=[];return function a(o,l){if(o instanceof __&&o.id===r.id)s.push(l);else if(o instanceof Vt)for(let c=0;c<o.length;c++)a(o[c].data,[...l,o[c].id]);else if(o instanceof Wn)o.traverse((c,h)=>{a(c,[...l,h])});else if(Array.isArray(o))for(let c=0;c<o.length;c++)a(o[c],[...l,c]);else{if(cC(o))return;if(typeof o=="object"&&o!==null)for(let c in o)a(o[c],[...l,c])}}(n,[]),s}})(kn||(kn={}))}),dX=F(()=>{});function ri(t,e){let i=[];if(!(e.length<=t.length))return null;{let n=0;for(;n<e.length;){if(e[n]==="*")i.push(t[n]);else if(t[n]!==e[n])return null;n+=1}}return i}var uX=F(()=>{});function iv(t){try{if(!bi.trusted&&!Zo){let i=Qe.sharedLength||0;i<Qe.length&&(Qe.length=i)}let e;if(bi.randomAccessStructure&&kt[mt]<64&&kt[mt]>=32&&jR?(e=jR(kt,mt,Ns,bi),kt=null,!(t&&t.lazy)&&e&&(e=e.toJSON()),mt=Ns):e=pn(),yr&&(mt=yr.postBundlePosition,yr=null),Zo&&(Qe.restoreStructures=null),mt==Ns)Qe&&Qe.restoreStructures&&zR(),Qe=null,kt=null,Yo&&(Yo=null);else{if(mt>Ns)throw new Error("Unexpected end of MessagePack data");if(!Zo){let i;try{i=JSON.stringify(e,(n,r)=>typeof r=="bigint"?`${r}n`:r).slice(0,100)}catch(n){i="(JSON view not available "+n+")"}throw new Error("Data read, but end of buffer not reached "+i)}}return e}catch(e){throw Qe&&Qe.restoreStructures&&zR(),PE(),(e instanceof RangeError||e.message.startsWith("Unexpected end of buffer")||mt>Ns)&&(e.incomplete=!0),e}}function zR(){for(let t in Qe.restoreStructures)Qe[t]=Qe.restoreStructures[t];Qe.restoreStructures=null}function pn(){let t=kt[mt++];if(t<160){if(t<128){if(t<64)return t;{let e=Qe[63&t]||bi.getStructures&&_F()[63&t];return e?(e.read||(e.read=CE(e,63&t)),e.read()):t}}if(t<144){if(t-=128,bi.mapsAsObjects){let e={};for(let i=0;i<t;i++){let n=xF();n==="__proto__"&&(n="__proto_"),e[n]=pn()}return e}{let e=new Map;for(let i=0;i<t;i++)e.set(pn(),pn());return e}}{t-=144;let e=new Array(t);for(let i=0;i<t;i++)e[i]=pn();return bi.freezeData?Object.freeze(e):e}}if(t<192){let e=t-160;if(ua>=mt)return Xl.slice(mt-fs,(mt+=e)-fs);if(ua==0&&Ns<140){let i=e<16?_C(e):bF(e);if(i!=null)return i}return M_(e)}{let e;switch(t){case 192:return null;case 193:return yr?(e=pn(),e>0?yr[1].slice(yr.position1,yr.position1+=e):yr[0].slice(yr.position0,yr.position0-=e)):MF;case 194:return!1;case 195:return!0;case 196:if(e=kt[mt++],e===void 0)throw new Error("Unexpected end of buffer");return Xw(e);case 197:return e=He.getUint16(mt),mt+=2,Xw(e);case 198:return e=He.getUint32(mt),mt+=4,Xw(e);case 199:return Xh(kt[mt++]);case 200:return e=He.getUint16(mt),mt+=2,Xh(e);case 201:return e=He.getUint32(mt),mt+=4,Xh(e);case 202:if(e=He.getFloat32(mt),bi.useFloat32>2){let i=BE[(127&kt[mt])<<1|kt[mt+1]>>7];return mt+=4,(i*e+(e>0?.5:-.5)|0)/i}return mt+=4,e;case 203:return e=He.getFloat64(mt),mt+=8,e;case 204:return kt[mt++];case 205:return e=He.getUint16(mt),mt+=2,e;case 206:return e=He.getUint32(mt),mt+=4,e;case 207:return bi.int64AsType==="number"?(e=4294967296*He.getUint32(mt),e+=He.getUint32(mt+4)):bi.int64AsType==="string"?e=He.getBigUint64(mt).toString():bi.int64AsType==="auto"?(e=He.getBigUint64(mt),e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=He.getBigUint64(mt),mt+=8,e;case 208:return He.getInt8(mt++);case 209:return e=He.getInt16(mt),mt+=2,e;case 210:return e=He.getInt32(mt),mt+=4,e;case 211:return bi.int64AsType==="number"?(e=4294967296*He.getInt32(mt),e+=He.getUint32(mt+4)):bi.int64AsType==="string"?e=He.getBigInt64(mt).toString():bi.int64AsType==="auto"?(e=He.getBigInt64(mt),e>=BigInt(-2)<<BigInt(52)&&e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=He.getBigInt64(mt),mt+=8,e;case 212:if(e=kt[mt++],e==114)return LE(63&kt[mt++]);{let i=gr[e];if(i)return i.read?(mt++,i.read(pn())):i.noBuffer?(mt++,i()):i(kt.subarray(mt,++mt));throw new Error("Unknown extension "+e)}case 213:return e=kt[mt],e==114?(mt++,LE(63&kt[mt++],kt[mt++])):Xh(2);case 214:return Xh(4);case 215:return Xh(8);case 216:return Xh(16);case 217:return e=kt[mt++],ua>=mt?Xl.slice(mt-fs,(mt+=e)-fs):AF(e);case 218:return e=He.getUint16(mt),ua>=(mt+=2)?Xl.slice(mt-fs,(mt+=e)-fs):TF(e);case 219:return e=He.getUint32(mt),ua>=(mt+=4)?Xl.slice(mt-fs,(mt+=e)-fs):CF(e);case 220:return e=He.getUint16(mt),mt+=2,FR(e);case 221:return e=He.getUint32(mt),mt+=4,FR(e);case 222:return e=He.getUint16(mt),mt+=2,NR(e);case 223:return e=He.getUint32(mt),mt+=4,NR(e);default:if(t>=224)return t-256;if(t===void 0){let i=new Error("Unexpected end of MessagePack data");throw i.incomplete=!0,i}throw new Error("Unknown MessagePack token "+t)}}}function CE(t,e){function i(){if(i.count++>RE){let r;try{r=t.read=new Function("r","return function(){return "+(bi.freezeData?"Object.freeze":"")+"({"+t.map(s=>s==="__proto__"?"__proto_:r()":EF.test(s)?s+":r()":"["+JSON.stringify(s)+"]:r()").join(",")+"})}")(pn)}catch{return RE=1/0,i()}return t.read0=r,t.highByte===0&&(t.read=IE(e,t.read)),r()}let n={};for(let r=0,s=t.length;r<s;r++){let a=t[r];a==="__proto__"&&(a="__proto_"),n[a]=pn()}return bi.freezeData?Object.freeze(n):n}return i.count=0,t.read0=i,t.highByte===0?IE(e,i):i}function _F(){let t=SF(()=>(kt=null,bi.getStructures()));return Qe=bi._mergeStructures(t,Qe)}function Am(t){let e;if(t<16&&(e=_C(t)))return e;if(t>64&&DE)return DE.decode(kt.subarray(mt,mt+=t));let i=mt+t,n=[];for(e="";mt<i;){let r=kt[mt++];if(128&r)if((224&r)==192){let s=(31&r)<<6|63&kt[mt++];s<128?n.push(65533):n.push(s)}else if((240&r)==224){let s=(31&r)<<12|(63&kt[mt++])<<6|63&kt[mt++];s<2048||s>=55296&&s<=57343?n.push(65533):n.push(s)}else if((248&r)==240){let s=(7&r)<<18|(63&kt[mt++])<<12|(63&kt[mt++])<<6|63&kt[mt++];s<65536||s>1114111?n.push(65533):(s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s))}else n.push(65533);else n.push(r);n.length>=4096&&(e+=Fn.apply(String,n),n.length=0)}return n.length>0&&(e+=Fn.apply(String,n)),e}function FR(t){let e=new Array(t);for(let i=0;i<t;i++)e[i]=pn();return bi.freezeData?Object.freeze(e):e}function NR(t){if(bi.mapsAsObjects){let e={};for(let i=0;i<t;i++){let n=xF();n==="__proto__"&&(n="__proto_"),e[n]=pn()}return e}{let e=new Map;for(let i=0;i<t;i++)e.set(pn(),pn());return e}}function bF(t){let e=mt,i=new Array(t);for(let n=0;n<t;n++){let r=kt[mt++];if((128&r)>0)return void(mt=e);i[n]=r}return Fn.apply(String,i)}function _C(t){if(t<4){if(t<2){if(t===0)return"";{let e=kt[mt++];return(128&e)>1?void(mt-=1):Fn(e)}}{let e=kt[mt++],i=kt[mt++];if((128&e)>0||(128&i)>0)return void(mt-=2);if(t<3)return Fn(e,i);let n=kt[mt++];return(128&n)>0?void(mt-=3):Fn(e,i,n)}}{let e=kt[mt++],i=kt[mt++],n=kt[mt++],r=kt[mt++];if((128&e)>0||(128&i)>0||(128&n)>0||(128&r)>0)return void(mt-=4);if(t<6){if(t===4)return Fn(e,i,n,r);{let s=kt[mt++];return(128&s)>0?void(mt-=5):Fn(e,i,n,r,s)}}if(t<8){let s=kt[mt++],a=kt[mt++];if((128&s)>0||(128&a)>0)return void(mt-=6);if(t<7)return Fn(e,i,n,r,s,a);let o=kt[mt++];return(128&o)>0?void(mt-=7):Fn(e,i,n,r,s,a,o)}{let s=kt[mt++],a=kt[mt++],o=kt[mt++],l=kt[mt++];if((128&s)>0||(128&a)>0||(128&o)>0||(128&l)>0)return void(mt-=8);if(t<10){if(t===8)return Fn(e,i,n,r,s,a,o,l);{let c=kt[mt++];return(128&c)>0?void(mt-=9):Fn(e,i,n,r,s,a,o,l,c)}}if(t<12){let c=kt[mt++],h=kt[mt++];if((128&c)>0||(128&h)>0)return void(mt-=10);if(t<11)return Fn(e,i,n,r,s,a,o,l,c,h);let d=kt[mt++];return(128&d)>0?void(mt-=11):Fn(e,i,n,r,s,a,o,l,c,h,d)}{let c=kt[mt++],h=kt[mt++],d=kt[mt++],u=kt[mt++];if((128&c)>0||(128&h)>0||(128&d)>0||(128&u)>0)return void(mt-=12);if(t<14){if(t===12)return Fn(e,i,n,r,s,a,o,l,c,h,d,u);{let p=kt[mt++];return(128&p)>0?void(mt-=13):Fn(e,i,n,r,s,a,o,l,c,h,d,u,p)}}{let p=kt[mt++],f=kt[mt++];if((128&p)>0||(128&f)>0)return void(mt-=14);if(t<15)return Fn(e,i,n,r,s,a,o,l,c,h,d,u,p,f);let g=kt[mt++];return(128&g)>0?void(mt-=15):Fn(e,i,n,r,s,a,o,l,c,h,d,u,p,f,g)}}}}}function kR(){let t,e=kt[mt++];if(e<192)t=e-160;else switch(e){case 217:t=kt[mt++];break;case 218:t=He.getUint16(mt),mt+=2;break;case 219:t=He.getUint32(mt),mt+=4;break;default:throw new Error("Expected string")}return Am(t)}function Xw(t){return bi.copyBuffers?Uint8Array.prototype.slice.call(kt,mt,mt+=t):kt.subarray(mt,mt+=t)}function Xh(t){let e=kt[mt++];if(gr[e]){let i;return gr[e](kt.subarray(mt,i=mt+=t),n=>{mt=n;try{return pn()}finally{mt=i}})}throw new Error("Unknown extension type "+e)}function xF(){let t=kt[mt++];if(!(t>=160&&t<192))return mt--,wF(pn());if(t-=160,ua>=mt)return Xl.slice(mt-fs,(mt+=t)-fs);if(!(ua==0&&Ns<180))return M_(t);let e,i=4095&(t<<5^(t>1?He.getUint16(mt):t>0?kt[mt]:0)),n=OE[i],r=mt,s=mt+t-3,a=0;if(n&&n.bytes==t){for(;r<s;){if(e=He.getUint32(r),e!=n[a++]){r=1879048192;break}r+=4}for(s+=3;r<s;)if(e=kt[r++],e!=n[a++]){r=1879048192;break}if(r===s)return mt=r,n.string;s-=3,r=mt}for(n=[],OE[i]=n,n.bytes=t;r<s;)e=He.getUint32(r),n.push(e),r+=4;for(s+=3;r<s;)e=kt[r++],n.push(e);let o=t<16?_C(t):bF(t);return n.string=o??M_(t)}function wF(t){if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean"||typeof t=="bigint")return t.toString();if(t==null)return t+"";if(bi.allowArraysInMapKeys&&Array.isArray(t)&&t.flat().every(e=>["string","number","boolean","bigint"].includes(typeof e)))return t.flat().toString();throw new Error("Invalid property type for record: "+typeof t)}function SF(t){GR&&GR();let e=Ns,i=mt,n=S_,r=fs,s=ua,a=Xl,o=w_,l=Yo,c=yr,h=new Uint8Array(kt.slice(0,Ns)),d=Qe,u=Qe.slice(0,Qe.length),p=bi,f=Zo,g=t();return Ns=e,mt=i,S_=n,fs=r,ua=s,Xl=a,w_=o,Yo=l,yr=c,kt=h,Zo=f,(Qe=d).splice(0,Qe.length,...u),bi=p,He=new DataView(kt.buffer,kt.byteOffset,kt.byteLength),g}function PE(){kt=null,Yo=null,Qe=null}function pX(t){t.unpack?gr[t.type]=t.unpack:gr[t.type]=t}var DE,kt,Ns,mt,VR,w_,S_,bi,Qe,Xl,fs,ua,yr,Yo,gr,He,$w,MF,Zo,RE,jR,GR,Tm,EF,IE,M_,AF,TF,CF,Fn,OE,LE,Yw,HR,WR,qR,BE,nv,XR,$R,YR,UE,Zw,Tg,fX=F(()=>{try{DE=new TextDecoder}catch{}mt=0,w_=VR=[],S_=0,bi={},fs=0,ua=0,gr=[],$w={useRecords:!1,mapsAsObjects:!0},(MF=new class{}).name="MessagePack 0xC1",Zo=!1,RE=2,Tm=class{constructor(t){t&&(t.useRecords===!1&&t.mapsAsObjects===void 0&&(t.mapsAsObjects=!0),t.sequential&&t.trusted!==!1&&(t.trusted=!0,!t.structures&&t.useRecords!=0&&(t.structures=[],t.maxSharedStructures||(t.maxSharedStructures=0))),t.structures?t.structures.sharedLength=t.structures.length:t.getStructures&&((t.structures=[]).uninitialized=!0,t.structures.sharedLength=0),t.int64AsNumber&&(t.int64AsType="number")),Object.assign(this,t)}unpack(t,e){if(kt)return SF(()=>(PE(),this?this.unpack(t,e):Tm.prototype.unpack.call($w,t,e)));!t.buffer&&t.constructor===ArrayBuffer&&(t=typeof Buffer<"u"?Buffer.from(t):new Uint8Array(t)),typeof e=="object"?(Ns=e.end||t.length,mt=e.start||0):(mt=0,Ns=e>-1?e:t.length),S_=0,ua=0,Xl=null,w_=VR,yr=null,kt=t;try{He=t.dataView||(t.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength))}catch(i){throw kt=null,t instanceof Uint8Array?i:new Error("Source must be a Uint8Array or Buffer but was a "+(t&&typeof t=="object"?t.constructor.name:typeof t))}if(this instanceof Tm){if(bi=this,this.structures)return Qe=this.structures,iv(e);(!Qe||Qe.length>0)&&(Qe=[])}else bi=$w,(!Qe||Qe.length>0)&&(Qe=[]);return iv(e)}unpackMultiple(t,e){let i,n=0;try{Zo=!0;let r=t.length,s=this?this.unpack(t,r):nv.unpack(t,r);if(!e){for(i=[s];mt<r;)n=mt,i.push(iv());return i}if(e(s,n,mt)===!1)return;for(;mt<r;)if(n=mt,e(iv(),n,mt)===!1)return}catch(r){throw r.lastPosition=n,r.values=i,r}finally{Zo=!1,PE()}}_mergeStructures(t,e){t=t||[],Object.isFrozen(t)&&(t=t.map(i=>i.slice(0)));for(let i=0,n=t.length;i<n;i++){let r=t[i];r&&(r.isShared=!0,i>=32&&(r.highByte=i-32>>5))}t.sharedLength=t.length;for(let i in e||[])if(i>=0){let n=t[i],r=e[i];r&&(n&&((t.restoreStructures||(t.restoreStructures=[]))[i]=n),t[i]=r)}return this.structures=t}decode(t,e){return this.unpack(t,e)}},EF=/^[a-zA-Z_$][a-zA-Z\d_$]*$/,IE=(t,e)=>function(){let i=kt[mt++];if(i===0)return e();let n=t<32?-(t+(i<<5)):t+(i<<5),r=Qe[n]||_F()[n];if(!r)throw new Error("Record id is not defined for "+n);return r.read||(r.read=CE(r,t)),r.read()},M_=Am,AF=Am,TF=Am,CF=Am,Fn=String.fromCharCode,OE=new Array(4096),LE=(t,e)=>{let i=pn().map(wF),n=t;e!==void 0&&(t=t<32?-((e<<5)+t):(e<<5)+t,i.highByte=e);let r=Qe[t];return r&&(r.isShared||Zo)&&((Qe.restoreStructures||(Qe.restoreStructures=[]))[t]=r),Qe[t]=i,i.read=CE(i,n),(i.read0||i.read)()},gr[0]=()=>{},gr[0].noBuffer=!0,gr[66]=t=>{let e=t.byteLength%8||8,i=BigInt(128&t[0]?t[0]-256:t[0]);for(let n=1;n<e;n++)i<<=BigInt(8),i+=BigInt(t[n]);if(t.byteLength!==e){let n=new DataView(t.buffer,t.byteOffset,t.byteLength),r=(s,a)=>{let o=a-s;if(o<=40){let d=n.getBigUint64(s);for(let u=s+8;u<a;u+=8)d<<=BigInt(64),d|=n.getBigUint64(u);return d}let l=s+(o>>4<<3),c=r(s,l),h=r(l,a);return c<<BigInt(8*(a-l))|h};i=i<<BigInt(8*(n.byteLength-e))|r(e,n.byteLength)}return i},Yw={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError:typeof AggregateError=="function"?AggregateError:null},gr[101]=()=>{let t=pn();if(!Yw[t[0]]){let e=Error(t[1],{cause:t[2]});return e.name=t[0],e}return Yw[t[0]](t[1],{cause:t[2]})},gr[105]=t=>{if(bi.structuredClone===!1)throw new Error("Structured clone extension is disabled");let e=He.getUint32(mt-4);Yo||(Yo=new Map);let i,n=kt[mt];i=n>=144&&n<160||n==220||n==221?[]:n>=128&&n<144||n==222||n==223?new Map:(n>=199&&n<=201||n>=212&&n<=216)&&kt[mt+1]===115?new Set:{};let r={target:i};Yo.set(e,r);let s=pn();if(!r.used)return r.target=s;if(Object.assign(i,s),i instanceof Map)for(let[a,o]of s.entries())i.set(a,o);if(i instanceof Set)for(let a of Array.from(s))i.add(a);return i},gr[112]=t=>{if(bi.structuredClone===!1)throw new Error("Structured clone extension is disabled");let e=He.getUint32(mt-4),i=Yo.get(e);return i.used=!0,i.target},gr[115]=()=>new Set(pn()),HR=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(t=>t+"Array"),WR=typeof globalThis=="object"?globalThis:window,gr[116]=t=>{let e=t[0],i=Uint8Array.prototype.slice.call(t,1).buffer,n=HR[e];if(!n){if(e===16)return i;if(e===17)return new DataView(i);throw new Error("Could not find typed array for code "+e)}return new WR[n](i)},gr[120]=()=>{let t=pn();return new RegExp(t[0],t[1])},qR=[],gr[98]=t=>{let e=(t[0]<<24)+(t[1]<<16)+(t[2]<<8)+t[3],i=mt;return mt+=e-t.length,yr=qR,(yr=[kR(),kR()]).position0=0,yr.position1=0,yr.postBundlePosition=mt,mt=i,pn()},gr[255]=t=>t.length==4?new Date(1e3*(16777216*t[0]+(t[1]<<16)+(t[2]<<8)+t[3])):t.length==8?new Date(((t[0]<<22)+(t[1]<<14)+(t[2]<<6)+(t[3]>>2))/1e6+1e3*(4294967296*(3&t[3])+16777216*t[4]+(t[5]<<16)+(t[6]<<8)+t[7])):t.length==12?new Date(((t[0]<<24)+(t[1]<<16)+(t[2]<<8)+t[3])/1e6+1e3*((128&t[4]?-281474976710656:0)+1099511627776*t[6]+4294967296*t[7]+16777216*t[8]+(t[9]<<16)+(t[10]<<8)+t[11])):new Date("invalid"),BE=new Array(147);for(let t=0;t<256;t++)BE[t]=+("1e"+Math.floor(45.15-.30103*t));(nv=new Tm({useRecords:!1})).unpack,nv.unpackMultiple,nv.unpack,XR=new Float32Array(1),new Uint8Array(XR.buffer,0,4)}),mX=F(()=>{fX(),pC(),yC(),$c(),zb(),Xc(),$R=[{Class:te.prototype.constructor,type:1,write:t=>({...t}),read:t=>(Object.setPrototypeOf(t,te.prototype),t)},{Class:Vt.prototype.constructor,type:2,write:t=>[...t],read:t=>(Object.setPrototypeOf(t,Vt.prototype),t)},{Class:Wn.prototype.constructor,type:3,write:t=>[...t],read:t=>(Object.setPrototypeOf(t,Wn.prototype),t)},{Class:__.prototype.constructor,type:4,write:t=>t.id,read:t=>new __(t)},{Class:EE.prototype.constructor,type:5,write:t=>t.data,read:t=>new EE(t)},{Class:fn.prototype.constructor,type:6,write:t=>({...t}),read:t=>(Object.setPrototypeOf(t,fn.prototype),t)}];for(let t of $R)pX(t);YR=new Tm({structuredClone:!0}),(UE||(UE={})).deserialize=function(t){return YR.unpack(t)}}),gX=F(()=>{mX(),Zw=t=>()=>{throw new Error(t+" is not available in the runtime build (decode-only CollabSerialize)")},Tg={deserialize:UE.deserialize,serialize:Zw("CollabSerialize.serialize"),checksum:Zw("CollabSerialize.checksum")}}),Ye=F(()=>{kb(),lX(),fC(),Xc(),zb(),mC(),$c(),cX(),dX(),yF(),uX(),pC(),gX(),pF(),yC()});function zE(t){return t==="MouseDown"||t==="MouseUp"||t==="KeyDown"||t==="KeyUp"||t==="Collision"||t==="Trigger"}var ZR,FE,Iu,rv,Kw,KR,QR,JR,NE,kE,tI,eI,iI,nI,rI,VE,jE,sI,aI,oI,lI,PF=F(()=>{var t,e,i;Ye(),et(),(t=ZR||(ZR={})).toEventUIType=function(n){return n.type==="Conditional"?n.condition.type==="Distance"?"Distance":"StateChange":n.type},t.fromEventUIType=function(n){return n==="Distance"||n==="StateChange"?"Conditional":n},FE={LookAt:[],Follow:["Create"],DragDrop:["Transition","Animation","Audio","Particles","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MouseHover:["Transition","Animation","TimelineAnimation","Particles","Create","Destroy","SwitchCamera","SceneTransition","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Scroll:["Transition","Animation","TimelineAnimation","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Start:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Conditional:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MouseDown:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MouseUp:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MousePress:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],KeyDown:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],KeyUp:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],KeyPress:["Transition","Animation","Audio","Particles","Video","Link","Create","SwitchCamera","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],GameControl:["Transition","Animation","TimelineAnimation","Audio","Particles","Create","Conditional"],Collision:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Create","Destroy","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Trigger:["Transition","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Resize:["Transition","Animation","Audio","Particles","Video","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],VariableChange:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],API:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],WEBHOOK:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],AIAssistantListener:["SetVariable"],AIAssistantTrigger:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"]},(n=>{n.is=function(r){return r.type==="MouseDown"||r.type==="MouseUp"||r.type==="MousePress"||r.type==="KeyDown"||r.type==="KeyUp"||r.type==="KeyPress"},n.defaultData=function(r){return r==="MouseDown"||r==="MouseUp"||r==="MousePress"?{type:r,mode:"Object",disabled:!1,name:"",actions:new Vt}:{type:r,disabled:!1,name:"",key:void 0,actions:new Vt}}})(Iu||(Iu={})),(n=>{n.propertyDefaultData=function(r){return{type:"Property",value:[r??null,"position","x"]}},n.valueDefaultData={type:"Literal",value:0}})(rv||(rv={})),(e=Kw||(Kw={})).comparisonDefaultData=function(n){return{type:"Comparison",operator:"==",lOperand:rv.propertyDefaultData(n),rOperand:{...rv.valueDefaultData}}},e.distanceDefaultData=function(n){return{type:"Distance",toObject:n??null,fromObject:n??null,distance:200}},e.stateDefaultData=function(n,r){return{type:"State",object:n??null,state:r??null}},(KR||(KR={})).isConditionalSubActions=function(n){return n.find(r=>r==="ifActions"||r==="elseActions")!==void 0},(n=>{n.is=function(r){return r.type==="Conditional"},n.defaultData=function(r){return{type:"Conditional",disabled:!1,name:"",inActions:new Vt,outActions:new Vt,condition:Kw.distanceDefaultData(r)}}})(QR||(QR={})),(JR||(JR={})).defaultData={type:"DragDrop",name:"",cursor:"hand",disabled:!1,dampingFactor:1,objects:[],snapTo:"center",snapSurfaceMode:"bbox",snapSurfaceOffset:0,dropOn:"all",autoOrient:!0,dropDestinations:[],plane:"adaptive",planeMode:"locked",referenceFrame:"global",limits:[-1/0,1/0,-1/0,1/0,-1/0,1/0],drop:!1,resetOnSnapFail:!1,snapSpeed:20,resetSpeed:20,dragDropActions:{drag:new Vt,drop:new Vt}},(NE||(NE={})).defaultData={type:"Follow",disabled:!1,name:"",maxDelta:0,dampingFactor:1,target:"cursor",plane:"custom",resetOnPointerLeave:!0,resetAfterDistanceLimit:!0,enabledTranslation:[!0,!0,!0],limitDistanceEnabled:!1,limitDistance:1e3,snapDelay:0,resetSpeed:5,actions:new Vt},(kE||(kE={})).defaultData={type:"LookAt",disabled:!1,name:"",distance:1e3,dampingFactor:1,target:"cursor",tilt:"up",axis:"z",plane:"custom",resetOnPointerLeave:!0,resetAfterDistanceLimit:!0,enabledRotation:[!0,!0,!0],limitDistanceEnabled:!1,limitDistance:1e3,snapDelay:0,resetSpeed:5},(n=>{n.is=function(r){return r.type==="MouseHover"},n.defaultData=function(){return{type:"MouseHover",disabled:!1,name:"",actions:new Vt}}})(tI||(tI={})),(n=>{n.is=function(r){return r.type==="Scroll"},n.defaultData=function(){return{type:"Scroll",disabled:!1,name:"",steps:100,trigger:"load",startFrom:"enter",enterAnchor:"top",startOffset:0,endAfter:400,actions:new Vt}}})(eI||(eI={})),(n=>{n.is=function(r){return r.type==="Start"},n.defaultData=function(){return{type:"Start",disabled:!1,name:"",actions:new Vt}}})(iI||(iI={})),(n=>{n.is=function(r){return r.type==="Collision"},n.defaultData=function(){return{type:"Collision",disabled:!1,name:"",target:"character",actions:new Vt}}})(nI||(nI={})),(n=>{n.is=function(r){return r.type==="Trigger"},n.defaultData=function(r,s){return{type:"Trigger",name:"",disabled:!1,target:"all",triggeringObjects:[],actions:new Vt,triggerZone:"box",position:s.toArray(),rotation:[0,0,0],size:r.toArray(),radius:r.length()/2,helperVisible:!0}}})(rI||(rI={})),(i=VE||(VE={})).defaultSizes={mobile:[480,480],tablet:[768,768],desktop:[1200,1200],custom:[769,1200]},i.is=function(n){return n.type==="Resize"},i.sizeToDevice=function(n){return typeof n=="string"?n:"custom"},i.deviceToSize=function(n){return typeof n=="string"?[...i.defaultSizes[n]]:[...n]},i.defaultData=function(){let n={size:"mobile",operator:"<",actions:new Vt},r={size:"tablet",operator:"<",actions:new Vt},s={size:[...i.defaultSizes.custom],operator:"<>",actions:new Vt},a=new Vt;return a.push({id:Ot.generateUUID(),fi:0,data:n},{id:Ot.generateUUID(),fi:1,data:r},{id:Ot.generateUUID(),fi:2,data:s}),{type:"Resize",disabled:!1,name:"",orientation:"horizontal",breakpoints:a}},i.defaultBreakpointData=function(){return{size:[...i.defaultSizes.custom],operator:"<>",actions:new Vt}},(n=>{n.propertyPaths={Position:["position"],"Position X":["position","x"],"Position Y":["position","y"],"Position Z":["position","z"],Rotation:["rotation"],"Rotation X":["rotation","x"],"Rotation Y":["rotation","y"],"Rotation Z":["rotation","z"],Scale:["scale"],"Scale X":["scale","x"],"Scale Y":["scale","y"],"Scale Z":["scale","z"],Width:["width"],Height:["height"],Depth:["depth"],"Mouse Position X":["mouse","x"],"Mouse Position Y":["mouse","y"],"Mouse Pressed":["mouse","pressed"],"Screen Width":["mouse","width"],"Screen Height":["mouse","height"],"Hit Position X":["raycast","x"],"Hit Position Y":["raycast","y"],"Hit Position Z":["raycast","z"],"Hit Object Position X":["raycast","objX"],"Hit Object Position Y":["raycast","objY"],"Hit Object Position Z":["raycast","objZ"]},n.is=function(r){return r.type==="VariableChange"},n.defaultData=function(){return{disabled:!1,type:"VariableChange",name:"",actions:new Vt,variableId:"",objectId:null,property:"Position X"}}})(jE||(jE={})),(n=>{n.is=function(r){return r.type==="API"},n.defaultData=function(){return{disabled:!1,type:"API",name:"",successActions:new Vt,errorActions:new Vt,userAPIId:""}}})(sI||(sI={})),(n=>{n.is=function(r){return r.type==="WEBHOOK"},n.defaultData=function(){return{disabled:!1,type:"WEBHOOK",name:"",actions:new Vt,userWebhookId:""}}})(aI||(aI={})),(n=>{n.is=function(r){return r.type==="AIAssistantListener"},n.defaultData=function(){return{disabled:!1,type:"AIAssistantListener",name:"",actions:new Vt,analysis:"average",analysisRange:[0,71],analysisSingle:0}}})(oI||(oI={})),(n=>{n.is=function(r){return r.type==="AIAssistantTrigger"},n.defaultData=function(){return{disabled:!1,description:"",name:"",type:"AIAssistantTrigger",actions:new Vt}}})(lI||(lI={}))});function hI(t){let e=typeof t;return t!==null&&(e==="object"||e==="function")}function cI(t){return typeof t=="string"&&t.length===36&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t)}var Yc,Wu,DF,Rr,dI,Ja,ah,Cg,uI,qu,An,Je,GE,pI,$l,dp,fI,mI,gI,vI,yI,_I,bI,xI,Qw,wI,SI,Jw,MI,EI,AI,tS,TI,eS,CI,PI,DI,RI,II,OI,LI,BI,UI,Vc,Ko,Yl,HE,WE,E_,A_,T_,C_,P_,qE,XE,D_,$E,Xu,zI,iS,nS,YE,FI,R_,NI,kI,I_,VI,jI,GI,HI,WI,qI,XI,$I,YI,Vb,bC,Ki,ki,wu,RF,Pg,O_,yc,ZE,xC,L_,B_,KE,Ho,l1,tr,rS,kl,U_,eg,sS,aS,oS,$u,lS,QE,JE,ZI,Rd,IF,Mn,z_,KI,QI,JI,tO,Ha,ig,F_,N_,Qo,Ic,eO,Zl,k_,Jo,hS,cS,bc,jc,xc,ng,tA,iO,_r,dS,nO,rO,Wo,Fs,Yu,eA,_s=F(()=>{var t,e,i,n,r,s,a,o;Yc="personal camera",Wu="a218fcc3-276b-49b9-b485-49037fd14f5f",DF=2500134,Rr=5526619,(t=dI||{}).x="x",t.y="y",t.z="z",dI=t,(l=>{function c(u,p){return Math.pow(p[0]-u[0],2)+Math.pow(p[1]-u[1],2)}function h(u,p){return Math.sqrt(c(u,p))}function d(u,p,f){let g=l.sub(p,u),m=l.sub(f,u),y=l.dot(g,m)/l.dot(g,g),v=l.scalarMultiply(g,y);return l.add(u,v)}l.isEqual=function(u,p){return u[0]===p[0]&&u[1]===p[1]},l.lerp=function(u,p,f){return[u[0]+(p[0]-u[0])*f,u[1]+(p[1]-u[1])*f]},l.add=function(u,p){return[u[0]+p[0],u[1]+p[1]]},l.sub=function(u,p){return[u[0]-p[0],u[1]-p[1]]},l.multiply=function(u,p){return[u[0]*p[0],u[1]*p[1]]},l.divide=function(u,p){return[u[0]/p[0],u[1]/p[1]]},l.distanceSquared=c,l.distance=h,l.dot=function(u,p){return u[0]*p[0]+u[1]*p[1]},l.scalarMultiply=function(u,p){return[u[0]*p,u[1]*p]},l.projectionOnto=d,l.projectionOntoDistance=function(u,p,f){return h(u,d(u,p,f))},l.center=function(u,p){return[.5*(u[0]+p[0]),.5*(u[1]+p[1])]}})(Ja||(Ja={})),(e=ah||(ah={})).isEqual=function(l,c){return l[0]===c[0]&&l[1]===c[1]&&l[2]===c[2]},e.add=function(l,c){return[l[0]+c[0],l[1]+c[1],l[2]+c[2]]},e.sub=function(l,c){return[l[0]-c[0],l[1]-c[1],l[2]-c[2]]},e.div=function(l,c){return[l[0]/c[0],l[1]/c[1],l[2]/c[2]]},e.mul=function(l,c){return[l[0]*c[0],l[1]*c[1],l[2]*c[2]]},e.dist=function(l,c){return Math.hypot(l[0]-c[0],l[1]-c[1],l[2]-c[2])},e.lerp=function(l,c,h){return[l[0]+(c[0]-l[0])*h,l[1]+(c[1]-l[1])*h,l[2]+(c[2]-l[2])*h]},(i=Cg||(Cg={})).isEqual=function(l,c){return l[0]===c[0]&&l[1]===c[1]&&l[2]===c[2]&&l[3]===c[3]},i.lerp=function(l,c,h){return[l[0]+(c[0]-l[0])*h,l[1]+(c[1]-l[1])*h,l[2]+(c[2]-l[2])*h,l[3]+(c[3]-l[3])*h]},(l=>{let c=180/Math.PI,h=Math.PI/180;function d(p){return typeof p=="number"?p*c:p}function u(p){return typeof p=="number"?p*h:p}l.radToDeg=function(p){return[d(p[0]),d(p[1]),d(p[2])]},l.degToRad=function(p){return[u(p[0]),u(p[1]),u(p[2])]}})(uI||(uI={})),(n=qu||(qu={})).identity=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],n.isEqual=function(l,c){for(let h=0;h<16;h++)if(l[h]!==c[h])return!1;return!0},n.simplify=function(l){return l??n.identity},n.applyMatrix4=function(l,c){let h=c.slice(0);for(let d=0,u=c.length;d<u;d+=3){let p=l[3]*c[d]+l[7]*c[d+1]+l[11]*c[d+2]+l[15];h[d]=(l[0]*c[d]+l[4]*c[d+1]+l[8]*c[d+2]+l[12])/p,h[d+1]=(l[1]*c[d]+l[5]*c[d+1]+l[9]*c[d+2]+l[13])/p,h[d+2]=(l[2]*c[d]+l[6]*c[d+1]+l[10]*c[d+2]+l[14])/p}return h},(r=An||(An={})).isRGB=function(l){return typeof l=="object"&&typeof l.r=="number"&&typeof l.g=="number"&&typeof l.b=="number"},r.white={r:1,g:1,b:1},r.red={r:1,g:0,b:0},r.black={r:0,g:0,b:0},r.toRgb255a1=function(l){return{r:Math.round(255*l.r),g:Math.round(255*l.g),b:Math.round(255*l.b),a:1}},r.clone=function(l){return{r:l.r,g:l.g,b:l.b}},r.fromHex=function(l){return{r:((l=Math.floor(l))>>16&255)/255,g:(l>>8&255)/255,b:(255&l)/255}},r.toHex=function(l){return 65536*Math.round(255*l.r)+256*Math.round(255*l.g)+Math.round(255*l.b)},r.equals=function(l,c){return l.r===c.r&&l.g===c.g&&l.b===c.b},r.equalsFixed=function(l,c){return l.r.toFixed(2)===c.r.toFixed(2)&&l.g.toFixed(2)===c.g.toFixed(2)&&l.b.toFixed(2)===c.b.toFixed(2)},r.lerp=function(l,c,h){return{r:l.r+(c.r-l.r)*h,g:l.g+(c.g-l.g)*h,b:l.b+(c.b-l.b)*h}},r.is=function(l){return!!hI(l)&&"r"in l&&"g"in l&&"b"in l&&!("a"in l)},(s=Je||(Je={})).white={...An.white,a:1},s.is=function(l){return!!hI(l)&&"r"in l&&"g"in l&&"b"in l&&"a"in l},s.transparent={...An.white,a:0},s.from0to1=function(l){return{r:l[0],g:l[1],b:l[2],a:l[3]}},s.fromHexAndA=function(l,c){return{...An.fromHex(l),a:c}},s.toRgb255a1=function(l){return{r:Math.round(255*l.r),g:Math.round(255*l.g),b:Math.round(255*l.b),a:l.a}},s.equals=function(l,c){return An.equals(l,c)&&l.a===c.a},s.equalsFixed=function(l,c){return An.equalsFixed(l,c)&&l.a.toFixed(2)===c.a.toFixed(2)},s.lerp=function(l,c,h){return{r:l.r+(c.r-l.r)*h,g:l.g+(c.g-l.g)*h,b:l.b+(c.b-l.b)*h,a:l.a+(c.a-l.a)*h}},s.toStyle=function({r:l,g:c,b:h,a:d}=s.white){return`rgba(${255*l}, ${255*c}, ${255*h}, ${d})`},(GE||(GE={})).identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1],pivot:[0,0,0],pivotRotation:[0,0,0]},(a=pI||{})[a.LINEAR=0]="LINEAR",a[a.EASE=1]="EASE",a[a.EASE_IN=2]="EASE_IN",a[a.EASE_OUT=3]="EASE_OUT",a[a.EASE_IN_OUT=4]="EASE_IN_OUT",a[a.CUBIC=5]="CUBIC",a[a.SPRING=6]="SPRING",a[a.ARC=7]="ARC",a[a.NONE=8]="NONE",pI=a,($l||($l={})).defaultData={mass:1,stiffness:80,damping:10,velocity:0},(dp||(dp={})).defaultData={control1:[.5,0],control2:[.5,1]},(o=fI||(fI={})).linear=[0,0,1,1],o.ease=[.25,.1,.25,1],o.easeIn=[.42,0,1,1],o.easeOut=[0,0,.58,1],o.easeInOut=[.42,0,.58,1]}),vX=F(()=>{var t,e;Ye(),PF(),(mI||(mI={})).defaultData={type:"SwitchCamera",name:"",targetCamera:"",delay:0,animate:!0,duration:1e3,easing:4,runMode:"Normal"},(gI||(gI={})).defaultData={type:"SceneTransition",name:"",target:"",delay:0,duration:1,transition:"none"},(vI||(vI={})).defaultData={type:"Link",name:"",url:null,context:"tab"},(yI||(yI={})).defaultData={type:"Destroy",name:"",objects:[],delay:0},(_I||(_I={})).defaultData={type:"Particles",name:"",emitterObjectId:"",delay:0,emission:"start",triggerAfter:"any"},(bI||(bI={})).defaultData={type:"Create",name:"",object:"",delay:0,creationSpeed:10,coordinateSystem:"world",dynamic:!0,destroy:"No",destroyAfterQuantity:5,lifetime:2,position:[0,0,0],rotation:[0,0,0],velocity:[1e3,0,0],hideBase:"No"},(xI||(xI={})).defaultData={type:"Reset",name:"",delay:0},(Qw||(Qw={})).defaultData={interaction:"play",delay:0,volume:.5,loop:1},(t=wI||(wI={})).pauseDefaultData={interaction:"pause",delay:0},t.stopDefaultData={interaction:"stop",delay:0},(e=SI||(SI={})).defaultData={type:"Audio",name:"",...Qw.defaultData},e.hasAudioByActions=i=>i.some(({data:n})=>n.type==="Audio"&&n.interaction==="play"&&n.audio),e.hasAudioByEvents=i=>{for(let{data:n}of i)if(Iu.is(n)||n.type==="Start"||n.type==="Collision"){if(e.hasAudioByActions(n.actions))return!0}else if(n.type==="Conditional"){if(e.hasAudioByActions(n.inActions)||e.hasAudioByActions(n.outActions))return!0}else if(n.type==="GameControl"&&Object.values(n.gameActions).find(r=>e.hasAudioByActions(r)))return!0},e.getAudiosByActions=i=>{let n=[];return i.forEach(r=>{let s=r.data;s.type==="Audio"&&s.interaction==="play"&&s.audio&&n.push(r),s.type==="Conditional"&&(n.push(...e.getAudiosByActions(s.ifActions)),n.push(...e.getAudiosByActions(s.elseActions)))}),n},e.getAudiosByEvents=i=>{let n=[];return i.forEach(({data:r})=>{Iu.is(r)||r.type==="Collision"||r.type==="Start"||r.type==="Trigger"?n.push(...e.getAudiosByActions(r.actions)):r.type==="Conditional"?(n.push(...e.getAudiosByActions(r.inActions)),n.push(...e.getAudiosByActions(r.outActions))):r.type==="GameControl"?Object.values(r.gameActions).forEach(s=>{n.push(...e.getAudiosByActions(s))}):r.type==="DragDrop"&&(n.push(...e.getAudiosByActions(r.dragDropActions.drag)),n.push(...e.getAudiosByActions(r.dragDropActions.drop)))}),n},(Jw||(Jw={})).defaultData={interaction:"play",delay:0,volume:.5,loop:1/0},(i=>{i.pauseDefaultData={interaction:"pause",delay:0},i.stopDefaultData={interaction:"stop",delay:0}})(MI||(MI={})),(i=>{i.defaultData={type:"Video",name:"",triggerAfter:"autoplay",...Jw.defaultData},i.hasVideoByActions=n=>n.some(({data:r})=>r.type==="Video"&&r.interaction==="play"&&r.layerId),i.hasVideoByObject=n=>{if(n.events){for(let{data:r}of n.events)if((Iu.is(r)||r.type==="Start")&&i.hasVideoByActions(r.actions))return!0}},i.getVideosByActions=n=>{let r=[];return n.forEach(s=>{let a=s.data;a.type==="Video"&&a.interaction==="play"&&a.layerId&&r.push(s)}),r},i.getVideosByEvents=n=>{let r=[];return n.forEach(({data:s})=>{(Iu.is(s)||s.type==="Start")&&r.push(...i.getVideosByActions(s.actions))}),r}})(EI||(EI={})),(AI||(AI={})).defaultData=function(i){return{state:i,repeat:0,delay:0,delayDirection:"start-once",direction:"normal",duration:1e3,easing:4}},(tS||(tS={})).defaultData=function(){return{tweens:new Vt,repeat:0,delay:0,delayDirection:"start-once",direction:"normal"}},(TI||(TI={})).defaultData=function(i){return{type:"Transition",name:"",runMode:"Once",object:i??null,...tS.defaultData()}},(eS||(eS={})).defaultData=function(i){return{interaction:"play",timeline:i,repeat:0,delay:0,delayDirection:"start-once",direction:"normal",runMode:"Once"}},(i=>{i.pauseDefaultData={interaction:"pause",delay:0},i.stopDefaultData={interaction:"stop",delay:0}})(CI||(CI={})),(PI||(PI={})).defaultData=function(i){return{type:"TimelineAnimation",name:"",...eS.defaultData(i)}},(DI||(DI={})).defaultData=function(i,n,r){return{type:"Animation",name:"",object:i,clipId:n,crop:r,crop2:r,repeat:-1,delay:0,delayDirection:"start-once",direction:"normal",runMode:"Normal"}},(RI||(RI={})).defaultData={type:"SetVariable",name:"",variableId:"",expression:[]},(II||(II={})).defaultData=()=>({type:"Conditional",name:"",ifActions:new Vt,elseActions:new Vt,condition:[]}),(OI||(OI={})).defaultData={type:"DynamicVariablePlay",name:"",variableId:"",mode:"PlayPause",delay:0,pauseDelay:0},(LI||(LI={})).defaultData={type:"ClearLocalStorage",name:"",target:"all"},(BI||(BI={})).defaultData={name:"",type:"UserAPI"}}),yX=F(()=>{var t;(t=UI||(UI={})).emptyAudio={data:Uint8Array.from(atob("UklGRjIAAABXQVZFZm10IBIAAAABAAEAQB8AAEAfAAABAAgAAABmYWN0BAAAAAAAAABkYXRhAAAAAA=="),e=>e.charCodeAt(0)),mimeType:"audio/wav",filename:"unknown"},t.maxSize=2e6}),OF=F(()=>{var t;(t=Vc||(Vc={})).all=["PerspectiveCamera","OrthographicCamera"],t.is=function(e){return t.all.includes(e)},(e=>{e.DefaultUp=[0,1,0],e.DefaultTargetOffset=1e3,e.MinTargetOffset=.001,e.sanitizeTargetOffset=function(s){return s===void 0||!Number.isFinite(s)||s<e.MinTargetOffset?e.DefaultTargetOffset:s},e.DefaultAzimuth=-24,e.DefaultElevation=15;let i=e.DefaultAzimuth*Math.PI/180,n=e.DefaultElevation*Math.PI/180,r=180/Math.PI;e.DefaultPosition=[e.DefaultTargetOffset*Math.sin(i)*Math.cos(n),e.DefaultTargetOffset*Math.sin(n),e.DefaultTargetOffset*Math.cos(i)*Math.cos(n)],e.DefaultRotation=[Math.atan2(-Math.sin(n),Math.cos(i)*Math.cos(n))*r,Math.asin(Math.sin(i)*Math.cos(n))*r,Math.atan2(Math.sin(i)*Math.sin(n),Math.cos(i))*r],e.defaultData={far:1e5,type:"PerspectiveCamera",perspective:{near:70,fov:45,zoom:1},orthographic:{near:-1e5,zoom:1},up:e.DefaultUp,isUpVectorFlipped:!1,targetOffset:e.DefaultTargetOffset},e.getZoom=function(s){return s.type==="PerspectiveCamera"?s.perspective?.zoom??1:s.orthographic?.zoom??1}})(Ko||(Ko={}))}),LF=F(()=>{var t;(t=Yl||(Yl={})).defaultData=function(e,i=.1){return{disabled:!1,type:"linear",hideBase:!1,instanced:!1,count:3,radial:{radius:2*Math.max(typeof e[0]=="number"?e[0]:1,typeof e[1]=="number"?e[1]:1),start:0,end:360,alignment:!1,axis:"y",scale:[1,1,1],rotation:[0,0,0],position:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},toObject:{object:"",spreadType:"random",scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],axis:"x",seed:0,count:99,align:"normal",pivot:[0,0,0],pivotRotation:[0,0,0]},linear:{scale:[1,1,1],rotation:[0,0,0],position:[(typeof e[0]=="number"?e[0]+e[0]:1)*i,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},grid:{count:[2,2,2],size:e.map(n=>(typeof n=="number"?n:1)*(1+i)),useCenter:!0},randomness:!1,randomnessObject:{strength:100,scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],movement:1,seed:0,freqScale:10,noiseType:"perlin"}}},t.merge=function(e,i){let n={...e};if(WE.forEach(r=>{Object.assign(n,{[r]:i[r]??e[r]})}),n.radial={...e.radial},i.radial){let r=e.radial,s=i.radial;E_.forEach(a=>{Object.assign(n.radial,{[a]:s[a]??r[a]})})}if(n.linear={...e.linear},i.linear){let r=e.linear,s=i.linear;A_.forEach(a=>{Object.assign(n.linear,{[a]:s[a]??r[a]})})}if(n.grid={...e.grid},i.grid){let r=e.grid,s=i.grid;T_.forEach(a=>{Object.assign(n.grid,{[a]:s[a]??r[a]})})}if(n.toObject={...e.toObject},i.toObject){let r=e.toObject,s=i.toObject;C_.forEach(a=>{Object.assign(n.toObject,{[a]:s[a]??r[a]})})}if(n.randomnessObject={...e.randomnessObject},i.randomnessObject){let r=e.randomnessObject,s=i.randomnessObject;P_.forEach(a=>{Object.assign(n.randomnessObject,{[a]:s[a]??r[a]})})}return n},t.isPartial=function(e){return!(!e.randomnessObject&&!e.toObject)},(e=>{e.defaultData={radial:{},linear:{},grid:{},toObject:{},randomnessObject:{}};let i=["radial","linear","grid","toObject","randomnessObject"];e.toOps=function(n,r){let s=[];n.count!==void 0&&s.push({type:0,path:r,props:{count:n.count}});for(let a of i){let o=n[a];o&&Object.keys(o).length>0&&s.push({type:0,path:[...r,a],props:o})}return s}})(HE||(HE={})),WE=["count"],E_=["radius","start","end","position","scale","rotation"],A_=["position","scale","rotation"],T_=["count","size"],C_=["count","position","scale","rotation"],P_=["strength","scale","rotation","position","movement","seed","freqScale"]}),BF=F(()=>{var t;_s(),(t=qE||(qE={})).all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"],t.is=function(e){return t.all.includes(e)},(XE||(XE={})).defaultData=function(e){return function(i){if(i==="PointLight")return{type:i,color:Je.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,penumbraSize:.5,depth:1e5};if(i==="SpotLight")return{type:i,color:Je.white,intensity:1,distance:2e3,decay:1,shadows:!0,penumbra:0,angle:30/180*Math.PI,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};if(i==="DirectionalLight")return{type:i,color:Je.white,intensity:1,shadows:!0,size:2e3,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};throw new Error("not implemented")}(e)}}),UF=F(()=>{var t;(t=D_||(D_={})).defaultShapeData={type:"PlaneEmitterShape",size:[100,100,100]},t.defaultCollisionData={colliderEntityId:null,collisionBounce:.75},t.defaultData={renderMaterial:{type:"particleMaterial",color:{r:1,g:.2,b:.545,a:1},color2:{r:.945,g:.714,b:.184,a:1},coloring:"gradient",ease:"linearFadeOut",easeSize:"linearFadeOut",transparent:!0,size:[40,40],texture:"pt_default_particle",spriteRotation:[0,0]},birthRatePerSec:50,gravity:1,noiseStrength:0,noiseScale:0,noiseSeed:1,noiseType:"curl",randomRotation:0,randomScale:.2,randomMass:.5,rootObjectType:"instancedMesh",life:1,direction:[0,0,0],directionMode:"axis",speed:10,shape:t.defaultShapeData,autoPlay:!0,emitTimeDelay:0,emitTimeCycle:"infinity",emitTimeDuration:1,...t.defaultCollisionData}}),zF=F(()=>{var t;(t=$E||($E={})).defaultData={gravity:10,damping:.03,localStiffness:.67,globalStiffness:.5,globalRange:.15,stiffnessFalloff:.1,windStrength:0,vspCoefficient:.01,elasticity:.15,hairLength:.75,tipSeparation:.8,kink:0,kinkFrequency:0,clumpStrength:0,clumpSize:32,clumpTipScale:1.5,spreadRadius:.03,guideStrands:8192,headShape:"sphere",baseObjectId:null,hairColorSource:"custom",hairShadeRoot:.6,hairShadeTip:1.15,hairRootColor:{r:.29,g:.102,b:.039,a:1},hairMidColor:{r:.8,g:.267,b:.133,a:1},hairTipColor:{r:.545,g:.18,b:.18,a:1},headColor:{r:.325,g:.137,b:.114,a:1},noiseEnabled:!1,noiseColorA:{r:.545,g:.184,b:.788,a:1},noiseColorB:{r:.914,g:.188,b:.914,a:1},noiseColorC:{r:.2,g:.4,b:1,a:1},noiseColorD:{r:.2,g:1,b:.6,a:1},noiseScale:1.8,noiseMixHair:.75,noiseMixHead:.8,castShadow:!0,receiveShadow:!0,hairWidth:1.75,specularPower:40,specularIntensity:.4,diffuseIntensity:.6,ambientIntensity:.25,opacity:1,tipFade:.4,autoPlay:!0},t.regenProps=["hairLength","spreadRadius","guideStrands","headShape","baseObjectId"]}),wC=F(()=>{(Xu||(Xu={})).defaultData={enabled:"visibility",fusedBody:!0,rigidBody:"positioned",density:1,pointMass:0,gravityScale:1,friction:.5,damping:0,restitution:.2,colliderType:"convex",enabledRotation:[!0,!0,!0],enabledTranslation:[!0,!0,!0]}}),FF=F(()=>{var t,e;(t=zI||{})[t.Front=0]="Front",t[t.Back=1]="Back",t[t.Double=2]="Double",zI=t,(e=iS||(iS={})).defaultData={castShadow:!0,receiveShadow:!0},e.equals=function(i,n){return i.castShadow===n.castShadow&&i.receiveShadow===n.receiveShadow},(i=>{i.defaultData={flatShading:!1,wireframe:!1,side:0},i.equals=function(n,r){return n.flatShading===r.flatShading&&n.side===r.side&&n.wireframe===r.wireframe&&(n.shadowCatcher??!1)===(r.shadowCatcher??!1)}})(nS||(nS={})),(YE||(YE={})).defaultData={...nS.defaultData,...iS.defaultData},(FI||(FI={})).getMaterialData=function(i,n){let r=[];if("material"in i){let s=typeof i.material=="string"?n.materials[i.material]??n.lib.materials[i.material]?.asset:i.material;s&&r.push(s)}else if("materials"in i)for(let s of i.materials){let a=typeof s=="string"?n.materials[s]??n.lib.materials[s]?.asset:s;a&&r.push(a)}return r}}),NF=F(()=>{var t;(t=R_||(R_={})).defaultVideo={data:"",thumb:"/_assets/_videos/catThumb.png",type:"video",name:"Cat video"},t.maxSize=3e7}),Gg=F(()=>{var t,e,i,n;Ye(),_s(),NF(),_s(),(NI||(NI={})).is=function(r){return r==="texture"||r==="video"||r==="color"||r==="depth"||r==="normal"||r==="gradient"||r==="noise"||r==="fresnel"||r==="cavity"||r==="dust"||r==="rainbow"||r==="toon"||r==="outline"||r==="particle"||r==="transmission"||r==="reflection"||r==="matcap"||r==="displace"||r==="pattern"||r==="vertexColor"||r==="light"},(kI||(kI={})).is=function(r){return r==="luminance"||r==="r"||r==="g"||r==="b"||r==="a"},(I_||(I_={})).is=function(r){return typeof r=="object"&&r!==null&&r.image!=null},(VI||(VI={})).is=function(r){return r==="phong"||r==="toon"||r==="lambert"||r==="physical"},(n=jI||{})[n.Linear=0]="Linear",n[n.Radial=1]="Radial",n[n.Polar=2]="Polar",jI=n,GI=(r=>(r[r.RepeatWrapping=1e3]="RepeatWrapping",r[r.ClampToEdgeWrapping=1001]="ClampToEdgeWrapping",r[r.MirroredRepeatWrapping=1002]="MirroredRepeatWrapping",r))(GI||{}),HI=(r=>(r[r.NearestFilter=1003]="NearestFilter",r[r.LinearFilter=1006]="LinearFilter",r[r.LinearMipmapLinearFilter=1008]="LinearMipmapLinearFilter",r))(HI||{}),(i=WI||{})[i.UV=0]="UV",i[i.Planar=1]="Planar",i[i.Spherical=2]="Spherical",i[i.Cylindrical=3]="Cylindrical",i[i.Triplanar=4]="Triplanar",WI=i,(e=qI||{})[e.Simplex=0]="Simplex",e[e.SimplexFractal=1]="SimplexFractal",e[e.Ashima=2]="Ashima",e[e.Fbm=3]="Fbm",e[e.Perlin=4]="Perlin",e[e.Voronoi=5]="Voronoi",qI=e,(t=XI||{})[t.F1=0]="F1",t[t.F2=1]="F2",t[t.F2MinusF1=2]="F2MinusF1",t[t.SmoothBlend=3]="SmoothBlend",t[t.Edge=4]="Edge",t[t.Power=5]="Power",t[t.Lines=6]="Lines",t[t.Cells=7]="Cells",XI=t,$I=(r=>(r[r.Lights=0]="Lights",r[r.Static=1]="Static",r[r.Camera=2]="Camera",r))($I||{}),YI=(r=>(r[r.Circle=0]="Circle",r[r.Ring=1]="Ring",r[r.Polygon=2]="Polygon",r[r.Cross=3]="Cross",r[r.Diamond=4]="Diamond",r[r.Checkerboard=5]="Checkerboard",r[r.Line=6]="Line",r[r.Wave=7]="Wave",r))(YI||{}),Vb=["mode","gradientType","noiseType","tracingMode","mirror","displacementType","projection","cnormal","crop","axis","side","roughnessMapChannel","metalnessMap","metalnessMapChannel","normalMap","aoMap","aoMapChannel","emissiveMap","style"],bC=["wrapping","image","video","name","minFilter","magFilter"],(r=>{r.patch=function(s,a){let{texture:o,...l}=a;if(Object.assign(s,l),o){let c=s.texture;c&&Object.assign(c,o)}},r.defaultColorLayer=function(s){return{...r.defaultData("color"),color:s}},r.defaultData=function(s,a){return s==="light"&&a?function(o){let l={mode:0,isMask:!1,visible:!0,bumpMap:void 0,bumpMapIntensity:5,roughnessMap:void 0,alphaOverride:1};switch(o){case"phong":return{...l,category:"phong",specular:{r:.2,g:.2,b:.2},shininess:5,type:"light",visible:!0,mode:0,occlusion:!0,alpha:.6};case"toon":return{...l,category:"toon",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1};case"lambert":return{...l,category:"lambert",emissive:{r:0,g:0,b:0},type:"light",alpha:1,visible:!0,mode:0,occlusion:!0};case"physical":return{...l,category:"physical",roughness:.6,metalness:.2,reflectivity:.2,type:"light",alpha:.6,visible:!0,mode:0,occlusion:!0}}}(a):function(o){let l={alpha:1,mode:0,isMask:!1,visible:!0};switch(o){case"texture":return{...l,type:"texture",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{image:"image_0",wrapping:1e3,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"video":return{...l,type:"video",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{video:R_.defaultVideo,wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"color":return{...l,type:"color",color:An.fromHex(Rr)};case"vertexColor":return{...l,type:"vertexColor"};case"depth":return{...l,type:"depth",gradientType:1,smooth:!1,isVector:!0,isWorldSpace:!1,origin:[0,0,0],direction:[1,0,0],colors:[[1,1,1,1],[0,0,0,1]],steps:[0,1],near:50,far:200};case"normal":return{...l,type:"normal",cnormal:[1,1,1]};case"gradient":return{...l,type:"gradient",gradientType:0,smooth:!1,colors:[[0,0,0,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,1,1,1,1,1,1,1,1,1],num:2,angle:0,offset:[0,0],morph:[0,0]};case"noise":return{...l,type:"noise",size:[100,100,100],noiseType:0,scale:1,move:1,colorA:{...An.fromHex(6710886),a:1},colorB:{...An.fromHex(6710886),a:1},colorC:{...An.fromHex(16777215),a:1},colorD:{...An.fromHex(16777215),a:1},distortion:[1,1],fA:[1.7,9.2],fB:[8.3,2.8],voronoiStyle:0,highCut:1,lowCut:0,smoothness:.3,seed:0,quality:1};case"cavity":return{...l,type:"cavity",mode:3,ridge:1,valley:1};case"fresnel":return{...l,type:"fresnel",color:Je.fromHexAndA(16777215,1),bias:.1,scale:1,intensity:2,factor:1};case"dust":return{...l,type:"dust",color:Je.fromHexAndA(10323813,1),coverage:.2,softness:.2,noiseStrength:.2,noiseScale:1};case"rainbow":return{...l,type:"rainbow",filmThickness:30,movement:0,wavelengths:[0,0,0],noiseStrength:0,noiseScale:1,offset:[0,0,0]};case"toon":return{...l,type:"toon",positioning:2,colors:[[0,0,0,1],[.5,.5,.5,1],[.5,.5,.5,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,.475,.525,1,1,1,1,1,1,1],num:4,source:[0,1e3,0],isWorldSpace:!0,noiseStrength:0,noiseScale:1,shadowColor:Je.fromHexAndA(0,0),offset:[0,0,0]};case"outline":return{...l,type:"outline",outlineColor:Je.fromHexAndA(0,1),contourColor:Je.fromHexAndA(0,1),outlineWidth:2,contourWidth:5,outlineThreshold:.4,contourThreshold:0,outlineSmoothing:0,contourFrequency:10,contourDirection:[0,1,0],positionalLines:!1,compensation:!0};case"matcap":return{...l,type:"matcap",texture:{image:"matcap_0",wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006}};case"transmission":return{...l,type:"transmission",thickness:10,ior:1.5,roughness:1};case"reflection":return{...l,type:"reflection",blur:0,thickness:.001,steps:60,stepSize:.005,tracingMode:1,mirror:0};case"displace":return{visible:!0,type:"displace",displacementType:"noise",noiseType:0,scale:10,movement:1,offset:[0,0,0],intensity:8,voronoiStyle:0,smoothness:.3,seed:0,highCut:1,lowCut:0,quality:1};case"pattern":return{...l,type:"pattern",style:0,projection:0,axis:"y",blending:0,offset:[0,0],colorA:{...An.fromHex(0),a:1},colorB:{...An.fromHex(16777215),a:1},frequency:[10,10],size:.5,variation:0,smoothness:.5,zigzag:0,rotation:0,vertical:[0,1],horizontal:[0,1],sides:6}}}(s)}})(Ki||(Ki={})),(r=>{function s(a,o="layer1",l="layer2",c=An.fromHex(16777215)){let h=new Vt;return h.push({fi:0,data:Ki.defaultData("light",a),id:o}),h.push({fi:1,data:Ki.defaultData("color"),id:l}),{layers:h}}r.isMergable=function(a){return!a.layers.some(o=>o.data.type==="texture"&&o.data.projection!==0||o.data.type==="depth"&&!o.data.isWorldSpace||o.data.type==="noise"||o.data.type==="dust"&&o.data.noiseStrength!==0||o.data.type==="displace")},r.getHash=function(a){let o="";return a.layers.forEach(l=>{Object.entries(l.data).forEach(([c,h])=>{o+=`${c}${h}`,Array.isArray(h)?h.forEach(d=>o+=`${d}`):typeof h=="object"?Object.values(h).forEach(d=>{o+=typeof d=="number"?`${d.toFixed(4)}`:`${d}`}):o+=`${h}`})}),o},r.defaultEmptyData=function(){return{layers:new Vt}},r.defaultData=function(a="layer1",o="layer2"){return s("physical",a,o)},r.withName=function(a,o){return{...a,name:o}},r.defaultTwoLayerData=s,r.defaultColorMaterial=function(a,o,l="layer1",c="layer2"){let h=new Vt;return h.push({fi:0,data:Ki.defaultData("light",o),id:l}),h.push({fi:1,data:Ki.defaultColorLayer(a),id:c}),{layers:h}},r.defaultUIObjectMaterial=function(a){let o=Ki.defaultData("texture");a&&Object.assign(o.texture,{image:a});let l=new Vt;return l.push({fi:0,data:o,id:"layer1"}),l.push({fi:1,data:{...Ki.defaultData("transmission"),alpha:1},id:"layer2"}),l.push({fi:2,data:{...Ki.defaultData("light","lambert"),alpha:0},id:"layer3"}),{layers:l}},r.defaultTwoLayerTextureData=function(a,o="physical",l="layer1",c="layer2"){let h=Ki.defaultData("texture");Object.assign(h.texture,{image:a});let d=new Vt;return d.push({fi:0,data:h,id:l}),d.push({fi:1,data:Ki.defaultData("light",o),id:c}),{layers:d}},r.defaultTwoLayerVideoTextureData=function(a,o="physical",l="layer1",c="layer2"){let h=Ki.defaultData("video");Object.assign(h.texture,{video:a});let d=new Vt;return d.push({fi:0,data:h,id:l}),d.push({fi:1,data:Ki.defaultData("light",o),id:c}),{layers:d}}})(ki||(ki={}))}),_X=F(()=>{wu="Roboto_regular",RF="https://fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Me5WZLCzYlKw.ttf"}),kF=F(()=>{Ye(),(Pg||(Pg={})).defaultData=function(){return{points:new Vt,roundness:0,shapeHoles:[],isClosed:!1}}}),VF=F(()=>{Ye(),(O_||(O_={})).defaultData=function(){return{points:new Vt,lastInsertionPlane:null,subdivisions:12,isClosed:!1,subdivisionMode:"parametric"}},yc={type:"Ellipse",width:50,height:50,spikes:16,angle:360,innerRadius:0},(ZE||(ZE={})).merge=function(t,e){let i={...t};return L_.forEach(n=>{Object.assign(i,{[n]:e[n]??t[n]})}),i},xC={shape:yc,depth:1,offset:0,bevel:50,bevelSides:6,angle:0,twist:0,startScale:1,endScale:1,capType:"flat"},L_=["depth","offset","angle","twist","startScale","endScale"]}),SC=F(()=>{var t,e;kF(),VF(),(t=B_||(B_={})).is2DParametricMesh=function(i){return i==="PolygonGeometry"||i==="RectangleGeometry"||i==="StarGeometry"||i==="TriangleGeometry"||i==="EllipseGeometry"||i==="UIGeometry"},t.isParametricMesh=function(i){return i==="PolygonGeometry"||i==="RectangleGeometry"||i==="StarGeometry"||i==="TriangleGeometry"||i==="EllipseGeometry"||i==="PathGeometry"||i==="VectorGeometry"||i==="ConeGeometry"||i==="CubeGeometry"||i==="CylinderGeometry"||i==="DodecahedronGeometry"||i==="HelixGeometry"||i==="IcosahedronGeometry"||i==="LatheGeometry"||i==="PyramidGeometry"||i==="SphereGeometry"||i==="PlaneGeometry"||i==="BackdropGeometry"||i==="TorusGeometry"||i==="TorusKnotGeometry"||i==="BooleanGeometry"||i==="TextGeometry"||i==="InputGeometry"||i==="DecalGeometry"},t.isSwappableGeometry=function(i){return i==="PolygonGeometry"||i==="RectangleGeometry"||i==="StarGeometry"||i==="TriangleGeometry"||i==="EllipseGeometry"||i==="PathGeometry"||i==="VectorGeometry"||i==="ConeGeometry"||i==="CubeGeometry"||i==="CylinderGeometry"||i==="DodecahedronGeometry"||i==="HelixGeometry"||i==="IcosahedronGeometry"||i==="LatheGeometry"||i==="PyramidGeometry"||i==="SphereGeometry"||i==="PlaneGeometry"||i==="BackdropGeometry"||i==="TorusGeometry"||i==="TorusKnotGeometry"||i==="TextGeometry"||i==="SubdivGeometry"||i==="NonParametricGeometry"},(KE||(KE={})).merge=function(i,n){let r={...i};return Object.assign(r,n),r.type==="PathGeometry"&&"extrusion"in n&&n.extrusion&&(r.extrusion={...i.extrusion},Object.assign(r.extrusion,ZE.merge(r.extrusion,n.extrusion))),r},(e=Ho||(Ho={})).defaultData=function(i){if(i==="RectangleGeometry")return{width:320,height:320,type:i,cornerRadius:[0,0,0,0],cornerType:0,depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if(i==="UIGeometry")return{type:i,frame:"",cornerRadius:[0,0,0,0],cornerType:0,width:1,height:1};if(i==="PathGeometry")return{type:i,width:1,height:1,depth:1,path:O_.defaultData(),extrusion:xC};if(i==="VectorGeometry")return{width:1,height:1,type:i,subdivisions:12,shape:Pg.defaultData(),depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if(i==="BooleanGeometry")return{type:i,operation:2,width:0,height:0,depth:0,phongAngle:35};if(i==="ShapeBlendGeometry")return{type:i,width:0,height:0,depth:0,resolutionLevel:6,blendRange:100,useChildrenColors:!1};if(i==="DecalGeometry")return{type:i,width:200,height:200,depth:200,offset:1};if(i==="TextGeometry")return{type:i,width:100,height:100,depth:0,horizontalAlign:1,verticalAlign:1,fontSize:16,lineHeight:1.2,letterSpacing:0,text:{textValue:""},textTransform:1,font:"Roboto_regular",editable:!1,extrudeBevelSize:0,extrudeBevelSegments:1};if(i==="InputGeometry")return{...e.defaultData("TextGeometry"),type:i,editable:!0};if(i==="SphereGeometry")return{type:"SphereGeometry",width:100,height:100,depth:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180};throw new Error("not implemented")},l1=["width","height","depth"]}),jF=F(()=>{_s(),(t=>{function e(i){return i.mode??"linear"}t.defaultData={enabled:!1,useBackgroundColor:!1,color:An.white,near:.1,far:2e3,mode:"linear",density:.005,heightFalloff:.01,heightBase:0},t.getMode=e,t.getModeIndex=function(i){let n=e(i);return n==="height"?1:n==="both"?2:0},t.getDensity=function(i){return i.density??t.defaultData.density},t.getHeightFalloff=function(i){return i.heightFalloff??t.defaultData.heightFalloff},t.getHeightBase=function(i){return i.heightBase??t.defaultData.heightBase}})(tr||(tr={}))}),MC=F(()=>{(rS||(rS={})).defaultData={image:null,rotation:0,blur:32,showBackground:!0},(kl||(kl={})).defaultData={enabled:!1,mode:"hdri",hdri:rS.defaultData,timeOfDay:10,weather:"partlyCloudy",lighting:!0,lightingIntensity:1,lightingQuality:"full",clouds:!0,windSpeed:2,animateWind:!0,exposure:1,seed:2}}),GF=F(()=>{(()=>{let t={opacity:1,blendFunction:13,enabled:!1};(U_||(U_={})).defaultData={enabled:!1,pixelation:{...t,blendFunction:16,granularity:15},bloom:{...t,blendFunction:16,intensity:1,blurScale:1,luminanceThreshold:.25,luminanceSmoothing:.025,kernelSize:3},chromaticAberration:{...t,offset:[2,2]},vignette:{...t,darkness:1,offset:0},hueSaturation:{...t,hue:3,saturation:0},brightnessContrast:{...t,brightness:.25,contrast:0},depthOfField:{...t,focusDistance:100,focalLength:20,bokehScale:5},noise:{...t,blendFunction:16}}})()}),EC=F(()=>{var t;jF(),MC(),GF(),_s(),(t=eg||(eg={})).defaultData={type:"normal",softShadowQuality:"low"},t.isSoft=function(e){return e!=null&&(e.type===void 0||e.type==="soft")},(sS||(sS={})).defaultData={enabled:!0,color:{r:.8274509803921568,g:.8274509803921568,b:.8274509803921568},intensity:.75},(aS||(aS={})).defaultData={occlusion:!1,aoFullRes:!1,radius:256,bias:.5,aoColor:{r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}},(e=>{e.defaultData={pipeline:"classic",toneMapping:"aces",exposure:1},e.isUntouched=function(i){return i===void 0||i.pipeline==="classic"&&(i.toneMapping==="none"||i.toneMapping==="aces")&&i.exposure===1}})(oS||(oS={})),($u||($u={})).defaultData={usePhysics:!1,gravity:-10},(lS||(lS={})).defaultData={playCamera:Yc,gameControlObject:null},(QE||(QE={})).defaultData={backgroundColor:Je.fromHexAndA(DF,1),postprocessing:U_.defaultData,fog:tr.defaultData,sky:kl.defaultData,globalPhysics:$u.defaultData,ambient:sS.defaultData,ao:aS.defaultData,shadow:eg.defaultData,publish:lS.defaultData,grading:oS.defaultData}}),bX=F(()=>{(JE||(JE={})).defaultData={colliderType:"box",size:[100,100,100],colliderHelperVisible:!0,forceType:"collider",forceRange:"global",forceIntensity:.5,forceDambing:.95}}),jb=F(()=>{var t,e,i;Ye(),OF(),BF(),UF(),zF(),wC(),FF(),_s(),Gg(),SC(),LF(),ar(),EC(),bX(),(t=ZI||(ZI={})).isComponentRelated=function(n){return n==="Component"||n==="Instance"},t.isEmptyOrComponent=function(n){return n==="Empty"||n==="Instance"},(e=Rd||(Rd={})).identity={...GE.identity,hiddenMatrix:qu.identity},e.fromObject=function(n){return{position:n.position,rotation:n.rotation,scale:n.scale,pivot:n.pivot,pivotRotation:n.pivotRotation,hiddenMatrix:n.hiddenMatrix}},e.merge=function(n,r){return{position:r?.position||n.position,rotation:r?.rotation||n.rotation,pivot:r?.pivot||n.pivot,pivotRotation:r?.pivotRotation||n.pivotRotation,scale:r?.scale||n.scale,hiddenMatrix:r?.hiddenMatrix||n.hiddenMatrix}},e.diff=function(n,r){return hF({position:ah.isEqual(n.position,r.position)?void 0:r.position,rotation:ah.isEqual(n.rotation,r.rotation)?void 0:r.rotation,scale:ah.isEqual(n.scale,r.scale)?null:r.scale,hiddenMatrix:qu.isEqual(n.hiddenMatrix,r.hiddenMatrix)?void 0:r.hiddenMatrix})},IF=["slide","offset"],(Mn||(Mn={})).defaultData={states:new Vt,events:new Vt,visible:!0,raycastLock:!1,physics:Xu.defaultData,pathSnapping:{pathId:null,slide:0,offset:0,orientation:"tangential"},...Rd.identity,cloner:null},(z_||(z_={})).defaultData={type:"Empty",...Mn.defaultData},(KI||(KI={})).defaultData={type:"ParticleCollider",...JE.defaultData,...Mn.defaultData},(QI||(QI={})).defaultData={type:"Component",...Mn.defaultData},(JI||(JI={})).defaultData={type:"Particle",...Mn.defaultData,...D_.defaultData},(tO||(tO={})).defaultData={type:"Hair",...Mn.defaultData,...$E.defaultData},(Ha||(Ha={})).defaultData={type:"Mesh",...Mn.defaultData,...YE.defaultData},(ig||(ig={})).defaultData={...Mn.defaultData,...Rd.identity,position:Ko.DefaultPosition,rotation:Ko.DefaultRotation,...Ko.defaultData},(n=>{n.defaultData=function(r){return{...Mn.defaultData,...XE.defaultData(r)}},n.defaultDirectionalLightData={...n.defaultData("DirectionalLight"),position:[200,300,300],name:"Directional Light",intensity:.7}})(F_||(F_={})),(n=>{function r(s,a,o=0){for(;o<a.length;){let l=s?s[a[o]]:void 0;if(a.length===o+1)return l;if(!l)return;s=l.descendants,o+=1}}n.resolveWithDes=r,n.resolve=function(s,a,o=0){let l=r(s,a,o);if(l){let c=Object.keys(l);if(c.length===1&&c[0]==="descendants")return}return l}})(N_||(N_={})),(n=>{function r(s,a){return{...Mn.defaultData,...a,component:s,overrides:new fn,physics:void 0,events:void 0,type:"Instance"}}n.rootOverrideProps=["physics","events"],n.compositeNonOptionalOverrideProps=["geometry"],n.compositeEntireOverrideOverrideProps=["material"],n.ofComponent=r,n.fromComponentData=function(s){let a=Rd.fromObject(s.data);return r(s.id,a)}})(Qo||(Qo={})),(n=>{n.defaultData={type:"Page",...Mn.defaultData,physics:{...Xu.defaultData,fusedBody:!1},...QE.defaultData,camera:ig.defaultData,timelines:new te},n.isUIPage=function(r){return r.uiScene!==void 0}})(Ic||(Ic={})),(i=eO||(eO={})).defaultCamera={position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0],hiddenMatrix:qu.identity,name:"Play Camera",visible:!0,raycastLock:!1,physics:Xu.defaultData,states:new Vt,events:new Vt,cloner:null,pathSnapping:{pathId:null,orientation:"tangential",slide:0,offset:0},...Ko.defaultData},i.KeysByResetCategory={States:["states"],Events:["events"],Material:["material","materials"],Geometry:["geometry"],Position:["position"],Rotation:["rotation"],Scale:["scale"],Transform:["position","scale","rotation","hiddenMatrix"],Name:["name"],Visibility:["visible","raycastLock","flatShading","wireframe","side","shadowCatcher"],Shadows:["castShadow","receiveShadow"],Cloner:["cloner"],Physics:["physics"]},i.defaultMeshObject={name:"Rectangle",...Mn.defaultData,...Ha.defaultData,geometry:Ho.defaultData("RectangleGeometry"),material:ki.defaultTwoLayerData("physical","layer1","layer2")},i.defaultBooleanObject={name:"Boolean",...Mn.defaultData,...Ha.defaultData,geometry:Ho.defaultData("BooleanGeometry"),material:ki.defaultTwoLayerData("physical","layer1","layer2")},i.defaultShapeBlendObject={name:"Shape Blend",...Mn.defaultData,...Ha.defaultData,geometry:Ho.defaultData("ShapeBlendGeometry"),material:ki.defaultTwoLayerData("physical","layer1","layer2")},i.defaultTextObject={name:"Text",...Mn.defaultData,...Ha.defaultData,geometry:Ho.defaultData("TextGeometry"),material:ki.defaultTwoLayerData("physical","layer1","layer2")},i.defaultInputObject={name:"Input",...Mn.defaultData,...Ha.defaultData,geometry:Ho.defaultData("InputGeometry"),material:ki.defaultTwoLayerData("physical","layer1","layer2")},(n=>{n.newEmpty=function(r,s){let a={name:s};return r.type==="Mesh"?(a.geometry={},"material"in r&&(a.material={layers:new fn}),"materials"in r&&(a.materials=r.materials.map(o=>({layers:new fn})))):Vc.is(r.type)&&(a.perspective={},a.orthographic={}),a},n.toOps=function(r,s){let a,o=[],l={orthographic:0,perspective:0,geometry:0};function c(h,d){for(let[u,p]of Object.entries(d.layers)){let{texture:f,...g}=p;if(f!==void 0&&Object.keys(f).length>0){let m={path:[...h,"layers",u,"texture"],props:f,type:0};o.push(m)}if(Object.keys(g).length>0){let m={path:[...h,"layers",u],props:g,type:0};o.push(m)}}}for(let[h,d]of Object.entries(s)){let u=d;if(h!=="name")if(h==="cloner")o.push(...HE.toOps(u,["cloner"]));else if(h==="pathSnapping")o.push({path:[h],props:{slide:u.slide,offset:u.offset},type:0});else if(h==="material")c(["material"],u);else if(h==="materials")for(let[p,f]of Object.entries(u))c(["materials",p],f);else if(l[h]===0){if(h==="geometry"&&u.extrusion!==void 0){let p={path:[h,"extrusion"],props:u.extrusion,type:0};o.push(p),u={...u},delete u.extrusion}if(Object.keys(u).length>0){let p={path:[h],props:u,type:0};o.push(p)}}else a===void 0&&(a={path:[],props:{},type:0},o.push(a)),a.props[h]=u}return o},n.patch=function(r,s){if(s===void 0)return r;let a={...r};if(Object.assign(a,Rd.merge(a,s)),Object.assign(a,{pathSnapping:Object.assign({},a.pathSnapping,{slide:s.pathSnapping?.slide??a.pathSnapping?.slide??0,offset:s.pathSnapping?.offset??a.pathSnapping?.offset??0})}),Vc.is(r.type)){a.orthographic={...a.orthographic},a.perspective={...a.perspective};let o=s;o.orthographic?.zoom!==void 0&&(a.orthographic.zoom=o.orthographic.zoom),o.perspective?.zoom!==void 0&&(a.perspective.zoom=o.perspective.zoom),o.isUpVectorFlipped!==void 0&&(a.isUpVectorFlipped=o.isUpVectorFlipped),o.targetOffset!==void 0&&(a.targetOffset=o.targetOffset)}else if(r.type==="Mesh")"geometry"in s&&Object.assign(a,{geometry:KE.merge(a.geometry,s.geometry)}),(s.material||s.materials)&&(a=function(o,l){if(l===void 0)return o;let c={...o};return"material"in c&&"material"in l&&l.material&&(c.material=x_(c.material,h=>{if(typeof h!="string")for(let[d,u]of Object.entries(l.material.layers)){let p=h.layers.data(d);p&&Ki.patch(p,u)}}).data),c.materials&&l.materials&&(c.materials=x_(c.materials,h=>{for(let d=0;d<c.materials.length;d++){let u=l.materials[d];if(typeof u!="string")for(let[p,f]of Object.entries(u.layers)){let g=h[d]?.layers?.data(p);g&&Ki.patch(g,f)}}}).data),c}(a,s)),a.cloner&&"cloner"in s&&Object.assign(a,{cloner:Yl.merge(a.cloner,s.cloner)});else if(r.type==="Empty")a.cloner&&"cloner"in s&&Object.assign(a,{cloner:Yl.merge(a.cloner,s.cloner)});else if(qE.is(r.type)){let o=s;o.intensity!==void 0&&(a.intensity=o.intensity),o.color!==void 0&&(typeof o.color=="string"?a.color=o.color:a.color=An.clone(o.color))}return a}})(Zl||(Zl={}))}),AC=F(()=>{(k_||(k_={})).defaultData={enablePan:!0,enableZoom:!0,enableRotate:!0,enableDamping:!0,rotationLimitsMode:0,rotationVerticalOffset:{min:Math.PI/4,max:Math.PI/4},rotationHorizontalOffset:{min:Math.PI/4,max:Math.PI/4},rotationSoftLimit:2,rotationSpeed:1,panLimitsMode:0,panVerticalOffset:{min:250,max:250},panHorizontalOffset:{min:250,max:250},panSoftLimit:2,zoomLimitsEnabled:!1,zoomLimits:{min:.1,max:2},autoRotate:!1,autoRotateSpeed:2,autoRotateClockwise:!0,hoverRotatePanMode:0,hoverRotatePanStrength:20,hoverRotateDamping:.125,isTouchZoom:!0,orbitTouches:2,panTouches:3,resetHoverEffectOnPointerLeave:!0}}),Gb=F(()=>{AC(),_s(),(Jo||(Jo={})).defaultData={orbitControls:k_.defaultData,playPage:Wu,withBackground:!0,preventScroll:!1,preventTouchScroll:!1,hideCursor:!1,mouseEventTarget:"canvas",joystickSizeAndXYOffset:Array(12).fill(0).map((t,e)=>{let i=0,n=0;return e<5?n=-30:e<10&&(n=30),e===0||e===10||e===5?i=30:(e===4||e===11||e===9)&&(i=-30),[120,[i,n],"show"]}),settings:{image:{format:"jpg",ratio:1,colorSpace:"display-p3"},videoStatic:{fps:60,mbps:150,ratio:1,duration:1e3,format:"mp4",imageFormat:"jpg",activeTimeline:null,colorSpace:"display-p3"},web:{logo:!0,compress:!0,preset:1,preload:!0,hint:!1,imageQuality:70,pixelRatioMobile:0,pixelRatioDesktop:0}},stopRaycast:!0,hdTransmission:!1,renderer:"webgpu",asyncShaderCompilation:!0}}),HF=F(()=>{var t;(hS||(hS={})).defaultData={id:"basic",label:"Basic",style:"None",prompt:""},(cS||(cS={})).defaultData={weather:0,shadows:0,lightOrigin:0,temperature:0,sun:0,camera:0,environment:0,particles:0,nature:0,floor:0},(t=bc||(bc={})).defaultData=()=>({mode:"line-art-both",prompt:"",negativePrompt:"",style:{...hS.defaultData},isRandomSeed:!0,seed:t.generateSeed(),guessMode:!1,advanced:!1,steps:20,guidanceScale:7.5,controlNetScale:1,modifiers:cS.defaultData}),t.generateSeed=()=>Math.round(1e5*Math.random())}),TC=F(()=>{jb(),Ye(),Gb(),_s(),ar(),HF(),(t=>{function e(i,n){let r=i.scene.objects.get(n);if(r&&r.data.type==="Component")return r;{let s=i.shared.lib.components[n];if(s)return{...s.asset,id:n}}}t.physicsEnabled=function(i){return i.find(n=>n.data.type==="Page"&&n.data.globalPhysics.usePhysics)!==void 0},t.findTimeline=function(i,n){let r=i.find(s=>s.data.type==="Page"&&s.data.timelines?.[n]!==void 0);return r&&r.data.timelines?.[n]},t.getComponentData=e,t.traverseModuleInstances=function(i,n,r){i.scene.objects.traverseFrom(n,(s,a)=>{if(a.type==="Instance"){let o=e(i,a.component)?.data;o&&r(s,a,o.events)}else r(s,a,a.events)})}})(jc||(jc={})),(t=>{function e(n=!0,r=[]){let s=[];n&&s.push({...t.defaultLight}),s.push(...r);let a=new Wn;return a.push({fi:1,id:Wu,data:{...Ic.defaultData,name:"Scene 1"},children:s}),a}function i(n){return{...t.defaultData,objects:Er(n,Wn.prototype)}}t.TRASH_CAN_ID="830a2708-8ed9-49cf-a68e-085299892222",t.defaultLight={fi:-1,data:F_.defaultDirectionalLightData,id:"830a2708-8ed9-49cf-a68e-085299899103",children:[]},t.createDefaultObjectTreeWithPage=e,t.defaultData={objects:e(),publish:Jo.defaultData,styles:bc.defaultData()},t.emptyDataWithoutPage=function(){return{objects:new Wn,publish:Jo.defaultData,styles:bc.defaultData()}},t.emptyDataWithPage=function(n=!0){return{objects:e(n),publish:Jo.defaultData,styles:bc.defaultData()}},t.emptyData=function(){return{objects:new Wn,publish:{...Jo.defaultData},styles:bc.defaultData()}},t.withObjs=i,t.withObj=function(n,r){return i([{id:n,data:r,children:[],fi:0}])}})(xc||(xc={}))}),WF=F(()=>{(ng||(ng={})).defaultData={preset:"fullscreen",allowResponsive:!1,size:[512,512],coords:[0,0],sceneScale:1,color:{r:0,g:0,b:0,a:.5}}}),CC=F(()=>{var t,e;Ye(),ar(),(t=tA||(tA={})).defaultData=i=>({url:i,name:"New Webhook",parametersSchemas:new Vt}),t.defaultParameterValueByType=i=>i==="number"?0:i!=="boolean"&&"",(iO||(iO={})).defaultData=(i,n="GET")=>({url:i,method:n,name:"New API",headers:new Vt,queries:new Vt,autoStart:!0}),(i=>{function n(s){return s.textValue!==void 0}function r(s){return typeof s=="boolean"}i.isTextValue=n,i.isNumber=function(s){return typeof s=="number"},i.isBoolean=r,i.typeOfVariable=function(s){return n(s)?"string":r(s)?"boolean":"number"},i.getDisplayedValue=function(s){return i.isTextValue(s)?Array.isArray(s.textValue)?s.textValue.map(a=>a.toString().padStart(s.padding??2,"0")).join(s.deliminator??":")+(s.suffix!==void 0?" "+s.suffix:""):s.textValue.toString():i.isBoolean(s)?s?"True":"False":i.isNumber(s)?parseFloat(s.toFixed(3)).toString():s.toString()}})(_r||(_r={})),(dS||(dS={})).all=["images","videos","colors","audios","particles","fonts","materials","variables"],(nO||(nO={})).all=[...dS.all,"components"],(rO||(rO={})).defaultData=function(){return{images:new te,videos:new te,colors:new te,audios:new te,particles:new te,fonts:new te,materials:new te,components:new te,variables:new te,userAPIs:new te,userWebhooks:new te}},(Wo||(Wo={})).defaultData=function(){return{images:new te,videos:new te,colors:new te,audios:new te,particles:new te,fonts:new te,materials:new te,components:new te,variables:new te,userAPIs:new te,userWebhooks:new te}},(e=Fs||(Fs={})).defaultColors=function(){return Er({"89b10010-844c-11ec-a8a3-0242ac120002":{r:.5,g:.5,b:.5,a:1,name:"Default Color"}},te.prototype)},e.defaultImages=function(){return Er({},te.prototype)},e.emptyData=function(){return{catelogs:new te,materials:new te,images:new te,videos:new te,colors:new te,audios:new te,particles:new te,fonts:new te,variables:new Vt,userAPIs:new te,userWebhooks:new te,lib:Wo.defaultData()}},e.defaultVariables=function(i){switch(i){case"number":return{value:0,name:"Number"};case"boolean":return{value:!1,name:"Boolean"};case"string":return{value:{textValue:"String value"},name:"String"};case"time":{let n=[0,0,0];return{name:"Time",value:{textValue:n,deliminator:":",padding:2,suffix:"AM"},dynamicVariableType:"time",format:"HH:mm:ss",format12h24h:"12ampm",timeZone:null,hasEnd:!1,endValue:{textValue:n,deliminator:":",padding:2,suffix:"AM"},autoStart:!0,repeat:!1}}case"counter":return{name:"Counter",value:0,dynamicVariableType:"counter",updateInterval:1e3,increment:1,autoStart:!0,hasEnd:!0,endValue:60,repeat:!0,randomStart:!1,range:[0,100],decimals:0};case"random":return{name:"Random",value:0,dynamicVariableType:"random",updateInterval:1e3,increment:1,autoStart:!0,isStatic:!1,hasEnd:!0,endValue:60,repeat:!0,min:0,max:100,decimals:0};default:console.error("Unknown variable type",i)}},e.getFormattedTimerTime=function(i,n){if(n.format==="HH:mm:ss"){let r=Math.floor(i/3600),s=Math.floor((i-3600*r)/60);return{textValue:[r,s,Math.round(i-3600*r-60*s)]}}if(n.format==="mm:ss"){let r=Math.floor(i/60);return{textValue:[r,Math.round(i-60*r)]}}return n.format==="number"?Math.round(i):Math.round(1e3*i)/1e3}}),xX=F(()=>{}),qF=F(()=>{var t;Ye(),TC(),WF(),CC(),(t=Yu||(Yu={})).defaultData={schema:131,scene:xc.defaultData,frames:new te().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",ng.defaultData),shared:{...Fs.emptyData(),colors:Fs.defaultColors()}},t.createDefaultData=function(){return Tg.deserialize(Tg.serialize(t.defaultData))},t.emptyDataForImports=function(){return{schema:131,scene:xc.emptyDataWithPage(),frames:new te().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",ng.defaultData),shared:{...Fs.emptyData(),colors:Fs.defaultColors(),images:Fs.defaultImages()}}},t.emptyData=function(){return{schema:131,scene:xc.emptyDataWithPage(),frames:new te().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",ng.defaultData),shared:Fs.emptyData()}},t.clipboard2dData=function(){return{schema:131,scene:xc.emptyData(),frames:new te,shared:Fs.emptyData()}},t.withoutLib=function(e){return{...e,shared:{...e.shared,lib:Wo.defaultData()}}},t.getComponentData=function(e,i){return jc.getComponentData(e,i)},t.hasSensitiveData=function(e){let i=Object.values(e.shared.userAPIs);for(let n of i){let r=n.headers;for(let s of r)if(s.data.key.toLowerCase()==="authorization"&&s.data.value!=="")return!0}return!1}}),wX=F(()=>{(eA||(eA={})).emptyImage={data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=",name:"empty"}});function Oc(t,e=[0,0]){return[t&&!isNaN(t[0])?t[0]:e[0],t&&!isNaN(t[1])?t[1]:e[1]]}function Cf(t,e,i){switch(t){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 7:return"cubicBezier( .25, 1, .5, 1 )";case 5:{let{control1:n,control2:r}=e??{...dp.defaultData};return`cubicBezier( ${n[0]}, ${n[1]}, ${r[0]}, ${r[1]} )`}case 6:{let{mass:n,stiffness:r,damping:s,velocity:a}=i??{...$l.defaultData},o=new XF(n,r,s,a),l=o.solve(1);return()=>c=>o.solve(c)/l}case 8:return()=>n=>Math.floor(n)}}var sO,aO,Lc,Dg,XF,V_,j_,$F=F(()=>{Ye(),_s(),(sO||(sO={})).defaultData=function(t,e){return{id:t,name:e,duration:5,objectTimelines:new te}},(aO||(aO={})).is=function(t){return t&&typeof t.x=="number"&&typeof t.y=="number"&&typeof t.z=="number"},(t=>{function e(h,d){let u=[0,0],p=[1,1];if(h?.cubicControls)u=Oc(h.cubicControls.control1,u);else switch(h?.type){case 2:case 4:u=[.42,0];break;case 3:case 0:u=[0,0];break;case 1:u=[.25,.1];break;case 7:u=[.25,1]}if(d?.cubicControls)p=Oc(d.cubicControls.control2,p);else switch(d?.type){case 2:case 0:p=[1,1];break;case 3:case 4:p=[.58,1];break;case 1:p=[.25,1];break;case 7:p=[.5,1]}return{control1:u,control2:p}}function i(h){if(!t.BEZIER_PRESETS.includes(h))return;let d={type:h};return{control1:e(d).control1,control2:e(void 0,d).control2}}function n(h,d){return Math.abs(h[0]-d[0])<.001&&Math.abs(h[1]-d[1])<.001}function r(h){let d=t.ROOT_PROPERTY_ORDER.indexOf(h[0]);return d===-1?t.ROOT_PROPERTY_ORDER.length:d}function s(h){return h.layerId??h.path.join(".")}function a(h){let d=h[h.length-1];return Dg.includes(d)?d:void 0}function o(h){return h.layerId?h.layerId:(a(h.path)?h.path.slice(0,-1):h.path).join(".")}function l(h){return["material",h.type==="light"?`${h.category} lighting`:h.type]}function c(h,d,u){return{id:h,data:{id:h,time:u?.time??0,path:d,value:{},layerId:u?.layerId,index:u?.index,isPlaceholder:!0,easing:{type:5,cubicControls:{control1:[.42,0],control2:[.58,1]}}}}}t.getControlsWithDefault=e,t.BEZIER_PRESETS=[0,1,2,3,4,7],t.presetHandles=i,t.presetForHandles=function(h){return t.BEZIER_PRESETS.find(d=>{let u=i(d);return u!==void 0&&n(u.control1,h.control1)&&n(u.control2,h.control2)})},t.defaultData=function(h){return{id:h,keyframes:new Vt}},t.ROOT_PROPERTY_ORDER=["position","rotation","scale","shape size","material","opacity","camera","light","cloner","path extrusion","path snapping"],t.rowOrder=r,t.propertyKey=s,t.groupKeyframes=function(h,d){let u=new Map;for(let p of h){let f=p.data;if(d?.(f))continue;let g=s(f),m=u.get(g);m||(m={id:g,path:f.path,keyframes:[],layerId:f.layerId,index:f.index},u.set(g,m)),f.isPlaceholder?m.placeholder=p.id:m.keyframes.push(p)}return[...u.values()].sort((p,f)=>{let g=r(p.path)-r(f.path);return g!==0?g:(p.index??0)-(f.index??0)})},t.rowAxis=a,t.drawnRowKey=o,t.drawnRows=function(h){let d=new Map;for(let u of h){let p=a(u.path),f=p?u.path.slice(0,-1):u.path,g=o(u),m=d.get(g);m||(m={id:g,path:f,layerId:u.layerId,index:u.index,tracks:[]},d.set(g,m)),m.tracks.push({axis:p,property:u})}return[...d.values()]},t.sortedKeyframes=function(h){return[...h].sort((d,u)=>d.data.time-u.data.time)},t.materialLayerPath=l,t.createMaterialGroup=function(h,d){return h.map(({data:u,id:p},f)=>c(d(),l(u),{layerId:p,index:f}))},t.placeholderKeyframe=c,t.createName=function(h){return Object.entries(h).reduce((d,[u,p])=>(typeof p!="string"&&d.push({name:p.name}),d),[])},t.Presets=[{name:"Slide in",animationParams:{translateX:{value:[-20,0],easing:Cf(3),duration:1e3},opacity:{value:[0,1],easing:Cf(3),duration:1e3},endDelay:250,loop:!0}},{name:"Rotate",animationParams:{rotate:{value:[0,"1turn"],easing:Cf(5),duration:700},endDelay:250,loop:!0}},{name:"Scale Out",animationParams:{scale:{value:[1,1.5],easing:Cf(4),duration:1e3},endDelay:250,loop:!0}},{name:"Jump",animationParams:{translateY:[{value:0,duration:200,easing:"linear"},{value:-20,easing:"linear",duration:200},{value:0,easing:"linear",duration:100}],endDelay:500,loop:!0}},{name:"Jump Rotate",animationParams:{translateY:[{value:0,duration:200,easing:"linear"},{value:-20,easing:"linear",duration:200},{value:0,easing:"linear",duration:100}],rotate:{value:[0,"1turn"],easing:Cf(5),duration:500},endDelay:500,loop:!0}},{name:"Bounce",animationParams:{translateY:{value:["20px","-20px"],duration:575,easing:"easeOutQuad"},direction:"alternate",loop:!0}}]})(Lc||(Lc={})),Dg=["x","y","z"],XF=class{constructor(t=1,e=100,i=10,n=0){this.mass=t,this.stiffness=e,this.damping=i,this.initialVelocity=n,this.m_w0=Math.sqrt(e/t),this.m_zeta=i/(2*Math.sqrt(e*t)),this.m_zeta<1?(this.m_wd=this.m_w0*Math.sqrt(1-this.m_zeta*this.m_zeta),this.m_A=1,this.m_B=(this.m_zeta*this.m_w0-n)/this.m_wd):(this.m_wd=0,this.m_A=1,this.m_B=-n+this.m_w0)}solve(t){return 1-(this.m_zeta<1?Math.exp(-t*this.m_zeta*this.m_w0)*(this.m_A*Math.cos(this.m_wd*t)+this.m_B*Math.sin(this.m_wd*t)):(this.m_A+this.m_B*t)*Math.exp(-t*this.m_w0))}getDuration(){let t=.16666666666666666,e=0,i=0;for(;;)if(e+=t,this.solve(e)===1){if(i++,i>=16)break}else i=0;return e*t*1e3}}}),PC=F(()=>{var t;_s(),Ye(),(V_||(V_={})).list=["idle","move","jump","run"],(t=j_||(j_={})).defaultColliderData={type:"capsule",height:200,radius:50,position:[0,0,0],rotation:[0,0,0]},t.defaultDataThirdPerson={moveMode:"walk",forwardDirection:"+z",speedTranslate:1e3,speedRotate:100,runMultiplier:2,rotationMode:"normal",rotBy:"keys",rotByTouch:"drag",delayPos:[.3,.3],delayRot:[.3,.3],keyAssignments:[["moveNegZ","W"],["moveNegX","A"],["movePosZ","S"],["movePosX","D"],["rotPosX","\u25B2"],["rotPosY","\u25C0"],["rotNegX","\u25BC"],["rotNegY","\u25B6"],["jump","Space"],["run","\u21E7"],["none","Ctrl"]],touchControl:!0,joystickPosLoc:5,joystickRotLoc:11,jumpTouchButtonLoc:9,collider:t.defaultColliderData,colliderHelperVisible:!0,collisionEnabled:!0,jumpPower:100,resetYPosition:3e3,alignToGround:!1,autoOrientMove:!0,orientWith:"camera",orientMode:"radial",delayPosCamera:.3,delayRotCamera:.3,camera:"",cameraXAxis:"Limit",cameraYAxis:"Free",cameraRotXLimits:[0,Math.PI/2],cameraRotYLimits:[-Math.PI/2,Math.PI/2],gameActions:{idle:new Vt,move:new Vt,jump:new Vt,run:new Vt},navmesh:{enabled:!1,ch:6,cs:6,walkableClimb:5,walkableHeight:1,walkableRadius:0,zones:"all",objects:[],helperVisible:!0,destinationHelperRadius:0,destinationHelperColor:Je.fromHexAndA(3728051,1)}}});function uc(t,...e){let i={};for(let n of e.flat())t!=null&&n in t&&(i[n]=t[n]);return i}function oO(t){t.layers.forEach(e=>{if(e.type==="depth"&&e.colorA!==void 0){let i=e.colorA,n=e.colorB,r=[[i.r,i.g,i.b,i.a],[n.r,n.g,n.b,n.a]],s=[0,1];for(let o=2;o<10;o++)r.push(r[1]),s.push(1);let a={...uc(ln(e),"type","visible","isVector","isWorldSpace","origin","alpha","mode"),near:Math.max(0,e.near),far:Math.max(0,e.far),colors:r,steps:s,num:2,direction:[1,0,0],smooth:!1,gradientType:1};Object.assign(e,a)}else if(e.type==="depth"&&e.gradientType===1&&(e.near<0||e.far<0)){let i={...ln(e),near:Math.max(e.near,0),far:Math.max(e.far,0)};Object.assign(e,i)}})}function Fo(t,e){Object.values(t.shared.materials).forEach(i=>e(i))}function No(t,e){t.scene.objects.traverse((i,n)=>{"materials"in n?n.materials.forEach((r,s)=>{r===void 0&&(n.materials[s]=ki.defaultTwoLayerData("phong"),r=n.materials[s]),typeof r!="string"&&e(r)}):"material"in n?typeof n.material!="string"&&(n.material===void 0&&(n.material=ki.defaultTwoLayerData("phong")),e(n.material)):n.type==="Mesh"&&(n.material===void 0&&(n.material=ki.defaultTwoLayerData("phong")),e(n.material)),"overrides"in n&&Object.values(n.overrides).forEach(r=>{r.material&&typeof r.material!="string"&&Object.getPrototypeOf(r.material)!==fn.prototype&&e(r.material)})})}function lO(t){t.layers===void 0&&Object.assign(t,ki.defaultTwoLayerData("lambert"))}function uS(t){!t.layers||t.layers.forEach(e=>{if(e.type==="depth"&&e.colors.length===10){let i=[...e.colors];i.push(e.colors[9]);let n=[...e.steps];n.push(e.steps[9]);let r={...ln(e),colors:i,steps:n};Object.assign(e,r)}})}function hO(t){t.scene.objects.traverse((e,i)=>{"materials"in i?i.materials.forEach(n=>{typeof n!="string"&&uS(n)}):"material"in i&&typeof i.material!="string"&&uS(i.material)}),Object.values(t.shared.materials).forEach(e=>uS(e))}function cO(t){t.layers&&t.layers.forEach(e=>{e.type==="depth"&&e.num!==void 0&&(e.colors=e.colors.slice(0,e.num),e.steps=e.steps.slice(0,e.num),delete e.num)})}function dO(t){t.layers&&t.layers.forEach(e=>{(function(i){return i.type!=="displace"})(e)&&e.isMask===void 0&&(e.isMask=!1),(e.type==="texture"||e.type==="video")&&e.blending===void 0&&(e.blending=0),(e.type==="noise"||e.type==="displace"&&e.displacementType==="noise")&&(e.voronoiStyle===void 0&&(e.voronoiStyle=0),e.highCut===void 0&&(e.highCut=1),e.lowCut===void 0&&(e.lowCut=0),e.smoothness===void 0&&(e.smoothness=.3),e.seed===void 0&&(e.seed=0),e.quality===void 0&&(e.quality=1))})}function uO(t){let e=t.layers.find(i=>i.type==="light")?.data;if(e?.category==="basic"){let i=Ki.defaultData("light","phong"),n=e;Object.assign(n,i),n.visible=!1}}function pO(t){Fo(t,uO),No(t,uO)}function fO(t){t.layers.forEach(e=>{e.type==="light"&&e.category!=="toon"&&e.occlusion===void 0&&(e.occlusion=!0)})}function mO(t){t.layers&&t.layers.forEach(e=>{e.type==="light"&&e.bumpMapIntensity===void 0&&(e.bumpMapIntensity=5)})}var SX=F(()=>{Gg(),_s(),AC(),jb(),Ye(),Gb(),ar(),et(),SC(),PC(),HF(),TC(),wC(),EC()}),YF={};function gO(t){t.layers&&t.layers.forEach(e=>{e.type==="light"&&e.alphaOverride===void 0&&(e.alphaOverride=1)})}function vO(t){t.rotation=t.rotation.slice(0,3).map(e=>e*_c)}function ZF(t){vO(t),t.type==="Page"&&vO(t.camera),t.states?.forEach(i=>{i.rotation===void 0||i.rotation===null||(i.rotation=i.rotation.slice(0,3).map(n=>n*_c))});let e=t.geometry;e&&e.type==="SphereGeometry"&&(e.thetaLength=(e.thetaLength??180)*_c),e&&e.type==="TorusGeometry"&&(e.arc=e.arc*_c),e&&e.type==="PathGeometry"&&(e.extrusion.angle*=_c,e.extrusion.twist*=_c),t.type==="Mesh"&&t.geometry.type==="TextGeometry"&&(t.geometry.text={textValue:t.geometry.text}),Array.isArray(ln(t.events))&&t.events?.forEach(i=>{(i.type==="MouseDown"||i.type==="MouseUp"||i.type==="MousePress"||i.type==="KeyDown"||i.type==="KeyUp"||i.type==="KeyPress"||i.type==="Collision"||i.type==="Trigger")&&(i.runMode=i.toggle?"Toggle":"Repeat")})}function MX(t){t.scene.objects.traverse((e,i)=>{})}function EX(t){let e=t.schema??104;e!==131&&e<130&&(G_(t.asset),t.schema=130)}function Ou(t,e){e(t.data);for(let i of t.children)Ou(i,e)}function KF(t){let e=t.schema??104;e!==131&&(e<105&&(Ou(t.asset,ZF),t.schema=105),e<118&&(Ou(t.asset,JF),t.schema=118),e<121&&(Ou(t.asset,nA),t.schema=121),e<130&&(Ou(t.asset,AX),t.schema=130))}function QF(t,e){No(t,e),Fo(t,e),Object.values(t.shared.lib.materials).forEach(i=>e(i.asset))}function G_(t){t.layers===void 0&&Object.assign(t,ki.defaultTwoLayerData("phong"))}function AX(t){"materials"in t?t.materials.forEach(e=>{e!==void 0&&typeof e!="string"&&G_(e)}):"material"in t&&t.material!==void 0&&typeof t.material!="string"&&G_(t.material)}function JF(t){t.timelineAnimations=Er({},te.prototype)}function TX(t){let e=[];return t?(t.forEach((i,n)=>{let{path:r,keyframes:s}=i.data,a=r[0]==="material"?i.id:void 0;s?.length?s.forEach(({id:o,data:l})=>{e.push({id:o,data:{...l,path:r,layerId:a,index:n}})}):e.push(Lc.placeholderKeyframe(i.id,r,{layerId:a,index:n}))}),e.sort((i,n)=>i.data.time-n.data.time),new Vt(...e.map((i,n)=>({...i,fi:n})))):new Vt}function CX(t){for(let{id:e,data:i}of[...t.unproxy()]){let n=i.path?.[0];if(!n||!tN.includes(n))continue;let r=iA(i.value);if(!r.length)continue;let s=t.data(e);if(!s)continue;let a=i.value,[o,...l]=r;for(let c of l){let h=Ot.generateUUID();t.insertBefore(null,[{id:h,data:{...i,id:h,path:[n,c],value:a[c],easing:PX(i.easing)}}])}s.path=[n,o],s.value=a[o]}}function iA(t){return t===null||typeof t!="object"?[]:Dg.filter(e=>e in t)}function PX(t){let e=t?.cubicControls;return{...t,cubicControls:{control1:[...e?.control1??[0,0]],control2:[...e?.control2??[1,1]]},...t?.springParameters?{springParameters:{...t.springParameters}}:{}}}function DX(t,e){return Math.abs(t[0]-e[0])<1e-6&&Math.abs(t[1]-e[1])<1e-6}function RX(t){let e=function(s){let a=[];for(let o of Lc.groupKeyframes(s)){let l=new Set(o.keyframes.flatMap(h=>iA(h.data.value))),c=l.size?[...l].map(h=>o.keyframes.filter(d=>iA(d.data.value).includes(h))):[o.keyframes];for(let h of c){let d=[...h].sort((u,p)=>u.data.time-p.data.time);for(let u=0;u+1<d.length;u++)a.push({left:d[u],right:d[u+1]})}}return a}([...t.unproxy()]),i=new Map,n=new Set;for(let{left:s,right:a}of e){let o=s.data.easing?.type,l=(o===void 0?void 0:Lc.presetHandles(o))?.control2??(o===5?Oc(a.data.easing?.cubicControls?.control2,[1,1]):void 0);if(!l)continue;let c=i.get(a.id);c?DX(c,l)||n.add(a.id):i.set(a.id,l)}let r=new Map;for(let{id:s,data:a}of t.unproxy()){let o=a.easing?.type,l=o===void 0?void 0:Lc.presetHandles(o);l&&r.set(s,l.control1)}for(let{left:s,right:a}of e)n.has(a.id)&&r.delete(s.id);for(let[s,a]of r){let o=t.data(s);!o?.easing||(o.easing.cubicControls={control1:a,control2:Oc(o.easing.cubicControls?.control2,[1,1])},o.easing.type=5)}for(let{left:s,right:a}of e){if(!r.has(s.id))continue;let o=t.data(a.id),l=i.get(a.id);!o?.easing||!l||(o.easing.cubicControls={control1:Oc(o.easing.cubicControls?.control1,[0,0]),control2:l})}}function yO(t,e){t.scene.objects.traverse((i,n)=>{let r=n;if(r.type==="Page"&&r.timelines)for(let s of Object.values(r.timelines))for(let a of Object.values(s.objectTimelines??{}))e(a.keyframes)})}function nA(t){t.pivot=[0,0,0],t.pivotRotation=[0,0,0]}function IX(t){}function OX(t){let e=t.schema??0;if(e!==131){if(e>131)return void console.error(`This scene was created with a newer version of Spline (file format ${e}, this runtime reads 131). Update @splinetool/runtime to the latest version to load it correctly.`);console.warn("updating from ",e,"to ",131),function(i,n){if(n<1&&(No(i,oO),Fo(i,oO),i.schema=1),n<2&&(function(r){Object.assign(r.scene.publish,{orbitControls:{...k_.defaultData,...ln(r.scene.publish.orbitControls)}})}(i),i.schema=2),n<3&&(function(r){function s(a){if(a.layers){for(let o of Object.values(a.layers))if(o){for(let[l,c]of Object.entries(o))if((Vb.includes(l)||typeof c=="boolean")&&delete o[l],l==="texture")for(let[h,d]of Object.entries(c))(bC.includes(h)||typeof d=="boolean")&&delete c[h]}}}r.scene.objects.traverse((a,o)=>{o.states.forEach(l=>{let c=l;c.material?s(c.material):c.materials&&c.materials.forEach(h=>{s(h)})})})}(i),i.schema=3),n<4&&(function(r){r.scene.publish.withBackground=!0}(i),i.schema=4),n<5&&(function(r){r.scene.publish.settings.web={compress:!0,preload:!0,preset:1,logo:!0,hint:!1}}(i),i.schema=5),n<6&&(function(r){r.scene.objects.traverse((s,a)=>{let o=a.cloner;o&&(o.radial.scale=o.radial.scale.map(l=>l+1),o.linear.scale=o.linear.scale.map(l=>l+1))})}(i),i.schema=6),n<7&&(function(r){r.scene.objects.traverse((s,a)=>{let o=a.geometry;o&&(o.type==="DodecahedronGeometry"||o.type==="IcosahedronGeometry")&&(o.detail=Math.round(o.detail))})}(i),i.schema=7),n<8&&(i.schema=8),n<9&&(hO(i),i.schema=9),n<10&&(function(r){r.scene.objects.traverse((s,a)=>{a.type==="Mesh"&&(a.geometry.type==="BooleanGeometry"||a.geometry.type==="SubdivGeometry")&&(a.geometry.phongAngle=35)})}(i),i.schema=10),n<11&&(function(r){r.scene.environment.ambientLight.softShadows=!1,r.scene.environment.ambientLight.softShadowQuality="low",r.scene.objects.traverse((s,a)=>{(a.type==="DirectionalLight"||a.type==="SpotLight")&&(a.shadowResolution=1024,a.shadowRadius=1,a.depth=1e5)}),r.shared.penumbraSize=new Array(5).fill(.5)}(i),i.schema=11),n<12&&(hO(i),i.schema=12),n<13&&(function(r){r.shared.audios=Er({},te.prototype)}(i),i.schema=13),n<14&&(function(r){let s=r.shared.materials;Object.entries(s).forEach(([a,o])=>{if(!o.layers){let l={name:"Untitled Material",layers:[{fi:0,data:{type:"light",category:"phong",alpha:.6,visible:!0,mode:0,specular:{r:.2,g:.2,b:.2},shininess:5},id:"layer1"},{fi:1,data:{type:"color",alpha:1,visible:!0,mode:0,color:{r:.2823529411764706,g:.2823529411764706,b:.30196078431372547}},id:"layer2"}]};Object.assign(s,{[a]:l})}})}(i),i.schema=14),n<15&&(function(r){Object.entries(ln(r.shared.images)).filter(s=>s[1].asset===!1).map(s=>s[0]).forEach(s=>{delete r.shared.images[s]}),Object.entries(ln(r.shared.audios)).filter(s=>s[1].asset===!1).map(s=>s[0]).forEach(s=>{delete r.shared.audios[s]})}(i),i.schema=15),n<16&&(function(r){r.scene.publish.settings.web.preload=!1}(i),i.schema=16),n<17&&(No(i,cO),Fo(i,cO),i.schema=17),n<18&&(No(i,lO),Fo(i,lO),i.schema=18),n<19&&(function(r){Object.assign(r.scene.publish.settings,{video:{...Jo.defaultData.settings.video,...ln(r.scene.publish.settings.video)}})}(i),i.schema=19),n<20&&(function(r){r.shared.fonts=Er({},te.prototype)}(i),function(r){let s=[];r.scene.objects.traverse((a,o)=>{let l=o;if(l.type==="TextFrame"){let c=ki.defaultTwoLayerData("phong"),h=typeof l.color=="string"?r.shared.colors[l.color]:l.color;c.layers[1].data.color={r:h.r,g:h.g,b:h.b},c.layers[1].data.alpha=l.alpha;let d=function(f){return f.replace(".typeface","").replace(/optimer/gi,"open sans").replace("space_mono","space mono").replace(/alma_mono/gi,"varela round").replace(/droid_sans_mono/gi,"noto sans mono").replace(/droid_sans|gentilis|gnomon_(simple|foreground)|helvetiker/gi,"roboto").replace(/droid_serif/gi,"roboto slab").replace("_sans"," sans").replace("crimson_text","crimson text").replace("medium_medium","medium").replace("fatface_fatface","fatface").replace("100hairline","thin").replace("200thin","extralight").replace("300light","light").replace("500medium","medium").replace("600semi","semibold").replace("800heavy","extrabold").replace("900black","black").replace(/bodoni_(11|16|24|36|48|72|96)([^_])/gi,"bodoni_$1_$2").replace(/bodoni_(11|16|24|36|48|72|96)/gi,"bodoni moda").replace(/(thin|hairline)(_regular)?/gi,"100").replace(/(extra|ultra)light(_regular)?/gi,"200").replace(/light(_regular)?/gi,"300").replace(/_book|_normal|_roman/gi,"_regular").replace(/medium(_regular)?/gi,"500").replace(/(semi|demi)bold(_regular)?/gi,"600").replace(/(extra|ultra)bold(_regular)?/gi,"800").replace(/bold(_regular)?/gi,"700").replace(/(black|heavy|fatface)(_regular)?/gi,"900").replace(/([1-9]00)_italic/gi,"$1italic").replace(/regularitalic/gi,"italic").replace(/regularitalic/gi,"italic").split(" ").map(g=>g.charAt(0).toUpperCase()+g.slice(1)).join(" ")}(l.font);r.shared.fonts[d]===void 0&&(r.shared.fonts[d]={name:d});let u={name:l.name,...Mn.defaultData,...Ha.defaultData,flatShading:!1,wireframe:!1,geometry:{...Ho.defaultData("TextGeometry"),width:l.width,height:l.height,font:d,depth:0,horizontalAlign:l.horizontalAlign,verticalAlign:l.verticalAlign,fontSize:1.40625*l.fontSize,lineHeight:l.lineHeight/1.40625,letterSpacing:l.letterSpacing-1,text:l.text,textTransform:l.textTransform,extrudeBevelSize:0,extrudeBevelSegments:1},material:c,states:ln(l.states),events:ln(l.events),visible:l.visible,raycastLock:l.raycastLock,position:l.position,rotation:l.rotation,scale:l.scale,hiddenMatrix:l.hiddenMatrix},p=ln(r.scene.objects).parent(a);r.scene.objects.insertAfter(p??null,a,[{id:a+"new",data:u,children:[]}]),s.push(a)}}),s.forEach(a=>{r.scene.objects.delete(a)})}(i),i.schema=20),n<21&&(function(r){let s={0:"MouseDown",1:"MouseUp",2:"MouseHover",5:"KeyDown",6:"KeyUp",7:"Start",9:"LookAt",10:"Follow",11:"Scroll",12:"Audio",13:"GameControl"};r.scene.objects.traverse((a,o)=>{o.events.forEach(l=>{if(s[Number(l.type)])if(Object.assign(l,{type:s[Number(l.type)]}),l.type==="Audio"&&"audioEvent"in l&&(Object.assign(l,{playAudio:l.audioEvent}),delete l.audioEvent),l.type==="GameControl")Object.assign(l,{gameActions:{idle:new Vt,move:new Vt,jump:new Vt}});else{let c=new Vt;Object.assign(l,{actions:c}),(l.type==="MouseDown"||l.type==="MouseUp"||l.type==="KeyDown"||l.type==="KeyUp")&&"url"in l&&c.push({fi:0,id:Ot.generateUUID(),data:{type:"Link",url:l.url,delay:0}}),"targets"in l&&(l.targets.forEach((h,d,u)=>{let p={easing:h.easing,duration:h.duration};h.easing===6?Object.assign(p,uc(h,"mass","stiffness","damping","velocity")):h.easing===5&&Object.assign(p,{control1:{...h.control1},control2:{...h.control2}});let f={repeat:h.repeat?-1:0,delay:h.delay,delayDirection:h.delayDirection,direction:h.cycle&&h.rewind?"pingpong-rewind":h.cycle?"pingpong":"normal"},g={state:h.state,...f,...p},m={allowSlerp:!0,type:"Transition",object:h.object,repeat:0,delay:0,delayDirection:void 0,direction:"normal",tweens:new Vt({fi:0,id:Ot.generateUUID(),data:{state:void 0,repeat:0,delay:0,delayDirection:void 0,direction:"normal",duration:0,easing:4}},{fi:1,id:Ot.generateUUID(),data:g})};c.push({fi:u,id:d,data:m})}),delete l.targets)}})})}(i),function(r){r.scene.objects.traverse((s,a)=>{function o(l,c){let h=new Vt,d=[];if(a.events.forEach((u,p,f)=>{if(u.type==="Audio"&&u.trigger===c){let g;d.push(p),u.interaction==="play"?g={...uc(u,"interaction","audio","delay","volume","loop"),triggerAfter:"after"in u?u.after:void 0,toggle:"after"in u?u.toggle:void 0,type:"Audio"}:(u.interaction==="pause"||u.interaction==="stop")&&(g={...uc(u,"interaction","delay","object","playAudio"),type:"Audio"}),g&&h.push({fi:f,id:p,data:g})}}),d.forEach(u=>a.events.delete(u)),h.length){let u=a.events.find(p=>p.type===l)?.data;u?"actions"in u&&u.actions.insertBefore(null,h):a.events.insertBefore(null,[{id:Ot.generateUUID(),data:{type:l,actions:h}}])}}o("Start","start"),o("MouseDown","mouseDown"),o("MouseUp","mouseUp"),o("KeyDown","keyDown"),o("KeyUp","keyUp")})}(i),i.schema=21),n<22&&(pO(i),i.schema=22),n<23&&(function(r){r.scene.objects.traverse((s,a)=>{a.type==="Mesh"&&a.geometry.type==="SubdivGeometry"&&(a.geometry.scaleBaked||(a.geometry.scaleBaked=[1,1,1]))})}(i),i.schema=23),n<24&&(function(r){r.scene.objects.traverse((s,a)=>{(a.type==="Empty"||a.type==="Mesh")&&a.cloner&&!a.cloner.randomnessObject&&!a.cloner.toObject&&!a.cloner.randomness&&(a.cloner={...a.cloner,toObject:{object:"",spreadType:"random",scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],axis:"x",seed:0,count:99,align:"normal"},randomness:!1,randomnessObject:{strength:100,scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],movement:1,seed:0,freqScale:10,noiseType:"perlin"}})})}(i),i.schema=24),(n<25||i.shared.videos===void 0)&&(function(r){r.shared.videos=Er({},te.prototype)}(i),n<25&&(i.schema=25)),n<26&&(function(r){r.scene.objects.traverse((s,a)=>{let o=r.scene.objects.unproxy().parent(s);if(o){let l=ln(r.scene.objects.data(o));l&&l.type==="Mesh"&&l.geometry.type==="BooleanGeometry"&&a.type==="Mesh"&&(a.visible=ln(a).booleanExclude!==!0)}})}(i),i.schema=26),n<27&&(function(r){r.scene.objects.traverse((s,a)=>{if(a.type==="Mesh"){let o=a;a.geometry.type==="NonParametricGeometry"?o.material!==void 0&&delete o.material:o.materials!==void 0&&delete o.materials}})}(i),i.schema=27),n<28&&(pO(i),i.schema=28),n<29&&(function(r){function s(o){Object.setPrototypeOf(o,fn.prototype),o.texture&&Object.setPrototypeOf(o.texture,fn.prototype)}function a(o){Object.setPrototypeOf(o,fn.prototype);for(let l in o)s(o[l])}r.scene.objects.traverse((o,l)=>{l.states.forEach(c=>{let h=c;if(h.material){let d=ln(h.material).layers;a(d),h.material.layers=d}if(h.materials)for(let d=0;d<h.materials.length;d++){let u=h.materials[d],p=ln(u).layers;a(p),u.layers=p}})})}(i),i.schema=29),n<30&&(function(r){r.scene.objects.traverse((s,a)=>{a.type==="Mesh"&&a.geometry.type==="NonParametricGeometry"&&!("material"in a)&&!("materials"in a)&&(a.material=ki.defaultTwoLayerData("phong"))})}(i),i.schema=30),n<31&&(function(r){r.scene.publish.orbitControls.autoZoom===void 0&&(r.scene.publish.orbitControls.autoZoom=!1),r.scene.objects.traverse((s,a)=>{(a.type==="OrthographicCamera"||a.type==="PerspectiveCamera")&&(a.orthographic.autoZoom===void 0&&(a.orthographic.autoZoom=!1),a.orthographic.autoZoomFrustumSize===void 0&&(a.orthographic.autoZoomFrustumSize=790))})}(i),i.schema=31),n<33&&(function(r){r.scene.objects.traverse((s,a)=>{a.pathSnapping===void 0&&(a.pathSnapping={pathId:null,slide:0,offset:0,orientation:"tangential"}),a.pathSnapping.offset===void 0&&(a.pathSnapping.offset=0)})}(i),i.schema=33),n<34&&(function(r){r.scene.publish.mouseEventTarget===void 0&&(r.scene.publish.mouseEventTarget="canvas"),r.scene.publish.settings.web.hint===void 0&&(r.scene.publish.settings.web.hint=!1)}(i),i.schema=34),n<35&&(function(r){let{video:s}=r.scene.publish.settings;s.format==="gif"&&s.fps>48&&(s.fps=15)}(i),i.schema=35),n<36&&(function(r){r.scene.objects.traverse((s,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&(o.resetYPosition=Math.abs(o.resetYPosition-a.position[1]))})})}(i),i.schema=36),n<37&&(function(r){let s=r.scene.environment.usePhysics;r.scene.objects.traverse((a,o)=>{s&&o.physics===null?o.collision=!1:o.collision="visibility"})}(i),i.schema=37),n<38&&(No(i,dO),Fo(i,dO),i.schema=38),n<39&&(function(r){r.scene.objects.traverse((s,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&(o.navmesh=j_.defaultDataThirdPerson.navmesh)})})}(i),i.schema=39),n<40&&(function(r){r.scene.styles||(r.scene.styles=bc.defaultData())}(i),i.schema=40),n<41&&(function(r){r.scene.environment.ambientLight.occlusion===void 0&&(r.scene.environment.ambientLight.occlusion=!1),r.scene.environment.ambientLight.aoFullRes===void 0&&(r.scene.environment.ambientLight.aoFullRes=!1),r.scene.environment.ambientLight.radius===void 0&&(r.scene.environment.ambientLight.radius=256),r.scene.environment.ambientLight.bias===void 0&&(r.scene.environment.ambientLight.bias=.5),r.scene.environment.ambientLight.aoColor===void 0&&(r.scene.environment.ambientLight.aoColor={r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}),No(r,fO),Fo(r,fO)}(i),i.schema=41),n<42&&(function(r){r.scene.objects.traverse((s,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&Object.assign(o.gameActions,{run:new Vt})})})}(i),i.schema=42),n<43&&(function(r){r.scene.objects.traverse((s,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&(o.keyAssignments=[...o.keyAssignments,["run","\u21E7"],["none","Ctrl"]])})})}(i),i.schema=43),n<99){No(i,mO),Fo(i,mO),i.scene.publish.playCamera===null&&(i.scene.publish.playCamera=Yc);let r=ln(i.scene.objects),s=i.scene.objects;i.scene.publish.playPage=Wu,s.insertBefore(null,null,[{id:Wu,data:{...Ic.defaultData,backgroundColor:i.scene.backgroundColor,fog:i.scene.fog,postprocessing:i.scene.postprocessing,ao:uc(i.scene.environment.ambientLight,"occlusion","aoFullRes","radius","bias","aoColor"),publish:{playCamera:i.scene.publish.playCamera,gameControlObject:i.scene.publish.gameControlObject},shadow:uc(i.scene.environment.ambientLight,"softShadowQuality"),globalPhysics:{...$u.defaultData,...uc(i.scene.environment,"usePhysics","gravity")},camera:ln(i.scene.ownerCamera)??Ic.defaultData.camera,name:"Scene"},children:[]}]);for(let l of r)l.id!==xc.TRASH_CAN_ID&&s.move(Wu,l.fi,l.id);let a=0,o=0;i.shared.penumbraSize&&i.scene.objects.traverse((l,c)=>{c.type==="DirectionalLight"?(c.penumbraSize=i.shared.penumbraSize[Math.min(a,2)],a+=1):c.type==="SpotLight"&&(c.penumbraSize=i.shared.penumbraSize[3+Math.min(o,1)],o+=1),(c.physics===void 0||c.physics===null)&&c.type!=="Instance"&&(c.physics={},Object.assign(c.physics,Xu.defaultData)),c.physics!==void 0&&c.physics!==null&&(c.physics.enabled=c.collision??"visibility",delete c.collision)}),i.schema=99}}(t,e),e<100&&(t.scene.publish.joystickSizeAndXYOffset===void 0&&(t.scene.publish.joystickSizeAndXYOffset=Jo.defaultData.joystickSizeAndXYOffset),t.schema=100),e<101&&(No(t,gO),Fo(t,gO),t.schema=101),e<102&&(function(i){i.scene.objects.traverse((n,r)=>{let s=r.geometry;s&&s.type==="PathGeometry"&&(s.extrusion.capType="flat",s.extrusion.bevel=50,s.extrusion.bevelSides=6,s.extrusion.shape.type==="Custom"&&(s.extrusion.shape.shapeQuality="low"))})}(t),t.schema=102),e<104&&(t.shared.catelogs=new te,t.shared.lib=Wo.defaultData(),t.schema=104),e<105&&(function(i){i.shared.variables=Er({},te.prototype)}(t),t.scene.objects.traverse((i,n)=>{ZF(n)}),t.schema=105);for(let i of Object.values(t.shared.lib.components))KF(i);e<106&&(function(i){let n=ln(i.shared.variables);i.shared.variables=Er(Object.entries(n??{}).map(([r,s],a)=>({fi:a,id:r,data:s})),Vt.prototype)}(t),t.schema=106),e<107&&(t.shared.lib.variables=Wo.defaultData().variables,t.schema=107),e<109&&(function(i){i.shared.particles=Er({},te.prototype),i.shared.lib&&(i.shared.lib.particles=Wo.defaultData().particles)}(t),t.schema=109),e<110&&(function(i){i.scene.objects.traverse((n,r)=>{r.type==="Particle"&&typeof r.renderMaterial.size=="number"&&Object.assign(r.renderMaterial,{size:[r.renderMaterial.size,r.renderMaterial.size]})})}(t),t.schema=110),e<111&&(t.scene.objects.traverse((i,n)=>{(function(r){Array.isArray(ln(r.events))&&r.events?.forEach(s=>{"disabled"in s||(s.disabled=!1),(s.type==="MouseDown"||s.type==="MouseUp"||s.type==="MousePress")&&(s.mode=s.mode||"Object")})})(n)}),t.schema=111),e<112&&(function(i){i.scene.objects.traverse((n,r)=>{r.type==="Page"&&(r.postprocessing.depthOfField.focusDistance=100,r.postprocessing.depthOfField.focalLength=20,r.postprocessing.depthOfField.bokehScale=5)})}(t),t.schema=112),e<113&&(function(i){i.scene.objects.traverse((n,r)=>{Array.isArray(ln(r.events))!==!1&&r.events?.forEach(s=>{let a=s.runMode;s.type==="MouseDown"||s.type==="MouseUp"||s.type==="KeyDown"||s.type==="KeyUp"||s.type==="Collision"||s.type==="Trigger"?s.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode=a??"Repeat"),(o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode=a==="Toggle"?"Toggle":"Normal")}):s.type==="MouseHover"||s.type==="MousePress"||s.type==="KeyPress"?s.actions?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Toggle")}):s.type==="GameControl"?(delete s.actions,Object.keys(s.gameActions).forEach(o=>{s.gameActions[o]?.forEach(l=>{l.type==="Transition"&&(l.runMode="Repeat"),l.type==="Animation"&&(l.runMode="Normal")})})):s.type==="DragDrop"?(delete s.actions,s.dragDropActions?.drag?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Toggle")}),s.dragDropActions?.drop?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Toggle")})):s.type==="Resize"?(delete s.actions,s.breakpoints?.forEach(o=>{o.actions?.forEach(l=>{(l.type==="Transition"||l.type==="Animation"||l.type==="SwitchCamera")&&(l.runMode="Toggle")})})):s.type==="Start"?s.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Once"),(o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Normal")}):s.type==="VariableChange"||s.type==="Scroll"?s.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Normal")}):s.type==="Conditional"&&(delete s.actions,s.inActions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Normal")}),s.outActions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Normal")}))})})}(t),t.schema=113),e<114&&(t.scene.publish.settings.web.imageQuality===void 0&&(t.scene.publish.settings.web.imageQuality=70),t.schema=114),e<115&&(function(i){i.shared.userAPIs=Er({},te.prototype),i.shared.userWebhooks=Er({},te.prototype),i.shared.lib&&(i.shared.lib.userAPIs=Wo.defaultData().userAPIs,i.shared.lib.userWebhooks=Wo.defaultData().userWebhooks)}(t),t.schema=115),e<116&&(function(i){i.scene.publish.settings.videoStatic===void 0&&(i.scene.publish.settings.videoStatic=Jo.defaultData.settings.videoStatic)}(t),t.schema=116),e<117&&(t.scene.publish.settings.web.pixelRatioMobile===void 0&&(t.scene.publish.settings.web.pixelRatioMobile=0),t.scene.publish.settings.web.pixelRatioDesktop===void 0&&(t.scene.publish.settings.web.pixelRatioDesktop=0),t.schema=117),e<118&&(t.shared.timelineAnimations=Er({},te.prototype),t.scene.objects.traverse((i,n)=>{JF(n)}),t.schema=118),e<119&&(t.scene.publish.settings.videoStatic.format=Yu.defaultData.scene.publish.settings.videoStatic.format,t.scene.publish.settings.videoStatic.imageFormat=Yu.defaultData.scene.publish.settings.videoStatic.imageFormat,t.schema=119),e<120&&(t.scene.publish.settings.image.colorSpace="display-p3",t.scene.publish.settings.videoStatic.colorSpace="display-p3",t.schema=120),e<121&&(t.scene.objects.traverse((i,n)=>{nA(n),n.type==="Page"&&n.camera!==void 0&&nA(n.camera)}),t.schema=121),e<122&&(delete t.scene.publish.settings.video,t.scene.publish.orbitControls.rotationSpeed=Yu.defaultData.scene.publish.orbitControls.rotationSpeed,t.schema=122),e<123&&(t.scene.objects.traverse((i,n)=>{n.type==="Page"&&n.sky===void 0&&(n.sky=kl.defaultData)}),t.schema=123),e<124&&(e>=123&&t.scene.objects.traverse((i,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&(typeof r.exposure=="number"&&(r.exposure=Math.round(r.exposure/5e-4*1e4)/1e4),r.lighting===void 0&&(r.lighting=kl.defaultData.lighting))}),t.schema=124),e<125&&(t.scene.objects.traverse((i,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&r.lightingIntensity===void 0&&(r.lightingIntensity=kl.defaultData.lightingIntensity)}),t.schema=125),e<126&&(t.scene.objects.traverse((i,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&(r.mode===void 0&&(r.mode="physical"),r.hdri===void 0?r.hdri={...kl.defaultData.hdri}:(r.hdri.blur===void 0&&(r.hdri.blur=kl.defaultData.hdri.blur),Array.isArray(r.hdri.rotation)&&(r.hdri.rotation=r.hdri.rotation[1]??0)))}),t.schema=126),e<127&&(t.scene.objects.traverse((i,n)=>{let r=n.sky;n.type==="Page"&&r?.hdri!==void 0&&r.hdri.showBackground===void 0&&(r.hdri.showBackground=!0)}),t.schema=127),e<128&&(t.scene.objects.traverse((i,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&r.lightingQuality===void 0&&(r.lightingQuality="full")}),t.schema=128),e<129&&(t.scene.objects.traverse((i,n)=>{if(n.type==="Page"){n.camera===void 0&&(n.camera=Ic.defaultData.camera);let r=n.camera;r.far=1e5,r.perspective?r.perspective.near=70:r.perspective={near:70,fov:45,zoom:1}}}),t.schema=129),e<130&&(QF(t,G_),t.schema=130),e<131&&(function(i){i.scene.objects.traverse((n,r)=>{let s=r.states;if(!s)return;let a=r.timelineAnimations,o=[];s.forEach((l,c)=>{(l.isAnimation||a?.[c])&&o.push(c)}),o.forEach(l=>s.delete(l))})}(t),function(i){let n=i.shared,r=n.timelineAnimations;if(!r)return;let s=i.scene.objects,a=s.unproxy().find(o=>o.data.type==="Page")?.id;for(let[o,l]of Object.entries(r)){let c=Er({},te.prototype),h=0,d=Boolean(l.loop);for(let[f,g]of Object.entries(l.mapping??{})){let m=s.data(f)?.timelineAnimations?.[g];!m||(h=Math.max(h,m.to??0),d=d||Boolean(m.loop),c[f]={id:f,keyframes:TX(m.properties?.unproxy())})}let u=l.page??a,p=u?s.data(u):void 0;p&&p.type==="Page"&&((p.timelines??(p.timelines=Er({},te.prototype)))[o]={id:o,name:l.name,duration:h||5,...d?{loop:d}:{},objectTimelines:c})}delete n.timelineAnimations,s.traverse((o,l)=>{delete l.timelineAnimations})}(t),yO(t,CX),yO(t,RX),t.schema=131)}}kg(YF,{updateAllMaterials:()=>QF,updateDocumentSchema:()=>OX,updateLibSchema:()=>IX,updateMaterialSchema:()=>EX,updateObjectStateRec:()=>Ou,updateObjectsSchema:()=>KF,updateTextValues:()=>MX});var _c,tN,_O,sv,pS,bO,av,wc,Pf,Id,ov,fS,h1,mS,gS,xO,c1,vS,Bc,rA,Hb=F(()=>{et(),qF(),Ye(),$F(),SX(),Gb(),Gg(),ar(),CC(),jb(),MC(),_c=180/Math.PI,tN=["position","rotation","scale","shape size"]}),LX=F(()=>{var t,e,i;_s(),Ye(),ar(),(_O||(_O={})).is=function(n){return!0},(t=sv||(sv={})).defaultData={position:[0,0],scale:[1,1],rotation:0,shear:[0,0]},t.merge=function(n,r){return{position:r?.position??n.position,rotation:r?.rotation??n.rotation,scale:r?.scale??n.scale,shear:r?.shear??n.shear}},t.diff=function(n,r){return hF({position:Ja.isEqual(n.position,r.position)?void 0:r.position,rotation:n.rotation===r.rotation?void 0:r.rotation,scale:Ja.isEqual(n.scale,r.scale)?void 0:r.scale,shear:n.shear&&r.shear&&Ja.isEqual(n.shear,r.shear)?void 0:r.shear})},(pS||(pS={})).defaultData={horizontalConstraint:0,verticalConstraint:0},(bO||(bO={})).defaultData={direction:"row",wrap:"unwrap",align:"top-left",gap:10,rowGap:10,autoGap:!1,autoRowGap:!1,leftPadding:8,rightPadding:8,topPadding:8,bottomPadding:8},(av||(av={})).defaultData={opacity:1,fill:{color:Je.fromHexAndA(Rr,1),enabled:!0},stroke:{color:Je.from0to1([0,0,0,1]),thickness:1,enabled:!1,mode:"inside"},layerBlur:{radius:2,enabled:!1},backgroundBlur:{radius:2,enabled:!1},dropShadow:{offset:[10,10],blurRadius:10,color:Je.from0to1([0,0,0,1]),enabled:!1,spread:0},innerShadow:{offset:[10,10],blurRadius:10,color:Je.from0to1([0,0,0,1]),enabled:!1,spread:0}},(e=wc||(wc={})).newEmpty=function(n,r){return{name:r}},e.patch=function(n,r){if(r===void 0)return n;let s={...n};return Object.assign(s,sv.merge(s,r)),s=function(a,o){if(o===void 0)return a;let l={...a},c=["width","height","cornerRadius"];for(let h of c)h in l&&h in o&&o[h]!==void 0&&Object.assign(l,{[h]:o[h]});return l}(s,r),s=function(a,o){if(o===void 0)return a;let l={...a};return"fill"in l&&"fill"in o&&o.fill!==void 0&&Object.assign(l,{fill:{...l.fill,...o.fill}}),"stroke"in l&&"stroke"in o&&o.stroke!==void 0&&Object.assign(l,{stroke:{...l.stroke,...o.stroke}}),"layerBlur"in l&&"layerBlur"in o&&o.layerBlur!==void 0&&Object.assign(l,{layerBlur:{...l.layerBlur,...o.layerBlur}}),"backgroundBlur"in l&&"backgroundBlur"in o&&o.backgroundBlur!==void 0&&Object.assign(l,{backgroundBlur:{...l.backgroundBlur,...o.backgroundBlur}}),"dropShadow"in l&&"dropShadow"in o&&o.dropShadow!==void 0&&Object.assign(l,{dropShadow:{...l.dropShadow,...o.dropShadow}}),"innerShadow"in l&&"innerShadow"in o&&o.innerShadow!==void 0&&Object.assign(l,{innerShadow:{...l.innerShadow,...o.innerShadow}}),l}(s,r),s},e.toOps=function(n,r){let s,a=[];for(let[o,l]of Object.entries(r))o!=="name"&&(s===void 0&&(s={path:[],props:{},type:0},a.push(s)),s.props[o]=l);return a},(Pf||(Pf={})).defaultData={...sv.defaultData,...pS.defaultData,states:new Vt,events:new Vt,visible:!0,raycastLock:!1},(Id||(Id={})).defaultData={...Pf.defaultData,...av.defaultData},(ov||(ov={})).defaultData={cornerRadius:[0,0,0,0]},(fS||(fS={})).defaultData={...Id.defaultData,type:"ellipse2d",width:100,height:100,name:"Ellipse"},(h1||(h1={})).defaultData={...Id.defaultData,...ov.defaultData,type:"rectangle2d",width:100,height:100,name:"Rectangle"},(mS||(mS={})).defaultData={...Id.defaultData,type:"text2d",width:100,height:100,fontSize:12,lineHeight:1.2,letterSpacing:0,text:{textValue:"Hello world"},horizontalAlign:1,verticalAlign:1,textTransform:1,font:"Roboto_regular",name:"Text"},(gS||(gS={})).defaultData={...Id.defaultData,type:"path2d",path:"",name:"Path"},(xO||(xO={})).is=function(n){return n.type==="ellipse2d"||n.type==="rectangle2d"||n.type==="text2d"||n.type==="vector2d"||n.type==="path2d"},(c1||(c1={})).defaultData={...Pf.defaultData,name:"Group",type:"group2d"},(vS||(vS={})).defaultData=()=>({...Pf.defaultData,...ov.defaultData,...av.defaultData,name:"Frame",type:"frame2d",clipped:!0,width:200,height:200,fill:{color:Je.fromHexAndA(4737101,1),enabled:!0},stroke:{color:Je.fromHexAndA(0,1),thickness:1,enabled:!1,mode:"inside"},backgroundBlur:{radius:2,enabled:!1},layerBlur:{radius:2,enabled:!1}}),(n=>{n.defaultData=function(r){switch(r){case"rectangle2d":case"vector2d":return{...h1.defaultData};case"ellipse2d":return{...fS.defaultData};case"text2d":return{...mS.defaultData};case"path2d":return{...gS.defaultData};case"frame2d":return{...vS.defaultData()};case"group2d":return{...c1.defaultData}}},n.getPivot=function(r){return"width"in r&&"height"in r?[typeof r.width=="number"?.5*r.width:0,typeof r.height=="number"?.5*r.height:0]:[0,0]},n.isResizeable=function(r){return r.type==="rectangle2d"||r.type==="ellipse2d"||r.type==="text2d"||r.type==="frame2d"},n.isAutoLayoutable=function(r){return r.type==="frame2d"&&r.autoLayout!==void 0},n.hasCorners=function(r){return r.type==="rectangle2d"||r.type==="frame2d"}})(Bc||(Bc={})),(i=rA||(rA={})).defaultData={name:"UI",type:"scene2d",objects:new Wn},i.emptyData=function(){return{type:"scene2d",objects:new Wn}}}),BX=F(()=>{vX(),yX(),OF(),LF(),qF(),PF(),wX(),NF(),jF(),MC(),Hb(),WF(),SC(),wC(),BF(),Gg(),FF(),GF(),_s(),Gb(),jb(),AC(),VF(),CC(),TC(),_X(),kF(),PC(),EC(),UF(),zF(),LX()});function Sc(t,e=!1){let i=t[0].index!==null,n=new Set(Object.keys(t[0].attributes)),r=new Set(Object.keys(t[0].morphAttributes)),s={},a={},o=t[0].morphTargetsRelative,l=new Gt,c=0;for(let h=0;h<t.length;++h){let d=t[h],u=0;if(i!==(d.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let p in d.attributes){if(!n.has(p))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+'. All geometries must have compatible attributes; make sure "'+p+'" attribute exists among all geometries, or in none of them.'),null;s[p]===void 0&&(s[p]=[]),s[p].push(d.attributes[p]),u++}if(u!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". Make sure all geometries have the same number of attributes."),null;if(o!==d.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let p in d.morphAttributes){if(!r.has(p))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphAttributes must be consistent throughout all geometries."),null;a[p]===void 0&&(a[p]=[]),a[p].push(d.morphAttributes[p])}if(e){let p;if(i)p=d.index.count;else{if(d.attributes.position===void 0)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". The geometry must have either an index or a position attribute"),null;p=d.attributes.position.count}l.addGroup(c,p,h),c+=p}}if(i){let h=0,d=[];for(let u=0;u<t.length;++u){let p=t[u].index;for(let f=0;f<p.count;++f)d.push(p.getX(f)+h);h+=t[u].attributes.position.count}l.setIndex(d)}for(let h in s){let d=wO(s[h]);if(!d)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+h+" attribute."),null;l.setAttribute(h,d)}for(let h in a){let d=a[h][0].length;if(d!==0){l.morphAttributes=l.morphAttributes||{},l.morphAttributes[h]=[];for(let u=0;u<d;++u){let p=[];for(let g=0;g<a[h].length;++g)p.push(a[h][g][u]);let f=wO(p);if(!f)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+h+" morphAttribute."),null;l.morphAttributes[h].push(f)}}}return l}function wO(t){let e,i,n,r=-1,s=0;for(let c=0;c<t.length;++c){let h=t[c];if(e===void 0&&(e=h.array.constructor),e!==h.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(i===void 0&&(i=h.itemSize),i!==h.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=h.normalized),n!==h.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(r===-1&&(r=h.gpuType),r!==h.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=h.count*i}let a=new e(s),o=new Ht(a,i,n),l=0;for(let c=0;c<t.length;++c){let h=t[c];if(h.isInterleavedBufferAttribute){let d=l/i;for(let u=0,p=h.count;u<p;u++)for(let f=0;f<i;f++){let g=h.getComponent(u,f);o.setComponent(u+d,f,g)}}else a.set(h.array,l);l+=h.count*i}return r!==void 0&&(o.gpuType=r),o}var Hg=F(()=>{et()});function eN(t){let e=t.points.length/7,i=new Vt;for(let n=0;n<e;n++){let r=7*n,s=t.points[r+0],a=t.points[r+1],o=t.points[r+2],l=t.points[r+3],c=t.points[r+4],h=t.points[r+5],d=t.points[r+6];i.push({fi:n,id:Ot.generateUUID(),data:{roundness:d,position:[s,a],areControlsDirectionsMirrored:!0,controlPrevious:{position:[o,l]},controlNext:{position:[c,h]}}})}return{points:i,isClosed:t.isClosed,roundness:t.roundness,shapeHoles:t.shapeHoles?.map(n=>eN(n))??[]}}function iN(t){let{userData:e,uuid:i,...n}=t;if(e===void 0||e.type==="NonParametricGeometry")return function(a){let o,{userData:l,data:c}=a,h=c?.groups,d=c?.attributes??{},u=c?.morphAttributes??{},p=c?.interleavedBuffers,f=c?.arrayBuffers,g=c?.index;d.position!==void 0&&Array.isArray(d.position.array)&&(o=function(y){let v=1/0,_=1/0,b=1/0,x=-1/0,w=-1/0,S=-1/0;for(let A=0;A<y.length;A+=3){let E=y[A],P=y[A+1],T=y[A+2];v=Math.min(v,E),_=Math.min(_,P),b=Math.min(b,T),x=Math.max(x,E),w=Math.max(w,P),S=Math.max(S,T)}return{width:x-v,height:w-_,depth:S-b}}(d.position.array));let m={...l===void 0?{}:l.parameters,data:{attributes:d,morphAttributes:u,interleavedBuffers:p,arrayBuffers:f},...o===void 0?{}:o,type:"NonParametricGeometry"};return g!==void 0&&Object.assign(m.data,{index:g}),h!==void 0&&Object.assign(m.data,{groups:h.map(y=>({...y,materialIndex:y.materialIndex??0}))}),m}(t);if(e.type==="SubdivGeometry"){let a="SubdivGeometry",o=n.data?.attributes;if(o?.positionWASM===void 0){let c=new Gt;if(o?.position===void 0||o?.faceMap===void 0)return null;let h=o.position.array,d=o.faceMap.array,u=n.data.index.array;c.setAttribute("position",new Nt(h,3)),c.setIndex(new nh(u,1));let p=function(y,v=1e-4){v=Math.max(v,Number.EPSILON);let _={},b=y.getIndex(),x=y.getAttribute("position"),w=b?b.count:x.count,S=0,A=Object.keys(y.attributes),E={},P={},T=[],R=["getX","getY","getZ","getW"],L=["setX","setY","setZ","setW"];for(let $=0,nt=A.length;$<nt;$++){let Q=A[$],rt=y.attributes[Q];E[Q]=new rt.constructor(new rt.array.constructor(rt.count*rt.itemSize),rt.itemSize,rt.normalized);let gt=y.morphAttributes[Q];gt&&(P[Q]||(P[Q]=[]),gt.forEach((at,ht)=>{let ct=new at.array.constructor(at.count*at.itemSize);P[Q][ht]=new at.constructor(ct,at.itemSize,at.normalized)}))}let D=.5*v,U=Math.log10(1/v),V=Math.pow(10,U),k=D*V;for(let $=0;$<w;$++){let nt=b?b.getX($):$,Q="";for(let rt=0,gt=A.length;rt<gt;rt++){let at=A[rt],ht=y.getAttribute(at),ct=ht.itemSize;for(let q=0;q<ct;q++)Q+=~~(ht[R[q]](nt)*V+k)+","}if(Q in _)T.push(_[Q]);else{for(let rt=0,gt=A.length;rt<gt;rt++){let at=A[rt],ht=y.getAttribute(at),ct=y.morphAttributes[at],q=ht.itemSize,lt=E[at],z=P[at];for(let O=0;O<q;O++){let j=R[O],Z=L[O];if(lt[Z](S,ht[j](nt)),ct)for(let I=0,G=ct.length;I<G;I++)z[I][Z](S,ct[I][j](nt))}}_[Q]=S,T.push(S),S++}}let Y=y.clone();for(let $ in y.attributes){let nt=E[$];if(Y.setAttribute($,new nt.constructor(nt.array.slice(0,S*nt.itemSize),nt.itemSize,nt.normalized)),$ in P)for(let Q=0;Q<P[$].length;Q++){let rt=P[$][Q];Y.morphAttributes[$][Q]=new rt.constructor(rt.array.slice(0,S*rt.itemSize),rt.itemSize,rt.normalized)}}return Y.setIndex(T),Y}(c),f=[],g=new Array(d[d.length-1]+1).fill(3),m=p.getIndex().array;for(let y=0,v=d.length;y<v;)d[y]===d[y+1]?(g[d[y]]++,f.push(...new Set(m.slice(3*y,3*y+6))),y+=2):(f.push(...m.slice(3*y,3*y+3)),y++);o.indexWASM={array:f},o.positionWASM=p.attributes.position,o.verticesPerFaceWASM={array:g}}if(o?.positionWASM===void 0||o?.positionWASM.length===0||o?.indexWASM===void 0||o?.indexWASM.length===0||o?.verticesPerFaceWASM===void 0||o?.verticesPerFaceWASM.length===0)return null;let l={type:a,...UX(o.positionWASM.array)};l.subdivisions=e.parameters.subdivisions;for(let c in o)c==="positionWASM"?l[c]=new Float32Array(o[c].array):c==="indexWASM"?l[c]=new Int32Array(o[c].array):c==="verticesPerFaceWASM"&&(l[c]=new Int8Array(o[c].array));return l.scaleBaked=[1,1,1],l}let r=e.type,s=e.parameters;return r==="VectorGeometry"?(s.extrudeDepth&&(s.depth=s.extrudeDepth),{...s,width:100,height:100,shape:eN(e.shape),type:r}):r==="LatheGeometry"?{...e.parameters,type:r,points:(e?.parameters.points??[]).map(a=>[a.x,a.y])}:(s.extrudeDepth&&(s.depth=s.extrudeDepth),{...s,type:r})}function UX(t){return sA.setFromArray(t),sA.getSize(Cm),{width:Cm.x,height:Cm.y,depth:Cm.z}}var sA,Cm,nN,il,rg,rN,_p,Df,lv,yS,bp,SO,_S,MO,bS,up,wl,Sl,Eo,xS,EO,AO,wS,aA,tl,zX=F(()=>{Ye(),et(),Hg(),new At,new $t,new Ei,new C,new C,sA=new ci,Cm=new C}),FX=F(()=>{}),NX=F(()=>{Ye(),Hb()}),kX=F(()=>{Gg(),[...Vb],new Set(bC)}),Yt=F(()=>{BX(),FX(),xX(),Hb(),NX(),$F(),kX(),PC(),Ye()}),sl=F(()=>{nN=[3,4,8,9],il=5,rg=3,rN=32}),Wg=F(()=>{et(),_p=t=>{var e;return(e=class extends t{}).geometryHelper=new ga(30,30,30),e}}),qg=F(()=>{et(),Df=new $o,lv=new vr,yS=new At,bp=(t,e,i,n,r=!1,s=t)=>{let a=e,o=s.matrixWorld;if(a.boundingSphere===null&&a.computeBoundingSphere(),lv.copy(a.boundingSphere),lv.applyMatrix4(o),i.ray.intersectsSphere(lv)===!1||(yS.copy(o).invert(),Df.copy(i.ray).applyMatrix4(yS),a.boundingBox!==null&&Df.intersectsBox(a.boundingBox)===!1))return;let l,c,h,d,u,p,f=a.index,g=a.attributes.position,m=a.drawRange;if(r===!1){for(u=Math.max(0,m.start),p=Math.min(f.count,m.start+m.count);u<p;u+=3)if(c=f.getX(u),h=f.getX(u+1),d=f.getX(u+2),l=y(t,i,Df,g,c,h,d),l)return l.faceIndex=Math.floor(u/3),void n.push(l)}else{let v=a.attributes.position,_=new C,b=new C,x=new C,w=new C,S=2,A=1/((s.scale.x+s.scale.y+s.scale.z)/3),E=A*A;for(let P=Math.max(0,m.start),T=Math.min(v.count,m.start+m.count)-1;P<T;P+=S){if(_.fromBufferAttribute(v,P),b.fromBufferAttribute(v,P+1),Df.distanceSqToSegment(_,b,w,x)>E)continue;w.applyMatrix4(s.matrixWorld);let R=i.ray.origin.distanceTo(w);R<i.near||R>i.far||n.push({distance:R,point:x.clone().applyMatrix4(s.matrixWorld),object:t})}}function y(v,_,b,x,w,S,A){let E=new C,P=new C,T=new C,R=new C,L=new C;if(E.fromBufferAttribute(x,w),P.fromBufferAttribute(x,S),T.fromBufferAttribute(x,A),b.intersectTriangle(E,P,T,!1,R)===null)return null;L.copy(R),L.applyMatrix4(v.matrixWorld);let D=_.ray.origin.distanceTo(L);return D<_.near||D>_.far?null:{faceIndex:1,distance:D,point:L.clone(),object:v}}}}),Wb=F(()=>{et(),Wg(),qg(),SO=new C(1,1,1),_S=new C,MO=new C,bS=new $t,up=class extends _p(Dz){constructor(t,e=15){super(e),this.object=t,this.dummy=new vp,this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${t.uuid}`,this.matrix=this.dummy.matrixWorld,this.matrixAutoUpdate=!1,this.object.isBone&&(this.visible=!1)}raycast(t,e){bp(this.object,up.geometryHelper,t,e,!1,this.dummy)}update(){}updateMatrix(){}updateMatrixWorld(t){this.object.matrixWorld.decompose(_S,bS,MO),this.matrix.compose(_S,bS,SO),super.updateMatrixWorld(t)}updateWorldMatrix(t,e){}}}),VX=F(()=>{et(),wl=new C,Sl=new C,Eo=new At,xS=[new C(-1,1,1),new C(-1,-1,1),new C(1,-1,1),new C(1,1,1),new C(-1,1,-1),new C(-1,-1,-1),new C(1,-1,-1),new C(1,1,-1)],EO=[[0,3],[1,2],[5,6],[4,7],[0,1],[3,2],[7,6],[4,5],[0,4],[1,5],[2,6],[3,7]],AO=[[0,2],[7,5],[4,1],[3,6],[4,3],[1,6]],wS=(t,e,i)=>{t.updateEntityBoxSize(wl,Sl),Eo.copy(e).multiply(t.matrixWorld),Sl.x===0&&Sl.y===0&&Sl.z===0?i.push(new C(wl.x,wl.y,wl.z).applyMatrix4(Eo)):xS.forEach(n=>{i.push(n.clone().multiply(Sl).add(wl).applyMatrix4(Eo))})},aA=class extends ci{constructor(){super(...arguments),this.matrix=new At,this.vertices=[],this.faces=[],this.edges=[],this.centerEdges=[]}copy(t){return super.copy(t),this.matrix.copy(t.matrix),this.vertices=t.vertices.map(e=>e.clone()),this.faces=t.faces.map(e=>e.clone()),this.edges=t.edges.map(e=>e.clone()),this.centerEdges=t.centerEdges.map(e=>e.clone()),this}setFromObjectSize(t,e=!1){t.updateWorldMatrix(!1,e),this.makeEmpty(),this.matrix.copy(t.matrixWorld);let i=new At().copy(t.matrixWorld).invert();return this.expandByObjectSize(t,i,e)}expandByObjectSize(t,e,i=!1){let n=[];if(i===!0){let r=[];t.traverseEntity(s=>{if(s.visible||s.cloner&&s.data.visible){if(!("geometry"in s))return Eo.copy(e).multiply(s.matrixWorld),void r.push(new C().applyMatrix4(Eo));wS(s,e,n)}}),n.length===0&&n.push(...r)}else wS(t,e,n);return this.setFromPoints(n)}getCenter(t){return(t=super.getCenter(t)).applyMatrix4(this.matrix),t}getPositionToCenter(t){return(t=super.getCenter(t)).applyMatrix4(Eo.copy(this.matrix).setPosition(0,0,0)),t}computeVertices(){this.getSize(Sl).multiplyScalar(.5),this.getCenter(wl),Eo.copy(this.matrix).setPosition(wl),this.vertices=xS.map(t=>t.clone().multiply(Sl).applyMatrix4(Eo))}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=EO.map(([t,e])=>new vs(this.vertices[t],this.vertices[e])),this.centerEdges=this.edges.map(t=>t.getCenter(new C))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=AO.map(([t,e])=>this.vertices[t].clone().add(this.vertices[e]).multiplyScalar(.5))}}}),H_=F(()=>{tl={Cloner:null,changeEntityProptotype:()=>{},createEntity:()=>{}}});function sg(t){return t?.isParticleSystem===!0}function Gc(t){return t?.isHairSystem===!0}function ch(t){return t?.isShapeBlendEntity===!0}function qb(t){return t?.isPathObject===!0}function as(t){return t?.isObject2D===!0}function Cr(t){return t?.isUIObject===!0}function Lu(t){return t?.isCloner===!0}function Mc(t){return t?.isClone===!0}function d1(t){return t?.isComponentObject===!0}var Li=F(()=>{});function wi(t){DC.add(t)}function Vn(t,e){let i=`${t}:${e}`;hA.has(i)||hA.add(i)}function W_(t,e){RC.set(t,e)}function SS(t){return RC.get(t)}function xp(t,e){IC.set(t,e)}function MS(t){return IC.get(t)}function oA(t,e){OC.set(t,e)}function sN(t){return OC.get(t)}function lA(){return Xb}var DC,hA,RC,IC,OC,Xb,q_,ke=F(()=>{DC=new Set,hA=new Set,RC=new Map,IC=new Map,OC=new Map,Xb=null,q_=null});function aN(t){let e=t.elements;ha.set(e[0],e[1],e[2]),ca.set(e[4],e[5],e[6]),Xa.set(e[8],e[9],e[10])}function oN(){let t=Math.max(ha.lengthSq(),ca.lengthSq(),Xa.lengthSq());ha.lengthSq()>Pm*t?ms.copy(ha).normalize():ms.set(1,0,0),gs.crossVectors(Xa,ms),gs.lengthSq()<=Pm*t&&(gs.copy(ca).addScaledVector(ms,-ca.dot(ms)),gs.lengthSq()<=Pm*t&&function(e,i){e.set(1,0,0).cross(i),e.lengthSq()<=Pm&&e.set(0,1,0).cross(i),e.normalize()}(gs,ms)),gs.normalize(),Ec.crossVectors(ms,gs)}function lN(t){return aN(t),oN(),hN.makeBasis(ms,gs,Ec)}var ha,ca,Xa,ms,gs,Ec,hN,Pm,Dm,hv,Ac,$b,cN=F(()=>{et(),ha=new C,ca=new C,Xa=new C,ms=new C,gs=new C,Ec=new C,hN=new At,Pm=1e-12,Dm=.01}),Xg=F(()=>{et(),cN(),hv=new At,(Ac||(Ac={})).is=function(t){return t&&t.__isSPEObject},$b=t=>class extends t{constructor(){super(...arguments),this.previousModelViewMatrix=new At,this.copyPreviousMatrix=!0,this.hiddenMatrix=new At,this.pivotMatrix=new At,this.matrixWorldRigid=new At,this.shearScale=new At,this.shearScaleInv=new At}get __isSPEObject(){return!0}getPhysicsLocalMatrix(e){return!!this.rigidBody?.isDynamic()&&(e.copy(this.matrixWorld),this.hasNonUniformScale&&e.multiply(this.shearScaleInv),this.parent&&e.premultiply(hv.copy(this.parent.matrixWorld).invert()),e.premultiply(hv.copy(this.hiddenMatrix).invert()),e.multiply(hv.copy(this.pivotMatrix).invert()),!0)}isDescendantOf(e){e instanceof _i&&(e=e.uuid);let i=this;for(;i.parent;){if(i.parent.uuid===e)return!0;i=i.parent}return!1}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(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.matrixWorld.multiply(this.pivotMatrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(let i of this.children)i.updateMatrixWorld(e)}updateWorldMatrix(e,i){let n=this.parent;if(e&&n!==null&&n.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)),this.matrixWorld.multiply(this.pivotMatrix),i)for(let r of this.children)r.updateWorldMatrix(!1,!0)}traverseChildren(e,i=0){for(let n of this.children)Ac.is(n)&&n.traverseObject(e,i+1)}traverseObject(e,i=0){if(e(this,i)!==!0)for(let n of this.children)Ac.is(n)&&n.traverseObject(e,i+1)}updateMatrixWorldRigid(){this.hasNonUniformScale=function(e,i,n){return aN(e),oN(),i.makeBasis(ms,gs,Ec),n.set(ms.dot(ha),ms.dot(ca),ms.dot(Xa),0,gs.dot(ha),gs.dot(ca),gs.dot(Xa),0,Ec.dot(ha),Ec.dot(ca),Ec.dot(Xa),0,0,0,0,1),function(){let r=ha.length(),s=ca.length(),a=Xa.length(),o=Math.max(r,s,a);if(o-r>Dm||o-s>Dm||o-a>Dm)return!0;let l=Dm*o*o;return Math.abs(ha.dot(ca))>l||Math.abs(ha.dot(Xa))>l||Math.abs(ca.dot(Xa))>l}()}(this.matrixWorld,this.matrixWorldRigid,this.shearScale),this.matrixWorldRigid.copyPosition(this.matrixWorld),this.shearScaleInv.copy(this.shearScale).invert()}attach(e,i){this.updateWorldMatrix(!0,!1);let n=new At().copy(this.matrixWorld).invert();return e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),n.multiply(e.parent.matrixWorld)),"hiddenMatrix"in e&&e.hiddenMatrix instanceof At?e.hiddenMatrix.premultiply(n):e.applyMatrix4(n),e.updateWorldMatrix(!1,!1),this.add(e),i!==void 0&&(this.children.pop(),this.children.splice(i,0,e)),this}copy(e,i=!1){return super.copy(e,i),this.hasNonUniformScale=e.hasNonUniformScale,this}onAfterRender(e,i,n,r,s,a){this.copyPreviousMatrix&&this.previousModelViewMatrix.copy(this.modelViewMatrix)}}});function TO(t,e,i){return Vl.subVectors(e,t),Rg.subVectors(e,i),Vl.cross(Rg).length()<=ag}function dN(t){let e=uA.get(t.points);if(e!==void 0&&e.isClosed===t.isClosed)return e.curve;let i=function(n){let r=n.points,s=[r[0]],a=[new C(...r[0].data.position)];pc.copy(a[0]);for(let y=0;y<r.length-1;y++)Vl.fromArray(r[y].data.position),Rg.fromArray(r[y+1].data.position),Su.subVectors(Vl,pc),Mu.subVectors(Vl,Rg),Su.cross(Mu).length()>ag&&(s.push(r[y]),a.push(new C().copy(Vl)),pc.copy(Vl));let o=r[r.length-1];s.push(o),a.push(new C(...o.data.position));let l=n.isClosed,c=s.length-(l?0:1),h=s.length,d=[],u=[];for(let y=0;y<h;y++){let v=s[y].data;d.push(new C(...v.controlPrevious.position)),u.push(new C(...v.controlNext.position))}let p=[];for(let y=0;y<c;y++){let v=y===h-1?0:y+1;p.push(TO(a[y],u[y],a[v])&&TO(a[y],d[v],a[v]))}let f=[];for(let y=0;y<h;y++){let v=s[y].data,_=a[y],b={position:_,prevDir:void 0,nextDir:void 0,controlPrevious:d[y],controlNext:u[y],tan:void 0,baseRoundness:v.roundness,removedLength:0};if(f.push(b),v.roundness===0||!l&&(y===0||y===h-1))continue;let x=l&&y==0?h-1:y-1,w=l&&y==h-1?0:y+1,S=new C().subVectors(a[x],_).normalize(),A=new C().subVectors(a[w],_).normalize();b.prevDir=S,b.nextDir=A;let E=p[l&&y===0?h-1:y-1],P=p[y];if(E&&P){fc.addVectors(S,A).normalize();let T=pc.crossVectors(fc,S).length()/S.dot(fc);b.tan=T,b.removedLength=v.roundness/T}}for(let y=0;y<c;y++){let v=l&&y===h-1?0:y+1,_=f[y],b=f[v];if(_.removedLength!==0||b.removedLength!==0){let x=_.position.distanceTo(b.position);_.removedLength=Math.min(_.removedLength,x/2),b.removedLength=Math.min(b.removedLength,x/2)}}let g=new Array(2*h).fill(null);for(let y=0;y<c;y++){let v=l&&y===h-1?0:y+1,_=f[y],b=f[v],x=null;if(p[y]){let w=_.position.clone(),S=b.position.clone();(_.removedLength!==0||b.removedLength!==0)&&(_.nextDir&&w.add(pc.copy(_.nextDir).setLength(_.removedLength)),b.prevDir&&S.add(pc.copy(b.prevDir).setLength(b.removedLength))),w.distanceTo(S)>ag&&(x=new Zm(w,w.clone().lerp(S,.3),S.clone().lerp(w,.3),S))}else _.position.distanceTo(b.position)>ag&&(x=new Zm(_.position,_.controlNext,b.controlPrevious,b.position));g[2*y+1]=x}for(let y=0;y<h;y++){let v=f[y];if(v.removedLength===0)continue;let _=v.position,b=v.prevDir.clone().multiplyScalar(v.removedLength).add(_),x=v.nextDir.clone().multiplyScalar(v.removedLength).add(_),w=v.tan*v.removedLength;fc.addVectors(v.prevDir,v.nextDir).normalize(),Su.copy(b).lerp(x,.5);let S=b.distanceTo(x)/2;dA.copy(fc).multiplyScalar(Math.sqrt(Math.pow(w,2)-Math.pow(S,2))).add(Su),u1.copy(fc).multiplyScalar(-w).add(dA);let A=_.distanceTo(u1)/_.distanceTo(Su);Mu.copy(v.prevDir).multiplyScalar(A*_.distanceTo(b)).add(_),cA.copy(Mu).lerp(u1,2);let E=b.clone().lerp(Mu,4/3),P=x.clone().lerp(cA,4/3);g[2*y]=new Zm(b,E,P,x)}let m=new uN;for(let y=0;y<g.length;y++){let v=g[y];v&&m.add(v)}return m}(t);return uA.set(t.points,{isClosed:t.isClosed,curve:i}),i}var uN,ag,Vl,Rg,pc,fc,Su,u1,Mu,cA,dA,uA,Be,Wa,CO,PO,Od,ES,cv,dv,DO,AS,TS,Yb,pA,Zc,$a,pN=F(()=>{et(),uN=class extends sE{constructor(){super()}getPoints(t=12){let e,i=[],n=this.getCurveLengths(),r=n[n.length-1]/n.length;for(let s=0,a=this.curves;s<a.length;s++){let o=a[s],l=s===0?n[s]:n[s]-n[s-1],c=Math.ceil(t*l/r),h=o.getPoints(c);for(let d=0;d<h.length;d++){let u=h[d];e&&e.equals(u)||(i.push(u),e=u)}}return this.autoClose&&i.length>1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}},ag=.001,Vl=new C,Rg=new C,pc=new C,fc=new C,Su=new C,u1=new C,Mu=new C,cA=new C,dA=new C,uA=new WeakMap}),Wr=F(()=>{et(),Yt(),VX(),Ye(),H_(),Li(),ke(),Xg(),pN(),ii(),(Be||(Be={})).is=function(t){return t&&t.__isEntity},Wa=t=>Be.is(t),CO={type:"completeState",isfromEntity:!0},PO=["x","y","z"],Od=new C,ES=new C(1,1,1),cv=new $t,dv=new Ei,DO=new C().set(0,1,0),AS=new At,TS=new At,Yb=t=>class extends $b(t){constructor(){super(...arguments),this.raycastLock=!1,this.scaleLock=!1,this.disposed=!1,this.stateSelection=null,this.destroyedInAction=!1,this.instances=[],this.prevState=null,this.currentState=null,this.currentAnimationAction=null,this.reversibleToState=null,this.transitionState={settled:!0,state:null},this.currentTransitionEvent=null,this.previousAction=null,this._singleBBox=new aA,this._recursiveBBox=new aA,this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0,this._needApplyPathSnapping=!0,this.attachedPaths=new Set}get __isEntity(){return!0}entityChildren(e){let i=this.children[e];if(Be.is(i))return i}entityChildrenCount(){let e=this.children.length;for(;e--;)if(Be.is(this.children[e]))return e+1;return 0}get isConcreteEntity(){return typeof this.identity=="string"}get isVirtualEntity(){return typeof this.identity!="string"}get isInstanceRoot(){return this.isConcreteEntity&&this.data.type==="Instance"}nearestInstanceSelfOrParent(){let e=this;for(;e.data.type!=="Instance";){let i=e.parent;if(!Be.is(i))return;e=i}return e}forInstancesRec(e){this.instances.forEach(i=>{i.disposed||e(i),i.forInstancesRec(e)})}super_Entity(e,i){typeof e=="string"&&(this.uuid=e),this.identity=e,this.data=i,this.matrixAutoUpdate=!1,this.dataPatched=this.data}changeSelectedState(e,i,n=!1){if(this.data.states.length!==0||n){for(let r of this.data.states)Zl.toOps(this.data,r.data).forEach(s=>{let a=b_.replaceProps(s,this.data);this.dataPatched=this.data,this.updateByPatchedOp(a,this.data,i)});if(e!==null){let r=this.data.states.data(e);r&&(this.dataPatched=Zl.patch(this.data,r),Zl.toOps(this.data,r).forEach(s=>{this.updateByPatchedOp(s,this.dataPatched,i)}))}n&&this.updateTransformState(this.dataPatched,i),this.stateSelection=e,this.updatePathSnapping(this.dataPatched.pathSnapping)}}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}updateEntityBoxSize(e,i){e.setScalar(0),i.setScalar(0)}resetBBoxNeedsUpdateSelf(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}resetBBoxNeedsUpdate(){this.resetBBoxNeedsUpdateSelf(),this.traverseAncestors(e=>{Wa(e)&&e.resetBBoxNeedsUpdateSelf()}),this.traverseEntity(e=>{e.resetBBoxNeedsUpdateSelf()})}find(e){let i;return this.traverseEntity(n=>{n.uuid===e&&(i=n)}),i}traverseSortNextHelper(){let e=this.parent;if(e){let i=e.children,n=i.indexOf(this)+1;if(Be.is(i[n]))return i[n];if(Be.is(e))return e.traverseSortNextHelper()}}sortNext(){let e=this.children;return this.children.length>0&&Be.is(this.children[0])?e[0]:this.traverseSortNextHelper()}goUp(e){let i=this;for(;e>0&&i!==null;)i=i.parent,e-=1;return i}hasAnccestorOrSelf(e){return this===e||this.hasAnccestor(e)}hasAnccestor(e){let i=this.parent;for(;i;){if(e===i)return!0;i=i.parent}return!1}countToAccestor(e){let i=0,n=this;for(;n!==e;){if(n===null)return-1;n=n.parent,i+=1}return i}forEachEntity(e){for(let i of this.children)Wa(i)&&e(i)}traverseEntityAncestors(e){this.traverseAncestors(i=>{Be.is(i)&&e(i)})}traverseConcreteEntity(e,i=0){if(e(this,i)!==!0)for(let n of this.children)Wa(n)&&n.isConcreteEntity&&n.traverseEntity(e,i+1)}traverseEntity(e,i=0){if(e(this,i)!==!0)for(let n of this.children)Wa(n)&&n.traverseEntity(e,i+1)}traverseVisibleEntity(e){e(this);for(let i of this.children)Wa(i)&&i.visible&&i.traverseVisibleEntity(e)}updateMatrix(){super.updateMatrix(),this.cloner&&this.cloner.onObjUpdateMatrix(),this.dispatchEvent({type:"updateMatrix"})}updateMatrixWorld(e){super.updateMatrixWorld(e),this.dispatchEvent({type:"updateMatrixWorld"})}copy(e,i=!1){return super.copy(e,i),this.dataPatched=e.dataPatched,this.raycastLock=e.raycastLock,this.scaleLock=e.scaleLock,this.hiddenMatrix.copy(e.hiddenMatrix),this}hasEntityChild(){return this.children.some(e=>Wa(e))}isAncestorOf(e){if(this.uuid===e)return!1;let i=!1;return this.traverseEntity(n=>{n.uuid===e&&(i=!0)}),i}toObjectTransformState(e=[]){return this.updateWorldMatrix(!0,!1),ME({position:this.position.toArray(),rotation:[this.rotation.x*Ot.RAD2DEG,this.rotation.y*Ot.RAD2DEG,this.rotation.z*Ot.RAD2DEG],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray(),pivot:[0,0,0],pivotRotation:[0,0,0]},e)}getTransformValues(e,i,n){return i[e].map((r,s)=>n?.shared.getVariable(r,[this.uuid,e,PO[s]])??r)}updateTransformState(e,i){let n=!1;if(e.position&&(this.position.fromArray(this.getTransformValues("position",e,i)),n=!0),e.rotation&&(Od.fromArray(this.getTransformValues("rotation",e,i)).multiplyScalar(Ot.DEG2RAD),this.rotation.setFromVector3(Od),n=!0),e.scale&&(this.scale.fromArray(this.getTransformValues("scale",e,i)),n=!0),e.hiddenMatrix!==void 0&&(n=!0,this.hiddenMatrix.fromArray(e.hiddenMatrix??qu.identity)),e.pivot!==void 0||e.pivotRotation!==void 0){if(n=!0,e.pivot!==void 0&&e.pivotRotation!==void 0)this.pivotMatrix.compose(Od.fromArray(e.pivot).negate(),cv.setFromEuler(dv.fromArray(e.pivotRotation.map(r=>r*Ot.DEG2RAD))).invert(),ES);else if(e.pivot!==void 0)this.pivotMatrix.setPosition(-e.pivot[0],-e.pivot[1],-e.pivot[2]);else if(e.pivotRotation!==void 0){let r=Od.setFromMatrixPosition(this.pivotMatrix);cv.setFromEuler(dv.fromArray(e.pivotRotation.map(s=>s*Ot.DEG2RAD))).invert(),this.pivotMatrix.compose(r,cv,ES)}}return n&&(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(r=>{r.invalidateClonerTransform(this)})),e.position&&e.rotation&&e.scale&&e.hiddenMatrix!==void 0&&this.updateWorldMatrix(!1,!0),n}onVariableUpdate(e=!1){e?this.resetBBoxNeedsUpdate():(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(i=>{i.invalidateClonerTransform(this)}),this.requestRender())}dispose(){this.disposed=!0,this.cloner&&(this.cloner.dispose(),this.cloner=void 0)}disposeChildrenRecursively(){for(let e of this.children)Be.is(e)&&e.disposeRecursively()}disposeRecursively(){this.dispose(),this.children.forEach(e=>{Be.is(e)&&e.disposeRecursively()})}toState(e=[]){return ME({name:this.name,visible:this.visible,raycastLock:this.raycastLock,...this.toObjectTransformState(e)},e)}updateByObjUpdateOp(e,i){e!==void 0&&this.updateByOp({type:0,props:e,path:[]},{...this.data,...e},i,!1)}updateByOp(e,i,n,r){let s=this.data;this.data=i;let a=e,o=ri(e.path,["states","*"]);if(o!==null){if(e.type===0){let[l]=o;if(this?.stateSelection===l){let c={...e.props};if(delete c.name,Object.values(e.props).some(h=>h===void 0)){let h=this.data;if(h!==void 0){let d=kn.zoom(h,e.path.slice(2));if(d)for(let u in e.props)e.props[u]===void 0&&u in d&&(c[u]=d[u])}}a={...e,props:c,path:e.path.slice(2)}}}}else if(e.type===0){let l=this.stateSelection?this.data.states.data(this.stateSelection):void 0;if(l!==void 0){if(e.props.name!==void 0&&l.name){let{name:h,...d}=l;l=d}if(e.props.material!==void 0&&"material"in l){let{material:h,...d}=l;l=d}let c=kn.removeOverridden(e.path,e.props,l);a={...e,props:c}}}if(this.updateByPatchedOpBase(a,Zl.patch(this.data,this.stateSelection?this.data.states.data(this.stateSelection):void 0),n),ri(e.path,["overrides"])){let l=[],c=[...e.path];for(l.push(c[1]),c.splice(0,2);c.length>0&&c[0]==="descendants";)l.push(c[1]),c.splice(0,2);if(l[l.length-1]===void 0){if(e.type===0)for(let h of Object.keys(e.props)){l[l.length-1]=h;let d=n.scene.findInstance([this.uuid,...l]);d&&(d.overrideData=e.props[h],d.updateState(sh.apply(d.component.data,d.overrideData),n))}}else{let h=n.scene.findInstance([this.uuid,...l]);if(h){let d=kn.zoom(h.component.data,c);if((e={...e,path:c}).type===0){let u=e.props;if(d)for(let[p,f]of Object.entries(e.props))f===void 0&&(u===e.props&&(u={...e.props}),u[p]=d[p]);e={...e,props:u}}h.overrideData=N_.resolve(i.overrides,l),h.updateByOp(e,Jn.applySimple(h.data,e),n,!1)}}}else if(this.instances.length>0){let l;if(e.path.length===0&&e.type===0){let c;for(let h of Qo.rootOverrideProps)h in e.props&&(c===void 0&&(c={}),c[h]=e.props[h]);c&&(l={...e,props:c})}else for(let c of Qo.rootOverrideProps)if(ri(e.path,[c])){l=e;break}l!==void 0&&this.instances.forEach(c=>{if(c.isInstanceRoot){let h=sh.filterOp(c.overrideData,l);h&&c.updateByOp(h,Jn.applySimple(c.data,h),n,!0)}}),this.instances.forEach(c=>{if(!c.isInstanceRoot){let h=sh.filterOp(c.overrideData,e);if(h){let d;d=s===c.data&&e===h?i:Jn.applySimple(c.data,h),c.updateByOp(h,d,n,!0)}}})}}updateByPatchedOpBase(e,i,n){if(this.dataPatched=i,e.path.length===0&&e.type===0)e.props.type!==void 0&&!Vc.is(e.props.type)&&tl.changeEntityProptotype(this,i,n);else if(e.path.length===1&&e.path[0]==="geometry"&&e.type===0&&"type"in e.props){tl.changeEntityProptotype(this,i,n);for(let r of this.children)Be.is(r)&&r.updateVisible(n.scene)}this.updateByPatchedOp(e,i,n)}updateByPatchedOp(e,i,n){if(e.path.length===0&&e.type===0?this.updateState(e.props,n):e.type===0&&("resolutionLevel"in e.props||"useChildrenColors"in e.props)&&this.updateState(i,n),e.path[0]==="morphTargetInfluences"&&e.type===0){let r=i.morphTargetInfluences.get(e.path[1])?.data.name;r&&this.updateMorphInfluences(r,n.shared.getVariable(e.props.value,[this.uuid,"morphTargetInfluences",r]))}if(ri(e.path,["pathSnapping"])!==null&&this.updatePathSnapping(i.pathSnapping),ri(e.path,["cloner"])!==null){let r=Jn.drop(e,1);r.path.length===0&&r.type===0&&r.props.disabled===!0?this.setFromClonerState(null,n):this.cloner?this.cloner.updateState(i.cloner,n):(this.setFromClonerState(i.cloner,n),this.expandCloner(n)),this.updateVisible(n.scene)}}updatePathSnapping(e=this.dataPatched.pathSnapping){this._updatedPathSnapping=e,this._needApplyPathSnapping=!0}get updatedPathSnapping(){return this._updatedPathSnapping}applyPathSnapping(e){if(this._needApplyPathSnapping===!1)return;let i=this._updatedPathSnapping?.pathId??this.dataPatched.pathSnapping.pathId,n=this._updatedPathSnapping?.slide??this.dataPatched.pathSnapping.slide??0,r=this._updatedPathSnapping?.offset??this.dataPatched.pathSnapping.offset??0,s=this._updatedPathSnapping?.orientation??this.dataPatched.pathSnapping.orientation;if(i===null)return;let a=e.find(i);if(!a)return;this._needApplyPathSnapping=!1;let o=a.data;if(o.geometry.path.points.length<=1)return;let l=dN(o.geometry.path),c=(n+r)%1;n+r===1&&c===0&&(c=1);let h=null;try{h=l.curves.length?l.getPointAt(c):null}catch{}if(h===null)return;a.updateMatrixWorld();let d=this.parent?AS.copy(this.parent.matrixWorld).invert():AS.identity();d.multiply(a.matrixWorld),h.applyMatrix4(d);let u={position:h.toArray(),rotation:o.rotation};if(s==="tangential"){let p=TS.extractRotation(a.matrixWorld),f=l.getTangentAt(c).applyMatrix4(p).add(h),g=TS.lookAt(h,f,DO),m=Od.setFromEuler(dv.setFromRotationMatrix(g)).multiplyScalar(Ot.RAD2DEG);u={...u,rotation:m.toArray()}}this.updateTransformState(u),this.traverseEntity(p=>{p._cameraType&&p.dispatchEvent(CO)})}updateVisible(e){if(this.visible=this.dataPatched.visible&&(!this.dataPatched.cloner||(this.dataPatched.cloner.disabled??!1)||this.dataPatched.cloner?.hideBase!==!0),!e)return;let i=!1;this.traverseEntity(n=>{if(n.data.type==="Splat")return i=!0,!0}),i&&e.reloadSplats()}updateState_Entity(e,i){e.name!==void 0&&(this.name=e.name),e.raycastLock!==void 0&&(this.raycastLock=e.raycastLock),e.visible!==void 0&&(this.updateVisible(i?.scene),this.resetBBoxNeedsUpdate()),i&&"cloner"in e&&e.cloner!==void 0&&(this.setFromClonerState(e.cloner,i),this.updateVisible(i.scene)),this.updateTransformState(e,i)}get attachedSurfaceCloners(){return this.children.filter(e=>Lu(e)&&e.parameters.type==="toObject")}setFromClonerState(e,i){if(!this.disposed)if(e===null||e.disabled)this.cloner&&this.cloner.dispose(),this.cloner=void 0;else if(this.cloner===void 0){if(tl.Cloner===null)return void Vn("cloners","a cloner");this.cloner=new tl.Cloner(this,e),i.scene.addPendingExpandCloner(this)}else this.cloner.updateState(e,i)}expandCloner(e){!this.disposed&&this.cloner&&this.cloner.expandClones(e)}invalidateClonerTransform(e){this.cloner&&this.cloner.invalidateTransform(e)}requestRender(){this.dispatchEvent({type:"requestRender"})}}}),Kc=F(()=>{et(),Wr(),(pA||(pA={})).is=t=>"objectHelper"in t,Zc=(t,e)=>class extends Yb(t){constructor(){super(...arguments),this.objectHelper=new e(this),this.gizmos={}}get geometryHelper(){return e.geometryHelper}raycast(i,n){this.objectHelper.raycast(i,n)}showGizmos(){for(let i in this.gizmos){let n=this.gizmos[i];n instanceof Sg&&(n.visible=!0)}}updateEntityBoxSize(i,n){this.objectHelper.visible&&this.geometryHelper instanceof ga?(i.setScalar(0),n.set(this.geometryHelper.parameters.width,this.geometryHelper.parameters.height,this.geometryHelper.parameters.height).multiplyScalar(.5)):super.updateEntityBoxSize(i,n)}hideGizmos(){for(let i in this.gizmos){let n=this.gizmos[i];n instanceof Sg&&(n.visible=!1)}}}}),Zb=F(()=>{et(),Wb(),Kc(),$a=class extends Zc(vp,up){constructor(t,e){super(),this.super_Entity(t,e),this.objectHelper.update(),this.data.type==="Empty"&&(this.objectHelper.visible=!1)}updateState(t,e){this.updateState_Entity(t,e),"buffer"in t&&Object.keys(t).length===1&&e.scene.reloadSplats()}}});function Qs(t,e,i,n,r,s,a){Rm.set(r,s,a).unproject(n);let o=e[t];if(o!==void 0){let l=i.getAttribute("position");for(let c=0,h=o.length;c<h;c++)l.setXYZ(o[c],Rm.x,Rm.y,Rm.z)}}var Rm,cs,RO,fN,jX=F(()=>{et(),Wg(),qg(),Rm=new C,cs=new Wl,RO=class extends gu{constructor(t){let e=new Gt,i=new zo({color:16777215,vertexColors:!0,toneMapped:!1}),n=[],r=[],s={},a=new Jt(15711266),o=new Jt(15711266),l=new Jt(2857471);function c(d,u,p){h(d,p),h(u,p)}function h(d,u){n.push(0,0,0),r.push(u.r,u.g,u.b),s[d]===void 0&&(s[d]=[]),s[d].push(n.length/3-1)}c("n1","n2",a),c("n2","n4",a),c("n4","n3",a),c("n3","n1",a),c("f1","f2",a),c("f2","f4",a),c("f4","f3",a),c("f3","f1",a),c("n1","f1",a),c("n2","f2",a),c("n3","f3",a),c("n4","f4",a),c("p","n1",o),c("p","n2",o),c("p","n3",o),c("p","n4",o),c("u1","u2",l),c("u2","u3",l),c("u3","u1",l),e.setAttribute("position",new Nt(n,3)),e.setAttribute("color",new Nt(r,3)),super(e,i),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update()}update(){let t=this.geometry,e=this.pointMap;cs.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let i=.8;Qs("n1",e,t,cs,-1,-1,i),Qs("n2",e,t,cs,1,-1,i),Qs("n3",e,t,cs,-1,1,i),Qs("n4",e,t,cs,1,1,i);let n=i;Qs("f1",e,t,cs,-1,-1,n),Qs("f2",e,t,cs,1,-1,n),Qs("f3",e,t,cs,-1,1,n),Qs("f4",e,t,cs,1,1,n);let r=n;Qs("u1",e,t,cs,.35,1.1,r),Qs("u2",e,t,cs,-.35,1.1,r),Qs("u3",e,t,cs,0,1.55,r),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}},fN=class extends _p(RO){constructor(t){super(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,e){bp(this.object,this.geometry,t,e,!0)}}});function IO(t){return 1-Math.pow(1-t,3)}var $h,uv,pv,fv,Ld,mv,Oa,gn,Hs=F(()=>{et(),jX(),Yt(),Kc(),ii(),$h=new C,uv=new C,pv=new $t,fv=new C,Ld=new C,mv=new C,Oa=class extends Zc(Wl,fN){constructor(t="",e={...ig.defaultData,name:""}){super(),this._cameraType="OrthographicCamera",this.targetOffset=Ko.DefaultTargetOffset,this.isUpVectorFlipped=!1,this.angleOffsetFromUp=0,this.wasMovedByUser=!1,this.wasMovedBySwitchCameraAction=!1,this._createdAt=typeof performance<"u"?performance.now():0,this._tickProjectionTransition=()=>{let r=this._projectionTransition;if(r===void 0)return;if(this.disposed)return void this._endProjectionTransition();r.raf=requestAnimationFrame(this._tickProjectionTransition);let s=Oa.projectionTransitionRequestRender??r.requestRender;this.updateProjectionMatrix(),s?.()},this.super_Entity(t,e),this.previousProjectionMatrix=new At,this.matrixAutoUpdate=!0,this.width=window.innerWidth,this.height=window.innerHeight;let i=this.width,n=this.height;this.orthoCamera=new hp(-.5*i,.5*i,.5*n,-.5*n,-5e4,1e4),this.perspCamera=new Vu(45,i/n,50,1e4),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.focus=this.perspCamera.focus,this.filmGauge=this.perspCamera.filmGauge,this.filmOffset=this.perspCamera.filmOffset,this.objectHelper.update()}static withoutProjectionTransition(t){let e=Oa.projectionTransitionsEnabled;Oa.projectionTransitionsEnabled=!1;try{return t()}finally{Oa.projectionTransitionsEnabled=e}}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}set fov(t){this.perspCamera.fov=t}get fov(){return this.perspCamera.fov}setNear(t,e){t==="PerspectiveCamera"?this.perspCamera.near=e:this.orthoCamera.near=e}setZoom(t,e){e>=0&&(t==="PerspectiveCamera"?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}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,e,i){typeof t=="number"&&(t=new C(t,e,i)),super.lookAt(t),this.getWorldPosition($h),this.targetOffset=$h.distanceTo(t)}getTarget(t=new C){return this.getWorldDirection(uv),this.getWorldPosition($h),uv.multiplyScalar(this.targetOffset),t.copy($h).add(uv),t}getDistanceToTarget(){let t=this.getTarget();return this.getWorldPosition($h),$h.distanceTo(t)}updateUp(){this.getWorldQuaternion(pv),fv.set(0,0,1).applyQuaternion(pv),Ld.copy(_i.DEFAULT_UP),this.isUpVectorFlipped&&Ld.negate(),Ld.applyQuaternion(pv),mv.copy(_i.DEFAULT_UP).projectOnPlane(fv),this.angleOffsetFromUp=mv.angleTo(Ld),this.angleOffsetFromUp*=mv.cross(Ld).dot(fv)>=0?1:-1}updateTransformState(t,e){let i=super.updateTransformState(t,e);return t.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=t.isUpVectorFlipped),this.updateUp(),i}getViewFrontToObject(t){let e=t.getWorldPosition(new C),i=t.getWorldDirection(new C).multiplyScalar(this.targetOffset);return{position:e.clone().add(i),target:e}}getViewToTarget(t){let e=this.getWorldDirection(new C).multiplyScalar(this.targetOffset);return{position:t.clone().sub(e),target:t}}getViewToObject(t){let e=new C;return t.getWorldPosition(e),this.getViewToTarget(e)}setViewplaneSize(t,e,i=!1){if(this.aspect=t/e,i){let n=t>e?this.aspect:1,r=t>e?1:this.aspect;this.left=-395*n,this.right=395*n,this.top=1/r*395,this.bottom=1/r*-395}else this.left=.5*-t,this.right=.5*t,this.top=.5*e,this.bottom=.5*-e;this.updateProjectionMatrix()}copyViewPlaneSize(t){this.aspect=t.aspect,this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.updateProjectionMatrix()}toOrthographic(){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}toPerspective(){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}get isProjectionTransitioning(){return this._projectionTransition!==void 0}get projectionTransitionProgress(){let t=this._projectionTransition;if(t===void 0)return 1;let e=(performance.now()-t.start)/t.duration;return e>=1?1:e<=0?0:IO(e)}get _activeSubCamera(){return this._cameraType==="PerspectiveCamera"?this.perspCamera:this.orthoCamera}_canAnimateProjection(){return Oa.projectionTransitionsEnabled&&typeof requestAnimationFrame=="function"&&typeof performance<"u"&&performance.now()-this._createdAt>=Oa.projectionTransitionMinAgeMs}_beginProjectionTransition(t){let e=this._projectionTransition;e===void 0&&(e={from:new At,blend:new At,blendInverse:new At,start:0,duration:Oa.projectionTransitionDuration,referenceDepth:1,raf:0,requestRender:t},this._projectionTransition=e),e.from.copy(this.projectionMatrix),e.start=performance.now(),e.duration=Oa.projectionTransitionDuration,e.referenceDepth=Number.isFinite(this.targetOffset)?Math.max(1,this.targetOffset):1,t&&(e.requestRender=t),e.raf!==0&&cancelAnimationFrame(e.raf),e.raf=requestAnimationFrame(this._tickProjectionTransition)}_applyProjectionTransition(){let t=this._projectionTransition;if(t===void 0)return;let e=(performance.now()-t.start)/t.duration;if(e>=1)return void this._endProjectionTransition();let i=IO(e),n=t.from.elements,r=this._activeSubCamera.projectionMatrix.elements,s=t.blend.elements,a=t.referenceDepth,o=Math.max(1e-6,n[15]-n[11]*a),l=i*o/(i*o+(1-i)*Math.max(1e-6,r[15]-r[11]*a));for(let c=0;c<16;c++)s[c]=n[c]+(r[c]-n[c])*l;t.blendInverse.copy(t.blend).invert(),this.projectionMatrix=t.blend,this.projectionMatrixInverse=t.blendInverse}_endProjectionTransition(){let t=this._projectionTransition;if(t===void 0)return;t.raf!==0&&cancelAnimationFrame(t.raf),this._projectionTransition=void 0;let e=this._activeSubCamera;this.projectionMatrix=e.projectionMatrix,this.projectionMatrixInverse=e.projectionMatrixInverse}_syncProjectionTransition(t){let e=t._projectionTransition;if(e===void 0)return void(this._projectionTransition!==void 0&&this._endProjectionTransition());let i=this._projectionTransition;i===void 0?(i={from:new At,blend:new At,blendInverse:new At,start:0,duration:1,referenceDepth:1,raf:0,requestRender:void 0},this._projectionTransition=i):i.raf!==0&&(cancelAnimationFrame(i.raf),i.raf=0),i.requestRender=void 0,i.from.copy(e.from),i.start=e.start,i.duration=e.duration,i.referenceDepth=e.referenceDepth,this._applyProjectionTransition()}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,e,i,n,r,s){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(t,e,i,n,r,s):this.orthoCamera.setViewOffset(t,e,i,n,r,s),this._applyProjectionTransition()}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}copyHistory(){this.previousProjectionMatrix&&this.previousProjectionMatrix.copy(this.projectionMatrix)}updateProjectionMatrix(){this._cameraType==="PerspectiveCamera"?this.toPerspective():this._cameraType==="OrthographicCamera"&&this.toOrthographic()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(t,e){return super.copy(t,e),this.parent=t.parent,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=Ko.sanitizeTargetOffset(t.targetOffset),this.updateProjectionMatrix(),this._syncProjectionTransition(t),this}toCameraState(t=[]){return ME({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},t)}updateCameraSubtype(t,e){let i=t==="perspective"?"PerspectiveCamera":"OrthographicCamera";e.zoom!==void 0&&this.setZoom(i,e.zoom),e.near!==void 0&&this.setNear(i,e.near),e.fov!==void 0&&i==="PerspectiveCamera"&&(this.fov=e.fov)}updateState(t,e){this.updateCameraState(t,e)}updateCameraState(t,e){this.updateState_Entity(t,e),t.far!==void 0&&(this.far=t.far),t.orthographic!==void 0&&this.updateCameraSubtype("orthographic",t.orthographic),t.perspective!==void 0&&this.updateCameraSubtype("perspective",t.perspective),t.type!==void 0&&(t.type!==this._cameraType&&this._canAnimateProjection()&&this._beginProjectionTransition(e?.shared.requestRender),this.cameraType=t.type),t.up!==void 0&&this.up.fromArray(t.up.map(i=>typeof i=="number"?i:0)),t.targetOffset!==void 0&&(this.targetOffset=Ko.sanitizeTargetOffset(t.targetOffset)),t.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=t.isUpVectorFlipped),this.updateProjectionMatrix()}updateByPatchedOp(t,e,i){super.updateByPatchedOp(t,e,i),t.path.length===1&&t.type===0&&this.updateCameraSubtype(t.path[0],t.props)}toState(t){return{...super.toState(t),...this.toCameraState(t),type:this.cameraType}}},(gn=Oa).projectionTransitionsEnabled=!1,gn.projectionTransitionDuration=350,gn.projectionTransitionMinAgeMs=1e3});function mN(t){return t.type==="TorusGeometry"&&t.arc===360}var gN,gv,fA,Ig=F(()=>{et(),gN=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,revolutions:2,segments:40,pathRadius:10,pathType:0,pathSegments:30,cornerRadius:30,cornerSegments:4},t.parameters),n=Math.abs(i.width),r=Math.abs(i.height??n),s=Math.abs(i.depth??n),a=Math.abs(Math.min(n,s))/2;return{parameters:Object.assign(i,{width:n,height:r,depth:s,radius:a,segments:Math.round(i.segments),pathSegments:Math.round(i.pathSegments),cornerSegments:Math.round(i.cornerSegments)})}}static build(t){let{width:e,height:i,depth:n,radius:r,revolutions:s,segments:a,pathRadius:o,pathType:l,pathSegments:c,cornerRadius:h,cornerSegments:d}=t.parameters,u=new fA(!1,e,i,n,r,s,a,o,l,c,h,d);return Object.assign(u,{userData:{...t,type:"HelixGeometry"}})}},gv=new nh([0,0,0],1),fA=class extends Gt{constructor(t=!0,e=1,i=1,n=1,r=1,s=1,a=1,o=1,l=1,c=1,h=1,d=1){if(super(),s===0)return;let u=t&&s===1;u&&(d=0),h>100&&(h=100),h===0&&(d=0);let p,f,g,m,y,v,_,b,x=()=>new C,w=new C,S=x(),A=x(),E=x(),P=x(),T=x(),R=x(),L=x(),D=x(),U=x(),V=x(),k=x(),Y=i-2*o+.001,$=Y/s,nt=Math.ceil(a*s),Q=nt+1,rt=Y/nt,gt=-Y/2,at=c+1,ht=2*Math.PI/c,ct=Math.PI/2/d,q=Math.min((1-h/100)*o,o-.01),lt=o-q,z=0,O=2*d+2,j=at*O/2,Z=j+at*Q,I=Math.max(0,at*(Q+O)),[G,W,N]=[3,3,2].map(jt=>Array(I*jt).fill(0)),tt=[],ot=r-o;function pt(jt,Ft){let _e=Math.PI/2;v=Ft*rt,b=2*Math.PI*(v%$)/$+_e,v+=gt,_=Math.sin(b)*ot,y=Math.cos(b)*ot,t?jt.set(y,_,v):jt.set(y,v,_)}pt(w,-1e-10),pt(S,0),P.copy(w),pt(w,1);let ut=w.distanceTo(S),Pt=u?0:lt+q,bt=ut*nt+2*Pt,Rt=q,_t=bt-Pt;for(let jt=0;jt<=nt;jt++){pt(A,jt),k.subVectors(A,P).normalize(),P.copy(A),U.copy(A).setComponent(+t+1,0).normalize(),V.crossVectors(k,U).normalize();let Ft=jt===0,_e=jt===nt,be=Ft?3*Math.PI/2:ct,Vi=Ft?Rt:_t,oe=Ft?at:Z,le=Ft?0:I-at,Pe=k.clone().multiplyScalar(Ft?-lt:lt).add(A),si=k.clone().multiplyScalar(Ft?-1:1).normalize();for(let ze=0;ze<at;ze++){let Pi=ze*ht;if(T.addVectors(w.copy(U).multiplyScalar(o*Math.cos(Pi)),S.copy(V).multiplyScalar(o*Math.sin(Pi))),R.copy(T).normalize(),Ft||_e){u||(z=le+ze,[0,1,2].forEach(ui=>{G[3*z+ui]=Pe.getComponent(ui),W[3*z+ui]=si.getComponent(ui)}),N[2*z]=+_e,N[2*z+1]=ze/c),S.copy(R).multiplyScalar(q),E.addVectors(A,S);for(let ui=0;ui<d;ui++){let tn=ui*ct+be;L.addVectors(w.copy(k).multiplyScalar(lt*Math.sin(tn)),S.copy(R).multiplyScalar(lt*Math.cos(tn))),D.copy(L).normalize(),S.addVectors(E,L),L.normalize(),z=oe+ui*at+ze,[0,1,2].forEach(vn=>{G[3*z+vn]=S.getComponent(vn),W[3*z+vn]=D.getComponent(vn)});let Kr=+Ft+Math.sin(tn);N[2*z]=(Vi+lt*Kr)/bt,N[2*z+1]=ze/c}}S.addVectors(A,T),z=j+jt*at+ze,[0,1,2].forEach(ui=>{G[3*z+ui]=S.getComponent(ui),W[3*z+ui]=R.getComponent(ui)}),N[2*z]=(Pt+jt*ut)/bt,N[2*z+1]=ze/c}}let X=Q+2*d+2,[vt,Dt]=[+u,X-1];for(let jt=vt;jt<=Dt-1;jt++){let Ft=u&&jt===Dt-1;for(let _e=0;_e<at-1;_e++)p=jt*at+_e,f=p+1,g=(Ft?_e:p)+at,m=(Ft?_e+1:f)+at,jt===0?tt.push(f,m,g):jt===X-2?tt.push(p,f,g):tt.push(p,f,g,f,m,g)}this.setIndex(tt),this.setAttribute("position",new Nt(G,3)),this.setAttribute("normal",new Nt(W,3)),this.setAttribute("uv",new Nt(N,2))}getClosedTorusIndicesForBooleanOrSubdiv(){let t,e,i,n,r=this.userData.parameters,s=Math.ceil(r.tubularSegments),a=r.radialSegments,o=a+1,l=[];for(let c=1;c<s;c++)for(let h=0;h<a;h++)t=c*o+h,e=t+1,i=t+o,n=e+o,l.push(t,e,i,e,n,i);for(let c=0;c<a;c++)t=s*o+c,e=t+1,i=c+o,n=c+1+o,l.push(t,e,i,e,n,i);return gv.array=new Uint32Array(l),gv.count=l.length,gv}}});function GX(t){return LO||(LO=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.31/build",i=import("./boolean.js"),[n,r]=await Promise.all([i,fetch(`${e}/boolean.wasm`).then(s=>s.arrayBuffer())]);await n.default({module_or_path:r}),Og=n}())}function X_(){if(Og===void 0)throw new Error("boolean-wasm is not loaded");return Og}function LC(t){let e=Lg.get(t);if(e===void 0)throw new Error("Unknown csg mesh set handle "+t);return e}function BC(t){return Lg.set(++mA,t),mA}function HX(t,e,i){if(Og===void 0)return-1;let{positions:n,indices:r,normals:s}=function(a,o){if(o&&a.userData.positions!==void 0){let p=a.userData,f=[];for(let g=0,m=0;g<p.verticesPerFace.length;g++){let y=p.verticesPerFace[g];for(let v=1;v<y-1;v++)f.push(p.indices[m],p.indices[m+v],p.indices[m+v+1]);m+=y}return{positions:p.positions instanceof Float32Array?p.positions:new Float32Array(p.positions),indices:new Uint32Array(f)}}let l;l=mN(a.userData.parameters)?a.getClosedTorusIndicesForBooleanOrSubdiv():a.getIndex();let c,h=a.getAttribute("position");if(l===null){c=new Uint32Array(h.count);for(let p=0;p<c.length;p++)c[p]=p}else c=l.array instanceof Uint32Array?l.array:new Uint32Array(l.array);let d=a.getAttribute("normal"),u=d!==void 0&&d.itemSize===3&&d.count===h.count&&d.array instanceof Float32Array&&d.isInterleavedBufferAttribute!==!0?d.array:void 0;return{positions:h.array,indices:c,normals:u}}(t,e);return BC(new Og.CsgMesh(n,r,s))}function OO(t,e){let i=X_(),n=yN[e];if(n===void 0)throw new Error("Unknown boolean operation "+e);let r=t.map(LC);if(r.length===1)return i.clone_mesh(r[0]);let s,a=[];if(e===2&&r.length>2){let o=r[0];for(let l=1;l<r.length-1;l++)o=i.boolean_mesh(o,r[l],0),a.push(o);s=i.boolean_mesh(r[r.length-1],o,2)}else if(e===2)s=i.boolean_mesh(r[1],r[0],2);else{let o=r[r.length-1];for(let l=0;l<r.length-1&&(o=i.boolean_mesh(o,r[l],n),a.push(o),o.tri_count()!==0);l++);s=o,a.pop()}for(let o of a)o.free();return s}function CS(t,e){LC(t).transform(new Float32Array(e.elements))}function vN(t){let e=Lg.get(t);e!==void 0&&(e.free(),Lg.delete(t))}var Og,Lg,mA,LO,yN,Kb=F(()=>{et(),Ig(),Lg=new Map,mA=0,yN={0:0,1:1,2:2}});function Yh(t){return t!==null&&"booleanOp"in t}var gA,_N,WX=F(()=>{et(),Wr(),Kb(),gA=class extends Yb(xi){constructor(){super(...arguments),this.booleanMeshSetAddress=-1,this.booleanWasTransformed=!1,this.booleanMatrixInvOld=new At}updateVisible(t){super.updateVisible(t),this.visible=!Yh(this.parent)&&this.visible,Yh(this.parent)&&this.parent.invalidateDownstreamBooleanData()}onClonerLayoutUpdated(){Yh(this.parent)&&this.invalidateDownstreamBooleanData()}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(vN(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(t=!1){return t?this.booleanWasTransformed=!0:this.freeBooleanPointer(),Yh(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let t of this.children)t instanceof gA&&(t.freeBooleanPointer(),Yh(t)&&t.invalidateUpstreamBooleanData())}updateTransformState(t,e){let i=super.updateTransformState(t,e);return i&&Yh(this.parent)&&this.invalidateDownstreamBooleanData(!0),i}onVariableUpdate(t=!1){super.onVariableUpdate(t),Yh(this.parent)&&this.invalidateDownstreamBooleanData(!0)}}}),qX=F(()=>{_N=null});function UC(t,e=0,i=t.count,n,r){let s=1/0,a=1/0,o=1/0,l=-1/0,c=-1/0,h=-1/0;for(let d=e;d<i;d++){let u=t.getX(d),p=t.getY(d),f=t.getZ(d);u<s&&(s=u),p<a&&(a=p),f<o&&(o=f),u>l&&(l=u),p>c&&(c=p),f>h&&(h=f)}Im.min.set(s,a,o),Im.max.set(l,c,h),Im.getCenter(n),Im.getSize(r).multiplyScalar(.5)}var Im,BO,UO,Xi,Yn=F(()=>{et(),WX(),qX(),Im=new ci,BO=new Gt,UO=new Gs,Xi=class extends gA{constructor(t,e){super(BO,UO),this.super_Entity(t,e)}updateState(t,e){this.updateState_Entity(t,e)}raycast(t,e){let i=_N;i===null?super.raycast(t,e):i(this,t,e)}updateEntityBoxSize(t,e){let i=this.geometry.getAttribute("position");i!==void 0?UC(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,t,e):super.updateEntityBoxSize(t,e)}}});function $_(t){return t?.isClassicNodeMaterial===!0}var mn,Bg,bN,xN,og,wN,SN,MN,zC=F(()=>{}),ya=F(()=>{et(),mn=class extends Jt{constructor(t,e,i,n){super(t,e,i),this.isColorA=!0,this.a=n}setRGBA(t,e,i,n){super.setRGB(t,e,i),this.a=n}copy(t){return super.copy(t),this.a="a"in t?t.a:1,this}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}equals(t){return super.equals(t)&&this.a===t.a}setStyle(t,e="srgb"){let i;if(t==="transparent")return this.setRGBA(0,0,0,0),this;if(i=/^((?:rgb|hsl)a?)\(([^)]*)\)/.exec(t)){let n,r=i[1],s=i[2];switch(r){case"rgb":case"rgba":if(n=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.a=r==="rgba"?parseFloat(n[4]):1,super.setStyle(t,e);break;case"hsl":case"hsla":if(n=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)%\s*,\s*(\d*\.?\d+)%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.a=r==="hsla"?parseFloat(n[4]):1,super.setStyle(t,e)}}return super.setStyle(t,e)}get x(){return this.r}get y(){return this.g}get z(){return this.b}get w(){return this.a}set x(t){this.r=t}set y(t){this.g=t}set z(t){this.b=t}set w(t){this.a=t}}}),EN=F(()=>{ya(),Bg=class extends mn{}}),XX=F(()=>{bN=class{constructor(t=1e4){this.timeout=t,this.cache=new Map,this.head={data:null,time:0,src:null,next:null,prev:null},this.tail={data:null,time:1/0,src:null,next:null,prev:null},this.hasClean=!1,this.cleanupTimer=null,this.head.next=this.tail,this.tail.prev=this.head}log(...t){}remove(t){let e=this.cache.get(t);e&&(this.dispose(t,e.data),this.cache.delete(t),e.prev.next=e.next,e.next.prev=e.prev,e.next=null,e.prev=null,e.data=null)}scheduleCleanup(){this.hasClean||(this.log("scheduled cleanup"),this.hasClean=!0,this.cleanupTimer=setTimeout(()=>{this.hasClean=!1,this.cleanupTimer=null,this.log("cleaning");let t=Date.now(),e=this.head.next;for(;e.time<t-this.timeout;){this.dispose(e.src,e.data),this.cache.delete(e.src);let i=e;e=e.next,e.prev=this.head,this.head.next=e,i.next=null,i.prev=null,i.data=null}this.head.next!==this.tail?this.scheduleCleanup():this.log("no more cleanup")},this.timeout+1e3))}has(t){return this.cache.get(t)?.data}load(t){let e=Date.now(),i=this.cache.get(t);return i===void 0?(i={data:this.create(t),src:t,time:e,next:null,prev:null},this.cache.set(t,i)):(i.time=e,i.prev.next=i.next,i.next.prev=i.prev),i.prev=this.tail.prev,i.next=this.tail,this.tail.prev.next=i,this.tail.prev=i,this.scheduleCleanup(),i.data}disposeAll(){this.cleanupTimer!==null&&(clearTimeout(this.cleanupTimer),this.cleanupTimer=null),this.hasClean=!1,this.cache.forEach((t,e)=>{this.dispose(e,t.data),t.next=null,t.prev=null,t.data=null}),this.cache.clear(),this.head.next=this.tail,this.tail.prev=this.head}destroy(){this.disposeAll(),this.head=null,this.tail=null}}}),AN=F(()=>{XX(),xN=class extends bN{create(t){return URL.createObjectURL(new Blob([t]))}dispose(t,e){URL.revokeObjectURL(e)}}}),TN=F(()=>{wN=class{constructor(t,e){this.data=t,this.cache=e,this.refCount=0}deref(){this.refCount,this.refCount-=1,this.refCount===0&&(this.cache.remove(this),this.dispose())}dispose(){this.refCount}},SN=class{constructor(){this.cache=new Map}remove(t){this.cache.delete(t.data)}load(t){let e=this.cache.get(t);return e===void 0&&(e=this.create(t),this.cache.set(t,e)),e.refCount+=1,e}}}),$X=F(()=>{et(),MN=class extends _z{constructor(t){super(t),this.type=qn}parse(t){let e=function(p,f){switch(p){case 1:throw new Error("THREE.HDRLoader: Read Error: "+(f||""));case 2:throw new Error("THREE.HDRLoader: Write Error: "+(f||""));case 3:throw new Error("THREE.HDRLoader: Bad File Format: "+(f||""));default:throw new Error("THREE.HDRLoader: Memory Error: "+(f||""))}},i=function(p,f,g){f=f||1024;let m=p.pos,y=-1,v=0,_="",b=String.fromCharCode.apply(null,new Uint16Array(p.subarray(m,m+128)));for(;0>(y=b.indexOf(`
|
|
4162
|
+
})();`}),aF=F(()=>{lC=class{constructor(t,e,i){this.deps=t,this.onConsole=e,this.onEvent=i,this.disposed=!1,this.eventUnsubs=new Map,this.variablePollHandle=null,this.lastVariables=null}dispose(){this.disposed=!0;for(let t of this.eventUnsubs.values())t();this.eventUnsubs.clear(),this.stopVariablePolling()}execute(t,e){let i=this.deps;switch(t){case"setVariable":{let n=i.setVariable(String(e[0]),e[1]);return n.warning&&this.onConsole("warn",n.warning),n.ok}case"setVariables":{let n=e[0]??{},r=!0;for(let[s,a]of Object.entries(n)){let o=i.setVariable(s,a);o.warning&&this.onConsole("warn",o.warning),r=r&&o.ok}return r}case"getVariable":return i.getVariable(String(e[0]));case"getVariables":return i.getVariables();case"getAllObjects":return i.getAllObjects();case"findObjectByName":case"findObjectById":return i.findObject(String(e[0]));case"getGeometry":{let n=i.getGeometry(String(e[0]),e[1]??{});return n.warning&&this.onConsole("warn",n.warning),n.data}case"updateObject":return i.updateObject(String(e[0]),e[1]??{});case"createObject":return i.createObject(String(e[0]),e[1]??{});case"createCustomMaterial":if(i.createCustomMaterial===void 0)throw new Error("createCustomMaterial: not available on this surface \u2014 custom three.js/TSL materials need the inline HTML-content mode (editor Preview/Play and web exports).");return i.createCustomMaterial(e[0]);case"setMaterial":if(i.setMaterial===void 0)throw new Error("setMaterial: not available on this surface \u2014 custom three.js/TSL materials need the inline HTML-content mode (editor Preview/Play and web exports).");return i.setMaterial(String(e[0]),e[1]);case"cloneObject":return i.cloneObject(String(e[0]),e[1]??{});case"removeObject":return i.removeObject(String(e[0]));case"spawnObject":{let n=i.spawnObject(String(e[0]),e[1]??{});return n.warning&&this.onConsole("warn",n.warning),n.object}case"destroyObject":return i.destroyObject(String(e[0]));case"setInstanceTransforms":{let n=e[1]===null||e[1]===void 0?null:e[1],r=i.setInstanceTransforms(String(e[0]),n);return r<0&&this.onConsole("warn",`spline.setInstanceTransforms: "${String(e[0])}" has no cloner \u2014 make the object a cloner first (its copies are what this drives).`),r}case"emitEvent":case"emitEventReverse":{let n=i.emitEvent(String(e[0]),String(e[1]),t==="emitEventReverse");return n.warning&&this.onConsole("warn",n.warning),n.ok}case"requestRender":return i.requestRender(),!0;case"listenEvent":{let n=String(e[0]);return n==="variableChange"?this.startVariablePolling():this.eventUnsubs.has(n)||this.eventUnsubs.set(n,i.addSplineEventListener(n,r=>{this.onEvent(n,r)})),!0}case"unlistenEvent":{let n=String(e[0]);return n==="variableChange"?this.stopVariablePolling():(this.eventUnsubs.get(n)?.(),this.eventUnsubs.delete(n)),!0}default:throw new Error(`Unknown spline bridge method: ${t}`)}}startVariablePolling(){this.variablePollHandle===null&&(this.lastVariables=this.deps.getVariables(),this.variablePollHandle=window.setInterval(()=>{if(this.disposed)return;let t=this.deps.getVariables(),e=function(i,n){let r=[];for(let s of Object.keys(n))i[s]!==n[s]&&r.push({name:s,value:n[s]});return r}(this.lastVariables??{},t);this.lastVariables=t;for(let i of e)this.onEvent("variableChange",i)},100))}stopVariablePolling(){this.variablePollHandle!==null&&(window.clearInterval(this.variablePollHandle),this.variablePollHandle=null),this.lastVariables=null}}});function tX(t,e,i,n){return[t[0]*e+t[4]*i+t[8]*n+t[12],t[1]*e+t[5]*i+t[9]*n+t[13],t[2]*e+t[6]*i+t[10]*n+t[14]]}var eX=F(()=>{}),oF,iX=F(()=>{}),nX=F(()=>{hC(),aF(),oF=class{constructor(t,e,i){this.iframe=t,this.deps=e,this.onConsole=i,this.disposed=!1,this.handshakeSeen=!1,this.handshakeTimer=null,this.onMessage=n=>{if(this.disposed||n.source!==this.iframe.contentWindow)return;let r=n.data;var s;typeof(s=r)!="object"||s===null||s[Ul]!==!0||typeof s.kind!="string"||this.handleMessage(r)},this.host=new lC(e,i,(n,r)=>{this.sendEvent(n,r)})}attach(){window.addEventListener("message",this.onMessage),this.send({[Ul]:!0,kind:"ready-ack"}),this.handshakeTimer=window.setTimeout(()=>{this.handshakeTimer=null,!this.handshakeSeen&&!this.disposed&&this.onConsole("warn","The HTML content frame has not initialized (no signal from its scripts yet) \u2014 if the page looks frozen, check for errors in its code.")},6e3)}dispose(){this.disposed=!0,window.removeEventListener("message",this.onMessage),this.host.dispose(),this.handshakeTimer!==null&&(window.clearTimeout(this.handshakeTimer),this.handshakeTimer=null)}handleMessage(t){switch(t.kind){case"ready":this.handshakeSeen=!0,this.send({[Ul]:!0,kind:"ready-ack"});break;case"console":this.onConsole(t.level,t.text);break;case"call":{let e;try{e=Promise.resolve(this.host.execute(t.method,t.args))}catch(i){e=Promise.reject(i)}e.then(i=>{this.send({[Ul]:!0,kind:"result",id:t.id,ok:!0,value:i,error:void 0})},i=>{let n=i instanceof Error?i.message:String(i);this.send({[Ul]:!0,kind:"result",id:t.id,ok:!1,value:void 0,error:n}),this.onConsole("error",n)});break}case"input":this.dispatchInput(t.event)}}send(t){this.iframe.contentWindow?.postMessage(t,"*")}sendEvent(t,e){this.send({[Ul]:!0,kind:"event",eventName:t,payload:e})}dispatchInput(t){let e=this.deps.getCanvas();if(!e)return;let i=this.iframe.getBoundingClientRect(),n={bubbles:!0,cancelable:!0,view:window,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey};switch(t.type){case"pointerdown":case"pointermove":case"pointerup":case"pointercancel":e.dispatchEvent(new PointerEvent(t.type,{...n,clientX:(t.x??0)+i.left,clientY:(t.y??0)+i.top,button:t.button,buttons:t.buttons,pointerId:t.pointerId,pointerType:t.pointerType,isPrimary:t.isPrimary,movementX:t.movementX,movementY:t.movementY}));break;case"click":case"dblclick":e.dispatchEvent(new MouseEvent(t.type,{...n,clientX:(t.x??0)+i.left,clientY:(t.y??0)+i.top,button:t.button,buttons:t.buttons}));break;case"wheel":{let r=new WheelEvent("wheel",{...n,clientX:(t.x??0)+i.left,clientY:(t.y??0)+i.top,deltaX:t.deltaX,deltaY:t.deltaY,deltaMode:t.deltaMode});typeof t.wheelDeltaX=="number"&&Object.defineProperty(r,"wheelDeltaX",{value:t.wheelDeltaX}),typeof t.wheelDeltaY=="number"&&Object.defineProperty(r,"wheelDeltaY",{value:t.wheelDeltaY}),e.dispatchEvent(r);break}case"keydown":case"keyup":e.dispatchEvent(new KeyboardEvent(t.type,{...n,key:t.key,code:t.code,repeat:t.repeat}))}}}}),ii=F(()=>{oC(),Nq(),kq(),Vq(),Gq(),Hq(),Wq(),qq(),Xq(),$q(),Yq(),Qq(),hC(),Jq(),aF(),eX(),iX(),nX()}),rX=F(()=>{});function lF(t){return Array.isArray(t)?t:[t]}function y_(t,e){let i=0;for(;i<t.length&&i<e.length;){if(t[i]<e[i])return-1;if(t[i]>e[i])return 1;i+=1}return i!==e.length?-1:i!==t.length?1:0}var sX=F(()=>{});function Er(t,e){return Object.setPrototypeOf(t,e),t}function Gw(t){let e={...t};return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),e}function ql(t,e,i){if(t===void 0?e===void 0?(t=0,e=10):t=e-10:e===void 0&&(e=t+10),t>e){let s=t;t=e,e=s}let n=[],r=1/(i+1);for(let s=0;s<i;s++){let a=t+(e-t)*(s+.75+.5*Math.random())*r;n.push(a)}return n}function cC(t){return t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Uint32Array||t instanceof Int8Array||t instanceof Int16Array||t instanceof Int32Array||t instanceof Float32Array||t instanceof Float64Array}var aX=F(()=>{});function dC(t){if(t.deepFreeze!==void 0)return void t.deepFreeze(t);let e=Object.getOwnPropertyNames(t);for(let i of e){let n=t[i];n&&typeof n=="object"&&dC(n)}return Object.freeze(t)}function hF(t){for(let e of Object.keys(t))t[e]===void 0&&delete t[e];return t}var Hw,__,EE,te,uC,oX=F(()=>{}),ar=F(()=>{rX(),sX(),aX(),oX()}),pC=F(()=>{Hw=class{},__=class extends Hw{constructor(t){super(),this.id=t}},EE=class extends Hw{constructor(t){super(),this.data=t}}}),lX=F(()=>{}),zb=F(()=>{te=class{modifyById(t,e){let i=this;if(i[t]===void 0)throw new Error("not expected");{let n={...i,[t]:e};return Object.setPrototypeOf(n,te.prototype),n}}add(t,e){return this.runOp({type:1,id:t,data:e})?.data??this}runOp(t){let e=this;if(t.type===1){let i,n=e[t.id];i=n===void 0?{type:2,id:t.id}:{type:1,id:t.id,data:n};let{id:r,data:s}=t,a={...e,[r]:s};return Object.setPrototypeOf(a,te.prototype),{data:a,actual:t,reverse:i}}if(t.type===2){let{id:i}=t,n=e[i];if(n===void 0)return null;{let r={...e};return Object.setPrototypeOf(r,te.prototype),delete r[i],{data:r,actual:t,reverse:{type:1,id:i,data:n}}}}return null}}}),fC=F(()=>{uC=class extends Error{}});function cF(t,e){for(let i of t)e(i.id,i.data)!==!0&&cF(i.children,e)}function dF(t,e){if(e(t.id,t.data)!==!0)for(let i of t.children)dF(i,e)}var Wn,ev,cp,Vt,Xc=F(()=>{ar(),fC(),ar(),Wn=class extends Array{constructor(...t){super(...t),Ka(this,"partialObjectCaches"),Ka(this,"objCaches"),Ka(this,"parentCaches"),Object.setPrototypeOf(this,Wn.prototype)}deepFreeze(){let t=0;for(;t<this.length;)dC(this[t]),t++}fillCaches0(t,e){this.objCaches.set(t.id,t),this.parentCaches.set(t.id,e);for(let i of t.children)this.fillCaches0(i,t.id)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,this.parentCaches=new Map;for(let t of this)this.fillCaches0(t,null)}}randomId(){this.fillCaches();let t=Array.from(this.objCaches.keys());if(t.length!==0)return t[Math.max(0,Math.floor(Math.random()*t.length)-1)]}nonExistOrDescendantOf(t,e){if(!this.has(t))return!0;for(;t;){let i=this.parent(t);if(i===e)return!0;t=i}return!1}rootAcestor(t){for(;t;){let e=this.parent(t);if(!e)return t;t=e}return t}isDescendantOf(t,e){for(;t;){let i=this.parent(t);if(i===e)return!0;t=i}return!1}data(t){return this.get(t)?.data}has(t){return this.childrenOf(t)!==void 0}partialCache(t){this.partialObjectCaches===void 0&&(this.partialObjectCaches=new Map);let e=this.get(t);e!==void 0&&this.partialObjectCaches.set(t,e)}get(t){if(this.partialObjectCaches!==void 0){let e=this.partialObjectCaches.get(t);if(e!==void 0)return e}return this.fillCaches(),this.objCaches.get(t)}childrenOf(t){return t===null?this:this.get(t)?.children}traverseFrom(t,e){if(t===null)this.traverse(e);else{let i=this.get(t);i&&dF(i,e)}}traverse(t){cF(this,t)}totalSize(){return this.fillCaches(),this.objCaches.size}parent(t){return this.fillCaches(),this.parentCaches.get(t)}childrenArray(t){return t===null?this:this.get(t).children}modifyById(t,e){if(this.get(t)===void 0)throw new Error("not expected");{let i=this.parent(t),n=this.childrenArray(i),r=n.findIndex(o=>o.id===t);if(r<0)throw new Error("not expected");let s=n[r];n=[...n],n[r]={...s,data:e};let a=new Map;return a.set(t,n[r]),this.modifyArrayBy(i,n,a)}}modifyArrayBy(t,e,i=void 0){let n=t,r=e;for(;n!==null;){let a=r,o=n;if(n=this.parent(n),n===void 0)throw new Error;r=this.childrenArray(n);let l=r.findIndex(c=>c.id===o);if(l<0)throw new Error;r=[...r],r[l]={...r[l],children:a},i&&i.set(o,r[l])}Object.setPrototypeOf(r,Wn.prototype);let s=r;if(i&&this.objCaches!==void 0&&this.parentCaches!==void 0){s.objCaches=this.objCaches;for(let[a,o]of i)s.objCaches.set(a,o);s.parentCaches=this.parentCaches,this.objCaches=void 0,this.parentCaches=void 0}else s.fillCaches();return s}runOp(t){switch(t.type){case 7:return this.addOp(t);case 8:return this.deleteOp(t);case 9:return this.moveOp(t)}return null}checkDuplicatedIdRec({id:t,children:e}){if(this.get(t)!==void 0)return!0;for(let i of e)if(this.checkDuplicatedIdRec(i))return!0;return!1}addOp(t){let{parent:e,fi:i,id:n,data:r,children:s}=t;if(e!==null&&this.get(e)===void 0||this.checkDuplicatedIdRec(t))return null;{let a=e,o=this.childrenArray(a),l={fi:i,id:n,data:r,children:s};return o=[...o,l],o.sort((c,h)=>c.fi-h.fi),t.localIndex=o.indexOf(l),{data:this.modifyArrayBy(a,o),actual:t,reverse:{type:8,id:n}}}}deleteOp(t){let{id:e}=t;if(this.get(e)===null)return null;{let i=this.parent(e);if(i===void 0)return null;let n=this.childrenArray(i),r=n.findIndex(a=>a.id===e);t.localIndex=r,n=[...n];let s=n.splice(r,1)[0];return{data:this.modifyArrayBy(i,n),actual:t,reverse:{type:7,...s,parent:i}}}}moveOp(t){let{parent:e,fi:i,id:n}=t;if(e!==null&&this.get(e)===void 0)return this.deleteOp({type:8,id:n});if(e!==null){let d=e;for(;d!==null;){if(d===void 0)throw new Error;if(d===n)throw new uC("cyclic tree");d=this.parent(d)}}let r=this.parent(n);if(r===void 0)return null;let s=r,a=this.childrenArray(r),o=a.findIndex(d=>d.id===n);a=[...a];let l=a.splice(o,1)[0],c=this.modifyArrayBy(r,a);r=e,a=c.childrenArray(r);let h=l.fi;return l={...l,fi:i},a=[...a,l],a.sort((d,u)=>d.fi-u.fi),t.localIndex=a.indexOf(l),c=c.modifyArrayBy(r,a),{data:c,actual:t,reverse:{type:9,parent:s,fi:h,id:n}}}previous(t,e){if(e===null){let n=this.childrenArray(t);return n.length===0?null:n[n.length-1].id}let i=null;for(let n of this.childrenArray(t)){if(n.id===e)return i;i=n.id}return null}traverseSortNext(t){let e=this.parent(t);if(e!==void 0){let i=this.childrenArray(e),n=i.findIndex(r=>r.id===t)+1;if(n<i.length)return i[n].id;if(e)return this.traverseSortNext(e)}}sortNext(t){let e=this.childrenArray(t);return e.length>0?e[0].id:this.traverseSortNext(t)}traverseSortPrevious(t){let e=this.childrenArray(t);return e.length>0?this.traverseSortPrevious(e[e.length-1].id):t}sortPrevious(t){let e=this.parent(t);if(e!==void 0){let i=this.childrenArray(e),n=i.findIndex(r=>r.id===t)-1;return n>=0?this.traverseSortPrevious(i[n].id):e}}getAllSorted(t){let e=[];for(let i of t){let n=this.getWithSortKey(i.id);n!==void 0&&e.push({...i,...n})}e.sort((i,n)=>y_(i.sortKey,n.sortKey));for(let i of e)delete i.sortKey;return e}getAllIdSorted(t){let e=[];for(let i of t){let n=this.getWithSortKey(i);n!==void 0&&e.push(n)}e.sort((i,n)=>y_(i.sortKey,n.sortKey));for(let i of e)delete i.sortKey;return e.map(i=>i.id)}getWithSortKey(t){let e=t,i=[],n=this.get(e),r=n;if(n!==void 0){for(;e;)i.splice(0,0,n.fi),e=this.parent(e),e!==null&&(n=this.get(e));return{...r,sortKey:i}}}insertBeforeHelper(t,e,i){return this.insertAfterHelper(t,this.previous(t,e),i)}insertAfterHelper(t,e,i){let n=this.childrenArray(t);if(e===null){if(n.length===0)return ql(0,i,i);{let r=n[0].fi;return ql(r-i,r,i)}}{let r=this.get(e);if(r===void 0||this.parent(e)!==t)throw new Error("illegal args");let s=n.find(a=>a.fi>r.fi);if(s===void 0){let a=n[n.length-1].fi;return ql(a,a+i,i)}return ql(r.fi,s.fi,i)}}}}),mC=F(()=>{var t;ev=null,(t=cp||(cp={})).setPreservePrototype=function(e){ev=e},t.tryPreservePrototype=function(e,i){return Object.getPrototypeOf(e)===ev&&Object.setPrototypeOf(i,ev),i},t.runOp=function(e,i){if(i.type!==0)return null;if(Array.isArray(e)){let n=i.props,r={},s=[...e],a=!1;if(n)for(let o of Object.keys(n)){let l=parseInt(o);if(isNaN(l))throw new Error("wrong index");r[o]=s[l],s[l]=n[o],a=!0}return a?{data:s,actual:i,reverse:{type:0,props:r}}:null}{let n=i.props,r={},s={...e},a=!1;if(n)for(let o of Object.keys(n)){r[o]=s[o];let l=n[o];l===void 0?delete s[o]:s[o]=l,a=!0}return a?{data:t.tryPreservePrototype(e,s),actual:i,reverse:{type:0,props:r}}:null}}}),$c=F(()=>{ar(),ar(),Vt=class extends Array{constructor(...t){super(...t),Ka(this,"objCaches"),Object.setPrototypeOf(this,Vt.prototype)}deepFreeze(){let t=0;for(;t<this.length;)dC(this[t]),t++}fillCaches0(t){this.objCaches.set(t.id,t)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,Object.getOwnPropertyDescriptor(this,"objCaches").enumerable=!1;for(let t of this)this.fillCaches0(t)}}randomId(){this.fillCaches();let t=Array.from(this.objCaches.keys());if(t.length!==0)return t[Math.max(0,Math.floor(Math.random()*t.length)-1)]}data(t){return this.get(t)?.data}get(t){return this.fillCaches(),this.objCaches.get(t)}modifyById(t,e){if(this.get(t)===void 0)throw new Error("not expected");{let i=this,n=i.findIndex(s=>s.id===t);if(n<0)throw new Error("not expected");let r=i[n];return i=[...i],i[n]={...r,data:e},this.modifyArrayBy(i)}}modifyArrayBy(t){Object.setPrototypeOf(t,Vt.prototype);let e=t;return typeof process<"u"||e.fillCaches(),e}runOp(t){switch(t.type){case 4:return this.addOp(t);case 5:return this.deleteOp(t);case 6:return this.moveOp(t)}return null}addOp(t){let{fi:e,id:i,data:n}=t,r=this,s={fi:e,id:i,data:n};return r=[...r,s],r.sort((a,o)=>a.fi-o.fi),t.localIndex=r.indexOf(s),{data:this.modifyArrayBy(r),actual:t,reverse:{type:5,id:i}}}deleteOp(t){let{id:e}=t,i=this,n=i.findIndex(s=>s.id===e);if(n===-1)return null;t.localIndex=n,i=[...i];let r=i.splice(n,1)[0];return{data:this.modifyArrayBy(i),actual:t,reverse:{type:4,...r}}}moveOp(t){let{fi:e,id:i}=t,n=this;n=[...n];let r=n.findIndex(o=>o.id===i);if(r===-1)return null;let s=n[r].fi,a={...n[r],fi:e};return n[r]=a,n.sort((o,l)=>o.fi-l.fi),t.localIndex=n.indexOf(a),{data:this.modifyArrayBy(n),actual:t,reverse:{type:6,fi:s,id:i}}}previous(t){if(t===null)return this.length===0?null:this[this.length-1].id;let e=null;for(let i of this){if(i.id===t)return e;e=i.id}return null}insertBeforeHelper(t,e){return this.insertAfterHelper(this.previous(t),e)}insertAfterHelper(t,e){let i=this;if(t===null){if(i.length===0)return ql(0,e,e);{let n=i[0].fi;return ql(n-e,n,e)}}{let n=this.get(t);if(n===void 0)throw new Error("illegal args");let r=i.find(s=>s.fi>n.fi);if(r===void 0){let s=i[i.length-1].fi;return ql(s,s+e,e)}return ql(n.fi,r.fi,e)}}}});function hX(t,e){let i={cur:[],result:[],len:0};return[t=Gu(t,e,i)??t,i.result]}function s1(t,e){return t===null?null:(t.cur[t.len]=e,t.len+=1,t)}function a1(t){t&&(t.len-=1)}function uF(t,e,i){let n=!1,r=t.map(s=>{let a=s.id,o=e[a];if(o!==void 0&&typeof o=="string"&&(n=!0,a=o,i!==null))throw new Error("not supported");let l=Gu(s.data,e,s1(i,a));a1(i),n=n||l!==void 0,l===void 0&&(l=s.data);let c=uF(s.children,e,i);return c!==void 0?n=!0:c=s.children,{...s,id:a,data:l,children:c}});if(n)return r}function Gu(t,e,i){if(t instanceof Wn){let n=uF(t,e,i);return n!==void 0&&Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n}if(t instanceof Vt)return function(n,r,s){let a=!1,o=n.map(l=>{let c=l.id,h=r[c];if(h!==void 0&&typeof h=="string"&&(a=!0,c=h,s!==null))throw new Error("not supported");let d=Gu(l.data,r,s1(s,c));return a1(s),a=a||d!==void 0,d===void 0&&(d=l.data),{...l,id:c,data:d}});if(a)return Object.setPrototypeOf(o,Object.getPrototypeOf(n)),o}(t,e,i);if(Array.isArray(t)){let n=!1,r=t.map((s,a)=>{let o=Gu(s,e,s1(i,a));return a1(i),n=n||o!==void 0,o===void 0&&(o=s),o});return n?(Object.setPrototypeOf(r,Object.getPrototypeOf(t)),r):void 0}if(t&&typeof t=="object"&&!cC(t)){let n={},r=!1;for(let[s,a]of Object.entries(t))if(s!=="name"&&s!=="variableId"){let o=e[s];if(typeof o=="string"){if(i!==null)throw new Error("not supported");r=!0,s=o}let l=Gu(a,e,s1(i,s));a1(i),r=r||l!==void 0,l===void 0&&(l=a),n[s]=l}else n[s]=a;return r?(Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n):void 0}if(typeof t=="string"){let n=e[t];return n!==void 0&&function(r){if(r===null)return null;r.result.push(r.cur.slice(0,r.len))}(i),n}}var pF=F(()=>{Xc(),$c(),ar()});function Hu(t){return t&&typeof t=="object"&&t instanceof fn}function gC(t,e){if(e===void 0)return;let i=!1,n=t.map(r=>{let s=r.id,a=tg(r.data,e[s]);if(i=i||a!==void 0,a===void 0&&(a=r.data),r.children){let o=gC(r.children,e);return o!==void 0?i=!0:o=r.children,{...r,id:s,data:a,children:o}}return{...r,id:s,data:a}});return i?n:void 0}function tg(t,e){if(!Hu(e))return e;if(t instanceof Wn){let i=gC(t,e);return i!==void 0&&Object.setPrototypeOf(i,Object.getPrototypeOf(t)),i}if(t instanceof Vt)return function(i,n){if(n===void 0)return;let r=!1,s=i.map(a=>{let o=a.id,l=tg(a.data,n[o]);return r=r||l!==void 0,l===void 0&&(l=a.data),{...a,id:o,data:l}});return r?(Object.setPrototypeOf(s,Object.getPrototypeOf(i)),s):void 0}(t,e);if(Array.isArray(t)){let i=!1,n=t.map((r,s)=>{let a=tg(r,e[s]);return i=i||a!==void 0,a===void 0&&(a=r),a});return i?(Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n):void 0}if(t instanceof fn)return vC(t,e);if(t&&typeof t=="object"){let i={},n=!1;for(let[r,s]of Object.entries(t)){let a=tg(s,e[r]);n=n||a!==void 0,a===void 0&&(a=s),i[r]=a}return n?(Object.setPrototypeOf(i,Object.getPrototypeOf(t)),i):void 0}}function vC(t,e){if(t===void 0)return e;if(e===void 0)return t;if(!Hu(e))return e;if(!Hu(t))return sh.apply(t,e);let i=new Set;for(let r of Object.keys(t))i.add(r);for(let r of Object.keys(e))i.add(r);let n=new fn;for(let r of i){let s=vC(t===void 0?void 0:t[r],e===void 0?void 0:e[r]);n[r]=s}return n}var fn,sh,b_,Jn,BR,yC=F(()=>{var t;Xc(),$c(),kb(),ar(),fn=class{unusedFunOverridesTable(e){}runOp(e){let i=[],n=this,r=0,s={};for(;r<e.path.length;){if(i.push(n),n=n===void 0?void 0:n[e.path[r]],n!==void 0&&!Hu(n))return null;r+=1}n=n?Gw(n):new fn;for(let[a,o]of Object.entries(e.props)){let l=n[a];s[a]=l,o===void 0?delete n[a]:n[a]=o}for(;r>0;){if(Object.keys(n).length===0){let a=i[r-1];a&&(n=Gw(a),delete n[e.path[r-1]])}else{let a=i[r-1];if(a){let o=Gw(a);o[e.path[r-1]]=n,n=o}else{let o=new fn;o[e.path[r-1]]=n,n=o}}r-=1}return{data:Object.setPrototypeOf(n,fn.prototype),actual:e,reverse:{...e,props:s}}}},(t=sh||(sh={})).apply=function(e,i){return tg(e,i)??e},t.merge=function(e,i){return vC(e,i)},t.filterOp=function(e,i){let n=0,r=i.path,s=e;for(;n<r.length&&s!==void 0;){if(s=kn.zoomOnce(s,r[n]),s===void 0)return i;if(!Hu(s))return;n+=1}if(s===void 0)return i;if(Hu(s)){if(i.type===0){let a={...i.props};for(let o of Object.keys(s))delete a[o];return{...i,props:a}}if(i.type===1||i.type===4||i.type===7){let a=gC([i],s);return a?a[0]:i}return i}}}),cX=F(()=>{kb(),zb(),Xc(),fC(),mC(),$c(),pF(),yC(),(b_||(b_={})).replaceProps=function(t,e){let i=kn.zoom(e,t.path);if(typeof i=="object"){let n={};for(let r of Object.keys(t.props))n[r]=i[r];return{...t,props:n}}return{...t,props:{}}},(t=>{function e(r,s){let a=s.path,o=[];for(;;){let l;if(r instanceof fn&&s.type===0&&(l=r.runOp({...s,path:a.slice(o.length)}),l===null&&(l=void 0)),l===void 0&&o.length===a.length&&(l=r instanceof Wn||r instanceof Vt||r instanceof te?r.runOp(s):cp.runOp(r,s)),l!==void 0){if(l!==null){let d=l.data;for(let u=o.length-1;u>=0;u--){let p=a[u],f=o[u];if(f instanceof Wn){if(typeof p=="number")throw new Error("illegal arg");d=f.modifyById(p,d)}else if(f instanceof Vt){if(typeof p=="number")throw new Error("illegal arg");d=f.modifyById(p,d)}else if(f instanceof te){if(typeof p=="number")throw new Error("illegal arg");d=f.modifyById(p,d)}else if(f instanceof fn){let g={...f,[p]:d};d=Object.setPrototypeOf(g,fn.prototype)}else{if(typeof f!="object")return null;if(Array.isArray(f)){if(typeof p=="string"&&(p=parseInt(p),isNaN(p)))throw new Error("Invalid path");let g=d;d=[...f],d[p]=g}else d=cp.tryPreservePrototype(f,{...f,[p]:d})}}return{data:d,actual:{...l.actual,path:a},reverse:{...l.reverse,path:a}}}return null}let c,h=a[o.length];if(r instanceof Wn){if(typeof h=="number")throw new Error("");c=r.get(h)?.data}else if(r instanceof Vt){if(typeof h=="number")throw new Error("");c=r.get(h)?.data}else r!==null&&(c=r[h]);if(c===void 0)return null;o.push(r),r=c}}function i(r,s){for(let a=0;a<r.length&&a<s.length;a++)if(r[a]!==s[a])return!0;return!1}function n(r,s){if(r.length!==s.length)return!1;for(let a=0;a<r.length;a++)if(r[a]!==s[a])return!1;return!0}t.drop=function(r,s){return{...r,path:r.path.slice(s)}},t.applySimple=function(r,s){return e(r,s)?.data??r},t.apply=e,t.pathDisjoint=i,t.pathEq=n,t.commutative=function(r,s){return i(r.path,s.path)},t.subsumed=function(r,s){return!(r.type!==0||s.type!==0||!n(r.path,s.path))&&Object.keys(r.props).every(a=>s.props[a]!==void 0)}})(Jn||(Jn={})),(t=>{function e(i,n){let r=i,s=[],a=[];for(let o of n)try{if(o.type===3||o.type===5&&o.path[o.path.length-1]==="variables"){let l,c,h;if(o.type===3?(l=kn.zoom(r,[...o.path,o.id]),h=Jn.apply(r,{...o,type:2})):(l=kn.zoom(r,[...o.path,o.id,"value"]),h=Jn.apply(r,o)),h!==null){r=h.data;let[d,u]=hX(r,{[o.id]:l});r=d;for(let p=0;p<u.length;p++){let f=u[p],g=f.pop();if(typeof g=="number"){let m=[g];for(let v=p+1;v<u.length;v++){let _=u[v],b=_[_.length-1];if(typeof b!="number"||!kn.equal(f,_.slice(0,_.length-1)))break;m.push(b),u.splice(v,1)}let y=kn.zoom(r,f);c=y.map((v,_)=>m.includes(_)?o.id:v),l=y,g=f.pop()}else{if(g==="alphaOverride"||g==="alpha"){l/=100;let m=l,y=kn.zoom(r,f.slice(0,f.length-2)),v=y.layers.map(_=>_.id===f[f.length-1]?{..._,data:{..._.data,[g]:m}}:_);Object.setPrototypeOf(v,Object.getPrototypeOf(y.layers)),y.layers=v}c=o.id}s.push({type:0,path:f,props:{[g]:l}}),a.push({type:0,path:f,props:{[g]:c}})}a.push(h.reverse),s.push(h.actual)}}else{let l=Jn.apply(r,o);l!==null&&(s.push(l.actual),r=l.data,a.push(l.reverse))}}catch(l){if(l instanceof uC)return null;throw l}return{data:r,actual:s,reverse:a.reverse()}}t.empty=function(){return[]},t.removePrefix=function(i,n){let r=[];for(let s of i){let[a,...o]=s.path;a===n&&r.push({...s,path:o})}return r},t.addPrefix=function(i,n){return i.map(r=>({...r,path:[n,...r.path]}))},t.concat=function(i,n){return[...i,...n]},t.compress=function(i,n){return[...i.filter(r=>!n.some(s=>Jn.subsumed(r,s))),...n]},t.commutative=function(i,n){return i.every(r=>n.every(s=>Jn.commutative(r,s)))},t.applyAll=function(i,n){for(let r of n){let s=e(i,r);s!==null&&(i=s.data)}return i},t.apply=e})(BR||(BR={}))});function Ww(t,e,i){if(t.length>0){let n=t[t.length-1];if(n.type===0&&e.type===0&&kn.equal(n.path,i))return void Object.assign(n.props,e.props)}t.push({...e,path:i})}function o1(t,e,i){return i instanceof Wn?new Fb(t,e,i):i instanceof Vt?new Nb(t,e,i):i instanceof te?new Proxy(new mF(t,e,i),vF):i!==null&&typeof i=="object"?cC(i)?i:new Proxy(new fF(t,e,i),gF):i}function Em(t){let e=new TE(t);return[o1(e,"",t),e]}function x_(t,e){let[i,n]=Em(t);return e(i),n.result()}function ln(t){return t instanceof Fb||t instanceof Nb?t._current:t!==null&&typeof t=="object"?t[AE]:t}var AE,UR,Tf,Dd,fF,mF,qw,gF,vF,Fb,Nb,TE,kn,yF=F(()=>{zb(),Xc(),mC(),$c(),ar(),kb(),AE=Symbol(),UR=Symbol(),Tf=Symbol(),Dd=class{reportOp(t,e,i=[]){let n=this;if(e===null)return;n._current=e.data;let r=i;for(;!(n instanceof TE);){let s=n._path,a=n._current;if(s!==""&&r.splice(0,0,s),n=n._parent,n===null)return;n.update(s,a)}n.push(r,t,e.actual,e.reverse)}deleteChildren(t){if(this._children){let e=this._children[t];if(e){let i=e[Tf];i&&i(),delete this._children[t]}}}},fF=class extends Dd{constructor(t,e,i){super(),this._parent=t,this._path=e,this._current=i}update(t,e){if(Array.isArray(this._current)){if(typeof t=="string"&&(t=parseInt(t),isNaN(t)))throw new Error("Invalid path");this._current=[...this._current],this._current[t]=e}else this._current=cp.tryPreservePrototype(this._current,{...this._current,[t]:e})}runOp(t){this.reportOp(t,cp.runOp(this._current,t),t.path)}},mF=class extends Dd{constructor(t,e,i){super(),this._parent=t,this._path=e,this._current=i}update(t,e){this._current={...this._current,[t]:e},Object.setPrototypeOf(this._current,te.prototype)}runOp(t){this.reportOp(t,this._current.runOp(t))}},qw={get(t,e){if(e===Tf)return()=>{t._parent=null};if(e===AE)return t._current;if(e===UR)return t;let{_current:i,_children:n}=t;if(e==="push"&&Array.isArray(i))throw new Error("not supported to expand array");let r=n===void 0?void 0:n[e];if(r!==void 0)return r;let s=i[e],a=o1(t,e,s);return a!==s?(n===void 0&&(n={},t._children=n),n[e]=a,a):s},has:(t,e)=>e in t._current,ownKeys:t=>Reflect.ownKeys(t._current),defineProperty(){throw Error("not supported")},getPrototypeOf:t=>Object.getPrototypeOf(t._current),setPrototypeOf(){throw Error("not supported")},getOwnPropertyDescriptor(t,e){let i=t._current,n=Reflect.getOwnPropertyDescriptor(i,e);return n&&{writable:!0,configurable:!0,enumerable:n.enumerable,value:i[e]}}},gF={...qw,set(t,e,i){let n={type:0,props:{[e]:ln(i)??i}};return t.deleteChildren(e),t.runOp(n),!0},deleteProperty(t,e){let i={type:0,props:{[e]:void 0}};return t.deleteChildren(e),t.runOp(i),!0}},vF={...qw,set(t,e,i){return i===void 0?this.deleteProperty(t,e):(t.deleteChildren(e),t.runOp({type:1,id:e,data:i})),!0},deleteProperty:(t,e)=>(t.runOp({type:2,id:e}),!0)},Fb=class extends Dd{constructor(t,e,i){super(),this._children={},this._parent=t,this._path=e,this._current=i,this[Tf]=()=>{this._parent=null}}unproxy(){return this._current}update(t,e){this._current=this._current.modifyById(t,e)}runOp(t){this.reportOp(t,this._current.runOp(t))}randomId(){return this._current.randomId()}isDescendantOf(t,e){return this._current.isDescendantOf(t,e)}childrenOf(t){return this._current.childrenOf(t)}get(t){return this._current.get(t)}parent(t){return this._current.parent(t)}traverse(t){this._current.traverse((e,i)=>{t(e,this.data(e))})}data(t){let{_current:e,_children:i}=this,n=i===void 0?void 0:i[t];if(n!==void 0)return n;let r=e.get(t)?.data,s=o1(this,t,r);return s!==r?(i===void 0&&(i={},this._children=i),i[t]=s,s):r}add(t,e,i,n,r){this.runOp({type:7,parent:t,fi:e,id:i,data:n,children:r})}move(t,e,i){this.runOp({type:9,parent:t,fi:e,id:i})}insertAfter(t,e,i){let n=this._current.insertAfterHelper(t,e,i.length);for(let r=0;r<i.length;r++){let s=i[r];this.add(t,n[r],s.id,s.data,s.children)}}insertBefore(t,e,i){let n=this._current.insertBeforeHelper(t,e,i.length);for(let r=0;r<i.length;r++){let s=i[r];this.add(t,n[r],s.id,s.data,s.children)}}moveAfter(t,e,i){let n=this._current.insertAfterHelper(t,e,i.length);for(let r=0;r<i.length;r++){let s=i[r];this.move(t,n[r],s)}}moveBefore(t,e,i){let n=this._current.insertBeforeHelper(t,e,i.length);for(let r=0;r<i.length;r++){let s=i[r];this.move(t,n[r],s)}}delete(t){this.deleteChildren(t),this.runOp({type:8,id:t})}sortNext(t){return this._current.sortNext(t)}sortPrevious(t){return this._current.sortPrevious(t)}getAllSorted(t){return this._current.getAllSorted(t)}},Nb=class extends Dd{constructor(t,e,i){super(),this._children={},this._parent=t,this._path=e,this._current=i,this[Tf]=()=>{this._parent=null}}unproxy(){return this._current}get length(){return this._current.length}forEach(t){let e=this.length;for(let i=0;i<e;i++){let n=this._current[i].id,r=this._current[i].fi;t(this.data(this._current[i].id),n,r,i)}}find(t){let e=this.length;for(let i=0;i<e;i++){let n=this._current[i].id;if(t(this.data(n),n))return this.get(n)}}update(t,e){this._current=this._current.modifyById(t,e)}randomId(){return this._current.randomId()}get(t){return{...this._current.get(t),data:this.data(t)}}at(t){let{id:e,fi:i}=this._current.at(t);return{id:e,fi:i,data:this.data(e)}}data(t){let{_current:e,_children:i}=this,n=i===void 0?void 0:i[t];if(n!==void 0)return n;let r=e.get(t)?.data,s=o1(this,t,r);return s!==r?(i===void 0&&(i={},this._children=i),i[t]=s,s):r}runOp(t){this.reportOp(t,this._current.runOp(t))}add(t,e,i){this.runOp({type:4,fi:t,id:e,data:i})}move(t,e){this.runOp({type:6,fi:t,id:e})}insertAfter(t,e){let i=this._current.insertAfterHelper(t,e.length);for(let n=0;n<e.length;n++){let r=e[n];this.add(i[n],r.id,r.data)}}insertBefore(t,e){let i=this._current.insertBeforeHelper(t,e.length);for(let n=0;n<e.length;n++){let r=e[n];this.add(i[n],r.id,r.data)}}moveAfter(t,e){let i=this._current.insertAfterHelper(t,e.length);for(let n=0;n<e.length;n++){let r=e[n];this.move(i[n],r)}}moveBefore(t,e){let i=this._current.insertBeforeHelper(t,e.length);for(let n=0;n<e.length;n++){let r=e[n];this.move(i[n],r)}}delete(t){this.deleteChildren(t),this.runOp({type:5,id:t})}},TE=class extends Dd{constructor(t){super(),this.ts=[],this.actual=[],this.reverse=[],this._current=t}update(t,e){if(t!=="")throw new Error("");this._current=e}push(t,e,i,n){Ww(this.ts,e,t),Ww(this.actual,i,t),Ww(this.reverse,n,t)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}}}),kb=F(()=>{pC(),yF(),$c(),Xc(),ar(),(t=>{function e(n,r){return(n instanceof Wn||n instanceof Fb)&&typeof r=="string"||(n instanceof Vt||n instanceof Nb)&&typeof r=="string"?n.data(r):typeof r=="number"&&Array.isArray(n)||typeof r=="string"&&typeof n=="object"&&n!==null?n[r]:void 0}function i(n,r,s=0){for(;s<r.length&&n!==void 0;)n=e(n,r[s]),s+=1;return n}t.equal=function(n,r){if(r.length!==n.length)return!1;{let s=0;for(;s<n.length;){if(n[s]!==r[s])return!1;s+=1}}return!0},t.removeOverridden=function(n,r,s){let a=i(s,n);if(a!==void 0&&typeof a=="object"&&a!==null){let o={...r};return Object.keys(a).forEach(l=>{delete o[l]}),o}return r},t.zoomOnce=e,t.zoom=i,t.findPathes=function(n,r){let s=[];return function a(o,l){if(o instanceof __&&o.id===r.id)s.push(l);else if(o instanceof Vt)for(let c=0;c<o.length;c++)a(o[c].data,[...l,o[c].id]);else if(o instanceof Wn)o.traverse((c,h)=>{a(c,[...l,h])});else if(Array.isArray(o))for(let c=0;c<o.length;c++)a(o[c],[...l,c]);else{if(cC(o))return;if(typeof o=="object"&&o!==null)for(let c in o)a(o[c],[...l,c])}}(n,[]),s}})(kn||(kn={}))}),dX=F(()=>{});function ri(t,e){let i=[];if(!(e.length<=t.length))return null;{let n=0;for(;n<e.length;){if(e[n]==="*")i.push(t[n]);else if(t[n]!==e[n])return null;n+=1}}return i}var uX=F(()=>{});function iv(t){try{if(!bi.trusted&&!Zo){let i=Qe.sharedLength||0;i<Qe.length&&(Qe.length=i)}let e;if(bi.randomAccessStructure&&kt[mt]<64&&kt[mt]>=32&&jR?(e=jR(kt,mt,Ns,bi),kt=null,!(t&&t.lazy)&&e&&(e=e.toJSON()),mt=Ns):e=pn(),yr&&(mt=yr.postBundlePosition,yr=null),Zo&&(Qe.restoreStructures=null),mt==Ns)Qe&&Qe.restoreStructures&&zR(),Qe=null,kt=null,Yo&&(Yo=null);else{if(mt>Ns)throw new Error("Unexpected end of MessagePack data");if(!Zo){let i;try{i=JSON.stringify(e,(n,r)=>typeof r=="bigint"?`${r}n`:r).slice(0,100)}catch(n){i="(JSON view not available "+n+")"}throw new Error("Data read, but end of buffer not reached "+i)}}return e}catch(e){throw Qe&&Qe.restoreStructures&&zR(),PE(),(e instanceof RangeError||e.message.startsWith("Unexpected end of buffer")||mt>Ns)&&(e.incomplete=!0),e}}function zR(){for(let t in Qe.restoreStructures)Qe[t]=Qe.restoreStructures[t];Qe.restoreStructures=null}function pn(){let t=kt[mt++];if(t<160){if(t<128){if(t<64)return t;{let e=Qe[63&t]||bi.getStructures&&_F()[63&t];return e?(e.read||(e.read=CE(e,63&t)),e.read()):t}}if(t<144){if(t-=128,bi.mapsAsObjects){let e={};for(let i=0;i<t;i++){let n=xF();n==="__proto__"&&(n="__proto_"),e[n]=pn()}return e}{let e=new Map;for(let i=0;i<t;i++)e.set(pn(),pn());return e}}{t-=144;let e=new Array(t);for(let i=0;i<t;i++)e[i]=pn();return bi.freezeData?Object.freeze(e):e}}if(t<192){let e=t-160;if(ua>=mt)return Xl.slice(mt-fs,(mt+=e)-fs);if(ua==0&&Ns<140){let i=e<16?_C(e):bF(e);if(i!=null)return i}return M_(e)}{let e;switch(t){case 192:return null;case 193:return yr?(e=pn(),e>0?yr[1].slice(yr.position1,yr.position1+=e):yr[0].slice(yr.position0,yr.position0-=e)):MF;case 194:return!1;case 195:return!0;case 196:if(e=kt[mt++],e===void 0)throw new Error("Unexpected end of buffer");return Xw(e);case 197:return e=He.getUint16(mt),mt+=2,Xw(e);case 198:return e=He.getUint32(mt),mt+=4,Xw(e);case 199:return Xh(kt[mt++]);case 200:return e=He.getUint16(mt),mt+=2,Xh(e);case 201:return e=He.getUint32(mt),mt+=4,Xh(e);case 202:if(e=He.getFloat32(mt),bi.useFloat32>2){let i=BE[(127&kt[mt])<<1|kt[mt+1]>>7];return mt+=4,(i*e+(e>0?.5:-.5)|0)/i}return mt+=4,e;case 203:return e=He.getFloat64(mt),mt+=8,e;case 204:return kt[mt++];case 205:return e=He.getUint16(mt),mt+=2,e;case 206:return e=He.getUint32(mt),mt+=4,e;case 207:return bi.int64AsType==="number"?(e=4294967296*He.getUint32(mt),e+=He.getUint32(mt+4)):bi.int64AsType==="string"?e=He.getBigUint64(mt).toString():bi.int64AsType==="auto"?(e=He.getBigUint64(mt),e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=He.getBigUint64(mt),mt+=8,e;case 208:return He.getInt8(mt++);case 209:return e=He.getInt16(mt),mt+=2,e;case 210:return e=He.getInt32(mt),mt+=4,e;case 211:return bi.int64AsType==="number"?(e=4294967296*He.getInt32(mt),e+=He.getUint32(mt+4)):bi.int64AsType==="string"?e=He.getBigInt64(mt).toString():bi.int64AsType==="auto"?(e=He.getBigInt64(mt),e>=BigInt(-2)<<BigInt(52)&&e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=He.getBigInt64(mt),mt+=8,e;case 212:if(e=kt[mt++],e==114)return LE(63&kt[mt++]);{let i=gr[e];if(i)return i.read?(mt++,i.read(pn())):i.noBuffer?(mt++,i()):i(kt.subarray(mt,++mt));throw new Error("Unknown extension "+e)}case 213:return e=kt[mt],e==114?(mt++,LE(63&kt[mt++],kt[mt++])):Xh(2);case 214:return Xh(4);case 215:return Xh(8);case 216:return Xh(16);case 217:return e=kt[mt++],ua>=mt?Xl.slice(mt-fs,(mt+=e)-fs):AF(e);case 218:return e=He.getUint16(mt),ua>=(mt+=2)?Xl.slice(mt-fs,(mt+=e)-fs):TF(e);case 219:return e=He.getUint32(mt),ua>=(mt+=4)?Xl.slice(mt-fs,(mt+=e)-fs):CF(e);case 220:return e=He.getUint16(mt),mt+=2,FR(e);case 221:return e=He.getUint32(mt),mt+=4,FR(e);case 222:return e=He.getUint16(mt),mt+=2,NR(e);case 223:return e=He.getUint32(mt),mt+=4,NR(e);default:if(t>=224)return t-256;if(t===void 0){let i=new Error("Unexpected end of MessagePack data");throw i.incomplete=!0,i}throw new Error("Unknown MessagePack token "+t)}}}function CE(t,e){function i(){if(i.count++>RE){let r;try{r=t.read=new Function("r","return function(){return "+(bi.freezeData?"Object.freeze":"")+"({"+t.map(s=>s==="__proto__"?"__proto_:r()":EF.test(s)?s+":r()":"["+JSON.stringify(s)+"]:r()").join(",")+"})}")(pn)}catch{return RE=1/0,i()}return t.read0=r,t.highByte===0&&(t.read=IE(e,t.read)),r()}let n={};for(let r=0,s=t.length;r<s;r++){let a=t[r];a==="__proto__"&&(a="__proto_"),n[a]=pn()}return bi.freezeData?Object.freeze(n):n}return i.count=0,t.read0=i,t.highByte===0?IE(e,i):i}function _F(){let t=SF(()=>(kt=null,bi.getStructures()));return Qe=bi._mergeStructures(t,Qe)}function Am(t){let e;if(t<16&&(e=_C(t)))return e;if(t>64&&DE)return DE.decode(kt.subarray(mt,mt+=t));let i=mt+t,n=[];for(e="";mt<i;){let r=kt[mt++];if(128&r)if((224&r)==192){let s=(31&r)<<6|63&kt[mt++];s<128?n.push(65533):n.push(s)}else if((240&r)==224){let s=(31&r)<<12|(63&kt[mt++])<<6|63&kt[mt++];s<2048||s>=55296&&s<=57343?n.push(65533):n.push(s)}else if((248&r)==240){let s=(7&r)<<18|(63&kt[mt++])<<12|(63&kt[mt++])<<6|63&kt[mt++];s<65536||s>1114111?n.push(65533):(s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s))}else n.push(65533);else n.push(r);n.length>=4096&&(e+=Fn.apply(String,n),n.length=0)}return n.length>0&&(e+=Fn.apply(String,n)),e}function FR(t){let e=new Array(t);for(let i=0;i<t;i++)e[i]=pn();return bi.freezeData?Object.freeze(e):e}function NR(t){if(bi.mapsAsObjects){let e={};for(let i=0;i<t;i++){let n=xF();n==="__proto__"&&(n="__proto_"),e[n]=pn()}return e}{let e=new Map;for(let i=0;i<t;i++)e.set(pn(),pn());return e}}function bF(t){let e=mt,i=new Array(t);for(let n=0;n<t;n++){let r=kt[mt++];if((128&r)>0)return void(mt=e);i[n]=r}return Fn.apply(String,i)}function _C(t){if(t<4){if(t<2){if(t===0)return"";{let e=kt[mt++];return(128&e)>1?void(mt-=1):Fn(e)}}{let e=kt[mt++],i=kt[mt++];if((128&e)>0||(128&i)>0)return void(mt-=2);if(t<3)return Fn(e,i);let n=kt[mt++];return(128&n)>0?void(mt-=3):Fn(e,i,n)}}{let e=kt[mt++],i=kt[mt++],n=kt[mt++],r=kt[mt++];if((128&e)>0||(128&i)>0||(128&n)>0||(128&r)>0)return void(mt-=4);if(t<6){if(t===4)return Fn(e,i,n,r);{let s=kt[mt++];return(128&s)>0?void(mt-=5):Fn(e,i,n,r,s)}}if(t<8){let s=kt[mt++],a=kt[mt++];if((128&s)>0||(128&a)>0)return void(mt-=6);if(t<7)return Fn(e,i,n,r,s,a);let o=kt[mt++];return(128&o)>0?void(mt-=7):Fn(e,i,n,r,s,a,o)}{let s=kt[mt++],a=kt[mt++],o=kt[mt++],l=kt[mt++];if((128&s)>0||(128&a)>0||(128&o)>0||(128&l)>0)return void(mt-=8);if(t<10){if(t===8)return Fn(e,i,n,r,s,a,o,l);{let c=kt[mt++];return(128&c)>0?void(mt-=9):Fn(e,i,n,r,s,a,o,l,c)}}if(t<12){let c=kt[mt++],h=kt[mt++];if((128&c)>0||(128&h)>0)return void(mt-=10);if(t<11)return Fn(e,i,n,r,s,a,o,l,c,h);let d=kt[mt++];return(128&d)>0?void(mt-=11):Fn(e,i,n,r,s,a,o,l,c,h,d)}{let c=kt[mt++],h=kt[mt++],d=kt[mt++],u=kt[mt++];if((128&c)>0||(128&h)>0||(128&d)>0||(128&u)>0)return void(mt-=12);if(t<14){if(t===12)return Fn(e,i,n,r,s,a,o,l,c,h,d,u);{let p=kt[mt++];return(128&p)>0?void(mt-=13):Fn(e,i,n,r,s,a,o,l,c,h,d,u,p)}}{let p=kt[mt++],f=kt[mt++];if((128&p)>0||(128&f)>0)return void(mt-=14);if(t<15)return Fn(e,i,n,r,s,a,o,l,c,h,d,u,p,f);let g=kt[mt++];return(128&g)>0?void(mt-=15):Fn(e,i,n,r,s,a,o,l,c,h,d,u,p,f,g)}}}}}function kR(){let t,e=kt[mt++];if(e<192)t=e-160;else switch(e){case 217:t=kt[mt++];break;case 218:t=He.getUint16(mt),mt+=2;break;case 219:t=He.getUint32(mt),mt+=4;break;default:throw new Error("Expected string")}return Am(t)}function Xw(t){return bi.copyBuffers?Uint8Array.prototype.slice.call(kt,mt,mt+=t):kt.subarray(mt,mt+=t)}function Xh(t){let e=kt[mt++];if(gr[e]){let i;return gr[e](kt.subarray(mt,i=mt+=t),n=>{mt=n;try{return pn()}finally{mt=i}})}throw new Error("Unknown extension type "+e)}function xF(){let t=kt[mt++];if(!(t>=160&&t<192))return mt--,wF(pn());if(t-=160,ua>=mt)return Xl.slice(mt-fs,(mt+=t)-fs);if(!(ua==0&&Ns<180))return M_(t);let e,i=4095&(t<<5^(t>1?He.getUint16(mt):t>0?kt[mt]:0)),n=OE[i],r=mt,s=mt+t-3,a=0;if(n&&n.bytes==t){for(;r<s;){if(e=He.getUint32(r),e!=n[a++]){r=1879048192;break}r+=4}for(s+=3;r<s;)if(e=kt[r++],e!=n[a++]){r=1879048192;break}if(r===s)return mt=r,n.string;s-=3,r=mt}for(n=[],OE[i]=n,n.bytes=t;r<s;)e=He.getUint32(r),n.push(e),r+=4;for(s+=3;r<s;)e=kt[r++],n.push(e);let o=t<16?_C(t):bF(t);return n.string=o??M_(t)}function wF(t){if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean"||typeof t=="bigint")return t.toString();if(t==null)return t+"";if(bi.allowArraysInMapKeys&&Array.isArray(t)&&t.flat().every(e=>["string","number","boolean","bigint"].includes(typeof e)))return t.flat().toString();throw new Error("Invalid property type for record: "+typeof t)}function SF(t){GR&&GR();let e=Ns,i=mt,n=S_,r=fs,s=ua,a=Xl,o=w_,l=Yo,c=yr,h=new Uint8Array(kt.slice(0,Ns)),d=Qe,u=Qe.slice(0,Qe.length),p=bi,f=Zo,g=t();return Ns=e,mt=i,S_=n,fs=r,ua=s,Xl=a,w_=o,Yo=l,yr=c,kt=h,Zo=f,(Qe=d).splice(0,Qe.length,...u),bi=p,He=new DataView(kt.buffer,kt.byteOffset,kt.byteLength),g}function PE(){kt=null,Yo=null,Qe=null}function pX(t){t.unpack?gr[t.type]=t.unpack:gr[t.type]=t}var DE,kt,Ns,mt,VR,w_,S_,bi,Qe,Xl,fs,ua,yr,Yo,gr,He,$w,MF,Zo,RE,jR,GR,Tm,EF,IE,M_,AF,TF,CF,Fn,OE,LE,Yw,HR,WR,qR,BE,nv,XR,$R,YR,UE,Zw,Tg,fX=F(()=>{try{DE=new TextDecoder}catch{}mt=0,w_=VR=[],S_=0,bi={},fs=0,ua=0,gr=[],$w={useRecords:!1,mapsAsObjects:!0},(MF=new class{}).name="MessagePack 0xC1",Zo=!1,RE=2,Tm=class{constructor(t){t&&(t.useRecords===!1&&t.mapsAsObjects===void 0&&(t.mapsAsObjects=!0),t.sequential&&t.trusted!==!1&&(t.trusted=!0,!t.structures&&t.useRecords!=0&&(t.structures=[],t.maxSharedStructures||(t.maxSharedStructures=0))),t.structures?t.structures.sharedLength=t.structures.length:t.getStructures&&((t.structures=[]).uninitialized=!0,t.structures.sharedLength=0),t.int64AsNumber&&(t.int64AsType="number")),Object.assign(this,t)}unpack(t,e){if(kt)return SF(()=>(PE(),this?this.unpack(t,e):Tm.prototype.unpack.call($w,t,e)));!t.buffer&&t.constructor===ArrayBuffer&&(t=typeof Buffer<"u"?Buffer.from(t):new Uint8Array(t)),typeof e=="object"?(Ns=e.end||t.length,mt=e.start||0):(mt=0,Ns=e>-1?e:t.length),S_=0,ua=0,Xl=null,w_=VR,yr=null,kt=t;try{He=t.dataView||(t.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength))}catch(i){throw kt=null,t instanceof Uint8Array?i:new Error("Source must be a Uint8Array or Buffer but was a "+(t&&typeof t=="object"?t.constructor.name:typeof t))}if(this instanceof Tm){if(bi=this,this.structures)return Qe=this.structures,iv(e);(!Qe||Qe.length>0)&&(Qe=[])}else bi=$w,(!Qe||Qe.length>0)&&(Qe=[]);return iv(e)}unpackMultiple(t,e){let i,n=0;try{Zo=!0;let r=t.length,s=this?this.unpack(t,r):nv.unpack(t,r);if(!e){for(i=[s];mt<r;)n=mt,i.push(iv());return i}if(e(s,n,mt)===!1)return;for(;mt<r;)if(n=mt,e(iv(),n,mt)===!1)return}catch(r){throw r.lastPosition=n,r.values=i,r}finally{Zo=!1,PE()}}_mergeStructures(t,e){t=t||[],Object.isFrozen(t)&&(t=t.map(i=>i.slice(0)));for(let i=0,n=t.length;i<n;i++){let r=t[i];r&&(r.isShared=!0,i>=32&&(r.highByte=i-32>>5))}t.sharedLength=t.length;for(let i in e||[])if(i>=0){let n=t[i],r=e[i];r&&(n&&((t.restoreStructures||(t.restoreStructures=[]))[i]=n),t[i]=r)}return this.structures=t}decode(t,e){return this.unpack(t,e)}},EF=/^[a-zA-Z_$][a-zA-Z\d_$]*$/,IE=(t,e)=>function(){let i=kt[mt++];if(i===0)return e();let n=t<32?-(t+(i<<5)):t+(i<<5),r=Qe[n]||_F()[n];if(!r)throw new Error("Record id is not defined for "+n);return r.read||(r.read=CE(r,t)),r.read()},M_=Am,AF=Am,TF=Am,CF=Am,Fn=String.fromCharCode,OE=new Array(4096),LE=(t,e)=>{let i=pn().map(wF),n=t;e!==void 0&&(t=t<32?-((e<<5)+t):(e<<5)+t,i.highByte=e);let r=Qe[t];return r&&(r.isShared||Zo)&&((Qe.restoreStructures||(Qe.restoreStructures=[]))[t]=r),Qe[t]=i,i.read=CE(i,n),(i.read0||i.read)()},gr[0]=()=>{},gr[0].noBuffer=!0,gr[66]=t=>{let e=t.byteLength%8||8,i=BigInt(128&t[0]?t[0]-256:t[0]);for(let n=1;n<e;n++)i<<=BigInt(8),i+=BigInt(t[n]);if(t.byteLength!==e){let n=new DataView(t.buffer,t.byteOffset,t.byteLength),r=(s,a)=>{let o=a-s;if(o<=40){let d=n.getBigUint64(s);for(let u=s+8;u<a;u+=8)d<<=BigInt(64),d|=n.getBigUint64(u);return d}let l=s+(o>>4<<3),c=r(s,l),h=r(l,a);return c<<BigInt(8*(a-l))|h};i=i<<BigInt(8*(n.byteLength-e))|r(e,n.byteLength)}return i},Yw={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError:typeof AggregateError=="function"?AggregateError:null},gr[101]=()=>{let t=pn();if(!Yw[t[0]]){let e=Error(t[1],{cause:t[2]});return e.name=t[0],e}return Yw[t[0]](t[1],{cause:t[2]})},gr[105]=t=>{if(bi.structuredClone===!1)throw new Error("Structured clone extension is disabled");let e=He.getUint32(mt-4);Yo||(Yo=new Map);let i,n=kt[mt];i=n>=144&&n<160||n==220||n==221?[]:n>=128&&n<144||n==222||n==223?new Map:(n>=199&&n<=201||n>=212&&n<=216)&&kt[mt+1]===115?new Set:{};let r={target:i};Yo.set(e,r);let s=pn();if(!r.used)return r.target=s;if(Object.assign(i,s),i instanceof Map)for(let[a,o]of s.entries())i.set(a,o);if(i instanceof Set)for(let a of Array.from(s))i.add(a);return i},gr[112]=t=>{if(bi.structuredClone===!1)throw new Error("Structured clone extension is disabled");let e=He.getUint32(mt-4),i=Yo.get(e);return i.used=!0,i.target},gr[115]=()=>new Set(pn()),HR=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(t=>t+"Array"),WR=typeof globalThis=="object"?globalThis:window,gr[116]=t=>{let e=t[0],i=Uint8Array.prototype.slice.call(t,1).buffer,n=HR[e];if(!n){if(e===16)return i;if(e===17)return new DataView(i);throw new Error("Could not find typed array for code "+e)}return new WR[n](i)},gr[120]=()=>{let t=pn();return new RegExp(t[0],t[1])},qR=[],gr[98]=t=>{let e=(t[0]<<24)+(t[1]<<16)+(t[2]<<8)+t[3],i=mt;return mt+=e-t.length,yr=qR,(yr=[kR(),kR()]).position0=0,yr.position1=0,yr.postBundlePosition=mt,mt=i,pn()},gr[255]=t=>t.length==4?new Date(1e3*(16777216*t[0]+(t[1]<<16)+(t[2]<<8)+t[3])):t.length==8?new Date(((t[0]<<22)+(t[1]<<14)+(t[2]<<6)+(t[3]>>2))/1e6+1e3*(4294967296*(3&t[3])+16777216*t[4]+(t[5]<<16)+(t[6]<<8)+t[7])):t.length==12?new Date(((t[0]<<24)+(t[1]<<16)+(t[2]<<8)+t[3])/1e6+1e3*((128&t[4]?-281474976710656:0)+1099511627776*t[6]+4294967296*t[7]+16777216*t[8]+(t[9]<<16)+(t[10]<<8)+t[11])):new Date("invalid"),BE=new Array(147);for(let t=0;t<256;t++)BE[t]=+("1e"+Math.floor(45.15-.30103*t));(nv=new Tm({useRecords:!1})).unpack,nv.unpackMultiple,nv.unpack,XR=new Float32Array(1),new Uint8Array(XR.buffer,0,4)}),mX=F(()=>{fX(),pC(),yC(),$c(),zb(),Xc(),$R=[{Class:te.prototype.constructor,type:1,write:t=>({...t}),read:t=>(Object.setPrototypeOf(t,te.prototype),t)},{Class:Vt.prototype.constructor,type:2,write:t=>[...t],read:t=>(Object.setPrototypeOf(t,Vt.prototype),t)},{Class:Wn.prototype.constructor,type:3,write:t=>[...t],read:t=>(Object.setPrototypeOf(t,Wn.prototype),t)},{Class:__.prototype.constructor,type:4,write:t=>t.id,read:t=>new __(t)},{Class:EE.prototype.constructor,type:5,write:t=>t.data,read:t=>new EE(t)},{Class:fn.prototype.constructor,type:6,write:t=>({...t}),read:t=>(Object.setPrototypeOf(t,fn.prototype),t)}];for(let t of $R)pX(t);YR=new Tm({structuredClone:!0}),(UE||(UE={})).deserialize=function(t){return YR.unpack(t)}}),gX=F(()=>{mX(),Zw=t=>()=>{throw new Error(t+" is not available in the runtime build (decode-only CollabSerialize)")},Tg={deserialize:UE.deserialize,serialize:Zw("CollabSerialize.serialize"),checksum:Zw("CollabSerialize.checksum")}}),Ye=F(()=>{kb(),lX(),fC(),Xc(),zb(),mC(),$c(),cX(),dX(),yF(),uX(),pC(),gX(),pF(),yC()});function zE(t){return t==="MouseDown"||t==="MouseUp"||t==="KeyDown"||t==="KeyUp"||t==="Collision"||t==="Trigger"}var ZR,FE,Iu,rv,Kw,KR,QR,JR,NE,kE,tI,eI,iI,nI,rI,VE,jE,sI,aI,oI,lI,PF=F(()=>{var t,e,i;Ye(),et(),(t=ZR||(ZR={})).toEventUIType=function(n){return n.type==="Conditional"?n.condition.type==="Distance"?"Distance":"StateChange":n.type},t.fromEventUIType=function(n){return n==="Distance"||n==="StateChange"?"Conditional":n},FE={LookAt:[],Follow:["Create"],DragDrop:["Transition","Animation","Audio","Particles","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MouseHover:["Transition","Animation","TimelineAnimation","Particles","Create","Destroy","SwitchCamera","SceneTransition","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Scroll:["Transition","Animation","TimelineAnimation","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Start:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Conditional:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MouseDown:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MouseUp:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MousePress:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],KeyDown:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],KeyUp:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],KeyPress:["Transition","Animation","Audio","Particles","Video","Link","Create","SwitchCamera","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],GameControl:["Transition","Animation","TimelineAnimation","Audio","Particles","Create","Conditional"],Collision:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Create","Destroy","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Trigger:["Transition","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Resize:["Transition","Animation","Audio","Particles","Video","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],VariableChange:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],API:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],WEBHOOK:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],AIAssistantListener:["SetVariable"],AIAssistantTrigger:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"]},(n=>{n.is=function(r){return r.type==="MouseDown"||r.type==="MouseUp"||r.type==="MousePress"||r.type==="KeyDown"||r.type==="KeyUp"||r.type==="KeyPress"},n.defaultData=function(r){return r==="MouseDown"||r==="MouseUp"||r==="MousePress"?{type:r,mode:"Object",disabled:!1,name:"",actions:new Vt}:{type:r,disabled:!1,name:"",key:void 0,actions:new Vt}}})(Iu||(Iu={})),(n=>{n.propertyDefaultData=function(r){return{type:"Property",value:[r??null,"position","x"]}},n.valueDefaultData={type:"Literal",value:0}})(rv||(rv={})),(e=Kw||(Kw={})).comparisonDefaultData=function(n){return{type:"Comparison",operator:"==",lOperand:rv.propertyDefaultData(n),rOperand:{...rv.valueDefaultData}}},e.distanceDefaultData=function(n){return{type:"Distance",toObject:n??null,fromObject:n??null,distance:200}},e.stateDefaultData=function(n,r){return{type:"State",object:n??null,state:r??null}},(KR||(KR={})).isConditionalSubActions=function(n){return n.find(r=>r==="ifActions"||r==="elseActions")!==void 0},(n=>{n.is=function(r){return r.type==="Conditional"},n.defaultData=function(r){return{type:"Conditional",disabled:!1,name:"",inActions:new Vt,outActions:new Vt,condition:Kw.distanceDefaultData(r)}}})(QR||(QR={})),(JR||(JR={})).defaultData={type:"DragDrop",name:"",cursor:"hand",disabled:!1,dampingFactor:1,objects:[],snapTo:"center",snapSurfaceMode:"bbox",snapSurfaceOffset:0,dropOn:"all",autoOrient:!0,dropDestinations:[],plane:"adaptive",planeMode:"locked",referenceFrame:"global",limits:[-1/0,1/0,-1/0,1/0,-1/0,1/0],drop:!1,resetOnSnapFail:!1,snapSpeed:20,resetSpeed:20,dragDropActions:{drag:new Vt,drop:new Vt}},(NE||(NE={})).defaultData={type:"Follow",disabled:!1,name:"",maxDelta:0,dampingFactor:1,target:"cursor",plane:"custom",resetOnPointerLeave:!0,resetAfterDistanceLimit:!0,enabledTranslation:[!0,!0,!0],limitDistanceEnabled:!1,limitDistance:1e3,snapDelay:0,resetSpeed:5,actions:new Vt},(kE||(kE={})).defaultData={type:"LookAt",disabled:!1,name:"",distance:1e3,dampingFactor:1,target:"cursor",tilt:"up",axis:"z",plane:"custom",resetOnPointerLeave:!0,resetAfterDistanceLimit:!0,enabledRotation:[!0,!0,!0],limitDistanceEnabled:!1,limitDistance:1e3,snapDelay:0,resetSpeed:5},(n=>{n.is=function(r){return r.type==="MouseHover"},n.defaultData=function(){return{type:"MouseHover",disabled:!1,name:"",actions:new Vt}}})(tI||(tI={})),(n=>{n.is=function(r){return r.type==="Scroll"},n.defaultData=function(){return{type:"Scroll",disabled:!1,name:"",steps:100,trigger:"load",startFrom:"enter",enterAnchor:"top",startOffset:0,endAfter:400,actions:new Vt}}})(eI||(eI={})),(n=>{n.is=function(r){return r.type==="Start"},n.defaultData=function(){return{type:"Start",disabled:!1,name:"",actions:new Vt}}})(iI||(iI={})),(n=>{n.is=function(r){return r.type==="Collision"},n.defaultData=function(){return{type:"Collision",disabled:!1,name:"",target:"character",actions:new Vt}}})(nI||(nI={})),(n=>{n.is=function(r){return r.type==="Trigger"},n.defaultData=function(r,s){return{type:"Trigger",name:"",disabled:!1,target:"all",triggeringObjects:[],actions:new Vt,triggerZone:"box",position:s.toArray(),rotation:[0,0,0],size:r.toArray(),radius:r.length()/2,helperVisible:!0}}})(rI||(rI={})),(i=VE||(VE={})).defaultSizes={mobile:[480,480],tablet:[768,768],desktop:[1200,1200],custom:[769,1200]},i.is=function(n){return n.type==="Resize"},i.sizeToDevice=function(n){return typeof n=="string"?n:"custom"},i.deviceToSize=function(n){return typeof n=="string"?[...i.defaultSizes[n]]:[...n]},i.defaultData=function(){let n={size:"mobile",operator:"<",actions:new Vt},r={size:"tablet",operator:"<",actions:new Vt},s={size:[...i.defaultSizes.custom],operator:"<>",actions:new Vt},a=new Vt;return a.push({id:Ot.generateUUID(),fi:0,data:n},{id:Ot.generateUUID(),fi:1,data:r},{id:Ot.generateUUID(),fi:2,data:s}),{type:"Resize",disabled:!1,name:"",orientation:"horizontal",breakpoints:a}},i.defaultBreakpointData=function(){return{size:[...i.defaultSizes.custom],operator:"<>",actions:new Vt}},(n=>{n.propertyPaths={Position:["position"],"Position X":["position","x"],"Position Y":["position","y"],"Position Z":["position","z"],Rotation:["rotation"],"Rotation X":["rotation","x"],"Rotation Y":["rotation","y"],"Rotation Z":["rotation","z"],Scale:["scale"],"Scale X":["scale","x"],"Scale Y":["scale","y"],"Scale Z":["scale","z"],Width:["width"],Height:["height"],Depth:["depth"],"Mouse Position X":["mouse","x"],"Mouse Position Y":["mouse","y"],"Mouse Pressed":["mouse","pressed"],"Screen Width":["mouse","width"],"Screen Height":["mouse","height"],"Hit Position X":["raycast","x"],"Hit Position Y":["raycast","y"],"Hit Position Z":["raycast","z"],"Hit Object Position X":["raycast","objX"],"Hit Object Position Y":["raycast","objY"],"Hit Object Position Z":["raycast","objZ"]},n.is=function(r){return r.type==="VariableChange"},n.defaultData=function(){return{disabled:!1,type:"VariableChange",name:"",actions:new Vt,variableId:"",objectId:null,property:"Position X"}}})(jE||(jE={})),(n=>{n.is=function(r){return r.type==="API"},n.defaultData=function(){return{disabled:!1,type:"API",name:"",successActions:new Vt,errorActions:new Vt,userAPIId:""}}})(sI||(sI={})),(n=>{n.is=function(r){return r.type==="WEBHOOK"},n.defaultData=function(){return{disabled:!1,type:"WEBHOOK",name:"",actions:new Vt,userWebhookId:""}}})(aI||(aI={})),(n=>{n.is=function(r){return r.type==="AIAssistantListener"},n.defaultData=function(){return{disabled:!1,type:"AIAssistantListener",name:"",actions:new Vt,analysis:"average",analysisRange:[0,71],analysisSingle:0}}})(oI||(oI={})),(n=>{n.is=function(r){return r.type==="AIAssistantTrigger"},n.defaultData=function(){return{disabled:!1,description:"",name:"",type:"AIAssistantTrigger",actions:new Vt}}})(lI||(lI={}))});function hI(t){let e=typeof t;return t!==null&&(e==="object"||e==="function")}function cI(t){return typeof t=="string"&&t.length===36&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t)}var Yc,Wu,DF,Rr,dI,Ja,ah,Cg,uI,qu,An,Je,GE,pI,$l,dp,fI,mI,gI,vI,yI,_I,bI,xI,Qw,wI,SI,Jw,MI,EI,AI,tS,TI,eS,CI,PI,DI,RI,II,OI,LI,BI,UI,Vc,Ko,Yl,HE,WE,E_,A_,T_,C_,P_,qE,XE,D_,$E,Xu,zI,iS,nS,YE,FI,R_,NI,kI,I_,VI,jI,GI,HI,WI,qI,XI,$I,YI,Vb,bC,Ki,ki,wu,RF,Pg,O_,yc,ZE,xC,L_,B_,KE,Ho,l1,tr,rS,kl,U_,eg,sS,aS,oS,$u,lS,QE,JE,ZI,Rd,IF,Mn,z_,KI,QI,JI,tO,Ha,ig,F_,N_,Qo,Ic,eO,Zl,k_,Jo,hS,cS,bc,jc,xc,ng,tA,iO,_r,dS,nO,rO,Wo,Fs,Yu,eA,_s=F(()=>{var t,e,i,n,r,s,a,o;Yc="personal camera",Wu="a218fcc3-276b-49b9-b485-49037fd14f5f",DF=2500134,Rr=5526619,(t=dI||{}).x="x",t.y="y",t.z="z",dI=t,(l=>{function c(u,p){return Math.pow(p[0]-u[0],2)+Math.pow(p[1]-u[1],2)}function h(u,p){return Math.sqrt(c(u,p))}function d(u,p,f){let g=l.sub(p,u),m=l.sub(f,u),y=l.dot(g,m)/l.dot(g,g),v=l.scalarMultiply(g,y);return l.add(u,v)}l.isEqual=function(u,p){return u[0]===p[0]&&u[1]===p[1]},l.lerp=function(u,p,f){return[u[0]+(p[0]-u[0])*f,u[1]+(p[1]-u[1])*f]},l.add=function(u,p){return[u[0]+p[0],u[1]+p[1]]},l.sub=function(u,p){return[u[0]-p[0],u[1]-p[1]]},l.multiply=function(u,p){return[u[0]*p[0],u[1]*p[1]]},l.divide=function(u,p){return[u[0]/p[0],u[1]/p[1]]},l.distanceSquared=c,l.distance=h,l.dot=function(u,p){return u[0]*p[0]+u[1]*p[1]},l.scalarMultiply=function(u,p){return[u[0]*p,u[1]*p]},l.projectionOnto=d,l.projectionOntoDistance=function(u,p,f){return h(u,d(u,p,f))},l.center=function(u,p){return[.5*(u[0]+p[0]),.5*(u[1]+p[1])]}})(Ja||(Ja={})),(e=ah||(ah={})).isEqual=function(l,c){return l[0]===c[0]&&l[1]===c[1]&&l[2]===c[2]},e.add=function(l,c){return[l[0]+c[0],l[1]+c[1],l[2]+c[2]]},e.sub=function(l,c){return[l[0]-c[0],l[1]-c[1],l[2]-c[2]]},e.div=function(l,c){return[l[0]/c[0],l[1]/c[1],l[2]/c[2]]},e.mul=function(l,c){return[l[0]*c[0],l[1]*c[1],l[2]*c[2]]},e.dist=function(l,c){return Math.hypot(l[0]-c[0],l[1]-c[1],l[2]-c[2])},e.lerp=function(l,c,h){return[l[0]+(c[0]-l[0])*h,l[1]+(c[1]-l[1])*h,l[2]+(c[2]-l[2])*h]},(i=Cg||(Cg={})).isEqual=function(l,c){return l[0]===c[0]&&l[1]===c[1]&&l[2]===c[2]&&l[3]===c[3]},i.lerp=function(l,c,h){return[l[0]+(c[0]-l[0])*h,l[1]+(c[1]-l[1])*h,l[2]+(c[2]-l[2])*h,l[3]+(c[3]-l[3])*h]},(l=>{let c=180/Math.PI,h=Math.PI/180;function d(p){return typeof p=="number"?p*c:p}function u(p){return typeof p=="number"?p*h:p}l.radToDeg=function(p){return[d(p[0]),d(p[1]),d(p[2])]},l.degToRad=function(p){return[u(p[0]),u(p[1]),u(p[2])]}})(uI||(uI={})),(n=qu||(qu={})).identity=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],n.isEqual=function(l,c){for(let h=0;h<16;h++)if(l[h]!==c[h])return!1;return!0},n.simplify=function(l){return l??n.identity},n.applyMatrix4=function(l,c){let h=c.slice(0);for(let d=0,u=c.length;d<u;d+=3){let p=l[3]*c[d]+l[7]*c[d+1]+l[11]*c[d+2]+l[15];h[d]=(l[0]*c[d]+l[4]*c[d+1]+l[8]*c[d+2]+l[12])/p,h[d+1]=(l[1]*c[d]+l[5]*c[d+1]+l[9]*c[d+2]+l[13])/p,h[d+2]=(l[2]*c[d]+l[6]*c[d+1]+l[10]*c[d+2]+l[14])/p}return h},(r=An||(An={})).isRGB=function(l){return typeof l=="object"&&typeof l.r=="number"&&typeof l.g=="number"&&typeof l.b=="number"},r.white={r:1,g:1,b:1},r.red={r:1,g:0,b:0},r.black={r:0,g:0,b:0},r.toRgb255a1=function(l){return{r:Math.round(255*l.r),g:Math.round(255*l.g),b:Math.round(255*l.b),a:1}},r.clone=function(l){return{r:l.r,g:l.g,b:l.b}},r.fromHex=function(l){return{r:((l=Math.floor(l))>>16&255)/255,g:(l>>8&255)/255,b:(255&l)/255}},r.toHex=function(l){return 65536*Math.round(255*l.r)+256*Math.round(255*l.g)+Math.round(255*l.b)},r.equals=function(l,c){return l.r===c.r&&l.g===c.g&&l.b===c.b},r.equalsFixed=function(l,c){return l.r.toFixed(2)===c.r.toFixed(2)&&l.g.toFixed(2)===c.g.toFixed(2)&&l.b.toFixed(2)===c.b.toFixed(2)},r.lerp=function(l,c,h){return{r:l.r+(c.r-l.r)*h,g:l.g+(c.g-l.g)*h,b:l.b+(c.b-l.b)*h}},r.is=function(l){return!!hI(l)&&"r"in l&&"g"in l&&"b"in l&&!("a"in l)},(s=Je||(Je={})).white={...An.white,a:1},s.is=function(l){return!!hI(l)&&"r"in l&&"g"in l&&"b"in l&&"a"in l},s.transparent={...An.white,a:0},s.from0to1=function(l){return{r:l[0],g:l[1],b:l[2],a:l[3]}},s.fromHexAndA=function(l,c){return{...An.fromHex(l),a:c}},s.toRgb255a1=function(l){return{r:Math.round(255*l.r),g:Math.round(255*l.g),b:Math.round(255*l.b),a:l.a}},s.equals=function(l,c){return An.equals(l,c)&&l.a===c.a},s.equalsFixed=function(l,c){return An.equalsFixed(l,c)&&l.a.toFixed(2)===c.a.toFixed(2)},s.lerp=function(l,c,h){return{r:l.r+(c.r-l.r)*h,g:l.g+(c.g-l.g)*h,b:l.b+(c.b-l.b)*h,a:l.a+(c.a-l.a)*h}},s.toStyle=function({r:l,g:c,b:h,a:d}=s.white){return`rgba(${255*l}, ${255*c}, ${255*h}, ${d})`},(GE||(GE={})).identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1],pivot:[0,0,0],pivotRotation:[0,0,0]},(a=pI||{})[a.LINEAR=0]="LINEAR",a[a.EASE=1]="EASE",a[a.EASE_IN=2]="EASE_IN",a[a.EASE_OUT=3]="EASE_OUT",a[a.EASE_IN_OUT=4]="EASE_IN_OUT",a[a.CUBIC=5]="CUBIC",a[a.SPRING=6]="SPRING",a[a.ARC=7]="ARC",a[a.NONE=8]="NONE",pI=a,($l||($l={})).defaultData={mass:1,stiffness:80,damping:10,velocity:0},(dp||(dp={})).defaultData={control1:[.5,0],control2:[.5,1]},(o=fI||(fI={})).linear=[0,0,1,1],o.ease=[.25,.1,.25,1],o.easeIn=[.42,0,1,1],o.easeOut=[0,0,.58,1],o.easeInOut=[.42,0,.58,1]}),vX=F(()=>{var t,e;Ye(),PF(),(mI||(mI={})).defaultData={type:"SwitchCamera",name:"",targetCamera:"",delay:0,animate:!0,duration:1e3,easing:4,runMode:"Normal"},(gI||(gI={})).defaultData={type:"SceneTransition",name:"",target:"",delay:0,duration:1,transition:"none"},(vI||(vI={})).defaultData={type:"Link",name:"",url:null,context:"tab"},(yI||(yI={})).defaultData={type:"Destroy",name:"",objects:[],delay:0},(_I||(_I={})).defaultData={type:"Particles",name:"",emitterObjectId:"",delay:0,emission:"start",triggerAfter:"any"},(bI||(bI={})).defaultData={type:"Create",name:"",object:"",delay:0,creationSpeed:10,coordinateSystem:"world",dynamic:!0,destroy:"No",destroyAfterQuantity:5,lifetime:2,position:[0,0,0],rotation:[0,0,0],velocity:[1e3,0,0],hideBase:"No"},(xI||(xI={})).defaultData={type:"Reset",name:"",delay:0},(Qw||(Qw={})).defaultData={interaction:"play",delay:0,volume:.5,loop:1},(t=wI||(wI={})).pauseDefaultData={interaction:"pause",delay:0},t.stopDefaultData={interaction:"stop",delay:0},(e=SI||(SI={})).defaultData={type:"Audio",name:"",...Qw.defaultData},e.hasAudioByActions=i=>i.some(({data:n})=>n.type==="Audio"&&n.interaction==="play"&&n.audio),e.hasAudioByEvents=i=>{for(let{data:n}of i)if(Iu.is(n)||n.type==="Start"||n.type==="Collision"){if(e.hasAudioByActions(n.actions))return!0}else if(n.type==="Conditional"){if(e.hasAudioByActions(n.inActions)||e.hasAudioByActions(n.outActions))return!0}else if(n.type==="GameControl"&&Object.values(n.gameActions).find(r=>e.hasAudioByActions(r)))return!0},e.getAudiosByActions=i=>{let n=[];return i.forEach(r=>{let s=r.data;s.type==="Audio"&&s.interaction==="play"&&s.audio&&n.push(r),s.type==="Conditional"&&(n.push(...e.getAudiosByActions(s.ifActions)),n.push(...e.getAudiosByActions(s.elseActions)))}),n},e.getAudiosByEvents=i=>{let n=[];return i.forEach(({data:r})=>{Iu.is(r)||r.type==="Collision"||r.type==="Start"||r.type==="Trigger"?n.push(...e.getAudiosByActions(r.actions)):r.type==="Conditional"?(n.push(...e.getAudiosByActions(r.inActions)),n.push(...e.getAudiosByActions(r.outActions))):r.type==="GameControl"?Object.values(r.gameActions).forEach(s=>{n.push(...e.getAudiosByActions(s))}):r.type==="DragDrop"&&(n.push(...e.getAudiosByActions(r.dragDropActions.drag)),n.push(...e.getAudiosByActions(r.dragDropActions.drop)))}),n},(Jw||(Jw={})).defaultData={interaction:"play",delay:0,volume:.5,loop:1/0},(i=>{i.pauseDefaultData={interaction:"pause",delay:0},i.stopDefaultData={interaction:"stop",delay:0}})(MI||(MI={})),(i=>{i.defaultData={type:"Video",name:"",triggerAfter:"autoplay",...Jw.defaultData},i.hasVideoByActions=n=>n.some(({data:r})=>r.type==="Video"&&r.interaction==="play"&&r.layerId),i.hasVideoByObject=n=>{if(n.events){for(let{data:r}of n.events)if((Iu.is(r)||r.type==="Start")&&i.hasVideoByActions(r.actions))return!0}},i.getVideosByActions=n=>{let r=[];return n.forEach(s=>{let a=s.data;a.type==="Video"&&a.interaction==="play"&&a.layerId&&r.push(s)}),r},i.getVideosByEvents=n=>{let r=[];return n.forEach(({data:s})=>{(Iu.is(s)||s.type==="Start")&&r.push(...i.getVideosByActions(s.actions))}),r}})(EI||(EI={})),(AI||(AI={})).defaultData=function(i){return{state:i,repeat:0,delay:0,delayDirection:"start-once",direction:"normal",duration:1e3,easing:4}},(tS||(tS={})).defaultData=function(){return{tweens:new Vt,repeat:0,delay:0,delayDirection:"start-once",direction:"normal"}},(TI||(TI={})).defaultData=function(i){return{type:"Transition",name:"",runMode:"Once",object:i??null,...tS.defaultData()}},(eS||(eS={})).defaultData=function(i){return{interaction:"play",timeline:i,repeat:0,delay:0,delayDirection:"start-once",direction:"normal",runMode:"Once"}},(i=>{i.pauseDefaultData={interaction:"pause",delay:0},i.stopDefaultData={interaction:"stop",delay:0}})(CI||(CI={})),(PI||(PI={})).defaultData=function(i){return{type:"TimelineAnimation",name:"",...eS.defaultData(i)}},(DI||(DI={})).defaultData=function(i,n,r){return{type:"Animation",name:"",object:i,clipId:n,crop:r,crop2:r,repeat:-1,delay:0,delayDirection:"start-once",direction:"normal",runMode:"Normal"}},(RI||(RI={})).defaultData={type:"SetVariable",name:"",variableId:"",expression:[]},(II||(II={})).defaultData=()=>({type:"Conditional",name:"",ifActions:new Vt,elseActions:new Vt,condition:[]}),(OI||(OI={})).defaultData={type:"DynamicVariablePlay",name:"",variableId:"",mode:"PlayPause",delay:0,pauseDelay:0},(LI||(LI={})).defaultData={type:"ClearLocalStorage",name:"",target:"all"},(BI||(BI={})).defaultData={name:"",type:"UserAPI"}}),yX=F(()=>{var t;(t=UI||(UI={})).emptyAudio={data:Uint8Array.from(atob("UklGRjIAAABXQVZFZm10IBIAAAABAAEAQB8AAEAfAAABAAgAAABmYWN0BAAAAAAAAABkYXRhAAAAAA=="),e=>e.charCodeAt(0)),mimeType:"audio/wav",filename:"unknown"},t.maxSize=2e6}),OF=F(()=>{var t;(t=Vc||(Vc={})).all=["PerspectiveCamera","OrthographicCamera"],t.is=function(e){return t.all.includes(e)},(e=>{e.DefaultUp=[0,1,0],e.DefaultTargetOffset=1e3,e.MinTargetOffset=.001,e.sanitizeTargetOffset=function(s){return s===void 0||!Number.isFinite(s)||s<e.MinTargetOffset?e.DefaultTargetOffset:s},e.DefaultAzimuth=-24,e.DefaultElevation=15;let i=e.DefaultAzimuth*Math.PI/180,n=e.DefaultElevation*Math.PI/180,r=180/Math.PI;e.DefaultPosition=[e.DefaultTargetOffset*Math.sin(i)*Math.cos(n),e.DefaultTargetOffset*Math.sin(n),e.DefaultTargetOffset*Math.cos(i)*Math.cos(n)],e.DefaultRotation=[Math.atan2(-Math.sin(n),Math.cos(i)*Math.cos(n))*r,Math.asin(Math.sin(i)*Math.cos(n))*r,Math.atan2(Math.sin(i)*Math.sin(n),Math.cos(i))*r],e.defaultData={far:1e5,type:"PerspectiveCamera",perspective:{near:70,fov:45,zoom:1},orthographic:{near:-1e5,zoom:1},up:e.DefaultUp,isUpVectorFlipped:!1,targetOffset:e.DefaultTargetOffset},e.getZoom=function(s){return s.type==="PerspectiveCamera"?s.perspective?.zoom??1:s.orthographic?.zoom??1}})(Ko||(Ko={}))}),LF=F(()=>{var t;(t=Yl||(Yl={})).defaultData=function(e,i=.1){return{disabled:!1,type:"linear",hideBase:!1,instanced:!1,count:3,radial:{radius:2*Math.max(typeof e[0]=="number"?e[0]:1,typeof e[1]=="number"?e[1]:1),start:0,end:360,alignment:!1,axis:"y",scale:[1,1,1],rotation:[0,0,0],position:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},toObject:{object:"",spreadType:"random",scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],axis:"x",seed:0,count:99,align:"normal",pivot:[0,0,0],pivotRotation:[0,0,0]},linear:{scale:[1,1,1],rotation:[0,0,0],position:[(typeof e[0]=="number"?e[0]+e[0]:1)*i,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},grid:{count:[2,2,2],size:e.map(n=>(typeof n=="number"?n:1)*(1+i)),useCenter:!0},randomness:!1,randomnessObject:{strength:100,scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],movement:1,seed:0,freqScale:10,noiseType:"perlin"}}},t.merge=function(e,i){let n={...e};if(WE.forEach(r=>{Object.assign(n,{[r]:i[r]??e[r]})}),n.radial={...e.radial},i.radial){let r=e.radial,s=i.radial;E_.forEach(a=>{Object.assign(n.radial,{[a]:s[a]??r[a]})})}if(n.linear={...e.linear},i.linear){let r=e.linear,s=i.linear;A_.forEach(a=>{Object.assign(n.linear,{[a]:s[a]??r[a]})})}if(n.grid={...e.grid},i.grid){let r=e.grid,s=i.grid;T_.forEach(a=>{Object.assign(n.grid,{[a]:s[a]??r[a]})})}if(n.toObject={...e.toObject},i.toObject){let r=e.toObject,s=i.toObject;C_.forEach(a=>{Object.assign(n.toObject,{[a]:s[a]??r[a]})})}if(n.randomnessObject={...e.randomnessObject},i.randomnessObject){let r=e.randomnessObject,s=i.randomnessObject;P_.forEach(a=>{Object.assign(n.randomnessObject,{[a]:s[a]??r[a]})})}return n},t.isPartial=function(e){return!(!e.randomnessObject&&!e.toObject)},(e=>{e.defaultData={radial:{},linear:{},grid:{},toObject:{},randomnessObject:{}};let i=["radial","linear","grid","toObject","randomnessObject"];e.toOps=function(n,r){let s=[];n.count!==void 0&&s.push({type:0,path:r,props:{count:n.count}});for(let a of i){let o=n[a];o&&Object.keys(o).length>0&&s.push({type:0,path:[...r,a],props:o})}return s}})(HE||(HE={})),WE=["count"],E_=["radius","start","end","position","scale","rotation"],A_=["position","scale","rotation"],T_=["count","size"],C_=["count","position","scale","rotation"],P_=["strength","scale","rotation","position","movement","seed","freqScale"]}),BF=F(()=>{var t;_s(),(t=qE||(qE={})).all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"],t.is=function(e){return t.all.includes(e)},(XE||(XE={})).defaultData=function(e){return function(i){if(i==="PointLight")return{type:i,color:Je.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,penumbraSize:.5,depth:1e5};if(i==="SpotLight")return{type:i,color:Je.white,intensity:1,distance:2e3,decay:1,shadows:!0,penumbra:0,angle:30/180*Math.PI,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};if(i==="DirectionalLight")return{type:i,color:Je.white,intensity:1,shadows:!0,size:2e3,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};throw new Error("not implemented")}(e)}}),UF=F(()=>{var t;(t=D_||(D_={})).defaultShapeData={type:"PlaneEmitterShape",size:[100,100,100]},t.defaultCollisionData={colliderEntityId:null,collisionBounce:.75},t.defaultData={renderMaterial:{type:"particleMaterial",color:{r:1,g:.2,b:.545,a:1},color2:{r:.945,g:.714,b:.184,a:1},coloring:"gradient",ease:"linearFadeOut",easeSize:"linearFadeOut",transparent:!0,size:[40,40],texture:"pt_default_particle",spriteRotation:[0,0]},birthRatePerSec:50,gravity:1,noiseStrength:0,noiseScale:0,noiseSeed:1,noiseType:"curl",randomRotation:0,randomScale:.2,randomMass:.5,rootObjectType:"instancedMesh",life:1,direction:[0,0,0],directionMode:"axis",speed:10,shape:t.defaultShapeData,autoPlay:!0,emitTimeDelay:0,emitTimeCycle:"infinity",emitTimeDuration:1,...t.defaultCollisionData}}),zF=F(()=>{var t;(t=$E||($E={})).defaultData={gravity:10,damping:.03,localStiffness:.67,globalStiffness:.5,globalRange:.15,stiffnessFalloff:.1,windStrength:0,vspCoefficient:.01,elasticity:.15,hairLength:.75,tipSeparation:.8,kink:0,kinkFrequency:0,clumpStrength:0,clumpSize:32,clumpTipScale:1.5,spreadRadius:.03,guideStrands:8192,headShape:"sphere",baseObjectId:null,hairColorSource:"custom",hairShadeRoot:.6,hairShadeTip:1.15,hairRootColor:{r:.29,g:.102,b:.039,a:1},hairMidColor:{r:.8,g:.267,b:.133,a:1},hairTipColor:{r:.545,g:.18,b:.18,a:1},headColor:{r:.325,g:.137,b:.114,a:1},noiseEnabled:!1,noiseColorA:{r:.545,g:.184,b:.788,a:1},noiseColorB:{r:.914,g:.188,b:.914,a:1},noiseColorC:{r:.2,g:.4,b:1,a:1},noiseColorD:{r:.2,g:1,b:.6,a:1},noiseScale:1.8,noiseMixHair:.75,noiseMixHead:.8,castShadow:!0,receiveShadow:!0,hairWidth:1.75,specularPower:40,specularIntensity:.4,diffuseIntensity:.6,ambientIntensity:.25,opacity:1,tipFade:.4,autoPlay:!0},t.regenProps=["hairLength","spreadRadius","guideStrands","headShape","baseObjectId"]}),wC=F(()=>{(Xu||(Xu={})).defaultData={enabled:"visibility",fusedBody:!0,rigidBody:"positioned",density:1,pointMass:0,gravityScale:1,friction:.5,damping:0,restitution:.2,colliderType:"convex",enabledRotation:[!0,!0,!0],enabledTranslation:[!0,!0,!0]}}),FF=F(()=>{var t,e;(t=zI||{})[t.Front=0]="Front",t[t.Back=1]="Back",t[t.Double=2]="Double",zI=t,(e=iS||(iS={})).defaultData={castShadow:!0,receiveShadow:!0},e.equals=function(i,n){return i.castShadow===n.castShadow&&i.receiveShadow===n.receiveShadow},(i=>{i.defaultData={flatShading:!1,wireframe:!1,side:0},i.equals=function(n,r){return n.flatShading===r.flatShading&&n.side===r.side&&n.wireframe===r.wireframe&&(n.shadowCatcher??!1)===(r.shadowCatcher??!1)}})(nS||(nS={})),(YE||(YE={})).defaultData={...nS.defaultData,...iS.defaultData},(FI||(FI={})).getMaterialData=function(i,n){let r=[];if("material"in i){let s=typeof i.material=="string"?n.materials[i.material]??n.lib.materials[i.material]?.asset:i.material;s&&r.push(s)}else if("materials"in i)for(let s of i.materials){let a=typeof s=="string"?n.materials[s]??n.lib.materials[s]?.asset:s;a&&r.push(a)}return r}}),NF=F(()=>{var t;(t=R_||(R_={})).defaultVideo={data:"",thumb:"/_assets/_videos/catThumb.png",type:"video",name:"Cat video"},t.maxSize=3e7}),Gg=F(()=>{var t,e,i,n;Ye(),_s(),NF(),_s(),(NI||(NI={})).is=function(r){return r==="texture"||r==="video"||r==="color"||r==="depth"||r==="normal"||r==="gradient"||r==="noise"||r==="fresnel"||r==="cavity"||r==="dust"||r==="rainbow"||r==="toon"||r==="outline"||r==="particle"||r==="transmission"||r==="reflection"||r==="matcap"||r==="displace"||r==="pattern"||r==="vertexColor"||r==="light"},(kI||(kI={})).is=function(r){return r==="luminance"||r==="r"||r==="g"||r==="b"||r==="a"},(I_||(I_={})).is=function(r){return typeof r=="object"&&r!==null&&r.image!=null},(VI||(VI={})).is=function(r){return r==="phong"||r==="toon"||r==="lambert"||r==="physical"},(n=jI||{})[n.Linear=0]="Linear",n[n.Radial=1]="Radial",n[n.Polar=2]="Polar",jI=n,GI=(r=>(r[r.RepeatWrapping=1e3]="RepeatWrapping",r[r.ClampToEdgeWrapping=1001]="ClampToEdgeWrapping",r[r.MirroredRepeatWrapping=1002]="MirroredRepeatWrapping",r))(GI||{}),HI=(r=>(r[r.NearestFilter=1003]="NearestFilter",r[r.LinearFilter=1006]="LinearFilter",r[r.LinearMipmapLinearFilter=1008]="LinearMipmapLinearFilter",r))(HI||{}),(i=WI||{})[i.UV=0]="UV",i[i.Planar=1]="Planar",i[i.Spherical=2]="Spherical",i[i.Cylindrical=3]="Cylindrical",i[i.Triplanar=4]="Triplanar",WI=i,(e=qI||{})[e.Simplex=0]="Simplex",e[e.SimplexFractal=1]="SimplexFractal",e[e.Ashima=2]="Ashima",e[e.Fbm=3]="Fbm",e[e.Perlin=4]="Perlin",e[e.Voronoi=5]="Voronoi",qI=e,(t=XI||{})[t.F1=0]="F1",t[t.F2=1]="F2",t[t.F2MinusF1=2]="F2MinusF1",t[t.SmoothBlend=3]="SmoothBlend",t[t.Edge=4]="Edge",t[t.Power=5]="Power",t[t.Lines=6]="Lines",t[t.Cells=7]="Cells",XI=t,$I=(r=>(r[r.Lights=0]="Lights",r[r.Static=1]="Static",r[r.Camera=2]="Camera",r))($I||{}),YI=(r=>(r[r.Circle=0]="Circle",r[r.Ring=1]="Ring",r[r.Polygon=2]="Polygon",r[r.Cross=3]="Cross",r[r.Diamond=4]="Diamond",r[r.Checkerboard=5]="Checkerboard",r[r.Line=6]="Line",r[r.Wave=7]="Wave",r))(YI||{}),Vb=["mode","gradientType","noiseType","tracingMode","mirror","displacementType","projection","cnormal","crop","axis","side","roughnessMapChannel","metalnessMap","metalnessMapChannel","normalMap","aoMap","aoMapChannel","emissiveMap","style"],bC=["wrapping","image","video","name","minFilter","magFilter"],(r=>{r.patch=function(s,a){let{texture:o,...l}=a;if(Object.assign(s,l),o){let c=s.texture;c&&Object.assign(c,o)}},r.defaultColorLayer=function(s){return{...r.defaultData("color"),color:s}},r.defaultData=function(s,a){return s==="light"&&a?function(o){let l={mode:0,isMask:!1,visible:!0,bumpMap:void 0,bumpMapIntensity:5,roughnessMap:void 0,alphaOverride:1};switch(o){case"phong":return{...l,category:"phong",specular:{r:.2,g:.2,b:.2},shininess:5,type:"light",visible:!0,mode:0,occlusion:!0,alpha:.6};case"toon":return{...l,category:"toon",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1};case"lambert":return{...l,category:"lambert",emissive:{r:0,g:0,b:0},type:"light",alpha:1,visible:!0,mode:0,occlusion:!0};case"physical":return{...l,category:"physical",roughness:.6,metalness:.2,reflectivity:.2,type:"light",alpha:.6,visible:!0,mode:0,occlusion:!0}}}(a):function(o){let l={alpha:1,mode:0,isMask:!1,visible:!0};switch(o){case"texture":return{...l,type:"texture",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{image:"image_0",wrapping:1e3,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"video":return{...l,type:"video",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{video:R_.defaultVideo,wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"color":return{...l,type:"color",color:An.fromHex(Rr)};case"vertexColor":return{...l,type:"vertexColor"};case"depth":return{...l,type:"depth",gradientType:1,smooth:!1,isVector:!0,isWorldSpace:!1,origin:[0,0,0],direction:[1,0,0],colors:[[1,1,1,1],[0,0,0,1]],steps:[0,1],near:50,far:200};case"normal":return{...l,type:"normal",cnormal:[1,1,1]};case"gradient":return{...l,type:"gradient",gradientType:0,smooth:!1,colors:[[0,0,0,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,1,1,1,1,1,1,1,1,1],num:2,angle:0,offset:[0,0],morph:[0,0]};case"noise":return{...l,type:"noise",size:[100,100,100],noiseType:0,scale:1,move:1,colorA:{...An.fromHex(6710886),a:1},colorB:{...An.fromHex(6710886),a:1},colorC:{...An.fromHex(16777215),a:1},colorD:{...An.fromHex(16777215),a:1},distortion:[1,1],fA:[1.7,9.2],fB:[8.3,2.8],voronoiStyle:0,highCut:1,lowCut:0,smoothness:.3,seed:0,quality:1};case"cavity":return{...l,type:"cavity",mode:3,ridge:1,valley:1};case"fresnel":return{...l,type:"fresnel",color:Je.fromHexAndA(16777215,1),bias:.1,scale:1,intensity:2,factor:1};case"dust":return{...l,type:"dust",color:Je.fromHexAndA(10323813,1),coverage:.2,softness:.2,noiseStrength:.2,noiseScale:1};case"rainbow":return{...l,type:"rainbow",filmThickness:30,movement:0,wavelengths:[0,0,0],noiseStrength:0,noiseScale:1,offset:[0,0,0]};case"toon":return{...l,type:"toon",positioning:2,colors:[[0,0,0,1],[.5,.5,.5,1],[.5,.5,.5,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,.475,.525,1,1,1,1,1,1,1],num:4,source:[0,1e3,0],isWorldSpace:!0,noiseStrength:0,noiseScale:1,shadowColor:Je.fromHexAndA(0,0),offset:[0,0,0]};case"outline":return{...l,type:"outline",outlineColor:Je.fromHexAndA(0,1),contourColor:Je.fromHexAndA(0,1),outlineWidth:2,contourWidth:5,outlineThreshold:.4,contourThreshold:0,outlineSmoothing:0,contourFrequency:10,contourDirection:[0,1,0],positionalLines:!1,compensation:!0};case"matcap":return{...l,type:"matcap",texture:{image:"matcap_0",wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006}};case"transmission":return{...l,type:"transmission",thickness:10,ior:1.5,roughness:1};case"reflection":return{...l,type:"reflection",blur:0,thickness:.001,steps:60,stepSize:.005,tracingMode:1,mirror:0};case"displace":return{visible:!0,type:"displace",displacementType:"noise",noiseType:0,scale:10,movement:1,offset:[0,0,0],intensity:8,voronoiStyle:0,smoothness:.3,seed:0,highCut:1,lowCut:0,quality:1};case"pattern":return{...l,type:"pattern",style:0,projection:0,axis:"y",blending:0,offset:[0,0],colorA:{...An.fromHex(0),a:1},colorB:{...An.fromHex(16777215),a:1},frequency:[10,10],size:.5,variation:0,smoothness:.5,zigzag:0,rotation:0,vertical:[0,1],horizontal:[0,1],sides:6}}}(s)}})(Ki||(Ki={})),(r=>{function s(a,o="layer1",l="layer2",c=An.fromHex(16777215)){let h=new Vt;return h.push({fi:0,data:Ki.defaultData("light",a),id:o}),h.push({fi:1,data:Ki.defaultData("color"),id:l}),{layers:h}}r.isMergable=function(a){return!a.layers.some(o=>o.data.type==="texture"&&o.data.projection!==0||o.data.type==="depth"&&!o.data.isWorldSpace||o.data.type==="noise"||o.data.type==="dust"&&o.data.noiseStrength!==0||o.data.type==="displace")},r.getHash=function(a){let o="";return a.layers.forEach(l=>{Object.entries(l.data).forEach(([c,h])=>{o+=`${c}${h}`,Array.isArray(h)?h.forEach(d=>o+=`${d}`):typeof h=="object"?Object.values(h).forEach(d=>{o+=typeof d=="number"?`${d.toFixed(4)}`:`${d}`}):o+=`${h}`})}),o},r.defaultEmptyData=function(){return{layers:new Vt}},r.defaultData=function(a="layer1",o="layer2"){return s("physical",a,o)},r.withName=function(a,o){return{...a,name:o}},r.defaultTwoLayerData=s,r.defaultColorMaterial=function(a,o,l="layer1",c="layer2"){let h=new Vt;return h.push({fi:0,data:Ki.defaultData("light",o),id:l}),h.push({fi:1,data:Ki.defaultColorLayer(a),id:c}),{layers:h}},r.defaultUIObjectMaterial=function(a){let o=Ki.defaultData("texture");a&&Object.assign(o.texture,{image:a});let l=new Vt;return l.push({fi:0,data:o,id:"layer1"}),l.push({fi:1,data:{...Ki.defaultData("transmission"),alpha:1},id:"layer2"}),l.push({fi:2,data:{...Ki.defaultData("light","lambert"),alpha:0},id:"layer3"}),{layers:l}},r.defaultTwoLayerTextureData=function(a,o="physical",l="layer1",c="layer2"){let h=Ki.defaultData("texture");Object.assign(h.texture,{image:a});let d=new Vt;return d.push({fi:0,data:h,id:l}),d.push({fi:1,data:Ki.defaultData("light",o),id:c}),{layers:d}},r.defaultTwoLayerVideoTextureData=function(a,o="physical",l="layer1",c="layer2"){let h=Ki.defaultData("video");Object.assign(h.texture,{video:a});let d=new Vt;return d.push({fi:0,data:h,id:l}),d.push({fi:1,data:Ki.defaultData("light",o),id:c}),{layers:d}}})(ki||(ki={}))}),_X=F(()=>{wu="Roboto_regular",RF="https://fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Me5WZLCzYlKw.ttf"}),kF=F(()=>{Ye(),(Pg||(Pg={})).defaultData=function(){return{points:new Vt,roundness:0,shapeHoles:[],isClosed:!1}}}),VF=F(()=>{Ye(),(O_||(O_={})).defaultData=function(){return{points:new Vt,lastInsertionPlane:null,subdivisions:12,isClosed:!1,subdivisionMode:"parametric"}},yc={type:"Ellipse",width:50,height:50,spikes:16,angle:360,innerRadius:0},(ZE||(ZE={})).merge=function(t,e){let i={...t};return L_.forEach(n=>{Object.assign(i,{[n]:e[n]??t[n]})}),i},xC={shape:yc,depth:1,offset:0,bevel:50,bevelSides:6,angle:0,twist:0,startScale:1,endScale:1,capType:"flat"},L_=["depth","offset","angle","twist","startScale","endScale"]}),SC=F(()=>{var t,e;kF(),VF(),(t=B_||(B_={})).is2DParametricMesh=function(i){return i==="PolygonGeometry"||i==="RectangleGeometry"||i==="StarGeometry"||i==="TriangleGeometry"||i==="EllipseGeometry"||i==="UIGeometry"},t.isParametricMesh=function(i){return i==="PolygonGeometry"||i==="RectangleGeometry"||i==="StarGeometry"||i==="TriangleGeometry"||i==="EllipseGeometry"||i==="PathGeometry"||i==="VectorGeometry"||i==="ConeGeometry"||i==="CubeGeometry"||i==="CylinderGeometry"||i==="DodecahedronGeometry"||i==="HelixGeometry"||i==="IcosahedronGeometry"||i==="LatheGeometry"||i==="PyramidGeometry"||i==="SphereGeometry"||i==="PlaneGeometry"||i==="BackdropGeometry"||i==="TorusGeometry"||i==="TorusKnotGeometry"||i==="BooleanGeometry"||i==="TextGeometry"||i==="InputGeometry"||i==="DecalGeometry"},t.isSwappableGeometry=function(i){return i==="PolygonGeometry"||i==="RectangleGeometry"||i==="StarGeometry"||i==="TriangleGeometry"||i==="EllipseGeometry"||i==="PathGeometry"||i==="VectorGeometry"||i==="ConeGeometry"||i==="CubeGeometry"||i==="CylinderGeometry"||i==="DodecahedronGeometry"||i==="HelixGeometry"||i==="IcosahedronGeometry"||i==="LatheGeometry"||i==="PyramidGeometry"||i==="SphereGeometry"||i==="PlaneGeometry"||i==="BackdropGeometry"||i==="TorusGeometry"||i==="TorusKnotGeometry"||i==="TextGeometry"||i==="SubdivGeometry"||i==="NonParametricGeometry"},(KE||(KE={})).merge=function(i,n){let r={...i};return Object.assign(r,n),r.type==="PathGeometry"&&"extrusion"in n&&n.extrusion&&(r.extrusion={...i.extrusion},Object.assign(r.extrusion,ZE.merge(r.extrusion,n.extrusion))),r},(e=Ho||(Ho={})).defaultData=function(i){if(i==="RectangleGeometry")return{width:320,height:320,type:i,cornerRadius:[0,0,0,0],cornerType:0,depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if(i==="UIGeometry")return{type:i,frame:"",cornerRadius:[0,0,0,0],cornerType:0,width:1,height:1};if(i==="PathGeometry")return{type:i,width:1,height:1,depth:1,path:O_.defaultData(),extrusion:xC};if(i==="VectorGeometry")return{width:1,height:1,type:i,subdivisions:12,shape:Pg.defaultData(),depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if(i==="BooleanGeometry")return{type:i,operation:2,width:0,height:0,depth:0,phongAngle:35};if(i==="ShapeBlendGeometry")return{type:i,width:0,height:0,depth:0,resolutionLevel:6,blendRange:100,useChildrenColors:!1};if(i==="DecalGeometry")return{type:i,width:200,height:200,depth:200,offset:1};if(i==="TextGeometry")return{type:i,width:100,height:100,depth:0,horizontalAlign:1,verticalAlign:1,fontSize:16,lineHeight:1.2,letterSpacing:0,text:{textValue:""},textTransform:1,font:"Roboto_regular",editable:!1,extrudeBevelSize:0,extrudeBevelSegments:1};if(i==="InputGeometry")return{...e.defaultData("TextGeometry"),type:i,editable:!0};if(i==="SphereGeometry")return{type:"SphereGeometry",width:100,height:100,depth:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180};throw new Error("not implemented")},l1=["width","height","depth"]}),jF=F(()=>{_s(),(t=>{function e(i){return i.mode??"linear"}t.defaultData={enabled:!1,useBackgroundColor:!1,color:An.white,near:.1,far:2e3,mode:"linear",density:.005,heightFalloff:.01,heightBase:0},t.getMode=e,t.getModeIndex=function(i){let n=e(i);return n==="height"?1:n==="both"?2:0},t.getDensity=function(i){return i.density??t.defaultData.density},t.getHeightFalloff=function(i){return i.heightFalloff??t.defaultData.heightFalloff},t.getHeightBase=function(i){return i.heightBase??t.defaultData.heightBase}})(tr||(tr={}))}),MC=F(()=>{(rS||(rS={})).defaultData={image:null,rotation:0,blur:32,showBackground:!0},(kl||(kl={})).defaultData={enabled:!1,mode:"hdri",hdri:rS.defaultData,timeOfDay:10,weather:"partlyCloudy",lighting:!0,lightingIntensity:1,lightingQuality:"full",clouds:!0,windSpeed:2,animateWind:!0,exposure:1,seed:2}}),GF=F(()=>{(()=>{let t={opacity:1,blendFunction:13,enabled:!1};(U_||(U_={})).defaultData={enabled:!1,pixelation:{...t,blendFunction:16,granularity:15},bloom:{...t,blendFunction:16,intensity:1,blurScale:1,luminanceThreshold:.25,luminanceSmoothing:.025,kernelSize:3},chromaticAberration:{...t,offset:[2,2]},vignette:{...t,darkness:1,offset:0},hueSaturation:{...t,hue:3,saturation:0},brightnessContrast:{...t,brightness:.25,contrast:0},depthOfField:{...t,focusDistance:100,focalLength:20,bokehScale:5},noise:{...t,blendFunction:16}}})()}),EC=F(()=>{var t;jF(),MC(),GF(),_s(),(t=eg||(eg={})).defaultData={type:"normal",softShadowQuality:"low"},t.isSoft=function(e){return e!=null&&(e.type===void 0||e.type==="soft")},(sS||(sS={})).defaultData={enabled:!0,color:{r:.8274509803921568,g:.8274509803921568,b:.8274509803921568},intensity:.75},(aS||(aS={})).defaultData={occlusion:!1,aoFullRes:!1,radius:256,bias:.5,aoColor:{r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}},(e=>{e.defaultData={pipeline:"classic",toneMapping:"aces",exposure:1},e.isUntouched=function(i){return i===void 0||i.pipeline==="classic"&&(i.toneMapping==="none"||i.toneMapping==="aces")&&i.exposure===1}})(oS||(oS={})),($u||($u={})).defaultData={usePhysics:!1,gravity:-10},(lS||(lS={})).defaultData={playCamera:Yc,gameControlObject:null},(QE||(QE={})).defaultData={backgroundColor:Je.fromHexAndA(DF,1),postprocessing:U_.defaultData,fog:tr.defaultData,sky:kl.defaultData,globalPhysics:$u.defaultData,ambient:sS.defaultData,ao:aS.defaultData,shadow:eg.defaultData,publish:lS.defaultData,grading:oS.defaultData}}),bX=F(()=>{(JE||(JE={})).defaultData={colliderType:"box",size:[100,100,100],colliderHelperVisible:!0,forceType:"collider",forceRange:"global",forceIntensity:.5,forceDambing:.95}}),jb=F(()=>{var t,e,i;Ye(),OF(),BF(),UF(),zF(),wC(),FF(),_s(),Gg(),SC(),LF(),ar(),EC(),bX(),(t=ZI||(ZI={})).isComponentRelated=function(n){return n==="Component"||n==="Instance"},t.isEmptyOrComponent=function(n){return n==="Empty"||n==="Instance"},(e=Rd||(Rd={})).identity={...GE.identity,hiddenMatrix:qu.identity},e.fromObject=function(n){return{position:n.position,rotation:n.rotation,scale:n.scale,pivot:n.pivot,pivotRotation:n.pivotRotation,hiddenMatrix:n.hiddenMatrix}},e.merge=function(n,r){return{position:r?.position||n.position,rotation:r?.rotation||n.rotation,pivot:r?.pivot||n.pivot,pivotRotation:r?.pivotRotation||n.pivotRotation,scale:r?.scale||n.scale,hiddenMatrix:r?.hiddenMatrix||n.hiddenMatrix}},e.diff=function(n,r){return hF({position:ah.isEqual(n.position,r.position)?void 0:r.position,rotation:ah.isEqual(n.rotation,r.rotation)?void 0:r.rotation,scale:ah.isEqual(n.scale,r.scale)?null:r.scale,hiddenMatrix:qu.isEqual(n.hiddenMatrix,r.hiddenMatrix)?void 0:r.hiddenMatrix})},IF=["slide","offset"],(Mn||(Mn={})).defaultData={states:new Vt,events:new Vt,visible:!0,raycastLock:!1,physics:Xu.defaultData,pathSnapping:{pathId:null,slide:0,offset:0,orientation:"tangential"},...Rd.identity,cloner:null},(z_||(z_={})).defaultData={type:"Empty",...Mn.defaultData},(KI||(KI={})).defaultData={type:"ParticleCollider",...JE.defaultData,...Mn.defaultData},(QI||(QI={})).defaultData={type:"Component",...Mn.defaultData},(JI||(JI={})).defaultData={type:"Particle",...Mn.defaultData,...D_.defaultData},(tO||(tO={})).defaultData={type:"Hair",...Mn.defaultData,...$E.defaultData},(Ha||(Ha={})).defaultData={type:"Mesh",...Mn.defaultData,...YE.defaultData},(ig||(ig={})).defaultData={...Mn.defaultData,...Rd.identity,position:Ko.DefaultPosition,rotation:Ko.DefaultRotation,...Ko.defaultData},(n=>{n.defaultData=function(r){return{...Mn.defaultData,...XE.defaultData(r)}},n.defaultDirectionalLightData={...n.defaultData("DirectionalLight"),position:[200,300,300],name:"Directional Light",intensity:.7}})(F_||(F_={})),(n=>{function r(s,a,o=0){for(;o<a.length;){let l=s?s[a[o]]:void 0;if(a.length===o+1)return l;if(!l)return;s=l.descendants,o+=1}}n.resolveWithDes=r,n.resolve=function(s,a,o=0){let l=r(s,a,o);if(l){let c=Object.keys(l);if(c.length===1&&c[0]==="descendants")return}return l}})(N_||(N_={})),(n=>{function r(s,a){return{...Mn.defaultData,...a,component:s,overrides:new fn,physics:void 0,events:void 0,type:"Instance"}}n.rootOverrideProps=["physics","events"],n.compositeNonOptionalOverrideProps=["geometry"],n.compositeEntireOverrideOverrideProps=["material"],n.ofComponent=r,n.fromComponentData=function(s){let a=Rd.fromObject(s.data);return r(s.id,a)}})(Qo||(Qo={})),(n=>{n.defaultData={type:"Page",...Mn.defaultData,physics:{...Xu.defaultData,fusedBody:!1},...QE.defaultData,camera:ig.defaultData,timelines:new te},n.isUIPage=function(r){return r.uiScene!==void 0}})(Ic||(Ic={})),(i=eO||(eO={})).defaultCamera={position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0],hiddenMatrix:qu.identity,name:"Play Camera",visible:!0,raycastLock:!1,physics:Xu.defaultData,states:new Vt,events:new Vt,cloner:null,pathSnapping:{pathId:null,orientation:"tangential",slide:0,offset:0},...Ko.defaultData},i.KeysByResetCategory={States:["states"],Events:["events"],Material:["material","materials"],Geometry:["geometry"],Position:["position"],Rotation:["rotation"],Scale:["scale"],Transform:["position","scale","rotation","hiddenMatrix"],Name:["name"],Visibility:["visible","raycastLock","flatShading","wireframe","side","shadowCatcher"],Shadows:["castShadow","receiveShadow"],Cloner:["cloner"],Physics:["physics"]},i.defaultMeshObject={name:"Rectangle",...Mn.defaultData,...Ha.defaultData,geometry:Ho.defaultData("RectangleGeometry"),material:ki.defaultTwoLayerData("physical","layer1","layer2")},i.defaultBooleanObject={name:"Boolean",...Mn.defaultData,...Ha.defaultData,geometry:Ho.defaultData("BooleanGeometry"),material:ki.defaultTwoLayerData("physical","layer1","layer2")},i.defaultShapeBlendObject={name:"Shape Blend",...Mn.defaultData,...Ha.defaultData,geometry:Ho.defaultData("ShapeBlendGeometry"),material:ki.defaultTwoLayerData("physical","layer1","layer2")},i.defaultTextObject={name:"Text",...Mn.defaultData,...Ha.defaultData,geometry:Ho.defaultData("TextGeometry"),material:ki.defaultTwoLayerData("physical","layer1","layer2")},i.defaultInputObject={name:"Input",...Mn.defaultData,...Ha.defaultData,geometry:Ho.defaultData("InputGeometry"),material:ki.defaultTwoLayerData("physical","layer1","layer2")},(n=>{n.newEmpty=function(r,s){let a={name:s};return r.type==="Mesh"?(a.geometry={},"material"in r&&(a.material={layers:new fn}),"materials"in r&&(a.materials=r.materials.map(o=>({layers:new fn})))):Vc.is(r.type)&&(a.perspective={},a.orthographic={}),a},n.toOps=function(r,s){let a,o=[],l={orthographic:0,perspective:0,geometry:0};function c(h,d){for(let[u,p]of Object.entries(d.layers)){let{texture:f,...g}=p;if(f!==void 0&&Object.keys(f).length>0){let m={path:[...h,"layers",u,"texture"],props:f,type:0};o.push(m)}if(Object.keys(g).length>0){let m={path:[...h,"layers",u],props:g,type:0};o.push(m)}}}for(let[h,d]of Object.entries(s)){let u=d;if(h!=="name")if(h==="cloner")o.push(...HE.toOps(u,["cloner"]));else if(h==="pathSnapping")o.push({path:[h],props:{slide:u.slide,offset:u.offset},type:0});else if(h==="material")c(["material"],u);else if(h==="materials")for(let[p,f]of Object.entries(u))c(["materials",p],f);else if(l[h]===0){if(h==="geometry"&&u.extrusion!==void 0){let p={path:[h,"extrusion"],props:u.extrusion,type:0};o.push(p),u={...u},delete u.extrusion}if(Object.keys(u).length>0){let p={path:[h],props:u,type:0};o.push(p)}}else a===void 0&&(a={path:[],props:{},type:0},o.push(a)),a.props[h]=u}return o},n.patch=function(r,s){if(s===void 0)return r;let a={...r};if(Object.assign(a,Rd.merge(a,s)),Object.assign(a,{pathSnapping:Object.assign({},a.pathSnapping,{slide:s.pathSnapping?.slide??a.pathSnapping?.slide??0,offset:s.pathSnapping?.offset??a.pathSnapping?.offset??0})}),Vc.is(r.type)){a.orthographic={...a.orthographic},a.perspective={...a.perspective};let o=s;o.orthographic?.zoom!==void 0&&(a.orthographic.zoom=o.orthographic.zoom),o.perspective?.zoom!==void 0&&(a.perspective.zoom=o.perspective.zoom),o.isUpVectorFlipped!==void 0&&(a.isUpVectorFlipped=o.isUpVectorFlipped),o.targetOffset!==void 0&&(a.targetOffset=o.targetOffset)}else if(r.type==="Mesh")"geometry"in s&&Object.assign(a,{geometry:KE.merge(a.geometry,s.geometry)}),(s.material||s.materials)&&(a=function(o,l){if(l===void 0)return o;let c={...o};return"material"in c&&"material"in l&&l.material&&(c.material=x_(c.material,h=>{if(typeof h!="string")for(let[d,u]of Object.entries(l.material.layers)){let p=h.layers.data(d);p&&Ki.patch(p,u)}}).data),c.materials&&l.materials&&(c.materials=x_(c.materials,h=>{for(let d=0;d<c.materials.length;d++){let u=l.materials[d];if(typeof u!="string")for(let[p,f]of Object.entries(u.layers)){let g=h[d]?.layers?.data(p);g&&Ki.patch(g,f)}}}).data),c}(a,s)),a.cloner&&"cloner"in s&&Object.assign(a,{cloner:Yl.merge(a.cloner,s.cloner)});else if(r.type==="Empty")a.cloner&&"cloner"in s&&Object.assign(a,{cloner:Yl.merge(a.cloner,s.cloner)});else if(qE.is(r.type)){let o=s;o.intensity!==void 0&&(a.intensity=o.intensity),o.color!==void 0&&(typeof o.color=="string"?a.color=o.color:a.color=An.clone(o.color))}return a}})(Zl||(Zl={}))}),AC=F(()=>{(k_||(k_={})).defaultData={enablePan:!0,enableZoom:!0,enableRotate:!0,enableDamping:!0,rotationLimitsMode:0,rotationVerticalOffset:{min:Math.PI/4,max:Math.PI/4},rotationHorizontalOffset:{min:Math.PI/4,max:Math.PI/4},rotationSoftLimit:2,rotationSpeed:1,panLimitsMode:0,panVerticalOffset:{min:250,max:250},panHorizontalOffset:{min:250,max:250},panSoftLimit:2,zoomLimitsEnabled:!1,zoomLimits:{min:.1,max:2},autoRotate:!1,autoRotateSpeed:2,autoRotateClockwise:!0,hoverRotatePanMode:0,hoverRotatePanStrength:20,hoverRotateDamping:.125,isTouchZoom:!0,orbitTouches:2,panTouches:3,resetHoverEffectOnPointerLeave:!0}}),Gb=F(()=>{AC(),_s(),(Jo||(Jo={})).defaultData={orbitControls:k_.defaultData,playPage:Wu,withBackground:!0,preventScroll:!1,preventTouchScroll:!1,hideCursor:!1,mouseEventTarget:"canvas",joystickSizeAndXYOffset:Array(12).fill(0).map((t,e)=>{let i=0,n=0;return e<5?n=-30:e<10&&(n=30),e===0||e===10||e===5?i=30:(e===4||e===11||e===9)&&(i=-30),[120,[i,n],"show"]}),settings:{image:{format:"jpg",ratio:1,colorSpace:"display-p3"},videoStatic:{fps:60,mbps:150,ratio:1,duration:1e3,format:"mp4",imageFormat:"jpg",activeTimeline:null,colorSpace:"display-p3"},web:{logo:!0,compress:!0,preset:1,preload:!0,hint:!1,imageQuality:70,pixelRatioMobile:0,pixelRatioDesktop:0}},stopRaycast:!0,hdTransmission:!1,renderer:"webgpu",asyncShaderCompilation:!0}}),HF=F(()=>{var t;(hS||(hS={})).defaultData={id:"basic",label:"Basic",style:"None",prompt:""},(cS||(cS={})).defaultData={weather:0,shadows:0,lightOrigin:0,temperature:0,sun:0,camera:0,environment:0,particles:0,nature:0,floor:0},(t=bc||(bc={})).defaultData=()=>({mode:"line-art-both",prompt:"",negativePrompt:"",style:{...hS.defaultData},isRandomSeed:!0,seed:t.generateSeed(),guessMode:!1,advanced:!1,steps:20,guidanceScale:7.5,controlNetScale:1,modifiers:cS.defaultData}),t.generateSeed=()=>Math.round(1e5*Math.random())}),TC=F(()=>{jb(),Ye(),Gb(),_s(),ar(),HF(),(t=>{function e(i,n){let r=i.scene.objects.get(n);if(r&&r.data.type==="Component")return r;{let s=i.shared.lib.components[n];if(s)return{...s.asset,id:n}}}t.physicsEnabled=function(i){return i.find(n=>n.data.type==="Page"&&n.data.globalPhysics.usePhysics)!==void 0},t.findTimeline=function(i,n){let r=i.find(s=>s.data.type==="Page"&&s.data.timelines?.[n]!==void 0);return r&&r.data.timelines?.[n]},t.getComponentData=e,t.traverseModuleInstances=function(i,n,r){i.scene.objects.traverseFrom(n,(s,a)=>{if(a.type==="Instance"){let o=e(i,a.component)?.data;o&&r(s,a,o.events)}else r(s,a,a.events)})}})(jc||(jc={})),(t=>{function e(n=!0,r=[]){let s=[];n&&s.push({...t.defaultLight}),s.push(...r);let a=new Wn;return a.push({fi:1,id:Wu,data:{...Ic.defaultData,name:"Scene 1"},children:s}),a}function i(n){return{...t.defaultData,objects:Er(n,Wn.prototype)}}t.TRASH_CAN_ID="830a2708-8ed9-49cf-a68e-085299892222",t.defaultLight={fi:-1,data:F_.defaultDirectionalLightData,id:"830a2708-8ed9-49cf-a68e-085299899103",children:[]},t.createDefaultObjectTreeWithPage=e,t.defaultData={objects:e(),publish:Jo.defaultData,styles:bc.defaultData()},t.emptyDataWithoutPage=function(){return{objects:new Wn,publish:Jo.defaultData,styles:bc.defaultData()}},t.emptyDataWithPage=function(n=!0){return{objects:e(n),publish:Jo.defaultData,styles:bc.defaultData()}},t.emptyData=function(){return{objects:new Wn,publish:{...Jo.defaultData},styles:bc.defaultData()}},t.withObjs=i,t.withObj=function(n,r){return i([{id:n,data:r,children:[],fi:0}])}})(xc||(xc={}))}),WF=F(()=>{(ng||(ng={})).defaultData={preset:"fullscreen",allowResponsive:!1,size:[512,512],coords:[0,0],sceneScale:1,color:{r:0,g:0,b:0,a:.5}}}),CC=F(()=>{var t,e;Ye(),ar(),(t=tA||(tA={})).defaultData=i=>({url:i,name:"New Webhook",parametersSchemas:new Vt}),t.defaultParameterValueByType=i=>i==="number"?0:i!=="boolean"&&"",(iO||(iO={})).defaultData=(i,n="GET")=>({url:i,method:n,name:"New API",headers:new Vt,queries:new Vt,autoStart:!0}),(i=>{function n(s){return s.textValue!==void 0}function r(s){return typeof s=="boolean"}i.isTextValue=n,i.isNumber=function(s){return typeof s=="number"},i.isBoolean=r,i.typeOfVariable=function(s){return n(s)?"string":r(s)?"boolean":"number"},i.getDisplayedValue=function(s){return i.isTextValue(s)?Array.isArray(s.textValue)?s.textValue.map(a=>a.toString().padStart(s.padding??2,"0")).join(s.deliminator??":")+(s.suffix!==void 0?" "+s.suffix:""):s.textValue.toString():i.isBoolean(s)?s?"True":"False":i.isNumber(s)?parseFloat(s.toFixed(3)).toString():s.toString()}})(_r||(_r={})),(dS||(dS={})).all=["images","videos","colors","audios","particles","fonts","materials","variables"],(nO||(nO={})).all=[...dS.all,"components"],(rO||(rO={})).defaultData=function(){return{images:new te,videos:new te,colors:new te,audios:new te,particles:new te,fonts:new te,materials:new te,components:new te,variables:new te,userAPIs:new te,userWebhooks:new te}},(Wo||(Wo={})).defaultData=function(){return{images:new te,videos:new te,colors:new te,audios:new te,particles:new te,fonts:new te,materials:new te,components:new te,variables:new te,userAPIs:new te,userWebhooks:new te}},(e=Fs||(Fs={})).defaultColors=function(){return Er({"89b10010-844c-11ec-a8a3-0242ac120002":{r:.5,g:.5,b:.5,a:1,name:"Default Color"}},te.prototype)},e.defaultImages=function(){return Er({},te.prototype)},e.emptyData=function(){return{catelogs:new te,materials:new te,images:new te,videos:new te,colors:new te,audios:new te,particles:new te,fonts:new te,variables:new Vt,userAPIs:new te,userWebhooks:new te,lib:Wo.defaultData()}},e.defaultVariables=function(i){switch(i){case"number":return{value:0,name:"Number"};case"boolean":return{value:!1,name:"Boolean"};case"string":return{value:{textValue:"String value"},name:"String"};case"time":{let n=[0,0,0];return{name:"Time",value:{textValue:n,deliminator:":",padding:2,suffix:"AM"},dynamicVariableType:"time",format:"HH:mm:ss",format12h24h:"12ampm",timeZone:null,hasEnd:!1,endValue:{textValue:n,deliminator:":",padding:2,suffix:"AM"},autoStart:!0,repeat:!1}}case"counter":return{name:"Counter",value:0,dynamicVariableType:"counter",updateInterval:1e3,increment:1,autoStart:!0,hasEnd:!0,endValue:60,repeat:!0,randomStart:!1,range:[0,100],decimals:0};case"random":return{name:"Random",value:0,dynamicVariableType:"random",updateInterval:1e3,increment:1,autoStart:!0,isStatic:!1,hasEnd:!0,endValue:60,repeat:!0,min:0,max:100,decimals:0};default:console.error("Unknown variable type",i)}},e.getFormattedTimerTime=function(i,n){if(n.format==="HH:mm:ss"){let r=Math.floor(i/3600),s=Math.floor((i-3600*r)/60);return{textValue:[r,s,Math.round(i-3600*r-60*s)]}}if(n.format==="mm:ss"){let r=Math.floor(i/60);return{textValue:[r,Math.round(i-60*r)]}}return n.format==="number"?Math.round(i):Math.round(1e3*i)/1e3}}),xX=F(()=>{}),qF=F(()=>{var t;Ye(),TC(),WF(),CC(),(t=Yu||(Yu={})).defaultData={schema:131,scene:xc.defaultData,frames:new te().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",ng.defaultData),shared:{...Fs.emptyData(),colors:Fs.defaultColors()}},t.createDefaultData=function(){return Tg.deserialize(Tg.serialize(t.defaultData))},t.emptyDataForImports=function(){return{schema:131,scene:xc.emptyDataWithPage(),frames:new te().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",ng.defaultData),shared:{...Fs.emptyData(),colors:Fs.defaultColors(),images:Fs.defaultImages()}}},t.emptyData=function(){return{schema:131,scene:xc.emptyDataWithPage(),frames:new te().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",ng.defaultData),shared:Fs.emptyData()}},t.clipboard2dData=function(){return{schema:131,scene:xc.emptyData(),frames:new te,shared:Fs.emptyData()}},t.withoutLib=function(e){return{...e,shared:{...e.shared,lib:Wo.defaultData()}}},t.getComponentData=function(e,i){return jc.getComponentData(e,i)},t.hasSensitiveData=function(e){let i=Object.values(e.shared.userAPIs);for(let n of i){let r=n.headers;for(let s of r)if(s.data.key.toLowerCase()==="authorization"&&s.data.value!=="")return!0}return!1}}),wX=F(()=>{(eA||(eA={})).emptyImage={data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=",name:"empty"}});function Oc(t,e=[0,0]){return[t&&!isNaN(t[0])?t[0]:e[0],t&&!isNaN(t[1])?t[1]:e[1]]}function Cf(t,e,i){switch(t){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 7:return"cubicBezier( .25, 1, .5, 1 )";case 5:{let{control1:n,control2:r}=e??{...dp.defaultData};return`cubicBezier( ${n[0]}, ${n[1]}, ${r[0]}, ${r[1]} )`}case 6:{let{mass:n,stiffness:r,damping:s,velocity:a}=i??{...$l.defaultData},o=new XF(n,r,s,a),l=o.solve(1);return()=>c=>o.solve(c)/l}case 8:return()=>n=>Math.floor(n)}}var sO,aO,Lc,Dg,XF,V_,j_,$F=F(()=>{Ye(),_s(),(sO||(sO={})).defaultData=function(t,e){return{id:t,name:e,duration:5,objectTimelines:new te}},(aO||(aO={})).is=function(t){return t&&typeof t.x=="number"&&typeof t.y=="number"&&typeof t.z=="number"},(t=>{function e(h,d){let u=[0,0],p=[1,1];if(h?.cubicControls)u=Oc(h.cubicControls.control1,u);else switch(h?.type){case 2:case 4:u=[.42,0];break;case 3:case 0:u=[0,0];break;case 1:u=[.25,.1];break;case 7:u=[.25,1]}if(d?.cubicControls)p=Oc(d.cubicControls.control2,p);else switch(d?.type){case 2:case 0:p=[1,1];break;case 3:case 4:p=[.58,1];break;case 1:p=[.25,1];break;case 7:p=[.5,1]}return{control1:u,control2:p}}function i(h){if(!t.BEZIER_PRESETS.includes(h))return;let d={type:h};return{control1:e(d).control1,control2:e(void 0,d).control2}}function n(h,d){return Math.abs(h[0]-d[0])<.001&&Math.abs(h[1]-d[1])<.001}function r(h){let d=t.ROOT_PROPERTY_ORDER.indexOf(h[0]);return d===-1?t.ROOT_PROPERTY_ORDER.length:d}function s(h){return h.layerId??h.path.join(".")}function a(h){let d=h[h.length-1];return Dg.includes(d)?d:void 0}function o(h){return h.layerId?h.layerId:(a(h.path)?h.path.slice(0,-1):h.path).join(".")}function l(h){return["material",h.type==="light"?`${h.category} lighting`:h.type]}function c(h,d,u){return{id:h,data:{id:h,time:u?.time??0,path:d,value:{},layerId:u?.layerId,index:u?.index,isPlaceholder:!0,easing:{type:5,cubicControls:{control1:[.42,0],control2:[.58,1]}}}}}t.getControlsWithDefault=e,t.BEZIER_PRESETS=[0,1,2,3,4,7],t.presetHandles=i,t.presetForHandles=function(h){return t.BEZIER_PRESETS.find(d=>{let u=i(d);return u!==void 0&&n(u.control1,h.control1)&&n(u.control2,h.control2)})},t.defaultData=function(h){return{id:h,keyframes:new Vt}},t.ROOT_PROPERTY_ORDER=["position","rotation","scale","shape size","material","opacity","camera","light","cloner","path extrusion","path snapping"],t.rowOrder=r,t.propertyKey=s,t.groupKeyframes=function(h,d){let u=new Map;for(let p of h){let f=p.data;if(d?.(f))continue;let g=s(f),m=u.get(g);m||(m={id:g,path:f.path,keyframes:[],layerId:f.layerId,index:f.index},u.set(g,m)),f.isPlaceholder?m.placeholder=p.id:m.keyframes.push(p)}return[...u.values()].sort((p,f)=>{let g=r(p.path)-r(f.path);return g!==0?g:(p.index??0)-(f.index??0)})},t.rowAxis=a,t.drawnRowKey=o,t.drawnRows=function(h){let d=new Map;for(let u of h){let p=a(u.path),f=p?u.path.slice(0,-1):u.path,g=o(u),m=d.get(g);m||(m={id:g,path:f,layerId:u.layerId,index:u.index,tracks:[]},d.set(g,m)),m.tracks.push({axis:p,property:u})}return[...d.values()]},t.sortedKeyframes=function(h){return[...h].sort((d,u)=>d.data.time-u.data.time)},t.materialLayerPath=l,t.createMaterialGroup=function(h,d){return h.map(({data:u,id:p},f)=>c(d(),l(u),{layerId:p,index:f}))},t.placeholderKeyframe=c,t.createName=function(h){return Object.entries(h).reduce((d,[u,p])=>(typeof p!="string"&&d.push({name:p.name}),d),[])},t.Presets=[{name:"Slide in",animationParams:{translateX:{value:[-20,0],easing:Cf(3),duration:1e3},opacity:{value:[0,1],easing:Cf(3),duration:1e3},endDelay:250,loop:!0}},{name:"Rotate",animationParams:{rotate:{value:[0,"1turn"],easing:Cf(5),duration:700},endDelay:250,loop:!0}},{name:"Scale Out",animationParams:{scale:{value:[1,1.5],easing:Cf(4),duration:1e3},endDelay:250,loop:!0}},{name:"Jump",animationParams:{translateY:[{value:0,duration:200,easing:"linear"},{value:-20,easing:"linear",duration:200},{value:0,easing:"linear",duration:100}],endDelay:500,loop:!0}},{name:"Jump Rotate",animationParams:{translateY:[{value:0,duration:200,easing:"linear"},{value:-20,easing:"linear",duration:200},{value:0,easing:"linear",duration:100}],rotate:{value:[0,"1turn"],easing:Cf(5),duration:500},endDelay:500,loop:!0}},{name:"Bounce",animationParams:{translateY:{value:["20px","-20px"],duration:575,easing:"easeOutQuad"},direction:"alternate",loop:!0}}]})(Lc||(Lc={})),Dg=["x","y","z"],XF=class{constructor(t=1,e=100,i=10,n=0){this.mass=t,this.stiffness=e,this.damping=i,this.initialVelocity=n,this.m_w0=Math.sqrt(e/t),this.m_zeta=i/(2*Math.sqrt(e*t)),this.m_zeta<1?(this.m_wd=this.m_w0*Math.sqrt(1-this.m_zeta*this.m_zeta),this.m_A=1,this.m_B=(this.m_zeta*this.m_w0-n)/this.m_wd):(this.m_wd=0,this.m_A=1,this.m_B=-n+this.m_w0)}solve(t){return 1-(this.m_zeta<1?Math.exp(-t*this.m_zeta*this.m_w0)*(this.m_A*Math.cos(this.m_wd*t)+this.m_B*Math.sin(this.m_wd*t)):(this.m_A+this.m_B*t)*Math.exp(-t*this.m_w0))}getDuration(){let t=.16666666666666666,e=0,i=0;for(;;)if(e+=t,this.solve(e)===1){if(i++,i>=16)break}else i=0;return e*t*1e3}}}),PC=F(()=>{var t;_s(),Ye(),(V_||(V_={})).list=["idle","move","jump","run"],(t=j_||(j_={})).defaultColliderData={type:"capsule",height:200,radius:50,position:[0,0,0],rotation:[0,0,0]},t.defaultDataThirdPerson={moveMode:"walk",forwardDirection:"+z",speedTranslate:1e3,speedRotate:100,runMultiplier:2,rotationMode:"normal",rotBy:"keys",rotByTouch:"drag",delayPos:[.3,.3],delayRot:[.3,.3],keyAssignments:[["moveNegZ","W"],["moveNegX","A"],["movePosZ","S"],["movePosX","D"],["rotPosX","\u25B2"],["rotPosY","\u25C0"],["rotNegX","\u25BC"],["rotNegY","\u25B6"],["jump","Space"],["run","\u21E7"],["none","Ctrl"]],touchControl:!0,joystickPosLoc:5,joystickRotLoc:11,jumpTouchButtonLoc:9,collider:t.defaultColliderData,colliderHelperVisible:!0,collisionEnabled:!0,jumpPower:100,resetYPosition:3e3,alignToGround:!1,autoOrientMove:!0,orientWith:"camera",orientMode:"radial",delayPosCamera:.3,delayRotCamera:.3,camera:"",cameraXAxis:"Limit",cameraYAxis:"Free",cameraRotXLimits:[0,Math.PI/2],cameraRotYLimits:[-Math.PI/2,Math.PI/2],gameActions:{idle:new Vt,move:new Vt,jump:new Vt,run:new Vt},navmesh:{enabled:!1,ch:6,cs:6,walkableClimb:5,walkableHeight:1,walkableRadius:0,zones:"all",objects:[],helperVisible:!0,destinationHelperRadius:0,destinationHelperColor:Je.fromHexAndA(3728051,1)}}});function uc(t,...e){let i={};for(let n of e.flat())t!=null&&n in t&&(i[n]=t[n]);return i}function oO(t){t.layers.forEach(e=>{if(e.type==="depth"&&e.colorA!==void 0){let i=e.colorA,n=e.colorB,r=[[i.r,i.g,i.b,i.a],[n.r,n.g,n.b,n.a]],s=[0,1];for(let o=2;o<10;o++)r.push(r[1]),s.push(1);let a={...uc(ln(e),"type","visible","isVector","isWorldSpace","origin","alpha","mode"),near:Math.max(0,e.near),far:Math.max(0,e.far),colors:r,steps:s,num:2,direction:[1,0,0],smooth:!1,gradientType:1};Object.assign(e,a)}else if(e.type==="depth"&&e.gradientType===1&&(e.near<0||e.far<0)){let i={...ln(e),near:Math.max(e.near,0),far:Math.max(e.far,0)};Object.assign(e,i)}})}function Fo(t,e){Object.values(t.shared.materials).forEach(i=>e(i))}function No(t,e){t.scene.objects.traverse((i,n)=>{"materials"in n?n.materials.forEach((r,s)=>{r===void 0&&(n.materials[s]=ki.defaultTwoLayerData("phong"),r=n.materials[s]),typeof r!="string"&&e(r)}):"material"in n?typeof n.material!="string"&&(n.material===void 0&&(n.material=ki.defaultTwoLayerData("phong")),e(n.material)):n.type==="Mesh"&&(n.material===void 0&&(n.material=ki.defaultTwoLayerData("phong")),e(n.material)),"overrides"in n&&Object.values(n.overrides).forEach(r=>{r.material&&typeof r.material!="string"&&Object.getPrototypeOf(r.material)!==fn.prototype&&e(r.material)})})}function lO(t){t.layers===void 0&&Object.assign(t,ki.defaultTwoLayerData("lambert"))}function uS(t){!t.layers||t.layers.forEach(e=>{if(e.type==="depth"&&e.colors.length===10){let i=[...e.colors];i.push(e.colors[9]);let n=[...e.steps];n.push(e.steps[9]);let r={...ln(e),colors:i,steps:n};Object.assign(e,r)}})}function hO(t){t.scene.objects.traverse((e,i)=>{"materials"in i?i.materials.forEach(n=>{typeof n!="string"&&uS(n)}):"material"in i&&typeof i.material!="string"&&uS(i.material)}),Object.values(t.shared.materials).forEach(e=>uS(e))}function cO(t){t.layers&&t.layers.forEach(e=>{e.type==="depth"&&e.num!==void 0&&(e.colors=e.colors.slice(0,e.num),e.steps=e.steps.slice(0,e.num),delete e.num)})}function dO(t){t.layers&&t.layers.forEach(e=>{(function(i){return i.type!=="displace"})(e)&&e.isMask===void 0&&(e.isMask=!1),(e.type==="texture"||e.type==="video")&&e.blending===void 0&&(e.blending=0),(e.type==="noise"||e.type==="displace"&&e.displacementType==="noise")&&(e.voronoiStyle===void 0&&(e.voronoiStyle=0),e.highCut===void 0&&(e.highCut=1),e.lowCut===void 0&&(e.lowCut=0),e.smoothness===void 0&&(e.smoothness=.3),e.seed===void 0&&(e.seed=0),e.quality===void 0&&(e.quality=1))})}function uO(t){let e=t.layers.find(i=>i.type==="light")?.data;if(e?.category==="basic"){let i=Ki.defaultData("light","phong"),n=e;Object.assign(n,i),n.visible=!1}}function pO(t){Fo(t,uO),No(t,uO)}function fO(t){t.layers.forEach(e=>{e.type==="light"&&e.category!=="toon"&&e.occlusion===void 0&&(e.occlusion=!0)})}function mO(t){t.layers&&t.layers.forEach(e=>{e.type==="light"&&e.bumpMapIntensity===void 0&&(e.bumpMapIntensity=5)})}var SX=F(()=>{Gg(),_s(),AC(),jb(),Ye(),Gb(),ar(),et(),SC(),PC(),HF(),TC(),wC(),EC()}),YF={};function gO(t){t.layers&&t.layers.forEach(e=>{e.type==="light"&&e.alphaOverride===void 0&&(e.alphaOverride=1)})}function vO(t){t.rotation=t.rotation.slice(0,3).map(e=>e*_c)}function ZF(t){vO(t),t.type==="Page"&&vO(t.camera),t.states?.forEach(i=>{i.rotation===void 0||i.rotation===null||(i.rotation=i.rotation.slice(0,3).map(n=>n*_c))});let e=t.geometry;e&&e.type==="SphereGeometry"&&(e.thetaLength=(e.thetaLength??180)*_c),e&&e.type==="TorusGeometry"&&(e.arc=e.arc*_c),e&&e.type==="PathGeometry"&&(e.extrusion.angle*=_c,e.extrusion.twist*=_c),t.type==="Mesh"&&t.geometry.type==="TextGeometry"&&(t.geometry.text={textValue:t.geometry.text}),Array.isArray(ln(t.events))&&t.events?.forEach(i=>{(i.type==="MouseDown"||i.type==="MouseUp"||i.type==="MousePress"||i.type==="KeyDown"||i.type==="KeyUp"||i.type==="KeyPress"||i.type==="Collision"||i.type==="Trigger")&&(i.runMode=i.toggle?"Toggle":"Repeat")})}function MX(t){t.scene.objects.traverse((e,i)=>{})}function EX(t){let e=t.schema??104;e!==131&&e<130&&(G_(t.asset),t.schema=130)}function Ou(t,e){e(t.data);for(let i of t.children)Ou(i,e)}function KF(t){let e=t.schema??104;e!==131&&(e<105&&(Ou(t.asset,ZF),t.schema=105),e<118&&(Ou(t.asset,JF),t.schema=118),e<121&&(Ou(t.asset,nA),t.schema=121),e<130&&(Ou(t.asset,AX),t.schema=130))}function QF(t,e){No(t,e),Fo(t,e),Object.values(t.shared.lib.materials).forEach(i=>e(i.asset))}function G_(t){t.layers===void 0&&Object.assign(t,ki.defaultTwoLayerData("phong"))}function AX(t){"materials"in t?t.materials.forEach(e=>{e!==void 0&&typeof e!="string"&&G_(e)}):"material"in t&&t.material!==void 0&&typeof t.material!="string"&&G_(t.material)}function JF(t){t.timelineAnimations=Er({},te.prototype)}function TX(t){let e=[];return t?(t.forEach((i,n)=>{let{path:r,keyframes:s}=i.data,a=r[0]==="material"?i.id:void 0;s?.length?s.forEach(({id:o,data:l})=>{e.push({id:o,data:{...l,path:r,layerId:a,index:n}})}):e.push(Lc.placeholderKeyframe(i.id,r,{layerId:a,index:n}))}),e.sort((i,n)=>i.data.time-n.data.time),new Vt(...e.map((i,n)=>({...i,fi:n})))):new Vt}function CX(t){for(let{id:e,data:i}of[...t.unproxy()]){let n=i.path?.[0];if(!n||!tN.includes(n))continue;let r=iA(i.value);if(!r.length)continue;let s=t.data(e);if(!s)continue;let a=i.value,[o,...l]=r;for(let c of l){let h=Ot.generateUUID();t.insertBefore(null,[{id:h,data:{...i,id:h,path:[n,c],value:a[c],easing:PX(i.easing)}}])}s.path=[n,o],s.value=a[o]}}function iA(t){return t===null||typeof t!="object"?[]:Dg.filter(e=>e in t)}function PX(t){let e=t?.cubicControls;return{...t,cubicControls:{control1:[...e?.control1??[0,0]],control2:[...e?.control2??[1,1]]},...t?.springParameters?{springParameters:{...t.springParameters}}:{}}}function DX(t,e){return Math.abs(t[0]-e[0])<1e-6&&Math.abs(t[1]-e[1])<1e-6}function RX(t){let e=function(s){let a=[];for(let o of Lc.groupKeyframes(s)){let l=new Set(o.keyframes.flatMap(h=>iA(h.data.value))),c=l.size?[...l].map(h=>o.keyframes.filter(d=>iA(d.data.value).includes(h))):[o.keyframes];for(let h of c){let d=[...h].sort((u,p)=>u.data.time-p.data.time);for(let u=0;u+1<d.length;u++)a.push({left:d[u],right:d[u+1]})}}return a}([...t.unproxy()]),i=new Map,n=new Set;for(let{left:s,right:a}of e){let o=s.data.easing?.type,l=(o===void 0?void 0:Lc.presetHandles(o))?.control2??(o===5?Oc(a.data.easing?.cubicControls?.control2,[1,1]):void 0);if(!l)continue;let c=i.get(a.id);c?DX(c,l)||n.add(a.id):i.set(a.id,l)}let r=new Map;for(let{id:s,data:a}of t.unproxy()){let o=a.easing?.type,l=o===void 0?void 0:Lc.presetHandles(o);l&&r.set(s,l.control1)}for(let{left:s,right:a}of e)n.has(a.id)&&r.delete(s.id);for(let[s,a]of r){let o=t.data(s);!o?.easing||(o.easing.cubicControls={control1:a,control2:Oc(o.easing.cubicControls?.control2,[1,1])},o.easing.type=5)}for(let{left:s,right:a}of e){if(!r.has(s.id))continue;let o=t.data(a.id),l=i.get(a.id);!o?.easing||!l||(o.easing.cubicControls={control1:Oc(o.easing.cubicControls?.control1,[0,0]),control2:l})}}function yO(t,e){t.scene.objects.traverse((i,n)=>{let r=n;if(r.type==="Page"&&r.timelines)for(let s of Object.values(r.timelines))for(let a of Object.values(s.objectTimelines??{}))e(a.keyframes)})}function nA(t){t.pivot=[0,0,0],t.pivotRotation=[0,0,0]}function IX(t){}function OX(t){let e=t.schema??0;if(e!==131){if(e>131)return void console.error(`This scene was created with a newer version of Spline (file format ${e}, this runtime reads 131). Update @splinetool/runtime to the latest version to load it correctly.`);console.warn("updating from ",e,"to ",131),function(i,n){if(n<1&&(No(i,oO),Fo(i,oO),i.schema=1),n<2&&(function(r){Object.assign(r.scene.publish,{orbitControls:{...k_.defaultData,...ln(r.scene.publish.orbitControls)}})}(i),i.schema=2),n<3&&(function(r){function s(a){if(a.layers){for(let o of Object.values(a.layers))if(o){for(let[l,c]of Object.entries(o))if((Vb.includes(l)||typeof c=="boolean")&&delete o[l],l==="texture")for(let[h,d]of Object.entries(c))(bC.includes(h)||typeof d=="boolean")&&delete c[h]}}}r.scene.objects.traverse((a,o)=>{o.states.forEach(l=>{let c=l;c.material?s(c.material):c.materials&&c.materials.forEach(h=>{s(h)})})})}(i),i.schema=3),n<4&&(function(r){r.scene.publish.withBackground=!0}(i),i.schema=4),n<5&&(function(r){r.scene.publish.settings.web={compress:!0,preload:!0,preset:1,logo:!0,hint:!1}}(i),i.schema=5),n<6&&(function(r){r.scene.objects.traverse((s,a)=>{let o=a.cloner;o&&(o.radial.scale=o.radial.scale.map(l=>l+1),o.linear.scale=o.linear.scale.map(l=>l+1))})}(i),i.schema=6),n<7&&(function(r){r.scene.objects.traverse((s,a)=>{let o=a.geometry;o&&(o.type==="DodecahedronGeometry"||o.type==="IcosahedronGeometry")&&(o.detail=Math.round(o.detail))})}(i),i.schema=7),n<8&&(i.schema=8),n<9&&(hO(i),i.schema=9),n<10&&(function(r){r.scene.objects.traverse((s,a)=>{a.type==="Mesh"&&(a.geometry.type==="BooleanGeometry"||a.geometry.type==="SubdivGeometry")&&(a.geometry.phongAngle=35)})}(i),i.schema=10),n<11&&(function(r){r.scene.environment.ambientLight.softShadows=!1,r.scene.environment.ambientLight.softShadowQuality="low",r.scene.objects.traverse((s,a)=>{(a.type==="DirectionalLight"||a.type==="SpotLight")&&(a.shadowResolution=1024,a.shadowRadius=1,a.depth=1e5)}),r.shared.penumbraSize=new Array(5).fill(.5)}(i),i.schema=11),n<12&&(hO(i),i.schema=12),n<13&&(function(r){r.shared.audios=Er({},te.prototype)}(i),i.schema=13),n<14&&(function(r){let s=r.shared.materials;Object.entries(s).forEach(([a,o])=>{if(!o.layers){let l={name:"Untitled Material",layers:[{fi:0,data:{type:"light",category:"phong",alpha:.6,visible:!0,mode:0,specular:{r:.2,g:.2,b:.2},shininess:5},id:"layer1"},{fi:1,data:{type:"color",alpha:1,visible:!0,mode:0,color:{r:.2823529411764706,g:.2823529411764706,b:.30196078431372547}},id:"layer2"}]};Object.assign(s,{[a]:l})}})}(i),i.schema=14),n<15&&(function(r){Object.entries(ln(r.shared.images)).filter(s=>s[1].asset===!1).map(s=>s[0]).forEach(s=>{delete r.shared.images[s]}),Object.entries(ln(r.shared.audios)).filter(s=>s[1].asset===!1).map(s=>s[0]).forEach(s=>{delete r.shared.audios[s]})}(i),i.schema=15),n<16&&(function(r){r.scene.publish.settings.web.preload=!1}(i),i.schema=16),n<17&&(No(i,cO),Fo(i,cO),i.schema=17),n<18&&(No(i,lO),Fo(i,lO),i.schema=18),n<19&&(function(r){Object.assign(r.scene.publish.settings,{video:{...Jo.defaultData.settings.video,...ln(r.scene.publish.settings.video)}})}(i),i.schema=19),n<20&&(function(r){r.shared.fonts=Er({},te.prototype)}(i),function(r){let s=[];r.scene.objects.traverse((a,o)=>{let l=o;if(l.type==="TextFrame"){let c=ki.defaultTwoLayerData("phong"),h=typeof l.color=="string"?r.shared.colors[l.color]:l.color;c.layers[1].data.color={r:h.r,g:h.g,b:h.b},c.layers[1].data.alpha=l.alpha;let d=function(f){return f.replace(".typeface","").replace(/optimer/gi,"open sans").replace("space_mono","space mono").replace(/alma_mono/gi,"varela round").replace(/droid_sans_mono/gi,"noto sans mono").replace(/droid_sans|gentilis|gnomon_(simple|foreground)|helvetiker/gi,"roboto").replace(/droid_serif/gi,"roboto slab").replace("_sans"," sans").replace("crimson_text","crimson text").replace("medium_medium","medium").replace("fatface_fatface","fatface").replace("100hairline","thin").replace("200thin","extralight").replace("300light","light").replace("500medium","medium").replace("600semi","semibold").replace("800heavy","extrabold").replace("900black","black").replace(/bodoni_(11|16|24|36|48|72|96)([^_])/gi,"bodoni_$1_$2").replace(/bodoni_(11|16|24|36|48|72|96)/gi,"bodoni moda").replace(/(thin|hairline)(_regular)?/gi,"100").replace(/(extra|ultra)light(_regular)?/gi,"200").replace(/light(_regular)?/gi,"300").replace(/_book|_normal|_roman/gi,"_regular").replace(/medium(_regular)?/gi,"500").replace(/(semi|demi)bold(_regular)?/gi,"600").replace(/(extra|ultra)bold(_regular)?/gi,"800").replace(/bold(_regular)?/gi,"700").replace(/(black|heavy|fatface)(_regular)?/gi,"900").replace(/([1-9]00)_italic/gi,"$1italic").replace(/regularitalic/gi,"italic").replace(/regularitalic/gi,"italic").split(" ").map(g=>g.charAt(0).toUpperCase()+g.slice(1)).join(" ")}(l.font);r.shared.fonts[d]===void 0&&(r.shared.fonts[d]={name:d});let u={name:l.name,...Mn.defaultData,...Ha.defaultData,flatShading:!1,wireframe:!1,geometry:{...Ho.defaultData("TextGeometry"),width:l.width,height:l.height,font:d,depth:0,horizontalAlign:l.horizontalAlign,verticalAlign:l.verticalAlign,fontSize:1.40625*l.fontSize,lineHeight:l.lineHeight/1.40625,letterSpacing:l.letterSpacing-1,text:l.text,textTransform:l.textTransform,extrudeBevelSize:0,extrudeBevelSegments:1},material:c,states:ln(l.states),events:ln(l.events),visible:l.visible,raycastLock:l.raycastLock,position:l.position,rotation:l.rotation,scale:l.scale,hiddenMatrix:l.hiddenMatrix},p=ln(r.scene.objects).parent(a);r.scene.objects.insertAfter(p??null,a,[{id:a+"new",data:u,children:[]}]),s.push(a)}}),s.forEach(a=>{r.scene.objects.delete(a)})}(i),i.schema=20),n<21&&(function(r){let s={0:"MouseDown",1:"MouseUp",2:"MouseHover",5:"KeyDown",6:"KeyUp",7:"Start",9:"LookAt",10:"Follow",11:"Scroll",12:"Audio",13:"GameControl"};r.scene.objects.traverse((a,o)=>{o.events.forEach(l=>{if(s[Number(l.type)])if(Object.assign(l,{type:s[Number(l.type)]}),l.type==="Audio"&&"audioEvent"in l&&(Object.assign(l,{playAudio:l.audioEvent}),delete l.audioEvent),l.type==="GameControl")Object.assign(l,{gameActions:{idle:new Vt,move:new Vt,jump:new Vt}});else{let c=new Vt;Object.assign(l,{actions:c}),(l.type==="MouseDown"||l.type==="MouseUp"||l.type==="KeyDown"||l.type==="KeyUp")&&"url"in l&&c.push({fi:0,id:Ot.generateUUID(),data:{type:"Link",url:l.url,delay:0}}),"targets"in l&&(l.targets.forEach((h,d,u)=>{let p={easing:h.easing,duration:h.duration};h.easing===6?Object.assign(p,uc(h,"mass","stiffness","damping","velocity")):h.easing===5&&Object.assign(p,{control1:{...h.control1},control2:{...h.control2}});let f={repeat:h.repeat?-1:0,delay:h.delay,delayDirection:h.delayDirection,direction:h.cycle&&h.rewind?"pingpong-rewind":h.cycle?"pingpong":"normal"},g={state:h.state,...f,...p},m={allowSlerp:!0,type:"Transition",object:h.object,repeat:0,delay:0,delayDirection:void 0,direction:"normal",tweens:new Vt({fi:0,id:Ot.generateUUID(),data:{state:void 0,repeat:0,delay:0,delayDirection:void 0,direction:"normal",duration:0,easing:4}},{fi:1,id:Ot.generateUUID(),data:g})};c.push({fi:u,id:d,data:m})}),delete l.targets)}})})}(i),function(r){r.scene.objects.traverse((s,a)=>{function o(l,c){let h=new Vt,d=[];if(a.events.forEach((u,p,f)=>{if(u.type==="Audio"&&u.trigger===c){let g;d.push(p),u.interaction==="play"?g={...uc(u,"interaction","audio","delay","volume","loop"),triggerAfter:"after"in u?u.after:void 0,toggle:"after"in u?u.toggle:void 0,type:"Audio"}:(u.interaction==="pause"||u.interaction==="stop")&&(g={...uc(u,"interaction","delay","object","playAudio"),type:"Audio"}),g&&h.push({fi:f,id:p,data:g})}}),d.forEach(u=>a.events.delete(u)),h.length){let u=a.events.find(p=>p.type===l)?.data;u?"actions"in u&&u.actions.insertBefore(null,h):a.events.insertBefore(null,[{id:Ot.generateUUID(),data:{type:l,actions:h}}])}}o("Start","start"),o("MouseDown","mouseDown"),o("MouseUp","mouseUp"),o("KeyDown","keyDown"),o("KeyUp","keyUp")})}(i),i.schema=21),n<22&&(pO(i),i.schema=22),n<23&&(function(r){r.scene.objects.traverse((s,a)=>{a.type==="Mesh"&&a.geometry.type==="SubdivGeometry"&&(a.geometry.scaleBaked||(a.geometry.scaleBaked=[1,1,1]))})}(i),i.schema=23),n<24&&(function(r){r.scene.objects.traverse((s,a)=>{(a.type==="Empty"||a.type==="Mesh")&&a.cloner&&!a.cloner.randomnessObject&&!a.cloner.toObject&&!a.cloner.randomness&&(a.cloner={...a.cloner,toObject:{object:"",spreadType:"random",scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],axis:"x",seed:0,count:99,align:"normal"},randomness:!1,randomnessObject:{strength:100,scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],movement:1,seed:0,freqScale:10,noiseType:"perlin"}})})}(i),i.schema=24),(n<25||i.shared.videos===void 0)&&(function(r){r.shared.videos=Er({},te.prototype)}(i),n<25&&(i.schema=25)),n<26&&(function(r){r.scene.objects.traverse((s,a)=>{let o=r.scene.objects.unproxy().parent(s);if(o){let l=ln(r.scene.objects.data(o));l&&l.type==="Mesh"&&l.geometry.type==="BooleanGeometry"&&a.type==="Mesh"&&(a.visible=ln(a).booleanExclude!==!0)}})}(i),i.schema=26),n<27&&(function(r){r.scene.objects.traverse((s,a)=>{if(a.type==="Mesh"){let o=a;a.geometry.type==="NonParametricGeometry"?o.material!==void 0&&delete o.material:o.materials!==void 0&&delete o.materials}})}(i),i.schema=27),n<28&&(pO(i),i.schema=28),n<29&&(function(r){function s(o){Object.setPrototypeOf(o,fn.prototype),o.texture&&Object.setPrototypeOf(o.texture,fn.prototype)}function a(o){Object.setPrototypeOf(o,fn.prototype);for(let l in o)s(o[l])}r.scene.objects.traverse((o,l)=>{l.states.forEach(c=>{let h=c;if(h.material){let d=ln(h.material).layers;a(d),h.material.layers=d}if(h.materials)for(let d=0;d<h.materials.length;d++){let u=h.materials[d],p=ln(u).layers;a(p),u.layers=p}})})}(i),i.schema=29),n<30&&(function(r){r.scene.objects.traverse((s,a)=>{a.type==="Mesh"&&a.geometry.type==="NonParametricGeometry"&&!("material"in a)&&!("materials"in a)&&(a.material=ki.defaultTwoLayerData("phong"))})}(i),i.schema=30),n<31&&(function(r){r.scene.publish.orbitControls.autoZoom===void 0&&(r.scene.publish.orbitControls.autoZoom=!1),r.scene.objects.traverse((s,a)=>{(a.type==="OrthographicCamera"||a.type==="PerspectiveCamera")&&(a.orthographic.autoZoom===void 0&&(a.orthographic.autoZoom=!1),a.orthographic.autoZoomFrustumSize===void 0&&(a.orthographic.autoZoomFrustumSize=790))})}(i),i.schema=31),n<33&&(function(r){r.scene.objects.traverse((s,a)=>{a.pathSnapping===void 0&&(a.pathSnapping={pathId:null,slide:0,offset:0,orientation:"tangential"}),a.pathSnapping.offset===void 0&&(a.pathSnapping.offset=0)})}(i),i.schema=33),n<34&&(function(r){r.scene.publish.mouseEventTarget===void 0&&(r.scene.publish.mouseEventTarget="canvas"),r.scene.publish.settings.web.hint===void 0&&(r.scene.publish.settings.web.hint=!1)}(i),i.schema=34),n<35&&(function(r){let{video:s}=r.scene.publish.settings;s.format==="gif"&&s.fps>48&&(s.fps=15)}(i),i.schema=35),n<36&&(function(r){r.scene.objects.traverse((s,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&(o.resetYPosition=Math.abs(o.resetYPosition-a.position[1]))})})}(i),i.schema=36),n<37&&(function(r){let s=r.scene.environment.usePhysics;r.scene.objects.traverse((a,o)=>{s&&o.physics===null?o.collision=!1:o.collision="visibility"})}(i),i.schema=37),n<38&&(No(i,dO),Fo(i,dO),i.schema=38),n<39&&(function(r){r.scene.objects.traverse((s,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&(o.navmesh=j_.defaultDataThirdPerson.navmesh)})})}(i),i.schema=39),n<40&&(function(r){r.scene.styles||(r.scene.styles=bc.defaultData())}(i),i.schema=40),n<41&&(function(r){r.scene.environment.ambientLight.occlusion===void 0&&(r.scene.environment.ambientLight.occlusion=!1),r.scene.environment.ambientLight.aoFullRes===void 0&&(r.scene.environment.ambientLight.aoFullRes=!1),r.scene.environment.ambientLight.radius===void 0&&(r.scene.environment.ambientLight.radius=256),r.scene.environment.ambientLight.bias===void 0&&(r.scene.environment.ambientLight.bias=.5),r.scene.environment.ambientLight.aoColor===void 0&&(r.scene.environment.ambientLight.aoColor={r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}),No(r,fO),Fo(r,fO)}(i),i.schema=41),n<42&&(function(r){r.scene.objects.traverse((s,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&Object.assign(o.gameActions,{run:new Vt})})})}(i),i.schema=42),n<43&&(function(r){r.scene.objects.traverse((s,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&(o.keyAssignments=[...o.keyAssignments,["run","\u21E7"],["none","Ctrl"]])})})}(i),i.schema=43),n<99){No(i,mO),Fo(i,mO),i.scene.publish.playCamera===null&&(i.scene.publish.playCamera=Yc);let r=ln(i.scene.objects),s=i.scene.objects;i.scene.publish.playPage=Wu,s.insertBefore(null,null,[{id:Wu,data:{...Ic.defaultData,backgroundColor:i.scene.backgroundColor,fog:i.scene.fog,postprocessing:i.scene.postprocessing,ao:uc(i.scene.environment.ambientLight,"occlusion","aoFullRes","radius","bias","aoColor"),publish:{playCamera:i.scene.publish.playCamera,gameControlObject:i.scene.publish.gameControlObject},shadow:uc(i.scene.environment.ambientLight,"softShadowQuality"),globalPhysics:{...$u.defaultData,...uc(i.scene.environment,"usePhysics","gravity")},camera:ln(i.scene.ownerCamera)??Ic.defaultData.camera,name:"Scene"},children:[]}]);for(let l of r)l.id!==xc.TRASH_CAN_ID&&s.move(Wu,l.fi,l.id);let a=0,o=0;i.shared.penumbraSize&&i.scene.objects.traverse((l,c)=>{c.type==="DirectionalLight"?(c.penumbraSize=i.shared.penumbraSize[Math.min(a,2)],a+=1):c.type==="SpotLight"&&(c.penumbraSize=i.shared.penumbraSize[3+Math.min(o,1)],o+=1),(c.physics===void 0||c.physics===null)&&c.type!=="Instance"&&(c.physics={},Object.assign(c.physics,Xu.defaultData)),c.physics!==void 0&&c.physics!==null&&(c.physics.enabled=c.collision??"visibility",delete c.collision)}),i.schema=99}}(t,e),e<100&&(t.scene.publish.joystickSizeAndXYOffset===void 0&&(t.scene.publish.joystickSizeAndXYOffset=Jo.defaultData.joystickSizeAndXYOffset),t.schema=100),e<101&&(No(t,gO),Fo(t,gO),t.schema=101),e<102&&(function(i){i.scene.objects.traverse((n,r)=>{let s=r.geometry;s&&s.type==="PathGeometry"&&(s.extrusion.capType="flat",s.extrusion.bevel=50,s.extrusion.bevelSides=6,s.extrusion.shape.type==="Custom"&&(s.extrusion.shape.shapeQuality="low"))})}(t),t.schema=102),e<104&&(t.shared.catelogs=new te,t.shared.lib=Wo.defaultData(),t.schema=104),e<105&&(function(i){i.shared.variables=Er({},te.prototype)}(t),t.scene.objects.traverse((i,n)=>{ZF(n)}),t.schema=105);for(let i of Object.values(t.shared.lib.components))KF(i);e<106&&(function(i){let n=ln(i.shared.variables);i.shared.variables=Er(Object.entries(n??{}).map(([r,s],a)=>({fi:a,id:r,data:s})),Vt.prototype)}(t),t.schema=106),e<107&&(t.shared.lib.variables=Wo.defaultData().variables,t.schema=107),e<109&&(function(i){i.shared.particles=Er({},te.prototype),i.shared.lib&&(i.shared.lib.particles=Wo.defaultData().particles)}(t),t.schema=109),e<110&&(function(i){i.scene.objects.traverse((n,r)=>{r.type==="Particle"&&typeof r.renderMaterial.size=="number"&&Object.assign(r.renderMaterial,{size:[r.renderMaterial.size,r.renderMaterial.size]})})}(t),t.schema=110),e<111&&(t.scene.objects.traverse((i,n)=>{(function(r){Array.isArray(ln(r.events))&&r.events?.forEach(s=>{"disabled"in s||(s.disabled=!1),(s.type==="MouseDown"||s.type==="MouseUp"||s.type==="MousePress")&&(s.mode=s.mode||"Object")})})(n)}),t.schema=111),e<112&&(function(i){i.scene.objects.traverse((n,r)=>{r.type==="Page"&&(r.postprocessing.depthOfField.focusDistance=100,r.postprocessing.depthOfField.focalLength=20,r.postprocessing.depthOfField.bokehScale=5)})}(t),t.schema=112),e<113&&(function(i){i.scene.objects.traverse((n,r)=>{Array.isArray(ln(r.events))!==!1&&r.events?.forEach(s=>{let a=s.runMode;s.type==="MouseDown"||s.type==="MouseUp"||s.type==="KeyDown"||s.type==="KeyUp"||s.type==="Collision"||s.type==="Trigger"?s.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode=a??"Repeat"),(o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode=a==="Toggle"?"Toggle":"Normal")}):s.type==="MouseHover"||s.type==="MousePress"||s.type==="KeyPress"?s.actions?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Toggle")}):s.type==="GameControl"?(delete s.actions,Object.keys(s.gameActions).forEach(o=>{s.gameActions[o]?.forEach(l=>{l.type==="Transition"&&(l.runMode="Repeat"),l.type==="Animation"&&(l.runMode="Normal")})})):s.type==="DragDrop"?(delete s.actions,s.dragDropActions?.drag?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Toggle")}),s.dragDropActions?.drop?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Toggle")})):s.type==="Resize"?(delete s.actions,s.breakpoints?.forEach(o=>{o.actions?.forEach(l=>{(l.type==="Transition"||l.type==="Animation"||l.type==="SwitchCamera")&&(l.runMode="Toggle")})})):s.type==="Start"?s.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Once"),(o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Normal")}):s.type==="VariableChange"||s.type==="Scroll"?s.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Normal")}):s.type==="Conditional"&&(delete s.actions,s.inActions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Normal")}),s.outActions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Normal")}))})})}(t),t.schema=113),e<114&&(t.scene.publish.settings.web.imageQuality===void 0&&(t.scene.publish.settings.web.imageQuality=70),t.schema=114),e<115&&(function(i){i.shared.userAPIs=Er({},te.prototype),i.shared.userWebhooks=Er({},te.prototype),i.shared.lib&&(i.shared.lib.userAPIs=Wo.defaultData().userAPIs,i.shared.lib.userWebhooks=Wo.defaultData().userWebhooks)}(t),t.schema=115),e<116&&(function(i){i.scene.publish.settings.videoStatic===void 0&&(i.scene.publish.settings.videoStatic=Jo.defaultData.settings.videoStatic)}(t),t.schema=116),e<117&&(t.scene.publish.settings.web.pixelRatioMobile===void 0&&(t.scene.publish.settings.web.pixelRatioMobile=0),t.scene.publish.settings.web.pixelRatioDesktop===void 0&&(t.scene.publish.settings.web.pixelRatioDesktop=0),t.schema=117),e<118&&(t.shared.timelineAnimations=Er({},te.prototype),t.scene.objects.traverse((i,n)=>{JF(n)}),t.schema=118),e<119&&(t.scene.publish.settings.videoStatic.format=Yu.defaultData.scene.publish.settings.videoStatic.format,t.scene.publish.settings.videoStatic.imageFormat=Yu.defaultData.scene.publish.settings.videoStatic.imageFormat,t.schema=119),e<120&&(t.scene.publish.settings.image.colorSpace="display-p3",t.scene.publish.settings.videoStatic.colorSpace="display-p3",t.schema=120),e<121&&(t.scene.objects.traverse((i,n)=>{nA(n),n.type==="Page"&&n.camera!==void 0&&nA(n.camera)}),t.schema=121),e<122&&(delete t.scene.publish.settings.video,t.scene.publish.orbitControls.rotationSpeed=Yu.defaultData.scene.publish.orbitControls.rotationSpeed,t.schema=122),e<123&&(t.scene.objects.traverse((i,n)=>{n.type==="Page"&&n.sky===void 0&&(n.sky=kl.defaultData)}),t.schema=123),e<124&&(e>=123&&t.scene.objects.traverse((i,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&(typeof r.exposure=="number"&&(r.exposure=Math.round(r.exposure/5e-4*1e4)/1e4),r.lighting===void 0&&(r.lighting=kl.defaultData.lighting))}),t.schema=124),e<125&&(t.scene.objects.traverse((i,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&r.lightingIntensity===void 0&&(r.lightingIntensity=kl.defaultData.lightingIntensity)}),t.schema=125),e<126&&(t.scene.objects.traverse((i,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&(r.mode===void 0&&(r.mode="physical"),r.hdri===void 0?r.hdri={...kl.defaultData.hdri}:(r.hdri.blur===void 0&&(r.hdri.blur=kl.defaultData.hdri.blur),Array.isArray(r.hdri.rotation)&&(r.hdri.rotation=r.hdri.rotation[1]??0)))}),t.schema=126),e<127&&(t.scene.objects.traverse((i,n)=>{let r=n.sky;n.type==="Page"&&r?.hdri!==void 0&&r.hdri.showBackground===void 0&&(r.hdri.showBackground=!0)}),t.schema=127),e<128&&(t.scene.objects.traverse((i,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&r.lightingQuality===void 0&&(r.lightingQuality="full")}),t.schema=128),e<129&&(t.scene.objects.traverse((i,n)=>{if(n.type==="Page"){n.camera===void 0&&(n.camera=Ic.defaultData.camera);let r=n.camera;r.far=1e5,r.perspective?r.perspective.near=70:r.perspective={near:70,fov:45,zoom:1}}}),t.schema=129),e<130&&(QF(t,G_),t.schema=130),e<131&&(function(i){i.scene.objects.traverse((n,r)=>{let s=r.states;if(!s)return;let a=r.timelineAnimations,o=[];s.forEach((l,c)=>{(l.isAnimation||a?.[c])&&o.push(c)}),o.forEach(l=>s.delete(l))})}(t),function(i){let n=i.shared,r=n.timelineAnimations;if(!r)return;let s=i.scene.objects,a=s.unproxy().find(o=>o.data.type==="Page")?.id;for(let[o,l]of Object.entries(r)){let c=Er({},te.prototype),h=0,d=Boolean(l.loop);for(let[f,g]of Object.entries(l.mapping??{})){let m=s.data(f)?.timelineAnimations?.[g];!m||(h=Math.max(h,m.to??0),d=d||Boolean(m.loop),c[f]={id:f,keyframes:TX(m.properties?.unproxy())})}let u=l.page??a,p=u?s.data(u):void 0;p&&p.type==="Page"&&((p.timelines??(p.timelines=Er({},te.prototype)))[o]={id:o,name:l.name,duration:h||5,...d?{loop:d}:{},objectTimelines:c})}delete n.timelineAnimations,s.traverse((o,l)=>{delete l.timelineAnimations})}(t),yO(t,CX),yO(t,RX),t.schema=131)}}kg(YF,{updateAllMaterials:()=>QF,updateDocumentSchema:()=>OX,updateLibSchema:()=>IX,updateMaterialSchema:()=>EX,updateObjectStateRec:()=>Ou,updateObjectsSchema:()=>KF,updateTextValues:()=>MX});var _c,tN,_O,sv,pS,bO,av,wc,Pf,Id,ov,fS,h1,mS,gS,xO,c1,vS,Bc,rA,Hb=F(()=>{et(),qF(),Ye(),$F(),SX(),Gb(),Gg(),ar(),CC(),jb(),MC(),_c=180/Math.PI,tN=["position","rotation","scale","shape size"]}),LX=F(()=>{var t,e,i;_s(),Ye(),ar(),(_O||(_O={})).is=function(n){return!0},(t=sv||(sv={})).defaultData={position:[0,0],scale:[1,1],rotation:0,shear:[0,0]},t.merge=function(n,r){return{position:r?.position??n.position,rotation:r?.rotation??n.rotation,scale:r?.scale??n.scale,shear:r?.shear??n.shear}},t.diff=function(n,r){return hF({position:Ja.isEqual(n.position,r.position)?void 0:r.position,rotation:n.rotation===r.rotation?void 0:r.rotation,scale:Ja.isEqual(n.scale,r.scale)?void 0:r.scale,shear:n.shear&&r.shear&&Ja.isEqual(n.shear,r.shear)?void 0:r.shear})},(pS||(pS={})).defaultData={horizontalConstraint:0,verticalConstraint:0},(bO||(bO={})).defaultData={direction:"row",wrap:"unwrap",align:"top-left",gap:10,rowGap:10,autoGap:!1,autoRowGap:!1,leftPadding:8,rightPadding:8,topPadding:8,bottomPadding:8},(av||(av={})).defaultData={opacity:1,fill:{color:Je.fromHexAndA(Rr,1),enabled:!0},stroke:{color:Je.from0to1([0,0,0,1]),thickness:1,enabled:!1,mode:"inside"},layerBlur:{radius:2,enabled:!1},backgroundBlur:{radius:2,enabled:!1},dropShadow:{offset:[10,10],blurRadius:10,color:Je.from0to1([0,0,0,1]),enabled:!1,spread:0},innerShadow:{offset:[10,10],blurRadius:10,color:Je.from0to1([0,0,0,1]),enabled:!1,spread:0}},(e=wc||(wc={})).newEmpty=function(n,r){return{name:r}},e.patch=function(n,r){if(r===void 0)return n;let s={...n};return Object.assign(s,sv.merge(s,r)),s=function(a,o){if(o===void 0)return a;let l={...a},c=["width","height","cornerRadius"];for(let h of c)h in l&&h in o&&o[h]!==void 0&&Object.assign(l,{[h]:o[h]});return l}(s,r),s=function(a,o){if(o===void 0)return a;let l={...a};return"fill"in l&&"fill"in o&&o.fill!==void 0&&Object.assign(l,{fill:{...l.fill,...o.fill}}),"stroke"in l&&"stroke"in o&&o.stroke!==void 0&&Object.assign(l,{stroke:{...l.stroke,...o.stroke}}),"layerBlur"in l&&"layerBlur"in o&&o.layerBlur!==void 0&&Object.assign(l,{layerBlur:{...l.layerBlur,...o.layerBlur}}),"backgroundBlur"in l&&"backgroundBlur"in o&&o.backgroundBlur!==void 0&&Object.assign(l,{backgroundBlur:{...l.backgroundBlur,...o.backgroundBlur}}),"dropShadow"in l&&"dropShadow"in o&&o.dropShadow!==void 0&&Object.assign(l,{dropShadow:{...l.dropShadow,...o.dropShadow}}),"innerShadow"in l&&"innerShadow"in o&&o.innerShadow!==void 0&&Object.assign(l,{innerShadow:{...l.innerShadow,...o.innerShadow}}),l}(s,r),s},e.toOps=function(n,r){let s,a=[];for(let[o,l]of Object.entries(r))o!=="name"&&(s===void 0&&(s={path:[],props:{},type:0},a.push(s)),s.props[o]=l);return a},(Pf||(Pf={})).defaultData={...sv.defaultData,...pS.defaultData,states:new Vt,events:new Vt,visible:!0,raycastLock:!1},(Id||(Id={})).defaultData={...Pf.defaultData,...av.defaultData},(ov||(ov={})).defaultData={cornerRadius:[0,0,0,0]},(fS||(fS={})).defaultData={...Id.defaultData,type:"ellipse2d",width:100,height:100,name:"Ellipse"},(h1||(h1={})).defaultData={...Id.defaultData,...ov.defaultData,type:"rectangle2d",width:100,height:100,name:"Rectangle"},(mS||(mS={})).defaultData={...Id.defaultData,type:"text2d",width:100,height:100,fontSize:12,lineHeight:1.2,letterSpacing:0,text:{textValue:"Hello world"},horizontalAlign:1,verticalAlign:1,textTransform:1,font:"Roboto_regular",name:"Text"},(gS||(gS={})).defaultData={...Id.defaultData,type:"path2d",path:"",name:"Path"},(xO||(xO={})).is=function(n){return n.type==="ellipse2d"||n.type==="rectangle2d"||n.type==="text2d"||n.type==="vector2d"||n.type==="path2d"},(c1||(c1={})).defaultData={...Pf.defaultData,name:"Group",type:"group2d"},(vS||(vS={})).defaultData=()=>({...Pf.defaultData,...ov.defaultData,...av.defaultData,name:"Frame",type:"frame2d",clipped:!0,width:200,height:200,fill:{color:Je.fromHexAndA(4737101,1),enabled:!0},stroke:{color:Je.fromHexAndA(0,1),thickness:1,enabled:!1,mode:"inside"},backgroundBlur:{radius:2,enabled:!1},layerBlur:{radius:2,enabled:!1}}),(n=>{n.defaultData=function(r){switch(r){case"rectangle2d":case"vector2d":return{...h1.defaultData};case"ellipse2d":return{...fS.defaultData};case"text2d":return{...mS.defaultData};case"path2d":return{...gS.defaultData};case"frame2d":return{...vS.defaultData()};case"group2d":return{...c1.defaultData}}},n.getPivot=function(r){return"width"in r&&"height"in r?[typeof r.width=="number"?.5*r.width:0,typeof r.height=="number"?.5*r.height:0]:[0,0]},n.isResizeable=function(r){return r.type==="rectangle2d"||r.type==="ellipse2d"||r.type==="text2d"||r.type==="frame2d"},n.isAutoLayoutable=function(r){return r.type==="frame2d"&&r.autoLayout!==void 0},n.hasCorners=function(r){return r.type==="rectangle2d"||r.type==="frame2d"}})(Bc||(Bc={})),(i=rA||(rA={})).defaultData={name:"UI",type:"scene2d",objects:new Wn},i.emptyData=function(){return{type:"scene2d",objects:new Wn}}}),BX=F(()=>{vX(),yX(),OF(),LF(),qF(),PF(),wX(),NF(),jF(),MC(),Hb(),WF(),SC(),wC(),BF(),Gg(),FF(),GF(),_s(),Gb(),jb(),AC(),VF(),CC(),TC(),_X(),kF(),PC(),EC(),UF(),zF(),LX()});function Sc(t,e=!1){let i=t[0].index!==null,n=new Set(Object.keys(t[0].attributes)),r=new Set(Object.keys(t[0].morphAttributes)),s={},a={},o=t[0].morphTargetsRelative,l=new Gt,c=0;for(let h=0;h<t.length;++h){let d=t[h],u=0;if(i!==(d.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let p in d.attributes){if(!n.has(p))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+'. All geometries must have compatible attributes; make sure "'+p+'" attribute exists among all geometries, or in none of them.'),null;s[p]===void 0&&(s[p]=[]),s[p].push(d.attributes[p]),u++}if(u!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". Make sure all geometries have the same number of attributes."),null;if(o!==d.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let p in d.morphAttributes){if(!r.has(p))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphAttributes must be consistent throughout all geometries."),null;a[p]===void 0&&(a[p]=[]),a[p].push(d.morphAttributes[p])}if(e){let p;if(i)p=d.index.count;else{if(d.attributes.position===void 0)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". The geometry must have either an index or a position attribute"),null;p=d.attributes.position.count}l.addGroup(c,p,h),c+=p}}if(i){let h=0,d=[];for(let u=0;u<t.length;++u){let p=t[u].index;for(let f=0;f<p.count;++f)d.push(p.getX(f)+h);h+=t[u].attributes.position.count}l.setIndex(d)}for(let h in s){let d=wO(s[h]);if(!d)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+h+" attribute."),null;l.setAttribute(h,d)}for(let h in a){let d=a[h][0].length;if(d!==0){l.morphAttributes=l.morphAttributes||{},l.morphAttributes[h]=[];for(let u=0;u<d;++u){let p=[];for(let g=0;g<a[h].length;++g)p.push(a[h][g][u]);let f=wO(p);if(!f)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+h+" morphAttribute."),null;l.morphAttributes[h].push(f)}}}return l}function wO(t){let e,i,n,r=-1,s=0;for(let c=0;c<t.length;++c){let h=t[c];if(e===void 0&&(e=h.array.constructor),e!==h.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(i===void 0&&(i=h.itemSize),i!==h.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=h.normalized),n!==h.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(r===-1&&(r=h.gpuType),r!==h.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=h.count*i}let a=new e(s),o=new Ht(a,i,n),l=0;for(let c=0;c<t.length;++c){let h=t[c];if(h.isInterleavedBufferAttribute){let d=l/i;for(let u=0,p=h.count;u<p;u++)for(let f=0;f<i;f++){let g=h.getComponent(u,f);o.setComponent(u+d,f,g)}}else a.set(h.array,l);l+=h.count*i}return r!==void 0&&(o.gpuType=r),o}var Hg=F(()=>{et()});function eN(t){let e=t.points.length/7,i=new Vt;for(let n=0;n<e;n++){let r=7*n,s=t.points[r+0],a=t.points[r+1],o=t.points[r+2],l=t.points[r+3],c=t.points[r+4],h=t.points[r+5],d=t.points[r+6];i.push({fi:n,id:Ot.generateUUID(),data:{roundness:d,position:[s,a],areControlsDirectionsMirrored:!0,controlPrevious:{position:[o,l]},controlNext:{position:[c,h]}}})}return{points:i,isClosed:t.isClosed,roundness:t.roundness,shapeHoles:t.shapeHoles?.map(n=>eN(n))??[]}}function iN(t){let{userData:e,uuid:i,...n}=t;if(e===void 0||e.type==="NonParametricGeometry")return function(a){let o,{userData:l,data:c}=a,h=c?.groups,d=c?.attributes??{},u=c?.morphAttributes??{},p=c?.interleavedBuffers,f=c?.arrayBuffers,g=c?.index;d.position!==void 0&&Array.isArray(d.position.array)&&(o=function(y){let v=1/0,_=1/0,b=1/0,x=-1/0,w=-1/0,S=-1/0;for(let A=0;A<y.length;A+=3){let E=y[A],P=y[A+1],T=y[A+2];v=Math.min(v,E),_=Math.min(_,P),b=Math.min(b,T),x=Math.max(x,E),w=Math.max(w,P),S=Math.max(S,T)}return{width:x-v,height:w-_,depth:S-b}}(d.position.array));let m={...l===void 0?{}:l.parameters,data:{attributes:d,morphAttributes:u,interleavedBuffers:p,arrayBuffers:f},...o===void 0?{}:o,type:"NonParametricGeometry"};return g!==void 0&&Object.assign(m.data,{index:g}),h!==void 0&&Object.assign(m.data,{groups:h.map(y=>({...y,materialIndex:y.materialIndex??0}))}),m}(t);if(e.type==="SubdivGeometry"){let a="SubdivGeometry",o=n.data?.attributes;if(o?.positionWASM===void 0){let c=new Gt;if(o?.position===void 0||o?.faceMap===void 0)return null;let h=o.position.array,d=o.faceMap.array,u=n.data.index.array;c.setAttribute("position",new Nt(h,3)),c.setIndex(new nh(u,1));let p=function(y,v=1e-4){v=Math.max(v,Number.EPSILON);let _={},b=y.getIndex(),x=y.getAttribute("position"),w=b?b.count:x.count,S=0,A=Object.keys(y.attributes),E={},P={},T=[],R=["getX","getY","getZ","getW"],L=["setX","setY","setZ","setW"];for(let $=0,nt=A.length;$<nt;$++){let Q=A[$],rt=y.attributes[Q];E[Q]=new rt.constructor(new rt.array.constructor(rt.count*rt.itemSize),rt.itemSize,rt.normalized);let gt=y.morphAttributes[Q];gt&&(P[Q]||(P[Q]=[]),gt.forEach((at,ht)=>{let ct=new at.array.constructor(at.count*at.itemSize);P[Q][ht]=new at.constructor(ct,at.itemSize,at.normalized)}))}let D=.5*v,U=Math.log10(1/v),V=Math.pow(10,U),k=D*V;for(let $=0;$<w;$++){let nt=b?b.getX($):$,Q="";for(let rt=0,gt=A.length;rt<gt;rt++){let at=A[rt],ht=y.getAttribute(at),ct=ht.itemSize;for(let q=0;q<ct;q++)Q+=~~(ht[R[q]](nt)*V+k)+","}if(Q in _)T.push(_[Q]);else{for(let rt=0,gt=A.length;rt<gt;rt++){let at=A[rt],ht=y.getAttribute(at),ct=y.morphAttributes[at],q=ht.itemSize,lt=E[at],z=P[at];for(let O=0;O<q;O++){let j=R[O],Z=L[O];if(lt[Z](S,ht[j](nt)),ct)for(let I=0,G=ct.length;I<G;I++)z[I][Z](S,ct[I][j](nt))}}_[Q]=S,T.push(S),S++}}let Y=y.clone();for(let $ in y.attributes){let nt=E[$];if(Y.setAttribute($,new nt.constructor(nt.array.slice(0,S*nt.itemSize),nt.itemSize,nt.normalized)),$ in P)for(let Q=0;Q<P[$].length;Q++){let rt=P[$][Q];Y.morphAttributes[$][Q]=new rt.constructor(rt.array.slice(0,S*rt.itemSize),rt.itemSize,rt.normalized)}}return Y.setIndex(T),Y}(c),f=[],g=new Array(d[d.length-1]+1).fill(3),m=p.getIndex().array;for(let y=0,v=d.length;y<v;)d[y]===d[y+1]?(g[d[y]]++,f.push(...new Set(m.slice(3*y,3*y+6))),y+=2):(f.push(...m.slice(3*y,3*y+3)),y++);o.indexWASM={array:f},o.positionWASM=p.attributes.position,o.verticesPerFaceWASM={array:g}}if(o?.positionWASM===void 0||o?.positionWASM.length===0||o?.indexWASM===void 0||o?.indexWASM.length===0||o?.verticesPerFaceWASM===void 0||o?.verticesPerFaceWASM.length===0)return null;let l={type:a,...UX(o.positionWASM.array)};l.subdivisions=e.parameters.subdivisions;for(let c in o)c==="positionWASM"?l[c]=new Float32Array(o[c].array):c==="indexWASM"?l[c]=new Int32Array(o[c].array):c==="verticesPerFaceWASM"&&(l[c]=new Int8Array(o[c].array));return l.scaleBaked=[1,1,1],l}let r=e.type,s=e.parameters;return r==="VectorGeometry"?(s.extrudeDepth&&(s.depth=s.extrudeDepth),{...s,width:100,height:100,shape:eN(e.shape),type:r}):r==="LatheGeometry"?{...e.parameters,type:r,points:(e?.parameters.points??[]).map(a=>[a.x,a.y])}:(s.extrudeDepth&&(s.depth=s.extrudeDepth),{...s,type:r})}function UX(t){return sA.setFromArray(t),sA.getSize(Cm),{width:Cm.x,height:Cm.y,depth:Cm.z}}var sA,Cm,nN,il,rg,rN,_p,Df,lv,yS,bp,SO,_S,MO,bS,up,wl,Sl,Eo,xS,EO,AO,wS,aA,tl,zX=F(()=>{Ye(),et(),Hg(),new At,new $t,new Ei,new C,new C,sA=new ci,Cm=new C}),FX=F(()=>{}),NX=F(()=>{Ye(),Hb()}),kX=F(()=>{Gg(),[...Vb],new Set(bC)}),Yt=F(()=>{BX(),FX(),xX(),Hb(),NX(),$F(),kX(),PC(),Ye()}),sl=F(()=>{nN=[3,4,8,9],il=5,rg=3,rN=32}),Wg=F(()=>{et(),_p=t=>{var e;return(e=class extends t{}).geometryHelper=new ga(30,30,30),e}}),qg=F(()=>{et(),Df=new $o,lv=new vr,yS=new At,bp=(t,e,i,n,r=!1,s=t)=>{let a=e,o=s.matrixWorld;if(a.boundingSphere===null&&a.computeBoundingSphere(),lv.copy(a.boundingSphere),lv.applyMatrix4(o),i.ray.intersectsSphere(lv)===!1||(yS.copy(o).invert(),Df.copy(i.ray).applyMatrix4(yS),a.boundingBox!==null&&Df.intersectsBox(a.boundingBox)===!1))return;let l,c,h,d,u,p,f=a.index,g=a.attributes.position,m=a.drawRange;if(r===!1){for(u=Math.max(0,m.start),p=Math.min(f.count,m.start+m.count);u<p;u+=3)if(c=f.getX(u),h=f.getX(u+1),d=f.getX(u+2),l=y(t,i,Df,g,c,h,d),l)return l.faceIndex=Math.floor(u/3),void n.push(l)}else{let v=a.attributes.position,_=new C,b=new C,x=new C,w=new C,S=2,A=1/((s.scale.x+s.scale.y+s.scale.z)/3),E=A*A;for(let P=Math.max(0,m.start),T=Math.min(v.count,m.start+m.count)-1;P<T;P+=S){if(_.fromBufferAttribute(v,P),b.fromBufferAttribute(v,P+1),Df.distanceSqToSegment(_,b,w,x)>E)continue;w.applyMatrix4(s.matrixWorld);let R=i.ray.origin.distanceTo(w);R<i.near||R>i.far||n.push({distance:R,point:x.clone().applyMatrix4(s.matrixWorld),object:t})}}function y(v,_,b,x,w,S,A){let E=new C,P=new C,T=new C,R=new C,L=new C;if(E.fromBufferAttribute(x,w),P.fromBufferAttribute(x,S),T.fromBufferAttribute(x,A),b.intersectTriangle(E,P,T,!1,R)===null)return null;L.copy(R),L.applyMatrix4(v.matrixWorld);let D=_.ray.origin.distanceTo(L);return D<_.near||D>_.far?null:{faceIndex:1,distance:D,point:L.clone(),object:v}}}}),Wb=F(()=>{et(),Wg(),qg(),SO=new C(1,1,1),_S=new C,MO=new C,bS=new $t,up=class extends _p(Dz){constructor(t,e=15){super(e),this.object=t,this.dummy=new vp,this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${t.uuid}`,this.matrix=this.dummy.matrixWorld,this.matrixAutoUpdate=!1,this.object.isBone&&(this.visible=!1)}raycast(t,e){bp(this.object,up.geometryHelper,t,e,!1,this.dummy)}update(){}updateMatrix(){}updateMatrixWorld(t){this.object.matrixWorld.decompose(_S,bS,MO),this.matrix.compose(_S,bS,SO),super.updateMatrixWorld(t)}updateWorldMatrix(t,e){}}}),VX=F(()=>{et(),wl=new C,Sl=new C,Eo=new At,xS=[new C(-1,1,1),new C(-1,-1,1),new C(1,-1,1),new C(1,1,1),new C(-1,1,-1),new C(-1,-1,-1),new C(1,-1,-1),new C(1,1,-1)],EO=[[0,3],[1,2],[5,6],[4,7],[0,1],[3,2],[7,6],[4,5],[0,4],[1,5],[2,6],[3,7]],AO=[[0,2],[7,5],[4,1],[3,6],[4,3],[1,6]],wS=(t,e,i)=>{t.updateEntityBoxSize(wl,Sl),Eo.copy(e).multiply(t.matrixWorld),Sl.x===0&&Sl.y===0&&Sl.z===0?i.push(new C(wl.x,wl.y,wl.z).applyMatrix4(Eo)):xS.forEach(n=>{i.push(n.clone().multiply(Sl).add(wl).applyMatrix4(Eo))})},aA=class extends ci{constructor(){super(...arguments),this.matrix=new At,this.vertices=[],this.faces=[],this.edges=[],this.centerEdges=[]}copy(t){return super.copy(t),this.matrix.copy(t.matrix),this.vertices=t.vertices.map(e=>e.clone()),this.faces=t.faces.map(e=>e.clone()),this.edges=t.edges.map(e=>e.clone()),this.centerEdges=t.centerEdges.map(e=>e.clone()),this}setFromObjectSize(t,e=!1){t.updateWorldMatrix(!1,e),this.makeEmpty(),this.matrix.copy(t.matrixWorld);let i=new At().copy(t.matrixWorld).invert();return this.expandByObjectSize(t,i,e)}expandByObjectSize(t,e,i=!1){let n=[];if(i===!0){let r=[];t.traverseEntity(s=>{if(s.visible||s.cloner&&s.data.visible){if(!("geometry"in s))return Eo.copy(e).multiply(s.matrixWorld),void r.push(new C().applyMatrix4(Eo));wS(s,e,n)}}),n.length===0&&n.push(...r)}else wS(t,e,n);return this.setFromPoints(n)}getCenter(t){return(t=super.getCenter(t)).applyMatrix4(this.matrix),t}getPositionToCenter(t){return(t=super.getCenter(t)).applyMatrix4(Eo.copy(this.matrix).setPosition(0,0,0)),t}computeVertices(){this.getSize(Sl).multiplyScalar(.5),this.getCenter(wl),Eo.copy(this.matrix).setPosition(wl),this.vertices=xS.map(t=>t.clone().multiply(Sl).applyMatrix4(Eo))}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=EO.map(([t,e])=>new vs(this.vertices[t],this.vertices[e])),this.centerEdges=this.edges.map(t=>t.getCenter(new C))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=AO.map(([t,e])=>this.vertices[t].clone().add(this.vertices[e]).multiplyScalar(.5))}}}),H_=F(()=>{tl={Cloner:null,changeEntityProptotype:()=>{},createEntity:()=>{}}});function sg(t){return t?.isParticleSystem===!0}function Gc(t){return t?.isHairSystem===!0}function ch(t){return t?.isShapeBlendEntity===!0}function qb(t){return t?.isPathObject===!0}function as(t){return t?.isObject2D===!0}function Cr(t){return t?.isUIObject===!0}function Lu(t){return t?.isCloner===!0}function Mc(t){return t?.isClone===!0}function d1(t){return t?.isComponentObject===!0}var Li=F(()=>{});function wi(t){DC.add(t)}function Vn(t,e){let i=`${t}:${e}`;hA.has(i)||hA.add(i)}function W_(t,e){RC.set(t,e)}function SS(t){return RC.get(t)}function xp(t,e){IC.set(t,e)}function MS(t){return IC.get(t)}function oA(t,e){OC.set(t,e)}function sN(t){return OC.get(t)}function lA(){return Xb}var DC,hA,RC,IC,OC,Xb,q_,ke=F(()=>{DC=new Set,hA=new Set,RC=new Map,IC=new Map,OC=new Map,Xb=null,q_=null});function aN(t){let e=t.elements;ha.set(e[0],e[1],e[2]),ca.set(e[4],e[5],e[6]),Xa.set(e[8],e[9],e[10])}function oN(){let t=Math.max(ha.lengthSq(),ca.lengthSq(),Xa.lengthSq());ha.lengthSq()>Pm*t?ms.copy(ha).normalize():ms.set(1,0,0),gs.crossVectors(Xa,ms),gs.lengthSq()<=Pm*t&&(gs.copy(ca).addScaledVector(ms,-ca.dot(ms)),gs.lengthSq()<=Pm*t&&function(e,i){e.set(1,0,0).cross(i),e.lengthSq()<=Pm&&e.set(0,1,0).cross(i),e.normalize()}(gs,ms)),gs.normalize(),Ec.crossVectors(ms,gs)}function lN(t){return aN(t),oN(),hN.makeBasis(ms,gs,Ec)}var ha,ca,Xa,ms,gs,Ec,hN,Pm,Dm,hv,Ac,$b,cN=F(()=>{et(),ha=new C,ca=new C,Xa=new C,ms=new C,gs=new C,Ec=new C,hN=new At,Pm=1e-12,Dm=.01}),Xg=F(()=>{et(),cN(),hv=new At,(Ac||(Ac={})).is=function(t){return t&&t.__isSPEObject},$b=t=>class extends t{constructor(){super(...arguments),this.previousModelViewMatrix=new At,this.copyPreviousMatrix=!0,this.hiddenMatrix=new At,this.pivotMatrix=new At,this.matrixWorldRigid=new At,this.shearScale=new At,this.shearScaleInv=new At}get __isSPEObject(){return!0}getPhysicsLocalMatrix(e){return!!this.rigidBody?.isDynamic()&&(e.copy(this.matrixWorld),this.hasNonUniformScale&&e.multiply(this.shearScaleInv),this.parent&&e.premultiply(hv.copy(this.parent.matrixWorld).invert()),e.premultiply(hv.copy(this.hiddenMatrix).invert()),e.multiply(hv.copy(this.pivotMatrix).invert()),!0)}isDescendantOf(e){e instanceof _i&&(e=e.uuid);let i=this;for(;i.parent;){if(i.parent.uuid===e)return!0;i=i.parent}return!1}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(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.matrixWorld.multiply(this.pivotMatrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(let i of this.children)i.updateMatrixWorld(e)}updateWorldMatrix(e,i){let n=this.parent;if(e&&n!==null&&n.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)),this.matrixWorld.multiply(this.pivotMatrix),i)for(let r of this.children)r.updateWorldMatrix(!1,!0)}traverseChildren(e,i=0){for(let n of this.children)Ac.is(n)&&n.traverseObject(e,i+1)}traverseObject(e,i=0){if(e(this,i)!==!0)for(let n of this.children)Ac.is(n)&&n.traverseObject(e,i+1)}updateMatrixWorldRigid(){this.hasNonUniformScale=function(e,i,n){return aN(e),oN(),i.makeBasis(ms,gs,Ec),n.set(ms.dot(ha),ms.dot(ca),ms.dot(Xa),0,gs.dot(ha),gs.dot(ca),gs.dot(Xa),0,Ec.dot(ha),Ec.dot(ca),Ec.dot(Xa),0,0,0,0,1),function(){let r=ha.length(),s=ca.length(),a=Xa.length(),o=Math.max(r,s,a);if(o-r>Dm||o-s>Dm||o-a>Dm)return!0;let l=Dm*o*o;return Math.abs(ha.dot(ca))>l||Math.abs(ha.dot(Xa))>l||Math.abs(ca.dot(Xa))>l}()}(this.matrixWorld,this.matrixWorldRigid,this.shearScale),this.matrixWorldRigid.copyPosition(this.matrixWorld),this.shearScaleInv.copy(this.shearScale).invert()}attach(e,i){this.updateWorldMatrix(!0,!1);let n=new At().copy(this.matrixWorld).invert();return e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),n.multiply(e.parent.matrixWorld)),"hiddenMatrix"in e&&e.hiddenMatrix instanceof At?e.hiddenMatrix.premultiply(n):e.applyMatrix4(n),e.updateWorldMatrix(!1,!1),this.add(e),i!==void 0&&(this.children.pop(),this.children.splice(i,0,e)),this}copy(e,i=!1){return super.copy(e,i),this.hasNonUniformScale=e.hasNonUniformScale,this}onAfterRender(e,i,n,r,s,a){this.copyPreviousMatrix&&this.previousModelViewMatrix.copy(this.modelViewMatrix)}}});function TO(t,e,i){return Vl.subVectors(e,t),Rg.subVectors(e,i),Vl.cross(Rg).length()<=ag}function dN(t){let e=uA.get(t.points);if(e!==void 0&&e.isClosed===t.isClosed)return e.curve;let i=function(n){let r=n.points,s=[r[0]],a=[new C(...r[0].data.position)];pc.copy(a[0]);for(let y=0;y<r.length-1;y++)Vl.fromArray(r[y].data.position),Rg.fromArray(r[y+1].data.position),Su.subVectors(Vl,pc),Mu.subVectors(Vl,Rg),Su.cross(Mu).length()>ag&&(s.push(r[y]),a.push(new C().copy(Vl)),pc.copy(Vl));let o=r[r.length-1];s.push(o),a.push(new C(...o.data.position));let l=n.isClosed,c=s.length-(l?0:1),h=s.length,d=[],u=[];for(let y=0;y<h;y++){let v=s[y].data;d.push(new C(...v.controlPrevious.position)),u.push(new C(...v.controlNext.position))}let p=[];for(let y=0;y<c;y++){let v=y===h-1?0:y+1;p.push(TO(a[y],u[y],a[v])&&TO(a[y],d[v],a[v]))}let f=[];for(let y=0;y<h;y++){let v=s[y].data,_=a[y],b={position:_,prevDir:void 0,nextDir:void 0,controlPrevious:d[y],controlNext:u[y],tan:void 0,baseRoundness:v.roundness,removedLength:0};if(f.push(b),v.roundness===0||!l&&(y===0||y===h-1))continue;let x=l&&y==0?h-1:y-1,w=l&&y==h-1?0:y+1,S=new C().subVectors(a[x],_).normalize(),A=new C().subVectors(a[w],_).normalize();b.prevDir=S,b.nextDir=A;let E=p[l&&y===0?h-1:y-1],P=p[y];if(E&&P){fc.addVectors(S,A).normalize();let T=pc.crossVectors(fc,S).length()/S.dot(fc);b.tan=T,b.removedLength=v.roundness/T}}for(let y=0;y<c;y++){let v=l&&y===h-1?0:y+1,_=f[y],b=f[v];if(_.removedLength!==0||b.removedLength!==0){let x=_.position.distanceTo(b.position);_.removedLength=Math.min(_.removedLength,x/2),b.removedLength=Math.min(b.removedLength,x/2)}}let g=new Array(2*h).fill(null);for(let y=0;y<c;y++){let v=l&&y===h-1?0:y+1,_=f[y],b=f[v],x=null;if(p[y]){let w=_.position.clone(),S=b.position.clone();(_.removedLength!==0||b.removedLength!==0)&&(_.nextDir&&w.add(pc.copy(_.nextDir).setLength(_.removedLength)),b.prevDir&&S.add(pc.copy(b.prevDir).setLength(b.removedLength))),w.distanceTo(S)>ag&&(x=new Zm(w,w.clone().lerp(S,.3),S.clone().lerp(w,.3),S))}else _.position.distanceTo(b.position)>ag&&(x=new Zm(_.position,_.controlNext,b.controlPrevious,b.position));g[2*y+1]=x}for(let y=0;y<h;y++){let v=f[y];if(v.removedLength===0)continue;let _=v.position,b=v.prevDir.clone().multiplyScalar(v.removedLength).add(_),x=v.nextDir.clone().multiplyScalar(v.removedLength).add(_),w=v.tan*v.removedLength;fc.addVectors(v.prevDir,v.nextDir).normalize(),Su.copy(b).lerp(x,.5);let S=b.distanceTo(x)/2;dA.copy(fc).multiplyScalar(Math.sqrt(Math.pow(w,2)-Math.pow(S,2))).add(Su),u1.copy(fc).multiplyScalar(-w).add(dA);let A=_.distanceTo(u1)/_.distanceTo(Su);Mu.copy(v.prevDir).multiplyScalar(A*_.distanceTo(b)).add(_),cA.copy(Mu).lerp(u1,2);let E=b.clone().lerp(Mu,4/3),P=x.clone().lerp(cA,4/3);g[2*y]=new Zm(b,E,P,x)}let m=new uN;for(let y=0;y<g.length;y++){let v=g[y];v&&m.add(v)}return m}(t);return uA.set(t.points,{isClosed:t.isClosed,curve:i}),i}var uN,ag,Vl,Rg,pc,fc,Su,u1,Mu,cA,dA,uA,Be,Wa,CO,PO,Od,ES,cv,dv,DO,AS,TS,Yb,pA,Zc,$a,pN=F(()=>{et(),uN=class extends sE{constructor(){super()}getPoints(t=12){let e,i=[],n=this.getCurveLengths(),r=n[n.length-1]/n.length;for(let s=0,a=this.curves;s<a.length;s++){let o=a[s],l=s===0?n[s]:n[s]-n[s-1],c=Math.ceil(t*l/r),h=o.getPoints(c);for(let d=0;d<h.length;d++){let u=h[d];e&&e.equals(u)||(i.push(u),e=u)}}return this.autoClose&&i.length>1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}},ag=.001,Vl=new C,Rg=new C,pc=new C,fc=new C,Su=new C,u1=new C,Mu=new C,cA=new C,dA=new C,uA=new WeakMap}),Wr=F(()=>{et(),Yt(),VX(),Ye(),H_(),Li(),ke(),Xg(),pN(),ii(),(Be||(Be={})).is=function(t){return t&&t.__isEntity},Wa=t=>Be.is(t),CO={type:"completeState",isfromEntity:!0},PO=["x","y","z"],Od=new C,ES=new C(1,1,1),cv=new $t,dv=new Ei,DO=new C().set(0,1,0),AS=new At,TS=new At,Yb=t=>class extends $b(t){constructor(){super(...arguments),this.raycastLock=!1,this.scaleLock=!1,this.disposed=!1,this.stateSelection=null,this.destroyedInAction=!1,this.instances=[],this.prevState=null,this.currentState=null,this.currentAnimationAction=null,this.reversibleToState=null,this.transitionState={settled:!0,state:null},this.currentTransitionEvent=null,this.previousAction=null,this._singleBBox=new aA,this._recursiveBBox=new aA,this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0,this._needApplyPathSnapping=!0,this.attachedPaths=new Set}get __isEntity(){return!0}entityChildren(e){let i=this.children[e];if(Be.is(i))return i}entityChildrenCount(){let e=this.children.length;for(;e--;)if(Be.is(this.children[e]))return e+1;return 0}get isConcreteEntity(){return typeof this.identity=="string"}get isVirtualEntity(){return typeof this.identity!="string"}get isInstanceRoot(){return this.isConcreteEntity&&this.data.type==="Instance"}nearestInstanceSelfOrParent(){let e=this;for(;e.data.type!=="Instance";){let i=e.parent;if(!Be.is(i))return;e=i}return e}forInstancesRec(e){this.instances.forEach(i=>{i.disposed||e(i),i.forInstancesRec(e)})}super_Entity(e,i){typeof e=="string"&&(this.uuid=e),this.identity=e,this.data=i,this.matrixAutoUpdate=!1,this.dataPatched=this.data}changeSelectedState(e,i,n=!1){if(this.data.states.length!==0||n){for(let r of this.data.states)Zl.toOps(this.data,r.data).forEach(s=>{let a=b_.replaceProps(s,this.data);this.dataPatched=this.data,this.updateByPatchedOp(a,this.data,i)});if(e!==null){let r=this.data.states.data(e);r&&(this.dataPatched=Zl.patch(this.data,r),Zl.toOps(this.data,r).forEach(s=>{this.updateByPatchedOp(s,this.dataPatched,i)}))}n&&this.updateTransformState(this.dataPatched,i),this.stateSelection=e,this.updatePathSnapping(this.dataPatched.pathSnapping)}}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}updateEntityBoxSize(e,i){e.setScalar(0),i.setScalar(0)}resetBBoxNeedsUpdateSelf(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}resetBBoxNeedsUpdate(){this.resetBBoxNeedsUpdateSelf(),this.traverseAncestors(e=>{Wa(e)&&e.resetBBoxNeedsUpdateSelf()}),this.traverseEntity(e=>{e.resetBBoxNeedsUpdateSelf()})}find(e){let i;return this.traverseEntity(n=>{n.uuid===e&&(i=n)}),i}traverseSortNextHelper(){let e=this.parent;if(e){let i=e.children,n=i.indexOf(this)+1;if(Be.is(i[n]))return i[n];if(Be.is(e))return e.traverseSortNextHelper()}}sortNext(){let e=this.children;return this.children.length>0&&Be.is(this.children[0])?e[0]:this.traverseSortNextHelper()}goUp(e){let i=this;for(;e>0&&i!==null;)i=i.parent,e-=1;return i}hasAnccestorOrSelf(e){return this===e||this.hasAnccestor(e)}hasAnccestor(e){let i=this.parent;for(;i;){if(e===i)return!0;i=i.parent}return!1}countToAccestor(e){let i=0,n=this;for(;n!==e;){if(n===null)return-1;n=n.parent,i+=1}return i}forEachEntity(e){for(let i of this.children)Wa(i)&&e(i)}traverseEntityAncestors(e){this.traverseAncestors(i=>{Be.is(i)&&e(i)})}traverseConcreteEntity(e,i=0){if(e(this,i)!==!0)for(let n of this.children)Wa(n)&&n.isConcreteEntity&&n.traverseEntity(e,i+1)}traverseEntity(e,i=0){if(e(this,i)!==!0)for(let n of this.children)Wa(n)&&n.traverseEntity(e,i+1)}traverseVisibleEntity(e){e(this);for(let i of this.children)Wa(i)&&i.visible&&i.traverseVisibleEntity(e)}updateMatrix(){super.updateMatrix(),this.cloner&&this.cloner.onObjUpdateMatrix(),this.dispatchEvent({type:"updateMatrix"})}updateMatrixWorld(e){super.updateMatrixWorld(e),this.dispatchEvent({type:"updateMatrixWorld"})}copy(e,i=!1){return super.copy(e,i),this.dataPatched=e.dataPatched,this.raycastLock=e.raycastLock,this.scaleLock=e.scaleLock,this.hiddenMatrix.copy(e.hiddenMatrix),this}hasEntityChild(){return this.children.some(e=>Wa(e))}isAncestorOf(e){if(this.uuid===e)return!1;let i=!1;return this.traverseEntity(n=>{n.uuid===e&&(i=!0)}),i}toObjectTransformState(e=[]){return this.updateWorldMatrix(!0,!1),ME({position:this.position.toArray(),rotation:[this.rotation.x*Ot.RAD2DEG,this.rotation.y*Ot.RAD2DEG,this.rotation.z*Ot.RAD2DEG],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray(),pivot:[0,0,0],pivotRotation:[0,0,0]},e)}getTransformValues(e,i,n){return i[e].map((r,s)=>n?.shared.getVariable(r,[this.uuid,e,PO[s]])??r)}updateTransformState(e,i){let n=!1;if(e.position&&(this.position.fromArray(this.getTransformValues("position",e,i)),n=!0),e.rotation&&(Od.fromArray(this.getTransformValues("rotation",e,i)).multiplyScalar(Ot.DEG2RAD),this.rotation.setFromVector3(Od),n=!0),e.scale&&(this.scale.fromArray(this.getTransformValues("scale",e,i)),n=!0),e.hiddenMatrix!==void 0&&(n=!0,this.hiddenMatrix.fromArray(e.hiddenMatrix??qu.identity)),e.pivot!==void 0||e.pivotRotation!==void 0){if(n=!0,e.pivot!==void 0&&e.pivotRotation!==void 0)this.pivotMatrix.compose(Od.fromArray(e.pivot).negate(),cv.setFromEuler(dv.fromArray(e.pivotRotation.map(r=>r*Ot.DEG2RAD))).invert(),ES);else if(e.pivot!==void 0)this.pivotMatrix.setPosition(-e.pivot[0],-e.pivot[1],-e.pivot[2]);else if(e.pivotRotation!==void 0){let r=Od.setFromMatrixPosition(this.pivotMatrix);cv.setFromEuler(dv.fromArray(e.pivotRotation.map(s=>s*Ot.DEG2RAD))).invert(),this.pivotMatrix.compose(r,cv,ES)}}return n&&(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(r=>{r.invalidateClonerTransform(this)})),e.position&&e.rotation&&e.scale&&e.hiddenMatrix!==void 0&&this.updateWorldMatrix(!1,!0),n}onVariableUpdate(e=!1){e?this.resetBBoxNeedsUpdate():(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(i=>{i.invalidateClonerTransform(this)}),this.requestRender())}dispose(){this.disposed=!0,this.cloner&&(this.cloner.dispose(),this.cloner=void 0)}disposeChildrenRecursively(){for(let e of this.children)Be.is(e)&&e.disposeRecursively()}disposeRecursively(){this.dispose(),this.children.forEach(e=>{Be.is(e)&&e.disposeRecursively()})}toState(e=[]){return ME({name:this.name,visible:this.visible,raycastLock:this.raycastLock,...this.toObjectTransformState(e)},e)}updateByObjUpdateOp(e,i){e!==void 0&&this.updateByOp({type:0,props:e,path:[]},{...this.data,...e},i,!1)}updateByOp(e,i,n,r){let s=this.data;this.data=i;let a=e,o=ri(e.path,["states","*"]);if(o!==null){if(e.type===0){let[l]=o;if(this?.stateSelection===l){let c={...e.props};if(delete c.name,Object.values(e.props).some(h=>h===void 0)){let h=this.data;if(h!==void 0){let d=kn.zoom(h,e.path.slice(2));if(d)for(let u in e.props)e.props[u]===void 0&&u in d&&(c[u]=d[u])}}a={...e,props:c,path:e.path.slice(2)}}}}else if(e.type===0){let l=this.stateSelection?this.data.states.data(this.stateSelection):void 0;if(l!==void 0){if(e.props.name!==void 0&&l.name){let{name:h,...d}=l;l=d}if(e.props.material!==void 0&&"material"in l){let{material:h,...d}=l;l=d}let c=kn.removeOverridden(e.path,e.props,l);a={...e,props:c}}}if(this.updateByPatchedOpBase(a,Zl.patch(this.data,this.stateSelection?this.data.states.data(this.stateSelection):void 0),n),ri(e.path,["overrides"])){let l=[],c=[...e.path];for(l.push(c[1]),c.splice(0,2);c.length>0&&c[0]==="descendants";)l.push(c[1]),c.splice(0,2);if(l[l.length-1]===void 0){if(e.type===0)for(let h of Object.keys(e.props)){l[l.length-1]=h;let d=n.scene.findInstance([this.uuid,...l]);d&&(d.overrideData=e.props[h],d.updateState(sh.apply(d.component.data,d.overrideData),n))}}else{let h=n.scene.findInstance([this.uuid,...l]);if(h){let d=kn.zoom(h.component.data,c);if((e={...e,path:c}).type===0){let u=e.props;if(d)for(let[p,f]of Object.entries(e.props))f===void 0&&(u===e.props&&(u={...e.props}),u[p]=d[p]);e={...e,props:u}}h.overrideData=N_.resolve(i.overrides,l),h.updateByOp(e,Jn.applySimple(h.data,e),n,!1)}}}else if(this.instances.length>0){let l;if(e.path.length===0&&e.type===0){let c;for(let h of Qo.rootOverrideProps)h in e.props&&(c===void 0&&(c={}),c[h]=e.props[h]);c&&(l={...e,props:c})}else for(let c of Qo.rootOverrideProps)if(ri(e.path,[c])){l=e;break}l!==void 0&&this.instances.forEach(c=>{if(c.isInstanceRoot){let h=sh.filterOp(c.overrideData,l);h&&c.updateByOp(h,Jn.applySimple(c.data,h),n,!0)}}),this.instances.forEach(c=>{if(!c.isInstanceRoot){let h=sh.filterOp(c.overrideData,e);if(h){let d;d=s===c.data&&e===h?i:Jn.applySimple(c.data,h),c.updateByOp(h,d,n,!0)}}})}}updateByPatchedOpBase(e,i,n){if(this.dataPatched=i,e.path.length===0&&e.type===0)e.props.type!==void 0&&!Vc.is(e.props.type)&&tl.changeEntityProptotype(this,i,n);else if(e.path.length===1&&e.path[0]==="geometry"&&e.type===0&&"type"in e.props){tl.changeEntityProptotype(this,i,n);for(let r of this.children)Be.is(r)&&r.updateVisible(n.scene)}this.updateByPatchedOp(e,i,n)}updateByPatchedOp(e,i,n){if(e.path.length===0&&e.type===0?this.updateState(e.props,n):e.type===0&&("resolutionLevel"in e.props||"useChildrenColors"in e.props)&&this.updateState(i,n),e.path[0]==="morphTargetInfluences"&&e.type===0){let r=i.morphTargetInfluences.get(e.path[1])?.data.name;r&&this.updateMorphInfluences(r,n.shared.getVariable(e.props.value,[this.uuid,"morphTargetInfluences",r]))}if(ri(e.path,["pathSnapping"])!==null&&this.updatePathSnapping(i.pathSnapping),ri(e.path,["cloner"])!==null){let r=Jn.drop(e,1);r.path.length===0&&r.type===0&&r.props.disabled===!0?this.setFromClonerState(null,n):this.cloner?this.cloner.updateState(i.cloner,n):(this.setFromClonerState(i.cloner,n),this.expandCloner(n)),this.updateVisible(n.scene)}}updatePathSnapping(e=this.dataPatched.pathSnapping){this._updatedPathSnapping=e,this._needApplyPathSnapping=!0}get updatedPathSnapping(){return this._updatedPathSnapping}applyPathSnapping(e){if(this._needApplyPathSnapping===!1)return;let i=this._updatedPathSnapping?.pathId??this.dataPatched.pathSnapping.pathId,n=this._updatedPathSnapping?.slide??this.dataPatched.pathSnapping.slide??0,r=this._updatedPathSnapping?.offset??this.dataPatched.pathSnapping.offset??0,s=this._updatedPathSnapping?.orientation??this.dataPatched.pathSnapping.orientation;if(i===null)return;let a=e.find(i);if(!a)return;this._needApplyPathSnapping=!1;let o=a.data;if(o.geometry.path.points.length<=1)return;let l=dN(o.geometry.path),c=(n+r)%1;n+r===1&&c===0&&(c=1);let h=null;try{h=l.curves.length?l.getPointAt(c):null}catch{}if(h===null)return;a.updateMatrixWorld();let d=this.parent?AS.copy(this.parent.matrixWorld).invert():AS.identity();d.multiply(a.matrixWorld),h.applyMatrix4(d);let u={position:h.toArray(),rotation:o.rotation};if(s==="tangential"){let p=TS.extractRotation(a.matrixWorld),f=l.getTangentAt(c).applyMatrix4(p).add(h),g=TS.lookAt(h,f,DO),m=Od.setFromEuler(dv.setFromRotationMatrix(g)).multiplyScalar(Ot.RAD2DEG);u={...u,rotation:m.toArray()}}this.updateTransformState(u),this.traverseEntity(p=>{p._cameraType&&p.dispatchEvent(CO)})}updateVisible(e){if(this.visible=this.dataPatched.visible&&(!this.dataPatched.cloner||(this.dataPatched.cloner.disabled??!1)||this.dataPatched.cloner?.hideBase!==!0),!e)return;let i=!1;this.traverseEntity(n=>{if(n.data.type==="Splat")return i=!0,!0}),i&&e.reloadSplats()}updateState_Entity(e,i){e.name!==void 0&&(this.name=e.name),e.raycastLock!==void 0&&(this.raycastLock=e.raycastLock),e.visible!==void 0&&(this.updateVisible(i?.scene),this.resetBBoxNeedsUpdate()),i&&"cloner"in e&&e.cloner!==void 0&&(this.setFromClonerState(e.cloner,i),this.updateVisible(i.scene)),this.updateTransformState(e,i)}get attachedSurfaceCloners(){return this.children.filter(e=>Lu(e)&&e.parameters.type==="toObject")}setFromClonerState(e,i){if(!this.disposed)if(e===null||e.disabled)this.cloner&&this.cloner.dispose(),this.cloner=void 0;else if(this.cloner===void 0){if(tl.Cloner===null)return void Vn("cloners","a cloner");this.cloner=new tl.Cloner(this,e),i.scene.addPendingExpandCloner(this)}else this.cloner.updateState(e,i)}expandCloner(e){!this.disposed&&this.cloner&&this.cloner.expandClones(e)}invalidateClonerTransform(e){this.cloner&&this.cloner.invalidateTransform(e)}requestRender(){this.dispatchEvent({type:"requestRender"})}}}),Kc=F(()=>{et(),Wr(),(pA||(pA={})).is=t=>"objectHelper"in t,Zc=(t,e)=>class extends Yb(t){constructor(){super(...arguments),this.objectHelper=new e(this),this.gizmos={}}get geometryHelper(){return e.geometryHelper}raycast(i,n){this.objectHelper.raycast(i,n)}showGizmos(){for(let i in this.gizmos){let n=this.gizmos[i];n instanceof Sg&&(n.visible=!0)}}updateEntityBoxSize(i,n){this.objectHelper.visible&&this.geometryHelper instanceof ga?(i.setScalar(0),n.set(this.geometryHelper.parameters.width,this.geometryHelper.parameters.height,this.geometryHelper.parameters.height).multiplyScalar(.5)):super.updateEntityBoxSize(i,n)}hideGizmos(){for(let i in this.gizmos){let n=this.gizmos[i];n instanceof Sg&&(n.visible=!1)}}}}),Zb=F(()=>{et(),Wb(),Kc(),$a=class extends Zc(vp,up){constructor(t,e){super(),this.super_Entity(t,e),this.objectHelper.update(),this.data.type==="Empty"&&(this.objectHelper.visible=!1)}updateState(t,e){this.updateState_Entity(t,e),"buffer"in t&&Object.keys(t).length===1&&e.scene.reloadSplats()}}});function Qs(t,e,i,n,r,s,a){Rm.set(r,s,a).unproject(n);let o=e[t];if(o!==void 0){let l=i.getAttribute("position");for(let c=0,h=o.length;c<h;c++)l.setXYZ(o[c],Rm.x,Rm.y,Rm.z)}}var Rm,cs,RO,fN,jX=F(()=>{et(),Wg(),qg(),Rm=new C,cs=new Wl,RO=class extends gu{constructor(t){let e=new Gt,i=new zo({color:16777215,vertexColors:!0,toneMapped:!1}),n=[],r=[],s={},a=new Jt(15711266),o=new Jt(15711266),l=new Jt(2857471);function c(d,u,p){h(d,p),h(u,p)}function h(d,u){n.push(0,0,0),r.push(u.r,u.g,u.b),s[d]===void 0&&(s[d]=[]),s[d].push(n.length/3-1)}c("n1","n2",a),c("n2","n4",a),c("n4","n3",a),c("n3","n1",a),c("f1","f2",a),c("f2","f4",a),c("f4","f3",a),c("f3","f1",a),c("n1","f1",a),c("n2","f2",a),c("n3","f3",a),c("n4","f4",a),c("p","n1",o),c("p","n2",o),c("p","n3",o),c("p","n4",o),c("u1","u2",l),c("u2","u3",l),c("u3","u1",l),e.setAttribute("position",new Nt(n,3)),e.setAttribute("color",new Nt(r,3)),super(e,i),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update()}update(){let t=this.geometry,e=this.pointMap;cs.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let i=.8;Qs("n1",e,t,cs,-1,-1,i),Qs("n2",e,t,cs,1,-1,i),Qs("n3",e,t,cs,-1,1,i),Qs("n4",e,t,cs,1,1,i);let n=i;Qs("f1",e,t,cs,-1,-1,n),Qs("f2",e,t,cs,1,-1,n),Qs("f3",e,t,cs,-1,1,n),Qs("f4",e,t,cs,1,1,n);let r=n;Qs("u1",e,t,cs,.35,1.1,r),Qs("u2",e,t,cs,-.35,1.1,r),Qs("u3",e,t,cs,0,1.55,r),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}},fN=class extends _p(RO){constructor(t){super(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,e){bp(this.object,this.geometry,t,e,!0)}}});function IO(t){return 1-Math.pow(1-t,3)}var $h,uv,pv,fv,Ld,mv,Oa,gn,Hs=F(()=>{et(),jX(),Yt(),Kc(),ii(),$h=new C,uv=new C,pv=new $t,fv=new C,Ld=new C,mv=new C,Oa=class extends Zc(Wl,fN){constructor(t="",e={...ig.defaultData,name:""}){super(),this._cameraType="OrthographicCamera",this.targetOffset=Ko.DefaultTargetOffset,this.isUpVectorFlipped=!1,this.angleOffsetFromUp=0,this.wasMovedByUser=!1,this.wasMovedBySwitchCameraAction=!1,this._createdAt=typeof performance<"u"?performance.now():0,this._tickProjectionTransition=()=>{let r=this._projectionTransition;if(r===void 0)return;if(this.disposed)return void this._endProjectionTransition();r.raf=requestAnimationFrame(this._tickProjectionTransition);let s=Oa.projectionTransitionRequestRender??r.requestRender;this.updateProjectionMatrix(),s?.()},this.super_Entity(t,e),this.previousProjectionMatrix=new At,this.matrixAutoUpdate=!0,this.width=window.innerWidth,this.height=window.innerHeight;let i=this.width,n=this.height;this.orthoCamera=new hp(-.5*i,.5*i,.5*n,-.5*n,-5e4,1e4),this.perspCamera=new Vu(45,i/n,50,1e4),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.focus=this.perspCamera.focus,this.filmGauge=this.perspCamera.filmGauge,this.filmOffset=this.perspCamera.filmOffset,this.objectHelper.update()}static withoutProjectionTransition(t){let e=Oa.projectionTransitionsEnabled;Oa.projectionTransitionsEnabled=!1;try{return t()}finally{Oa.projectionTransitionsEnabled=e}}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}set fov(t){this.perspCamera.fov=t}get fov(){return this.perspCamera.fov}setNear(t,e){t==="PerspectiveCamera"?this.perspCamera.near=e:this.orthoCamera.near=e}setZoom(t,e){e>=0&&(t==="PerspectiveCamera"?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}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,e,i){typeof t=="number"&&(t=new C(t,e,i)),super.lookAt(t),this.getWorldPosition($h),this.targetOffset=$h.distanceTo(t)}getTarget(t=new C){return this.getWorldDirection(uv),this.getWorldPosition($h),uv.multiplyScalar(this.targetOffset),t.copy($h).add(uv),t}getDistanceToTarget(){let t=this.getTarget();return this.getWorldPosition($h),$h.distanceTo(t)}updateUp(){this.getWorldQuaternion(pv),fv.set(0,0,1).applyQuaternion(pv),Ld.copy(_i.DEFAULT_UP),this.isUpVectorFlipped&&Ld.negate(),Ld.applyQuaternion(pv),mv.copy(_i.DEFAULT_UP).projectOnPlane(fv),this.angleOffsetFromUp=mv.angleTo(Ld),this.angleOffsetFromUp*=mv.cross(Ld).dot(fv)>=0?1:-1}updateTransformState(t,e){let i=super.updateTransformState(t,e);return t.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=t.isUpVectorFlipped),this.updateUp(),i}getViewFrontToObject(t){let e=t.getWorldPosition(new C),i=t.getWorldDirection(new C).multiplyScalar(this.targetOffset);return{position:e.clone().add(i),target:e}}getViewToTarget(t){let e=this.getWorldDirection(new C).multiplyScalar(this.targetOffset);return{position:t.clone().sub(e),target:t}}getViewToObject(t){let e=new C;return t.getWorldPosition(e),this.getViewToTarget(e)}setViewplaneSize(t,e,i=!1){if(this.aspect=t/e,i){let n=t>e?this.aspect:1,r=t>e?1:this.aspect;this.left=-395*n,this.right=395*n,this.top=1/r*395,this.bottom=1/r*-395}else this.left=.5*-t,this.right=.5*t,this.top=.5*e,this.bottom=.5*-e;this.updateProjectionMatrix()}copyViewPlaneSize(t){this.aspect=t.aspect,this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.updateProjectionMatrix()}toOrthographic(){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}toPerspective(){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}get isProjectionTransitioning(){return this._projectionTransition!==void 0}get projectionTransitionProgress(){let t=this._projectionTransition;if(t===void 0)return 1;let e=(performance.now()-t.start)/t.duration;return e>=1?1:e<=0?0:IO(e)}get _activeSubCamera(){return this._cameraType==="PerspectiveCamera"?this.perspCamera:this.orthoCamera}_canAnimateProjection(){return Oa.projectionTransitionsEnabled&&typeof requestAnimationFrame=="function"&&typeof performance<"u"&&performance.now()-this._createdAt>=Oa.projectionTransitionMinAgeMs}_beginProjectionTransition(t){let e=this._projectionTransition;e===void 0&&(e={from:new At,blend:new At,blendInverse:new At,start:0,duration:Oa.projectionTransitionDuration,referenceDepth:1,raf:0,requestRender:t},this._projectionTransition=e),e.from.copy(this.projectionMatrix),e.start=performance.now(),e.duration=Oa.projectionTransitionDuration,e.referenceDepth=Number.isFinite(this.targetOffset)?Math.max(1,this.targetOffset):1,t&&(e.requestRender=t),e.raf!==0&&cancelAnimationFrame(e.raf),e.raf=requestAnimationFrame(this._tickProjectionTransition)}_applyProjectionTransition(){let t=this._projectionTransition;if(t===void 0)return;let e=(performance.now()-t.start)/t.duration;if(e>=1)return void this._endProjectionTransition();let i=IO(e),n=t.from.elements,r=this._activeSubCamera.projectionMatrix.elements,s=t.blend.elements,a=t.referenceDepth,o=Math.max(1e-6,n[15]-n[11]*a),l=i*o/(i*o+(1-i)*Math.max(1e-6,r[15]-r[11]*a));for(let c=0;c<16;c++)s[c]=n[c]+(r[c]-n[c])*l;t.blendInverse.copy(t.blend).invert(),this.projectionMatrix=t.blend,this.projectionMatrixInverse=t.blendInverse}_endProjectionTransition(){let t=this._projectionTransition;if(t===void 0)return;t.raf!==0&&cancelAnimationFrame(t.raf),this._projectionTransition=void 0;let e=this._activeSubCamera;this.projectionMatrix=e.projectionMatrix,this.projectionMatrixInverse=e.projectionMatrixInverse}_syncProjectionTransition(t){let e=t._projectionTransition;if(e===void 0)return void(this._projectionTransition!==void 0&&this._endProjectionTransition());let i=this._projectionTransition;i===void 0?(i={from:new At,blend:new At,blendInverse:new At,start:0,duration:1,referenceDepth:1,raf:0,requestRender:void 0},this._projectionTransition=i):i.raf!==0&&(cancelAnimationFrame(i.raf),i.raf=0),i.requestRender=void 0,i.from.copy(e.from),i.start=e.start,i.duration=e.duration,i.referenceDepth=e.referenceDepth,this._applyProjectionTransition()}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,e,i,n,r,s){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(t,e,i,n,r,s):this.orthoCamera.setViewOffset(t,e,i,n,r,s),this._applyProjectionTransition()}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}copyHistory(){this.previousProjectionMatrix&&this.previousProjectionMatrix.copy(this.projectionMatrix)}updateProjectionMatrix(){this._cameraType==="PerspectiveCamera"?this.toPerspective():this._cameraType==="OrthographicCamera"&&this.toOrthographic()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(t,e){return super.copy(t,e),this.parent=t.parent,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=Ko.sanitizeTargetOffset(t.targetOffset),this.updateProjectionMatrix(),this._syncProjectionTransition(t),this}toCameraState(t=[]){return ME({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},t)}updateCameraSubtype(t,e){let i=t==="perspective"?"PerspectiveCamera":"OrthographicCamera";e.zoom!==void 0&&this.setZoom(i,e.zoom),e.near!==void 0&&this.setNear(i,e.near),e.fov!==void 0&&i==="PerspectiveCamera"&&(this.fov=e.fov)}updateState(t,e){this.updateCameraState(t,e)}updateCameraState(t,e){this.updateState_Entity(t,e),t.far!==void 0&&(this.far=t.far),t.orthographic!==void 0&&this.updateCameraSubtype("orthographic",t.orthographic),t.perspective!==void 0&&this.updateCameraSubtype("perspective",t.perspective),t.type!==void 0&&(t.type!==this._cameraType&&this._canAnimateProjection()&&this._beginProjectionTransition(e?.shared.requestRender),this.cameraType=t.type),t.up!==void 0&&this.up.fromArray(t.up.map(i=>typeof i=="number"?i:0)),t.targetOffset!==void 0&&(this.targetOffset=Ko.sanitizeTargetOffset(t.targetOffset)),t.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=t.isUpVectorFlipped),this.updateProjectionMatrix()}updateByPatchedOp(t,e,i){super.updateByPatchedOp(t,e,i),t.path.length===1&&t.type===0&&this.updateCameraSubtype(t.path[0],t.props)}toState(t){return{...super.toState(t),...this.toCameraState(t),type:this.cameraType}}},(gn=Oa).projectionTransitionsEnabled=!1,gn.projectionTransitionDuration=350,gn.projectionTransitionMinAgeMs=1e3});function mN(t){return t.type==="TorusGeometry"&&t.arc===360}var gN,gv,fA,Ig=F(()=>{et(),gN=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,revolutions:2,segments:40,pathRadius:10,pathType:0,pathSegments:30,cornerRadius:30,cornerSegments:4},t.parameters),n=Math.abs(i.width),r=Math.abs(i.height??n),s=Math.abs(i.depth??n),a=Math.abs(Math.min(n,s))/2;return{parameters:Object.assign(i,{width:n,height:r,depth:s,radius:a,segments:Math.round(i.segments),pathSegments:Math.round(i.pathSegments),cornerSegments:Math.round(i.cornerSegments)})}}static build(t){let{width:e,height:i,depth:n,radius:r,revolutions:s,segments:a,pathRadius:o,pathType:l,pathSegments:c,cornerRadius:h,cornerSegments:d}=t.parameters,u=new fA(!1,e,i,n,r,s,a,o,l,c,h,d);return Object.assign(u,{userData:{...t,type:"HelixGeometry"}})}},gv=new nh([0,0,0],1),fA=class extends Gt{constructor(t=!0,e=1,i=1,n=1,r=1,s=1,a=1,o=1,l=1,c=1,h=1,d=1){if(super(),s===0)return;let u=t&&s===1;u&&(d=0),h>100&&(h=100),h===0&&(d=0);let p,f,g,m,y,v,_,b,x=()=>new C,w=new C,S=x(),A=x(),E=x(),P=x(),T=x(),R=x(),L=x(),D=x(),U=x(),V=x(),k=x(),Y=i-2*o+.001,$=Y/s,nt=Math.ceil(a*s),Q=nt+1,rt=Y/nt,gt=-Y/2,at=c+1,ht=2*Math.PI/c,ct=Math.PI/2/d,q=Math.min((1-h/100)*o,o-.01),lt=o-q,z=0,O=2*d+2,j=at*O/2,Z=j+at*Q,I=Math.max(0,at*(Q+O)),[G,W,N]=[3,3,2].map(jt=>Array(I*jt).fill(0)),tt=[],ot=r-o;function pt(jt,Ft){let _e=Math.PI/2;v=Ft*rt,b=2*Math.PI*(v%$)/$+_e,v+=gt,_=Math.sin(b)*ot,y=Math.cos(b)*ot,t?jt.set(y,_,v):jt.set(y,v,_)}pt(w,-1e-10),pt(S,0),P.copy(w),pt(w,1);let ut=w.distanceTo(S),Pt=u?0:lt+q,bt=ut*nt+2*Pt,Rt=q,_t=bt-Pt;for(let jt=0;jt<=nt;jt++){pt(A,jt),k.subVectors(A,P).normalize(),P.copy(A),U.copy(A).setComponent(+t+1,0).normalize(),V.crossVectors(k,U).normalize();let Ft=jt===0,_e=jt===nt,be=Ft?3*Math.PI/2:ct,Vi=Ft?Rt:_t,oe=Ft?at:Z,le=Ft?0:I-at,Pe=k.clone().multiplyScalar(Ft?-lt:lt).add(A),si=k.clone().multiplyScalar(Ft?-1:1).normalize();for(let ze=0;ze<at;ze++){let Pi=ze*ht;if(T.addVectors(w.copy(U).multiplyScalar(o*Math.cos(Pi)),S.copy(V).multiplyScalar(o*Math.sin(Pi))),R.copy(T).normalize(),Ft||_e){u||(z=le+ze,[0,1,2].forEach(ui=>{G[3*z+ui]=Pe.getComponent(ui),W[3*z+ui]=si.getComponent(ui)}),N[2*z]=+_e,N[2*z+1]=ze/c),S.copy(R).multiplyScalar(q),E.addVectors(A,S);for(let ui=0;ui<d;ui++){let tn=ui*ct+be;L.addVectors(w.copy(k).multiplyScalar(lt*Math.sin(tn)),S.copy(R).multiplyScalar(lt*Math.cos(tn))),D.copy(L).normalize(),S.addVectors(E,L),L.normalize(),z=oe+ui*at+ze,[0,1,2].forEach(vn=>{G[3*z+vn]=S.getComponent(vn),W[3*z+vn]=D.getComponent(vn)});let Kr=+Ft+Math.sin(tn);N[2*z]=(Vi+lt*Kr)/bt,N[2*z+1]=ze/c}}S.addVectors(A,T),z=j+jt*at+ze,[0,1,2].forEach(ui=>{G[3*z+ui]=S.getComponent(ui),W[3*z+ui]=R.getComponent(ui)}),N[2*z]=(Pt+jt*ut)/bt,N[2*z+1]=ze/c}}let X=Q+2*d+2,[vt,Dt]=[+u,X-1];for(let jt=vt;jt<=Dt-1;jt++){let Ft=u&&jt===Dt-1;for(let _e=0;_e<at-1;_e++)p=jt*at+_e,f=p+1,g=(Ft?_e:p)+at,m=(Ft?_e+1:f)+at,jt===0?tt.push(f,m,g):jt===X-2?tt.push(p,f,g):tt.push(p,f,g,f,m,g)}this.setIndex(tt),this.setAttribute("position",new Nt(G,3)),this.setAttribute("normal",new Nt(W,3)),this.setAttribute("uv",new Nt(N,2))}getClosedTorusIndicesForBooleanOrSubdiv(){let t,e,i,n,r=this.userData.parameters,s=Math.ceil(r.tubularSegments),a=r.radialSegments,o=a+1,l=[];for(let c=1;c<s;c++)for(let h=0;h<a;h++)t=c*o+h,e=t+1,i=t+o,n=e+o,l.push(t,e,i,e,n,i);for(let c=0;c<a;c++)t=s*o+c,e=t+1,i=c+o,n=c+1+o,l.push(t,e,i,e,n,i);return gv.array=new Uint32Array(l),gv.count=l.length,gv}}});function GX(t){return LO||(LO=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.32/build",i=import("./boolean.js"),[n,r]=await Promise.all([i,fetch(`${e}/boolean.wasm`).then(s=>s.arrayBuffer())]);await n.default({module_or_path:r}),Og=n}())}function X_(){if(Og===void 0)throw new Error("boolean-wasm is not loaded");return Og}function LC(t){let e=Lg.get(t);if(e===void 0)throw new Error("Unknown csg mesh set handle "+t);return e}function BC(t){return Lg.set(++mA,t),mA}function HX(t,e,i){if(Og===void 0)return-1;let{positions:n,indices:r,normals:s}=function(a,o){if(o&&a.userData.positions!==void 0){let p=a.userData,f=[];for(let g=0,m=0;g<p.verticesPerFace.length;g++){let y=p.verticesPerFace[g];for(let v=1;v<y-1;v++)f.push(p.indices[m],p.indices[m+v],p.indices[m+v+1]);m+=y}return{positions:p.positions instanceof Float32Array?p.positions:new Float32Array(p.positions),indices:new Uint32Array(f)}}let l;l=mN(a.userData.parameters)?a.getClosedTorusIndicesForBooleanOrSubdiv():a.getIndex();let c,h=a.getAttribute("position");if(l===null){c=new Uint32Array(h.count);for(let p=0;p<c.length;p++)c[p]=p}else c=l.array instanceof Uint32Array?l.array:new Uint32Array(l.array);let d=a.getAttribute("normal"),u=d!==void 0&&d.itemSize===3&&d.count===h.count&&d.array instanceof Float32Array&&d.isInterleavedBufferAttribute!==!0?d.array:void 0;return{positions:h.array,indices:c,normals:u}}(t,e);return BC(new Og.CsgMesh(n,r,s))}function OO(t,e){let i=X_(),n=yN[e];if(n===void 0)throw new Error("Unknown boolean operation "+e);let r=t.map(LC);if(r.length===1)return i.clone_mesh(r[0]);let s,a=[];if(e===2&&r.length>2){let o=r[0];for(let l=1;l<r.length-1;l++)o=i.boolean_mesh(o,r[l],0),a.push(o);s=i.boolean_mesh(r[r.length-1],o,2)}else if(e===2)s=i.boolean_mesh(r[1],r[0],2);else{let o=r[r.length-1];for(let l=0;l<r.length-1&&(o=i.boolean_mesh(o,r[l],n),a.push(o),o.tri_count()!==0);l++);s=o,a.pop()}for(let o of a)o.free();return s}function CS(t,e){LC(t).transform(new Float32Array(e.elements))}function vN(t){let e=Lg.get(t);e!==void 0&&(e.free(),Lg.delete(t))}var Og,Lg,mA,LO,yN,Kb=F(()=>{et(),Ig(),Lg=new Map,mA=0,yN={0:0,1:1,2:2}});function Yh(t){return t!==null&&"booleanOp"in t}var gA,_N,WX=F(()=>{et(),Wr(),Kb(),gA=class extends Yb(xi){constructor(){super(...arguments),this.booleanMeshSetAddress=-1,this.booleanWasTransformed=!1,this.booleanMatrixInvOld=new At}updateVisible(t){super.updateVisible(t),this.visible=!Yh(this.parent)&&this.visible,Yh(this.parent)&&this.parent.invalidateDownstreamBooleanData()}onClonerLayoutUpdated(){Yh(this.parent)&&this.invalidateDownstreamBooleanData()}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(vN(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(t=!1){return t?this.booleanWasTransformed=!0:this.freeBooleanPointer(),Yh(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let t of this.children)t instanceof gA&&(t.freeBooleanPointer(),Yh(t)&&t.invalidateUpstreamBooleanData())}updateTransformState(t,e){let i=super.updateTransformState(t,e);return i&&Yh(this.parent)&&this.invalidateDownstreamBooleanData(!0),i}onVariableUpdate(t=!1){super.onVariableUpdate(t),Yh(this.parent)&&this.invalidateDownstreamBooleanData(!0)}}}),qX=F(()=>{_N=null});function UC(t,e=0,i=t.count,n,r){let s=1/0,a=1/0,o=1/0,l=-1/0,c=-1/0,h=-1/0;for(let d=e;d<i;d++){let u=t.getX(d),p=t.getY(d),f=t.getZ(d);u<s&&(s=u),p<a&&(a=p),f<o&&(o=f),u>l&&(l=u),p>c&&(c=p),f>h&&(h=f)}Im.min.set(s,a,o),Im.max.set(l,c,h),Im.getCenter(n),Im.getSize(r).multiplyScalar(.5)}var Im,BO,UO,Xi,Yn=F(()=>{et(),WX(),qX(),Im=new ci,BO=new Gt,UO=new Gs,Xi=class extends gA{constructor(t,e){super(BO,UO),this.super_Entity(t,e)}updateState(t,e){this.updateState_Entity(t,e)}raycast(t,e){let i=_N;i===null?super.raycast(t,e):i(this,t,e)}updateEntityBoxSize(t,e){let i=this.geometry.getAttribute("position");i!==void 0?UC(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,t,e):super.updateEntityBoxSize(t,e)}}});function $_(t){return t?.isClassicNodeMaterial===!0}var mn,Bg,bN,xN,og,wN,SN,MN,zC=F(()=>{}),ya=F(()=>{et(),mn=class extends Jt{constructor(t,e,i,n){super(t,e,i),this.isColorA=!0,this.a=n}setRGBA(t,e,i,n){super.setRGB(t,e,i),this.a=n}copy(t){return super.copy(t),this.a="a"in t?t.a:1,this}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}equals(t){return super.equals(t)&&this.a===t.a}setStyle(t,e="srgb"){let i;if(t==="transparent")return this.setRGBA(0,0,0,0),this;if(i=/^((?:rgb|hsl)a?)\(([^)]*)\)/.exec(t)){let n,r=i[1],s=i[2];switch(r){case"rgb":case"rgba":if(n=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.a=r==="rgba"?parseFloat(n[4]):1,super.setStyle(t,e);break;case"hsl":case"hsla":if(n=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)%\s*,\s*(\d*\.?\d+)%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.a=r==="hsla"?parseFloat(n[4]):1,super.setStyle(t,e)}}return super.setStyle(t,e)}get x(){return this.r}get y(){return this.g}get z(){return this.b}get w(){return this.a}set x(t){this.r=t}set y(t){this.g=t}set z(t){this.b=t}set w(t){this.a=t}}}),EN=F(()=>{ya(),Bg=class extends mn{}}),XX=F(()=>{bN=class{constructor(t=1e4){this.timeout=t,this.cache=new Map,this.head={data:null,time:0,src:null,next:null,prev:null},this.tail={data:null,time:1/0,src:null,next:null,prev:null},this.hasClean=!1,this.cleanupTimer=null,this.head.next=this.tail,this.tail.prev=this.head}log(...t){}remove(t){let e=this.cache.get(t);e&&(this.dispose(t,e.data),this.cache.delete(t),e.prev.next=e.next,e.next.prev=e.prev,e.next=null,e.prev=null,e.data=null)}scheduleCleanup(){this.hasClean||(this.log("scheduled cleanup"),this.hasClean=!0,this.cleanupTimer=setTimeout(()=>{this.hasClean=!1,this.cleanupTimer=null,this.log("cleaning");let t=Date.now(),e=this.head.next;for(;e.time<t-this.timeout;){this.dispose(e.src,e.data),this.cache.delete(e.src);let i=e;e=e.next,e.prev=this.head,this.head.next=e,i.next=null,i.prev=null,i.data=null}this.head.next!==this.tail?this.scheduleCleanup():this.log("no more cleanup")},this.timeout+1e3))}has(t){return this.cache.get(t)?.data}load(t){let e=Date.now(),i=this.cache.get(t);return i===void 0?(i={data:this.create(t),src:t,time:e,next:null,prev:null},this.cache.set(t,i)):(i.time=e,i.prev.next=i.next,i.next.prev=i.prev),i.prev=this.tail.prev,i.next=this.tail,this.tail.prev.next=i,this.tail.prev=i,this.scheduleCleanup(),i.data}disposeAll(){this.cleanupTimer!==null&&(clearTimeout(this.cleanupTimer),this.cleanupTimer=null),this.hasClean=!1,this.cache.forEach((t,e)=>{this.dispose(e,t.data),t.next=null,t.prev=null,t.data=null}),this.cache.clear(),this.head.next=this.tail,this.tail.prev=this.head}destroy(){this.disposeAll(),this.head=null,this.tail=null}}}),AN=F(()=>{XX(),xN=class extends bN{create(t){return URL.createObjectURL(new Blob([t]))}dispose(t,e){URL.revokeObjectURL(e)}}}),TN=F(()=>{wN=class{constructor(t,e){this.data=t,this.cache=e,this.refCount=0}deref(){this.refCount,this.refCount-=1,this.refCount===0&&(this.cache.remove(this),this.dispose())}dispose(){this.refCount}},SN=class{constructor(){this.cache=new Map}remove(t){this.cache.delete(t.data)}load(t){let e=this.cache.get(t);return e===void 0&&(e=this.create(t),this.cache.set(t,e)),e.refCount+=1,e}}}),$X=F(()=>{et(),MN=class extends _z{constructor(t){super(t),this.type=qn}parse(t){let e=function(p,f){switch(p){case 1:throw new Error("THREE.HDRLoader: Read Error: "+(f||""));case 2:throw new Error("THREE.HDRLoader: Write Error: "+(f||""));case 3:throw new Error("THREE.HDRLoader: Bad File Format: "+(f||""));default:throw new Error("THREE.HDRLoader: Memory Error: "+(f||""))}},i=function(p,f,g){f=f||1024;let m=p.pos,y=-1,v=0,_="",b=String.fromCharCode.apply(null,new Uint16Array(p.subarray(m,m+128)));for(;0>(y=b.indexOf(`
|
|
4163
4163
|
`))&&v<f&&m<p.byteLength;)_+=b,v+=b.length,m+=128,b=String.fromCharCode.apply(null,new Uint16Array(p.subarray(m,m+128)));return-1<y&&(g!==!1&&(p.pos+=v+y+1),_+b.slice(0,y))},n=function(p,f,g,m){let y=p[f+3],v=Math.pow(2,y-128)/255;g[m+0]=p[f+0]*v,g[m+1]=p[f+1]*v,g[m+2]=p[f+2]*v,g[m+3]=1},r=function(p,f,g,m){let y=p[f+3],v=Math.pow(2,y-128)/255;g[m+0]=Hl.toHalfFloat(Math.min(p[f+0]*v,65504)),g[m+1]=Hl.toHalfFloat(Math.min(p[f+1]*v,65504)),g[m+2]=Hl.toHalfFloat(Math.min(p[f+2]*v,65504)),g[m+3]=Hl.toHalfFloat(1)},s=new Uint8Array(t);s.pos=0;let a,o,l,c=function(p){let f,g,m=/^#\?(\S+)/,y=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,v=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,_=/^\s*FORMAT=(\S+)\s*$/,b=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,x={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};for((p.pos>=p.byteLength||!(f=i(p)))&&e(1,"no header found"),(g=f.match(m))||e(3,"bad initial token"),x.valid|=1,x.programtype=g[1],x.string+=f+`
|
|
4164
4164
|
`;f=i(p),f!==!1;)if(x.string+=f+`
|
|
4165
4165
|
`,f.charAt(0)!=="#"){if((g=f.match(y))&&(x.gamma=parseFloat(g[1])),(g=f.match(v))&&(x.exposure=parseFloat(g[1])),(g=f.match(_))&&(x.valid|=2,x.format=g[1]),(g=f.match(b))&&(x.valid|=4,x.height=parseInt(g[1],10),x.width=parseInt(g[2],10)),2&x.valid&&4&x.valid)break}else x.comments+=f+`
|
|
4166
4166
|
`;return 2&x.valid||e(3,"missing format specifier"),4&x.valid||e(3,"missing image size specifier"),x}(s),h=c.width,d=c.height,u=function(p,f,g){let m=f;if(m<8||m>32767||p[0]!==2||p[1]!==2||128&p[2])return new Uint8Array(p);m!==(p[2]<<8|p[3])&&e(3,"wrong scanline width");let y=new Uint8Array(4*f*g);y.length||e(4,"unable to allocate buffer space");let v=0,_=0,b=4*m,x=new Uint8Array(4),w=new Uint8Array(b),S=g;for(;S>0&&_<p.byteLength;){_+4>p.byteLength&&e(1),x[0]=p[_++],x[1]=p[_++],x[2]=p[_++],x[3]=p[_++],(x[0]!=2||x[1]!=2||(x[2]<<8|x[3])!=m)&&e(3,"bad rgbe scanline format");let A,E=0;for(;E<b&&_<p.byteLength;){A=p[_++];let T=A>128;if(T&&(A-=128),(A===0||E+A>b)&&e(3,"bad scanline data"),T){let R=p[_++];for(let L=0;L<A;L++)w[E++]=R}else w.set(p.subarray(_,_+A),E),E+=A,_+=A}let P=m;for(let T=0;T<P;T++){let R=0;y[v]=w[T+R],R+=m,y[v+1]=w[T+R],R+=m,y[v+2]=w[T+R],R+=m,y[v+3]=w[T+R],v+=4}S--}return y}(s.subarray(s.pos),h,d);switch(this.type){case $e:l=u.length/4;let p=new Float32Array(4*l);for(let g=0;g<l;g++)n(u,4*g,p,4*g);a=p,o=$e;break;case qn:l=u.length/4;let f=new Uint16Array(4*l);for(let g=0;g<l;g++)r(u,4*g,f,4*g);a=f,o=qn;break;default:throw new Error("THREE.HDRLoader: Unsupported type: "+this.type)}return{width:h,height:d,data:a,header:c.string,gamma:c.gamma,exposure:c.exposure,type:o,colorSpace:ku,minFilter:de,magFilter:de,generateMipmaps:!1,flipY:!0}}setDataType(t){return this.type=t,this}}});function zO(t){return t.length>2&&t[0]===35&&t[1]===63}var FO,FC,qo,YX=F(()=>{et(),$X()}),CN=F(()=>{et(),AN(),TN(),YX(),FO=0,FC=class extends wN{constructor(t,e){super(t,e.imageHolderCache),this.data=t,this.shared=e,this.instanceId=++FO,this.loaded=!1,this.isVideo=!1,this.isBuffer=!1,this.isHdr=!1,this._cache={1e3:{},1001:{},1002:{}},this.isVideo=t.type==="video",this.isBuffer=t.isWebGLRenderTarget===!0,this.loadPromise=this.updateSrc(this.isBuffer?t:t.data)}async updateSrc(t){if(typeof document>"u")return;this.disposeTextures(),this.loaded=!1,this.isHdr=!1;let e=()=>{this.loaded=!0;for(let n of Object.values(this._cache))for(let r of Object.values(n))for(let s of Object.values(r))s&&(s.image=this.img,s.needsUpdate=!0);this.shared.requestRender()};if(this.isBuffer)this.img=t,this.loaded=!0;else if(this.isVideo){if(this.img=document.createElement("video"),this.img.preload="auto",this.img.playsInline=!0,this.img.currentTime=.01,typeof t!="string"){let n,r=new FileReader;r.readAsDataURL(new Blob([t],{type:"video/mp4"})),await new Promise(s=>{r.onloadend=a=>{n=a.target?.result,s(null)}}),this.img.src=n}else this.img.src=t;this.img.onloadeddata=()=>{e()}}else if(t instanceof Uint8Array?zO(t):typeof t=="string"&&/\.hdr($|[?#])/i.test(t)){let n=t instanceof Uint8Array?t:null;if(n===null)try{n=new Uint8Array(await(await fetch(t)).arrayBuffer())}catch{n=null}let r=n!==null&&zO(n)?function(s){try{let a=new MN().parse(s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength));if(!a||!a.width||!a.height)return null;let{width:o,height:l}=a,c=a.data,h=new Uint16Array(c.length),d=4*o,u=g=>Hl.toHalfFloat(Math.pow(Math.max(Hl.fromHalfFloat(g),0),1/2.2)),p=new Map,f=g=>{let m=p.get(g);return m===void 0&&(m=u(g),p.set(g,m)),m};for(let g=0;g<l;g++){let m=g*d,y=(l-1-g)*d;for(let v=0;v<d;v+=4)h[y+v]=f(c[m+v]),h[y+v+1]=f(c[m+v+1]),h[y+v+2]=f(c[m+v+2]),h[y+v+3]=c[m+v+3]}return{isSplineHdr:!0,data:h,width:o,height:l}}catch{return null}}(n):null;r!==null&&(this.isHdr=!0,this.img=r,e())}else this.img=new Image,this.img.src=typeof(i=t)=="string"?i:(og||(og=new xN),og.load(i)),this.img.onload=e,await new Promise(n=>{this.img.onload=()=>{e(),n(null)}});var i}getTexture(t,e=1008,i=1006){let n=this._cache[t]?.[e]?.[i];if(n)return n;{let r;return this.isBuffer?r=this.img.texture:this.isVideo?r=new dz(this.img,void 0,t,t):this.isHdr?(r=function(s){let a=new Tn(s.data,s.width,s.height,qi,qn);return a.flipY=!1,a.image.isSplineHdr=!0,a.needsUpdate=!0,a}(this.img),r.wrapS=t,r.wrapT=t,r.magFilter=i,r.minFilter=e):r=new zi(this.img,void 0,t,t,i,e),this.isBuffer||(r.anisotropy=8,r.generateMipmaps=e===1008),this.loaded&&(r.needsUpdate=!0),this._cache[t]===void 0&&(this._cache[t]={}),this._cache[t][e]===void 0&&(this._cache[t][e]={}),this._cache[t][e][i]=r,r}}setNeedsUpdate(t){if(!this.isBuffer)for(let e of Object.values(this._cache))for(let i of Object.values(e))for(let n of Object.values(i))n&&(n.needsUpdate=t)}disposeTextures(){for(let[t,e]of Object.entries(this._cache))for(let[i,n]of Object.entries(e))for(let[r,s]of Object.entries(n))s?.dispose(),this._cache[t]!==void 0&&this._cache[t][i]!==void 0&&(this._cache[t][i][r]=void 0)}dispose(){super.dispose(),this.disposeTextures()}}}),NC=F(()=>{CN(),qo=class extends FC{}});function ZX(t){if(typeof t=="string")return t;let e=vA.get(t);return e||(e={url:URL.createObjectURL(new Blob([t]))},vA.set(t,e)),e.url}var vA,KX=F(()=>{vA=new Map});function QX(){if(!yA)return NO||(NO=async function(){await Promise.resolve().then(()=>(hP(),t9)),PN(window!==void 0?window:global),yA=!0}())}var PN,DN,yA,NO,RN=F(()=>{DN=new Promise(t=>{PN=t}),yA=!1});function kO(t,e){t.forEach(i=>{"dragDropActions"in i.data?(e.push(...i.data.dragDropActions.drag),e.push(...i.data.dragDropActions.drop)):"inActions"in i.data?(e.push(...i.data.inActions),e.push(...i.data.outActions)):"gameActions"in i.data?(e.push(...i.data.gameActions.idle),e.push(...i.data.gameActions.move),e.push(...i.data.gameActions.jump),e.push(...i.data.gameActions.run)):"breakpoints"in i.data?i.data.breakpoints.forEach(n=>{e.push(...n.data.actions)}):"actions"in i.data&&(e.push(...i.data.actions),i.data.actions.forEach(n=>{n.data.type==="Conditional"&&n.data.ifActions&&(e.push(...n.data.ifActions),e.push(...n.data.elseActions))}))})}function JX(t){let e=!1,i=[];return t.scene.objects.traverse((n,r)=>{if(r.type==="Page"&&r.uiScene!==void 0&&r.uiScene.objects.traverse((s,a)=>{if(a.events===void 0||Array.isArray(a.events)===!1)return!0;kO(a.events,i),e=e||i.some(o=>o.data.type==="Audio")}),r.events===void 0||Array.isArray(r.events)===!1)return!0;kO(r.events,i),e=e||i.some(s=>s.data.type==="Audio")}),e}var VO,Bu,kC=F(()=>{KX(),RN(),DN.then(t=>VO=t),Bu=class{constructor({src:t,volume:e,delay:i,loop:n}){let r;this._volume=1,this.delay=0,this._loop=1,this.loopsRemaining=0,this._status="stopped",this.onEnd=()=>{this.loopsRemaining===1/0?this.replay():this.loopsRemaining>1?(this.replay(),this.loopsRemaining--):(this._status="stopped",this.loopsRemaining=this._loop)},r=typeof t=="string"?{src:t}:{src:ZX(t),format:"wav"},this.sound=new VO.Howl(r),this.sound.on("end",this.onEnd),this.src=t,e!==void 0&&(this.volume=e),i!==void 0&&(this.delay=i),n!==void 0&&(this.loop=n)}get status(){return this._status}get volume(){return this._volume}set volume(t){this._volume=t,this.sound.volume(t)}get loop(){return this._loop}set loop(t){this._loop=t,this.loopsRemaining=t}replay(){this.clearDelay(),this.delayTimerId=window.setTimeout(()=>{this.sound.play(),this.clearDelay()},this.delay)}fade(t,e=1e3){t?(this.sound.volume(this._volume),this.clearFade(),this.fadeTimerId=window.setTimeout(()=>{this.sound.fade(this._volume,0,e),this.clearFade()},t)):this.sound.fade(this._volume,0,e)}on(t,e,i){this.sound.on(t,e,i)}off(t,e,i){this.sound.off(t,e,i)}play(){this._status==="playing"||this.sound.playing()||(this._status==="paused"?(this.sound.seek()===0?this.replay():this.sound.play(),this._status="playing"):this._status==="stopped"&&(this.replay(),this._status="playing"))}pause(){this._status==="playing"&&(this.sound.pause(),this.clearFade(),this.clearDelay(),this._status="paused")}stop(){this.sound.stop(),this.loopsRemaining=this._loop,this.clearFade(),this.clearDelay(),this._status="stopped"}clearFade(){this.fadeTimerId&&(clearTimeout(this.fadeTimerId),delete this.fadeTimerId)}clearDelay(){this.delayTimerId&&(clearTimeout(this.delayTimerId),delete this.delayTimerId)}dispose(t=!1){this.off(),this.stop(),this.clearFade(),this.clearDelay()}}});function jO(t){let e=!1;return t.scene.objects.traverse((i,n)=>{n.type==="Mesh"&&(n.geometry.type==="TextGeometry"||n.geometry.type==="InputGeometry")&&(e=!0)}),e}var VC,jC=F(()=>{VC=null});function GO(t){return new it(t.y,-t.x)}var GC,_A,IN,ON,vv,HO,Y_,LN,PS,Z_=F(()=>{et(),GC=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=t.parameters?.radiusTop,n=t.parameters?.radiusBottom,r=Object.assign({},e?.parameters??{width:100,radialSegments:64,heightSegments:1,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadius:8,cornerSegments:8,hollow:0},t.parameters);r.thetaLength=Ot.clamp(r.thetaLength,0,360),r.hollow=Ot.clamp(r.hollow??0,0,1);let s=r.width/2,a=r.radiusTop??s,o=r.radiusBottom??s;if(a===o?(a=s,o=s):a>o?(a=s,o=o*s/a):(a=a*s/o,o=s),r.shapeBlendNode){a=i??s,o=n??s;let l=2*Math.max(a,o);r.width=l,r.depth=l}return{parameters:Object.assign(r,{width:Math.abs(r.width),height:Math.abs(r.height??r.width),depth:Math.abs(r.depth??r.width),radiusTop:a,radiusBottom:o})}}static build(t){let e,{width:i,depth:n,height:r,radialSegments:s,heightSegments:a,openEnded:o,thetaStart:l,thetaLength:c,radiusTop:h,radiusBottom:d,cornerRadius:u,cornerSegments:p,hollow:f}=t.parameters;c===0?(e=new Gt,e.setAttribute("position",new Nt([],3))):e=u||f?new _A(h,d,r,s,a,o,l,c*Math.PI/180,u,u,p,f):new Ym(h,d,r,s,a,o,l,c*Math.PI/180);let g=n/i;return g!==1&&e.scale(1,1,g),Object.assign(e,{userData:{...t,type:"CylinderGeometry"}})}},_A=class extends Gt{constructor(t,e,i,n,r,s,a,o,l,c,h,d,u=!1){super(),this.type="RoundedCylinderBufferGeometry",t=t!==void 0?t:1,e=e!==void 0?e:1,i=i||1,n=Math.floor(n)||8,r=Math.floor(r)||1,s=s!==void 0&&s,a=a!==void 0?a:0,o=o!==void 0?o:2*Math.PI,s&&(l=0,c=0);let p=i/2;u&&t==0&&(t=l),u&&e==0&&(e=c);let f=new it(t,p),g=new it(e,-p),m=null,y=null,v=null,_=null,b=f.clone().sub(g),x=0,w=0,S=0;d>0&&(x=Math.min(t,e)*(1-d),w=t-x,S=e-x);let A=f.clone();A.x-=x;let E=Math.PI-b.angle(),P=b.angle(),T=Math.tan(P/2),R=Math.tan(E/2),L=T+R,D=d?L:R,U=d?L:T;if(l=Math.min(l,(t-w)/D,b.length()/L),c=Math.min(c,(e-S)/U,b.length()/L),l>0){let tt=l/T;m=f.clone().sub(new it(tt,l)),d&&(v=m.clone(),v.x-=x-L*l),f.sub(b.clone().setLength(tt))}if(c>0){let tt=c/R;y=g.clone().sub(new it(tt,-c)),g.add(b.clone().setLength(tt)),d&&(_=y.clone(),_.x-=x-L*c,A.sub(b.clone().setLength(tt)))}b=f.clone().sub(g);let V=b.length()<.5,k=[],Y=[],$=[],nt=[],Q=[],rt=[],gt=(tt,ot,pt,ut,Pt)=>{for(let bt=0;bt<h+1;bt++){let Rt=bt/h,_t=ut<0?Rt:1-Rt;Pt&&(_t-=1),_t*=tt;let X=Math.sin(_t),vt=Math.cos(_t)*ut,Dt=vt*ot+pt.y;k.push(X*ot+pt.x),Y.push(Dt),$.push(X),nt.push(vt),Q.push(.5+Dt/i),rt.push(!1)}},at=(tt,ot,pt)=>{let ut=[tt,ot];pt<0&&ut.reverse();for(let Pt of ut)k.push(Pt),Y.push(p*pt),$.push(0),nt.push(pt),Q.push(.5),rt.push(!0)};if(_&&y?(gt(E,c,_,-1,!0),gt(P,c,y,-1,!1)):y?(at(y.x,0,-1),gt(P,c,y,-1,!1)):s||at(e,S,-1),!V){let tt=GO(b).normalize();for(let ot=0;ot<=r;ot++){let pt=ot/r,ut=b.y*pt+g.y;k.push(b.x*pt+g.x),Y.push(ut),$.push(tt.x),nt.push(tt.y),Q.push(.5+ut/i),rt.push(!1)}}if(v&&m?(gt(E,l,m,1,!1),gt(P,l,v,1,!0)):m?(gt(E,l,m,1,!1),at(m.x,0,1)):s||at(t,w,1),d&&!V){let tt=GO(b).multiplyScalar(-1).normalize();for(let ot=0;ot<=r;ot++){let pt=ot/r,ut=b.y*-pt+A.y;k.push(b.x*-pt+A.x),Y.push(ut),$.push(tt.x),nt.push(tt.y),Q.push(.5+ut/i),rt.push(!1)}}let ht=k.length,ct=ht+(d&&!s?1:0),q=(tt,ot)=>tt*ht+(ot===ht?0:ot),lt=o<2*Math.PI,z=(n+1)*ht+(lt?2*(1+ct):0),O=new Float32Array(3*z),j=new Float32Array(3*z),Z=new Float32Array(2*z),I=z-1>65535?new Uint32Array(n*Math.max(0,ct-1)*6+(lt?2*(ct+1)*3:0)):new Uint16Array(n*Math.max(0,ct-1)*6+(lt?2*(ct+1)*3:0)),G=0,W=0;for(let tt=0;tt<=n;tt++){let ot=tt/n,pt=ot*o+a,ut=Math.sin(pt),Pt=Math.cos(pt);for(let bt=0;bt<ht;bt++){let Rt=3*W,_t=2*W,X=k[bt],vt=$[bt];O[Rt]=X*ut,O[Rt+1]=Y[bt],O[Rt+2]=X*Pt,j[Rt]=vt*ut,j[Rt+1]=nt[bt],j[Rt+2]=vt*Pt,rt[bt]?(Z[_t]=.5,Z[_t+1]=.5):(Z[_t]=ot,Z[_t+1]=Q[bt]),W++}}for(let tt=0;tt<n;tt++)for(let ot=0;ot<ct-1;ot++){if(s&&d&&ot==r)continue;let pt=q(tt,ot),ut=q(tt+1,ot),Pt=q(tt+1,ot+1),bt=q(tt,ot+1),Rt=O[3*Pt+0],_t=O[3*Pt+2];I[G++]=pt,I[G++]=ut,I[G++]=bt,(Rt!=0||_t!=0)&&(I[G++]=ut,I[G++]=Pt,I[G++]=bt)}function N(tt,ot,pt){let ut=Math.sin(pt),Pt=Math.cos(pt),bt=-Pt,Rt=ut,_t=tt<0?(Ft,_e,be)=>{I[G++]=Ft,I[G++]=_e,I[G++]=be}:(Ft,_e,be)=>{I[G++]=Ft,I[G++]=be,I[G++]=_e},X=(t+e+w+S)/4,vt=3*W,Dt=2*W;O[vt]=X*ut,O[vt+1]=0,O[vt+2]=X*Pt,j[vt]=bt,j[vt+1]=0,j[vt+2]=Rt,Z[Dt]=.5,Z[Dt+1]=.5;let jt=W++;for(let Ft=0;Ft<ct;Ft++){let _e=3*(ot+(Ft===ht?0:Ft));vt=3*W,Dt=2*W,O[vt]=O[_e],O[vt+1]=O[_e+1],O[vt+2]=O[_e+2],j[vt]=bt,j[vt+1]=0,j[vt+2]=Rt;let be=_e/3*2|0;Z[Dt]=Z[be],Z[Dt+1]=Z[be+1],W++}for(let Ft=jt+1;Ft<W-1;Ft++)_t(jt,Ft,Ft+1);_t(jt,W-1,jt+1)}lt&&(N(-1,0,a),N(1,n*ht,a+o)),this.setIndex(new Ht(I.slice(0,G),1)),this.setAttribute("position",new Ht(O,3)),this.setAttribute("normal",new Ht(j,3)),this.setAttribute("uv",new Ht(Z,2))}}}),WO=F(()=>{et(),Z_(),IN=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,radialSegments:32,heightSegments:8,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadiusTop:8,cornerRadiusBottom:8,cornerSegments:8},t.parameters);return i.thetaLength=Ot.clamp(i.thetaLength,0,360),{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let e,{width:i,depth:n,height:r,radialSegments:s,heightSegments:a,openEnded:o,thetaStart:l,thetaLength:c,cornerRadiusTop:h,cornerRadiusBottom:d,cornerSegments:u}=t.parameters;c===0?(e=new Gt,e.setAttribute("position",new Nt([],3))):e=h>0||d>0||c<360?new _A(0,i/2,r,s,a,o,l,c*Math.PI/180,h,d,u,0,!0):new f_(i/2,r,s,a,o);let p=n/i;return p!==1&&e.scale(1,1,p),Object.assign(e,{userData:{...t,type:"ConeGeometry"}})}}}),qO=F(()=>{et(),ON=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,widthSegments:1,heightSegments:1,depthSegments:1,cornerRadius:8,cornerSegments:8},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let e,{width:i,height:n,depth:r,widthSegments:s,heightSegments:a,depthSegments:o,cornerRadius:l,cornerSegments:c}=t.parameters;return e=l===0?new ga(i,n,r,s,a,o):new HO(i,n,r,s,a,o,l,c),Object.assign(e,{userData:{...t,type:"CubeGeometry"}})}},vv=Math.PI/2,HO=class extends Gt{constructor(t=1,e=1,i=1,n=1,r=1,s=1,a=0,o=4){super(),this.type="BoxGeometry",n=Math.floor(n),r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);let l=(a=Math.min(a,t/2,e/2,i/2))>0,c=o+1,h=2*((s+1)*(r+1)+(n+1)*(s+1)+(n+1)*(r+1))+(l?4*c*(s+1+(n+1)+(r+1))+c*(c+1)/2*8:0),d=2*(s*r+n*s+n*r)+(l?4*o*(s+n+r):0),u=l?8*o*o:0,p=new Float32Array(3*h),f=new Float32Array(3*h),g=new Float32Array(2*h),m=h-1>65535?new Uint32Array(6*d+3*u):new Uint16Array(6*d+3*u),y=0,v=0,_=new Float64Array(c),b=new Float64Array(c),x=new Float64Array(c),w=new Float64Array(c);for(let L=0;L<c;L++){let D=L/o*vv;_[L]=Math.sin(D)*a,b[L]=(1-Math.cos(D))*a,x[L]=Math.sin(D),w[L]=Math.cos(D)}let S=c*(c+1)/2,A=new Float64Array(3*S),E=new Float64Array(3*S);{let L=new C(t/2,e/2,i/2);L.subScalar(a);let D=0;for(let U=0;U<=o;U++){let V=vv*(1-U/o),k=Math.cos(V),Y=Math.sin(V),$=0;for(let nt=0;nt<=U;nt++){let Q=k*Math.cos($),rt=Y,gt=k*Math.sin($);A[3*D]=Q,A[3*D+1]=rt,A[3*D+2]=gt,E[3*D]=L.x+Q*a,E[3*D+1]=L.y+rt*a,E[3*D+2]=L.z+gt*a,D++,$+=vv/U}}}function P(L,D,U,V,k,Y,$,nt,Q,rt){let gt=(Y-2*a)/Q,at=($-2*a)/rt,ht=Y/2-a,ct=$/2-a,q=nt/2,lt=Q+1,z=rt+1,O=0,j=new C;for(let Z=0;Z<z;Z++){let I=Z*at-ct;for(let G=0;G<lt;G++){let W=G*gt-ht,N=3*(y+O),tt=2*(y+O);j[L]=W*V,j[D]=I*k,j[U]=q,p[N]=j.x,p[N+1]=j.y,p[N+2]=j.z,j[L]=0,j[D]=0,j[U]=nt>0?1:-1,f[N]=j.x,f[N+1]=j.y,f[N+2]=j.z,g[tt]=G/Q,g[tt+1]=1-Z/rt,O+=1}}for(let Z=0;Z<rt;Z++)for(let I=0;I<Q;I++){let G=y+I+lt*Z,W=y+I+lt*(Z+1),N=y+(I+1)+lt*(Z+1),tt=y+(I+1)+lt*Z;m[v++]=G,m[v++]=W,m[v++]=tt,m[v++]=W,m[v++]=N,m[v++]=tt}y+=O}function T(L,D,U,V,k,Y,$,nt,Q,rt){let gt=($-2*a)/rt,at=$/2-a,ht=nt/2-a,ct=Q/2,q=rt+1,lt=0,z=new C,O=new C;for(let j=0;j<o+1;j++){z[D]=(ht+_[j])*k,z[U]=(ct-b[j])*Y,O[L]=0,O[D]=x[j]*Math.sign(z[D]),O[U]=w[j]*Math.sign(z[U]);for(let Z=0;Z<q;Z++){let I=Z*gt-at;z[L]=I*V;let G=3*(y+lt),W=2*(y+lt);p[G]=z.x,p[G+1]=z.y,p[G+2]=z.z,f[G]=O.x,f[G+1]=O.y,f[G+2]=O.z,g[W]=Z/rt,g[W+1]=0,lt+=1}}for(let j=0;j<o;j++)for(let Z=0;Z<rt;Z++){let I=y+Z+q*j,G=y+Z+q*(j+1),W=y+(Z+1)+q*(j+1),N=y+(Z+1)+q*j;m[v++]=I,m[v++]=G,m[v++]=N,m[v++]=G,m[v++]=W,m[v++]=N}y+=lt}function R(L,D,U){let V=L*D*U>0?(Y,$,nt)=>{m[v++]=Y,m[v++]=$,m[v++]=nt}:(Y,$,nt)=>{m[v++]=Y,m[v++]=nt,m[v++]=$},k=y;for(let Y=0;Y<S;Y++){let $=3*Y,nt=3*y,Q=2*y;p[nt]=L*E[$],p[nt+1]=D*E[$+1],p[nt+2]=U*E[$+2],f[nt]=L*A[$],f[nt+1]=D*A[$+1],f[nt+2]=U*A[$+2],g[Q]=0,g[Q+1]=0,y++}for(let Y=0;Y<o;Y++){let $=k+Y*(Y+1)/2,nt=k+(Y+1)*(Y+2)/2;V($,nt+1,nt);for(let Q=1;Q<=Y;Q++)V($+Q-1,$+Q,nt+Q),V($+Q,nt+Q+1,nt+Q)}}P("z","y","x",-1,-1,i,e,t,s,r),P("z","y","x",1,-1,i,e,-t,s,r),P("x","z","y",1,1,t,i,e,n,s),P("x","z","y",1,-1,t,i,-e,n,s),P("x","y","z",1,-1,t,e,i,n,r),P("x","y","z",-1,-1,t,e,-i,n,r),a>0&&(T("z","y","x",-1,-1,1,i,e,t,s),T("z","y","x",1,-1,-1,i,e,t,s),T("z","y","x",-1,1,-1,i,e,t,s),T("z","y","x",1,1,1,i,e,t,s),T("x","y","z",-1,-1,-1,t,e,i,n),T("x","y","z",1,-1,1,t,e,i,n),T("x","y","z",-1,1,1,t,e,i,n),T("x","y","z",1,1,-1,t,e,i,n),T("y","x","z",-1,-1,1,e,t,i,r),T("y","x","z",1,-1,-1,e,t,i,r),T("y","x","z",1,1,1,e,t,i,r),T("y","x","z",-1,1,-1,e,t,i,r),R(1,1,1),R(-1,1,1),R(1,-1,1),R(-1,-1,1),R(1,1,-1),R(-1,1,-1),R(1,-1,-1),R(-1,-1,-1)),this.setIndex(new Ht(m,1)),this.setAttribute("position",new Ht(p,3)),this.setAttribute("normal",new Ht(f,3)),this.setAttribute("uv",new Ht(g,2))}}}),BN=F(()=>{et(),Y_=class extends Gt{constructor(t=[],e=[],i="",n=1,r=.2,s=4){super(),this.type="PolyhedronGeometryRound";let a,o,l,c=0;return function(){(r=Math.min(.99999,r))==0&&(s=0);let h={IcosahedronGeometry:5,DodecahedronGeometry:3,HexahedronGeometry:3,OctahedronGeometry:4,TetrahedronGeometry:3}[i],d=new C,u=d.clone(),p=new un,f=r*n,g=n-f,m=s+1,y=new C,v=(q,lt)=>y.subVectors(q,lt).normalize(),_=(q,lt)=>Array(q).fill(void 0).map(lt),b=_(t.length/3,(q,lt)=>new C().fromArray(t,3*lt).setLength(n)),x=[],w=1e6;for(let q=0;q<b.length;q++){let lt,z,O,j=b[q],Z=[],I=1e10,G=-1;for(;(G=e.indexOf(q,G+1))!=-1;){let ot=G-G%3;lt=e[ot+(G+1)%3],z=e[ot+(G+2)%3],O=j.distanceToSquared(b[lt]),I=Math.min(I,O),Z.push([lt,z,O])}I+=1e-6;let W=[],N=0,tt=Z.length;for(let ot=0;ot<tt;ot++){[lt,z,O]=Z[N];let pt=x[lt]?.includes(q)==1;O<=I&&W.push(lt+ +pt*w),N=Z.findIndex(ut=>ut[0]==z)}x.push(W)}let S=[];{let q,lt,z=0,O=0,j=h==3;for(let Z=0;Z<=s;Z++){q=Z*(Z+1)/2,lt=(Z+1)*(Z+2)/2;for(let I=0;I<s-Z;I++)[z,O]=[q+I+Z+2,lt+I+Z+3],S.push(q,lt,...j?[O,q]:[z,lt],O,z),[q,lt]=[z,O];S.push(q,lt,q+s+2)}}let A=0;for(let q=0;q<x.length;q++)for(let lt=0;lt<h;lt++)x[q][lt]<w&&A++;let E=b.length*h*S.length*3+A*m*6*3+2*A*3*3;a=new Float64Array(E),o=new Float64Array(E),l=new Float64Array(E/3*2);let P=(q,lt,z)=>{let O=c/3*2;l[O]=Math.atan2(z,-q)/2/Math.PI+.5,l[O+1]=1-(Math.atan2(-lt,Math.sqrt(q*q+z*z))/Math.PI+.5)},T=q=>{a[c]=q.x,a[c+1]=q.y,a[c+2]=q.z,o[c]=y.x,o[c+1]=y.y,o[c+2]=y.z,P(q.x,q.y,q.z),c+=3},R=q=>{a[c]=q[0].x,a[c+1]=q[0].y,a[c+2]=q[0].z,o[c]=q[1].x,o[c+1]=q[1].y,o[c+2]=q[1].z,P(q[0].x,q[0].y,q[0].z),c+=3},L=(s+2)*(s+3)/2,D=new Float64Array(3*L),U=new Float64Array(3*L),V=new Float64Array(2*L),k=_(2*h*m,()=>new C),Y=_(s*Math.max(0,s-1)/2,()=>new C),$=d.clone(),nt=d.clone(),Q=d.clone(),rt=d.clone(),gt=d.clone(),at=[],ht=_(b.length,()=>_(h,()=>d.clone()));for(let q=0;q<b.length;q++){d.copy(b[q]).normalize(),$.copy(d).multiplyScalar(g);let lt=x[q];for(let W=0;W<lt.length;W++){let N=lt[W],tt=lt[(W+1)%h];p.setFromPointsAndIndices(b,q,N%w,tt%w),p.b.sub(p.a).setLength(1e10).add(p.a),p.c.sub(p.a).setLength(1e10).add(p.a),p.closestPointToPoint($,ht[q][W])}let z=0,O=[],j=[],Z=new C;s==0&&[...ht[q]].reduce((W,N)=>W.add(N),Z).multiplyScalar(1/h);for(let W=0;W<h;W++){let N=[],tt=(W-1+h)%h,ot=ht[q][tt],pt=ht[q][W];d.copy(ot).sub($),u.copy(pt).sub($);let ut=$.angleTo(d),Pt=d.angleTo(u),bt=Math.cos(ut)*f;s==0?nt.copy(Z):nt.copy($).setLength(g+bt),O.push(bt);let Rt=[nt,ot,pt];for(let _t=0;_t<2;_t++){let X=Rt[_t],vt=Rt[_t+1];rt.subVectors(X,$),gt.subVectors(vt,$),Q.crossVectors(rt,gt).normalize();for(let Dt=0;Dt<m;Dt++){let jt=[ut,Pt][_t]*Dt/m;d.copy(rt).applyAxisAngle(Q,jt).add($),k[z++].copy(d),_t&&(v(d,$),N.push([Dt==0?X:d.clone(),y.clone()]))}_t&&(v(vt,$),N.push([vt,y.clone()]))}j.push(N)}at.push(j);let I=2*m,G=2;for(let W=0;W<h;W++){let N=I*W,tt=I*((W+1)%h),ot=0,pt=[k[N]];for(let ut=1;ut<m;ut++){let Pt=k[N+ut],bt=k[tt+ut];pt.push(Pt);for(let Rt=1,_t=ut-G+1;Rt<=_t;Rt++)d.lerpVectors(Pt,bt,Rt/(_t+1)),d.sub($).setLength(O[W]).add($),pt.push(Y[ot++].copy(d));pt.push(bt)}for(let ut=0;ut<m;ut++)pt.push(k[ut+m+N]);pt.push(k[tt+m]);for(let ut=0,Pt=pt.length;ut<Pt;ut++){let bt=pt[ut],Rt=3*ut,_t=2*ut;D[Rt]=bt.x,D[Rt+1]=bt.y,D[Rt+2]=bt.z,v(bt,$),U[Rt]=y.x,U[Rt+1]=y.y,U[Rt+2]=y.z,V[_t]=Math.atan2(bt.z,-bt.x)/2/Math.PI+.5,V[_t+1]=1-(Math.atan2(-bt.y,Math.sqrt(bt.x*bt.x+bt.z*bt.z))/Math.PI+.5)}for(let ut=0,Pt=S.length;ut<Pt;ut++){let bt=3*S[ut],Rt=2*S[ut],_t=c/3*2;a[c]=D[bt],a[c+1]=D[bt+1],a[c+2]=D[bt+2],o[c]=U[bt],o[c+1]=U[bt+1],o[c+2]=U[bt+2],l[_t]=V[Rt],l[_t+1]=V[Rt+1],c+=3}}}let ct=[];for(let q=0;q<x.length;q++)for(let lt=0;lt<h;lt++){let z=x[q][lt];if(z<w){let O=x[z].findIndex(I=>I%w==q),j=at[q][lt],Z=at[z][O];for(let I=0;I<m;I++){let G=j[I],W=Z[m-I],N=j[I+1],tt=Z[m-(I+1)];R(G),R(W),R(N),R(N),R(W),R(tt)}ct.push(j[0][0],Z[m][0],j[m][0],Z[0][0])}}for(;ct.length;){let q,lt,z,[O,j]=ct.splice(0,2);q=j;let Z=[O];for(;O!=q;)Z.push(q),lt=ct.indexOf(q),z=lt%2,q=ct.splice(lt-z,2)[1-z];y.subVectors(Z[0],Z[1]).cross(d.subVectors(Z[0],Z[2])).normalize();let I=y.dot(Z[0])<0;I&&y.negate();for(let G=1;G<=Z.length-2;G++)T(Z[G+ +I]),T(Z[G+1-+I]),T(Z[0])}}(),function(){let h=new C,d=new C,u=new C,p=new C,f=new it,g=new it,m=new it,y=(b,x,w,S)=>{S<0&&b.x===1&&(l[x]=b.x-1),w.x===0&&w.z===0&&(l[x]=S/2/Math.PI+.5)};for(let b=0,x=0;b<c;b+=9,x+=6){h.set(a[b+0],a[b+1],a[b+2]),d.set(a[b+3],a[b+4],a[b+5]),u.set(a[b+6],a[b+7],a[b+8]),f.set(l[x+0],l[x+1]),g.set(l[x+2],l[x+3]),m.set(l[x+4],l[x+5]),p.copy(h).add(d).add(u).divideScalar(3);let w=_(p);y(f,x+0,h,w),y(g,x+2,d,w),y(m,x+4,u,w)}let v=c/3*2;for(let b=0;b<v;b+=6){let x=l[b+0],w=l[b+2],S=l[b+4],A=Math.max(x,w,S),E=Math.min(x,w,S);A>.9&&E<.1&&(x<.2&&(l[b+0]+=1),w<.2&&(l[b+2]+=1),S<.2&&(l[b+4]+=1))}function _(b){return Math.atan2(b.z,-b.x)}}(),this.setAttribute("position",new Ht(new Float32Array(a.subarray(0,c)),3)),this.setAttribute("normal",new Ht(new Float32Array(o.subarray(0,c)),3)),void this.setAttribute("uv",new Ht(new Float32Array(l.subarray(0,c/3*2)),2))}static fromJSON(t){return new Y_(t.vertices,t.indices,t.radius,t.corner,t.cornerSides)}}}),XO=F(()=>{BN(),et(),LN=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,detail:0,corner:0,cornerSides:4},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let{width:e,height:i,depth:n,detail:r,corner:s,cornerSides:a}=t.parameters,o=r===0&&s!==0?new PS(.5*e,s,a):new nE(.5*e,r),l=i/e,c=n/e;return(l!==1||c!==1)&&o.scale(1,l,c),Object.assign(o,{userData:{...t,type:"DodecahedronGeometry"}})}},PS=class extends Y_{constructor(t=1,e=.2,i=4){let n=(1+Math.sqrt(5))/2,r=1/n,s="DodecahedronGeometry";super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],s,t,e,i),this.type=s}static fromJSON(t){return new PS(t.radius,t.corner,t.cornerSides)}}});function $O(t,e=new it){let i=t.length();return e.set(-t.y/i,t.x/i)}function t$(t){let e=new it;e.addVectors(t.v0,Cc.subVectors(t.v1,t.v0).multiplyScalar(2/3));let i=new it;return i.addVectors(t.v2,Ug.subVectors(t.v1,t.v2).multiplyScalar(2/3)),new zs(t.v0,e,i,t.v2)}function Om(t,e,i=Number.EPSILON){return Math.abs(t-e)<i}function e$(t,e,i=Number.EPSILON){return t.distanceTo(e)<i}function i$(t,e,i=Number.EPSILON){return t.distanceTo(e)<i}function UN(t,e,i){let n=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),r=Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2)),s=Math.sqrt(Math.pow(i.x-t.x,2)+Math.pow(i.y-t.y,2));return Math.acos((r*r+n*n-s*s)/(2*r*n))}function n$(t,e,i){return ZO(t,e)&&ZO(e,i)&&bA(t.position,e.position,i.position)}function bA(t,e,i){return Cc.copy(e).sub(t).cross(Ug.copy(i).sub(t))===0}function r$(t,e,i,n,r){let s=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),a=(t.y+e.y)/2,o=(t.x+e.x)/2,l=Math.sqrt(Math.pow(i,2)-Math.pow(s/2,2))*(t.y-e.y)/s,c=Math.sqrt(Math.pow(i,2)-Math.pow(s/2,2))*(e.x-t.x)/s;return n.set(o+l,a+c),r.set(o-l,a-c),[n,r]}function s$(t,e,i){return t.distanceTo(i)<e.distanceTo(i)?e:t}function a$(t,e,i,n,r,s){let a,o=e.x-t.x,l=e.y-t.y,c=i.x-t.x,h=i.y-t.y,d=Math.sqrt((o+c)*(o+c)+(l+h)*(l+h));return UN(e,t,i)>Math.PI&&(d*=-1),a=Om(h,l)?(l+h)*(n/d-.5)*8/3/(o-c):(o+c)*(n/d-.5)*8/3/(h-l),r.set(e.x-a*l,e.y+a*o),s.set(i.x+a*h,i.y-a*c),[r,s]}function YO(t,e){return t.position.equals(t.controls[1].position)&&e.position.equals(e.controls[0].position)}function ZO(t,e){return bA(t.position,t.controls[1].position,e.position)&&bA(t.position,e.controls[0].position,e.position)}function KO(t,e=12,i=!1){let n=[];for(let r=0,s=t.length;r<s;r++){let a=t[r],o=0;if(i&&a.roundedCurveCorner!==void 0){let l=.5*Tc(a.roundedCurveCorner,e);r>0&&(n[r-1]+=l),o+=l}a.curveAfter!==void 0&&(o+=Tc(a.curveAfter,e)),n.push(o)}return t.length>0&&i&&t[0].roundedCurveCorner!==void 0&&(n[t.length-1]+=.5*Tc(t[0].roundedCurveCorner,e)),n}function Tc(t,e=12){return t&&t instanceof bm?2*e:t&&(t instanceof ps||t instanceof rE)?1:t&&t instanceof t1?e*t.points.length:e}var Eu,yv,_v,Uc,p1,Cc,Ug,zN,FN,NN,kN,xA,wA,bv,QO,JO,t4,e4,i4,Ni,VN=F(()=>{et(),Eu=1e-12,yv=class{constructor(t){this.position=new it,this.startPosition=new it,this.uuid=Ot.generateUUID(),this.position=t.clone()}start(){this.reset()}reset(){this.startPosition.copy(this.position)}applyOffset(t){this.position.copy(this.startPosition).add(t)}copy(t){return this.position.copy(t.position),this.startPosition.copy(t.startPosition),this}clone(){return new yv(this.position).copy(this)}toJSON(){return[this.position.x,this.position.y]}},_v=class extends yv{constructor(t){super(t.position),this.parent=t}copy(t){return super.copy(t),this}clone(){return new _v(this.parent).copy(this)}},Uc=class extends yv{constructor(t,e){super(e),this.controls=[],this.roundness=0,this.areControlsDirectionsMirrored=!0,this.uuid=t,this.controls.push(new _v(this),new _v(this))}static create(t,e){let i=new Uc(t,new it(...e.position));return i.controls[0].position.set(...e.controlPrevious.position),i.controls[1].position.set(...e.controlNext.position),i.roundness=e.roundness,i.areControlsDirectionsMirrored=e.areControlsDirectionsMirrored,i}getOppositeControl(t){let e=this.controls.indexOf(t);return e===0?this.controls[1]:e===1?this.controls[0]:null}applyOffsetToControls(t,e=1){for(let i=0,n=this.controls.length;i<n;i++){let r=this.controls[i];this.position.distanceTo(r.position)<=e?r.position.copy(this.position):r.applyOffset(t)}}controlsMoved(){return!(this.position.equals(this.controls[0].position)&&this.position.equals(this.controls[1].position))}copy(t){return super.copy(t),this.controls[0].copy(t.controls[0]),this.controls[1].copy(t.controls[1]),this.roundness=t.roundness,this.uuid=t.uuid,this}clone(){return new Uc(this.uuid,this.position).copy(this)}toJSON(){return super.toJSON().concat(this.controls[0].toJSON(),this.controls[1].toJSON(),[this.roundness])}computeTangents(){let t=this.curveBefore?.getTangentAt(1),e=this.curveAfter?.getTangentAt(0);return[t,e]}computeNormals(t=new it,e=new it){let[i,n]=this.computeTangents();return i&&n&&($O(i,t),$O(n,e)),[t,e]}computeTangent(t=new it){let[e,i]=this.computeTangents();return e&&i&&t.copy(e).add(i).normalize(),t}computeNormal(t=new it){let[e,i]=this.computeNormals();return t.copy(e).add(i).normalize(),t}},p1=t=>t,Cc=new it,Ug=new it,zN=new it,FN=new it,NN=new it,kN=new it,xA=new C,wA=new C}),yh=F(()=>{et(),VN(),bv=new it,QO=new it,JO=new it,t4=new it,e4=new it,i4=new it,Ni=class extends xg{constructor(t=100,e=100){super(),this.points=[],this.shapeHoles=[],this.plane=new kr(new C(0,0,-1)),this.subdivision=0,this.controlSnapDistance=4,this.pointIDs=0,this.isMesh2D=!1,this.isText=!1,this._roundness=0,this.isClosed=!1,this.useCubicForRoundedCorners=!0,this.uuid=Ot.generateUUID(),this.needsUpdate=!1,this.roundedCurves=[],this._width=t,this._height=e}static createFromState(t,e,i){let n=new Ni;return n.isClosed=t.isClosed,n.points=t.points.map(r=>Uc.create(r.id,r.data)),typeof t.roundness=="number"&&(n.roundness=t.roundness),n.shapeHoles=t.shapeHoles.map(r=>Ni.createFromState(r)),e!==void 0&&i!==void 0&&n.applySize(e,i),n.update(),n}get width(){return this._width}get height(){return this._height}get roundness(){return this._roundness}set roundness(t){if(this._roundness!==t){this._roundness=t;for(let e=0,i=this.points.length;e<i;e++)this.points[e].roundness=t;this.needsUpdate=!0}}getPointsIndexesByIds(t){return t.map(e=>this.getPointIndexById(e)).filter(e=>e>=0)}getPointIndexById(t){let e=this.points.length,i=this.points.findIndex(n=>n.uuid===t);if(i<0){let n=e;for(let r=0,s=this.shapeHoles.length;r<s;r++){let a=this.shapeHoles[r],o=a.points.length,l=a.getPointIndexById(t);if(!(l<0))return l+n;n+=o}}return i}getLineIndexById(t){return this.getPointIndexById(t)}getBezierPoint(t){if(t<=this.points.length-1)return this.points[t];if(this.shapeHoles.length>0){let e=this.points.length;for(let i=0,n=this.shapeHoles.length;i<n;i++){let r=this.shapeHoles[i],s=t-e;if(s<=r.points.length-1)return r.points[s];e+=r.points.length}}throw new Error("This shape does not have a point for this index: "+t)}getBezierPointIndex(t){let e=this.points.indexOf(t);if(e>=0)return e;if(e=this.points.length,this.shapeHoles.length>0)for(let i=0,n=this.shapeHoles.length;i<n;i++){let r=this.shapeHoles[i],s=r.points.indexOf(t);if(s>=0)return e+s;e+=r.points.length}return-1}getAllPoints(){let t=[].concat(...this.shapeHoles.map(e=>e.points));return[...this.points,...t]}applySize(t,e){t===0&&(t=.001),e===0&&(e=.001),this._width=t,this._height=e}applyScale(t,e){let i=bv.set(t,e);for(let n=0,r=this.points.length;n<r;n++){let s=this.points[n];s.position.multiply(i),s.controls[0].position.multiply(i),s.controls[1].position.multiply(i)}for(let n=0,r=this.shapeHoles.length;n<r;n++)this.shapeHoles[n].applyScale(t,e);this._update()}createPoint(t,e=0,i=Ot.generateUUID()){let n;n=t instanceof it?t:new it(t,e);let r=new Uc(i,n);return r.roundness=this.roundness,r}addPoint(t){this.points.push(t),this.needsUpdate=!0}addPointAt(t,e){this.points.splice(e,0,t),this.needsUpdate=!0}getPointByUuid(t){for(let e=0,i=this.points.length;e<i;e++){let n=this.points[e];if(n.uuid===t)return n}for(let e=0,i=this.shapeHoles.length;e<i;e++){let n=this.shapeHoles[e].getPointByUuid(t);if(n)return n}}getFirstPoint(){return this.points[0]}getLastPoint(){return this.points[this.points.length-1]}removePoint(t){let e=this.points.indexOf(t);e>=0&&this.points.splice(e,1),this.needsUpdate=!0}removePointById(t){let e=this.points.find(i=>i.uuid===t);e&&this.removePoint(e)}update(){for(let t=0,e=this.shapeHoles.length;t<e;t++)this.shapeHoles[t].update();this._update()}extractShapePointsToBuffer(t,e=12,i=!1){this.subdivision=e,this.curveDivisions===void 0&&this.computeCurveDivisions(e);let n=i?this.roundedCurveDivisions:this.curveDivisions;return function(r,s,a=12,o=!0){let l,c=wA.set(0,0,0),h=0,d=[];for(let u=0;u<s.length;u++){let p=p1(s[u]),f=Cc,g=Tc(p,a);d.push(g);for(let m=0;m<=g;m++)if(p instanceof zs||p instanceof Go||p instanceof ps){if(p.getPoint(m/g,f),c.set(f.x,f.y,0),l!==void 0&&i$(l,c))continue;l===void 0&&(l=xA),l.copy(c),r.setXYZ(h,c.x,c.y,c.z),h++}}o&&h>1&&(r.getX(h-1)!==r.getX(0)||r.getY(h-1)!==r.getY(0)||r.getZ(h-1)!==r.getZ(0))&&(r.setXYZ(h,r.getX(0),r.getY(0),r.getZ(0)),h++)}(t,i?this.roundedCurves:this.curves,e,this.autoClose),n.reduce((r,s)=>r+s,0)+1}computeCurveDivisions(t=12){return this.curveDivisions=KO(this.points,t,!1),this.roundedCurveDivisions=KO(this.points,t,!0),this.curveDivisions}extractFilteredShapePointsToBuffer(t,e,i=12){return 2*function(n,r,s,a=12,o=!0){let l=wA.set(0,0,0),c=0,h=[];for(let d=0;d<r.length;d++){if(s[d]===!1)continue;let u,p=p1(r[d]),f=Cc,g=Tc(p,a);h.push(g);for(let m=0;m<=g;m++)if(p instanceof zs||p instanceof Go||p instanceof ps){if(p.getPoint(m/g,f),l.set(f.x,f.y,0),u?.equals(l))continue;u===void 0?u=xA:(n.setXYZ(c,u.x,u.y,u.z),c++,n.setXYZ(c,l.x,l.y,l.z),c++),u.copy(l)}}return o&&c>1&&!(n.getX(c-1)===n.getX(0)&&n.getY(c-1)===n.getY(0)&&n.getZ(c-1)===n.getZ(0))&&(n.setXYZ(c,n.getX(0),n.getY(0),n.getZ(0)),c++),h}(t,this.curves,e,i,this.autoClose).reduce((n,r)=>n+r,0)}extractShapePointsToFlatArray(t,e=12){return this.subdivision=e,this.curveDivisions===void 0&&this.computeCurveDivisions(e),function(i,n,r=12,s=!0){let a,o=0;for(let l=0;l<n.length;l++){let c=p1(n[l]),h=Tc(c,r),d=Cc;for(let u=0;u<=h;u++)if(c instanceof zs||c instanceof Go||c instanceof ps){if(c.getPoint(u/h,d),a!==void 0&&e$(a,d,Eu))continue;a===void 0&&(a=Ug),a.copy(d),i.push(d.x,d.y),o++}}return Om(i[0],i[i.length-2],Eu)&&Om(i[1],i[i.length-1],Eu)&&(i.pop(),i.pop()),s&&o>1&&!(Om(i[o-1],i[1],Eu)&&Om(i[o-2],i[0],Eu))&&(i.push(i[0],i[1]),o++),i}(t,this.roundedCurves,e,this.autoClose)}getCurveIndexFromVertexId(t,e=!1){let i=0;this.curveDivisions===void 0&&this.computeCurveDivisions(this.subdivision);let n=e?this.roundedCurveDivisions:this.curveDivisions,r=0;e&&this.points[0].roundedCurveCorner!==void 0&&(r=.5*Tc(this.points[0].roundedCurveCorner,this.subdivision));let s=t-r;s<0&&(s+=n.reduce((a,o)=>a+o,0));for(let a=0,o=n.length;a<o;a++){let l=n[a];if(s<i+l)return[a,(s-i+1)/l];i+=l}return[0,1]}getCurveT(t,e,i){let n=this.points[t],r=this.points[t>=this.points.length-1?0:t+1],s=this.curveDivisions,a=s[t];if(YO(n,r)){let l=n.position.distanceTo(r.position);return n.position.distanceTo(bv.set(i.x,i.y))/l}let o=0;for(let l=0;l<t;l++)o+=s[l];return(e-o)/a}dispose(){}_applyCurveForPoint(t,e){YO(e,t)?this.lineTo(t.position.x,t.position.y):this.bezierCurveTo(e.controls[1].position.x,e.controls[1].position.y,t.controls[0].position.x,t.controls[0].position.y,t.position.x,t.position.y);let i=this.curves[this.curves.length-1];t.curveBefore=i,e.curveAfter=i;let n=i.clone();t.roundedCurveBefore=n,e.roundedCurveAfter=n,t.roundedCurveCorner=void 0,this.roundedCurves.push(n)}_update(){if(this.curves=[],this.roundedCurves=[],!this.points.length)return;for(let e=0,i=this.points.length;e<i;e++){let n=this.points[e];if(e===0)this.moveTo(n.position.x,n.position.y);else{let r=this.points[e-1];this._applyCurveForPoint(n,r)}}let t=this.getLastPoint();if(t?.curveAfter&&(t.curveAfter=void 0),this.isClosed){let e=this.points[0],i=this.points[this.points.length-1];this._applyCurveForPoint(e,i)}if(this.points.length>2){let e=0;for(let i=0,n=this.points.length;i<n;i++){let r=this.points[i],s=this.points[i-1]??this.points[this.points.length-1],a=this.points[i+1]??this.points[0],o=r.roundness,l=s&&a&&n$(s,r,a);if(!r.controlsMoved()&&o>0&&!l){let c=r.curveBefore,h=r.curveAfter;if(c===void 0||h===void 0)continue;let d,u=r.roundedCurveBefore,p=r.roundedCurveAfter,f=c instanceof ps?c.v1.distanceTo(c.v2):c.getLength(),g=h instanceof ps?h.v1.distanceTo(h.v2):h.getLength(),m=Math.min(o,.499*f),y=Math.min(o,.499*g),v=Math.min(m,y),_=1-v/f,b=v/g,x=c.getPointAt(_,bv),w=h.getPointAt(b,QO);if(this._subSplitCurve(c,u,_,x,void 0),this._subSplitCurve(h,p,b,void 0,w),this.useCubicForRoundedCorners){let S=UN(x,r.position,w)/2,A=Math.tan(S)*x.distanceTo(r.position),[E,P]=r$(x,w,A,JO,t4),T=s$(E,P,r.position),[R,L]=a$(T,x,w,A,e4,i4);d=new zs(x.clone(),R.clone(),L.clone(),w.clone())}else d=new Go(x.clone(),r.position.clone(),w.clone());r.roundedCurveCorner=d,this.roundedCurves.splice(i+e,0,d),e++}}}}_subSplitCurve(t,e,i,n,r){if(!(t instanceof ps)){let s=t,a=e,o=s.getUtoTmapping(i,0),l=function(c,h,d,u,p=.5){let f=Cc.subVectors(h,c).multiplyScalar(p).add(c),g=Ug.subVectors(d,h).multiplyScalar(p).add(h),m=zN.subVectors(u,d).multiplyScalar(p).add(d),y=f,v=FN.subVectors(g,f).multiplyScalar(p).add(f),_=NN.subVectors(m,g).multiplyScalar(p).add(g),b=m,x=kN.subVectors(_,v).multiplyScalar(p).add(v);return[c.x,c.y,y.x,y.y,v.x,v.y,x.x,x.y,_.x,_.y,b.x,b.y,u.x,u.y]}(s.v0,s.v1,s.v2,s.v3,o);return n!==void 0&&(a.v0.set(l[0],l[1]),a.v1.set(l[2],l[3]),a.v2.set(l[4],l[5]),a.v3.set(l[6],l[7])),r!==void 0&&(a.v0.set(l[6],l[7]),a.v1.set(l[8],l[9]),a.v2.set(l[10],l[11]),a.v3.set(l[12],l[13])),a}return n!==void 0&&e.v2.copy(n),r!==void 0&&e.v1.copy(r),e}clone(){let t=new Ni(this._width,this._height);return t.points=this.points.map(e=>e.clone()),t.isClosed=this.isClosed,t.roundness=this.roundness,t.isMesh2D=this.isMesh2D,t.shapeHoles=this.shapeHoles.map(e=>e.clone()),t}toJSON(){return{points:this.points.reduce((t,e)=>t.concat(e.toJSON()),[]),shapeHoles:this.shapeHoles.map(t=>t.toJSON()),isClosed:this.isClosed,roundness:this.roundness}}fromJSON(t){this.points=[],this.pointIDs=0;let e=t.points.length/7;for(let i=0;i<e;i++){let n=7*i,r=t.points[n+0],s=t.points[n+1],a=t.points[n+2],o=t.points[n+3],l=t.points[n+4],c=t.points[n+5],h=t.points[n+6],d=new Uc(Ot.generateUUID(),new it(r,s));d.controls[0].position.set(a,o),d.controls[1].position.set(l,c),d.roundness=h,this.points.push(d)}return this.shapeHoles=t.shapeHoles?.length?t.shapeHoles.map(i=>{let n=new Ni;return n.fromJSON(i),n}):[],this.isClosed=t.isClosed,this._roundness=t.roundness,this._update(),this}fromShape(t,e=!1){this.isText=e;let i=(n,r)=>{r instanceof zs&&r.v3.equals(n.position)&&n.controls[0].position.copy(r.v2)};return this.points=(n=>{let r,s,a=[];for(r=0,s=n.length;r<s;r++)n[r]instanceof Go&&(n[r]=t$(n[r]));for(r=0,s=n.length;r<s;r++){let c,h=n[r],d=r>0?n[r-1]:null;h instanceof zs?(c=this.createPoint(h.v0),c.controls[1].position.copy(h.v1)):h instanceof ps&&(c=this.createPoint(h.v1)),c!==void 0&&(d!==null&&i(c,d),a.push(c))}let o=n[n.length-1],l=!1;return o instanceof zs?o.v3.equals(a[0].position)&&(a[0].controls[0].position.copy(o.v2),l=!0):o instanceof ps&&o.v2.equals(a[0].position)&&(l=!0),this.isClosed=l,a})(t.curves),t instanceof xg&&(this.shapeHoles=t.holes.map(n=>{let r=new Ni;return r.fromShape(n),r})),this.update(),this}updatePoint(t,e){let i=this.getPointByUuid(t);i&&(e.position!==void 0&&i.position.fromArray(e.position),e.roundness!==void 0&&(i.roundness=e.roundness),e.areControlsDirectionsMirrored!==void 0&&(i.areControlsDirectionsMirrored=e.areControlsDirectionsMirrored),this.needsUpdate=!0)}updatePreviousControl(t,e){let i=this.getPointByUuid(t)?.controls[0];i&&(e.position&&i.position.fromArray(e.position),this.needsUpdate=!0)}updateNextControl(t,e){let i=this.getPointByUuid(t)?.controls[1];i&&(e.position&&i.position.fromArray(e.position),this.needsUpdate=!0)}}});function DS({x:t,y:e},i,n,r,s){return{x:t*i+r,y:e*n+s}}function o$(t,e){let i=e===1.5707963267948966?.551915024494:e===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(e/4),n=Math.cos(t),r=Math.sin(t),s=Math.cos(t+e),a=Math.sin(t+e);return[{x:n-r*i,y:r+n*i},{x:s+a*i,y:a-s*i},{x:s,y:a}]}function n4(t,e,i,n){let r=t*n-e*i<0?-1:1,s=Math.min(1,Math.max(-1,t*i+e*n));return r*Math.acos(s)}var f1,l$=F(()=>{f1=2*Math.PI});function he(t,e){if(!t)throw e||"Assertion Failed!"}function Kl(t){var e=t.windingRule,i=e===void 0?fi.ODD:e,n=t.elementType,r=n===void 0?En.POLYGONS:n,s=t.polySize,a=s===void 0?3:s,o=t.vertexSize,l=o===void 0?2:o,c=t.normal,h=c===void 0?[0,0,1]:c,d=t.contours,u=d===void 0?[]:d,p=t.strict,f=p===void 0||p,g=t.debug,m=g!==void 0&&g;if(!u&&f)throw new Error("Contours can't be empty");if(u){var y=new jN;t.edgeCreateCallback&&(y.edgeCreateCallback=t.edgeCreateCallback),t.vertexIdCallback&&(y.vertexIdCallback=t.vertexIdCallback);for(var v=0;v<u.length;v++)y.addContour(l||2,u[v]);return y.tesselate(i,r,a,l,h,f),{vertices:y.vertices,vertexIndices:y.vertexIndices,vertexCount:y.vertexCount,elements:y.elements,elementCount:y.elementCount,mesh:m?y.mesh:void 0}}}var fi,En,re,Bd,Rf,Zh,RS,IS,OS,r4,xv,LS,s4,a4,jN,BS,GN,HN,wp=F(()=>{var t;(t=fi||(fi={}))[t.ODD=0]="ODD",t[t.NONZERO=1]="NONZERO",t[t.POSITIVE=2]="POSITIVE",t[t.NEGATIVE=3]="NEGATIVE",t[t.ABS_GEQ_TWO=4]="ABS_GEQ_TWO",function(e){e[e.POLYGONS=0]="POLYGONS",e[e.CONNECTED_POLYGONS=1]="CONNECTED_POLYGONS",e[e.BOUNDARY_CONTOURS=2]="BOUNDARY_CONTOURS"}(En||(En={})),re=function(){function e(){}return e.vertEq=function(i,n){return i.s===n.s&&i.t===n.t},e.vertLeq=function(i,n){return i.s<n.s||i.s===n.s&&i.t<=n.t},e.transLeq=function(i,n){return i.t<n.t||i.t===n.t&&i.s<=n.s},e.edgeGoesLeft=function(i){return e.vertLeq(i.Dst,i.Org)},e.edgeGoesRight=function(i){return e.vertLeq(i.Org,i.Dst)},e.vertL1dist=function(i,n){return Math.abs(i.s-n.s)+Math.abs(i.t-n.t)},e.edgeEval=function(i,n,r){he(e.vertLeq(i,n)&&e.vertLeq(n,r));var s=n.s-i.s,a=r.s-n.s;return s+a>0?s<a?n.t-i.t+(i.t-r.t)*(s/(s+a)):n.t-r.t+(r.t-i.t)*(a/(s+a)):0},e.edgeSign=function(i,n,r){he(e.vertLeq(i,n)&&e.vertLeq(n,r));var s=n.s-i.s,a=r.s-n.s;return s+a>0?(n.t-r.t)*s+(n.t-i.t)*a:0},e.transEval=function(i,n,r){he(e.transLeq(i,n)&&e.transLeq(n,r));var s=n.t-i.t,a=r.t-n.t;return s+a>0?s<a?n.s-i.s+(i.s-r.s)*(s/(s+a)):n.s-r.s+(r.s-i.s)*(a/(s+a)):0},e.transSign=function(i,n,r){he(e.transLeq(i,n)&&e.transLeq(n,r));var s=n.t-i.t,a=r.t-n.t;return s+a>0?(n.s-r.s)*s+(n.s-i.s)*a:0},e.vertCCW=function(i,n,r){return i.s*(n.t-r.t)+n.s*(r.t-i.t)+r.s*(i.t-n.t)>=0},e.interpolate=function(i,n,r,s){return(i=i<0?0:i)<=(r=r<0?0:r)?r===0?(n+s)/2:n+i/(i+r)*(s-n):s+r/(i+r)*(n-s)},e.intersect=function(i,n,r,s,a){var o,l,c;e.vertLeq(i,n)||(c=i,i=n,n=c),e.vertLeq(r,s)||(c=r,r=s,s=c),e.vertLeq(i,r)||(c=i,i=r,r=c,c=n,n=s,s=c),e.vertLeq(r,n)?e.vertLeq(n,s)?((o=e.edgeEval(i,r,n))+(l=e.edgeEval(r,n,s))<0&&(o=-o,l=-l),a.s=e.interpolate(o,r.s,l,n.s)):((o=e.edgeSign(i,r,n))+(l=-e.edgeSign(i,s,n))<0&&(o=-o,l=-l),a.s=e.interpolate(o,r.s,l,s.s)):a.s=(r.s+n.s)/2,e.transLeq(i,n)||(c=i,i=n,n=c),e.transLeq(r,s)||(c=r,r=s,s=c),e.transLeq(i,r)||(c=i,i=r,r=c,c=n,n=s,s=c),e.transLeq(r,n)?e.transLeq(n,s)?((o=e.transEval(i,r,n))+(l=e.transEval(r,n,s))<0&&(o=-o,l=-l),a.t=e.interpolate(o,r.t,l,n.t)):((o=e.transSign(i,r,n))+(l=-e.transSign(i,s,n))<0&&(o=-o,l=-l),a.t=e.interpolate(o,r.t,l,s.t)):a.t=(r.t+n.t)/2},e}(),Bd=function(){this.next=null,this.prev=null,this.anEdge=null,this.trail=null,this.n=0,this.marked=!1,this.inside=!1},Rf=function(){function e(i){this.side=i,this.next=null,this.Org=null,this.Sym=null,this.Onext=null,this.Lnext=null,this.Lface=null,this.activeRegion=null,this.winding=0}return Object.defineProperty(e.prototype,"Rface",{get:function(){return this.Sym.Lface},set:function(i){this.Sym.Lface=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dst",{get:function(){return this.Sym.Org},set:function(i){this.Sym.Org=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Oprev",{get:function(){return this.Sym.Lnext},set:function(i){this.Sym.Lnext=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Lprev",{get:function(){return this.Onext.Sym},set:function(i){this.Onext.Sym=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dprev",{get:function(){return this.Lnext.Sym},set:function(i){this.Lnext.Sym=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Rprev",{get:function(){return this.Sym.Onext},set:function(i){this.Sym.Onext=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dnext",{get:function(){return this.Sym.Onext.Sym},set:function(i){this.Sym.Onext.Sym=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Rnext",{get:function(){return this.Sym.Lnext.Sym},set:function(i){this.Sym.Lnext.Sym=i},enumerable:!0,configurable:!0}),e}(),Zh=function(){this.next=null,this.prev=null,this.anEdge=null,this.coords=[0,0,0],this.s=0,this.t=0,this.pqHandle=0,this.n=0,this.idx=0},RS=function(){function e(){var i=new Zh,n=new Bd,r=new Rf(0),s=new Rf(1);i.next=i.prev=i,i.anEdge=null,n.next=n.prev=n,r.next=r,r.Sym=s,s.next=s,s.Sym=r,this.vHead=i,this.fHead=n,this.eHead=r,this.eHeadSym=s}return e.prototype.makeEdge_=function(i){var n=new Rf(0),r=new Rf(1);i.Sym.side<i.side&&(i=i.Sym);var s=i.Sym.next;return r.next=s,s.Sym.next=n,n.next=i,i.Sym.next=r,n.Sym=r,n.Onext=n,n.Lnext=r,n.Org=null,n.Lface=null,n.winding=0,n.activeRegion=null,r.Sym=n,r.Onext=r,r.Lnext=n,r.Org=null,r.Lface=null,r.winding=0,r.activeRegion=null,n},e.prototype.splice_=function(i,n){var r=i.Onext,s=n.Onext;r.Sym.Lnext=n,s.Sym.Lnext=i,i.Onext=s,n.Onext=r},e.prototype.makeVertex_=function(i,n,r){var s=i;he(s,"Vertex can't be null!");var a=r.prev;s.prev=a,a.next=s,s.next=r,r.prev=s,s.anEdge=n;var o=n;do o.Org=s,o=o.Onext;while(o!==n)},e.prototype.makeFace_=function(i,n,r){var s=i;he(s,"Face can't be null");var a=r.prev;s.prev=a,a.next=s,s.next=r,r.prev=s,s.anEdge=n,s.trail=null,s.marked=!1,s.inside=r.inside;var o=n;do o.Lface=s,o=o.Lnext;while(o!==n)},e.prototype.killEdge_=function(i){i.Sym.side<i.side&&(i=i.Sym);var n=i.next,r=i.Sym.next;n.Sym.next=r,r.Sym.next=n},e.prototype.killVertex_=function(i,n){var r=i.anEdge,s=r;do s.Org=n,s=s.Onext;while(s!==r);var a=i.prev,o=i.next;o.prev=a,a.next=o},e.prototype.killFace_=function(i,n){var r=i.anEdge,s=r;do s.Lface=n,s=s.Lnext;while(s!==r);var a=i.prev,o=i.next;o.prev=a,a.next=o},e.prototype.makeEdge=function(){var i=new Zh,n=new Zh,r=new Bd,s=this.makeEdge_(this.eHead);return this.makeVertex_(i,s,this.vHead),this.makeVertex_(n,s.Sym,this.vHead),this.makeFace_(r,s,this.fHead),s},e.prototype.splice=function(i,n){var r=!1,s=!1;if(i!==n){if(n.Org!==i.Org&&(s=!0,this.killVertex_(n.Org,i.Org)),n.Lface!==i.Lface&&(r=!0,this.killFace_(n.Lface,i.Lface)),this.splice_(n,i),!s){var a=new Zh;this.makeVertex_(a,n,i.Org),i.Org.anEdge=i}if(!r){var o=new Bd;this.makeFace_(o,n,i.Lface),i.Lface.anEdge=i}}},e.prototype.delete=function(i){var n=i.Sym,r=!1;if(i.Lface!==i.Rface&&(r=!0,this.killFace_(i.Lface,i.Rface)),i.Onext===i)this.killVertex_(i.Org,null);else if(i.Rface.anEdge=i.Oprev,i.Org.anEdge=i.Onext,this.splice_(i,i.Oprev),!r){var s=new Bd;this.makeFace_(s,i,i.Lface)}n.Onext===n?(this.killVertex_(n.Org,null),this.killFace_(n.Lface,null)):(i.Lface.anEdge=n.Oprev,n.Org.anEdge=n.Onext,this.splice_(n,n.Oprev)),this.killEdge_(i)},e.prototype.addEdgeVertex=function(i){var n=this.makeEdge_(i),r=n.Sym;this.splice_(n,i.Lnext),n.Org=i.Dst;var s=new Zh;return this.makeVertex_(s,r,n.Org),n.Lface=r.Lface=i.Lface,n},e.prototype.splitEdge=function(i){var n=this.addEdgeVertex(i).Sym;return this.splice_(i.Sym,i.Sym.Oprev),this.splice_(i.Sym,n),i.Dst=n.Org,n.Dst.anEdge=n.Sym,n.Rface=i.Rface,n.winding=i.winding,n.Sym.winding=i.Sym.winding,n.idx=i.idx,n.Sym.idx=i.Sym.idx,n},e.prototype.connect=function(i,n){var r=!1,s=this.makeEdge_(i),a=s.Sym;if(n.Lface!==i.Lface&&(r=!0,this.killFace_(n.Lface,i.Lface)),this.splice_(s,i.Lnext),this.splice_(a,n),s.Org=i.Dst,a.Org=n.Org,s.Lface=a.Lface=i.Lface,i.Lface.anEdge=a,!r){var o=new Bd;this.makeFace_(o,s,i.Lface)}return s},e.prototype.zapFace=function(i){var n,r,s,a,o,l=i.anEdge;r=l.Lnext;do r=(n=r).Lnext,n.Lface=null,n.Rface===null&&(n.Onext===n?this.killVertex_(n.Org,null):(n.Org.anEdge=n.Onext,this.splice_(n,n.Oprev)),(s=n.Sym).Onext===s?this.killVertex_(s.Org,null):(s.Org.anEdge=s.Onext,this.splice_(s,s.Oprev)),this.killEdge_(n));while(n!=l);a=i.prev,(o=i.next).prev=a,a.next=o},e.prototype.countFaceVerts_=function(i){var n=i.anEdge,r=0;do r++,n=n.Lnext;while(n!==i.anEdge);return r},e.prototype.mergeConvexFaces=function(i){var n,r,s,a,o;for(n=this.fHead.next;n!==this.fHead;n=n.next)if(n.inside)for(o=(r=n.anEdge).Org;s=r.Lnext,(a=r.Sym)&&a.Lface&&a.Lface.inside&&this.countFaceVerts_(n)+this.countFaceVerts_(a.Lface)-2<=i&&re.vertCCW(r.Lprev.Org,r.Org,a.Lnext.Lnext.Org)&&re.vertCCW(a.Lprev.Org,a.Org,r.Lnext.Lnext.Org)&&(s=a.Lnext,this.delete(a),r=null,a=null),!r||r.Lnext.Org!==o;)r=s;return!0},e.prototype.check=function(){var i,n,r,s,a,o,l=this.fHead,c=this.vHead,h=this.eHead;for(n=l,n=l;(i=n.next)!==l;n=i){he(i.prev===n),a=i.anEdge;do he(a.Sym!==a),he(a.Sym.Sym===a),he(a.Lnext.Onext.Sym===a),he(a.Onext.Sym.Lnext===a),he(a.Lface===i),a=a.Lnext;while(a!==i.anEdge)}for(he(i.prev===n&&i.anEdge===null),s=c,s=c;(r=s.next)!==c;s=r){he(r.prev===s),a=r.anEdge;do he(a.Sym!==a),he(a.Sym.Sym===a),he(a.Lnext.Onext.Sym===a),he(a.Onext.Sym.Lnext===a),he(a.Org===r),a=a.Onext;while(a!==r.anEdge)}for(he(r.prev===s&&r.anEdge===null),o=h,o=h;(a=o.next)!==h;o=a)he(a.Sym.next===o.Sym),he(a.Sym!==a),he(a.Sym.Sym===a),he(a.Org!==null),he(a.Dst!==null),he(a.Lnext.Onext.Sym===a),he(a.Onext.Sym.Lnext===a);he(a.Sym.next===o.Sym&&a.Sym===this.eHeadSym&&a.Sym.Sym===a&&a.Org===null&&a.Dst===null&&a.Lface===null&&a.Rface===null)},e}(),IS=function(){this.handle=null},OS=function(){this.key=null,this.node=0},r4=function(){function e(i,n){this.leq=n,this.max=0,this.nodes=[],this.handles=[],this.initialized=!1,this.freeList=0,this.size=0,this.max=i,this.nodes=[],this.handles=[];for(var r=0;r<i+1;r++)this.nodes[r]=new IS,this.handles[r]=new OS;this.initialized=!1,this.nodes[1].handle=1,this.handles[1].key=null}return e.prototype.floatDown_=function(i){var n,r,s,a=this.nodes,o=this.handles;for(n=a[i].handle;;){if((s=i<<1)<this.size&&this.leq(o[a[s+1].handle].key,o[a[s].handle].key)&&++s,he(s<=this.max),r=a[s].handle,s>this.size||this.leq(o[n].key,o[r].key)){a[i].handle=n,o[n].node=i;break}a[i].handle=r,o[r].node=i,i=s}},e.prototype.floatUp_=function(i){var n,r,s,a=this.nodes,o=this.handles;for(n=a[i].handle;;){if(r=a[s=i>>1].handle,s===0||this.leq(o[r].key,o[n].key)){a[i].handle=n,o[n].node=i;break}a[i].handle=r,o[r].node=i,i=s}},e.prototype.init=function(){for(var i=this.size;i>=1;--i)this.floatDown_(i);this.initialized=!0},e.prototype.min=function(){return this.handles[this.nodes[1].handle].key},e.prototype.insert=function(i){var n,r;if(2*(n=++this.size)>this.max){var s,a;for(this.max*=2,a=this.nodes.length,this.nodes.length=this.max+1,s=a;s<this.nodes.length;s++)this.nodes[s]=new IS;for(a=this.handles.length,this.handles.length=this.max+1,s=a;s<this.handles.length;s++)this.handles[s]=new OS}return this.freeList===0?r=n:(r=this.freeList,this.freeList=this.handles[r].node),this.nodes[n].handle=r,this.handles[r].node=n,this.handles[r].key=i,this.initialized&&this.floatUp_(n),r},e.prototype.extractMin=function(){var i=this.nodes,n=this.handles,r=i[1].handle,s=n[r].key;return this.size>0&&(i[1].handle=i[this.size].handle,n[i[1].handle].node=1,n[r].key=null,n[r].node=this.freeList,this.freeList=r,--this.size,this.size>0&&this.floatDown_(1)),s},e.prototype.delete=function(i){var n,r=this.nodes,s=this.handles;he(i>=1&&i<=this.max&&s[i].key!==null),r[n=s[i].node].handle=r[this.size].handle,s[r[n].handle].node=n,--this.size,n<=this.size&&(n<=1||this.leq(s[r[n>>1].handle].key,s[r[n].handle].key)?this.floatDown_(n):this.floatUp_(n)),s[i].key=null,s[i].node=this.freeList,this.freeList=i},e}(),xv=function(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1},LS=function(){this.key=null,this.next=null,this.prev=null},s4=function(){function e(i,n){this.frame=i,this.leq=n,this.head=new LS,this.head.next=this.head,this.head.prev=this.head}return e.prototype.min=function(){return this.head.next},e.prototype.max=function(){return this.head.prev},e.prototype.insert=function(i){return this.insertBefore(this.head,i)},e.prototype.search=function(i){var n=this.head;do n=n.next;while(n.key!==null&&!this.leq(this.frame,i,n.key));return n},e.prototype.insertBefore=function(i,n){do i=i.prev;while(i.key!==null&&!this.leq(this.frame,i.key,n));var r=new LS;return r.key=n,r.next=i.next,i.next.prev=r,r.prev=i,i.next=r,r},e.prototype.delete=function(i){i.next.prev=i.prev,i.prev.next=i.next},e}(),a4=function(){function e(){}return e.regionBelow=function(i){return i.nodeUp.prev.key},e.regionAbove=function(i){return i.nodeUp.next.key},e.debugEvent=function(i){},e.addWinding=function(i,n){i.winding+=n.winding,i.Sym.winding+=n.Sym.winding},e.edgeLeq=function(i,n,r){var s=i.event,a=n.eUp,o=r.eUp;return a.Dst===s?o.Dst===s?re.vertLeq(a.Org,o.Org)?re.edgeSign(o.Dst,a.Org,o.Org)<=0:re.edgeSign(a.Dst,o.Org,a.Org)>=0:re.edgeSign(o.Dst,s,o.Org)<=0:o.Dst===s?re.edgeSign(a.Dst,s,a.Org)>=0:re.edgeEval(a.Dst,s,a.Org)>=re.edgeEval(o.Dst,s,o.Org)},e.deleteRegion=function(i,n){n.fixUpperEdge&&he(n.eUp.winding===0),n.eUp.activeRegion=null,i.dict.delete(n.nodeUp)},e.fixUpperEdge=function(i,n,r){he(n.fixUpperEdge),i.mesh.delete(n.eUp),n.fixUpperEdge=!1,n.eUp=r,r.activeRegion=n},e.topLeftRegion=function(i,n){var r,s=n.eUp.Org;do n=e.regionAbove(n);while(n.eUp.Org===s);if(n.fixUpperEdge){if((r=i.mesh.connect(e.regionBelow(n).eUp.Sym,n.eUp.Lnext))===null)return null;e.fixUpperEdge(i,n,r),n=e.regionAbove(n)}return n},e.topRightRegion=function(i){var n=i.eUp.Dst;do i=e.regionAbove(i);while(i.eUp.Dst===n);return i},e.addRegionBelow=function(i,n,r){var s=new xv;return s.eUp=r,s.nodeUp=i.dict.insertBefore(n.nodeUp,s),s.fixUpperEdge=!1,s.sentinel=!1,s.dirty=!1,r.activeRegion=s,s},e.isWindingInside=function(i,n){switch(i.windingRule){case fi.ODD:return!!(1&n);case fi.NONZERO:return n!==0;case fi.POSITIVE:return n>0;case fi.NEGATIVE:return n<0;case fi.ABS_GEQ_TWO:return n>=2||n<=-2}throw new Error("Invalid winding rulle")},e.computeWinding=function(i,n){n.windingNumber=e.regionAbove(n).windingNumber+n.eUp.winding,n.inside=e.isWindingInside(i,n.windingNumber)},e.finishRegion=function(i,n){var r=n.eUp,s=r.Lface;s.inside=n.inside,s.anEdge=r,e.deleteRegion(i,n)},e.finishLeftRegions=function(i,n,r){for(var s,a=null,o=n,l=n.eUp;o!==r;){if(o.fixUpperEdge=!1,(s=(a=e.regionBelow(o)).eUp).Org!=l.Org){if(!a.fixUpperEdge){e.finishRegion(i,o);break}s=i.mesh.connect(l.Lprev,s.Sym),e.fixUpperEdge(i,a,s)}l.Onext!==s&&(i.mesh.splice(s.Oprev,s),i.mesh.splice(l,s)),e.finishRegion(i,o),l=a.eUp,o=a}return l},e.addRightEdges=function(i,n,r,s,a,o){var l,c,h,d,u=!0;h=r;do he(re.vertLeq(h.Org,h.Dst)),e.addRegionBelow(i,n,h.Sym),h=h.Onext;while(h!==s);for(a===null&&(a=e.regionBelow(n).eUp.Rprev),c=n,d=a;(h=(l=e.regionBelow(c)).eUp.Sym).Org===d.Org;)h.Onext!==d&&(i.mesh.splice(h.Oprev,h),i.mesh.splice(d.Oprev,h)),l.windingNumber=c.windingNumber-h.winding,l.inside=e.isWindingInside(i,l.windingNumber),c.dirty=!0,!u&&e.checkForRightSplice(i,c)&&(e.addWinding(h,d),e.deleteRegion(i,c),i.mesh.delete(d)),u=!1,c=l,d=h;c.dirty=!0,he(c.windingNumber-h.winding===l.windingNumber),o&&e.walkDirtyRegions(i,c)},e.spliceMergeVertices=function(i,n,r){i.mesh.splice(n,r)},e.vertexWeights=function(i,n,r){var s=re.vertL1dist(n,i),a=re.vertL1dist(r,i),o=.5*a/(s+a),l=.5*s/(s+a);i.coords[0]+=o*n.coords[0]+l*r.coords[0],i.coords[1]+=o*n.coords[1]+l*r.coords[1],i.coords[2]+=o*n.coords[2]+l*r.coords[2]},e.getIntersectData=function(i,n,r,s,a,o){n.coords[0]=n.coords[1]=n.coords[2]=0,n.idx=-1,e.vertexWeights(n,r,s),e.vertexWeights(n,a,o)},e.checkForRightSplice=function(i,n){var r=e.regionBelow(n),s=n.eUp,a=r.eUp;if(re.vertLeq(s.Org,a.Org)){if(re.edgeSign(a.Dst,s.Org,a.Org)>0)return!1;re.vertEq(s.Org,a.Org)?s.Org!==a.Org&&(i.pq.delete(s.Org.pqHandle),e.spliceMergeVertices(i,a.Oprev,s)):(i.mesh.splitEdge(a.Sym),i.mesh.splice(s,a.Oprev),n.dirty=r.dirty=!0)}else{if(re.edgeSign(s.Dst,a.Org,s.Org)<0)return!1;e.regionAbove(n).dirty=n.dirty=!0,i.mesh.splitEdge(s.Sym),i.mesh.splice(a.Oprev,s)}return!0},e.checkForLeftSplice=function(i,n){var r,s=e.regionBelow(n),a=n.eUp,o=s.eUp;if(he(!re.vertEq(a.Dst,o.Dst)),re.vertLeq(a.Dst,o.Dst)){if(re.edgeSign(a.Dst,o.Dst,a.Org)<0)return!1;e.regionAbove(n).dirty=n.dirty=!0,r=i.mesh.splitEdge(a),i.mesh.splice(o.Sym,r),r.Lface.inside=n.inside}else{if(re.edgeSign(o.Dst,a.Dst,o.Org)>0)return!1;n.dirty=s.dirty=!0,r=i.mesh.splitEdge(o),i.mesh.splice(a.Lnext,o.Sym),r.Rface.inside=n.inside}return!0},e.checkForIntersect=function(i,n){var r,s,a=e.regionBelow(n),o=n.eUp,l=a.eUp,c=o.Org,h=l.Org,d=o.Dst,u=l.Dst,p=new Zh;if(he(!re.vertEq(u,d)),he(re.edgeSign(d,i.event,c)<=0),he(re.edgeSign(u,i.event,h)>=0),he(c!==i.event&&h!==i.event),he(!n.fixUpperEdge&&!a.fixUpperEdge),c===h||Math.min(c.t,d.t)>Math.max(h.t,u.t))return!1;if(re.vertLeq(c,h)){if(re.edgeSign(u,c,h)>0)return!1}else if(re.edgeSign(d,h,c)<0)return!1;return e.debugEvent(i),re.intersect(d,c,u,h,p),he(Math.min(c.t,d.t)<=p.t),he(p.t<=Math.max(h.t,u.t)),he(Math.min(u.s,d.s)<=p.s),he(p.s<=Math.max(h.s,c.s)),re.vertLeq(p,i.event)&&(p.s=i.event.s,p.t=i.event.t),r=re.vertLeq(c,h)?c:h,re.vertLeq(r,p)&&(p.s=r.s,p.t=r.t),re.vertEq(p,c)||re.vertEq(p,h)?(e.checkForRightSplice(i,n),!1):!re.vertEq(d,i.event)&&re.edgeSign(d,i.event,p)>=0||!re.vertEq(u,i.event)&&re.edgeSign(u,i.event,p)<=0?u===i.event?(i.mesh.splitEdge(o.Sym),i.mesh.splice(l.Sym,o),n=e.topLeftRegion(i,n),o=e.regionBelow(n).eUp,e.finishLeftRegions(i,e.regionBelow(n),a),e.addRightEdges(i,n,o.Oprev,o,o,!0),!0):d===i.event?(i.mesh.splitEdge(l.Sym),i.mesh.splice(o.Lnext,l.Oprev),a=n,n=e.topRightRegion(n),s=e.regionBelow(n).eUp.Rprev,a.eUp=l.Oprev,l=e.finishLeftRegions(i,a,null),e.addRightEdges(i,n,l.Onext,o.Rprev,s,!0),!0):(re.edgeSign(d,i.event,p)>=0&&(e.regionAbove(n).dirty=n.dirty=!0,i.mesh.splitEdge(o.Sym),o.Org.s=i.event.s,o.Org.t=i.event.t),re.edgeSign(u,i.event,p)<=0&&(n.dirty=a.dirty=!0,i.mesh.splitEdge(l.Sym),l.Org.s=i.event.s,l.Org.t=i.event.t),!1):(i.mesh.splitEdge(o.Sym),i.mesh.splitEdge(l.Sym),i.mesh.splice(l.Oprev,o),o.Org.s=p.s,o.Org.t=p.t,o.Org.pqHandle=i.pq.insert(o.Org),e.getIntersectData(i,o.Org,c,d,h,u),e.regionAbove(n).dirty=n.dirty=a.dirty=!0,!1)},e.walkDirtyRegions=function(i,n){for(var r,s,a=e.regionBelow(n);;){for(;a.dirty;)n=a,a=e.regionBelow(a);if(!n.dirty&&(a=n,(n=e.regionAbove(n))===null||!n.dirty))return;if(n.dirty=!1,r=n.eUp,s=a.eUp,r.Dst!==s.Dst&&e.checkForLeftSplice(i,n)&&(a.fixUpperEdge?(e.deleteRegion(i,a),i.mesh.delete(s),s=(a=e.regionBelow(n)).eUp):n.fixUpperEdge&&(e.deleteRegion(i,n),i.mesh.delete(r),r=(n=e.regionAbove(a)).eUp)),r.Org!==s.Org){if(r.Dst===s.Dst||n.fixUpperEdge||a.fixUpperEdge||r.Dst!==i.event&&s.Dst!==i.event)e.checkForRightSplice(i,n);else if(e.checkForIntersect(i,n))return}r.Org===s.Org&&r.Dst===s.Dst&&(e.addWinding(s,r),e.deleteRegion(i,n),i.mesh.delete(r),n=e.regionAbove(a))}},e.connectRightVertex=function(i,n,r){var s,a=r.Onext,o=e.regionBelow(n),l=n.eUp,c=o.eUp,h=!1;l.Dst!==c.Dst&&e.checkForIntersect(i,n),re.vertEq(l.Org,i.event)&&(i.mesh.splice(a.Oprev,l),n=e.topLeftRegion(i,n),a=e.regionBelow(n).eUp,e.finishLeftRegions(i,e.regionBelow(n),o),h=!0),re.vertEq(c.Org,i.event)&&(i.mesh.splice(r,c.Oprev),r=e.finishLeftRegions(i,o,null),h=!0),h?e.addRightEdges(i,n,r.Onext,a,a,!0):(s=re.vertLeq(c.Org,l.Org)?c.Oprev:l,s=i.mesh.connect(r.Lprev,s),e.addRightEdges(i,n,s,s.Onext,s.Onext,!1),s.Sym.activeRegion.fixUpperEdge=!0,e.walkDirtyRegions(i,n))},e.connectLeftDegenerate=function(i,n,r){var s,a,o,l,c;return s=n.eUp,re.vertEq(s.Org,r)?(he(!1),void e.spliceMergeVertices(i,s,r.anEdge)):re.vertEq(s.Dst,r)?(he(!1),n=e.topRightRegion(n),a=l=(o=(c=e.regionBelow(n)).eUp.Sym).Onext,c.fixUpperEdge&&(he(a!==o),e.deleteRegion(i,c),i.mesh.delete(o),o=a.Oprev),i.mesh.splice(r.anEdge,o),re.edgeGoesLeft(a)||(a=null),void e.addRightEdges(i,n,o.Onext,l,a,!0)):(i.mesh.splitEdge(s.Sym),n.fixUpperEdge&&(i.mesh.delete(s.Onext),n.fixUpperEdge=!1),i.mesh.splice(r.anEdge,s),void e.sweepEvent(i,r))},e.connectLeftVertex=function(i,n){var r,s,a,o,l,c,h=new xv;if(h.eUp=n.anEdge.Sym,r=i.dict.search(h).key,s=e.regionBelow(r)){if(o=r.eUp,l=s.eUp,re.edgeSign(o.Dst,n,o.Org)===0)return void e.connectLeftDegenerate(i,r,n);a=re.vertLeq(l.Dst,o.Dst)?r:s,r.inside||a.fixUpperEdge?(c=a===r?i.mesh.connect(n.anEdge.Sym,o.Lnext):i.mesh.connect(l.Dnext,n.anEdge).Sym,a.fixUpperEdge?e.fixUpperEdge(i,a,c):e.computeWinding(i,e.addRegionBelow(i,r,c)),e.sweepEvent(i,n)):e.addRightEdges(i,r,n.anEdge,n.anEdge,null,!0)}},e.sweepEvent=function(i,n){i.event=n,e.debugEvent(i);for(var r=n.anEdge;r.activeRegion===null;)if((r=r.Onext)===n.anEdge)return void e.connectLeftVertex(i,n);var s=e.topLeftRegion(i,r.activeRegion);he(s!==null);var a=e.regionBelow(s),o=a.eUp,l=e.finishLeftRegions(i,a,null);l.Onext===o?e.connectRightVertex(i,s,l):e.addRightEdges(i,s,l.Onext,o,o,!0)},e.addSentinel=function(i,n,r,s){var a=new xv,o=i.mesh.makeEdge();o.Org.s=r,o.Org.t=s,o.Dst.s=n,o.Dst.t=s,i.event=o.Dst,a.eUp=o,a.windingNumber=0,a.inside=!1,a.fixUpperEdge=!1,a.sentinel=!0,a.dirty=!1,a.nodeUp=i.dict.insert(a)},e.initEdgeDict=function(i){i.dict=new s4(i,e.edgeLeq);var n=i.bmax[0]-i.bmin[0],r=i.bmax[1]-i.bmin[1],s=i.bmin[0]-n,a=i.bmax[0]+n,o=i.bmin[1]-r,l=i.bmax[1]+r;e.addSentinel(i,s,a,o),e.addSentinel(i,s,a,l)},e.doneEdgeDict=function(i){for(var n,r=0;(n=i.dict.min().key)!==null;)n.sentinel||(he(n.fixUpperEdge),he(++r===1)),he(n.windingNumber===0),e.deleteRegion(i,n)},e.removeDegenerateEdges=function(i){var n,r,s,a=i.mesh.eHead;for(n=a.next;n!==a;n=r)r=n.next,s=n.Lnext,re.vertEq(n.Org,n.Dst)&&n.Lnext.Lnext!==n&&(e.spliceMergeVertices(i,s,n),i.mesh.delete(n),s=(n=s).Lnext),s.Lnext===n&&(s!==n&&((s===r||s===r.Sym)&&(r=r.next),i.mesh.delete(s)),(n===r||n===r.Sym)&&(r=r.next),i.mesh.delete(n))},e.initPriorityQ=function(i){var n,r,s,a=0;for(r=(s=i.mesh.vHead).next;r!==s;r=r.next)a++;for(a+=8,n=i.pq=new r4(a,re.vertLeq),r=(s=i.mesh.vHead).next;r!==s;r=r.next)r.pqHandle=n.insert(r);return r===s&&(n.init(),!0)},e.donePriorityQ=function(i){i.pq=null},e.removeDegenerateFaces=function(i,n){var r,s,a;for(r=n.fHead.next;r!==n.fHead;r=s)s=r.next,he((a=r.anEdge).Lnext!==a),a.Lnext.Lnext===a&&(e.addWinding(a.Onext,a),i.mesh.delete(a));return!0},e.computeInterior=function(i,n){var r,s;if(n===void 0&&(n=!0),e.removeDegenerateEdges(i),!e.initPriorityQ(i))return!1;for(e.initEdgeDict(i);(r=i.pq.extractMin())!==null;){for(;(s=i.pq.min())!==null&&re.vertEq(s,r);)s=i.pq.extractMin(),e.spliceMergeVertices(i,r.anEdge,s.anEdge);e.sweepEvent(i,r)}return i.event=i.dict.min().key.eUp.Org,e.debugEvent(i),e.doneEdgeDict(i),e.donePriorityQ(i),!!e.removeDegenerateFaces(i,i.mesh)&&(n&&i.mesh.check(),!0)},e}(),jN=function(){function e(){this.mesh=new RS,this.normal=[0,0,0],this.sUnit=[0,0,0],this.tUnit=[0,0,0],this.bmin=[0,0],this.bmax=[0,0],this.windingRule=fi.ODD,this.dict=null,this.pq=null,this.event=null,this.vertexIndexCounter=0,this.vertices=[],this.vertexIndices=[],this.vertexCount=0,this.elements=[],this.elementCount=0}return e.prototype.dot_=function(i,n){return i[0]*n[0]+i[1]*n[1]+i[2]*n[2]},e.prototype.normalize_=function(i){var n=i[0]*i[0]+i[1]*i[1]+i[2]*i[2];if(!n)throw"Zero-size vector!";n=Math.sqrt(n),i[0]/=n,i[1]/=n,i[2]/=n},e.prototype.longAxis_=function(i){var n=0;return Math.abs(i[1])>Math.abs(i[0])&&(n=1),Math.abs(i[2])>Math.abs(i[n])&&(n=2),n},e.prototype.computeNormal_=function(i){var n,r,s,a,o,l,c=[0,0,0],h=[0,0,0],d=[0,0,0],u=[0,0,0],p=[0,0,0],f=[null,null,null],g=[null,null,null],m=this.mesh.vHead;n=m.next;for(var y=0;y<3;++y)a=n.coords[y],h[y]=a,g[y]=n,c[y]=a,f[y]=n;for(n=m.next;n!==m;n=n.next)for(var v=0;v<3;++v)(a=n.coords[v])<h[v]&&(h[v]=a,g[v]=n),a>c[v]&&(c[v]=a,f[v]=n);var _=0;if(c[1]-h[1]>c[0]-h[0]&&(_=1),c[2]-h[2]>c[_]-h[_]&&(_=2),h[_]>=c[_])return i[0]=0,i[1]=0,void(i[2]=1);for(l=0,r=g[_],s=f[_],d[0]=r.coords[0]-s.coords[0],d[1]=r.coords[1]-s.coords[1],d[2]=r.coords[2]-s.coords[2],n=m.next;n!==m;n=n.next)u[0]=n.coords[0]-s.coords[0],u[1]=n.coords[1]-s.coords[1],u[2]=n.coords[2]-s.coords[2],p[0]=d[1]*u[2]-d[2]*u[1],p[1]=d[2]*u[0]-d[0]*u[2],p[2]=d[0]*u[1]-d[1]*u[0],(o=p[0]*p[0]+p[1]*p[1]+p[2]*p[2])>l&&(l=o,i[0]=p[0],i[1]=p[1],i[2]=p[2]);l<=0&&(i[0]=i[1]=i[2]=0,i[this.longAxis_(d)]=1)},e.prototype.checkOrientation_=function(){for(var i,n,r=this.mesh.fHead,s=this.mesh.vHead,a=0,o=r.next;o!==r;o=o.next)if(!((n=o.anEdge).winding<=0))do a+=(n.Org.s-n.Dst.s)*(n.Org.t+n.Dst.t),n=n.Lnext;while(n!==o.anEdge);if(a<0){for(i=s.next;i!==s;i=i.next)i.t=-i.t;this.tUnit[0]=-this.tUnit[0],this.tUnit[1]=-this.tUnit[1],this.tUnit[2]=-this.tUnit[2]}},e.prototype.projectPolygon_=function(){var i,n,r=this.mesh.vHead,s=[0,0,0],a=!1;s[0]=this.normal[0],s[1]=this.normal[1],s[2]=this.normal[2],!s[0]&&!s[1]&&!s[2]&&(this.computeNormal_(s),a=!0),i=this.sUnit,n=this.tUnit;var o=this.longAxis_(s);i[o]=0,i[(o+1)%3]=1,i[(o+2)%3]=0,n[o]=0,n[(o+1)%3]=0,n[(o+2)%3]=s[o]>0?1:-1;for(var l=r.next;l!==r;l=l.next)l.s=this.dot_(l.coords,i),l.t=this.dot_(l.coords,n);a&&this.checkOrientation_();for(var c=!0,h=r.next;h!==r;h=h.next)c?(this.bmin[0]=this.bmax[0]=h.s,this.bmin[1]=this.bmax[1]=h.t,c=!1):(h.s<this.bmin[0]&&(this.bmin[0]=h.s),h.s>this.bmax[0]&&(this.bmax[0]=h.s),h.t<this.bmin[1]&&(this.bmin[1]=h.t),h.t>this.bmax[1]&&(this.bmax[1]=h.t))},e.prototype.addWinding_=function(i,n){i.winding+=n.winding,i.Sym.winding+=n.Sym.winding},e.prototype.tessellateMonoRegion_=function(i,n){var r,s;if((r=n.anEdge).Lnext===r||r.Lnext.Lnext===r)throw"Mono region invalid";for(;re.vertLeq(r.Dst,r.Org);r=r.Lprev);for(;re.vertLeq(r.Org,r.Dst);r=r.Lnext);for(s=r.Lprev;r.Lnext!==s;)if(re.vertLeq(r.Dst,s.Org)){for(;s.Lnext!==r&&(re.edgeGoesLeft(s.Lnext)||re.edgeSign(s.Org,s.Dst,s.Lnext.Dst)<=0);)s=i.connect(s.Lnext,s).Sym;s=s.Lprev}else{for(;s.Lnext!==r&&(re.edgeGoesRight(r.Lprev)||re.edgeSign(r.Dst,r.Org,r.Lprev.Org)>=0);)r=i.connect(r,r.Lprev).Sym;r=r.Lnext}if(s.Lnext===r)throw"Mono region invalid";for(;s.Lnext.Lnext!==r;)s=i.connect(s.Lnext,s).Sym;return!0},e.prototype.tessellateInterior_=function(i){for(var n,r=i.fHead.next;r!==i.fHead;r=n)if(n=r.next,r.inside&&!this.tessellateMonoRegion_(i,r))return!1;return!0},e.prototype.discardExterior_=function(i){for(var n,r=i.fHead.next;r!==i.fHead;r=n)n=r.next,r.inside||i.zapFace(r)},e.prototype.setWindingNumber_=function(i,n,r){for(var s,a=i.eHead.next;a!==i.eHead;a=s)s=a.next,a.Rface.inside!==a.Lface.inside?a.winding=a.Lface.inside?n:-n:r?i.delete(a):a.winding=0},e.prototype.getNeighbourFace_=function(i){return i.Rface&&i.Rface.inside?i.Rface.n:-1},e.prototype.outputPolymesh_=function(i,n,r,s){var a,o,l=0,c=0;r>3&&i.mergeConvexFaces(r);for(var h=i.vHead.next;h!==i.vHead;h=h.next)h.n=-1;for(var d=i.fHead.next;d!==i.fHead;d=d.next)if(d.n=-1,d.inside){a=d.anEdge,o=0;do(h=a.Org).n===-1&&(h.n=c,c++),o++,a=a.Lnext;while(a!==d.anEdge);if(o>r)throw"Face vertex greater that support polygon";d.n=l,++l}for(this.elementCount=l,n===En.CONNECTED_POLYGONS&&(l*=2),this.elements=[],this.elements.length=l*r,this.vertexCount=c,this.vertices=[],this.vertices.length=c*s,this.vertexIndices=[],this.vertexIndices.length=c,h=i.vHead.next;h!==i.vHead;h=h.next)if(h.n!==-1){var u=h.n*s;this.vertices[u+0]=h.coords[0],this.vertices[u+1]=h.coords[1],s>2&&(this.vertices[u+2]=h.coords[2]),this.vertexIndices[h.n]=h.idx}var p=0;for(d=i.fHead.next;d!==i.fHead;d=d.next)if(d.inside){a=d.anEdge,o=0;do h=a.Org,this.elements[p++]=h.n,o++,a=a.Lnext;while(a!==d.anEdge);for(var f=o;f<r;++f)this.elements[p++]=-1;if(n===En.CONNECTED_POLYGONS){a=d.anEdge;do this.elements[p++]=this.getNeighbourFace_(a),a=a.Lnext;while(a!==d.anEdge);for(var g=o;g<r;++g)this.elements[p++]=-1}}},e.prototype.outputContours_=function(i,n){var r,s,a=0,o=0;this.vertexCount=0,this.elementCount=0;for(var l=i.fHead.next;l!==i.fHead;l=l.next)if(l.inside){s=r=l.anEdge;do this.vertexCount++,r=r.Lnext;while(r!==s);this.elementCount++}this.elements=[],this.elements.length=2*this.elementCount,this.vertices=[],this.vertices.length=this.vertexCount*n,this.vertexIndices=[],this.vertexIndices.length=this.vertexCount;var c=0,h=0,d=0;for(a=0,l=i.fHead.next;l!==i.fHead;l=l.next)if(l.inside){o=0,s=r=l.anEdge;do this.vertices[c++]=r.Org.coords[0],this.vertices[c++]=r.Org.coords[1],n>2&&(this.vertices[c++]=r.Org.coords[2]),this.vertexIndices[h++]=this.vertexIdCallback?this.vertexIdCallback(r):r.Org.idx,o++,r=r.Lnext;while(r!==s);this.elements[d++]=a,this.elements[d++]=o,a+=o}},e.prototype.addContour=function(i,n){this.mesh===null&&(this.mesh=new RS),i<2&&(i=2),i>3&&(i=3);for(var r=null,s=0;s<n.length;s+=i)r===null?(r=this.mesh.makeEdge(),this.mesh.splice(r,r.Sym)):(this.mesh.splitEdge(r),r=r.Lnext),r.Org.coords[0]=n[s+0],r.Org.coords[1]=n[s+1],r.Org.coords[2]=i>2?n[s+2]:0,r.Org.idx=this.vertexIndexCounter++,this.edgeCreateCallback&&this.edgeCreateCallback(r),r.winding=1,r.Sym.winding=-1},e.prototype.tesselate=function(i,n,r,s,a,o){if(i===void 0&&(i=fi.ODD),n===void 0&&(n=En.POLYGONS),o===void 0&&(o=!0),this.vertices=[],this.elements=[],this.vertexIndices=[],this.vertexIndexCounter=0,a&&(this.normal[0]=a[0],this.normal[1]=a[1],this.normal[2]=a[2]),this.windingRule=i,s<2&&(s=2),s>3&&(s=3),!this.mesh)return!1;this.projectPolygon_(),a4.computeInterior(this,o);var l=this.mesh;return n===En.BOUNDARY_CONTOURS?this.setWindingNumber_(l,1,!0):this.tessellateInterior_(l),o&&l.check(),n===En.BOUNDARY_CONTOURS?this.outputContours_(l,s):this.outputPolymesh_(l,n,r,s),!0},e}(),fi.ODD,fi.NONZERO,fi.POSITIVE,fi.NEGATIVE,fi.ABS_GEQ_TWO,En.POLYGONS,En.CONNECTED_POLYGONS,En.BOUNDARY_CONTOURS}),h$=F(()=>{(GN=BS=class{constructor(t=256,e=!1){this.capacity=t,this.size=0,this.debug=e,this.debug&&console.log(`allocating with cap ${t}`);let i=t*BS.eSize;this.buffer=new ArrayBuffer(i);let n=Float32Array.BYTES_PER_ELEMENT,r=0;this.positions=new Float32Array(this.buffer,r*n,3*t),r+=3*t,this.normals=new Float32Array(this.buffer,r*n,3*t),r+=3*t,this.uvs=new Float32Array(this.buffer,r*n,2*t)}realloc(t,e=!1){if(t<this.size)throw Error("cannot shrink buffer");if(t<=this.capacity&&!e)return;this.debug&&console.log(`resizing from ${this.capacity} \u2192 ${t}`);let i=t*BS.eSize,n=new ArrayBuffer(i),r=Float32Array.BYTES_PER_ELEMENT,s=0,a=new Float32Array(n,s*r,3*t);s+=3*t;let o=new Float32Array(n,s*r,3*t);s+=3*t;let l=new Float32Array(n,s*r,2*t);e?(a.set(this.positions.subarray(0,3*this.size)),o.set(this.normals.subarray(0,3*this.size)),l.set(this.uvs.subarray(0,2*this.size))):(a.set(this.positions),o.set(this.normals),l.set(this.uvs)),this.buffer=n,this.positions=a,this.normals=o,this.uvs=l,this.capacity=t}get(t=1){let e=this.size+t;if(e>this.capacity){let n=this.capacity;for(;e>n;)n*=2;this.realloc(n)}let i=this.size;return this.size=e,i}reserve(t){let e=this.size+t;e>this.capacity&&this.realloc(e)}shrink(){this.debug&&console.log(`shrinking ${this.capacity} \u2192 ${this.size}`),this.realloc(this.size,!0)}}).eSize=8*Float32Array.BYTES_PER_ELEMENT}),c$=F(()=>{HN=class{constructor(t=[],e=(i,n)=>i<n?-1:i>n?1:0){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;let t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:e,compare:i}=this,n=e[t];for(;t>0;){let r=t-1>>1,s=e[r];if(i(n,s)>=0)break;e[t]=s,t=r}e[t]=n}_down(t){let{data:e,compare:i}=this,n=this.length>>1,r=e[t];for(;t<n;){let s=1+(t<<1),a=s+1;if(a<this.length&&i(e[a],e[s])<0&&(s=a),i(e[s],r)>=0)break;e[t]=e[s],t=s}e[t]=r}}});function wv(t,e,i,n){this.x=t,this.y=e,this.h=i,this.d=function(r,s,a){let o=!1,l=1/0;for(let c of a)for(let h=0,d=c.length,u=d-1;h<d;u=h++){let p=c[h],f=c[u];p[1]>s!=f[1]>s&&r<(f[0]-p[0])*(s-p[1])/(f[1]-p[1])+p[0]&&(o=!o),l=Math.min(l,d$(r,s,p,f))}return l===0?0:(o?1:-1)*Math.sqrt(l)}(t,e,n),this.max=this.d+this.h*Math.SQRT2}function d$(t,e,i,n){let r=i[0],s=i[1],a=n[0]-r,o=n[1]-s;if(a!==0||o!==0){let l=((t-r)*a+(e-s)*o)/(a*a+o*o);l>1?(r=n[0],s=n[1]):l>0&&(r+=a*l,s+=o*l)}return a=t-r,o=e-s,a*a+o*o}var K_,SA,MA,Sv,Q_,EA,AA,_h,u$=F(()=>{c$()}),HC=F(()=>{et(),wp(),h$(),ii(),u$(),K_={vertices:[160,160,-160,160,-160,-160,160,-160],vertexIndices:[1,0,3,2],vertexCount:4,elements:[0,4],elementCount:1,mesh:void 0},SA={vertices:[],vertexIndices:[],vertexCount:0,elements:[],elementCount:0,mesh:void 0},MA={vertices:[-160,160,160,-160,160,160,-160,-160],vertexIndices:[1,3,0,2],vertexCount:4,elements:[0,1,2,1,0,3],elementCount:2,mesh:void 0},Sv=(t,e)=>([i,n])=>(n<i&&(n+=e),(t>=i?t:t+e)<=n),Q_=class extends Gt{constructor(t,e,i=0,n=12,r=3,s=fi.ODD,a=!1){super(),this.forPathBevel=a,this.type="ShapeGeometry",this.vertexCache={},this._shape=t,this._depth=e,this._curveSegments=n,this._bevelSegmentsInput=r;let o,l,c,h=this._shape.extractShapePointsToFlatArray([],n),d=this._shape.shapeHoles.map(E=>{let P=E.extractShapePointsToFlatArray([],n),T=[];for(let R=P.length-1;R>=1;R-=2){let L=P[R-1],D=P[R-0];T.push(L,D)}return T}),u=[],p=[];for(let E=0;E<h.length;E+=2)p.push([h[E],h[E+1]]);u.push(p);for(let E=0;E<d.length;E++){let P=d[E],T=[];for(let R=0;R<P.length;R+=2)T.push([P[R],P[R+1]]);u.push(T)}o=t.isText?.1*new Lb().setFromPoints(t.points.map(E=>E.position)).getSize(new it).length():u[0].length===0?i:i>0?function(E,P,T=1,R=!1){let L=1/0,D=1/0,U=-1/0,V=-1/0;for(let[q,lt]of E[0])q<L&&(L=q),lt<D&&(D=lt),q>U&&(U=q),lt>V&&(V=lt);let k=U-L,Y=V-D,$=Math.max(T,Math.min(k,Y));if($===T){let q=[L,D];return q.distance=0,q.distance}let nt=new HN([],(q,lt)=>lt.max-q.max),Q=function(q){let lt=0,z=0,O=0,j=q[0];for(let I=0,G=j.length,W=G-1;I<G;W=I++){let N=j[I],tt=j[W],ot=N[0]*tt[1]-tt[0]*N[1];z+=(N[0]+tt[0])*ot,O+=(N[1]+tt[1])*ot,lt+=3*ot}let Z=new wv(z/lt,O/lt,0,q);return lt===0||Z.d<0?new wv(j[0][0],j[0][1],0,q):Z}(E),rt=new wv(L+k/2,D+Y/2,0,E);rt.d>Q.d&&(Q=rt);let gt=2;function at(q,lt,z){let O=new wv(q,lt,z,E);if(gt++,O.max>Q.d+T&&nt.push(O),O.d>Q.d&&(Q=O,R&&console.log(`found best ${Math.round(1e4*O.d)/1e4} after ${gt} probes`),Q.d>P))return P}let ht=$/2;for(let q=L;q<U;q+=$)for(let lt=D;lt<V;lt+=$)at(q+ht,lt+ht,ht);for(;nt.length;){let{max:q,x:lt,y:z,h:O}=nt.pop();if(q-Q.d<=T)break;ht=O/2,at(lt-ht,z-ht,ht),at(lt+ht,z-ht,ht),at(lt-ht,z+ht,ht),at(lt+ht,z+ht,ht)}R&&console.log(`num probes: ${gt}
|
|
4167
4167
|
best distance: ${Q.d}`);let ct=[Q.x,Q.y];return ct.distance=Q.d,ct.distance}(u,i):1e-5,i<=0?(this._bevel=0,this._bevelSegments=0):(this._bevel=Math.min(i,o,e/2),this._bevelSegments=Math.floor(r));try{l=Kl({windingRule:s,elementType:En.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[h]})}catch{l=K_}try{c=Kl({windingRule:fi.ODD,elementType:En.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...d]})}catch{c=SA}if(!l)throw new Error("error generating geometry");let f=l.elementCount;if(c){l.elementCount+=c.elementCount;for(let E=0;E<c.elements.length;E++){let P=c.elements[E],T=E%2==0?l.vertexCount:0;l.elements.push(P+T)}for(let E=0;E<c.vertexIndices.length;E++){let P=c.vertexIndices[E],T=l.vertexCount;l.vertexIndices.push(P+T)}for(let E=0;E<c.vertices.length;E++){let P=c.vertices[E];l.vertices.push(P)}}let g=1/0,m=-1/0,y=1/0,v=-1/0;for(let E=0,P=l.vertexCount;E<P;E++){let T=2*E,R=l.vertices[T+0],L=l.vertices[T+1];R<g&&(g=R),R>m&&(m=R),L<y&&(y=L),L>v&&(v=L)}this._minX=g,this._minY=y,this._width=m-g,this._height=v-y,this._buffer=new GN(this._computeBufferEstimatedSize(l));let _=[],b=[];for(let E=l.elementCount-1;E>=0;E--){let P=E>=f,T=2*E,R=l.elements[T+0],L=l.elements[T+1],D=R+L,U={start:R,count:L,normals:[],continuous:[],concave:[]},V=R,k=D-1,Y=R+1,$=this._shape.roundedCurves.length;do{let at=V-R,ht=l.vertices[2*k+0],ct=l.vertices[2*k+1],q=l.vertices[2*V+0],lt=l.vertices[2*V+1],z=l.vertices[2*Y+0],O=l.vertices[2*Y+1],j=q-ht,Z=lt-ct,I=Math.sqrt(j*j+Z*Z);j/=I,Z/=I;let G=q-z,W=lt-O,N=Math.sqrt(G*G+W*W);G/=N,W/=N,U.normals[2*at+0]=-W,U.normals[2*at+1]=G,U.concave[at]=j*W-Z*G>0;let tt=l.vertexIndices[V];if(Array.isArray(tt))U.continuous[at]=!1;else{let[ot,pt]=this._shape.getCurveIndexFromVertexId(tt-1,!0);if(pt>0&&pt<1)U.continuous[at]=!0;else{let ut=pt===1?ot+1:ot-1;ut=(ut+$)%$;let Pt=pt===1?0:1,bt=this._shape.roundedCurves[ot].getTangent(pt),Rt=this._shape.roundedCurves[ut].getTangent(Pt);U.continuous[at]=bt.dot(Rt)>.95}}P&&(U.normals[2*at+0]*=-1,U.normals[2*at+1]*=-1),[k,V,Y]=[V,Y,Y+1],Y>=D&&(Y-=L)}while(Y!==R+1);let nt=[];nt.push({bevelI:0,angle:0,size:0,boundary:{vertices:l.vertices.slice(2*R,2*D),vertexCount:L,vertexIndices:new Array(L).fill(!0).map((at,ht)=>[ht,ht]),elements:[0,L],elementCount:1,mesh:null},reverseMap:[],insetPoints:l.vertices.slice(2*R,2*D)});let Q=0;for(let at=1;at<=this._bevelSegments;at++){let ht=at/this._bevelSegments*Math.PI/2,ct=(1-Math.cos(ht))*this._bevel,q=[],lt=[],z=[],O=[],j=0;for(let I=0;I<L;I++){let G=2*I,W=(I-1+L)%L*2,N=l.vertices[2*U.start+G+0],tt=l.vertices[2*U.start+G+1],ot=-U.normals[W+0]*ct,pt=-U.normals[W+1]*ct,ut=-U.normals[G+0]*ct,Pt=-U.normals[G+1]*ct;if(U.concave[I]||!U.concave[I]&&P){let bt=Math.atan2(pt,ot),Rt=Math.atan2(Pt,ut);Rt>bt&&(Rt-=2*Math.PI);let _t=Rt-bt;if(U.continuous[I]||P){let X=bt+_t/2,vt=Math.cos(X)*ct,Dt=Math.sin(X)*ct;q[2*j+0]=N+vt*(P?-1:1),q[2*j+1]=tt+Dt*(P?-1:1),O[j]=I,j++}else{let X=Math.max(1,Math.floor(n/4*Math.abs(_t)/Math.PI));for(let vt=0;vt<=X;vt++){let Dt=bt+_t*(vt/X),jt=Math.cos(Dt)*ct,Ft=Math.sin(Dt)*ct;q[2*j+0]=N+jt,q[2*j+1]=tt+Ft,O[j]=I,j++}}}else q[2*j+0]=N+ot,q[2*j+1]=tt+pt,O[j]=I,lt[I]=j,j++,q[2*j+0]=N,q[2*j+1]=tt,O[j]=I,j++,q[2*j+0]=N+ut,q[2*j+1]=tt+Pt,O[j]=I,z[I]=j,j++}let Z=Kl({windingRule:fi.POSITIVE,elementType:En.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[q],edgeCreateCallback:I=>{let G=I.Org.idx,W=O[G],N=O[(G+1)%O.length];I.idx=[W,N],I.Sym.idx=[N,W]},vertexIdCallback:I=>{let G=I.Lprev.idx;return[G?G[1]:0,I.idx?I.idx[0]:0]}});if(!Z)throw console.log("Error"),new Error(`error generating bevel geometry for ${at}'th loop`);if(!Z.vertexCount){let I=(at-1)/this._bevelSegments*Math.PI/2;Q=(1-Math.sin(I))*this._bevel;break}for(let I=0;I<Z.vertexIndices.length;I++){let[G,W]=Z.vertexIndices[I];if(G===W)continue;let N=W;W<G&&(N+=L);for(let tt=G;tt<N;tt++){let ot=tt%L,pt=(tt+1)%L;if(!U.continuous[ot]||!U.continuous[pt]){Z.vertexIndices[I]=[G,ot],Z.vertexIndices.splice(I+1,0,[pt,W]),Z.vertices.splice(2*(I+1),0,Z.vertices[2*I],Z.vertices[2*I+1]);break}}}nt.push({bevelI:at,angle:ht,size:ct,boundary:Z,reverseMap:O,insetPoints:q})}let rt=(at,ht,ct)=>{let q=0,lt=at.boundary.vertexIndices.length;for(;q<lt&&ct(at.boundary.vertexIndices[ht]);)ht=(ht+1)%lt,q++;return q},gt=_.length;for(let at=1;at<nt.length;at++){let ht=nt[at-1],ct=nt[at],q=ht.boundary.vertexIndices.length,lt=ct.boundary.vertexIndices.length;if(!q||!lt)break;let z=U.concave.length,O=0,j=Sv(O,L);for(;!ht.boundary.vertexIndices.filter(j).length||!ct.boundary.vertexIndices.filter(j).length;)O++,j=Sv(O,L);let Z=ht.boundary.vertexIndices.findIndex(j),I=ct.boundary.vertexIndices.findIndex(j);do Z=(Z+1)%q;while(j(ht.boundary.vertexIndices[Z]));do I=(I+1)%lt;while(j(ct.boundary.vertexIndices[I]));O=(O+1)%L;let G,W,N=O,tt=0,ot=this._buildBevelVert(U,ht,(Z-1+q)%q,void 0,tt),pt=this._buildBevelVert(U,ct,(I-1+lt)%lt,void 0,tt),ut=!1;do{tt=(O||z)/z,j=Sv(O,L);let Pt=rt(ht,Z,j),bt=rt(ct,I,j),Rt=ut;if(ut=!1,Pt&&!bt){for(let _t=0;_t<Pt;_t++)G=this._buildBevelVert(U,ht,(Z+_t)%q,_t/(Pt-1),tt),_.push(ot.topN,G.topP,pt.topN),a===!1&&_.push(G.bottomP,ot.bottomN,pt.bottomN),ot=G;ut=!0}else if(!Pt&&bt)for(let _t=0;_t<bt;_t++)W=this._buildBevelVert(U,ct,(I+_t)%lt,_t/(bt-1),tt),_.push(pt.topN,ot.topP,W.topP),a===!1&&_.push(ot.bottomP,pt.bottomN,W.bottomP),pt=W;else if(Pt&&bt)if(G=this._buildBevelVert(U,ht,Z,0,tt),W=this._buildBevelVert(U,ct,I,0,tt),Rt?(_.push(ot.topN,W.topP,pt.topN),_.push(ot.topN,G.topP,W.topP),a===!1&&(_.push(W.bottomP,ot.bottomN,pt.bottomN),_.push(W.bottomP,G.bottomP,ot.bottomN))):(_.push(pt.topN,ot.topN,G.topP),_.push(pt.topN,G.topP,W.topP),a===!1&&(_.push(G.bottomP,ot.bottomN,pt.bottomN),_.push(G.bottomP,pt.bottomN,W.bottomP))),ot=G,pt=W,Pt===bt)for(let _t=1;_t<Pt;_t++)G=this._buildBevelVert(U,ht,(Z+_t)%q,_t/(Pt-1),tt),W=this._buildBevelVert(U,ct,(I+_t)%lt,_t/(bt-1),tt),_.push(ot.topN,G.topP,pt.topN),_.push(pt.topN,G.topP,W.topP),a===!1&&(_.push(G.bottomP,ot.bottomN,pt.bottomN),_.push(G.bottomP,pt.bottomN,W.bottomP)),ot=G,pt=W;else if(Pt>bt){let _t=Pt/bt,X=0;for(let vt=1;vt<Pt;vt++)G=this._buildBevelVert(U,ht,(Z+vt)%q,vt/(Pt-1),tt),_.push(ot.topN,G.topP,pt.topN),a===!1&&_.push(G.bottomP,ot.bottomN,pt.bottomN),ot=G,vt>(X+1)*_t&&(X++,W=this._buildBevelVert(U,ct,(I+X)%lt,X/(bt-1),tt),_.push(pt.topN,G.topP,W.topP),a===!1&&_.push(G.bottomP,pt.bottomN,W.bottomP),pt=W)}else{let _t=bt/Pt,X=0;for(let vt=1;vt<bt;vt++)W=this._buildBevelVert(U,ct,(I+vt)%lt,vt/(bt-1),tt),_.push(pt.topN,G.topP,W.topP),a===!1&&_.push(G.bottomP,pt.bottomN,W.bottomP),pt=W,vt>(X+1)*_t&&(X++,G=this._buildBevelVert(U,ht,(Z+X)%q,X/(Pt-1),tt),_.push(ot.topN,G.topP,pt.topN),a===!1&&_.push(G.bottomP,ot.bottomN,pt.bottomN),ot=G)}Z=(Z+Pt)%q,I=(I+bt)%lt,O=(O+1)%z}while(O!==N)}if(a===!1&&this._depth>2*this._bevel&&this._buildWall(nt,U,_),P){let at=[];for(let ht=_.length-1;ht>=gt+2;ht-=3){let ct=_[ht-2],q=_[ht-1],lt=_[ht-0];at.push(lt,q,ct)}_.splice(gt,_.length-gt,...at)}if(P){let at=[];for(let ht=nt[nt.length-1].boundary.vertices.length-1;ht>=1;ht-=2){let ct=nt[nt.length-1].boundary.vertices[ht-1],q=nt[nt.length-1].boundary.vertices[ht-0];at.push(ct,q)}b.push(at)}if(!P){let at,ht=nt[nt.length-1];try{at=Kl({windingRule:nt.length>1?fi.POSITIVE:fi.ODD,elementType:En.POLYGONS,vertexSize:2,strict:!0,contours:[ht.insetPoints,...b]})}catch{at=MA}if(!at)throw new Error("Error generating geometry for surface");d.length===0&&this._bevel<o&&Object.assign(this,{useNgonForTopBottomFaceDuringBake:!0});for(let ct=0;ct<3*at.elementCount;ct+=3){let q=this._buildSurfaceVert(at,at.elements[ct+0],Q),lt=this._buildSurfaceVert(at,at.elements[ct+1],Q),z=this._buildSurfaceVert(at,at.elements[ct+2],Q);_.push(q.top,lt.top,z.top),a===!1&&_.push(z.bottom,lt.bottom,q.bottom)}}this.vertexCache={}}this._buffer.shrink();let x=new Ht(Uint32Array.from(_),1),w=new Ht(this._buffer.positions,3),S=new Ht(this._buffer.normals,3),A=new Ht(this._buffer.uvs,2);w.needsUpdate=!0,S.needsUpdate=!0,A.needsUpdate=!0,x.needsUpdate=!0,this.setAttribute("position",w),this.setAttribute("normal",S),this.setAttribute("uv",A),this.setIndex(x)}_computeBufferEstimatedSize(t){return 2*t.vertexCount*(2+this._bevelSegments)}_buildWall(t,e,i){let n=t[0];for(let r=0,s=n.boundary.vertexCount;r<s;r++){let a=this._buildBevelVert(e,n,r),o=this._buildBevelVert(e,n,(r+1)%s);i.push(o.topP,a.topN,a.bottomN),i.push(o.topP,a.bottomN,o.bottomP)}}_buildSurfaceVert(t,e,i){let n=e.toString();if(n in this.vertexCache)return this.vertexCache[n];let r=t.vertices[2*e+0],s=t.vertices[2*e+1],a=(r-this._minX)/this._width,o=(s-this._minY)/this._height;this.forPathBevel&&(o=1);let l=this._buffer.get(this.forPathBevel?1:2),c=3*l,h=2*l,d={top:l+0,bottom:l+1};return this._buffer.positions[c+0]=r,this._buffer.positions[c+1]=s,this._buffer.positions[c+2]=this.forPathBevel?this._bevel:this._depth-i,this._buffer.normals[c+0]=0,this._buffer.normals[c+1]=0,this._buffer.normals[c+2]=1,this._buffer.uvs[h+0]=a,this._buffer.uvs[h+1]=o,this.forPathBevel===!1&&(this._buffer.positions[c+3]=r,this._buffer.positions[c+4]=s,this._buffer.positions[c+5]=i,this._buffer.normals[c+3]=0,this._buffer.normals[c+4]=0,this._buffer.normals[c+5]=-1,this._buffer.uvs[h+2]=a,this._buffer.uvs[h+3]=o),this.vertexCache[n]=d,d}_buildBevelVert(t,e,i,n=1,r){let s=`${e.bevelI}:${i}`;if(s in this.vertexCache&&r!==0&&r!==1&&(!r||r===this.vertexCache[s].pathBevelUCoord))return this.vertexCache[s];let a,o,l,c,[h,d]=e.boundary.vertexIndices[i];h!==d?(o=h,a=d,c=!1,l=t.continuous[o]&&t.continuous[a]):(a=h,o=(a-1+t.count)%t.count,c=t.concave[a]&&e.bevelI>0,l=t.continuous[a]||c);let u=Math.cos(e.angle),p=Math.sin(e.angle),f=2*i,g=2*a,m=2*o,y=e.boundary.vertices[f+0],v=e.boundary.vertices[f+1],_=(1-p)*this._bevel,b=(y-this._minX)/this._width,x=(v-this._minY)/this._height;this.forPathBevel&&(r!==void 0&&(b=r),x=1);let w=t.normals[g+0],S=t.normals[g+1],A=t.normals[m+0],E=t.normals[m+1];if(c){w+=(A-w)*(1-n),S+=(E-S)*(1-n);let D=Math.sqrt(w*w+S*S);w/=D,S/=D}let P=this.forPathBevel?this._buffer.get(l?1:2):this._buffer.get(l?2:4),T=3*P,R=2*P,L={i,fi:a,topP:P+0,topN:P+0,bottomP:P+1,bottomN:P+1,pathBevelUCoord:r};return this._buffer.positions[T+0]=y,this._buffer.positions[T+1]=v,this._buffer.positions[T+2]=(this.forPathBevel?this._bevel:this._depth)-_,this._buffer.normals[T+0]=w*u,this._buffer.normals[T+1]=S*u,this._buffer.normals[T+2]=p,this._buffer.uvs[R+0]=b,this._buffer.uvs[R+1]=x,this.forPathBevel===!1&&(this._buffer.positions[T+3]=y,this._buffer.positions[T+4]=v,this._buffer.positions[T+5]=_,this._buffer.normals[T+3]=w*u,this._buffer.normals[T+4]=S*u,this._buffer.normals[T+5]=-p,this._buffer.uvs[R+2]=x,this._buffer.uvs[R+3]=b),l||(this.forPathBevel?(P+=1,T+=3,R+=2):(P+=2,T+=6,R+=4),L.topP=P+0,L.bottomP=P+1,this._buffer.positions[T+0]=y,this._buffer.positions[T+1]=v,this._buffer.positions[T+2]=(this.forPathBevel?this._bevel:this._depth)-_,this._buffer.normals[T+0]=A*u,this._buffer.normals[T+1]=E*u,this._buffer.normals[T+2]=p,this._buffer.uvs[R+0]=b,this._buffer.uvs[R+1]=x,this.forPathBevel===!1&&(this._buffer.positions[T+3]=y,this._buffer.positions[T+4]=v,this._buffer.positions[T+5]=_,this._buffer.normals[T+3]=A*u,this._buffer.normals[T+4]=E*u,this._buffer.normals[T+5]=-p,this._buffer.uvs[R+2]=x,this._buffer.uvs[R+3]=b)),this.vertexCache[s]=L,L}clone(){let t=new Q_(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegmentsInput);return t.userData=Ub(this.userData),t}}}),WN=F(()=>{et(),wp(),ii(),HC(),EA=class extends Gt{constructor(t,e=12,i={}){super(),this.type="ShapeGeometry",this.windingRule=fi.ODD,this.elementType=En.POLYGONS,this.polySize=3,this.vertexSize=2,this.strict=!0,this._shape=t,this._curveSegments=e,this._triangulationOptions=Object.assign({windingRule:fi.ODD,elementType:En.POLYGONS,polySize:3,vertexSize:2,strict:!0},i);let n,r,s,a=this._shape.extractShapePointsToFlatArray([],this._curveSegments),o=this._shape.shapeHoles.map(u=>u.extractShapePointsToFlatArray([],this._curveSegments)),l=!0,c=!0;for(let u=0,p=a.length/2;u<p;u++){let f=2*u,g=a[f+0],m=a[f+1];if(r!==void 0&&g!==r&&(l=!1),s!==void 0&&m!==s&&(c=!1),r=g,s=m,!l&&!c)break}if(!l&&!c)try{n=Kl({contours:[a,...o],windingRule:this._triangulationOptions.windingRule,elementType:this._triangulationOptions.elementType,polySize:this._triangulationOptions.polySize,vertexSize:this._triangulationOptions.vertexSize,strict:this._triangulationOptions.strict})}catch{n=K_}let h=n?.vertexCount??1,d=n?.elementCount??1;if(this._positionAttribute=new Ht(new Float32Array(3*h),3),this._normalAttribute=new Ht(new Float32Array(3*h),3),this._uvAttribute=new Ht(new Float32Array(2*h),2),this._indexAttribute=new Ht(new Uint32Array(3*d),1),n){let u=1/0,p=-1/0,f=1/0,g=-1/0;for(let v=0,_=h;v<_;v++){let b=2*v,x=n.vertices[b+0],w=n.vertices[b+1];x<u&&(u=x),x>p&&(p=x),w<f&&(f=w),w>g&&(g=w)}let m=p-u,y=g-f;for(let v=0,_=h;v<_;v++){let b=2*v,x=n.vertices[b+0],w=n.vertices[b+1],S=(x-u)/m,A=(w-f)/y;this._positionAttribute.setXYZ(v,x,w,0),this._normalAttribute.setXYZ(v,0,0,1),this._uvAttribute.setXY(v,S,A)}for(let v=0,_=d;v<_;v++){let b=3*v,x=n.elements[b+0],w=n.elements[b+1],S=n.elements[b+2];this._indexAttribute.setX(b+0,x),this._indexAttribute.setX(b+1,w),this._indexAttribute.setX(b+2,S)}}this.setAttribute("position",this._positionAttribute),this.setAttribute("normal",this._normalAttribute),this.setAttribute("uv",this._uvAttribute),this.setIndex(this._indexAttribute),this.setDrawRange(0,3*(n?.elementCount??1))}clone(){let t=new EA(this._shape,this._curveSegments);return t.userData=Ub(this.userData),t}}}),p$=F(()=>{wp(),ii(),HC(),AA=class extends Q_{constructor(t,e,i=0,n=12,r=3,s=fi.ODD){super(t,e,i,n,r,s),this.type="ShapeGeometry"}_computeBufferEstimatedSize(t){return 2*t.vertexCount*(2+this._bevelSegments)}_buildWall(t,e,i){let n=t[0];for(let r=0,s=n.boundary.vertexCount;r<s;r++){let a=this._buildBevelVert(e,n,r),o=this._buildBevelVert(e,n,(r+1)%s);i.push(o.topP,a.topN,a.bottomN),i.push(o.topP,a.bottomN,o.bottomP)}}clone(){let t=new AA(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegmentsInput);return t.userData=Ub(this.userData),t}}}),dh=F(()=>{yh(),WN(),p$(),wp(),_h=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i,n=Object.assign({},e?.parameters??{width:100,subdivisions:40,roundness:0,extrudeBevelSize:0,extrudeBevelSegments:3,windingRule:fi.ODD},t.parameters),r=Math.abs(n.width),s=Math.abs(n.height??n.width),a=Math.abs(n.depth??0),o=t.shape??e?.shape,l=o?.roundness??n.roundness;o!==void 0&&(o instanceof Ni?(i=o,(i.width!==r||i.height!==s)&&i.applySize(r,s)):i=new Ni(r,s).fromJSON(o),t.parameters?.roundness!==void 0&&t.parameters?.roundness>0&&i.update());let c=i??new Ni(r,s);return{parameters:Object.assign(n,{width:r,height:s,depth:a,roundness:l}),shape:c}}static build(t){let e,{depth:i,extrudeBevelSize:n,extrudeBevelSegments:r,subdivisions:s,roundness:a,windingRule:o}=t.parameters;return t.shape.roundness=a,e=i<=0?new EA(t.shape,s,{windingRule:o}):new AA(t.shape,i,n,s,r,o),Object.assign(e,{userData:{...t,type:"VectorGeometry"}})}}});function f$(t,e,i,n,r,s){if(n>=WC)return r>30||r%4==0?(function(h,d,u,p=0,f=0,g=0){let m=.5522847498,y=d*m,v=u*m;h.addPoint(Mv(f-d,g,f-d,g-v,f-d,g+v)),h.addPoint(Mv(f,g+u,f-y,g+u,f+y,g+u)),h.addPoint(Mv(f+d,g,f+d,g+v,f+d,g-v)),h.addPoint(Mv(f,g-u,f+y,g-u,f-y,g-u)),p>0&&XN(h,d,u,p)}(t,e,i,s),Math.round(r/4)):o4(t,n,r,e,i,s);let a={x:0,y:i},o=(n=Math.max(n,.001))+.5*Math.PI,l={x:Math.cos(o)*e,y:Math.sin(o)*i},c=function({px:h,py:d,cx:u,cy:p,rx:f,ry:g,largeArcFlag:m,sweepFlag:y}){let v=[];if(f===0||g===0)return[];let _=(h-u)/2,b=(d-p)/2;if(_===0&&b===0)return[];f=Math.abs(f),g=Math.abs(g);let x=Math.pow(_,2)/Math.pow(f,2)+Math.pow(b,2)/Math.pow(g,2);x>1&&(f*=Math.sqrt(x),g*=Math.sqrt(x));let w=function(L,D,U,V,k,Y,$,nt,Q,rt){let gt=Math.pow(k,2),at=Math.pow(Y,2),ht=Math.pow($,2),ct=Math.pow(nt,2),q=gt*at-gt*ct-at*ht;q<0&&(q=0),q/=gt*ct+at*ht,q=Math.sqrt(q)*(Q===rt?-1:1);let lt=q*k/Y*nt,z=q*-Y/k*$,O=lt+(L+U)/2,j=z+(D+V)/2,Z=($-lt)/k,I=(nt-z)/Y,G=(-$-lt)/k,W=(-nt-z)/Y,N=n4(1,0,Z,I),tt=n4(Z,I,G,W);return!rt&&tt>0&&(tt-=f1),rt&&tt<0&&(tt+=f1),{centerx:O,centery:j,ang1:N,ang2:tt}}(h,d,u,p,f,g,_,b,m,y),{ang1:S,ang2:A}=w,{centerx:E,centery:P}=w,T=Math.abs(A)/(f1/4);Math.abs(1-T)<1e-7&&(T=1);let R=Math.max(Math.ceil(T),1);A/=R;for(let L=0;L<R;L++)v.push(o$(S,A)),S+=A;return v.map(L=>{let{x:D,y:U}=DS(L[0],f,g,E,P),{x:V,y:k}=DS(L[1],f,g,E,P),{x:Y,y:$}=DS(L[2],f,g,E,P);return{x1:D,y1:U,x2:V,y2:k,x:Y,y:$}})}({px:a.x,py:a.y,cx:l.x,cy:l.y,rx:e,ry:i,largeArcFlag:n>Math.PI,sweepFlag:!0});return r>30||r%c.length===0?function(h,d,u,p,f,g,m,y){let v=Math.round(f/p.length);h.addPoint(Zu(d,u));for(let _=0,b=p.length;_<b;_++){let x=p[_],w=h.points[_],S=Zu(x.x,x.y);w.controls[1].position.set(x.x1,x.y1),S.controls[0].position.set(x.x2,x.y2),h.addPoint(S)}return y>0?qN(h,g,m,y):h.addPoint(Zu(0,0)),v}(t,a.x,a.y,c,r,e,i,s):o4(t,n,r,e,i,s)}function o4(t,e,i,n,r,s){let a=-e/i;for(let o=0;o<=i;o++){let l=a*o,c=Math.sin(l)*n,h=Math.cos(l)*r;t.addPoint(Zu(c,h))}return e<WC?s>0?qN(t,n,r,s):t.addPoint(Zu(0,0)):(t.removePoint(t.points[t.points.length-1]),s>0&&XN(t,n,r,s)),1}function Zu(t,e){return new Uc(Ot.generateUUID(),new it(t,e))}function Mv(t,e,i,n,r,s){let a=Zu(t,e);return a.controls[0].position.set(i,n),a.controls[1].position.set(r,s),a}function qN(t,e,i,n){$N(t,e,i,n).forEach(r=>t.addPoint(r))}function XN(t,e,i,n){let r=$N(t,e,i,n),s=new Ni;r.forEach(a=>s.addPoint(a)),s.isClosed=!0,t.shapeHoles.push(s)}function $N(t,e,i,n){let r=n*e/100,s=r*(Math.abs(i)/Math.abs(e)),a=new it(r/e,s/i),o=t.points.map(l=>{let c=l.clone();return c.uuid=Ot.generateUUID(),c}).reverse();return o.forEach(l=>{l.position.multiply(a);let c=l.controls[0].position.clone().multiply(a),h=l.controls[1].position.clone().multiply(a);l.controls[0].position.copy(h),l.controls[1].position.copy(c)}),o}var WC,Qb,YN,US,ZN,J_=F(()=>{yh(),VN(),l$(),dh(),et(),WC=2*Math.PI,Qb=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,spikes:64,angle:360,innerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1},t.parameters);return i.angle=Ot.clamp(i.angle,0,360),{shape:t.shape&&t.shape instanceof Ni?t.shape:new Ni,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(t){let e,{width:i,height:n,spikes:r,angle:s,innerRadius:a,depth:o,extrudeBevelSize:l,extrudeBevelSegments:c}=t.parameters,h=t.shape,d=f$(h,.5*i,.5*n,s*Math.PI/180,r,a);return h.isClosed=!0,h.update(),s===0?(e=new Gt,e.setAttribute("position",new Nt([],3))):e=_h.create({shape:h,parameters:{subdivisions:d,depth:o,extrudeBevelSize:l,extrudeBevelSegments:c}}),Object.assign(e,{userData:{...t,type:"EllipseGeometry"}})}}}),l4=F(()=>{et(),BN(),YN=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,detail:0,corner:0,cornerSides:4},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let{width:e,height:i,depth:n,detail:r,corner:s,cornerSides:a}=t.parameters,o=r===0&&s!==0?new US(.5*e,s,a):new oE(.5*e,r),l=i/e,c=n/e;return(l!==1||c!==1)&&o.scale(1,l,c),Object.assign(o,{userData:{...t,type:"IcosahedronGeometry"}})}},US=class extends Y_{constructor(t=1,e=.2,i=4){let n=(1+Math.sqrt(5))/2,r="IcosahedronGeometry";super([-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],r,t,e,i),this.type=r}static fromJSON(t){return new US(t.radius,t.corner,t.cornerSides)}}}),h4=F(()=>{et(),ZN=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){(t.parameters?.points??[]).forEach(n=>{Array.isArray(n)&&(n.x=n[0],n.y=n[1])});let i=Object.assign({},e?.parameters??{width:100,segments:64,verticalSegments:64,points:[{x:0,y:-50,id:0},{x:50,y:-50,id:1},{x:50,y:50,id:2},{x:0,y:50,id:3}]},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let{points:e,segments:i,verticalSegments:n}=t.parameters,r=new xg;r.moveTo(e[0].x,e[0].y),r.bezierCurveTo(e[1].x,e[1].y,e[2].x,e[2].y,e[3].x,e[3].y);let s=new lE(r.extractPoints(n).shape,i);return s.rotateZ(Math.PI),Object.assign(s,{userData:{...t,type:"LatheGeometry"}})}}});function Ud(t,e){return Math.abs(e-t)/2+Math.min(t,e)}function m$(t){let{positions:e,faces:i,materialIndices:n,uvs:r}=t,s=e.length/3,a=i.length/3,o=r!==null&&a>0,l=3*a,c=new Uint32Array(l),h=new Uint32Array(l),d=new Uint32Array(l),u=new Uint32Array(l),p=new Uint32Array(l),f=0,g=8;for(;g<2*l;)g*=2;let m=g-1,y=new Int32Array(g).fill(-1),v=(D,U)=>{let V=(Math.imul(D,2654435761)^U)&m;for(;;){let k=y[V];if(k===-1)return y[V]=f,c[f]=D,h[f]=U,f++;if(c[k]===D&&h[k]===U)return k;V=V+1&m}},_=(D,U)=>{let V=D<U?D:U,k=D<U?U:D,Y=(Math.imul(V,2654435761)^k)&m;for(;;){let $=y[Y];if(c[$]===V&&h[$]===k)return $;Y=Y+1&m}},b=new Uint32Array(s),x=new Float64Array(3*s),w=(D,U,V)=>{let k=D<U?v(D,U):v(U,D),Y=++d[k];Y===1?u[k]=V:Y===2&&(p[k]=V),b[D]++,b[U]++,x[3*D]+=e[3*U],x[3*D+1]+=e[3*U+1],x[3*D+2]+=e[3*U+2],x[3*U]+=e[3*D],x[3*U+1]+=e[3*D+1],x[3*U+2]+=e[3*D+2]};for(let D=0;D<a;D++){let U=i[3*D],V=i[3*D+1],k=i[3*D+2];w(U,V,k),w(V,k,U),w(k,U,V)}let S=new Float64Array(3*f);for(let D=0;D<f;D++){let U=3*c[D],V=3*h[D];if(d[D]===2){let k=3*u[D],Y=3*p[D];S[3*D]=.375*(e[U]+e[V])+.125*(e[k]+e[Y]),S[3*D+1]=.375*(e[U+1]+e[V+1])+.125*(e[k+1]+e[Y+1]),S[3*D+2]=.375*(e[U+2]+e[V+2])+.125*(e[k+2]+e[Y+2])}else S[3*D]=.5*(e[U]+e[V]),S[3*D+1]=.5*(e[U+1]+e[V+1]),S[3*D+2]=.5*(e[U+2]+e[V+2])}let A,E=new Float64Array(3*s);for(let D=0;D<s;D++){let U=b[D];U===3?A=3/16:U>3&&(A=3/(8*U));let V=1-U*Number(A),k=Number(A);U===2&&(V=3/4,k=1/8),E[3*D]=e[3*D]*V+x[3*D]*k,E[3*D+1]=e[3*D+1]*V+x[3*D+1]*k,E[3*D+2]=e[3*D+2]*V+x[3*D+2]*k}let P=new Float64Array(3*(s+f));P.set(E),P.set(S,3*s);let T=new Uint32Array(12*a),R=new Array(4*a),L=o?new Float64Array(24*a):null;for(let D=0;D<a;D++){let U=i[3*D],V=i[3*D+1],k=i[3*D+2],Y=_(U,V)+s,$=_(V,k)+s,nt=_(k,U)+s,Q=12*D;T[Q++]=Y,T[Q++]=$,T[Q++]=nt,T[Q++]=U,T[Q++]=Y,T[Q++]=nt,T[Q++]=V,T[Q++]=$,T[Q++]=Y,T[Q++]=k,T[Q++]=nt,T[Q++]=$;let rt=n[D];if(R[4*D]=rt,R[4*D+1]=rt,R[4*D+2]=rt,R[4*D+3]=rt,L!==null){let gt=6*D,at=r[gt],ht=r[gt+1],ct=r[gt+2],q=r[gt+3],lt=r[gt+4],z=r[gt+5],O=Ud(at,ct),j=Ud(ht,q),Z=Ud(ct,lt),I=Ud(q,z),G=Ud(at,lt),W=Ud(ht,z),N=24*D;L[N++]=O,L[N++]=j,L[N++]=Z,L[N++]=I,L[N++]=G,L[N++]=W,L[N++]=at,L[N++]=ht,L[N++]=O,L[N++]=j,L[N++]=G,L[N++]=W,L[N++]=ct,L[N++]=q,L[N++]=Z,L[N++]=I,L[N++]=O,L[N++]=j,L[N++]=lt,L[N++]=z,L[N++]=G,L[N++]=W,L[N++]=Z,L[N++]=I}}return{positions:P,faces:T,materialIndices:R,uvs:L}}var Ev,KN,xn,QN,qC,g$=F(()=>{et(),Ev=1e4,KN=class{constructor(t=1){this.subdivisions=t}modify(t){let e=function(n){let r=n.getAttribute("position");if(r===void 0)return console.error("SubdivisionModifier: Position attribute required for subdivision."),{positions:new Float64Array(0),faces:new Uint32Array(0),materialIndices:[],uvs:null};let s=n.getAttribute("uv"),a=n.getIndex(),o=r.count,l=new Map,c=new Uint32Array(o),h=[],d=0;for(let v=0;v<o;v++){let _=r.getX(v),b=r.getY(v),x=r.getZ(v),w=Math.round(_*Ev),S=Math.round(b*Ev),A=Math.round(x*Ev),E=l.get(w);E===void 0&&(E=new Map,l.set(w,E));let P=E.get(S);P===void 0&&(P=new Map,E.set(S,P));let T=P.get(A);T===void 0&&(T=d++,P.set(A,T),h.push(_,b,x)),c[v]=T}let u=[],p=[],f=s===void 0?null:[],g=a!==null?a.count:o,m=(v,_)=>{let b=a!==null?a.getX(v):v,x=a!==null?a.getX(v+1):v+1,w=a!==null?a.getX(v+2):v+2;if(!(b<o&&x<o&&w<o))return;let S=c[b],A=c[x],E=c[w];S===A||A===E||E===S||(u.push(S,A,E),p.push(_),f!==null&&f.push(s.getX(b),s.getY(b),s.getX(x),s.getY(x),s.getX(w),s.getY(w)))},y=n.groups;if(y.length>0)for(let v=0;v<y.length;v++){let _=y[v],b=_.materialIndex===void 0?0:_.materialIndex,x=Math.max(_.start,0),w=Math.min(_.start+_.count,g);for(let S=x;S<w&&S+2<g;S+=3)m(S,b)}else for(let v=0;v+2<g;v+=3)m(v,0);return{positions:Float64Array.from(h),faces:Uint32Array.from(u),materialIndices:p,uvs:f===null?null:Float64Array.from(f)}}(t),i=this.subdivisions;for(;i-- >0;)e=m$(e);return function(n,r){let{positions:s,faces:a,materialIndices:o,uvs:l}=n,c=s.length/3,h=a.length/3,d=new Float64Array(3*c);for(let y=0;y<h;y++){let v=3*a[3*y],_=3*a[3*y+1],b=3*a[3*y+2],x=s[b]-s[_],w=s[b+1]-s[_+1],S=s[b+2]-s[_+2],A=s[v]-s[_],E=s[v+1]-s[_+1],P=s[v+2]-s[_+2],T=w*P-S*E,R=S*A-x*P,L=x*E-w*A;d[v]+=T,d[v+1]+=R,d[v+2]+=L,d[_]+=T,d[_+1]+=R,d[_+2]+=L,d[b]+=T,d[b+1]+=R,d[b+2]+=L}for(let y=0;y<c;y++){let v=d[3*y],_=d[3*y+1],b=d[3*y+2],x=Math.sqrt(v*v+_*_+b*b)||1;d[3*y]=v/x,d[3*y+1]=_/x,d[3*y+2]=b/x}let u=3*h,p=new Float32Array(3*u),f=new Float32Array(3*u),g=l!==null&&l.length>0?new Float32Array(2*u):null;for(let y=0;y<u;y++){let v=3*a[y];p[3*y]=s[v],p[3*y+1]=s[v+1],p[3*y+2]=s[v+2],f[3*y]=d[v],f[3*y+1]=d[v+1],f[3*y+2]=d[v+2]}g!==null&&g.set(l.subarray(0,2*u));let m=new Gt;m.setAttribute("position",new Ht(p,3)),u>0&&(m.setAttribute("normal",new Ht(f,3)),m.setAttribute("color",new Ht(new Float32Array(3*u).fill(1),3))),g!==null&&m.setAttribute("uv",new Ht(g,2));for(let y=0;y<h;){let v=o[y],_=y;do y++;while(y<h&&o[y]===v);m.addGroup(3*_,3*(y-_),v)}return r.boundingBox!==null&&(m.boundingBox=r.boundingBox.clone()),r.boundingSphere!==null&&(m.boundingSphere=r.boundingSphere.clone()),m}(e,t)}}}),c4=F(()=>{et(),g$(),xn=new C,QN=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i,n=t.geometry??e?.geometry??new Gt().copy(new ga(100,100,100));e===void 0?(n.computeBoundingBox(),n.boundingBox.getSize(xn),i={width:xn.x,height:xn.y,depth:xn.z,subdivisions:0}):i=e.parameters;let r={...i,...t.parameters};return{parameters:{width:Math.abs(r.width),height:Math.abs(r.height),depth:Math.abs(r.depth),subdivisions:Math.abs(r.subdivisions)},geometry:n}}static build(t){let{width:e,height:i,depth:n,subdivisions:r}=t.parameters,s=t.geometry??new Gt().copy(new ga(100,100,100)),a=s.userData.parameters;a===void 0?(s.boundingBox=function(l){let c=new ci,h=l.attributes.position;return h?(c.setFromBufferAttribute(h),c):(c.makeEmpty(),c)}(s),s.boundingBox.getSize(xn)):xn.set(a.width,a.height,a.depth),(e!==xn.x||i!==xn.y||n!==xn.z)&&s.scale(xn.x===0?1:e/xn.x,xn.y===0?1:i/xn.y,xn.z===0?1:n/xn.z);let o=s.originalGeometry;try{r>0?(o===void 0||a?.subdivisions!==r)&&(o===void 0&&(o=s),s=new KN(r).modify(o)):(o!==void 0&&(s=o),o=void 0,s.getAttribute("normal")===void 0&&s.computeVertexNormals())}catch{o!==void 0&&(s=o),o=void 0,s.getAttribute("normal")===void 0&&s.computeVertexNormals()}return o!==void 0&&Object.assign(s,{originalGeometry:o}),delete t.geometry,Object.assign(s,{userData:{...t,type:"NonParametricGeometry"}})}static loadFromUrl(t,e,i){new tC(i).load(t,n=>{let r=this.normalizeInputs({geometry:n});n.boundingBox.getSize(xn);let s=100/xn.x;Object.assign(r.parameters,{width:100,height:xn.y*s,depth:xn.z*s}),e(this.build(r))})}}}),TA=F(()=>{yh(),dh(),qC=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:3},t.parameters);return{shape:t.shape&&t.shape instanceof Ni?t.shape:new Ni,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(t){let{width:e,height:i,spikes:n,cornerRadius:r,depth:s,extrudeBevelSize:a,extrudeBevelSegments:o}=t.parameters,l=t.shape,c=.5*e,h=.5*i,d=2*Math.PI/n;for(let p=0;p<n;p++){let f=d*p,g=0+Math.sin(f)*c,m=0+Math.cos(f)*h;l.addPoint(l.createPoint(g,m))}l.isClosed=!0;for(let p=0,f=l.points.length;p<f;p++)l.points[p].roundness=r;l.roundness=r,l.update();let u=_h.create({shape:l,parameters:{roundness:r,depth:s,extrudeBevelSize:a,extrudeBevelSegments:o}});return Object.assign(u,{userData:{...t,type:"PolygonGeometry"}})}}});function If(t,e,i){i.x=t.x*e.x,i.y=t.y,i.z=t.x*e.y}function zS(t,e,i,n,r,s){let a=tk.copy(e).sub(t),o=ek.copy(i).sub(t),l=a.angleTo(o);if(a.normalize(),o.normalize(),n===r){let c=a.add(o).normalize();s.copy(t).addScaledVector(c,n/Math.sin(l/2))}else{let c=a.angleTo(o);s.copy(t),s.addScaledVector(a,r/Math.sin(c)),s.addScaledVector(o,n/Math.sin(c))}}function v$(t,e,i){let n=t.clone().sub(e),r=i.clone().sub(e);return n.projectOnVector(r),n.add(e)}var JN,tk,ek,d4,Jb,ik,nk,rk,u4,XC,sk,ak,ok,lk,p4=F(()=>{et(),JN=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,radialSegments:4,heightSegments:1,cornerRadius:0,cornerSegments:8,openEnded:!1},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let{width:e,height:i,depth:n,radialSegments:r,heightSegments:s,openEnded:a,cornerRadius:o,cornerSegments:l}=t.parameters,c=new d4(.5*e,i,r,s,a,o,l),h=n/e;return h!==1&&c.scale(1,1,h),Object.assign(c,{userData:{...t,type:"PyramidGeometry"}})}},tk=new C,ek=new C,d4=class extends Gt{constructor(t=.5,e=1,i=4,n=1,r=!1,s=0,a=4){super(),i=Math.floor(Math.max(3,i)),n=Math.floor(n),a=Math.floor(a);let o,l=[],c=[],h=[],d=[],u=0,p=e/2,f=Math.PI/i,g=t*Math.cos(Math.PI/i),m=2*Math.PI/i,y=(i-2)*Math.PI/i,v=Math.PI-y,_=new C(0,-p,0),b=new C(0,p,0),x=new it(t,-p),w=new it(g,-p),S=new it(0,b.y).sub(w),A=new it(0,b.y).sub(x),E=new it(S.y,-S.x).normalize(),P=new it(A.y,-A.x).normalize(),T=t*Math.cos(Math.PI/i)*Math.tan((Math.PI-S.angle())/2)-1e-8;s=Math.min(s,T);{let Y=new C(E.x,E.y,0),$=new C(Math.cos(m)*Y.x,Y.y,Math.sin(m)*Y.x);o=Y.angleTo($)}let R=s/Math.tan((Math.PI-S.angle())/2),L=s/Math.tan((Math.PI-o)/2),D=new C;if(!r){c.push(_.x,_.y,_.z),h.push(0,-1,0),d.push(0,0);let Y=u++,$=[],nt=x.clone(),Q=R/Math.cos(Math.PI/i);nt.x-=Q;for(let rt=0;rt<i;rt++){let gt=rt/i*Math.PI*2+f;If(nt,new it(Math.sin(gt),Math.cos(gt)),D),c.push(D.x,D.y,D.z),h.push(0,-1,0),d.push(0,0),$.push(u++)}for(let rt=0;rt<$.length;rt++)l.push($[rt],Y,$[(rt+1)%$.length])}let U=[];{let Y=new C,$=new C,nt=new C,Q=new C,rt=new C,gt=new C;for(let at=0;at<i;at++){let ht=at/i*Math.PI*2+f,ct=(at+.5)/i*Math.PI*2+f,q=(at+1)/i*Math.PI*2+f,lt=new it(Math.sin(ht),Math.cos(ht)),z=new it(Math.sin(ct),Math.cos(ct)),O=new it(Math.sin(q),Math.cos(q));If(x,lt,$),If(x,O,nt),If(E,z,Y),zS(b,$,nt,L,L,Q),c.push(Q.x,Q.y,Q.z),zS($,b,nt,L,R,rt),c.push(rt.x,rt.y,rt.z),zS(nt,$,b,R,L,gt),c.push(gt.x,gt.y,gt.z),h.push(Y.x,Y.y,Y.z),h.push(Y.x,Y.y,Y.z),h.push(Y.x,Y.y,Y.z),d.push(0,0),d.push(0,0),d.push(0,0);let j=u++,Z=u++,I=u++;if(l.push(j,Z,I),s>0){{let N=$.clone().add(nt).multiplyScalar(.5),tt=b.clone().sub(N).normalize(),ot=_.clone().sub(N).normalize().add(tt).normalize().multiplyScalar(-1);V(N,gt.clone().sub(rt),ot,S.angle())}let G,W;{let N=new C;If(P,O,N);let tt=gt.clone().add(Q).multiplyScalar(.5);tt=v$(tt,nt,b);let ot=gt.clone().sub(Q);[G,W]=V(tt,ot,N,o,Q.y)}{let N=G,tt=N.clone().setY(0).normalize(),ot=new C(0,-1,0),pt=tt.clone().cross(ot);k(N,tt,ot,pt)}U.concat(W);{let N=S.angle(),tt=Math.PI-N,ot=b.clone();ot.y-=s/Math.sin(N-Math.PI/2);let pt=new C,ut=[];for(let bt=0;bt<a;bt++){let Rt=[],_t=Math.PI/2-tt*bt/a,X=Math.cos(_t),vt=Math.sin(_t),Dt=ct;for(let jt=0;jt<=bt;jt++){let Ft=Math.cos(Dt),_e=Math.sin(Dt);Y.x=X*_e,Y.y=vt,Y.z=X*Ft,pt.copy(ot).addScaledVector(Y,s),c.push(pt.x,pt.y,pt.z),h.push(Y.x,Y.y,Y.z),d.push(0,0),Rt.push(u++),Dt+=2*Math.PI/bt/i}ut.push(Rt)}W.reverse(),ut.push(W);let Pt=ut.length-1;for(let bt=0;bt<Pt;bt++){let Rt=ut[bt],_t=ut[bt+1],X=Rt.length-1;l.push(_t[1],Rt[0],_t[0]);for(let vt=1;vt<=X;vt++)l.push(Rt[vt],Rt[vt-1],_t[vt]),l.push(_t[vt+1],Rt[vt],_t[vt])}}}}}function V(Y,$,nt,Q,rt){let gt=-Q/2,at=(Math.PI-Q)/2,ht=$.clone().normalize().cross(nt);Y.addScaledVector(nt,-s/Math.sin(at));let ct=new C,q=new C,lt=u,z=[];for(let O=0;O<=a;O++){let j=gt+O/a*Q;q.set(0,0,0),q.addScaledVector(ht,Math.sin(j)),q.addScaledVector(nt,Math.cos(j));for(let Z=0;Z<=1;Z++){let I=Z/1-.5;if(ct.copy(Y),ct.addScaledVector($,I),ct.addScaledVector(q,s),rt!=null){let G=Math.max(0,ct.y-rt);ct.addScaledVector($,-G/$.y)}c.push(ct.x,ct.y,ct.z),h.push(q.x,q.y,q.z),d.push(0,0),Z===0&&z.push(u),u++}}for(let O=0;O<a;O++)for(let j=0;j<1;j++){let Z=lt+j+2*O,I=Z+2,G=I+1,W=Z+1;l.push(Z,I,W),l.push(I,G,W)}return[Y.clone().addScaledVector($,.5),z]}function k(Y,$,nt,Q){let rt=Math.PI/2,gt=A.angle()-rt,at=[],ht=new C,ct=new C;for(let lt=0;lt<=a;lt++){let z=[],O=lt/a;for(let j=0;j<=lt;j++){let Z=((lt?j/lt:0)-.5)*v,I=Math.cos(Z),G=Math.sin(Z),W=(rt+Math.atan(Math.tan(gt)*I))*O,N=Math.cos(W),tt=Math.sin(W);ht.set(0,0,0),ht.addScaledVector($,tt*I),ht.addScaledVector(nt,N),ht.addScaledVector(Q,tt*G),ct.copy(Y).addScaledVector(ht,s),c.push(ct.x,ct.y,ct.z),h.push(ht.x,ht.y,ht.z),d.push(0,0),z.push(u++)}at.push(z)}let q=at.length-1;for(let lt=0;lt<q;lt++){let z=at[lt],O=at[lt+1],j=z.length-1;l.push(z[0],O[1],O[0]);for(let Z=1;Z<=j;Z++)l.push(z[Z-1],z[Z],O[Z]),l.push(z[Z],O[Z+1],O[Z])}}this.setIndex(l),this.setAttribute("position",new Nt(c,3)),this.setAttribute("normal",new Nt(h,3)),this.setAttribute("uv",new Nt(d,2))}}}),tb=F(()=>{yh(),dh(),Jb=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,cornerRadius:[0,0,0,0],cornerType:1,extrudeBevelSize:0,extrudeBevelSegments:1},t.parameters),n=Object.assign(e?.ui??{enabledIndieCorners:!1},t.ui);return{shape:t.shape&&t.shape instanceof Ni?t.shape:new Ni,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)}),ui:n}}static build(t){let e=t.shape,{width:i,height:n,cornerRadius:r,cornerType:s,depth:a,extrudeBevelSize:o,extrudeBevelSegments:l}=t.parameters,c={x:.5*i,y:.5*n},h={x:-c.x,y:-c.y},d={x:c.x,y:c.y};function u(b,x,w){return x>i&&w>n?Math.min(b*i/x,b*n/w):x>i?b*i/x:w>n?b*n/w:b}let p=[];p[0]=r[0]===0?0:u(r[0],r[0]+r[3],r[0]+r[1]),p[1]=r[1]===0?0:u(r[1],r[1]+r[2],r[1]+r[0]),p[2]=r[2]===0?0:u(r[2],r[2]+r[1],r[2]+r[3]),p[3]=r[3]===0?0:u(r[3],r[3]+r[0],r[3]+r[2]);let f=h.x,g=d.x,m=d.y,y=h.y;e.addPoint(e.createPoint(f,m)),e.addPoint(e.createPoint(g,m)),e.addPoint(e.createPoint(g,y)),e.addPoint(e.createPoint(f,y)),e.isClosed=!0;let v=!0;for(let b=0,x=e.points.length;b<x;b++)e.points[b].roundness=p[b],b>0&&p[b]!==p[b-1]&&(v=!1);v&&(e.roundness=p[0]),e.useCubicForRoundedCorners=s!==1,e.update();let _=_h.create({shape:e,parameters:{depth:a,extrudeBevelSize:o,extrudeBevelSegments:l}});return Object.assign(_,{userData:{...t,type:"RectangleGeometry"}})}}}),f4=F(()=>{et(),ik=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180},t.parameters);return i.thetaLength=Ot.clamp(i.thetaLength,0,180),{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let e,{width:i=100,height:n=i,depth:r=i,widthSegments:s=64,heightSegments:a=64,phiStart:o,phiLength:l,thetaStart:c,thetaLength:h}=t.parameters;return h===0?(e=new Gt,e.setAttribute("position",new Nt([],3))):e=new rh(.5*i,s,a,o,l,c,h*Ot.DEG2RAD),e.scale(1,n/i,r/i),Object.assign(e,{userData:{...t,type:"SphereGeometry"}})}}}),m4=F(()=>{et(),nk=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,widthSegments:8,heightSegments:8},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:0})}}static build(t){let{width:e=100,height:i=e,widthSegments:n=8,heightSegments:r=8}=t.parameters,s=new lo(e,i,n,r);return s.scale(1,1,1),Object.assign(s,{userData:{...t,type:"PlaneGeometry"}})}}}),g4=F(()=>{et(),rk=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,angle:90,cornerRadius:24,cornerSegments:8},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let{width:e,height:i,depth:n,angle:r,cornerRadius:s,cornerSegments:a}=t.parameters,o=new u4(e,i,n,r,s,a);return Object.assign(o,{userData:{...t,type:"BackdropGeometry"}})}},u4=class extends Gt{constructor(t=1,e=1,i=1,n=90,r=10,s=24){super(),this.type="BackdropGeometry";let a=[],o=[],l=[],c=.001;r==0&&(s=1),s=Math.max(1,Math.floor(s)),r=Math.min(r,100),n=Math.min(180-c,n),n*=Math.PI/180;let h=[],d=Math.PI/2,u=(ct=0,q=0,lt=0)=>new C(ct,q,lt),p=u(),f=u(),[g,m,y]=[e/2,t/2,i/2],v=-m,_=+m,[b,x,w]=[u(v,-g,+y),u(v,-g,-y),u(v,+g,-y)],S=(ct,q=!1)=>Math.sin(ct-Math.PI/(+q+1)),A=(ct,q=!1)=>Math.cos(ct-Math.PI/(+q+1));w.y=Math.sin(n)*e-g;let E=Math.cos(n)*e-y,P=b.z-c;n<=d?(w.z=Math.min(E,P),w.z==P&&(w.y-=(E-P)/Math.tan(d-n))):x.z=Math.min(x.z-E-y,b.z-c),p.subVectors(b,x),f.subVectors(w,x);let T=Math.min(p.length(),f.length())*r/100,R=T*Math.tan(n/2),L=T/Math.cos(n/2),D=p.clone().normalize().add(f.normalize()).setLength(L).add(x);p.set(0,S(n,!0),A(n,!0)),h.push([w,p.clone()]);let U=(Math.PI-n)/s;for(let ct=0;ct<=s;ct++){let q=d+n+ct*U;p.set(0,Math.sin(q)*R,Math.cos(q)*R),p.add(D),f.set(0,S(q),A(q)),h.push([p.clone(),f.clone()])}h.push([b,u(0,1,0)]);let V=Math.sin(U/2)*R*2,k=h.length-1,Y=h[0][0].distanceTo(h[1][0]),$=Y+V*s+h[k-1][0].distanceTo(h[k][0]);h[0].push(1);for(let ct=0;ct<=s;ct++)h[ct+1].push(1-(Y+ct*V)/$);h[k].push(0);let nt,Q,rt,[gt,at,ht]=h[0];for(let ct=1;ct<h.length;ct++)[nt,Q,rt]=h[ct],a.push(v,gt.y,gt.z,v,nt.y,nt.z,_,gt.y,gt.z,_,gt.y,gt.z,v,nt.y,nt.z,_,nt.y,nt.z),o.push(0,at.y,at.z,0,Q.y,Q.z,0,at.y,at.z,0,at.y,at.z,0,Q.y,Q.z,0,Q.y,Q.z),l.push(0,ht,0,rt,1,ht,1,ht,0,rt,1,rt),[gt,at,ht]=[nt,Q,rt];this.setAttribute("position",new Nt(a,3)),this.setAttribute("normal",new Nt(o,3)),this.setAttribute("uv",new Nt(l,2))}}}),CA=F(()=>{yh(),dh(),XC=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,innerRadiusPercent:38.19,spikes:5,cornerRadius:0,angle:360,extrudeBevelSize:0,extrudeBevelSegments:1},t.parameters);return{shape:t.shape&&t.shape instanceof Ni?t.shape:new Ni,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(t){let{width:e,height:i,innerRadiusPercent:n,spikes:r,cornerRadius:s,angle:a,depth:o,extrudeBevelSize:l,extrudeBevelSegments:c}=t.parameters,h=t.shape,d=.5*e,u=.5*i,p=a*Math.PI/360/r,f=Math.PI/2*3*-1,g=d*n/100,m=u*n/100;if(r===3&&n===50){p=2*Math.PI/r;for(let v=0;v<r;v++){let _=p*v,b=0+Math.sin(_)*d,x=0+Math.cos(_)*u;h.addPoint(h.createPoint(b,x))}}else for(let v=0;v<r;v++){let _=0+Math.cos(f)*d,b=0+Math.sin(f)*u;h.addPoint(h.createPoint(_,b)),f+=p,_=0+Math.cos(f)*g,b=0+Math.sin(f)*m,h.addPoint(h.createPoint(_,b)),f+=p}h.isClosed=!0;for(let v=0,_=h.points.length;v<_;v++)h.points[v].roundness=s;h.roundness=s,h.update();let y=_h.create({shape:h,parameters:{roundness:s,depth:o,extrudeBevelSize:l,extrudeBevelSegments:c}});return Object.assign(y,{userData:{...t,type:"StarGeometry"}})}}}),v4=F(()=>{et(),sk=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(t){let{width:e,height:i}=t.parameters,n=new lo(e,i);return Object.assign(n,{userData:{...t,type:"TextFrameGeometry"}})}}}),y4=F(()=>{et(),Ig(),ak=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,radialSegments:32,tubularSegments:64,arc:360,cornerRadius:30,cornerSegments:8},t.parameters),n=Math.abs(i.width),r=Math.abs(i.height??i.width);i.shapeBlendNode&&(r=n);let s=Math.round(Math.abs(i.depth??.25*i.width));return{parameters:Object.assign(i,{width:n,height:r,depth:s})}}static build(t){let{width:e,height:i,depth:n,radialSegments:r,tubularSegments:s,arc:a,cornerRadius:o,cornerSegments:l}=t.parameters,c=function(h,d,u,p,f,g,m,y,v,_,b){[d,u]=[u,d],m=d/2;let x=Ot.clamp(f/360,0,1);if(x===0){let w=new Gt;return w.setAttribute("position",new Nt([],3)),w}return x===1&&(_=0),new fA(!0,h,d,u,p,x,g,m,0,v,_,b)}(e,i,n,.5*e,a,s,0,0,r,o,l);return c.scale(1,i/e,1),Object.assign(c,{userData:{...t,type:"TorusGeometry"}})}}}),_4=F(()=>{et(),ok=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,tubularSegments:64,radialSegments:32,p:2,q:3},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width),tube:i.tube??.125*i.width})}}static build(t){let{width:e,tube:i,tubularSegments:n,radialSegments:r,p:s,q:a}=t.parameters,o=.5*e;o!==i&&(o-=i);let l=new hE(o,i,n,r,s,a);return Object.assign(l,{userData:{...t,type:"TorusKnotGeometry"}})}}}),b4=F(()=>{yh(),dh(),lk=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1,isRect:!1},t.parameters);return{shape:t.shape&&t.shape instanceof Ni?t.shape:new Ni,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width*(i.isRect?1:Math.sqrt(3)/2)),depth:Math.abs(i.depth??0)})}}static build(t){let{width:e=100,height:i,cornerRadius:n,depth:r,extrudeBevelSize:s,extrudeBevelSegments:a,isRect:o}=t.parameters,l=t.shape,c=.5*e,h=.5*i;o?(l.addPoint(l.createPoint(-c,h)),l.addPoint(l.createPoint(c,-h)),l.addPoint(l.createPoint(-c,-h))):(l.addPoint(l.createPoint(0,h)),l.addPoint(l.createPoint(c,-h)),l.addPoint(l.createPoint(-c,-h))),l.isClosed=!0;for(let u=0,p=l.points.length;u<p;u++)l.points[u].roundness=n;l.roundness=n,l.update();let d=_h.create({shape:l,parameters:{roundness:n,depth:r,extrudeBevelSize:s,extrudeBevelSegments:a}});return Object.assign(d,{userData:{...t,type:"TriangleGeometry"}})}}}),y$=F(()=>{}),_$=F(()=>{et(),new vr,new At,new $o,new C,new C,new C,new C});function x4(){let t=new Gt;return t.setAttribute("position",new Ht(new Float32Array([]),3)),t.setIndex(new Ht(new Uint16Array([]),1)),t}var w4,PA,hk=F(()=>{ar(),Yt(),wp(),et(),Hg(),yh(),dh(),w4=x4().attributes,PA=class extends Gt{constructor(t,e){super(),this.isTextGeometry=!0,this.charWidths=[],this.charCoords=[],this.wrappedText=[],this.isLowResolution=!1,this.vectorShapes=[],Object.assign(this.attributes,w4),this.userData={parameters:t,type:"TextGeometry"};let i=e.getFont(t.font);i?.isLoaded?(this.font=i,this.update(t,e)):this.updateFont(t.font,e).then(()=>{this.update(t,e),e?.requestRender()})}async updateFont(t,e){let i=e.getFont(t);i&&(this.font=i,await i.loadingPromise)}update(t,e){let i=this.font;if(this.userData={parameters:t,type:"TextGeometry"},!i?.isLoaded)return void console.warn("Cannot update text because its font is not loaded");let{width:n,height:r,depth:s,extrudeBevelSize:a,extrudeBevelSegments:o,text:l,textTransform:c}=t,h=_r.getDisplayedValue(l),d=function(b,x,w,S){let A=typeof b.width=="string"?Number(S.getVariable(b.width)):b.width,E=[""],P="";for(let T of w)P+=T,T===" "||T===`
|
|
4168
4168
|
`?(E[E.length-1]+=P,P="",T===`
|
|
4169
|
-
`&&E.push("")):x.getTextWidth(E[E.length-1]+P,b)>A&&(E[E.length-1].length&&E.push(""),x.getTextWidth(E[E.length-1]+P,b)>A&&(P.length===1?(E[E.length-1]+=P,P=""):(E[E.length-1]+=P.slice(0,-1),P=P[P.length-1],E.push(""))));return E[E.length-1]+=P,E}(t,i,c===2?h.toUpperCase():c===3?h.toLowerCase():h,e),{shapes:u,charWidths:p,charCoords:f}=i.generateShapes(d,t,e),g=.5*(typeof n=="number"?n:Number(e.getVariable(n))),m=.5*(typeof r=="number"?r:Number(e.getVariable(r))),y=u.map(b=>new Ni().fromShape(b,!0));this.vectorShapes=y;let v=y.map(b=>_h.create({shape:b,parameters:{depth:s,extrudeBevelSegments:o,extrudeBevelSize:a,windingRule:s<=0?fi.NONZERO:fi.ODD,subdivisions:this.isLowResolution&&s>0?1:12}})),_=v.length?Sc(v):x4();_.translate(-g,m,0),this.dispose(),this.wrappedText=d,this.charCoords=f,this.charWidths=p,this.deleteAttribute("extrudeNormal"),Object.entries(_.attributes).forEach(([b,x])=>{this.setAttribute(b,x)}),this.setIndex(_.index),this.computeBoundingSphere()}clone(){let t=Er(new Gt,PA.prototype);return t.copy(this),console.log("CloneGeometry",this,t),t}copy(t){return Object.entries(t.attributes).forEach(([e,i])=>{this.setAttribute(e,i)}),this.setIndex(t.index),this.userData={parameters:{...t.userData.parameters},type:"TextGeometry"},this}async setText(t,e){this.font&&await this.font.loadingPromise,await this.update({...this.userData.parameters,text:{textValue:t}},e)}get text(){return this.userData.parameters.text??""}}});function b$(t){if(!DA)return S4||(S4=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.31/build",i=import("./process.js"),[n,r]=await Promise.all([i,fetch(`${e}/process.wasm`).then(o=>o.arrayBuffer())]),s=n.default,a=await s({wasmBinary:r});ck(a),DA=!0}())}var ck,$C,DA,S4,tx=F(()=>{$C=new Promise(t=>{ck=t}),DA=!1});function FS(t,e){if(Object.keys(t.morphAttributes).length>0||Object.keys(e.morphAttributes).length>0)return!1;let i=Object.keys(t.attributes),n=Object.keys(e.attributes);if(i.length!==n.length)return!1;for(let o of n){let l=t.attributes[o],c=e.attributes[o];if(l===void 0||l.isInterleavedBufferAttribute===!0||c.isInterleavedBufferAttribute===!0||l.itemSize!==c.itemSize||l.normalized!==c.normalized||l.array.constructor!==c.array.constructor||l.array.length!==c.array.length)return!1}let r=t.index,s=e.index;if(r===null!=(s===null))return!1;let a=!1;if(r!==null&&s!==null){if(r.array.length!==s.array.length)return!1;let o=r.array.constructor,l=s.array.constructor;if(o!==l){if(o!==Uint32Array||l!==Uint16Array)return!1;a=!0}}if(t.groups.length!==e.groups.length)return!1;for(let o=0;o<e.groups.length;o++){let l=t.groups[o],c=e.groups[o];if(l.start!==c.start||l.count!==c.count||l.materialIndex!==c.materialIndex)return!1}for(let o of n){let l=t.attributes[o],c=e.attributes[o];l.array.set(c.array),l.needsUpdate=!0}if(r!==null&&s!==null){if(a){let o=r.array,l=s.array;for(let c=0,h=l.length;c<h;c++){let d=l[c];o[c]=d===65535?4294967295:d}}else r.array.set(s.array);r.needsUpdate=!0}return t.drawRange.start=e.drawRange.start,t.drawRange.count=e.drawRange.count,t.userData=e.userData,t.boundingBox=null,t.boundingSphere=null,!0}function RA(t,e,i,n){let r,s,a,o=t.position.array,l=t.normal.array,c=dk.makeScale(e,i,n).invert().elements;for(let h=0,d=o.length;h<d;h+=3)o[h]*=e,o[h+1]*=i,o[h+2]*=n,r=l[h],s=l[h+1],a=l[h+2],l[h]=c[0]*r+c[4]*s+c[8]*a,l[h+1]=c[1]*r+c[5]*s+c[9]*a,l[h+2]=c[2]*r+c[6]*s+c[10]*a;t.position.needsUpdate=!0,t.normal.needsUpdate=!0}var dk,uk=F(()=>{et(),dk=new At});function pk(t){let e=Object.keys(t);return e.length===1&&e[0]==="subdivisions"}function YC(t,e){let i=e?e.count:t.count,n=0,r=1e4,s=new Map,a=new Uint32Array(i),o=[];for(let h=0;h<i;h++){let d=e?e.getX(h):h,u=t.getX(d),p=t.getY(d),f=t.getZ(d),g=Math.round(u*r),m=Math.round(p*r),y=Math.round(f*r),v=s.get(g);v===void 0&&(v=new Map,s.set(g,v));let _=v.get(m);_===void 0&&(_=new Map,v.set(m,_));let b=_.get(y);b===void 0&&(b=n++,_.set(y,b),o.push(u,p,f)),a[h]=b}let l=[],c=[];for(let h=0;h<a.length;h+=3)a[h]===a[h+1]||a[h]===a[h+2]||a[h+1]===a[h+2]||(l.push(a[h],a[h+1],a[h+2]),c.push(e?e.getX(h):h,e?e.getX(h+1):h+1,e?e.getX(h+2):h+2));return{positions:o,triIndices:l,triOriginals:c}}var Of,Kh,Qt,NS,kS,VS,Fi,Lf,Av,Tv,Cv,IA,m1,Sp=F(()=>{et(),tx(),Yt(),ex(),uk(),Ig(),Of=new ci,Kh=new C,$C.then(t=>{Qt=t}),NS=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),kS=new Uint32Array([0,1,2,3]),VS=new Uint8Array([4]),Fi=class extends Gt{constructor(t,e){super(),this.data=t,this.flatShading=e,this.subdivPointer=0,this.rebuild(),this.freeSubdivPointer()}mutateDirectlyScaleBaked(t,e){this.freeSubdivPointer();let i=this.data.scaleBaked.map(a=>typeof a=="number"?a:1),n=ah.div(e.map(a=>typeof a=="number"?a:0),i);if(n.every(a=>a===1))return;this.subdividedGeometry&&RA(this.subdividedGeometry.attributes,...n),this.originalGeometry&&RA(this.originalGeometry.attributes,...n),this.data=t;let r=this.userData.parameters;this.userData.parameters={width:r.width*n[0],height:r.height*n[1],depth:r.depth*n[2]},this.originalGeometry.boundingSphere.center.multiply(Kh.fromArray(n));let s=Kh.set(r.width,r.height,r.depth).length();this.originalGeometry.boundingSphere.radius=s/2}ensureSubdivPointer(){return this.subdivPointer===0&&this.rebuild(),this.subdivPointer}mutateDirectlySubdivisions(t){this.freeSubdivPointer(),this.data=t;let e=t.phongAngle??35;this.flatShading&&(e=-1);let i=null;if(t.subdivisions>0){let r=0;try{r=Fi.allocate(t),i=Fi.buildRefined(r,t.subdivisions,e)}catch(s){console.error(s,t)}finally{r&&Fi.freeSubdivPointer(r)}}this.subdividedGeometry?.dispose(),this.subdividedGeometry=i??void 0,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere);let n=this.userData.parameters;Object.assign(this,this.subdividedGeometry??this.originalGeometry),this.userData.parameters=n}rebuild(){let t,e,i;try{({originalGeometry:t,subdividedGeometry:e,subdivPointer:i}=Fi.build(this.data,void 0,!this.flatShading,void 0))}catch{t=new ga(100,100,100),i=0}this.subdivPointer=i,this.originalGeometry=t,this.subdividedGeometry=e??void 0;let n=this.subdividedGeometry??this.originalGeometry;Object.assign(this,n),this.calcBoundingBox()}freeSubdivPointer(){this.subdivPointer&&(Fi.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0)}dispose(){super.dispose(),this.freeSubdivPointer()}calcBoundingBox(){let t=this.originalGeometry;t.boundingSphere===null&&(t.boundingSphere=new vr,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=t.boundingSphere));let e=t.attributes.position,i=t.boundingSphere.center;Of.setFromBufferAttribute(e),Of.getCenter(i),t.boundingSphere.radius=i.distanceTo(Of.max),isNaN(t.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),Of.getSize(Kh);let n={width:Kh.x,height:Kh.y,depth:Kh.z};return this.userData.parameters=n,n}static build(t,e,i,n){let r,s,a=t?.phongAngle??35;i===!1&&(a=-1),e&&(Qt.free_bvh(e),Qt.free_subdivision_surface(e));try{r=Fi.allocate(t,n)}catch(l){console.error(l,t),r=Fi.allocate({positionWASM:NS,indexWASM:kS,verticesPerFaceWASM:VS},n)}Qt.set_destination_refinement_level(r,0);let o=Fi.buildLevel(r,!0,a);return s=t.subdivisions>0?Fi.buildRefined(r,t.subdivisions,a):null,{subdivPointer:r,originalGeometry:o,subdividedGeometry:s}}static buildRefined(t,e,i){try{return Qt.set_destination_refinement_level(t,e),Fi.buildLevel(t,!1,i)??null}catch{try{return Qt.set_destination_refinement_level(t,e-1),Fi.buildLevel(t,!1,i)??null}catch{return null}}}static primitiveToQuads(t,e,i){t.widthSegments>16&&(t.widthSegments=16),t.heightSegments>16&&(t.heightSegments=16),t.depthSegments>16&&(t.depthSegments=16),t.radialSegments>16&&(t.radialSegments=16),t.type==="DodecahedronGeometry"&&(t.detail=0);let n,r=t.shape!==void 0||t.path!==void 0?e.geometry:Ql(t,i,!1,e);n=mN(t)?r.getClosedTorusIndicesForBooleanOrSubdiv():r.getIndex();let s,{positions:a,triIndices:o,triOriginals:l}=YC(r.getAttribute("position"),n);if(t.type==="CylinderGeometry"&&t.cornerRadius===0&&t.hollow===0&&t.openEnded===!1){let u=t.radialSegments*t.heightSegments*3*2;s=[u,u+3*t.radialSegments]}let{indices:c,verticesPerFace:h,uvs:d}=function(u,p,f,g,m){let y=[],v=[],_=m?f.getAttribute("uv"):void 0,b=_&&_.itemSize===2?[]:void 0,x=A=>{if(b){let E=m[A];b.push(_.getX(E),_.getY(E))}};if(f.userData.shape!==void 0&&f.userData.parameters.depth===0&&f.userData.shape.shapeHoles.length===0){let A=f.userData.shape.extractShapePointsToFlatArray([]),E=f.userData.parameters.spikes;if(f.userData.type==="EllipseGeometry"&&E<=24&&E%4==0&&f.userData.parameters.angle>=360){let R=A.length/2/E;A=A.filter((L,D)=>Math.floor(D/2)%R===0)}let P=0;for(let R=0;R<A.length;R+=2)P+=(A[R]-A[(R===0?A.length:R)-2])*(A[R+1]+A[(R===0?A.length:R)-1]);u.length=0;let T=0;if(P<0)for(let R=0;R<A.length;R+=2)u.push(A[R],A[R+1],0),y.push(T++);else for(let R=A.length-2;R>=0;R-=2)u.push(A[R],A[R+1],0),y.push(T++);return v.push(T),{indices:y,verticesPerFace:v}}let w=new Float32Array([f.userData.parameters.depth])[0],S=0;for(;S<p.length;){if(f.useNgonForTopBottomFaceDuringBake){let A=0;if((u[3*p[S]+2]===w||u[3*p[S]+2]===0)&&A++,(u[3*p[S+1]+2]===w||u[3*p[S+1]+2]===0)&&A++,(u[3*p[S+2]+2]===w||u[3*p[S+2]+2]===0)&&A++,A===3)break}if(p[S+1]===p[S+3]&&p[S+2]===p[S+5]||p[S+0]===p[S+3]&&p[S+2]===p[S+4]){Lf.set(u[3*p[S]],u[3*p[S]+1],u[3*p[S]+2]),Av.set(u[3*p[S+1]],u[3*p[S+1]+1],u[3*p[S+1]+2]),Tv.set(u[3*p[S+4]],u[3*p[S+4]+1],u[3*p[S+4]+2]),Cv.set(u[3*p[S+5]],u[3*p[S+5]+1],u[3*p[S+5]+2]),Av.sub(Lf).normalize(),Tv.sub(Lf).normalize(),Cv.sub(Lf).normalize();let A=Av.cross(Tv).dot(Cv),E=S;Math.abs(A)>.005||g&&g.some((P,T)=>T%2!=1&&E>=g[T]&&E<g[T+1])?(y.push(p[S],p[S+1],p[S+2]),x(S),x(S+1),x(S+2),v.push(3),S+=3):(y.push(p[S],p[S+1],p[S+4],p[S+5]),x(S),x(S+1),x(S+4),x(S+5),v.push(4),S+=6)}else y.push(p[S],p[S+1],p[S+2]),x(S),x(S+1),x(S+2),v.push(3),S+=3}if(f.useNgonForTopBottomFaceDuringBake){let A=[],E=[],P=0;for(let T=0,R=0;T<u.length;T+=3,R++)u[T+2]===0&&(A.push(R),P++),u[T+2]===w&&E.push(R);if(f.userData.parameters.extrudeBevelSize===0){let T=E[0];E[0]=E[1],E[1]=T}A.reverse(),y.push(...A,...E),v.push(P,P),b=void 0}return{indices:y,verticesPerFace:v,uvs:b}}(a,o,r,s,l);return{positions:a,indices:c,verticesPerFace:h,uvs:d}}static allocate(t,e){let i,n,r,s=[],a=[];t.positionWASM&&t.positionWASM.length>0?(i=t.positionWASM,n=t.indexWASM,r=t.verticesPerFaceWASM,Qt.alloc_subdivision_surface_uvs&&t.uvWASM&&t.uvWASM.length===2*n.length&&(a=t.uvWASM)):(i=NS,n=kS,r=VS);let o,l=i.length,c=n.length,h=r.length,d=i.length+s.length+a.length,u=n.length+r.length,p=d*Float32Array.BYTES_PER_ELEMENT+u*Uint32Array.BYTES_PER_ELEMENT,f=d*Float32Array.BYTES_PER_ELEMENT,g=Qt._malloc(p),m=new Float32Array(Qt.HEAPF32.buffer,g,d),y=new Uint32Array(Qt.HEAPU32.buffer,g+f,u);m.set(i,0),m.set(s,i.length),m.set(a,i.length+s.length),y.set(n,0),y.set(r,n.length),t?.scaleBaked?.some(b=>b!==1)&&(o=new At().makeScale(...t.scaleBaked.map(b=>typeof b=="number"?b:1))),e&&(o?o.premultiply(e):o=e);let v=g+(i.length+s.length)*Float32Array.BYTES_PER_ELEMENT,_=a.length?o?Qt.alloc_subdivision_surface_uvs2(g,l,g+f,c,g+f+n.length*Uint32Array.BYTES_PER_ELEMENT,h,v,a.length,o.elements):Qt.alloc_subdivision_surface_uvs(g,l,g+f,c,g+f+n.length*Uint32Array.BYTES_PER_ELEMENT,h,v,a.length):o?Qt.alloc_subdivision_surface2(g,l,g+f,c,g+f+n.length*Uint32Array.BYTES_PER_ELEMENT,h,o.elements):Qt.alloc_subdivision_surface(g,l,g+f,c,g+f+n.length*Uint32Array.BYTES_PER_ELEMENT,h);return Qt._free(g),_}static buildLevel(t,e,i,n,r,s=!1){let a=r?Qt.get_mesh_data2(t,e?Qt.Level.CONTROL:Qt.Level.REFINED,i,r.elements):Qt.get_mesh_data(t,e?Qt.Level.CONTROL:Qt.Level.REFINED,i),o=Qt.HEAPU32.subarray(a>>2,10+(a>>2)),l=o.subarray(4,8),c=0,h=Qt.HEAPU32[o[c]>>2],d=Qt.HEAPF32.subarray(h>>2,(h>>2)+l[c]);c++;let u=Qt.HEAPU32[o[c]>>2],p=Qt.HEAPF32.subarray(u>>2,(u>>2)+l[c]);c++;let f=Qt.HEAPU32[o[c]>>2],g=Qt.HEAPU32.subarray(f>>2,(f>>2)+l[c]);c++;let m,y=Qt.HEAPU32[o[c]>>2],v=Qt.HEAPU32.subarray(y>>2,(y>>2)+l[c]);if(c++,Qt.alloc_subdivision_surface_uvs){let b=o[9];if(b>0){let x=Qt.HEAPU32[o[8]>>2];m=Qt.HEAPF32.subarray(x>>2,(x>>2)+b)}}if(n===void 0){let b=new Gt;if(b.setIndex(new nh(v,1)),b.setAttribute("position",new Nt(d,3)),b.setAttribute("normal",new Nt(p,3)),m&&b.setAttribute("uv",new Nt(m,2)),e){b.setAttribute("faceMap",new nh(g,1));let x=new Float32Array(p.length/3*4).fill(0);b.setAttribute("color",new Ht(x,4))}return Qt.free_mesh_data(a),b.userData.type="SubdivGeometry",b}if(n.getAttribute("position").copyArray(d),n.getAttribute("normal").copyArray(p),n.attributes.position.needsUpdate=!0,n.attributes.normal.needsUpdate=!0,s){let b=n.getIndex();b!==null&&b.array.length===v.length&&(b.copyArray(v),b.needsUpdate=!0)}let _=n.getAttribute("uv");m&&_&&_.array.length===m.length&&(_.copyArray(m),_.needsUpdate=!0),Qt.free_mesh_data(a)}static freeSubdivPointer(t){Qt.free_bvh(t),Qt.free_subdivision_surface(t)}static buildControlCageWireframe(t,e,i){let n=Qt.get_wireframe_data_for_base_level(t),r=Qt.HEAPU32.subarray(n>>2,4+(n>>2)),s=r.subarray(2,4),a=0,o=Qt.HEAPU32[r[a]>>2],l=Qt.HEAPF32.subarray(o>>2,(o>>2)+s[a]);a++;let c=Qt.HEAPU32[r[a]>>2],h=Qt.HEAPU32.subarray(c>>2,(c>>2)+s[a]);if(e===void 0){let d=new Gt;d.setAttribute("position",new Nt(l,3));let u=new Float32Array(l.length);for(let p=0,f=l.length;p<f;)u[p++]=i.r,u[p++]=i.g,u[p++]=i.b;return d.setAttribute("color",new Ht(u,3)),d.setIndex(new nh(h,1)),Qt.free_wireframe_data_for_base_level(n),d}e.getAttribute("position").copyArray(l),e.attributes.position.needsUpdate=!0,Qt.free_wireframe_data_for_base_level(n)}static updateCollabMesh(t,e,i){let n=e===0;n||Qt.set_destination_refinement_level(t,e);let r=i?Qt.get_topological_data2(t,n?Qt.Level.CONTROL:Qt.Level.REFINED,i.elements):Qt.get_topological_data(t,n?Qt.Level.CONTROL:Qt.Level.REFINED),s=Qt.HEAPU32.subarray(r>>2,8+(r>>2)),a=s.subarray(3,6),o=0,l=Qt.HEAPU32[s[o]>>2],c=new Float32Array(Qt.HEAPF32.subarray(l>>2,(l>>2)+a[o]));o++;let h=Qt.HEAPU32[s[o]>>2],d=new Uint32Array(Qt.HEAPU32.subarray(h>>2,(h>>2)+a[o]));o++;let u,p=Qt.HEAPU32[s[o]>>2],f=new Uint8Array(Qt.HEAPU32.subarray(p>>2,(p>>2)+a[o]));if(Qt.alloc_subdivision_surface_uvs){let g=s[7];if(g>0){let m=Qt.HEAPU32[s[6]>>2];u=new Float32Array(Qt.HEAPF32.subarray(m>>2,(m>>2)+g))}}return Qt.free_topological_data(r),{positions:c,indices:d,verticesPerFace:f,uvs:u}}},Lf=new C,Av=new C,Tv=new C,Cv=new C}),fk=F(()=>{WO(),qO(),Z_(),XO(),J_(),Ig(),l4(),h4(),c4(),TA(),p4(),tb(),f4(),m4(),g4(),CA(),v4(),y4(),_4(),b4(),dh(),ke(),WO(),qO(),Z_(),XO(),J_(),y$(),Ig(),l4(),h4(),c4(),TA(),p4(),tb(),f4(),m4(),g4(),CA(),v4(),y4(),_4(),b4(),dh(),_$(),WN(),hk(),Sp(),tx(),Kb(),IA={ConeGeometry:IN,CubeGeometry:ON,CylinderGeometry:GC,DodecahedronGeometry:LN,EllipseGeometry:Qb,HelixGeometry:gN,IcosahedronGeometry:YN,LatheGeometry:ZN,NonParametricGeometry:QN,PolygonGeometry:qC,PyramidGeometry:JN,RectangleGeometry:Jb,SphereGeometry:ik,PlaneGeometry:nk,BackdropGeometry:rk,StarGeometry:XC,TextFrameGeometry:sk,TorusGeometry:ak,TorusKnotGeometry:ok,TriangleGeometry:lk,VectorGeometry:_h},m1=t=>{let e=IA[t.type]??sN(t.type);if(e===void 0)throw new Error(`No geometry factory registered for "${t.type}" \u2014 was its feature compiled out of this runtime build?`);return e.create(t)}});function Ql(t,e,i,n){let r,s,a;t.type==="PathGeometry"?(s=JSON.parse(JSON.stringify(t)),a=[[],["extrusion"]]):(s={...t},a=[[]]);for(let c of a){let h=s;for(let d of c)h=h[d];for(r in h){let d=h[r];cI(d)&&!mk.includes(r)&&(h[r]=e.getVariable(d,[n.uuid,"geometry",...c,r]),cI(h[r])&&(h[r]=1))}}let o,l={parameters:s,type:s.type};if(s.type==="PathGeometry")l.path=s.path;else if(s.type==="VectorGeometry"){let c=Ni.createFromState(s.shape,s.width,s.height);l.shape=c}else if(s.type==="NonParametricGeometry"){if(s.data.groups&&s.data.groups?.forEach(c=>c.materialIndex=Math.max(c.materialIndex??0,0)),l.geometry=new tC().parse(s),l.geometry.groups.length===0){let c=l.geometry;c.addGroup(0,Math.max(c.getIndex()?.count??0,c.getAttribute("position").count),0)}}else{if(s.type==="SubdivGeometry"){let c=new Fi(s,i);return c.data=t,c}if(s.type==="TextGeometry"||s.type==="InputGeometry"){let c=sN(s.type);if(c)return c.create(s,e);Vn("text",`a ${s.type}`);let h=Ni.createFromState(Pg.defaultData(),100,100);return m1({...s,shape:h,type:"VectorGeometry"})}if(s.type==="UIGeometry")return Jb.create({parameters:{width:s.width,height:s.height,cornerRadius:s.cornerRadius,cornerType:s.cornerType}})}try{o=m1(l)}catch(c){console.error(c),console.error(`Error generating geometry with inputs: ${l}`);let h=Ni.createFromState(Pg.defaultData(),100,100);l.shape=h,l.type="VectorGeometry",o=m1(l)}return o}var mk,M4,OA,ex=F(()=>{Yt(),et(),fk(),ke(),tb(),yh(),Sp(),mk=["font"]}),x$=F(()=>{ex(),M4=class{constructor(){this.objects=new Map,this.unreachable=new Set}getCached(t){return this.objects.get(t)}get size(){return this.objects.size}get(t,e,i){let n=this.objects.get(t);return n===void 0?(n=this.createObject(t,e,i),this.objects.set(t,n)):n.isShared=!0,n}forceDelete(t){let e=this.objects.get(t);e&&(this.disposeObject(e),this.objects.delete(t))}adopt(t,e){this.objects.set(t,e)}mutateIfUnique(t,e){let i=this.objects.get(t);if(i&&i.isShared!==!0)return this.objects.delete(t),this.objects.set(e,i),i}startGc(){this.unreachable=new Set(this.objects.keys())}markAsReachable(t,e){e===this.objects.get(t)&&this.unreachable.delete(t)}endGc(){this.unreachable.forEach(t=>{this.disposeObject(this.objects.get(t)),this.objects.delete(t)}),this.unreachable.clear()}dispose(){this.objects.forEach(t=>{this.disposeObject(t)}),this.objects.clear()}},OA=class extends M4{constructor(t){super(),this.flatShading=t}disposeObject(t){t.dispose()}createObject(t,e,i){let n=Ql(t,e,this.flatShading,i);return n.computeBoundingSphere(),n}}});function eb(){return ix}function gk(){if(ix==="webgpu"){if(T4!==void 0)return T4;BA||(BA=!0,console.warn('[spe] Material backend is "webgpu" but no TSL material factory is registered \u2014 import spe/src/renderer/webgpu before creating materials. Falling back to WebGL materials.'))}if(LA===void 0)throw new Error('[spe] Classic (WebGL) materials are not available in this build \u2014 it was compiled WebGPU-only. Re-export the scene with renderer "Both" or "WebGL 2", or load the full runtime.');return LA}function vk(t,e){return gk().createRootMaterial(t,e)}function E4(t,e,i){return gk().createSharedMaterial(t,e,i)}function A4(t){return t.getLayersOfType===void 0&&Object.assign(t,{layers:[],getLayersOfType:()=>[],hasAO:!1,assetsLoaded:()=>!0}),t}function yk(){return w$}var ix,T4,LA,BA,UA,w$,zA,_k,bh=F(()=>{ix="webgl",BA=!1}),S$=F(()=>{_k={markNeedsUpdateRendererDirty:()=>{}}});function Pc(t,e){let i=0;if(!t.layers||t.layers.length===0)return!1;let n=t.layers?.find(r=>r.data.type==="light");if(n){let r=n.data,s=Number(e.getVariable(r.alphaOverride));if((typeof r.alphaOverride=="string"?s/100:r.alphaOverride)<1)return!0}for(let r of t.layers){if(r.data.type!=="displace"&&r.data.isMask)return!0;if(r.data.type!=="displace"&&"alpha"in r.data&&r.data.type!=="light"&&r.data.type!=="fresnel"&&r.data.type!=="cavity"&&r.data.type!=="dust"&&r.data.type!=="texture"&&r.data.type!=="matcap"&&r.data.type!=="rainbow"&&r.data.type!=="outline"&&r.data.type!=="pattern"){let s=r.data.visible?r.data.alpha:0;if(typeof s=="string"&&(s=Math.max(0,Math.min(1,Number(e.getVariable(s)??100)/100))),s===1&&r.data.type==="depth"||r.data.type==="gradient"){for(let a of r.data.colors)if(a[3]<1){s=a[3];break}}else if(s===1&&r.data.type==="noise"){let a=e.color(r.data.colorA).a,o=e.color(r.data.colorB).a,l=e.color(r.data.colorC).a,c=e.color(r.data.colorD).a,h=Math.min(a,Math.min(o,Math.min(l,c)));h<1&&(s=h)}i+=(1-i)*s}}return i<1}var ZC=F(()=>{});function pp(t){return typeof t=="string"||typeof t=="number"&&t!==0}var uh,qt,nx,bk,C4,P4,ys,nl=F(()=>{uh=(t,e,i)=>Math.max(0,Math.min(1,Number(e.getVariable(typeof t=="number"?100*t:t,i)??100)/100))??1,qt=(t,e,i)=>typeof t=="number"?t:e.getVariable(t,i),nx={noise:["noiseType"],texture:["projection","axis","projectionAxis","side"],video:["projection","axis","projectionAxis","side"],displace:["noiseType"],light:["roughnessMap","bumpMap","roughnessMapChannel","metalnessMap","metalnessMapChannel","normalMap","aoMap","aoMapChannel","emissiveMap"],depth:["smooth","isWorldSpace","gradientType","isVector"],pattern:["style","projection","axis"],reflection:["tracingMode","mirror"]},bk={depth:["colors"],gradient:["colors","steps"],toon:["colors","steps"]}}),Mp=F(()=>{et(),Xg(),C4=class extends $b(_i){},P4=t=>t.type==="Mesh",ys=class extends C4{constructor(t){super(),this.object=t,this.isClone=!0,this.matrixAutoUpdate=!1,this.hasNonUniformScale=t.hasNonUniformScale}raycast(t,e){}expand(){let t=0,e=this.object.entityChildren(t);for(;e;){let i=this.children[t];i?.object!==e&&(i&&this.remove(i),i=new ys(e),this.add(i),this.children.splice(t,0,this.children.pop()),i.matrixWorldNeedsUpdate=!0,i.matrixAutoUpdate=!1,i.matrix=e.matrix,i.hiddenMatrix=e.hiddenMatrix,i.pivotMatrix=e.pivotMatrix),i.expand(),t+=1,e=this.object.entityChildren(t)}for(;this.children.length>t;)this.remove(this.children[t]);this.pivotMatrix=this.object.pivotMatrix}get visible(){let t=this.object.cloner;return(t===void 0||this.parent!==t||!t.instancingActive&&!t.insideBoolean)&&(this.playModeVisible!==void 0?this.playModeVisible:this.object.visible||this.object.dataPatched.visible&&this.object.dataPatched.cloner?.hideBase===!0)}set visible(t){}get castShadow(){return this.object.castShadow}set castShadow(t){}get receiveShadow(){return this.object.receiveShadow}set receiveShadow(t){}get isMesh(){return P4(this.object)}get isLight(){return this.object.isLight}get layers(){return this.object.layers}set layers(t){}get isCamera(){return!1}get geometry(){if(this.object.geometry)return this.object.geometry}get material(){if(this.object.material)return this.object.material}get morphTargetInfluences(){if(this.object.morphTargetInfluences)return this.object.morphTargetInfluences}set morphTargetInfluences(t){}}});function D4(){return KC}var KC,QC,JC=F(()=>{KC=null,QC=null});function FA(t){return"variable_"+t}var jS,GS,HS,R4,WS,I4,O4,ib,t3=F(()=>{Yt(),EN(),CN(),NC(),ya(),kC(),jC(),x$(),bh(),TN(),S$(),ZC(),nl(),Wr(),Mp(),Ye(),et(),JC(),ke(),jS=new At,GS=new C,HS=new $t,R4=new C,WS=new Ei,I4=class extends SN{constructor(t){super(),this.shared=t}create(t){return new FC(t,this.shared)}},(ib=O4=class{constructor(t,e={},i=!0,n=!1){if(this.data=t,this.needsJitter=i,this.enableLocalStorageForPersistentVariables=n,this.geometryCache=new OA(!0),this.geometryCache2=new OA(!1),this.imageHolderCache=new I4(this),this.thisContext={scene:_k,shared:this},this.deletedImage=new qo(eA.emptyImage,this),this.deletedVideo=new qo(R_.defaultVideo,this),this.materials={},this.images={},this.uiBuffers={},this.videos={},this.colors={},this.audios={},this.particles={},this.fonts={},this.variables={},this.userAPIs={},this.userWebhooks={},this.mouseProperty=null,this.raycastProperty=null,this.requestRender=()=>{this._requestRender&&this._requestRender()},this.transientGeometryKeys=new WeakSet,e.images)for(let[r,s]of Object.entries(e.images))this.addImage(r,s);if(e.videos)for(let[r,s]of Object.entries(e.videos))this.addVideo(r,s);if(e.audios)for(let[r,s]of Object.entries(e.audios))this.addAudio(r,s);if(e.particles)for(let[r,s]of Object.entries(e.particles))this.addParticle(r,s);this.reset(t)}get deletedMaterial(){return this._deletedMaterial??(this._deletedMaterial=E4(ki.defaultTwoLayerData("phong"),this.thisContext,"")),this._deletedMaterial}setRequestRender(t){this._requestRender=t}getImageLoadPromises(){return Object.values(this.images).map(t=>t.loadPromise)}setEntityOpContext(t){this.entityOpContext=t}reset(t,e=!1,i=!1){this.data=t,this.resetLib(t.lib);for(let{id:n,data:r}of t.variables)this.addVariableHolder(n,r),e&&this.updateVariableHolder(n,r);for(let[n,r]of Object.entries(t.userAPIs??{}))this.addUserAPI(n,r);for(let[n,r]of Object.entries(t.userWebhooks??{}))this.addUserWebhook(n,r);if(!i){for(let[n,r]of Object.entries(t.images))this.addImage(n,r);for(let[n,r]of Object.entries(t.videos))this.addVideo(n,r)}for(let[n,r]of Object.entries(t.colors))this.addColor(n,r);for(let[n,r]of Object.entries(t.lib.materials))this.addMaterial(n,r.asset);for(let[n,r]of Object.entries(t.materials))this.addMaterial(n,r);for(let[n,r]of Object.entries(t.audios))this.addAudio(n,r);for(let[n,r]of Object.entries(t.particles))this.addParticle(n,r);for(let[n,r]of Object.entries(t.fonts))this.addFont(n,r)}addMaterial(t,e){if(e.layers===void 0&&(e={...e,layers:ki.defaultTwoLayerData("phong").layers}),this.materials[t]){let i=this.materials[t];i.reset(e,this.thisContext),i.dispose()}else{let i=E4(e,this.thisContext,t);this.materials[t]=i}}deleteMaterial(t){this.materials[t]&&(this.materials[t].nodeMaterialDispose(),delete this.materials[t])}getMaterial(t){return this.materials[t]}getMaterialOrDeletedPlaceholder(t){return this.materials[t]??this.deletedMaterial}material(t){return typeof t=="string"?this.getMaterialOrDeletedPlaceholder(t):t==null?(console.error("material is undefined or null"),this.deletedMaterial):(t.layers===void 0&&(t={...t,layers:ki.defaultTwoLayerData("phong").layers}),vk(t,this.thisContext))}getMaterials(){return this.materials}addImage(t,e){return this.images[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.images[t].updateSrc(e.data),!0):(this.images[t]=new qo(e,this),!1)}deleteImage(t){let e=this.images[t];e&&(e.dispose(),delete this.images[t])}getDefaultImage(){return this.images.image_0}getImage(t){return this.images[t]??this.deletedImage}image(t){return typeof t=="string"?this.getImage(t):this.imageHolderCache.load(t)}addUIBuffer(t,e){return this.uiBuffers[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.uiBuffers[t].updateSrc(e),!0):(this.uiBuffers[t]=new qo(e,this),!1)}uiBuffer(t){return this.uiBuffers[t]}addVideo(t,e){return this.videos[t]?(this.videos[t].updateSrc(e.data),!0):(this.videos[t]=new qo(e,this),!1)}deleteVideo(t){let e=this.videos[t];e&&(e.dispose(),delete this.videos[t])}getVideo(t){return this.videos[t]??this.deletedVideo}video(t){return typeof t=="string"?this.getVideo(t):this.imageHolderCache.load(t)}addColor(t,e){return this.colors[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),"a"in e?this.colors[t].setRGBA(e.r,e.g,e.b,e.a):this.colors[t].setRGBA(e.r,e.g,e.b,1),!0):(this.colors[t]=new Bg(e.r,e.g,e.b,"a"in e?e.a:1),!1)}updateColor(t,e){if(this.colors[t]){this.onColorOrImageUpdate&&this.onColorOrImageUpdate();let i=this.colors[t];return this.colors[t].r=e.r??i.r,this.colors[t].g=e.g??i.g,this.colors[t].b=e.b??i.b,this.colors[t].a=e.a??i.a,!0}return!1}deleteColor(t){this.colors[t]&&delete this.colors[t]}getColor(t){return this.colors[t]}getColorNames(){return Object.values(this.data.colors).map(t=>t.name)}getColorByName(t){for(let e in this.data.colors)if(this.data.colors[e].name===t)return{color:this.colors[e],id:e}}color(t){let e;if(typeof t!="string")return new mn(t.r,t.g,t.b,"a"in t?t.a:1);{let i=this.getColor(t);i?e=i:(console.warn("Tried to create color layer params with a color key that does not exist in the assets manager"),e=new mn(0,0,0,0))}return e}addAudio(t,e){this.audios[t]=e}getAudio(t){let e=this.audios[t];if(e instanceof Bu)return e;{let i=new Bu({src:e.data});return this.audios[t]=i,i}}addParticle(t,e){this.particles[t]=e}getParticle(t){return this.particles[t]}deleteParticle(t){this.particles[t]&&delete this.particles[t]}deleteAudio(t){let e=this.audios[t];e&&(e instanceof Bu&&e.dispose(),delete this.audios[t])}addFont(t,e){let i=VC;i!==null?(this.fonts[t]=new i(e),this.fonts[t].loadingPromise.then(()=>this.requestRender())):Vn("text","a font asset")}getFont(t){return this.fonts[t]}deleteFont(t){this.fonts[t]&&delete this.fonts[t]}dispose(){Object.keys(this.materials).forEach(t=>this.deleteMaterial(t)),this._requestRender=void 0,Object.values(this.audios).forEach(t=>{t instanceof Bu&&t.dispose()}),this.audios={},this.particles={},this.geometryCache.dispose(),this.geometryCache2.dispose()}addVariableHolder(t,e){if(this.variables[t]===void 0){let i=e.value;if(this.enableLocalStorageForPersistentVariables&&e.persistent){let n=localStorage.getItem(FA(t));i=n!==null?JSON.parse(n):e.value}return this.variables[t]={value:i,locations:[],persistent:e.persistent},"dynamicVariableType"in e&&(this.variables[t].dynamicVariablePlayState="Playing",this.variables[t].dynamicVariableToggleIsForward=void 0),!0}return this.variables[t].value=e.value,!1}resetDynamicVariablePlayState(){for(let t in this.variables)this.variables[t].dynamicVariablePlayState!==void 0&&(this.variables[t].dynamicVariablePlayState="Playing",this.variables[t].dynamicVariableToggleIsForward=void 0)}updateVariableHolder(t,e){this.updateVariable(t,e.value)}updateVariable(t,e){if(this.variables[t]===void 0)return!1;this.variables[t].value=e,this.enableLocalStorageForPersistentVariables&&this.variables[t].persistent&&localStorage.setItem(FA(t),JSON.stringify(e));let i=e;for(;typeof i=="string";)i=this.variables[i].value;let n=this.entityOpContext.scene,r=!1;for(let s=this.variables[t].locations.length-1;s>=0;s--){let a=this.variables[t].locations[s];if(a[0]==="material"){let o=a[1],l=i,c={scene:n,shared:this},h=a.slice(2);n.traverseMaterial(u=>{let p=u.root??u;p.uuid===o&&p.onVariableUpdate(h,l,c)});let d=this.materials[o];d&&d.onVariableUpdate(h,l,c)}else{let o=n.find(a[0]);if(o===void 0){this.variables[t].locations.splice(s,1);continue}if(r=!0,a[1]!=="geometry"&&a[1]!=="particles"){for(let l=1;l<a.length-1;l++)o=o[a[l]];a[1]==="rotation"?o[a[a.length-1]]=i*Ot.DEG2RAD:o[a[a.length-1]]=i}if(o=n.find(a[0]),o.type==="ParticleEmitter"&&o.updateVariableState(i,a),Be.is(o))if(a[1]==="position"||a[1]==="rotation"||a[1]==="scale")o.onVariableUpdate();else if(a[1]==="geometry"){let l=o;o.component&&(l=o.component);let c=l.dataPatched;l.chooseGeoemtryCache(this).forceDelete(c.geometry),l.createGeometryDelayed(this.entityOpContext),l.onVariableUpdate(!0),l.invalidateDownstreamBooleanData(),l.instances.forEach(h=>{let d=h.dataPatched;h.chooseGeoemtryCache(this).forceDelete(d.geometry),h.createGeometryDelayed(this.entityOpContext),h.onVariableUpdate(!0),h.invalidateDownstreamBooleanData()})}else a[1]==="morphTargetInfluences"&&o.updateMorphInfluences(a[2],i)}}return r&&n.markShadowsDirty(),this.requestRender(),!0}updateEntityGeometryParams(t,e){let i=t;if(i.component&&(i=i.component),typeof i.chooseGeoemtryCache!="function")return!1;let n=i.dataPatched,r=n?.geometry;if(!r||typeof r.type!="string"||r.type==="VectorGeometry"||r.type==="PathGeometry")return!1;let s=c=>c.toLowerCase().replace(/[\s_.-]+/g,""),a=new Map;for(let c of Object.keys(r))a.set(s(c),c);let o={};for(let[c,h]of Object.entries(e??{})){let d=a.get(s(c));if(d===void 0||d==="type"||d==="font"||d==="shape"||d==="path"||d==="data")continue;if(d==="text"){(typeof h=="string"||typeof h=="number")&&(o[d]={textValue:String(h)});continue}let u=r[d];typeof h=="number"&&isFinite(h)&&(typeof u=="number"||typeof u=="string")&&(o[d]=h)}if(Object.keys(o).length===0)return!1;let l={...r,...o};return i.dataPatched={...n,geometry:l},this.transientGeometryKeys.has(r)&&i.chooseGeoemtryCache(this).forceDelete(n.geometry),this.transientGeometryKeys.add(l),i.createGeometryDelayed(this.entityOpContext),i.onVariableUpdate(!0),i.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}resetEntityGeometryParams(t){let e=t;if(e.component&&(e=e.component),typeof e.chooseGeoemtryCache!="function")return!1;let i=e.dataPatched?.geometry;return!(!i||!this.transientGeometryKeys.has(i)||(e.dataPatched=e.data,e.chooseGeoemtryCache(this).forceDelete(i),e.createGeometryDelayed(this.entityOpContext),e.onVariableUpdate(!0),e.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),0))}updateEntityGeometryVertices(t,e){let i=t;if(i.component&&(i=i.component),typeof i.chooseGeoemtryCache!="function")return!1;let n=i.dataPatched,r=n?.geometry;if(!r||r.type!=="NonParametricGeometry")return!1;let s=e?.vertices;if(s===void 0||typeof s.length!="number"||s.length<9||s.length%3!=0||s.length/3>O4.MAX_TRANSIENT_VERTICES)return!1;let a,o,l,c=s instanceof Float32Array?s:Float32Array.from(s),h=c.length/3;if(e.normals!==void 0){if(e.normals.length!==c.length)return!1;a=e.normals instanceof Float32Array?e.normals:Float32Array.from(e.normals)}if(e.uvs!==void 0){if(e.uvs.length!==2*h)return!1;o=e.uvs instanceof Float32Array?e.uvs:Float32Array.from(e.uvs)}if(e.indices!==void 0){let x=h>65535?Uint32Array.from(e.indices):Uint16Array.from(e.indices);if(x.length===0||x.length%3!=0)return!1;for(let w=0;w<x.length;w++)if(x[w]>=h)return!1;l={array:x,itemSize:1,type:x.constructor.name,normalized:!1}}else{let x=r.data,w=x?.index;if(w?.array?.length){if(h<(x?.attributes?.position?.array?.length??0)/3){let S=w.array;for(let A=0;A<S.length;A++)if(S[A]>=h)return!1}l=w}}let d=1/0,u=1/0,p=1/0,f=-1/0,g=-1/0,m=-1/0;for(let x=0;x<c.length;x+=3){let w=c[x],S=c[x+1],A=c[x+2];w<d&&(d=w),w>f&&(f=w),S<u&&(u=S),S>g&&(g=S),A<p&&(p=A),A>m&&(m=A)}let y=(x,w)=>({array:x,itemSize:w,type:"Float32Array",normalized:!1}),v={position:y(c,3)};a&&(v.normal=y(a,3)),o&&(v.uv=y(o,2));let _={...r,width:f-d,height:g-u,depth:m-p,data:{attributes:v,...l?{index:l}:{}}},b=this.transientGeometryKeys.has(r);return i.dataPatched={...n,geometry:_},this.transientGeometryKeys.add(_),i.applyTransientGeometryData(this.entityOpContext,b),i.onVariableUpdate(!0),i.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}setEntityInstanceTransforms(t,e){let i=t;i.component&&(i=i.component);let n=i.cloner;if(n===void 0)return-1;let r=n.children,s=Math.PI/180,a=!1;if(e===null)for(let o of r)o.transformOverride!==void 0&&(o.transformOverride=void 0,a=!0);else{if(!Array.isArray(e))return r.length;{let o=Math.min(e.length,r.length);for(let l=0;l<o;l++){let c=e[l],h=r[l];if(c==null){h.transformOverride!==void 0&&(h.transformOverride=void 0,a=!0);continue}let d=h.transformOverride??{position:[h.position.x,h.position.y,h.position.z],rotation:[h.rotation.x,h.rotation.y,h.rotation.z],scale:[h.scale.x,h.scale.y,h.scale.z]};c.position&&(typeof c.position.x=="number"&&(d.position[0]=c.position.x),typeof c.position.y=="number"&&(d.position[1]=c.position.y),typeof c.position.z=="number"&&(d.position[2]=c.position.z)),c.rotation&&(typeof c.rotation.x=="number"&&(d.rotation[0]=c.rotation.x*s),typeof c.rotation.y=="number"&&(d.rotation[1]=c.rotation.y*s),typeof c.rotation.z=="number"&&(d.rotation[2]=c.rotation.z*s)),c.scale&&(typeof c.scale.x=="number"&&(d.scale[0]=c.scale.x),typeof c.scale.y=="number"&&(d.scale[1]=c.scale.y),typeof c.scale.z=="number"&&(d.scale[2]=c.scale.z)),h.transformOverride=d,h.position.fromArray(d.position),h.rotation.fromArray(d.rotation),h.scale.fromArray(d.scale),h.updateMatrix(),h.hasNonUniformScale&&(h.updateMatrixWorld(),h.updateMatrixWorldRigid())}}}return a?n.update(this.entityOpContext):n.syncInstanceMatrices(),n.invalidateTransform(i),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),r.length}spawnRuntimeClone(t,e={}){if(typeof t.entityChildren!="function")return;let i=t.parent;if(i===null)return;let n=new ys(t);n.playModeVisible=e.visible!==!1,n.expand(),typeof e.name=="string"&&(n.name=e.name);let r=Math.PI/180;return n.position.copy(t.position),n.rotation.copy(t.rotation),n.scale.copy(t.scale),n.hiddenMatrix.copy(t.hiddenMatrix),e.position&&(typeof e.position.x=="number"&&(n.position.x=e.position.x),typeof e.position.y=="number"&&(n.position.y=e.position.y),typeof e.position.z=="number"&&(n.position.z=e.position.z)),e.rotation&&(typeof e.rotation.x=="number"&&(n.rotation.x=e.rotation.x*r),typeof e.rotation.y=="number"&&(n.rotation.y=e.rotation.y*r),typeof e.rotation.z=="number"&&(n.rotation.z=e.rotation.z*r)),e.scale&&(typeof e.scale.x=="number"&&(n.scale.x=e.scale.x),typeof e.scale.y=="number"&&(n.scale.y=e.scale.y),typeof e.scale.z=="number"&&(n.scale.z=e.scale.z)),n.updateMatrix(),i.add(n),n.updateWorldMatrix(!0,!0),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),n}destroyRuntimeClone(t){t.removeFromParent(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender()}updateEntityMaterialParams(t,e){let i=t.material;if(!i)return!1;let n=[];for(let c of Array.isArray(i)?i:[i]){let h=c.root??c;h&&Array.isArray(h.layers)&&h.data&&!n.includes(h)&&n.push(h)}if(n.length===0)return!1;let r={scene:this.entityOpContext.scene,shared:this},s=c=>c.toLowerCase().replace(/[\s_.-]+/g,""),a=c=>{if(typeof c=="string"){let h=new mn(1,1,1,1);try{h.set(c)}catch{return null}return{r:h.r,g:h.g,b:h.b,a:void 0}}if(c&&typeof c=="object"&&"r"in c){let h=c;if([h.r,h.g,h.b].some(u=>typeof u!="number"||!isFinite(u)))return null;let d=Math.max(h.r,h.g,h.b)>1?1/255:1;return{r:h.r*d,g:h.g*d,b:h.b*d,a:typeof h.a=="number"?Math.max(0,Math.min(h.a,1)):void 0}}return null},o=(c,h,d)=>{if(!c.hasValue(h))return!1;let u=c.getValue(h);if(!u||typeof u!="object"||!u.isColor)return!1;let p=d.a??(typeof u.a=="number"?u.a:1);return u instanceof Bg?c.setValue(h,new mn(d.r,d.g,d.b,p)):typeof u.setRGBA=="function"?u.setRGBA(d.r,d.g,d.b,p):u.setRGB(d.r,d.g,d.b),!0},l=!1;for(let c of n){let h=c.data.layers??[],d=u=>c.layers.find(p=>p.uuid===u);if(e.color!==void 0){let u=a(e.color),p=h.find(g=>g.data.type==="color"),f=p&&d(p.id);if(u&&f&&o(f,"color",u)&&(l=!0,u.a!==void 0)){let g=u.a<1||Pc(c.data,this);c.setTransparent?c.setTransparent(g,r.scene):c.transparent=g}}typeof e.alpha=="number"&&isFinite(e.alpha)&&(c.onVariableUpdate?.(["alphaOverride"],Math.max(0,Math.min(e.alpha,100)),r),l=!0);for(let u of e.layers??[]){if(!u||typeof u!="object")continue;let p=typeof u.id=="string"?h.find(y=>y.id===u.id):typeof u.index=="number"?h[u.index]:typeof u.type=="string"?h.find(y=>y.data.type===u.type):void 0,f=p&&d(p.id);if(!p||!f)continue;let g=nx[p.data.type]??[],m=Object.keys(p.data);for(let[y,v]of Object.entries(u)){if(y==="id"||y==="index"||y==="type")continue;let _=m.find(x=>x===y)??m.find(x=>s(x)===s(y))??y;if(g.includes(_))continue;let b=a(v);if(b&&o(f,_,b))l=!0;else if(typeof v=="number"&&isFinite(v))c.onVariableUpdate?.(["layer",p.id,_],v,r),l=!0;else if(Array.isArray(v)&&v.length<=3&&v.every(x=>typeof x=="number"&&isFinite(x))){let x=["x","y","z"];v.forEach((w,S)=>{c.onVariableUpdate?.(["layer",p.id,_,x[S]],w,r)}),l=!0}}}}return l&&this.requestRender(),l}deleteVariable(t){this.variables[t]&&delete this.variables[t]}getVariable(t,e){if(Array.isArray(t)){if(t[0]==="mouse")return this.mouseProperty?.[t[1]]??0;if(t[0]==="raycast")return this.raycastProperty?.[t[1]]??0;let i=this.entityOpContext.scene.find(t[0]);if(t[1]==="width"||t[1]==="height"||t[1]==="depth")return i.geometry.userData.parameters[t[1]];if((t[1]==="position"||t[1]==="rotation")&&t.length>2&&i?.getPhysicsLocalMatrix?.(jS))return jS.decompose(GS,HS,R4),t[1]==="position"?GS[t[2]]:(WS.setFromQuaternion(HS,i.rotation.order),WS[t[2]]*Ot.RAD2DEG);for(let n=1;n<t.length;n++)i=i[t[n]];return t[1]==="rotation"&&(i*=Ot.RAD2DEG),i}for(let i in this.variables){if(e===void 0)break;let n=this.variables[i],r=n.locations?.findIndex(s=>kn.equal(s,e));r!==void 0&&r!==-1&&n.locations.splice(r,1)}if(typeof t=="string"){let i=t,n=t;do{if(n=i,this.variables[i]===void 0)break;let r=this.variables[i].value;e&&this.variables[n]!==void 0&&this.variables[n].locations.push(e),i=r}while(typeof i=="string");return i}return t}getVariables(){return this.variables}getVariablesNames(){return this.data.variables.map(t=>t.data.name)}getVariableByName(t){for(let e of this.data.variables)if(e.data.name===t)return{variable:e.data,id:e.id}}getDynamicVariablePlayState(t){return this.variables[t]?.dynamicVariablePlayState}setDynamicVariablePlayState(t,e){this.variables[t]!==void 0&&(this.variables[t].dynamicVariablePlayState=e)}getDynamicVariableToggleIsForward(t){return this.variables[t]?.dynamicVariableToggleIsForward}setDynamicVariableToggleIsForward(t,e){this.variables[t]!==void 0&&(this.variables[t].dynamicVariableToggleIsForward=e)}resetLib(t){for(let[e,i]of Object.entries(t.images))this.addImage(e,i.asset);for(let[e,i]of Object.entries(t.audios))this.addAudio(e,i.asset);for(let[e,i]of Object.entries(t.particles))this.addParticle(e,i.asset);for(let[e,i]of Object.entries(t.colors))this.addColor(e,i.asset);for(let[e,i]of Object.entries(t.fonts))this.addFont(e,i.asset);for(let[e,i]of Object.entries(t.videos))this.addVideo(e,i.asset);for(let[e,i]of Object.entries(t.variables))this.addVariableHolder(e,i.asset)}updateLibByOp(t,e){t.path[0]==="images"?t.path.length===1&&t.type===1?this.addImage(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteImage(t.id):t.path[0]==="videos"?t.path.length===1&&t.type===1?this.addVideo(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteVideo(t.id):t.path[0]==="audios"?t.path.length===1&&t.type===1?this.addAudio(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteAudio(t.id):t.path[0]==="particles"?t.path.length===1&&t.type===1?this.addParticle(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteParticle(t.id):t.path[0]==="colors"?t.path.length===1&&t.type===1?this.addColor(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteColor(t.id):t.path[0]==="materials"?t.path.length===1&&t.type===1?this.addMaterial(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteMaterial(t.id):t.path[0]==="fonts"?t.path.length===1&&t.type===1?this.addFont(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteFont(t.id):t.path[0]==="variables"?t.path.length===1&&t.type===1?this.addVariableHolder(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteVariable(t.id):t.path[0]==="components"&&e.updateByLibOp(t,this)}updateByOp(t,e,i){if(this.data=e,t.path[0]==="images")t.path.length===2&&t.type===0?t.props.data&&this.getImage(t.path[1]).updateSrc(t.props.data):t.path.length===1&&t.type===1?this.addImage(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteImage(t.id);else if(t.path[0]==="videos")t.path.length===2&&t.type===0?t.props.data&&this.getVideo(t.path[1]).updateSrc(t.props.data):t.path.length===1&&t.type===1?this.addVideo(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteVideo(t.id);else if(t.path[0]==="audios")t.path.length===2&&t.type===0?t.props.data&&this.addAudio(t.path[1],e.audios[t.path[1]]):t.path.length===1&&t.type===1?this.addAudio(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteAudio(t.id);else if(t.path[0]==="particles")t.path.length===2&&t.type===0?t.props.data&&this.addParticle(t.path[1],e.particles[t.path[1]]):t.path.length===1&&t.type===1?this.addParticle(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteParticle(t.id);else if(t.path[0]==="colors")t.path.length===2&&t.type===0?this.updateColor(t.path[1],t.props):t.path.length===1&&t.type===1?this.addColor(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteColor(t.id);else if(t.path[0]==="materials")t.path.length===1&&t.type===1?this.addMaterial(t.id,t.data):t.path.length===1&&t.type===2?this.deleteMaterial(t.id):t.path.length>1&&this.getMaterial(t.path[1]).updateByOp(Jn.drop(t,2),e.materials[t.path[1]],{shared:this,scene:i});else if(t.path[0]==="fonts")t.path.length===2&&t.type===0?this.updateFont(t.path[1],t,i):t.path.length===1&&t.type===1?this.addFont(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteFont(t.id);else if(t.path[0]==="variables")t.path.length===2&&t.type===0?"value"in t.props?this.updateVariable(t.path[1],t.props.value):"persistent"in t.props&&(this.variables[t.path[1]].persistent=t.props.persistent):t.path.length===1&&t.type===4?this.addVariableHolder(t.id,t.data):t.path.length===1&&t.type===5&&this.deleteVariable(t.id);else if(t.path[0]==="userAPIs"){if(t.path.length===1&&t.type===1)this.addUserAPI(t.id,t.data);else if(t.path.length===1&&t.type===2)this.deleteUserAPI(t.id);else if(typeof t.path[1]=="string"){let n=e.userAPIs[t.path[1]];if(n){let r=t.type===0&&t.props.debounce===void 0,s=this.getUserAPI(t.path[1]);s!==void 0&&s===this.openAIRealtime?s.update(n):s?.update(n,this,r)}}}else if(t.path[0]==="userWebhooks"){if(t.path.length===1&&t.type===1)this.addUserWebhook(t.id,t.data);else if(t.path.length===1&&t.type===2)this.deleteUserWebhook(t.id);else if(typeof t.path[1]=="string"){let n=e.userWebhooks[t.path[1]];n&&this.getUserWebhook(t.path[1])?.update(n)}}else t.path[0]==="lib"&&this.updateLibByOp(Jn.drop(t,1),i)}updateFont(t,e,i){if(e.props.url){let n=this.getFont(t),r={...this.data.fonts[t],url:e.props.url};n.update(r),n.loadingPromise.then(()=>this.requestRender()),i.updateFont(t,this)}}addUserAPI(t,e){if(this.userAPIs[t])return this.userAPIs[t].update(e,this),!0;if(this.openAIRealtime?.id===t)return this.openAIRealtime.update(e),!0;if(e.integration?.type==="VoiceAssistant"){let i=QC;return i===null?(Vn("ai-assistant","a voice-assistant integration"),!1):(this.openAIRealtime=i(e,t,this),!1)}{let i=D4();return i===null?(Vn("api-services","a user API integration"),!1):(this.userAPIs[t]=i.createUserAPI(t,e,this),!1)}}getUserAPI(t){return this.openAIRealtime?.id===t?this.openAIRealtime:this.userAPIs[t]}getUserAPIs(){return this.userAPIs}deleteUserAPI(t){let e=this.userAPIs[t];e&&(e.dispose(),delete this.userAPIs[t])}addUserWebhook(t,e){if(this.userWebhooks[t])return this.userWebhooks[t].update(e),!0;{let i=D4();return i===null?(Vn("api-services","a user webhook"),!1):(this.userWebhooks[t]=i.createUserWebhook(t,e),!1)}}getUserWebhook(t){return this.userWebhooks[t]}getUserWebhooks(){return this.userWebhooks}deleteUserWebhook(t){let e=this.userWebhooks[t];e&&(e.dispose(),delete this.userWebhooks[t])}get scene(){return this.entityOpContext.scene}}).MAX_TRANSIENT_VERTICES=6e4,new ib(Fs.emptyData())});function xk(t){return $_(t)||t?.isTSLNodeMaterial===!0}var Hr,qS,XS,$S,L4,YS,Ai,wk=F(()=>{zC()}),Qc=F(()=>{Yt(),Yn(),bh(),wk(),Ye(),ar(),Hr=class extends Xi{setMaterialOverride(t,e){this.materialOverride=A4(t),this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.materialOverride,this.layers.set(0),this.syncShapeBlendNodeLayer(),e.scene.markNeedsUpdateRendererDirty())}updateByPatchedOp(t,e,i){if(super.updateByPatchedOp(t,e,i),ri(t.path,["geometry"])&&this.syncShadowCatcher(i),function(n,r){let s=[];if(r.length!==n.length)return null;{let a=0;for(;a<n.length;){if(r[a]==="*")s.push(n[a]);else if(n[a]!==r[a])return null;a+=1}}return s}(t.path,["materials"])!==null&&t.type===0&&Array.isArray(this.material))for(let[n,r]of Object.entries(t.props)){let s=this.material[Number(n)],a=i.shared.material(r);a!==s&&Hr.disposeOneMaterial(s),this.material[Number(n)]=a}else if(ri(t.path,["material"])){let n=this.material;!Array.isArray(n)&&typeof n?.updateByOp=="function"&&"material"in e&&typeof e.material!="string"&&n.updateByOp(Jn.drop(t,1),e.material,i)}else if(ri(t.path,["materials","*"])&&Array.isArray(this.material)){let n=t.path[1];if("materials"in e&&n<this.material.length){let r=e.materials[n];typeof r!="string"&&this.material[n].updateByOp(Jn.drop(t,2),r,i)}}}get needsAO(){return this.material!==void 0&&(Array.isArray(this.material)?this.material[0]:this.material).hasAO}syncShapeBlendNodeLayer(){this.dataPatched.type==="Mesh"&&this.dataPatched.geometry.shapeBlendNode?this.layers.set(9):512&this.layers.mask&&this.layers.set(0)}updateState(t,e){super.updateState(t,e),t.castShadow!==void 0&&(this.castShadow=t.castShadow),t.receiveShadow!==void 0&&(this.receiveShadow=t.receiveShadow);let i,n=this.dataPatched;this.syncShapeBlendNodeLayer(),this.dataPatched.type==="Mesh"&&this.dataPatched.geometry.type==="ShapeBlendGeometry"&&(i={resolutionLevel:Math.min(8,this.dataPatched.geometry.resolutionLevel),useChildrenColors:this.dataPatched.geometry.useChildrenColors});let r=this.materialOverride!==void 0;!r&&t.geometry?.type!=="NonParametricGeometry"&&"material"in t&&t.material!==void 0&&(this.disposeMaterial(),this.material=e.shared.material(t.material).getFlavor(n.flatShading,n.side,n.wireframe,i),e.scene.markNeedsUpdateRendererDirty()),!r&&(t.geometry?.type==="NonParametricGeometry"||"materials"in t)&&("materials"in t&&t.materials!==void 0?(this.disposeMaterial(),this.material=t.materials.map(a=>e.shared.material(a).getFlavor(n.flatShading,n.side,n.wireframe)),e.scene.markNeedsUpdateRendererDirty()):"material"in t&&t.material!==void 0&&(this.disposeMaterial(),this.material=[e.shared.material(t.material).getFlavor(n.flatShading,n.side,n.wireframe)],e.scene.markNeedsUpdateRendererDirty()));let s=this.data;if(!r&&s.geometry?.type!=="NonParametricGeometry"&&"materials"in s&&s.materials!==void 0&&(this.disposeMaterial(),this.material=e.shared.material(s.materials[0]).getFlavor(n.flatShading,n.side,n.wireframe)),!r&&(t.flatShading!==void 0||t.wireframe!==void 0||t.side!==void 0))if(Array.isArray(this.material))for(let a=0;a<this.material.length;a++)this.material[a]=this.material[a].getFlavor(n.flatShading,n.side,n.wireframe);else this.material=this.material.getFlavor(n.flatShading,n.side,n.wireframe,i);this.syncShadowCatcher(e)}shadowCatcherActive(){let t=this.dataPatched,e=t.geometry?.type;return t.shadowCatcher===!0&&(e==="RectangleGeometry"||e==="PlaneGeometry")}syncShadowCatcher(t){let e=this.dataPatched;if(this.shadowCatcherActive()){if(this.shadowCatcherMaterial===void 0){let i=UA===void 0?null:A4(UA());if(i===null)return;this.shadowCatcherMaterial=i}this.shadowCatcherMaterial.side=e.side,this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.shadowCatcherMaterial,t.scene.markNeedsUpdateRendererDirty()),this.castShadow=!1,this.receiveShadow=!0,this.layers.set(0)}else this.shadowCatcherMaterial!==void 0&&this.material===this.shadowCatcherMaterial&&(this.materialOverride!==void 0?(this.material=this.materialOverride,t.scene.markNeedsUpdateRendererDirty()):"material"in e&&e.material!==void 0&&(this.material=t.shared.material(e.material).getFlavor(e.flatShading,e.side,e.wireframe),t.scene.markNeedsUpdateRendererDirty(),this.needsAO&&this.layers.enable(5)),this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow)}static disposeOneMaterial(t){var e;xk(t)&&!function(i){return i?.isClassicSharedMaterial===!0}(e=t)&&e?.isTSLSharedMaterial!==!0&&t.nodeMaterialDispose()}disposeMaterial(){this.material&&lF(this.material).forEach(t=>{Hr.disposeOneMaterial(t)})}dispose(){this.disposeMaterial(),this.shadowCatcherMaterial?.dispose(),super.dispose()}}}),qr=F(()=>{Yt(),Ye(),t3(),Qc(),et(),ex(),Sp(),uk(),qS=new C,XS=new ve,$S=new ve,L4=new C,YS=new At,Ai=class extends Hr{constructor(t,e,i){super(t,e),this.data=e,this.isSkinnedMesh=!1,this.localGeometry=void 0,e.bindMode&&e.bindMatrix&&(this.bindMode=e.bindMode,this.bindMatrix=new At().fromArray(e.bindMatrix),this.bindMatrixInverse=new At)}chooseGeoemtryCache(t){return t.geometryCache}supportsInPlaceGeometryUpdate(t){return t.isTextGeometry!==!0}markGeometryAsReachable(t){this.geometryCreateDeleyed instanceof Gt&&this.chooseGeoemtryCache(t).markAsReachable(this.dataPatched.geometry,this.geometryCreateDeleyed)}get builtSharedGeometry(){if(this.localGeometry===void 0)return this.geometryCreateDeleyed instanceof Gt?this.geometryCreateDeleyed:void 0}get geometry(){if(this.localGeometry!==void 0)return this.localGeometry;if(this.geometryCreateDeleyed instanceof ib){let t=this.geometryCreateDeleyed,e=this.chooseGeoemtryCache(t),i=this.dataPatched.geometry;this.geometryCreateDeleyed=e.get(i,t,this),this._geometryCacheKey=i}return this.geometryCreateDeleyed}set geometry(t){this.localGeometry=t}get is2DAndNoDepth(){let t=this.dataPatched.geometry;return B_.is2DParametricMesh(t.type)&&t.depth===0}get is2DType(){return B_.is2DParametricMesh(this.geometry.userData.type)}get isNonParametric(){return this.geometry.userData.type==="NonParametricGeometry"}updateByPatchedOp(t,e,i){super.updateByPatchedOp(t,e,i),ri(t.path,["geometry"])&&this.updateByPatchedOpGeometry(Jn.drop(t,1),e.geometry,i)}removeInteractionGeometry(t){this.localGeometry?.dispose(),this.localGeometry=void 0}get appliedGeometrySize(){let t=this.localGeometry?.userData;if(t!==void 0&&t.sxPrev!==void 0)return[t.sxPrev,t.syPrev,t.szPrev]}updateGeometryInteractions(t,e){this.invalidateDownstreamBooleanData();let i=this.data.geometry.type;if(i==="NonParametricGeometry"||i==="SubdivGeometry"){let n,r,s,a=t;if(this.localGeometry===void 0){let d={...this.data.geometry,...a};this.localGeometry=Ql(d,e,this.data.flatShading,this)}a.scaleBaked?[n,r,s]=a.scaleBaked:{width:n,height:r,depth:s}=a;let o=this.localGeometry.userData,l=typeof n=="number"?n:1,c=typeof r=="number"?r:1,h=typeof s=="number"?s:1;o.sxPrev!==void 0&&RA(this.localGeometry.attributes,l/o.sxPrev,c/o.syPrev,h/o.szPrev),o.sxPrev=l,o.syPrev=c,o.szPrev=h}else{let n=Ql({...this.data.geometry,...t},e,this.data.flatShading,this);this.localGeometry!==void 0&&this.supportsInPlaceGeometryUpdate(this.localGeometry)&&FS(this.localGeometry,n)?n.dispose():(this.localGeometry?.dispose(),this.localGeometry=n)}}refreshAttachedClonersInteractions(t){for(let e of this.attachedSurfaceCloners)e.update(t)}refreshAttachedCloners(t){for(let e of this.attachedSurfaceCloners)t.scene.addPendingUpdateCloner(e.object)}refreshAttachedPaths(t){for(let e of this.attachedPaths)t.scene.addPendingCommand(()=>e.updateShape())}createGeometryDelayed(t){this.geometryCreateDeleyed=t.shared,this.refreshAttachedCloners(t),this.refreshAttachedPaths(t)}updateByPatchedOpGeometry(t,e,i){let n=!1;if(t.type===0&&t.path.length===0&&Object.keys(t.props).includes("scaleBaked")&&this.geometryCreateDeleyed instanceof Fi&&this.chooseGeoemtryCache(i.shared).mutateIfUnique(this.geometryCreateDeleyed.data,e)===this.geometryCreateDeleyed&&(n=!0,this.geometryCreateDeleyed.mutateDirectlyScaleBaked(e,t.props.scaleBaked),this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)),!n&&t.type===0&&t.path.length===0&&pk(t.props)&&this.geometryCreateDeleyed instanceof Fi&&this.chooseGeoemtryCache(i.shared).mutateIfUnique(this.geometryCreateDeleyed.data,e)===this.geometryCreateDeleyed&&(n=!0,this.geometryCreateDeleyed.mutateDirectlySubdivisions(e),this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)),!n&&t.type===0&&t.path.length===0&&this.geometryCreateDeleyed instanceof Gt&&!(this.geometryCreateDeleyed instanceof Fi)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let r=i.shared,s=this.chooseGeoemtryCache(r),a=this.geometryCreateDeleyed;if(s.getCached(this._geometryCacheKey)===a&&a.isShared!==!0){let o=this.dataPatched.geometry,l=Ql(o,r,this.data.flatShading,this);FS(a,l)?(l.dispose(),a.computeBoundingSphere(),s.mutateIfUnique(this._geometryCacheKey,o)):(l.computeBoundingSphere(),s.forceDelete(this._geometryCacheKey),s.adopt(o,l),this.geometryCreateDeleyed=l),this._geometryCacheKey=o,n=!0,this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)}}n||(i.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(i)),this.syncShapeBlendNodeLayer(),this.resetBBoxNeedsUpdate(),this.invalidateDownstreamBooleanData()}updateGeometryOnStateUpdate(t,e){this.createGeometryDelayed(e)}applyTransientGeometryData(t,e){let i=t.shared,n=this.dataPatched.geometry;if(this.geometryCreateDeleyed instanceof Gt&&!(this.geometryCreateDeleyed instanceof Fi)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let r=this.chooseGeoemtryCache(i),s=this.geometryCreateDeleyed;if(r.getCached(this._geometryCacheKey)===s&&s.isShared!==!0){let a=Ql(n,i,this.data.flatShading,this);return FS(s,a)?(a.dispose(),s.computeBoundingSphere(),r.mutateIfUnique(this._geometryCacheKey,n)):(a.computeBoundingSphere(),r.forceDelete(this._geometryCacheKey),r.adopt(n,a),this.geometryCreateDeleyed=a),this._geometryCacheKey=n,this.refreshAttachedCloners(t),void this.refreshAttachedPaths(t)}}e&&this._geometryCacheKey!==void 0&&this.chooseGeoemtryCache(i).forceDelete(this._geometryCacheKey),t.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(t)}updateState(t,e){t.geometry!==void 0&&this.updateGeometryOnStateUpdate(t.geometry,e);let i=t.morphTargetInfluences;if(i){this.updateMorphTargets(),this.geometry.morphTargetsRelative=!0;for(let{data:{name:n,value:r}}of i)this.updateMorphInfluences(n,e.shared.getVariable(r,[this.uuid,"morphTargetInfluences",n]))}super.updateState(t,e)}updateMorphInfluences(t,e){if(this.morphTargetDictionary===void 0)return;let i=this.morphTargetDictionary[t];i!==void 0&&(this.morphTargetInfluences[i]=e)}updateGeometryGroupsIfNeeded(){Array.isArray(this.material)&&this.geometry.groups.length===0&&this.geometry.addGroup(0,Math.max(this.geometry.getIndex()?.count??0,this.geometry.getAttribute("position").count),0)}updateEntityBoxSize(t,e){let i=this.geometry.userData.parameters;this.is2DType?t.set(0,0,.5*i.depth):this.isNonParametric?(t.setScalar(0),this.geometry.boundingSphere&&t.copy(this.geometry.boundingSphere.center),e.set(i.width,i.height,i.depth??0).multiplyScalar(.5)):i.centerOffset?t.fromArray(i.centerOffset):t.setScalar(0),e.set(i.width,i.height,i.depth??0).multiplyScalar(.5)}updateMatrixWorld(t){super.updateMatrixWorld(t),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"&&this.bindMatrixInverse.copy(this.bindMatrix).invert()}bind(t,e){this.skeleton=t,this.isSkinnedMesh=!0,e===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(t){let e=new ve,i=this.geometry.attributes.skinWeight;for(let n=0,r=i.count;n<r;n++){e.fromBufferAttribute(i,n);let s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),i.setXYZW(n,e.x,e.y,e.z,e.w)}}boneTransform(t,e){let i=this.skeleton;if(i===void 0)return;let n=this.geometry;XS.fromBufferAttribute(n.attributes.skinIndex,t),$S.fromBufferAttribute(n.attributes.skinWeight,t),qS.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let r=0;r<4;r++){let s=$S.getComponent(r);if(s!==0){let a=XS.getComponent(r);YS.multiplyMatrices(i.bones[a].matrixWorld,i.boneInverses[a]),e.addScaledVector(L4.copy(qS).applyMatrix4(YS),s)}}return e.applyMatrix4(this.bindMatrixInverse)}}});function Ku(t){if(Array.isArray(t.material)){for(let e of t.material)if(e.getLayersOfType("outline").length===0)return}else if(!$_(t.material)||t.material.getLayersOfType("outline").length===0)return;t instanceof Ai&&t.is2DAndNoDepth?function(e){if(e.geometry.attributes.extrudeNormals||!e.geometry.attributes.position)return;let i=e.geometry.attributes.position.array,n=new Float32Array(i.length),r=new C;for(let s=0;s<i.length;s+=3)r.set(i[s],i[s+1],i[s+2]).normalize(),n[s]=r.x,n[s+1]=r.y,n[s+2]=r.z;e.geometry.setAttribute("extrudeNormal",new Nt(n,3))}(t):function(e){if(e.geometry.attributes.extrudeNormal||!e.geometry.attributes.position||!e.geometry.attributes.normal)return;let i=new Map,n=e.geometry.attributes,r=n.position.array,s=n.normal.array,a=new Float32Array(r.length);for(let o=0;o<r.length;o+=3){let l=`${r[o]}_${r[o+1]}_${r[o+2]}`,c=new C(s[o],s[o+1],s[o+2]);i.has(l)?i.get(l)?.normals.push(c):i.set(l,{normals:[c],result:new C})}i.forEach((o,l)=>{for(let c of o.normals)o.result.add(c);o.result.divideScalar(o.normals.length)});for(let o=0;o<r.length;o+=3){let l=`${r[o]}_${r[o+1]}_${r[o+2]}`,c=i.get(l)?.result;c&&(a[o]=c.x,a[o+1]=c.y,a[o+2]=c.z)}e.geometry.setAttribute("extrudeNormal",new Nt(a,3))}(t)}function ZS(t){return Math.min(2047,Math.max(1,Math.round(2048*t)))/2048}function Qu(t){if(!t.geometry.attributes.position)return;let e=t.geometry.attributes,i=e.position.array,n=e.randomColor;if(n!==void 0&&3*n.count===i.length)return;let r=new Float32Array(i.length),s=parseInt(t.uuid.replace(/\D/g,"")),a=[ZS(Ot.seededRandom(s)),ZS(Ot.seededRandom(s+1e4)),ZS(Ot.seededRandom(s+2e4))];for(let o=0;o<i.length;o++)r[o]=a[o%3];t.geometry.setAttribute("randomColor",new Ht(r,3))}var rx=F(()=>{et(),zC(),qr()});function B4(t){let e=!1;return t.scene.objects.traverse((i,n)=>{n.geometry?.type==="BooleanGeometry"&&(e=!0)}),e}function M$(t,e){let i=t.cloner;return i!==void 0&&i.parent===e?i:void 0}function U4(t,e,i,n){let r=16*(e.children.length+1);Lm.length<r&&(Lm=new Float32Array(r));let s=0,a=l=>{l.toArray(Lm,16*s),s++},o=e.parameters.hideBase!==!0;o&&a(n),NA.multiplyMatrices(t.hiddenMatrix,t.matrix);for(let l of e.children)!Mc(l)||l.playModeVisible===!1||(kA.multiplyMatrices(l.hiddenMatrix,l.matrix).multiply(l.pivotMatrix),g1.multiplyMatrices(NA,kA),(!o||!g1.equals(n))&&a(g1));try{return s===0?0:function(l,c){return BC(X_().instanced_union(LC(l),c))}(i,Lm.subarray(0,16*s))}finally{vN(i)}}var Ao,z4,NA,kA,g1,Lm,oh,nb,sx,pa,to,rb,$g=F(()=>{Yn(),et(),Kb(),rx(),Qc(),Li(),Ao=new At,z4=new At,NA=new At,kA=new At,g1=new At,Lm=new Float32Array(0),oh=class extends Hr{constructor(t,e,i){super(t,e),this.data=e,this.meshSetAddresses=[],this.needsTransformForDownstream=!1,this.geometry=new Gt,this.onAfterRender=(n,r,s,a,o,l)=>{super.onAfterRender(n,r,s,a,o,l),this.recomputeBoolean()},this.geometry.userData.parameters={width:0,height:0,depth:0}}get booleanOp(){return this.data.geometry.operation}get phongAngle(){return this.data.geometry.phongAngle??45}get isLOD(){return this.recomputeBoolean(),!1}updateByPatchedOp(t,e,i){super.updateByPatchedOp(t,e,i),t.path.length===1&&t.path[0]==="geometry"&&t.type===0&&t.props.operation!==void 0&&(this.freeBooleanPointer(),this.resetBBoxNeedsUpdate())}freeBooleanPointer(){super.freeBooleanPointer(),this.geometry.dispose()}recomputeBoolean(t,e=!0){if(this.booleanMeshSetAddress!==-1&&!t)return;for(let n=0;n<this.children.length;n++){let r=this.children[n];r instanceof oh&&r.dataPatched.visible===!0&&r.recomputeBoolean(t===!0,e)}this.meshSetAddresses=[];for(let n=0;n<this.children.length;n++){let r=this.children[n];if(r instanceof Xi&&r.dataPatched.visible===!0&&r.geometry.attributes.position?.count>0&&r.geometry.drawRange.count>0&&r.booleanMeshSetAddress!==0){Ao.multiplyMatrices(r.hiddenMatrix,r.matrix).multiply(r.pivotMatrix);try{let s=M$(r,this);if(r.booleanMeshSetAddress===-1){if((r.geometry.index??r.geometry.getAttribute("position")).count/3<15e5){let a=HX(r.geometry,t===!0);r.booleanMeshSetAddress=s===void 0||a===-1?a:U4(r,s,a,Ao)}if(r.booleanMeshSetAddress===-1)return;s===void 0&&CS(r.booleanMeshSetAddress,Ao),r.booleanMatrixInvOld.copy(Ao).invert(),r.booleanWasTransformed=!1}else r instanceof oh&&r.needsTransformForDownstream===!0?(s===void 0?CS(r.booleanMeshSetAddress,Ao):r.booleanMeshSetAddress=U4(r,s,r.booleanMeshSetAddress,Ao),r.needsTransformForDownstream=!1):r.booleanWasTransformed===!0&&(CS(r.booleanMeshSetAddress,z4.multiplyMatrices(Ao,r.booleanMatrixInvOld)),r.booleanMatrixInvOld.copy(Ao).invert(),r.booleanWasTransformed=!1)}catch(s){console.error(s),r.booleanMeshSetAddress=0,r.geometry.userData.booleanOperationDidFail=!0;continue}if(r.booleanMeshSetAddress===0)continue;this.meshSetAddresses.push(r.booleanMeshSetAddress),r.geometry.userData.booleanOperationDidFail=!1}}if(this.meshSetAddresses.length===0){if(this.geometry.getAttribute("position")?.array.length!==0){let n=this.geometry;n.dispose(),this.geometry=new Gt,this.geometry.userData=n.userData,this.geometry.boundingSphere=n.boundingSphere,this.geometry.setAttribute("position",new Nt([],3))}return void this.geometry.setDrawRange(0,0)}if(t===!0)return function(n,r){let s=X_(),a=OO(n,r),o=s.mesh_topological_data(a),l=o.positions(),c=o.indices();return o.free(),a.free(),{positions:l,indices:c,verticesPerFace:new Uint8Array(c.length/3).fill(3)}}(this.meshSetAddresses,this.booleanOp);let i=this.geometry;i.dispose(),this.geometry=new Gt,this.geometry.userData=i.userData,this.geometry.boundingSphere=i.boundingSphere;try{this.booleanMeshSetAddress=function(n,r,s,a){let o=X_(),l=OO(n,r),c=o.mesh_render_data(l,Math.max(a,0));if(s.setAttribute("position",new Nt(c.positions(),3)),s.setAttribute("normal",new Nt(c.normals(),3)),c.free(),s.boundingSphere===null&&(s.boundingSphere=new vr),l.tri_count()===0)s.boundingSphere.center.set(0,0,0),s.boundingSphere.radius=0,s.userData.parameters={width:0,height:0,depth:0};else{let h=l.bounds();s.boundingSphere.center.set(h[0],h[1],h[2]),s.boundingSphere.radius=(h[3]**2+h[4]**2+h[5]**2)**.5,s.userData.parameters={width:2*h[3],height:2*h[4],depth:2*h[5]}}return BC(l)}(this.meshSetAddresses,this.booleanOp,this.geometry,this.phongAngle)}catch(n){this.booleanMeshSetAddress=0,this.geometry.userData.booleanOperationDidFail=!0,console.error(n)}this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0,Ku(this),Qu(this)}dispose(){super.dispose(),this.geometry.dispose()}}}),Yg=F(()=>{et(),Wr(),Kc(),(nb||(nb={})).is=function(t){return Be.is(t)&&t instanceof _u},sx=(t,e)=>class extends Zc(t,e){updateState_Light(i,n){if(this.updateState_Entity(i,n),i.color!==void 0&&(this.color=n.shared.color(i.color)),i.intensity!==void 0&&(this.intensity=i.intensity*Math.PI),i.depth!==void 0){let r=this.shadow;r.camera.far=i.depth,r.needsUpdate=!0}i.shadows!==void 0&&(this.castShadow=i.shadows)}}}),xh=F(()=>{$g(),Yn(),Kc(),pa=t=>t instanceof Xi,to=t=>t!==null&&t instanceof oh,rb=t=>pA.is(t)});function mr(t,e){return e.color(t)}function F4(t=new Date,e){let i=e.format,n=t.getSeconds(),r=t;e&&e.timeZone!==null&&(r=function(d,u){try{let p=new Intl.DateTimeFormat("en-US",{timeZone:u,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}).formatToParts(d),f=g=>Number(p.find(m=>m.type===g)?.value);return new Date(f("year"),f("month")-1,f("day"),f("hour"),f("minute"),f("second"),d.getMilliseconds())}catch{return new Date(NaN)}}(new Date,e.timeZone));let s,a=r.getHours(),o=r.getMinutes();e.format12h24h==="12ampm"&&(s=a>=12?"PM":"AM");let l,c,h=a;switch(e.format12h24h!=="24"&&(h=a%12,h===0&&(h=12)),i){case"HH:mm:ss":l=[h,o,n];break;case"HH:mm":l=[h,o];break;case"HH":l=[h],s=void 0;break;case"mm":l=[o],s=void 0;break;case"ss":l=[n],s=void 0;break;case"year":c=r.getFullYear();break;case"month":c=r.getMonth()+1;break;case"dayOfYear":c=Math.floor((r.getTime()-new Date(r.getFullYear(),0,0).getTime())/864e5);break;case"dayOfMonth":c=r.getDate();break;case"secondOfDay":c=60*a*60+60*o+n;break;default:console.error("Unknown time format",i),c=0}return l!==void 0?{textValue:l,suffix:s}:c}var VA,Zg,e3=F(()=>{}),E$=F(()=>{et(),Wg(),qg(),VA=class extends _p(Pz){constructor(t,e=15,i=10066329){super(t,e,i),this.object=t,this.added=!1,this.name=`DirectionalLightHelper: ${t.uuid}`}raycast(t,e){bp(this.object,VA.geometryHelper,t,e)}}}),i3=F(()=>{et(),E$(),Yg(),Zg=class extends sx(Mz,VA){constructor(t,e,i){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=2048,this.shadow.mapSize.height=2048,this.shadow.normalBias=1,this.layers.enable(3);let n=this.shadow.camera;n.top=1250,n.bottom=-1250,n.right=1250,n.left=-1250,n.near=-1e4,n.far=2500;let r=new wg(this.shadow.camera);r.visible=!1,this.gizmos.shadowmap=r}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this.gizmos){let e=this.gizmos[t];e instanceof wg&&e.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e);let i=t.depth!==void 0&&t.depth!==this.shadow.camera.far||t.size!==void 0&&t.size/2!==this.shadow.camera.right;t.size!==void 0&&function(n,r){n.shadow.camera.right=r/2,n.shadow.camera.left=-r/2,n.shadow.camera.top=r/2,n.shadow.camera.bottom=-r/2,n.shadow.needsUpdate=!0}(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)),t.penumbraSize!==void 0&&e.scene.markPenumbraSizeDirty(),i&&this.update()}}});function n3(t){return t instanceof Hr&&t.needsAO&&!ch(t)&&t.isDecalObject!==!0}function r3(t){let e=t.cloner;if(e&&Array.isArray(e.children))for(let i of e.children)i?.layers&&(i.layers.mask=t.layers.mask)}function s3(t){return t.getLayersOfType("reflection").filter(e=>e.data.visible).length}function N4(t,e){let i={outline:!1,cavity:!1},n=t.layers.mask&ax,r=e.getLayersOfType("transmission"),s=e.getLayersOfType("outline"),a=s3(e),o=e.getLayersOfType("cavity");return(s.length>0||o.length>0)&&(t.layers.set(8),r.length>0&&t.layers.enable(3),a>0&&t.layers.enable(4),i.outline=s.length>0,i.cavity=o.length>0,Qu(t),Ku(t)),r.length===0&&s.length===0&&o.length===0&&a===0&&t.layers.set(0),n&&t.layers.set(9),!n&&n3(t)&&t.layers.enable(5),r3(t),i}function k4(t,e){if(!e.layers)return!1;let i=t.layers.mask&ax,n=!1,r=e.getLayersOfType("transmission").filter(l=>l.data.visible),s=e.getLayersOfType("outline").filter(l=>l.data.visible),a=s3(e),o=e.getLayersOfType("cavity").filter(l=>l.data.visible);return r.length>0&&(t.layers.set(3),(s.length>0||o.length>0)&&t.layers.enable(8),a>0&&t.layers.enable(4),n=!0),r.length===0&&s.length===0&&o.length===0&&a===0&&t.layers.set(0),i&&t.layers.set(9),!i&&n3(t)&&t.layers.enable(5),r3(t),n}function V4(t,e){var i;if(!e.layers)return!1;let n=t.layers.mask&ax,r=!1,s=s3(e),a=e.getLayersOfType("transmission").filter(c=>c.data.visible),o=e.getLayersOfType("outline").filter(c=>c.data.visible),l=e.getLayersOfType("cavity").filter(c=>c.data.visible);return s>0&&((i=t.userData).__splinePlanarMirror??(i.__splinePlanarMirror=0),t.layers.set(4),a.length>0&&t.layers.enable(3),(o.length>0||l.length>0)&&t.layers.enable(8),r=!0),s===0&&a.length===0&&o.length===0&&l.length===0&&t.layers.set(0),n&&t.layers.set(9),!n&&n3(t)&&t.layers.enable(5),r3(t),r}function jA(t,e,i,n=!1){let r=t.cloner;if(r){let s=null;if(t.raycast===xi.prototype.raycast||t.raycast===Xi.prototype.raycast){let a=t.geometry;a&&(a.boundingSphere===null&&a.computeBoundingSphere(),s=a.boundingSphere)}for(let a of r.children){if(s!==null&&(GA.copy(s).applyMatrix4(a.matrixWorld),!e.ray.intersectsSphere(GA)))continue;let o=Mk.copy(a.matrixWorld).invert(),l=Ek.copy(e.ray).applyMatrix4(o),c=t.matrixWorld;l.applyMatrix4(c);let h=Sk;h.set(l.origin,l.direction),h.near=e.near,h.far=e.far,h.layers.mask=e.layers.mask;let d=h.intersectObject(t,!1);d.length>0&&i.push({...d[0],object:n?a:t})}}}var ax,Sk,Mk,Ek,GA,Pv,Ak,KS,QS,JS,Kg,dn,Tk=F(()=>{Li(),rx(),Yn(),Qc(),et(),ax=512,Sk=new eC,Mk=new At,Ek=new $o,GA=new vr}),A$=F(()=>{et(),Wg(),qg(),Pv=class extends _p(Tz){constructor(t,e=6710886){super(t,e),this.object=t,this.matrix=t.matrixWorld,this.name=`SpotLightHelper: ${t.uuid}`}raycast(t,e){bp(this.object,Pv.geometryHelper,t,e)}update(){if(this.object!==void 0){let t=Pv._vector,e=this.object.distance?this.object.distance:1e3,i=e*Math.tan(this.object.angle);this.cone.scale.set(i,i,e),t.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(t);let n=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let r=0,s=this.cone.material.length;r<s;r++)this.cone.material[r].color.set(n);else this.cone.material.color.set(n)}}},(Ak=Pv)._vector=new C}),a3=F(()=>{et(),A$(),Yg(),KS=new C,QS=new C,JS=new $t,Kg=class extends sx(wz,Ak){constructor(t,e,i){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let n=this.shadow.camera;n.fov=2*Ot.RAD2DEG*this.angle,n.aspect=1,n.near=100,n.far=2500;let r=new wg(this.shadow.camera);r.visible=!1,this.gizmos.shadowmap=r,this.update()}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this.gizmos){let e=this.gizmos[t];e instanceof wg&&e.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),QS.setFromMatrixPosition(this.matrixWorld),JS.setFromRotationMatrix(this.matrixWorld),KS.copy(this.up).applyQuaternion(JS).negate().multiplyScalar(this.distance),this.target.position.copy(QS).add(KS),this.target.updateMatrixWorld(),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e),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.penumbraSize!==void 0&&e.scene.markPenumbraSizeDirty(),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null))}}}),al=F(()=>{Yt(),Hs(),et(),Wr(),ya(),e3(),sl(),i3(),Ye(),bh(),et(),Qc(),xh(),Tk(),a3(),ke(),$g(),dn=class extends Yb(rs){constructor(t,e,i){if(super(),this.data=e,this.bgColor=new mn(1,1,1,1),this.fog=null,this.backupFog=new KM(16777215,.1,2e3),this.fogUseBGColor=!1,this.fogMode="linear",this.fogDensity=tr.getDensity({}),this.fogHeightFalloff=tr.getHeightFalloff({}),this.fogHeightBase=tr.getHeightBase({}),this.isActive=!1,this.skyState=null,this.skyStateVersion=0,this.gradingState=null,this.skyHdriHolder=null,this.aoColor=new Jt,this.penumbraSizeArrayCache=null,this.super_Entity(t,e),this.personalCamera=new gn(Yc,{...ig.defaultData,...e.camera,name:"Personal Camera"}),this.personalCamera.objectHelper.visible=!1,this.add(this.personalCamera),this.activeCamera=this.personalCamera,this.ambientLight=new xz(13882323,8553090,.75*Math.PI),this.ambientLight.name="Default Ambient Light",this.ambientLight.layers.enable(3),this.ambientLight.removeFromParent(),this.add(this.ambientLight),e.uiScene){let n=lA();n===null?Vn("ui-2d","a page's 2D scene"):this.uiScene=new n.Scene2D((Array.isArray(t)?t[0]:t)+"-ui",e.uiScene,{dpr:window.devicePixelRatio,shared:i.shared})}else e.uiFrame&&this.createUICanvas(e.uiFrame,i)}get scene(){return this.parent}get postprocessing(){return this.data.postprocessing}get frameId(){return this.data.uiFrame}get frame(){return this.uiCanvas?.frame}createUICanvas(t,e){let i=lA();i!==null?(this.uiCanvas=new i.UICanvas(this.uuid+"-uiscreen",window.innerWidth,window.innerHeight,e),this.uiCanvas.isScreenSpace=!0,this.uiCanvas.promise.then(()=>{this.uiCanvas?.applyFrame(t),this.uiCanvas?.applySize()})):Vn("ui-2d","a page's UI canvas")}updateVisible(){}setBackgroundColor(t){this.bgColor=t,this.fogUseBGColor===!0&&(this.backupFog.color=t)}entityChildrenCount(){return this.uiScene?this.uiScene.children.length:super.entityChildrenCount()}updateAmbientLight(t,e){t.color!==void 0&&(this.ambientLight.color=mr(t.color,e)),t.intensity!==void 0&&(this.ambientLight.intensity=t.intensity*Math.PI),t.enabled!==void 0&&(t.enabled?this.add(this.ambientLight):this.remove(this.ambientLight))}onDeactive(){this.isActive=!1}onActive(t){this.isActive=!0,t.fog=this.fog,this.traverseEntity(e=>{e instanceof oh&&e.recomputeBoolean()}),this.updateShadow(this.data.shadow)}forceMaterialsUpdate(){this.traverseEntity(t=>{if(t instanceof Hr)if(Array.isArray(t.material))for(let e of t.material)e.needsUpdate=!0;else t.material.needsUpdate=!0,t.material.dispose()})}updateShadow(t){if(t.softShadowQuality===void 0&&t.type===void 0||!this.isActive)return;let e=this.data.shadow;var i,n;i=eg.isSoft(e),n=e?.softShadowQuality,zA!==void 0&&zA(i,n)&&this.forceMaterialsUpdate()}updateFog(t,e){t.enabled?this.fog=this.backupFog:this.fog=null,this.isActive&&(this.scene.fog=this.fog),this.fogUseBGColor=t.useBackgroundColor,t.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=mr(t.color,e),this.backupFog.near=t.near,this.backupFog.far=t.far,this.fogMode=tr.getMode(t),this.fogDensity=tr.getDensity(t),this.fogHeightFalloff=tr.getHeightFalloff(t),this.fogHeightBase=tr.getHeightBase(t)}updateSky(t,e){this.skyState=t??null,this.skyStateVersion++;let i=t?.hdri?.image;this.skyHdriHolder=i!=null?e.image(i):null}updateAo(t,e){t.aoColor!==void 0&&(this.aoColor=mr(t.aoColor,e))}updateByOp(t,e,i,n){let r=this.data.uiFrame;super.updateByOp(t,e,i,n);let s=e;ri(t.path,["fog"])?this.updateFog(s.fog,i.shared):ri(t.path,["sky"])?this.updateSky(s.sky,i.shared):ri(t.path,["grading"])?this.gradingState=s.grading??null:ri(t.path,["ao"])?this.updateAo(s.ao,i.shared):ri(t.path,["ambient"])?this.updateAmbientLight(s.ambient,i.shared):ri(t.path,["shadow"])?this.updateShadow(s.shadow):t.type===0&&t.path.length===0&&(t.props.uiFrame!==void 0||r!==s.uiFrame)&&this.updateUIFrame(t.props.uiFrame,i)}updateUIFrame(t,e){t?(this.uiCanvas||this.createUICanvas(t,e),this.uiCanvas.enabled=!0,this.uiCanvas.applyFrame(t)):this.uiCanvas&&(this.uiCanvas.enabled=!1)}updateState(t,e){this.updateState_Entity(t,e),t.backgroundColor!==void 0&&this.setBackgroundColor(mr(t.backgroundColor,e.shared)),t.fog!==void 0&&this.updateFog(t.fog,e.shared),t.sky!==void 0&&this.updateSky(t.sky,e.shared),t.grading!==void 0&&(this.gradingState=t.grading),t.ambient!==void 0&&this.updateAmbientLight(t.ambient,e.shared),t.ao!==void 0&&this.updateAo(t.ao,e.shared),t.shadow!==void 0&&this.updateShadow(t.shadow)}createFrame(t,e){}raycast(t,e){super.raycast(t,e)}switchActiveCamera(t){t&&t.isDescendantOf(this)&&(this.activeCamera!==this.personalCamera&&(this.activeCamera.objectHelper.visible=!0),this.activeCamera=t,t.objectHelper.visible=!1)}get playCamera(){return this.scene?.find(this.data.publish.playCamera)??this.personalCamera}switchToPlayCamera(){this.switchActiveCamera(this.playCamera)}get penumbraSizeArray(){return this.penumbraSizeArrayCache===null&&this.updatePenumbraSizeArray(),this.penumbraSizeArrayCache}updatePenumbraSizeArray(){this.penumbraSizeArrayCache=new Array(il).fill(.5);let t=0,e=0;this.traverseEntity(i=>{if(!i.visible)return!0;i instanceof Zg&&i.visible&&t<rg&&(this.penumbraSizeArrayCache[t]=i.data.penumbraSize??.5,t+=1),i instanceof Kg&&i.visible&&t<il-rg&&(this.penumbraSizeArrayCache[rg+e]=i.data.penumbraSize??.5,e+=1)})}raycastWithClones(t){let e=[],i=n=>{for(let r of n.children){let s=r.cloner;Be.is(r)&&(r.visible||s?.object.data.visible)&&((pa(r)||rb(r)&&this.scene.enableHelpers&&r.objectHelper.visible)&&(t.intersectObject(r,!1,e),jA(r,t,e,!0)),i(r))}};return i(this),e}updateEntity2DByOp(t,e,i,n){this.uiCanvas?.updateEntity2DByOp(t,e,i,n)}}});function j4(){return Ck}function t2(){if(sb===null)throw new Error('[spe] Classic (WebGL) particles are not available in this build \u2014 it was compiled WebGPU-only. Re-export the scene with renderer "Both" or "WebGL 2", or load the full runtime.');return sb}function e2(t){return t?.isWebGPUSplineRenderer===!0}var Ck,sb,Ju,Pk=F(()=>{Ck=null,sb=null}),o3=F(()=>{et(),Wb(),Kc(),Ju=class extends Zc(vp,up){constructor(t,e,i){super(),this.super_Entity(t,e),this.context=i,this.objectHelper.update()}updateState(t,e){this.updateState_Entity(t,e)}}}),T$=mp((t,e)=>{var i,n;i=t,n=function(){return r.importState=function(s){var a=new r;return a.importState(s),a},r;function r(){return function(s){var a=0,o=0,l=0,c=1;s.length==0&&(s=[+new Date]);var h=function(){var p=4022871197,f=function(g){g=g.toString();for(var m=0;m<g.length;m++){var y=.02519603282416938*(p+=g.charCodeAt(m));y-=p=y>>>0,p=(y*=p)>>>0,p+=4294967296*(y-=p)}return 23283064365386963e-26*(p>>>0)};return f.version="Mash 0.9",f}();a=h(" "),o=h(" "),l=h(" ");for(var d=0;d<s.length;d++)(a-=h(s[d]))<0&&(a+=1),(o-=h(s[d]))<0&&(o+=1),(l-=h(s[d]))<0&&(l+=1);h=null;var u=function(){var p=2091639*a+23283064365386963e-26*c;return a=o,o=l,l=p-(c=0|p)};return u.next=u,u.uint32=function(){return 4294967296*u()},u.fract53=function(){return u()+11102230246251565e-32*(2097152*u()|0)},u.version="Alea 0.9",u.args=s,u.exportState=function(){return[a,o,l,c]},u.importState=function(p){a=+p[0]||0,o=+p[1]||0,l=+p[2]||0,c=+p[3]||0},u}(Array.prototype.slice.call(arguments))}},typeof t=="object"?e.exports=n():typeof define=="function"&&define.amd?define(n):i.Alea=n()});function C$(t){let e=!1;return t.scene.objects.traverse((i,n)=>{n.type==="Mesh"&&n.geometry.type==="SubdivGeometry"&&(e=!0)}),e}var Js,zd,fp,Qg=F(()=>{Yn(),et(),Sp(),rx(),qr(),Js=new ci,zd=new C,fp=class extends Ai{constructor(t,e,i){super(t,e,i),this.data=e,this.hiddenMatrixOld=new At,this.smoothShading=!0,this.skipReactionUpdate=!1}chooseGeoemtryCache(t){return this.dataPatched.flatShading?t.geometryCache:t.geometryCache2}get subdivPointerNew(){return this.localGeometry!==void 0?this.subdivPointer:this.geometry.ensureSubdivPointer()}get originalGeometryNew(){return this.localGeometry!==void 0?this.originalGeometry:this.geometry.originalGeometry}get phongAngle(){return this.data.geometry.phongAngle??45}updateEntityBoxSize(t,e){let i=this.geometry.userData.parameters;t.copy(this.originalGeometryNew.boundingSphere.center),e.set(i.width,i.height,i.depth??0).multiplyScalar(.5)}createGeometryByControls(t){if(this.skipReactionUpdate===!0)return;let e=this.localGeometry?.uuid,{originalGeometry:i,subdividedGeometry:n,subdivPointer:r}=Fi.build(t,this.subdivPointer,this.smoothShading,this.hasNonUniformScale?this.shearScale:void 0);this.subdivPointer=r,i!==void 0&&(this.originalGeometry?.dispose(),this.originalGeometry=i),n!==void 0&&(this.subdividedGeometry?.dispose(),this.subdividedGeometry=n??void 0),this.localGeometry=this.subdividedGeometry??this.originalGeometry,Ku(this),Qu(this),this.calcBoundingBox(),e&&(this.localGeometry.uuid=e)}updateState(t,e){if(super.updateState(t,e),t.flatShading!==void 0){let i=this.material;this.material=Array.isArray(i)?i.map(n=>n.getFlavor(!1,n.side,n.wireframe)):i.getFlavor(!1,i.side,i.wireframe),this.smoothShading=!t.flatShading,this.createGeometryDelayed(e)}}updateMesh(t=!1,e=!1,i=!1){e&&this.subdividedGeometry||Fi.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1,this.originalGeometry,t&&this.hasNonUniformScale?this.shearScaleInv:void 0,i),this.subdividedGeometry&&Fi.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1,this.subdividedGeometry,t&&this.hasNonUniformScale?this.shearScaleInv:void 0)}updateTopology(){let t=this.localGeometry?.uuid;this.originalGeometry.dispose(),this.originalGeometry=Fi.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=Fi.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1)),this.localGeometry=this.subdividedGeometry??this.originalGeometry,Ku(this),Qu(this),this.calcBoundingBox(),t&&(this.localGeometry.uuid=t)}raycast(t,e){let i=this.localGeometry;this.localGeometry=this.originalGeometryNew,Xi.prototype.raycast.call(this,t,e),this.localGeometry=i}activateShearCompensation(){!this.hasNonUniformScale||(this.matrix.copy(this.matrixWorldRigid),this.hiddenMatrixOld.copy(this.hiddenMatrix),this.hiddenMatrix.copy(this.parent.matrixWorld).invert())}deactivateShearCompensation(){!this.hasNonUniformScale||(this.updateMatrix(),this.hasNonUniformScale=void 0,this.hiddenMatrix.copy(this.hiddenMatrixOld))}calcBoundingBox(){let t=this.originalGeometry;t.boundingSphere===null&&(t.boundingSphere=new vr,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=t.boundingSphere));let e=t.attributes.position,i=t.boundingSphere.center;Js.setFromBufferAttribute(e),Js.getCenter(i),t.boundingSphere.radius=i.distanceTo(Js.max),isNaN(t.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),Js.getSize(zd),this.hasNonUniformScale&&zd.divide(this.scale);let n={width:zd.x,height:zd.y,depth:zd.z};return this.geometry.userData.parameters=n,n}updateBoundingSphere(t){let e=this.originalGeometry;Js.min.set(t[0],t[2],t[4]),Js.max.set(t[1],t[3],t[5]),this.hasNonUniformScale&&(Js.min.applyMatrix4(this.shearScaleInv),Js.max.applyMatrix4(this.shearScaleInv)),e.boundingSphere===null&&(e.boundingSphere=new vr);let i=e.boundingSphere.center;Js.getCenter(i),e.boundingSphere.radius=i.distanceTo(Js.max)}freeSubdivPointer(){this.subdivPointer&&(Fi.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0),this.localGeometry=void 0,this.originalGeometry?.dispose(),this.subdividedGeometry?.dispose()}dispose(){super.dispose(),this.freeSubdivPointer()}updateSubdivisionLevel(t){if(this.skipReactionUpdate===!0)return;let e=this.localGeometry,i=e?.uuid,n=e?.userData.parameters,r=t.subdivisions>0?Fi.buildRefined(this.subdivPointer,t.subdivisions,this.smoothShading?t.phongAngle??35:-1):null;this.subdividedGeometry?.dispose(),this.subdividedGeometry=r??void 0,this.subdividedGeometry&&this.originalGeometry.boundingSphere&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere),this.localGeometry=this.subdividedGeometry??this.originalGeometry,Ku(this),Qu(this),n!==void 0&&(this.localGeometry.userData.parameters=n),i&&(this.localGeometry.uuid=i)}updateByPatchedOpGeometry(t,e,i){super.updateByPatchedOpGeometry(t,e,i),this.localGeometry&&(t.type===0&&t.path.length===0&&pk(t.props)&&this.subdivPointer?this.updateSubdivisionLevel(e):this.createGeometryByControls(e))}}});function l3(t){if(t.component){let e=t.component.instances.indexOf(t);e>=0&&t.component.instances.splice(e,1);for(let i of t.children)Be.is(i)&&l3(i)}}var lg,HA,ox,Dk=F(()=>{Wr()}),P$=mp((t,e)=>{function i(n,r,s,a){this.message=n,this.expected=r,this.found=s,this.location=a,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,i)}(function(n,r){function s(){this.constructor=n}s.prototype=r.prototype,n.prototype=new s})(i,Error),i.buildMessage=function(n,r){var s,a={literal:function(d){return'"'+l(d.text)+'"'},class:function(d){var u,p="";for(u=0;u<d.parts.length;u++)p+=d.parts[u]instanceof Array?c(d.parts[u][0])+"-"+c(d.parts[u][1]):c(d.parts[u]);return"["+(d.inverted?"^":"")+p+"]"},any:function(d){return"any character"},end:function(d){return"end of input"},other:function(d){return d.description}};function o(d){return d.charCodeAt(0).toString(16).toUpperCase()}function l(d){return d.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(u){return"\\x0"+o(u)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(u){return"\\x"+o(u)})}function c(d){return d.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(u){return"\\x0"+o(u)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(u){return"\\x"+o(u)})}function h(d){return a[d.type](d)}return"Expected "+function(d){var u,p,f=new Array(d.length);for(u=0;u<d.length;u++)f[u]=h(d[u]);if(f.sort(),f.length>0){for(u=1,p=1;u<f.length;u++)f[u-1]!==f[u]&&(f[p]=f[u],p++);f.length=p}switch(f.length){case 1:return f[0];case 2:return f[0]+" or "+f[1];default:return f.slice(0,-1).join(", ")+", or "+f[f.length-1]}}(n)+" but "+((s=r)?'"'+l(s)+'"':"end of input")+" found."},e.exports={SyntaxError:i,parse:function(n,r){r=r!==void 0?r:{};var s,a={},o={svg_path:Pe},l=Pe,c=function(J){if(!J)return[];for(var Et=[],ft=0;ft<J.length;ft++)Et=Et.concat.apply(Et,J[ft]);var St=Et[0];return St&&St.code=="m"&&(delete St.relative,St.code="M"),Et},h=function(J,Et){return function(ft,St){if(!St)return[ft];for(var It=[ft],B=0,st=St.length;B<st;B++)It[B+1]=St[B][1];return It}(J,Et)},d=/^[Mm]/,u=be(["M","m"],!1,!1),p=function(J,Et,ft){var St=uo(J,[Et]);return ft&&(St=St.concat(uo(J=="M"?"L":"l",ft[1]))),St},f=/^[Zz]/,g=be(["Z","z"],!1,!1),m=function(){return uo("Z")},y=/^[Ll]/,v=be(["L","l"],!1,!1),_=function(J,Et){return uo(J,Et)},b=/^[Hh]/,x=be(["H","h"],!1,!1),w=function(J,Et){return uo(J,Et.map(function(ft){return{x:ft}}))},S=/^[Vv]/,A=be(["V","v"],!1,!1),E=function(J,Et){return uo(J,Et.map(function(ft){return{y:ft}}))},P=/^[Cc]/,T=be(["C","c"],!1,!1),R=function(J,Et,ft){return{x1:J.x,y1:J.y,x2:Et.x,y2:Et.y,x:ft.x,y:ft.y}},L=/^[Ss]/,D=be(["S","s"],!1,!1),U=function(J,Et){return{x2:J.x,y2:J.y,x:Et.x,y:Et.y}},V=/^[Qq]/,k=be(["Q","q"],!1,!1),Y=function(J,Et){return{x1:J.x,y1:J.y,x:Et.x,y:Et.y}},$=/^[Tt]/,nt=be(["T","t"],!1,!1),Q=/^[Aa]/,rt=be(["A","a"],!1,!1),gt=function(J,Et,ft,St,It,B){return{rx:J,ry:Et,xAxisRotation:ft,largeArc:St,sweep:It,x:B.x,y:B.y}},at=function(J,Et){return{x:J,y:Et}},ht=function(J){return 1*J},ct=function(J){return 1*J.join("")},q=/^[01]/,lt=be(["0","1"],!1,!1),z=function(J){return J=="1"},O=function(){return""},j=",",Z=_e(",",!1),I=function(J){return J.join("")},G=".",W=_e(".",!1),N=/^[eE]/,tt=be(["e","E"],!1,!1),ot=/^[+\-]/,pt=be(["+","-"],!1,!1),ut=/^[0-9]/,Pt=be([["0","9"]],!1,!1),bt=function(J){return J.join("")},Rt=/^[ \t\n\r]/,_t=be([" "," ",`
|
|
4169
|
+
`&&E.push("")):x.getTextWidth(E[E.length-1]+P,b)>A&&(E[E.length-1].length&&E.push(""),x.getTextWidth(E[E.length-1]+P,b)>A&&(P.length===1?(E[E.length-1]+=P,P=""):(E[E.length-1]+=P.slice(0,-1),P=P[P.length-1],E.push(""))));return E[E.length-1]+=P,E}(t,i,c===2?h.toUpperCase():c===3?h.toLowerCase():h,e),{shapes:u,charWidths:p,charCoords:f}=i.generateShapes(d,t,e),g=.5*(typeof n=="number"?n:Number(e.getVariable(n))),m=.5*(typeof r=="number"?r:Number(e.getVariable(r))),y=u.map(b=>new Ni().fromShape(b,!0));this.vectorShapes=y;let v=y.map(b=>_h.create({shape:b,parameters:{depth:s,extrudeBevelSegments:o,extrudeBevelSize:a,windingRule:s<=0?fi.NONZERO:fi.ODD,subdivisions:this.isLowResolution&&s>0?1:12}})),_=v.length?Sc(v):x4();_.translate(-g,m,0),this.dispose(),this.wrappedText=d,this.charCoords=f,this.charWidths=p,this.deleteAttribute("extrudeNormal"),Object.entries(_.attributes).forEach(([b,x])=>{this.setAttribute(b,x)}),this.setIndex(_.index),this.computeBoundingSphere()}clone(){let t=Er(new Gt,PA.prototype);return t.copy(this),console.log("CloneGeometry",this,t),t}copy(t){return Object.entries(t.attributes).forEach(([e,i])=>{this.setAttribute(e,i)}),this.setIndex(t.index),this.userData={parameters:{...t.userData.parameters},type:"TextGeometry"},this}async setText(t,e){this.font&&await this.font.loadingPromise,await this.update({...this.userData.parameters,text:{textValue:t}},e)}get text(){return this.userData.parameters.text??""}}});function b$(t){if(!DA)return S4||(S4=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.32/build",i=import("./process.js"),[n,r]=await Promise.all([i,fetch(`${e}/process.wasm`).then(o=>o.arrayBuffer())]),s=n.default,a=await s({wasmBinary:r});ck(a),DA=!0}())}var ck,$C,DA,S4,tx=F(()=>{$C=new Promise(t=>{ck=t}),DA=!1});function FS(t,e){if(Object.keys(t.morphAttributes).length>0||Object.keys(e.morphAttributes).length>0)return!1;let i=Object.keys(t.attributes),n=Object.keys(e.attributes);if(i.length!==n.length)return!1;for(let o of n){let l=t.attributes[o],c=e.attributes[o];if(l===void 0||l.isInterleavedBufferAttribute===!0||c.isInterleavedBufferAttribute===!0||l.itemSize!==c.itemSize||l.normalized!==c.normalized||l.array.constructor!==c.array.constructor||l.array.length!==c.array.length)return!1}let r=t.index,s=e.index;if(r===null!=(s===null))return!1;let a=!1;if(r!==null&&s!==null){if(r.array.length!==s.array.length)return!1;let o=r.array.constructor,l=s.array.constructor;if(o!==l){if(o!==Uint32Array||l!==Uint16Array)return!1;a=!0}}if(t.groups.length!==e.groups.length)return!1;for(let o=0;o<e.groups.length;o++){let l=t.groups[o],c=e.groups[o];if(l.start!==c.start||l.count!==c.count||l.materialIndex!==c.materialIndex)return!1}for(let o of n){let l=t.attributes[o],c=e.attributes[o];l.array.set(c.array),l.needsUpdate=!0}if(r!==null&&s!==null){if(a){let o=r.array,l=s.array;for(let c=0,h=l.length;c<h;c++){let d=l[c];o[c]=d===65535?4294967295:d}}else r.array.set(s.array);r.needsUpdate=!0}return t.drawRange.start=e.drawRange.start,t.drawRange.count=e.drawRange.count,t.userData=e.userData,t.boundingBox=null,t.boundingSphere=null,!0}function RA(t,e,i,n){let r,s,a,o=t.position.array,l=t.normal.array,c=dk.makeScale(e,i,n).invert().elements;for(let h=0,d=o.length;h<d;h+=3)o[h]*=e,o[h+1]*=i,o[h+2]*=n,r=l[h],s=l[h+1],a=l[h+2],l[h]=c[0]*r+c[4]*s+c[8]*a,l[h+1]=c[1]*r+c[5]*s+c[9]*a,l[h+2]=c[2]*r+c[6]*s+c[10]*a;t.position.needsUpdate=!0,t.normal.needsUpdate=!0}var dk,uk=F(()=>{et(),dk=new At});function pk(t){let e=Object.keys(t);return e.length===1&&e[0]==="subdivisions"}function YC(t,e){let i=e?e.count:t.count,n=0,r=1e4,s=new Map,a=new Uint32Array(i),o=[];for(let h=0;h<i;h++){let d=e?e.getX(h):h,u=t.getX(d),p=t.getY(d),f=t.getZ(d),g=Math.round(u*r),m=Math.round(p*r),y=Math.round(f*r),v=s.get(g);v===void 0&&(v=new Map,s.set(g,v));let _=v.get(m);_===void 0&&(_=new Map,v.set(m,_));let b=_.get(y);b===void 0&&(b=n++,_.set(y,b),o.push(u,p,f)),a[h]=b}let l=[],c=[];for(let h=0;h<a.length;h+=3)a[h]===a[h+1]||a[h]===a[h+2]||a[h+1]===a[h+2]||(l.push(a[h],a[h+1],a[h+2]),c.push(e?e.getX(h):h,e?e.getX(h+1):h+1,e?e.getX(h+2):h+2));return{positions:o,triIndices:l,triOriginals:c}}var Of,Kh,Qt,NS,kS,VS,Fi,Lf,Av,Tv,Cv,IA,m1,Sp=F(()=>{et(),tx(),Yt(),ex(),uk(),Ig(),Of=new ci,Kh=new C,$C.then(t=>{Qt=t}),NS=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),kS=new Uint32Array([0,1,2,3]),VS=new Uint8Array([4]),Fi=class extends Gt{constructor(t,e){super(),this.data=t,this.flatShading=e,this.subdivPointer=0,this.rebuild(),this.freeSubdivPointer()}mutateDirectlyScaleBaked(t,e){this.freeSubdivPointer();let i=this.data.scaleBaked.map(a=>typeof a=="number"?a:1),n=ah.div(e.map(a=>typeof a=="number"?a:0),i);if(n.every(a=>a===1))return;this.subdividedGeometry&&RA(this.subdividedGeometry.attributes,...n),this.originalGeometry&&RA(this.originalGeometry.attributes,...n),this.data=t;let r=this.userData.parameters;this.userData.parameters={width:r.width*n[0],height:r.height*n[1],depth:r.depth*n[2]},this.originalGeometry.boundingSphere.center.multiply(Kh.fromArray(n));let s=Kh.set(r.width,r.height,r.depth).length();this.originalGeometry.boundingSphere.radius=s/2}ensureSubdivPointer(){return this.subdivPointer===0&&this.rebuild(),this.subdivPointer}mutateDirectlySubdivisions(t){this.freeSubdivPointer(),this.data=t;let e=t.phongAngle??35;this.flatShading&&(e=-1);let i=null;if(t.subdivisions>0){let r=0;try{r=Fi.allocate(t),i=Fi.buildRefined(r,t.subdivisions,e)}catch(s){console.error(s,t)}finally{r&&Fi.freeSubdivPointer(r)}}this.subdividedGeometry?.dispose(),this.subdividedGeometry=i??void 0,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere);let n=this.userData.parameters;Object.assign(this,this.subdividedGeometry??this.originalGeometry),this.userData.parameters=n}rebuild(){let t,e,i;try{({originalGeometry:t,subdividedGeometry:e,subdivPointer:i}=Fi.build(this.data,void 0,!this.flatShading,void 0))}catch{t=new ga(100,100,100),i=0}this.subdivPointer=i,this.originalGeometry=t,this.subdividedGeometry=e??void 0;let n=this.subdividedGeometry??this.originalGeometry;Object.assign(this,n),this.calcBoundingBox()}freeSubdivPointer(){this.subdivPointer&&(Fi.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0)}dispose(){super.dispose(),this.freeSubdivPointer()}calcBoundingBox(){let t=this.originalGeometry;t.boundingSphere===null&&(t.boundingSphere=new vr,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=t.boundingSphere));let e=t.attributes.position,i=t.boundingSphere.center;Of.setFromBufferAttribute(e),Of.getCenter(i),t.boundingSphere.radius=i.distanceTo(Of.max),isNaN(t.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),Of.getSize(Kh);let n={width:Kh.x,height:Kh.y,depth:Kh.z};return this.userData.parameters=n,n}static build(t,e,i,n){let r,s,a=t?.phongAngle??35;i===!1&&(a=-1),e&&(Qt.free_bvh(e),Qt.free_subdivision_surface(e));try{r=Fi.allocate(t,n)}catch(l){console.error(l,t),r=Fi.allocate({positionWASM:NS,indexWASM:kS,verticesPerFaceWASM:VS},n)}Qt.set_destination_refinement_level(r,0);let o=Fi.buildLevel(r,!0,a);return s=t.subdivisions>0?Fi.buildRefined(r,t.subdivisions,a):null,{subdivPointer:r,originalGeometry:o,subdividedGeometry:s}}static buildRefined(t,e,i){try{return Qt.set_destination_refinement_level(t,e),Fi.buildLevel(t,!1,i)??null}catch{try{return Qt.set_destination_refinement_level(t,e-1),Fi.buildLevel(t,!1,i)??null}catch{return null}}}static primitiveToQuads(t,e,i){t.widthSegments>16&&(t.widthSegments=16),t.heightSegments>16&&(t.heightSegments=16),t.depthSegments>16&&(t.depthSegments=16),t.radialSegments>16&&(t.radialSegments=16),t.type==="DodecahedronGeometry"&&(t.detail=0);let n,r=t.shape!==void 0||t.path!==void 0?e.geometry:Ql(t,i,!1,e);n=mN(t)?r.getClosedTorusIndicesForBooleanOrSubdiv():r.getIndex();let s,{positions:a,triIndices:o,triOriginals:l}=YC(r.getAttribute("position"),n);if(t.type==="CylinderGeometry"&&t.cornerRadius===0&&t.hollow===0&&t.openEnded===!1){let u=t.radialSegments*t.heightSegments*3*2;s=[u,u+3*t.radialSegments]}let{indices:c,verticesPerFace:h,uvs:d}=function(u,p,f,g,m){let y=[],v=[],_=m?f.getAttribute("uv"):void 0,b=_&&_.itemSize===2?[]:void 0,x=A=>{if(b){let E=m[A];b.push(_.getX(E),_.getY(E))}};if(f.userData.shape!==void 0&&f.userData.parameters.depth===0&&f.userData.shape.shapeHoles.length===0){let A=f.userData.shape.extractShapePointsToFlatArray([]),E=f.userData.parameters.spikes;if(f.userData.type==="EllipseGeometry"&&E<=24&&E%4==0&&f.userData.parameters.angle>=360){let R=A.length/2/E;A=A.filter((L,D)=>Math.floor(D/2)%R===0)}let P=0;for(let R=0;R<A.length;R+=2)P+=(A[R]-A[(R===0?A.length:R)-2])*(A[R+1]+A[(R===0?A.length:R)-1]);u.length=0;let T=0;if(P<0)for(let R=0;R<A.length;R+=2)u.push(A[R],A[R+1],0),y.push(T++);else for(let R=A.length-2;R>=0;R-=2)u.push(A[R],A[R+1],0),y.push(T++);return v.push(T),{indices:y,verticesPerFace:v}}let w=new Float32Array([f.userData.parameters.depth])[0],S=0;for(;S<p.length;){if(f.useNgonForTopBottomFaceDuringBake){let A=0;if((u[3*p[S]+2]===w||u[3*p[S]+2]===0)&&A++,(u[3*p[S+1]+2]===w||u[3*p[S+1]+2]===0)&&A++,(u[3*p[S+2]+2]===w||u[3*p[S+2]+2]===0)&&A++,A===3)break}if(p[S+1]===p[S+3]&&p[S+2]===p[S+5]||p[S+0]===p[S+3]&&p[S+2]===p[S+4]){Lf.set(u[3*p[S]],u[3*p[S]+1],u[3*p[S]+2]),Av.set(u[3*p[S+1]],u[3*p[S+1]+1],u[3*p[S+1]+2]),Tv.set(u[3*p[S+4]],u[3*p[S+4]+1],u[3*p[S+4]+2]),Cv.set(u[3*p[S+5]],u[3*p[S+5]+1],u[3*p[S+5]+2]),Av.sub(Lf).normalize(),Tv.sub(Lf).normalize(),Cv.sub(Lf).normalize();let A=Av.cross(Tv).dot(Cv),E=S;Math.abs(A)>.005||g&&g.some((P,T)=>T%2!=1&&E>=g[T]&&E<g[T+1])?(y.push(p[S],p[S+1],p[S+2]),x(S),x(S+1),x(S+2),v.push(3),S+=3):(y.push(p[S],p[S+1],p[S+4],p[S+5]),x(S),x(S+1),x(S+4),x(S+5),v.push(4),S+=6)}else y.push(p[S],p[S+1],p[S+2]),x(S),x(S+1),x(S+2),v.push(3),S+=3}if(f.useNgonForTopBottomFaceDuringBake){let A=[],E=[],P=0;for(let T=0,R=0;T<u.length;T+=3,R++)u[T+2]===0&&(A.push(R),P++),u[T+2]===w&&E.push(R);if(f.userData.parameters.extrudeBevelSize===0){let T=E[0];E[0]=E[1],E[1]=T}A.reverse(),y.push(...A,...E),v.push(P,P),b=void 0}return{indices:y,verticesPerFace:v,uvs:b}}(a,o,r,s,l);return{positions:a,indices:c,verticesPerFace:h,uvs:d}}static allocate(t,e){let i,n,r,s=[],a=[];t.positionWASM&&t.positionWASM.length>0?(i=t.positionWASM,n=t.indexWASM,r=t.verticesPerFaceWASM,Qt.alloc_subdivision_surface_uvs&&t.uvWASM&&t.uvWASM.length===2*n.length&&(a=t.uvWASM)):(i=NS,n=kS,r=VS);let o,l=i.length,c=n.length,h=r.length,d=i.length+s.length+a.length,u=n.length+r.length,p=d*Float32Array.BYTES_PER_ELEMENT+u*Uint32Array.BYTES_PER_ELEMENT,f=d*Float32Array.BYTES_PER_ELEMENT,g=Qt._malloc(p),m=new Float32Array(Qt.HEAPF32.buffer,g,d),y=new Uint32Array(Qt.HEAPU32.buffer,g+f,u);m.set(i,0),m.set(s,i.length),m.set(a,i.length+s.length),y.set(n,0),y.set(r,n.length),t?.scaleBaked?.some(b=>b!==1)&&(o=new At().makeScale(...t.scaleBaked.map(b=>typeof b=="number"?b:1))),e&&(o?o.premultiply(e):o=e);let v=g+(i.length+s.length)*Float32Array.BYTES_PER_ELEMENT,_=a.length?o?Qt.alloc_subdivision_surface_uvs2(g,l,g+f,c,g+f+n.length*Uint32Array.BYTES_PER_ELEMENT,h,v,a.length,o.elements):Qt.alloc_subdivision_surface_uvs(g,l,g+f,c,g+f+n.length*Uint32Array.BYTES_PER_ELEMENT,h,v,a.length):o?Qt.alloc_subdivision_surface2(g,l,g+f,c,g+f+n.length*Uint32Array.BYTES_PER_ELEMENT,h,o.elements):Qt.alloc_subdivision_surface(g,l,g+f,c,g+f+n.length*Uint32Array.BYTES_PER_ELEMENT,h);return Qt._free(g),_}static buildLevel(t,e,i,n,r,s=!1){let a=r?Qt.get_mesh_data2(t,e?Qt.Level.CONTROL:Qt.Level.REFINED,i,r.elements):Qt.get_mesh_data(t,e?Qt.Level.CONTROL:Qt.Level.REFINED,i),o=Qt.HEAPU32.subarray(a>>2,10+(a>>2)),l=o.subarray(4,8),c=0,h=Qt.HEAPU32[o[c]>>2],d=Qt.HEAPF32.subarray(h>>2,(h>>2)+l[c]);c++;let u=Qt.HEAPU32[o[c]>>2],p=Qt.HEAPF32.subarray(u>>2,(u>>2)+l[c]);c++;let f=Qt.HEAPU32[o[c]>>2],g=Qt.HEAPU32.subarray(f>>2,(f>>2)+l[c]);c++;let m,y=Qt.HEAPU32[o[c]>>2],v=Qt.HEAPU32.subarray(y>>2,(y>>2)+l[c]);if(c++,Qt.alloc_subdivision_surface_uvs){let b=o[9];if(b>0){let x=Qt.HEAPU32[o[8]>>2];m=Qt.HEAPF32.subarray(x>>2,(x>>2)+b)}}if(n===void 0){let b=new Gt;if(b.setIndex(new nh(v,1)),b.setAttribute("position",new Nt(d,3)),b.setAttribute("normal",new Nt(p,3)),m&&b.setAttribute("uv",new Nt(m,2)),e){b.setAttribute("faceMap",new nh(g,1));let x=new Float32Array(p.length/3*4).fill(0);b.setAttribute("color",new Ht(x,4))}return Qt.free_mesh_data(a),b.userData.type="SubdivGeometry",b}if(n.getAttribute("position").copyArray(d),n.getAttribute("normal").copyArray(p),n.attributes.position.needsUpdate=!0,n.attributes.normal.needsUpdate=!0,s){let b=n.getIndex();b!==null&&b.array.length===v.length&&(b.copyArray(v),b.needsUpdate=!0)}let _=n.getAttribute("uv");m&&_&&_.array.length===m.length&&(_.copyArray(m),_.needsUpdate=!0),Qt.free_mesh_data(a)}static freeSubdivPointer(t){Qt.free_bvh(t),Qt.free_subdivision_surface(t)}static buildControlCageWireframe(t,e,i){let n=Qt.get_wireframe_data_for_base_level(t),r=Qt.HEAPU32.subarray(n>>2,4+(n>>2)),s=r.subarray(2,4),a=0,o=Qt.HEAPU32[r[a]>>2],l=Qt.HEAPF32.subarray(o>>2,(o>>2)+s[a]);a++;let c=Qt.HEAPU32[r[a]>>2],h=Qt.HEAPU32.subarray(c>>2,(c>>2)+s[a]);if(e===void 0){let d=new Gt;d.setAttribute("position",new Nt(l,3));let u=new Float32Array(l.length);for(let p=0,f=l.length;p<f;)u[p++]=i.r,u[p++]=i.g,u[p++]=i.b;return d.setAttribute("color",new Ht(u,3)),d.setIndex(new nh(h,1)),Qt.free_wireframe_data_for_base_level(n),d}e.getAttribute("position").copyArray(l),e.attributes.position.needsUpdate=!0,Qt.free_wireframe_data_for_base_level(n)}static updateCollabMesh(t,e,i){let n=e===0;n||Qt.set_destination_refinement_level(t,e);let r=i?Qt.get_topological_data2(t,n?Qt.Level.CONTROL:Qt.Level.REFINED,i.elements):Qt.get_topological_data(t,n?Qt.Level.CONTROL:Qt.Level.REFINED),s=Qt.HEAPU32.subarray(r>>2,8+(r>>2)),a=s.subarray(3,6),o=0,l=Qt.HEAPU32[s[o]>>2],c=new Float32Array(Qt.HEAPF32.subarray(l>>2,(l>>2)+a[o]));o++;let h=Qt.HEAPU32[s[o]>>2],d=new Uint32Array(Qt.HEAPU32.subarray(h>>2,(h>>2)+a[o]));o++;let u,p=Qt.HEAPU32[s[o]>>2],f=new Uint8Array(Qt.HEAPU32.subarray(p>>2,(p>>2)+a[o]));if(Qt.alloc_subdivision_surface_uvs){let g=s[7];if(g>0){let m=Qt.HEAPU32[s[6]>>2];u=new Float32Array(Qt.HEAPF32.subarray(m>>2,(m>>2)+g))}}return Qt.free_topological_data(r),{positions:c,indices:d,verticesPerFace:f,uvs:u}}},Lf=new C,Av=new C,Tv=new C,Cv=new C}),fk=F(()=>{WO(),qO(),Z_(),XO(),J_(),Ig(),l4(),h4(),c4(),TA(),p4(),tb(),f4(),m4(),g4(),CA(),v4(),y4(),_4(),b4(),dh(),ke(),WO(),qO(),Z_(),XO(),J_(),y$(),Ig(),l4(),h4(),c4(),TA(),p4(),tb(),f4(),m4(),g4(),CA(),v4(),y4(),_4(),b4(),dh(),_$(),WN(),hk(),Sp(),tx(),Kb(),IA={ConeGeometry:IN,CubeGeometry:ON,CylinderGeometry:GC,DodecahedronGeometry:LN,EllipseGeometry:Qb,HelixGeometry:gN,IcosahedronGeometry:YN,LatheGeometry:ZN,NonParametricGeometry:QN,PolygonGeometry:qC,PyramidGeometry:JN,RectangleGeometry:Jb,SphereGeometry:ik,PlaneGeometry:nk,BackdropGeometry:rk,StarGeometry:XC,TextFrameGeometry:sk,TorusGeometry:ak,TorusKnotGeometry:ok,TriangleGeometry:lk,VectorGeometry:_h},m1=t=>{let e=IA[t.type]??sN(t.type);if(e===void 0)throw new Error(`No geometry factory registered for "${t.type}" \u2014 was its feature compiled out of this runtime build?`);return e.create(t)}});function Ql(t,e,i,n){let r,s,a;t.type==="PathGeometry"?(s=JSON.parse(JSON.stringify(t)),a=[[],["extrusion"]]):(s={...t},a=[[]]);for(let c of a){let h=s;for(let d of c)h=h[d];for(r in h){let d=h[r];cI(d)&&!mk.includes(r)&&(h[r]=e.getVariable(d,[n.uuid,"geometry",...c,r]),cI(h[r])&&(h[r]=1))}}let o,l={parameters:s,type:s.type};if(s.type==="PathGeometry")l.path=s.path;else if(s.type==="VectorGeometry"){let c=Ni.createFromState(s.shape,s.width,s.height);l.shape=c}else if(s.type==="NonParametricGeometry"){if(s.data.groups&&s.data.groups?.forEach(c=>c.materialIndex=Math.max(c.materialIndex??0,0)),l.geometry=new tC().parse(s),l.geometry.groups.length===0){let c=l.geometry;c.addGroup(0,Math.max(c.getIndex()?.count??0,c.getAttribute("position").count),0)}}else{if(s.type==="SubdivGeometry"){let c=new Fi(s,i);return c.data=t,c}if(s.type==="TextGeometry"||s.type==="InputGeometry"){let c=sN(s.type);if(c)return c.create(s,e);Vn("text",`a ${s.type}`);let h=Ni.createFromState(Pg.defaultData(),100,100);return m1({...s,shape:h,type:"VectorGeometry"})}if(s.type==="UIGeometry")return Jb.create({parameters:{width:s.width,height:s.height,cornerRadius:s.cornerRadius,cornerType:s.cornerType}})}try{o=m1(l)}catch(c){console.error(c),console.error(`Error generating geometry with inputs: ${l}`);let h=Ni.createFromState(Pg.defaultData(),100,100);l.shape=h,l.type="VectorGeometry",o=m1(l)}return o}var mk,M4,OA,ex=F(()=>{Yt(),et(),fk(),ke(),tb(),yh(),Sp(),mk=["font"]}),x$=F(()=>{ex(),M4=class{constructor(){this.objects=new Map,this.unreachable=new Set}getCached(t){return this.objects.get(t)}get size(){return this.objects.size}get(t,e,i){let n=this.objects.get(t);return n===void 0?(n=this.createObject(t,e,i),this.objects.set(t,n)):n.isShared=!0,n}forceDelete(t){let e=this.objects.get(t);e&&(this.disposeObject(e),this.objects.delete(t))}adopt(t,e){this.objects.set(t,e)}mutateIfUnique(t,e){let i=this.objects.get(t);if(i&&i.isShared!==!0)return this.objects.delete(t),this.objects.set(e,i),i}startGc(){this.unreachable=new Set(this.objects.keys())}markAsReachable(t,e){e===this.objects.get(t)&&this.unreachable.delete(t)}endGc(){this.unreachable.forEach(t=>{this.disposeObject(this.objects.get(t)),this.objects.delete(t)}),this.unreachable.clear()}dispose(){this.objects.forEach(t=>{this.disposeObject(t)}),this.objects.clear()}},OA=class extends M4{constructor(t){super(),this.flatShading=t}disposeObject(t){t.dispose()}createObject(t,e,i){let n=Ql(t,e,this.flatShading,i);return n.computeBoundingSphere(),n}}});function eb(){return ix}function gk(){if(ix==="webgpu"){if(T4!==void 0)return T4;BA||(BA=!0,console.warn('[spe] Material backend is "webgpu" but no TSL material factory is registered \u2014 import spe/src/renderer/webgpu before creating materials. Falling back to WebGL materials.'))}if(LA===void 0)throw new Error('[spe] Classic (WebGL) materials are not available in this build \u2014 it was compiled WebGPU-only. Re-export the scene with renderer "Both" or "WebGL 2", or load the full runtime.');return LA}function vk(t,e){return gk().createRootMaterial(t,e)}function E4(t,e,i){return gk().createSharedMaterial(t,e,i)}function A4(t){return t.getLayersOfType===void 0&&Object.assign(t,{layers:[],getLayersOfType:()=>[],hasAO:!1,assetsLoaded:()=>!0}),t}function yk(){return w$}var ix,T4,LA,BA,UA,w$,zA,_k,bh=F(()=>{ix="webgl",BA=!1}),S$=F(()=>{_k={markNeedsUpdateRendererDirty:()=>{}}});function Pc(t,e){let i=0;if(!t.layers||t.layers.length===0)return!1;let n=t.layers?.find(r=>r.data.type==="light");if(n){let r=n.data,s=Number(e.getVariable(r.alphaOverride));if((typeof r.alphaOverride=="string"?s/100:r.alphaOverride)<1)return!0}for(let r of t.layers){if(r.data.type!=="displace"&&r.data.isMask)return!0;if(r.data.type!=="displace"&&"alpha"in r.data&&r.data.type!=="light"&&r.data.type!=="fresnel"&&r.data.type!=="cavity"&&r.data.type!=="dust"&&r.data.type!=="texture"&&r.data.type!=="matcap"&&r.data.type!=="rainbow"&&r.data.type!=="outline"&&r.data.type!=="pattern"){let s=r.data.visible?r.data.alpha:0;if(typeof s=="string"&&(s=Math.max(0,Math.min(1,Number(e.getVariable(s)??100)/100))),s===1&&r.data.type==="depth"||r.data.type==="gradient"){for(let a of r.data.colors)if(a[3]<1){s=a[3];break}}else if(s===1&&r.data.type==="noise"){let a=e.color(r.data.colorA).a,o=e.color(r.data.colorB).a,l=e.color(r.data.colorC).a,c=e.color(r.data.colorD).a,h=Math.min(a,Math.min(o,Math.min(l,c)));h<1&&(s=h)}i+=(1-i)*s}}return i<1}var ZC=F(()=>{});function pp(t){return typeof t=="string"||typeof t=="number"&&t!==0}var uh,qt,nx,bk,C4,P4,ys,nl=F(()=>{uh=(t,e,i)=>Math.max(0,Math.min(1,Number(e.getVariable(typeof t=="number"?100*t:t,i)??100)/100))??1,qt=(t,e,i)=>typeof t=="number"?t:e.getVariable(t,i),nx={noise:["noiseType"],texture:["projection","axis","projectionAxis","side"],video:["projection","axis","projectionAxis","side"],displace:["noiseType"],light:["roughnessMap","bumpMap","roughnessMapChannel","metalnessMap","metalnessMapChannel","normalMap","aoMap","aoMapChannel","emissiveMap"],depth:["smooth","isWorldSpace","gradientType","isVector"],pattern:["style","projection","axis"],reflection:["tracingMode","mirror"]},bk={depth:["colors"],gradient:["colors","steps"],toon:["colors","steps"]}}),Mp=F(()=>{et(),Xg(),C4=class extends $b(_i){},P4=t=>t.type==="Mesh",ys=class extends C4{constructor(t){super(),this.object=t,this.isClone=!0,this.matrixAutoUpdate=!1,this.hasNonUniformScale=t.hasNonUniformScale}raycast(t,e){}expand(){let t=0,e=this.object.entityChildren(t);for(;e;){let i=this.children[t];i?.object!==e&&(i&&this.remove(i),i=new ys(e),this.add(i),this.children.splice(t,0,this.children.pop()),i.matrixWorldNeedsUpdate=!0,i.matrixAutoUpdate=!1,i.matrix=e.matrix,i.hiddenMatrix=e.hiddenMatrix,i.pivotMatrix=e.pivotMatrix),i.expand(),t+=1,e=this.object.entityChildren(t)}for(;this.children.length>t;)this.remove(this.children[t]);this.pivotMatrix=this.object.pivotMatrix}get visible(){let t=this.object.cloner;return(t===void 0||this.parent!==t||!t.instancingActive&&!t.insideBoolean)&&(this.playModeVisible!==void 0?this.playModeVisible:this.object.visible||this.object.dataPatched.visible&&this.object.dataPatched.cloner?.hideBase===!0)}set visible(t){}get castShadow(){return this.object.castShadow}set castShadow(t){}get receiveShadow(){return this.object.receiveShadow}set receiveShadow(t){}get isMesh(){return P4(this.object)}get isLight(){return this.object.isLight}get layers(){return this.object.layers}set layers(t){}get isCamera(){return!1}get geometry(){if(this.object.geometry)return this.object.geometry}get material(){if(this.object.material)return this.object.material}get morphTargetInfluences(){if(this.object.morphTargetInfluences)return this.object.morphTargetInfluences}set morphTargetInfluences(t){}}});function D4(){return KC}var KC,QC,JC=F(()=>{KC=null,QC=null});function FA(t){return"variable_"+t}var jS,GS,HS,R4,WS,I4,O4,ib,t3=F(()=>{Yt(),EN(),CN(),NC(),ya(),kC(),jC(),x$(),bh(),TN(),S$(),ZC(),nl(),Wr(),Mp(),Ye(),et(),JC(),ke(),jS=new At,GS=new C,HS=new $t,R4=new C,WS=new Ei,I4=class extends SN{constructor(t){super(),this.shared=t}create(t){return new FC(t,this.shared)}},(ib=O4=class{constructor(t,e={},i=!0,n=!1){if(this.data=t,this.needsJitter=i,this.enableLocalStorageForPersistentVariables=n,this.geometryCache=new OA(!0),this.geometryCache2=new OA(!1),this.imageHolderCache=new I4(this),this.thisContext={scene:_k,shared:this},this.deletedImage=new qo(eA.emptyImage,this),this.deletedVideo=new qo(R_.defaultVideo,this),this.materials={},this.images={},this.uiBuffers={},this.videos={},this.colors={},this.audios={},this.particles={},this.fonts={},this.variables={},this.userAPIs={},this.userWebhooks={},this.mouseProperty=null,this.raycastProperty=null,this.requestRender=()=>{this._requestRender&&this._requestRender()},this.transientGeometryKeys=new WeakSet,e.images)for(let[r,s]of Object.entries(e.images))this.addImage(r,s);if(e.videos)for(let[r,s]of Object.entries(e.videos))this.addVideo(r,s);if(e.audios)for(let[r,s]of Object.entries(e.audios))this.addAudio(r,s);if(e.particles)for(let[r,s]of Object.entries(e.particles))this.addParticle(r,s);this.reset(t)}get deletedMaterial(){return this._deletedMaterial??(this._deletedMaterial=E4(ki.defaultTwoLayerData("phong"),this.thisContext,"")),this._deletedMaterial}setRequestRender(t){this._requestRender=t}getImageLoadPromises(){return Object.values(this.images).map(t=>t.loadPromise)}setEntityOpContext(t){this.entityOpContext=t}reset(t,e=!1,i=!1){this.data=t,this.resetLib(t.lib);for(let{id:n,data:r}of t.variables)this.addVariableHolder(n,r),e&&this.updateVariableHolder(n,r);for(let[n,r]of Object.entries(t.userAPIs??{}))this.addUserAPI(n,r);for(let[n,r]of Object.entries(t.userWebhooks??{}))this.addUserWebhook(n,r);if(!i){for(let[n,r]of Object.entries(t.images))this.addImage(n,r);for(let[n,r]of Object.entries(t.videos))this.addVideo(n,r)}for(let[n,r]of Object.entries(t.colors))this.addColor(n,r);for(let[n,r]of Object.entries(t.lib.materials))this.addMaterial(n,r.asset);for(let[n,r]of Object.entries(t.materials))this.addMaterial(n,r);for(let[n,r]of Object.entries(t.audios))this.addAudio(n,r);for(let[n,r]of Object.entries(t.particles))this.addParticle(n,r);for(let[n,r]of Object.entries(t.fonts))this.addFont(n,r)}addMaterial(t,e){if(e.layers===void 0&&(e={...e,layers:ki.defaultTwoLayerData("phong").layers}),this.materials[t]){let i=this.materials[t];i.reset(e,this.thisContext),i.dispose()}else{let i=E4(e,this.thisContext,t);this.materials[t]=i}}deleteMaterial(t){this.materials[t]&&(this.materials[t].nodeMaterialDispose(),delete this.materials[t])}getMaterial(t){return this.materials[t]}getMaterialOrDeletedPlaceholder(t){return this.materials[t]??this.deletedMaterial}material(t){return typeof t=="string"?this.getMaterialOrDeletedPlaceholder(t):t==null?(console.error("material is undefined or null"),this.deletedMaterial):(t.layers===void 0&&(t={...t,layers:ki.defaultTwoLayerData("phong").layers}),vk(t,this.thisContext))}getMaterials(){return this.materials}addImage(t,e){return this.images[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.images[t].updateSrc(e.data),!0):(this.images[t]=new qo(e,this),!1)}deleteImage(t){let e=this.images[t];e&&(e.dispose(),delete this.images[t])}getDefaultImage(){return this.images.image_0}getImage(t){return this.images[t]??this.deletedImage}image(t){return typeof t=="string"?this.getImage(t):this.imageHolderCache.load(t)}addUIBuffer(t,e){return this.uiBuffers[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.uiBuffers[t].updateSrc(e),!0):(this.uiBuffers[t]=new qo(e,this),!1)}uiBuffer(t){return this.uiBuffers[t]}addVideo(t,e){return this.videos[t]?(this.videos[t].updateSrc(e.data),!0):(this.videos[t]=new qo(e,this),!1)}deleteVideo(t){let e=this.videos[t];e&&(e.dispose(),delete this.videos[t])}getVideo(t){return this.videos[t]??this.deletedVideo}video(t){return typeof t=="string"?this.getVideo(t):this.imageHolderCache.load(t)}addColor(t,e){return this.colors[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),"a"in e?this.colors[t].setRGBA(e.r,e.g,e.b,e.a):this.colors[t].setRGBA(e.r,e.g,e.b,1),!0):(this.colors[t]=new Bg(e.r,e.g,e.b,"a"in e?e.a:1),!1)}updateColor(t,e){if(this.colors[t]){this.onColorOrImageUpdate&&this.onColorOrImageUpdate();let i=this.colors[t];return this.colors[t].r=e.r??i.r,this.colors[t].g=e.g??i.g,this.colors[t].b=e.b??i.b,this.colors[t].a=e.a??i.a,!0}return!1}deleteColor(t){this.colors[t]&&delete this.colors[t]}getColor(t){return this.colors[t]}getColorNames(){return Object.values(this.data.colors).map(t=>t.name)}getColorByName(t){for(let e in this.data.colors)if(this.data.colors[e].name===t)return{color:this.colors[e],id:e}}color(t){let e;if(typeof t!="string")return new mn(t.r,t.g,t.b,"a"in t?t.a:1);{let i=this.getColor(t);i?e=i:(console.warn("Tried to create color layer params with a color key that does not exist in the assets manager"),e=new mn(0,0,0,0))}return e}addAudio(t,e){this.audios[t]=e}getAudio(t){let e=this.audios[t];if(e instanceof Bu)return e;{let i=new Bu({src:e.data});return this.audios[t]=i,i}}addParticle(t,e){this.particles[t]=e}getParticle(t){return this.particles[t]}deleteParticle(t){this.particles[t]&&delete this.particles[t]}deleteAudio(t){let e=this.audios[t];e&&(e instanceof Bu&&e.dispose(),delete this.audios[t])}addFont(t,e){let i=VC;i!==null?(this.fonts[t]=new i(e),this.fonts[t].loadingPromise.then(()=>this.requestRender())):Vn("text","a font asset")}getFont(t){return this.fonts[t]}deleteFont(t){this.fonts[t]&&delete this.fonts[t]}dispose(){Object.keys(this.materials).forEach(t=>this.deleteMaterial(t)),this._requestRender=void 0,Object.values(this.audios).forEach(t=>{t instanceof Bu&&t.dispose()}),this.audios={},this.particles={},this.geometryCache.dispose(),this.geometryCache2.dispose()}addVariableHolder(t,e){if(this.variables[t]===void 0){let i=e.value;if(this.enableLocalStorageForPersistentVariables&&e.persistent){let n=localStorage.getItem(FA(t));i=n!==null?JSON.parse(n):e.value}return this.variables[t]={value:i,locations:[],persistent:e.persistent},"dynamicVariableType"in e&&(this.variables[t].dynamicVariablePlayState="Playing",this.variables[t].dynamicVariableToggleIsForward=void 0),!0}return this.variables[t].value=e.value,!1}resetDynamicVariablePlayState(){for(let t in this.variables)this.variables[t].dynamicVariablePlayState!==void 0&&(this.variables[t].dynamicVariablePlayState="Playing",this.variables[t].dynamicVariableToggleIsForward=void 0)}updateVariableHolder(t,e){this.updateVariable(t,e.value)}updateVariable(t,e){if(this.variables[t]===void 0)return!1;this.variables[t].value=e,this.enableLocalStorageForPersistentVariables&&this.variables[t].persistent&&localStorage.setItem(FA(t),JSON.stringify(e));let i=e;for(;typeof i=="string";)i=this.variables[i].value;let n=this.entityOpContext.scene,r=!1;for(let s=this.variables[t].locations.length-1;s>=0;s--){let a=this.variables[t].locations[s];if(a[0]==="material"){let o=a[1],l=i,c={scene:n,shared:this},h=a.slice(2);n.traverseMaterial(u=>{let p=u.root??u;p.uuid===o&&p.onVariableUpdate(h,l,c)});let d=this.materials[o];d&&d.onVariableUpdate(h,l,c)}else{let o=n.find(a[0]);if(o===void 0){this.variables[t].locations.splice(s,1);continue}if(r=!0,a[1]!=="geometry"&&a[1]!=="particles"){for(let l=1;l<a.length-1;l++)o=o[a[l]];a[1]==="rotation"?o[a[a.length-1]]=i*Ot.DEG2RAD:o[a[a.length-1]]=i}if(o=n.find(a[0]),o.type==="ParticleEmitter"&&o.updateVariableState(i,a),Be.is(o))if(a[1]==="position"||a[1]==="rotation"||a[1]==="scale")o.onVariableUpdate();else if(a[1]==="geometry"){let l=o;o.component&&(l=o.component);let c=l.dataPatched;l.chooseGeoemtryCache(this).forceDelete(c.geometry),l.createGeometryDelayed(this.entityOpContext),l.onVariableUpdate(!0),l.invalidateDownstreamBooleanData(),l.instances.forEach(h=>{let d=h.dataPatched;h.chooseGeoemtryCache(this).forceDelete(d.geometry),h.createGeometryDelayed(this.entityOpContext),h.onVariableUpdate(!0),h.invalidateDownstreamBooleanData()})}else a[1]==="morphTargetInfluences"&&o.updateMorphInfluences(a[2],i)}}return r&&n.markShadowsDirty(),this.requestRender(),!0}updateEntityGeometryParams(t,e){let i=t;if(i.component&&(i=i.component),typeof i.chooseGeoemtryCache!="function")return!1;let n=i.dataPatched,r=n?.geometry;if(!r||typeof r.type!="string"||r.type==="VectorGeometry"||r.type==="PathGeometry")return!1;let s=c=>c.toLowerCase().replace(/[\s_.-]+/g,""),a=new Map;for(let c of Object.keys(r))a.set(s(c),c);let o={};for(let[c,h]of Object.entries(e??{})){let d=a.get(s(c));if(d===void 0||d==="type"||d==="font"||d==="shape"||d==="path"||d==="data")continue;if(d==="text"){(typeof h=="string"||typeof h=="number")&&(o[d]={textValue:String(h)});continue}let u=r[d];typeof h=="number"&&isFinite(h)&&(typeof u=="number"||typeof u=="string")&&(o[d]=h)}if(Object.keys(o).length===0)return!1;let l={...r,...o};return i.dataPatched={...n,geometry:l},this.transientGeometryKeys.has(r)&&i.chooseGeoemtryCache(this).forceDelete(n.geometry),this.transientGeometryKeys.add(l),i.createGeometryDelayed(this.entityOpContext),i.onVariableUpdate(!0),i.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}resetEntityGeometryParams(t){let e=t;if(e.component&&(e=e.component),typeof e.chooseGeoemtryCache!="function")return!1;let i=e.dataPatched?.geometry;return!(!i||!this.transientGeometryKeys.has(i)||(e.dataPatched=e.data,e.chooseGeoemtryCache(this).forceDelete(i),e.createGeometryDelayed(this.entityOpContext),e.onVariableUpdate(!0),e.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),0))}updateEntityGeometryVertices(t,e){let i=t;if(i.component&&(i=i.component),typeof i.chooseGeoemtryCache!="function")return!1;let n=i.dataPatched,r=n?.geometry;if(!r||r.type!=="NonParametricGeometry")return!1;let s=e?.vertices;if(s===void 0||typeof s.length!="number"||s.length<9||s.length%3!=0||s.length/3>O4.MAX_TRANSIENT_VERTICES)return!1;let a,o,l,c=s instanceof Float32Array?s:Float32Array.from(s),h=c.length/3;if(e.normals!==void 0){if(e.normals.length!==c.length)return!1;a=e.normals instanceof Float32Array?e.normals:Float32Array.from(e.normals)}if(e.uvs!==void 0){if(e.uvs.length!==2*h)return!1;o=e.uvs instanceof Float32Array?e.uvs:Float32Array.from(e.uvs)}if(e.indices!==void 0){let x=h>65535?Uint32Array.from(e.indices):Uint16Array.from(e.indices);if(x.length===0||x.length%3!=0)return!1;for(let w=0;w<x.length;w++)if(x[w]>=h)return!1;l={array:x,itemSize:1,type:x.constructor.name,normalized:!1}}else{let x=r.data,w=x?.index;if(w?.array?.length){if(h<(x?.attributes?.position?.array?.length??0)/3){let S=w.array;for(let A=0;A<S.length;A++)if(S[A]>=h)return!1}l=w}}let d=1/0,u=1/0,p=1/0,f=-1/0,g=-1/0,m=-1/0;for(let x=0;x<c.length;x+=3){let w=c[x],S=c[x+1],A=c[x+2];w<d&&(d=w),w>f&&(f=w),S<u&&(u=S),S>g&&(g=S),A<p&&(p=A),A>m&&(m=A)}let y=(x,w)=>({array:x,itemSize:w,type:"Float32Array",normalized:!1}),v={position:y(c,3)};a&&(v.normal=y(a,3)),o&&(v.uv=y(o,2));let _={...r,width:f-d,height:g-u,depth:m-p,data:{attributes:v,...l?{index:l}:{}}},b=this.transientGeometryKeys.has(r);return i.dataPatched={...n,geometry:_},this.transientGeometryKeys.add(_),i.applyTransientGeometryData(this.entityOpContext,b),i.onVariableUpdate(!0),i.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}setEntityInstanceTransforms(t,e){let i=t;i.component&&(i=i.component);let n=i.cloner;if(n===void 0)return-1;let r=n.children,s=Math.PI/180,a=!1;if(e===null)for(let o of r)o.transformOverride!==void 0&&(o.transformOverride=void 0,a=!0);else{if(!Array.isArray(e))return r.length;{let o=Math.min(e.length,r.length);for(let l=0;l<o;l++){let c=e[l],h=r[l];if(c==null){h.transformOverride!==void 0&&(h.transformOverride=void 0,a=!0);continue}let d=h.transformOverride??{position:[h.position.x,h.position.y,h.position.z],rotation:[h.rotation.x,h.rotation.y,h.rotation.z],scale:[h.scale.x,h.scale.y,h.scale.z]};c.position&&(typeof c.position.x=="number"&&(d.position[0]=c.position.x),typeof c.position.y=="number"&&(d.position[1]=c.position.y),typeof c.position.z=="number"&&(d.position[2]=c.position.z)),c.rotation&&(typeof c.rotation.x=="number"&&(d.rotation[0]=c.rotation.x*s),typeof c.rotation.y=="number"&&(d.rotation[1]=c.rotation.y*s),typeof c.rotation.z=="number"&&(d.rotation[2]=c.rotation.z*s)),c.scale&&(typeof c.scale.x=="number"&&(d.scale[0]=c.scale.x),typeof c.scale.y=="number"&&(d.scale[1]=c.scale.y),typeof c.scale.z=="number"&&(d.scale[2]=c.scale.z)),h.transformOverride=d,h.position.fromArray(d.position),h.rotation.fromArray(d.rotation),h.scale.fromArray(d.scale),h.updateMatrix(),h.hasNonUniformScale&&(h.updateMatrixWorld(),h.updateMatrixWorldRigid())}}}return a?n.update(this.entityOpContext):n.syncInstanceMatrices(),n.invalidateTransform(i),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),r.length}spawnRuntimeClone(t,e={}){if(typeof t.entityChildren!="function")return;let i=t.parent;if(i===null)return;let n=new ys(t);n.playModeVisible=e.visible!==!1,n.expand(),typeof e.name=="string"&&(n.name=e.name);let r=Math.PI/180;return n.position.copy(t.position),n.rotation.copy(t.rotation),n.scale.copy(t.scale),n.hiddenMatrix.copy(t.hiddenMatrix),e.position&&(typeof e.position.x=="number"&&(n.position.x=e.position.x),typeof e.position.y=="number"&&(n.position.y=e.position.y),typeof e.position.z=="number"&&(n.position.z=e.position.z)),e.rotation&&(typeof e.rotation.x=="number"&&(n.rotation.x=e.rotation.x*r),typeof e.rotation.y=="number"&&(n.rotation.y=e.rotation.y*r),typeof e.rotation.z=="number"&&(n.rotation.z=e.rotation.z*r)),e.scale&&(typeof e.scale.x=="number"&&(n.scale.x=e.scale.x),typeof e.scale.y=="number"&&(n.scale.y=e.scale.y),typeof e.scale.z=="number"&&(n.scale.z=e.scale.z)),n.updateMatrix(),i.add(n),n.updateWorldMatrix(!0,!0),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),n}destroyRuntimeClone(t){t.removeFromParent(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender()}updateEntityMaterialParams(t,e){let i=t.material;if(!i)return!1;let n=[];for(let c of Array.isArray(i)?i:[i]){let h=c.root??c;h&&Array.isArray(h.layers)&&h.data&&!n.includes(h)&&n.push(h)}if(n.length===0)return!1;let r={scene:this.entityOpContext.scene,shared:this},s=c=>c.toLowerCase().replace(/[\s_.-]+/g,""),a=c=>{if(typeof c=="string"){let h=new mn(1,1,1,1);try{h.set(c)}catch{return null}return{r:h.r,g:h.g,b:h.b,a:void 0}}if(c&&typeof c=="object"&&"r"in c){let h=c;if([h.r,h.g,h.b].some(u=>typeof u!="number"||!isFinite(u)))return null;let d=Math.max(h.r,h.g,h.b)>1?1/255:1;return{r:h.r*d,g:h.g*d,b:h.b*d,a:typeof h.a=="number"?Math.max(0,Math.min(h.a,1)):void 0}}return null},o=(c,h,d)=>{if(!c.hasValue(h))return!1;let u=c.getValue(h);if(!u||typeof u!="object"||!u.isColor)return!1;let p=d.a??(typeof u.a=="number"?u.a:1);return u instanceof Bg?c.setValue(h,new mn(d.r,d.g,d.b,p)):typeof u.setRGBA=="function"?u.setRGBA(d.r,d.g,d.b,p):u.setRGB(d.r,d.g,d.b),!0},l=!1;for(let c of n){let h=c.data.layers??[],d=u=>c.layers.find(p=>p.uuid===u);if(e.color!==void 0){let u=a(e.color),p=h.find(g=>g.data.type==="color"),f=p&&d(p.id);if(u&&f&&o(f,"color",u)&&(l=!0,u.a!==void 0)){let g=u.a<1||Pc(c.data,this);c.setTransparent?c.setTransparent(g,r.scene):c.transparent=g}}typeof e.alpha=="number"&&isFinite(e.alpha)&&(c.onVariableUpdate?.(["alphaOverride"],Math.max(0,Math.min(e.alpha,100)),r),l=!0);for(let u of e.layers??[]){if(!u||typeof u!="object")continue;let p=typeof u.id=="string"?h.find(y=>y.id===u.id):typeof u.index=="number"?h[u.index]:typeof u.type=="string"?h.find(y=>y.data.type===u.type):void 0,f=p&&d(p.id);if(!p||!f)continue;let g=nx[p.data.type]??[],m=Object.keys(p.data);for(let[y,v]of Object.entries(u)){if(y==="id"||y==="index"||y==="type")continue;let _=m.find(x=>x===y)??m.find(x=>s(x)===s(y))??y;if(g.includes(_))continue;let b=a(v);if(b&&o(f,_,b))l=!0;else if(typeof v=="number"&&isFinite(v))c.onVariableUpdate?.(["layer",p.id,_],v,r),l=!0;else if(Array.isArray(v)&&v.length<=3&&v.every(x=>typeof x=="number"&&isFinite(x))){let x=["x","y","z"];v.forEach((w,S)=>{c.onVariableUpdate?.(["layer",p.id,_,x[S]],w,r)}),l=!0}}}}return l&&this.requestRender(),l}deleteVariable(t){this.variables[t]&&delete this.variables[t]}getVariable(t,e){if(Array.isArray(t)){if(t[0]==="mouse")return this.mouseProperty?.[t[1]]??0;if(t[0]==="raycast")return this.raycastProperty?.[t[1]]??0;let i=this.entityOpContext.scene.find(t[0]);if(t[1]==="width"||t[1]==="height"||t[1]==="depth")return i.geometry.userData.parameters[t[1]];if((t[1]==="position"||t[1]==="rotation")&&t.length>2&&i?.getPhysicsLocalMatrix?.(jS))return jS.decompose(GS,HS,R4),t[1]==="position"?GS[t[2]]:(WS.setFromQuaternion(HS,i.rotation.order),WS[t[2]]*Ot.RAD2DEG);for(let n=1;n<t.length;n++)i=i[t[n]];return t[1]==="rotation"&&(i*=Ot.RAD2DEG),i}for(let i in this.variables){if(e===void 0)break;let n=this.variables[i],r=n.locations?.findIndex(s=>kn.equal(s,e));r!==void 0&&r!==-1&&n.locations.splice(r,1)}if(typeof t=="string"){let i=t,n=t;do{if(n=i,this.variables[i]===void 0)break;let r=this.variables[i].value;e&&this.variables[n]!==void 0&&this.variables[n].locations.push(e),i=r}while(typeof i=="string");return i}return t}getVariables(){return this.variables}getVariablesNames(){return this.data.variables.map(t=>t.data.name)}getVariableByName(t){for(let e of this.data.variables)if(e.data.name===t)return{variable:e.data,id:e.id}}getDynamicVariablePlayState(t){return this.variables[t]?.dynamicVariablePlayState}setDynamicVariablePlayState(t,e){this.variables[t]!==void 0&&(this.variables[t].dynamicVariablePlayState=e)}getDynamicVariableToggleIsForward(t){return this.variables[t]?.dynamicVariableToggleIsForward}setDynamicVariableToggleIsForward(t,e){this.variables[t]!==void 0&&(this.variables[t].dynamicVariableToggleIsForward=e)}resetLib(t){for(let[e,i]of Object.entries(t.images))this.addImage(e,i.asset);for(let[e,i]of Object.entries(t.audios))this.addAudio(e,i.asset);for(let[e,i]of Object.entries(t.particles))this.addParticle(e,i.asset);for(let[e,i]of Object.entries(t.colors))this.addColor(e,i.asset);for(let[e,i]of Object.entries(t.fonts))this.addFont(e,i.asset);for(let[e,i]of Object.entries(t.videos))this.addVideo(e,i.asset);for(let[e,i]of Object.entries(t.variables))this.addVariableHolder(e,i.asset)}updateLibByOp(t,e){t.path[0]==="images"?t.path.length===1&&t.type===1?this.addImage(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteImage(t.id):t.path[0]==="videos"?t.path.length===1&&t.type===1?this.addVideo(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteVideo(t.id):t.path[0]==="audios"?t.path.length===1&&t.type===1?this.addAudio(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteAudio(t.id):t.path[0]==="particles"?t.path.length===1&&t.type===1?this.addParticle(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteParticle(t.id):t.path[0]==="colors"?t.path.length===1&&t.type===1?this.addColor(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteColor(t.id):t.path[0]==="materials"?t.path.length===1&&t.type===1?this.addMaterial(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteMaterial(t.id):t.path[0]==="fonts"?t.path.length===1&&t.type===1?this.addFont(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteFont(t.id):t.path[0]==="variables"?t.path.length===1&&t.type===1?this.addVariableHolder(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteVariable(t.id):t.path[0]==="components"&&e.updateByLibOp(t,this)}updateByOp(t,e,i){if(this.data=e,t.path[0]==="images")t.path.length===2&&t.type===0?t.props.data&&this.getImage(t.path[1]).updateSrc(t.props.data):t.path.length===1&&t.type===1?this.addImage(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteImage(t.id);else if(t.path[0]==="videos")t.path.length===2&&t.type===0?t.props.data&&this.getVideo(t.path[1]).updateSrc(t.props.data):t.path.length===1&&t.type===1?this.addVideo(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteVideo(t.id);else if(t.path[0]==="audios")t.path.length===2&&t.type===0?t.props.data&&this.addAudio(t.path[1],e.audios[t.path[1]]):t.path.length===1&&t.type===1?this.addAudio(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteAudio(t.id);else if(t.path[0]==="particles")t.path.length===2&&t.type===0?t.props.data&&this.addParticle(t.path[1],e.particles[t.path[1]]):t.path.length===1&&t.type===1?this.addParticle(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteParticle(t.id);else if(t.path[0]==="colors")t.path.length===2&&t.type===0?this.updateColor(t.path[1],t.props):t.path.length===1&&t.type===1?this.addColor(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteColor(t.id);else if(t.path[0]==="materials")t.path.length===1&&t.type===1?this.addMaterial(t.id,t.data):t.path.length===1&&t.type===2?this.deleteMaterial(t.id):t.path.length>1&&this.getMaterial(t.path[1]).updateByOp(Jn.drop(t,2),e.materials[t.path[1]],{shared:this,scene:i});else if(t.path[0]==="fonts")t.path.length===2&&t.type===0?this.updateFont(t.path[1],t,i):t.path.length===1&&t.type===1?this.addFont(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteFont(t.id);else if(t.path[0]==="variables")t.path.length===2&&t.type===0?"value"in t.props?this.updateVariable(t.path[1],t.props.value):"persistent"in t.props&&(this.variables[t.path[1]].persistent=t.props.persistent):t.path.length===1&&t.type===4?this.addVariableHolder(t.id,t.data):t.path.length===1&&t.type===5&&this.deleteVariable(t.id);else if(t.path[0]==="userAPIs"){if(t.path.length===1&&t.type===1)this.addUserAPI(t.id,t.data);else if(t.path.length===1&&t.type===2)this.deleteUserAPI(t.id);else if(typeof t.path[1]=="string"){let n=e.userAPIs[t.path[1]];if(n){let r=t.type===0&&t.props.debounce===void 0,s=this.getUserAPI(t.path[1]);s!==void 0&&s===this.openAIRealtime?s.update(n):s?.update(n,this,r)}}}else if(t.path[0]==="userWebhooks"){if(t.path.length===1&&t.type===1)this.addUserWebhook(t.id,t.data);else if(t.path.length===1&&t.type===2)this.deleteUserWebhook(t.id);else if(typeof t.path[1]=="string"){let n=e.userWebhooks[t.path[1]];n&&this.getUserWebhook(t.path[1])?.update(n)}}else t.path[0]==="lib"&&this.updateLibByOp(Jn.drop(t,1),i)}updateFont(t,e,i){if(e.props.url){let n=this.getFont(t),r={...this.data.fonts[t],url:e.props.url};n.update(r),n.loadingPromise.then(()=>this.requestRender()),i.updateFont(t,this)}}addUserAPI(t,e){if(this.userAPIs[t])return this.userAPIs[t].update(e,this),!0;if(this.openAIRealtime?.id===t)return this.openAIRealtime.update(e),!0;if(e.integration?.type==="VoiceAssistant"){let i=QC;return i===null?(Vn("ai-assistant","a voice-assistant integration"),!1):(this.openAIRealtime=i(e,t,this),!1)}{let i=D4();return i===null?(Vn("api-services","a user API integration"),!1):(this.userAPIs[t]=i.createUserAPI(t,e,this),!1)}}getUserAPI(t){return this.openAIRealtime?.id===t?this.openAIRealtime:this.userAPIs[t]}getUserAPIs(){return this.userAPIs}deleteUserAPI(t){let e=this.userAPIs[t];e&&(e.dispose(),delete this.userAPIs[t])}addUserWebhook(t,e){if(this.userWebhooks[t])return this.userWebhooks[t].update(e),!0;{let i=D4();return i===null?(Vn("api-services","a user webhook"),!1):(this.userWebhooks[t]=i.createUserWebhook(t,e),!1)}}getUserWebhook(t){return this.userWebhooks[t]}getUserWebhooks(){return this.userWebhooks}deleteUserWebhook(t){let e=this.userWebhooks[t];e&&(e.dispose(),delete this.userWebhooks[t])}get scene(){return this.entityOpContext.scene}}).MAX_TRANSIENT_VERTICES=6e4,new ib(Fs.emptyData())});function xk(t){return $_(t)||t?.isTSLNodeMaterial===!0}var Hr,qS,XS,$S,L4,YS,Ai,wk=F(()=>{zC()}),Qc=F(()=>{Yt(),Yn(),bh(),wk(),Ye(),ar(),Hr=class extends Xi{setMaterialOverride(t,e){this.materialOverride=A4(t),this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.materialOverride,this.layers.set(0),this.syncShapeBlendNodeLayer(),e.scene.markNeedsUpdateRendererDirty())}updateByPatchedOp(t,e,i){if(super.updateByPatchedOp(t,e,i),ri(t.path,["geometry"])&&this.syncShadowCatcher(i),function(n,r){let s=[];if(r.length!==n.length)return null;{let a=0;for(;a<n.length;){if(r[a]==="*")s.push(n[a]);else if(n[a]!==r[a])return null;a+=1}}return s}(t.path,["materials"])!==null&&t.type===0&&Array.isArray(this.material))for(let[n,r]of Object.entries(t.props)){let s=this.material[Number(n)],a=i.shared.material(r);a!==s&&Hr.disposeOneMaterial(s),this.material[Number(n)]=a}else if(ri(t.path,["material"])){let n=this.material;!Array.isArray(n)&&typeof n?.updateByOp=="function"&&"material"in e&&typeof e.material!="string"&&n.updateByOp(Jn.drop(t,1),e.material,i)}else if(ri(t.path,["materials","*"])&&Array.isArray(this.material)){let n=t.path[1];if("materials"in e&&n<this.material.length){let r=e.materials[n];typeof r!="string"&&this.material[n].updateByOp(Jn.drop(t,2),r,i)}}}get needsAO(){return this.material!==void 0&&(Array.isArray(this.material)?this.material[0]:this.material).hasAO}syncShapeBlendNodeLayer(){this.dataPatched.type==="Mesh"&&this.dataPatched.geometry.shapeBlendNode?this.layers.set(9):512&this.layers.mask&&this.layers.set(0)}updateState(t,e){super.updateState(t,e),t.castShadow!==void 0&&(this.castShadow=t.castShadow),t.receiveShadow!==void 0&&(this.receiveShadow=t.receiveShadow);let i,n=this.dataPatched;this.syncShapeBlendNodeLayer(),this.dataPatched.type==="Mesh"&&this.dataPatched.geometry.type==="ShapeBlendGeometry"&&(i={resolutionLevel:Math.min(8,this.dataPatched.geometry.resolutionLevel),useChildrenColors:this.dataPatched.geometry.useChildrenColors});let r=this.materialOverride!==void 0;!r&&t.geometry?.type!=="NonParametricGeometry"&&"material"in t&&t.material!==void 0&&(this.disposeMaterial(),this.material=e.shared.material(t.material).getFlavor(n.flatShading,n.side,n.wireframe,i),e.scene.markNeedsUpdateRendererDirty()),!r&&(t.geometry?.type==="NonParametricGeometry"||"materials"in t)&&("materials"in t&&t.materials!==void 0?(this.disposeMaterial(),this.material=t.materials.map(a=>e.shared.material(a).getFlavor(n.flatShading,n.side,n.wireframe)),e.scene.markNeedsUpdateRendererDirty()):"material"in t&&t.material!==void 0&&(this.disposeMaterial(),this.material=[e.shared.material(t.material).getFlavor(n.flatShading,n.side,n.wireframe)],e.scene.markNeedsUpdateRendererDirty()));let s=this.data;if(!r&&s.geometry?.type!=="NonParametricGeometry"&&"materials"in s&&s.materials!==void 0&&(this.disposeMaterial(),this.material=e.shared.material(s.materials[0]).getFlavor(n.flatShading,n.side,n.wireframe)),!r&&(t.flatShading!==void 0||t.wireframe!==void 0||t.side!==void 0))if(Array.isArray(this.material))for(let a=0;a<this.material.length;a++)this.material[a]=this.material[a].getFlavor(n.flatShading,n.side,n.wireframe);else this.material=this.material.getFlavor(n.flatShading,n.side,n.wireframe,i);this.syncShadowCatcher(e)}shadowCatcherActive(){let t=this.dataPatched,e=t.geometry?.type;return t.shadowCatcher===!0&&(e==="RectangleGeometry"||e==="PlaneGeometry")}syncShadowCatcher(t){let e=this.dataPatched;if(this.shadowCatcherActive()){if(this.shadowCatcherMaterial===void 0){let i=UA===void 0?null:A4(UA());if(i===null)return;this.shadowCatcherMaterial=i}this.shadowCatcherMaterial.side=e.side,this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.shadowCatcherMaterial,t.scene.markNeedsUpdateRendererDirty()),this.castShadow=!1,this.receiveShadow=!0,this.layers.set(0)}else this.shadowCatcherMaterial!==void 0&&this.material===this.shadowCatcherMaterial&&(this.materialOverride!==void 0?(this.material=this.materialOverride,t.scene.markNeedsUpdateRendererDirty()):"material"in e&&e.material!==void 0&&(this.material=t.shared.material(e.material).getFlavor(e.flatShading,e.side,e.wireframe),t.scene.markNeedsUpdateRendererDirty(),this.needsAO&&this.layers.enable(5)),this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow)}static disposeOneMaterial(t){var e;xk(t)&&!function(i){return i?.isClassicSharedMaterial===!0}(e=t)&&e?.isTSLSharedMaterial!==!0&&t.nodeMaterialDispose()}disposeMaterial(){this.material&&lF(this.material).forEach(t=>{Hr.disposeOneMaterial(t)})}dispose(){this.disposeMaterial(),this.shadowCatcherMaterial?.dispose(),super.dispose()}}}),qr=F(()=>{Yt(),Ye(),t3(),Qc(),et(),ex(),Sp(),uk(),qS=new C,XS=new ve,$S=new ve,L4=new C,YS=new At,Ai=class extends Hr{constructor(t,e,i){super(t,e),this.data=e,this.isSkinnedMesh=!1,this.localGeometry=void 0,e.bindMode&&e.bindMatrix&&(this.bindMode=e.bindMode,this.bindMatrix=new At().fromArray(e.bindMatrix),this.bindMatrixInverse=new At)}chooseGeoemtryCache(t){return t.geometryCache}supportsInPlaceGeometryUpdate(t){return t.isTextGeometry!==!0}markGeometryAsReachable(t){this.geometryCreateDeleyed instanceof Gt&&this.chooseGeoemtryCache(t).markAsReachable(this.dataPatched.geometry,this.geometryCreateDeleyed)}get builtSharedGeometry(){if(this.localGeometry===void 0)return this.geometryCreateDeleyed instanceof Gt?this.geometryCreateDeleyed:void 0}get geometry(){if(this.localGeometry!==void 0)return this.localGeometry;if(this.geometryCreateDeleyed instanceof ib){let t=this.geometryCreateDeleyed,e=this.chooseGeoemtryCache(t),i=this.dataPatched.geometry;this.geometryCreateDeleyed=e.get(i,t,this),this._geometryCacheKey=i}return this.geometryCreateDeleyed}set geometry(t){this.localGeometry=t}get is2DAndNoDepth(){let t=this.dataPatched.geometry;return B_.is2DParametricMesh(t.type)&&t.depth===0}get is2DType(){return B_.is2DParametricMesh(this.geometry.userData.type)}get isNonParametric(){return this.geometry.userData.type==="NonParametricGeometry"}updateByPatchedOp(t,e,i){super.updateByPatchedOp(t,e,i),ri(t.path,["geometry"])&&this.updateByPatchedOpGeometry(Jn.drop(t,1),e.geometry,i)}removeInteractionGeometry(t){this.localGeometry?.dispose(),this.localGeometry=void 0}get appliedGeometrySize(){let t=this.localGeometry?.userData;if(t!==void 0&&t.sxPrev!==void 0)return[t.sxPrev,t.syPrev,t.szPrev]}updateGeometryInteractions(t,e){this.invalidateDownstreamBooleanData();let i=this.data.geometry.type;if(i==="NonParametricGeometry"||i==="SubdivGeometry"){let n,r,s,a=t;if(this.localGeometry===void 0){let d={...this.data.geometry,...a};this.localGeometry=Ql(d,e,this.data.flatShading,this)}a.scaleBaked?[n,r,s]=a.scaleBaked:{width:n,height:r,depth:s}=a;let o=this.localGeometry.userData,l=typeof n=="number"?n:1,c=typeof r=="number"?r:1,h=typeof s=="number"?s:1;o.sxPrev!==void 0&&RA(this.localGeometry.attributes,l/o.sxPrev,c/o.syPrev,h/o.szPrev),o.sxPrev=l,o.syPrev=c,o.szPrev=h}else{let n=Ql({...this.data.geometry,...t},e,this.data.flatShading,this);this.localGeometry!==void 0&&this.supportsInPlaceGeometryUpdate(this.localGeometry)&&FS(this.localGeometry,n)?n.dispose():(this.localGeometry?.dispose(),this.localGeometry=n)}}refreshAttachedClonersInteractions(t){for(let e of this.attachedSurfaceCloners)e.update(t)}refreshAttachedCloners(t){for(let e of this.attachedSurfaceCloners)t.scene.addPendingUpdateCloner(e.object)}refreshAttachedPaths(t){for(let e of this.attachedPaths)t.scene.addPendingCommand(()=>e.updateShape())}createGeometryDelayed(t){this.geometryCreateDeleyed=t.shared,this.refreshAttachedCloners(t),this.refreshAttachedPaths(t)}updateByPatchedOpGeometry(t,e,i){let n=!1;if(t.type===0&&t.path.length===0&&Object.keys(t.props).includes("scaleBaked")&&this.geometryCreateDeleyed instanceof Fi&&this.chooseGeoemtryCache(i.shared).mutateIfUnique(this.geometryCreateDeleyed.data,e)===this.geometryCreateDeleyed&&(n=!0,this.geometryCreateDeleyed.mutateDirectlyScaleBaked(e,t.props.scaleBaked),this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)),!n&&t.type===0&&t.path.length===0&&pk(t.props)&&this.geometryCreateDeleyed instanceof Fi&&this.chooseGeoemtryCache(i.shared).mutateIfUnique(this.geometryCreateDeleyed.data,e)===this.geometryCreateDeleyed&&(n=!0,this.geometryCreateDeleyed.mutateDirectlySubdivisions(e),this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)),!n&&t.type===0&&t.path.length===0&&this.geometryCreateDeleyed instanceof Gt&&!(this.geometryCreateDeleyed instanceof Fi)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let r=i.shared,s=this.chooseGeoemtryCache(r),a=this.geometryCreateDeleyed;if(s.getCached(this._geometryCacheKey)===a&&a.isShared!==!0){let o=this.dataPatched.geometry,l=Ql(o,r,this.data.flatShading,this);FS(a,l)?(l.dispose(),a.computeBoundingSphere(),s.mutateIfUnique(this._geometryCacheKey,o)):(l.computeBoundingSphere(),s.forceDelete(this._geometryCacheKey),s.adopt(o,l),this.geometryCreateDeleyed=l),this._geometryCacheKey=o,n=!0,this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)}}n||(i.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(i)),this.syncShapeBlendNodeLayer(),this.resetBBoxNeedsUpdate(),this.invalidateDownstreamBooleanData()}updateGeometryOnStateUpdate(t,e){this.createGeometryDelayed(e)}applyTransientGeometryData(t,e){let i=t.shared,n=this.dataPatched.geometry;if(this.geometryCreateDeleyed instanceof Gt&&!(this.geometryCreateDeleyed instanceof Fi)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let r=this.chooseGeoemtryCache(i),s=this.geometryCreateDeleyed;if(r.getCached(this._geometryCacheKey)===s&&s.isShared!==!0){let a=Ql(n,i,this.data.flatShading,this);return FS(s,a)?(a.dispose(),s.computeBoundingSphere(),r.mutateIfUnique(this._geometryCacheKey,n)):(a.computeBoundingSphere(),r.forceDelete(this._geometryCacheKey),r.adopt(n,a),this.geometryCreateDeleyed=a),this._geometryCacheKey=n,this.refreshAttachedCloners(t),void this.refreshAttachedPaths(t)}}e&&this._geometryCacheKey!==void 0&&this.chooseGeoemtryCache(i).forceDelete(this._geometryCacheKey),t.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(t)}updateState(t,e){t.geometry!==void 0&&this.updateGeometryOnStateUpdate(t.geometry,e);let i=t.morphTargetInfluences;if(i){this.updateMorphTargets(),this.geometry.morphTargetsRelative=!0;for(let{data:{name:n,value:r}}of i)this.updateMorphInfluences(n,e.shared.getVariable(r,[this.uuid,"morphTargetInfluences",n]))}super.updateState(t,e)}updateMorphInfluences(t,e){if(this.morphTargetDictionary===void 0)return;let i=this.morphTargetDictionary[t];i!==void 0&&(this.morphTargetInfluences[i]=e)}updateGeometryGroupsIfNeeded(){Array.isArray(this.material)&&this.geometry.groups.length===0&&this.geometry.addGroup(0,Math.max(this.geometry.getIndex()?.count??0,this.geometry.getAttribute("position").count),0)}updateEntityBoxSize(t,e){let i=this.geometry.userData.parameters;this.is2DType?t.set(0,0,.5*i.depth):this.isNonParametric?(t.setScalar(0),this.geometry.boundingSphere&&t.copy(this.geometry.boundingSphere.center),e.set(i.width,i.height,i.depth??0).multiplyScalar(.5)):i.centerOffset?t.fromArray(i.centerOffset):t.setScalar(0),e.set(i.width,i.height,i.depth??0).multiplyScalar(.5)}updateMatrixWorld(t){super.updateMatrixWorld(t),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"&&this.bindMatrixInverse.copy(this.bindMatrix).invert()}bind(t,e){this.skeleton=t,this.isSkinnedMesh=!0,e===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(t){let e=new ve,i=this.geometry.attributes.skinWeight;for(let n=0,r=i.count;n<r;n++){e.fromBufferAttribute(i,n);let s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),i.setXYZW(n,e.x,e.y,e.z,e.w)}}boneTransform(t,e){let i=this.skeleton;if(i===void 0)return;let n=this.geometry;XS.fromBufferAttribute(n.attributes.skinIndex,t),$S.fromBufferAttribute(n.attributes.skinWeight,t),qS.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let r=0;r<4;r++){let s=$S.getComponent(r);if(s!==0){let a=XS.getComponent(r);YS.multiplyMatrices(i.bones[a].matrixWorld,i.boneInverses[a]),e.addScaledVector(L4.copy(qS).applyMatrix4(YS),s)}}return e.applyMatrix4(this.bindMatrixInverse)}}});function Ku(t){if(Array.isArray(t.material)){for(let e of t.material)if(e.getLayersOfType("outline").length===0)return}else if(!$_(t.material)||t.material.getLayersOfType("outline").length===0)return;t instanceof Ai&&t.is2DAndNoDepth?function(e){if(e.geometry.attributes.extrudeNormals||!e.geometry.attributes.position)return;let i=e.geometry.attributes.position.array,n=new Float32Array(i.length),r=new C;for(let s=0;s<i.length;s+=3)r.set(i[s],i[s+1],i[s+2]).normalize(),n[s]=r.x,n[s+1]=r.y,n[s+2]=r.z;e.geometry.setAttribute("extrudeNormal",new Nt(n,3))}(t):function(e){if(e.geometry.attributes.extrudeNormal||!e.geometry.attributes.position||!e.geometry.attributes.normal)return;let i=new Map,n=e.geometry.attributes,r=n.position.array,s=n.normal.array,a=new Float32Array(r.length);for(let o=0;o<r.length;o+=3){let l=`${r[o]}_${r[o+1]}_${r[o+2]}`,c=new C(s[o],s[o+1],s[o+2]);i.has(l)?i.get(l)?.normals.push(c):i.set(l,{normals:[c],result:new C})}i.forEach((o,l)=>{for(let c of o.normals)o.result.add(c);o.result.divideScalar(o.normals.length)});for(let o=0;o<r.length;o+=3){let l=`${r[o]}_${r[o+1]}_${r[o+2]}`,c=i.get(l)?.result;c&&(a[o]=c.x,a[o+1]=c.y,a[o+2]=c.z)}e.geometry.setAttribute("extrudeNormal",new Nt(a,3))}(t)}function ZS(t){return Math.min(2047,Math.max(1,Math.round(2048*t)))/2048}function Qu(t){if(!t.geometry.attributes.position)return;let e=t.geometry.attributes,i=e.position.array,n=e.randomColor;if(n!==void 0&&3*n.count===i.length)return;let r=new Float32Array(i.length),s=parseInt(t.uuid.replace(/\D/g,"")),a=[ZS(Ot.seededRandom(s)),ZS(Ot.seededRandom(s+1e4)),ZS(Ot.seededRandom(s+2e4))];for(let o=0;o<i.length;o++)r[o]=a[o%3];t.geometry.setAttribute("randomColor",new Ht(r,3))}var rx=F(()=>{et(),zC(),qr()});function B4(t){let e=!1;return t.scene.objects.traverse((i,n)=>{n.geometry?.type==="BooleanGeometry"&&(e=!0)}),e}function M$(t,e){let i=t.cloner;return i!==void 0&&i.parent===e?i:void 0}function U4(t,e,i,n){let r=16*(e.children.length+1);Lm.length<r&&(Lm=new Float32Array(r));let s=0,a=l=>{l.toArray(Lm,16*s),s++},o=e.parameters.hideBase!==!0;o&&a(n),NA.multiplyMatrices(t.hiddenMatrix,t.matrix);for(let l of e.children)!Mc(l)||l.playModeVisible===!1||(kA.multiplyMatrices(l.hiddenMatrix,l.matrix).multiply(l.pivotMatrix),g1.multiplyMatrices(NA,kA),(!o||!g1.equals(n))&&a(g1));try{return s===0?0:function(l,c){return BC(X_().instanced_union(LC(l),c))}(i,Lm.subarray(0,16*s))}finally{vN(i)}}var Ao,z4,NA,kA,g1,Lm,oh,nb,sx,pa,to,rb,$g=F(()=>{Yn(),et(),Kb(),rx(),Qc(),Li(),Ao=new At,z4=new At,NA=new At,kA=new At,g1=new At,Lm=new Float32Array(0),oh=class extends Hr{constructor(t,e,i){super(t,e),this.data=e,this.meshSetAddresses=[],this.needsTransformForDownstream=!1,this.geometry=new Gt,this.onAfterRender=(n,r,s,a,o,l)=>{super.onAfterRender(n,r,s,a,o,l),this.recomputeBoolean()},this.geometry.userData.parameters={width:0,height:0,depth:0}}get booleanOp(){return this.data.geometry.operation}get phongAngle(){return this.data.geometry.phongAngle??45}get isLOD(){return this.recomputeBoolean(),!1}updateByPatchedOp(t,e,i){super.updateByPatchedOp(t,e,i),t.path.length===1&&t.path[0]==="geometry"&&t.type===0&&t.props.operation!==void 0&&(this.freeBooleanPointer(),this.resetBBoxNeedsUpdate())}freeBooleanPointer(){super.freeBooleanPointer(),this.geometry.dispose()}recomputeBoolean(t,e=!0){if(this.booleanMeshSetAddress!==-1&&!t)return;for(let n=0;n<this.children.length;n++){let r=this.children[n];r instanceof oh&&r.dataPatched.visible===!0&&r.recomputeBoolean(t===!0,e)}this.meshSetAddresses=[];for(let n=0;n<this.children.length;n++){let r=this.children[n];if(r instanceof Xi&&r.dataPatched.visible===!0&&r.geometry.attributes.position?.count>0&&r.geometry.drawRange.count>0&&r.booleanMeshSetAddress!==0){Ao.multiplyMatrices(r.hiddenMatrix,r.matrix).multiply(r.pivotMatrix);try{let s=M$(r,this);if(r.booleanMeshSetAddress===-1){if((r.geometry.index??r.geometry.getAttribute("position")).count/3<15e5){let a=HX(r.geometry,t===!0);r.booleanMeshSetAddress=s===void 0||a===-1?a:U4(r,s,a,Ao)}if(r.booleanMeshSetAddress===-1)return;s===void 0&&CS(r.booleanMeshSetAddress,Ao),r.booleanMatrixInvOld.copy(Ao).invert(),r.booleanWasTransformed=!1}else r instanceof oh&&r.needsTransformForDownstream===!0?(s===void 0?CS(r.booleanMeshSetAddress,Ao):r.booleanMeshSetAddress=U4(r,s,r.booleanMeshSetAddress,Ao),r.needsTransformForDownstream=!1):r.booleanWasTransformed===!0&&(CS(r.booleanMeshSetAddress,z4.multiplyMatrices(Ao,r.booleanMatrixInvOld)),r.booleanMatrixInvOld.copy(Ao).invert(),r.booleanWasTransformed=!1)}catch(s){console.error(s),r.booleanMeshSetAddress=0,r.geometry.userData.booleanOperationDidFail=!0;continue}if(r.booleanMeshSetAddress===0)continue;this.meshSetAddresses.push(r.booleanMeshSetAddress),r.geometry.userData.booleanOperationDidFail=!1}}if(this.meshSetAddresses.length===0){if(this.geometry.getAttribute("position")?.array.length!==0){let n=this.geometry;n.dispose(),this.geometry=new Gt,this.geometry.userData=n.userData,this.geometry.boundingSphere=n.boundingSphere,this.geometry.setAttribute("position",new Nt([],3))}return void this.geometry.setDrawRange(0,0)}if(t===!0)return function(n,r){let s=X_(),a=OO(n,r),o=s.mesh_topological_data(a),l=o.positions(),c=o.indices();return o.free(),a.free(),{positions:l,indices:c,verticesPerFace:new Uint8Array(c.length/3).fill(3)}}(this.meshSetAddresses,this.booleanOp);let i=this.geometry;i.dispose(),this.geometry=new Gt,this.geometry.userData=i.userData,this.geometry.boundingSphere=i.boundingSphere;try{this.booleanMeshSetAddress=function(n,r,s,a){let o=X_(),l=OO(n,r),c=o.mesh_render_data(l,Math.max(a,0));if(s.setAttribute("position",new Nt(c.positions(),3)),s.setAttribute("normal",new Nt(c.normals(),3)),c.free(),s.boundingSphere===null&&(s.boundingSphere=new vr),l.tri_count()===0)s.boundingSphere.center.set(0,0,0),s.boundingSphere.radius=0,s.userData.parameters={width:0,height:0,depth:0};else{let h=l.bounds();s.boundingSphere.center.set(h[0],h[1],h[2]),s.boundingSphere.radius=(h[3]**2+h[4]**2+h[5]**2)**.5,s.userData.parameters={width:2*h[3],height:2*h[4],depth:2*h[5]}}return BC(l)}(this.meshSetAddresses,this.booleanOp,this.geometry,this.phongAngle)}catch(n){this.booleanMeshSetAddress=0,this.geometry.userData.booleanOperationDidFail=!0,console.error(n)}this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0,Ku(this),Qu(this)}dispose(){super.dispose(),this.geometry.dispose()}}}),Yg=F(()=>{et(),Wr(),Kc(),(nb||(nb={})).is=function(t){return Be.is(t)&&t instanceof _u},sx=(t,e)=>class extends Zc(t,e){updateState_Light(i,n){if(this.updateState_Entity(i,n),i.color!==void 0&&(this.color=n.shared.color(i.color)),i.intensity!==void 0&&(this.intensity=i.intensity*Math.PI),i.depth!==void 0){let r=this.shadow;r.camera.far=i.depth,r.needsUpdate=!0}i.shadows!==void 0&&(this.castShadow=i.shadows)}}}),xh=F(()=>{$g(),Yn(),Kc(),pa=t=>t instanceof Xi,to=t=>t!==null&&t instanceof oh,rb=t=>pA.is(t)});function mr(t,e){return e.color(t)}function F4(t=new Date,e){let i=e.format,n=t.getSeconds(),r=t;e&&e.timeZone!==null&&(r=function(d,u){try{let p=new Intl.DateTimeFormat("en-US",{timeZone:u,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}).formatToParts(d),f=g=>Number(p.find(m=>m.type===g)?.value);return new Date(f("year"),f("month")-1,f("day"),f("hour"),f("minute"),f("second"),d.getMilliseconds())}catch{return new Date(NaN)}}(new Date,e.timeZone));let s,a=r.getHours(),o=r.getMinutes();e.format12h24h==="12ampm"&&(s=a>=12?"PM":"AM");let l,c,h=a;switch(e.format12h24h!=="24"&&(h=a%12,h===0&&(h=12)),i){case"HH:mm:ss":l=[h,o,n];break;case"HH:mm":l=[h,o];break;case"HH":l=[h],s=void 0;break;case"mm":l=[o],s=void 0;break;case"ss":l=[n],s=void 0;break;case"year":c=r.getFullYear();break;case"month":c=r.getMonth()+1;break;case"dayOfYear":c=Math.floor((r.getTime()-new Date(r.getFullYear(),0,0).getTime())/864e5);break;case"dayOfMonth":c=r.getDate();break;case"secondOfDay":c=60*a*60+60*o+n;break;default:console.error("Unknown time format",i),c=0}return l!==void 0?{textValue:l,suffix:s}:c}var VA,Zg,e3=F(()=>{}),E$=F(()=>{et(),Wg(),qg(),VA=class extends _p(Pz){constructor(t,e=15,i=10066329){super(t,e,i),this.object=t,this.added=!1,this.name=`DirectionalLightHelper: ${t.uuid}`}raycast(t,e){bp(this.object,VA.geometryHelper,t,e)}}}),i3=F(()=>{et(),E$(),Yg(),Zg=class extends sx(Mz,VA){constructor(t,e,i){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=2048,this.shadow.mapSize.height=2048,this.shadow.normalBias=1,this.layers.enable(3);let n=this.shadow.camera;n.top=1250,n.bottom=-1250,n.right=1250,n.left=-1250,n.near=-1e4,n.far=2500;let r=new wg(this.shadow.camera);r.visible=!1,this.gizmos.shadowmap=r}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this.gizmos){let e=this.gizmos[t];e instanceof wg&&e.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e);let i=t.depth!==void 0&&t.depth!==this.shadow.camera.far||t.size!==void 0&&t.size/2!==this.shadow.camera.right;t.size!==void 0&&function(n,r){n.shadow.camera.right=r/2,n.shadow.camera.left=-r/2,n.shadow.camera.top=r/2,n.shadow.camera.bottom=-r/2,n.shadow.needsUpdate=!0}(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)),t.penumbraSize!==void 0&&e.scene.markPenumbraSizeDirty(),i&&this.update()}}});function n3(t){return t instanceof Hr&&t.needsAO&&!ch(t)&&t.isDecalObject!==!0}function r3(t){let e=t.cloner;if(e&&Array.isArray(e.children))for(let i of e.children)i?.layers&&(i.layers.mask=t.layers.mask)}function s3(t){return t.getLayersOfType("reflection").filter(e=>e.data.visible).length}function N4(t,e){let i={outline:!1,cavity:!1},n=t.layers.mask&ax,r=e.getLayersOfType("transmission"),s=e.getLayersOfType("outline"),a=s3(e),o=e.getLayersOfType("cavity");return(s.length>0||o.length>0)&&(t.layers.set(8),r.length>0&&t.layers.enable(3),a>0&&t.layers.enable(4),i.outline=s.length>0,i.cavity=o.length>0,Qu(t),Ku(t)),r.length===0&&s.length===0&&o.length===0&&a===0&&t.layers.set(0),n&&t.layers.set(9),!n&&n3(t)&&t.layers.enable(5),r3(t),i}function k4(t,e){if(!e.layers)return!1;let i=t.layers.mask&ax,n=!1,r=e.getLayersOfType("transmission").filter(l=>l.data.visible),s=e.getLayersOfType("outline").filter(l=>l.data.visible),a=s3(e),o=e.getLayersOfType("cavity").filter(l=>l.data.visible);return r.length>0&&(t.layers.set(3),(s.length>0||o.length>0)&&t.layers.enable(8),a>0&&t.layers.enable(4),n=!0),r.length===0&&s.length===0&&o.length===0&&a===0&&t.layers.set(0),i&&t.layers.set(9),!i&&n3(t)&&t.layers.enable(5),r3(t),n}function V4(t,e){var i;if(!e.layers)return!1;let n=t.layers.mask&ax,r=!1,s=s3(e),a=e.getLayersOfType("transmission").filter(c=>c.data.visible),o=e.getLayersOfType("outline").filter(c=>c.data.visible),l=e.getLayersOfType("cavity").filter(c=>c.data.visible);return s>0&&((i=t.userData).__splinePlanarMirror??(i.__splinePlanarMirror=0),t.layers.set(4),a.length>0&&t.layers.enable(3),(o.length>0||l.length>0)&&t.layers.enable(8),r=!0),s===0&&a.length===0&&o.length===0&&l.length===0&&t.layers.set(0),n&&t.layers.set(9),!n&&n3(t)&&t.layers.enable(5),r3(t),r}function jA(t,e,i,n=!1){let r=t.cloner;if(r){let s=null;if(t.raycast===xi.prototype.raycast||t.raycast===Xi.prototype.raycast){let a=t.geometry;a&&(a.boundingSphere===null&&a.computeBoundingSphere(),s=a.boundingSphere)}for(let a of r.children){if(s!==null&&(GA.copy(s).applyMatrix4(a.matrixWorld),!e.ray.intersectsSphere(GA)))continue;let o=Mk.copy(a.matrixWorld).invert(),l=Ek.copy(e.ray).applyMatrix4(o),c=t.matrixWorld;l.applyMatrix4(c);let h=Sk;h.set(l.origin,l.direction),h.near=e.near,h.far=e.far,h.layers.mask=e.layers.mask;let d=h.intersectObject(t,!1);d.length>0&&i.push({...d[0],object:n?a:t})}}}var ax,Sk,Mk,Ek,GA,Pv,Ak,KS,QS,JS,Kg,dn,Tk=F(()=>{Li(),rx(),Yn(),Qc(),et(),ax=512,Sk=new eC,Mk=new At,Ek=new $o,GA=new vr}),A$=F(()=>{et(),Wg(),qg(),Pv=class extends _p(Tz){constructor(t,e=6710886){super(t,e),this.object=t,this.matrix=t.matrixWorld,this.name=`SpotLightHelper: ${t.uuid}`}raycast(t,e){bp(this.object,Pv.geometryHelper,t,e)}update(){if(this.object!==void 0){let t=Pv._vector,e=this.object.distance?this.object.distance:1e3,i=e*Math.tan(this.object.angle);this.cone.scale.set(i,i,e),t.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(t);let n=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let r=0,s=this.cone.material.length;r<s;r++)this.cone.material[r].color.set(n);else this.cone.material.color.set(n)}}},(Ak=Pv)._vector=new C}),a3=F(()=>{et(),A$(),Yg(),KS=new C,QS=new C,JS=new $t,Kg=class extends sx(wz,Ak){constructor(t,e,i){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let n=this.shadow.camera;n.fov=2*Ot.RAD2DEG*this.angle,n.aspect=1,n.near=100,n.far=2500;let r=new wg(this.shadow.camera);r.visible=!1,this.gizmos.shadowmap=r,this.update()}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this.gizmos){let e=this.gizmos[t];e instanceof wg&&e.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),QS.setFromMatrixPosition(this.matrixWorld),JS.setFromRotationMatrix(this.matrixWorld),KS.copy(this.up).applyQuaternion(JS).negate().multiplyScalar(this.distance),this.target.position.copy(QS).add(KS),this.target.updateMatrixWorld(),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e),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.penumbraSize!==void 0&&e.scene.markPenumbraSizeDirty(),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null))}}}),al=F(()=>{Yt(),Hs(),et(),Wr(),ya(),e3(),sl(),i3(),Ye(),bh(),et(),Qc(),xh(),Tk(),a3(),ke(),$g(),dn=class extends Yb(rs){constructor(t,e,i){if(super(),this.data=e,this.bgColor=new mn(1,1,1,1),this.fog=null,this.backupFog=new KM(16777215,.1,2e3),this.fogUseBGColor=!1,this.fogMode="linear",this.fogDensity=tr.getDensity({}),this.fogHeightFalloff=tr.getHeightFalloff({}),this.fogHeightBase=tr.getHeightBase({}),this.isActive=!1,this.skyState=null,this.skyStateVersion=0,this.gradingState=null,this.skyHdriHolder=null,this.aoColor=new Jt,this.penumbraSizeArrayCache=null,this.super_Entity(t,e),this.personalCamera=new gn(Yc,{...ig.defaultData,...e.camera,name:"Personal Camera"}),this.personalCamera.objectHelper.visible=!1,this.add(this.personalCamera),this.activeCamera=this.personalCamera,this.ambientLight=new xz(13882323,8553090,.75*Math.PI),this.ambientLight.name="Default Ambient Light",this.ambientLight.layers.enable(3),this.ambientLight.removeFromParent(),this.add(this.ambientLight),e.uiScene){let n=lA();n===null?Vn("ui-2d","a page's 2D scene"):this.uiScene=new n.Scene2D((Array.isArray(t)?t[0]:t)+"-ui",e.uiScene,{dpr:window.devicePixelRatio,shared:i.shared})}else e.uiFrame&&this.createUICanvas(e.uiFrame,i)}get scene(){return this.parent}get postprocessing(){return this.data.postprocessing}get frameId(){return this.data.uiFrame}get frame(){return this.uiCanvas?.frame}createUICanvas(t,e){let i=lA();i!==null?(this.uiCanvas=new i.UICanvas(this.uuid+"-uiscreen",window.innerWidth,window.innerHeight,e),this.uiCanvas.isScreenSpace=!0,this.uiCanvas.promise.then(()=>{this.uiCanvas?.applyFrame(t),this.uiCanvas?.applySize()})):Vn("ui-2d","a page's UI canvas")}updateVisible(){}setBackgroundColor(t){this.bgColor=t,this.fogUseBGColor===!0&&(this.backupFog.color=t)}entityChildrenCount(){return this.uiScene?this.uiScene.children.length:super.entityChildrenCount()}updateAmbientLight(t,e){t.color!==void 0&&(this.ambientLight.color=mr(t.color,e)),t.intensity!==void 0&&(this.ambientLight.intensity=t.intensity*Math.PI),t.enabled!==void 0&&(t.enabled?this.add(this.ambientLight):this.remove(this.ambientLight))}onDeactive(){this.isActive=!1}onActive(t){this.isActive=!0,t.fog=this.fog,this.traverseEntity(e=>{e instanceof oh&&e.recomputeBoolean()}),this.updateShadow(this.data.shadow)}forceMaterialsUpdate(){this.traverseEntity(t=>{if(t instanceof Hr)if(Array.isArray(t.material))for(let e of t.material)e.needsUpdate=!0;else t.material.needsUpdate=!0,t.material.dispose()})}updateShadow(t){if(t.softShadowQuality===void 0&&t.type===void 0||!this.isActive)return;let e=this.data.shadow;var i,n;i=eg.isSoft(e),n=e?.softShadowQuality,zA!==void 0&&zA(i,n)&&this.forceMaterialsUpdate()}updateFog(t,e){t.enabled?this.fog=this.backupFog:this.fog=null,this.isActive&&(this.scene.fog=this.fog),this.fogUseBGColor=t.useBackgroundColor,t.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=mr(t.color,e),this.backupFog.near=t.near,this.backupFog.far=t.far,this.fogMode=tr.getMode(t),this.fogDensity=tr.getDensity(t),this.fogHeightFalloff=tr.getHeightFalloff(t),this.fogHeightBase=tr.getHeightBase(t)}updateSky(t,e){this.skyState=t??null,this.skyStateVersion++;let i=t?.hdri?.image;this.skyHdriHolder=i!=null?e.image(i):null}updateAo(t,e){t.aoColor!==void 0&&(this.aoColor=mr(t.aoColor,e))}updateByOp(t,e,i,n){let r=this.data.uiFrame;super.updateByOp(t,e,i,n);let s=e;ri(t.path,["fog"])?this.updateFog(s.fog,i.shared):ri(t.path,["sky"])?this.updateSky(s.sky,i.shared):ri(t.path,["grading"])?this.gradingState=s.grading??null:ri(t.path,["ao"])?this.updateAo(s.ao,i.shared):ri(t.path,["ambient"])?this.updateAmbientLight(s.ambient,i.shared):ri(t.path,["shadow"])?this.updateShadow(s.shadow):t.type===0&&t.path.length===0&&(t.props.uiFrame!==void 0||r!==s.uiFrame)&&this.updateUIFrame(t.props.uiFrame,i)}updateUIFrame(t,e){t?(this.uiCanvas||this.createUICanvas(t,e),this.uiCanvas.enabled=!0,this.uiCanvas.applyFrame(t)):this.uiCanvas&&(this.uiCanvas.enabled=!1)}updateState(t,e){this.updateState_Entity(t,e),t.backgroundColor!==void 0&&this.setBackgroundColor(mr(t.backgroundColor,e.shared)),t.fog!==void 0&&this.updateFog(t.fog,e.shared),t.sky!==void 0&&this.updateSky(t.sky,e.shared),t.grading!==void 0&&(this.gradingState=t.grading),t.ambient!==void 0&&this.updateAmbientLight(t.ambient,e.shared),t.ao!==void 0&&this.updateAo(t.ao,e.shared),t.shadow!==void 0&&this.updateShadow(t.shadow)}createFrame(t,e){}raycast(t,e){super.raycast(t,e)}switchActiveCamera(t){t&&t.isDescendantOf(this)&&(this.activeCamera!==this.personalCamera&&(this.activeCamera.objectHelper.visible=!0),this.activeCamera=t,t.objectHelper.visible=!1)}get playCamera(){return this.scene?.find(this.data.publish.playCamera)??this.personalCamera}switchToPlayCamera(){this.switchActiveCamera(this.playCamera)}get penumbraSizeArray(){return this.penumbraSizeArrayCache===null&&this.updatePenumbraSizeArray(),this.penumbraSizeArrayCache}updatePenumbraSizeArray(){this.penumbraSizeArrayCache=new Array(il).fill(.5);let t=0,e=0;this.traverseEntity(i=>{if(!i.visible)return!0;i instanceof Zg&&i.visible&&t<rg&&(this.penumbraSizeArrayCache[t]=i.data.penumbraSize??.5,t+=1),i instanceof Kg&&i.visible&&t<il-rg&&(this.penumbraSizeArrayCache[rg+e]=i.data.penumbraSize??.5,e+=1)})}raycastWithClones(t){let e=[],i=n=>{for(let r of n.children){let s=r.cloner;Be.is(r)&&(r.visible||s?.object.data.visible)&&((pa(r)||rb(r)&&this.scene.enableHelpers&&r.objectHelper.visible)&&(t.intersectObject(r,!1,e),jA(r,t,e,!0)),i(r))}};return i(this),e}updateEntity2DByOp(t,e,i,n){this.uiCanvas?.updateEntity2DByOp(t,e,i,n)}}});function j4(){return Ck}function t2(){if(sb===null)throw new Error('[spe] Classic (WebGL) particles are not available in this build \u2014 it was compiled WebGPU-only. Re-export the scene with renderer "Both" or "WebGL 2", or load the full runtime.');return sb}function e2(t){return t?.isWebGPUSplineRenderer===!0}var Ck,sb,Ju,Pk=F(()=>{Ck=null,sb=null}),o3=F(()=>{et(),Wb(),Kc(),Ju=class extends Zc(vp,up){constructor(t,e,i){super(),this.super_Entity(t,e),this.context=i,this.objectHelper.update()}updateState(t,e){this.updateState_Entity(t,e)}}}),T$=mp((t,e)=>{var i,n;i=t,n=function(){return r.importState=function(s){var a=new r;return a.importState(s),a},r;function r(){return function(s){var a=0,o=0,l=0,c=1;s.length==0&&(s=[+new Date]);var h=function(){var p=4022871197,f=function(g){g=g.toString();for(var m=0;m<g.length;m++){var y=.02519603282416938*(p+=g.charCodeAt(m));y-=p=y>>>0,p=(y*=p)>>>0,p+=4294967296*(y-=p)}return 23283064365386963e-26*(p>>>0)};return f.version="Mash 0.9",f}();a=h(" "),o=h(" "),l=h(" ");for(var d=0;d<s.length;d++)(a-=h(s[d]))<0&&(a+=1),(o-=h(s[d]))<0&&(o+=1),(l-=h(s[d]))<0&&(l+=1);h=null;var u=function(){var p=2091639*a+23283064365386963e-26*c;return a=o,o=l,l=p-(c=0|p)};return u.next=u,u.uint32=function(){return 4294967296*u()},u.fract53=function(){return u()+11102230246251565e-32*(2097152*u()|0)},u.version="Alea 0.9",u.args=s,u.exportState=function(){return[a,o,l,c]},u.importState=function(p){a=+p[0]||0,o=+p[1]||0,l=+p[2]||0,c=+p[3]||0},u}(Array.prototype.slice.call(arguments))}},typeof t=="object"?e.exports=n():typeof define=="function"&&define.amd?define(n):i.Alea=n()});function C$(t){let e=!1;return t.scene.objects.traverse((i,n)=>{n.type==="Mesh"&&n.geometry.type==="SubdivGeometry"&&(e=!0)}),e}var Js,zd,fp,Qg=F(()=>{Yn(),et(),Sp(),rx(),qr(),Js=new ci,zd=new C,fp=class extends Ai{constructor(t,e,i){super(t,e,i),this.data=e,this.hiddenMatrixOld=new At,this.smoothShading=!0,this.skipReactionUpdate=!1}chooseGeoemtryCache(t){return this.dataPatched.flatShading?t.geometryCache:t.geometryCache2}get subdivPointerNew(){return this.localGeometry!==void 0?this.subdivPointer:this.geometry.ensureSubdivPointer()}get originalGeometryNew(){return this.localGeometry!==void 0?this.originalGeometry:this.geometry.originalGeometry}get phongAngle(){return this.data.geometry.phongAngle??45}updateEntityBoxSize(t,e){let i=this.geometry.userData.parameters;t.copy(this.originalGeometryNew.boundingSphere.center),e.set(i.width,i.height,i.depth??0).multiplyScalar(.5)}createGeometryByControls(t){if(this.skipReactionUpdate===!0)return;let e=this.localGeometry?.uuid,{originalGeometry:i,subdividedGeometry:n,subdivPointer:r}=Fi.build(t,this.subdivPointer,this.smoothShading,this.hasNonUniformScale?this.shearScale:void 0);this.subdivPointer=r,i!==void 0&&(this.originalGeometry?.dispose(),this.originalGeometry=i),n!==void 0&&(this.subdividedGeometry?.dispose(),this.subdividedGeometry=n??void 0),this.localGeometry=this.subdividedGeometry??this.originalGeometry,Ku(this),Qu(this),this.calcBoundingBox(),e&&(this.localGeometry.uuid=e)}updateState(t,e){if(super.updateState(t,e),t.flatShading!==void 0){let i=this.material;this.material=Array.isArray(i)?i.map(n=>n.getFlavor(!1,n.side,n.wireframe)):i.getFlavor(!1,i.side,i.wireframe),this.smoothShading=!t.flatShading,this.createGeometryDelayed(e)}}updateMesh(t=!1,e=!1,i=!1){e&&this.subdividedGeometry||Fi.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1,this.originalGeometry,t&&this.hasNonUniformScale?this.shearScaleInv:void 0,i),this.subdividedGeometry&&Fi.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1,this.subdividedGeometry,t&&this.hasNonUniformScale?this.shearScaleInv:void 0)}updateTopology(){let t=this.localGeometry?.uuid;this.originalGeometry.dispose(),this.originalGeometry=Fi.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=Fi.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1)),this.localGeometry=this.subdividedGeometry??this.originalGeometry,Ku(this),Qu(this),this.calcBoundingBox(),t&&(this.localGeometry.uuid=t)}raycast(t,e){let i=this.localGeometry;this.localGeometry=this.originalGeometryNew,Xi.prototype.raycast.call(this,t,e),this.localGeometry=i}activateShearCompensation(){!this.hasNonUniformScale||(this.matrix.copy(this.matrixWorldRigid),this.hiddenMatrixOld.copy(this.hiddenMatrix),this.hiddenMatrix.copy(this.parent.matrixWorld).invert())}deactivateShearCompensation(){!this.hasNonUniformScale||(this.updateMatrix(),this.hasNonUniformScale=void 0,this.hiddenMatrix.copy(this.hiddenMatrixOld))}calcBoundingBox(){let t=this.originalGeometry;t.boundingSphere===null&&(t.boundingSphere=new vr,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=t.boundingSphere));let e=t.attributes.position,i=t.boundingSphere.center;Js.setFromBufferAttribute(e),Js.getCenter(i),t.boundingSphere.radius=i.distanceTo(Js.max),isNaN(t.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),Js.getSize(zd),this.hasNonUniformScale&&zd.divide(this.scale);let n={width:zd.x,height:zd.y,depth:zd.z};return this.geometry.userData.parameters=n,n}updateBoundingSphere(t){let e=this.originalGeometry;Js.min.set(t[0],t[2],t[4]),Js.max.set(t[1],t[3],t[5]),this.hasNonUniformScale&&(Js.min.applyMatrix4(this.shearScaleInv),Js.max.applyMatrix4(this.shearScaleInv)),e.boundingSphere===null&&(e.boundingSphere=new vr);let i=e.boundingSphere.center;Js.getCenter(i),e.boundingSphere.radius=i.distanceTo(Js.max)}freeSubdivPointer(){this.subdivPointer&&(Fi.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0),this.localGeometry=void 0,this.originalGeometry?.dispose(),this.subdividedGeometry?.dispose()}dispose(){super.dispose(),this.freeSubdivPointer()}updateSubdivisionLevel(t){if(this.skipReactionUpdate===!0)return;let e=this.localGeometry,i=e?.uuid,n=e?.userData.parameters,r=t.subdivisions>0?Fi.buildRefined(this.subdivPointer,t.subdivisions,this.smoothShading?t.phongAngle??35:-1):null;this.subdividedGeometry?.dispose(),this.subdividedGeometry=r??void 0,this.subdividedGeometry&&this.originalGeometry.boundingSphere&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere),this.localGeometry=this.subdividedGeometry??this.originalGeometry,Ku(this),Qu(this),n!==void 0&&(this.localGeometry.userData.parameters=n),i&&(this.localGeometry.uuid=i)}updateByPatchedOpGeometry(t,e,i){super.updateByPatchedOpGeometry(t,e,i),this.localGeometry&&(t.type===0&&t.path.length===0&&pk(t.props)&&this.subdivPointer?this.updateSubdivisionLevel(e):this.createGeometryByControls(e))}}});function l3(t){if(t.component){let e=t.component.instances.indexOf(t);e>=0&&t.component.instances.splice(e,1);for(let i of t.children)Be.is(i)&&l3(i)}}var lg,HA,ox,Dk=F(()=>{Wr()}),P$=mp((t,e)=>{function i(n,r,s,a){this.message=n,this.expected=r,this.found=s,this.location=a,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,i)}(function(n,r){function s(){this.constructor=n}s.prototype=r.prototype,n.prototype=new s})(i,Error),i.buildMessage=function(n,r){var s,a={literal:function(d){return'"'+l(d.text)+'"'},class:function(d){var u,p="";for(u=0;u<d.parts.length;u++)p+=d.parts[u]instanceof Array?c(d.parts[u][0])+"-"+c(d.parts[u][1]):c(d.parts[u]);return"["+(d.inverted?"^":"")+p+"]"},any:function(d){return"any character"},end:function(d){return"end of input"},other:function(d){return d.description}};function o(d){return d.charCodeAt(0).toString(16).toUpperCase()}function l(d){return d.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(u){return"\\x0"+o(u)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(u){return"\\x"+o(u)})}function c(d){return d.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(u){return"\\x0"+o(u)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(u){return"\\x"+o(u)})}function h(d){return a[d.type](d)}return"Expected "+function(d){var u,p,f=new Array(d.length);for(u=0;u<d.length;u++)f[u]=h(d[u]);if(f.sort(),f.length>0){for(u=1,p=1;u<f.length;u++)f[u-1]!==f[u]&&(f[p]=f[u],p++);f.length=p}switch(f.length){case 1:return f[0];case 2:return f[0]+" or "+f[1];default:return f.slice(0,-1).join(", ")+", or "+f[f.length-1]}}(n)+" but "+((s=r)?'"'+l(s)+'"':"end of input")+" found."},e.exports={SyntaxError:i,parse:function(n,r){r=r!==void 0?r:{};var s,a={},o={svg_path:Pe},l=Pe,c=function(J){if(!J)return[];for(var Et=[],ft=0;ft<J.length;ft++)Et=Et.concat.apply(Et,J[ft]);var St=Et[0];return St&&St.code=="m"&&(delete St.relative,St.code="M"),Et},h=function(J,Et){return function(ft,St){if(!St)return[ft];for(var It=[ft],B=0,st=St.length;B<st;B++)It[B+1]=St[B][1];return It}(J,Et)},d=/^[Mm]/,u=be(["M","m"],!1,!1),p=function(J,Et,ft){var St=uo(J,[Et]);return ft&&(St=St.concat(uo(J=="M"?"L":"l",ft[1]))),St},f=/^[Zz]/,g=be(["Z","z"],!1,!1),m=function(){return uo("Z")},y=/^[Ll]/,v=be(["L","l"],!1,!1),_=function(J,Et){return uo(J,Et)},b=/^[Hh]/,x=be(["H","h"],!1,!1),w=function(J,Et){return uo(J,Et.map(function(ft){return{x:ft}}))},S=/^[Vv]/,A=be(["V","v"],!1,!1),E=function(J,Et){return uo(J,Et.map(function(ft){return{y:ft}}))},P=/^[Cc]/,T=be(["C","c"],!1,!1),R=function(J,Et,ft){return{x1:J.x,y1:J.y,x2:Et.x,y2:Et.y,x:ft.x,y:ft.y}},L=/^[Ss]/,D=be(["S","s"],!1,!1),U=function(J,Et){return{x2:J.x,y2:J.y,x:Et.x,y:Et.y}},V=/^[Qq]/,k=be(["Q","q"],!1,!1),Y=function(J,Et){return{x1:J.x,y1:J.y,x:Et.x,y:Et.y}},$=/^[Tt]/,nt=be(["T","t"],!1,!1),Q=/^[Aa]/,rt=be(["A","a"],!1,!1),gt=function(J,Et,ft,St,It,B){return{rx:J,ry:Et,xAxisRotation:ft,largeArc:St,sweep:It,x:B.x,y:B.y}},at=function(J,Et){return{x:J,y:Et}},ht=function(J){return 1*J},ct=function(J){return 1*J.join("")},q=/^[01]/,lt=be(["0","1"],!1,!1),z=function(J){return J=="1"},O=function(){return""},j=",",Z=_e(",",!1),I=function(J){return J.join("")},G=".",W=_e(".",!1),N=/^[eE]/,tt=be(["e","E"],!1,!1),ot=/^[+\-]/,pt=be(["+","-"],!1,!1),ut=/^[0-9]/,Pt=be([["0","9"]],!1,!1),bt=function(J){return J.join("")},Rt=/^[ \t\n\r]/,_t=be([" "," ",`
|
|
4170
4170
|
`,"\r"],!1,!1),X=0,vt=[{line:1,column:1}],Dt=0,jt=[],Ft=0;if("startRule"in r){if(!(r.startRule in o))throw new Error(`Can't start parsing from rule "`+r.startRule+'".');l=o[r.startRule]}function _e(J,Et){return{type:"literal",text:J,ignoreCase:Et}}function be(J,Et,ft){return{type:"class",parts:J,inverted:Et,ignoreCase:ft}}function Vi(J){var Et,ft=vt[J];if(ft)return ft;for(Et=J-1;!vt[Et];)Et--;for(ft={line:(ft=vt[Et]).line,column:ft.column};Et<J;)n.charCodeAt(Et)===10?(ft.line++,ft.column=1):ft.column++,Et++;return vt[J]=ft,ft}function oe(J,Et){var ft=Vi(J),St=Vi(Et);return{start:{offset:J,line:ft.line,column:ft.column},end:{offset:Et,line:St.line,column:St.column}}}function le(J){X<Dt||(X>Dt&&(Dt=X,jt=[]),jt.push(J))}function Pe(){var J,Et,ft,St,It;for(J=X,Et=[],ft=Oe();ft!==a;)Et.push(ft),ft=Oe();if(Et!==a)if(ft=function(){var B,st,xt,Mt,dt,wt;if(B=X,(st=si())!==a){for(xt=[],Mt=X,dt=[],wt=Oe();wt!==a;)dt.push(wt),wt=Oe();for(dt!==a&&(wt=si())!==a?Mt=dt=[dt,wt]:(X=Mt,Mt=a);Mt!==a;){for(xt.push(Mt),Mt=X,dt=[],wt=Oe();wt!==a;)dt.push(wt),wt=Oe();dt!==a&&(wt=si())!==a?Mt=dt=[dt,wt]:(X=Mt,Mt=a)}xt!==a?B=st=h(st,xt):(X=B,B=a)}else X=B,B=a;return B}(),ft===a&&(ft=null),ft!==a){for(St=[],It=Oe();It!==a;)St.push(It),It=Oe();St!==a?J=Et=c(ft):(X=J,J=a)}else X=J,J=a;else X=J,J=a;return J}function si(){var J,Et,ft,St,It,B;if(J=X,Et=function(){var st,xt,Mt,dt,wt,Lt,Xt;if(st=X,d.test(n.charAt(X))?(xt=n.charAt(X),X++):(xt=a,Ft===0&&le(u)),xt!==a){for(Mt=[],dt=Oe();dt!==a;)Mt.push(dt),dt=Oe();Mt!==a&&(dt=yn())!==a?(wt=X,(Lt=xe())===a&&(Lt=null),Lt!==a&&(Xt=Pi())!==a?wt=Lt=[Lt,Xt]:(X=wt,wt=a),wt===a&&(wt=null),wt!==a?st=xt=p(xt,dt,wt):(X=st,st=a)):(X=st,st=a)}else X=st,st=a;return st}(),Et!==a){for(ft=[],St=X,It=[],B=Oe();B!==a;)It.push(B),B=Oe();for(It!==a&&(B=ze())!==a?St=It=[It,B]:(X=St,St=a);St!==a;){for(ft.push(St),St=X,It=[],B=Oe();B!==a;)It.push(B),B=Oe();It!==a&&(B=ze())!==a?St=It=[It,B]:(X=St,St=a)}ft!==a?J=Et=h(Et,ft):(X=J,J=a)}else X=J,J=a;return J}function ze(){var J,Et;return f.test(n.charAt(X))?(Et=n.charAt(X),X++):(Et=a,Ft===0&&le(g)),Et!==a&&(Et=m()),(J=Et)===a&&(J=function(){var ft,St,It,B;if(ft=X,y.test(n.charAt(X))?(St=n.charAt(X),X++):(St=a,Ft===0&&le(v)),St!==a){for(It=[],B=Oe();B!==a;)It.push(B),B=Oe();It!==a&&(B=Pi())!==a?ft=St=_(St,B):(X=ft,ft=a)}else X=ft,ft=a;return ft}())===a&&(J=function(){var ft,St,It,B;if(ft=X,b.test(n.charAt(X))?(St=n.charAt(X),X++):(St=a,Ft===0&&le(x)),St!==a){for(It=[],B=Oe();B!==a;)It.push(B),B=Oe();It!==a&&(B=ui())!==a?ft=St=w(St,B):(X=ft,ft=a)}else X=ft,ft=a;return ft}())===a&&(J=function(){var ft,St,It,B;if(ft=X,S.test(n.charAt(X))?(St=n.charAt(X),X++):(St=a,Ft===0&&le(A)),St!==a){for(It=[],B=Oe();B!==a;)It.push(B),B=Oe();It!==a&&(B=ui())!==a?ft=St=E(St,B):(X=ft,ft=a)}else X=ft,ft=a;return ft}())===a&&(J=function(){var ft,St,It,B;if(ft=X,P.test(n.charAt(X))?(St=n.charAt(X),X++):(St=a,Ft===0&&le(T)),St!==a){for(It=[],B=Oe();B!==a;)It.push(B),B=Oe();It!==a?(B=function(){var st,xt,Mt,dt,wt,Lt;if(st=X,(xt=tn())!==a){for(Mt=[],dt=X,(wt=xe())===a&&(wt=null),wt!==a&&(Lt=tn())!==a?dt=wt=[wt,Lt]:(X=dt,dt=a);dt!==a;)Mt.push(dt),dt=X,(wt=xe())===a&&(wt=null),wt!==a&&(Lt=tn())!==a?dt=wt=[wt,Lt]:(X=dt,dt=a);Mt!==a?st=xt=h(xt,Mt):(X=st,st=a)}else X=st,st=a;return st}(),B!==a?ft=St=_(St,B):(X=ft,ft=a)):(X=ft,ft=a)}else X=ft,ft=a;return ft}())===a&&(J=function(){var ft,St,It,B;if(ft=X,L.test(n.charAt(X))?(St=n.charAt(X),X++):(St=a,Ft===0&&le(D)),St!==a){for(It=[],B=Oe();B!==a;)It.push(B),B=Oe();It!==a?(B=function(){var st,xt,Mt,dt,wt,Lt;if(st=X,(xt=Kr())!==a){for(Mt=[],dt=X,(wt=xe())===a&&(wt=null),wt!==a&&(Lt=Kr())!==a?dt=wt=[wt,Lt]:(X=dt,dt=a);dt!==a;)Mt.push(dt),dt=X,(wt=xe())===a&&(wt=null),wt!==a&&(Lt=Kr())!==a?dt=wt=[wt,Lt]:(X=dt,dt=a);Mt!==a?st=xt=h(xt,Mt):(X=st,st=a)}else X=st,st=a;return st}(),B!==a?ft=St=_(St,B):(X=ft,ft=a)):(X=ft,ft=a)}else X=ft,ft=a;return ft}())===a&&(J=function(){var ft,St,It,B;if(ft=X,V.test(n.charAt(X))?(St=n.charAt(X),X++):(St=a,Ft===0&&le(k)),St!==a){for(It=[],B=Oe();B!==a;)It.push(B),B=Oe();It!==a?(B=function(){var st,xt,Mt,dt,wt,Lt;if(st=X,(xt=vn())!==a){for(Mt=[],dt=X,(wt=xe())===a&&(wt=null),wt!==a&&(Lt=vn())!==a?dt=wt=[wt,Lt]:(X=dt,dt=a);dt!==a;)Mt.push(dt),dt=X,(wt=xe())===a&&(wt=null),wt!==a&&(Lt=vn())!==a?dt=wt=[wt,Lt]:(X=dt,dt=a);Mt!==a?st=xt=h(xt,Mt):(X=st,st=a)}else X=st,st=a;return st}(),B!==a?ft=St=_(St,B):(X=ft,ft=a)):(X=ft,ft=a)}else X=ft,ft=a;return ft}())===a&&(J=function(){var ft,St,It,B;if(ft=X,$.test(n.charAt(X))?(St=n.charAt(X),X++):(St=a,Ft===0&&le(nt)),St!==a){for(It=[],B=Oe();B!==a;)It.push(B),B=Oe();It!==a?(B=function(){var st,xt,Mt,dt,wt,Lt;if(st=X,(xt=yn())!==a){for(Mt=[],dt=X,(wt=xe())===a&&(wt=null),wt!==a&&(Lt=yn())!==a?dt=wt=[wt,Lt]:(X=dt,dt=a);dt!==a;)Mt.push(dt),dt=X,(wt=xe())===a&&(wt=null),wt!==a&&(Lt=yn())!==a?dt=wt=[wt,Lt]:(X=dt,dt=a);Mt!==a?st=xt=h(xt,Mt):(X=st,st=a)}else X=st,st=a;return st}(),B!==a?ft=St=_(St,B):(X=ft,ft=a)):(X=ft,ft=a)}else X=ft,ft=a;return ft}())===a&&(J=function(){var ft,St,It,B;if(ft=X,Q.test(n.charAt(X))?(St=n.charAt(X),X++):(St=a,Ft===0&&le(rt)),St!==a){for(It=[],B=Oe();B!==a;)It.push(B),B=Oe();It!==a?(B=function(){var st,xt,Mt,dt,wt,Lt;if(st=X,(xt=Qr())!==a){for(Mt=[],dt=X,(wt=xe())===a&&(wt=null),wt!==a&&(Lt=Qr())!==a?dt=wt=[wt,Lt]:(X=dt,dt=a);dt!==a;)Mt.push(dt),dt=X,(wt=xe())===a&&(wt=null),wt!==a&&(Lt=Qr())!==a?dt=wt=[wt,Lt]:(X=dt,dt=a);Mt!==a?st=xt=h(xt,Mt):(X=st,st=a)}else X=st,st=a;return st}(),B!==a?ft=St=_(St,B):(X=ft,ft=a)):(X=ft,ft=a)}else X=ft,ft=a;return ft}()),J}function Pi(){var J,Et,ft,St,It,B;if(J=X,(Et=yn())!==a){for(ft=[],St=X,(It=xe())===a&&(It=null),It!==a&&(B=yn())!==a?St=It=[It,B]:(X=St,St=a);St!==a;)ft.push(St),St=X,(It=xe())===a&&(It=null),It!==a&&(B=yn())!==a?St=It=[It,B]:(X=St,St=a);ft!==a?J=Et=h(Et,ft):(X=J,J=a)}else X=J,J=a;return J}function ui(){var J,Et,ft,St,It,B;if(J=X,(Et=co())!==a){for(ft=[],St=X,(It=xe())===a&&(It=null),It!==a&&(B=co())!==a?St=It=[It,B]:(X=St,St=a);St!==a;)ft.push(St),St=X,(It=xe())===a&&(It=null),It!==a&&(B=co())!==a?St=It=[It,B]:(X=St,St=a);ft!==a?J=Et=h(Et,ft):(X=J,J=a)}else X=J,J=a;return J}function tn(){var J,Et,ft,St,It,B;return J=X,(Et=yn())!==a?((ft=xe())===a&&(ft=null),ft!==a&&(St=yn())!==a?((It=xe())===a&&(It=null),It!==a&&(B=yn())!==a?J=Et=R(Et,St,B):(X=J,J=a)):(X=J,J=a)):(X=J,J=a),J}function Kr(){var J,Et,ft,St;return J=X,(Et=yn())!==a?((ft=xe())===a&&(ft=null),ft!==a&&(St=yn())!==a?J=Et=U(Et,St):(X=J,J=a)):(X=J,J=a),J}function vn(){var J,Et,ft,St;return J=X,(Et=yn())!==a?((ft=xe())===a&&(ft=null),ft!==a&&(St=yn())!==a?J=Et=Y(Et,St):(X=J,J=a)):(X=J,J=a),J}function Qr(){var J,Et,ft,St,It,B,st,xt,Mt,dt,wt;return J=X,(Et=yt())!==a?((ft=xe())===a&&(ft=null),ft!==a&&(St=yt())!==a?((It=xe())===a&&(It=null),It!==a&&(B=co())!==a&&xe()!==a&&(st=Lp())!==a?((xt=xe())===a&&(xt=null),xt!==a&&(Mt=Lp())!==a?((dt=xe())===a&&(dt=null),dt!==a&&(wt=yn())!==a?J=Et=gt(Et,St,B,st,Mt,wt):(X=J,J=a)):(X=J,J=a)):(X=J,J=a)):(X=J,J=a)):(X=J,J=a),J}function yn(){var J,Et,ft,St;return J=X,(Et=co())!==a?((ft=xe())===a&&(ft=null),ft!==a&&(St=co())!==a?J=Et=at(Et,St):(X=J,J=a)):(X=J,J=a),J}function yt(){var J;return(J=Up())===a&&(J=ba()),J!==a&&(J=ht(J)),J}function co(){var J,Et,ft;return J=X,(Et=ad())===a&&(Et=null),Et!==a&&(ft=Up())!==a?J=Et=[Et,ft]:(X=J,J=a),J===a&&(J=X,(Et=ad())===a&&(Et=null),Et!==a&&(ft=ba())!==a?J=Et=[Et,ft]:(X=J,J=a)),J!==a&&(J=ct(J)),J}function Lp(){var J;return q.test(n.charAt(X))?(J=n.charAt(X),X++):(J=a,Ft===0&&le(lt)),J!==a&&(J=z(J)),J}function xe(){var J,Et,ft,St,It;if(J=X,Et=[],(ft=Oe())!==a)for(;ft!==a;)Et.push(ft),ft=Oe();else Et=a;if(Et!==a)if((ft=Bp())===a&&(ft=null),ft!==a){for(St=[],It=Oe();It!==a;)St.push(It),It=Oe();St!==a?J=Et=[Et,ft,St]:(X=J,J=a)}else X=J,J=a;else X=J,J=a;if(J===a){if(J=X,Et=X,(ft=Bp())!==a){for(St=[],It=Oe();It!==a;)St.push(It),It=Oe();St!==a?Et=ft=[ft,St]:(X=Et,Et=a)}else X=Et,Et=a;Et!==a&&(Et=O()),J=Et}return J}function Bp(){var J;return n.charCodeAt(X)===44?(J=j,X++):(J=a,Ft===0&&le(Z)),J}function Up(){var J,Et,ft;return J=X,Et=function(){var St,It,B,st;return St=X,(It=ba())===a&&(It=null),It!==a?(n.charCodeAt(X)===46?(B=G,X++):(B=a,Ft===0&&le(W)),B!==a&&(st=ba())!==a?St=It=[It,B,st]:(X=St,St=a)):(X=St,St=a),St===a&&(St=X,(It=ba())!==a?(n.charCodeAt(X)===46?(B=G,X++):(B=a,Ft===0&&le(W)),B!==a?St=It=[It,B]:(X=St,St=a)):(X=St,St=a)),St!==a&&(St=I(St)),St}(),Et!==a?((ft=zp())===a&&(ft=null),ft!==a?J=Et=[Et,ft]:(X=J,J=a)):(X=J,J=a),J===a&&(J=X,(Et=ba())!==a&&(ft=zp())!==a?J=Et=[Et,ft]:(X=J,J=a)),J!==a&&(J=I(J)),J}function zp(){var J,Et,ft,St;return J=X,N.test(n.charAt(X))?(Et=n.charAt(X),X++):(Et=a,Ft===0&&le(tt)),Et!==a?((ft=ad())===a&&(ft=null),ft!==a&&(St=ba())!==a?J=Et=[Et,ft,St]:(X=J,J=a)):(X=J,J=a),J!==a&&(J=I(J)),J}function ad(){var J;return ot.test(n.charAt(X))?(J=n.charAt(X),X++):(J=a,Ft===0&&le(pt)),J}function ba(){var J,Et;if(J=[],ut.test(n.charAt(X))?(Et=n.charAt(X),X++):(Et=a,Ft===0&&le(Pt)),Et!==a)for(;Et!==a;)J.push(Et),ut.test(n.charAt(X))?(Et=n.charAt(X),X++):(Et=a,Ft===0&&le(Pt));else J=a;return J!==a&&(J=bt(J)),J}function Oe(){var J;return Rt.test(n.charAt(X))?(J=n.charAt(X),X++):(J=a,Ft===0&&le(_t)),J!==a&&(J=O()),J}var od,ld,xa,dl={m:"moveto",l:"lineto",h:"horizontal lineto",v:"vertical lineto",c:"curveto",s:"smooth curveto",q:"quadratic curveto",t:"smooth quadratic curveto",a:"elliptical arc",z:"closepath"};for(var Fp in dl)dl[Fp.toUpperCase()]=dl[Fp];function uo(J,Et){Et||(Et=[{}]);for(var ft=Et.length;ft--;){var St={code:J,command:dl[J]};for(var It in J==J.toLowerCase()&&(St.relative=!0),Et[ft])St[It]=Et[ft][It];Et[ft]=St}return Et}if((s=l())!==a&&X===n.length)return s;throw s!==a&&X<n.length&&le({type:"end"}),od=jt,ld=Dt<n.length?n.charAt(Dt):null,xa=Dt<n.length?oe(Dt,Dt+1):oe(Dt,Dt),new i(i.buildMessage(od,ld),od,ld,xa)}}}),h3=mp((t,e)=>{var i=P$().parse;i.parseSVG=i,i.makeAbsolute=function(n){var r,s={x:0,y:0},a={x:"x0",y:"y0",x1:"x0",y1:"y0",x2:"x0",y2:"y0"};return n.forEach(function(o){for(var l in o.command==="moveto"&&(r=o),o.x0=s.x,o.y0=s.y,a)l in o&&(o[l]+=o.relative?o[a[l]]:0);"x"in o||(o.x=s.x),"y"in o||(o.y=s.y),o.relative=!1,o.code=o.code.toUpperCase(),o.command=="closepath"&&(o.x=r.x,o.y=r.y),s=o}),n},e.exports=i}),Rk=F(()=>{lg=new Set}),D$=F(()=>{et(),Wg(),qg(),HA=class extends _p(Cz){constructor(t,e=15,i=6710886){super(t,e,i),this.object=t,this.name=`PointLightHelper: ${t.uuid}`}raycast(t,e){bp(this.object,HA.geometryHelper,t,e)}}}),Ik=F(()=>{et(),D$(),Yg(),ox=class extends sx(Sz,HA){constructor(t,e,i){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let n=this.shadow.camera;n.fov=90,n.aspect=1,n.near=100,n.far=2500;let r=new C(-n.far+this.position.x,-n.far+this.position.y,-n.far+this.position.z),s=new C(n.far+this.position.x,n.far+this.position.y,n.far+this.position.z),a=new ci(r,s),o=new Sg(a,new Jt(16755200));o.visible=!1,this.gizmos.shadowmap=o,this.update()}update(){if(this.shadow&&(this.shadow.camera.updateProjectionMatrix(),this.gizmos))for(let t in this.gizmos){let e=this.gizmos[t];if(e instanceof Sg){let i=this.shadow.camera,n=new C(-i.far+this.position.x,-i.far+this.position.y,-i.far+this.position.z),r=new C(i.far+this.position.x,i.far+this.position.y,i.far+this.position.z);e.box.set(n,r),e.updateMatrixWorld(!0)}}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e),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))}}});function G4(t){let e=WA.get(t);return e===void 0&&(e=Ok++,WA.set(t,e)),e}function R$(t,e,i,n){let r=t,s=e;return[G4(i),G4(n),r.layers?.mask??0,r.renderOrder??0,(r.castShadow??s.castShadow)===!0?1:0,(r.receiveShadow??s.receiveShadow)===!0?1:0].join(":")}var WA,Ok,qA,XA,Dv,Lk,I$=F(()=>{Li(),WA=new WeakMap,Ok=1}),O$=F(()=>{et(),XA=(qA=[8,32,128,512])[qA.length-1],Dv=new At().makeScale(0,0,0),Lk=class extends Ob{constructor(t,e,i,n){super(t,e,i),this.isInstanceGroup=!0,this.members=new Array(i).fill(null),this.raycast=()=>{},this.matrixAutoUpdate=!1,this.frustumCulled=!1,this.adoptPassState(n);for(let r=0;r<i;r++)this.setMatrixAt(r,Dv);this.instanceMatrix.needsUpdate=!0}adoptPassState(t){this.layers.mask=t.layers.mask,this.renderOrder=t.renderOrder,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow}assign(t,e){this.members[t]=e}writeSlot(t,e,i){return i===!1?(this.setMatrixAt(t,Dv),!1):(this.setMatrixAt(t,e.matrixWorld),!0)}park(t){this.members[t]=null,this.setMatrixAt(t,Dv)}get memberCount(){let t=0;for(let e of this.members)e!==null&&t++;return t}}});function Bk(t,e){let i=e.get(t);if(i!==void 0)return i;let n=t.visible&&(t.parent===null||Bk(t.parent,e));return e.set(t,n),n}var Uk,L$=F(()=>{I$(),O$(),Uk=class{constructor(t=8){this.minGroupSize=t,this.groups=[],this.groupKeys=new WeakMap,this.placements=new Map,this.visibilityMemo=new Map,this.page=null,this.stats={instancingGroups:0,instancedDrawsSaved:0,instancingRegroups:0,instancingParks:0,instancingIneligible:{}}}update(t,e){this.page!==t&&(this.teardown(),this.page=t,e=!0),t.matrixWorldAutoUpdate===!0&&t.updateMatrixWorld(),e&&this.reconcile(t),this.refresh()}reconcile(t){let e={},i=new Map;t.traverse(s=>{if(s.isInstanceGroup===!0)return;let a=function(l){if(l.isMesh!==!0)return"not-a-mesh";if(ch(l)||Cr(l)||Gc(l)||sg(l))return"excluded-type";let c=function(f){let g=Mc(f)?f.object:f;return g.geometry!==void 0?g:void 0}(l);if(c===void 0)return"not-a-mesh";let h=c.material;if(h===void 0)return"not-a-mesh";if(Array.isArray(h))return"array-material";let d=c.builtSharedGeometry;if(d===void 0)return"unrealized-geometry";if(!function(f){return f.isShared===!0}(d))return"unshared-geometry";if(d.attributes.position===void 0)return"empty-geometry";if(d.morphAttributes.position!==void 0)return"morph";if(c.isSkinnedMesh===!0)return"skinned";let u=c.morphTargetInfluences;if(u!==void 0&&u.length>0)return"morph";if(d.drawRange.start!==0||d.drawRange.count!==Number.POSITIVE_INFINITY)return"draw-range";let p=h;return p.positionNode!=null||p.castShadowPositionNode!=null?"position-node":p.transparent===!0?"transparent":c.userData?.__splinePlanarMirror!==void 0?"reflection":function(f){let g=f;for(;g!==null;){let m=g.states;if(m!==void 0&&Object.keys(m).length>0)return!0;g=g.parent}return!1}(c)?"interaction-states":{object:l,owner:c,geometry:d,material:h,key:R$(l,c,d,h)}}(s);if(typeof a=="string")return void(e[a]=(e[a]??0)+1);let o=i.get(a.key);o===void 0?i.set(a.key,[a]):o.push(a)});let n=new Map;for(let[s,a]of i)for(let o of a)n.set(o.object,s);let r=!1;for(let[s,a]of this.placements)n.get(s)!==this.groupKeys.get(a.group)&&this.parkPlacement(s,a);for(let s=this.groups.length-1;s>=0;s--){let a=this.groups[s];a.memberCount>=this.minGroupSize||(this.destroyGroup(a),this.groups.splice(s,1),r=!0)}for(let[s,a]of i){let o=a.filter(c=>!this.placements.has(c.object));if(o.length===0)continue;let l=0;for(let c of this.groups){if(l>=o.length)break;if(this.groupKeys.get(c)!==s)continue;let{members:h}=c;for(let d=0;d<h.length&&l<o.length;d++)h[d]===null&&this.place(c,d,o[l++].object)}for(;o.length-l>=this.minGroupSize;){let c=o.slice(l,l+XA);this.groups.push(this.createGroup(t,s,c)),l+=c.length,r=!0}}r&&this.stats.instancingRegroups++,this.publishGroupStats(),this.stats.instancingIneligible=e}createGroup(t,e,i){let n=i[0],r=new Lk(n.geometry,n.material,function(s){for(let a of qA)if(s<=a)return a;return XA}(i.length),n.object);this.groupKeys.set(r,e);for(let s=0;s<i.length;s++)this.place(r,s,i[s].object);return t.add(r),r}destroyGroup(t){for(let e=0;e<t.members.length;e++){let i=t.members[e];i!==null&&this.parkPlacement(i,{group:t,slot:e})}t.removeFromParent(),t.dispose()}place(t,e,i){t.assign(e,i),this.placements.set(i,{group:t,slot:e}),i.isDrawSuppressed=!0}parkPlacement(t,e){e.group.park(e.slot),e.group.instanceMatrix.needsUpdate=!0,this.placements.delete(t),t.isDrawSuppressed=!1,this.stats.instancingParks++}refresh(){this.visibilityMemo.clear();for(let t of this.groups){let{members:e}=t,i=null;for(let n=0;n<e.length;n++){let r=e[n];r!==null&&(i===null&&(i=r),t.writeSlot(n,r,Bk(r,this.visibilityMemo)))}i!==null&&(t.adoptPassState(i),t.instanceMatrix.needsUpdate=!0)}}teardown(){for(let t of this.groups)this.destroyGroup(t);this.groups.length=0;for(let t of this.placements.keys())t.isDrawSuppressed=!1;this.placements.clear(),this.publishGroupStats()}dispose(){this.teardown(),this.page=null}publishGroupStats(){let t=0;for(let e of this.groups){let i=e.memberCount;i>0&&(t+=i-1)}this.stats.instancingGroups=this.groups.length,this.stats.instancedDrawsSaved=t}}});function B$(t,e,i){i.length=0;let{axis:n,sign:r,limit:s}=e;for(let a=0;a<t.length;a++){let o=t[a],l=t[(a+1)%t.length],c=(n===0?o.px:n===1?o.py:o.pz)*r-s,h=(n===0?l.px:n===1?l.py:l.pz)*r-s,d=c<=0,u=h<=0;if(d&&i.push(o),d!==u){let p=c/(c-h);i.push({px:o.px+(l.px-o.px)*p,py:o.py+(l.py-o.py)*p,pz:o.pz+(l.pz-o.pz)*p,nx:o.nx+(l.nx-o.nx)*p,ny:o.ny+(l.ny-o.ny)*p,nz:o.nz+(l.nz-o.nz)*p})}}return i}function U$(t,e,i,n,r,s,a,o,l){let c=t.geometry,h=c.getAttribute("position");if(h===void 0||h.count===0)return!0;let d=c.getAttribute("normal"),u=c.getIndex(),p=u!==null?u.count:h.count;if(p>zk)return!0;let f=c.drawRange.start,g=f+(c.drawRange.count===1/0?p-f:Math.min(c.drawRange.count,p-f));Au.copy(t.objectToDecal),Bm.getNormalMatrix(Au);let m=[],y=[];for(let v=f;v+2<g;v+=3){let _=u!==null?u.getX(v):v,b=u!==null?u.getX(v+1):v+1,x=u!==null?u.getX(v+2):v+2;if(ja.fromBufferAttribute(h,_).applyMatrix4(Au),Bo.fromBufferAttribute(h,b).applyMatrix4(Au),Uo.fromBufferAttribute(h,x).applyMatrix4(Au),ja.z>i&&Bo.z>i&&Uo.z>i||ja.z<-i&&Bo.z<-i&&Uo.z<-i)continue;Nr.subVectors(Bo,ja),$A.subVectors(Uo,ja),Bl.crossVectors(Nr,$A);let w=Bl.length();if(!(w===0||Bl.z/w<=Nk)){if(m.length=0,d!==void 0)Nr.fromBufferAttribute(d,_).applyMatrix3(Bm),m.push({px:ja.x,py:ja.y,pz:ja.z,nx:Nr.x,ny:Nr.y,nz:Nr.z}),Nr.fromBufferAttribute(d,b).applyMatrix3(Bm),m.push({px:Bo.x,py:Bo.y,pz:Bo.z,nx:Nr.x,ny:Nr.y,nz:Nr.z}),Nr.fromBufferAttribute(d,x).applyMatrix3(Bm),m.push({px:Uo.x,py:Uo.y,pz:Uo.z,nx:Nr.x,ny:Nr.y,nz:Nr.z});else{Bl.divideScalar(w);for(let S of[ja,Bo,Uo])m.push({px:S.x,py:S.y,pz:S.z,nx:Bl.x,ny:Bl.y,nz:Bl.z})}for(let S of e){if(m.length===0)break;let A=B$(m,S,y);y=m,m=A}if(!(m.length<3)){if(a.length/3+3*(m.length-2)>Fk)return!1;for(let S=1;S+1<m.length;S++)for(let A of[m[0],m[S],m[S+1]]){l.push(A.px*n+.5,A.py*r+.5);let E=A.nx,P=A.ny,T=A.nz,R=Math.hypot(E,P,T);R>0?(E/=R,P/=R,T/=R):(E=0,P=0,T=1),a.push(A.px+E*s,A.py+P*s,A.pz+T*s),o.push(E,P,T)}}}}return!0}var zk,Fk,Nk,Au,Bm,ja,Bo,Uo,Nr,$A,Bl,Rv,i2,n2,r2,YA,kk,z$=F(()=>{et(),zk=15e5,Fk=3e5,Nk=.01,Au=new At,Bm=new ue,ja=new C,Bo=new C,Uo=new C,Nr=new C,$A=new C,Bl=new C}),F$=F(()=>{et(),Ye(),Qc(),Yn(),Wr(),z$(),rx(),Rv=new ci,i2=new ci,n2=new At,r2=new C,YA=class extends Hr{constructor(t,e,i){super(t,e),this.data=e,this.geometry=new Gt,this.lastSignature=[],this.nextSignature=[],this.scanned=[],this.lastParams={width:0,height:0,depth:0,offset:0},this.context=i;let n=this.data.geometry;this.lastParams={width:this.resolveNumber(n.width,0),height:this.resolveNumber(n.height,0),depth:this.resolveNumber(n.depth,0),offset:n.offset??0},this.geometry.userData={type:"DecalGeometry",parameters:{...this.lastParams}}}get isLOD(){return this.updateDecal(),!1}get isDecalObject(){return!0}resolveNumber(t,e){if(typeof t=="number")return t;let i=Number(this.context.shared.getVariable(t));return Number.isFinite(i)?i:e}currentParams(){let t=this.dataPatched.geometry;return{width:this.resolveNumber(t.width,this.lastParams.width),height:this.resolveNumber(t.height,this.lastParams.height),depth:this.resolveNumber(t.depth,this.lastParams.depth),offset:t.offset??0}}projectionRoot(){let t=this.parent;for(;t!==null&&Be.is(t);){if(t.data?.type==="Page")return t;t=t.parent}return this.context.scene}scanTargets(t,e,i){let n=this.scanned;n.length=0;let r=this.projectionRoot();if(r===null)return n;Rv.makeEmpty();for(let s=0;s<8;s++)r2.set((1&s?.5:-.5)*t,(2&s?.5:-.5)*e,(4&s?.5:-.5)*i).applyMatrix4(this.matrixWorld),Rv.expandByPoint(r2);return r.traverse(s=>{if(s===this||!Be.is(s)||!(s instanceof Xi)||s instanceof YA||s.dataPatched?.type!=="Mesh"||!s.visible||s.destroyedInAction||512&s.layers.mask)return;let a=s.geometry,o=a?.getAttribute("position");o===void 0||o.count===0||a.drawRange.count!==0&&(a.boundingBox===null&&a.computeBoundingBox(),i2.copy(a.boundingBox).applyMatrix4(s.matrixWorld),Rv.intersectsBox(i2)&&n.push(s))}),n}collectSignature(t,e,i){t.length=0,t.push(i.width,i.height,i.depth,i.offset);for(let n of this.matrixWorld.elements)t.push(n);for(let n of e){t.push(n.id,n.geometry.id);let r=n.geometry.getAttribute("position");t.push(r===void 0?-1:"version"in r?r.version:r.data.version);let s=n.geometry.getIndex();t.push(s!==null?s.version:-1),t.push(n.geometry.drawRange.count===1/0?-1:n.geometry.drawRange.count);for(let a of n.matrixWorld.elements)t.push(a)}}signaturesEqual(t,e){if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}updateDecal(){if(this.disposed)return!1;this.updateWorldMatrix(!0,!1);let t=this.currentParams(),e=this.scanTargets(t.width,t.height,t.depth);if(this.collectSignature(this.nextSignature,e,t),this.signaturesEqual(this.nextSignature,this.lastSignature))return!1;let i=this.lastSignature;this.lastSignature=this.nextSignature,this.nextSignature=i,this.lastParams=t,n2.copy(this.matrixWorld).invert();let n=e.map(r=>({geometry:r.geometry,objectToDecal:new At().multiplyMatrices(n2,r.matrixWorld)}));return this.geometry.dispose(),this.geometry=function(r,s){let a=Math.max(Math.abs(s.width),1e-6),o=Math.max(Math.abs(s.height),1e-6),l=Math.max(Math.abs(s.depth),1e-6),c=[{axis:0,sign:1,limit:a/2},{axis:0,sign:-1,limit:a/2},{axis:1,sign:1,limit:o/2},{axis:1,sign:-1,limit:o/2},{axis:2,sign:1,limit:l/2},{axis:2,sign:-1,limit:l/2}],h=[],d=[],u=[];for(let f of r)if(!U$(f,c,l/2,1/a,1/o,s.offset,h,d,u))break;let p=new Gt;return p.setAttribute("position",new Nt(h,3)),p.setAttribute("normal",new Nt(d,3)),p.setAttribute("uv",new Nt(u,2)),h.length===0?(p.setDrawRange(0,0),p.boundingSphere=new vr):p.computeBoundingSphere(),p}(n,t),this.geometry.userData={type:"DecalGeometry",parameters:{width:t.width,height:t.height,depth:t.depth}},Ku(this),Qu(this),this.resetBBoxNeedsUpdate(),!0}updateByPatchedOp(t,e,i){super.updateByPatchedOp(t,e,i),ri(t.path,["geometry"])&&this.resetBBoxNeedsUpdate()}updateEntityBoxSize(t,e){let i=this.currentParams();t.setScalar(0),e.set(i.width,i.height,i.depth).multiplyScalar(.5)}dispose(){super.dispose(),this.geometry.dispose()}}}),N$=F(()=>{et(),Wb(),Kc(),kk=class extends Zc(eE,up){constructor(t,e){super(),this.super_Entity(t,e),this.objectHelper.update(),this.matrixAutoUpdate=!0}updateState(t,e){this.updateState_Entity(t,e)}}});function c3(t,e,i){if(console.assert(e.type!==void 0),e.type==="Mesh")return function(n,r,s){let a;if(v1!==void 0&&r?.geometry&&"subdivisions"in r.geometry&&(r.geometry.subdivisions??0)>v1&&Object.assign(r.geometry,{subdivisions:v1}),r.geometry.type==="TextGeometry"||r.geometry.type==="InputGeometry"){let o=MS(r.geometry.type);return o?o(n,r,s):(Vn(r.geometry.type==="InputGeometry"?"textinputs":"text",`a Mesh with ${r.geometry.type}`),new Ai(n,r,s))}if(r.geometry.type==="SubdivGeometry")a=new fp(n,r,s);else if(r.geometry.type==="PathGeometry"||r.geometry.type==="VectorGeometry"||r.geometry.type==="ShapeBlendGeometry"){let o=MS(r.geometry.type);o?a=o(n,r,s):(Vn(r.geometry.type==="ShapeBlendGeometry"?"shape-blends":r.geometry.type==="PathGeometry"?"3d-paths":"vector-shapes",`a Mesh with ${r.geometry.type}`),a=new Ai(n,r,s))}else if(r.geometry.type==="BooleanGeometry")a=new oh(n,r,s);else if(r.geometry.type==="DecalGeometry")a=new YA(n,r,s);else if(r.geometry.type==="UIGeometry"){let o=MS("UIGeometry");o?a=o(n,r,s):(Vn("ui-2d","a Mesh with UIGeometry"),a=new Ai(n,r,s))}else a=new Ai(n,r,s);return a}(t,e,i);if(e.type==="Empty")return new $a(t,e);if(e.type==="Particle"){let n=SS("Particle");return n?n(t,e,i):(Vn("particles","a Particle system"),new $a(t,e))}if(e.type==="ParticleCollider")return new Ju(t,e,i);if(e.type==="Hair"){let n=SS("Hair");return n?n(t,e,i):(Vn("hair","a Hair System"),new $a(t,e))}if(e.type==="Splat")return new $a(t,e);if(e.type==="Bone")return new kk(t,e);if(e.type==="Page")return new dn(t,e,i);if(e.type==="PointLight")return new ox(t,e,i);if(e.type==="SpotLight")return new Kg(t,e,i);if(e.type==="DirectionalLight")return new Zg(t,e,i);if(e.type==="Component"||e.type==="Instance"){let n=SS(e.type);return n?n(t,e,i):(Vn("components",`a ${e.type}`),new $a(t,e))}return Vc.is(e.type)?new gn(t,e):(console.error(e),new $a(t,e))}function k$(t,e,i){let n=c3(t.identity,e,i),r=t.children,s=t.attachedPaths,a=t.parent,o=t.component,l=t.instances,c=t.overrideData,h=t.uuid,d=t.stateSelection;t.dispose();for(let u of Object.keys(t))delete t[u];Object.setPrototypeOf(t,Object.getPrototypeOf(n));for(let u of Object.keys(n))t[u]=n[u];t.children=[...t.children,...r],t.attachedPaths=s,t.parent=a,t.component=o,t.instances=l,t.uuid=h,t.overrideData=c,t.updateState(t.data,i),d&&t.changeSelectedState(d,i),t.resetBBoxNeedsUpdate()}var v1,Vk,jk,Gk,Jl,y1,Hk,ZA,V$=F(()=>{Yt(),Qg(),$g(),F$(),qr(),Zb(),Ik(),a3(),i3(),Hs(),H_(),N$(),al(),o3(),ke(),v1=function(){try{let t=window.location.href;if(t.includes("reducesubdiv=")){let e=t.indexOf("reducesubdiv=")+13;return parseInt(t.slice(e,e+1))}}catch{}}(),tl.createEntity=c3,tl.changeEntityProptotype=k$}),j$=F(()=>{Vk=class{constructor(){this._constraints=new Map}setConstraint(t,e){e===null?this._constraints.delete(t):this._constraints.set(t,e)}removeDependencies(t){this._constraints.delete(t)}applyConstraints(t){let e=new Set;this._constraints.forEach((i,n)=>{let r=[n,i],s=i;for(;this._constraints.has(s);){if(s=this._constraints.get(s),r.includes(s)){console.warn(`circular dependency detected: ${r.join(" -> ")}`);break}e.has(s)||r.push(s)}for(let a=r.length-2;a>=0;a--)if(!e.has(r[a])){let o=t.find(r[a]);o?o.applyPathSnapping(t):console.warn(`missing entity ${r[a]}`),e.add(r[a])}})}findDependency(t,e){let i=t;for(;this._constraints.has(i);)if(i=this._constraints.get(i),i===e)return!0;return!1}}}),G$=F(()=>{jk="AGFzbQEAAAAADwhkeWxpbmsuMAEEAAAAAAETA2AAAGAIf39/f39/f38AYAABfwISAQNlbnYGbWVtb3J5AgMAgIAEAwQDAAECBzkDEV9fd2FzbV9jYWxsX2N0b3JzAAALc29ydEluZGV4ZXMAARNlbXNjcmlwdGVuX3Rsc19pbml0AAIK3gMDAwABC9IDAwF/BnwBfgJAIAdFDQAgAysDUCEMIAMrAzAhDSADKwMQIQ5BACEDRP///////+9/IQtEAAAAAAAAEAAhCgNAIAIgA0ECdGoCfyAOIAEgA0EMbGoiCCoCALuiIA0gCCoCBLuioCAMIAgqAgi7oqBEAAAAAAAAsECiIgmZRAAAAAAAAOBBYwRAIAmqDAELQYCAgIB4CzYCACAJIAsgCSALYxshCyAJIAogCSAKZBshCiADQQFqIgMgB0cNAAsgB0UNACAGuCAKIAuhoyEJQQAhAwNAAn8gCSACIANBAnRqIgEoAgC3IAuhoiIKmUQAAAAAAADgQWMEQCAKqgwBC0GAgICAeAshCCABIAg2AgAgBCAIQQJ0aiIBIAEoAgBBAWo2AgAgA0EBaiIDIAdHDQALCyAGQQJPBEAgBCgCACEIQQEhAwNAIAQgA0ECdGoiASABKAIAIAhqIgg2AgAgA0EBaiIDIAZHDQALCyAHQQFrIgGtIQ8DQCAEIAIgD6dBAnQiA2ooAgBBAnRqIgcgBygCAEEBayIHNgIAIAUgASAHa0ECdGogACADaigCADYCACAPUCEDIA9CAX0hDyADRQ0ACyAGBEAgBEEAIAZBAnT8CwALCwQAQQAL"}),H$=F(()=>{Gk=`
|
|
4171
4171
|
function sortWorker(self) {
|
|
4172
4172
|
let wasmInstance;
|
|
@@ -9842,11 +9842,11 @@ void main() {
|
|
|
9842
9842
|
void main() {
|
|
9843
9843
|
vec4 texel = texture2D( tDiffuse, vUv );
|
|
9844
9844
|
gl_FragColor = texel;
|
|
9845
|
-
}`}),VQ=new class{constructor(t){this._mesh=new xi(kQ,t)}dispose(){this._mesh.geometry.dispose()}render(t){t.render(this._mesh,NQ)}get material(){return this._mesh.material}set material(t){this._mesh.material=t}}(LV),G2=null,H2=null,jQ=me.identity(),BV=class{constructor(t,e,i,n){var r;this.uuid=t,this.width=e,this.height=i,this.context=n,this.enabled=!0,this.isScreenSpace=!1,this.dpr=window.devicePixelRatio,this.isFrameDirty=!1,this.onRenderRequestedDownstream=()=>{this.isFrameDirty=!0,this.isScreenSpace||lg.add(this),this.context.shared.requestRender()},this._innerApplySize=()=>{let s=this.width,a=this.height;this.renderer.dpr=$5(s,a,this.dpr,this.isScreenSpace),this.renderer.setSize(s,a)},this.onFrameOverrideObjectEvent=s=>{if(s.target?.uuid!==void 0){let a=this.frameRoot?.find(s.target.uuid);a&&a.dispatchEvent({...s,target:a})}},this.scene2d=new I3(Ot.generateUUID(),rA.defaultData,{dpr:window.devicePixelRatio,shared:n.shared}),this.canvas=(G2===null&&(G2=document.createElement("canvas")),G2),this.renderer=(r=this.canvas,H2===null&&(H2=new IQ(r)),H2),this.promise=this.init(),this.renderTarget=new Ne(1,1,{type:qn,stencilBuffer:!1,depthBuffer:!1}),n.shared.addUIBuffer(this.uuid,this.renderTarget),this.textureHolder=n.shared.uiBuffer(this.uuid)}get canvasTexture(){return this._canvasTexture||(this._canvasTexture=new uz(this.canvas)),this._canvasTexture}async init(){await this.renderer.init(),this.renderer.uiFontReady?.then(()=>{this.frameOverride&&this.onRenderRequestedDownstream()})}render(t){if(this.isFrameDirty){if(this.isFrameDirty=!1,this._innerApplySize(),this.renderer.clear(),this.frameOverride?.draw(this.renderer),this.renderer.render(),this.canvasTexture.needsUpdate=!0,t.blitTextureToTarget)t.blitTextureToTarget(this.canvasTexture,this.renderTarget);else{LV.uniforms.tDiffuse.value=this.canvasTexture;let e=t.getRenderTarget();t.setRenderTarget(this.renderTarget),t.clear(),VQ.render(t),t.setRenderTarget(e)}this.textureHolder?.setNeedsUpdate(!0)}}updateEntity2DByOp(t,e,i,n){this.scene2d.updateEntityByOp(t,e,i,n),this.applySize()}updateTreeByOp(t,e){this.scene2d.updateTreeByOp(t,e),this.applySize()}applyOverrides(t){if(this.frameOverride&&this.frameRoot){this.frameOverride.position=[0,0],this.frameOverride.rotation=0;let e=t?.width??this.width,i=t?.height??this.height;this.frameOverride.width=e,this.frameOverride.height=i,this.frameOverride.localMatrix=jQ,this.isScreenSpace&&(this.frameOverride.fill.color=Je.from0to1([0,0,0,0])),this.frameOverride.data={...this.frameOverride.data,width:e,height:i},UV({objectOverride:this.frameOverride,objectRoot:this.frameRoot,newParentWidth:this.frameOverride.width,newParentHeight:this.frameOverride.height,initialParentWidth:this.frameRoot.width,initialParentHeight:this.frameRoot.height}),this.frameOverride.updateWorldMatrix(!0,!1,!0)}}applySize(t,e=window.devicePixelRatio){let i=Math.max(1,t?.width??this.width),n=Math.max(1,t?.height??this.height);this.dpr=e,this.width=i,this.height=n,this._innerApplySize();let r=function(s,a,o,l){let c=$5(s,a,o,l),h=Math.max(o,512/Math.min(s,a)),d=Math.min(h,c);return{width:Math.max(1,Math.ceil(s*d)),height:Math.max(1,Math.ceil(a*d))}}(i,n,e,this.isScreenSpace);this.renderTarget.setSize(r.width,r.height),this._canvasTexture?.dispose(),this._canvasTexture=void 0,this.applyOverrides(t),this.frameOverride?.requestRender()}applyFrame(t){let e=this.context.scene.find2D(t);if(e&&e instanceof so)return this.disposeFrameOverride(),this.frameRoot=e,this.frameOverride=e.clone({dpr:this.renderer.dpr,shared:this.context.shared}),this.scene2d.add(this.frameOverride),this.applySize(),this.frame?.addEventListener("render",this.onRenderRequestedDownstream),this.frameOverride.traverse(i=>{i.addEventListener("beginState",this.onFrameOverrideObjectEvent),i.addEventListener("completeState",this.onFrameOverrideObjectEvent)}),this.frame?.requestRender(),e}get frame(){return this.frameOverride}get frameId(){return this.frame?.uuid}find(t){return this.scene2d.find(t)}get texture(){return this.textureHolder?.getTexture(1001)}disposeFrameOverride(){this.frameOverride?.removeEventListener("render",this.onRenderRequestedDownstream),this.frameOverride?.traverse(t=>{t.removeEventListener("beginState",this.onFrameOverrideObjectEvent),t.removeEventListener("completeState",this.onFrameOverrideObjectEvent)}),this.frameOverride&&this.scene2d.remove(this.frameOverride)}};function UV({objectOverride:t,objectRoot:e,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:s}){if(t instanceof so&&e instanceof so||t instanceof lh&&e instanceof lh)for(let a=0,o=t.children.length;a<o;a++){let l=t.children[a],c=e.children[a];l&&c&&l.uuid===c.uuid&&GQ({objectOverride:l,objectRoot:c,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:s})}}function GQ({objectOverride:t,objectRoot:e,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:s}){let[a,o]=function(d){if(W2(d))return[d.width,d.height];if(d instanceof yb){let[u,p]=d.getHalfSize();return[2*u,2*p]}if(d instanceof lh){let[u,p]=d.recursiveBBox.getHalfSize();return[2*u,2*p]}return[0,0]}(e),{width:l,height:c,position:h}=OV({constraints:t.data,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:s,objectInitialWidth:a,objectInitialHeight:o,objectInitialPosition:e.position});if(t.position=h,t.data={...t.data,position:h},t.states)for(let d in t.states)HQ({stateId:d,objectOverride:t,objectRoot:e,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:s});if(W2(t)||t instanceof lh)W2(t)&&(t.width=l,t.height=c,t.data={...t.data,width:l,height:c}),UV({objectOverride:t,objectRoot:e,newParentWidth:l,newParentHeight:c,initialParentWidth:a,initialParentHeight:o});else if(t instanceof yb){let d=e,u=a!==0?l/a:1,p=o!==0?c/o:1;t.path=function(f,g=1,m=1){if(g<=0||m<=0)return f;if(RV(f))return console.warn("Cannot scale invalid path",f),j2([]);if(g===1&&m===1)return f;try{return j2((0,FQ.parseSVG)(f).map(y=>{let v={...y};return"x"in v&&(v.x=v.x*g),"y"in v&&(v.y=v.y*m),"x1"in v&&(v.x1=v.x1*g),"x2"in v&&(v.x2=v.x2*g),"y1"in v&&(v.y1=v.y1*m),"y2"in v&&(v.y2=v.y2*m),"rx"in v&&(v.rx=v.rx*g),"ry"in v&&(v.ry=v.ry*m),v}))}catch(y){return console.warn("Error parsing SVG path",y),j2([])}}(d.path,u,p),t.data={...t.data,path:t.path}}}function HQ({stateId:t,objectOverride:e,objectRoot:i,newParentWidth:n,newParentHeight:r,initialParentWidth:s,initialParentHeight:a}){let o=e.states?.[t],l=i.states?.[t];if(o&&l){let{width:c,height:h,position:d}=OV({constraints:e.data,newParentWidth:n,newParentHeight:r,initialParentWidth:s,initialParentHeight:a,objectInitialWidth:Bc.isResizeable(l)?l.width:0,objectInitialHeight:Bc.isResizeable(l)?l.height:0,objectInitialPosition:l.position});Object.assign(e.states[t],{position:d}),Bc.isResizeable(o)&&Object.assign(e.states[t],{width:c,height:h})}}function W2(t){return t instanceof e0||t instanceof so||t instanceof D3||t instanceof R3}ex();var Y5,WQ=class extends Ai{constructor(t,e,i){super(t,e,i),this.isUIObject=!0,this.uiCanvas=new BV(t+"-canvas",e.geometry.width,e.geometry.height,i),this.uiCanvas.promise.then(()=>{this.applyFrame(this.dataPatched.geometry.frame,i.shared)})}updateByPatchedOpGeometry(t,e,i){super.updateByPatchedOpGeometry(t,e,i),t.type===0&&(t.props.frame!==void 0&&this.applyFrame(t.props.frame,i.shared),(t.props.width!==void 0||t.props.height!==void 0)&&this.applySize(t.props,i.shared))}applySize(t,e){let i=t?.width??this.dataPatched.geometry.width,n=t?.height??this.dataPatched.geometry.height;this.uiCanvas.applySize({width:i,height:n}),this.applyGeometryParametersFromFrame(e)}applyFrame(t,e){this.uiCanvas.applyFrame(t),this.applyGeometryParametersFromFrame(e),this.applyMaterialParametersFromFrame({shared:e})}applyGeometryParametersFromFrame(t){let e=this.frame;e&&(Object.assign(this.data,{geometry:Object.assign(this.data.geometry,{cornerRadius:e.cornerRadius,cornerType:0})}),Object.assign(this.dataPatched,{geometry:Object.assign(this.dataPatched.geometry,{cornerRadius:e.cornerRadius,cornerType:0})}),this.localGeometry?.dispose(),this.localGeometry=Ql(this.dataPatched.geometry,t,this.data.flatShading,this))}applyMaterialParametersFromFrame(t){let e=this.frame;if(e){let i=e.data.backgroundBlur;Object.assign(this.data.material.layers[0].data.texture,{image:this.uiCanvas.uuid}),Object.assign(this.data.material.layers[1].data,{roughness:i.radius,alpha:i.enabled?1:0}),Object.assign(this.dataPatched.material.layers[0].data.texture,{image:this.uiCanvas.uuid}),Object.assign(this.dataPatched.material.layers[1].data,{roughness:i.radius,alpha:i.enabled?1:0}),this.material.reset?.(this.dataPatched.material,t,!0)}}updateEntity2DByOp(t,e,i,n){this.uiCanvas.updateEntity2DByOp(t,e,i,n),t===this.frameId&&e.type===0&&(e.props.cornerRadius!==void 0?this.applyGeometryParametersFromFrame(n):ri(e.path,["backgroundBlur"])&&this.applyMaterialParametersFromFrame({shared:n}))}get frame(){return this.uiCanvas.frame}get frameId(){return this.frame?.uuid}removeInteractionGeometry(t){super.removeInteractionGeometry(t),this.applySize({},t)}updateGeometryInteractions(t,e){super.updateGeometryInteractions(t,e),this.applySize({width:t.width,height:t.height},e);let i={...this.data.geometry,...t};this.localGeometry?.dispose(),this.localGeometry=Ql(i,e,this.data.flatShading,this)}};ke(),xp("UIGeometry",(t,e,i)=>new WQ(t,e,i)),Xb=Y5={Scene2D:I3,UICanvas:BV,loadHanaUIRUNTIME:function(){return mb||(mb=async()=>async function(t,e){return await t.default(e?{module_or_path:e}:void 0),Object.getOwnPropertyDescriptor(t.Engine.prototype,"scene")||Object.defineProperty(t.Engine.prototype,"scene",{get:function(){let i=Object.create(t.SceneController.prototype);return i.__wbg_ptr=this.__wbg_ptr,i}}),{createEngine:i=>t.Engine.create(i,JSON.parse('{"schema":13,"scenes":[{"fi":0,"id":"32603ebf4-bd9a-54ba-c1e9-6645c3ee7a53","data":{"name":"Page","backgroundColor":[0,0,0,0],"objects":[]}}],"assets":{"images":{},"videos":{},"colors":{},"audios":{},"numbers":{},"booleans":{},"strings":{},"dynamicVariables":{"counters":{},"randoms":{},"timers":{},"times":{}},"fonts":{},"animations":{},"geometries":{},"emojiArt":{}},"publish":{"logo":true,"presentationSizing":"Contain","allowPageScroll":true,"showBackground":true},"framePublish":{},"components":{}}'),!0)}}(await Promise.resolve().then(()=>(sD(),rD)),B5??function(){let t=typeof process<"u"?"2.0.31":void 0;return`https://cdn.spline.design/@splinetool/runtime${t?`@${t}`:""}/build/hana-ui.wasm`}())),PV().then(()=>{})},setHanaUIWasmUrl:function(t){B5=t}},q_!==null&&Y5.setHanaUIWasmUrl(q_),wi("ui-2d"),hk(),et();var zV,q2,qQ=class{constructor(){this.type="ShapePath",this.color=new Jt,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new Km,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath?.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.currentPath?.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,r,s){return this.currentPath?.bezierCurveTo(t,e,i,n,r,s),this}splineThru(t){return this.currentPath?.splineThru(t),this}toShapes(){let t={loc:0,t:0};function e(c,h,d,u){let p=c.x,f=h.x,g=d.x,m=u.x,y=c.y,v=h.y,_=d.y,b=u.y,x=(m-g)*(y-_)-(b-_)*(p-g),w=(b-_)*(f-p)-(m-g)*(v-y),S=x/w,A=((f-p)*(y-_)-(v-y)*(p-g))/w;if(w===0&&x!==0||S<=0||S>=1||A<0||A>1)return null;if(x===0&&w===0){for(let E=0;E<2;E++){if(i(E===0?d:u,c,h),t.loc===0){let P=E===0?d:u;return{x:P.x,y:P.y,t:t.t}}if(t.loc===2)return{x:+(p+t.t*(f-p)).toPrecision(10),y:+(y+t.t*(v-y)).toPrecision(10),t:t.t}}return null}for(let E=0;E<2;E++)if(i(E===0?d:u,c,h),t.loc===0){let P=E===0?d:u;return{x:P.x,y:P.y,t:t.t}}return{x:+(p+S*(f-p)).toPrecision(10),y:+(y+S*(v-y)).toPrecision(10),t:S}}function i(c,h,d){let u,p=d.x-h.x,f=d.y-h.y,g=c.x-h.x,m=c.y-h.y,y=p*m-g*f;return c.x===h.x&&c.y===h.y?(t.loc=0,void(t.t=0)):c.x===d.x&&c.y===d.y?(t.loc=1,void(t.t=1)):void(y<-Number.EPSILON?t.loc=3:y>Number.EPSILON?t.loc=4:p*g<0||f*m<0?t.loc=5:Math.sqrt(p*p+f*f)<Math.sqrt(g*g+m*m)?t.loc=6:(u=p!==0?g/p:m/f,t.loc=2,t.t=u))}let n=0,r=999999999,s=-999999999,a=[];this.subPaths.forEach(c=>{let h=c.getPoints(),d=-999999999,u=999999999,p=-999999999,f=999999999;for(let g=0;g<h.length;g++){let m=h[g];m.y>d&&(d=m.y),m.y<u&&(u=m.y),m.x>p&&(p=m.x),m.x<f&&(f=m.x)}s<=p&&(s=p+1),r>=f&&(r=f-1),h.length&&a.push({curves:c.curves,points:h,isCW:aE.isClockWise(h),identifier:n++,boundingBox:new Lb(new it(f,u),new it(p,d))})});let o=a.map(c=>function(h,d,u,p,f){(f==null||f==="")&&(f="nonzero");let g=new it;h.boundingBox.getCenter(g);let m=function(w,S,A){let E=new it;S.getCenter(E);let P=[];return A.forEach(T=>{T.boundingBox.containsPoint(E)&&function(R,L){let D=[],U=[];for(let V=1;V<R.length;V++){let k=R[V-1],Y=R[V];for(let $=1;$<L.length;$++){let nt=e(k,Y,L[$-1],L[$]);nt!==null&&D.find(Q=>Q.t<=nt.t+Number.EPSILON&&Q.t>=nt.t-Number.EPSILON)===void 0&&(D.push(nt),U.push(new it(nt.x,nt.y)))}}return U}(w,T.points).forEach(R=>{P.push({identifier:T.identifier,isCW:T.isCW,point:R})})}),P.sort((T,R)=>T.point.x-R.point.x),P}([new it(u,g.y),new it(p,g.y)],h.boundingBox,d);m.sort((w,S)=>w.point.x-S.point.x);let y=[],v=[];m.forEach(w=>{w.identifier===h.identifier?y.push(w):v.push(w)});let _=y[0].point.x,b=[],x=0;for(;x<v.length&&v[x].point.x<_;)b.length>0&&b[b.length-1]===v[x].identifier?b.pop():b.push(v[x].identifier),x++;if(b.push(h.identifier),f==="evenodd"){let w=b.length%2==0,S=b[b.length-2];return{identifier:h.identifier,isHole:w,for:S}}if(f==="nonzero"){let w=!0,S=null,A=null;for(let E=0;E<b.length;E++){let P=b[E];d[P]&&(w?(A=d[P].isCW,w=!1,S=P):A!==d[P].isCW&&(A=d[P].isCW,w=!0))}return{identifier:h.identifier,isHole:w,for:S}}console.warn('fill-rule: "'+f+'" is currently not implemented.')}(c,a,r,s,this.userData?.style.fillRule)),l=[];return a.forEach(c=>{let h=o[c.identifier];if(h&&!h.isHole){let d=new xg;d.curves=c.curves,o.filter(u=>u?.isHole&&u.for===c.identifier).forEach(u=>{if(u){let p=a[u.identifier],f=new Km;f.curves=p.curves,d.holes.push(f)}}),l.push(d)}}),l}},FV=!1,Z5=new Promise(t=>{zV=t}),K5=!1;function Q5(){if(FV=!0,!K5)return q2||(q2=async function(){let t=await import("./opentype.js");zV(t),K5=!0}(),q2)}var XQ=new class{async load(t,e,i=()=>{}){let{load:n}=await Z5;n(t,(r,s)=>{r||!s?i(r??"Something went wrong"):e(s)})}async parse(t){let{parse:e,Bidi:i}=await Z5;try{let n=e(t),r=new i,s=a=>n.charToGlyphIndex(a.char);return r.registerModifier("glyphIndex",null,s),r.applyFeatures(n,n.defaultRenderOptions.features),{font:n,bidi:r}}catch(n){console.error(n)}}};function $Q(t,e){return e.state.glyphIndex===t||e.state.fina===t||e.state.medi===t||e.state.init===t}et(),jC(),ke(),xp("TextGeometry",(t,e,i)=>new P3(t,e,i));var J5={create:(t,e)=>new PA(t,e)};oA("TextGeometry",J5),oA("InputGeometry",J5),VC=class{constructor(t){this._arrayBuffer=new ArrayBuffer(1),this._isLoaded=!1,this._intercepted=!1,this._layoutErrorWarned=!1,this._isUserFont=t.isUserFont??!1,this._loadingPromise=this.load(t)}update(t){this._isLoaded=!1,this._isUserFont=t.isUserFont??!1,this._loadingPromise=this.load(t)}async load(t){try{this._layoutErrorWarned=!1;let e=await async function(i){let n,r,s=!1;if(i.url?(n=await async function(a){let o;try{o=await fetch(a)}catch(l){throw new Error(`could not fetch the font at ${a}: ${l}`)}if(!o.ok)throw new Error(`${o.status} ${o.statusText} fetching the font at ${a}`);return await o.arrayBuffer()}(i.url),r=i.url,s=i.url.startsWith("/")):i.data&&(n=i.data.buffer.slice(i.data.byteOffset,i.data.byteOffset+i.data.byteLength)),n){if(!FV)return{font:void 0,url:r,intercepted:s,arr:n,bidi:null};{let a=await XQ.parse(n);if(a)return{font:a.font,url:r,intercepted:s,arr:n,bidi:a.bidi}}}}(t);e&&(this._arrayBuffer=e.arr,this._url=e.url,this.font=e.font,this._intercepted=e.intercepted,this._isLoaded=!0,this._bidi=e.bidi)}catch(e){console.warn(`Could not load the font "${t.url??"(inline data)"}"`,e)}}warnLayoutError(t){this._layoutErrorWarned||(this._layoutErrorWarned=!0,console.warn(`Text layout failed for the font "${this._url??"(inline data)"}"`,t))}get url(){return this._url}get intercepted(){return this._intercepted}get isLoaded(){return this._isLoaded}get loadingPromise(){return this._loadingPromise}reverseLigaturesTable(t,e,i){if(!this._bidi)return[];let n=this._bidi;n.getTextGlyphs(e);let r=n.tokenizer.tokens,s=[],a=0,o=i.length===r.length;for(let l=0;l<i.length;l++){let c=i[l].index,h=String.fromCharCode(i[l].unicode),d=r[a];if($Q(c,d)||o)s.push({char:h,index:c,replacements:[d.state.glyphIndex],replacementChars:[d.char]}),a++;else{let u=d.char,p="",f=[d.state.glyphIndex],g=[],m=!1;for(;!m;)a++,p=e.charAt(a),u+=p,f.push(t.charToGlyphIndex(p)),g=t.stringToGlyphs(u),g.length===1&&g[0].index===c&&(m=!0),a>e.length&&(m=!0);s.push({char:h,index:c,replacements:f,replacementChars:Array.from(u)}),a++}}return s}generateShapes(t,e,i){if(!this._isLoaded)return;let n=this.font,r=e.fontSize/this.unitsPerEm,s=e.fontSize*e.lineHeight,a=t.map(y=>this.getTextWidth(y,e)),o=typeof e.width=="string"?Number(i.getVariable(e.width)):e.width,l=typeof e.height=="string"?Number(i.getVariable(e.height)):e.height,c=this.getCharWidth(`
|
|
9845
|
+
}`}),VQ=new class{constructor(t){this._mesh=new xi(kQ,t)}dispose(){this._mesh.geometry.dispose()}render(t){t.render(this._mesh,NQ)}get material(){return this._mesh.material}set material(t){this._mesh.material=t}}(LV),G2=null,H2=null,jQ=me.identity(),BV=class{constructor(t,e,i,n){var r;this.uuid=t,this.width=e,this.height=i,this.context=n,this.enabled=!0,this.isScreenSpace=!1,this.dpr=window.devicePixelRatio,this.isFrameDirty=!1,this.onRenderRequestedDownstream=()=>{this.isFrameDirty=!0,this.isScreenSpace||lg.add(this),this.context.shared.requestRender()},this._innerApplySize=()=>{let s=this.width,a=this.height;this.renderer.dpr=$5(s,a,this.dpr,this.isScreenSpace),this.renderer.setSize(s,a)},this.onFrameOverrideObjectEvent=s=>{if(s.target?.uuid!==void 0){let a=this.frameRoot?.find(s.target.uuid);a&&a.dispatchEvent({...s,target:a})}},this.scene2d=new I3(Ot.generateUUID(),rA.defaultData,{dpr:window.devicePixelRatio,shared:n.shared}),this.canvas=(G2===null&&(G2=document.createElement("canvas")),G2),this.renderer=(r=this.canvas,H2===null&&(H2=new IQ(r)),H2),this.promise=this.init(),this.renderTarget=new Ne(1,1,{type:qn,stencilBuffer:!1,depthBuffer:!1}),n.shared.addUIBuffer(this.uuid,this.renderTarget),this.textureHolder=n.shared.uiBuffer(this.uuid)}get canvasTexture(){return this._canvasTexture||(this._canvasTexture=new uz(this.canvas)),this._canvasTexture}async init(){await this.renderer.init(),this.renderer.uiFontReady?.then(()=>{this.frameOverride&&this.onRenderRequestedDownstream()})}render(t){if(this.isFrameDirty){if(this.isFrameDirty=!1,this._innerApplySize(),this.renderer.clear(),this.frameOverride?.draw(this.renderer),this.renderer.render(),this.canvasTexture.needsUpdate=!0,t.blitTextureToTarget)t.blitTextureToTarget(this.canvasTexture,this.renderTarget);else{LV.uniforms.tDiffuse.value=this.canvasTexture;let e=t.getRenderTarget();t.setRenderTarget(this.renderTarget),t.clear(),VQ.render(t),t.setRenderTarget(e)}this.textureHolder?.setNeedsUpdate(!0)}}updateEntity2DByOp(t,e,i,n){this.scene2d.updateEntityByOp(t,e,i,n),this.applySize()}updateTreeByOp(t,e){this.scene2d.updateTreeByOp(t,e),this.applySize()}applyOverrides(t){if(this.frameOverride&&this.frameRoot){this.frameOverride.position=[0,0],this.frameOverride.rotation=0;let e=t?.width??this.width,i=t?.height??this.height;this.frameOverride.width=e,this.frameOverride.height=i,this.frameOverride.localMatrix=jQ,this.isScreenSpace&&(this.frameOverride.fill.color=Je.from0to1([0,0,0,0])),this.frameOverride.data={...this.frameOverride.data,width:e,height:i},UV({objectOverride:this.frameOverride,objectRoot:this.frameRoot,newParentWidth:this.frameOverride.width,newParentHeight:this.frameOverride.height,initialParentWidth:this.frameRoot.width,initialParentHeight:this.frameRoot.height}),this.frameOverride.updateWorldMatrix(!0,!1,!0)}}applySize(t,e=window.devicePixelRatio){let i=Math.max(1,t?.width??this.width),n=Math.max(1,t?.height??this.height);this.dpr=e,this.width=i,this.height=n,this._innerApplySize();let r=function(s,a,o,l){let c=$5(s,a,o,l),h=Math.max(o,512/Math.min(s,a)),d=Math.min(h,c);return{width:Math.max(1,Math.ceil(s*d)),height:Math.max(1,Math.ceil(a*d))}}(i,n,e,this.isScreenSpace);this.renderTarget.setSize(r.width,r.height),this._canvasTexture?.dispose(),this._canvasTexture=void 0,this.applyOverrides(t),this.frameOverride?.requestRender()}applyFrame(t){let e=this.context.scene.find2D(t);if(e&&e instanceof so)return this.disposeFrameOverride(),this.frameRoot=e,this.frameOverride=e.clone({dpr:this.renderer.dpr,shared:this.context.shared}),this.scene2d.add(this.frameOverride),this.applySize(),this.frame?.addEventListener("render",this.onRenderRequestedDownstream),this.frameOverride.traverse(i=>{i.addEventListener("beginState",this.onFrameOverrideObjectEvent),i.addEventListener("completeState",this.onFrameOverrideObjectEvent)}),this.frame?.requestRender(),e}get frame(){return this.frameOverride}get frameId(){return this.frame?.uuid}find(t){return this.scene2d.find(t)}get texture(){return this.textureHolder?.getTexture(1001)}disposeFrameOverride(){this.frameOverride?.removeEventListener("render",this.onRenderRequestedDownstream),this.frameOverride?.traverse(t=>{t.removeEventListener("beginState",this.onFrameOverrideObjectEvent),t.removeEventListener("completeState",this.onFrameOverrideObjectEvent)}),this.frameOverride&&this.scene2d.remove(this.frameOverride)}};function UV({objectOverride:t,objectRoot:e,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:s}){if(t instanceof so&&e instanceof so||t instanceof lh&&e instanceof lh)for(let a=0,o=t.children.length;a<o;a++){let l=t.children[a],c=e.children[a];l&&c&&l.uuid===c.uuid&&GQ({objectOverride:l,objectRoot:c,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:s})}}function GQ({objectOverride:t,objectRoot:e,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:s}){let[a,o]=function(d){if(W2(d))return[d.width,d.height];if(d instanceof yb){let[u,p]=d.getHalfSize();return[2*u,2*p]}if(d instanceof lh){let[u,p]=d.recursiveBBox.getHalfSize();return[2*u,2*p]}return[0,0]}(e),{width:l,height:c,position:h}=OV({constraints:t.data,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:s,objectInitialWidth:a,objectInitialHeight:o,objectInitialPosition:e.position});if(t.position=h,t.data={...t.data,position:h},t.states)for(let d in t.states)HQ({stateId:d,objectOverride:t,objectRoot:e,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:s});if(W2(t)||t instanceof lh)W2(t)&&(t.width=l,t.height=c,t.data={...t.data,width:l,height:c}),UV({objectOverride:t,objectRoot:e,newParentWidth:l,newParentHeight:c,initialParentWidth:a,initialParentHeight:o});else if(t instanceof yb){let d=e,u=a!==0?l/a:1,p=o!==0?c/o:1;t.path=function(f,g=1,m=1){if(g<=0||m<=0)return f;if(RV(f))return console.warn("Cannot scale invalid path",f),j2([]);if(g===1&&m===1)return f;try{return j2((0,FQ.parseSVG)(f).map(y=>{let v={...y};return"x"in v&&(v.x=v.x*g),"y"in v&&(v.y=v.y*m),"x1"in v&&(v.x1=v.x1*g),"x2"in v&&(v.x2=v.x2*g),"y1"in v&&(v.y1=v.y1*m),"y2"in v&&(v.y2=v.y2*m),"rx"in v&&(v.rx=v.rx*g),"ry"in v&&(v.ry=v.ry*m),v}))}catch(y){return console.warn("Error parsing SVG path",y),j2([])}}(d.path,u,p),t.data={...t.data,path:t.path}}}function HQ({stateId:t,objectOverride:e,objectRoot:i,newParentWidth:n,newParentHeight:r,initialParentWidth:s,initialParentHeight:a}){let o=e.states?.[t],l=i.states?.[t];if(o&&l){let{width:c,height:h,position:d}=OV({constraints:e.data,newParentWidth:n,newParentHeight:r,initialParentWidth:s,initialParentHeight:a,objectInitialWidth:Bc.isResizeable(l)?l.width:0,objectInitialHeight:Bc.isResizeable(l)?l.height:0,objectInitialPosition:l.position});Object.assign(e.states[t],{position:d}),Bc.isResizeable(o)&&Object.assign(e.states[t],{width:c,height:h})}}function W2(t){return t instanceof e0||t instanceof so||t instanceof D3||t instanceof R3}ex();var Y5,WQ=class extends Ai{constructor(t,e,i){super(t,e,i),this.isUIObject=!0,this.uiCanvas=new BV(t+"-canvas",e.geometry.width,e.geometry.height,i),this.uiCanvas.promise.then(()=>{this.applyFrame(this.dataPatched.geometry.frame,i.shared)})}updateByPatchedOpGeometry(t,e,i){super.updateByPatchedOpGeometry(t,e,i),t.type===0&&(t.props.frame!==void 0&&this.applyFrame(t.props.frame,i.shared),(t.props.width!==void 0||t.props.height!==void 0)&&this.applySize(t.props,i.shared))}applySize(t,e){let i=t?.width??this.dataPatched.geometry.width,n=t?.height??this.dataPatched.geometry.height;this.uiCanvas.applySize({width:i,height:n}),this.applyGeometryParametersFromFrame(e)}applyFrame(t,e){this.uiCanvas.applyFrame(t),this.applyGeometryParametersFromFrame(e),this.applyMaterialParametersFromFrame({shared:e})}applyGeometryParametersFromFrame(t){let e=this.frame;e&&(Object.assign(this.data,{geometry:Object.assign(this.data.geometry,{cornerRadius:e.cornerRadius,cornerType:0})}),Object.assign(this.dataPatched,{geometry:Object.assign(this.dataPatched.geometry,{cornerRadius:e.cornerRadius,cornerType:0})}),this.localGeometry?.dispose(),this.localGeometry=Ql(this.dataPatched.geometry,t,this.data.flatShading,this))}applyMaterialParametersFromFrame(t){let e=this.frame;if(e){let i=e.data.backgroundBlur;Object.assign(this.data.material.layers[0].data.texture,{image:this.uiCanvas.uuid}),Object.assign(this.data.material.layers[1].data,{roughness:i.radius,alpha:i.enabled?1:0}),Object.assign(this.dataPatched.material.layers[0].data.texture,{image:this.uiCanvas.uuid}),Object.assign(this.dataPatched.material.layers[1].data,{roughness:i.radius,alpha:i.enabled?1:0}),this.material.reset?.(this.dataPatched.material,t,!0)}}updateEntity2DByOp(t,e,i,n){this.uiCanvas.updateEntity2DByOp(t,e,i,n),t===this.frameId&&e.type===0&&(e.props.cornerRadius!==void 0?this.applyGeometryParametersFromFrame(n):ri(e.path,["backgroundBlur"])&&this.applyMaterialParametersFromFrame({shared:n}))}get frame(){return this.uiCanvas.frame}get frameId(){return this.frame?.uuid}removeInteractionGeometry(t){super.removeInteractionGeometry(t),this.applySize({},t)}updateGeometryInteractions(t,e){super.updateGeometryInteractions(t,e),this.applySize({width:t.width,height:t.height},e);let i={...this.data.geometry,...t};this.localGeometry?.dispose(),this.localGeometry=Ql(i,e,this.data.flatShading,this)}};ke(),xp("UIGeometry",(t,e,i)=>new WQ(t,e,i)),Xb=Y5={Scene2D:I3,UICanvas:BV,loadHanaUIRUNTIME:function(){return mb||(mb=async()=>async function(t,e){return await t.default(e?{module_or_path:e}:void 0),Object.getOwnPropertyDescriptor(t.Engine.prototype,"scene")||Object.defineProperty(t.Engine.prototype,"scene",{get:function(){let i=Object.create(t.SceneController.prototype);return i.__wbg_ptr=this.__wbg_ptr,i}}),{createEngine:i=>t.Engine.create(i,JSON.parse('{"schema":13,"scenes":[{"fi":0,"id":"32603ebf4-bd9a-54ba-c1e9-6645c3ee7a53","data":{"name":"Page","backgroundColor":[0,0,0,0],"objects":[]}}],"assets":{"images":{},"videos":{},"colors":{},"audios":{},"numbers":{},"booleans":{},"strings":{},"dynamicVariables":{"counters":{},"randoms":{},"timers":{},"times":{}},"fonts":{},"animations":{},"geometries":{},"emojiArt":{}},"publish":{"logo":true,"presentationSizing":"Contain","allowPageScroll":true,"showBackground":true},"framePublish":{},"components":{}}'),!0)}}(await Promise.resolve().then(()=>(sD(),rD)),B5??function(){let t=typeof process<"u"?"2.0.32":void 0;return`https://cdn.spline.design/@splinetool/runtime${t?`@${t}`:""}/build/hana-ui.wasm`}())),PV().then(()=>{})},setHanaUIWasmUrl:function(t){B5=t}},q_!==null&&Y5.setHanaUIWasmUrl(q_),wi("ui-2d"),hk(),et();var zV,q2,qQ=class{constructor(){this.type="ShapePath",this.color=new Jt,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new Km,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath?.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.currentPath?.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,r,s){return this.currentPath?.bezierCurveTo(t,e,i,n,r,s),this}splineThru(t){return this.currentPath?.splineThru(t),this}toShapes(){let t={loc:0,t:0};function e(c,h,d,u){let p=c.x,f=h.x,g=d.x,m=u.x,y=c.y,v=h.y,_=d.y,b=u.y,x=(m-g)*(y-_)-(b-_)*(p-g),w=(b-_)*(f-p)-(m-g)*(v-y),S=x/w,A=((f-p)*(y-_)-(v-y)*(p-g))/w;if(w===0&&x!==0||S<=0||S>=1||A<0||A>1)return null;if(x===0&&w===0){for(let E=0;E<2;E++){if(i(E===0?d:u,c,h),t.loc===0){let P=E===0?d:u;return{x:P.x,y:P.y,t:t.t}}if(t.loc===2)return{x:+(p+t.t*(f-p)).toPrecision(10),y:+(y+t.t*(v-y)).toPrecision(10),t:t.t}}return null}for(let E=0;E<2;E++)if(i(E===0?d:u,c,h),t.loc===0){let P=E===0?d:u;return{x:P.x,y:P.y,t:t.t}}return{x:+(p+S*(f-p)).toPrecision(10),y:+(y+S*(v-y)).toPrecision(10),t:S}}function i(c,h,d){let u,p=d.x-h.x,f=d.y-h.y,g=c.x-h.x,m=c.y-h.y,y=p*m-g*f;return c.x===h.x&&c.y===h.y?(t.loc=0,void(t.t=0)):c.x===d.x&&c.y===d.y?(t.loc=1,void(t.t=1)):void(y<-Number.EPSILON?t.loc=3:y>Number.EPSILON?t.loc=4:p*g<0||f*m<0?t.loc=5:Math.sqrt(p*p+f*f)<Math.sqrt(g*g+m*m)?t.loc=6:(u=p!==0?g/p:m/f,t.loc=2,t.t=u))}let n=0,r=999999999,s=-999999999,a=[];this.subPaths.forEach(c=>{let h=c.getPoints(),d=-999999999,u=999999999,p=-999999999,f=999999999;for(let g=0;g<h.length;g++){let m=h[g];m.y>d&&(d=m.y),m.y<u&&(u=m.y),m.x>p&&(p=m.x),m.x<f&&(f=m.x)}s<=p&&(s=p+1),r>=f&&(r=f-1),h.length&&a.push({curves:c.curves,points:h,isCW:aE.isClockWise(h),identifier:n++,boundingBox:new Lb(new it(f,u),new it(p,d))})});let o=a.map(c=>function(h,d,u,p,f){(f==null||f==="")&&(f="nonzero");let g=new it;h.boundingBox.getCenter(g);let m=function(w,S,A){let E=new it;S.getCenter(E);let P=[];return A.forEach(T=>{T.boundingBox.containsPoint(E)&&function(R,L){let D=[],U=[];for(let V=1;V<R.length;V++){let k=R[V-1],Y=R[V];for(let $=1;$<L.length;$++){let nt=e(k,Y,L[$-1],L[$]);nt!==null&&D.find(Q=>Q.t<=nt.t+Number.EPSILON&&Q.t>=nt.t-Number.EPSILON)===void 0&&(D.push(nt),U.push(new it(nt.x,nt.y)))}}return U}(w,T.points).forEach(R=>{P.push({identifier:T.identifier,isCW:T.isCW,point:R})})}),P.sort((T,R)=>T.point.x-R.point.x),P}([new it(u,g.y),new it(p,g.y)],h.boundingBox,d);m.sort((w,S)=>w.point.x-S.point.x);let y=[],v=[];m.forEach(w=>{w.identifier===h.identifier?y.push(w):v.push(w)});let _=y[0].point.x,b=[],x=0;for(;x<v.length&&v[x].point.x<_;)b.length>0&&b[b.length-1]===v[x].identifier?b.pop():b.push(v[x].identifier),x++;if(b.push(h.identifier),f==="evenodd"){let w=b.length%2==0,S=b[b.length-2];return{identifier:h.identifier,isHole:w,for:S}}if(f==="nonzero"){let w=!0,S=null,A=null;for(let E=0;E<b.length;E++){let P=b[E];d[P]&&(w?(A=d[P].isCW,w=!1,S=P):A!==d[P].isCW&&(A=d[P].isCW,w=!0))}return{identifier:h.identifier,isHole:w,for:S}}console.warn('fill-rule: "'+f+'" is currently not implemented.')}(c,a,r,s,this.userData?.style.fillRule)),l=[];return a.forEach(c=>{let h=o[c.identifier];if(h&&!h.isHole){let d=new xg;d.curves=c.curves,o.filter(u=>u?.isHole&&u.for===c.identifier).forEach(u=>{if(u){let p=a[u.identifier],f=new Km;f.curves=p.curves,d.holes.push(f)}}),l.push(d)}}),l}},FV=!1,Z5=new Promise(t=>{zV=t}),K5=!1;function Q5(){if(FV=!0,!K5)return q2||(q2=async function(){let t=await import("./opentype.js");zV(t),K5=!0}(),q2)}var XQ=new class{async load(t,e,i=()=>{}){let{load:n}=await Z5;n(t,(r,s)=>{r||!s?i(r??"Something went wrong"):e(s)})}async parse(t){let{parse:e,Bidi:i}=await Z5;try{let n=e(t),r=new i,s=a=>n.charToGlyphIndex(a.char);return r.registerModifier("glyphIndex",null,s),r.applyFeatures(n,n.defaultRenderOptions.features),{font:n,bidi:r}}catch(n){console.error(n)}}};function $Q(t,e){return e.state.glyphIndex===t||e.state.fina===t||e.state.medi===t||e.state.init===t}et(),jC(),ke(),xp("TextGeometry",(t,e,i)=>new P3(t,e,i));var J5={create:(t,e)=>new PA(t,e)};oA("TextGeometry",J5),oA("InputGeometry",J5),VC=class{constructor(t){this._arrayBuffer=new ArrayBuffer(1),this._isLoaded=!1,this._intercepted=!1,this._layoutErrorWarned=!1,this._isUserFont=t.isUserFont??!1,this._loadingPromise=this.load(t)}update(t){this._isLoaded=!1,this._isUserFont=t.isUserFont??!1,this._loadingPromise=this.load(t)}async load(t){try{this._layoutErrorWarned=!1;let e=await async function(i){let n,r,s=!1;if(i.url?(n=await async function(a){let o;try{o=await fetch(a)}catch(l){throw new Error(`could not fetch the font at ${a}: ${l}`)}if(!o.ok)throw new Error(`${o.status} ${o.statusText} fetching the font at ${a}`);return await o.arrayBuffer()}(i.url),r=i.url,s=i.url.startsWith("/")):i.data&&(n=i.data.buffer.slice(i.data.byteOffset,i.data.byteOffset+i.data.byteLength)),n){if(!FV)return{font:void 0,url:r,intercepted:s,arr:n,bidi:null};{let a=await XQ.parse(n);if(a)return{font:a.font,url:r,intercepted:s,arr:n,bidi:a.bidi}}}}(t);e&&(this._arrayBuffer=e.arr,this._url=e.url,this.font=e.font,this._intercepted=e.intercepted,this._isLoaded=!0,this._bidi=e.bidi)}catch(e){console.warn(`Could not load the font "${t.url??"(inline data)"}"`,e)}}warnLayoutError(t){this._layoutErrorWarned||(this._layoutErrorWarned=!0,console.warn(`Text layout failed for the font "${this._url??"(inline data)"}"`,t))}get url(){return this._url}get intercepted(){return this._intercepted}get isLoaded(){return this._isLoaded}get loadingPromise(){return this._loadingPromise}reverseLigaturesTable(t,e,i){if(!this._bidi)return[];let n=this._bidi;n.getTextGlyphs(e);let r=n.tokenizer.tokens,s=[],a=0,o=i.length===r.length;for(let l=0;l<i.length;l++){let c=i[l].index,h=String.fromCharCode(i[l].unicode),d=r[a];if($Q(c,d)||o)s.push({char:h,index:c,replacements:[d.state.glyphIndex],replacementChars:[d.char]}),a++;else{let u=d.char,p="",f=[d.state.glyphIndex],g=[],m=!1;for(;!m;)a++,p=e.charAt(a),u+=p,f.push(t.charToGlyphIndex(p)),g=t.stringToGlyphs(u),g.length===1&&g[0].index===c&&(m=!0),a>e.length&&(m=!0);s.push({char:h,index:c,replacements:f,replacementChars:Array.from(u)}),a++}}return s}generateShapes(t,e,i){if(!this._isLoaded)return;let n=this.font,r=e.fontSize/this.unitsPerEm,s=e.fontSize*e.lineHeight,a=t.map(y=>this.getTextWidth(y,e)),o=typeof e.width=="string"?Number(i.getVariable(e.width)):e.width,l=typeof e.height=="string"?Number(i.getVariable(e.height)):e.height,c=this.getCharWidth(`
|
|
9846
9846
|
`,e),h=e.horizontalAlign===1?c:0,d=this.getLineInitialOffsetX(a[0],o,e.horizontalAlign,t[0],c),u=this.getLineInitialOffsetY(s,t.length,l,r,e.verticalAlign),p=[],f=t.map(()=>[]),g=t.map(()=>[]);for(let y=0;y<t.length;y++){let v=t[y],_={features:{liga:!0},letterSpacing:e.letterSpacing},b=[];try{b=n.stringToGlyphs(v,_)}catch(E){this.warnLayoutError(E)}d=this.getLineInitialOffsetX(a[y],o,e.horizontalAlign,v,c);let x=[];try{x=this.reverseLigaturesTable(n,v,b)}catch(E){this.warnLayoutError(E)}let w=this.computeSpaceWidthForLine(t,y,e,i),S=0,A=b[0];A&&e.horizontalAlign===2&&A.leftSideBearing!==void 0&&(d-=A.leftSideBearing*r);try{this.font?.forEachGlyph(v,d,u,e.fontSize,_,(E,P,T,R,L)=>{let D=E.index===0?`
|
|
9847
9847
|
`:E.unicode?String.fromCharCode(E.unicode):void 0,U=x[S],V=0;if(D===`
|
|
9848
9848
|
`)V=h;else if(D===" ")V=w;else{let k=this.createPath(E,r,P,T,e);k&&(V=k.offsetX,p.push(k.path))}if(U&&U.replacements.length!==1){let k=U.replacements.map(Q=>(n.glyphs.get(Q).advanceWidth??0)*r),Y=k.reduce((Q,rt)=>Q+rt,0),$=k.map(Q=>Q/Y),nt=P;for(let Q=0;Q<$.length;Q++){let rt=V*$[Q];g[y].push([nt,T]),f[y].push(rt),nt+=rt}}else g[y].push([P,T]),f[y].push(V);S++})}catch(E){this.warnLayoutError(E)}u-=s}let m=[];for(let y=0,v=p.length;y<v;y++)m.push(...p[y].toShapes());return{shapes:m,charWidths:f,lineWidths:a,charCoords:g}}get isUserFont(){return this._isUserFont}get arrayBuffer(){return this._arrayBuffer}get ascender(){return this.font?.ascender??0}get descender(){return this.font?.descender??0}get familyName(){return this.font?.names.fontFamily??""}get subfamilyName(){return this.font?.names.fontSubfamily??""}get unitsPerEm(){return this.font?.unitsPerEm??1}getLineInitialOffsetX(t,e,i,n,r){return(i===3||i===2)&&n.indexOf(`
|
|
9849
|
-
`)>=0&&(t-=r),i===3?.5*e-.5*t:i===2?e-t:0}getLineInitialOffsetY(t,e,i,n,r){let s=e*t,a=t-Math.abs(this.ascender-this.descender)*n,o=-this.ascender*n-a/2;return r===3?-(i-s-o):r===2?-(.5*i-.5*s-o):o}createPath(t,e,i,n,r){let s=t.getPath(i,-n,r.fontSize,{kerning:!1,letterSpacing:r.letterSpacing});if(!s)return void console.error('THREE.Font: character "'+t+'" does not exists in font family '+this.familyName+".");let a=new qQ,o=(t.advanceWidth??1)*e;if(t)for(let l of s.commands){let c=a.currentPath?.currentPoint;if(!c||l.type==="Z"||c.x!==l.x||-c.y!==l.y)switch(l.type){case"M":a.moveTo(l.x,-l.y);break;case"L":a.lineTo(l.x,-l.y);break;case"Q":a.quadraticCurveTo(l.x1,-l.y1,l.x,-l.y);break;case"C":a.bezierCurveTo(l.x1,-l.y1,l.x2,-l.y2,l.x,-l.y)}}return a.subPaths.forEach(l=>{let c=function(h){if(h.length){let d=h[0];if(d instanceof ps)return d.v1;if(d instanceof zs||d instanceof Go)return d.v0}}(l.curves);c!==void 0&&l.currentPoint.distanceTo(c)>0&&l.lineTo(c.x,c.y)}),{offsetX:o,path:a}}getCharWidth(t,e){try{return this.font?.getAdvanceWidth(t,e.fontSize,{kerning:!0,letterSpacing:e.letterSpacing})??0}catch(i){return this.warnLayoutError(i),0}}getTextWidth(t,e){try{return this.font?.getAdvanceWidth(t,e.fontSize,{kerning:!0,letterSpacing:e.letterSpacing})??0}catch(i){return this.warnLayoutError(i),0}}computeSpaceWidthForLine(t,e,i,n){let r=this.getCharWidth(" ",i),s=t[e];if(s){let a=this.countSpaces(s.trimEnd());if(i.horizontalAlign===4&&e<t.length-1&&a)return((typeof i.width=="string"?Number(n.getVariable(i.width)):i.width)-(this.getTextWidth(s,i)-a*r))/a}return r}countSpaces(t){return(t.match(/ /g)||[]).length}},wi("text"),Yt();var NV=null;function tB(){return NV}function YQ(t){let e=!1;return t.scene.objects.forEach(i=>{i.data.type==="Page"&&!e&&i.data.publish.gameControlObject&&jc.traverseModuleInstances(t,i.id,(n,r,s)=>{for(let a of s)a.data.type==="GameControl"&&a.data.navmesh.enabled&&(e=!0)})}),e}ii();var oy=(t,e)=>{let i=e.x-t.x,n=e.y-t.y;return Math.sqrt(i*i+n*n)},X2=t=>t*(Math.PI/180),ly=new Map,_b=(t,e,i)=>{let n,r=e.split(/[ ,]+/g);for(let s=0;s<r.length;s+=1)n=r[s],t.addEventListener?t.addEventListener(n,i,!1):t.attachEvent&&t.attachEvent(n,i)},bb=(t,e,i)=>{let n,r=e.split(/[ ,]+/g);for(let s=0;s<r.length;s+=1)n=r[s],t.removeEventListener?t.removeEventListener(n,i):t.detachEvent&&t.detachEvent(n,i)},kV=t=>(t.preventDefault(),t.type.match(/^touch/)?t.changedTouches:t),eB=()=>{if(!(typeof window>"u"))return{x:window.pageXOffset!==void 0?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,y:window.pageYOffset!==void 0?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop}},$2=(t,e)=>{e.top||e.right||e.bottom||e.left?(t.style.top=e.top,t.style.right=e.right,t.style.bottom=e.bottom,t.style.left=e.left):(t.style.left=e.x+"px",t.style.top=e.y+"px")},Y2=(t,e,i)=>{let n=VV(t);for(let r in n)if(Object.prototype.hasOwnProperty.call(n,r))if(typeof e=="string")n[r]=e+" "+i;else{let s="";for(let a=0,o=e.length;a<o;a+=1)s+=e[a]+" "+i+", ";n[r]=s.slice(0,-2)}return n},VV=t=>{let e={};return e[t]="",["webkit","Moz","o"].forEach(function(i){e[i+t.charAt(0).toUpperCase()+t.slice(1)]=""}),e},Z2=(t,e)=>{for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},MT=(t,e)=>{if(t.length)for(let i=0,n=t.length;i<n;i+=1)e(t[i]);else e(t)};typeof window<"u"&&(jV="ontouchstart"in window,GV=!!window.PointerEvent,HV=!!window.MSPointerEvent);var jV,GV,HV,$d,iB={start:"mousedown",move:"mousemove",end:"mouseup"},Zf={};function mc(){}GV?$d={start:"pointerdown",move:"pointermove",end:"pointerup, pointercancel"}:HV?$d={start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:jV?($d={start:"touchstart",move:"touchmove",end:"touchend, touchcancel"},Zf=iB):$d=iB,mc.prototype.on=function(t,e){var i,n=this,r=t.split(/[ ,]+/g);n._handlers_=n._handlers_||{};for(var s=0;s<r.length;s+=1)i=r[s],n._handlers_[i]=n._handlers_[i]||[],n._handlers_[i].push(e);return n},mc.prototype.off=function(t,e){var i=this;return i._handlers_=i._handlers_||{},t===void 0?i._handlers_={}:e===void 0?i._handlers_[t]=null:i._handlers_[t]&&i._handlers_[t].indexOf(e)>=0&&i._handlers_[t].splice(i._handlers_[t].indexOf(e),1),i},mc.prototype.trigger=function(t,e){var i,n=this,r=t.split(/[ ,]+/g);n._handlers_=n._handlers_||{};for(var s=0;s<r.length;s+=1)i=r[s],n._handlers_[i]&&n._handlers_[i].length&&n._handlers_[i].forEach(function(a){a.call(n,{type:i,target:n},e)})},mc.prototype.config=function(t){var e=this;e.options=e.defaults||{},t&&(e.options=((i,n)=>{let r={};for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&Object.prototype.hasOwnProperty.call(n,s)?r[s]=n[s]:Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s]);return r})(e.options,t))},mc.prototype.bindEvt=function(t,e){var i=this;return i._domHandlers_=i._domHandlers_||{},i._domHandlers_[e]=function(){typeof i["on"+e]=="function"?i["on"+e].apply(i,arguments):console.warn('[WARNING] : Missing "on'+e+'" handler.')},_b(t,$d[e],i._domHandlers_[e]),Zf[e]&&_b(t,Zf[e],i._domHandlers_[e]),i},mc.prototype.unbindEvt=function(t,e){var i=this;return i._domHandlers_=i._domHandlers_||{},bb(t,$d[e],i._domHandlers_[e]),Zf[e]&&bb(t,Zf[e],i._domHandlers_[e]),delete i._domHandlers_[e],this};var O3=mc;function zn(t,e){return this.identifier=e.identifier,this.position=e.position,this.frontPosition=e.frontPosition,this.collection=t,this.defaults={size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,mode:"dynamic",zone:document.body,lockX:!1,lockY:!1,shape:"circle"},this.config(e),this.options.mode==="dynamic"&&(this.options.restOpacity=0),this.id=zn.id,zn.id+=1,this.buildEl().stylize(),this.instance={el:this.ui.el,on:this.on.bind(this),off:this.off.bind(this),show:this.show.bind(this),hide:this.hide.bind(this),add:this.addToDom.bind(this),remove:this.removeFromDom.bind(this),destroy:this.destroy.bind(this),setPosition:this.setPosition.bind(this),resetDirection:this.resetDirection.bind(this),computeDirection:this.computeDirection.bind(this),trigger:this.trigger.bind(this),position:this.position,frontPosition:this.frontPosition,ui:this.ui,identifier:this.identifier,id:this.id,options:this.options},this.instance}zn.prototype=new O3,zn.constructor=zn,zn.id=0,zn.prototype.buildEl=function(t){return this.ui={},this.options.dataOnly||(this.ui.el=document.createElement("div"),this.ui.back=document.createElement("div"),this.ui.front=document.createElement("div"),this.ui.el.className="nipple collection_"+this.collection.id,this.ui.back.className="back",this.ui.front.className="front",this.ui.el.setAttribute("id","nipple_"+this.collection.id+"_"+this.id),this.ui.el.appendChild(this.ui.back),this.ui.el.appendChild(this.ui.front)),this},zn.prototype.stylize=function(){if(this.options.dataOnly)return this;var t=this.options.fadeTime+"ms",e=(()=>{let r=VV("borderRadius");for(let s in r)Object.prototype.hasOwnProperty.call(r,s)&&(r[s]="50%");return r})(),i=Y2("transition","opacity",t),n={};return n.el={position:"absolute",opacity:this.options.restOpacity,display:"block",zIndex:999},n.back={position:"absolute",display:"block",width:this.options.size+"px",height:this.options.size+"px",marginLeft:-this.options.size/2+"px",marginTop:-this.options.size/2+"px",background:"rgba(255, 255, 255, .4)",border:"solid 2px rgba(0, 0, 0, .1)"},n.front={width:this.options.size/2+"px",height:this.options.size/2+"px",position:"absolute",display:"block",marginLeft:-this.options.size/4+"px",marginTop:-this.options.size/4+"px",background:"rgba(255, 255, 255, .8)",border:"solid 2px rgba(0, 0, 0, .1)"},Z2(n.el,i),this.options.shape==="circle"&&Z2(n.back,e),Z2(n.front,e),this.applyStyles(n),this},zn.prototype.applyStyles=function(t){for(var e in this.ui)if(Object.prototype.hasOwnProperty.call(this.ui,e))for(var i in t[e])this.ui[e].style[i]=t[e][i];return this},zn.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)||this.options.zone.appendChild(this.ui.el),this},zn.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)||this.options.zone.removeChild(this.ui.el),this},zn.prototype.destroy=function(){clearTimeout(this.removeTimeout),clearTimeout(this.showTimeout),clearTimeout(this.restTimeout),this.trigger("destroyed",this.instance),this.removeFromDom(),this.off(),this.ui=null,this.instance=null,this.collection=null,this.options=null},zn.prototype.show=function(t){var e=this;return e.options.dataOnly||(clearTimeout(e.removeTimeout),clearTimeout(e.showTimeout),clearTimeout(e.restTimeout),e.addToDom(),e.restCallback(),setTimeout(function(){e.ui.el.style.opacity=1},0),e.showTimeout=setTimeout(function(){e.trigger("shown",e.instance),typeof t=="function"&&t.call(this)},e.options.fadeTime)),e},zn.prototype.hide=function(t){var e=this;if(e.options.dataOnly)return e;if(e.ui.el.style.opacity=e.options.restOpacity,clearTimeout(e.removeTimeout),clearTimeout(e.showTimeout),clearTimeout(e.restTimeout),e.removeTimeout=setTimeout(function(){var i=e.options.mode==="dynamic"?"none":"block";e.ui.el.style.display=i,typeof t=="function"&&t.call(e),e.trigger("hidden",e.instance)},e.options.fadeTime),e.options.restJoystick){let i=e.options.restJoystick,n={};n.x=i===!0||i.x!==!1?0:e.instance.frontPosition.x,n.y=i===!0||i.y!==!1?0:e.instance.frontPosition.y,e.setPosition(t,n)}return e},zn.prototype.setPosition=function(t,e){var i=this;i.frontPosition={x:e.x,y:e.y};var n=i.options.fadeTime+"ms",r={};r.front=Y2("transition",["top","left"],n);var s={front:{}};s.front={left:i.frontPosition.x+"px",top:i.frontPosition.y+"px"},i.applyStyles(r),i.applyStyles(s),i.restTimeout=setTimeout(function(){typeof t=="function"&&t.call(i),i.restCallback()},i.options.fadeTime)},zn.prototype.restCallback=function(){var t=this,e={};e.front=Y2("transition","none",""),t.applyStyles(e),t.trigger("rested",t.instance)},zn.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}},zn.prototype.computeDirection=function(t){var e,i,n,r=t.angle.radian,s=Math.PI/4,a=Math.PI/2;if(r>s&&r<3*s&&!t.lockX?e="up":r>-s&&r<=s&&!t.lockY?e="left":r>3*-s&&r<=-s&&!t.lockX?e="down":t.lockY||(e="right"),t.lockY||(i=r>-a&&r<a?"left":"right"),t.lockX||(n=r>0?"up":"down"),t.force>this.options.threshold){var o,l={};for(o in this.direction)Object.prototype.hasOwnProperty.call(this.direction,o)&&(l[o]=this.direction[o]);var c={};for(o in this.direction={x:i,y:n,angle:e},t.direction=this.direction,l)l[o]===this.direction[o]&&(c[o]=!0);if(c.x&&c.y&&c.angle)return t;(!c.x||!c.y)&&this.trigger("plain",t),c.x||this.trigger("plain:"+i,t),c.y||this.trigger("plain:"+n,t),c.angle||this.trigger("dir dir:"+e,t)}else this.resetDirection();return t};var ZQ=zn;function on(t,e){var i=this;i.nipples=[],i.idles=[],i.actives=[],i.ids=[],i.pressureIntervals={},i.manager=t,i.id=on.id,on.id+=1,i.defaults={zone:document.body,multitouch:!1,maxNumberOfNipples:10,mode:"dynamic",position:{top:0,left:0},catchDistance:200,size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,lockX:!1,lockY:!1,shape:"circle",dynamicPage:!1,follow:!1},i.config(e),(i.options.mode==="static"||i.options.mode==="semi")&&(i.options.multitouch=!1),i.options.multitouch||(i.options.maxNumberOfNipples=1);let n=getComputedStyle(i.options.zone.parentElement);return n&&n.display==="flex"&&(i.parentIsFlex=!0),i.updateBox(),i.prepareNipples(),i.bindings(),i.begin(),i.nipples}on.prototype=new O3,on.constructor=on,on.id=0,on.prototype.prepareNipples=function(){var t=this,e=t.nipples;e.on=t.on.bind(t),e.off=t.off.bind(t),e.options=t.options,e.destroy=t.destroy.bind(t),e.ids=t.ids,e.id=t.id,e.processOnMove=t.processOnMove.bind(t),e.processOnEnd=t.processOnEnd.bind(t),e.get=function(i){if(i===void 0)return e[0];for(var n=0,r=e.length;n<r;n+=1)if(e[n].identifier===i)return e[n];return!1}},on.prototype.bindings=function(){var t=this;t.bindEvt(t.options.zone,"start"),t.options.zone.style.touchAction="none",t.options.zone.style.msTouchAction="none"},on.prototype.begin=function(){var t=this,e=t.options;if(e.mode==="static"){var i=t.createNipple(e.position,t.manager.getIdentifier());i.add(),t.idles.push(i)}},on.prototype.createNipple=function(t,e){var i=this,n=i.manager.scroll,r={},s=i.options,a=i.parentIsFlex?n.x:n.x+i.box.left,o=i.parentIsFlex?n.y:n.y+i.box.top;if(t.x&&t.y)r={x:t.x-a,y:t.y-o};else if(t.top||t.right||t.bottom||t.left){var l=document.createElement("DIV");l.style.display="hidden",l.style.top=t.top,l.style.right=t.right,l.style.bottom=t.bottom,l.style.left=t.left,l.style.position="absolute",s.zone.appendChild(l);var c=l.getBoundingClientRect();s.zone.removeChild(l),r=t,t={x:c.left+n.x,y:c.top+n.y}}var h=new ZQ(i,{color:s.color,size:s.size,threshold:s.threshold,fadeTime:s.fadeTime,dataOnly:s.dataOnly,restJoystick:s.restJoystick,restOpacity:s.restOpacity,mode:s.mode,identifier:e,position:t,zone:s.zone,frontPosition:{x:0,y:0},shape:s.shape});return s.dataOnly||($2(h.ui.el,r),$2(h.ui.front,h.frontPosition)),i.nipples.push(h),i.trigger("added "+h.identifier+":added",h),i.manager.trigger("added "+h.identifier+":added",h),i.bindNipple(h),h},on.prototype.updateBox=function(){this.box=this.options.zone.getBoundingClientRect()},on.prototype.bindNipple=function(t){var e,i=this,n=function(r,s){e=r.type+" "+s.id+":"+r.type,i.trigger(e,s)};t.on("destroyed",i.onDestroyed.bind(i)),t.on("shown hidden rested dir plain",n),t.on("dir:up dir:right dir:down dir:left",n),t.on("plain:up plain:right plain:down plain:left",n)},on.prototype.pressureFn=function(t,e,i){var n=this,r=0;clearInterval(n.pressureIntervals[i]),n.pressureIntervals[i]=setInterval(function(){var s=t.force||t.pressure||t.webkitForce||0;s!==r&&(e.trigger("pressure",s),n.trigger("pressure "+e.identifier+":pressure",s),r=s)}.bind(n),100)},on.prototype.onstart=function(t){var e=this,i=e.options,n=t;return t=kV(t),e.updateBox(),MT(t,function(r){e.actives.length<i.maxNumberOfNipples?e.processOnStart(r):n.type.match(/^touch/)&&(Object.keys(e.manager.ids).forEach(function(s){if(Object.values(n.touches).findIndex(function(o){return o.identifier===s})<0){var a=[t[0]];a.identifier=s,e.processOnEnd(a)}}),e.actives.length<i.maxNumberOfNipples&&e.processOnStart(r))}),e.manager.bindDocument(),!1},on.prototype.processOnStart=function(t){var e,i=this,n=i.options,r=i.manager.getIdentifier(t),s=t.force||t.pressure||t.webkitForce||0,a={x:t.pageX,y:t.pageY},o=i.getOrCreate(r,a);o.identifier!==r&&i.manager.removeIdentifier(o.identifier),o.identifier=r;var l=function(c){c.trigger("start",c),i.trigger("start "+c.id+":start",c),c.show(),s>0&&i.pressureFn(t,c,c.identifier),i.processOnMove(t)};if((e=i.idles.indexOf(o))>=0&&i.idles.splice(e,1),i.actives.push(o),i.ids.push(o.identifier),n.mode!=="semi")l(o);else{if(!(oy(a,o.position)<=n.catchDistance))return o.destroy(),void i.processOnStart(t);l(o)}return o},on.prototype.getOrCreate=function(t,e){var i,n=this,r=n.options;return/(semi|static)/.test(r.mode)?(i=n.idles[0])?(n.idles.splice(0,1),i):r.mode==="semi"?n.createNipple(e,t):(console.warn("Coudln't find the needed nipple."),!1):i=n.createNipple(e,t)},on.prototype.processOnMove=function(t){var e=this,i=e.options,n=e.manager.getIdentifier(t),r=e.nipples.get(n),s=e.manager.scroll;if((_=>isNaN(_.buttons)?_.pressure!==0:_.buttons!==0)(t)){if(!r)return console.error("Found zombie joystick with ID "+n),void e.manager.removeIdentifier(n);if(i.dynamicPage){var a=r.el.getBoundingClientRect();r.position={x:s.x+a.left,y:s.y+a.top}}r.identifier=n;var o=r.options.size/2,l={x:t.pageX,y:t.pageY};i.lockX&&(l.y=r.position.y),i.lockY&&(l.x=r.position.x);var c,h,d=oy(l,r.position),u=((_,b)=>{let x=b.x-_.x,w=b.y-_.y;return(S=>S*(180/Math.PI))(Math.atan2(w,x))})(l,r.position),p=X2(u),f=d/o,g={distance:d,position:l};if(r.options.shape==="circle"?(c=Math.min(d,o),h=((_,b,x)=>{let w={x:0,y:0};return x=X2(x),w.x=_.x-b*Math.cos(x),w.y=_.y-b*Math.sin(x),w})(r.position,c,u)):(h=((_,b,x)=>({x:Math.min(Math.max(_.x,b.x-x),b.x+x),y:Math.min(Math.max(_.y,b.y-x),b.y+x)}))(l,r.position,o),c=oy(h,r.position)),i.follow){if(d>o){let _=l.x-h.x,b=l.y-h.y;r.position.x+=_,r.position.y+=b,r.el.style.top=r.position.y-(e.box.top+s.y)+"px",r.el.style.left=r.position.x-(e.box.left+s.x)+"px",d=oy(l,r.position)}}else l=h,d=c;var m=l.x-r.position.x,y=l.y-r.position.y;r.frontPosition={x:m,y},i.dataOnly||$2(r.ui.front,r.frontPosition);var v={identifier:r.identifier,position:l,force:f,pressure:t.force||t.pressure||t.webkitForce||0,distance:d,angle:{radian:p,degree:u},vector:{x:m/o,y:-y/o},raw:g,instance:r,lockX:i.lockX,lockY:i.lockY};(v=r.computeDirection(v)).angle={radian:X2(180-u),degree:180-u},r.trigger("move",v),e.trigger("move "+r.id+":move",v)}else this.processOnEnd(t)},on.prototype.processOnEnd=function(t){var e=this,i=e.options,n=e.manager.getIdentifier(t),r=e.nipples.get(n),s=e.manager.removeIdentifier(r.identifier);!r||(i.dataOnly||r.hide(function(){i.mode==="dynamic"&&(r.trigger("removed",r),e.trigger("removed "+r.id+":removed",r),e.manager.trigger("removed "+r.id+":removed",r),r.destroy())}),clearInterval(e.pressureIntervals[r.identifier]),r.resetDirection(),r.trigger("end",r),e.trigger("end "+r.id+":end",r),e.ids.indexOf(r.identifier)>=0&&e.ids.splice(e.ids.indexOf(r.identifier),1),e.actives.indexOf(r)>=0&&e.actives.splice(e.actives.indexOf(r),1),/(semi|static)/.test(i.mode)?e.idles.push(r):e.nipples.indexOf(r)>=0&&e.nipples.splice(e.nipples.indexOf(r),1),e.manager.unbindDocument(),/(semi|static)/.test(i.mode)&&(e.manager.ids[s.id]=s.identifier))},on.prototype.onDestroyed=function(t,e){var i=this;i.nipples.indexOf(e)>=0&&i.nipples.splice(i.nipples.indexOf(e),1),i.actives.indexOf(e)>=0&&i.actives.splice(i.actives.indexOf(e),1),i.idles.indexOf(e)>=0&&i.idles.splice(i.idles.indexOf(e),1),i.ids.indexOf(e.identifier)>=0&&i.ids.splice(i.ids.indexOf(e.identifier),1),i.manager.removeIdentifier(e.identifier),i.manager.unbindDocument()},on.prototype.destroy=function(){var t=this;for(var e in t.unbindEvt(t.options.zone,"start"),t.nipples.forEach(function(i){i.destroy()}),t.pressureIntervals)Object.prototype.hasOwnProperty.call(t.pressureIntervals,e)&&clearInterval(t.pressureIntervals[e]);t.trigger("destroyed",t.nipples),t.manager.unbindDocument(),t.off(),t.pressureIntervals={},t.nipples=[],t.idles=[],t.actives=[],t.ids=[],t.manager=null};var KQ=on;function Sn(t){var e=this;e.ids={},e.index=0,e.collections=[],e.scroll=eB(),e._windowBound=!1,e.config(t),e.prepareCollections();var i=function(){var n;e.collections.forEach(function(r){r.forEach(function(s){n=s.el.getBoundingClientRect(),s.position={x:e.scroll.x+n.left,y:e.scroll.y+n.top}})})};return e._onResize=function(){(n=>{ly.has(n)&&clearTimeout(ly.get(n)),ly.set(n,setTimeout(function(){ly.delete(n),n()},100))})(i)},e._onScroll=function(){e.scroll=eB()},e.collections}Sn.prototype=new O3,Sn.constructor=Sn,Sn.prototype.prepareCollections=function(){var t=this;t.collections.create=t.create.bind(t),t.collections.on=t.on.bind(t),t.collections.off=t.off.bind(t),t.collections.destroy=t.destroy.bind(t),t.collections.get=function(e){var i;return t.collections.every(function(n){return!(i=n.get(e))}),i}},Sn.prototype.create=function(t){return this.createCollection(t)},Sn.prototype.bindWindowEvents=function(){var t=this;t._windowBound||typeof window>"u"||(t._windowBound=!0,_b(window,"resize",t._onResize),_b(window,"scroll",t._onScroll))},Sn.prototype.unbindWindowEvents=function(){var t=this;!t._windowBound||typeof window>"u"||(t._windowBound=!1,bb(window,"resize",t._onResize),bb(window,"scroll",t._onScroll))},Sn.prototype.createCollection=function(t){var e=this,i=new KQ(e,t);return e.bindCollection(i),e.collections.push(i),e.bindWindowEvents(),i},Sn.prototype.bindCollection=function(t){var e,i=this,n=function(r,s){e=r.type+" "+s.id+":"+r.type,i.trigger(e,s)};t.on("destroyed",i.onDestroyed.bind(i)),t.on("shown hidden rested dir plain",n),t.on("dir:up dir:right dir:down dir:left",n),t.on("plain:up plain:right plain:down plain:left",n)},Sn.prototype.bindDocument=function(){var t=this;t.binded||(t.bindEvt(document,"move").bindEvt(document,"end"),t.binded=!0)},Sn.prototype.unbindDocument=function(t){var e=this;(!Object.keys(e.ids).length||t===!0)&&(e.unbindEvt(document,"move").unbindEvt(document,"end"),e.binded=!1)},Sn.prototype.getIdentifier=function(t){var e;return t?(e=t.identifier===void 0?t.pointerId:t.identifier)===void 0&&(e=this.latest||0):e=this.index,this.ids[e]===void 0&&(this.ids[e]=this.index,this.index+=1),this.latest=e,this.ids[e]},Sn.prototype.removeIdentifier=function(t){var e={};for(var i in this.ids)if(this.ids[i]===t){e.id=i,e.identifier=this.ids[i],delete this.ids[i];break}return e},Sn.prototype.onmove=function(t){return this.onAny("move",t),!1},Sn.prototype.onend=function(t){return this.onAny("end",t),!1},Sn.prototype.oncancel=function(t){return this.onAny("end",t),!1},Sn.prototype.onAny=function(t,e){var i,n=this,r="processOn"+t.charAt(0).toUpperCase()+t.slice(1);e=kV(e);var s=function(a,o,l){l.ids.indexOf(o)>=0&&(l[r](a),a._found_=!0)};return MT(e,function(a){i=n.getIdentifier(a),MT(n.collections,s.bind(null,a,i)),a._found_||n.removeIdentifier(i)}),!1},Sn.prototype.destroy=function(){var t=this;t.unbindDocument(!0),t.unbindWindowEvents(),t.ids={},t.index=0,t.collections.forEach(function(e){e.destroy()}),t.collections=[],t.off()},Sn.prototype.onDestroyed=function(t,e){var i=this;if(i.collections.indexOf(e)<0)return!1;i.collections.splice(i.collections.indexOf(e),1),i.collections.length===0&&i.unbindWindowEvents()};var QQ=Sn,np=null;function nB(){return np||(np=new QQ),np}var JQ={create:function(t){return nB().create(t)},destroy:function(){np&&(np.destroy(),np=null)},get factory(){return nB()}},tJ=JQ;ii(),Yt(),et(),Hs(),Wr(),Yt();var WV=null;function K2(){return WV}var qV,Q2,eJ=new Promise(t=>{qV=t});function iJ(t){return Q2||(Q2=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.31/build",i=import("./physics.js"),[n,r]=await Promise.all([i,fetch(`${e}/physics.wasm`).then(s=>s.arrayBuffer())]);await n.init(r),qV(n)}(),Q2)}function XV(t){let e=t.elements,i=e[0]**2+e[1]**2+e[2]**2,n=e[4]**2+e[5]**2+e[6]**2,r=e[8]**2+e[9]**2+e[10]**2,s=e[0]**2+e[4]**2+e[8]**2,a=e[1]**2+e[5]**2+e[9]**2,o=e[2]**2+e[6]**2+e[10]**2,l=1e-8;return i<l||n<l||r<l||s<l||a<l||o<l}function Vo(t,e){let i=new Gt;if(e&&XV(e))return i.setAttribute("position",new Nt([],3)),i.setIndex([]),i;if(!t.getAttribute("position"))return i.setAttribute("position",new Nt([],3)),i.setIndex([]),i;let{positions:n,triIndices:r}=YC(t.getAttribute("position"),t.getIndex());return i.setAttribute("position",new Nt(n,3)),i.setIndex(r),e&&i.applyMatrix4(e),i}Li(),Wr(),ke(),o3(),et(),et(),Sp(),Hg();var Ge,nJ=class{constructor(t,e,i,n,r,s){this.id=t,this.data=e,this.object=i,this.initialDisabled=!1,this.actions=Pn(e,e.actions,n,r,s,i),this.target=e.target}disconnect(){nr(this.actions)}dispatch(t){this.initialDisabled||(this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Collision"}),this.actions.Transition.forEach(e=>e.play()),this.actions.Animation.forEach(e=>{e.data.runMode==="Toggle"?e.toggle():e.play()}),this.actions.TimelineAnimation.forEach(e=>{"runMode"in e.data&&e.data.runMode==="Toggle"?e.toggle():e.play()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Link.forEach(e=>{e.dispatch()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Create.forEach(e=>{e.dispatch()}),this.actions.Destroy.forEach(e=>{e.dispatch(t??!1)}),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.Audio.forEach(e=>{e.dispatchBasic()}),this.actions.Particles.forEach(e=>{e.dispatchBasic()}),this.actions.Video.forEach(e=>{e.dispatchBasic()}),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch()))}},rB=class{constructor(t,e,i,n,r,s){this.id=t,this.data=e,this.object=i,this.page=n,this.currentIntersectedObjects=[],this.actions=Pn(e,e.actions,n,r,s,i),this.target=e.target,this.triggeringObjects=[];for(let a of e.triggeringObjects){let o=n.scene.find(a);o&&this.triggeringObjects.push(o)}}isValidTriggeringObject(t){return this.target==="all"||this.triggeringObjects.some(e=>e===t||e.isAncestorOf(t.uuid)||t.isAncestorOf(e.uuid))}disconnect(){nr(this.actions)}dispatch(){this.object.destroyedInAction||(this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Trigger"}),this.actions.Transition.forEach(t=>t.play()),this.actions.SwitchCamera.forEach(t=>{t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.TimelineAnimation.forEach(t=>{"runMode"in t.data&&t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.Link.forEach(t=>{t.dispatch()}),this.actions.Reset.forEach(t=>{t.dispatch()}),this.actions.Create.forEach(t=>{t.dispatch()}),this.actions.Destroy.forEach(t=>{t.dispatch(!1)}),this.actions.Audio.forEach(t=>{t.dispatchBasic()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()}),this.actions.Video.forEach(t=>{t.dispatchBasic()}),this.actions.SceneTransition.forEach(t=>{t.dispatch()}),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch()))}};Li(),eJ.then(t=>Ge=t);var wn=new C,Is=new $t,Pl=new C,sB=(new Ei(0,0,0,"YXZ"),new Ei(0,0,0,"XYZ")),ia=new C,J2=new C,tM=new C(1,1,1),Yd=new $t,hy=new At,aB=new At,rJ={type:"updateMatrix"},oB=new $t,eM=new vr,iM=.01,ET={type:"beginEvent",eventName:"Collision"},sJ={type:"beginEvent",eventName:"Trigger"},xb=t=>t.states.some(e=>e.data.position!==void 0||e.data.rotation!==void 0||e.data.hiddenMatrix!==void 0||e.data.cloner!==void 0||e.data.pathSnapping!==void 0);function Zd(t){return function(e){return typeof e=="object"&&e!==null&&"booleanOp"in e}(Mc(t)?t.object:t)}var aJ=class{constructor(t){this.eventContext=t,this.isEnabled=!1,this.gameControl=null,this.joysticks=[],this.joystickToGameControls=[],this.sharedGameControlGlobals={entitiesWithTransformAnim:[],entityToCollisionEvents:{},colliderToEntity:new Map,kinematicBodyToEntity:new Map,triggers:[],gamePads:[],createdObjects:[],nCreatedPerAction:{}},this.sensorToTriggerEvent={},this.eventManager=void 0,this.needsCollisionDetection=!1,this.initializationCounter=-1,this.fixedBodiesToWatch=[],this.rigidBodyToMesh=new Map,this.nActiveRigidBodies=0,this.collisionEvents=[],this.isExport=!1,this.skipRender=!0,this._staticBVHAttrIds=new WeakMap,this._staticBVHNextAttrId=1,this.processRigidBody=e=>{if(e.bodyType()!==Ge.RigidBodyType.Dynamic)return;e.isSleeping()||this.nActiveRigidBodies++;let[i,n,r]=this.rigidBodyToMesh.get(e.handle);if(wn.copy(e.translation()).multiplyScalar(this.pixelsPerMeter),Is.copy(e.rotation()),i.matrixWorld.compose(wn,Is,n),i.hasNonUniformScale&&i.matrixWorld.multiply(i.shearScale),i.dispatchEvent(rJ),r){let s=i.cloner;if(s&&s.objectForSample===void 0){s.matrixWorld.copy(i.matrixWorld);for(let a of s.children)a.updateMatrixWorld(!0)}for(let a of i.children)a.updateMatrixWorld(!0)}},this.accumulator=0,this.handleCollisionEvents=(e,i,n)=>{if(n===!1)return;let r,s;if(this.sensorToTriggerEvent[e]?(r=this.sensorToTriggerEvent[e],s=this.sharedGameControlGlobals.colliderToEntity.get(i)):this.sensorToTriggerEvent[i]&&(r=this.sensorToTriggerEvent[i],s=this.sharedGameControlGlobals.colliderToEntity.get(e)),r&&s&&r.isValidTriggeringObject(s))r.dispatch();else{for(let a=this.sharedGameControlGlobals.createdObjects.length-1;a>=0;a--){let o=this.sharedGameControlGlobals.createdObjects[a];if(o.userData.hasCollisionDestroy&&(o.rigidBody?.collider(0).handle===e||o.rigidBody?.collider(0).handle===i)){this.sharedGameControlGlobals.createdObjects.splice(a,1),o.removeFromParent();let l=o.rigidBody;requestAnimationFrame(()=>{o.rigidBody===l&&(this.sharedGameControlGlobals.rapierWorld?.removeRigidBody(l),o.rigidBody=void 0)});break}}if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(e)){let a=this.sharedGameControlGlobals.colliderToEntity.get(i),o=this.sharedGameControlGlobals.entityToCollisionEvents[a.uuid];if(o===void 0)return;for(let l of o)l.data.target==="character"&&this.dispatchCollisionEvent(l,a,i)}else if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(i)){let a=this.sharedGameControlGlobals.colliderToEntity.get(e),o=this.sharedGameControlGlobals.entityToCollisionEvents[a.uuid];if(o===void 0)return;for(let l of o)l.data.target==="character"&&this.dispatchCollisionEvent(l,a,e)}else{let a=this.sharedGameControlGlobals.colliderToEntity.get(e),o=this.sharedGameControlGlobals.entityToCollisionEvents[a.uuid];if(o!==void 0)for(let h of o)h.data.target==="scene"&&this.dispatchCollisionEvent(h,a,e);let l=this.sharedGameControlGlobals.colliderToEntity.get(i),c=this.sharedGameControlGlobals.entityToCollisionEvents[l?.uuid];if(c!==void 0)for(let h of c)h.data.target==="scene"&&this.dispatchCollisionEvent(h,l,i)}}},this.isExport=t.isExport,this.sharedAssets=t.sharedAssets,this.renderer=t.renderer,this.requestRender=t.requestRender,this.domElement=this.renderer.domElement,this.pixelsPerMeter=200,this.gravity=this.page.data.globalPhysics.gravity}get page(){return this.eventContext.page}markIsDestroyTarget(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let i of e.events){if(i.data.disabled===!0)continue;let n=i.data.actions?.find(r=>r.data.type==="Destroy")?.data;if(n)for(let r of n.objects){let s=this.page.scene.find(r);s&&(s.userData.hasDestroy=!0)}}})}markIsDragObject(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let i of e.events)if(i.data.disabled!==!0&&i.data.type==="DragDrop")for(let n of i.data.objects){let r=this.page.scene.find(n);r&&(r.userData.hasDrag=!0)}})}_staticBVHIdOf(t){let e=this._staticBVHAttrIds.get(t);return e===void 0&&(e=this._staticBVHNextAttrId++,this._staticBVHAttrIds.set(t,e)),e}initBVH(){if(K2()===null)return void Vn("collision-bvh","trigger/collision detection");let t=[],e=[];if(this.page.traverseChildren(i=>{let n,r=i instanceof Ju,s=sg(i);if(Lu(i)||r||s)return;n=Mc(i)?i.object:i;let a=n.dataPatched;if(a.physics?.enabled==="visibility"?!a.visible:!a.physics?.enabled)return!0;let o=i.geometry,l=n.userData.hasDestroy===!0,c=n.userData.hasDrag===!0;if(xb(a)||l||c||n.dataPatched.events.some(h=>h.data.disabled!==!0&&(h.data.type==="GameControl"||h.data.type==="Follow")))return i.updateMatrixWorldRigid(),this.addBoundsTree(i),!0;if(o){let h=o.getAttribute("position");if(h!==void 0&&h.count>0){t.push({geometry:o,matrixWorld:i.matrixWorld}),e.push(o.id,this._staticBVHIdOf(h),h.version,o.index!==null?this._staticBVHIdOf(o.index):-1,o.index!==null?o.index.version:-1);for(let d of i.matrixWorld.elements)e.push(d)}}return!!Zd(i)||void 0}),t.length>0){let i=this._staticBVHCache;if(i!==void 0&&i.signature.length===e.length&&i.signature.every((s,a)=>s===e[a]))return void(this.sharedGameControlGlobals.staticMeshBVH=i.bvh);let n=Sc(t.map(s=>Vo(s.geometry,s.matrixWorld)),!1),r=new(K2())(n);this._staticBVHCache={signature:e,bvh:r},this.sharedGameControlGlobals.staticMeshBVH=r}}addRigidBody(t,e,i){if(XV(t.matrixWorld))return;let n=[],r="geometry"in t?t.geometry:void 0,s=e.dataPatched;if(r?.getAttribute("position")!==void 0&&n.push(Vo(r,t.shearScale)),s.physics.fusedBody){let a=this.gatherChildrenGeom(t,n);t.traverseObject(a),t.children.forEach(l=>l.updateMatrixWorld(!0));let o=t.cloner;o&&o.objectForSample===void 0&&s.physics.rigidBody==="dynamic"&&(o.traverseObject(a),o.children.forEach(l=>l.updateMatrixWorld(!0)))}if(n.length>0){let a,o=!1,l=!i.fromCreate&&s.physics.rigidBody==="dynamic"||i.fromCreate&&i.dynamic;l?(a=Ge.RigidBodyDesc.dynamic(),a.setLinearDamping(s.physics.damping).setAngularDamping(s.physics.damping).setAdditionalMass(1e-9).setGravityScale(s.physics.gravityScale).enabledRotations(...s.physics.enabledRotation).enabledTranslations(...s.physics.enabledTranslation)):(i.hasTransformAnim||i.hasFollow||i.hasDrag)&&!i.fromCreate?(a=Ge.RigidBodyDesc.kinematicPositionBased(),o=!0):a=Ge.RigidBodyDesc.fixed();let c=Sc(n);(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(wn,Is,Pl),t.position0=wn.clone().divideScalar(this.pixelsPerMeter),t.rotation0=Is.clone(),wn.divideScalar(this.pixelsPerMeter),a.setTranslation(wn.x,wn.y,wn.z).setRotation(Is),r?c?.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter):c?.scale(Pl.x/this.pixelsPerMeter,Pl.y/this.pixelsPerMeter,Pl.z/this.pixelsPerMeter);let h=this.sharedGameControlGlobals.rapierWorld.createRigidBody(a),d=!(s.geometry===void 0||s.geometry.type==="SubdivGeometry"||s.geometry.type==="NonParametricGeometry"||s.geometry.type==="BooleanGeometry"||s.geometry.type==="VectorGeometry"||s.geometry.type==="StarGeometry"||s.geometry.type==="RectangleGeometry"||s.geometry.type==="EllipseGeometry"||s.geometry.type==="TriangleGeometry"||s.geometry.type==="TorusGeometry"||s.geometry.type==="HelixGeometry");try{this.addCollider(h,s.physics,c,e,d)}catch{try{this.addCollider(h,s.physics,c,e,!1)}catch(u){console.error(u)}}if(h.numColliders()===0)return void this.sharedGameControlGlobals.rapierWorld.removeRigidBody(h);l?this.rigidBodyToMesh.set(h.handle,[t,Pl.clone(),s.physics.fusedBody]):o?(this.sharedGameControlGlobals.kinematicBodyToEntity.set(h.handle,t),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t)):this.fixedBodiesToWatch.push([t,h,(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).clone()]),t.rigidBody=h}}addBoundsTree(t){let e=[];if(t.geometry?.getAttribute("position")!==void 0&&t.geometry?.getAttribute("position").count>0&&e.push(Vo(t.geometry,t.shearScale)),t.traverseObject(this.gatherChildrenGeom(t,e)),t.children.forEach(i=>i.updateMatrixWorld(!0)),e.length>0){let i=Sc(e,!1);t.bvhGeometry=i,i.getAttribute("position").count>0&&(t.bvhGeometry.boundsTree=new(K2())(i),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t))}}addCollider(t,e,i,n,r=!0){if(i?.getAttribute("position").count===0||i?.getIndex()?.count===0)return;let s;i&&(s=e.colliderType==="trimesh"?Ge.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array):Ge.ColliderDesc.convexMesh(i.getAttribute("position").array,r?i.getIndex().array:void 0)),s.setFrictionCombineRule(Ge.CoefficientCombineRule.Average).setRestitutionCombineRule(Ge.CoefficientCombineRule.Average).setDensity(e.density).setFriction(e.friction).setRestitution(e.restitution);let a=this.sharedGameControlGlobals.rapierWorld.createCollider(s,t);this.sharedGameControlGlobals.colliderToEntity.set(a.handle,n),this.sharedGameControlGlobals.entityToCollisionEvents[n.uuid]?.some(o=>o.target==="scene")&&a.setActiveEvents(Ge.ActiveEvents.COLLISION_EVENTS)}gatherChildrenGeom(t,e){let i=Zd(t);return(n,r)=>{if(r===0)return;if(i&&n.parent===t)return!0;let s;if(Lu(n)){if(!n.objectForSample)return n.object.dataPatched.physics.fusedBody===!0&&n.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(n.objectForSample.dataPatched.physics.fusedBody)return;s=n.object}else if(Mc(n))s=n.object;else if(s=n,s.dataPatched.cloner?.hideBase)return!0;let a=s.dataPatched;if(a.physics.enabled==="visibility"?!a.visible:!a.physics.enabled)return!0;r===1?t.hasNonUniformScale?n.matrixWorld.multiplyMatrices(t.shearScale,n.hiddenMatrix):n.matrixWorld.copy(n.hiddenMatrix):n.matrixWorld.multiplyMatrices(n.parent.matrixWorld,n.hiddenMatrix),n.matrixWorld.multiply(n.matrix);let o=n.geometry;return o?.getAttribute("position")!==void 0&&e.push(Vo(o,n.matrixWorld)),!!Zd(n)||void 0}}activate(t){if(this.isEnabled)return;this.isEnabled=!0,this.eventManager=t,this.usePhysics=this.page.data.globalPhysics.usePhysics;let e=this.page.playCamera,i=!1;this.page.traverseEntity(a=>{for(let o of a.dataPatched.events)if(o.data.disabled===!1&&o.data.type==="Trigger")return this.needsCollisionDetection=!0,!0});let n=tB();if(n!==null?i=n.setup({manager:this,camera:e,renderer:this.renderer,sharedAssets:this.sharedAssets,eventContext:this.eventContext,isExport:this.isExport})||i:this.page.data.publish.gameControlObject!==null&&Vn("game-controls","the scene's game controls"),i===!1){let{enableRotate:a,enablePan:o,enableZoom:l,autoRotate:c,hoverRotatePanMode:h}=this.eventManager.publish.orbitControls;(a||o||l||c||h!==0)&&(this.orbitControls=new vV(e,this.renderer.domElement,{isExport:this.isExport,isPlayMode:!0}),this.orbitControls.addEventListener("change",this.requestRender),this.orbitControls.addEventListener("end",this.requestRender),this.orbitControls.addEventListener("start",this.requestRender),this.orbitControls.fromJSON(this.eventManager.publish.orbitControls,this.eventManager.publish.mouseEventTarget),this.orbitControls.useKeyEvents=!1,this.orbitControls.addEventListenersToCamera(),this.orbitControls.connect(),this.orbitControls.update())}let r=this.renderer.domElement.width/this.renderer.getPixelRatio(),s=this.renderer.domElement.height/this.renderer.getPixelRatio();tB()?.createJoysticks(this,r,s),this.markIsDestroyTarget(),this.markIsDragObject(),this.rebuildBVH(),this.initializationCounter++,window.setTimeout(()=>{this.collisionEvents.forEach(a=>a.initialDisabled=!1)},80)}initPhysics(){this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=new Ge.World(new Ge.Vector3(0,this.gravity,0)),this.events=new Ge.EventQueue(!0);let t=[],e=[];if(this.page.traverseChildren(a=>{let o;if(Lu(a)){if(!a.objectForSample)return a.object.dataPatched.physics.fusedBody===!0&&a.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(a.objectForSample.dataPatched.physics.fusedBody)return;o=a.object}else if(Mc(a))o=a.object;else{if(sg(a)||Gc(a)||a instanceof Ju)return;if(o=a,o.dataPatched.cloner?.disabled===!1&&o.dataPatched.cloner?.hideBase&&o.dataPatched.physics?.fusedBody!==!0)return!0}let l,c=o.dataPatched;for(let m of c.events)m.data.disabled!==!0&&m.data.type==="GameControl"&&(l=m.data);if(!c.physics||(c.physics.enabled==="visibility"?!c.visible:!c.physics.enabled))return!0;a.updateMatrixWorldRigid();let h=xb(c),d=!1,u=o.userData.hasDestroy,p=o.userData.hasDrag,f=!1;for(let m of c.events)if(m.data.disabled!==!0){if(m.data.type==="Collision"){d=!0;let y=new nJ(m.id,m.data,o,this.page,this.sharedAssets,this.eventManager);y.initialDisabled=!0,this.collisionEvents.push(y),this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid]&&this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid].every(v=>v.id!==m.id)?this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid].push(y):this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid]=[y]}else if(m.data.type==="Follow"){f=!0;let y=m.data.target;a.traverseVisible(v=>{v.userData.isFollowingObj=y})}}c.physics.rigidBody==="dynamic"&&c.physics.fusedBody===!1&&(a.matrixWorldFusedFalse=a.matrixWorld.clone());let g=a.geometry;if(l!==void 0){let m=Ge.RigidBodyDesc.kinematicPositionBased();(a.hasNonUniformScale?a.matrixWorldRigid:a.matrixWorld).decompose(wn,Is,Pl),a.position0=wn.clone().divideScalar(this.pixelsPerMeter),a.rotation0=Is.clone(),wn.divideScalar(this.pixelsPerMeter),m.setTranslation(wn.x,wn.y,wn.z).setRotation(Is);let y,v=this.sharedGameControlGlobals.rapierWorld.createRigidBody(m);a.rigidBody=v,y=l.collider.type==="sphere"?Ge.ColliderDesc.ball(l.collider.radius/this.pixelsPerMeter):l.collider.type==="capsule"?Ge.ColliderDesc.capsule((l.collider.height/2-l.collider.radius)/this.pixelsPerMeter,l.collider.radius/this.pixelsPerMeter):Ge.ColliderDesc.cuboid(l.collider.width/this.pixelsPerMeter/2,l.collider.height/this.pixelsPerMeter/2,l.collider.depth/this.pixelsPerMeter/2),y.setFrictionCombineRule(Ge.CoefficientCombineRule.Average).setDensity(c.physics.density).setFriction(c.physics.friction).setRestitution(0).setRestitutionCombineRule(Ge.CoefficientCombineRule.Min);let _=this.sharedGameControlGlobals.rapierWorld.createCollider(y,v);this.sharedGameControlGlobals.colliderToEntity.set(_.handle,o),wn.fromArray(l.collider.position.map(x=>typeof x=="number"?x:0)).multiply(Pl.setFromMatrixScale(o.matrixWorld)).divideScalar(this.pixelsPerMeter),_.setTranslationWrtParent(wn);let b=new $t().setFromEuler(new Ei().setFromVector3(new C().fromArray(l.collider.rotation.map(x=>typeof x=="number"?x:0))));_.setRotationWrtParent(b),_.setActiveEvents(Ge.ActiveEvents.COLLISION_EVENTS),this.generateSensorColliderDescs(o,!0)}else c.physics.rigidBody==="dynamic"||h||f||u||p||d?(this.addRigidBody(a,o,{hasFollow:f,hasTransformAnim:h,hasDrag:p}),this.generateSensorColliderDescs(o,c.physics.fusedBody)):(g&&t.push(Vo(g,a.matrixWorld)),c.physics.fusedBody&&!Zd(a)&&a.traverseObject((m,y)=>{if(y===0)return;let v;if(Lu(m)){if(!m.objectForSample)return m.object.dataPatched.physics.fusedBody===!0&&m.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(m.objectForSample.dataPatched.physics.fusedBody)return;v=m.object}else{if(sg(m)||Gc(m)||m instanceof Ju)return;if(Mc(m))v=m.object;else if(v=m,v.dataPatched.cloner?.hideBase)return!0}let _=v.dataPatched;if(_.physics.enabled==="visibility"?!_.visible:!_.physics.enabled)return!0;let b=m.geometry;return b?.getAttribute("position")!==void 0&&t.push(Vo(b,m.matrixWorld)),!!Zd(m)||void 0}),this.generateSensorColliderDescs(o,c.physics.fusedBody,e));return!(c.physics?.fusedBody!==!0&&!l&&!Zd(a))||void 0}),t.length===0)return;let i=Sc(t),n=i.getIndex().count>0;if(!n&&e.length===0)return;i.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter);let r=Ge.RigidBodyDesc.fixed(),s=this.sharedGameControlGlobals.rapierWorld.createRigidBody(r);if(n){let a=Ge.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array).setFrictionCombineRule(Ge.CoefficientCombineRule.Multiply).setRestitutionCombineRule(Ge.CoefficientCombineRule.Multiply).setFriction(1).setRestitution(1);this.sharedGameControlGlobals.rapierWorld.createCollider(a,s)}for(let[a,o]of e){let l=this.sharedGameControlGlobals.rapierWorld.createCollider(a,s);this.sensorToTriggerEvent[l.handle]=o}}updatePositions(){return this.nActiveRigidBodies=0,this.sharedGameControlGlobals.rapierWorld.forEachRigidBody(this.processRigidBody),this.nActiveRigidBodies>0}rebuildBVH(){this.usePhysics?this.initPhysics():(this.page.traverseEntity(t=>{for(let e of t.dataPatched.events)if(e.data.type==="Trigger"&&e.data.disabled!==!0){let i=new rB(e.id,e.data,t,this.page,this.sharedAssets,this.eventManager),n=new At().compose(ia.fromArray(e.data.position.map(r=>typeof r=="number"?r:0)),Yd.setFromEuler(sB.fromArray(e.data.rotation.map(r=>typeof r=="number"?r:0))),tM);if(e.data.triggerZone==="box"){let r=new ci;r.min.fromArray(e.data.size.map(s=>typeof s=="number"?s:0)).multiplyScalar(-.5),r.max.fromArray(e.data.size.map(s=>typeof s=="number"?s:0)).multiplyScalar(.5),this.sharedGameControlGlobals.triggers.push([r,n,t,i])}else this.sharedGameControlGlobals.triggers.push([e.data.radius,n,t,i])}}),this.needsCollisionDetection&&this.initBVH())}disconnectEvents(){this.collisionEvents.forEach(t=>t.disconnect()),this.sharedGameControlGlobals.triggers.forEach(t=>t[3].disconnect()),this.sharedGameControlGlobals.triggers.length=0}deactivate(){if(this.isEnabled){this.isEnabled=!1,this.page.traverse(t=>{let e=t;e.matrixWorldFusedFalse&&(e.matrixWorldFusedFalse=void 0),e.rigidBody&&(e.rigidBody=void 0),e.position0&&(e.position0=void 0),e.rotation0&&(e.rotation0=void 0)}),this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=void 0,this.sharedGameControlGlobals.staticMeshBVH=void 0,this.accumulator=0,this.sharedGameControlGlobals.entitiesWithTransformAnim=[],this.sharedGameControlGlobals.kinematicBodyToEntity.clear(),this.fixedBodiesToWatch=[],this.disconnectEvents(),this.gameControl?.reset(),this.gameControl?.dispose(),this.gameControl=null,this.initializationCounter=-1,this.joysticks.forEach(([t,e])=>{t?.destroy(),e.remove()}),this.joystickToGameControls=[],this.joysticks=[],this.orbitControls&&(this.orbitControls.dispose(),this.orbitControls=void 0),this.navigationMeshWrapper?.dispose(),this.navigationMeshWrapper=void 0;for(let t of Object.values(this.sharedGameControlGlobals.entityToCollisionEvents))t.forEach(e=>e.disconnect());this.sharedGameControlGlobals.entityToCollisionEvents={},this.page.updateMatrixWorld(!0)}}update(t){if(!this.isEnabled)return!0;let e=!0;if(this.orbitControls!==void 0&&this.orbitControls.needsUpdate&&(this.orbitControls.update(),e=!this.orbitControls.isCurrentlyDamping),this.initializationCounter>=0&&this.initializationCounter<2?(this.initializationCounter++,e=!1):this.initializationCounter===2&&this.gameControl&&(e=!this.gameControl.update(t)&&e),this.usePhysics===!1&&this.checkTrigger(),this.usePhysics){let i=.016666666666666666;if(t===0)e=this.stepPhysics()&&e;else{let n=t/1e3;n<i&&n>.55*i&&(n=i),this.accumulator+=n;let r=performance.now(),s=0,a=6;for(;this.accumulator>=i&&s<a&&(e=this.stepPhysics()&&e,this.accumulator-=i,s++,!(performance.now()-r>1e3*i)););this.accumulator=this.accumulator%i}}this.skipRender=e}recordPhysicsPose(t){(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(wn,Is,Pl);let e=t;e.prevQ===void 0?(e.prevQ=Is.clone(),e.prevT=wn.clone()):(e.prevQ.copy(Is),e.prevT.copy(wn))}promoteMovedFixedBodies(){for(let t=this.fixedBodiesToWatch.length-1;t>=0;t--){let[e,i,n]=this.fixedBodiesToWatch[t];(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).equals(n)||(i.setBodyType(Ge.RigidBodyType.KinematicPositionBased,!0),this.sharedGameControlGlobals.kinematicBodyToEntity.set(i.handle,e),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e),this.fixedBodiesToWatch.splice(t,1))}}clampPushedBodies(){let t=this.gameControl?.object.rigidBody;if(t===void 0)return;let e=this.sharedGameControlGlobals.rapierWorld,i=t.linvel(),n=t.translation(),r=Math.hypot(i.x,i.z);for(let s=0;s<t.numColliders();s++){let a=t.collider(s);e.contactPairsWith(a,o=>{let l=o.parent();if(l===null||!l.isDynamic())return;let c=l.translation(),h=-1/0,d=0,u=0;if(e.contactPair(a,o,y=>{let v=y.normal(),_=v.x*(c.x-n.x)+v.y*(c.y-n.y)+v.z*(c.z-n.z)<0?-1:1;if(Math.abs(v.y)>.7)return;let b=_*v.x,x=_*v.z,w=Math.hypot(b,x);if(w<1e-4)return;let S=(i.x*b+i.z*x)/w;S>h&&(h=S,d=b/w,u=x/w)}),h===-1/0)return;let p=i.x*d+i.z*u;if(p<-iM)return;let f=l.linvel();if(r>iM&&p>iM){let y=f.x*d+f.z*u;if(y<=0)return;let v=Math.min(y,p);return void l.setLinvel({x:d*v,y:f.y,z:u*v},!0)}let g=f.x*d+f.z*u-Math.max(0,p);if(g<=0)return;let m=.5*g;l.setLinvel({x:f.x-d*m,y:f.y,z:f.z-u*m},!0)})}}stepPhysics(){this.promoteMovedFixedBodies();for(let t of this.sharedGameControlGlobals.kinematicBodyToEntity.values())this.recordPhysicsPose(t),t.rigidBody.setNextKinematicTranslation(wn.divideScalar(this.pixelsPerMeter)),t.rigidBody.setNextKinematicRotation(Is);for(let t of this.sharedGameControlGlobals.entitiesWithTransformAnim)t.rigidBody?.isKinematic()!==!0&&this.recordPhysicsPose(t);return this.sharedGameControlGlobals.rapierWorld.step(this.events),this.clampPushedBodies(),this.events?.drainCollisionEvents(this.handleCollisionEvents),!this.updatePositions()}dispatchCollisionEvent(t,e,i){let n,r=(this.sharedGameControlGlobals.rapierWorld?.getCollider(i))._parent;if(e.cloner){for(let s of e.cloner.children)if(s.rigidBody===r){n=s;break}}t.dispatch(n),e.dispatchEvent(ET)}updateUseWindowEvents(t){this.orbitControls?.updateUseWindowEvents(t)}generateSensorColliderDescs(t,e,i){let n=aB.copy(t.matrixWorld).invert();t.traverseEntity((r,s)=>{if(e===!1&&s===1)return!0;for(let a of r.dataPatched.events)if(a.data.type==="Trigger"&&a.data.disabled!==!0){let o,l=new rB(a.id,a.data,r,this.page,this.sharedAssets,this.eventManager);if(o=a.data.triggerZone==="box"?Ge.ColliderDesc.cuboid(...a.data.size.map(c=>(typeof c=="number"?c:1)/(2*this.pixelsPerMeter))):Ge.ColliderDesc.ball(a.data.radius/this.pixelsPerMeter),o.setDensity(0).setSensor(!0).setActiveEvents(Ge.ActiveEvents.COLLISION_EVENTS),ia.fromArray(a.data.position.map(c=>typeof c=="number"?c:0)),Yd.setFromEuler(sB.fromArray(a.data.rotation.map(c=>typeof c=="number"?c:0))),hy.compose(ia,Yd,tM).premultiply(r.matrixWorld),i?(hy.decompose(ia,Yd,J2),o.setActiveCollisionTypes(Ge.ActiveCollisionTypes.KINEMATIC_FIXED|Ge.ActiveCollisionTypes.DYNAMIC_FIXED)):(hy.premultiply(n).decompose(ia,Yd,J2),t.rigidBody.bodyType()===Ge.RigidBodyType.Dynamic||(t.rigidBody.bodyType()===Ge.RigidBodyType.Fixed?o.setActiveCollisionTypes(Ge.ActiveCollisionTypes.KINEMATIC_FIXED|Ge.ActiveCollisionTypes.DYNAMIC_FIXED):o.setActiveCollisionTypes(Ge.ActiveCollisionTypes.KINEMATIC_KINEMATIC|Ge.ActiveCollisionTypes.DYNAMIC_KINEMATIC))),ia.divideScalar(this.pixelsPerMeter),o.setTranslation(ia.x,ia.y,ia.z),o.setRotation(Yd),i)i.push([o,l]);else{let c=this.sharedGameControlGlobals.rapierWorld.createCollider(o,t.rigidBody);this.sensorToTriggerEvent[c.handle]=l}}})}checkTrigger(){let t;for(let e=0;e<this.sharedGameControlGlobals.triggers.length;e++){let[i,n,r,s]=this.sharedGameControlGlobals.triggers[e];for(let a=0;a<this.sharedGameControlGlobals.entitiesWithTransformAnim.length;a++){let o=this.sharedGameControlGlobals.entitiesWithTransformAnim[a];if(r===o||s.isValidTriggeringObject(Be.is(o)?o:o.object)===!1)continue;let l=aB.copy(r.matrixWorld).decompose(ia,oB,J2).compose(ia,oB,tM).multiply(n),c=hy.copy(o.matrixWorld).invert().multiply(l),h=o.bvhGeometry.boundsTree;i instanceof ci?t=h.intersectsBox(i,c):(eM.radius=i,eM.center.setFromMatrixPosition(c),t=h.intersectsSphere(eM)),t?s.currentIntersectedObjects.indexOf(o)===-1&&(s.currentIntersectedObjects.push(o),s.dispatch(),r.dispatchEvent(sJ)):s.currentIntersectedObjects=s.currentIntersectedObjects.filter(d=>d!==o)}}}};Mp(),et(),Z_(),Ye(),bh();var nM=.02,lB=new C,hB=new C,oJ=new C,Mr=new C,Do=new C,Kd=new C,rM=new At,cB=new At,lJ=new At,ds=new $t,sc=new $t,Qd=new Ei(0,0,0,"YXZ"),hJ=new C(1,0,0),Fa=new C(0,1,0),cJ=new C(0,0,1),dB=new C(1,1,1),uB=[],pB=t=>uB[t]??(uB[t]=new C),sM=new C,dJ=new C,uJ=new C,pJ=new C,fB=new $t,fJ=new C,mB=new $t,Zn=new vs,Os=new ci,mJ={type:"requestRender"},gJ={type:"updateMatrix"},AT=class extends Nn{constructor(t,e,i,n,r,s,a,o,l){super(),this.object=t,this.domElement=e,this.data=i,this.gloabalPhysics=n,this.controlsManager=r,this.cameraFollow=s,this.camera=a,this.page=o,this.sharedAssets=l,this.enableDamping=!0,this.hiddenMatrix0=new At,this.target0=new C,this.zoom0=1,this.rotForce=1,this.moveForce=1,this.pixelsPerMeter=200,this.euler0=new Ei(0,0,0,"YXZ"),this.position0Cam=new C,this.quat0Cam=new $t,this.scale0Cam=new C,this.hiddenMatrix0Cam=new At,this.threshEndTranslate=.01,this.threshEndRotate=1e-8,this.threshEndRotVel=.005,this.collider={type:"capsule",radius:40,segment:new vs(new C(0,-40,0),new C(0,40,0)),matrix:new At,position:new C,rotation:new $t},this.euler=new Ei(0,0,0,"YXZ"),this.eulerDelta=new C,this.lastPosition=new C,this.lastCameraQuaternion=new $t,this.lastCameraPosition=new C,this.PI_2=Math.PI/2,this.prevMouse=new it,this.velocityTarget=new C,this.velocity=new C,this.directionXZ=new C,this.rotVelocityStick=new C,this.rotVelocityTarget=new C,this.rotVelocity=new C,this.rotDirection=new C,this.nonColliderRotOffset=new At,this.nonColliderPosOffset=new At,this.firstPointerId=-1,this.rot=new C,this.path=[],this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0},this.onObject=!1,this.actionState={},this.keyAssignments=[["moveNegZ","W"],["moveNegX","A"],["movePosZ","S"],["movePosX","D"],["rotPosX","ArrowUp"],["rotPosY","ArrowLeft"],["rotNegX","ArrowDown"],["rotNegY","ArrowRight"],["jump"," "]],this.collisionEnabled=!0,this.offsetMatrix=new At,this.objectToTarget=new C,this.objectToTarget0=new C,this.objectToCamXZ=new C,this.objectToCamXZ0=new C,this.targetToCamera=new C,this.targetToCamera0=new C,this.cameraPolarAxis0=new C,this.targetPos=new C,this.targetQuat=new $t,this.lerpFactorPos=new C().setScalar(.3),this.lerpFactorPosStart=.3,this.lerpFactorPosEnd=.3,this.lerpFactorRotStart=.3,this.lerpFactorRotEnd=.3,this.lerpFactorPosCamera=.3,this.lerpFactorRotCamera=.3,this.objXZQuat=new $t,this.objXZQuatInv=new $t,this.objXZRotMat=new At,this.isFirstPerson=!1,this.didHit=!1,this.groundVelocity=new C,this.pushedVelocity=new C,this.groundYRotation=0,this.objectRealQuat=new $t,this.colliderWorldQuat=new $t,this.groundNormal=new C,this.groundTilt=new $t,this.groundTiltInv=new $t,this.lastHitObj=null,this.isFirstFrame=!0,this.rotationAccumWhenOrientWithCamera=0,this.navMeshPathDest=null,this.position=new C,this.quaternion=new $t,this.scale=new C,this.initialAction=!0,this.onPointerDown=f=>{!(f.target===this.domElement||f.target instanceof HTMLElement&&f.target.tagName==="SPLINE-VIEWER"&&f.target.shadowRoot?.contains(this.domElement))||this.firstPointerId!==-1||(this.firstPointerId=f.pointerId,this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp),this.rotBy!=="keys"&&!ss&&!xE&&this.domElement.requestPointerLock(),this.prevMouse.set(f.clientX,f.clientY))},this.onPointerUp=f=>{this.firstPointerId=-1,this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp),f.pointerType==="mouse"&&this.domElement.ownerDocument.exitPointerLock()},this.onPointerMove=f=>{if(f.pointerId!==this.firstPointerId)return;let g=f.clientX-this.prevMouse.x,m=f.clientY-this.prevMouse.y;this.prevMouse.set(f.clientX,f.clientY),f.pointerType==="mouse"&&this.rotBy!=="keys"&&(xE&&rF<15.5&&!ss?(this.eulerDelta.y=-g*this.mouseOrbitSensitivity,this.eulerDelta.x=-m*this.mouseOrbitSensitivity):(this.eulerDelta.y=-f.movementX*this.mouseOrbitSensitivity,this.eulerDelta.x=-f.movementY*this.mouseOrbitSensitivity)),f.pointerType!=="mouse"&&this.rotByTouch==="drag"&&(this.eulerDelta.y=-g*this.mouseOrbitSensitivity*5,this.eulerDelta.x=-m*this.mouseOrbitSensitivity*5),this.controlsManager.requestRender()},this.onPointerlockChange=f=>{this.domElement.ownerDocument.pointerLockElement===this.domElement?AT.isLocked=!0:AT.isLocked=!1},this.onPointerlockError=()=>{console.error("SPE.GameControls: Unable to use Pointer Lock API")},this.handleVisibilityChange=()=>{if(document?.hidden)for(let f in this.movementState)this.movementState[f]=0},this.onKeyDown=f=>{!(f.target instanceof HTMLInputElement)&&(f.code==="ArrowLeft"||f.code==="ArrowUp"||f.code==="ArrowRight"||f.code==="ArrowDown"||f.code==="Space")&&f.preventDefault();for(let g of this.keyAssignments)if(f.key.toUpperCase()===g[1]||f.key===g[1]){this.movementState[g[0]]=1;break}this.controlsManager.requestRender()},this.onKeyUp=f=>{for(let g of this.keyAssignments)if(f.key.toUpperCase()===g[1]||f.key===g[1]||f.code.slice(3,f.code.length).toUpperCase()===g[1]){this.movementState[g[0]]=0;break}},this.copyVRGamePadValues=(f,g)=>{for(let m=2;m<4;m++){let y=f.axes[m];g===0?m===2?this.movementState.movePosX=y:this.movementState.movePosZ=y:(f.buttons[3].pressed?this.movementState.jump=1:this.movementState.jump=0,m===2?this.movementState.rotPosY=y:this.moveMode==="fly"&&(this.movementState.moveNegY=y))}},this.sharedGameControlGlobals=r.sharedGameControlGlobals,t===a&&(this.isFirstPerson=!0),this.hiddenMatrix0.copy(this.object.hiddenMatrix),this.object.parent?this.object.hiddenMatrix.copy(this.object.parent.matrixWorld).invert():this.object.hiddenMatrix.identity(),this.object.matrix.copy(this.object.matrixWorld),this.object.matrix.decompose(this.position,this.quaternion,this.scale),this.euler0.setFromQuaternion(this.quaternion,"YXZ");let c=this.euler0.clone(),h=c.y;if(this.objectRealQuat.copy(this.quaternion),c.y=0,this.quaternion.setFromEuler(c),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),c.set(0,h,0),this.quaternion.setFromEuler(c),this.rot.setFromEuler(c),this.object.matrixAutoUpdate=!1,(this.isFirstPerson||this.cameraFollow===!0)&&(this.target0.copy(this.camera.getTarget()),this.zoom0=this.camera.zoom),this.cameraFollow===!0){this.position0Cam.copy(this.camera.position),this.quat0Cam.copy(this.camera.quaternion),this.scale0Cam.copy(this.camera.scale),this.hiddenMatrix0Cam.copy(this.camera.hiddenMatrix),this.camera.parent?(this.camera.hiddenMatrix.copy(this.camera?.parent.matrixWorld),this.camera.matrix.copy(this.camera.matrixWorld)):this.camera.hiddenMatrix.identity(),this.camera.matrix.copy(this.camera.matrixWorld),this.camera.matrix.decompose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.matrixAutoUpdate=!1,this.offsetMatrix.copy(this.object.matrix).invert().multiply(this.camera.matrix);let f,g=new C(0,0,-1).applyQuaternion(this.camera.quaternion),m=new C().subVectors(this.position,this.camera.position);this.objectToCamXZ.copy(m),this.objectToCamXZ.y=0,this.objectToCamXZ0.copy(this.objectToCamXZ),Math.abs(g.y)<1e-6?(m.y=0,g.y=0,f=m.projectOnVector(g)):f=m.y/g.y>0?g.multiplyScalar(m.y/g.y):g.multiplyScalar(m.length()),this.targetToCamera0.copy(f).negate();let y=this.camera.position.clone().add(f);this.objectToTarget0.subVectors(y,this.position);let v=new Ei().setFromQuaternion(this.camera.quaternion,"YXZ");this.cameraPolarOffset=-v.x,v.x=0,v.z=0,v.y-=Math.PI/2,this.cameraPolarAxis0.set(0,0,-1).applyEuler(v)}if(this.object instanceof gn&&(this.object.matrixAutoUpdate=!1),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.rotByTouch=i.rotByTouch??"joystick",this.rotBy=i.rotBy??"keys",this.rotationMode=i.rotationMode??"normal",this.moveMode=i.moveMode??"walk",this.collisionEnabled=i.collisionEnabled,this.speedTranslate=1*(i.speedTranslate??250),this.speedOrbit=.025*(i.speedRotate??100),this.mouseOrbitSensitivity=16e-6*(i.speedRotate??100),this.keyAssignments=i.keyAssignments.map(f=>{let g=[f[0],f[1]];return g[1]==="\u25B2"?g[1]="ArrowUp":g[1]==="\u25C0"?g[1]="ArrowLeft":g[1]==="\u25BC"?g[1]="ArrowDown":g[1]==="\u25B6"?g[1]="ArrowRight":g[1]==="\u21E7"?g[1]="Shift":g[1]==="\u21B5"?g[1]="Enter":g[1]==="Space"?g[1]=" ":g[1]==="\u2318"?g[1]="Meta":g[1]==="Ctrl"?g[1]="Control":g[1]==="Esc"&&(g[1]="Escape"),g}),i.rotBy==="mouse"){let f;f=this.keyAssignments.findIndex(g=>g[0]==="rotNegX"),f!==-1&&(this.keyAssignments[f][1]=""),f=this.keyAssignments.findIndex(g=>g[0]==="rotPosX"),f!==-1&&(this.keyAssignments[f][1]=""),f=this.keyAssignments.findIndex(g=>g[0]==="rotPosY"),f!==-1&&(this.keyAssignments[f][1]=""),f=this.keyAssignments.findIndex(g=>g[0]==="rotNegY"),f!==-1&&(this.keyAssignments[f][1]="")}this.lerpFactorPosStart=1-.02**(1/(60*(i.delayPos[0]??.3))),this.lerpFactorPosEnd=1-.02**(1/(60*(i.delayPos[1]??.3))),this.lerpFactorPos.setScalar(this.lerpFactorPosStart),this.lerpFactorRotStart=1-.02**(1/(60*(i.delayRot[0]??.3))),this.lerpFactorRotEnd=1-.02**(1/(60*(i.delayRot[1]??.3))),this.lerpFactorPosCamera=1-.02**(1/(60*(i.delayPosCamera??.3))),this.lerpFactorRotCamera=1-.02**(1/(60*(i.delayRotCamera??.3))),this.gravity=12*(this.gloabalPhysics.gravity??$u.defaultData.gravity),this.usePhysics=this.gloabalPhysics.usePhysics??$u.defaultData.usePhysics,this.jumpPower=20*i.jumpPower,this.resetYPosition=this.position.y+Math.abs(i.resetYPosition)*(this.gravity>0?1:-1),this.alignToGround=i.alignToGround??!1,this.orientMode=i.autoOrientMove?i.orientMode:"none",this.orientWith=i.orientWith??j_.defaultDataThirdPerson.orientWith,this.slopeThresh=65*Math.PI/180,i.collider.type==="capsule"?(this.collider.radius=i.collider.radius,this.collider.segment.start.y=i.collider.height/2-i.collider.radius,this.collider.segment.end.y=-this.collider.segment.start.y,this.offset=i.collider.height*nM/this.pixelsPerMeter,this.stepThresh=.3*i.collider.height/this.pixelsPerMeter,this.colliderHeight=i.collider.height):i.collider.type==="sphere"?(this.collider.radius=i.collider.radius,this.collider.segment.start.y=0,this.collider.segment.end.y=0,this.offset=2*i.collider.radius*nM/this.pixelsPerMeter,this.stepThresh=2*i.collider.radius*.3/this.pixelsPerMeter,this.colliderHeight=2*i.collider.radius):(this.offset=i.collider.height*nM/this.pixelsPerMeter,this.stepThresh=.3*i.collider.height/this.pixelsPerMeter,this.colliderHeight=i.collider.height),this.collider.type=i.collider.type;let d=new C().fromArray(i.collider.position.map(f=>typeof f=="number"?f:0)),u=new $t().setFromEuler(new Ei().fromArray([...i.collider.rotation.map(f=>typeof f=="number"?f:0),"XYZ"]));this.collider.position.copy(d).multiply(this.scale),this.collider.rotation.copy(u),this.collider.matrix.compose(d,u,dB),i.cameraXAxis!==void 0&&(this.cameraXAxis=i.cameraXAxis,this.cameraYAxis=i.cameraYAxis,this.minPolarAngle=i.cameraRotXLimits[0],this.maxPolarAngle=i.cameraRotXLimits[1],this.minAzimuthAngleRel=i.cameraRotYLimits[0],this.maxAzimuthAngleRel=i.cameraRotYLimits[1]),this.forwardDir=i.forwardDirection??"-z",this.isFirstPerson&&(this.forwardDir="-z"),this.runMultiplier=i.runMultiplier??2;let p=2*i.navmesh.destinationHelperRadius;if(p>0){let f=new Vt;f.push({fi:0,data:{...Ki.defaultData("light","phong"),alpha:0},id:"layer1"}),f.push({fi:0,data:{...Ki.defaultData("color"),color:i.navmesh.destinationHelperColor,alpha:i.navmesh.destinationHelperColor.a},id:"layer2"});let g=vk({layers:f},{scene:this.page.scene,shared:this.sharedAssets});this.navMeshPathDest=new xi(GC.create({parameters:{width:p,height:p/10,hollow:.7}}),g),this.navMeshPathDest.material.userData.opacity0=i.navmesh.destinationHelperColor.a}this.activate()}reset(t=!1){if(this.object.hiddenMatrix.copy(this.hiddenMatrix0),t){this.object.updateMatrix(),this.object.updateMatrixWorld(),this.object.matrix.copy(this.object.matrixWorld),this.object.matrix.decompose(this.position,this.quaternion,this.scale),this.object.parent?this.object.hiddenMatrix.copy(this.object.parent.matrixWorld).invert():this.object.hiddenMatrix.identity();let e=new Ei().setFromQuaternion(this.quaternion,"YXZ"),i=e.y;this.objectRealQuat.copy(this.quaternion),e.y=0,this.quaternion.setFromEuler(e),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),e.set(0,i,0),this.quaternion.setFromEuler(e),this.rot.setFromEuler(e),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.velocityTarget.set(0,0,0),this.velocity.set(0,0,0)}else this.object instanceof gn?this.object.matrixAutoUpdate=!0:this.object.updateMatrix();this.cameraFollow===!0&&(this.camera.quaternion.copy(this.quat0Cam),this.camera.position.copy(this.position0Cam),this.camera.scale.copy(this.scale0Cam),this.camera.hiddenMatrix.copy(this.hiddenMatrix0Cam),this.camera.matrixAutoUpdate=!0),this.controlsManager.requestRender()}activate(){this.instantiateActions(),this.domElement.ownerDocument.addEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.addEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.addEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.addEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.addEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.addEventListener("visibilitychange",this.handleVisibilityChange)}deactivate(){this.disposeActions(),this.domElement.ownerDocument.removeEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.removeEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.removeEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.removeEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.removeEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.removeEventListener("visibilitychange",this.handleVisibilityChange)}dispose(){this.deactivate(),this.navMeshPathDest?.parent&&this.page.remove(this.navMeshPathDest)}instantiateActions(){let t=this.data,e=this.sharedAssets;t.gameActions!==void 0&&(this.actions={},V_.list.forEach(i=>{this.actions[i]=Pn({...t,disabled:!1,type:"GameControl"},t.gameActions[i],this.page,e,this.controlsManager.eventManager,this.object)})),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"),this.initialAction&&(this.initialAction=!1)}disposeActions(){this.initialAction=!1,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),nr(this.actions.idle),nr(this.actions.move),nr(this.actions.run),nr(this.actions.jump)}dispatchStartEvent(t){this.actions[t]!==void 0&&(this.actionState[t]||(this.actionState[t]=!0,this.actions[t].Transition.forEach(e=>{e.play()}),this.actions[t].Animation.forEach(e=>{e.play(this.initialAction===!1)}),this.actions[t].TimelineAnimation.forEach(e=>{e.play()}),this.actions[t].Create.forEach(e=>{e.dispatchStart()}),this.actions[t].Audio.forEach(e=>{e.dispatchGameControl("start")}),this.actions[t].Particles.forEach(e=>{e.dispatchGameControl("start")})))}dispatchStopEvent(t){this.actions[t]!==void 0&&(!this.actionState[t]||(this.actionState[t]=!1,this.actions[t].Transition.forEach(e=>{e.stop(),e.object.currentState!==null&&e.object.changeSelectedState(null,{scene:this.page.scene,shared:this.sharedAssets})}),this.actions[t].TimelineAnimation.forEach(e=>{e.stop()}),this.actions[t].Create.forEach(e=>{e.dispatchStop()}),this.actions[t].Audio.forEach(e=>{e.dispatchGameControl("stop")}),this.actions[t].Particles.forEach(e=>{e.dispatchGameControl("stop")})))}get colliderWorldPosition(){return Mr.copy(this.collider.position).applyQuaternion(this.objectRealQuat).add(this.position)}update(t){if(this.gravity<0?this.position.y<this.resetYPosition:this.position.y>this.resetYPosition)return this.reset(!0),!0;this.sharedGameControlGlobals.gamePads.forEach(this.copyVRGamePadValues);let e=(this.isFirstFrame?16.6:t)/1e3;this.isFirstFrame&&(this.isFirstFrame=!1);let i=60*e,n=!1;if(this.groundYRotation=0,this.groundVelocity.set(0,0,0),this.usePhysics&&this.collisionEnabled&&this.object.rigidBody?.collider(0).shape){let s=Do.set(0,(this.velocity.y===0?this.pixelsPerMeter*Math.max(Math.abs(this.gravity)/120,1)*(this.gravity>0?1:-1):this.velocity.y)*e,0).divideScalar(this.pixelsPerMeter),a=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter),this.colliderWorldQuat,s,this.object.rigidBody?.collider(0).shape,0,1,!1,8,void 0,void 0,this.object.rigidBody);if(a){this.onObject=!0,this.groundNormal.set(a.normal2.x,a.normal2.y,a.normal2.z).applyQuaternion(this.colliderWorldQuat).negate(),this.alignToGround&&this.groundTiltAdjustment(this.groundNormal),Math.acos(this.groundNormal.y)<this.slopeThresh&&(n=!0),a.collider.parent()?.bodyType()===0&&Math.acos(this.groundNormal.y)*(180/Math.PI)>45&&(this.onObject=!1);let o=a.collider.parent(),l=o!==null&&o.isKinematic()?o:null,c=l===null?void 0:this.sharedGameControlGlobals.kinematicBodyToEntity.get(l.handle);if(l!==null&&c?.userData.isFollowingObj!==this.object.uuid){let h=this.object.getWorldPosition(Mr).add(this.collider.position).divideScalar(this.pixelsPerMeter),d=l.velocityAtPoint(h);this.groundVelocity.set(d.x,d.y,d.z).multiplyScalar(this.pixelsPerMeter),this.groundYRotation=l.angvel().y*e}}else this.onObject=!1}if(this.moveMode==="walk"&&this.collisionEnabled&&(this.movementState.jump===1&&this.onObject&&(this.velocityTarget.y=this.jumpPower,this.movementState.jump=0,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("jump"),this.onObject=!1),this.onObject?this.velocityTarget.y/=2:this.velocityTarget.y+=this.gravity*i),this.moveMode==="fly"&&(this.velocityTarget.y=(this.movementState.movePosY-this.movementState.moveNegY)*this.speedTranslate),this.directionXZ.z=this.movementState.movePosZ-this.movementState.moveNegZ,this.directionXZ.x=this.movementState.movePosX-this.movementState.moveNegX,this.forwardDir==="+z"&&this.directionXZ.multiplyScalar(-1),this.directionXZ.manhattanLength()>0&&(this.path=[]),this.navMeshPathDest){let s=this.navMeshPathDest.material;if(this.moveMode==="walk"&&this.path.length>1){this.navMeshPathDest.position.copy(this.path[this.path.length-1]),this.navMeshPathDest.parent||this.page.add(this.navMeshPathDest);let a=Mr.subVectors(this.path[1],this.position),o=Do.subVectors(this.path[1],this.path[0]);a.dot(o)<0?this.path.shift():(this.directionXZ.x=o.x,this.directionXZ.z=o.z),s.opacity=s.userData.opacity0}else s.opacity-=.05*s.userData.opacity0,this.navMeshPathDest.material.opacity<=0&&this.navMeshPathDest.parent&&this.page.remove(this.navMeshPathDest)}this.directionXZ.normalize(),this.movementState.run?this.moveForce=this.runMultiplier:this.moveForce=1,this.velocityTarget.z=this.directionXZ.z*this.speedTranslate*this.moveForce,this.velocityTarget.x=this.directionXZ.x*this.speedTranslate*this.moveForce,(this.moveMode==="walk"?this.velocityTarget.x+this.velocityTarget.z===0:this.velocityTarget.manhattanLength()===0)?this.lerpFactorPos.setScalar(this.lerpFactorPosEnd):this.lerpFactorPos.setScalar(this.lerpFactorPosStart),this.moveMode==="walk"&&(this.lerpFactorPos.y=1),this.didHit===!1&&this.pushedVelocity.manhattanLength()===0||this.usePhysics===!1?(this.velocity.x+=(this.velocityTarget.x-this.velocity.x)*(1-(1-this.lerpFactorPos.x)**i),this.velocity.y+=(this.velocityTarget.y-this.velocity.y)*(1-(1-this.lerpFactorPos.y)**i),this.velocity.z+=(this.velocityTarget.z-this.velocity.z)*(1-(1-this.lerpFactorPos.z)**i)):this.velocity.copy(this.velocityTarget),(this.moveMode==="walk"?this.velocity.x**2+this.velocity.z**2<this.speedTranslate:this.velocity.lengthSq()<this.speedTranslate)?(this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.onObject&&(this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"))):(this.dispatchStopEvent("idle"),(this.onObject||this.moveMode==="fly")&&(this.dispatchStopEvent("jump"),this.movementState.run?(this.dispatchStopEvent("move"),this.dispatchStartEvent("run")):(this.dispatchStopEvent("run"),this.dispatchStartEvent("move"))));let r=oJ.copy(this.velocity);if(this.orientMode!=="none"&&this.isFirstPerson===!1){let s=Do.copy(r);s.y=0,r.set(0,r.y,s.length()*(this.forwardDir==="+z"?1:-1))}if(this.directionXZ.manhattanLength()>0&&this.orientMode!=="none"&&this.isFirstPerson===!1)if(this.orientWith==="camera"&&this.path.length<=1){let s=Mr;this.camera.getWorldDirection(s);let a=Kd.copy(Fa).multiplyScalar(s.dot(Fa));s.sub(a);let o=Do.copy(this.directionXZ);o.x*=-1,this.rot.y=s.angleTo(o)*(s.cross(o).y>0?-1:1)+this.rotationAccumWhenOrientWithCamera}else this.rot.y=(this.path.length>1?0:this.euler.y)+Math.atan2(-this.directionXZ.z,this.directionXZ.x)+Math.PI/2*(this.forwardDir==="+z"?1:-1);if(Qd.setFromVector3(this.rot),this.moveMode==="walk"&&(Qd.x=0),r.applyEuler(Qd),n&&(sc.setFromUnitVectors(Fa,this.groundNormal),r.applyQuaternion(sc)),this.usePhysics===!0&&this.object.rigidBody){this.pushedVelocity.set(0,0,0);let s=0;for(let a of this.sharedGameControlGlobals.entitiesWithTransformAnim){if(a.rigidBody===void 0||a.prevQ===void 0)continue;(a.hasNonUniformScale?a.matrixWorldRigid:a.matrixWorld).decompose(sM,fB,dJ);let o=this.object.getWorldPosition(uJ).add(this.collider.position).sub(sM);mB.copy(a.prevQ).invert().premultiply(fB);let l=Kd.subVectors(sM,a.prevT).add(pJ.copy(o).applyQuaternion(mB).sub(o)).divideScalar(e).divideScalar(this.pixelsPerMeter),c=a.rigidBody.collider(0).castCollider(l,this.object.rigidBody.collider(0),Mr.copy(r).divideScalar(this.pixelsPerMeter),0,e,!1);l.multiplyScalar(this.pixelsPerMeter);let h=Be.is(a)?a:a.object;if(c!==null&&this.lastHitObj!==h){let d;a instanceof ys&&(d=a);let u=this.sharedGameControlGlobals.entityToCollisionEvents[h.uuid];if(u)for(let p of u)p.data.target==="character"&&(p.dispatch(d),h.dispatchEvent(ET));this.lastHitObj=h}c!==null&&(Math.abs(l.x)>Math.abs(this.pushedVelocity.x)&&(this.pushedVelocity.x=l.x),Math.abs(l.y)>Math.abs(this.pushedVelocity.y)&&(this.pushedVelocity.y=l.y),Math.abs(l.z)>Math.abs(this.pushedVelocity.z)&&(this.pushedVelocity.z=l.z),pB(s++).copy(c.normal1).applyQuaternion(a.quaternion))}if(s>0){for(let a=0;a<s;a++){let o=pB(a),l=o.dot(r);l<0&&r.addScaledVector(o,-l)}r.add(this.pushedVelocity)}else r.add(this.groundVelocity)}if(this.rotDirection.y=Number(this.movementState.rotPosY)-Number(this.movementState.rotNegY),this.rotDirection.x=Number(this.movementState.rotPosX)-Number(this.movementState.rotNegX),this.rotDirection.normalize(),this.rotationMode==="normal"&&(this.movementState.rotPosX||this.movementState.rotNegX)||this.rotationMode==="steer"&&(this.movementState.rotPosX||this.movementState.rotNegX)&&(this.movementState.movePosZ||this.movementState.moveNegZ||this.moveMode==="walk")?this.rotVelocityStick.x=-this.rotDirection.x*this.speedOrbit*this.rotForce:this.rotVelocityStick.x=0,this.rotationMode==="normal"&&(this.movementState.rotPosY||this.movementState.rotNegY)||this.rotationMode==="steer"&&(this.movementState.rotPosY||this.movementState.rotNegY)&&(this.movementState.movePosZ||this.movementState.moveNegZ)?this.rotVelocityStick.y=-this.rotDirection.y*this.speedOrbit*this.rotForce:this.rotVelocityStick.y=0,this.rotVelocityTarget.subVectors(this.eulerDelta.divideScalar(e),this.rotVelocityStick),this.rotVelocityTarget.manhattanLength()===0?this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotEnd)**i):this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotStart)**i),this.euler.x+=this.rotVelocity.x*e,this.euler.y+=this.rotVelocity.y*e+this.groundYRotation,this.rotVelocityTarget.y===0&&this.directionXZ.manhattanLength()===0?this.rotationAccumWhenOrientWithCamera=0:(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.rotationAccumWhenOrientWithCamera+=this.rotVelocity.y*e),this.isFirstPerson===!1&&this.orientMode!=="none"&&this.directionXZ.manhattanLength()>0){if(this.orientMode==="radial"){this.objectToCamXZ.copy(this.objectToCamXZ0).applyAxisAngle(Fa,this.euler.y-this.euler0.y);let s=Do.copy(this.objectToCamXZ).normalize(),a=Kd.copy(r).multiplyScalar(e);a.y=0;let o=a.sub(Mr.copy(s).multiplyScalar(a.dot(s))).cross(s).y;this.euler.y-=Math.atan2(o,this.objectToCamXZ.length())}}else this.rot.y+=this.rotVelocity.y*e+this.groundYRotation,this.rotVelocityTarget.y!==0&&(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.euler.y=this.rot.y);if(this.cameraFollow===!0&&(this.moveMode==="walk"?this.cameraXAxis==="Limit"?this.euler.x=Ot.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):this.euler.x=Ot.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset,this.PI_2+this.cameraPolarOffset):this.cameraXAxis==="Limit"&&(this.euler.x=Ot.clamp(this.euler.x,-this.PI_2,this.PI_2))),this.moveMode==="fly"?this.rot.x=this.euler.x:this.isFirstPerson&&(Qd.copy(this.euler),Qd.y=0,this.nonColliderRotOffset.makeRotationFromEuler(Qd)),ds.setFromAxisAngle(hJ,this.rot.x),sc.setFromAxisAngle(Fa,this.rot.y),sc.multiply(ds),ds.setFromAxisAngle(cJ,this.rot.z),sc.multiply(ds),this.quaternion.copy(sc),this.objectRealQuat.multiplyQuaternions(this.quaternion,this.objXZQuat),this.colliderWorldQuat.copy(this.objectRealQuat).multiply(this.collider.rotation),this.collisionEnabled)if(this.usePhysics&&this.object.rigidBody?.collider(0).shape){let s=Do.copy(r).multiplyScalar(e/this.pixelsPerMeter),a=null;this.didHit=!1;let o=new C;for(let h=0;h<5;h++){let d=s.length(),u=Kd.copy(s).normalize();if(a=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(o),this.colliderWorldQuat,u,this.object.rigidBody.collider(0).shape,0,d,!1,12,void 0,void 0,this.object.rigidBody),a===null){h===0&&this.directionXZ.manhattanLength()!==0&&(this.lastHitObj=null),o.add(s);break}{this.didHit=!0;let p=this.sharedGameControlGlobals.colliderToEntity.get(a.collider.handle);if(p!==this.lastHitObj&&h===0){this.lastHitObj=p;let y=this.sharedGameControlGlobals.entityToCollisionEvents[p?.uuid];if(y){for(let v of y)if(v.data.target==="character"){let _,b=(this.sharedGameControlGlobals.rapierWorld?.getCollider(a.collider.handle))._parent;if(p.cloner){for(let x of p.cloner.children)if(x.rigidBody===b){_=x;break}}v.dispatch(_),p.dispatchEvent(ET)}}}let f=lB.set(a.normal2.x,a.normal2.y,a.normal2.z).applyQuaternion(this.colliderWorldQuat),g=hB.copy(u).multiplyScalar(a.time_of_impact).dot(f),m=a.time_of_impact;if(m===0&&(this.position.y+=this.offset*this.pixelsPerMeter),g>this.offset&&(m=a.time_of_impact*(g-this.offset)/g,o.addScaledVector(u,m)),s.copy(u).multiplyScalar(d-m),Math.acos(-f.y)>this.slopeThresh){let y=this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(o),v=Kd.copy(a.witness2).applyQuaternion(this.colliderWorldQuat);v.y=0;let _=y.add(v);_.y+=this.stepThresh;let b=this.sharedGameControlGlobals.rapierWorld.castShape(_,this.colliderWorldQuat,s,this.object.rigidBody?.collider(0).shape,0,1,!1,12,void 0,void 0,this.object.rigidBody);b!==null&&b.time_of_impact===0&&(f.y=0,f.normalize())}s.addScaledVector(f,-s.dot(f))}}this.position.addScaledVector(o,this.pixelsPerMeter),Mr.copy(this.position).divideScalar(this.pixelsPerMeter),ds.copy(this.quaternion).premultiply(this.groundTilt).multiply(this.objXZQuat);let l=this.object.rigidBody,c=l!==void 0&&fJ.copy(Mr).sub(l.translation()).lengthSq()>1;l!==void 0&&(c?(l.setTranslation(Mr,!0),l.setRotation(ds,!0)):(l.setNextKinematicTranslation(Mr),l.setNextKinematicRotation(ds)))}else{let s=this.onObject?1:5,a=r.multiplyScalar(e/s);for(let o=0;o<s;o++)this.position.add(a),this.collisionAdjustment(e/s)}else this.position.addScaledVector(r,e);if(this.moveMode==="walk"&&this.onObject&&(this.velocityTarget.y=0,this.velocity.y=0),this.quaternion.premultiply(this.groundTilt).multiply(this.objXZQuat),this.object.matrix.compose(this.position,this.quaternion,this.scale),this.object.matrixWorldNeedsUpdate=!0,this.object.matrix.multiply(this.nonColliderPosOffset).multiply(this.nonColliderRotOffset),this.quaternion.premultiply(this.groundTiltInv).multiply(this.objXZQuatInv),this.cameraFollow===!0){this.updateFollowArms();let s=this.objectToTarget.add(this.position),a=this.targetToCamera.add(s);rM.lookAt(a,s,Fa).setPosition(a),rM.decompose(this.targetPos,this.targetQuat,Mr),this.camera.quaternion.slerp(this.targetQuat,1-(1-this.lerpFactorRotCamera)**i),this.camera.position.lerp(this.targetPos,1-(1-this.lerpFactorPosCamera)**i),this.camera.updateMatrix(),this.camera.updateMatrixWorld(),this.cameraYAxis==="Limit"&&this.orientMode==="cartesian"&&(this.euler.y=Ot.clamp(this.euler.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel)),this.euler.x=Ot.clamp(this.euler.x,-this.PI_2+(this.cameraPolarOffset<0?this.cameraPolarOffset:0),this.PI_2+(this.cameraPolarOffset>0?this.cameraPolarOffset:0))}return this.eulerDelta.set(0,0,0),this.object.dispatchEvent(gJ),!(this.path.length<2&&this.lastPosition.distanceToSquared(this.position)<this.threshEndTranslate&&Math.abs(this.rotVelocity.x)<this.threshEndRotVel&&Math.abs(this.rotVelocity.y)<this.threshEndRotVel&&(this.camera===void 0||this.isFirstPerson||this.lastCameraPosition.distanceToSquared(this.camera.position)<this.threshEndTranslate&&8*(1-this.lastCameraQuaternion.dot(this.camera.quaternion))<this.threshEndRotate)&&(this.moveMode==="fly"||this.onObject===!0||this.collisionEnabled===!1)&&(this.navMeshPathDest===null||this.navMeshPathDest.material.opacity<-.04*this.navMeshPathDest?.material?.userData.opacity0)||(this.camera&&(this.lastCameraPosition.copy(this.camera.position),this.lastCameraQuaternion.copy(this.camera.quaternion)),this.lastPosition.copy(this.position),this.object.dispatchEvent(mJ),0))}updateFollowArms(){this.objectToTarget.copy(this.objectToTarget0),this.targetToCamera.copy(this.targetToCamera0);let t,e=ds.setFromAxisAngle(Fa,this.cameraYAxis==="Limit"&&this.orientMode!=="radial"?Ot.clamp(this.euler.y-this.euler0.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel):this.euler.y-this.euler0.y);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&this.objectToTarget.applyQuaternion(e),t=this.cameraXAxis==="Limit"?Ot.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):Ot.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset+1e-6,this.PI_2+this.cameraPolarOffset-1e-6);let i=Mr.copy(this.cameraPolarAxis0);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&i.applyQuaternion(e);let n=sc.setFromAxisAngle(i,t);this.cameraYAxis!=="Locked"&&this.targetToCamera.applyQuaternion(e),this.cameraXAxis!=="Locked"&&this.targetToCamera.applyQuaternion(n)}groundTiltAdjustment(t){180*Fa.angleTo(t)/Math.PI<15||180*Fa.angleTo(t)/Math.PI>85?ds.identity():ds.setFromUnitVectors(Fa,t),this.groundTilt.slerp(ds,.06),this.groundTiltInv.copy(this.groundTilt).invert()}collisionAdjustment(t){let e=hB.set(0,0,0);this.object.matrix.compose(this.position,this.quaternion,this.scale);let i=rM.multiplyMatrices(this.object.matrix,this.objXZRotMat).multiply(this.collider.matrix).decompose(Mr,ds,Do).compose(Mr,ds,dB);this.sharedGameControlGlobals.entitiesWithTransformAnim.forEach(r=>{if(r===this.object||r.isDescendantOf(this.object)||!r.bvhGeometry||!r.bvhGeometry.boundsTree)return;Os.makeEmpty(),r.updateMatrixWorldRigid();let s=r.matrixWorldRigid,a=cB.copy(s).invert(),o=lJ.copy(cB).multiply(i);Zn.copy(this.collider.segment),Zn.start.applyMatrix4(o),Zn.end.applyMatrix4(o);let l=lB.copy(this.position).applyMatrix4(a);Os.expandByPoint(Zn.start),Os.expandByPoint(Zn.end),Os.min.addScalar(-this.collider.radius),Os.max.addScalar(this.collider.radius),r.bvhGeometry.boundsTree.shapecast({boundsTraverseOrder:c=>c.distanceToPoint(Zn.end),intersectsBounds:c=>c.intersectsBox(Os),intersectsTriangle:c=>{let h=Mr,d=Do,u=c.closestPointToSegment(Zn,h,d);if(u<this.collider.radius){let p=this.collider.radius-u,f=d.sub(h).normalize(),g=Kd.copy(l);g.addScaledVector(f,p);let m=g.applyMatrix4(s).sub(this.position);e.add(m),Zn.start.addScaledVector(f,p),Zn.end.addScaledVector(f,p)}}})}),Os.makeEmpty(),Zn.copy(this.collider.segment),Zn.start.applyMatrix4(i),Zn.end.applyMatrix4(i),Os.expandByPoint(Zn.start),Os.expandByPoint(Zn.end),Os.min.addScalar(-this.collider.radius),Os.max.addScalar(this.collider.radius),this.sharedGameControlGlobals.staticMeshBVH?.shapecast({boundsTraverseOrder:r=>r.distanceToPoint(Zn.end),intersectsBounds:r=>r.intersectsBox(Os),intersectsTriangle:r=>{let s=Mr,a=Do,o=r.closestPointToSegment(Zn,s,a);if(o<this.collider.radius){let l=this.collider.radius-o,c=a.sub(s).normalize();this.alignToGround&&this.groundTiltAdjustment(c),e.addScaledVector(c,l),Zn.start.addScaledVector(c,l),Zn.end.addScaledVector(c,l)}}}),this.onObject=Math.abs(e.y)>Math.abs(t*this.velocity.y*.25),this.onObject&&this.dispatchStopEvent("jump");let n=Math.max(0,e.length()-1e-5);e.normalize().multiplyScalar(n),this.position.add(e)}pause(){this.firstPointerId=-1,this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0},this.deactivate()}resume(){this.activate()}},$V=AT;$V.isLocked=!1,et(),Hg(),Mp(),Sp();var YV,ZV,aM,vJ=new Promise(t=>{YV=t});function yJ(t){return aM||(aM=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.31/build";typeof window<"u"&&(ZV=new URL(e.endsWith("/")?e:`${e}/`,window.location.href).href);let i=import("./navmesh.js"),[n,r]=await Promise.all([i,fetch(`${e}/navmesh.wasm`).then(o=>o.arrayBuffer())]),s=n.default,a=await s({wasmBinary:r});YV(a)}(),aM)}ii();var KV,Fe,ur,_J=t=>`
|
|
9849
|
+
`)>=0&&(t-=r),i===3?.5*e-.5*t:i===2?e-t:0}getLineInitialOffsetY(t,e,i,n,r){let s=e*t,a=t-Math.abs(this.ascender-this.descender)*n,o=-this.ascender*n-a/2;return r===3?-(i-s-o):r===2?-(.5*i-.5*s-o):o}createPath(t,e,i,n,r){let s=t.getPath(i,-n,r.fontSize,{kerning:!1,letterSpacing:r.letterSpacing});if(!s)return void console.error('THREE.Font: character "'+t+'" does not exists in font family '+this.familyName+".");let a=new qQ,o=(t.advanceWidth??1)*e;if(t)for(let l of s.commands){let c=a.currentPath?.currentPoint;if(!c||l.type==="Z"||c.x!==l.x||-c.y!==l.y)switch(l.type){case"M":a.moveTo(l.x,-l.y);break;case"L":a.lineTo(l.x,-l.y);break;case"Q":a.quadraticCurveTo(l.x1,-l.y1,l.x,-l.y);break;case"C":a.bezierCurveTo(l.x1,-l.y1,l.x2,-l.y2,l.x,-l.y)}}return a.subPaths.forEach(l=>{let c=function(h){if(h.length){let d=h[0];if(d instanceof ps)return d.v1;if(d instanceof zs||d instanceof Go)return d.v0}}(l.curves);c!==void 0&&l.currentPoint.distanceTo(c)>0&&l.lineTo(c.x,c.y)}),{offsetX:o,path:a}}getCharWidth(t,e){try{return this.font?.getAdvanceWidth(t,e.fontSize,{kerning:!0,letterSpacing:e.letterSpacing})??0}catch(i){return this.warnLayoutError(i),0}}getTextWidth(t,e){try{return this.font?.getAdvanceWidth(t,e.fontSize,{kerning:!0,letterSpacing:e.letterSpacing})??0}catch(i){return this.warnLayoutError(i),0}}computeSpaceWidthForLine(t,e,i,n){let r=this.getCharWidth(" ",i),s=t[e];if(s){let a=this.countSpaces(s.trimEnd());if(i.horizontalAlign===4&&e<t.length-1&&a)return((typeof i.width=="string"?Number(n.getVariable(i.width)):i.width)-(this.getTextWidth(s,i)-a*r))/a}return r}countSpaces(t){return(t.match(/ /g)||[]).length}},wi("text"),Yt();var NV=null;function tB(){return NV}function YQ(t){let e=!1;return t.scene.objects.forEach(i=>{i.data.type==="Page"&&!e&&i.data.publish.gameControlObject&&jc.traverseModuleInstances(t,i.id,(n,r,s)=>{for(let a of s)a.data.type==="GameControl"&&a.data.navmesh.enabled&&(e=!0)})}),e}ii();var oy=(t,e)=>{let i=e.x-t.x,n=e.y-t.y;return Math.sqrt(i*i+n*n)},X2=t=>t*(Math.PI/180),ly=new Map,_b=(t,e,i)=>{let n,r=e.split(/[ ,]+/g);for(let s=0;s<r.length;s+=1)n=r[s],t.addEventListener?t.addEventListener(n,i,!1):t.attachEvent&&t.attachEvent(n,i)},bb=(t,e,i)=>{let n,r=e.split(/[ ,]+/g);for(let s=0;s<r.length;s+=1)n=r[s],t.removeEventListener?t.removeEventListener(n,i):t.detachEvent&&t.detachEvent(n,i)},kV=t=>(t.preventDefault(),t.type.match(/^touch/)?t.changedTouches:t),eB=()=>{if(!(typeof window>"u"))return{x:window.pageXOffset!==void 0?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,y:window.pageYOffset!==void 0?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop}},$2=(t,e)=>{e.top||e.right||e.bottom||e.left?(t.style.top=e.top,t.style.right=e.right,t.style.bottom=e.bottom,t.style.left=e.left):(t.style.left=e.x+"px",t.style.top=e.y+"px")},Y2=(t,e,i)=>{let n=VV(t);for(let r in n)if(Object.prototype.hasOwnProperty.call(n,r))if(typeof e=="string")n[r]=e+" "+i;else{let s="";for(let a=0,o=e.length;a<o;a+=1)s+=e[a]+" "+i+", ";n[r]=s.slice(0,-2)}return n},VV=t=>{let e={};return e[t]="",["webkit","Moz","o"].forEach(function(i){e[i+t.charAt(0).toUpperCase()+t.slice(1)]=""}),e},Z2=(t,e)=>{for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},MT=(t,e)=>{if(t.length)for(let i=0,n=t.length;i<n;i+=1)e(t[i]);else e(t)};typeof window<"u"&&(jV="ontouchstart"in window,GV=!!window.PointerEvent,HV=!!window.MSPointerEvent);var jV,GV,HV,$d,iB={start:"mousedown",move:"mousemove",end:"mouseup"},Zf={};function mc(){}GV?$d={start:"pointerdown",move:"pointermove",end:"pointerup, pointercancel"}:HV?$d={start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:jV?($d={start:"touchstart",move:"touchmove",end:"touchend, touchcancel"},Zf=iB):$d=iB,mc.prototype.on=function(t,e){var i,n=this,r=t.split(/[ ,]+/g);n._handlers_=n._handlers_||{};for(var s=0;s<r.length;s+=1)i=r[s],n._handlers_[i]=n._handlers_[i]||[],n._handlers_[i].push(e);return n},mc.prototype.off=function(t,e){var i=this;return i._handlers_=i._handlers_||{},t===void 0?i._handlers_={}:e===void 0?i._handlers_[t]=null:i._handlers_[t]&&i._handlers_[t].indexOf(e)>=0&&i._handlers_[t].splice(i._handlers_[t].indexOf(e),1),i},mc.prototype.trigger=function(t,e){var i,n=this,r=t.split(/[ ,]+/g);n._handlers_=n._handlers_||{};for(var s=0;s<r.length;s+=1)i=r[s],n._handlers_[i]&&n._handlers_[i].length&&n._handlers_[i].forEach(function(a){a.call(n,{type:i,target:n},e)})},mc.prototype.config=function(t){var e=this;e.options=e.defaults||{},t&&(e.options=((i,n)=>{let r={};for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&Object.prototype.hasOwnProperty.call(n,s)?r[s]=n[s]:Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s]);return r})(e.options,t))},mc.prototype.bindEvt=function(t,e){var i=this;return i._domHandlers_=i._domHandlers_||{},i._domHandlers_[e]=function(){typeof i["on"+e]=="function"?i["on"+e].apply(i,arguments):console.warn('[WARNING] : Missing "on'+e+'" handler.')},_b(t,$d[e],i._domHandlers_[e]),Zf[e]&&_b(t,Zf[e],i._domHandlers_[e]),i},mc.prototype.unbindEvt=function(t,e){var i=this;return i._domHandlers_=i._domHandlers_||{},bb(t,$d[e],i._domHandlers_[e]),Zf[e]&&bb(t,Zf[e],i._domHandlers_[e]),delete i._domHandlers_[e],this};var O3=mc;function zn(t,e){return this.identifier=e.identifier,this.position=e.position,this.frontPosition=e.frontPosition,this.collection=t,this.defaults={size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,mode:"dynamic",zone:document.body,lockX:!1,lockY:!1,shape:"circle"},this.config(e),this.options.mode==="dynamic"&&(this.options.restOpacity=0),this.id=zn.id,zn.id+=1,this.buildEl().stylize(),this.instance={el:this.ui.el,on:this.on.bind(this),off:this.off.bind(this),show:this.show.bind(this),hide:this.hide.bind(this),add:this.addToDom.bind(this),remove:this.removeFromDom.bind(this),destroy:this.destroy.bind(this),setPosition:this.setPosition.bind(this),resetDirection:this.resetDirection.bind(this),computeDirection:this.computeDirection.bind(this),trigger:this.trigger.bind(this),position:this.position,frontPosition:this.frontPosition,ui:this.ui,identifier:this.identifier,id:this.id,options:this.options},this.instance}zn.prototype=new O3,zn.constructor=zn,zn.id=0,zn.prototype.buildEl=function(t){return this.ui={},this.options.dataOnly||(this.ui.el=document.createElement("div"),this.ui.back=document.createElement("div"),this.ui.front=document.createElement("div"),this.ui.el.className="nipple collection_"+this.collection.id,this.ui.back.className="back",this.ui.front.className="front",this.ui.el.setAttribute("id","nipple_"+this.collection.id+"_"+this.id),this.ui.el.appendChild(this.ui.back),this.ui.el.appendChild(this.ui.front)),this},zn.prototype.stylize=function(){if(this.options.dataOnly)return this;var t=this.options.fadeTime+"ms",e=(()=>{let r=VV("borderRadius");for(let s in r)Object.prototype.hasOwnProperty.call(r,s)&&(r[s]="50%");return r})(),i=Y2("transition","opacity",t),n={};return n.el={position:"absolute",opacity:this.options.restOpacity,display:"block",zIndex:999},n.back={position:"absolute",display:"block",width:this.options.size+"px",height:this.options.size+"px",marginLeft:-this.options.size/2+"px",marginTop:-this.options.size/2+"px",background:"rgba(255, 255, 255, .4)",border:"solid 2px rgba(0, 0, 0, .1)"},n.front={width:this.options.size/2+"px",height:this.options.size/2+"px",position:"absolute",display:"block",marginLeft:-this.options.size/4+"px",marginTop:-this.options.size/4+"px",background:"rgba(255, 255, 255, .8)",border:"solid 2px rgba(0, 0, 0, .1)"},Z2(n.el,i),this.options.shape==="circle"&&Z2(n.back,e),Z2(n.front,e),this.applyStyles(n),this},zn.prototype.applyStyles=function(t){for(var e in this.ui)if(Object.prototype.hasOwnProperty.call(this.ui,e))for(var i in t[e])this.ui[e].style[i]=t[e][i];return this},zn.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)||this.options.zone.appendChild(this.ui.el),this},zn.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)||this.options.zone.removeChild(this.ui.el),this},zn.prototype.destroy=function(){clearTimeout(this.removeTimeout),clearTimeout(this.showTimeout),clearTimeout(this.restTimeout),this.trigger("destroyed",this.instance),this.removeFromDom(),this.off(),this.ui=null,this.instance=null,this.collection=null,this.options=null},zn.prototype.show=function(t){var e=this;return e.options.dataOnly||(clearTimeout(e.removeTimeout),clearTimeout(e.showTimeout),clearTimeout(e.restTimeout),e.addToDom(),e.restCallback(),setTimeout(function(){e.ui.el.style.opacity=1},0),e.showTimeout=setTimeout(function(){e.trigger("shown",e.instance),typeof t=="function"&&t.call(this)},e.options.fadeTime)),e},zn.prototype.hide=function(t){var e=this;if(e.options.dataOnly)return e;if(e.ui.el.style.opacity=e.options.restOpacity,clearTimeout(e.removeTimeout),clearTimeout(e.showTimeout),clearTimeout(e.restTimeout),e.removeTimeout=setTimeout(function(){var i=e.options.mode==="dynamic"?"none":"block";e.ui.el.style.display=i,typeof t=="function"&&t.call(e),e.trigger("hidden",e.instance)},e.options.fadeTime),e.options.restJoystick){let i=e.options.restJoystick,n={};n.x=i===!0||i.x!==!1?0:e.instance.frontPosition.x,n.y=i===!0||i.y!==!1?0:e.instance.frontPosition.y,e.setPosition(t,n)}return e},zn.prototype.setPosition=function(t,e){var i=this;i.frontPosition={x:e.x,y:e.y};var n=i.options.fadeTime+"ms",r={};r.front=Y2("transition",["top","left"],n);var s={front:{}};s.front={left:i.frontPosition.x+"px",top:i.frontPosition.y+"px"},i.applyStyles(r),i.applyStyles(s),i.restTimeout=setTimeout(function(){typeof t=="function"&&t.call(i),i.restCallback()},i.options.fadeTime)},zn.prototype.restCallback=function(){var t=this,e={};e.front=Y2("transition","none",""),t.applyStyles(e),t.trigger("rested",t.instance)},zn.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}},zn.prototype.computeDirection=function(t){var e,i,n,r=t.angle.radian,s=Math.PI/4,a=Math.PI/2;if(r>s&&r<3*s&&!t.lockX?e="up":r>-s&&r<=s&&!t.lockY?e="left":r>3*-s&&r<=-s&&!t.lockX?e="down":t.lockY||(e="right"),t.lockY||(i=r>-a&&r<a?"left":"right"),t.lockX||(n=r>0?"up":"down"),t.force>this.options.threshold){var o,l={};for(o in this.direction)Object.prototype.hasOwnProperty.call(this.direction,o)&&(l[o]=this.direction[o]);var c={};for(o in this.direction={x:i,y:n,angle:e},t.direction=this.direction,l)l[o]===this.direction[o]&&(c[o]=!0);if(c.x&&c.y&&c.angle)return t;(!c.x||!c.y)&&this.trigger("plain",t),c.x||this.trigger("plain:"+i,t),c.y||this.trigger("plain:"+n,t),c.angle||this.trigger("dir dir:"+e,t)}else this.resetDirection();return t};var ZQ=zn;function on(t,e){var i=this;i.nipples=[],i.idles=[],i.actives=[],i.ids=[],i.pressureIntervals={},i.manager=t,i.id=on.id,on.id+=1,i.defaults={zone:document.body,multitouch:!1,maxNumberOfNipples:10,mode:"dynamic",position:{top:0,left:0},catchDistance:200,size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,lockX:!1,lockY:!1,shape:"circle",dynamicPage:!1,follow:!1},i.config(e),(i.options.mode==="static"||i.options.mode==="semi")&&(i.options.multitouch=!1),i.options.multitouch||(i.options.maxNumberOfNipples=1);let n=getComputedStyle(i.options.zone.parentElement);return n&&n.display==="flex"&&(i.parentIsFlex=!0),i.updateBox(),i.prepareNipples(),i.bindings(),i.begin(),i.nipples}on.prototype=new O3,on.constructor=on,on.id=0,on.prototype.prepareNipples=function(){var t=this,e=t.nipples;e.on=t.on.bind(t),e.off=t.off.bind(t),e.options=t.options,e.destroy=t.destroy.bind(t),e.ids=t.ids,e.id=t.id,e.processOnMove=t.processOnMove.bind(t),e.processOnEnd=t.processOnEnd.bind(t),e.get=function(i){if(i===void 0)return e[0];for(var n=0,r=e.length;n<r;n+=1)if(e[n].identifier===i)return e[n];return!1}},on.prototype.bindings=function(){var t=this;t.bindEvt(t.options.zone,"start"),t.options.zone.style.touchAction="none",t.options.zone.style.msTouchAction="none"},on.prototype.begin=function(){var t=this,e=t.options;if(e.mode==="static"){var i=t.createNipple(e.position,t.manager.getIdentifier());i.add(),t.idles.push(i)}},on.prototype.createNipple=function(t,e){var i=this,n=i.manager.scroll,r={},s=i.options,a=i.parentIsFlex?n.x:n.x+i.box.left,o=i.parentIsFlex?n.y:n.y+i.box.top;if(t.x&&t.y)r={x:t.x-a,y:t.y-o};else if(t.top||t.right||t.bottom||t.left){var l=document.createElement("DIV");l.style.display="hidden",l.style.top=t.top,l.style.right=t.right,l.style.bottom=t.bottom,l.style.left=t.left,l.style.position="absolute",s.zone.appendChild(l);var c=l.getBoundingClientRect();s.zone.removeChild(l),r=t,t={x:c.left+n.x,y:c.top+n.y}}var h=new ZQ(i,{color:s.color,size:s.size,threshold:s.threshold,fadeTime:s.fadeTime,dataOnly:s.dataOnly,restJoystick:s.restJoystick,restOpacity:s.restOpacity,mode:s.mode,identifier:e,position:t,zone:s.zone,frontPosition:{x:0,y:0},shape:s.shape});return s.dataOnly||($2(h.ui.el,r),$2(h.ui.front,h.frontPosition)),i.nipples.push(h),i.trigger("added "+h.identifier+":added",h),i.manager.trigger("added "+h.identifier+":added",h),i.bindNipple(h),h},on.prototype.updateBox=function(){this.box=this.options.zone.getBoundingClientRect()},on.prototype.bindNipple=function(t){var e,i=this,n=function(r,s){e=r.type+" "+s.id+":"+r.type,i.trigger(e,s)};t.on("destroyed",i.onDestroyed.bind(i)),t.on("shown hidden rested dir plain",n),t.on("dir:up dir:right dir:down dir:left",n),t.on("plain:up plain:right plain:down plain:left",n)},on.prototype.pressureFn=function(t,e,i){var n=this,r=0;clearInterval(n.pressureIntervals[i]),n.pressureIntervals[i]=setInterval(function(){var s=t.force||t.pressure||t.webkitForce||0;s!==r&&(e.trigger("pressure",s),n.trigger("pressure "+e.identifier+":pressure",s),r=s)}.bind(n),100)},on.prototype.onstart=function(t){var e=this,i=e.options,n=t;return t=kV(t),e.updateBox(),MT(t,function(r){e.actives.length<i.maxNumberOfNipples?e.processOnStart(r):n.type.match(/^touch/)&&(Object.keys(e.manager.ids).forEach(function(s){if(Object.values(n.touches).findIndex(function(o){return o.identifier===s})<0){var a=[t[0]];a.identifier=s,e.processOnEnd(a)}}),e.actives.length<i.maxNumberOfNipples&&e.processOnStart(r))}),e.manager.bindDocument(),!1},on.prototype.processOnStart=function(t){var e,i=this,n=i.options,r=i.manager.getIdentifier(t),s=t.force||t.pressure||t.webkitForce||0,a={x:t.pageX,y:t.pageY},o=i.getOrCreate(r,a);o.identifier!==r&&i.manager.removeIdentifier(o.identifier),o.identifier=r;var l=function(c){c.trigger("start",c),i.trigger("start "+c.id+":start",c),c.show(),s>0&&i.pressureFn(t,c,c.identifier),i.processOnMove(t)};if((e=i.idles.indexOf(o))>=0&&i.idles.splice(e,1),i.actives.push(o),i.ids.push(o.identifier),n.mode!=="semi")l(o);else{if(!(oy(a,o.position)<=n.catchDistance))return o.destroy(),void i.processOnStart(t);l(o)}return o},on.prototype.getOrCreate=function(t,e){var i,n=this,r=n.options;return/(semi|static)/.test(r.mode)?(i=n.idles[0])?(n.idles.splice(0,1),i):r.mode==="semi"?n.createNipple(e,t):(console.warn("Coudln't find the needed nipple."),!1):i=n.createNipple(e,t)},on.prototype.processOnMove=function(t){var e=this,i=e.options,n=e.manager.getIdentifier(t),r=e.nipples.get(n),s=e.manager.scroll;if((_=>isNaN(_.buttons)?_.pressure!==0:_.buttons!==0)(t)){if(!r)return console.error("Found zombie joystick with ID "+n),void e.manager.removeIdentifier(n);if(i.dynamicPage){var a=r.el.getBoundingClientRect();r.position={x:s.x+a.left,y:s.y+a.top}}r.identifier=n;var o=r.options.size/2,l={x:t.pageX,y:t.pageY};i.lockX&&(l.y=r.position.y),i.lockY&&(l.x=r.position.x);var c,h,d=oy(l,r.position),u=((_,b)=>{let x=b.x-_.x,w=b.y-_.y;return(S=>S*(180/Math.PI))(Math.atan2(w,x))})(l,r.position),p=X2(u),f=d/o,g={distance:d,position:l};if(r.options.shape==="circle"?(c=Math.min(d,o),h=((_,b,x)=>{let w={x:0,y:0};return x=X2(x),w.x=_.x-b*Math.cos(x),w.y=_.y-b*Math.sin(x),w})(r.position,c,u)):(h=((_,b,x)=>({x:Math.min(Math.max(_.x,b.x-x),b.x+x),y:Math.min(Math.max(_.y,b.y-x),b.y+x)}))(l,r.position,o),c=oy(h,r.position)),i.follow){if(d>o){let _=l.x-h.x,b=l.y-h.y;r.position.x+=_,r.position.y+=b,r.el.style.top=r.position.y-(e.box.top+s.y)+"px",r.el.style.left=r.position.x-(e.box.left+s.x)+"px",d=oy(l,r.position)}}else l=h,d=c;var m=l.x-r.position.x,y=l.y-r.position.y;r.frontPosition={x:m,y},i.dataOnly||$2(r.ui.front,r.frontPosition);var v={identifier:r.identifier,position:l,force:f,pressure:t.force||t.pressure||t.webkitForce||0,distance:d,angle:{radian:p,degree:u},vector:{x:m/o,y:-y/o},raw:g,instance:r,lockX:i.lockX,lockY:i.lockY};(v=r.computeDirection(v)).angle={radian:X2(180-u),degree:180-u},r.trigger("move",v),e.trigger("move "+r.id+":move",v)}else this.processOnEnd(t)},on.prototype.processOnEnd=function(t){var e=this,i=e.options,n=e.manager.getIdentifier(t),r=e.nipples.get(n),s=e.manager.removeIdentifier(r.identifier);!r||(i.dataOnly||r.hide(function(){i.mode==="dynamic"&&(r.trigger("removed",r),e.trigger("removed "+r.id+":removed",r),e.manager.trigger("removed "+r.id+":removed",r),r.destroy())}),clearInterval(e.pressureIntervals[r.identifier]),r.resetDirection(),r.trigger("end",r),e.trigger("end "+r.id+":end",r),e.ids.indexOf(r.identifier)>=0&&e.ids.splice(e.ids.indexOf(r.identifier),1),e.actives.indexOf(r)>=0&&e.actives.splice(e.actives.indexOf(r),1),/(semi|static)/.test(i.mode)?e.idles.push(r):e.nipples.indexOf(r)>=0&&e.nipples.splice(e.nipples.indexOf(r),1),e.manager.unbindDocument(),/(semi|static)/.test(i.mode)&&(e.manager.ids[s.id]=s.identifier))},on.prototype.onDestroyed=function(t,e){var i=this;i.nipples.indexOf(e)>=0&&i.nipples.splice(i.nipples.indexOf(e),1),i.actives.indexOf(e)>=0&&i.actives.splice(i.actives.indexOf(e),1),i.idles.indexOf(e)>=0&&i.idles.splice(i.idles.indexOf(e),1),i.ids.indexOf(e.identifier)>=0&&i.ids.splice(i.ids.indexOf(e.identifier),1),i.manager.removeIdentifier(e.identifier),i.manager.unbindDocument()},on.prototype.destroy=function(){var t=this;for(var e in t.unbindEvt(t.options.zone,"start"),t.nipples.forEach(function(i){i.destroy()}),t.pressureIntervals)Object.prototype.hasOwnProperty.call(t.pressureIntervals,e)&&clearInterval(t.pressureIntervals[e]);t.trigger("destroyed",t.nipples),t.manager.unbindDocument(),t.off(),t.pressureIntervals={},t.nipples=[],t.idles=[],t.actives=[],t.ids=[],t.manager=null};var KQ=on;function Sn(t){var e=this;e.ids={},e.index=0,e.collections=[],e.scroll=eB(),e._windowBound=!1,e.config(t),e.prepareCollections();var i=function(){var n;e.collections.forEach(function(r){r.forEach(function(s){n=s.el.getBoundingClientRect(),s.position={x:e.scroll.x+n.left,y:e.scroll.y+n.top}})})};return e._onResize=function(){(n=>{ly.has(n)&&clearTimeout(ly.get(n)),ly.set(n,setTimeout(function(){ly.delete(n),n()},100))})(i)},e._onScroll=function(){e.scroll=eB()},e.collections}Sn.prototype=new O3,Sn.constructor=Sn,Sn.prototype.prepareCollections=function(){var t=this;t.collections.create=t.create.bind(t),t.collections.on=t.on.bind(t),t.collections.off=t.off.bind(t),t.collections.destroy=t.destroy.bind(t),t.collections.get=function(e){var i;return t.collections.every(function(n){return!(i=n.get(e))}),i}},Sn.prototype.create=function(t){return this.createCollection(t)},Sn.prototype.bindWindowEvents=function(){var t=this;t._windowBound||typeof window>"u"||(t._windowBound=!0,_b(window,"resize",t._onResize),_b(window,"scroll",t._onScroll))},Sn.prototype.unbindWindowEvents=function(){var t=this;!t._windowBound||typeof window>"u"||(t._windowBound=!1,bb(window,"resize",t._onResize),bb(window,"scroll",t._onScroll))},Sn.prototype.createCollection=function(t){var e=this,i=new KQ(e,t);return e.bindCollection(i),e.collections.push(i),e.bindWindowEvents(),i},Sn.prototype.bindCollection=function(t){var e,i=this,n=function(r,s){e=r.type+" "+s.id+":"+r.type,i.trigger(e,s)};t.on("destroyed",i.onDestroyed.bind(i)),t.on("shown hidden rested dir plain",n),t.on("dir:up dir:right dir:down dir:left",n),t.on("plain:up plain:right plain:down plain:left",n)},Sn.prototype.bindDocument=function(){var t=this;t.binded||(t.bindEvt(document,"move").bindEvt(document,"end"),t.binded=!0)},Sn.prototype.unbindDocument=function(t){var e=this;(!Object.keys(e.ids).length||t===!0)&&(e.unbindEvt(document,"move").unbindEvt(document,"end"),e.binded=!1)},Sn.prototype.getIdentifier=function(t){var e;return t?(e=t.identifier===void 0?t.pointerId:t.identifier)===void 0&&(e=this.latest||0):e=this.index,this.ids[e]===void 0&&(this.ids[e]=this.index,this.index+=1),this.latest=e,this.ids[e]},Sn.prototype.removeIdentifier=function(t){var e={};for(var i in this.ids)if(this.ids[i]===t){e.id=i,e.identifier=this.ids[i],delete this.ids[i];break}return e},Sn.prototype.onmove=function(t){return this.onAny("move",t),!1},Sn.prototype.onend=function(t){return this.onAny("end",t),!1},Sn.prototype.oncancel=function(t){return this.onAny("end",t),!1},Sn.prototype.onAny=function(t,e){var i,n=this,r="processOn"+t.charAt(0).toUpperCase()+t.slice(1);e=kV(e);var s=function(a,o,l){l.ids.indexOf(o)>=0&&(l[r](a),a._found_=!0)};return MT(e,function(a){i=n.getIdentifier(a),MT(n.collections,s.bind(null,a,i)),a._found_||n.removeIdentifier(i)}),!1},Sn.prototype.destroy=function(){var t=this;t.unbindDocument(!0),t.unbindWindowEvents(),t.ids={},t.index=0,t.collections.forEach(function(e){e.destroy()}),t.collections=[],t.off()},Sn.prototype.onDestroyed=function(t,e){var i=this;if(i.collections.indexOf(e)<0)return!1;i.collections.splice(i.collections.indexOf(e),1),i.collections.length===0&&i.unbindWindowEvents()};var QQ=Sn,np=null;function nB(){return np||(np=new QQ),np}var JQ={create:function(t){return nB().create(t)},destroy:function(){np&&(np.destroy(),np=null)},get factory(){return nB()}},tJ=JQ;ii(),Yt(),et(),Hs(),Wr(),Yt();var WV=null;function K2(){return WV}var qV,Q2,eJ=new Promise(t=>{qV=t});function iJ(t){return Q2||(Q2=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.32/build",i=import("./physics.js"),[n,r]=await Promise.all([i,fetch(`${e}/physics.wasm`).then(s=>s.arrayBuffer())]);await n.init(r),qV(n)}(),Q2)}function XV(t){let e=t.elements,i=e[0]**2+e[1]**2+e[2]**2,n=e[4]**2+e[5]**2+e[6]**2,r=e[8]**2+e[9]**2+e[10]**2,s=e[0]**2+e[4]**2+e[8]**2,a=e[1]**2+e[5]**2+e[9]**2,o=e[2]**2+e[6]**2+e[10]**2,l=1e-8;return i<l||n<l||r<l||s<l||a<l||o<l}function Vo(t,e){let i=new Gt;if(e&&XV(e))return i.setAttribute("position",new Nt([],3)),i.setIndex([]),i;if(!t.getAttribute("position"))return i.setAttribute("position",new Nt([],3)),i.setIndex([]),i;let{positions:n,triIndices:r}=YC(t.getAttribute("position"),t.getIndex());return i.setAttribute("position",new Nt(n,3)),i.setIndex(r),e&&i.applyMatrix4(e),i}Li(),Wr(),ke(),o3(),et(),et(),Sp(),Hg();var Ge,nJ=class{constructor(t,e,i,n,r,s){this.id=t,this.data=e,this.object=i,this.initialDisabled=!1,this.actions=Pn(e,e.actions,n,r,s,i),this.target=e.target}disconnect(){nr(this.actions)}dispatch(t){this.initialDisabled||(this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Collision"}),this.actions.Transition.forEach(e=>e.play()),this.actions.Animation.forEach(e=>{e.data.runMode==="Toggle"?e.toggle():e.play()}),this.actions.TimelineAnimation.forEach(e=>{"runMode"in e.data&&e.data.runMode==="Toggle"?e.toggle():e.play()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Link.forEach(e=>{e.dispatch()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Create.forEach(e=>{e.dispatch()}),this.actions.Destroy.forEach(e=>{e.dispatch(t??!1)}),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.Audio.forEach(e=>{e.dispatchBasic()}),this.actions.Particles.forEach(e=>{e.dispatchBasic()}),this.actions.Video.forEach(e=>{e.dispatchBasic()}),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch()))}},rB=class{constructor(t,e,i,n,r,s){this.id=t,this.data=e,this.object=i,this.page=n,this.currentIntersectedObjects=[],this.actions=Pn(e,e.actions,n,r,s,i),this.target=e.target,this.triggeringObjects=[];for(let a of e.triggeringObjects){let o=n.scene.find(a);o&&this.triggeringObjects.push(o)}}isValidTriggeringObject(t){return this.target==="all"||this.triggeringObjects.some(e=>e===t||e.isAncestorOf(t.uuid)||t.isAncestorOf(e.uuid))}disconnect(){nr(this.actions)}dispatch(){this.object.destroyedInAction||(this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Trigger"}),this.actions.Transition.forEach(t=>t.play()),this.actions.SwitchCamera.forEach(t=>{t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.TimelineAnimation.forEach(t=>{"runMode"in t.data&&t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.Link.forEach(t=>{t.dispatch()}),this.actions.Reset.forEach(t=>{t.dispatch()}),this.actions.Create.forEach(t=>{t.dispatch()}),this.actions.Destroy.forEach(t=>{t.dispatch(!1)}),this.actions.Audio.forEach(t=>{t.dispatchBasic()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()}),this.actions.Video.forEach(t=>{t.dispatchBasic()}),this.actions.SceneTransition.forEach(t=>{t.dispatch()}),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch()))}};Li(),eJ.then(t=>Ge=t);var wn=new C,Is=new $t,Pl=new C,sB=(new Ei(0,0,0,"YXZ"),new Ei(0,0,0,"XYZ")),ia=new C,J2=new C,tM=new C(1,1,1),Yd=new $t,hy=new At,aB=new At,rJ={type:"updateMatrix"},oB=new $t,eM=new vr,iM=.01,ET={type:"beginEvent",eventName:"Collision"},sJ={type:"beginEvent",eventName:"Trigger"},xb=t=>t.states.some(e=>e.data.position!==void 0||e.data.rotation!==void 0||e.data.hiddenMatrix!==void 0||e.data.cloner!==void 0||e.data.pathSnapping!==void 0);function Zd(t){return function(e){return typeof e=="object"&&e!==null&&"booleanOp"in e}(Mc(t)?t.object:t)}var aJ=class{constructor(t){this.eventContext=t,this.isEnabled=!1,this.gameControl=null,this.joysticks=[],this.joystickToGameControls=[],this.sharedGameControlGlobals={entitiesWithTransformAnim:[],entityToCollisionEvents:{},colliderToEntity:new Map,kinematicBodyToEntity:new Map,triggers:[],gamePads:[],createdObjects:[],nCreatedPerAction:{}},this.sensorToTriggerEvent={},this.eventManager=void 0,this.needsCollisionDetection=!1,this.initializationCounter=-1,this.fixedBodiesToWatch=[],this.rigidBodyToMesh=new Map,this.nActiveRigidBodies=0,this.collisionEvents=[],this.isExport=!1,this.skipRender=!0,this._staticBVHAttrIds=new WeakMap,this._staticBVHNextAttrId=1,this.processRigidBody=e=>{if(e.bodyType()!==Ge.RigidBodyType.Dynamic)return;e.isSleeping()||this.nActiveRigidBodies++;let[i,n,r]=this.rigidBodyToMesh.get(e.handle);if(wn.copy(e.translation()).multiplyScalar(this.pixelsPerMeter),Is.copy(e.rotation()),i.matrixWorld.compose(wn,Is,n),i.hasNonUniformScale&&i.matrixWorld.multiply(i.shearScale),i.dispatchEvent(rJ),r){let s=i.cloner;if(s&&s.objectForSample===void 0){s.matrixWorld.copy(i.matrixWorld);for(let a of s.children)a.updateMatrixWorld(!0)}for(let a of i.children)a.updateMatrixWorld(!0)}},this.accumulator=0,this.handleCollisionEvents=(e,i,n)=>{if(n===!1)return;let r,s;if(this.sensorToTriggerEvent[e]?(r=this.sensorToTriggerEvent[e],s=this.sharedGameControlGlobals.colliderToEntity.get(i)):this.sensorToTriggerEvent[i]&&(r=this.sensorToTriggerEvent[i],s=this.sharedGameControlGlobals.colliderToEntity.get(e)),r&&s&&r.isValidTriggeringObject(s))r.dispatch();else{for(let a=this.sharedGameControlGlobals.createdObjects.length-1;a>=0;a--){let o=this.sharedGameControlGlobals.createdObjects[a];if(o.userData.hasCollisionDestroy&&(o.rigidBody?.collider(0).handle===e||o.rigidBody?.collider(0).handle===i)){this.sharedGameControlGlobals.createdObjects.splice(a,1),o.removeFromParent();let l=o.rigidBody;requestAnimationFrame(()=>{o.rigidBody===l&&(this.sharedGameControlGlobals.rapierWorld?.removeRigidBody(l),o.rigidBody=void 0)});break}}if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(e)){let a=this.sharedGameControlGlobals.colliderToEntity.get(i),o=this.sharedGameControlGlobals.entityToCollisionEvents[a.uuid];if(o===void 0)return;for(let l of o)l.data.target==="character"&&this.dispatchCollisionEvent(l,a,i)}else if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(i)){let a=this.sharedGameControlGlobals.colliderToEntity.get(e),o=this.sharedGameControlGlobals.entityToCollisionEvents[a.uuid];if(o===void 0)return;for(let l of o)l.data.target==="character"&&this.dispatchCollisionEvent(l,a,e)}else{let a=this.sharedGameControlGlobals.colliderToEntity.get(e),o=this.sharedGameControlGlobals.entityToCollisionEvents[a.uuid];if(o!==void 0)for(let h of o)h.data.target==="scene"&&this.dispatchCollisionEvent(h,a,e);let l=this.sharedGameControlGlobals.colliderToEntity.get(i),c=this.sharedGameControlGlobals.entityToCollisionEvents[l?.uuid];if(c!==void 0)for(let h of c)h.data.target==="scene"&&this.dispatchCollisionEvent(h,l,i)}}},this.isExport=t.isExport,this.sharedAssets=t.sharedAssets,this.renderer=t.renderer,this.requestRender=t.requestRender,this.domElement=this.renderer.domElement,this.pixelsPerMeter=200,this.gravity=this.page.data.globalPhysics.gravity}get page(){return this.eventContext.page}markIsDestroyTarget(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let i of e.events){if(i.data.disabled===!0)continue;let n=i.data.actions?.find(r=>r.data.type==="Destroy")?.data;if(n)for(let r of n.objects){let s=this.page.scene.find(r);s&&(s.userData.hasDestroy=!0)}}})}markIsDragObject(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let i of e.events)if(i.data.disabled!==!0&&i.data.type==="DragDrop")for(let n of i.data.objects){let r=this.page.scene.find(n);r&&(r.userData.hasDrag=!0)}})}_staticBVHIdOf(t){let e=this._staticBVHAttrIds.get(t);return e===void 0&&(e=this._staticBVHNextAttrId++,this._staticBVHAttrIds.set(t,e)),e}initBVH(){if(K2()===null)return void Vn("collision-bvh","trigger/collision detection");let t=[],e=[];if(this.page.traverseChildren(i=>{let n,r=i instanceof Ju,s=sg(i);if(Lu(i)||r||s)return;n=Mc(i)?i.object:i;let a=n.dataPatched;if(a.physics?.enabled==="visibility"?!a.visible:!a.physics?.enabled)return!0;let o=i.geometry,l=n.userData.hasDestroy===!0,c=n.userData.hasDrag===!0;if(xb(a)||l||c||n.dataPatched.events.some(h=>h.data.disabled!==!0&&(h.data.type==="GameControl"||h.data.type==="Follow")))return i.updateMatrixWorldRigid(),this.addBoundsTree(i),!0;if(o){let h=o.getAttribute("position");if(h!==void 0&&h.count>0){t.push({geometry:o,matrixWorld:i.matrixWorld}),e.push(o.id,this._staticBVHIdOf(h),h.version,o.index!==null?this._staticBVHIdOf(o.index):-1,o.index!==null?o.index.version:-1);for(let d of i.matrixWorld.elements)e.push(d)}}return!!Zd(i)||void 0}),t.length>0){let i=this._staticBVHCache;if(i!==void 0&&i.signature.length===e.length&&i.signature.every((s,a)=>s===e[a]))return void(this.sharedGameControlGlobals.staticMeshBVH=i.bvh);let n=Sc(t.map(s=>Vo(s.geometry,s.matrixWorld)),!1),r=new(K2())(n);this._staticBVHCache={signature:e,bvh:r},this.sharedGameControlGlobals.staticMeshBVH=r}}addRigidBody(t,e,i){if(XV(t.matrixWorld))return;let n=[],r="geometry"in t?t.geometry:void 0,s=e.dataPatched;if(r?.getAttribute("position")!==void 0&&n.push(Vo(r,t.shearScale)),s.physics.fusedBody){let a=this.gatherChildrenGeom(t,n);t.traverseObject(a),t.children.forEach(l=>l.updateMatrixWorld(!0));let o=t.cloner;o&&o.objectForSample===void 0&&s.physics.rigidBody==="dynamic"&&(o.traverseObject(a),o.children.forEach(l=>l.updateMatrixWorld(!0)))}if(n.length>0){let a,o=!1,l=!i.fromCreate&&s.physics.rigidBody==="dynamic"||i.fromCreate&&i.dynamic;l?(a=Ge.RigidBodyDesc.dynamic(),a.setLinearDamping(s.physics.damping).setAngularDamping(s.physics.damping).setAdditionalMass(1e-9).setGravityScale(s.physics.gravityScale).enabledRotations(...s.physics.enabledRotation).enabledTranslations(...s.physics.enabledTranslation)):(i.hasTransformAnim||i.hasFollow||i.hasDrag)&&!i.fromCreate?(a=Ge.RigidBodyDesc.kinematicPositionBased(),o=!0):a=Ge.RigidBodyDesc.fixed();let c=Sc(n);(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(wn,Is,Pl),t.position0=wn.clone().divideScalar(this.pixelsPerMeter),t.rotation0=Is.clone(),wn.divideScalar(this.pixelsPerMeter),a.setTranslation(wn.x,wn.y,wn.z).setRotation(Is),r?c?.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter):c?.scale(Pl.x/this.pixelsPerMeter,Pl.y/this.pixelsPerMeter,Pl.z/this.pixelsPerMeter);let h=this.sharedGameControlGlobals.rapierWorld.createRigidBody(a),d=!(s.geometry===void 0||s.geometry.type==="SubdivGeometry"||s.geometry.type==="NonParametricGeometry"||s.geometry.type==="BooleanGeometry"||s.geometry.type==="VectorGeometry"||s.geometry.type==="StarGeometry"||s.geometry.type==="RectangleGeometry"||s.geometry.type==="EllipseGeometry"||s.geometry.type==="TriangleGeometry"||s.geometry.type==="TorusGeometry"||s.geometry.type==="HelixGeometry");try{this.addCollider(h,s.physics,c,e,d)}catch{try{this.addCollider(h,s.physics,c,e,!1)}catch(u){console.error(u)}}if(h.numColliders()===0)return void this.sharedGameControlGlobals.rapierWorld.removeRigidBody(h);l?this.rigidBodyToMesh.set(h.handle,[t,Pl.clone(),s.physics.fusedBody]):o?(this.sharedGameControlGlobals.kinematicBodyToEntity.set(h.handle,t),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t)):this.fixedBodiesToWatch.push([t,h,(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).clone()]),t.rigidBody=h}}addBoundsTree(t){let e=[];if(t.geometry?.getAttribute("position")!==void 0&&t.geometry?.getAttribute("position").count>0&&e.push(Vo(t.geometry,t.shearScale)),t.traverseObject(this.gatherChildrenGeom(t,e)),t.children.forEach(i=>i.updateMatrixWorld(!0)),e.length>0){let i=Sc(e,!1);t.bvhGeometry=i,i.getAttribute("position").count>0&&(t.bvhGeometry.boundsTree=new(K2())(i),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t))}}addCollider(t,e,i,n,r=!0){if(i?.getAttribute("position").count===0||i?.getIndex()?.count===0)return;let s;i&&(s=e.colliderType==="trimesh"?Ge.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array):Ge.ColliderDesc.convexMesh(i.getAttribute("position").array,r?i.getIndex().array:void 0)),s.setFrictionCombineRule(Ge.CoefficientCombineRule.Average).setRestitutionCombineRule(Ge.CoefficientCombineRule.Average).setDensity(e.density).setFriction(e.friction).setRestitution(e.restitution);let a=this.sharedGameControlGlobals.rapierWorld.createCollider(s,t);this.sharedGameControlGlobals.colliderToEntity.set(a.handle,n),this.sharedGameControlGlobals.entityToCollisionEvents[n.uuid]?.some(o=>o.target==="scene")&&a.setActiveEvents(Ge.ActiveEvents.COLLISION_EVENTS)}gatherChildrenGeom(t,e){let i=Zd(t);return(n,r)=>{if(r===0)return;if(i&&n.parent===t)return!0;let s;if(Lu(n)){if(!n.objectForSample)return n.object.dataPatched.physics.fusedBody===!0&&n.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(n.objectForSample.dataPatched.physics.fusedBody)return;s=n.object}else if(Mc(n))s=n.object;else if(s=n,s.dataPatched.cloner?.hideBase)return!0;let a=s.dataPatched;if(a.physics.enabled==="visibility"?!a.visible:!a.physics.enabled)return!0;r===1?t.hasNonUniformScale?n.matrixWorld.multiplyMatrices(t.shearScale,n.hiddenMatrix):n.matrixWorld.copy(n.hiddenMatrix):n.matrixWorld.multiplyMatrices(n.parent.matrixWorld,n.hiddenMatrix),n.matrixWorld.multiply(n.matrix);let o=n.geometry;return o?.getAttribute("position")!==void 0&&e.push(Vo(o,n.matrixWorld)),!!Zd(n)||void 0}}activate(t){if(this.isEnabled)return;this.isEnabled=!0,this.eventManager=t,this.usePhysics=this.page.data.globalPhysics.usePhysics;let e=this.page.playCamera,i=!1;this.page.traverseEntity(a=>{for(let o of a.dataPatched.events)if(o.data.disabled===!1&&o.data.type==="Trigger")return this.needsCollisionDetection=!0,!0});let n=tB();if(n!==null?i=n.setup({manager:this,camera:e,renderer:this.renderer,sharedAssets:this.sharedAssets,eventContext:this.eventContext,isExport:this.isExport})||i:this.page.data.publish.gameControlObject!==null&&Vn("game-controls","the scene's game controls"),i===!1){let{enableRotate:a,enablePan:o,enableZoom:l,autoRotate:c,hoverRotatePanMode:h}=this.eventManager.publish.orbitControls;(a||o||l||c||h!==0)&&(this.orbitControls=new vV(e,this.renderer.domElement,{isExport:this.isExport,isPlayMode:!0}),this.orbitControls.addEventListener("change",this.requestRender),this.orbitControls.addEventListener("end",this.requestRender),this.orbitControls.addEventListener("start",this.requestRender),this.orbitControls.fromJSON(this.eventManager.publish.orbitControls,this.eventManager.publish.mouseEventTarget),this.orbitControls.useKeyEvents=!1,this.orbitControls.addEventListenersToCamera(),this.orbitControls.connect(),this.orbitControls.update())}let r=this.renderer.domElement.width/this.renderer.getPixelRatio(),s=this.renderer.domElement.height/this.renderer.getPixelRatio();tB()?.createJoysticks(this,r,s),this.markIsDestroyTarget(),this.markIsDragObject(),this.rebuildBVH(),this.initializationCounter++,window.setTimeout(()=>{this.collisionEvents.forEach(a=>a.initialDisabled=!1)},80)}initPhysics(){this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=new Ge.World(new Ge.Vector3(0,this.gravity,0)),this.events=new Ge.EventQueue(!0);let t=[],e=[];if(this.page.traverseChildren(a=>{let o;if(Lu(a)){if(!a.objectForSample)return a.object.dataPatched.physics.fusedBody===!0&&a.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(a.objectForSample.dataPatched.physics.fusedBody)return;o=a.object}else if(Mc(a))o=a.object;else{if(sg(a)||Gc(a)||a instanceof Ju)return;if(o=a,o.dataPatched.cloner?.disabled===!1&&o.dataPatched.cloner?.hideBase&&o.dataPatched.physics?.fusedBody!==!0)return!0}let l,c=o.dataPatched;for(let m of c.events)m.data.disabled!==!0&&m.data.type==="GameControl"&&(l=m.data);if(!c.physics||(c.physics.enabled==="visibility"?!c.visible:!c.physics.enabled))return!0;a.updateMatrixWorldRigid();let h=xb(c),d=!1,u=o.userData.hasDestroy,p=o.userData.hasDrag,f=!1;for(let m of c.events)if(m.data.disabled!==!0){if(m.data.type==="Collision"){d=!0;let y=new nJ(m.id,m.data,o,this.page,this.sharedAssets,this.eventManager);y.initialDisabled=!0,this.collisionEvents.push(y),this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid]&&this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid].every(v=>v.id!==m.id)?this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid].push(y):this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid]=[y]}else if(m.data.type==="Follow"){f=!0;let y=m.data.target;a.traverseVisible(v=>{v.userData.isFollowingObj=y})}}c.physics.rigidBody==="dynamic"&&c.physics.fusedBody===!1&&(a.matrixWorldFusedFalse=a.matrixWorld.clone());let g=a.geometry;if(l!==void 0){let m=Ge.RigidBodyDesc.kinematicPositionBased();(a.hasNonUniformScale?a.matrixWorldRigid:a.matrixWorld).decompose(wn,Is,Pl),a.position0=wn.clone().divideScalar(this.pixelsPerMeter),a.rotation0=Is.clone(),wn.divideScalar(this.pixelsPerMeter),m.setTranslation(wn.x,wn.y,wn.z).setRotation(Is);let y,v=this.sharedGameControlGlobals.rapierWorld.createRigidBody(m);a.rigidBody=v,y=l.collider.type==="sphere"?Ge.ColliderDesc.ball(l.collider.radius/this.pixelsPerMeter):l.collider.type==="capsule"?Ge.ColliderDesc.capsule((l.collider.height/2-l.collider.radius)/this.pixelsPerMeter,l.collider.radius/this.pixelsPerMeter):Ge.ColliderDesc.cuboid(l.collider.width/this.pixelsPerMeter/2,l.collider.height/this.pixelsPerMeter/2,l.collider.depth/this.pixelsPerMeter/2),y.setFrictionCombineRule(Ge.CoefficientCombineRule.Average).setDensity(c.physics.density).setFriction(c.physics.friction).setRestitution(0).setRestitutionCombineRule(Ge.CoefficientCombineRule.Min);let _=this.sharedGameControlGlobals.rapierWorld.createCollider(y,v);this.sharedGameControlGlobals.colliderToEntity.set(_.handle,o),wn.fromArray(l.collider.position.map(x=>typeof x=="number"?x:0)).multiply(Pl.setFromMatrixScale(o.matrixWorld)).divideScalar(this.pixelsPerMeter),_.setTranslationWrtParent(wn);let b=new $t().setFromEuler(new Ei().setFromVector3(new C().fromArray(l.collider.rotation.map(x=>typeof x=="number"?x:0))));_.setRotationWrtParent(b),_.setActiveEvents(Ge.ActiveEvents.COLLISION_EVENTS),this.generateSensorColliderDescs(o,!0)}else c.physics.rigidBody==="dynamic"||h||f||u||p||d?(this.addRigidBody(a,o,{hasFollow:f,hasTransformAnim:h,hasDrag:p}),this.generateSensorColliderDescs(o,c.physics.fusedBody)):(g&&t.push(Vo(g,a.matrixWorld)),c.physics.fusedBody&&!Zd(a)&&a.traverseObject((m,y)=>{if(y===0)return;let v;if(Lu(m)){if(!m.objectForSample)return m.object.dataPatched.physics.fusedBody===!0&&m.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(m.objectForSample.dataPatched.physics.fusedBody)return;v=m.object}else{if(sg(m)||Gc(m)||m instanceof Ju)return;if(Mc(m))v=m.object;else if(v=m,v.dataPatched.cloner?.hideBase)return!0}let _=v.dataPatched;if(_.physics.enabled==="visibility"?!_.visible:!_.physics.enabled)return!0;let b=m.geometry;return b?.getAttribute("position")!==void 0&&t.push(Vo(b,m.matrixWorld)),!!Zd(m)||void 0}),this.generateSensorColliderDescs(o,c.physics.fusedBody,e));return!(c.physics?.fusedBody!==!0&&!l&&!Zd(a))||void 0}),t.length===0)return;let i=Sc(t),n=i.getIndex().count>0;if(!n&&e.length===0)return;i.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter);let r=Ge.RigidBodyDesc.fixed(),s=this.sharedGameControlGlobals.rapierWorld.createRigidBody(r);if(n){let a=Ge.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array).setFrictionCombineRule(Ge.CoefficientCombineRule.Multiply).setRestitutionCombineRule(Ge.CoefficientCombineRule.Multiply).setFriction(1).setRestitution(1);this.sharedGameControlGlobals.rapierWorld.createCollider(a,s)}for(let[a,o]of e){let l=this.sharedGameControlGlobals.rapierWorld.createCollider(a,s);this.sensorToTriggerEvent[l.handle]=o}}updatePositions(){return this.nActiveRigidBodies=0,this.sharedGameControlGlobals.rapierWorld.forEachRigidBody(this.processRigidBody),this.nActiveRigidBodies>0}rebuildBVH(){this.usePhysics?this.initPhysics():(this.page.traverseEntity(t=>{for(let e of t.dataPatched.events)if(e.data.type==="Trigger"&&e.data.disabled!==!0){let i=new rB(e.id,e.data,t,this.page,this.sharedAssets,this.eventManager),n=new At().compose(ia.fromArray(e.data.position.map(r=>typeof r=="number"?r:0)),Yd.setFromEuler(sB.fromArray(e.data.rotation.map(r=>typeof r=="number"?r:0))),tM);if(e.data.triggerZone==="box"){let r=new ci;r.min.fromArray(e.data.size.map(s=>typeof s=="number"?s:0)).multiplyScalar(-.5),r.max.fromArray(e.data.size.map(s=>typeof s=="number"?s:0)).multiplyScalar(.5),this.sharedGameControlGlobals.triggers.push([r,n,t,i])}else this.sharedGameControlGlobals.triggers.push([e.data.radius,n,t,i])}}),this.needsCollisionDetection&&this.initBVH())}disconnectEvents(){this.collisionEvents.forEach(t=>t.disconnect()),this.sharedGameControlGlobals.triggers.forEach(t=>t[3].disconnect()),this.sharedGameControlGlobals.triggers.length=0}deactivate(){if(this.isEnabled){this.isEnabled=!1,this.page.traverse(t=>{let e=t;e.matrixWorldFusedFalse&&(e.matrixWorldFusedFalse=void 0),e.rigidBody&&(e.rigidBody=void 0),e.position0&&(e.position0=void 0),e.rotation0&&(e.rotation0=void 0)}),this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=void 0,this.sharedGameControlGlobals.staticMeshBVH=void 0,this.accumulator=0,this.sharedGameControlGlobals.entitiesWithTransformAnim=[],this.sharedGameControlGlobals.kinematicBodyToEntity.clear(),this.fixedBodiesToWatch=[],this.disconnectEvents(),this.gameControl?.reset(),this.gameControl?.dispose(),this.gameControl=null,this.initializationCounter=-1,this.joysticks.forEach(([t,e])=>{t?.destroy(),e.remove()}),this.joystickToGameControls=[],this.joysticks=[],this.orbitControls&&(this.orbitControls.dispose(),this.orbitControls=void 0),this.navigationMeshWrapper?.dispose(),this.navigationMeshWrapper=void 0;for(let t of Object.values(this.sharedGameControlGlobals.entityToCollisionEvents))t.forEach(e=>e.disconnect());this.sharedGameControlGlobals.entityToCollisionEvents={},this.page.updateMatrixWorld(!0)}}update(t){if(!this.isEnabled)return!0;let e=!0;if(this.orbitControls!==void 0&&this.orbitControls.needsUpdate&&(this.orbitControls.update(),e=!this.orbitControls.isCurrentlyDamping),this.initializationCounter>=0&&this.initializationCounter<2?(this.initializationCounter++,e=!1):this.initializationCounter===2&&this.gameControl&&(e=!this.gameControl.update(t)&&e),this.usePhysics===!1&&this.checkTrigger(),this.usePhysics){let i=.016666666666666666;if(t===0)e=this.stepPhysics()&&e;else{let n=t/1e3;n<i&&n>.55*i&&(n=i),this.accumulator+=n;let r=performance.now(),s=0,a=6;for(;this.accumulator>=i&&s<a&&(e=this.stepPhysics()&&e,this.accumulator-=i,s++,!(performance.now()-r>1e3*i)););this.accumulator=this.accumulator%i}}this.skipRender=e}recordPhysicsPose(t){(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(wn,Is,Pl);let e=t;e.prevQ===void 0?(e.prevQ=Is.clone(),e.prevT=wn.clone()):(e.prevQ.copy(Is),e.prevT.copy(wn))}promoteMovedFixedBodies(){for(let t=this.fixedBodiesToWatch.length-1;t>=0;t--){let[e,i,n]=this.fixedBodiesToWatch[t];(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).equals(n)||(i.setBodyType(Ge.RigidBodyType.KinematicPositionBased,!0),this.sharedGameControlGlobals.kinematicBodyToEntity.set(i.handle,e),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e),this.fixedBodiesToWatch.splice(t,1))}}clampPushedBodies(){let t=this.gameControl?.object.rigidBody;if(t===void 0)return;let e=this.sharedGameControlGlobals.rapierWorld,i=t.linvel(),n=t.translation(),r=Math.hypot(i.x,i.z);for(let s=0;s<t.numColliders();s++){let a=t.collider(s);e.contactPairsWith(a,o=>{let l=o.parent();if(l===null||!l.isDynamic())return;let c=l.translation(),h=-1/0,d=0,u=0;if(e.contactPair(a,o,y=>{let v=y.normal(),_=v.x*(c.x-n.x)+v.y*(c.y-n.y)+v.z*(c.z-n.z)<0?-1:1;if(Math.abs(v.y)>.7)return;let b=_*v.x,x=_*v.z,w=Math.hypot(b,x);if(w<1e-4)return;let S=(i.x*b+i.z*x)/w;S>h&&(h=S,d=b/w,u=x/w)}),h===-1/0)return;let p=i.x*d+i.z*u;if(p<-iM)return;let f=l.linvel();if(r>iM&&p>iM){let y=f.x*d+f.z*u;if(y<=0)return;let v=Math.min(y,p);return void l.setLinvel({x:d*v,y:f.y,z:u*v},!0)}let g=f.x*d+f.z*u-Math.max(0,p);if(g<=0)return;let m=.5*g;l.setLinvel({x:f.x-d*m,y:f.y,z:f.z-u*m},!0)})}}stepPhysics(){this.promoteMovedFixedBodies();for(let t of this.sharedGameControlGlobals.kinematicBodyToEntity.values())this.recordPhysicsPose(t),t.rigidBody.setNextKinematicTranslation(wn.divideScalar(this.pixelsPerMeter)),t.rigidBody.setNextKinematicRotation(Is);for(let t of this.sharedGameControlGlobals.entitiesWithTransformAnim)t.rigidBody?.isKinematic()!==!0&&this.recordPhysicsPose(t);return this.sharedGameControlGlobals.rapierWorld.step(this.events),this.clampPushedBodies(),this.events?.drainCollisionEvents(this.handleCollisionEvents),!this.updatePositions()}dispatchCollisionEvent(t,e,i){let n,r=(this.sharedGameControlGlobals.rapierWorld?.getCollider(i))._parent;if(e.cloner){for(let s of e.cloner.children)if(s.rigidBody===r){n=s;break}}t.dispatch(n),e.dispatchEvent(ET)}updateUseWindowEvents(t){this.orbitControls?.updateUseWindowEvents(t)}generateSensorColliderDescs(t,e,i){let n=aB.copy(t.matrixWorld).invert();t.traverseEntity((r,s)=>{if(e===!1&&s===1)return!0;for(let a of r.dataPatched.events)if(a.data.type==="Trigger"&&a.data.disabled!==!0){let o,l=new rB(a.id,a.data,r,this.page,this.sharedAssets,this.eventManager);if(o=a.data.triggerZone==="box"?Ge.ColliderDesc.cuboid(...a.data.size.map(c=>(typeof c=="number"?c:1)/(2*this.pixelsPerMeter))):Ge.ColliderDesc.ball(a.data.radius/this.pixelsPerMeter),o.setDensity(0).setSensor(!0).setActiveEvents(Ge.ActiveEvents.COLLISION_EVENTS),ia.fromArray(a.data.position.map(c=>typeof c=="number"?c:0)),Yd.setFromEuler(sB.fromArray(a.data.rotation.map(c=>typeof c=="number"?c:0))),hy.compose(ia,Yd,tM).premultiply(r.matrixWorld),i?(hy.decompose(ia,Yd,J2),o.setActiveCollisionTypes(Ge.ActiveCollisionTypes.KINEMATIC_FIXED|Ge.ActiveCollisionTypes.DYNAMIC_FIXED)):(hy.premultiply(n).decompose(ia,Yd,J2),t.rigidBody.bodyType()===Ge.RigidBodyType.Dynamic||(t.rigidBody.bodyType()===Ge.RigidBodyType.Fixed?o.setActiveCollisionTypes(Ge.ActiveCollisionTypes.KINEMATIC_FIXED|Ge.ActiveCollisionTypes.DYNAMIC_FIXED):o.setActiveCollisionTypes(Ge.ActiveCollisionTypes.KINEMATIC_KINEMATIC|Ge.ActiveCollisionTypes.DYNAMIC_KINEMATIC))),ia.divideScalar(this.pixelsPerMeter),o.setTranslation(ia.x,ia.y,ia.z),o.setRotation(Yd),i)i.push([o,l]);else{let c=this.sharedGameControlGlobals.rapierWorld.createCollider(o,t.rigidBody);this.sensorToTriggerEvent[c.handle]=l}}})}checkTrigger(){let t;for(let e=0;e<this.sharedGameControlGlobals.triggers.length;e++){let[i,n,r,s]=this.sharedGameControlGlobals.triggers[e];for(let a=0;a<this.sharedGameControlGlobals.entitiesWithTransformAnim.length;a++){let o=this.sharedGameControlGlobals.entitiesWithTransformAnim[a];if(r===o||s.isValidTriggeringObject(Be.is(o)?o:o.object)===!1)continue;let l=aB.copy(r.matrixWorld).decompose(ia,oB,J2).compose(ia,oB,tM).multiply(n),c=hy.copy(o.matrixWorld).invert().multiply(l),h=o.bvhGeometry.boundsTree;i instanceof ci?t=h.intersectsBox(i,c):(eM.radius=i,eM.center.setFromMatrixPosition(c),t=h.intersectsSphere(eM)),t?s.currentIntersectedObjects.indexOf(o)===-1&&(s.currentIntersectedObjects.push(o),s.dispatch(),r.dispatchEvent(sJ)):s.currentIntersectedObjects=s.currentIntersectedObjects.filter(d=>d!==o)}}}};Mp(),et(),Z_(),Ye(),bh();var nM=.02,lB=new C,hB=new C,oJ=new C,Mr=new C,Do=new C,Kd=new C,rM=new At,cB=new At,lJ=new At,ds=new $t,sc=new $t,Qd=new Ei(0,0,0,"YXZ"),hJ=new C(1,0,0),Fa=new C(0,1,0),cJ=new C(0,0,1),dB=new C(1,1,1),uB=[],pB=t=>uB[t]??(uB[t]=new C),sM=new C,dJ=new C,uJ=new C,pJ=new C,fB=new $t,fJ=new C,mB=new $t,Zn=new vs,Os=new ci,mJ={type:"requestRender"},gJ={type:"updateMatrix"},AT=class extends Nn{constructor(t,e,i,n,r,s,a,o,l){super(),this.object=t,this.domElement=e,this.data=i,this.gloabalPhysics=n,this.controlsManager=r,this.cameraFollow=s,this.camera=a,this.page=o,this.sharedAssets=l,this.enableDamping=!0,this.hiddenMatrix0=new At,this.target0=new C,this.zoom0=1,this.rotForce=1,this.moveForce=1,this.pixelsPerMeter=200,this.euler0=new Ei(0,0,0,"YXZ"),this.position0Cam=new C,this.quat0Cam=new $t,this.scale0Cam=new C,this.hiddenMatrix0Cam=new At,this.threshEndTranslate=.01,this.threshEndRotate=1e-8,this.threshEndRotVel=.005,this.collider={type:"capsule",radius:40,segment:new vs(new C(0,-40,0),new C(0,40,0)),matrix:new At,position:new C,rotation:new $t},this.euler=new Ei(0,0,0,"YXZ"),this.eulerDelta=new C,this.lastPosition=new C,this.lastCameraQuaternion=new $t,this.lastCameraPosition=new C,this.PI_2=Math.PI/2,this.prevMouse=new it,this.velocityTarget=new C,this.velocity=new C,this.directionXZ=new C,this.rotVelocityStick=new C,this.rotVelocityTarget=new C,this.rotVelocity=new C,this.rotDirection=new C,this.nonColliderRotOffset=new At,this.nonColliderPosOffset=new At,this.firstPointerId=-1,this.rot=new C,this.path=[],this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0},this.onObject=!1,this.actionState={},this.keyAssignments=[["moveNegZ","W"],["moveNegX","A"],["movePosZ","S"],["movePosX","D"],["rotPosX","ArrowUp"],["rotPosY","ArrowLeft"],["rotNegX","ArrowDown"],["rotNegY","ArrowRight"],["jump"," "]],this.collisionEnabled=!0,this.offsetMatrix=new At,this.objectToTarget=new C,this.objectToTarget0=new C,this.objectToCamXZ=new C,this.objectToCamXZ0=new C,this.targetToCamera=new C,this.targetToCamera0=new C,this.cameraPolarAxis0=new C,this.targetPos=new C,this.targetQuat=new $t,this.lerpFactorPos=new C().setScalar(.3),this.lerpFactorPosStart=.3,this.lerpFactorPosEnd=.3,this.lerpFactorRotStart=.3,this.lerpFactorRotEnd=.3,this.lerpFactorPosCamera=.3,this.lerpFactorRotCamera=.3,this.objXZQuat=new $t,this.objXZQuatInv=new $t,this.objXZRotMat=new At,this.isFirstPerson=!1,this.didHit=!1,this.groundVelocity=new C,this.pushedVelocity=new C,this.groundYRotation=0,this.objectRealQuat=new $t,this.colliderWorldQuat=new $t,this.groundNormal=new C,this.groundTilt=new $t,this.groundTiltInv=new $t,this.lastHitObj=null,this.isFirstFrame=!0,this.rotationAccumWhenOrientWithCamera=0,this.navMeshPathDest=null,this.position=new C,this.quaternion=new $t,this.scale=new C,this.initialAction=!0,this.onPointerDown=f=>{!(f.target===this.domElement||f.target instanceof HTMLElement&&f.target.tagName==="SPLINE-VIEWER"&&f.target.shadowRoot?.contains(this.domElement))||this.firstPointerId!==-1||(this.firstPointerId=f.pointerId,this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp),this.rotBy!=="keys"&&!ss&&!xE&&this.domElement.requestPointerLock(),this.prevMouse.set(f.clientX,f.clientY))},this.onPointerUp=f=>{this.firstPointerId=-1,this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp),f.pointerType==="mouse"&&this.domElement.ownerDocument.exitPointerLock()},this.onPointerMove=f=>{if(f.pointerId!==this.firstPointerId)return;let g=f.clientX-this.prevMouse.x,m=f.clientY-this.prevMouse.y;this.prevMouse.set(f.clientX,f.clientY),f.pointerType==="mouse"&&this.rotBy!=="keys"&&(xE&&rF<15.5&&!ss?(this.eulerDelta.y=-g*this.mouseOrbitSensitivity,this.eulerDelta.x=-m*this.mouseOrbitSensitivity):(this.eulerDelta.y=-f.movementX*this.mouseOrbitSensitivity,this.eulerDelta.x=-f.movementY*this.mouseOrbitSensitivity)),f.pointerType!=="mouse"&&this.rotByTouch==="drag"&&(this.eulerDelta.y=-g*this.mouseOrbitSensitivity*5,this.eulerDelta.x=-m*this.mouseOrbitSensitivity*5),this.controlsManager.requestRender()},this.onPointerlockChange=f=>{this.domElement.ownerDocument.pointerLockElement===this.domElement?AT.isLocked=!0:AT.isLocked=!1},this.onPointerlockError=()=>{console.error("SPE.GameControls: Unable to use Pointer Lock API")},this.handleVisibilityChange=()=>{if(document?.hidden)for(let f in this.movementState)this.movementState[f]=0},this.onKeyDown=f=>{!(f.target instanceof HTMLInputElement)&&(f.code==="ArrowLeft"||f.code==="ArrowUp"||f.code==="ArrowRight"||f.code==="ArrowDown"||f.code==="Space")&&f.preventDefault();for(let g of this.keyAssignments)if(f.key.toUpperCase()===g[1]||f.key===g[1]){this.movementState[g[0]]=1;break}this.controlsManager.requestRender()},this.onKeyUp=f=>{for(let g of this.keyAssignments)if(f.key.toUpperCase()===g[1]||f.key===g[1]||f.code.slice(3,f.code.length).toUpperCase()===g[1]){this.movementState[g[0]]=0;break}},this.copyVRGamePadValues=(f,g)=>{for(let m=2;m<4;m++){let y=f.axes[m];g===0?m===2?this.movementState.movePosX=y:this.movementState.movePosZ=y:(f.buttons[3].pressed?this.movementState.jump=1:this.movementState.jump=0,m===2?this.movementState.rotPosY=y:this.moveMode==="fly"&&(this.movementState.moveNegY=y))}},this.sharedGameControlGlobals=r.sharedGameControlGlobals,t===a&&(this.isFirstPerson=!0),this.hiddenMatrix0.copy(this.object.hiddenMatrix),this.object.parent?this.object.hiddenMatrix.copy(this.object.parent.matrixWorld).invert():this.object.hiddenMatrix.identity(),this.object.matrix.copy(this.object.matrixWorld),this.object.matrix.decompose(this.position,this.quaternion,this.scale),this.euler0.setFromQuaternion(this.quaternion,"YXZ");let c=this.euler0.clone(),h=c.y;if(this.objectRealQuat.copy(this.quaternion),c.y=0,this.quaternion.setFromEuler(c),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),c.set(0,h,0),this.quaternion.setFromEuler(c),this.rot.setFromEuler(c),this.object.matrixAutoUpdate=!1,(this.isFirstPerson||this.cameraFollow===!0)&&(this.target0.copy(this.camera.getTarget()),this.zoom0=this.camera.zoom),this.cameraFollow===!0){this.position0Cam.copy(this.camera.position),this.quat0Cam.copy(this.camera.quaternion),this.scale0Cam.copy(this.camera.scale),this.hiddenMatrix0Cam.copy(this.camera.hiddenMatrix),this.camera.parent?(this.camera.hiddenMatrix.copy(this.camera?.parent.matrixWorld),this.camera.matrix.copy(this.camera.matrixWorld)):this.camera.hiddenMatrix.identity(),this.camera.matrix.copy(this.camera.matrixWorld),this.camera.matrix.decompose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.matrixAutoUpdate=!1,this.offsetMatrix.copy(this.object.matrix).invert().multiply(this.camera.matrix);let f,g=new C(0,0,-1).applyQuaternion(this.camera.quaternion),m=new C().subVectors(this.position,this.camera.position);this.objectToCamXZ.copy(m),this.objectToCamXZ.y=0,this.objectToCamXZ0.copy(this.objectToCamXZ),Math.abs(g.y)<1e-6?(m.y=0,g.y=0,f=m.projectOnVector(g)):f=m.y/g.y>0?g.multiplyScalar(m.y/g.y):g.multiplyScalar(m.length()),this.targetToCamera0.copy(f).negate();let y=this.camera.position.clone().add(f);this.objectToTarget0.subVectors(y,this.position);let v=new Ei().setFromQuaternion(this.camera.quaternion,"YXZ");this.cameraPolarOffset=-v.x,v.x=0,v.z=0,v.y-=Math.PI/2,this.cameraPolarAxis0.set(0,0,-1).applyEuler(v)}if(this.object instanceof gn&&(this.object.matrixAutoUpdate=!1),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.rotByTouch=i.rotByTouch??"joystick",this.rotBy=i.rotBy??"keys",this.rotationMode=i.rotationMode??"normal",this.moveMode=i.moveMode??"walk",this.collisionEnabled=i.collisionEnabled,this.speedTranslate=1*(i.speedTranslate??250),this.speedOrbit=.025*(i.speedRotate??100),this.mouseOrbitSensitivity=16e-6*(i.speedRotate??100),this.keyAssignments=i.keyAssignments.map(f=>{let g=[f[0],f[1]];return g[1]==="\u25B2"?g[1]="ArrowUp":g[1]==="\u25C0"?g[1]="ArrowLeft":g[1]==="\u25BC"?g[1]="ArrowDown":g[1]==="\u25B6"?g[1]="ArrowRight":g[1]==="\u21E7"?g[1]="Shift":g[1]==="\u21B5"?g[1]="Enter":g[1]==="Space"?g[1]=" ":g[1]==="\u2318"?g[1]="Meta":g[1]==="Ctrl"?g[1]="Control":g[1]==="Esc"&&(g[1]="Escape"),g}),i.rotBy==="mouse"){let f;f=this.keyAssignments.findIndex(g=>g[0]==="rotNegX"),f!==-1&&(this.keyAssignments[f][1]=""),f=this.keyAssignments.findIndex(g=>g[0]==="rotPosX"),f!==-1&&(this.keyAssignments[f][1]=""),f=this.keyAssignments.findIndex(g=>g[0]==="rotPosY"),f!==-1&&(this.keyAssignments[f][1]=""),f=this.keyAssignments.findIndex(g=>g[0]==="rotNegY"),f!==-1&&(this.keyAssignments[f][1]="")}this.lerpFactorPosStart=1-.02**(1/(60*(i.delayPos[0]??.3))),this.lerpFactorPosEnd=1-.02**(1/(60*(i.delayPos[1]??.3))),this.lerpFactorPos.setScalar(this.lerpFactorPosStart),this.lerpFactorRotStart=1-.02**(1/(60*(i.delayRot[0]??.3))),this.lerpFactorRotEnd=1-.02**(1/(60*(i.delayRot[1]??.3))),this.lerpFactorPosCamera=1-.02**(1/(60*(i.delayPosCamera??.3))),this.lerpFactorRotCamera=1-.02**(1/(60*(i.delayRotCamera??.3))),this.gravity=12*(this.gloabalPhysics.gravity??$u.defaultData.gravity),this.usePhysics=this.gloabalPhysics.usePhysics??$u.defaultData.usePhysics,this.jumpPower=20*i.jumpPower,this.resetYPosition=this.position.y+Math.abs(i.resetYPosition)*(this.gravity>0?1:-1),this.alignToGround=i.alignToGround??!1,this.orientMode=i.autoOrientMove?i.orientMode:"none",this.orientWith=i.orientWith??j_.defaultDataThirdPerson.orientWith,this.slopeThresh=65*Math.PI/180,i.collider.type==="capsule"?(this.collider.radius=i.collider.radius,this.collider.segment.start.y=i.collider.height/2-i.collider.radius,this.collider.segment.end.y=-this.collider.segment.start.y,this.offset=i.collider.height*nM/this.pixelsPerMeter,this.stepThresh=.3*i.collider.height/this.pixelsPerMeter,this.colliderHeight=i.collider.height):i.collider.type==="sphere"?(this.collider.radius=i.collider.radius,this.collider.segment.start.y=0,this.collider.segment.end.y=0,this.offset=2*i.collider.radius*nM/this.pixelsPerMeter,this.stepThresh=2*i.collider.radius*.3/this.pixelsPerMeter,this.colliderHeight=2*i.collider.radius):(this.offset=i.collider.height*nM/this.pixelsPerMeter,this.stepThresh=.3*i.collider.height/this.pixelsPerMeter,this.colliderHeight=i.collider.height),this.collider.type=i.collider.type;let d=new C().fromArray(i.collider.position.map(f=>typeof f=="number"?f:0)),u=new $t().setFromEuler(new Ei().fromArray([...i.collider.rotation.map(f=>typeof f=="number"?f:0),"XYZ"]));this.collider.position.copy(d).multiply(this.scale),this.collider.rotation.copy(u),this.collider.matrix.compose(d,u,dB),i.cameraXAxis!==void 0&&(this.cameraXAxis=i.cameraXAxis,this.cameraYAxis=i.cameraYAxis,this.minPolarAngle=i.cameraRotXLimits[0],this.maxPolarAngle=i.cameraRotXLimits[1],this.minAzimuthAngleRel=i.cameraRotYLimits[0],this.maxAzimuthAngleRel=i.cameraRotYLimits[1]),this.forwardDir=i.forwardDirection??"-z",this.isFirstPerson&&(this.forwardDir="-z"),this.runMultiplier=i.runMultiplier??2;let p=2*i.navmesh.destinationHelperRadius;if(p>0){let f=new Vt;f.push({fi:0,data:{...Ki.defaultData("light","phong"),alpha:0},id:"layer1"}),f.push({fi:0,data:{...Ki.defaultData("color"),color:i.navmesh.destinationHelperColor,alpha:i.navmesh.destinationHelperColor.a},id:"layer2"});let g=vk({layers:f},{scene:this.page.scene,shared:this.sharedAssets});this.navMeshPathDest=new xi(GC.create({parameters:{width:p,height:p/10,hollow:.7}}),g),this.navMeshPathDest.material.userData.opacity0=i.navmesh.destinationHelperColor.a}this.activate()}reset(t=!1){if(this.object.hiddenMatrix.copy(this.hiddenMatrix0),t){this.object.updateMatrix(),this.object.updateMatrixWorld(),this.object.matrix.copy(this.object.matrixWorld),this.object.matrix.decompose(this.position,this.quaternion,this.scale),this.object.parent?this.object.hiddenMatrix.copy(this.object.parent.matrixWorld).invert():this.object.hiddenMatrix.identity();let e=new Ei().setFromQuaternion(this.quaternion,"YXZ"),i=e.y;this.objectRealQuat.copy(this.quaternion),e.y=0,this.quaternion.setFromEuler(e),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),e.set(0,i,0),this.quaternion.setFromEuler(e),this.rot.setFromEuler(e),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.velocityTarget.set(0,0,0),this.velocity.set(0,0,0)}else this.object instanceof gn?this.object.matrixAutoUpdate=!0:this.object.updateMatrix();this.cameraFollow===!0&&(this.camera.quaternion.copy(this.quat0Cam),this.camera.position.copy(this.position0Cam),this.camera.scale.copy(this.scale0Cam),this.camera.hiddenMatrix.copy(this.hiddenMatrix0Cam),this.camera.matrixAutoUpdate=!0),this.controlsManager.requestRender()}activate(){this.instantiateActions(),this.domElement.ownerDocument.addEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.addEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.addEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.addEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.addEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.addEventListener("visibilitychange",this.handleVisibilityChange)}deactivate(){this.disposeActions(),this.domElement.ownerDocument.removeEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.removeEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.removeEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.removeEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.removeEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.removeEventListener("visibilitychange",this.handleVisibilityChange)}dispose(){this.deactivate(),this.navMeshPathDest?.parent&&this.page.remove(this.navMeshPathDest)}instantiateActions(){let t=this.data,e=this.sharedAssets;t.gameActions!==void 0&&(this.actions={},V_.list.forEach(i=>{this.actions[i]=Pn({...t,disabled:!1,type:"GameControl"},t.gameActions[i],this.page,e,this.controlsManager.eventManager,this.object)})),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"),this.initialAction&&(this.initialAction=!1)}disposeActions(){this.initialAction=!1,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),nr(this.actions.idle),nr(this.actions.move),nr(this.actions.run),nr(this.actions.jump)}dispatchStartEvent(t){this.actions[t]!==void 0&&(this.actionState[t]||(this.actionState[t]=!0,this.actions[t].Transition.forEach(e=>{e.play()}),this.actions[t].Animation.forEach(e=>{e.play(this.initialAction===!1)}),this.actions[t].TimelineAnimation.forEach(e=>{e.play()}),this.actions[t].Create.forEach(e=>{e.dispatchStart()}),this.actions[t].Audio.forEach(e=>{e.dispatchGameControl("start")}),this.actions[t].Particles.forEach(e=>{e.dispatchGameControl("start")})))}dispatchStopEvent(t){this.actions[t]!==void 0&&(!this.actionState[t]||(this.actionState[t]=!1,this.actions[t].Transition.forEach(e=>{e.stop(),e.object.currentState!==null&&e.object.changeSelectedState(null,{scene:this.page.scene,shared:this.sharedAssets})}),this.actions[t].TimelineAnimation.forEach(e=>{e.stop()}),this.actions[t].Create.forEach(e=>{e.dispatchStop()}),this.actions[t].Audio.forEach(e=>{e.dispatchGameControl("stop")}),this.actions[t].Particles.forEach(e=>{e.dispatchGameControl("stop")})))}get colliderWorldPosition(){return Mr.copy(this.collider.position).applyQuaternion(this.objectRealQuat).add(this.position)}update(t){if(this.gravity<0?this.position.y<this.resetYPosition:this.position.y>this.resetYPosition)return this.reset(!0),!0;this.sharedGameControlGlobals.gamePads.forEach(this.copyVRGamePadValues);let e=(this.isFirstFrame?16.6:t)/1e3;this.isFirstFrame&&(this.isFirstFrame=!1);let i=60*e,n=!1;if(this.groundYRotation=0,this.groundVelocity.set(0,0,0),this.usePhysics&&this.collisionEnabled&&this.object.rigidBody?.collider(0).shape){let s=Do.set(0,(this.velocity.y===0?this.pixelsPerMeter*Math.max(Math.abs(this.gravity)/120,1)*(this.gravity>0?1:-1):this.velocity.y)*e,0).divideScalar(this.pixelsPerMeter),a=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter),this.colliderWorldQuat,s,this.object.rigidBody?.collider(0).shape,0,1,!1,8,void 0,void 0,this.object.rigidBody);if(a){this.onObject=!0,this.groundNormal.set(a.normal2.x,a.normal2.y,a.normal2.z).applyQuaternion(this.colliderWorldQuat).negate(),this.alignToGround&&this.groundTiltAdjustment(this.groundNormal),Math.acos(this.groundNormal.y)<this.slopeThresh&&(n=!0),a.collider.parent()?.bodyType()===0&&Math.acos(this.groundNormal.y)*(180/Math.PI)>45&&(this.onObject=!1);let o=a.collider.parent(),l=o!==null&&o.isKinematic()?o:null,c=l===null?void 0:this.sharedGameControlGlobals.kinematicBodyToEntity.get(l.handle);if(l!==null&&c?.userData.isFollowingObj!==this.object.uuid){let h=this.object.getWorldPosition(Mr).add(this.collider.position).divideScalar(this.pixelsPerMeter),d=l.velocityAtPoint(h);this.groundVelocity.set(d.x,d.y,d.z).multiplyScalar(this.pixelsPerMeter),this.groundYRotation=l.angvel().y*e}}else this.onObject=!1}if(this.moveMode==="walk"&&this.collisionEnabled&&(this.movementState.jump===1&&this.onObject&&(this.velocityTarget.y=this.jumpPower,this.movementState.jump=0,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("jump"),this.onObject=!1),this.onObject?this.velocityTarget.y/=2:this.velocityTarget.y+=this.gravity*i),this.moveMode==="fly"&&(this.velocityTarget.y=(this.movementState.movePosY-this.movementState.moveNegY)*this.speedTranslate),this.directionXZ.z=this.movementState.movePosZ-this.movementState.moveNegZ,this.directionXZ.x=this.movementState.movePosX-this.movementState.moveNegX,this.forwardDir==="+z"&&this.directionXZ.multiplyScalar(-1),this.directionXZ.manhattanLength()>0&&(this.path=[]),this.navMeshPathDest){let s=this.navMeshPathDest.material;if(this.moveMode==="walk"&&this.path.length>1){this.navMeshPathDest.position.copy(this.path[this.path.length-1]),this.navMeshPathDest.parent||this.page.add(this.navMeshPathDest);let a=Mr.subVectors(this.path[1],this.position),o=Do.subVectors(this.path[1],this.path[0]);a.dot(o)<0?this.path.shift():(this.directionXZ.x=o.x,this.directionXZ.z=o.z),s.opacity=s.userData.opacity0}else s.opacity-=.05*s.userData.opacity0,this.navMeshPathDest.material.opacity<=0&&this.navMeshPathDest.parent&&this.page.remove(this.navMeshPathDest)}this.directionXZ.normalize(),this.movementState.run?this.moveForce=this.runMultiplier:this.moveForce=1,this.velocityTarget.z=this.directionXZ.z*this.speedTranslate*this.moveForce,this.velocityTarget.x=this.directionXZ.x*this.speedTranslate*this.moveForce,(this.moveMode==="walk"?this.velocityTarget.x+this.velocityTarget.z===0:this.velocityTarget.manhattanLength()===0)?this.lerpFactorPos.setScalar(this.lerpFactorPosEnd):this.lerpFactorPos.setScalar(this.lerpFactorPosStart),this.moveMode==="walk"&&(this.lerpFactorPos.y=1),this.didHit===!1&&this.pushedVelocity.manhattanLength()===0||this.usePhysics===!1?(this.velocity.x+=(this.velocityTarget.x-this.velocity.x)*(1-(1-this.lerpFactorPos.x)**i),this.velocity.y+=(this.velocityTarget.y-this.velocity.y)*(1-(1-this.lerpFactorPos.y)**i),this.velocity.z+=(this.velocityTarget.z-this.velocity.z)*(1-(1-this.lerpFactorPos.z)**i)):this.velocity.copy(this.velocityTarget),(this.moveMode==="walk"?this.velocity.x**2+this.velocity.z**2<this.speedTranslate:this.velocity.lengthSq()<this.speedTranslate)?(this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.onObject&&(this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"))):(this.dispatchStopEvent("idle"),(this.onObject||this.moveMode==="fly")&&(this.dispatchStopEvent("jump"),this.movementState.run?(this.dispatchStopEvent("move"),this.dispatchStartEvent("run")):(this.dispatchStopEvent("run"),this.dispatchStartEvent("move"))));let r=oJ.copy(this.velocity);if(this.orientMode!=="none"&&this.isFirstPerson===!1){let s=Do.copy(r);s.y=0,r.set(0,r.y,s.length()*(this.forwardDir==="+z"?1:-1))}if(this.directionXZ.manhattanLength()>0&&this.orientMode!=="none"&&this.isFirstPerson===!1)if(this.orientWith==="camera"&&this.path.length<=1){let s=Mr;this.camera.getWorldDirection(s);let a=Kd.copy(Fa).multiplyScalar(s.dot(Fa));s.sub(a);let o=Do.copy(this.directionXZ);o.x*=-1,this.rot.y=s.angleTo(o)*(s.cross(o).y>0?-1:1)+this.rotationAccumWhenOrientWithCamera}else this.rot.y=(this.path.length>1?0:this.euler.y)+Math.atan2(-this.directionXZ.z,this.directionXZ.x)+Math.PI/2*(this.forwardDir==="+z"?1:-1);if(Qd.setFromVector3(this.rot),this.moveMode==="walk"&&(Qd.x=0),r.applyEuler(Qd),n&&(sc.setFromUnitVectors(Fa,this.groundNormal),r.applyQuaternion(sc)),this.usePhysics===!0&&this.object.rigidBody){this.pushedVelocity.set(0,0,0);let s=0;for(let a of this.sharedGameControlGlobals.entitiesWithTransformAnim){if(a.rigidBody===void 0||a.prevQ===void 0)continue;(a.hasNonUniformScale?a.matrixWorldRigid:a.matrixWorld).decompose(sM,fB,dJ);let o=this.object.getWorldPosition(uJ).add(this.collider.position).sub(sM);mB.copy(a.prevQ).invert().premultiply(fB);let l=Kd.subVectors(sM,a.prevT).add(pJ.copy(o).applyQuaternion(mB).sub(o)).divideScalar(e).divideScalar(this.pixelsPerMeter),c=a.rigidBody.collider(0).castCollider(l,this.object.rigidBody.collider(0),Mr.copy(r).divideScalar(this.pixelsPerMeter),0,e,!1);l.multiplyScalar(this.pixelsPerMeter);let h=Be.is(a)?a:a.object;if(c!==null&&this.lastHitObj!==h){let d;a instanceof ys&&(d=a);let u=this.sharedGameControlGlobals.entityToCollisionEvents[h.uuid];if(u)for(let p of u)p.data.target==="character"&&(p.dispatch(d),h.dispatchEvent(ET));this.lastHitObj=h}c!==null&&(Math.abs(l.x)>Math.abs(this.pushedVelocity.x)&&(this.pushedVelocity.x=l.x),Math.abs(l.y)>Math.abs(this.pushedVelocity.y)&&(this.pushedVelocity.y=l.y),Math.abs(l.z)>Math.abs(this.pushedVelocity.z)&&(this.pushedVelocity.z=l.z),pB(s++).copy(c.normal1).applyQuaternion(a.quaternion))}if(s>0){for(let a=0;a<s;a++){let o=pB(a),l=o.dot(r);l<0&&r.addScaledVector(o,-l)}r.add(this.pushedVelocity)}else r.add(this.groundVelocity)}if(this.rotDirection.y=Number(this.movementState.rotPosY)-Number(this.movementState.rotNegY),this.rotDirection.x=Number(this.movementState.rotPosX)-Number(this.movementState.rotNegX),this.rotDirection.normalize(),this.rotationMode==="normal"&&(this.movementState.rotPosX||this.movementState.rotNegX)||this.rotationMode==="steer"&&(this.movementState.rotPosX||this.movementState.rotNegX)&&(this.movementState.movePosZ||this.movementState.moveNegZ||this.moveMode==="walk")?this.rotVelocityStick.x=-this.rotDirection.x*this.speedOrbit*this.rotForce:this.rotVelocityStick.x=0,this.rotationMode==="normal"&&(this.movementState.rotPosY||this.movementState.rotNegY)||this.rotationMode==="steer"&&(this.movementState.rotPosY||this.movementState.rotNegY)&&(this.movementState.movePosZ||this.movementState.moveNegZ)?this.rotVelocityStick.y=-this.rotDirection.y*this.speedOrbit*this.rotForce:this.rotVelocityStick.y=0,this.rotVelocityTarget.subVectors(this.eulerDelta.divideScalar(e),this.rotVelocityStick),this.rotVelocityTarget.manhattanLength()===0?this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotEnd)**i):this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotStart)**i),this.euler.x+=this.rotVelocity.x*e,this.euler.y+=this.rotVelocity.y*e+this.groundYRotation,this.rotVelocityTarget.y===0&&this.directionXZ.manhattanLength()===0?this.rotationAccumWhenOrientWithCamera=0:(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.rotationAccumWhenOrientWithCamera+=this.rotVelocity.y*e),this.isFirstPerson===!1&&this.orientMode!=="none"&&this.directionXZ.manhattanLength()>0){if(this.orientMode==="radial"){this.objectToCamXZ.copy(this.objectToCamXZ0).applyAxisAngle(Fa,this.euler.y-this.euler0.y);let s=Do.copy(this.objectToCamXZ).normalize(),a=Kd.copy(r).multiplyScalar(e);a.y=0;let o=a.sub(Mr.copy(s).multiplyScalar(a.dot(s))).cross(s).y;this.euler.y-=Math.atan2(o,this.objectToCamXZ.length())}}else this.rot.y+=this.rotVelocity.y*e+this.groundYRotation,this.rotVelocityTarget.y!==0&&(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.euler.y=this.rot.y);if(this.cameraFollow===!0&&(this.moveMode==="walk"?this.cameraXAxis==="Limit"?this.euler.x=Ot.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):this.euler.x=Ot.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset,this.PI_2+this.cameraPolarOffset):this.cameraXAxis==="Limit"&&(this.euler.x=Ot.clamp(this.euler.x,-this.PI_2,this.PI_2))),this.moveMode==="fly"?this.rot.x=this.euler.x:this.isFirstPerson&&(Qd.copy(this.euler),Qd.y=0,this.nonColliderRotOffset.makeRotationFromEuler(Qd)),ds.setFromAxisAngle(hJ,this.rot.x),sc.setFromAxisAngle(Fa,this.rot.y),sc.multiply(ds),ds.setFromAxisAngle(cJ,this.rot.z),sc.multiply(ds),this.quaternion.copy(sc),this.objectRealQuat.multiplyQuaternions(this.quaternion,this.objXZQuat),this.colliderWorldQuat.copy(this.objectRealQuat).multiply(this.collider.rotation),this.collisionEnabled)if(this.usePhysics&&this.object.rigidBody?.collider(0).shape){let s=Do.copy(r).multiplyScalar(e/this.pixelsPerMeter),a=null;this.didHit=!1;let o=new C;for(let h=0;h<5;h++){let d=s.length(),u=Kd.copy(s).normalize();if(a=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(o),this.colliderWorldQuat,u,this.object.rigidBody.collider(0).shape,0,d,!1,12,void 0,void 0,this.object.rigidBody),a===null){h===0&&this.directionXZ.manhattanLength()!==0&&(this.lastHitObj=null),o.add(s);break}{this.didHit=!0;let p=this.sharedGameControlGlobals.colliderToEntity.get(a.collider.handle);if(p!==this.lastHitObj&&h===0){this.lastHitObj=p;let y=this.sharedGameControlGlobals.entityToCollisionEvents[p?.uuid];if(y){for(let v of y)if(v.data.target==="character"){let _,b=(this.sharedGameControlGlobals.rapierWorld?.getCollider(a.collider.handle))._parent;if(p.cloner){for(let x of p.cloner.children)if(x.rigidBody===b){_=x;break}}v.dispatch(_),p.dispatchEvent(ET)}}}let f=lB.set(a.normal2.x,a.normal2.y,a.normal2.z).applyQuaternion(this.colliderWorldQuat),g=hB.copy(u).multiplyScalar(a.time_of_impact).dot(f),m=a.time_of_impact;if(m===0&&(this.position.y+=this.offset*this.pixelsPerMeter),g>this.offset&&(m=a.time_of_impact*(g-this.offset)/g,o.addScaledVector(u,m)),s.copy(u).multiplyScalar(d-m),Math.acos(-f.y)>this.slopeThresh){let y=this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(o),v=Kd.copy(a.witness2).applyQuaternion(this.colliderWorldQuat);v.y=0;let _=y.add(v);_.y+=this.stepThresh;let b=this.sharedGameControlGlobals.rapierWorld.castShape(_,this.colliderWorldQuat,s,this.object.rigidBody?.collider(0).shape,0,1,!1,12,void 0,void 0,this.object.rigidBody);b!==null&&b.time_of_impact===0&&(f.y=0,f.normalize())}s.addScaledVector(f,-s.dot(f))}}this.position.addScaledVector(o,this.pixelsPerMeter),Mr.copy(this.position).divideScalar(this.pixelsPerMeter),ds.copy(this.quaternion).premultiply(this.groundTilt).multiply(this.objXZQuat);let l=this.object.rigidBody,c=l!==void 0&&fJ.copy(Mr).sub(l.translation()).lengthSq()>1;l!==void 0&&(c?(l.setTranslation(Mr,!0),l.setRotation(ds,!0)):(l.setNextKinematicTranslation(Mr),l.setNextKinematicRotation(ds)))}else{let s=this.onObject?1:5,a=r.multiplyScalar(e/s);for(let o=0;o<s;o++)this.position.add(a),this.collisionAdjustment(e/s)}else this.position.addScaledVector(r,e);if(this.moveMode==="walk"&&this.onObject&&(this.velocityTarget.y=0,this.velocity.y=0),this.quaternion.premultiply(this.groundTilt).multiply(this.objXZQuat),this.object.matrix.compose(this.position,this.quaternion,this.scale),this.object.matrixWorldNeedsUpdate=!0,this.object.matrix.multiply(this.nonColliderPosOffset).multiply(this.nonColliderRotOffset),this.quaternion.premultiply(this.groundTiltInv).multiply(this.objXZQuatInv),this.cameraFollow===!0){this.updateFollowArms();let s=this.objectToTarget.add(this.position),a=this.targetToCamera.add(s);rM.lookAt(a,s,Fa).setPosition(a),rM.decompose(this.targetPos,this.targetQuat,Mr),this.camera.quaternion.slerp(this.targetQuat,1-(1-this.lerpFactorRotCamera)**i),this.camera.position.lerp(this.targetPos,1-(1-this.lerpFactorPosCamera)**i),this.camera.updateMatrix(),this.camera.updateMatrixWorld(),this.cameraYAxis==="Limit"&&this.orientMode==="cartesian"&&(this.euler.y=Ot.clamp(this.euler.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel)),this.euler.x=Ot.clamp(this.euler.x,-this.PI_2+(this.cameraPolarOffset<0?this.cameraPolarOffset:0),this.PI_2+(this.cameraPolarOffset>0?this.cameraPolarOffset:0))}return this.eulerDelta.set(0,0,0),this.object.dispatchEvent(gJ),!(this.path.length<2&&this.lastPosition.distanceToSquared(this.position)<this.threshEndTranslate&&Math.abs(this.rotVelocity.x)<this.threshEndRotVel&&Math.abs(this.rotVelocity.y)<this.threshEndRotVel&&(this.camera===void 0||this.isFirstPerson||this.lastCameraPosition.distanceToSquared(this.camera.position)<this.threshEndTranslate&&8*(1-this.lastCameraQuaternion.dot(this.camera.quaternion))<this.threshEndRotate)&&(this.moveMode==="fly"||this.onObject===!0||this.collisionEnabled===!1)&&(this.navMeshPathDest===null||this.navMeshPathDest.material.opacity<-.04*this.navMeshPathDest?.material?.userData.opacity0)||(this.camera&&(this.lastCameraPosition.copy(this.camera.position),this.lastCameraQuaternion.copy(this.camera.quaternion)),this.lastPosition.copy(this.position),this.object.dispatchEvent(mJ),0))}updateFollowArms(){this.objectToTarget.copy(this.objectToTarget0),this.targetToCamera.copy(this.targetToCamera0);let t,e=ds.setFromAxisAngle(Fa,this.cameraYAxis==="Limit"&&this.orientMode!=="radial"?Ot.clamp(this.euler.y-this.euler0.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel):this.euler.y-this.euler0.y);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&this.objectToTarget.applyQuaternion(e),t=this.cameraXAxis==="Limit"?Ot.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):Ot.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset+1e-6,this.PI_2+this.cameraPolarOffset-1e-6);let i=Mr.copy(this.cameraPolarAxis0);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&i.applyQuaternion(e);let n=sc.setFromAxisAngle(i,t);this.cameraYAxis!=="Locked"&&this.targetToCamera.applyQuaternion(e),this.cameraXAxis!=="Locked"&&this.targetToCamera.applyQuaternion(n)}groundTiltAdjustment(t){180*Fa.angleTo(t)/Math.PI<15||180*Fa.angleTo(t)/Math.PI>85?ds.identity():ds.setFromUnitVectors(Fa,t),this.groundTilt.slerp(ds,.06),this.groundTiltInv.copy(this.groundTilt).invert()}collisionAdjustment(t){let e=hB.set(0,0,0);this.object.matrix.compose(this.position,this.quaternion,this.scale);let i=rM.multiplyMatrices(this.object.matrix,this.objXZRotMat).multiply(this.collider.matrix).decompose(Mr,ds,Do).compose(Mr,ds,dB);this.sharedGameControlGlobals.entitiesWithTransformAnim.forEach(r=>{if(r===this.object||r.isDescendantOf(this.object)||!r.bvhGeometry||!r.bvhGeometry.boundsTree)return;Os.makeEmpty(),r.updateMatrixWorldRigid();let s=r.matrixWorldRigid,a=cB.copy(s).invert(),o=lJ.copy(cB).multiply(i);Zn.copy(this.collider.segment),Zn.start.applyMatrix4(o),Zn.end.applyMatrix4(o);let l=lB.copy(this.position).applyMatrix4(a);Os.expandByPoint(Zn.start),Os.expandByPoint(Zn.end),Os.min.addScalar(-this.collider.radius),Os.max.addScalar(this.collider.radius),r.bvhGeometry.boundsTree.shapecast({boundsTraverseOrder:c=>c.distanceToPoint(Zn.end),intersectsBounds:c=>c.intersectsBox(Os),intersectsTriangle:c=>{let h=Mr,d=Do,u=c.closestPointToSegment(Zn,h,d);if(u<this.collider.radius){let p=this.collider.radius-u,f=d.sub(h).normalize(),g=Kd.copy(l);g.addScaledVector(f,p);let m=g.applyMatrix4(s).sub(this.position);e.add(m),Zn.start.addScaledVector(f,p),Zn.end.addScaledVector(f,p)}}})}),Os.makeEmpty(),Zn.copy(this.collider.segment),Zn.start.applyMatrix4(i),Zn.end.applyMatrix4(i),Os.expandByPoint(Zn.start),Os.expandByPoint(Zn.end),Os.min.addScalar(-this.collider.radius),Os.max.addScalar(this.collider.radius),this.sharedGameControlGlobals.staticMeshBVH?.shapecast({boundsTraverseOrder:r=>r.distanceToPoint(Zn.end),intersectsBounds:r=>r.intersectsBox(Os),intersectsTriangle:r=>{let s=Mr,a=Do,o=r.closestPointToSegment(Zn,s,a);if(o<this.collider.radius){let l=this.collider.radius-o,c=a.sub(s).normalize();this.alignToGround&&this.groundTiltAdjustment(c),e.addScaledVector(c,l),Zn.start.addScaledVector(c,l),Zn.end.addScaledVector(c,l)}}}),this.onObject=Math.abs(e.y)>Math.abs(t*this.velocity.y*.25),this.onObject&&this.dispatchStopEvent("jump");let n=Math.max(0,e.length()-1e-5);e.normalize().multiplyScalar(n),this.position.add(e)}pause(){this.firstPointerId=-1,this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0},this.deactivate()}resume(){this.activate()}},$V=AT;$V.isLocked=!1,et(),Hg(),Mp(),Sp();var YV,ZV,aM,vJ=new Promise(t=>{YV=t});function yJ(t){return aM||(aM=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.32/build";typeof window<"u"&&(ZV=new URL(e.endsWith("/")?e:`${e}/`,window.location.href).href);let i=import("./navmesh.js"),[n,r]=await Promise.all([i,fetch(`${e}/navmesh.wasm`).then(o=>o.arrayBuffer())]),s=n.default,a=await s({wasmBinary:r});YV(a)}(),aM)}ii();var KV,Fe,ur,_J=t=>`
|
|
9850
9850
|
(async function() {
|
|
9851
9851
|
const [wasmImport, wasmBinary] = await Promise.all([
|
|
9852
9852
|
import('${t}' + 'navmesh.js'),
|
|
@@ -9856,7 +9856,7 @@ void main() {
|
|
|
9856
9856
|
self.module = await wasmModule({ wasmBinary });
|
|
9857
9857
|
postMessage('ready');
|
|
9858
9858
|
})();
|
|
9859
|
-
`,bJ={cs:6,ch:2,walkableSlopeAngle:90,walkableHeight:20,walkableClimb:5,walkableRadius:0,maxEdgeLen:12,maxSimplificationError:1.3,minRegionArea:8,mergeRegionArea:20,maxVertsPerPoly:6,detailSampleDist:6,detailSampleMaxError:1};vJ.then(t=>{KV=t,Fe=new t.Vec3,ur=new t.Vec3});var xJ=new C,wJ=class{constructor(t=!1,e=!1){this.usePhysics=t,this.isExport=e,this.onPointerDown=i=>{if(ae.length!==1)return;let{raycaster:n,page:r}=this.eventContext;this.eventContext.updateRaycaster(i);let s=r.raycastWithClones(n);if(s.length!==0){if(this.gameControl){let a=xJ.copy(this.gameControl.colliderWorldPosition);a.y-=this.gameControl.colliderHeight/2,this.gameControl.path=this.computePath(a,s[0].point)}this.eventContext.requestRender()}},this.traverseWithPhysics=(i,n)=>r=>{let s;if(r instanceof zc){if(!r.objectForSample)return r.object.dataPatched.physics.fusedBody===!0&&r.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(r.objectForSample.dataPatched.physics.fusedBody)return;s=r.object}else if(r instanceof ys)s=r.object;else if(s=r,s.dataPatched.cloner?.disabled===!1&&s.dataPatched.cloner?.hideBase&&s.dataPatched.physics?.fusedBody!==!0)return!0;if(n&&!s.userData.navmesh)return;let a=s.dataPatched;if(!a.visible&&a.physics?.enabled!==!0)return!0;r.updateMatrixWorldRigid();let o=xb(a),l=s.userData.hasDestroy,c=s.userData.hasDrag,h=!1,d=!1;for(let u of a.events)u.data.disabled!==!0&&(u.data.type==="GameControl"?h=!0:u.data.type==="Follow"&&(d=!0));if(h||o||d||l||c)return!0;if(this.usePhysics&&a.physics?.rigidBody==="dynamic"){if(this.usePhysics&&a.physics?.fusedBody)return!0}else if("geometry"in r&&r.geometry&&i.push(Vo(r.geometry,r.matrixWorld)),this.usePhysics&&a.physics?.fusedBody)return r.traverseObject((u,p)=>{if(p===0)return;let f;if(u instanceof zc){if(!u.objectForSample)return u.object.dataPatched.physics.fusedBody===!0&&u.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(u.objectForSample.dataPatched.physics.fusedBody)return;f=u.object}else if(u instanceof ys)f=u.object;else if(f=u,u.dataPatched.cloner?.hideBase)return!0;let g=f.dataPatched;if(!g.visible&&g.physics?.enabled!==!0)return!0;"geometry"in u&&u.geometry&&i.push(Vo(u.geometry,u.matrixWorld))}),!0},this.traverseNoPhysics=(i,n)=>r=>{let s;if(r instanceof zc)return;s=r instanceof ys?r.object:r;let a=s.dataPatched;if(a.physics.enabled==="visibility"?!a.visible:!a.physics.enabled)return!0;if(n&&!s.userData.navmesh)return;let o=r.geometry,l=s.userData.hasDestroy===!0,c=s.userData.hasDrag===!0;if(xb(a)||l||c||s.dataPatched.events.some(h=>h.data.disabled!==!0&&h.data.type==="GameControl"))return!0;o&&i.push(Vo(o,r.matrixWorld))},this.navmeshWasm=KV,this.navMesh=new this.navmeshWasm.NavMesh,this._workerURL=URL.createObjectURL(new Blob([(e?_J(ZV??"https://cdn.spline.design/@splinetool/runtime@2.0.
|
|
9859
|
+
`,bJ={cs:6,ch:2,walkableSlopeAngle:90,walkableHeight:20,walkableClimb:5,walkableRadius:0,maxEdgeLen:12,maxSimplificationError:1.3,minRegionArea:8,mergeRegionArea:20,maxVertsPerPoly:6,detailSampleDist:6,detailSampleMaxError:1};vJ.then(t=>{KV=t,Fe=new t.Vec3,ur=new t.Vec3});var xJ=new C,wJ=class{constructor(t=!1,e=!1){this.usePhysics=t,this.isExport=e,this.onPointerDown=i=>{if(ae.length!==1)return;let{raycaster:n,page:r}=this.eventContext;this.eventContext.updateRaycaster(i);let s=r.raycastWithClones(n);if(s.length!==0){if(this.gameControl){let a=xJ.copy(this.gameControl.colliderWorldPosition);a.y-=this.gameControl.colliderHeight/2,this.gameControl.path=this.computePath(a,s[0].point)}this.eventContext.requestRender()}},this.traverseWithPhysics=(i,n)=>r=>{let s;if(r instanceof zc){if(!r.objectForSample)return r.object.dataPatched.physics.fusedBody===!0&&r.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(r.objectForSample.dataPatched.physics.fusedBody)return;s=r.object}else if(r instanceof ys)s=r.object;else if(s=r,s.dataPatched.cloner?.disabled===!1&&s.dataPatched.cloner?.hideBase&&s.dataPatched.physics?.fusedBody!==!0)return!0;if(n&&!s.userData.navmesh)return;let a=s.dataPatched;if(!a.visible&&a.physics?.enabled!==!0)return!0;r.updateMatrixWorldRigid();let o=xb(a),l=s.userData.hasDestroy,c=s.userData.hasDrag,h=!1,d=!1;for(let u of a.events)u.data.disabled!==!0&&(u.data.type==="GameControl"?h=!0:u.data.type==="Follow"&&(d=!0));if(h||o||d||l||c)return!0;if(this.usePhysics&&a.physics?.rigidBody==="dynamic"){if(this.usePhysics&&a.physics?.fusedBody)return!0}else if("geometry"in r&&r.geometry&&i.push(Vo(r.geometry,r.matrixWorld)),this.usePhysics&&a.physics?.fusedBody)return r.traverseObject((u,p)=>{if(p===0)return;let f;if(u instanceof zc){if(!u.objectForSample)return u.object.dataPatched.physics.fusedBody===!0&&u.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(u.objectForSample.dataPatched.physics.fusedBody)return;f=u.object}else if(u instanceof ys)f=u.object;else if(f=u,u.dataPatched.cloner?.hideBase)return!0;let g=f.dataPatched;if(!g.visible&&g.physics?.enabled!==!0)return!0;"geometry"in u&&u.geometry&&i.push(Vo(u.geometry,u.matrixWorld))}),!0},this.traverseNoPhysics=(i,n)=>r=>{let s;if(r instanceof zc)return;s=r instanceof ys?r.object:r;let a=s.dataPatched;if(a.physics.enabled==="visibility"?!a.visible:!a.physics.enabled)return!0;if(n&&!s.userData.navmesh)return;let o=r.geometry,l=s.userData.hasDestroy===!0,c=s.userData.hasDrag===!0;if(xb(a)||l||c||s.dataPatched.events.some(h=>h.data.disabled!==!0&&h.data.type==="GameControl"))return!0;o&&i.push(Vo(o,r.matrixWorld))},this.navmeshWasm=KV,this.navMesh=new this.navmeshWasm.NavMesh,this._workerURL=URL.createObjectURL(new Blob([(e?_J(ZV??"https://cdn.spline.design/@splinetool/runtime@2.0.32/build/"):`
|
|
9860
9860
|
(async function() {
|
|
9861
9861
|
const [wasmImport, wasmBinary] = await Promise.all([
|
|
9862
9862
|
import(self.location.origin + '/_libraries/navmesh.js'),
|
|
@@ -9931,7 +9931,7 @@ onmessage = function(messageEvent) {
|
|
|
9931
9931
|
[${P1}] { pointer-events: none; }
|
|
9932
9932
|
[${P1}] > * { pointer-events: auto; }
|
|
9933
9933
|
[${P1}] [data-spline-passthrough] { pointer-events: none; }
|
|
9934
|
-
`,Sj=class{constructor(t,e,i,n,r){this.container=t,this.host=e,this.observer=i,this.previousSplineGlobal=n,this.removeLateLifecycleShim=r}static mount(t,e,i,n){if(typeof document>"u")return null;let r=e.parentElement;if(!r)return null;getComputedStyle(r).position==="static"&&(r.style.position="relative");let s=document.createElement("div");s.setAttribute(P1,"");let a=s.style;a.position="absolute",a.overflow="hidden";let o=()=>{a.left=`${e.offsetLeft}px`,a.top=`${e.offsetTop}px`,a.width=`${e.offsetWidth}px`,a.height=`${e.offsetHeight}px`};o();let l=new ResizeObserver(o);l.observe(e),l.observe(r);let c=document.createElement("style");c.textContent=Ket,s.appendChild(c);let h=new DOMParser().parseFromString(i,"text/html"),d=Array.from(h.querySelectorAll("script"));for(let v of d)v.remove();for(let v of Array.from(h.head.children))(v.tagName==="STYLE"||v.tagName==="LINK"&&v.rel==="stylesheet")&&s.appendChild(v);for(;h.body.firstChild;)s.appendChild(h.body.firstChild);r.insertBefore(s,e.nextSibling);let u=new Map,p=new lC(xj(t,e,n),(v,_)=>{v==="warn"?console.warn(`[spline html] ${_}`):v==="error"&&console.error(`[spline html] ${_}`)},(v,_)=>{let b=u.get(v);if(b)for(let x of b)try{x(_)}catch(w){console.error(w)}}),f=(v,_)=>{try{return Promise.resolve(p.execute(v,_))}catch(b){return Promise.reject(b)}},g={ready:Promise.resolve(),setVariable:(v,_)=>f("setVariable",[v,_]),setVariables:v=>f("setVariables",[v]),getVariable:v=>f("getVariable",[v]),getVariables:()=>f("getVariables",[]),getAllObjects:()=>f("getAllObjects",[]),findObjectByName:v=>f("findObjectByName",[v]),findObjectById:v=>f("findObjectById",[v]),getGeometry:(v,_)=>f("getGeometry",[v,_??{}]),updateObject:(v,_)=>f("updateObject",[v,_]),createObject:(v,_)=>f("createObject",[v,_??{}]),createCustomMaterial:v=>f("createCustomMaterial",[v]),setMaterial:(v,_)=>f("setMaterial",[v,_]),cloneObject:(v,_)=>f("cloneObject",[v,_??{}]),removeObject:v=>f("removeObject",[v]),spawnObject:(v,_)=>f("spawnObject",[v,_??{}]),destroyObject:v=>f("destroyObject",[v]),setInstanceTransforms:(v,_)=>f("setInstanceTransforms",[v,_??null]),emitEvent:(v,_)=>f("emitEvent",[v,_]),emitEventReverse:(v,_)=>f("emitEventReverse",[v,_]),requestRender:()=>f("requestRender",[]),addEventListener:(v,_)=>{if(typeof _!="function")return;let b=u.get(v);b||(b=new Set,u.set(v,b),f("listenEvent",[v])),b.add(_)},removeEventListener:(v,_)=>{let b=u.get(v);!b||(b.delete(_),b.size===0&&(u.delete(v),f("unlistenEvent",[v])))}},m=window.spline;window.spline=g;let y=function(){if(typeof document>"u"||document.readyState==="loading")return()=>{};let v=[],_=(x,w)=>{let S=new Set,A=x.addEventListener.bind(x),E=x.removeEventListener.bind(x);Object.defineProperty(x,"addEventListener",{configurable:!0,writable:!0,value:(P,T,R)=>{if(A(P,T,R),!w.includes(P)||T==null)return;let L={type:P,listener:T};S.add(L),queueMicrotask(()=>{!S.delete(L)||((D,U,V)=>{let k=new Event(V);try{typeof U=="function"?U.call(D,k):U.handleEvent?.(k)}catch(Y){console.error(Y)}})(x,L.listener,L.type)})}}),Object.defineProperty(x,"removeEventListener",{configurable:!0,writable:!0,value:(P,T,R)=>{E(P,T,R);for(let L of S)L.type===P&&L.listener===T&&S.delete(L)}}),v.push(()=>{delete x.addEventListener,delete x.removeEventListener,S.clear()})};_(document,["DOMContentLoaded"]),_(window,["load"]);let b=Object.getOwnPropertyDescriptor(window,"onload");return Object.defineProperty(window,"onload",{configurable:!0,get:()=>null,set:x=>{typeof x=="function"&&queueMicrotask(()=>{try{x.call(window,new Event("load"))}catch(w){console.error(w)}})}}),v.push(()=>{b?Object.defineProperty(window,"onload",b):delete window.onload}),()=>{for(let x of v)x()}}();for(let v of d){let _=document.createElement("script");for(let b of Array.from(v.attributes))_.setAttribute(b.name,b.value);v.src?_.async=!1:_.textContent=v.textContent,s.appendChild(_)}return new Sj(s,p,l,m,y)}dispose(){this.removeLateLifecycleShim(),this.host.dispose(),this.observer.disconnect(),this.container.remove(),window.spline!==void 0&&(window.spline=this.previousSplineGlobal)}};function Mj(t){return typeof t=="object"&&t!==null&&t.isMaterial===!0}function yU(t){if(typeof t.material=="function")throw new Error("createObject: a (three) => material factory must be resolved to a material instance before object creation \u2014 this entry point does not support it.");if(!Mj(t.material))return{options:t};let e=t.material;if(e.isNodeMaterial===!0){let i=yk()?.NodeMaterial;if(i!==void 0&&e instanceof i)return{options:{...t,material:void 0},material:e};throw new Error("createObject: this TSL NodeMaterial comes from your own three/webgpu module instance, which cannot compile in the runtime's bundled three. Build it with app.createCustomMaterial((three) => \u2026) instead, or use a built-in material (MeshStandardMaterial, MeshBasicMaterial, \u2026).")}if(e.isShaderMaterial===!0)throw new Error("createObject: a GLSL ShaderMaterial cannot compile on the WebGPU backend \u2014 port the shader to TSL with app.createCustomMaterial((three) => \u2026), or use a built-in material (MeshStandardMaterial, \u2026).");return{options:{...t,material:void 0},material:e}}Yt(),Ye(),et(),fk(),ya(),Ye(),Yt(),zX(),bh();var Qet=new Set(["name","parent","position","rotation","scale","visible","castShadow","receiveShadow","color","material"]),_U="'Cube', 'Sphere', 'Plane', 'Rectangle', 'Ellipse', 'Triangle', 'Polygon', 'Star', 'Cone', 'Cylinder', 'Pyramid', 'Torus', 'TorusKnot', 'Dodecahedron', 'Icosahedron', 'Helix', 'Backdrop', 'Lathe', 'Text', 'CustomMesh', 'Group', 'PointLight', 'SpotLight', 'DirectionalLight'",Jet={cube:"CubeGeometry",box:"CubeGeometry",sphere:"SphereGeometry",plane:"PlaneGeometry",rectangle:"RectangleGeometry",ellipse:"EllipseGeometry",circle:"EllipseGeometry",triangle:"TriangleGeometry",polygon:"PolygonGeometry",star:"StarGeometry",cone:"ConeGeometry",cylinder:"CylinderGeometry",pyramid:"PyramidGeometry",torus:"TorusGeometry",torusknot:"TorusKnotGeometry",dodecahedron:"DodecahedronGeometry",icosahedron:"IcosahedronGeometry",helix:"HelixGeometry",backdrop:"BackdropGeometry",lathe:"LatheGeometry",text:"TextGeometry",custommesh:"NonParametricGeometry",nonparametric:"NonParametricGeometry"},tit={group:"Empty",empty:"Empty",pointlight:"PointLight",spotlight:"SpotLight",directionallight:"DirectionalLight"},eit={shapeblend:"Shape Blends are built from member meshes in the editor and cannot be created empty.",path:"Path shapes need authored path data \u2014 clone an existing one with cloneObject() instead.",vector:"Vector shapes need authored shape data \u2014 clone an existing one with cloneObject() instead.",shape:"Vector shapes need authored shape data \u2014 clone an existing one with cloneObject() instead.",boolean:"Boolean operations are not creatable at runtime \u2014 clone an existing Boolean object with cloneObject() instead.",decal:"Decals need a surface to project onto \u2014 clone an existing Decal with cloneObject() instead.",ui:"UI objects need a 2D frame \u2014 clone an existing one with cloneObject() instead.",input:"Text inputs are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",particle:"Particle emitters are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",particlecollider:"Particle forces are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",hair:"Hair systems are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",camera:"Cameras are not creatable at runtime.",perspectivecamera:"Cameras are not creatable at runtime.",orthographiccamera:"Cameras are not creatable at runtime.",hemispherelight:"Hemisphere lights are not creatable at runtime.",splat:"Splats are not creatable at runtime.",page:"Pages are not creatable at runtime.",component:"Components are authored in the editor.",instance:"Instances are authored in the editor \u2014 clone an existing one with cloneObject() instead.",bone:"Bones are not creatable at runtime.",mesh:"pass the shape name directly, e.g. createObject('Cube')."},iit={CubeGeometry:"Cube",SphereGeometry:"Sphere",PlaneGeometry:"Plane",RectangleGeometry:"Rectangle",EllipseGeometry:"Ellipse",TriangleGeometry:"Triangle",PolygonGeometry:"Pentagon",StarGeometry:"Star",ConeGeometry:"Cone",CylinderGeometry:"Cylinder",PyramidGeometry:"Pyramid",TorusGeometry:"Torus",TorusKnotGeometry:"Torus Knot",DodecahedronGeometry:"Dodecahedron",IcosahedronGeometry:"Icosahedron",HelixGeometry:"Helix",BackdropGeometry:"Backdrop",LatheGeometry:"Lathe",TextGeometry:"Text",NonParametricGeometry:"Custom Mesh"},nit={Empty:"Group",PointLight:"Point Light",SpotLight:"Spot Light",DirectionalLight:"Directional Light"};function Ng(t,e){return t===void 0?[e[0],e[1],e[2]]:Array.isArray(t)?[t[0]??e[0],t[1]??e[1],t[2]??e[2]]:[t.x??e[0],t.y??e[1],t.z??e[2]]}function Ej(t){return typeof t=="number"?[t,t,t]:Ng(t,[1,1,1])}function HT(t){let e=new mn(0,0,0,1);return e.setStyle(t),{r:e.r,g:e.g,b:e.b}}function bU(t,e){let i=t.material??(t.color!==void 0?{color:t.color}:void 0);if(i===void 0)return ki.defaultColorMaterial(xU(Rr),"physical","layer1","layer2");if(typeof i=="string"){for(let[a,o]of Object.entries(e.shared.materials))if(a===i||o.name===i)return a;if(function(a){let o=a.trim().toLowerCase();return/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(o)||/^(rgb|hsl)a?\(/.test(o)||Jt.NAMES[o]!==void 0}(i))return ki.defaultColorMaterial(HT(i),"physical","layer1","layer2");throw new Error(`createObject: material '${i}' matches no shared material in this document (available: ${function(a){let o=Object.entries(a.shared.materials).map(([,l])=>`'${l.name}'`).filter(l=>l!=="'undefined'");return o.length?o.join(", "):"(none)"}(e)}) and is not a valid CSS color.`)}if(typeof i=="function")throw new Error("createObject: a (three) => material factory must be resolved to a material instance before object creation \u2014 this entry point does not support it.");if(Mj(i))throw new Error("createObject: a three.js material instance cannot be stored in the document \u2014 this entry point does not support it.");let n=i.color!==void 0?HT(i.color):xU(Rr),r=ki.defaultColorMaterial(n,"physical","layer1","layer2"),s=r.layers.find(a=>a.data.type==="light");if(s){let a={};i.roughness!==void 0&&(a.roughness=i.roughness),i.metalness!==void 0&&(a.metalness=i.metalness),i.reflectivity!==void 0&&(a.reflectivity=i.reflectivity),Object.assign(s.data,a)}if(i.alpha!==void 0){let a=r.layers.find(o=>o.data.type==="color");a&&Object.assign(a.data,{alpha:i.alpha})}return r}function xU(t){return{r:(t>>16&255)/255,g:(t>>8&255)/255,b:(255&t)/255}}function rit(t){let e=Ho.defaultData("TextGeometry"),{text:i,...n}=t,r=n.fontSize;return r!==void 0&&n.width===void 0&&(n.width=350*r/16),r!==void 0&&n.height===void 0&&(n.height=50*r/16),Object.assign(e,n),i!==void 0&&Object.assign(e,{text:{textValue:String(i)}}),e}function Fy(t){return Array.isArray(t)?t:!ArrayBuffer.isView(t)||t instanceof DataView?null:Array.from(t)}function sit(t,e){return iN({userData:{type:t,...IA[t].normalizeInputs({parameters:e})}})}function ait(t,e,i){let{objectType:n,geometryType:r}=t,s=function(l){let c={};for(let[h,d]of Object.entries(l))!Qet.has(h)&&d!==void 0&&(c[h]=d);return c}(e),a={states:new Vt,events:new Vt};if(n==="Mesh"&&r){if(r==="NonParametricGeometry"){let{geometry:l,doubleSide:c}=function(h){let d=Fy(h.vertices);if(!d||d.length<9||d.length%3!=0)throw new Error("createObject('CustomMesh'): `vertices` must be a flat number[] of x,y,z triples (length a multiple of 3, at least one triangle).");let u=d.length/3;if(u>6e4)throw new Error(`createObject('CustomMesh'): too many vertices (${u}); keep it under 60000.`);let p=Fy(h.indices);if(p&&p.length){let _=p.find(b=>!Number.isInteger(b)||b<0||b>=u);if(_!==void 0)throw new Error(`createObject('CustomMesh'): index ${_} is out of range (mesh has ${u} vertices).`)}else p=null;let f=new Gt;f.setAttribute("position",new Nt(d,3));let g=Fy(h.normals),m=g!==null&&g.length===d.length;m&&f.setAttribute("normal",new Nt(g,3));let y=Fy(h.uvs);y&&y.length===2*u&&f.setAttribute("uv",new Nt(y,2));let v=!1;if(!m){let _=p??Array.from({length:u},(w,S)=>S),{closed:b,inverted:x}=function(w,S){let A=w.length/3,E=new Map,P=new Array(A);for(let D=0;D<A;D++){let U=`${Math.round(1e4*w[3*D])},${Math.round(1e4*w[3*D+1])},${Math.round(1e4*w[3*D+2])}`,V=E.get(U);V===void 0?(E.set(U,D),P[D]=D):P[D]=V}let T=new Map;for(let D=0;D+2<S.length;D+=3){let U=P[S[D]],V=P[S[D+1]],k=P[S[D+2]];for(let[Y,$]of[[U,V],[V,k],[k,U]]){if(Y===$)continue;let nt=Y<$?Y+"_"+$:$+"_"+Y;T.set(nt,(T.get(nt)??0)+1)}}let R=T.size>0;for(let D of T.values())if(D!==2){R=!1;break}if(!R)return{closed:!1,inverted:!1};let L=0;for(let D=0;D+2<S.length;D+=3){let U=3*S[D],V=3*S[D+1],k=3*S[D+2],Y=w[U],$=w[U+1],nt=w[U+2],Q=w[V],rt=w[V+1],gt=w[V+2],at=w[k],ht=w[k+1],ct=w[k+2];L+=Y*(rt*ct-gt*ht)+$*(gt*at-Q*ct)+nt*(Q*ht-rt*at)}return{closed:!0,inverted:L<0}}(d,_);if(b&&x){for(let w=0;w+2<_.length;w+=3){let S=_[w+1];_[w+1]=_[w+2],_[w+2]=S}p=_}else b||(v=!0)}return p&&f.setIndex(p),m||f.computeVertexNormals(),{geometry:iN({userData:{type:"NonParametricGeometry",parameters:{subdivisions:0}},data:f.toJSON().data}),doubleSide:v}}(s);Object.assign(a,Ha.defaultData,{geometry:l,materials:[bU(e,i)]}),c&&(a.side=2)}else Object.assign(a,Ha.defaultData,{geometry:r==="TextGeometry"?rit(s):sit(r,s),material:bU(e,i)});e.castShadow!==void 0&&(a.castShadow=e.castShadow),e.receiveShadow!==void 0&&(a.receiveShadow=e.receiveShadow)}else n==="Empty"?Object.assign(a,z_.defaultData):(Object.assign(a,F_.defaultData(n),s),e.color!==void 0&&(a.color=HT(e.color)));a.visible=e.visible??!0,a.position=Ng(e.position,[0,0,0]),a.rotation=Ng(e.rotation,[0,0,0]),a.scale=Ej(e.scale);let o=(r&&iit[r])??nit[n]??n;return a.name=e.name??Aj(o,i.scene.objects),a}function Aj(t,e){let i=new Set;if(e.traverse((r,s)=>{i.add(s.name??"")}),!i.has(t))return t;let n=2;for(;i.has(`${t} ${n}`);)n++;return`${t} ${n}`}function Tj(t,e){let i=Ot.generateUUID();if(t.data.type==="Component")return{data:{...Qo.fromComponentData(t),name:t.data.name+" Instance"},id:i,fi:t.fi,children:[]};e[t.id]=i;let n=t.data;return n.type==="Empty"&&n.animations?.length&&(n={...n,animations:n.animations.map(([r,s,a])=>{let o=Ot.generateUUID(),l=a.indexOf(r);return[o,s,l!==-1?a.slice(0,l)+o+a.slice(l+r.length):a]})}),{...t,id:i,data:n,children:t.children.map(r=>Tj(r,e))}}function oit(t){let e={};return function(i,n){return Gu(i,n,null)??i}(Tj(t,e),e)}function lit(t){let e=Array.isArray(t)?t[0]:t,i=e.layers?.map(hit)??[],n=e.layers?.find(r=>r.type==="light");return{layers:i,alpha:n?.node.alphaOverride?.value??1}}function hit(t){return t.type==="texture"||t.type==="video"||t.type==="matcap"?{...t.data,updateTexture:e=>t.color.texture.image.updateSrc(e)}:{...t.data}}bh(),Li(),kC(),ya();var cm=new mn(0,0,0,1),cit={color:["color"],cavity:[],dust:["color"],fresnel:["color"],normal:[],gradient:["colors"],depth:["colors"],texture:[],video:[],noise:["colorA","colorB","colorC","colorD"],toon:["colors","shadowColor"],outline:["outlineColor","contourColor"],transmission:["attenuationColor"],reflection:[],matcap:[],pattern:["colorA","colorB"],vertexColor:[],light:[],displace:[],rainbow:[],particle:[]};Yt(),Yt();var dit=new it;function wU(t){let e=new mn(0,0,0,1);try{e.setStyle(t)}catch(i){console.error(i)}return e}var Cj=class{constructor(t,{renderOnDemand:e,renderMode:i="auto",wasmPath:n,renderer:r,htmlContentMode:s="sandbox"}={}){if(this._rendererBackend="webgl",this._rendererAuto=!1,this._rendererConfigured=!1,this._viewportMode=1,this._viewportWidth=window.innerWidth,this._viewportHeight=window.innerHeight,this._proxyObjectCache=new Map,this._htmlContentMode="sandbox",this._variablesCache=new Map,this._isPaused=!1,this._renderRequested=!1,this._skipRender=!1,this.time=performance.now(),this.dt=0,this.currentTAAFrame=0,this.disposed=!1,this._requestRenderAutoMode=()=>{this._skipRender=!1},this.requestRender=()=>{this._renderRequested=!0},this.render=a=>{if(this.time=a,this._lastTime&&(this.dt=this.time-this._lastTime),this._lastTime=this.time,this._perfs?.start(),this._renderer)if(this._isPaused||!(this.renderMode==="manual"&&!this._renderRequested||this.renderMode==="auto"&&this._skipRender)){if(this._renderRequested=!1,this._skipRender=!0,this._controls&&(this._skipRender=this._controls.update(this.dt)??!1),this._eventManager&&(this._eventManager.handlers?.Start?.hasVideoAction||this._eventManager.handlers?.Basic?.hasVideoAction||this._eventManager.handlers?.Conditional?.hasVideoAction)&&(this._skipRender=!1),this._animationControls?.update(this.dt),this._skipRender?(this.currentTAAFrame++,this.currentTAAFrame<rN?this._skipRender=!1:this.currentTAAFrame=0):this.currentTAAFrame=0,this._scene?.traverseVisibleEntity(o=>{o.type==="ParticleSystem"&&(o.update(this.dt),this._skipRender=!1),Gc(o)&&(this._renderer?.isWebGPUSplineRenderer!==!0&&o.warnClassicFallbackOnce(),o.isSimulating&&(o.update(this.dt),this._skipRender=!1))}),this._scene&&this._scene.activeCamera!==this._camera&&(this._camera=this._scene.activeCamera),this._eventManager?.isEnabled&&(this._eventManager.handlers?.Follow?.onAnimationFrameDamping(),this._eventManager.handlers?.LookAt?.onAnimationFrameDamping(),this._eventManager.handlers?.DragDrop?.onAnimationFrameDamping()),this._scene&&this._camera){if(this._scene.pathConstraints.applyConstraints(this._scene),this._renderer.sceneTransitionTimeRemaining>0){this._renderer.sceneTransitionTimeRemaining-=this.dt;let o=Math.min(1,1-this._renderer.sceneTransitionTimeRemaining/this._renderer.sceneTransitionDuration);this._renderer.pipeline.sceneTransitionPass.uniforms.mixRatio.value=o,this._skipRender=!1}else this._renderer.pipeline.sceneTransitionFromTexture=null;this._renderer.renderSplineScene(this._scene,this._camera),this._renderer.lastFrameIncomplete===!0&&(this._skipRender=!1),this._renderer.skyAnimationActive===!0&&(this._skipRender=!1)}this.canvas.dispatchEvent(this._renderedEvent),this._perfs?.end()}else this._perfs?.end();else this._perfs?.end()},this._resize=a=>{if(this._renderer){if(this._viewportMode===1&&this._frameView&&(this._frameView.frameSize=dit.set(this._viewportWidth,this._viewportHeight)),a){let o=this._viewportWidth,l=this._viewportHeight;this._renderer.setSize(o-1,l-1,!1),this._renderer.setSize(o,l,!1)}else this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1);this._camera=this._scene?.activeCamera,this._scene?.updateViewPlaneSize(this._frameView?.frameSize?.x??this._viewportWidth,this._frameView?.frameSize?.y??this._viewportHeight,this._frameView?.enableResponsive??!1),this._camera&&(this._frameView?.setCamera(this._camera),this._frameView?.updateCamera(),this._camera.cameraType==="PerspectiveCamera"&&(this._camera.aspect=this._viewportWidth/this._viewportHeight),this._camera.updateProjectionMatrix()),this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect()),this._requestRenderAutoMode()}},this._debouncedResize=Ag(this._resize,10),this._onScroll=a=>{this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect())},this.canvas=t,this._htmlContentMode=s,this.renderMode=e?"auto":i,n!==void 0&&(this._wasmPath=function(a){let o=a.length;for(;o>0&&"/".includes(a[o-1]);)o--;return a.slice(0,o)}(n)),this._rendererBackend=r??"webgl",r===void 0){let a=null;try{a=new URLSearchParams(window.location.search).get("renderer")}catch{}a==="webgpu"||a==="webgl"||a==="webgl2"?this._rendererBackend=a==="webgl2"?"webgl":a:(this._rendererAuto=!0,this._rendererBackend="webgl")}this._renderedEvent=new CustomEvent("rendered",{bubbles:!0}),Object.defineProperty(this._renderedEvent,"target",{writable:!1,value:this}),window.location.search.includes("perfs")&&Promise.resolve().then(()=>(AY(),_6)).then(({Perfs:a})=>{this._perfs=new a({x:10,y:10})}),function(a){a.addEventListener("pointerdown",IR,!0),a.addEventListener("pointerdown",tv,!0),a.addEventListener("pointermove",tv,!0),a.addEventListener("pointerup",Pd,!0),a.addEventListener("pointercancel",Pd,!0),a.addEventListener("pointerleave",Pd,!0),window.addEventListener("keydown",OR,!0),window.addEventListener("keyup",LR,!0)}(t)}async _createRenderer(){this._rendererBackend,this._rendererBackend;{let{SplineRenderer:t,rendererGlobals:e}=await Promise.resolve().then(()=>($L(),uT));try{new URLSearchParams(window.location.search).get("taa")==="off"&&(e.taaEnabled.value=!1)}catch{}return new t({canvas:this.canvas,antialias:!1,alpha:!0,stencil:!1,depth:!1,powerPreference:"high-performance"})}}_failWebGPURequired(){console.error('[spline] This scene was exported for WebGPU only and this browser does not provide a WebGPU adapter. Re-export with renderer "Both" or "WebGL 2" to support this browser.');try{let t=window.devicePixelRatio||1,e=this.canvas.clientWidth||300,i=this.canvas.clientHeight||150;this.canvas.width=e*t,this.canvas.height=i*t;let n=this.canvas.getContext("2d");n&&(n.scale(t,t),n.fillStyle="rgba(127, 127, 127, 0.85)",n.font="13px system-ui, -apple-system, Segoe UI, Roboto, sans-serif",n.textAlign="center",n.textBaseline="middle",n.fillText("This scene requires a WebGPU-capable browser.",e/2,i/2))}catch{}this.canvas.dispatchEvent(new CustomEvent("splineerror",{bubbles:!0,detail:{reason:"webgpu-required"}}))}async load(t,e,i){(function(r){let s="The Spline Runtime only accepts .splinecode files that are generated from Spline export panel.";r.endsWith(".spline")?console.warn(s+" The .spline files are only meant to be used by the Editor."):r.endsWith(".splinecode")||console.warn(s)})(t),this.disposed=!1;let n=await(await fetch(t,i)).arrayBuffer();await this.start(n,{variables:e})}async start(t,{interactive:e=!0,variables:i}={}){if(this.disposed)return;er.init();let n=await async function(u){let[p,f]=Em(Tg.deserialize(new Uint8Array(u)));if((p.schema??0)!==131){let{updateDocumentSchema:g}=await Promise.resolve().then(()=>(Hb(),YF));g(p)}return f.result().data}(t);this._data=n;let r=function(u){let p=[];return u.scene.objects.traverse((f,g)=>{g.type==="Mesh"&&g.geometry.type==="NonParametricGeometry"&&g.geometry.data.draco!==void 0&&p.push(g)}),p}(n);n.version&&(0,Yet.default)(n.version,"2.0.31")>0&&console.warn("Your .splinecode file is more recent than the library. Please upgrade @splinetool/runtime to the latest version."),this._wasmPath!==void 0&&(this.setUIWasmUrl(`${this._wasmPath}/hana-ui.wasm`),function(u){JA=u}(this._wasmPath));let s=async function(){}();await Promise.all([s,r.length&&mU(this._wasmPath),B4(n)&&GX(this._wasmPath),C$(n)&&b$(this._wasmPath),jc.physicsEnabled(n.scene.objects)&&iJ(this._wasmPath),jO(n)&&Q5(),H4(n)&&$$(),JX(n)&&QX(),H5(n)&&s.then(()=>lA()?.loadHanaUIRUNTIME()),YQ(n)&&yJ(this._wasmPath)].filter(Boolean)),r.length&&await gU(r),this._eventManager?.deactivate(),this._controls?.deactivate(),this._scene?.dispose();let a=n.scene.publish.renderer;if(this._rendererAuto&&a==="webgl")this._rendererBackend="webgl";else if(this._rendererAuto&&a==="webgpu")return void this._failWebGPURequired();let o=function(u){let p=new Set;return u.scene.objects.traverse((f,g)=>{if(g.type!=="Page")return;let m=g.postprocessing;if(m&&typeof m=="object"&&m.enabled===!0)for(let[y,v]of Object.entries(m))y!=="enabled"&&v&&typeof v=="object"&&v.enabled===!0&&p.add(y)}),[...p]}(n);this._rendererBackend,this._rendererBackend!=="webgpu"&&await Promise.all([Promise.resolve().then(()=>($L(),uT)),$et(o)]),function(u){ix=u}((this._rendererBackend,"webgl"));let l=new Get(n);if(l.resetPersonalCameraFromDocumentData(),this._scene=l.scene,this._sharedAssetsManager=l.sharedAssets,this._camera=this._scene.activeCamera,window.location.search.includes("merge-geometries")){let{mergeStaticGeometries:u}=await Promise.resolve().then(()=>(oK(),eV)),p=performance.now();u(n,l.scene);let f=performance.now();console.log("Merged geometries in ",f-p," ms")}B4(n)&&this._scene.traverse(u=>{to(u)&&u.recomputeBoolean()}),this._sharedAssetsManager.setRequestRender(()=>{this._requestRenderAutoMode(),this._scene?.traverse(u=>{Lu(u)&&u.pendingMediaLoad&&u.update({scene:this._scene,shared:this._sharedAssetsManager})})}),this._scene?.traverse(u=>{u.type==="ParticleSystem"&&(u.wakeUp(),u.data.autoPlay?u.start():u.stop()),Gc(u)&&u.setPlayMode(!0)});let c=Object.keys(n.shared.fonts).flatMap(u=>{let p=this._sharedAssetsManager.getFont(u);return p?[p.loadingPromise]:[]});if(Promise.all(c).then(()=>{this.disposed||(l.scene.markNeedsUpdateRendererDirty(),this._requestRenderAutoMode())}),jO(n)&&function(u){if(jc.physicsEnabled(u.scene.objects))return!0;let p=!1;return u.scene.objects.traverse((f,g)=>{if(g.events){if(Array.isArray(g.events)){for(let m of g.events)if(m.data.disabled!==!0&&m.data.type==="GameControl"&&m.data.collisionEnabled){p=!0;break}}else for(let m of Object.values(g.events))if(m.disabled!==!0&&m.type==="GameControl"&&m.collisionEnabled){p=!0;break}}}),p}(n)&&await Promise.all(c),H5(n)){let u=[];this._scene.traverseEntity(p=>{(Cr(p)||p instanceof dn)&&p.uiCanvas&&u.push(p.uiCanvas)}),await Promise.all(u.map(p=>p.promise))}if(this._scene.rewriteEventsBeforeGoToPlayMode(),N3(this._scene.activePage,this._sharedAssetsManager),this._renderer||(this._renderer=await this._createRenderer()),!this._rendererConfigured){this._rendererConfigured=!0,this._renderer.hdTransmission=n.scene.publish.hdTransmission===!0;let u=()=>/Mobi|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),p=this._getPixelRatio(u()?n.scene.publish.settings.web.pixelRatioMobile:n.scene.publish.settings.web.pixelRatioDesktop);if(this._renderer.setPixelRatio(p),this._renderer.pipeline.enableUIOverlay(),this._renderer.pipeline.addEventListener("smaaloaded",this._requestRenderAutoMode),n.shared.images.SplineWatermark){let f=this._sharedAssetsManager.getImage("SplineWatermark");await f.loadPromise;let g=f.getTexture(1001);this._renderer.pipeline.setWatermark(g)}}H4(n)&&this._scene.initializeSplatViewer(),n.scene.blueNoiseTextureData!==void 0&&this._renderer.pipeline.updateBlueNoiseTexture(n.scene.blueNoiseTextureData);let h=Object.values(n.frames)[0];if(this._frameView?this._frameView.setCamera(this._camera):(h.preset==="fullscreen"?(this._viewportMode=1,this.canvas.style.display="block",this.canvas.parentElement&&(this._viewportWidth=this.canvas.parentElement.clientWidth||300,this.canvas.style.width="100%"),this.canvas.parentElement&&(this._viewportHeight=this.canvas.parentElement.clientHeight||150,this.canvas.style.height="100%")):(this._viewportMode=2,this._viewportWidth=h.size[0],this._viewportHeight=h.size[1],this.canvas.style.width=`${this._viewportWidth}px`,this.canvas.style.height=`${this._viewportHeight}px`),this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1),this._frameView=new jK(this._renderer,this._camera,new it(this._viewportWidth,this._viewportHeight)),this._frameView.enableResponsive=(h.allowResponsive??!1)&&h.preset==="fullscreen"),e){let u=new xK(this._renderer,this.data.scene.publish,this._scene,()=>this._scene.activeCamera,this._sharedAssetsManager,this._requestRenderAutoMode,!0,h);this._scene.updateMatrixWorld(!0),this._controls=new aJ(u),this._animationControls=new qet(this._scene,this._requestRenderAutoMode),this._eventManager=new UK(n.scene.publish,this._controls,this._animationControls,u,n.shared.variables),this._eventManager.activate(),this._controls.activate(this._eventManager)}this._resize(),this._scene.activePage.data.postprocessing.depthOfField.enabled&&Promise.all(this._sharedAssetsManager.getImageLoadPromises()).then(()=>{this.disposed||this._resize(!0)}),i!==void 0&&this.setVariables(i),this.dt===0&&(this.render(performance.now()),setTimeout(()=>{this._renderer?.setAnimationLoop(this.render)},0)),this._resizeObserverTimeout=setTimeout(()=>{!this._resizeObserver&&this.canvas.parentElement&&(this._resizeObserver=new ResizeObserver(()=>{this._viewportWidth=this.canvas.clientWidth,this._viewportHeight=this.canvas.clientHeight,this._debouncedResize()}),this._resizeObserver.observe(this.canvas.parentElement))},300),document.addEventListener("scroll",this._onScroll),this._htmlContentOverlay?.dispose(),this._htmlContentOverlay=void 0;let d=n.scene.publish.htmlContent?.html;if(e&&d&&this._htmlContentMode!=="none"){let u={shared:this._sharedAssetsManager,findEntity:p=>this._scene?.getObjectByProperty("uuid",p)??this._scene?.getObjectByName(p)};this._htmlContentOverlay=(this._htmlContentMode==="inline"?Sj.mount(this,this.canvas,d,u):wj.mount(this,this.canvas,d,u))??void 0}}setVariables(t){if(this._data!==void 0){let e=Object.entries(t);for(let[i,n]of e)this.setVariable(i,n)}}setVariable(t,e){let i=this._getVariableByName(t);if(i&&!("dynamicVariableType"in i.data)){let n=e;typeof i.data.value=="number"?n=typeof e=="number"?e:typeof e=="boolean"?e===!0?1:0:parseFloat(e):typeof i.data.value=="boolean"?n=typeof e=="number"?!!e:typeof e=="boolean"?e:e.toLocaleLowerCase()!=="false"&&!!e:typeof i.data.value!="string"&&i.data.value.textValue!==void 0&&(n=e.toString());let r=typeof n=="string"?{textValue:n}:n;this._sharedAssetsManager?.updateVariable(i.id,r),this.requestRender(),this._requestRenderAutoMode()}else i===void 0?console.warn(`No variable named ${t} was found in your Spline file. Make sure to create it from Spline editor.`):"dynamicVariableType"in i.data&&console.warn(`Dynamic variables like ${t} cannot be updated from code.`)}getVariables(){let t={};return this._data&&this._data.shared.variables.forEach(e=>{t[e.data.name]===void 0&&(t[e.data.name]=this._getVariableValue(this._sharedAssetsManager.getVariable(e.id)))}),t}getVariable(t){let e=this._getVariableByName(t);if(e){let i=this._sharedAssetsManager.getVariable(e.id);return this._getVariableValue(i)}}_getVariableValue(t){return typeof t!="string"&&_r.isTextValue(t)?_r.getDisplayedValue(t):t}_getVariableByName(t){if(this._data){if(this._variablesCache.has(t))return this._variablesCache.get(t);let e=this._data.shared.variables.find(i=>i.data.name===t);return e&&this._variablesCache.set(t,e),e}}_getPixelRatio(t){switch(t){case 0:return window.devicePixelRatio;case 1:return 1;case 2:return 2}}findObjectById(t){let e=this._scene?.getObjectByProperty("uuid",t);return this._createProxyObject(e)}findObjectByName(t){let e=this._scene?.getObjectByName(t);return this._createProxyObject(e)}getAllObjects(){let t=[];return this._scene?.traverseEntity(e=>{if(!(e.uuid===Yc||this._scene.isInvisibleObjects(e)||e instanceof dn)){let i=this._createProxyObject(e);i&&t.push(i)}}),t}getSplineEvents(){return(this._eventManager?.handlers?.Spline).splineEvents}emitEvent(t,e){(this.findObjectById(e)||this.findObjectByName(e))?.emitEvent(t)}emitEventReverse(t,e){(this.findObjectById(e)||this.findObjectByName(e))?.emitEventReverse(t)}addEventListener(t,e){this.canvas.addEventListener(t,e)}removeEventListener(t,e){this.canvas.removeEventListener(t,e)}setZoom(t){this._controls?.orbitControls instanceof vV&&this._controls?.orbitControls.setZoom(t)}get eventManager(){return this._eventManager}get controls(){return this._controls}setSize(t,e){this._viewportWidth=t,this._viewportHeight=e,this._viewportMode=2,this._resize()}setBackgroundColor(t){let e=wU(t);this._scene?.activePage.setBackgroundColor(e),this._requestRenderAutoMode()}dispose(){this.disposed=!0,this._htmlContentOverlay?.dispose(),this._htmlContentOverlay=void 0,this._eventManager?.dispose(),this._scene?.dispose(),this._scene=void 0,this._camera=void 0,og&&og.disposeAll(),this._sharedAssetsManager?.setRequestRender(()=>{}),this._sharedAssetsManager?.dispose(),this._sharedAssetsManager=void 0,this._proxyObjectCache.forEach(t=>{P2.unsubscribe(t)}),this._proxyObjectCache.clear(),this._variablesCache.clear(),this._renderer?.pipeline.removeEventListener("smaaloaded",this._requestRenderAutoMode),this._renderer?.setAnimationLoop(null),this._renderer?.dispose(),this._renderer=void 0,this._debouncedResize.cancel(),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=void 0),this._resizeObserverTimeout!==void 0&&(clearTimeout(this._resizeObserverTimeout),this._resizeObserverTimeout=void 0),this.canvas.style.width="",this.canvas.style.height="",this.canvas.removeAttribute("width"),this.canvas.removeAttribute("height"),this._frameView=void 0,this._controls?.deactivate(),this._controls=void 0,this._animationControls=void 0,this._eventManager?.eventContext.dispose(),this._eventManager=void 0,this._splatViewer=void 0,this._data=void 0,this._perfs=void 0,this.dt=0,this._lastTime=void 0,function(t){t.removeEventListener("pointerdown",IR,!0),t.removeEventListener("pointerdown",tv,!0),t.removeEventListener("pointermove",tv,!0),t.removeEventListener("pointerup",Pd,!0),t.removeEventListener("pointercancel",Pd,!0),t.removeEventListener("pointerleave",Pd,!0),window.removeEventListener("keydown",OR,!0),window.removeEventListener("keyup",LR,!0)}(this.canvas),document.removeEventListener("scroll",this._onScroll),er.dispose()}get isStopped(){return this._isPaused}stop(){this._isPaused||(this._renderer?.setAnimationLoop(null),this._isPaused=!0,this._eventManager?.pause(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!1))}play(){!this._isPaused||(this._isPaused=!1,this._eventManager?.resume(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!0),this._renderer?.setAnimationLoop(this.render))}setGlobalEvents(t){this._eventManager?.updateUseWindowEvents(t)}get data(){return this._data}_createProxyObject(t){if(!this._scene)return;let e,i=this._scene;if(t==null)return;if(this._proxyObjectCache.has(t.uuid))return this._proxyObjectCache.get(t.uuid);t.traverseAncestors(h=>{h instanceof dn&&(e=h.name)});let n=this._sharedAssetsManager,r={shared:n,scene:this._scene},s=h=>{if(h===null||h==="Base State")return null;if(h&&t.data.states){let d=t.data.states.find(u=>u.data.name===h);return d?d.id:void 0}},a="material"in t?t.material:void 0,o=t.materialOverride,l={name:t.name,uuid:t.uuid,visible:t.visible,intensity:t.intensity,position:t.position,rotation:t.rotation,scale:t.scale,type:t.data.type,page:e,material:o??(a?lit(a):void 0),parentUuid:t.parent instanceof dn||t instanceof lx?void 0:t.parent?.uuid,emitEvent(h){t.dispatchEvent({type:"userEvent",eventName:h})},emitEventReverse(h){t.dispatchEvent({type:"userEvent",eventName:h,reverse:!0})},hide(){t.visible&&(t.visible=!1,r.shared.requestRender())},show(){t.visible||(t.visible=!0,r.shared.requestRender())},get state(){let h=t.stateSelection;if(h!==null)return t.data.states.find(({id:d})=>d===h)?.data.name},set state(h){let d;if(h!==void 0){let u=typeof h=="string"?t.data.states.find(({id:p})=>p===h):t.data.states[h];if(u)d=u.id;else{let p=typeof h=="string"?s(h):void 0;p&&(d=p)}}t.changeSelectedState(d??null,r),t.currentState=d??null,t.dispatchEvent({type:"completeState",state:d??null}),r.shared.requestRender()},transition(h){let d=bj;if(d===null)return Vn("transitions","obj.transition()"),{transition(b){return this},play(){return this},pause(){return this},reset(){return this},seek(b){return this}};let u,p,f=this,g=[],m=!1,y=()=>{p=new uj({delay:0,delayDirection:"start-once",direction:"normal",repeat:0,runMode:"Repeat"},g.map(b=>b.runner))},v={update(b){p?.update(b),p?.isPlaying!==!0&&er.remove(v)}},_={transition({from:b,to:x,duration:w,delay:S,...A}){let E=s(b);E===void 0&&(E=u);let P=s(x);return u=P,g.push(new d(t,E,P,{state:P,repeat:0,delay:S??0,delayDirection:"start-once",direction:"normal",duration:w??1e3,...A,...A.easing===6?$l.defaultData:A.easing===5?dp.defaultData:{}},n,!1,i.activePage,{onBegin:()=>{(b&&E||b==="Base State"&&!E)&&(f.state=E??void 0)},onComplete:()=>{f.state=P??void 0}})),y(),this},play(){return p?(m=!0,p.play(er.time),p.isPlaying&&er.add(v),this):this},pause(){return p?.stop(),er.remove(v),this},reset(){return this.pause(),m=!1,y(),p?.seek(0),this},seek(b){let x=g.reduce((w,S)=>w+S.runner.duration,0);return x>0&&p?.seek(b/1e3/x),this}};return _.transition(h),(h.autoPlay??!0)&&queueMicrotask(()=>{m||_.play()}),_},set color(h){let d=wU(h);if(nb.is(t))return void(t.color=d);if(!(t.type==="Mesh"&&"material"in t&&t instanceof Hr))return;let u={r:d.r,g:d.g,b:d.b,a:d.a},p=t.materialOverride;if(p!==void 0){let m=p.color;return void(m?.isColor===!0&&typeof m.setStyle=="function"&&(m.setStyle(h),r.shared.requestRender()))}let f=Array.isArray(t.material)?t.material[0]:t.material,g=f.data.layers.find(m=>m.data.type==="color")?.id;if(g)f.updateByOp({type:0,path:["layers",g],props:{color:{...u}}},f.data,r);else{let m=f.data,y=m.layers.find(S=>S.data.type==="light");if(!y)return;let v=m.layers.indexOf(y)===0?y:null,_=m.layers.at(v?m.layers.indexOf(v)+1:0),b={type:4,fi:v?v.fi+(_?(_.fi-v.fi)/2:1):_?_.fi/2:1,id:Ot.generateUUID(),data:{...Ki.defaultData("color"),color:u},localIndex:0},x=m.layers.insertAfterHelper(v?.id??null,1),w=m.layers.runOp({...b,fi:x[0]}).data;Object.assign(f.data,{layers:w}),f.updateByOp({...b,path:["layers"]},f.data,r)}}},c=P2(l,(h,d)=>{let u=t[h],p=function(f){return f.split(".")}(h);p[0]==="material"&&a&&o===void 0&&function(f,g,m){let y=Array.isArray(m)?m[0]:m;if(f[0]==="layers"){let v=parseInt(f[1]),_=y.layers[v],b=f[2];_&&b&&function(x,w,S){let A=x[0];try{if(function(E,P){return!!cit[P]?.includes(E)}(A,S.type,x.slice(1)))if(A==="colors"){if(x.length<2)throw new Error("You cannot mutate the colors array, only its items");let E=parseInt(x[1]),P=S.getValue(A)?.[E];if(!P)throw new Error("Color index out of range");cm.setStyle(w),P.set(cm.r,cm.g,cm.b,cm.a)}else S.getValue(A)?.setStyle(w);else if(A==="texture"||A==="video"){let E=S.color;(function(P,T,R,L){let D=P[0];if(D==="repeat"||D==="offset"||D==="rotation"){let U=L.getNode("mat"),V=U&&typeof U.updateMatrix=="function"?U:L.getValue("mat");if(!V)return;if(D==="rotation")V.rotation=parseFloat(T);else{let k=P[1];if(k===void 0)T instanceof Array&&T.length===2&&Object.assign(V,{[D]:T});else{let Y=V[D],$=parseInt(k)===0?[parseFloat(T),Y[1]]:[Y[0],parseFloat(T)];Object.assign(V,{[D]:$})}}V.updateMatrix()}else D==="wrapping"||D==="minFilter"||D==="magFilter"?D==="wrapping"?R.texture.wrap=T:R.texture[D]=T:D==="image"&&P[1]==="data"&&R.texture.image.updateSrc(T)})(x.slice(1),w,E,S)}else{let E=x[1],P=S.getValue(A);P?.isVector3&&E!==void 0||P?.isVector2&&E!==void 0?P.setComponent(parseInt(E),w):S.setValue(A,w)}}catch(E){console.error("Error setting material value",E)}}(f.slice(2),g,_)}else f[0]==="alpha"&&y.layers.forEach(v=>{v.type==="light"&&v.node.alphaOverride!==void 0&&(v.node.alphaOverride.value=g,g<1&&(y.transparent=!0))})}(p.slice(1),d,a),typeof u!="object"&&Object.getOwnPropertyDescriptor(t,h)?.writable&&(t[h]=d),this._requestRenderAutoMode(),t.updateMatrix()});return this._proxyObjectCache.set(t.uuid,c),c}setUIWasmUrl(t){(function(e){q_=e,Xb?.setHanaUIWasmUrl(e)})(t)}pauseGameControls(){this._eventManager?.controlsManager.gameControl?.pause()}resumeGameControls(){this._eventManager?.controlsManager.gameControl?.resume()}async swapGeometry(t,e){let i;if(typeof e=="string"){if(!e.endsWith(".splinegeometry"))throw new Error("Only .splinegeometry format is supported");{let l=await(await fetch(e)).arrayBuffer();i=new Uint8Array(l)}}else i=e;let n=Tg.deserialize(i),r="data"in n&&n.data.draco!==void 0;r&&await mU(this._wasmPath);let s=this._scene?.getObjectByProperty("uuid",t)??this._scene?.getObjectByName(t);if(!s)return void console.warn(`Object ${t} not found`);if(s.data.type!=="Mesh"||!(s instanceof Hr))return void console.warn(`Object ${t} is not a mesh`);let a=s,o={...a.data,geometry:n};r&&await gU([o]),a.updateByOp({type:0,path:[],props:{geometry:o.geometry}},o,{shared:this._sharedAssetsManager,scene:this._scene},!1);for(let l of a.data.states){let c={...l.data};a.states||(a.states={}),a.states[l.id]=Zl.patch(o,c)}return i}_applyDocumentTransaction(t){this._data=t.data,this._scene&&(this._scene.data=this._data.scene),this._sharedAssetsManager&&(this._sharedAssetsManager.data=this._data.shared);for(let e of t.actual){let i=e.path;Array.isArray(i)&&i.length===2&&i[0]==="scene"&&i[1]==="objects"&&this._scene?.updateTreeByOp({...e,path:[]},this._sharedAssetsManager)}}_findEntity(t){return this._scene?.getObjectByProperty("uuid",t)??this._scene?.getObjectByName(t)}_resolveParentId(t){if(t===void 0)return this._scene.activePage.uuid;let e=typeof t=="string"?t:t.uuid,i=this._findEntity(e);if(!i)throw new Error(`parent '${e}' \u2014 no object with that name or uuid in the scene.`);return i.uuid}async createCustomMaterial(t){if(this.disposed)throw new Error("createCustomMaterial: this Application was disposed.");if(typeof t!="function")throw new Error("createCustomMaterial: expected a factory function \u2014 createCustomMaterial((three) => new three.MeshStandardNodeMaterial()).");let e=yk();if(e===void 0&&e===void 0)throw new Error("createCustomMaterial: requires the webgpu backend (the runtime default where WebGPU is available). This Application is on the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } or drop any ?renderer=webgl2 override.");let i=t(e);if(typeof i!="object"||i===null||i.isMaterial!==!0)throw new Error("createCustomMaterial: the factory must return a three.js material built from the namespace it receives \u2014 e.g. (three) => new three.MeshStandardNodeMaterial().");return i}async setMaterial(t,e){if(this.disposed)throw new Error("setMaterial: this Application was disposed.");let i=this._scene;if(!i)throw new Error("setMaterial: no scene loaded \u2014 call load() or start() first.");let n=typeof t=="string"?t:t.uuid,r=this._findEntity(n);if(!r)throw new Error(`setMaterial: '${n}' \u2014 no object with that name or uuid in the scene.`);if(!(r instanceof Hr))throw new Error(`setMaterial: '${n}' is not a mesh \u2014 lights, groups, and cameras have no material.`);let s=typeof e=="function"?await this.createCustomMaterial(e):e;if(eb()!=="webgpu")throw new Error("setMaterial: custom three.js materials require the webgpu backend (the runtime default where WebGPU is available). This scene is running the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } or drop any ?renderer=webgl2 override.");let a=yU({material:s});if(a.material===void 0)throw new Error("setMaterial: expected a three.js material instance or a (three) => material factory.");return r.setMaterialOverride(a.material,{scene:i,shared:this._sharedAssetsManager}),this._proxyObjectCache.delete(r.uuid),this._requestRenderAutoMode(),a.material}async createObject(t,e={}){if(this.disposed)throw new Error("createObject: this Application was disposed.");let i=this._scene,n=this._data;if(!i||!n)throw new Error("createObject: no scene loaded \u2014 call load() or start() first.");let r=function(m){if(typeof m!="string"||m.length===0)throw new Error(`createObject: expected a type name string \u2014 one of ${_U}.`);let y=m.replace(/Geometry$/i,"").replace(/[\s_-]/g,"").toLowerCase(),v=tit[y];if(v)return{objectType:v};let _=Jet[y];if(_)return{objectType:"Mesh",geometryType:_};let b=eit[y];throw b?new Error(`createObject: '${m}' is not supported \u2014 ${b}`):new Error(`createObject: '${m}' is not a creatable Spline type \u2014 use one of ${_U}, e.g. createObject('Cube', { width: 200 }).`)}(t);typeof e.material=="function"&&(e={...e,material:await this.createCustomMaterial(e.material)});let s,a,{options:o,material:l}=yU(e);if(l!==void 0){if(r.objectType!=="Mesh")throw new Error("createObject: a three.js material instance only applies to mesh types \u2014 lights and groups have no material.");if(eb()!=="webgpu")throw new Error("createObject: three.js material instances require the webgpu backend (the runtime default where WebGPU is available). This scene is running the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } to the Application, or drop any ?renderer=webgl2 override.")}if(r.geometryType==="TextGeometry"){if(!DC.has("text"))throw new Error("createObject: this runtime build was compiled without the 'text' feature \u2014 re-export the scene with a Text object present, or load the full runtime build.");if(await Q5(),a=e.font??wu,n.shared.fonts[a]===void 0){if(a!==wu){let m=Object.keys(n.shared.fonts).join(", ");throw new Error(`createObject: font '${a}' is not in this document \u2014 available fonts: ${m||"(none)"}.`)}s={name:wu,url:RF}}}let c=this._resolveParentId(e.parent),h=ait(r,o,n),d=Ot.generateUUID(),[u,p]=Em(n);s&&(u.shared.fonts[wu]=s),u.scene.objects.insertAfter(c,null,[{id:d,data:h,children:[]}]);let f=p.result();if(s&&this._sharedAssetsManager.addFont(wu,s),a!==void 0){let m=this._sharedAssetsManager.getFont(a);m&&await m.loadingPromise}this._applyDocumentTransaction(f);let g=i.find(d);return l!==void 0&&g.setMaterialOverride(l,{scene:i,shared:this._sharedAssetsManager}),this._requestRenderAutoMode(),this._createProxyObject(g)}cloneObject(t,e={}){if(this.disposed)throw new Error("cloneObject: this Application was disposed.");let i=this._scene,n=this._data;if(!i||!n)throw new Error("cloneObject: no scene loaded \u2014 call load() or start() first.");let r=typeof t=="string"?t:t?.uuid,s=r?this._findEntity(r):void 0;if(!s)throw new Error(`cloneObject: '${r}' \u2014 no object with that name or uuid in the scene.`);if(s instanceof dn)throw new Error("cloneObject: pages cannot be cloned.");let a=n.scene.objects.get(s.uuid);if(!a)throw new Error(`cloneObject: '${r}' is not part of the document tree (expanded clones and instanced children cannot be cloned \u2014 clone their source object instead).`);let o=function(p,f,g){let m={...p.data};return f.position!==void 0&&(m.position=Ng(f.position,[0,0,0])),f.rotation!==void 0&&(m.rotation=Ng(f.rotation,[0,0,0])),f.scale!==void 0&&(m.scale=Ej(f.scale)),f.visible!==void 0&&(m.visible=f.visible),m.name=f.name??Aj(`${p.data.name??"Object"} Copy`,g),{...p,data:m}}(oit(a),e,n.scene.objects),l=e.parent!==void 0?this._resolveParentId(e.parent):n.scene.objects.parent(s.uuid)??null,c=e.parent!==void 0?null:s.uuid,[h,d]=Em(n);h.scene.objects.insertAfter(l,c,[o]),this._applyDocumentTransaction(d.result());let u=i.find(o.id);return this._requestRenderAutoMode(),this._createProxyObject(u)}removeObject(t){let e=this._scene,i=this._data;if(this.disposed||!e||!i)return!1;let n=typeof t=="string"?t:t?.uuid,r=n?this._findEntity(n):void 0;if(!r)return!1;if(r instanceof dn)throw new Error("removeObject: pages cannot be removed.");if(r.data.type==="PerspectiveCamera"||r.data.type==="OrthographicCamera")throw new Error("removeObject: cameras cannot be removed.");if(i.scene.objects.get(r.uuid)===void 0)throw new Error(`removeObject: '${n}' is not part of the document tree (expanded clones and instanced children cannot be removed individually).`);let s=[];r.traverseEntity(l=>{s.push(l.uuid)});let[a,o]=Em(i);a.scene.objects.delete(r.uuid),this._applyDocumentTransaction(o.result());for(let l of s){let c=this._proxyObjectCache.get(l);c&&(P2.unsubscribe(c),this._proxyObjectCache.delete(l))}return this._requestRenderAutoMode(),!0}};var yx=window,_x=yx.ShadowRoot&&(yx.ShadyCSS===void 0||yx.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,k3=Symbol(),Pj=new WeakMap,i0=class{constructor(e,i,n){if(this._$cssResult$=!0,n!==k3)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=i}get styleSheet(){let e=this.o,i=this.t;if(_x&&e===void 0){let n=i!==void 0&&i.length===1;n&&(e=Pj.get(i)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Pj.set(i,e))}return e}toString(){return this.cssText}},Dj=t=>new i0(typeof t=="string"?t:t+"",void 0,k3),V3=(t,...e)=>{let i=t.length===1?t[0]:e.reduce((n,r,s)=>n+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+t[s+1],t[0]);return new i0(i,t,k3)},j3=(t,e)=>{_x?t.adoptedStyleSheets=e.map(i=>i instanceof CSSStyleSheet?i:i.styleSheet):e.forEach(i=>{let n=document.createElement("style"),r=yx.litNonce;r!==void 0&&n.setAttribute("nonce",r),n.textContent=i.cssText,t.appendChild(n)})},bx=_x?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let i="";for(let n of e.cssRules)i+=n.cssText;return Dj(i)})(t):t;var G3,xx=window,Rj=xx.trustedTypes,uit=Rj?Rj.emptyScript:"",Ij=xx.reactiveElementPolyfillSupport,W3={toAttribute(t,e){switch(e){case Boolean:t=t?uit:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=t!==null;break;case Number:i=t===null?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch{i=null}}return i}},Oj=(t,e)=>e!==t&&(e==e||t==t),H3={attribute:!0,type:String,converter:W3,reflect:!1,hasChanged:Oj},q3="finalized",cl=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var i;this.finalize(),((i=this.h)!==null&&i!==void 0?i:this.h=[]).push(e)}static get observedAttributes(){this.finalize();let e=[];return this.elementProperties.forEach((i,n)=>{let r=this._$Ep(n,i);r!==void 0&&(this._$Ev.set(r,n),e.push(r))}),e}static createProperty(e,i=H3){if(i.state&&(i.attribute=!1),this.finalize(),this.elementProperties.set(e,i),!i.noAccessor&&!this.prototype.hasOwnProperty(e)){let n=typeof e=="symbol"?Symbol():"__"+e,r=this.getPropertyDescriptor(e,n,i);r!==void 0&&Object.defineProperty(this.prototype,e,r)}}static getPropertyDescriptor(e,i,n){return{get(){return this[i]},set(r){let s=this[e];this[i]=r,this.requestUpdate(e,s,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||H3}static finalize(){if(this.hasOwnProperty(q3))return!1;this[q3]=!0;let e=Object.getPrototypeOf(this);if(e.finalize(),e.h!==void 0&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){let i=this.properties,n=[...Object.getOwnPropertyNames(i),...Object.getOwnPropertySymbols(i)];for(let r of n)this.createProperty(r,i[r])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){let i=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let r of n)i.unshift(bx(r))}else e!==void 0&&i.push(bx(e));return i}static _$Ep(e,i){let n=i.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise(i=>this.enableUpdating=i),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(e=this.constructor.h)===null||e===void 0||e.forEach(i=>i(this))}addController(e){var i,n;((i=this._$ES)!==null&&i!==void 0?i:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((n=e.hostConnected)===null||n===void 0||n.call(e))}removeController(e){var i;(i=this._$ES)===null||i===void 0||i.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((e,i)=>{this.hasOwnProperty(i)&&(this._$Ei.set(i,this[i]),delete this[i])})}createRenderRoot(){var e;let i=(e=this.shadowRoot)!==null&&e!==void 0?e:this.attachShadow(this.constructor.shadowRootOptions);return j3(i,this.constructor.elementStyles),i}connectedCallback(){var e;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)===null||e===void 0||e.forEach(i=>{var n;return(n=i.hostConnected)===null||n===void 0?void 0:n.call(i)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(i=>{var n;return(n=i.hostDisconnected)===null||n===void 0?void 0:n.call(i)})}attributeChangedCallback(e,i,n){this._$AK(e,n)}_$EO(e,i,n=H3){var r;let s=this.constructor._$Ep(e,n);if(s!==void 0&&n.reflect===!0){let a=(((r=n.converter)===null||r===void 0?void 0:r.toAttribute)!==void 0?n.converter:W3).toAttribute(i,n.type);this._$El=e,a==null?this.removeAttribute(s):this.setAttribute(s,a),this._$El=null}}_$AK(e,i){var n;let r=this.constructor,s=r._$Ev.get(e);if(s!==void 0&&this._$El!==s){let a=r.getPropertyOptions(s),o=typeof a.converter=="function"?{fromAttribute:a.converter}:((n=a.converter)===null||n===void 0?void 0:n.fromAttribute)!==void 0?a.converter:W3;this._$El=s,this[s]=o.fromAttribute(i,a.type),this._$El=null}}requestUpdate(e,i,n){let r=!0;e!==void 0&&(((n=n||this.constructor.getPropertyOptions(e)).hasChanged||Oj)(this[e],i)?(this._$AL.has(e)||this._$AL.set(e,i),n.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,n))):r=!1),!this.isUpdatePending&&r&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(i){Promise.reject(i)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((r,s)=>this[s]=r),this._$Ei=void 0);let i=!1,n=this._$AL;try{i=this.shouldUpdate(n),i?(this.willUpdate(n),(e=this._$ES)===null||e===void 0||e.forEach(r=>{var s;return(s=r.hostUpdate)===null||s===void 0?void 0:s.call(r)}),this.update(n)):this._$Ek()}catch(r){throw i=!1,this._$Ek(),r}i&&this._$AE(n)}willUpdate(e){}_$AE(e){var i;(i=this._$ES)===null||i===void 0||i.forEach(n=>{var r;return(r=n.hostUpdated)===null||r===void 0?void 0:r.call(n)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){this._$EC!==void 0&&(this._$EC.forEach((i,n)=>this._$EO(n,this[n],i)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}};cl[q3]=!0,cl.elementProperties=new Map,cl.elementStyles=[],cl.shadowRootOptions={mode:"open"},Ij?.({ReactiveElement:cl}),((G3=xx.reactiveElementVersions)!==null&&G3!==void 0?G3:xx.reactiveElementVersions=[]).push("1.6.3");var X3,wx=window,Rp=wx.trustedTypes,Lj=Rp?Rp.createPolicy("lit-html",{createHTML:t=>t}):void 0,Y3="$lit$",Mh=`lit$${(Math.random()+"").slice(9)}$`,Vj="?"+Mh,pit=`<${Vj}>`,id=document,r0=()=>id.createComment(""),s0=t=>t===null||typeof t!="object"&&typeof t!="function",jj=Array.isArray,fit=t=>jj(t)||typeof t?.[Symbol.iterator]=="function",$3=`[
|
|
9934
|
+
`,Sj=class{constructor(t,e,i,n,r){this.container=t,this.host=e,this.observer=i,this.previousSplineGlobal=n,this.removeLateLifecycleShim=r}static mount(t,e,i,n){if(typeof document>"u")return null;let r=e.parentElement;if(!r)return null;getComputedStyle(r).position==="static"&&(r.style.position="relative");let s=document.createElement("div");s.setAttribute(P1,"");let a=s.style;a.position="absolute",a.overflow="hidden";let o=()=>{a.left=`${e.offsetLeft}px`,a.top=`${e.offsetTop}px`,a.width=`${e.offsetWidth}px`,a.height=`${e.offsetHeight}px`};o();let l=new ResizeObserver(o);l.observe(e),l.observe(r);let c=document.createElement("style");c.textContent=Ket,s.appendChild(c);let h=new DOMParser().parseFromString(i,"text/html"),d=Array.from(h.querySelectorAll("script"));for(let v of d)v.remove();for(let v of Array.from(h.head.children))(v.tagName==="STYLE"||v.tagName==="LINK"&&v.rel==="stylesheet")&&s.appendChild(v);for(;h.body.firstChild;)s.appendChild(h.body.firstChild);r.insertBefore(s,e.nextSibling);let u=new Map,p=new lC(xj(t,e,n),(v,_)=>{v==="warn"?console.warn(`[spline html] ${_}`):v==="error"&&console.error(`[spline html] ${_}`)},(v,_)=>{let b=u.get(v);if(b)for(let x of b)try{x(_)}catch(w){console.error(w)}}),f=(v,_)=>{try{return Promise.resolve(p.execute(v,_))}catch(b){return Promise.reject(b)}},g={ready:Promise.resolve(),setVariable:(v,_)=>f("setVariable",[v,_]),setVariables:v=>f("setVariables",[v]),getVariable:v=>f("getVariable",[v]),getVariables:()=>f("getVariables",[]),getAllObjects:()=>f("getAllObjects",[]),findObjectByName:v=>f("findObjectByName",[v]),findObjectById:v=>f("findObjectById",[v]),getGeometry:(v,_)=>f("getGeometry",[v,_??{}]),updateObject:(v,_)=>f("updateObject",[v,_]),createObject:(v,_)=>f("createObject",[v,_??{}]),createCustomMaterial:v=>f("createCustomMaterial",[v]),setMaterial:(v,_)=>f("setMaterial",[v,_]),cloneObject:(v,_)=>f("cloneObject",[v,_??{}]),removeObject:v=>f("removeObject",[v]),spawnObject:(v,_)=>f("spawnObject",[v,_??{}]),destroyObject:v=>f("destroyObject",[v]),setInstanceTransforms:(v,_)=>f("setInstanceTransforms",[v,_??null]),emitEvent:(v,_)=>f("emitEvent",[v,_]),emitEventReverse:(v,_)=>f("emitEventReverse",[v,_]),requestRender:()=>f("requestRender",[]),addEventListener:(v,_)=>{if(typeof _!="function")return;let b=u.get(v);b||(b=new Set,u.set(v,b),f("listenEvent",[v])),b.add(_)},removeEventListener:(v,_)=>{let b=u.get(v);!b||(b.delete(_),b.size===0&&(u.delete(v),f("unlistenEvent",[v])))}},m=window.spline;window.spline=g;let y=function(){if(typeof document>"u"||document.readyState==="loading")return()=>{};let v=[],_=(x,w)=>{let S=new Set,A=x.addEventListener.bind(x),E=x.removeEventListener.bind(x);Object.defineProperty(x,"addEventListener",{configurable:!0,writable:!0,value:(P,T,R)=>{if(A(P,T,R),!w.includes(P)||T==null)return;let L={type:P,listener:T};S.add(L),queueMicrotask(()=>{!S.delete(L)||((D,U,V)=>{let k=new Event(V);try{typeof U=="function"?U.call(D,k):U.handleEvent?.(k)}catch(Y){console.error(Y)}})(x,L.listener,L.type)})}}),Object.defineProperty(x,"removeEventListener",{configurable:!0,writable:!0,value:(P,T,R)=>{E(P,T,R);for(let L of S)L.type===P&&L.listener===T&&S.delete(L)}}),v.push(()=>{delete x.addEventListener,delete x.removeEventListener,S.clear()})};_(document,["DOMContentLoaded"]),_(window,["load"]);let b=Object.getOwnPropertyDescriptor(window,"onload");return Object.defineProperty(window,"onload",{configurable:!0,get:()=>null,set:x=>{typeof x=="function"&&queueMicrotask(()=>{try{x.call(window,new Event("load"))}catch(w){console.error(w)}})}}),v.push(()=>{b?Object.defineProperty(window,"onload",b):delete window.onload}),()=>{for(let x of v)x()}}();for(let v of d){let _=document.createElement("script");for(let b of Array.from(v.attributes))_.setAttribute(b.name,b.value);v.src?_.async=!1:_.textContent=v.textContent,s.appendChild(_)}return new Sj(s,p,l,m,y)}dispose(){this.removeLateLifecycleShim(),this.host.dispose(),this.observer.disconnect(),this.container.remove(),window.spline!==void 0&&(window.spline=this.previousSplineGlobal)}};function Mj(t){return typeof t=="object"&&t!==null&&t.isMaterial===!0}function yU(t){if(typeof t.material=="function")throw new Error("createObject: a (three) => material factory must be resolved to a material instance before object creation \u2014 this entry point does not support it.");if(!Mj(t.material))return{options:t};let e=t.material;if(e.isNodeMaterial===!0){let i=yk()?.NodeMaterial;if(i!==void 0&&e instanceof i)return{options:{...t,material:void 0},material:e};throw new Error("createObject: this TSL NodeMaterial comes from your own three/webgpu module instance, which cannot compile in the runtime's bundled three. Build it with app.createCustomMaterial((three) => \u2026) instead, or use a built-in material (MeshStandardMaterial, MeshBasicMaterial, \u2026).")}if(e.isShaderMaterial===!0)throw new Error("createObject: a GLSL ShaderMaterial cannot compile on the WebGPU backend \u2014 port the shader to TSL with app.createCustomMaterial((three) => \u2026), or use a built-in material (MeshStandardMaterial, \u2026).");return{options:{...t,material:void 0},material:e}}Yt(),Ye(),et(),fk(),ya(),Ye(),Yt(),zX(),bh();var Qet=new Set(["name","parent","position","rotation","scale","visible","castShadow","receiveShadow","color","material"]),_U="'Cube', 'Sphere', 'Plane', 'Rectangle', 'Ellipse', 'Triangle', 'Polygon', 'Star', 'Cone', 'Cylinder', 'Pyramid', 'Torus', 'TorusKnot', 'Dodecahedron', 'Icosahedron', 'Helix', 'Backdrop', 'Lathe', 'Text', 'CustomMesh', 'Group', 'PointLight', 'SpotLight', 'DirectionalLight'",Jet={cube:"CubeGeometry",box:"CubeGeometry",sphere:"SphereGeometry",plane:"PlaneGeometry",rectangle:"RectangleGeometry",ellipse:"EllipseGeometry",circle:"EllipseGeometry",triangle:"TriangleGeometry",polygon:"PolygonGeometry",star:"StarGeometry",cone:"ConeGeometry",cylinder:"CylinderGeometry",pyramid:"PyramidGeometry",torus:"TorusGeometry",torusknot:"TorusKnotGeometry",dodecahedron:"DodecahedronGeometry",icosahedron:"IcosahedronGeometry",helix:"HelixGeometry",backdrop:"BackdropGeometry",lathe:"LatheGeometry",text:"TextGeometry",custommesh:"NonParametricGeometry",nonparametric:"NonParametricGeometry"},tit={group:"Empty",empty:"Empty",pointlight:"PointLight",spotlight:"SpotLight",directionallight:"DirectionalLight"},eit={shapeblend:"Shape Blends are built from member meshes in the editor and cannot be created empty.",path:"Path shapes need authored path data \u2014 clone an existing one with cloneObject() instead.",vector:"Vector shapes need authored shape data \u2014 clone an existing one with cloneObject() instead.",shape:"Vector shapes need authored shape data \u2014 clone an existing one with cloneObject() instead.",boolean:"Boolean operations are not creatable at runtime \u2014 clone an existing Boolean object with cloneObject() instead.",decal:"Decals need a surface to project onto \u2014 clone an existing Decal with cloneObject() instead.",ui:"UI objects need a 2D frame \u2014 clone an existing one with cloneObject() instead.",input:"Text inputs are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",particle:"Particle emitters are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",particlecollider:"Particle forces are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",hair:"Hair systems are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",camera:"Cameras are not creatable at runtime.",perspectivecamera:"Cameras are not creatable at runtime.",orthographiccamera:"Cameras are not creatable at runtime.",hemispherelight:"Hemisphere lights are not creatable at runtime.",splat:"Splats are not creatable at runtime.",page:"Pages are not creatable at runtime.",component:"Components are authored in the editor.",instance:"Instances are authored in the editor \u2014 clone an existing one with cloneObject() instead.",bone:"Bones are not creatable at runtime.",mesh:"pass the shape name directly, e.g. createObject('Cube')."},iit={CubeGeometry:"Cube",SphereGeometry:"Sphere",PlaneGeometry:"Plane",RectangleGeometry:"Rectangle",EllipseGeometry:"Ellipse",TriangleGeometry:"Triangle",PolygonGeometry:"Pentagon",StarGeometry:"Star",ConeGeometry:"Cone",CylinderGeometry:"Cylinder",PyramidGeometry:"Pyramid",TorusGeometry:"Torus",TorusKnotGeometry:"Torus Knot",DodecahedronGeometry:"Dodecahedron",IcosahedronGeometry:"Icosahedron",HelixGeometry:"Helix",BackdropGeometry:"Backdrop",LatheGeometry:"Lathe",TextGeometry:"Text",NonParametricGeometry:"Custom Mesh"},nit={Empty:"Group",PointLight:"Point Light",SpotLight:"Spot Light",DirectionalLight:"Directional Light"};function Ng(t,e){return t===void 0?[e[0],e[1],e[2]]:Array.isArray(t)?[t[0]??e[0],t[1]??e[1],t[2]??e[2]]:[t.x??e[0],t.y??e[1],t.z??e[2]]}function Ej(t){return typeof t=="number"?[t,t,t]:Ng(t,[1,1,1])}function HT(t){let e=new mn(0,0,0,1);return e.setStyle(t),{r:e.r,g:e.g,b:e.b}}function bU(t,e){let i=t.material??(t.color!==void 0?{color:t.color}:void 0);if(i===void 0)return ki.defaultColorMaterial(xU(Rr),"physical","layer1","layer2");if(typeof i=="string"){for(let[a,o]of Object.entries(e.shared.materials))if(a===i||o.name===i)return a;if(function(a){let o=a.trim().toLowerCase();return/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(o)||/^(rgb|hsl)a?\(/.test(o)||Jt.NAMES[o]!==void 0}(i))return ki.defaultColorMaterial(HT(i),"physical","layer1","layer2");throw new Error(`createObject: material '${i}' matches no shared material in this document (available: ${function(a){let o=Object.entries(a.shared.materials).map(([,l])=>`'${l.name}'`).filter(l=>l!=="'undefined'");return o.length?o.join(", "):"(none)"}(e)}) and is not a valid CSS color.`)}if(typeof i=="function")throw new Error("createObject: a (three) => material factory must be resolved to a material instance before object creation \u2014 this entry point does not support it.");if(Mj(i))throw new Error("createObject: a three.js material instance cannot be stored in the document \u2014 this entry point does not support it.");let n=i.color!==void 0?HT(i.color):xU(Rr),r=ki.defaultColorMaterial(n,"physical","layer1","layer2"),s=r.layers.find(a=>a.data.type==="light");if(s){let a={};i.roughness!==void 0&&(a.roughness=i.roughness),i.metalness!==void 0&&(a.metalness=i.metalness),i.reflectivity!==void 0&&(a.reflectivity=i.reflectivity),Object.assign(s.data,a)}if(i.alpha!==void 0){let a=r.layers.find(o=>o.data.type==="color");a&&Object.assign(a.data,{alpha:i.alpha})}return r}function xU(t){return{r:(t>>16&255)/255,g:(t>>8&255)/255,b:(255&t)/255}}function rit(t){let e=Ho.defaultData("TextGeometry"),{text:i,...n}=t,r=n.fontSize;return r!==void 0&&n.width===void 0&&(n.width=350*r/16),r!==void 0&&n.height===void 0&&(n.height=50*r/16),Object.assign(e,n),i!==void 0&&Object.assign(e,{text:{textValue:String(i)}}),e}function Fy(t){return Array.isArray(t)?t:!ArrayBuffer.isView(t)||t instanceof DataView?null:Array.from(t)}function sit(t,e){return iN({userData:{type:t,...IA[t].normalizeInputs({parameters:e})}})}function ait(t,e,i){let{objectType:n,geometryType:r}=t,s=function(l){let c={};for(let[h,d]of Object.entries(l))!Qet.has(h)&&d!==void 0&&(c[h]=d);return c}(e),a={states:new Vt,events:new Vt};if(n==="Mesh"&&r){if(r==="NonParametricGeometry"){let{geometry:l,doubleSide:c}=function(h){let d=Fy(h.vertices);if(!d||d.length<9||d.length%3!=0)throw new Error("createObject('CustomMesh'): `vertices` must be a flat number[] of x,y,z triples (length a multiple of 3, at least one triangle).");let u=d.length/3;if(u>6e4)throw new Error(`createObject('CustomMesh'): too many vertices (${u}); keep it under 60000.`);let p=Fy(h.indices);if(p&&p.length){let _=p.find(b=>!Number.isInteger(b)||b<0||b>=u);if(_!==void 0)throw new Error(`createObject('CustomMesh'): index ${_} is out of range (mesh has ${u} vertices).`)}else p=null;let f=new Gt;f.setAttribute("position",new Nt(d,3));let g=Fy(h.normals),m=g!==null&&g.length===d.length;m&&f.setAttribute("normal",new Nt(g,3));let y=Fy(h.uvs);y&&y.length===2*u&&f.setAttribute("uv",new Nt(y,2));let v=!1;if(!m){let _=p??Array.from({length:u},(w,S)=>S),{closed:b,inverted:x}=function(w,S){let A=w.length/3,E=new Map,P=new Array(A);for(let D=0;D<A;D++){let U=`${Math.round(1e4*w[3*D])},${Math.round(1e4*w[3*D+1])},${Math.round(1e4*w[3*D+2])}`,V=E.get(U);V===void 0?(E.set(U,D),P[D]=D):P[D]=V}let T=new Map;for(let D=0;D+2<S.length;D+=3){let U=P[S[D]],V=P[S[D+1]],k=P[S[D+2]];for(let[Y,$]of[[U,V],[V,k],[k,U]]){if(Y===$)continue;let nt=Y<$?Y+"_"+$:$+"_"+Y;T.set(nt,(T.get(nt)??0)+1)}}let R=T.size>0;for(let D of T.values())if(D!==2){R=!1;break}if(!R)return{closed:!1,inverted:!1};let L=0;for(let D=0;D+2<S.length;D+=3){let U=3*S[D],V=3*S[D+1],k=3*S[D+2],Y=w[U],$=w[U+1],nt=w[U+2],Q=w[V],rt=w[V+1],gt=w[V+2],at=w[k],ht=w[k+1],ct=w[k+2];L+=Y*(rt*ct-gt*ht)+$*(gt*at-Q*ct)+nt*(Q*ht-rt*at)}return{closed:!0,inverted:L<0}}(d,_);if(b&&x){for(let w=0;w+2<_.length;w+=3){let S=_[w+1];_[w+1]=_[w+2],_[w+2]=S}p=_}else b||(v=!0)}return p&&f.setIndex(p),m||f.computeVertexNormals(),{geometry:iN({userData:{type:"NonParametricGeometry",parameters:{subdivisions:0}},data:f.toJSON().data}),doubleSide:v}}(s);Object.assign(a,Ha.defaultData,{geometry:l,materials:[bU(e,i)]}),c&&(a.side=2)}else Object.assign(a,Ha.defaultData,{geometry:r==="TextGeometry"?rit(s):sit(r,s),material:bU(e,i)});e.castShadow!==void 0&&(a.castShadow=e.castShadow),e.receiveShadow!==void 0&&(a.receiveShadow=e.receiveShadow)}else n==="Empty"?Object.assign(a,z_.defaultData):(Object.assign(a,F_.defaultData(n),s),e.color!==void 0&&(a.color=HT(e.color)));a.visible=e.visible??!0,a.position=Ng(e.position,[0,0,0]),a.rotation=Ng(e.rotation,[0,0,0]),a.scale=Ej(e.scale);let o=(r&&iit[r])??nit[n]??n;return a.name=e.name??Aj(o,i.scene.objects),a}function Aj(t,e){let i=new Set;if(e.traverse((r,s)=>{i.add(s.name??"")}),!i.has(t))return t;let n=2;for(;i.has(`${t} ${n}`);)n++;return`${t} ${n}`}function Tj(t,e){let i=Ot.generateUUID();if(t.data.type==="Component")return{data:{...Qo.fromComponentData(t),name:t.data.name+" Instance"},id:i,fi:t.fi,children:[]};e[t.id]=i;let n=t.data;return n.type==="Empty"&&n.animations?.length&&(n={...n,animations:n.animations.map(([r,s,a])=>{let o=Ot.generateUUID(),l=a.indexOf(r);return[o,s,l!==-1?a.slice(0,l)+o+a.slice(l+r.length):a]})}),{...t,id:i,data:n,children:t.children.map(r=>Tj(r,e))}}function oit(t){let e={};return function(i,n){return Gu(i,n,null)??i}(Tj(t,e),e)}function lit(t){let e=Array.isArray(t)?t[0]:t,i=e.layers?.map(hit)??[],n=e.layers?.find(r=>r.type==="light");return{layers:i,alpha:n?.node.alphaOverride?.value??1}}function hit(t){return t.type==="texture"||t.type==="video"||t.type==="matcap"?{...t.data,updateTexture:e=>t.color.texture.image.updateSrc(e)}:{...t.data}}bh(),Li(),kC(),ya();var cm=new mn(0,0,0,1),cit={color:["color"],cavity:[],dust:["color"],fresnel:["color"],normal:[],gradient:["colors"],depth:["colors"],texture:[],video:[],noise:["colorA","colorB","colorC","colorD"],toon:["colors","shadowColor"],outline:["outlineColor","contourColor"],transmission:["attenuationColor"],reflection:[],matcap:[],pattern:["colorA","colorB"],vertexColor:[],light:[],displace:[],rainbow:[],particle:[]};Yt(),Yt();var dit=new it;function wU(t){let e=new mn(0,0,0,1);try{e.setStyle(t)}catch(i){console.error(i)}return e}var Cj=class{constructor(t,{renderOnDemand:e,renderMode:i="auto",wasmPath:n,renderer:r,htmlContentMode:s="sandbox"}={}){if(this._rendererBackend="webgl",this._rendererAuto=!1,this._rendererConfigured=!1,this._viewportMode=1,this._viewportWidth=window.innerWidth,this._viewportHeight=window.innerHeight,this._proxyObjectCache=new Map,this._htmlContentMode="sandbox",this._variablesCache=new Map,this._isPaused=!1,this._renderRequested=!1,this._skipRender=!1,this.time=performance.now(),this.dt=0,this.currentTAAFrame=0,this.disposed=!1,this._requestRenderAutoMode=()=>{this._skipRender=!1},this.requestRender=()=>{this._renderRequested=!0},this.render=a=>{if(this.time=a,this._lastTime&&(this.dt=this.time-this._lastTime),this._lastTime=this.time,this._perfs?.start(),this._renderer)if(this._isPaused||!(this.renderMode==="manual"&&!this._renderRequested||this.renderMode==="auto"&&this._skipRender)){if(this._renderRequested=!1,this._skipRender=!0,this._controls&&(this._skipRender=this._controls.update(this.dt)??!1),this._eventManager&&(this._eventManager.handlers?.Start?.hasVideoAction||this._eventManager.handlers?.Basic?.hasVideoAction||this._eventManager.handlers?.Conditional?.hasVideoAction)&&(this._skipRender=!1),this._animationControls?.update(this.dt),this._skipRender?(this.currentTAAFrame++,this.currentTAAFrame<rN?this._skipRender=!1:this.currentTAAFrame=0):this.currentTAAFrame=0,this._scene?.traverseVisibleEntity(o=>{o.type==="ParticleSystem"&&(o.update(this.dt),this._skipRender=!1),Gc(o)&&(this._renderer?.isWebGPUSplineRenderer!==!0&&o.warnClassicFallbackOnce(),o.isSimulating&&(o.update(this.dt),this._skipRender=!1))}),this._scene&&this._scene.activeCamera!==this._camera&&(this._camera=this._scene.activeCamera),this._eventManager?.isEnabled&&(this._eventManager.handlers?.Follow?.onAnimationFrameDamping(),this._eventManager.handlers?.LookAt?.onAnimationFrameDamping(),this._eventManager.handlers?.DragDrop?.onAnimationFrameDamping()),this._scene&&this._camera){if(this._scene.pathConstraints.applyConstraints(this._scene),this._renderer.sceneTransitionTimeRemaining>0){this._renderer.sceneTransitionTimeRemaining-=this.dt;let o=Math.min(1,1-this._renderer.sceneTransitionTimeRemaining/this._renderer.sceneTransitionDuration);this._renderer.pipeline.sceneTransitionPass.uniforms.mixRatio.value=o,this._skipRender=!1}else this._renderer.pipeline.sceneTransitionFromTexture=null;this._renderer.renderSplineScene(this._scene,this._camera),this._renderer.lastFrameIncomplete===!0&&(this._skipRender=!1),this._renderer.skyAnimationActive===!0&&(this._skipRender=!1)}this.canvas.dispatchEvent(this._renderedEvent),this._perfs?.end()}else this._perfs?.end();else this._perfs?.end()},this._resize=a=>{if(this._renderer){if(this._viewportMode===1&&this._frameView&&(this._frameView.frameSize=dit.set(this._viewportWidth,this._viewportHeight)),a){let o=this._viewportWidth,l=this._viewportHeight;this._renderer.setSize(o-1,l-1,!1),this._renderer.setSize(o,l,!1)}else this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1);this._camera=this._scene?.activeCamera,this._scene?.updateViewPlaneSize(this._frameView?.frameSize?.x??this._viewportWidth,this._frameView?.frameSize?.y??this._viewportHeight,this._frameView?.enableResponsive??!1),this._camera&&(this._frameView?.setCamera(this._camera),this._frameView?.updateCamera(),this._camera.cameraType==="PerspectiveCamera"&&(this._camera.aspect=this._viewportWidth/this._viewportHeight),this._camera.updateProjectionMatrix()),this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect()),this._requestRenderAutoMode()}},this._debouncedResize=Ag(this._resize,10),this._onScroll=a=>{this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect())},this.canvas=t,this._htmlContentMode=s,this.renderMode=e?"auto":i,n!==void 0&&(this._wasmPath=function(a){let o=a.length;for(;o>0&&"/".includes(a[o-1]);)o--;return a.slice(0,o)}(n)),this._rendererBackend=r??"webgl",r===void 0){let a=null;try{a=new URLSearchParams(window.location.search).get("renderer")}catch{}a==="webgpu"||a==="webgl"||a==="webgl2"?this._rendererBackend=a==="webgl2"?"webgl":a:(this._rendererAuto=!0,this._rendererBackend="webgl")}this._renderedEvent=new CustomEvent("rendered",{bubbles:!0}),Object.defineProperty(this._renderedEvent,"target",{writable:!1,value:this}),window.location.search.includes("perfs")&&Promise.resolve().then(()=>(AY(),_6)).then(({Perfs:a})=>{this._perfs=new a({x:10,y:10})}),function(a){a.addEventListener("pointerdown",IR,!0),a.addEventListener("pointerdown",tv,!0),a.addEventListener("pointermove",tv,!0),a.addEventListener("pointerup",Pd,!0),a.addEventListener("pointercancel",Pd,!0),a.addEventListener("pointerleave",Pd,!0),window.addEventListener("keydown",OR,!0),window.addEventListener("keyup",LR,!0)}(t)}async _createRenderer(){this._rendererBackend,this._rendererBackend;{let{SplineRenderer:t,rendererGlobals:e}=await Promise.resolve().then(()=>($L(),uT));try{new URLSearchParams(window.location.search).get("taa")==="off"&&(e.taaEnabled.value=!1)}catch{}return new t({canvas:this.canvas,antialias:!1,alpha:!0,stencil:!1,depth:!1,powerPreference:"high-performance"})}}_failWebGPURequired(){console.error('[spline] This scene was exported for WebGPU only and this browser does not provide a WebGPU adapter. Re-export with renderer "Both" or "WebGL 2" to support this browser.');try{let t=window.devicePixelRatio||1,e=this.canvas.clientWidth||300,i=this.canvas.clientHeight||150;this.canvas.width=e*t,this.canvas.height=i*t;let n=this.canvas.getContext("2d");n&&(n.scale(t,t),n.fillStyle="rgba(127, 127, 127, 0.85)",n.font="13px system-ui, -apple-system, Segoe UI, Roboto, sans-serif",n.textAlign="center",n.textBaseline="middle",n.fillText("This scene requires a WebGPU-capable browser.",e/2,i/2))}catch{}this.canvas.dispatchEvent(new CustomEvent("splineerror",{bubbles:!0,detail:{reason:"webgpu-required"}}))}async load(t,e,i){(function(r){let s="The Spline Runtime only accepts .splinecode files that are generated from Spline export panel.";r.endsWith(".spline")?console.warn(s+" The .spline files are only meant to be used by the Editor."):r.endsWith(".splinecode")||console.warn(s)})(t),this.disposed=!1;let n=await(await fetch(t,i)).arrayBuffer();await this.start(n,{variables:e})}async start(t,{interactive:e=!0,variables:i}={}){if(this.disposed)return;er.init();let n=await async function(u){let[p,f]=Em(Tg.deserialize(new Uint8Array(u)));if((p.schema??0)!==131){let{updateDocumentSchema:g}=await Promise.resolve().then(()=>(Hb(),YF));g(p)}return f.result().data}(t);this._data=n;let r=function(u){let p=[];return u.scene.objects.traverse((f,g)=>{g.type==="Mesh"&&g.geometry.type==="NonParametricGeometry"&&g.geometry.data.draco!==void 0&&p.push(g)}),p}(n);n.version&&(0,Yet.default)(n.version,"2.0.32")>0&&console.warn("Your .splinecode file is more recent than the library. Please upgrade @splinetool/runtime to the latest version."),this._wasmPath!==void 0&&(this.setUIWasmUrl(`${this._wasmPath}/hana-ui.wasm`),function(u){JA=u}(this._wasmPath));let s=async function(){}();await Promise.all([s,r.length&&mU(this._wasmPath),B4(n)&&GX(this._wasmPath),C$(n)&&b$(this._wasmPath),jc.physicsEnabled(n.scene.objects)&&iJ(this._wasmPath),jO(n)&&Q5(),H4(n)&&$$(),JX(n)&&QX(),H5(n)&&s.then(()=>lA()?.loadHanaUIRUNTIME()),YQ(n)&&yJ(this._wasmPath)].filter(Boolean)),r.length&&await gU(r),this._eventManager?.deactivate(),this._controls?.deactivate(),this._scene?.dispose();let a=n.scene.publish.renderer;if(this._rendererAuto&&a==="webgl")this._rendererBackend="webgl";else if(this._rendererAuto&&a==="webgpu")return void this._failWebGPURequired();let o=function(u){let p=new Set;return u.scene.objects.traverse((f,g)=>{if(g.type!=="Page")return;let m=g.postprocessing;if(m&&typeof m=="object"&&m.enabled===!0)for(let[y,v]of Object.entries(m))y!=="enabled"&&v&&typeof v=="object"&&v.enabled===!0&&p.add(y)}),[...p]}(n);this._rendererBackend,this._rendererBackend!=="webgpu"&&await Promise.all([Promise.resolve().then(()=>($L(),uT)),$et(o)]),function(u){ix=u}((this._rendererBackend,"webgl"));let l=new Get(n);if(l.resetPersonalCameraFromDocumentData(),this._scene=l.scene,this._sharedAssetsManager=l.sharedAssets,this._camera=this._scene.activeCamera,window.location.search.includes("merge-geometries")){let{mergeStaticGeometries:u}=await Promise.resolve().then(()=>(oK(),eV)),p=performance.now();u(n,l.scene);let f=performance.now();console.log("Merged geometries in ",f-p," ms")}B4(n)&&this._scene.traverse(u=>{to(u)&&u.recomputeBoolean()}),this._sharedAssetsManager.setRequestRender(()=>{this._requestRenderAutoMode(),this._scene?.traverse(u=>{Lu(u)&&u.pendingMediaLoad&&u.update({scene:this._scene,shared:this._sharedAssetsManager})})}),this._scene?.traverse(u=>{u.type==="ParticleSystem"&&(u.wakeUp(),u.data.autoPlay?u.start():u.stop()),Gc(u)&&u.setPlayMode(!0)});let c=Object.keys(n.shared.fonts).flatMap(u=>{let p=this._sharedAssetsManager.getFont(u);return p?[p.loadingPromise]:[]});if(Promise.all(c).then(()=>{this.disposed||(l.scene.markNeedsUpdateRendererDirty(),this._requestRenderAutoMode())}),jO(n)&&function(u){if(jc.physicsEnabled(u.scene.objects))return!0;let p=!1;return u.scene.objects.traverse((f,g)=>{if(g.events){if(Array.isArray(g.events)){for(let m of g.events)if(m.data.disabled!==!0&&m.data.type==="GameControl"&&m.data.collisionEnabled){p=!0;break}}else for(let m of Object.values(g.events))if(m.disabled!==!0&&m.type==="GameControl"&&m.collisionEnabled){p=!0;break}}}),p}(n)&&await Promise.all(c),H5(n)){let u=[];this._scene.traverseEntity(p=>{(Cr(p)||p instanceof dn)&&p.uiCanvas&&u.push(p.uiCanvas)}),await Promise.all(u.map(p=>p.promise))}if(this._scene.rewriteEventsBeforeGoToPlayMode(),N3(this._scene.activePage,this._sharedAssetsManager),this._renderer||(this._renderer=await this._createRenderer()),!this._rendererConfigured){this._rendererConfigured=!0,this._renderer.hdTransmission=n.scene.publish.hdTransmission===!0;let u=()=>/Mobi|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),p=this._getPixelRatio(u()?n.scene.publish.settings.web.pixelRatioMobile:n.scene.publish.settings.web.pixelRatioDesktop);if(this._renderer.setPixelRatio(p),this._renderer.pipeline.enableUIOverlay(),this._renderer.pipeline.addEventListener("smaaloaded",this._requestRenderAutoMode),n.shared.images.SplineWatermark){let f=this._sharedAssetsManager.getImage("SplineWatermark");await f.loadPromise;let g=f.getTexture(1001);this._renderer.pipeline.setWatermark(g)}}H4(n)&&this._scene.initializeSplatViewer(),n.scene.blueNoiseTextureData!==void 0&&this._renderer.pipeline.updateBlueNoiseTexture(n.scene.blueNoiseTextureData);let h=Object.values(n.frames)[0];if(this._frameView?this._frameView.setCamera(this._camera):(h.preset==="fullscreen"?(this._viewportMode=1,this.canvas.style.display="block",this.canvas.parentElement&&(this._viewportWidth=this.canvas.parentElement.clientWidth||300,this.canvas.style.width="100%"),this.canvas.parentElement&&(this._viewportHeight=this.canvas.parentElement.clientHeight||150,this.canvas.style.height="100%")):(this._viewportMode=2,this._viewportWidth=h.size[0],this._viewportHeight=h.size[1],this.canvas.style.width=`${this._viewportWidth}px`,this.canvas.style.height=`${this._viewportHeight}px`),this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1),this._frameView=new jK(this._renderer,this._camera,new it(this._viewportWidth,this._viewportHeight)),this._frameView.enableResponsive=(h.allowResponsive??!1)&&h.preset==="fullscreen"),e){let u=new xK(this._renderer,this.data.scene.publish,this._scene,()=>this._scene.activeCamera,this._sharedAssetsManager,this._requestRenderAutoMode,!0,h);this._scene.updateMatrixWorld(!0),this._controls=new aJ(u),this._animationControls=new qet(this._scene,this._requestRenderAutoMode),this._eventManager=new UK(n.scene.publish,this._controls,this._animationControls,u,n.shared.variables),this._eventManager.activate(),this._controls.activate(this._eventManager)}this._resize(),this._scene.activePage.data.postprocessing.depthOfField.enabled&&Promise.all(this._sharedAssetsManager.getImageLoadPromises()).then(()=>{this.disposed||this._resize(!0)}),i!==void 0&&this.setVariables(i),this.dt===0&&(this.render(performance.now()),setTimeout(()=>{this._renderer?.setAnimationLoop(this.render)},0)),this._resizeObserverTimeout=setTimeout(()=>{!this._resizeObserver&&this.canvas.parentElement&&(this._resizeObserver=new ResizeObserver(()=>{this._viewportWidth=this.canvas.clientWidth,this._viewportHeight=this.canvas.clientHeight,this._debouncedResize()}),this._resizeObserver.observe(this.canvas.parentElement))},300),document.addEventListener("scroll",this._onScroll),this._htmlContentOverlay?.dispose(),this._htmlContentOverlay=void 0;let d=n.scene.publish.htmlContent?.html;if(e&&d&&this._htmlContentMode!=="none"){let u={shared:this._sharedAssetsManager,findEntity:p=>this._scene?.getObjectByProperty("uuid",p)??this._scene?.getObjectByName(p)};this._htmlContentOverlay=(this._htmlContentMode==="inline"?Sj.mount(this,this.canvas,d,u):wj.mount(this,this.canvas,d,u))??void 0}}setVariables(t){if(this._data!==void 0){let e=Object.entries(t);for(let[i,n]of e)this.setVariable(i,n)}}setVariable(t,e){let i=this._getVariableByName(t);if(i&&!("dynamicVariableType"in i.data)){let n=e;typeof i.data.value=="number"?n=typeof e=="number"?e:typeof e=="boolean"?e===!0?1:0:parseFloat(e):typeof i.data.value=="boolean"?n=typeof e=="number"?!!e:typeof e=="boolean"?e:e.toLocaleLowerCase()!=="false"&&!!e:typeof i.data.value!="string"&&i.data.value.textValue!==void 0&&(n=e.toString());let r=typeof n=="string"?{textValue:n}:n;this._sharedAssetsManager?.updateVariable(i.id,r),this.requestRender(),this._requestRenderAutoMode()}else i===void 0?console.warn(`No variable named ${t} was found in your Spline file. Make sure to create it from Spline editor.`):"dynamicVariableType"in i.data&&console.warn(`Dynamic variables like ${t} cannot be updated from code.`)}getVariables(){let t={};return this._data&&this._data.shared.variables.forEach(e=>{t[e.data.name]===void 0&&(t[e.data.name]=this._getVariableValue(this._sharedAssetsManager.getVariable(e.id)))}),t}getVariable(t){let e=this._getVariableByName(t);if(e){let i=this._sharedAssetsManager.getVariable(e.id);return this._getVariableValue(i)}}_getVariableValue(t){return typeof t!="string"&&_r.isTextValue(t)?_r.getDisplayedValue(t):t}_getVariableByName(t){if(this._data){if(this._variablesCache.has(t))return this._variablesCache.get(t);let e=this._data.shared.variables.find(i=>i.data.name===t);return e&&this._variablesCache.set(t,e),e}}_getPixelRatio(t){switch(t){case 0:return window.devicePixelRatio;case 1:return 1;case 2:return 2}}findObjectById(t){let e=this._scene?.getObjectByProperty("uuid",t);return this._createProxyObject(e)}findObjectByName(t){let e=this._scene?.getObjectByName(t);return this._createProxyObject(e)}getAllObjects(){let t=[];return this._scene?.traverseEntity(e=>{if(!(e.uuid===Yc||this._scene.isInvisibleObjects(e)||e instanceof dn)){let i=this._createProxyObject(e);i&&t.push(i)}}),t}getSplineEvents(){return(this._eventManager?.handlers?.Spline).splineEvents}emitEvent(t,e){(this.findObjectById(e)||this.findObjectByName(e))?.emitEvent(t)}emitEventReverse(t,e){(this.findObjectById(e)||this.findObjectByName(e))?.emitEventReverse(t)}addEventListener(t,e){this.canvas.addEventListener(t,e)}removeEventListener(t,e){this.canvas.removeEventListener(t,e)}setZoom(t){this._controls?.orbitControls instanceof vV&&this._controls?.orbitControls.setZoom(t)}get eventManager(){return this._eventManager}get controls(){return this._controls}setSize(t,e){this._viewportWidth=t,this._viewportHeight=e,this._viewportMode=2,this._resize()}setBackgroundColor(t){let e=wU(t);this._scene?.activePage.setBackgroundColor(e),this._requestRenderAutoMode()}dispose(){this.disposed=!0,this._htmlContentOverlay?.dispose(),this._htmlContentOverlay=void 0,this._eventManager?.dispose(),this._scene?.dispose(),this._scene=void 0,this._camera=void 0,og&&og.disposeAll(),this._sharedAssetsManager?.setRequestRender(()=>{}),this._sharedAssetsManager?.dispose(),this._sharedAssetsManager=void 0,this._proxyObjectCache.forEach(t=>{P2.unsubscribe(t)}),this._proxyObjectCache.clear(),this._variablesCache.clear(),this._renderer?.pipeline.removeEventListener("smaaloaded",this._requestRenderAutoMode),this._renderer?.setAnimationLoop(null),this._renderer?.dispose(),this._renderer=void 0,this._debouncedResize.cancel(),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=void 0),this._resizeObserverTimeout!==void 0&&(clearTimeout(this._resizeObserverTimeout),this._resizeObserverTimeout=void 0),this.canvas.style.width="",this.canvas.style.height="",this.canvas.removeAttribute("width"),this.canvas.removeAttribute("height"),this._frameView=void 0,this._controls?.deactivate(),this._controls=void 0,this._animationControls=void 0,this._eventManager?.eventContext.dispose(),this._eventManager=void 0,this._splatViewer=void 0,this._data=void 0,this._perfs=void 0,this.dt=0,this._lastTime=void 0,function(t){t.removeEventListener("pointerdown",IR,!0),t.removeEventListener("pointerdown",tv,!0),t.removeEventListener("pointermove",tv,!0),t.removeEventListener("pointerup",Pd,!0),t.removeEventListener("pointercancel",Pd,!0),t.removeEventListener("pointerleave",Pd,!0),window.removeEventListener("keydown",OR,!0),window.removeEventListener("keyup",LR,!0)}(this.canvas),document.removeEventListener("scroll",this._onScroll),er.dispose()}get isStopped(){return this._isPaused}stop(){this._isPaused||(this._renderer?.setAnimationLoop(null),this._isPaused=!0,this._eventManager?.pause(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!1))}play(){!this._isPaused||(this._isPaused=!1,this._eventManager?.resume(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!0),this._renderer?.setAnimationLoop(this.render))}setGlobalEvents(t){this._eventManager?.updateUseWindowEvents(t)}get data(){return this._data}_createProxyObject(t){if(!this._scene)return;let e,i=this._scene;if(t==null)return;if(this._proxyObjectCache.has(t.uuid))return this._proxyObjectCache.get(t.uuid);t.traverseAncestors(h=>{h instanceof dn&&(e=h.name)});let n=this._sharedAssetsManager,r={shared:n,scene:this._scene},s=h=>{if(h===null||h==="Base State")return null;if(h&&t.data.states){let d=t.data.states.find(u=>u.data.name===h);return d?d.id:void 0}},a="material"in t?t.material:void 0,o=t.materialOverride,l={name:t.name,uuid:t.uuid,visible:t.visible,intensity:t.intensity,position:t.position,rotation:t.rotation,scale:t.scale,type:t.data.type,page:e,material:o??(a?lit(a):void 0),parentUuid:t.parent instanceof dn||t instanceof lx?void 0:t.parent?.uuid,emitEvent(h){t.dispatchEvent({type:"userEvent",eventName:h})},emitEventReverse(h){t.dispatchEvent({type:"userEvent",eventName:h,reverse:!0})},hide(){t.visible&&(t.visible=!1,r.shared.requestRender())},show(){t.visible||(t.visible=!0,r.shared.requestRender())},get state(){let h=t.stateSelection;if(h!==null)return t.data.states.find(({id:d})=>d===h)?.data.name},set state(h){let d;if(h!==void 0){let u=typeof h=="string"?t.data.states.find(({id:p})=>p===h):t.data.states[h];if(u)d=u.id;else{let p=typeof h=="string"?s(h):void 0;p&&(d=p)}}t.changeSelectedState(d??null,r),t.currentState=d??null,t.dispatchEvent({type:"completeState",state:d??null}),r.shared.requestRender()},transition(h){let d=bj;if(d===null)return Vn("transitions","obj.transition()"),{transition(b){return this},play(){return this},pause(){return this},reset(){return this},seek(b){return this}};let u,p,f=this,g=[],m=!1,y=()=>{p=new uj({delay:0,delayDirection:"start-once",direction:"normal",repeat:0,runMode:"Repeat"},g.map(b=>b.runner))},v={update(b){p?.update(b),p?.isPlaying!==!0&&er.remove(v)}},_={transition({from:b,to:x,duration:w,delay:S,...A}){let E=s(b);E===void 0&&(E=u);let P=s(x);return u=P,g.push(new d(t,E,P,{state:P,repeat:0,delay:S??0,delayDirection:"start-once",direction:"normal",duration:w??1e3,...A,...A.easing===6?$l.defaultData:A.easing===5?dp.defaultData:{}},n,!1,i.activePage,{onBegin:()=>{(b&&E||b==="Base State"&&!E)&&(f.state=E??void 0)},onComplete:()=>{f.state=P??void 0}})),y(),this},play(){return p?(m=!0,p.play(er.time),p.isPlaying&&er.add(v),this):this},pause(){return p?.stop(),er.remove(v),this},reset(){return this.pause(),m=!1,y(),p?.seek(0),this},seek(b){let x=g.reduce((w,S)=>w+S.runner.duration,0);return x>0&&p?.seek(b/1e3/x),this}};return _.transition(h),(h.autoPlay??!0)&&queueMicrotask(()=>{m||_.play()}),_},set color(h){let d=wU(h);if(nb.is(t))return void(t.color=d);if(!(t.type==="Mesh"&&"material"in t&&t instanceof Hr))return;let u={r:d.r,g:d.g,b:d.b,a:d.a},p=t.materialOverride;if(p!==void 0){let m=p.color;return void(m?.isColor===!0&&typeof m.setStyle=="function"&&(m.setStyle(h),r.shared.requestRender()))}let f=Array.isArray(t.material)?t.material[0]:t.material,g=f.data.layers.find(m=>m.data.type==="color")?.id;if(g)f.updateByOp({type:0,path:["layers",g],props:{color:{...u}}},f.data,r);else{let m=f.data,y=m.layers.find(S=>S.data.type==="light");if(!y)return;let v=m.layers.indexOf(y)===0?y:null,_=m.layers.at(v?m.layers.indexOf(v)+1:0),b={type:4,fi:v?v.fi+(_?(_.fi-v.fi)/2:1):_?_.fi/2:1,id:Ot.generateUUID(),data:{...Ki.defaultData("color"),color:u},localIndex:0},x=m.layers.insertAfterHelper(v?.id??null,1),w=m.layers.runOp({...b,fi:x[0]}).data;Object.assign(f.data,{layers:w}),f.updateByOp({...b,path:["layers"]},f.data,r)}}},c=P2(l,(h,d)=>{let u=t[h],p=function(f){return f.split(".")}(h);p[0]==="material"&&a&&o===void 0&&function(f,g,m){let y=Array.isArray(m)?m[0]:m;if(f[0]==="layers"){let v=parseInt(f[1]),_=y.layers[v],b=f[2];_&&b&&function(x,w,S){let A=x[0];try{if(function(E,P){return!!cit[P]?.includes(E)}(A,S.type,x.slice(1)))if(A==="colors"){if(x.length<2)throw new Error("You cannot mutate the colors array, only its items");let E=parseInt(x[1]),P=S.getValue(A)?.[E];if(!P)throw new Error("Color index out of range");cm.setStyle(w),P.set(cm.r,cm.g,cm.b,cm.a)}else S.getValue(A)?.setStyle(w);else if(A==="texture"||A==="video"){let E=S.color;(function(P,T,R,L){let D=P[0];if(D==="repeat"||D==="offset"||D==="rotation"){let U=L.getNode("mat"),V=U&&typeof U.updateMatrix=="function"?U:L.getValue("mat");if(!V)return;if(D==="rotation")V.rotation=parseFloat(T);else{let k=P[1];if(k===void 0)T instanceof Array&&T.length===2&&Object.assign(V,{[D]:T});else{let Y=V[D],$=parseInt(k)===0?[parseFloat(T),Y[1]]:[Y[0],parseFloat(T)];Object.assign(V,{[D]:$})}}V.updateMatrix()}else D==="wrapping"||D==="minFilter"||D==="magFilter"?D==="wrapping"?R.texture.wrap=T:R.texture[D]=T:D==="image"&&P[1]==="data"&&R.texture.image.updateSrc(T)})(x.slice(1),w,E,S)}else{let E=x[1],P=S.getValue(A);P?.isVector3&&E!==void 0||P?.isVector2&&E!==void 0?P.setComponent(parseInt(E),w):S.setValue(A,w)}}catch(E){console.error("Error setting material value",E)}}(f.slice(2),g,_)}else f[0]==="alpha"&&y.layers.forEach(v=>{v.type==="light"&&v.node.alphaOverride!==void 0&&(v.node.alphaOverride.value=g,g<1&&(y.transparent=!0))})}(p.slice(1),d,a),typeof u!="object"&&Object.getOwnPropertyDescriptor(t,h)?.writable&&(t[h]=d),this._requestRenderAutoMode(),t.updateMatrix()});return this._proxyObjectCache.set(t.uuid,c),c}setUIWasmUrl(t){(function(e){q_=e,Xb?.setHanaUIWasmUrl(e)})(t)}pauseGameControls(){this._eventManager?.controlsManager.gameControl?.pause()}resumeGameControls(){this._eventManager?.controlsManager.gameControl?.resume()}async swapGeometry(t,e){let i;if(typeof e=="string"){if(!e.endsWith(".splinegeometry"))throw new Error("Only .splinegeometry format is supported");{let l=await(await fetch(e)).arrayBuffer();i=new Uint8Array(l)}}else i=e;let n=Tg.deserialize(i),r="data"in n&&n.data.draco!==void 0;r&&await mU(this._wasmPath);let s=this._scene?.getObjectByProperty("uuid",t)??this._scene?.getObjectByName(t);if(!s)return void console.warn(`Object ${t} not found`);if(s.data.type!=="Mesh"||!(s instanceof Hr))return void console.warn(`Object ${t} is not a mesh`);let a=s,o={...a.data,geometry:n};r&&await gU([o]),a.updateByOp({type:0,path:[],props:{geometry:o.geometry}},o,{shared:this._sharedAssetsManager,scene:this._scene},!1);for(let l of a.data.states){let c={...l.data};a.states||(a.states={}),a.states[l.id]=Zl.patch(o,c)}return i}_applyDocumentTransaction(t){this._data=t.data,this._scene&&(this._scene.data=this._data.scene),this._sharedAssetsManager&&(this._sharedAssetsManager.data=this._data.shared);for(let e of t.actual){let i=e.path;Array.isArray(i)&&i.length===2&&i[0]==="scene"&&i[1]==="objects"&&this._scene?.updateTreeByOp({...e,path:[]},this._sharedAssetsManager)}}_findEntity(t){return this._scene?.getObjectByProperty("uuid",t)??this._scene?.getObjectByName(t)}_resolveParentId(t){if(t===void 0)return this._scene.activePage.uuid;let e=typeof t=="string"?t:t.uuid,i=this._findEntity(e);if(!i)throw new Error(`parent '${e}' \u2014 no object with that name or uuid in the scene.`);return i.uuid}async createCustomMaterial(t){if(this.disposed)throw new Error("createCustomMaterial: this Application was disposed.");if(typeof t!="function")throw new Error("createCustomMaterial: expected a factory function \u2014 createCustomMaterial((three) => new three.MeshStandardNodeMaterial()).");let e=yk();if(e===void 0&&e===void 0)throw new Error("createCustomMaterial: requires the webgpu backend (the runtime default where WebGPU is available). This Application is on the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } or drop any ?renderer=webgl2 override.");let i=t(e);if(typeof i!="object"||i===null||i.isMaterial!==!0)throw new Error("createCustomMaterial: the factory must return a three.js material built from the namespace it receives \u2014 e.g. (three) => new three.MeshStandardNodeMaterial().");return i}async setMaterial(t,e){if(this.disposed)throw new Error("setMaterial: this Application was disposed.");let i=this._scene;if(!i)throw new Error("setMaterial: no scene loaded \u2014 call load() or start() first.");let n=typeof t=="string"?t:t.uuid,r=this._findEntity(n);if(!r)throw new Error(`setMaterial: '${n}' \u2014 no object with that name or uuid in the scene.`);if(!(r instanceof Hr))throw new Error(`setMaterial: '${n}' is not a mesh \u2014 lights, groups, and cameras have no material.`);let s=typeof e=="function"?await this.createCustomMaterial(e):e;if(eb()!=="webgpu")throw new Error("setMaterial: custom three.js materials require the webgpu backend (the runtime default where WebGPU is available). This scene is running the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } or drop any ?renderer=webgl2 override.");let a=yU({material:s});if(a.material===void 0)throw new Error("setMaterial: expected a three.js material instance or a (three) => material factory.");return r.setMaterialOverride(a.material,{scene:i,shared:this._sharedAssetsManager}),this._proxyObjectCache.delete(r.uuid),this._requestRenderAutoMode(),a.material}async createObject(t,e={}){if(this.disposed)throw new Error("createObject: this Application was disposed.");let i=this._scene,n=this._data;if(!i||!n)throw new Error("createObject: no scene loaded \u2014 call load() or start() first.");let r=function(m){if(typeof m!="string"||m.length===0)throw new Error(`createObject: expected a type name string \u2014 one of ${_U}.`);let y=m.replace(/Geometry$/i,"").replace(/[\s_-]/g,"").toLowerCase(),v=tit[y];if(v)return{objectType:v};let _=Jet[y];if(_)return{objectType:"Mesh",geometryType:_};let b=eit[y];throw b?new Error(`createObject: '${m}' is not supported \u2014 ${b}`):new Error(`createObject: '${m}' is not a creatable Spline type \u2014 use one of ${_U}, e.g. createObject('Cube', { width: 200 }).`)}(t);typeof e.material=="function"&&(e={...e,material:await this.createCustomMaterial(e.material)});let s,a,{options:o,material:l}=yU(e);if(l!==void 0){if(r.objectType!=="Mesh")throw new Error("createObject: a three.js material instance only applies to mesh types \u2014 lights and groups have no material.");if(eb()!=="webgpu")throw new Error("createObject: three.js material instances require the webgpu backend (the runtime default where WebGPU is available). This scene is running the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } to the Application, or drop any ?renderer=webgl2 override.")}if(r.geometryType==="TextGeometry"){if(!DC.has("text"))throw new Error("createObject: this runtime build was compiled without the 'text' feature \u2014 re-export the scene with a Text object present, or load the full runtime build.");if(await Q5(),a=e.font??wu,n.shared.fonts[a]===void 0){if(a!==wu){let m=Object.keys(n.shared.fonts).join(", ");throw new Error(`createObject: font '${a}' is not in this document \u2014 available fonts: ${m||"(none)"}.`)}s={name:wu,url:RF}}}let c=this._resolveParentId(e.parent),h=ait(r,o,n),d=Ot.generateUUID(),[u,p]=Em(n);s&&(u.shared.fonts[wu]=s),u.scene.objects.insertAfter(c,null,[{id:d,data:h,children:[]}]);let f=p.result();if(s&&this._sharedAssetsManager.addFont(wu,s),a!==void 0){let m=this._sharedAssetsManager.getFont(a);m&&await m.loadingPromise}this._applyDocumentTransaction(f);let g=i.find(d);return l!==void 0&&g.setMaterialOverride(l,{scene:i,shared:this._sharedAssetsManager}),this._requestRenderAutoMode(),this._createProxyObject(g)}cloneObject(t,e={}){if(this.disposed)throw new Error("cloneObject: this Application was disposed.");let i=this._scene,n=this._data;if(!i||!n)throw new Error("cloneObject: no scene loaded \u2014 call load() or start() first.");let r=typeof t=="string"?t:t?.uuid,s=r?this._findEntity(r):void 0;if(!s)throw new Error(`cloneObject: '${r}' \u2014 no object with that name or uuid in the scene.`);if(s instanceof dn)throw new Error("cloneObject: pages cannot be cloned.");let a=n.scene.objects.get(s.uuid);if(!a)throw new Error(`cloneObject: '${r}' is not part of the document tree (expanded clones and instanced children cannot be cloned \u2014 clone their source object instead).`);let o=function(p,f,g){let m={...p.data};return f.position!==void 0&&(m.position=Ng(f.position,[0,0,0])),f.rotation!==void 0&&(m.rotation=Ng(f.rotation,[0,0,0])),f.scale!==void 0&&(m.scale=Ej(f.scale)),f.visible!==void 0&&(m.visible=f.visible),m.name=f.name??Aj(`${p.data.name??"Object"} Copy`,g),{...p,data:m}}(oit(a),e,n.scene.objects),l=e.parent!==void 0?this._resolveParentId(e.parent):n.scene.objects.parent(s.uuid)??null,c=e.parent!==void 0?null:s.uuid,[h,d]=Em(n);h.scene.objects.insertAfter(l,c,[o]),this._applyDocumentTransaction(d.result());let u=i.find(o.id);return this._requestRenderAutoMode(),this._createProxyObject(u)}removeObject(t){let e=this._scene,i=this._data;if(this.disposed||!e||!i)return!1;let n=typeof t=="string"?t:t?.uuid,r=n?this._findEntity(n):void 0;if(!r)return!1;if(r instanceof dn)throw new Error("removeObject: pages cannot be removed.");if(r.data.type==="PerspectiveCamera"||r.data.type==="OrthographicCamera")throw new Error("removeObject: cameras cannot be removed.");if(i.scene.objects.get(r.uuid)===void 0)throw new Error(`removeObject: '${n}' is not part of the document tree (expanded clones and instanced children cannot be removed individually).`);let s=[];r.traverseEntity(l=>{s.push(l.uuid)});let[a,o]=Em(i);a.scene.objects.delete(r.uuid),this._applyDocumentTransaction(o.result());for(let l of s){let c=this._proxyObjectCache.get(l);c&&(P2.unsubscribe(c),this._proxyObjectCache.delete(l))}return this._requestRenderAutoMode(),!0}};var yx=window,_x=yx.ShadowRoot&&(yx.ShadyCSS===void 0||yx.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,k3=Symbol(),Pj=new WeakMap,i0=class{constructor(e,i,n){if(this._$cssResult$=!0,n!==k3)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=i}get styleSheet(){let e=this.o,i=this.t;if(_x&&e===void 0){let n=i!==void 0&&i.length===1;n&&(e=Pj.get(i)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Pj.set(i,e))}return e}toString(){return this.cssText}},Dj=t=>new i0(typeof t=="string"?t:t+"",void 0,k3),V3=(t,...e)=>{let i=t.length===1?t[0]:e.reduce((n,r,s)=>n+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+t[s+1],t[0]);return new i0(i,t,k3)},j3=(t,e)=>{_x?t.adoptedStyleSheets=e.map(i=>i instanceof CSSStyleSheet?i:i.styleSheet):e.forEach(i=>{let n=document.createElement("style"),r=yx.litNonce;r!==void 0&&n.setAttribute("nonce",r),n.textContent=i.cssText,t.appendChild(n)})},bx=_x?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let i="";for(let n of e.cssRules)i+=n.cssText;return Dj(i)})(t):t;var G3,xx=window,Rj=xx.trustedTypes,uit=Rj?Rj.emptyScript:"",Ij=xx.reactiveElementPolyfillSupport,W3={toAttribute(t,e){switch(e){case Boolean:t=t?uit:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=t!==null;break;case Number:i=t===null?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch{i=null}}return i}},Oj=(t,e)=>e!==t&&(e==e||t==t),H3={attribute:!0,type:String,converter:W3,reflect:!1,hasChanged:Oj},q3="finalized",cl=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var i;this.finalize(),((i=this.h)!==null&&i!==void 0?i:this.h=[]).push(e)}static get observedAttributes(){this.finalize();let e=[];return this.elementProperties.forEach((i,n)=>{let r=this._$Ep(n,i);r!==void 0&&(this._$Ev.set(r,n),e.push(r))}),e}static createProperty(e,i=H3){if(i.state&&(i.attribute=!1),this.finalize(),this.elementProperties.set(e,i),!i.noAccessor&&!this.prototype.hasOwnProperty(e)){let n=typeof e=="symbol"?Symbol():"__"+e,r=this.getPropertyDescriptor(e,n,i);r!==void 0&&Object.defineProperty(this.prototype,e,r)}}static getPropertyDescriptor(e,i,n){return{get(){return this[i]},set(r){let s=this[e];this[i]=r,this.requestUpdate(e,s,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||H3}static finalize(){if(this.hasOwnProperty(q3))return!1;this[q3]=!0;let e=Object.getPrototypeOf(this);if(e.finalize(),e.h!==void 0&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){let i=this.properties,n=[...Object.getOwnPropertyNames(i),...Object.getOwnPropertySymbols(i)];for(let r of n)this.createProperty(r,i[r])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){let i=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let r of n)i.unshift(bx(r))}else e!==void 0&&i.push(bx(e));return i}static _$Ep(e,i){let n=i.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise(i=>this.enableUpdating=i),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(e=this.constructor.h)===null||e===void 0||e.forEach(i=>i(this))}addController(e){var i,n;((i=this._$ES)!==null&&i!==void 0?i:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((n=e.hostConnected)===null||n===void 0||n.call(e))}removeController(e){var i;(i=this._$ES)===null||i===void 0||i.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((e,i)=>{this.hasOwnProperty(i)&&(this._$Ei.set(i,this[i]),delete this[i])})}createRenderRoot(){var e;let i=(e=this.shadowRoot)!==null&&e!==void 0?e:this.attachShadow(this.constructor.shadowRootOptions);return j3(i,this.constructor.elementStyles),i}connectedCallback(){var e;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)===null||e===void 0||e.forEach(i=>{var n;return(n=i.hostConnected)===null||n===void 0?void 0:n.call(i)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(i=>{var n;return(n=i.hostDisconnected)===null||n===void 0?void 0:n.call(i)})}attributeChangedCallback(e,i,n){this._$AK(e,n)}_$EO(e,i,n=H3){var r;let s=this.constructor._$Ep(e,n);if(s!==void 0&&n.reflect===!0){let a=(((r=n.converter)===null||r===void 0?void 0:r.toAttribute)!==void 0?n.converter:W3).toAttribute(i,n.type);this._$El=e,a==null?this.removeAttribute(s):this.setAttribute(s,a),this._$El=null}}_$AK(e,i){var n;let r=this.constructor,s=r._$Ev.get(e);if(s!==void 0&&this._$El!==s){let a=r.getPropertyOptions(s),o=typeof a.converter=="function"?{fromAttribute:a.converter}:((n=a.converter)===null||n===void 0?void 0:n.fromAttribute)!==void 0?a.converter:W3;this._$El=s,this[s]=o.fromAttribute(i,a.type),this._$El=null}}requestUpdate(e,i,n){let r=!0;e!==void 0&&(((n=n||this.constructor.getPropertyOptions(e)).hasChanged||Oj)(this[e],i)?(this._$AL.has(e)||this._$AL.set(e,i),n.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,n))):r=!1),!this.isUpdatePending&&r&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(i){Promise.reject(i)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((r,s)=>this[s]=r),this._$Ei=void 0);let i=!1,n=this._$AL;try{i=this.shouldUpdate(n),i?(this.willUpdate(n),(e=this._$ES)===null||e===void 0||e.forEach(r=>{var s;return(s=r.hostUpdate)===null||s===void 0?void 0:s.call(r)}),this.update(n)):this._$Ek()}catch(r){throw i=!1,this._$Ek(),r}i&&this._$AE(n)}willUpdate(e){}_$AE(e){var i;(i=this._$ES)===null||i===void 0||i.forEach(n=>{var r;return(r=n.hostUpdated)===null||r===void 0?void 0:r.call(n)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){this._$EC!==void 0&&(this._$EC.forEach((i,n)=>this._$EO(n,this[n],i)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}};cl[q3]=!0,cl.elementProperties=new Map,cl.elementStyles=[],cl.shadowRootOptions={mode:"open"},Ij?.({ReactiveElement:cl}),((G3=xx.reactiveElementVersions)!==null&&G3!==void 0?G3:xx.reactiveElementVersions=[]).push("1.6.3");var X3,wx=window,Rp=wx.trustedTypes,Lj=Rp?Rp.createPolicy("lit-html",{createHTML:t=>t}):void 0,Y3="$lit$",Mh=`lit$${(Math.random()+"").slice(9)}$`,Vj="?"+Mh,pit=`<${Vj}>`,id=document,r0=()=>id.createComment(""),s0=t=>t===null||typeof t!="object"&&typeof t!="function",jj=Array.isArray,fit=t=>jj(t)||typeof t?.[Symbol.iterator]=="function",$3=`[
|
|
9935
9935
|
\f\r]`,n0=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Bj=/-->/g,Uj=/>/g,td=RegExp(`>|${$3}(?:([^\\s"'>=/]+)(${$3}*=${$3}*(?:[^
|
|
9936
9936
|
\f\r"'\`<>=]|("|')|))|$)`,"g"),zj=/'/g,Fj=/"/g,Gj=/^(?:script|style|textarea|title)$/i,Hj=t=>(e,...i)=>({_$litType$:t,strings:e,values:i}),Wj=Hj(1),Vut=Hj(2),nd=Symbol.for("lit-noChange"),hr=Symbol.for("lit-nothing"),Nj=new WeakMap,ed=id.createTreeWalker(id,129,null,!1);function qj(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return Lj!==void 0?Lj.createHTML(e):e}var mit=(t,e)=>{let i=t.length-1,n=[],r,s=e===2?"<svg>":"",a=n0;for(let o=0;o<i;o++){let l=t[o],c,h,d=-1,u=0;for(;u<l.length&&(a.lastIndex=u,h=a.exec(l),h!==null);)u=a.lastIndex,a===n0?h[1]==="!--"?a=Bj:h[1]!==void 0?a=Uj:h[2]!==void 0?(Gj.test(h[2])&&(r=RegExp("</"+h[2],"g")),a=td):h[3]!==void 0&&(a=td):a===td?h[0]===">"?(a=r??n0,d=-1):h[1]===void 0?d=-2:(d=a.lastIndex-h[2].length,c=h[1],a=h[3]===void 0?td:h[3]==='"'?Fj:zj):a===Fj||a===zj?a=td:a===Bj||a===Uj?a=n0:(a=td,r=void 0);let p=a===td&&t[o+1].startsWith("/>")?" ":"";s+=a===n0?l+pit:d>=0?(n.push(c),l.slice(0,d)+Y3+l.slice(d)+Mh+p):l+Mh+(d===-2?(n.push(void 0),o):p)}return[qj(t,s+(t[i]||"<?>")+(e===2?"</svg>":"")),n]},rd=class{constructor({strings:e,_$litType$:i},n){let r;this.parts=[];let s=0,a=0,o=e.length-1,l=this.parts,[c,h]=mit(e,i);if(this.el=rd.createElement(c,n),ed.currentNode=this.el.content,i===2){let d=this.el.content,u=d.firstChild;u.remove(),d.append(...u.childNodes)}for(;(r=ed.nextNode())!==null&&l.length<o;){if(r.nodeType===1){if(r.hasAttributes()){let d=[];for(let u of r.getAttributeNames())if(u.endsWith(Y3)||u.startsWith(Mh)){let p=h[a++];if(d.push(u),p!==void 0){let f=r.getAttribute(p.toLowerCase()+Y3).split(Mh),g=/([.?@])?(.*)/.exec(p);l.push({type:1,index:s,name:g[2],strings:f,ctor:g[1]==="."?K3:g[1]==="?"?Q3:g[1]==="@"?J3:Op})}else l.push({type:6,index:s})}for(let u of d)r.removeAttribute(u)}if(Gj.test(r.tagName)){let d=r.textContent.split(Mh),u=d.length-1;if(u>0){r.textContent=Rp?Rp.emptyScript:"";for(let p=0;p<u;p++)r.append(d[p],r0()),ed.nextNode(),l.push({type:2,index:++s});r.append(d[u],r0())}}}else if(r.nodeType===8)if(r.data===Vj)l.push({type:2,index:s});else{let d=-1;for(;(d=r.data.indexOf(Mh,d+1))!==-1;)l.push({type:7,index:s}),d+=Mh.length-1}s++}}static createElement(e,i){let n=id.createElement("template");return n.innerHTML=e,n}};function Ip(t,e,i=t,n){var r,s,a,o;if(e===nd)return e;let l=n!==void 0?(r=i._$Co)===null||r===void 0?void 0:r[n]:i._$Cl,c=s0(e)?void 0:e._$litDirective$;return l?.constructor!==c&&((s=l?._$AO)===null||s===void 0||s.call(l,!1),c===void 0?l=void 0:(l=new c(t),l._$AT(t,i,n)),n!==void 0?((a=(o=i)._$Co)!==null&&a!==void 0?a:o._$Co=[])[n]=l:i._$Cl=l),l!==void 0&&(e=Ip(t,l._$AS(t,e.values),l,n)),e}var Z3=class{constructor(e,i){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var i;let{el:{content:n},parts:r}=this._$AD,s=((i=e?.creationScope)!==null&&i!==void 0?i:id).importNode(n,!0);ed.currentNode=s;let a=ed.nextNode(),o=0,l=0,c=r[0];for(;c!==void 0;){if(o===c.index){let h;c.type===2?h=new sd(a,a.nextSibling,this,e):c.type===1?h=new c.ctor(a,c.name,c.strings,this,e):c.type===6&&(h=new tP(a,this,e)),this._$AV.push(h),c=r[++l]}o!==c?.index&&(a=ed.nextNode(),o++)}return ed.currentNode=id,s}v(e){let i=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,i),i+=n.strings.length-2):n._$AI(e[i])),i++}},sd=class{constructor(e,i,n,r){var s;this.type=2,this._$AH=hr,this._$AN=void 0,this._$AA=e,this._$AB=i,this._$AM=n,this.options=r,this._$Cp=(s=r?.isConnected)===null||s===void 0||s}get _$AU(){var e,i;return(i=(e=this._$AM)===null||e===void 0?void 0:e._$AU)!==null&&i!==void 0?i:this._$Cp}get parentNode(){let e=this._$AA.parentNode,i=this._$AM;return i!==void 0&&e?.nodeType===11&&(e=i.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,i=this){e=Ip(this,e,i),s0(e)?e===hr||e==null||e===""?(this._$AH!==hr&&this._$AR(),this._$AH=hr):e!==this._$AH&&e!==nd&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):fit(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==hr&&s0(this._$AH)?this._$AA.nextSibling.data=e:this.$(id.createTextNode(e)),this._$AH=e}g(e){var i;let{values:n,_$litType$:r}=e,s=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=rd.createElement(qj(r.h,r.h[0]),this.options)),r);if(((i=this._$AH)===null||i===void 0?void 0:i._$AD)===s)this._$AH.v(n);else{let a=new Z3(s,this),o=a.u(this.options);a.v(n),this.$(o),this._$AH=a}}_$AC(e){let i=Nj.get(e.strings);return i===void 0&&Nj.set(e.strings,i=new rd(e)),i}T(e){jj(this._$AH)||(this._$AH=[],this._$AR());let i=this._$AH,n,r=0;for(let s of e)r===i.length?i.push(n=new sd(this.k(r0()),this.k(r0()),this,this.options)):n=i[r],n._$AI(s),r++;r<i.length&&(this._$AR(n&&n._$AB.nextSibling,r),i.length=r)}_$AR(e=this._$AA.nextSibling,i){var n;for((n=this._$AP)===null||n===void 0||n.call(this,!1,!0,i);e&&e!==this._$AB;){let r=e.nextSibling;e.remove(),e=r}}setConnected(e){var i;this._$AM===void 0&&(this._$Cp=e,(i=this._$AP)===null||i===void 0||i.call(this,e))}},Op=class{constructor(e,i,n,r,s){this.type=1,this._$AH=hr,this._$AN=void 0,this.element=e,this.name=i,this._$AM=r,this.options=s,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=hr}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,i=this,n,r){let s=this.strings,a=!1;if(s===void 0)e=Ip(this,e,i,0),a=!s0(e)||e!==this._$AH&&e!==nd,a&&(this._$AH=e);else{let o=e,l,c;for(e=s[0],l=0;l<s.length-1;l++)c=Ip(this,o[n+l],i,l),c===nd&&(c=this._$AH[l]),a||(a=!s0(c)||c!==this._$AH[l]),c===hr?e=hr:e!==hr&&(e+=(c??"")+s[l+1]),this._$AH[l]=c}a&&!r&&this.j(e)}j(e){e===hr?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},K3=class extends Op{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===hr?void 0:e}},git=Rp?Rp.emptyScript:"",Q3=class extends Op{constructor(){super(...arguments),this.type=4}j(e){e&&e!==hr?this.element.setAttribute(this.name,git):this.element.removeAttribute(this.name)}},J3=class extends Op{constructor(e,i,n,r,s){super(e,i,n,r,s),this.type=5}_$AI(e,i=this){var n;if((e=(n=Ip(this,e,i,0))!==null&&n!==void 0?n:hr)===nd)return;let r=this._$AH,s=e===hr&&r!==hr||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,a=e!==hr&&(r===hr||s);s&&this.element.removeEventListener(this.name,this,r),a&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var i,n;typeof this._$AH=="function"?this._$AH.call((n=(i=this.options)===null||i===void 0?void 0:i.host)!==null&&n!==void 0?n:this.element,e):this._$AH.handleEvent(e)}},tP=class{constructor(e,i,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=i,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){Ip(this,e)}};var kj=wx.litHtmlPolyfillSupport;kj?.(rd,sd),((X3=wx.litHtmlVersions)!==null&&X3!==void 0?X3:wx.litHtmlVersions=[]).push("2.8.0");var a0=(t,e,i)=>{var n,r;let s=(n=i?.renderBefore)!==null&&n!==void 0?n:e,a=s._$litPart$;if(a===void 0){let o=(r=i?.renderBefore)!==null&&r!==void 0?r:null;s._$litPart$=a=new sd(e.insertBefore(r0(),o),o,void 0,i??{})}return a._$AI(t),a};var eP,iP;var Eh=class extends cl{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,i;let n=super.createRenderRoot();return(e=(i=this.renderOptions).renderBefore)!==null&&e!==void 0||(i.renderBefore=n.firstChild),n}update(e){let i=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=a0(i,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!1)}render(){return nd}};Eh.finalized=!0,Eh._$litElement$=!0,(eP=globalThis.litElementHydrateSupport)===null||eP===void 0||eP.call(globalThis,{LitElement:Eh});var Xj=globalThis.litElementPolyfillSupport;Xj?.({LitElement:Eh});((iP=globalThis.litElementVersions)!==null&&iP!==void 0?iP:globalThis.litElementVersions=[]).push("3.3.3");var $j=t=>e=>typeof e=="function"?((i,n)=>(customElements.define(i,n),n))(t,e):((i,n)=>{let{kind:r,elements:s}=n;return{kind:r,elements:s,finisher(a){customElements.define(i,a)}}})(t,e);var vit=(t,e)=>e.kind==="method"&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(i){i.createProperty(e.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){typeof e.initializer=="function"&&(this[e.key]=e.initializer.call(this))},finisher(i){i.createProperty(e.key,t)}},yit=(t,e,i)=>{e.constructor.createProperty(i,t)};function ws(t){return(e,i)=>i!==void 0?yit(t,e,i):vit(t,e)}var nP,fpt=((nP=window.HTMLSlotElement)===null||nP===void 0?void 0:nP.prototype.assignedElements)!=null?(t,e)=>t.assignedElements(e):(t,e)=>t.assignedNodes(e).filter(i=>i.nodeType===Node.ELEMENT_NODE);var Sx=window.IntersectionObserver!=null;var Yj=(t=32,e=2)=>{let i=t/2;return Wj` <style>
|
|
9937
9937
|
:host {
|