@splinetool/viewer 2.0.35 → 2.0.37

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.
@@ -32,7 +32,7 @@ property scaling ${e.scaling.method}
32
32
  property quaternion ${e.quaternion.method}`;if(e.harmonics&&e.harmonics.length>0)for(let M=0;M<e.harmonics.length;M++)n=`${n}
33
33
  property harmonics_${M} ${e.harmonics[M].method}`;n=`${n}
34
34
  end_header
35
- `;let s=new TextEncoder().encode(n),a=r*2*4,o=e.xyz.quantized.data.buffer.byteLength,l=e.xyz instanceof Es?a:0,u=e.color.quantized.data.buffer.byteLength,h=e.color instanceof Es?a:0,d=e.opacity.quantized.data.buffer.byteLength,c=e.opacity instanceof Es?a:0,p=e.scaling.quantized.data.buffer.byteLength,f=e.scaling instanceof Es?a:0,m=e.quaternion.quantized.data.buffer.byteLength,g=e.quaternion instanceof Es?a:0,v=e.variableChunkSize?Uint16Array.from(e.variableChunkSize):void 0,y=v?v.byteLength:0,_=s.byteLength+y+o+l+u+h+d+c+p+f+m+g,b=0,x=0;if(e.harmonics&&e.harmonics.length>0)for(let M=0;M<e.harmonics.length;M++)b+=e.harmonics[M].quantized.data.buffer.byteLength,x+=e.harmonics[M]instanceof Es?a:0;b=0,x=0,_+=b+x;let w=new Uint8Array(_),S=0;if(w.set(s,S),S+=s.byteLength,y>0&&(w.set(new Uint8Array(v.buffer),S),S+=y),e.xyz instanceof Es&&(w.set(new Uint8Array(e.xyz.minmaxMatrix.data.buffer),S),S+=a),w.set(new Uint8Array(e.xyz.quantized.data.buffer),S),S+=o,e.color instanceof Es&&(w.set(new Uint8Array(e.color.minmaxMatrix.data.buffer),S),S+=a),w.set(new Uint8Array(e.color.quantized.data.buffer),S),S+=u,e.opacity instanceof Es&&(w.set(new Uint8Array(e.opacity.minmaxMatrix.data.buffer),S),S+=a),w.set(new Uint8Array(e.opacity.quantized.data.buffer),S),S+=d,e.scaling instanceof Es&&(w.set(new Uint8Array(e.scaling.minmaxMatrix.data.buffer),S),S+=a),w.set(new Uint8Array(e.scaling.quantized.data.buffer),S),S+=p,e.quaternion instanceof Es&&(w.set(new Uint8Array(e.quaternion.minmaxMatrix.data.buffer),S),S+=a),w.set(new Uint8Array(e.quaternion.quantized.data.buffer),S),S+=m,b>0&&e.harmonics&&e.harmonics.length>0)for(let M=0;M<e.harmonics.length;M++){let T=e.harmonics[M];T instanceof Es&&(w.set(new Uint8Array(T.minmaxMatrix.data.buffer),S),S+=a),w.set(new Uint8Array(T.quantized.data.buffer),S),S+=T.quantized.data.byteLength}return new kB(w.buffer)}}});async function gZ(e){return createImageBitmap(new Blob([e]))}async function vZ(e){return fetch(e).then(t=>{if(!t.ok)throw new Error(`Failed to fetch image: ${t.statusText}`);return t.blob()}).then(t=>createImageBitmap(t))}function GRe(e){if(typeof e.requestVideoFrameCallback!="function"){e.hanaClockBase=++jB*zRe;return}e.hanaPresentedFrames=++jB;let t=()=>{e.hanaDisposed||(e.hanaPresentedFrames=++jB)};e.addEventListener("seeked",t);let i=()=>{t(),!e.hanaDisposed&&(e.hanaFrameCallback=e.requestVideoFrameCallback(i))};e.hanaFrameCallback=e.requestVideoFrameCallback(i)}function yZ(e){let t=e.hanaPresentedFrames;return t===void 0?e.hanaClockBase+e.currentTime:t}function jRe(e,t){e.hanaObjectUrl=URL.createObjectURL(t),e.src=e.hanaObjectUrl}function HB(e){if(e.hanaDisposed)return;e.hanaDisposed=!0;let t=e.hanaFrameCallback;t!==void 0&&(e.hanaFrameCallback=void 0,typeof e.cancelVideoFrameCallback=="function"&&e.cancelVideoFrameCallback(t));let i=e.hanaObjectUrl;i!==void 0&&(e.hanaObjectUrl=void 0,URL.revokeObjectURL(i)),e.pause(),e.removeAttribute("src"),e.load()}function HRe(e){let t=r=>{let n=e.error;return new Error(n===null?r:`${r} (code ${n.code}: ${n.message})`)},i=r=>{let n=t(r);return HB(e),n};return e.error!==null?Promise.reject(i("video failed to load")):e.readyState>=kRe?Promise.resolve(e):new Promise((r,n)=>{let s=setTimeout(()=>a(n,i("video timed out before presenting a frame")),VRe),a=(u,h)=>{clearTimeout(s),e.removeEventListener("loadeddata",o),e.removeEventListener("canplay",o),e.removeEventListener("error",l),u(h)},o=()=>a(r,e),l=()=>a(n,i("video failed to load"));e.addEventListener("loadeddata",o),e.addEventListener("canplay",o),e.addEventListener("error",l)})}function _Z(e){return e.preload="auto",e.autoplay=!0,e.loop=!0,e.muted=!0,e.playsInline=!0,e.currentTime=.01,e.load(),e.onloadeddata=()=>{e.muted=!0;let t=e.play();t!==void 0&&t.then(i=>{}).catch(()=>{e.play()}).finally(()=>{e.pause()})},GRe(e),HRe(e)}async function bZ(e){let t=document.createElement("video");return jRe(t,new Blob([e])),_Z(t)}async function xZ(e){let t=document.createElement("video");return t.crossOrigin="anonymous",t.src=e,_Z(t)}var jB,zRe,kRe,VRe,wZ=QA(()=>{"use strict";jB=0,zRe=1e6,kRe=2,VRe=3e4});var LZ={};DB(LZ,{DeviceLostPromise:()=>rm,Engine:()=>nm,PixelReadPromise:()=>Jc,SceneController:()=>tS,addRealizedChild:()=>WRe,componentInstanceRefreshOps:()=>qRe,default:()=>$Pe,dematerializeInstance:()=>$Re,duplicateComponentInstance:()=>XRe,initSync:()=>qPe,overrideForRealizedEdit:()=>YRe,realizeComponentInstance:()=>KRe,removeRealizedNode:()=>ZRe,web_init:()=>QRe});function WRe(e,t,i,r,n){let s=de.addRealizedChild(ne(e),ne(t),ne(i),ne(r),ne(n));return ii(s)}function qRe(e,t,i,r,n){let s=de.componentInstanceRefreshOps(ne(e),ne(t),ne(i),ne(r),ne(n));return ii(s)}function $Re(e,t,i,r){let n=de.dematerializeInstance(ne(e),ne(t),ne(i),ne(r));return ii(n)}function XRe(e,t,i,r){let n=de.duplicateComponentInstance(ne(e),ne(t),ne(i),ne(r));return ii(n)}function YRe(e,t,i,r,n){let s=de.overrideForRealizedEdit(ne(e),ne(t),ne(i),ne(r),ne(n));return ii(s)}function KRe(e,t,i){let r=de.realizeComponentInstance(ne(e),ne(t),ne(i));return ii(r)}function ZRe(e,t,i,r){let n=de.removeRealizedNode(ne(e),ne(t),ne(i),ne(r));return ii(n)}function QRe(){de.web_init()}function IZ(){return{__proto__:null,"./hana_bg.js":{__proto__:null,__wbg_Error_ef53bc310eb298a0:function(t,i){let r=Error(Hi(t,i));return ne(r)},__wbg_Number_6b506e6536831eaa:function(t){return Number(C(t))},__wbg_Window_afcc911b2f9c92e2:function(t){let i=C(t).Window;return ne(i)},__wbg_WorkerGlobalScope_5d19ebc889ff397e:function(t){let i=C(t).WorkerGlobalScope;return ne(i)},__wbg___wbindgen_bigint_get_as_i64_38130e98eecd467d:function(t,i){let r=C(i),n=typeof r=="bigint"?r:void 0;di().setBigInt64(t+8,ci(n)?BigInt(0):n,!0),di().setInt32(t+0,!ci(n),!0)},__wbg___wbindgen_boolean_get_1a45e2c38d4d41b9:function(t){let i=C(t),r=typeof i=="boolean"?i:void 0;return ci(r)?16777215:r?1:0},__wbg___wbindgen_debug_string_0accd80f45e5faa2:function(t,i){let r=eU(C(i)),n=As(r,de.__wbindgen_export,de.__wbindgen_export2),s=On;di().setInt32(t+4,s,!0),di().setInt32(t+0,n,!0)},__wbg___wbindgen_in_70a403a56e771704:function(t,i){return C(t)in C(i)},__wbg___wbindgen_is_bigint_6ffd6468a9bc44b9:function(t){return typeof C(t)=="bigint"},__wbg___wbindgen_is_function_754e9f305ff6029e:function(t){return typeof C(t)=="function"},__wbg___wbindgen_is_null_87c3bfe968c6a5ad:function(t){return C(t)===null},__wbg___wbindgen_is_null_or_undefined_cf617b836541fad3:function(t){return C(t)==null},__wbg___wbindgen_is_object_56732c2bc353f41d:function(t){let i=C(t);return typeof i=="object"&&i!==null},__wbg___wbindgen_is_string_c236cabd84a4d769:function(t){return typeof C(t)=="string"},__wbg___wbindgen_is_undefined_67b456be8673d3d7:function(t){return C(t)===void 0},__wbg___wbindgen_jsval_eq_1068e624fa87f6ab:function(t,i){return C(t)===C(i)},__wbg___wbindgen_jsval_loose_eq_2c56564c75129511:function(t,i){return C(t)==C(i)},__wbg___wbindgen_number_get_9bb1761122181af2:function(t,i){let r=C(i),n=typeof r=="number"?r:void 0;di().setFloat64(t+8,ci(n)?0:n,!0),di().setInt32(t+0,!ci(n),!0)},__wbg___wbindgen_string_get_72bdf95d3ae505b1:function(t,i){let r=C(i),n=typeof r=="string"?r:void 0;var s=ci(n)?0:As(n,de.__wbindgen_export,de.__wbindgen_export2),a=On;di().setInt32(t+4,a,!0),di().setInt32(t+0,s,!0)},__wbg___wbindgen_throw_1506f2235d1bdba0:function(t,i){throw new Error(Hi(t,i))},__wbg__wbg_cb_unref_61db23ac97f16c31:function(t){C(t)._wbg_cb_unref()},__wbg_activeTexture_7a0d6fe7120979ce:function(t,i){C(t).activeTexture(i>>>0)},__wbg_activeTexture_dd15c31d50b73529:function(t,i){C(t).activeTexture(i>>>0)},__wbg_addEventListener_5593b0efd622abd6:function(){return ti(function(t,i,r,n,s){C(t).addEventListener(Hi(i,r),C(n),C(s))},arguments)},__wbg_arrayBuffer_05927079aabe6d46:function(){return ti(function(t){let i=C(t).arrayBuffer();return ne(i)},arguments)},__wbg_assign_551ec2d000f70c24:function(){return ti(function(t,i,r){C(t).assign(Hi(i,r))},arguments)},__wbg_attachShader_5c6a46e7c0fc637a:function(t,i,r){C(t).attachShader(C(i),C(r))},__wbg_attachShader_c2b12b36afa45936:function(t,i,r){C(t).attachShader(C(i),C(r))},__wbg_beginComputePass_431a159006c13c7c:function(t,i){let r=C(t).beginComputePass(C(i));return ne(r)},__wbg_beginRenderPass_aa22c432e793359a:function(){return ti(function(t,i){let r=C(t).beginRenderPass(C(i));return ne(r)},arguments)},__wbg_bindBuffer_3841df88ccee4ed0:function(t,i,r){C(t).bindBuffer(i>>>0,C(r))},__wbg_bindBuffer_aa5dc7dc1c8ad1c8:function(t,i,r){C(t).bindBuffer(i>>>0,C(r))},__wbg_bindFramebuffer_10bbdf7040d89a17:function(t,i,r){C(t).bindFramebuffer(i>>>0,C(r))},__wbg_bindFramebuffer_ee8e42543c29c602:function(t,i,r){C(t).bindFramebuffer(i>>>0,C(r))},__wbg_bindRenderbuffer_7808d8eabbe18554:function(t,i,r){C(t).bindRenderbuffer(i>>>0,C(r))},__wbg_bindRenderbuffer_c0360bfb79c193c2:function(t,i,r){C(t).bindRenderbuffer(i>>>0,C(r))},__wbg_bindTexture_28d1d695d4801955:function(t,i,r){C(t).bindTexture(i>>>0,C(r))},__wbg_bindTexture_a1a012a31e1419d5:function(t,i,r){C(t).bindTexture(i>>>0,C(r))},__wbg_bindVertexArrayOES_15e48910a5d208b1:function(t,i){C(t).bindVertexArrayOES(C(i))},__wbg_bindVertexArray_4f2f0a7892280041:function(t,i){C(t).bindVertexArray(C(i))},__wbg_blendEquation_1ced323efc9ce0f8:function(t,i){C(t).blendEquation(i>>>0)},__wbg_blendEquation_a12f5acd9d14fb9b:function(t,i){C(t).blendEquation(i>>>0)},__wbg_blendFunc_d5202c7fe94c67ee:function(t,i,r){C(t).blendFunc(i>>>0,r>>>0)},__wbg_blendFunc_fbff85cd0fce280e:function(t,i,r){C(t).blendFunc(i>>>0,r>>>0)},__wbg_blitFramebuffer_acb954bfb30ed714:function(t,i,r,n,s,a,o,l,u,h,d){C(t).blitFramebuffer(i,r,n,s,a,o,l,u,h>>>0,d>>>0)},__wbg_bufferData_043a7e5da22f40d9:function(t,i,r,n){C(t).bufferData(i>>>0,r,n>>>0)},__wbg_bufferData_7b6881381d415425:function(t,i,r,n){C(t).bufferData(i>>>0,C(r),n>>>0)},__wbg_bufferData_9fddca30299e6114:function(t,i,r,n){C(t).bufferData(i>>>0,r,n>>>0)},__wbg_bufferData_f0837cec09725cc0:function(t,i,r,n){C(t).bufferData(i>>>0,C(r),n>>>0)},__wbg_bufferSubData_885e4f8d5833cf11:function(t,i,r,n){C(t).bufferSubData(i>>>0,r,C(n))},__wbg_bufferSubData_8fc824b6a9503f12:function(t,i,r,n){C(t).bufferSubData(i>>>0,r,C(n))},__wbg_call_8a89609d89f6608a:function(){return ti(function(t,i){let r=C(t).call(C(i));return ne(r)},arguments)},__wbg_call_9c758de292015997:function(){return ti(function(t,i,r){let n=C(t).call(C(i),C(r));return ne(n)},arguments)},__wbg_clearBufferfv_2e2858bd8bcf1715:function(t,i,r,n,s){C(t).clearBufferfv(i>>>0,r,ih(n,s))},__wbg_clearBufferiv_e356514eb1d165fe:function(t,i,r,n,s){C(t).clearBufferiv(i>>>0,r,DZ(n,s))},__wbg_compileShader_8810a4868b23621b:function(t,i){C(t).compileShader(C(i))},__wbg_compileShader_ec8d5eb7f2b70a48:function(t,i){C(t).compileShader(C(i))},__wbg_configure_0e4789c0f6b35c8e:function(){return ti(function(t,i){C(t).configure(C(i))},arguments)},__wbg_copyBufferSubData_9936fdf5e53e1832:function(t,i,r,n,s,a){C(t).copyBufferSubData(i>>>0,r>>>0,n,s,a)},__wbg_copyBufferToBuffer_5e2cd8f10ae78183:function(){return ti(function(t,i,r,n,s){C(t).copyBufferToBuffer(C(i),r,C(n),s)},arguments)},__wbg_copyBufferToBuffer_ca30deb8de65f5d5:function(){return ti(function(t,i,r,n,s,a){C(t).copyBufferToBuffer(C(i),r,C(n),s,a)},arguments)},__wbg_copyExternalImageToTexture_4df105bb39517948:function(){return ti(function(t,i,r,n){C(t).copyExternalImageToTexture(C(i),C(r),C(n))},arguments)},__wbg_copyTextureToBuffer_ed6e67a77ecb768d:function(){return ti(function(t,i,r,n){C(t).copyTextureToBuffer(C(i),C(r),C(n))},arguments)},__wbg_createBindGroupLayout_49a7e2b3d076afcf:function(){return ti(function(t,i){let r=C(t).createBindGroupLayout(C(i));return ne(r)},arguments)},__wbg_createBindGroup_655c6e6c0258530e:function(t,i){let r=C(t).createBindGroup(C(i));return ne(r)},__wbg_createBuffer_0726dd2ab09ea1d2:function(){return ti(function(t,i){let r=C(t).createBuffer(C(i));return ne(r)},arguments)},__wbg_createBuffer_333d6aae40284594:function(t){let i=C(t).createBuffer();return ci(i)?0:ne(i)},__wbg_createBuffer_3ae54605e5676c83:function(t){let i=C(t).createBuffer();return ci(i)?0:ne(i)},__wbg_createCommandEncoder_ec1f40f0cb4d09df:function(t,i){let r=C(t).createCommandEncoder(C(i));return ne(r)},__wbg_createComputePipelineAsync_afe7021ac5a02993:function(t,i){let r=C(t).createComputePipelineAsync(C(i));return ne(r)},__wbg_createFramebuffer_6f42ff976bb98152:function(t){let i=C(t).createFramebuffer();return ci(i)?0:ne(i)},__wbg_createFramebuffer_ef1247e8b2e9b09f:function(t){let i=C(t).createFramebuffer();return ci(i)?0:ne(i)},__wbg_createPipelineLayout_2c8cd4528b06c108:function(t,i){let r=C(t).createPipelineLayout(C(i));return ne(r)},__wbg_createProgram_b48c3323af547213:function(t){let i=C(t).createProgram();return ci(i)?0:ne(i)},__wbg_createProgram_f6a8df4491031d57:function(t){let i=C(t).createProgram();return ci(i)?0:ne(i)},__wbg_createQuerySet_cb7b21d1d405b890:function(){return ti(function(t,i){let r=C(t).createQuerySet(C(i));return ne(r)},arguments)},__wbg_createRenderPipelineAsync_eecad1e54ef27acf:function(t,i){let r=C(t).createRenderPipelineAsync(C(i));return ne(r)},__wbg_createRenderPipeline_cf98d4d699bfb03c:function(){return ti(function(t,i){let r=C(t).createRenderPipeline(C(i));return ne(r)},arguments)},__wbg_createRenderbuffer_a2f947c7fa8c8bf0:function(t){let i=C(t).createRenderbuffer();return ci(i)?0:ne(i)},__wbg_createRenderbuffer_c09d5809ac95924e:function(t){let i=C(t).createRenderbuffer();return ci(i)?0:ne(i)},__wbg_createSampler_c8ffb3c8d565f704:function(t,i){let r=C(t).createSampler(C(i));return ne(r)},__wbg_createShaderModule_2e44fc7677c6288b:function(t,i){let r=C(t).createShaderModule(C(i));return ne(r)},__wbg_createShader_0e3f814b69e9e184:function(t,i){let r=C(t).createShader(i>>>0);return ci(r)?0:ne(r)},__wbg_createShader_383b3295276271d2:function(t,i){let r=C(t).createShader(i>>>0);return ci(r)?0:ne(r)},__wbg_createTexture_1bac74c999b8a48e:function(){return ti(function(t,i){let r=C(t).createTexture(C(i));return ne(r)},arguments)},__wbg_createTexture_461a3048c40e7175:function(t){let i=C(t).createTexture();return ci(i)?0:ne(i)},__wbg_createTexture_d6e2c1f04a554a15:function(t){let i=C(t).createTexture();return ci(i)?0:ne(i)},__wbg_createVertexArrayOES_2f67d3679ba9a29c:function(t){let i=C(t).createVertexArrayOES();return ci(i)?0:ne(i)},__wbg_createVertexArray_febd1d11636d15ad:function(t){let i=C(t).createVertexArray();return ci(i)?0:ne(i)},__wbg_createView_ceaf2f5881adbd34:function(){return ti(function(t,i){let r=C(t).createView(C(i));return ne(r)},arguments)},__wbg_cullFace_a4ee8b8c3c126388:function(t,i){C(t).cullFace(i>>>0)},__wbg_cullFace_c6b39a55ccade015:function(t,i){C(t).cullFace(i>>>0)},__wbg_currentTime_0b40b60bc76843cb:function(t){return C(t).currentTime},__wbg_debug_78b457f1effb3792:function(t){console.debug(C(t))},__wbg_deleteBuffer_520156dc8a1f81af:function(t,i){C(t).deleteBuffer(C(i))},__wbg_deleteBuffer_a925fdd1b590fbbc:function(t,i){C(t).deleteBuffer(C(i))},__wbg_deleteFramebuffer_aa4bf9f184123318:function(t,i){C(t).deleteFramebuffer(C(i))},__wbg_deleteFramebuffer_cc043e5a8cb9a556:function(t,i){C(t).deleteFramebuffer(C(i))},__wbg_deleteProgram_0c859ebcab2b7b5a:function(t,i){C(t).deleteProgram(C(i))},__wbg_deleteProgram_df6a6609c7d91a6e:function(t,i){C(t).deleteProgram(C(i))},__wbg_deleteRenderbuffer_37c079dbc257fcf9:function(t,i){C(t).deleteRenderbuffer(C(i))},__wbg_deleteRenderbuffer_4b7a888363766554:function(t,i){C(t).deleteRenderbuffer(C(i))},__wbg_deleteShader_170dea06bd074d01:function(t,i){C(t).deleteShader(C(i))},__wbg_deleteShader_944accd60733a9cb:function(t,i){C(t).deleteShader(C(i))},__wbg_deleteTexture_54dee8e15570751e:function(t,i){C(t).deleteTexture(C(i))},__wbg_deleteTexture_be3eaabebb89a85e:function(t,i){C(t).deleteTexture(C(i))},__wbg_deleteVertexArrayOES_4262d2d0e9fb77c5:function(t,i){C(t).deleteVertexArrayOES(C(i))},__wbg_deleteVertexArray_8f0fb3b3d54c7483:function(t,i){C(t).deleteVertexArray(C(i))},__wbg_depthMask_95332b64c5ef8b45:function(t,i){C(t).depthMask(i!==0)},__wbg_depthMask_f55bea4b6c3b9531:function(t,i){C(t).depthMask(i!==0)},__wbg_description_02485704e69b1e7f:function(t,i){let r=C(i).description,n=As(r,de.__wbindgen_export,de.__wbindgen_export2),s=On;di().setInt32(t+4,s,!0),di().setInt32(t+0,n,!0)},__wbg_disable_2cf98ccb81612ef9:function(t,i){C(t).disable(i>>>0)},__wbg_disable_6b825656c54f5646:function(t,i){C(t).disable(i>>>0)},__wbg_dispatchWorkgroups_afb2344298c62227:function(t,i,r,n){C(t).dispatchWorkgroups(i>>>0,r>>>0,n>>>0)},__wbg_displayHeight_465673c1823a1db3:function(t){return C(t).displayHeight},__wbg_displayWidth_73729fd8eb965076:function(t){return C(t).displayWidth},__wbg_disposeVideo_c94c1ccd57a63f68:function(t){HB(C(t))},__wbg_document_aceb08cd6489baf5:function(t){let i=C(t).document;return ci(i)?0:ne(i)},__wbg_done_60cf307fcc680536:function(t){return C(t).done},__wbg_drawArrays_6eb87620c1dcbfb4:function(t,i,r,n){C(t).drawArrays(i>>>0,r,n)},__wbg_drawArrays_f332b526550a641e:function(t,i,r,n){C(t).drawArrays(i>>>0,r,n)},__wbg_drawBuffersWEBGL_10cdfe87c17cd93f:function(t,i){C(t).drawBuffersWEBGL(C(i))},__wbg_drawBuffers_c5a9ee312b2d6fa8:function(t,i){C(t).drawBuffers(C(i))},__wbg_drawElements_23ec4847dad548e0:function(t,i,r,n,s){C(t).drawElements(i>>>0,r,n>>>0,s)},__wbg_drawElements_fe4671e9c358058d:function(t,i,r,n,s){C(t).drawElements(i>>>0,r,n>>>0,s)},__wbg_drawIndexed_d31913e79d58fbac:function(t,i,r,n,s,a){C(t).drawIndexed(i>>>0,r>>>0,n>>>0,s,a>>>0)},__wbg_draw_6877f98847e1e36c:function(t,i,r,n,s){C(t).draw(i>>>0,r>>>0,n>>>0,s>>>0)},__wbg_duration_d6a6a568a0baf72d:function(t){return C(t).duration},__wbg_enableVertexAttribArray_cc09a0312b6adee5:function(t,i){C(t).enableVertexAttribArray(i>>>0)},__wbg_enableVertexAttribArray_f88d3d499ab40ea6:function(t,i){C(t).enableVertexAttribArray(i>>>0)},__wbg_enable_1928c361308989d5:function(t,i){C(t).enable(i>>>0)},__wbg_enable_2cc4ff32a0fd985f:function(t,i){C(t).enable(i>>>0)},__wbg_end_c36889de8ddef882:function(t){C(t).end()},__wbg_end_f99ebed53d4e198a:function(t){C(t).end()},__wbg_engine_new:function(t){let i=nm.__wrap(t);return ne(i)},__wbg_entries_04b37a02507f1713:function(t){let i=Object.entries(C(t));return ne(i)},__wbg_error_78ff5b3a29b770e0:function(t){console.error(C(t))},__wbg_error_a6fa202b58aa1cd3:function(t,i){let r,n;try{r=t,n=i,console.error(Hi(t,i))}finally{de.__wbindgen_export4(r,n,1)}},__wbg_features_2b07a28fe18ad0ce:function(t){let i=C(t).features;return ne(i)},__wbg_features_d4d2020319592cbe:function(t){let i=C(t).features;return ne(i)},__wbg_fetch_ce1af4d1b59a60be:function(t,i){let r=C(t).fetch(C(i));return ne(r)},__wbg_finish_4d91de5e927dd13f:function(t,i){let r=C(t).finish(C(i));return ne(r)},__wbg_finish_6e06b68ab68cd9f6:function(t){let i=C(t).finish();return ne(i)},__wbg_flush_2088ebca1fd13068:function(t){C(t).flush()},__wbg_flush_3be48fce9f195fa5:function(t){C(t).flush()},__wbg_framebufferRenderbuffer_0c9d0e5587497683:function(t,i,r,n,s){C(t).framebufferRenderbuffer(i>>>0,r>>>0,n>>>0,C(s))},__wbg_framebufferRenderbuffer_599e58ad30dcfeb3:function(t,i,r,n,s){C(t).framebufferRenderbuffer(i>>>0,r>>>0,n>>>0,C(s))},__wbg_framebufferTexture2D_44caed1725e57636:function(t,i,r,n,s,a){C(t).framebufferTexture2D(i>>>0,r>>>0,n>>>0,C(s),a)},__wbg_framebufferTexture2D_fbba21b750c2316a:function(t,i,r,n,s,a){C(t).framebufferTexture2D(i>>>0,r>>>0,n>>>0,C(s),a)},__wbg_from_d300fe49deab18f5:function(t){let i=Array.from(C(t));return ne(i)},__wbg_generateMipmap_1403959fc241438f:function(t,i){C(t).generateMipmap(i>>>0)},__wbg_generateMipmap_b261c040d5707fe5:function(t,i){C(t).generateMipmap(i>>>0)},__wbg_getActiveUniform_3a275fd8fdf7a327:function(t,i,r){let n=C(t).getActiveUniform(C(i),r>>>0);return ci(n)?0:ne(n)},__wbg_getActiveUniform_86f7a30e1a52aca4:function(t,i,r){let n=C(t).getActiveUniform(C(i),r>>>0);return ci(n)?0:ne(n)},__wbg_getContext_469d34698d869fc1:function(){return ti(function(t,i,r){let n=C(t).getContext(Hi(i,r));return ci(n)?0:ne(n)},arguments)},__wbg_getContext_5b39fff76491fded:function(){return ti(function(t,i,r,n){let s=C(t).getContext(Hi(i,r),C(n));return ci(s)?0:ne(s)},arguments)},__wbg_getContext_7d3a8f461c828713:function(){return ti(function(t,i,r){let n=C(t).getContext(Hi(i,r));return ci(n)?0:ne(n)},arguments)},__wbg_getCurrentTexture_20714d1bd9051cab:function(){return ti(function(t){let i=C(t).getCurrentTexture();return ne(i)},arguments)},__wbg_getExtension_454cdc5ffd07bf03:function(){return ti(function(t,i,r){let n=C(t).getExtension(Hi(i,r));return ci(n)?0:ne(n)},arguments)},__wbg_getMappedRange_d0bf3141224111b6:function(){return ti(function(t,i,r){let n=C(t).getMappedRange(i,r);return ne(n)},arguments)},__wbg_getParameter_015942a7ad566b20:function(){return ti(function(t,i){let r=C(t).getParameter(i>>>0);return ne(r)},arguments)},__wbg_getParameter_1e77e23f5ccf0300:function(){return ti(function(t,i){let r=C(t).getParameter(i>>>0);return ne(r)},arguments)},__wbg_getPreferredCanvasFormat_8b57039d1801a506:function(t){let i=C(t).getPreferredCanvasFormat();return(s0.indexOf(i)+1||102)-1},__wbg_getProgramInfoLog_2f9cfcecc4f772e1:function(t,i,r){let n=C(i).getProgramInfoLog(C(r));var s=ci(n)?0:As(n,de.__wbindgen_export,de.__wbindgen_export2),a=On;di().setInt32(t+4,a,!0),di().setInt32(t+0,s,!0)},__wbg_getProgramInfoLog_f0d48f606547aed7:function(t,i,r){let n=C(i).getProgramInfoLog(C(r));var s=ci(n)?0:As(n,de.__wbindgen_export,de.__wbindgen_export2),a=On;di().setInt32(t+4,a,!0),di().setInt32(t+0,s,!0)},__wbg_getProgramParameter_08beabb2736d5769:function(t,i,r){let n=C(t).getProgramParameter(C(i),r>>>0);return ne(n)},__wbg_getProgramParameter_aee848e1db52b7cd:function(t,i,r){let n=C(t).getProgramParameter(C(i),r>>>0);return ne(n)},__wbg_getRandomValues_3f44b700395062e5:function(){return ti(function(t,i){globalThis.crypto.getRandomValues(im(t,i))},arguments)},__wbg_getRandomValues_bf16787eede473f5:function(){return ti(function(t,i){globalThis.crypto.getRandomValues(im(t,i))},arguments)},__wbg_getShaderInfoLog_510365af17f29a35:function(t,i,r){let n=C(i).getShaderInfoLog(C(r));var s=ci(n)?0:As(n,de.__wbindgen_export,de.__wbindgen_export2),a=On;di().setInt32(t+4,a,!0),di().setInt32(t+0,s,!0)},__wbg_getShaderInfoLog_cd77c7b7bdb9ce65:function(t,i,r){let n=C(i).getShaderInfoLog(C(r));var s=ci(n)?0:As(n,de.__wbindgen_export,de.__wbindgen_export2),a=On;di().setInt32(t+4,a,!0),di().setInt32(t+0,s,!0)},__wbg_getSupportedExtensions_7a31b3412a25d9ba:function(t){let i=C(t).getSupportedExtensions();return ci(i)?0:ne(i)},__wbg_getUniformLocation_010256f946f9a865:function(t,i,r,n){let s=C(t).getUniformLocation(C(i),Hi(r,n));return ci(s)?0:ne(s)},__wbg_getUniformLocation_f9774d4f157f5914:function(t,i,r,n){let s=C(t).getUniformLocation(C(i),Hi(r,n));return ci(s)?0:ne(s)},__wbg_get_1f8f054ddbaa7db2:function(){return ti(function(t,i){let r=Reflect.get(C(t),C(i));return ne(r)},arguments)},__wbg_get_2b48c7d0d006a781:function(t,i){let r=C(t)[i>>>0];return ne(r)},__wbg_get_cb935c1402921898:function(t,i){let r=C(t)[i>>>0];return ci(r)?0:ne(r)},__wbg_get_de6a0f7d4d18a304:function(){return ti(function(t,i){let r=Reflect.get(C(t),C(i));return ne(r)},arguments)},__wbg_get_index_ab123d64c89e3156:function(t,i){return C(t)[i>>>0]},__wbg_get_unchecked_33f6e5c9e2f2d6b2:function(t,i){let r=C(t)[i>>>0];return ne(r)},__wbg_get_with_ref_key_6412cf3094599694:function(t,i){let r=C(t)[C(i)];return ne(r)},__wbg_get_with_ref_key_7e638bba08a44478:function(t,i){let r=C(t)[C(i)];return ne(r)},__wbg_gpu_2ccc250735d24a2a:function(t){let i=C(t).gpu;return ne(i)},__wbg_has_0c97053e877f47cc:function(t,i,r){return C(t).has(Hi(i,r))},__wbg_has_73740b27f436fed3:function(){return ti(function(t,i){return Reflect.has(C(t),C(i))},arguments)},__wbg_height_4e7694e4e2110bdb:function(t){return C(t).height},__wbg_info_af7f45292ba9b0ea:function(t){console.info(C(t))},__wbg_info_cf0d9a286850cd24:function(t){let i=C(t).info;return ne(i)},__wbg_innerHeight_8b6ee2571dbedb9d:function(){return ti(function(t){let i=C(t).innerHeight;return ne(i)},arguments)},__wbg_innerWidth_7475bec19f48fe43:function(){return ti(function(t){let i=C(t).innerWidth;return ne(i)},arguments)},__wbg_instanceof_ArrayBuffer_8f49811467741499:function(t){let i;try{i=C(t)instanceof ArrayBuffer}catch{i=!1}return i},__wbg_instanceof_GpuOutOfMemoryError_6429c750997f1c8d:function(t){let i;try{i=C(t)instanceof GPUOutOfMemoryError}catch{i=!1}return i},__wbg_instanceof_GpuValidationError_75fa3611f065f4df:function(t){let i;try{i=C(t)instanceof GPUValidationError}catch{i=!1}return i},__wbg_instanceof_HtmlVideoElement_95590e1ff107ba83:function(t){let i;try{i=C(t)instanceof HTMLVideoElement}catch{i=!1}return i},__wbg_instanceof_ImageBitmap_beed1259521cd66d:function(t){let i;try{i=C(t)instanceof ImageBitmap}catch{i=!1}return i},__wbg_instanceof_Response_cb984bd66d7bd408:function(t){let i;try{i=C(t)instanceof Response}catch{i=!1}return i},__wbg_instanceof_Uint8Array_86f30649f63ef9c2:function(t){let i;try{i=C(t)instanceof Uint8Array}catch{i=!1}return i},__wbg_instanceof_WebGl2RenderingContext_39d13e3f953130c7:function(t){let i;try{i=C(t)instanceof WebGL2RenderingContext}catch{i=!1}return i},__wbg_instanceof_Window_e093be59ee9a8e14:function(t){let i;try{i=C(t)instanceof Window}catch{i=!1}return i},__wbg_invalidateFramebuffer_6b8dae55a3debb1d:function(){return ti(function(t,i,r){C(t).invalidateFramebuffer(i>>>0,C(r))},arguments)},__wbg_isArray_67c2c9c4313f4448:function(t){return Array.isArray(C(t))},__wbg_isFallbackAdapter_8ccb967428491dcb:function(t){return C(t).isFallbackAdapter},__wbg_isSafeInteger_66acec27e09e99a7:function(t){return Number.isSafeInteger(C(t))},__wbg_iterator_8732428d309e270e:function(){return ne(Symbol.iterator)},__wbg_label_7ed42f25f841996b:function(t,i){let r=C(i).label,n=As(r,de.__wbindgen_export,de.__wbindgen_export2),s=On;di().setInt32(t+4,s,!0),di().setInt32(t+0,n,!0)},__wbg_length_280688879ee7deb5:function(t){return C(t).length},__wbg_length_4a591ecaa01354d9:function(t){return C(t).length},__wbg_length_66f1a4b2e9026940:function(t){return C(t).length},__wbg_limits_20c6f56636df7d38:function(t){let i=C(t).limits;return ne(i)},__wbg_limits_328c61cd41512420:function(t){let i=C(t).limits;return ne(i)},__wbg_linkProgram_3ccc9beaa6dace28:function(t,i){C(t).linkProgram(C(i))},__wbg_linkProgram_fe2b1bf26336c4a5:function(t,i){C(t).linkProgram(C(i))},__wbg_loadImageFromBytes_3d42766b73aca4ca:function(t){let i=gZ(ii(t));return ne(i)},__wbg_loadImageFromUrl_50be99dbf040255b:function(t,i){let r,n;try{r=t,n=i;let s=vZ(Hi(t,i));return ne(s)}finally{de.__wbindgen_export4(r,n,1)}},__wbg_loadVideoFromBytes_3d884aadcf4d2139:function(t){let i=bZ(ii(t));return ne(i)},__wbg_loadVideoFromUrl_7997ffb030d4b08b:function(t,i){let r,n;try{r=t,n=i;let s=xZ(Hi(t,i));return ne(s)}finally{de.__wbindgen_export4(r,n,1)}},__wbg_location_efdf1fea18b5552a:function(t){let i=C(t).location;return ne(i)},__wbg_log_cf2e968649f3384e:function(t){console.log(C(t))},__wbg_lost_0fa164c88f543338:function(t){let i=C(t).lost;return ne(i)},__wbg_mapAsync_52b01fa9e8f765fd:function(t,i,r,n){let s=C(t).mapAsync(i>>>0,r,n);return ne(s)},__wbg_maxBindGroupsPlusVertexBuffers_33e5006b23e20478:function(t){return C(t).maxBindGroupsPlusVertexBuffers},__wbg_maxBindGroups_f6d26f3a67826666:function(t){return C(t).maxBindGroups},__wbg_maxBindingsPerBindGroup_edab2e8dabbf6060:function(t){return C(t).maxBindingsPerBindGroup},__wbg_maxBufferSize_bbc69284c14aa7da:function(t){return C(t).maxBufferSize},__wbg_maxColorAttachmentBytesPerSample_63ebe4f81de2f34c:function(t){return C(t).maxColorAttachmentBytesPerSample},__wbg_maxColorAttachments_aed8c38beabf3a5c:function(t){return C(t).maxColorAttachments},__wbg_maxComputeInvocationsPerWorkgroup_2d964564c37f1c65:function(t){return C(t).maxComputeInvocationsPerWorkgroup},__wbg_maxComputeWorkgroupSizeX_a3e3206570da184f:function(t){return C(t).maxComputeWorkgroupSizeX},__wbg_maxComputeWorkgroupSizeY_dffa4a62244b7563:function(t){return C(t).maxComputeWorkgroupSizeY},__wbg_maxComputeWorkgroupSizeZ_976ebcb760f6d07d:function(t){return C(t).maxComputeWorkgroupSizeZ},__wbg_maxComputeWorkgroupStorageSize_2e8dbece6e532e2a:function(t){return C(t).maxComputeWorkgroupStorageSize},__wbg_maxComputeWorkgroupsPerDimension_bb7d36b4d20c80f4:function(t){return C(t).maxComputeWorkgroupsPerDimension},__wbg_maxDynamicStorageBuffersPerPipelineLayout_1ca859cb96a414e0:function(t){return C(t).maxDynamicStorageBuffersPerPipelineLayout},__wbg_maxDynamicUniformBuffersPerPipelineLayout_e968f2c8cd8f4d46:function(t){return C(t).maxDynamicUniformBuffersPerPipelineLayout},__wbg_maxInterStageShaderVariables_138ac882c4d6a3d3:function(t){return C(t).maxInterStageShaderVariables},__wbg_maxSampledTexturesPerShaderStage_bb3e6b2698321fa6:function(t){return C(t).maxSampledTexturesPerShaderStage},__wbg_maxSamplersPerShaderStage_98c00a1829fa414b:function(t){return C(t).maxSamplersPerShaderStage},__wbg_maxStorageBufferBindingSize_e500e31f479e669e:function(t){return C(t).maxStorageBufferBindingSize},__wbg_maxStorageBuffersPerShaderStage_eb663f6d7521b6a7:function(t){return C(t).maxStorageBuffersPerShaderStage},__wbg_maxStorageTexturesPerShaderStage_bb3ad93b53e618c0:function(t){return C(t).maxStorageTexturesPerShaderStage},__wbg_maxTextureArrayLayers_2a56d05fb261c99a:function(t){return C(t).maxTextureArrayLayers},__wbg_maxTextureDimension1D_84590c1d4770d319:function(t){return C(t).maxTextureDimension1D},__wbg_maxTextureDimension2D_7f2b5c8b2727e3fc:function(t){return C(t).maxTextureDimension2D},__wbg_maxTextureDimension3D_7f3babddf55c32a6:function(t){return C(t).maxTextureDimension3D},__wbg_maxUniformBufferBindingSize_d80a09e23c0b284c:function(t){return C(t).maxUniformBufferBindingSize},__wbg_maxUniformBuffersPerShaderStage_0b8b2de676fa740e:function(t){return C(t).maxUniformBuffersPerShaderStage},__wbg_maxVertexAttributes_a693dd921316649b:function(t){return C(t).maxVertexAttributes},__wbg_maxVertexBufferArrayStride_f256d91f281076cb:function(t){return C(t).maxVertexBufferArrayStride},__wbg_maxVertexBuffers_70ab564b25d5ac20:function(t){return C(t).maxVertexBuffers},__wbg_message_28959d6ca4d7dda0:function(t,i){let r=C(i).message,n=As(r,de.__wbindgen_export,de.__wbindgen_export2),s=On;di().setInt32(t+4,s,!0),di().setInt32(t+0,n,!0)},__wbg_message_4ada57a3710f1502:function(t,i){let r=C(i).message,n=As(r,de.__wbindgen_export,de.__wbindgen_export2),s=On;di().setInt32(t+4,s,!0),di().setInt32(t+0,n,!0)},__wbg_minStorageBufferOffsetAlignment_3248ed00dcdbf79f:function(t){return C(t).minStorageBufferOffsetAlignment},__wbg_minUniformBufferOffsetAlignment_3b9fa4caae03e903:function(t){return C(t).minUniformBufferOffsetAlignment},__wbg_name_b7fa2500fc153b89:function(t,i){let r=C(i).name,n=As(r,de.__wbindgen_export,de.__wbindgen_export2),s=On;di().setInt32(t+4,s,!0),di().setInt32(t+0,n,!0)},__wbg_navigator_3833ecdbc19d2757:function(t){let i=C(t).navigator;return ne(i)},__wbg_navigator_391291470f58c650:function(t){let i=C(t).navigator;return ne(i)},__wbg_new_227d7c05414eb861:function(){let t=new Error;return ne(t)},__wbg_new_3b242422c588a8f3:function(){return ti(function(t,i){let r=new OffscreenCanvas(t>>>0,i>>>0);return ne(r)},arguments)},__wbg_new_578aeef4b6b94378:function(t){let i=new Uint8Array(C(t));return ne(i)},__wbg_new_b682b81e8eaaf027:function(t,i){try{var r={a:t,b:i},n=(a,o)=>{let l=r.a;r.a=0;try{return SZ(l,r.b,a,o)}finally{r.a=l}};let s=new Promise(n);return ne(s)}finally{r.a=0}},__wbg_new_ce1ab61c1c2b300d:function(){let t=new Object;return ne(t)},__wbg_new_d90091b82fdf5b91:function(){let t=new Array;return ne(t)},__wbg_new_from_slice_18fa1f71286d66b8:function(t,i){let r=new Uint8Array(im(t,i));return ne(r)},__wbg_new_from_slice_3c93d0bc613de8f0:function(t,i){let r=new Float64Array(PPe(t,i));return ne(r)},__wbg_new_from_slice_47be4219028de35d:function(t,i){let r=new Uint32Array(jw(t,i));return ne(r)},__wbg_new_from_slice_956df4f769fb782c:function(t,i){let r=new Float32Array(ih(t,i));return ne(r)},__wbg_new_typed_41c97238ee4583e3:function(){let t=new Object;return ne(t)},__wbg_new_typed_bf31d18f92484486:function(t,i){try{var r={a:t,b:i},n=(a,o)=>{let l=r.a;r.a=0;try{return SZ(l,r.b,a,o)}finally{r.a=l}};let s=new Promise(n);return ne(s)}finally{r.a=0}},__wbg_new_with_byte_offset_and_length_d836f26d916dd9ad:function(t,i,r){let n=new Uint8Array(C(t),i>>>0,r>>>0);return ne(n)},__wbg_new_with_length_36a4998e27b014c5:function(t){let i=new Uint8Array(t>>>0);return ne(i)},__wbg_new_with_length_b4a87ccced374381:function(t){let i=new Float64Array(t>>>0);return ne(i)},__wbg_new_with_str_and_init_bcd02b79a793d27f:function(){return ti(function(t,i,r){let n=new Request(Hi(t,i),C(r));return ne(n)},arguments)},__wbg_next_9e03acdf51c4960d:function(t){let i=C(t).next;return ne(i)},__wbg_next_eb8ca7351fa27906:function(){return ti(function(t){let i=C(t).next();return ne(i)},arguments)},__wbg_now_f565250295e2d180:function(t){return C(t).now()},__wbg_of_57145fdec12d159f:function(t){let i=Array.of(C(t));return ne(i)},__wbg_ok_fb13c30bc1893039:function(t){return C(t).ok},__wbg_onSubmittedWorkDone_270d6b5a45520e79:function(t){let i=C(t).onSubmittedWorkDone();return ne(i)},__wbg_open_177ad1dcc06b9106:function(){return ti(function(t,i,r,n,s,a,o){let l=C(t).open(Hi(i,r),Hi(n,s),Hi(a,o));return ci(l)?0:ne(l)},arguments)},__wbg_open_feb75fe4d9971c50:function(){return ti(function(t,i,r,n,s){let a=C(t).open(Hi(i,r),Hi(n,s));return ci(a)?0:ne(a)},arguments)},__wbg_ownKeys_0587b8fe286a40e6:function(){return ti(function(t){let i=Reflect.ownKeys(C(t));return ne(i)},arguments)},__wbg_pause_adce2b37e004ae49:function(){return ti(function(t){C(t).pause()},arguments)},__wbg_performance_68499ca0718837f5:function(t){let i=C(t).performance;return ci(i)?0:ne(i)},__wbg_pixelStorei_6e42d231aa75bd00:function(t,i,r){C(t).pixelStorei(i>>>0,r)},__wbg_pixelStorei_84dc1952dc699c94:function(t,i,r){C(t).pixelStorei(i>>>0,r)},__wbg_play_4ed9ece3cae2c100:function(){return ti(function(t){let i=C(t).play();return ne(i)},arguments)},__wbg_popErrorScope_8e7f4cbff8b758dd:function(t){let i=C(t).popErrorScope();return ne(i)},__wbg_prototypesetcall_3249fc62a0fafa30:function(t,i,r){Uint8Array.prototype.set.call(im(t,i),C(r))},__wbg_prototypesetcall_59640349d2c6d881:function(t,i,r){Uint32Array.prototype.set.call(jw(t,i),C(r))},__wbg_provokingVertexWEBGL_0354dc7ad44d69bf:function(t,i){C(t).provokingVertexWEBGL(i>>>0)},__wbg_pushErrorScope_fa23d1206bc26dce:function(t,i){C(t).pushErrorScope(fPe[i])},__wbg_push_a6822215aa43e71c:function(t,i){return C(t).push(C(i))},__wbg_querySelectorAll_4dcc230a2f8a2498:function(){return ti(function(t,i,r){let n=C(t).querySelectorAll(Hi(i,r));return ne(n)},arguments)},__wbg_queueMicrotask_35c611f4a14830b2:function(t){queueMicrotask(C(t))},__wbg_queueMicrotask_404ed0a58e0b63cc:function(t){let i=C(t).queueMicrotask;return ne(i)},__wbg_queue_adce34608fd0c893:function(t){let i=C(t).queue;return ne(i)},__wbg_readBuffer_2027f7cdd7533f2d:function(t,i){C(t).readBuffer(i>>>0)},__wbg_readPixels_a04f5cf5019be695:function(){return ti(function(t,i,r,n,s,a,o,l){C(t).readPixels(i,r,n,s,a>>>0,o>>>0,C(l))},arguments)},__wbg_readPixels_bf9ee726d9179d3c:function(){return ti(function(t,i,r,n,s,a,o,l){C(t).readPixels(i,r,n,s,a>>>0,o>>>0,C(l))},arguments)},__wbg_readPixels_d00c1cae608273d8:function(){return ti(function(t,i,r,n,s,a,o,l){C(t).readPixels(i,r,n,s,a>>>0,o>>>0,l)},arguments)},__wbg_readyState_77b1b1db1b8c2a5f:function(t){return C(t).readyState},__wbg_reason_b02cd587d1a09948:function(t){let i=C(t).reason;return(pPe.indexOf(i)+1||3)-1},__wbg_renderbufferStorageMultisample_75bba97a8e59bc6e:function(t,i,r,n,s,a){C(t).renderbufferStorageMultisample(i>>>0,r,n>>>0,s,a)},__wbg_renderbufferStorage_3f5b0ec8fca2f9f8:function(t,i,r,n,s){C(t).renderbufferStorage(i>>>0,r>>>0,n,s)},__wbg_renderbufferStorage_c34a47cacbbc5fff:function(t,i,r,n,s){C(t).renderbufferStorage(i>>>0,r>>>0,n,s)},__wbg_requestAdapter_2e6718811c735a57:function(t,i){let r=C(t).requestAdapter(C(i));return ne(r)},__wbg_requestDevice_ab46d0519ea1cc34:function(t,i){let r=C(t).requestDevice(C(i));return ne(r)},__wbg_resolveQuerySet_0f32dc3de3f09701:function(t,i,r,n,s,a){C(t).resolveQuerySet(C(i),r>>>0,n>>>0,C(s),a>>>0)},__wbg_resolve_25a7e548d5881dca:function(t){let i=Promise.resolve(C(t));return ne(i)},__wbg_scissor_079b7c4a5c9fcb63:function(t,i,r,n,s){C(t).scissor(i,r,n,s)},__wbg_scissor_e69faa631ab6fdc0:function(t,i,r,n,s){C(t).scissor(i,r,n,s)},__wbg_setBindGroup_268fd1714fff0ef5:function(){return ti(function(t,i,r,n,s,a,o){C(t).setBindGroup(i>>>0,C(r),jw(n,s),a,o>>>0)},arguments)},__wbg_setBindGroup_3e4ce136bc833ea1:function(){return ti(function(t,i,r,n,s,a,o){C(t).setBindGroup(i>>>0,C(r),jw(n,s),a,o>>>0)},arguments)},__wbg_setBindGroup_c22a1b95c0b17f37:function(t,i,r){C(t).setBindGroup(i>>>0,C(r))},__wbg_setBindGroup_f0de6cb2c7dbfc2c:function(t,i,r){C(t).setBindGroup(i>>>0,C(r))},__wbg_setIndexBuffer_2531a9103450445e:function(t,i,r,n){C(t).setIndexBuffer(C(i),$B[r],n)},__wbg_setIndexBuffer_7f3cf667b4d71566:function(t,i,r,n,s){C(t).setIndexBuffer(C(i),$B[r],n,s)},__wbg_setPipeline_c41bf46790f27f9e:function(t,i){C(t).setPipeline(C(i))},__wbg_setPipeline_d73f019e98c76d2d:function(t,i){C(t).setPipeline(C(i))},__wbg_setStencilReference_66c74be6232bb9da:function(t,i){C(t).setStencilReference(i>>>0)},__wbg_setTimeout_b5f25e402b6e8ff9:function(){return ti(function(t,i,r){return C(t).setTimeout(C(i),r)},arguments)},__wbg_setVertexBuffer_1e448859663dd400:function(t,i,r,n){C(t).setVertexBuffer(i>>>0,C(r),n)},__wbg_setVertexBuffer_7cf533d694e747f3:function(t,i,r,n,s){C(t).setVertexBuffer(i>>>0,C(r),n,s)},__wbg_setViewport_d9fc3eac343de7d0:function(t,i,r,n,s,a,o){C(t).setViewport(i,r,n,s,a,o)},__wbg_set_29c99a8aac1c01e5:function(t,i,r){C(t).set(im(i,r))},__wbg_set_6e30c9374c26414c:function(){return ti(function(t,i,r){return Reflect.set(C(t),C(i),C(r))},arguments)},__wbg_set_6f7e2d6e41d9a122:function(t,i,r){C(t)[ii(i)]=ii(r)},__wbg_set_a_88262a42340d0b1c:function(t,i){C(t).a=i},__wbg_set_access_9a5092f05dc45fad:function(t,i){C(t).access=xPe[i]},__wbg_set_address_mode_u_9e2695575a219e33:function(t,i){C(t).addressModeU=WB[i]},__wbg_set_address_mode_v_f479b2e6cccbcac4:function(t,i){C(t).addressModeV=WB[i]},__wbg_set_address_mode_w_46273e153230180d:function(t,i){C(t).addressModeW=WB[i]},__wbg_set_alpha_bfd2df62e7bc581b:function(t,i){C(t).alpha=C(i)},__wbg_set_alpha_mode_df805952892caa9c:function(t,i){C(t).alphaMode=uPe[i]},__wbg_set_alpha_to_coverage_enabled_8b5dc2b0a225b3b2:function(t,i){C(t).alphaToCoverageEnabled=i!==0},__wbg_set_array_layer_count_7312f0f31af94e7c:function(t,i){C(t).arrayLayerCount=i>>>0},__wbg_set_array_stride_f64_27ffaf4fffd74e61:function(t,i){C(t).arrayStride=i},__wbg_set_aspect_0d453bca3d012f02:function(t,i){C(t).aspect=ZB[i]},__wbg_set_aspect_210da747c9d77aba:function(t,i){C(t).aspect=ZB[i]},__wbg_set_aspect_4962514fe99e68e6:function(t,i){C(t).aspect=ZB[i]},__wbg_set_attributes_7537844a7e6dafdc:function(t,i,r){C(t).attributes=Tu(i,r)},__wbg_set_b_c47befe0af3261eb:function(t,i){C(t).b=i},__wbg_set_base_array_layer_f176bb9f1b37b342:function(t,i){C(t).baseArrayLayer=i>>>0},__wbg_set_base_mip_level_1df145d9f8db32a9:function(t,i){C(t).baseMipLevel=i>>>0},__wbg_set_beginning_of_pass_write_index_0d4fa06109208ad7:function(t,i){C(t).beginningOfPassWriteIndex=i>>>0},__wbg_set_beginning_of_pass_write_index_e9f5d016947893bd:function(t,i){C(t).beginningOfPassWriteIndex=i>>>0},__wbg_set_bind_group_layouts_5a9cfea401c020ab:function(t,i,r){C(t).bindGroupLayouts=Tu(i,r)},__wbg_set_binding_155b0440b4307793:function(t,i){C(t).binding=i>>>0},__wbg_set_binding_f74df3510792aba1:function(t,i){C(t).binding=i>>>0},__wbg_set_blend_7493c2066c3e9970:function(t,i){C(t).blend=C(i)},__wbg_set_buffer_9c01e3b6d6765ea2:function(t,i){C(t).buffer=C(i)},__wbg_set_buffer_c3410572051920ba:function(t,i){C(t).buffer=C(i)},__wbg_set_buffer_ef7f75306cf663ed:function(t,i){C(t).buffer=C(i)},__wbg_set_buffers_7d0d8f507699e956:function(t,i,r){C(t).buffers=Tu(i,r)},__wbg_set_bytes_per_row_c54ca96953f35774:function(t,i){C(t).bytesPerRow=i>>>0},__wbg_set_bytes_per_row_d69b88eee3929c07:function(t,i){C(t).bytesPerRow=i>>>0},__wbg_set_c775d84916be79ea:function(t,i,r){C(t).set(C(i),r>>>0)},__wbg_set_clear_value_gpu_color_dict_6211425789c76e59:function(t,i){C(t).clearValue=C(i)},__wbg_set_code_b4f37f81f45b5b25:function(t,i,r){C(t).code=Hi(i,r)},__wbg_set_color_83aa977526e88cbb:function(t,i){C(t).color=C(i)},__wbg_set_color_attachments_581fdb3310e4abfa:function(t,i,r){C(t).colorAttachments=Tu(i,r)},__wbg_set_compare_cd9b62cdb92eb580:function(t,i){C(t).compare=qB[i]},__wbg_set_compare_f36b34abfaa08ccb:function(t,i){C(t).compare=qB[i]},__wbg_set_compute_d0c2d276b6d4b18d:function(t,i){C(t).compute=C(i)},__wbg_set_count_069a4eac409bac55:function(t,i){C(t).count=i>>>0},__wbg_set_count_3ab1c1220e4ceeb3:function(t,i){C(t).count=i>>>0},__wbg_set_cull_mode_fc649853947a3d0c:function(t,i){C(t).cullMode=cPe[i]},__wbg_set_currentTime_7c37e2312e9d2687:function(t,i){C(t).currentTime=i},__wbg_set_depth_bias_clamp_1c0d695df7f092e5:function(t,i){C(t).depthBiasClamp=i},__wbg_set_depth_bias_d7cd16096242a657:function(t,i){C(t).depthBias=i},__wbg_set_depth_bias_slope_scale_c4e52ec743ef55ba:function(t,i){C(t).depthBiasSlopeScale=i},__wbg_set_depth_clear_value_beda3ec5b1a5c43a:function(t,i){C(t).depthClearValue=i},__wbg_set_depth_compare_0c8631eb2eae98e3:function(t,i){C(t).depthCompare=qB[i]},__wbg_set_depth_fail_op_668155ae33d3c06f:function(t,i){C(t).depthFailOp=YB[i]},__wbg_set_depth_load_op_511c513eab4e56a9:function(t,i){C(t).depthLoadOp=XB[i]},__wbg_set_depth_or_array_layers_89371305ed0bd962:function(t,i){C(t).depthOrArrayLayers=i>>>0},__wbg_set_depth_read_only_7f41a74741c144ec:function(t,i){C(t).depthReadOnly=i!==0},__wbg_set_depth_stencil_97506c7bea4f53da:function(t,i){C(t).depthStencil=C(i)},__wbg_set_depth_stencil_attachment_73b79e8b4e948222:function(t,i){C(t).depthStencilAttachment=C(i)},__wbg_set_depth_store_op_c89f33b39b43361c:function(t,i){C(t).depthStoreOp=KB[i]},__wbg_set_depth_write_enabled_ce89750042940350:function(t,i){C(t).depthWriteEnabled=i!==0},__wbg_set_device_e275d1d4f3c9eb74:function(t,i){C(t).device=C(i)},__wbg_set_dimension_868eee80f4b90011:function(t,i){C(t).dimension=wPe[i]},__wbg_set_dimension_e325282e613ca0a4:function(t,i){C(t).dimension=QB[i]},__wbg_set_dst_factor_ec7407f19be1aff9:function(t,i){C(t).dstFactor=MZ[i]},__wbg_set_end_of_pass_write_index_0d546e46b86ea069:function(t,i){C(t).endOfPassWriteIndex=i>>>0},__wbg_set_end_of_pass_write_index_49a6ddbb2b888bfa:function(t,i){C(t).endOfPassWriteIndex=i>>>0},__wbg_set_entries_86a29dd6291c95e7:function(t,i,r){C(t).entries=Tu(i,r)},__wbg_set_entries_a12aca1e458b0456:function(t,i,r){C(t).entries=Tu(i,r)},__wbg_set_entry_point_207540f042015ce5:function(t,i,r){C(t).entryPoint=Hi(i,r)},__wbg_set_entry_point_5f26aacbe4c545eb:function(t,i,r){C(t).entryPoint=Hi(i,r)},__wbg_set_entry_point_e87e79251dd3144f:function(t,i,r){C(t).entryPoint=Hi(i,r)},__wbg_set_external_texture_386483d8dd82ab56:function(t,i){C(t).externalTexture=C(i)},__wbg_set_fail_op_92f716dbc88b6973:function(t,i){C(t).failOp=YB[i]},__wbg_set_flip_y_4e1632b36ad0413a:function(t,i){C(t).flipY=i!==0},__wbg_set_format_1fcaa7d60546b490:function(t,i){C(t).format=s0[i]},__wbg_set_format_2c1414a817c213f8:function(t,i){C(t).format=s0[i]},__wbg_set_format_533f9ffa7eef563d:function(t,i){C(t).format=s0[i]},__wbg_set_format_5d2f25cc93654ecc:function(t,i){C(t).format=TPe[i]},__wbg_set_format_5ff53724ed6cedf2:function(t,i){C(t).format=s0[i]},__wbg_set_format_815efd4dc4817bbb:function(t,i){C(t).format=s0[i]},__wbg_set_format_e52bdcca880d2c8e:function(t,i){C(t).format=s0[i]},__wbg_set_fragment_8b780f00a0b0e6f3:function(t,i){C(t).fragment=C(i)},__wbg_set_front_face_28ffdf524eedce5b:function(t,i){C(t).frontFace=mPe[i]},__wbg_set_g_5983abfc46e0cf4e:function(t,i){C(t).g=i},__wbg_set_has_dynamic_offset_62bc230bdb7c54d0:function(t,i){C(t).hasDynamicOffset=i!==0},__wbg_set_height_0739170de8653cc4:function(t,i){C(t).height=i>>>0},__wbg_set_height_14335c4047cf9c1b:function(t,i){C(t).height=i>>>0},__wbg_set_height_c661af0c0b5376f9:function(t,i){C(t).height=i>>>0},__wbg_set_label_08d9be3e4719c226:function(t,i,r){C(t).label=Hi(i,r)},__wbg_set_label_17eb9fe3a02f62b0:function(t,i,r){C(t).label=Hi(i,r)},__wbg_set_label_206558c8adc3780f:function(t,i,r){C(t).label=Hi(i,r)},__wbg_set_label_48e6b787d256f621:function(t,i,r){C(t).label=Hi(i,r)},__wbg_set_label_547d0d4aec39fbe9:function(t,i,r){C(t).label=Hi(i,r)},__wbg_set_label_5ee7427342869829:function(t,i,r){C(t).label=Hi(i,r)},__wbg_set_label_60ad96c811e0d109:function(t,i,r){C(t).label=Hi(i,r)},__wbg_set_label_6db0393d3fdc90a5:function(t,i,r){C(t).label=Hi(i,r)},__wbg_set_label_72bb4f41ef0cb893:function(t,i,r){C(t).label=Hi(i,r)},__wbg_set_label_79387decda299036:function(t,i,r){C(t).label=Hi(i,r)},__wbg_set_label_9556af8b5cda3c9d:function(t,i,r){C(t).label=Hi(i,r)},__wbg_set_label_d010f237b26f2c55:function(t,i,r){C(t).label=Hi(i,r)},__wbg_set_label_e16e2dbe51349c7f:function(t,i,r){C(t).label=Hi(i,r)},__wbg_set_label_e3944e54881b8c50:function(t,i,r){C(t).label=Hi(i,r)},__wbg_set_label_e922700240417ab5:function(t,i,r){C(t).label=Hi(i,r)},__wbg_set_label_ef44793ddf4455c5:function(t,i,r){C(t).label=Hi(i,r)},__wbg_set_layout_41021cfd2a2f62df:function(t,i){C(t).layout=C(i)},__wbg_set_layout_50ab727f44b38f26:function(t,i){C(t).layout=C(i)},__wbg_set_layout_913d53c17194c989:function(t,i){C(t).layout=C(i)},__wbg_set_layout_gpu_auto_layout_mode_0a5a185b3d52b726:function(t,i){C(t).layout=TZ[i]},__wbg_set_layout_gpu_auto_layout_mode_aeba193938b47882:function(t,i){C(t).layout=TZ[i]},__wbg_set_load_op_99661da6c4eab9b0:function(t,i){C(t).loadOp=XB[i]},__wbg_set_lod_max_clamp_dd2d9f9f052f4f44:function(t,i){C(t).lodMaxClamp=i},__wbg_set_lod_min_clamp_6d20c97916baeb93:function(t,i){C(t).lodMinClamp=i},__wbg_set_loop_b622b726769860be:function(t,i){C(t).loop=i!==0},__wbg_set_mag_filter_b5adebc99cb938e1:function(t,i){C(t).magFilter=EZ[i]},__wbg_set_mapped_at_creation_81b586dc90a50347:function(t,i){C(t).mappedAtCreation=i!==0},__wbg_set_mask_70a8a59ce09e5997:function(t,i){C(t).mask=i>>>0},__wbg_set_max_anisotropy_2beada0e2db62c45:function(t,i){C(t).maxAnisotropy=i},__wbg_set_method_7a6811dec7a4feff:function(t,i,r){C(t).method=Hi(i,r)},__wbg_set_min_binding_size_f64_5005a6904cdf43da:function(t,i){C(t).minBindingSize=i},__wbg_set_min_filter_c72f17375e135f0a:function(t,i){C(t).minFilter=EZ[i]},__wbg_set_mip_level_13253f3afc7aa58a:function(t,i){C(t).mipLevel=i>>>0},__wbg_set_mip_level_count_534caaa7e68e68b8:function(t,i){C(t).mipLevelCount=i>>>0},__wbg_set_mip_level_count_776c8c218b65bc08:function(t,i){C(t).mipLevelCount=i>>>0},__wbg_set_mip_level_f7ac79e8c54f59ad:function(t,i){C(t).mipLevel=i>>>0},__wbg_set_mipmap_filter_5bf66195a3639700:function(t,i){C(t).mipmapFilter=gPe[i]},__wbg_set_mode_9990b3393ba469ae:function(t,i){C(t).mode=dPe[i]},__wbg_set_mode_c90e3667002857d4:function(t,i){C(t).mode=EPe[i]},__wbg_set_module_5db9b76ee2dd2a59:function(t,i){C(t).module=C(i)},__wbg_set_module_d0e2098713606cae:function(t,i){C(t).module=C(i)},__wbg_set_module_f02e076ca7e7daf8:function(t,i){C(t).module=C(i)},__wbg_set_multisample_37ddafe88b5cd466:function(t,i){C(t).multisample=C(i)},__wbg_set_multisampled_7913fd7183272840:function(t,i){C(t).multisampled=i!==0},__wbg_set_muted_16f1e7acd8244e28:function(t,i){C(t).muted=i!==0},__wbg_set_offset_f64_28c24dc15000932e:function(t,i){C(t).offset=i},__wbg_set_offset_f64_89f0ce01a689839e:function(t,i){C(t).offset=i},__wbg_set_offset_f64_b562d1367e34ef93:function(t,i){C(t).offset=i},__wbg_set_offset_f64_fa66068813376ca3:function(t,i){C(t).offset=i},__wbg_set_once_27df5233613a51cd:function(t,i){C(t).once=i!==0},__wbg_set_operation_62ce44e1728c4047:function(t,i){C(t).operation=lPe[i]},__wbg_set_origin_gpu_origin_2d_dict_1240202973e56f92:function(t,i){C(t).origin=C(i)},__wbg_set_origin_gpu_origin_3d_dict_37222d7b3d238123:function(t,i){C(t).origin=C(i)},__wbg_set_origin_gpu_origin_3d_dict_631c04520718091f:function(t,i){C(t).origin=C(i)},__wbg_set_pass_op_cf02fa088d6352a7:function(t,i){C(t).passOp=YB[i]},__wbg_set_power_preference_8fdca0b7af640d49:function(t,i){C(t).powerPreference=vPe[i]},__wbg_set_premultiplied_alpha_3f27816ad319d5a9:function(t,i){C(t).premultipliedAlpha=i!==0},__wbg_set_primitive_43c23761a55b4088:function(t,i){C(t).primitive=C(i)},__wbg_set_query_set_41de86d2401aee04:function(t,i){C(t).querySet=C(i)},__wbg_set_query_set_4889dd944d5ec0fd:function(t,i){C(t).querySet=C(i)},__wbg_set_r_c6f4c68f4804d655:function(t,i){C(t).r=i},__wbg_set_required_features_1baf274a8669db60:function(t,i,r){C(t).requiredFeatures=Tu(i,r)},__wbg_set_required_limits_871ed33c68613dcb:function(t,i){C(t).requiredLimits=C(i)},__wbg_set_resolve_target_gpu_texture_view_b19a4f2debf79b96:function(t,i){C(t).resolveTarget=C(i)},__wbg_set_resource_5ae7b5e67924f234:function(t,i){C(t).resource=C(i)},__wbg_set_resource_gpu_buffer_binding_e5dbca063e7cb67b:function(t,i){C(t).resource=C(i)},__wbg_set_resource_gpu_texture_view_eb46c355d51ad7e5:function(t,i){C(t).resource=C(i)},__wbg_set_rows_per_image_5011f97318ee71af:function(t,i){C(t).rowsPerImage=i>>>0},__wbg_set_rows_per_image_59a813ac5006e10e:function(t,i){C(t).rowsPerImage=i>>>0},__wbg_set_sample_count_eb86a8b18545b54f:function(t,i){C(t).sampleCount=i>>>0},__wbg_set_sample_type_c32e1dfff94e63eb:function(t,i){C(t).sampleType=SPe[i]},__wbg_set_sampler_c0e1258543a33bce:function(t,i){C(t).sampler=C(i)},__wbg_set_shader_location_7e1832a74f912217:function(t,i){C(t).shaderLocation=i>>>0},__wbg_set_size_f64_6bcd40704bf4cfdc:function(t,i){C(t).size=i},__wbg_set_size_f64_8b8f6bba5d678162:function(t,i){C(t).size=i},__wbg_set_size_gpu_extent_3d_dict_7e42e1c98fa36434:function(t,i){C(t).size=C(i)},__wbg_set_source_0c40b87cfdd5d704:function(t,i){C(t).source=C(i)},__wbg_set_source_html_canvas_element_f657e39507ba2fe5:function(t,i){C(t).source=C(i)},__wbg_set_source_html_image_element_fcc7cba0635adac1:function(t,i){C(t).source=C(i)},__wbg_set_source_html_video_element_e63a39653665f651:function(t,i){C(t).source=C(i)},__wbg_set_source_image_data_68478f1afce208b8:function(t,i){C(t).source=C(i)},__wbg_set_source_offscreen_canvas_266a3de949693e62:function(t,i){C(t).source=C(i)},__wbg_set_source_video_frame_3083c0ce54b9cb73:function(t,i){C(t).source=C(i)},__wbg_set_src_factor_9bfe84af9b7b5cac:function(t,i){C(t).srcFactor=MZ[i]},__wbg_set_stencil_back_85b22f1db5b1940a:function(t,i){C(t).stencilBack=C(i)},__wbg_set_stencil_clear_value_42be608809151e2a:function(t,i){C(t).stencilClearValue=i>>>0},__wbg_set_stencil_front_525526164a798a44:function(t,i){C(t).stencilFront=C(i)},__wbg_set_stencil_load_op_31838c036993098a:function(t,i){C(t).stencilLoadOp=XB[i]},__wbg_set_stencil_read_mask_5cc26495e8b3ae82:function(t,i){C(t).stencilReadMask=i>>>0},__wbg_set_stencil_read_only_bf1d0c1897e25c62:function(t,i){C(t).stencilReadOnly=i!==0},__wbg_set_stencil_store_op_e6be1cbc3a8fc210:function(t,i){C(t).stencilStoreOp=KB[i]},__wbg_set_stencil_write_mask_d9cb40ec4b4bee5b:function(t,i){C(t).stencilWriteMask=i>>>0},__wbg_set_step_mode_a97bb24714da41a9:function(t,i){C(t).stepMode=MPe[i]},__wbg_set_storage_texture_939a097db4b18bd4:function(t,i){C(t).storageTexture=C(i)},__wbg_set_store_op_b5fdf672436f13f3:function(t,i){C(t).storeOp=KB[i]},__wbg_set_strip_index_format_9f787be6c5fc9e87:function(t,i){C(t).stripIndexFormat=$B[i]},__wbg_set_targets_c38bd200c836d66f:function(t,i,r){C(t).targets=Tu(i,r)},__wbg_set_texture_016561d5911339e5:function(t,i){C(t).texture=C(i)},__wbg_set_texture_1f64653a5d2d7b4d:function(t,i){C(t).texture=C(i)},__wbg_set_texture_9dcedde1bb31eda6:function(t,i){C(t).texture=C(i)},__wbg_set_timestamp_writes_59c2d19ed8aecd97:function(t,i){C(t).timestampWrites=C(i)},__wbg_set_timestamp_writes_98bed1a8bbc6682d:function(t,i){C(t).timestampWrites=C(i)},__wbg_set_tone_mapping_b3464f1baa4cff92:function(t,i){C(t).toneMapping=C(i)},__wbg_set_topology_da25f2cc5af203d2:function(t,i){C(t).topology=yPe[i]},__wbg_set_type_7f0457c6084dde9b:function(t,i){C(t).type=_Pe[i]},__wbg_set_type_ccf8472d40abcddf:function(t,i){C(t).type=bPe[i]},__wbg_set_type_d09829f59932a0fc:function(t,i){C(t).type=hPe[i]},__wbg_set_unclipped_depth_04524a2b44e1e3c1:function(t,i){C(t).unclippedDepth=i!==0},__wbg_set_usage_a137f82ca163b0a9:function(t,i){C(t).usage=i>>>0},__wbg_set_usage_b2a2935f37bf3d08:function(t,i){C(t).usage=i>>>0},__wbg_set_usage_ba5b0f8b333ab325:function(t,i){C(t).usage=i>>>0},__wbg_set_usage_ddd42599bbba7779:function(t,i){C(t).usage=i>>>0},__wbg_set_vertex_0be5d146f9ff6f36:function(t,i){C(t).vertex=C(i)},__wbg_set_view_dimension_0df554032f1f3a85:function(t,i){C(t).viewDimension=QB[i]},__wbg_set_view_dimension_4818d4c18ce5815e:function(t,i){C(t).viewDimension=QB[i]},__wbg_set_view_formats_4347dc8363331086:function(t,i,r){C(t).viewFormats=Tu(i,r)},__wbg_set_view_formats_5797d2fff3c11808:function(t,i,r){C(t).viewFormats=Tu(i,r)},__wbg_set_view_gpu_texture_view_9b2d86b6b99d9fd9:function(t,i){C(t).view=C(i)},__wbg_set_view_gpu_texture_view_c0f35f8857c25206:function(t,i){C(t).view=C(i)},__wbg_set_visibility_9570b037224c4cc2:function(t,i){C(t).visibility=i>>>0},__wbg_set_volume_520cdc6b7ada8f76:function(t,i){C(t).volume=i},__wbg_set_width_7ca43f32db1cfe8e:function(t,i){C(t).width=i>>>0},__wbg_set_width_87301412247f3343:function(t,i){C(t).width=i>>>0},__wbg_set_width_9f685402c2cbee70:function(t,i){C(t).width=i>>>0},__wbg_set_write_mask_d45279e56abbfcb5:function(t,i){C(t).writeMask=i>>>0},__wbg_set_x_232d24fdc32d8351:function(t,i){C(t).x=i>>>0},__wbg_set_x_876d592971db129a:function(t,i){C(t).x=i>>>0},__wbg_set_y_18fe375093e59dfb:function(t,i){C(t).y=i>>>0},__wbg_set_y_2b1f5ac0dd5586a5:function(t,i){C(t).y=i>>>0},__wbg_set_z_ef005d82bc9d24e3:function(t,i){C(t).z=i>>>0},__wbg_shaderSource_7d18b5a43a504f5c:function(t,i,r,n){C(t).shaderSource(C(i),Hi(r,n))},__wbg_shaderSource_df5bb6320451f3cd:function(t,i,r,n){C(t).shaderSource(C(i),Hi(r,n))},__wbg_size_211f88d386430781:function(t){return C(t).size},__wbg_src_f0e9281991fbd919:function(t,i){let r=C(i).src,n=As(r,de.__wbindgen_export,de.__wbindgen_export2),s=On;di().setInt32(t+4,s,!0),di().setInt32(t+0,n,!0)},__wbg_stack_3b0d974bbf31e44f:function(t,i){let r=C(i).stack,n=As(r,de.__wbindgen_export,de.__wbindgen_export2),s=On;di().setInt32(t+4,s,!0),di().setInt32(t+0,n,!0)},__wbg_static_accessor_GLOBAL_9d53f2689e622ca1:function(){let t=typeof global>"u"?null:global;return ci(t)?0:ne(t)},__wbg_static_accessor_GLOBAL_THIS_a1a35cec07001a8a:function(){let t=typeof globalThis>"u"?null:globalThis;return ci(t)?0:ne(t)},__wbg_static_accessor_SELF_4c59f6c7ea29a144:function(){let t=typeof self>"u"?null:self;return ci(t)?0:ne(t)},__wbg_static_accessor_WINDOW_e70ae9f2eb052253:function(){let t=typeof window>"u"?null:window;return ci(t)?0:ne(t)},__wbg_stencilFunc_8f53a5508560354d:function(t,i,r,n){C(t).stencilFunc(i>>>0,r,n>>>0)},__wbg_stencilFunc_c7553215f237ee38:function(t,i,r,n){C(t).stencilFunc(i>>>0,r,n>>>0)},__wbg_stencilOp_a844a4e9824eee70:function(t,i,r,n){C(t).stencilOp(i>>>0,r>>>0,n>>>0)},__wbg_stencilOp_e82bd7ea13f18adf:function(t,i,r,n){C(t).stencilOp(i>>>0,r>>>0,n>>>0)},__wbg_subgroupMaxSize_1527c5f7a8fe91bb:function(t){return C(t).subgroupMaxSize},__wbg_subgroupMinSize_d6c5ad4bddc828e9:function(t){return C(t).subgroupMinSize},__wbg_submit_ce44115121cd166c:function(t,i,r){C(t).submit(Tu(i,r))},__wbg_texImage2D_01c22558517ee8db:function(){return ti(function(t,i,r,n,s,a,o){C(t).texImage2D(i>>>0,r,n,s>>>0,a>>>0,C(o))},arguments)},__wbg_texImage2D_152e9dcd4bc3a464:function(){return ti(function(t,i,r,n,s,a,o,l,u,h){C(t).texImage2D(i>>>0,r,n,s,a,o,l>>>0,u>>>0,C(h))},arguments)},__wbg_texImage2D_3704db20a16b6c35:function(){return ti(function(t,i,r,n,s,a,o,l,u,h){C(t).texImage2D(i>>>0,r,n,s,a,o,l>>>0,u>>>0,C(h))},arguments)},__wbg_texImage2D_63d0b87d5ebe4a7f:function(){return ti(function(t,i,r,n,s,a,o){C(t).texImage2D(i>>>0,r,n,s>>>0,a>>>0,C(o))},arguments)},__wbg_texImage2D_90633e994ded3d2b:function(){return ti(function(t,i,r,n,s,a,o){C(t).texImage2D(i>>>0,r,n,s>>>0,a>>>0,C(o))},arguments)},__wbg_texImage2D_ea94e8a2df5f97e2:function(){return ti(function(t,i,r,n,s,a,o,l,u,h){C(t).texImage2D(i>>>0,r,n,s,a,o,l>>>0,u>>>0,h)},arguments)},__wbg_texImage2D_facfa039fb461b66:function(){return ti(function(t,i,r,n,s,a,o){C(t).texImage2D(i>>>0,r,n,s>>>0,a>>>0,C(o))},arguments)},__wbg_texParameteri_87ebfcefb0af2c50:function(t,i,r,n){C(t).texParameteri(i>>>0,r>>>0,n)},__wbg_texParameteri_e5ad2054e239066e:function(t,i,r,n){C(t).texParameteri(i>>>0,r>>>0,n)},__wbg_texStorage2D_bb2a1bd1ab0b9184:function(t,i,r,n,s,a){C(t).texStorage2D(i>>>0,r,n>>>0,s,a)},__wbg_texSubImage2D_3483ba5f10ee42c2:function(){return ti(function(t,i,r,n,s,a,o,l){C(t).texSubImage2D(i>>>0,r,n,s,a>>>0,o>>>0,C(l))},arguments)},__wbg_texSubImage2D_4ca4c3faa4392438:function(){return ti(function(t,i,r,n,s,a,o,l,u,h){C(t).texSubImage2D(i>>>0,r,n,s,a,o,l>>>0,u>>>0,C(h))},arguments)},__wbg_texSubImage2D_54d18572b1ba74ab:function(){return ti(function(t,i,r,n,s,a,o,l,u,h){C(t).texSubImage2D(i>>>0,r,n,s,a,o,l>>>0,u>>>0,h)},arguments)},__wbg_texSubImage2D_5bebe93724e6ed61:function(){return ti(function(t,i,r,n,s,a,o,l,u,h){C(t).texSubImage2D(i>>>0,r,n,s,a,o,l>>>0,u>>>0,C(h))},arguments)},__wbg_texSubImage2D_5e1594de0416e9f6:function(){return ti(function(t,i,r,n,s,a,o,l){C(t).texSubImage2D(i>>>0,r,n,s,a>>>0,o>>>0,C(l))},arguments)},__wbg_then_18f476d590e58992:function(t,i,r){let n=C(t).then(C(i),C(r));return ne(n)},__wbg_then_47213a40b6aeb86c:function(t,i){let r=C(t).then(C(i));return ne(r)},__wbg_then_ac7b025999b52837:function(t,i){let r=C(t).then(C(i));return ne(r)},__wbg_type_71742b859467fa3c:function(t){return C(t).type},__wbg_unconfigure_0a07a0a40de8988d:function(t){C(t).unconfigure()},__wbg_uniform1f_8c3b3e6e3723fe14:function(t,i,r){C(t).uniform1f(C(i),r)},__wbg_uniform1f_d6619faa73c2a45f:function(t,i,r){C(t).uniform1f(C(i),r)},__wbg_uniform1fv_11d5842aff79c8a3:function(t,i,r,n){C(t).uniform1fv(C(i),ih(r,n))},__wbg_uniform1fv_b4b087b4d6e2bb25:function(t,i,r,n){C(t).uniform1fv(C(i),ih(r,n))},__wbg_uniform1i_14982bb8438243b4:function(t,i,r){C(t).uniform1i(C(i),r)},__wbg_uniform1i_cf11d5b364eed1c8:function(t,i,r){C(t).uniform1i(C(i),r)},__wbg_uniform1ui_d177882f473d2afc:function(t,i,r){C(t).uniform1ui(C(i),r>>>0)},__wbg_uniform2f_19fb96222ae72e1a:function(t,i,r,n){C(t).uniform2f(C(i),r,n)},__wbg_uniform2f_44cee47e30b82f96:function(t,i,r,n){C(t).uniform2f(C(i),r,n)},__wbg_uniform2fv_2f06d989ec4b5d8f:function(t,i,r,n){C(t).uniform2fv(C(i),ih(r,n))},__wbg_uniform2fv_f022309b362a80c3:function(t,i,r,n){C(t).uniform2fv(C(i),ih(r,n))},__wbg_uniform2i_16e8a2c966614be6:function(t,i,r,n){C(t).uniform2i(C(i),r,n)},__wbg_uniform2i_d353da02172ea38d:function(t,i,r,n){C(t).uniform2i(C(i),r,n)},__wbg_uniform3f_360c1ea4c73cacef:function(t,i,r,n,s){C(t).uniform3f(C(i),r,n,s)},__wbg_uniform3f_b616f9e06266a25f:function(t,i,r,n,s){C(t).uniform3f(C(i),r,n,s)},__wbg_uniform4f_f1a670d511b34878:function(t,i,r,n,s,a){C(t).uniform4f(C(i),r,n,s,a)},__wbg_uniform4f_f97f3f59af09856f:function(t,i,r,n,s,a){C(t).uniform4f(C(i),r,n,s,a)},__wbg_uniformMatrix3fv_f45b91f173d7fbed:function(t,i,r,n,s){C(t).uniformMatrix3fv(C(i),r!==0,ih(n,s))},__wbg_uniformMatrix3fv_feab3f952d705f51:function(t,i,r,n,s){C(t).uniformMatrix3fv(C(i),r!==0,ih(n,s))},__wbg_uniformMatrix3x2fv_ab13f9742e5fcb2f:function(t,i,r,n,s){C(t).uniformMatrix3x2fv(C(i),r!==0,ih(n,s))},__wbg_uniformMatrix4fv_540dc6bf792eba8f:function(t,i,r,n,s){C(t).uniformMatrix4fv(C(i),r!==0,ih(n,s))},__wbg_uniformMatrix4fv_e3dac9dd429d6adc:function(t,i,r,n,s){C(t).uniformMatrix4fv(C(i),r!==0,ih(n,s))},__wbg_uniformMatrix4x3fv_115d029ad3124cef:function(t,i,r,n,s){C(t).uniformMatrix4x3fv(C(i),r!==0,ih(n,s))},__wbg_unmap_adaf93276fdf9aaf:function(t){C(t).unmap()},__wbg_useProgram_55a3e940abb19137:function(t,i){C(t).useProgram(C(i))},__wbg_useProgram_e24dadf4c06636f5:function(t,i){C(t).useProgram(C(i))},__wbg_userAgent_8def8135d886414b:function(){return ti(function(t,i){let r=C(i).userAgent,n=As(r,de.__wbindgen_export,de.__wbindgen_export2),s=On;di().setInt32(t+4,s,!0),di().setInt32(t+0,n,!0)},arguments)},__wbg_valueOf_41ae57308c1f031c:function(t){return C(t).valueOf()},__wbg_value_f3625092ee4b37f4:function(t){let i=C(t).value;return ne(i)},__wbg_vertexAttrib4f_6444504b25f4d43e:function(t,i,r,n,s,a){C(t).vertexAttrib4f(i>>>0,r,n,s,a)},__wbg_vertexAttrib4f_aad41fe000407191:function(t,i,r,n,s,a){C(t).vertexAttrib4f(i>>>0,r,n,s,a)},__wbg_vertexAttribIPointer_ed1c3507e84527e2:function(t,i,r,n,s,a){C(t).vertexAttribIPointer(i>>>0,r,n>>>0,s,a)},__wbg_vertexAttribPointer_39eddea7c20e350c:function(t,i,r,n,s,a,o){C(t).vertexAttribPointer(i>>>0,r,n>>>0,s!==0,a,o)},__wbg_vertexAttribPointer_3bc50c0431082f73:function(t,i,r,n,s,a,o){C(t).vertexAttribPointer(i>>>0,r,n>>>0,s!==0,a,o)},__wbg_videoFrameToken_6f05524e85fa2b75:function(t){return yZ(C(t))},__wbg_videoHeight_e267fd1e74bb1b06:function(t){return C(t).videoHeight},__wbg_videoWidth_670b8e775ea04b5d:function(t){return C(t).videoWidth},__wbg_viewport_14d947f2faf58e85:function(t,i,r,n,s){C(t).viewport(i,r,n,s)},__wbg_viewport_24055b0754803788:function(t,i,r,n,s){C(t).viewport(i,r,n,s)},__wbg_warn_410c3261e3c6d686:function(t){console.warn(C(t))},__wbg_width_f1791280fae1517a:function(t){return C(t).width},__wbg_writeTexture_53ba204c494b042c:function(){return ti(function(t,i,r,n,s,a){C(t).writeTexture(C(i),im(r,n),C(s),C(a))},arguments)},__wbindgen_cast_0000000000000001:function(t,i){let r=Qc(t,i,iPe);return ne(r)},__wbindgen_cast_0000000000000002:function(t,i){let r=Qc(t,i,ePe);return ne(r)},__wbindgen_cast_0000000000000003:function(t,i){let r=Qc(t,i,rPe);return ne(r)},__wbindgen_cast_0000000000000004:function(t,i){let r=Qc(t,i,nPe);return ne(r)},__wbindgen_cast_0000000000000005:function(t,i){let r=Qc(t,i,tPe);return ne(r)},__wbindgen_cast_0000000000000006:function(t,i){let r=Qc(t,i,sPe);return ne(r)},__wbindgen_cast_0000000000000007:function(t,i){let r=Qc(t,i,aPe);return ne(r)},__wbindgen_cast_0000000000000008:function(t,i){let r=Qc(t,i,oPe);return ne(r)},__wbindgen_cast_0000000000000009:function(t,i){let r=Qc(t,i,JRe);return ne(r)},__wbindgen_cast_000000000000000a:function(t){return ne(t)},__wbindgen_cast_000000000000000b:function(t,i){let r=ih(t,i);return ne(r)},__wbindgen_cast_000000000000000c:function(t,i){let r=DPe(t,i);return ne(r)},__wbindgen_cast_000000000000000d:function(t,i){let r=DZ(t,i);return ne(r)},__wbindgen_cast_000000000000000e:function(t,i){let r=NPe(t,i);return ne(r)},__wbindgen_cast_000000000000000f:function(t,i){let r=IPe(t,i);return ne(r)},__wbindgen_cast_0000000000000010:function(t,i){let r=jw(t,i);return ne(r)},__wbindgen_cast_0000000000000011:function(t,i){let r=im(t,i);return ne(r)},__wbindgen_cast_0000000000000012:function(t,i){let r=Hi(t,i);return ne(r)},__wbindgen_cast_0000000000000013:function(t){let i=BigInt.asUintN(64,t);return ne(i)},__wbindgen_cast_0000000000000014:function(t,i){var r=im(t,i).slice();return de.__wbindgen_export4(t,i*1,1),ne(r)},__wbindgen_object_clone_ref:function(t){let i=C(t);return ne(i)},__wbindgen_object_drop_ref:function(t){ii(t)}}}}function JRe(e,t){de.__wasm_bindgen_func_elem_12556(e,t)}function ePe(e,t,i){de.__wasm_bindgen_func_elem_5124(e,t,ne(i))}function tPe(e,t,i){de.__wasm_bindgen_func_elem_11150(e,t,ne(i))}function iPe(e,t,i){try{let s=de.__wbindgen_add_to_stack_pointer(-16);de.__wasm_bindgen_func_elem_14193(s,e,t,ne(i));var r=di().getInt32(s+4*0,!0),n=di().getInt32(s+4*1,!0);if(n)throw ii(r)}finally{de.__wbindgen_add_to_stack_pointer(16)}}function rPe(e,t,i){try{let s=de.__wbindgen_add_to_stack_pointer(-16);de.__wasm_bindgen_func_elem_11149(s,e,t,ne(i));var r=di().getInt32(s+4*0,!0),n=di().getInt32(s+4*1,!0);if(n)throw ii(r)}finally{de.__wbindgen_add_to_stack_pointer(16)}}function nPe(e,t,i){try{let s=de.__wbindgen_add_to_stack_pointer(-16);de.__wasm_bindgen_func_elem_11149_3(s,e,t,ne(i));var r=di().getInt32(s+4*0,!0),n=di().getInt32(s+4*1,!0);if(n)throw ii(r)}finally{de.__wbindgen_add_to_stack_pointer(16)}}function sPe(e,t,i){try{let s=de.__wbindgen_add_to_stack_pointer(-16);de.__wasm_bindgen_func_elem_11149_5(s,e,t,ne(i));var r=di().getInt32(s+4*0,!0),n=di().getInt32(s+4*1,!0);if(n)throw ii(r)}finally{de.__wbindgen_add_to_stack_pointer(16)}}function aPe(e,t,i){try{let s=de.__wbindgen_add_to_stack_pointer(-16);de.__wasm_bindgen_func_elem_11149_6(s,e,t,ne(i));var r=di().getInt32(s+4*0,!0),n=di().getInt32(s+4*1,!0);if(n)throw ii(r)}finally{de.__wbindgen_add_to_stack_pointer(16)}}function oPe(e,t,i){try{let s=de.__wbindgen_add_to_stack_pointer(-16);de.__wasm_bindgen_func_elem_11149_7(s,e,t,ne(i));var r=di().getInt32(s+4*0,!0),n=di().getInt32(s+4*1,!0);if(n)throw ii(r)}finally{de.__wbindgen_add_to_stack_pointer(16)}}function SZ(e,t,i,r){de.__wasm_bindgen_func_elem_14195(e,t,ne(i),ne(r))}function ne(e){Jw===Mu.length&&Mu.push(Mu.length+1);let t=Jw;return Jw=Mu[t],Mu[t]=e,t}function CPe(e){if(rC==1)throw new Error("out of js stack");return Mu[--rC]=e,rC}function eU(e){let t=typeof e;if(t=="number"||t=="boolean"||e==null)return`${e}`;if(t=="string")return`"${e}"`;if(t=="symbol"){let n=e.description;return n==null?"Symbol":`Symbol(${n})`}if(t=="function"){let n=e.name;return typeof n=="string"&&n.length>0?`Function(${n})`:"Function"}if(Array.isArray(e)){let n=e.length,s="[";n>0&&(s+=eU(e[0]));for(let a=1;a<n;a++)s+=", "+eU(e[a]);return s+="]",s}let i=/\[object ([^\]]+)\]/.exec(toString.call(e)),r;if(i&&i.length>1)r=i[1];else return toString.call(e);if(r=="Object")try{return"Object("+JSON.stringify(e)+")"}catch{return"Object"}return e instanceof Error?`${e.name}: ${e.message}
35
+ `;let s=new TextEncoder().encode(n),a=r*2*4,o=e.xyz.quantized.data.buffer.byteLength,l=e.xyz instanceof Es?a:0,u=e.color.quantized.data.buffer.byteLength,h=e.color instanceof Es?a:0,d=e.opacity.quantized.data.buffer.byteLength,c=e.opacity instanceof Es?a:0,p=e.scaling.quantized.data.buffer.byteLength,f=e.scaling instanceof Es?a:0,m=e.quaternion.quantized.data.buffer.byteLength,g=e.quaternion instanceof Es?a:0,v=e.variableChunkSize?Uint16Array.from(e.variableChunkSize):void 0,y=v?v.byteLength:0,_=s.byteLength+y+o+l+u+h+d+c+p+f+m+g,b=0,x=0;if(e.harmonics&&e.harmonics.length>0)for(let M=0;M<e.harmonics.length;M++)b+=e.harmonics[M].quantized.data.buffer.byteLength,x+=e.harmonics[M]instanceof Es?a:0;b=0,x=0,_+=b+x;let w=new Uint8Array(_),S=0;if(w.set(s,S),S+=s.byteLength,y>0&&(w.set(new Uint8Array(v.buffer),S),S+=y),e.xyz instanceof Es&&(w.set(new Uint8Array(e.xyz.minmaxMatrix.data.buffer),S),S+=a),w.set(new Uint8Array(e.xyz.quantized.data.buffer),S),S+=o,e.color instanceof Es&&(w.set(new Uint8Array(e.color.minmaxMatrix.data.buffer),S),S+=a),w.set(new Uint8Array(e.color.quantized.data.buffer),S),S+=u,e.opacity instanceof Es&&(w.set(new Uint8Array(e.opacity.minmaxMatrix.data.buffer),S),S+=a),w.set(new Uint8Array(e.opacity.quantized.data.buffer),S),S+=d,e.scaling instanceof Es&&(w.set(new Uint8Array(e.scaling.minmaxMatrix.data.buffer),S),S+=a),w.set(new Uint8Array(e.scaling.quantized.data.buffer),S),S+=p,e.quaternion instanceof Es&&(w.set(new Uint8Array(e.quaternion.minmaxMatrix.data.buffer),S),S+=a),w.set(new Uint8Array(e.quaternion.quantized.data.buffer),S),S+=m,b>0&&e.harmonics&&e.harmonics.length>0)for(let M=0;M<e.harmonics.length;M++){let T=e.harmonics[M];T instanceof Es&&(w.set(new Uint8Array(T.minmaxMatrix.data.buffer),S),S+=a),w.set(new Uint8Array(T.quantized.data.buffer),S),S+=T.quantized.data.byteLength}return new kB(w.buffer)}}});async function gZ(e){return createImageBitmap(new Blob([e]))}async function vZ(e){return fetch(e).then(t=>{if(!t.ok)throw new Error(`Failed to fetch image: ${t.statusText}`);return t.blob()}).then(t=>createImageBitmap(t))}function GRe(e){if(typeof e.requestVideoFrameCallback!="function"){e.hanaClockBase=++jB*zRe;return}e.hanaPresentedFrames=++jB;let t=()=>{e.hanaDisposed||(e.hanaPresentedFrames=++jB)};e.addEventListener("seeked",t);let i=()=>{t(),!e.hanaDisposed&&(e.hanaFrameCallback=e.requestVideoFrameCallback(i))};e.hanaFrameCallback=e.requestVideoFrameCallback(i)}function yZ(e){let t=e.hanaPresentedFrames;return t===void 0?e.hanaClockBase+e.currentTime:t}function jRe(e,t){e.hanaObjectUrl=URL.createObjectURL(t),e.src=e.hanaObjectUrl}function HB(e){if(e.hanaDisposed)return;e.hanaDisposed=!0;let t=e.hanaFrameCallback;t!==void 0&&(e.hanaFrameCallback=void 0,typeof e.cancelVideoFrameCallback=="function"&&e.cancelVideoFrameCallback(t));let i=e.hanaObjectUrl;i!==void 0&&(e.hanaObjectUrl=void 0,URL.revokeObjectURL(i)),e.pause(),e.removeAttribute("src"),e.load()}function HRe(e){let t=r=>{let n=e.error;return new Error(n===null?r:`${r} (code ${n.code}: ${n.message})`)},i=r=>{let n=t(r);return HB(e),n};return e.error!==null?Promise.reject(i("video failed to load")):e.readyState>=kRe?Promise.resolve(e):new Promise((r,n)=>{let s=setTimeout(()=>a(n,i("video timed out before presenting a frame")),VRe),a=(u,h)=>{clearTimeout(s),e.removeEventListener("loadeddata",o),e.removeEventListener("canplay",o),e.removeEventListener("error",l),u(h)},o=()=>a(r,e),l=()=>a(n,i("video failed to load"));e.addEventListener("loadeddata",o),e.addEventListener("canplay",o),e.addEventListener("error",l)})}function _Z(e){return e.preload="auto",e.autoplay=!0,e.loop=!0,e.muted=!0,e.playsInline=!0,e.currentTime=.01,e.load(),e.onloadeddata=()=>{e.muted=!0;let t=e.play();t!==void 0&&t.then(i=>{}).catch(()=>{e.play()}).finally(()=>{e.pause()})},GRe(e),HRe(e)}async function bZ(e){let t=document.createElement("video");return jRe(t,new Blob([e])),_Z(t)}async function xZ(e){let t=document.createElement("video");return t.crossOrigin="anonymous",t.src=e,_Z(t)}var jB,zRe,kRe,VRe,wZ=QA(()=>{"use strict";jB=0,zRe=1e6,kRe=2,VRe=3e4});var LZ={};DB(LZ,{DeviceLostPromise:()=>rm,Engine:()=>nm,PixelReadPromise:()=>Jc,SceneController:()=>tS,addRealizedChild:()=>WRe,componentInstanceRefreshOps:()=>qRe,default:()=>$Pe,dematerializeInstance:()=>$Re,duplicateComponentInstance:()=>XRe,initSync:()=>qPe,overrideForRealizedEdit:()=>YRe,realizeComponentInstance:()=>KRe,removeRealizedNode:()=>ZRe,web_init:()=>QRe});function WRe(e,t,i,r,n){let s=de.addRealizedChild(ne(e),ne(t),ne(i),ne(r),ne(n));return ii(s)}function qRe(e,t,i,r,n){let s=de.componentInstanceRefreshOps(ne(e),ne(t),ne(i),ne(r),ne(n));return ii(s)}function $Re(e,t,i,r){let n=de.dematerializeInstance(ne(e),ne(t),ne(i),ne(r));return ii(n)}function XRe(e,t,i,r){let n=de.duplicateComponentInstance(ne(e),ne(t),ne(i),ne(r));return ii(n)}function YRe(e,t,i,r,n){let s=de.overrideForRealizedEdit(ne(e),ne(t),ne(i),ne(r),ne(n));return ii(s)}function KRe(e,t,i){let r=de.realizeComponentInstance(ne(e),ne(t),ne(i));return ii(r)}function ZRe(e,t,i,r){let n=de.removeRealizedNode(ne(e),ne(t),ne(i),ne(r));return ii(n)}function QRe(){de.web_init()}function IZ(){return{__proto__:null,"./hana_bg.js":{__proto__:null,__wbg_Error_ef53bc310eb298a0:function(t,i){let r=Error(Hi(t,i));return ne(r)},__wbg_Number_6b506e6536831eaa:function(t){return Number(C(t))},__wbg_Window_afcc911b2f9c92e2:function(t){let i=C(t).Window;return ne(i)},__wbg_WorkerGlobalScope_5d19ebc889ff397e:function(t){let i=C(t).WorkerGlobalScope;return ne(i)},__wbg___wbindgen_bigint_get_as_i64_38130e98eecd467d:function(t,i){let r=C(i),n=typeof r=="bigint"?r:void 0;di().setBigInt64(t+8,ci(n)?BigInt(0):n,!0),di().setInt32(t+0,!ci(n),!0)},__wbg___wbindgen_boolean_get_1a45e2c38d4d41b9:function(t){let i=C(t),r=typeof i=="boolean"?i:void 0;return ci(r)?16777215:r?1:0},__wbg___wbindgen_debug_string_0accd80f45e5faa2:function(t,i){let r=eU(C(i)),n=As(r,de.__wbindgen_export,de.__wbindgen_export2),s=On;di().setInt32(t+4,s,!0),di().setInt32(t+0,n,!0)},__wbg___wbindgen_in_70a403a56e771704:function(t,i){return C(t)in C(i)},__wbg___wbindgen_is_bigint_6ffd6468a9bc44b9:function(t){return typeof C(t)=="bigint"},__wbg___wbindgen_is_function_754e9f305ff6029e:function(t){return typeof C(t)=="function"},__wbg___wbindgen_is_null_87c3bfe968c6a5ad:function(t){return C(t)===null},__wbg___wbindgen_is_null_or_undefined_cf617b836541fad3:function(t){return C(t)==null},__wbg___wbindgen_is_object_56732c2bc353f41d:function(t){let i=C(t);return typeof i=="object"&&i!==null},__wbg___wbindgen_is_string_c236cabd84a4d769:function(t){return typeof C(t)=="string"},__wbg___wbindgen_is_undefined_67b456be8673d3d7:function(t){return C(t)===void 0},__wbg___wbindgen_jsval_eq_1068e624fa87f6ab:function(t,i){return C(t)===C(i)},__wbg___wbindgen_jsval_loose_eq_2c56564c75129511:function(t,i){return C(t)==C(i)},__wbg___wbindgen_number_get_9bb1761122181af2:function(t,i){let r=C(i),n=typeof r=="number"?r:void 0;di().setFloat64(t+8,ci(n)?0:n,!0),di().setInt32(t+0,!ci(n),!0)},__wbg___wbindgen_string_get_72bdf95d3ae505b1:function(t,i){let r=C(i),n=typeof r=="string"?r:void 0;var s=ci(n)?0:As(n,de.__wbindgen_export,de.__wbindgen_export2),a=On;di().setInt32(t+4,a,!0),di().setInt32(t+0,s,!0)},__wbg___wbindgen_throw_1506f2235d1bdba0:function(t,i){throw new Error(Hi(t,i))},__wbg__wbg_cb_unref_61db23ac97f16c31:function(t){C(t)._wbg_cb_unref()},__wbg_activeTexture_7a0d6fe7120979ce:function(t,i){C(t).activeTexture(i>>>0)},__wbg_activeTexture_dd15c31d50b73529:function(t,i){C(t).activeTexture(i>>>0)},__wbg_addEventListener_5593b0efd622abd6:function(){return ti(function(t,i,r,n,s){C(t).addEventListener(Hi(i,r),C(n),C(s))},arguments)},__wbg_arrayBuffer_05927079aabe6d46:function(){return ti(function(t){let i=C(t).arrayBuffer();return ne(i)},arguments)},__wbg_assign_551ec2d000f70c24:function(){return ti(function(t,i,r){C(t).assign(Hi(i,r))},arguments)},__wbg_attachShader_5c6a46e7c0fc637a:function(t,i,r){C(t).attachShader(C(i),C(r))},__wbg_attachShader_c2b12b36afa45936:function(t,i,r){C(t).attachShader(C(i),C(r))},__wbg_beginComputePass_431a159006c13c7c:function(t,i){let r=C(t).beginComputePass(C(i));return ne(r)},__wbg_beginRenderPass_aa22c432e793359a:function(){return ti(function(t,i){let r=C(t).beginRenderPass(C(i));return ne(r)},arguments)},__wbg_bindBuffer_3841df88ccee4ed0:function(t,i,r){C(t).bindBuffer(i>>>0,C(r))},__wbg_bindBuffer_aa5dc7dc1c8ad1c8:function(t,i,r){C(t).bindBuffer(i>>>0,C(r))},__wbg_bindFramebuffer_10bbdf7040d89a17:function(t,i,r){C(t).bindFramebuffer(i>>>0,C(r))},__wbg_bindFramebuffer_ee8e42543c29c602:function(t,i,r){C(t).bindFramebuffer(i>>>0,C(r))},__wbg_bindRenderbuffer_7808d8eabbe18554:function(t,i,r){C(t).bindRenderbuffer(i>>>0,C(r))},__wbg_bindRenderbuffer_c0360bfb79c193c2:function(t,i,r){C(t).bindRenderbuffer(i>>>0,C(r))},__wbg_bindTexture_28d1d695d4801955:function(t,i,r){C(t).bindTexture(i>>>0,C(r))},__wbg_bindTexture_a1a012a31e1419d5:function(t,i,r){C(t).bindTexture(i>>>0,C(r))},__wbg_bindVertexArrayOES_15e48910a5d208b1:function(t,i){C(t).bindVertexArrayOES(C(i))},__wbg_bindVertexArray_4f2f0a7892280041:function(t,i){C(t).bindVertexArray(C(i))},__wbg_blendEquation_1ced323efc9ce0f8:function(t,i){C(t).blendEquation(i>>>0)},__wbg_blendEquation_a12f5acd9d14fb9b:function(t,i){C(t).blendEquation(i>>>0)},__wbg_blendFunc_d5202c7fe94c67ee:function(t,i,r){C(t).blendFunc(i>>>0,r>>>0)},__wbg_blendFunc_fbff85cd0fce280e:function(t,i,r){C(t).blendFunc(i>>>0,r>>>0)},__wbg_blitFramebuffer_acb954bfb30ed714:function(t,i,r,n,s,a,o,l,u,h,d){C(t).blitFramebuffer(i,r,n,s,a,o,l,u,h>>>0,d>>>0)},__wbg_bufferData_043a7e5da22f40d9:function(t,i,r,n){C(t).bufferData(i>>>0,r,n>>>0)},__wbg_bufferData_7b6881381d415425:function(t,i,r,n){C(t).bufferData(i>>>0,C(r),n>>>0)},__wbg_bufferData_9fddca30299e6114:function(t,i,r,n){C(t).bufferData(i>>>0,r,n>>>0)},__wbg_bufferData_f0837cec09725cc0:function(t,i,r,n){C(t).bufferData(i>>>0,C(r),n>>>0)},__wbg_bufferSubData_885e4f8d5833cf11:function(t,i,r,n){C(t).bufferSubData(i>>>0,r,C(n))},__wbg_bufferSubData_8fc824b6a9503f12:function(t,i,r,n){C(t).bufferSubData(i>>>0,r,C(n))},__wbg_call_8a89609d89f6608a:function(){return ti(function(t,i){let r=C(t).call(C(i));return ne(r)},arguments)},__wbg_call_9c758de292015997:function(){return ti(function(t,i,r){let n=C(t).call(C(i),C(r));return ne(n)},arguments)},__wbg_clearBufferfv_2e2858bd8bcf1715:function(t,i,r,n,s){C(t).clearBufferfv(i>>>0,r,ih(n,s))},__wbg_clearBufferiv_e356514eb1d165fe:function(t,i,r,n,s){C(t).clearBufferiv(i>>>0,r,DZ(n,s))},__wbg_compileShader_8810a4868b23621b:function(t,i){C(t).compileShader(C(i))},__wbg_compileShader_ec8d5eb7f2b70a48:function(t,i){C(t).compileShader(C(i))},__wbg_configure_0e4789c0f6b35c8e:function(){return ti(function(t,i){C(t).configure(C(i))},arguments)},__wbg_copyBufferSubData_9936fdf5e53e1832:function(t,i,r,n,s,a){C(t).copyBufferSubData(i>>>0,r>>>0,n,s,a)},__wbg_copyBufferToBuffer_5e2cd8f10ae78183:function(){return ti(function(t,i,r,n,s){C(t).copyBufferToBuffer(C(i),r,C(n),s)},arguments)},__wbg_copyBufferToBuffer_ca30deb8de65f5d5:function(){return ti(function(t,i,r,n,s,a){C(t).copyBufferToBuffer(C(i),r,C(n),s,a)},arguments)},__wbg_copyExternalImageToTexture_4df105bb39517948:function(){return ti(function(t,i,r,n){C(t).copyExternalImageToTexture(C(i),C(r),C(n))},arguments)},__wbg_copyTextureToBuffer_ed6e67a77ecb768d:function(){return ti(function(t,i,r,n){C(t).copyTextureToBuffer(C(i),C(r),C(n))},arguments)},__wbg_createBindGroupLayout_49a7e2b3d076afcf:function(){return ti(function(t,i){let r=C(t).createBindGroupLayout(C(i));return ne(r)},arguments)},__wbg_createBindGroup_655c6e6c0258530e:function(t,i){let r=C(t).createBindGroup(C(i));return ne(r)},__wbg_createBuffer_0726dd2ab09ea1d2:function(){return ti(function(t,i){let r=C(t).createBuffer(C(i));return ne(r)},arguments)},__wbg_createBuffer_333d6aae40284594:function(t){let i=C(t).createBuffer();return ci(i)?0:ne(i)},__wbg_createBuffer_3ae54605e5676c83:function(t){let i=C(t).createBuffer();return ci(i)?0:ne(i)},__wbg_createCommandEncoder_ec1f40f0cb4d09df:function(t,i){let r=C(t).createCommandEncoder(C(i));return ne(r)},__wbg_createComputePipelineAsync_afe7021ac5a02993:function(t,i){let r=C(t).createComputePipelineAsync(C(i));return ne(r)},__wbg_createFramebuffer_6f42ff976bb98152:function(t){let i=C(t).createFramebuffer();return ci(i)?0:ne(i)},__wbg_createFramebuffer_ef1247e8b2e9b09f:function(t){let i=C(t).createFramebuffer();return ci(i)?0:ne(i)},__wbg_createPipelineLayout_2c8cd4528b06c108:function(t,i){let r=C(t).createPipelineLayout(C(i));return ne(r)},__wbg_createProgram_b48c3323af547213:function(t){let i=C(t).createProgram();return ci(i)?0:ne(i)},__wbg_createProgram_f6a8df4491031d57:function(t){let i=C(t).createProgram();return ci(i)?0:ne(i)},__wbg_createQuerySet_cb7b21d1d405b890:function(){return ti(function(t,i){let r=C(t).createQuerySet(C(i));return ne(r)},arguments)},__wbg_createRenderPipelineAsync_eecad1e54ef27acf:function(t,i){let r=C(t).createRenderPipelineAsync(C(i));return ne(r)},__wbg_createRenderPipeline_cf98d4d699bfb03c:function(){return ti(function(t,i){let r=C(t).createRenderPipeline(C(i));return ne(r)},arguments)},__wbg_createRenderbuffer_a2f947c7fa8c8bf0:function(t){let i=C(t).createRenderbuffer();return ci(i)?0:ne(i)},__wbg_createRenderbuffer_c09d5809ac95924e:function(t){let i=C(t).createRenderbuffer();return ci(i)?0:ne(i)},__wbg_createSampler_c8ffb3c8d565f704:function(t,i){let r=C(t).createSampler(C(i));return ne(r)},__wbg_createShaderModule_2e44fc7677c6288b:function(t,i){let r=C(t).createShaderModule(C(i));return ne(r)},__wbg_createShader_0e3f814b69e9e184:function(t,i){let r=C(t).createShader(i>>>0);return ci(r)?0:ne(r)},__wbg_createShader_383b3295276271d2:function(t,i){let r=C(t).createShader(i>>>0);return ci(r)?0:ne(r)},__wbg_createTexture_1bac74c999b8a48e:function(){return ti(function(t,i){let r=C(t).createTexture(C(i));return ne(r)},arguments)},__wbg_createTexture_461a3048c40e7175:function(t){let i=C(t).createTexture();return ci(i)?0:ne(i)},__wbg_createTexture_d6e2c1f04a554a15:function(t){let i=C(t).createTexture();return ci(i)?0:ne(i)},__wbg_createVertexArrayOES_2f67d3679ba9a29c:function(t){let i=C(t).createVertexArrayOES();return ci(i)?0:ne(i)},__wbg_createVertexArray_febd1d11636d15ad:function(t){let i=C(t).createVertexArray();return ci(i)?0:ne(i)},__wbg_createView_ceaf2f5881adbd34:function(){return ti(function(t,i){let r=C(t).createView(C(i));return ne(r)},arguments)},__wbg_cullFace_a4ee8b8c3c126388:function(t,i){C(t).cullFace(i>>>0)},__wbg_cullFace_c6b39a55ccade015:function(t,i){C(t).cullFace(i>>>0)},__wbg_currentTime_0b40b60bc76843cb:function(t){return C(t).currentTime},__wbg_debug_78b457f1effb3792:function(t){console.debug(C(t))},__wbg_deleteBuffer_520156dc8a1f81af:function(t,i){C(t).deleteBuffer(C(i))},__wbg_deleteBuffer_a925fdd1b590fbbc:function(t,i){C(t).deleteBuffer(C(i))},__wbg_deleteFramebuffer_aa4bf9f184123318:function(t,i){C(t).deleteFramebuffer(C(i))},__wbg_deleteFramebuffer_cc043e5a8cb9a556:function(t,i){C(t).deleteFramebuffer(C(i))},__wbg_deleteProgram_0c859ebcab2b7b5a:function(t,i){C(t).deleteProgram(C(i))},__wbg_deleteProgram_df6a6609c7d91a6e:function(t,i){C(t).deleteProgram(C(i))},__wbg_deleteRenderbuffer_37c079dbc257fcf9:function(t,i){C(t).deleteRenderbuffer(C(i))},__wbg_deleteRenderbuffer_4b7a888363766554:function(t,i){C(t).deleteRenderbuffer(C(i))},__wbg_deleteShader_170dea06bd074d01:function(t,i){C(t).deleteShader(C(i))},__wbg_deleteShader_944accd60733a9cb:function(t,i){C(t).deleteShader(C(i))},__wbg_deleteTexture_54dee8e15570751e:function(t,i){C(t).deleteTexture(C(i))},__wbg_deleteTexture_be3eaabebb89a85e:function(t,i){C(t).deleteTexture(C(i))},__wbg_deleteVertexArrayOES_4262d2d0e9fb77c5:function(t,i){C(t).deleteVertexArrayOES(C(i))},__wbg_deleteVertexArray_8f0fb3b3d54c7483:function(t,i){C(t).deleteVertexArray(C(i))},__wbg_depthMask_95332b64c5ef8b45:function(t,i){C(t).depthMask(i!==0)},__wbg_depthMask_f55bea4b6c3b9531:function(t,i){C(t).depthMask(i!==0)},__wbg_description_02485704e69b1e7f:function(t,i){let r=C(i).description,n=As(r,de.__wbindgen_export,de.__wbindgen_export2),s=On;di().setInt32(t+4,s,!0),di().setInt32(t+0,n,!0)},__wbg_disable_2cf98ccb81612ef9:function(t,i){C(t).disable(i>>>0)},__wbg_disable_6b825656c54f5646:function(t,i){C(t).disable(i>>>0)},__wbg_dispatchWorkgroups_afb2344298c62227:function(t,i,r,n){C(t).dispatchWorkgroups(i>>>0,r>>>0,n>>>0)},__wbg_displayHeight_465673c1823a1db3:function(t){return C(t).displayHeight},__wbg_displayWidth_73729fd8eb965076:function(t){return C(t).displayWidth},__wbg_disposeVideo_c94c1ccd57a63f68:function(t){HB(C(t))},__wbg_document_aceb08cd6489baf5:function(t){let i=C(t).document;return ci(i)?0:ne(i)},__wbg_done_60cf307fcc680536:function(t){return C(t).done},__wbg_drawArrays_6eb87620c1dcbfb4:function(t,i,r,n){C(t).drawArrays(i>>>0,r,n)},__wbg_drawArrays_f332b526550a641e:function(t,i,r,n){C(t).drawArrays(i>>>0,r,n)},__wbg_drawBuffersWEBGL_10cdfe87c17cd93f:function(t,i){C(t).drawBuffersWEBGL(C(i))},__wbg_drawBuffers_c5a9ee312b2d6fa8:function(t,i){C(t).drawBuffers(C(i))},__wbg_drawElements_23ec4847dad548e0:function(t,i,r,n,s){C(t).drawElements(i>>>0,r,n>>>0,s)},__wbg_drawElements_fe4671e9c358058d:function(t,i,r,n,s){C(t).drawElements(i>>>0,r,n>>>0,s)},__wbg_drawIndexed_d31913e79d58fbac:function(t,i,r,n,s,a){C(t).drawIndexed(i>>>0,r>>>0,n>>>0,s,a>>>0)},__wbg_draw_6877f98847e1e36c:function(t,i,r,n,s){C(t).draw(i>>>0,r>>>0,n>>>0,s>>>0)},__wbg_duration_d6a6a568a0baf72d:function(t){return C(t).duration},__wbg_enableVertexAttribArray_cc09a0312b6adee5:function(t,i){C(t).enableVertexAttribArray(i>>>0)},__wbg_enableVertexAttribArray_f88d3d499ab40ea6:function(t,i){C(t).enableVertexAttribArray(i>>>0)},__wbg_enable_1928c361308989d5:function(t,i){C(t).enable(i>>>0)},__wbg_enable_2cc4ff32a0fd985f:function(t,i){C(t).enable(i>>>0)},__wbg_end_c36889de8ddef882:function(t){C(t).end()},__wbg_end_f99ebed53d4e198a:function(t){C(t).end()},__wbg_engine_new:function(t){let i=nm.__wrap(t);return ne(i)},__wbg_entries_04b37a02507f1713:function(t){let i=Object.entries(C(t));return ne(i)},__wbg_error_78ff5b3a29b770e0:function(t){console.error(C(t))},__wbg_error_a6fa202b58aa1cd3:function(t,i){let r,n;try{r=t,n=i,console.error(Hi(t,i))}finally{de.__wbindgen_export4(r,n,1)}},__wbg_features_2b07a28fe18ad0ce:function(t){let i=C(t).features;return ne(i)},__wbg_features_d4d2020319592cbe:function(t){let i=C(t).features;return ne(i)},__wbg_fetch_ce1af4d1b59a60be:function(t,i){let r=C(t).fetch(C(i));return ne(r)},__wbg_finish_4d91de5e927dd13f:function(t,i){let r=C(t).finish(C(i));return ne(r)},__wbg_finish_6e06b68ab68cd9f6:function(t){let i=C(t).finish();return ne(i)},__wbg_flush_2088ebca1fd13068:function(t){C(t).flush()},__wbg_flush_3be48fce9f195fa5:function(t){C(t).flush()},__wbg_framebufferRenderbuffer_0c9d0e5587497683:function(t,i,r,n,s){C(t).framebufferRenderbuffer(i>>>0,r>>>0,n>>>0,C(s))},__wbg_framebufferRenderbuffer_599e58ad30dcfeb3:function(t,i,r,n,s){C(t).framebufferRenderbuffer(i>>>0,r>>>0,n>>>0,C(s))},__wbg_framebufferTexture2D_44caed1725e57636:function(t,i,r,n,s,a){C(t).framebufferTexture2D(i>>>0,r>>>0,n>>>0,C(s),a)},__wbg_framebufferTexture2D_fbba21b750c2316a:function(t,i,r,n,s,a){C(t).framebufferTexture2D(i>>>0,r>>>0,n>>>0,C(s),a)},__wbg_from_d300fe49deab18f5:function(t){let i=Array.from(C(t));return ne(i)},__wbg_generateMipmap_1403959fc241438f:function(t,i){C(t).generateMipmap(i>>>0)},__wbg_generateMipmap_b261c040d5707fe5:function(t,i){C(t).generateMipmap(i>>>0)},__wbg_getActiveUniform_3a275fd8fdf7a327:function(t,i,r){let n=C(t).getActiveUniform(C(i),r>>>0);return ci(n)?0:ne(n)},__wbg_getActiveUniform_86f7a30e1a52aca4:function(t,i,r){let n=C(t).getActiveUniform(C(i),r>>>0);return ci(n)?0:ne(n)},__wbg_getContext_469d34698d869fc1:function(){return ti(function(t,i,r){let n=C(t).getContext(Hi(i,r));return ci(n)?0:ne(n)},arguments)},__wbg_getContext_5b39fff76491fded:function(){return ti(function(t,i,r,n){let s=C(t).getContext(Hi(i,r),C(n));return ci(s)?0:ne(s)},arguments)},__wbg_getContext_7d3a8f461c828713:function(){return ti(function(t,i,r){let n=C(t).getContext(Hi(i,r));return ci(n)?0:ne(n)},arguments)},__wbg_getCurrentTexture_20714d1bd9051cab:function(){return ti(function(t){let i=C(t).getCurrentTexture();return ne(i)},arguments)},__wbg_getExtension_454cdc5ffd07bf03:function(){return ti(function(t,i,r){let n=C(t).getExtension(Hi(i,r));return ci(n)?0:ne(n)},arguments)},__wbg_getMappedRange_d0bf3141224111b6:function(){return ti(function(t,i,r){let n=C(t).getMappedRange(i,r);return ne(n)},arguments)},__wbg_getParameter_015942a7ad566b20:function(){return ti(function(t,i){let r=C(t).getParameter(i>>>0);return ne(r)},arguments)},__wbg_getParameter_1e77e23f5ccf0300:function(){return ti(function(t,i){let r=C(t).getParameter(i>>>0);return ne(r)},arguments)},__wbg_getPreferredCanvasFormat_8b57039d1801a506:function(t){let i=C(t).getPreferredCanvasFormat();return(s0.indexOf(i)+1||102)-1},__wbg_getProgramInfoLog_2f9cfcecc4f772e1:function(t,i,r){let n=C(i).getProgramInfoLog(C(r));var s=ci(n)?0:As(n,de.__wbindgen_export,de.__wbindgen_export2),a=On;di().setInt32(t+4,a,!0),di().setInt32(t+0,s,!0)},__wbg_getProgramInfoLog_f0d48f606547aed7:function(t,i,r){let n=C(i).getProgramInfoLog(C(r));var s=ci(n)?0:As(n,de.__wbindgen_export,de.__wbindgen_export2),a=On;di().setInt32(t+4,a,!0),di().setInt32(t+0,s,!0)},__wbg_getProgramParameter_08beabb2736d5769:function(t,i,r){let n=C(t).getProgramParameter(C(i),r>>>0);return ne(n)},__wbg_getProgramParameter_aee848e1db52b7cd:function(t,i,r){let n=C(t).getProgramParameter(C(i),r>>>0);return ne(n)},__wbg_getRandomValues_3f44b700395062e5:function(){return ti(function(t,i){globalThis.crypto.getRandomValues(im(t,i))},arguments)},__wbg_getRandomValues_bf16787eede473f5:function(){return ti(function(t,i){globalThis.crypto.getRandomValues(im(t,i))},arguments)},__wbg_getShaderInfoLog_510365af17f29a35:function(t,i,r){let n=C(i).getShaderInfoLog(C(r));var s=ci(n)?0:As(n,de.__wbindgen_export,de.__wbindgen_export2),a=On;di().setInt32(t+4,a,!0),di().setInt32(t+0,s,!0)},__wbg_getShaderInfoLog_cd77c7b7bdb9ce65:function(t,i,r){let n=C(i).getShaderInfoLog(C(r));var s=ci(n)?0:As(n,de.__wbindgen_export,de.__wbindgen_export2),a=On;di().setInt32(t+4,a,!0),di().setInt32(t+0,s,!0)},__wbg_getSupportedExtensions_7a31b3412a25d9ba:function(t){let i=C(t).getSupportedExtensions();return ci(i)?0:ne(i)},__wbg_getUniformLocation_010256f946f9a865:function(t,i,r,n){let s=C(t).getUniformLocation(C(i),Hi(r,n));return ci(s)?0:ne(s)},__wbg_getUniformLocation_f9774d4f157f5914:function(t,i,r,n){let s=C(t).getUniformLocation(C(i),Hi(r,n));return ci(s)?0:ne(s)},__wbg_get_1f8f054ddbaa7db2:function(){return ti(function(t,i){let r=Reflect.get(C(t),C(i));return ne(r)},arguments)},__wbg_get_2b48c7d0d006a781:function(t,i){let r=C(t)[i>>>0];return ne(r)},__wbg_get_cb935c1402921898:function(t,i){let r=C(t)[i>>>0];return ci(r)?0:ne(r)},__wbg_get_de6a0f7d4d18a304:function(){return ti(function(t,i){let r=Reflect.get(C(t),C(i));return ne(r)},arguments)},__wbg_get_index_ab123d64c89e3156:function(t,i){return C(t)[i>>>0]},__wbg_get_unchecked_33f6e5c9e2f2d6b2:function(t,i){let r=C(t)[i>>>0];return ne(r)},__wbg_get_with_ref_key_6412cf3094599694:function(t,i){let r=C(t)[C(i)];return ne(r)},__wbg_get_with_ref_key_7e638bba08a44478:function(t,i){let r=C(t)[C(i)];return ne(r)},__wbg_gpu_2ccc250735d24a2a:function(t){let i=C(t).gpu;return ne(i)},__wbg_has_0c97053e877f47cc:function(t,i,r){return C(t).has(Hi(i,r))},__wbg_has_73740b27f436fed3:function(){return ti(function(t,i){return Reflect.has(C(t),C(i))},arguments)},__wbg_height_4e7694e4e2110bdb:function(t){return C(t).height},__wbg_info_af7f45292ba9b0ea:function(t){console.info(C(t))},__wbg_info_cf0d9a286850cd24:function(t){let i=C(t).info;return ne(i)},__wbg_innerHeight_8b6ee2571dbedb9d:function(){return ti(function(t){let i=C(t).innerHeight;return ne(i)},arguments)},__wbg_innerWidth_7475bec19f48fe43:function(){return ti(function(t){let i=C(t).innerWidth;return ne(i)},arguments)},__wbg_instanceof_ArrayBuffer_8f49811467741499:function(t){let i;try{i=C(t)instanceof ArrayBuffer}catch{i=!1}return i},__wbg_instanceof_GpuOutOfMemoryError_6429c750997f1c8d:function(t){let i;try{i=C(t)instanceof GPUOutOfMemoryError}catch{i=!1}return i},__wbg_instanceof_GpuValidationError_75fa3611f065f4df:function(t){let i;try{i=C(t)instanceof GPUValidationError}catch{i=!1}return i},__wbg_instanceof_HtmlVideoElement_95590e1ff107ba83:function(t){let i;try{i=C(t)instanceof HTMLVideoElement}catch{i=!1}return i},__wbg_instanceof_ImageBitmap_beed1259521cd66d:function(t){let i;try{i=C(t)instanceof ImageBitmap}catch{i=!1}return i},__wbg_instanceof_Response_cb984bd66d7bd408:function(t){let i;try{i=C(t)instanceof Response}catch{i=!1}return i},__wbg_instanceof_Uint8Array_86f30649f63ef9c2:function(t){let i;try{i=C(t)instanceof Uint8Array}catch{i=!1}return i},__wbg_instanceof_WebGl2RenderingContext_39d13e3f953130c7:function(t){let i;try{i=C(t)instanceof WebGL2RenderingContext}catch{i=!1}return i},__wbg_instanceof_Window_e093be59ee9a8e14:function(t){let i;try{i=C(t)instanceof Window}catch{i=!1}return i},__wbg_invalidateFramebuffer_6b8dae55a3debb1d:function(){return ti(function(t,i,r){C(t).invalidateFramebuffer(i>>>0,C(r))},arguments)},__wbg_isArray_67c2c9c4313f4448:function(t){return Array.isArray(C(t))},__wbg_isFallbackAdapter_8ccb967428491dcb:function(t){return C(t).isFallbackAdapter},__wbg_isSafeInteger_66acec27e09e99a7:function(t){return Number.isSafeInteger(C(t))},__wbg_iterator_8732428d309e270e:function(){return ne(Symbol.iterator)},__wbg_label_7ed42f25f841996b:function(t,i){let r=C(i).label,n=As(r,de.__wbindgen_export,de.__wbindgen_export2),s=On;di().setInt32(t+4,s,!0),di().setInt32(t+0,n,!0)},__wbg_length_280688879ee7deb5:function(t){return C(t).length},__wbg_length_4a591ecaa01354d9:function(t){return C(t).length},__wbg_length_66f1a4b2e9026940:function(t){return C(t).length},__wbg_limits_20c6f56636df7d38:function(t){let i=C(t).limits;return ne(i)},__wbg_limits_328c61cd41512420:function(t){let i=C(t).limits;return ne(i)},__wbg_linkProgram_3ccc9beaa6dace28:function(t,i){C(t).linkProgram(C(i))},__wbg_linkProgram_fe2b1bf26336c4a5:function(t,i){C(t).linkProgram(C(i))},__wbg_loadImageFromBytes_3d42766b73aca4ca:function(t){let i=gZ(ii(t));return ne(i)},__wbg_loadImageFromUrl_50be99dbf040255b:function(t,i){let r,n;try{r=t,n=i;let s=vZ(Hi(t,i));return ne(s)}finally{de.__wbindgen_export4(r,n,1)}},__wbg_loadVideoFromBytes_3d884aadcf4d2139:function(t){let i=bZ(ii(t));return ne(i)},__wbg_loadVideoFromUrl_7997ffb030d4b08b:function(t,i){let r,n;try{r=t,n=i;let s=xZ(Hi(t,i));return ne(s)}finally{de.__wbindgen_export4(r,n,1)}},__wbg_location_efdf1fea18b5552a:function(t){let i=C(t).location;return ne(i)},__wbg_log_cf2e968649f3384e:function(t){console.log(C(t))},__wbg_lost_0fa164c88f543338:function(t){let i=C(t).lost;return ne(i)},__wbg_mapAsync_52b01fa9e8f765fd:function(t,i,r,n){let s=C(t).mapAsync(i>>>0,r,n);return ne(s)},__wbg_maxBindGroupsPlusVertexBuffers_33e5006b23e20478:function(t){return C(t).maxBindGroupsPlusVertexBuffers},__wbg_maxBindGroups_f6d26f3a67826666:function(t){return C(t).maxBindGroups},__wbg_maxBindingsPerBindGroup_edab2e8dabbf6060:function(t){return C(t).maxBindingsPerBindGroup},__wbg_maxBufferSize_bbc69284c14aa7da:function(t){return C(t).maxBufferSize},__wbg_maxColorAttachmentBytesPerSample_63ebe4f81de2f34c:function(t){return C(t).maxColorAttachmentBytesPerSample},__wbg_maxColorAttachments_aed8c38beabf3a5c:function(t){return C(t).maxColorAttachments},__wbg_maxComputeInvocationsPerWorkgroup_2d964564c37f1c65:function(t){return C(t).maxComputeInvocationsPerWorkgroup},__wbg_maxComputeWorkgroupSizeX_a3e3206570da184f:function(t){return C(t).maxComputeWorkgroupSizeX},__wbg_maxComputeWorkgroupSizeY_dffa4a62244b7563:function(t){return C(t).maxComputeWorkgroupSizeY},__wbg_maxComputeWorkgroupSizeZ_976ebcb760f6d07d:function(t){return C(t).maxComputeWorkgroupSizeZ},__wbg_maxComputeWorkgroupStorageSize_2e8dbece6e532e2a:function(t){return C(t).maxComputeWorkgroupStorageSize},__wbg_maxComputeWorkgroupsPerDimension_bb7d36b4d20c80f4:function(t){return C(t).maxComputeWorkgroupsPerDimension},__wbg_maxDynamicStorageBuffersPerPipelineLayout_1ca859cb96a414e0:function(t){return C(t).maxDynamicStorageBuffersPerPipelineLayout},__wbg_maxDynamicUniformBuffersPerPipelineLayout_e968f2c8cd8f4d46:function(t){return C(t).maxDynamicUniformBuffersPerPipelineLayout},__wbg_maxInterStageShaderVariables_138ac882c4d6a3d3:function(t){return C(t).maxInterStageShaderVariables},__wbg_maxSampledTexturesPerShaderStage_bb3e6b2698321fa6:function(t){return C(t).maxSampledTexturesPerShaderStage},__wbg_maxSamplersPerShaderStage_98c00a1829fa414b:function(t){return C(t).maxSamplersPerShaderStage},__wbg_maxStorageBufferBindingSize_e500e31f479e669e:function(t){return C(t).maxStorageBufferBindingSize},__wbg_maxStorageBuffersPerShaderStage_eb663f6d7521b6a7:function(t){return C(t).maxStorageBuffersPerShaderStage},__wbg_maxStorageTexturesPerShaderStage_bb3ad93b53e618c0:function(t){return C(t).maxStorageTexturesPerShaderStage},__wbg_maxTextureArrayLayers_2a56d05fb261c99a:function(t){return C(t).maxTextureArrayLayers},__wbg_maxTextureDimension1D_84590c1d4770d319:function(t){return C(t).maxTextureDimension1D},__wbg_maxTextureDimension2D_7f2b5c8b2727e3fc:function(t){return C(t).maxTextureDimension2D},__wbg_maxTextureDimension3D_7f3babddf55c32a6:function(t){return C(t).maxTextureDimension3D},__wbg_maxUniformBufferBindingSize_d80a09e23c0b284c:function(t){return C(t).maxUniformBufferBindingSize},__wbg_maxUniformBuffersPerShaderStage_0b8b2de676fa740e:function(t){return C(t).maxUniformBuffersPerShaderStage},__wbg_maxVertexAttributes_a693dd921316649b:function(t){return C(t).maxVertexAttributes},__wbg_maxVertexBufferArrayStride_f256d91f281076cb:function(t){return C(t).maxVertexBufferArrayStride},__wbg_maxVertexBuffers_70ab564b25d5ac20:function(t){return C(t).maxVertexBuffers},__wbg_message_28959d6ca4d7dda0:function(t,i){let r=C(i).message,n=As(r,de.__wbindgen_export,de.__wbindgen_export2),s=On;di().setInt32(t+4,s,!0),di().setInt32(t+0,n,!0)},__wbg_message_4ada57a3710f1502:function(t,i){let r=C(i).message,n=As(r,de.__wbindgen_export,de.__wbindgen_export2),s=On;di().setInt32(t+4,s,!0),di().setInt32(t+0,n,!0)},__wbg_minStorageBufferOffsetAlignment_3248ed00dcdbf79f:function(t){return C(t).minStorageBufferOffsetAlignment},__wbg_minUniformBufferOffsetAlignment_3b9fa4caae03e903:function(t){return C(t).minUniformBufferOffsetAlignment},__wbg_name_b7fa2500fc153b89:function(t,i){let r=C(i).name,n=As(r,de.__wbindgen_export,de.__wbindgen_export2),s=On;di().setInt32(t+4,s,!0),di().setInt32(t+0,n,!0)},__wbg_navigator_3833ecdbc19d2757:function(t){let i=C(t).navigator;return ne(i)},__wbg_navigator_391291470f58c650:function(t){let i=C(t).navigator;return ne(i)},__wbg_new_227d7c05414eb861:function(){let t=new Error;return ne(t)},__wbg_new_3b242422c588a8f3:function(){return ti(function(t,i){let r=new OffscreenCanvas(t>>>0,i>>>0);return ne(r)},arguments)},__wbg_new_578aeef4b6b94378:function(t){let i=new Uint8Array(C(t));return ne(i)},__wbg_new_b682b81e8eaaf027:function(t,i){try{var r={a:t,b:i},n=(a,o)=>{let l=r.a;r.a=0;try{return SZ(l,r.b,a,o)}finally{r.a=l}};let s=new Promise(n);return ne(s)}finally{r.a=0}},__wbg_new_ce1ab61c1c2b300d:function(){let t=new Object;return ne(t)},__wbg_new_d90091b82fdf5b91:function(){let t=new Array;return ne(t)},__wbg_new_from_slice_18fa1f71286d66b8:function(t,i){let r=new Uint8Array(im(t,i));return ne(r)},__wbg_new_from_slice_3c93d0bc613de8f0:function(t,i){let r=new Float64Array(PPe(t,i));return ne(r)},__wbg_new_from_slice_47be4219028de35d:function(t,i){let r=new Uint32Array(jw(t,i));return ne(r)},__wbg_new_from_slice_956df4f769fb782c:function(t,i){let r=new Float32Array(ih(t,i));return ne(r)},__wbg_new_typed_41c97238ee4583e3:function(){let t=new Object;return ne(t)},__wbg_new_typed_bf31d18f92484486:function(t,i){try{var r={a:t,b:i},n=(a,o)=>{let l=r.a;r.a=0;try{return SZ(l,r.b,a,o)}finally{r.a=l}};let s=new Promise(n);return ne(s)}finally{r.a=0}},__wbg_new_with_byte_offset_and_length_d836f26d916dd9ad:function(t,i,r){let n=new Uint8Array(C(t),i>>>0,r>>>0);return ne(n)},__wbg_new_with_length_36a4998e27b014c5:function(t){let i=new Uint8Array(t>>>0);return ne(i)},__wbg_new_with_length_b4a87ccced374381:function(t){let i=new Float64Array(t>>>0);return ne(i)},__wbg_new_with_str_and_init_bcd02b79a793d27f:function(){return ti(function(t,i,r){let n=new Request(Hi(t,i),C(r));return ne(n)},arguments)},__wbg_next_9e03acdf51c4960d:function(t){let i=C(t).next;return ne(i)},__wbg_next_eb8ca7351fa27906:function(){return ti(function(t){let i=C(t).next();return ne(i)},arguments)},__wbg_now_f565250295e2d180:function(t){return C(t).now()},__wbg_of_57145fdec12d159f:function(t){let i=Array.of(C(t));return ne(i)},__wbg_ok_fb13c30bc1893039:function(t){return C(t).ok},__wbg_onSubmittedWorkDone_270d6b5a45520e79:function(t){let i=C(t).onSubmittedWorkDone();return ne(i)},__wbg_open_177ad1dcc06b9106:function(){return ti(function(t,i,r,n,s,a,o){let l=C(t).open(Hi(i,r),Hi(n,s),Hi(a,o));return ci(l)?0:ne(l)},arguments)},__wbg_open_feb75fe4d9971c50:function(){return ti(function(t,i,r,n,s){let a=C(t).open(Hi(i,r),Hi(n,s));return ci(a)?0:ne(a)},arguments)},__wbg_ownKeys_0587b8fe286a40e6:function(){return ti(function(t){let i=Reflect.ownKeys(C(t));return ne(i)},arguments)},__wbg_pause_adce2b37e004ae49:function(){return ti(function(t){C(t).pause()},arguments)},__wbg_performance_68499ca0718837f5:function(t){let i=C(t).performance;return ci(i)?0:ne(i)},__wbg_pixelStorei_6e42d231aa75bd00:function(t,i,r){C(t).pixelStorei(i>>>0,r)},__wbg_pixelStorei_84dc1952dc699c94:function(t,i,r){C(t).pixelStorei(i>>>0,r)},__wbg_play_4ed9ece3cae2c100:function(){return ti(function(t){let i=C(t).play();return ne(i)},arguments)},__wbg_popErrorScope_8e7f4cbff8b758dd:function(t){let i=C(t).popErrorScope();return ne(i)},__wbg_prototypesetcall_3249fc62a0fafa30:function(t,i,r){Uint8Array.prototype.set.call(im(t,i),C(r))},__wbg_prototypesetcall_59640349d2c6d881:function(t,i,r){Uint32Array.prototype.set.call(jw(t,i),C(r))},__wbg_provokingVertexWEBGL_0354dc7ad44d69bf:function(t,i){C(t).provokingVertexWEBGL(i>>>0)},__wbg_pushErrorScope_fa23d1206bc26dce:function(t,i){C(t).pushErrorScope(fPe[i])},__wbg_push_a6822215aa43e71c:function(t,i){return C(t).push(C(i))},__wbg_querySelectorAll_4dcc230a2f8a2498:function(){return ti(function(t,i,r){let n=C(t).querySelectorAll(Hi(i,r));return ne(n)},arguments)},__wbg_queueMicrotask_35c611f4a14830b2:function(t){queueMicrotask(C(t))},__wbg_queueMicrotask_404ed0a58e0b63cc:function(t){let i=C(t).queueMicrotask;return ne(i)},__wbg_queue_adce34608fd0c893:function(t){let i=C(t).queue;return ne(i)},__wbg_readBuffer_2027f7cdd7533f2d:function(t,i){C(t).readBuffer(i>>>0)},__wbg_readPixels_a04f5cf5019be695:function(){return ti(function(t,i,r,n,s,a,o,l){C(t).readPixels(i,r,n,s,a>>>0,o>>>0,C(l))},arguments)},__wbg_readPixels_bf9ee726d9179d3c:function(){return ti(function(t,i,r,n,s,a,o,l){C(t).readPixels(i,r,n,s,a>>>0,o>>>0,C(l))},arguments)},__wbg_readPixels_d00c1cae608273d8:function(){return ti(function(t,i,r,n,s,a,o,l){C(t).readPixels(i,r,n,s,a>>>0,o>>>0,l)},arguments)},__wbg_readyState_77b1b1db1b8c2a5f:function(t){return C(t).readyState},__wbg_reason_b02cd587d1a09948:function(t){let i=C(t).reason;return(pPe.indexOf(i)+1||3)-1},__wbg_renderbufferStorageMultisample_75bba97a8e59bc6e:function(t,i,r,n,s,a){C(t).renderbufferStorageMultisample(i>>>0,r,n>>>0,s,a)},__wbg_renderbufferStorage_3f5b0ec8fca2f9f8:function(t,i,r,n,s){C(t).renderbufferStorage(i>>>0,r>>>0,n,s)},__wbg_renderbufferStorage_c34a47cacbbc5fff:function(t,i,r,n,s){C(t).renderbufferStorage(i>>>0,r>>>0,n,s)},__wbg_requestAdapter_2e6718811c735a57:function(t,i){let r=C(t).requestAdapter(C(i));return ne(r)},__wbg_requestDevice_ab46d0519ea1cc34:function(t,i){let r=C(t).requestDevice(C(i));return ne(r)},__wbg_resolveQuerySet_0f32dc3de3f09701:function(t,i,r,n,s,a){C(t).resolveQuerySet(C(i),r>>>0,n>>>0,C(s),a>>>0)},__wbg_resolve_25a7e548d5881dca:function(t){let i=Promise.resolve(C(t));return ne(i)},__wbg_scissor_079b7c4a5c9fcb63:function(t,i,r,n,s){C(t).scissor(i,r,n,s)},__wbg_scissor_e69faa631ab6fdc0:function(t,i,r,n,s){C(t).scissor(i,r,n,s)},__wbg_setBindGroup_268fd1714fff0ef5:function(){return ti(function(t,i,r,n,s,a,o){C(t).setBindGroup(i>>>0,C(r),jw(n,s),a,o>>>0)},arguments)},__wbg_setBindGroup_3e4ce136bc833ea1:function(){return ti(function(t,i,r,n,s,a,o){C(t).setBindGroup(i>>>0,C(r),jw(n,s),a,o>>>0)},arguments)},__wbg_setBindGroup_c22a1b95c0b17f37:function(t,i,r){C(t).setBindGroup(i>>>0,C(r))},__wbg_setBindGroup_f0de6cb2c7dbfc2c:function(t,i,r){C(t).setBindGroup(i>>>0,C(r))},__wbg_setIndexBuffer_2531a9103450445e:function(t,i,r,n){C(t).setIndexBuffer(C(i),$B[r],n)},__wbg_setIndexBuffer_7f3cf667b4d71566:function(t,i,r,n,s){C(t).setIndexBuffer(C(i),$B[r],n,s)},__wbg_setPipeline_c41bf46790f27f9e:function(t,i){C(t).setPipeline(C(i))},__wbg_setPipeline_d73f019e98c76d2d:function(t,i){C(t).setPipeline(C(i))},__wbg_setStencilReference_66c74be6232bb9da:function(t,i){C(t).setStencilReference(i>>>0)},__wbg_setTimeout_b5f25e402b6e8ff9:function(){return ti(function(t,i,r){return C(t).setTimeout(C(i),r)},arguments)},__wbg_setVertexBuffer_1e448859663dd400:function(t,i,r,n){C(t).setVertexBuffer(i>>>0,C(r),n)},__wbg_setVertexBuffer_7cf533d694e747f3:function(t,i,r,n,s){C(t).setVertexBuffer(i>>>0,C(r),n,s)},__wbg_setViewport_d9fc3eac343de7d0:function(t,i,r,n,s,a,o){C(t).setViewport(i,r,n,s,a,o)},__wbg_set_29c99a8aac1c01e5:function(t,i,r){C(t).set(im(i,r))},__wbg_set_6e30c9374c26414c:function(){return ti(function(t,i,r){return Reflect.set(C(t),C(i),C(r))},arguments)},__wbg_set_6f7e2d6e41d9a122:function(t,i,r){C(t)[ii(i)]=ii(r)},__wbg_set_a_88262a42340d0b1c:function(t,i){C(t).a=i},__wbg_set_access_9a5092f05dc45fad:function(t,i){C(t).access=xPe[i]},__wbg_set_address_mode_u_9e2695575a219e33:function(t,i){C(t).addressModeU=WB[i]},__wbg_set_address_mode_v_f479b2e6cccbcac4:function(t,i){C(t).addressModeV=WB[i]},__wbg_set_address_mode_w_46273e153230180d:function(t,i){C(t).addressModeW=WB[i]},__wbg_set_alpha_bfd2df62e7bc581b:function(t,i){C(t).alpha=C(i)},__wbg_set_alpha_mode_df805952892caa9c:function(t,i){C(t).alphaMode=uPe[i]},__wbg_set_alpha_to_coverage_enabled_8b5dc2b0a225b3b2:function(t,i){C(t).alphaToCoverageEnabled=i!==0},__wbg_set_array_layer_count_7312f0f31af94e7c:function(t,i){C(t).arrayLayerCount=i>>>0},__wbg_set_array_stride_f64_27ffaf4fffd74e61:function(t,i){C(t).arrayStride=i},__wbg_set_aspect_0d453bca3d012f02:function(t,i){C(t).aspect=ZB[i]},__wbg_set_aspect_210da747c9d77aba:function(t,i){C(t).aspect=ZB[i]},__wbg_set_aspect_4962514fe99e68e6:function(t,i){C(t).aspect=ZB[i]},__wbg_set_attributes_7537844a7e6dafdc:function(t,i,r){C(t).attributes=Tu(i,r)},__wbg_set_b_c47befe0af3261eb:function(t,i){C(t).b=i},__wbg_set_base_array_layer_f176bb9f1b37b342:function(t,i){C(t).baseArrayLayer=i>>>0},__wbg_set_base_mip_level_1df145d9f8db32a9:function(t,i){C(t).baseMipLevel=i>>>0},__wbg_set_beginning_of_pass_write_index_0d4fa06109208ad7:function(t,i){C(t).beginningOfPassWriteIndex=i>>>0},__wbg_set_beginning_of_pass_write_index_e9f5d016947893bd:function(t,i){C(t).beginningOfPassWriteIndex=i>>>0},__wbg_set_bind_group_layouts_5a9cfea401c020ab:function(t,i,r){C(t).bindGroupLayouts=Tu(i,r)},__wbg_set_binding_155b0440b4307793:function(t,i){C(t).binding=i>>>0},__wbg_set_binding_f74df3510792aba1:function(t,i){C(t).binding=i>>>0},__wbg_set_blend_7493c2066c3e9970:function(t,i){C(t).blend=C(i)},__wbg_set_buffer_9c01e3b6d6765ea2:function(t,i){C(t).buffer=C(i)},__wbg_set_buffer_c3410572051920ba:function(t,i){C(t).buffer=C(i)},__wbg_set_buffer_ef7f75306cf663ed:function(t,i){C(t).buffer=C(i)},__wbg_set_buffers_7d0d8f507699e956:function(t,i,r){C(t).buffers=Tu(i,r)},__wbg_set_bytes_per_row_c54ca96953f35774:function(t,i){C(t).bytesPerRow=i>>>0},__wbg_set_bytes_per_row_d69b88eee3929c07:function(t,i){C(t).bytesPerRow=i>>>0},__wbg_set_c775d84916be79ea:function(t,i,r){C(t).set(C(i),r>>>0)},__wbg_set_clear_value_gpu_color_dict_6211425789c76e59:function(t,i){C(t).clearValue=C(i)},__wbg_set_code_b4f37f81f45b5b25:function(t,i,r){C(t).code=Hi(i,r)},__wbg_set_color_83aa977526e88cbb:function(t,i){C(t).color=C(i)},__wbg_set_color_attachments_581fdb3310e4abfa:function(t,i,r){C(t).colorAttachments=Tu(i,r)},__wbg_set_compare_cd9b62cdb92eb580:function(t,i){C(t).compare=qB[i]},__wbg_set_compare_f36b34abfaa08ccb:function(t,i){C(t).compare=qB[i]},__wbg_set_compute_d0c2d276b6d4b18d:function(t,i){C(t).compute=C(i)},__wbg_set_count_069a4eac409bac55:function(t,i){C(t).count=i>>>0},__wbg_set_count_3ab1c1220e4ceeb3:function(t,i){C(t).count=i>>>0},__wbg_set_cull_mode_fc649853947a3d0c:function(t,i){C(t).cullMode=cPe[i]},__wbg_set_currentTime_7c37e2312e9d2687:function(t,i){C(t).currentTime=i},__wbg_set_depth_bias_clamp_1c0d695df7f092e5:function(t,i){C(t).depthBiasClamp=i},__wbg_set_depth_bias_d7cd16096242a657:function(t,i){C(t).depthBias=i},__wbg_set_depth_bias_slope_scale_c4e52ec743ef55ba:function(t,i){C(t).depthBiasSlopeScale=i},__wbg_set_depth_clear_value_beda3ec5b1a5c43a:function(t,i){C(t).depthClearValue=i},__wbg_set_depth_compare_0c8631eb2eae98e3:function(t,i){C(t).depthCompare=qB[i]},__wbg_set_depth_fail_op_668155ae33d3c06f:function(t,i){C(t).depthFailOp=YB[i]},__wbg_set_depth_load_op_511c513eab4e56a9:function(t,i){C(t).depthLoadOp=XB[i]},__wbg_set_depth_or_array_layers_89371305ed0bd962:function(t,i){C(t).depthOrArrayLayers=i>>>0},__wbg_set_depth_read_only_7f41a74741c144ec:function(t,i){C(t).depthReadOnly=i!==0},__wbg_set_depth_stencil_97506c7bea4f53da:function(t,i){C(t).depthStencil=C(i)},__wbg_set_depth_stencil_attachment_73b79e8b4e948222:function(t,i){C(t).depthStencilAttachment=C(i)},__wbg_set_depth_store_op_c89f33b39b43361c:function(t,i){C(t).depthStoreOp=KB[i]},__wbg_set_depth_write_enabled_ce89750042940350:function(t,i){C(t).depthWriteEnabled=i!==0},__wbg_set_device_e275d1d4f3c9eb74:function(t,i){C(t).device=C(i)},__wbg_set_dimension_868eee80f4b90011:function(t,i){C(t).dimension=wPe[i]},__wbg_set_dimension_e325282e613ca0a4:function(t,i){C(t).dimension=QB[i]},__wbg_set_dst_factor_ec7407f19be1aff9:function(t,i){C(t).dstFactor=MZ[i]},__wbg_set_end_of_pass_write_index_0d546e46b86ea069:function(t,i){C(t).endOfPassWriteIndex=i>>>0},__wbg_set_end_of_pass_write_index_49a6ddbb2b888bfa:function(t,i){C(t).endOfPassWriteIndex=i>>>0},__wbg_set_entries_86a29dd6291c95e7:function(t,i,r){C(t).entries=Tu(i,r)},__wbg_set_entries_a12aca1e458b0456:function(t,i,r){C(t).entries=Tu(i,r)},__wbg_set_entry_point_207540f042015ce5:function(t,i,r){C(t).entryPoint=Hi(i,r)},__wbg_set_entry_point_5f26aacbe4c545eb:function(t,i,r){C(t).entryPoint=Hi(i,r)},__wbg_set_entry_point_e87e79251dd3144f:function(t,i,r){C(t).entryPoint=Hi(i,r)},__wbg_set_external_texture_386483d8dd82ab56:function(t,i){C(t).externalTexture=C(i)},__wbg_set_fail_op_92f716dbc88b6973:function(t,i){C(t).failOp=YB[i]},__wbg_set_flip_y_4e1632b36ad0413a:function(t,i){C(t).flipY=i!==0},__wbg_set_format_1fcaa7d60546b490:function(t,i){C(t).format=s0[i]},__wbg_set_format_2c1414a817c213f8:function(t,i){C(t).format=s0[i]},__wbg_set_format_533f9ffa7eef563d:function(t,i){C(t).format=s0[i]},__wbg_set_format_5d2f25cc93654ecc:function(t,i){C(t).format=TPe[i]},__wbg_set_format_5ff53724ed6cedf2:function(t,i){C(t).format=s0[i]},__wbg_set_format_815efd4dc4817bbb:function(t,i){C(t).format=s0[i]},__wbg_set_format_e52bdcca880d2c8e:function(t,i){C(t).format=s0[i]},__wbg_set_fragment_8b780f00a0b0e6f3:function(t,i){C(t).fragment=C(i)},__wbg_set_front_face_28ffdf524eedce5b:function(t,i){C(t).frontFace=mPe[i]},__wbg_set_g_5983abfc46e0cf4e:function(t,i){C(t).g=i},__wbg_set_has_dynamic_offset_62bc230bdb7c54d0:function(t,i){C(t).hasDynamicOffset=i!==0},__wbg_set_height_0739170de8653cc4:function(t,i){C(t).height=i>>>0},__wbg_set_height_14335c4047cf9c1b:function(t,i){C(t).height=i>>>0},__wbg_set_height_c661af0c0b5376f9:function(t,i){C(t).height=i>>>0},__wbg_set_label_08d9be3e4719c226:function(t,i,r){C(t).label=Hi(i,r)},__wbg_set_label_17eb9fe3a02f62b0:function(t,i,r){C(t).label=Hi(i,r)},__wbg_set_label_206558c8adc3780f:function(t,i,r){C(t).label=Hi(i,r)},__wbg_set_label_48e6b787d256f621:function(t,i,r){C(t).label=Hi(i,r)},__wbg_set_label_547d0d4aec39fbe9:function(t,i,r){C(t).label=Hi(i,r)},__wbg_set_label_5ee7427342869829:function(t,i,r){C(t).label=Hi(i,r)},__wbg_set_label_60ad96c811e0d109:function(t,i,r){C(t).label=Hi(i,r)},__wbg_set_label_6db0393d3fdc90a5:function(t,i,r){C(t).label=Hi(i,r)},__wbg_set_label_72bb4f41ef0cb893:function(t,i,r){C(t).label=Hi(i,r)},__wbg_set_label_79387decda299036:function(t,i,r){C(t).label=Hi(i,r)},__wbg_set_label_9556af8b5cda3c9d:function(t,i,r){C(t).label=Hi(i,r)},__wbg_set_label_d010f237b26f2c55:function(t,i,r){C(t).label=Hi(i,r)},__wbg_set_label_e16e2dbe51349c7f:function(t,i,r){C(t).label=Hi(i,r)},__wbg_set_label_e3944e54881b8c50:function(t,i,r){C(t).label=Hi(i,r)},__wbg_set_label_e922700240417ab5:function(t,i,r){C(t).label=Hi(i,r)},__wbg_set_label_ef44793ddf4455c5:function(t,i,r){C(t).label=Hi(i,r)},__wbg_set_layout_41021cfd2a2f62df:function(t,i){C(t).layout=C(i)},__wbg_set_layout_50ab727f44b38f26:function(t,i){C(t).layout=C(i)},__wbg_set_layout_913d53c17194c989:function(t,i){C(t).layout=C(i)},__wbg_set_layout_gpu_auto_layout_mode_0a5a185b3d52b726:function(t,i){C(t).layout=TZ[i]},__wbg_set_layout_gpu_auto_layout_mode_aeba193938b47882:function(t,i){C(t).layout=TZ[i]},__wbg_set_load_op_99661da6c4eab9b0:function(t,i){C(t).loadOp=XB[i]},__wbg_set_lod_max_clamp_dd2d9f9f052f4f44:function(t,i){C(t).lodMaxClamp=i},__wbg_set_lod_min_clamp_6d20c97916baeb93:function(t,i){C(t).lodMinClamp=i},__wbg_set_loop_b622b726769860be:function(t,i){C(t).loop=i!==0},__wbg_set_mag_filter_b5adebc99cb938e1:function(t,i){C(t).magFilter=EZ[i]},__wbg_set_mapped_at_creation_81b586dc90a50347:function(t,i){C(t).mappedAtCreation=i!==0},__wbg_set_mask_70a8a59ce09e5997:function(t,i){C(t).mask=i>>>0},__wbg_set_max_anisotropy_2beada0e2db62c45:function(t,i){C(t).maxAnisotropy=i},__wbg_set_method_7a6811dec7a4feff:function(t,i,r){C(t).method=Hi(i,r)},__wbg_set_min_binding_size_f64_5005a6904cdf43da:function(t,i){C(t).minBindingSize=i},__wbg_set_min_filter_c72f17375e135f0a:function(t,i){C(t).minFilter=EZ[i]},__wbg_set_mip_level_13253f3afc7aa58a:function(t,i){C(t).mipLevel=i>>>0},__wbg_set_mip_level_count_534caaa7e68e68b8:function(t,i){C(t).mipLevelCount=i>>>0},__wbg_set_mip_level_count_776c8c218b65bc08:function(t,i){C(t).mipLevelCount=i>>>0},__wbg_set_mip_level_f7ac79e8c54f59ad:function(t,i){C(t).mipLevel=i>>>0},__wbg_set_mipmap_filter_5bf66195a3639700:function(t,i){C(t).mipmapFilter=gPe[i]},__wbg_set_mode_9990b3393ba469ae:function(t,i){C(t).mode=dPe[i]},__wbg_set_mode_c90e3667002857d4:function(t,i){C(t).mode=EPe[i]},__wbg_set_module_5db9b76ee2dd2a59:function(t,i){C(t).module=C(i)},__wbg_set_module_d0e2098713606cae:function(t,i){C(t).module=C(i)},__wbg_set_module_f02e076ca7e7daf8:function(t,i){C(t).module=C(i)},__wbg_set_multisample_37ddafe88b5cd466:function(t,i){C(t).multisample=C(i)},__wbg_set_multisampled_7913fd7183272840:function(t,i){C(t).multisampled=i!==0},__wbg_set_muted_16f1e7acd8244e28:function(t,i){C(t).muted=i!==0},__wbg_set_offset_f64_28c24dc15000932e:function(t,i){C(t).offset=i},__wbg_set_offset_f64_89f0ce01a689839e:function(t,i){C(t).offset=i},__wbg_set_offset_f64_b562d1367e34ef93:function(t,i){C(t).offset=i},__wbg_set_offset_f64_fa66068813376ca3:function(t,i){C(t).offset=i},__wbg_set_once_27df5233613a51cd:function(t,i){C(t).once=i!==0},__wbg_set_operation_62ce44e1728c4047:function(t,i){C(t).operation=lPe[i]},__wbg_set_origin_gpu_origin_2d_dict_1240202973e56f92:function(t,i){C(t).origin=C(i)},__wbg_set_origin_gpu_origin_3d_dict_37222d7b3d238123:function(t,i){C(t).origin=C(i)},__wbg_set_origin_gpu_origin_3d_dict_631c04520718091f:function(t,i){C(t).origin=C(i)},__wbg_set_pass_op_cf02fa088d6352a7:function(t,i){C(t).passOp=YB[i]},__wbg_set_power_preference_8fdca0b7af640d49:function(t,i){C(t).powerPreference=vPe[i]},__wbg_set_premultiplied_alpha_3f27816ad319d5a9:function(t,i){C(t).premultipliedAlpha=i!==0},__wbg_set_primitive_43c23761a55b4088:function(t,i){C(t).primitive=C(i)},__wbg_set_query_set_41de86d2401aee04:function(t,i){C(t).querySet=C(i)},__wbg_set_query_set_4889dd944d5ec0fd:function(t,i){C(t).querySet=C(i)},__wbg_set_r_c6f4c68f4804d655:function(t,i){C(t).r=i},__wbg_set_required_features_1baf274a8669db60:function(t,i,r){C(t).requiredFeatures=Tu(i,r)},__wbg_set_required_limits_871ed33c68613dcb:function(t,i){C(t).requiredLimits=C(i)},__wbg_set_resolve_target_gpu_texture_view_b19a4f2debf79b96:function(t,i){C(t).resolveTarget=C(i)},__wbg_set_resource_5ae7b5e67924f234:function(t,i){C(t).resource=C(i)},__wbg_set_resource_gpu_buffer_binding_e5dbca063e7cb67b:function(t,i){C(t).resource=C(i)},__wbg_set_resource_gpu_texture_view_eb46c355d51ad7e5:function(t,i){C(t).resource=C(i)},__wbg_set_rows_per_image_5011f97318ee71af:function(t,i){C(t).rowsPerImage=i>>>0},__wbg_set_rows_per_image_59a813ac5006e10e:function(t,i){C(t).rowsPerImage=i>>>0},__wbg_set_sample_count_eb86a8b18545b54f:function(t,i){C(t).sampleCount=i>>>0},__wbg_set_sample_type_c32e1dfff94e63eb:function(t,i){C(t).sampleType=SPe[i]},__wbg_set_sampler_c0e1258543a33bce:function(t,i){C(t).sampler=C(i)},__wbg_set_shader_location_7e1832a74f912217:function(t,i){C(t).shaderLocation=i>>>0},__wbg_set_size_f64_6bcd40704bf4cfdc:function(t,i){C(t).size=i},__wbg_set_size_f64_8b8f6bba5d678162:function(t,i){C(t).size=i},__wbg_set_size_gpu_extent_3d_dict_7e42e1c98fa36434:function(t,i){C(t).size=C(i)},__wbg_set_source_0c40b87cfdd5d704:function(t,i){C(t).source=C(i)},__wbg_set_source_html_canvas_element_f657e39507ba2fe5:function(t,i){C(t).source=C(i)},__wbg_set_source_html_image_element_fcc7cba0635adac1:function(t,i){C(t).source=C(i)},__wbg_set_source_html_video_element_e63a39653665f651:function(t,i){C(t).source=C(i)},__wbg_set_source_image_data_68478f1afce208b8:function(t,i){C(t).source=C(i)},__wbg_set_source_offscreen_canvas_266a3de949693e62:function(t,i){C(t).source=C(i)},__wbg_set_source_video_frame_3083c0ce54b9cb73:function(t,i){C(t).source=C(i)},__wbg_set_src_factor_9bfe84af9b7b5cac:function(t,i){C(t).srcFactor=MZ[i]},__wbg_set_stencil_back_85b22f1db5b1940a:function(t,i){C(t).stencilBack=C(i)},__wbg_set_stencil_clear_value_42be608809151e2a:function(t,i){C(t).stencilClearValue=i>>>0},__wbg_set_stencil_front_525526164a798a44:function(t,i){C(t).stencilFront=C(i)},__wbg_set_stencil_load_op_31838c036993098a:function(t,i){C(t).stencilLoadOp=XB[i]},__wbg_set_stencil_read_mask_5cc26495e8b3ae82:function(t,i){C(t).stencilReadMask=i>>>0},__wbg_set_stencil_read_only_bf1d0c1897e25c62:function(t,i){C(t).stencilReadOnly=i!==0},__wbg_set_stencil_store_op_e6be1cbc3a8fc210:function(t,i){C(t).stencilStoreOp=KB[i]},__wbg_set_stencil_write_mask_d9cb40ec4b4bee5b:function(t,i){C(t).stencilWriteMask=i>>>0},__wbg_set_step_mode_a97bb24714da41a9:function(t,i){C(t).stepMode=MPe[i]},__wbg_set_storage_texture_939a097db4b18bd4:function(t,i){C(t).storageTexture=C(i)},__wbg_set_store_op_b5fdf672436f13f3:function(t,i){C(t).storeOp=KB[i]},__wbg_set_strip_index_format_9f787be6c5fc9e87:function(t,i){C(t).stripIndexFormat=$B[i]},__wbg_set_targets_c38bd200c836d66f:function(t,i,r){C(t).targets=Tu(i,r)},__wbg_set_texture_016561d5911339e5:function(t,i){C(t).texture=C(i)},__wbg_set_texture_1f64653a5d2d7b4d:function(t,i){C(t).texture=C(i)},__wbg_set_texture_9dcedde1bb31eda6:function(t,i){C(t).texture=C(i)},__wbg_set_timestamp_writes_59c2d19ed8aecd97:function(t,i){C(t).timestampWrites=C(i)},__wbg_set_timestamp_writes_98bed1a8bbc6682d:function(t,i){C(t).timestampWrites=C(i)},__wbg_set_tone_mapping_b3464f1baa4cff92:function(t,i){C(t).toneMapping=C(i)},__wbg_set_topology_da25f2cc5af203d2:function(t,i){C(t).topology=yPe[i]},__wbg_set_type_7f0457c6084dde9b:function(t,i){C(t).type=_Pe[i]},__wbg_set_type_ccf8472d40abcddf:function(t,i){C(t).type=bPe[i]},__wbg_set_type_d09829f59932a0fc:function(t,i){C(t).type=hPe[i]},__wbg_set_unclipped_depth_04524a2b44e1e3c1:function(t,i){C(t).unclippedDepth=i!==0},__wbg_set_usage_a137f82ca163b0a9:function(t,i){C(t).usage=i>>>0},__wbg_set_usage_b2a2935f37bf3d08:function(t,i){C(t).usage=i>>>0},__wbg_set_usage_ba5b0f8b333ab325:function(t,i){C(t).usage=i>>>0},__wbg_set_usage_ddd42599bbba7779:function(t,i){C(t).usage=i>>>0},__wbg_set_vertex_0be5d146f9ff6f36:function(t,i){C(t).vertex=C(i)},__wbg_set_view_dimension_0df554032f1f3a85:function(t,i){C(t).viewDimension=QB[i]},__wbg_set_view_dimension_4818d4c18ce5815e:function(t,i){C(t).viewDimension=QB[i]},__wbg_set_view_formats_4347dc8363331086:function(t,i,r){C(t).viewFormats=Tu(i,r)},__wbg_set_view_formats_5797d2fff3c11808:function(t,i,r){C(t).viewFormats=Tu(i,r)},__wbg_set_view_gpu_texture_view_9b2d86b6b99d9fd9:function(t,i){C(t).view=C(i)},__wbg_set_view_gpu_texture_view_c0f35f8857c25206:function(t,i){C(t).view=C(i)},__wbg_set_visibility_9570b037224c4cc2:function(t,i){C(t).visibility=i>>>0},__wbg_set_volume_520cdc6b7ada8f76:function(t,i){C(t).volume=i},__wbg_set_width_7ca43f32db1cfe8e:function(t,i){C(t).width=i>>>0},__wbg_set_width_87301412247f3343:function(t,i){C(t).width=i>>>0},__wbg_set_width_9f685402c2cbee70:function(t,i){C(t).width=i>>>0},__wbg_set_write_mask_d45279e56abbfcb5:function(t,i){C(t).writeMask=i>>>0},__wbg_set_x_232d24fdc32d8351:function(t,i){C(t).x=i>>>0},__wbg_set_x_876d592971db129a:function(t,i){C(t).x=i>>>0},__wbg_set_y_18fe375093e59dfb:function(t,i){C(t).y=i>>>0},__wbg_set_y_2b1f5ac0dd5586a5:function(t,i){C(t).y=i>>>0},__wbg_set_z_ef005d82bc9d24e3:function(t,i){C(t).z=i>>>0},__wbg_shaderSource_7d18b5a43a504f5c:function(t,i,r,n){C(t).shaderSource(C(i),Hi(r,n))},__wbg_shaderSource_df5bb6320451f3cd:function(t,i,r,n){C(t).shaderSource(C(i),Hi(r,n))},__wbg_size_211f88d386430781:function(t){return C(t).size},__wbg_src_f0e9281991fbd919:function(t,i){let r=C(i).src,n=As(r,de.__wbindgen_export,de.__wbindgen_export2),s=On;di().setInt32(t+4,s,!0),di().setInt32(t+0,n,!0)},__wbg_stack_3b0d974bbf31e44f:function(t,i){let r=C(i).stack,n=As(r,de.__wbindgen_export,de.__wbindgen_export2),s=On;di().setInt32(t+4,s,!0),di().setInt32(t+0,n,!0)},__wbg_static_accessor_GLOBAL_9d53f2689e622ca1:function(){let t=typeof global>"u"?null:global;return ci(t)?0:ne(t)},__wbg_static_accessor_GLOBAL_THIS_a1a35cec07001a8a:function(){let t=typeof globalThis>"u"?null:globalThis;return ci(t)?0:ne(t)},__wbg_static_accessor_SELF_4c59f6c7ea29a144:function(){let t=typeof self>"u"?null:self;return ci(t)?0:ne(t)},__wbg_static_accessor_WINDOW_e70ae9f2eb052253:function(){let t=typeof window>"u"?null:window;return ci(t)?0:ne(t)},__wbg_stencilFunc_8f53a5508560354d:function(t,i,r,n){C(t).stencilFunc(i>>>0,r,n>>>0)},__wbg_stencilFunc_c7553215f237ee38:function(t,i,r,n){C(t).stencilFunc(i>>>0,r,n>>>0)},__wbg_stencilOp_a844a4e9824eee70:function(t,i,r,n){C(t).stencilOp(i>>>0,r>>>0,n>>>0)},__wbg_stencilOp_e82bd7ea13f18adf:function(t,i,r,n){C(t).stencilOp(i>>>0,r>>>0,n>>>0)},__wbg_subgroupMaxSize_1527c5f7a8fe91bb:function(t){return C(t).subgroupMaxSize},__wbg_subgroupMinSize_d6c5ad4bddc828e9:function(t){return C(t).subgroupMinSize},__wbg_submit_ce44115121cd166c:function(t,i,r){C(t).submit(Tu(i,r))},__wbg_texImage2D_01c22558517ee8db:function(){return ti(function(t,i,r,n,s,a,o){C(t).texImage2D(i>>>0,r,n,s>>>0,a>>>0,C(o))},arguments)},__wbg_texImage2D_152e9dcd4bc3a464:function(){return ti(function(t,i,r,n,s,a,o,l,u,h){C(t).texImage2D(i>>>0,r,n,s,a,o,l>>>0,u>>>0,C(h))},arguments)},__wbg_texImage2D_3704db20a16b6c35:function(){return ti(function(t,i,r,n,s,a,o,l,u,h){C(t).texImage2D(i>>>0,r,n,s,a,o,l>>>0,u>>>0,C(h))},arguments)},__wbg_texImage2D_63d0b87d5ebe4a7f:function(){return ti(function(t,i,r,n,s,a,o){C(t).texImage2D(i>>>0,r,n,s>>>0,a>>>0,C(o))},arguments)},__wbg_texImage2D_90633e994ded3d2b:function(){return ti(function(t,i,r,n,s,a,o){C(t).texImage2D(i>>>0,r,n,s>>>0,a>>>0,C(o))},arguments)},__wbg_texImage2D_ea94e8a2df5f97e2:function(){return ti(function(t,i,r,n,s,a,o,l,u,h){C(t).texImage2D(i>>>0,r,n,s,a,o,l>>>0,u>>>0,h)},arguments)},__wbg_texImage2D_facfa039fb461b66:function(){return ti(function(t,i,r,n,s,a,o){C(t).texImage2D(i>>>0,r,n,s>>>0,a>>>0,C(o))},arguments)},__wbg_texParameteri_87ebfcefb0af2c50:function(t,i,r,n){C(t).texParameteri(i>>>0,r>>>0,n)},__wbg_texParameteri_e5ad2054e239066e:function(t,i,r,n){C(t).texParameteri(i>>>0,r>>>0,n)},__wbg_texStorage2D_bb2a1bd1ab0b9184:function(t,i,r,n,s,a){C(t).texStorage2D(i>>>0,r,n>>>0,s,a)},__wbg_texSubImage2D_3483ba5f10ee42c2:function(){return ti(function(t,i,r,n,s,a,o,l){C(t).texSubImage2D(i>>>0,r,n,s,a>>>0,o>>>0,C(l))},arguments)},__wbg_texSubImage2D_4ca4c3faa4392438:function(){return ti(function(t,i,r,n,s,a,o,l,u,h){C(t).texSubImage2D(i>>>0,r,n,s,a,o,l>>>0,u>>>0,C(h))},arguments)},__wbg_texSubImage2D_54d18572b1ba74ab:function(){return ti(function(t,i,r,n,s,a,o,l,u,h){C(t).texSubImage2D(i>>>0,r,n,s,a,o,l>>>0,u>>>0,h)},arguments)},__wbg_texSubImage2D_5bebe93724e6ed61:function(){return ti(function(t,i,r,n,s,a,o,l,u,h){C(t).texSubImage2D(i>>>0,r,n,s,a,o,l>>>0,u>>>0,C(h))},arguments)},__wbg_texSubImage2D_5e1594de0416e9f6:function(){return ti(function(t,i,r,n,s,a,o,l){C(t).texSubImage2D(i>>>0,r,n,s,a>>>0,o>>>0,C(l))},arguments)},__wbg_then_18f476d590e58992:function(t,i,r){let n=C(t).then(C(i),C(r));return ne(n)},__wbg_then_47213a40b6aeb86c:function(t,i){let r=C(t).then(C(i));return ne(r)},__wbg_then_ac7b025999b52837:function(t,i){let r=C(t).then(C(i));return ne(r)},__wbg_type_71742b859467fa3c:function(t){return C(t).type},__wbg_unconfigure_0a07a0a40de8988d:function(t){C(t).unconfigure()},__wbg_uniform1f_8c3b3e6e3723fe14:function(t,i,r){C(t).uniform1f(C(i),r)},__wbg_uniform1f_d6619faa73c2a45f:function(t,i,r){C(t).uniform1f(C(i),r)},__wbg_uniform1fv_11d5842aff79c8a3:function(t,i,r,n){C(t).uniform1fv(C(i),ih(r,n))},__wbg_uniform1fv_b4b087b4d6e2bb25:function(t,i,r,n){C(t).uniform1fv(C(i),ih(r,n))},__wbg_uniform1i_14982bb8438243b4:function(t,i,r){C(t).uniform1i(C(i),r)},__wbg_uniform1i_cf11d5b364eed1c8:function(t,i,r){C(t).uniform1i(C(i),r)},__wbg_uniform1ui_d177882f473d2afc:function(t,i,r){C(t).uniform1ui(C(i),r>>>0)},__wbg_uniform2f_19fb96222ae72e1a:function(t,i,r,n){C(t).uniform2f(C(i),r,n)},__wbg_uniform2f_44cee47e30b82f96:function(t,i,r,n){C(t).uniform2f(C(i),r,n)},__wbg_uniform2fv_2f06d989ec4b5d8f:function(t,i,r,n){C(t).uniform2fv(C(i),ih(r,n))},__wbg_uniform2fv_f022309b362a80c3:function(t,i,r,n){C(t).uniform2fv(C(i),ih(r,n))},__wbg_uniform2i_16e8a2c966614be6:function(t,i,r,n){C(t).uniform2i(C(i),r,n)},__wbg_uniform2i_d353da02172ea38d:function(t,i,r,n){C(t).uniform2i(C(i),r,n)},__wbg_uniform3f_360c1ea4c73cacef:function(t,i,r,n,s){C(t).uniform3f(C(i),r,n,s)},__wbg_uniform3f_b616f9e06266a25f:function(t,i,r,n,s){C(t).uniform3f(C(i),r,n,s)},__wbg_uniform4f_f1a670d511b34878:function(t,i,r,n,s,a){C(t).uniform4f(C(i),r,n,s,a)},__wbg_uniform4f_f97f3f59af09856f:function(t,i,r,n,s,a){C(t).uniform4f(C(i),r,n,s,a)},__wbg_uniformMatrix3fv_f45b91f173d7fbed:function(t,i,r,n,s){C(t).uniformMatrix3fv(C(i),r!==0,ih(n,s))},__wbg_uniformMatrix3fv_feab3f952d705f51:function(t,i,r,n,s){C(t).uniformMatrix3fv(C(i),r!==0,ih(n,s))},__wbg_uniformMatrix3x2fv_ab13f9742e5fcb2f:function(t,i,r,n,s){C(t).uniformMatrix3x2fv(C(i),r!==0,ih(n,s))},__wbg_uniformMatrix4fv_540dc6bf792eba8f:function(t,i,r,n,s){C(t).uniformMatrix4fv(C(i),r!==0,ih(n,s))},__wbg_uniformMatrix4fv_e3dac9dd429d6adc:function(t,i,r,n,s){C(t).uniformMatrix4fv(C(i),r!==0,ih(n,s))},__wbg_uniformMatrix4x3fv_115d029ad3124cef:function(t,i,r,n,s){C(t).uniformMatrix4x3fv(C(i),r!==0,ih(n,s))},__wbg_unmap_adaf93276fdf9aaf:function(t){C(t).unmap()},__wbg_useProgram_55a3e940abb19137:function(t,i){C(t).useProgram(C(i))},__wbg_useProgram_e24dadf4c06636f5:function(t,i){C(t).useProgram(C(i))},__wbg_userAgent_8def8135d886414b:function(){return ti(function(t,i){let r=C(i).userAgent,n=As(r,de.__wbindgen_export,de.__wbindgen_export2),s=On;di().setInt32(t+4,s,!0),di().setInt32(t+0,n,!0)},arguments)},__wbg_valueOf_41ae57308c1f031c:function(t){return C(t).valueOf()},__wbg_value_f3625092ee4b37f4:function(t){let i=C(t).value;return ne(i)},__wbg_vertexAttrib4f_6444504b25f4d43e:function(t,i,r,n,s,a){C(t).vertexAttrib4f(i>>>0,r,n,s,a)},__wbg_vertexAttrib4f_aad41fe000407191:function(t,i,r,n,s,a){C(t).vertexAttrib4f(i>>>0,r,n,s,a)},__wbg_vertexAttribIPointer_ed1c3507e84527e2:function(t,i,r,n,s,a){C(t).vertexAttribIPointer(i>>>0,r,n>>>0,s,a)},__wbg_vertexAttribPointer_39eddea7c20e350c:function(t,i,r,n,s,a,o){C(t).vertexAttribPointer(i>>>0,r,n>>>0,s!==0,a,o)},__wbg_vertexAttribPointer_3bc50c0431082f73:function(t,i,r,n,s,a,o){C(t).vertexAttribPointer(i>>>0,r,n>>>0,s!==0,a,o)},__wbg_videoFrameToken_6f05524e85fa2b75:function(t){return yZ(C(t))},__wbg_videoHeight_e267fd1e74bb1b06:function(t){return C(t).videoHeight},__wbg_videoWidth_670b8e775ea04b5d:function(t){return C(t).videoWidth},__wbg_viewport_14d947f2faf58e85:function(t,i,r,n,s){C(t).viewport(i,r,n,s)},__wbg_viewport_24055b0754803788:function(t,i,r,n,s){C(t).viewport(i,r,n,s)},__wbg_warn_410c3261e3c6d686:function(t){console.warn(C(t))},__wbg_width_f1791280fae1517a:function(t){return C(t).width},__wbg_writeTexture_53ba204c494b042c:function(){return ti(function(t,i,r,n,s,a){C(t).writeTexture(C(i),im(r,n),C(s),C(a))},arguments)},__wbindgen_cast_0000000000000001:function(t,i){let r=Qc(t,i,iPe);return ne(r)},__wbindgen_cast_0000000000000002:function(t,i){let r=Qc(t,i,ePe);return ne(r)},__wbindgen_cast_0000000000000003:function(t,i){let r=Qc(t,i,rPe);return ne(r)},__wbindgen_cast_0000000000000004:function(t,i){let r=Qc(t,i,nPe);return ne(r)},__wbindgen_cast_0000000000000005:function(t,i){let r=Qc(t,i,tPe);return ne(r)},__wbindgen_cast_0000000000000006:function(t,i){let r=Qc(t,i,sPe);return ne(r)},__wbindgen_cast_0000000000000007:function(t,i){let r=Qc(t,i,aPe);return ne(r)},__wbindgen_cast_0000000000000008:function(t,i){let r=Qc(t,i,oPe);return ne(r)},__wbindgen_cast_0000000000000009:function(t,i){let r=Qc(t,i,JRe);return ne(r)},__wbindgen_cast_000000000000000a:function(t){return ne(t)},__wbindgen_cast_000000000000000b:function(t,i){let r=ih(t,i);return ne(r)},__wbindgen_cast_000000000000000c:function(t,i){let r=DPe(t,i);return ne(r)},__wbindgen_cast_000000000000000d:function(t,i){let r=DZ(t,i);return ne(r)},__wbindgen_cast_000000000000000e:function(t,i){let r=NPe(t,i);return ne(r)},__wbindgen_cast_000000000000000f:function(t,i){let r=IPe(t,i);return ne(r)},__wbindgen_cast_0000000000000010:function(t,i){let r=jw(t,i);return ne(r)},__wbindgen_cast_0000000000000011:function(t,i){let r=im(t,i);return ne(r)},__wbindgen_cast_0000000000000012:function(t,i){let r=Hi(t,i);return ne(r)},__wbindgen_cast_0000000000000013:function(t){let i=BigInt.asUintN(64,t);return ne(i)},__wbindgen_cast_0000000000000014:function(t,i){var r=im(t,i).slice();return de.__wbindgen_export4(t,i*1,1),ne(r)},__wbindgen_object_clone_ref:function(t){let i=C(t);return ne(i)},__wbindgen_object_drop_ref:function(t){ii(t)}}}}function JRe(e,t){de.__wasm_bindgen_func_elem_12558(e,t)}function ePe(e,t,i){de.__wasm_bindgen_func_elem_5127(e,t,ne(i))}function tPe(e,t,i){de.__wasm_bindgen_func_elem_11151(e,t,ne(i))}function iPe(e,t,i){try{let s=de.__wbindgen_add_to_stack_pointer(-16);de.__wasm_bindgen_func_elem_14195(s,e,t,ne(i));var r=di().getInt32(s+4*0,!0),n=di().getInt32(s+4*1,!0);if(n)throw ii(r)}finally{de.__wbindgen_add_to_stack_pointer(16)}}function rPe(e,t,i){try{let s=de.__wbindgen_add_to_stack_pointer(-16);de.__wasm_bindgen_func_elem_11150(s,e,t,ne(i));var r=di().getInt32(s+4*0,!0),n=di().getInt32(s+4*1,!0);if(n)throw ii(r)}finally{de.__wbindgen_add_to_stack_pointer(16)}}function nPe(e,t,i){try{let s=de.__wbindgen_add_to_stack_pointer(-16);de.__wasm_bindgen_func_elem_11150_3(s,e,t,ne(i));var r=di().getInt32(s+4*0,!0),n=di().getInt32(s+4*1,!0);if(n)throw ii(r)}finally{de.__wbindgen_add_to_stack_pointer(16)}}function sPe(e,t,i){try{let s=de.__wbindgen_add_to_stack_pointer(-16);de.__wasm_bindgen_func_elem_11150_5(s,e,t,ne(i));var r=di().getInt32(s+4*0,!0),n=di().getInt32(s+4*1,!0);if(n)throw ii(r)}finally{de.__wbindgen_add_to_stack_pointer(16)}}function aPe(e,t,i){try{let s=de.__wbindgen_add_to_stack_pointer(-16);de.__wasm_bindgen_func_elem_11150_6(s,e,t,ne(i));var r=di().getInt32(s+4*0,!0),n=di().getInt32(s+4*1,!0);if(n)throw ii(r)}finally{de.__wbindgen_add_to_stack_pointer(16)}}function oPe(e,t,i){try{let s=de.__wbindgen_add_to_stack_pointer(-16);de.__wasm_bindgen_func_elem_11150_7(s,e,t,ne(i));var r=di().getInt32(s+4*0,!0),n=di().getInt32(s+4*1,!0);if(n)throw ii(r)}finally{de.__wbindgen_add_to_stack_pointer(16)}}function SZ(e,t,i,r){de.__wasm_bindgen_func_elem_14197(e,t,ne(i),ne(r))}function ne(e){Jw===Mu.length&&Mu.push(Mu.length+1);let t=Jw;return Jw=Mu[t],Mu[t]=e,t}function CPe(e){if(rC==1)throw new Error("out of js stack");return Mu[--rC]=e,rC}function eU(e){let t=typeof e;if(t=="number"||t=="boolean"||e==null)return`${e}`;if(t=="string")return`"${e}"`;if(t=="symbol"){let n=e.description;return n==null?"Symbol":`Symbol(${n})`}if(t=="function"){let n=e.name;return typeof n=="string"&&n.length>0?`Function(${n})`:"Function"}if(Array.isArray(e)){let n=e.length,s="[";n>0&&(s+=eU(e[0]));for(let a=1;a<n;a++)s+=", "+eU(e[a]);return s+="]",s}let i=/\[object ([^\]]+)\]/.exec(toString.call(e)),r;if(i&&i.length>1)r=i[1];else return toString.call(e);if(r=="Object")try{return"Object("+JSON.stringify(e)+")"}catch{return"Object"}return e instanceof Error?`${e.name}: ${e.message}
36
36
  ${e.stack}`:r}function RPe(e){e<1028||(Mu[e]=Jw,Jw=e)}function ih(e,t){return e=e>>>0,OPe().subarray(e/4,e/4+t)}function PPe(e,t){return e=e>>>0,LPe().subarray(e/8,e/8+t)}function DPe(e,t){return e=e>>>0,BPe().subarray(e/2,e/2+t)}function DZ(e,t){return e=e>>>0,UPe().subarray(e/4,e/4+t)}function NPe(e,t){return e=e>>>0,FPe().subarray(e/1,e/1+t)}function Gw(e,t){e=e>>>0;let i=di(),r=[];for(let n=e;n<e+4*t;n+=4)r.push(ii(i.getUint32(n,!0)));return r}function Tu(e,t){e=e>>>0;let i=di(),r=[];for(let n=e;n<e+4*t;n+=4)r.push(C(i.getUint32(n,!0)));return r}function IPe(e,t){return e=e>>>0,zPe().subarray(e/2,e/2+t)}function jw(e,t){return e=e>>>0,kPe().subarray(e/4,e/4+t)}function im(e,t){return e=e>>>0,Qw().subarray(e/1,e/1+t)}function di(){return(a0===null||a0.buffer.detached===!0||a0.buffer.detached===void 0&&a0.buffer!==de.memory.buffer)&&(a0=new DataView(de.memory.buffer)),a0}function OPe(){return(Hw===null||Hw.byteLength===0)&&(Hw=new Float32Array(de.memory.buffer)),Hw}function LPe(){return(Ww===null||Ww.byteLength===0)&&(Ww=new Float64Array(de.memory.buffer)),Ww}function BPe(){return(qw===null||qw.byteLength===0)&&(qw=new Int16Array(de.memory.buffer)),qw}function UPe(){return($w===null||$w.byteLength===0)&&($w=new Int32Array(de.memory.buffer)),$w}function FPe(){return(Xw===null||Xw.byteLength===0)&&(Xw=new Int8Array(de.memory.buffer)),Xw}function Hi(e,t){return GPe(e>>>0,t)}function zPe(){return(Yw===null||Yw.byteLength===0)&&(Yw=new Uint16Array(de.memory.buffer)),Yw}function kPe(){return(Kw===null||Kw.byteLength===0)&&(Kw=new Uint32Array(de.memory.buffer)),Kw}function Qw(){return(Zw===null||Zw.byteLength===0)&&(Zw=new Uint8Array(de.memory.buffer)),Zw}function C(e){return Mu[e]}function ti(e,t){try{return e.apply(this,t)}catch(i){de.__wbindgen_export3(ne(i))}}function ci(e){return e==null}function Qc(e,t,i){let r={a:e,b:t,cnt:1},n=(...s)=>{r.cnt++;let a=r.a;r.a=0;try{return i(a,r.b,...s)}finally{r.a=a,n._wbg_cb_unref()}};return n._wbg_cb_unref=()=>{--r.cnt===0&&(de.__wbindgen_export5(r.a,r.b),r.a=0,PZ.unregister(r))},PZ.register(n,r,r),n}function NZ(e,t){let i=t(e.length*4,4)>>>0,r=di();for(let n=0;n<e.length;n++)r.setUint32(i+4*n,ne(e[n]),!0);return On=e.length,i}function As(e,t,i){if(i===void 0){let o=eS.encode(e),l=t(o.length,1)>>>0;return Qw().subarray(l,l+o.length).set(o),On=o.length,l}let r=e.length,n=t(r,1)>>>0,s=Qw(),a=0;for(;a<r;a++){let o=e.charCodeAt(a);if(o>127)break;s[n+a]=o}if(a!==r){a!==0&&(e=e.slice(a)),n=i(n,r,r=a+e.length*3,1)>>>0;let o=Qw().subarray(n+a,n+r),l=eS.encodeInto(e,o);a+=l.written,n=i(n,r,a,1)>>>0}return On=a,n}function ii(e){let t=C(e);return RPe(e),t}function GPe(e,t){return JB+=t,JB>=VPe&&(nC=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),nC.decode(),JB=t),nC.decode(Qw().subarray(e,e+t))}function OZ(e,t){return HPe=e,de=e.exports,jPe=t,a0=null,Hw=null,Ww=null,qw=null,$w=null,Xw=null,Yw=null,Kw=null,Zw=null,de.__wbindgen_start(),de}async function WPe(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(n){if(e.ok&&i(e.type)&&e.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",n);else throw n}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{let r=await WebAssembly.instantiate(e,t);return r instanceof WebAssembly.Instance?{instance:r,module:e}:r}function i(r){switch(r){case"basic":case"cors":case"default":return!0}return!1}}function qPe(e){if(de!==void 0)return de;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let t=IZ();e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e));let i=new WebAssembly.Instance(e,t);return OZ(i,e)}async function $Pe(e){if(de!==void 0)return de;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),e===void 0&&(e=new URL("hana-ui.wasm",XPe.url));let t=IZ();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:i,module:r}=await WPe(await e,t);return OZ(i,r)}var XPe,rm,nm,Jc,tS,WB,TZ,MZ,lPe,hPe,uPe,dPe,qB,cPe,pPe,fPe,EZ,mPe,$B,XB,gPe,vPe,yPe,_Pe,bPe,YB,xPe,KB,ZB,wPe,s0,SPe,QB,TPe,MPe,EPe,AZ,CZ,RZ,APe,PZ,a0,Hw,Ww,qw,$w,Xw,Yw,Kw,Zw,Mu,Jw,rC,nC,VPe,JB,eS,On,jPe,HPe,de,BZ=QA(()=>{"use strict";wZ();XPe={},rm=class{static __wrap(t){let i=Object.create(rm.prototype);return i.__wbg_ptr=t,AZ.register(i,i.__wbg_ptr,i),i}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,AZ.unregister(this),t}free(){let t=this.__destroy_into_raw();de.__wbg_devicelostpromise_free(t,0)}wait(){let t=this.__destroy_into_raw(),i=de.devicelostpromise_wait(t);return ii(i)}};Symbol.dispose&&(rm.prototype[Symbol.dispose]=rm.prototype.free);nm=class{static __wrap(t){let i=Object.create(nm.prototype);return i.__wbg_ptr=t,CZ.register(i,i.__wbg_ptr,i),i}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,CZ.unregister(this),t}free(){let t=this.__destroy_into_raw();de.__wbg_engine_free(t,0)}static create(t,i,r){let n=de.engine_create(ne(t),ne(i),r);return ii(n)}getDeviceLostPromise(){let t=de.engine_getDeviceLostPromise(this.__wbg_ptr);return t===0?void 0:rm.__wrap(t)}getGpuFrameTimeMs(){try{let r=de.__wbindgen_add_to_stack_pointer(-16);de.engine_getGpuFrameTimeMs(r,this.__wbg_ptr);var t=di().getInt32(r+4*0,!0),i=di().getFloat64(r+8*1,!0);return t===0?void 0:i}finally{de.__wbindgen_add_to_stack_pointer(16)}}isWebgpu(){return de.engine_isWebgpu(this.__wbg_ptr)!==0}onFrame(t){de.engine_onFrame(this.__wbg_ptr,!ci(t),ci(t)?0:t)}removeTexture(t){de.engine_removeTexture(this.__wbg_ptr,ne(t))}renderRegion(t,i,r){let n=de.engine_renderRegion(this.__wbg_ptr,ne(t),ne(i),r);return Jc.__wrap(n)}reset(t){de.engine_reset(this.__wbg_ptr,ne(t))}resize(t,i){de.engine_resize(this.__wbg_ptr,ne(t),i)}samplePixels(t,i){let r=de.engine_samplePixels(this.__wbg_ptr,ne(t),ne(i));return Jc.__wrap(r)}};Symbol.dispose&&(nm.prototype[Symbol.dispose]=nm.prototype.free);Jc=class{static __wrap(t){let i=Object.create(Jc.prototype);return i.__wbg_ptr=t,RZ.register(i,i.__wbg_ptr,i),i}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,RZ.unregister(this),t}free(){let t=this.__destroy_into_raw();de.__wbg_pixelreadpromise_free(t,0)}wait(){let t=this.__destroy_into_raw(),i=de.pixelreadpromise_wait(t);return ii(i)}};Symbol.dispose&&(Jc.prototype[Symbol.dispose]=Jc.prototype.free);tS=class{__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,APe.unregister(this),t}free(){let t=this.__destroy_into_raw();de.__wbg_scenecontroller_free(t,0)}get is_play_mode(){return de.__wbg_get_scenecontroller_is_play_mode(this.__wbg_ptr)!==0}get needs_video_update(){return de.__wbg_get_scenecontroller_needs_video_update(this.__wbg_ptr)!==0}get show_pixel_grid(){return de.__wbg_get_scenecontroller_show_pixel_grid(this.__wbg_ptr)!==0}addEmojiArt(t,i){let r=As(t,de.__wbindgen_export,de.__wbindgen_export2),n=On;de.scenecontroller_addEmojiArt(this.__wbg_ptr,r,n,ne(i))}addImage(t,i){de.scenecontroller_addImage(this.__wbg_ptr,ne(t),ne(i))}addLocalFont(t,i,r,n,s){var a=ci(r)?0:As(r,de.__wbindgen_export,de.__wbindgen_export2),o=On,l=ci(n)?0:As(n,de.__wbindgen_export,de.__wbindgen_export2),u=On,h=ci(s)?0:As(s,de.__wbindgen_export,de.__wbindgen_export2),d=On;return de.scenecontroller_addLocalFont(this.__wbg_ptr,ne(t),ne(i),a,o,l,u,h,d)!==0}addModel3DGeometry(t,i){de.scenecontroller_addModel3DGeometry(this.__wbg_ptr,ne(t),ne(i))}addVideo(t,i){de.scenecontroller_addVideo(this.__wbg_ptr,ne(t),ne(i))}addWebFont(t,i){let r=As(i,de.__wbindgen_export,de.__wbindgen_export2),n=On,s=de.scenecontroller_addWebFont(this.__wbg_ptr,ne(t),r,n);return ii(s)}applyDeltaToVectorVertexPositionSelection(t,i,r){let n=de.scenecontroller_applyDeltaToVectorVertexPositionSelection(this.__wbg_ptr,ne(t),ne(i),ne(r));return ii(n)}axisAlignedBoundingBox(t){let i=de.scenecontroller_axisAlignedBoundingBox(this.__wbg_ptr,ne(t));return ii(i)}boundingBox(){let t=de.scenecontroller_boundingBox(this.__wbg_ptr);return ii(t)}boxIntersectsObjects(t,i,r,n,s){try{let u=de.__wbindgen_add_to_stack_pointer(-16);de.scenecontroller_boxIntersectsObjects(u,this.__wbg_ptr,ne(t),ne(i),r,n,ci(s)?0:ne(s));var a=di().getInt32(u+4*0,!0),o=di().getInt32(u+4*1,!0),l=Gw(a,o).slice();return de.__wbindgen_export4(a,o*4,4),l}finally{de.__wbindgen_add_to_stack_pointer(16)}}calcTextAutoSize(t,i){let r=de.scenecontroller_calcTextAutoSize(this.__wbg_ptr,ne(t),ci(i)?Number.MAX_SAFE_INTEGER:Math.fround(i));return ii(r)}centerPencilData(t){let i=de.scenecontroller_centerPencilData(this.__wbg_ptr,ne(t));return ii(i)}centerVectorData(){let t=de.scenecontroller_centerVectorData(this.__wbg_ptr);return ii(t)}clearVideoExportFrame(t){de.scenecontroller_clearVideoExportFrame(this.__wbg_ptr,ne(t))}clearVideoExportFrames(){de.scenecontroller_clearVideoExportFrames(this.__wbg_ptr)}figmaVectorToVecNet(t,i){let r=de.scenecontroller_figmaVectorToVecNet(this.__wbg_ptr,ne(t),ne(i));return ii(r)}flattenShape(t){let i=de.scenecontroller_flattenShape(this.__wbg_ptr,ne(t));return ii(i)}flushLayout(t){try{let s=de.__wbindgen_add_to_stack_pointer(-16);de.scenecontroller_flushLayout(s,this.__wbg_ptr,ne(t));var i=di().getInt32(s+4*0,!0),r=di().getInt32(s+4*1,!0),n=Gw(i,r).slice();return de.__wbindgen_export4(i,r*4,4),n}finally{de.__wbindgen_add_to_stack_pointer(16)}}getCurrentFrameIndex(){let t=de.scenecontroller_getCurrentFrameIndex(this.__wbg_ptr);return t===Number.MAX_SAFE_INTEGER?void 0:t}getTotalFramesAmount(){return de.scenecontroller_getTotalFramesAmount(this.__wbg_ptr)>>>0}getUpdatedPencilData(){let t=de.scenecontroller_getUpdatedPencilData(this.__wbg_ptr);return ii(t)}getUpdatedVecNetData(){let t=de.scenecontroller_getUpdatedVecNetData(this.__wbg_ptr);return ii(t)}getVectorBoxSelectionBoundsAndLocalMatrix(t){let i=de.scenecontroller_getVectorBoxSelectionBoundsAndLocalMatrix(this.__wbg_ptr,t);return ii(i)}getVectorCursor(){let t=de.scenecontroller_getVectorCursor(this.__wbg_ptr);return ii(t)}getVectorEditMode(){let t=de.scenecontroller_getVectorEditMode(this.__wbg_ptr);return ii(t)}getVectorEditingState(){let t=de.scenecontroller_getVectorEditingState(this.__wbg_ptr);return ii(t)}getVectorSelectedVerts(){let t=de.scenecontroller_getVectorSelectedVerts(this.__wbg_ptr);return ii(t)}getVectorSelectionCount(){return de.scenecontroller_getVectorSelectionCount(this.__wbg_ptr)>>>0}hasFontAssetsChanges(){return de.scenecontroller_hasFontAssetsChanges(this.__wbg_ptr)!==0}hasSingleVectorSelectedSegment(){return de.scenecontroller_hasSingleVectorSelectedSegment(this.__wbg_ptr)!==0}instanceRootOf(t){let i=de.scenecontroller_instanceRootOf(this.__wbg_ptr,ne(t));return ii(i)}intersectsObject(t,i,r,n){return de.scenecontroller_intersectsObject(this.__wbg_ptr,ne(t),ne(i),ci(r)?Number.MAX_SAFE_INTEGER:Math.fround(r),ci(n)?16777215:n?1:0)!==0}intersectsObjects(t,i,r){try{let o=de.__wbindgen_add_to_stack_pointer(-16);de.scenecontroller_intersectsObjects(o,this.__wbg_ptr,ne(t),ci(i)?16777215:i?1:0,ci(r)?Number.MAX_SAFE_INTEGER:Math.fround(r));var n=di().getInt32(o+4*0,!0),s=di().getInt32(o+4*1,!0),a=Gw(n,s).slice();return de.__wbindgen_export4(n,s*4,4),a}finally{de.__wbindgen_add_to_stack_pointer(16)}}isEditedVectorEmpty(){return de.scenecontroller_isEditedVectorEmpty(this.__wbg_ptr)!==0}isObjectInViewport(t){return de.scenecontroller_isObjectInViewport(this.__wbg_ptr,ne(t))!==0}isUiFontLoaded(){return de.scenecontroller_isUiFontLoaded(this.__wbg_ptr)!==0}isVectorBoxSelectAllowed(){return de.scenecontroller_isVectorBoxSelectAllowed(this.__wbg_ptr)!==0}isVectorPointUnderCursor(t){return de.scenecontroller_isVectorPointUnderCursor(this.__wbg_ptr,ne(t))!==0}layout(){de.scenecontroller_layout(this.__wbg_ptr)}layoutFromResize(){try{let n=de.__wbindgen_add_to_stack_pointer(-16);de.scenecontroller_layoutFromResize(n,this.__wbg_ptr);var t=di().getInt32(n+4*0,!0),i=di().getInt32(n+4*1,!0),r=Gw(t,i).slice();return de.__wbindgen_export4(t,i*4,4),r}finally{de.__wbindgen_add_to_stack_pointer(16)}}markNeedsLayoutResolve(t){de.scenecontroller_markNeedsLayoutResolve(this.__wbg_ptr,ne(t))}measureTextNaturalSize(t){let i=de.scenecontroller_measureTextNaturalSize(this.__wbg_ptr,ne(t));return ii(i)}model3DAnimationClipIndex(t){let i=de.scenecontroller_model3DAnimationClipIndex(this.__wbg_ptr,ne(t));return i===Number.MAX_SAFE_INTEGER?void 0:i}model3DAnimationIsPlaying(t){return de.scenecontroller_model3DAnimationIsPlaying(this.__wbg_ptr,ne(t))!==0}model3DAnimationLocalTime(t){let i=de.scenecontroller_model3DAnimationLocalTime(this.__wbg_ptr,ne(t));return i===Number.MAX_SAFE_INTEGER?void 0:i}moveVectorSelectionByDelta(t){de.scenecontroller_moveVectorSelectionByDelta(this.__wbg_ptr,ne(t))}objectAlignedBoundingBox(t){let i=de.scenecontroller_objectAlignedBoundingBox(this.__wbg_ptr,ne(t));return ii(i)}objectData(t){let i=de.scenecontroller_objectData(this.__wbg_ptr,ne(t));return ii(i)}objectLocalMatrix(t){let i=de.scenecontroller_objectLocalMatrix(this.__wbg_ptr,ne(t));return ii(i)}objectWorldMatrix(t){let i=de.scenecontroller_objectWorldMatrix(this.__wbg_ptr,ne(t));return ii(i)}objectWorldMatrixWithChildrenOffset(t){let i=de.scenecontroller_objectWorldMatrixWithChildrenOffset(this.__wbg_ptr,ne(t));return ii(i)}onKeyDown(t){let i=As(t,de.__wbindgen_export,de.__wbindgen_export2),r=On;de.scenecontroller_onKeyDown(this.__wbg_ptr,i,r)}onKeyUp(t){let i=As(t,de.__wbindgen_export,de.__wbindgen_export2),r=On;de.scenecontroller_onKeyUp(this.__wbg_ptr,i,r)}onPointerDown(t,i,r){de.scenecontroller_onPointerDown(this.__wbg_ptr,ne(t),i,r)}onPointerEnter(){de.scenecontroller_onPointerEnter(this.__wbg_ptr)}onPointerLeave(){de.scenecontroller_onPointerLeave(this.__wbg_ptr)}onPointerMove(t,i,r){de.scenecontroller_onPointerMove(this.__wbg_ptr,ne(t),i,r)}onPointerUp(t,i,r){de.scenecontroller_onPointerUp(this.__wbg_ptr,ne(t),i,r)}outermostInstanceRootOf(t){let i=de.scenecontroller_outermostInstanceRootOf(this.__wbg_ptr,ne(t));return ii(i)}parentAlignedBoundingBox(t,i){let r=de.scenecontroller_parentAlignedBoundingBox(this.__wbg_ptr,ne(t),ne(i));return ii(r)}parseSvgPath(t,i){let r=As(t,de.__wbindgen_export,de.__wbindgen_export2),n=On,s=de.scenecontroller_parseSvgPath(this.__wbg_ptr,r,n,i);return ii(s)}pencilShiftDown(){de.scenecontroller_pencilShiftDown(this.__wbg_ptr)}pencilShiftUp(){de.scenecontroller_pencilShiftUp(this.__wbg_ptr)}pendingAssetLoads(){return de.scenecontroller_pendingAssetLoads(this.__wbg_ptr)>>>0}playInEditorFrame(t){de.scenecontroller_playInEditorFrame(this.__wbg_ptr,ne(t))}present(t,i){de.scenecontroller_present(this.__wbg_ptr,ci(t)?0:ne(t),ci(i)?16777215:i?1:0)}previewTransition(t,i,r){de.scenecontroller_previewTransition(this.__wbg_ptr,ne(t),ci(i)?0:ne(i),ne(r))}projectionEffectBoundingBox(t){let i=de.scenecontroller_projectionEffectBoundingBox(this.__wbg_ptr,ne(t));return ii(i)}readVectorCornerRadiiForSelection(t,i){let r=de.scenecontroller_readVectorCornerRadiiForSelection(this.__wbg_ptr,ne(t),ne(i));return ii(r)}readVectorCornerSmoothing(t){return de.scenecontroller_readVectorCornerSmoothing(this.__wbg_ptr,ne(t))}readVectorVertexPositionsForSelection(t,i){let r=de.scenecontroller_readVectorVertexPositionsForSelection(this.__wbg_ptr,ne(t),ne(i));return ii(r)}reanchorObject(t){de.scenecontroller_reanchorObject(this.__wbg_ptr,ne(t))}resetAllStates(t,i){let r=NZ(i,de.__wbindgen_export),n=On;de.scenecontroller_resetAllStates(this.__wbg_ptr,ci(t)?0:ne(t),r,n)}resizeGroup(t,i,r){try{let o=de.__wbindgen_add_to_stack_pointer(-16);de.scenecontroller_resizeGroup(o,this.__wbg_ptr,ne(t),i,r);var n=di().getInt32(o+4*0,!0),s=di().getInt32(o+4*1,!0),a=Gw(n,s).slice();return de.__wbindgen_export4(n,s*4,4),a}finally{de.__wbindgen_add_to_stack_pointer(16)}}saveVectorSelectionInitialPositions(){de.scenecontroller_saveVectorSelectionInitialPositions(this.__wbg_ptr)}screenToWorld(t){let i=de.scenecontroller_screenToWorld(this.__wbg_ptr,ne(t));return ii(i)}seekVideos(t){let i=de.scenecontroller_seekVideos(this.__wbg_ptr,t);return ii(i)}setBytesForVectorCornerRadiusSelection(t,i,r){let n=de.scenecontroller_setBytesForVectorCornerRadiusSelection(this.__wbg_ptr,ne(t),ne(i),r);return ii(n)}setBytesForVectorCornerSmoothing(t,i){let r=de.scenecontroller_setBytesForVectorCornerSmoothing(this.__wbg_ptr,ne(t),i);return ii(r)}setBytesForVectorVertexPositionSelection(t,i,r,n){let s=de.scenecontroller_setBytesForVectorVertexPositionSelection(this.__wbg_ptr,ne(t),ne(i),r,n);return ii(s)}setModel3DAnimation(t,i,r){de.scenecontroller_setModel3DAnimation(this.__wbg_ptr,ne(t),ci(i)?Number.MAX_SAFE_INTEGER:i>>>0,r)}setModel3DAnimationLocalTime(t,i){de.scenecontroller_setModel3DAnimationLocalTime(this.__wbg_ptr,ne(t),i)}setPresentationPadding(t){de.scenecontroller_setPresentationPadding(this.__wbg_ptr,ne(t))}setShowPixelGrid(t){de.scenecontroller_setShowPixelGrid(this.__wbg_ptr,t)}setVectorEditingState(t){try{de.scenecontroller_setVectorEditingState(this.__wbg_ptr,CPe(t))}finally{Mu[rC++]=void 0}}setVectorTool(t){de.scenecontroller_setVectorTool(this.__wbg_ptr,ne(t))}setVideoExportFrame(t,i){de.scenecontroller_setVideoExportFrame(this.__wbg_ptr,ne(t),ne(i))}snapVectorResizeHandle(t,i,r){let n=de.scenecontroller_snapVectorResizeHandle(this.__wbg_ptr,ne(t),i,r);return ii(n)}start(){de.scenecontroller_start(this.__wbg_ptr)}startPencil(t,i,r){de.scenecontroller_startPencil(this.__wbg_ptr,ne(t),i,ne(r))}startVectorEditing(t,i){de.scenecontroller_startVectorEditing(this.__wbg_ptr,ne(t),i)}stopInEditorFrame(){de.scenecontroller_stopInEditorFrame(this.__wbg_ptr)}stopPencil(){de.scenecontroller_stopPencil(this.__wbg_ptr)}stopPresenting(){de.scenecontroller_stopPresenting(this.__wbg_ptr)}stopPreviewTransition(){de.scenecontroller_stopPreviewTransition(this.__wbg_ptr)}stopVectorEditing(){de.scenecontroller_stopVectorEditing(this.__wbg_ptr)}strokeShape(t){let i=de.scenecontroller_strokeShape(this.__wbg_ptr,ne(t));return ii(i)}switchScene(t){de.scenecontroller_switchScene(this.__wbg_ptr,ne(t))}transformBoundingBoxByAlignObject(t,i,r,n){let s=de.scenecontroller_transformBoundingBoxByAlignObject(this.__wbg_ptr,ne(t),ne(i),ne(r),ne(n));return ii(s)}transformVectorSelection(t,i,r,n){return de.scenecontroller_transformVectorSelection(this.__wbg_ptr,ne(t),ne(i),r,n)!==0}triggerEventForObjectIds(t){let i=NZ(t,de.__wbindgen_export),r=On;de.scenecontroller_triggerEventForObjectIds(this.__wbg_ptr,i,r)}updateByOp(t){de.scenecontroller_updateByOp(this.__wbg_ptr,ne(t))}updateCached(){de.scenecontroller_updateCached(this.__wbg_ptr)}updateCamera(t){de.scenecontroller_updateCamera(this.__wbg_ptr,ne(t))}updateComponents(t){de.scenecontroller_updateComponents(this.__wbg_ptr,ne(t))}updatePublish(t){de.scenecontroller_updatePublish(this.__wbg_ptr,ne(t))}updateSceneOp(t){de.scenecontroller_updateSceneOp(this.__wbg_ptr,ne(t))}updateUiShapes(t){de.scenecontroller_updateUiShapes(this.__wbg_ptr,ne(t))}vectorAllowMultiSelect(t){de.scenecontroller_vectorAllowMultiSelect(this.__wbg_ptr,t)}vectorBoxSelect(t,i){de.scenecontroller_vectorBoxSelect(this.__wbg_ptr,ne(t),ne(i))}vectorClearSnapping(){de.scenecontroller_vectorClearSnapping(this.__wbg_ptr)}vectorDeleteSelection(t){de.scenecontroller_vectorDeleteSelection(this.__wbg_ptr,t)}vectorResize(t,i){let r=de.scenecontroller_vectorResize(this.__wbg_ptr,ne(t),ne(i));return ii(r)}vectorResizeWithCornerRadii(t,i,r){let n=de.scenecontroller_vectorResizeWithCornerRadii(this.__wbg_ptr,ne(t),ne(i),r);return ii(n)}vectorSetIsAltPressed(t){de.scenecontroller_vectorSetIsAltPressed(this.__wbg_ptr,t)}vectorSetIsSnapping(t){de.scenecontroller_vectorSetIsSnapping(this.__wbg_ptr,t)}vectorSetIsSnappingControlAngles(t){de.scenecontroller_vectorSetIsSnappingControlAngles(this.__wbg_ptr,t)}vectorStopContinueSubpath(){de.scenecontroller_vectorStopContinueSubpath(this.__wbg_ptr)}videoFillSources(t){let i=de.scenecontroller_videoFillSources(this.__wbg_ptr,ne(t));return ii(i)}worldToScreen(t){let i=de.scenecontroller_worldToScreen(this.__wbg_ptr,ne(t));return ii(i)}set is_play_mode(t){de.__wbg_set_scenecontroller_is_play_mode(this.__wbg_ptr,t)}set needs_video_update(t){de.__wbg_set_scenecontroller_needs_video_update(this.__wbg_ptr,t)}set show_pixel_grid(t){de.__wbg_set_scenecontroller_show_pixel_grid(this.__wbg_ptr,t)}};Symbol.dispose&&(tS.prototype[Symbol.dispose]=tS.prototype.free);WB=["clamp-to-edge","repeat","mirror-repeat"],TZ=["auto"],MZ=["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"],lPe=["add","subtract","reverse-subtract","min","max"],hPe=["uniform","storage","read-only-storage"],uPe=["opaque","premultiplied"],dPe=["standard","extended"],qB=["never","less","equal","less-equal","greater","not-equal","greater-equal","always"],cPe=["none","front","back"],pPe=["unknown","destroyed"],fPe=["validation","out-of-memory","internal"],EZ=["nearest","linear"],mPe=["ccw","cw"],$B=["uint16","uint32"],XB=["load","clear"],gPe=["nearest","linear"],vPe=["low-power","high-performance"],yPe=["point-list","line-list","line-strip","triangle-list","triangle-strip"],_Pe=["occlusion","timestamp"],bPe=["filtering","non-filtering","comparison"],YB=["keep","zero","replace","invert","increment-clamp","decrement-clamp","increment-wrap","decrement-wrap"],xPe=["write-only","read-only","read-write"],KB=["store","discard"],ZB=["all","stencil-only","depth-only"],wPe=["1d","2d","3d"],s0=["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"],SPe=["float","unfilterable-float","depth","sint","uint"],QB=["1d","2d","2d-array","cube","cube-array","3d"],TPe=["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"],MPe=["vertex","instance"],EPe=["same-origin","no-cors","cors","navigate"],AZ=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>de.__wbg_devicelostpromise_free(e,1)),CZ=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>de.__wbg_engine_free(e,1)),RZ=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>de.__wbg_pixelreadpromise_free(e,1)),APe=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>de.__wbg_scenecontroller_free(e,1));PZ=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>de.__wbindgen_export5(e.a,e.b));a0=null;Hw=null;Ww=null;qw=null;$w=null;Xw=null;Yw=null;Kw=null;Zw=null;Mu=new Array(1024).fill(void 0);Mu.push(void 0,null,!0,!1);Jw=Mu.length;rC=1024;nC=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});nC.decode();VPe=2146435072,JB=0;eS=new TextEncoder;"encodeInto"in eS||(eS.encodeInto=function(e,t){let i=eS.encode(e);return t.set(i),{read:e.length,written:i.length}});On=0});var YVe={};DB(YVe,{SplineViewer:()=>Ro});module.exports=oCe(YVe);var jv={},YPe=Object.create,dO=Object.defineProperty,KPe=Object.getOwnPropertyDescriptor,ZPe=Object.getOwnPropertyNames,QPe=Object.getPrototypeOf,JPe=Object.prototype.hasOwnProperty,V=(e,t)=>()=>(e&&(t=e(e=0)),t),cw=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),pw=(e,t)=>{for(var i in t)dO(e,i,{get:t[i],enumerable:!0})},fw=(e,t,i)=>(i=e!=null?YPe(QPe(e)):{},((r,n,s,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of ZPe(n))!JPe.call(r,o)&&o!==void 0&&dO(r,o,{get:()=>n[o],enumerable:!(a=KPe(n,o))||a.enumerable});return r})(!t&&e&&e.__esModule?i:dO(i,"default",{value:e,enumerable:!0}),e)),Lc=(e,t,i)=>(((r,n,s)=>{n in r?dO(r,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[n]=s})(e,typeof t!="symbol"?t+"":t,i),i);function sC(e,t){return new oye[e](t)}function oM(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function aE(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function Ove(){let e=aE("canvas");return e.style.display="block",e}function GE(...e){let t="THREE."+e.shift();Xy?Xy("log",t,...e):console.log(t,...e)}function Lve(e){let t=e[0];if(typeof t=="string"&&t.startsWith("TSL:")){let i=e[1];i&&i.isStackTrace?e[0]+=" "+i.getLocation():e[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return e}function it(...e){let t="THREE."+(e=Lve(e)).shift();if(Xy)Xy("warn",t,...e);else{let i=e[0];i&&i.isStackTrace?console.warn(i.getError(t)):console.warn(t,...e)}}function Xe(...e){let t="THREE."+(e=Lve(e)).shift();if(Xy)Xy("error",t,...e);else{let i=e[0];i&&i.isStackTrace?console.error(i.getError(t)):console.error(t,...e)}}function Sr(...e){let t=e.join(" ");t in Zj||(Zj[t]=!0,it(...e))}function kh(){let e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,i=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return(co[255&e]+co[e>>8&255]+co[e>>16&255]+co[e>>24&255]+"-"+co[255&t]+co[t>>8&255]+"-"+co[t>>16&15|64]+co[t>>24&255]+"-"+co[63&i|128]+co[i>>8&255]+"-"+co[i>>16&255]+co[i>>24&255]+co[255&r]+co[r>>8&255]+co[r>>16&255]+co[r>>24&255]).toLowerCase()}function Li(e,t,i){return Math.max(t,Math.min(i,e))}function Gj(e,t){return(e%t+t)%t}function eDe(e,t,i,r,n){return r+(e-t)*(n-r)/(i-t)}function tDe(e,t,i){return e!==t?(i-e)/(t-e):0}function lM(e,t,i){return(1-i)*e+i*t}function iDe(e,t,i,r){return lM(e,t,1-Math.exp(-i*r))}function rDe(e,t=1){return t-Math.abs(Gj(e,2*t)-t)}function nDe(e,t,i){return e<=t?0:e>=i?1:(e=(e-t)/(i-t))*e*(3-2*e)}function sDe(e,t,i){return e<=t?0:e>=i?1:(e=(e-t)/(i-t))*e*e*(e*(6*e-15)+10)}function aDe(e,t){return e+Math.floor(Math.random()*(t-e+1))}function oDe(e,t){return e+Math.random()*(t-e)}function lDe(e){return e*(.5-Math.random())}function hDe(e){e!==void 0&&(Qj=e);let t=Qj+=1831565813;return t=Math.imul(t^t>>>15,1|t),t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296}function uDe(e){return e*wb}function dDe(e){return e*Sb}function cDe(e){return!(e&e-1)&&e!==0}function pDe(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function fDe(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}function mDe(e,t,i,r,n){let s=Math.cos,a=Math.sin,o=s(i/2),l=a(i/2),u=s((t+r)/2),h=a((t+r)/2),d=s((t-r)/2),c=a((t-r)/2),p=s((r-t)/2),f=a((r-t)/2);switch(n){case"XYX":e.set(o*h,l*d,l*c,o*u);break;case"YZY":e.set(l*c,o*h,l*d,o*u);break;case"ZXZ":e.set(l*d,l*c,o*h,o*u);break;case"XZX":e.set(o*h,l*f,l*p,o*u);break;case"YXY":e.set(l*p,o*h,l*f,o*u);break;case"ZYZ":e.set(l*f,l*p,o*h,o*u);break;default:it("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+n)}}function sl(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function Ji(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(4294967295*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(2147483647*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function ep(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function S1(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}function tU(e){return typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap?lye.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(it("Texture: Unable to serialize Texture."),{})}function iU(e,t,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?e+6*(t-e)*i:i<.5?t:i<2/3?e+6*(t-e)*(2/3-i):e}function rU(e,t,i,r,n){for(let s=0,a=e.length-3;s<=a;s+=3){eg.fromArray(e,s);let o=n.x*Math.abs(eg.x)+n.y*Math.abs(eg.y)+n.z*Math.abs(eg.z),l=t.dot(eg),u=i.dot(eg),h=r.dot(eg);if(Math.max(-Math.max(l,u,h),Math.min(l,u,h))>o)return!1}return!0}function Cl(e){Math.abs(e)>65504&&it("DataUtils.toHalfFloat(): Value out of range."),e=Li(e,-65504,65504),Cc.floatView[0]=e;let t=Cc.uint32View[0],i=t>>23&511;return Cc.baseTable[i]+((8388607&t)>>Cc.shiftTable[i])}function iS(e){let t=e>>10;return Cc.uint32View[0]=Cc.mantissaTable[Cc.offsetTable[t]+(1023&e)]+Cc.exponentTable[t],Cc.floatView[0]}function aC(e,t,i,r,n,s){Ev.subVectors(e,i).addScalar(.5).multiply(r),n!==void 0?(Tb.x=s*Ev.x-n*Ev.y,Tb.y=n*Ev.x+s*Ev.y):Tb.copy(Ev),e.copy(t),e.x+=Tb.x,e.y+=Tb.y,e.applyMatrix4(i7)}function oC(e,t,i,r,n,s,a,o,l,u){e.getVertexPosition(o,uM),e.getVertexPosition(l,dM),e.getVertexPosition(u,cM);let h=function(d,c,p,f,m,g,v,y){let _;if(_=c.side===jr?f.intersectTriangle(v,g,m,!0,y):f.intersectTriangle(m,g,v,c.side===Mo,y),_===null)return null;pM.copy(y),pM.applyMatrix4(d.matrixWorld);let b=p.ray.origin.distanceTo(pM);return b<p.near||b>p.far?null:{distance:b,point:pM.clone(),object:d}}(e,t,i,r,uM,dM,cM,n7);if(h){let d=new P;Ls.getBarycoord(n7,uM,dM,cM,d),n&&(h.uv=Ls.getInterpolatedAttribute(n,o,l,u,d,new J)),s&&(h.uv1=Ls.getInterpolatedAttribute(s,o,l,u,d,new J)),a&&(h.normal=Ls.getInterpolatedAttribute(a,o,l,u,d,new P),h.normal.dot(r.direction)>0&&h.normal.multiplyScalar(-1));let c={a:o,b:l,c:u,normal:new P,materialIndex:0};Ls.getNormal(uM,dM,cM,c.normal),h.face=c,h.barycoord=d}return h}function lC(e,t,i,r,n,s,a){let o=e.geometry.attributes.position;if(lE.fromBufferAttribute(o,n),hE.fromBufferAttribute(o,s),i.distanceSqToSegment(lE,hE,QN,o7)>r)return;QN.applyMatrix4(e.matrixWorld);let l=t.ray.origin.distanceTo(QN);return l<t.near||l>t.far?void 0:{distance:l,point:o7.clone().applyMatrix4(e.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:e}}function nU(){let e=0,t=0,i=0,r=0;function n(s,a,o,l){e=s,t=o,i=-3*s+3*a-2*o-l,r=2*s-2*a+o+l}return{initCatmullRom:function(s,a,o,l,u){n(a,o,u*(o-s),u*(l-a))},initNonuniformCatmullRom:function(s,a,o,l,u,h,d){let c=(a-s)/u-(o-s)/(u+h)+(o-a)/h,p=(o-a)/h-(l-a)/(h+d)+(l-o)/d;c*=h,p*=h,n(a,o,c,p)},calc:function(s){let a=s*s;return e+t*s+i*a+r*(a*s)}}}function UZ(e,t,i,r,n){let s=.5*(r-t),a=.5*(n-i),o=e*e;return(2*i-2*r+s+a)*(e*o)+(-3*i+3*r-2*s-a)*o+s*e+i}function rS(e,t,i,r){return function(n,s){let a=1-n;return a*a*s}(e,t)+function(n,s){return 2*(1-n)*n*s}(e,i)+function(n,s){return n*n*s}(e,r)}function nS(e,t,i,r,n){return function(s,a){let o=1-s;return o*o*o*a}(e,t)+function(s,a){let o=1-s;return 3*o*o*s*a}(e,i)+function(s,a){return 3*(1-s)*s*s*a}(e,r)+function(s,a){return s*s*s*a}(e,n)}function FZ(e,t,i,r,n){let s;if(n===function(a,o,l,u){let h=0;for(let d=o,c=l-u;d<l;d+=u)h+=(a[c]-a[d])*(a[d+1]+a[c+1]),c=d;return h}(e,t,i,r)>0)for(let a=t;a<i;a+=r)s=zZ(a/r|0,e[a],e[a+1],s);else for(let a=i-r;a>=t;a-=r)s=zZ(a/r|0,e[a],e[a+1],s);return s&&jx(s,s.next)&&(WE(s),s=s.next),s}function xy(e,t){if(!e)return e;t||(t=e);let i,r=e;do if(i=!1,r.steiner||!jx(r,r.next)&&ws(r.prev,r,r.next)!==0)r=r.next;else{if(WE(r),r=t=r.prev,r===r.next)break;i=!0}while(i||r!==t);return t}function jE(e,t,i,r,n,s,a){if(!e)return;!a&&s&&function(l,u,h,d){let c=l;do c.z===0&&(c.z=jj(c.x,c.y,u,h,d)),c.prevZ=c.prev,c.nextZ=c.next,c=c.next;while(c!==l);c.prevZ.nextZ=null,c.prevZ=null,function(p){let f,m=1;do{let g,v=p;p=null;let y=null;for(f=0;v;){f++;let _=v,b=0;for(let w=0;w<m&&(b++,_=_.nextZ,_);w++);let x=m;for(;b>0||x>0&&_;)b!==0&&(x===0||!_||v.z<=_.z)?(g=v,v=v.nextZ,b--):(g=_,_=_.nextZ,x--),y?y.nextZ=g:p=g,g.prevZ=y,y=g;v=_}y.nextZ=null,m*=2}while(f>1)}(c)}(e,r,n,s);let o=e;for(;e.prev!==e.next;){let l=e.prev,u=e.next;if(s?vDe(e,r,n,s):gDe(e))t.push(l.i,e.i,u.i),WE(e),e=u.next,o=u.next;else if((e=u)===o){a?a===1?jE(e=yDe(xy(e),t),t,i,r,n,s,2):a===2&&_De(e,t,i,r,n,s):jE(xy(e),t,i,r,n,s,1);break}}}function gDe(e){let t=e.prev,i=e,r=e.next;if(ws(t,i,r)>=0)return!1;let n=t.x,s=i.x,a=r.x,o=t.y,l=i.y,u=r.y,h=Math.min(n,s,a),d=Math.min(o,l,u),c=Math.max(n,s,a),p=Math.max(o,l,u),f=r.next;for(;f!==t;){if(f.x>=h&&f.x<=c&&f.y>=d&&f.y<=p&&hM(n,o,s,l,a,u,f.x,f.y)&&ws(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function vDe(e,t,i,r){let n=e.prev,s=e,a=e.next;if(ws(n,s,a)>=0)return!1;let o=n.x,l=s.x,u=a.x,h=n.y,d=s.y,c=a.y,p=Math.min(o,l,u),f=Math.min(h,d,c),m=Math.max(o,l,u),g=Math.max(h,d,c),v=jj(p,f,t,i,r),y=jj(m,g,t,i,r),_=e.prevZ,b=e.nextZ;for(;_&&_.z>=v&&b&&b.z<=y;){if(_.x>=p&&_.x<=m&&_.y>=f&&_.y<=g&&_!==n&&_!==a&&hM(o,h,l,d,u,c,_.x,_.y)&&ws(_.prev,_,_.next)>=0||(_=_.prevZ,b.x>=p&&b.x<=m&&b.y>=f&&b.y<=g&&b!==n&&b!==a&&hM(o,h,l,d,u,c,b.x,b.y)&&ws(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;_&&_.z>=v;){if(_.x>=p&&_.x<=m&&_.y>=f&&_.y<=g&&_!==n&&_!==a&&hM(o,h,l,d,u,c,_.x,_.y)&&ws(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;b&&b.z<=y;){if(b.x>=p&&b.x<=m&&b.y>=f&&b.y<=g&&b!==n&&b!==a&&hM(o,h,l,d,u,c,b.x,b.y)&&ws(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function yDe(e,t){let i=e;do{let r=i.prev,n=i.next.next;!jx(r,n)&&Uve(r,i,i.next,n)&&HE(r,n)&&HE(n,r)&&(t.push(r.i,i.i,n.i),WE(i),WE(i.next),i=e=n),i=i.next}while(i!==e);return xy(i)}function _De(e,t,i,r,n,s){let a=e;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&TDe(a,o)){let l=Fve(a,o);return a=xy(a,a.next),l=xy(l,l.next),jE(a,t,i,r,n,s,0),void jE(l,t,i,r,n,s,0)}o=o.next}a=a.next}while(a!==e)}function bDe(e,t){let i=e.x-t.x;return i===0&&(i=e.y-t.y,i===0)&&(i=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x)),i}function xDe(e,t){let i=function(n,s){let a,o=s,l=n.x,u=n.y,h=-1/0;if(jx(n,o))return o;do{if(jx(n,o.next))return o.next;if(u<=o.y&&u>=o.next.y&&o.next.y!==o.y){let m=o.x+(u-o.y)*(o.next.x-o.x)/(o.next.y-o.y);if(m<=l&&m>h&&(h=m,a=o.x<o.next.x?o:o.next,m===l))return a}o=o.next}while(o!==s);if(!a)return null;let d=a,c=a.x,p=a.y,f=1/0;o=a;do{if(l>=o.x&&o.x>=c&&l!==o.x&&Bve(u<p?l:h,u,c,p,u<p?h:l,u,o.x,o.y)){let m=Math.abs(u-o.y)/(l-o.x);HE(o,n)&&(m<f||m===f&&(o.x>a.x||o.x===a.x&&wDe(a,o)))&&(a=o,f=m)}o=o.next}while(o!==d);return a}(e,t);if(!i)return t;let r=Fve(i,e);return xy(r,r.next),xy(i,i.next)}function wDe(e,t){return ws(e.prev,e,t.prev)<0&&ws(t.next,e,e.next)<0}function jj(e,t,i,r,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*n|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function SDe(e){let t=e,i=e;do(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next;while(t!==e);return i}function Bve(e,t,i,r,n,s,a,o){return(n-a)*(t-o)>=(e-a)*(s-o)&&(e-a)*(r-o)>=(i-a)*(t-o)&&(i-a)*(s-o)>=(n-a)*(r-o)}function hM(e,t,i,r,n,s,a,o){return!(e===a&&t===o)&&Bve(e,t,i,r,n,s,a,o)}function TDe(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(i,r){let n=i;do{if(n.i!==i.i&&n.next.i!==i.i&&n.i!==r.i&&n.next.i!==r.i&&Uve(n,n.next,i,r))return!0;n=n.next}while(n!==i);return!1}(e,t)&&(HE(e,t)&&HE(t,e)&&function(i,r){let n=i,s=!1,a=(i.x+r.x)/2,o=(i.y+r.y)/2;do n.y>o!=n.next.y>o&&n.next.y!==n.y&&a<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(s=!s),n=n.next;while(n!==i);return s}(e,t)&&(ws(e.prev,e,t.prev)||ws(e,t.prev,t))||jx(e,t)&&ws(e.prev,e,e.next)>0&&ws(t.prev,t,t.next)>0)}function ws(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function jx(e,t){return e.x===t.x&&e.y===t.y}function Uve(e,t,i,r){let n=uC(ws(e,t,i)),s=uC(ws(e,t,r)),a=uC(ws(i,r,e)),o=uC(ws(i,r,t));return!!(n!==s&&a!==o||n===0&&hC(e,i,t)||s===0&&hC(e,r,t)||a===0&&hC(i,e,r)||o===0&&hC(i,t,r))}function hC(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function uC(e){return e>0?1:e<0?-1:0}function HE(e,t){return ws(e.prev,e,e.next)<0?ws(e,t,e.next)>=0&&ws(e,e.prev,t)>=0:ws(e,t,e.prev)<0||ws(e,e.next,t)<0}function Fve(e,t){let i=Hj(e.i,e.x,e.y),r=Hj(t.i,t.x,t.y),n=e.next,s=t.prev;return e.next=t,t.prev=e,i.next=n,n.prev=i,r.next=i,i.prev=r,s.next=r,r.prev=s,r}function zZ(e,t,i,r){let n=Hj(e,t,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function WE(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Hj(e,t,i){return{i:e,x:t,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function kZ(e){let t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function VZ(e,t){for(let i=0;i<t.length;i++)e.push(t[i].x),e.push(t[i].y)}function Hx(e){let t={};for(let i in e){t[i]={};for(let r in e[i]){let n=e[i][r];if(GZ(n))n.isRenderTargetTexture?(it("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[i][r]=null):t[i][r]=n.clone();else if(Array.isArray(n))if(GZ(n[0])){let s=[];for(let a=0,o=n.length;a<o;a++)s[a]=n[a].clone();t[i][r]=s}else t[i][r]=n.slice();else t[i][r]=n}}return t}function ul(e){let t={};for(let i=0;i<e.length;i++){let r=Hx(e[i]);for(let n in r)t[n]=r[n]}return t}function GZ(e){return e&&(e.isColor||e.isMatrix3||e.isMatrix4||e.isVector2||e.isVector3||e.isVector4||e.isTexture||e.isQuaternion)}function zve(e){let t=e.getRenderTarget();return t===null?e.outputColorSpace:t.isXRRenderTarget===!0?t.texture.colorSpace:oi.workingColorSpace}function dC(e,t){return e&&e.constructor!==t?typeof t.BYTES_PER_ELEMENT=="number"?new t(e):Array.prototype.slice.call(e):e}function MDe(e){let t=e.length,i=new Array(t);for(let r=0;r!==t;++r)i[r]=r;return i.sort(function(r,n){return e[r]-e[n]}),i}function jZ(e,t,i){let r=e.length,n=new e.constructor(r);for(let s=0,a=0;a!==r;++s){let o=i[s]*t;for(let l=0;l!==t;++l)n[a++]=e[o+l]}return n}function EDe(e){if(e.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");let t=function(i){switch(i.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return v7;case"vector":case"vector2":case"vector3":case"vector4":return _ye;case"color":return yye;case"quaternion":return y7;case"bool":case"boolean":return Eb;case"string":return Ab}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+i)}(e.type);if(e.times===void 0){let i=[],r=[];(function(n,s,a,o){let l=1,u=n[0];for(;u!==void 0&&u[o]===void 0;)u=n[l++];if(u===void 0)return;let h=u[o];if(h!==void 0)if(Array.isArray(h))do h=u[o],h!==void 0&&(s.push(u.time),a.push(...h)),u=n[l++];while(u!==void 0);else if(h.toArray!==void 0)do h=u[o],h!==void 0&&(s.push(u.time),h.toArray(a,a.length)),u=n[l++];while(u!==void 0);else do h=u[o],h!==void 0&&(s.push(u.time),a.push(h)),u=n[l++];while(u!==void 0)})(e.keys,i,r,"value"),e.times=i,e.values=r}return t.parse!==void 0?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}function HZ(e){try{let t=e.slice(e.indexOf(":")+1);return new URL(t).protocol==="blob:"}catch{return!1}}function ADe(){this._document.hidden===!1&&this.reset()}function WZ(e,t){return e.distance-t.distance}function Wj(e,t,i,r){let n=!0;if(e.layers.test(t.layers)&&e.raycast(t,i)===!1&&(n=!1),n===!0&&r===!0){let s=e.children;for(let a=0,o=s.length;a<o;a++)Wj(s[a],t,i,!0)}}function Gs(e,t,i,r,n,s,a){gM.set(n,s,a).unproject(r);let o=t[e];if(o!==void 0){let l=i.getAttribute("position");for(let u=0,h=o.length;u<h;u++)l.setXYZ(o[u],gM.x,gM.y,gM.z)}}function qj(e,t,i,r){let n=function(s){switch(s){case zr:case Rf:return{byteLength:1,components:1};case Ah:case Pf:case ni:return{byteLength:2,components:1};case qx:case $x:return{byteLength:2,components:4};case cn:case Ns:case Ht:return{byteLength:4,components:1};case Xx:case Yx:return{byteLength:4,components:3}}throw new Error(`THREE.TextureUtils: Unknown texture type ${s}.`)}(r);switch(i){case KE:return e*t;case Us:case pf:return e*t/n.components*n.byteLength;case bs:case ff:return e*t*2/n.components*n.byteLength;case _g:return e*t*3/n.components*n.byteLength;case mn:case kg:return e*t*4/n.components*n.byteLength;case Df:case Nf:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case If:case Of:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case Zx:case Jx:return Math.max(e,16)*Math.max(t,8)/4;case Kx:case Qx:return Math.max(e,8)*Math.max(t,8)/2;case wy:case Sy:case My:case Ey:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case Ty:case Lf:case Ay:case Cy:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case Ry:return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16;case Py:return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16;case Dy:return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16;case Ny:return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16;case Iy:return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16;case Oy:return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16;case Ly:return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16;case By:return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16;case Uy:return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16;case Fy:return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16;case zy:return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16;case ky:return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16;case Vy:return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16;case Gy:case jy:case Hy:return Math.ceil(e/4)*Math.ceil(t/4)*16;case Wy:case qy:return Math.ceil(e/4)*Math.ceil(t/4)*8;case Bf:case $y:return Math.ceil(e/4)*Math.ceil(t/4)*16}throw new Error(`Unable to determine texture byte length for ${i} format.`)}var yu,gh,I$,cO,O$,qE,Ef,L$,fd,Mo,jr,Zr,Ii,sa,bc,xc,wc,Hv,qN,qo,pO,fO,B$,U$,mO,Wx,gO,vO,sy,Af,yO,_O,bO,xO,wO,kve,Vve,Gve,jve,cx,px,fx,sf,mx,gx,vx,yx,Kb,F$,z$,Os,SO,TO,MO,$E,$j,XE,YE,$N,wd,Gc,ay,oy,Cf,Jn,gr,cf,gt,EO,ld,nt,ly,Dn,Hve,zr,Rf,Pf,Ah,Ns,cn,Ht,ni,qx,$x,yd,Xx,Yx,KE,_g,mn,Yl,Ch,Us,pf,bs,ff,XN,kg,Df,Nf,If,Of,Kx,Zx,Qx,Jx,wy,Sy,Ty,My,Ey,Lf,Ay,Cy,Ry,Py,Dy,Ny,Iy,Oy,Ly,By,Uy,Fy,zy,ky,Vy,Gy,jy,Hy,Wy,qy,Bf,$y,Xj,Yj,AO,sS,cC,pC,o0,l0,aS,vc,Wve,cu,k$,fl,Yi,Sd,hy,Ot,YN,Kj,qve,$ve,Qm,Xve,Yve,Kve,Zve,Qve,Jve,eye,tye,iye,rye,nye,sye,aye,KN,CO,oE,RO,af,Zb,PO,Sc,DO,Wv,_d,NO,xo,$l,Zu,Jm,oye,Zj,Xy,IO,xs,co,Qj,wb,Sb,ht,sU,J,jt,aU,P,fC,oU,qZ,hi,mC,lU,hU,oi,T1,lye,$Z,gC,XZ,vC,Pi,uU,pt,yi,yr,v4,hye,dU,Ve,h0,Vh,YZ,KZ,tp,oS,Rl,cU,pU,Kr,ZN,ZZ,fU,u0,Ud,lS,M1,QZ,JZ,mU,gU,vU,yU,eQ,d0,yC,un,mw,_U,ip,hS,ot,no,Jj,Zo,Gh,Fd,_C,zd,c0,p0,bU,bC,xC,wC,SC,TC,MC,Ls,fn,kd,jh,uS,f0,m0,g0,rp,np,sm,E1,dS,cS,eg,Cc,bd,js,pS,tQ,It,OO,Uf,e7,Et,iQ,A1,EC,qa,rQ,rh,AC,v0,Pl,C1,ma,At,Qb,Po,lg,nQ,go,t7,R1,P1,y0,_0,Ev,Tb,i7,fS,D1,mS,xU,CC,wU,r7,Vd,RC,gS,sp,PC,vS,DC,mf,Zl,SU,am,yS,TU,uM,dM,cM,NC,_S,n7,pM,Cr,s7,Dr,MU,sQ,LO,ml,b0,EU,bS,AU,aQ,N1,I1,y4,IC,oQ,lQ,$a,om,hQ,xS,qv,CU,a7,sd,lE,hE,RU,O1,wS,QN,o7,fM,PU,DU,Mb,uye,V$,JN,bg,G$,es,j$,Ph,uE,BO,OC,l7,Eu,mM,uQ,NU,IU,LC,BC,UC,dQ,pu,dE,wh,h7,of,cQ,eI,OU,u7,cE,ZE,pQ,d7,c7,p7,qc,Ff,UO,f7,H$,i1,Pr,W$,m7,dye,cye,pye,fye,mye,q$,gye,vye,g7,L1,fQ,LU,mQ,gQ,Au,Eb,yye,v7,vQ,y7,Ab,_ye,tI,B1,bye,yQ,Av,Gd,_Q,pE,x0,bQ,xye,wye,Gp,_4,FC,BU,UU,zC,SS,TS,Cu,xg,ap,FU,zU,bh,xQ,uy,U1,wQ,QE,Vg,SQ,JE,Sye,Tye,TQ,Mye,iI,FO,$$,w0,Eye,Aye,MQ,kC,EQ,VC,AQ,CQ,RQ,PQ,DQ,NQ,IQ,OQ,An,LQ,BQ,Cye,Qe,X$,kU,Y$,_7,UQ,K$,VU,b4,GU,MS,S0,T0,GC,FQ,zQ,Eh,jU,Rye,Pye,HU,ES,WU,Dye,gM,cs,eA,tA,Nye,b7=V(()=>{yu="185",gh={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},I$=0,cO=1,O$=2,qE=0,Ef=1,L$=2,fd=3,Mo=0,jr=1,Zr=2,Ii=0,sa=1,bc=2,xc=3,wc=4,Hv=5,qN=6,qo=100,pO=101,fO=102,B$=103,U$=104,mO=200,Wx=201,gO=202,vO=203,sy=204,Af=205,yO=206,_O=207,bO=208,xO=209,wO=210,kve=211,Vve=212,Gve=213,jve=214,cx=0,px=1,fx=2,sf=3,mx=4,gx=5,vx=6,yx=7,Kb=0,F$=1,z$=2,Os=0,SO=1,TO=2,MO=3,$E=4,$j=5,XE=6,YE=7,$N=300,wd=301,Gc=302,ay=303,oy=304,Cf=306,Jn=1e3,gr=1001,cf=1002,gt=1003,EO=1004,ld=1005,nt=1006,ly=1007,Dn=1008,Hve=1008,zr=1009,Rf=1010,Pf=1011,Ah=1012,Ns=1013,cn=1014,Ht=1015,ni=1016,qx=1017,$x=1018,yd=1020,Xx=35902,Yx=35899,KE=1021,_g=1022,mn=1023,Yl=1026,Ch=1027,Us=1028,pf=1029,bs=1030,ff=1031,XN=1032,kg=1033,Df=33776,Nf=33777,If=33778,Of=33779,Kx=35840,Zx=35841,Qx=35842,Jx=35843,wy=36196,Sy=37492,Ty=37496,My=37488,Ey=37489,Lf=37490,Ay=37491,Cy=37808,Ry=37809,Py=37810,Dy=37811,Ny=37812,Iy=37813,Oy=37814,Ly=37815,By=37816,Uy=37817,Fy=37818,zy=37819,ky=37820,Vy=37821,Gy=36492,jy=36494,Hy=36495,Wy=36283,qy=36284,Bf=36285,$y=36286,Xj=2200,Yj=2201,AO=2202,sS=2300,cC=2301,pC=2302,o0=2400,l0=2401,aS=2402,vc=3200,Wve=3201,cu=0,k$=1,fl="",Yi="srgb",Sd="srgb-linear",hy="linear",Ot="srgb",YN="",Kj="rg",qve="ga",$ve=0,Qm=7680,Xve=7681,Yve=7682,Kve=7683,Zve=34055,Qve=34056,Jve=5386,eye=512,tye=513,iye=514,rye=515,nye=516,sye=517,aye=518,KN=519,CO=512,oE=513,RO=514,af=515,Zb=516,PO=517,Sc=518,DO=519,Wv=35044,_d=35048,NO="300 es",xo=2e3,$l=2001,Zu={COMPUTE:"compute",RENDER:"render"},Jm={TEXTURE_COMPARE:"depthTextureCompare"},oye={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array},Zj={},Xy=null,IO={[cx]:px,[fx]:vx,[mx]:yx,[sf]:gx,[px]:cx,[vx]:fx,[yx]:mx,[gx]:sf},xs=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){let i=this._listeners;return i!==void 0&&i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){let i=this._listeners;if(i===void 0)return;let r=i[e];if(r!==void 0){let n=r.indexOf(t);n!==-1&&r.splice(n,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let i=t[e.type];if(i!==void 0){e.target=this;let r=i.slice(0);for(let n=0,s=r.length;n<s;n++)r[n].call(this,e);e.target=null}}},co=["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"],Qj=1234567,wb=Math.PI/180,Sb=180/Math.PI,ht={DEG2RAD:wb,RAD2DEG:Sb,generateUUID:kh,clamp:Li,euclideanModulo:Gj,mapLinear:eDe,inverseLerp:tDe,lerp:lM,damp:iDe,pingpong:rDe,smoothstep:nDe,smootherstep:sDe,randInt:aDe,randFloat:oDe,randFloatSpread:lDe,seededRandom:hDe,degToRad:uDe,radToDeg:dDe,isPowerOfTwo:cDe,ceilPowerOfTwo:pDe,floorPowerOfTwo:fDe,setQuaternionFromProperEuler:mDe,normalize:Ji,denormalize:sl},sU=class{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("THREE.Vector2: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Li(this.x,e.x,t.x),this.y=Li(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Li(this.x,e,t),this.y=Li(this.y,e,t),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Li(i,e,t))}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(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.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(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let i=this.dot(e)/t;return Math.acos(Li(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let i=Math.cos(t),r=Math.sin(t),n=this.x-e.x,s=this.y-e.y;return this.x=n*i-s*r+e.x,this.y=n*r+s*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},J=sU,sU.prototype.isVector2=!0,jt=class{constructor(e=0,t=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=r}static slerpFlat(e,t,i,r,n,s,a){let o=i[r+0],l=i[r+1],u=i[r+2],h=i[r+3],d=n[s+0],c=n[s+1],p=n[s+2],f=n[s+3];if(h!==f||o!==d||l!==c||u!==p){let m=o*d+l*c+u*p+h*f;m<0&&(d=-d,c=-c,p=-p,f=-f,m=-m);let g=1-a;if(m<.9995){let v=Math.acos(m),y=Math.sin(v);g=Math.sin(g*v)/y,o=o*g+d*(a=Math.sin(a*v)/y),l=l*g+c*a,u=u*g+p*a,h=h*g+f*a}else{o=o*g+d*a,l=l*g+c*a,u=u*g+p*a,h=h*g+f*a;let v=1/Math.sqrt(o*o+l*l+u*u+h*h);o*=v,l*=v,u*=v,h*=v}}e[t]=o,e[t+1]=l,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,i,r,n,s){let a=i[r],o=i[r+1],l=i[r+2],u=i[r+3],h=n[s],d=n[s+1],c=n[s+2],p=n[s+3];return e[t]=a*p+u*h+o*c-l*d,e[t+1]=o*p+u*d+l*h-a*c,e[t+2]=l*p+u*c+a*d-o*h,e[t+3]=u*p-a*h-o*d-l*c,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let i=e._x,r=e._y,n=e._z,s=e._order,a=Math.cos,o=Math.sin,l=a(i/2),u=a(r/2),h=a(n/2),d=o(i/2),c=o(r/2),p=o(n/2);switch(s){case"XYZ":this._x=d*u*h+l*c*p,this._y=l*c*h-d*u*p,this._z=l*u*p+d*c*h,this._w=l*u*h-d*c*p;break;case"YXZ":this._x=d*u*h+l*c*p,this._y=l*c*h-d*u*p,this._z=l*u*p-d*c*h,this._w=l*u*h+d*c*p;break;case"ZXY":this._x=d*u*h-l*c*p,this._y=l*c*h+d*u*p,this._z=l*u*p+d*c*h,this._w=l*u*h-d*c*p;break;case"ZYX":this._x=d*u*h-l*c*p,this._y=l*c*h+d*u*p,this._z=l*u*p-d*c*h,this._w=l*u*h+d*c*p;break;case"YZX":this._x=d*u*h+l*c*p,this._y=l*c*h+d*u*p,this._z=l*u*p-d*c*h,this._w=l*u*h-d*c*p;break;case"XZY":this._x=d*u*h-l*c*p,this._y=l*c*h-d*u*p,this._z=l*u*p+d*c*h,this._w=l*u*h+d*c*p;break;default:it("Quaternion: .setFromEuler() encountered an unknown order: "+s)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,i=t[0],r=t[4],n=t[8],s=t[1],a=t[5],o=t[9],l=t[2],u=t[6],h=t[10],d=i+a+h;if(d>0){let c=.5/Math.sqrt(d+1);this._w=.25/c,this._x=(u-o)*c,this._y=(n-l)*c,this._z=(s-r)*c}else if(i>a&&i>h){let c=2*Math.sqrt(1+i-a-h);this._w=(u-o)/c,this._x=.25*c,this._y=(r+s)/c,this._z=(n+l)/c}else if(a>h){let c=2*Math.sqrt(1+a-i-h);this._w=(n-l)/c,this._x=(r+s)/c,this._y=.25*c,this._z=(o+u)/c}else{let c=2*Math.sqrt(1+h-i-a);this._w=(s-r)/c,this._x=(n+l)/c,this._y=(o+u)/c,this._z=.25*c}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<1e-8?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Li(this.dot(e),-1,1)))}rotateTowards(e,t){let i=this.angleTo(e);if(i===0)return this;let r=Math.min(1,t/i);return this.slerp(e,r),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(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._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 e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let i=e._x,r=e._y,n=e._z,s=e._w,a=t._x,o=t._y,l=t._z,u=t._w;return this._x=i*u+s*a+r*l-n*o,this._y=r*u+s*o+n*a-i*l,this._z=n*u+s*l+i*o-r*a,this._w=s*u-i*a-r*o-n*l,this._onChangeCallback(),this}slerp(e,t){let i=e._x,r=e._y,n=e._z,s=e._w,a=this.dot(e);a<0&&(i=-i,r=-r,n=-n,s=-s,a=-a);let o=1-t;if(a<.9995){let l=Math.acos(a),u=Math.sin(l);o=Math.sin(o*l)/u,t=Math.sin(t*l)/u,this._x=this._x*o+i*t,this._y=this._y*o+r*t,this._z=this._z*o+n*t,this._w=this._w*o+s*t,this._onChangeCallback()}else this._x=this._x*o+i*t,this._y=this._y*o+r*t,this._z=this._z*o+n*t,this._w=this._w*o+s*t,this.normalize();return this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),r=Math.sqrt(1-i),n=Math.sqrt(i);return this.set(r*Math.sin(e),r*Math.cos(e),n*Math.sin(t),n*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},aU=class{constructor(e=0,t=0,i=0){this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("THREE.Vector3: index is out of range: "+e)}return this}getComponent(e){switch(e){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: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(oU.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(oU.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,i=this.y,r=this.z,n=e.elements;return this.x=n[0]*t+n[3]*i+n[6]*r,this.y=n[1]*t+n[4]*i+n[7]*r,this.z=n[2]*t+n[5]*i+n[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,i=this.y,r=this.z,n=e.elements,s=1/(n[3]*t+n[7]*i+n[11]*r+n[15]);return this.x=(n[0]*t+n[4]*i+n[8]*r+n[12])*s,this.y=(n[1]*t+n[5]*i+n[9]*r+n[13])*s,this.z=(n[2]*t+n[6]*i+n[10]*r+n[14])*s,this}applyQuaternion(e){let t=this.x,i=this.y,r=this.z,n=e.x,s=e.y,a=e.z,o=e.w,l=2*(s*r-a*i),u=2*(a*t-n*r),h=2*(n*i-s*t);return this.x=t+o*l+s*h-a*u,this.y=i+o*u+a*l-n*h,this.z=r+o*h+n*u-s*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,i=this.y,r=this.z,n=e.elements;return this.x=n[0]*t+n[4]*i+n[8]*r,this.y=n[1]*t+n[5]*i+n[9]*r,this.z=n[2]*t+n[6]*i+n[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Li(this.x,e.x,t.x),this.y=Li(this.y,e.y,t.y),this.z=Li(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Li(this.x,e,t),this.y=Li(this.y,e,t),this.z=Li(this.z,e,t),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Li(i,e,t))}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(e){return this.x*e.x+this.y*e.y+this.z*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let i=e.x,r=e.y,n=e.z,s=t.x,a=t.y,o=t.z;return this.x=r*o-n*a,this.y=n*s-i*o,this.z=i*a-r*s,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return fC.copy(this).projectOnVector(e),this.sub(fC)}reflect(e){return this.sub(fC.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let i=this.dot(e)/t;return Math.acos(Li(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){let r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=2*Math.random()-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},P=aU,aU.prototype.isVector3=!0,fC=new P,oU=new jt,hi=qZ=class{constructor(e,t,i,r,n,s,a,o,l){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,r,n,s,a,o,l)}set(e,t,i,r,n,s,a,o,l){let u=this.elements;return u[0]=e,u[1]=r,u[2]=a,u[3]=t,u[4]=n,u[5]=o,u[6]=i,u[7]=s,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,r=t.elements,n=this.elements,s=i[0],a=i[3],o=i[6],l=i[1],u=i[4],h=i[7],d=i[2],c=i[5],p=i[8],f=r[0],m=r[3],g=r[6],v=r[1],y=r[4],_=r[7],b=r[2],x=r[5],w=r[8];return n[0]=s*f+a*v+o*b,n[3]=s*m+a*y+o*x,n[6]=s*g+a*_+o*w,n[1]=l*f+u*v+h*b,n[4]=l*m+u*y+h*x,n[7]=l*g+u*_+h*w,n[2]=d*f+c*v+p*b,n[5]=d*m+c*y+p*x,n[8]=d*g+c*_+p*w,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],i=e[1],r=e[2],n=e[3],s=e[4],a=e[5],o=e[6],l=e[7],u=e[8];return t*s*u-t*a*l-i*n*u+i*a*o+r*n*l-r*s*o}invert(){let e=this.elements,t=e[0],i=e[1],r=e[2],n=e[3],s=e[4],a=e[5],o=e[6],l=e[7],u=e[8],h=u*s-a*l,d=a*o-u*n,c=l*n-s*o,p=t*h+i*d+r*c;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);let f=1/p;return e[0]=h*f,e[1]=(r*l-u*i)*f,e[2]=(a*i-r*s)*f,e[3]=d*f,e[4]=(u*t-r*o)*f,e[5]=(r*n-a*t)*f,e[6]=c*f,e[7]=(i*o-l*t)*f,e[8]=(s*t-i*n)*f,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,r,n,s,a){let o=Math.cos(n),l=Math.sin(n);return this.set(i*o,i*l,-i*(o*s+l*a)+s+e,-r*l,r*o,-r*(-l*s+o*a)+a+t,0,0,1),this}scale(e,t){return Sr("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(mC.makeScale(e,t)),this}rotate(e){return Sr("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(mC.makeRotation(-e)),this}translate(e,t){return Sr("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(mC.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){let i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}},qZ.prototype.isMatrix3=!0,mC=new hi,lU=new hi().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),hU=new hi().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715),oi=function(){let e={enabled:!1,workingColorSpace:Sd,spaces:{},convert:function(n,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===Ot&&(n.r=ep(n.r),n.g=ep(n.g),n.b=ep(n.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(n.applyMatrix3(this.spaces[s].toXYZ),n.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===Ot&&(n.r=S1(n.r),n.g=S1(n.g),n.b=S1(n.b))),n},workingToColorSpace:function(n,s){return this.convert(n,this.workingColorSpace,s)},colorSpaceToWorking:function(n,s){return this.convert(n,s,this.workingColorSpace)},getPrimaries:function(n){return this.spaces[n].primaries},getTransfer:function(n){return n===fl?hy:this.spaces[n].transfer},getToneMappingMode:function(n){return this.spaces[n].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(n,s=this.workingColorSpace){return n.fromArray(this.spaces[s].luminanceCoefficients)},define:function(n){Object.assign(this.spaces,n)},_getMatrix:function(n,s,a){return n.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(n){return this.spaces[n].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(n=this.workingColorSpace){return this.spaces[n].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(n,s){return Sr("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),e.workingToColorSpace(n,s)},toWorkingColorSpace:function(n,s){return Sr("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),e.colorSpaceToWorking(n,s)}},t=[.64,.33,.3,.6,.15,.06],i=[.2126,.7152,.0722],r=[.3127,.329];return e.define({[Sd]:{primaries:t,whitePoint:r,transfer:hy,toXYZ:lU,fromXYZ:hU,luminanceCoefficients:i,workingColorSpaceConfig:{unpackColorSpace:Yi},outputColorSpaceConfig:{drawingBufferColorSpace:Yi}},[Yi]:{primaries:t,whitePoint:r,transfer:Ot,toXYZ:lU,fromXYZ:hU,luminanceCoefficients:i,outputColorSpaceConfig:{drawingBufferColorSpace:Yi}}}),e}(),lye=class{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let i;if(e instanceof HTMLCanvasElement)i=e;else{T1===void 0&&(T1=aE("canvas")),T1.width=e.width,T1.height=e.height;let r=T1.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),i=T1}return i.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=aE("canvas");t.width=e.width,t.height=e.height;let i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);let r=i.getImageData(0,0,e.width,e.height),n=r.data;for(let s=0;s<n.length;s++)n[s]=255*ep(n[s]/255);return i.putImageData(r,0,0),t}if(e.data){let t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor(255*ep(t[i]/255)):t[i]=ep(t[i]);return{data:t,width:e.width,height:e.height}}return it("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},$Z=0,gC=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:$Z++}),this.uuid=kh(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let i={uuid:this.uuid,url:""},r=this.data;if(r!==null){let n;if(Array.isArray(r)){n=[];for(let s=0,a=r.length;s<a;s++)r[s].isDataTexture?n.push(tU(r[s].image)):n.push(tU(r[s]))}else n=tU(r);i.url=n}return t||(e.images[this.uuid]=i),i}},XZ=0,vC=new P,(Pi=class extends xs{constructor(e=Pi.DEFAULT_IMAGE,t=Pi.DEFAULT_MAPPING,i=gr,r=gr,n=nt,s=Dn,a=mn,o=zr,l=Pi.DEFAULT_ANISOTROPY,u=fl){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:XZ++}),this.uuid=kh(),this.name="",this.source=new gC(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=n,this.minFilter=s,this.anisotropy=l,this.format=a,this.internalFormat=null,this.type=o,this.offset=new J(0,0),this.repeat=new J(1,1),this.center=new J(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new hi,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(vC).x}get height(){return this.source.getSize(vC).y}get depth(){return this.source.getSize(vC).z}get image(){return this.source.data}set image(e){this.source.data=e}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(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let i=e[t];if(i===void 0){it(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];r!==void 0?r&&i&&r.isVector2&&i.isVector2||r&&i&&r.isVector3&&i.isVector3||r&&i&&r.isMatrix3&&i.isMatrix3?r.copy(i):this[t]=i:it(`Texture.setValues(): property '${t}' does not exist.`)}}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let i={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).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),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==$N)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Jn:e.x=e.x-Math.floor(e.x);break;case gr:e.x=e.x<0?0:1;break;case cf:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case Jn:e.y=e.y-Math.floor(e.y);break;case gr:e.y=e.y<0?0:1;break;case cf:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}).DEFAULT_IMAGE=null,Pi.DEFAULT_MAPPING=$N,Pi.DEFAULT_ANISOTROPY=1,uU=class{constructor(e=0,t=0,i=0,r=1){this.x=e,this.y=t,this.z=i,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("THREE.Vector4: index is out of range: "+e)}return this}getComponent(e){switch(e){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: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,i=this.y,r=this.z,n=this.w,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*r+s[12]*n,this.y=s[1]*t+s[5]*i+s[9]*r+s[13]*n,this.z=s[2]*t+s[6]*i+s[10]*r+s[14]*n,this.w=s[3]*t+s[7]*i+s[11]*r+s[15]*n,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,r,n,s=e.elements,a=s[0],o=s[4],l=s[8],u=s[1],h=s[5],d=s[9],c=s[2],p=s[6],f=s[10];if(Math.abs(o-u)<.01&&Math.abs(l-c)<.01&&Math.abs(d-p)<.01){if(Math.abs(o+u)<.1&&Math.abs(l+c)<.1&&Math.abs(d+p)<.1&&Math.abs(a+h+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let g=(a+1)/2,v=(h+1)/2,y=(f+1)/2,_=(o+u)/4,b=(l+c)/4,x=(d+p)/4;return g>v&&g>y?g<.01?(i=0,r=.707106781,n=.707106781):(i=Math.sqrt(g),r=_/i,n=b/i):v>y?v<.01?(i=.707106781,r=0,n=.707106781):(r=Math.sqrt(v),i=_/r,n=x/r):y<.01?(i=.707106781,r=.707106781,n=0):(n=Math.sqrt(y),i=b/n,r=x/n),this.set(i,r,n,t),this}let m=Math.sqrt((p-d)*(p-d)+(l-c)*(l-c)+(u-o)*(u-o));return Math.abs(m)<.001&&(m=1),this.x=(p-d)/m,this.y=(l-c)/m,this.z=(u-o)/m,this.w=Math.acos((a+h+f-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Li(this.x,e.x,t.x),this.y=Li(this.y,e.y,t.y),this.z=Li(this.z,e.z,t.z),this.w=Li(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Li(this.x,e,t),this.y=Li(this.y,e,t),this.z=Li(this.z,e,t),this.w=Li(this.w,e,t),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Li(i,e,t))}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(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),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}},pt=uU,uU.prototype.isVector4=!0,yi=class extends xs{constructor(e=1,t=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:nt,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=e,this.height=t,this.depth=i.depth,this.scissor=new pt(0,0,e,t),this.scissorTest=!1,this.viewport=new pt(0,0,e,t),this.textures=[];let r={width:e,height:t,depth:i.depth},n=new Pi(r),s=i.count;for(let a=0;a<s;a++)this.textures[a]=n.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(e={}){let t={minFilter:nt,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let i=0;i<this.textures.length;i++)this.textures[i].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let r=0,n=this.textures.length;r<n;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=i,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,i=e.textures.length;t<i;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let r=Object.assign({},e.textures[t].image);this.textures[t].source=new gC(r)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}},yr=class extends yi{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}},v4=class extends Pi{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=gt,this.minFilter=gt,this.wrapR=gr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}},hye=class extends Pi{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=gt,this.minFilter=gt,this.wrapR=gr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},Ve=dU=class{constructor(e,t,i,r,n,s,a,o,l,u,h,d,c,p,f,m){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,r,n,s,a,o,l,u,h,d,c,p,f,m)}set(e,t,i,r,n,s,a,o,l,u,h,d,c,p,f,m){let g=this.elements;return g[0]=e,g[4]=t,g[8]=i,g[12]=r,g[1]=n,g[5]=s,g[9]=a,g[13]=o,g[2]=l,g[6]=u,g[10]=h,g[14]=d,g[3]=c,g[7]=p,g[11]=f,g[15]=m,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 dU().fromArray(this.elements)}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){let t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return this.determinantAffine()===0?(e.set(1,0,0),t.set(0,1,0),i.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this)}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){if(e.determinantAffine()===0)return this.identity();let t=this.elements,i=e.elements,r=1/h0.setFromMatrixColumn(e,0).length(),n=1/h0.setFromMatrixColumn(e,1).length(),s=1/h0.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*n,t[5]=i[5]*n,t[6]=i[6]*n,t[7]=0,t[8]=i[8]*s,t[9]=i[9]*s,t[10]=i[10]*s,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,i=e.x,r=e.y,n=e.z,s=Math.cos(i),a=Math.sin(i),o=Math.cos(r),l=Math.sin(r),u=Math.cos(n),h=Math.sin(n);if(e.order==="XYZ"){let d=s*u,c=s*h,p=a*u,f=a*h;t[0]=o*u,t[4]=-o*h,t[8]=l,t[1]=c+p*l,t[5]=d-f*l,t[9]=-a*o,t[2]=f-d*l,t[6]=p+c*l,t[10]=s*o}else if(e.order==="YXZ"){let d=o*u,c=o*h,p=l*u,f=l*h;t[0]=d+f*a,t[4]=p*a-c,t[8]=s*l,t[1]=s*h,t[5]=s*u,t[9]=-a,t[2]=c*a-p,t[6]=f+d*a,t[10]=s*o}else if(e.order==="ZXY"){let d=o*u,c=o*h,p=l*u,f=l*h;t[0]=d-f*a,t[4]=-s*h,t[8]=p+c*a,t[1]=c+p*a,t[5]=s*u,t[9]=f-d*a,t[2]=-s*l,t[6]=a,t[10]=s*o}else if(e.order==="ZYX"){let d=s*u,c=s*h,p=a*u,f=a*h;t[0]=o*u,t[4]=p*l-c,t[8]=d*l+f,t[1]=o*h,t[5]=f*l+d,t[9]=c*l-p,t[2]=-l,t[6]=a*o,t[10]=s*o}else if(e.order==="YZX"){let d=s*o,c=s*l,p=a*o,f=a*l;t[0]=o*u,t[4]=f-d*h,t[8]=p*h+c,t[1]=h,t[5]=s*u,t[9]=-a*u,t[2]=-l*u,t[6]=c*h+p,t[10]=d-f*h}else if(e.order==="XZY"){let d=s*o,c=s*l,p=a*o,f=a*l;t[0]=o*u,t[4]=-h,t[8]=l*u,t[1]=d*h+f,t[5]=s*u,t[9]=c*h-p,t[2]=p*h-c,t[6]=a*u,t[10]=f*h+d}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(YZ,e,KZ)}lookAt(e,t,i){let r=this.elements;return Rl.subVectors(e,t),Rl.lengthSq()===0&&(Rl.z=1),Rl.normalize(),tp.crossVectors(i,Rl),tp.lengthSq()===0&&(Math.abs(i.z)===1?Rl.x+=1e-4:Rl.z+=1e-4,Rl.normalize(),tp.crossVectors(i,Rl)),tp.normalize(),oS.crossVectors(Rl,tp),r[0]=tp.x,r[4]=oS.x,r[8]=Rl.x,r[1]=tp.y,r[5]=oS.y,r[9]=Rl.y,r[2]=tp.z,r[6]=oS.z,r[10]=Rl.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,r=t.elements,n=this.elements,s=i[0],a=i[4],o=i[8],l=i[12],u=i[1],h=i[5],d=i[9],c=i[13],p=i[2],f=i[6],m=i[10],g=i[14],v=i[3],y=i[7],_=i[11],b=i[15],x=r[0],w=r[4],S=r[8],M=r[12],T=r[1],E=r[5],A=r[9],R=r[13],N=r[2],D=r[6],O=r[10],z=r[14],U=r[3],G=r[7],j=r[11],K=r[15];return n[0]=s*x+a*T+o*N+l*U,n[4]=s*w+a*E+o*D+l*G,n[8]=s*S+a*A+o*O+l*j,n[12]=s*M+a*R+o*z+l*K,n[1]=u*x+h*T+d*N+c*U,n[5]=u*w+h*E+d*D+c*G,n[9]=u*S+h*A+d*O+c*j,n[13]=u*M+h*R+d*z+c*K,n[2]=p*x+f*T+m*N+g*U,n[6]=p*w+f*E+m*D+g*G,n[10]=p*S+f*A+m*O+g*j,n[14]=p*M+f*R+m*z+g*K,n[3]=v*x+y*T+_*N+b*U,n[7]=v*w+y*E+_*D+b*G,n[11]=v*S+y*A+_*O+b*j,n[15]=v*M+y*R+_*z+b*K,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],i=e[4],r=e[8],n=e[12],s=e[1],a=e[5],o=e[9],l=e[13],u=e[2],h=e[6],d=e[10],c=e[14],p=e[3],f=e[7],m=e[11],g=e[15],v=o*c-l*d,y=a*c-l*h,_=a*d-o*h,b=s*c-l*u,x=s*d-o*u,w=s*h-a*u;return t*(f*v-m*y+g*_)-i*(p*v-m*b+g*x)+r*(p*y-f*b+g*w)-n*(p*_-f*x+m*w)}determinantAffine(){let e=this.elements,t=e[0],i=e[4],r=e[8],n=e[1],s=e[5],a=e[9],o=e[2],l=e[6],u=e[10];return t*(s*u-a*l)-i*(n*u-a*o)+r*(n*l-s*o)}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(e,t,i){let r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){let e=this.elements,t=e[0],i=e[1],r=e[2],n=e[3],s=e[4],a=e[5],o=e[6],l=e[7],u=e[8],h=e[9],d=e[10],c=e[11],p=e[12],f=e[13],m=e[14],g=e[15],v=t*a-i*s,y=t*o-r*s,_=t*l-n*s,b=i*o-r*a,x=i*l-n*a,w=r*l-n*o,S=u*f-h*p,M=u*m-d*p,T=u*g-c*p,E=h*m-d*f,A=h*g-c*f,R=d*g-c*m,N=v*R-y*A+_*E+b*T-x*M+w*S;if(N===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let D=1/N;return e[0]=(a*R-o*A+l*E)*D,e[1]=(r*A-i*R-n*E)*D,e[2]=(f*w-m*x+g*b)*D,e[3]=(d*x-h*w-c*b)*D,e[4]=(o*T-s*R-l*M)*D,e[5]=(t*R-r*T+n*M)*D,e[6]=(m*_-p*w-g*y)*D,e[7]=(u*w-d*_+c*y)*D,e[8]=(s*A-a*T+l*S)*D,e[9]=(i*T-t*A-n*S)*D,e[10]=(p*x-f*_+g*v)*D,e[11]=(h*_-u*x-c*v)*D,e[12]=(a*M-s*E-o*S)*D,e[13]=(t*E-i*M+r*S)*D,e[14]=(f*y-p*b-m*v)*D,e[15]=(u*b-h*y+d*v)*D,this}scale(e){let t=this.elements,i=e.x,r=e.y,n=e.z;return t[0]*=i,t[4]*=r,t[8]*=n,t[1]*=i,t[5]*=r,t[9]*=n,t[2]*=i,t[6]*=r,t[10]*=n,t[3]*=i,t[7]*=r,t[11]*=n,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let i=Math.cos(t),r=Math.sin(t),n=1-i,s=e.x,a=e.y,o=e.z,l=n*s,u=n*a;return this.set(l*s+i,l*a-r*o,l*o+r*a,0,l*a+r*o,u*a+i,u*o-r*s,0,l*o-r*a,u*o+r*s,n*o*o+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,n,s){return this.set(1,i,n,0,e,1,s,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){let r=this.elements,n=t._x,s=t._y,a=t._z,o=t._w,l=n+n,u=s+s,h=a+a,d=n*l,c=n*u,p=n*h,f=s*u,m=s*h,g=a*h,v=o*l,y=o*u,_=o*h,b=i.x,x=i.y,w=i.z;return r[0]=(1-(f+g))*b,r[1]=(c+_)*b,r[2]=(p-y)*b,r[3]=0,r[4]=(c-_)*x,r[5]=(1-(d+g))*x,r[6]=(m+v)*x,r[7]=0,r[8]=(p+y)*w,r[9]=(m-v)*w,r[10]=(1-(d+f))*w,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){let r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];let n=this.determinantAffine();if(n===0)return i.set(1,1,1),t.identity(),this;let s=h0.set(r[0],r[1],r[2]).length(),a=h0.set(r[4],r[5],r[6]).length(),o=h0.set(r[8],r[9],r[10]).length();n<0&&(s=-s),Vh.copy(this);let l=1/s,u=1/a,h=1/o;return Vh.elements[0]*=l,Vh.elements[1]*=l,Vh.elements[2]*=l,Vh.elements[4]*=u,Vh.elements[5]*=u,Vh.elements[6]*=u,Vh.elements[8]*=h,Vh.elements[9]*=h,Vh.elements[10]*=h,t.setFromRotationMatrix(Vh),i.x=s,i.y=a,i.z=o,this}makePerspective(e,t,i,r,n,s,a=xo,o=!1){let l,u,h=this.elements,d=2*n/(t-e),c=2*n/(i-r),p=(t+e)/(t-e),f=(i+r)/(i-r);if(o)l=n/(s-n),u=s*n/(s-n);else if(a===xo)l=-(s+n)/(s-n),u=-2*s*n/(s-n);else{if(a!==$l)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);l=-s/(s-n),u=-s*n/(s-n)}return h[0]=d,h[4]=0,h[8]=p,h[12]=0,h[1]=0,h[5]=c,h[9]=f,h[13]=0,h[2]=0,h[6]=0,h[10]=l,h[14]=u,h[3]=0,h[7]=0,h[11]=-1,h[15]=0,this}makeOrthographic(e,t,i,r,n,s,a=xo,o=!1){let l,u,h=this.elements,d=2/(t-e),c=2/(i-r),p=-(t+e)/(t-e),f=-(i+r)/(i-r);if(o)l=1/(s-n),u=s/(s-n);else if(a===xo)l=-2/(s-n),u=-(s+n)/(s-n);else{if(a!==$l)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);l=-1/(s-n),u=-n/(s-n)}return h[0]=d,h[4]=0,h[8]=0,h[12]=p,h[1]=0,h[5]=c,h[9]=0,h[13]=f,h[2]=0,h[6]=0,h[10]=l,h[14]=u,h[3]=0,h[7]=0,h[11]=0,h[15]=1,this}equals(e){let t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){let i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}},dU.prototype.isMatrix4=!0,h0=new P,Vh=new Ve,YZ=new P(0,0,0),KZ=new P(1,1,1),tp=new P,oS=new P,Rl=new P,cU=new Ve,pU=new jt,(Kr=class{constructor(e=0,t=0,i=0,r=Kr.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,r=this._order){return this._x=e,this._y=t,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){let r=e.elements,n=r[0],s=r[4],a=r[8],o=r[1],l=r[5],u=r[9],h=r[2],d=r[6],c=r[10];switch(t){case"XYZ":this._y=Math.asin(Li(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,c),this._z=Math.atan2(-s,n)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Li(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,c),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-h,n),this._z=0);break;case"ZXY":this._x=Math.asin(Li(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,c),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(o,n));break;case"ZYX":this._y=Math.asin(-Li(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,c),this._z=Math.atan2(o,n)):(this._x=0,this._z=Math.atan2(-s,l));break;case"YZX":this._z=Math.asin(Li(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-h,n)):(this._x=0,this._y=Math.atan2(a,c));break;case"XZY":this._z=Math.asin(-Li(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(a,n)):(this._x=Math.atan2(-u,c),this._y=0);break;default:it("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return cU.makeRotationFromQuaternion(e),this.setFromRotationMatrix(cU,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return pU.setFromEuler(this),this.setFromQuaternion(pU,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}).DEFAULT_ORDER="XYZ",ZN=class{constructor(){this.mask=1}set(e){this.mask=1<<e>>>0}enable(e){this.mask|=1<<e}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e}disable(e){this.mask&=~(1<<e)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return!!(this.mask&1<<e)}},ZZ=0,fU=new P,u0=new jt,Ud=new Ve,lS=new P,M1=new P,QZ=new P,JZ=new jt,mU=new P(1,0,0),gU=new P(0,1,0),vU=new P(0,0,1),yU={type:"added"},eQ={type:"removed"},d0={type:"childadded",child:null},yC={type:"childremoved",child:null},(un=class extends xs{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:ZZ++}),this.uuid=kh(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=un.DEFAULT_UP.clone();let e=new P,t=new Kr,i=new jt,r=new P(1,1,1);t._onChange(function(){i.setFromEuler(t,!1)}),i._onChange(function(){t.setFromQuaternion(i,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new Ve},normalMatrix:{value:new hi}}),this.matrix=new Ve,this.matrixWorld=new Ve,this.matrixAutoUpdate=un.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=un.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new ZN,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(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return u0.setFromAxisAngle(e,t),this.quaternion.multiply(u0),this}rotateOnWorldAxis(e,t){return u0.setFromAxisAngle(e,t),this.quaternion.premultiply(u0),this}rotateX(e){return this.rotateOnAxis(mU,e)}rotateY(e){return this.rotateOnAxis(gU,e)}rotateZ(e){return this.rotateOnAxis(vU,e)}translateOnAxis(e,t){return fU.copy(e).applyQuaternion(this.quaternion),this.position.add(fU.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(mU,e)}translateY(e){return this.translateOnAxis(gU,e)}translateZ(e){return this.translateOnAxis(vU,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Ud.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?lS.copy(e):lS.set(e,t,i);let r=this.parent;this.updateWorldMatrix(!0,!1),M1.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Ud.lookAt(M1,lS,this.up):Ud.lookAt(lS,M1,this.up),this.quaternion.setFromRotationMatrix(Ud),r&&(Ud.extractRotation(r.matrixWorld),u0.setFromRotationMatrix(Ud),this.quaternion.premultiply(u0.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(Xe("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(yU),d0.child=e,this.dispatchEvent(d0),d0.child=null):Xe("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(eQ),yC.child=e,this.dispatchEvent(yC),yC.child=null),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Ud.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Ud.multiply(e.parent.matrixWorld)),e.applyMatrix4(Ud),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(yU),d0.child=e,this.dispatchEvent(d0),d0.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let i=0,r=this.children.length;i<r;i++){let n=this.children[i].getObjectByProperty(e,t);if(n!==void 0)return n}}getObjectsByProperty(e,t,i=[]){this[e]===t&&i.push(this);let r=this.children;for(let n=0,s=r.length;n<s;n++)r[n].getObjectsByProperty(e,t,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(M1,e,QZ),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(M1,JZ,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverseVisible(e)}traverseAncestors(e){let t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let e=this.pivot;if(e!==null){let t=e.x,i=e.y,r=e.z,n=this.matrix.elements;n[12]+=t-n[0]*t-n[4]*i-n[8]*r,n[13]+=i-n[1]*t-n[5]*i-n[9]*r,n[14]+=r-n[2]*t-n[6]*i-n[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].updateMatrixWorld(e)}updateWorldMatrix(e,t,i=!1){let r=this.parent;if(e===!0&&r!==null&&r.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),t===!0){let n=this.children;for(let s=0,a=n.length;s<a;s++)n[s].updateWorldMatrix(!1,!0,i)}}toJSON(e){let t=e===void 0||typeof e=="string",i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let r={};function n(a,o){return a[o.uuid]===void 0&&(a[o.uuid]=o.toJSON(e)),o.uuid}if(r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),this.static!==!1&&(r.static=this.static),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(a=>({...a,boundingBox:a.boundingBox?a.boundingBox.toJSON():void 0,boundingSphere:a.boundingSphere?a.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(a=>({...a})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON())),this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=n(e.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,u=o.length;l<u;l++){let h=o[l];n(e.shapes,h)}else n(e.shapes,o)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(n(e.skeletons,this.skeleton),r.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(n(e.materials,this.material[o]));r.material=a}else r.material=n(e.materials,this.material);if(this.children.length>0){r.children=[];for(let a=0;a<this.children.length;a++)r.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let a=0;a<this.animations.length;a++){let o=this.animations[a];r.animations.push(n(e.animations,o))}}if(t){let a=s(e.geometries),o=s(e.materials),l=s(e.textures),u=s(e.images),h=s(e.shapes),d=s(e.skeletons),c=s(e.animations),p=s(e.nodes);a.length>0&&(i.geometries=a),o.length>0&&(i.materials=o),l.length>0&&(i.textures=l),u.length>0&&(i.images=u),h.length>0&&(i.shapes=h),d.length>0&&(i.skeletons=d),c.length>0&&(i.animations=c),p.length>0&&(i.nodes=p)}return i.object=r,i;function s(a){let o=[];for(let l in a){let u=a[l];delete u.metadata,o.push(u)}return o}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i<e.children.length;i++){let r=e.children[i];this.add(r.clone())}return this}}).DEFAULT_UP=new P(0,1,0),un.DEFAULT_MATRIX_AUTO_UPDATE=!0,un.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0,mw=class extends un{constructor(){super(),this.isGroup=!0,this.type="Group"}},_U={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},ip={h:0,s:0,l:0},hS={h:0,s:0,l:0},ot=class{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){let r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Yi){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,oi.colorSpaceToWorking(this,t),this}setRGB(e,t,i,r=oi.workingColorSpace){return this.r=e,this.g=t,this.b=i,oi.colorSpaceToWorking(this,r),this}setHSL(e,t,i,r=oi.workingColorSpace){if(e=Gj(e,1),t=Li(t,0,1),i=Li(i,0,1),t===0)this.r=this.g=this.b=i;else{let n=i<=.5?i*(1+t):i+t-i*t,s=2*i-n;this.r=iU(s,n,e+1/3),this.g=iU(s,n,e),this.b=iU(s,n,e-1/3)}return oi.colorSpaceToWorking(this,r),this}setStyle(e,t=Yi){function i(n){n!==void 0&&parseFloat(n)<1&&it("Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let n,s=r[1],a=r[2];switch(s){case"rgb":case"rgba":if(n=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(n[4]),this.setRGB(Math.min(255,parseInt(n[1],10))/255,Math.min(255,parseInt(n[2],10))/255,Math.min(255,parseInt(n[3],10))/255,t);if(n=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(n[4]),this.setRGB(Math.min(100,parseInt(n[1],10))/100,Math.min(100,parseInt(n[2],10))/100,Math.min(100,parseInt(n[3],10))/100,t);break;case"hsl":case"hsla":if(n=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(n[4]),this.setHSL(parseFloat(n[1])/360,parseFloat(n[2])/100,parseFloat(n[3])/100,t);break;default:it("Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let n=r[1],s=n.length;if(s===3)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(s===6)return this.setHex(parseInt(n,16),t);it("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Yi){let i=_U[e.toLowerCase()];return i!==void 0?this.setHex(i,t):it("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=ep(e.r),this.g=ep(e.g),this.b=ep(e.b),this}copyLinearToSRGB(e){return this.r=S1(e.r),this.g=S1(e.g),this.b=S1(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Yi){return oi.workingToColorSpace(no.copy(this),e),65536*Math.round(Li(255*no.r,0,255))+256*Math.round(Li(255*no.g,0,255))+Math.round(Li(255*no.b,0,255))}getHexString(e=Yi){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=oi.workingColorSpace){oi.workingToColorSpace(no.copy(this),t);let i,r,n=no.r,s=no.g,a=no.b,o=Math.max(n,s,a),l=Math.min(n,s,a),u=(l+o)/2;if(l===o)i=0,r=0;else{let h=o-l;switch(r=u<=.5?h/(o+l):h/(2-o-l),o){case n:i=(s-a)/h+(s<a?6:0);break;case s:i=(a-n)/h+2;break;case a:i=(n-s)/h+4}i/=6}return e.h=i,e.s=r,e.l=u,e}getRGB(e,t=oi.workingColorSpace){return oi.workingToColorSpace(no.copy(this),t),e.r=no.r,e.g=no.g,e.b=no.b,e}getStyle(e=Yi){oi.workingToColorSpace(no.copy(this),e);let t=no.r,i=no.g,r=no.b;return e!==Yi?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(255*t)},${Math.round(255*i)},${Math.round(255*r)})`}offsetHSL(e,t,i){return this.getHSL(ip),this.setHSL(ip.h+e,ip.s+t,ip.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(ip),e.getHSL(hS);let i=lM(ip.h,hS.h,t),r=lM(ip.s,hS.s,t),n=lM(ip.l,hS.l,t);return this.setHSL(i,r,n),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,i=this.g,r=this.b,n=e.elements;return this.r=n[0]*t+n[3]*i+n[6]*r,this.g=n[1]*t+n[4]*i+n[7]*r,this.b=n[2]*t+n[5]*i+n[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},no=new ot,ot.NAMES=_U,Jj=class{constructor(e,t=1,i=1e3){this.isFog=!0,this.name="",this.color=new ot(e),this.near=t,this.far=i}clone(){return new Jj(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}},Zo=class extends un{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 Kr,this.environmentIntensity=1,this.environmentRotation=new Kr,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}},Gh=new P,Fd=new P,_C=new P,zd=new P,c0=new P,p0=new P,bU=new P,bC=new P,xC=new P,wC=new P,SC=new pt,TC=new pt,MC=new pt,Ls=class{constructor(e=new P,t=new P,i=new P){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,r){r.subVectors(i,t),Gh.subVectors(e,t),r.cross(Gh);let n=r.lengthSq();return n>0?r.multiplyScalar(1/Math.sqrt(n)):r.set(0,0,0)}static getBarycoord(e,t,i,r,n){Gh.subVectors(r,t),Fd.subVectors(i,t),_C.subVectors(e,t);let s=Gh.dot(Gh),a=Gh.dot(Fd),o=Gh.dot(_C),l=Fd.dot(Fd),u=Fd.dot(_C),h=s*l-a*a;if(h===0)return n.set(0,0,0),null;let d=1/h,c=(l*o-a*u)*d,p=(s*u-a*o)*d;return n.set(1-c-p,p,c)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,zd)!==null&&zd.x>=0&&zd.y>=0&&zd.x+zd.y<=1}static getInterpolation(e,t,i,r,n,s,a,o){return this.getBarycoord(e,t,i,r,zd)===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(n,zd.x),o.addScaledVector(s,zd.y),o.addScaledVector(a,zd.z),o)}static getInterpolatedAttribute(e,t,i,r,n,s){return SC.setScalar(0),TC.setScalar(0),MC.setScalar(0),SC.fromBufferAttribute(e,t),TC.fromBufferAttribute(e,i),MC.fromBufferAttribute(e,r),s.setScalar(0),s.addScaledVector(SC,n.x),s.addScaledVector(TC,n.y),s.addScaledVector(MC,n.z),s}static isFrontFacing(e,t,i,r){return Gh.subVectors(i,t),Fd.subVectors(e,t),Gh.cross(Fd).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Gh.subVectors(this.c,this.b),Fd.subVectors(this.a,this.b),.5*Gh.cross(Fd).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Ls.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Ls.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,r,n){return Ls.getInterpolation(e,this.a,this.b,this.c,t,i,r,n)}containsPoint(e){return Ls.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Ls.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let i,r,n=this.a,s=this.b,a=this.c;c0.subVectors(s,n),p0.subVectors(a,n),bC.subVectors(e,n);let o=c0.dot(bC),l=p0.dot(bC);if(o<=0&&l<=0)return t.copy(n);xC.subVectors(e,s);let u=c0.dot(xC),h=p0.dot(xC);if(u>=0&&h<=u)return t.copy(s);let d=o*h-u*l;if(d<=0&&o>=0&&u<=0)return i=o/(o-u),t.copy(n).addScaledVector(c0,i);wC.subVectors(e,a);let c=c0.dot(wC),p=p0.dot(wC);if(p>=0&&c<=p)return t.copy(a);let f=c*l-o*p;if(f<=0&&l>=0&&p<=0)return r=l/(l-p),t.copy(n).addScaledVector(p0,r);let m=u*p-c*h;if(m<=0&&h-u>=0&&c-p>=0)return bU.subVectors(a,s),r=(h-u)/(h-u+(c-p)),t.copy(s).addScaledVector(bU,r);let g=1/(m+f+d);return i=f*g,r=d*g,t.copy(n).addScaledVector(c0,i).addScaledVector(p0,r)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},fn=class{constructor(e=new P(1/0,1/0,1/0),t=new P(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t+=3)this.expandByPoint(jh.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(jh.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let i=jh.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.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(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let i=e.geometry;if(i!==void 0){let n=i.getAttribute("position");if(t===!0&&n!==void 0&&e.isInstancedMesh!==!0)for(let s=0,a=n.count;s<a;s++)e.isMesh===!0?e.getVertexPosition(s,jh):jh.fromBufferAttribute(n,s),jh.applyMatrix4(e.matrixWorld),this.expandByPoint(jh);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),uS.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),uS.copy(i.boundingBox)),uS.applyMatrix4(e.matrixWorld),this.union(uS)}let r=e.children;for(let n=0,s=r.length;n<s;n++)this.expandByObject(r[n],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,jh),jh.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(E1),dS.subVectors(this.max,E1),f0.subVectors(e.a,E1),m0.subVectors(e.b,E1),g0.subVectors(e.c,E1),rp.subVectors(m0,f0),np.subVectors(g0,m0),sm.subVectors(f0,g0);let t=[0,-rp.z,rp.y,0,-np.z,np.y,0,-sm.z,sm.y,rp.z,0,-rp.x,np.z,0,-np.x,sm.z,0,-sm.x,-rp.y,rp.x,0,-np.y,np.x,0,-sm.y,sm.x,0];return!(!rU(t,f0,m0,g0,dS)||(t=[1,0,0,0,1,0,0,0,1],!rU(t,f0,m0,g0,dS)))&&(cS.crossVectors(rp,np),t=[cS.x,cS.y,cS.z],rU(t,f0,m0,g0,dS))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,jh).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(jh).length()),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(kd[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),kd[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),kd[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),kd[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),kd[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),kd[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),kd[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),kd[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(kd)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},kd=[new P,new P,new P,new P,new P,new P,new P,new P],jh=new P,uS=new fn,f0=new P,m0=new P,g0=new P,rp=new P,np=new P,sm=new P,E1=new P,dS=new P,cS=new P,eg=new P,Cc=function(){let e=new ArrayBuffer(4),t=new Float32Array(e),i=new Uint32Array(e),r=new Uint32Array(512),n=new Uint32Array(512);for(let l=0;l<256;++l){let u=l-127;u<-27?(r[l]=0,r[256|l]=32768,n[l]=24,n[256|l]=24):u<-14?(r[l]=1024>>-u-14,r[256|l]=1024>>-u-14|32768,n[l]=-u-1,n[256|l]=-u-1):u<=15?(r[l]=u+15<<10,r[256|l]=u+15<<10|32768,n[l]=13,n[256|l]=13):u<128?(r[l]=31744,r[256|l]=64512,n[l]=24,n[256|l]=24):(r[l]=31744,r[256|l]=64512,n[l]=13,n[256|l]=13)}let s=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let l=1;l<1024;++l){let u=l<<13,h=0;for(;!(8388608&u);)u<<=1,h-=8388608;u&=-8388609,h+=947912704,s[l]=u|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:t,uint32View:i,baseTable:r,shiftTable:n,mantissaTable:s,exponentTable:a,offsetTable:o}}(),bd=class{static toHalfFloat(e){return Cl(e)}static fromHalfFloat(e){return iS(e)}},js=new P,pS=new J,tQ=0,It=class extends xs{constructor(e,t,i=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:tQ++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=Wv,this.updateRanges=[],this.gpuType=Ht,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,n=this.itemSize;r<n;r++)this.array[e+r]=t.array[i+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)pS.fromBufferAttribute(this,t),pS.applyMatrix3(e),this.setXY(t,pS.x,pS.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)js.fromBufferAttribute(this,t),js.applyMatrix3(e),this.setXYZ(t,js.x,js.y,js.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)js.fromBufferAttribute(this,t),js.applyMatrix4(e),this.setXYZ(t,js.x,js.y,js.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)js.fromBufferAttribute(this,t),js.applyNormalMatrix(e),this.setXYZ(t,js.x,js.y,js.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)js.fromBufferAttribute(this,t),js.transformDirection(e),this.setXYZ(t,js.x,js.y,js.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=sl(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=Ji(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=sl(t,this.array)),t}setX(e,t){return this.normalized&&(t=Ji(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=sl(t,this.array)),t}setY(e,t){return this.normalized&&(t=Ji(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=sl(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Ji(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=sl(t,this.array)),t}setW(e,t){return this.normalized&&(t=Ji(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=Ji(t,this.array),i=Ji(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=Ji(t,this.array),i=Ji(i,this.array),r=Ji(r,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,t,i,r,n){return e*=this.itemSize,this.normalized&&(t=Ji(t,this.array),i=Ji(i,this.array),r=Ji(r,this.array),n=Ji(n,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this.array[e+3]=n,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Wv&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}},OO=class extends It{constructor(e,t,i){super(new Uint16Array(e),t,i)}},Uf=class extends It{constructor(e,t,i){super(new Uint32Array(e),t,i)}},e7=class extends It{constructor(e,t,i){super(new Uint16Array(e),t,i),this.isFloat16BufferAttribute=!0}getX(e){let t=iS(this.array[e*this.itemSize]);return this.normalized&&(t=sl(t,this.array)),t}setX(e,t){return this.normalized&&(t=Ji(t,this.array)),this.array[e*this.itemSize]=Cl(t),this}getY(e){let t=iS(this.array[e*this.itemSize+1]);return this.normalized&&(t=sl(t,this.array)),t}setY(e,t){return this.normalized&&(t=Ji(t,this.array)),this.array[e*this.itemSize+1]=Cl(t),this}getZ(e){let t=iS(this.array[e*this.itemSize+2]);return this.normalized&&(t=sl(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Ji(t,this.array)),this.array[e*this.itemSize+2]=Cl(t),this}getW(e){let t=iS(this.array[e*this.itemSize+3]);return this.normalized&&(t=sl(t,this.array)),t}setW(e,t){return this.normalized&&(t=Ji(t,this.array)),this.array[e*this.itemSize+3]=Cl(t),this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=Ji(t,this.array),i=Ji(i,this.array)),this.array[e+0]=Cl(t),this.array[e+1]=Cl(i),this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=Ji(t,this.array),i=Ji(i,this.array),r=Ji(r,this.array)),this.array[e+0]=Cl(t),this.array[e+1]=Cl(i),this.array[e+2]=Cl(r),this}setXYZW(e,t,i,r,n){return e*=this.itemSize,this.normalized&&(t=Ji(t,this.array),i=Ji(i,this.array),r=Ji(r,this.array),n=Ji(n,this.array)),this.array[e+0]=Cl(t),this.array[e+1]=Cl(i),this.array[e+2]=Cl(r),this.array[e+3]=Cl(n),this}},Et=class extends It{constructor(e,t,i){super(new Float32Array(e),t,i)}},iQ=new fn,A1=new P,EC=new P,qa=class{constructor(e=new P,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let i=this.center;t!==void 0?i.copy(t):iQ.setFromPoints(e).getCenter(i);let r=0;for(let n=0,s=e.length;n<s;n++)r=Math.max(r,i.distanceToSquared(e[n]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let i=this.center.distanceToSquared(e);return t.copy(e),i>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;A1.subVectors(e,this.center);let t=A1.lengthSq();if(t>this.radius*this.radius){let i=Math.sqrt(t),r=.5*(i-this.radius);this.center.addScaledVector(A1,r/i),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(EC.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(A1.copy(e.center).add(EC)),this.expandByPoint(A1.copy(e.center).sub(EC))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},rQ=0,rh=new Ve,AC=new un,v0=new P,Pl=new fn,C1=new fn,ma=new P,At=class extends xs{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:rQ++}),this.uuid=kh(),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(e){return Array.isArray(e)?this.index=new(function(t){for(let i=t.length-1;i>=0;--i)if(t[i]>=65535)return!0;return!1}(e)?Uf:OO)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let i=this.attributes.normal;if(i!==void 0){let n=new hi().getNormalMatrix(e);i.applyNormalMatrix(n),i.needsUpdate=!0}let r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(e){return rh.makeRotationFromQuaternion(e),this.applyMatrix4(rh),this}rotateX(e){return rh.makeRotationX(e),this.applyMatrix4(rh),this}rotateY(e){return rh.makeRotationY(e),this.applyMatrix4(rh),this}rotateZ(e){return rh.makeRotationZ(e),this.applyMatrix4(rh),this}translate(e,t,i){return rh.makeTranslation(e,t,i),this.applyMatrix4(rh),this}scale(e,t,i){return rh.makeScale(e,t,i),this.applyMatrix4(rh),this}lookAt(e){return AC.lookAt(e),AC.updateMatrix(),this.applyMatrix4(AC.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(v0).negate(),this.translate(v0.x,v0.y,v0.z),this}setFromPoints(e){let t=this.getAttribute("position");if(t===void 0){let i=[];for(let r=0,n=e.length;r<n;r++){let s=e[r];i.push(s.x,s.y,s.z||0)}this.setAttribute("position",new Et(i,3))}else{let i=Math.min(e.length,t.count);for(let r=0;r<i;r++){let n=e[r];t.setXYZ(r,n.x,n.y,n.z||0)}e.length>t.count&&it("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new fn);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return Xe("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),void this.boundingBox.set(new P(-1/0,-1/0,-1/0),new P(1/0,1/0,1/0));if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,r=t.length;i<r;i++){let n=t[i];Pl.setFromBufferAttribute(n),this.morphTargetsRelative?(ma.addVectors(this.boundingBox.min,Pl.min),this.boundingBox.expandByPoint(ma),ma.addVectors(this.boundingBox.max,Pl.max),this.boundingBox.expandByPoint(ma)):(this.boundingBox.expandByPoint(Pl.min),this.boundingBox.expandByPoint(Pl.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Xe('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 qa);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return Xe("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),void this.boundingSphere.set(new P,1/0);if(e){let i=this.boundingSphere.center;if(Pl.setFromBufferAttribute(e),t)for(let n=0,s=t.length;n<s;n++){let a=t[n];C1.setFromBufferAttribute(a),this.morphTargetsRelative?(ma.addVectors(Pl.min,C1.min),Pl.expandByPoint(ma),ma.addVectors(Pl.max,C1.max),Pl.expandByPoint(ma)):(Pl.expandByPoint(C1.min),Pl.expandByPoint(C1.max))}Pl.getCenter(i);let r=0;for(let n=0,s=e.count;n<s;n++)ma.fromBufferAttribute(e,n),r=Math.max(r,i.distanceToSquared(ma));if(t)for(let n=0,s=t.length;n<s;n++){let a=t[n],o=this.morphTargetsRelative;for(let l=0,u=a.count;l<u;l++)ma.fromBufferAttribute(a,l),o&&(v0.fromBufferAttribute(e,l),ma.add(v0)),r=Math.max(r,i.distanceToSquared(ma))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&Xe('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0)return void Xe("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");let i=t.position,r=t.normal,n=t.uv,s=this.getAttribute("tangent");(s===void 0||s.count!==i.count)&&(s=new It(new Float32Array(4*i.count),4),this.setAttribute("tangent",s));let a=[],o=[];for(let S=0;S<i.count;S++)a[S]=new P,o[S]=new P;let l=new P,u=new P,h=new P,d=new J,c=new J,p=new J,f=new P,m=new P;function g(S,M,T){l.fromBufferAttribute(i,S),u.fromBufferAttribute(i,M),h.fromBufferAttribute(i,T),d.fromBufferAttribute(n,S),c.fromBufferAttribute(n,M),p.fromBufferAttribute(n,T),u.sub(l),h.sub(l),c.sub(d),p.sub(d);let E=1/(c.x*p.y-p.x*c.y);!isFinite(E)||(f.copy(u).multiplyScalar(p.y).addScaledVector(h,-c.y).multiplyScalar(E),m.copy(h).multiplyScalar(c.x).addScaledVector(u,-p.x).multiplyScalar(E),a[S].add(f),a[M].add(f),a[T].add(f),o[S].add(m),o[M].add(m),o[T].add(m))}let v=this.groups;v.length===0&&(v=[{start:0,count:e.count}]);for(let S=0,M=v.length;S<M;++S){let T=v[S],E=T.start;for(let A=E,R=E+T.count;A<R;A+=3)g(e.getX(A+0),e.getX(A+1),e.getX(A+2))}let y=new P,_=new P,b=new P,x=new P;function w(S){b.fromBufferAttribute(r,S),x.copy(b);let M=a[S];y.copy(M),y.sub(b.multiplyScalar(b.dot(M))).normalize(),_.crossVectors(x,M);let T=_.dot(o[S])<0?-1:1;s.setXYZW(S,y.x,y.y,y.z,T)}for(let S=0,M=v.length;S<M;++S){let T=v[S],E=T.start;for(let A=E,R=E+T.count;A<R;A+=3)w(e.getX(A+0)),w(e.getX(A+1)),w(e.getX(A+2))}this._transformed=!0}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0||i.count!==t.count)i=new It(new Float32Array(3*t.count),3),this.setAttribute("normal",i);else for(let d=0,c=i.count;d<c;d++)i.setXYZ(d,0,0,0);let r=new P,n=new P,s=new P,a=new P,o=new P,l=new P,u=new P,h=new P;if(e)for(let d=0,c=e.count;d<c;d+=3){let p=e.getX(d+0),f=e.getX(d+1),m=e.getX(d+2);r.fromBufferAttribute(t,p),n.fromBufferAttribute(t,f),s.fromBufferAttribute(t,m),u.subVectors(s,n),h.subVectors(r,n),u.cross(h),a.fromBufferAttribute(i,p),o.fromBufferAttribute(i,f),l.fromBufferAttribute(i,m),a.add(u),o.add(u),l.add(u),i.setXYZ(p,a.x,a.y,a.z),i.setXYZ(f,o.x,o.y,o.z),i.setXYZ(m,l.x,l.y,l.z)}else for(let d=0,c=t.count;d<c;d+=3)r.fromBufferAttribute(t,d+0),n.fromBufferAttribute(t,d+1),s.fromBufferAttribute(t,d+2),u.subVectors(s,n),h.subVectors(r,n),u.cross(h),i.setXYZ(d+0,u.x,u.y,u.z),i.setXYZ(d+1,u.x,u.y,u.z),i.setXYZ(d+2,u.x,u.y,u.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)ma.fromBufferAttribute(e,t),ma.normalize(),e.setXYZ(t,ma.x,ma.y,ma.z)}toNonIndexed(){function e(a,o){let l=a.array,u=a.itemSize,h=a.normalized,d=new l.constructor(o.length*u),c=0,p=0;for(let f=0,m=o.length;f<m;f++){c=a.isInterleavedBufferAttribute?o[f]*a.data.stride+a.offset:o[f]*u;for(let g=0;g<u;g++)d[p++]=l[c++]}return new It(d,u,h)}if(this.index===null)return it("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new At,i=this.index.array,r=this.attributes;for(let a in r){let o=e(r[a],i);t.setAttribute(a,o)}let n=this.morphAttributes;for(let a in n){let o=[],l=n[a];for(let u=0,h=l.length;u<h;u++){let d=e(l[u],i);o.push(d)}t.morphAttributes[a]=o}t.morphTargetsRelative=this.morphTargetsRelative;let s=this.groups;for(let a=0,o=s.length;a<o;a++){let l=s[a];t.addGroup(l.start,l.count,l.materialIndex)}return t}toJSON(){let e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){let o=this.parameters;for(let l in o)o[l]!==void 0&&(e[l]=o[l]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let i=this.attributes;for(let o in i){let l=i[o];e.data.attributes[o]=l.toJSON(e.data)}let r={},n=!1;for(let o in this.morphAttributes){let l=this.morphAttributes[o],u=[];for(let h=0,d=l.length;h<d;h++){let c=l[h];u.push(c.toJSON(e.data))}u.length>0&&(r[o]=u,n=!0)}n&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let s=this.groups;s.length>0&&(e.data.groups=JSON.parse(JSON.stringify(s)));let a=this.boundingSphere;return a!==null&&(e.data.boundingSphere=a.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let i=e.index;i!==null&&this.setIndex(i.clone());let r=e.attributes;for(let l in r){let u=r[l];this.setAttribute(l,u.clone(t))}let n=e.morphAttributes;for(let l in n){let u=[],h=n[l];for(let d=0,c=h.length;d<c;d++)u.push(h[d].clone(t));this.morphAttributes[l]=u}this.morphTargetsRelative=e.morphTargetsRelative;let s=e.groups;for(let l=0,u=s.length;l<u;l++){let h=s[l];this.addGroup(h.start,h.count,h.materialIndex)}let a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());let o=e.boundingSphere;return o!==null&&(this.boundingSphere=o.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}},Qb=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Wv,this.updateRanges=[],this.version=0,this.uuid=kh()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let r=0,n=this.stride;r<n;r++)this.array[e+r]=t.array[i+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=kh()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(t,this.stride);return i.setUsage(this.usage),i}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=kh()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.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}}},Po=new P,lg=class{constructor(e,t,i,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=i,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,i=this.data.count;t<i;t++)Po.fromBufferAttribute(this,t),Po.applyMatrix4(e),this.setXYZ(t,Po.x,Po.y,Po.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)Po.fromBufferAttribute(this,t),Po.applyNormalMatrix(e),this.setXYZ(t,Po.x,Po.y,Po.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)Po.fromBufferAttribute(this,t),Po.transformDirection(e),this.setXYZ(t,Po.x,Po.y,Po.z);return this}getComponent(e,t){let i=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(i=sl(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=Ji(i,this.array)),this.data.array[e*this.data.stride+this.offset+t]=i,this}setX(e,t){return this.normalized&&(t=Ji(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Ji(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Ji(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Ji(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=sl(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=sl(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=sl(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=sl(t,this.array)),t}setXY(e,t,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ji(t,this.array),i=Ji(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this}setXYZ(e,t,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ji(t,this.array),i=Ji(i,this.array),r=Ji(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this}setXYZW(e,t,i,r,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ji(t,this.array),i=Ji(i,this.array),r=Ji(r,this.array),n=Ji(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this.data.array[e+3]=n,this}clone(e){if(e===void 0){GE("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let i=0;i<this.count;i++){let r=i*this.data.stride+this.offset;for(let n=0;n<this.itemSize;n++)t.push(this.data.array[r+n])}return new It(new this.array.constructor(t),this.itemSize,this.normalized)}return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new lg(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){GE("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let i=0;i<this.count;i++){let r=i*this.data.stride+this.offset;for(let n=0;n<this.itemSize;n++)t.push(this.data.array[r+n])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}},nQ=0,go=class extends xs{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:nQ++}),this.uuid=kh(),this.name="",this.type="Material",this.blending=sa,this.side=Mo,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=sy,this.blendDst=Af,this.blendEquation=qo,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new ot(0,0,0),this.blendAlpha=0,this.depthFunc=sf,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=KN,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Qm,this.stencilZFail=Qm,this.stencilZPass=Qm,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(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let i=e[t];if(i===void 0){it(`Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];r!==void 0?r&&r.isColor?r.set(i):r&&r.isVector2&&i&&i.isVector2||r&&r.isEuler&&i&&i.isEuler||r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i:it(`Material: '${t}' is not a property of THREE.${this.type}.`)}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let i={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};function r(n){let s=[];for(let a in n){let o=n[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(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).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(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).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(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).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(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).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!==sa&&(i.blending=this.blending),this.side!==Mo&&(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!==sy&&(i.blendSrc=this.blendSrc),this.blendDst!==Af&&(i.blendDst=this.blendDst),this.blendEquation!==qo&&(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!==sf&&(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!==KN&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Qm&&(i.stencilFail=this.stencilFail),this.stencilZFail!==Qm&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==Qm&&(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),t){let n=r(e.textures),s=r(e.images);n.length>0&&(i.textures=n),s.length>0&&(i.images=s)}return i}fromJSON(e,t){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new ot().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?this.vertexColors=e.vertexColors>0:this.vertexColors=e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=t[e.map]||null),e.matcap!==void 0&&(this.matcap=t[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=t[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=t[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=t[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let i=e.normalScale;Array.isArray(i)===!1&&(i=[i,i]),this.normalScale=new J().fromArray(i)}return e.displacementMap!==void 0&&(this.displacementMap=t[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=t[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=t[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=t[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=t[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=t[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=t[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=t[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=t[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=t[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=t[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new J().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(this.iridescenceMap=t[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=t[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=t[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=t[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=t[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,i=null;if(t!==null){let r=t.length;i=new Array(r);for(let n=0;n!==r;++n)i[n]=t[n].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}},t7=class extends go{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new ot(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},P1=new P,y0=new P,_0=new P,Ev=new J,Tb=new J,i7=new Ve,fS=new P,D1=new P,mS=new P,xU=new J,CC=new J,wU=new J,r7=class extends un{constructor(e=new t7){if(super(),this.isSprite=!0,this.type="Sprite",R1===void 0){R1=new At;let t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),i=new Qb(t,5);R1.setIndex([0,1,2,0,2,3]),R1.setAttribute("position",new lg(i,3,0,!1)),R1.setAttribute("uv",new lg(i,2,3,!1))}this.geometry=R1,this.material=e,this.center=new J(.5,.5),this.count=1}raycast(e,t){e.camera===null&&Xe('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),y0.setFromMatrixScale(this.matrixWorld),i7.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),_0.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&y0.multiplyScalar(-_0.z);let i,r,n=this.material.rotation;n!==0&&(r=Math.cos(n),i=Math.sin(n));let s=this.center;aC(fS.set(-.5,-.5,0),_0,s,y0,i,r),aC(D1.set(.5,-.5,0),_0,s,y0,i,r),aC(mS.set(.5,.5,0),_0,s,y0,i,r),xU.set(0,0),CC.set(1,0),wU.set(1,1);let a=e.ray.intersectTriangle(fS,D1,mS,!1,P1);if(a===null&&(aC(D1.set(-.5,.5,0),_0,s,y0,i,r),CC.set(0,1),a=e.ray.intersectTriangle(fS,mS,D1,!1,P1),a===null))return;let o=e.ray.origin.distanceTo(P1);o<e.near||o>e.far||t.push({distance:o,point:P1.clone(),uv:Ls.getInterpolation(P1,fS,D1,mS,xU,CC,wU,new J),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}},Vd=new P,RC=new P,gS=new P,sp=new P,PC=new P,vS=new P,DC=new P,mf=class{constructor(e=new P,t=new P(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Vd)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=Vd.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Vd.copy(this.origin).addScaledVector(this.direction,t),Vd.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){RC.copy(e).add(t).multiplyScalar(.5),gS.copy(t).sub(e).normalize(),sp.copy(this.origin).sub(RC);let n,s,a,o,l=.5*e.distanceTo(t),u=-this.direction.dot(gS),h=sp.dot(this.direction),d=-sp.dot(gS),c=sp.lengthSq(),p=Math.abs(1-u*u);if(p>0)if(n=u*d-h,s=u*h-d,o=l*p,n>=0)if(s>=-o)if(s<=o){let f=1/p;n*=f,s*=f,a=n*(n+u*s+2*h)+s*(u*n+s+2*d)+c}else s=l,n=Math.max(0,-(u*s+h)),a=-n*n+s*(s+2*d)+c;else s=-l,n=Math.max(0,-(u*s+h)),a=-n*n+s*(s+2*d)+c;else s<=-o?(n=Math.max(0,-(-u*l+h)),s=n>0?-l:Math.min(Math.max(-l,-d),l),a=-n*n+s*(s+2*d)+c):s<=o?(n=0,s=Math.min(Math.max(-l,-d),l),a=s*(s+2*d)+c):(n=Math.max(0,-(u*l+h)),s=n>0?l:Math.min(Math.max(-l,-d),l),a=-n*n+s*(s+2*d)+c);else s=u>0?-l:l,n=Math.max(0,-(u*s+h)),a=-n*n+s*(s+2*d)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,n),r&&r.copy(RC).addScaledVector(gS,s),a}intersectSphere(e,t){Vd.subVectors(e.center,this.origin);let i=Vd.dot(this.direction),r=Vd.dot(Vd)-i*i,n=e.radius*e.radius;if(r>n)return null;let s=Math.sqrt(n-r),a=i-s,o=i+s;return o<0?null:a<0?this.at(o,t):this.at(a,t)}intersectsSphere(e){return!(e.radius<0)&&this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){let i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,n,s,a,o,l=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,d=this.origin;return l>=0?(i=(e.min.x-d.x)*l,r=(e.max.x-d.x)*l):(i=(e.max.x-d.x)*l,r=(e.min.x-d.x)*l),u>=0?(n=(e.min.y-d.y)*u,s=(e.max.y-d.y)*u):(n=(e.max.y-d.y)*u,s=(e.min.y-d.y)*u),i>s||n>r||((n>i||isNaN(i))&&(i=n),(s<r||isNaN(r))&&(r=s),h>=0?(a=(e.min.z-d.z)*h,o=(e.max.z-d.z)*h):(a=(e.max.z-d.z)*h,o=(e.min.z-d.z)*h),i>o||a>r)||((a>i||i!=i)&&(i=a),(o<r||r!=r)&&(r=o),r<0)?null:this.at(i>=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,Vd)!==null}intersectTriangle(e,t,i,r,n){PC.subVectors(t,e),vS.subVectors(i,e),DC.crossVectors(PC,vS);let s,a=this.direction.dot(DC);if(a>0){if(r)return null;s=1}else{if(!(a<0))return null;s=-1,a=-a}sp.subVectors(this.origin,e);let o=s*this.direction.dot(vS.crossVectors(sp,vS));if(o<0)return null;let l=s*this.direction.dot(PC.cross(sp));if(l<0||o+l>a)return null;let u=-s*sp.dot(DC);return u<0?null:this.at(u/a,n)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},Zl=class extends go{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ot(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 Kr,this.combine=Kb,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},SU=new Ve,am=new mf,yS=new qa,TU=new P,uM=new P,dM=new P,cM=new P,NC=new P,_S=new P,n7=new P,pM=new P,Cr=class extends un{constructor(e=new At,t=new Zl){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let i=e[t[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,n=i.length;r<n;r++){let s=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[s]=r}}}}getVertexPosition(e,t){let i=this.geometry,r=i.attributes.position,n=i.morphAttributes.position,s=i.morphTargetsRelative;t.fromBufferAttribute(r,e);let a=this.morphTargetInfluences;if(n&&a){_S.set(0,0,0);for(let o=0,l=n.length;o<l;o++){let u=a[o],h=n[o];u!==0&&(NC.fromBufferAttribute(h,e),s?_S.addScaledVector(NC,u):_S.addScaledVector(NC.sub(t),u))}t.add(_S)}return t}raycast(e,t){let i=this.geometry,r=this.material,n=this.matrixWorld;r!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),yS.copy(i.boundingSphere),yS.applyMatrix4(n),am.copy(e.ray).recast(e.near),(yS.containsPoint(am.origin)!==!1||!(am.intersectSphere(yS,TU)===null||am.origin.distanceToSquared(TU)>(e.far-e.near)**2))&&(SU.copy(n).invert(),am.copy(e.ray).applyMatrix4(SU),(i.boundingBox===null||am.intersectsBox(i.boundingBox)!==!1)&&this._computeIntersections(e,t,am)))}_computeIntersections(e,t,i){let r,n=this.geometry,s=this.material,a=n.index,o=n.attributes.position,l=n.attributes.uv,u=n.attributes.uv1,h=n.attributes.normal,d=n.groups,c=n.drawRange;if(a!==null)if(Array.isArray(s))for(let p=0,f=d.length;p<f;p++){let m=d[p],g=s[m.materialIndex];for(let v=Math.max(m.start,c.start),y=Math.min(a.count,Math.min(m.start+m.count,c.start+c.count));v<y;v+=3)r=oC(this,g,e,i,l,u,h,a.getX(v),a.getX(v+1),a.getX(v+2)),r&&(r.faceIndex=Math.floor(v/3),r.face.materialIndex=m.materialIndex,t.push(r))}else for(let p=Math.max(0,c.start),f=Math.min(a.count,c.start+c.count);p<f;p+=3)r=oC(this,s,e,i,l,u,h,a.getX(p),a.getX(p+1),a.getX(p+2)),r&&(r.faceIndex=Math.floor(p/3),t.push(r));else if(o!==void 0)if(Array.isArray(s))for(let p=0,f=d.length;p<f;p++){let m=d[p],g=s[m.materialIndex];for(let v=Math.max(m.start,c.start),y=Math.min(o.count,Math.min(m.start+m.count,c.start+c.count));v<y;v+=3)r=oC(this,g,e,i,l,u,h,v,v+1,v+2),r&&(r.faceIndex=Math.floor(v/3),r.face.materialIndex=m.materialIndex,t.push(r))}else for(let p=Math.max(0,c.start),f=Math.min(o.count,c.start+c.count);p<f;p+=3)r=oC(this,s,e,i,l,u,h,p,p+1,p+2),r&&(r.faceIndex=Math.floor(p/3),t.push(r))}},s7=class extends un{constructor(){super(),this.isBone=!0,this.type="Bone"}},Dr=class extends Pi{constructor(e=null,t=1,i=1,r,n,s,a,o,l=gt,u=gt,h,d){super(null,s,a,o,l,u,r,n,h,d),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},MU=new Ve,sQ=new Ve,LO=class{constructor(e=[],t=[]){this.uuid=kh(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){let e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(16*e.length),t.length===0)this.calculateInverses();else if(e.length!==t.length){it("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let i=0,r=this.bones.length;i<r;i++)this.boneInverses.push(new Ve)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){let i=new Ve;this.bones[e]&&i.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(i)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){let i=this.bones[e];i&&i.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){let i=this.bones[e];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 e=this.bones,t=this.boneInverses,i=this.boneMatrices,r=this.boneTexture;for(let n=0,s=e.length;n<s;n++){let a=e[n]?e[n].matrixWorld:sQ;MU.multiplyMatrices(a,t[n]),MU.toArray(i,16*n)}r!==null&&(r.needsUpdate=!0)}clone(){return new LO(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(4*this.bones.length);e=4*Math.ceil(e/4),e=Math.max(e,4);let t=new Float32Array(e*e*4);t.set(this.boneMatrices);let i=new Dr(t,e,e,mn,Ht);return i.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=i,this}getBoneByName(e){for(let t=0,i=this.bones.length;t<i;t++){let r=this.bones[t];if(r.name===e)return r}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let i=0,r=e.bones.length;i<r;i++){let n=e.bones[i],s=t[n];s===void 0&&(it("Skeleton: No bone found with UUID:",n),s=new s7),this.bones.push(s),this.boneInverses.push(new Ve().fromArray(e.boneInverses[i]))}return this.init(),this}toJSON(){let e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;let t=this.bones,i=this.boneInverses;for(let r=0,n=t.length;r<n;r++){let s=t[r];e.bones.push(s.uuid);let a=i[r];e.boneInverses.push(a.toArray())}return e}},ml=class extends It{constructor(e,t,i,r=1){super(e,t,i),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}},b0=new Ve,EU=new Ve,bS=[],AU=new fn,aQ=new Ve,N1=new Cr,I1=new qa,y4=class extends Cr{constructor(e,t,i){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new ml(new Float32Array(16*i),16),this.instanceColor=null,this.morphTexture=null,this.count=i,this.boundingBox=null,this.boundingSphere=null;for(let r=0;r<i;r++)this.setMatrixAt(r,aQ)}computeBoundingBox(){let e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new fn),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,b0),AU.copy(e.boundingBox).applyMatrix4(b0),this.boundingBox.union(AU)}computeBoundingSphere(){let e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new qa),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,b0),I1.copy(e.boundingSphere).applyMatrix4(b0),this.boundingSphere.union(I1)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){return this.instanceColor===null?t.setRGB(1,1,1):t.fromArray(this.instanceColor.array,3*e)}getMatrixAt(e,t){return t.fromArray(this.instanceMatrix.array,16*e)}getMorphAt(e,t){let i=t.morphTargetInfluences,r=this.morphTexture.source.data.data,n=e*(i.length+1)+1;for(let s=0;s<i.length;s++)i[s]=r[n+s]}raycast(e,t){let i=this.matrixWorld,r=this.count;if(N1.geometry=this.geometry,N1.material=this.material,N1.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),I1.copy(this.boundingSphere),I1.applyMatrix4(i),e.ray.intersectsSphere(I1)!==!1))for(let n=0;n<r;n++){this.getMatrixAt(n,b0),EU.multiplyMatrices(i,b0),N1.matrixWorld=EU,N1.raycast(e,bS);for(let s=0,a=bS.length;s<a;s++){let o=bS[s];o.instanceId=n,o.object=this,t.push(o)}bS.length=0}}setColorAt(e,t){return this.instanceColor===null&&(this.instanceColor=new ml(new Float32Array(3*this.instanceMatrix.count).fill(1),3)),t.toArray(this.instanceColor.array,3*e),this}setMatrixAt(e,t){return t.toArray(this.instanceMatrix.array,16*e),this}setMorphAt(e,t){let i=t.morphTargetInfluences,r=i.length+1;this.morphTexture===null&&(this.morphTexture=new Dr(new Float32Array(r*this.count),r,this.count,Us,Ht));let n=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=r*e;return n[o]=a,n.set(i,o+1),this}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}},IC=new P,oQ=new P,lQ=new hi,$a=class{constructor(e=new P(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){let r=IC.subVectors(i,t).cross(oQ.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,i=!0){let r=e.delta(IC),n=this.normal.dot(r);if(n===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let s=-(e.start.dot(this.normal)+this.constant)/n;return i===!0&&(s<0||s>1)?null:t.copy(e.start).addScaledVector(r,s)}intersectsLine(e){let t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let i=t||lQ.getNormalMatrix(e),r=this.coplanarPoint(IC).applyMatrix4(e),n=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(n),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}},om=new qa,hQ=new J(.5,.5),xS=new P,qv=class{constructor(e=new $a,t=new $a,i=new $a,r=new $a,n=new $a,s=new $a){this.planes=[e,t,i,r,n,s]}set(e,t,i,r,n,s){let a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(r),a[4].copy(n),a[5].copy(s),this}copy(e){let t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=xo,i=!1){let r=this.planes,n=e.elements,s=n[0],a=n[1],o=n[2],l=n[3],u=n[4],h=n[5],d=n[6],c=n[7],p=n[8],f=n[9],m=n[10],g=n[11],v=n[12],y=n[13],_=n[14],b=n[15];if(r[0].setComponents(l-s,c-u,g-p,b-v).normalize(),r[1].setComponents(l+s,c+u,g+p,b+v).normalize(),r[2].setComponents(l+a,c+h,g+f,b+y).normalize(),r[3].setComponents(l-a,c-h,g-f,b-y).normalize(),i)r[4].setComponents(o,d,m,_).normalize(),r[5].setComponents(l-o,c-d,g-m,b-_).normalize();else if(r[4].setComponents(l-o,c-d,g-m,b-_).normalize(),t===xo)r[5].setComponents(l+o,c+d,g+m,b+_).normalize();else{if(t!==$l)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);r[5].setComponents(o,d,m,_).normalize()}return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),om.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),om.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(om)}intersectsSprite(e){om.center.set(0,0,0);let t=hQ.distanceTo(e.center);return om.radius=.7071067811865476+t,om.applyMatrix4(e.matrixWorld),this.intersectsSphere(om)}intersectsSphere(e){let t=this.planes,i=e.center,r=-e.radius;for(let n=0;n<6;n++)if(t[n].distanceToPoint(i)<r)return!1;return!0}intersectsBox(e){let t=this.planes;for(let i=0;i<6;i++){let r=t[i];if(xS.x=r.normal.x>0?e.max.x:e.min.x,xS.y=r.normal.y>0?e.max.y:e.min.y,xS.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(xS)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},CU=new Ve,a7=class{constructor(){this.coordinateSystem=xo,this._frustums=[],this._count=0}setFromArrayCamera(e){let t=e.cameras,i=this._frustums;for(let r=0;r<t.length;r++){let n=t[r];CU.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),i[r]===void 0&&(i[r]=new qv),i[r].setFromProjectionMatrix(CU,n.coordinateSystem,n.reversedDepth)}return this._count=t.length,this}intersectsObject(e){let t=this._frustums;for(let i=0;i<this._count;i++)if(t[i].intersectsObject(e))return!0;return!1}intersectsSprite(e){let t=this._frustums;for(let i=0;i<this._count;i++)if(t[i].intersectsSprite(e))return!0;return!1}intersectsSphere(e){let t=this._frustums;for(let i=0;i<this._count;i++)if(t[i].intersectsSphere(e))return!0;return!1}intersectsBox(e){let t=this._frustums;for(let i=0;i<this._count;i++)if(t[i].intersectsBox(e))return!0;return!1}containsPoint(e){let t=this._frustums;for(let i=0;i<this._count;i++)if(t[i].containsPoint(e))return!0;return!1}copy(e){this.coordinateSystem=e.coordinateSystem;let t=this._frustums,i=e._frustums;for(let r=0;r<e._count;r++)t[r]===void 0&&(t[r]=new qv),t[r].copy(i[r]);return this._count=e._count,this}clone(){return new a7().copy(this)}},sd=class extends go{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new ot(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}},lE=new P,hE=new P,RU=new Ve,O1=new mf,wS=new qa,QN=new P,o7=new P,fM=class extends un{constructor(e=new At,t=new sd){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,i=[0];for(let r=1,n=t.count;r<n;r++)lE.fromBufferAttribute(t,r-1),hE.fromBufferAttribute(t,r),i[r]=i[r-1],i[r]+=lE.distanceTo(hE);e.setAttribute("lineDistance",new Et(i,1))}else it("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){let i=this.geometry,r=this.matrixWorld,n=e.params.Line.threshold,s=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),wS.copy(i.boundingSphere),wS.applyMatrix4(r),wS.radius+=n,e.ray.intersectsSphere(wS)===!1)return;RU.copy(r).invert(),O1.copy(e.ray).applyMatrix4(RU);let a=n/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,l=this.isLineSegments?2:1,u=i.index,h=i.attributes.position;if(u!==null){let d=Math.max(0,s.start),c=Math.min(u.count,s.start+s.count);for(let p=d,f=c-1;p<f;p+=l){let m=u.getX(p),g=u.getX(p+1),v=lC(this,e,O1,o,m,g,p);v&&t.push(v)}if(this.isLineLoop){let p=u.getX(c-1),f=u.getX(d),m=lC(this,e,O1,o,p,f,c-1);m&&t.push(m)}}else{let d=Math.max(0,s.start),c=Math.min(h.count,s.start+s.count);for(let p=d,f=c-1;p<f;p+=l){let m=lC(this,e,O1,o,p,p+1,p);m&&t.push(m)}if(this.isLineLoop){let p=lC(this,e,O1,o,c-1,d,c-1);p&&t.push(p)}}}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let i=e[t[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,n=i.length;r<n;r++){let s=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[s]=r}}}}},PU=new P,DU=new P,Mb=class extends fM{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,i=[];for(let r=0,n=t.count;r<n;r+=2)PU.fromBufferAttribute(t,r),DU.fromBufferAttribute(t,r+1),i[r]=r===0?0:i[r-1],i[r+1]=i[r]+PU.distanceTo(DU);e.setAttribute("lineDistance",new Et(i,1))}else it("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}},uye=class extends go{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new ot(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},V$=class extends Pi{constructor(e,t,i,r,n=nt,s=nt,a,o,l){super(e,t,i,r,n,s,a,o,l),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;let u=this;"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(function h(){u.needsUpdate=!0,u._requestVideoFrameCallbackId=e.requestVideoFrameCallback(h)}))}clone(){return new this.constructor(this.image).copy(this)}update(){let e=this.image;"requestVideoFrameCallback"in e==0&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}},JN=class extends Pi{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=gt,this.minFilter=gt,this.generateMipmaps=!1,this.needsUpdate=!0}},bg=class extends Pi{constructor(e=[],t=wd,i,r,n,s,a,o,l,u){super(e,t,i,r,n,s,a,o,l,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},G$=class extends Pi{constructor(e,t,i,r,n,s,a,o,l){super(e,t,i,r,n,s,a,o,l),this.isCanvasTexture=!0,this.needsUpdate=!0}},es=class extends Pi{constructor(e,t,i=cn,r,n,s,a=gt,o=gt,l,u=Yl,h=1){if(u!==Yl&&u!==Ch)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super({width:e,height:t,depth:h},r,n,s,a,o,u,i,l),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new gC(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}},j$=class extends es{constructor(e,t=cn,i=wd,r,n,s=gt,a=gt,o,l=Yl){let u={width:e,height:e,depth:1},h=[u,u,u,u,u,u];super(e,e,t,i,r,n,s,a,o,l),this.image=h,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}},Ph=class extends At{constructor(e=1,t=1,i=1,r=1,n=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:n,depthSegments:s};let a=this;r=Math.floor(r),n=Math.floor(n),s=Math.floor(s);let o=[],l=[],u=[],h=[],d=0,c=0;function p(f,m,g,v,y,_,b,x,w,S,M){let T=_/w,E=b/S,A=_/2,R=b/2,N=x/2,D=w+1,O=S+1,z=0,U=0,G=new P;for(let j=0;j<O;j++){let K=j*E-R;for(let q=0;q<D;q++){let se=q*T-A;G[f]=se*v,G[m]=K*y,G[g]=N,l.push(G.x,G.y,G.z),G[f]=0,G[m]=0,G[g]=x>0?1:-1,u.push(G.x,G.y,G.z),h.push(q/w),h.push(1-j/S),z+=1}}for(let j=0;j<S;j++)for(let K=0;K<w;K++){let q=d+K+D*j,se=d+K+D*(j+1),ve=d+(K+1)+D*(j+1),oe=d+(K+1)+D*j;o.push(q,se,oe),o.push(se,ve,oe),U+=6}a.addGroup(c,U,M),c+=U,d+=z}p("z","y","x",-1,-1,i,t,e,s,n,0),p("z","y","x",1,-1,i,t,-e,s,n,1),p("x","z","y",1,1,e,i,t,r,s,2),p("x","z","y",1,-1,e,i,-t,r,s,3),p("x","y","z",1,-1,e,t,i,r,n,4),p("x","y","z",-1,-1,e,t,-i,r,n,5),this.setIndex(o),this.setAttribute("position",new Et(l,3)),this.setAttribute("normal",new Et(u,3)),this.setAttribute("uv",new Et(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ph(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}},uE=class extends At{constructor(e=1,t=1,i=1,r=32,n=1,s=!1,a=0,o=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:r,heightSegments:n,openEnded:s,thetaStart:a,thetaLength:o};let l=this;r=Math.floor(r),n=Math.floor(n);let u=[],h=[],d=[],c=[],p=0,f=[],m=i/2,g=0;function v(y){let _=p,b=new J,x=new P,w=0,S=y===!0?e:t,M=y===!0?1:-1;for(let E=1;E<=r;E++)h.push(0,m*M,0),d.push(0,M,0),c.push(.5,.5),p++;let T=p;for(let E=0;E<=r;E++){let A=E/r*o+a,R=Math.cos(A),N=Math.sin(A);x.x=S*N,x.y=m*M,x.z=S*R,h.push(x.x,x.y,x.z),d.push(0,M,0),b.x=.5*R+.5,b.y=.5*N*M+.5,c.push(b.x,b.y),p++}for(let E=0;E<r;E++){let A=_+E,R=T+E;y===!0?u.push(R,R+1,A):u.push(R+1,R,A),w+=3}l.addGroup(g,w,y===!0?1:2),g+=w}(function(){let y=new P,_=new P,b=0,x=(t-e)/i;for(let w=0;w<=n;w++){let S=[],M=w/n,T=M*(t-e)+e;for(let E=0;E<=r;E++){let A=E/r,R=A*o+a,N=Math.sin(R),D=Math.cos(R);_.x=T*N,_.y=-M*i+m,_.z=T*D,h.push(_.x,_.y,_.z),y.set(N,x,D).normalize(),d.push(y.x,y.y,y.z),c.push(A,1-M),S.push(p++)}f.push(S)}for(let w=0;w<r;w++)for(let S=0;S<n;S++){let M=f[S][w],T=f[S+1][w],E=f[S+1][w+1],A=f[S][w+1];(e>0||S!==0)&&(u.push(M,T,A),b+=3),(t>0||S!==n-1)&&(u.push(T,E,A),b+=3)}l.addGroup(g,b,0),g+=b})(),s===!1&&(e>0&&v(!0),t>0&&v(!1)),this.setIndex(u),this.setAttribute("position",new Et(h,3)),this.setAttribute("normal",new Et(d,3)),this.setAttribute("uv",new Et(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new uE(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}},BO=class extends uE{constructor(e=1,t=1,i=32,r=1,n=!1,s=0,a=2*Math.PI){super(0,e,t,i,r,n,s,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:r,openEnded:n,thetaStart:s,thetaLength:a}}static fromJSON(e){return new BO(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}},OC=class extends At{constructor(e=[],t=[],i=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:i,detail:r};let n=[],s=[];function a(c,p,f,m){let g=m+1,v=[];for(let y=0;y<=g;y++){v[y]=[];let _=c.clone().lerp(f,y/g),b=p.clone().lerp(f,y/g),x=g-y;for(let w=0;w<=x;w++)v[y][w]=w===0&&y===g?_:_.clone().lerp(b,w/x)}for(let y=0;y<g;y++)for(let _=0;_<2*(g-y)-1;_++){let b=Math.floor(_/2);_%2==0?(o(v[y][b+1]),o(v[y+1][b]),o(v[y][b])):(o(v[y][b+1]),o(v[y+1][b+1]),o(v[y+1][b]))}}function o(c){n.push(c.x,c.y,c.z)}function l(c,p){let f=3*c;p.x=e[f+0],p.y=e[f+1],p.z=e[f+2]}function u(c,p,f,m){m<0&&c.x===1&&(s[p]=c.x-1),f.x===0&&f.z===0&&(s[p]=m/2/Math.PI+.5)}function h(c){return Math.atan2(c.z,-c.x)}function d(c){return Math.atan2(-c.y,Math.sqrt(c.x*c.x+c.z*c.z))}(function(c){let p=new P,f=new P,m=new P;for(let g=0;g<t.length;g+=3)l(t[g+0],p),l(t[g+1],f),l(t[g+2],m),a(p,f,m,c)})(r),function(c){let p=new P;for(let f=0;f<n.length;f+=3)p.x=n[f+0],p.y=n[f+1],p.z=n[f+2],p.normalize().multiplyScalar(c),n[f+0]=p.x,n[f+1]=p.y,n[f+2]=p.z}(i),function(){let c=new P;for(let p=0;p<n.length;p+=3){c.x=n[p+0],c.y=n[p+1],c.z=n[p+2];let f=h(c)/2/Math.PI+.5,m=d(c)/Math.PI+.5;s.push(f,1-m)}(function(){let p=new P,f=new P,m=new P,g=new P,v=new J,y=new J,_=new J;for(let b=0,x=0;b<n.length;b+=9,x+=6){p.set(n[b+0],n[b+1],n[b+2]),f.set(n[b+3],n[b+4],n[b+5]),m.set(n[b+6],n[b+7],n[b+8]),v.set(s[x+0],s[x+1]),y.set(s[x+2],s[x+3]),_.set(s[x+4],s[x+5]),g.copy(p).add(f).add(m).divideScalar(3);let w=h(g);u(v,x+0,p,w),u(y,x+2,f,w),u(_,x+4,m,w)}})(),function(){for(let p=0;p<s.length;p+=6){let f=s[p+0],m=s[p+2],g=s[p+4],v=Math.max(f,m,g),y=Math.min(f,m,g);v>.9&&y<.1&&(f<.2&&(s[p+0]+=1),m<.2&&(s[p+2]+=1),g<.2&&(s[p+4]+=1))}}()}(),this.setAttribute("position",new Et(n,3)),this.setAttribute("normal",new Et(n.slice(),3)),this.setAttribute("uv",new Et(s,2)),r===0?this.computeVertexNormals():this.normalizeNormals()}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new OC(e.vertices,e.indices,e.radius,e.detail)}},l7=class extends OC{constructor(e=1,t=0){let i=(1+Math.sqrt(5))/2,r=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,-r,-i,0,-r,i,0,r,-i,0,r,i,-r,-i,0,-r,i,0,r,-i,0,r,i,0,-i,0,-r,i,0,-r,-i,0,r,i,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],e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new l7(e.radius,e.detail)}},Eu=class{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){it("Curve: .getPoint() not implemented.")}getPointAt(e,t){let i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t,i=[],r=this.getPoint(0),n=0;i.push(0);for(let s=1;s<=e;s++)t=this.getPoint(s/e),n+=t.distanceTo(r),i.push(n),r=t;return this.cacheArcLengths=i,i}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){let i,r=this.getLengths(),n=0,s=r.length;i=t||e*r[s-1];let a,o=0,l=s-1;for(;o<=l;)if(n=Math.floor(o+(l-o)/2),a=r[n]-i,a<0)o=n+1;else{if(!(a>0)){l=n;break}l=n-1}if(n=l,r[n]===i)return n/(s-1);let u=r[n];return(n+(i-u)/(r[n+1]-u))/(s-1)}getTangent(e,t){let i=e-1e-4,r=e+1e-4;i<0&&(i=0),r>1&&(r=1);let n=this.getPoint(i),s=this.getPoint(r),a=t||(n.isVector2?new J:new P);return a.copy(s).sub(n).normalize(),a}getTangentAt(e,t){let i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t=!1){let i=new P,r=[],n=[],s=[],a=new P,o=new Ve;for(let c=0;c<=e;c++){let p=c/e;r[c]=this.getTangentAt(p,new P)}n[0]=new P,s[0]=new P;let l=Number.MAX_VALUE,u=Math.abs(r[0].x),h=Math.abs(r[0].y),d=Math.abs(r[0].z);u<=l&&(l=u,i.set(1,0,0)),h<=l&&(l=h,i.set(0,1,0)),d<=l&&i.set(0,0,1),a.crossVectors(r[0],i).normalize(),n[0].crossVectors(r[0],a),s[0].crossVectors(r[0],n[0]);for(let c=1;c<=e;c++){if(n[c]=n[c-1].clone(),s[c]=s[c-1].clone(),a.crossVectors(r[c-1],r[c]),a.length()>Number.EPSILON){a.normalize();let p=Math.acos(Li(r[c-1].dot(r[c]),-1,1));n[c].applyMatrix4(o.makeRotationAxis(a,p))}s[c].crossVectors(r[c],n[c])}if(t===!0){let c=Math.acos(Li(n[0].dot(n[e]),-1,1));c/=e,r[0].dot(a.crossVectors(n[0],n[e]))>0&&(c=-c);for(let p=1;p<=e;p++)n[p].applyMatrix4(o.makeRotationAxis(r[p],c*p)),s[p].crossVectors(r[p],n[p])}return{tangents:r,normals:n,binormals:s}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},mM=class extends Eu{constructor(e=0,t=0,i=1,r=1,n=0,s=2*Math.PI,a=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=r,this.aStartAngle=n,this.aEndAngle=s,this.aClockwise=a,this.aRotation=o}getPoint(e,t=new J){let i=t,r=2*Math.PI,n=this.aEndAngle-this.aStartAngle,s=Math.abs(n)<Number.EPSILON;for(;n<0;)n+=r;for(;n>r;)n-=r;n<Number.EPSILON&&(n=s?0:r),this.aClockwise===!0&&!s&&(n===r?n=-r:n-=r);let a=this.aStartAngle+e*n,o=this.aX+this.xRadius*Math.cos(a),l=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){let u=Math.cos(this.aRotation),h=Math.sin(this.aRotation),d=o-this.aX,c=l-this.aY;o=d*u-c*h+this.aX,l=d*h+c*u+this.aY}return i.set(o,l)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}},uQ=class extends mM{constructor(e,t,i,r,n,s){super(e,t,i,i,r,n,s),this.isArcCurve=!0,this.type="ArcCurve"}},NU=new P,IU=new P,LC=new nU,BC=new nU,UC=new nU,dQ=class extends Eu{constructor(e=[],t=!1,i="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=i,this.tension=r}getPoint(e,t=new P){let i,r,n=t,s=this.points,a=s.length,o=(a-(this.closed?0:1))*e,l=Math.floor(o),u=o-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/a)+1)*a:u===0&&l===a-1&&(l=a-2,u=1),this.closed||l>0?i=s[(l-1)%a]:(IU.subVectors(s[0],s[1]).add(s[0]),i=IU);let h=s[l%a],d=s[(l+1)%a];if(this.closed||l+2<a?r=s[(l+2)%a]:(NU.subVectors(s[a-1],s[a-2]).add(s[a-1]),r=NU),this.curveType==="centripetal"||this.curveType==="chordal"){let c=this.curveType==="chordal"?.5:.25,p=Math.pow(i.distanceToSquared(h),c),f=Math.pow(h.distanceToSquared(d),c),m=Math.pow(d.distanceToSquared(r),c);f<1e-4&&(f=1),p<1e-4&&(p=f),m<1e-4&&(m=f),LC.initNonuniformCatmullRom(i.x,h.x,d.x,r.x,p,f,m),BC.initNonuniformCatmullRom(i.y,h.y,d.y,r.y,p,f,m),UC.initNonuniformCatmullRom(i.z,h.z,d.z,r.z,p,f,m)}else this.curveType==="catmullrom"&&(LC.initCatmullRom(i.x,h.x,d.x,r.x,this.tension),BC.initCatmullRom(i.y,h.y,d.y,r.y,this.tension),UC.initCatmullRom(i.z,h.z,d.z,r.z,this.tension));return n.set(LC.calc(u),BC.calc(u),UC.calc(u)),n}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){let r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let r=e.points[t];this.points.push(new P().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}},pu=class extends Eu{constructor(e=new J,t=new J,i=new J,r=new J){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new J){let i=t,r=this.v0,n=this.v1,s=this.v2,a=this.v3;return i.set(nS(e,r.x,n.x,s.x,a.x),nS(e,r.y,n.y,s.y,a.y)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},dE=class extends Eu{constructor(e=new P,t=new P,i=new P,r=new P){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new P){let i=t,r=this.v0,n=this.v1,s=this.v2,a=this.v3;return i.set(nS(e,r.x,n.x,s.x,a.x),nS(e,r.y,n.y,s.y,a.y),nS(e,r.z,n.z,s.z,a.z)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},wh=class extends Eu{constructor(e=new J,t=new J){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new J){let i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new J){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},h7=class extends Eu{constructor(e=new P,t=new P){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new P){let i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new P){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},of=class extends Eu{constructor(e=new J,t=new J,i=new J){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new J){let i=t,r=this.v0,n=this.v1,s=this.v2;return i.set(rS(e,r.x,n.x,s.x),rS(e,r.y,n.y,s.y)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},cQ=class extends Eu{constructor(e=new P,t=new P,i=new P){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new P){let i=t,r=this.v0,n=this.v1,s=this.v2;return i.set(rS(e,r.x,n.x,s.x),rS(e,r.y,n.y,s.y),rS(e,r.z,n.z,s.z)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},eI=class extends Eu{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new J){let i=t,r=this.points,n=(r.length-1)*e,s=Math.floor(n),a=n-s,o=r[s===0?s:s-1],l=r[s],u=r[s>r.length-2?r.length-1:s+1],h=r[s>r.length-3?r.length-1:s+2];return i.set(UZ(a,o.x,l.x,u.x,h.x),UZ(a,o.y,l.y,u.y,h.y)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let r=e.points[t];this.points.push(r.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){let r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let r=e.points[t];this.points.push(new J().fromArray(r))}return this}},OU=Object.freeze({__proto__:null,ArcCurve:uQ,CatmullRomCurve3:dQ,CubicBezierCurve:pu,CubicBezierCurve3:dE,EllipseCurve:mM,LineCurve:wh,LineCurve3:h7,QuadraticBezierCurve:of,QuadraticBezierCurve3:cQ,SplineCurve:eI}),u7=class extends Eu{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){let i=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new OU[i](t,e))}return this}getPoint(e,t){let i=e*this.getLength(),r=this.getCurveLengths(),n=0;for(;n<r.length;){if(r[n]>=i){let s=r[n]-i,a=this.curves[n],o=a.getLength(),l=o===0?0:1-s/o;return a.getPointAt(l,t)}n++}return null}getLength(){let e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let e=[],t=0;for(let i=0,r=this.curves.length;i<r;i++)t+=this.curves[i].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t,i=[];for(let r=0,n=this.curves;r<n.length;r++){let s=n[r],a=s.isEllipseCurve?2*e:s.isLineCurve||s.isLineCurve3?1:s.isSplineCurve?e*s.points.length:e,o=s.getPoints(a);for(let l=0;l<o.length;l++){let u=o[l];t&&t.equals(u)||(i.push(u),t=u)}}return this.autoClose&&i.length>1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}copy(e){super.copy(e),this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){let r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,i=this.curves.length;t<i;t++){let r=this.curves[t];e.curves.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){let r=e.curves[t];this.curves.push(new OU[r.type]().fromJSON(r))}return this}},cE=class extends u7{constructor(e){super(),this.type="Path",this.currentPoint=new J,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,i=e.length;t<i;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let i=new wh(this.currentPoint.clone(),new J(e,t));return this.curves.push(i),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,i,r){let n=new of(this.currentPoint.clone(),new J(e,t),new J(i,r));return this.curves.push(n),this.currentPoint.set(i,r),this}bezierCurveTo(e,t,i,r,n,s){let a=new pu(this.currentPoint.clone(),new J(e,t),new J(i,r),new J(n,s));return this.curves.push(a),this.currentPoint.set(n,s),this}splineThru(e){let t=[this.currentPoint.clone()].concat(e),i=new eI(t);return this.curves.push(i),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,i,r,n,s){let a=this.currentPoint.x,o=this.currentPoint.y;return this.absarc(e+a,t+o,i,r,n,s),this}absarc(e,t,i,r,n,s){return this.absellipse(e,t,i,i,r,n,s),this}ellipse(e,t,i,r,n,s,a,o){let l=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+l,t+u,i,r,n,s,a,o),this}absellipse(e,t,i,r,n,s,a,o){let l=new mM(e,t,i,r,n,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 u=l.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}},ZE=class extends cE{constructor(e){super(e),this.uuid=kh(),this.type="Shape",this.holes=[]}getPointsHoles(e){let t=[];for(let i=0,r=this.holes.length;i<r;i++)t[i]=this.holes[i].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){let r=e.holes[t];this.holes.push(r.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,i=this.holes.length;t<i;t++){let r=this.holes[t];e.holes.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){let r=e.holes[t];this.holes.push(new cE().fromJSON(r))}return this}},pQ=class{static triangulate(e,t,i=2){return function(r,n,s=2){let a,o,l,u=n&&n.length,h=u?n[0]*s:r.length,d=FZ(r,0,h,s,!0),c=[];if(!d||d.next===d.prev)return c;if(u&&(d=function(p,f,m,g){let v=[];for(let y=0,_=f.length;y<_;y++){let b=FZ(p,f[y]*g,y<_-1?f[y+1]*g:p.length,g,!1);b===b.next&&(b.steiner=!0),v.push(SDe(b))}v.sort(bDe);for(let y=0;y<v.length;y++)m=xDe(v[y],m);return m}(r,n,d,s)),r.length>80*s){a=r[0],o=r[1];let p=a,f=o;for(let m=s;m<h;m+=s){let g=r[m],v=r[m+1];g<a&&(a=g),v<o&&(o=v),g>p&&(p=g),v>f&&(f=v)}l=Math.max(p-a,f-o),l=l!==0?32767/l:0}return jE(d,c,s,a,o,l,0),c}(e,t,i)}},d7=class{static area(e){let t=e.length,i=0;for(let r=t-1,n=0;n<t;r=n++)i+=e[r].x*e[n].y-e[n].x*e[r].y;return .5*i}static isClockWise(e){return d7.area(e)<0}static triangulateShape(e,t){let i=[],r=[],n=[];kZ(e),VZ(i,e);let s=e.length;t.forEach(kZ);for(let o=0;o<t.length;o++)r.push(s),s+=t[o].length,VZ(i,t[o]);let a=pQ.triangulate(i,r);for(let o=0;o<a.length;o+=3)n.push(a.slice(o,o+3));return n}},c7=class extends OC{constructor(e=1,t=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],e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new c7(e.radius,e.detail)}},p7=class extends At{constructor(e=[new J(0,-.5),new J(.5,0),new J(0,.5)],t=12,i=0,r=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:r},t=Math.floor(t),r=Li(r,0,2*Math.PI);let n=[],s=[],a=[],o=[],l=[],u=1/t,h=new P,d=new J,c=new P,p=new P,f=new P,m=0,g=0;for(let v=0;v<=e.length-1;v++)switch(v){case 0:m=e[v+1].x-e[v].x,g=e[v+1].y-e[v].y,c.x=1*g,c.y=-m,c.z=0*g,f.copy(c),c.normalize(),o.push(c.x,c.y,c.z);break;case e.length-1:o.push(f.x,f.y,f.z);break;default:m=e[v+1].x-e[v].x,g=e[v+1].y-e[v].y,c.x=1*g,c.y=-m,c.z=0*g,p.copy(c),c.x+=f.x,c.y+=f.y,c.z+=f.z,c.normalize(),o.push(c.x,c.y,c.z),f.copy(p)}for(let v=0;v<=t;v++){let y=i+v*u*r,_=Math.sin(y),b=Math.cos(y);for(let x=0;x<=e.length-1;x++){h.x=e[x].x*_,h.y=e[x].y,h.z=e[x].x*b,s.push(h.x,h.y,h.z),d.x=v/t,d.y=x/(e.length-1),a.push(d.x,d.y);let w=o[3*x+0]*_,S=o[3*x+1],M=o[3*x+0]*b;l.push(w,S,M)}}for(let v=0;v<t;v++)for(let y=0;y<e.length-1;y++){let _=y+v*e.length,b=_,x=_+e.length,w=_+e.length+1,S=_+1;n.push(b,x,S),n.push(w,S,x)}this.setIndex(n),this.setAttribute("position",new Et(s,3)),this.setAttribute("uv",new Et(a,2)),this.setAttribute("normal",new Et(l,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new p7(e.points,e.segments,e.phiStart,e.phiLength)}},qc=class extends At{constructor(e=1,t=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:r};let n=e/2,s=t/2,a=Math.floor(i),o=Math.floor(r),l=a+1,u=o+1,h=e/a,d=t/o,c=[],p=[],f=[],m=[];for(let g=0;g<u;g++){let v=g*d-s;for(let y=0;y<l;y++){let _=y*h-n;p.push(_,-v,0),f.push(0,0,1),m.push(y/a),m.push(1-g/o)}}for(let g=0;g<o;g++)for(let v=0;v<a;v++){let y=v+l*g,_=v+l*(g+1),b=v+1+l*(g+1),x=v+1+l*g;c.push(y,_,x),c.push(_,b,x)}this.setIndex(c),this.setAttribute("position",new Et(p,3)),this.setAttribute("normal",new Et(f,3)),this.setAttribute("uv",new Et(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new qc(e.width,e.height,e.widthSegments,e.heightSegments)}},Ff=class extends At{constructor(e=1,t=32,i=16,r=0,n=2*Math.PI,s=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:r,phiLength:n,thetaStart:s,thetaLength:a},t=Math.max(3,Math.floor(t)),i=Math.max(2,Math.floor(i));let o=Math.min(s+a,Math.PI),l=0,u=[],h=new P,d=new P,c=[],p=[],f=[],m=[];for(let g=0;g<=i;g++){let v=[],y=g/i,_=s+y*a,b=e*Math.cos(_),x=Math.sqrt(e*e-b*b),w=0;g===0&&s===0?w=.5/t:g===i&&o===Math.PI&&(w=-.5/t);for(let S=0;S<=t;S++){let M=S/t,T=r+M*n;h.x=-x*Math.cos(T),h.y=b,h.z=x*Math.sin(T),p.push(h.x,h.y,h.z),d.copy(h).normalize(),f.push(d.x,d.y,d.z),m.push(M+w,1-y),v.push(l++)}u.push(v)}for(let g=0;g<i;g++)for(let v=0;v<t;v++){let y=u[g][v+1],_=u[g][v],b=u[g+1][v],x=u[g+1][v+1];(g!==0||s>0)&&c.push(y,_,x),(g!==i-1||o<Math.PI)&&c.push(_,b,x)}this.setIndex(c),this.setAttribute("position",new Et(p,3)),this.setAttribute("normal",new Et(f,3)),this.setAttribute("uv",new Et(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ff(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}},UO=class extends At{constructor(e=1,t=.4,i=12,r=48,n=2*Math.PI,s=0,a=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:i,tubularSegments:r,arc:n,thetaStart:s,thetaLength:a},i=Math.floor(i),r=Math.floor(r);let o=[],l=[],u=[],h=[],d=new P,c=new P,p=new P;for(let f=0;f<=i;f++){let m=s+f/i*a;for(let g=0;g<=r;g++){let v=g/r*n;c.x=(e+t*Math.cos(m))*Math.cos(v),c.y=(e+t*Math.cos(m))*Math.sin(v),c.z=t*Math.sin(m),l.push(c.x,c.y,c.z),d.x=e*Math.cos(v),d.y=e*Math.sin(v),p.subVectors(c,d).normalize(),u.push(p.x,p.y,p.z),h.push(g/r),h.push(f/i)}}for(let f=1;f<=i;f++)for(let m=1;m<=r;m++){let g=(r+1)*f+m-1,v=(r+1)*(f-1)+m-1,y=(r+1)*(f-1)+m,_=(r+1)*f+m;o.push(g,v,_),o.push(v,y,_)}this.setIndex(o),this.setAttribute("position",new Et(l,3)),this.setAttribute("normal",new Et(u,3)),this.setAttribute("uv",new Et(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new UO(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}},f7=class extends At{constructor(e=1,t=.4,i=64,r=8,n=2,s=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:i,radialSegments:r,p:n,q:s},i=Math.floor(i),r=Math.floor(r);let a=[],o=[],l=[],u=[],h=new P,d=new P,c=new P,p=new P,f=new P,m=new P,g=new P;for(let y=0;y<=i;++y){let _=y/i*n*Math.PI*2;v(_,n,s,e,c),v(_+.01,n,s,e,p),m.subVectors(p,c),g.addVectors(p,c),f.crossVectors(m,g),g.crossVectors(f,m),f.normalize(),g.normalize();for(let b=0;b<=r;++b){let x=b/r*Math.PI*2,w=-t*Math.cos(x),S=t*Math.sin(x);h.x=c.x+(w*g.x+S*f.x),h.y=c.y+(w*g.y+S*f.y),h.z=c.z+(w*g.z+S*f.z),o.push(h.x,h.y,h.z),d.subVectors(h,c).normalize(),l.push(d.x,d.y,d.z),u.push(y/i),u.push(b/r)}}for(let y=1;y<=i;y++)for(let _=1;_<=r;_++){let b=(r+1)*(y-1)+(_-1),x=(r+1)*y+(_-1),w=(r+1)*y+_,S=(r+1)*(y-1)+_;a.push(b,x,S),a.push(x,w,S)}function v(y,_,b,x,w){let S=Math.cos(y),M=Math.sin(y),T=b/_*y,E=Math.cos(T);w.x=x*(2+E)*.5*S,w.y=x*(2+E)*M*.5,w.z=x*Math.sin(T)*.5}this.setIndex(a),this.setAttribute("position",new Et(o,3)),this.setAttribute("normal",new Et(l,3)),this.setAttribute("uv",new Et(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new f7(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}},H$=class extends go{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new ot(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}},i1={clone:Hx,merge:ul},Pr=class extends go{constructor(e){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
- })();`}),l1e=V(()=>{rX=class{constructor(e,t,i){this.deps=e,this.onConsole=t,this.onEvent=i,this.disposed=!1,this.eventUnsubs=new Map,this.variablePollHandle=null,this.lastVariables=null}dispose(){this.disposed=!0;for(let e of this.eventUnsubs.values())e();this.eventUnsubs.clear(),this.stopVariablePolling()}execute(e,t){let i=this.deps;switch(e){case"setVariable":{let r=i.setVariable(String(t[0]),t[1]);return r.warning&&this.onConsole("warn",r.warning),r.ok}case"setVariables":{let r=t[0]??{},n=!0;for(let[s,a]of Object.entries(r)){let o=i.setVariable(s,a);o.warning&&this.onConsole("warn",o.warning),n=n&&o.ok}return n}case"getVariable":return i.getVariable(String(t[0]));case"getVariables":return i.getVariables();case"getAllObjects":return i.getAllObjects();case"findObjectByName":case"findObjectById":return i.findObject(String(t[0]));case"getGeometry":{let r=i.getGeometry(String(t[0]),t[1]??{});return r.warning&&this.onConsole("warn",r.warning),r.data}case"updateObject":return i.updateObject(String(t[0]),t[1]??{});case"createObject":return i.createObject(String(t[0]),t[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(t[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(t[0]),t[1]);case"cloneObject":return i.cloneObject(String(t[0]),t[1]??{});case"removeObject":return i.removeObject(String(t[0]));case"spawnObject":{let r=i.spawnObject(String(t[0]),t[1]??{});return r.warning&&this.onConsole("warn",r.warning),r.object}case"destroyObject":return i.destroyObject(String(t[0]));case"setInstanceTransforms":{let r=t[1]===null||t[1]===void 0?null:t[1],n=i.setInstanceTransforms(String(t[0]),r);return n<0&&this.onConsole("warn",`spline.setInstanceTransforms: "${String(t[0])}" has no cloner \u2014 make the object a cloner first (its copies are what this drives).`),n}case"emitEvent":case"emitEventReverse":{let r=i.emitEvent(String(t[0]),String(t[1]),e==="emitEventReverse");return r.warning&&this.onConsole("warn",r.warning),r.ok}case"requestRender":return i.requestRender(),!0;case"listenEvent":{let r=String(t[0]);return r==="variableChange"?this.startVariablePolling():this.eventUnsubs.has(r)||this.eventUnsubs.set(r,i.addSplineEventListener(r,n=>{this.onEvent(r,n)})),!0}case"unlistenEvent":{let r=String(t[0]);return r==="variableChange"?this.stopVariablePolling():(this.eventUnsubs.get(r)?.(),this.eventUnsubs.delete(r)),!0}default:throw new Error(`Unknown spline bridge method: ${e}`)}}startVariablePolling(){this.variablePollHandle===null&&(this.lastVariables=this.deps.getVariables(),this.variablePollHandle=window.setInterval(()=>{if(this.disposed)return;let e=this.deps.getVariables(),t=function(i,r){let n=[];for(let s of Object.keys(r))i[s]!==r[s]&&n.push({name:s,value:r[s]});return n}(this.lastVariables??{},e);this.lastVariables=e;for(let i of t)this.onEvent("variableChange",i)},100))}stopVariablePolling(){this.variablePollHandle!==null&&(window.clearInterval(this.variablePollHandle),this.variablePollHandle=null),this.lastVariables=null}}});function lIe(e,t,i,r){return[e[0]*t+e[4]*i+e[8]*r+e[12],e[1]*t+e[5]*i+e[9]*r+e[13],e[2]*t+e[6]*i+e[10]*r+e[14]]}var hIe=V(()=>{}),h1e,uIe=V(()=>{}),dIe=V(()=>{nX(),l1e(),h1e=class{constructor(e,t,i){this.iframe=e,this.deps=t,this.onConsole=i,this.disposed=!1,this.handshakeSeen=!1,this.handshakeTimer=null,this.onMessage=r=>{if(this.disposed||r.source!==this.iframe.contentWindow)return;let n=r.data;var s;typeof(s=n)!="object"||s===null||s[hg]!==!0||typeof s.kind!="string"||this.handleMessage(n)},this.host=new rX(t,i,(r,n)=>{this.sendEvent(r,n)})}attach(){window.addEventListener("message",this.onMessage),this.send({[hg]:!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(e){switch(e.kind){case"ready":this.handshakeSeen=!0,this.send({[hg]:!0,kind:"ready-ack"});break;case"console":this.onConsole(e.level,e.text);break;case"call":{let t;try{t=Promise.resolve(this.host.execute(e.method,e.args))}catch(i){t=Promise.reject(i)}t.then(i=>{this.send({[hg]:!0,kind:"result",id:e.id,ok:!0,value:i,error:void 0})},i=>{let r=i instanceof Error?i.message:String(i);this.send({[hg]:!0,kind:"result",id:e.id,ok:!1,value:void 0,error:r}),this.onConsole("error",r)});break}case"input":this.dispatchInput(e.event)}}send(e){this.iframe.contentWindow?.postMessage(e,"*")}sendEvent(e,t){this.send({[hg]:!0,kind:"event",eventName:e,payload:t})}dispatchInput(e){let t=this.deps.getCanvas();if(!t)return;let i=this.iframe.getBoundingClientRect(),r={bubbles:!0,cancelable:!0,view:window,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey};switch(e.type){case"pointerdown":case"pointermove":case"pointerup":case"pointercancel":t.dispatchEvent(new PointerEvent(e.type,{...r,clientX:(e.x??0)+i.left,clientY:(e.y??0)+i.top,button:e.button,buttons:e.buttons,pointerId:e.pointerId,pointerType:e.pointerType,isPrimary:e.isPrimary,movementX:e.movementX,movementY:e.movementY}));break;case"click":case"dblclick":t.dispatchEvent(new MouseEvent(e.type,{...r,clientX:(e.x??0)+i.left,clientY:(e.y??0)+i.top,button:e.button,buttons:e.buttons}));break;case"wheel":{let n=new WheelEvent("wheel",{...r,clientX:(e.x??0)+i.left,clientY:(e.y??0)+i.top,deltaX:e.deltaX,deltaY:e.deltaY,deltaMode:e.deltaMode});typeof e.wheelDeltaX=="number"&&Object.defineProperty(n,"wheelDeltaX",{value:e.wheelDeltaX}),typeof e.wheelDeltaY=="number"&&Object.defineProperty(n,"wheelDeltaY",{value:e.wheelDeltaY}),t.dispatchEvent(n);break}case"keydown":case"keyup":t.dispatchEvent(new KeyboardEvent(e.type,{...r,key:e.key,code:e.code,repeat:e.repeat}))}}}}),Hr=V(()=>{iX(),$Ne(),XNe(),YNe(),ZNe(),QNe(),JNe(),eIe(),tIe(),iIe(),rIe(),aIe(),nX(),oIe(),l1e(),hIe(),uIe(),dIe()}),cIe=V(()=>{});function u1e(e){return Array.isArray(e)?e:[e]}function kO(e,t){let i=0;for(;i<e.length&&i<t.length;){if(e[i]<t[i])return-1;if(e[i]>t[i])return 1;i+=1}return i!==t.length?-1:i!==e.length?1:0}var pIe=V(()=>{});function Ho(e,t){return Object.setPrototypeOf(e,t),e}function $U(e){let t={...e};return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),t}function wg(e,t,i){if(e===void 0?t===void 0?(e=0,t=10):e=t-10:t===void 0&&(t=e+10),e>t){let s=e;e=t,t=s}let r=[],n=1/(i+1);for(let s=0;s<i;s++){let a=e+(t-e)*(s+.75+.5*Math.random())*n;r.push(a)}return r}function Yy(e){return e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Float32Array||e instanceof Float64Array}var fIe=V(()=>{});function sX(e){if(e.deepFreeze!==void 0)return void e.deepFreeze(e);let t=Object.getOwnPropertyNames(e);for(let i of t){let r=e[i];r&&typeof r=="object"&&sX(r)}return Object.freeze(e)}function d1e(e){for(let t of Object.keys(e))e[t]===void 0&&delete e[t];return e}var XU,VO,I7,ai,aX,mIe=V(()=>{}),ha=V(()=>{cIe(),pIe(),fIe(),mIe()}),oX=V(()=>{XU=class{},VO=class extends XU{constructor(e){super(),this.id=e}},I7=class extends XU{constructor(e){super(),this.data=e}}}),gIe=V(()=>{}),S4=V(()=>{ai=class{modifyById(e,t){let i=this;if(i[e]===void 0)throw new Error("not expected");{let r={...i,[e]:t};return Object.setPrototypeOf(r,ai.prototype),r}}add(e,t){return this.runOp({type:1,id:e,data:t})?.data??this}runOp(e){let t=this;if(e.type===1){let i,r=t[e.id];i=r===void 0?{type:2,id:e.id}:{type:1,id:e.id,data:r};let{id:n,data:s}=e,a={...t,[n]:s};return Object.setPrototypeOf(a,ai.prototype),{data:a,actual:e,reverse:i}}if(e.type===2){let{id:i}=e,r=t[i];if(r===void 0)return null;{let n={...t};return Object.setPrototypeOf(n,ai.prototype),delete n[i],{data:n,actual:e,reverse:{type:1,id:i,data:r}}}}return null}}}),lX=V(()=>{aX=class extends Error{}});function c1e(e,t){for(let i of e)t(i.id,i.data)!==!0&&c1e(i.children,t)}function p1e(e,t){if(t(e.id,e.data)!==!0)for(let i of e.children)p1e(i,t)}var Aa,HC,ew,Nt,n1=V(()=>{ha(),lX(),ha(),Aa=class extends Array{constructor(...e){super(...e),Lc(this,"partialObjectCaches"),Lc(this,"objCaches"),Lc(this,"parentCaches"),Object.setPrototypeOf(this,Aa.prototype)}deepFreeze(){let e=0;for(;e<this.length;)sX(this[e]),e++}fillCaches0(e,t){this.objCaches.set(e.id,e),this.parentCaches.set(e.id,t);for(let i of e.children)this.fillCaches0(i,e.id)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,this.parentCaches=new Map;for(let e of this)this.fillCaches0(e,null)}}randomId(){this.fillCaches();let e=Array.from(this.objCaches.keys());if(e.length!==0)return e[Math.max(0,Math.floor(Math.random()*e.length)-1)]}nonExistOrDescendantOf(e,t){if(!this.has(e))return!0;for(;e;){let i=this.parent(e);if(i===t)return!0;e=i}return!1}rootAcestor(e){for(;e;){let t=this.parent(e);if(!t)return e;e=t}return e}isDescendantOf(e,t){for(;e;){let i=this.parent(e);if(i===t)return!0;e=i}return!1}data(e){return this.get(e)?.data}has(e){return this.childrenOf(e)!==void 0}partialCache(e){this.partialObjectCaches===void 0&&(this.partialObjectCaches=new Map);let t=this.get(e);t!==void 0&&this.partialObjectCaches.set(e,t)}get(e){if(this.partialObjectCaches!==void 0){let t=this.partialObjectCaches.get(e);if(t!==void 0)return t}return this.fillCaches(),this.objCaches.get(e)}childrenOf(e){return e===null?this:this.get(e)?.children}traverseFrom(e,t){if(e===null)this.traverse(t);else{let i=this.get(e);i&&p1e(i,t)}}traverse(e){c1e(this,e)}totalSize(){return this.fillCaches(),this.objCaches.size}parent(e){return this.fillCaches(),this.parentCaches.get(e)}childrenArray(e){return e===null?this:this.get(e).children}modifyById(e,t){if(this.get(e)===void 0)throw new Error("not expected");{let i=this.parent(e),r=this.childrenArray(i),n=r.findIndex(o=>o.id===e);if(n<0)throw new Error("not expected");let s=r[n];r=[...r],r[n]={...s,data:t};let a=new Map;return a.set(e,r[n]),this.modifyArrayBy(i,r,a)}}modifyArrayBy(e,t,i=void 0){let r=e,n=t;for(;r!==null;){let a=n,o=r;if(r=this.parent(r),r===void 0)throw new Error;n=this.childrenArray(r);let l=n.findIndex(u=>u.id===o);if(l<0)throw new Error;n=[...n],n[l]={...n[l],children:a},i&&i.set(o,n[l])}Object.setPrototypeOf(n,Aa.prototype);let s=n;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(e){switch(e.type){case 7:return this.addOp(e);case 8:return this.deleteOp(e);case 9:return this.moveOp(e)}return null}checkDuplicatedIdRec({id:e,children:t}){if(this.get(e)!==void 0)return!0;for(let i of t)if(this.checkDuplicatedIdRec(i))return!0;return!1}addOp(e){let{parent:t,fi:i,id:r,data:n,children:s}=e;if(t!==null&&this.get(t)===void 0||this.checkDuplicatedIdRec(e))return null;{let a=t,o=this.childrenArray(a),l={fi:i,id:r,data:n,children:s};return o=[...o,l],o.sort((u,h)=>u.fi-h.fi),e.localIndex=o.indexOf(l),{data:this.modifyArrayBy(a,o),actual:e,reverse:{type:8,id:r}}}}deleteOp(e){let{id:t}=e;if(this.get(t)===null)return null;{let i=this.parent(t);if(i===void 0)return null;let r=this.childrenArray(i),n=r.findIndex(a=>a.id===t);e.localIndex=n,r=[...r];let s=r.splice(n,1)[0];return{data:this.modifyArrayBy(i,r),actual:e,reverse:{type:7,...s,parent:i}}}}moveOp(e){let{parent:t,fi:i,id:r}=e;if(t!==null&&this.get(t)===void 0)return this.deleteOp({type:8,id:r});if(t!==null){let d=t;for(;d!==null;){if(d===void 0)throw new Error;if(d===r)throw new aX("cyclic tree");d=this.parent(d)}}let n=this.parent(r);if(n===void 0)return null;let s=n,a=this.childrenArray(n),o=a.findIndex(d=>d.id===r);a=[...a];let l=a.splice(o,1)[0],u=this.modifyArrayBy(n,a);n=t,a=u.childrenArray(n);let h=l.fi;return l={...l,fi:i},a=[...a,l],a.sort((d,c)=>d.fi-c.fi),e.localIndex=a.indexOf(l),u=u.modifyArrayBy(n,a),{data:u,actual:e,reverse:{type:9,parent:s,fi:h,id:r}}}previous(e,t){if(t===null){let r=this.childrenArray(e);return r.length===0?null:r[r.length-1].id}let i=null;for(let r of this.childrenArray(e)){if(r.id===t)return i;i=r.id}return null}traverseSortNext(e){let t=this.parent(e);if(t!==void 0){let i=this.childrenArray(t),r=i.findIndex(n=>n.id===e)+1;if(r<i.length)return i[r].id;if(t)return this.traverseSortNext(t)}}sortNext(e){let t=this.childrenArray(e);return t.length>0?t[0].id:this.traverseSortNext(e)}traverseSortPrevious(e){let t=this.childrenArray(e);return t.length>0?this.traverseSortPrevious(t[t.length-1].id):e}sortPrevious(e){let t=this.parent(e);if(t!==void 0){let i=this.childrenArray(t),r=i.findIndex(n=>n.id===e)-1;return r>=0?this.traverseSortPrevious(i[r].id):t}}getAllSorted(e){let t=[];for(let i of e){let r=this.getWithSortKey(i.id);r!==void 0&&t.push({...i,...r})}t.sort((i,r)=>kO(i.sortKey,r.sortKey));for(let i of t)delete i.sortKey;return t}getAllIdSorted(e){let t=[];for(let i of e){let r=this.getWithSortKey(i);r!==void 0&&t.push(r)}t.sort((i,r)=>kO(i.sortKey,r.sortKey));for(let i of t)delete i.sortKey;return t.map(i=>i.id)}getWithSortKey(e){let t=e,i=[],r=this.get(t),n=r;if(r!==void 0){for(;t;)i.splice(0,0,r.fi),t=this.parent(t),t!==null&&(r=this.get(t));return{...n,sortKey:i}}}insertBeforeHelper(e,t,i){return this.insertAfterHelper(e,this.previous(e,t),i)}insertAfterHelper(e,t,i){let r=this.childrenArray(e);if(t===null){if(r.length===0)return wg(0,i,i);{let n=r[0].fi;return wg(n-i,n,i)}}{let n=this.get(t);if(n===void 0||this.parent(t)!==e)throw new Error("illegal args");let s=r.find(a=>a.fi>n.fi);if(s===void 0){let a=r[r.length-1].fi;return wg(a,a+i,i)}return wg(n.fi,s.fi,i)}}}}),hX=V(()=>{var e;ha(),HC=null,(e=ew||(ew={})).setPreservePrototype=function(t){HC=t},e.tryPreservePrototype=function(t,i){return Object.getPrototypeOf(t)===HC&&Object.setPrototypeOf(i,HC),i},e.runOp=function(t,i){if(i.type!==0)return null;if(Array.isArray(t)||Yy(t)){let r=i.props,n={},s=Yy(t)?t.slice():[...t],a=!1;if(r)for(let o of Object.keys(r)){let l=parseInt(o);if(isNaN(l))throw new Error("wrong index");n[o]=s[l],s[l]=r[o],a=!0}return a?{data:s,actual:i,reverse:{type:0,props:n}}:null}{let r=i.props,n={},s={...t},a=!1;if(r)for(let o of Object.keys(r)){n[o]=s[o];let l=r[o];l===void 0?delete s[o]:s[o]=l,a=!0}return a?{data:e.tryPreservePrototype(t,s),actual:i,reverse:{type:0,props:n}}:null}}}),s1=V(()=>{ha(),ha(),Nt=class extends Array{constructor(...e){super(...e),Lc(this,"objCaches"),Object.setPrototypeOf(this,Nt.prototype)}deepFreeze(){let e=0;for(;e<this.length;)sX(this[e]),e++}fillCaches0(e){this.objCaches.set(e.id,e)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,Object.getOwnPropertyDescriptor(this,"objCaches").enumerable=!1;for(let e of this)this.fillCaches0(e)}}randomId(){this.fillCaches();let e=Array.from(this.objCaches.keys());if(e.length!==0)return e[Math.max(0,Math.floor(Math.random()*e.length)-1)]}data(e){return this.get(e)?.data}get(e){return this.fillCaches(),this.objCaches.get(e)}modifyById(e,t){if(this.get(e)===void 0)throw new Error("not expected");{let i=this,r=i.findIndex(s=>s.id===e);if(r<0)throw new Error("not expected");let n=i[r];return i=[...i],i[r]={...n,data:t},this.modifyArrayBy(i)}}modifyArrayBy(e){Object.setPrototypeOf(e,Nt.prototype);let t=e;return typeof process<"u"||t.fillCaches(),t}runOp(e){switch(e.type){case 4:return this.addOp(e);case 5:return this.deleteOp(e);case 6:return this.moveOp(e)}return null}addOp(e){let{fi:t,id:i,data:r}=e,n=this,s={fi:t,id:i,data:r};return n=[...n,s],n.sort((a,o)=>a.fi-o.fi),e.localIndex=n.indexOf(s),{data:this.modifyArrayBy(n),actual:e,reverse:{type:5,id:i}}}deleteOp(e){let{id:t}=e,i=this,r=i.findIndex(s=>s.id===t);if(r===-1)return null;e.localIndex=r,i=[...i];let n=i.splice(r,1)[0];return{data:this.modifyArrayBy(i),actual:e,reverse:{type:4,...n}}}moveOp(e){let{fi:t,id:i}=e,r=this;r=[...r];let n=r.findIndex(o=>o.id===i);if(n===-1)return null;let s=r[n].fi,a={...r[n],fi:t};return r[n]=a,r.sort((o,l)=>o.fi-l.fi),e.localIndex=r.indexOf(a),{data:this.modifyArrayBy(r),actual:e,reverse:{type:6,fi:s,id:i}}}previous(e){if(e===null)return this.length===0?null:this[this.length-1].id;let t=null;for(let i of this){if(i.id===e)return t;t=i.id}return null}insertBeforeHelper(e,t){return this.insertAfterHelper(this.previous(e),t)}insertAfterHelper(e,t){let i=this;if(e===null){if(i.length===0)return wg(0,t,t);{let r=i[0].fi;return wg(r-t,r,t)}}{let r=this.get(e);if(r===void 0)throw new Error("illegal args");let n=i.find(s=>s.fi>r.fi);if(n===void 0){let s=i[i.length-1].fi;return wg(s,s+t,t)}return wg(r.fi,n.fi,t)}}}});function vIe(e,t){let i={cur:[],result:[],len:0};return[e=bx(e,t,i)??e,i.result]}function sI(e,t){return e===null?null:(e.cur[e.len]=t,e.len+=1,e)}function aI(e){e&&(e.len-=1)}function f1e(e,t,i){let r=!1,n=e.map(s=>{let a=s.id,o=t[a];if(o!==void 0&&typeof o=="string"&&(r=!0,a=o,i!==null))throw new Error("not supported");let l=bx(s.data,t,sI(i,a));aI(i),r=r||l!==void 0,l===void 0&&(l=s.data);let u=f1e(s.children,t,i);return u!==void 0?r=!0:u=s.children,{...s,id:a,data:l,children:u}});if(r)return n}function bx(e,t,i){if(e instanceof Aa){let r=f1e(e,t,i);return r!==void 0&&Object.setPrototypeOf(r,Object.getPrototypeOf(e)),r}if(e instanceof Nt)return function(r,n,s){let a=!1,o=r.map(l=>{let u=l.id,h=n[u];if(h!==void 0&&typeof h=="string"&&(a=!0,u=h,s!==null))throw new Error("not supported");let d=bx(l.data,n,sI(s,u));return aI(s),a=a||d!==void 0,d===void 0&&(d=l.data),{...l,id:u,data:d}});if(a)return Object.setPrototypeOf(o,Object.getPrototypeOf(r)),o}(e,t,i);if(Array.isArray(e)){let r=!1,n=e.map((s,a)=>{let o=bx(s,t,sI(i,a));return aI(i),r=r||o!==void 0,o===void 0&&(o=s),o});return r?(Object.setPrototypeOf(n,Object.getPrototypeOf(e)),n):void 0}if(e&&typeof e=="object"&&!Yy(e)){let r={},n=!1;for(let[s,a]of Object.entries(e))if(s!=="name"&&s!=="variableId"){let o=t[s];if(typeof o=="string"){if(i!==null)throw new Error("not supported");n=!0,s=o}let l=bx(a,t,sI(i,s));aI(i),n=n||l!==void 0,l===void 0&&(l=a),r[s]=l}else r[s]=a;return n?(Object.setPrototypeOf(r,Object.getPrototypeOf(e)),r):void 0}if(typeof e=="string"){let r=t[e];return r!==void 0&&function(n){if(n===null)return null;n.result.push(n.cur.slice(0,n.len))}(i),r}}var m1e=V(()=>{n1(),s1(),ha()});function xx(e){return e&&typeof e=="object"&&e instanceof Qs}function uX(e,t){if(t===void 0)return;let i=!1,r=e.map(n=>{let s=n.id,a=mE(n.data,t[s]);if(i=i||a!==void 0,a===void 0&&(a=n.data),n.children){let o=uX(n.children,t);return o!==void 0?i=!0:o=n.children,{...n,id:s,data:a,children:o}}return{...n,id:s,data:a}});return i?r:void 0}function mE(e,t){if(!xx(t))return t;if(e instanceof Aa){let i=uX(e,t);return i!==void 0&&Object.setPrototypeOf(i,Object.getPrototypeOf(e)),i}if(e instanceof Nt)return function(i,r){if(r===void 0)return;let n=!1,s=i.map(a=>{let o=a.id,l=mE(a.data,r[o]);return n=n||l!==void 0,l===void 0&&(l=a.data),{...a,id:o,data:l}});return n?(Object.setPrototypeOf(s,Object.getPrototypeOf(i)),s):void 0}(e,t);if(Array.isArray(e)){let i=!1,r=e.map((n,s)=>{let a=mE(n,t[s]);return i=i||a!==void 0,a===void 0&&(a=n),a});return i?(Object.setPrototypeOf(r,Object.getPrototypeOf(e)),r):void 0}if(e instanceof Qs)return dX(e,t);if(e&&typeof e=="object"){let i={},r=!1;for(let[n,s]of Object.entries(e)){let a=mE(s,t[n]);r=r||a!==void 0,a===void 0&&(a=s),i[n]=a}return r?(Object.setPrototypeOf(i,Object.getPrototypeOf(e)),i):void 0}}function dX(e,t){if(e===void 0)return t;if(t===void 0)return e;if(!xx(t))return t;if(!xx(e))return Ig.apply(e,t);let i=new Set;for(let n of Object.keys(e))i.add(n);for(let n of Object.keys(t))i.add(n);let r=new Qs;for(let n of i){let s=dX(e===void 0?void 0:e[n],t===void 0?void 0:t[n]);r[n]=s}return r}var Qs,Ig,GO,Xa,uJ,cX=V(()=>{var e;n1(),s1(),E4(),ha(),Qs=class{unusedFunOverridesTable(t){}runOp(t){let i=[],r=this,n=0,s={};for(;n<t.path.length;){if(i.push(r),r=r===void 0?void 0:r[t.path[n]],r!==void 0&&!xx(r))return null;n+=1}r=r?$U(r):new Qs;for(let[a,o]of Object.entries(t.props)){let l=r[a];s[a]=l,o===void 0?delete r[a]:r[a]=o}for(;n>0;){if(Object.keys(r).length===0){let a=i[n-1];a&&(r=$U(a),delete r[t.path[n-1]])}else{let a=i[n-1];if(a){let o=$U(a);o[t.path[n-1]]=r,r=o}else{let o=new Qs;o[t.path[n-1]]=r,r=o}}n-=1}return{data:Object.setPrototypeOf(r,Qs.prototype),actual:t,reverse:{...t,props:s}}}},(e=Ig||(Ig={})).apply=function(t,i){return mE(t,i)??t},e.merge=function(t,i){return dX(t,i)},e.filterOp=function(t,i){let r=0,n=i.path,s=t;for(;r<n.length&&s!==void 0;){if(s=Ta.zoomOnce(s,n[r]),s===void 0)return i;if(!xx(s))return;r+=1}if(s===void 0)return i;if(xx(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=uX([i],s);return a?a[0]:i}return i}}}),yIe=V(()=>{ha(),E4(),S4(),n1(),lX(),hX(),s1(),m1e(),cX(),(GO||(GO={})).replaceProps=function(e,t){let i=Ta.zoom(t,e.path);if(typeof i=="object"){let r={};for(let n of Object.keys(e.props))r[n]=i[n];return{...e,props:r}}return{...e,props:{}}},(e=>{function t(n,s){let a=s.path,o=[];for(;;){let l;if(n instanceof Qs&&s.type===0&&(l=n.runOp({...s,path:a.slice(o.length)}),l===null&&(l=void 0)),l===void 0&&o.length===a.length&&(l=n instanceof Aa||n instanceof Nt||n instanceof ai?n.runOp(s):ew.runOp(n,s)),l!==void 0){if(l!==null){let d=l.data;for(let c=o.length-1;c>=0;c--){let p=a[c],f=o[c];if(f instanceof Aa){if(typeof p=="number")throw new Error("illegal arg");d=f.modifyById(p,d)}else if(f instanceof Nt){if(typeof p=="number")throw new Error("illegal arg");d=f.modifyById(p,d)}else if(f instanceof ai){if(typeof p=="number")throw new Error("illegal arg");d=f.modifyById(p,d)}else if(f instanceof Qs){let m={...f,[p]:d};d=Object.setPrototypeOf(m,Qs.prototype)}else{if(typeof f!="object")return null;if(Array.isArray(f)||Yy(f)){if(typeof p=="string"&&(p=parseInt(p),isNaN(p)))throw new Error("Invalid path");let m=d;d=Yy(f)?f.slice():[...f],d[p]=m}else d=ew.tryPreservePrototype(f,{...f,[p]:d})}}return{data:d,actual:{...l.actual,path:a},reverse:{...l.reverse,path:a}}}return null}let u,h=a[o.length];if(n instanceof Aa){if(typeof h=="number")throw new Error("");u=n.get(h)?.data}else if(n instanceof Nt){if(typeof h=="number")throw new Error("");u=n.get(h)?.data}else n!==null&&(u=n[h]);if(u===void 0)return null;o.push(n),n=u}}function i(n,s){for(let a=0;a<n.length&&a<s.length;a++)if(n[a]!==s[a])return!0;return!1}function r(n,s){if(n.length!==s.length)return!1;for(let a=0;a<n.length;a++)if(n[a]!==s[a])return!1;return!0}e.drop=function(n,s){return{...n,path:n.path.slice(s)}},e.applySimple=function(n,s){return t(n,s)?.data??n},e.apply=t,e.pathDisjoint=i,e.pathEq=r,e.commutative=function(n,s){return i(n.path,s.path)},e.subsumed=function(n,s){return!(n.type!==0||s.type!==0||!r(n.path,s.path))&&Object.keys(n.props).every(a=>s.props[a]!==void 0)}})(Xa||(Xa={})),(e=>{function t(i,r){let n=i,s=[],a=[];for(let o of r)try{if(o.type===3||o.type===5&&o.path[o.path.length-1]==="variables"){let l,u,h;if(o.type===3?(l=Ta.zoom(n,[...o.path,o.id]),h=Xa.apply(n,{...o,type:2})):(l=Ta.zoom(n,[...o.path,o.id,"value"]),h=Xa.apply(n,o)),h!==null){n=h.data;let[d,c]=vIe(n,{[o.id]:l});n=d;for(let p=0;p<c.length;p++){let f=c[p],m=f.pop();if(typeof m=="number"){let g=[m];for(let y=p+1;y<c.length;y++){let _=c[y],b=_[_.length-1];if(typeof b!="number"||!Ta.equal(f,_.slice(0,_.length-1)))break;g.push(b),c.splice(y,1)}let v=Ta.zoom(n,f);u=v.map((y,_)=>g.includes(_)?o.id:y),l=v,m=f.pop()}else{if(m==="alphaOverride"||m==="alpha"){l/=100;let g=l,v=Ta.zoom(n,f.slice(0,f.length-2)),y=v.layers.map(_=>_.id===f[f.length-1]?{..._,data:{..._.data,[m]:g}}:_);Object.setPrototypeOf(y,Object.getPrototypeOf(v.layers)),v.layers=y}u=o.id}s.push({type:0,path:f,props:{[m]:l}}),a.push({type:0,path:f,props:{[m]:u}})}a.push(h.reverse),s.push(h.actual)}}else{let l=Xa.apply(n,o);l!==null&&(s.push(l.actual),n=l.data,a.push(l.reverse))}}catch(l){if(l instanceof aX)return null;throw l}return{data:n,actual:s,reverse:a.reverse()}}e.empty=function(){return[]},e.removePrefix=function(i,r){let n=[];for(let s of i){let[a,...o]=s.path;a===r&&n.push({...s,path:o})}return n},e.addPrefix=function(i,r){return i.map(n=>({...n,path:[r,...n.path]}))},e.concat=function(i,r){return[...i,...r]},e.compress=function(i,r){return[...i.filter(n=>!r.some(s=>Xa.subsumed(n,s))),...r]},e.commutative=function(i,r){return i.every(n=>r.every(s=>Xa.commutative(n,s)))},e.applyAll=function(i,r){for(let n of r){let s=t(i,n);s!==null&&(i=s.data)}return i},e.apply=t})(uJ||(uJ={}))});function YU(e,t,i){if(e.length>0){let r=e[e.length-1];if(r.type===0&&t.type===0&&Ta.equal(r.path,i))return void Object.assign(r.props,t.props)}e.push({...t,path:i})}function oI(e,t,i){return i instanceof Aa?new T4(e,t,i):i instanceof Nt?new M4(e,t,i):i instanceof ai?new Proxy(new v1e(e,t,i),_1e):i!==null&&typeof i=="object"?Yy(i)?i:new Proxy(new g1e(e,t,i),y1e):i}function bM(e){let t=new L7(e);return[oI(t,"",e),t]}function jO(e,t){let[i,r]=bM(e);return t(i),r.result()}function $s(e){return e instanceof T4||e instanceof M4?e._current:e!==null&&typeof e=="object"?e[O7]:e}var O7,dJ,RS,z1,g1e,v1e,KU,y1e,_1e,T4,M4,L7,Ta,b1e=V(()=>{S4(),n1(),hX(),s1(),ha(),E4(),O7=Symbol(),dJ=Symbol(),RS=Symbol(),z1=class{reportOp(e,t,i=[]){let r=this;if(t===null)return;r._current=t.data;let n=i;for(;!(r instanceof L7);){let s=r._path,a=r._current;if(s!==""&&n.splice(0,0,s),r=r._parent,r===null)return;r.update(s,a)}r.push(n,e,t.actual,t.reverse)}deleteChildren(e){if(this._children){let t=this._children[e];if(t){let i=t[RS];i&&i(),delete this._children[e]}}}},g1e=class extends z1{constructor(e,t,i){super(),this._parent=e,this._path=t,this._current=i}update(e,t){if(Array.isArray(this._current)){if(typeof e=="string"&&(e=parseInt(e),isNaN(e)))throw new Error("Invalid path");this._current=[...this._current],this._current[e]=t}else this._current=ew.tryPreservePrototype(this._current,{...this._current,[e]:t})}runOp(e){this.reportOp(e,ew.runOp(this._current,e),e.path)}},v1e=class extends z1{constructor(e,t,i){super(),this._parent=e,this._path=t,this._current=i}update(e,t){this._current={...this._current,[e]:t},Object.setPrototypeOf(this._current,ai.prototype)}runOp(e){this.reportOp(e,this._current.runOp(e))}},KU={get(e,t){if(t===RS)return()=>{e._parent=null};if(t===O7)return e._current;if(t===dJ)return e;let{_current:i,_children:r}=e;if(t==="push"&&Array.isArray(i))throw new Error("not supported to expand array");let n=r===void 0?void 0:r[t];if(n!==void 0)return n;let s=i[t],a=oI(e,t,s);return a!==s?(r===void 0&&(r={},e._children=r),r[t]=a,a):s},has:(e,t)=>t in e._current,ownKeys:e=>Reflect.ownKeys(e._current),defineProperty(){throw Error("not supported")},getPrototypeOf:e=>Object.getPrototypeOf(e._current),setPrototypeOf(){throw Error("not supported")},getOwnPropertyDescriptor(e,t){let i=e._current,r=Reflect.getOwnPropertyDescriptor(i,t);return r&&{writable:!0,configurable:!0,enumerable:r.enumerable,value:i[t]}}},y1e={...KU,set(e,t,i){let r={type:0,props:{[t]:$s(i)??i}};return e.deleteChildren(t),e.runOp(r),!0},deleteProperty(e,t){let i={type:0,props:{[t]:void 0}};return e.deleteChildren(t),e.runOp(i),!0}},_1e={...KU,set(e,t,i){return i===void 0?this.deleteProperty(e,t):(e.deleteChildren(t),e.runOp({type:1,id:t,data:i})),!0},deleteProperty:(e,t)=>(e.runOp({type:2,id:t}),!0)},T4=class extends z1{constructor(e,t,i){super(),this._children={},this._parent=e,this._path=t,this._current=i,this[RS]=()=>{this._parent=null}}unproxy(){return this._current}update(e,t){this._current=this._current.modifyById(e,t)}runOp(e){this.reportOp(e,this._current.runOp(e))}randomId(){return this._current.randomId()}isDescendantOf(e,t){return this._current.isDescendantOf(e,t)}childrenOf(e){return this._current.childrenOf(e)}get(e){return this._current.get(e)}parent(e){return this._current.parent(e)}traverse(e){this._current.traverse((t,i)=>{e(t,this.data(t))})}data(e){let{_current:t,_children:i}=this,r=i===void 0?void 0:i[e];if(r!==void 0)return r;let n=t.get(e)?.data,s=oI(this,e,n);return s!==n?(i===void 0&&(i={},this._children=i),i[e]=s,s):n}add(e,t,i,r,n){this.runOp({type:7,parent:e,fi:t,id:i,data:r,children:n})}move(e,t,i){this.runOp({type:9,parent:e,fi:t,id:i})}insertAfter(e,t,i){let r=this._current.insertAfterHelper(e,t,i.length);for(let n=0;n<i.length;n++){let s=i[n];this.add(e,r[n],s.id,s.data,s.children)}}insertBefore(e,t,i){let r=this._current.insertBeforeHelper(e,t,i.length);for(let n=0;n<i.length;n++){let s=i[n];this.add(e,r[n],s.id,s.data,s.children)}}moveAfter(e,t,i){let r=this._current.insertAfterHelper(e,t,i.length);for(let n=0;n<i.length;n++){let s=i[n];this.move(e,r[n],s)}}moveBefore(e,t,i){let r=this._current.insertBeforeHelper(e,t,i.length);for(let n=0;n<i.length;n++){let s=i[n];this.move(e,r[n],s)}}delete(e){this.deleteChildren(e),this.runOp({type:8,id:e})}sortNext(e){return this._current.sortNext(e)}sortPrevious(e){return this._current.sortPrevious(e)}getAllSorted(e){return this._current.getAllSorted(e)}},M4=class extends z1{constructor(e,t,i){super(),this._children={},this._parent=e,this._path=t,this._current=i,this[RS]=()=>{this._parent=null}}unproxy(){return this._current}get length(){return this._current.length}forEach(e){let t=this.length;for(let i=0;i<t;i++){let r=this._current[i].id,n=this._current[i].fi;e(this.data(this._current[i].id),r,n,i)}}find(e){let t=this.length;for(let i=0;i<t;i++){let r=this._current[i].id;if(e(this.data(r),r))return this.get(r)}}update(e,t){this._current=this._current.modifyById(e,t)}randomId(){return this._current.randomId()}get(e){return{...this._current.get(e),data:this.data(e)}}at(e){let{id:t,fi:i}=this._current.at(e);return{id:t,fi:i,data:this.data(t)}}data(e){let{_current:t,_children:i}=this,r=i===void 0?void 0:i[e];if(r!==void 0)return r;let n=t.get(e)?.data,s=oI(this,e,n);return s!==n?(i===void 0&&(i={},this._children=i),i[e]=s,s):n}runOp(e){this.reportOp(e,this._current.runOp(e))}add(e,t,i){this.runOp({type:4,fi:e,id:t,data:i})}move(e,t){this.runOp({type:6,fi:e,id:t})}insertAfter(e,t){let i=this._current.insertAfterHelper(e,t.length);for(let r=0;r<t.length;r++){let n=t[r];this.add(i[r],n.id,n.data)}}insertBefore(e,t){let i=this._current.insertBeforeHelper(e,t.length);for(let r=0;r<t.length;r++){let n=t[r];this.add(i[r],n.id,n.data)}}moveAfter(e,t){let i=this._current.insertAfterHelper(e,t.length);for(let r=0;r<t.length;r++){let n=t[r];this.move(i[r],n)}}moveBefore(e,t){let i=this._current.insertBeforeHelper(e,t.length);for(let r=0;r<t.length;r++){let n=t[r];this.move(i[r],n)}}delete(e){this.deleteChildren(e),this.runOp({type:5,id:e})}},L7=class extends z1{constructor(e){super(),this.ts=[],this.actual=[],this.reverse=[],this._current=e}update(e,t){if(e!=="")throw new Error("");this._current=t}push(e,t,i,r){YU(this.ts,t,e),YU(this.actual,i,e),YU(this.reverse,r,e)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}}}),E4=V(()=>{oX(),b1e(),s1(),n1(),ha(),(e=>{function t(r,n){return(r instanceof Aa||r instanceof T4)&&typeof n=="string"||(r instanceof Nt||r instanceof M4)&&typeof n=="string"?r.data(n):typeof n=="number"&&Array.isArray(r)||typeof n=="string"&&typeof r=="object"&&r!==null?r[n]:void 0}function i(r,n,s=0){for(;s<n.length&&r!==void 0;)r=t(r,n[s]),s+=1;return r}e.equal=function(r,n){if(n.length!==r.length)return!1;{let s=0;for(;s<r.length;){if(r[s]!==n[s])return!1;s+=1}}return!0},e.removeOverridden=function(r,n,s){let a=i(s,r);if(a!==void 0&&typeof a=="object"&&a!==null){let o={...n};return Object.keys(a).forEach(l=>{delete o[l]}),o}return n},e.zoomOnce=t,e.zoom=i,e.findPathes=function(r,n){let s=[];return function a(o,l){if(o instanceof VO&&o.id===n.id)s.push(l);else if(o instanceof Nt)for(let u=0;u<o.length;u++)a(o[u].data,[...l,o[u].id]);else if(o instanceof Aa)o.traverse((u,h)=>{a(h,[...l,u])});else if(Array.isArray(o)){if(typeof o[0]=="number")return;for(let u=0;u<o.length;u++)a(o[u],[...l,u])}else{if(Yy(o))return;if(typeof o=="object"&&o!==null)for(let u in o)a(o[u],[...l,u])}}(r,[]),s}})(Ta||(Ta={}))}),_Ie=V(()=>{});function Jr(e,t){let i=[];if(!(t.length<=e.length))return null;{let r=0;for(;r<t.length;){if(t[r]==="*")i.push(e[r]);else if(e[r]!==t[r])return null;r+=1}}return i}var bIe=V(()=>{});function WC(e){try{if(!Rn.trusted&&!vf){let i=Br.sharedLength||0;i<Br.length&&(Br.length=i)}let t;if(Rn.randomAccessStructure&&Rt[Ue]<64&&Rt[Ue]>=32&&vJ?(t=vJ(Rt,Ue,mu,Rn),Rt=null,!(e&&e.lazy)&&t&&(t=t.toJSON()),Ue=mu):t=Zs(),To&&(Ue=To.postBundlePosition,To=null),vf&&(Br.restoreStructures=null),Ue==mu)Br&&Br.restoreStructures&&cJ(),Br=null,Rt=null,gf&&(gf=null);else{if(Ue>mu)throw new Error("Unexpected end of MessagePack data");if(!vf){let i;try{i=JSON.stringify(t,(r,n)=>typeof n=="bigint"?`${n}n`:n).slice(0,100)}catch(r){i="(JSON view not available "+r+")"}throw new Error("Data read, but end of buffer not reached "+i)}}return t}catch(t){throw Br&&Br.restoreStructures&&cJ(),U7(),(t instanceof RangeError||t.message.startsWith("Unexpected end of buffer")||Ue>mu)&&(t.incomplete=!0),t}}function cJ(){for(let e in Br.restoreStructures)Br[e]=Br.restoreStructures[e];Br.restoreStructures=null}function Zs(){let e=Rt[Ue++];if(e<160){if(e<128){if(e<64)return e;{let t=Br[63&e]||Rn.getStructures&&x1e()[63&e];return t?(t.read||(t.read=B7(t,63&e)),t.read()):e}}if(e<144){if(e-=128,Rn.mapsAsObjects){let t={};for(let i=0;i<e;i++){let r=S1e();r==="__proto__"&&(r="__proto_"),t[r]=Zs()}return t}{let t=new Map;for(let i=0;i<e;i++)t.set(Zs(),Zs());return t}}{e-=144;let t=new Array(e);for(let i=0;i<e;i++)t[i]=Zs();return Rn.freezeData?Object.freeze(t):t}}if(e<192){let t=e-160;if(md>=Ue)return Sg.slice(Ue-Sh,(Ue+=t)-Sh);if(md==0&&mu<140){let i=t<16?pX(t):w1e(t);if(i!=null)return i}return qO(t)}{let t;switch(e){case 192:return null;case 193:return To?(t=Zs(),t>0?To[1].slice(To.position1,To.position1+=t):To[0].slice(To.position0,To.position0-=t)):E1e;case 194:return!1;case 195:return!0;case 196:if(t=Rt[Ue++],t===void 0)throw new Error("Unexpected end of buffer");return ZU(t);case 197:return t=Er.getUint16(Ue),Ue+=2,ZU(t);case 198:return t=Er.getUint32(Ue),Ue+=4,ZU(t);case 199:return M0(Rt[Ue++]);case 200:return t=Er.getUint16(Ue),Ue+=2,M0(t);case 201:return t=Er.getUint32(Ue),Ue+=4,M0(t);case 202:if(t=Er.getFloat32(Ue),Rn.useFloat32>2){let i=j7[(127&Rt[Ue])<<1|Rt[Ue+1]>>7];return Ue+=4,(i*t+(t>0?.5:-.5)|0)/i}return Ue+=4,t;case 203:return t=Er.getFloat64(Ue),Ue+=8,t;case 204:return Rt[Ue++];case 205:return t=Er.getUint16(Ue),Ue+=2,t;case 206:return t=Er.getUint32(Ue),Ue+=4,t;case 207:return Rn.int64AsType==="number"?(t=4294967296*Er.getUint32(Ue),t+=Er.getUint32(Ue+4)):Rn.int64AsType==="string"?t=Er.getBigUint64(Ue).toString():Rn.int64AsType==="auto"?(t=Er.getBigUint64(Ue),t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=Er.getBigUint64(Ue),Ue+=8,t;case 208:return Er.getInt8(Ue++);case 209:return t=Er.getInt16(Ue),Ue+=2,t;case 210:return t=Er.getInt32(Ue),Ue+=4,t;case 211:return Rn.int64AsType==="number"?(t=4294967296*Er.getInt32(Ue),t+=Er.getUint32(Ue+4)):Rn.int64AsType==="string"?t=Er.getBigInt64(Ue).toString():Rn.int64AsType==="auto"?(t=Er.getBigInt64(Ue),t>=BigInt(-2)<<BigInt(52)&&t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=Er.getBigInt64(Ue),Ue+=8,t;case 212:if(t=Rt[Ue++],t==114)return G7(63&Rt[Ue++]);{let i=_o[t];if(i)return i.read?(Ue++,i.read(Zs())):i.noBuffer?(Ue++,i()):i(Rt.subarray(Ue,++Ue));throw new Error("Unknown extension "+t)}case 213:return t=Rt[Ue],t==114?(Ue++,G7(63&Rt[Ue++],Rt[Ue++])):M0(2);case 214:return M0(4);case 215:return M0(8);case 216:return M0(16);case 217:return t=Rt[Ue++],md>=Ue?Sg.slice(Ue-Sh,(Ue+=t)-Sh):C1e(t);case 218:return t=Er.getUint16(Ue),md>=(Ue+=2)?Sg.slice(Ue-Sh,(Ue+=t)-Sh):R1e(t);case 219:return t=Er.getUint32(Ue),md>=(Ue+=4)?Sg.slice(Ue-Sh,(Ue+=t)-Sh):P1e(t);case 220:return t=Er.getUint16(Ue),Ue+=2,pJ(t);case 221:return t=Er.getUint32(Ue),Ue+=4,pJ(t);case 222:return t=Er.getUint16(Ue),Ue+=2,fJ(t);case 223:return t=Er.getUint32(Ue),Ue+=4,fJ(t);default:if(e>=224)return e-256;if(e===void 0){let i=new Error("Unexpected end of MessagePack data");throw i.incomplete=!0,i}throw new Error("Unknown MessagePack token "+e)}}}function B7(e,t){function i(){if(i.count++>z7){let n;try{n=e.read=new Function("r","return function(){return "+(Rn.freezeData?"Object.freeze":"")+"({"+e.map(s=>s==="__proto__"?"__proto_:r()":A1e.test(s)?s+":r()":"["+JSON.stringify(s)+"]:r()").join(",")+"})}")(Zs)}catch{return z7=1/0,i()}return e.read0=n,e.highByte===0&&(e.read=k7(t,e.read)),n()}let r={};for(let n=0,s=e.length;n<s;n++){let a=e[n];a==="__proto__"&&(a="__proto_"),r[a]=Zs()}return Rn.freezeData?Object.freeze(r):r}return i.count=0,e.read0=i,e.highByte===0?k7(t,i):i}function x1e(){let e=M1e(()=>(Rt=null,Rn.getStructures()));return Br=Rn._mergeStructures(e,Br)}function xM(e){let t;if(e<16&&(t=pX(e)))return t;if(e>64&&F7)return F7.decode(Rt.subarray(Ue,Ue+=e));let i=Ue+e,r=[];for(t="";Ue<i;){let n=Rt[Ue++];if(128&n)if((224&n)==192){let s=(31&n)<<6|63&Rt[Ue++];s<128?r.push(65533):r.push(s)}else if((240&n)==224){let s=(31&n)<<12|(63&Rt[Ue++])<<6|63&Rt[Ue++];s<2048||s>=55296&&s<=57343?r.push(65533):r.push(s)}else if((248&n)==240){let s=(7&n)<<18|(63&Rt[Ue++])<<12|(63&Rt[Ue++])<<6|63&Rt[Ue++];s<65536||s>1114111?r.push(65533):(s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|1023&s),r.push(s))}else r.push(65533);else r.push(n);r.length>=4096&&(t+=wa.apply(String,r),r.length=0)}return r.length>0&&(t+=wa.apply(String,r)),t}function pJ(e){let t=new Array(e);for(let i=0;i<e;i++)t[i]=Zs();return Rn.freezeData?Object.freeze(t):t}function fJ(e){if(Rn.mapsAsObjects){let t={};for(let i=0;i<e;i++){let r=S1e();r==="__proto__"&&(r="__proto_"),t[r]=Zs()}return t}{let t=new Map;for(let i=0;i<e;i++)t.set(Zs(),Zs());return t}}function w1e(e){let t=Ue,i=new Array(e);for(let r=0;r<e;r++){let n=Rt[Ue++];if((128&n)>0)return void(Ue=t);i[r]=n}return wa.apply(String,i)}function pX(e){if(e<4){if(e<2){if(e===0)return"";{let t=Rt[Ue++];return(128&t)>1?void(Ue-=1):wa(t)}}{let t=Rt[Ue++],i=Rt[Ue++];if((128&t)>0||(128&i)>0)return void(Ue-=2);if(e<3)return wa(t,i);let r=Rt[Ue++];return(128&r)>0?void(Ue-=3):wa(t,i,r)}}{let t=Rt[Ue++],i=Rt[Ue++],r=Rt[Ue++],n=Rt[Ue++];if((128&t)>0||(128&i)>0||(128&r)>0||(128&n)>0)return void(Ue-=4);if(e<6){if(e===4)return wa(t,i,r,n);{let s=Rt[Ue++];return(128&s)>0?void(Ue-=5):wa(t,i,r,n,s)}}if(e<8){let s=Rt[Ue++],a=Rt[Ue++];if((128&s)>0||(128&a)>0)return void(Ue-=6);if(e<7)return wa(t,i,r,n,s,a);let o=Rt[Ue++];return(128&o)>0?void(Ue-=7):wa(t,i,r,n,s,a,o)}{let s=Rt[Ue++],a=Rt[Ue++],o=Rt[Ue++],l=Rt[Ue++];if((128&s)>0||(128&a)>0||(128&o)>0||(128&l)>0)return void(Ue-=8);if(e<10){if(e===8)return wa(t,i,r,n,s,a,o,l);{let u=Rt[Ue++];return(128&u)>0?void(Ue-=9):wa(t,i,r,n,s,a,o,l,u)}}if(e<12){let u=Rt[Ue++],h=Rt[Ue++];if((128&u)>0||(128&h)>0)return void(Ue-=10);if(e<11)return wa(t,i,r,n,s,a,o,l,u,h);let d=Rt[Ue++];return(128&d)>0?void(Ue-=11):wa(t,i,r,n,s,a,o,l,u,h,d)}{let u=Rt[Ue++],h=Rt[Ue++],d=Rt[Ue++],c=Rt[Ue++];if((128&u)>0||(128&h)>0||(128&d)>0||(128&c)>0)return void(Ue-=12);if(e<14){if(e===12)return wa(t,i,r,n,s,a,o,l,u,h,d,c);{let p=Rt[Ue++];return(128&p)>0?void(Ue-=13):wa(t,i,r,n,s,a,o,l,u,h,d,c,p)}}{let p=Rt[Ue++],f=Rt[Ue++];if((128&p)>0||(128&f)>0)return void(Ue-=14);if(e<15)return wa(t,i,r,n,s,a,o,l,u,h,d,c,p,f);let m=Rt[Ue++];return(128&m)>0?void(Ue-=15):wa(t,i,r,n,s,a,o,l,u,h,d,c,p,f,m)}}}}}function mJ(){let e,t=Rt[Ue++];if(t<192)e=t-160;else switch(t){case 217:e=Rt[Ue++];break;case 218:e=Er.getUint16(Ue),Ue+=2;break;case 219:e=Er.getUint32(Ue),Ue+=4;break;default:throw new Error("Expected string")}return xM(e)}function ZU(e){return Rn.copyBuffers?Uint8Array.prototype.slice.call(Rt,Ue,Ue+=e):Rt.subarray(Ue,Ue+=e)}function M0(e){let t=Rt[Ue++];if(_o[t]){let i;return _o[t](Rt.subarray(Ue,i=Ue+=e),r=>{Ue=r;try{return Zs()}finally{Ue=i}})}throw new Error("Unknown extension type "+t)}function S1e(){let e=Rt[Ue++];if(!(e>=160&&e<192))return Ue--,T1e(Zs());if(e-=160,md>=Ue)return Sg.slice(Ue-Sh,(Ue+=e)-Sh);if(!(md==0&&mu<180))return qO(e);let t,i=4095&(e<<5^(e>1?Er.getUint16(Ue):e>0?Rt[Ue]:0)),r=V7[i],n=Ue,s=Ue+e-3,a=0;if(r&&r.bytes==e){for(;n<s;){if(t=Er.getUint32(n),t!=r[a++]){n=1879048192;break}n+=4}for(s+=3;n<s;)if(t=Rt[n++],t!=r[a++]){n=1879048192;break}if(n===s)return Ue=n,r.string;s-=3,n=Ue}for(r=[],V7[i]=r,r.bytes=e;n<s;)t=Er.getUint32(n),r.push(t),n+=4;for(s+=3;n<s;)t=Rt[n++],r.push(t);let o=e<16?pX(e):w1e(e);return r.string=o??qO(e)}function T1e(e){if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean"||typeof e=="bigint")return e.toString();if(e==null)return e+"";if(Rn.allowArraysInMapKeys&&Array.isArray(e)&&e.flat().every(t=>["string","number","boolean","bigint"].includes(typeof t)))return e.flat().toString();throw new Error("Invalid property type for record: "+typeof e)}function M1e(e){yJ&&yJ();let t=mu,i=Ue,r=WO,n=Sh,s=md,a=Sg,o=HO,l=gf,u=To,h=new Uint8Array(Rt.slice(0,mu)),d=Br,c=Br.slice(0,Br.length),p=Rn,f=vf,m=e();return mu=t,Ue=i,WO=r,Sh=n,md=s,Sg=a,HO=o,gf=l,To=u,Rt=h,vf=f,(Br=d).splice(0,Br.length,...c),Rn=p,Er=new DataView(Rt.buffer,Rt.byteOffset,Rt.byteLength),m}function U7(){Rt=null,gf=null,Br=null}function xIe(e){e.unpack?_o[e.type]=e.unpack:_o[e.type]=e}var F7,Rt,mu,Ue,gJ,HO,WO,Rn,Br,Sg,Sh,md,To,gf,_o,Er,QU,E1e,vf,z7,vJ,yJ,wM,A1e,k7,qO,C1e,R1e,P1e,wa,V7,G7,JU,_J,bJ,xJ,j7,qC,wJ,SJ,TJ,H7,eF,sA,wIe=V(()=>{try{F7=new TextDecoder}catch{}Ue=0,HO=gJ=[],WO=0,Rn={},Sh=0,md=0,_o=[],QU={useRecords:!1,mapsAsObjects:!0},(E1e=new class{}).name="MessagePack 0xC1",vf=!1,z7=2,wM=class{constructor(e){e&&(e.useRecords===!1&&e.mapsAsObjects===void 0&&(e.mapsAsObjects=!0),e.sequential&&e.trusted!==!1&&(e.trusted=!0,!e.structures&&e.useRecords!=0&&(e.structures=[],e.maxSharedStructures||(e.maxSharedStructures=0))),e.structures?e.structures.sharedLength=e.structures.length:e.getStructures&&((e.structures=[]).uninitialized=!0,e.structures.sharedLength=0),e.int64AsNumber&&(e.int64AsType="number")),Object.assign(this,e)}unpack(e,t){if(Rt)return M1e(()=>(U7(),this?this.unpack(e,t):wM.prototype.unpack.call(QU,e,t)));!e.buffer&&e.constructor===ArrayBuffer&&(e=typeof Buffer<"u"?Buffer.from(e):new Uint8Array(e)),typeof t=="object"?(mu=t.end||e.length,Ue=t.start||0):(Ue=0,mu=t>-1?t:e.length),WO=0,md=0,Sg=null,HO=gJ,To=null,Rt=e;try{Er=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(i){throw Rt=null,e instanceof Uint8Array?i:new Error("Source must be a Uint8Array or Buffer but was a "+(e&&typeof e=="object"?e.constructor.name:typeof e))}if(this instanceof wM){if(Rn=this,this.structures)return Br=this.structures,WC(t);(!Br||Br.length>0)&&(Br=[])}else Rn=QU,(!Br||Br.length>0)&&(Br=[]);return WC(t)}unpackMultiple(e,t){let i,r=0;try{vf=!0;let n=e.length,s=this?this.unpack(e,n):qC.unpack(e,n);if(!t){for(i=[s];Ue<n;)r=Ue,i.push(WC());return i}if(t(s,r,Ue)===!1)return;for(;Ue<n;)if(r=Ue,t(WC(),r,Ue)===!1)return}catch(n){throw n.lastPosition=r,n.values=i,n}finally{vf=!1,U7()}}_mergeStructures(e,t){e=e||[],Object.isFrozen(e)&&(e=e.map(i=>i.slice(0)));for(let i=0,r=e.length;i<r;i++){let n=e[i];n&&(n.isShared=!0,i>=32&&(n.highByte=i-32>>5))}e.sharedLength=e.length;for(let i in t||[])if(i>=0){let r=e[i],n=t[i];n&&(r&&((e.restoreStructures||(e.restoreStructures=[]))[i]=r),e[i]=n)}return this.structures=e}decode(e,t){return this.unpack(e,t)}},A1e=/^[a-zA-Z_$][a-zA-Z\d_$]*$/,k7=(e,t)=>function(){let i=Rt[Ue++];if(i===0)return t();let r=e<32?-(e+(i<<5)):e+(i<<5),n=Br[r]||x1e()[r];if(!n)throw new Error("Record id is not defined for "+r);return n.read||(n.read=B7(n,e)),n.read()},qO=xM,C1e=xM,R1e=xM,P1e=xM,wa=String.fromCharCode,V7=new Array(4096),G7=(e,t)=>{let i=Zs().map(T1e),r=e;t!==void 0&&(e=e<32?-((t<<5)+e):(t<<5)+e,i.highByte=t);let n=Br[e];return n&&(n.isShared||vf)&&((Br.restoreStructures||(Br.restoreStructures=[]))[e]=n),Br[e]=i,i.read=B7(i,r),(i.read0||i.read)()},_o[0]=()=>{},_o[0].noBuffer=!0,_o[66]=e=>{let t=e.byteLength%8||8,i=BigInt(128&e[0]?e[0]-256:e[0]);for(let r=1;r<t;r++)i<<=BigInt(8),i+=BigInt(e[r]);if(e.byteLength!==t){let r=new DataView(e.buffer,e.byteOffset,e.byteLength),n=(s,a)=>{let o=a-s;if(o<=40){let d=r.getBigUint64(s);for(let c=s+8;c<a;c+=8)d<<=BigInt(64),d|=r.getBigUint64(c);return d}let l=s+(o>>4<<3),u=n(s,l),h=n(l,a);return u<<BigInt(8*(a-l))|h};i=i<<BigInt(8*(r.byteLength-t))|n(t,r.byteLength)}return i},JU={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError:typeof AggregateError=="function"?AggregateError:null},_o[101]=()=>{let e=Zs();if(!JU[e[0]]){let t=Error(e[1],{cause:e[2]});return t.name=e[0],t}return JU[e[0]](e[1],{cause:e[2]})},_o[105]=e=>{if(Rn.structuredClone===!1)throw new Error("Structured clone extension is disabled");let t=Er.getUint32(Ue-4);gf||(gf=new Map);let i,r=Rt[Ue];i=r>=144&&r<160||r==220||r==221?[]:r>=128&&r<144||r==222||r==223?new Map:(r>=199&&r<=201||r>=212&&r<=216)&&Rt[Ue+1]===115?new Set:{};let n={target:i};gf.set(t,n);let s=Zs();if(!n.used)return n.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},_o[112]=e=>{if(Rn.structuredClone===!1)throw new Error("Structured clone extension is disabled");let t=Er.getUint32(Ue-4),i=gf.get(t);return i.used=!0,i.target},_o[115]=()=>new Set(Zs()),_J=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(e=>e+"Array"),bJ=typeof globalThis=="object"?globalThis:window,_o[116]=e=>{let t=e[0],i=Uint8Array.prototype.slice.call(e,1).buffer,r=_J[t];if(!r){if(t===16)return i;if(t===17)return new DataView(i);throw new Error("Could not find typed array for code "+t)}return new bJ[r](i)},_o[120]=()=>{let e=Zs();return new RegExp(e[0],e[1])},xJ=[],_o[98]=e=>{let t=(e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3],i=Ue;return Ue+=t-e.length,To=xJ,(To=[mJ(),mJ()]).position0=0,To.position1=0,To.postBundlePosition=Ue,Ue=i,Zs()},_o[255]=e=>e.length==4?new Date(1e3*(16777216*e[0]+(e[1]<<16)+(e[2]<<8)+e[3])):e.length==8?new Date(((e[0]<<22)+(e[1]<<14)+(e[2]<<6)+(e[3]>>2))/1e6+1e3*(4294967296*(3&e[3])+16777216*e[4]+(e[5]<<16)+(e[6]<<8)+e[7])):e.length==12?new Date(((e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3])/1e6+1e3*((128&e[4]?-281474976710656:0)+1099511627776*e[6]+4294967296*e[7]+16777216*e[8]+(e[9]<<16)+(e[10]<<8)+e[11])):new Date("invalid"),j7=new Array(147);for(let e=0;e<256;e++)j7[e]=+("1e"+Math.floor(45.15-.30103*e));(qC=new wM({useRecords:!1})).unpack,qC.unpackMultiple,qC.unpack,wJ=new Float32Array(1),new Uint8Array(wJ.buffer,0,4)}),SIe=V(()=>{wIe(),oX(),cX(),s1(),S4(),n1(),SJ=[{Class:ai.prototype.constructor,type:1,write:e=>({...e}),read:e=>(Object.setPrototypeOf(e,ai.prototype),e)},{Class:Nt.prototype.constructor,type:2,write:e=>[...e],read:e=>(Object.setPrototypeOf(e,Nt.prototype),e)},{Class:Aa.prototype.constructor,type:3,write:e=>[...e],read:e=>(Object.setPrototypeOf(e,Aa.prototype),e)},{Class:VO.prototype.constructor,type:4,write:e=>e.id,read:e=>new VO(e)},{Class:I7.prototype.constructor,type:5,write:e=>e.data,read:e=>new I7(e)},{Class:Qs.prototype.constructor,type:6,write:e=>({...e}),read:e=>(Object.setPrototypeOf(e,Qs.prototype),e)}];for(let e of SJ)xIe(e);TJ=new wM({structuredClone:!0}),(H7||(H7={})).deserialize=function(e){return TJ.unpack(e)}}),TIe=V(()=>{SIe(),eF=e=>()=>{throw new Error(e+" is not available in the runtime build (decode-only CollabSerialize)")},sA={deserialize:H7.deserialize,serialize:eF("CollabSerialize.serialize"),checksum:eF("CollabSerialize.checksum")}}),Nr=V(()=>{E4(),gIe(),lX(),n1(),S4(),hX(),s1(),yIe(),_Ie(),b1e(),bIe(),oX(),TIe(),m1e(),cX()});function W7(e){return e==="MouseDown"||e==="MouseUp"||e==="KeyDown"||e==="KeyUp"||e==="Collision"||e==="Trigger"}var MJ,q7,ex,$C,tF,EJ,AJ,CJ,$7,X7,RJ,PJ,DJ,NJ,IJ,Y7,K7,OJ,LJ,BJ,UJ,D1e=V(()=>{var e,t,i;Nr(),le(),(e=MJ||(MJ={})).toEventUIType=function(r){return r.type==="Conditional"?r.condition.type==="Distance"?"Distance":"StateChange":r.type},e.fromEventUIType=function(r){return r==="Distance"||r==="StateChange"?"Conditional":r},q7={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"]},(r=>{r.is=function(n){return n.type==="MouseDown"||n.type==="MouseUp"||n.type==="MousePress"||n.type==="KeyDown"||n.type==="KeyUp"||n.type==="KeyPress"},r.defaultData=function(n){return n==="MouseDown"||n==="MouseUp"||n==="MousePress"?{type:n,mode:"Object",disabled:!1,name:"",actions:new Nt}:{type:n,disabled:!1,name:"",key:void 0,actions:new Nt}}})(ex||(ex={})),(r=>{r.propertyDefaultData=function(n){return{type:"Property",value:[n??null,"position","x"]}},r.valueDefaultData={type:"Literal",value:0}})($C||($C={})),(t=tF||(tF={})).comparisonDefaultData=function(r){return{type:"Comparison",operator:"==",lOperand:$C.propertyDefaultData(r),rOperand:{...$C.valueDefaultData}}},t.distanceDefaultData=function(r){return{type:"Distance",toObject:r??null,fromObject:r??null,distance:200}},t.stateDefaultData=function(r,n){return{type:"State",object:r??null,state:n??null}},(EJ||(EJ={})).isConditionalSubActions=function(r){return r.find(n=>n==="ifActions"||n==="elseActions")!==void 0},(r=>{r.is=function(n){return n.type==="Conditional"},r.defaultData=function(n){return{type:"Conditional",disabled:!1,name:"",inActions:new Nt,outActions:new Nt,condition:tF.distanceDefaultData(n)}}})(AJ||(AJ={})),(CJ||(CJ={})).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 Nt,drop:new Nt}},($7||($7={})).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 Nt},(X7||(X7={})).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},(r=>{r.is=function(n){return n.type==="MouseHover"},r.defaultData=function(){return{type:"MouseHover",disabled:!1,name:"",actions:new Nt}}})(RJ||(RJ={})),(r=>{r.is=function(n){return n.type==="Scroll"},r.defaultData=function(){return{type:"Scroll",disabled:!1,name:"",steps:100,trigger:"load",startFrom:"enter",enterAnchor:"top",startOffset:0,endAfter:400,actions:new Nt}}})(PJ||(PJ={})),(r=>{r.is=function(n){return n.type==="Start"},r.defaultData=function(){return{type:"Start",disabled:!1,name:"",actions:new Nt}}})(DJ||(DJ={})),(r=>{r.is=function(n){return n.type==="Collision"},r.defaultData=function(){return{type:"Collision",disabled:!1,name:"",target:"character",actions:new Nt}}})(NJ||(NJ={})),(r=>{r.is=function(n){return n.type==="Trigger"},r.defaultData=function(n,s){return{type:"Trigger",name:"",disabled:!1,target:"all",triggeringObjects:[],actions:new Nt,triggerZone:"box",position:s.toArray(),rotation:[0,0,0],size:n.toArray(),radius:n.length()/2,helperVisible:!0}}})(IJ||(IJ={})),(i=Y7||(Y7={})).defaultSizes={mobile:[480,480],tablet:[768,768],desktop:[1200,1200],custom:[769,1200]},i.is=function(r){return r.type==="Resize"},i.sizeToDevice=function(r){return typeof r=="string"?r:"custom"},i.deviceToSize=function(r){return typeof r=="string"?[...i.defaultSizes[r]]:[...r]},i.defaultData=function(){let r={size:"mobile",operator:"<",actions:new Nt},n={size:"tablet",operator:"<",actions:new Nt},s={size:[...i.defaultSizes.custom],operator:"<>",actions:new Nt},a=new Nt;return a.push({id:ht.generateUUID(),fi:0,data:r},{id:ht.generateUUID(),fi:1,data:n},{id:ht.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 Nt}},(r=>{r.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"]},r.is=function(n){return n.type==="VariableChange"},r.defaultData=function(){return{disabled:!1,type:"VariableChange",name:"",actions:new Nt,variableId:"",objectId:null,property:"Position X"}}})(K7||(K7={})),(r=>{r.is=function(n){return n.type==="API"},r.defaultData=function(){return{disabled:!1,type:"API",name:"",successActions:new Nt,errorActions:new Nt,userAPIId:""}}})(OJ||(OJ={})),(r=>{r.is=function(n){return n.type==="WEBHOOK"},r.defaultData=function(){return{disabled:!1,type:"WEBHOOK",name:"",actions:new Nt,userWebhookId:""}}})(LJ||(LJ={})),(r=>{r.is=function(n){return n.type==="AIAssistantListener"},r.defaultData=function(){return{disabled:!1,type:"AIAssistantListener",name:"",actions:new Nt,analysis:"average",analysisRange:[0,71],analysisSingle:0}}})(BJ||(BJ={})),(r=>{r.is=function(n){return n.type==="AIAssistantTrigger"},r.defaultData=function(){return{disabled:!1,description:"",name:"",type:"AIAssistantTrigger",actions:new Nt}}})(UJ||(UJ={}))});function FJ(e){let t=typeof e;return e!==null&&(t==="object"||t==="function")}function zJ(e){return typeof e=="string"&&e.length===36&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)}var a1,wx,N1e,eo,kJ,Bc,Og,aA,VJ,Sx,oa,kr,Z7,GJ,Tg,tw,jJ,HJ,WJ,qJ,$J,XJ,YJ,KJ,iF,ZJ,QJ,rF,JJ,eee,tee,nF,iee,sF,ree,nee,see,aee,oee,lee,hee,uee,dee,Ky,yf,Mg,Q7,J7,$O,XO,YO,KO,ZO,eH,tH,QO,iH,Tx,cee,aF,oF,rH,pee,JO,fee,mee,oA,gee,vee,yee,_ee,bee,xee,wee,See,Tee,A4,fX,os,is,Pb,I1e,lA,eL,Uv,nH,mX,tL,iL,sH,lf,lI,Xn,lF,gg,Dh=V(()=>{var e,t,i,r,n,s,a,o;a1="personal camera",wx="a218fcc3-276b-49b9-b485-49037fd14f5f",N1e=2500134,eo=5526619,(e=kJ||{}).x="x",e.y="y",e.z="z",kJ=e,(l=>{function u(c,p){return Math.pow(p[0]-c[0],2)+Math.pow(p[1]-c[1],2)}function h(c,p){return Math.sqrt(u(c,p))}function d(c,p,f){let m=l.sub(p,c),g=l.sub(f,c),v=l.dot(m,g)/l.dot(m,m),y=l.scalarMultiply(m,v);return l.add(c,y)}l.isEqual=function(c,p){return c[0]===p[0]&&c[1]===p[1]},l.lerp=function(c,p,f){return[c[0]+(p[0]-c[0])*f,c[1]+(p[1]-c[1])*f]},l.add=function(c,p){return[c[0]+p[0],c[1]+p[1]]},l.sub=function(c,p){return[c[0]-p[0],c[1]-p[1]]},l.multiply=function(c,p){return[c[0]*p[0],c[1]*p[1]]},l.divide=function(c,p){return[c[0]/p[0],c[1]/p[1]]},l.distanceSquared=u,l.distance=h,l.dot=function(c,p){return c[0]*p[0]+c[1]*p[1]},l.scalarMultiply=function(c,p){return[c[0]*p,c[1]*p]},l.projectionOnto=d,l.projectionOntoDistance=function(c,p,f){return h(c,d(c,p,f))},l.center=function(c,p){return[.5*(c[0]+p[0]),.5*(c[1]+p[1])]}})(Bc||(Bc={})),(t=Og||(Og={})).isEqual=function(l,u){return l[0]===u[0]&&l[1]===u[1]&&l[2]===u[2]},t.add=function(l,u){return[l[0]+u[0],l[1]+u[1],l[2]+u[2]]},t.sub=function(l,u){return[l[0]-u[0],l[1]-u[1],l[2]-u[2]]},t.div=function(l,u){return[l[0]/u[0],l[1]/u[1],l[2]/u[2]]},t.mul=function(l,u){return[l[0]*u[0],l[1]*u[1],l[2]*u[2]]},t.dist=function(l,u){return Math.hypot(l[0]-u[0],l[1]-u[1],l[2]-u[2])},t.lerp=function(l,u,h){return[l[0]+(u[0]-l[0])*h,l[1]+(u[1]-l[1])*h,l[2]+(u[2]-l[2])*h]},(i=aA||(aA={})).isEqual=function(l,u){return l[0]===u[0]&&l[1]===u[1]&&l[2]===u[2]&&l[3]===u[3]},i.lerp=function(l,u,h){return[l[0]+(u[0]-l[0])*h,l[1]+(u[1]-l[1])*h,l[2]+(u[2]-l[2])*h,l[3]+(u[3]-l[3])*h]},(l=>{let u=180/Math.PI,h=Math.PI/180;function d(p){return typeof p=="number"?p*u:p}function c(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[c(p[0]),c(p[1]),c(p[2])]}})(VJ||(VJ={})),(r=Sx||(Sx={})).identity=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],r.isEqual=function(l,u){for(let h=0;h<16;h++)if(l[h]!==u[h])return!1;return!0},r.simplify=function(l){return l??r.identity},r.applyMatrix4=function(l,u){let h=u.slice(0);for(let d=0,c=u.length;d<c;d+=3){let p=l[3]*u[d]+l[7]*u[d+1]+l[11]*u[d+2]+l[15];h[d]=(l[0]*u[d]+l[4]*u[d+1]+l[8]*u[d+2]+l[12])/p,h[d+1]=(l[1]*u[d]+l[5]*u[d+1]+l[9]*u[d+2]+l[13])/p,h[d+2]=(l[2]*u[d]+l[6]*u[d+1]+l[10]*u[d+2]+l[14])/p}return h},(n=oa||(oa={})).isRGB=function(l){return typeof l=="object"&&typeof l.r=="number"&&typeof l.g=="number"&&typeof l.b=="number"},n.white={r:1,g:1,b:1},n.red={r:1,g:0,b:0},n.black={r:0,g:0,b:0},n.toRgb255a1=function(l){return{r:Math.round(255*l.r),g:Math.round(255*l.g),b:Math.round(255*l.b),a:1}},n.clone=function(l){return{r:l.r,g:l.g,b:l.b}},n.fromHex=function(l){return{r:((l=Math.floor(l))>>16&255)/255,g:(l>>8&255)/255,b:(255&l)/255}},n.toHex=function(l){return 65536*Math.round(255*l.r)+256*Math.round(255*l.g)+Math.round(255*l.b)},n.equals=function(l,u){return l.r===u.r&&l.g===u.g&&l.b===u.b},n.equalsFixed=function(l,u){return l.r.toFixed(2)===u.r.toFixed(2)&&l.g.toFixed(2)===u.g.toFixed(2)&&l.b.toFixed(2)===u.b.toFixed(2)},n.lerp=function(l,u,h){return{r:l.r+(u.r-l.r)*h,g:l.g+(u.g-l.g)*h,b:l.b+(u.b-l.b)*h}},n.is=function(l){return!!FJ(l)&&"r"in l&&"g"in l&&"b"in l&&!("a"in l)},(s=kr||(kr={})).white={...oa.white,a:1},s.is=function(l){return!!FJ(l)&&"r"in l&&"g"in l&&"b"in l&&"a"in l},s.transparent={...oa.white,a:0},s.from0to1=function(l){return{r:l[0],g:l[1],b:l[2],a:l[3]}},s.fromHexAndA=function(l,u){return{...oa.fromHex(l),a:u}},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,u){return oa.equals(l,u)&&l.a===u.a},s.equalsFixed=function(l,u){return oa.equalsFixed(l,u)&&l.a.toFixed(2)===u.a.toFixed(2)},s.lerp=function(l,u,h){return{r:l.r+(u.r-l.r)*h,g:l.g+(u.g-l.g)*h,b:l.b+(u.b-l.b)*h,a:l.a+(u.a-l.a)*h}},s.toStyle=function({r:l,g:u,b:h,a:d}=s.white){return`rgba(${255*l}, ${255*u}, ${255*h}, ${d})`},(Z7||(Z7={})).identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1],pivot:[0,0,0],pivotRotation:[0,0,0]},(a=GJ||{})[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",GJ=a,(Tg||(Tg={})).defaultData={mass:1,stiffness:80,damping:10,velocity:0},(tw||(tw={})).defaultData={control1:[.5,0],control2:[.5,1]},(o=jJ||(jJ={})).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]}),MIe=V(()=>{var e,t;Nr(),D1e(),(HJ||(HJ={})).defaultData={type:"SwitchCamera",name:"",targetCamera:"",delay:0,animate:!0,duration:1e3,easing:4,runMode:"Normal"},(WJ||(WJ={})).defaultData={type:"SceneTransition",name:"",target:"",delay:0,duration:1,transition:"none"},(qJ||(qJ={})).defaultData={type:"Link",name:"",url:null,context:"tab"},($J||($J={})).defaultData={type:"Destroy",name:"",objects:[],delay:0},(XJ||(XJ={})).defaultData={type:"Particles",name:"",emitterObjectId:"",delay:0,emission:"start",triggerAfter:"any"},(YJ||(YJ={})).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"},(KJ||(KJ={})).defaultData={type:"Reset",name:"",delay:0},(iF||(iF={})).defaultData={interaction:"play",delay:0,volume:.5,loop:1},(e=ZJ||(ZJ={})).pauseDefaultData={interaction:"pause",delay:0},e.stopDefaultData={interaction:"stop",delay:0},(t=QJ||(QJ={})).defaultData={type:"Audio",name:"",...iF.defaultData},t.hasAudioByActions=i=>i.some(({data:r})=>r.type==="Audio"&&r.interaction==="play"&&r.audio),t.hasAudioByEvents=i=>{for(let{data:r}of i)if(ex.is(r)||r.type==="Start"||r.type==="Collision"){if(t.hasAudioByActions(r.actions))return!0}else if(r.type==="Conditional"){if(t.hasAudioByActions(r.inActions)||t.hasAudioByActions(r.outActions))return!0}else if(r.type==="GameControl"&&Object.values(r.gameActions).find(n=>t.hasAudioByActions(n)))return!0},t.getAudiosByActions=i=>{let r=[];return i.forEach(n=>{let s=n.data;s.type==="Audio"&&s.interaction==="play"&&s.audio&&r.push(n),s.type==="Conditional"&&(r.push(...t.getAudiosByActions(s.ifActions)),r.push(...t.getAudiosByActions(s.elseActions)))}),r},t.getAudiosByEvents=i=>{let r=[];return i.forEach(({data:n})=>{ex.is(n)||n.type==="Collision"||n.type==="Start"||n.type==="Trigger"?r.push(...t.getAudiosByActions(n.actions)):n.type==="Conditional"?(r.push(...t.getAudiosByActions(n.inActions)),r.push(...t.getAudiosByActions(n.outActions))):n.type==="GameControl"?Object.values(n.gameActions).forEach(s=>{r.push(...t.getAudiosByActions(s))}):n.type==="DragDrop"&&(r.push(...t.getAudiosByActions(n.dragDropActions.drag)),r.push(...t.getAudiosByActions(n.dragDropActions.drop)))}),r},(rF||(rF={})).defaultData={interaction:"play",delay:0,volume:.5,loop:1/0},(i=>{i.pauseDefaultData={interaction:"pause",delay:0},i.stopDefaultData={interaction:"stop",delay:0}})(JJ||(JJ={})),(i=>{i.defaultData={type:"Video",name:"",triggerAfter:"autoplay",...rF.defaultData},i.hasVideoByActions=r=>r.some(({data:n})=>n.type==="Video"&&n.interaction==="play"&&n.layerId),i.hasVideoByObject=r=>{if(r.events){for(let{data:n}of r.events)if((ex.is(n)||n.type==="Start")&&i.hasVideoByActions(n.actions))return!0}},i.getVideosByActions=r=>{let n=[];return r.forEach(s=>{let a=s.data;a.type==="Video"&&a.interaction==="play"&&a.layerId&&n.push(s)}),n},i.getVideosByEvents=r=>{let n=[];return r.forEach(({data:s})=>{(ex.is(s)||s.type==="Start")&&n.push(...i.getVideosByActions(s.actions))}),n}})(eee||(eee={})),(tee||(tee={})).defaultData=function(i){return{state:i,repeat:0,delay:0,delayDirection:"start-once",direction:"normal",duration:1e3,easing:4}},(nF||(nF={})).defaultData=function(){return{tweens:new Nt,repeat:0,delay:0,delayDirection:"start-once",direction:"normal"}},(iee||(iee={})).defaultData=function(i){return{type:"Transition",name:"",runMode:"Once",object:i??null,...nF.defaultData()}},(sF||(sF={})).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}})(ree||(ree={})),(nee||(nee={})).defaultData=function(i){return{type:"TimelineAnimation",name:"",...sF.defaultData(i)}},(see||(see={})).defaultData=function(i,r,n){return{type:"Animation",name:"",object:i,clipId:r,crop:n,crop2:n,repeat:-1,delay:0,delayDirection:"start-once",direction:"normal",runMode:"Normal"}},(aee||(aee={})).defaultData={type:"SetVariable",name:"",variableId:"",expression:[]},(oee||(oee={})).defaultData=()=>({type:"Conditional",name:"",ifActions:new Nt,elseActions:new Nt,condition:[]}),(lee||(lee={})).defaultData={type:"DynamicVariablePlay",name:"",variableId:"",mode:"PlayPause",delay:0,pauseDelay:0},(hee||(hee={})).defaultData={type:"ClearLocalStorage",name:"",target:"all"},(uee||(uee={})).defaultData={name:"",type:"UserAPI"}}),EIe=V(()=>{var e;(e=dee||(dee={})).emptyAudio={data:Uint8Array.from(atob("UklGRjIAAABXQVZFZm10IBIAAAABAAEAQB8AAEAfAAABAAgAAABmYWN0BAAAAAAAAABkYXRhAAAAAA=="),t=>t.charCodeAt(0)),mimeType:"audio/wav",filename:"unknown"},e.maxSize=2e6}),O1e=V(()=>{var e;(e=Ky||(Ky={})).all=["PerspectiveCamera","OrthographicCamera"],e.is=function(t){return e.all.includes(t)},(t=>{t.DefaultUp=[0,1,0],t.DefaultTargetOffset=1e3,t.MinTargetOffset=.001,t.sanitizeTargetOffset=function(s){return s===void 0||!Number.isFinite(s)||s<t.MinTargetOffset?t.DefaultTargetOffset:s},t.DefaultAzimuth=-24,t.DefaultElevation=15;let i=t.DefaultAzimuth*Math.PI/180,r=t.DefaultElevation*Math.PI/180,n=180/Math.PI;t.DefaultPosition=[t.DefaultTargetOffset*Math.sin(i)*Math.cos(r),t.DefaultTargetOffset*Math.sin(r),t.DefaultTargetOffset*Math.cos(i)*Math.cos(r)],t.DefaultRotation=[Math.atan2(-Math.sin(r),Math.cos(i)*Math.cos(r))*n,Math.asin(Math.sin(i)*Math.cos(r))*n,Math.atan2(Math.sin(i)*Math.sin(r),Math.cos(i))*n],t.defaultData={far:1e5,type:"PerspectiveCamera",perspective:{near:70,fov:45,zoom:1},orthographic:{near:-1e5,zoom:1},up:t.DefaultUp,isUpVectorFlipped:!1,targetOffset:t.DefaultTargetOffset},t.getZoom=function(s){return s.type==="PerspectiveCamera"?s.perspective?.zoom??1:s.orthographic?.zoom??1}})(yf||(yf={}))}),L1e=V(()=>{var e;(e=Mg||(Mg={})).defaultData=function(t,i=.1){return{disabled:!1,type:"linear",hideBase:!1,instanced:!1,count:3,radial:{radius:2*Math.max(typeof t[0]=="number"?t[0]:1,typeof t[1]=="number"?t[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 t[0]=="number"?t[0]+t[0]:1)*i,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},grid:{count:[2,2,2],size:t.map(r=>(typeof r=="number"?r: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"}}},e.merge=function(t,i){let r={...t};if(J7.forEach(n=>{Object.assign(r,{[n]:i[n]??t[n]})}),r.radial={...t.radial},i.radial){let n=t.radial,s=i.radial;$O.forEach(a=>{Object.assign(r.radial,{[a]:s[a]??n[a]})})}if(r.linear={...t.linear},i.linear){let n=t.linear,s=i.linear;XO.forEach(a=>{Object.assign(r.linear,{[a]:s[a]??n[a]})})}if(r.grid={...t.grid},i.grid){let n=t.grid,s=i.grid;YO.forEach(a=>{Object.assign(r.grid,{[a]:s[a]??n[a]})})}if(r.toObject={...t.toObject},i.toObject){let n=t.toObject,s=i.toObject;KO.forEach(a=>{Object.assign(r.toObject,{[a]:s[a]??n[a]})})}if(r.randomnessObject={...t.randomnessObject},i.randomnessObject){let n=t.randomnessObject,s=i.randomnessObject;ZO.forEach(a=>{Object.assign(r.randomnessObject,{[a]:s[a]??n[a]})})}return r},e.isPartial=function(t){return!(!t.randomnessObject&&!t.toObject)},(t=>{t.defaultData={radial:{},linear:{},grid:{},toObject:{},randomnessObject:{}};let i=["radial","linear","grid","toObject","randomnessObject"];t.toOps=function(r,n){let s=[];r.count!==void 0&&s.push({type:0,path:n,props:{count:r.count}});for(let a of i){let o=r[a];o&&Object.keys(o).length>0&&s.push({type:0,path:[...n,a],props:o})}return s}})(Q7||(Q7={})),J7=["count"],$O=["radius","start","end","position","scale","rotation"],XO=["position","scale","rotation"],YO=["count","size"],KO=["count","position","scale","rotation"],ZO=["strength","scale","rotation","position","movement","seed","freqScale"]}),B1e=V(()=>{var e;Dh(),(e=eH||(eH={})).all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"],e.is=function(t){return e.all.includes(t)},(tH||(tH={})).defaultData=function(t){return function(i){if(i==="PointLight")return{type:i,color:kr.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,penumbraSize:.5,depth:1e5};if(i==="SpotLight")return{type:i,color:kr.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:kr.white,intensity:1,shadows:!0,size:2e3,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};throw new Error("not implemented")}(t)}}),U1e=V(()=>{var e;(e=QO||(QO={})).defaultShapeData={type:"PlaneEmitterShape",size:[100,100,100]},e.defaultCollisionData={colliderEntityId:null,collisionBounce:.75},e.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:e.defaultShapeData,autoPlay:!0,emitTimeDelay:0,emitTimeCycle:"infinity",emitTimeDuration:1,...e.defaultCollisionData}}),F1e=V(()=>{var e;(e=iH||(iH={})).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},e.regenProps=["hairLength","spreadRadius","guideStrands","headShape","baseObjectId"]}),gX=V(()=>{(Tx||(Tx={})).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]}}),z1e=V(()=>{var e,t;(e=cee||{})[e.Front=0]="Front",e[e.Back=1]="Back",e[e.Double=2]="Double",cee=e,(t=aF||(aF={})).defaultData={castShadow:!0,receiveShadow:!0},t.equals=function(i,r){return i.castShadow===r.castShadow&&i.receiveShadow===r.receiveShadow},(i=>{i.defaultData={flatShading:!1,wireframe:!1,side:0},i.equals=function(r,n){return r.flatShading===n.flatShading&&r.side===n.side&&r.wireframe===n.wireframe&&(r.shadowCatcher??!1)===(n.shadowCatcher??!1)}})(oF||(oF={})),(rH||(rH={})).defaultData={...oF.defaultData,...aF.defaultData},(pee||(pee={})).getMaterialData=function(i,r){let n=[];if("material"in i){let s=typeof i.material=="string"?r.materials[i.material]??r.lib.materials[i.material]?.asset:i.material;s&&n.push(s)}else if("materials"in i)for(let s of i.materials){let a=typeof s=="string"?r.materials[s]??r.lib.materials[s]?.asset:s;a&&n.push(a)}return n}}),k1e=V(()=>{var e;(e=JO||(JO={})).defaultVideo={data:"",thumb:"/_assets/_videos/catThumb.png",type:"video",name:"Cat video"},e.maxSize=3e7}),PA=V(()=>{var e,t,i,r;Nr(),Dh(),k1e(),Dh(),(fee||(fee={})).is=function(n){return n==="texture"||n==="video"||n==="color"||n==="depth"||n==="normal"||n==="gradient"||n==="noise"||n==="fresnel"||n==="cavity"||n==="dust"||n==="rainbow"||n==="toon"||n==="outline"||n==="particle"||n==="transmission"||n==="reflection"||n==="matcap"||n==="displace"||n==="pattern"||n==="vertexColor"||n==="light"},(mee||(mee={})).is=function(n){return n==="luminance"||n==="r"||n==="g"||n==="b"||n==="a"},(oA||(oA={})).is=function(n){return typeof n=="object"&&n!==null&&n.image!=null},(gee||(gee={})).is=function(n){return n==="phong"||n==="toon"||n==="lambert"||n==="physical"},(r=vee||{})[r.Linear=0]="Linear",r[r.Radial=1]="Radial",r[r.Polar=2]="Polar",vee=r,yee=(n=>(n[n.RepeatWrapping=1e3]="RepeatWrapping",n[n.ClampToEdgeWrapping=1001]="ClampToEdgeWrapping",n[n.MirroredRepeatWrapping=1002]="MirroredRepeatWrapping",n))(yee||{}),_ee=(n=>(n[n.NearestFilter=1003]="NearestFilter",n[n.LinearFilter=1006]="LinearFilter",n[n.LinearMipmapLinearFilter=1008]="LinearMipmapLinearFilter",n))(_ee||{}),(i=bee||{})[i.UV=0]="UV",i[i.Planar=1]="Planar",i[i.Spherical=2]="Spherical",i[i.Cylindrical=3]="Cylindrical",i[i.Triplanar=4]="Triplanar",bee=i,(t=xee||{})[t.Simplex=0]="Simplex",t[t.SimplexFractal=1]="SimplexFractal",t[t.Ashima=2]="Ashima",t[t.Fbm=3]="Fbm",t[t.Perlin=4]="Perlin",t[t.Voronoi=5]="Voronoi",xee=t,(e=wee||{})[e.F1=0]="F1",e[e.F2=1]="F2",e[e.F2MinusF1=2]="F2MinusF1",e[e.SmoothBlend=3]="SmoothBlend",e[e.Edge=4]="Edge",e[e.Power=5]="Power",e[e.Lines=6]="Lines",e[e.Cells=7]="Cells",wee=e,See=(n=>(n[n.Lights=0]="Lights",n[n.Static=1]="Static",n[n.Camera=2]="Camera",n))(See||{}),Tee=(n=>(n[n.Circle=0]="Circle",n[n.Ring=1]="Ring",n[n.Polygon=2]="Polygon",n[n.Cross=3]="Cross",n[n.Diamond=4]="Diamond",n[n.Checkerboard=5]="Checkerboard",n[n.Line=6]="Line",n[n.Wave=7]="Wave",n))(Tee||{}),A4=["mode","gradientType","noiseType","tracingMode","mirror","displacementType","projection","cnormal","crop","axis","side","roughnessMapChannel","metalnessMap","metalnessMapChannel","normalMap","aoMap","aoMapChannel","emissiveMap","style"],fX=["wrapping","image","video","name","minFilter","magFilter"],(n=>{n.patch=function(s,a){let{texture:o,...l}=a;if(Object.assign(s,l),o){let u=s.texture;u&&Object.assign(u,o)}},n.defaultColorLayer=function(s){return{...n.defaultData("color"),color:s}},n.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:JO.defaultVideo,wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"color":return{...l,type:"color",color:oa.fromHex(eo)};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:{...oa.fromHex(6710886),a:1},colorB:{...oa.fromHex(6710886),a:1},colorC:{...oa.fromHex(16777215),a:1},colorD:{...oa.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:kr.fromHexAndA(16777215,1),bias:.1,scale:1,intensity:2,factor:1};case"dust":return{...l,type:"dust",color:kr.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:kr.fromHexAndA(0,0),offset:[0,0,0]};case"outline":return{...l,type:"outline",outlineColor:kr.fromHexAndA(0,1),contourColor:kr.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:{...oa.fromHex(0),a:1},colorB:{...oa.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)}})(os||(os={})),(n=>{function s(a,o="layer1",l="layer2",u=oa.fromHex(16777215)){let h=new Nt;return h.push({fi:0,data:os.defaultData("light",a),id:o}),h.push({fi:1,data:os.defaultData("color"),id:l}),{layers:h}}n.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")},n.getHash=function(a){let o="";return a.layers.forEach(l=>{Object.entries(l.data).forEach(([u,h])=>{o+=`${u}${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},n.defaultEmptyData=function(){return{layers:new Nt}},n.defaultData=function(a="layer1",o="layer2"){return s("physical",a,o)},n.withName=function(a,o){return{...a,name:o}},n.defaultTwoLayerData=s,n.defaultColorMaterial=function(a,o,l="layer1",u="layer2"){let h=new Nt;return h.push({fi:0,data:os.defaultData("light",o),id:l}),h.push({fi:1,data:os.defaultColorLayer(a),id:u}),{layers:h}},n.defaultUIObjectMaterial=function(a){let o=os.defaultData("texture");a&&Object.assign(o.texture,{image:a});let l=new Nt;return l.push({fi:0,data:o,id:"layer1"}),l.push({fi:1,data:{...os.defaultData("transmission"),alpha:1},id:"layer2"}),l.push({fi:2,data:{...os.defaultData("light","lambert"),alpha:0},id:"layer3"}),{layers:l}},n.defaultTwoLayerTextureData=function(a,o="physical",l="layer1",u="layer2"){let h=os.defaultData("texture");Object.assign(h.texture,{image:a});let d=new Nt;return d.push({fi:0,data:h,id:l}),d.push({fi:1,data:os.defaultData("light",o),id:u}),{layers:d}},n.defaultTwoLayerVideoTextureData=function(a,o="physical",l="layer1",u="layer2"){let h=os.defaultData("video");Object.assign(h.texture,{video:a});let d=new Nt;return d.push({fi:0,data:h,id:l}),d.push({fi:1,data:os.defaultData("light",o),id:u}),{layers:d}}})(is||(is={}))}),AIe=V(()=>{Pb="Roboto_regular",I1e="https://fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Me5WZLCzYlKw.ttf"}),V1e=V(()=>{Nr(),(lA||(lA={})).defaultData=function(){return{points:new Nt,roundness:0,shapeHoles:[],isClosed:!1}}}),G1e=V(()=>{Nr(),(eL||(eL={})).defaultData=function(){return{points:new Nt,lastInsertionPlane:null,subdivisions:12,isClosed:!1,subdivisionMode:"parametric"}},Uv={type:"Ellipse",width:50,height:50,spikes:16,angle:360,innerRadius:0},(nH||(nH={})).merge=function(e,t){let i={...e};return tL.forEach(r=>{Object.assign(i,{[r]:t[r]??e[r]})}),i},mX={shape:Uv,depth:1,offset:0,bevel:50,bevelSides:6,angle:0,twist:0,startScale:1,endScale:1,capType:"flat"},tL=["depth","offset","angle","twist","startScale","endScale"]}),vX=V(()=>{var e,t;V1e(),G1e(),(e=iL||(iL={})).is2DParametricMesh=function(i){return i==="PolygonGeometry"||i==="RectangleGeometry"||i==="StarGeometry"||i==="TriangleGeometry"||i==="EllipseGeometry"||i==="UIGeometry"},e.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"},e.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"},(sH||(sH={})).merge=function(i,r){let n={...i};return Object.assign(n,r),n.type==="PathGeometry"&&"extrusion"in r&&r.extrusion&&(n.extrusion={...i.extrusion},Object.assign(n.extrusion,nH.merge(n.extrusion,r.extrusion))),n},(t=lf||(lf={})).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:eL.defaultData(),extrusion:mX};if(i==="VectorGeometry")return{width:1,height:1,type:i,subdivisions:12,shape:lA.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,projection:"all",projectionTargets:[]};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{...t.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")},lI=["width","height","depth"]}),j1e=V(()=>{Dh(),(e=>{function t(i){return i.mode??"linear"}e.defaultData={enabled:!1,useBackgroundColor:!1,color:oa.white,near:.1,far:2e3,mode:"linear",density:.005,heightFalloff:.01,heightBase:0},e.getMode=t,e.getModeIndex=function(i){let r=t(i);return r==="height"?1:r==="both"?2:0},e.getDensity=function(i){return i.density??e.defaultData.density},e.getHeightFalloff=function(i){return i.heightFalloff??e.defaultData.heightFalloff},e.getHeightBase=function(i){return i.heightBase??e.defaultData.heightBase}})(Xn||(Xn={}))}),yX=V(()=>{(lF||(lF={})).defaultData={image:null,rotation:0,blur:32,showBackground:!0},(gg||(gg={})).defaultData={enabled:!1,mode:"hdri",hdri:lF.defaultData,timeOfDay:10,weather:"partlyCloudy",lighting:!0,lightingIntensity:1,lightingQuality:"full",clouds:!0,windSpeed:2,animateWind:!0,exposure:1,seed:2}});function CIe(e){let t=typeof e=="string"?Number.parseInt(e,10):e;return typeof t=="number"&&Number.isFinite(t)?Math.min(5,Math.max(0,Math.round(t))):3}var hA,dy,hF,uF,dF,Mx,cF,aH,oH,Mee,k1,H1e,na,rL,Eee,Aee,Cee,Ree,yc,gE,nL,sL,_f,cy,Pee,Eg,aL,bf,pF,fF,$v,Zy,Xv,vE,lH,Dee,Eo,mF,Nee,Iee,hf,fu,Ex,hH,W1e=V(()=>{(()=>{let e={opacity:1,blendFunction:13,enabled:!1};(hA||(hA={})).defaultData={enabled:!1,pixelation:{...e,blendFunction:16,granularity:15},bloom:{...e,blendFunction:16,intensity:1,blurScale:1,luminanceThreshold:.25,luminanceSmoothing:.025,kernelSize:3},chromaticAberration:{...e,offset:[2,2]},vignette:{...e,darkness:1,offset:0},hueSaturation:{...e,hue:3,saturation:0},brightnessContrast:{...e,brightness:.25,contrast:0},depthOfField:{...e,focusDistance:100,focalLength:20,bokehScale:5},noise:{...e,blendFunction:16}}})()}),_X=V(()=>{var e;j1e(),yX(),W1e(),Dh(),(e=dy||(dy={})).defaultData={type:"normal",softShadowQuality:"low"},e.isSoft=function(t){return t!=null&&(t.type===void 0||t.type==="soft")},(hF||(hF={})).defaultData={enabled:!0,color:{r:.8274509803921568,g:.8274509803921568,b:.8274509803921568},intensity:.75},(uF||(uF={})).defaultData={occlusion:!1,aoFullRes:!1,radius:256,bias:.5,aoColor:{r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}},(t=>{t.defaultData={pipeline:"classic",toneMapping:"aces",exposure:1},t.isUntouched=function(i){return i===void 0||i.pipeline==="classic"&&(i.toneMapping==="none"||i.toneMapping==="aces")&&i.exposure===1}})(dF||(dF={})),(Mx||(Mx={})).defaultData={usePhysics:!1,gravity:-10},(cF||(cF={})).defaultData={playCamera:a1,gameControlObject:null},(aH||(aH={})).defaultData={backgroundColor:kr.fromHexAndA(N1e,1),postprocessing:hA.defaultData,fog:Xn.defaultData,sky:gg.defaultData,globalPhysics:Mx.defaultData,ambient:hF.defaultData,ao:uF.defaultData,shadow:dy.defaultData,publish:cF.defaultData,grading:dF.defaultData}}),RIe=V(()=>{(oH||(oH={})).defaultData={colliderType:"box",size:[100,100,100],colliderHelperVisible:!0,forceType:"collider",forceRange:"global",forceIntensity:.5,forceDambing:.95}}),C4=V(()=>{var e,t,i;Nr(),O1e(),B1e(),U1e(),F1e(),gX(),z1e(),Dh(),PA(),vX(),L1e(),ha(),_X(),RIe(),(e=Mee||(Mee={})).isComponentRelated=function(r){return r==="Component"||r==="Instance"},e.isEmptyOrComponent=function(r){return r==="Empty"||r==="Instance"},(t=k1||(k1={})).identity={...Z7.identity,hiddenMatrix:Sx.identity},t.fromObject=function(r){return{position:r.position,rotation:r.rotation,scale:r.scale,pivot:r.pivot,pivotRotation:r.pivotRotation,hiddenMatrix:r.hiddenMatrix}},t.merge=function(r,n){return{position:n?.position||r.position,rotation:n?.rotation||r.rotation,pivot:n?.pivot||r.pivot,pivotRotation:n?.pivotRotation||r.pivotRotation,scale:n?.scale||r.scale,hiddenMatrix:n?.hiddenMatrix||r.hiddenMatrix}},t.diff=function(r,n){return d1e({position:Og.isEqual(r.position,n.position)?void 0:n.position,rotation:Og.isEqual(r.rotation,n.rotation)?void 0:n.rotation,scale:Og.isEqual(r.scale,n.scale)?null:n.scale,hiddenMatrix:Sx.isEqual(r.hiddenMatrix,n.hiddenMatrix)?void 0:n.hiddenMatrix})},H1e=["slide","offset"],(na||(na={})).defaultData={states:new Nt,events:new Nt,visible:!0,raycastLock:!1,physics:Tx.defaultData,pathSnapping:{pathId:null,slide:0,offset:0,orientation:"tangential"},...k1.identity,cloner:null},(rL||(rL={})).defaultData={type:"Empty",...na.defaultData},(Eee||(Eee={})).defaultData={type:"ParticleCollider",...oH.defaultData,...na.defaultData},(Aee||(Aee={})).defaultData={type:"Component",...na.defaultData},(Cee||(Cee={})).defaultData={type:"Particle",...na.defaultData,...QO.defaultData},(Ree||(Ree={})).defaultData={type:"Hair",...na.defaultData,...iH.defaultData},(yc||(yc={})).defaultData={type:"Mesh",...na.defaultData,...rH.defaultData},(gE||(gE={})).defaultData={...na.defaultData,...k1.identity,position:yf.DefaultPosition,rotation:yf.DefaultRotation,...yf.defaultData},(r=>{r.defaultData=function(n){return{...na.defaultData,...tH.defaultData(n)}},r.defaultDirectionalLightData={...r.defaultData("DirectionalLight"),position:[200,300,300],name:"Directional Light",intensity:.7}})(nL||(nL={})),(r=>{function n(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}}r.resolveWithDes=n,r.resolve=function(s,a,o=0){let l=n(s,a,o);if(l){let u=Object.keys(l);if(u.length===1&&u[0]==="descendants")return}return l}})(sL||(sL={})),(r=>{function n(s,a){return{...na.defaultData,...a,component:s,overrides:new Qs,physics:void 0,events:void 0,type:"Instance"}}r.rootOverrideProps=["physics","events"],r.compositeNonOptionalOverrideProps=["geometry"],r.compositeEntireOverrideOverrideProps=["material"],r.ofComponent=n,r.fromComponentData=function(s){let a=k1.fromObject(s.data);return n(s.id,a)}})(_f||(_f={})),(r=>{r.defaultData={type:"Page",...na.defaultData,physics:{...Tx.defaultData,fusedBody:!1},...aH.defaultData,camera:gE.defaultData,timelines:new ai},r.isUIPage=function(n){return n.uiScene!==void 0}})(cy||(cy={})),(i=Pee||(Pee={})).defaultCamera={position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0],hiddenMatrix:Sx.identity,name:"Play Camera",visible:!0,raycastLock:!1,physics:Tx.defaultData,states:new Nt,events:new Nt,cloner:null,pathSnapping:{pathId:null,orientation:"tangential",slide:0,offset:0},...yf.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",...na.defaultData,...yc.defaultData,geometry:lf.defaultData("RectangleGeometry"),material:is.defaultTwoLayerData("physical","layer1","layer2")},i.defaultBooleanObject={name:"Boolean",...na.defaultData,...yc.defaultData,geometry:lf.defaultData("BooleanGeometry"),material:is.defaultTwoLayerData("physical","layer1","layer2")},i.defaultShapeBlendObject={name:"Shape Blend",...na.defaultData,...yc.defaultData,geometry:lf.defaultData("ShapeBlendGeometry"),material:is.defaultTwoLayerData("physical","layer1","layer2")},i.defaultTextObject={name:"Text",...na.defaultData,...yc.defaultData,geometry:lf.defaultData("TextGeometry"),material:is.defaultTwoLayerData("physical","layer1","layer2")},i.defaultInputObject={name:"Input",...na.defaultData,...yc.defaultData,geometry:lf.defaultData("InputGeometry"),material:is.defaultTwoLayerData("physical","layer1","layer2")},(r=>{r.newEmpty=function(n,s){let a={name:s};return n.type==="Mesh"?(a.geometry={},"material"in n&&(a.material={layers:new Qs}),"materials"in n&&(a.materials=n.materials.map(o=>({layers:new Qs})))):Ky.is(n.type)&&(a.perspective={},a.orthographic={}),a},r.toOps=function(n,s){let a,o=[],l={orthographic:0,perspective:0,geometry:0};function u(h,d){for(let[c,p]of Object.entries(d.layers)){let{texture:f,...m}=p;if(f!==void 0&&Object.keys(f).length>0){let g={path:[...h,"layers",c,"texture"],props:f,type:0};o.push(g)}if(Object.keys(m).length>0){let g={path:[...h,"layers",c],props:m,type:0};o.push(g)}}}for(let[h,d]of Object.entries(s)){let c=d;if(h!=="name")if(h==="cloner")o.push(...Q7.toOps(c,["cloner"]));else if(h==="pathSnapping")o.push({path:[h],props:{slide:c.slide,offset:c.offset},type:0});else if(h==="material")u(["material"],c);else if(h==="materials")for(let[p,f]of Object.entries(c))u(["materials",p],f);else if(l[h]===0){if(h==="geometry"&&c.extrusion!==void 0){let p={path:[h,"extrusion"],props:c.extrusion,type:0};o.push(p),c={...c},delete c.extrusion}if(Object.keys(c).length>0){let p={path:[h],props:c,type:0};o.push(p)}}else a===void 0&&(a={path:[],props:{},type:0},o.push(a)),a.props[h]=c}return o},r.patch=function(n,s){if(s===void 0)return n;let a={...n};if(Object.assign(a,k1.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})}),Ky.is(n.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(n.type==="Mesh")"geometry"in s&&Object.assign(a,{geometry:sH.merge(a.geometry,s.geometry)}),(s.material||s.materials)&&(a=function(o,l){if(l===void 0)return o;let u={...o};return"material"in u&&"material"in l&&l.material&&(u.material=jO(u.material,h=>{if(typeof h!="string")for(let[d,c]of Object.entries(l.material.layers)){let p=h.layers.data(d);p&&os.patch(p,c)}}).data),u.materials&&l.materials&&(u.materials=jO(u.materials,h=>{for(let d=0;d<u.materials.length;d++){let c=l.materials[d];if(typeof c!="string")for(let[p,f]of Object.entries(c.layers)){let m=h[d]?.layers?.data(p);m&&os.patch(m,f)}}}).data),u}(a,s)),a.cloner&&"cloner"in s&&Object.assign(a,{cloner:Mg.merge(a.cloner,s.cloner)});else if(n.type==="Empty")a.cloner&&"cloner"in s&&Object.assign(a,{cloner:Mg.merge(a.cloner,s.cloner)});else if(eH.is(n.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=oa.clone(o.color))}return a}})(Eg||(Eg={}))}),bX=V(()=>{(aL||(aL={})).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}}),R4=V(()=>{bX(),Dh(),(bf||(bf={})).defaultData={orbitControls:aL.defaultData,playPage:wx,withBackground:!0,preventScroll:!1,preventTouchScroll:!1,hideCursor:!1,mouseEventTarget:"canvas",joystickSizeAndXYOffset:Array(12).fill(0).map((e,t)=>{let i=0,r=0;return t<5?r=-30:t<10&&(r=30),t===0||t===10||t===5?i=30:(t===4||t===11||t===9)&&(i=-30),[120,[i,r],"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}}),q1e=V(()=>{var e;(pF||(pF={})).defaultData={id:"basic",label:"Basic",style:"None",prompt:""},(fF||(fF={})).defaultData={weather:0,shadows:0,lightOrigin:0,temperature:0,sun:0,camera:0,environment:0,particles:0,nature:0,floor:0},(e=$v||($v={})).defaultData=()=>({mode:"line-art-both",prompt:"",negativePrompt:"",style:{...pF.defaultData},isRandomSeed:!0,seed:e.generateSeed(),guessMode:!1,advanced:!1,steps:20,guidanceScale:7.5,controlNetScale:1,modifiers:fF.defaultData}),e.generateSeed=()=>Math.round(1e5*Math.random())}),xX=V(()=>{C4(),Nr(),R4(),Dh(),ha(),q1e(),(e=>{function t(i,r){let n=i.scene.objects.get(r);if(n&&n.data.type==="Component")return n;{let s=i.shared.lib.components[r];if(s)return{...s.asset,id:r}}}e.physicsEnabled=function(i){return i.find(r=>r.data.type==="Page"&&r.data.globalPhysics.usePhysics)!==void 0},e.findTimeline=function(i,r){let n=i.find(s=>s.data.type==="Page"&&s.data.timelines?.[r]!==void 0);return n&&n.data.timelines?.[r]},e.getComponentData=t,e.traverseModuleInstances=function(i,r,n){i.scene.objects.traverseFrom(r,(s,a)=>{if(a.type==="Instance"){let o=t(i,a.component)?.data;o&&n(s,a,o.events)}else n(s,a,a.events)})}})(Zy||(Zy={})),(e=>{function t(r=!0,n=[]){let s=[];r&&s.push({...e.defaultLight}),s.push(...n);let a=new Aa;return a.push({fi:1,id:wx,data:{...cy.defaultData,name:"Scene 1"},children:s}),a}function i(r){return{...e.defaultData,objects:Ho(r,Aa.prototype)}}e.TRASH_CAN_ID="830a2708-8ed9-49cf-a68e-085299892222",e.defaultLight={fi:-1,data:nL.defaultDirectionalLightData,id:"830a2708-8ed9-49cf-a68e-085299899103",children:[]},e.createDefaultObjectTreeWithPage=t,e.defaultData={objects:t(),publish:bf.defaultData,styles:$v.defaultData()},e.emptyDataWithoutPage=function(){return{objects:new Aa,publish:bf.defaultData,styles:$v.defaultData()}},e.emptyDataWithPage=function(r=!0){return{objects:t(r),publish:bf.defaultData,styles:$v.defaultData()}},e.emptyData=function(){return{objects:new Aa,publish:{...bf.defaultData},styles:$v.defaultData()}},e.withObjs=i,e.withObj=function(r,n){return i([{id:r,data:n,children:[],fi:0}])}})(Xv||(Xv={}))}),$1e=V(()=>{(vE||(vE={})).defaultData={preset:"fullscreen",allowResponsive:!1,size:[512,512],coords:[0,0],sceneScale:1,color:{r:0,g:0,b:0,a:.5}}}),wX=V(()=>{var e,t;Nr(),ha(),(e=lH||(lH={})).defaultData=i=>({url:i,name:"New Webhook",parametersSchemas:new Nt}),e.defaultParameterValueByType=i=>i==="number"?0:i!=="boolean"&&"",(Dee||(Dee={})).defaultData=(i,r="GET")=>({url:i,method:r,name:"New API",headers:new Nt,queries:new Nt,autoStart:!0}),(i=>{function r(s){return s.textValue!==void 0}function n(s){return typeof s=="boolean"}i.isTextValue=r,i.isNumber=function(s){return typeof s=="number"},i.isBoolean=n,i.typeOfVariable=function(s){return r(s)?"string":n(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()}})(Eo||(Eo={})),(mF||(mF={})).all=["images","videos","colors","audios","particles","fonts","materials","variables"],(Nee||(Nee={})).all=[...mF.all,"components"],(Iee||(Iee={})).defaultData=function(){return{images:new ai,videos:new ai,colors:new ai,audios:new ai,particles:new ai,fonts:new ai,materials:new ai,components:new ai,variables:new ai,userAPIs:new ai,userWebhooks:new ai}},(hf||(hf={})).defaultData=function(){return{images:new ai,videos:new ai,colors:new ai,audios:new ai,particles:new ai,fonts:new ai,materials:new ai,components:new ai,variables:new ai,userAPIs:new ai,userWebhooks:new ai}},(t=fu||(fu={})).defaultColors=function(){return Ho({"89b10010-844c-11ec-a8a3-0242ac120002":{r:.5,g:.5,b:.5,a:1,name:"Default Color"}},ai.prototype)},t.defaultImages=function(){return Ho({},ai.prototype)},t.emptyData=function(){return{catelogs:new ai,materials:new ai,images:new ai,videos:new ai,colors:new ai,audios:new ai,particles:new ai,fonts:new ai,variables:new Nt,userAPIs:new ai,userWebhooks:new ai,lib:hf.defaultData()}},t.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 r=[0,0,0];return{name:"Time",value:{textValue:r,deliminator:":",padding:2,suffix:"AM"},dynamicVariableType:"time",format:"HH:mm:ss",format12h24h:"12ampm",timeZone:null,hasEnd:!1,endValue:{textValue:r,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)}},t.getFormattedTimerTime=function(i,r){if(r.format==="HH:mm:ss"){let n=Math.floor(i/3600),s=Math.floor((i-3600*n)/60);return{textValue:[n,s,Math.round(i-3600*n-60*s)]}}if(r.format==="mm:ss"){let n=Math.floor(i/60);return{textValue:[n,Math.round(i-60*n)]}}return r.format==="number"?Math.round(i):Math.round(1e3*i)/1e3}}),PIe=V(()=>{}),X1e=V(()=>{var e;Nr(),xX(),$1e(),wX(),(e=Ex||(Ex={})).defaultData={schema:131,scene:Xv.defaultData,frames:new ai().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",vE.defaultData),shared:{...fu.emptyData(),colors:fu.defaultColors()}},e.createDefaultData=function(){return sA.deserialize(sA.serialize(e.defaultData))},e.emptyDataForImports=function(){return{schema:131,scene:Xv.emptyDataWithPage(),frames:new ai().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",vE.defaultData),shared:{...fu.emptyData(),colors:fu.defaultColors(),images:fu.defaultImages()}}},e.emptyData=function(){return{schema:131,scene:Xv.emptyDataWithPage(),frames:new ai().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",vE.defaultData),shared:fu.emptyData()}},e.clipboard2dData=function(){return{schema:131,scene:Xv.emptyData(),frames:new ai,shared:fu.emptyData()}},e.withoutLib=function(t){return{...t,shared:{...t.shared,lib:hf.defaultData()}}},e.getComponentData=function(t,i){return Zy.getComponentData(t,i)},e.hasSensitiveData=function(t){let i=Object.values(t.shared.userAPIs);for(let r of i){let n=r.headers;for(let s of n)if(s.data.key.toLowerCase()==="authorization"&&s.data.value!=="")return!0}return!1}}),DIe=V(()=>{(hH||(hH={})).emptyImage={data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=",name:"empty"}});function py(e,t=[0,0]){return[e&&!isNaN(e[0])?e[0]:t[0],e&&!isNaN(e[1])?e[1]:t[1]]}function PS(e,t,i){switch(e){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:r,control2:n}=t??{...tw.defaultData};return`cubicBezier( ${r[0]}, ${r[1]}, ${n[0]}, ${n[1]} )`}case 6:{let{mass:r,stiffness:n,damping:s,velocity:a}=i??{...Tg.defaultData},o=new Y1e(r,n,s,a),l=o.solve(1);return()=>u=>o.solve(u)/l}case 8:return()=>r=>Math.floor(r)}}var Oee,Lee,fy,uA,Y1e,oL,lL,K1e=V(()=>{Nr(),Dh(),(Oee||(Oee={})).defaultData=function(e,t){return{id:e,name:t,duration:5,objectTimelines:new ai}},(Lee||(Lee={})).is=function(e){return e&&typeof e.x=="number"&&typeof e.y=="number"&&typeof e.z=="number"},(e=>{function t(h,d){let c=[0,0],p=[1,1];if(h?.cubicControls)c=py(h.cubicControls.control1,c);else switch(h?.type){case 2:case 4:c=[.42,0];break;case 3:case 0:c=[0,0];break;case 1:c=[.25,.1];break;case 7:c=[.25,1]}if(d?.cubicControls)p=py(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:c,control2:p}}function i(h){if(!e.BEZIER_PRESETS.includes(h))return;let d={type:h};return{control1:t(d).control1,control2:t(void 0,d).control2}}function r(h,d){return Math.abs(h[0]-d[0])<.001&&Math.abs(h[1]-d[1])<.001}function n(h){let d=e.ROOT_PROPERTY_ORDER.indexOf(h[0]);return d===-1?e.ROOT_PROPERTY_ORDER.length:d}function s(h){return h.layerId??h.path.join(".")}function a(h){let d=h[h.length-1];return uA.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 u(h,d,c){return{id:h,data:{id:h,time:c?.time??0,path:d,value:{},layerId:c?.layerId,index:c?.index,isPlaceholder:!0,easing:{type:5,cubicControls:{control1:[.42,0],control2:[.58,1]}}}}}e.getControlsWithDefault=t,e.BEZIER_PRESETS=[0,1,2,3,4,7],e.presetHandles=i,e.presetForHandles=function(h){return e.BEZIER_PRESETS.find(d=>{let c=i(d);return c!==void 0&&r(c.control1,h.control1)&&r(c.control2,h.control2)})},e.defaultData=function(h){return{id:h,keyframes:new Nt}},e.ROOT_PROPERTY_ORDER=["position","rotation","scale","shape size","material","opacity","camera","light","cloner","path extrusion","path snapping"],e.rowOrder=n,e.propertyKey=s,e.groupKeyframes=function(h,d){let c=new Map;for(let p of h){let f=p.data;if(d?.(f))continue;let m=s(f),g=c.get(m);g||(g={id:m,path:f.path,keyframes:[],layerId:f.layerId,index:f.index},c.set(m,g)),f.isPlaceholder?g.placeholder=p.id:g.keyframes.push(p)}return[...c.values()].sort((p,f)=>{let m=n(p.path)-n(f.path);return m!==0?m:(p.index??0)-(f.index??0)})},e.rowAxis=a,e.drawnRowKey=o,e.drawnRows=function(h){let d=new Map;for(let c of h){let p=a(c.path),f=p?c.path.slice(0,-1):c.path,m=o(c),g=d.get(m);g||(g={id:m,path:f,layerId:c.layerId,index:c.index,tracks:[]},d.set(m,g)),g.tracks.push({axis:p,property:c})}return[...d.values()]},e.sortedKeyframes=function(h){return[...h].sort((d,c)=>d.data.time-c.data.time)},e.materialLayerPath=l,e.createMaterialGroup=function(h,d){return h.map(({data:c,id:p},f)=>u(d(),l(c),{layerId:p,index:f}))},e.placeholderKeyframe=u,e.createName=function(h){return Object.entries(h).reduce((d,[c,p])=>(typeof p!="string"&&d.push({name:p.name}),d),[])},e.Presets=[{name:"Slide in",animationParams:{translateX:{value:[-20,0],easing:PS(3),duration:1e3},opacity:{value:[0,1],easing:PS(3),duration:1e3},endDelay:250,loop:!0}},{name:"Rotate",animationParams:{rotate:{value:[0,"1turn"],easing:PS(5),duration:700},endDelay:250,loop:!0}},{name:"Scale Out",animationParams:{scale:{value:[1,1.5],easing:PS(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:PS(5),duration:500},endDelay:500,loop:!0}},{name:"Bounce",animationParams:{translateY:{value:["20px","-20px"],duration:575,easing:"easeOutQuad"},direction:"alternate",loop:!0}}]})(fy||(fy={})),uA=["x","y","z"],Y1e=class{constructor(e=1,t=100,i=10,r=0){this.mass=e,this.stiffness=t,this.damping=i,this.initialVelocity=r,this.m_w0=Math.sqrt(t/e),this.m_zeta=i/(2*Math.sqrt(t*e)),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-r)/this.m_wd):(this.m_wd=0,this.m_A=1,this.m_B=-r+this.m_w0)}solve(e){return 1-(this.m_zeta<1?Math.exp(-e*this.m_zeta*this.m_w0)*(this.m_A*Math.cos(this.m_wd*e)+this.m_B*Math.sin(this.m_wd*e)):(this.m_A+this.m_B*e)*Math.exp(-e*this.m_w0))}getDuration(){let e=.16666666666666666,t=0,i=0;for(;;)if(t+=e,this.solve(t)===1){if(i++,i>=16)break}else i=0;return t*e*1e3}}}),SX=V(()=>{var e;Dh(),Nr(),(oL||(oL={})).list=["idle","move","jump","run"],(e=lL||(lL={})).defaultColliderData={type:"capsule",height:200,radius:50,position:[0,0,0],rotation:[0,0,0]},e.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:e.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 Nt,move:new Nt,jump:new Nt,run:new Nt},navmesh:{enabled:!1,ch:6,cs:6,walkableClimb:5,walkableHeight:1,walkableRadius:0,zones:"all",objects:[],helperVisible:!0,destinationHelperRadius:0,destinationHelperColor:kr.fromHexAndA(3728051,1)}}});function Cv(e,...t){let i={};for(let r of t.flat())e!=null&&r in e&&(i[r]=e[r]);return i}function Bee(e){e.layers.forEach(t=>{if(t.type==="depth"&&t.colorA!==void 0){let i=t.colorA,r=t.colorB,n=[[i.r,i.g,i.b,i.a],[r.r,r.g,r.b,r.a]],s=[0,1];for(let o=2;o<10;o++)n.push(n[1]),s.push(1);let a={...Cv($s(t),"type","visible","isVector","isWorldSpace","origin","alpha","mode"),near:Math.max(0,t.near),far:Math.max(0,t.far),colors:n,steps:s,num:2,direction:[1,0,0],smooth:!1,gradientType:1};Object.assign(t,a)}else if(t.type==="depth"&&t.gradientType===1&&(t.near<0||t.far<0)){let i={...$s(t),near:Math.max(t.near,0),far:Math.max(t.far,0)};Object.assign(t,i)}})}function $p(e,t){Object.values(e.shared.materials).forEach(i=>t(i))}function Xp(e,t){e.scene.objects.traverse((i,r)=>{"materials"in r?r.materials.forEach((n,s)=>{n===void 0&&(r.materials[s]=is.defaultTwoLayerData("phong"),n=r.materials[s]),typeof n!="string"&&t(n)}):"material"in r?typeof r.material!="string"&&(r.material===void 0&&(r.material=is.defaultTwoLayerData("phong")),t(r.material)):r.type==="Mesh"&&(r.material===void 0&&(r.material=is.defaultTwoLayerData("phong")),t(r.material)),"overrides"in r&&Object.values(r.overrides).forEach(n=>{n.material&&typeof n.material!="string"&&Object.getPrototypeOf(n.material)!==Qs.prototype&&t(n.material)})})}function Uee(e){e.layers===void 0&&Object.assign(e,is.defaultTwoLayerData("lambert"))}function gF(e){!e.layers||e.layers.forEach(t=>{if(t.type==="depth"&&t.colors.length===10){let i=[...t.colors];i.push(t.colors[9]);let r=[...t.steps];r.push(t.steps[9]);let n={...$s(t),colors:i,steps:r};Object.assign(t,n)}})}function Fee(e){e.scene.objects.traverse((t,i)=>{"materials"in i?i.materials.forEach(r=>{typeof r!="string"&&gF(r)}):"material"in i&&typeof i.material!="string"&&gF(i.material)}),Object.values(e.shared.materials).forEach(t=>gF(t))}function zee(e){e.layers&&e.layers.forEach(t=>{t.type==="depth"&&t.num!==void 0&&(t.colors=t.colors.slice(0,t.num),t.steps=t.steps.slice(0,t.num),delete t.num)})}function kee(e){e.layers&&e.layers.forEach(t=>{(function(i){return i.type!=="displace"})(t)&&t.isMask===void 0&&(t.isMask=!1),(t.type==="texture"||t.type==="video")&&t.blending===void 0&&(t.blending=0),(t.type==="noise"||t.type==="displace"&&t.displacementType==="noise")&&(t.voronoiStyle===void 0&&(t.voronoiStyle=0),t.highCut===void 0&&(t.highCut=1),t.lowCut===void 0&&(t.lowCut=0),t.smoothness===void 0&&(t.smoothness=.3),t.seed===void 0&&(t.seed=0),t.quality===void 0&&(t.quality=1))})}function Vee(e){let t=e.layers.find(i=>i.type==="light")?.data;if(t?.category==="basic"){let i=os.defaultData("light","phong"),r=t;Object.assign(r,i),r.visible=!1}}function Gee(e){$p(e,Vee),Xp(e,Vee)}function jee(e){e.layers.forEach(t=>{t.type==="light"&&t.category!=="toon"&&t.occlusion===void 0&&(t.occlusion=!0)})}function Hee(e){e.layers&&e.layers.forEach(t=>{t.type==="light"&&t.bumpMapIntensity===void 0&&(t.bumpMapIntensity=5)})}var NIe=V(()=>{PA(),Dh(),bX(),C4(),Nr(),R4(),ha(),le(),vX(),SX(),q1e(),xX(),gX(),_X()}),Z1e={};function Wee(e){e.layers&&e.layers.forEach(t=>{t.type==="light"&&t.alphaOverride===void 0&&(t.alphaOverride=1)})}function qee(e){e.rotation=e.rotation.slice(0,3).map(t=>t*Fv)}function Q1e(e){qee(e),e.type==="Page"&&qee(e.camera),e.states?.forEach(i=>{i.rotation===void 0||i.rotation===null||(i.rotation=i.rotation.slice(0,3).map(r=>r*Fv))});let t=e.geometry;t&&t.type==="SphereGeometry"&&(t.thetaLength=(t.thetaLength??180)*Fv),t&&t.type==="TorusGeometry"&&(t.arc=t.arc*Fv),t&&t.type==="PathGeometry"&&(t.extrusion.angle*=Fv,t.extrusion.twist*=Fv),e.type==="Mesh"&&e.geometry.type==="TextGeometry"&&(e.geometry.text={textValue:e.geometry.text}),Array.isArray($s(e.events))&&e.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 IIe(e){e.scene.objects.traverse((t,i)=>{})}function OIe(e){let t=e.schema??104;t!==131&&t<130&&(hL(e.asset),e.schema=130)}function tx(e,t){t(e.data);for(let i of e.children)tx(i,t)}function J1e(e){let t=e.schema??104;t!==131&&(t<105&&(tx(e.asset,Q1e),e.schema=105),t<118&&(tx(e.asset,t_e),e.schema=118),t<121&&(tx(e.asset,dH),e.schema=121),t<130&&(tx(e.asset,LIe),e.schema=130))}function e_e(e,t){Xp(e,t),$p(e,t),Object.values(e.shared.lib.materials).forEach(i=>t(i.asset))}function hL(e){e.layers===void 0&&Object.assign(e,is.defaultTwoLayerData("phong"))}function LIe(e){"materials"in e?e.materials.forEach(t=>{t!==void 0&&typeof t!="string"&&hL(t)}):"material"in e&&e.material!==void 0&&typeof e.material!="string"&&hL(e.material)}function t_e(e){e.timelineAnimations=Ho({},ai.prototype)}function BIe(e){let t=[];return e?(e.forEach((i,r)=>{let{path:n,keyframes:s}=i.data,a=n[0]==="material"?i.id:void 0;s?.length?s.forEach(({id:o,data:l})=>{t.push({id:o,data:{...l,path:n,layerId:a,index:r}})}):t.push(fy.placeholderKeyframe(i.id,n,{layerId:a,index:r}))}),t.sort((i,r)=>i.data.time-r.data.time),new Nt(...t.map((i,r)=>({...i,fi:r})))):new Nt}function UIe(e){for(let{id:t,data:i}of[...e.unproxy()]){let r=i.path?.[0];if(!r||!i_e.includes(r))continue;let n=uH(i.value);if(!n.length)continue;let s=e.data(t);if(!s)continue;let a=i.value,[o,...l]=n;for(let u of l){let h=ht.generateUUID();e.insertBefore(null,[{id:h,data:{...i,id:h,path:[r,u],value:a[u],easing:FIe(i.easing)}}])}s.path=[r,o],s.value=a[o]}}function uH(e){return e===null||typeof e!="object"?[]:uA.filter(t=>t in e)}function FIe(e){let t=e?.cubicControls;return{...e,cubicControls:{control1:[...t?.control1??[0,0]],control2:[...t?.control2??[1,1]]},...e?.springParameters?{springParameters:{...e.springParameters}}:{}}}function zIe(e,t){return Math.abs(e[0]-t[0])<1e-6&&Math.abs(e[1]-t[1])<1e-6}function kIe(e){let t=function(s){let a=[];for(let o of fy.groupKeyframes(s)){let l=new Set(o.keyframes.flatMap(h=>uH(h.data.value))),u=l.size?[...l].map(h=>o.keyframes.filter(d=>uH(d.data.value).includes(h))):[o.keyframes];for(let h of u){let d=[...h].sort((c,p)=>c.data.time-p.data.time);for(let c=0;c+1<d.length;c++)a.push({left:d[c],right:d[c+1]})}}return a}([...e.unproxy()]),i=new Map,r=new Set;for(let{left:s,right:a}of t){let o=s.data.easing?.type,l=(o===void 0?void 0:fy.presetHandles(o))?.control2??(o===5?py(a.data.easing?.cubicControls?.control2,[1,1]):void 0);if(!l)continue;let u=i.get(a.id);u?zIe(u,l)||r.add(a.id):i.set(a.id,l)}let n=new Map;for(let{id:s,data:a}of e.unproxy()){let o=a.easing?.type,l=o===void 0?void 0:fy.presetHandles(o);l&&n.set(s,l.control1)}for(let{left:s,right:a}of t)r.has(a.id)&&n.delete(s.id);for(let[s,a]of n){let o=e.data(s);!o?.easing||(o.easing.cubicControls={control1:a,control2:py(o.easing.cubicControls?.control2,[1,1])},o.easing.type=5)}for(let{left:s,right:a}of t){if(!n.has(s.id))continue;let o=e.data(a.id),l=i.get(a.id);!o?.easing||!l||(o.easing.cubicControls={control1:py(o.easing.cubicControls?.control1,[0,0]),control2:l})}}function $ee(e,t){e.scene.objects.traverse((i,r)=>{let n=r;if(n.type==="Page"&&n.timelines)for(let s of Object.values(n.timelines))for(let a of Object.values(s.objectTimelines??{}))t(a.keyframes)})}function dH(e){e.pivot=[0,0,0],e.pivotRotation=[0,0,0]}function VIe(e){}function GIe(e){let t=e.schema??0;if(t!==131){if(t>131)return void console.error(`This scene was created with a newer version of Spline (file format ${t}, this runtime reads 131). Update @splinetool/runtime to the latest version to load it correctly.`);console.warn("updating from ",t,"to ",131),function(i,r){if(r<1&&(Xp(i,Bee),$p(i,Bee),i.schema=1),r<2&&(function(n){Object.assign(n.scene.publish,{orbitControls:{...aL.defaultData,...$s(n.scene.publish.orbitControls)}})}(i),i.schema=2),r<3&&(function(n){function s(a){if(a.layers){for(let o of Object.values(a.layers))if(o){for(let[l,u]of Object.entries(o))if((A4.includes(l)||typeof u=="boolean")&&delete o[l],l==="texture")for(let[h,d]of Object.entries(u))(fX.includes(h)||typeof d=="boolean")&&delete u[h]}}}n.scene.objects.traverse((a,o)=>{o.states.forEach(l=>{let u=l;u.material?s(u.material):u.materials&&u.materials.forEach(h=>{s(h)})})})}(i),i.schema=3),r<4&&(function(n){n.scene.publish.withBackground=!0}(i),i.schema=4),r<5&&(function(n){n.scene.publish.settings.web={compress:!0,preload:!0,preset:1,logo:!0,hint:!1}}(i),i.schema=5),r<6&&(function(n){n.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),r<7&&(function(n){n.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),r<8&&(i.schema=8),r<9&&(Fee(i),i.schema=9),r<10&&(function(n){n.scene.objects.traverse((s,a)=>{a.type==="Mesh"&&(a.geometry.type==="BooleanGeometry"||a.geometry.type==="SubdivGeometry")&&(a.geometry.phongAngle=35)})}(i),i.schema=10),r<11&&(function(n){n.scene.environment.ambientLight.softShadows=!1,n.scene.environment.ambientLight.softShadowQuality="low",n.scene.objects.traverse((s,a)=>{(a.type==="DirectionalLight"||a.type==="SpotLight")&&(a.shadowResolution=1024,a.shadowRadius=1,a.depth=1e5)}),n.shared.penumbraSize=new Array(5).fill(.5)}(i),i.schema=11),r<12&&(Fee(i),i.schema=12),r<13&&(function(n){n.shared.audios=Ho({},ai.prototype)}(i),i.schema=13),r<14&&(function(n){let s=n.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),r<15&&(function(n){Object.entries($s(n.shared.images)).filter(s=>s[1].asset===!1).map(s=>s[0]).forEach(s=>{delete n.shared.images[s]}),Object.entries($s(n.shared.audios)).filter(s=>s[1].asset===!1).map(s=>s[0]).forEach(s=>{delete n.shared.audios[s]})}(i),i.schema=15),r<16&&(function(n){n.scene.publish.settings.web.preload=!1}(i),i.schema=16),r<17&&(Xp(i,zee),$p(i,zee),i.schema=17),r<18&&(Xp(i,Uee),$p(i,Uee),i.schema=18),r<19&&(function(n){Object.assign(n.scene.publish.settings,{video:{...bf.defaultData.settings.video,...$s(n.scene.publish.settings.video)}})}(i),i.schema=19),r<20&&(function(n){n.shared.fonts=Ho({},ai.prototype)}(i),function(n){let s=[];n.scene.objects.traverse((a,o)=>{let l=o;if(l.type==="TextFrame"){let u=is.defaultTwoLayerData("phong"),h=typeof l.color=="string"?n.shared.colors[l.color]:l.color;u.layers[1].data.color={r:h.r,g:h.g,b:h.b},u.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(m=>m.charAt(0).toUpperCase()+m.slice(1)).join(" ")}(l.font);n.shared.fonts[d]===void 0&&(n.shared.fonts[d]={name:d});let c={name:l.name,...na.defaultData,...yc.defaultData,flatShading:!1,wireframe:!1,geometry:{...lf.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:u,states:$s(l.states),events:$s(l.events),visible:l.visible,raycastLock:l.raycastLock,position:l.position,rotation:l.rotation,scale:l.scale,hiddenMatrix:l.hiddenMatrix},p=$s(n.scene.objects).parent(a);n.scene.objects.insertAfter(p??null,a,[{id:a+"new",data:c,children:[]}]),s.push(a)}}),s.forEach(a=>{n.scene.objects.delete(a)})}(i),i.schema=20),r<21&&(function(n){let s={0:"MouseDown",1:"MouseUp",2:"MouseHover",5:"KeyDown",6:"KeyUp",7:"Start",9:"LookAt",10:"Follow",11:"Scroll",12:"Audio",13:"GameControl"};n.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 Nt,move:new Nt,jump:new Nt}});else{let u=new Nt;Object.assign(l,{actions:u}),(l.type==="MouseDown"||l.type==="MouseUp"||l.type==="KeyDown"||l.type==="KeyUp")&&"url"in l&&u.push({fi:0,id:ht.generateUUID(),data:{type:"Link",url:l.url,delay:0}}),"targets"in l&&(l.targets.forEach((h,d,c)=>{let p={easing:h.easing,duration:h.duration};h.easing===6?Object.assign(p,Cv(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"},m={state:h.state,...f,...p},g={allowSlerp:!0,type:"Transition",object:h.object,repeat:0,delay:0,delayDirection:void 0,direction:"normal",tweens:new Nt({fi:0,id:ht.generateUUID(),data:{state:void 0,repeat:0,delay:0,delayDirection:void 0,direction:"normal",duration:0,easing:4}},{fi:1,id:ht.generateUUID(),data:m})};u.push({fi:c,id:d,data:g})}),delete l.targets)}})})}(i),function(n){n.scene.objects.traverse((s,a)=>{function o(l,u){let h=new Nt,d=[];if(a.events.forEach((c,p,f)=>{if(c.type==="Audio"&&c.trigger===u){let m;d.push(p),c.interaction==="play"?m={...Cv(c,"interaction","audio","delay","volume","loop"),triggerAfter:"after"in c?c.after:void 0,toggle:"after"in c?c.toggle:void 0,type:"Audio"}:(c.interaction==="pause"||c.interaction==="stop")&&(m={...Cv(c,"interaction","delay","object","playAudio"),type:"Audio"}),m&&h.push({fi:f,id:p,data:m})}}),d.forEach(c=>a.events.delete(c)),h.length){let c=a.events.find(p=>p.type===l)?.data;c?"actions"in c&&c.actions.insertBefore(null,h):a.events.insertBefore(null,[{id:ht.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),r<22&&(Gee(i),i.schema=22),r<23&&(function(n){n.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),r<24&&(function(n){n.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),(r<25||i.shared.videos===void 0)&&(function(n){n.shared.videos=Ho({},ai.prototype)}(i),r<25&&(i.schema=25)),r<26&&(function(n){n.scene.objects.traverse((s,a)=>{let o=n.scene.objects.unproxy().parent(s);if(o){let l=$s(n.scene.objects.data(o));l&&l.type==="Mesh"&&l.geometry.type==="BooleanGeometry"&&a.type==="Mesh"&&(a.visible=$s(a).booleanExclude!==!0)}})}(i),i.schema=26),r<27&&(function(n){n.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),r<28&&(Gee(i),i.schema=28),r<29&&(function(n){function s(o){Object.setPrototypeOf(o,Qs.prototype),o.texture&&Object.setPrototypeOf(o.texture,Qs.prototype)}function a(o){Object.setPrototypeOf(o,Qs.prototype);for(let l in o)s(o[l])}n.scene.objects.traverse((o,l)=>{l.states.forEach(u=>{let h=u;if(h.material){let d=$s(h.material).layers;a(d),h.material.layers=d}if(h.materials)for(let d=0;d<h.materials.length;d++){let c=h.materials[d],p=$s(c).layers;a(p),c.layers=p}})})}(i),i.schema=29),r<30&&(function(n){n.scene.objects.traverse((s,a)=>{a.type==="Mesh"&&a.geometry.type==="NonParametricGeometry"&&!("material"in a)&&!("materials"in a)&&(a.material=is.defaultTwoLayerData("phong"))})}(i),i.schema=30),r<31&&(function(n){n.scene.publish.orbitControls.autoZoom===void 0&&(n.scene.publish.orbitControls.autoZoom=!1),n.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),r<33&&(function(n){n.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),r<34&&(function(n){n.scene.publish.mouseEventTarget===void 0&&(n.scene.publish.mouseEventTarget="canvas"),n.scene.publish.settings.web.hint===void 0&&(n.scene.publish.settings.web.hint=!1)}(i),i.schema=34),r<35&&(function(n){let{video:s}=n.scene.publish.settings;s.format==="gif"&&s.fps>48&&(s.fps=15)}(i),i.schema=35),r<36&&(function(n){n.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),r<37&&(function(n){let s=n.scene.environment.usePhysics;n.scene.objects.traverse((a,o)=>{s&&o.physics===null?o.collision=!1:o.collision="visibility"})}(i),i.schema=37),r<38&&(Xp(i,kee),$p(i,kee),i.schema=38),r<39&&(function(n){n.scene.objects.traverse((s,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&(o.navmesh=lL.defaultDataThirdPerson.navmesh)})})}(i),i.schema=39),r<40&&(function(n){n.scene.styles||(n.scene.styles=$v.defaultData())}(i),i.schema=40),r<41&&(function(n){n.scene.environment.ambientLight.occlusion===void 0&&(n.scene.environment.ambientLight.occlusion=!1),n.scene.environment.ambientLight.aoFullRes===void 0&&(n.scene.environment.ambientLight.aoFullRes=!1),n.scene.environment.ambientLight.radius===void 0&&(n.scene.environment.ambientLight.radius=256),n.scene.environment.ambientLight.bias===void 0&&(n.scene.environment.ambientLight.bias=.5),n.scene.environment.ambientLight.aoColor===void 0&&(n.scene.environment.ambientLight.aoColor={r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}),Xp(n,jee),$p(n,jee)}(i),i.schema=41),r<42&&(function(n){n.scene.objects.traverse((s,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&Object.assign(o.gameActions,{run:new Nt})})})}(i),i.schema=42),r<43&&(function(n){n.scene.objects.traverse((s,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&(o.keyAssignments=[...o.keyAssignments,["run","\u21E7"],["none","Ctrl"]])})})}(i),i.schema=43),r<99){Xp(i,Hee),$p(i,Hee),i.scene.publish.playCamera===null&&(i.scene.publish.playCamera=a1);let n=$s(i.scene.objects),s=i.scene.objects;i.scene.publish.playPage=wx,s.insertBefore(null,null,[{id:wx,data:{...cy.defaultData,backgroundColor:i.scene.backgroundColor,fog:i.scene.fog,postprocessing:i.scene.postprocessing,ao:Cv(i.scene.environment.ambientLight,"occlusion","aoFullRes","radius","bias","aoColor"),publish:{playCamera:i.scene.publish.playCamera,gameControlObject:i.scene.publish.gameControlObject},shadow:Cv(i.scene.environment.ambientLight,"softShadowQuality"),globalPhysics:{...Mx.defaultData,...Cv(i.scene.environment,"usePhysics","gravity")},camera:$s(i.scene.ownerCamera)??cy.defaultData.camera,name:"Scene"},children:[]}]);for(let l of n)l.id!==Xv.TRASH_CAN_ID&&s.move(wx,l.fi,l.id);let a=0,o=0;i.shared.penumbraSize&&i.scene.objects.traverse((l,u)=>{u.type==="DirectionalLight"?(u.penumbraSize=i.shared.penumbraSize[Math.min(a,2)],a+=1):u.type==="SpotLight"&&(u.penumbraSize=i.shared.penumbraSize[3+Math.min(o,1)],o+=1),(u.physics===void 0||u.physics===null)&&u.type!=="Instance"&&(u.physics={},Object.assign(u.physics,Tx.defaultData)),u.physics!==void 0&&u.physics!==null&&(u.physics.enabled=u.collision??"visibility",delete u.collision)}),i.schema=99}}(e,t),t<100&&(e.scene.publish.joystickSizeAndXYOffset===void 0&&(e.scene.publish.joystickSizeAndXYOffset=bf.defaultData.joystickSizeAndXYOffset),e.schema=100),t<101&&(Xp(e,Wee),$p(e,Wee),e.schema=101),t<102&&(function(i){i.scene.objects.traverse((r,n)=>{let s=n.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"))})}(e),e.schema=102),t<104&&(e.shared.catelogs=new ai,e.shared.lib=hf.defaultData(),e.schema=104),t<105&&(function(i){i.shared.variables=Ho({},ai.prototype)}(e),e.scene.objects.traverse((i,r)=>{Q1e(r)}),e.schema=105);for(let i of Object.values(e.shared.lib.components))J1e(i);t<106&&(function(i){let r=$s(i.shared.variables);i.shared.variables=Ho(Object.entries(r??{}).map(([n,s],a)=>({fi:a,id:n,data:s})),Nt.prototype)}(e),e.schema=106),t<107&&(e.shared.lib.variables=hf.defaultData().variables,e.schema=107),t<109&&(function(i){i.shared.particles=Ho({},ai.prototype),i.shared.lib&&(i.shared.lib.particles=hf.defaultData().particles)}(e),e.schema=109),t<110&&(function(i){i.scene.objects.traverse((r,n)=>{n.type==="Particle"&&typeof n.renderMaterial.size=="number"&&Object.assign(n.renderMaterial,{size:[n.renderMaterial.size,n.renderMaterial.size]})})}(e),e.schema=110),t<111&&(e.scene.objects.traverse((i,r)=>{(function(n){Array.isArray($s(n.events))&&n.events?.forEach(s=>{"disabled"in s||(s.disabled=!1),(s.type==="MouseDown"||s.type==="MouseUp"||s.type==="MousePress")&&(s.mode=s.mode||"Object")})})(r)}),e.schema=111),t<112&&(function(i){i.scene.objects.traverse((r,n)=>{n.type==="Page"&&(n.postprocessing.depthOfField.focusDistance=100,n.postprocessing.depthOfField.focalLength=20,n.postprocessing.depthOfField.bokehScale=5)})}(e),e.schema=112),t<113&&(function(i){i.scene.objects.traverse((r,n)=>{Array.isArray($s(n.events))!==!1&&n.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")}))})})}(e),e.schema=113),t<114&&(e.scene.publish.settings.web.imageQuality===void 0&&(e.scene.publish.settings.web.imageQuality=70),e.schema=114),t<115&&(function(i){i.shared.userAPIs=Ho({},ai.prototype),i.shared.userWebhooks=Ho({},ai.prototype),i.shared.lib&&(i.shared.lib.userAPIs=hf.defaultData().userAPIs,i.shared.lib.userWebhooks=hf.defaultData().userWebhooks)}(e),e.schema=115),t<116&&(function(i){i.scene.publish.settings.videoStatic===void 0&&(i.scene.publish.settings.videoStatic=bf.defaultData.settings.videoStatic)}(e),e.schema=116),t<117&&(e.scene.publish.settings.web.pixelRatioMobile===void 0&&(e.scene.publish.settings.web.pixelRatioMobile=0),e.scene.publish.settings.web.pixelRatioDesktop===void 0&&(e.scene.publish.settings.web.pixelRatioDesktop=0),e.schema=117),t<118&&(e.shared.timelineAnimations=Ho({},ai.prototype),e.scene.objects.traverse((i,r)=>{t_e(r)}),e.schema=118),t<119&&(e.scene.publish.settings.videoStatic.format=Ex.defaultData.scene.publish.settings.videoStatic.format,e.scene.publish.settings.videoStatic.imageFormat=Ex.defaultData.scene.publish.settings.videoStatic.imageFormat,e.schema=119),t<120&&(e.scene.publish.settings.image.colorSpace="display-p3",e.scene.publish.settings.videoStatic.colorSpace="display-p3",e.schema=120),t<121&&(e.scene.objects.traverse((i,r)=>{dH(r),r.type==="Page"&&r.camera!==void 0&&dH(r.camera)}),e.schema=121),t<122&&(delete e.scene.publish.settings.video,e.scene.publish.orbitControls.rotationSpeed=Ex.defaultData.scene.publish.orbitControls.rotationSpeed,e.schema=122),t<123&&(e.scene.objects.traverse((i,r)=>{r.type==="Page"&&r.sky===void 0&&(r.sky=gg.defaultData)}),e.schema=123),t<124&&(t>=123&&e.scene.objects.traverse((i,r)=>{let n=r.sky;r.type==="Page"&&n!==void 0&&(typeof n.exposure=="number"&&(n.exposure=Math.round(n.exposure/5e-4*1e4)/1e4),n.lighting===void 0&&(n.lighting=gg.defaultData.lighting))}),e.schema=124),t<125&&(e.scene.objects.traverse((i,r)=>{let n=r.sky;r.type==="Page"&&n!==void 0&&n.lightingIntensity===void 0&&(n.lightingIntensity=gg.defaultData.lightingIntensity)}),e.schema=125),t<126&&(e.scene.objects.traverse((i,r)=>{let n=r.sky;r.type==="Page"&&n!==void 0&&(n.mode===void 0&&(n.mode="physical"),n.hdri===void 0?n.hdri={...gg.defaultData.hdri}:(n.hdri.blur===void 0&&(n.hdri.blur=gg.defaultData.hdri.blur),Array.isArray(n.hdri.rotation)&&(n.hdri.rotation=n.hdri.rotation[1]??0)))}),e.schema=126),t<127&&(e.scene.objects.traverse((i,r)=>{let n=r.sky;r.type==="Page"&&n?.hdri!==void 0&&n.hdri.showBackground===void 0&&(n.hdri.showBackground=!0)}),e.schema=127),t<128&&(e.scene.objects.traverse((i,r)=>{let n=r.sky;r.type==="Page"&&n!==void 0&&n.lightingQuality===void 0&&(n.lightingQuality="full")}),e.schema=128),t<129&&(e.scene.objects.traverse((i,r)=>{if(r.type==="Page"){r.camera===void 0&&(r.camera=cy.defaultData.camera);let n=r.camera;n.far=1e5,n.perspective?n.perspective.near=70:n.perspective={near:70,fov:45,zoom:1}}}),e.schema=129),t<130&&(e_e(e,hL),e.schema=130),t<131&&(function(i){i.scene.objects.traverse((r,n)=>{let s=n.states;if(!s)return;let a=n.timelineAnimations,o=[];s.forEach((l,u)=>{(l.isAnimation||a?.[u])&&o.push(u)}),o.forEach(l=>s.delete(l))})}(e),function(i){let r=i.shared,n=r.timelineAnimations;if(!n)return;let s=i.scene.objects,a=s.unproxy().find(o=>o.data.type==="Page")?.id;for(let[o,l]of Object.entries(n)){let u=Ho({},ai.prototype),h=0,d=Boolean(l.loop);for(let[f,m]of Object.entries(l.mapping??{})){let g=s.data(f)?.timelineAnimations?.[m];!g||(h=Math.max(h,g.to??0),d=d||Boolean(g.loop),u[f]={id:f,keyframes:BIe(g.properties?.unproxy())})}let c=l.page??a,p=c?s.data(c):void 0;p&&p.type==="Page"&&((p.timelines??(p.timelines=Ho({},ai.prototype)))[o]={id:o,name:l.name,duration:h||5,...d?{loop:d}:{},objectTimelines:u})}delete r.timelineAnimations,s.traverse((o,l)=>{delete l.timelineAnimations})}(e),$ee(e,UIe),$ee(e,kIe),e.schema=131)}}pw(Z1e,{updateAllMaterials:()=>e_e,updateDocumentSchema:()=>GIe,updateLibSchema:()=>VIe,updateMaterialSchema:()=>OIe,updateObjectStateRec:()=>tx,updateObjectsSchema:()=>J1e,updateTextValues:()=>IIe});var Fv,i_e,Xee,XC,vF,Yee,YC,Yv,DS,V1,KC,yF,hI,_F,bF,Kee,uI,xF,my,cH,P4=V(()=>{le(),X1e(),Nr(),K1e(),NIe(),R4(),PA(),ha(),wX(),C4(),yX(),Fv=180/Math.PI,i_e=["position","rotation","scale","shape size"]}),jIe=V(()=>{var e,t,i;Dh(),Nr(),ha(),(Xee||(Xee={})).is=function(r){return!0},(e=XC||(XC={})).defaultData={position:[0,0],scale:[1,1],rotation:0,shear:[0,0]},e.merge=function(r,n){return{position:n?.position??r.position,rotation:n?.rotation??r.rotation,scale:n?.scale??r.scale,shear:n?.shear??r.shear}},e.diff=function(r,n){return d1e({position:Bc.isEqual(r.position,n.position)?void 0:n.position,rotation:r.rotation===n.rotation?void 0:n.rotation,scale:Bc.isEqual(r.scale,n.scale)?void 0:n.scale,shear:r.shear&&n.shear&&Bc.isEqual(r.shear,n.shear)?void 0:n.shear})},(vF||(vF={})).defaultData={horizontalConstraint:0,verticalConstraint:0},(Yee||(Yee={})).defaultData={direction:"row",wrap:"unwrap",align:"top-left",gap:10,rowGap:10,autoGap:!1,autoRowGap:!1,leftPadding:8,rightPadding:8,topPadding:8,bottomPadding:8},(YC||(YC={})).defaultData={opacity:1,fill:{color:kr.fromHexAndA(eo,1),enabled:!0},stroke:{color:kr.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:kr.from0to1([0,0,0,1]),enabled:!1,spread:0},innerShadow:{offset:[10,10],blurRadius:10,color:kr.from0to1([0,0,0,1]),enabled:!1,spread:0}},(t=Yv||(Yv={})).newEmpty=function(r,n){return{name:n}},t.patch=function(r,n){if(n===void 0)return r;let s={...r};return Object.assign(s,XC.merge(s,n)),s=function(a,o){if(o===void 0)return a;let l={...a},u=["width","height","cornerRadius"];for(let h of u)h in l&&h in o&&o[h]!==void 0&&Object.assign(l,{[h]:o[h]});return l}(s,n),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,n),s},t.toOps=function(r,n){let s,a=[];for(let[o,l]of Object.entries(n))o!=="name"&&(s===void 0&&(s={path:[],props:{},type:0},a.push(s)),s.props[o]=l);return a},(DS||(DS={})).defaultData={...XC.defaultData,...vF.defaultData,states:new Nt,events:new Nt,visible:!0,raycastLock:!1},(V1||(V1={})).defaultData={...DS.defaultData,...YC.defaultData},(KC||(KC={})).defaultData={cornerRadius:[0,0,0,0]},(yF||(yF={})).defaultData={...V1.defaultData,type:"ellipse2d",width:100,height:100,name:"Ellipse"},(hI||(hI={})).defaultData={...V1.defaultData,...KC.defaultData,type:"rectangle2d",width:100,height:100,name:"Rectangle"},(_F||(_F={})).defaultData={...V1.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"},(bF||(bF={})).defaultData={...V1.defaultData,type:"path2d",path:"",name:"Path"},(Kee||(Kee={})).is=function(r){return r.type==="ellipse2d"||r.type==="rectangle2d"||r.type==="text2d"||r.type==="vector2d"||r.type==="path2d"},(uI||(uI={})).defaultData={...DS.defaultData,name:"Group",type:"group2d"},(xF||(xF={})).defaultData=()=>({...DS.defaultData,...KC.defaultData,...YC.defaultData,name:"Frame",type:"frame2d",clipped:!0,width:200,height:200,fill:{color:kr.fromHexAndA(4737101,1),enabled:!0},stroke:{color:kr.fromHexAndA(0,1),thickness:1,enabled:!1,mode:"inside"},backgroundBlur:{radius:2,enabled:!1},layerBlur:{radius:2,enabled:!1}}),(r=>{r.defaultData=function(n){switch(n){case"rectangle2d":case"vector2d":return{...hI.defaultData};case"ellipse2d":return{...yF.defaultData};case"text2d":return{..._F.defaultData};case"path2d":return{...bF.defaultData};case"frame2d":return{...xF.defaultData()};case"group2d":return{...uI.defaultData}}},r.getPivot=function(n){return"width"in n&&"height"in n?[typeof n.width=="number"?.5*n.width:0,typeof n.height=="number"?.5*n.height:0]:[0,0]},r.isResizeable=function(n){return n.type==="rectangle2d"||n.type==="ellipse2d"||n.type==="text2d"||n.type==="frame2d"},r.isAutoLayoutable=function(n){return n.type==="frame2d"&&n.autoLayout!==void 0},r.hasCorners=function(n){return n.type==="rectangle2d"||n.type==="frame2d"}})(my||(my={})),(i=cH||(cH={})).defaultData={name:"UI",type:"scene2d",objects:new Aa},i.emptyData=function(){return{type:"scene2d",objects:new Aa}}}),HIe=V(()=>{MIe(),EIe(),O1e(),L1e(),X1e(),D1e(),DIe(),k1e(),j1e(),yX(),P4(),$1e(),vX(),gX(),B1e(),PA(),z1e(),W1e(),Dh(),R4(),C4(),bX(),G1e(),wX(),xX(),AIe(),V1e(),SX(),_X(),U1e(),F1e(),jIe()});function Kv(e,t=!1){let i=e[0].index!==null,r=new Set(Object.keys(e[0].attributes)),n=new Set(Object.keys(e[0].morphAttributes)),s={},a={},o=e[0].morphTargetsRelative,l=new At,u=0;for(let h=0;h<e.length;++h){let d=e[h],c=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(!r.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]),c++}if(c!==r.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(!n.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(t){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(u,p,h),u+=p}}if(i){let h=0,d=[];for(let c=0;c<e.length;++c){let p=e[c].index;for(let f=0;f<p.count;++f)d.push(p.getX(f)+h);h+=e[c].attributes.position.count}l.setIndex(d)}for(let h in s){let d=Zee(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 c=0;c<d;++c){let p=[];for(let m=0;m<a[h].length;++m)p.push(a[h][m][c]);let f=Zee(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 Zee(e){let t,i,r,n=-1,s=0;for(let u=0;u<e.length;++u){let h=e[u];if(t===void 0&&(t=h.array.constructor),t!==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(r===void 0&&(r=h.normalized),r!==h.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(n===-1&&(n=h.gpuType),n!==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 t(s),o=new It(a,i,r),l=0;for(let u=0;u<e.length;++u){let h=e[u];if(h.isInterleavedBufferAttribute){let d=l/i;for(let c=0,p=h.count;c<p;c++)for(let f=0;f<i;f++){let m=h.getComponent(c,f);o.setComponent(c+d,f,m)}}else a.set(h.array,l);l+=h.count*i}return n!==void 0&&(o.gpuType=n),o}var DA=V(()=>{le()});function r_e(e){let t=e.points.length/7,i=new Nt;for(let r=0;r<t;r++){let n=7*r,s=e.points[n+0],a=e.points[n+1],o=e.points[n+2],l=e.points[n+3],u=e.points[n+4],h=e.points[n+5],d=e.points[n+6];i.push({fi:r,id:ht.generateUUID(),data:{roundness:d,position:[s,a],areControlsDirectionsMirrored:!0,controlPrevious:{position:[o,l]},controlNext:{position:[u,h]}}})}return{points:i,isClosed:e.isClosed,roundness:e.roundness,shapeHoles:e.shapeHoles?.map(r=>r_e(r))??[]}}function n_e(e){let{userData:t,uuid:i,...r}=e;if(t===void 0||t.type==="NonParametricGeometry")return function(a){let o,{userData:l,data:u}=a,h=u?.groups,d=u?.attributes??{},c=u?.morphAttributes??{},p=u?.interleavedBuffers,f=u?.arrayBuffers,m=u?.index;d.position!==void 0&&Array.isArray(d.position.array)&&(o=function(v){let y=1/0,_=1/0,b=1/0,x=-1/0,w=-1/0,S=-1/0;for(let M=0;M<v.length;M+=3){let T=v[M],E=v[M+1],A=v[M+2];y=Math.min(y,T),_=Math.min(_,E),b=Math.min(b,A),x=Math.max(x,T),w=Math.max(w,E),S=Math.max(S,A)}return{width:x-y,height:w-_,depth:S-b}}(d.position.array));let g={...l===void 0?{}:l.parameters,data:{attributes:d,morphAttributes:c,interleavedBuffers:p,arrayBuffers:f},...o===void 0?{}:o,type:"NonParametricGeometry"};return m!==void 0&&Object.assign(g.data,{index:m}),h!==void 0&&Object.assign(g.data,{groups:h.map(v=>({...v,materialIndex:v.materialIndex??0}))}),g}(e);if(t.type==="SubdivGeometry"){let a="SubdivGeometry",o=r.data?.attributes;if(o?.positionWASM===void 0){let u=new At;if(o?.position===void 0||o?.faceMap===void 0)return null;let h=o.position.array,d=o.faceMap.array,c=r.data.index.array;u.setAttribute("position",new Et(h,3)),u.setIndex(new Uf(c,1));let p=function(v,y=1e-4){y=Math.max(y,Number.EPSILON);let _={},b=v.getIndex(),x=v.getAttribute("position"),w=b?b.count:x.count,S=0,M=Object.keys(v.attributes),T={},E={},A=[],R=["getX","getY","getZ","getW"],N=["setX","setY","setZ","setW"];for(let j=0,K=M.length;j<K;j++){let q=M[j],se=v.attributes[q];T[q]=new se.constructor(new se.array.constructor(se.count*se.itemSize),se.itemSize,se.normalized);let ve=v.morphAttributes[q];ve&&(E[q]||(E[q]=[]),ve.forEach((oe,fe)=>{let _e=new oe.array.constructor(oe.count*oe.itemSize);E[q][fe]=new oe.constructor(_e,oe.itemSize,oe.normalized)}))}let D=.5*y,O=Math.log10(1/y),z=Math.pow(10,O),U=D*z;for(let j=0;j<w;j++){let K=b?b.getX(j):j,q="";for(let se=0,ve=M.length;se<ve;se++){let oe=M[se],fe=v.getAttribute(oe),_e=fe.itemSize;for(let Z=0;Z<_e;Z++)q+=~~(fe[R[Z]](K)*z+U)+","}if(q in _)A.push(_[q]);else{for(let se=0,ve=M.length;se<ve;se++){let oe=M[se],fe=v.getAttribute(oe),_e=v.morphAttributes[oe],Z=fe.itemSize,pe=T[oe],H=E[oe];for(let F=0;F<Z;F++){let X=R[F],re=N[F];if(pe[re](S,fe[X](K)),_e)for(let k=0,Q=_e.length;k<Q;k++)H[k][re](S,_e[k][X](K))}}_[q]=S,A.push(S),S++}}let G=v.clone();for(let j in v.attributes){let K=T[j];if(G.setAttribute(j,new K.constructor(K.array.slice(0,S*K.itemSize),K.itemSize,K.normalized)),j in E)for(let q=0;q<E[j].length;q++){let se=E[j][q];G.morphAttributes[j][q]=new se.constructor(se.array.slice(0,S*se.itemSize),se.itemSize,se.normalized)}}return G.setIndex(A),G}(u),f=[],m=new Array(d[d.length-1]+1).fill(3),g=p.getIndex().array;for(let v=0,y=d.length;v<y;)d[v]===d[v+1]?(m[d[v]]++,f.push(...new Set(g.slice(3*v,3*v+6))),v+=2):(f.push(...g.slice(3*v,3*v+3)),v++);o.indexWASM={array:f},o.positionWASM=p.attributes.position,o.verticesPerFaceWASM={array:m}}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,...WIe(o.positionWASM.array)};l.subdivisions=t.parameters.subdivisions;for(let u in o)u==="positionWASM"?l[u]=new Float32Array(o[u].array):u==="indexWASM"?l[u]=new Int32Array(o[u].array):u==="verticesPerFaceWASM"&&(l[u]=new Int8Array(o[u].array));return l.scaleBaked=[1,1,1],l}let n=t.type,s=t.parameters;return n==="VectorGeometry"?(s.extrudeDepth&&(s.depth=s.extrudeDepth),{...s,width:100,height:100,shape:r_e(t.shape),type:n}):n==="LatheGeometry"?{...t.parameters,type:n,points:(t?.parameters.points??[]).map(a=>[a.x,a.y])}:(s.extrudeDepth&&(s.depth=s.extrudeDepth),{...s,type:n})}function WIe(e){return pH.setFromArray(e),pH.getSize(SM),{width:SM.x,height:SM.y,depth:SM.z}}var pH,SM,s_e,Vf,yE,a_e,vw,NS,ZC,wF,yw,Qee,SF,Jee,TF,iw,lm,hm,op,MF,ete,tte,EF,fH,xf,qIe=V(()=>{Nr(),le(),DA(),new Ve,new jt,new Kr,new P,new P,pH=new fn,SM=new P}),$Ie=V(()=>{}),XIe=V(()=>{Nr(),P4()}),YIe=V(()=>{PA(),[...A4],new Set(fX)}),Wt=V(()=>{HIe(),$Ie(),PIe(),P4(),XIe(),K1e(),YIe(),SX(),Nr()}),qf=V(()=>{s_e=[3,4,8,9],Vf=5,yE=3,a_e=32}),NA=V(()=>{le(),vw=e=>{var t;return(t=class extends e{}).geometryHelper=new Ph(30,30,30),t}}),IA=V(()=>{le(),NS=new mf,ZC=new qa,wF=new Ve,yw=(e,t,i,r,n=!1,s=e)=>{let a=t,o=s.matrixWorld;if(a.boundingSphere===null&&a.computeBoundingSphere(),ZC.copy(a.boundingSphere),ZC.applyMatrix4(o),i.ray.intersectsSphere(ZC)===!1||(wF.copy(o).invert(),NS.copy(i.ray).applyMatrix4(wF),a.boundingBox!==null&&NS.intersectsBox(a.boundingBox)===!1))return;let l,u,h,d,c,p,f=a.index,m=a.attributes.position,g=a.drawRange;if(n===!1){for(c=Math.max(0,g.start),p=Math.min(f.count,g.start+g.count);c<p;c+=3)if(u=f.getX(c),h=f.getX(c+1),d=f.getX(c+2),l=v(e,i,NS,m,u,h,d),l)return l.faceIndex=Math.floor(c/3),void r.push(l)}else{let y=a.attributes.position,_=new P,b=new P,x=new P,w=new P,S=2,M=1/((s.scale.x+s.scale.y+s.scale.z)/3),T=M*M;for(let E=Math.max(0,g.start),A=Math.min(y.count,g.start+g.count)-1;E<A;E+=S){if(_.fromBufferAttribute(y,E),b.fromBufferAttribute(y,E+1),NS.distanceSqToSegment(_,b,w,x)>T)continue;w.applyMatrix4(s.matrixWorld);let R=i.ray.origin.distanceTo(w);R<i.near||R>i.far||r.push({distance:R,point:x.clone().applyMatrix4(s.matrixWorld),object:e})}}function v(y,_,b,x,w,S,M){let T=new P,E=new P,A=new P,R=new P,N=new P;if(T.fromBufferAttribute(x,w),E.fromBufferAttribute(x,S),A.fromBufferAttribute(x,M),b.intersectTriangle(T,E,A,!1,R)===null)return null;N.copy(R),N.applyMatrix4(y.matrixWorld);let D=_.ray.origin.distanceTo(N);return D<_.near||D>_.far?null:{faceIndex:1,distance:D,point:N.clone(),object:y}}}}),D4=V(()=>{le(),NA(),IA(),Qee=new P(1,1,1),SF=new P,Jee=new P,TF=new jt,iw=class extends vw(Nye){constructor(e,t=15){super(t),this.object=e,this.dummy=new mw,this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${e.uuid}`,this.matrix=this.dummy.matrixWorld,this.matrixAutoUpdate=!1,this.object.isBone&&(this.visible=!1)}raycast(e,t){yw(this.object,iw.geometryHelper,e,t,!1,this.dummy)}update(){}updateMatrix(){}updateMatrixWorld(e){this.object.matrixWorld.decompose(SF,TF,Jee),this.matrix.compose(SF,TF,Qee),super.updateMatrixWorld(e)}updateWorldMatrix(e,t){}}}),KIe=V(()=>{le(),lm=new P,hm=new P,op=new Ve,MF=[new P(-1,1,1),new P(-1,-1,1),new P(1,-1,1),new P(1,1,1),new P(-1,1,-1),new P(-1,-1,-1),new P(1,-1,-1),new P(1,1,-1)],ete=[[0,3],[1,2],[5,6],[4,7],[0,1],[3,2],[7,6],[4,5],[0,4],[1,5],[2,6],[3,7]],tte=[[0,2],[7,5],[4,1],[3,6],[4,3],[1,6]],EF=(e,t,i)=>{e.updateEntityBoxSize(lm,hm),op.copy(t).multiply(e.matrixWorld),hm.x===0&&hm.y===0&&hm.z===0?i.push(new P(lm.x,lm.y,lm.z).applyMatrix4(op)):MF.forEach(r=>{i.push(r.clone().multiply(hm).add(lm).applyMatrix4(op))})},fH=class extends fn{constructor(){super(...arguments),this.matrix=new Ve,this.vertices=[],this.faces=[],this.edges=[],this.centerEdges=[]}copy(e){return super.copy(e),this.matrix.copy(e.matrix),this.vertices=e.vertices.map(t=>t.clone()),this.faces=e.faces.map(t=>t.clone()),this.edges=e.edges.map(t=>t.clone()),this.centerEdges=e.centerEdges.map(t=>t.clone()),this}setFromObjectSize(e,t=!1){e.updateWorldMatrix(!1,t),this.makeEmpty(),this.matrix.copy(e.matrixWorld);let i=new Ve().copy(e.matrixWorld).invert();return this.expandByObjectSize(e,i,t)}expandByObjectSize(e,t,i=!1){let r=[];if(i===!0){let n=[];e.traverseEntity(s=>{if(s.visible||s.cloner&&s.data.visible){if(!("geometry"in s))return op.copy(t).multiply(s.matrixWorld),void n.push(new P().applyMatrix4(op));EF(s,t,r)}}),r.length===0&&r.push(...n)}else EF(e,t,r);return this.setFromPoints(r)}getCenter(e){return(e=super.getCenter(e)).applyMatrix4(this.matrix),e}getPositionToCenter(e){return(e=super.getCenter(e)).applyMatrix4(op.copy(this.matrix).setPosition(0,0,0)),e}computeVertices(){this.getSize(hm).multiplyScalar(.5),this.getCenter(lm),op.copy(this.matrix).setPosition(lm),this.vertices=MF.map(e=>e.clone().multiply(hm).applyMatrix4(op))}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=ete.map(([e,t])=>new Eh(this.vertices[e],this.vertices[t])),this.centerEdges=this.edges.map(e=>e.getCenter(new P))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=tte.map(([e,t])=>this.vertices[e].clone().add(this.vertices[t]).multiplyScalar(.5))}}}),uL=V(()=>{xf={Cloner:null,changeEntityProptotype:()=>{},createEntity:()=>{}}});function _E(e){return e?.isParticleSystem===!0}function Qy(e){return e?.isHairSystem===!0}function Gf(e){return e?.isShapeBlendEntity===!0}function N4(e){return e?.isPathObject===!0}function Ql(e){return e?.isObject2D===!0}function Xo(e){return e?.isUIObject===!0}function ix(e){return e?.isCloner===!0}function Zv(e){return e?.isClone===!0}function dI(e){return e?.isComponentObject===!0}var rs=V(()=>{});function Nn(e){TX.add(e)}function Ma(e,t){let i=`${e}:${t}`;vH.has(i)||vH.add(i)}function dL(e,t){MX.set(e,t)}function AF(e){return MX.get(e)}function _w(e,t){EX.set(e,t)}function CF(e){return EX.get(e)}function mH(e,t){AX.set(e,t)}function o_e(e){return AX.get(e)}function gH(){return I4}var TX,vH,MX,EX,AX,I4,cL,_r=V(()=>{TX=new Set,vH=new Set,MX=new Map,EX=new Map,AX=new Map,I4=null,cL=null});function l_e(e){let t=e.elements;hd.set(t[0],t[1],t[2]),ud.set(t[4],t[5],t[6]),Mc.set(t[8],t[9],t[10])}function h_e(){let e=Math.max(hd.lengthSq(),ud.lengthSq(),Mc.lengthSq());hd.lengthSq()>TM*e?Th.copy(hd).normalize():Th.set(1,0,0),Mh.crossVectors(Mc,Th),Mh.lengthSq()<=TM*e&&(Mh.copy(ud).addScaledVector(Th,-ud.dot(Th)),Mh.lengthSq()<=TM*e&&function(t,i){t.set(1,0,0).cross(i),t.lengthSq()<=TM&&t.set(0,1,0).cross(i),t.normalize()}(Mh,Th)),Mh.normalize(),Qv.crossVectors(Th,Mh)}function u_e(e){return l_e(e),h_e(),d_e.makeBasis(Th,Mh,Qv)}var hd,ud,Mc,Th,Mh,Qv,d_e,TM,MM,QC,Jv,O4,c_e=V(()=>{le(),hd=new P,ud=new P,Mc=new P,Th=new P,Mh=new P,Qv=new P,d_e=new Ve,TM=1e-12,MM=.01}),OA=V(()=>{le(),c_e(),QC=new Ve,(Jv||(Jv={})).is=function(e){return e&&e.__isSPEObject},O4=e=>class extends e{constructor(){super(...arguments),this.previousModelViewMatrix=new Ve,this.copyPreviousMatrix=!0,this.hiddenMatrix=new Ve,this.pivotMatrix=new Ve,this.matrixWorldRigid=new Ve,this.shearScale=new Ve,this.shearScaleInv=new Ve}get __isSPEObject(){return!0}getPhysicsLocalMatrix(t){return!!this.rigidBody?.isDynamic()&&(t.copy(this.matrixWorld),this.hasNonUniformScale&&t.multiply(this.shearScaleInv),this.parent&&t.premultiply(QC.copy(this.parent.matrixWorld).invert()),t.premultiply(QC.copy(this.hiddenMatrix).invert()),t.multiply(QC.copy(this.pivotMatrix).invert()),!0)}isDescendantOf(t){t instanceof un&&(t=t.uuid);let i=this;for(;i.parent;){if(i.parent.uuid===t)return!0;i=i.parent}return!1}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(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,t=!0);for(let i of this.children)i.updateMatrixWorld(t)}updateWorldMatrix(t,i){let r=this.parent;if(t&&r!==null&&r.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 n of this.children)n.updateWorldMatrix(!1,!0)}traverseChildren(t,i=0){for(let r of this.children)Jv.is(r)&&r.traverseObject(t,i+1)}traverseObject(t,i=0){if(t(this,i)!==!0)for(let r of this.children)Jv.is(r)&&r.traverseObject(t,i+1)}updateMatrixWorldRigid(){this.hasNonUniformScale=function(t,i,r){return l_e(t),h_e(),i.makeBasis(Th,Mh,Qv),r.set(Th.dot(hd),Th.dot(ud),Th.dot(Mc),0,Mh.dot(hd),Mh.dot(ud),Mh.dot(Mc),0,Qv.dot(hd),Qv.dot(ud),Qv.dot(Mc),0,0,0,0,1),function(){let n=hd.length(),s=ud.length(),a=Mc.length(),o=Math.max(n,s,a);if(o-n>MM||o-s>MM||o-a>MM)return!0;let l=MM*o*o;return Math.abs(hd.dot(ud))>l||Math.abs(hd.dot(Mc))>l||Math.abs(ud.dot(Mc))>l}()}(this.matrixWorld,this.matrixWorldRigid,this.shearScale),this.matrixWorldRigid.copyPosition(this.matrixWorld),this.shearScaleInv.copy(this.shearScale).invert()}attach(t,i){this.updateWorldMatrix(!0,!1);let r=new Ve().copy(this.matrixWorld).invert();return t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),r.multiply(t.parent.matrixWorld)),"hiddenMatrix"in t&&t.hiddenMatrix instanceof Ve?t.hiddenMatrix.premultiply(r):t.applyMatrix4(r),t.updateWorldMatrix(!1,!1),this.add(t),i!==void 0&&(this.children.pop(),this.children.splice(i,0,t)),this}copy(t,i=!1){return super.copy(t,i),this.hasNonUniformScale=t.hasNonUniformScale,this}onAfterRender(t,i,r,n,s,a){this.copyPreviousMatrix&&this.previousModelViewMatrix.copy(this.modelViewMatrix)}}});function ite(e,t,i){return vg.subVectors(t,e),dA.subVectors(t,i),vg.cross(dA).length()<=bE}function p_e(e){let t=bH.get(e.points);if(t!==void 0&&t.isClosed===e.isClosed)return t.curve;let i=function(r){let n=r.points,s=[n[0]],a=[new P(...n[0].data.position)];Rv.copy(a[0]);for(let v=0;v<n.length-1;v++)vg.fromArray(n[v].data.position),dA.fromArray(n[v+1].data.position),Db.subVectors(vg,Rv),Nb.subVectors(vg,dA),Db.cross(Nb).length()>bE&&(s.push(n[v]),a.push(new P().copy(vg)),Rv.copy(vg));let o=n[n.length-1];s.push(o),a.push(new P(...o.data.position));let l=r.isClosed,u=s.length-(l?0:1),h=s.length,d=[],c=[];for(let v=0;v<h;v++){let y=s[v].data;d.push(new P(...y.controlPrevious.position)),c.push(new P(...y.controlNext.position))}let p=[];for(let v=0;v<u;v++){let y=v===h-1?0:v+1;p.push(ite(a[v],c[v],a[y])&&ite(a[v],d[y],a[y]))}let f=[];for(let v=0;v<h;v++){let y=s[v].data,_=a[v],b={position:_,prevDir:void 0,nextDir:void 0,controlPrevious:d[v],controlNext:c[v],tan:void 0,baseRoundness:y.roundness,removedLength:0};if(f.push(b),y.roundness===0||!l&&(v===0||v===h-1))continue;let x=l&&v==0?h-1:v-1,w=l&&v==h-1?0:v+1,S=new P().subVectors(a[x],_).normalize(),M=new P().subVectors(a[w],_).normalize();b.prevDir=S,b.nextDir=M;let T=p[l&&v===0?h-1:v-1],E=p[v];if(T&&E){Pv.addVectors(S,M).normalize();let A=Rv.crossVectors(Pv,S).length()/S.dot(Pv);b.tan=A,b.removedLength=y.roundness/A}}for(let v=0;v<u;v++){let y=l&&v===h-1?0:v+1,_=f[v],b=f[y];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 m=new Array(2*h).fill(null);for(let v=0;v<u;v++){let y=l&&v===h-1?0:v+1,_=f[v],b=f[y],x=null;if(p[v]){let w=_.position.clone(),S=b.position.clone();(_.removedLength!==0||b.removedLength!==0)&&(_.nextDir&&w.add(Rv.copy(_.nextDir).setLength(_.removedLength)),b.prevDir&&S.add(Rv.copy(b.prevDir).setLength(b.removedLength))),w.distanceTo(S)>bE&&(x=new dE(w,w.clone().lerp(S,.3),S.clone().lerp(w,.3),S))}else _.position.distanceTo(b.position)>bE&&(x=new dE(_.position,_.controlNext,b.controlPrevious,b.position));m[2*v+1]=x}for(let v=0;v<h;v++){let y=f[v];if(y.removedLength===0)continue;let _=y.position,b=y.prevDir.clone().multiplyScalar(y.removedLength).add(_),x=y.nextDir.clone().multiplyScalar(y.removedLength).add(_),w=y.tan*y.removedLength;Pv.addVectors(y.prevDir,y.nextDir).normalize(),Db.copy(b).lerp(x,.5);let S=b.distanceTo(x)/2;_H.copy(Pv).multiplyScalar(Math.sqrt(Math.pow(w,2)-Math.pow(S,2))).add(Db),cI.copy(Pv).multiplyScalar(-w).add(_H);let M=_.distanceTo(cI)/_.distanceTo(Db);Nb.copy(y.prevDir).multiplyScalar(M*_.distanceTo(b)).add(_),yH.copy(Nb).lerp(cI,2);let T=b.clone().lerp(Nb,4/3),E=x.clone().lerp(yH,4/3);m[2*v]=new dE(b,T,E,x)}let g=new f_e;for(let v=0;v<m.length;v++){let y=m[v];y&&g.add(y)}return g}(e);return bH.set(e.points,{isClosed:e.isClosed,curve:i}),i}var f_e,bE,vg,dA,Rv,Pv,Db,cI,Nb,yH,_H,bH,Ib,xH,pI,m_e,g_e,v_e,hr,_c,rte,nte,IS,RF,JC,PF,DF,L4,wH,o1,Ec,y_e=V(()=>{le(),f_e=class extends u7{constructor(){super()}getPoints(e=12){let t,i=[],r=this.getCurveLengths(),n=r[r.length-1]/r.length;for(let s=0,a=this.curves;s<a.length;s++){let o=a[s],l=s===0?r[s]:r[s]-r[s-1],u=Math.ceil(e*l/n),h=o.getPoints(u);for(let d=0;d<h.length;d++){let c=h[d];t&&t.equals(c)||(i.push(c),t=c)}}return this.autoClose&&i.length>1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}},bE=.001,vg=new P,dA=new P,Rv=new P,Pv=new P,Db=new P,cI=new P,Nb=new P,yH=new P,_H=new P,bH=new WeakMap}),ZIe=V(()=>{le(),Ib=new Ve,xH=new jt,pI=new jt,m_e=new Kr,g_e=new P,v_e=new P(0,1,0)}),xl=V(()=>{le(),Wt(),KIe(),Nr(),uL(),rs(),_r(),OA(),y_e(),ZIe(),Hr(),(hr||(hr={})).is=function(e){return e&&e.__isEntity},_c=e=>hr.is(e),rte={type:"completeState",isfromEntity:!0},nte=["x","y","z"],IS=new P,RF=new P(1,1,1),JC=new jt,PF=new Kr,DF=new Ve,L4=e=>class extends O4(e){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 fH,this._recursiveBBox=new fH,this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0,this._needApplyPathSnapping=!0,this.attachedPaths=new Set}get __isEntity(){return!0}entityChildren(t){let i=this.children[t];if(hr.is(i))return i}entityChildrenCount(){let t=this.children.length;for(;t--;)if(hr.is(this.children[t]))return t+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 t=this;for(;t.data.type!=="Instance";){let i=t.parent;if(!hr.is(i))return;t=i}return t}forInstancesRec(t){this.instances.forEach(i=>{i.disposed||t(i),i.forInstancesRec(t)})}super_Entity(t,i){typeof t=="string"&&(this.uuid=t),this.identity=t,this.data=i,this.matrixAutoUpdate=!1,this.dataPatched=this.data}changeSelectedState(t,i,r=!1){if(this.data.states.length!==0||r){for(let n of this.data.states)Eg.toOps(this.data,n.data).forEach(s=>{let a=GO.replaceProps(s,this.data);this.dataPatched=this.data,this.updateByPatchedOp(a,this.data,i)});if(t!==null){let n=this.data.states.data(t);n&&(this.dataPatched=Eg.patch(this.data,n),Eg.toOps(this.data,n).forEach(s=>{this.updateByPatchedOp(s,this.dataPatched,i)}))}r&&this.updateTransformState(this.dataPatched,i),this.stateSelection=t,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(t,i){t.setScalar(0),i.setScalar(0)}resetBBoxNeedsUpdateSelf(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}resetBBoxNeedsUpdate(){this.resetBBoxNeedsUpdateSelf(),this.traverseAncestors(t=>{_c(t)&&t.resetBBoxNeedsUpdateSelf()}),this.traverseEntity(t=>{t.resetBBoxNeedsUpdateSelf()})}find(t){let i;return this.traverseEntity(r=>{r.uuid===t&&(i=r)}),i}traverseSortNextHelper(){let t=this.parent;if(t){let i=t.children,r=i.indexOf(this)+1;if(hr.is(i[r]))return i[r];if(hr.is(t))return t.traverseSortNextHelper()}}sortNext(){let t=this.children;return this.children.length>0&&hr.is(this.children[0])?t[0]:this.traverseSortNextHelper()}goUp(t){let i=this;for(;t>0&&i!==null;)i=i.parent,t-=1;return i}hasAnccestorOrSelf(t){return this===t||this.hasAnccestor(t)}hasAnccestor(t){let i=this.parent;for(;i;){if(t===i)return!0;i=i.parent}return!1}countToAccestor(t){let i=0,r=this;for(;r!==t;){if(r===null)return-1;r=r.parent,i+=1}return i}forEachEntity(t){for(let i of this.children)_c(i)&&t(i)}traverseEntityAncestors(t){this.traverseAncestors(i=>{hr.is(i)&&t(i)})}traverseConcreteEntity(t,i=0){if(t(this,i)!==!0)for(let r of this.children)_c(r)&&r.isConcreteEntity&&r.traverseEntity(t,i+1)}traverseEntity(t,i=0){if(t(this,i)!==!0)for(let r of this.children)_c(r)&&r.traverseEntity(t,i+1)}traverseVisibleEntity(t){t(this);for(let i of this.children)_c(i)&&i.visible&&i.traverseVisibleEntity(t)}updateMatrix(){super.updateMatrix(),this.cloner&&this.cloner.onObjUpdateMatrix(),this.dispatchEvent({type:"updateMatrix"})}updateMatrixWorld(t){super.updateMatrixWorld(t),this.dispatchEvent({type:"updateMatrixWorld"})}copy(t,i=!1){return super.copy(t,i),this.dataPatched=t.dataPatched,this.raycastLock=t.raycastLock,this.scaleLock=t.scaleLock,this.hiddenMatrix.copy(t.hiddenMatrix),this}hasEntityChild(){return this.children.some(t=>_c(t))}isAncestorOf(t){if(this.uuid===t)return!1;let i=!1;return this.traverseEntity(r=>{r.uuid===t&&(i=!0)}),i}toObjectTransformState(t=[]){return this.updateWorldMatrix(!0,!1),N7({position:this.position.toArray(),rotation:[this.rotation.x*ht.RAD2DEG,this.rotation.y*ht.RAD2DEG,this.rotation.z*ht.RAD2DEG],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray(),pivot:[0,0,0],pivotRotation:[0,0,0]},t)}getTransformValues(t,i,r){return i[t].map((n,s)=>r?.shared.getVariable(n,[this.uuid,t,nte[s]])??n)}updateTransformState(t,i){let r=!1;if(t.position&&(this.position.fromArray(this.getTransformValues("position",t,i)),r=!0),t.rotation&&(IS.fromArray(this.getTransformValues("rotation",t,i)).multiplyScalar(ht.DEG2RAD),this.rotation.setFromVector3(IS),r=!0),t.scale&&(this.scale.fromArray(this.getTransformValues("scale",t,i)),r=!0),t.hiddenMatrix!==void 0&&(r=!0,this.hiddenMatrix.fromArray(t.hiddenMatrix??Sx.identity)),t.pivot!==void 0||t.pivotRotation!==void 0){if(r=!0,t.pivot!==void 0&&t.pivotRotation!==void 0)this.pivotMatrix.compose(IS.fromArray(t.pivot).negate(),JC.setFromEuler(PF.fromArray(t.pivotRotation.map(n=>n*ht.DEG2RAD))).invert(),RF);else if(t.pivot!==void 0)this.pivotMatrix.setPosition(-t.pivot[0],-t.pivot[1],-t.pivot[2]);else if(t.pivotRotation!==void 0){let n=IS.setFromMatrixPosition(this.pivotMatrix);JC.setFromEuler(PF.fromArray(t.pivotRotation.map(s=>s*ht.DEG2RAD))).invert(),this.pivotMatrix.compose(n,JC,RF)}}return r&&(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(n=>{n.invalidateClonerTransform(this)})),t.position&&t.rotation&&t.scale&&t.hiddenMatrix!==void 0&&this.updateWorldMatrix(!1,!0),r}onVariableUpdate(t=!1){t?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 t of this.children)hr.is(t)&&t.disposeRecursively()}disposeRecursively(){this.dispose(),this.children.forEach(t=>{hr.is(t)&&t.disposeRecursively()})}toState(t=[]){return N7({name:this.name,visible:this.visible,raycastLock:this.raycastLock,...this.toObjectTransformState(t)},t)}updateByObjUpdateOp(t,i){t!==void 0&&this.updateByOp({type:0,props:t,path:[]},{...this.data,...t},i,!1)}updateByOp(t,i,r,n){let s=this.data;this.data=i;let a=t,o=Jr(t.path,["states","*"]);if(o!==null){if(t.type===0){let[l]=o;if(this?.stateSelection===l){let u={...t.props};if(delete u.name,Object.values(t.props).some(h=>h===void 0)){let h=this.data;if(h!==void 0){let d=Ta.zoom(h,t.path.slice(2));if(d)for(let c in t.props)t.props[c]===void 0&&c in d&&(u[c]=d[c])}}a={...t,props:u,path:t.path.slice(2)}}}}else if(t.type===0){let l=this.stateSelection?this.data.states.data(this.stateSelection):void 0;if(l!==void 0){if(t.props.name!==void 0&&l.name){let{name:h,...d}=l;l=d}if(t.props.material!==void 0&&"material"in l){let{material:h,...d}=l;l=d}let u=Ta.removeOverridden(t.path,t.props,l);a={...t,props:u}}}if(this.updateByPatchedOpBase(a,Eg.patch(this.data,this.stateSelection?this.data.states.data(this.stateSelection):void 0),r),Jr(t.path,["overrides"])){let l=[],u=[...t.path];for(l.push(u[1]),u.splice(0,2);u.length>0&&u[0]==="descendants";)l.push(u[1]),u.splice(0,2);if(l[l.length-1]===void 0){if(t.type===0)for(let h of Object.keys(t.props)){l[l.length-1]=h;let d=r.scene.findInstance([this.uuid,...l]);d&&(d.overrideData=t.props[h],d.updateState(Ig.apply(d.component.data,d.overrideData),r))}}else{let h=r.scene.findInstance([this.uuid,...l]);if(h){let d=Ta.zoom(h.component.data,u);if((t={...t,path:u}).type===0){let c=t.props;if(d)for(let[p,f]of Object.entries(t.props))f===void 0&&(c===t.props&&(c={...t.props}),c[p]=d[p]);t={...t,props:c}}h.overrideData=sL.resolve(i.overrides,l),h.updateByOp(t,Xa.applySimple(h.data,t),r,!1)}}}else if(this.instances.length>0){let l;if(t.path.length===0&&t.type===0){let u;for(let h of _f.rootOverrideProps)h in t.props&&(u===void 0&&(u={}),u[h]=t.props[h]);u&&(l={...t,props:u})}else for(let u of _f.rootOverrideProps)if(Jr(t.path,[u])){l=t;break}l!==void 0&&this.instances.forEach(u=>{if(u.isInstanceRoot){let h=Ig.filterOp(u.overrideData,l);h&&u.updateByOp(h,Xa.applySimple(u.data,h),r,!0)}}),this.instances.forEach(u=>{if(!u.isInstanceRoot){let h=Ig.filterOp(u.overrideData,t);if(h){let d;d=s===u.data&&t===h?i:Xa.applySimple(u.data,h),u.updateByOp(h,d,r,!0)}}})}}updateByPatchedOpBase(t,i,r){if(this.dataPatched=i,t.path.length===0&&t.type===0)t.props.type!==void 0&&!Ky.is(t.props.type)&&xf.changeEntityProptotype(this,i,r);else if(t.path.length===1&&t.path[0]==="geometry"&&t.type===0&&"type"in t.props){xf.changeEntityProptotype(this,i,r);for(let n of this.children)hr.is(n)&&n.updateVisible(r.scene)}this.updateByPatchedOp(t,i,r)}updateByPatchedOp(t,i,r){if(t.path.length===0&&t.type===0?this.updateState(t.props,r):t.type===0&&("resolutionLevel"in t.props||"useChildrenColors"in t.props)&&this.updateState(i,r),t.path[0]==="morphTargetInfluences"&&t.type===0){let n=i.morphTargetInfluences.get(t.path[1])?.data.name;n&&this.updateMorphInfluences(n,r.shared.getVariable(t.props.value,[this.uuid,"morphTargetInfluences",n]))}if(Jr(t.path,["pathSnapping"])!==null&&this.updatePathSnapping(i.pathSnapping),Jr(t.path,["cloner"])!==null){let n=Xa.drop(t,1);n.path.length===0&&n.type===0&&n.props.disabled===!0?this.setFromClonerState(null,r):this.cloner?this.cloner.updateState(i.cloner,r):(this.setFromClonerState(i.cloner,r),this.expandCloner(r)),this.updateVisible(r.scene)}}updatePathSnapping(t=this.dataPatched.pathSnapping){this._updatedPathSnapping=t,this._needApplyPathSnapping=!0}get updatedPathSnapping(){return this._updatedPathSnapping}applyPathSnapping(t){if(this._needApplyPathSnapping===!1)return;let i=this._updatedPathSnapping?.pathId??this.dataPatched.pathSnapping.pathId,r=this._updatedPathSnapping?.slide??this.dataPatched.pathSnapping.slide??0,n=this._updatedPathSnapping?.offset??this.dataPatched.pathSnapping.offset??0,s=this._updatedPathSnapping?.orientation??this.dataPatched.pathSnapping.orientation;if(i===null)return;let a=t.find(i);if(!a)return;this._needApplyPathSnapping=!1;let o=a.data;if(o.geometry.path.points.length<=1)return;let l=p_e(o.geometry.path),u=function(p){let f=p%1;return f<0?f+1:f===0&&p>0?1:f}(r+n),h=null;try{h=l.curves.length?l.getPointAt(u):null}catch{}if(h===null)return;a.updateMatrixWorld();let d=this.parent?DF.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix):DF.copy(this.hiddenMatrix),c=function(p,f,m,g){xH.setFromRotationMatrix(Ib.extractRotation(g));let v=p.clone().applyMatrix4(Ib.copy(g).invert().multiply(m));if(f===null)pI.setFromRotationMatrix(Ib.extractRotation(m));else{let y=f.clone().applyMatrix4(Ib.extractRotation(m));pI.setFromRotationMatrix(Ib.lookAt(g_e.set(0,0,0),y,v_e))}return{position:v,rotation:new P().setFromEuler(m_e.setFromQuaternion(xH.invert().multiply(pI))).multiplyScalar(ht.RAD2DEG)}}(h,s==="tangential"?l.getTangentAt(u):null,a.matrixWorld,d);this.updateTransformState({position:c.position.toArray(),rotation:c.rotation.toArray()}),this.traverseEntity(p=>{p._cameraType&&p.dispatchEvent(rte)})}updateVisible(t){if(this.visible=this.dataPatched.visible&&(!this.dataPatched.cloner||(this.dataPatched.cloner.disabled??!1)||this.dataPatched.cloner?.hideBase!==!0),!t)return;let i=!1;this.traverseEntity(r=>{if(r.data.type==="Splat")return i=!0,!0}),i&&t.reloadSplats()}updateState_Entity(t,i){t.name!==void 0&&(this.name=t.name),t.raycastLock!==void 0&&(this.raycastLock=t.raycastLock),t.visible!==void 0&&(this.updateVisible(i?.scene),this.resetBBoxNeedsUpdate()),i&&"cloner"in t&&t.cloner!==void 0&&(this.setFromClonerState(t.cloner,i),this.updateVisible(i.scene)),this.updateTransformState(t,i)}get attachedSurfaceCloners(){return this.children.filter(t=>ix(t)&&t.parameters.type==="toObject")}setFromClonerState(t,i){if(!this.disposed)if(t===null||t.disabled)this.cloner&&this.cloner.dispose(),this.cloner=void 0;else if(this.cloner===void 0){if(xf.Cloner===null)return void Ma("cloners","a cloner");this.cloner=new xf.Cloner(this,t),i.scene.addPendingExpandCloner(this)}else this.cloner.updateState(t,i)}expandCloner(t){!this.disposed&&this.cloner&&this.cloner.expandClones(t)}invalidateClonerTransform(t){this.cloner&&this.cloner.invalidateTransform(t)}requestRender(){this.dispatchEvent({type:"requestRender"})}}}),l1=V(()=>{le(),xl(),(wH||(wH={})).is=e=>"objectHelper"in e,o1=(e,t)=>class extends L4(e){constructor(){super(...arguments),this.objectHelper=new t(this),this.gizmos={}}get geometryHelper(){return t.geometryHelper}raycast(i,r){this.objectHelper.raycast(i,r)}showGizmos(){for(let i in this.gizmos){let r=this.gizmos[i];r instanceof tA&&(r.visible=!0)}}updateEntityBoxSize(i,r){this.objectHelper.visible&&this.geometryHelper instanceof Ph?(i.setScalar(0),r.set(this.geometryHelper.parameters.width,this.geometryHelper.parameters.height,this.geometryHelper.parameters.height).multiplyScalar(.5)):super.updateEntityBoxSize(i,r)}hideGizmos(){for(let i in this.gizmos){let r=this.gizmos[i];r instanceof tA&&(r.visible=!1)}}}}),B4=V(()=>{le(),D4(),l1(),Ec=class extends o1(mw,iw){constructor(e,t){super(),this.super_Entity(e,t),this.objectHelper.update(),this.data.type==="Empty"&&(this.objectHelper.visible=!1)}updateState(e,t){this.updateState_Entity(e,t),"buffer"in e&&Object.keys(e).length===1&&t.scene.reloadSplats()}}});function Ru(e,t,i,r,n,s,a){EM.set(n,s,a).unproject(r);let o=t[e];if(o!==void 0){let l=i.getAttribute("position");for(let u=0,h=o.length;u<h;u++)l.setXYZ(o[u],EM.x,EM.y,EM.z)}}var EM,nh,ste,__e,QIe=V(()=>{le(),NA(),IA(),EM=new P,nh=new xg,ste=class extends Mb{constructor(e){let t=new At,i=new sd({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],n=[],s={},a=new ot(15711266),o=new ot(15711266),l=new ot(2857471);function u(d,c,p){h(d,p),h(c,p)}function h(d,c){r.push(0,0,0),n.push(c.r,c.g,c.b),s[d]===void 0&&(s[d]=[]),s[d].push(r.length/3-1)}u("n1","n2",a),u("n2","n4",a),u("n4","n3",a),u("n3","n1",a),u("f1","f2",a),u("f2","f4",a),u("f4","f3",a),u("f3","f1",a),u("n1","f1",a),u("n2","f2",a),u("n3","f3",a),u("n4","f4",a),u("p","n1",o),u("p","n2",o),u("p","n3",o),u("p","n4",o),u("u1","u2",l),u("u2","u3",l),u("u3","u1",l),t.setAttribute("position",new Et(r,3)),t.setAttribute("color",new Et(n,3)),super(t,i),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update()}update(){let e=this.geometry,t=this.pointMap;nh.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let i=.8;Ru("n1",t,e,nh,-1,-1,i),Ru("n2",t,e,nh,1,-1,i),Ru("n3",t,e,nh,-1,1,i),Ru("n4",t,e,nh,1,1,i);let r=i;Ru("f1",t,e,nh,-1,-1,r),Ru("f2",t,e,nh,1,-1,r),Ru("f3",t,e,nh,-1,1,r),Ru("f4",t,e,nh,1,1,r);let n=r;Ru("u1",t,e,nh,.35,1.1,n),Ru("u2",t,e,nh,-.35,1.1,n),Ru("u3",t,e,nh,0,1.55,n),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}},__e=class extends vw(ste){constructor(e){super(e),this.object=e,this.name=`CombinedCameraHelper: ${e.uuid}`}updateMatrixWorld(e){super.updateMatrixWorld(e),this.updateTarget()}updateTarget(){let e=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(e)}raycast(e,t){yw(this.object,this.geometry,e,t,!0)}}});function ate(e){return 1-Math.pow(1-e,3)}var E0,e3,t3,i3,G1,r3,Hd,us,Nh=V(()=>{le(),QIe(),Wt(),l1(),Hr(),E0=new P,e3=new P,t3=new jt,i3=new P,G1=new P,r3=new P,Hd=class extends o1(xg,__e){constructor(e="",t={...gE.defaultData,name:""}){super(),this._cameraType="OrthographicCamera",this.targetOffset=yf.DefaultTargetOffset,this.isUpVectorFlipped=!1,this.angleOffsetFromUp=0,this.wasMovedByUser=!1,this.wasMovedBySwitchCameraAction=!1,this._createdAt=typeof performance<"u"?performance.now():0,this._tickProjectionTransition=()=>{let n=this._projectionTransition;if(n===void 0)return;if(this.disposed)return void this._endProjectionTransition();n.raf=requestAnimationFrame(this._tickProjectionTransition);let s=Hd.projectionTransitionRequestRender??n.requestRender;this.updateProjectionMatrix(),s?.()},this.super_Entity(e,t),this.previousProjectionMatrix=new Ve,this.matrixAutoUpdate=!0,this.width=window.innerWidth,this.height=window.innerHeight;let i=this.width,r=this.height;this.orthoCamera=new Vg(-.5*i,.5*i,.5*r,-.5*r,-5e4,1e4),this.perspCamera=new bh(45,i/r,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(e){let t=Hd.projectionTransitionsEnabled;Hd.projectionTransitionsEnabled=!1;try{return e()}finally{Hd.projectionTransitionsEnabled=t}}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}set fov(e){this.perspCamera.fov=e}get fov(){return this.perspCamera.fov}setNear(e,t){e==="PerspectiveCamera"?this.perspCamera.near=t:this.orthoCamera.near=t}setZoom(e,t){t>=0&&(e==="PerspectiveCamera"?this.perspCamera.zoom=t:this.orthoCamera.zoom=t)}set cameraType(e){e==="PerspectiveCamera"?this.toPerspective():e==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(e){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=e:this.orthoCamera.near=e}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(e){e>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}lookAt(e,t,i){typeof e=="number"&&(e=new P(e,t,i)),super.lookAt(e),this.getWorldPosition(E0),this.targetOffset=E0.distanceTo(e)}getTarget(e=new P){return this.getWorldDirection(e3),this.getWorldPosition(E0),e3.multiplyScalar(this.targetOffset),e.copy(E0).add(e3),e}getDistanceToTarget(){let e=this.getTarget();return this.getWorldPosition(E0),E0.distanceTo(e)}updateUp(){this.getWorldQuaternion(t3),i3.set(0,0,1).applyQuaternion(t3),G1.copy(un.DEFAULT_UP),this.isUpVectorFlipped&&G1.negate(),G1.applyQuaternion(t3),r3.copy(un.DEFAULT_UP).projectOnPlane(i3),this.angleOffsetFromUp=r3.angleTo(G1),this.angleOffsetFromUp*=r3.cross(G1).dot(i3)>=0?1:-1}updateTransformState(e,t){let i=super.updateTransformState(e,t);return e.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateUp(),i}getViewFrontToObject(e){let t=e.getWorldPosition(new P),i=e.getWorldDirection(new P).multiplyScalar(this.targetOffset);return{position:t.clone().add(i),target:t}}getViewToTarget(e){let t=this.getWorldDirection(new P).multiplyScalar(this.targetOffset);return{position:e.clone().sub(t),target:e}}getViewToObject(e){let t=new P;return e.getWorldPosition(t),this.getViewToTarget(t)}setViewplaneSize(e,t,i=!1){if(this.aspect=e/t,i){let r=e>t?this.aspect:1,n=e>t?1:this.aspect;this.left=-395*r,this.right=395*r,this.top=1/n*395,this.bottom=1/n*-395}else this.left=.5*-e,this.right=.5*e,this.top=.5*t,this.bottom=.5*-t;this.updateProjectionMatrix()}copyViewPlaneSize(e){this.aspect=e.aspect,this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.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 e=this._projectionTransition;if(e===void 0)return 1;let t=(performance.now()-e.start)/e.duration;return t>=1?1:t<=0?0:ate(t)}get _activeSubCamera(){return this._cameraType==="PerspectiveCamera"?this.perspCamera:this.orthoCamera}_canAnimateProjection(){return Hd.projectionTransitionsEnabled&&typeof requestAnimationFrame=="function"&&typeof performance<"u"&&performance.now()-this._createdAt>=Hd.projectionTransitionMinAgeMs}_beginProjectionTransition(e){let t=this._projectionTransition;t===void 0&&(t={from:new Ve,blend:new Ve,blendInverse:new Ve,start:0,duration:Hd.projectionTransitionDuration,referenceDepth:1,raf:0,requestRender:e},this._projectionTransition=t),t.from.copy(this.projectionMatrix),t.start=performance.now(),t.duration=Hd.projectionTransitionDuration,t.referenceDepth=Number.isFinite(this.targetOffset)?Math.max(1,this.targetOffset):1,e&&(t.requestRender=e),t.raf!==0&&cancelAnimationFrame(t.raf),t.raf=requestAnimationFrame(this._tickProjectionTransition)}_applyProjectionTransition(){let e=this._projectionTransition;if(e===void 0)return;let t=(performance.now()-e.start)/e.duration;if(t>=1)return void this._endProjectionTransition();let i=ate(t),r=e.from.elements,n=this._activeSubCamera.projectionMatrix.elements,s=e.blend.elements,a=e.referenceDepth,o=Math.max(1e-6,r[15]-r[11]*a),l=i*o/(i*o+(1-i)*Math.max(1e-6,n[15]-n[11]*a));for(let u=0;u<16;u++)s[u]=r[u]+(n[u]-r[u])*l;e.blendInverse.copy(e.blend).invert(),this.projectionMatrix=e.blend,this.projectionMatrixInverse=e.blendInverse}_endProjectionTransition(){let e=this._projectionTransition;if(e===void 0)return;e.raf!==0&&cancelAnimationFrame(e.raf),this._projectionTransition=void 0;let t=this._activeSubCamera;this.projectionMatrix=t.projectionMatrix,this.projectionMatrixInverse=t.projectionMatrixInverse}_syncProjectionTransition(e){let t=e._projectionTransition;if(t===void 0)return void(this._projectionTransition!==void 0&&this._endProjectionTransition());let i=this._projectionTransition;i===void 0?(i={from:new Ve,blend:new Ve,blendInverse:new Ve,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(t.from),i.start=t.start,i.duration=t.duration,i.referenceDepth=t.referenceDepth,this._applyProjectionTransition()}setFocalLength(e){this.perspCamera.setFocalLength(e),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(e,t,i,r,n,s){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(e,t,i,r,n,s):this.orthoCamera.setViewOffset(e,t,i,r,n,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(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(e,t){return super.copy(e,t),this.parent=e.parent,this.orthoCamera.copy(e.orthoCamera),this.perspCamera.copy(e.perspCamera),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.far=e.far,this.view=e.view===null?null:Object.assign({},e.view),this._cameraType=e._cameraType,this.aspect=e.aspect,this.fov=e.fov,this.focus=e.focus,this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this.targetOffset=yf.sanitizeTargetOffset(e.targetOffset),this.updateProjectionMatrix(),this._syncProjectionTransition(e),this}toCameraState(e=[]){return N7({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},e)}updateCameraSubtype(e,t){let i=e==="perspective"?"PerspectiveCamera":"OrthographicCamera";t.zoom!==void 0&&this.setZoom(i,t.zoom),t.near!==void 0&&this.setNear(i,t.near),t.fov!==void 0&&i==="PerspectiveCamera"&&(this.fov=t.fov)}updateState(e,t){this.updateCameraState(e,t)}updateCameraState(e,t){this.updateState_Entity(e,t),e.far!==void 0&&(this.far=e.far),e.orthographic!==void 0&&this.updateCameraSubtype("orthographic",e.orthographic),e.perspective!==void 0&&this.updateCameraSubtype("perspective",e.perspective),e.type!==void 0&&(e.type!==this._cameraType&&this._canAnimateProjection()&&this._beginProjectionTransition(t?.shared.requestRender),this.cameraType=e.type),e.up!==void 0&&this.up.fromArray(e.up.map(i=>typeof i=="number"?i:0)),e.targetOffset!==void 0&&(this.targetOffset=yf.sanitizeTargetOffset(e.targetOffset)),e.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateProjectionMatrix()}updateByPatchedOp(e,t,i){super.updateByPatchedOp(e,t,i),e.path.length===1&&e.type===0&&this.updateCameraSubtype(e.path[0],e.props)}toState(e){return{...super.toState(e),...this.toCameraState(e),type:this.cameraType}}},(us=Hd).projectionTransitionsEnabled=!1,us.projectionTransitionDuration=350,us.projectionTransitionMinAgeMs=1e3});function b_e(e){return e.type==="TorusGeometry"&&e.arc===360}var x_e,n3,SH,cA=V(()=>{le(),x_e=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,revolutions:2,segments:40,pathRadius:10,pathType:0,pathSegments:30,cornerRadius:30,cornerSegments:4},e.parameters),r=Math.abs(i.width),n=Math.abs(i.height??r),s=Math.abs(i.depth??r),a=Math.abs(Math.min(r,s))/2;return{parameters:Object.assign(i,{width:r,height:n,depth:s,radius:a,segments:Math.round(i.segments),pathSegments:Math.round(i.pathSegments),cornerSegments:Math.round(i.cornerSegments)})}}static build(e){let{width:t,height:i,depth:r,radius:n,revolutions:s,segments:a,pathRadius:o,pathType:l,pathSegments:u,cornerRadius:h,cornerSegments:d}=e.parameters,c=new SH(!1,t,i,r,n,s,a,o,l,u,h,d);return Object.assign(c,{userData:{...e,type:"HelixGeometry"}})}},n3=new Uf([0,0,0],1),SH=class extends At{constructor(e=!0,t=1,i=1,r=1,n=1,s=1,a=1,o=1,l=1,u=1,h=1,d=1){if(super(),s===0)return;let c=e&&s===1;c&&(d=0),h>100&&(h=100),h===0&&(d=0);let p,f,m,g,v,y,_,b,x=()=>new P,w=new P,S=x(),M=x(),T=x(),E=x(),A=x(),R=x(),N=x(),D=x(),O=x(),z=x(),U=x(),G=i-2*o+.001,j=G/s,K=Math.ceil(a*s),q=K+1,se=G/K,ve=-G/2,oe=u+1,fe=2*Math.PI/u,_e=Math.PI/2/d,Z=Math.min((1-h/100)*o,o-.01),pe=o-Z,H=0,F=2*d+2,X=oe*F/2,re=X+oe*q,k=Math.max(0,oe*(q+F)),[Q,te,W]=[3,3,2].map(dt=>Array(k*dt).fill(0)),he=[],ce=n-o;function Ee(dt,et){let Yt=Math.PI/2;y=et*se,b=2*Math.PI*(y%j)/j+Yt,y+=ve,_=Math.sin(b)*ce,v=Math.cos(b)*ce,e?dt.set(v,_,y):dt.set(v,y,_)}Ee(w,-1e-10),Ee(S,0),E.copy(w),Ee(w,1);let Se=w.distanceTo(S),qe=c?0:pe+Z,Ne=Se*K+2*qe,He=Z,Re=Ne-qe;for(let dt=0;dt<=K;dt++){Ee(M,dt),U.subVectors(M,E).normalize(),E.copy(M),O.copy(M).setComponent(+e+1,0).normalize(),z.crossVectors(U,O).normalize();let et=dt===0,Yt=dt===K,si=et?3*Math.PI/2:_e,ar=et?He:Re,St=et?oe:re,Dt=et?0:k-oe,Qt=U.clone().multiplyScalar(et?-pe:pe).add(M),Ai=U.clone().multiplyScalar(et?-1:1).normalize();for(let wi=0;wi<oe;wi++){let mi=wi*fe;if(A.addVectors(w.copy(O).multiplyScalar(o*Math.cos(mi)),S.copy(z).multiplyScalar(o*Math.sin(mi))),R.copy(A).normalize(),et||Yt){c||(H=Dt+wi,[0,1,2].forEach(Ci=>{Q[3*H+Ci]=Qt.getComponent(Ci),te[3*H+Ci]=Ai.getComponent(Ci)}),W[2*H]=+Yt,W[2*H+1]=wi/u),S.copy(R).multiplyScalar(Z),T.addVectors(M,S);for(let Ci=0;Ci<d;Ci++){let Ir=Ci*_e+si;N.addVectors(w.copy(U).multiplyScalar(pe*Math.sin(Ir)),S.copy(R).multiplyScalar(pe*Math.cos(Ir))),D.copy(N).normalize(),S.addVectors(T,N),N.normalize(),H=St+Ci*oe+wi,[0,1,2].forEach(ir=>{Q[3*H+ir]=S.getComponent(ir),te[3*H+ir]=D.getComponent(ir)});let Wr=+et+Math.sin(Ir);W[2*H]=(ar+pe*Wr)/Ne,W[2*H+1]=wi/u}}S.addVectors(M,A),H=X+dt*oe+wi,[0,1,2].forEach(Ci=>{Q[3*H+Ci]=S.getComponent(Ci),te[3*H+Ci]=R.getComponent(Ci)}),W[2*H]=(qe+dt*Se)/Ne,W[2*H+1]=wi/u}}let ee=q+2*d+2,[Me,We]=[+c,ee-1];for(let dt=Me;dt<=We-1;dt++){let et=c&&dt===We-1;for(let Yt=0;Yt<oe-1;Yt++)p=dt*oe+Yt,f=p+1,m=(et?Yt:p)+oe,g=(et?Yt+1:f)+oe,dt===0?he.push(f,g,m):dt===ee-2?he.push(p,f,m):he.push(p,f,m,f,g,m)}this.setIndex(he),this.setAttribute("position",new Et(Q,3)),this.setAttribute("normal",new Et(te,3)),this.setAttribute("uv",new Et(W,2))}getClosedTorusIndicesForBooleanOrSubdiv(){let e,t,i,r,n=this.userData.parameters,s=Math.ceil(n.tubularSegments),a=n.radialSegments,o=a+1,l=[];for(let u=1;u<s;u++)for(let h=0;h<a;h++)e=u*o+h,t=e+1,i=e+o,r=t+o,l.push(e,t,i,t,r,i);for(let u=0;u<a;u++)e=s*o+u,t=e+1,i=u+o,r=u+1+o,l.push(e,t,i,t,r,i);return n3.array=new Uint32Array(l),n3.count=l.length,n3}}});function JIe(e){return lte||(lte=async function(){let t=e??"https://cdn.spline.design/@splinetool/runtime@2.0.35/build",i=import("./boolean.js"),[r,n]=await Promise.all([i,fetch(`${t}/boolean.wasm`).then(s=>s.arrayBuffer())]);await r.default({module_or_path:n}),pA=r}())}function pL(){if(pA===void 0)throw new Error("boolean-wasm is not loaded");return pA}function CX(e){let t=fA.get(e);if(t===void 0)throw new Error("Unknown csg mesh set handle "+e);return t}function RX(e){return fA.set(++TH,e),TH}function eOe(e,t,i){if(pA===void 0)return-1;let{positions:r,indices:n,normals:s}=function(a,o){if(o&&a.userData.positions!==void 0){let p=a.userData,f=[];for(let m=0,g=0;m<p.verticesPerFace.length;m++){let v=p.verticesPerFace[m];for(let y=1;y<v-1;y++)f.push(p.indices[g],p.indices[g+y],p.indices[g+y+1]);g+=v}return{positions:p.positions instanceof Float32Array?p.positions:new Float32Array(p.positions),indices:new Uint32Array(f)}}let l;l=b_e(a.userData.parameters)?a.getClosedTorusIndicesForBooleanOrSubdiv():a.getIndex();let u,h=a.getAttribute("position");if(l===null){u=new Uint32Array(h.count);for(let p=0;p<u.length;p++)u[p]=p}else u=l.array instanceof Uint32Array?l.array:new Uint32Array(l.array);let d=a.getAttribute("normal"),c=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:u,normals:c}}(e,t);return RX(new pA.CsgMesh(r,n,s))}function ote(e,t){let i=pL(),r=S_e[t];if(r===void 0)throw new Error("Unknown boolean operation "+t);let n=e.map(CX);if(n.length===1)return i.clone_mesh(n[0]);let s,a=[];if(t===2&&n.length>2){let o=n[0];for(let l=1;l<n.length-1;l++)o=i.boolean_mesh(o,n[l],0),a.push(o);s=i.boolean_mesh(n[n.length-1],o,2)}else if(t===2)s=i.boolean_mesh(n[1],n[0],2);else{let o=n[n.length-1];for(let l=0;l<n.length-1&&(o=i.boolean_mesh(o,n[l],r),a.push(o),o.tri_count()!==0);l++);s=o,a.pop()}for(let o of a)o.free();return s}function NF(e,t){CX(e).transform(new Float32Array(t.elements))}function w_e(e){let t=fA.get(e);t!==void 0&&(t.free(),fA.delete(e))}var pA,fA,TH,lte,S_e,U4=V(()=>{le(),cA(),fA=new Map,TH=0,S_e={0:0,1:1,2:2}});function A0(e){return e!==null&&"booleanOp"in e}var MH,T_e,tOe=V(()=>{le(),xl(),U4(),MH=class extends L4(Cr){constructor(){super(...arguments),this.booleanMeshSetAddress=-1,this.booleanWasTransformed=!1,this.booleanMatrixInvOld=new Ve}updateVisible(e){super.updateVisible(e),this.visible=!A0(this.parent)&&this.visible,A0(this.parent)&&this.parent.invalidateDownstreamBooleanData()}onClonerLayoutUpdated(){A0(this.parent)&&this.invalidateDownstreamBooleanData()}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(w_e(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(e=!1){return e?this.booleanWasTransformed=!0:this.freeBooleanPointer(),A0(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let e of this.children)e instanceof MH&&(e.freeBooleanPointer(),A0(e)&&e.invalidateUpstreamBooleanData())}updateTransformState(e,t){let i=super.updateTransformState(e,t);return i&&A0(this.parent)&&this.invalidateDownstreamBooleanData(!0),i}onVariableUpdate(e=!1){super.onVariableUpdate(e),A0(this.parent)&&this.invalidateDownstreamBooleanData(!0)}}}),iOe=V(()=>{T_e=null});function PX(e,t=0,i=e.count,r,n){let s=1/0,a=1/0,o=1/0,l=-1/0,u=-1/0,h=-1/0;for(let d=t;d<i;d++){let c=e.getX(d),p=e.getY(d),f=e.getZ(d);c<s&&(s=c),p<a&&(a=p),f<o&&(o=f),c>l&&(l=c),p>u&&(u=p),f>h&&(h=f)}AM.min.set(s,a,o),AM.max.set(l,u,h),AM.getCenter(r),AM.getSize(n).multiplyScalar(.5)}var AM,hte,ute,Ss,Na=V(()=>{le(),tOe(),iOe(),AM=new fn,hte=new At,ute=new Zl,Ss=class extends MH{constructor(e,t){super(hte,ute),this.super_Entity(e,t)}updateState(e,t){this.updateState_Entity(e,t)}raycast(e,t){let i=T_e;i===null?super.raycast(e,t):i(this,e,t)}updateEntityBoxSize(e,t){let i=this.geometry.getAttribute("position");i!==void 0?PX(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,e,t):super.updateEntityBoxSize(e,t)}}});function fL(e){return e?.isClassicNodeMaterial===!0}var Fr,mA,M_e,E_e,xE,A_e,C_e,R_e,DX=V(()=>{}),bu=V(()=>{le(),Fr=class extends ot{constructor(e,t,i,r){super(e,t,i),this.isColorA=!0,this.a=r}setRGBA(e,t,i,r){super.setRGB(e,t,i),this.a=r}copy(e){return super.copy(e),this.a="a"in e?e.a:1,this}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}equals(e){return super.equals(e)&&this.a===e.a}setStyle(e,t="srgb"){let i;if(e==="transparent")return this.setRGBA(0,0,0,0),this;if(i=/^((?:rgb|hsl)a?)\(([^)]*)\)/.exec(e)){let r,n=i[1],s=i[2];switch(n){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.a=n==="rgba"?parseFloat(r[4]):1,super.setStyle(e,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)%\s*,\s*(\d*\.?\d+)%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.a=n==="hsla"?parseFloat(r[4]):1,super.setStyle(e,t)}}return super.setStyle(e,t)}get x(){return this.r}get y(){return this.g}get z(){return this.b}get w(){return this.a}set x(e){this.r=e}set y(e){this.g=e}set z(e){this.b=e}set w(e){this.a=e}}}),P_e=V(()=>{bu(),mA=class extends Fr{}}),rOe=V(()=>{M_e=class{constructor(e=1e4){this.timeout=e,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(...e){}remove(e){let t=this.cache.get(e);t&&(this.dispose(e,t.data),this.cache.delete(e),t.prev.next=t.next,t.next.prev=t.prev,t.next=null,t.prev=null,t.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 e=Date.now(),t=this.head.next;for(;t.time<e-this.timeout;){this.dispose(t.src,t.data),this.cache.delete(t.src);let i=t;t=t.next,t.prev=this.head,this.head.next=t,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(e){return this.cache.get(e)?.data}load(e){let t=Date.now(),i=this.cache.get(e);return i===void 0?(i={data:this.create(e),src:e,time:t,next:null,prev:null},this.cache.set(e,i)):(i.time=t,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((e,t)=>{this.dispose(t,e.data),e.next=null,e.prev=null,e.data=null}),this.cache.clear(),this.head.next=this.tail,this.tail.prev=this.head}destroy(){this.disposeAll(),this.head=null,this.tail=null}}}),D_e=V(()=>{rOe(),E_e=class extends M_e{create(e){return URL.createObjectURL(new Blob([e]))}dispose(e,t){URL.revokeObjectURL(t)}}}),N_e=V(()=>{A_e=class{constructor(e,t){this.data=e,this.cache=t,this.refCount=0}deref(){this.refCount,this.refCount-=1,this.refCount===0&&(this.cache.remove(this),this.dispose())}dispose(){this.refCount}},C_e=class{constructor(){this.cache=new Map}remove(e){this.cache.delete(e.data)}load(e){let t=this.cache.get(e);return t===void 0&&(t=this.create(e),this.cache.set(e,t)),t.refCount+=1,t}}}),nOe=V(()=>{le(),R_e=class extends xye{constructor(e){super(e),this.type=ni}parse(e){let t=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,m){f=f||1024;let g=p.pos,v=-1,y=0,_="",b=String.fromCharCode.apply(null,new Uint16Array(p.subarray(g,g+128)));for(;0>(v=b.indexOf(`
4162
+ })();`}),l1e=V(()=>{rX=class{constructor(e,t,i){this.deps=e,this.onConsole=t,this.onEvent=i,this.disposed=!1,this.eventUnsubs=new Map,this.variablePollHandle=null,this.lastVariables=null}dispose(){this.disposed=!0;for(let e of this.eventUnsubs.values())e();this.eventUnsubs.clear(),this.stopVariablePolling()}execute(e,t){let i=this.deps;switch(e){case"setVariable":{let r=i.setVariable(String(t[0]),t[1]);return r.warning&&this.onConsole("warn",r.warning),r.ok}case"setVariables":{let r=t[0]??{},n=!0;for(let[s,a]of Object.entries(r)){let o=i.setVariable(s,a);o.warning&&this.onConsole("warn",o.warning),n=n&&o.ok}return n}case"getVariable":return i.getVariable(String(t[0]));case"getVariables":return i.getVariables();case"getAllObjects":return i.getAllObjects();case"findObjectByName":case"findObjectById":return i.findObject(String(t[0]));case"getGeometry":{let r=i.getGeometry(String(t[0]),t[1]??{});return r.warning&&this.onConsole("warn",r.warning),r.data}case"updateObject":return i.updateObject(String(t[0]),t[1]??{});case"createObject":return i.createObject(String(t[0]),t[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(t[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(t[0]),t[1]);case"cloneObject":return i.cloneObject(String(t[0]),t[1]??{});case"removeObject":return i.removeObject(String(t[0]));case"spawnObject":{let r=i.spawnObject(String(t[0]),t[1]??{});return r.warning&&this.onConsole("warn",r.warning),r.object}case"destroyObject":return i.destroyObject(String(t[0]));case"setInstanceTransforms":{let r=t[1]===null||t[1]===void 0?null:t[1],n=i.setInstanceTransforms(String(t[0]),r);return n<0&&this.onConsole("warn",`spline.setInstanceTransforms: "${String(t[0])}" has no cloner \u2014 make the object a cloner first (its copies are what this drives).`),n}case"emitEvent":case"emitEventReverse":{let r=i.emitEvent(String(t[0]),String(t[1]),e==="emitEventReverse");return r.warning&&this.onConsole("warn",r.warning),r.ok}case"requestRender":return i.requestRender(),!0;case"listenEvent":{let r=String(t[0]);return r==="variableChange"?this.startVariablePolling():this.eventUnsubs.has(r)||this.eventUnsubs.set(r,i.addSplineEventListener(r,n=>{this.onEvent(r,n)})),!0}case"unlistenEvent":{let r=String(t[0]);return r==="variableChange"?this.stopVariablePolling():(this.eventUnsubs.get(r)?.(),this.eventUnsubs.delete(r)),!0}default:throw new Error(`Unknown spline bridge method: ${e}`)}}startVariablePolling(){this.variablePollHandle===null&&(this.lastVariables=this.deps.getVariables(),this.variablePollHandle=window.setInterval(()=>{if(this.disposed)return;let e=this.deps.getVariables(),t=function(i,r){let n=[];for(let s of Object.keys(r))i[s]!==r[s]&&n.push({name:s,value:r[s]});return n}(this.lastVariables??{},e);this.lastVariables=e;for(let i of t)this.onEvent("variableChange",i)},100))}stopVariablePolling(){this.variablePollHandle!==null&&(window.clearInterval(this.variablePollHandle),this.variablePollHandle=null),this.lastVariables=null}}});function lIe(e,t,i,r){return[e[0]*t+e[4]*i+e[8]*r+e[12],e[1]*t+e[5]*i+e[9]*r+e[13],e[2]*t+e[6]*i+e[10]*r+e[14]]}var hIe=V(()=>{}),h1e,uIe=V(()=>{}),dIe=V(()=>{nX(),l1e(),h1e=class{constructor(e,t,i){this.iframe=e,this.deps=t,this.onConsole=i,this.disposed=!1,this.handshakeSeen=!1,this.handshakeTimer=null,this.onMessage=r=>{if(this.disposed||r.source!==this.iframe.contentWindow)return;let n=r.data;var s;typeof(s=n)!="object"||s===null||s[hg]!==!0||typeof s.kind!="string"||this.handleMessage(n)},this.host=new rX(t,i,(r,n)=>{this.sendEvent(r,n)})}attach(){window.addEventListener("message",this.onMessage),this.send({[hg]:!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(e){switch(e.kind){case"ready":this.handshakeSeen=!0,this.send({[hg]:!0,kind:"ready-ack"});break;case"console":this.onConsole(e.level,e.text);break;case"call":{let t;try{t=Promise.resolve(this.host.execute(e.method,e.args))}catch(i){t=Promise.reject(i)}t.then(i=>{this.send({[hg]:!0,kind:"result",id:e.id,ok:!0,value:i,error:void 0})},i=>{let r=i instanceof Error?i.message:String(i);this.send({[hg]:!0,kind:"result",id:e.id,ok:!1,value:void 0,error:r}),this.onConsole("error",r)});break}case"input":this.dispatchInput(e.event)}}send(e){this.iframe.contentWindow?.postMessage(e,"*")}sendEvent(e,t){this.send({[hg]:!0,kind:"event",eventName:e,payload:t})}dispatchInput(e){let t=this.deps.getCanvas();if(!t)return;let i=this.iframe.getBoundingClientRect(),r={bubbles:!0,cancelable:!0,view:window,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey};switch(e.type){case"pointerdown":case"pointermove":case"pointerup":case"pointercancel":t.dispatchEvent(new PointerEvent(e.type,{...r,clientX:(e.x??0)+i.left,clientY:(e.y??0)+i.top,button:e.button,buttons:e.buttons,pointerId:e.pointerId,pointerType:e.pointerType,isPrimary:e.isPrimary,movementX:e.movementX,movementY:e.movementY}));break;case"click":case"dblclick":t.dispatchEvent(new MouseEvent(e.type,{...r,clientX:(e.x??0)+i.left,clientY:(e.y??0)+i.top,button:e.button,buttons:e.buttons}));break;case"wheel":{let n=new WheelEvent("wheel",{...r,clientX:(e.x??0)+i.left,clientY:(e.y??0)+i.top,deltaX:e.deltaX,deltaY:e.deltaY,deltaMode:e.deltaMode});typeof e.wheelDeltaX=="number"&&Object.defineProperty(n,"wheelDeltaX",{value:e.wheelDeltaX}),typeof e.wheelDeltaY=="number"&&Object.defineProperty(n,"wheelDeltaY",{value:e.wheelDeltaY}),t.dispatchEvent(n);break}case"keydown":case"keyup":t.dispatchEvent(new KeyboardEvent(e.type,{...r,key:e.key,code:e.code,repeat:e.repeat}))}}}}),Hr=V(()=>{iX(),$Ne(),XNe(),YNe(),ZNe(),QNe(),JNe(),eIe(),tIe(),iIe(),rIe(),aIe(),nX(),oIe(),l1e(),hIe(),uIe(),dIe()}),cIe=V(()=>{});function u1e(e){return Array.isArray(e)?e:[e]}function kO(e,t){let i=0;for(;i<e.length&&i<t.length;){if(e[i]<t[i])return-1;if(e[i]>t[i])return 1;i+=1}return i!==t.length?-1:i!==e.length?1:0}var pIe=V(()=>{});function Ho(e,t){return Object.setPrototypeOf(e,t),e}function $U(e){let t={...e};return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),t}function wg(e,t,i){if(e===void 0?t===void 0?(e=0,t=10):e=t-10:t===void 0&&(t=e+10),e>t){let s=e;e=t,t=s}let r=[],n=1/(i+1);for(let s=0;s<i;s++){let a=e+(t-e)*(s+.75+.5*Math.random())*n;r.push(a)}return r}function Yy(e){return e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Float32Array||e instanceof Float64Array}var fIe=V(()=>{});function sX(e){if(e.deepFreeze!==void 0)return void e.deepFreeze(e);let t=Object.getOwnPropertyNames(e);for(let i of t){let r=e[i];r&&typeof r=="object"&&sX(r)}return Object.freeze(e)}function d1e(e){for(let t of Object.keys(e))e[t]===void 0&&delete e[t];return e}var XU,VO,I7,ai,aX,mIe=V(()=>{}),ha=V(()=>{cIe(),pIe(),fIe(),mIe()}),oX=V(()=>{XU=class{},VO=class extends XU{constructor(e){super(),this.id=e}},I7=class extends XU{constructor(e){super(),this.data=e}}}),gIe=V(()=>{}),S4=V(()=>{ai=class{modifyById(e,t){let i=this;if(i[e]===void 0)throw new Error("not expected");{let r={...i,[e]:t};return Object.setPrototypeOf(r,ai.prototype),r}}add(e,t){return this.runOp({type:1,id:e,data:t})?.data??this}runOp(e){let t=this;if(e.type===1){let i,r=t[e.id];i=r===void 0?{type:2,id:e.id}:{type:1,id:e.id,data:r};let{id:n,data:s}=e,a={...t,[n]:s};return Object.setPrototypeOf(a,ai.prototype),{data:a,actual:e,reverse:i}}if(e.type===2){let{id:i}=e,r=t[i];if(r===void 0)return null;{let n={...t};return Object.setPrototypeOf(n,ai.prototype),delete n[i],{data:n,actual:e,reverse:{type:1,id:i,data:r}}}}return null}}}),lX=V(()=>{aX=class extends Error{}});function c1e(e,t){for(let i of e)t(i.id,i.data)!==!0&&c1e(i.children,t)}function p1e(e,t){if(t(e.id,e.data)!==!0)for(let i of e.children)p1e(i,t)}var Aa,HC,ew,Nt,n1=V(()=>{ha(),lX(),ha(),Aa=class extends Array{constructor(...e){super(...e),Lc(this,"partialObjectCaches"),Lc(this,"objCaches"),Lc(this,"parentCaches"),Object.setPrototypeOf(this,Aa.prototype)}deepFreeze(){let e=0;for(;e<this.length;)sX(this[e]),e++}fillCaches0(e,t){this.objCaches.set(e.id,e),this.parentCaches.set(e.id,t);for(let i of e.children)this.fillCaches0(i,e.id)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,this.parentCaches=new Map;for(let e of this)this.fillCaches0(e,null)}}randomId(){this.fillCaches();let e=Array.from(this.objCaches.keys());if(e.length!==0)return e[Math.max(0,Math.floor(Math.random()*e.length)-1)]}nonExistOrDescendantOf(e,t){if(!this.has(e))return!0;for(;e;){let i=this.parent(e);if(i===t)return!0;e=i}return!1}rootAcestor(e){for(;e;){let t=this.parent(e);if(!t)return e;e=t}return e}isDescendantOf(e,t){for(;e;){let i=this.parent(e);if(i===t)return!0;e=i}return!1}data(e){return this.get(e)?.data}has(e){return this.childrenOf(e)!==void 0}partialCache(e){this.partialObjectCaches===void 0&&(this.partialObjectCaches=new Map);let t=this.get(e);t!==void 0&&this.partialObjectCaches.set(e,t)}get(e){if(this.partialObjectCaches!==void 0){let t=this.partialObjectCaches.get(e);if(t!==void 0)return t}return this.fillCaches(),this.objCaches.get(e)}childrenOf(e){return e===null?this:this.get(e)?.children}traverseFrom(e,t){if(e===null)this.traverse(t);else{let i=this.get(e);i&&p1e(i,t)}}traverse(e){c1e(this,e)}totalSize(){return this.fillCaches(),this.objCaches.size}parent(e){return this.fillCaches(),this.parentCaches.get(e)}childrenArray(e){return e===null?this:this.get(e).children}modifyById(e,t){if(this.get(e)===void 0)throw new Error("not expected");{let i=this.parent(e),r=this.childrenArray(i),n=r.findIndex(o=>o.id===e);if(n<0)throw new Error("not expected");let s=r[n];r=[...r],r[n]={...s,data:t};let a=new Map;return a.set(e,r[n]),this.modifyArrayBy(i,r,a)}}modifyArrayBy(e,t,i=void 0){let r=e,n=t;for(;r!==null;){let a=n,o=r;if(r=this.parent(r),r===void 0)throw new Error;n=this.childrenArray(r);let l=n.findIndex(u=>u.id===o);if(l<0)throw new Error;n=[...n],n[l]={...n[l],children:a},i&&i.set(o,n[l])}Object.setPrototypeOf(n,Aa.prototype);let s=n;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(e){switch(e.type){case 7:return this.addOp(e);case 8:return this.deleteOp(e);case 9:return this.moveOp(e)}return null}checkDuplicatedIdRec({id:e,children:t}){if(this.get(e)!==void 0)return!0;for(let i of t)if(this.checkDuplicatedIdRec(i))return!0;return!1}addOp(e){let{parent:t,fi:i,id:r,data:n,children:s}=e;if(t!==null&&this.get(t)===void 0||this.checkDuplicatedIdRec(e))return null;{let a=t,o=this.childrenArray(a),l={fi:i,id:r,data:n,children:s};return o=[...o,l],o.sort((u,h)=>u.fi-h.fi),e.localIndex=o.indexOf(l),{data:this.modifyArrayBy(a,o),actual:e,reverse:{type:8,id:r}}}}deleteOp(e){let{id:t}=e;if(this.get(t)===null)return null;{let i=this.parent(t);if(i===void 0)return null;let r=this.childrenArray(i),n=r.findIndex(a=>a.id===t);e.localIndex=n,r=[...r];let s=r.splice(n,1)[0];return{data:this.modifyArrayBy(i,r),actual:e,reverse:{type:7,...s,parent:i}}}}moveOp(e){let{parent:t,fi:i,id:r}=e;if(t!==null&&this.get(t)===void 0)return this.deleteOp({type:8,id:r});if(t!==null){let d=t;for(;d!==null;){if(d===void 0)throw new Error;if(d===r)throw new aX("cyclic tree");d=this.parent(d)}}let n=this.parent(r);if(n===void 0)return null;let s=n,a=this.childrenArray(n),o=a.findIndex(d=>d.id===r);a=[...a];let l=a.splice(o,1)[0],u=this.modifyArrayBy(n,a);n=t,a=u.childrenArray(n);let h=l.fi;return l={...l,fi:i},a=[...a,l],a.sort((d,c)=>d.fi-c.fi),e.localIndex=a.indexOf(l),u=u.modifyArrayBy(n,a),{data:u,actual:e,reverse:{type:9,parent:s,fi:h,id:r}}}previous(e,t){if(t===null){let r=this.childrenArray(e);return r.length===0?null:r[r.length-1].id}let i=null;for(let r of this.childrenArray(e)){if(r.id===t)return i;i=r.id}return null}traverseSortNext(e){let t=this.parent(e);if(t!==void 0){let i=this.childrenArray(t),r=i.findIndex(n=>n.id===e)+1;if(r<i.length)return i[r].id;if(t)return this.traverseSortNext(t)}}sortNext(e){let t=this.childrenArray(e);return t.length>0?t[0].id:this.traverseSortNext(e)}traverseSortPrevious(e){let t=this.childrenArray(e);return t.length>0?this.traverseSortPrevious(t[t.length-1].id):e}sortPrevious(e){let t=this.parent(e);if(t!==void 0){let i=this.childrenArray(t),r=i.findIndex(n=>n.id===e)-1;return r>=0?this.traverseSortPrevious(i[r].id):t}}getAllSorted(e){let t=[];for(let i of e){let r=this.getWithSortKey(i.id);r!==void 0&&t.push({...i,...r})}t.sort((i,r)=>kO(i.sortKey,r.sortKey));for(let i of t)delete i.sortKey;return t}getAllIdSorted(e){let t=[];for(let i of e){let r=this.getWithSortKey(i);r!==void 0&&t.push(r)}t.sort((i,r)=>kO(i.sortKey,r.sortKey));for(let i of t)delete i.sortKey;return t.map(i=>i.id)}getWithSortKey(e){let t=e,i=[],r=this.get(t),n=r;if(r!==void 0){for(;t;)i.splice(0,0,r.fi),t=this.parent(t),t!==null&&(r=this.get(t));return{...n,sortKey:i}}}insertBeforeHelper(e,t,i){return this.insertAfterHelper(e,this.previous(e,t),i)}insertAfterHelper(e,t,i){let r=this.childrenArray(e);if(t===null){if(r.length===0)return wg(0,i,i);{let n=r[0].fi;return wg(n-i,n,i)}}{let n=this.get(t);if(n===void 0||this.parent(t)!==e)throw new Error("illegal args");let s=r.find(a=>a.fi>n.fi);if(s===void 0){let a=r[r.length-1].fi;return wg(a,a+i,i)}return wg(n.fi,s.fi,i)}}}}),hX=V(()=>{var e;ha(),HC=null,(e=ew||(ew={})).setPreservePrototype=function(t){HC=t},e.tryPreservePrototype=function(t,i){return Object.getPrototypeOf(t)===HC&&Object.setPrototypeOf(i,HC),i},e.runOp=function(t,i){if(i.type!==0)return null;if(Array.isArray(t)||Yy(t)){let r=i.props,n={},s=Yy(t)?t.slice():[...t],a=!1;if(r)for(let o of Object.keys(r)){let l=parseInt(o);if(isNaN(l))throw new Error("wrong index");n[o]=s[l],s[l]=r[o],a=!0}return a?{data:s,actual:i,reverse:{type:0,props:n}}:null}{let r=i.props,n={},s={...t},a=!1;if(r)for(let o of Object.keys(r)){n[o]=s[o];let l=r[o];l===void 0?delete s[o]:s[o]=l,a=!0}return a?{data:e.tryPreservePrototype(t,s),actual:i,reverse:{type:0,props:n}}:null}}}),s1=V(()=>{ha(),ha(),Nt=class extends Array{constructor(...e){super(...e),Lc(this,"objCaches"),Object.setPrototypeOf(this,Nt.prototype)}deepFreeze(){let e=0;for(;e<this.length;)sX(this[e]),e++}fillCaches0(e){this.objCaches.set(e.id,e)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,Object.getOwnPropertyDescriptor(this,"objCaches").enumerable=!1;for(let e of this)this.fillCaches0(e)}}randomId(){this.fillCaches();let e=Array.from(this.objCaches.keys());if(e.length!==0)return e[Math.max(0,Math.floor(Math.random()*e.length)-1)]}data(e){return this.get(e)?.data}get(e){return this.fillCaches(),this.objCaches.get(e)}modifyById(e,t){if(this.get(e)===void 0)throw new Error("not expected");{let i=this,r=i.findIndex(s=>s.id===e);if(r<0)throw new Error("not expected");let n=i[r];return i=[...i],i[r]={...n,data:t},this.modifyArrayBy(i)}}modifyArrayBy(e){Object.setPrototypeOf(e,Nt.prototype);let t=e;return typeof process<"u"||t.fillCaches(),t}runOp(e){switch(e.type){case 4:return this.addOp(e);case 5:return this.deleteOp(e);case 6:return this.moveOp(e)}return null}addOp(e){let{fi:t,id:i,data:r}=e,n=this,s={fi:t,id:i,data:r};return n=[...n,s],n.sort((a,o)=>a.fi-o.fi),e.localIndex=n.indexOf(s),{data:this.modifyArrayBy(n),actual:e,reverse:{type:5,id:i}}}deleteOp(e){let{id:t}=e,i=this,r=i.findIndex(s=>s.id===t);if(r===-1)return null;e.localIndex=r,i=[...i];let n=i.splice(r,1)[0];return{data:this.modifyArrayBy(i),actual:e,reverse:{type:4,...n}}}moveOp(e){let{fi:t,id:i}=e,r=this;r=[...r];let n=r.findIndex(o=>o.id===i);if(n===-1)return null;let s=r[n].fi,a={...r[n],fi:t};return r[n]=a,r.sort((o,l)=>o.fi-l.fi),e.localIndex=r.indexOf(a),{data:this.modifyArrayBy(r),actual:e,reverse:{type:6,fi:s,id:i}}}previous(e){if(e===null)return this.length===0?null:this[this.length-1].id;let t=null;for(let i of this){if(i.id===e)return t;t=i.id}return null}insertBeforeHelper(e,t){return this.insertAfterHelper(this.previous(e),t)}insertAfterHelper(e,t){let i=this;if(e===null){if(i.length===0)return wg(0,t,t);{let r=i[0].fi;return wg(r-t,r,t)}}{let r=this.get(e);if(r===void 0)throw new Error("illegal args");let n=i.find(s=>s.fi>r.fi);if(n===void 0){let s=i[i.length-1].fi;return wg(s,s+t,t)}return wg(r.fi,n.fi,t)}}}});function vIe(e,t){let i={cur:[],result:[],len:0};return[e=bx(e,t,i)??e,i.result]}function sI(e,t){return e===null?null:(e.cur[e.len]=t,e.len+=1,e)}function aI(e){e&&(e.len-=1)}function f1e(e,t,i){let r=!1,n=e.map(s=>{let a=s.id,o=t[a];if(o!==void 0&&typeof o=="string"&&(r=!0,a=o,i!==null))throw new Error("not supported");let l=bx(s.data,t,sI(i,a));aI(i),r=r||l!==void 0,l===void 0&&(l=s.data);let u=f1e(s.children,t,i);return u!==void 0?r=!0:u=s.children,{...s,id:a,data:l,children:u}});if(r)return n}function bx(e,t,i){if(e instanceof Aa){let r=f1e(e,t,i);return r!==void 0&&Object.setPrototypeOf(r,Object.getPrototypeOf(e)),r}if(e instanceof Nt)return function(r,n,s){let a=!1,o=r.map(l=>{let u=l.id,h=n[u];if(h!==void 0&&typeof h=="string"&&(a=!0,u=h,s!==null))throw new Error("not supported");let d=bx(l.data,n,sI(s,u));return aI(s),a=a||d!==void 0,d===void 0&&(d=l.data),{...l,id:u,data:d}});if(a)return Object.setPrototypeOf(o,Object.getPrototypeOf(r)),o}(e,t,i);if(Array.isArray(e)){let r=!1,n=e.map((s,a)=>{let o=bx(s,t,sI(i,a));return aI(i),r=r||o!==void 0,o===void 0&&(o=s),o});return r?(Object.setPrototypeOf(n,Object.getPrototypeOf(e)),n):void 0}if(e&&typeof e=="object"&&!Yy(e)){let r={},n=!1;for(let[s,a]of Object.entries(e))if(s!=="name"&&s!=="variableId"){let o=t[s];if(typeof o=="string"){if(i!==null)throw new Error("not supported");n=!0,s=o}let l=bx(a,t,sI(i,s));aI(i),n=n||l!==void 0,l===void 0&&(l=a),r[s]=l}else r[s]=a;return n?(Object.setPrototypeOf(r,Object.getPrototypeOf(e)),r):void 0}if(typeof e=="string"){let r=t[e];return r!==void 0&&function(n){if(n===null)return null;n.result.push(n.cur.slice(0,n.len))}(i),r}}var m1e=V(()=>{n1(),s1(),ha()});function xx(e){return e&&typeof e=="object"&&e instanceof Qs}function uX(e,t){if(t===void 0)return;let i=!1,r=e.map(n=>{let s=n.id,a=mE(n.data,t[s]);if(i=i||a!==void 0,a===void 0&&(a=n.data),n.children){let o=uX(n.children,t);return o!==void 0?i=!0:o=n.children,{...n,id:s,data:a,children:o}}return{...n,id:s,data:a}});return i?r:void 0}function mE(e,t){if(!xx(t))return t;if(e instanceof Aa){let i=uX(e,t);return i!==void 0&&Object.setPrototypeOf(i,Object.getPrototypeOf(e)),i}if(e instanceof Nt)return function(i,r){if(r===void 0)return;let n=!1,s=i.map(a=>{let o=a.id,l=mE(a.data,r[o]);return n=n||l!==void 0,l===void 0&&(l=a.data),{...a,id:o,data:l}});return n?(Object.setPrototypeOf(s,Object.getPrototypeOf(i)),s):void 0}(e,t);if(Array.isArray(e)){let i=!1,r=e.map((n,s)=>{let a=mE(n,t[s]);return i=i||a!==void 0,a===void 0&&(a=n),a});return i?(Object.setPrototypeOf(r,Object.getPrototypeOf(e)),r):void 0}if(e instanceof Qs)return dX(e,t);if(e&&typeof e=="object"){let i={},r=!1;for(let[n,s]of Object.entries(e)){let a=mE(s,t[n]);r=r||a!==void 0,a===void 0&&(a=s),i[n]=a}return r?(Object.setPrototypeOf(i,Object.getPrototypeOf(e)),i):void 0}}function dX(e,t){if(e===void 0)return t;if(t===void 0)return e;if(!xx(t))return t;if(!xx(e))return Ig.apply(e,t);let i=new Set;for(let n of Object.keys(e))i.add(n);for(let n of Object.keys(t))i.add(n);let r=new Qs;for(let n of i){let s=dX(e===void 0?void 0:e[n],t===void 0?void 0:t[n]);r[n]=s}return r}var Qs,Ig,GO,Xa,uJ,cX=V(()=>{var e;n1(),s1(),E4(),ha(),Qs=class{unusedFunOverridesTable(t){}runOp(t){let i=[],r=this,n=0,s={};for(;n<t.path.length;){if(i.push(r),r=r===void 0?void 0:r[t.path[n]],r!==void 0&&!xx(r))return null;n+=1}r=r?$U(r):new Qs;for(let[a,o]of Object.entries(t.props)){let l=r[a];s[a]=l,o===void 0?delete r[a]:r[a]=o}for(;n>0;){if(Object.keys(r).length===0){let a=i[n-1];a&&(r=$U(a),delete r[t.path[n-1]])}else{let a=i[n-1];if(a){let o=$U(a);o[t.path[n-1]]=r,r=o}else{let o=new Qs;o[t.path[n-1]]=r,r=o}}n-=1}return{data:Object.setPrototypeOf(r,Qs.prototype),actual:t,reverse:{...t,props:s}}}},(e=Ig||(Ig={})).apply=function(t,i){return mE(t,i)??t},e.merge=function(t,i){return dX(t,i)},e.filterOp=function(t,i){let r=0,n=i.path,s=t;for(;r<n.length&&s!==void 0;){if(s=Ta.zoomOnce(s,n[r]),s===void 0)return i;if(!xx(s))return;r+=1}if(s===void 0)return i;if(xx(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=uX([i],s);return a?a[0]:i}return i}}}),yIe=V(()=>{ha(),E4(),S4(),n1(),lX(),hX(),s1(),m1e(),cX(),(GO||(GO={})).replaceProps=function(e,t){let i=Ta.zoom(t,e.path);if(typeof i=="object"){let r={};for(let n of Object.keys(e.props))r[n]=i[n];return{...e,props:r}}return{...e,props:{}}},(e=>{function t(n,s){let a=s.path,o=[];for(;;){let l;if(n instanceof Qs&&s.type===0&&(l=n.runOp({...s,path:a.slice(o.length)}),l===null&&(l=void 0)),l===void 0&&o.length===a.length&&(l=n instanceof Aa||n instanceof Nt||n instanceof ai?n.runOp(s):ew.runOp(n,s)),l!==void 0){if(l!==null){let d=l.data;for(let c=o.length-1;c>=0;c--){let p=a[c],f=o[c];if(f instanceof Aa){if(typeof p=="number")throw new Error("illegal arg");d=f.modifyById(p,d)}else if(f instanceof Nt){if(typeof p=="number")throw new Error("illegal arg");d=f.modifyById(p,d)}else if(f instanceof ai){if(typeof p=="number")throw new Error("illegal arg");d=f.modifyById(p,d)}else if(f instanceof Qs){let m={...f,[p]:d};d=Object.setPrototypeOf(m,Qs.prototype)}else{if(typeof f!="object")return null;if(Array.isArray(f)||Yy(f)){if(typeof p=="string"&&(p=parseInt(p),isNaN(p)))throw new Error("Invalid path");let m=d;d=Yy(f)?f.slice():[...f],d[p]=m}else d=ew.tryPreservePrototype(f,{...f,[p]:d})}}return{data:d,actual:{...l.actual,path:a},reverse:{...l.reverse,path:a}}}return null}let u,h=a[o.length];if(n instanceof Aa){if(typeof h=="number")throw new Error("");u=n.get(h)?.data}else if(n instanceof Nt){if(typeof h=="number")throw new Error("");u=n.get(h)?.data}else n!==null&&(u=n[h]);if(u===void 0)return null;o.push(n),n=u}}function i(n,s){for(let a=0;a<n.length&&a<s.length;a++)if(n[a]!==s[a])return!0;return!1}function r(n,s){if(n.length!==s.length)return!1;for(let a=0;a<n.length;a++)if(n[a]!==s[a])return!1;return!0}e.drop=function(n,s){return{...n,path:n.path.slice(s)}},e.applySimple=function(n,s){return t(n,s)?.data??n},e.apply=t,e.pathDisjoint=i,e.pathEq=r,e.commutative=function(n,s){return i(n.path,s.path)},e.subsumed=function(n,s){return!(n.type!==0||s.type!==0||!r(n.path,s.path))&&Object.keys(n.props).every(a=>s.props[a]!==void 0)}})(Xa||(Xa={})),(e=>{function t(i,r){let n=i,s=[],a=[];for(let o of r)try{if(o.type===3||o.type===5&&o.path[o.path.length-1]==="variables"){let l,u,h;if(o.type===3?(l=Ta.zoom(n,[...o.path,o.id]),h=Xa.apply(n,{...o,type:2})):(l=Ta.zoom(n,[...o.path,o.id,"value"]),h=Xa.apply(n,o)),h!==null){n=h.data;let[d,c]=vIe(n,{[o.id]:l});n=d;for(let p=0;p<c.length;p++){let f=c[p],m=f.pop();if(typeof m=="number"){let g=[m];for(let y=p+1;y<c.length;y++){let _=c[y],b=_[_.length-1];if(typeof b!="number"||!Ta.equal(f,_.slice(0,_.length-1)))break;g.push(b),c.splice(y,1)}let v=Ta.zoom(n,f);u=v.map((y,_)=>g.includes(_)?o.id:y),l=v,m=f.pop()}else{if(m==="alphaOverride"||m==="alpha"){l/=100;let g=l,v=Ta.zoom(n,f.slice(0,f.length-2)),y=v.layers.map(_=>_.id===f[f.length-1]?{..._,data:{..._.data,[m]:g}}:_);Object.setPrototypeOf(y,Object.getPrototypeOf(v.layers)),v.layers=y}u=o.id}s.push({type:0,path:f,props:{[m]:l}}),a.push({type:0,path:f,props:{[m]:u}})}a.push(h.reverse),s.push(h.actual)}}else{let l=Xa.apply(n,o);l!==null&&(s.push(l.actual),n=l.data,a.push(l.reverse))}}catch(l){if(l instanceof aX)return null;throw l}return{data:n,actual:s,reverse:a.reverse()}}e.empty=function(){return[]},e.removePrefix=function(i,r){let n=[];for(let s of i){let[a,...o]=s.path;a===r&&n.push({...s,path:o})}return n},e.addPrefix=function(i,r){return i.map(n=>({...n,path:[r,...n.path]}))},e.concat=function(i,r){return[...i,...r]},e.compress=function(i,r){return[...i.filter(n=>!r.some(s=>Xa.subsumed(n,s))),...r]},e.commutative=function(i,r){return i.every(n=>r.every(s=>Xa.commutative(n,s)))},e.applyAll=function(i,r){for(let n of r){let s=t(i,n);s!==null&&(i=s.data)}return i},e.apply=t})(uJ||(uJ={}))});function YU(e,t,i){if(e.length>0){let r=e[e.length-1];if(r.type===0&&t.type===0&&Ta.equal(r.path,i))return void Object.assign(r.props,t.props)}e.push({...t,path:i})}function oI(e,t,i){return i instanceof Aa?new T4(e,t,i):i instanceof Nt?new M4(e,t,i):i instanceof ai?new Proxy(new v1e(e,t,i),_1e):i!==null&&typeof i=="object"?Yy(i)?i:new Proxy(new g1e(e,t,i),y1e):i}function bM(e){let t=new L7(e);return[oI(t,"",e),t]}function jO(e,t){let[i,r]=bM(e);return t(i),r.result()}function $s(e){return e instanceof T4||e instanceof M4?e._current:e!==null&&typeof e=="object"?e[O7]:e}var O7,dJ,RS,z1,g1e,v1e,KU,y1e,_1e,T4,M4,L7,Ta,b1e=V(()=>{S4(),n1(),hX(),s1(),ha(),E4(),O7=Symbol(),dJ=Symbol(),RS=Symbol(),z1=class{reportOp(e,t,i=[]){let r=this;if(t===null)return;r._current=t.data;let n=i;for(;!(r instanceof L7);){let s=r._path,a=r._current;if(s!==""&&n.splice(0,0,s),r=r._parent,r===null)return;r.update(s,a)}r.push(n,e,t.actual,t.reverse)}deleteChildren(e){if(this._children){let t=this._children[e];if(t){let i=t[RS];i&&i(),delete this._children[e]}}}},g1e=class extends z1{constructor(e,t,i){super(),this._parent=e,this._path=t,this._current=i}update(e,t){if(Array.isArray(this._current)){if(typeof e=="string"&&(e=parseInt(e),isNaN(e)))throw new Error("Invalid path");this._current=[...this._current],this._current[e]=t}else this._current=ew.tryPreservePrototype(this._current,{...this._current,[e]:t})}runOp(e){this.reportOp(e,ew.runOp(this._current,e),e.path)}},v1e=class extends z1{constructor(e,t,i){super(),this._parent=e,this._path=t,this._current=i}update(e,t){this._current={...this._current,[e]:t},Object.setPrototypeOf(this._current,ai.prototype)}runOp(e){this.reportOp(e,this._current.runOp(e))}},KU={get(e,t){if(t===RS)return()=>{e._parent=null};if(t===O7)return e._current;if(t===dJ)return e;let{_current:i,_children:r}=e;if(t==="push"&&Array.isArray(i))throw new Error("not supported to expand array");let n=r===void 0?void 0:r[t];if(n!==void 0)return n;let s=i[t],a=oI(e,t,s);return a!==s?(r===void 0&&(r={},e._children=r),r[t]=a,a):s},has:(e,t)=>t in e._current,ownKeys:e=>Reflect.ownKeys(e._current),defineProperty(){throw Error("not supported")},getPrototypeOf:e=>Object.getPrototypeOf(e._current),setPrototypeOf(){throw Error("not supported")},getOwnPropertyDescriptor(e,t){let i=e._current,r=Reflect.getOwnPropertyDescriptor(i,t);return r&&{writable:!0,configurable:!0,enumerable:r.enumerable,value:i[t]}}},y1e={...KU,set(e,t,i){let r={type:0,props:{[t]:$s(i)??i}};return e.deleteChildren(t),e.runOp(r),!0},deleteProperty(e,t){let i={type:0,props:{[t]:void 0}};return e.deleteChildren(t),e.runOp(i),!0}},_1e={...KU,set(e,t,i){return i===void 0?this.deleteProperty(e,t):(e.deleteChildren(t),e.runOp({type:1,id:t,data:i})),!0},deleteProperty:(e,t)=>(e.runOp({type:2,id:t}),!0)},T4=class extends z1{constructor(e,t,i){super(),this._children={},this._parent=e,this._path=t,this._current=i,this[RS]=()=>{this._parent=null}}unproxy(){return this._current}update(e,t){this._current=this._current.modifyById(e,t)}runOp(e){this.reportOp(e,this._current.runOp(e))}randomId(){return this._current.randomId()}isDescendantOf(e,t){return this._current.isDescendantOf(e,t)}childrenOf(e){return this._current.childrenOf(e)}get(e){return this._current.get(e)}parent(e){return this._current.parent(e)}traverse(e){this._current.traverse((t,i)=>{e(t,this.data(t))})}data(e){let{_current:t,_children:i}=this,r=i===void 0?void 0:i[e];if(r!==void 0)return r;let n=t.get(e)?.data,s=oI(this,e,n);return s!==n?(i===void 0&&(i={},this._children=i),i[e]=s,s):n}add(e,t,i,r,n){this.runOp({type:7,parent:e,fi:t,id:i,data:r,children:n})}move(e,t,i){this.runOp({type:9,parent:e,fi:t,id:i})}insertAfter(e,t,i){let r=this._current.insertAfterHelper(e,t,i.length);for(let n=0;n<i.length;n++){let s=i[n];this.add(e,r[n],s.id,s.data,s.children)}}insertBefore(e,t,i){let r=this._current.insertBeforeHelper(e,t,i.length);for(let n=0;n<i.length;n++){let s=i[n];this.add(e,r[n],s.id,s.data,s.children)}}moveAfter(e,t,i){let r=this._current.insertAfterHelper(e,t,i.length);for(let n=0;n<i.length;n++){let s=i[n];this.move(e,r[n],s)}}moveBefore(e,t,i){let r=this._current.insertBeforeHelper(e,t,i.length);for(let n=0;n<i.length;n++){let s=i[n];this.move(e,r[n],s)}}delete(e){this.deleteChildren(e),this.runOp({type:8,id:e})}sortNext(e){return this._current.sortNext(e)}sortPrevious(e){return this._current.sortPrevious(e)}getAllSorted(e){return this._current.getAllSorted(e)}},M4=class extends z1{constructor(e,t,i){super(),this._children={},this._parent=e,this._path=t,this._current=i,this[RS]=()=>{this._parent=null}}unproxy(){return this._current}get length(){return this._current.length}forEach(e){let t=this.length;for(let i=0;i<t;i++){let r=this._current[i].id,n=this._current[i].fi;e(this.data(this._current[i].id),r,n,i)}}find(e){let t=this.length;for(let i=0;i<t;i++){let r=this._current[i].id;if(e(this.data(r),r))return this.get(r)}}update(e,t){this._current=this._current.modifyById(e,t)}randomId(){return this._current.randomId()}get(e){return{...this._current.get(e),data:this.data(e)}}at(e){let{id:t,fi:i}=this._current.at(e);return{id:t,fi:i,data:this.data(t)}}data(e){let{_current:t,_children:i}=this,r=i===void 0?void 0:i[e];if(r!==void 0)return r;let n=t.get(e)?.data,s=oI(this,e,n);return s!==n?(i===void 0&&(i={},this._children=i),i[e]=s,s):n}runOp(e){this.reportOp(e,this._current.runOp(e))}add(e,t,i){this.runOp({type:4,fi:e,id:t,data:i})}move(e,t){this.runOp({type:6,fi:e,id:t})}insertAfter(e,t){let i=this._current.insertAfterHelper(e,t.length);for(let r=0;r<t.length;r++){let n=t[r];this.add(i[r],n.id,n.data)}}insertBefore(e,t){let i=this._current.insertBeforeHelper(e,t.length);for(let r=0;r<t.length;r++){let n=t[r];this.add(i[r],n.id,n.data)}}moveAfter(e,t){let i=this._current.insertAfterHelper(e,t.length);for(let r=0;r<t.length;r++){let n=t[r];this.move(i[r],n)}}moveBefore(e,t){let i=this._current.insertBeforeHelper(e,t.length);for(let r=0;r<t.length;r++){let n=t[r];this.move(i[r],n)}}delete(e){this.deleteChildren(e),this.runOp({type:5,id:e})}},L7=class extends z1{constructor(e){super(),this.ts=[],this.actual=[],this.reverse=[],this._current=e}update(e,t){if(e!=="")throw new Error("");this._current=t}push(e,t,i,r){YU(this.ts,t,e),YU(this.actual,i,e),YU(this.reverse,r,e)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}}}),E4=V(()=>{oX(),b1e(),s1(),n1(),ha(),(e=>{function t(r,n){return(r instanceof Aa||r instanceof T4)&&typeof n=="string"||(r instanceof Nt||r instanceof M4)&&typeof n=="string"?r.data(n):typeof n=="number"&&Array.isArray(r)||typeof n=="string"&&typeof r=="object"&&r!==null?r[n]:void 0}function i(r,n,s=0){for(;s<n.length&&r!==void 0;)r=t(r,n[s]),s+=1;return r}e.equal=function(r,n){if(n.length!==r.length)return!1;{let s=0;for(;s<r.length;){if(r[s]!==n[s])return!1;s+=1}}return!0},e.removeOverridden=function(r,n,s){let a=i(s,r);if(a!==void 0&&typeof a=="object"&&a!==null){let o={...n};return Object.keys(a).forEach(l=>{delete o[l]}),o}return n},e.zoomOnce=t,e.zoom=i,e.findPathes=function(r,n){let s=[];return function a(o,l){if(o instanceof VO&&o.id===n.id)s.push(l);else if(o instanceof Nt)for(let u=0;u<o.length;u++)a(o[u].data,[...l,o[u].id]);else if(o instanceof Aa)o.traverse((u,h)=>{a(h,[...l,u])});else if(Array.isArray(o)){if(typeof o[0]=="number")return;for(let u=0;u<o.length;u++)a(o[u],[...l,u])}else{if(Yy(o))return;if(typeof o=="object"&&o!==null)for(let u in o)a(o[u],[...l,u])}}(r,[]),s}})(Ta||(Ta={}))}),_Ie=V(()=>{});function Jr(e,t){let i=[];if(!(t.length<=e.length))return null;{let r=0;for(;r<t.length;){if(t[r]==="*")i.push(e[r]);else if(e[r]!==t[r])return null;r+=1}}return i}var bIe=V(()=>{});function WC(e){try{if(!Rn.trusted&&!vf){let i=Br.sharedLength||0;i<Br.length&&(Br.length=i)}let t;if(Rn.randomAccessStructure&&Rt[Ue]<64&&Rt[Ue]>=32&&vJ?(t=vJ(Rt,Ue,mu,Rn),Rt=null,!(e&&e.lazy)&&t&&(t=t.toJSON()),Ue=mu):t=Zs(),To&&(Ue=To.postBundlePosition,To=null),vf&&(Br.restoreStructures=null),Ue==mu)Br&&Br.restoreStructures&&cJ(),Br=null,Rt=null,gf&&(gf=null);else{if(Ue>mu)throw new Error("Unexpected end of MessagePack data");if(!vf){let i;try{i=JSON.stringify(t,(r,n)=>typeof n=="bigint"?`${n}n`:n).slice(0,100)}catch(r){i="(JSON view not available "+r+")"}throw new Error("Data read, but end of buffer not reached "+i)}}return t}catch(t){throw Br&&Br.restoreStructures&&cJ(),U7(),(t instanceof RangeError||t.message.startsWith("Unexpected end of buffer")||Ue>mu)&&(t.incomplete=!0),t}}function cJ(){for(let e in Br.restoreStructures)Br[e]=Br.restoreStructures[e];Br.restoreStructures=null}function Zs(){let e=Rt[Ue++];if(e<160){if(e<128){if(e<64)return e;{let t=Br[63&e]||Rn.getStructures&&x1e()[63&e];return t?(t.read||(t.read=B7(t,63&e)),t.read()):e}}if(e<144){if(e-=128,Rn.mapsAsObjects){let t={};for(let i=0;i<e;i++){let r=S1e();r==="__proto__"&&(r="__proto_"),t[r]=Zs()}return t}{let t=new Map;for(let i=0;i<e;i++)t.set(Zs(),Zs());return t}}{e-=144;let t=new Array(e);for(let i=0;i<e;i++)t[i]=Zs();return Rn.freezeData?Object.freeze(t):t}}if(e<192){let t=e-160;if(md>=Ue)return Sg.slice(Ue-Sh,(Ue+=t)-Sh);if(md==0&&mu<140){let i=t<16?pX(t):w1e(t);if(i!=null)return i}return qO(t)}{let t;switch(e){case 192:return null;case 193:return To?(t=Zs(),t>0?To[1].slice(To.position1,To.position1+=t):To[0].slice(To.position0,To.position0-=t)):E1e;case 194:return!1;case 195:return!0;case 196:if(t=Rt[Ue++],t===void 0)throw new Error("Unexpected end of buffer");return ZU(t);case 197:return t=Er.getUint16(Ue),Ue+=2,ZU(t);case 198:return t=Er.getUint32(Ue),Ue+=4,ZU(t);case 199:return M0(Rt[Ue++]);case 200:return t=Er.getUint16(Ue),Ue+=2,M0(t);case 201:return t=Er.getUint32(Ue),Ue+=4,M0(t);case 202:if(t=Er.getFloat32(Ue),Rn.useFloat32>2){let i=j7[(127&Rt[Ue])<<1|Rt[Ue+1]>>7];return Ue+=4,(i*t+(t>0?.5:-.5)|0)/i}return Ue+=4,t;case 203:return t=Er.getFloat64(Ue),Ue+=8,t;case 204:return Rt[Ue++];case 205:return t=Er.getUint16(Ue),Ue+=2,t;case 206:return t=Er.getUint32(Ue),Ue+=4,t;case 207:return Rn.int64AsType==="number"?(t=4294967296*Er.getUint32(Ue),t+=Er.getUint32(Ue+4)):Rn.int64AsType==="string"?t=Er.getBigUint64(Ue).toString():Rn.int64AsType==="auto"?(t=Er.getBigUint64(Ue),t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=Er.getBigUint64(Ue),Ue+=8,t;case 208:return Er.getInt8(Ue++);case 209:return t=Er.getInt16(Ue),Ue+=2,t;case 210:return t=Er.getInt32(Ue),Ue+=4,t;case 211:return Rn.int64AsType==="number"?(t=4294967296*Er.getInt32(Ue),t+=Er.getUint32(Ue+4)):Rn.int64AsType==="string"?t=Er.getBigInt64(Ue).toString():Rn.int64AsType==="auto"?(t=Er.getBigInt64(Ue),t>=BigInt(-2)<<BigInt(52)&&t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=Er.getBigInt64(Ue),Ue+=8,t;case 212:if(t=Rt[Ue++],t==114)return G7(63&Rt[Ue++]);{let i=_o[t];if(i)return i.read?(Ue++,i.read(Zs())):i.noBuffer?(Ue++,i()):i(Rt.subarray(Ue,++Ue));throw new Error("Unknown extension "+t)}case 213:return t=Rt[Ue],t==114?(Ue++,G7(63&Rt[Ue++],Rt[Ue++])):M0(2);case 214:return M0(4);case 215:return M0(8);case 216:return M0(16);case 217:return t=Rt[Ue++],md>=Ue?Sg.slice(Ue-Sh,(Ue+=t)-Sh):C1e(t);case 218:return t=Er.getUint16(Ue),md>=(Ue+=2)?Sg.slice(Ue-Sh,(Ue+=t)-Sh):R1e(t);case 219:return t=Er.getUint32(Ue),md>=(Ue+=4)?Sg.slice(Ue-Sh,(Ue+=t)-Sh):P1e(t);case 220:return t=Er.getUint16(Ue),Ue+=2,pJ(t);case 221:return t=Er.getUint32(Ue),Ue+=4,pJ(t);case 222:return t=Er.getUint16(Ue),Ue+=2,fJ(t);case 223:return t=Er.getUint32(Ue),Ue+=4,fJ(t);default:if(e>=224)return e-256;if(e===void 0){let i=new Error("Unexpected end of MessagePack data");throw i.incomplete=!0,i}throw new Error("Unknown MessagePack token "+e)}}}function B7(e,t){function i(){if(i.count++>z7){let n;try{n=e.read=new Function("r","return function(){return "+(Rn.freezeData?"Object.freeze":"")+"({"+e.map(s=>s==="__proto__"?"__proto_:r()":A1e.test(s)?s+":r()":"["+JSON.stringify(s)+"]:r()").join(",")+"})}")(Zs)}catch{return z7=1/0,i()}return e.read0=n,e.highByte===0&&(e.read=k7(t,e.read)),n()}let r={};for(let n=0,s=e.length;n<s;n++){let a=e[n];a==="__proto__"&&(a="__proto_"),r[a]=Zs()}return Rn.freezeData?Object.freeze(r):r}return i.count=0,e.read0=i,e.highByte===0?k7(t,i):i}function x1e(){let e=M1e(()=>(Rt=null,Rn.getStructures()));return Br=Rn._mergeStructures(e,Br)}function xM(e){let t;if(e<16&&(t=pX(e)))return t;if(e>64&&F7)return F7.decode(Rt.subarray(Ue,Ue+=e));let i=Ue+e,r=[];for(t="";Ue<i;){let n=Rt[Ue++];if(128&n)if((224&n)==192){let s=(31&n)<<6|63&Rt[Ue++];s<128?r.push(65533):r.push(s)}else if((240&n)==224){let s=(31&n)<<12|(63&Rt[Ue++])<<6|63&Rt[Ue++];s<2048||s>=55296&&s<=57343?r.push(65533):r.push(s)}else if((248&n)==240){let s=(7&n)<<18|(63&Rt[Ue++])<<12|(63&Rt[Ue++])<<6|63&Rt[Ue++];s<65536||s>1114111?r.push(65533):(s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|1023&s),r.push(s))}else r.push(65533);else r.push(n);r.length>=4096&&(t+=wa.apply(String,r),r.length=0)}return r.length>0&&(t+=wa.apply(String,r)),t}function pJ(e){let t=new Array(e);for(let i=0;i<e;i++)t[i]=Zs();return Rn.freezeData?Object.freeze(t):t}function fJ(e){if(Rn.mapsAsObjects){let t={};for(let i=0;i<e;i++){let r=S1e();r==="__proto__"&&(r="__proto_"),t[r]=Zs()}return t}{let t=new Map;for(let i=0;i<e;i++)t.set(Zs(),Zs());return t}}function w1e(e){let t=Ue,i=new Array(e);for(let r=0;r<e;r++){let n=Rt[Ue++];if((128&n)>0)return void(Ue=t);i[r]=n}return wa.apply(String,i)}function pX(e){if(e<4){if(e<2){if(e===0)return"";{let t=Rt[Ue++];return(128&t)>1?void(Ue-=1):wa(t)}}{let t=Rt[Ue++],i=Rt[Ue++];if((128&t)>0||(128&i)>0)return void(Ue-=2);if(e<3)return wa(t,i);let r=Rt[Ue++];return(128&r)>0?void(Ue-=3):wa(t,i,r)}}{let t=Rt[Ue++],i=Rt[Ue++],r=Rt[Ue++],n=Rt[Ue++];if((128&t)>0||(128&i)>0||(128&r)>0||(128&n)>0)return void(Ue-=4);if(e<6){if(e===4)return wa(t,i,r,n);{let s=Rt[Ue++];return(128&s)>0?void(Ue-=5):wa(t,i,r,n,s)}}if(e<8){let s=Rt[Ue++],a=Rt[Ue++];if((128&s)>0||(128&a)>0)return void(Ue-=6);if(e<7)return wa(t,i,r,n,s,a);let o=Rt[Ue++];return(128&o)>0?void(Ue-=7):wa(t,i,r,n,s,a,o)}{let s=Rt[Ue++],a=Rt[Ue++],o=Rt[Ue++],l=Rt[Ue++];if((128&s)>0||(128&a)>0||(128&o)>0||(128&l)>0)return void(Ue-=8);if(e<10){if(e===8)return wa(t,i,r,n,s,a,o,l);{let u=Rt[Ue++];return(128&u)>0?void(Ue-=9):wa(t,i,r,n,s,a,o,l,u)}}if(e<12){let u=Rt[Ue++],h=Rt[Ue++];if((128&u)>0||(128&h)>0)return void(Ue-=10);if(e<11)return wa(t,i,r,n,s,a,o,l,u,h);let d=Rt[Ue++];return(128&d)>0?void(Ue-=11):wa(t,i,r,n,s,a,o,l,u,h,d)}{let u=Rt[Ue++],h=Rt[Ue++],d=Rt[Ue++],c=Rt[Ue++];if((128&u)>0||(128&h)>0||(128&d)>0||(128&c)>0)return void(Ue-=12);if(e<14){if(e===12)return wa(t,i,r,n,s,a,o,l,u,h,d,c);{let p=Rt[Ue++];return(128&p)>0?void(Ue-=13):wa(t,i,r,n,s,a,o,l,u,h,d,c,p)}}{let p=Rt[Ue++],f=Rt[Ue++];if((128&p)>0||(128&f)>0)return void(Ue-=14);if(e<15)return wa(t,i,r,n,s,a,o,l,u,h,d,c,p,f);let m=Rt[Ue++];return(128&m)>0?void(Ue-=15):wa(t,i,r,n,s,a,o,l,u,h,d,c,p,f,m)}}}}}function mJ(){let e,t=Rt[Ue++];if(t<192)e=t-160;else switch(t){case 217:e=Rt[Ue++];break;case 218:e=Er.getUint16(Ue),Ue+=2;break;case 219:e=Er.getUint32(Ue),Ue+=4;break;default:throw new Error("Expected string")}return xM(e)}function ZU(e){return Rn.copyBuffers?Uint8Array.prototype.slice.call(Rt,Ue,Ue+=e):Rt.subarray(Ue,Ue+=e)}function M0(e){let t=Rt[Ue++];if(_o[t]){let i;return _o[t](Rt.subarray(Ue,i=Ue+=e),r=>{Ue=r;try{return Zs()}finally{Ue=i}})}throw new Error("Unknown extension type "+t)}function S1e(){let e=Rt[Ue++];if(!(e>=160&&e<192))return Ue--,T1e(Zs());if(e-=160,md>=Ue)return Sg.slice(Ue-Sh,(Ue+=e)-Sh);if(!(md==0&&mu<180))return qO(e);let t,i=4095&(e<<5^(e>1?Er.getUint16(Ue):e>0?Rt[Ue]:0)),r=V7[i],n=Ue,s=Ue+e-3,a=0;if(r&&r.bytes==e){for(;n<s;){if(t=Er.getUint32(n),t!=r[a++]){n=1879048192;break}n+=4}for(s+=3;n<s;)if(t=Rt[n++],t!=r[a++]){n=1879048192;break}if(n===s)return Ue=n,r.string;s-=3,n=Ue}for(r=[],V7[i]=r,r.bytes=e;n<s;)t=Er.getUint32(n),r.push(t),n+=4;for(s+=3;n<s;)t=Rt[n++],r.push(t);let o=e<16?pX(e):w1e(e);return r.string=o??qO(e)}function T1e(e){if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean"||typeof e=="bigint")return e.toString();if(e==null)return e+"";if(Rn.allowArraysInMapKeys&&Array.isArray(e)&&e.flat().every(t=>["string","number","boolean","bigint"].includes(typeof t)))return e.flat().toString();throw new Error("Invalid property type for record: "+typeof e)}function M1e(e){yJ&&yJ();let t=mu,i=Ue,r=WO,n=Sh,s=md,a=Sg,o=HO,l=gf,u=To,h=new Uint8Array(Rt.slice(0,mu)),d=Br,c=Br.slice(0,Br.length),p=Rn,f=vf,m=e();return mu=t,Ue=i,WO=r,Sh=n,md=s,Sg=a,HO=o,gf=l,To=u,Rt=h,vf=f,(Br=d).splice(0,Br.length,...c),Rn=p,Er=new DataView(Rt.buffer,Rt.byteOffset,Rt.byteLength),m}function U7(){Rt=null,gf=null,Br=null}function xIe(e){e.unpack?_o[e.type]=e.unpack:_o[e.type]=e}var F7,Rt,mu,Ue,gJ,HO,WO,Rn,Br,Sg,Sh,md,To,gf,_o,Er,QU,E1e,vf,z7,vJ,yJ,wM,A1e,k7,qO,C1e,R1e,P1e,wa,V7,G7,JU,_J,bJ,xJ,j7,qC,wJ,SJ,TJ,H7,eF,sA,wIe=V(()=>{try{F7=new TextDecoder}catch{}Ue=0,HO=gJ=[],WO=0,Rn={},Sh=0,md=0,_o=[],QU={useRecords:!1,mapsAsObjects:!0},(E1e=new class{}).name="MessagePack 0xC1",vf=!1,z7=2,wM=class{constructor(e){e&&(e.useRecords===!1&&e.mapsAsObjects===void 0&&(e.mapsAsObjects=!0),e.sequential&&e.trusted!==!1&&(e.trusted=!0,!e.structures&&e.useRecords!=0&&(e.structures=[],e.maxSharedStructures||(e.maxSharedStructures=0))),e.structures?e.structures.sharedLength=e.structures.length:e.getStructures&&((e.structures=[]).uninitialized=!0,e.structures.sharedLength=0),e.int64AsNumber&&(e.int64AsType="number")),Object.assign(this,e)}unpack(e,t){if(Rt)return M1e(()=>(U7(),this?this.unpack(e,t):wM.prototype.unpack.call(QU,e,t)));!e.buffer&&e.constructor===ArrayBuffer&&(e=typeof Buffer<"u"?Buffer.from(e):new Uint8Array(e)),typeof t=="object"?(mu=t.end||e.length,Ue=t.start||0):(Ue=0,mu=t>-1?t:e.length),WO=0,md=0,Sg=null,HO=gJ,To=null,Rt=e;try{Er=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(i){throw Rt=null,e instanceof Uint8Array?i:new Error("Source must be a Uint8Array or Buffer but was a "+(e&&typeof e=="object"?e.constructor.name:typeof e))}if(this instanceof wM){if(Rn=this,this.structures)return Br=this.structures,WC(t);(!Br||Br.length>0)&&(Br=[])}else Rn=QU,(!Br||Br.length>0)&&(Br=[]);return WC(t)}unpackMultiple(e,t){let i,r=0;try{vf=!0;let n=e.length,s=this?this.unpack(e,n):qC.unpack(e,n);if(!t){for(i=[s];Ue<n;)r=Ue,i.push(WC());return i}if(t(s,r,Ue)===!1)return;for(;Ue<n;)if(r=Ue,t(WC(),r,Ue)===!1)return}catch(n){throw n.lastPosition=r,n.values=i,n}finally{vf=!1,U7()}}_mergeStructures(e,t){e=e||[],Object.isFrozen(e)&&(e=e.map(i=>i.slice(0)));for(let i=0,r=e.length;i<r;i++){let n=e[i];n&&(n.isShared=!0,i>=32&&(n.highByte=i-32>>5))}e.sharedLength=e.length;for(let i in t||[])if(i>=0){let r=e[i],n=t[i];n&&(r&&((e.restoreStructures||(e.restoreStructures=[]))[i]=r),e[i]=n)}return this.structures=e}decode(e,t){return this.unpack(e,t)}},A1e=/^[a-zA-Z_$][a-zA-Z\d_$]*$/,k7=(e,t)=>function(){let i=Rt[Ue++];if(i===0)return t();let r=e<32?-(e+(i<<5)):e+(i<<5),n=Br[r]||x1e()[r];if(!n)throw new Error("Record id is not defined for "+r);return n.read||(n.read=B7(n,e)),n.read()},qO=xM,C1e=xM,R1e=xM,P1e=xM,wa=String.fromCharCode,V7=new Array(4096),G7=(e,t)=>{let i=Zs().map(T1e),r=e;t!==void 0&&(e=e<32?-((t<<5)+e):(t<<5)+e,i.highByte=t);let n=Br[e];return n&&(n.isShared||vf)&&((Br.restoreStructures||(Br.restoreStructures=[]))[e]=n),Br[e]=i,i.read=B7(i,r),(i.read0||i.read)()},_o[0]=()=>{},_o[0].noBuffer=!0,_o[66]=e=>{let t=e.byteLength%8||8,i=BigInt(128&e[0]?e[0]-256:e[0]);for(let r=1;r<t;r++)i<<=BigInt(8),i+=BigInt(e[r]);if(e.byteLength!==t){let r=new DataView(e.buffer,e.byteOffset,e.byteLength),n=(s,a)=>{let o=a-s;if(o<=40){let d=r.getBigUint64(s);for(let c=s+8;c<a;c+=8)d<<=BigInt(64),d|=r.getBigUint64(c);return d}let l=s+(o>>4<<3),u=n(s,l),h=n(l,a);return u<<BigInt(8*(a-l))|h};i=i<<BigInt(8*(r.byteLength-t))|n(t,r.byteLength)}return i},JU={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError:typeof AggregateError=="function"?AggregateError:null},_o[101]=()=>{let e=Zs();if(!JU[e[0]]){let t=Error(e[1],{cause:e[2]});return t.name=e[0],t}return JU[e[0]](e[1],{cause:e[2]})},_o[105]=e=>{if(Rn.structuredClone===!1)throw new Error("Structured clone extension is disabled");let t=Er.getUint32(Ue-4);gf||(gf=new Map);let i,r=Rt[Ue];i=r>=144&&r<160||r==220||r==221?[]:r>=128&&r<144||r==222||r==223?new Map:(r>=199&&r<=201||r>=212&&r<=216)&&Rt[Ue+1]===115?new Set:{};let n={target:i};gf.set(t,n);let s=Zs();if(!n.used)return n.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},_o[112]=e=>{if(Rn.structuredClone===!1)throw new Error("Structured clone extension is disabled");let t=Er.getUint32(Ue-4),i=gf.get(t);return i.used=!0,i.target},_o[115]=()=>new Set(Zs()),_J=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(e=>e+"Array"),bJ=typeof globalThis=="object"?globalThis:window,_o[116]=e=>{let t=e[0],i=Uint8Array.prototype.slice.call(e,1).buffer,r=_J[t];if(!r){if(t===16)return i;if(t===17)return new DataView(i);throw new Error("Could not find typed array for code "+t)}return new bJ[r](i)},_o[120]=()=>{let e=Zs();return new RegExp(e[0],e[1])},xJ=[],_o[98]=e=>{let t=(e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3],i=Ue;return Ue+=t-e.length,To=xJ,(To=[mJ(),mJ()]).position0=0,To.position1=0,To.postBundlePosition=Ue,Ue=i,Zs()},_o[255]=e=>e.length==4?new Date(1e3*(16777216*e[0]+(e[1]<<16)+(e[2]<<8)+e[3])):e.length==8?new Date(((e[0]<<22)+(e[1]<<14)+(e[2]<<6)+(e[3]>>2))/1e6+1e3*(4294967296*(3&e[3])+16777216*e[4]+(e[5]<<16)+(e[6]<<8)+e[7])):e.length==12?new Date(((e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3])/1e6+1e3*((128&e[4]?-281474976710656:0)+1099511627776*e[6]+4294967296*e[7]+16777216*e[8]+(e[9]<<16)+(e[10]<<8)+e[11])):new Date("invalid"),j7=new Array(147);for(let e=0;e<256;e++)j7[e]=+("1e"+Math.floor(45.15-.30103*e));(qC=new wM({useRecords:!1})).unpack,qC.unpackMultiple,qC.unpack,wJ=new Float32Array(1),new Uint8Array(wJ.buffer,0,4)}),SIe=V(()=>{wIe(),oX(),cX(),s1(),S4(),n1(),SJ=[{Class:ai.prototype.constructor,type:1,write:e=>({...e}),read:e=>(Object.setPrototypeOf(e,ai.prototype),e)},{Class:Nt.prototype.constructor,type:2,write:e=>[...e],read:e=>(Object.setPrototypeOf(e,Nt.prototype),e)},{Class:Aa.prototype.constructor,type:3,write:e=>[...e],read:e=>(Object.setPrototypeOf(e,Aa.prototype),e)},{Class:VO.prototype.constructor,type:4,write:e=>e.id,read:e=>new VO(e)},{Class:I7.prototype.constructor,type:5,write:e=>e.data,read:e=>new I7(e)},{Class:Qs.prototype.constructor,type:6,write:e=>({...e}),read:e=>(Object.setPrototypeOf(e,Qs.prototype),e)}];for(let e of SJ)xIe(e);TJ=new wM({structuredClone:!0}),(H7||(H7={})).deserialize=function(e){return TJ.unpack(e)}}),TIe=V(()=>{SIe(),eF=e=>()=>{throw new Error(e+" is not available in the runtime build (decode-only CollabSerialize)")},sA={deserialize:H7.deserialize,serialize:eF("CollabSerialize.serialize"),checksum:eF("CollabSerialize.checksum")}}),Nr=V(()=>{E4(),gIe(),lX(),n1(),S4(),hX(),s1(),yIe(),_Ie(),b1e(),bIe(),oX(),TIe(),m1e(),cX()});function W7(e){return e==="MouseDown"||e==="MouseUp"||e==="KeyDown"||e==="KeyUp"||e==="Collision"||e==="Trigger"}var MJ,q7,ex,$C,tF,EJ,AJ,CJ,$7,X7,RJ,PJ,DJ,NJ,IJ,Y7,K7,OJ,LJ,BJ,UJ,D1e=V(()=>{var e,t,i;Nr(),le(),(e=MJ||(MJ={})).toEventUIType=function(r){return r.type==="Conditional"?r.condition.type==="Distance"?"Distance":"StateChange":r.type},e.fromEventUIType=function(r){return r==="Distance"||r==="StateChange"?"Conditional":r},q7={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"]},(r=>{r.is=function(n){return n.type==="MouseDown"||n.type==="MouseUp"||n.type==="MousePress"||n.type==="KeyDown"||n.type==="KeyUp"||n.type==="KeyPress"},r.defaultData=function(n){return n==="MouseDown"||n==="MouseUp"||n==="MousePress"?{type:n,mode:"Object",disabled:!1,name:"",actions:new Nt}:{type:n,disabled:!1,name:"",key:void 0,actions:new Nt}}})(ex||(ex={})),(r=>{r.propertyDefaultData=function(n){return{type:"Property",value:[n??null,"position","x"]}},r.valueDefaultData={type:"Literal",value:0}})($C||($C={})),(t=tF||(tF={})).comparisonDefaultData=function(r){return{type:"Comparison",operator:"==",lOperand:$C.propertyDefaultData(r),rOperand:{...$C.valueDefaultData}}},t.distanceDefaultData=function(r){return{type:"Distance",toObject:r??null,fromObject:r??null,distance:200}},t.stateDefaultData=function(r,n){return{type:"State",object:r??null,state:n??null}},(EJ||(EJ={})).isConditionalSubActions=function(r){return r.find(n=>n==="ifActions"||n==="elseActions")!==void 0},(r=>{r.is=function(n){return n.type==="Conditional"},r.defaultData=function(n){return{type:"Conditional",disabled:!1,name:"",inActions:new Nt,outActions:new Nt,condition:tF.distanceDefaultData(n)}}})(AJ||(AJ={})),(CJ||(CJ={})).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 Nt,drop:new Nt}},($7||($7={})).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 Nt},(X7||(X7={})).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},(r=>{r.is=function(n){return n.type==="MouseHover"},r.defaultData=function(){return{type:"MouseHover",disabled:!1,name:"",actions:new Nt}}})(RJ||(RJ={})),(r=>{r.is=function(n){return n.type==="Scroll"},r.defaultData=function(){return{type:"Scroll",disabled:!1,name:"",steps:100,trigger:"load",startFrom:"enter",enterAnchor:"top",startOffset:0,endAfter:400,actions:new Nt}}})(PJ||(PJ={})),(r=>{r.is=function(n){return n.type==="Start"},r.defaultData=function(){return{type:"Start",disabled:!1,name:"",actions:new Nt}}})(DJ||(DJ={})),(r=>{r.is=function(n){return n.type==="Collision"},r.defaultData=function(){return{type:"Collision",disabled:!1,name:"",target:"character",actions:new Nt}}})(NJ||(NJ={})),(r=>{r.is=function(n){return n.type==="Trigger"},r.defaultData=function(n,s){return{type:"Trigger",name:"",disabled:!1,target:"all",triggeringObjects:[],actions:new Nt,triggerZone:"box",position:s.toArray(),rotation:[0,0,0],size:n.toArray(),radius:n.length()/2,helperVisible:!0}}})(IJ||(IJ={})),(i=Y7||(Y7={})).defaultSizes={mobile:[480,480],tablet:[768,768],desktop:[1200,1200],custom:[769,1200]},i.is=function(r){return r.type==="Resize"},i.sizeToDevice=function(r){return typeof r=="string"?r:"custom"},i.deviceToSize=function(r){return typeof r=="string"?[...i.defaultSizes[r]]:[...r]},i.defaultData=function(){let r={size:"mobile",operator:"<",actions:new Nt},n={size:"tablet",operator:"<",actions:new Nt},s={size:[...i.defaultSizes.custom],operator:"<>",actions:new Nt},a=new Nt;return a.push({id:ht.generateUUID(),fi:0,data:r},{id:ht.generateUUID(),fi:1,data:n},{id:ht.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 Nt}},(r=>{r.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"]},r.is=function(n){return n.type==="VariableChange"},r.defaultData=function(){return{disabled:!1,type:"VariableChange",name:"",actions:new Nt,variableId:"",objectId:null,property:"Position X"}}})(K7||(K7={})),(r=>{r.is=function(n){return n.type==="API"},r.defaultData=function(){return{disabled:!1,type:"API",name:"",successActions:new Nt,errorActions:new Nt,userAPIId:""}}})(OJ||(OJ={})),(r=>{r.is=function(n){return n.type==="WEBHOOK"},r.defaultData=function(){return{disabled:!1,type:"WEBHOOK",name:"",actions:new Nt,userWebhookId:""}}})(LJ||(LJ={})),(r=>{r.is=function(n){return n.type==="AIAssistantListener"},r.defaultData=function(){return{disabled:!1,type:"AIAssistantListener",name:"",actions:new Nt,analysis:"average",analysisRange:[0,71],analysisSingle:0}}})(BJ||(BJ={})),(r=>{r.is=function(n){return n.type==="AIAssistantTrigger"},r.defaultData=function(){return{disabled:!1,description:"",name:"",type:"AIAssistantTrigger",actions:new Nt}}})(UJ||(UJ={}))});function FJ(e){let t=typeof e;return e!==null&&(t==="object"||t==="function")}function zJ(e){return typeof e=="string"&&e.length===36&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)}var a1,wx,N1e,eo,kJ,Bc,Og,aA,VJ,Sx,oa,kr,Z7,GJ,Tg,tw,jJ,HJ,WJ,qJ,$J,XJ,YJ,KJ,iF,ZJ,QJ,rF,JJ,eee,tee,nF,iee,sF,ree,nee,see,aee,oee,lee,hee,uee,dee,Ky,yf,Mg,Q7,J7,$O,XO,YO,KO,ZO,eH,tH,QO,iH,Tx,cee,aF,oF,rH,pee,JO,fee,mee,oA,gee,vee,yee,_ee,bee,xee,wee,See,Tee,A4,fX,os,is,Pb,I1e,lA,eL,Uv,nH,mX,tL,iL,sH,lf,lI,Xn,lF,gg,Dh=V(()=>{var e,t,i,r,n,s,a,o;a1="personal camera",wx="a218fcc3-276b-49b9-b485-49037fd14f5f",N1e=2500134,eo=5526619,(e=kJ||{}).x="x",e.y="y",e.z="z",kJ=e,(l=>{function u(c,p){return Math.pow(p[0]-c[0],2)+Math.pow(p[1]-c[1],2)}function h(c,p){return Math.sqrt(u(c,p))}function d(c,p,f){let m=l.sub(p,c),g=l.sub(f,c),v=l.dot(m,g)/l.dot(m,m),y=l.scalarMultiply(m,v);return l.add(c,y)}l.isEqual=function(c,p){return c[0]===p[0]&&c[1]===p[1]},l.lerp=function(c,p,f){return[c[0]+(p[0]-c[0])*f,c[1]+(p[1]-c[1])*f]},l.add=function(c,p){return[c[0]+p[0],c[1]+p[1]]},l.sub=function(c,p){return[c[0]-p[0],c[1]-p[1]]},l.multiply=function(c,p){return[c[0]*p[0],c[1]*p[1]]},l.divide=function(c,p){return[c[0]/p[0],c[1]/p[1]]},l.distanceSquared=u,l.distance=h,l.dot=function(c,p){return c[0]*p[0]+c[1]*p[1]},l.scalarMultiply=function(c,p){return[c[0]*p,c[1]*p]},l.projectionOnto=d,l.projectionOntoDistance=function(c,p,f){return h(c,d(c,p,f))},l.center=function(c,p){return[.5*(c[0]+p[0]),.5*(c[1]+p[1])]}})(Bc||(Bc={})),(t=Og||(Og={})).isEqual=function(l,u){return l[0]===u[0]&&l[1]===u[1]&&l[2]===u[2]},t.add=function(l,u){return[l[0]+u[0],l[1]+u[1],l[2]+u[2]]},t.sub=function(l,u){return[l[0]-u[0],l[1]-u[1],l[2]-u[2]]},t.div=function(l,u){return[l[0]/u[0],l[1]/u[1],l[2]/u[2]]},t.mul=function(l,u){return[l[0]*u[0],l[1]*u[1],l[2]*u[2]]},t.dist=function(l,u){return Math.hypot(l[0]-u[0],l[1]-u[1],l[2]-u[2])},t.lerp=function(l,u,h){return[l[0]+(u[0]-l[0])*h,l[1]+(u[1]-l[1])*h,l[2]+(u[2]-l[2])*h]},(i=aA||(aA={})).isEqual=function(l,u){return l[0]===u[0]&&l[1]===u[1]&&l[2]===u[2]&&l[3]===u[3]},i.lerp=function(l,u,h){return[l[0]+(u[0]-l[0])*h,l[1]+(u[1]-l[1])*h,l[2]+(u[2]-l[2])*h,l[3]+(u[3]-l[3])*h]},(l=>{let u=180/Math.PI,h=Math.PI/180;function d(p){return typeof p=="number"?p*u:p}function c(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[c(p[0]),c(p[1]),c(p[2])]}})(VJ||(VJ={})),(r=Sx||(Sx={})).identity=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],r.isEqual=function(l,u){for(let h=0;h<16;h++)if(l[h]!==u[h])return!1;return!0},r.simplify=function(l){return l??r.identity},r.applyMatrix4=function(l,u){let h=u.slice(0);for(let d=0,c=u.length;d<c;d+=3){let p=l[3]*u[d]+l[7]*u[d+1]+l[11]*u[d+2]+l[15];h[d]=(l[0]*u[d]+l[4]*u[d+1]+l[8]*u[d+2]+l[12])/p,h[d+1]=(l[1]*u[d]+l[5]*u[d+1]+l[9]*u[d+2]+l[13])/p,h[d+2]=(l[2]*u[d]+l[6]*u[d+1]+l[10]*u[d+2]+l[14])/p}return h},(n=oa||(oa={})).isRGB=function(l){return typeof l=="object"&&typeof l.r=="number"&&typeof l.g=="number"&&typeof l.b=="number"},n.white={r:1,g:1,b:1},n.red={r:1,g:0,b:0},n.black={r:0,g:0,b:0},n.toRgb255a1=function(l){return{r:Math.round(255*l.r),g:Math.round(255*l.g),b:Math.round(255*l.b),a:1}},n.clone=function(l){return{r:l.r,g:l.g,b:l.b}},n.fromHex=function(l){return{r:((l=Math.floor(l))>>16&255)/255,g:(l>>8&255)/255,b:(255&l)/255}},n.toHex=function(l){return 65536*Math.round(255*l.r)+256*Math.round(255*l.g)+Math.round(255*l.b)},n.equals=function(l,u){return l.r===u.r&&l.g===u.g&&l.b===u.b},n.equalsFixed=function(l,u){return l.r.toFixed(2)===u.r.toFixed(2)&&l.g.toFixed(2)===u.g.toFixed(2)&&l.b.toFixed(2)===u.b.toFixed(2)},n.lerp=function(l,u,h){return{r:l.r+(u.r-l.r)*h,g:l.g+(u.g-l.g)*h,b:l.b+(u.b-l.b)*h}},n.is=function(l){return!!FJ(l)&&"r"in l&&"g"in l&&"b"in l&&!("a"in l)},(s=kr||(kr={})).white={...oa.white,a:1},s.is=function(l){return!!FJ(l)&&"r"in l&&"g"in l&&"b"in l&&"a"in l},s.transparent={...oa.white,a:0},s.from0to1=function(l){return{r:l[0],g:l[1],b:l[2],a:l[3]}},s.fromHexAndA=function(l,u){return{...oa.fromHex(l),a:u}},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,u){return oa.equals(l,u)&&l.a===u.a},s.equalsFixed=function(l,u){return oa.equalsFixed(l,u)&&l.a.toFixed(2)===u.a.toFixed(2)},s.lerp=function(l,u,h){return{r:l.r+(u.r-l.r)*h,g:l.g+(u.g-l.g)*h,b:l.b+(u.b-l.b)*h,a:l.a+(u.a-l.a)*h}},s.toStyle=function({r:l,g:u,b:h,a:d}=s.white){return`rgba(${255*l}, ${255*u}, ${255*h}, ${d})`},(Z7||(Z7={})).identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1],pivot:[0,0,0],pivotRotation:[0,0,0]},(a=GJ||{})[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",GJ=a,(Tg||(Tg={})).defaultData={mass:1,stiffness:80,damping:10,velocity:0},(tw||(tw={})).defaultData={control1:[.5,0],control2:[.5,1]},(o=jJ||(jJ={})).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]}),MIe=V(()=>{var e,t;Nr(),D1e(),(HJ||(HJ={})).defaultData={type:"SwitchCamera",name:"",targetCamera:"",delay:0,animate:!0,duration:1e3,easing:4,runMode:"Normal"},(WJ||(WJ={})).defaultData={type:"SceneTransition",name:"",target:"",delay:0,duration:1,transition:"none"},(qJ||(qJ={})).defaultData={type:"Link",name:"",url:null,context:"tab"},($J||($J={})).defaultData={type:"Destroy",name:"",objects:[],delay:0},(XJ||(XJ={})).defaultData={type:"Particles",name:"",emitterObjectId:"",delay:0,emission:"start",triggerAfter:"any"},(YJ||(YJ={})).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"},(KJ||(KJ={})).defaultData={type:"Reset",name:"",delay:0},(iF||(iF={})).defaultData={interaction:"play",delay:0,volume:.5,loop:1},(e=ZJ||(ZJ={})).pauseDefaultData={interaction:"pause",delay:0},e.stopDefaultData={interaction:"stop",delay:0},(t=QJ||(QJ={})).defaultData={type:"Audio",name:"",...iF.defaultData},t.hasAudioByActions=i=>i.some(({data:r})=>r.type==="Audio"&&r.interaction==="play"&&r.audio),t.hasAudioByEvents=i=>{for(let{data:r}of i)if(ex.is(r)||r.type==="Start"||r.type==="Collision"){if(t.hasAudioByActions(r.actions))return!0}else if(r.type==="Conditional"){if(t.hasAudioByActions(r.inActions)||t.hasAudioByActions(r.outActions))return!0}else if(r.type==="GameControl"&&Object.values(r.gameActions).find(n=>t.hasAudioByActions(n)))return!0},t.getAudiosByActions=i=>{let r=[];return i.forEach(n=>{let s=n.data;s.type==="Audio"&&s.interaction==="play"&&s.audio&&r.push(n),s.type==="Conditional"&&(r.push(...t.getAudiosByActions(s.ifActions)),r.push(...t.getAudiosByActions(s.elseActions)))}),r},t.getAudiosByEvents=i=>{let r=[];return i.forEach(({data:n})=>{ex.is(n)||n.type==="Collision"||n.type==="Start"||n.type==="Trigger"?r.push(...t.getAudiosByActions(n.actions)):n.type==="Conditional"?(r.push(...t.getAudiosByActions(n.inActions)),r.push(...t.getAudiosByActions(n.outActions))):n.type==="GameControl"?Object.values(n.gameActions).forEach(s=>{r.push(...t.getAudiosByActions(s))}):n.type==="DragDrop"&&(r.push(...t.getAudiosByActions(n.dragDropActions.drag)),r.push(...t.getAudiosByActions(n.dragDropActions.drop)))}),r},(rF||(rF={})).defaultData={interaction:"play",delay:0,volume:.5,loop:1/0},(i=>{i.pauseDefaultData={interaction:"pause",delay:0},i.stopDefaultData={interaction:"stop",delay:0}})(JJ||(JJ={})),(i=>{i.defaultData={type:"Video",name:"",triggerAfter:"autoplay",...rF.defaultData},i.hasVideoByActions=r=>r.some(({data:n})=>n.type==="Video"&&n.interaction==="play"&&n.layerId),i.hasVideoByObject=r=>{if(r.events){for(let{data:n}of r.events)if((ex.is(n)||n.type==="Start")&&i.hasVideoByActions(n.actions))return!0}},i.getVideosByActions=r=>{let n=[];return r.forEach(s=>{let a=s.data;a.type==="Video"&&a.interaction==="play"&&a.layerId&&n.push(s)}),n},i.getVideosByEvents=r=>{let n=[];return r.forEach(({data:s})=>{(ex.is(s)||s.type==="Start")&&n.push(...i.getVideosByActions(s.actions))}),n}})(eee||(eee={})),(tee||(tee={})).defaultData=function(i){return{state:i,repeat:0,delay:0,delayDirection:"start-once",direction:"normal",duration:1e3,easing:4}},(nF||(nF={})).defaultData=function(){return{tweens:new Nt,repeat:0,delay:0,delayDirection:"start-once",direction:"normal"}},(iee||(iee={})).defaultData=function(i){return{type:"Transition",name:"",runMode:"Once",object:i??null,...nF.defaultData()}},(sF||(sF={})).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}})(ree||(ree={})),(nee||(nee={})).defaultData=function(i){return{type:"TimelineAnimation",name:"",...sF.defaultData(i)}},(see||(see={})).defaultData=function(i,r,n){return{type:"Animation",name:"",object:i,clipId:r,crop:n,crop2:n,repeat:-1,delay:0,delayDirection:"start-once",direction:"normal",runMode:"Normal"}},(aee||(aee={})).defaultData={type:"SetVariable",name:"",variableId:"",expression:[]},(oee||(oee={})).defaultData=()=>({type:"Conditional",name:"",ifActions:new Nt,elseActions:new Nt,condition:[]}),(lee||(lee={})).defaultData={type:"DynamicVariablePlay",name:"",variableId:"",mode:"PlayPause",delay:0,pauseDelay:0},(hee||(hee={})).defaultData={type:"ClearLocalStorage",name:"",target:"all"},(uee||(uee={})).defaultData={name:"",type:"UserAPI"}}),EIe=V(()=>{var e;(e=dee||(dee={})).emptyAudio={data:Uint8Array.from(atob("UklGRjIAAABXQVZFZm10IBIAAAABAAEAQB8AAEAfAAABAAgAAABmYWN0BAAAAAAAAABkYXRhAAAAAA=="),t=>t.charCodeAt(0)),mimeType:"audio/wav",filename:"unknown"},e.maxSize=2e6}),O1e=V(()=>{var e;(e=Ky||(Ky={})).all=["PerspectiveCamera","OrthographicCamera"],e.is=function(t){return e.all.includes(t)},(t=>{t.DefaultUp=[0,1,0],t.DefaultTargetOffset=1e3,t.MinTargetOffset=.001,t.sanitizeTargetOffset=function(s){return s===void 0||!Number.isFinite(s)||s<t.MinTargetOffset?t.DefaultTargetOffset:s},t.DefaultAzimuth=-24,t.DefaultElevation=15;let i=t.DefaultAzimuth*Math.PI/180,r=t.DefaultElevation*Math.PI/180,n=180/Math.PI;t.DefaultPosition=[t.DefaultTargetOffset*Math.sin(i)*Math.cos(r),t.DefaultTargetOffset*Math.sin(r),t.DefaultTargetOffset*Math.cos(i)*Math.cos(r)],t.DefaultRotation=[Math.atan2(-Math.sin(r),Math.cos(i)*Math.cos(r))*n,Math.asin(Math.sin(i)*Math.cos(r))*n,Math.atan2(Math.sin(i)*Math.sin(r),Math.cos(i))*n],t.defaultData={far:1e5,type:"PerspectiveCamera",perspective:{near:70,fov:45,zoom:1},orthographic:{near:-1e5,zoom:1},up:t.DefaultUp,isUpVectorFlipped:!1,targetOffset:t.DefaultTargetOffset},t.getZoom=function(s){return s.type==="PerspectiveCamera"?s.perspective?.zoom??1:s.orthographic?.zoom??1}})(yf||(yf={}))}),L1e=V(()=>{var e;(e=Mg||(Mg={})).defaultData=function(t,i=.1){return{disabled:!1,type:"linear",hideBase:!1,instanced:!1,count:3,radial:{radius:2*Math.max(typeof t[0]=="number"?t[0]:1,typeof t[1]=="number"?t[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 t[0]=="number"?t[0]+t[0]:1)*i,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},grid:{count:[2,2,2],size:t.map(r=>(typeof r=="number"?r: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"}}},e.merge=function(t,i){let r={...t};if(J7.forEach(n=>{Object.assign(r,{[n]:i[n]??t[n]})}),r.radial={...t.radial},i.radial){let n=t.radial,s=i.radial;$O.forEach(a=>{Object.assign(r.radial,{[a]:s[a]??n[a]})})}if(r.linear={...t.linear},i.linear){let n=t.linear,s=i.linear;XO.forEach(a=>{Object.assign(r.linear,{[a]:s[a]??n[a]})})}if(r.grid={...t.grid},i.grid){let n=t.grid,s=i.grid;YO.forEach(a=>{Object.assign(r.grid,{[a]:s[a]??n[a]})})}if(r.toObject={...t.toObject},i.toObject){let n=t.toObject,s=i.toObject;KO.forEach(a=>{Object.assign(r.toObject,{[a]:s[a]??n[a]})})}if(r.randomnessObject={...t.randomnessObject},i.randomnessObject){let n=t.randomnessObject,s=i.randomnessObject;ZO.forEach(a=>{Object.assign(r.randomnessObject,{[a]:s[a]??n[a]})})}return r},e.isPartial=function(t){return!(!t.randomnessObject&&!t.toObject)},(t=>{t.defaultData={radial:{},linear:{},grid:{},toObject:{},randomnessObject:{}};let i=["radial","linear","grid","toObject","randomnessObject"];t.toOps=function(r,n){let s=[];r.count!==void 0&&s.push({type:0,path:n,props:{count:r.count}});for(let a of i){let o=r[a];o&&Object.keys(o).length>0&&s.push({type:0,path:[...n,a],props:o})}return s}})(Q7||(Q7={})),J7=["count"],$O=["radius","start","end","position","scale","rotation"],XO=["position","scale","rotation"],YO=["count","size"],KO=["count","position","scale","rotation"],ZO=["strength","scale","rotation","position","movement","seed","freqScale"]}),B1e=V(()=>{var e;Dh(),(e=eH||(eH={})).all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"],e.is=function(t){return e.all.includes(t)},(tH||(tH={})).defaultData=function(t){return function(i){if(i==="PointLight")return{type:i,color:kr.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,penumbraSize:.5,depth:1e5};if(i==="SpotLight")return{type:i,color:kr.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:kr.white,intensity:1,shadows:!0,size:2e3,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};throw new Error("not implemented")}(t)}}),U1e=V(()=>{var e;(e=QO||(QO={})).defaultShapeData={type:"PlaneEmitterShape",size:[100,100,100]},e.defaultCollisionData={colliderEntityId:null,collisionBounce:.75},e.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:e.defaultShapeData,autoPlay:!0,emitTimeDelay:0,emitTimeCycle:"infinity",emitTimeDuration:1,...e.defaultCollisionData}}),F1e=V(()=>{var e;(e=iH||(iH={})).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},e.regenProps=["hairLength","spreadRadius","guideStrands","headShape","baseObjectId"]}),gX=V(()=>{(Tx||(Tx={})).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]}}),z1e=V(()=>{var e,t;(e=cee||{})[e.Front=0]="Front",e[e.Back=1]="Back",e[e.Double=2]="Double",cee=e,(t=aF||(aF={})).defaultData={castShadow:!0,receiveShadow:!0},t.equals=function(i,r){return i.castShadow===r.castShadow&&i.receiveShadow===r.receiveShadow},(i=>{i.defaultData={flatShading:!1,wireframe:!1,side:0},i.equals=function(r,n){return r.flatShading===n.flatShading&&r.side===n.side&&r.wireframe===n.wireframe&&(r.shadowCatcher??!1)===(n.shadowCatcher??!1)}})(oF||(oF={})),(rH||(rH={})).defaultData={...oF.defaultData,...aF.defaultData},(pee||(pee={})).getMaterialData=function(i,r){let n=[];if("material"in i){let s=typeof i.material=="string"?r.materials[i.material]??r.lib.materials[i.material]?.asset:i.material;s&&n.push(s)}else if("materials"in i)for(let s of i.materials){let a=typeof s=="string"?r.materials[s]??r.lib.materials[s]?.asset:s;a&&n.push(a)}return n}}),k1e=V(()=>{var e;(e=JO||(JO={})).defaultVideo={data:"",thumb:"/_assets/_videos/catThumb.png",type:"video",name:"Cat video"},e.maxSize=3e7}),PA=V(()=>{var e,t,i,r;Nr(),Dh(),k1e(),Dh(),(fee||(fee={})).is=function(n){return n==="texture"||n==="video"||n==="color"||n==="depth"||n==="normal"||n==="gradient"||n==="noise"||n==="fresnel"||n==="cavity"||n==="dust"||n==="rainbow"||n==="toon"||n==="outline"||n==="particle"||n==="transmission"||n==="reflection"||n==="matcap"||n==="displace"||n==="pattern"||n==="vertexColor"||n==="light"},(mee||(mee={})).is=function(n){return n==="luminance"||n==="r"||n==="g"||n==="b"||n==="a"},(oA||(oA={})).is=function(n){return typeof n=="object"&&n!==null&&n.image!=null},(gee||(gee={})).is=function(n){return n==="phong"||n==="toon"||n==="lambert"||n==="physical"},(r=vee||{})[r.Linear=0]="Linear",r[r.Radial=1]="Radial",r[r.Polar=2]="Polar",vee=r,yee=(n=>(n[n.RepeatWrapping=1e3]="RepeatWrapping",n[n.ClampToEdgeWrapping=1001]="ClampToEdgeWrapping",n[n.MirroredRepeatWrapping=1002]="MirroredRepeatWrapping",n))(yee||{}),_ee=(n=>(n[n.NearestFilter=1003]="NearestFilter",n[n.LinearFilter=1006]="LinearFilter",n[n.LinearMipmapLinearFilter=1008]="LinearMipmapLinearFilter",n))(_ee||{}),(i=bee||{})[i.UV=0]="UV",i[i.Planar=1]="Planar",i[i.Spherical=2]="Spherical",i[i.Cylindrical=3]="Cylindrical",i[i.Triplanar=4]="Triplanar",bee=i,(t=xee||{})[t.Simplex=0]="Simplex",t[t.SimplexFractal=1]="SimplexFractal",t[t.Ashima=2]="Ashima",t[t.Fbm=3]="Fbm",t[t.Perlin=4]="Perlin",t[t.Voronoi=5]="Voronoi",xee=t,(e=wee||{})[e.F1=0]="F1",e[e.F2=1]="F2",e[e.F2MinusF1=2]="F2MinusF1",e[e.SmoothBlend=3]="SmoothBlend",e[e.Edge=4]="Edge",e[e.Power=5]="Power",e[e.Lines=6]="Lines",e[e.Cells=7]="Cells",wee=e,See=(n=>(n[n.Lights=0]="Lights",n[n.Static=1]="Static",n[n.Camera=2]="Camera",n))(See||{}),Tee=(n=>(n[n.Circle=0]="Circle",n[n.Ring=1]="Ring",n[n.Polygon=2]="Polygon",n[n.Cross=3]="Cross",n[n.Diamond=4]="Diamond",n[n.Checkerboard=5]="Checkerboard",n[n.Line=6]="Line",n[n.Wave=7]="Wave",n))(Tee||{}),A4=["mode","gradientType","noiseType","tracingMode","mirror","displacementType","projection","cnormal","crop","axis","side","roughnessMapChannel","metalnessMap","metalnessMapChannel","normalMap","aoMap","aoMapChannel","emissiveMap","style"],fX=["wrapping","image","video","name","minFilter","magFilter"],(n=>{n.patch=function(s,a){let{texture:o,...l}=a;if(Object.assign(s,l),o){let u=s.texture;u&&Object.assign(u,o)}},n.defaultColorLayer=function(s){return{...n.defaultData("color"),color:s}},n.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:JO.defaultVideo,wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"color":return{...l,type:"color",color:oa.fromHex(eo)};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:{...oa.fromHex(6710886),a:1},colorB:{...oa.fromHex(6710886),a:1},colorC:{...oa.fromHex(16777215),a:1},colorD:{...oa.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:kr.fromHexAndA(16777215,1),bias:.1,scale:1,intensity:2,factor:1};case"dust":return{...l,type:"dust",color:kr.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:kr.fromHexAndA(0,0),offset:[0,0,0]};case"outline":return{...l,type:"outline",outlineColor:kr.fromHexAndA(0,1),contourColor:kr.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:{...oa.fromHex(0),a:1},colorB:{...oa.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)}})(os||(os={})),(n=>{function s(a,o="layer1",l="layer2",u=oa.fromHex(16777215)){let h=new Nt;return h.push({fi:0,data:os.defaultData("light",a),id:o}),h.push({fi:1,data:os.defaultData("color"),id:l}),{layers:h}}n.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")},n.getHash=function(a){let o="";return a.layers.forEach(l=>{Object.entries(l.data).forEach(([u,h])=>{o+=`${u}${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},n.defaultEmptyData=function(){return{layers:new Nt}},n.defaultData=function(a="layer1",o="layer2"){return s("physical",a,o)},n.withName=function(a,o){return{...a,name:o}},n.defaultTwoLayerData=s,n.defaultColorMaterial=function(a,o,l="layer1",u="layer2"){let h=new Nt;return h.push({fi:0,data:os.defaultData("light",o),id:l}),h.push({fi:1,data:os.defaultColorLayer(a),id:u}),{layers:h}},n.defaultUIObjectMaterial=function(a){let o=os.defaultData("texture");a&&Object.assign(o.texture,{image:a});let l=new Nt;return l.push({fi:0,data:o,id:"layer1"}),l.push({fi:1,data:{...os.defaultData("transmission"),alpha:1},id:"layer2"}),l.push({fi:2,data:{...os.defaultData("light","lambert"),alpha:0},id:"layer3"}),{layers:l}},n.defaultTwoLayerTextureData=function(a,o="physical",l="layer1",u="layer2"){let h=os.defaultData("texture");Object.assign(h.texture,{image:a});let d=new Nt;return d.push({fi:0,data:h,id:l}),d.push({fi:1,data:os.defaultData("light",o),id:u}),{layers:d}},n.defaultTwoLayerVideoTextureData=function(a,o="physical",l="layer1",u="layer2"){let h=os.defaultData("video");Object.assign(h.texture,{video:a});let d=new Nt;return d.push({fi:0,data:h,id:l}),d.push({fi:1,data:os.defaultData("light",o),id:u}),{layers:d}}})(is||(is={}))}),AIe=V(()=>{Pb="Roboto_regular",I1e="https://fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Me5WZLCzYlKw.ttf"}),V1e=V(()=>{Nr(),(lA||(lA={})).defaultData=function(){return{points:new Nt,roundness:0,shapeHoles:[],isClosed:!1}}}),G1e=V(()=>{Nr(),(eL||(eL={})).defaultData=function(){return{points:new Nt,lastInsertionPlane:null,subdivisions:12,isClosed:!1,subdivisionMode:"parametric"}},Uv={type:"Ellipse",width:50,height:50,spikes:16,angle:360,innerRadius:0},(nH||(nH={})).merge=function(e,t){let i={...e};return tL.forEach(r=>{Object.assign(i,{[r]:t[r]??e[r]})}),i},mX={shape:Uv,depth:1,offset:0,bevel:50,bevelSides:6,angle:0,twist:0,startScale:1,endScale:1,capType:"flat"},tL=["depth","offset","angle","twist","startScale","endScale"]}),vX=V(()=>{var e,t;V1e(),G1e(),(e=iL||(iL={})).is2DParametricMesh=function(i){return i==="PolygonGeometry"||i==="RectangleGeometry"||i==="StarGeometry"||i==="TriangleGeometry"||i==="EllipseGeometry"||i==="UIGeometry"},e.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"},e.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"},(sH||(sH={})).merge=function(i,r){let n={...i};return Object.assign(n,r),n.type==="PathGeometry"&&"extrusion"in r&&r.extrusion&&(n.extrusion={...i.extrusion},Object.assign(n.extrusion,nH.merge(n.extrusion,r.extrusion))),n},(t=lf||(lf={})).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:eL.defaultData(),extrusion:mX};if(i==="VectorGeometry")return{width:1,height:1,type:i,subdivisions:12,shape:lA.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,projection:"all",projectionTargets:[]};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{...t.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")},lI=["width","height","depth"]}),j1e=V(()=>{Dh(),(e=>{function t(i){return i.mode??"linear"}e.defaultData={enabled:!1,useBackgroundColor:!1,color:oa.white,near:.1,far:2e3,mode:"linear",density:.005,heightFalloff:.01,heightBase:0},e.getMode=t,e.getModeIndex=function(i){let r=t(i);return r==="height"?1:r==="both"?2:0},e.getDensity=function(i){return i.density??e.defaultData.density},e.getHeightFalloff=function(i){return i.heightFalloff??e.defaultData.heightFalloff},e.getHeightBase=function(i){return i.heightBase??e.defaultData.heightBase}})(Xn||(Xn={}))}),yX=V(()=>{(lF||(lF={})).defaultData={image:null,rotation:0,blur:32,showBackground:!0},(gg||(gg={})).defaultData={enabled:!1,mode:"hdri",hdri:lF.defaultData,timeOfDay:10,weather:"partlyCloudy",lighting:!0,lightingIntensity:1,lightingQuality:"full",clouds:!0,windSpeed:2,animateWind:!0,exposure:1,seed:2}});function CIe(e){let t=typeof e=="string"?Number.parseInt(e,10):e;return typeof t=="number"&&Number.isFinite(t)?Math.min(5,Math.max(0,Math.round(t))):3}var hA,dy,hF,uF,dF,Mx,cF,aH,oH,Mee,k1,H1e,na,rL,Eee,Aee,Cee,Ree,yc,gE,nL,sL,_f,cy,Pee,Eg,aL,bf,pF,fF,$v,Zy,Xv,vE,lH,Dee,Eo,mF,Nee,Iee,hf,fu,Ex,hH,W1e=V(()=>{(()=>{let e={opacity:1,blendFunction:13,enabled:!1};(hA||(hA={})).defaultData={enabled:!1,pixelation:{...e,blendFunction:16,granularity:15},bloom:{...e,blendFunction:16,intensity:1,blurScale:1,luminanceThreshold:.25,luminanceSmoothing:.025,kernelSize:3},chromaticAberration:{...e,offset:[2,2]},vignette:{...e,darkness:1,offset:0},hueSaturation:{...e,hue:3,saturation:0},brightnessContrast:{...e,brightness:.25,contrast:0},depthOfField:{...e,focusDistance:100,focalLength:20,bokehScale:5},noise:{...e,blendFunction:16}}})()}),_X=V(()=>{var e;j1e(),yX(),W1e(),Dh(),(e=dy||(dy={})).defaultData={type:"normal",softShadowQuality:"low"},e.isSoft=function(t){return t!=null&&(t.type===void 0||t.type==="soft")},(hF||(hF={})).defaultData={enabled:!0,color:{r:.8274509803921568,g:.8274509803921568,b:.8274509803921568},intensity:.75},(uF||(uF={})).defaultData={occlusion:!1,aoFullRes:!1,radius:256,bias:.5,aoColor:{r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}},(t=>{t.defaultData={pipeline:"classic",toneMapping:"aces",exposure:1},t.isUntouched=function(i){return i===void 0||i.pipeline==="classic"&&(i.toneMapping==="none"||i.toneMapping==="aces")&&i.exposure===1}})(dF||(dF={})),(Mx||(Mx={})).defaultData={usePhysics:!1,gravity:-10},(cF||(cF={})).defaultData={playCamera:a1,gameControlObject:null},(aH||(aH={})).defaultData={backgroundColor:kr.fromHexAndA(N1e,1),postprocessing:hA.defaultData,fog:Xn.defaultData,sky:gg.defaultData,globalPhysics:Mx.defaultData,ambient:hF.defaultData,ao:uF.defaultData,shadow:dy.defaultData,publish:cF.defaultData,grading:dF.defaultData}}),RIe=V(()=>{(oH||(oH={})).defaultData={colliderType:"box",size:[100,100,100],colliderHelperVisible:!0,forceType:"collider",forceRange:"global",forceIntensity:.5,forceDambing:.95}}),C4=V(()=>{var e,t,i;Nr(),O1e(),B1e(),U1e(),F1e(),gX(),z1e(),Dh(),PA(),vX(),L1e(),ha(),_X(),RIe(),(e=Mee||(Mee={})).isComponentRelated=function(r){return r==="Component"||r==="Instance"},e.isEmptyOrComponent=function(r){return r==="Empty"||r==="Instance"},(t=k1||(k1={})).identity={...Z7.identity,hiddenMatrix:Sx.identity},t.fromObject=function(r){return{position:r.position,rotation:r.rotation,scale:r.scale,pivot:r.pivot,pivotRotation:r.pivotRotation,hiddenMatrix:r.hiddenMatrix}},t.merge=function(r,n){return{position:n?.position||r.position,rotation:n?.rotation||r.rotation,pivot:n?.pivot||r.pivot,pivotRotation:n?.pivotRotation||r.pivotRotation,scale:n?.scale||r.scale,hiddenMatrix:n?.hiddenMatrix||r.hiddenMatrix}},t.diff=function(r,n){return d1e({position:Og.isEqual(r.position,n.position)?void 0:n.position,rotation:Og.isEqual(r.rotation,n.rotation)?void 0:n.rotation,scale:Og.isEqual(r.scale,n.scale)?null:n.scale,hiddenMatrix:Sx.isEqual(r.hiddenMatrix,n.hiddenMatrix)?void 0:n.hiddenMatrix})},H1e=["slide","offset"],(na||(na={})).defaultData={states:new Nt,events:new Nt,visible:!0,raycastLock:!1,physics:Tx.defaultData,pathSnapping:{pathId:null,slide:0,offset:0,orientation:"tangential"},...k1.identity,cloner:null},(rL||(rL={})).defaultData={type:"Empty",...na.defaultData},(Eee||(Eee={})).defaultData={type:"ParticleCollider",...oH.defaultData,...na.defaultData},(Aee||(Aee={})).defaultData={type:"Component",...na.defaultData},(Cee||(Cee={})).defaultData={type:"Particle",...na.defaultData,...QO.defaultData},(Ree||(Ree={})).defaultData={type:"Hair",...na.defaultData,...iH.defaultData},(yc||(yc={})).defaultData={type:"Mesh",...na.defaultData,...rH.defaultData},(gE||(gE={})).defaultData={...na.defaultData,...k1.identity,position:yf.DefaultPosition,rotation:yf.DefaultRotation,...yf.defaultData},(r=>{r.defaultData=function(n){return{...na.defaultData,...tH.defaultData(n)}},r.defaultDirectionalLightData={...r.defaultData("DirectionalLight"),position:[200,300,300],name:"Directional Light",intensity:.7}})(nL||(nL={})),(r=>{function n(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}}r.resolveWithDes=n,r.resolve=function(s,a,o=0){let l=n(s,a,o);if(l){let u=Object.keys(l);if(u.length===1&&u[0]==="descendants")return}return l}})(sL||(sL={})),(r=>{function n(s,a){return{...na.defaultData,...a,component:s,overrides:new Qs,physics:void 0,events:void 0,type:"Instance"}}r.rootOverrideProps=["physics","events"],r.compositeNonOptionalOverrideProps=["geometry"],r.compositeEntireOverrideOverrideProps=["material"],r.ofComponent=n,r.fromComponentData=function(s){let a=k1.fromObject(s.data);return n(s.id,a)}})(_f||(_f={})),(r=>{r.defaultData={type:"Page",...na.defaultData,physics:{...Tx.defaultData,fusedBody:!1},...aH.defaultData,camera:gE.defaultData,timelines:new ai},r.isUIPage=function(n){return n.uiScene!==void 0}})(cy||(cy={})),(i=Pee||(Pee={})).defaultCamera={position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0],hiddenMatrix:Sx.identity,name:"Play Camera",visible:!0,raycastLock:!1,physics:Tx.defaultData,states:new Nt,events:new Nt,cloner:null,pathSnapping:{pathId:null,orientation:"tangential",slide:0,offset:0},...yf.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",...na.defaultData,...yc.defaultData,geometry:lf.defaultData("RectangleGeometry"),material:is.defaultTwoLayerData("physical","layer1","layer2")},i.defaultBooleanObject={name:"Boolean",...na.defaultData,...yc.defaultData,geometry:lf.defaultData("BooleanGeometry"),material:is.defaultTwoLayerData("physical","layer1","layer2")},i.defaultShapeBlendObject={name:"Shape Blend",...na.defaultData,...yc.defaultData,geometry:lf.defaultData("ShapeBlendGeometry"),material:is.defaultTwoLayerData("physical","layer1","layer2")},i.defaultTextObject={name:"Text",...na.defaultData,...yc.defaultData,geometry:lf.defaultData("TextGeometry"),material:is.defaultTwoLayerData("physical","layer1","layer2")},i.defaultInputObject={name:"Input",...na.defaultData,...yc.defaultData,geometry:lf.defaultData("InputGeometry"),material:is.defaultTwoLayerData("physical","layer1","layer2")},(r=>{r.newEmpty=function(n,s){let a={name:s};return n.type==="Mesh"?(a.geometry={},"material"in n&&(a.material={layers:new Qs}),"materials"in n&&(a.materials=n.materials.map(o=>({layers:new Qs})))):Ky.is(n.type)&&(a.perspective={},a.orthographic={}),a},r.toOps=function(n,s){let a,o=[],l={orthographic:0,perspective:0,geometry:0};function u(h,d){for(let[c,p]of Object.entries(d.layers)){let{texture:f,...m}=p;if(f!==void 0&&Object.keys(f).length>0){let g={path:[...h,"layers",c,"texture"],props:f,type:0};o.push(g)}if(Object.keys(m).length>0){let g={path:[...h,"layers",c],props:m,type:0};o.push(g)}}}for(let[h,d]of Object.entries(s)){let c=d;if(h!=="name")if(h==="cloner")o.push(...Q7.toOps(c,["cloner"]));else if(h==="pathSnapping")o.push({path:[h],props:{slide:c.slide,offset:c.offset},type:0});else if(h==="material")u(["material"],c);else if(h==="materials")for(let[p,f]of Object.entries(c))u(["materials",p],f);else if(l[h]===0){if(h==="geometry"&&c.extrusion!==void 0){let p={path:[h,"extrusion"],props:c.extrusion,type:0};o.push(p),c={...c},delete c.extrusion}if(Object.keys(c).length>0){let p={path:[h],props:c,type:0};o.push(p)}}else a===void 0&&(a={path:[],props:{},type:0},o.push(a)),a.props[h]=c}return o},r.patch=function(n,s){if(s===void 0)return n;let a={...n};if(Object.assign(a,k1.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})}),Ky.is(n.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(n.type==="Mesh")"geometry"in s&&Object.assign(a,{geometry:sH.merge(a.geometry,s.geometry)}),(s.material||s.materials)&&(a=function(o,l){if(l===void 0)return o;let u={...o};return"material"in u&&"material"in l&&l.material&&(u.material=jO(u.material,h=>{if(typeof h!="string")for(let[d,c]of Object.entries(l.material.layers)){let p=h.layers.data(d);p&&os.patch(p,c)}}).data),u.materials&&l.materials&&(u.materials=jO(u.materials,h=>{for(let d=0;d<u.materials.length;d++){let c=l.materials[d];if(typeof c!="string")for(let[p,f]of Object.entries(c.layers)){let m=h[d]?.layers?.data(p);m&&os.patch(m,f)}}}).data),u}(a,s)),a.cloner&&"cloner"in s&&Object.assign(a,{cloner:Mg.merge(a.cloner,s.cloner)});else if(n.type==="Empty")a.cloner&&"cloner"in s&&Object.assign(a,{cloner:Mg.merge(a.cloner,s.cloner)});else if(eH.is(n.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=oa.clone(o.color))}return a}})(Eg||(Eg={}))}),bX=V(()=>{(aL||(aL={})).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}}),R4=V(()=>{bX(),Dh(),(bf||(bf={})).defaultData={orbitControls:aL.defaultData,playPage:wx,withBackground:!0,preventScroll:!1,preventTouchScroll:!1,hideCursor:!1,mouseEventTarget:"canvas",joystickSizeAndXYOffset:Array(12).fill(0).map((e,t)=>{let i=0,r=0;return t<5?r=-30:t<10&&(r=30),t===0||t===10||t===5?i=30:(t===4||t===11||t===9)&&(i=-30),[120,[i,r],"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}}),q1e=V(()=>{var e;(pF||(pF={})).defaultData={id:"basic",label:"Basic",style:"None",prompt:""},(fF||(fF={})).defaultData={weather:0,shadows:0,lightOrigin:0,temperature:0,sun:0,camera:0,environment:0,particles:0,nature:0,floor:0},(e=$v||($v={})).defaultData=()=>({mode:"line-art-both",prompt:"",negativePrompt:"",style:{...pF.defaultData},isRandomSeed:!0,seed:e.generateSeed(),guessMode:!1,advanced:!1,steps:20,guidanceScale:7.5,controlNetScale:1,modifiers:fF.defaultData}),e.generateSeed=()=>Math.round(1e5*Math.random())}),xX=V(()=>{C4(),Nr(),R4(),Dh(),ha(),q1e(),(e=>{function t(i,r){let n=i.scene.objects.get(r);if(n&&n.data.type==="Component")return n;{let s=i.shared.lib.components[r];if(s)return{...s.asset,id:r}}}e.physicsEnabled=function(i){return i.find(r=>r.data.type==="Page"&&r.data.globalPhysics.usePhysics)!==void 0},e.findTimeline=function(i,r){let n=i.find(s=>s.data.type==="Page"&&s.data.timelines?.[r]!==void 0);return n&&n.data.timelines?.[r]},e.getComponentData=t,e.traverseModuleInstances=function(i,r,n){i.scene.objects.traverseFrom(r,(s,a)=>{if(a.type==="Instance"){let o=t(i,a.component)?.data;o&&n(s,a,o.events)}else n(s,a,a.events)})}})(Zy||(Zy={})),(e=>{function t(r=!0,n=[]){let s=[];r&&s.push({...e.defaultLight}),s.push(...n);let a=new Aa;return a.push({fi:1,id:wx,data:{...cy.defaultData,name:"Scene 1"},children:s}),a}function i(r){return{...e.defaultData,objects:Ho(r,Aa.prototype)}}e.TRASH_CAN_ID="830a2708-8ed9-49cf-a68e-085299892222",e.defaultLight={fi:-1,data:nL.defaultDirectionalLightData,id:"830a2708-8ed9-49cf-a68e-085299899103",children:[]},e.createDefaultObjectTreeWithPage=t,e.defaultData={objects:t(),publish:bf.defaultData,styles:$v.defaultData()},e.emptyDataWithoutPage=function(){return{objects:new Aa,publish:bf.defaultData,styles:$v.defaultData()}},e.emptyDataWithPage=function(r=!0){return{objects:t(r),publish:bf.defaultData,styles:$v.defaultData()}},e.emptyData=function(){return{objects:new Aa,publish:{...bf.defaultData},styles:$v.defaultData()}},e.withObjs=i,e.withObj=function(r,n){return i([{id:r,data:n,children:[],fi:0}])}})(Xv||(Xv={}))}),$1e=V(()=>{(vE||(vE={})).defaultData={preset:"fullscreen",allowResponsive:!1,size:[512,512],coords:[0,0],sceneScale:1,color:{r:0,g:0,b:0,a:.5}}}),wX=V(()=>{var e,t;Nr(),ha(),(e=lH||(lH={})).defaultData=i=>({url:i,name:"New Webhook",parametersSchemas:new Nt}),e.defaultParameterValueByType=i=>i==="number"?0:i!=="boolean"&&"",(Dee||(Dee={})).defaultData=(i,r="GET")=>({url:i,method:r,name:"New API",headers:new Nt,queries:new Nt,autoStart:!0}),(i=>{function r(s){return s.textValue!==void 0}function n(s){return typeof s=="boolean"}i.isTextValue=r,i.isNumber=function(s){return typeof s=="number"},i.isBoolean=n,i.typeOfVariable=function(s){return r(s)?"string":n(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()}})(Eo||(Eo={})),(mF||(mF={})).all=["images","videos","colors","audios","particles","fonts","materials","variables"],(Nee||(Nee={})).all=[...mF.all,"components"],(Iee||(Iee={})).defaultData=function(){return{images:new ai,videos:new ai,colors:new ai,audios:new ai,particles:new ai,fonts:new ai,materials:new ai,components:new ai,variables:new ai,userAPIs:new ai,userWebhooks:new ai}},(hf||(hf={})).defaultData=function(){return{images:new ai,videos:new ai,colors:new ai,audios:new ai,particles:new ai,fonts:new ai,materials:new ai,components:new ai,variables:new ai,userAPIs:new ai,userWebhooks:new ai}},(t=fu||(fu={})).defaultColors=function(){return Ho({"89b10010-844c-11ec-a8a3-0242ac120002":{r:.5,g:.5,b:.5,a:1,name:"Default Color"}},ai.prototype)},t.defaultImages=function(){return Ho({},ai.prototype)},t.emptyData=function(){return{catelogs:new ai,materials:new ai,images:new ai,videos:new ai,colors:new ai,audios:new ai,particles:new ai,fonts:new ai,variables:new Nt,userAPIs:new ai,userWebhooks:new ai,lib:hf.defaultData()}},t.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 r=[0,0,0];return{name:"Time",value:{textValue:r,deliminator:":",padding:2,suffix:"AM"},dynamicVariableType:"time",format:"HH:mm:ss",format12h24h:"12ampm",timeZone:null,hasEnd:!1,endValue:{textValue:r,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)}},t.getFormattedTimerTime=function(i,r){if(r.format==="HH:mm:ss"){let n=Math.floor(i/3600),s=Math.floor((i-3600*n)/60);return{textValue:[n,s,Math.round(i-3600*n-60*s)]}}if(r.format==="mm:ss"){let n=Math.floor(i/60);return{textValue:[n,Math.round(i-60*n)]}}return r.format==="number"?Math.round(i):Math.round(1e3*i)/1e3}}),PIe=V(()=>{}),X1e=V(()=>{var e;Nr(),xX(),$1e(),wX(),(e=Ex||(Ex={})).defaultData={schema:131,scene:Xv.defaultData,frames:new ai().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",vE.defaultData),shared:{...fu.emptyData(),colors:fu.defaultColors()}},e.createDefaultData=function(){return sA.deserialize(sA.serialize(e.defaultData))},e.emptyDataForImports=function(){return{schema:131,scene:Xv.emptyDataWithPage(),frames:new ai().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",vE.defaultData),shared:{...fu.emptyData(),colors:fu.defaultColors(),images:fu.defaultImages()}}},e.emptyData=function(){return{schema:131,scene:Xv.emptyDataWithPage(),frames:new ai().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",vE.defaultData),shared:fu.emptyData()}},e.clipboard2dData=function(){return{schema:131,scene:Xv.emptyData(),frames:new ai,shared:fu.emptyData()}},e.withoutLib=function(t){return{...t,shared:{...t.shared,lib:hf.defaultData()}}},e.getComponentData=function(t,i){return Zy.getComponentData(t,i)},e.hasSensitiveData=function(t){let i=Object.values(t.shared.userAPIs);for(let r of i){let n=r.headers;for(let s of n)if(s.data.key.toLowerCase()==="authorization"&&s.data.value!=="")return!0}return!1}}),DIe=V(()=>{(hH||(hH={})).emptyImage={data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=",name:"empty"}});function py(e,t=[0,0]){return[e&&!isNaN(e[0])?e[0]:t[0],e&&!isNaN(e[1])?e[1]:t[1]]}function PS(e,t,i){switch(e){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:r,control2:n}=t??{...tw.defaultData};return`cubicBezier( ${r[0]}, ${r[1]}, ${n[0]}, ${n[1]} )`}case 6:{let{mass:r,stiffness:n,damping:s,velocity:a}=i??{...Tg.defaultData},o=new Y1e(r,n,s,a),l=o.solve(1);return()=>u=>o.solve(u)/l}case 8:return()=>r=>Math.floor(r)}}var Oee,Lee,fy,uA,Y1e,oL,lL,K1e=V(()=>{Nr(),Dh(),(Oee||(Oee={})).defaultData=function(e,t){return{id:e,name:t,duration:5,objectTimelines:new ai}},(Lee||(Lee={})).is=function(e){return e&&typeof e.x=="number"&&typeof e.y=="number"&&typeof e.z=="number"},(e=>{function t(h,d){let c=[0,0],p=[1,1];if(h?.cubicControls)c=py(h.cubicControls.control1,c);else switch(h?.type){case 2:case 4:c=[.42,0];break;case 3:case 0:c=[0,0];break;case 1:c=[.25,.1];break;case 7:c=[.25,1]}if(d?.cubicControls)p=py(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:c,control2:p}}function i(h){if(!e.BEZIER_PRESETS.includes(h))return;let d={type:h};return{control1:t(d).control1,control2:t(void 0,d).control2}}function r(h,d){return Math.abs(h[0]-d[0])<.001&&Math.abs(h[1]-d[1])<.001}function n(h){let d=e.ROOT_PROPERTY_ORDER.indexOf(h[0]);return d===-1?e.ROOT_PROPERTY_ORDER.length:d}function s(h){return h.layerId??h.path.join(".")}function a(h){let d=h[h.length-1];return uA.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 u(h,d,c){return{id:h,data:{id:h,time:c?.time??0,path:d,value:{},layerId:c?.layerId,index:c?.index,isPlaceholder:!0,easing:{type:5,cubicControls:{control1:[.42,0],control2:[.58,1]}}}}}e.getControlsWithDefault=t,e.BEZIER_PRESETS=[0,1,2,3,4,7],e.presetHandles=i,e.presetForHandles=function(h){return e.BEZIER_PRESETS.find(d=>{let c=i(d);return c!==void 0&&r(c.control1,h.control1)&&r(c.control2,h.control2)})},e.defaultData=function(h){return{id:h,keyframes:new Nt}},e.ROOT_PROPERTY_ORDER=["position","rotation","scale","shape size","material","opacity","camera","light","cloner","path extrusion","path snapping"],e.rowOrder=n,e.propertyKey=s,e.groupKeyframes=function(h,d){let c=new Map;for(let p of h){let f=p.data;if(d?.(f))continue;let m=s(f),g=c.get(m);g||(g={id:m,path:f.path,keyframes:[],layerId:f.layerId,index:f.index},c.set(m,g)),f.isPlaceholder?g.placeholder=p.id:g.keyframes.push(p)}return[...c.values()].sort((p,f)=>{let m=n(p.path)-n(f.path);return m!==0?m:(p.index??0)-(f.index??0)})},e.rowAxis=a,e.drawnRowKey=o,e.drawnRows=function(h){let d=new Map;for(let c of h){let p=a(c.path),f=p?c.path.slice(0,-1):c.path,m=o(c),g=d.get(m);g||(g={id:m,path:f,layerId:c.layerId,index:c.index,tracks:[]},d.set(m,g)),g.tracks.push({axis:p,property:c})}return[...d.values()]},e.sortedKeyframes=function(h){return[...h].sort((d,c)=>d.data.time-c.data.time)},e.materialLayerPath=l,e.createMaterialGroup=function(h,d){return h.map(({data:c,id:p},f)=>u(d(),l(c),{layerId:p,index:f}))},e.placeholderKeyframe=u,e.createName=function(h){return Object.entries(h).reduce((d,[c,p])=>(typeof p!="string"&&d.push({name:p.name}),d),[])},e.Presets=[{name:"Slide in",animationParams:{translateX:{value:[-20,0],easing:PS(3),duration:1e3},opacity:{value:[0,1],easing:PS(3),duration:1e3},endDelay:250,loop:!0}},{name:"Rotate",animationParams:{rotate:{value:[0,"1turn"],easing:PS(5),duration:700},endDelay:250,loop:!0}},{name:"Scale Out",animationParams:{scale:{value:[1,1.5],easing:PS(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:PS(5),duration:500},endDelay:500,loop:!0}},{name:"Bounce",animationParams:{translateY:{value:["20px","-20px"],duration:575,easing:"easeOutQuad"},direction:"alternate",loop:!0}}]})(fy||(fy={})),uA=["x","y","z"],Y1e=class{constructor(e=1,t=100,i=10,r=0){this.mass=e,this.stiffness=t,this.damping=i,this.initialVelocity=r,this.m_w0=Math.sqrt(t/e),this.m_zeta=i/(2*Math.sqrt(t*e)),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-r)/this.m_wd):(this.m_wd=0,this.m_A=1,this.m_B=-r+this.m_w0)}solve(e){return 1-(this.m_zeta<1?Math.exp(-e*this.m_zeta*this.m_w0)*(this.m_A*Math.cos(this.m_wd*e)+this.m_B*Math.sin(this.m_wd*e)):(this.m_A+this.m_B*e)*Math.exp(-e*this.m_w0))}getDuration(){let e=.16666666666666666,t=0,i=0;for(;;)if(t+=e,this.solve(t)===1){if(i++,i>=16)break}else i=0;return t*e*1e3}}}),SX=V(()=>{var e;Dh(),Nr(),(oL||(oL={})).list=["idle","move","jump","run"],(e=lL||(lL={})).defaultColliderData={type:"capsule",height:200,radius:50,position:[0,0,0],rotation:[0,0,0]},e.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:e.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 Nt,move:new Nt,jump:new Nt,run:new Nt},navmesh:{enabled:!1,ch:6,cs:6,walkableClimb:5,walkableHeight:1,walkableRadius:0,zones:"all",objects:[],helperVisible:!0,destinationHelperRadius:0,destinationHelperColor:kr.fromHexAndA(3728051,1)}}});function Cv(e,...t){let i={};for(let r of t.flat())e!=null&&r in e&&(i[r]=e[r]);return i}function Bee(e){e.layers.forEach(t=>{if(t.type==="depth"&&t.colorA!==void 0){let i=t.colorA,r=t.colorB,n=[[i.r,i.g,i.b,i.a],[r.r,r.g,r.b,r.a]],s=[0,1];for(let o=2;o<10;o++)n.push(n[1]),s.push(1);let a={...Cv($s(t),"type","visible","isVector","isWorldSpace","origin","alpha","mode"),near:Math.max(0,t.near),far:Math.max(0,t.far),colors:n,steps:s,num:2,direction:[1,0,0],smooth:!1,gradientType:1};Object.assign(t,a)}else if(t.type==="depth"&&t.gradientType===1&&(t.near<0||t.far<0)){let i={...$s(t),near:Math.max(t.near,0),far:Math.max(t.far,0)};Object.assign(t,i)}})}function $p(e,t){Object.values(e.shared.materials).forEach(i=>t(i))}function Xp(e,t){e.scene.objects.traverse((i,r)=>{"materials"in r?r.materials.forEach((n,s)=>{n===void 0&&(r.materials[s]=is.defaultTwoLayerData("phong"),n=r.materials[s]),typeof n!="string"&&t(n)}):"material"in r?typeof r.material!="string"&&(r.material===void 0&&(r.material=is.defaultTwoLayerData("phong")),t(r.material)):r.type==="Mesh"&&(r.material===void 0&&(r.material=is.defaultTwoLayerData("phong")),t(r.material)),"overrides"in r&&Object.values(r.overrides).forEach(n=>{n.material&&typeof n.material!="string"&&Object.getPrototypeOf(n.material)!==Qs.prototype&&t(n.material)})})}function Uee(e){e.layers===void 0&&Object.assign(e,is.defaultTwoLayerData("lambert"))}function gF(e){!e.layers||e.layers.forEach(t=>{if(t.type==="depth"&&t.colors.length===10){let i=[...t.colors];i.push(t.colors[9]);let r=[...t.steps];r.push(t.steps[9]);let n={...$s(t),colors:i,steps:r};Object.assign(t,n)}})}function Fee(e){e.scene.objects.traverse((t,i)=>{"materials"in i?i.materials.forEach(r=>{typeof r!="string"&&gF(r)}):"material"in i&&typeof i.material!="string"&&gF(i.material)}),Object.values(e.shared.materials).forEach(t=>gF(t))}function zee(e){e.layers&&e.layers.forEach(t=>{t.type==="depth"&&t.num!==void 0&&(t.colors=t.colors.slice(0,t.num),t.steps=t.steps.slice(0,t.num),delete t.num)})}function kee(e){e.layers&&e.layers.forEach(t=>{(function(i){return i.type!=="displace"})(t)&&t.isMask===void 0&&(t.isMask=!1),(t.type==="texture"||t.type==="video")&&t.blending===void 0&&(t.blending=0),(t.type==="noise"||t.type==="displace"&&t.displacementType==="noise")&&(t.voronoiStyle===void 0&&(t.voronoiStyle=0),t.highCut===void 0&&(t.highCut=1),t.lowCut===void 0&&(t.lowCut=0),t.smoothness===void 0&&(t.smoothness=.3),t.seed===void 0&&(t.seed=0),t.quality===void 0&&(t.quality=1))})}function Vee(e){let t=e.layers.find(i=>i.type==="light")?.data;if(t?.category==="basic"){let i=os.defaultData("light","phong"),r=t;Object.assign(r,i),r.visible=!1}}function Gee(e){$p(e,Vee),Xp(e,Vee)}function jee(e){e.layers.forEach(t=>{t.type==="light"&&t.category!=="toon"&&t.occlusion===void 0&&(t.occlusion=!0)})}function Hee(e){e.layers&&e.layers.forEach(t=>{t.type==="light"&&t.bumpMapIntensity===void 0&&(t.bumpMapIntensity=5)})}var NIe=V(()=>{PA(),Dh(),bX(),C4(),Nr(),R4(),ha(),le(),vX(),SX(),q1e(),xX(),gX(),_X()}),Z1e={};function Wee(e){e.layers&&e.layers.forEach(t=>{t.type==="light"&&t.alphaOverride===void 0&&(t.alphaOverride=1)})}function qee(e){e.rotation=e.rotation.slice(0,3).map(t=>t*Fv)}function Q1e(e){qee(e),e.type==="Page"&&qee(e.camera),e.states?.forEach(i=>{i.rotation===void 0||i.rotation===null||(i.rotation=i.rotation.slice(0,3).map(r=>r*Fv))});let t=e.geometry;t&&t.type==="SphereGeometry"&&(t.thetaLength=(t.thetaLength??180)*Fv),t&&t.type==="TorusGeometry"&&(t.arc=t.arc*Fv),t&&t.type==="PathGeometry"&&(t.extrusion.angle*=Fv,t.extrusion.twist*=Fv),e.type==="Mesh"&&e.geometry.type==="TextGeometry"&&(e.geometry.text={textValue:e.geometry.text}),Array.isArray($s(e.events))&&e.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 IIe(e){e.scene.objects.traverse((t,i)=>{})}function OIe(e){let t=e.schema??104;t!==131&&t<130&&(hL(e.asset),e.schema=130)}function tx(e,t){t(e.data);for(let i of e.children)tx(i,t)}function J1e(e){let t=e.schema??104;t!==131&&(t<105&&(tx(e.asset,Q1e),e.schema=105),t<118&&(tx(e.asset,t_e),e.schema=118),t<121&&(tx(e.asset,dH),e.schema=121),t<130&&(tx(e.asset,LIe),e.schema=130))}function e_e(e,t){Xp(e,t),$p(e,t),Object.values(e.shared.lib.materials).forEach(i=>t(i.asset))}function hL(e){e.layers===void 0&&Object.assign(e,is.defaultTwoLayerData("phong"))}function LIe(e){"materials"in e?e.materials.forEach(t=>{t!==void 0&&typeof t!="string"&&hL(t)}):"material"in e&&e.material!==void 0&&typeof e.material!="string"&&hL(e.material)}function t_e(e){e.timelineAnimations=Ho({},ai.prototype)}function BIe(e){let t=[];return e?(e.forEach((i,r)=>{let{path:n,keyframes:s}=i.data,a=n[0]==="material"?i.id:void 0;s?.length?s.forEach(({id:o,data:l})=>{t.push({id:o,data:{...l,path:n,layerId:a,index:r}})}):t.push(fy.placeholderKeyframe(i.id,n,{layerId:a,index:r}))}),t.sort((i,r)=>i.data.time-r.data.time),new Nt(...t.map((i,r)=>({...i,fi:r})))):new Nt}function UIe(e){for(let{id:t,data:i}of[...e.unproxy()]){let r=i.path?.[0];if(!r||!i_e.includes(r))continue;let n=uH(i.value);if(!n.length)continue;let s=e.data(t);if(!s)continue;let a=i.value,[o,...l]=n;for(let u of l){let h=ht.generateUUID();e.insertBefore(null,[{id:h,data:{...i,id:h,path:[r,u],value:a[u],easing:FIe(i.easing)}}])}s.path=[r,o],s.value=a[o]}}function uH(e){return e===null||typeof e!="object"?[]:uA.filter(t=>t in e)}function FIe(e){let t=e?.cubicControls;return{...e,cubicControls:{control1:[...t?.control1??[0,0]],control2:[...t?.control2??[1,1]]},...e?.springParameters?{springParameters:{...e.springParameters}}:{}}}function zIe(e,t){return Math.abs(e[0]-t[0])<1e-6&&Math.abs(e[1]-t[1])<1e-6}function kIe(e){let t=function(s){let a=[];for(let o of fy.groupKeyframes(s)){let l=new Set(o.keyframes.flatMap(h=>uH(h.data.value))),u=l.size?[...l].map(h=>o.keyframes.filter(d=>uH(d.data.value).includes(h))):[o.keyframes];for(let h of u){let d=[...h].sort((c,p)=>c.data.time-p.data.time);for(let c=0;c+1<d.length;c++)a.push({left:d[c],right:d[c+1]})}}return a}([...e.unproxy()]),i=new Map,r=new Set;for(let{left:s,right:a}of t){let o=s.data.easing?.type,l=(o===void 0?void 0:fy.presetHandles(o))?.control2??(o===5?py(a.data.easing?.cubicControls?.control2,[1,1]):void 0);if(!l)continue;let u=i.get(a.id);u?zIe(u,l)||r.add(a.id):i.set(a.id,l)}let n=new Map;for(let{id:s,data:a}of e.unproxy()){let o=a.easing?.type,l=o===void 0?void 0:fy.presetHandles(o);l&&n.set(s,l.control1)}for(let{left:s,right:a}of t)r.has(a.id)&&n.delete(s.id);for(let[s,a]of n){let o=e.data(s);!o?.easing||(o.easing.cubicControls={control1:a,control2:py(o.easing.cubicControls?.control2,[1,1])},o.easing.type=5)}for(let{left:s,right:a}of t){if(!n.has(s.id))continue;let o=e.data(a.id),l=i.get(a.id);!o?.easing||!l||(o.easing.cubicControls={control1:py(o.easing.cubicControls?.control1,[0,0]),control2:l})}}function $ee(e,t){e.scene.objects.traverse((i,r)=>{let n=r;if(n.type==="Page"&&n.timelines)for(let s of Object.values(n.timelines))for(let a of Object.values(s.objectTimelines??{}))t(a.keyframes)})}function dH(e){e.pivot=[0,0,0],e.pivotRotation=[0,0,0]}function VIe(e){}function GIe(e){let t=e.schema??0;if(t!==131){if(t>131)return void console.error(`This scene was created with a newer version of Spline (file format ${t}, this runtime reads 131). Update @splinetool/runtime to the latest version to load it correctly.`);console.warn("updating from ",t,"to ",131),function(i,r){if(r<1&&(Xp(i,Bee),$p(i,Bee),i.schema=1),r<2&&(function(n){Object.assign(n.scene.publish,{orbitControls:{...aL.defaultData,...$s(n.scene.publish.orbitControls)}})}(i),i.schema=2),r<3&&(function(n){function s(a){if(a.layers){for(let o of Object.values(a.layers))if(o){for(let[l,u]of Object.entries(o))if((A4.includes(l)||typeof u=="boolean")&&delete o[l],l==="texture")for(let[h,d]of Object.entries(u))(fX.includes(h)||typeof d=="boolean")&&delete u[h]}}}n.scene.objects.traverse((a,o)=>{o.states.forEach(l=>{let u=l;u.material?s(u.material):u.materials&&u.materials.forEach(h=>{s(h)})})})}(i),i.schema=3),r<4&&(function(n){n.scene.publish.withBackground=!0}(i),i.schema=4),r<5&&(function(n){n.scene.publish.settings.web={compress:!0,preload:!0,preset:1,logo:!0,hint:!1}}(i),i.schema=5),r<6&&(function(n){n.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),r<7&&(function(n){n.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),r<8&&(i.schema=8),r<9&&(Fee(i),i.schema=9),r<10&&(function(n){n.scene.objects.traverse((s,a)=>{a.type==="Mesh"&&(a.geometry.type==="BooleanGeometry"||a.geometry.type==="SubdivGeometry")&&(a.geometry.phongAngle=35)})}(i),i.schema=10),r<11&&(function(n){n.scene.environment.ambientLight.softShadows=!1,n.scene.environment.ambientLight.softShadowQuality="low",n.scene.objects.traverse((s,a)=>{(a.type==="DirectionalLight"||a.type==="SpotLight")&&(a.shadowResolution=1024,a.shadowRadius=1,a.depth=1e5)}),n.shared.penumbraSize=new Array(5).fill(.5)}(i),i.schema=11),r<12&&(Fee(i),i.schema=12),r<13&&(function(n){n.shared.audios=Ho({},ai.prototype)}(i),i.schema=13),r<14&&(function(n){let s=n.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),r<15&&(function(n){Object.entries($s(n.shared.images)).filter(s=>s[1].asset===!1).map(s=>s[0]).forEach(s=>{delete n.shared.images[s]}),Object.entries($s(n.shared.audios)).filter(s=>s[1].asset===!1).map(s=>s[0]).forEach(s=>{delete n.shared.audios[s]})}(i),i.schema=15),r<16&&(function(n){n.scene.publish.settings.web.preload=!1}(i),i.schema=16),r<17&&(Xp(i,zee),$p(i,zee),i.schema=17),r<18&&(Xp(i,Uee),$p(i,Uee),i.schema=18),r<19&&(function(n){Object.assign(n.scene.publish.settings,{video:{...bf.defaultData.settings.video,...$s(n.scene.publish.settings.video)}})}(i),i.schema=19),r<20&&(function(n){n.shared.fonts=Ho({},ai.prototype)}(i),function(n){let s=[];n.scene.objects.traverse((a,o)=>{let l=o;if(l.type==="TextFrame"){let u=is.defaultTwoLayerData("phong"),h=typeof l.color=="string"?n.shared.colors[l.color]:l.color;u.layers[1].data.color={r:h.r,g:h.g,b:h.b},u.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(m=>m.charAt(0).toUpperCase()+m.slice(1)).join(" ")}(l.font);n.shared.fonts[d]===void 0&&(n.shared.fonts[d]={name:d});let c={name:l.name,...na.defaultData,...yc.defaultData,flatShading:!1,wireframe:!1,geometry:{...lf.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:u,states:$s(l.states),events:$s(l.events),visible:l.visible,raycastLock:l.raycastLock,position:l.position,rotation:l.rotation,scale:l.scale,hiddenMatrix:l.hiddenMatrix},p=$s(n.scene.objects).parent(a);n.scene.objects.insertAfter(p??null,a,[{id:a+"new",data:c,children:[]}]),s.push(a)}}),s.forEach(a=>{n.scene.objects.delete(a)})}(i),i.schema=20),r<21&&(function(n){let s={0:"MouseDown",1:"MouseUp",2:"MouseHover",5:"KeyDown",6:"KeyUp",7:"Start",9:"LookAt",10:"Follow",11:"Scroll",12:"Audio",13:"GameControl"};n.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 Nt,move:new Nt,jump:new Nt}});else{let u=new Nt;Object.assign(l,{actions:u}),(l.type==="MouseDown"||l.type==="MouseUp"||l.type==="KeyDown"||l.type==="KeyUp")&&"url"in l&&u.push({fi:0,id:ht.generateUUID(),data:{type:"Link",url:l.url,delay:0}}),"targets"in l&&(l.targets.forEach((h,d,c)=>{let p={easing:h.easing,duration:h.duration};h.easing===6?Object.assign(p,Cv(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"},m={state:h.state,...f,...p},g={allowSlerp:!0,type:"Transition",object:h.object,repeat:0,delay:0,delayDirection:void 0,direction:"normal",tweens:new Nt({fi:0,id:ht.generateUUID(),data:{state:void 0,repeat:0,delay:0,delayDirection:void 0,direction:"normal",duration:0,easing:4}},{fi:1,id:ht.generateUUID(),data:m})};u.push({fi:c,id:d,data:g})}),delete l.targets)}})})}(i),function(n){n.scene.objects.traverse((s,a)=>{function o(l,u){let h=new Nt,d=[];if(a.events.forEach((c,p,f)=>{if(c.type==="Audio"&&c.trigger===u){let m;d.push(p),c.interaction==="play"?m={...Cv(c,"interaction","audio","delay","volume","loop"),triggerAfter:"after"in c?c.after:void 0,toggle:"after"in c?c.toggle:void 0,type:"Audio"}:(c.interaction==="pause"||c.interaction==="stop")&&(m={...Cv(c,"interaction","delay","object","playAudio"),type:"Audio"}),m&&h.push({fi:f,id:p,data:m})}}),d.forEach(c=>a.events.delete(c)),h.length){let c=a.events.find(p=>p.type===l)?.data;c?"actions"in c&&c.actions.insertBefore(null,h):a.events.insertBefore(null,[{id:ht.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),r<22&&(Gee(i),i.schema=22),r<23&&(function(n){n.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),r<24&&(function(n){n.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),(r<25||i.shared.videos===void 0)&&(function(n){n.shared.videos=Ho({},ai.prototype)}(i),r<25&&(i.schema=25)),r<26&&(function(n){n.scene.objects.traverse((s,a)=>{let o=n.scene.objects.unproxy().parent(s);if(o){let l=$s(n.scene.objects.data(o));l&&l.type==="Mesh"&&l.geometry.type==="BooleanGeometry"&&a.type==="Mesh"&&(a.visible=$s(a).booleanExclude!==!0)}})}(i),i.schema=26),r<27&&(function(n){n.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),r<28&&(Gee(i),i.schema=28),r<29&&(function(n){function s(o){Object.setPrototypeOf(o,Qs.prototype),o.texture&&Object.setPrototypeOf(o.texture,Qs.prototype)}function a(o){Object.setPrototypeOf(o,Qs.prototype);for(let l in o)s(o[l])}n.scene.objects.traverse((o,l)=>{l.states.forEach(u=>{let h=u;if(h.material){let d=$s(h.material).layers;a(d),h.material.layers=d}if(h.materials)for(let d=0;d<h.materials.length;d++){let c=h.materials[d],p=$s(c).layers;a(p),c.layers=p}})})}(i),i.schema=29),r<30&&(function(n){n.scene.objects.traverse((s,a)=>{a.type==="Mesh"&&a.geometry.type==="NonParametricGeometry"&&!("material"in a)&&!("materials"in a)&&(a.material=is.defaultTwoLayerData("phong"))})}(i),i.schema=30),r<31&&(function(n){n.scene.publish.orbitControls.autoZoom===void 0&&(n.scene.publish.orbitControls.autoZoom=!1),n.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),r<33&&(function(n){n.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),r<34&&(function(n){n.scene.publish.mouseEventTarget===void 0&&(n.scene.publish.mouseEventTarget="canvas"),n.scene.publish.settings.web.hint===void 0&&(n.scene.publish.settings.web.hint=!1)}(i),i.schema=34),r<35&&(function(n){let{video:s}=n.scene.publish.settings;s.format==="gif"&&s.fps>48&&(s.fps=15)}(i),i.schema=35),r<36&&(function(n){n.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),r<37&&(function(n){let s=n.scene.environment.usePhysics;n.scene.objects.traverse((a,o)=>{s&&o.physics===null?o.collision=!1:o.collision="visibility"})}(i),i.schema=37),r<38&&(Xp(i,kee),$p(i,kee),i.schema=38),r<39&&(function(n){n.scene.objects.traverse((s,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&(o.navmesh=lL.defaultDataThirdPerson.navmesh)})})}(i),i.schema=39),r<40&&(function(n){n.scene.styles||(n.scene.styles=$v.defaultData())}(i),i.schema=40),r<41&&(function(n){n.scene.environment.ambientLight.occlusion===void 0&&(n.scene.environment.ambientLight.occlusion=!1),n.scene.environment.ambientLight.aoFullRes===void 0&&(n.scene.environment.ambientLight.aoFullRes=!1),n.scene.environment.ambientLight.radius===void 0&&(n.scene.environment.ambientLight.radius=256),n.scene.environment.ambientLight.bias===void 0&&(n.scene.environment.ambientLight.bias=.5),n.scene.environment.ambientLight.aoColor===void 0&&(n.scene.environment.ambientLight.aoColor={r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}),Xp(n,jee),$p(n,jee)}(i),i.schema=41),r<42&&(function(n){n.scene.objects.traverse((s,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&Object.assign(o.gameActions,{run:new Nt})})})}(i),i.schema=42),r<43&&(function(n){n.scene.objects.traverse((s,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&(o.keyAssignments=[...o.keyAssignments,["run","\u21E7"],["none","Ctrl"]])})})}(i),i.schema=43),r<99){Xp(i,Hee),$p(i,Hee),i.scene.publish.playCamera===null&&(i.scene.publish.playCamera=a1);let n=$s(i.scene.objects),s=i.scene.objects;i.scene.publish.playPage=wx,s.insertBefore(null,null,[{id:wx,data:{...cy.defaultData,backgroundColor:i.scene.backgroundColor,fog:i.scene.fog,postprocessing:i.scene.postprocessing,ao:Cv(i.scene.environment.ambientLight,"occlusion","aoFullRes","radius","bias","aoColor"),publish:{playCamera:i.scene.publish.playCamera,gameControlObject:i.scene.publish.gameControlObject},shadow:Cv(i.scene.environment.ambientLight,"softShadowQuality"),globalPhysics:{...Mx.defaultData,...Cv(i.scene.environment,"usePhysics","gravity")},camera:$s(i.scene.ownerCamera)??cy.defaultData.camera,name:"Scene"},children:[]}]);for(let l of n)l.id!==Xv.TRASH_CAN_ID&&s.move(wx,l.fi,l.id);let a=0,o=0;i.shared.penumbraSize&&i.scene.objects.traverse((l,u)=>{u.type==="DirectionalLight"?(u.penumbraSize=i.shared.penumbraSize[Math.min(a,2)],a+=1):u.type==="SpotLight"&&(u.penumbraSize=i.shared.penumbraSize[3+Math.min(o,1)],o+=1),(u.physics===void 0||u.physics===null)&&u.type!=="Instance"&&(u.physics={},Object.assign(u.physics,Tx.defaultData)),u.physics!==void 0&&u.physics!==null&&(u.physics.enabled=u.collision??"visibility",delete u.collision)}),i.schema=99}}(e,t),t<100&&(e.scene.publish.joystickSizeAndXYOffset===void 0&&(e.scene.publish.joystickSizeAndXYOffset=bf.defaultData.joystickSizeAndXYOffset),e.schema=100),t<101&&(Xp(e,Wee),$p(e,Wee),e.schema=101),t<102&&(function(i){i.scene.objects.traverse((r,n)=>{let s=n.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"))})}(e),e.schema=102),t<104&&(e.shared.catelogs=new ai,e.shared.lib=hf.defaultData(),e.schema=104),t<105&&(function(i){i.shared.variables=Ho({},ai.prototype)}(e),e.scene.objects.traverse((i,r)=>{Q1e(r)}),e.schema=105);for(let i of Object.values(e.shared.lib.components))J1e(i);t<106&&(function(i){let r=$s(i.shared.variables);i.shared.variables=Ho(Object.entries(r??{}).map(([n,s],a)=>({fi:a,id:n,data:s})),Nt.prototype)}(e),e.schema=106),t<107&&(e.shared.lib.variables=hf.defaultData().variables,e.schema=107),t<109&&(function(i){i.shared.particles=Ho({},ai.prototype),i.shared.lib&&(i.shared.lib.particles=hf.defaultData().particles)}(e),e.schema=109),t<110&&(function(i){i.scene.objects.traverse((r,n)=>{n.type==="Particle"&&typeof n.renderMaterial.size=="number"&&Object.assign(n.renderMaterial,{size:[n.renderMaterial.size,n.renderMaterial.size]})})}(e),e.schema=110),t<111&&(e.scene.objects.traverse((i,r)=>{(function(n){Array.isArray($s(n.events))&&n.events?.forEach(s=>{"disabled"in s||(s.disabled=!1),(s.type==="MouseDown"||s.type==="MouseUp"||s.type==="MousePress")&&(s.mode=s.mode||"Object")})})(r)}),e.schema=111),t<112&&(function(i){i.scene.objects.traverse((r,n)=>{n.type==="Page"&&(n.postprocessing.depthOfField.focusDistance=100,n.postprocessing.depthOfField.focalLength=20,n.postprocessing.depthOfField.bokehScale=5)})}(e),e.schema=112),t<113&&(function(i){i.scene.objects.traverse((r,n)=>{Array.isArray($s(n.events))!==!1&&n.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")}))})})}(e),e.schema=113),t<114&&(e.scene.publish.settings.web.imageQuality===void 0&&(e.scene.publish.settings.web.imageQuality=70),e.schema=114),t<115&&(function(i){i.shared.userAPIs=Ho({},ai.prototype),i.shared.userWebhooks=Ho({},ai.prototype),i.shared.lib&&(i.shared.lib.userAPIs=hf.defaultData().userAPIs,i.shared.lib.userWebhooks=hf.defaultData().userWebhooks)}(e),e.schema=115),t<116&&(function(i){i.scene.publish.settings.videoStatic===void 0&&(i.scene.publish.settings.videoStatic=bf.defaultData.settings.videoStatic)}(e),e.schema=116),t<117&&(e.scene.publish.settings.web.pixelRatioMobile===void 0&&(e.scene.publish.settings.web.pixelRatioMobile=0),e.scene.publish.settings.web.pixelRatioDesktop===void 0&&(e.scene.publish.settings.web.pixelRatioDesktop=0),e.schema=117),t<118&&(e.shared.timelineAnimations=Ho({},ai.prototype),e.scene.objects.traverse((i,r)=>{t_e(r)}),e.schema=118),t<119&&(e.scene.publish.settings.videoStatic.format=Ex.defaultData.scene.publish.settings.videoStatic.format,e.scene.publish.settings.videoStatic.imageFormat=Ex.defaultData.scene.publish.settings.videoStatic.imageFormat,e.schema=119),t<120&&(e.scene.publish.settings.image.colorSpace="display-p3",e.scene.publish.settings.videoStatic.colorSpace="display-p3",e.schema=120),t<121&&(e.scene.objects.traverse((i,r)=>{dH(r),r.type==="Page"&&r.camera!==void 0&&dH(r.camera)}),e.schema=121),t<122&&(delete e.scene.publish.settings.video,e.scene.publish.orbitControls.rotationSpeed=Ex.defaultData.scene.publish.orbitControls.rotationSpeed,e.schema=122),t<123&&(e.scene.objects.traverse((i,r)=>{r.type==="Page"&&r.sky===void 0&&(r.sky=gg.defaultData)}),e.schema=123),t<124&&(t>=123&&e.scene.objects.traverse((i,r)=>{let n=r.sky;r.type==="Page"&&n!==void 0&&(typeof n.exposure=="number"&&(n.exposure=Math.round(n.exposure/5e-4*1e4)/1e4),n.lighting===void 0&&(n.lighting=gg.defaultData.lighting))}),e.schema=124),t<125&&(e.scene.objects.traverse((i,r)=>{let n=r.sky;r.type==="Page"&&n!==void 0&&n.lightingIntensity===void 0&&(n.lightingIntensity=gg.defaultData.lightingIntensity)}),e.schema=125),t<126&&(e.scene.objects.traverse((i,r)=>{let n=r.sky;r.type==="Page"&&n!==void 0&&(n.mode===void 0&&(n.mode="physical"),n.hdri===void 0?n.hdri={...gg.defaultData.hdri}:(n.hdri.blur===void 0&&(n.hdri.blur=gg.defaultData.hdri.blur),Array.isArray(n.hdri.rotation)&&(n.hdri.rotation=n.hdri.rotation[1]??0)))}),e.schema=126),t<127&&(e.scene.objects.traverse((i,r)=>{let n=r.sky;r.type==="Page"&&n?.hdri!==void 0&&n.hdri.showBackground===void 0&&(n.hdri.showBackground=!0)}),e.schema=127),t<128&&(e.scene.objects.traverse((i,r)=>{let n=r.sky;r.type==="Page"&&n!==void 0&&n.lightingQuality===void 0&&(n.lightingQuality="full")}),e.schema=128),t<129&&(e.scene.objects.traverse((i,r)=>{if(r.type==="Page"){r.camera===void 0&&(r.camera=cy.defaultData.camera);let n=r.camera;n.far=1e5,n.perspective?n.perspective.near=70:n.perspective={near:70,fov:45,zoom:1}}}),e.schema=129),t<130&&(e_e(e,hL),e.schema=130),t<131&&(function(i){i.scene.objects.traverse((r,n)=>{let s=n.states;if(!s)return;let a=n.timelineAnimations,o=[];s.forEach((l,u)=>{(l.isAnimation||a?.[u])&&o.push(u)}),o.forEach(l=>s.delete(l))})}(e),function(i){let r=i.shared,n=r.timelineAnimations;if(!n)return;let s=i.scene.objects,a=s.unproxy().find(o=>o.data.type==="Page")?.id;for(let[o,l]of Object.entries(n)){let u=Ho({},ai.prototype),h=0,d=Boolean(l.loop);for(let[f,m]of Object.entries(l.mapping??{})){let g=s.data(f)?.timelineAnimations?.[m];!g||(h=Math.max(h,g.to??0),d=d||Boolean(g.loop),u[f]={id:f,keyframes:BIe(g.properties?.unproxy())})}let c=l.page??a,p=c?s.data(c):void 0;p&&p.type==="Page"&&((p.timelines??(p.timelines=Ho({},ai.prototype)))[o]={id:o,name:l.name,duration:h||5,...d?{loop:d}:{},objectTimelines:u})}delete r.timelineAnimations,s.traverse((o,l)=>{delete l.timelineAnimations})}(e),$ee(e,UIe),$ee(e,kIe),e.schema=131)}}pw(Z1e,{updateAllMaterials:()=>e_e,updateDocumentSchema:()=>GIe,updateLibSchema:()=>VIe,updateMaterialSchema:()=>OIe,updateObjectStateRec:()=>tx,updateObjectsSchema:()=>J1e,updateTextValues:()=>IIe});var Fv,i_e,Xee,XC,vF,Yee,YC,Yv,DS,V1,KC,yF,hI,_F,bF,Kee,uI,xF,my,cH,P4=V(()=>{le(),X1e(),Nr(),K1e(),NIe(),R4(),PA(),ha(),wX(),C4(),yX(),Fv=180/Math.PI,i_e=["position","rotation","scale","shape size"]}),jIe=V(()=>{var e,t,i;Dh(),Nr(),ha(),(Xee||(Xee={})).is=function(r){return!0},(e=XC||(XC={})).defaultData={position:[0,0],scale:[1,1],rotation:0,shear:[0,0]},e.merge=function(r,n){return{position:n?.position??r.position,rotation:n?.rotation??r.rotation,scale:n?.scale??r.scale,shear:n?.shear??r.shear}},e.diff=function(r,n){return d1e({position:Bc.isEqual(r.position,n.position)?void 0:n.position,rotation:r.rotation===n.rotation?void 0:n.rotation,scale:Bc.isEqual(r.scale,n.scale)?void 0:n.scale,shear:r.shear&&n.shear&&Bc.isEqual(r.shear,n.shear)?void 0:n.shear})},(vF||(vF={})).defaultData={horizontalConstraint:0,verticalConstraint:0},(Yee||(Yee={})).defaultData={direction:"row",wrap:"unwrap",align:"top-left",gap:10,rowGap:10,autoGap:!1,autoRowGap:!1,leftPadding:8,rightPadding:8,topPadding:8,bottomPadding:8},(YC||(YC={})).defaultData={opacity:1,fill:{color:kr.fromHexAndA(eo,1),enabled:!0},stroke:{color:kr.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:kr.from0to1([0,0,0,1]),enabled:!1,spread:0},innerShadow:{offset:[10,10],blurRadius:10,color:kr.from0to1([0,0,0,1]),enabled:!1,spread:0}},(t=Yv||(Yv={})).newEmpty=function(r,n){return{name:n}},t.patch=function(r,n){if(n===void 0)return r;let s={...r};return Object.assign(s,XC.merge(s,n)),s=function(a,o){if(o===void 0)return a;let l={...a},u=["width","height","cornerRadius"];for(let h of u)h in l&&h in o&&o[h]!==void 0&&Object.assign(l,{[h]:o[h]});return l}(s,n),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,n),s},t.toOps=function(r,n){let s,a=[];for(let[o,l]of Object.entries(n))o!=="name"&&(s===void 0&&(s={path:[],props:{},type:0},a.push(s)),s.props[o]=l);return a},(DS||(DS={})).defaultData={...XC.defaultData,...vF.defaultData,states:new Nt,events:new Nt,visible:!0,raycastLock:!1},(V1||(V1={})).defaultData={...DS.defaultData,...YC.defaultData},(KC||(KC={})).defaultData={cornerRadius:[0,0,0,0]},(yF||(yF={})).defaultData={...V1.defaultData,type:"ellipse2d",width:100,height:100,name:"Ellipse"},(hI||(hI={})).defaultData={...V1.defaultData,...KC.defaultData,type:"rectangle2d",width:100,height:100,name:"Rectangle"},(_F||(_F={})).defaultData={...V1.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"},(bF||(bF={})).defaultData={...V1.defaultData,type:"path2d",path:"",name:"Path"},(Kee||(Kee={})).is=function(r){return r.type==="ellipse2d"||r.type==="rectangle2d"||r.type==="text2d"||r.type==="vector2d"||r.type==="path2d"},(uI||(uI={})).defaultData={...DS.defaultData,name:"Group",type:"group2d"},(xF||(xF={})).defaultData=()=>({...DS.defaultData,...KC.defaultData,...YC.defaultData,name:"Frame",type:"frame2d",clipped:!0,width:200,height:200,fill:{color:kr.fromHexAndA(4737101,1),enabled:!0},stroke:{color:kr.fromHexAndA(0,1),thickness:1,enabled:!1,mode:"inside"},backgroundBlur:{radius:2,enabled:!1},layerBlur:{radius:2,enabled:!1}}),(r=>{r.defaultData=function(n){switch(n){case"rectangle2d":case"vector2d":return{...hI.defaultData};case"ellipse2d":return{...yF.defaultData};case"text2d":return{..._F.defaultData};case"path2d":return{...bF.defaultData};case"frame2d":return{...xF.defaultData()};case"group2d":return{...uI.defaultData}}},r.getPivot=function(n){return"width"in n&&"height"in n?[typeof n.width=="number"?.5*n.width:0,typeof n.height=="number"?.5*n.height:0]:[0,0]},r.isResizeable=function(n){return n.type==="rectangle2d"||n.type==="ellipse2d"||n.type==="text2d"||n.type==="frame2d"},r.isAutoLayoutable=function(n){return n.type==="frame2d"&&n.autoLayout!==void 0},r.hasCorners=function(n){return n.type==="rectangle2d"||n.type==="frame2d"}})(my||(my={})),(i=cH||(cH={})).defaultData={name:"UI",type:"scene2d",objects:new Aa},i.emptyData=function(){return{type:"scene2d",objects:new Aa}}}),HIe=V(()=>{MIe(),EIe(),O1e(),L1e(),X1e(),D1e(),DIe(),k1e(),j1e(),yX(),P4(),$1e(),vX(),gX(),B1e(),PA(),z1e(),W1e(),Dh(),R4(),C4(),bX(),G1e(),wX(),xX(),AIe(),V1e(),SX(),_X(),U1e(),F1e(),jIe()});function Kv(e,t=!1){let i=e[0].index!==null,r=new Set(Object.keys(e[0].attributes)),n=new Set(Object.keys(e[0].morphAttributes)),s={},a={},o=e[0].morphTargetsRelative,l=new At,u=0;for(let h=0;h<e.length;++h){let d=e[h],c=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(!r.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]),c++}if(c!==r.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(!n.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(t){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(u,p,h),u+=p}}if(i){let h=0,d=[];for(let c=0;c<e.length;++c){let p=e[c].index;for(let f=0;f<p.count;++f)d.push(p.getX(f)+h);h+=e[c].attributes.position.count}l.setIndex(d)}for(let h in s){let d=Zee(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 c=0;c<d;++c){let p=[];for(let m=0;m<a[h].length;++m)p.push(a[h][m][c]);let f=Zee(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 Zee(e){let t,i,r,n=-1,s=0;for(let u=0;u<e.length;++u){let h=e[u];if(t===void 0&&(t=h.array.constructor),t!==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(r===void 0&&(r=h.normalized),r!==h.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(n===-1&&(n=h.gpuType),n!==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 t(s),o=new It(a,i,r),l=0;for(let u=0;u<e.length;++u){let h=e[u];if(h.isInterleavedBufferAttribute){let d=l/i;for(let c=0,p=h.count;c<p;c++)for(let f=0;f<i;f++){let m=h.getComponent(c,f);o.setComponent(c+d,f,m)}}else a.set(h.array,l);l+=h.count*i}return n!==void 0&&(o.gpuType=n),o}var DA=V(()=>{le()});function r_e(e){let t=e.points.length/7,i=new Nt;for(let r=0;r<t;r++){let n=7*r,s=e.points[n+0],a=e.points[n+1],o=e.points[n+2],l=e.points[n+3],u=e.points[n+4],h=e.points[n+5],d=e.points[n+6];i.push({fi:r,id:ht.generateUUID(),data:{roundness:d,position:[s,a],areControlsDirectionsMirrored:!0,controlPrevious:{position:[o,l]},controlNext:{position:[u,h]}}})}return{points:i,isClosed:e.isClosed,roundness:e.roundness,shapeHoles:e.shapeHoles?.map(r=>r_e(r))??[]}}function n_e(e){let{userData:t,uuid:i,...r}=e;if(t===void 0||t.type==="NonParametricGeometry")return function(a){let o,{userData:l,data:u}=a,h=u?.groups,d=u?.attributes??{},c=u?.morphAttributes??{},p=u?.interleavedBuffers,f=u?.arrayBuffers,m=u?.index;d.position!==void 0&&Array.isArray(d.position.array)&&(o=function(v){let y=1/0,_=1/0,b=1/0,x=-1/0,w=-1/0,S=-1/0;for(let M=0;M<v.length;M+=3){let T=v[M],E=v[M+1],A=v[M+2];y=Math.min(y,T),_=Math.min(_,E),b=Math.min(b,A),x=Math.max(x,T),w=Math.max(w,E),S=Math.max(S,A)}return{width:x-y,height:w-_,depth:S-b}}(d.position.array));let g={...l===void 0?{}:l.parameters,data:{attributes:d,morphAttributes:c,interleavedBuffers:p,arrayBuffers:f},...o===void 0?{}:o,type:"NonParametricGeometry"};return m!==void 0&&Object.assign(g.data,{index:m}),h!==void 0&&Object.assign(g.data,{groups:h.map(v=>({...v,materialIndex:v.materialIndex??0}))}),g}(e);if(t.type==="SubdivGeometry"){let a="SubdivGeometry",o=r.data?.attributes;if(o?.positionWASM===void 0){let u=new At;if(o?.position===void 0||o?.faceMap===void 0)return null;let h=o.position.array,d=o.faceMap.array,c=r.data.index.array;u.setAttribute("position",new Et(h,3)),u.setIndex(new Uf(c,1));let p=function(v,y=1e-4){y=Math.max(y,Number.EPSILON);let _={},b=v.getIndex(),x=v.getAttribute("position"),w=b?b.count:x.count,S=0,M=Object.keys(v.attributes),T={},E={},A=[],R=["getX","getY","getZ","getW"],N=["setX","setY","setZ","setW"];for(let j=0,K=M.length;j<K;j++){let q=M[j],se=v.attributes[q];T[q]=new se.constructor(new se.array.constructor(se.count*se.itemSize),se.itemSize,se.normalized);let ve=v.morphAttributes[q];ve&&(E[q]||(E[q]=[]),ve.forEach((oe,fe)=>{let _e=new oe.array.constructor(oe.count*oe.itemSize);E[q][fe]=new oe.constructor(_e,oe.itemSize,oe.normalized)}))}let D=.5*y,O=Math.log10(1/y),z=Math.pow(10,O),U=D*z;for(let j=0;j<w;j++){let K=b?b.getX(j):j,q="";for(let se=0,ve=M.length;se<ve;se++){let oe=M[se],fe=v.getAttribute(oe),_e=fe.itemSize;for(let Z=0;Z<_e;Z++)q+=~~(fe[R[Z]](K)*z+U)+","}if(q in _)A.push(_[q]);else{for(let se=0,ve=M.length;se<ve;se++){let oe=M[se],fe=v.getAttribute(oe),_e=v.morphAttributes[oe],Z=fe.itemSize,pe=T[oe],H=E[oe];for(let F=0;F<Z;F++){let X=R[F],re=N[F];if(pe[re](S,fe[X](K)),_e)for(let k=0,Q=_e.length;k<Q;k++)H[k][re](S,_e[k][X](K))}}_[q]=S,A.push(S),S++}}let G=v.clone();for(let j in v.attributes){let K=T[j];if(G.setAttribute(j,new K.constructor(K.array.slice(0,S*K.itemSize),K.itemSize,K.normalized)),j in E)for(let q=0;q<E[j].length;q++){let se=E[j][q];G.morphAttributes[j][q]=new se.constructor(se.array.slice(0,S*se.itemSize),se.itemSize,se.normalized)}}return G.setIndex(A),G}(u),f=[],m=new Array(d[d.length-1]+1).fill(3),g=p.getIndex().array;for(let v=0,y=d.length;v<y;)d[v]===d[v+1]?(m[d[v]]++,f.push(...new Set(g.slice(3*v,3*v+6))),v+=2):(f.push(...g.slice(3*v,3*v+3)),v++);o.indexWASM={array:f},o.positionWASM=p.attributes.position,o.verticesPerFaceWASM={array:m}}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,...WIe(o.positionWASM.array)};l.subdivisions=t.parameters.subdivisions;for(let u in o)u==="positionWASM"?l[u]=new Float32Array(o[u].array):u==="indexWASM"?l[u]=new Int32Array(o[u].array):u==="verticesPerFaceWASM"&&(l[u]=new Int8Array(o[u].array));return l.scaleBaked=[1,1,1],l}let n=t.type,s=t.parameters;return n==="VectorGeometry"?(s.extrudeDepth&&(s.depth=s.extrudeDepth),{...s,width:100,height:100,shape:r_e(t.shape),type:n}):n==="LatheGeometry"?{...t.parameters,type:n,points:(t?.parameters.points??[]).map(a=>[a.x,a.y])}:(s.extrudeDepth&&(s.depth=s.extrudeDepth),{...s,type:n})}function WIe(e){return pH.setFromArray(e),pH.getSize(SM),{width:SM.x,height:SM.y,depth:SM.z}}var pH,SM,s_e,Vf,yE,a_e,vw,NS,ZC,wF,yw,Qee,SF,Jee,TF,iw,lm,hm,op,MF,ete,tte,EF,fH,xf,qIe=V(()=>{Nr(),le(),DA(),new Ve,new jt,new Kr,new P,new P,pH=new fn,SM=new P}),$Ie=V(()=>{}),XIe=V(()=>{Nr(),P4()}),YIe=V(()=>{PA(),[...A4],new Set(fX)}),Wt=V(()=>{HIe(),$Ie(),PIe(),P4(),XIe(),K1e(),YIe(),SX(),Nr()}),qf=V(()=>{s_e=[3,4,8,9],Vf=5,yE=3,a_e=32}),NA=V(()=>{le(),vw=e=>{var t;return(t=class extends e{}).geometryHelper=new Ph(30,30,30),t}}),IA=V(()=>{le(),NS=new mf,ZC=new qa,wF=new Ve,yw=(e,t,i,r,n=!1,s=e)=>{let a=t,o=s.matrixWorld;if(a.boundingSphere===null&&a.computeBoundingSphere(),ZC.copy(a.boundingSphere),ZC.applyMatrix4(o),i.ray.intersectsSphere(ZC)===!1||(wF.copy(o).invert(),NS.copy(i.ray).applyMatrix4(wF),a.boundingBox!==null&&NS.intersectsBox(a.boundingBox)===!1))return;let l,u,h,d,c,p,f=a.index,m=a.attributes.position,g=a.drawRange;if(n===!1){for(c=Math.max(0,g.start),p=Math.min(f.count,g.start+g.count);c<p;c+=3)if(u=f.getX(c),h=f.getX(c+1),d=f.getX(c+2),l=v(e,i,NS,m,u,h,d),l)return l.faceIndex=Math.floor(c/3),void r.push(l)}else{let y=a.attributes.position,_=new P,b=new P,x=new P,w=new P,S=2,M=1/((s.scale.x+s.scale.y+s.scale.z)/3),T=M*M;for(let E=Math.max(0,g.start),A=Math.min(y.count,g.start+g.count)-1;E<A;E+=S){if(_.fromBufferAttribute(y,E),b.fromBufferAttribute(y,E+1),NS.distanceSqToSegment(_,b,w,x)>T)continue;w.applyMatrix4(s.matrixWorld);let R=i.ray.origin.distanceTo(w);R<i.near||R>i.far||r.push({distance:R,point:x.clone().applyMatrix4(s.matrixWorld),object:e})}}function v(y,_,b,x,w,S,M){let T=new P,E=new P,A=new P,R=new P,N=new P;if(T.fromBufferAttribute(x,w),E.fromBufferAttribute(x,S),A.fromBufferAttribute(x,M),b.intersectTriangle(T,E,A,!1,R)===null)return null;N.copy(R),N.applyMatrix4(y.matrixWorld);let D=_.ray.origin.distanceTo(N);return D<_.near||D>_.far?null:{faceIndex:1,distance:D,point:N.clone(),object:y}}}}),D4=V(()=>{le(),NA(),IA(),Qee=new P(1,1,1),SF=new P,Jee=new P,TF=new jt,iw=class extends vw(Nye){constructor(e,t=15){super(t),this.object=e,this.dummy=new mw,this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${e.uuid}`,this.matrix=this.dummy.matrixWorld,this.matrixAutoUpdate=!1,this.object.isBone&&(this.visible=!1)}raycast(e,t){yw(this.object,iw.geometryHelper,e,t,!1,this.dummy)}update(){}updateMatrix(){}updateMatrixWorld(e){this.object.matrixWorld.decompose(SF,TF,Jee),this.matrix.compose(SF,TF,Qee),super.updateMatrixWorld(e)}updateWorldMatrix(e,t){}}}),KIe=V(()=>{le(),lm=new P,hm=new P,op=new Ve,MF=[new P(-1,1,1),new P(-1,-1,1),new P(1,-1,1),new P(1,1,1),new P(-1,1,-1),new P(-1,-1,-1),new P(1,-1,-1),new P(1,1,-1)],ete=[[0,3],[1,2],[5,6],[4,7],[0,1],[3,2],[7,6],[4,5],[0,4],[1,5],[2,6],[3,7]],tte=[[0,2],[7,5],[4,1],[3,6],[4,3],[1,6]],EF=(e,t,i)=>{e.updateEntityBoxSize(lm,hm),op.copy(t).multiply(e.matrixWorld),hm.x===0&&hm.y===0&&hm.z===0?i.push(new P(lm.x,lm.y,lm.z).applyMatrix4(op)):MF.forEach(r=>{i.push(r.clone().multiply(hm).add(lm).applyMatrix4(op))})},fH=class extends fn{constructor(){super(...arguments),this.matrix=new Ve,this.vertices=[],this.faces=[],this.edges=[],this.centerEdges=[]}copy(e){return super.copy(e),this.matrix.copy(e.matrix),this.vertices=e.vertices.map(t=>t.clone()),this.faces=e.faces.map(t=>t.clone()),this.edges=e.edges.map(t=>t.clone()),this.centerEdges=e.centerEdges.map(t=>t.clone()),this}setFromObjectSize(e,t=!1){e.updateWorldMatrix(!1,t),this.makeEmpty(),this.matrix.copy(e.matrixWorld);let i=new Ve().copy(e.matrixWorld).invert();return this.expandByObjectSize(e,i,t)}expandByObjectSize(e,t,i=!1){let r=[];if(i===!0){let n=[];e.traverseEntity(s=>{if(s.visible||s.cloner&&s.data.visible){if(!("geometry"in s))return op.copy(t).multiply(s.matrixWorld),void n.push(new P().applyMatrix4(op));EF(s,t,r)}}),r.length===0&&r.push(...n)}else EF(e,t,r);return this.setFromPoints(r)}getCenter(e){return(e=super.getCenter(e)).applyMatrix4(this.matrix),e}getPositionToCenter(e){return(e=super.getCenter(e)).applyMatrix4(op.copy(this.matrix).setPosition(0,0,0)),e}computeVertices(){this.getSize(hm).multiplyScalar(.5),this.getCenter(lm),op.copy(this.matrix).setPosition(lm),this.vertices=MF.map(e=>e.clone().multiply(hm).applyMatrix4(op))}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=ete.map(([e,t])=>new Eh(this.vertices[e],this.vertices[t])),this.centerEdges=this.edges.map(e=>e.getCenter(new P))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=tte.map(([e,t])=>this.vertices[e].clone().add(this.vertices[t]).multiplyScalar(.5))}}}),uL=V(()=>{xf={Cloner:null,changeEntityProptotype:()=>{},createEntity:()=>{}}});function _E(e){return e?.isParticleSystem===!0}function Qy(e){return e?.isHairSystem===!0}function Gf(e){return e?.isShapeBlendEntity===!0}function N4(e){return e?.isPathObject===!0}function Ql(e){return e?.isObject2D===!0}function Xo(e){return e?.isUIObject===!0}function ix(e){return e?.isCloner===!0}function Zv(e){return e?.isClone===!0}function dI(e){return e?.isComponentObject===!0}var rs=V(()=>{});function Nn(e){TX.add(e)}function Ma(e,t){let i=`${e}:${t}`;vH.has(i)||vH.add(i)}function dL(e,t){MX.set(e,t)}function AF(e){return MX.get(e)}function _w(e,t){EX.set(e,t)}function CF(e){return EX.get(e)}function mH(e,t){AX.set(e,t)}function o_e(e){return AX.get(e)}function gH(){return I4}var TX,vH,MX,EX,AX,I4,cL,_r=V(()=>{TX=new Set,vH=new Set,MX=new Map,EX=new Map,AX=new Map,I4=null,cL=null});function l_e(e){let t=e.elements;hd.set(t[0],t[1],t[2]),ud.set(t[4],t[5],t[6]),Mc.set(t[8],t[9],t[10])}function h_e(){let e=Math.max(hd.lengthSq(),ud.lengthSq(),Mc.lengthSq());hd.lengthSq()>TM*e?Th.copy(hd).normalize():Th.set(1,0,0),Mh.crossVectors(Mc,Th),Mh.lengthSq()<=TM*e&&(Mh.copy(ud).addScaledVector(Th,-ud.dot(Th)),Mh.lengthSq()<=TM*e&&function(t,i){t.set(1,0,0).cross(i),t.lengthSq()<=TM&&t.set(0,1,0).cross(i),t.normalize()}(Mh,Th)),Mh.normalize(),Qv.crossVectors(Th,Mh)}function u_e(e){return l_e(e),h_e(),d_e.makeBasis(Th,Mh,Qv)}var hd,ud,Mc,Th,Mh,Qv,d_e,TM,MM,QC,Jv,O4,c_e=V(()=>{le(),hd=new P,ud=new P,Mc=new P,Th=new P,Mh=new P,Qv=new P,d_e=new Ve,TM=1e-12,MM=.01}),OA=V(()=>{le(),c_e(),QC=new Ve,(Jv||(Jv={})).is=function(e){return e&&e.__isSPEObject},O4=e=>class extends e{constructor(){super(...arguments),this.previousModelViewMatrix=new Ve,this.copyPreviousMatrix=!0,this.hiddenMatrix=new Ve,this.pivotMatrix=new Ve,this.matrixWorldRigid=new Ve,this.shearScale=new Ve,this.shearScaleInv=new Ve}get __isSPEObject(){return!0}getPhysicsLocalMatrix(t){return!!this.rigidBody?.isDynamic()&&(t.copy(this.matrixWorld),this.hasNonUniformScale&&t.multiply(this.shearScaleInv),this.parent&&t.premultiply(QC.copy(this.parent.matrixWorld).invert()),t.premultiply(QC.copy(this.hiddenMatrix).invert()),t.multiply(QC.copy(this.pivotMatrix).invert()),!0)}isDescendantOf(t){t instanceof un&&(t=t.uuid);let i=this;for(;i.parent;){if(i.parent.uuid===t)return!0;i=i.parent}return!1}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(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,t=!0);for(let i of this.children)i.updateMatrixWorld(t)}updateWorldMatrix(t,i){let r=this.parent;if(t&&r!==null&&r.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 n of this.children)n.updateWorldMatrix(!1,!0)}traverseChildren(t,i=0){for(let r of this.children)Jv.is(r)&&r.traverseObject(t,i+1)}traverseObject(t,i=0){if(t(this,i)!==!0)for(let r of this.children)Jv.is(r)&&r.traverseObject(t,i+1)}updateMatrixWorldRigid(){this.hasNonUniformScale=function(t,i,r){return l_e(t),h_e(),i.makeBasis(Th,Mh,Qv),r.set(Th.dot(hd),Th.dot(ud),Th.dot(Mc),0,Mh.dot(hd),Mh.dot(ud),Mh.dot(Mc),0,Qv.dot(hd),Qv.dot(ud),Qv.dot(Mc),0,0,0,0,1),function(){let n=hd.length(),s=ud.length(),a=Mc.length(),o=Math.max(n,s,a);if(o-n>MM||o-s>MM||o-a>MM)return!0;let l=MM*o*o;return Math.abs(hd.dot(ud))>l||Math.abs(hd.dot(Mc))>l||Math.abs(ud.dot(Mc))>l}()}(this.matrixWorld,this.matrixWorldRigid,this.shearScale),this.matrixWorldRigid.copyPosition(this.matrixWorld),this.shearScaleInv.copy(this.shearScale).invert()}attach(t,i){this.updateWorldMatrix(!0,!1);let r=new Ve().copy(this.matrixWorld).invert();return t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),r.multiply(t.parent.matrixWorld)),"hiddenMatrix"in t&&t.hiddenMatrix instanceof Ve?t.hiddenMatrix.premultiply(r):t.applyMatrix4(r),t.updateWorldMatrix(!1,!1),this.add(t),i!==void 0&&(this.children.pop(),this.children.splice(i,0,t)),this}copy(t,i=!1){return super.copy(t,i),this.hasNonUniformScale=t.hasNonUniformScale,this}onAfterRender(t,i,r,n,s,a){this.copyPreviousMatrix&&this.previousModelViewMatrix.copy(this.modelViewMatrix)}}});function ite(e,t,i){return vg.subVectors(t,e),dA.subVectors(t,i),vg.cross(dA).length()<=bE}function p_e(e){let t=bH.get(e.points);if(t!==void 0&&t.isClosed===e.isClosed)return t.curve;let i=function(r){let n=r.points,s=[n[0]],a=[new P(...n[0].data.position)];Rv.copy(a[0]);for(let v=0;v<n.length-1;v++)vg.fromArray(n[v].data.position),dA.fromArray(n[v+1].data.position),Db.subVectors(vg,Rv),Nb.subVectors(vg,dA),Db.cross(Nb).length()>bE&&(s.push(n[v]),a.push(new P().copy(vg)),Rv.copy(vg));let o=n[n.length-1];s.push(o),a.push(new P(...o.data.position));let l=r.isClosed,u=s.length-(l?0:1),h=s.length,d=[],c=[];for(let v=0;v<h;v++){let y=s[v].data;d.push(new P(...y.controlPrevious.position)),c.push(new P(...y.controlNext.position))}let p=[];for(let v=0;v<u;v++){let y=v===h-1?0:v+1;p.push(ite(a[v],c[v],a[y])&&ite(a[v],d[y],a[y]))}let f=[];for(let v=0;v<h;v++){let y=s[v].data,_=a[v],b={position:_,prevDir:void 0,nextDir:void 0,controlPrevious:d[v],controlNext:c[v],tan:void 0,baseRoundness:y.roundness,removedLength:0};if(f.push(b),y.roundness===0||!l&&(v===0||v===h-1))continue;let x=l&&v==0?h-1:v-1,w=l&&v==h-1?0:v+1,S=new P().subVectors(a[x],_).normalize(),M=new P().subVectors(a[w],_).normalize();b.prevDir=S,b.nextDir=M;let T=p[l&&v===0?h-1:v-1],E=p[v];if(T&&E){Pv.addVectors(S,M).normalize();let A=Rv.crossVectors(Pv,S).length()/S.dot(Pv);b.tan=A,b.removedLength=y.roundness/A}}for(let v=0;v<u;v++){let y=l&&v===h-1?0:v+1,_=f[v],b=f[y];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 m=new Array(2*h).fill(null);for(let v=0;v<u;v++){let y=l&&v===h-1?0:v+1,_=f[v],b=f[y],x=null;if(p[v]){let w=_.position.clone(),S=b.position.clone();(_.removedLength!==0||b.removedLength!==0)&&(_.nextDir&&w.add(Rv.copy(_.nextDir).setLength(_.removedLength)),b.prevDir&&S.add(Rv.copy(b.prevDir).setLength(b.removedLength))),w.distanceTo(S)>bE&&(x=new dE(w,w.clone().lerp(S,.3),S.clone().lerp(w,.3),S))}else _.position.distanceTo(b.position)>bE&&(x=new dE(_.position,_.controlNext,b.controlPrevious,b.position));m[2*v+1]=x}for(let v=0;v<h;v++){let y=f[v];if(y.removedLength===0)continue;let _=y.position,b=y.prevDir.clone().multiplyScalar(y.removedLength).add(_),x=y.nextDir.clone().multiplyScalar(y.removedLength).add(_),w=y.tan*y.removedLength;Pv.addVectors(y.prevDir,y.nextDir).normalize(),Db.copy(b).lerp(x,.5);let S=b.distanceTo(x)/2;_H.copy(Pv).multiplyScalar(Math.sqrt(Math.pow(w,2)-Math.pow(S,2))).add(Db),cI.copy(Pv).multiplyScalar(-w).add(_H);let M=_.distanceTo(cI)/_.distanceTo(Db);Nb.copy(y.prevDir).multiplyScalar(M*_.distanceTo(b)).add(_),yH.copy(Nb).lerp(cI,2);let T=b.clone().lerp(Nb,4/3),E=x.clone().lerp(yH,4/3);m[2*v]=new dE(b,T,E,x)}let g=new f_e;for(let v=0;v<m.length;v++){let y=m[v];y&&g.add(y)}return g}(e);return bH.set(e.points,{isClosed:e.isClosed,curve:i}),i}var f_e,bE,vg,dA,Rv,Pv,Db,cI,Nb,yH,_H,bH,Ib,xH,pI,m_e,g_e,v_e,hr,_c,rte,nte,IS,RF,JC,PF,DF,L4,wH,o1,Ec,y_e=V(()=>{le(),f_e=class extends u7{constructor(){super()}getPoints(e=12){let t,i=[],r=this.getCurveLengths(),n=r[r.length-1]/r.length;for(let s=0,a=this.curves;s<a.length;s++){let o=a[s],l=s===0?r[s]:r[s]-r[s-1],u=Math.ceil(e*l/n),h=o.getPoints(u);for(let d=0;d<h.length;d++){let c=h[d];t&&t.equals(c)||(i.push(c),t=c)}}return this.autoClose&&i.length>1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}},bE=.001,vg=new P,dA=new P,Rv=new P,Pv=new P,Db=new P,cI=new P,Nb=new P,yH=new P,_H=new P,bH=new WeakMap}),ZIe=V(()=>{le(),Ib=new Ve,xH=new jt,pI=new jt,m_e=new Kr,g_e=new P,v_e=new P(0,1,0)}),xl=V(()=>{le(),Wt(),KIe(),Nr(),uL(),rs(),_r(),OA(),y_e(),ZIe(),Hr(),(hr||(hr={})).is=function(e){return e&&e.__isEntity},_c=e=>hr.is(e),rte={type:"completeState",isfromEntity:!0},nte=["x","y","z"],IS=new P,RF=new P(1,1,1),JC=new jt,PF=new Kr,DF=new Ve,L4=e=>class extends O4(e){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 fH,this._recursiveBBox=new fH,this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0,this._needApplyPathSnapping=!0,this.attachedPaths=new Set}get __isEntity(){return!0}entityChildren(t){let i=this.children[t];if(hr.is(i))return i}entityChildrenCount(){let t=this.children.length;for(;t--;)if(hr.is(this.children[t]))return t+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 t=this;for(;t.data.type!=="Instance";){let i=t.parent;if(!hr.is(i))return;t=i}return t}forInstancesRec(t){this.instances.forEach(i=>{i.disposed||t(i),i.forInstancesRec(t)})}super_Entity(t,i){typeof t=="string"&&(this.uuid=t),this.identity=t,this.data=i,this.matrixAutoUpdate=!1,this.dataPatched=this.data}changeSelectedState(t,i,r=!1){if(this.data.states.length!==0||r){for(let n of this.data.states)Eg.toOps(this.data,n.data).forEach(s=>{let a=GO.replaceProps(s,this.data);this.dataPatched=this.data,this.updateByPatchedOp(a,this.data,i)});if(t!==null){let n=this.data.states.data(t);n&&(this.dataPatched=Eg.patch(this.data,n),Eg.toOps(this.data,n).forEach(s=>{this.updateByPatchedOp(s,this.dataPatched,i)}))}r&&this.updateTransformState(this.dataPatched,i),this.stateSelection=t,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(t,i){t.setScalar(0),i.setScalar(0)}resetBBoxNeedsUpdateSelf(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}resetBBoxNeedsUpdate(){this.resetBBoxNeedsUpdateSelf(),this.traverseAncestors(t=>{_c(t)&&t.resetBBoxNeedsUpdateSelf()}),this.traverseEntity(t=>{t.resetBBoxNeedsUpdateSelf()})}find(t){let i;return this.traverseEntity(r=>{r.uuid===t&&(i=r)}),i}traverseSortNextHelper(){let t=this.parent;if(t){let i=t.children,r=i.indexOf(this)+1;if(hr.is(i[r]))return i[r];if(hr.is(t))return t.traverseSortNextHelper()}}sortNext(){let t=this.children;return this.children.length>0&&hr.is(this.children[0])?t[0]:this.traverseSortNextHelper()}goUp(t){let i=this;for(;t>0&&i!==null;)i=i.parent,t-=1;return i}hasAnccestorOrSelf(t){return this===t||this.hasAnccestor(t)}hasAnccestor(t){let i=this.parent;for(;i;){if(t===i)return!0;i=i.parent}return!1}countToAccestor(t){let i=0,r=this;for(;r!==t;){if(r===null)return-1;r=r.parent,i+=1}return i}forEachEntity(t){for(let i of this.children)_c(i)&&t(i)}traverseEntityAncestors(t){this.traverseAncestors(i=>{hr.is(i)&&t(i)})}traverseConcreteEntity(t,i=0){if(t(this,i)!==!0)for(let r of this.children)_c(r)&&r.isConcreteEntity&&r.traverseEntity(t,i+1)}traverseEntity(t,i=0){if(t(this,i)!==!0)for(let r of this.children)_c(r)&&r.traverseEntity(t,i+1)}traverseVisibleEntity(t){t(this);for(let i of this.children)_c(i)&&i.visible&&i.traverseVisibleEntity(t)}updateMatrix(){super.updateMatrix(),this.cloner&&this.cloner.onObjUpdateMatrix(),this.dispatchEvent({type:"updateMatrix"})}updateMatrixWorld(t){super.updateMatrixWorld(t),this.dispatchEvent({type:"updateMatrixWorld"})}copy(t,i=!1){return super.copy(t,i),this.dataPatched=t.dataPatched,this.raycastLock=t.raycastLock,this.scaleLock=t.scaleLock,this.hiddenMatrix.copy(t.hiddenMatrix),this}hasEntityChild(){return this.children.some(t=>_c(t))}isAncestorOf(t){if(this.uuid===t)return!1;let i=!1;return this.traverseEntity(r=>{r.uuid===t&&(i=!0)}),i}toObjectTransformState(t=[]){return this.updateWorldMatrix(!0,!1),N7({position:this.position.toArray(),rotation:[this.rotation.x*ht.RAD2DEG,this.rotation.y*ht.RAD2DEG,this.rotation.z*ht.RAD2DEG],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray(),pivot:[0,0,0],pivotRotation:[0,0,0]},t)}getTransformValues(t,i,r){return i[t].map((n,s)=>r?.shared.getVariable(n,[this.uuid,t,nte[s]])??n)}updateTransformState(t,i){let r=!1;if(t.position&&(this.position.fromArray(this.getTransformValues("position",t,i)),r=!0),t.rotation&&(IS.fromArray(this.getTransformValues("rotation",t,i)).multiplyScalar(ht.DEG2RAD),this.rotation.setFromVector3(IS),r=!0),t.scale&&(this.scale.fromArray(this.getTransformValues("scale",t,i)),r=!0),t.hiddenMatrix!==void 0&&(r=!0,this.hiddenMatrix.fromArray(t.hiddenMatrix??Sx.identity)),t.pivot!==void 0||t.pivotRotation!==void 0){if(r=!0,t.pivot!==void 0&&t.pivotRotation!==void 0)this.pivotMatrix.compose(IS.fromArray(t.pivot).negate(),JC.setFromEuler(PF.fromArray(t.pivotRotation.map(n=>n*ht.DEG2RAD))).invert(),RF);else if(t.pivot!==void 0)this.pivotMatrix.setPosition(-t.pivot[0],-t.pivot[1],-t.pivot[2]);else if(t.pivotRotation!==void 0){let n=IS.setFromMatrixPosition(this.pivotMatrix);JC.setFromEuler(PF.fromArray(t.pivotRotation.map(s=>s*ht.DEG2RAD))).invert(),this.pivotMatrix.compose(n,JC,RF)}}return r&&(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(n=>{n.invalidateClonerTransform(this)})),t.position&&t.rotation&&t.scale&&t.hiddenMatrix!==void 0&&this.updateWorldMatrix(!1,!0),r}onVariableUpdate(t=!1){t?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 t of this.children)hr.is(t)&&t.disposeRecursively()}disposeRecursively(){this.dispose(),this.children.forEach(t=>{hr.is(t)&&t.disposeRecursively()})}toState(t=[]){return N7({name:this.name,visible:this.visible,raycastLock:this.raycastLock,...this.toObjectTransformState(t)},t)}updateByObjUpdateOp(t,i){t!==void 0&&this.updateByOp({type:0,props:t,path:[]},{...this.data,...t},i,!1)}updateByOp(t,i,r,n){let s=this.data;this.data=i;let a=t,o=Jr(t.path,["states","*"]);if(o!==null){if(t.type===0){let[l]=o;if(this?.stateSelection===l){let u={...t.props};if(delete u.name,Object.values(t.props).some(h=>h===void 0)){let h=this.data;if(h!==void 0){let d=Ta.zoom(h,t.path.slice(2));if(d)for(let c in t.props)t.props[c]===void 0&&c in d&&(u[c]=d[c])}}a={...t,props:u,path:t.path.slice(2)}}}}else if(t.type===0){let l=this.stateSelection?this.data.states.data(this.stateSelection):void 0;if(l!==void 0){if(t.props.name!==void 0&&l.name){let{name:h,...d}=l;l=d}if(t.props.material!==void 0&&"material"in l){let{material:h,...d}=l;l=d}let u=Ta.removeOverridden(t.path,t.props,l);a={...t,props:u}}}if(this.updateByPatchedOpBase(a,Eg.patch(this.data,this.stateSelection?this.data.states.data(this.stateSelection):void 0),r),Jr(t.path,["overrides"])){let l=[],u=[...t.path];for(l.push(u[1]),u.splice(0,2);u.length>0&&u[0]==="descendants";)l.push(u[1]),u.splice(0,2);if(l[l.length-1]===void 0){if(t.type===0)for(let h of Object.keys(t.props)){l[l.length-1]=h;let d=r.scene.findInstance([this.uuid,...l]);d&&(d.overrideData=t.props[h],d.updateState(Ig.apply(d.component.data,d.overrideData),r))}}else{let h=r.scene.findInstance([this.uuid,...l]);if(h){let d=Ta.zoom(h.component.data,u);if((t={...t,path:u}).type===0){let c=t.props;if(d)for(let[p,f]of Object.entries(t.props))f===void 0&&(c===t.props&&(c={...t.props}),c[p]=d[p]);t={...t,props:c}}h.overrideData=sL.resolve(i.overrides,l),h.updateByOp(t,Xa.applySimple(h.data,t),r,!1)}}}else if(this.instances.length>0){let l;if(t.path.length===0&&t.type===0){let u;for(let h of _f.rootOverrideProps)h in t.props&&(u===void 0&&(u={}),u[h]=t.props[h]);u&&(l={...t,props:u})}else for(let u of _f.rootOverrideProps)if(Jr(t.path,[u])){l=t;break}l!==void 0&&this.instances.forEach(u=>{if(u.isInstanceRoot){let h=Ig.filterOp(u.overrideData,l);h&&u.updateByOp(h,Xa.applySimple(u.data,h),r,!0)}}),this.instances.forEach(u=>{if(!u.isInstanceRoot){let h=Ig.filterOp(u.overrideData,t);if(h){let d;d=s===u.data&&t===h?i:Xa.applySimple(u.data,h),u.updateByOp(h,d,r,!0)}}})}}updateByPatchedOpBase(t,i,r){if(this.dataPatched=i,t.path.length===0&&t.type===0)t.props.type!==void 0&&!Ky.is(t.props.type)&&xf.changeEntityProptotype(this,i,r);else if(t.path.length===1&&t.path[0]==="geometry"&&t.type===0&&"type"in t.props){xf.changeEntityProptotype(this,i,r);for(let n of this.children)hr.is(n)&&n.updateVisible(r.scene)}this.updateByPatchedOp(t,i,r)}updateByPatchedOp(t,i,r){if(t.path.length===0&&t.type===0?this.updateState(t.props,r):t.type===0&&("resolutionLevel"in t.props||"useChildrenColors"in t.props)&&this.updateState(i,r),t.path[0]==="morphTargetInfluences"&&t.type===0){let n=i.morphTargetInfluences.get(t.path[1])?.data.name;n&&this.updateMorphInfluences(n,r.shared.getVariable(t.props.value,[this.uuid,"morphTargetInfluences",n]))}if(Jr(t.path,["pathSnapping"])!==null&&this.updatePathSnapping(i.pathSnapping),Jr(t.path,["cloner"])!==null){let n=Xa.drop(t,1);n.path.length===0&&n.type===0&&n.props.disabled===!0?this.setFromClonerState(null,r):this.cloner?this.cloner.updateState(i.cloner,r):(this.setFromClonerState(i.cloner,r),this.expandCloner(r)),this.updateVisible(r.scene)}}updatePathSnapping(t=this.dataPatched.pathSnapping){this._updatedPathSnapping=t,this._needApplyPathSnapping=!0}get updatedPathSnapping(){return this._updatedPathSnapping}applyPathSnapping(t){if(this._needApplyPathSnapping===!1)return;let i=this._updatedPathSnapping?.pathId??this.dataPatched.pathSnapping.pathId,r=this._updatedPathSnapping?.slide??this.dataPatched.pathSnapping.slide??0,n=this._updatedPathSnapping?.offset??this.dataPatched.pathSnapping.offset??0,s=this._updatedPathSnapping?.orientation??this.dataPatched.pathSnapping.orientation;if(i===null)return;let a=t.find(i);if(!a)return;this._needApplyPathSnapping=!1;let o=a.data;if(o.geometry.path.points.length<=1)return;let l=p_e(o.geometry.path),u=function(p){let f=p%1;return f<0?f+1:f===0&&p>0?1:f}(r+n),h=null;try{h=l.curves.length?l.getPointAt(u):null}catch{}if(h===null)return;a.updateMatrixWorld();let d=this.parent?DF.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix):DF.copy(this.hiddenMatrix),c=function(p,f,m,g){xH.setFromRotationMatrix(Ib.extractRotation(g));let v=p.clone().applyMatrix4(Ib.copy(g).invert().multiply(m));if(f===null)pI.setFromRotationMatrix(Ib.extractRotation(m));else{let y=f.clone().applyMatrix4(Ib.extractRotation(m));pI.setFromRotationMatrix(Ib.lookAt(g_e.set(0,0,0),y,v_e))}return{position:v,rotation:new P().setFromEuler(m_e.setFromQuaternion(xH.invert().multiply(pI))).multiplyScalar(ht.RAD2DEG)}}(h,s==="tangential"?l.getTangentAt(u):null,a.matrixWorld,d);this.updateTransformState({position:c.position.toArray(),rotation:c.rotation.toArray()}),this.traverseEntity(p=>{p._cameraType&&p.dispatchEvent(rte)})}updateVisible(t){if(this.visible=this.dataPatched.visible&&(!this.dataPatched.cloner||(this.dataPatched.cloner.disabled??!1)||this.dataPatched.cloner?.hideBase!==!0),!t)return;let i=!1;this.traverseEntity(r=>{if(r.data.type==="Splat")return i=!0,!0}),i&&t.reloadSplats()}updateState_Entity(t,i){t.name!==void 0&&(this.name=t.name),t.raycastLock!==void 0&&(this.raycastLock=t.raycastLock),t.visible!==void 0&&(this.updateVisible(i?.scene),this.resetBBoxNeedsUpdate()),i&&"cloner"in t&&t.cloner!==void 0&&(this.setFromClonerState(t.cloner,i),this.updateVisible(i.scene)),this.updateTransformState(t,i)}get attachedSurfaceCloners(){return this.children.filter(t=>ix(t)&&t.parameters.type==="toObject")}setFromClonerState(t,i){if(!this.disposed)if(t===null||t.disabled)this.cloner&&this.cloner.dispose(),this.cloner=void 0;else if(this.cloner===void 0){if(xf.Cloner===null)return void Ma("cloners","a cloner");this.cloner=new xf.Cloner(this,t),i.scene.addPendingExpandCloner(this)}else this.cloner.updateState(t,i)}expandCloner(t){!this.disposed&&this.cloner&&this.cloner.expandClones(t)}invalidateClonerTransform(t){this.cloner&&this.cloner.invalidateTransform(t)}requestRender(){this.dispatchEvent({type:"requestRender"})}}}),l1=V(()=>{le(),xl(),(wH||(wH={})).is=e=>"objectHelper"in e,o1=(e,t)=>class extends L4(e){constructor(){super(...arguments),this.objectHelper=new t(this),this.gizmos={}}get geometryHelper(){return t.geometryHelper}raycast(i,r){this.objectHelper.raycast(i,r)}showGizmos(){for(let i in this.gizmos){let r=this.gizmos[i];r instanceof tA&&(r.visible=!0)}}updateEntityBoxSize(i,r){this.objectHelper.visible&&this.geometryHelper instanceof Ph?(i.setScalar(0),r.set(this.geometryHelper.parameters.width,this.geometryHelper.parameters.height,this.geometryHelper.parameters.height).multiplyScalar(.5)):super.updateEntityBoxSize(i,r)}hideGizmos(){for(let i in this.gizmos){let r=this.gizmos[i];r instanceof tA&&(r.visible=!1)}}}}),B4=V(()=>{le(),D4(),l1(),Ec=class extends o1(mw,iw){constructor(e,t){super(),this.super_Entity(e,t),this.objectHelper.update(),this.data.type==="Empty"&&(this.objectHelper.visible=!1)}updateState(e,t){this.updateState_Entity(e,t),"buffer"in e&&Object.keys(e).length===1&&t.scene.reloadSplats()}}});function Ru(e,t,i,r,n,s,a){EM.set(n,s,a).unproject(r);let o=t[e];if(o!==void 0){let l=i.getAttribute("position");for(let u=0,h=o.length;u<h;u++)l.setXYZ(o[u],EM.x,EM.y,EM.z)}}var EM,nh,ste,__e,QIe=V(()=>{le(),NA(),IA(),EM=new P,nh=new xg,ste=class extends Mb{constructor(e){let t=new At,i=new sd({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],n=[],s={},a=new ot(15711266),o=new ot(15711266),l=new ot(2857471);function u(d,c,p){h(d,p),h(c,p)}function h(d,c){r.push(0,0,0),n.push(c.r,c.g,c.b),s[d]===void 0&&(s[d]=[]),s[d].push(r.length/3-1)}u("n1","n2",a),u("n2","n4",a),u("n4","n3",a),u("n3","n1",a),u("f1","f2",a),u("f2","f4",a),u("f4","f3",a),u("f3","f1",a),u("n1","f1",a),u("n2","f2",a),u("n3","f3",a),u("n4","f4",a),u("p","n1",o),u("p","n2",o),u("p","n3",o),u("p","n4",o),u("u1","u2",l),u("u2","u3",l),u("u3","u1",l),t.setAttribute("position",new Et(r,3)),t.setAttribute("color",new Et(n,3)),super(t,i),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update()}update(){let e=this.geometry,t=this.pointMap;nh.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let i=.8;Ru("n1",t,e,nh,-1,-1,i),Ru("n2",t,e,nh,1,-1,i),Ru("n3",t,e,nh,-1,1,i),Ru("n4",t,e,nh,1,1,i);let r=i;Ru("f1",t,e,nh,-1,-1,r),Ru("f2",t,e,nh,1,-1,r),Ru("f3",t,e,nh,-1,1,r),Ru("f4",t,e,nh,1,1,r);let n=r;Ru("u1",t,e,nh,.35,1.1,n),Ru("u2",t,e,nh,-.35,1.1,n),Ru("u3",t,e,nh,0,1.55,n),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}},__e=class extends vw(ste){constructor(e){super(e),this.object=e,this.name=`CombinedCameraHelper: ${e.uuid}`}updateMatrixWorld(e){super.updateMatrixWorld(e),this.updateTarget()}updateTarget(){let e=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(e)}raycast(e,t){yw(this.object,this.geometry,e,t,!0)}}});function ate(e){return 1-Math.pow(1-e,3)}var E0,e3,t3,i3,G1,r3,Hd,us,Nh=V(()=>{le(),QIe(),Wt(),l1(),Hr(),E0=new P,e3=new P,t3=new jt,i3=new P,G1=new P,r3=new P,Hd=class extends o1(xg,__e){constructor(e="",t={...gE.defaultData,name:""}){super(),this._cameraType="OrthographicCamera",this.targetOffset=yf.DefaultTargetOffset,this.isUpVectorFlipped=!1,this.angleOffsetFromUp=0,this.wasMovedByUser=!1,this.wasMovedBySwitchCameraAction=!1,this._createdAt=typeof performance<"u"?performance.now():0,this._tickProjectionTransition=()=>{let n=this._projectionTransition;if(n===void 0)return;if(this.disposed)return void this._endProjectionTransition();n.raf=requestAnimationFrame(this._tickProjectionTransition);let s=Hd.projectionTransitionRequestRender??n.requestRender;this.updateProjectionMatrix(),s?.()},this.super_Entity(e,t),this.previousProjectionMatrix=new Ve,this.matrixAutoUpdate=!0,this.width=window.innerWidth,this.height=window.innerHeight;let i=this.width,r=this.height;this.orthoCamera=new Vg(-.5*i,.5*i,.5*r,-.5*r,-5e4,1e4),this.perspCamera=new bh(45,i/r,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(e){let t=Hd.projectionTransitionsEnabled;Hd.projectionTransitionsEnabled=!1;try{return e()}finally{Hd.projectionTransitionsEnabled=t}}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}set fov(e){this.perspCamera.fov=e}get fov(){return this.perspCamera.fov}setNear(e,t){e==="PerspectiveCamera"?this.perspCamera.near=t:this.orthoCamera.near=t}setZoom(e,t){t>=0&&(e==="PerspectiveCamera"?this.perspCamera.zoom=t:this.orthoCamera.zoom=t)}set cameraType(e){e==="PerspectiveCamera"?this.toPerspective():e==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(e){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=e:this.orthoCamera.near=e}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(e){e>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}lookAt(e,t,i){typeof e=="number"&&(e=new P(e,t,i)),super.lookAt(e),this.getWorldPosition(E0),this.targetOffset=E0.distanceTo(e)}getTarget(e=new P){return this.getWorldDirection(e3),this.getWorldPosition(E0),e3.multiplyScalar(this.targetOffset),e.copy(E0).add(e3),e}getDistanceToTarget(){let e=this.getTarget();return this.getWorldPosition(E0),E0.distanceTo(e)}updateUp(){this.getWorldQuaternion(t3),i3.set(0,0,1).applyQuaternion(t3),G1.copy(un.DEFAULT_UP),this.isUpVectorFlipped&&G1.negate(),G1.applyQuaternion(t3),r3.copy(un.DEFAULT_UP).projectOnPlane(i3),this.angleOffsetFromUp=r3.angleTo(G1),this.angleOffsetFromUp*=r3.cross(G1).dot(i3)>=0?1:-1}updateTransformState(e,t){let i=super.updateTransformState(e,t);return e.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateUp(),i}getViewFrontToObject(e){let t=e.getWorldPosition(new P),i=e.getWorldDirection(new P).multiplyScalar(this.targetOffset);return{position:t.clone().add(i),target:t}}getViewToTarget(e){let t=this.getWorldDirection(new P).multiplyScalar(this.targetOffset);return{position:e.clone().sub(t),target:e}}getViewToObject(e){let t=new P;return e.getWorldPosition(t),this.getViewToTarget(t)}setViewplaneSize(e,t,i=!1){if(this.aspect=e/t,i){let r=e>t?this.aspect:1,n=e>t?1:this.aspect;this.left=-395*r,this.right=395*r,this.top=1/n*395,this.bottom=1/n*-395}else this.left=.5*-e,this.right=.5*e,this.top=.5*t,this.bottom=.5*-t;this.updateProjectionMatrix()}copyViewPlaneSize(e){this.aspect=e.aspect,this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.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 e=this._projectionTransition;if(e===void 0)return 1;let t=(performance.now()-e.start)/e.duration;return t>=1?1:t<=0?0:ate(t)}get _activeSubCamera(){return this._cameraType==="PerspectiveCamera"?this.perspCamera:this.orthoCamera}_canAnimateProjection(){return Hd.projectionTransitionsEnabled&&typeof requestAnimationFrame=="function"&&typeof performance<"u"&&performance.now()-this._createdAt>=Hd.projectionTransitionMinAgeMs}_beginProjectionTransition(e){let t=this._projectionTransition;t===void 0&&(t={from:new Ve,blend:new Ve,blendInverse:new Ve,start:0,duration:Hd.projectionTransitionDuration,referenceDepth:1,raf:0,requestRender:e},this._projectionTransition=t),t.from.copy(this.projectionMatrix),t.start=performance.now(),t.duration=Hd.projectionTransitionDuration,t.referenceDepth=Number.isFinite(this.targetOffset)?Math.max(1,this.targetOffset):1,e&&(t.requestRender=e),t.raf!==0&&cancelAnimationFrame(t.raf),t.raf=requestAnimationFrame(this._tickProjectionTransition)}_applyProjectionTransition(){let e=this._projectionTransition;if(e===void 0)return;let t=(performance.now()-e.start)/e.duration;if(t>=1)return void this._endProjectionTransition();let i=ate(t),r=e.from.elements,n=this._activeSubCamera.projectionMatrix.elements,s=e.blend.elements,a=e.referenceDepth,o=Math.max(1e-6,r[15]-r[11]*a),l=i*o/(i*o+(1-i)*Math.max(1e-6,n[15]-n[11]*a));for(let u=0;u<16;u++)s[u]=r[u]+(n[u]-r[u])*l;e.blendInverse.copy(e.blend).invert(),this.projectionMatrix=e.blend,this.projectionMatrixInverse=e.blendInverse}_endProjectionTransition(){let e=this._projectionTransition;if(e===void 0)return;e.raf!==0&&cancelAnimationFrame(e.raf),this._projectionTransition=void 0;let t=this._activeSubCamera;this.projectionMatrix=t.projectionMatrix,this.projectionMatrixInverse=t.projectionMatrixInverse}_syncProjectionTransition(e){let t=e._projectionTransition;if(t===void 0)return void(this._projectionTransition!==void 0&&this._endProjectionTransition());let i=this._projectionTransition;i===void 0?(i={from:new Ve,blend:new Ve,blendInverse:new Ve,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(t.from),i.start=t.start,i.duration=t.duration,i.referenceDepth=t.referenceDepth,this._applyProjectionTransition()}setFocalLength(e){this.perspCamera.setFocalLength(e),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(e,t,i,r,n,s){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(e,t,i,r,n,s):this.orthoCamera.setViewOffset(e,t,i,r,n,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(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(e,t){return super.copy(e,t),this.parent=e.parent,this.orthoCamera.copy(e.orthoCamera),this.perspCamera.copy(e.perspCamera),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.far=e.far,this.view=e.view===null?null:Object.assign({},e.view),this._cameraType=e._cameraType,this.aspect=e.aspect,this.fov=e.fov,this.focus=e.focus,this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this.targetOffset=yf.sanitizeTargetOffset(e.targetOffset),this.updateProjectionMatrix(),this._syncProjectionTransition(e),this}toCameraState(e=[]){return N7({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},e)}updateCameraSubtype(e,t){let i=e==="perspective"?"PerspectiveCamera":"OrthographicCamera";t.zoom!==void 0&&this.setZoom(i,t.zoom),t.near!==void 0&&this.setNear(i,t.near),t.fov!==void 0&&i==="PerspectiveCamera"&&(this.fov=t.fov)}updateState(e,t){this.updateCameraState(e,t)}updateCameraState(e,t){this.updateState_Entity(e,t),e.far!==void 0&&(this.far=e.far),e.orthographic!==void 0&&this.updateCameraSubtype("orthographic",e.orthographic),e.perspective!==void 0&&this.updateCameraSubtype("perspective",e.perspective),e.type!==void 0&&(e.type!==this._cameraType&&this._canAnimateProjection()&&this._beginProjectionTransition(t?.shared.requestRender),this.cameraType=e.type),e.up!==void 0&&this.up.fromArray(e.up.map(i=>typeof i=="number"?i:0)),e.targetOffset!==void 0&&(this.targetOffset=yf.sanitizeTargetOffset(e.targetOffset)),e.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateProjectionMatrix()}updateByPatchedOp(e,t,i){super.updateByPatchedOp(e,t,i),e.path.length===1&&e.type===0&&this.updateCameraSubtype(e.path[0],e.props)}toState(e){return{...super.toState(e),...this.toCameraState(e),type:this.cameraType}}},(us=Hd).projectionTransitionsEnabled=!1,us.projectionTransitionDuration=350,us.projectionTransitionMinAgeMs=1e3});function b_e(e){return e.type==="TorusGeometry"&&e.arc===360}var x_e,n3,SH,cA=V(()=>{le(),x_e=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,revolutions:2,segments:40,pathRadius:10,pathType:0,pathSegments:30,cornerRadius:30,cornerSegments:4},e.parameters),r=Math.abs(i.width),n=Math.abs(i.height??r),s=Math.abs(i.depth??r),a=Math.abs(Math.min(r,s))/2;return{parameters:Object.assign(i,{width:r,height:n,depth:s,radius:a,segments:Math.round(i.segments),pathSegments:Math.round(i.pathSegments),cornerSegments:Math.round(i.cornerSegments)})}}static build(e){let{width:t,height:i,depth:r,radius:n,revolutions:s,segments:a,pathRadius:o,pathType:l,pathSegments:u,cornerRadius:h,cornerSegments:d}=e.parameters,c=new SH(!1,t,i,r,n,s,a,o,l,u,h,d);return Object.assign(c,{userData:{...e,type:"HelixGeometry"}})}},n3=new Uf([0,0,0],1),SH=class extends At{constructor(e=!0,t=1,i=1,r=1,n=1,s=1,a=1,o=1,l=1,u=1,h=1,d=1){if(super(),s===0)return;let c=e&&s===1;c&&(d=0),h>100&&(h=100),h===0&&(d=0);let p,f,m,g,v,y,_,b,x=()=>new P,w=new P,S=x(),M=x(),T=x(),E=x(),A=x(),R=x(),N=x(),D=x(),O=x(),z=x(),U=x(),G=i-2*o+.001,j=G/s,K=Math.ceil(a*s),q=K+1,se=G/K,ve=-G/2,oe=u+1,fe=2*Math.PI/u,_e=Math.PI/2/d,Z=Math.min((1-h/100)*o,o-.01),pe=o-Z,H=0,F=2*d+2,X=oe*F/2,re=X+oe*q,k=Math.max(0,oe*(q+F)),[Q,te,W]=[3,3,2].map(dt=>Array(k*dt).fill(0)),he=[],ce=n-o;function Ee(dt,et){let Yt=Math.PI/2;y=et*se,b=2*Math.PI*(y%j)/j+Yt,y+=ve,_=Math.sin(b)*ce,v=Math.cos(b)*ce,e?dt.set(v,_,y):dt.set(v,y,_)}Ee(w,-1e-10),Ee(S,0),E.copy(w),Ee(w,1);let Se=w.distanceTo(S),qe=c?0:pe+Z,Ne=Se*K+2*qe,He=Z,Re=Ne-qe;for(let dt=0;dt<=K;dt++){Ee(M,dt),U.subVectors(M,E).normalize(),E.copy(M),O.copy(M).setComponent(+e+1,0).normalize(),z.crossVectors(U,O).normalize();let et=dt===0,Yt=dt===K,si=et?3*Math.PI/2:_e,ar=et?He:Re,St=et?oe:re,Dt=et?0:k-oe,Qt=U.clone().multiplyScalar(et?-pe:pe).add(M),Ai=U.clone().multiplyScalar(et?-1:1).normalize();for(let wi=0;wi<oe;wi++){let mi=wi*fe;if(A.addVectors(w.copy(O).multiplyScalar(o*Math.cos(mi)),S.copy(z).multiplyScalar(o*Math.sin(mi))),R.copy(A).normalize(),et||Yt){c||(H=Dt+wi,[0,1,2].forEach(Ci=>{Q[3*H+Ci]=Qt.getComponent(Ci),te[3*H+Ci]=Ai.getComponent(Ci)}),W[2*H]=+Yt,W[2*H+1]=wi/u),S.copy(R).multiplyScalar(Z),T.addVectors(M,S);for(let Ci=0;Ci<d;Ci++){let Ir=Ci*_e+si;N.addVectors(w.copy(U).multiplyScalar(pe*Math.sin(Ir)),S.copy(R).multiplyScalar(pe*Math.cos(Ir))),D.copy(N).normalize(),S.addVectors(T,N),N.normalize(),H=St+Ci*oe+wi,[0,1,2].forEach(ir=>{Q[3*H+ir]=S.getComponent(ir),te[3*H+ir]=D.getComponent(ir)});let Wr=+et+Math.sin(Ir);W[2*H]=(ar+pe*Wr)/Ne,W[2*H+1]=wi/u}}S.addVectors(M,A),H=X+dt*oe+wi,[0,1,2].forEach(Ci=>{Q[3*H+Ci]=S.getComponent(Ci),te[3*H+Ci]=R.getComponent(Ci)}),W[2*H]=(qe+dt*Se)/Ne,W[2*H+1]=wi/u}}let ee=q+2*d+2,[Me,We]=[+c,ee-1];for(let dt=Me;dt<=We-1;dt++){let et=c&&dt===We-1;for(let Yt=0;Yt<oe-1;Yt++)p=dt*oe+Yt,f=p+1,m=(et?Yt:p)+oe,g=(et?Yt+1:f)+oe,dt===0?he.push(f,g,m):dt===ee-2?he.push(p,f,m):he.push(p,f,m,f,g,m)}this.setIndex(he),this.setAttribute("position",new Et(Q,3)),this.setAttribute("normal",new Et(te,3)),this.setAttribute("uv",new Et(W,2))}getClosedTorusIndicesForBooleanOrSubdiv(){let e,t,i,r,n=this.userData.parameters,s=Math.ceil(n.tubularSegments),a=n.radialSegments,o=a+1,l=[];for(let u=1;u<s;u++)for(let h=0;h<a;h++)e=u*o+h,t=e+1,i=e+o,r=t+o,l.push(e,t,i,t,r,i);for(let u=0;u<a;u++)e=s*o+u,t=e+1,i=u+o,r=u+1+o,l.push(e,t,i,t,r,i);return n3.array=new Uint32Array(l),n3.count=l.length,n3}}});function JIe(e){return lte||(lte=async function(){let t=e??"https://cdn.spline.design/@splinetool/runtime@2.0.37/build",i=import("./boolean.js"),[r,n]=await Promise.all([i,fetch(`${t}/boolean.wasm`).then(s=>s.arrayBuffer())]);await r.default({module_or_path:n}),pA=r}())}function pL(){if(pA===void 0)throw new Error("boolean-wasm is not loaded");return pA}function CX(e){let t=fA.get(e);if(t===void 0)throw new Error("Unknown csg mesh set handle "+e);return t}function RX(e){return fA.set(++TH,e),TH}function eOe(e,t,i){if(pA===void 0)return-1;let{positions:r,indices:n,normals:s}=function(a,o){if(o&&a.userData.positions!==void 0){let p=a.userData,f=[];for(let m=0,g=0;m<p.verticesPerFace.length;m++){let v=p.verticesPerFace[m];for(let y=1;y<v-1;y++)f.push(p.indices[g],p.indices[g+y],p.indices[g+y+1]);g+=v}return{positions:p.positions instanceof Float32Array?p.positions:new Float32Array(p.positions),indices:new Uint32Array(f)}}let l;l=b_e(a.userData.parameters)?a.getClosedTorusIndicesForBooleanOrSubdiv():a.getIndex();let u,h=a.getAttribute("position");if(l===null){u=new Uint32Array(h.count);for(let p=0;p<u.length;p++)u[p]=p}else u=l.array instanceof Uint32Array?l.array:new Uint32Array(l.array);let d=a.getAttribute("normal"),c=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:u,normals:c}}(e,t);return RX(new pA.CsgMesh(r,n,s))}function ote(e,t){let i=pL(),r=S_e[t];if(r===void 0)throw new Error("Unknown boolean operation "+t);let n=e.map(CX);if(n.length===1)return i.clone_mesh(n[0]);let s,a=[];if(t===2&&n.length>2){let o=n[0];for(let l=1;l<n.length-1;l++)o=i.boolean_mesh(o,n[l],0),a.push(o);s=i.boolean_mesh(n[n.length-1],o,2)}else if(t===2)s=i.boolean_mesh(n[1],n[0],2);else{let o=n[n.length-1];for(let l=0;l<n.length-1&&(o=i.boolean_mesh(o,n[l],r),a.push(o),o.tri_count()!==0);l++);s=o,a.pop()}for(let o of a)o.free();return s}function NF(e,t){CX(e).transform(new Float32Array(t.elements))}function w_e(e){let t=fA.get(e);t!==void 0&&(t.free(),fA.delete(e))}var pA,fA,TH,lte,S_e,U4=V(()=>{le(),cA(),fA=new Map,TH=0,S_e={0:0,1:1,2:2}});function A0(e){return e!==null&&"booleanOp"in e}var MH,T_e,tOe=V(()=>{le(),xl(),U4(),MH=class extends L4(Cr){constructor(){super(...arguments),this.booleanMeshSetAddress=-1,this.booleanWasTransformed=!1,this.booleanMatrixInvOld=new Ve}updateVisible(e){super.updateVisible(e),this.visible=!A0(this.parent)&&this.visible,A0(this.parent)&&this.parent.invalidateDownstreamBooleanData()}onClonerLayoutUpdated(){A0(this.parent)&&this.invalidateDownstreamBooleanData()}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(w_e(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(e=!1){return e?this.booleanWasTransformed=!0:this.freeBooleanPointer(),A0(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let e of this.children)e instanceof MH&&(e.freeBooleanPointer(),A0(e)&&e.invalidateUpstreamBooleanData())}updateTransformState(e,t){let i=super.updateTransformState(e,t);return i&&A0(this.parent)&&this.invalidateDownstreamBooleanData(!0),i}onVariableUpdate(e=!1){super.onVariableUpdate(e),A0(this.parent)&&this.invalidateDownstreamBooleanData(!0)}}}),iOe=V(()=>{T_e=null});function PX(e,t=0,i=e.count,r,n){let s=1/0,a=1/0,o=1/0,l=-1/0,u=-1/0,h=-1/0;for(let d=t;d<i;d++){let c=e.getX(d),p=e.getY(d),f=e.getZ(d);c<s&&(s=c),p<a&&(a=p),f<o&&(o=f),c>l&&(l=c),p>u&&(u=p),f>h&&(h=f)}AM.min.set(s,a,o),AM.max.set(l,u,h),AM.getCenter(r),AM.getSize(n).multiplyScalar(.5)}var AM,hte,ute,Ss,Na=V(()=>{le(),tOe(),iOe(),AM=new fn,hte=new At,ute=new Zl,Ss=class extends MH{constructor(e,t){super(hte,ute),this.super_Entity(e,t)}updateState(e,t){this.updateState_Entity(e,t)}raycast(e,t){let i=T_e;i===null?super.raycast(e,t):i(this,e,t)}updateEntityBoxSize(e,t){let i=this.geometry.getAttribute("position");i!==void 0?PX(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,e,t):super.updateEntityBoxSize(e,t)}}});function fL(e){return e?.isClassicNodeMaterial===!0}var Fr,mA,M_e,E_e,xE,A_e,C_e,R_e,DX=V(()=>{}),bu=V(()=>{le(),Fr=class extends ot{constructor(e,t,i,r){super(e,t,i),this.isColorA=!0,this.a=r}setRGBA(e,t,i,r){super.setRGB(e,t,i),this.a=r}copy(e){return super.copy(e),this.a="a"in e?e.a:1,this}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}equals(e){return super.equals(e)&&this.a===e.a}setStyle(e,t="srgb"){let i;if(e==="transparent")return this.setRGBA(0,0,0,0),this;if(i=/^((?:rgb|hsl)a?)\(([^)]*)\)/.exec(e)){let r,n=i[1],s=i[2];switch(n){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.a=n==="rgba"?parseFloat(r[4]):1,super.setStyle(e,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)%\s*,\s*(\d*\.?\d+)%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.a=n==="hsla"?parseFloat(r[4]):1,super.setStyle(e,t)}}return super.setStyle(e,t)}get x(){return this.r}get y(){return this.g}get z(){return this.b}get w(){return this.a}set x(e){this.r=e}set y(e){this.g=e}set z(e){this.b=e}set w(e){this.a=e}}}),P_e=V(()=>{bu(),mA=class extends Fr{}}),rOe=V(()=>{M_e=class{constructor(e=1e4){this.timeout=e,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(...e){}remove(e){let t=this.cache.get(e);t&&(this.dispose(e,t.data),this.cache.delete(e),t.prev.next=t.next,t.next.prev=t.prev,t.next=null,t.prev=null,t.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 e=Date.now(),t=this.head.next;for(;t.time<e-this.timeout;){this.dispose(t.src,t.data),this.cache.delete(t.src);let i=t;t=t.next,t.prev=this.head,this.head.next=t,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(e){return this.cache.get(e)?.data}load(e){let t=Date.now(),i=this.cache.get(e);return i===void 0?(i={data:this.create(e),src:e,time:t,next:null,prev:null},this.cache.set(e,i)):(i.time=t,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((e,t)=>{this.dispose(t,e.data),e.next=null,e.prev=null,e.data=null}),this.cache.clear(),this.head.next=this.tail,this.tail.prev=this.head}destroy(){this.disposeAll(),this.head=null,this.tail=null}}}),D_e=V(()=>{rOe(),E_e=class extends M_e{create(e){return URL.createObjectURL(new Blob([e]))}dispose(e,t){URL.revokeObjectURL(t)}}}),N_e=V(()=>{A_e=class{constructor(e,t){this.data=e,this.cache=t,this.refCount=0}deref(){this.refCount,this.refCount-=1,this.refCount===0&&(this.cache.remove(this),this.dispose())}dispose(){this.refCount}},C_e=class{constructor(){this.cache=new Map}remove(e){this.cache.delete(e.data)}load(e){let t=this.cache.get(e);return t===void 0&&(t=this.create(e),this.cache.set(e,t)),t.refCount+=1,t}}}),nOe=V(()=>{le(),R_e=class extends xye{constructor(e){super(e),this.type=ni}parse(e){let t=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,m){f=f||1024;let g=p.pos,v=-1,y=0,_="",b=String.fromCharCode.apply(null,new Uint16Array(p.subarray(g,g+128)));for(;0>(v=b.indexOf(`
4163
4163
  `))&&y<f&&g<p.byteLength;)_+=b,y+=b.length,g+=128,b=String.fromCharCode.apply(null,new Uint16Array(p.subarray(g,g+128)));return-1<v&&(m!==!1&&(p.pos+=y+v+1),_+b.slice(0,v))},r=function(p,f,m,g){let v=p[f+3],y=Math.pow(2,v-128)/255;m[g+0]=p[f+0]*y,m[g+1]=p[f+1]*y,m[g+2]=p[f+2]*y,m[g+3]=1},n=function(p,f,m,g){let v=p[f+3],y=Math.pow(2,v-128)/255;m[g+0]=bd.toHalfFloat(Math.min(p[f+0]*y,65504)),m[g+1]=bd.toHalfFloat(Math.min(p[f+1]*y,65504)),m[g+2]=bd.toHalfFloat(Math.min(p[f+2]*y,65504)),m[g+3]=bd.toHalfFloat(1)},s=new Uint8Array(e);s.pos=0;let a,o,l,u=function(p){let f,m,g=/^#\?(\S+)/,v=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,y=/^\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)))&&t(1,"no header found"),(m=f.match(g))||t(3,"bad initial token"),x.valid|=1,x.programtype=m[1],x.string+=f+`
4164
4164
  `;f=i(p),f!==!1;)if(x.string+=f+`
4165
4165
  `,f.charAt(0)!=="#"){if((m=f.match(v))&&(x.gamma=parseFloat(m[1])),(m=f.match(y))&&(x.exposure=parseFloat(m[1])),(m=f.match(_))&&(x.valid|=2,x.format=m[1]),(m=f.match(b))&&(x.valid|=4,x.height=parseInt(m[1],10),x.width=parseInt(m[2],10)),2&x.valid&&4&x.valid)break}else x.comments+=f+`
4166
4166
  `;return 2&x.valid||t(3,"missing format specifier"),4&x.valid||t(3,"missing image size specifier"),x}(s),h=u.width,d=u.height,c=function(p,f,m){let g=f;if(g<8||g>32767||p[0]!==2||p[1]!==2||128&p[2])return new Uint8Array(p);g!==(p[2]<<8|p[3])&&t(3,"wrong scanline width");let v=new Uint8Array(4*f*m);v.length||t(4,"unable to allocate buffer space");let y=0,_=0,b=4*g,x=new Uint8Array(4),w=new Uint8Array(b),S=m;for(;S>0&&_<p.byteLength;){_+4>p.byteLength&&t(1),x[0]=p[_++],x[1]=p[_++],x[2]=p[_++],x[3]=p[_++],(x[0]!=2||x[1]!=2||(x[2]<<8|x[3])!=g)&&t(3,"bad rgbe scanline format");let M,T=0;for(;T<b&&_<p.byteLength;){M=p[_++];let A=M>128;if(A&&(M-=128),(M===0||T+M>b)&&t(3,"bad scanline data"),A){let R=p[_++];for(let N=0;N<M;N++)w[T++]=R}else w.set(p.subarray(_,_+M),T),T+=M,_+=M}let E=g;for(let A=0;A<E;A++){let R=0;v[y]=w[A+R],R+=g,v[y+1]=w[A+R],R+=g,v[y+2]=w[A+R],R+=g,v[y+3]=w[A+R],y+=4}S--}return v}(s.subarray(s.pos),h,d);switch(this.type){case Ht:l=c.length/4;let p=new Float32Array(4*l);for(let m=0;m<l;m++)r(c,4*m,p,4*m);a=p,o=Ht;break;case ni:l=c.length/4;let f=new Uint16Array(4*l);for(let m=0;m<l;m++)n(c,4*m,f,4*m);a=f,o=ni;break;default:throw new Error("THREE.HDRLoader: Unsupported type: "+this.type)}return{width:h,height:d,data:a,header:u.string,gamma:u.gamma,exposure:u.exposure,type:o,colorSpace:Sd,minFilter:nt,magFilter:nt,generateMipmaps:!1,flipY:!0}}setDataType(e){return this.type=e,this}}});function dte(e){return e.length>2&&e[0]===35&&e[1]===63}function IF(e){return typeof e=="object"&&e!==null&&e.isSplineHdr===!0}function I_e(e){let t=new Dr(e.data,e.width,e.height,mn,ni);return t.flipY=!1,t.image.isSplineHdr=!0,t.needsUpdate=!0,t}var cte,NX,Rc,O_e=V(()=>{le(),nOe()}),L_e=V(()=>{le(),D_e(),N_e(),O_e(),cte=0,NX=class extends A_e{constructor(e,t){super(e,t.imageHolderCache),this.data=e,this.shared=t,this.instanceId=++cte,this.loaded=!1,this.isVideo=!1,this.isBuffer=!1,this.isHdr=!1,this._cache={1e3:{},1001:{},1002:{}},this.isVideo=e.type==="video",this.isBuffer=e.isWebGLRenderTarget===!0,this.loadPromise=this.updateSrc(this.isBuffer?e:e.data)}async updateSrc(e){if(typeof document>"u")return;this.disposeTextures(),this.loaded=!1,this.isHdr=!1;let t=()=>{this.loaded=!0;for(let r of Object.values(this._cache))for(let n of Object.values(r))for(let s of Object.values(n))s&&(s.image=this.img,s.needsUpdate=!0);this.shared.requestRender()};if(this.isBuffer)this.img=e,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 e!="string"){let r,n=new FileReader;n.readAsDataURL(new Blob([e],{type:"video/mp4"})),await new Promise(s=>{n.onloadend=a=>{r=a.target?.result,s(null)}}),this.img.src=r}else this.img.src=e;this.img.onloadeddata=()=>{t()}}else if(e instanceof Uint8Array?dte(e):typeof e=="string"&&/\.hdr($|[?#])/i.test(e)){let r=e instanceof Uint8Array?e:null;if(r===null)try{r=new Uint8Array(await(await fetch(e)).arrayBuffer())}catch{r=null}let n=r!==null&&dte(r)?function(s){try{let a=new R_e().parse(s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength));if(!a||!a.width||!a.height)return null;let{width:o,height:l}=a,u=a.data,h=new Uint16Array(u.length),d=4*o,c=m=>bd.toHalfFloat(Math.pow(Math.max(bd.fromHalfFloat(m),0),1/2.2)),p=new Map,f=m=>{let g=p.get(m);return g===void 0&&(g=c(m),p.set(m,g)),g};for(let m=0;m<l;m++){let g=m*d,v=(l-1-m)*d;for(let y=0;y<d;y+=4)h[v+y]=f(u[g+y]),h[v+y+1]=f(u[g+y+1]),h[v+y+2]=f(u[g+y+2]),h[v+y+3]=u[g+y+3]}return{isSplineHdr:!0,data:h,width:o,height:l}}catch{return null}}(r):null;n!==null&&(this.isHdr=!0,this.img=n,t())}else this.img=new Image,this.img.src=typeof(i=e)=="string"?i:(xE||(xE=new E_e),xE.load(i)),this.img.onload=t,await new Promise(r=>{this.img.onload=()=>{t(),r(null)}});var i}getTexture(e,t=1008,i=1006){let r=this._cache[e]?.[t]?.[i];if(r)return r;{let n;return this.isBuffer?n=this.img.texture:this.isVideo?n=new V$(this.img,void 0,e,e):this.isHdr?(n=I_e(this.img),n.wrapS=e,n.wrapT=e,n.magFilter=i,n.minFilter=t):n=new Pi(this.img,void 0,e,e,i,t),this.isBuffer||(n.anisotropy=8,n.generateMipmaps=t===1008),this.loaded&&(n.needsUpdate=!0),this._cache[e]===void 0&&(this._cache[e]={}),this._cache[e][t]===void 0&&(this._cache[e][t]={}),this._cache[e][t][i]=n,n}}setNeedsUpdate(e){if(!this.isBuffer)for(let t of Object.values(this._cache))for(let i of Object.values(t))for(let r of Object.values(i))r&&(r.needsUpdate=e)}disposeTextures(){for(let[e,t]of Object.entries(this._cache))for(let[i,r]of Object.entries(t))for(let[n,s]of Object.entries(r))s?.dispose(),this._cache[e]!==void 0&&this._cache[e][i]!==void 0&&(this._cache[e][i][n]=void 0)}dispose(){super.dispose(),this.disposeTextures()}}}),F4=V(()=>{L_e(),Rc=class extends NX{}});function sOe(e){if(typeof e=="string")return e;let t=EH.get(e);return t||(t={url:URL.createObjectURL(new Blob([e]))},EH.set(e,t)),t.url}var EH,aOe=V(()=>{EH=new Map});function oOe(){if(!AH)return pte||(pte=async function(){await Promise.resolve().then(()=>(kK(),lCe)),B_e(window!==void 0?window:global),AH=!0}())}var B_e,U_e,AH,pte,F_e=V(()=>{U_e=new Promise(e=>{B_e=e}),AH=!1});function fte(e,t){e.forEach(i=>{"dragDropActions"in i.data?(t.push(...i.data.dragDropActions.drag),t.push(...i.data.dragDropActions.drop)):"inActions"in i.data?(t.push(...i.data.inActions),t.push(...i.data.outActions)):"gameActions"in i.data?(t.push(...i.data.gameActions.idle),t.push(...i.data.gameActions.move),t.push(...i.data.gameActions.jump),t.push(...i.data.gameActions.run)):"breakpoints"in i.data?i.data.breakpoints.forEach(r=>{t.push(...r.data.actions)}):"actions"in i.data&&(t.push(...i.data.actions),i.data.actions.forEach(r=>{r.data.type==="Conditional"&&r.data.ifActions&&(t.push(...r.data.ifActions),t.push(...r.data.elseActions))}))})}function lOe(e){let t=!1,i=[];return e.scene.objects.traverse((r,n)=>{if(n.type==="Page"&&n.uiScene!==void 0&&n.uiScene.objects.traverse((s,a)=>{if(a.events===void 0||Array.isArray(a.events)===!1)return!0;fte(a.events,i),t=t||i.some(o=>o.data.type==="Audio")}),n.events===void 0||Array.isArray(n.events)===!1)return!0;fte(n.events,i),t=t||i.some(s=>s.data.type==="Audio")}),t}var mte,rx,IX=V(()=>{aOe(),F_e(),U_e.then(e=>mte=e),rx=class{constructor({src:e,volume:t,delay:i,loop:r}){let n;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)},n=typeof e=="string"?{src:e}:{src:sOe(e),format:"wav"},this.sound=new mte.Howl(n),this.sound.on("end",this.onEnd),this.src=e,t!==void 0&&(this.volume=t),i!==void 0&&(this.delay=i),r!==void 0&&(this.loop=r)}get status(){return this._status}get volume(){return this._volume}set volume(e){this._volume=e,this.sound.volume(e)}get loop(){return this._loop}set loop(e){this._loop=e,this.loopsRemaining=e}replay(){this.clearDelay(),this.delayTimerId=window.setTimeout(()=>{this.sound.play(),this.clearDelay()},this.delay)}fade(e,t=1e3){e?(this.sound.volume(this._volume),this.clearFade(),this.fadeTimerId=window.setTimeout(()=>{this.sound.fade(this._volume,0,t),this.clearFade()},e)):this.sound.fade(this._volume,0,t)}on(e,t,i){this.sound.on(e,t,i)}off(e,t,i){this.sound.off(e,t,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(e=!1){this.off(),this.stop(),this.clearFade(),this.clearDelay()}}});function gte(e){let t=!1;return e.scene.objects.traverse((i,r)=>{r.type==="Mesh"&&(r.geometry.type==="TextGeometry"||r.geometry.type==="InputGeometry")&&(t=!0)}),t}var OX,LX=V(()=>{OX=null});function vte(e){return new J(e.y,-e.x)}var BX,CH,z_e,k_e,s3,yte,mL,V_e,OF,gL=V(()=>{le(),BX=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=e.parameters?.radiusTop,r=e.parameters?.radiusBottom,n=Object.assign({},t?.parameters??{width:100,radialSegments:64,heightSegments:1,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadius:8,cornerSegments:8,hollow:0},e.parameters);n.thetaLength=ht.clamp(n.thetaLength,0,360),n.hollow=ht.clamp(n.hollow??0,0,1);let s=n.width/2,a=n.radiusTop??s,o=n.radiusBottom??s;if(a===o?(a=s,o=s):a>o?(a=s,o=o*s/a):(a=a*s/o,o=s),n.shapeBlendNode){a=i??s,o=r??s;let l=2*Math.max(a,o);n.width=l,n.depth=l}return{parameters:Object.assign(n,{width:Math.abs(n.width),height:Math.abs(n.height??n.width),depth:Math.abs(n.depth??n.width),radiusTop:a,radiusBottom:o})}}static build(e){let t,{width:i,depth:r,height:n,radialSegments:s,heightSegments:a,openEnded:o,thetaStart:l,thetaLength:u,radiusTop:h,radiusBottom:d,cornerRadius:c,cornerSegments:p,hollow:f}=e.parameters;u===0?(t=new At,t.setAttribute("position",new Et([],3))):t=c||f?new CH(h,d,n,s,a,o,l,u*Math.PI/180,c,c,p,f):new uE(h,d,n,s,a,o,l,u*Math.PI/180);let m=r/i;return m!==1&&t.scale(1,1,m),Object.assign(t,{userData:{...e,type:"CylinderGeometry"}})}},CH=class extends At{constructor(e,t,i,r,n,s,a,o,l,u,h,d,c=!1){super(),this.type="RoundedCylinderBufferGeometry",e=e!==void 0?e:1,t=t!==void 0?t:1,i=i||1,r=Math.floor(r)||8,n=Math.floor(n)||1,s=s!==void 0&&s,a=a!==void 0?a:0,o=o!==void 0?o:2*Math.PI,s&&(l=0,u=0);let p=i/2;c&&e==0&&(e=l),c&&t==0&&(t=u);let f=new J(e,p),m=new J(t,-p),g=null,v=null,y=null,_=null,b=f.clone().sub(m),x=0,w=0,S=0;d>0&&(x=Math.min(e,t)*(1-d),w=e-x,S=t-x);let M=f.clone();M.x-=x;let T=Math.PI-b.angle(),E=b.angle(),A=Math.tan(E/2),R=Math.tan(T/2),N=A+R,D=d?N:R,O=d?N:A;if(l=Math.min(l,(e-w)/D,b.length()/N),u=Math.min(u,(t-S)/O,b.length()/N),l>0){let he=l/A;g=f.clone().sub(new J(he,l)),d&&(y=g.clone(),y.x-=x-N*l),f.sub(b.clone().setLength(he))}if(u>0){let he=u/R;v=m.clone().sub(new J(he,-u)),m.add(b.clone().setLength(he)),d&&(_=v.clone(),_.x-=x-N*u,M.sub(b.clone().setLength(he)))}b=f.clone().sub(m);let z=b.length()<.5,U=[],G=[],j=[],K=[],q=[],se=[],ve=(he,ce,Ee,Se,qe)=>{for(let Ne=0;Ne<h+1;Ne++){let He=Ne/h,Re=Se<0?He:1-He;qe&&(Re-=1),Re*=he;let ee=Math.sin(Re),Me=Math.cos(Re)*Se,We=Me*ce+Ee.y;U.push(ee*ce+Ee.x),G.push(We),j.push(ee),K.push(Me),q.push(.5+We/i),se.push(!1)}},oe=(he,ce,Ee)=>{let Se=[he,ce];Ee<0&&Se.reverse();for(let qe of Se)U.push(qe),G.push(p*Ee),j.push(0),K.push(Ee),q.push(.5),se.push(!0)};if(_&&v?(ve(T,u,_,-1,!0),ve(E,u,v,-1,!1)):v?(oe(v.x,0,-1),ve(E,u,v,-1,!1)):s||oe(t,S,-1),!z){let he=vte(b).normalize();for(let ce=0;ce<=n;ce++){let Ee=ce/n,Se=b.y*Ee+m.y;U.push(b.x*Ee+m.x),G.push(Se),j.push(he.x),K.push(he.y),q.push(.5+Se/i),se.push(!1)}}if(y&&g?(ve(T,l,g,1,!1),ve(E,l,y,1,!0)):g?(ve(T,l,g,1,!1),oe(g.x,0,1)):s||oe(e,w,1),d&&!z){let he=vte(b).multiplyScalar(-1).normalize();for(let ce=0;ce<=n;ce++){let Ee=ce/n,Se=b.y*-Ee+M.y;U.push(b.x*-Ee+M.x),G.push(Se),j.push(he.x),K.push(he.y),q.push(.5+Se/i),se.push(!1)}}let fe=U.length,_e=fe+(d&&!s?1:0),Z=(he,ce)=>he*fe+(ce===fe?0:ce),pe=o<2*Math.PI,H=(r+1)*fe+(pe?2*(1+_e):0),F=new Float32Array(3*H),X=new Float32Array(3*H),re=new Float32Array(2*H),k=H-1>65535?new Uint32Array(r*Math.max(0,_e-1)*6+(pe?2*(_e+1)*3:0)):new Uint16Array(r*Math.max(0,_e-1)*6+(pe?2*(_e+1)*3:0)),Q=0,te=0;for(let he=0;he<=r;he++){let ce=he/r,Ee=ce*o+a,Se=Math.sin(Ee),qe=Math.cos(Ee);for(let Ne=0;Ne<fe;Ne++){let He=3*te,Re=2*te,ee=U[Ne],Me=j[Ne];F[He]=ee*Se,F[He+1]=G[Ne],F[He+2]=ee*qe,X[He]=Me*Se,X[He+1]=K[Ne],X[He+2]=Me*qe,se[Ne]?(re[Re]=.5,re[Re+1]=.5):(re[Re]=ce,re[Re+1]=q[Ne]),te++}}for(let he=0;he<r;he++)for(let ce=0;ce<_e-1;ce++){if(s&&d&&ce==n)continue;let Ee=Z(he,ce),Se=Z(he+1,ce),qe=Z(he+1,ce+1),Ne=Z(he,ce+1),He=F[3*qe+0],Re=F[3*qe+2];k[Q++]=Ee,k[Q++]=Se,k[Q++]=Ne,(He!=0||Re!=0)&&(k[Q++]=Se,k[Q++]=qe,k[Q++]=Ne)}function W(he,ce,Ee){let Se=Math.sin(Ee),qe=Math.cos(Ee),Ne=-qe,He=Se,Re=he<0?(et,Yt,si)=>{k[Q++]=et,k[Q++]=Yt,k[Q++]=si}:(et,Yt,si)=>{k[Q++]=et,k[Q++]=si,k[Q++]=Yt},ee=(e+t+w+S)/4,Me=3*te,We=2*te;F[Me]=ee*Se,F[Me+1]=0,F[Me+2]=ee*qe,X[Me]=Ne,X[Me+1]=0,X[Me+2]=He,re[We]=.5,re[We+1]=.5;let dt=te++;for(let et=0;et<_e;et++){let Yt=3*(ce+(et===fe?0:et));Me=3*te,We=2*te,F[Me]=F[Yt],F[Me+1]=F[Yt+1],F[Me+2]=F[Yt+2],X[Me]=Ne,X[Me+1]=0,X[Me+2]=He;let si=Yt/3*2|0;re[We]=re[si],re[We+1]=re[si+1],te++}for(let et=dt+1;et<te-1;et++)Re(dt,et,et+1);Re(dt,te-1,dt+1)}pe&&(W(-1,0,a),W(1,r*fe,a+o)),this.setIndex(new It(k.slice(0,Q),1)),this.setAttribute("position",new It(F,3)),this.setAttribute("normal",new It(X,3)),this.setAttribute("uv",new It(re,2))}}}),_te=V(()=>{le(),gL(),z_e=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,radialSegments:32,heightSegments:8,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadiusTop:8,cornerRadiusBottom:8,cornerSegments:8},e.parameters);return i.thetaLength=ht.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(e){let t,{width:i,depth:r,height:n,radialSegments:s,heightSegments:a,openEnded:o,thetaStart:l,thetaLength:u,cornerRadiusTop:h,cornerRadiusBottom:d,cornerSegments:c}=e.parameters;u===0?(t=new At,t.setAttribute("position",new Et([],3))):t=h>0||d>0||u<360?new CH(0,i/2,n,s,a,o,l,u*Math.PI/180,h,d,c,0,!0):new BO(i/2,n,s,a,o);let p=r/i;return p!==1&&t.scale(1,1,p),Object.assign(t,{userData:{...e,type:"ConeGeometry"}})}}}),bte=V(()=>{le(),k_e=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,widthSegments:1,heightSegments:1,depthSegments:1,cornerRadius:8,cornerSegments:8},e.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(e){let t,{width:i,height:r,depth:n,widthSegments:s,heightSegments:a,depthSegments:o,cornerRadius:l,cornerSegments:u}=e.parameters;return t=l===0?new Ph(i,r,n,s,a,o):new yte(i,r,n,s,a,o,l,u),Object.assign(t,{userData:{...e,type:"CubeGeometry"}})}},s3=Math.PI/2,yte=class extends At{constructor(e=1,t=1,i=1,r=1,n=1,s=1,a=0,o=4){super(),this.type="BoxGeometry",r=Math.floor(r),n=Math.floor(n),s=Math.floor(s),o=Math.floor(o);let l=(a=Math.min(a,e/2,t/2,i/2))>0,u=o+1,h=2*((s+1)*(n+1)+(r+1)*(s+1)+(r+1)*(n+1))+(l?4*u*(s+1+(r+1)+(n+1))+u*(u+1)/2*8:0),d=2*(s*n+r*s+r*n)+(l?4*o*(s+r+n):0),c=l?8*o*o:0,p=new Float32Array(3*h),f=new Float32Array(3*h),m=new Float32Array(2*h),g=h-1>65535?new Uint32Array(6*d+3*c):new Uint16Array(6*d+3*c),v=0,y=0,_=new Float64Array(u),b=new Float64Array(u),x=new Float64Array(u),w=new Float64Array(u);for(let N=0;N<u;N++){let D=N/o*s3;_[N]=Math.sin(D)*a,b[N]=(1-Math.cos(D))*a,x[N]=Math.sin(D),w[N]=Math.cos(D)}let S=u*(u+1)/2,M=new Float64Array(3*S),T=new Float64Array(3*S);{let N=new P(e/2,t/2,i/2);N.subScalar(a);let D=0;for(let O=0;O<=o;O++){let z=s3*(1-O/o),U=Math.cos(z),G=Math.sin(z),j=0;for(let K=0;K<=O;K++){let q=U*Math.cos(j),se=G,ve=U*Math.sin(j);M[3*D]=q,M[3*D+1]=se,M[3*D+2]=ve,T[3*D]=N.x+q*a,T[3*D+1]=N.y+se*a,T[3*D+2]=N.z+ve*a,D++,j+=s3/O}}}function E(N,D,O,z,U,G,j,K,q,se){let ve=(G-2*a)/q,oe=(j-2*a)/se,fe=G/2-a,_e=j/2-a,Z=K/2,pe=q+1,H=se+1,F=0,X=new P;for(let re=0;re<H;re++){let k=re*oe-_e;for(let Q=0;Q<pe;Q++){let te=Q*ve-fe,W=3*(v+F),he=2*(v+F);X[N]=te*z,X[D]=k*U,X[O]=Z,p[W]=X.x,p[W+1]=X.y,p[W+2]=X.z,X[N]=0,X[D]=0,X[O]=K>0?1:-1,f[W]=X.x,f[W+1]=X.y,f[W+2]=X.z,m[he]=Q/q,m[he+1]=1-re/se,F+=1}}for(let re=0;re<se;re++)for(let k=0;k<q;k++){let Q=v+k+pe*re,te=v+k+pe*(re+1),W=v+(k+1)+pe*(re+1),he=v+(k+1)+pe*re;g[y++]=Q,g[y++]=te,g[y++]=he,g[y++]=te,g[y++]=W,g[y++]=he}v+=F}function A(N,D,O,z,U,G,j,K,q,se){let ve=(j-2*a)/se,oe=j/2-a,fe=K/2-a,_e=q/2,Z=se+1,pe=0,H=new P,F=new P;for(let X=0;X<o+1;X++){H[D]=(fe+_[X])*U,H[O]=(_e-b[X])*G,F[N]=0,F[D]=x[X]*Math.sign(H[D]),F[O]=w[X]*Math.sign(H[O]);for(let re=0;re<Z;re++){let k=re*ve-oe;H[N]=k*z;let Q=3*(v+pe),te=2*(v+pe);p[Q]=H.x,p[Q+1]=H.y,p[Q+2]=H.z,f[Q]=F.x,f[Q+1]=F.y,f[Q+2]=F.z,m[te]=re/se,m[te+1]=0,pe+=1}}for(let X=0;X<o;X++)for(let re=0;re<se;re++){let k=v+re+Z*X,Q=v+re+Z*(X+1),te=v+(re+1)+Z*(X+1),W=v+(re+1)+Z*X;g[y++]=k,g[y++]=Q,g[y++]=W,g[y++]=Q,g[y++]=te,g[y++]=W}v+=pe}function R(N,D,O){let z=N*D*O>0?(G,j,K)=>{g[y++]=G,g[y++]=j,g[y++]=K}:(G,j,K)=>{g[y++]=G,g[y++]=K,g[y++]=j},U=v;for(let G=0;G<S;G++){let j=3*G,K=3*v,q=2*v;p[K]=N*T[j],p[K+1]=D*T[j+1],p[K+2]=O*T[j+2],f[K]=N*M[j],f[K+1]=D*M[j+1],f[K+2]=O*M[j+2],m[q]=0,m[q+1]=0,v++}for(let G=0;G<o;G++){let j=U+G*(G+1)/2,K=U+(G+1)*(G+2)/2;z(j,K+1,K);for(let q=1;q<=G;q++)z(j+q-1,j+q,K+q),z(j+q,K+q+1,K+q)}}E("z","y","x",-1,-1,i,t,e,s,n),E("z","y","x",1,-1,i,t,-e,s,n),E("x","z","y",1,1,e,i,t,r,s),E("x","z","y",1,-1,e,i,-t,r,s),E("x","y","z",1,-1,e,t,i,r,n),E("x","y","z",-1,-1,e,t,-i,r,n),a>0&&(A("z","y","x",-1,-1,1,i,t,e,s),A("z","y","x",1,-1,-1,i,t,e,s),A("z","y","x",-1,1,-1,i,t,e,s),A("z","y","x",1,1,1,i,t,e,s),A("x","y","z",-1,-1,-1,e,t,i,r),A("x","y","z",1,-1,1,e,t,i,r),A("x","y","z",-1,1,1,e,t,i,r),A("x","y","z",1,1,-1,e,t,i,r),A("y","x","z",-1,-1,1,t,e,i,n),A("y","x","z",1,-1,-1,t,e,i,n),A("y","x","z",1,1,1,t,e,i,n),A("y","x","z",-1,1,-1,t,e,i,n),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 It(g,1)),this.setAttribute("position",new It(p,3)),this.setAttribute("normal",new It(f,3)),this.setAttribute("uv",new It(m,2))}}}),G_e=V(()=>{le(),mL=class extends At{constructor(e=[],t=[],i="",r=1,n=.2,s=4){super(),this.type="PolyhedronGeometryRound";let a,o,l,u=0;return function(){(n=Math.min(.99999,n))==0&&(s=0);let h={IcosahedronGeometry:5,DodecahedronGeometry:3,HexahedronGeometry:3,OctahedronGeometry:4,TetrahedronGeometry:3}[i],d=new P,c=d.clone(),p=new Ls,f=n*r,m=r-f,g=s+1,v=new P,y=(Z,pe)=>v.subVectors(Z,pe).normalize(),_=(Z,pe)=>Array(Z).fill(void 0).map(pe),b=_(e.length/3,(Z,pe)=>new P().fromArray(e,3*pe).setLength(r)),x=[],w=1e6;for(let Z=0;Z<b.length;Z++){let pe,H,F,X=b[Z],re=[],k=1e10,Q=-1;for(;(Q=t.indexOf(Z,Q+1))!=-1;){let ce=Q-Q%3;pe=t[ce+(Q+1)%3],H=t[ce+(Q+2)%3],F=X.distanceToSquared(b[pe]),k=Math.min(k,F),re.push([pe,H,F])}k+=1e-6;let te=[],W=0,he=re.length;for(let ce=0;ce<he;ce++){[pe,H,F]=re[W];let Ee=x[pe]?.includes(Z)==1;F<=k&&te.push(pe+ +Ee*w),W=re.findIndex(Se=>Se[0]==H)}x.push(te)}let S=[];{let Z,pe,H=0,F=0,X=h==3;for(let re=0;re<=s;re++){Z=re*(re+1)/2,pe=(re+1)*(re+2)/2;for(let k=0;k<s-re;k++)[H,F]=[Z+k+re+2,pe+k+re+3],S.push(Z,pe,...X?[F,Z]:[H,pe],F,H),[Z,pe]=[H,F];S.push(Z,pe,Z+s+2)}}let M=0;for(let Z=0;Z<x.length;Z++)for(let pe=0;pe<h;pe++)x[Z][pe]<w&&M++;let T=b.length*h*S.length*3+M*g*6*3+2*M*3*3;a=new Float64Array(T),o=new Float64Array(T),l=new Float64Array(T/3*2);let E=(Z,pe,H)=>{let F=u/3*2;l[F]=Math.atan2(H,-Z)/2/Math.PI+.5,l[F+1]=1-(Math.atan2(-pe,Math.sqrt(Z*Z+H*H))/Math.PI+.5)},A=Z=>{a[u]=Z.x,a[u+1]=Z.y,a[u+2]=Z.z,o[u]=v.x,o[u+1]=v.y,o[u+2]=v.z,E(Z.x,Z.y,Z.z),u+=3},R=Z=>{a[u]=Z[0].x,a[u+1]=Z[0].y,a[u+2]=Z[0].z,o[u]=Z[1].x,o[u+1]=Z[1].y,o[u+2]=Z[1].z,E(Z[0].x,Z[0].y,Z[0].z),u+=3},N=(s+2)*(s+3)/2,D=new Float64Array(3*N),O=new Float64Array(3*N),z=new Float64Array(2*N),U=_(2*h*g,()=>new P),G=_(s*Math.max(0,s-1)/2,()=>new P),j=d.clone(),K=d.clone(),q=d.clone(),se=d.clone(),ve=d.clone(),oe=[],fe=_(b.length,()=>_(h,()=>d.clone()));for(let Z=0;Z<b.length;Z++){d.copy(b[Z]).normalize(),j.copy(d).multiplyScalar(m);let pe=x[Z];for(let te=0;te<pe.length;te++){let W=pe[te],he=pe[(te+1)%h];p.setFromPointsAndIndices(b,Z,W%w,he%w),p.b.sub(p.a).setLength(1e10).add(p.a),p.c.sub(p.a).setLength(1e10).add(p.a),p.closestPointToPoint(j,fe[Z][te])}let H=0,F=[],X=[],re=new P;s==0&&[...fe[Z]].reduce((te,W)=>te.add(W),re).multiplyScalar(1/h);for(let te=0;te<h;te++){let W=[],he=(te-1+h)%h,ce=fe[Z][he],Ee=fe[Z][te];d.copy(ce).sub(j),c.copy(Ee).sub(j);let Se=j.angleTo(d),qe=d.angleTo(c),Ne=Math.cos(Se)*f;s==0?K.copy(re):K.copy(j).setLength(m+Ne),F.push(Ne);let He=[K,ce,Ee];for(let Re=0;Re<2;Re++){let ee=He[Re],Me=He[Re+1];se.subVectors(ee,j),ve.subVectors(Me,j),q.crossVectors(se,ve).normalize();for(let We=0;We<g;We++){let dt=[Se,qe][Re]*We/g;d.copy(se).applyAxisAngle(q,dt).add(j),U[H++].copy(d),Re&&(y(d,j),W.push([We==0?ee:d.clone(),v.clone()]))}Re&&(y(Me,j),W.push([Me,v.clone()]))}X.push(W)}oe.push(X);let k=2*g,Q=2;for(let te=0;te<h;te++){let W=k*te,he=k*((te+1)%h),ce=0,Ee=[U[W]];for(let Se=1;Se<g;Se++){let qe=U[W+Se],Ne=U[he+Se];Ee.push(qe);for(let He=1,Re=Se-Q+1;He<=Re;He++)d.lerpVectors(qe,Ne,He/(Re+1)),d.sub(j).setLength(F[te]).add(j),Ee.push(G[ce++].copy(d));Ee.push(Ne)}for(let Se=0;Se<g;Se++)Ee.push(U[Se+g+W]);Ee.push(U[he+g]);for(let Se=0,qe=Ee.length;Se<qe;Se++){let Ne=Ee[Se],He=3*Se,Re=2*Se;D[He]=Ne.x,D[He+1]=Ne.y,D[He+2]=Ne.z,y(Ne,j),O[He]=v.x,O[He+1]=v.y,O[He+2]=v.z,z[Re]=Math.atan2(Ne.z,-Ne.x)/2/Math.PI+.5,z[Re+1]=1-(Math.atan2(-Ne.y,Math.sqrt(Ne.x*Ne.x+Ne.z*Ne.z))/Math.PI+.5)}for(let Se=0,qe=S.length;Se<qe;Se++){let Ne=3*S[Se],He=2*S[Se],Re=u/3*2;a[u]=D[Ne],a[u+1]=D[Ne+1],a[u+2]=D[Ne+2],o[u]=O[Ne],o[u+1]=O[Ne+1],o[u+2]=O[Ne+2],l[Re]=z[He],l[Re+1]=z[He+1],u+=3}}}let _e=[];for(let Z=0;Z<x.length;Z++)for(let pe=0;pe<h;pe++){let H=x[Z][pe];if(H<w){let F=x[H].findIndex(k=>k%w==Z),X=oe[Z][pe],re=oe[H][F];for(let k=0;k<g;k++){let Q=X[k],te=re[g-k],W=X[k+1],he=re[g-(k+1)];R(Q),R(te),R(W),R(W),R(te),R(he)}_e.push(X[0][0],re[g][0],X[g][0],re[0][0])}}for(;_e.length;){let Z,pe,H,[F,X]=_e.splice(0,2);Z=X;let re=[F];for(;F!=Z;)re.push(Z),pe=_e.indexOf(Z),H=pe%2,Z=_e.splice(pe-H,2)[1-H];v.subVectors(re[0],re[1]).cross(d.subVectors(re[0],re[2])).normalize();let k=v.dot(re[0])<0;k&&v.negate();for(let Q=1;Q<=re.length-2;Q++)A(re[Q+ +k]),A(re[Q+1-+k]),A(re[0])}}(),function(){let h=new P,d=new P,c=new P,p=new P,f=new J,m=new J,g=new J,v=(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<u;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]),c.set(a[b+6],a[b+7],a[b+8]),f.set(l[x+0],l[x+1]),m.set(l[x+2],l[x+3]),g.set(l[x+4],l[x+5]),p.copy(h).add(d).add(c).divideScalar(3);let w=_(p);v(f,x+0,h,w),v(m,x+2,d,w),v(g,x+4,c,w)}let y=u/3*2;for(let b=0;b<y;b+=6){let x=l[b+0],w=l[b+2],S=l[b+4],M=Math.max(x,w,S),T=Math.min(x,w,S);M>.9&&T<.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 It(new Float32Array(a.subarray(0,u)),3)),this.setAttribute("normal",new It(new Float32Array(o.subarray(0,u)),3)),void this.setAttribute("uv",new It(new Float32Array(l.subarray(0,u/3*2)),2))}static fromJSON(e){return new mL(e.vertices,e.indices,e.radius,e.corner,e.cornerSides)}}}),xte=V(()=>{G_e(),le(),V_e=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,detail:0,corner:0,cornerSides:4},e.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(e){let{width:t,height:i,depth:r,detail:n,corner:s,cornerSides:a}=e.parameters,o=n===0&&s!==0?new OF(.5*t,s,a):new l7(.5*t,n),l=i/t,u=r/t;return(l!==1||u!==1)&&o.scale(1,l,u),Object.assign(o,{userData:{...e,type:"DodecahedronGeometry"}})}},OF=class extends mL{constructor(e=1,t=.2,i=4){let r=(1+Math.sqrt(5))/2,n=1/r,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,-n,-r,0,-n,r,0,n,-r,0,n,r,-n,-r,0,-n,r,0,n,-r,0,n,r,0,-r,0,-n,r,0,-n,-r,0,n,r,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],s,e,t,i),this.type=s}static fromJSON(e){return new OF(e.radius,e.corner,e.cornerSides)}}});function wte(e,t=new J){let i=e.length();return t.set(-e.y/i,e.x/i)}function hOe(e){let t=new J;t.addVectors(e.v0,ty.subVectors(e.v1,e.v0).multiplyScalar(2/3));let i=new J;return i.addVectors(e.v2,gA.subVectors(e.v1,e.v2).multiplyScalar(2/3)),new pu(e.v0,t,i,e.v2)}function CM(e,t,i=Number.EPSILON){return Math.abs(e-t)<i}function uOe(e,t,i=Number.EPSILON){return e.distanceTo(t)<i}function dOe(e,t,i=Number.EPSILON){return e.distanceTo(t)<i}function j_e(e,t,i){let r=Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)),n=Math.sqrt(Math.pow(t.x-i.x,2)+Math.pow(t.y-i.y,2)),s=Math.sqrt(Math.pow(i.x-e.x,2)+Math.pow(i.y-e.y,2));return Math.acos((n*n+r*r-s*s)/(2*n*r))}function cOe(e,t,i){return Tte(e,t)&&Tte(t,i)&&RH(e.position,t.position,i.position)}function RH(e,t,i){return ty.copy(t).sub(e).cross(gA.copy(i).sub(e))===0}function pOe(e,t,i,r,n){let s=Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)),a=(e.y+t.y)/2,o=(e.x+t.x)/2,l=Math.sqrt(Math.pow(i,2)-Math.pow(s/2,2))*(e.y-t.y)/s,u=Math.sqrt(Math.pow(i,2)-Math.pow(s/2,2))*(t.x-e.x)/s;return r.set(o+l,a+u),n.set(o-l,a-u),[r,n]}function fOe(e,t,i){return e.distanceTo(i)<t.distanceTo(i)?t:e}function mOe(e,t,i,r,n,s){let a,o=t.x-e.x,l=t.y-e.y,u=i.x-e.x,h=i.y-e.y,d=Math.sqrt((o+u)*(o+u)+(l+h)*(l+h));return j_e(t,e,i)>Math.PI&&(d*=-1),a=CM(h,l)?(l+h)*(r/d-.5)*8/3/(o-u):(o+u)*(r/d-.5)*8/3/(h-l),n.set(t.x-a*l,t.y+a*o),s.set(i.x+a*h,i.y-a*u),[n,s]}function Ste(e,t){return e.position.equals(e.controls[1].position)&&t.position.equals(t.controls[0].position)}function Tte(e,t){return RH(e.position,e.controls[1].position,t.position)&&RH(e.position,t.controls[0].position,t.position)}function Mte(e,t=12,i=!1){let r=[];for(let n=0,s=e.length;n<s;n++){let a=e[n],o=0;if(i&&a.roundedCurveCorner!==void 0){let l=.5*ey(a.roundedCurveCorner,t);n>0&&(r[n-1]+=l),o+=l}a.curveAfter!==void 0&&(o+=ey(a.curveAfter,t)),r.push(o)}return e.length>0&&i&&e[0].roundedCurveCorner!==void 0&&(r[e.length-1]+=.5*ey(e[0].roundedCurveCorner,t)),r}function ey(e,t=12){return e&&e instanceof mM?2*t:e&&(e instanceof wh||e instanceof h7)?1:e&&e instanceof eI?t*e.points.length:t}var Ob,a3,o3,gy,fI,ty,gA,H_e,W_e,q_e,$_e,PH,DH,l3,Ete,Ate,Cte,Rte,Pte,hs,X_e=V(()=>{le(),Ob=1e-12,a3=class{constructor(e){this.position=new J,this.startPosition=new J,this.uuid=ht.generateUUID(),this.position=e.clone()}start(){this.reset()}reset(){this.startPosition.copy(this.position)}applyOffset(e){this.position.copy(this.startPosition).add(e)}copy(e){return this.position.copy(e.position),this.startPosition.copy(e.startPosition),this}clone(){return new a3(this.position).copy(this)}toJSON(){return[this.position.x,this.position.y]}},o3=class extends a3{constructor(e){super(e.position),this.parent=e}copy(e){return super.copy(e),this}clone(){return new o3(this.parent).copy(this)}},gy=class extends a3{constructor(e,t){super(t),this.controls=[],this.roundness=0,this.areControlsDirectionsMirrored=!0,this.uuid=e,this.controls.push(new o3(this),new o3(this))}static create(e,t){let i=new gy(e,new J(...t.position));return i.controls[0].position.set(...t.controlPrevious.position),i.controls[1].position.set(...t.controlNext.position),i.roundness=t.roundness,i.areControlsDirectionsMirrored=t.areControlsDirectionsMirrored,i}getOppositeControl(e){let t=this.controls.indexOf(e);return t===0?this.controls[1]:t===1?this.controls[0]:null}applyOffsetToControls(e,t=1){for(let i=0,r=this.controls.length;i<r;i++){let n=this.controls[i];this.position.distanceTo(n.position)<=t?n.position.copy(this.position):n.applyOffset(e)}}controlsMoved(){return!(this.position.equals(this.controls[0].position)&&this.position.equals(this.controls[1].position))}copy(e){return super.copy(e),this.controls[0].copy(e.controls[0]),this.controls[1].copy(e.controls[1]),this.roundness=e.roundness,this.uuid=e.uuid,this}clone(){return new gy(this.uuid,this.position).copy(this)}toJSON(){return super.toJSON().concat(this.controls[0].toJSON(),this.controls[1].toJSON(),[this.roundness])}computeTangents(){let e=this.curveBefore?.getTangentAt(1),t=this.curveAfter?.getTangentAt(0);return[e,t]}computeNormals(e=new J,t=new J){let[i,r]=this.computeTangents();return i&&r&&(wte(i,e),wte(r,t)),[e,t]}computeTangent(e=new J){let[t,i]=this.computeTangents();return t&&i&&e.copy(t).add(i).normalize(),e}computeNormal(e=new J){let[t,i]=this.computeNormals();return e.copy(t).add(i).normalize(),e}},fI=e=>e,ty=new J,gA=new J,H_e=new J,W_e=new J,q_e=new J,$_e=new J,PH=new P,DH=new P}),Kg=V(()=>{le(),X_e(),l3=new J,Ete=new J,Ate=new J,Cte=new J,Rte=new J,Pte=new J,hs=class extends ZE{constructor(e=100,t=100){super(),this.points=[],this.shapeHoles=[],this.plane=new $a(new P(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=ht.generateUUID(),this.needsUpdate=!1,this.roundedCurves=[],this._width=e,this._height=t}static createFromState(e,t,i){let r=new hs;return r.isClosed=e.isClosed,r.points=e.points.map(n=>gy.create(n.id,n.data)),typeof e.roundness=="number"&&(r.roundness=e.roundness),r.shapeHoles=e.shapeHoles.map(n=>hs.createFromState(n)),t!==void 0&&i!==void 0&&r.applySize(t,i),r.update(),r}get width(){return this._width}get height(){return this._height}get roundness(){return this._roundness}set roundness(e){if(this._roundness!==e){this._roundness=e;for(let t=0,i=this.points.length;t<i;t++)this.points[t].roundness=e;this.needsUpdate=!0}}getPointsIndexesByIds(e){return e.map(t=>this.getPointIndexById(t)).filter(t=>t>=0)}getPointIndexById(e){let t=this.points.length,i=this.points.findIndex(r=>r.uuid===e);if(i<0){let r=t;for(let n=0,s=this.shapeHoles.length;n<s;n++){let a=this.shapeHoles[n],o=a.points.length,l=a.getPointIndexById(e);if(!(l<0))return l+r;r+=o}}return i}getLineIndexById(e){return this.getPointIndexById(e)}getBezierPoint(e){if(e<=this.points.length-1)return this.points[e];if(this.shapeHoles.length>0){let t=this.points.length;for(let i=0,r=this.shapeHoles.length;i<r;i++){let n=this.shapeHoles[i],s=e-t;if(s<=n.points.length-1)return n.points[s];t+=n.points.length}}throw new Error("This shape does not have a point for this index: "+e)}getBezierPointIndex(e){let t=this.points.indexOf(e);if(t>=0)return t;if(t=this.points.length,this.shapeHoles.length>0)for(let i=0,r=this.shapeHoles.length;i<r;i++){let n=this.shapeHoles[i],s=n.points.indexOf(e);if(s>=0)return t+s;t+=n.points.length}return-1}getAllPoints(){let e=[].concat(...this.shapeHoles.map(t=>t.points));return[...this.points,...e]}applySize(e,t){e===0&&(e=.001),t===0&&(t=.001),this._width=e,this._height=t}applyScale(e,t){let i=l3.set(e,t);for(let r=0,n=this.points.length;r<n;r++){let s=this.points[r];s.position.multiply(i),s.controls[0].position.multiply(i),s.controls[1].position.multiply(i)}for(let r=0,n=this.shapeHoles.length;r<n;r++)this.shapeHoles[r].applyScale(e,t);this._update()}createPoint(e,t=0,i=ht.generateUUID()){let r;r=e instanceof J?e:new J(e,t);let n=new gy(i,r);return n.roundness=this.roundness,n}addPoint(e){this.points.push(e),this.needsUpdate=!0}addPointAt(e,t){this.points.splice(t,0,e),this.needsUpdate=!0}getPointByUuid(e){for(let t=0,i=this.points.length;t<i;t++){let r=this.points[t];if(r.uuid===e)return r}for(let t=0,i=this.shapeHoles.length;t<i;t++){let r=this.shapeHoles[t].getPointByUuid(e);if(r)return r}}getFirstPoint(){return this.points[0]}getLastPoint(){return this.points[this.points.length-1]}removePoint(e){let t=this.points.indexOf(e);t>=0&&this.points.splice(t,1),this.needsUpdate=!0}removePointById(e){let t=this.points.find(i=>i.uuid===e);t&&this.removePoint(t)}update(){for(let e=0,t=this.shapeHoles.length;e<t;e++)this.shapeHoles[e].update();this._update()}extractShapePointsToBuffer(e,t=12,i=!1){this.subdivision=t,this.curveDivisions===void 0&&this.computeCurveDivisions(t);let r=i?this.roundedCurveDivisions:this.curveDivisions;return function(n,s,a=12,o=!0){let l,u=DH.set(0,0,0),h=0,d=[];for(let c=0;c<s.length;c++){let p=fI(s[c]),f=ty,m=ey(p,a);d.push(m);for(let g=0;g<=m;g++)if(p instanceof pu||p instanceof of||p instanceof wh){if(p.getPoint(g/m,f),u.set(f.x,f.y,0),l!==void 0&&dOe(l,u))continue;l===void 0&&(l=PH),l.copy(u),n.setXYZ(h,u.x,u.y,u.z),h++}}o&&h>1&&(n.getX(h-1)!==n.getX(0)||n.getY(h-1)!==n.getY(0)||n.getZ(h-1)!==n.getZ(0))&&(n.setXYZ(h,n.getX(0),n.getY(0),n.getZ(0)),h++)}(e,i?this.roundedCurves:this.curves,t,this.autoClose),r.reduce((n,s)=>n+s,0)+1}computeCurveDivisions(e=12){return this.curveDivisions=Mte(this.points,e,!1),this.roundedCurveDivisions=Mte(this.points,e,!0),this.curveDivisions}extractFilteredShapePointsToBuffer(e,t,i=12){return 2*function(r,n,s,a=12,o=!0){let l=DH.set(0,0,0),u=0,h=[];for(let d=0;d<n.length;d++){if(s[d]===!1)continue;let c,p=fI(n[d]),f=ty,m=ey(p,a);h.push(m);for(let g=0;g<=m;g++)if(p instanceof pu||p instanceof of||p instanceof wh){if(p.getPoint(g/m,f),l.set(f.x,f.y,0),c?.equals(l))continue;c===void 0?c=PH:(r.setXYZ(u,c.x,c.y,c.z),u++,r.setXYZ(u,l.x,l.y,l.z),u++),c.copy(l)}}return o&&u>1&&!(r.getX(u-1)===r.getX(0)&&r.getY(u-1)===r.getY(0)&&r.getZ(u-1)===r.getZ(0))&&(r.setXYZ(u,r.getX(0),r.getY(0),r.getZ(0)),u++),h}(e,this.curves,t,i,this.autoClose).reduce((r,n)=>r+n,0)}extractShapePointsToFlatArray(e,t=12){return this.subdivision=t,this.curveDivisions===void 0&&this.computeCurveDivisions(t),function(i,r,n=12,s=!0){let a,o=0;for(let l=0;l<r.length;l++){let u=fI(r[l]),h=ey(u,n),d=ty;for(let c=0;c<=h;c++)if(u instanceof pu||u instanceof of||u instanceof wh){if(u.getPoint(c/h,d),a!==void 0&&uOe(a,d,Ob))continue;a===void 0&&(a=gA),a.copy(d),i.push(d.x,d.y),o++}}return CM(i[0],i[i.length-2],Ob)&&CM(i[1],i[i.length-1],Ob)&&(i.pop(),i.pop()),s&&o>1&&!(CM(i[o-1],i[1],Ob)&&CM(i[o-2],i[0],Ob))&&(i.push(i[0],i[1]),o++),i}(e,this.roundedCurves,t,this.autoClose)}getCurveIndexFromVertexId(e,t=!1){let i=0;this.curveDivisions===void 0&&this.computeCurveDivisions(this.subdivision);let r=t?this.roundedCurveDivisions:this.curveDivisions,n=0;t&&this.points[0].roundedCurveCorner!==void 0&&(n=.5*ey(this.points[0].roundedCurveCorner,this.subdivision));let s=e-n;s<0&&(s+=r.reduce((a,o)=>a+o,0));for(let a=0,o=r.length;a<o;a++){let l=r[a];if(s<i+l)return[a,(s-i+1)/l];i+=l}return[0,1]}getCurveT(e,t,i){let r=this.points[e],n=this.points[e>=this.points.length-1?0:e+1],s=this.curveDivisions,a=s[e];if(Ste(r,n)){let l=r.position.distanceTo(n.position);return r.position.distanceTo(l3.set(i.x,i.y))/l}let o=0;for(let l=0;l<e;l++)o+=s[l];return(t-o)/a}dispose(){}_applyCurveForPoint(e,t){Ste(t,e)?this.lineTo(e.position.x,e.position.y):this.bezierCurveTo(t.controls[1].position.x,t.controls[1].position.y,e.controls[0].position.x,e.controls[0].position.y,e.position.x,e.position.y);let i=this.curves[this.curves.length-1];e.curveBefore=i,t.curveAfter=i;let r=i.clone();e.roundedCurveBefore=r,t.roundedCurveAfter=r,e.roundedCurveCorner=void 0,this.roundedCurves.push(r)}_update(){if(this.curves=[],this.roundedCurves=[],!this.points.length)return;for(let t=0,i=this.points.length;t<i;t++){let r=this.points[t];if(t===0)this.moveTo(r.position.x,r.position.y);else{let n=this.points[t-1];this._applyCurveForPoint(r,n)}}let e=this.getLastPoint();if(e?.curveAfter&&(e.curveAfter=void 0),this.isClosed){let t=this.points[0],i=this.points[this.points.length-1];this._applyCurveForPoint(t,i)}if(this.points.length>2){let t=0;for(let i=0,r=this.points.length;i<r;i++){let n=this.points[i],s=this.points[i-1]??this.points[this.points.length-1],a=this.points[i+1]??this.points[0],o=n.roundness,l=s&&a&&cOe(s,n,a);if(!n.controlsMoved()&&o>0&&!l){let u=n.curveBefore,h=n.curveAfter;if(u===void 0||h===void 0)continue;let d,c=n.roundedCurveBefore,p=n.roundedCurveAfter,f=u instanceof wh?u.v1.distanceTo(u.v2):u.getLength(),m=h instanceof wh?h.v1.distanceTo(h.v2):h.getLength(),g=Math.min(o,.499*f),v=Math.min(o,.499*m),y=Math.min(g,v),_=1-y/f,b=y/m,x=u.getPointAt(_,l3),w=h.getPointAt(b,Ete);if(this._subSplitCurve(u,c,_,x,void 0),this._subSplitCurve(h,p,b,void 0,w),this.useCubicForRoundedCorners){let S=j_e(x,n.position,w)/2,M=Math.tan(S)*x.distanceTo(n.position),[T,E]=pOe(x,w,M,Ate,Cte),A=fOe(T,E,n.position),[R,N]=mOe(A,x,w,M,Rte,Pte);d=new pu(x.clone(),R.clone(),N.clone(),w.clone())}else d=new of(x.clone(),n.position.clone(),w.clone());n.roundedCurveCorner=d,this.roundedCurves.splice(i+t,0,d),t++}}}}_subSplitCurve(e,t,i,r,n){if(!(e instanceof wh)){let s=e,a=t,o=s.getUtoTmapping(i,0),l=function(u,h,d,c,p=.5){let f=ty.subVectors(h,u).multiplyScalar(p).add(u),m=gA.subVectors(d,h).multiplyScalar(p).add(h),g=H_e.subVectors(c,d).multiplyScalar(p).add(d),v=f,y=W_e.subVectors(m,f).multiplyScalar(p).add(f),_=q_e.subVectors(g,m).multiplyScalar(p).add(m),b=g,x=$_e.subVectors(_,y).multiplyScalar(p).add(y);return[u.x,u.y,v.x,v.y,y.x,y.y,x.x,x.y,_.x,_.y,b.x,b.y,c.x,c.y]}(s.v0,s.v1,s.v2,s.v3,o);return r!==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])),n!==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 r!==void 0&&t.v2.copy(r),n!==void 0&&t.v1.copy(n),t}clone(){let e=new hs(this._width,this._height);return e.points=this.points.map(t=>t.clone()),e.isClosed=this.isClosed,e.roundness=this.roundness,e.isMesh2D=this.isMesh2D,e.shapeHoles=this.shapeHoles.map(t=>t.clone()),e}toJSON(){return{points:this.points.reduce((e,t)=>e.concat(t.toJSON()),[]),shapeHoles:this.shapeHoles.map(e=>e.toJSON()),isClosed:this.isClosed,roundness:this.roundness}}fromJSON(e){this.points=[],this.pointIDs=0;let t=e.points.length/7;for(let i=0;i<t;i++){let r=7*i,n=e.points[r+0],s=e.points[r+1],a=e.points[r+2],o=e.points[r+3],l=e.points[r+4],u=e.points[r+5],h=e.points[r+6],d=new gy(ht.generateUUID(),new J(n,s));d.controls[0].position.set(a,o),d.controls[1].position.set(l,u),d.roundness=h,this.points.push(d)}return this.shapeHoles=e.shapeHoles?.length?e.shapeHoles.map(i=>{let r=new hs;return r.fromJSON(i),r}):[],this.isClosed=e.isClosed,this._roundness=e.roundness,this._update(),this}fromShape(e,t=!1){this.isText=t;let i=(r,n)=>{n instanceof pu&&n.v3.equals(r.position)&&r.controls[0].position.copy(n.v2)};return this.points=(r=>{let n,s,a=[];for(n=0,s=r.length;n<s;n++)r[n]instanceof of&&(r[n]=hOe(r[n]));for(n=0,s=r.length;n<s;n++){let u,h=r[n],d=n>0?r[n-1]:null;h instanceof pu?(u=this.createPoint(h.v0),u.controls[1].position.copy(h.v1)):h instanceof wh&&(u=this.createPoint(h.v1)),u!==void 0&&(d!==null&&i(u,d),a.push(u))}let o=r[r.length-1],l=!1;return o instanceof pu?o.v3.equals(a[0].position)&&(a[0].controls[0].position.copy(o.v2),l=!0):o instanceof wh&&o.v2.equals(a[0].position)&&(l=!0),this.isClosed=l,a})(e.curves),e instanceof ZE&&(this.shapeHoles=e.holes.map(r=>{let n=new hs;return n.fromShape(r),n})),this.update(),this}updatePoint(e,t){let i=this.getPointByUuid(e);i&&(t.position!==void 0&&i.position.fromArray(t.position),t.roundness!==void 0&&(i.roundness=t.roundness),t.areControlsDirectionsMirrored!==void 0&&(i.areControlsDirectionsMirrored=t.areControlsDirectionsMirrored),this.needsUpdate=!0)}updatePreviousControl(e,t){let i=this.getPointByUuid(e)?.controls[0];i&&(t.position&&i.position.fromArray(t.position),this.needsUpdate=!0)}updateNextControl(e,t){let i=this.getPointByUuid(e)?.controls[1];i&&(t.position&&i.position.fromArray(t.position),this.needsUpdate=!0)}}});function LF({x:e,y:t},i,r,n,s){return{x:e*i+n,y:t*r+s}}function gOe(e,t){let i=t===1.5707963267948966?.551915024494:t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),r=Math.cos(e),n=Math.sin(e),s=Math.cos(e+t),a=Math.sin(e+t);return[{x:r-n*i,y:n+r*i},{x:s+a*i,y:a-s*i},{x:s,y:a}]}function Dte(e,t,i,r){let n=e*r-t*i<0?-1:1,s=Math.min(1,Math.max(-1,e*i+t*r));return n*Math.acos(s)}var mI,vOe=V(()=>{mI=2*Math.PI});function Mi(e,t){if(!e)throw t||"Assertion Failed!"}function Ag(e){var t=e.windingRule,i=t===void 0?xn.ODD:t,r=e.elementType,n=r===void 0?aa.POLYGONS:r,s=e.polySize,a=s===void 0?3:s,o=e.vertexSize,l=o===void 0?2:o,u=e.normal,h=u===void 0?[0,0,1]:u,d=e.contours,c=d===void 0?[]:d,p=e.strict,f=p===void 0||p,m=e.debug,g=m!==void 0&&m;if(!c&&f)throw new Error("Contours can't be empty");if(c){var v=new Y_e;e.edgeCreateCallback&&(v.edgeCreateCallback=e.edgeCreateCallback),e.vertexIdCallback&&(v.vertexIdCallback=e.vertexIdCallback);for(var y=0;y<c.length;y++)v.addContour(l||2,c[y]);return v.tesselate(i,n,a,l,h,f),{vertices:v.vertices,vertexIndices:v.vertexIndices,vertexCount:v.vertexCount,elements:v.elements,elementCount:v.elementCount,mesh:g?v.mesh:void 0}}}var xn,aa,pi,j1,OS,C0,BF,UF,FF,Nte,h3,zF,Ite,Ote,Y_e,kF,K_e,Z_e,bw=V(()=>{var e;(e=xn||(xn={}))[e.ODD=0]="ODD",e[e.NONZERO=1]="NONZERO",e[e.POSITIVE=2]="POSITIVE",e[e.NEGATIVE=3]="NEGATIVE",e[e.ABS_GEQ_TWO=4]="ABS_GEQ_TWO",function(t){t[t.POLYGONS=0]="POLYGONS",t[t.CONNECTED_POLYGONS=1]="CONNECTED_POLYGONS",t[t.BOUNDARY_CONTOURS=2]="BOUNDARY_CONTOURS"}(aa||(aa={})),pi=function(){function t(){}return t.vertEq=function(i,r){return i.s===r.s&&i.t===r.t},t.vertLeq=function(i,r){return i.s<r.s||i.s===r.s&&i.t<=r.t},t.transLeq=function(i,r){return i.t<r.t||i.t===r.t&&i.s<=r.s},t.edgeGoesLeft=function(i){return t.vertLeq(i.Dst,i.Org)},t.edgeGoesRight=function(i){return t.vertLeq(i.Org,i.Dst)},t.vertL1dist=function(i,r){return Math.abs(i.s-r.s)+Math.abs(i.t-r.t)},t.edgeEval=function(i,r,n){Mi(t.vertLeq(i,r)&&t.vertLeq(r,n));var s=r.s-i.s,a=n.s-r.s;return s+a>0?s<a?r.t-i.t+(i.t-n.t)*(s/(s+a)):r.t-n.t+(n.t-i.t)*(a/(s+a)):0},t.edgeSign=function(i,r,n){Mi(t.vertLeq(i,r)&&t.vertLeq(r,n));var s=r.s-i.s,a=n.s-r.s;return s+a>0?(r.t-n.t)*s+(r.t-i.t)*a:0},t.transEval=function(i,r,n){Mi(t.transLeq(i,r)&&t.transLeq(r,n));var s=r.t-i.t,a=n.t-r.t;return s+a>0?s<a?r.s-i.s+(i.s-n.s)*(s/(s+a)):r.s-n.s+(n.s-i.s)*(a/(s+a)):0},t.transSign=function(i,r,n){Mi(t.transLeq(i,r)&&t.transLeq(r,n));var s=r.t-i.t,a=n.t-r.t;return s+a>0?(r.s-n.s)*s+(r.s-i.s)*a:0},t.vertCCW=function(i,r,n){return i.s*(r.t-n.t)+r.s*(n.t-i.t)+n.s*(i.t-r.t)>=0},t.interpolate=function(i,r,n,s){return(i=i<0?0:i)<=(n=n<0?0:n)?n===0?(r+s)/2:r+i/(i+n)*(s-r):s+n/(i+n)*(r-s)},t.intersect=function(i,r,n,s,a){var o,l,u;t.vertLeq(i,r)||(u=i,i=r,r=u),t.vertLeq(n,s)||(u=n,n=s,s=u),t.vertLeq(i,n)||(u=i,i=n,n=u,u=r,r=s,s=u),t.vertLeq(n,r)?t.vertLeq(r,s)?((o=t.edgeEval(i,n,r))+(l=t.edgeEval(n,r,s))<0&&(o=-o,l=-l),a.s=t.interpolate(o,n.s,l,r.s)):((o=t.edgeSign(i,n,r))+(l=-t.edgeSign(i,s,r))<0&&(o=-o,l=-l),a.s=t.interpolate(o,n.s,l,s.s)):a.s=(n.s+r.s)/2,t.transLeq(i,r)||(u=i,i=r,r=u),t.transLeq(n,s)||(u=n,n=s,s=u),t.transLeq(i,n)||(u=i,i=n,n=u,u=r,r=s,s=u),t.transLeq(n,r)?t.transLeq(r,s)?((o=t.transEval(i,n,r))+(l=t.transEval(n,r,s))<0&&(o=-o,l=-l),a.t=t.interpolate(o,n.t,l,r.t)):((o=t.transSign(i,n,r))+(l=-t.transSign(i,s,r))<0&&(o=-o,l=-l),a.t=t.interpolate(o,n.t,l,s.t)):a.t=(n.t+r.t)/2},t}(),j1=function(){this.next=null,this.prev=null,this.anEdge=null,this.trail=null,this.n=0,this.marked=!1,this.inside=!1},OS=function(){function t(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(t.prototype,"Rface",{get:function(){return this.Sym.Lface},set:function(i){this.Sym.Lface=i},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"Dst",{get:function(){return this.Sym.Org},set:function(i){this.Sym.Org=i},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"Oprev",{get:function(){return this.Sym.Lnext},set:function(i){this.Sym.Lnext=i},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"Lprev",{get:function(){return this.Onext.Sym},set:function(i){this.Onext.Sym=i},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"Dprev",{get:function(){return this.Lnext.Sym},set:function(i){this.Lnext.Sym=i},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"Rprev",{get:function(){return this.Sym.Onext},set:function(i){this.Sym.Onext=i},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"Dnext",{get:function(){return this.Sym.Onext.Sym},set:function(i){this.Sym.Onext.Sym=i},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"Rnext",{get:function(){return this.Sym.Lnext.Sym},set:function(i){this.Sym.Lnext.Sym=i},enumerable:!0,configurable:!0}),t}(),C0=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},BF=function(){function t(){var i=new C0,r=new j1,n=new OS(0),s=new OS(1);i.next=i.prev=i,i.anEdge=null,r.next=r.prev=r,n.next=n,n.Sym=s,s.next=s,s.Sym=n,this.vHead=i,this.fHead=r,this.eHead=n,this.eHeadSym=s}return t.prototype.makeEdge_=function(i){var r=new OS(0),n=new OS(1);i.Sym.side<i.side&&(i=i.Sym);var s=i.Sym.next;return n.next=s,s.Sym.next=r,r.next=i,i.Sym.next=n,r.Sym=n,r.Onext=r,r.Lnext=n,r.Org=null,r.Lface=null,r.winding=0,r.activeRegion=null,n.Sym=r,n.Onext=n,n.Lnext=r,n.Org=null,n.Lface=null,n.winding=0,n.activeRegion=null,r},t.prototype.splice_=function(i,r){var n=i.Onext,s=r.Onext;n.Sym.Lnext=r,s.Sym.Lnext=i,i.Onext=s,r.Onext=n},t.prototype.makeVertex_=function(i,r,n){var s=i;Mi(s,"Vertex can't be null!");var a=n.prev;s.prev=a,a.next=s,s.next=n,n.prev=s,s.anEdge=r;var o=r;do o.Org=s,o=o.Onext;while(o!==r)},t.prototype.makeFace_=function(i,r,n){var s=i;Mi(s,"Face can't be null");var a=n.prev;s.prev=a,a.next=s,s.next=n,n.prev=s,s.anEdge=r,s.trail=null,s.marked=!1,s.inside=n.inside;var o=r;do o.Lface=s,o=o.Lnext;while(o!==r)},t.prototype.killEdge_=function(i){i.Sym.side<i.side&&(i=i.Sym);var r=i.next,n=i.Sym.next;r.Sym.next=n,n.Sym.next=r},t.prototype.killVertex_=function(i,r){var n=i.anEdge,s=n;do s.Org=r,s=s.Onext;while(s!==n);var a=i.prev,o=i.next;o.prev=a,a.next=o},t.prototype.killFace_=function(i,r){var n=i.anEdge,s=n;do s.Lface=r,s=s.Lnext;while(s!==n);var a=i.prev,o=i.next;o.prev=a,a.next=o},t.prototype.makeEdge=function(){var i=new C0,r=new C0,n=new j1,s=this.makeEdge_(this.eHead);return this.makeVertex_(i,s,this.vHead),this.makeVertex_(r,s.Sym,this.vHead),this.makeFace_(n,s,this.fHead),s},t.prototype.splice=function(i,r){var n=!1,s=!1;if(i!==r){if(r.Org!==i.Org&&(s=!0,this.killVertex_(r.Org,i.Org)),r.Lface!==i.Lface&&(n=!0,this.killFace_(r.Lface,i.Lface)),this.splice_(r,i),!s){var a=new C0;this.makeVertex_(a,r,i.Org),i.Org.anEdge=i}if(!n){var o=new j1;this.makeFace_(o,r,i.Lface),i.Lface.anEdge=i}}},t.prototype.delete=function(i){var r=i.Sym,n=!1;if(i.Lface!==i.Rface&&(n=!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),!n){var s=new j1;this.makeFace_(s,i,i.Lface)}r.Onext===r?(this.killVertex_(r.Org,null),this.killFace_(r.Lface,null)):(i.Lface.anEdge=r.Oprev,r.Org.anEdge=r.Onext,this.splice_(r,r.Oprev)),this.killEdge_(i)},t.prototype.addEdgeVertex=function(i){var r=this.makeEdge_(i),n=r.Sym;this.splice_(r,i.Lnext),r.Org=i.Dst;var s=new C0;return this.makeVertex_(s,n,r.Org),r.Lface=n.Lface=i.Lface,r},t.prototype.splitEdge=function(i){var r=this.addEdgeVertex(i).Sym;return this.splice_(i.Sym,i.Sym.Oprev),this.splice_(i.Sym,r),i.Dst=r.Org,r.Dst.anEdge=r.Sym,r.Rface=i.Rface,r.winding=i.winding,r.Sym.winding=i.Sym.winding,r.idx=i.idx,r.Sym.idx=i.Sym.idx,r},t.prototype.connect=function(i,r){var n=!1,s=this.makeEdge_(i),a=s.Sym;if(r.Lface!==i.Lface&&(n=!0,this.killFace_(r.Lface,i.Lface)),this.splice_(s,i.Lnext),this.splice_(a,r),s.Org=i.Dst,a.Org=r.Org,s.Lface=a.Lface=i.Lface,i.Lface.anEdge=a,!n){var o=new j1;this.makeFace_(o,s,i.Lface)}return s},t.prototype.zapFace=function(i){var r,n,s,a,o,l=i.anEdge;n=l.Lnext;do n=(r=n).Lnext,r.Lface=null,r.Rface===null&&(r.Onext===r?this.killVertex_(r.Org,null):(r.Org.anEdge=r.Onext,this.splice_(r,r.Oprev)),(s=r.Sym).Onext===s?this.killVertex_(s.Org,null):(s.Org.anEdge=s.Onext,this.splice_(s,s.Oprev)),this.killEdge_(r));while(r!=l);a=i.prev,(o=i.next).prev=a,a.next=o},t.prototype.countFaceVerts_=function(i){var r=i.anEdge,n=0;do n++,r=r.Lnext;while(r!==i.anEdge);return n},t.prototype.mergeConvexFaces=function(i){var r,n,s,a,o;for(r=this.fHead.next;r!==this.fHead;r=r.next)if(r.inside)for(o=(n=r.anEdge).Org;s=n.Lnext,(a=n.Sym)&&a.Lface&&a.Lface.inside&&this.countFaceVerts_(r)+this.countFaceVerts_(a.Lface)-2<=i&&pi.vertCCW(n.Lprev.Org,n.Org,a.Lnext.Lnext.Org)&&pi.vertCCW(a.Lprev.Org,a.Org,n.Lnext.Lnext.Org)&&(s=a.Lnext,this.delete(a),n=null,a=null),!n||n.Lnext.Org!==o;)n=s;return!0},t.prototype.check=function(){var i,r,n,s,a,o,l=this.fHead,u=this.vHead,h=this.eHead;for(r=l,r=l;(i=r.next)!==l;r=i){Mi(i.prev===r),a=i.anEdge;do Mi(a.Sym!==a),Mi(a.Sym.Sym===a),Mi(a.Lnext.Onext.Sym===a),Mi(a.Onext.Sym.Lnext===a),Mi(a.Lface===i),a=a.Lnext;while(a!==i.anEdge)}for(Mi(i.prev===r&&i.anEdge===null),s=u,s=u;(n=s.next)!==u;s=n){Mi(n.prev===s),a=n.anEdge;do Mi(a.Sym!==a),Mi(a.Sym.Sym===a),Mi(a.Lnext.Onext.Sym===a),Mi(a.Onext.Sym.Lnext===a),Mi(a.Org===n),a=a.Onext;while(a!==n.anEdge)}for(Mi(n.prev===s&&n.anEdge===null),o=h,o=h;(a=o.next)!==h;o=a)Mi(a.Sym.next===o.Sym),Mi(a.Sym!==a),Mi(a.Sym.Sym===a),Mi(a.Org!==null),Mi(a.Dst!==null),Mi(a.Lnext.Onext.Sym===a),Mi(a.Onext.Sym.Lnext===a);Mi(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)},t}(),UF=function(){this.handle=null},FF=function(){this.key=null,this.node=0},Nte=function(){function t(i,r){this.leq=r,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 n=0;n<i+1;n++)this.nodes[n]=new UF,this.handles[n]=new FF;this.initialized=!1,this.nodes[1].handle=1,this.handles[1].key=null}return t.prototype.floatDown_=function(i){var r,n,s,a=this.nodes,o=this.handles;for(r=a[i].handle;;){if((s=i<<1)<this.size&&this.leq(o[a[s+1].handle].key,o[a[s].handle].key)&&++s,Mi(s<=this.max),n=a[s].handle,s>this.size||this.leq(o[r].key,o[n].key)){a[i].handle=r,o[r].node=i;break}a[i].handle=n,o[n].node=i,i=s}},t.prototype.floatUp_=function(i){var r,n,s,a=this.nodes,o=this.handles;for(r=a[i].handle;;){if(n=a[s=i>>1].handle,s===0||this.leq(o[n].key,o[r].key)){a[i].handle=r,o[r].node=i;break}a[i].handle=n,o[n].node=i,i=s}},t.prototype.init=function(){for(var i=this.size;i>=1;--i)this.floatDown_(i);this.initialized=!0},t.prototype.min=function(){return this.handles[this.nodes[1].handle].key},t.prototype.insert=function(i){var r,n;if(2*(r=++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 UF;for(a=this.handles.length,this.handles.length=this.max+1,s=a;s<this.handles.length;s++)this.handles[s]=new FF}return this.freeList===0?n=r:(n=this.freeList,this.freeList=this.handles[n].node),this.nodes[r].handle=n,this.handles[n].node=r,this.handles[n].key=i,this.initialized&&this.floatUp_(r),n},t.prototype.extractMin=function(){var i=this.nodes,r=this.handles,n=i[1].handle,s=r[n].key;return this.size>0&&(i[1].handle=i[this.size].handle,r[i[1].handle].node=1,r[n].key=null,r[n].node=this.freeList,this.freeList=n,--this.size,this.size>0&&this.floatDown_(1)),s},t.prototype.delete=function(i){var r,n=this.nodes,s=this.handles;Mi(i>=1&&i<=this.max&&s[i].key!==null),n[r=s[i].node].handle=n[this.size].handle,s[n[r].handle].node=r,--this.size,r<=this.size&&(r<=1||this.leq(s[n[r>>1].handle].key,s[n[r].handle].key)?this.floatDown_(r):this.floatUp_(r)),s[i].key=null,s[i].node=this.freeList,this.freeList=i},t}(),h3=function(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1},zF=function(){this.key=null,this.next=null,this.prev=null},Ite=function(){function t(i,r){this.frame=i,this.leq=r,this.head=new zF,this.head.next=this.head,this.head.prev=this.head}return t.prototype.min=function(){return this.head.next},t.prototype.max=function(){return this.head.prev},t.prototype.insert=function(i){return this.insertBefore(this.head,i)},t.prototype.search=function(i){var r=this.head;do r=r.next;while(r.key!==null&&!this.leq(this.frame,i,r.key));return r},t.prototype.insertBefore=function(i,r){do i=i.prev;while(i.key!==null&&!this.leq(this.frame,i.key,r));var n=new zF;return n.key=r,n.next=i.next,i.next.prev=n,n.prev=i,i.next=n,n},t.prototype.delete=function(i){i.next.prev=i.prev,i.prev.next=i.next},t}(),Ote=function(){function t(){}return t.regionBelow=function(i){return i.nodeUp.prev.key},t.regionAbove=function(i){return i.nodeUp.next.key},t.debugEvent=function(i){},t.addWinding=function(i,r){i.winding+=r.winding,i.Sym.winding+=r.Sym.winding},t.edgeLeq=function(i,r,n){var s=i.event,a=r.eUp,o=n.eUp;return a.Dst===s?o.Dst===s?pi.vertLeq(a.Org,o.Org)?pi.edgeSign(o.Dst,a.Org,o.Org)<=0:pi.edgeSign(a.Dst,o.Org,a.Org)>=0:pi.edgeSign(o.Dst,s,o.Org)<=0:o.Dst===s?pi.edgeSign(a.Dst,s,a.Org)>=0:pi.edgeEval(a.Dst,s,a.Org)>=pi.edgeEval(o.Dst,s,o.Org)},t.deleteRegion=function(i,r){r.fixUpperEdge&&Mi(r.eUp.winding===0),r.eUp.activeRegion=null,i.dict.delete(r.nodeUp)},t.fixUpperEdge=function(i,r,n){Mi(r.fixUpperEdge),i.mesh.delete(r.eUp),r.fixUpperEdge=!1,r.eUp=n,n.activeRegion=r},t.topLeftRegion=function(i,r){var n,s=r.eUp.Org;do r=t.regionAbove(r);while(r.eUp.Org===s);if(r.fixUpperEdge){if((n=i.mesh.connect(t.regionBelow(r).eUp.Sym,r.eUp.Lnext))===null)return null;t.fixUpperEdge(i,r,n),r=t.regionAbove(r)}return r},t.topRightRegion=function(i){var r=i.eUp.Dst;do i=t.regionAbove(i);while(i.eUp.Dst===r);return i},t.addRegionBelow=function(i,r,n){var s=new h3;return s.eUp=n,s.nodeUp=i.dict.insertBefore(r.nodeUp,s),s.fixUpperEdge=!1,s.sentinel=!1,s.dirty=!1,n.activeRegion=s,s},t.isWindingInside=function(i,r){switch(i.windingRule){case xn.ODD:return!!(1&r);case xn.NONZERO:return r!==0;case xn.POSITIVE:return r>0;case xn.NEGATIVE:return r<0;case xn.ABS_GEQ_TWO:return r>=2||r<=-2}throw new Error("Invalid winding rulle")},t.computeWinding=function(i,r){r.windingNumber=t.regionAbove(r).windingNumber+r.eUp.winding,r.inside=t.isWindingInside(i,r.windingNumber)},t.finishRegion=function(i,r){var n=r.eUp,s=n.Lface;s.inside=r.inside,s.anEdge=n,t.deleteRegion(i,r)},t.finishLeftRegions=function(i,r,n){for(var s,a=null,o=r,l=r.eUp;o!==n;){if(o.fixUpperEdge=!1,(s=(a=t.regionBelow(o)).eUp).Org!=l.Org){if(!a.fixUpperEdge){t.finishRegion(i,o);break}s=i.mesh.connect(l.Lprev,s.Sym),t.fixUpperEdge(i,a,s)}l.Onext!==s&&(i.mesh.splice(s.Oprev,s),i.mesh.splice(l,s)),t.finishRegion(i,o),l=a.eUp,o=a}return l},t.addRightEdges=function(i,r,n,s,a,o){var l,u,h,d,c=!0;h=n;do Mi(pi.vertLeq(h.Org,h.Dst)),t.addRegionBelow(i,r,h.Sym),h=h.Onext;while(h!==s);for(a===null&&(a=t.regionBelow(r).eUp.Rprev),u=r,d=a;(h=(l=t.regionBelow(u)).eUp.Sym).Org===d.Org;)h.Onext!==d&&(i.mesh.splice(h.Oprev,h),i.mesh.splice(d.Oprev,h)),l.windingNumber=u.windingNumber-h.winding,l.inside=t.isWindingInside(i,l.windingNumber),u.dirty=!0,!c&&t.checkForRightSplice(i,u)&&(t.addWinding(h,d),t.deleteRegion(i,u),i.mesh.delete(d)),c=!1,u=l,d=h;u.dirty=!0,Mi(u.windingNumber-h.winding===l.windingNumber),o&&t.walkDirtyRegions(i,u)},t.spliceMergeVertices=function(i,r,n){i.mesh.splice(r,n)},t.vertexWeights=function(i,r,n){var s=pi.vertL1dist(r,i),a=pi.vertL1dist(n,i),o=.5*a/(s+a),l=.5*s/(s+a);i.coords[0]+=o*r.coords[0]+l*n.coords[0],i.coords[1]+=o*r.coords[1]+l*n.coords[1],i.coords[2]+=o*r.coords[2]+l*n.coords[2]},t.getIntersectData=function(i,r,n,s,a,o){r.coords[0]=r.coords[1]=r.coords[2]=0,r.idx=-1,t.vertexWeights(r,n,s),t.vertexWeights(r,a,o)},t.checkForRightSplice=function(i,r){var n=t.regionBelow(r),s=r.eUp,a=n.eUp;if(pi.vertLeq(s.Org,a.Org)){if(pi.edgeSign(a.Dst,s.Org,a.Org)>0)return!1;pi.vertEq(s.Org,a.Org)?s.Org!==a.Org&&(i.pq.delete(s.Org.pqHandle),t.spliceMergeVertices(i,a.Oprev,s)):(i.mesh.splitEdge(a.Sym),i.mesh.splice(s,a.Oprev),r.dirty=n.dirty=!0)}else{if(pi.edgeSign(s.Dst,a.Org,s.Org)<0)return!1;t.regionAbove(r).dirty=r.dirty=!0,i.mesh.splitEdge(s.Sym),i.mesh.splice(a.Oprev,s)}return!0},t.checkForLeftSplice=function(i,r){var n,s=t.regionBelow(r),a=r.eUp,o=s.eUp;if(Mi(!pi.vertEq(a.Dst,o.Dst)),pi.vertLeq(a.Dst,o.Dst)){if(pi.edgeSign(a.Dst,o.Dst,a.Org)<0)return!1;t.regionAbove(r).dirty=r.dirty=!0,n=i.mesh.splitEdge(a),i.mesh.splice(o.Sym,n),n.Lface.inside=r.inside}else{if(pi.edgeSign(o.Dst,a.Dst,o.Org)>0)return!1;r.dirty=s.dirty=!0,n=i.mesh.splitEdge(o),i.mesh.splice(a.Lnext,o.Sym),n.Rface.inside=r.inside}return!0},t.checkForIntersect=function(i,r){var n,s,a=t.regionBelow(r),o=r.eUp,l=a.eUp,u=o.Org,h=l.Org,d=o.Dst,c=l.Dst,p=new C0;if(Mi(!pi.vertEq(c,d)),Mi(pi.edgeSign(d,i.event,u)<=0),Mi(pi.edgeSign(c,i.event,h)>=0),Mi(u!==i.event&&h!==i.event),Mi(!r.fixUpperEdge&&!a.fixUpperEdge),u===h||Math.min(u.t,d.t)>Math.max(h.t,c.t))return!1;if(pi.vertLeq(u,h)){if(pi.edgeSign(c,u,h)>0)return!1}else if(pi.edgeSign(d,h,u)<0)return!1;return t.debugEvent(i),pi.intersect(d,u,c,h,p),Mi(Math.min(u.t,d.t)<=p.t),Mi(p.t<=Math.max(h.t,c.t)),Mi(Math.min(c.s,d.s)<=p.s),Mi(p.s<=Math.max(h.s,u.s)),pi.vertLeq(p,i.event)&&(p.s=i.event.s,p.t=i.event.t),n=pi.vertLeq(u,h)?u:h,pi.vertLeq(n,p)&&(p.s=n.s,p.t=n.t),pi.vertEq(p,u)||pi.vertEq(p,h)?(t.checkForRightSplice(i,r),!1):!pi.vertEq(d,i.event)&&pi.edgeSign(d,i.event,p)>=0||!pi.vertEq(c,i.event)&&pi.edgeSign(c,i.event,p)<=0?c===i.event?(i.mesh.splitEdge(o.Sym),i.mesh.splice(l.Sym,o),r=t.topLeftRegion(i,r),o=t.regionBelow(r).eUp,t.finishLeftRegions(i,t.regionBelow(r),a),t.addRightEdges(i,r,o.Oprev,o,o,!0),!0):d===i.event?(i.mesh.splitEdge(l.Sym),i.mesh.splice(o.Lnext,l.Oprev),a=r,r=t.topRightRegion(r),s=t.regionBelow(r).eUp.Rprev,a.eUp=l.Oprev,l=t.finishLeftRegions(i,a,null),t.addRightEdges(i,r,l.Onext,o.Rprev,s,!0),!0):(pi.edgeSign(d,i.event,p)>=0&&(t.regionAbove(r).dirty=r.dirty=!0,i.mesh.splitEdge(o.Sym),o.Org.s=i.event.s,o.Org.t=i.event.t),pi.edgeSign(c,i.event,p)<=0&&(r.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),t.getIntersectData(i,o.Org,u,d,h,c),t.regionAbove(r).dirty=r.dirty=a.dirty=!0,!1)},t.walkDirtyRegions=function(i,r){for(var n,s,a=t.regionBelow(r);;){for(;a.dirty;)r=a,a=t.regionBelow(a);if(!r.dirty&&(a=r,(r=t.regionAbove(r))===null||!r.dirty))return;if(r.dirty=!1,n=r.eUp,s=a.eUp,n.Dst!==s.Dst&&t.checkForLeftSplice(i,r)&&(a.fixUpperEdge?(t.deleteRegion(i,a),i.mesh.delete(s),s=(a=t.regionBelow(r)).eUp):r.fixUpperEdge&&(t.deleteRegion(i,r),i.mesh.delete(n),n=(r=t.regionAbove(a)).eUp)),n.Org!==s.Org){if(n.Dst===s.Dst||r.fixUpperEdge||a.fixUpperEdge||n.Dst!==i.event&&s.Dst!==i.event)t.checkForRightSplice(i,r);else if(t.checkForIntersect(i,r))return}n.Org===s.Org&&n.Dst===s.Dst&&(t.addWinding(s,n),t.deleteRegion(i,r),i.mesh.delete(n),r=t.regionAbove(a))}},t.connectRightVertex=function(i,r,n){var s,a=n.Onext,o=t.regionBelow(r),l=r.eUp,u=o.eUp,h=!1;l.Dst!==u.Dst&&t.checkForIntersect(i,r),pi.vertEq(l.Org,i.event)&&(i.mesh.splice(a.Oprev,l),r=t.topLeftRegion(i,r),a=t.regionBelow(r).eUp,t.finishLeftRegions(i,t.regionBelow(r),o),h=!0),pi.vertEq(u.Org,i.event)&&(i.mesh.splice(n,u.Oprev),n=t.finishLeftRegions(i,o,null),h=!0),h?t.addRightEdges(i,r,n.Onext,a,a,!0):(s=pi.vertLeq(u.Org,l.Org)?u.Oprev:l,s=i.mesh.connect(n.Lprev,s),t.addRightEdges(i,r,s,s.Onext,s.Onext,!1),s.Sym.activeRegion.fixUpperEdge=!0,t.walkDirtyRegions(i,r))},t.connectLeftDegenerate=function(i,r,n){var s,a,o,l,u;return s=r.eUp,pi.vertEq(s.Org,n)?(Mi(!1),void t.spliceMergeVertices(i,s,n.anEdge)):pi.vertEq(s.Dst,n)?(Mi(!1),r=t.topRightRegion(r),a=l=(o=(u=t.regionBelow(r)).eUp.Sym).Onext,u.fixUpperEdge&&(Mi(a!==o),t.deleteRegion(i,u),i.mesh.delete(o),o=a.Oprev),i.mesh.splice(n.anEdge,o),pi.edgeGoesLeft(a)||(a=null),void t.addRightEdges(i,r,o.Onext,l,a,!0)):(i.mesh.splitEdge(s.Sym),r.fixUpperEdge&&(i.mesh.delete(s.Onext),r.fixUpperEdge=!1),i.mesh.splice(n.anEdge,s),void t.sweepEvent(i,n))},t.connectLeftVertex=function(i,r){var n,s,a,o,l,u,h=new h3;if(h.eUp=r.anEdge.Sym,n=i.dict.search(h).key,s=t.regionBelow(n)){if(o=n.eUp,l=s.eUp,pi.edgeSign(o.Dst,r,o.Org)===0)return void t.connectLeftDegenerate(i,n,r);a=pi.vertLeq(l.Dst,o.Dst)?n:s,n.inside||a.fixUpperEdge?(u=a===n?i.mesh.connect(r.anEdge.Sym,o.Lnext):i.mesh.connect(l.Dnext,r.anEdge).Sym,a.fixUpperEdge?t.fixUpperEdge(i,a,u):t.computeWinding(i,t.addRegionBelow(i,n,u)),t.sweepEvent(i,r)):t.addRightEdges(i,n,r.anEdge,r.anEdge,null,!0)}},t.sweepEvent=function(i,r){i.event=r,t.debugEvent(i);for(var n=r.anEdge;n.activeRegion===null;)if((n=n.Onext)===r.anEdge)return void t.connectLeftVertex(i,r);var s=t.topLeftRegion(i,n.activeRegion);Mi(s!==null);var a=t.regionBelow(s),o=a.eUp,l=t.finishLeftRegions(i,a,null);l.Onext===o?t.connectRightVertex(i,s,l):t.addRightEdges(i,s,l.Onext,o,o,!0)},t.addSentinel=function(i,r,n,s){var a=new h3,o=i.mesh.makeEdge();o.Org.s=n,o.Org.t=s,o.Dst.s=r,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)},t.initEdgeDict=function(i){i.dict=new Ite(i,t.edgeLeq);var r=i.bmax[0]-i.bmin[0],n=i.bmax[1]-i.bmin[1],s=i.bmin[0]-r,a=i.bmax[0]+r,o=i.bmin[1]-n,l=i.bmax[1]+n;t.addSentinel(i,s,a,o),t.addSentinel(i,s,a,l)},t.doneEdgeDict=function(i){for(var r,n=0;(r=i.dict.min().key)!==null;)r.sentinel||(Mi(r.fixUpperEdge),Mi(++n===1)),Mi(r.windingNumber===0),t.deleteRegion(i,r)},t.removeDegenerateEdges=function(i){var r,n,s,a=i.mesh.eHead;for(r=a.next;r!==a;r=n)n=r.next,s=r.Lnext,pi.vertEq(r.Org,r.Dst)&&r.Lnext.Lnext!==r&&(t.spliceMergeVertices(i,s,r),i.mesh.delete(r),s=(r=s).Lnext),s.Lnext===r&&(s!==r&&((s===n||s===n.Sym)&&(n=n.next),i.mesh.delete(s)),(r===n||r===n.Sym)&&(n=n.next),i.mesh.delete(r))},t.initPriorityQ=function(i){var r,n,s,a=0;for(n=(s=i.mesh.vHead).next;n!==s;n=n.next)a++;for(a+=8,r=i.pq=new Nte(a,pi.vertLeq),n=(s=i.mesh.vHead).next;n!==s;n=n.next)n.pqHandle=r.insert(n);return n===s&&(r.init(),!0)},t.donePriorityQ=function(i){i.pq=null},t.removeDegenerateFaces=function(i,r){var n,s,a;for(n=r.fHead.next;n!==r.fHead;n=s)s=n.next,Mi((a=n.anEdge).Lnext!==a),a.Lnext.Lnext===a&&(t.addWinding(a.Onext,a),i.mesh.delete(a));return!0},t.computeInterior=function(i,r){var n,s;if(r===void 0&&(r=!0),t.removeDegenerateEdges(i),!t.initPriorityQ(i))return!1;for(t.initEdgeDict(i);(n=i.pq.extractMin())!==null;){for(;(s=i.pq.min())!==null&&pi.vertEq(s,n);)s=i.pq.extractMin(),t.spliceMergeVertices(i,n.anEdge,s.anEdge);t.sweepEvent(i,n)}return i.event=i.dict.min().key.eUp.Org,t.debugEvent(i),t.doneEdgeDict(i),t.donePriorityQ(i),!!t.removeDegenerateFaces(i,i.mesh)&&(r&&i.mesh.check(),!0)},t}(),Y_e=function(){function t(){this.mesh=new BF,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=xn.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 t.prototype.dot_=function(i,r){return i[0]*r[0]+i[1]*r[1]+i[2]*r[2]},t.prototype.normalize_=function(i){var r=i[0]*i[0]+i[1]*i[1]+i[2]*i[2];if(!r)throw"Zero-size vector!";r=Math.sqrt(r),i[0]/=r,i[1]/=r,i[2]/=r},t.prototype.longAxis_=function(i){var r=0;return Math.abs(i[1])>Math.abs(i[0])&&(r=1),Math.abs(i[2])>Math.abs(i[r])&&(r=2),r},t.prototype.computeNormal_=function(i){var r,n,s,a,o,l,u=[0,0,0],h=[0,0,0],d=[0,0,0],c=[0,0,0],p=[0,0,0],f=[null,null,null],m=[null,null,null],g=this.mesh.vHead;r=g.next;for(var v=0;v<3;++v)a=r.coords[v],h[v]=a,m[v]=r,u[v]=a,f[v]=r;for(r=g.next;r!==g;r=r.next)for(var y=0;y<3;++y)(a=r.coords[y])<h[y]&&(h[y]=a,m[y]=r),a>u[y]&&(u[y]=a,f[y]=r);var _=0;if(u[1]-h[1]>u[0]-h[0]&&(_=1),u[2]-h[2]>u[_]-h[_]&&(_=2),h[_]>=u[_])return i[0]=0,i[1]=0,void(i[2]=1);for(l=0,n=m[_],s=f[_],d[0]=n.coords[0]-s.coords[0],d[1]=n.coords[1]-s.coords[1],d[2]=n.coords[2]-s.coords[2],r=g.next;r!==g;r=r.next)c[0]=r.coords[0]-s.coords[0],c[1]=r.coords[1]-s.coords[1],c[2]=r.coords[2]-s.coords[2],p[0]=d[1]*c[2]-d[2]*c[1],p[1]=d[2]*c[0]-d[0]*c[2],p[2]=d[0]*c[1]-d[1]*c[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)},t.prototype.checkOrientation_=function(){for(var i,r,n=this.mesh.fHead,s=this.mesh.vHead,a=0,o=n.next;o!==n;o=o.next)if(!((r=o.anEdge).winding<=0))do a+=(r.Org.s-r.Dst.s)*(r.Org.t+r.Dst.t),r=r.Lnext;while(r!==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]}},t.prototype.projectPolygon_=function(){var i,r,n=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,r=this.tUnit;var o=this.longAxis_(s);i[o]=0,i[(o+1)%3]=1,i[(o+2)%3]=0,r[o]=0,r[(o+1)%3]=0,r[(o+2)%3]=s[o]>0?1:-1;for(var l=n.next;l!==n;l=l.next)l.s=this.dot_(l.coords,i),l.t=this.dot_(l.coords,r);a&&this.checkOrientation_();for(var u=!0,h=n.next;h!==n;h=h.next)u?(this.bmin[0]=this.bmax[0]=h.s,this.bmin[1]=this.bmax[1]=h.t,u=!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))},t.prototype.addWinding_=function(i,r){i.winding+=r.winding,i.Sym.winding+=r.Sym.winding},t.prototype.tessellateMonoRegion_=function(i,r){var n,s;if((n=r.anEdge).Lnext===n||n.Lnext.Lnext===n)throw"Mono region invalid";for(;pi.vertLeq(n.Dst,n.Org);n=n.Lprev);for(;pi.vertLeq(n.Org,n.Dst);n=n.Lnext);for(s=n.Lprev;n.Lnext!==s;)if(pi.vertLeq(n.Dst,s.Org)){for(;s.Lnext!==n&&(pi.edgeGoesLeft(s.Lnext)||pi.edgeSign(s.Org,s.Dst,s.Lnext.Dst)<=0);)s=i.connect(s.Lnext,s).Sym;s=s.Lprev}else{for(;s.Lnext!==n&&(pi.edgeGoesRight(n.Lprev)||pi.edgeSign(n.Dst,n.Org,n.Lprev.Org)>=0);)n=i.connect(n,n.Lprev).Sym;n=n.Lnext}if(s.Lnext===n)throw"Mono region invalid";for(;s.Lnext.Lnext!==n;)s=i.connect(s.Lnext,s).Sym;return!0},t.prototype.tessellateInterior_=function(i){for(var r,n=i.fHead.next;n!==i.fHead;n=r)if(r=n.next,n.inside&&!this.tessellateMonoRegion_(i,n))return!1;return!0},t.prototype.discardExterior_=function(i){for(var r,n=i.fHead.next;n!==i.fHead;n=r)r=n.next,n.inside||i.zapFace(n)},t.prototype.setWindingNumber_=function(i,r,n){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?r:-r:n?i.delete(a):a.winding=0},t.prototype.getNeighbourFace_=function(i){return i.Rface&&i.Rface.inside?i.Rface.n:-1},t.prototype.outputPolymesh_=function(i,r,n,s){var a,o,l=0,u=0;n>3&&i.mergeConvexFaces(n);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=u,u++),o++,a=a.Lnext;while(a!==d.anEdge);if(o>n)throw"Face vertex greater that support polygon";d.n=l,++l}for(this.elementCount=l,r===aa.CONNECTED_POLYGONS&&(l*=2),this.elements=[],this.elements.length=l*n,this.vertexCount=u,this.vertices=[],this.vertices.length=u*s,this.vertexIndices=[],this.vertexIndices.length=u,h=i.vHead.next;h!==i.vHead;h=h.next)if(h.n!==-1){var c=h.n*s;this.vertices[c+0]=h.coords[0],this.vertices[c+1]=h.coords[1],s>2&&(this.vertices[c+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<n;++f)this.elements[p++]=-1;if(r===aa.CONNECTED_POLYGONS){a=d.anEdge;do this.elements[p++]=this.getNeighbourFace_(a),a=a.Lnext;while(a!==d.anEdge);for(var m=o;m<n;++m)this.elements[p++]=-1}}},t.prototype.outputContours_=function(i,r){var n,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=n=l.anEdge;do this.vertexCount++,n=n.Lnext;while(n!==s);this.elementCount++}this.elements=[],this.elements.length=2*this.elementCount,this.vertices=[],this.vertices.length=this.vertexCount*r,this.vertexIndices=[],this.vertexIndices.length=this.vertexCount;var u=0,h=0,d=0;for(a=0,l=i.fHead.next;l!==i.fHead;l=l.next)if(l.inside){o=0,s=n=l.anEdge;do this.vertices[u++]=n.Org.coords[0],this.vertices[u++]=n.Org.coords[1],r>2&&(this.vertices[u++]=n.Org.coords[2]),this.vertexIndices[h++]=this.vertexIdCallback?this.vertexIdCallback(n):n.Org.idx,o++,n=n.Lnext;while(n!==s);this.elements[d++]=a,this.elements[d++]=o,a+=o}},t.prototype.addContour=function(i,r){this.mesh===null&&(this.mesh=new BF),i<2&&(i=2),i>3&&(i=3);for(var n=null,s=0;s<r.length;s+=i)n===null?(n=this.mesh.makeEdge(),this.mesh.splice(n,n.Sym)):(this.mesh.splitEdge(n),n=n.Lnext),n.Org.coords[0]=r[s+0],n.Org.coords[1]=r[s+1],n.Org.coords[2]=i>2?r[s+2]:0,n.Org.idx=this.vertexIndexCounter++,this.edgeCreateCallback&&this.edgeCreateCallback(n),n.winding=1,n.Sym.winding=-1},t.prototype.tesselate=function(i,r,n,s,a,o){if(i===void 0&&(i=xn.ODD),r===void 0&&(r=aa.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_(),Ote.computeInterior(this,o);var l=this.mesh;return r===aa.BOUNDARY_CONTOURS?this.setWindingNumber_(l,1,!0):this.tessellateInterior_(l),o&&l.check(),r===aa.BOUNDARY_CONTOURS?this.outputContours_(l,s):this.outputPolymesh_(l,r,n,s),!0},t}(),xn.ODD,xn.NONZERO,xn.POSITIVE,xn.NEGATIVE,xn.ABS_GEQ_TWO,aa.POLYGONS,aa.CONNECTED_POLYGONS,aa.BOUNDARY_CONTOURS}),yOe=V(()=>{(K_e=kF=class{constructor(e=256,t=!1){this.capacity=e,this.size=0,this.debug=t,this.debug&&console.log(`allocating with cap ${e}`);let i=e*kF.eSize;this.buffer=new ArrayBuffer(i);let r=Float32Array.BYTES_PER_ELEMENT,n=0;this.positions=new Float32Array(this.buffer,n*r,3*e),n+=3*e,this.normals=new Float32Array(this.buffer,n*r,3*e),n+=3*e,this.uvs=new Float32Array(this.buffer,n*r,2*e)}realloc(e,t=!1){if(e<this.size)throw Error("cannot shrink buffer");if(e<=this.capacity&&!t)return;this.debug&&console.log(`resizing from ${this.capacity} \u2192 ${e}`);let i=e*kF.eSize,r=new ArrayBuffer(i),n=Float32Array.BYTES_PER_ELEMENT,s=0,a=new Float32Array(r,s*n,3*e);s+=3*e;let o=new Float32Array(r,s*n,3*e);s+=3*e;let l=new Float32Array(r,s*n,2*e);t?(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=r,this.positions=a,this.normals=o,this.uvs=l,this.capacity=e}get(e=1){let t=this.size+e;if(t>this.capacity){let r=this.capacity;for(;t>r;)r*=2;this.realloc(r)}let i=this.size;return this.size=t,i}reserve(e){let t=this.size+e;t>this.capacity&&this.realloc(t)}shrink(){this.debug&&console.log(`shrinking ${this.capacity} \u2192 ${this.size}`),this.realloc(this.size,!0)}}).eSize=8*Float32Array.BYTES_PER_ELEMENT}),_Oe=V(()=>{Z_e=class{constructor(e=[],t=(i,r)=>i<r?-1:i>r?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;let e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:t,compare:i}=this,r=t[e];for(;e>0;){let n=e-1>>1,s=t[n];if(i(r,s)>=0)break;t[e]=s,e=n}t[e]=r}_down(e){let{data:t,compare:i}=this,r=this.length>>1,n=t[e];for(;e<r;){let s=1+(e<<1),a=s+1;if(a<this.length&&i(t[a],t[s])<0&&(s=a),i(t[s],n)>=0)break;t[e]=t[s],e=s}t[e]=n}}});function u3(e,t,i,r){this.x=e,this.y=t,this.h=i,this.d=function(n,s,a){let o=!1,l=1/0;for(let u of a)for(let h=0,d=u.length,c=d-1;h<d;c=h++){let p=u[h],f=u[c];p[1]>s!=f[1]>s&&n<(f[0]-p[0])*(s-p[1])/(f[1]-p[1])+p[0]&&(o=!o),l=Math.min(l,bOe(n,s,p,f))}return l===0?0:(o?1:-1)*Math.sqrt(l)}(e,t,r),this.max=this.d+this.h*Math.SQRT2}function bOe(e,t,i,r){let n=i[0],s=i[1],a=r[0]-n,o=r[1]-s;if(a!==0||o!==0){let l=((e-n)*a+(t-s)*o)/(a*a+o*o);l>1?(n=r[0],s=r[1]):l>0&&(n+=a*l,s+=o*l)}return a=e-n,o=t-s,a*a+o*o}var vL,NH,IH,d3,yL,OH,LH,Zg,xOe=V(()=>{_Oe()}),UX=V(()=>{le(),bw(),yOe(),Hr(),xOe(),vL={vertices:[160,160,-160,160,-160,-160,160,-160],vertexIndices:[1,0,3,2],vertexCount:4,elements:[0,4],elementCount:1,mesh:void 0},NH={vertices:[],vertexIndices:[],vertexCount:0,elements:[],elementCount:0,mesh:void 0},IH={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},d3=(e,t)=>([i,r])=>(r<i&&(r+=t),(e>=i?e:e+t)<=r),yL=class extends At{constructor(e,t,i=0,r=12,n=3,s=xn.ODD,a=!1){super(),this.forPathBevel=a,this.type="ShapeGeometry",this.vertexCache={},this._shape=e,this._depth=t,this._curveSegments=r,this._bevelSegmentsInput=n;let o,l,u,h=this._shape.extractShapePointsToFlatArray([],r),d=this._shape.shapeHoles.map(T=>{let E=T.extractShapePointsToFlatArray([],r),A=[];for(let R=E.length-1;R>=1;R-=2){let N=E[R-1],D=E[R-0];A.push(N,D)}return A}),c=[],p=[];for(let T=0;T<h.length;T+=2)p.push([h[T],h[T+1]]);c.push(p);for(let T=0;T<d.length;T++){let E=d[T],A=[];for(let R=0;R<E.length;R+=2)A.push([E[R],E[R+1]]);c.push(A)}o=e.isText?.1*new b4().setFromPoints(e.points.map(T=>T.position)).getSize(new J).length():c[0].length===0?i:i>0?function(T,E,A=1,R=!1){let N=1/0,D=1/0,O=-1/0,z=-1/0;for(let[Z,pe]of T[0])Z<N&&(N=Z),pe<D&&(D=pe),Z>O&&(O=Z),pe>z&&(z=pe);let U=O-N,G=z-D,j=Math.max(A,Math.min(U,G));if(j===A){let Z=[N,D];return Z.distance=0,Z.distance}let K=new Z_e([],(Z,pe)=>pe.max-Z.max),q=function(Z){let pe=0,H=0,F=0,X=Z[0];for(let k=0,Q=X.length,te=Q-1;k<Q;te=k++){let W=X[k],he=X[te],ce=W[0]*he[1]-he[0]*W[1];H+=(W[0]+he[0])*ce,F+=(W[1]+he[1])*ce,pe+=3*ce}let re=new u3(H/pe,F/pe,0,Z);return pe===0||re.d<0?new u3(X[0][0],X[0][1],0,Z):re}(T),se=new u3(N+U/2,D+G/2,0,T);se.d>q.d&&(q=se);let ve=2;function oe(Z,pe,H){let F=new u3(Z,pe,H,T);if(ve++,F.max>q.d+A&&K.push(F),F.d>q.d&&(q=F,R&&console.log(`found best ${Math.round(1e4*F.d)/1e4} after ${ve} probes`),q.d>E))return E}let fe=j/2;for(let Z=N;Z<O;Z+=j)for(let pe=D;pe<z;pe+=j)oe(Z+fe,pe+fe,fe);for(;K.length;){let{max:Z,x:pe,y:H,h:F}=K.pop();if(Z-q.d<=A)break;fe=F/2,oe(pe-fe,H-fe,fe),oe(pe+fe,H-fe,fe),oe(pe-fe,H+fe,fe),oe(pe+fe,H+fe,fe)}R&&console.log(`num probes: ${ve}
4167
4167
  best distance: ${q.d}`);let _e=[q.x,q.y];return _e.distance=q.d,_e.distance}(c,i):1e-5,i<=0?(this._bevel=0,this._bevelSegments=0):(this._bevel=Math.min(i,o,t/2),this._bevelSegments=Math.floor(n));try{l=Ag({windingRule:s,elementType:aa.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[h]})}catch{l=vL}try{u=Ag({windingRule:xn.ODD,elementType:aa.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...d]})}catch{u=NH}if(!l)throw new Error("error generating geometry");let f=l.elementCount;if(u){l.elementCount+=u.elementCount;for(let T=0;T<u.elements.length;T++){let E=u.elements[T],A=T%2==0?l.vertexCount:0;l.elements.push(E+A)}for(let T=0;T<u.vertexIndices.length;T++){let E=u.vertexIndices[T],A=l.vertexCount;l.vertexIndices.push(E+A)}for(let T=0;T<u.vertices.length;T++){let E=u.vertices[T];l.vertices.push(E)}}let m=1/0,g=-1/0,v=1/0,y=-1/0;for(let T=0,E=l.vertexCount;T<E;T++){let A=2*T,R=l.vertices[A+0],N=l.vertices[A+1];R<m&&(m=R),R>g&&(g=R),N<v&&(v=N),N>y&&(y=N)}this._minX=m,this._minY=v,this._width=g-m,this._height=y-v,this._buffer=new K_e(this._computeBufferEstimatedSize(l));let _=[],b=[];for(let T=l.elementCount-1;T>=0;T--){let E=T>=f,A=2*T,R=l.elements[A+0],N=l.elements[A+1],D=R+N,O={start:R,count:N,normals:[],continuous:[],concave:[]},z=R,U=D-1,G=R+1,j=this._shape.roundedCurves.length;do{let oe=z-R,fe=l.vertices[2*U+0],_e=l.vertices[2*U+1],Z=l.vertices[2*z+0],pe=l.vertices[2*z+1],H=l.vertices[2*G+0],F=l.vertices[2*G+1],X=Z-fe,re=pe-_e,k=Math.sqrt(X*X+re*re);X/=k,re/=k;let Q=Z-H,te=pe-F,W=Math.sqrt(Q*Q+te*te);Q/=W,te/=W,O.normals[2*oe+0]=-te,O.normals[2*oe+1]=Q,O.concave[oe]=X*te-re*Q>0;let he=l.vertexIndices[z];if(Array.isArray(he))O.continuous[oe]=!1;else{let[ce,Ee]=this._shape.getCurveIndexFromVertexId(he-1,!0);if(Ee>0&&Ee<1)O.continuous[oe]=!0;else{let Se=Ee===1?ce+1:ce-1;Se=(Se+j)%j;let qe=Ee===1?0:1,Ne=this._shape.roundedCurves[ce].getTangent(Ee),He=this._shape.roundedCurves[Se].getTangent(qe);O.continuous[oe]=Ne.dot(He)>.95}}E&&(O.normals[2*oe+0]*=-1,O.normals[2*oe+1]*=-1),[U,z,G]=[z,G,G+1],G>=D&&(G-=N)}while(G!==R+1);let K=[];K.push({bevelI:0,angle:0,size:0,boundary:{vertices:l.vertices.slice(2*R,2*D),vertexCount:N,vertexIndices:new Array(N).fill(!0).map((oe,fe)=>[fe,fe]),elements:[0,N],elementCount:1,mesh:null},reverseMap:[],insetPoints:l.vertices.slice(2*R,2*D)});let q=0;for(let oe=1;oe<=this._bevelSegments;oe++){let fe=oe/this._bevelSegments*Math.PI/2,_e=(1-Math.cos(fe))*this._bevel,Z=[],pe=[],H=[],F=[],X=0;for(let k=0;k<N;k++){let Q=2*k,te=(k-1+N)%N*2,W=l.vertices[2*O.start+Q+0],he=l.vertices[2*O.start+Q+1],ce=-O.normals[te+0]*_e,Ee=-O.normals[te+1]*_e,Se=-O.normals[Q+0]*_e,qe=-O.normals[Q+1]*_e;if(O.concave[k]||!O.concave[k]&&E){let Ne=Math.atan2(Ee,ce),He=Math.atan2(qe,Se);He>Ne&&(He-=2*Math.PI);let Re=He-Ne;if(O.continuous[k]||E){let ee=Ne+Re/2,Me=Math.cos(ee)*_e,We=Math.sin(ee)*_e;Z[2*X+0]=W+Me*(E?-1:1),Z[2*X+1]=he+We*(E?-1:1),F[X]=k,X++}else{let ee=Math.max(1,Math.floor(r/4*Math.abs(Re)/Math.PI));for(let Me=0;Me<=ee;Me++){let We=Ne+Re*(Me/ee),dt=Math.cos(We)*_e,et=Math.sin(We)*_e;Z[2*X+0]=W+dt,Z[2*X+1]=he+et,F[X]=k,X++}}}else Z[2*X+0]=W+ce,Z[2*X+1]=he+Ee,F[X]=k,pe[k]=X,X++,Z[2*X+0]=W,Z[2*X+1]=he,F[X]=k,X++,Z[2*X+0]=W+Se,Z[2*X+1]=he+qe,F[X]=k,H[k]=X,X++}let re=Ag({windingRule:xn.POSITIVE,elementType:aa.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[Z],edgeCreateCallback:k=>{let Q=k.Org.idx,te=F[Q],W=F[(Q+1)%F.length];k.idx=[te,W],k.Sym.idx=[W,te]},vertexIdCallback:k=>{let Q=k.Lprev.idx;return[Q?Q[1]:0,k.idx?k.idx[0]:0]}});if(!re)throw console.log("Error"),new Error(`error generating bevel geometry for ${oe}'th loop`);if(!re.vertexCount){let k=(oe-1)/this._bevelSegments*Math.PI/2;q=(1-Math.sin(k))*this._bevel;break}for(let k=0;k<re.vertexIndices.length;k++){let[Q,te]=re.vertexIndices[k];if(Q===te)continue;let W=te;te<Q&&(W+=N);for(let he=Q;he<W;he++){let ce=he%N,Ee=(he+1)%N;if(!O.continuous[ce]||!O.continuous[Ee]){re.vertexIndices[k]=[Q,ce],re.vertexIndices.splice(k+1,0,[Ee,te]),re.vertices.splice(2*(k+1),0,re.vertices[2*k],re.vertices[2*k+1]);break}}}K.push({bevelI:oe,angle:fe,size:_e,boundary:re,reverseMap:F,insetPoints:Z})}let se=(oe,fe,_e)=>{let Z=0,pe=oe.boundary.vertexIndices.length;for(;Z<pe&&_e(oe.boundary.vertexIndices[fe]);)fe=(fe+1)%pe,Z++;return Z},ve=_.length;for(let oe=1;oe<K.length;oe++){let fe=K[oe-1],_e=K[oe],Z=fe.boundary.vertexIndices.length,pe=_e.boundary.vertexIndices.length;if(!Z||!pe)break;let H=O.concave.length,F=0,X=d3(F,N);for(;!fe.boundary.vertexIndices.filter(X).length||!_e.boundary.vertexIndices.filter(X).length;)F++,X=d3(F,N);let re=fe.boundary.vertexIndices.findIndex(X),k=_e.boundary.vertexIndices.findIndex(X);do re=(re+1)%Z;while(X(fe.boundary.vertexIndices[re]));do k=(k+1)%pe;while(X(_e.boundary.vertexIndices[k]));F=(F+1)%N;let Q,te,W=F,he=0,ce=this._buildBevelVert(O,fe,(re-1+Z)%Z,void 0,he),Ee=this._buildBevelVert(O,_e,(k-1+pe)%pe,void 0,he),Se=!1;do{he=(F||H)/H,X=d3(F,N);let qe=se(fe,re,X),Ne=se(_e,k,X),He=Se;if(Se=!1,qe&&!Ne){for(let Re=0;Re<qe;Re++)Q=this._buildBevelVert(O,fe,(re+Re)%Z,Re/(qe-1),he),_.push(ce.topN,Q.topP,Ee.topN),a===!1&&_.push(Q.bottomP,ce.bottomN,Ee.bottomN),ce=Q;Se=!0}else if(!qe&&Ne)for(let Re=0;Re<Ne;Re++)te=this._buildBevelVert(O,_e,(k+Re)%pe,Re/(Ne-1),he),_.push(Ee.topN,ce.topP,te.topP),a===!1&&_.push(ce.bottomP,Ee.bottomN,te.bottomP),Ee=te;else if(qe&&Ne)if(Q=this._buildBevelVert(O,fe,re,0,he),te=this._buildBevelVert(O,_e,k,0,he),He?(_.push(ce.topN,te.topP,Ee.topN),_.push(ce.topN,Q.topP,te.topP),a===!1&&(_.push(te.bottomP,ce.bottomN,Ee.bottomN),_.push(te.bottomP,Q.bottomP,ce.bottomN))):(_.push(Ee.topN,ce.topN,Q.topP),_.push(Ee.topN,Q.topP,te.topP),a===!1&&(_.push(Q.bottomP,ce.bottomN,Ee.bottomN),_.push(Q.bottomP,Ee.bottomN,te.bottomP))),ce=Q,Ee=te,qe===Ne)for(let Re=1;Re<qe;Re++)Q=this._buildBevelVert(O,fe,(re+Re)%Z,Re/(qe-1),he),te=this._buildBevelVert(O,_e,(k+Re)%pe,Re/(Ne-1),he),_.push(ce.topN,Q.topP,Ee.topN),_.push(Ee.topN,Q.topP,te.topP),a===!1&&(_.push(Q.bottomP,ce.bottomN,Ee.bottomN),_.push(Q.bottomP,Ee.bottomN,te.bottomP)),ce=Q,Ee=te;else if(qe>Ne){let Re=qe/Ne,ee=0;for(let Me=1;Me<qe;Me++)Q=this._buildBevelVert(O,fe,(re+Me)%Z,Me/(qe-1),he),_.push(ce.topN,Q.topP,Ee.topN),a===!1&&_.push(Q.bottomP,ce.bottomN,Ee.bottomN),ce=Q,Me>(ee+1)*Re&&(ee++,te=this._buildBevelVert(O,_e,(k+ee)%pe,ee/(Ne-1),he),_.push(Ee.topN,Q.topP,te.topP),a===!1&&_.push(Q.bottomP,Ee.bottomN,te.bottomP),Ee=te)}else{let Re=Ne/qe,ee=0;for(let Me=1;Me<Ne;Me++)te=this._buildBevelVert(O,_e,(k+Me)%pe,Me/(Ne-1),he),_.push(Ee.topN,Q.topP,te.topP),a===!1&&_.push(Q.bottomP,Ee.bottomN,te.bottomP),Ee=te,Me>(ee+1)*Re&&(ee++,Q=this._buildBevelVert(O,fe,(re+ee)%Z,ee/(qe-1),he),_.push(ce.topN,Q.topP,Ee.topN),a===!1&&_.push(Q.bottomP,ce.bottomN,Ee.bottomN),ce=Q)}re=(re+qe)%Z,k=(k+Ne)%pe,F=(F+1)%H}while(F!==W)}if(a===!1&&this._depth>2*this._bevel&&this._buildWall(K,O,_),E){let oe=[];for(let fe=_.length-1;fe>=ve+2;fe-=3){let _e=_[fe-2],Z=_[fe-1],pe=_[fe-0];oe.push(pe,Z,_e)}_.splice(ve,_.length-ve,...oe)}if(E){let oe=[];for(let fe=K[K.length-1].boundary.vertices.length-1;fe>=1;fe-=2){let _e=K[K.length-1].boundary.vertices[fe-1],Z=K[K.length-1].boundary.vertices[fe-0];oe.push(_e,Z)}b.push(oe)}if(!E){let oe,fe=K[K.length-1];try{oe=Ag({windingRule:K.length>1?xn.POSITIVE:xn.ODD,elementType:aa.POLYGONS,vertexSize:2,strict:!0,contours:[fe.insetPoints,...b]})}catch{oe=IH}if(!oe)throw new Error("Error generating geometry for surface");d.length===0&&this._bevel<o&&Object.assign(this,{useNgonForTopBottomFaceDuringBake:!0});for(let _e=0;_e<3*oe.elementCount;_e+=3){let Z=this._buildSurfaceVert(oe,oe.elements[_e+0],q),pe=this._buildSurfaceVert(oe,oe.elements[_e+1],q),H=this._buildSurfaceVert(oe,oe.elements[_e+2],q);_.push(Z.top,pe.top,H.top),a===!1&&_.push(H.bottom,pe.bottom,Z.bottom)}}this.vertexCache={}}this._buffer.shrink();let x=new It(Uint32Array.from(_),1),w=new It(this._buffer.positions,3),S=new It(this._buffer.normals,3),M=new It(this._buffer.uvs,2);w.needsUpdate=!0,S.needsUpdate=!0,M.needsUpdate=!0,x.needsUpdate=!0,this.setAttribute("position",w),this.setAttribute("normal",S),this.setAttribute("uv",M),this.setIndex(x)}_computeBufferEstimatedSize(e){return 2*e.vertexCount*(2+this._bevelSegments)}_buildWall(e,t,i){let r=e[0];for(let n=0,s=r.boundary.vertexCount;n<s;n++){let a=this._buildBevelVert(t,r,n),o=this._buildBevelVert(t,r,(n+1)%s);i.push(o.topP,a.topN,a.bottomN),i.push(o.topP,a.bottomN,o.bottomP)}}_buildSurfaceVert(e,t,i){let r=t.toString();if(r in this.vertexCache)return this.vertexCache[r];let n=e.vertices[2*t+0],s=e.vertices[2*t+1],a=(n-this._minX)/this._width,o=(s-this._minY)/this._height;this.forPathBevel&&(o=1);let l=this._buffer.get(this.forPathBevel?1:2),u=3*l,h=2*l,d={top:l+0,bottom:l+1};return this._buffer.positions[u+0]=n,this._buffer.positions[u+1]=s,this._buffer.positions[u+2]=this.forPathBevel?this._bevel:this._depth-i,this._buffer.normals[u+0]=0,this._buffer.normals[u+1]=0,this._buffer.normals[u+2]=1,this._buffer.uvs[h+0]=a,this._buffer.uvs[h+1]=o,this.forPathBevel===!1&&(this._buffer.positions[u+3]=n,this._buffer.positions[u+4]=s,this._buffer.positions[u+5]=i,this._buffer.normals[u+3]=0,this._buffer.normals[u+4]=0,this._buffer.normals[u+5]=-1,this._buffer.uvs[h+2]=a,this._buffer.uvs[h+3]=o),this.vertexCache[r]=d,d}_buildBevelVert(e,t,i,r=1,n){let s=`${t.bevelI}:${i}`;if(s in this.vertexCache&&n!==0&&n!==1&&(!n||n===this.vertexCache[s].pathBevelUCoord))return this.vertexCache[s];let a,o,l,u,[h,d]=t.boundary.vertexIndices[i];h!==d?(o=h,a=d,u=!1,l=e.continuous[o]&&e.continuous[a]):(a=h,o=(a-1+e.count)%e.count,u=e.concave[a]&&t.bevelI>0,l=e.continuous[a]||u);let c=Math.cos(t.angle),p=Math.sin(t.angle),f=2*i,m=2*a,g=2*o,v=t.boundary.vertices[f+0],y=t.boundary.vertices[f+1],_=(1-p)*this._bevel,b=(v-this._minX)/this._width,x=(y-this._minY)/this._height;this.forPathBevel&&(n!==void 0&&(b=n),x=1);let w=e.normals[m+0],S=e.normals[m+1],M=e.normals[g+0],T=e.normals[g+1];if(u){w+=(M-w)*(1-r),S+=(T-S)*(1-r);let D=Math.sqrt(w*w+S*S);w/=D,S/=D}let E=this.forPathBevel?this._buffer.get(l?1:2):this._buffer.get(l?2:4),A=3*E,R=2*E,N={i,fi:a,topP:E+0,topN:E+0,bottomP:E+1,bottomN:E+1,pathBevelUCoord:n};return this._buffer.positions[A+0]=v,this._buffer.positions[A+1]=y,this._buffer.positions[A+2]=(this.forPathBevel?this._bevel:this._depth)-_,this._buffer.normals[A+0]=w*c,this._buffer.normals[A+1]=S*c,this._buffer.normals[A+2]=p,this._buffer.uvs[R+0]=b,this._buffer.uvs[R+1]=x,this.forPathBevel===!1&&(this._buffer.positions[A+3]=v,this._buffer.positions[A+4]=y,this._buffer.positions[A+5]=_,this._buffer.normals[A+3]=w*c,this._buffer.normals[A+4]=S*c,this._buffer.normals[A+5]=-p,this._buffer.uvs[R+2]=x,this._buffer.uvs[R+3]=b),l||(this.forPathBevel?(E+=1,A+=3,R+=2):(E+=2,A+=6,R+=4),N.topP=E+0,N.bottomP=E+1,this._buffer.positions[A+0]=v,this._buffer.positions[A+1]=y,this._buffer.positions[A+2]=(this.forPathBevel?this._bevel:this._depth)-_,this._buffer.normals[A+0]=M*c,this._buffer.normals[A+1]=T*c,this._buffer.normals[A+2]=p,this._buffer.uvs[R+0]=b,this._buffer.uvs[R+1]=x,this.forPathBevel===!1&&(this._buffer.positions[A+3]=v,this._buffer.positions[A+4]=y,this._buffer.positions[A+5]=_,this._buffer.normals[A+3]=M*c,this._buffer.normals[A+4]=T*c,this._buffer.normals[A+5]=-p,this._buffer.uvs[R+2]=x,this._buffer.uvs[R+3]=b)),this.vertexCache[s]=N,N}clone(){let e=new yL(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegmentsInput);return e.userData=w4(this.userData),e}}}),Q_e=V(()=>{le(),bw(),Hr(),UX(),OH=class extends At{constructor(e,t=12,i={}){super(),this.type="ShapeGeometry",this.windingRule=xn.ODD,this.elementType=aa.POLYGONS,this.polySize=3,this.vertexSize=2,this.strict=!0,this._shape=e,this._curveSegments=t,this._triangulationOptions=Object.assign({windingRule:xn.ODD,elementType:aa.POLYGONS,polySize:3,vertexSize:2,strict:!0},i);let r,n,s,a=this._shape.extractShapePointsToFlatArray([],this._curveSegments),o=this._shape.shapeHoles.map(c=>c.extractShapePointsToFlatArray([],this._curveSegments)),l=!0,u=!0;for(let c=0,p=a.length/2;c<p;c++){let f=2*c,m=a[f+0],g=a[f+1];if(n!==void 0&&m!==n&&(l=!1),s!==void 0&&g!==s&&(u=!1),n=m,s=g,!l&&!u)break}if(!l&&!u)try{r=Ag({contours:[a,...o],windingRule:this._triangulationOptions.windingRule,elementType:this._triangulationOptions.elementType,polySize:this._triangulationOptions.polySize,vertexSize:this._triangulationOptions.vertexSize,strict:this._triangulationOptions.strict})}catch{r=vL}let h=r?.vertexCount??1,d=r?.elementCount??1;if(this._positionAttribute=new It(new Float32Array(3*h),3),this._normalAttribute=new It(new Float32Array(3*h),3),this._uvAttribute=new It(new Float32Array(2*h),2),this._indexAttribute=new It(new Uint32Array(3*d),1),r){let c=1/0,p=-1/0,f=1/0,m=-1/0;for(let y=0,_=h;y<_;y++){let b=2*y,x=r.vertices[b+0],w=r.vertices[b+1];x<c&&(c=x),x>p&&(p=x),w<f&&(f=w),w>m&&(m=w)}let g=p-c,v=m-f;for(let y=0,_=h;y<_;y++){let b=2*y,x=r.vertices[b+0],w=r.vertices[b+1],S=(x-c)/g,M=(w-f)/v;this._positionAttribute.setXYZ(y,x,w,0),this._normalAttribute.setXYZ(y,0,0,1),this._uvAttribute.setXY(y,S,M)}for(let y=0,_=d;y<_;y++){let b=3*y,x=r.elements[b+0],w=r.elements[b+1],S=r.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*(r?.elementCount??1))}clone(){let e=new OH(this._shape,this._curveSegments);return e.userData=w4(this.userData),e}}}),wOe=V(()=>{bw(),Hr(),UX(),LH=class extends yL{constructor(e,t,i=0,r=12,n=3,s=xn.ODD){super(e,t,i,r,n,s),this.type="ShapeGeometry"}_computeBufferEstimatedSize(e){return 2*e.vertexCount*(2+this._bevelSegments)}_buildWall(e,t,i){let r=e[0];for(let n=0,s=r.boundary.vertexCount;n<s;n++){let a=this._buildBevelVert(t,r,n),o=this._buildBevelVert(t,r,(n+1)%s);i.push(o.topP,a.topN,a.bottomN),i.push(o.topP,a.bottomN,o.bottomP)}}clone(){let e=new LH(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegmentsInput);return e.userData=w4(this.userData),e}}}),Gg=V(()=>{Kg(),Q_e(),wOe(),bw(),Zg=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i,r=Object.assign({},t?.parameters??{width:100,subdivisions:40,roundness:0,extrudeBevelSize:0,extrudeBevelSegments:3,windingRule:xn.ODD},e.parameters),n=Math.abs(r.width),s=Math.abs(r.height??r.width),a=Math.abs(r.depth??0),o=e.shape??t?.shape,l=o?.roundness??r.roundness;o!==void 0&&(o instanceof hs?(i=o,(i.width!==n||i.height!==s)&&i.applySize(n,s)):i=new hs(n,s).fromJSON(o),e.parameters?.roundness!==void 0&&e.parameters?.roundness>0&&i.update());let u=i??new hs(n,s);return{parameters:Object.assign(r,{width:n,height:s,depth:a,roundness:l}),shape:u}}static build(e){let t,{depth:i,extrudeBevelSize:r,extrudeBevelSegments:n,subdivisions:s,roundness:a,windingRule:o}=e.parameters;return e.shape.roundness=a,t=i<=0?new OH(e.shape,s,{windingRule:o}):new LH(e.shape,i,r,s,n,o),Object.assign(t,{userData:{...e,type:"VectorGeometry"}})}}});function SOe(e,t,i,r,n,s){if(r>=FX)return n>30||n%4==0?(function(h,d,c,p=0,f=0,m=0){let g=.5522847498,v=d*g,y=c*g;h.addPoint(c3(f-d,m,f-d,m-y,f-d,m+y)),h.addPoint(c3(f,m+c,f-v,m+c,f+v,m+c)),h.addPoint(c3(f+d,m,f+d,m+y,f+d,m-y)),h.addPoint(c3(f,m-c,f+v,m-c,f-v,m-c)),p>0&&ebe(h,d,c,p)}(e,t,i,s),Math.round(n/4)):Lte(e,r,n,t,i,s);let a={x:0,y:i},o=(r=Math.max(r,.001))+.5*Math.PI,l={x:Math.cos(o)*t,y:Math.sin(o)*i},u=function({px:h,py:d,cx:c,cy:p,rx:f,ry:m,largeArcFlag:g,sweepFlag:v}){let y=[];if(f===0||m===0)return[];let _=(h-c)/2,b=(d-p)/2;if(_===0&&b===0)return[];f=Math.abs(f),m=Math.abs(m);let x=Math.pow(_,2)/Math.pow(f,2)+Math.pow(b,2)/Math.pow(m,2);x>1&&(f*=Math.sqrt(x),m*=Math.sqrt(x));let w=function(N,D,O,z,U,G,j,K,q,se){let ve=Math.pow(U,2),oe=Math.pow(G,2),fe=Math.pow(j,2),_e=Math.pow(K,2),Z=ve*oe-ve*_e-oe*fe;Z<0&&(Z=0),Z/=ve*_e+oe*fe,Z=Math.sqrt(Z)*(q===se?-1:1);let pe=Z*U/G*K,H=Z*-G/U*j,F=pe+(N+O)/2,X=H+(D+z)/2,re=(j-pe)/U,k=(K-H)/G,Q=(-j-pe)/U,te=(-K-H)/G,W=Dte(1,0,re,k),he=Dte(re,k,Q,te);return!se&&he>0&&(he-=mI),se&&he<0&&(he+=mI),{centerx:F,centery:X,ang1:W,ang2:he}}(h,d,c,p,f,m,_,b,g,v),{ang1:S,ang2:M}=w,{centerx:T,centery:E}=w,A=Math.abs(M)/(mI/4);Math.abs(1-A)<1e-7&&(A=1);let R=Math.max(Math.ceil(A),1);M/=R;for(let N=0;N<R;N++)y.push(gOe(S,M)),S+=M;return y.map(N=>{let{x:D,y:O}=LF(N[0],f,m,T,E),{x:z,y:U}=LF(N[1],f,m,T,E),{x:G,y:j}=LF(N[2],f,m,T,E);return{x1:D,y1:O,x2:z,y2:U,x:G,y:j}})}({px:a.x,py:a.y,cx:l.x,cy:l.y,rx:t,ry:i,largeArcFlag:r>Math.PI,sweepFlag:!0});return n>30||n%u.length===0?function(h,d,c,p,f,m,g,v){let y=Math.round(f/p.length);h.addPoint(Ax(d,c));for(let _=0,b=p.length;_<b;_++){let x=p[_],w=h.points[_],S=Ax(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 v>0?J_e(h,m,g,v):h.addPoint(Ax(0,0)),y}(e,a.x,a.y,u,n,t,i,s):Lte(e,r,n,t,i,s)}function Lte(e,t,i,r,n,s){let a=-t/i;for(let o=0;o<=i;o++){let l=a*o,u=Math.sin(l)*r,h=Math.cos(l)*n;e.addPoint(Ax(u,h))}return t<FX?s>0?J_e(e,r,n,s):e.addPoint(Ax(0,0)):(e.removePoint(e.points[e.points.length-1]),s>0&&ebe(e,r,n,s)),1}function Ax(e,t){return new gy(ht.generateUUID(),new J(e,t))}function c3(e,t,i,r,n,s){let a=Ax(e,t);return a.controls[0].position.set(i,r),a.controls[1].position.set(n,s),a}function J_e(e,t,i,r){tbe(e,t,i,r).forEach(n=>e.addPoint(n))}function ebe(e,t,i,r){let n=tbe(e,t,i,r),s=new hs;n.forEach(a=>s.addPoint(a)),s.isClosed=!0,e.shapeHoles.push(s)}function tbe(e,t,i,r){let n=r*t/100,s=n*(Math.abs(i)/Math.abs(t)),a=new J(n/t,s/i),o=e.points.map(l=>{let u=l.clone();return u.uuid=ht.generateUUID(),u}).reverse();return o.forEach(l=>{l.position.multiply(a);let u=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(u)}),o}var FX,z4,ibe,VF,rbe,_L=V(()=>{Kg(),X_e(),vOe(),Gg(),le(),FX=2*Math.PI,z4=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,spikes:64,angle:360,innerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1},e.parameters);return i.angle=ht.clamp(i.angle,0,360),{shape:e.shape&&e.shape instanceof hs?e.shape:new hs,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(e){let t,{width:i,height:r,spikes:n,angle:s,innerRadius:a,depth:o,extrudeBevelSize:l,extrudeBevelSegments:u}=e.parameters,h=e.shape,d=SOe(h,.5*i,.5*r,s*Math.PI/180,n,a);return h.isClosed=!0,h.update(),s===0?(t=new At,t.setAttribute("position",new Et([],3))):t=Zg.create({shape:h,parameters:{subdivisions:d,depth:o,extrudeBevelSize:l,extrudeBevelSegments:u}}),Object.assign(t,{userData:{...e,type:"EllipseGeometry"}})}}}),Bte=V(()=>{le(),G_e(),ibe=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,detail:0,corner:0,cornerSides:4},e.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(e){let{width:t,height:i,depth:r,detail:n,corner:s,cornerSides:a}=e.parameters,o=n===0&&s!==0?new VF(.5*t,s,a):new c7(.5*t,n),l=i/t,u=r/t;return(l!==1||u!==1)&&o.scale(1,l,u),Object.assign(o,{userData:{...e,type:"IcosahedronGeometry"}})}},VF=class extends mL{constructor(e=1,t=.2,i=4){let r=(1+Math.sqrt(5))/2,n="IcosahedronGeometry";super([-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,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],n,e,t,i),this.type=n}static fromJSON(e){return new VF(e.radius,e.corner,e.cornerSides)}}}),Ute=V(()=>{le(),rbe=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){(e.parameters?.points??[]).forEach(r=>{Array.isArray(r)&&(r.x=r[0],r.y=r[1])});let i=Object.assign({},t?.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}]},e.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(e){let{points:t,segments:i,verticalSegments:r}=e.parameters,n=new ZE;n.moveTo(t[0].x,t[0].y),n.bezierCurveTo(t[1].x,t[1].y,t[2].x,t[2].y,t[3].x,t[3].y);let s=new p7(n.extractPoints(r).shape,i);return s.rotateZ(Math.PI),Object.assign(s,{userData:{...e,type:"LatheGeometry"}})}}});function H1(e,t){return Math.abs(t-e)/2+Math.min(e,t)}function TOe(e){let{positions:t,faces:i,materialIndices:r,uvs:n}=e,s=t.length/3,a=i.length/3,o=n!==null&&a>0,l=3*a,u=new Uint32Array(l),h=new Uint32Array(l),d=new Uint32Array(l),c=new Uint32Array(l),p=new Uint32Array(l),f=0,m=8;for(;m<2*l;)m*=2;let g=m-1,v=new Int32Array(m).fill(-1),y=(D,O)=>{let z=(Math.imul(D,2654435761)^O)&g;for(;;){let U=v[z];if(U===-1)return v[z]=f,u[f]=D,h[f]=O,f++;if(u[U]===D&&h[U]===O)return U;z=z+1&g}},_=(D,O)=>{let z=D<O?D:O,U=D<O?O:D,G=(Math.imul(z,2654435761)^U)&g;for(;;){let j=v[G];if(u[j]===z&&h[j]===U)return j;G=G+1&g}},b=new Uint32Array(s),x=new Float64Array(3*s),w=(D,O,z)=>{let U=D<O?y(D,O):y(O,D),G=++d[U];G===1?c[U]=z:G===2&&(p[U]=z),b[D]++,b[O]++,x[3*D]+=t[3*O],x[3*D+1]+=t[3*O+1],x[3*D+2]+=t[3*O+2],x[3*O]+=t[3*D],x[3*O+1]+=t[3*D+1],x[3*O+2]+=t[3*D+2]};for(let D=0;D<a;D++){let O=i[3*D],z=i[3*D+1],U=i[3*D+2];w(O,z,U),w(z,U,O),w(U,O,z)}let S=new Float64Array(3*f);for(let D=0;D<f;D++){let O=3*u[D],z=3*h[D];if(d[D]===2){let U=3*c[D],G=3*p[D];S[3*D]=.375*(t[O]+t[z])+.125*(t[U]+t[G]),S[3*D+1]=.375*(t[O+1]+t[z+1])+.125*(t[U+1]+t[G+1]),S[3*D+2]=.375*(t[O+2]+t[z+2])+.125*(t[U+2]+t[G+2])}else S[3*D]=.5*(t[O]+t[z]),S[3*D+1]=.5*(t[O+1]+t[z+1]),S[3*D+2]=.5*(t[O+2]+t[z+2])}let M,T=new Float64Array(3*s);for(let D=0;D<s;D++){let O=b[D];O===3?M=3/16:O>3&&(M=3/(8*O));let z=1-O*Number(M),U=Number(M);O===2&&(z=3/4,U=1/8),T[3*D]=t[3*D]*z+x[3*D]*U,T[3*D+1]=t[3*D+1]*z+x[3*D+1]*U,T[3*D+2]=t[3*D+2]*z+x[3*D+2]*U}let E=new Float64Array(3*(s+f));E.set(T),E.set(S,3*s);let A=new Uint32Array(12*a),R=new Array(4*a),N=o?new Float64Array(24*a):null;for(let D=0;D<a;D++){let O=i[3*D],z=i[3*D+1],U=i[3*D+2],G=_(O,z)+s,j=_(z,U)+s,K=_(U,O)+s,q=12*D;A[q++]=G,A[q++]=j,A[q++]=K,A[q++]=O,A[q++]=G,A[q++]=K,A[q++]=z,A[q++]=j,A[q++]=G,A[q++]=U,A[q++]=K,A[q++]=j;let se=r[D];if(R[4*D]=se,R[4*D+1]=se,R[4*D+2]=se,R[4*D+3]=se,N!==null){let ve=6*D,oe=n[ve],fe=n[ve+1],_e=n[ve+2],Z=n[ve+3],pe=n[ve+4],H=n[ve+5],F=H1(oe,_e),X=H1(fe,Z),re=H1(_e,pe),k=H1(Z,H),Q=H1(oe,pe),te=H1(fe,H),W=24*D;N[W++]=F,N[W++]=X,N[W++]=re,N[W++]=k,N[W++]=Q,N[W++]=te,N[W++]=oe,N[W++]=fe,N[W++]=F,N[W++]=X,N[W++]=Q,N[W++]=te,N[W++]=_e,N[W++]=Z,N[W++]=re,N[W++]=k,N[W++]=F,N[W++]=X,N[W++]=pe,N[W++]=H,N[W++]=Q,N[W++]=te,N[W++]=re,N[W++]=k}}return{positions:E,faces:A,materialIndices:R,uvs:N}}var p3,nbe,ta,sbe,zX,MOe=V(()=>{le(),p3=1e4,nbe=class{constructor(e=1){this.subdivisions=e}modify(e){let t=function(r){let n=r.getAttribute("position");if(n===void 0)return console.error("SubdivisionModifier: Position attribute required for subdivision."),{positions:new Float64Array(0),faces:new Uint32Array(0),materialIndices:[],uvs:null};let s=r.getAttribute("uv"),a=r.getIndex(),o=n.count,l=new Map,u=new Uint32Array(o),h=[],d=0;for(let y=0;y<o;y++){let _=n.getX(y),b=n.getY(y),x=n.getZ(y),w=Math.round(_*p3),S=Math.round(b*p3),M=Math.round(x*p3),T=l.get(w);T===void 0&&(T=new Map,l.set(w,T));let E=T.get(S);E===void 0&&(E=new Map,T.set(S,E));let A=E.get(M);A===void 0&&(A=d++,E.set(M,A),h.push(_,b,x)),u[y]=A}let c=[],p=[],f=s===void 0?null:[],m=a!==null?a.count:o,g=(y,_)=>{let b=a!==null?a.getX(y):y,x=a!==null?a.getX(y+1):y+1,w=a!==null?a.getX(y+2):y+2;if(!(b<o&&x<o&&w<o))return;let S=u[b],M=u[x],T=u[w];S===M||M===T||T===S||(c.push(S,M,T),p.push(_),f!==null&&f.push(s.getX(b),s.getY(b),s.getX(x),s.getY(x),s.getX(w),s.getY(w)))},v=r.groups;if(v.length>0)for(let y=0;y<v.length;y++){let _=v[y],b=_.materialIndex===void 0?0:_.materialIndex,x=Math.max(_.start,0),w=Math.min(_.start+_.count,m);for(let S=x;S<w&&S+2<m;S+=3)g(S,b)}else for(let y=0;y+2<m;y+=3)g(y,0);return{positions:Float64Array.from(h),faces:Uint32Array.from(c),materialIndices:p,uvs:f===null?null:Float64Array.from(f)}}(e),i=this.subdivisions;for(;i-- >0;)t=TOe(t);return function(r,n){let{positions:s,faces:a,materialIndices:o,uvs:l}=r,u=s.length/3,h=a.length/3,d=new Float64Array(3*u);for(let v=0;v<h;v++){let y=3*a[3*v],_=3*a[3*v+1],b=3*a[3*v+2],x=s[b]-s[_],w=s[b+1]-s[_+1],S=s[b+2]-s[_+2],M=s[y]-s[_],T=s[y+1]-s[_+1],E=s[y+2]-s[_+2],A=w*E-S*T,R=S*M-x*E,N=x*T-w*M;d[y]+=A,d[y+1]+=R,d[y+2]+=N,d[_]+=A,d[_+1]+=R,d[_+2]+=N,d[b]+=A,d[b+1]+=R,d[b+2]+=N}for(let v=0;v<u;v++){let y=d[3*v],_=d[3*v+1],b=d[3*v+2],x=Math.sqrt(y*y+_*_+b*b)||1;d[3*v]=y/x,d[3*v+1]=_/x,d[3*v+2]=b/x}let c=3*h,p=new Float32Array(3*c),f=new Float32Array(3*c),m=l!==null&&l.length>0?new Float32Array(2*c):null;for(let v=0;v<c;v++){let y=3*a[v];p[3*v]=s[y],p[3*v+1]=s[y+1],p[3*v+2]=s[y+2],f[3*v]=d[y],f[3*v+1]=d[y+1],f[3*v+2]=d[y+2]}m!==null&&m.set(l.subarray(0,2*c));let g=new At;g.setAttribute("position",new It(p,3)),c>0&&(g.setAttribute("normal",new It(f,3)),g.setAttribute("color",new It(new Float32Array(3*c).fill(1),3))),m!==null&&g.setAttribute("uv",new It(m,2));for(let v=0;v<h;){let y=o[v],_=v;do v++;while(v<h&&o[v]===y);g.addGroup(3*_,3*(v-_),y)}return n.boundingBox!==null&&(g.boundingBox=n.boundingBox.clone()),n.boundingSphere!==null&&(g.boundingSphere=n.boundingSphere.clone()),g}(t,e)}}}),Fte=V(()=>{le(),MOe(),ta=new P,sbe=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i,r=e.geometry??t?.geometry??new At().copy(new Ph(100,100,100));t===void 0?(r.computeBoundingBox(),r.boundingBox.getSize(ta),i={width:ta.x,height:ta.y,depth:ta.z,subdivisions:0}):i=t.parameters;let n={...i,...e.parameters};return{parameters:{width:Math.abs(n.width),height:Math.abs(n.height),depth:Math.abs(n.depth),subdivisions:Math.abs(n.subdivisions)},geometry:r}}static build(e){let{width:t,height:i,depth:r,subdivisions:n}=e.parameters,s=e.geometry??new At().copy(new Ph(100,100,100)),a=s.userData.parameters;a===void 0?(s.boundingBox=function(l){let u=new fn,h=l.attributes.position;return h?(u.setFromBufferAttribute(h),u):(u.makeEmpty(),u)}(s),s.boundingBox.getSize(ta)):ta.set(a.width,a.height,a.depth),(t!==ta.x||i!==ta.y||r!==ta.z)&&s.scale(ta.x===0?1:t/ta.x,ta.y===0?1:i/ta.y,ta.z===0?1:r/ta.z);let o=s.originalGeometry;try{n>0?(o===void 0||a?.subdivisions!==n)&&(o===void 0&&(o=s),s=new nbe(n).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 e.geometry,Object.assign(s,{userData:{...e,type:"NonParametricGeometry"}})}static loadFromUrl(e,t,i){new $$(i).load(e,r=>{let n=this.normalizeInputs({geometry:r});r.boundingBox.getSize(ta);let s=100/ta.x;Object.assign(n.parameters,{width:100,height:ta.y*s,depth:ta.z*s}),t(this.build(n))})}}}),BH=V(()=>{Kg(),Gg(),zX=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:3},e.parameters);return{shape:e.shape&&e.shape instanceof hs?e.shape:new hs,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(e){let{width:t,height:i,spikes:r,cornerRadius:n,depth:s,extrudeBevelSize:a,extrudeBevelSegments:o}=e.parameters,l=e.shape,u=.5*t,h=.5*i,d=2*Math.PI/r;for(let p=0;p<r;p++){let f=d*p,m=0+Math.sin(f)*u,g=0+Math.cos(f)*h;l.addPoint(l.createPoint(m,g))}l.isClosed=!0;for(let p=0,f=l.points.length;p<f;p++)l.points[p].roundness=n;l.roundness=n,l.update();let c=Zg.create({shape:l,parameters:{roundness:n,depth:s,extrudeBevelSize:a,extrudeBevelSegments:o}});return Object.assign(c,{userData:{...e,type:"PolygonGeometry"}})}}});function LS(e,t,i){i.x=e.x*t.x,i.y=e.y,i.z=e.x*t.y}function GF(e,t,i,r,n,s){let a=obe.copy(t).sub(e),o=lbe.copy(i).sub(e),l=a.angleTo(o);if(a.normalize(),o.normalize(),r===n){let u=a.add(o).normalize();s.copy(e).addScaledVector(u,r/Math.sin(l/2))}else{let u=a.angleTo(o);s.copy(e),s.addScaledVector(a,n/Math.sin(u)),s.addScaledVector(o,r/Math.sin(u))}}function EOe(e,t,i){let r=e.clone().sub(t),n=i.clone().sub(t);return r.projectOnVector(n),r.add(t)}var abe,obe,lbe,zte,k4,hbe,ube,dbe,kte,kX,cbe,pbe,fbe,mbe,Vte=V(()=>{le(),abe=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,radialSegments:4,heightSegments:1,cornerRadius:0,cornerSegments:8,openEnded:!1},e.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(e){let{width:t,height:i,depth:r,radialSegments:n,heightSegments:s,openEnded:a,cornerRadius:o,cornerSegments:l}=e.parameters,u=new zte(.5*t,i,n,s,a,o,l),h=r/t;return h!==1&&u.scale(1,1,h),Object.assign(u,{userData:{...e,type:"PyramidGeometry"}})}},obe=new P,lbe=new P,zte=class extends At{constructor(e=.5,t=1,i=4,r=1,n=!1,s=0,a=4){super(),i=Math.floor(Math.max(3,i)),r=Math.floor(r),a=Math.floor(a);let o,l=[],u=[],h=[],d=[],c=0,p=t/2,f=Math.PI/i,m=e*Math.cos(Math.PI/i),g=2*Math.PI/i,v=(i-2)*Math.PI/i,y=Math.PI-v,_=new P(0,-p,0),b=new P(0,p,0),x=new J(e,-p),w=new J(m,-p),S=new J(0,b.y).sub(w),M=new J(0,b.y).sub(x),T=new J(S.y,-S.x).normalize(),E=new J(M.y,-M.x).normalize(),A=e*Math.cos(Math.PI/i)*Math.tan((Math.PI-S.angle())/2)-1e-8;s=Math.min(s,A);{let G=new P(T.x,T.y,0),j=new P(Math.cos(g)*G.x,G.y,Math.sin(g)*G.x);o=G.angleTo(j)}let R=s/Math.tan((Math.PI-S.angle())/2),N=s/Math.tan((Math.PI-o)/2),D=new P;if(!n){u.push(_.x,_.y,_.z),h.push(0,-1,0),d.push(0,0);let G=c++,j=[],K=x.clone(),q=R/Math.cos(Math.PI/i);K.x-=q;for(let se=0;se<i;se++){let ve=se/i*Math.PI*2+f;LS(K,new J(Math.sin(ve),Math.cos(ve)),D),u.push(D.x,D.y,D.z),h.push(0,-1,0),d.push(0,0),j.push(c++)}for(let se=0;se<j.length;se++)l.push(j[se],G,j[(se+1)%j.length])}let O=[];{let G=new P,j=new P,K=new P,q=new P,se=new P,ve=new P;for(let oe=0;oe<i;oe++){let fe=oe/i*Math.PI*2+f,_e=(oe+.5)/i*Math.PI*2+f,Z=(oe+1)/i*Math.PI*2+f,pe=new J(Math.sin(fe),Math.cos(fe)),H=new J(Math.sin(_e),Math.cos(_e)),F=new J(Math.sin(Z),Math.cos(Z));LS(x,pe,j),LS(x,F,K),LS(T,H,G),GF(b,j,K,N,N,q),u.push(q.x,q.y,q.z),GF(j,b,K,N,R,se),u.push(se.x,se.y,se.z),GF(K,j,b,R,N,ve),u.push(ve.x,ve.y,ve.z),h.push(G.x,G.y,G.z),h.push(G.x,G.y,G.z),h.push(G.x,G.y,G.z),d.push(0,0),d.push(0,0),d.push(0,0);let X=c++,re=c++,k=c++;if(l.push(X,re,k),s>0){{let W=j.clone().add(K).multiplyScalar(.5),he=b.clone().sub(W).normalize(),ce=_.clone().sub(W).normalize().add(he).normalize().multiplyScalar(-1);z(W,ve.clone().sub(se),ce,S.angle())}let Q,te;{let W=new P;LS(E,F,W);let he=ve.clone().add(q).multiplyScalar(.5);he=EOe(he,K,b);let ce=ve.clone().sub(q);[Q,te]=z(he,ce,W,o,q.y)}{let W=Q,he=W.clone().setY(0).normalize(),ce=new P(0,-1,0),Ee=he.clone().cross(ce);U(W,he,ce,Ee)}O.concat(te);{let W=S.angle(),he=Math.PI-W,ce=b.clone();ce.y-=s/Math.sin(W-Math.PI/2);let Ee=new P,Se=[];for(let Ne=0;Ne<a;Ne++){let He=[],Re=Math.PI/2-he*Ne/a,ee=Math.cos(Re),Me=Math.sin(Re),We=_e;for(let dt=0;dt<=Ne;dt++){let et=Math.cos(We),Yt=Math.sin(We);G.x=ee*Yt,G.y=Me,G.z=ee*et,Ee.copy(ce).addScaledVector(G,s),u.push(Ee.x,Ee.y,Ee.z),h.push(G.x,G.y,G.z),d.push(0,0),He.push(c++),We+=2*Math.PI/Ne/i}Se.push(He)}te.reverse(),Se.push(te);let qe=Se.length-1;for(let Ne=0;Ne<qe;Ne++){let He=Se[Ne],Re=Se[Ne+1],ee=He.length-1;l.push(Re[1],He[0],Re[0]);for(let Me=1;Me<=ee;Me++)l.push(He[Me],He[Me-1],Re[Me]),l.push(Re[Me+1],He[Me],Re[Me])}}}}}function z(G,j,K,q,se){let ve=-q/2,oe=(Math.PI-q)/2,fe=j.clone().normalize().cross(K);G.addScaledVector(K,-s/Math.sin(oe));let _e=new P,Z=new P,pe=c,H=[];for(let F=0;F<=a;F++){let X=ve+F/a*q;Z.set(0,0,0),Z.addScaledVector(fe,Math.sin(X)),Z.addScaledVector(K,Math.cos(X));for(let re=0;re<=1;re++){let k=re/1-.5;if(_e.copy(G),_e.addScaledVector(j,k),_e.addScaledVector(Z,s),se!=null){let Q=Math.max(0,_e.y-se);_e.addScaledVector(j,-Q/j.y)}u.push(_e.x,_e.y,_e.z),h.push(Z.x,Z.y,Z.z),d.push(0,0),re===0&&H.push(c),c++}}for(let F=0;F<a;F++)for(let X=0;X<1;X++){let re=pe+X+2*F,k=re+2,Q=k+1,te=re+1;l.push(re,k,te),l.push(k,Q,te)}return[G.clone().addScaledVector(j,.5),H]}function U(G,j,K,q){let se=Math.PI/2,ve=M.angle()-se,oe=[],fe=new P,_e=new P;for(let pe=0;pe<=a;pe++){let H=[],F=pe/a;for(let X=0;X<=pe;X++){let re=((pe?X/pe:0)-.5)*y,k=Math.cos(re),Q=Math.sin(re),te=(se+Math.atan(Math.tan(ve)*k))*F,W=Math.cos(te),he=Math.sin(te);fe.set(0,0,0),fe.addScaledVector(j,he*k),fe.addScaledVector(K,W),fe.addScaledVector(q,he*Q),_e.copy(G).addScaledVector(fe,s),u.push(_e.x,_e.y,_e.z),h.push(fe.x,fe.y,fe.z),d.push(0,0),H.push(c++)}oe.push(H)}let Z=oe.length-1;for(let pe=0;pe<Z;pe++){let H=oe[pe],F=oe[pe+1],X=H.length-1;l.push(H[0],F[1],F[0]);for(let re=1;re<=X;re++)l.push(H[re-1],H[re],F[re]),l.push(H[re],F[re+1],F[re])}}this.setIndex(l),this.setAttribute("position",new Et(u,3)),this.setAttribute("normal",new Et(h,3)),this.setAttribute("uv",new Et(d,2))}}}),bL=V(()=>{Kg(),Gg(),k4=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,cornerRadius:[0,0,0,0],cornerType:1,extrudeBevelSize:0,extrudeBevelSegments:1},e.parameters),r=Object.assign(t?.ui??{enabledIndieCorners:!1},e.ui);return{shape:e.shape&&e.shape instanceof hs?e.shape:new hs,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)}),ui:r}}static build(e){let t=e.shape,{width:i,height:r,cornerRadius:n,cornerType:s,depth:a,extrudeBevelSize:o,extrudeBevelSegments:l}=e.parameters,u={x:.5*i,y:.5*r},h={x:-u.x,y:-u.y},d={x:u.x,y:u.y};function c(b,x,w){return x>i&&w>r?Math.min(b*i/x,b*r/w):x>i?b*i/x:w>r?b*r/w:b}let p=[];p[0]=n[0]===0?0:c(n[0],n[0]+n[3],n[0]+n[1]),p[1]=n[1]===0?0:c(n[1],n[1]+n[2],n[1]+n[0]),p[2]=n[2]===0?0:c(n[2],n[2]+n[1],n[2]+n[3]),p[3]=n[3]===0?0:c(n[3],n[3]+n[0],n[3]+n[2]);let f=h.x,m=d.x,g=d.y,v=h.y;t.addPoint(t.createPoint(f,g)),t.addPoint(t.createPoint(m,g)),t.addPoint(t.createPoint(m,v)),t.addPoint(t.createPoint(f,v)),t.isClosed=!0;let y=!0;for(let b=0,x=t.points.length;b<x;b++)t.points[b].roundness=p[b],b>0&&p[b]!==p[b-1]&&(y=!1);y&&(t.roundness=p[0]),t.useCubicForRoundedCorners=s!==1,t.update();let _=Zg.create({shape:t,parameters:{depth:a,extrudeBevelSize:o,extrudeBevelSegments:l}});return Object.assign(_,{userData:{...e,type:"RectangleGeometry"}})}}}),Gte=V(()=>{le(),hbe=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180},e.parameters);return i.thetaLength=ht.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(e){let t,{width:i=100,height:r=i,depth:n=i,widthSegments:s=64,heightSegments:a=64,phiStart:o,phiLength:l,thetaStart:u,thetaLength:h}=e.parameters;return h===0?(t=new At,t.setAttribute("position",new Et([],3))):t=new Ff(.5*i,s,a,o,l,u,h*ht.DEG2RAD),t.scale(1,r/i,n/i),Object.assign(t,{userData:{...e,type:"SphereGeometry"}})}}}),jte=V(()=>{le(),ube=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,widthSegments:8,heightSegments:8},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:0})}}static build(e){let{width:t=100,height:i=t,widthSegments:r=8,heightSegments:n=8}=e.parameters,s=new qc(t,i,r,n);return s.scale(1,1,1),Object.assign(s,{userData:{...e,type:"PlaneGeometry"}})}}}),Hte=V(()=>{le(),dbe=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,angle:90,cornerRadius:24,cornerSegments:8},e.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(e){let{width:t,height:i,depth:r,angle:n,cornerRadius:s,cornerSegments:a}=e.parameters,o=new kte(t,i,r,n,s,a);return Object.assign(o,{userData:{...e,type:"BackdropGeometry"}})}},kte=class extends At{constructor(e=1,t=1,i=1,r=90,n=10,s=24){super(),this.type="BackdropGeometry";let a=[],o=[],l=[],u=.001;n==0&&(s=1),s=Math.max(1,Math.floor(s)),n=Math.min(n,100),r=Math.min(180-u,r),r*=Math.PI/180;let h=[],d=Math.PI/2,c=(_e=0,Z=0,pe=0)=>new P(_e,Z,pe),p=c(),f=c(),[m,g,v]=[t/2,e/2,i/2],y=-g,_=+g,[b,x,w]=[c(y,-m,+v),c(y,-m,-v),c(y,+m,-v)],S=(_e,Z=!1)=>Math.sin(_e-Math.PI/(+Z+1)),M=(_e,Z=!1)=>Math.cos(_e-Math.PI/(+Z+1));w.y=Math.sin(r)*t-m;let T=Math.cos(r)*t-v,E=b.z-u;r<=d?(w.z=Math.min(T,E),w.z==E&&(w.y-=(T-E)/Math.tan(d-r))):x.z=Math.min(x.z-T-v,b.z-u),p.subVectors(b,x),f.subVectors(w,x);let A=Math.min(p.length(),f.length())*n/100,R=A*Math.tan(r/2),N=A/Math.cos(r/2),D=p.clone().normalize().add(f.normalize()).setLength(N).add(x);p.set(0,S(r,!0),M(r,!0)),h.push([w,p.clone()]);let O=(Math.PI-r)/s;for(let _e=0;_e<=s;_e++){let Z=d+r+_e*O;p.set(0,Math.sin(Z)*R,Math.cos(Z)*R),p.add(D),f.set(0,S(Z),M(Z)),h.push([p.clone(),f.clone()])}h.push([b,c(0,1,0)]);let z=Math.sin(O/2)*R*2,U=h.length-1,G=h[0][0].distanceTo(h[1][0]),j=G+z*s+h[U-1][0].distanceTo(h[U][0]);h[0].push(1);for(let _e=0;_e<=s;_e++)h[_e+1].push(1-(G+_e*z)/j);h[U].push(0);let K,q,se,[ve,oe,fe]=h[0];for(let _e=1;_e<h.length;_e++)[K,q,se]=h[_e],a.push(y,ve.y,ve.z,y,K.y,K.z,_,ve.y,ve.z,_,ve.y,ve.z,y,K.y,K.z,_,K.y,K.z),o.push(0,oe.y,oe.z,0,q.y,q.z,0,oe.y,oe.z,0,oe.y,oe.z,0,q.y,q.z,0,q.y,q.z),l.push(0,fe,0,se,1,fe,1,fe,0,se,1,se),[ve,oe,fe]=[K,q,se];this.setAttribute("position",new Et(a,3)),this.setAttribute("normal",new Et(o,3)),this.setAttribute("uv",new Et(l,2))}}}),UH=V(()=>{Kg(),Gg(),kX=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,innerRadiusPercent:38.19,spikes:5,cornerRadius:0,angle:360,extrudeBevelSize:0,extrudeBevelSegments:1},e.parameters);return{shape:e.shape&&e.shape instanceof hs?e.shape:new hs,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(e){let{width:t,height:i,innerRadiusPercent:r,spikes:n,cornerRadius:s,angle:a,depth:o,extrudeBevelSize:l,extrudeBevelSegments:u}=e.parameters,h=e.shape,d=.5*t,c=.5*i,p=a*Math.PI/360/n,f=Math.PI/2*3*-1,m=d*r/100,g=c*r/100;if(n===3&&r===50){p=2*Math.PI/n;for(let y=0;y<n;y++){let _=p*y,b=0+Math.sin(_)*d,x=0+Math.cos(_)*c;h.addPoint(h.createPoint(b,x))}}else for(let y=0;y<n;y++){let _=0+Math.cos(f)*d,b=0+Math.sin(f)*c;h.addPoint(h.createPoint(_,b)),f+=p,_=0+Math.cos(f)*m,b=0+Math.sin(f)*g,h.addPoint(h.createPoint(_,b)),f+=p}h.isClosed=!0;for(let y=0,_=h.points.length;y<_;y++)h.points[y].roundness=s;h.roundness=s,h.update();let v=Zg.create({shape:h,parameters:{roundness:s,depth:o,extrudeBevelSize:l,extrudeBevelSegments:u}});return Object.assign(v,{userData:{...e,type:"StarGeometry"}})}}}),Wte=V(()=>{le(),cbe=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0},e.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(e){let{width:t,height:i}=e.parameters,r=new qc(t,i);return Object.assign(r,{userData:{...e,type:"TextFrameGeometry"}})}}}),qte=V(()=>{le(),cA(),pbe=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,radialSegments:32,tubularSegments:64,arc:360,cornerRadius:30,cornerSegments:8},e.parameters),r=Math.abs(i.width),n=Math.abs(i.height??i.width);i.shapeBlendNode&&(n=r);let s=Math.round(Math.abs(i.depth??.25*i.width));return{parameters:Object.assign(i,{width:r,height:n,depth:s})}}static build(e){let{width:t,height:i,depth:r,radialSegments:n,tubularSegments:s,arc:a,cornerRadius:o,cornerSegments:l}=e.parameters,u=function(h,d,c,p,f,m,g,v,y,_,b){[d,c]=[c,d],g=d/2;let x=ht.clamp(f/360,0,1);if(x===0){let w=new At;return w.setAttribute("position",new Et([],3)),w}return x===1&&(_=0),new SH(!0,h,d,c,p,x,m,g,0,y,_,b)}(t,i,r,.5*t,a,s,0,0,n,o,l);return u.scale(1,i/t,1),Object.assign(u,{userData:{...e,type:"TorusGeometry"}})}}}),$te=V(()=>{le(),fbe=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,tubularSegments:64,radialSegments:32,p:2,q:3},e.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(e){let{width:t,tube:i,tubularSegments:r,radialSegments:n,p:s,q:a}=e.parameters,o=.5*t;o!==i&&(o-=i);let l=new f7(o,i,r,n,s,a);return Object.assign(l,{userData:{...e,type:"TorusKnotGeometry"}})}}}),Xte=V(()=>{Kg(),Gg(),mbe=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1,isRect:!1},e.parameters);return{shape:e.shape&&e.shape instanceof hs?e.shape:new hs,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(e){let{width:t=100,height:i,cornerRadius:r,depth:n,extrudeBevelSize:s,extrudeBevelSegments:a,isRect:o}=e.parameters,l=e.shape,u=.5*t,h=.5*i;o?(l.addPoint(l.createPoint(-u,h)),l.addPoint(l.createPoint(u,-h)),l.addPoint(l.createPoint(-u,-h))):(l.addPoint(l.createPoint(0,h)),l.addPoint(l.createPoint(u,-h)),l.addPoint(l.createPoint(-u,-h))),l.isClosed=!0;for(let c=0,p=l.points.length;c<p;c++)l.points[c].roundness=r;l.roundness=r,l.update();let d=Zg.create({shape:l,parameters:{roundness:r,depth:n,extrudeBevelSize:s,extrudeBevelSegments:a}});return Object.assign(d,{userData:{...e,type:"TriangleGeometry"}})}}}),AOe=V(()=>{}),COe=V(()=>{le(),new qa,new Ve,new mf,new P,new P,new P,new P});function Yte(){let e=new At;return e.setAttribute("position",new It(new Float32Array([]),3)),e.setIndex(new It(new Uint16Array([]),1)),e}var Kte,FH,gbe=V(()=>{ha(),Wt(),bw(),le(),DA(),Kg(),Gg(),Kte=Yte().attributes,FH=class extends At{constructor(e,t){super(),this.isTextGeometry=!0,this.charWidths=[],this.charCoords=[],this.wrappedText=[],this.isLowResolution=!1,this.vectorShapes=[],Object.assign(this.attributes,Kte),this.userData={parameters:e,type:"TextGeometry"};let i=t.getFont(e.font);i?.isLoaded?(this.font=i,this.update(e,t)):this.updateFont(e.font,t).then(()=>{this.update(e,t),t?.requestRender()})}async updateFont(e,t){let i=t.getFont(e);i&&(this.font=i,await i.loadingPromise)}update(e,t){let i=this.font;if(this.userData={parameters:e,type:"TextGeometry"},!i?.isLoaded)return void console.warn("Cannot update text because its font is not loaded");let{width:r,height:n,depth:s,extrudeBevelSize:a,extrudeBevelSegments:o,text:l,textTransform:u}=e,h=Eo.getDisplayedValue(l),d=function(b,x,w,S){let M=typeof b.width=="string"?Number(S.getVariable(b.width)):b.width,T=[""],E="";for(let A of w)E+=A,A===" "||A===`
4168
4168
  `?(T[T.length-1]+=E,E="",A===`
4169
- `&&T.push("")):x.getTextWidth(T[T.length-1]+E,b)>M&&(T[T.length-1].length&&T.push(""),x.getTextWidth(T[T.length-1]+E,b)>M&&(E.length===1?(T[T.length-1]+=E,E=""):(T[T.length-1]+=E.slice(0,-1),E=E[E.length-1],T.push(""))));return T[T.length-1]+=E,T}(e,i,u===2?h.toUpperCase():u===3?h.toLowerCase():h,t),{shapes:c,charWidths:p,charCoords:f}=i.generateShapes(d,e,t),m=.5*(typeof r=="number"?r:Number(t.getVariable(r))),g=.5*(typeof n=="number"?n:Number(t.getVariable(n))),v=c.map(b=>new hs().fromShape(b,!0));this.vectorShapes=v;let y=v.map(b=>Zg.create({shape:b,parameters:{depth:s,extrudeBevelSegments:o,extrudeBevelSize:a,windingRule:s<=0?xn.NONZERO:xn.ODD,subdivisions:this.isLowResolution&&s>0?1:12}})),_=y.length?Kv(y):Yte();_.translate(-m,g,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 e=Ho(new At,FH.prototype);return e.copy(this),console.log("CloneGeometry",this,e),e}copy(e){return Object.entries(e.attributes).forEach(([t,i])=>{this.setAttribute(t,i)}),this.setIndex(e.index),this.userData={parameters:{...e.userData.parameters},type:"TextGeometry"},this}async setText(e,t){this.font&&await this.font.loadingPromise,await this.update({...this.userData.parameters,text:{textValue:e}},t)}get text(){return this.userData.parameters.text??""}}});function ROe(e){if(!zH)return Zte||(Zte=async function(){let t=e??"https://cdn.spline.design/@splinetool/runtime@2.0.35/build",i=import("./process.js"),[r,n]=await Promise.all([i,fetch(`${t}/process.wasm`).then(o=>o.arrayBuffer())]),s=r.default,a=await s({wasmBinary:n});vbe(a),zH=!0}())}var vbe,VX,zH,Zte,V4=V(()=>{VX=new Promise(e=>{vbe=e}),zH=!1});function jF(e,t){if(Object.keys(e.morphAttributes).length>0||Object.keys(t.morphAttributes).length>0)return!1;let i=Object.keys(e.attributes),r=Object.keys(t.attributes);if(i.length!==r.length)return!1;for(let o of r){let l=e.attributes[o],u=t.attributes[o];if(l===void 0||l.isInterleavedBufferAttribute===!0||u.isInterleavedBufferAttribute===!0||l.itemSize!==u.itemSize||l.normalized!==u.normalized||l.array.constructor!==u.array.constructor||l.array.length!==u.array.length)return!1}let n=e.index,s=t.index;if(n===null!=(s===null))return!1;let a=!1;if(n!==null&&s!==null){if(n.array.length!==s.array.length)return!1;let o=n.array.constructor,l=s.array.constructor;if(o!==l){if(o!==Uint32Array||l!==Uint16Array)return!1;a=!0}}if(e.groups.length!==t.groups.length)return!1;for(let o=0;o<t.groups.length;o++){let l=e.groups[o],u=t.groups[o];if(l.start!==u.start||l.count!==u.count||l.materialIndex!==u.materialIndex)return!1}for(let o of r){let l=e.attributes[o],u=t.attributes[o];l.array.set(u.array),l.needsUpdate=!0}if(n!==null&&s!==null){if(a){let o=n.array,l=s.array;for(let u=0,h=l.length;u<h;u++){let d=l[u];o[u]=d===65535?4294967295:d}}else n.array.set(s.array);n.needsUpdate=!0}return e.drawRange.start=t.drawRange.start,e.drawRange.count=t.drawRange.count,e.userData=t.userData,e.boundingBox=null,e.boundingSphere=null,!0}function kH(e,t,i,r){let n,s,a,o=e.position.array,l=e.normal.array,u=ybe.makeScale(t,i,r).invert().elements;for(let h=0,d=o.length;h<d;h+=3)o[h]*=t,o[h+1]*=i,o[h+2]*=r,n=l[h],s=l[h+1],a=l[h+2],l[h]=u[0]*n+u[4]*s+u[8]*a,l[h+1]=u[1]*n+u[5]*s+u[9]*a,l[h+2]=u[2]*n+u[6]*s+u[10]*a;e.position.needsUpdate=!0,e.normal.needsUpdate=!0}var ybe,_be=V(()=>{le(),ybe=new Ve});function VH(e){let t=Number(e);return Number.isInteger(t)&&t>=0&&String(t)===e?t:-1}function f3(e){if(e!=null){if(Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView))return e;if(typeof e=="object")return function(t){let i=Object.keys(t),r=0;for(let s of i){let a=VH(s);a>=r&&(r=a+1)}if(r===0||r>i.length)return;let n=new Array(r);for(let s=0;s<r;s++){let a=t[s];if(typeof a!="number")return;n[s]=a}return n}(e)}}function HF(e){if(e==null)return"missing";if(Array.isArray(e))return`Array(${e.length})`;if(ArrayBuffer.isView(e)){let l=e;return`${e.constructor.name}(${l.length})`}if(typeof e!="object")return typeof e;let t=Object.keys(e),i=t.filter(l=>VH(l)===-1),r=0;for(let l of t){let u=VH(l);u>=r&&(r=u+1)}let n=e,s=-1,a=-1;for(let l=0;l<r;l++)l in n?typeof n[l]!="number"&&a===-1&&(a=l):s===-1&&(s=l);let o=[`${t.length} keys`,"max index "+(r-1)];return s!==-1&&o.push(`first missing index ${s}`),a!==-1&&o.push(`non-number at ${a} (${typeof n[a]})`),i.length&&o.push(`stray keys ${i.slice(0,3).join(",")}`),`Object{${o.join(", ")}}`}function bbe(e){let t=Object.keys(e);return t.length===1&&t[0]==="subdivisions"}function GX(e,t){let i=t?t.count:e.count,r=0,n=1e4,s=new Map,a=new Uint32Array(i),o=[];for(let h=0;h<i;h++){let d=t?t.getX(h):h,c=e.getX(d),p=e.getY(d),f=e.getZ(d),m=Math.round(c*n),g=Math.round(p*n),v=Math.round(f*n),y=s.get(m);y===void 0&&(y=new Map,s.set(m,y));let _=y.get(g);_===void 0&&(_=new Map,y.set(g,_));let b=_.get(v);b===void 0&&(b=r++,_.set(v,b),o.push(c,p,f)),a[h]=b}let l=[],u=[];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]),u.push(t?t.getX(h):h,t?t.getX(h+1):h+1,t?t.getX(h+2):h+2));return{positions:o,triIndices:l,triOriginals:u}}var BS,R0,ri,WF,qF,$F,ls,US,m3,g3,v3,GH,gI,xw=V(()=>{le(),V4(),Wt(),G4(),_be(),cA(),BS=new fn,R0=new P,VX.then(e=>{ri=e}),WF=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),qF=new Uint32Array([0,1,2,3]),$F=new Uint8Array([4]),ls=class extends At{constructor(e,t){super(),this.data=e,this.flatShading=t,this.subdivPointer=0,this.rebuild(),this.freeSubdivPointer()}mutateDirectlyScaleBaked(e,t){this.freeSubdivPointer();let i=this.data.scaleBaked.map(a=>typeof a=="number"?a:1),r=Og.div(t.map(a=>typeof a=="number"?a:0),i);if(r.every(a=>a===1))return;this.subdividedGeometry&&kH(this.subdividedGeometry.attributes,...r),this.originalGeometry&&kH(this.originalGeometry.attributes,...r),this.data=e;let n=this.userData.parameters;this.userData.parameters={width:n.width*r[0],height:n.height*r[1],depth:n.depth*r[2]},this.originalGeometry.boundingSphere.center.multiply(R0.fromArray(r));let s=R0.set(n.width,n.height,n.depth).length();this.originalGeometry.boundingSphere.radius=s/2}ensureSubdivPointer(){return this.subdivPointer===0&&this.rebuild(),this.subdivPointer}mutateDirectlySubdivisions(e){this.freeSubdivPointer(),this.data=e;let t=e.phongAngle??35;this.flatShading&&(t=-1);let i=null;if(e.subdivisions>0){let n=0;try{n=ls.allocate(e),i=ls.buildRefined(n,e.subdivisions,t)}catch(s){console.error(s,e)}finally{n&&ls.freeSubdivPointer(n)}}this.subdividedGeometry?.dispose(),this.subdividedGeometry=i??void 0,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere);let r=this.userData.parameters;Object.assign(this,this.subdividedGeometry??this.originalGeometry),this.userData.parameters=r}rebuild(){let e,t,i;try{({originalGeometry:e,subdividedGeometry:t,subdivPointer:i}=ls.build(this.data,void 0,!this.flatShading,void 0))}catch{e=new Ph(100,100,100),i=0}this.subdivPointer=i,this.originalGeometry=e,this.subdividedGeometry=t??void 0;let r=this.subdividedGeometry??this.originalGeometry;Object.assign(this,r),this.calcBoundingBox()}freeSubdivPointer(){this.subdivPointer&&(ls.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0)}dispose(){super.dispose(),this.freeSubdivPointer()}calcBoundingBox(){let e=this.originalGeometry;e.boundingSphere===null&&(e.boundingSphere=new qa,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=e.boundingSphere));let t=e.attributes.position,i=e.boundingSphere.center;BS.setFromBufferAttribute(t),BS.getCenter(i),e.boundingSphere.radius=i.distanceTo(BS.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),BS.getSize(R0);let r={width:R0.x,height:R0.y,depth:R0.z};return this.userData.parameters=r,r}static build(e,t,i,r){let n,s,a=e?.phongAngle??35;i===!1&&(a=-1),t&&(ri.free_bvh(t),ri.free_subdivision_surface(t));try{n=ls.allocate(e,r)}catch(l){console.error(l,e),n=ls.allocate({positionWASM:WF,indexWASM:qF,verticesPerFaceWASM:$F},r)}ri.set_destination_refinement_level(n,0);let o=ls.buildLevel(n,!0,a);return s=e.subdivisions>0?ls.buildRefined(n,e.subdivisions,a):null,{subdivPointer:n,originalGeometry:o,subdividedGeometry:s}}static buildRefined(e,t,i){try{return ri.set_destination_refinement_level(e,t),ls.buildLevel(e,!1,i)??null}catch{try{return ri.set_destination_refinement_level(e,t-1),ls.buildLevel(e,!1,i)??null}catch{return null}}}static primitiveToQuads(e,t,i){e.widthSegments>16&&(e.widthSegments=16),e.heightSegments>16&&(e.heightSegments=16),e.depthSegments>16&&(e.depthSegments=16),e.radialSegments>16&&(e.radialSegments=16),e.type==="DodecahedronGeometry"&&(e.detail=0);let r,n=e.shape!==void 0||e.path!==void 0?t.geometry:Cg(e,i,!1,t);r=b_e(e)?n.getClosedTorusIndicesForBooleanOrSubdiv():n.getIndex();let s,{positions:a,triIndices:o,triOriginals:l}=GX(n.getAttribute("position"),r);if(e.type==="CylinderGeometry"&&e.cornerRadius===0&&e.hollow===0&&e.openEnded===!1){let c=e.radialSegments*e.heightSegments*3*2;s=[c,c+3*e.radialSegments]}let{indices:u,verticesPerFace:h,uvs:d}=function(c,p,f,m,g){let v=[],y=[],_=g?f.getAttribute("uv"):void 0,b=_&&_.itemSize===2?[]:void 0,x=M=>{if(b){let T=g[M];b.push(_.getX(T),_.getY(T))}};if(f.userData.shape!==void 0&&f.userData.parameters.depth===0&&f.userData.shape.shapeHoles.length===0){let M=f.userData.shape.extractShapePointsToFlatArray([]),T=f.userData.parameters.spikes;if(f.userData.type==="EllipseGeometry"&&T<=24&&T%4==0&&f.userData.parameters.angle>=360){let R=M.length/2/T;M=M.filter((N,D)=>Math.floor(D/2)%R===0)}let E=0;for(let R=0;R<M.length;R+=2)E+=(M[R]-M[(R===0?M.length:R)-2])*(M[R+1]+M[(R===0?M.length:R)-1]);c.length=0;let A=0;if(E<0)for(let R=0;R<M.length;R+=2)c.push(M[R],M[R+1],0),v.push(A++);else for(let R=M.length-2;R>=0;R-=2)c.push(M[R],M[R+1],0),v.push(A++);return y.push(A),{indices:v,verticesPerFace:y}}let w=new Float32Array([f.userData.parameters.depth])[0],S=0;for(;S<p.length;){if(f.useNgonForTopBottomFaceDuringBake){let M=0;if((c[3*p[S]+2]===w||c[3*p[S]+2]===0)&&M++,(c[3*p[S+1]+2]===w||c[3*p[S+1]+2]===0)&&M++,(c[3*p[S+2]+2]===w||c[3*p[S+2]+2]===0)&&M++,M===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]){US.set(c[3*p[S]],c[3*p[S]+1],c[3*p[S]+2]),m3.set(c[3*p[S+1]],c[3*p[S+1]+1],c[3*p[S+1]+2]),g3.set(c[3*p[S+4]],c[3*p[S+4]+1],c[3*p[S+4]+2]),v3.set(c[3*p[S+5]],c[3*p[S+5]+1],c[3*p[S+5]+2]),m3.sub(US).normalize(),g3.sub(US).normalize(),v3.sub(US).normalize();let M=m3.cross(g3).dot(v3),T=S;Math.abs(M)>.005||m&&m.some((E,A)=>A%2!=1&&T>=m[A]&&T<m[A+1])?(v.push(p[S],p[S+1],p[S+2]),x(S),x(S+1),x(S+2),y.push(3),S+=3):(v.push(p[S],p[S+1],p[S+4],p[S+5]),x(S),x(S+1),x(S+4),x(S+5),y.push(4),S+=6)}else v.push(p[S],p[S+1],p[S+2]),x(S),x(S+1),x(S+2),y.push(3),S+=3}if(f.useNgonForTopBottomFaceDuringBake){let M=[],T=[],E=0;for(let A=0,R=0;A<c.length;A+=3,R++)c[A+2]===0&&(M.push(R),E++),c[A+2]===w&&T.push(R);if(f.userData.parameters.extrudeBevelSize===0){let A=T[0];T[0]=T[1],T[1]=A}M.reverse(),v.push(...M,...T),y.push(E,E),b=void 0}return{indices:v,verticesPerFace:y,uvs:b}}(a,o,n,s,l);return{positions:a,indices:u,verticesPerFace:h,uvs:d}}static allocate(e,t){let i,r,n,s=[],a=[],o=f3(e.positionWASM),l=f3(e.indexWASM),u=f3(e.verticesPerFaceWASM);if(o&&o.length>0){if(!l?.length||!u?.length)throw new Error(`SubdivGeometry.allocate: unusable cage topology \u2014 positionWASM ${HF(e.positionWASM)}, indexWASM ${HF(e.indexWASM)}, verticesPerFaceWASM ${HF(e.verticesPerFaceWASM)}`);i=o,r=l,n=u;let S=f3(e.uvWASM);ri.alloc_subdivision_surface_uvs&&S&&S.length===2*r.length&&(a=S)}else i=WF,r=qF,n=$F;let h=i.length,d=r.length,c=n.length,p=i.length+s.length+a.length,f=r.length+n.length,m=p*Float32Array.BYTES_PER_ELEMENT+f*Uint32Array.BYTES_PER_ELEMENT,g=p*Float32Array.BYTES_PER_ELEMENT,v=ri._malloc(m);if(!v)throw new Error(`SubdivGeometry.allocate: wasm _malloc(${m}) failed`);let y,_=new Float32Array(ri.HEAPF32.buffer,v,p),b=new Uint32Array(ri.HEAPU32.buffer,v+g,f);_.set(i,0),_.set(s,i.length),_.set(a,i.length+s.length),b.set(r,0),b.set(n,r.length),e?.scaleBaked?.some(S=>S!==1)&&(y=new Ve().makeScale(...e.scaleBaked.map(S=>typeof S=="number"?S:1))),t&&(y?y.premultiply(t):y=t);let x=v+(i.length+s.length)*Float32Array.BYTES_PER_ELEMENT,w=a.length?y?ri.alloc_subdivision_surface_uvs2(v,h,v+g,d,v+g+r.length*Uint32Array.BYTES_PER_ELEMENT,c,x,a.length,y.elements):ri.alloc_subdivision_surface_uvs(v,h,v+g,d,v+g+r.length*Uint32Array.BYTES_PER_ELEMENT,c,x,a.length):y?ri.alloc_subdivision_surface2(v,h,v+g,d,v+g+r.length*Uint32Array.BYTES_PER_ELEMENT,c,y.elements):ri.alloc_subdivision_surface(v,h,v+g,d,v+g+r.length*Uint32Array.BYTES_PER_ELEMENT,c);return ri._free(v),w}static buildLevel(e,t,i,r,n,s=!1){let a=n?ri.get_mesh_data2(e,t?ri.Level.CONTROL:ri.Level.REFINED,i,n.elements):ri.get_mesh_data(e,t?ri.Level.CONTROL:ri.Level.REFINED,i),o=ri.HEAPU32.subarray(a>>2,10+(a>>2)),l=o.subarray(4,8),u=0,h=ri.HEAPU32[o[u]>>2],d=ri.HEAPF32.subarray(h>>2,(h>>2)+l[u]);u++;let c=ri.HEAPU32[o[u]>>2],p=ri.HEAPF32.subarray(c>>2,(c>>2)+l[u]);u++;let f=ri.HEAPU32[o[u]>>2],m=ri.HEAPU32.subarray(f>>2,(f>>2)+l[u]);u++;let g,v=ri.HEAPU32[o[u]>>2],y=ri.HEAPU32.subarray(v>>2,(v>>2)+l[u]);if(u++,ri.alloc_subdivision_surface_uvs){let b=o[9];if(b>0){let x=ri.HEAPU32[o[8]>>2];g=ri.HEAPF32.subarray(x>>2,(x>>2)+b)}}if(r===void 0){let b=new At;if(b.setIndex(new Uf(y,1)),b.setAttribute("position",new Et(d,3)),b.setAttribute("normal",new Et(p,3)),g&&b.setAttribute("uv",new Et(g,2)),t){b.setAttribute("faceMap",new Uf(m,1));let x=new Float32Array(p.length/3*4).fill(0);b.setAttribute("color",new It(x,4))}return ri.free_mesh_data(a),b.userData.type="SubdivGeometry",b}if(r.getAttribute("position").copyArray(d),r.getAttribute("normal").copyArray(p),r.attributes.position.needsUpdate=!0,r.attributes.normal.needsUpdate=!0,s){let b=r.getIndex();b!==null&&b.array.length===y.length&&(b.copyArray(y),b.needsUpdate=!0)}let _=r.getAttribute("uv");g&&_&&_.array.length===g.length&&(_.copyArray(g),_.needsUpdate=!0),ri.free_mesh_data(a)}static freeSubdivPointer(e){ri.free_bvh(e),ri.free_subdivision_surface(e)}static buildControlCageWireframe(e,t,i){let r=ri.get_wireframe_data_for_base_level(e),n=ri.HEAPU32.subarray(r>>2,4+(r>>2)),s=n.subarray(2,4),a=0,o=ri.HEAPU32[n[a]>>2],l=ri.HEAPF32.subarray(o>>2,(o>>2)+s[a]);a++;let u=ri.HEAPU32[n[a]>>2],h=ri.HEAPU32.subarray(u>>2,(u>>2)+s[a]);if(t===void 0){let d=new At;d.setAttribute("position",new Et(l,3));let c=new Float32Array(l.length);for(let p=0,f=l.length;p<f;)c[p++]=i.r,c[p++]=i.g,c[p++]=i.b;return d.setAttribute("color",new It(c,3)),d.setIndex(new Uf(h,1)),ri.free_wireframe_data_for_base_level(r),d}t.getAttribute("position").copyArray(l),t.attributes.position.needsUpdate=!0,ri.free_wireframe_data_for_base_level(r)}static updateCollabMesh(e,t,i){let r=t===0;r||ri.set_destination_refinement_level(e,t);let n=i?ri.get_topological_data2(e,r?ri.Level.CONTROL:ri.Level.REFINED,i.elements):ri.get_topological_data(e,r?ri.Level.CONTROL:ri.Level.REFINED),s=ri.HEAPU32.subarray(n>>2,8+(n>>2)),a=s.subarray(3,6),o=0,l=ri.HEAPU32[s[o]>>2],u=new Float32Array(ri.HEAPF32.subarray(l>>2,(l>>2)+a[o]));o++;let h=ri.HEAPU32[s[o]>>2],d=new Uint32Array(ri.HEAPU32.subarray(h>>2,(h>>2)+a[o]));o++;let c,p=ri.HEAPU32[s[o]>>2],f=new Uint8Array(ri.HEAPU32.subarray(p>>2,(p>>2)+a[o]));if(ri.alloc_subdivision_surface_uvs){let m=s[7];if(m>0){let g=ri.HEAPU32[s[6]>>2];c=new Float32Array(ri.HEAPF32.subarray(g>>2,(g>>2)+m))}}return ri.free_topological_data(n),{positions:u,indices:d,verticesPerFace:f,uvs:c}}},US=new P,m3=new P,g3=new P,v3=new P}),xbe=V(()=>{_te(),bte(),gL(),xte(),_L(),cA(),Bte(),Ute(),Fte(),BH(),Vte(),bL(),Gte(),jte(),Hte(),UH(),Wte(),qte(),$te(),Xte(),Gg(),_r(),_te(),bte(),gL(),xte(),_L(),AOe(),cA(),Bte(),Ute(),Fte(),BH(),Vte(),bL(),Gte(),jte(),Hte(),UH(),Wte(),qte(),$te(),Xte(),Gg(),COe(),Q_e(),gbe(),xw(),V4(),U4(),GH={ConeGeometry:z_e,CubeGeometry:k_e,CylinderGeometry:BX,DodecahedronGeometry:V_e,EllipseGeometry:z4,HelixGeometry:x_e,IcosahedronGeometry:ibe,LatheGeometry:rbe,NonParametricGeometry:sbe,PolygonGeometry:zX,PyramidGeometry:abe,RectangleGeometry:k4,SphereGeometry:hbe,PlaneGeometry:ube,BackdropGeometry:dbe,StarGeometry:kX,TextFrameGeometry:cbe,TorusGeometry:pbe,TorusKnotGeometry:fbe,TriangleGeometry:mbe,VectorGeometry:Zg},gI=e=>{let t=GH[e.type]??o_e(e.type);if(t===void 0)throw new Error(`No geometry factory registered for "${e.type}" \u2014 was its feature compiled out of this runtime build?`);return t.create(e)}});function Cg(e,t,i,r){let n,s,a;e.type==="PathGeometry"?(s=JSON.parse(JSON.stringify(e)),a=[[],["extrusion"]]):(s={...e},a=[[]]);for(let u of a){let h=s;for(let d of u)h=h[d];for(n in h){let d=h[n];zJ(d)&&!wbe.includes(n)&&(h[n]=t.getVariable(d,[r.uuid,"geometry",...u,n]),zJ(h[n])&&(h[n]=1))}}let o,l={parameters:s,type:s.type};if(s.type==="PathGeometry")l.path=s.path;else if(s.type==="VectorGeometry"){let u=hs.createFromState(s.shape,s.width,s.height);l.shape=u}else if(s.type==="NonParametricGeometry"){if(s.data.groups&&s.data.groups?.forEach(u=>u.materialIndex=Math.max(u.materialIndex??0,0)),l.geometry=new $$().parse(s),l.geometry.groups.length===0){let u=l.geometry;u.addGroup(0,Math.max(u.getIndex()?.count??0,u.getAttribute("position").count),0)}}else{if(s.type==="SubdivGeometry"){let u=new ls(s,i);return u.data=e,u}if(s.type==="TextGeometry"||s.type==="InputGeometry"){let u=o_e(s.type);if(u)return u.create(s,t);Ma("text",`a ${s.type}`);let h=hs.createFromState(lA.defaultData(),100,100);return gI({...s,shape:h,type:"VectorGeometry"})}if(s.type==="UIGeometry")return k4.create({parameters:{width:s.width,height:s.height,cornerRadius:s.cornerRadius,cornerType:s.cornerType}})}try{o=gI(l)}catch(u){console.error(u),console.error(`Error generating geometry with inputs: ${l}`);let h=hs.createFromState(lA.defaultData(),100,100);l.shape=h,l.type="VectorGeometry",o=gI(l)}return o}var wbe,Qte,jH,G4=V(()=>{Wt(),le(),xbe(),_r(),bL(),Kg(),xw(),wbe=["font"]}),POe=V(()=>{G4(),Qte=class{constructor(){this.objects=new Map,this.unreachable=new Set}getCached(e){return this.objects.get(e)}get size(){return this.objects.size}get(e,t,i){let r=this.objects.get(e);return r===void 0?(r=this.createObject(e,t,i),this.objects.set(e,r)):r.isShared=!0,r}forceDelete(e){let t=this.objects.get(e);t&&(this.disposeObject(t),this.objects.delete(e))}adopt(e,t){this.objects.set(e,t)}mutateIfUnique(e,t){let i=this.objects.get(e);if(i&&i.isShared!==!0)return this.objects.delete(e),this.objects.set(t,i),i}startGc(){this.unreachable=new Set(this.objects.keys())}markAsReachable(e,t){t===this.objects.get(e)&&this.unreachable.delete(e)}endGc(){this.unreachable.forEach(e=>{this.disposeObject(this.objects.get(e)),this.objects.delete(e)}),this.unreachable.clear()}dispose(){this.objects.forEach(e=>{this.disposeObject(e)}),this.objects.clear()}},jH=class extends Qte{constructor(e){super(),this.flatShading=e}disposeObject(e){e.dispose()}createObject(e,t,i){let r=Cg(e,t,this.flatShading,i);return r.computeBoundingSphere(),r}}});function xL(){return LA}function Sbe(){if(LA==="webgpu"){if(WH!==void 0)return WH;$H||($H=!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(qH===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 qH}function Tbe(e,t){return Sbe().createRootMaterial(e,t)}function Jte(e,t,i){return Sbe().createSharedMaterial(e,t,i)}function eie(e){return e.getLayersOfType===void 0&&Object.assign(e,{layers:[],getLayersOfType:()=>[],hasAO:!1,assetsLoaded:()=>!0}),e}function HH(){return Ebe}var LA,WH,qH,$H,XH,Mbe,Ebe,YH,Abe,$f=V(()=>{LA="webgl",$H=!1}),DOe=V(()=>{Abe={markNeedsUpdateRendererDirty:()=>{}}});function xd(e,t){let i=0;if(!e.layers||e.layers.length===0)return!1;let r=e.layers?.find(n=>n.data.type==="light");if(r){let n=r.data,s=Number(t.getVariable(n.alphaOverride));if((typeof n.alphaOverride=="string"?s/100:n.alphaOverride)<1)return!0}for(let n of e.layers){if(n.data.type!=="displace"&&n.data.isMask)return!0;if(n.data.type!=="displace"&&"alpha"in n.data&&n.data.type!=="light"&&n.data.type!=="fresnel"&&n.data.type!=="cavity"&&n.data.type!=="dust"&&n.data.type!=="texture"&&n.data.type!=="matcap"&&n.data.type!=="rainbow"&&n.data.type!=="outline"&&n.data.type!=="pattern"){let s=n.data.visible?n.data.alpha:0;if(typeof s=="string"&&(s=Math.max(0,Math.min(1,Number(t.getVariable(s)??100)/100))),s===1&&n.data.type==="depth"||n.data.type==="gradient"){for(let a of n.data.colors)if(a[3]<1){s=a[3];break}}else if(s===1&&n.data.type==="noise"){let a=t.color(n.data.colorA).a,o=t.color(n.data.colorB).a,l=t.color(n.data.colorC).a,u=t.color(n.data.colorD).a,h=Math.min(a,Math.min(o,Math.min(l,u)));h<1&&(s=h)}i+=(1-i)*s}}return i<1}var j4=V(()=>{});function zf(e){return typeof e=="string"||typeof e=="number"&&e!==0}var Ih,Lt,ww,jX,tie,iie,Rh,Md=V(()=>{Ih=(e,t,i)=>Math.max(0,Math.min(1,Number(t.getVariable(typeof e=="number"?100*e:e,i)??100)/100))??1,Lt=(e,t,i)=>typeof e=="number"?e:t.getVariable(e,i),ww={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"]},jX={depth:["colors"],gradient:["colors","steps"],toon:["colors","steps"]}}),Sw=V(()=>{le(),OA(),tie=class extends O4(un){},iie=e=>e.type==="Mesh",Rh=class extends tie{constructor(e){super(),this.object=e,this.isClone=!0,this.matrixAutoUpdate=!1,this.hasNonUniformScale=e.hasNonUniformScale}raycast(e,t){}expand(){let e=0,t=this.object.entityChildren(e);for(;t;){let i=this.children[e];i?.object!==t&&(i&&this.remove(i),i=new Rh(t),this.add(i),this.children.splice(e,0,this.children.pop()),i.matrixWorldNeedsUpdate=!0,i.matrixAutoUpdate=!1,i.matrix=t.matrix,i.hiddenMatrix=t.hiddenMatrix,i.pivotMatrix=t.pivotMatrix),i.expand(),e+=1,t=this.object.entityChildren(e)}for(;this.children.length>e;)this.remove(this.children[e]);this.pivotMatrix=this.object.pivotMatrix}get visible(){let e=this.object.cloner;return(e===void 0||this.parent!==e||!e.instancingActive&&!e.insideBoolean)&&(this.playModeVisible!==void 0?this.playModeVisible:this.object.visible||this.object.dataPatched.visible&&this.object.dataPatched.cloner?.hideBase===!0)}set visible(e){}get castShadow(){return this.object.castShadow}set castShadow(e){}get receiveShadow(){return this.object.receiveShadow}set receiveShadow(e){}get isMesh(){return iie(this.object)}get isLight(){return this.object.isLight}get layers(){return this.object.layers}set layers(e){}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(e){}}});function rie(){return HX}var HX,WX,qX=V(()=>{HX=null,WX=null});function KH(e){return"variable_"+e}var XF,YF,KF,nie,ZF,sie,aie,wL,$X=V(()=>{Wt(),P_e(),L_e(),F4(),bu(),IX(),LX(),POe(),$f(),N_e(),DOe(),j4(),Md(),xl(),Sw(),Nr(),le(),qX(),_r(),XF=new Ve,YF=new P,KF=new jt,nie=new P,ZF=new Kr,sie=class extends C_e{constructor(e){super(),this.shared=e}create(e){return new NX(e,this.shared)}},(wL=aie=class{constructor(e,t={},i=!0,r=!1){if(this.data=e,this.needsJitter=i,this.enableLocalStorageForPersistentVariables=r,this.geometryCache=new jH(!0),this.geometryCache2=new jH(!1),this.imageHolderCache=new sie(this),this.thisContext={scene:Abe,shared:this},this.deletedImage=new Rc(hH.emptyImage,this),this.deletedVideo=new Rc(JO.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,t.images)for(let[n,s]of Object.entries(t.images))this.addImage(n,s);if(t.videos)for(let[n,s]of Object.entries(t.videos))this.addVideo(n,s);if(t.audios)for(let[n,s]of Object.entries(t.audios))this.addAudio(n,s);if(t.particles)for(let[n,s]of Object.entries(t.particles))this.addParticle(n,s);this.reset(e)}get deletedMaterial(){return this._deletedMaterial??(this._deletedMaterial=Jte(is.defaultTwoLayerData("phong"),this.thisContext,"")),this._deletedMaterial}setRequestRender(e){this._requestRender=e}getImageLoadPromises(){return Object.values(this.images).map(e=>e.loadPromise)}setEntityOpContext(e){this.entityOpContext=e}reset(e,t=!1,i=!1){this.data=e,this.resetLib(e.lib);for(let{id:r,data:n}of e.variables)this.addVariableHolder(r,n),t&&this.updateVariableHolder(r,n);for(let[r,n]of Object.entries(e.userAPIs??{}))this.addUserAPI(r,n);for(let[r,n]of Object.entries(e.userWebhooks??{}))this.addUserWebhook(r,n);if(!i){for(let[r,n]of Object.entries(e.images))this.addImage(r,n);for(let[r,n]of Object.entries(e.videos))this.addVideo(r,n)}for(let[r,n]of Object.entries(e.colors))this.addColor(r,n);for(let[r,n]of Object.entries(e.lib.materials))this.addMaterial(r,n.asset);for(let[r,n]of Object.entries(e.materials))this.addMaterial(r,n);for(let[r,n]of Object.entries(e.audios))this.addAudio(r,n);for(let[r,n]of Object.entries(e.particles))this.addParticle(r,n);for(let[r,n]of Object.entries(e.fonts))this.addFont(r,n)}addMaterial(e,t){if(t.layers===void 0&&(t={...t,layers:is.defaultTwoLayerData("phong").layers}),this.materials[e]){let i=this.materials[e];i.reset(t,this.thisContext),i.dispose()}else{let i=Jte(t,this.thisContext,e);this.materials[e]=i}}deleteMaterial(e){this.materials[e]&&(this.materials[e].nodeMaterialDispose(),delete this.materials[e])}getMaterial(e){return this.materials[e]}getMaterialOrDeletedPlaceholder(e){return this.materials[e]??this.deletedMaterial}material(e){return typeof e=="string"?this.getMaterialOrDeletedPlaceholder(e):e==null?(console.error("material is undefined or null"),this.deletedMaterial):(e.layers===void 0&&(e={...e,layers:is.defaultTwoLayerData("phong").layers}),Tbe(e,this.thisContext))}getMaterials(){return this.materials}addImage(e,t){return this.images[e]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.images[e].updateSrc(t.data),!0):(this.images[e]=new Rc(t,this),!1)}deleteImage(e){let t=this.images[e];t&&(t.dispose(),delete this.images[e])}getDefaultImage(){return this.images.image_0}getImage(e){return this.images[e]??this.deletedImage}image(e){return typeof e=="string"?this.getImage(e):this.imageHolderCache.load(e)}addUIBuffer(e,t){return this.uiBuffers[e]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.uiBuffers[e].updateSrc(t),!0):(this.uiBuffers[e]=new Rc(t,this),!1)}uiBuffer(e){return this.uiBuffers[e]}addVideo(e,t){return this.videos[e]?(this.videos[e].updateSrc(t.data),!0):(this.videos[e]=new Rc(t,this),!1)}deleteVideo(e){let t=this.videos[e];t&&(t.dispose(),delete this.videos[e])}getVideo(e){return this.videos[e]??this.deletedVideo}video(e){return typeof e=="string"?this.getVideo(e):this.imageHolderCache.load(e)}addColor(e,t){return this.colors[e]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),"a"in t?this.colors[e].setRGBA(t.r,t.g,t.b,t.a):this.colors[e].setRGBA(t.r,t.g,t.b,1),!0):(this.colors[e]=new mA(t.r,t.g,t.b,"a"in t?t.a:1),!1)}updateColor(e,t){if(this.colors[e]){this.onColorOrImageUpdate&&this.onColorOrImageUpdate();let i=this.colors[e];return this.colors[e].r=t.r??i.r,this.colors[e].g=t.g??i.g,this.colors[e].b=t.b??i.b,this.colors[e].a=t.a??i.a,!0}return!1}deleteColor(e){this.colors[e]&&delete this.colors[e]}getColor(e){return this.colors[e]}getColorNames(){return Object.values(this.data.colors).map(e=>e.name)}getColorByName(e){for(let t in this.data.colors)if(this.data.colors[t].name===e)return{color:this.colors[t],id:t}}color(e){let t;if(typeof e!="string")return new Fr(e.r,e.g,e.b,"a"in e?e.a:1);{let i=this.getColor(e);i?t=i:(console.warn("Tried to create color layer params with a color key that does not exist in the assets manager"),t=new Fr(0,0,0,0))}return t}addAudio(e,t){this.audios[e]=t}getAudio(e){let t=this.audios[e];if(t instanceof rx)return t;{let i=new rx({src:t.data});return this.audios[e]=i,i}}addParticle(e,t){this.particles[e]=t}getParticle(e){return this.particles[e]}deleteParticle(e){this.particles[e]&&delete this.particles[e]}deleteAudio(e){let t=this.audios[e];t&&(t instanceof rx&&t.dispose(),delete this.audios[e])}addFont(e,t){let i=OX;i!==null?(this.fonts[e]=new i(t),this.fonts[e].loadingPromise.then(()=>this.requestRender())):Ma("text","a font asset")}getFont(e){return this.fonts[e]}deleteFont(e){this.fonts[e]&&delete this.fonts[e]}dispose(){Object.keys(this.materials).forEach(e=>this.deleteMaterial(e)),this._requestRender=void 0,Object.values(this.audios).forEach(e=>{e instanceof rx&&e.dispose()}),this.audios={},this.particles={},this.geometryCache.dispose(),this.geometryCache2.dispose()}addVariableHolder(e,t){if(this.variables[e]===void 0){let i=t.value;if(this.enableLocalStorageForPersistentVariables&&t.persistent){let r=localStorage.getItem(KH(e));i=r!==null?JSON.parse(r):t.value}return this.variables[e]={value:i,locations:[],persistent:t.persistent},"dynamicVariableType"in t&&(this.variables[e].dynamicVariablePlayState="Playing",this.variables[e].dynamicVariableToggleIsForward=void 0),!0}return this.variables[e].value=t.value,!1}resetDynamicVariablePlayState(){for(let e in this.variables)this.variables[e].dynamicVariablePlayState!==void 0&&(this.variables[e].dynamicVariablePlayState="Playing",this.variables[e].dynamicVariableToggleIsForward=void 0)}updateVariableHolder(e,t){this.updateVariable(e,t.value)}updateVariable(e,t){if(this.variables[e]===void 0)return!1;this.variables[e].value=t,this.enableLocalStorageForPersistentVariables&&this.variables[e].persistent&&localStorage.setItem(KH(e),JSON.stringify(t));let i=t;for(;typeof i=="string";)i=this.variables[i].value;let r=this.entityOpContext.scene,n=!1;for(let s=this.variables[e].locations.length-1;s>=0;s--){let a=this.variables[e].locations[s];if(a[0]==="material"){let o=a[1],l=i,u={scene:r,shared:this},h=a.slice(2);r.traverseMaterial(c=>{let p=c.root??c;p.uuid===o&&p.onVariableUpdate(h,l,u)});let d=this.materials[o];d&&d.onVariableUpdate(h,l,u)}else{let o=r.find(a[0]);if(o===void 0){this.variables[e].locations.splice(s,1);continue}if(n=!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*ht.DEG2RAD:o[a[a.length-1]]=i}if(o=r.find(a[0]),o.type==="ParticleEmitter"&&o.updateVariableState(i,a),hr.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 u=l.dataPatched;l.chooseGeoemtryCache(this).forceDelete(u.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 n&&r.markShadowsDirty(),this.requestRender(),!0}updateEntityGeometryParams(e,t){let i=e;if(i.component&&(i=i.component),typeof i.chooseGeoemtryCache!="function")return!1;let r=i.dataPatched,n=r?.geometry;if(!n||typeof n.type!="string"||n.type==="VectorGeometry"||n.type==="PathGeometry")return!1;let s=u=>u.toLowerCase().replace(/[\s_.-]+/g,""),a=new Map;for(let u of Object.keys(n))a.set(s(u),u);let o={};for(let[u,h]of Object.entries(t??{})){let d=a.get(s(u));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 c=n[d];typeof h=="number"&&isFinite(h)&&(typeof c=="number"||typeof c=="string")&&(o[d]=h)}if(Object.keys(o).length===0)return!1;let l={...n,...o};return i.dataPatched={...r,geometry:l},this.transientGeometryKeys.has(n)&&i.chooseGeoemtryCache(this).forceDelete(r.geometry),this.transientGeometryKeys.add(l),i.createGeometryDelayed(this.entityOpContext),i.onVariableUpdate(!0),i.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}resetEntityGeometryParams(e){let t=e;if(t.component&&(t=t.component),typeof t.chooseGeoemtryCache!="function")return!1;let i=t.dataPatched?.geometry;return!(!i||!this.transientGeometryKeys.has(i)||(t.dataPatched=t.data,t.chooseGeoemtryCache(this).forceDelete(i),t.createGeometryDelayed(this.entityOpContext),t.onVariableUpdate(!0),t.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),0))}updateEntityGeometryVertices(e,t){let i=e;if(i.component&&(i=i.component),typeof i.chooseGeoemtryCache!="function")return!1;let r=i.dataPatched,n=r?.geometry;if(!n||n.type!=="NonParametricGeometry")return!1;let s=t?.vertices;if(s===void 0||typeof s.length!="number"||s.length<9||s.length%3!=0||s.length/3>aie.MAX_TRANSIENT_VERTICES)return!1;let a,o,l,u=s instanceof Float32Array?s:Float32Array.from(s),h=u.length/3;if(t.normals!==void 0){if(t.normals.length!==u.length)return!1;a=t.normals instanceof Float32Array?t.normals:Float32Array.from(t.normals)}if(t.uvs!==void 0){if(t.uvs.length!==2*h)return!1;o=t.uvs instanceof Float32Array?t.uvs:Float32Array.from(t.uvs)}if(t.indices!==void 0){let x=h>65535?Uint32Array.from(t.indices):Uint16Array.from(t.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=n.data,w=x?.index;if(w?.array?.length){if(h<(x?.attributes?.position?.array?.length??0)/3){let S=w.array;for(let M=0;M<S.length;M++)if(S[M]>=h)return!1}l=w}}let d=1/0,c=1/0,p=1/0,f=-1/0,m=-1/0,g=-1/0;for(let x=0;x<u.length;x+=3){let w=u[x],S=u[x+1],M=u[x+2];w<d&&(d=w),w>f&&(f=w),S<c&&(c=S),S>m&&(m=S),M<p&&(p=M),M>g&&(g=M)}let v=(x,w)=>({array:x,itemSize:w,type:"Float32Array",normalized:!1}),y={position:v(u,3)};a&&(y.normal=v(a,3)),o&&(y.uv=v(o,2));let _={...n,width:f-d,height:m-c,depth:g-p,data:{attributes:y,...l?{index:l}:{}}},b=this.transientGeometryKeys.has(n);return i.dataPatched={...r,geometry:_},this.transientGeometryKeys.add(_),i.applyTransientGeometryData(this.entityOpContext,b),i.onVariableUpdate(!0),i.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}setEntityInstanceTransforms(e,t){let i=e;i.component&&(i=i.component);let r=i.cloner;if(r===void 0)return-1;let n=r.children,s=Math.PI/180,a=!1;if(t===null)for(let o of n)o.transformOverride!==void 0&&(o.transformOverride=void 0,a=!0);else{if(!Array.isArray(t))return n.length;{let o=Math.min(t.length,n.length);for(let l=0;l<o;l++){let u=t[l],h=n[l];if(u==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]};u.position&&(typeof u.position.x=="number"&&(d.position[0]=u.position.x),typeof u.position.y=="number"&&(d.position[1]=u.position.y),typeof u.position.z=="number"&&(d.position[2]=u.position.z)),u.rotation&&(typeof u.rotation.x=="number"&&(d.rotation[0]=u.rotation.x*s),typeof u.rotation.y=="number"&&(d.rotation[1]=u.rotation.y*s),typeof u.rotation.z=="number"&&(d.rotation[2]=u.rotation.z*s)),u.scale&&(typeof u.scale.x=="number"&&(d.scale[0]=u.scale.x),typeof u.scale.y=="number"&&(d.scale[1]=u.scale.y),typeof u.scale.z=="number"&&(d.scale[2]=u.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?r.update(this.entityOpContext):r.syncInstanceMatrices(),r.invalidateTransform(i),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),n.length}spawnRuntimeClone(e,t={}){if(typeof e.entityChildren!="function")return;let i=e.parent;if(i===null)return;let r=new Rh(e);r.playModeVisible=t.visible!==!1,r.expand(),typeof t.name=="string"&&(r.name=t.name);let n=Math.PI/180;return r.position.copy(e.position),r.rotation.copy(e.rotation),r.scale.copy(e.scale),r.hiddenMatrix.copy(e.hiddenMatrix),t.position&&(typeof t.position.x=="number"&&(r.position.x=t.position.x),typeof t.position.y=="number"&&(r.position.y=t.position.y),typeof t.position.z=="number"&&(r.position.z=t.position.z)),t.rotation&&(typeof t.rotation.x=="number"&&(r.rotation.x=t.rotation.x*n),typeof t.rotation.y=="number"&&(r.rotation.y=t.rotation.y*n),typeof t.rotation.z=="number"&&(r.rotation.z=t.rotation.z*n)),t.scale&&(typeof t.scale.x=="number"&&(r.scale.x=t.scale.x),typeof t.scale.y=="number"&&(r.scale.y=t.scale.y),typeof t.scale.z=="number"&&(r.scale.z=t.scale.z)),r.updateMatrix(),i.add(r),r.updateWorldMatrix(!0,!0),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),r}destroyRuntimeClone(e){e.removeFromParent(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender()}updateEntityMaterialParams(e,t){let i=e.material;if(!i)return!1;let r=[];for(let u of Array.isArray(i)?i:[i]){let h=u.root??u;h&&Array.isArray(h.layers)&&h.data&&!r.includes(h)&&r.push(h)}if(r.length===0)return!1;let n={scene:this.entityOpContext.scene,shared:this},s=u=>u.toLowerCase().replace(/[\s_.-]+/g,""),a=u=>{if(typeof u=="string"){let h=new Fr(1,1,1,1);try{h.set(u)}catch{return null}return{r:h.r,g:h.g,b:h.b,a:void 0}}if(u&&typeof u=="object"&&"r"in u){let h=u;if([h.r,h.g,h.b].some(c=>typeof c!="number"||!isFinite(c)))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=(u,h,d)=>{if(!u.hasValue(h))return!1;let c=u.getValue(h);if(!c||typeof c!="object"||!c.isColor)return!1;let p=d.a??(typeof c.a=="number"?c.a:1);return c instanceof mA?u.setValue(h,new Fr(d.r,d.g,d.b,p)):typeof c.setRGBA=="function"?c.setRGBA(d.r,d.g,d.b,p):c.setRGB(d.r,d.g,d.b),!0},l=!1;for(let u of r){let h=u.data.layers??[],d=c=>u.layers.find(p=>p.uuid===c);if(t.color!==void 0){let c=a(t.color),p=h.find(m=>m.data.type==="color"),f=p&&d(p.id);if(c&&f&&o(f,"color",c)&&(l=!0,c.a!==void 0)){let m=c.a<1||xd(u.data,this);u.setTransparent?u.setTransparent(m,n.scene):u.transparent=m}}typeof t.alpha=="number"&&isFinite(t.alpha)&&(u.onVariableUpdate?.(["alphaOverride"],Math.max(0,Math.min(t.alpha,100)),n),l=!0);for(let c of t.layers??[]){if(!c||typeof c!="object")continue;let p=typeof c.id=="string"?h.find(v=>v.id===c.id):typeof c.index=="number"?h[c.index]:typeof c.type=="string"?h.find(v=>v.data.type===c.type):void 0,f=p&&d(p.id);if(!p||!f)continue;let m=ww[p.data.type]??[],g=Object.keys(p.data);for(let[v,y]of Object.entries(c)){if(v==="id"||v==="index"||v==="type")continue;let _=g.find(x=>x===v)??g.find(x=>s(x)===s(v))??v;if(m.includes(_))continue;let b=a(y);if(b&&o(f,_,b))l=!0;else if(typeof y=="number"&&isFinite(y))u.onVariableUpdate?.(["layer",p.id,_],y,n),l=!0;else if(Array.isArray(y)&&y.length<=3&&y.every(x=>typeof x=="number"&&isFinite(x))){let x=["x","y","z"];y.forEach((w,S)=>{u.onVariableUpdate?.(["layer",p.id,_,x[S]],w,n)}),l=!0}}}}return l&&this.requestRender(),l}deleteVariable(e){this.variables[e]&&delete this.variables[e]}getVariable(e,t){if(Array.isArray(e)){if(e[0]==="mouse")return this.mouseProperty?.[e[1]]??0;if(e[0]==="raycast")return this.raycastProperty?.[e[1]]??0;let i=this.entityOpContext.scene.find(e[0]);if(e[1]==="width"||e[1]==="height"||e[1]==="depth")return i.geometry.userData.parameters[e[1]];if((e[1]==="position"||e[1]==="rotation")&&e.length>2&&i?.getPhysicsLocalMatrix?.(XF))return XF.decompose(YF,KF,nie),e[1]==="position"?YF[e[2]]:(ZF.setFromQuaternion(KF,i.rotation.order),ZF[e[2]]*ht.RAD2DEG);for(let r=1;r<e.length;r++)i=i[e[r]];return e[1]==="rotation"&&(i*=ht.RAD2DEG),i}for(let i in this.variables){if(t===void 0)break;let r=this.variables[i],n=r.locations?.findIndex(s=>Ta.equal(s,t));n!==void 0&&n!==-1&&r.locations.splice(n,1)}if(typeof e=="string"){let i=e,r=e;do{if(r=i,this.variables[i]===void 0)break;let n=this.variables[i].value;t&&this.variables[r]!==void 0&&this.variables[r].locations.push(t),i=n}while(typeof i=="string");return i}return e}getVariables(){return this.variables}getVariablesNames(){return this.data.variables.map(e=>e.data.name)}getVariableByName(e){for(let t of this.data.variables)if(t.data.name===e)return{variable:t.data,id:t.id}}getDynamicVariablePlayState(e){return this.variables[e]?.dynamicVariablePlayState}setDynamicVariablePlayState(e,t){this.variables[e]!==void 0&&(this.variables[e].dynamicVariablePlayState=t)}getDynamicVariableToggleIsForward(e){return this.variables[e]?.dynamicVariableToggleIsForward}setDynamicVariableToggleIsForward(e,t){this.variables[e]!==void 0&&(this.variables[e].dynamicVariableToggleIsForward=t)}resetLib(e){for(let[t,i]of Object.entries(e.images))this.addImage(t,i.asset);for(let[t,i]of Object.entries(e.audios))this.addAudio(t,i.asset);for(let[t,i]of Object.entries(e.particles))this.addParticle(t,i.asset);for(let[t,i]of Object.entries(e.colors))this.addColor(t,i.asset);for(let[t,i]of Object.entries(e.fonts))this.addFont(t,i.asset);for(let[t,i]of Object.entries(e.videos))this.addVideo(t,i.asset);for(let[t,i]of Object.entries(e.variables))this.addVariableHolder(t,i.asset)}updateLibByOp(e,t){e.path[0]==="images"?e.path.length===1&&e.type===1?this.addImage(e.id,e.data.asset):e.path.length===1&&e.type===2&&this.deleteImage(e.id):e.path[0]==="videos"?e.path.length===1&&e.type===1?this.addVideo(e.id,e.data.asset):e.path.length===1&&e.type===2&&this.deleteVideo(e.id):e.path[0]==="audios"?e.path.length===1&&e.type===1?this.addAudio(e.id,e.data.asset):e.path.length===1&&e.type===2&&this.deleteAudio(e.id):e.path[0]==="particles"?e.path.length===1&&e.type===1?this.addParticle(e.id,e.data.asset):e.path.length===1&&e.type===2&&this.deleteParticle(e.id):e.path[0]==="colors"?e.path.length===1&&e.type===1?this.addColor(e.id,e.data.asset):e.path.length===1&&e.type===2&&this.deleteColor(e.id):e.path[0]==="materials"?e.path.length===1&&e.type===1?this.addMaterial(e.id,e.data.asset):e.path.length===1&&e.type===2&&this.deleteMaterial(e.id):e.path[0]==="fonts"?e.path.length===1&&e.type===1?this.addFont(e.id,e.data.asset):e.path.length===1&&e.type===2&&this.deleteFont(e.id):e.path[0]==="variables"?e.path.length===1&&e.type===1?this.addVariableHolder(e.id,e.data.asset):e.path.length===1&&e.type===2&&this.deleteVariable(e.id):e.path[0]==="components"&&t.updateByLibOp(e,this)}updateByOp(e,t,i){if(this.data=t,e.path[0]==="images")e.path.length===2&&e.type===0?e.props.data&&this.getImage(e.path[1]).updateSrc(e.props.data):e.path.length===1&&e.type===1?this.addImage(e.id,e.data):e.path.length===1&&e.type===2&&this.deleteImage(e.id);else if(e.path[0]==="videos")e.path.length===2&&e.type===0?e.props.data&&this.getVideo(e.path[1]).updateSrc(e.props.data):e.path.length===1&&e.type===1?this.addVideo(e.id,e.data):e.path.length===1&&e.type===2&&this.deleteVideo(e.id);else if(e.path[0]==="audios")e.path.length===2&&e.type===0?e.props.data&&this.addAudio(e.path[1],t.audios[e.path[1]]):e.path.length===1&&e.type===1?this.addAudio(e.id,e.data):e.path.length===1&&e.type===2&&this.deleteAudio(e.id);else if(e.path[0]==="particles")e.path.length===2&&e.type===0?e.props.data&&this.addParticle(e.path[1],t.particles[e.path[1]]):e.path.length===1&&e.type===1?this.addParticle(e.id,e.data):e.path.length===1&&e.type===2&&this.deleteParticle(e.id);else if(e.path[0]==="colors")e.path.length===2&&e.type===0?this.updateColor(e.path[1],e.props):e.path.length===1&&e.type===1?this.addColor(e.id,e.data):e.path.length===1&&e.type===2&&this.deleteColor(e.id);else if(e.path[0]==="materials")e.path.length===1&&e.type===1?this.addMaterial(e.id,e.data):e.path.length===1&&e.type===2?this.deleteMaterial(e.id):e.path.length>1&&this.getMaterial(e.path[1]).updateByOp(Xa.drop(e,2),t.materials[e.path[1]],{shared:this,scene:i});else if(e.path[0]==="fonts")e.path.length===2&&e.type===0?this.updateFont(e.path[1],e,i):e.path.length===1&&e.type===1?this.addFont(e.id,e.data):e.path.length===1&&e.type===2&&this.deleteFont(e.id);else if(e.path[0]==="variables")e.path.length===2&&e.type===0?"value"in e.props?this.updateVariable(e.path[1],e.props.value):"persistent"in e.props&&(this.variables[e.path[1]].persistent=e.props.persistent):e.path.length===1&&e.type===4?this.addVariableHolder(e.id,e.data):e.path.length===1&&e.type===5&&this.deleteVariable(e.id);else if(e.path[0]==="userAPIs"){if(e.path.length===1&&e.type===1)this.addUserAPI(e.id,e.data);else if(e.path.length===1&&e.type===2)this.deleteUserAPI(e.id);else if(typeof e.path[1]=="string"){let r=t.userAPIs[e.path[1]];if(r){let n=e.type===0&&e.props.debounce===void 0,s=this.getUserAPI(e.path[1]);s!==void 0&&s===this.openAIRealtime?s.update(r):s?.update(r,this,n)}}}else if(e.path[0]==="userWebhooks"){if(e.path.length===1&&e.type===1)this.addUserWebhook(e.id,e.data);else if(e.path.length===1&&e.type===2)this.deleteUserWebhook(e.id);else if(typeof e.path[1]=="string"){let r=t.userWebhooks[e.path[1]];r&&this.getUserWebhook(e.path[1])?.update(r)}}else e.path[0]==="lib"&&this.updateLibByOp(Xa.drop(e,1),i)}updateFont(e,t,i){if(t.props.url){let r=this.getFont(e),n={...this.data.fonts[e],url:t.props.url};r.update(n),r.loadingPromise.then(()=>this.requestRender()),i.updateFont(e,this)}}addUserAPI(e,t){if(this.userAPIs[e])return this.userAPIs[e].update(t,this),!0;if(this.openAIRealtime?.id===e)return this.openAIRealtime.update(t),!0;if(t.integration?.type==="VoiceAssistant"){let i=WX;return i===null?(Ma("ai-assistant","a voice-assistant integration"),!1):(this.openAIRealtime=i(t,e,this),!1)}{let i=rie();return i===null?(Ma("api-services","a user API integration"),!1):(this.userAPIs[e]=i.createUserAPI(e,t,this),!1)}}getUserAPI(e){return this.openAIRealtime?.id===e?this.openAIRealtime:this.userAPIs[e]}getUserAPIs(){return this.userAPIs}deleteUserAPI(e){let t=this.userAPIs[e];t&&(t.dispose(),delete this.userAPIs[e])}addUserWebhook(e,t){if(this.userWebhooks[e])return this.userWebhooks[e].update(t),!0;{let i=rie();return i===null?(Ma("api-services","a user webhook"),!1):(this.userWebhooks[e]=i.createUserWebhook(e,t),!1)}}getUserWebhook(e){return this.userWebhooks[e]}getUserWebhooks(){return this.userWebhooks}deleteUserWebhook(e){let t=this.userWebhooks[e];t&&(t.dispose(),delete this.userWebhooks[e])}get scene(){return this.entityOpContext.scene}}).MAX_TRANSIENT_VERTICES=6e4,new wL(fu.emptyData())});function Cbe(e){return fL(e)||e?.isTSLNodeMaterial===!0}var bl,QF,JF,e5,oie,t5,Fn,Rbe=V(()=>{DX()}),h1=V(()=>{Wt(),Na(),$f(),Rbe(),Nr(),ha(),bl=class extends Ss{setMaterialOverride(e,t){this.materialOverride=eie(e),this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.materialOverride,this.layers.set(0),this.syncShapeBlendNodeLayer(),t.scene.markNeedsUpdateRendererDirty())}updateByPatchedOp(e,t,i){if(super.updateByPatchedOp(e,t,i),Jr(e.path,["geometry"])&&this.syncShadowCatcher(i),function(r,n){let s=[];if(n.length!==r.length)return null;{let a=0;for(;a<r.length;){if(n[a]==="*")s.push(r[a]);else if(r[a]!==n[a])return null;a+=1}}return s}(e.path,["materials"])!==null&&e.type===0&&Array.isArray(this.material))for(let[r,n]of Object.entries(e.props)){let s=this.material[Number(r)],a=i.shared.material(n);a!==s&&bl.disposeOneMaterial(s),this.material[Number(r)]=a}else if(Jr(e.path,["material"])){let r=this.material;!Array.isArray(r)&&typeof r?.updateByOp=="function"&&"material"in t&&typeof t.material!="string"&&r.updateByOp(Xa.drop(e,1),t.material,i)}else if(Jr(e.path,["materials","*"])&&Array.isArray(this.material)){let r=e.path[1];if("materials"in t&&r<this.material.length){let n=t.materials[r];typeof n!="string"&&this.material[r].updateByOp(Xa.drop(e,2),n,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(e,t){super.updateState(e,t),e.castShadow!==void 0&&(this.castShadow=e.castShadow),e.receiveShadow!==void 0&&(this.receiveShadow=e.receiveShadow);let i,r=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 n=this.materialOverride!==void 0;!n&&e.geometry?.type!=="NonParametricGeometry"&&"material"in e&&e.material!==void 0&&(this.disposeMaterial(),this.material=t.shared.material(e.material).getFlavor(r.flatShading,r.side,r.wireframe,i),t.scene.markNeedsUpdateRendererDirty()),!n&&(e.geometry?.type==="NonParametricGeometry"||"materials"in e)&&("materials"in e&&e.materials!==void 0?(this.disposeMaterial(),this.material=e.materials.map(a=>t.shared.material(a).getFlavor(r.flatShading,r.side,r.wireframe)),t.scene.markNeedsUpdateRendererDirty()):"material"in e&&e.material!==void 0&&(this.disposeMaterial(),this.material=[t.shared.material(e.material).getFlavor(r.flatShading,r.side,r.wireframe)],t.scene.markNeedsUpdateRendererDirty()));let s=this.data;if(!n&&s.geometry?.type!=="NonParametricGeometry"&&"materials"in s&&s.materials!==void 0&&(this.disposeMaterial(),this.material=t.shared.material(s.materials[0]).getFlavor(r.flatShading,r.side,r.wireframe)),!n&&(e.flatShading!==void 0||e.wireframe!==void 0||e.side!==void 0))if(Array.isArray(this.material))for(let a=0;a<this.material.length;a++)this.material[a]=this.material[a].getFlavor(r.flatShading,r.side,r.wireframe);else this.material=this.material.getFlavor(r.flatShading,r.side,r.wireframe,i);this.syncShadowCatcher(t)}shadowCatcherActive(){let e=this.dataPatched,t=e.geometry?.type;return e.shadowCatcher===!0&&(t==="RectangleGeometry"||t==="PlaneGeometry")}syncShadowCatcher(e){let t=this.dataPatched;if(this.shadowCatcherActive()){if(this.shadowCatcherMaterial===void 0){let i=function(){let r=LA==="webgpu"&&XH!==void 0?XH:Mbe;return r===void 0?null:eie(r())}();if(i===null)return;this.shadowCatcherMaterial=i}this.shadowCatcherMaterial.side=t.side,this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.shadowCatcherMaterial,e.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,e.scene.markNeedsUpdateRendererDirty()):"material"in t&&t.material!==void 0&&(this.material=e.shared.material(t.material).getFlavor(t.flatShading,t.side,t.wireframe),e.scene.markNeedsUpdateRendererDirty(),this.needsAO&&this.layers.enable(5)),this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow)}static disposeOneMaterial(e){var t;Cbe(e)&&!function(i){return i?.isClassicSharedMaterial===!0}(t=e)&&t?.isTSLSharedMaterial!==!0&&e.nodeMaterialDispose()}disposeMaterial(){this.material&&u1e(this.material).forEach(e=>{bl.disposeOneMaterial(e)})}dispose(){this.disposeMaterial(),this.shadowCatcherMaterial?.dispose(),super.dispose()}}}),wl=V(()=>{Wt(),Nr(),$X(),h1(),le(),G4(),xw(),_be(),QF=new P,JF=new pt,e5=new pt,oie=new P,t5=new Ve,Fn=class extends bl{constructor(e,t,i){super(e,t),this.data=t,this.isSkinnedMesh=!1,this.localGeometry=void 0,t.bindMode&&t.bindMatrix&&(this.bindMode=t.bindMode,this.bindMatrix=new Ve().fromArray(t.bindMatrix),this.bindMatrixInverse=new Ve)}chooseGeoemtryCache(e){return e.geometryCache}supportsInPlaceGeometryUpdate(e){return e.isTextGeometry!==!0}markGeometryAsReachable(e){this.geometryCreateDeleyed instanceof At&&this.chooseGeoemtryCache(e).markAsReachable(this.dataPatched.geometry,this.geometryCreateDeleyed)}get builtSharedGeometry(){if(this.localGeometry===void 0)return this.geometryCreateDeleyed instanceof At?this.geometryCreateDeleyed:void 0}get geometry(){if(this.localGeometry!==void 0)return this.localGeometry;if(this.geometryCreateDeleyed instanceof wL){let e=this.geometryCreateDeleyed,t=this.chooseGeoemtryCache(e),i=this.dataPatched.geometry;this.geometryCreateDeleyed=t.get(i,e,this),this._geometryCacheKey=i}return this.geometryCreateDeleyed}set geometry(e){this.localGeometry=e}get is2DAndNoDepth(){let e=this.dataPatched.geometry;return iL.is2DParametricMesh(e.type)&&e.depth===0}get is2DType(){return iL.is2DParametricMesh(this.geometry.userData.type)}get isNonParametric(){return this.geometry.userData.type==="NonParametricGeometry"}updateByPatchedOp(e,t,i){super.updateByPatchedOp(e,t,i),Jr(e.path,["geometry"])&&this.updateByPatchedOpGeometry(Xa.drop(e,1),t.geometry,i)}removeInteractionGeometry(e){this.localGeometry?.dispose(),this.localGeometry=void 0}get appliedGeometrySize(){let e=this.localGeometry?.userData;if(e!==void 0&&e.sxPrev!==void 0)return[e.sxPrev,e.syPrev,e.szPrev]}updateGeometryInteractions(e,t){this.invalidateDownstreamBooleanData();let i=this.data.geometry.type;if(i==="NonParametricGeometry"||i==="SubdivGeometry"){let r,n,s,a=e;if(this.localGeometry===void 0){let d={...this.data.geometry,...a};this.localGeometry=Cg(d,t,this.data.flatShading,this)}a.scaleBaked?[r,n,s]=a.scaleBaked:{width:r,height:n,depth:s}=a;let o=this.localGeometry.userData,l=typeof r=="number"?r:1,u=typeof n=="number"?n:1,h=typeof s=="number"?s:1;o.sxPrev!==void 0&&kH(this.localGeometry.attributes,l/o.sxPrev,u/o.syPrev,h/o.szPrev),o.sxPrev=l,o.syPrev=u,o.szPrev=h}else{let r=Cg({...this.data.geometry,...e},t,this.data.flatShading,this);this.localGeometry!==void 0&&this.supportsInPlaceGeometryUpdate(this.localGeometry)&&jF(this.localGeometry,r)?r.dispose():(this.localGeometry?.dispose(),this.localGeometry=r)}}refreshAttachedClonersInteractions(e){for(let t of this.attachedSurfaceCloners)t.update(e)}refreshAttachedCloners(e){for(let t of this.attachedSurfaceCloners)e.scene.addPendingUpdateCloner(t.object)}refreshAttachedPaths(e){for(let t of this.attachedPaths)e.scene.addPendingCommand(()=>t.updateShape())}createGeometryDelayed(e){this.geometryCreateDeleyed=e.shared,this.refreshAttachedCloners(e),this.refreshAttachedPaths(e)}updateByPatchedOpGeometry(e,t,i){let r=!1;if(e.type===0&&e.path.length===0&&Object.keys(e.props).includes("scaleBaked")&&this.geometryCreateDeleyed instanceof ls&&this.chooseGeoemtryCache(i.shared).mutateIfUnique(this.geometryCreateDeleyed.data,t)===this.geometryCreateDeleyed&&(r=!0,this.geometryCreateDeleyed.mutateDirectlyScaleBaked(t,e.props.scaleBaked),this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)),!r&&e.type===0&&e.path.length===0&&bbe(e.props)&&this.geometryCreateDeleyed instanceof ls&&this.chooseGeoemtryCache(i.shared).mutateIfUnique(this.geometryCreateDeleyed.data,t)===this.geometryCreateDeleyed&&(r=!0,this.geometryCreateDeleyed.mutateDirectlySubdivisions(t),this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)),!r&&e.type===0&&e.path.length===0&&this.geometryCreateDeleyed instanceof At&&!(this.geometryCreateDeleyed instanceof ls)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let n=i.shared,s=this.chooseGeoemtryCache(n),a=this.geometryCreateDeleyed;if(s.getCached(this._geometryCacheKey)===a&&a.isShared!==!0){let o=this.dataPatched.geometry,l=Cg(o,n,this.data.flatShading,this);jF(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,r=!0,this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)}}r||(i.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(i)),this.syncShapeBlendNodeLayer(),this.resetBBoxNeedsUpdate(),this.invalidateDownstreamBooleanData()}updateGeometryOnStateUpdate(e,t){this.createGeometryDelayed(t)}applyTransientGeometryData(e,t){let i=e.shared,r=this.dataPatched.geometry;if(this.geometryCreateDeleyed instanceof At&&!(this.geometryCreateDeleyed instanceof ls)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let n=this.chooseGeoemtryCache(i),s=this.geometryCreateDeleyed;if(n.getCached(this._geometryCacheKey)===s&&s.isShared!==!0){let a=Cg(r,i,this.data.flatShading,this);return jF(s,a)?(a.dispose(),s.computeBoundingSphere(),n.mutateIfUnique(this._geometryCacheKey,r)):(a.computeBoundingSphere(),n.forceDelete(this._geometryCacheKey),n.adopt(r,a),this.geometryCreateDeleyed=a),this._geometryCacheKey=r,this.refreshAttachedCloners(e),void this.refreshAttachedPaths(e)}}t&&this._geometryCacheKey!==void 0&&this.chooseGeoemtryCache(i).forceDelete(this._geometryCacheKey),e.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(e)}updateState(e,t){e.geometry!==void 0&&this.updateGeometryOnStateUpdate(e.geometry,t);let i=e.morphTargetInfluences;if(i){this.updateMorphTargets(),this.geometry.morphTargetsRelative=!0;for(let{data:{name:r,value:n}}of i)this.updateMorphInfluences(r,t.shared.getVariable(n,[this.uuid,"morphTargetInfluences",r]))}super.updateState(e,t)}updateMorphInfluences(e,t){if(this.morphTargetDictionary===void 0)return;let i=this.morphTargetDictionary[e];i!==void 0&&(this.morphTargetInfluences[i]=t)}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(e,t){let i=this.geometry.userData.parameters;this.is2DType?e.set(0,0,.5*i.depth):this.isNonParametric?(e.setScalar(0),this.geometry.boundingSphere&&e.copy(this.geometry.boundingSphere.center),t.set(i.width,i.height,i.depth??0).multiplyScalar(.5)):i.centerOffset?e.fromArray(i.centerOffset):e.setScalar(0),t.set(i.width,i.height,i.depth??0).multiplyScalar(.5)}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"&&this.bindMatrixInverse.copy(this.bindMatrix).invert()}bind(e,t){this.skeleton=e,this.isSkinnedMesh=!0,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(e){let t=new pt,i=this.geometry.attributes.skinWeight;for(let r=0,n=i.count;r<n;r++){t.fromBufferAttribute(i,r);let s=1/t.manhattanLength();s!==1/0?t.multiplyScalar(s):t.set(1,0,0,0),i.setXYZW(r,t.x,t.y,t.z,t.w)}}boneTransform(e,t){let i=this.skeleton;if(i===void 0)return;let r=this.geometry;JF.fromBufferAttribute(r.attributes.skinIndex,e),e5.fromBufferAttribute(r.attributes.skinWeight,e),QF.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let n=0;n<4;n++){let s=e5.getComponent(n);if(s!==0){let a=JF.getComponent(n);t5.multiplyMatrices(i.bones[a].matrixWorld,i.boneInverses[a]),t.addScaledVector(oie.copy(QF).applyMatrix4(t5),s)}}return t.applyMatrix4(this.bindMatrixInverse)}}});function Cx(e){if(Array.isArray(e.material)){for(let t of e.material)if(t.getLayersOfType("outline").length===0)return}else if(!fL(e.material)||e.material.getLayersOfType("outline").length===0)return;e instanceof Fn&&e.is2DAndNoDepth?function(t){if(t.geometry.attributes.extrudeNormals||!t.geometry.attributes.position)return;let i=t.geometry.attributes.position.array,r=new Float32Array(i.length),n=new P;for(let s=0;s<i.length;s+=3)n.set(i[s],i[s+1],i[s+2]).normalize(),r[s]=n.x,r[s+1]=n.y,r[s+2]=n.z;t.geometry.setAttribute("extrudeNormal",new Et(r,3))}(e):function(t){if(t.geometry.attributes.extrudeNormal||!t.geometry.attributes.position||!t.geometry.attributes.normal)return;let i=new Map,r=t.geometry.attributes,n=r.position.array,s=r.normal.array,a=new Float32Array(n.length);for(let o=0;o<n.length;o+=3){let l=`${n[o]}_${n[o+1]}_${n[o+2]}`,u=new P(s[o],s[o+1],s[o+2]);i.has(l)?i.get(l)?.normals.push(u):i.set(l,{normals:[u],result:new P})}i.forEach((o,l)=>{for(let u of o.normals)o.result.add(u);o.result.divideScalar(o.normals.length)});for(let o=0;o<n.length;o+=3){let l=`${n[o]}_${n[o+1]}_${n[o+2]}`,u=i.get(l)?.result;u&&(a[o]=u.x,a[o+1]=u.y,a[o+2]=u.z)}t.geometry.setAttribute("extrudeNormal",new Et(a,3))}(e)}function i5(e){return Math.min(2047,Math.max(1,Math.round(2048*e)))/2048}function Rx(e){if(!e.geometry.attributes.position)return;let t=e.geometry.attributes,i=t.position.array,r=t.randomColor;if(r!==void 0&&3*r.count===i.length)return;let n=new Float32Array(i.length),s=parseInt(e.uuid.replace(/\D/g,"")),a=[i5(ht.seededRandom(s)),i5(ht.seededRandom(s+1e4)),i5(ht.seededRandom(s+2e4))];for(let o=0;o<i.length;o++)n[o]=a[o%3];e.geometry.setAttribute("randomColor",new It(n,3))}var H4=V(()=>{le(),DX(),wl()});function lie(e){let t=!1;return e.scene.objects.traverse((i,r)=>{r.geometry?.type==="BooleanGeometry"&&(t=!0)}),t}function NOe(e,t){let i=e.cloner;return i!==void 0&&i.parent===t?i:void 0}function hie(e,t,i,r){let n=16*(t.children.length+1);RM.length<n&&(RM=new Float32Array(n));let s=0,a=l=>{l.toArray(RM,16*s),s++},o=t.parameters.hideBase!==!0;o&&a(r),ZH.multiplyMatrices(e.hiddenMatrix,e.matrix);for(let l of t.children)!Zv(l)||l.playModeVisible===!1||(QH.multiplyMatrices(l.hiddenMatrix,l.matrix).multiply(l.pivotMatrix),vI.multiplyMatrices(ZH,QH),(!o||!vI.equals(r))&&a(vI));try{return s===0?0:function(l,u){return RX(pL().instanced_union(CX(l),u))}(i,RM.subarray(0,16*s))}finally{w_e(i)}}var lp,uie,ZH,QH,vI,RM,Lg,SL,W4,gd,Uc,TL,BA=V(()=>{Na(),le(),U4(),H4(),h1(),rs(),lp=new Ve,uie=new Ve,ZH=new Ve,QH=new Ve,vI=new Ve,RM=new Float32Array(0),Lg=class extends bl{constructor(e,t,i){super(e,t),this.data=t,this.meshSetAddresses=[],this.needsTransformForDownstream=!1,this.geometry=new At,this.onAfterRender=(r,n,s,a,o,l)=>{super.onAfterRender(r,n,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(e,t,i){super.updateByPatchedOp(e,t,i),e.path.length===1&&e.path[0]==="geometry"&&e.type===0&&e.props.operation!==void 0&&(this.freeBooleanPointer(),this.resetBBoxNeedsUpdate())}freeBooleanPointer(){super.freeBooleanPointer(),this.geometry.dispose()}recomputeBoolean(e,t=!0){if(this.booleanMeshSetAddress!==-1&&!e)return;for(let r=0;r<this.children.length;r++){let n=this.children[r];n instanceof Lg&&n.dataPatched.visible===!0&&n.recomputeBoolean(e===!0,t)}this.meshSetAddresses=[];for(let r=0;r<this.children.length;r++){let n=this.children[r];if(n instanceof Ss&&n.dataPatched.visible===!0&&n.geometry.attributes.position?.count>0&&n.geometry.drawRange.count>0&&n.booleanMeshSetAddress!==0){lp.multiplyMatrices(n.hiddenMatrix,n.matrix).multiply(n.pivotMatrix);try{let s=NOe(n,this);if(n.booleanMeshSetAddress===-1){if((n.geometry.index??n.geometry.getAttribute("position")).count/3<15e5){let a=eOe(n.geometry,e===!0);n.booleanMeshSetAddress=s===void 0||a===-1?a:hie(n,s,a,lp)}if(n.booleanMeshSetAddress===-1)return;s===void 0&&NF(n.booleanMeshSetAddress,lp),n.booleanMatrixInvOld.copy(lp).invert(),n.booleanWasTransformed=!1}else n instanceof Lg&&n.needsTransformForDownstream===!0?(s===void 0?NF(n.booleanMeshSetAddress,lp):n.booleanMeshSetAddress=hie(n,s,n.booleanMeshSetAddress,lp),n.needsTransformForDownstream=!1):n.booleanWasTransformed===!0&&(NF(n.booleanMeshSetAddress,uie.multiplyMatrices(lp,n.booleanMatrixInvOld)),n.booleanMatrixInvOld.copy(lp).invert(),n.booleanWasTransformed=!1)}catch(s){console.error(s),n.booleanMeshSetAddress=0,n.geometry.userData.booleanOperationDidFail=!0;continue}if(n.booleanMeshSetAddress===0)continue;this.meshSetAddresses.push(n.booleanMeshSetAddress),n.geometry.userData.booleanOperationDidFail=!1}}if(this.meshSetAddresses.length===0){if(this.geometry.getAttribute("position")?.array.length!==0){let r=this.geometry;r.dispose(),this.geometry=new At,this.geometry.userData=r.userData,this.geometry.boundingSphere=r.boundingSphere,this.geometry.setAttribute("position",new Et([],3))}return void this.geometry.setDrawRange(0,0)}if(e===!0)return function(r,n){let s=pL(),a=ote(r,n),o=s.mesh_topological_data(a),l=o.positions(),u=o.indices();return o.free(),a.free(),{positions:l,indices:u,verticesPerFace:new Uint8Array(u.length/3).fill(3)}}(this.meshSetAddresses,this.booleanOp);let i=this.geometry;i.dispose(),this.geometry=new At,this.geometry.userData=i.userData,this.geometry.boundingSphere=i.boundingSphere;try{this.booleanMeshSetAddress=function(r,n,s,a){let o=pL(),l=ote(r,n),u=o.mesh_render_data(l,Math.max(a,0));if(s.setAttribute("position",new Et(u.positions(),3)),s.setAttribute("normal",new Et(u.normals(),3)),u.free(),s.boundingSphere===null&&(s.boundingSphere=new qa),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 RX(l)}(this.meshSetAddresses,this.booleanOp,this.geometry,this.phongAngle)}catch(r){this.booleanMeshSetAddress=0,this.geometry.userData.booleanOperationDidFail=!0,console.error(r)}this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0,Cx(this),Rx(this)}dispose(){super.dispose(),this.geometry.dispose()}}}),UA=V(()=>{le(),xl(),l1(),(SL||(SL={})).is=function(e){return hr.is(e)&&e instanceof Gp},W4=(e,t)=>class extends o1(e,t){updateState_Light(i,r){if(this.updateState_Entity(i,r),i.color!==void 0&&(this.color=r.shared.color(i.color)),i.intensity!==void 0&&(this.intensity=i.intensity*Math.PI),i.depth!==void 0){let n=this.shadow;n.camera.far=i.depth,n.needsUpdate=!0}i.shadows!==void 0&&(this.castShadow=i.shadows)}}}),Qg=V(()=>{BA(),Na(),l1(),gd=e=>e instanceof Ss,Uc=e=>e!==null&&e instanceof Lg,TL=e=>wH.is(e)});function vo(e,t){return t.color(e)}function die(e=new Date,t){let i=t.format,r=e.getSeconds(),n=e;t&&t.timeZone!==null&&(n=function(d,c){try{let p=new Intl.DateTimeFormat("en-US",{timeZone:c,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}).formatToParts(d),f=m=>Number(p.find(g=>g.type===m)?.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,t.timeZone));let s,a=n.getHours(),o=n.getMinutes();t.format12h24h==="12ampm"&&(s=a>=12?"PM":"AM");let l,u,h=a;switch(t.format12h24h!=="24"&&(h=a%12,h===0&&(h=12)),i){case"HH:mm:ss":l=[h,o,r];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=[r],s=void 0;break;case"year":u=n.getFullYear();break;case"month":u=n.getMonth()+1;break;case"dayOfYear":u=Math.floor((n.getTime()-new Date(n.getFullYear(),0,0).getTime())/864e5);break;case"dayOfMonth":u=n.getDate();break;case"secondOfDay":u=60*a*60+60*o+r;break;default:console.error("Unknown time format",i),u=0}return l!==void 0?{textValue:l,suffix:s}:u}var JH,Tw,XX=V(()=>{}),IOe=V(()=>{le(),NA(),IA(),JH=class extends vw(Dye){constructor(e,t=15,i=10066329){super(e,t,i),this.object=e,this.added=!1,this.name=`DirectionalLightHelper: ${e.uuid}`}raycast(e,t){yw(this.object,JH.geometryHelper,e,t)}}}),q4=V(()=>{le(),IOe(),UA(),Tw=class extends W4(JE,JH){constructor(e,t,i){super(),this.super_Entity(e,t),this.castShadow=!0,this.shadow.mapSize.width=2048,this.shadow.mapSize.height=2048,this.shadow.normalBias=1,this.layers.enable(3);let r=this.shadow.camera;r.top=1250,r.bottom=-1250,r.right=1250,r.left=-1250,r.near=-1e4,r.far=2500;let n=new eA(this.shadow.camera);n.visible=!1,this.gizmos.shadowmap=n}update(){this.shadow.camera.updateProjectionMatrix();for(let e in this.gizmos){let t=this.gizmos[e];t instanceof eA&&t.update()}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.objectHelper&&this.objectHelper.update()}updateState(e,t){this.updateState_Light(e,t);let i=e.depth!==void 0&&e.depth!==this.shadow.camera.far||e.size!==void 0&&e.size/2!==this.shadow.camera.right;e.size!==void 0&&function(r,n){r.shadow.camera.right=n/2,r.shadow.camera.left=-n/2,r.shadow.camera.top=n/2,r.shadow.camera.bottom=-n/2,r.shadow.needsUpdate=!0}(this,e.size),e.shadowRadius!==void 0&&(this.shadow.radius=e.shadowRadius),e.shadowResolution!==void 0&&(this.shadow.mapSize.set(e.shadowResolution,e.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),e.penumbraSize!==void 0&&t.scene.markPenumbraSizeDirty(),i&&this.update()}}});function YX(e){return e instanceof bl&&e.needsAO&&!Gf(e)&&e.isDecalObject!==!0}function KX(e){let t=e.cloner;if(t&&Array.isArray(t.children))for(let i of t.children)i?.layers&&(i.layers.mask=e.layers.mask)}function ZX(e){return e.getLayersOfType("reflection").filter(t=>t.data.visible).length}function OOe(e){let t=1/0,i=-1/0;for(let r of e.getLayersOfType("reflection")){let n=r.data;if(!n.visible||n.mirror===1)continue;let s=typeof n.blur=="number"?n.blur:null;t=Math.min(t,s??0),i=Math.max(i,s??10)}return t===1/0?null:{min:t,max:i}}function LOe(e){for(let t of e.getLayersOfType("reflection")){let i=t.data;if(!i.visible)continue;let{blur:r,thickness:n,steps:s,stepSize:a}=i;return typeof r!="number"||typeof n!="number"||typeof s!="number"||typeof a!="number"?"variable":{blur:r,thickness:n,steps:s,stepSize:a,tracingMode:i.tracingMode===1?1:0}}return null}function cie(e,t){let i={outline:!1,cavity:!1},r=e.layers.mask&$4,n=t.getLayersOfType("transmission"),s=t.getLayersOfType("outline"),a=ZX(t),o=t.getLayersOfType("cavity");return(s.length>0||o.length>0)&&(e.layers.set(8),n.length>0&&e.layers.enable(3),a>0&&e.layers.enable(4),i.outline=s.length>0,i.cavity=o.length>0,Rx(e),Cx(e)),n.length===0&&s.length===0&&o.length===0&&a===0&&e.layers.set(0),r&&e.layers.set(9),!r&&YX(e)&&e.layers.enable(5),KX(e),i}function pie(e,t){if(!t.layers)return!1;let i=e.layers.mask&$4,r=!1,n=t.getLayersOfType("transmission").filter(l=>l.data.visible),s=t.getLayersOfType("outline").filter(l=>l.data.visible),a=ZX(t),o=t.getLayersOfType("cavity").filter(l=>l.data.visible);return n.length>0&&(e.layers.set(3),(s.length>0||o.length>0)&&e.layers.enable(8),a>0&&e.layers.enable(4),r=!0),n.length===0&&s.length===0&&o.length===0&&a===0&&e.layers.set(0),i&&e.layers.set(9),!i&&YX(e)&&e.layers.enable(5),KX(e),r}function fie(e,t){var i;if(!t.layers)return!1;let r=e.layers.mask&$4,n=!1,s=ZX(t),a=t.getLayersOfType("transmission").filter(u=>u.data.visible),o=t.getLayersOfType("outline").filter(u=>u.data.visible),l=t.getLayersOfType("cavity").filter(u=>u.data.visible);return s>0&&((i=e.userData).__splinePlanarMirror??(i.__splinePlanarMirror=0),e.layers.set(4),a.length>0&&e.layers.enable(3),(o.length>0||l.length>0)&&e.layers.enable(8),n=!0),s===0&&a.length===0&&o.length===0&&l.length===0&&e.layers.set(0),r&&e.layers.set(9),!r&&YX(e)&&e.layers.enable(5),KX(e),n}function eW(e,t,i,r=!1){let n=e.cloner;if(n){let s=null;if(e.raycast===Cr.prototype.raycast||e.raycast===Ss.prototype.raycast){let a=e.geometry;a&&(a.boundingSphere===null&&a.computeBoundingSphere(),s=a.boundingSphere)}for(let a of n.children){if(s!==null&&(tW.copy(s).applyMatrix4(a.matrixWorld),!t.ray.intersectsSphere(tW)))continue;let o=Dbe.copy(a.matrixWorld).invert(),l=Nbe.copy(t.ray).applyMatrix4(o),u=e.matrixWorld;l.applyMatrix4(u);let h=Pbe;h.set(l.origin,l.direction),h.near=t.near,h.far=t.far,h.layers.mask=t.layers.mask;let d=h.intersectObject(e,!1);d.length>0&&i.push({...d[0],object:r?a:e})}}}var $4,Pbe,Dbe,Nbe,tW,y3,Ibe,r5,n5,s5,Mw,Ks,QX=V(()=>{rs(),H4(),Na(),h1(),le(),$4=512,Pbe=new Y$,Dbe=new Ve,Nbe=new mf,tW=new qa}),BOe=V(()=>{le(),NA(),IA(),y3=class extends vw(Rye){constructor(e,t=6710886){super(e,t),this.object=e,this.matrix=e.matrixWorld,this.name=`SpotLightHelper: ${e.uuid}`}raycast(e,t){yw(this.object,y3.geometryHelper,e,t)}update(){if(this.object!==void 0){let e=y3._vector,t=this.object.distance?this.object.distance:1e3,i=t*Math.tan(this.object.angle);this.cone.scale.set(i,i,t),e.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(e);let r=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let n=0,s=this.cone.material.length;n<s;n++)this.cone.material[n].color.set(r);else this.cone.material.color.set(r)}}},(Ibe=y3)._vector=new P}),X4=V(()=>{le(),BOe(),UA(),r5=new P,n5=new P,s5=new jt,Mw=class extends W4(uy,Ibe){constructor(e,t,i){super(),this.super_Entity(e,t),this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let r=this.shadow.camera;r.fov=2*ht.RAD2DEG*this.angle,r.aspect=1,r.near=100,r.far=2500;let n=new eA(this.shadow.camera);n.visible=!1,this.gizmos.shadowmap=n,this.update()}update(){this.shadow.camera.updateProjectionMatrix();for(let e in this.gizmos){let t=this.gizmos[e];t instanceof eA&&t.update()}}updateMatrixWorld(e){super.updateMatrixWorld(e),n5.setFromMatrixPosition(this.matrixWorld),s5.setFromRotationMatrix(this.matrixWorld),r5.copy(this.up).applyQuaternion(s5).negate().multiplyScalar(this.distance),this.target.position.copy(n5).add(r5),this.target.updateMatrixWorld(),this.objectHelper&&this.objectHelper.update()}updateState(e,t){this.updateState_Light(e,t),e.distance!==void 0&&(this.distance=e.distance),e.decay!==void 0&&(this.decay=e.decay),e.angle!==void 0&&(this.angle=e.angle),e.penumbra!==void 0&&(this.penumbra=e.penumbra),e.shadowRadius!==void 0&&(this.shadow.radius=e.shadowRadius),e.penumbraSize!==void 0&&t.scene.markPenumbraSizeDirty(),e.shadowResolution!==void 0&&(this.shadow.mapSize.set(e.shadowResolution,e.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null))}}}),Xf=V(()=>{Wt(),Nh(),le(),xl(),bu(),XX(),qf(),q4(),Nr(),$f(),le(),h1(),Qg(),QX(),X4(),_r(),BA(),Ks=class extends L4(Zo){constructor(e,t,i){if(super(),this.data=t,this.bgColor=new Fr(1,1,1,1),this.fog=null,this.backupFog=new Jj(16777215,.1,2e3),this.fogUseBGColor=!1,this.fogMode="linear",this.fogDensity=Xn.getDensity({}),this.fogHeightFalloff=Xn.getHeightFalloff({}),this.fogHeightBase=Xn.getHeightBase({}),this.isActive=!1,this.skyState=null,this.skyStateVersion=0,this.gradingState=null,this.skyHdriHolder=null,this.aoColor=new ot,this.penumbraSizeArrayCache=null,this.super_Entity(e,t),this.personalCamera=new us(a1,{...gE.defaultData,...t.camera,name:"Personal Camera"}),this.personalCamera.objectHelper.visible=!1,this.add(this.personalCamera),this.activeCamera=this.personalCamera,this.ambientLight=new _4(13882323,8553090,.75*Math.PI),this.ambientLight.name="Default Ambient Light",this.ambientLight.layers.enable(3),this.ambientLight.removeFromParent(),this.add(this.ambientLight),t.uiScene){let r=gH();r===null?Ma("ui-2d","a page's 2D scene"):this.uiScene=new r.Scene2D((Array.isArray(e)?e[0]:e)+"-ui",t.uiScene,{dpr:window.devicePixelRatio,shared:i.shared})}else t.uiFrame&&this.createUICanvas(t.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(e,t){let i=gH();i!==null?(this.uiCanvas=new i.UICanvas(this.uuid+"-uiscreen",window.innerWidth,window.innerHeight,t),this.uiCanvas.isScreenSpace=!0,this.uiCanvas.promise.then(()=>{this.uiCanvas?.applyFrame(e),this.uiCanvas?.applySize()})):Ma("ui-2d","a page's UI canvas")}updateVisible(){}setBackgroundColor(e){this.bgColor=e,this.fogUseBGColor===!0&&(this.backupFog.color=e)}entityChildrenCount(){return this.uiScene?this.uiScene.children.length:super.entityChildrenCount()}updateAmbientLight(e,t){e.color!==void 0&&(this.ambientLight.color=vo(e.color,t)),e.intensity!==void 0&&(this.ambientLight.intensity=e.intensity*Math.PI),e.enabled!==void 0&&(e.enabled?this.add(this.ambientLight):this.remove(this.ambientLight))}onDeactive(){this.isActive=!1}onActive(e){this.isActive=!0,e.fog=this.fog,this.traverseEntity(t=>{t instanceof Lg&&t.recomputeBoolean()}),this.updateShadow(this.data.shadow)}forceMaterialsUpdate(){this.traverseEntity(e=>{if(e instanceof bl)if(Array.isArray(e.material))for(let t of e.material)t.needsUpdate=!0;else e.material.needsUpdate=!0,e.material.dispose()})}updateShadow(e){if(e.softShadowQuality===void 0&&e.type===void 0||!this.isActive)return;let t=this.data.shadow;var i,r;i=dy.isSoft(t),r=t?.softShadowQuality,YH!==void 0&&YH(i,r)&&this.forceMaterialsUpdate()}updateFog(e,t){e.enabled?this.fog=this.backupFog:this.fog=null,this.isActive&&(this.scene.fog=this.fog),this.fogUseBGColor=e.useBackgroundColor,e.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=vo(e.color,t),this.backupFog.near=e.near,this.backupFog.far=e.far,this.fogMode=Xn.getMode(e),this.fogDensity=Xn.getDensity(e),this.fogHeightFalloff=Xn.getHeightFalloff(e),this.fogHeightBase=Xn.getHeightBase(e)}updateSky(e,t){this.skyState=e??null,this.skyStateVersion++;let i=e?.hdri?.image;this.skyHdriHolder=i!=null?t.image(i):null}updateAo(e,t){e.aoColor!==void 0&&(this.aoColor=vo(e.aoColor,t))}updateByOp(e,t,i,r){let n=this.data.uiFrame;super.updateByOp(e,t,i,r);let s=t;Jr(e.path,["fog"])?this.updateFog(s.fog,i.shared):Jr(e.path,["sky"])?this.updateSky(s.sky,i.shared):Jr(e.path,["grading"])?this.gradingState=s.grading??null:Jr(e.path,["ao"])?this.updateAo(s.ao,i.shared):Jr(e.path,["ambient"])?this.updateAmbientLight(s.ambient,i.shared):Jr(e.path,["shadow"])?this.updateShadow(s.shadow):e.type===0&&e.path.length===0&&(e.props.uiFrame!==void 0||n!==s.uiFrame)&&this.updateUIFrame(e.props.uiFrame,i)}updateUIFrame(e,t){e?(this.uiCanvas||this.createUICanvas(e,t),this.uiCanvas.enabled=!0,this.uiCanvas.applyFrame(e)):this.uiCanvas&&(this.uiCanvas.enabled=!1)}updateState(e,t){this.updateState_Entity(e,t),e.backgroundColor!==void 0&&this.setBackgroundColor(vo(e.backgroundColor,t.shared)),e.fog!==void 0&&this.updateFog(e.fog,t.shared),e.sky!==void 0&&this.updateSky(e.sky,t.shared),e.grading!==void 0&&(this.gradingState=e.grading),e.ambient!==void 0&&this.updateAmbientLight(e.ambient,t.shared),e.ao!==void 0&&this.updateAo(e.ao,t.shared),e.shadow!==void 0&&this.updateShadow(e.shadow)}createFrame(e,t){}raycast(e,t){super.raycast(e,t)}switchActiveCamera(e){e&&e.isDescendantOf(this)&&(this.activeCamera!==this.personalCamera&&(this.activeCamera.objectHelper.visible=!0),this.activeCamera=e,e.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(Vf).fill(.5);let e=0,t=0;this.traverseEntity(i=>{if(!i.visible)return!0;i instanceof Tw&&i.visible&&e<yE&&(this.penumbraSizeArrayCache[e]=i.data.penumbraSize??.5,e+=1),i instanceof Mw&&i.visible&&e<Vf-yE&&(this.penumbraSizeArrayCache[yE+t]=i.data.penumbraSize??.5,t+=1)})}raycastWithClones(e){let t=[],i=r=>{for(let n of r.children){let s=n.cloner;hr.is(n)&&(n.visible||s?.object.data.visible)&&((gd(n)||TL(n)&&this.scene.enableHelpers&&n.objectHelper.visible)&&(e.intersectObject(n,!1,t),eW(n,e,t,!0)),i(n))}};return i(this),t}updateEntity2DByOp(e,t,i,r){this.uiCanvas?.updateEntity2DByOp(e,t,i,r)}}});function mie(){return JX}function a5(){if(ML===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 ML}function o5(e){return e?.isWebGPUSplineRenderer===!0}var JX,ML,eY=V(()=>{JX=null,ML=null});function iW(){return iY}var tY,iY,rY=V(()=>{tY=null,iY=null});function gie(e,t,i){return PM.setRGB(e,t,i,Yi),{r:PM.r,g:PM.g,b:PM.b}}function UOe(e,t,i){let r,n=vA(e.angle,0),[s,a]=rW(e.offset),[o,l]=rW(e.morph),u=e.colors??[],h=e.steps??[],d=Math.min(10,u.length,h.length);if(d===0)return[1,1,1,1];if(e.gradientType===1){let g=3*(t+o)-(t+s)-1,v=3*(i+l)-(i+a)-1;r=Math.hypot(g,v)+n}else if(e.gradientType===2){let g=-1*Math.atan2(t+o-.5+s,i+l-.5+a),v=n/Math.PI/-2+.5*g/Math.PI;r=v-Math.floor(v)}else{let g=.5+o/(t!==0?t:1e-6),v=l/(i!==0?i:1e-6),y=Math.cos(n)*g-Math.sin(n)*v,_=Math.sin(n)*g+Math.cos(n)*v,b=y*y+_*_;r=b>1e-12?(((t-.5+s)/2+y/2)*y+((i-.5+a)/2+_/2)*_)/b:0}let c=u[0][0],p=u[0][1],f=u[0][2],m=u[0][3];for(let g=1;g<d;g++){let v=h[g-1],y=h[g]-v,_=y!==0?Math.min(1,Math.max(0,(r-v)/y)):r>=v?1:0;e.smooth&&(_=_*_*(3-2*_)),c+=(u[g][0]-c)*_,p+=(u[g][1]-p)*_,f+=(u[g][2]-f)*_,m+=(u[g][3]-m)*_}return[c,p,f,m]}function FOe(e,t){let i=e,r=i?.data?.layers;if(r&&typeof r.forEach=="function"){let n=t,s=[];return r.forEach(a=>{let o=a.data;if(o.visible===!1||o.isMask===!0)return;let l=vA(o.alpha,1);if(!(l<=0))if(o.type==="color"){let u,h=o.color;typeof h=="string"?u=typeof n?.color=="function"?n.color(h):void 0:h&&typeof h.r=="number"&&(u=h),u&&s.push({kind:"color",layer:o,rgb:{...gie(u.r,u.g,u.b),a:u.a??1},alpha:l})}else o.type==="gradient"&&s.push({kind:"gradient",layer:o,alpha:l})}),s.length===0?null:(a,o)=>{let l=1,u=1,h=1,d=!0;for(let c of s){let p,f,m,g;if(c.kind==="color")({r:p,g:f,b:m}=c.rgb),g=c.rgb.a;else{let[y,_,b,x]=UOe(c.layer,a,o);({r:p,g:f,b:m}=gie(y,_,b)),g=x}let v=d?1:Math.min(1,Math.max(0,g*c.alpha));l+=(p-l)*v,u+=(f-u)*v,h+=(m-h)*v,d=!1}return{r:l,g:u,b:h}}}if(i?.color&&i.color.isColor===!0){let{r:n,g:s,b:a}=i.color;return()=>({r:n,g:s,b:a})}return null}var PM,vA,rW,zOe=V(()=>{le(),PM=new ot,vA=(e,t)=>typeof e=="number"&&Number.isFinite(e)?e:t,rW=e=>Array.isArray(e)&&typeof e[0]=="number"&&typeof e[1]=="number"?[e[0],e[1]]:[0,0]});function kOe(e,t){if(e==="torus"){let l=t()*Math.PI*2,u=t()*Math.PI*2,h=Math.cos(l),d=Math.sin(l),c=Math.cos(u),p=Math.sin(u);return{x:(1.4+.7*c)*h,y:-(1.4+.7*c)*d,z:.7*p,nx:c*h,ny:-c*d,nz:p,cr:1,cg:1,cb:1}}if(e==="cylinder"){let l=t()*Math.PI*2,u=Math.cos(l),h=Math.sin(l);return{x:.8*u,y:1.6*(t()-.5),z:.8*h,nx:u,ny:0,nz:h,cr:1,cg:1,cb:1}}let i=t()*Math.PI*2,r=2*t()-1,n=Math.acos(r),s=Math.sin(n)*Math.cos(i),a=Math.cos(n),o=Math.sin(n)*Math.sin(i);return{x:s,y:a,z:o,nx:s,ny:a,nz:o,cr:1,cg:1,cb:1}}function VOe(e){let{geometry:t,matrix:i}=e,r=t.getAttribute("position");if(!r||r.count<3)return null;let n=t.getAttribute("normal"),s=t.getAttribute("uv"),a=t.getAttribute("color"),o=t.getIndex(),l=o?o.count/3:r.count/3;if(l<1)return null;let u=(v,y)=>o?o.getX(3*v+y):3*v+y,h=i?i.elements:null,d=i?new hi().getNormalMatrix(i).elements:null,c=v=>{let y=r.getX(v),_=r.getY(v),b=r.getZ(v);return h?h[0]*y+h[4]*_+h[8]*b+h[12]:y},p=v=>{let y=r.getX(v),_=r.getY(v),b=r.getZ(v);return h?h[1]*y+h[5]*_+h[9]*b+h[13]:_},f=v=>{let y=r.getX(v),_=r.getY(v),b=r.getZ(v);return h?h[2]*y+h[6]*_+h[10]*b+h[14]:b},m=new Float64Array(l),g=0;for(let v=0;v<l;v++){let y=u(v,0),_=u(v,1),b=u(v,2),x=c(y),w=p(y),S=f(y),M=c(_)-x,T=p(_)-w,E=f(_)-S,A=c(b)-x,R=p(b)-w,N=f(b)-S,D=T*N-E*R,O=E*A-M*N,z=M*R-T*A;g+=.5*Math.sqrt(D*D+O*O+z*z),m[v]=g}return g<=0?null:{total:g,sample:(v,y)=>{let _=0,b=l-1;for(;_<b;){let se=_+b>>1;m[se]<v?_=se+1:b=se}let x=_,w=u(x,0),S=u(x,1),M=u(x,2),T=y(),E=y();T+E>1&&(T=1-T,E=1-E);let A,R,N,D=1-T-E,O=c(w)*D+c(S)*T+c(M)*E,z=p(w)*D+p(S)*T+p(M)*E,U=f(w)*D+f(S)*T+f(M)*E;if(n){if(A=n.getX(w)*D+n.getX(S)*T+n.getX(M)*E,R=n.getY(w)*D+n.getY(S)*T+n.getY(M)*E,N=n.getZ(w)*D+n.getZ(S)*T+n.getZ(M)*E,d){let se=d[0]*A+d[3]*R+d[6]*N,ve=d[1]*A+d[4]*R+d[7]*N,oe=d[2]*A+d[5]*R+d[8]*N;A=se,R=ve,N=oe}}else{let se=c(w),ve=p(w),oe=f(w),fe=c(S)-se,_e=p(S)-ve,Z=f(S)-oe,pe=c(M)-se,H=p(M)-ve,F=f(M)-oe;A=_e*F-Z*H,R=Z*pe-fe*F,N=fe*H-_e*pe}let G=Math.sqrt(A*A+R*R+N*N)||1,j=1,K=1,q=1;if(a)j=a.getX(w)*D+a.getX(S)*T+a.getX(M)*E,K=a.getY(w)*D+a.getY(S)*T+a.getY(M)*E,q=a.getZ(w)*D+a.getZ(S)*T+a.getZ(M)*E;else if(e.sampleColor){let se=s?s.getX(w)*D+s.getX(S)*T+s.getX(M)*E:.5,ve=s?s.getY(w)*D+s.getY(S)*T+s.getY(M)*E:.5,oe=e.sampleColor(se,ve);oe&&(j=oe.r,K=oe.g,q=oe.b)}return{x:O,y:z,z:U,nx:A/G,ny:R/G,nz:N/G,cr:j,cg:K,cb:q}}}}function vie(e){let t=Math.min(Math.max(1,Math.floor(e.guideStrands)),Px),i=function(l){let u=l>>>0;return()=>{u|=0,u=u+1831565813|0;let h=Math.imul(u^u>>>15,1|u);return h=h+Math.imul(h^h>>>7,61|h)^h,((h^h>>>14)>>>0)/4294967296}}(e.seed??1337),r=e.shape==="object"&&e.sampler,n=r?e.samplerRadius??ad:ad,s=new Float32Array(4*Qp),a=new Float32Array(Qp),o=new Float32Array(4*Px).fill(1);for(let l=0;l<t;l++){let u=r?e.sampler(i):kOe(e.shape,i),h=r?u.x:u.x*n,d=r?u.y:u.y*n,c=r?u.z:u.z*n,{nx:p,ny:f,nz:m}=u;o[4*l+0]=u.cr,o[4*l+1]=u.cg,o[4*l+2]=u.cb;let g,v,y,_=l*zv,b=(1.8+.8*i())*e.hairLength*n/(zv-1),x=.5+1.5*i(),w=(.02+.06*i())*n;Math.abs(f)<.99?(g=-m,v=0,y=p):(g=1,v=0,y=0);let S=Math.sqrt(g*g+v*v+y*y)||1;for(let M=0;M<zv;M++){let T=M/(zv-1),E=T*T*.4*n,A=w*Math.sin(T*x*Math.PI*2),R=4*(_+M);s[R+0]=h+p*b*M+A*g/S,s[R+1]=d+f*b*M-E+A*v/S,s[R+2]=c+m*b*M+A*y/S,s[R+3]=M===0?0:1,M<zv-1&&(a[_+M]=b)}}return{initialPositions:s,restLengths:a,unitScale:n,rootColors:o}}var zv,Px,Qp,ad,ug,FS,W1,P0,q1,yI,Obe=V(()=>{le(),Qp=(Px=16384)*(zv=32),ad=100}),Lbe=V(()=>{le(),Na(),rY(),zOe(),Obe(),ug=1/60,FS=new Ve,W1=new jt,P0=new P,q1=new P,yI=class extends Ss{constructor(e,t,i){super(e,t),this.type="HairSystem",this.isHairSystem=!0,this.simRunning=!1,this.previewRequested=!1,this.playModeActive=!1,this.pendingSimSeconds=0,this.simTime=0,this.resetRequested=!0,this.generation=0,this.settledSimSeconds=0,this.lastMotionFingerprint=0,this.lastBoneQuat=new jt,this.lastBonePos=new P,this.hasLastBone=!1,this.baseFoundAtRegen=!1,this.baseSourceGeomsAtRegen=[],this.baseSourceHashesAtRegen=[],this.baseColorHashAtRegen=0,this.baseScaleAtRegen=0,this.classicFallbackWarned=!1,this.regenSnapshot=null,this.context=i,this.data=t,this.geometry.setAttribute("position",new It(new Float32Array(0),3)),this.material=new Zl({colorWrite:!1,depthWrite:!1}),this.frustumCulled=!1,this.scalpMesh=new Cr(new Ff(ad,48,32),new Zl({color:5448477})),this.scalpMesh.name="HairScalp",this.add(this.scalpMesh);let r=new FO;r.setAttribute("position",new It(new Float32Array(12),3)),r.setIndex([0,2,1,2,3,1]),r.instanceCount=0,this.ribbonMesh=new Cr(r,new Zl({visible:!1})),this.ribbonMesh.name="HairRibbons",this.ribbonMesh.frustumCulled=!1,this.ribbonMesh.visible=!1,this.ribbonMesh.matrixAutoUpdate=!1,this.ribbonMesh.updateMatrixWorld=()=>{this.ribbonMesh.matrixWorld.identity()},this.ribbonMesh.updateWorldMatrix=()=>{this.ribbonMesh.matrixWorld.identity()},this.add(this.ribbonMesh),this.activeGuideStrands=t.guideStrands,this.roots=this.buildRoots(),this.regenSnapshot={guideStrands:t.guideStrands,hairLength:t.hairLength,spreadRadius:t.spreadRadius,headShape:t.headShape,baseObjectId:t.baseObjectId},this.applyScalpState(),this.applyShadowState(),this.syncSimRunning()}update(e){!this.simRunning||(this.pendingSimSeconds=Math.min(this.pendingSimSeconds+e/1e3,4*ug*2),this.trackMotionRest(e/1e3))}trackMotionRest(e){this.boneTransform(W1,P0);let t=this.hasLastBone&&(Math.abs(this.lastBoneQuat.dot(W1))<.9999995||this.lastBonePos.distanceToSquared(P0)>1e-8),i=this.motionFingerprint(),r=!this.hasLastBone||t||this.resetRequested||i!==this.lastMotionFingerprint||this.data.windStrength>.001;this.lastBoneQuat.copy(W1),this.lastBonePos.copy(P0),this.lastMotionFingerprint=i,this.hasLastBone=!0,this.settledSimSeconds=r?0:this.settledSimSeconds+e}motionFingerprint(){let e=this.data;return e.gravity+2*e.damping+3*e.localStiffness+4*e.globalStiffness+5*e.globalRange+6*e.stiffnessFalloff+7*e.windStrength+8*e.vspCoefficient+9*e.kink+10*e.kinkFrequency+11*e.clumpStrength+12*e.clumpSize+13*e.clumpTipScale}get isSimulating(){return(this.simRunning||this.resetRequested)&&this.visible}get isMotionSettled(){return this.settledSimSeconds>6}get isVisiblyAnimating(){return this.isSimulating&&!this.isMotionSettled}startPreview(){this.previewRequested=!0,this.syncSimRunning()}stopPreview(){this.previewRequested=!1,this.syncSimRunning()}setPlayMode(e){this.playModeActive=e,e&&this.resetSimulation(),this.syncSimRunning()}resetSimulation(){this.resetRequested=!0,this.pendingSimSeconds=0,this.simTime=0,this.settledSimSeconds=0}warnClassicFallbackOnce(){this.classicFallbackWarned||(this.classicFallbackWarned=!0,console.warn("[spline] Hair System strands require the WebGPU renderer \u2014 the WebGL fallback shows only the scalp. Reload with ?renderer=webgpu in a WebGPU-capable browser."))}syncSimRunning(){this.simRunning=this.playModeActive||this.previewRequested||this.data.autoPlay}updateState(e,t){super.updateState(e,t),this.updateHairState(e)}updateHairState(e){if((e.guideStrands!==void 0||e.hairLength!==void 0||e.spreadRadius!==void 0||e.headShape!==void 0||e.baseObjectId!==void 0)&&this.regenerate(),(e.headShape!==void 0||e.baseObjectId!==void 0)&&this.applyScalpState(),e.headColor!==void 0){let t=this.scalpMesh.material;t.isMeshBasicMaterial===!0&&t.color.setRGB(e.headColor.r,e.headColor.g,e.headColor.b,Yi)}(e.castShadow!==void 0||e.receiveShadow!==void 0)&&this.applyShadowState(),e.autoPlay!==void 0&&this.syncSimRunning()}applyShadowState(){let e=this.data.castShadow??!0,t=this.data.receiveShadow??!0;this.castShadow=e,this.receiveShadow=t,this.scalpMesh.castShadow=e,this.scalpMesh.receiveShadow=t,this.ribbonMesh.castShadow=e,this.ribbonMesh.receiveShadow=t}regenerate(){this.activeGuideStrands=Math.max(1,Math.min(Math.floor(this.data.guideStrands),16384)),this.roots=this.buildRoots(),this.generation++,this.regenSnapshot={guideStrands:this.data.guideStrands,hairLength:this.data.hairLength,spreadRadius:this.data.spreadRadius,headShape:this.data.headShape,baseObjectId:this.data.baseObjectId},this.resetSimulation()}checkDataDrift(){let e=this.data,t=this.regenSnapshot;if(t===null||t.guideStrands!==e.guideStrands||t.hairLength!==e.hairLength||t.spreadRadius!==e.spreadRadius||t.headShape!==e.headShape||t.baseObjectId!==e.baseObjectId){let i=t===null||t.headShape!==e.headShape||t.baseObjectId!==e.baseObjectId;this.regenerate(),i&&this.applyScalpState()}this.syncSimRunning(),this.applyShadowState(),this.checkBaseDrift()}buildRoots(){let{headShape:e,baseObjectId:t,guideStrands:i,hairLength:r}=this.data;if(this.baseFoundAtRegen=!1,this.baseSourceGeomsAtRegen=[],this.baseSourceHashesAtRegen=[],this.baseColorHashAtRegen=0,this.baseScaleAtRegen=0,e==="object"&&t){let n=this.context.scene.find(t);if(n){this.baseFoundAtRegen=!0,n.updateWorldMatrix(!0,!0);let s=this.collectBaseSources(n),a=s?function(o){let l=[];for(let d of o){let c=VOe(d);c&&l.push(c)}if(l.length===0)return null;let u=new Float64Array(l.length),h=0;for(let d=0;d<l.length;d++)h+=l[d].total,u[d]=h;return h<=0?null:d=>{let c=d()*h,p=0,f=l.length-1;for(;p<f;){let g=p+f>>1;u[g]<c?p=g+1:f=g}let m=p===0?c:c-u[p-1];return l[p].sample(m,d)}}(s.sources):null;if(this.baseSourceGeomsAtRegen=s?.sources.map(o=>o.geometry)??[],this.baseSourceHashesAtRegen=s?.hashes??[],this.baseColorHashAtRegen=s?.colorHash??0,s&&a){let o=this.baseWorldScale(n),l=Math.max(s.radius*o,.001);this.baseScaleAtRegen=o;let u=o;return vie({shape:"object",guideStrands:i,hairLength:r,sampler:h=>{let d=a(h);return{...d,x:d.x*u,y:d.y*u,z:d.z*u}},samplerRadius:l})}}}return vie({shape:e==="object"?"sphere":e,guideStrands:i,hairLength:r})}collectBaseSources(e){let t=[],i=[],r=0,n=0;FS.copy(e.matrixWorld).invert();let s=FS.clone(),a=o=>{if(o.isHairSystem===!0||o!==e&&o.visible===!1)return;let l=o.geometry;if(o.isMesh===!0&&l&&(l.getAttribute("position")?.count??0)>=3){let u=o===e?void 0:new Ve().multiplyMatrices(s,o.matrixWorld),h=Array.isArray(o.material)?o.material[0]:o.material;t.push({geometry:l,matrix:u,sampleColor:FOe(h,this.context.shared)??void 0}),i.push(yI.matrixHash(u)),n+=function(c,p){let f=c,m=0,g=1,v=_=>{m+=_*g,g+=1},y=f?.data?.layers;if(y&&typeof y.forEach=="function"){let _=p;y.forEach(b=>{let x=b.data;if(x.visible!==!1){if(x.type==="color"){let w=x.color,S=typeof w=="string"?typeof _?.color=="function"?_.color(w):void 0:w;S&&typeof S.r=="number"&&(v(S.r),v(S.g),v(S.b)),v(vA(x.alpha,1))}else if(x.type==="gradient"){let w=x;for(let S of w.colors??[])v(S[0]),v(S[1]),v(S[2]),v(S[3]);for(let S of w.steps??[])v(S);v(vA(w.angle,0)),v(w.gradientType),v(w.smooth?1:0)}}})}else f?.color&&f.color.isColor===!0&&(v(f.color.r),v(f.color.g),v(f.color.b));return m}(h,this.context.shared),l.boundingSphere===null&&l.computeBoundingSphere();let d=l.boundingSphere;if(d){let c=0,p=1;u?(P0.copy(d.center).applyMatrix4(u),c=P0.length(),p=yI.matrixMaxScale(u)):c=d.center.length(),r=Math.max(r,c+d.radius*p)}}for(let u of o.children)a(u)};return a(e),t.length===0?null:{sources:t,hashes:i,radius:Math.max(r,.001),colorHash:n}}static matrixHash(e){if(!e)return 0;let t=e.elements,i=0;for(let r=0;r<16;r++)i+=t[r]*(r+1);return i}static matrixMaxScale(e){let t=e.elements,i=Math.hypot(t[0],t[1],t[2]),r=Math.hypot(t[4],t[5],t[6]),n=Math.hypot(t[8],t[9],t[10]);return Math.max(i,r,n,1e-6)}baseWorldScale(e){return FS.copy(e.matrixWorld).decompose(P0,W1,q1),Math.max(Math.abs(q1.x),Math.abs(q1.y),Math.abs(q1.z),1e-6)}get widthWorldScale(){return this.data.headShape==="object"&&this.data.baseObjectId&&this.baseScaleAtRegen>0?this.baseScaleAtRegen:1}checkBaseDrift(){if(this.data.headShape!=="object"||!this.data.baseObjectId)return;let e=this.context.scene.find(this.data.baseObjectId);if(!e)return;if(!this.baseFoundAtRegen)return void this.regenerate();e.updateWorldMatrix(!0,!0);let t=this.collectBaseSources(e),i=t?.sources??[],r=t?.hashes??[],n=this.baseSourceGeomsAtRegen,s=this.baseSourceHashesAtRegen,a=i.length!==n.length;if(!a){for(let o=0;o<i.length;o++)if(i[o].geometry!==n[o]||Math.abs(r[o]-s[o])>1e-4*Math.max(Math.abs(s[o]),1)){a=!0;break}}if(!a&&this.data.hairColorSource==="object"&&(t?.colorHash??0)!==this.baseColorHashAtRegen&&(a=!0),!a&&i.length>0){let o=this.baseWorldScale(e);a=Math.abs(o-this.baseScaleAtRegen)>.001*Math.max(this.baseScaleAtRegen,1e-6)}a&&this.regenerate()}applyScalpState(){let e=this.data.headShape,t=e==="object"&&this.data.baseObjectId!==null;this.scalpMesh.visible=!t,!t&&(this.scalpMesh.geometry.dispose(),this.scalpMesh.geometry=e==="torus"?new UO(1.4*ad,.7*ad,24,48):e==="cylinder"?new uE(.8*ad,.8*ad,1.6*ad,48,1):new Ff(ad,48,32))}boneTransform(e,t){let i=this.matrixWorld;if(this.data.headShape==="object"&&this.data.baseObjectId){let r=this.context.scene.find(this.data.baseObjectId)?.matrixWorld;r&&(i=r)}FS.copy(i).decompose(t,e,q1)}raycast(e,t){if(!this.scalpMesh.visible)return;let i=[];this.scalpMesh.raycast(e,i);for(let r of i)r.object=this,t.push(r)}get shadowBoundsRadius(){let e=this.data.headShape==="torus"?2.6:1.5;return this.roots.unitScale*(e+2.6*Math.max(this.data.hairLength,0))}getShadowBoundsCenter(e){return this.boneTransform(W1,e),e}updateEntityBoxSize(e,t){let i=this.shadowBoundsRadius;e.set(0,0,0),t.set(i,i,i)}dispose(){super.dispose(),this.scalpMesh.geometry.dispose(),this.scalpMesh.material.dispose(),this.ribbonMesh.geometry.dispose(),this.ribbonMesh.material.dispose?.(),iW()?.release(this)}}});function _I(){return{shapeInput:()=>`
4169
+ `&&T.push("")):x.getTextWidth(T[T.length-1]+E,b)>M&&(T[T.length-1].length&&T.push(""),x.getTextWidth(T[T.length-1]+E,b)>M&&(E.length===1?(T[T.length-1]+=E,E=""):(T[T.length-1]+=E.slice(0,-1),E=E[E.length-1],T.push(""))));return T[T.length-1]+=E,T}(e,i,u===2?h.toUpperCase():u===3?h.toLowerCase():h,t),{shapes:c,charWidths:p,charCoords:f}=i.generateShapes(d,e,t),m=.5*(typeof r=="number"?r:Number(t.getVariable(r))),g=.5*(typeof n=="number"?n:Number(t.getVariable(n))),v=c.map(b=>new hs().fromShape(b,!0));this.vectorShapes=v;let y=v.map(b=>Zg.create({shape:b,parameters:{depth:s,extrudeBevelSegments:o,extrudeBevelSize:a,windingRule:s<=0?xn.NONZERO:xn.ODD,subdivisions:this.isLowResolution&&s>0?1:12}})),_=y.length?Kv(y):Yte();_.translate(-m,g,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 e=Ho(new At,FH.prototype);return e.copy(this),console.log("CloneGeometry",this,e),e}copy(e){return Object.entries(e.attributes).forEach(([t,i])=>{this.setAttribute(t,i)}),this.setIndex(e.index),this.userData={parameters:{...e.userData.parameters},type:"TextGeometry"},this}async setText(e,t){this.font&&await this.font.loadingPromise,await this.update({...this.userData.parameters,text:{textValue:e}},t)}get text(){return this.userData.parameters.text??""}}});function ROe(e){if(!zH)return Zte||(Zte=async function(){let t=e??"https://cdn.spline.design/@splinetool/runtime@2.0.37/build",i=import("./process.js"),[r,n]=await Promise.all([i,fetch(`${t}/process.wasm`).then(o=>o.arrayBuffer())]),s=r.default,a=await s({wasmBinary:n});vbe(a),zH=!0}())}var vbe,VX,zH,Zte,V4=V(()=>{VX=new Promise(e=>{vbe=e}),zH=!1});function jF(e,t){if(Object.keys(e.morphAttributes).length>0||Object.keys(t.morphAttributes).length>0)return!1;let i=Object.keys(e.attributes),r=Object.keys(t.attributes);if(i.length!==r.length)return!1;for(let o of r){let l=e.attributes[o],u=t.attributes[o];if(l===void 0||l.isInterleavedBufferAttribute===!0||u.isInterleavedBufferAttribute===!0||l.itemSize!==u.itemSize||l.normalized!==u.normalized||l.array.constructor!==u.array.constructor||l.array.length!==u.array.length)return!1}let n=e.index,s=t.index;if(n===null!=(s===null))return!1;let a=!1;if(n!==null&&s!==null){if(n.array.length!==s.array.length)return!1;let o=n.array.constructor,l=s.array.constructor;if(o!==l){if(o!==Uint32Array||l!==Uint16Array)return!1;a=!0}}if(e.groups.length!==t.groups.length)return!1;for(let o=0;o<t.groups.length;o++){let l=e.groups[o],u=t.groups[o];if(l.start!==u.start||l.count!==u.count||l.materialIndex!==u.materialIndex)return!1}for(let o of r){let l=e.attributes[o],u=t.attributes[o];l.array.set(u.array),l.needsUpdate=!0}if(n!==null&&s!==null){if(a){let o=n.array,l=s.array;for(let u=0,h=l.length;u<h;u++){let d=l[u];o[u]=d===65535?4294967295:d}}else n.array.set(s.array);n.needsUpdate=!0}return e.drawRange.start=t.drawRange.start,e.drawRange.count=t.drawRange.count,e.userData=t.userData,e.boundingBox=null,e.boundingSphere=null,!0}function kH(e,t,i,r){let n,s,a,o=e.position.array,l=e.normal.array,u=ybe.makeScale(t,i,r).invert().elements;for(let h=0,d=o.length;h<d;h+=3)o[h]*=t,o[h+1]*=i,o[h+2]*=r,n=l[h],s=l[h+1],a=l[h+2],l[h]=u[0]*n+u[4]*s+u[8]*a,l[h+1]=u[1]*n+u[5]*s+u[9]*a,l[h+2]=u[2]*n+u[6]*s+u[10]*a;e.position.needsUpdate=!0,e.normal.needsUpdate=!0}var ybe,_be=V(()=>{le(),ybe=new Ve});function VH(e){let t=Number(e);return Number.isInteger(t)&&t>=0&&String(t)===e?t:-1}function f3(e){if(e!=null){if(Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView))return e;if(typeof e=="object")return function(t){let i=Object.keys(t),r=0;for(let s of i){let a=VH(s);a>=r&&(r=a+1)}if(r===0||r>i.length)return;let n=new Array(r);for(let s=0;s<r;s++){let a=t[s];if(typeof a!="number")return;n[s]=a}return n}(e)}}function HF(e){if(e==null)return"missing";if(Array.isArray(e))return`Array(${e.length})`;if(ArrayBuffer.isView(e)){let l=e;return`${e.constructor.name}(${l.length})`}if(typeof e!="object")return typeof e;let t=Object.keys(e),i=t.filter(l=>VH(l)===-1),r=0;for(let l of t){let u=VH(l);u>=r&&(r=u+1)}let n=e,s=-1,a=-1;for(let l=0;l<r;l++)l in n?typeof n[l]!="number"&&a===-1&&(a=l):s===-1&&(s=l);let o=[`${t.length} keys`,"max index "+(r-1)];return s!==-1&&o.push(`first missing index ${s}`),a!==-1&&o.push(`non-number at ${a} (${typeof n[a]})`),i.length&&o.push(`stray keys ${i.slice(0,3).join(",")}`),`Object{${o.join(", ")}}`}function bbe(e){let t=Object.keys(e);return t.length===1&&t[0]==="subdivisions"}function GX(e,t){let i=t?t.count:e.count,r=0,n=1e4,s=new Map,a=new Uint32Array(i),o=[];for(let h=0;h<i;h++){let d=t?t.getX(h):h,c=e.getX(d),p=e.getY(d),f=e.getZ(d),m=Math.round(c*n),g=Math.round(p*n),v=Math.round(f*n),y=s.get(m);y===void 0&&(y=new Map,s.set(m,y));let _=y.get(g);_===void 0&&(_=new Map,y.set(g,_));let b=_.get(v);b===void 0&&(b=r++,_.set(v,b),o.push(c,p,f)),a[h]=b}let l=[],u=[];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]),u.push(t?t.getX(h):h,t?t.getX(h+1):h+1,t?t.getX(h+2):h+2));return{positions:o,triIndices:l,triOriginals:u}}var BS,R0,ri,WF,qF,$F,ls,US,m3,g3,v3,GH,gI,xw=V(()=>{le(),V4(),Wt(),G4(),_be(),cA(),BS=new fn,R0=new P,VX.then(e=>{ri=e}),WF=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),qF=new Uint32Array([0,1,2,3]),$F=new Uint8Array([4]),ls=class extends At{constructor(e,t){super(),this.data=e,this.flatShading=t,this.subdivPointer=0,this.rebuild(),this.freeSubdivPointer()}mutateDirectlyScaleBaked(e,t){this.freeSubdivPointer();let i=this.data.scaleBaked.map(a=>typeof a=="number"?a:1),r=Og.div(t.map(a=>typeof a=="number"?a:0),i);if(r.every(a=>a===1))return;this.subdividedGeometry&&kH(this.subdividedGeometry.attributes,...r),this.originalGeometry&&kH(this.originalGeometry.attributes,...r),this.data=e;let n=this.userData.parameters;this.userData.parameters={width:n.width*r[0],height:n.height*r[1],depth:n.depth*r[2]},this.originalGeometry.boundingSphere.center.multiply(R0.fromArray(r));let s=R0.set(n.width,n.height,n.depth).length();this.originalGeometry.boundingSphere.radius=s/2}ensureSubdivPointer(){return this.subdivPointer===0&&this.rebuild(),this.subdivPointer}mutateDirectlySubdivisions(e){this.freeSubdivPointer(),this.data=e;let t=e.phongAngle??35;this.flatShading&&(t=-1);let i=null;if(e.subdivisions>0){let n=0;try{n=ls.allocate(e),i=ls.buildRefined(n,e.subdivisions,t)}catch(s){console.error(s,e)}finally{n&&ls.freeSubdivPointer(n)}}this.subdividedGeometry?.dispose(),this.subdividedGeometry=i??void 0,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere);let r=this.userData.parameters;Object.assign(this,this.subdividedGeometry??this.originalGeometry),this.userData.parameters=r}rebuild(){let e,t,i;try{({originalGeometry:e,subdividedGeometry:t,subdivPointer:i}=ls.build(this.data,void 0,!this.flatShading,void 0))}catch{e=new Ph(100,100,100),i=0}this.subdivPointer=i,this.originalGeometry=e,this.subdividedGeometry=t??void 0;let r=this.subdividedGeometry??this.originalGeometry;Object.assign(this,r),this.calcBoundingBox()}freeSubdivPointer(){this.subdivPointer&&(ls.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0)}dispose(){super.dispose(),this.freeSubdivPointer()}calcBoundingBox(){let e=this.originalGeometry;e.boundingSphere===null&&(e.boundingSphere=new qa,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=e.boundingSphere));let t=e.attributes.position,i=e.boundingSphere.center;BS.setFromBufferAttribute(t),BS.getCenter(i),e.boundingSphere.radius=i.distanceTo(BS.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),BS.getSize(R0);let r={width:R0.x,height:R0.y,depth:R0.z};return this.userData.parameters=r,r}static build(e,t,i,r){let n,s,a=e?.phongAngle??35;i===!1&&(a=-1),t&&(ri.free_bvh(t),ri.free_subdivision_surface(t));try{n=ls.allocate(e,r)}catch(l){console.error(l,e),n=ls.allocate({positionWASM:WF,indexWASM:qF,verticesPerFaceWASM:$F},r)}ri.set_destination_refinement_level(n,0);let o=ls.buildLevel(n,!0,a);return s=e.subdivisions>0?ls.buildRefined(n,e.subdivisions,a):null,{subdivPointer:n,originalGeometry:o,subdividedGeometry:s}}static buildRefined(e,t,i){try{return ri.set_destination_refinement_level(e,t),ls.buildLevel(e,!1,i)??null}catch{try{return ri.set_destination_refinement_level(e,t-1),ls.buildLevel(e,!1,i)??null}catch{return null}}}static primitiveToQuads(e,t,i){e.widthSegments>16&&(e.widthSegments=16),e.heightSegments>16&&(e.heightSegments=16),e.depthSegments>16&&(e.depthSegments=16),e.radialSegments>16&&(e.radialSegments=16),e.type==="DodecahedronGeometry"&&(e.detail=0);let r,n=e.shape!==void 0||e.path!==void 0?t.geometry:Cg(e,i,!1,t);r=b_e(e)?n.getClosedTorusIndicesForBooleanOrSubdiv():n.getIndex();let s,{positions:a,triIndices:o,triOriginals:l}=GX(n.getAttribute("position"),r);if(e.type==="CylinderGeometry"&&e.cornerRadius===0&&e.hollow===0&&e.openEnded===!1){let c=e.radialSegments*e.heightSegments*3*2;s=[c,c+3*e.radialSegments]}let{indices:u,verticesPerFace:h,uvs:d}=function(c,p,f,m,g){let v=[],y=[],_=g?f.getAttribute("uv"):void 0,b=_&&_.itemSize===2?[]:void 0,x=M=>{if(b){let T=g[M];b.push(_.getX(T),_.getY(T))}};if(f.userData.shape!==void 0&&f.userData.parameters.depth===0&&f.userData.shape.shapeHoles.length===0){let M=f.userData.shape.extractShapePointsToFlatArray([]),T=f.userData.parameters.spikes;if(f.userData.type==="EllipseGeometry"&&T<=24&&T%4==0&&f.userData.parameters.angle>=360){let R=M.length/2/T;M=M.filter((N,D)=>Math.floor(D/2)%R===0)}let E=0;for(let R=0;R<M.length;R+=2)E+=(M[R]-M[(R===0?M.length:R)-2])*(M[R+1]+M[(R===0?M.length:R)-1]);c.length=0;let A=0;if(E<0)for(let R=0;R<M.length;R+=2)c.push(M[R],M[R+1],0),v.push(A++);else for(let R=M.length-2;R>=0;R-=2)c.push(M[R],M[R+1],0),v.push(A++);return y.push(A),{indices:v,verticesPerFace:y}}let w=new Float32Array([f.userData.parameters.depth])[0],S=0;for(;S<p.length;){if(f.useNgonForTopBottomFaceDuringBake){let M=0;if((c[3*p[S]+2]===w||c[3*p[S]+2]===0)&&M++,(c[3*p[S+1]+2]===w||c[3*p[S+1]+2]===0)&&M++,(c[3*p[S+2]+2]===w||c[3*p[S+2]+2]===0)&&M++,M===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]){US.set(c[3*p[S]],c[3*p[S]+1],c[3*p[S]+2]),m3.set(c[3*p[S+1]],c[3*p[S+1]+1],c[3*p[S+1]+2]),g3.set(c[3*p[S+4]],c[3*p[S+4]+1],c[3*p[S+4]+2]),v3.set(c[3*p[S+5]],c[3*p[S+5]+1],c[3*p[S+5]+2]),m3.sub(US).normalize(),g3.sub(US).normalize(),v3.sub(US).normalize();let M=m3.cross(g3).dot(v3),T=S;Math.abs(M)>.005||m&&m.some((E,A)=>A%2!=1&&T>=m[A]&&T<m[A+1])?(v.push(p[S],p[S+1],p[S+2]),x(S),x(S+1),x(S+2),y.push(3),S+=3):(v.push(p[S],p[S+1],p[S+4],p[S+5]),x(S),x(S+1),x(S+4),x(S+5),y.push(4),S+=6)}else v.push(p[S],p[S+1],p[S+2]),x(S),x(S+1),x(S+2),y.push(3),S+=3}if(f.useNgonForTopBottomFaceDuringBake){let M=[],T=[],E=0;for(let A=0,R=0;A<c.length;A+=3,R++)c[A+2]===0&&(M.push(R),E++),c[A+2]===w&&T.push(R);if(f.userData.parameters.extrudeBevelSize===0){let A=T[0];T[0]=T[1],T[1]=A}M.reverse(),v.push(...M,...T),y.push(E,E),b=void 0}return{indices:v,verticesPerFace:y,uvs:b}}(a,o,n,s,l);return{positions:a,indices:u,verticesPerFace:h,uvs:d}}static allocate(e,t){let i,r,n,s=[],a=[],o=f3(e.positionWASM),l=f3(e.indexWASM),u=f3(e.verticesPerFaceWASM);if(o&&o.length>0){if(!l?.length||!u?.length)throw new Error(`SubdivGeometry.allocate: unusable cage topology \u2014 positionWASM ${HF(e.positionWASM)}, indexWASM ${HF(e.indexWASM)}, verticesPerFaceWASM ${HF(e.verticesPerFaceWASM)}`);i=o,r=l,n=u;let S=f3(e.uvWASM);ri.alloc_subdivision_surface_uvs&&S&&S.length===2*r.length&&(a=S)}else i=WF,r=qF,n=$F;let h=i.length,d=r.length,c=n.length,p=i.length+s.length+a.length,f=r.length+n.length,m=p*Float32Array.BYTES_PER_ELEMENT+f*Uint32Array.BYTES_PER_ELEMENT,g=p*Float32Array.BYTES_PER_ELEMENT,v=ri._malloc(m);if(!v)throw new Error(`SubdivGeometry.allocate: wasm _malloc(${m}) failed`);let y,_=new Float32Array(ri.HEAPF32.buffer,v,p),b=new Uint32Array(ri.HEAPU32.buffer,v+g,f);_.set(i,0),_.set(s,i.length),_.set(a,i.length+s.length),b.set(r,0),b.set(n,r.length),e?.scaleBaked?.some(S=>S!==1)&&(y=new Ve().makeScale(...e.scaleBaked.map(S=>typeof S=="number"?S:1))),t&&(y?y.premultiply(t):y=t);let x=v+(i.length+s.length)*Float32Array.BYTES_PER_ELEMENT,w=a.length?y?ri.alloc_subdivision_surface_uvs2(v,h,v+g,d,v+g+r.length*Uint32Array.BYTES_PER_ELEMENT,c,x,a.length,y.elements):ri.alloc_subdivision_surface_uvs(v,h,v+g,d,v+g+r.length*Uint32Array.BYTES_PER_ELEMENT,c,x,a.length):y?ri.alloc_subdivision_surface2(v,h,v+g,d,v+g+r.length*Uint32Array.BYTES_PER_ELEMENT,c,y.elements):ri.alloc_subdivision_surface(v,h,v+g,d,v+g+r.length*Uint32Array.BYTES_PER_ELEMENT,c);return ri._free(v),w}static buildLevel(e,t,i,r,n,s=!1){let a=n?ri.get_mesh_data2(e,t?ri.Level.CONTROL:ri.Level.REFINED,i,n.elements):ri.get_mesh_data(e,t?ri.Level.CONTROL:ri.Level.REFINED,i),o=ri.HEAPU32.subarray(a>>2,10+(a>>2)),l=o.subarray(4,8),u=0,h=ri.HEAPU32[o[u]>>2],d=ri.HEAPF32.subarray(h>>2,(h>>2)+l[u]);u++;let c=ri.HEAPU32[o[u]>>2],p=ri.HEAPF32.subarray(c>>2,(c>>2)+l[u]);u++;let f=ri.HEAPU32[o[u]>>2],m=ri.HEAPU32.subarray(f>>2,(f>>2)+l[u]);u++;let g,v=ri.HEAPU32[o[u]>>2],y=ri.HEAPU32.subarray(v>>2,(v>>2)+l[u]);if(u++,ri.alloc_subdivision_surface_uvs){let b=o[9];if(b>0){let x=ri.HEAPU32[o[8]>>2];g=ri.HEAPF32.subarray(x>>2,(x>>2)+b)}}if(r===void 0){let b=new At;if(b.setIndex(new Uf(y,1)),b.setAttribute("position",new Et(d,3)),b.setAttribute("normal",new Et(p,3)),g&&b.setAttribute("uv",new Et(g,2)),t){b.setAttribute("faceMap",new Uf(m,1));let x=new Float32Array(p.length/3*4).fill(0);b.setAttribute("color",new It(x,4))}return ri.free_mesh_data(a),b.userData.type="SubdivGeometry",b}if(r.getAttribute("position").copyArray(d),r.getAttribute("normal").copyArray(p),r.attributes.position.needsUpdate=!0,r.attributes.normal.needsUpdate=!0,s){let b=r.getIndex();b!==null&&b.array.length===y.length&&(b.copyArray(y),b.needsUpdate=!0)}let _=r.getAttribute("uv");g&&_&&_.array.length===g.length&&(_.copyArray(g),_.needsUpdate=!0),ri.free_mesh_data(a)}static freeSubdivPointer(e){ri.free_bvh(e),ri.free_subdivision_surface(e)}static buildControlCageWireframe(e,t,i){let r=ri.get_wireframe_data_for_base_level(e),n=ri.HEAPU32.subarray(r>>2,4+(r>>2)),s=n.subarray(2,4),a=0,o=ri.HEAPU32[n[a]>>2],l=ri.HEAPF32.subarray(o>>2,(o>>2)+s[a]);a++;let u=ri.HEAPU32[n[a]>>2],h=ri.HEAPU32.subarray(u>>2,(u>>2)+s[a]);if(t===void 0){let d=new At;d.setAttribute("position",new Et(l,3));let c=new Float32Array(l.length);for(let p=0,f=l.length;p<f;)c[p++]=i.r,c[p++]=i.g,c[p++]=i.b;return d.setAttribute("color",new It(c,3)),d.setIndex(new Uf(h,1)),ri.free_wireframe_data_for_base_level(r),d}t.getAttribute("position").copyArray(l),t.attributes.position.needsUpdate=!0,ri.free_wireframe_data_for_base_level(r)}static updateCollabMesh(e,t,i){let r=t===0;r||ri.set_destination_refinement_level(e,t);let n=i?ri.get_topological_data2(e,r?ri.Level.CONTROL:ri.Level.REFINED,i.elements):ri.get_topological_data(e,r?ri.Level.CONTROL:ri.Level.REFINED),s=ri.HEAPU32.subarray(n>>2,8+(n>>2)),a=s.subarray(3,6),o=0,l=ri.HEAPU32[s[o]>>2],u=new Float32Array(ri.HEAPF32.subarray(l>>2,(l>>2)+a[o]));o++;let h=ri.HEAPU32[s[o]>>2],d=new Uint32Array(ri.HEAPU32.subarray(h>>2,(h>>2)+a[o]));o++;let c,p=ri.HEAPU32[s[o]>>2],f=new Uint8Array(ri.HEAPU32.subarray(p>>2,(p>>2)+a[o]));if(ri.alloc_subdivision_surface_uvs){let m=s[7];if(m>0){let g=ri.HEAPU32[s[6]>>2];c=new Float32Array(ri.HEAPF32.subarray(g>>2,(g>>2)+m))}}return ri.free_topological_data(n),{positions:u,indices:d,verticesPerFace:f,uvs:c}}},US=new P,m3=new P,g3=new P,v3=new P}),xbe=V(()=>{_te(),bte(),gL(),xte(),_L(),cA(),Bte(),Ute(),Fte(),BH(),Vte(),bL(),Gte(),jte(),Hte(),UH(),Wte(),qte(),$te(),Xte(),Gg(),_r(),_te(),bte(),gL(),xte(),_L(),AOe(),cA(),Bte(),Ute(),Fte(),BH(),Vte(),bL(),Gte(),jte(),Hte(),UH(),Wte(),qte(),$te(),Xte(),Gg(),COe(),Q_e(),gbe(),xw(),V4(),U4(),GH={ConeGeometry:z_e,CubeGeometry:k_e,CylinderGeometry:BX,DodecahedronGeometry:V_e,EllipseGeometry:z4,HelixGeometry:x_e,IcosahedronGeometry:ibe,LatheGeometry:rbe,NonParametricGeometry:sbe,PolygonGeometry:zX,PyramidGeometry:abe,RectangleGeometry:k4,SphereGeometry:hbe,PlaneGeometry:ube,BackdropGeometry:dbe,StarGeometry:kX,TextFrameGeometry:cbe,TorusGeometry:pbe,TorusKnotGeometry:fbe,TriangleGeometry:mbe,VectorGeometry:Zg},gI=e=>{let t=GH[e.type]??o_e(e.type);if(t===void 0)throw new Error(`No geometry factory registered for "${e.type}" \u2014 was its feature compiled out of this runtime build?`);return t.create(e)}});function Cg(e,t,i,r){let n,s,a;e.type==="PathGeometry"?(s=JSON.parse(JSON.stringify(e)),a=[[],["extrusion"]]):(s={...e},a=[[]]);for(let u of a){let h=s;for(let d of u)h=h[d];for(n in h){let d=h[n];zJ(d)&&!wbe.includes(n)&&(h[n]=t.getVariable(d,[r.uuid,"geometry",...u,n]),zJ(h[n])&&(h[n]=1))}}let o,l={parameters:s,type:s.type};if(s.type==="PathGeometry")l.path=s.path;else if(s.type==="VectorGeometry"){let u=hs.createFromState(s.shape,s.width,s.height);l.shape=u}else if(s.type==="NonParametricGeometry"){if(s.data.groups&&s.data.groups?.forEach(u=>u.materialIndex=Math.max(u.materialIndex??0,0)),l.geometry=new $$().parse(s),l.geometry.groups.length===0){let u=l.geometry;u.addGroup(0,Math.max(u.getIndex()?.count??0,u.getAttribute("position").count),0)}}else{if(s.type==="SubdivGeometry"){let u=new ls(s,i);return u.data=e,u}if(s.type==="TextGeometry"||s.type==="InputGeometry"){let u=o_e(s.type);if(u)return u.create(s,t);Ma("text",`a ${s.type}`);let h=hs.createFromState(lA.defaultData(),100,100);return gI({...s,shape:h,type:"VectorGeometry"})}if(s.type==="UIGeometry")return k4.create({parameters:{width:s.width,height:s.height,cornerRadius:s.cornerRadius,cornerType:s.cornerType}})}try{o=gI(l)}catch(u){console.error(u),console.error(`Error generating geometry with inputs: ${l}`);let h=hs.createFromState(lA.defaultData(),100,100);l.shape=h,l.type="VectorGeometry",o=gI(l)}return o}var wbe,Qte,jH,G4=V(()=>{Wt(),le(),xbe(),_r(),bL(),Kg(),xw(),wbe=["font"]}),POe=V(()=>{G4(),Qte=class{constructor(){this.objects=new Map,this.unreachable=new Set}getCached(e){return this.objects.get(e)}get size(){return this.objects.size}get(e,t,i){let r=this.objects.get(e);return r===void 0?(r=this.createObject(e,t,i),this.objects.set(e,r)):r.isShared=!0,r}forceDelete(e){let t=this.objects.get(e);t&&(this.disposeObject(t),this.objects.delete(e))}adopt(e,t){this.objects.set(e,t)}mutateIfUnique(e,t){let i=this.objects.get(e);if(i&&i.isShared!==!0)return this.objects.delete(e),this.objects.set(t,i),i}startGc(){this.unreachable=new Set(this.objects.keys())}markAsReachable(e,t){t===this.objects.get(e)&&this.unreachable.delete(e)}endGc(){this.unreachable.forEach(e=>{this.disposeObject(this.objects.get(e)),this.objects.delete(e)}),this.unreachable.clear()}dispose(){this.objects.forEach(e=>{this.disposeObject(e)}),this.objects.clear()}},jH=class extends Qte{constructor(e){super(),this.flatShading=e}disposeObject(e){e.dispose()}createObject(e,t,i){let r=Cg(e,t,this.flatShading,i);return r.computeBoundingSphere(),r}}});function xL(){return LA}function Sbe(){if(LA==="webgpu"){if(WH!==void 0)return WH;$H||($H=!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(qH===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 qH}function Tbe(e,t){return Sbe().createRootMaterial(e,t)}function Jte(e,t,i){return Sbe().createSharedMaterial(e,t,i)}function eie(e){return e.getLayersOfType===void 0&&Object.assign(e,{layers:[],getLayersOfType:()=>[],hasAO:!1,assetsLoaded:()=>!0}),e}function HH(){return Ebe}var LA,WH,qH,$H,XH,Mbe,Ebe,YH,Abe,$f=V(()=>{LA="webgl",$H=!1}),DOe=V(()=>{Abe={markNeedsUpdateRendererDirty:()=>{}}});function xd(e,t){let i=0;if(!e.layers||e.layers.length===0)return!1;let r=e.layers?.find(n=>n.data.type==="light");if(r){let n=r.data,s=Number(t.getVariable(n.alphaOverride));if((typeof n.alphaOverride=="string"?s/100:n.alphaOverride)<1)return!0}for(let n of e.layers){if(n.data.type!=="displace"&&n.data.isMask)return!0;if(n.data.type!=="displace"&&"alpha"in n.data&&n.data.type!=="light"&&n.data.type!=="fresnel"&&n.data.type!=="cavity"&&n.data.type!=="dust"&&n.data.type!=="texture"&&n.data.type!=="matcap"&&n.data.type!=="rainbow"&&n.data.type!=="outline"&&n.data.type!=="pattern"){let s=n.data.visible?n.data.alpha:0;if(typeof s=="string"&&(s=Math.max(0,Math.min(1,Number(t.getVariable(s)??100)/100))),s===1&&n.data.type==="depth"||n.data.type==="gradient"){for(let a of n.data.colors)if(a[3]<1){s=a[3];break}}else if(s===1&&n.data.type==="noise"){let a=t.color(n.data.colorA).a,o=t.color(n.data.colorB).a,l=t.color(n.data.colorC).a,u=t.color(n.data.colorD).a,h=Math.min(a,Math.min(o,Math.min(l,u)));h<1&&(s=h)}i+=(1-i)*s}}return i<1}var j4=V(()=>{});function zf(e){return typeof e=="string"||typeof e=="number"&&e!==0}var Ih,Lt,ww,jX,tie,iie,Rh,Md=V(()=>{Ih=(e,t,i)=>Math.max(0,Math.min(1,Number(t.getVariable(typeof e=="number"?100*e:e,i)??100)/100))??1,Lt=(e,t,i)=>typeof e=="number"?e:t.getVariable(e,i),ww={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"]},jX={depth:["colors"],gradient:["colors","steps"],toon:["colors","steps"]}}),Sw=V(()=>{le(),OA(),tie=class extends O4(un){},iie=e=>e.type==="Mesh",Rh=class extends tie{constructor(e){super(),this.object=e,this.isClone=!0,this.matrixAutoUpdate=!1,this.hasNonUniformScale=e.hasNonUniformScale}raycast(e,t){}expand(){let e=0,t=this.object.entityChildren(e);for(;t;){let i=this.children[e];i?.object!==t&&(i&&this.remove(i),i=new Rh(t),this.add(i),this.children.splice(e,0,this.children.pop()),i.matrixWorldNeedsUpdate=!0,i.matrixAutoUpdate=!1,i.matrix=t.matrix,i.hiddenMatrix=t.hiddenMatrix,i.pivotMatrix=t.pivotMatrix),i.expand(),e+=1,t=this.object.entityChildren(e)}for(;this.children.length>e;)this.remove(this.children[e]);this.pivotMatrix=this.object.pivotMatrix}get visible(){let e=this.object.cloner;return(e===void 0||this.parent!==e||!e.instancingActive&&!e.insideBoolean)&&(this.playModeVisible!==void 0?this.playModeVisible:this.object.visible||this.object.dataPatched.visible&&this.object.dataPatched.cloner?.hideBase===!0)}set visible(e){}get castShadow(){return this.object.castShadow}set castShadow(e){}get receiveShadow(){return this.object.receiveShadow}set receiveShadow(e){}get isMesh(){return iie(this.object)}get isLight(){return this.object.isLight}get layers(){return this.object.layers}set layers(e){}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(e){}}});function rie(){return HX}var HX,WX,qX=V(()=>{HX=null,WX=null});function KH(e){return"variable_"+e}var XF,YF,KF,nie,ZF,sie,aie,wL,$X=V(()=>{Wt(),P_e(),L_e(),F4(),bu(),IX(),LX(),POe(),$f(),N_e(),DOe(),j4(),Md(),xl(),Sw(),Nr(),le(),qX(),_r(),XF=new Ve,YF=new P,KF=new jt,nie=new P,ZF=new Kr,sie=class extends C_e{constructor(e){super(),this.shared=e}create(e){return new NX(e,this.shared)}},(wL=aie=class{constructor(e,t={},i=!0,r=!1){if(this.data=e,this.needsJitter=i,this.enableLocalStorageForPersistentVariables=r,this.geometryCache=new jH(!0),this.geometryCache2=new jH(!1),this.imageHolderCache=new sie(this),this.thisContext={scene:Abe,shared:this},this.deletedImage=new Rc(hH.emptyImage,this),this.deletedVideo=new Rc(JO.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,t.images)for(let[n,s]of Object.entries(t.images))this.addImage(n,s);if(t.videos)for(let[n,s]of Object.entries(t.videos))this.addVideo(n,s);if(t.audios)for(let[n,s]of Object.entries(t.audios))this.addAudio(n,s);if(t.particles)for(let[n,s]of Object.entries(t.particles))this.addParticle(n,s);this.reset(e)}get deletedMaterial(){return this._deletedMaterial??(this._deletedMaterial=Jte(is.defaultTwoLayerData("phong"),this.thisContext,"")),this._deletedMaterial}setRequestRender(e){this._requestRender=e}getImageLoadPromises(){return Object.values(this.images).map(e=>e.loadPromise)}setEntityOpContext(e){this.entityOpContext=e}reset(e,t=!1,i=!1){this.data=e,this.resetLib(e.lib);for(let{id:r,data:n}of e.variables)this.addVariableHolder(r,n),t&&this.updateVariableHolder(r,n);for(let[r,n]of Object.entries(e.userAPIs??{}))this.addUserAPI(r,n);for(let[r,n]of Object.entries(e.userWebhooks??{}))this.addUserWebhook(r,n);if(!i){for(let[r,n]of Object.entries(e.images))this.addImage(r,n);for(let[r,n]of Object.entries(e.videos))this.addVideo(r,n)}for(let[r,n]of Object.entries(e.colors))this.addColor(r,n);for(let[r,n]of Object.entries(e.lib.materials))this.addMaterial(r,n.asset);for(let[r,n]of Object.entries(e.materials))this.addMaterial(r,n);for(let[r,n]of Object.entries(e.audios))this.addAudio(r,n);for(let[r,n]of Object.entries(e.particles))this.addParticle(r,n);for(let[r,n]of Object.entries(e.fonts))this.addFont(r,n)}addMaterial(e,t){if(t.layers===void 0&&(t={...t,layers:is.defaultTwoLayerData("phong").layers}),this.materials[e]){let i=this.materials[e];i.reset(t,this.thisContext),i.dispose()}else{let i=Jte(t,this.thisContext,e);this.materials[e]=i}}deleteMaterial(e){this.materials[e]&&(this.materials[e].nodeMaterialDispose(),delete this.materials[e])}getMaterial(e){return this.materials[e]}getMaterialOrDeletedPlaceholder(e){return this.materials[e]??this.deletedMaterial}material(e){return typeof e=="string"?this.getMaterialOrDeletedPlaceholder(e):e==null?(console.error("material is undefined or null"),this.deletedMaterial):(e.layers===void 0&&(e={...e,layers:is.defaultTwoLayerData("phong").layers}),Tbe(e,this.thisContext))}getMaterials(){return this.materials}addImage(e,t){return this.images[e]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.images[e].updateSrc(t.data),!0):(this.images[e]=new Rc(t,this),!1)}deleteImage(e){let t=this.images[e];t&&(t.dispose(),delete this.images[e])}getDefaultImage(){return this.images.image_0}getImage(e){return this.images[e]??this.deletedImage}image(e){return typeof e=="string"?this.getImage(e):this.imageHolderCache.load(e)}addUIBuffer(e,t){return this.uiBuffers[e]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.uiBuffers[e].updateSrc(t),!0):(this.uiBuffers[e]=new Rc(t,this),!1)}uiBuffer(e){return this.uiBuffers[e]}addVideo(e,t){return this.videos[e]?(this.videos[e].updateSrc(t.data),!0):(this.videos[e]=new Rc(t,this),!1)}deleteVideo(e){let t=this.videos[e];t&&(t.dispose(),delete this.videos[e])}getVideo(e){return this.videos[e]??this.deletedVideo}video(e){return typeof e=="string"?this.getVideo(e):this.imageHolderCache.load(e)}addColor(e,t){return this.colors[e]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),"a"in t?this.colors[e].setRGBA(t.r,t.g,t.b,t.a):this.colors[e].setRGBA(t.r,t.g,t.b,1),!0):(this.colors[e]=new mA(t.r,t.g,t.b,"a"in t?t.a:1),!1)}updateColor(e,t){if(this.colors[e]){this.onColorOrImageUpdate&&this.onColorOrImageUpdate();let i=this.colors[e];return this.colors[e].r=t.r??i.r,this.colors[e].g=t.g??i.g,this.colors[e].b=t.b??i.b,this.colors[e].a=t.a??i.a,!0}return!1}deleteColor(e){this.colors[e]&&delete this.colors[e]}getColor(e){return this.colors[e]}getColorNames(){return Object.values(this.data.colors).map(e=>e.name)}getColorByName(e){for(let t in this.data.colors)if(this.data.colors[t].name===e)return{color:this.colors[t],id:t}}color(e){let t;if(typeof e!="string")return new Fr(e.r,e.g,e.b,"a"in e?e.a:1);{let i=this.getColor(e);i?t=i:(console.warn("Tried to create color layer params with a color key that does not exist in the assets manager"),t=new Fr(0,0,0,0))}return t}addAudio(e,t){this.audios[e]=t}getAudio(e){let t=this.audios[e];if(t instanceof rx)return t;{let i=new rx({src:t.data});return this.audios[e]=i,i}}addParticle(e,t){this.particles[e]=t}getParticle(e){return this.particles[e]}deleteParticle(e){this.particles[e]&&delete this.particles[e]}deleteAudio(e){let t=this.audios[e];t&&(t instanceof rx&&t.dispose(),delete this.audios[e])}addFont(e,t){let i=OX;i!==null?(this.fonts[e]=new i(t),this.fonts[e].loadingPromise.then(()=>this.requestRender())):Ma("text","a font asset")}getFont(e){return this.fonts[e]}deleteFont(e){this.fonts[e]&&delete this.fonts[e]}dispose(){Object.keys(this.materials).forEach(e=>this.deleteMaterial(e)),this._requestRender=void 0,Object.values(this.audios).forEach(e=>{e instanceof rx&&e.dispose()}),this.audios={},this.particles={},this.geometryCache.dispose(),this.geometryCache2.dispose()}addVariableHolder(e,t){if(this.variables[e]===void 0){let i=t.value;if(this.enableLocalStorageForPersistentVariables&&t.persistent){let r=localStorage.getItem(KH(e));i=r!==null?JSON.parse(r):t.value}return this.variables[e]={value:i,locations:[],persistent:t.persistent},"dynamicVariableType"in t&&(this.variables[e].dynamicVariablePlayState="Playing",this.variables[e].dynamicVariableToggleIsForward=void 0),!0}return this.variables[e].value=t.value,!1}resetDynamicVariablePlayState(){for(let e in this.variables)this.variables[e].dynamicVariablePlayState!==void 0&&(this.variables[e].dynamicVariablePlayState="Playing",this.variables[e].dynamicVariableToggleIsForward=void 0)}updateVariableHolder(e,t){this.updateVariable(e,t.value)}updateVariable(e,t){if(this.variables[e]===void 0)return!1;this.variables[e].value=t,this.enableLocalStorageForPersistentVariables&&this.variables[e].persistent&&localStorage.setItem(KH(e),JSON.stringify(t));let i=t;for(;typeof i=="string";)i=this.variables[i].value;let r=this.entityOpContext.scene,n=!1;for(let s=this.variables[e].locations.length-1;s>=0;s--){let a=this.variables[e].locations[s];if(a[0]==="material"){let o=a[1],l=i,u={scene:r,shared:this},h=a.slice(2);r.traverseMaterial(c=>{let p=c.root??c;p.uuid===o&&p.onVariableUpdate(h,l,u)});let d=this.materials[o];d&&d.onVariableUpdate(h,l,u)}else{let o=r.find(a[0]);if(o===void 0){this.variables[e].locations.splice(s,1);continue}if(n=!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*ht.DEG2RAD:o[a[a.length-1]]=i}if(o=r.find(a[0]),o.type==="ParticleEmitter"&&o.updateVariableState(i,a),hr.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 u=l.dataPatched;l.chooseGeoemtryCache(this).forceDelete(u.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 n&&r.markShadowsDirty(),this.requestRender(),!0}updateEntityGeometryParams(e,t){let i=e;if(i.component&&(i=i.component),typeof i.chooseGeoemtryCache!="function")return!1;let r=i.dataPatched,n=r?.geometry;if(!n||typeof n.type!="string"||n.type==="VectorGeometry"||n.type==="PathGeometry")return!1;let s=u=>u.toLowerCase().replace(/[\s_.-]+/g,""),a=new Map;for(let u of Object.keys(n))a.set(s(u),u);let o={};for(let[u,h]of Object.entries(t??{})){let d=a.get(s(u));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 c=n[d];typeof h=="number"&&isFinite(h)&&(typeof c=="number"||typeof c=="string")&&(o[d]=h)}if(Object.keys(o).length===0)return!1;let l={...n,...o};return i.dataPatched={...r,geometry:l},this.transientGeometryKeys.has(n)&&i.chooseGeoemtryCache(this).forceDelete(r.geometry),this.transientGeometryKeys.add(l),i.createGeometryDelayed(this.entityOpContext),i.onVariableUpdate(!0),i.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}resetEntityGeometryParams(e){let t=e;if(t.component&&(t=t.component),typeof t.chooseGeoemtryCache!="function")return!1;let i=t.dataPatched?.geometry;return!(!i||!this.transientGeometryKeys.has(i)||(t.dataPatched=t.data,t.chooseGeoemtryCache(this).forceDelete(i),t.createGeometryDelayed(this.entityOpContext),t.onVariableUpdate(!0),t.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),0))}updateEntityGeometryVertices(e,t){let i=e;if(i.component&&(i=i.component),typeof i.chooseGeoemtryCache!="function")return!1;let r=i.dataPatched,n=r?.geometry;if(!n||n.type!=="NonParametricGeometry")return!1;let s=t?.vertices;if(s===void 0||typeof s.length!="number"||s.length<9||s.length%3!=0||s.length/3>aie.MAX_TRANSIENT_VERTICES)return!1;let a,o,l,u=s instanceof Float32Array?s:Float32Array.from(s),h=u.length/3;if(t.normals!==void 0){if(t.normals.length!==u.length)return!1;a=t.normals instanceof Float32Array?t.normals:Float32Array.from(t.normals)}if(t.uvs!==void 0){if(t.uvs.length!==2*h)return!1;o=t.uvs instanceof Float32Array?t.uvs:Float32Array.from(t.uvs)}if(t.indices!==void 0){let x=h>65535?Uint32Array.from(t.indices):Uint16Array.from(t.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=n.data,w=x?.index;if(w?.array?.length){if(h<(x?.attributes?.position?.array?.length??0)/3){let S=w.array;for(let M=0;M<S.length;M++)if(S[M]>=h)return!1}l=w}}let d=1/0,c=1/0,p=1/0,f=-1/0,m=-1/0,g=-1/0;for(let x=0;x<u.length;x+=3){let w=u[x],S=u[x+1],M=u[x+2];w<d&&(d=w),w>f&&(f=w),S<c&&(c=S),S>m&&(m=S),M<p&&(p=M),M>g&&(g=M)}let v=(x,w)=>({array:x,itemSize:w,type:"Float32Array",normalized:!1}),y={position:v(u,3)};a&&(y.normal=v(a,3)),o&&(y.uv=v(o,2));let _={...n,width:f-d,height:m-c,depth:g-p,data:{attributes:y,...l?{index:l}:{}}},b=this.transientGeometryKeys.has(n);return i.dataPatched={...r,geometry:_},this.transientGeometryKeys.add(_),i.applyTransientGeometryData(this.entityOpContext,b),i.onVariableUpdate(!0),i.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}setEntityInstanceTransforms(e,t){let i=e;i.component&&(i=i.component);let r=i.cloner;if(r===void 0)return-1;let n=r.children,s=Math.PI/180,a=!1;if(t===null)for(let o of n)o.transformOverride!==void 0&&(o.transformOverride=void 0,a=!0);else{if(!Array.isArray(t))return n.length;{let o=Math.min(t.length,n.length);for(let l=0;l<o;l++){let u=t[l],h=n[l];if(u==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]};u.position&&(typeof u.position.x=="number"&&(d.position[0]=u.position.x),typeof u.position.y=="number"&&(d.position[1]=u.position.y),typeof u.position.z=="number"&&(d.position[2]=u.position.z)),u.rotation&&(typeof u.rotation.x=="number"&&(d.rotation[0]=u.rotation.x*s),typeof u.rotation.y=="number"&&(d.rotation[1]=u.rotation.y*s),typeof u.rotation.z=="number"&&(d.rotation[2]=u.rotation.z*s)),u.scale&&(typeof u.scale.x=="number"&&(d.scale[0]=u.scale.x),typeof u.scale.y=="number"&&(d.scale[1]=u.scale.y),typeof u.scale.z=="number"&&(d.scale[2]=u.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?r.update(this.entityOpContext):r.syncInstanceMatrices(),r.invalidateTransform(i),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),n.length}spawnRuntimeClone(e,t={}){if(typeof e.entityChildren!="function")return;let i=e.parent;if(i===null)return;let r=new Rh(e);r.playModeVisible=t.visible!==!1,r.expand(),typeof t.name=="string"&&(r.name=t.name);let n=Math.PI/180;return r.position.copy(e.position),r.rotation.copy(e.rotation),r.scale.copy(e.scale),r.hiddenMatrix.copy(e.hiddenMatrix),t.position&&(typeof t.position.x=="number"&&(r.position.x=t.position.x),typeof t.position.y=="number"&&(r.position.y=t.position.y),typeof t.position.z=="number"&&(r.position.z=t.position.z)),t.rotation&&(typeof t.rotation.x=="number"&&(r.rotation.x=t.rotation.x*n),typeof t.rotation.y=="number"&&(r.rotation.y=t.rotation.y*n),typeof t.rotation.z=="number"&&(r.rotation.z=t.rotation.z*n)),t.scale&&(typeof t.scale.x=="number"&&(r.scale.x=t.scale.x),typeof t.scale.y=="number"&&(r.scale.y=t.scale.y),typeof t.scale.z=="number"&&(r.scale.z=t.scale.z)),r.updateMatrix(),i.add(r),r.updateWorldMatrix(!0,!0),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),r}destroyRuntimeClone(e){e.removeFromParent(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender()}updateEntityMaterialParams(e,t){let i=e.material;if(!i)return!1;let r=[];for(let u of Array.isArray(i)?i:[i]){let h=u.root??u;h&&Array.isArray(h.layers)&&h.data&&!r.includes(h)&&r.push(h)}if(r.length===0)return!1;let n={scene:this.entityOpContext.scene,shared:this},s=u=>u.toLowerCase().replace(/[\s_.-]+/g,""),a=u=>{if(typeof u=="string"){let h=new Fr(1,1,1,1);try{h.set(u)}catch{return null}return{r:h.r,g:h.g,b:h.b,a:void 0}}if(u&&typeof u=="object"&&"r"in u){let h=u;if([h.r,h.g,h.b].some(c=>typeof c!="number"||!isFinite(c)))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=(u,h,d)=>{if(!u.hasValue(h))return!1;let c=u.getValue(h);if(!c||typeof c!="object"||!c.isColor)return!1;let p=d.a??(typeof c.a=="number"?c.a:1);return c instanceof mA?u.setValue(h,new Fr(d.r,d.g,d.b,p)):typeof c.setRGBA=="function"?c.setRGBA(d.r,d.g,d.b,p):c.setRGB(d.r,d.g,d.b),!0},l=!1;for(let u of r){let h=u.data.layers??[],d=c=>u.layers.find(p=>p.uuid===c);if(t.color!==void 0){let c=a(t.color),p=h.find(m=>m.data.type==="color"),f=p&&d(p.id);if(c&&f&&o(f,"color",c)&&(l=!0,c.a!==void 0)){let m=c.a<1||xd(u.data,this);u.setTransparent?u.setTransparent(m,n.scene):u.transparent=m}}typeof t.alpha=="number"&&isFinite(t.alpha)&&(u.onVariableUpdate?.(["alphaOverride"],Math.max(0,Math.min(t.alpha,100)),n),l=!0);for(let c of t.layers??[]){if(!c||typeof c!="object")continue;let p=typeof c.id=="string"?h.find(v=>v.id===c.id):typeof c.index=="number"?h[c.index]:typeof c.type=="string"?h.find(v=>v.data.type===c.type):void 0,f=p&&d(p.id);if(!p||!f)continue;let m=ww[p.data.type]??[],g=Object.keys(p.data);for(let[v,y]of Object.entries(c)){if(v==="id"||v==="index"||v==="type")continue;let _=g.find(x=>x===v)??g.find(x=>s(x)===s(v))??v;if(m.includes(_))continue;let b=a(y);if(b&&o(f,_,b))l=!0;else if(typeof y=="number"&&isFinite(y))u.onVariableUpdate?.(["layer",p.id,_],y,n),l=!0;else if(Array.isArray(y)&&y.length<=3&&y.every(x=>typeof x=="number"&&isFinite(x))){let x=["x","y","z"];y.forEach((w,S)=>{u.onVariableUpdate?.(["layer",p.id,_,x[S]],w,n)}),l=!0}}}}return l&&this.requestRender(),l}deleteVariable(e){this.variables[e]&&delete this.variables[e]}getVariable(e,t){if(Array.isArray(e)){if(e[0]==="mouse")return this.mouseProperty?.[e[1]]??0;if(e[0]==="raycast")return this.raycastProperty?.[e[1]]??0;let i=this.entityOpContext.scene.find(e[0]);if(e[1]==="width"||e[1]==="height"||e[1]==="depth")return i.geometry.userData.parameters[e[1]];if((e[1]==="position"||e[1]==="rotation")&&e.length>2&&i?.getPhysicsLocalMatrix?.(XF))return XF.decompose(YF,KF,nie),e[1]==="position"?YF[e[2]]:(ZF.setFromQuaternion(KF,i.rotation.order),ZF[e[2]]*ht.RAD2DEG);for(let r=1;r<e.length;r++)i=i[e[r]];return e[1]==="rotation"&&(i*=ht.RAD2DEG),i}for(let i in this.variables){if(t===void 0)break;let r=this.variables[i],n=r.locations?.findIndex(s=>Ta.equal(s,t));n!==void 0&&n!==-1&&r.locations.splice(n,1)}if(typeof e=="string"){let i=e,r=e;do{if(r=i,this.variables[i]===void 0)break;let n=this.variables[i].value;t&&this.variables[r]!==void 0&&this.variables[r].locations.push(t),i=n}while(typeof i=="string");return i}return e}getVariables(){return this.variables}getVariablesNames(){return this.data.variables.map(e=>e.data.name)}getVariableByName(e){for(let t of this.data.variables)if(t.data.name===e)return{variable:t.data,id:t.id}}getDynamicVariablePlayState(e){return this.variables[e]?.dynamicVariablePlayState}setDynamicVariablePlayState(e,t){this.variables[e]!==void 0&&(this.variables[e].dynamicVariablePlayState=t)}getDynamicVariableToggleIsForward(e){return this.variables[e]?.dynamicVariableToggleIsForward}setDynamicVariableToggleIsForward(e,t){this.variables[e]!==void 0&&(this.variables[e].dynamicVariableToggleIsForward=t)}resetLib(e){for(let[t,i]of Object.entries(e.images))this.addImage(t,i.asset);for(let[t,i]of Object.entries(e.audios))this.addAudio(t,i.asset);for(let[t,i]of Object.entries(e.particles))this.addParticle(t,i.asset);for(let[t,i]of Object.entries(e.colors))this.addColor(t,i.asset);for(let[t,i]of Object.entries(e.fonts))this.addFont(t,i.asset);for(let[t,i]of Object.entries(e.videos))this.addVideo(t,i.asset);for(let[t,i]of Object.entries(e.variables))this.addVariableHolder(t,i.asset)}updateLibByOp(e,t){e.path[0]==="images"?e.path.length===1&&e.type===1?this.addImage(e.id,e.data.asset):e.path.length===1&&e.type===2&&this.deleteImage(e.id):e.path[0]==="videos"?e.path.length===1&&e.type===1?this.addVideo(e.id,e.data.asset):e.path.length===1&&e.type===2&&this.deleteVideo(e.id):e.path[0]==="audios"?e.path.length===1&&e.type===1?this.addAudio(e.id,e.data.asset):e.path.length===1&&e.type===2&&this.deleteAudio(e.id):e.path[0]==="particles"?e.path.length===1&&e.type===1?this.addParticle(e.id,e.data.asset):e.path.length===1&&e.type===2&&this.deleteParticle(e.id):e.path[0]==="colors"?e.path.length===1&&e.type===1?this.addColor(e.id,e.data.asset):e.path.length===1&&e.type===2&&this.deleteColor(e.id):e.path[0]==="materials"?e.path.length===1&&e.type===1?this.addMaterial(e.id,e.data.asset):e.path.length===1&&e.type===2&&this.deleteMaterial(e.id):e.path[0]==="fonts"?e.path.length===1&&e.type===1?this.addFont(e.id,e.data.asset):e.path.length===1&&e.type===2&&this.deleteFont(e.id):e.path[0]==="variables"?e.path.length===1&&e.type===1?this.addVariableHolder(e.id,e.data.asset):e.path.length===1&&e.type===2&&this.deleteVariable(e.id):e.path[0]==="components"&&t.updateByLibOp(e,this)}updateByOp(e,t,i){if(this.data=t,e.path[0]==="images")e.path.length===2&&e.type===0?e.props.data&&this.getImage(e.path[1]).updateSrc(e.props.data):e.path.length===1&&e.type===1?this.addImage(e.id,e.data):e.path.length===1&&e.type===2&&this.deleteImage(e.id);else if(e.path[0]==="videos")e.path.length===2&&e.type===0?e.props.data&&this.getVideo(e.path[1]).updateSrc(e.props.data):e.path.length===1&&e.type===1?this.addVideo(e.id,e.data):e.path.length===1&&e.type===2&&this.deleteVideo(e.id);else if(e.path[0]==="audios")e.path.length===2&&e.type===0?e.props.data&&this.addAudio(e.path[1],t.audios[e.path[1]]):e.path.length===1&&e.type===1?this.addAudio(e.id,e.data):e.path.length===1&&e.type===2&&this.deleteAudio(e.id);else if(e.path[0]==="particles")e.path.length===2&&e.type===0?e.props.data&&this.addParticle(e.path[1],t.particles[e.path[1]]):e.path.length===1&&e.type===1?this.addParticle(e.id,e.data):e.path.length===1&&e.type===2&&this.deleteParticle(e.id);else if(e.path[0]==="colors")e.path.length===2&&e.type===0?this.updateColor(e.path[1],e.props):e.path.length===1&&e.type===1?this.addColor(e.id,e.data):e.path.length===1&&e.type===2&&this.deleteColor(e.id);else if(e.path[0]==="materials")e.path.length===1&&e.type===1?this.addMaterial(e.id,e.data):e.path.length===1&&e.type===2?this.deleteMaterial(e.id):e.path.length>1&&this.getMaterial(e.path[1]).updateByOp(Xa.drop(e,2),t.materials[e.path[1]],{shared:this,scene:i});else if(e.path[0]==="fonts")e.path.length===2&&e.type===0?this.updateFont(e.path[1],e,i):e.path.length===1&&e.type===1?this.addFont(e.id,e.data):e.path.length===1&&e.type===2&&this.deleteFont(e.id);else if(e.path[0]==="variables")e.path.length===2&&e.type===0?"value"in e.props?this.updateVariable(e.path[1],e.props.value):"persistent"in e.props&&(this.variables[e.path[1]].persistent=e.props.persistent):e.path.length===1&&e.type===4?this.addVariableHolder(e.id,e.data):e.path.length===1&&e.type===5&&this.deleteVariable(e.id);else if(e.path[0]==="userAPIs"){if(e.path.length===1&&e.type===1)this.addUserAPI(e.id,e.data);else if(e.path.length===1&&e.type===2)this.deleteUserAPI(e.id);else if(typeof e.path[1]=="string"){let r=t.userAPIs[e.path[1]];if(r){let n=e.type===0&&e.props.debounce===void 0,s=this.getUserAPI(e.path[1]);s!==void 0&&s===this.openAIRealtime?s.update(r):s?.update(r,this,n)}}}else if(e.path[0]==="userWebhooks"){if(e.path.length===1&&e.type===1)this.addUserWebhook(e.id,e.data);else if(e.path.length===1&&e.type===2)this.deleteUserWebhook(e.id);else if(typeof e.path[1]=="string"){let r=t.userWebhooks[e.path[1]];r&&this.getUserWebhook(e.path[1])?.update(r)}}else e.path[0]==="lib"&&this.updateLibByOp(Xa.drop(e,1),i)}updateFont(e,t,i){if(t.props.url){let r=this.getFont(e),n={...this.data.fonts[e],url:t.props.url};r.update(n),r.loadingPromise.then(()=>this.requestRender()),i.updateFont(e,this)}}addUserAPI(e,t){if(this.userAPIs[e])return this.userAPIs[e].update(t,this),!0;if(this.openAIRealtime?.id===e)return this.openAIRealtime.update(t),!0;if(t.integration?.type==="VoiceAssistant"){let i=WX;return i===null?(Ma("ai-assistant","a voice-assistant integration"),!1):(this.openAIRealtime=i(t,e,this),!1)}{let i=rie();return i===null?(Ma("api-services","a user API integration"),!1):(this.userAPIs[e]=i.createUserAPI(e,t,this),!1)}}getUserAPI(e){return this.openAIRealtime?.id===e?this.openAIRealtime:this.userAPIs[e]}getUserAPIs(){return this.userAPIs}deleteUserAPI(e){let t=this.userAPIs[e];t&&(t.dispose(),delete this.userAPIs[e])}addUserWebhook(e,t){if(this.userWebhooks[e])return this.userWebhooks[e].update(t),!0;{let i=rie();return i===null?(Ma("api-services","a user webhook"),!1):(this.userWebhooks[e]=i.createUserWebhook(e,t),!1)}}getUserWebhook(e){return this.userWebhooks[e]}getUserWebhooks(){return this.userWebhooks}deleteUserWebhook(e){let t=this.userWebhooks[e];t&&(t.dispose(),delete this.userWebhooks[e])}get scene(){return this.entityOpContext.scene}}).MAX_TRANSIENT_VERTICES=6e4,new wL(fu.emptyData())});function Cbe(e){return fL(e)||e?.isTSLNodeMaterial===!0}var bl,QF,JF,e5,oie,t5,Fn,Rbe=V(()=>{DX()}),h1=V(()=>{Wt(),Na(),$f(),Rbe(),Nr(),ha(),bl=class extends Ss{setMaterialOverride(e,t){this.materialOverride=eie(e),this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.materialOverride,this.layers.set(0),this.syncShapeBlendNodeLayer(),t.scene.markNeedsUpdateRendererDirty())}updateByPatchedOp(e,t,i){if(super.updateByPatchedOp(e,t,i),Jr(e.path,["geometry"])&&this.syncShadowCatcher(i),function(r,n){let s=[];if(n.length!==r.length)return null;{let a=0;for(;a<r.length;){if(n[a]==="*")s.push(r[a]);else if(r[a]!==n[a])return null;a+=1}}return s}(e.path,["materials"])!==null&&e.type===0&&Array.isArray(this.material))for(let[r,n]of Object.entries(e.props)){let s=this.material[Number(r)],a=i.shared.material(n);a!==s&&bl.disposeOneMaterial(s),this.material[Number(r)]=a}else if(Jr(e.path,["material"])){let r=this.material;!Array.isArray(r)&&typeof r?.updateByOp=="function"&&"material"in t&&typeof t.material!="string"&&r.updateByOp(Xa.drop(e,1),t.material,i)}else if(Jr(e.path,["materials","*"])&&Array.isArray(this.material)){let r=e.path[1];if("materials"in t&&r<this.material.length){let n=t.materials[r];typeof n!="string"&&this.material[r].updateByOp(Xa.drop(e,2),n,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(e,t){super.updateState(e,t),e.castShadow!==void 0&&(this.castShadow=e.castShadow),e.receiveShadow!==void 0&&(this.receiveShadow=e.receiveShadow);let i,r=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 n=this.materialOverride!==void 0;!n&&e.geometry?.type!=="NonParametricGeometry"&&"material"in e&&e.material!==void 0&&(this.disposeMaterial(),this.material=t.shared.material(e.material).getFlavor(r.flatShading,r.side,r.wireframe,i),t.scene.markNeedsUpdateRendererDirty()),!n&&(e.geometry?.type==="NonParametricGeometry"||"materials"in e)&&("materials"in e&&e.materials!==void 0?(this.disposeMaterial(),this.material=e.materials.map(a=>t.shared.material(a).getFlavor(r.flatShading,r.side,r.wireframe)),t.scene.markNeedsUpdateRendererDirty()):"material"in e&&e.material!==void 0&&(this.disposeMaterial(),this.material=[t.shared.material(e.material).getFlavor(r.flatShading,r.side,r.wireframe)],t.scene.markNeedsUpdateRendererDirty()));let s=this.data;if(!n&&s.geometry?.type!=="NonParametricGeometry"&&"materials"in s&&s.materials!==void 0&&(this.disposeMaterial(),this.material=t.shared.material(s.materials[0]).getFlavor(r.flatShading,r.side,r.wireframe)),!n&&(e.flatShading!==void 0||e.wireframe!==void 0||e.side!==void 0))if(Array.isArray(this.material))for(let a=0;a<this.material.length;a++)this.material[a]=this.material[a].getFlavor(r.flatShading,r.side,r.wireframe);else this.material=this.material.getFlavor(r.flatShading,r.side,r.wireframe,i);this.syncShadowCatcher(t)}shadowCatcherActive(){let e=this.dataPatched,t=e.geometry?.type;return e.shadowCatcher===!0&&(t==="RectangleGeometry"||t==="PlaneGeometry")}syncShadowCatcher(e){let t=this.dataPatched;if(this.shadowCatcherActive()){if(this.shadowCatcherMaterial===void 0){let i=function(){let r=LA==="webgpu"&&XH!==void 0?XH:Mbe;return r===void 0?null:eie(r())}();if(i===null)return;this.shadowCatcherMaterial=i}this.shadowCatcherMaterial.side=t.side,this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.shadowCatcherMaterial,e.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,e.scene.markNeedsUpdateRendererDirty()):"material"in t&&t.material!==void 0&&(this.material=e.shared.material(t.material).getFlavor(t.flatShading,t.side,t.wireframe),e.scene.markNeedsUpdateRendererDirty(),this.needsAO&&this.layers.enable(5)),this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow)}static disposeOneMaterial(e){var t;Cbe(e)&&!function(i){return i?.isClassicSharedMaterial===!0}(t=e)&&t?.isTSLSharedMaterial!==!0&&e.nodeMaterialDispose()}disposeMaterial(){this.material&&u1e(this.material).forEach(e=>{bl.disposeOneMaterial(e)})}dispose(){this.disposeMaterial(),this.shadowCatcherMaterial?.dispose(),super.dispose()}}}),wl=V(()=>{Wt(),Nr(),$X(),h1(),le(),G4(),xw(),_be(),QF=new P,JF=new pt,e5=new pt,oie=new P,t5=new Ve,Fn=class extends bl{constructor(e,t,i){super(e,t),this.data=t,this.isSkinnedMesh=!1,this.localGeometry=void 0,t.bindMode&&t.bindMatrix&&(this.bindMode=t.bindMode,this.bindMatrix=new Ve().fromArray(t.bindMatrix),this.bindMatrixInverse=new Ve)}chooseGeoemtryCache(e){return e.geometryCache}supportsInPlaceGeometryUpdate(e){return e.isTextGeometry!==!0}markGeometryAsReachable(e){this.geometryCreateDeleyed instanceof At&&this.chooseGeoemtryCache(e).markAsReachable(this.dataPatched.geometry,this.geometryCreateDeleyed)}get builtSharedGeometry(){if(this.localGeometry===void 0)return this.geometryCreateDeleyed instanceof At?this.geometryCreateDeleyed:void 0}get geometry(){if(this.localGeometry!==void 0)return this.localGeometry;if(this.geometryCreateDeleyed instanceof wL){let e=this.geometryCreateDeleyed,t=this.chooseGeoemtryCache(e),i=this.dataPatched.geometry;this.geometryCreateDeleyed=t.get(i,e,this),this._geometryCacheKey=i}return this.geometryCreateDeleyed}set geometry(e){this.localGeometry=e}get is2DAndNoDepth(){let e=this.dataPatched.geometry;return iL.is2DParametricMesh(e.type)&&e.depth===0}get is2DType(){return iL.is2DParametricMesh(this.geometry.userData.type)}get isNonParametric(){return this.geometry.userData.type==="NonParametricGeometry"}updateByPatchedOp(e,t,i){super.updateByPatchedOp(e,t,i),Jr(e.path,["geometry"])&&this.updateByPatchedOpGeometry(Xa.drop(e,1),t.geometry,i)}removeInteractionGeometry(e){this.localGeometry?.dispose(),this.localGeometry=void 0}get appliedGeometrySize(){let e=this.localGeometry?.userData;if(e!==void 0&&e.sxPrev!==void 0)return[e.sxPrev,e.syPrev,e.szPrev]}updateGeometryInteractions(e,t){this.invalidateDownstreamBooleanData();let i=this.data.geometry.type;if(i==="NonParametricGeometry"||i==="SubdivGeometry"){let r,n,s,a=e;if(this.localGeometry===void 0){let d={...this.data.geometry,...a};this.localGeometry=Cg(d,t,this.data.flatShading,this)}a.scaleBaked?[r,n,s]=a.scaleBaked:{width:r,height:n,depth:s}=a;let o=this.localGeometry.userData,l=typeof r=="number"?r:1,u=typeof n=="number"?n:1,h=typeof s=="number"?s:1;o.sxPrev!==void 0&&kH(this.localGeometry.attributes,l/o.sxPrev,u/o.syPrev,h/o.szPrev),o.sxPrev=l,o.syPrev=u,o.szPrev=h}else{let r=Cg({...this.data.geometry,...e},t,this.data.flatShading,this);this.localGeometry!==void 0&&this.supportsInPlaceGeometryUpdate(this.localGeometry)&&jF(this.localGeometry,r)?r.dispose():(this.localGeometry?.dispose(),this.localGeometry=r)}}refreshAttachedClonersInteractions(e){for(let t of this.attachedSurfaceCloners)t.update(e)}refreshAttachedCloners(e){for(let t of this.attachedSurfaceCloners)e.scene.addPendingUpdateCloner(t.object)}refreshAttachedPaths(e){for(let t of this.attachedPaths)e.scene.addPendingCommand(()=>t.updateShape())}createGeometryDelayed(e){this.geometryCreateDeleyed=e.shared,this.refreshAttachedCloners(e),this.refreshAttachedPaths(e)}updateByPatchedOpGeometry(e,t,i){let r=!1;if(e.type===0&&e.path.length===0&&Object.keys(e.props).includes("scaleBaked")&&this.geometryCreateDeleyed instanceof ls&&this.chooseGeoemtryCache(i.shared).mutateIfUnique(this.geometryCreateDeleyed.data,t)===this.geometryCreateDeleyed&&(r=!0,this.geometryCreateDeleyed.mutateDirectlyScaleBaked(t,e.props.scaleBaked),this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)),!r&&e.type===0&&e.path.length===0&&bbe(e.props)&&this.geometryCreateDeleyed instanceof ls&&this.chooseGeoemtryCache(i.shared).mutateIfUnique(this.geometryCreateDeleyed.data,t)===this.geometryCreateDeleyed&&(r=!0,this.geometryCreateDeleyed.mutateDirectlySubdivisions(t),this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)),!r&&e.type===0&&e.path.length===0&&this.geometryCreateDeleyed instanceof At&&!(this.geometryCreateDeleyed instanceof ls)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let n=i.shared,s=this.chooseGeoemtryCache(n),a=this.geometryCreateDeleyed;if(s.getCached(this._geometryCacheKey)===a&&a.isShared!==!0){let o=this.dataPatched.geometry,l=Cg(o,n,this.data.flatShading,this);jF(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,r=!0,this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)}}r||(i.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(i)),this.syncShapeBlendNodeLayer(),this.resetBBoxNeedsUpdate(),this.invalidateDownstreamBooleanData()}updateGeometryOnStateUpdate(e,t){this.createGeometryDelayed(t)}applyTransientGeometryData(e,t){let i=e.shared,r=this.dataPatched.geometry;if(this.geometryCreateDeleyed instanceof At&&!(this.geometryCreateDeleyed instanceof ls)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let n=this.chooseGeoemtryCache(i),s=this.geometryCreateDeleyed;if(n.getCached(this._geometryCacheKey)===s&&s.isShared!==!0){let a=Cg(r,i,this.data.flatShading,this);return jF(s,a)?(a.dispose(),s.computeBoundingSphere(),n.mutateIfUnique(this._geometryCacheKey,r)):(a.computeBoundingSphere(),n.forceDelete(this._geometryCacheKey),n.adopt(r,a),this.geometryCreateDeleyed=a),this._geometryCacheKey=r,this.refreshAttachedCloners(e),void this.refreshAttachedPaths(e)}}t&&this._geometryCacheKey!==void 0&&this.chooseGeoemtryCache(i).forceDelete(this._geometryCacheKey),e.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(e)}updateState(e,t){e.geometry!==void 0&&this.updateGeometryOnStateUpdate(e.geometry,t);let i=e.morphTargetInfluences;if(i){this.updateMorphTargets(),this.geometry.morphTargetsRelative=!0;for(let{data:{name:r,value:n}}of i)this.updateMorphInfluences(r,t.shared.getVariable(n,[this.uuid,"morphTargetInfluences",r]))}super.updateState(e,t)}updateMorphInfluences(e,t){if(this.morphTargetDictionary===void 0)return;let i=this.morphTargetDictionary[e];i!==void 0&&(this.morphTargetInfluences[i]=t)}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(e,t){let i=this.geometry.userData.parameters;this.is2DType?e.set(0,0,.5*i.depth):this.isNonParametric?(e.setScalar(0),this.geometry.boundingSphere&&e.copy(this.geometry.boundingSphere.center),t.set(i.width,i.height,i.depth??0).multiplyScalar(.5)):i.centerOffset?e.fromArray(i.centerOffset):e.setScalar(0),t.set(i.width,i.height,i.depth??0).multiplyScalar(.5)}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"&&this.bindMatrixInverse.copy(this.bindMatrix).invert()}bind(e,t){this.skeleton=e,this.isSkinnedMesh=!0,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(e){let t=new pt,i=this.geometry.attributes.skinWeight;for(let r=0,n=i.count;r<n;r++){t.fromBufferAttribute(i,r);let s=1/t.manhattanLength();s!==1/0?t.multiplyScalar(s):t.set(1,0,0,0),i.setXYZW(r,t.x,t.y,t.z,t.w)}}boneTransform(e,t){let i=this.skeleton;if(i===void 0)return;let r=this.geometry;JF.fromBufferAttribute(r.attributes.skinIndex,e),e5.fromBufferAttribute(r.attributes.skinWeight,e),QF.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let n=0;n<4;n++){let s=e5.getComponent(n);if(s!==0){let a=JF.getComponent(n);t5.multiplyMatrices(i.bones[a].matrixWorld,i.boneInverses[a]),t.addScaledVector(oie.copy(QF).applyMatrix4(t5),s)}}return t.applyMatrix4(this.bindMatrixInverse)}}});function Cx(e){if(Array.isArray(e.material)){for(let t of e.material)if(t.getLayersOfType("outline").length===0)return}else if(!fL(e.material)||e.material.getLayersOfType("outline").length===0)return;e instanceof Fn&&e.is2DAndNoDepth?function(t){if(t.geometry.attributes.extrudeNormals||!t.geometry.attributes.position)return;let i=t.geometry.attributes.position.array,r=new Float32Array(i.length),n=new P;for(let s=0;s<i.length;s+=3)n.set(i[s],i[s+1],i[s+2]).normalize(),r[s]=n.x,r[s+1]=n.y,r[s+2]=n.z;t.geometry.setAttribute("extrudeNormal",new Et(r,3))}(e):function(t){if(t.geometry.attributes.extrudeNormal||!t.geometry.attributes.position||!t.geometry.attributes.normal)return;let i=new Map,r=t.geometry.attributes,n=r.position.array,s=r.normal.array,a=new Float32Array(n.length);for(let o=0;o<n.length;o+=3){let l=`${n[o]}_${n[o+1]}_${n[o+2]}`,u=new P(s[o],s[o+1],s[o+2]);i.has(l)?i.get(l)?.normals.push(u):i.set(l,{normals:[u],result:new P})}i.forEach((o,l)=>{for(let u of o.normals)o.result.add(u);o.result.divideScalar(o.normals.length)});for(let o=0;o<n.length;o+=3){let l=`${n[o]}_${n[o+1]}_${n[o+2]}`,u=i.get(l)?.result;u&&(a[o]=u.x,a[o+1]=u.y,a[o+2]=u.z)}t.geometry.setAttribute("extrudeNormal",new Et(a,3))}(e)}function i5(e){return Math.min(2047,Math.max(1,Math.round(2048*e)))/2048}function Rx(e){if(!e.geometry.attributes.position)return;let t=e.geometry.attributes,i=t.position.array,r=t.randomColor;if(r!==void 0&&3*r.count===i.length)return;let n=new Float32Array(i.length),s=parseInt(e.uuid.replace(/\D/g,"")),a=[i5(ht.seededRandom(s)),i5(ht.seededRandom(s+1e4)),i5(ht.seededRandom(s+2e4))];for(let o=0;o<i.length;o++)n[o]=a[o%3];e.geometry.setAttribute("randomColor",new It(n,3))}var H4=V(()=>{le(),DX(),wl()});function lie(e){let t=!1;return e.scene.objects.traverse((i,r)=>{r.geometry?.type==="BooleanGeometry"&&(t=!0)}),t}function NOe(e,t){let i=e.cloner;return i!==void 0&&i.parent===t?i:void 0}function hie(e,t,i,r){let n=16*(t.children.length+1);RM.length<n&&(RM=new Float32Array(n));let s=0,a=l=>{l.toArray(RM,16*s),s++},o=t.parameters.hideBase!==!0;o&&a(r),ZH.multiplyMatrices(e.hiddenMatrix,e.matrix);for(let l of t.children)!Zv(l)||l.playModeVisible===!1||(QH.multiplyMatrices(l.hiddenMatrix,l.matrix).multiply(l.pivotMatrix),vI.multiplyMatrices(ZH,QH),(!o||!vI.equals(r))&&a(vI));try{return s===0?0:function(l,u){return RX(pL().instanced_union(CX(l),u))}(i,RM.subarray(0,16*s))}finally{w_e(i)}}var lp,uie,ZH,QH,vI,RM,Lg,SL,W4,gd,Uc,TL,BA=V(()=>{Na(),le(),U4(),H4(),h1(),rs(),lp=new Ve,uie=new Ve,ZH=new Ve,QH=new Ve,vI=new Ve,RM=new Float32Array(0),Lg=class extends bl{constructor(e,t,i){super(e,t),this.data=t,this.meshSetAddresses=[],this.needsTransformForDownstream=!1,this.geometry=new At,this.onAfterRender=(r,n,s,a,o,l)=>{super.onAfterRender(r,n,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(e,t,i){super.updateByPatchedOp(e,t,i),e.path.length===1&&e.path[0]==="geometry"&&e.type===0&&e.props.operation!==void 0&&(this.freeBooleanPointer(),this.resetBBoxNeedsUpdate())}freeBooleanPointer(){super.freeBooleanPointer(),this.geometry.dispose()}recomputeBoolean(e,t=!0){if(this.booleanMeshSetAddress!==-1&&!e)return;for(let r=0;r<this.children.length;r++){let n=this.children[r];n instanceof Lg&&n.dataPatched.visible===!0&&n.recomputeBoolean(e===!0,t)}this.meshSetAddresses=[];for(let r=0;r<this.children.length;r++){let n=this.children[r];if(n instanceof Ss&&n.dataPatched.visible===!0&&n.geometry.attributes.position?.count>0&&n.geometry.drawRange.count>0&&n.booleanMeshSetAddress!==0){lp.multiplyMatrices(n.hiddenMatrix,n.matrix).multiply(n.pivotMatrix);try{let s=NOe(n,this);if(n.booleanMeshSetAddress===-1){if((n.geometry.index??n.geometry.getAttribute("position")).count/3<15e5){let a=eOe(n.geometry,e===!0);n.booleanMeshSetAddress=s===void 0||a===-1?a:hie(n,s,a,lp)}if(n.booleanMeshSetAddress===-1)return;s===void 0&&NF(n.booleanMeshSetAddress,lp),n.booleanMatrixInvOld.copy(lp).invert(),n.booleanWasTransformed=!1}else n instanceof Lg&&n.needsTransformForDownstream===!0?(s===void 0?NF(n.booleanMeshSetAddress,lp):n.booleanMeshSetAddress=hie(n,s,n.booleanMeshSetAddress,lp),n.needsTransformForDownstream=!1):n.booleanWasTransformed===!0&&(NF(n.booleanMeshSetAddress,uie.multiplyMatrices(lp,n.booleanMatrixInvOld)),n.booleanMatrixInvOld.copy(lp).invert(),n.booleanWasTransformed=!1)}catch(s){console.error(s),n.booleanMeshSetAddress=0,n.geometry.userData.booleanOperationDidFail=!0;continue}if(n.booleanMeshSetAddress===0)continue;this.meshSetAddresses.push(n.booleanMeshSetAddress),n.geometry.userData.booleanOperationDidFail=!1}}if(this.meshSetAddresses.length===0){if(this.geometry.getAttribute("position")?.array.length!==0){let r=this.geometry;r.dispose(),this.geometry=new At,this.geometry.userData=r.userData,this.geometry.boundingSphere=r.boundingSphere,this.geometry.setAttribute("position",new Et([],3))}return void this.geometry.setDrawRange(0,0)}if(e===!0)return function(r,n){let s=pL(),a=ote(r,n),o=s.mesh_topological_data(a),l=o.positions(),u=o.indices();return o.free(),a.free(),{positions:l,indices:u,verticesPerFace:new Uint8Array(u.length/3).fill(3)}}(this.meshSetAddresses,this.booleanOp);let i=this.geometry;i.dispose(),this.geometry=new At,this.geometry.userData=i.userData,this.geometry.boundingSphere=i.boundingSphere;try{this.booleanMeshSetAddress=function(r,n,s,a){let o=pL(),l=ote(r,n),u=o.mesh_render_data(l,Math.max(a,0));if(s.setAttribute("position",new Et(u.positions(),3)),s.setAttribute("normal",new Et(u.normals(),3)),u.free(),s.boundingSphere===null&&(s.boundingSphere=new qa),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 RX(l)}(this.meshSetAddresses,this.booleanOp,this.geometry,this.phongAngle)}catch(r){this.booleanMeshSetAddress=0,this.geometry.userData.booleanOperationDidFail=!0,console.error(r)}this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0,Cx(this),Rx(this)}dispose(){super.dispose(),this.geometry.dispose()}}}),UA=V(()=>{le(),xl(),l1(),(SL||(SL={})).is=function(e){return hr.is(e)&&e instanceof Gp},W4=(e,t)=>class extends o1(e,t){updateState_Light(i,r){if(this.updateState_Entity(i,r),i.color!==void 0&&(this.color=r.shared.color(i.color)),i.intensity!==void 0&&(this.intensity=i.intensity*Math.PI),i.depth!==void 0){let n=this.shadow;n.camera.far=i.depth,n.needsUpdate=!0}i.shadows!==void 0&&(this.castShadow=i.shadows)}}}),Qg=V(()=>{BA(),Na(),l1(),gd=e=>e instanceof Ss,Uc=e=>e!==null&&e instanceof Lg,TL=e=>wH.is(e)});function vo(e,t){return t.color(e)}function die(e=new Date,t){let i=t.format,r=e.getSeconds(),n=e;t&&t.timeZone!==null&&(n=function(d,c){try{let p=new Intl.DateTimeFormat("en-US",{timeZone:c,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}).formatToParts(d),f=m=>Number(p.find(g=>g.type===m)?.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,t.timeZone));let s,a=n.getHours(),o=n.getMinutes();t.format12h24h==="12ampm"&&(s=a>=12?"PM":"AM");let l,u,h=a;switch(t.format12h24h!=="24"&&(h=a%12,h===0&&(h=12)),i){case"HH:mm:ss":l=[h,o,r];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=[r],s=void 0;break;case"year":u=n.getFullYear();break;case"month":u=n.getMonth()+1;break;case"dayOfYear":u=Math.floor((n.getTime()-new Date(n.getFullYear(),0,0).getTime())/864e5);break;case"dayOfMonth":u=n.getDate();break;case"secondOfDay":u=60*a*60+60*o+r;break;default:console.error("Unknown time format",i),u=0}return l!==void 0?{textValue:l,suffix:s}:u}var JH,Tw,XX=V(()=>{}),IOe=V(()=>{le(),NA(),IA(),JH=class extends vw(Dye){constructor(e,t=15,i=10066329){super(e,t,i),this.object=e,this.added=!1,this.name=`DirectionalLightHelper: ${e.uuid}`}raycast(e,t){yw(this.object,JH.geometryHelper,e,t)}}}),q4=V(()=>{le(),IOe(),UA(),Tw=class extends W4(JE,JH){constructor(e,t,i){super(),this.super_Entity(e,t),this.castShadow=!0,this.shadow.mapSize.width=2048,this.shadow.mapSize.height=2048,this.shadow.normalBias=1,this.layers.enable(3);let r=this.shadow.camera;r.top=1250,r.bottom=-1250,r.right=1250,r.left=-1250,r.near=-1e4,r.far=2500;let n=new eA(this.shadow.camera);n.visible=!1,this.gizmos.shadowmap=n}update(){this.shadow.camera.updateProjectionMatrix();for(let e in this.gizmos){let t=this.gizmos[e];t instanceof eA&&t.update()}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.objectHelper&&this.objectHelper.update()}updateState(e,t){this.updateState_Light(e,t);let i=e.depth!==void 0&&e.depth!==this.shadow.camera.far||e.size!==void 0&&e.size/2!==this.shadow.camera.right;e.size!==void 0&&function(r,n){r.shadow.camera.right=n/2,r.shadow.camera.left=-n/2,r.shadow.camera.top=n/2,r.shadow.camera.bottom=-n/2,r.shadow.needsUpdate=!0}(this,e.size),e.shadowRadius!==void 0&&(this.shadow.radius=e.shadowRadius),e.shadowResolution!==void 0&&(this.shadow.mapSize.set(e.shadowResolution,e.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),e.penumbraSize!==void 0&&t.scene.markPenumbraSizeDirty(),i&&this.update()}}});function YX(e){return e instanceof bl&&e.needsAO&&!Gf(e)&&e.isDecalObject!==!0}function KX(e){let t=e.cloner;if(t&&Array.isArray(t.children))for(let i of t.children)i?.layers&&(i.layers.mask=e.layers.mask)}function ZX(e){return e.getLayersOfType("reflection").filter(t=>t.data.visible).length}function OOe(e){let t=1/0,i=-1/0;for(let r of e.getLayersOfType("reflection")){let n=r.data;if(!n.visible||n.mirror===1)continue;let s=typeof n.blur=="number"?n.blur:null;t=Math.min(t,s??0),i=Math.max(i,s??10)}return t===1/0?null:{min:t,max:i}}function LOe(e){for(let t of e.getLayersOfType("reflection")){let i=t.data;if(!i.visible)continue;let{blur:r,thickness:n,steps:s,stepSize:a}=i;return typeof r!="number"||typeof n!="number"||typeof s!="number"||typeof a!="number"?"variable":{blur:r,thickness:n,steps:s,stepSize:a,tracingMode:i.tracingMode===1?1:0}}return null}function cie(e,t){let i={outline:!1,cavity:!1},r=e.layers.mask&$4,n=t.getLayersOfType("transmission"),s=t.getLayersOfType("outline"),a=ZX(t),o=t.getLayersOfType("cavity");return(s.length>0||o.length>0)&&(e.layers.set(8),n.length>0&&e.layers.enable(3),a>0&&e.layers.enable(4),i.outline=s.length>0,i.cavity=o.length>0,Rx(e),Cx(e)),n.length===0&&s.length===0&&o.length===0&&a===0&&e.layers.set(0),r&&e.layers.set(9),!r&&YX(e)&&e.layers.enable(5),KX(e),i}function pie(e,t){if(!t.layers)return!1;let i=e.layers.mask&$4,r=!1,n=t.getLayersOfType("transmission").filter(l=>l.data.visible),s=t.getLayersOfType("outline").filter(l=>l.data.visible),a=ZX(t),o=t.getLayersOfType("cavity").filter(l=>l.data.visible);return n.length>0&&(e.layers.set(3),(s.length>0||o.length>0)&&e.layers.enable(8),a>0&&e.layers.enable(4),r=!0),n.length===0&&s.length===0&&o.length===0&&a===0&&e.layers.set(0),i&&e.layers.set(9),!i&&YX(e)&&e.layers.enable(5),KX(e),r}function fie(e,t){var i;if(!t.layers)return!1;let r=e.layers.mask&$4,n=!1,s=ZX(t),a=t.getLayersOfType("transmission").filter(u=>u.data.visible),o=t.getLayersOfType("outline").filter(u=>u.data.visible),l=t.getLayersOfType("cavity").filter(u=>u.data.visible);return s>0&&((i=e.userData).__splinePlanarMirror??(i.__splinePlanarMirror=0),e.layers.set(4),a.length>0&&e.layers.enable(3),(o.length>0||l.length>0)&&e.layers.enable(8),n=!0),s===0&&a.length===0&&o.length===0&&l.length===0&&e.layers.set(0),r&&e.layers.set(9),!r&&YX(e)&&e.layers.enable(5),KX(e),n}function eW(e,t,i,r=!1){let n=e.cloner;if(n){let s=null;if(e.raycast===Cr.prototype.raycast||e.raycast===Ss.prototype.raycast){let a=e.geometry;a&&(a.boundingSphere===null&&a.computeBoundingSphere(),s=a.boundingSphere)}for(let a of n.children){if(s!==null&&(tW.copy(s).applyMatrix4(a.matrixWorld),!t.ray.intersectsSphere(tW)))continue;let o=Dbe.copy(a.matrixWorld).invert(),l=Nbe.copy(t.ray).applyMatrix4(o),u=e.matrixWorld;l.applyMatrix4(u);let h=Pbe;h.set(l.origin,l.direction),h.near=t.near,h.far=t.far,h.layers.mask=t.layers.mask;let d=h.intersectObject(e,!1);d.length>0&&i.push({...d[0],object:r?a:e})}}}var $4,Pbe,Dbe,Nbe,tW,y3,Ibe,r5,n5,s5,Mw,Ks,QX=V(()=>{rs(),H4(),Na(),h1(),le(),$4=512,Pbe=new Y$,Dbe=new Ve,Nbe=new mf,tW=new qa}),BOe=V(()=>{le(),NA(),IA(),y3=class extends vw(Rye){constructor(e,t=6710886){super(e,t),this.object=e,this.matrix=e.matrixWorld,this.name=`SpotLightHelper: ${e.uuid}`}raycast(e,t){yw(this.object,y3.geometryHelper,e,t)}update(){if(this.object!==void 0){let e=y3._vector,t=this.object.distance?this.object.distance:1e3,i=t*Math.tan(this.object.angle);this.cone.scale.set(i,i,t),e.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(e);let r=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let n=0,s=this.cone.material.length;n<s;n++)this.cone.material[n].color.set(r);else this.cone.material.color.set(r)}}},(Ibe=y3)._vector=new P}),X4=V(()=>{le(),BOe(),UA(),r5=new P,n5=new P,s5=new jt,Mw=class extends W4(uy,Ibe){constructor(e,t,i){super(),this.super_Entity(e,t),this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let r=this.shadow.camera;r.fov=2*ht.RAD2DEG*this.angle,r.aspect=1,r.near=100,r.far=2500;let n=new eA(this.shadow.camera);n.visible=!1,this.gizmos.shadowmap=n,this.update()}update(){this.shadow.camera.updateProjectionMatrix();for(let e in this.gizmos){let t=this.gizmos[e];t instanceof eA&&t.update()}}updateMatrixWorld(e){super.updateMatrixWorld(e),n5.setFromMatrixPosition(this.matrixWorld),s5.setFromRotationMatrix(this.matrixWorld),r5.copy(this.up).applyQuaternion(s5).negate().multiplyScalar(this.distance),this.target.position.copy(n5).add(r5),this.target.updateMatrixWorld(),this.objectHelper&&this.objectHelper.update()}updateState(e,t){this.updateState_Light(e,t),e.distance!==void 0&&(this.distance=e.distance),e.decay!==void 0&&(this.decay=e.decay),e.angle!==void 0&&(this.angle=e.angle),e.penumbra!==void 0&&(this.penumbra=e.penumbra),e.shadowRadius!==void 0&&(this.shadow.radius=e.shadowRadius),e.penumbraSize!==void 0&&t.scene.markPenumbraSizeDirty(),e.shadowResolution!==void 0&&(this.shadow.mapSize.set(e.shadowResolution,e.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null))}}}),Xf=V(()=>{Wt(),Nh(),le(),xl(),bu(),XX(),qf(),q4(),Nr(),$f(),le(),h1(),Qg(),QX(),X4(),_r(),BA(),Ks=class extends L4(Zo){constructor(e,t,i){if(super(),this.data=t,this.bgColor=new Fr(1,1,1,1),this.fog=null,this.backupFog=new Jj(16777215,.1,2e3),this.fogUseBGColor=!1,this.fogMode="linear",this.fogDensity=Xn.getDensity({}),this.fogHeightFalloff=Xn.getHeightFalloff({}),this.fogHeightBase=Xn.getHeightBase({}),this.isActive=!1,this.skyState=null,this.skyStateVersion=0,this.gradingState=null,this.skyHdriHolder=null,this.aoColor=new ot,this.penumbraSizeArrayCache=null,this.super_Entity(e,t),this.personalCamera=new us(a1,{...gE.defaultData,...t.camera,name:"Personal Camera"}),this.personalCamera.objectHelper.visible=!1,this.add(this.personalCamera),this.activeCamera=this.personalCamera,this.ambientLight=new _4(13882323,8553090,.75*Math.PI),this.ambientLight.name="Default Ambient Light",this.ambientLight.layers.enable(3),this.ambientLight.removeFromParent(),this.add(this.ambientLight),t.uiScene){let r=gH();r===null?Ma("ui-2d","a page's 2D scene"):this.uiScene=new r.Scene2D((Array.isArray(e)?e[0]:e)+"-ui",t.uiScene,{dpr:window.devicePixelRatio,shared:i.shared})}else t.uiFrame&&this.createUICanvas(t.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(e,t){let i=gH();i!==null?(this.uiCanvas=new i.UICanvas(this.uuid+"-uiscreen",window.innerWidth,window.innerHeight,t),this.uiCanvas.isScreenSpace=!0,this.uiCanvas.promise.then(()=>{this.uiCanvas?.applyFrame(e),this.uiCanvas?.applySize()})):Ma("ui-2d","a page's UI canvas")}updateVisible(){}setBackgroundColor(e){this.bgColor=e,this.fogUseBGColor===!0&&(this.backupFog.color=e)}entityChildrenCount(){return this.uiScene?this.uiScene.children.length:super.entityChildrenCount()}updateAmbientLight(e,t){e.color!==void 0&&(this.ambientLight.color=vo(e.color,t)),e.intensity!==void 0&&(this.ambientLight.intensity=e.intensity*Math.PI),e.enabled!==void 0&&(e.enabled?this.add(this.ambientLight):this.remove(this.ambientLight))}onDeactive(){this.isActive=!1}onActive(e){this.isActive=!0,e.fog=this.fog,this.traverseEntity(t=>{t instanceof Lg&&t.recomputeBoolean()}),this.updateShadow(this.data.shadow)}forceMaterialsUpdate(){this.traverseEntity(e=>{if(e instanceof bl)if(Array.isArray(e.material))for(let t of e.material)t.needsUpdate=!0;else e.material.needsUpdate=!0,e.material.dispose()})}updateShadow(e){if(e.softShadowQuality===void 0&&e.type===void 0||!this.isActive)return;let t=this.data.shadow;var i,r;i=dy.isSoft(t),r=t?.softShadowQuality,YH!==void 0&&YH(i,r)&&this.forceMaterialsUpdate()}updateFog(e,t){e.enabled?this.fog=this.backupFog:this.fog=null,this.isActive&&(this.scene.fog=this.fog),this.fogUseBGColor=e.useBackgroundColor,e.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=vo(e.color,t),this.backupFog.near=e.near,this.backupFog.far=e.far,this.fogMode=Xn.getMode(e),this.fogDensity=Xn.getDensity(e),this.fogHeightFalloff=Xn.getHeightFalloff(e),this.fogHeightBase=Xn.getHeightBase(e)}updateSky(e,t){this.skyState=e??null,this.skyStateVersion++;let i=e?.hdri?.image;this.skyHdriHolder=i!=null?t.image(i):null}updateAo(e,t){e.aoColor!==void 0&&(this.aoColor=vo(e.aoColor,t))}updateByOp(e,t,i,r){let n=this.data.uiFrame;super.updateByOp(e,t,i,r);let s=t;Jr(e.path,["fog"])?this.updateFog(s.fog,i.shared):Jr(e.path,["sky"])?this.updateSky(s.sky,i.shared):Jr(e.path,["grading"])?this.gradingState=s.grading??null:Jr(e.path,["ao"])?this.updateAo(s.ao,i.shared):Jr(e.path,["ambient"])?this.updateAmbientLight(s.ambient,i.shared):Jr(e.path,["shadow"])?this.updateShadow(s.shadow):e.type===0&&e.path.length===0&&(e.props.uiFrame!==void 0||n!==s.uiFrame)&&this.updateUIFrame(e.props.uiFrame,i)}updateUIFrame(e,t){e?(this.uiCanvas||this.createUICanvas(e,t),this.uiCanvas.enabled=!0,this.uiCanvas.applyFrame(e)):this.uiCanvas&&(this.uiCanvas.enabled=!1)}updateState(e,t){this.updateState_Entity(e,t),e.backgroundColor!==void 0&&this.setBackgroundColor(vo(e.backgroundColor,t.shared)),e.fog!==void 0&&this.updateFog(e.fog,t.shared),e.sky!==void 0&&this.updateSky(e.sky,t.shared),e.grading!==void 0&&(this.gradingState=e.grading),e.ambient!==void 0&&this.updateAmbientLight(e.ambient,t.shared),e.ao!==void 0&&this.updateAo(e.ao,t.shared),e.shadow!==void 0&&this.updateShadow(e.shadow)}createFrame(e,t){}raycast(e,t){super.raycast(e,t)}switchActiveCamera(e){e&&e.isDescendantOf(this)&&(this.activeCamera!==this.personalCamera&&(this.activeCamera.objectHelper.visible=!0),this.activeCamera=e,e.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(Vf).fill(.5);let e=0,t=0;this.traverseEntity(i=>{if(!i.visible)return!0;i instanceof Tw&&i.visible&&e<yE&&(this.penumbraSizeArrayCache[e]=i.data.penumbraSize??.5,e+=1),i instanceof Mw&&i.visible&&e<Vf-yE&&(this.penumbraSizeArrayCache[yE+t]=i.data.penumbraSize??.5,t+=1)})}raycastWithClones(e){let t=[],i=r=>{for(let n of r.children){let s=n.cloner;hr.is(n)&&(n.visible||s?.object.data.visible)&&((gd(n)||TL(n)&&this.scene.enableHelpers&&n.objectHelper.visible)&&(e.intersectObject(n,!1,t),eW(n,e,t,!0)),i(n))}};return i(this),t}updateEntity2DByOp(e,t,i,r){this.uiCanvas?.updateEntity2DByOp(e,t,i,r)}}});function mie(){return JX}function a5(){if(ML===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 ML}function o5(e){return e?.isWebGPUSplineRenderer===!0}var JX,ML,eY=V(()=>{JX=null,ML=null});function iW(){return iY}var tY,iY,rY=V(()=>{tY=null,iY=null});function gie(e,t,i){return PM.setRGB(e,t,i,Yi),{r:PM.r,g:PM.g,b:PM.b}}function UOe(e,t,i){let r,n=vA(e.angle,0),[s,a]=rW(e.offset),[o,l]=rW(e.morph),u=e.colors??[],h=e.steps??[],d=Math.min(10,u.length,h.length);if(d===0)return[1,1,1,1];if(e.gradientType===1){let g=3*(t+o)-(t+s)-1,v=3*(i+l)-(i+a)-1;r=Math.hypot(g,v)+n}else if(e.gradientType===2){let g=-1*Math.atan2(t+o-.5+s,i+l-.5+a),v=n/Math.PI/-2+.5*g/Math.PI;r=v-Math.floor(v)}else{let g=.5+o/(t!==0?t:1e-6),v=l/(i!==0?i:1e-6),y=Math.cos(n)*g-Math.sin(n)*v,_=Math.sin(n)*g+Math.cos(n)*v,b=y*y+_*_;r=b>1e-12?(((t-.5+s)/2+y/2)*y+((i-.5+a)/2+_/2)*_)/b:0}let c=u[0][0],p=u[0][1],f=u[0][2],m=u[0][3];for(let g=1;g<d;g++){let v=h[g-1],y=h[g]-v,_=y!==0?Math.min(1,Math.max(0,(r-v)/y)):r>=v?1:0;e.smooth&&(_=_*_*(3-2*_)),c+=(u[g][0]-c)*_,p+=(u[g][1]-p)*_,f+=(u[g][2]-f)*_,m+=(u[g][3]-m)*_}return[c,p,f,m]}function FOe(e,t){let i=e,r=i?.data?.layers;if(r&&typeof r.forEach=="function"){let n=t,s=[];return r.forEach(a=>{let o=a.data;if(o.visible===!1||o.isMask===!0)return;let l=vA(o.alpha,1);if(!(l<=0))if(o.type==="color"){let u,h=o.color;typeof h=="string"?u=typeof n?.color=="function"?n.color(h):void 0:h&&typeof h.r=="number"&&(u=h),u&&s.push({kind:"color",layer:o,rgb:{...gie(u.r,u.g,u.b),a:u.a??1},alpha:l})}else o.type==="gradient"&&s.push({kind:"gradient",layer:o,alpha:l})}),s.length===0?null:(a,o)=>{let l=1,u=1,h=1,d=!0;for(let c of s){let p,f,m,g;if(c.kind==="color")({r:p,g:f,b:m}=c.rgb),g=c.rgb.a;else{let[y,_,b,x]=UOe(c.layer,a,o);({r:p,g:f,b:m}=gie(y,_,b)),g=x}let v=d?1:Math.min(1,Math.max(0,g*c.alpha));l+=(p-l)*v,u+=(f-u)*v,h+=(m-h)*v,d=!1}return{r:l,g:u,b:h}}}if(i?.color&&i.color.isColor===!0){let{r:n,g:s,b:a}=i.color;return()=>({r:n,g:s,b:a})}return null}var PM,vA,rW,zOe=V(()=>{le(),PM=new ot,vA=(e,t)=>typeof e=="number"&&Number.isFinite(e)?e:t,rW=e=>Array.isArray(e)&&typeof e[0]=="number"&&typeof e[1]=="number"?[e[0],e[1]]:[0,0]});function kOe(e,t){if(e==="torus"){let l=t()*Math.PI*2,u=t()*Math.PI*2,h=Math.cos(l),d=Math.sin(l),c=Math.cos(u),p=Math.sin(u);return{x:(1.4+.7*c)*h,y:-(1.4+.7*c)*d,z:.7*p,nx:c*h,ny:-c*d,nz:p,cr:1,cg:1,cb:1}}if(e==="cylinder"){let l=t()*Math.PI*2,u=Math.cos(l),h=Math.sin(l);return{x:.8*u,y:1.6*(t()-.5),z:.8*h,nx:u,ny:0,nz:h,cr:1,cg:1,cb:1}}let i=t()*Math.PI*2,r=2*t()-1,n=Math.acos(r),s=Math.sin(n)*Math.cos(i),a=Math.cos(n),o=Math.sin(n)*Math.sin(i);return{x:s,y:a,z:o,nx:s,ny:a,nz:o,cr:1,cg:1,cb:1}}function VOe(e){let{geometry:t,matrix:i}=e,r=t.getAttribute("position");if(!r||r.count<3)return null;let n=t.getAttribute("normal"),s=t.getAttribute("uv"),a=t.getAttribute("color"),o=t.getIndex(),l=o?o.count/3:r.count/3;if(l<1)return null;let u=(v,y)=>o?o.getX(3*v+y):3*v+y,h=i?i.elements:null,d=i?new hi().getNormalMatrix(i).elements:null,c=v=>{let y=r.getX(v),_=r.getY(v),b=r.getZ(v);return h?h[0]*y+h[4]*_+h[8]*b+h[12]:y},p=v=>{let y=r.getX(v),_=r.getY(v),b=r.getZ(v);return h?h[1]*y+h[5]*_+h[9]*b+h[13]:_},f=v=>{let y=r.getX(v),_=r.getY(v),b=r.getZ(v);return h?h[2]*y+h[6]*_+h[10]*b+h[14]:b},m=new Float64Array(l),g=0;for(let v=0;v<l;v++){let y=u(v,0),_=u(v,1),b=u(v,2),x=c(y),w=p(y),S=f(y),M=c(_)-x,T=p(_)-w,E=f(_)-S,A=c(b)-x,R=p(b)-w,N=f(b)-S,D=T*N-E*R,O=E*A-M*N,z=M*R-T*A;g+=.5*Math.sqrt(D*D+O*O+z*z),m[v]=g}return g<=0?null:{total:g,sample:(v,y)=>{let _=0,b=l-1;for(;_<b;){let se=_+b>>1;m[se]<v?_=se+1:b=se}let x=_,w=u(x,0),S=u(x,1),M=u(x,2),T=y(),E=y();T+E>1&&(T=1-T,E=1-E);let A,R,N,D=1-T-E,O=c(w)*D+c(S)*T+c(M)*E,z=p(w)*D+p(S)*T+p(M)*E,U=f(w)*D+f(S)*T+f(M)*E;if(n){if(A=n.getX(w)*D+n.getX(S)*T+n.getX(M)*E,R=n.getY(w)*D+n.getY(S)*T+n.getY(M)*E,N=n.getZ(w)*D+n.getZ(S)*T+n.getZ(M)*E,d){let se=d[0]*A+d[3]*R+d[6]*N,ve=d[1]*A+d[4]*R+d[7]*N,oe=d[2]*A+d[5]*R+d[8]*N;A=se,R=ve,N=oe}}else{let se=c(w),ve=p(w),oe=f(w),fe=c(S)-se,_e=p(S)-ve,Z=f(S)-oe,pe=c(M)-se,H=p(M)-ve,F=f(M)-oe;A=_e*F-Z*H,R=Z*pe-fe*F,N=fe*H-_e*pe}let G=Math.sqrt(A*A+R*R+N*N)||1,j=1,K=1,q=1;if(a)j=a.getX(w)*D+a.getX(S)*T+a.getX(M)*E,K=a.getY(w)*D+a.getY(S)*T+a.getY(M)*E,q=a.getZ(w)*D+a.getZ(S)*T+a.getZ(M)*E;else if(e.sampleColor){let se=s?s.getX(w)*D+s.getX(S)*T+s.getX(M)*E:.5,ve=s?s.getY(w)*D+s.getY(S)*T+s.getY(M)*E:.5,oe=e.sampleColor(se,ve);oe&&(j=oe.r,K=oe.g,q=oe.b)}return{x:O,y:z,z:U,nx:A/G,ny:R/G,nz:N/G,cr:j,cg:K,cb:q}}}}function vie(e){let t=Math.min(Math.max(1,Math.floor(e.guideStrands)),Px),i=function(l){let u=l>>>0;return()=>{u|=0,u=u+1831565813|0;let h=Math.imul(u^u>>>15,1|u);return h=h+Math.imul(h^h>>>7,61|h)^h,((h^h>>>14)>>>0)/4294967296}}(e.seed??1337),r=e.shape==="object"&&e.sampler,n=r?e.samplerRadius??ad:ad,s=new Float32Array(4*Qp),a=new Float32Array(Qp),o=new Float32Array(4*Px).fill(1);for(let l=0;l<t;l++){let u=r?e.sampler(i):kOe(e.shape,i),h=r?u.x:u.x*n,d=r?u.y:u.y*n,c=r?u.z:u.z*n,{nx:p,ny:f,nz:m}=u;o[4*l+0]=u.cr,o[4*l+1]=u.cg,o[4*l+2]=u.cb;let g,v,y,_=l*zv,b=(1.8+.8*i())*e.hairLength*n/(zv-1),x=.5+1.5*i(),w=(.02+.06*i())*n;Math.abs(f)<.99?(g=-m,v=0,y=p):(g=1,v=0,y=0);let S=Math.sqrt(g*g+v*v+y*y)||1;for(let M=0;M<zv;M++){let T=M/(zv-1),E=T*T*.4*n,A=w*Math.sin(T*x*Math.PI*2),R=4*(_+M);s[R+0]=h+p*b*M+A*g/S,s[R+1]=d+f*b*M-E+A*v/S,s[R+2]=c+m*b*M+A*y/S,s[R+3]=M===0?0:1,M<zv-1&&(a[_+M]=b)}}return{initialPositions:s,restLengths:a,unitScale:n,rootColors:o}}var zv,Px,Qp,ad,ug,FS,W1,P0,q1,yI,Obe=V(()=>{le(),Qp=(Px=16384)*(zv=32),ad=100}),Lbe=V(()=>{le(),Na(),rY(),zOe(),Obe(),ug=1/60,FS=new Ve,W1=new jt,P0=new P,q1=new P,yI=class extends Ss{constructor(e,t,i){super(e,t),this.type="HairSystem",this.isHairSystem=!0,this.simRunning=!1,this.previewRequested=!1,this.playModeActive=!1,this.pendingSimSeconds=0,this.simTime=0,this.resetRequested=!0,this.generation=0,this.settledSimSeconds=0,this.lastMotionFingerprint=0,this.lastBoneQuat=new jt,this.lastBonePos=new P,this.hasLastBone=!1,this.baseFoundAtRegen=!1,this.baseSourceGeomsAtRegen=[],this.baseSourceHashesAtRegen=[],this.baseColorHashAtRegen=0,this.baseScaleAtRegen=0,this.classicFallbackWarned=!1,this.regenSnapshot=null,this.context=i,this.data=t,this.geometry.setAttribute("position",new It(new Float32Array(0),3)),this.material=new Zl({colorWrite:!1,depthWrite:!1}),this.frustumCulled=!1,this.scalpMesh=new Cr(new Ff(ad,48,32),new Zl({color:5448477})),this.scalpMesh.name="HairScalp",this.add(this.scalpMesh);let r=new FO;r.setAttribute("position",new It(new Float32Array(12),3)),r.setIndex([0,2,1,2,3,1]),r.instanceCount=0,this.ribbonMesh=new Cr(r,new Zl({visible:!1})),this.ribbonMesh.name="HairRibbons",this.ribbonMesh.frustumCulled=!1,this.ribbonMesh.visible=!1,this.ribbonMesh.matrixAutoUpdate=!1,this.ribbonMesh.updateMatrixWorld=()=>{this.ribbonMesh.matrixWorld.identity()},this.ribbonMesh.updateWorldMatrix=()=>{this.ribbonMesh.matrixWorld.identity()},this.add(this.ribbonMesh),this.activeGuideStrands=t.guideStrands,this.roots=this.buildRoots(),this.regenSnapshot={guideStrands:t.guideStrands,hairLength:t.hairLength,spreadRadius:t.spreadRadius,headShape:t.headShape,baseObjectId:t.baseObjectId},this.applyScalpState(),this.applyShadowState(),this.syncSimRunning()}update(e){!this.simRunning||(this.pendingSimSeconds=Math.min(this.pendingSimSeconds+e/1e3,4*ug*2),this.trackMotionRest(e/1e3))}trackMotionRest(e){this.boneTransform(W1,P0);let t=this.hasLastBone&&(Math.abs(this.lastBoneQuat.dot(W1))<.9999995||this.lastBonePos.distanceToSquared(P0)>1e-8),i=this.motionFingerprint(),r=!this.hasLastBone||t||this.resetRequested||i!==this.lastMotionFingerprint||this.data.windStrength>.001;this.lastBoneQuat.copy(W1),this.lastBonePos.copy(P0),this.lastMotionFingerprint=i,this.hasLastBone=!0,this.settledSimSeconds=r?0:this.settledSimSeconds+e}motionFingerprint(){let e=this.data;return e.gravity+2*e.damping+3*e.localStiffness+4*e.globalStiffness+5*e.globalRange+6*e.stiffnessFalloff+7*e.windStrength+8*e.vspCoefficient+9*e.kink+10*e.kinkFrequency+11*e.clumpStrength+12*e.clumpSize+13*e.clumpTipScale}get isSimulating(){return(this.simRunning||this.resetRequested)&&this.visible}get isMotionSettled(){return this.settledSimSeconds>6}get isVisiblyAnimating(){return this.isSimulating&&!this.isMotionSettled}startPreview(){this.previewRequested=!0,this.syncSimRunning()}stopPreview(){this.previewRequested=!1,this.syncSimRunning()}setPlayMode(e){this.playModeActive=e,e&&this.resetSimulation(),this.syncSimRunning()}resetSimulation(){this.resetRequested=!0,this.pendingSimSeconds=0,this.simTime=0,this.settledSimSeconds=0}warnClassicFallbackOnce(){this.classicFallbackWarned||(this.classicFallbackWarned=!0,console.warn("[spline] Hair System strands require the WebGPU renderer \u2014 the WebGL fallback shows only the scalp. Reload with ?renderer=webgpu in a WebGPU-capable browser."))}syncSimRunning(){this.simRunning=this.playModeActive||this.previewRequested||this.data.autoPlay}updateState(e,t){super.updateState(e,t),this.updateHairState(e)}updateHairState(e){if((e.guideStrands!==void 0||e.hairLength!==void 0||e.spreadRadius!==void 0||e.headShape!==void 0||e.baseObjectId!==void 0)&&this.regenerate(),(e.headShape!==void 0||e.baseObjectId!==void 0)&&this.applyScalpState(),e.headColor!==void 0){let t=this.scalpMesh.material;t.isMeshBasicMaterial===!0&&t.color.setRGB(e.headColor.r,e.headColor.g,e.headColor.b,Yi)}(e.castShadow!==void 0||e.receiveShadow!==void 0)&&this.applyShadowState(),e.autoPlay!==void 0&&this.syncSimRunning()}applyShadowState(){let e=this.data.castShadow??!0,t=this.data.receiveShadow??!0;this.castShadow=e,this.receiveShadow=t,this.scalpMesh.castShadow=e,this.scalpMesh.receiveShadow=t,this.ribbonMesh.castShadow=e,this.ribbonMesh.receiveShadow=t}regenerate(){this.activeGuideStrands=Math.max(1,Math.min(Math.floor(this.data.guideStrands),16384)),this.roots=this.buildRoots(),this.generation++,this.regenSnapshot={guideStrands:this.data.guideStrands,hairLength:this.data.hairLength,spreadRadius:this.data.spreadRadius,headShape:this.data.headShape,baseObjectId:this.data.baseObjectId},this.resetSimulation()}checkDataDrift(){let e=this.data,t=this.regenSnapshot;if(t===null||t.guideStrands!==e.guideStrands||t.hairLength!==e.hairLength||t.spreadRadius!==e.spreadRadius||t.headShape!==e.headShape||t.baseObjectId!==e.baseObjectId){let i=t===null||t.headShape!==e.headShape||t.baseObjectId!==e.baseObjectId;this.regenerate(),i&&this.applyScalpState()}this.syncSimRunning(),this.applyShadowState(),this.checkBaseDrift()}buildRoots(){let{headShape:e,baseObjectId:t,guideStrands:i,hairLength:r}=this.data;if(this.baseFoundAtRegen=!1,this.baseSourceGeomsAtRegen=[],this.baseSourceHashesAtRegen=[],this.baseColorHashAtRegen=0,this.baseScaleAtRegen=0,e==="object"&&t){let n=this.context.scene.find(t);if(n){this.baseFoundAtRegen=!0,n.updateWorldMatrix(!0,!0);let s=this.collectBaseSources(n),a=s?function(o){let l=[];for(let d of o){let c=VOe(d);c&&l.push(c)}if(l.length===0)return null;let u=new Float64Array(l.length),h=0;for(let d=0;d<l.length;d++)h+=l[d].total,u[d]=h;return h<=0?null:d=>{let c=d()*h,p=0,f=l.length-1;for(;p<f;){let g=p+f>>1;u[g]<c?p=g+1:f=g}let m=p===0?c:c-u[p-1];return l[p].sample(m,d)}}(s.sources):null;if(this.baseSourceGeomsAtRegen=s?.sources.map(o=>o.geometry)??[],this.baseSourceHashesAtRegen=s?.hashes??[],this.baseColorHashAtRegen=s?.colorHash??0,s&&a){let o=this.baseWorldScale(n),l=Math.max(s.radius*o,.001);this.baseScaleAtRegen=o;let u=o;return vie({shape:"object",guideStrands:i,hairLength:r,sampler:h=>{let d=a(h);return{...d,x:d.x*u,y:d.y*u,z:d.z*u}},samplerRadius:l})}}}return vie({shape:e==="object"?"sphere":e,guideStrands:i,hairLength:r})}collectBaseSources(e){let t=[],i=[],r=0,n=0;FS.copy(e.matrixWorld).invert();let s=FS.clone(),a=o=>{if(o.isHairSystem===!0||o!==e&&o.visible===!1)return;let l=o.geometry;if(o.isMesh===!0&&l&&(l.getAttribute("position")?.count??0)>=3){let u=o===e?void 0:new Ve().multiplyMatrices(s,o.matrixWorld),h=Array.isArray(o.material)?o.material[0]:o.material;t.push({geometry:l,matrix:u,sampleColor:FOe(h,this.context.shared)??void 0}),i.push(yI.matrixHash(u)),n+=function(c,p){let f=c,m=0,g=1,v=_=>{m+=_*g,g+=1},y=f?.data?.layers;if(y&&typeof y.forEach=="function"){let _=p;y.forEach(b=>{let x=b.data;if(x.visible!==!1){if(x.type==="color"){let w=x.color,S=typeof w=="string"?typeof _?.color=="function"?_.color(w):void 0:w;S&&typeof S.r=="number"&&(v(S.r),v(S.g),v(S.b)),v(vA(x.alpha,1))}else if(x.type==="gradient"){let w=x;for(let S of w.colors??[])v(S[0]),v(S[1]),v(S[2]),v(S[3]);for(let S of w.steps??[])v(S);v(vA(w.angle,0)),v(w.gradientType),v(w.smooth?1:0)}}})}else f?.color&&f.color.isColor===!0&&(v(f.color.r),v(f.color.g),v(f.color.b));return m}(h,this.context.shared),l.boundingSphere===null&&l.computeBoundingSphere();let d=l.boundingSphere;if(d){let c=0,p=1;u?(P0.copy(d.center).applyMatrix4(u),c=P0.length(),p=yI.matrixMaxScale(u)):c=d.center.length(),r=Math.max(r,c+d.radius*p)}}for(let u of o.children)a(u)};return a(e),t.length===0?null:{sources:t,hashes:i,radius:Math.max(r,.001),colorHash:n}}static matrixHash(e){if(!e)return 0;let t=e.elements,i=0;for(let r=0;r<16;r++)i+=t[r]*(r+1);return i}static matrixMaxScale(e){let t=e.elements,i=Math.hypot(t[0],t[1],t[2]),r=Math.hypot(t[4],t[5],t[6]),n=Math.hypot(t[8],t[9],t[10]);return Math.max(i,r,n,1e-6)}baseWorldScale(e){return FS.copy(e.matrixWorld).decompose(P0,W1,q1),Math.max(Math.abs(q1.x),Math.abs(q1.y),Math.abs(q1.z),1e-6)}get widthWorldScale(){return this.data.headShape==="object"&&this.data.baseObjectId&&this.baseScaleAtRegen>0?this.baseScaleAtRegen:1}checkBaseDrift(){if(this.data.headShape!=="object"||!this.data.baseObjectId)return;let e=this.context.scene.find(this.data.baseObjectId);if(!e)return;if(!this.baseFoundAtRegen)return void this.regenerate();e.updateWorldMatrix(!0,!0);let t=this.collectBaseSources(e),i=t?.sources??[],r=t?.hashes??[],n=this.baseSourceGeomsAtRegen,s=this.baseSourceHashesAtRegen,a=i.length!==n.length;if(!a){for(let o=0;o<i.length;o++)if(i[o].geometry!==n[o]||Math.abs(r[o]-s[o])>1e-4*Math.max(Math.abs(s[o]),1)){a=!0;break}}if(!a&&this.data.hairColorSource==="object"&&(t?.colorHash??0)!==this.baseColorHashAtRegen&&(a=!0),!a&&i.length>0){let o=this.baseWorldScale(e);a=Math.abs(o-this.baseScaleAtRegen)>.001*Math.max(this.baseScaleAtRegen,1e-6)}a&&this.regenerate()}applyScalpState(){let e=this.data.headShape,t=e==="object"&&this.data.baseObjectId!==null;this.scalpMesh.visible=!t,!t&&(this.scalpMesh.geometry.dispose(),this.scalpMesh.geometry=e==="torus"?new UO(1.4*ad,.7*ad,24,48):e==="cylinder"?new uE(.8*ad,.8*ad,1.6*ad,48,1):new Ff(ad,48,32))}boneTransform(e,t){let i=this.matrixWorld;if(this.data.headShape==="object"&&this.data.baseObjectId){let r=this.context.scene.find(this.data.baseObjectId)?.matrixWorld;r&&(i=r)}FS.copy(i).decompose(t,e,q1)}raycast(e,t){if(!this.scalpMesh.visible)return;let i=[];this.scalpMesh.raycast(e,i);for(let r of i)r.object=this,t.push(r)}get shadowBoundsRadius(){let e=this.data.headShape==="torus"?2.6:1.5;return this.roots.unitScale*(e+2.6*Math.max(this.data.hairLength,0))}getShadowBoundsCenter(e){return this.boneTransform(W1,e),e}updateEntityBoxSize(e,t){let i=this.shadowBoundsRadius;e.set(0,0,0),t.set(i,i,i)}dispose(){super.dispose(),this.scalpMesh.geometry.dispose(),this.scalpMesh.material.dispose(),this.ribbonMesh.geometry.dispose(),this.ribbonMesh.material.dispose?.(),iW()?.release(this)}}});function _I(){return{shapeInput:()=>`
4170
4170
  const float posRowCoord = ${.5/uf};
4171
4171
  const float quatRowCoord = ${1.5/uf};
4172
4172
  const float param1RowCoord = ${2.5/uf};
@@ -12888,11 +12888,11 @@ void main() {
12888
12888
  void main() {
12889
12889
  vec4 texel = texture2D( tDiffuse, vUv );
12890
12890
  gl_FragColor = texel;
12891
- }`}),v5e=new class{constructor(e){this._mesh=new Cr(g5e,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,m5e)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}(zEe),tj=null,ij=null,y5e=Ui.identity(),kEe=class{constructor(e,t,i,r){var n;this.uuid=e,this.width=t,this.height=i,this.context=r,this.enabled=!0,this.isScreenSpace=!1,this.dpr=window.devicePixelRatio,this.isFrameDirty=!1,this.onRenderRequestedDownstream=()=>{this.isFrameDirty=!0,this.isScreenSpace||ME.add(this),this.context.shared.requestRender()},this._innerApplySize=()=>{let s=this.width,a=this.height;this.renderer.dpr=s0e(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 dK(ht.generateUUID(),cH.defaultData,{dpr:window.devicePixelRatio,shared:r.shared}),this.canvas=(tj===null&&(tj=document.createElement("canvas")),tj),this.renderer=(n=this.canvas,ij===null&&(ij=new l5e(n)),ij),this.promise=this.init(),this.renderTarget=new yr(1,1,{type:ni,stencilBuffer:!1,depthBuffer:!1}),r.shared.addUIBuffer(this.uuid,this.renderTarget),this.textureHolder=r.shared.uiBuffer(this.uuid)}get canvasTexture(){return this._canvasTexture||(this._canvasTexture=new G$(this.canvas)),this._canvasTexture}async init(){await this.renderer.init(),this.renderer.uiFontReady?.then(()=>{this.frameOverride&&this.onRenderRequestedDownstream()})}render(e){if(this.isFrameDirty){if(this.isFrameDirty=!1,this._innerApplySize(),this.renderer.clear(),this.frameOverride?.draw(this.renderer),this.renderer.render(),this.canvasTexture.needsUpdate=!0,e.blitTextureToTarget)e.blitTextureToTarget(this.canvasTexture,this.renderTarget);else{zEe.uniforms.tDiffuse.value=this.canvasTexture;let t=e.getRenderTarget();e.setRenderTarget(this.renderTarget),e.clear(),v5e.render(e),e.setRenderTarget(t)}this.textureHolder?.setNeedsUpdate(!0)}}updateEntity2DByOp(e,t,i,r){this.scene2d.updateEntityByOp(e,t,i,r),this.applySize()}updateTreeByOp(e,t){this.scene2d.updateTreeByOp(e,t),this.applySize()}applyOverrides(e){if(this.frameOverride&&this.frameRoot){this.frameOverride.position=[0,0],this.frameOverride.rotation=0;let t=e?.width??this.width,i=e?.height??this.height;this.frameOverride.width=t,this.frameOverride.height=i,this.frameOverride.localMatrix=y5e,this.isScreenSpace&&(this.frameOverride.fill.color=kr.from0to1([0,0,0,0])),this.frameOverride.data={...this.frameOverride.data,width:t,height:i},VEe({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(e,t=window.devicePixelRatio){let i=Math.max(1,e?.width??this.width),r=Math.max(1,e?.height??this.height);this.dpr=t,this.width=i,this.height=r,this._innerApplySize();let n=function(s,a,o,l){let u=s0e(s,a,o,l),h=Math.max(o,512/Math.min(s,a)),d=Math.min(h,u);return{width:Math.max(1,Math.ceil(s*d)),height:Math.max(1,Math.ceil(a*d))}}(i,r,t,this.isScreenSpace);this.renderTarget.setSize(n.width,n.height),this._canvasTexture?.dispose(),this._canvasTexture=void 0,this.applyOverrides(e),this.frameOverride?.requestRender()}applyFrame(e){let t=this.context.scene.find2D(e);if(t&&t instanceof Hc)return this.disposeFrameOverride(),this.frameRoot=t,this.frameOverride=t.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(),t}get frame(){return this.frameOverride}get frameId(){return this.frame?.uuid}find(e){return this.scene2d.find(e)}get texture(){return this.textureHolder?.getTexture(1001)}disposeFrameOverride(){this.frameOverride?.removeEventListener("render",this.onRenderRequestedDownstream),this.frameOverride?.traverse(e=>{e.removeEventListener("beginState",this.onFrameOverrideObjectEvent),e.removeEventListener("completeState",this.onFrameOverrideObjectEvent)}),this.frameOverride&&this.scene2d.remove(this.frameOverride)}};function VEe({objectOverride:e,objectRoot:t,newParentWidth:i,newParentHeight:r,initialParentWidth:n,initialParentHeight:s}){if(e instanceof Hc&&t instanceof Hc||e instanceof Fg&&t instanceof Fg)for(let a=0,o=e.children.length;a<o;a++){let l=e.children[a],u=t.children[a];l&&u&&l.uuid===u.uuid&&_5e({objectOverride:l,objectRoot:u,newParentWidth:i,newParentHeight:r,initialParentWidth:n,initialParentHeight:s})}}function _5e({objectOverride:e,objectRoot:t,newParentWidth:i,newParentHeight:r,initialParentWidth:n,initialParentHeight:s}){let[a,o]=function(d){if(rj(d))return[d.width,d.height];if(d instanceof h4){let[c,p]=d.getHalfSize();return[2*c,2*p]}if(d instanceof Fg){let[c,p]=d.recursiveBBox.getHalfSize();return[2*c,2*p]}return[0,0]}(t),{width:l,height:u,position:h}=FEe({constraints:e.data,newParentWidth:i,newParentHeight:r,initialParentWidth:n,initialParentHeight:s,objectInitialWidth:a,objectInitialHeight:o,objectInitialPosition:t.position});if(e.position=h,e.data={...e.data,position:h},e.states)for(let d in e.states)b5e({stateId:d,objectOverride:e,objectRoot:t,newParentWidth:i,newParentHeight:r,initialParentWidth:n,initialParentHeight:s});if(rj(e)||e instanceof Fg)rj(e)&&(e.width=l,e.height=u,e.data={...e.data,width:l,height:u}),VEe({objectOverride:e,objectRoot:t,newParentWidth:l,newParentHeight:u,initialParentWidth:a,initialParentHeight:o});else if(e instanceof h4){let d=t,c=a!==0?l/a:1,p=o!==0?u/o:1;e.path=function(f,m=1,g=1){if(m<=0||g<=0)return f;if(BEe(f))return console.warn("Cannot scale invalid path",f),ej([]);if(m===1&&g===1)return f;try{return ej((0,f5e.parseSVG)(f).map(v=>{let y={...v};return"x"in y&&(y.x=y.x*m),"y"in y&&(y.y=y.y*g),"x1"in y&&(y.x1=y.x1*m),"x2"in y&&(y.x2=y.x2*m),"y1"in y&&(y.y1=y.y1*g),"y2"in y&&(y.y2=y.y2*g),"rx"in y&&(y.rx=y.rx*m),"ry"in y&&(y.ry=y.ry*g),y}))}catch(v){return console.warn("Error parsing SVG path",v),ej([])}}(d.path,c,p),e.data={...e.data,path:e.path}}}function b5e({stateId:e,objectOverride:t,objectRoot:i,newParentWidth:r,newParentHeight:n,initialParentWidth:s,initialParentHeight:a}){let o=t.states?.[e],l=i.states?.[e];if(o&&l){let{width:u,height:h,position:d}=FEe({constraints:t.data,newParentWidth:r,newParentHeight:n,initialParentWidth:s,initialParentHeight:a,objectInitialWidth:my.isResizeable(l)?l.width:0,objectInitialHeight:my.isResizeable(l)?l.height:0,objectInitialPosition:l.position});Object.assign(t.states[e],{position:d}),my.isResizeable(o)&&Object.assign(t.states[e],{width:u,height:h})}}function rj(e){return e instanceof HA||e instanceof Hc||e instanceof hK||e instanceof uK}G4();var a0e,x5e=class extends Fn{constructor(e,t,i){super(e,t,i),this.isUIObject=!0,this.uiCanvas=new kEe(e+"-canvas",t.geometry.width,t.geometry.height,i),this.uiCanvas.promise.then(()=>{this.applyFrame(this.dataPatched.geometry.frame,i.shared)})}updateByPatchedOpGeometry(e,t,i){super.updateByPatchedOpGeometry(e,t,i),e.type===0&&(e.props.frame!==void 0&&this.applyFrame(e.props.frame,i.shared),(e.props.width!==void 0||e.props.height!==void 0)&&this.applySize(e.props,i.shared))}applySize(e,t){let i=e?.width??this.dataPatched.geometry.width,r=e?.height??this.dataPatched.geometry.height;this.uiCanvas.applySize({width:i,height:r}),this.applyGeometryParametersFromFrame(t)}applyFrame(e,t){this.uiCanvas.applyFrame(e),this.applyGeometryParametersFromFrame(t),this.applyMaterialParametersFromFrame({shared:t})}applyGeometryParametersFromFrame(e){let t=this.frame;t&&(Object.assign(this.data,{geometry:Object.assign(this.data.geometry,{cornerRadius:t.cornerRadius,cornerType:0})}),Object.assign(this.dataPatched,{geometry:Object.assign(this.dataPatched.geometry,{cornerRadius:t.cornerRadius,cornerType:0})}),this.localGeometry?.dispose(),this.localGeometry=Cg(this.dataPatched.geometry,e,this.data.flatShading,this))}applyMaterialParametersFromFrame(e){let t=this.frame;if(t){let i=t.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,e,!0)}}updateEntity2DByOp(e,t,i,r){this.uiCanvas.updateEntity2DByOp(e,t,i,r),e===this.frameId&&t.type===0&&(t.props.cornerRadius!==void 0?this.applyGeometryParametersFromFrame(r):Jr(t.path,["backgroundBlur"])&&this.applyMaterialParametersFromFrame({shared:r}))}get frame(){return this.uiCanvas.frame}get frameId(){return this.frame?.uuid}removeInteractionGeometry(e){super.removeInteractionGeometry(e),this.applySize({},e)}updateGeometryInteractions(e,t){super.updateGeometryInteractions(e,t),this.applySize({width:e.width,height:e.height},t);let i={...this.data.geometry,...e};this.localGeometry?.dispose(),this.localGeometry=Cg(i,t,this.data.flatShading,this)}};_r(),_w("UIGeometry",(e,t,i)=>new x5e(e,t,i)),I4=a0e={Scene2D:dK,UICanvas:kEe,loadHanaUIRUNTIME:function(){return a4||(a4=async()=>async function(e,t){return await e.default(t?{module_or_path:t}:void 0),Object.getOwnPropertyDescriptor(e.Engine.prototype,"scene")||Object.defineProperty(e.Engine.prototype,"scene",{get:function(){let i=Object.create(e.SceneController.prototype);return i.__wbg_ptr=this.__wbg_ptr,i}}),{createEngine:i=>e.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(()=>(BZ(),LZ)),Wge??function(){let e=typeof process<"u"?"2.0.35":void 0;return`https://cdn.spline.design/@splinetool/runtime${e?`@${e}`:""}/build/hana-ui.wasm`}())),OEe().then(()=>{})},setHanaUIWasmUrl:function(e){Wge=e}},cL!==null&&a0e.setHanaUIWasmUrl(cL),Nn("ui-2d"),oY(),gbe(),le();var GEe,nj,w5e=class{constructor(){this.type="ShapePath",this.color=new ot,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new cE,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath?.lineTo(e,t),this}quadraticCurveTo(e,t,i,r){return this.currentPath?.quadraticCurveTo(e,t,i,r),this}bezierCurveTo(e,t,i,r,n,s){return this.currentPath?.bezierCurveTo(e,t,i,r,n,s),this}splineThru(e){return this.currentPath?.splineThru(e),this}toShapes(){let e={loc:0,t:0};function t(u,h,d,c){let p=u.x,f=h.x,m=d.x,g=c.x,v=u.y,y=h.y,_=d.y,b=c.y,x=(g-m)*(v-_)-(b-_)*(p-m),w=(b-_)*(f-p)-(g-m)*(y-v),S=x/w,M=((f-p)*(v-_)-(y-v)*(p-m))/w;if(w===0&&x!==0||S<=0||S>=1||M<0||M>1)return null;if(x===0&&w===0){for(let T=0;T<2;T++){if(i(T===0?d:c,u,h),e.loc===0){let E=T===0?d:c;return{x:E.x,y:E.y,t:e.t}}if(e.loc===2)return{x:+(p+e.t*(f-p)).toPrecision(10),y:+(v+e.t*(y-v)).toPrecision(10),t:e.t}}return null}for(let T=0;T<2;T++)if(i(T===0?d:c,u,h),e.loc===0){let E=T===0?d:c;return{x:E.x,y:E.y,t:e.t}}return{x:+(p+S*(f-p)).toPrecision(10),y:+(v+S*(y-v)).toPrecision(10),t:S}}function i(u,h,d){let c,p=d.x-h.x,f=d.y-h.y,m=u.x-h.x,g=u.y-h.y,v=p*g-m*f;return u.x===h.x&&u.y===h.y?(e.loc=0,void(e.t=0)):u.x===d.x&&u.y===d.y?(e.loc=1,void(e.t=1)):void(v<-Number.EPSILON?e.loc=3:v>Number.EPSILON?e.loc=4:p*m<0||f*g<0?e.loc=5:Math.sqrt(p*p+f*f)<Math.sqrt(m*m+g*g)?e.loc=6:(c=p!==0?m/p:g/f,e.loc=2,e.t=c))}let r=0,n=999999999,s=-999999999,a=[];this.subPaths.forEach(u=>{let h=u.getPoints(),d=-999999999,c=999999999,p=-999999999,f=999999999;for(let m=0;m<h.length;m++){let g=h[m];g.y>d&&(d=g.y),g.y<c&&(c=g.y),g.x>p&&(p=g.x),g.x<f&&(f=g.x)}s<=p&&(s=p+1),n>=f&&(n=f-1),h.length&&a.push({curves:u.curves,points:h,isCW:d7.isClockWise(h),identifier:r++,boundingBox:new b4(new J(f,c),new J(p,d))})});let o=a.map(u=>function(h,d,c,p,f){(f==null||f==="")&&(f="nonzero");let m=new J;h.boundingBox.getCenter(m);let g=function(w,S,M){let T=new J;S.getCenter(T);let E=[];return M.forEach(A=>{A.boundingBox.containsPoint(T)&&function(R,N){let D=[],O=[];for(let z=1;z<R.length;z++){let U=R[z-1],G=R[z];for(let j=1;j<N.length;j++){let K=t(U,G,N[j-1],N[j]);K!==null&&D.find(q=>q.t<=K.t+Number.EPSILON&&q.t>=K.t-Number.EPSILON)===void 0&&(D.push(K),O.push(new J(K.x,K.y)))}}return O}(w,A.points).forEach(R=>{E.push({identifier:A.identifier,isCW:A.isCW,point:R})})}),E.sort((A,R)=>A.point.x-R.point.x),E}([new J(c,m.y),new J(p,m.y)],h.boundingBox,d);g.sort((w,S)=>w.point.x-S.point.x);let v=[],y=[];g.forEach(w=>{w.identifier===h.identifier?v.push(w):y.push(w)});let _=v[0].point.x,b=[],x=0;for(;x<y.length&&y[x].point.x<_;)b.length>0&&b[b.length-1]===y[x].identifier?b.pop():b.push(y[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,M=null;for(let T=0;T<b.length;T++){let E=b[T];d[E]&&(w?(M=d[E].isCW,w=!1,S=E):M!==d[E].isCW&&(M=d[E].isCW,w=!0))}return{identifier:h.identifier,isHole:w,for:S}}console.warn('fill-rule: "'+f+'" is currently not implemented.')}(u,a,n,s,this.userData?.style.fillRule)),l=[];return a.forEach(u=>{let h=o[u.identifier];if(h&&!h.isHole){let d=new ZE;d.curves=u.curves,o.filter(c=>c?.isHole&&c.for===u.identifier).forEach(c=>{if(c){let p=a[c.identifier],f=new cE;f.curves=p.curves,d.holes.push(f)}}),l.push(d)}}),l}},jEe=!1,o0e=new Promise(e=>{GEe=e}),l0e=!1;function h0e(){if(jEe=!0,!l0e)return nj||(nj=async function(){let e=await import("./opentype.js");GEe(e),l0e=!0}(),nj)}var S5e=new class{async load(e,t,i=()=>{}){let{load:r}=await o0e;r(e,(n,s)=>{n||!s?i(n??"Something went wrong"):t(s)})}async parse(e){let{parse:t,Bidi:i}=await o0e;try{let r=t(e),n=new i,s=a=>r.charToGlyphIndex(a.char);return n.registerModifier("glyphIndex",null,s),n.applyFeatures(r,r.defaultRenderOptions.features),{font:r,bidi:n}}catch(r){console.error(r)}}};function T5e(e,t){return t.state.glyphIndex===e||t.state.fina===e||t.state.medi===e||t.state.init===e}le(),LX(),_r(),_w("TextGeometry",(e,t,i)=>new K4(e,t,i));var u0e={create:(e,t)=>new FH(e,t)};mH("TextGeometry",u0e),mH("InputGeometry",u0e),OX=class{constructor(e){this._arrayBuffer=new ArrayBuffer(1),this._isLoaded=!1,this._intercepted=!1,this._layoutErrorWarned=!1,this._isUserFont=e.isUserFont??!1,this._loadingPromise=this.load(e)}update(e){this._isLoaded=!1,this._isUserFont=e.isUserFont??!1,this._loadingPromise=this.load(e)}async load(e){try{this._layoutErrorWarned=!1;let t=await async function(i){let r,n,s=!1;if(i.url?(r=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),n=i.url,s=i.url.startsWith("/")):i.data&&(r=i.data.buffer.slice(i.data.byteOffset,i.data.byteOffset+i.data.byteLength)),r){if(!jEe)return{font:void 0,url:n,intercepted:s,arr:r,bidi:null};{let a=await S5e.parse(r);if(a)return{font:a.font,url:n,intercepted:s,arr:r,bidi:a.bidi}}}}(e);t&&(this._arrayBuffer=t.arr,this._url=t.url,this.font=t.font,this._intercepted=t.intercepted,this._isLoaded=!0,this._bidi=t.bidi)}catch(t){console.warn(`Could not load the font "${e.url??"(inline data)"}"`,t)}}warnLayoutError(e){this._layoutErrorWarned||(this._layoutErrorWarned=!0,console.warn(`Text layout failed for the font "${this._url??"(inline data)"}"`,e))}get url(){return this._url}get intercepted(){return this._intercepted}get isLoaded(){return this._isLoaded}get loadingPromise(){return this._loadingPromise}reverseLigaturesTable(e,t,i){if(!this._bidi)return[];let r=this._bidi;r.getTextGlyphs(t);let n=r.tokenizer.tokens,s=[],a=0,o=i.length===n.length;for(let l=0;l<i.length;l++){let u=i[l].index,h=String.fromCharCode(i[l].unicode),d=n[a];if(T5e(u,d)||o)s.push({char:h,index:u,replacements:[d.state.glyphIndex],replacementChars:[d.char]}),a++;else{let c=d.char,p="",f=[d.state.glyphIndex],m=[],g=!1;for(;!g;)a++,p=t.charAt(a),c+=p,f.push(e.charToGlyphIndex(p)),m=e.stringToGlyphs(c),m.length===1&&m[0].index===u&&(g=!0),a>t.length&&(g=!0);s.push({char:h,index:u,replacements:f,replacementChars:Array.from(c)}),a++}}return s}generateShapes(e,t,i){if(!this._isLoaded)return;let r=this.font,n=t.fontSize/this.unitsPerEm,s=t.fontSize*t.lineHeight,a=e.map(v=>this.getTextWidth(v,t)),o=typeof t.width=="string"?Number(i.getVariable(t.width)):t.width,l=typeof t.height=="string"?Number(i.getVariable(t.height)):t.height,u=this.getCharWidth(`
12891
+ }`}),v5e=new class{constructor(e){this._mesh=new Cr(g5e,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,m5e)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}(zEe),tj=null,ij=null,y5e=Ui.identity(),kEe=class{constructor(e,t,i,r){var n;this.uuid=e,this.width=t,this.height=i,this.context=r,this.enabled=!0,this.isScreenSpace=!1,this.dpr=window.devicePixelRatio,this.isFrameDirty=!1,this.onRenderRequestedDownstream=()=>{this.isFrameDirty=!0,this.isScreenSpace||ME.add(this),this.context.shared.requestRender()},this._innerApplySize=()=>{let s=this.width,a=this.height;this.renderer.dpr=s0e(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 dK(ht.generateUUID(),cH.defaultData,{dpr:window.devicePixelRatio,shared:r.shared}),this.canvas=(tj===null&&(tj=document.createElement("canvas")),tj),this.renderer=(n=this.canvas,ij===null&&(ij=new l5e(n)),ij),this.promise=this.init(),this.renderTarget=new yr(1,1,{type:ni,stencilBuffer:!1,depthBuffer:!1}),r.shared.addUIBuffer(this.uuid,this.renderTarget),this.textureHolder=r.shared.uiBuffer(this.uuid)}get canvasTexture(){return this._canvasTexture||(this._canvasTexture=new G$(this.canvas)),this._canvasTexture}async init(){await this.renderer.init(),this.renderer.uiFontReady?.then(()=>{this.frameOverride&&this.onRenderRequestedDownstream()})}render(e){if(this.isFrameDirty){if(this.isFrameDirty=!1,this._innerApplySize(),this.renderer.clear(),this.frameOverride?.draw(this.renderer),this.renderer.render(),this.canvasTexture.needsUpdate=!0,e.blitTextureToTarget)e.blitTextureToTarget(this.canvasTexture,this.renderTarget);else{zEe.uniforms.tDiffuse.value=this.canvasTexture;let t=e.getRenderTarget();e.setRenderTarget(this.renderTarget),e.clear(),v5e.render(e),e.setRenderTarget(t)}this.textureHolder?.setNeedsUpdate(!0)}}updateEntity2DByOp(e,t,i,r){this.scene2d.updateEntityByOp(e,t,i,r),this.applySize()}updateTreeByOp(e,t){this.scene2d.updateTreeByOp(e,t),this.applySize()}applyOverrides(e){if(this.frameOverride&&this.frameRoot){this.frameOverride.position=[0,0],this.frameOverride.rotation=0;let t=e?.width??this.width,i=e?.height??this.height;this.frameOverride.width=t,this.frameOverride.height=i,this.frameOverride.localMatrix=y5e,this.isScreenSpace&&(this.frameOverride.fill.color=kr.from0to1([0,0,0,0])),this.frameOverride.data={...this.frameOverride.data,width:t,height:i},VEe({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(e,t=window.devicePixelRatio){let i=Math.max(1,e?.width??this.width),r=Math.max(1,e?.height??this.height);this.dpr=t,this.width=i,this.height=r,this._innerApplySize();let n=function(s,a,o,l){let u=s0e(s,a,o,l),h=Math.max(o,512/Math.min(s,a)),d=Math.min(h,u);return{width:Math.max(1,Math.ceil(s*d)),height:Math.max(1,Math.ceil(a*d))}}(i,r,t,this.isScreenSpace);this.renderTarget.setSize(n.width,n.height),this._canvasTexture?.dispose(),this._canvasTexture=void 0,this.applyOverrides(e),this.frameOverride?.requestRender()}applyFrame(e){let t=this.context.scene.find2D(e);if(t&&t instanceof Hc)return this.disposeFrameOverride(),this.frameRoot=t,this.frameOverride=t.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(),t}get frame(){return this.frameOverride}get frameId(){return this.frame?.uuid}find(e){return this.scene2d.find(e)}get texture(){return this.textureHolder?.getTexture(1001)}disposeFrameOverride(){this.frameOverride?.removeEventListener("render",this.onRenderRequestedDownstream),this.frameOverride?.traverse(e=>{e.removeEventListener("beginState",this.onFrameOverrideObjectEvent),e.removeEventListener("completeState",this.onFrameOverrideObjectEvent)}),this.frameOverride&&this.scene2d.remove(this.frameOverride)}};function VEe({objectOverride:e,objectRoot:t,newParentWidth:i,newParentHeight:r,initialParentWidth:n,initialParentHeight:s}){if(e instanceof Hc&&t instanceof Hc||e instanceof Fg&&t instanceof Fg)for(let a=0,o=e.children.length;a<o;a++){let l=e.children[a],u=t.children[a];l&&u&&l.uuid===u.uuid&&_5e({objectOverride:l,objectRoot:u,newParentWidth:i,newParentHeight:r,initialParentWidth:n,initialParentHeight:s})}}function _5e({objectOverride:e,objectRoot:t,newParentWidth:i,newParentHeight:r,initialParentWidth:n,initialParentHeight:s}){let[a,o]=function(d){if(rj(d))return[d.width,d.height];if(d instanceof h4){let[c,p]=d.getHalfSize();return[2*c,2*p]}if(d instanceof Fg){let[c,p]=d.recursiveBBox.getHalfSize();return[2*c,2*p]}return[0,0]}(t),{width:l,height:u,position:h}=FEe({constraints:e.data,newParentWidth:i,newParentHeight:r,initialParentWidth:n,initialParentHeight:s,objectInitialWidth:a,objectInitialHeight:o,objectInitialPosition:t.position});if(e.position=h,e.data={...e.data,position:h},e.states)for(let d in e.states)b5e({stateId:d,objectOverride:e,objectRoot:t,newParentWidth:i,newParentHeight:r,initialParentWidth:n,initialParentHeight:s});if(rj(e)||e instanceof Fg)rj(e)&&(e.width=l,e.height=u,e.data={...e.data,width:l,height:u}),VEe({objectOverride:e,objectRoot:t,newParentWidth:l,newParentHeight:u,initialParentWidth:a,initialParentHeight:o});else if(e instanceof h4){let d=t,c=a!==0?l/a:1,p=o!==0?u/o:1;e.path=function(f,m=1,g=1){if(m<=0||g<=0)return f;if(BEe(f))return console.warn("Cannot scale invalid path",f),ej([]);if(m===1&&g===1)return f;try{return ej((0,f5e.parseSVG)(f).map(v=>{let y={...v};return"x"in y&&(y.x=y.x*m),"y"in y&&(y.y=y.y*g),"x1"in y&&(y.x1=y.x1*m),"x2"in y&&(y.x2=y.x2*m),"y1"in y&&(y.y1=y.y1*g),"y2"in y&&(y.y2=y.y2*g),"rx"in y&&(y.rx=y.rx*m),"ry"in y&&(y.ry=y.ry*g),y}))}catch(v){return console.warn("Error parsing SVG path",v),ej([])}}(d.path,c,p),e.data={...e.data,path:e.path}}}function b5e({stateId:e,objectOverride:t,objectRoot:i,newParentWidth:r,newParentHeight:n,initialParentWidth:s,initialParentHeight:a}){let o=t.states?.[e],l=i.states?.[e];if(o&&l){let{width:u,height:h,position:d}=FEe({constraints:t.data,newParentWidth:r,newParentHeight:n,initialParentWidth:s,initialParentHeight:a,objectInitialWidth:my.isResizeable(l)?l.width:0,objectInitialHeight:my.isResizeable(l)?l.height:0,objectInitialPosition:l.position});Object.assign(t.states[e],{position:d}),my.isResizeable(o)&&Object.assign(t.states[e],{width:u,height:h})}}function rj(e){return e instanceof HA||e instanceof Hc||e instanceof hK||e instanceof uK}G4();var a0e,x5e=class extends Fn{constructor(e,t,i){super(e,t,i),this.isUIObject=!0,this.uiCanvas=new kEe(e+"-canvas",t.geometry.width,t.geometry.height,i),this.uiCanvas.promise.then(()=>{this.applyFrame(this.dataPatched.geometry.frame,i.shared)})}updateByPatchedOpGeometry(e,t,i){super.updateByPatchedOpGeometry(e,t,i),e.type===0&&(e.props.frame!==void 0&&this.applyFrame(e.props.frame,i.shared),(e.props.width!==void 0||e.props.height!==void 0)&&this.applySize(e.props,i.shared))}applySize(e,t){let i=e?.width??this.dataPatched.geometry.width,r=e?.height??this.dataPatched.geometry.height;this.uiCanvas.applySize({width:i,height:r}),this.applyGeometryParametersFromFrame(t)}applyFrame(e,t){this.uiCanvas.applyFrame(e),this.applyGeometryParametersFromFrame(t),this.applyMaterialParametersFromFrame({shared:t})}applyGeometryParametersFromFrame(e){let t=this.frame;t&&(Object.assign(this.data,{geometry:Object.assign(this.data.geometry,{cornerRadius:t.cornerRadius,cornerType:0})}),Object.assign(this.dataPatched,{geometry:Object.assign(this.dataPatched.geometry,{cornerRadius:t.cornerRadius,cornerType:0})}),this.localGeometry?.dispose(),this.localGeometry=Cg(this.dataPatched.geometry,e,this.data.flatShading,this))}applyMaterialParametersFromFrame(e){let t=this.frame;if(t){let i=t.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,e,!0)}}updateEntity2DByOp(e,t,i,r){this.uiCanvas.updateEntity2DByOp(e,t,i,r),e===this.frameId&&t.type===0&&(t.props.cornerRadius!==void 0?this.applyGeometryParametersFromFrame(r):Jr(t.path,["backgroundBlur"])&&this.applyMaterialParametersFromFrame({shared:r}))}get frame(){return this.uiCanvas.frame}get frameId(){return this.frame?.uuid}removeInteractionGeometry(e){super.removeInteractionGeometry(e),this.applySize({},e)}updateGeometryInteractions(e,t){super.updateGeometryInteractions(e,t),this.applySize({width:e.width,height:e.height},t);let i={...this.data.geometry,...e};this.localGeometry?.dispose(),this.localGeometry=Cg(i,t,this.data.flatShading,this)}};_r(),_w("UIGeometry",(e,t,i)=>new x5e(e,t,i)),I4=a0e={Scene2D:dK,UICanvas:kEe,loadHanaUIRUNTIME:function(){return a4||(a4=async()=>async function(e,t){return await e.default(t?{module_or_path:t}:void 0),Object.getOwnPropertyDescriptor(e.Engine.prototype,"scene")||Object.defineProperty(e.Engine.prototype,"scene",{get:function(){let i=Object.create(e.SceneController.prototype);return i.__wbg_ptr=this.__wbg_ptr,i}}),{createEngine:i=>e.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(()=>(BZ(),LZ)),Wge??function(){let e=typeof process<"u"?"2.0.37":void 0;return`https://cdn.spline.design/@splinetool/runtime${e?`@${e}`:""}/build/hana-ui.wasm`}())),OEe().then(()=>{})},setHanaUIWasmUrl:function(e){Wge=e}},cL!==null&&a0e.setHanaUIWasmUrl(cL),Nn("ui-2d"),oY(),gbe(),le();var GEe,nj,w5e=class{constructor(){this.type="ShapePath",this.color=new ot,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new cE,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath?.lineTo(e,t),this}quadraticCurveTo(e,t,i,r){return this.currentPath?.quadraticCurveTo(e,t,i,r),this}bezierCurveTo(e,t,i,r,n,s){return this.currentPath?.bezierCurveTo(e,t,i,r,n,s),this}splineThru(e){return this.currentPath?.splineThru(e),this}toShapes(){let e={loc:0,t:0};function t(u,h,d,c){let p=u.x,f=h.x,m=d.x,g=c.x,v=u.y,y=h.y,_=d.y,b=c.y,x=(g-m)*(v-_)-(b-_)*(p-m),w=(b-_)*(f-p)-(g-m)*(y-v),S=x/w,M=((f-p)*(v-_)-(y-v)*(p-m))/w;if(w===0&&x!==0||S<=0||S>=1||M<0||M>1)return null;if(x===0&&w===0){for(let T=0;T<2;T++){if(i(T===0?d:c,u,h),e.loc===0){let E=T===0?d:c;return{x:E.x,y:E.y,t:e.t}}if(e.loc===2)return{x:+(p+e.t*(f-p)).toPrecision(10),y:+(v+e.t*(y-v)).toPrecision(10),t:e.t}}return null}for(let T=0;T<2;T++)if(i(T===0?d:c,u,h),e.loc===0){let E=T===0?d:c;return{x:E.x,y:E.y,t:e.t}}return{x:+(p+S*(f-p)).toPrecision(10),y:+(v+S*(y-v)).toPrecision(10),t:S}}function i(u,h,d){let c,p=d.x-h.x,f=d.y-h.y,m=u.x-h.x,g=u.y-h.y,v=p*g-m*f;return u.x===h.x&&u.y===h.y?(e.loc=0,void(e.t=0)):u.x===d.x&&u.y===d.y?(e.loc=1,void(e.t=1)):void(v<-Number.EPSILON?e.loc=3:v>Number.EPSILON?e.loc=4:p*m<0||f*g<0?e.loc=5:Math.sqrt(p*p+f*f)<Math.sqrt(m*m+g*g)?e.loc=6:(c=p!==0?m/p:g/f,e.loc=2,e.t=c))}let r=0,n=999999999,s=-999999999,a=[];this.subPaths.forEach(u=>{let h=u.getPoints(),d=-999999999,c=999999999,p=-999999999,f=999999999;for(let m=0;m<h.length;m++){let g=h[m];g.y>d&&(d=g.y),g.y<c&&(c=g.y),g.x>p&&(p=g.x),g.x<f&&(f=g.x)}s<=p&&(s=p+1),n>=f&&(n=f-1),h.length&&a.push({curves:u.curves,points:h,isCW:d7.isClockWise(h),identifier:r++,boundingBox:new b4(new J(f,c),new J(p,d))})});let o=a.map(u=>function(h,d,c,p,f){(f==null||f==="")&&(f="nonzero");let m=new J;h.boundingBox.getCenter(m);let g=function(w,S,M){let T=new J;S.getCenter(T);let E=[];return M.forEach(A=>{A.boundingBox.containsPoint(T)&&function(R,N){let D=[],O=[];for(let z=1;z<R.length;z++){let U=R[z-1],G=R[z];for(let j=1;j<N.length;j++){let K=t(U,G,N[j-1],N[j]);K!==null&&D.find(q=>q.t<=K.t+Number.EPSILON&&q.t>=K.t-Number.EPSILON)===void 0&&(D.push(K),O.push(new J(K.x,K.y)))}}return O}(w,A.points).forEach(R=>{E.push({identifier:A.identifier,isCW:A.isCW,point:R})})}),E.sort((A,R)=>A.point.x-R.point.x),E}([new J(c,m.y),new J(p,m.y)],h.boundingBox,d);g.sort((w,S)=>w.point.x-S.point.x);let v=[],y=[];g.forEach(w=>{w.identifier===h.identifier?v.push(w):y.push(w)});let _=v[0].point.x,b=[],x=0;for(;x<y.length&&y[x].point.x<_;)b.length>0&&b[b.length-1]===y[x].identifier?b.pop():b.push(y[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,M=null;for(let T=0;T<b.length;T++){let E=b[T];d[E]&&(w?(M=d[E].isCW,w=!1,S=E):M!==d[E].isCW&&(M=d[E].isCW,w=!0))}return{identifier:h.identifier,isHole:w,for:S}}console.warn('fill-rule: "'+f+'" is currently not implemented.')}(u,a,n,s,this.userData?.style.fillRule)),l=[];return a.forEach(u=>{let h=o[u.identifier];if(h&&!h.isHole){let d=new ZE;d.curves=u.curves,o.filter(c=>c?.isHole&&c.for===u.identifier).forEach(c=>{if(c){let p=a[c.identifier],f=new cE;f.curves=p.curves,d.holes.push(f)}}),l.push(d)}}),l}},jEe=!1,o0e=new Promise(e=>{GEe=e}),l0e=!1;function h0e(){if(jEe=!0,!l0e)return nj||(nj=async function(){let e=await import("./opentype.js");GEe(e),l0e=!0}(),nj)}var S5e=new class{async load(e,t,i=()=>{}){let{load:r}=await o0e;r(e,(n,s)=>{n||!s?i(n??"Something went wrong"):t(s)})}async parse(e){let{parse:t,Bidi:i}=await o0e;try{let r=t(e),n=new i,s=a=>r.charToGlyphIndex(a.char);return n.registerModifier("glyphIndex",null,s),n.applyFeatures(r,r.defaultRenderOptions.features),{font:r,bidi:n}}catch(r){console.error(r)}}};function T5e(e,t){return t.state.glyphIndex===e||t.state.fina===e||t.state.medi===e||t.state.init===e}le(),LX(),_r(),_w("TextGeometry",(e,t,i)=>new K4(e,t,i));var u0e={create:(e,t)=>new FH(e,t)};mH("TextGeometry",u0e),mH("InputGeometry",u0e),OX=class{constructor(e){this._arrayBuffer=new ArrayBuffer(1),this._isLoaded=!1,this._intercepted=!1,this._layoutErrorWarned=!1,this._isUserFont=e.isUserFont??!1,this._loadingPromise=this.load(e)}update(e){this._isLoaded=!1,this._isUserFont=e.isUserFont??!1,this._loadingPromise=this.load(e)}async load(e){try{this._layoutErrorWarned=!1;let t=await async function(i){let r,n,s=!1;if(i.url?(r=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),n=i.url,s=i.url.startsWith("/")):i.data&&(r=i.data.buffer.slice(i.data.byteOffset,i.data.byteOffset+i.data.byteLength)),r){if(!jEe)return{font:void 0,url:n,intercepted:s,arr:r,bidi:null};{let a=await S5e.parse(r);if(a)return{font:a.font,url:n,intercepted:s,arr:r,bidi:a.bidi}}}}(e);t&&(this._arrayBuffer=t.arr,this._url=t.url,this.font=t.font,this._intercepted=t.intercepted,this._isLoaded=!0,this._bidi=t.bidi)}catch(t){console.warn(`Could not load the font "${e.url??"(inline data)"}"`,t)}}warnLayoutError(e){this._layoutErrorWarned||(this._layoutErrorWarned=!0,console.warn(`Text layout failed for the font "${this._url??"(inline data)"}"`,e))}get url(){return this._url}get intercepted(){return this._intercepted}get isLoaded(){return this._isLoaded}get loadingPromise(){return this._loadingPromise}reverseLigaturesTable(e,t,i){if(!this._bidi)return[];let r=this._bidi;r.getTextGlyphs(t);let n=r.tokenizer.tokens,s=[],a=0,o=i.length===n.length;for(let l=0;l<i.length;l++){let u=i[l].index,h=String.fromCharCode(i[l].unicode),d=n[a];if(T5e(u,d)||o)s.push({char:h,index:u,replacements:[d.state.glyphIndex],replacementChars:[d.char]}),a++;else{let c=d.char,p="",f=[d.state.glyphIndex],m=[],g=!1;for(;!g;)a++,p=t.charAt(a),c+=p,f.push(e.charToGlyphIndex(p)),m=e.stringToGlyphs(c),m.length===1&&m[0].index===u&&(g=!0),a>t.length&&(g=!0);s.push({char:h,index:u,replacements:f,replacementChars:Array.from(c)}),a++}}return s}generateShapes(e,t,i){if(!this._isLoaded)return;let r=this.font,n=t.fontSize/this.unitsPerEm,s=t.fontSize*t.lineHeight,a=e.map(v=>this.getTextWidth(v,t)),o=typeof t.width=="string"?Number(i.getVariable(t.width)):t.width,l=typeof t.height=="string"?Number(i.getVariable(t.height)):t.height,u=this.getCharWidth(`
12892
12892
  `,t),h=t.horizontalAlign===1?u:0,d=this.getLineInitialOffsetX(a[0],o,t.horizontalAlign,e[0],u),c=this.getLineInitialOffsetY(s,e.length,l,n,t.verticalAlign),p=[],f=e.map(()=>[]),m=e.map(()=>[]);for(let v=0;v<e.length;v++){let y=e[v],_={features:{liga:!0},letterSpacing:t.letterSpacing},b=[];try{b=r.stringToGlyphs(y,_)}catch(T){this.warnLayoutError(T)}d=this.getLineInitialOffsetX(a[v],o,t.horizontalAlign,y,u);let x=[];try{x=this.reverseLigaturesTable(r,y,b)}catch(T){this.warnLayoutError(T)}let w=this.computeSpaceWidthForLine(e,v,t,i),S=0,M=b[0];M&&t.horizontalAlign===2&&M.leftSideBearing!==void 0&&(d-=M.leftSideBearing*n);try{this.font?.forEachGlyph(y,d,c,t.fontSize,_,(T,E,A,R,N)=>{let D=T.index===0?`
12893
12893
  `:T.unicode?String.fromCharCode(T.unicode):void 0,O=x[S],z=0;if(D===`
12894
12894
  `)z=h;else if(D===" ")z=w;else{let U=this.createPath(T,n,E,A,t);U&&(z=U.offsetX,p.push(U.path))}if(O&&O.replacements.length!==1){let U=O.replacements.map(q=>(r.glyphs.get(q).advanceWidth??0)*n),G=U.reduce((q,se)=>q+se,0),j=U.map(q=>q/G),K=E;for(let q=0;q<j.length;q++){let se=z*j[q];m[v].push([K,A]),f[v].push(se),K+=se}}else m[v].push([E,A]),f[v].push(z);S++})}catch(T){this.warnLayoutError(T)}c-=s}let g=[];for(let v=0,y=p.length;v<y;v++)g.push(...p[v].toShapes());return{shapes:g,charWidths:f,lineWidths:a,charCoords:m}}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(e,t,i,r,n){return(i===3||i===2)&&r.indexOf(`
12895
- `)>=0&&(e-=n),i===3?.5*t-.5*e:i===2?t-e:0}getLineInitialOffsetY(e,t,i,r,n){let s=t*e,a=e-Math.abs(this.ascender-this.descender)*r,o=-this.ascender*r-a/2;return n===3?-(i-s-o):n===2?-(.5*i-.5*s-o):o}createPath(e,t,i,r,n){let s=e.getPath(i,-r,n.fontSize,{kerning:!1,letterSpacing:n.letterSpacing});if(!s)return void console.error('THREE.Font: character "'+e+'" does not exists in font family '+this.familyName+".");let a=new w5e,o=(e.advanceWidth??1)*t;if(e)for(let l of s.commands){let u=a.currentPath?.currentPoint;if(!u||l.type==="Z"||u.x!==l.x||-u.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 u=function(h){if(h.length){let d=h[0];if(d instanceof wh)return d.v1;if(d instanceof pu||d instanceof of)return d.v0}}(l.curves);u!==void 0&&l.currentPoint.distanceTo(u)>0&&l.lineTo(u.x,u.y)}),{offsetX:o,path:a}}getCharWidth(e,t){try{return this.font?.getAdvanceWidth(e,t.fontSize,{kerning:!0,letterSpacing:t.letterSpacing})??0}catch(i){return this.warnLayoutError(i),0}}getTextWidth(e,t){try{return this.font?.getAdvanceWidth(e,t.fontSize,{kerning:!0,letterSpacing:t.letterSpacing})??0}catch(i){return this.warnLayoutError(i),0}}computeSpaceWidthForLine(e,t,i,r){let n=this.getCharWidth(" ",i),s=e[t];if(s){let a=this.countSpaces(s.trimEnd());if(i.horizontalAlign===4&&t<e.length-1&&a)return((typeof i.width=="string"?Number(r.getVariable(i.width)):i.width)-(this.getTextWidth(s,i)-a*n))/a}return n}countSpaces(e){return(e.match(/ /g)||[]).length}},Nn("text"),Wt();var HEe=null;function d0e(){return HEe}function M5e(e){let t=!1;return e.scene.objects.forEach(i=>{i.data.type==="Page"&&!t&&i.data.publish.gameControlObject&&Zy.traverseModuleInstances(e,i.id,(r,n,s)=>{for(let a of s)a.data.type==="GameControl"&&a.data.navmesh.enabled&&(t=!0)})}),t}Hr();var fN=(e,t)=>{let i=t.x-e.x,r=t.y-e.y;return Math.sqrt(i*i+r*r)},sj=e=>e*(Math.PI/180),mN=new Map,u4=(e,t,i)=>{let r,n=t.split(/[ ,]+/g);for(let s=0;s<n.length;s+=1)r=n[s],e.addEventListener?e.addEventListener(r,i,!1):e.attachEvent&&e.attachEvent(r,i)},d4=(e,t,i)=>{let r,n=t.split(/[ ,]+/g);for(let s=0;s<n.length;s+=1)r=n[s],e.removeEventListener?e.removeEventListener(r,i):e.detachEvent&&e.detachEvent(r,i)},WEe=e=>(e.preventDefault(),e.type.match(/^touch/)?e.changedTouches:e),c0e=()=>{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}},aj=(e,t)=>{t.top||t.right||t.bottom||t.left?(e.style.top=t.top,e.style.right=t.right,e.style.bottom=t.bottom,e.style.left=t.left):(e.style.left=t.x+"px",e.style.top=t.y+"px")},oj=(e,t,i)=>{let r=qEe(e);for(let n in r)if(Object.prototype.hasOwnProperty.call(r,n))if(typeof t=="string")r[n]=t+" "+i;else{let s="";for(let a=0,o=t.length;a<o;a+=1)s+=t[a]+" "+i+", ";r[n]=s.slice(0,-2)}return r},qEe=e=>{let t={};return t[e]="",["webkit","Moz","o"].forEach(function(i){t[i+e.charAt(0).toUpperCase()+e.slice(1)]=""}),t},lj=(e,t)=>{for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},c$=(e,t)=>{if(e.length)for(let i=0,r=e.length;i<r;i+=1)t(e[i]);else t(e)};typeof window<"u"&&($Ee="ontouchstart"in window,XEe=!!window.PointerEvent,YEe=!!window.MSPointerEvent);var $Ee,XEe,YEe,rb,p0e={start:"mousedown",move:"mousemove",end:"mouseup"},q2={};function Lv(){}XEe?rb={start:"pointerdown",move:"pointermove",end:"pointerup, pointercancel"}:YEe?rb={start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:$Ee?(rb={start:"touchstart",move:"touchmove",end:"touchend, touchcancel"},q2=p0e):rb=p0e,Lv.prototype.on=function(e,t){var i,r=this,n=e.split(/[ ,]+/g);r._handlers_=r._handlers_||{};for(var s=0;s<n.length;s+=1)i=n[s],r._handlers_[i]=r._handlers_[i]||[],r._handlers_[i].push(t);return r},Lv.prototype.off=function(e,t){var i=this;return i._handlers_=i._handlers_||{},e===void 0?i._handlers_={}:t===void 0?i._handlers_[e]=null:i._handlers_[e]&&i._handlers_[e].indexOf(t)>=0&&i._handlers_[e].splice(i._handlers_[e].indexOf(t),1),i},Lv.prototype.trigger=function(e,t){var i,r=this,n=e.split(/[ ,]+/g);r._handlers_=r._handlers_||{};for(var s=0;s<n.length;s+=1)i=n[s],r._handlers_[i]&&r._handlers_[i].length&&r._handlers_[i].forEach(function(a){a.call(r,{type:i,target:r},t)})},Lv.prototype.config=function(e){var t=this;t.options=t.defaults||{},e&&(t.options=((i,r)=>{let n={};for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&Object.prototype.hasOwnProperty.call(r,s)?n[s]=r[s]:Object.prototype.hasOwnProperty.call(i,s)&&(n[s]=i[s]);return n})(t.options,e))},Lv.prototype.bindEvt=function(e,t){var i=this;return i._domHandlers_=i._domHandlers_||{},i._domHandlers_[t]=function(){typeof i["on"+t]=="function"?i["on"+t].apply(i,arguments):console.warn('[WARNING] : Missing "on'+t+'" handler.')},u4(e,rb[t],i._domHandlers_[t]),q2[t]&&u4(e,q2[t],i._domHandlers_[t]),i},Lv.prototype.unbindEvt=function(e,t){var i=this;return i._domHandlers_=i._domHandlers_||{},d4(e,rb[t],i._domHandlers_[t]),q2[t]&&d4(e,q2[t],i._domHandlers_[t]),delete i._domHandlers_[t],this};var cK=Lv;function xa(e,t){return this.identifier=t.identifier,this.position=t.position,this.frontPosition=t.frontPosition,this.collection=e,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(t),this.options.mode==="dynamic"&&(this.options.restOpacity=0),this.id=xa.id,xa.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}xa.prototype=new cK,xa.constructor=xa,xa.id=0,xa.prototype.buildEl=function(e){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},xa.prototype.stylize=function(){if(this.options.dataOnly)return this;var e=this.options.fadeTime+"ms",t=(()=>{let n=qEe("borderRadius");for(let s in n)Object.prototype.hasOwnProperty.call(n,s)&&(n[s]="50%");return n})(),i=oj("transition","opacity",e),r={};return r.el={position:"absolute",opacity:this.options.restOpacity,display:"block",zIndex:999},r.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)"},r.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)"},lj(r.el,i),this.options.shape==="circle"&&lj(r.back,t),lj(r.front,t),this.applyStyles(r),this},xa.prototype.applyStyles=function(e){for(var t in this.ui)if(Object.prototype.hasOwnProperty.call(this.ui,t))for(var i in e[t])this.ui[t].style[i]=e[t][i];return this},xa.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)||this.options.zone.appendChild(this.ui.el),this},xa.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)||this.options.zone.removeChild(this.ui.el),this},xa.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},xa.prototype.show=function(e){var t=this;return t.options.dataOnly||(clearTimeout(t.removeTimeout),clearTimeout(t.showTimeout),clearTimeout(t.restTimeout),t.addToDom(),t.restCallback(),setTimeout(function(){t.ui.el.style.opacity=1},0),t.showTimeout=setTimeout(function(){t.trigger("shown",t.instance),typeof e=="function"&&e.call(this)},t.options.fadeTime)),t},xa.prototype.hide=function(e){var t=this;if(t.options.dataOnly)return t;if(t.ui.el.style.opacity=t.options.restOpacity,clearTimeout(t.removeTimeout),clearTimeout(t.showTimeout),clearTimeout(t.restTimeout),t.removeTimeout=setTimeout(function(){var i=t.options.mode==="dynamic"?"none":"block";t.ui.el.style.display=i,typeof e=="function"&&e.call(t),t.trigger("hidden",t.instance)},t.options.fadeTime),t.options.restJoystick){let i=t.options.restJoystick,r={};r.x=i===!0||i.x!==!1?0:t.instance.frontPosition.x,r.y=i===!0||i.y!==!1?0:t.instance.frontPosition.y,t.setPosition(e,r)}return t},xa.prototype.setPosition=function(e,t){var i=this;i.frontPosition={x:t.x,y:t.y};var r=i.options.fadeTime+"ms",n={};n.front=oj("transition",["top","left"],r);var s={front:{}};s.front={left:i.frontPosition.x+"px",top:i.frontPosition.y+"px"},i.applyStyles(n),i.applyStyles(s),i.restTimeout=setTimeout(function(){typeof e=="function"&&e.call(i),i.restCallback()},i.options.fadeTime)},xa.prototype.restCallback=function(){var e=this,t={};t.front=oj("transition","none",""),e.applyStyles(t),e.trigger("rested",e.instance)},xa.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}},xa.prototype.computeDirection=function(e){var t,i,r,n=e.angle.radian,s=Math.PI/4,a=Math.PI/2;if(n>s&&n<3*s&&!e.lockX?t="up":n>-s&&n<=s&&!e.lockY?t="left":n>3*-s&&n<=-s&&!e.lockX?t="down":e.lockY||(t="right"),e.lockY||(i=n>-a&&n<a?"left":"right"),e.lockX||(r=n>0?"up":"down"),e.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 u={};for(o in this.direction={x:i,y:r,angle:t},e.direction=this.direction,l)l[o]===this.direction[o]&&(u[o]=!0);if(u.x&&u.y&&u.angle)return e;(!u.x||!u.y)&&this.trigger("plain",e),u.x||this.trigger("plain:"+i,e),u.y||this.trigger("plain:"+r,e),u.angle||this.trigger("dir dir:"+t,e)}else this.resetDirection();return e};var E5e=xa;function qs(e,t){var i=this;i.nipples=[],i.idles=[],i.actives=[],i.ids=[],i.pressureIntervals={},i.manager=e,i.id=qs.id,qs.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(t),(i.options.mode==="static"||i.options.mode==="semi")&&(i.options.multitouch=!1),i.options.multitouch||(i.options.maxNumberOfNipples=1);let r=getComputedStyle(i.options.zone.parentElement);return r&&r.display==="flex"&&(i.parentIsFlex=!0),i.updateBox(),i.prepareNipples(),i.bindings(),i.begin(),i.nipples}qs.prototype=new cK,qs.constructor=qs,qs.id=0,qs.prototype.prepareNipples=function(){var e=this,t=e.nipples;t.on=e.on.bind(e),t.off=e.off.bind(e),t.options=e.options,t.destroy=e.destroy.bind(e),t.ids=e.ids,t.id=e.id,t.processOnMove=e.processOnMove.bind(e),t.processOnEnd=e.processOnEnd.bind(e),t.get=function(i){if(i===void 0)return t[0];for(var r=0,n=t.length;r<n;r+=1)if(t[r].identifier===i)return t[r];return!1}},qs.prototype.bindings=function(){var e=this;e.bindEvt(e.options.zone,"start"),e.options.zone.style.touchAction="none",e.options.zone.style.msTouchAction="none"},qs.prototype.begin=function(){var e=this,t=e.options;if(t.mode==="static"){var i=e.createNipple(t.position,e.manager.getIdentifier());i.add(),e.idles.push(i)}},qs.prototype.createNipple=function(e,t){var i=this,r=i.manager.scroll,n={},s=i.options,a=i.parentIsFlex?r.x:r.x+i.box.left,o=i.parentIsFlex?r.y:r.y+i.box.top;if(e.x&&e.y)n={x:e.x-a,y:e.y-o};else if(e.top||e.right||e.bottom||e.left){var l=document.createElement("DIV");l.style.display="hidden",l.style.top=e.top,l.style.right=e.right,l.style.bottom=e.bottom,l.style.left=e.left,l.style.position="absolute",s.zone.appendChild(l);var u=l.getBoundingClientRect();s.zone.removeChild(l),n=e,e={x:u.left+r.x,y:u.top+r.y}}var h=new E5e(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:t,position:e,zone:s.zone,frontPosition:{x:0,y:0},shape:s.shape});return s.dataOnly||(aj(h.ui.el,n),aj(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},qs.prototype.updateBox=function(){this.box=this.options.zone.getBoundingClientRect()},qs.prototype.bindNipple=function(e){var t,i=this,r=function(n,s){t=n.type+" "+s.id+":"+n.type,i.trigger(t,s)};e.on("destroyed",i.onDestroyed.bind(i)),e.on("shown hidden rested dir plain",r),e.on("dir:up dir:right dir:down dir:left",r),e.on("plain:up plain:right plain:down plain:left",r)},qs.prototype.pressureFn=function(e,t,i){var r=this,n=0;clearInterval(r.pressureIntervals[i]),r.pressureIntervals[i]=setInterval(function(){var s=e.force||e.pressure||e.webkitForce||0;s!==n&&(t.trigger("pressure",s),r.trigger("pressure "+t.identifier+":pressure",s),n=s)}.bind(r),100)},qs.prototype.onstart=function(e){var t=this,i=t.options,r=e;return e=WEe(e),t.updateBox(),c$(e,function(n){t.actives.length<i.maxNumberOfNipples?t.processOnStart(n):r.type.match(/^touch/)&&(Object.keys(t.manager.ids).forEach(function(s){if(Object.values(r.touches).findIndex(function(o){return o.identifier===s})<0){var a=[e[0]];a.identifier=s,t.processOnEnd(a)}}),t.actives.length<i.maxNumberOfNipples&&t.processOnStart(n))}),t.manager.bindDocument(),!1},qs.prototype.processOnStart=function(e){var t,i=this,r=i.options,n=i.manager.getIdentifier(e),s=e.force||e.pressure||e.webkitForce||0,a={x:e.pageX,y:e.pageY},o=i.getOrCreate(n,a);o.identifier!==n&&i.manager.removeIdentifier(o.identifier),o.identifier=n;var l=function(u){u.trigger("start",u),i.trigger("start "+u.id+":start",u),u.show(),s>0&&i.pressureFn(e,u,u.identifier),i.processOnMove(e)};if((t=i.idles.indexOf(o))>=0&&i.idles.splice(t,1),i.actives.push(o),i.ids.push(o.identifier),r.mode!=="semi")l(o);else{if(!(fN(a,o.position)<=r.catchDistance))return o.destroy(),void i.processOnStart(e);l(o)}return o},qs.prototype.getOrCreate=function(e,t){var i,r=this,n=r.options;return/(semi|static)/.test(n.mode)?(i=r.idles[0])?(r.idles.splice(0,1),i):n.mode==="semi"?r.createNipple(t,e):(console.warn("Coudln't find the needed nipple."),!1):i=r.createNipple(t,e)},qs.prototype.processOnMove=function(e){var t=this,i=t.options,r=t.manager.getIdentifier(e),n=t.nipples.get(r),s=t.manager.scroll;if((_=>isNaN(_.buttons)?_.pressure!==0:_.buttons!==0)(e)){if(!n)return console.error("Found zombie joystick with ID "+r),void t.manager.removeIdentifier(r);if(i.dynamicPage){var a=n.el.getBoundingClientRect();n.position={x:s.x+a.left,y:s.y+a.top}}n.identifier=r;var o=n.options.size/2,l={x:e.pageX,y:e.pageY};i.lockX&&(l.y=n.position.y),i.lockY&&(l.x=n.position.x);var u,h,d=fN(l,n.position),c=((_,b)=>{let x=b.x-_.x,w=b.y-_.y;return(S=>S*(180/Math.PI))(Math.atan2(w,x))})(l,n.position),p=sj(c),f=d/o,m={distance:d,position:l};if(n.options.shape==="circle"?(u=Math.min(d,o),h=((_,b,x)=>{let w={x:0,y:0};return x=sj(x),w.x=_.x-b*Math.cos(x),w.y=_.y-b*Math.sin(x),w})(n.position,u,c)):(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,n.position,o),u=fN(h,n.position)),i.follow){if(d>o){let _=l.x-h.x,b=l.y-h.y;n.position.x+=_,n.position.y+=b,n.el.style.top=n.position.y-(t.box.top+s.y)+"px",n.el.style.left=n.position.x-(t.box.left+s.x)+"px",d=fN(l,n.position)}}else l=h,d=u;var g=l.x-n.position.x,v=l.y-n.position.y;n.frontPosition={x:g,y:v},i.dataOnly||aj(n.ui.front,n.frontPosition);var y={identifier:n.identifier,position:l,force:f,pressure:e.force||e.pressure||e.webkitForce||0,distance:d,angle:{radian:p,degree:c},vector:{x:g/o,y:-v/o},raw:m,instance:n,lockX:i.lockX,lockY:i.lockY};(y=n.computeDirection(y)).angle={radian:sj(180-c),degree:180-c},n.trigger("move",y),t.trigger("move "+n.id+":move",y)}else this.processOnEnd(e)},qs.prototype.processOnEnd=function(e){var t=this,i=t.options,r=t.manager.getIdentifier(e),n=t.nipples.get(r),s=t.manager.removeIdentifier(n.identifier);!n||(i.dataOnly||n.hide(function(){i.mode==="dynamic"&&(n.trigger("removed",n),t.trigger("removed "+n.id+":removed",n),t.manager.trigger("removed "+n.id+":removed",n),n.destroy())}),clearInterval(t.pressureIntervals[n.identifier]),n.resetDirection(),n.trigger("end",n),t.trigger("end "+n.id+":end",n),t.ids.indexOf(n.identifier)>=0&&t.ids.splice(t.ids.indexOf(n.identifier),1),t.actives.indexOf(n)>=0&&t.actives.splice(t.actives.indexOf(n),1),/(semi|static)/.test(i.mode)?t.idles.push(n):t.nipples.indexOf(n)>=0&&t.nipples.splice(t.nipples.indexOf(n),1),t.manager.unbindDocument(),/(semi|static)/.test(i.mode)&&(t.manager.ids[s.id]=s.identifier))},qs.prototype.onDestroyed=function(e,t){var i=this;i.nipples.indexOf(t)>=0&&i.nipples.splice(i.nipples.indexOf(t),1),i.actives.indexOf(t)>=0&&i.actives.splice(i.actives.indexOf(t),1),i.idles.indexOf(t)>=0&&i.idles.splice(i.idles.indexOf(t),1),i.ids.indexOf(t.identifier)>=0&&i.ids.splice(i.ids.indexOf(t.identifier),1),i.manager.removeIdentifier(t.identifier),i.manager.unbindDocument()},qs.prototype.destroy=function(){var e=this;for(var t in e.unbindEvt(e.options.zone,"start"),e.nipples.forEach(function(i){i.destroy()}),e.pressureIntervals)Object.prototype.hasOwnProperty.call(e.pressureIntervals,t)&&clearInterval(e.pressureIntervals[t]);e.trigger("destroyed",e.nipples),e.manager.unbindDocument(),e.off(),e.pressureIntervals={},e.nipples=[],e.idles=[],e.actives=[],e.ids=[],e.manager=null};var A5e=qs;function ra(e){var t=this;t.ids={},t.index=0,t.collections=[],t.scroll=c0e(),t._windowBound=!1,t.config(e),t.prepareCollections();var i=function(){var r;t.collections.forEach(function(n){n.forEach(function(s){r=s.el.getBoundingClientRect(),s.position={x:t.scroll.x+r.left,y:t.scroll.y+r.top}})})};return t._onResize=function(){(r=>{mN.has(r)&&clearTimeout(mN.get(r)),mN.set(r,setTimeout(function(){mN.delete(r),r()},100))})(i)},t._onScroll=function(){t.scroll=c0e()},t.collections}ra.prototype=new cK,ra.constructor=ra,ra.prototype.prepareCollections=function(){var e=this;e.collections.create=e.create.bind(e),e.collections.on=e.on.bind(e),e.collections.off=e.off.bind(e),e.collections.destroy=e.destroy.bind(e),e.collections.get=function(t){var i;return e.collections.every(function(r){return!(i=r.get(t))}),i}},ra.prototype.create=function(e){return this.createCollection(e)},ra.prototype.bindWindowEvents=function(){var e=this;e._windowBound||typeof window>"u"||(e._windowBound=!0,u4(window,"resize",e._onResize),u4(window,"scroll",e._onScroll))},ra.prototype.unbindWindowEvents=function(){var e=this;!e._windowBound||typeof window>"u"||(e._windowBound=!1,d4(window,"resize",e._onResize),d4(window,"scroll",e._onScroll))},ra.prototype.createCollection=function(e){var t=this,i=new A5e(t,e);return t.bindCollection(i),t.collections.push(i),t.bindWindowEvents(),i},ra.prototype.bindCollection=function(e){var t,i=this,r=function(n,s){t=n.type+" "+s.id+":"+n.type,i.trigger(t,s)};e.on("destroyed",i.onDestroyed.bind(i)),e.on("shown hidden rested dir plain",r),e.on("dir:up dir:right dir:down dir:left",r),e.on("plain:up plain:right plain:down plain:left",r)},ra.prototype.bindDocument=function(){var e=this;e.binded||(e.bindEvt(document,"move").bindEvt(document,"end"),e.binded=!0)},ra.prototype.unbindDocument=function(e){var t=this;(!Object.keys(t.ids).length||e===!0)&&(t.unbindEvt(document,"move").unbindEvt(document,"end"),t.binded=!1)},ra.prototype.getIdentifier=function(e){var t;return e?(t=e.identifier===void 0?e.pointerId:e.identifier)===void 0&&(t=this.latest||0):t=this.index,this.ids[t]===void 0&&(this.ids[t]=this.index,this.index+=1),this.latest=t,this.ids[t]},ra.prototype.removeIdentifier=function(e){var t={};for(var i in this.ids)if(this.ids[i]===e){t.id=i,t.identifier=this.ids[i],delete this.ids[i];break}return t},ra.prototype.onmove=function(e){return this.onAny("move",e),!1},ra.prototype.onend=function(e){return this.onAny("end",e),!1},ra.prototype.oncancel=function(e){return this.onAny("end",e),!1},ra.prototype.onAny=function(e,t){var i,r=this,n="processOn"+e.charAt(0).toUpperCase()+e.slice(1);t=WEe(t);var s=function(a,o,l){l.ids.indexOf(o)>=0&&(l[n](a),a._found_=!0)};return c$(t,function(a){i=r.getIdentifier(a),c$(r.collections,s.bind(null,a,i)),a._found_||r.removeIdentifier(i)}),!1},ra.prototype.destroy=function(){var e=this;e.unbindDocument(!0),e.unbindWindowEvents(),e.ids={},e.index=0,e.collections.forEach(function(t){t.destroy()}),e.collections=[],e.off()},ra.prototype.onDestroyed=function(e,t){var i=this;if(i.collections.indexOf(t)<0)return!1;i.collections.splice(i.collections.indexOf(t),1),i.collections.length===0&&i.unbindWindowEvents()};var C5e=ra,Gx=null;function f0e(){return Gx||(Gx=new C5e),Gx}var R5e={create:function(e){return f0e().create(e)},destroy:function(){Gx&&(Gx.destroy(),Gx=null)},get factory(){return f0e()}},P5e=R5e;Hr(),Wt(),le(),Nh(),xl(),Wt();var KEe=null;function hj(){return KEe}var ZEe,uj,D5e=new Promise(e=>{ZEe=e});function N5e(e){return uj||(uj=async function(){let t=e??"https://cdn.spline.design/@splinetool/runtime@2.0.35/build",i=import("./physics.js"),[r,n]=await Promise.all([i,fetch(`${t}/physics.wasm`).then(s=>s.arrayBuffer())]);await r.init(n),ZEe(r)}(),uj)}function QEe(e){let t=e.elements,i=t[0]**2+t[1]**2+t[2]**2,r=t[4]**2+t[5]**2+t[6]**2,n=t[8]**2+t[9]**2+t[10]**2,s=t[0]**2+t[4]**2+t[8]**2,a=t[1]**2+t[5]**2+t[9]**2,o=t[2]**2+t[6]**2+t[10]**2,l=1e-8;return i<l||r<l||n<l||s<l||a<l||o<l}function nf(e,t){let i=new At;if(t&&QEe(t))return i.setAttribute("position",new Et([],3)),i.setIndex([]),i;if(!e.getAttribute("position"))return i.setAttribute("position",new Et([],3)),i.setIndex([]),i;let{positions:r,triIndices:n}=GX(e.getAttribute("position"),e.getIndex());return i.setAttribute("position",new Et(r,3)),i.setIndex(n),t&&i.applyMatrix4(t),i}rs(),xl(),_r(),nY(),le(),le(),xw(),DA();var Mr,I5e=class{constructor(e,t,i,r,n,s){this.id=e,this.data=t,this.object=i,this.initialDisabled=!1,this.actions=ua(t,t.actions,r,n,s,i),this.target=t.target}disconnect(){Za(this.actions)}dispatch(e){this.initialDisabled||(this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Collision"}),this.actions.Transition.forEach(t=>t.play()),this.actions.Animation.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.Reset.forEach(t=>{t.dispatch()}),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(e??!1)}),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.Audio.forEach(t=>{t.dispatchBasic()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()}),this.actions.Video.forEach(t=>{t.dispatchBasic()}),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch()))}},m0e=class{constructor(e,t,i,r,n,s){this.id=e,this.data=t,this.object=i,this.page=r,this.currentIntersectedObjects=[],this.actions=ua(t,t.actions,r,n,s,i),this.target=t.target,this.triggeringObjects=[];for(let a of t.triggeringObjects){let o=r.scene.find(a);o&&this.triggeringObjects.push(o)}}isValidTriggeringObject(e){return this.target==="all"||this.triggeringObjects.some(t=>t===e||t.isAncestorOf(e.uuid)||e.isAncestorOf(t.uuid))}disconnect(){Za(this.actions)}dispatch(){this.object.destroyedInAction||(this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Trigger"}),this.actions.Transition.forEach(e=>e.play()),this.actions.SwitchCamera.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.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(!1)}),this.actions.Audio.forEach(e=>{e.dispatchBasic()}),this.actions.Particles.forEach(e=>{e.dispatchBasic()}),this.actions.Video.forEach(e=>{e.dispatchBasic()}),this.actions.SceneTransition.forEach(e=>{e.dispatch()}),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch()))}};rs(),D5e.then(e=>Mr=e);var ia=new P,su=new jt,$m=new P,g0e=(new Kr(0,0,0,"YXZ"),new Kr(0,0,0,"XYZ")),Yu=new P,dj=new P,cj=new P(1,1,1),nb=new jt,gN=new Ve,v0e=new Ve,O5e={type:"updateMatrix"},y0e=new jt,pj=new qa,fj=.01,p$={type:"beginEvent",eventName:"Collision"},L5e={type:"beginEvent",eventName:"Trigger"},c4=e=>e.states.some(t=>t.data.position!==void 0||t.data.rotation!==void 0||t.data.hiddenMatrix!==void 0||t.data.cloner!==void 0||t.data.pathSnapping!==void 0);function sb(e){return function(t){return typeof t=="object"&&t!==null&&"booleanOp"in t}(Zv(e)?e.object:e)}var B5e=class{constructor(e){this.eventContext=e,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=t=>{if(t.bodyType()!==Mr.RigidBodyType.Dynamic)return;t.isSleeping()||this.nActiveRigidBodies++;let[i,r,n]=this.rigidBodyToMesh.get(t.handle);if(ia.copy(t.translation()).multiplyScalar(this.pixelsPerMeter),su.copy(t.rotation()),i.matrixWorld.compose(ia,su,r),i.hasNonUniformScale&&i.matrixWorld.multiply(i.shearScale),i.dispatchEvent(O5e),n){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=(t,i,r)=>{if(r===!1)return;let n,s;if(this.sensorToTriggerEvent[t]?(n=this.sensorToTriggerEvent[t],s=this.sharedGameControlGlobals.colliderToEntity.get(i)):this.sensorToTriggerEvent[i]&&(n=this.sensorToTriggerEvent[i],s=this.sharedGameControlGlobals.colliderToEntity.get(t)),n&&s&&n.isValidTriggeringObject(s))n.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===t||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(t)){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(t),o=this.sharedGameControlGlobals.entityToCollisionEvents[a.uuid];if(o===void 0)return;for(let l of o)l.data.target==="character"&&this.dispatchCollisionEvent(l,a,t)}else{let a=this.sharedGameControlGlobals.colliderToEntity.get(t),o=this.sharedGameControlGlobals.entityToCollisionEvents[a.uuid];if(o!==void 0)for(let h of o)h.data.target==="scene"&&this.dispatchCollisionEvent(h,a,t);let l=this.sharedGameControlGlobals.colliderToEntity.get(i),u=this.sharedGameControlGlobals.entityToCollisionEvents[l?.uuid];if(u!==void 0)for(let h of u)h.data.target==="scene"&&this.dispatchCollisionEvent(h,l,i)}}},this.isExport=e.isExport,this.sharedAssets=e.sharedAssets,this.renderer=e.renderer,this.requestRender=e.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(e=>{let t=e.dataPatched;for(let i of t.events){if(i.data.disabled===!0)continue;let r=i.data.actions?.find(n=>n.data.type==="Destroy")?.data;if(r)for(let n of r.objects){let s=this.page.scene.find(n);s&&(s.userData.hasDestroy=!0)}}})}markIsDragObject(){this.page.traverseVisibleEntity(e=>{let t=e.dataPatched;for(let i of t.events)if(i.data.disabled!==!0&&i.data.type==="DragDrop")for(let r of i.data.objects){let n=this.page.scene.find(r);n&&(n.userData.hasDrag=!0)}})}_staticBVHIdOf(e){let t=this._staticBVHAttrIds.get(e);return t===void 0&&(t=this._staticBVHNextAttrId++,this._staticBVHAttrIds.set(e,t)),t}initBVH(){if(hj()===null)return void Ma("collision-bvh","trigger/collision detection");let e=[],t=[];if(this.page.traverseChildren(i=>{let r,n=i instanceof Dx,s=_E(i);if(ix(i)||n||s)return;r=Zv(i)?i.object:i;let a=r.dataPatched;if(a.physics?.enabled==="visibility"?!a.visible:!a.physics?.enabled)return!0;let o=i.geometry,l=r.userData.hasDestroy===!0,u=r.userData.hasDrag===!0;if(c4(a)||l||u||r.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){e.push({geometry:o,matrixWorld:i.matrixWorld}),t.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)t.push(d)}}return!!sb(i)||void 0}),e.length>0){let i=this._staticBVHCache;if(i!==void 0&&i.signature.length===t.length&&i.signature.every((s,a)=>s===t[a]))return void(this.sharedGameControlGlobals.staticMeshBVH=i.bvh);let r=Kv(e.map(s=>nf(s.geometry,s.matrixWorld)),!1),n=new(hj())(r);this._staticBVHCache={signature:t,bvh:n},this.sharedGameControlGlobals.staticMeshBVH=n}}addRigidBody(e,t,i){if(QEe(e.matrixWorld))return;let r=[],n="geometry"in e?e.geometry:void 0,s=t.dataPatched;if(n?.getAttribute("position")!==void 0&&r.push(nf(n,e.shearScale)),s.physics.fusedBody){let a=this.gatherChildrenGeom(e,r);e.traverseObject(a),e.children.forEach(l=>l.updateMatrixWorld(!0));let o=e.cloner;o&&o.objectForSample===void 0&&s.physics.rigidBody==="dynamic"&&(o.traverseObject(a),o.children.forEach(l=>l.updateMatrixWorld(!0)))}if(r.length>0){let a,o=!1,l=!i.fromCreate&&s.physics.rigidBody==="dynamic"||i.fromCreate&&i.dynamic;l?(a=Mr.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=Mr.RigidBodyDesc.kinematicPositionBased(),o=!0):a=Mr.RigidBodyDesc.fixed();let u=Kv(r);(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).decompose(ia,su,$m),e.position0=ia.clone().divideScalar(this.pixelsPerMeter),e.rotation0=su.clone(),ia.divideScalar(this.pixelsPerMeter),a.setTranslation(ia.x,ia.y,ia.z).setRotation(su),n?u?.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter):u?.scale($m.x/this.pixelsPerMeter,$m.y/this.pixelsPerMeter,$m.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,u,t,d)}catch{try{this.addCollider(h,s.physics,u,t,!1)}catch(c){console.error(c)}}if(h.numColliders()===0)return void this.sharedGameControlGlobals.rapierWorld.removeRigidBody(h);l?this.rigidBodyToMesh.set(h.handle,[e,$m.clone(),s.physics.fusedBody]):o?(this.sharedGameControlGlobals.kinematicBodyToEntity.set(h.handle,e),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e)):this.fixedBodiesToWatch.push([e,h,(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).clone()]),e.rigidBody=h}}addBoundsTree(e){let t=[];if(e.geometry?.getAttribute("position")!==void 0&&e.geometry?.getAttribute("position").count>0&&t.push(nf(e.geometry,e.shearScale)),e.traverseObject(this.gatherChildrenGeom(e,t)),e.children.forEach(i=>i.updateMatrixWorld(!0)),t.length>0){let i=Kv(t,!1);e.bvhGeometry=i,i.getAttribute("position").count>0&&(e.bvhGeometry.boundsTree=new(hj())(i),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e))}}addCollider(e,t,i,r,n=!0){if(i?.getAttribute("position").count===0||i?.getIndex()?.count===0)return;let s;i&&(s=t.colliderType==="trimesh"?Mr.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array):Mr.ColliderDesc.convexMesh(i.getAttribute("position").array,n?i.getIndex().array:void 0)),s.setFrictionCombineRule(Mr.CoefficientCombineRule.Average).setRestitutionCombineRule(Mr.CoefficientCombineRule.Average).setDensity(t.density).setFriction(t.friction).setRestitution(t.restitution);let a=this.sharedGameControlGlobals.rapierWorld.createCollider(s,e);this.sharedGameControlGlobals.colliderToEntity.set(a.handle,r),this.sharedGameControlGlobals.entityToCollisionEvents[r.uuid]?.some(o=>o.target==="scene")&&a.setActiveEvents(Mr.ActiveEvents.COLLISION_EVENTS)}gatherChildrenGeom(e,t){let i=sb(e);return(r,n)=>{if(n===0)return;if(i&&r.parent===e)return!0;let s;if(ix(r)){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(Zv(r))s=r.object;else if(s=r,s.dataPatched.cloner?.hideBase)return!0;let a=s.dataPatched;if(a.physics.enabled==="visibility"?!a.visible:!a.physics.enabled)return!0;n===1?e.hasNonUniformScale?r.matrixWorld.multiplyMatrices(e.shearScale,r.hiddenMatrix):r.matrixWorld.copy(r.hiddenMatrix):r.matrixWorld.multiplyMatrices(r.parent.matrixWorld,r.hiddenMatrix),r.matrixWorld.multiply(r.matrix);let o=r.geometry;return o?.getAttribute("position")!==void 0&&t.push(nf(o,r.matrixWorld)),!!sb(r)||void 0}}activate(e){if(this.isEnabled)return;this.isEnabled=!0,this.eventManager=e,this.usePhysics=this.page.data.globalPhysics.usePhysics;let t=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 r=d0e();if(r!==null?i=r.setup({manager:this,camera:t,renderer:this.renderer,sharedAssets:this.sharedAssets,eventContext:this.eventContext,isExport:this.isExport})||i:this.page.data.publish.gameControlObject!==null&&Ma("game-controls","the scene's game controls"),i===!1){let{enableRotate:a,enablePan:o,enableZoom:l,autoRotate:u,hoverRotatePanMode:h}=this.eventManager.publish.orbitControls;(a||o||l||u||h!==0)&&(this.orbitControls=new REe(t,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 n=this.renderer.domElement.width/this.renderer.getPixelRatio(),s=this.renderer.domElement.height/this.renderer.getPixelRatio();d0e()?.createJoysticks(this,n,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 Mr.World(new Mr.Vector3(0,this.gravity,0)),this.events=new Mr.EventQueue(!0);let e=[],t=[];if(this.page.traverseChildren(a=>{let o;if(ix(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(Zv(a))o=a.object;else{if(_E(a)||Qy(a)||a instanceof Dx)return;if(o=a,o.dataPatched.cloner?.disabled===!1&&o.dataPatched.cloner?.hideBase&&o.dataPatched.physics?.fusedBody!==!0)return!0}let l,u=o.dataPatched;for(let g of u.events)g.data.disabled!==!0&&g.data.type==="GameControl"&&(l=g.data);if(!u.physics||(u.physics.enabled==="visibility"?!u.visible:!u.physics.enabled))return!0;a.updateMatrixWorldRigid();let h=c4(u),d=!1,c=o.userData.hasDestroy,p=o.userData.hasDrag,f=!1;for(let g of u.events)if(g.data.disabled!==!0){if(g.data.type==="Collision"){d=!0;let v=new I5e(g.id,g.data,o,this.page,this.sharedAssets,this.eventManager);v.initialDisabled=!0,this.collisionEvents.push(v),this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid]&&this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid].every(y=>y.id!==g.id)?this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid].push(v):this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid]=[v]}else if(g.data.type==="Follow"){f=!0;let v=g.data.target;a.traverseVisible(y=>{y.userData.isFollowingObj=v})}}u.physics.rigidBody==="dynamic"&&u.physics.fusedBody===!1&&(a.matrixWorldFusedFalse=a.matrixWorld.clone());let m=a.geometry;if(l!==void 0){let g=Mr.RigidBodyDesc.kinematicPositionBased();(a.hasNonUniformScale?a.matrixWorldRigid:a.matrixWorld).decompose(ia,su,$m),a.position0=ia.clone().divideScalar(this.pixelsPerMeter),a.rotation0=su.clone(),ia.divideScalar(this.pixelsPerMeter),g.setTranslation(ia.x,ia.y,ia.z).setRotation(su);let v,y=this.sharedGameControlGlobals.rapierWorld.createRigidBody(g);a.rigidBody=y,v=l.collider.type==="sphere"?Mr.ColliderDesc.ball(l.collider.radius/this.pixelsPerMeter):l.collider.type==="capsule"?Mr.ColliderDesc.capsule((l.collider.height/2-l.collider.radius)/this.pixelsPerMeter,l.collider.radius/this.pixelsPerMeter):Mr.ColliderDesc.cuboid(l.collider.width/this.pixelsPerMeter/2,l.collider.height/this.pixelsPerMeter/2,l.collider.depth/this.pixelsPerMeter/2),v.setFrictionCombineRule(Mr.CoefficientCombineRule.Average).setDensity(u.physics.density).setFriction(u.physics.friction).setRestitution(0).setRestitutionCombineRule(Mr.CoefficientCombineRule.Min);let _=this.sharedGameControlGlobals.rapierWorld.createCollider(v,y);this.sharedGameControlGlobals.colliderToEntity.set(_.handle,o),ia.fromArray(l.collider.position.map(x=>typeof x=="number"?x:0)).multiply($m.setFromMatrixScale(o.matrixWorld)).divideScalar(this.pixelsPerMeter),_.setTranslationWrtParent(ia);let b=new jt().setFromEuler(new Kr().setFromVector3(new P().fromArray(l.collider.rotation.map(x=>typeof x=="number"?x:0))));_.setRotationWrtParent(b),_.setActiveEvents(Mr.ActiveEvents.COLLISION_EVENTS),this.generateSensorColliderDescs(o,!0)}else u.physics.rigidBody==="dynamic"||h||f||c||p||d?(this.addRigidBody(a,o,{hasFollow:f,hasTransformAnim:h,hasDrag:p}),this.generateSensorColliderDescs(o,u.physics.fusedBody)):(m&&e.push(nf(m,a.matrixWorld)),u.physics.fusedBody&&!sb(a)&&a.traverseObject((g,v)=>{if(v===0)return;let y;if(ix(g)){if(!g.objectForSample)return g.object.dataPatched.physics.fusedBody===!0&&g.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(g.objectForSample.dataPatched.physics.fusedBody)return;y=g.object}else{if(_E(g)||Qy(g)||g instanceof Dx)return;if(Zv(g))y=g.object;else if(y=g,y.dataPatched.cloner?.hideBase)return!0}let _=y.dataPatched;if(_.physics.enabled==="visibility"?!_.visible:!_.physics.enabled)return!0;let b=g.geometry;return b?.getAttribute("position")!==void 0&&e.push(nf(b,g.matrixWorld)),!!sb(g)||void 0}),this.generateSensorColliderDescs(o,u.physics.fusedBody,t));return!(u.physics?.fusedBody!==!0&&!l&&!sb(a))||void 0}),e.length===0)return;let i=Kv(e),r=i.getIndex().count>0;if(!r&&t.length===0)return;i.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter);let n=Mr.RigidBodyDesc.fixed(),s=this.sharedGameControlGlobals.rapierWorld.createRigidBody(n);if(r){let a=Mr.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array).setFrictionCombineRule(Mr.CoefficientCombineRule.Multiply).setRestitutionCombineRule(Mr.CoefficientCombineRule.Multiply).setFriction(1).setRestitution(1);this.sharedGameControlGlobals.rapierWorld.createCollider(a,s)}for(let[a,o]of t){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(e=>{for(let t of e.dataPatched.events)if(t.data.type==="Trigger"&&t.data.disabled!==!0){let i=new m0e(t.id,t.data,e,this.page,this.sharedAssets,this.eventManager),r=new Ve().compose(Yu.fromArray(t.data.position.map(n=>typeof n=="number"?n:0)),nb.setFromEuler(g0e.fromArray(t.data.rotation.map(n=>typeof n=="number"?n:0))),cj);if(t.data.triggerZone==="box"){let n=new fn;n.min.fromArray(t.data.size.map(s=>typeof s=="number"?s:0)).multiplyScalar(-.5),n.max.fromArray(t.data.size.map(s=>typeof s=="number"?s:0)).multiplyScalar(.5),this.sharedGameControlGlobals.triggers.push([n,r,e,i])}else this.sharedGameControlGlobals.triggers.push([t.data.radius,r,e,i])}}),this.needsCollisionDetection&&this.initBVH())}disconnectEvents(){this.collisionEvents.forEach(e=>e.disconnect()),this.sharedGameControlGlobals.triggers.forEach(e=>e[3].disconnect()),this.sharedGameControlGlobals.triggers.length=0}deactivate(){if(this.isEnabled){this.isEnabled=!1,this.page.traverse(e=>{let t=e;t.matrixWorldFusedFalse&&(t.matrixWorldFusedFalse=void 0),t.rigidBody&&(t.rigidBody=void 0),t.position0&&(t.position0=void 0),t.rotation0&&(t.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(([e,t])=>{e?.destroy(),t.remove()}),this.joystickToGameControls=[],this.joysticks=[],this.orbitControls&&(this.orbitControls.dispose(),this.orbitControls=void 0),this.navigationMeshWrapper?.dispose(),this.navigationMeshWrapper=void 0;for(let e of Object.values(this.sharedGameControlGlobals.entityToCollisionEvents))e.forEach(t=>t.disconnect());this.sharedGameControlGlobals.entityToCollisionEvents={},this.page.updateMatrixWorld(!0)}}update(e){if(!this.isEnabled)return!0;let t=!0;if(this.orbitControls!==void 0&&this.orbitControls.needsUpdate&&(this.orbitControls.update(),t=!this.orbitControls.isCurrentlyDamping),this.initializationCounter>=0&&this.initializationCounter<2?(this.initializationCounter++,t=!1):this.initializationCounter===2&&this.gameControl&&(t=!this.gameControl.update(e)&&t),this.usePhysics===!1&&this.checkTrigger(),this.usePhysics){let i=.016666666666666666;if(e===0)t=this.stepPhysics()&&t;else{let r=e/1e3;r<i&&r>.55*i&&(r=i),this.accumulator+=r;let n=performance.now(),s=0,a=6;for(;this.accumulator>=i&&s<a&&(t=this.stepPhysics()&&t,this.accumulator-=i,s++,!(performance.now()-n>1e3*i)););this.accumulator=this.accumulator%i}}this.skipRender=t}recordPhysicsPose(e){(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).decompose(ia,su,$m);let t=e;t.prevQ===void 0?(t.prevQ=su.clone(),t.prevT=ia.clone()):(t.prevQ.copy(su),t.prevT.copy(ia))}promoteMovedFixedBodies(){for(let e=this.fixedBodiesToWatch.length-1;e>=0;e--){let[t,i,r]=this.fixedBodiesToWatch[e];(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).equals(r)||(i.setBodyType(Mr.RigidBodyType.KinematicPositionBased,!0),this.sharedGameControlGlobals.kinematicBodyToEntity.set(i.handle,t),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t),this.fixedBodiesToWatch.splice(e,1))}}clampPushedBodies(){let e=this.gameControl?.object.rigidBody;if(e===void 0)return;let t=this.sharedGameControlGlobals.rapierWorld,i=e.linvel(),r=e.translation(),n=Math.hypot(i.x,i.z);for(let s=0;s<e.numColliders();s++){let a=e.collider(s);t.contactPairsWith(a,o=>{let l=o.parent();if(l===null||!l.isDynamic())return;let u=l.translation(),h=-1/0,d=0,c=0;if(t.contactPair(a,o,v=>{let y=v.normal(),_=y.x*(u.x-r.x)+y.y*(u.y-r.y)+y.z*(u.z-r.z)<0?-1:1;if(Math.abs(y.y)>.7)return;let b=_*y.x,x=_*y.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,c=x/w)}),h===-1/0)return;let p=i.x*d+i.z*c;if(p<-fj)return;let f=l.linvel();if(n>fj&&p>fj){let v=f.x*d+f.z*c;if(v<=0)return;let y=Math.min(v,p);return void l.setLinvel({x:d*y,y:f.y,z:c*y},!0)}let m=f.x*d+f.z*c-Math.max(0,p);if(m<=0)return;let g=.5*m;l.setLinvel({x:f.x-d*g,y:f.y,z:f.z-c*g},!0)})}}stepPhysics(){this.promoteMovedFixedBodies();for(let e of this.sharedGameControlGlobals.kinematicBodyToEntity.values())this.recordPhysicsPose(e),e.rigidBody.setNextKinematicTranslation(ia.divideScalar(this.pixelsPerMeter)),e.rigidBody.setNextKinematicRotation(su);for(let e of this.sharedGameControlGlobals.entitiesWithTransformAnim)e.rigidBody?.isKinematic()!==!0&&this.recordPhysicsPose(e);return this.sharedGameControlGlobals.rapierWorld.step(this.events),this.clampPushedBodies(),this.events?.drainCollisionEvents(this.handleCollisionEvents),!this.updatePositions()}dispatchCollisionEvent(e,t,i){let r,n=(this.sharedGameControlGlobals.rapierWorld?.getCollider(i))._parent;if(t.cloner){for(let s of t.cloner.children)if(s.rigidBody===n){r=s;break}}e.dispatch(r),t.dispatchEvent(p$)}updateUseWindowEvents(e){this.orbitControls?.updateUseWindowEvents(e)}generateSensorColliderDescs(e,t,i){let r=v0e.copy(e.matrixWorld).invert();e.traverseEntity((n,s)=>{if(t===!1&&s===1)return!0;for(let a of n.dataPatched.events)if(a.data.type==="Trigger"&&a.data.disabled!==!0){let o,l=new m0e(a.id,a.data,n,this.page,this.sharedAssets,this.eventManager);if(o=a.data.triggerZone==="box"?Mr.ColliderDesc.cuboid(...a.data.size.map(u=>(typeof u=="number"?u:1)/(2*this.pixelsPerMeter))):Mr.ColliderDesc.ball(a.data.radius/this.pixelsPerMeter),o.setDensity(0).setSensor(!0).setActiveEvents(Mr.ActiveEvents.COLLISION_EVENTS),Yu.fromArray(a.data.position.map(u=>typeof u=="number"?u:0)),nb.setFromEuler(g0e.fromArray(a.data.rotation.map(u=>typeof u=="number"?u:0))),gN.compose(Yu,nb,cj).premultiply(n.matrixWorld),i?(gN.decompose(Yu,nb,dj),o.setActiveCollisionTypes(Mr.ActiveCollisionTypes.KINEMATIC_FIXED|Mr.ActiveCollisionTypes.DYNAMIC_FIXED)):(gN.premultiply(r).decompose(Yu,nb,dj),e.rigidBody.bodyType()===Mr.RigidBodyType.Dynamic||(e.rigidBody.bodyType()===Mr.RigidBodyType.Fixed?o.setActiveCollisionTypes(Mr.ActiveCollisionTypes.KINEMATIC_FIXED|Mr.ActiveCollisionTypes.DYNAMIC_FIXED):o.setActiveCollisionTypes(Mr.ActiveCollisionTypes.KINEMATIC_KINEMATIC|Mr.ActiveCollisionTypes.DYNAMIC_KINEMATIC))),Yu.divideScalar(this.pixelsPerMeter),o.setTranslation(Yu.x,Yu.y,Yu.z),o.setRotation(nb),i)i.push([o,l]);else{let u=this.sharedGameControlGlobals.rapierWorld.createCollider(o,e.rigidBody);this.sensorToTriggerEvent[u.handle]=l}}})}checkTrigger(){let e;for(let t=0;t<this.sharedGameControlGlobals.triggers.length;t++){let[i,r,n,s]=this.sharedGameControlGlobals.triggers[t];for(let a=0;a<this.sharedGameControlGlobals.entitiesWithTransformAnim.length;a++){let o=this.sharedGameControlGlobals.entitiesWithTransformAnim[a];if(n===o||s.isValidTriggeringObject(hr.is(o)?o:o.object)===!1)continue;let l=v0e.copy(n.matrixWorld).decompose(Yu,y0e,dj).compose(Yu,y0e,cj).multiply(r),u=gN.copy(o.matrixWorld).invert().multiply(l),h=o.bvhGeometry.boundsTree;i instanceof fn?e=h.intersectsBox(i,u):(pj.radius=i,pj.center.setFromMatrixPosition(u),e=h.intersectsSphere(pj)),e?s.currentIntersectedObjects.indexOf(o)===-1&&(s.currentIntersectedObjects.push(o),s.dispatch(),n.dispatchEvent(L5e)):s.currentIntersectedObjects=s.currentIntersectedObjects.filter(d=>d!==o)}}}};Sw(),le(),gL(),Nr(),$f();var mj=.02,_0e=new P,b0e=new P,U5e=new P,Go=new P,Up=new P,ab=new P,gj=new Ve,x0e=new Ve,F5e=new Ve,mh=new jt,bv=new jt,ob=new Kr(0,0,0,"YXZ"),z5e=new P(1,0,0),dc=new P(0,1,0),k5e=new P(0,0,1),w0e=new P(1,1,1),S0e=[],T0e=e=>S0e[e]??(S0e[e]=new P),vj=new P,V5e=new P,G5e=new P,j5e=new P,M0e=new jt,H5e=new P,E0e=new jt,ka=new Eh,au=new fn,W5e={type:"requestRender"},q5e={type:"updateMatrix"},f$=class extends xs{constructor(e,t,i,r,n,s,a,o,l){super(),this.object=e,this.domElement=t,this.data=i,this.gloabalPhysics=r,this.controlsManager=n,this.cameraFollow=s,this.camera=a,this.page=o,this.sharedAssets=l,this.enableDamping=!0,this.hiddenMatrix0=new Ve,this.target0=new P,this.zoom0=1,this.rotForce=1,this.moveForce=1,this.pixelsPerMeter=200,this.euler0=new Kr(0,0,0,"YXZ"),this.position0Cam=new P,this.quat0Cam=new jt,this.scale0Cam=new P,this.hiddenMatrix0Cam=new Ve,this.threshEndTranslate=.01,this.threshEndRotate=1e-8,this.threshEndRotVel=.005,this.collider={type:"capsule",radius:40,segment:new Eh(new P(0,-40,0),new P(0,40,0)),matrix:new Ve,position:new P,rotation:new jt},this.euler=new Kr(0,0,0,"YXZ"),this.eulerDelta=new P,this.lastPosition=new P,this.lastCameraQuaternion=new jt,this.lastCameraPosition=new P,this.PI_2=Math.PI/2,this.prevMouse=new J,this.velocityTarget=new P,this.velocity=new P,this.directionXZ=new P,this.rotVelocityStick=new P,this.rotVelocityTarget=new P,this.rotVelocity=new P,this.rotDirection=new P,this.nonColliderRotOffset=new Ve,this.nonColliderPosOffset=new Ve,this.firstPointerId=-1,this.rot=new P,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 Ve,this.objectToTarget=new P,this.objectToTarget0=new P,this.objectToCamXZ=new P,this.objectToCamXZ0=new P,this.targetToCamera=new P,this.targetToCamera0=new P,this.cameraPolarAxis0=new P,this.targetPos=new P,this.targetQuat=new jt,this.lerpFactorPos=new P().setScalar(.3),this.lerpFactorPosStart=.3,this.lerpFactorPosEnd=.3,this.lerpFactorRotStart=.3,this.lerpFactorRotEnd=.3,this.lerpFactorPosCamera=.3,this.lerpFactorRotCamera=.3,this.objXZQuat=new jt,this.objXZQuatInv=new jt,this.objXZRotMat=new Ve,this.isFirstPerson=!1,this.didHit=!1,this.groundVelocity=new P,this.pushedVelocity=new P,this.groundYRotation=0,this.objectRealQuat=new jt,this.colliderWorldQuat=new jt,this.groundNormal=new P,this.groundTilt=new jt,this.groundTiltInv=new jt,this.lastHitObj=null,this.isFirstFrame=!0,this.rotationAccumWhenOrientWithCamera=0,this.navMeshPathDest=null,this.position=new P,this.quaternion=new jt,this.scale=new P,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"&&!Kl&&!R7&&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 m=f.clientX-this.prevMouse.x,g=f.clientY-this.prevMouse.y;this.prevMouse.set(f.clientX,f.clientY),f.pointerType==="mouse"&&this.rotBy!=="keys"&&(R7&&a1e<15.5&&!Kl?(this.eulerDelta.y=-m*this.mouseOrbitSensitivity,this.eulerDelta.x=-g*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=-m*this.mouseOrbitSensitivity*5,this.eulerDelta.x=-g*this.mouseOrbitSensitivity*5),this.controlsManager.requestRender()},this.onPointerlockChange=f=>{this.domElement.ownerDocument.pointerLockElement===this.domElement?f$.isLocked=!0:f$.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 m of this.keyAssignments)if(f.key.toUpperCase()===m[1]||f.key===m[1]){this.movementState[m[0]]=1;break}this.controlsManager.requestRender()},this.onKeyUp=f=>{for(let m of this.keyAssignments)if(f.key.toUpperCase()===m[1]||f.key===m[1]||f.code.slice(3,f.code.length).toUpperCase()===m[1]){this.movementState[m[0]]=0;break}},this.copyVRGamePadValues=(f,m)=>{for(let g=2;g<4;g++){let v=f.axes[g];m===0?g===2?this.movementState.movePosX=v:this.movementState.movePosZ=v:(f.buttons[3].pressed?this.movementState.jump=1:this.movementState.jump=0,g===2?this.movementState.rotPosY=v:this.moveMode==="fly"&&(this.movementState.moveNegY=v))}},this.sharedGameControlGlobals=n.sharedGameControlGlobals,e===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 u=this.euler0.clone(),h=u.y;if(this.objectRealQuat.copy(this.quaternion),u.y=0,this.quaternion.setFromEuler(u),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),u.set(0,h,0),this.quaternion.setFromEuler(u),this.rot.setFromEuler(u),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,m=new P(0,0,-1).applyQuaternion(this.camera.quaternion),g=new P().subVectors(this.position,this.camera.position);this.objectToCamXZ.copy(g),this.objectToCamXZ.y=0,this.objectToCamXZ0.copy(this.objectToCamXZ),Math.abs(m.y)<1e-6?(g.y=0,m.y=0,f=g.projectOnVector(m)):f=g.y/m.y>0?m.multiplyScalar(g.y/m.y):m.multiplyScalar(g.length()),this.targetToCamera0.copy(f).negate();let v=this.camera.position.clone().add(f);this.objectToTarget0.subVectors(v,this.position);let y=new Kr().setFromQuaternion(this.camera.quaternion,"YXZ");this.cameraPolarOffset=-y.x,y.x=0,y.z=0,y.y-=Math.PI/2,this.cameraPolarAxis0.set(0,0,-1).applyEuler(y)}if(this.object instanceof us&&(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 m=[f[0],f[1]];return m[1]==="\u25B2"?m[1]="ArrowUp":m[1]==="\u25C0"?m[1]="ArrowLeft":m[1]==="\u25BC"?m[1]="ArrowDown":m[1]==="\u25B6"?m[1]="ArrowRight":m[1]==="\u21E7"?m[1]="Shift":m[1]==="\u21B5"?m[1]="Enter":m[1]==="Space"?m[1]=" ":m[1]==="\u2318"?m[1]="Meta":m[1]==="Ctrl"?m[1]="Control":m[1]==="Esc"&&(m[1]="Escape"),m}),i.rotBy==="mouse"){let f;f=this.keyAssignments.findIndex(m=>m[0]==="rotNegX"),f!==-1&&(this.keyAssignments[f][1]=""),f=this.keyAssignments.findIndex(m=>m[0]==="rotPosX"),f!==-1&&(this.keyAssignments[f][1]=""),f=this.keyAssignments.findIndex(m=>m[0]==="rotPosY"),f!==-1&&(this.keyAssignments[f][1]=""),f=this.keyAssignments.findIndex(m=>m[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??Mx.defaultData.gravity),this.usePhysics=this.gloabalPhysics.usePhysics??Mx.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??lL.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*mj/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*mj/this.pixelsPerMeter,this.stepThresh=2*i.collider.radius*.3/this.pixelsPerMeter,this.colliderHeight=2*i.collider.radius):(this.offset=i.collider.height*mj/this.pixelsPerMeter,this.stepThresh=.3*i.collider.height/this.pixelsPerMeter,this.colliderHeight=i.collider.height),this.collider.type=i.collider.type;let d=new P().fromArray(i.collider.position.map(f=>typeof f=="number"?f:0)),c=new jt().setFromEuler(new Kr().fromArray([...i.collider.rotation.map(f=>typeof f=="number"?f:0),"XYZ"]));this.collider.position.copy(d).multiply(this.scale),this.collider.rotation.copy(c),this.collider.matrix.compose(d,c,w0e),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 Nt;f.push({fi:0,data:{...os.defaultData("light","phong"),alpha:0},id:"layer1"}),f.push({fi:0,data:{...os.defaultData("color"),color:i.navmesh.destinationHelperColor,alpha:i.navmesh.destinationHelperColor.a},id:"layer2"});let m=Tbe({layers:f},{scene:this.page.scene,shared:this.sharedAssets});this.navMeshPathDest=new Cr(BX.create({parameters:{width:p,height:p/10,hollow:.7}}),m),this.navMeshPathDest.material.userData.opacity0=i.navmesh.destinationHelperColor.a}this.activate()}reset(e=!1){if(this.object.hiddenMatrix.copy(this.hiddenMatrix0),e){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 t=new Kr().setFromQuaternion(this.quaternion,"YXZ"),i=t.y;this.objectRealQuat.copy(this.quaternion),t.y=0,this.quaternion.setFromEuler(t),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),t.set(0,i,0),this.quaternion.setFromEuler(t),this.rot.setFromEuler(t),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.velocityTarget.set(0,0,0),this.velocity.set(0,0,0)}else this.object instanceof us?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 e=this.data,t=this.sharedAssets;e.gameActions!==void 0&&(this.actions={},oL.list.forEach(i=>{this.actions[i]=ua({...e,disabled:!1,type:"GameControl"},e.gameActions[i],this.page,t,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"),Za(this.actions.idle),Za(this.actions.move),Za(this.actions.run),Za(this.actions.jump)}dispatchStartEvent(e){this.actions[e]!==void 0&&(this.actionState[e]||(this.actionState[e]=!0,this.actions[e].Transition.forEach(t=>{t.play()}),this.actions[e].Animation.forEach(t=>{t.play(this.initialAction===!1)}),this.actions[e].TimelineAnimation.forEach(t=>{t.play()}),this.actions[e].Create.forEach(t=>{t.dispatchStart()}),this.actions[e].Audio.forEach(t=>{t.dispatchGameControl("start")}),this.actions[e].Particles.forEach(t=>{t.dispatchGameControl("start")})))}dispatchStopEvent(e){this.actions[e]!==void 0&&(!this.actionState[e]||(this.actionState[e]=!1,this.actions[e].Transition.forEach(t=>{t.stop(),t.object.currentState!==null&&t.object.changeSelectedState(null,{scene:this.page.scene,shared:this.sharedAssets})}),this.actions[e].TimelineAnimation.forEach(t=>{t.stop()}),this.actions[e].Create.forEach(t=>{t.dispatchStop()}),this.actions[e].Audio.forEach(t=>{t.dispatchGameControl("stop")}),this.actions[e].Particles.forEach(t=>{t.dispatchGameControl("stop")})))}get colliderWorldPosition(){return Go.copy(this.collider.position).applyQuaternion(this.objectRealQuat).add(this.position)}update(e){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 t=(this.isFirstFrame?16.6:e)/1e3;this.isFirstFrame&&(this.isFirstFrame=!1);let i=60*t,r=!1;if(this.groundYRotation=0,this.groundVelocity.set(0,0,0),this.usePhysics&&this.collisionEnabled&&this.object.rigidBody?.collider(0).shape){let s=Up.set(0,(this.velocity.y===0?this.pixelsPerMeter*Math.max(Math.abs(this.gravity)/120,1)*(this.gravity>0?1:-1):this.velocity.y)*t,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&&(r=!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,u=l===null?void 0:this.sharedGameControlGlobals.kinematicBodyToEntity.get(l.handle);if(l!==null&&u?.userData.isFollowingObj!==this.object.uuid){let h=this.object.getWorldPosition(Go).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*t}}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=Go.subVectors(this.path[1],this.position),o=Up.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 n=U5e.copy(this.velocity);if(this.orientMode!=="none"&&this.isFirstPerson===!1){let s=Up.copy(n);s.y=0,n.set(0,n.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=Go;this.camera.getWorldDirection(s);let a=ab.copy(dc).multiplyScalar(s.dot(dc));s.sub(a);let o=Up.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(ob.setFromVector3(this.rot),this.moveMode==="walk"&&(ob.x=0),n.applyEuler(ob),r&&(bv.setFromUnitVectors(dc,this.groundNormal),n.applyQuaternion(bv)),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(vj,M0e,V5e);let o=this.object.getWorldPosition(G5e).add(this.collider.position).sub(vj);E0e.copy(a.prevQ).invert().premultiply(M0e);let l=ab.subVectors(vj,a.prevT).add(j5e.copy(o).applyQuaternion(E0e).sub(o)).divideScalar(t).divideScalar(this.pixelsPerMeter),u=a.rigidBody.collider(0).castCollider(l,this.object.rigidBody.collider(0),Go.copy(n).divideScalar(this.pixelsPerMeter),0,t,!1);l.multiplyScalar(this.pixelsPerMeter);let h=hr.is(a)?a:a.object;if(u!==null&&this.lastHitObj!==h){let d;a instanceof Rh&&(d=a);let c=this.sharedGameControlGlobals.entityToCollisionEvents[h.uuid];if(c)for(let p of c)p.data.target==="character"&&(p.dispatch(d),h.dispatchEvent(p$));this.lastHitObj=h}u!==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),T0e(s++).copy(u.normal1).applyQuaternion(a.quaternion))}if(s>0){for(let a=0;a<s;a++){let o=T0e(a),l=o.dot(n);l<0&&n.addScaledVector(o,-l)}n.add(this.pushedVelocity)}else n.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(t),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*t,this.euler.y+=this.rotVelocity.y*t+this.groundYRotation,this.rotVelocityTarget.y===0&&this.directionXZ.manhattanLength()===0?this.rotationAccumWhenOrientWithCamera=0:(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.rotationAccumWhenOrientWithCamera+=this.rotVelocity.y*t),this.isFirstPerson===!1&&this.orientMode!=="none"&&this.directionXZ.manhattanLength()>0){if(this.orientMode==="radial"){this.objectToCamXZ.copy(this.objectToCamXZ0).applyAxisAngle(dc,this.euler.y-this.euler0.y);let s=Up.copy(this.objectToCamXZ).normalize(),a=ab.copy(n).multiplyScalar(t);a.y=0;let o=a.sub(Go.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*t+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=ht.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):this.euler.x=ht.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset,this.PI_2+this.cameraPolarOffset):this.cameraXAxis==="Limit"&&(this.euler.x=ht.clamp(this.euler.x,-this.PI_2,this.PI_2))),this.moveMode==="fly"?this.rot.x=this.euler.x:this.isFirstPerson&&(ob.copy(this.euler),ob.y=0,this.nonColliderRotOffset.makeRotationFromEuler(ob)),mh.setFromAxisAngle(z5e,this.rot.x),bv.setFromAxisAngle(dc,this.rot.y),bv.multiply(mh),mh.setFromAxisAngle(k5e,this.rot.z),bv.multiply(mh),this.quaternion.copy(bv),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=Up.copy(n).multiplyScalar(t/this.pixelsPerMeter),a=null;this.didHit=!1;let o=new P;for(let h=0;h<5;h++){let d=s.length(),c=ab.copy(s).normalize();if(a=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(o),this.colliderWorldQuat,c,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 v=this.sharedGameControlGlobals.entityToCollisionEvents[p?.uuid];if(v){for(let y of v)if(y.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}}y.dispatch(_),p.dispatchEvent(p$)}}}let f=_0e.set(a.normal2.x,a.normal2.y,a.normal2.z).applyQuaternion(this.colliderWorldQuat),m=b0e.copy(c).multiplyScalar(a.time_of_impact).dot(f),g=a.time_of_impact;if(g===0&&(this.position.y+=this.offset*this.pixelsPerMeter),m>this.offset&&(g=a.time_of_impact*(m-this.offset)/m,o.addScaledVector(c,g)),s.copy(c).multiplyScalar(d-g),Math.acos(-f.y)>this.slopeThresh){let v=this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(o),y=ab.copy(a.witness2).applyQuaternion(this.colliderWorldQuat);y.y=0;let _=v.add(y);_.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),Go.copy(this.position).divideScalar(this.pixelsPerMeter),mh.copy(this.quaternion).premultiply(this.groundTilt).multiply(this.objXZQuat);let l=this.object.rigidBody,u=l!==void 0&&H5e.copy(Go).sub(l.translation()).lengthSq()>1;l!==void 0&&(u?(l.setTranslation(Go,!0),l.setRotation(mh,!0)):(l.setNextKinematicTranslation(Go),l.setNextKinematicRotation(mh)))}else{let s=this.onObject?1:5,a=n.multiplyScalar(t/s);for(let o=0;o<s;o++)this.position.add(a),this.collisionAdjustment(t/s)}else this.position.addScaledVector(n,t);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);gj.lookAt(a,s,dc).setPosition(a),gj.decompose(this.targetPos,this.targetQuat,Go),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=ht.clamp(this.euler.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel)),this.euler.x=ht.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(q5e),!(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(W5e),0))}updateFollowArms(){this.objectToTarget.copy(this.objectToTarget0),this.targetToCamera.copy(this.targetToCamera0);let e,t=mh.setFromAxisAngle(dc,this.cameraYAxis==="Limit"&&this.orientMode!=="radial"?ht.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(t),e=this.cameraXAxis==="Limit"?ht.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):ht.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset+1e-6,this.PI_2+this.cameraPolarOffset-1e-6);let i=Go.copy(this.cameraPolarAxis0);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&i.applyQuaternion(t);let r=bv.setFromAxisAngle(i,e);this.cameraYAxis!=="Locked"&&this.targetToCamera.applyQuaternion(t),this.cameraXAxis!=="Locked"&&this.targetToCamera.applyQuaternion(r)}groundTiltAdjustment(e){180*dc.angleTo(e)/Math.PI<15||180*dc.angleTo(e)/Math.PI>85?mh.identity():mh.setFromUnitVectors(dc,e),this.groundTilt.slerp(mh,.06),this.groundTiltInv.copy(this.groundTilt).invert()}collisionAdjustment(e){let t=b0e.set(0,0,0);this.object.matrix.compose(this.position,this.quaternion,this.scale);let i=gj.multiplyMatrices(this.object.matrix,this.objXZRotMat).multiply(this.collider.matrix).decompose(Go,mh,Up).compose(Go,mh,w0e);this.sharedGameControlGlobals.entitiesWithTransformAnim.forEach(n=>{if(n===this.object||n.isDescendantOf(this.object)||!n.bvhGeometry||!n.bvhGeometry.boundsTree)return;au.makeEmpty(),n.updateMatrixWorldRigid();let s=n.matrixWorldRigid,a=x0e.copy(s).invert(),o=F5e.copy(x0e).multiply(i);ka.copy(this.collider.segment),ka.start.applyMatrix4(o),ka.end.applyMatrix4(o);let l=_0e.copy(this.position).applyMatrix4(a);au.expandByPoint(ka.start),au.expandByPoint(ka.end),au.min.addScalar(-this.collider.radius),au.max.addScalar(this.collider.radius),n.bvhGeometry.boundsTree.shapecast({boundsTraverseOrder:u=>u.distanceToPoint(ka.end),intersectsBounds:u=>u.intersectsBox(au),intersectsTriangle:u=>{let h=Go,d=Up,c=u.closestPointToSegment(ka,h,d);if(c<this.collider.radius){let p=this.collider.radius-c,f=d.sub(h).normalize(),m=ab.copy(l);m.addScaledVector(f,p);let g=m.applyMatrix4(s).sub(this.position);t.add(g),ka.start.addScaledVector(f,p),ka.end.addScaledVector(f,p)}}})}),au.makeEmpty(),ka.copy(this.collider.segment),ka.start.applyMatrix4(i),ka.end.applyMatrix4(i),au.expandByPoint(ka.start),au.expandByPoint(ka.end),au.min.addScalar(-this.collider.radius),au.max.addScalar(this.collider.radius),this.sharedGameControlGlobals.staticMeshBVH?.shapecast({boundsTraverseOrder:n=>n.distanceToPoint(ka.end),intersectsBounds:n=>n.intersectsBox(au),intersectsTriangle:n=>{let s=Go,a=Up,o=n.closestPointToSegment(ka,s,a);if(o<this.collider.radius){let l=this.collider.radius-o,u=a.sub(s).normalize();this.alignToGround&&this.groundTiltAdjustment(u),t.addScaledVector(u,l),ka.start.addScaledVector(u,l),ka.end.addScaledVector(u,l)}}}),this.onObject=Math.abs(t.y)>Math.abs(e*this.velocity.y*.25),this.onObject&&this.dispatchStopEvent("jump");let r=Math.max(0,t.length()-1e-5);t.normalize().multiplyScalar(r),this.position.add(t)}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()}},JEe=f$;JEe.isLocked=!1,le(),DA(),Z4(),Sw(),xw();var eAe,tAe,yj,$5e=new Promise(e=>{eAe=e});function X5e(e){return yj||(yj=async function(){let t=e??"https://cdn.spline.design/@splinetool/runtime@2.0.35/build";typeof window<"u"&&(tAe=new URL(t.endsWith("/")?t:`${t}/`,window.location.href).href);let i=import("./navmesh.js"),[r,n]=await Promise.all([i,fetch(`${t}/navmesh.wasm`).then(o=>o.arrayBuffer())]),s=r.default,a=await s({wasmBinary:n});eAe(a)}(),yj)}Hr();var iAe,mr,po,Y5e=e=>`
12895
+ `)>=0&&(e-=n),i===3?.5*t-.5*e:i===2?t-e:0}getLineInitialOffsetY(e,t,i,r,n){let s=t*e,a=e-Math.abs(this.ascender-this.descender)*r,o=-this.ascender*r-a/2;return n===3?-(i-s-o):n===2?-(.5*i-.5*s-o):o}createPath(e,t,i,r,n){let s=e.getPath(i,-r,n.fontSize,{kerning:!1,letterSpacing:n.letterSpacing});if(!s)return void console.error('THREE.Font: character "'+e+'" does not exists in font family '+this.familyName+".");let a=new w5e,o=(e.advanceWidth??1)*t;if(e)for(let l of s.commands){let u=a.currentPath?.currentPoint;if(!u||l.type==="Z"||u.x!==l.x||-u.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 u=function(h){if(h.length){let d=h[0];if(d instanceof wh)return d.v1;if(d instanceof pu||d instanceof of)return d.v0}}(l.curves);u!==void 0&&l.currentPoint.distanceTo(u)>0&&l.lineTo(u.x,u.y)}),{offsetX:o,path:a}}getCharWidth(e,t){try{return this.font?.getAdvanceWidth(e,t.fontSize,{kerning:!0,letterSpacing:t.letterSpacing})??0}catch(i){return this.warnLayoutError(i),0}}getTextWidth(e,t){try{return this.font?.getAdvanceWidth(e,t.fontSize,{kerning:!0,letterSpacing:t.letterSpacing})??0}catch(i){return this.warnLayoutError(i),0}}computeSpaceWidthForLine(e,t,i,r){let n=this.getCharWidth(" ",i),s=e[t];if(s){let a=this.countSpaces(s.trimEnd());if(i.horizontalAlign===4&&t<e.length-1&&a)return((typeof i.width=="string"?Number(r.getVariable(i.width)):i.width)-(this.getTextWidth(s,i)-a*n))/a}return n}countSpaces(e){return(e.match(/ /g)||[]).length}},Nn("text"),Wt();var HEe=null;function d0e(){return HEe}function M5e(e){let t=!1;return e.scene.objects.forEach(i=>{i.data.type==="Page"&&!t&&i.data.publish.gameControlObject&&Zy.traverseModuleInstances(e,i.id,(r,n,s)=>{for(let a of s)a.data.type==="GameControl"&&a.data.navmesh.enabled&&(t=!0)})}),t}Hr();var fN=(e,t)=>{let i=t.x-e.x,r=t.y-e.y;return Math.sqrt(i*i+r*r)},sj=e=>e*(Math.PI/180),mN=new Map,u4=(e,t,i)=>{let r,n=t.split(/[ ,]+/g);for(let s=0;s<n.length;s+=1)r=n[s],e.addEventListener?e.addEventListener(r,i,!1):e.attachEvent&&e.attachEvent(r,i)},d4=(e,t,i)=>{let r,n=t.split(/[ ,]+/g);for(let s=0;s<n.length;s+=1)r=n[s],e.removeEventListener?e.removeEventListener(r,i):e.detachEvent&&e.detachEvent(r,i)},WEe=e=>(e.preventDefault(),e.type.match(/^touch/)?e.changedTouches:e),c0e=()=>{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}},aj=(e,t)=>{t.top||t.right||t.bottom||t.left?(e.style.top=t.top,e.style.right=t.right,e.style.bottom=t.bottom,e.style.left=t.left):(e.style.left=t.x+"px",e.style.top=t.y+"px")},oj=(e,t,i)=>{let r=qEe(e);for(let n in r)if(Object.prototype.hasOwnProperty.call(r,n))if(typeof t=="string")r[n]=t+" "+i;else{let s="";for(let a=0,o=t.length;a<o;a+=1)s+=t[a]+" "+i+", ";r[n]=s.slice(0,-2)}return r},qEe=e=>{let t={};return t[e]="",["webkit","Moz","o"].forEach(function(i){t[i+e.charAt(0).toUpperCase()+e.slice(1)]=""}),t},lj=(e,t)=>{for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},c$=(e,t)=>{if(e.length)for(let i=0,r=e.length;i<r;i+=1)t(e[i]);else t(e)};typeof window<"u"&&($Ee="ontouchstart"in window,XEe=!!window.PointerEvent,YEe=!!window.MSPointerEvent);var $Ee,XEe,YEe,rb,p0e={start:"mousedown",move:"mousemove",end:"mouseup"},q2={};function Lv(){}XEe?rb={start:"pointerdown",move:"pointermove",end:"pointerup, pointercancel"}:YEe?rb={start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:$Ee?(rb={start:"touchstart",move:"touchmove",end:"touchend, touchcancel"},q2=p0e):rb=p0e,Lv.prototype.on=function(e,t){var i,r=this,n=e.split(/[ ,]+/g);r._handlers_=r._handlers_||{};for(var s=0;s<n.length;s+=1)i=n[s],r._handlers_[i]=r._handlers_[i]||[],r._handlers_[i].push(t);return r},Lv.prototype.off=function(e,t){var i=this;return i._handlers_=i._handlers_||{},e===void 0?i._handlers_={}:t===void 0?i._handlers_[e]=null:i._handlers_[e]&&i._handlers_[e].indexOf(t)>=0&&i._handlers_[e].splice(i._handlers_[e].indexOf(t),1),i},Lv.prototype.trigger=function(e,t){var i,r=this,n=e.split(/[ ,]+/g);r._handlers_=r._handlers_||{};for(var s=0;s<n.length;s+=1)i=n[s],r._handlers_[i]&&r._handlers_[i].length&&r._handlers_[i].forEach(function(a){a.call(r,{type:i,target:r},t)})},Lv.prototype.config=function(e){var t=this;t.options=t.defaults||{},e&&(t.options=((i,r)=>{let n={};for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&Object.prototype.hasOwnProperty.call(r,s)?n[s]=r[s]:Object.prototype.hasOwnProperty.call(i,s)&&(n[s]=i[s]);return n})(t.options,e))},Lv.prototype.bindEvt=function(e,t){var i=this;return i._domHandlers_=i._domHandlers_||{},i._domHandlers_[t]=function(){typeof i["on"+t]=="function"?i["on"+t].apply(i,arguments):console.warn('[WARNING] : Missing "on'+t+'" handler.')},u4(e,rb[t],i._domHandlers_[t]),q2[t]&&u4(e,q2[t],i._domHandlers_[t]),i},Lv.prototype.unbindEvt=function(e,t){var i=this;return i._domHandlers_=i._domHandlers_||{},d4(e,rb[t],i._domHandlers_[t]),q2[t]&&d4(e,q2[t],i._domHandlers_[t]),delete i._domHandlers_[t],this};var cK=Lv;function xa(e,t){return this.identifier=t.identifier,this.position=t.position,this.frontPosition=t.frontPosition,this.collection=e,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(t),this.options.mode==="dynamic"&&(this.options.restOpacity=0),this.id=xa.id,xa.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}xa.prototype=new cK,xa.constructor=xa,xa.id=0,xa.prototype.buildEl=function(e){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},xa.prototype.stylize=function(){if(this.options.dataOnly)return this;var e=this.options.fadeTime+"ms",t=(()=>{let n=qEe("borderRadius");for(let s in n)Object.prototype.hasOwnProperty.call(n,s)&&(n[s]="50%");return n})(),i=oj("transition","opacity",e),r={};return r.el={position:"absolute",opacity:this.options.restOpacity,display:"block",zIndex:999},r.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)"},r.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)"},lj(r.el,i),this.options.shape==="circle"&&lj(r.back,t),lj(r.front,t),this.applyStyles(r),this},xa.prototype.applyStyles=function(e){for(var t in this.ui)if(Object.prototype.hasOwnProperty.call(this.ui,t))for(var i in e[t])this.ui[t].style[i]=e[t][i];return this},xa.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)||this.options.zone.appendChild(this.ui.el),this},xa.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)||this.options.zone.removeChild(this.ui.el),this},xa.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},xa.prototype.show=function(e){var t=this;return t.options.dataOnly||(clearTimeout(t.removeTimeout),clearTimeout(t.showTimeout),clearTimeout(t.restTimeout),t.addToDom(),t.restCallback(),setTimeout(function(){t.ui.el.style.opacity=1},0),t.showTimeout=setTimeout(function(){t.trigger("shown",t.instance),typeof e=="function"&&e.call(this)},t.options.fadeTime)),t},xa.prototype.hide=function(e){var t=this;if(t.options.dataOnly)return t;if(t.ui.el.style.opacity=t.options.restOpacity,clearTimeout(t.removeTimeout),clearTimeout(t.showTimeout),clearTimeout(t.restTimeout),t.removeTimeout=setTimeout(function(){var i=t.options.mode==="dynamic"?"none":"block";t.ui.el.style.display=i,typeof e=="function"&&e.call(t),t.trigger("hidden",t.instance)},t.options.fadeTime),t.options.restJoystick){let i=t.options.restJoystick,r={};r.x=i===!0||i.x!==!1?0:t.instance.frontPosition.x,r.y=i===!0||i.y!==!1?0:t.instance.frontPosition.y,t.setPosition(e,r)}return t},xa.prototype.setPosition=function(e,t){var i=this;i.frontPosition={x:t.x,y:t.y};var r=i.options.fadeTime+"ms",n={};n.front=oj("transition",["top","left"],r);var s={front:{}};s.front={left:i.frontPosition.x+"px",top:i.frontPosition.y+"px"},i.applyStyles(n),i.applyStyles(s),i.restTimeout=setTimeout(function(){typeof e=="function"&&e.call(i),i.restCallback()},i.options.fadeTime)},xa.prototype.restCallback=function(){var e=this,t={};t.front=oj("transition","none",""),e.applyStyles(t),e.trigger("rested",e.instance)},xa.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}},xa.prototype.computeDirection=function(e){var t,i,r,n=e.angle.radian,s=Math.PI/4,a=Math.PI/2;if(n>s&&n<3*s&&!e.lockX?t="up":n>-s&&n<=s&&!e.lockY?t="left":n>3*-s&&n<=-s&&!e.lockX?t="down":e.lockY||(t="right"),e.lockY||(i=n>-a&&n<a?"left":"right"),e.lockX||(r=n>0?"up":"down"),e.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 u={};for(o in this.direction={x:i,y:r,angle:t},e.direction=this.direction,l)l[o]===this.direction[o]&&(u[o]=!0);if(u.x&&u.y&&u.angle)return e;(!u.x||!u.y)&&this.trigger("plain",e),u.x||this.trigger("plain:"+i,e),u.y||this.trigger("plain:"+r,e),u.angle||this.trigger("dir dir:"+t,e)}else this.resetDirection();return e};var E5e=xa;function qs(e,t){var i=this;i.nipples=[],i.idles=[],i.actives=[],i.ids=[],i.pressureIntervals={},i.manager=e,i.id=qs.id,qs.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(t),(i.options.mode==="static"||i.options.mode==="semi")&&(i.options.multitouch=!1),i.options.multitouch||(i.options.maxNumberOfNipples=1);let r=getComputedStyle(i.options.zone.parentElement);return r&&r.display==="flex"&&(i.parentIsFlex=!0),i.updateBox(),i.prepareNipples(),i.bindings(),i.begin(),i.nipples}qs.prototype=new cK,qs.constructor=qs,qs.id=0,qs.prototype.prepareNipples=function(){var e=this,t=e.nipples;t.on=e.on.bind(e),t.off=e.off.bind(e),t.options=e.options,t.destroy=e.destroy.bind(e),t.ids=e.ids,t.id=e.id,t.processOnMove=e.processOnMove.bind(e),t.processOnEnd=e.processOnEnd.bind(e),t.get=function(i){if(i===void 0)return t[0];for(var r=0,n=t.length;r<n;r+=1)if(t[r].identifier===i)return t[r];return!1}},qs.prototype.bindings=function(){var e=this;e.bindEvt(e.options.zone,"start"),e.options.zone.style.touchAction="none",e.options.zone.style.msTouchAction="none"},qs.prototype.begin=function(){var e=this,t=e.options;if(t.mode==="static"){var i=e.createNipple(t.position,e.manager.getIdentifier());i.add(),e.idles.push(i)}},qs.prototype.createNipple=function(e,t){var i=this,r=i.manager.scroll,n={},s=i.options,a=i.parentIsFlex?r.x:r.x+i.box.left,o=i.parentIsFlex?r.y:r.y+i.box.top;if(e.x&&e.y)n={x:e.x-a,y:e.y-o};else if(e.top||e.right||e.bottom||e.left){var l=document.createElement("DIV");l.style.display="hidden",l.style.top=e.top,l.style.right=e.right,l.style.bottom=e.bottom,l.style.left=e.left,l.style.position="absolute",s.zone.appendChild(l);var u=l.getBoundingClientRect();s.zone.removeChild(l),n=e,e={x:u.left+r.x,y:u.top+r.y}}var h=new E5e(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:t,position:e,zone:s.zone,frontPosition:{x:0,y:0},shape:s.shape});return s.dataOnly||(aj(h.ui.el,n),aj(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},qs.prototype.updateBox=function(){this.box=this.options.zone.getBoundingClientRect()},qs.prototype.bindNipple=function(e){var t,i=this,r=function(n,s){t=n.type+" "+s.id+":"+n.type,i.trigger(t,s)};e.on("destroyed",i.onDestroyed.bind(i)),e.on("shown hidden rested dir plain",r),e.on("dir:up dir:right dir:down dir:left",r),e.on("plain:up plain:right plain:down plain:left",r)},qs.prototype.pressureFn=function(e,t,i){var r=this,n=0;clearInterval(r.pressureIntervals[i]),r.pressureIntervals[i]=setInterval(function(){var s=e.force||e.pressure||e.webkitForce||0;s!==n&&(t.trigger("pressure",s),r.trigger("pressure "+t.identifier+":pressure",s),n=s)}.bind(r),100)},qs.prototype.onstart=function(e){var t=this,i=t.options,r=e;return e=WEe(e),t.updateBox(),c$(e,function(n){t.actives.length<i.maxNumberOfNipples?t.processOnStart(n):r.type.match(/^touch/)&&(Object.keys(t.manager.ids).forEach(function(s){if(Object.values(r.touches).findIndex(function(o){return o.identifier===s})<0){var a=[e[0]];a.identifier=s,t.processOnEnd(a)}}),t.actives.length<i.maxNumberOfNipples&&t.processOnStart(n))}),t.manager.bindDocument(),!1},qs.prototype.processOnStart=function(e){var t,i=this,r=i.options,n=i.manager.getIdentifier(e),s=e.force||e.pressure||e.webkitForce||0,a={x:e.pageX,y:e.pageY},o=i.getOrCreate(n,a);o.identifier!==n&&i.manager.removeIdentifier(o.identifier),o.identifier=n;var l=function(u){u.trigger("start",u),i.trigger("start "+u.id+":start",u),u.show(),s>0&&i.pressureFn(e,u,u.identifier),i.processOnMove(e)};if((t=i.idles.indexOf(o))>=0&&i.idles.splice(t,1),i.actives.push(o),i.ids.push(o.identifier),r.mode!=="semi")l(o);else{if(!(fN(a,o.position)<=r.catchDistance))return o.destroy(),void i.processOnStart(e);l(o)}return o},qs.prototype.getOrCreate=function(e,t){var i,r=this,n=r.options;return/(semi|static)/.test(n.mode)?(i=r.idles[0])?(r.idles.splice(0,1),i):n.mode==="semi"?r.createNipple(t,e):(console.warn("Coudln't find the needed nipple."),!1):i=r.createNipple(t,e)},qs.prototype.processOnMove=function(e){var t=this,i=t.options,r=t.manager.getIdentifier(e),n=t.nipples.get(r),s=t.manager.scroll;if((_=>isNaN(_.buttons)?_.pressure!==0:_.buttons!==0)(e)){if(!n)return console.error("Found zombie joystick with ID "+r),void t.manager.removeIdentifier(r);if(i.dynamicPage){var a=n.el.getBoundingClientRect();n.position={x:s.x+a.left,y:s.y+a.top}}n.identifier=r;var o=n.options.size/2,l={x:e.pageX,y:e.pageY};i.lockX&&(l.y=n.position.y),i.lockY&&(l.x=n.position.x);var u,h,d=fN(l,n.position),c=((_,b)=>{let x=b.x-_.x,w=b.y-_.y;return(S=>S*(180/Math.PI))(Math.atan2(w,x))})(l,n.position),p=sj(c),f=d/o,m={distance:d,position:l};if(n.options.shape==="circle"?(u=Math.min(d,o),h=((_,b,x)=>{let w={x:0,y:0};return x=sj(x),w.x=_.x-b*Math.cos(x),w.y=_.y-b*Math.sin(x),w})(n.position,u,c)):(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,n.position,o),u=fN(h,n.position)),i.follow){if(d>o){let _=l.x-h.x,b=l.y-h.y;n.position.x+=_,n.position.y+=b,n.el.style.top=n.position.y-(t.box.top+s.y)+"px",n.el.style.left=n.position.x-(t.box.left+s.x)+"px",d=fN(l,n.position)}}else l=h,d=u;var g=l.x-n.position.x,v=l.y-n.position.y;n.frontPosition={x:g,y:v},i.dataOnly||aj(n.ui.front,n.frontPosition);var y={identifier:n.identifier,position:l,force:f,pressure:e.force||e.pressure||e.webkitForce||0,distance:d,angle:{radian:p,degree:c},vector:{x:g/o,y:-v/o},raw:m,instance:n,lockX:i.lockX,lockY:i.lockY};(y=n.computeDirection(y)).angle={radian:sj(180-c),degree:180-c},n.trigger("move",y),t.trigger("move "+n.id+":move",y)}else this.processOnEnd(e)},qs.prototype.processOnEnd=function(e){var t=this,i=t.options,r=t.manager.getIdentifier(e),n=t.nipples.get(r),s=t.manager.removeIdentifier(n.identifier);!n||(i.dataOnly||n.hide(function(){i.mode==="dynamic"&&(n.trigger("removed",n),t.trigger("removed "+n.id+":removed",n),t.manager.trigger("removed "+n.id+":removed",n),n.destroy())}),clearInterval(t.pressureIntervals[n.identifier]),n.resetDirection(),n.trigger("end",n),t.trigger("end "+n.id+":end",n),t.ids.indexOf(n.identifier)>=0&&t.ids.splice(t.ids.indexOf(n.identifier),1),t.actives.indexOf(n)>=0&&t.actives.splice(t.actives.indexOf(n),1),/(semi|static)/.test(i.mode)?t.idles.push(n):t.nipples.indexOf(n)>=0&&t.nipples.splice(t.nipples.indexOf(n),1),t.manager.unbindDocument(),/(semi|static)/.test(i.mode)&&(t.manager.ids[s.id]=s.identifier))},qs.prototype.onDestroyed=function(e,t){var i=this;i.nipples.indexOf(t)>=0&&i.nipples.splice(i.nipples.indexOf(t),1),i.actives.indexOf(t)>=0&&i.actives.splice(i.actives.indexOf(t),1),i.idles.indexOf(t)>=0&&i.idles.splice(i.idles.indexOf(t),1),i.ids.indexOf(t.identifier)>=0&&i.ids.splice(i.ids.indexOf(t.identifier),1),i.manager.removeIdentifier(t.identifier),i.manager.unbindDocument()},qs.prototype.destroy=function(){var e=this;for(var t in e.unbindEvt(e.options.zone,"start"),e.nipples.forEach(function(i){i.destroy()}),e.pressureIntervals)Object.prototype.hasOwnProperty.call(e.pressureIntervals,t)&&clearInterval(e.pressureIntervals[t]);e.trigger("destroyed",e.nipples),e.manager.unbindDocument(),e.off(),e.pressureIntervals={},e.nipples=[],e.idles=[],e.actives=[],e.ids=[],e.manager=null};var A5e=qs;function ra(e){var t=this;t.ids={},t.index=0,t.collections=[],t.scroll=c0e(),t._windowBound=!1,t.config(e),t.prepareCollections();var i=function(){var r;t.collections.forEach(function(n){n.forEach(function(s){r=s.el.getBoundingClientRect(),s.position={x:t.scroll.x+r.left,y:t.scroll.y+r.top}})})};return t._onResize=function(){(r=>{mN.has(r)&&clearTimeout(mN.get(r)),mN.set(r,setTimeout(function(){mN.delete(r),r()},100))})(i)},t._onScroll=function(){t.scroll=c0e()},t.collections}ra.prototype=new cK,ra.constructor=ra,ra.prototype.prepareCollections=function(){var e=this;e.collections.create=e.create.bind(e),e.collections.on=e.on.bind(e),e.collections.off=e.off.bind(e),e.collections.destroy=e.destroy.bind(e),e.collections.get=function(t){var i;return e.collections.every(function(r){return!(i=r.get(t))}),i}},ra.prototype.create=function(e){return this.createCollection(e)},ra.prototype.bindWindowEvents=function(){var e=this;e._windowBound||typeof window>"u"||(e._windowBound=!0,u4(window,"resize",e._onResize),u4(window,"scroll",e._onScroll))},ra.prototype.unbindWindowEvents=function(){var e=this;!e._windowBound||typeof window>"u"||(e._windowBound=!1,d4(window,"resize",e._onResize),d4(window,"scroll",e._onScroll))},ra.prototype.createCollection=function(e){var t=this,i=new A5e(t,e);return t.bindCollection(i),t.collections.push(i),t.bindWindowEvents(),i},ra.prototype.bindCollection=function(e){var t,i=this,r=function(n,s){t=n.type+" "+s.id+":"+n.type,i.trigger(t,s)};e.on("destroyed",i.onDestroyed.bind(i)),e.on("shown hidden rested dir plain",r),e.on("dir:up dir:right dir:down dir:left",r),e.on("plain:up plain:right plain:down plain:left",r)},ra.prototype.bindDocument=function(){var e=this;e.binded||(e.bindEvt(document,"move").bindEvt(document,"end"),e.binded=!0)},ra.prototype.unbindDocument=function(e){var t=this;(!Object.keys(t.ids).length||e===!0)&&(t.unbindEvt(document,"move").unbindEvt(document,"end"),t.binded=!1)},ra.prototype.getIdentifier=function(e){var t;return e?(t=e.identifier===void 0?e.pointerId:e.identifier)===void 0&&(t=this.latest||0):t=this.index,this.ids[t]===void 0&&(this.ids[t]=this.index,this.index+=1),this.latest=t,this.ids[t]},ra.prototype.removeIdentifier=function(e){var t={};for(var i in this.ids)if(this.ids[i]===e){t.id=i,t.identifier=this.ids[i],delete this.ids[i];break}return t},ra.prototype.onmove=function(e){return this.onAny("move",e),!1},ra.prototype.onend=function(e){return this.onAny("end",e),!1},ra.prototype.oncancel=function(e){return this.onAny("end",e),!1},ra.prototype.onAny=function(e,t){var i,r=this,n="processOn"+e.charAt(0).toUpperCase()+e.slice(1);t=WEe(t);var s=function(a,o,l){l.ids.indexOf(o)>=0&&(l[n](a),a._found_=!0)};return c$(t,function(a){i=r.getIdentifier(a),c$(r.collections,s.bind(null,a,i)),a._found_||r.removeIdentifier(i)}),!1},ra.prototype.destroy=function(){var e=this;e.unbindDocument(!0),e.unbindWindowEvents(),e.ids={},e.index=0,e.collections.forEach(function(t){t.destroy()}),e.collections=[],e.off()},ra.prototype.onDestroyed=function(e,t){var i=this;if(i.collections.indexOf(t)<0)return!1;i.collections.splice(i.collections.indexOf(t),1),i.collections.length===0&&i.unbindWindowEvents()};var C5e=ra,Gx=null;function f0e(){return Gx||(Gx=new C5e),Gx}var R5e={create:function(e){return f0e().create(e)},destroy:function(){Gx&&(Gx.destroy(),Gx=null)},get factory(){return f0e()}},P5e=R5e;Hr(),Wt(),le(),Nh(),xl(),Wt();var KEe=null;function hj(){return KEe}var ZEe,uj,D5e=new Promise(e=>{ZEe=e});function N5e(e){return uj||(uj=async function(){let t=e??"https://cdn.spline.design/@splinetool/runtime@2.0.37/build",i=import("./physics.js"),[r,n]=await Promise.all([i,fetch(`${t}/physics.wasm`).then(s=>s.arrayBuffer())]);await r.init(n),ZEe(r)}(),uj)}function QEe(e){let t=e.elements,i=t[0]**2+t[1]**2+t[2]**2,r=t[4]**2+t[5]**2+t[6]**2,n=t[8]**2+t[9]**2+t[10]**2,s=t[0]**2+t[4]**2+t[8]**2,a=t[1]**2+t[5]**2+t[9]**2,o=t[2]**2+t[6]**2+t[10]**2,l=1e-8;return i<l||r<l||n<l||s<l||a<l||o<l}function nf(e,t){let i=new At;if(t&&QEe(t))return i.setAttribute("position",new Et([],3)),i.setIndex([]),i;if(!e.getAttribute("position"))return i.setAttribute("position",new Et([],3)),i.setIndex([]),i;let{positions:r,triIndices:n}=GX(e.getAttribute("position"),e.getIndex());return i.setAttribute("position",new Et(r,3)),i.setIndex(n),t&&i.applyMatrix4(t),i}rs(),xl(),_r(),nY(),le(),le(),xw(),DA();var Mr,I5e=class{constructor(e,t,i,r,n,s){this.id=e,this.data=t,this.object=i,this.initialDisabled=!1,this.actions=ua(t,t.actions,r,n,s,i),this.target=t.target}disconnect(){Za(this.actions)}dispatch(e){this.initialDisabled||(this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Collision"}),this.actions.Transition.forEach(t=>t.play()),this.actions.Animation.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.Reset.forEach(t=>{t.dispatch()}),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(e??!1)}),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.Audio.forEach(t=>{t.dispatchBasic()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()}),this.actions.Video.forEach(t=>{t.dispatchBasic()}),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch()))}},m0e=class{constructor(e,t,i,r,n,s){this.id=e,this.data=t,this.object=i,this.page=r,this.currentIntersectedObjects=[],this.actions=ua(t,t.actions,r,n,s,i),this.target=t.target,this.triggeringObjects=[];for(let a of t.triggeringObjects){let o=r.scene.find(a);o&&this.triggeringObjects.push(o)}}isValidTriggeringObject(e){return this.target==="all"||this.triggeringObjects.some(t=>t===e||t.isAncestorOf(e.uuid)||e.isAncestorOf(t.uuid))}disconnect(){Za(this.actions)}dispatch(){this.object.destroyedInAction||(this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Trigger"}),this.actions.Transition.forEach(e=>e.play()),this.actions.SwitchCamera.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.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(!1)}),this.actions.Audio.forEach(e=>{e.dispatchBasic()}),this.actions.Particles.forEach(e=>{e.dispatchBasic()}),this.actions.Video.forEach(e=>{e.dispatchBasic()}),this.actions.SceneTransition.forEach(e=>{e.dispatch()}),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch()))}};rs(),D5e.then(e=>Mr=e);var ia=new P,su=new jt,$m=new P,g0e=(new Kr(0,0,0,"YXZ"),new Kr(0,0,0,"XYZ")),Yu=new P,dj=new P,cj=new P(1,1,1),nb=new jt,gN=new Ve,v0e=new Ve,O5e={type:"updateMatrix"},y0e=new jt,pj=new qa,fj=.01,p$={type:"beginEvent",eventName:"Collision"},L5e={type:"beginEvent",eventName:"Trigger"},c4=e=>e.states.some(t=>t.data.position!==void 0||t.data.rotation!==void 0||t.data.hiddenMatrix!==void 0||t.data.cloner!==void 0||t.data.pathSnapping!==void 0);function sb(e){return function(t){return typeof t=="object"&&t!==null&&"booleanOp"in t}(Zv(e)?e.object:e)}var B5e=class{constructor(e){this.eventContext=e,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=t=>{if(t.bodyType()!==Mr.RigidBodyType.Dynamic)return;t.isSleeping()||this.nActiveRigidBodies++;let[i,r,n]=this.rigidBodyToMesh.get(t.handle);if(ia.copy(t.translation()).multiplyScalar(this.pixelsPerMeter),su.copy(t.rotation()),i.matrixWorld.compose(ia,su,r),i.hasNonUniformScale&&i.matrixWorld.multiply(i.shearScale),i.dispatchEvent(O5e),n){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=(t,i,r)=>{if(r===!1)return;let n,s;if(this.sensorToTriggerEvent[t]?(n=this.sensorToTriggerEvent[t],s=this.sharedGameControlGlobals.colliderToEntity.get(i)):this.sensorToTriggerEvent[i]&&(n=this.sensorToTriggerEvent[i],s=this.sharedGameControlGlobals.colliderToEntity.get(t)),n&&s&&n.isValidTriggeringObject(s))n.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===t||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(t)){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(t),o=this.sharedGameControlGlobals.entityToCollisionEvents[a.uuid];if(o===void 0)return;for(let l of o)l.data.target==="character"&&this.dispatchCollisionEvent(l,a,t)}else{let a=this.sharedGameControlGlobals.colliderToEntity.get(t),o=this.sharedGameControlGlobals.entityToCollisionEvents[a.uuid];if(o!==void 0)for(let h of o)h.data.target==="scene"&&this.dispatchCollisionEvent(h,a,t);let l=this.sharedGameControlGlobals.colliderToEntity.get(i),u=this.sharedGameControlGlobals.entityToCollisionEvents[l?.uuid];if(u!==void 0)for(let h of u)h.data.target==="scene"&&this.dispatchCollisionEvent(h,l,i)}}},this.isExport=e.isExport,this.sharedAssets=e.sharedAssets,this.renderer=e.renderer,this.requestRender=e.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(e=>{let t=e.dataPatched;for(let i of t.events){if(i.data.disabled===!0)continue;let r=i.data.actions?.find(n=>n.data.type==="Destroy")?.data;if(r)for(let n of r.objects){let s=this.page.scene.find(n);s&&(s.userData.hasDestroy=!0)}}})}markIsDragObject(){this.page.traverseVisibleEntity(e=>{let t=e.dataPatched;for(let i of t.events)if(i.data.disabled!==!0&&i.data.type==="DragDrop")for(let r of i.data.objects){let n=this.page.scene.find(r);n&&(n.userData.hasDrag=!0)}})}_staticBVHIdOf(e){let t=this._staticBVHAttrIds.get(e);return t===void 0&&(t=this._staticBVHNextAttrId++,this._staticBVHAttrIds.set(e,t)),t}initBVH(){if(hj()===null)return void Ma("collision-bvh","trigger/collision detection");let e=[],t=[];if(this.page.traverseChildren(i=>{let r,n=i instanceof Dx,s=_E(i);if(ix(i)||n||s)return;r=Zv(i)?i.object:i;let a=r.dataPatched;if(a.physics?.enabled==="visibility"?!a.visible:!a.physics?.enabled)return!0;let o=i.geometry,l=r.userData.hasDestroy===!0,u=r.userData.hasDrag===!0;if(c4(a)||l||u||r.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){e.push({geometry:o,matrixWorld:i.matrixWorld}),t.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)t.push(d)}}return!!sb(i)||void 0}),e.length>0){let i=this._staticBVHCache;if(i!==void 0&&i.signature.length===t.length&&i.signature.every((s,a)=>s===t[a]))return void(this.sharedGameControlGlobals.staticMeshBVH=i.bvh);let r=Kv(e.map(s=>nf(s.geometry,s.matrixWorld)),!1),n=new(hj())(r);this._staticBVHCache={signature:t,bvh:n},this.sharedGameControlGlobals.staticMeshBVH=n}}addRigidBody(e,t,i){if(QEe(e.matrixWorld))return;let r=[],n="geometry"in e?e.geometry:void 0,s=t.dataPatched;if(n?.getAttribute("position")!==void 0&&r.push(nf(n,e.shearScale)),s.physics.fusedBody){let a=this.gatherChildrenGeom(e,r);e.traverseObject(a),e.children.forEach(l=>l.updateMatrixWorld(!0));let o=e.cloner;o&&o.objectForSample===void 0&&s.physics.rigidBody==="dynamic"&&(o.traverseObject(a),o.children.forEach(l=>l.updateMatrixWorld(!0)))}if(r.length>0){let a,o=!1,l=!i.fromCreate&&s.physics.rigidBody==="dynamic"||i.fromCreate&&i.dynamic;l?(a=Mr.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=Mr.RigidBodyDesc.kinematicPositionBased(),o=!0):a=Mr.RigidBodyDesc.fixed();let u=Kv(r);(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).decompose(ia,su,$m),e.position0=ia.clone().divideScalar(this.pixelsPerMeter),e.rotation0=su.clone(),ia.divideScalar(this.pixelsPerMeter),a.setTranslation(ia.x,ia.y,ia.z).setRotation(su),n?u?.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter):u?.scale($m.x/this.pixelsPerMeter,$m.y/this.pixelsPerMeter,$m.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,u,t,d)}catch{try{this.addCollider(h,s.physics,u,t,!1)}catch(c){console.error(c)}}if(h.numColliders()===0)return void this.sharedGameControlGlobals.rapierWorld.removeRigidBody(h);l?this.rigidBodyToMesh.set(h.handle,[e,$m.clone(),s.physics.fusedBody]):o?(this.sharedGameControlGlobals.kinematicBodyToEntity.set(h.handle,e),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e)):this.fixedBodiesToWatch.push([e,h,(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).clone()]),e.rigidBody=h}}addBoundsTree(e){let t=[];if(e.geometry?.getAttribute("position")!==void 0&&e.geometry?.getAttribute("position").count>0&&t.push(nf(e.geometry,e.shearScale)),e.traverseObject(this.gatherChildrenGeom(e,t)),e.children.forEach(i=>i.updateMatrixWorld(!0)),t.length>0){let i=Kv(t,!1);e.bvhGeometry=i,i.getAttribute("position").count>0&&(e.bvhGeometry.boundsTree=new(hj())(i),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e))}}addCollider(e,t,i,r,n=!0){if(i?.getAttribute("position").count===0||i?.getIndex()?.count===0)return;let s;i&&(s=t.colliderType==="trimesh"?Mr.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array):Mr.ColliderDesc.convexMesh(i.getAttribute("position").array,n?i.getIndex().array:void 0)),s.setFrictionCombineRule(Mr.CoefficientCombineRule.Average).setRestitutionCombineRule(Mr.CoefficientCombineRule.Average).setDensity(t.density).setFriction(t.friction).setRestitution(t.restitution);let a=this.sharedGameControlGlobals.rapierWorld.createCollider(s,e);this.sharedGameControlGlobals.colliderToEntity.set(a.handle,r),this.sharedGameControlGlobals.entityToCollisionEvents[r.uuid]?.some(o=>o.target==="scene")&&a.setActiveEvents(Mr.ActiveEvents.COLLISION_EVENTS)}gatherChildrenGeom(e,t){let i=sb(e);return(r,n)=>{if(n===0)return;if(i&&r.parent===e)return!0;let s;if(ix(r)){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(Zv(r))s=r.object;else if(s=r,s.dataPatched.cloner?.hideBase)return!0;let a=s.dataPatched;if(a.physics.enabled==="visibility"?!a.visible:!a.physics.enabled)return!0;n===1?e.hasNonUniformScale?r.matrixWorld.multiplyMatrices(e.shearScale,r.hiddenMatrix):r.matrixWorld.copy(r.hiddenMatrix):r.matrixWorld.multiplyMatrices(r.parent.matrixWorld,r.hiddenMatrix),r.matrixWorld.multiply(r.matrix);let o=r.geometry;return o?.getAttribute("position")!==void 0&&t.push(nf(o,r.matrixWorld)),!!sb(r)||void 0}}activate(e){if(this.isEnabled)return;this.isEnabled=!0,this.eventManager=e,this.usePhysics=this.page.data.globalPhysics.usePhysics;let t=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 r=d0e();if(r!==null?i=r.setup({manager:this,camera:t,renderer:this.renderer,sharedAssets:this.sharedAssets,eventContext:this.eventContext,isExport:this.isExport})||i:this.page.data.publish.gameControlObject!==null&&Ma("game-controls","the scene's game controls"),i===!1){let{enableRotate:a,enablePan:o,enableZoom:l,autoRotate:u,hoverRotatePanMode:h}=this.eventManager.publish.orbitControls;(a||o||l||u||h!==0)&&(this.orbitControls=new REe(t,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 n=this.renderer.domElement.width/this.renderer.getPixelRatio(),s=this.renderer.domElement.height/this.renderer.getPixelRatio();d0e()?.createJoysticks(this,n,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 Mr.World(new Mr.Vector3(0,this.gravity,0)),this.events=new Mr.EventQueue(!0);let e=[],t=[];if(this.page.traverseChildren(a=>{let o;if(ix(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(Zv(a))o=a.object;else{if(_E(a)||Qy(a)||a instanceof Dx)return;if(o=a,o.dataPatched.cloner?.disabled===!1&&o.dataPatched.cloner?.hideBase&&o.dataPatched.physics?.fusedBody!==!0)return!0}let l,u=o.dataPatched;for(let g of u.events)g.data.disabled!==!0&&g.data.type==="GameControl"&&(l=g.data);if(!u.physics||(u.physics.enabled==="visibility"?!u.visible:!u.physics.enabled))return!0;a.updateMatrixWorldRigid();let h=c4(u),d=!1,c=o.userData.hasDestroy,p=o.userData.hasDrag,f=!1;for(let g of u.events)if(g.data.disabled!==!0){if(g.data.type==="Collision"){d=!0;let v=new I5e(g.id,g.data,o,this.page,this.sharedAssets,this.eventManager);v.initialDisabled=!0,this.collisionEvents.push(v),this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid]&&this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid].every(y=>y.id!==g.id)?this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid].push(v):this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid]=[v]}else if(g.data.type==="Follow"){f=!0;let v=g.data.target;a.traverseVisible(y=>{y.userData.isFollowingObj=v})}}u.physics.rigidBody==="dynamic"&&u.physics.fusedBody===!1&&(a.matrixWorldFusedFalse=a.matrixWorld.clone());let m=a.geometry;if(l!==void 0){let g=Mr.RigidBodyDesc.kinematicPositionBased();(a.hasNonUniformScale?a.matrixWorldRigid:a.matrixWorld).decompose(ia,su,$m),a.position0=ia.clone().divideScalar(this.pixelsPerMeter),a.rotation0=su.clone(),ia.divideScalar(this.pixelsPerMeter),g.setTranslation(ia.x,ia.y,ia.z).setRotation(su);let v,y=this.sharedGameControlGlobals.rapierWorld.createRigidBody(g);a.rigidBody=y,v=l.collider.type==="sphere"?Mr.ColliderDesc.ball(l.collider.radius/this.pixelsPerMeter):l.collider.type==="capsule"?Mr.ColliderDesc.capsule((l.collider.height/2-l.collider.radius)/this.pixelsPerMeter,l.collider.radius/this.pixelsPerMeter):Mr.ColliderDesc.cuboid(l.collider.width/this.pixelsPerMeter/2,l.collider.height/this.pixelsPerMeter/2,l.collider.depth/this.pixelsPerMeter/2),v.setFrictionCombineRule(Mr.CoefficientCombineRule.Average).setDensity(u.physics.density).setFriction(u.physics.friction).setRestitution(0).setRestitutionCombineRule(Mr.CoefficientCombineRule.Min);let _=this.sharedGameControlGlobals.rapierWorld.createCollider(v,y);this.sharedGameControlGlobals.colliderToEntity.set(_.handle,o),ia.fromArray(l.collider.position.map(x=>typeof x=="number"?x:0)).multiply($m.setFromMatrixScale(o.matrixWorld)).divideScalar(this.pixelsPerMeter),_.setTranslationWrtParent(ia);let b=new jt().setFromEuler(new Kr().setFromVector3(new P().fromArray(l.collider.rotation.map(x=>typeof x=="number"?x:0))));_.setRotationWrtParent(b),_.setActiveEvents(Mr.ActiveEvents.COLLISION_EVENTS),this.generateSensorColliderDescs(o,!0)}else u.physics.rigidBody==="dynamic"||h||f||c||p||d?(this.addRigidBody(a,o,{hasFollow:f,hasTransformAnim:h,hasDrag:p}),this.generateSensorColliderDescs(o,u.physics.fusedBody)):(m&&e.push(nf(m,a.matrixWorld)),u.physics.fusedBody&&!sb(a)&&a.traverseObject((g,v)=>{if(v===0)return;let y;if(ix(g)){if(!g.objectForSample)return g.object.dataPatched.physics.fusedBody===!0&&g.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(g.objectForSample.dataPatched.physics.fusedBody)return;y=g.object}else{if(_E(g)||Qy(g)||g instanceof Dx)return;if(Zv(g))y=g.object;else if(y=g,y.dataPatched.cloner?.hideBase)return!0}let _=y.dataPatched;if(_.physics.enabled==="visibility"?!_.visible:!_.physics.enabled)return!0;let b=g.geometry;return b?.getAttribute("position")!==void 0&&e.push(nf(b,g.matrixWorld)),!!sb(g)||void 0}),this.generateSensorColliderDescs(o,u.physics.fusedBody,t));return!(u.physics?.fusedBody!==!0&&!l&&!sb(a))||void 0}),e.length===0)return;let i=Kv(e),r=i.getIndex().count>0;if(!r&&t.length===0)return;i.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter);let n=Mr.RigidBodyDesc.fixed(),s=this.sharedGameControlGlobals.rapierWorld.createRigidBody(n);if(r){let a=Mr.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array).setFrictionCombineRule(Mr.CoefficientCombineRule.Multiply).setRestitutionCombineRule(Mr.CoefficientCombineRule.Multiply).setFriction(1).setRestitution(1);this.sharedGameControlGlobals.rapierWorld.createCollider(a,s)}for(let[a,o]of t){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(e=>{for(let t of e.dataPatched.events)if(t.data.type==="Trigger"&&t.data.disabled!==!0){let i=new m0e(t.id,t.data,e,this.page,this.sharedAssets,this.eventManager),r=new Ve().compose(Yu.fromArray(t.data.position.map(n=>typeof n=="number"?n:0)),nb.setFromEuler(g0e.fromArray(t.data.rotation.map(n=>typeof n=="number"?n:0))),cj);if(t.data.triggerZone==="box"){let n=new fn;n.min.fromArray(t.data.size.map(s=>typeof s=="number"?s:0)).multiplyScalar(-.5),n.max.fromArray(t.data.size.map(s=>typeof s=="number"?s:0)).multiplyScalar(.5),this.sharedGameControlGlobals.triggers.push([n,r,e,i])}else this.sharedGameControlGlobals.triggers.push([t.data.radius,r,e,i])}}),this.needsCollisionDetection&&this.initBVH())}disconnectEvents(){this.collisionEvents.forEach(e=>e.disconnect()),this.sharedGameControlGlobals.triggers.forEach(e=>e[3].disconnect()),this.sharedGameControlGlobals.triggers.length=0}deactivate(){if(this.isEnabled){this.isEnabled=!1,this.page.traverse(e=>{let t=e;t.matrixWorldFusedFalse&&(t.matrixWorldFusedFalse=void 0),t.rigidBody&&(t.rigidBody=void 0),t.position0&&(t.position0=void 0),t.rotation0&&(t.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(([e,t])=>{e?.destroy(),t.remove()}),this.joystickToGameControls=[],this.joysticks=[],this.orbitControls&&(this.orbitControls.dispose(),this.orbitControls=void 0),this.navigationMeshWrapper?.dispose(),this.navigationMeshWrapper=void 0;for(let e of Object.values(this.sharedGameControlGlobals.entityToCollisionEvents))e.forEach(t=>t.disconnect());this.sharedGameControlGlobals.entityToCollisionEvents={},this.page.updateMatrixWorld(!0)}}update(e){if(!this.isEnabled)return!0;let t=!0;if(this.orbitControls!==void 0&&this.orbitControls.needsUpdate&&(this.orbitControls.update(),t=!this.orbitControls.isCurrentlyDamping),this.initializationCounter>=0&&this.initializationCounter<2?(this.initializationCounter++,t=!1):this.initializationCounter===2&&this.gameControl&&(t=!this.gameControl.update(e)&&t),this.usePhysics===!1&&this.checkTrigger(),this.usePhysics){let i=.016666666666666666;if(e===0)t=this.stepPhysics()&&t;else{let r=e/1e3;r<i&&r>.55*i&&(r=i),this.accumulator+=r;let n=performance.now(),s=0,a=6;for(;this.accumulator>=i&&s<a&&(t=this.stepPhysics()&&t,this.accumulator-=i,s++,!(performance.now()-n>1e3*i)););this.accumulator=this.accumulator%i}}this.skipRender=t}recordPhysicsPose(e){(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).decompose(ia,su,$m);let t=e;t.prevQ===void 0?(t.prevQ=su.clone(),t.prevT=ia.clone()):(t.prevQ.copy(su),t.prevT.copy(ia))}promoteMovedFixedBodies(){for(let e=this.fixedBodiesToWatch.length-1;e>=0;e--){let[t,i,r]=this.fixedBodiesToWatch[e];(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).equals(r)||(i.setBodyType(Mr.RigidBodyType.KinematicPositionBased,!0),this.sharedGameControlGlobals.kinematicBodyToEntity.set(i.handle,t),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t),this.fixedBodiesToWatch.splice(e,1))}}clampPushedBodies(){let e=this.gameControl?.object.rigidBody;if(e===void 0)return;let t=this.sharedGameControlGlobals.rapierWorld,i=e.linvel(),r=e.translation(),n=Math.hypot(i.x,i.z);for(let s=0;s<e.numColliders();s++){let a=e.collider(s);t.contactPairsWith(a,o=>{let l=o.parent();if(l===null||!l.isDynamic())return;let u=l.translation(),h=-1/0,d=0,c=0;if(t.contactPair(a,o,v=>{let y=v.normal(),_=y.x*(u.x-r.x)+y.y*(u.y-r.y)+y.z*(u.z-r.z)<0?-1:1;if(Math.abs(y.y)>.7)return;let b=_*y.x,x=_*y.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,c=x/w)}),h===-1/0)return;let p=i.x*d+i.z*c;if(p<-fj)return;let f=l.linvel();if(n>fj&&p>fj){let v=f.x*d+f.z*c;if(v<=0)return;let y=Math.min(v,p);return void l.setLinvel({x:d*y,y:f.y,z:c*y},!0)}let m=f.x*d+f.z*c-Math.max(0,p);if(m<=0)return;let g=.5*m;l.setLinvel({x:f.x-d*g,y:f.y,z:f.z-c*g},!0)})}}stepPhysics(){this.promoteMovedFixedBodies();for(let e of this.sharedGameControlGlobals.kinematicBodyToEntity.values())this.recordPhysicsPose(e),e.rigidBody.setNextKinematicTranslation(ia.divideScalar(this.pixelsPerMeter)),e.rigidBody.setNextKinematicRotation(su);for(let e of this.sharedGameControlGlobals.entitiesWithTransformAnim)e.rigidBody?.isKinematic()!==!0&&this.recordPhysicsPose(e);return this.sharedGameControlGlobals.rapierWorld.step(this.events),this.clampPushedBodies(),this.events?.drainCollisionEvents(this.handleCollisionEvents),!this.updatePositions()}dispatchCollisionEvent(e,t,i){let r,n=(this.sharedGameControlGlobals.rapierWorld?.getCollider(i))._parent;if(t.cloner){for(let s of t.cloner.children)if(s.rigidBody===n){r=s;break}}e.dispatch(r),t.dispatchEvent(p$)}updateUseWindowEvents(e){this.orbitControls?.updateUseWindowEvents(e)}generateSensorColliderDescs(e,t,i){let r=v0e.copy(e.matrixWorld).invert();e.traverseEntity((n,s)=>{if(t===!1&&s===1)return!0;for(let a of n.dataPatched.events)if(a.data.type==="Trigger"&&a.data.disabled!==!0){let o,l=new m0e(a.id,a.data,n,this.page,this.sharedAssets,this.eventManager);if(o=a.data.triggerZone==="box"?Mr.ColliderDesc.cuboid(...a.data.size.map(u=>(typeof u=="number"?u:1)/(2*this.pixelsPerMeter))):Mr.ColliderDesc.ball(a.data.radius/this.pixelsPerMeter),o.setDensity(0).setSensor(!0).setActiveEvents(Mr.ActiveEvents.COLLISION_EVENTS),Yu.fromArray(a.data.position.map(u=>typeof u=="number"?u:0)),nb.setFromEuler(g0e.fromArray(a.data.rotation.map(u=>typeof u=="number"?u:0))),gN.compose(Yu,nb,cj).premultiply(n.matrixWorld),i?(gN.decompose(Yu,nb,dj),o.setActiveCollisionTypes(Mr.ActiveCollisionTypes.KINEMATIC_FIXED|Mr.ActiveCollisionTypes.DYNAMIC_FIXED)):(gN.premultiply(r).decompose(Yu,nb,dj),e.rigidBody.bodyType()===Mr.RigidBodyType.Dynamic||(e.rigidBody.bodyType()===Mr.RigidBodyType.Fixed?o.setActiveCollisionTypes(Mr.ActiveCollisionTypes.KINEMATIC_FIXED|Mr.ActiveCollisionTypes.DYNAMIC_FIXED):o.setActiveCollisionTypes(Mr.ActiveCollisionTypes.KINEMATIC_KINEMATIC|Mr.ActiveCollisionTypes.DYNAMIC_KINEMATIC))),Yu.divideScalar(this.pixelsPerMeter),o.setTranslation(Yu.x,Yu.y,Yu.z),o.setRotation(nb),i)i.push([o,l]);else{let u=this.sharedGameControlGlobals.rapierWorld.createCollider(o,e.rigidBody);this.sensorToTriggerEvent[u.handle]=l}}})}checkTrigger(){let e;for(let t=0;t<this.sharedGameControlGlobals.triggers.length;t++){let[i,r,n,s]=this.sharedGameControlGlobals.triggers[t];for(let a=0;a<this.sharedGameControlGlobals.entitiesWithTransformAnim.length;a++){let o=this.sharedGameControlGlobals.entitiesWithTransformAnim[a];if(n===o||s.isValidTriggeringObject(hr.is(o)?o:o.object)===!1)continue;let l=v0e.copy(n.matrixWorld).decompose(Yu,y0e,dj).compose(Yu,y0e,cj).multiply(r),u=gN.copy(o.matrixWorld).invert().multiply(l),h=o.bvhGeometry.boundsTree;i instanceof fn?e=h.intersectsBox(i,u):(pj.radius=i,pj.center.setFromMatrixPosition(u),e=h.intersectsSphere(pj)),e?s.currentIntersectedObjects.indexOf(o)===-1&&(s.currentIntersectedObjects.push(o),s.dispatch(),n.dispatchEvent(L5e)):s.currentIntersectedObjects=s.currentIntersectedObjects.filter(d=>d!==o)}}}};Sw(),le(),gL(),Nr(),$f();var mj=.02,_0e=new P,b0e=new P,U5e=new P,Go=new P,Up=new P,ab=new P,gj=new Ve,x0e=new Ve,F5e=new Ve,mh=new jt,bv=new jt,ob=new Kr(0,0,0,"YXZ"),z5e=new P(1,0,0),dc=new P(0,1,0),k5e=new P(0,0,1),w0e=new P(1,1,1),S0e=[],T0e=e=>S0e[e]??(S0e[e]=new P),vj=new P,V5e=new P,G5e=new P,j5e=new P,M0e=new jt,H5e=new P,E0e=new jt,ka=new Eh,au=new fn,W5e={type:"requestRender"},q5e={type:"updateMatrix"},f$=class extends xs{constructor(e,t,i,r,n,s,a,o,l){super(),this.object=e,this.domElement=t,this.data=i,this.gloabalPhysics=r,this.controlsManager=n,this.cameraFollow=s,this.camera=a,this.page=o,this.sharedAssets=l,this.enableDamping=!0,this.hiddenMatrix0=new Ve,this.target0=new P,this.zoom0=1,this.rotForce=1,this.moveForce=1,this.pixelsPerMeter=200,this.euler0=new Kr(0,0,0,"YXZ"),this.position0Cam=new P,this.quat0Cam=new jt,this.scale0Cam=new P,this.hiddenMatrix0Cam=new Ve,this.threshEndTranslate=.01,this.threshEndRotate=1e-8,this.threshEndRotVel=.005,this.collider={type:"capsule",radius:40,segment:new Eh(new P(0,-40,0),new P(0,40,0)),matrix:new Ve,position:new P,rotation:new jt},this.euler=new Kr(0,0,0,"YXZ"),this.eulerDelta=new P,this.lastPosition=new P,this.lastCameraQuaternion=new jt,this.lastCameraPosition=new P,this.PI_2=Math.PI/2,this.prevMouse=new J,this.velocityTarget=new P,this.velocity=new P,this.directionXZ=new P,this.rotVelocityStick=new P,this.rotVelocityTarget=new P,this.rotVelocity=new P,this.rotDirection=new P,this.nonColliderRotOffset=new Ve,this.nonColliderPosOffset=new Ve,this.firstPointerId=-1,this.rot=new P,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 Ve,this.objectToTarget=new P,this.objectToTarget0=new P,this.objectToCamXZ=new P,this.objectToCamXZ0=new P,this.targetToCamera=new P,this.targetToCamera0=new P,this.cameraPolarAxis0=new P,this.targetPos=new P,this.targetQuat=new jt,this.lerpFactorPos=new P().setScalar(.3),this.lerpFactorPosStart=.3,this.lerpFactorPosEnd=.3,this.lerpFactorRotStart=.3,this.lerpFactorRotEnd=.3,this.lerpFactorPosCamera=.3,this.lerpFactorRotCamera=.3,this.objXZQuat=new jt,this.objXZQuatInv=new jt,this.objXZRotMat=new Ve,this.isFirstPerson=!1,this.didHit=!1,this.groundVelocity=new P,this.pushedVelocity=new P,this.groundYRotation=0,this.objectRealQuat=new jt,this.colliderWorldQuat=new jt,this.groundNormal=new P,this.groundTilt=new jt,this.groundTiltInv=new jt,this.lastHitObj=null,this.isFirstFrame=!0,this.rotationAccumWhenOrientWithCamera=0,this.navMeshPathDest=null,this.position=new P,this.quaternion=new jt,this.scale=new P,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"&&!Kl&&!R7&&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 m=f.clientX-this.prevMouse.x,g=f.clientY-this.prevMouse.y;this.prevMouse.set(f.clientX,f.clientY),f.pointerType==="mouse"&&this.rotBy!=="keys"&&(R7&&a1e<15.5&&!Kl?(this.eulerDelta.y=-m*this.mouseOrbitSensitivity,this.eulerDelta.x=-g*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=-m*this.mouseOrbitSensitivity*5,this.eulerDelta.x=-g*this.mouseOrbitSensitivity*5),this.controlsManager.requestRender()},this.onPointerlockChange=f=>{this.domElement.ownerDocument.pointerLockElement===this.domElement?f$.isLocked=!0:f$.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 m of this.keyAssignments)if(f.key.toUpperCase()===m[1]||f.key===m[1]){this.movementState[m[0]]=1;break}this.controlsManager.requestRender()},this.onKeyUp=f=>{for(let m of this.keyAssignments)if(f.key.toUpperCase()===m[1]||f.key===m[1]||f.code.slice(3,f.code.length).toUpperCase()===m[1]){this.movementState[m[0]]=0;break}},this.copyVRGamePadValues=(f,m)=>{for(let g=2;g<4;g++){let v=f.axes[g];m===0?g===2?this.movementState.movePosX=v:this.movementState.movePosZ=v:(f.buttons[3].pressed?this.movementState.jump=1:this.movementState.jump=0,g===2?this.movementState.rotPosY=v:this.moveMode==="fly"&&(this.movementState.moveNegY=v))}},this.sharedGameControlGlobals=n.sharedGameControlGlobals,e===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 u=this.euler0.clone(),h=u.y;if(this.objectRealQuat.copy(this.quaternion),u.y=0,this.quaternion.setFromEuler(u),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),u.set(0,h,0),this.quaternion.setFromEuler(u),this.rot.setFromEuler(u),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,m=new P(0,0,-1).applyQuaternion(this.camera.quaternion),g=new P().subVectors(this.position,this.camera.position);this.objectToCamXZ.copy(g),this.objectToCamXZ.y=0,this.objectToCamXZ0.copy(this.objectToCamXZ),Math.abs(m.y)<1e-6?(g.y=0,m.y=0,f=g.projectOnVector(m)):f=g.y/m.y>0?m.multiplyScalar(g.y/m.y):m.multiplyScalar(g.length()),this.targetToCamera0.copy(f).negate();let v=this.camera.position.clone().add(f);this.objectToTarget0.subVectors(v,this.position);let y=new Kr().setFromQuaternion(this.camera.quaternion,"YXZ");this.cameraPolarOffset=-y.x,y.x=0,y.z=0,y.y-=Math.PI/2,this.cameraPolarAxis0.set(0,0,-1).applyEuler(y)}if(this.object instanceof us&&(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 m=[f[0],f[1]];return m[1]==="\u25B2"?m[1]="ArrowUp":m[1]==="\u25C0"?m[1]="ArrowLeft":m[1]==="\u25BC"?m[1]="ArrowDown":m[1]==="\u25B6"?m[1]="ArrowRight":m[1]==="\u21E7"?m[1]="Shift":m[1]==="\u21B5"?m[1]="Enter":m[1]==="Space"?m[1]=" ":m[1]==="\u2318"?m[1]="Meta":m[1]==="Ctrl"?m[1]="Control":m[1]==="Esc"&&(m[1]="Escape"),m}),i.rotBy==="mouse"){let f;f=this.keyAssignments.findIndex(m=>m[0]==="rotNegX"),f!==-1&&(this.keyAssignments[f][1]=""),f=this.keyAssignments.findIndex(m=>m[0]==="rotPosX"),f!==-1&&(this.keyAssignments[f][1]=""),f=this.keyAssignments.findIndex(m=>m[0]==="rotPosY"),f!==-1&&(this.keyAssignments[f][1]=""),f=this.keyAssignments.findIndex(m=>m[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??Mx.defaultData.gravity),this.usePhysics=this.gloabalPhysics.usePhysics??Mx.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??lL.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*mj/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*mj/this.pixelsPerMeter,this.stepThresh=2*i.collider.radius*.3/this.pixelsPerMeter,this.colliderHeight=2*i.collider.radius):(this.offset=i.collider.height*mj/this.pixelsPerMeter,this.stepThresh=.3*i.collider.height/this.pixelsPerMeter,this.colliderHeight=i.collider.height),this.collider.type=i.collider.type;let d=new P().fromArray(i.collider.position.map(f=>typeof f=="number"?f:0)),c=new jt().setFromEuler(new Kr().fromArray([...i.collider.rotation.map(f=>typeof f=="number"?f:0),"XYZ"]));this.collider.position.copy(d).multiply(this.scale),this.collider.rotation.copy(c),this.collider.matrix.compose(d,c,w0e),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 Nt;f.push({fi:0,data:{...os.defaultData("light","phong"),alpha:0},id:"layer1"}),f.push({fi:0,data:{...os.defaultData("color"),color:i.navmesh.destinationHelperColor,alpha:i.navmesh.destinationHelperColor.a},id:"layer2"});let m=Tbe({layers:f},{scene:this.page.scene,shared:this.sharedAssets});this.navMeshPathDest=new Cr(BX.create({parameters:{width:p,height:p/10,hollow:.7}}),m),this.navMeshPathDest.material.userData.opacity0=i.navmesh.destinationHelperColor.a}this.activate()}reset(e=!1){if(this.object.hiddenMatrix.copy(this.hiddenMatrix0),e){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 t=new Kr().setFromQuaternion(this.quaternion,"YXZ"),i=t.y;this.objectRealQuat.copy(this.quaternion),t.y=0,this.quaternion.setFromEuler(t),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),t.set(0,i,0),this.quaternion.setFromEuler(t),this.rot.setFromEuler(t),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.velocityTarget.set(0,0,0),this.velocity.set(0,0,0)}else this.object instanceof us?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 e=this.data,t=this.sharedAssets;e.gameActions!==void 0&&(this.actions={},oL.list.forEach(i=>{this.actions[i]=ua({...e,disabled:!1,type:"GameControl"},e.gameActions[i],this.page,t,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"),Za(this.actions.idle),Za(this.actions.move),Za(this.actions.run),Za(this.actions.jump)}dispatchStartEvent(e){this.actions[e]!==void 0&&(this.actionState[e]||(this.actionState[e]=!0,this.actions[e].Transition.forEach(t=>{t.play()}),this.actions[e].Animation.forEach(t=>{t.play(this.initialAction===!1)}),this.actions[e].TimelineAnimation.forEach(t=>{t.play()}),this.actions[e].Create.forEach(t=>{t.dispatchStart()}),this.actions[e].Audio.forEach(t=>{t.dispatchGameControl("start")}),this.actions[e].Particles.forEach(t=>{t.dispatchGameControl("start")})))}dispatchStopEvent(e){this.actions[e]!==void 0&&(!this.actionState[e]||(this.actionState[e]=!1,this.actions[e].Transition.forEach(t=>{t.stop(),t.object.currentState!==null&&t.object.changeSelectedState(null,{scene:this.page.scene,shared:this.sharedAssets})}),this.actions[e].TimelineAnimation.forEach(t=>{t.stop()}),this.actions[e].Create.forEach(t=>{t.dispatchStop()}),this.actions[e].Audio.forEach(t=>{t.dispatchGameControl("stop")}),this.actions[e].Particles.forEach(t=>{t.dispatchGameControl("stop")})))}get colliderWorldPosition(){return Go.copy(this.collider.position).applyQuaternion(this.objectRealQuat).add(this.position)}update(e){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 t=(this.isFirstFrame?16.6:e)/1e3;this.isFirstFrame&&(this.isFirstFrame=!1);let i=60*t,r=!1;if(this.groundYRotation=0,this.groundVelocity.set(0,0,0),this.usePhysics&&this.collisionEnabled&&this.object.rigidBody?.collider(0).shape){let s=Up.set(0,(this.velocity.y===0?this.pixelsPerMeter*Math.max(Math.abs(this.gravity)/120,1)*(this.gravity>0?1:-1):this.velocity.y)*t,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&&(r=!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,u=l===null?void 0:this.sharedGameControlGlobals.kinematicBodyToEntity.get(l.handle);if(l!==null&&u?.userData.isFollowingObj!==this.object.uuid){let h=this.object.getWorldPosition(Go).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*t}}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=Go.subVectors(this.path[1],this.position),o=Up.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 n=U5e.copy(this.velocity);if(this.orientMode!=="none"&&this.isFirstPerson===!1){let s=Up.copy(n);s.y=0,n.set(0,n.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=Go;this.camera.getWorldDirection(s);let a=ab.copy(dc).multiplyScalar(s.dot(dc));s.sub(a);let o=Up.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(ob.setFromVector3(this.rot),this.moveMode==="walk"&&(ob.x=0),n.applyEuler(ob),r&&(bv.setFromUnitVectors(dc,this.groundNormal),n.applyQuaternion(bv)),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(vj,M0e,V5e);let o=this.object.getWorldPosition(G5e).add(this.collider.position).sub(vj);E0e.copy(a.prevQ).invert().premultiply(M0e);let l=ab.subVectors(vj,a.prevT).add(j5e.copy(o).applyQuaternion(E0e).sub(o)).divideScalar(t).divideScalar(this.pixelsPerMeter),u=a.rigidBody.collider(0).castCollider(l,this.object.rigidBody.collider(0),Go.copy(n).divideScalar(this.pixelsPerMeter),0,t,!1);l.multiplyScalar(this.pixelsPerMeter);let h=hr.is(a)?a:a.object;if(u!==null&&this.lastHitObj!==h){let d;a instanceof Rh&&(d=a);let c=this.sharedGameControlGlobals.entityToCollisionEvents[h.uuid];if(c)for(let p of c)p.data.target==="character"&&(p.dispatch(d),h.dispatchEvent(p$));this.lastHitObj=h}u!==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),T0e(s++).copy(u.normal1).applyQuaternion(a.quaternion))}if(s>0){for(let a=0;a<s;a++){let o=T0e(a),l=o.dot(n);l<0&&n.addScaledVector(o,-l)}n.add(this.pushedVelocity)}else n.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(t),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*t,this.euler.y+=this.rotVelocity.y*t+this.groundYRotation,this.rotVelocityTarget.y===0&&this.directionXZ.manhattanLength()===0?this.rotationAccumWhenOrientWithCamera=0:(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.rotationAccumWhenOrientWithCamera+=this.rotVelocity.y*t),this.isFirstPerson===!1&&this.orientMode!=="none"&&this.directionXZ.manhattanLength()>0){if(this.orientMode==="radial"){this.objectToCamXZ.copy(this.objectToCamXZ0).applyAxisAngle(dc,this.euler.y-this.euler0.y);let s=Up.copy(this.objectToCamXZ).normalize(),a=ab.copy(n).multiplyScalar(t);a.y=0;let o=a.sub(Go.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*t+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=ht.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):this.euler.x=ht.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset,this.PI_2+this.cameraPolarOffset):this.cameraXAxis==="Limit"&&(this.euler.x=ht.clamp(this.euler.x,-this.PI_2,this.PI_2))),this.moveMode==="fly"?this.rot.x=this.euler.x:this.isFirstPerson&&(ob.copy(this.euler),ob.y=0,this.nonColliderRotOffset.makeRotationFromEuler(ob)),mh.setFromAxisAngle(z5e,this.rot.x),bv.setFromAxisAngle(dc,this.rot.y),bv.multiply(mh),mh.setFromAxisAngle(k5e,this.rot.z),bv.multiply(mh),this.quaternion.copy(bv),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=Up.copy(n).multiplyScalar(t/this.pixelsPerMeter),a=null;this.didHit=!1;let o=new P;for(let h=0;h<5;h++){let d=s.length(),c=ab.copy(s).normalize();if(a=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(o),this.colliderWorldQuat,c,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 v=this.sharedGameControlGlobals.entityToCollisionEvents[p?.uuid];if(v){for(let y of v)if(y.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}}y.dispatch(_),p.dispatchEvent(p$)}}}let f=_0e.set(a.normal2.x,a.normal2.y,a.normal2.z).applyQuaternion(this.colliderWorldQuat),m=b0e.copy(c).multiplyScalar(a.time_of_impact).dot(f),g=a.time_of_impact;if(g===0&&(this.position.y+=this.offset*this.pixelsPerMeter),m>this.offset&&(g=a.time_of_impact*(m-this.offset)/m,o.addScaledVector(c,g)),s.copy(c).multiplyScalar(d-g),Math.acos(-f.y)>this.slopeThresh){let v=this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(o),y=ab.copy(a.witness2).applyQuaternion(this.colliderWorldQuat);y.y=0;let _=v.add(y);_.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),Go.copy(this.position).divideScalar(this.pixelsPerMeter),mh.copy(this.quaternion).premultiply(this.groundTilt).multiply(this.objXZQuat);let l=this.object.rigidBody,u=l!==void 0&&H5e.copy(Go).sub(l.translation()).lengthSq()>1;l!==void 0&&(u?(l.setTranslation(Go,!0),l.setRotation(mh,!0)):(l.setNextKinematicTranslation(Go),l.setNextKinematicRotation(mh)))}else{let s=this.onObject?1:5,a=n.multiplyScalar(t/s);for(let o=0;o<s;o++)this.position.add(a),this.collisionAdjustment(t/s)}else this.position.addScaledVector(n,t);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);gj.lookAt(a,s,dc).setPosition(a),gj.decompose(this.targetPos,this.targetQuat,Go),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=ht.clamp(this.euler.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel)),this.euler.x=ht.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(q5e),!(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(W5e),0))}updateFollowArms(){this.objectToTarget.copy(this.objectToTarget0),this.targetToCamera.copy(this.targetToCamera0);let e,t=mh.setFromAxisAngle(dc,this.cameraYAxis==="Limit"&&this.orientMode!=="radial"?ht.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(t),e=this.cameraXAxis==="Limit"?ht.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):ht.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset+1e-6,this.PI_2+this.cameraPolarOffset-1e-6);let i=Go.copy(this.cameraPolarAxis0);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&i.applyQuaternion(t);let r=bv.setFromAxisAngle(i,e);this.cameraYAxis!=="Locked"&&this.targetToCamera.applyQuaternion(t),this.cameraXAxis!=="Locked"&&this.targetToCamera.applyQuaternion(r)}groundTiltAdjustment(e){180*dc.angleTo(e)/Math.PI<15||180*dc.angleTo(e)/Math.PI>85?mh.identity():mh.setFromUnitVectors(dc,e),this.groundTilt.slerp(mh,.06),this.groundTiltInv.copy(this.groundTilt).invert()}collisionAdjustment(e){let t=b0e.set(0,0,0);this.object.matrix.compose(this.position,this.quaternion,this.scale);let i=gj.multiplyMatrices(this.object.matrix,this.objXZRotMat).multiply(this.collider.matrix).decompose(Go,mh,Up).compose(Go,mh,w0e);this.sharedGameControlGlobals.entitiesWithTransformAnim.forEach(n=>{if(n===this.object||n.isDescendantOf(this.object)||!n.bvhGeometry||!n.bvhGeometry.boundsTree)return;au.makeEmpty(),n.updateMatrixWorldRigid();let s=n.matrixWorldRigid,a=x0e.copy(s).invert(),o=F5e.copy(x0e).multiply(i);ka.copy(this.collider.segment),ka.start.applyMatrix4(o),ka.end.applyMatrix4(o);let l=_0e.copy(this.position).applyMatrix4(a);au.expandByPoint(ka.start),au.expandByPoint(ka.end),au.min.addScalar(-this.collider.radius),au.max.addScalar(this.collider.radius),n.bvhGeometry.boundsTree.shapecast({boundsTraverseOrder:u=>u.distanceToPoint(ka.end),intersectsBounds:u=>u.intersectsBox(au),intersectsTriangle:u=>{let h=Go,d=Up,c=u.closestPointToSegment(ka,h,d);if(c<this.collider.radius){let p=this.collider.radius-c,f=d.sub(h).normalize(),m=ab.copy(l);m.addScaledVector(f,p);let g=m.applyMatrix4(s).sub(this.position);t.add(g),ka.start.addScaledVector(f,p),ka.end.addScaledVector(f,p)}}})}),au.makeEmpty(),ka.copy(this.collider.segment),ka.start.applyMatrix4(i),ka.end.applyMatrix4(i),au.expandByPoint(ka.start),au.expandByPoint(ka.end),au.min.addScalar(-this.collider.radius),au.max.addScalar(this.collider.radius),this.sharedGameControlGlobals.staticMeshBVH?.shapecast({boundsTraverseOrder:n=>n.distanceToPoint(ka.end),intersectsBounds:n=>n.intersectsBox(au),intersectsTriangle:n=>{let s=Go,a=Up,o=n.closestPointToSegment(ka,s,a);if(o<this.collider.radius){let l=this.collider.radius-o,u=a.sub(s).normalize();this.alignToGround&&this.groundTiltAdjustment(u),t.addScaledVector(u,l),ka.start.addScaledVector(u,l),ka.end.addScaledVector(u,l)}}}),this.onObject=Math.abs(t.y)>Math.abs(e*this.velocity.y*.25),this.onObject&&this.dispatchStopEvent("jump");let r=Math.max(0,t.length()-1e-5);t.normalize().multiplyScalar(r),this.position.add(t)}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()}},JEe=f$;JEe.isLocked=!1,le(),DA(),Z4(),Sw(),xw();var eAe,tAe,yj,$5e=new Promise(e=>{eAe=e});function X5e(e){return yj||(yj=async function(){let t=e??"https://cdn.spline.design/@splinetool/runtime@2.0.37/build";typeof window<"u"&&(tAe=new URL(t.endsWith("/")?t:`${t}/`,window.location.href).href);let i=import("./navmesh.js"),[r,n]=await Promise.all([i,fetch(`${t}/navmesh.wasm`).then(o=>o.arrayBuffer())]),s=r.default,a=await s({wasmBinary:n});eAe(a)}(),yj)}Hr();var iAe,mr,po,Y5e=e=>`
12896
12896
  (async function() {
12897
12897
  const [wasmImport, wasmBinary] = await Promise.all([
12898
12898
  import('${e}' + 'navmesh.js'),
@@ -12902,7 +12902,7 @@ void main() {
12902
12902
  self.module = await wasmModule({ wasmBinary });
12903
12903
  postMessage('ready');
12904
12904
  })();
12905
- `,K5e={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};$5e.then(e=>{iAe=e,mr=new e.Vec3,po=new e.Vec3});var Z5e=new P,Q5e=class{constructor(e=!1,t=!1){this.usePhysics=e,this.isExport=t,this.onPointerDown=i=>{if(vi.length!==1)return;let{raycaster:r,page:n}=this.eventContext;this.eventContext.updateRaycaster(i);let s=n.raycastWithClones(r);if(s.length!==0){if(this.gameControl){let a=Z5e.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,r)=>n=>{let s;if(n instanceof Bg){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(n instanceof Rh)s=n.object;else if(s=n,s.dataPatched.cloner?.disabled===!1&&s.dataPatched.cloner?.hideBase&&s.dataPatched.physics?.fusedBody!==!0)return!0;if(r&&!s.userData.navmesh)return;let a=s.dataPatched;if(!a.visible&&a.physics?.enabled!==!0)return!0;n.updateMatrixWorldRigid();let o=c4(a),l=s.userData.hasDestroy,u=s.userData.hasDrag,h=!1,d=!1;for(let c of a.events)c.data.disabled!==!0&&(c.data.type==="GameControl"?h=!0:c.data.type==="Follow"&&(d=!0));if(h||o||d||l||u)return!0;if(this.usePhysics&&a.physics?.rigidBody==="dynamic"){if(this.usePhysics&&a.physics?.fusedBody)return!0}else if("geometry"in n&&n.geometry&&i.push(nf(n.geometry,n.matrixWorld)),this.usePhysics&&a.physics?.fusedBody)return n.traverseObject((c,p)=>{if(p===0)return;let f;if(c instanceof Bg){if(!c.objectForSample)return c.object.dataPatched.physics.fusedBody===!0&&c.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(c.objectForSample.dataPatched.physics.fusedBody)return;f=c.object}else if(c instanceof Rh)f=c.object;else if(f=c,c.dataPatched.cloner?.hideBase)return!0;let m=f.dataPatched;if(!m.visible&&m.physics?.enabled!==!0)return!0;"geometry"in c&&c.geometry&&i.push(nf(c.geometry,c.matrixWorld))}),!0},this.traverseNoPhysics=(i,r)=>n=>{let s;if(n instanceof Bg)return;s=n instanceof Rh?n.object:n;let a=s.dataPatched;if(a.physics.enabled==="visibility"?!a.visible:!a.physics.enabled)return!0;if(r&&!s.userData.navmesh)return;let o=n.geometry,l=s.userData.hasDestroy===!0,u=s.userData.hasDrag===!0;if(c4(a)||l||u||s.dataPatched.events.some(h=>h.data.disabled!==!0&&h.data.type==="GameControl"))return!0;o&&i.push(nf(o,n.matrixWorld))},this.navmeshWasm=iAe,this.navMesh=new this.navmeshWasm.NavMesh,this._workerURL=URL.createObjectURL(new Blob([(t?Y5e(tAe??"https://cdn.spline.design/@splinetool/runtime@2.0.35/build/"):`
12905
+ `,K5e={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};$5e.then(e=>{iAe=e,mr=new e.Vec3,po=new e.Vec3});var Z5e=new P,Q5e=class{constructor(e=!1,t=!1){this.usePhysics=e,this.isExport=t,this.onPointerDown=i=>{if(vi.length!==1)return;let{raycaster:r,page:n}=this.eventContext;this.eventContext.updateRaycaster(i);let s=n.raycastWithClones(r);if(s.length!==0){if(this.gameControl){let a=Z5e.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,r)=>n=>{let s;if(n instanceof Bg){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(n instanceof Rh)s=n.object;else if(s=n,s.dataPatched.cloner?.disabled===!1&&s.dataPatched.cloner?.hideBase&&s.dataPatched.physics?.fusedBody!==!0)return!0;if(r&&!s.userData.navmesh)return;let a=s.dataPatched;if(!a.visible&&a.physics?.enabled!==!0)return!0;n.updateMatrixWorldRigid();let o=c4(a),l=s.userData.hasDestroy,u=s.userData.hasDrag,h=!1,d=!1;for(let c of a.events)c.data.disabled!==!0&&(c.data.type==="GameControl"?h=!0:c.data.type==="Follow"&&(d=!0));if(h||o||d||l||u)return!0;if(this.usePhysics&&a.physics?.rigidBody==="dynamic"){if(this.usePhysics&&a.physics?.fusedBody)return!0}else if("geometry"in n&&n.geometry&&i.push(nf(n.geometry,n.matrixWorld)),this.usePhysics&&a.physics?.fusedBody)return n.traverseObject((c,p)=>{if(p===0)return;let f;if(c instanceof Bg){if(!c.objectForSample)return c.object.dataPatched.physics.fusedBody===!0&&c.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(c.objectForSample.dataPatched.physics.fusedBody)return;f=c.object}else if(c instanceof Rh)f=c.object;else if(f=c,c.dataPatched.cloner?.hideBase)return!0;let m=f.dataPatched;if(!m.visible&&m.physics?.enabled!==!0)return!0;"geometry"in c&&c.geometry&&i.push(nf(c.geometry,c.matrixWorld))}),!0},this.traverseNoPhysics=(i,r)=>n=>{let s;if(n instanceof Bg)return;s=n instanceof Rh?n.object:n;let a=s.dataPatched;if(a.physics.enabled==="visibility"?!a.visible:!a.physics.enabled)return!0;if(r&&!s.userData.navmesh)return;let o=n.geometry,l=s.userData.hasDestroy===!0,u=s.userData.hasDrag===!0;if(c4(a)||l||u||s.dataPatched.events.some(h=>h.data.disabled!==!0&&h.data.type==="GameControl"))return!0;o&&i.push(nf(o,n.matrixWorld))},this.navmeshWasm=iAe,this.navMesh=new this.navmeshWasm.NavMesh,this._workerURL=URL.createObjectURL(new Blob([(t?Y5e(tAe??"https://cdn.spline.design/@splinetool/runtime@2.0.37/build/"):`
12906
12906
  (async function() {
12907
12907
  const [wasmImport, wasmBinary] = await Promise.all([
12908
12908
  import(self.location.origin + '/_libraries/navmesh.js'),
@@ -12977,7 +12977,7 @@ onmessage = function(messageEvent) {
12977
12977
  [${uO}] { pointer-events: none; }
12978
12978
  [${uO}] > * { pointer-events: auto; }
12979
12979
  [${uO}] [data-spline-passthrough] { pointer-events: none; }
12980
- `,RAe=class{constructor(e,t,i,r,n){this.container=e,this.host=t,this.observer=i,this.previousSplineGlobal=r,this.removeLateLifecycleShim=n}static mount(e,t,i,r){if(typeof document>"u")return null;let n=t.parentElement;if(!n)return null;getComputedStyle(n).position==="static"&&(n.style.position="relative");let s=document.createElement("div");s.setAttribute(uO,"");let a=s.style;a.position="absolute",a.overflow="hidden";let o=()=>{a.left=`${t.offsetLeft}px`,a.top=`${t.offsetTop}px`,a.width=`${t.offsetWidth}px`,a.height=`${t.offsetHeight}px`};o();let l=new ResizeObserver(o);l.observe(t),l.observe(n);let u=document.createElement("style");u.textContent=AVe,s.appendChild(u);let h=new DOMParser().parseFromString(i,"text/html"),d=Array.from(h.querySelectorAll("script"));for(let y of d)y.remove();for(let y of Array.from(h.head.children))(y.tagName==="STYLE"||y.tagName==="LINK"&&y.rel==="stylesheet")&&s.appendChild(y);for(;h.body.firstChild;)s.appendChild(h.body.firstChild);n.insertBefore(s,t.nextSibling);let c=new Map,p=new rX(AAe(e,t,r),(y,_)=>{y==="warn"?console.warn(`[spline html] ${_}`):y==="error"&&console.error(`[spline html] ${_}`)},(y,_)=>{let b=c.get(y);if(b)for(let x of b)try{x(_)}catch(w){console.error(w)}}),f=(y,_)=>{try{return Promise.resolve(p.execute(y,_))}catch(b){return Promise.reject(b)}},m={ready:Promise.resolve(),setVariable:(y,_)=>f("setVariable",[y,_]),setVariables:y=>f("setVariables",[y]),getVariable:y=>f("getVariable",[y]),getVariables:()=>f("getVariables",[]),getAllObjects:()=>f("getAllObjects",[]),findObjectByName:y=>f("findObjectByName",[y]),findObjectById:y=>f("findObjectById",[y]),getGeometry:(y,_)=>f("getGeometry",[y,_??{}]),updateObject:(y,_)=>f("updateObject",[y,_]),createObject:(y,_)=>f("createObject",[y,_??{}]),createCustomMaterial:y=>f("createCustomMaterial",[y]),setMaterial:(y,_)=>f("setMaterial",[y,_]),cloneObject:(y,_)=>f("cloneObject",[y,_??{}]),removeObject:y=>f("removeObject",[y]),spawnObject:(y,_)=>f("spawnObject",[y,_??{}]),destroyObject:y=>f("destroyObject",[y]),setInstanceTransforms:(y,_)=>f("setInstanceTransforms",[y,_??null]),emitEvent:(y,_)=>f("emitEvent",[y,_]),emitEventReverse:(y,_)=>f("emitEventReverse",[y,_]),requestRender:()=>f("requestRender",[]),addEventListener:(y,_)=>{if(typeof _!="function")return;let b=c.get(y);b||(b=new Set,c.set(y,b),f("listenEvent",[y])),b.add(_)},removeEventListener:(y,_)=>{let b=c.get(y);!b||(b.delete(_),b.size===0&&(c.delete(y),f("unlistenEvent",[y])))}},g=window.spline;window.spline=m;let v=function(){if(typeof document>"u"||document.readyState==="loading")return()=>{};let y=[],_=(x,w)=>{let S=new Set,M=x.addEventListener.bind(x),T=x.removeEventListener.bind(x);Object.defineProperty(x,"addEventListener",{configurable:!0,writable:!0,value:(E,A,R)=>{if(M(E,A,R),!w.includes(E)||A==null)return;let N={type:E,listener:A};S.add(N),queueMicrotask(()=>{!S.delete(N)||((D,O,z)=>{let U=new Event(z);try{typeof O=="function"?O.call(D,U):O.handleEvent?.(U)}catch(G){console.error(G)}})(x,N.listener,N.type)})}}),Object.defineProperty(x,"removeEventListener",{configurable:!0,writable:!0,value:(E,A,R)=>{T(E,A,R);for(let N of S)N.type===E&&N.listener===A&&S.delete(N)}}),y.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)}})}}),y.push(()=>{b?Object.defineProperty(window,"onload",b):delete window.onload}),()=>{for(let x of y)x()}}();for(let y of d){let _=document.createElement("script");for(let b of Array.from(y.attributes))_.setAttribute(b.name,b.value);y.src?_.async=!1:_.textContent=y.textContent,s.appendChild(_)}return new RAe(s,p,l,g,v)}dispose(){this.removeLateLifecycleShim(),this.host.dispose(),this.observer.disconnect(),this.container.remove(),window.spline!==void 0&&(window.spline=this.previousSplineGlobal)}};function PAe(e){return typeof e=="object"&&e!==null&&e.isMaterial===!0}function Rve(e){if(typeof e.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(!PAe(e.material))return{options:e};let t=e.material;if(t.isNodeMaterial===!0){let i=HH()?.NodeMaterial;if(i!==void 0&&t instanceof i)return{options:{...e,material:void 0},material:t};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(t.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:{...e,material:void 0},material:t}}Wt(),Nr(),le(),xbe(),bu(),Nr(),Wt(),qIe(),$f();var CVe=new Set(["name","parent","position","rotation","scale","visible","castShadow","receiveShadow","color","material"]),Pve="'Cube', 'Sphere', 'Plane', 'Rectangle', 'Ellipse', 'Triangle', 'Polygon', 'Star', 'Cone', 'Cylinder', 'Pyramid', 'Torus', 'TorusKnot', 'Dodecahedron', 'Icosahedron', 'Helix', 'Backdrop', 'Lathe', 'Text', 'CustomMesh', 'Group', 'PointLight', 'SpotLight', 'DirectionalLight'",RVe={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"},PVe={group:"Empty",empty:"Empty",pointlight:"PointLight",spotlight:"SpotLight",directionallight:"DirectionalLight"},DVe={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')."},NVe={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"},IVe={Empty:"Group",PointLight:"Point Light",SpotLight:"Spot Light",DirectionalLight:"Directional Light"};function RA(e,t){return e===void 0?[t[0],t[1],t[2]]:Array.isArray(e)?[e[0]??t[0],e[1]??t[1],e[2]??t[2]]:[e.x??t[0],e.y??t[1],e.z??t[2]]}function DAe(e){return typeof e=="number"?[e,e,e]:RA(e,[1,1,1])}function N$(e){let t=new Fr(0,0,0,1);return t.setStyle(e),{r:t.r,g:t.g,b:t.b}}function Dve(e,t){let i=e.material??(e.color!==void 0?{color:e.color}:void 0);if(i===void 0)return is.defaultColorMaterial(Nve(eo),"physical","layer1","layer2");if(typeof i=="string"){for(let[a,o]of Object.entries(t.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)||ot.NAMES[o]!==void 0}(i))return is.defaultColorMaterial(N$(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)"}(t)}) 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(PAe(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 r=i.color!==void 0?N$(i.color):Nve(eo),n=is.defaultColorMaterial(r,"physical","layer1","layer2"),s=n.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=n.layers.find(o=>o.data.type==="color");a&&Object.assign(a.data,{alpha:i.alpha})}return n}function Nve(e){return{r:(e>>16&255)/255,g:(e>>8&255)/255,b:(255&e)/255}}function OVe(e){let t=lf.defaultData("TextGeometry"),{text:i,...r}=e,n=r.fontSize;return n!==void 0&&r.width===void 0&&(r.width=350*n/16),n!==void 0&&r.height===void 0&&(r.height=50*n/16),Object.assign(t,r),i!==void 0&&Object.assign(t,{text:{textValue:String(i)}}),t}function WN(e){return Array.isArray(e)?e:!ArrayBuffer.isView(e)||e instanceof DataView?null:Array.from(e)}function LVe(e,t){return n_e({userData:{type:e,...GH[e].normalizeInputs({parameters:t})}})}function BVe(e,t,i){let{objectType:r,geometryType:n}=e,s=function(l){let u={};for(let[h,d]of Object.entries(l))!CVe.has(h)&&d!==void 0&&(u[h]=d);return u}(t),a={states:new Nt,events:new Nt};if(r==="Mesh"&&n){if(n==="NonParametricGeometry"){let{geometry:l,doubleSide:u}=function(h){let d=WN(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 c=d.length/3;if(c>6e4)throw new Error(`createObject('CustomMesh'): too many vertices (${c}); keep it under 60000.`);let p=WN(h.indices);if(p&&p.length){let _=p.find(b=>!Number.isInteger(b)||b<0||b>=c);if(_!==void 0)throw new Error(`createObject('CustomMesh'): index ${_} is out of range (mesh has ${c} vertices).`)}else p=null;let f=new At;f.setAttribute("position",new Et(d,3));let m=WN(h.normals),g=m!==null&&m.length===d.length;g&&f.setAttribute("normal",new Et(m,3));let v=WN(h.uvs);v&&v.length===2*c&&f.setAttribute("uv",new Et(v,2));let y=!1;if(!g){let _=p??Array.from({length:c},(w,S)=>S),{closed:b,inverted:x}=function(w,S){let M=w.length/3,T=new Map,E=new Array(M);for(let D=0;D<M;D++){let O=`${Math.round(1e4*w[3*D])},${Math.round(1e4*w[3*D+1])},${Math.round(1e4*w[3*D+2])}`,z=T.get(O);z===void 0?(T.set(O,D),E[D]=D):E[D]=z}let A=new Map;for(let D=0;D+2<S.length;D+=3){let O=E[S[D]],z=E[S[D+1]],U=E[S[D+2]];for(let[G,j]of[[O,z],[z,U],[U,O]]){if(G===j)continue;let K=G<j?G+"_"+j:j+"_"+G;A.set(K,(A.get(K)??0)+1)}}let R=A.size>0;for(let D of A.values())if(D!==2){R=!1;break}if(!R)return{closed:!1,inverted:!1};let N=0;for(let D=0;D+2<S.length;D+=3){let O=3*S[D],z=3*S[D+1],U=3*S[D+2],G=w[O],j=w[O+1],K=w[O+2],q=w[z],se=w[z+1],ve=w[z+2],oe=w[U],fe=w[U+1],_e=w[U+2];N+=G*(se*_e-ve*fe)+j*(ve*oe-q*_e)+K*(q*fe-se*oe)}return{closed:!0,inverted:N<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||(y=!0)}return p&&f.setIndex(p),g||f.computeVertexNormals(),{geometry:n_e({userData:{type:"NonParametricGeometry",parameters:{subdivisions:0}},data:f.toJSON().data}),doubleSide:y}}(s);Object.assign(a,yc.defaultData,{geometry:l,materials:[Dve(t,i)]}),u&&(a.side=2)}else Object.assign(a,yc.defaultData,{geometry:n==="TextGeometry"?OVe(s):LVe(n,s),material:Dve(t,i)});t.castShadow!==void 0&&(a.castShadow=t.castShadow),t.receiveShadow!==void 0&&(a.receiveShadow=t.receiveShadow)}else r==="Empty"?Object.assign(a,rL.defaultData):(Object.assign(a,nL.defaultData(r),s),t.color!==void 0&&(a.color=N$(t.color)));a.visible=t.visible??!0,a.position=RA(t.position,[0,0,0]),a.rotation=RA(t.rotation,[0,0,0]),a.scale=DAe(t.scale);let o=(n&&NVe[n])??IVe[r]??r;return a.name=t.name??NAe(o,i.scene.objects),a}function NAe(e,t){let i=new Set;if(t.traverse((n,s)=>{i.add(s.name??"")}),!i.has(e))return e;let r=2;for(;i.has(`${e} ${r}`);)r++;return`${e} ${r}`}function IAe(e,t){let i=ht.generateUUID();if(e.data.type==="Component")return{data:{..._f.fromComponentData(e),name:e.data.name+" Instance"},id:i,fi:e.fi,children:[]};t[e.id]=i;let r=e.data;return r.type==="Empty"&&r.animations?.length&&(r={...r,animations:r.animations.map(([n,s,a])=>{let o=ht.generateUUID(),l=a.indexOf(n);return[o,s,l!==-1?a.slice(0,l)+o+a.slice(l+n.length):a]})}),{...e,id:i,data:r,children:e.children.map(n=>IAe(n,t))}}function UVe(e){let t={};return function(i,r){return bx(i,r,null)??i}(IAe(e,t),t)}function FVe(e){let t=Array.isArray(e)?e[0]:e,i=t.layers?.map(zVe)??[],r=t.layers?.find(n=>n.type==="light");return{layers:i,alpha:r?.node.alphaOverride?.value??1}}function zVe(e){return e.type==="texture"||e.type==="video"||e.type==="matcap"?{...e.data,updateTexture:t=>e.color.texture.image.updateSrc(t)}:{...e.data}}$f(),rs(),IX(),bu();var aM=new Fr(0,0,0,1),kVe={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:[]};Wt(),Wt();var VVe=new J;function Ive(e){let t=new Fr(0,0,0,1);try{t.setStyle(e)}catch(i){console.error(i)}return t}var OAe=class{constructor(e,{renderOnDemand:t,renderMode:i="auto",wasmPath:r,renderer:n,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<a_e?this._skipRender=!1:this.currentTAAFrame=0):this.currentTAAFrame=0,this._scene?.traverseVisibleEntity(o=>{o.type==="ParticleSystem"&&(o.update(this.dt),this._skipRender=!1),Qy(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=VVe.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=nA(this._resize,10),this._onScroll=a=>{this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect())},this.canvas=e,this._htmlContentMode=s,this.renderMode=t?"auto":i,r!==void 0&&(this._wasmPath=function(a){let o=a.length;for(;o>0&&"/".includes(a[o-1]);)o--;return a.slice(0,o)}(r)),this._rendererBackend=n??"webgl",n===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=typeof navigator<"u"&&"gpu"in navigator?"webgpu":"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(()=>(n4e(),cSe)).then(({Perfs:a})=>{this._perfs=new a({x:10,y:10})}),function(a){a.addEventListener("pointerdown",oJ,!0),a.addEventListener("pointerdown",jC,!0),a.addEventListener("pointermove",jC,!0),a.addEventListener("pointerup",F1,!0),a.addEventListener("pointercancel",F1,!0),a.addEventListener("pointerleave",F1,!0),window.addEventListener("keydown",lJ,!0),window.addEventListener("keyup",hJ,!0)}(e)}async _createRenderer(){if(this._rendererBackend==="webgpu"&&this._rendererAuto)try{await navigator.gpu?.requestAdapter()||(this._rendererBackend="webgl")}catch{this._rendererBackend="webgl"}if(this._rendererBackend==="webgpu")try{let{createWebGPUSplineRenderer:e,isWebGPUSupported:t}=await Promise.resolve().then(()=>(P9(),rO));t();let i=!0,r=!1,n=this._data?.scene.publish?.asyncShaderCompilation!==!1;try{let a=new URLSearchParams(window.location.search),o=a.get("bundles");o==="rerecord"?i="rerecord":(o==="off"||o==="0"||o==="false"||o==="no")&&(i=!1),r=a.get("forcegl")==="1";let l=a.get("asynccomp");l==="off"||l==="0"||l==="false"||l==="no"?n=!1:(l==="on"||l==="1"||l==="true"||l==="always")&&(n=!0)}catch{}let s=await e({canvas:this.canvas,antialias:!1,alpha:!0,powerPreference:"high-performance",sceneBundles:!r&&i,forceWebGL:r,asyncCompilation:!r&&n});return s.onBackgroundWorkReady=()=>{this._skipRender=!1,this._renderRequested=!0},s.skyAnimationAllowed=!0,s}catch(e){console.error("[spline] Failed to initialize the WebGPU renderer, falling back to WebGL:",e),this._rendererBackend="webgl"}{let{SplineRenderer:e,rendererGlobals:t}=await Promise.resolve().then(()=>(Tge(),n$));try{new URLSearchParams(window.location.search).get("taa")==="off"&&(t.taaEnabled.value=!1)}catch{}return new e({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 e=window.devicePixelRatio||1,t=this.canvas.clientWidth||300,i=this.canvas.clientHeight||150;this.canvas.width=t*e,this.canvas.height=i*e;let r=this.canvas.getContext("2d");r&&(r.scale(e,e),r.fillStyle="rgba(127, 127, 127, 0.85)",r.font="13px system-ui, -apple-system, Segoe UI, Roboto, sans-serif",r.textAlign="center",r.textBaseline="middle",r.fillText("This scene requires a WebGPU-capable browser.",t/2,i/2))}catch{}this.canvas.dispatchEvent(new CustomEvent("splineerror",{bubbles:!0,detail:{reason:"webgpu-required"}}))}async load(e,t,i){(function(n){let s="The Spline Runtime only accepts .splinecode files that are generated from Spline export panel.";n.endsWith(".spline")?console.warn(s+" The .spline files are only meant to be used by the Editor."):n.endsWith(".splinecode")||console.warn(s)})(e),this.disposed=!1;let r=await(await fetch(e,i)).arrayBuffer();await this.start(r,{variables:t})}async start(e,{interactive:t=!0,variables:i}={}){if(this.disposed)return;Bs.init();let r=await async function(c){let[p,f]=bM(sA.deserialize(new Uint8Array(c)));if((p.schema??0)!==131){let{updateDocumentSchema:m}=await Promise.resolve().then(()=>(P4(),Z1e));m(p)}return f.result().data}(e);this._data=r;let n=function(c){let p=[];return c.scene.objects.traverse((f,m)=>{m.type==="Mesh"&&m.geometry.type==="NonParametricGeometry"&&m.geometry.data.draco!==void 0&&p.push(m)}),p}(r);r.version&&(0,MVe.default)(r.version,"2.0.35")>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(c){pW=c}(this._wasmPath));let s=async function(){}();await Promise.all([s,n.length&&Eve(this._wasmPath),lie(r)&&JIe(this._wasmPath),WOe(r)&&ROe(this._wasmPath),Zy.physicsEnabled(r.scene.objects)&&N5e(this._wasmPath),gte(r)&&h0e(),Rie(r)&&pLe(),lOe(r)&&oOe(),t0e(r)&&s.then(()=>gH()?.loadHanaUIRUNTIME()),M5e(r)&&X5e(this._wasmPath)].filter(Boolean)),n.length&&await Ave(n),this._eventManager?.deactivate(),this._controls?.deactivate(),this._scene?.dispose();let a=r.scene.publish.renderer;if(this._rendererAuto&&a==="webgl")this._rendererBackend="webgl";else if(this._rendererAuto&&a==="webgpu"){if(this._rendererBackend!=="webgpu"||!await navigator.gpu?.requestAdapter().catch(()=>null))return void this._failWebGPURequired();this._rendererAuto=!1}let o=function(c){let p=new Set;return c.scene.objects.traverse((f,m)=>{if(m.type!=="Page")return;let g=m.postprocessing;if(g&&typeof g=="object"&&g.enabled===!0)for(let[v,y]of Object.entries(g))v!=="enabled"&&y&&typeof y=="object"&&y.enabled===!0&&p.add(v)}),[...p]}(r);if(this._rendererBackend==="webgpu")try{await Promise.all([Promise.resolve().then(()=>(P9(),rO)),TVe(o)]),this._renderer||(this._renderer=await this._createRenderer())}catch(c){console.error("[spline] Failed to load the WebGPU material backend, using WebGL:",c),this._rendererBackend="webgl"}this._rendererBackend!=="webgpu"&&await Promise.all([Promise.resolve().then(()=>(Tge(),n$)),SVe(o)]),function(c){LA=c}(this._rendererBackend==="webgpu"?"webgpu":"webgl");let l=new vVe(r);if(l.resetPersonalCameraFromDocumentData(),this._scene=l.scene,this._sharedAssetsManager=l.sharedAssets,this._camera=this._scene.activeCamera,window.location.search.includes("merge-geometries")){let{mergeStaticGeometries:c}=await Promise.resolve().then(()=>(hFe(),pEe)),p=performance.now();c(r,l.scene);let f=performance.now();console.log("Merged geometries in ",f-p," ms")}lie(r)&&this._scene.traverse(c=>{Uc(c)&&c.recomputeBoolean()}),this._sharedAssetsManager.setRequestRender(()=>{this._requestRenderAutoMode(),this._scene?.traverse(c=>{ix(c)&&c.pendingMediaLoad&&c.update({scene:this._scene,shared:this._sharedAssetsManager})})}),this._scene?.traverse(c=>{c.type==="ParticleSystem"&&(c.wakeUp(),c.data.autoPlay?c.start():c.stop()),Qy(c)&&c.setPlayMode(!0)});let u=Object.keys(r.shared.fonts).flatMap(c=>{let p=this._sharedAssetsManager.getFont(c);return p?[p.loadingPromise]:[]});if(Promise.all(u).then(()=>{this.disposed||(l.scene.markNeedsUpdateRendererDirty(),this._requestRenderAutoMode())}),gte(r)&&function(c){if(Zy.physicsEnabled(c.scene.objects))return!0;let p=!1;return c.scene.objects.traverse((f,m)=>{if(m.events){if(Array.isArray(m.events)){for(let g of m.events)if(g.data.disabled!==!0&&g.data.type==="GameControl"&&g.data.collisionEnabled){p=!0;break}}else for(let g of Object.values(m.events))if(g.disabled!==!0&&g.type==="GameControl"&&g.collisionEnabled){p=!0;break}}}),p}(r)&&await Promise.all(u),t0e(r)){let c=[];this._scene.traverseEntity(p=>{(Xo(p)||p instanceof Ks)&&p.uiCanvas&&c.push(p.uiCanvas)}),await Promise.all(c.map(p=>p.promise))}if(this._scene.rewriteEventsBeforeGoToPlayMode(),yK(this._scene.activePage,this._sharedAssetsManager),this._renderer||(this._renderer=await this._createRenderer()),!this._rendererConfigured){this._rendererConfigured=!0,this._renderer.hdTransmission=r.scene.publish.hdTransmission===!0;let c=()=>/Mobi|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),p=this._getPixelRatio(c()?r.scene.publish.settings.web.pixelRatioMobile:r.scene.publish.settings.web.pixelRatioDesktop);if(this._renderer.setPixelRatio(p),this._renderer.pipeline.enableUIOverlay(),this._renderer.pipeline.addEventListener("smaaloaded",this._requestRenderAutoMode),r.shared.images.SplineWatermark){let f=this._sharedAssetsManager.getImage("SplineWatermark");await f.loadPromise;let m=f.getTexture(1001);this._renderer.pipeline.setWatermark(m)}}Rie(r)&&this._scene.initializeSplatViewer(),r.scene.blueNoiseTextureData!==void 0&&this._renderer.pipeline.updateBlueNoiseTexture(r.scene.blueNoiseTextureData);let h=Object.values(r.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 HFe(this._renderer,this._camera,new J(this._viewportWidth,this._viewportHeight)),this._frameView.enableResponsive=(h.allowResponsive??!1)&&h.preset==="fullscreen"),t){let c=new SFe(this._renderer,this.data.scene.publish,this._scene,()=>this._scene.activeCamera,this._sharedAssetsManager,this._requestRenderAutoMode,!0,h);this._scene.updateMatrixWorld(!0),this._controls=new B5e(c),this._animationControls=new bVe(this._scene,this._requestRenderAutoMode),this._eventManager=new FFe(r.scene.publish,this._controls,this._animationControls,c,r.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=r.scene.publish.htmlContent?.html;if(t&&d&&this._htmlContentMode!=="none"){let c={shared:this._sharedAssetsManager,findEntity:p=>this._scene?.getObjectByProperty("uuid",p)??this._scene?.getObjectByName(p)};this._htmlContentOverlay=(this._htmlContentMode==="inline"?RAe.mount(this,this.canvas,d,c):CAe.mount(this,this.canvas,d,c))??void 0}}setVariables(e){if(this._data!==void 0){let t=Object.entries(e);for(let[i,r]of t)this.setVariable(i,r)}}setVariable(e,t){let i=this._getVariableByName(e);if(i&&!("dynamicVariableType"in i.data)){let r=t;typeof i.data.value=="number"?r=typeof t=="number"?t:typeof t=="boolean"?t===!0?1:0:parseFloat(t):typeof i.data.value=="boolean"?r=typeof t=="number"?!!t:typeof t=="boolean"?t:t.toLocaleLowerCase()!=="false"&&!!t:typeof i.data.value!="string"&&i.data.value.textValue!==void 0&&(r=t.toString());let n=typeof r=="string"?{textValue:r}:r;this._sharedAssetsManager?.updateVariable(i.id,n),this.requestRender(),this._requestRenderAutoMode()}else i===void 0?console.warn(`No variable named ${e} was found in your Spline file. Make sure to create it from Spline editor.`):"dynamicVariableType"in i.data&&console.warn(`Dynamic variables like ${e} cannot be updated from code.`)}getVariables(){let e={};return this._data&&this._data.shared.variables.forEach(t=>{e[t.data.name]===void 0&&(e[t.data.name]=this._getVariableValue(this._sharedAssetsManager.getVariable(t.id)))}),e}getVariable(e){let t=this._getVariableByName(e);if(t){let i=this._sharedAssetsManager.getVariable(t.id);return this._getVariableValue(i)}}_getVariableValue(e){return typeof e!="string"&&Eo.isTextValue(e)?Eo.getDisplayedValue(e):e}_getVariableByName(e){if(this._data){if(this._variablesCache.has(e))return this._variablesCache.get(e);let t=this._data.shared.variables.find(i=>i.data.name===e);return t&&this._variablesCache.set(e,t),t}}_getPixelRatio(e){switch(e){case 0:return window.devicePixelRatio;case 1:return 1;case 2:return 2}}findObjectById(e){let t=this._scene?.getObjectByProperty("uuid",e);return this._createProxyObject(t)}findObjectByName(e){let t=this._scene?.getObjectByName(e);return this._createProxyObject(t)}getAllObjects(){let e=[];return this._scene?.traverseEntity(t=>{if(!(t.uuid===a1||this._scene.isInvisibleObjects(t)||t instanceof Ks)){let i=this._createProxyObject(t);i&&e.push(i)}}),e}getSplineEvents(){return(this._eventManager?.handlers?.Spline).splineEvents}emitEvent(e,t){(this.findObjectById(t)||this.findObjectByName(t))?.emitEvent(e)}emitEventReverse(e,t){(this.findObjectById(t)||this.findObjectByName(t))?.emitEventReverse(e)}addEventListener(e,t){this.canvas.addEventListener(e,t)}removeEventListener(e,t){this.canvas.removeEventListener(e,t)}setZoom(e){this._controls?.orbitControls instanceof REe&&this._controls?.orbitControls.setZoom(e)}get eventManager(){return this._eventManager}get controls(){return this._controls}setSize(e,t){this._viewportWidth=e,this._viewportHeight=t,this._viewportMode=2,this._resize()}setBackgroundColor(e){let t=Ive(e);this._scene?.activePage.setBackgroundColor(t),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,xE&&xE.disposeAll(),this._sharedAssetsManager?.setRequestRender(()=>{}),this._sharedAssetsManager?.dispose(),this._sharedAssetsManager=void 0,this._proxyObjectCache.forEach(e=>{q9.unsubscribe(e)}),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(e){e.removeEventListener("pointerdown",oJ,!0),e.removeEventListener("pointerdown",jC,!0),e.removeEventListener("pointermove",jC,!0),e.removeEventListener("pointerup",F1,!0),e.removeEventListener("pointercancel",F1,!0),e.removeEventListener("pointerleave",F1,!0),window.removeEventListener("keydown",lJ,!0),window.removeEventListener("keyup",hJ,!0)}(this.canvas),document.removeEventListener("scroll",this._onScroll),Bs.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(e){this._eventManager?.updateUseWindowEvents(e)}get data(){return this._data}_createProxyObject(e){if(!this._scene)return;let t,i=this._scene;if(e==null)return;if(this._proxyObjectCache.has(e.uuid))return this._proxyObjectCache.get(e.uuid);e.traverseAncestors(h=>{h instanceof Ks&&(t=h.name)});let r=this._sharedAssetsManager,n={shared:r,scene:this._scene},s=h=>{if(h===null||h==="Base State")return null;if(h&&e.data.states){let d=e.data.states.find(c=>c.data.name===h);return d?d.id:void 0}},a="material"in e?e.material:void 0,o=e.materialOverride,l={name:e.name,uuid:e.uuid,visible:e.visible,intensity:e.intensity,position:e.position,rotation:e.rotation,scale:e.scale,type:e.data.type,page:t,material:o??(a?FVe(a):void 0),parentUuid:e.parent instanceof Ks||e instanceof Pg?void 0:e.parent?.uuid,emitEvent(h){e.dispatchEvent({type:"userEvent",eventName:h})},emitEventReverse(h){e.dispatchEvent({type:"userEvent",eventName:h,reverse:!0})},hide(){e.visible&&(e.visible=!1,n.shared.requestRender())},show(){e.visible||(e.visible=!0,n.shared.requestRender())},get state(){let h=e.stateSelection;if(h!==null)return e.data.states.find(({id:d})=>d===h)?.data.name},set state(h){let d;if(h!==void 0){let c=typeof h=="string"?e.data.states.find(({id:p})=>p===h):e.data.states[h];if(c)d=c.id;else{let p=typeof h=="string"?s(h):void 0;p&&(d=p)}}e.changeSelectedState(d??null,n),e.currentState=d??null,e.dispatchEvent({type:"completeState",state:d??null}),n.shared.requestRender()},transition(h){let d=MAe;if(d===null)return Ma("transitions","obj.transition()"),{transition(b){return this},play(){return this},pause(){return this},reset(){return this},seek(b){return this}};let c,p,f=this,m=[],g=!1,v=()=>{p=new dAe({delay:0,delayDirection:"start-once",direction:"normal",repeat:0,runMode:"Repeat"},m.map(b=>b.runner))},y={update(b){p?.update(b),p?.isPlaying!==!0&&Bs.remove(y)}},_={transition({from:b,to:x,duration:w,delay:S,...M}){let T=s(b);T===void 0&&(T=c);let E=s(x);return c=E,m.push(new d(e,T,E,{state:E,repeat:0,delay:S??0,delayDirection:"start-once",direction:"normal",duration:w??1e3,...M,...M.easing===6?Tg.defaultData:M.easing===5?tw.defaultData:{}},r,!1,i.activePage,{onBegin:()=>{(b&&T||b==="Base State"&&!T)&&(f.state=T??void 0)},onComplete:()=>{f.state=E??void 0}})),v(),this},play(){return p?(g=!0,p.play(Bs.time),p.isPlaying&&Bs.add(y),this):this},pause(){return p?.stop(),Bs.remove(y),this},reset(){return this.pause(),g=!1,v(),p?.seek(0),this},seek(b){let x=m.reduce((w,S)=>w+S.runner.duration,0);return x>0&&p?.seek(b/1e3/x),this}};return _.transition(h),(h.autoPlay??!0)&&queueMicrotask(()=>{g||_.play()}),_},set color(h){let d=Ive(h);if(SL.is(e))return void(e.color=d);if(!(e.type==="Mesh"&&"material"in e&&e instanceof bl))return;let c={r:d.r,g:d.g,b:d.b,a:d.a},p=e.materialOverride;if(p!==void 0){let g=p.color;return void(g?.isColor===!0&&typeof g.setStyle=="function"&&(g.setStyle(h),n.shared.requestRender()))}let f=Array.isArray(e.material)?e.material[0]:e.material,m=f.data.layers.find(g=>g.data.type==="color")?.id;if(m)f.updateByOp({type:0,path:["layers",m],props:{color:{...c}}},f.data,n);else{let g=f.data,v=g.layers.find(S=>S.data.type==="light");if(!v)return;let y=g.layers.indexOf(v)===0?v:null,_=g.layers.at(y?g.layers.indexOf(y)+1:0),b={type:4,fi:y?y.fi+(_?(_.fi-y.fi)/2:1):_?_.fi/2:1,id:ht.generateUUID(),data:{...os.defaultData("color"),color:c},localIndex:0},x=g.layers.insertAfterHelper(y?.id??null,1),w=g.layers.runOp({...b,fi:x[0]}).data;Object.assign(f.data,{layers:w}),f.updateByOp({...b,path:["layers"]},f.data,n)}}},u=q9(l,(h,d)=>{let c=e[h],p=function(f){return f.split(".")}(h);p[0]==="material"&&a&&o===void 0&&function(f,m,g){let v=Array.isArray(g)?g[0]:g;if(f[0]==="layers"){let y=parseInt(f[1]),_=v.layers[y],b=f[2];_&&b&&function(x,w,S){let M=x[0];try{if(function(T,E){return!!kVe[E]?.includes(T)}(M,S.type,x.slice(1)))if(M==="colors"){if(x.length<2)throw new Error("You cannot mutate the colors array, only its items");let T=parseInt(x[1]),E=S.getValue(M)?.[T];if(!E)throw new Error("Color index out of range");aM.setStyle(w),E.set(aM.r,aM.g,aM.b,aM.a)}else S.getValue(M)?.setStyle(w);else if(M==="texture"||M==="video"){let T=S.color;(function(E,A,R,N){let D=E[0];if(D==="repeat"||D==="offset"||D==="rotation"){let O=N.getNode("mat"),z=O&&typeof O.updateMatrix=="function"?O:N.getValue("mat");if(!z)return;if(D==="rotation")z.rotation=parseFloat(A);else{let U=E[1];if(U===void 0)A instanceof Array&&A.length===2&&Object.assign(z,{[D]:A});else{let G=z[D],j=parseInt(U)===0?[parseFloat(A),G[1]]:[G[0],parseFloat(A)];Object.assign(z,{[D]:j})}}z.updateMatrix()}else D==="wrapping"||D==="minFilter"||D==="magFilter"?D==="wrapping"?R.texture.wrap=A:R.texture[D]=A:D==="image"&&E[1]==="data"&&R.texture.image.updateSrc(A)})(x.slice(1),w,T,S)}else{let T=x[1],E=S.getValue(M);E?.isVector3&&T!==void 0||E?.isVector2&&T!==void 0?E.setComponent(parseInt(T),w):S.setValue(M,w)}}catch(T){console.error("Error setting material value",T)}}(f.slice(2),m,_)}else f[0]==="alpha"&&v.layers.forEach(y=>{y.type==="light"&&y.node.alphaOverride!==void 0&&(y.node.alphaOverride.value=m,m<1&&(v.transparent=!0))})}(p.slice(1),d,a),typeof c!="object"&&Object.getOwnPropertyDescriptor(e,h)?.writable&&(e[h]=d),this._requestRenderAutoMode(),e.updateMatrix()});return this._proxyObjectCache.set(e.uuid,u),u}setUIWasmUrl(e){(function(t){cL=t,I4?.setHanaUIWasmUrl(t)})(e)}pauseGameControls(){this._eventManager?.controlsManager.gameControl?.pause()}resumeGameControls(){this._eventManager?.controlsManager.gameControl?.resume()}async swapGeometry(e,t){let i;if(typeof t=="string"){if(!t.endsWith(".splinegeometry"))throw new Error("Only .splinegeometry format is supported");{let l=await(await fetch(t)).arrayBuffer();i=new Uint8Array(l)}}else i=t;let r=sA.deserialize(i),n="data"in r&&r.data.draco!==void 0;n&&await Eve(this._wasmPath);let s=this._scene?.getObjectByProperty("uuid",e)??this._scene?.getObjectByName(e);if(!s)return void console.warn(`Object ${e} not found`);if(s.data.type!=="Mesh"||!(s instanceof bl))return void console.warn(`Object ${e} is not a mesh`);let a=s,o={...a.data,geometry:r};n&&await Ave([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 u={...l.data};a.states||(a.states={}),a.states[l.id]=Eg.patch(o,u)}return i}_applyDocumentTransaction(e){this._data=e.data,this._scene&&(this._scene.data=this._data.scene),this._sharedAssetsManager&&(this._sharedAssetsManager.data=this._data.shared);for(let t of e.actual){let i=t.path;Array.isArray(i)&&i.length===2&&i[0]==="scene"&&i[1]==="objects"&&this._scene?.updateTreeByOp({...t,path:[]},this._sharedAssetsManager)}}_findEntity(e){return this._scene?.getObjectByProperty("uuid",e)??this._scene?.getObjectByName(e)}_resolveParentId(e){if(e===void 0)return this._scene.activePage.uuid;let t=typeof e=="string"?e:e.uuid,i=this._findEntity(t);if(!i)throw new Error(`parent '${t}' \u2014 no object with that name or uuid in the scene.`);return i.uuid}async createCustomMaterial(e){if(this.disposed)throw new Error("createCustomMaterial: this Application was disposed.");if(typeof e!="function")throw new Error("createCustomMaterial: expected a factory function \u2014 createCustomMaterial((three) => new three.MeshStandardNodeMaterial()).");let t=HH();if(t===void 0&&(this._rendererBackend==="webgpu"&&(await Promise.resolve().then(()=>(P9(),rO)),t=HH()),t===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=e(t);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(e,t){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 r=typeof e=="string"?e:e.uuid,n=this._findEntity(r);if(!n)throw new Error(`setMaterial: '${r}' \u2014 no object with that name or uuid in the scene.`);if(!(n instanceof bl))throw new Error(`setMaterial: '${r}' is not a mesh \u2014 lights, groups, and cameras have no material.`);let s=typeof t=="function"?await this.createCustomMaterial(t):t;if(xL()!=="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=Rve({material:s});if(a.material===void 0)throw new Error("setMaterial: expected a three.js material instance or a (three) => material factory.");return n.setMaterialOverride(a.material,{scene:i,shared:this._sharedAssetsManager}),this._proxyObjectCache.delete(n.uuid),this._requestRenderAutoMode(),a.material}async createObject(e,t={}){if(this.disposed)throw new Error("createObject: this Application was disposed.");let i=this._scene,r=this._data;if(!i||!r)throw new Error("createObject: no scene loaded \u2014 call load() or start() first.");let n=function(g){if(typeof g!="string"||g.length===0)throw new Error(`createObject: expected a type name string \u2014 one of ${Pve}.`);let v=g.replace(/Geometry$/i,"").replace(/[\s_-]/g,"").toLowerCase(),y=PVe[v];if(y)return{objectType:y};let _=RVe[v];if(_)return{objectType:"Mesh",geometryType:_};let b=DVe[v];throw b?new Error(`createObject: '${g}' is not supported \u2014 ${b}`):new Error(`createObject: '${g}' is not a creatable Spline type \u2014 use one of ${Pve}, e.g. createObject('Cube', { width: 200 }).`)}(e);typeof t.material=="function"&&(t={...t,material:await this.createCustomMaterial(t.material)});let s,a,{options:o,material:l}=Rve(t);if(l!==void 0){if(n.objectType!=="Mesh")throw new Error("createObject: a three.js material instance only applies to mesh types \u2014 lights and groups have no material.");if(xL()!=="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(n.geometryType==="TextGeometry"){if(!TX.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 h0e(),a=t.font??Pb,r.shared.fonts[a]===void 0){if(a!==Pb){let g=Object.keys(r.shared.fonts).join(", ");throw new Error(`createObject: font '${a}' is not in this document \u2014 available fonts: ${g||"(none)"}.`)}s={name:Pb,url:I1e}}}let u=this._resolveParentId(t.parent),h=BVe(n,o,r),d=ht.generateUUID(),[c,p]=bM(r);s&&(c.shared.fonts[Pb]=s),c.scene.objects.insertAfter(u,null,[{id:d,data:h,children:[]}]);let f=p.result();if(s&&this._sharedAssetsManager.addFont(Pb,s),a!==void 0){let g=this._sharedAssetsManager.getFont(a);g&&await g.loadingPromise}this._applyDocumentTransaction(f);let m=i.find(d);return l!==void 0&&m.setMaterialOverride(l,{scene:i,shared:this._sharedAssetsManager}),this._requestRenderAutoMode(),this._createProxyObject(m)}cloneObject(e,t={}){if(this.disposed)throw new Error("cloneObject: this Application was disposed.");let i=this._scene,r=this._data;if(!i||!r)throw new Error("cloneObject: no scene loaded \u2014 call load() or start() first.");let n=typeof e=="string"?e:e?.uuid,s=n?this._findEntity(n):void 0;if(!s)throw new Error(`cloneObject: '${n}' \u2014 no object with that name or uuid in the scene.`);if(s instanceof Ks)throw new Error("cloneObject: pages cannot be cloned.");let a=r.scene.objects.get(s.uuid);if(!a)throw new Error(`cloneObject: '${n}' 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,m){let g={...p.data};return f.position!==void 0&&(g.position=RA(f.position,[0,0,0])),f.rotation!==void 0&&(g.rotation=RA(f.rotation,[0,0,0])),f.scale!==void 0&&(g.scale=DAe(f.scale)),f.visible!==void 0&&(g.visible=f.visible),g.name=f.name??NAe(`${p.data.name??"Object"} Copy`,m),{...p,data:g}}(UVe(a),t,r.scene.objects),l=t.parent!==void 0?this._resolveParentId(t.parent):r.scene.objects.parent(s.uuid)??null,u=t.parent!==void 0?null:s.uuid,[h,d]=bM(r);h.scene.objects.insertAfter(l,u,[o]),this._applyDocumentTransaction(d.result());let c=i.find(o.id);return this._requestRenderAutoMode(),this._createProxyObject(c)}removeObject(e){let t=this._scene,i=this._data;if(this.disposed||!t||!i)return!1;let r=typeof e=="string"?e:e?.uuid,n=r?this._findEntity(r):void 0;if(!n)return!1;if(n instanceof Ks)throw new Error("removeObject: pages cannot be removed.");if(n.data.type==="PerspectiveCamera"||n.data.type==="OrthographicCamera")throw new Error("removeObject: cameras cannot be removed.");if(i.scene.objects.get(n.uuid)===void 0)throw new Error(`removeObject: '${r}' is not part of the document tree (expanded clones and instanced children cannot be removed individually).`);let s=[];n.traverseEntity(l=>{s.push(l.uuid)});let[a,o]=bM(i);a.scene.objects.delete(n.uuid),this._applyDocumentTransaction(o.result());for(let l of s){let u=this._proxyObjectCache.get(l);u&&(q9.unsubscribe(u),this._proxyObjectCache.delete(l))}return this._requestRenderAutoMode(),!0}};var xB=window,wB=xB.ShadowRoot&&(xB.ShadyCSS===void 0||xB.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,_K=Symbol(),LAe=new WeakMap,WA=class{constructor(t,i,r){if(this._$cssResult$=!0,r!==_K)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=i}get styleSheet(){let t=this.o,i=this.t;if(wB&&t===void 0){let r=i!==void 0&&i.length===1;r&&(t=LAe.get(i)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&LAe.set(i,t))}return t}toString(){return this.cssText}},BAe=e=>new WA(typeof e=="string"?e:e+"",void 0,_K),bK=(e,...t)=>{let i=e.length===1?e[0]:t.reduce((r,n,s)=>r+(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.")})(n)+e[s+1],e[0]);return new WA(i,e,_K)},xK=(e,t)=>{wB?e.adoptedStyleSheets=t.map(i=>i instanceof CSSStyleSheet?i:i.styleSheet):t.forEach(i=>{let r=document.createElement("style"),n=xB.litNonce;n!==void 0&&r.setAttribute("nonce",n),r.textContent=i.cssText,e.appendChild(r)})},SB=wB?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let i="";for(let r of t.cssRules)i+=r.cssText;return BAe(i)})(e):e;var wK,TB=window,UAe=TB.trustedTypes,GVe=UAe?UAe.emptyScript:"",FAe=TB.reactiveElementPolyfillSupport,TK={toAttribute(e,t){switch(t){case Boolean:e=e?GVe:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let i=e;switch(t){case Boolean:i=e!==null;break;case Number:i=e===null?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch{i=null}}return i}},zAe=(e,t)=>t!==e&&(t==t||e==e),SK={attribute:!0,type:String,converter:TK,reflect:!1,hasChanged:zAe},MK="finalized",Zf=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(t){var i;this.finalize(),((i=this.h)!==null&&i!==void 0?i:this.h=[]).push(t)}static get observedAttributes(){this.finalize();let t=[];return this.elementProperties.forEach((i,r)=>{let n=this._$Ep(r,i);n!==void 0&&(this._$Ev.set(n,r),t.push(n))}),t}static createProperty(t,i=SK){if(i.state&&(i.attribute=!1),this.finalize(),this.elementProperties.set(t,i),!i.noAccessor&&!this.prototype.hasOwnProperty(t)){let r=typeof t=="symbol"?Symbol():"__"+t,n=this.getPropertyDescriptor(t,r,i);n!==void 0&&Object.defineProperty(this.prototype,t,n)}}static getPropertyDescriptor(t,i,r){return{get(){return this[i]},set(n){let s=this[t];this[i]=n,this.requestUpdate(t,s,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||SK}static finalize(){if(this.hasOwnProperty(MK))return!1;this[MK]=!0;let t=Object.getPrototypeOf(this);if(t.finalize(),t.h!==void 0&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){let i=this.properties,r=[...Object.getOwnPropertyNames(i),...Object.getOwnPropertySymbols(i)];for(let n of r)this.createProperty(n,i[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){let i=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let n of r)i.unshift(SB(n))}else t!==void 0&&i.push(SB(t));return i}static _$Ep(t,i){let r=i.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}_$Eu(){var t;this._$E_=new Promise(i=>this.enableUpdating=i),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(t=this.constructor.h)===null||t===void 0||t.forEach(i=>i(this))}addController(t){var i,r;((i=this._$ES)!==null&&i!==void 0?i:this._$ES=[]).push(t),this.renderRoot!==void 0&&this.isConnected&&((r=t.hostConnected)===null||r===void 0||r.call(t))}removeController(t){var i;(i=this._$ES)===null||i===void 0||i.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((t,i)=>{this.hasOwnProperty(i)&&(this._$Ei.set(i,this[i]),delete this[i])})}createRenderRoot(){var t;let i=(t=this.shadowRoot)!==null&&t!==void 0?t:this.attachShadow(this.constructor.shadowRootOptions);return xK(i,this.constructor.elementStyles),i}connectedCallback(){var t;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$ES)===null||t===void 0||t.forEach(i=>{var r;return(r=i.hostConnected)===null||r===void 0?void 0:r.call(i)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$ES)===null||t===void 0||t.forEach(i=>{var r;return(r=i.hostDisconnected)===null||r===void 0?void 0:r.call(i)})}attributeChangedCallback(t,i,r){this._$AK(t,r)}_$EO(t,i,r=SK){var n;let s=this.constructor._$Ep(t,r);if(s!==void 0&&r.reflect===!0){let a=(((n=r.converter)===null||n===void 0?void 0:n.toAttribute)!==void 0?r.converter:TK).toAttribute(i,r.type);this._$El=t,a==null?this.removeAttribute(s):this.setAttribute(s,a),this._$El=null}}_$AK(t,i){var r;let n=this.constructor,s=n._$Ev.get(t);if(s!==void 0&&this._$El!==s){let a=n.getPropertyOptions(s),o=typeof a.converter=="function"?{fromAttribute:a.converter}:((r=a.converter)===null||r===void 0?void 0:r.fromAttribute)!==void 0?a.converter:TK;this._$El=s,this[s]=o.fromAttribute(i,a.type),this._$El=null}}requestUpdate(t,i,r){let n=!0;t!==void 0&&(((r=r||this.constructor.getPropertyOptions(t)).hasChanged||zAe)(this[t],i)?(this._$AL.has(t)||this._$AL.set(t,i),r.reflect===!0&&this._$El!==t&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(t,r))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(i){Promise.reject(i)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((n,s)=>this[s]=n),this._$Ei=void 0);let i=!1,r=this._$AL;try{i=this.shouldUpdate(r),i?(this.willUpdate(r),(t=this._$ES)===null||t===void 0||t.forEach(n=>{var s;return(s=n.hostUpdate)===null||s===void 0?void 0:s.call(n)}),this.update(r)):this._$Ek()}catch(n){throw i=!1,this._$Ek(),n}i&&this._$AE(r)}willUpdate(t){}_$AE(t){var i;(i=this._$ES)===null||i===void 0||i.forEach(r=>{var n;return(n=r.hostUpdated)===null||n===void 0?void 0:n.call(r)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){this._$EC!==void 0&&(this._$EC.forEach((i,r)=>this._$EO(r,this[r],i)),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}};Zf[MK]=!0,Zf.elementProperties=new Map,Zf.elementStyles=[],Zf.shadowRootOptions={mode:"open"},FAe?.({ReactiveElement:Zf}),((wK=TB.reactiveElementVersions)!==null&&wK!==void 0?wK:TB.reactiveElementVersions=[]).push("1.6.3");var EK,MB=window,Ow=MB.trustedTypes,kAe=Ow?Ow.createPolicy("lit-html",{createHTML:e=>e}):void 0,CK="$lit$",t0=`lit$${(Math.random()+"").slice(9)}$`,$Ae="?"+t0,jVe=`<${$Ae}>`,p1=document,$A=()=>p1.createComment(""),XA=e=>e===null||typeof e!="object"&&typeof e!="function",XAe=Array.isArray,HVe=e=>XAe(e)||typeof e?.[Symbol.iterator]=="function",AK=`[
12980
+ `,RAe=class{constructor(e,t,i,r,n){this.container=e,this.host=t,this.observer=i,this.previousSplineGlobal=r,this.removeLateLifecycleShim=n}static mount(e,t,i,r){if(typeof document>"u")return null;let n=t.parentElement;if(!n)return null;getComputedStyle(n).position==="static"&&(n.style.position="relative");let s=document.createElement("div");s.setAttribute(uO,"");let a=s.style;a.position="absolute",a.overflow="hidden";let o=()=>{a.left=`${t.offsetLeft}px`,a.top=`${t.offsetTop}px`,a.width=`${t.offsetWidth}px`,a.height=`${t.offsetHeight}px`};o();let l=new ResizeObserver(o);l.observe(t),l.observe(n);let u=document.createElement("style");u.textContent=AVe,s.appendChild(u);let h=new DOMParser().parseFromString(i,"text/html"),d=Array.from(h.querySelectorAll("script"));for(let y of d)y.remove();for(let y of Array.from(h.head.children))(y.tagName==="STYLE"||y.tagName==="LINK"&&y.rel==="stylesheet")&&s.appendChild(y);for(;h.body.firstChild;)s.appendChild(h.body.firstChild);n.insertBefore(s,t.nextSibling);let c=new Map,p=new rX(AAe(e,t,r),(y,_)=>{y==="warn"?console.warn(`[spline html] ${_}`):y==="error"&&console.error(`[spline html] ${_}`)},(y,_)=>{let b=c.get(y);if(b)for(let x of b)try{x(_)}catch(w){console.error(w)}}),f=(y,_)=>{try{return Promise.resolve(p.execute(y,_))}catch(b){return Promise.reject(b)}},m={ready:Promise.resolve(),setVariable:(y,_)=>f("setVariable",[y,_]),setVariables:y=>f("setVariables",[y]),getVariable:y=>f("getVariable",[y]),getVariables:()=>f("getVariables",[]),getAllObjects:()=>f("getAllObjects",[]),findObjectByName:y=>f("findObjectByName",[y]),findObjectById:y=>f("findObjectById",[y]),getGeometry:(y,_)=>f("getGeometry",[y,_??{}]),updateObject:(y,_)=>f("updateObject",[y,_]),createObject:(y,_)=>f("createObject",[y,_??{}]),createCustomMaterial:y=>f("createCustomMaterial",[y]),setMaterial:(y,_)=>f("setMaterial",[y,_]),cloneObject:(y,_)=>f("cloneObject",[y,_??{}]),removeObject:y=>f("removeObject",[y]),spawnObject:(y,_)=>f("spawnObject",[y,_??{}]),destroyObject:y=>f("destroyObject",[y]),setInstanceTransforms:(y,_)=>f("setInstanceTransforms",[y,_??null]),emitEvent:(y,_)=>f("emitEvent",[y,_]),emitEventReverse:(y,_)=>f("emitEventReverse",[y,_]),requestRender:()=>f("requestRender",[]),addEventListener:(y,_)=>{if(typeof _!="function")return;let b=c.get(y);b||(b=new Set,c.set(y,b),f("listenEvent",[y])),b.add(_)},removeEventListener:(y,_)=>{let b=c.get(y);!b||(b.delete(_),b.size===0&&(c.delete(y),f("unlistenEvent",[y])))}},g=window.spline;window.spline=m;let v=function(){if(typeof document>"u"||document.readyState==="loading")return()=>{};let y=[],_=(x,w)=>{let S=new Set,M=x.addEventListener.bind(x),T=x.removeEventListener.bind(x);Object.defineProperty(x,"addEventListener",{configurable:!0,writable:!0,value:(E,A,R)=>{if(M(E,A,R),!w.includes(E)||A==null)return;let N={type:E,listener:A};S.add(N),queueMicrotask(()=>{!S.delete(N)||((D,O,z)=>{let U=new Event(z);try{typeof O=="function"?O.call(D,U):O.handleEvent?.(U)}catch(G){console.error(G)}})(x,N.listener,N.type)})}}),Object.defineProperty(x,"removeEventListener",{configurable:!0,writable:!0,value:(E,A,R)=>{T(E,A,R);for(let N of S)N.type===E&&N.listener===A&&S.delete(N)}}),y.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)}})}}),y.push(()=>{b?Object.defineProperty(window,"onload",b):delete window.onload}),()=>{for(let x of y)x()}}();for(let y of d){let _=document.createElement("script");for(let b of Array.from(y.attributes))_.setAttribute(b.name,b.value);y.src?_.async=!1:_.textContent=y.textContent,s.appendChild(_)}return new RAe(s,p,l,g,v)}dispose(){this.removeLateLifecycleShim(),this.host.dispose(),this.observer.disconnect(),this.container.remove(),window.spline!==void 0&&(window.spline=this.previousSplineGlobal)}};function PAe(e){return typeof e=="object"&&e!==null&&e.isMaterial===!0}function Rve(e){if(typeof e.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(!PAe(e.material))return{options:e};let t=e.material;if(t.isNodeMaterial===!0){let i=HH()?.NodeMaterial;if(i!==void 0&&t instanceof i)return{options:{...e,material:void 0},material:t};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(t.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:{...e,material:void 0},material:t}}Wt(),Nr(),le(),xbe(),bu(),Nr(),Wt(),qIe(),$f();var CVe=new Set(["name","parent","position","rotation","scale","visible","castShadow","receiveShadow","color","material"]),Pve="'Cube', 'Sphere', 'Plane', 'Rectangle', 'Ellipse', 'Triangle', 'Polygon', 'Star', 'Cone', 'Cylinder', 'Pyramid', 'Torus', 'TorusKnot', 'Dodecahedron', 'Icosahedron', 'Helix', 'Backdrop', 'Lathe', 'Text', 'CustomMesh', 'Group', 'PointLight', 'SpotLight', 'DirectionalLight'",RVe={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"},PVe={group:"Empty",empty:"Empty",pointlight:"PointLight",spotlight:"SpotLight",directionallight:"DirectionalLight"},DVe={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')."},NVe={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"},IVe={Empty:"Group",PointLight:"Point Light",SpotLight:"Spot Light",DirectionalLight:"Directional Light"};function RA(e,t){return e===void 0?[t[0],t[1],t[2]]:Array.isArray(e)?[e[0]??t[0],e[1]??t[1],e[2]??t[2]]:[e.x??t[0],e.y??t[1],e.z??t[2]]}function DAe(e){return typeof e=="number"?[e,e,e]:RA(e,[1,1,1])}function N$(e){let t=new Fr(0,0,0,1);return t.setStyle(e),{r:t.r,g:t.g,b:t.b}}function Dve(e,t){let i=e.material??(e.color!==void 0?{color:e.color}:void 0);if(i===void 0)return is.defaultColorMaterial(Nve(eo),"physical","layer1","layer2");if(typeof i=="string"){for(let[a,o]of Object.entries(t.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)||ot.NAMES[o]!==void 0}(i))return is.defaultColorMaterial(N$(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)"}(t)}) 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(PAe(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 r=i.color!==void 0?N$(i.color):Nve(eo),n=is.defaultColorMaterial(r,"physical","layer1","layer2"),s=n.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=n.layers.find(o=>o.data.type==="color");a&&Object.assign(a.data,{alpha:i.alpha})}return n}function Nve(e){return{r:(e>>16&255)/255,g:(e>>8&255)/255,b:(255&e)/255}}function OVe(e){let t=lf.defaultData("TextGeometry"),{text:i,...r}=e,n=r.fontSize;return n!==void 0&&r.width===void 0&&(r.width=350*n/16),n!==void 0&&r.height===void 0&&(r.height=50*n/16),Object.assign(t,r),i!==void 0&&Object.assign(t,{text:{textValue:String(i)}}),t}function WN(e){return Array.isArray(e)?e:!ArrayBuffer.isView(e)||e instanceof DataView?null:Array.from(e)}function LVe(e,t){return n_e({userData:{type:e,...GH[e].normalizeInputs({parameters:t})}})}function BVe(e,t,i){let{objectType:r,geometryType:n}=e,s=function(l){let u={};for(let[h,d]of Object.entries(l))!CVe.has(h)&&d!==void 0&&(u[h]=d);return u}(t),a={states:new Nt,events:new Nt};if(r==="Mesh"&&n){if(n==="NonParametricGeometry"){let{geometry:l,doubleSide:u}=function(h){let d=WN(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 c=d.length/3;if(c>6e4)throw new Error(`createObject('CustomMesh'): too many vertices (${c}); keep it under 60000.`);let p=WN(h.indices);if(p&&p.length){let _=p.find(b=>!Number.isInteger(b)||b<0||b>=c);if(_!==void 0)throw new Error(`createObject('CustomMesh'): index ${_} is out of range (mesh has ${c} vertices).`)}else p=null;let f=new At;f.setAttribute("position",new Et(d,3));let m=WN(h.normals),g=m!==null&&m.length===d.length;g&&f.setAttribute("normal",new Et(m,3));let v=WN(h.uvs);v&&v.length===2*c&&f.setAttribute("uv",new Et(v,2));let y=!1;if(!g){let _=p??Array.from({length:c},(w,S)=>S),{closed:b,inverted:x}=function(w,S){let M=w.length/3,T=new Map,E=new Array(M);for(let D=0;D<M;D++){let O=`${Math.round(1e4*w[3*D])},${Math.round(1e4*w[3*D+1])},${Math.round(1e4*w[3*D+2])}`,z=T.get(O);z===void 0?(T.set(O,D),E[D]=D):E[D]=z}let A=new Map;for(let D=0;D+2<S.length;D+=3){let O=E[S[D]],z=E[S[D+1]],U=E[S[D+2]];for(let[G,j]of[[O,z],[z,U],[U,O]]){if(G===j)continue;let K=G<j?G+"_"+j:j+"_"+G;A.set(K,(A.get(K)??0)+1)}}let R=A.size>0;for(let D of A.values())if(D!==2){R=!1;break}if(!R)return{closed:!1,inverted:!1};let N=0;for(let D=0;D+2<S.length;D+=3){let O=3*S[D],z=3*S[D+1],U=3*S[D+2],G=w[O],j=w[O+1],K=w[O+2],q=w[z],se=w[z+1],ve=w[z+2],oe=w[U],fe=w[U+1],_e=w[U+2];N+=G*(se*_e-ve*fe)+j*(ve*oe-q*_e)+K*(q*fe-se*oe)}return{closed:!0,inverted:N<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||(y=!0)}return p&&f.setIndex(p),g||f.computeVertexNormals(),{geometry:n_e({userData:{type:"NonParametricGeometry",parameters:{subdivisions:0}},data:f.toJSON().data}),doubleSide:y}}(s);Object.assign(a,yc.defaultData,{geometry:l,materials:[Dve(t,i)]}),u&&(a.side=2)}else Object.assign(a,yc.defaultData,{geometry:n==="TextGeometry"?OVe(s):LVe(n,s),material:Dve(t,i)});t.castShadow!==void 0&&(a.castShadow=t.castShadow),t.receiveShadow!==void 0&&(a.receiveShadow=t.receiveShadow)}else r==="Empty"?Object.assign(a,rL.defaultData):(Object.assign(a,nL.defaultData(r),s),t.color!==void 0&&(a.color=N$(t.color)));a.visible=t.visible??!0,a.position=RA(t.position,[0,0,0]),a.rotation=RA(t.rotation,[0,0,0]),a.scale=DAe(t.scale);let o=(n&&NVe[n])??IVe[r]??r;return a.name=t.name??NAe(o,i.scene.objects),a}function NAe(e,t){let i=new Set;if(t.traverse((n,s)=>{i.add(s.name??"")}),!i.has(e))return e;let r=2;for(;i.has(`${e} ${r}`);)r++;return`${e} ${r}`}function IAe(e,t){let i=ht.generateUUID();if(e.data.type==="Component")return{data:{..._f.fromComponentData(e),name:e.data.name+" Instance"},id:i,fi:e.fi,children:[]};t[e.id]=i;let r=e.data;return r.type==="Empty"&&r.animations?.length&&(r={...r,animations:r.animations.map(([n,s,a])=>{let o=ht.generateUUID(),l=a.indexOf(n);return[o,s,l!==-1?a.slice(0,l)+o+a.slice(l+n.length):a]})}),{...e,id:i,data:r,children:e.children.map(n=>IAe(n,t))}}function UVe(e){let t={};return function(i,r){return bx(i,r,null)??i}(IAe(e,t),t)}function FVe(e){let t=Array.isArray(e)?e[0]:e,i=t.layers?.map(zVe)??[],r=t.layers?.find(n=>n.type==="light");return{layers:i,alpha:r?.node.alphaOverride?.value??1}}function zVe(e){return e.type==="texture"||e.type==="video"||e.type==="matcap"?{...e.data,updateTexture:t=>e.color.texture.image.updateSrc(t)}:{...e.data}}$f(),rs(),IX(),bu();var aM=new Fr(0,0,0,1),kVe={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:[]};Wt(),Wt();var VVe=new J;function Ive(e){let t=new Fr(0,0,0,1);try{t.setStyle(e)}catch(i){console.error(i)}return t}var OAe=class{constructor(e,{renderOnDemand:t,renderMode:i="auto",wasmPath:r,renderer:n,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<a_e?this._skipRender=!1:this.currentTAAFrame=0):this.currentTAAFrame=0,this._scene?.traverseVisibleEntity(o=>{o.type==="ParticleSystem"&&(o.update(this.dt),this._skipRender=!1),Qy(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=VVe.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=nA(this._resize,10),this._onScroll=a=>{this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect())},this.canvas=e,this._htmlContentMode=s,this.renderMode=t?"auto":i,r!==void 0&&(this._wasmPath=function(a){let o=a.length;for(;o>0&&"/".includes(a[o-1]);)o--;return a.slice(0,o)}(r)),this._rendererBackend=n??"webgl",n===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=typeof navigator<"u"&&"gpu"in navigator?"webgpu":"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(()=>(n4e(),cSe)).then(({Perfs:a})=>{this._perfs=new a({x:10,y:10})}),function(a){a.addEventListener("pointerdown",oJ,!0),a.addEventListener("pointerdown",jC,!0),a.addEventListener("pointermove",jC,!0),a.addEventListener("pointerup",F1,!0),a.addEventListener("pointercancel",F1,!0),a.addEventListener("pointerleave",F1,!0),window.addEventListener("keydown",lJ,!0),window.addEventListener("keyup",hJ,!0)}(e)}async _createRenderer(){if(this._rendererBackend==="webgpu"&&this._rendererAuto)try{await navigator.gpu?.requestAdapter()||(this._rendererBackend="webgl")}catch{this._rendererBackend="webgl"}if(this._rendererBackend==="webgpu")try{let{createWebGPUSplineRenderer:e,isWebGPUSupported:t}=await Promise.resolve().then(()=>(P9(),rO));t();let i=!0,r=!1,n=this._data?.scene.publish?.asyncShaderCompilation!==!1;try{let a=new URLSearchParams(window.location.search),o=a.get("bundles");o==="rerecord"?i="rerecord":(o==="off"||o==="0"||o==="false"||o==="no")&&(i=!1),r=a.get("forcegl")==="1";let l=a.get("asynccomp");l==="off"||l==="0"||l==="false"||l==="no"?n=!1:(l==="on"||l==="1"||l==="true"||l==="always")&&(n=!0)}catch{}let s=await e({canvas:this.canvas,antialias:!1,alpha:!0,powerPreference:"high-performance",sceneBundles:!r&&i,forceWebGL:r,asyncCompilation:!r&&n});return s.onBackgroundWorkReady=()=>{this._skipRender=!1,this._renderRequested=!0},s.skyAnimationAllowed=!0,s}catch(e){console.error("[spline] Failed to initialize the WebGPU renderer, falling back to WebGL:",e),this._rendererBackend="webgl"}{let{SplineRenderer:e,rendererGlobals:t}=await Promise.resolve().then(()=>(Tge(),n$));try{new URLSearchParams(window.location.search).get("taa")==="off"&&(t.taaEnabled.value=!1)}catch{}return new e({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 e=window.devicePixelRatio||1,t=this.canvas.clientWidth||300,i=this.canvas.clientHeight||150;this.canvas.width=t*e,this.canvas.height=i*e;let r=this.canvas.getContext("2d");r&&(r.scale(e,e),r.fillStyle="rgba(127, 127, 127, 0.85)",r.font="13px system-ui, -apple-system, Segoe UI, Roboto, sans-serif",r.textAlign="center",r.textBaseline="middle",r.fillText("This scene requires a WebGPU-capable browser.",t/2,i/2))}catch{}this.canvas.dispatchEvent(new CustomEvent("splineerror",{bubbles:!0,detail:{reason:"webgpu-required"}}))}async load(e,t,i){(function(n){let s="The Spline Runtime only accepts .splinecode files that are generated from Spline export panel.";n.endsWith(".spline")?console.warn(s+" The .spline files are only meant to be used by the Editor."):n.endsWith(".splinecode")||console.warn(s)})(e),this.disposed=!1;let r=await(await fetch(e,i)).arrayBuffer();await this.start(r,{variables:t})}async start(e,{interactive:t=!0,variables:i}={}){if(this.disposed)return;Bs.init();let r=await async function(c){let[p,f]=bM(sA.deserialize(new Uint8Array(c)));if((p.schema??0)!==131){let{updateDocumentSchema:m}=await Promise.resolve().then(()=>(P4(),Z1e));m(p)}return f.result().data}(e);this._data=r;let n=function(c){let p=[];return c.scene.objects.traverse((f,m)=>{m.type==="Mesh"&&m.geometry.type==="NonParametricGeometry"&&m.geometry.data.draco!==void 0&&p.push(m)}),p}(r);r.version&&(0,MVe.default)(r.version,"2.0.37")>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(c){pW=c}(this._wasmPath));let s=async function(){}();await Promise.all([s,n.length&&Eve(this._wasmPath),lie(r)&&JIe(this._wasmPath),WOe(r)&&ROe(this._wasmPath),Zy.physicsEnabled(r.scene.objects)&&N5e(this._wasmPath),gte(r)&&h0e(),Rie(r)&&pLe(),lOe(r)&&oOe(),t0e(r)&&s.then(()=>gH()?.loadHanaUIRUNTIME()),M5e(r)&&X5e(this._wasmPath)].filter(Boolean)),n.length&&await Ave(n),this._eventManager?.deactivate(),this._controls?.deactivate(),this._scene?.dispose();let a=r.scene.publish.renderer;if(this._rendererAuto&&a==="webgl")this._rendererBackend="webgl";else if(this._rendererAuto&&a==="webgpu"){if(this._rendererBackend!=="webgpu"||!await navigator.gpu?.requestAdapter().catch(()=>null))return void this._failWebGPURequired();this._rendererAuto=!1}let o=function(c){let p=new Set;return c.scene.objects.traverse((f,m)=>{if(m.type!=="Page")return;let g=m.postprocessing;if(g&&typeof g=="object"&&g.enabled===!0)for(let[v,y]of Object.entries(g))v!=="enabled"&&y&&typeof y=="object"&&y.enabled===!0&&p.add(v)}),[...p]}(r);if(this._rendererBackend==="webgpu")try{await Promise.all([Promise.resolve().then(()=>(P9(),rO)),TVe(o)]),this._renderer||(this._renderer=await this._createRenderer())}catch(c){console.error("[spline] Failed to load the WebGPU material backend, using WebGL:",c),this._rendererBackend="webgl"}this._rendererBackend!=="webgpu"&&await Promise.all([Promise.resolve().then(()=>(Tge(),n$)),SVe(o)]),function(c){LA=c}(this._rendererBackend==="webgpu"?"webgpu":"webgl");let l=new vVe(r);if(l.resetPersonalCameraFromDocumentData(),this._scene=l.scene,this._sharedAssetsManager=l.sharedAssets,this._camera=this._scene.activeCamera,window.location.search.includes("merge-geometries")){let{mergeStaticGeometries:c}=await Promise.resolve().then(()=>(hFe(),pEe)),p=performance.now();c(r,l.scene);let f=performance.now();console.log("Merged geometries in ",f-p," ms")}lie(r)&&this._scene.traverse(c=>{Uc(c)&&c.recomputeBoolean()}),this._sharedAssetsManager.setRequestRender(()=>{this._requestRenderAutoMode(),this._scene?.traverse(c=>{ix(c)&&c.pendingMediaLoad&&c.update({scene:this._scene,shared:this._sharedAssetsManager})})}),this._scene?.traverse(c=>{c.type==="ParticleSystem"&&(c.wakeUp(),c.data.autoPlay?c.start():c.stop()),Qy(c)&&c.setPlayMode(!0)});let u=Object.keys(r.shared.fonts).flatMap(c=>{let p=this._sharedAssetsManager.getFont(c);return p?[p.loadingPromise]:[]});if(Promise.all(u).then(()=>{this.disposed||(l.scene.markNeedsUpdateRendererDirty(),this._requestRenderAutoMode())}),gte(r)&&function(c){if(Zy.physicsEnabled(c.scene.objects))return!0;let p=!1;return c.scene.objects.traverse((f,m)=>{if(m.events){if(Array.isArray(m.events)){for(let g of m.events)if(g.data.disabled!==!0&&g.data.type==="GameControl"&&g.data.collisionEnabled){p=!0;break}}else for(let g of Object.values(m.events))if(g.disabled!==!0&&g.type==="GameControl"&&g.collisionEnabled){p=!0;break}}}),p}(r)&&await Promise.all(u),t0e(r)){let c=[];this._scene.traverseEntity(p=>{(Xo(p)||p instanceof Ks)&&p.uiCanvas&&c.push(p.uiCanvas)}),await Promise.all(c.map(p=>p.promise))}if(this._scene.rewriteEventsBeforeGoToPlayMode(),yK(this._scene.activePage,this._sharedAssetsManager),this._renderer||(this._renderer=await this._createRenderer()),!this._rendererConfigured){this._rendererConfigured=!0,this._renderer.hdTransmission=r.scene.publish.hdTransmission===!0;let c=()=>/Mobi|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),p=this._getPixelRatio(c()?r.scene.publish.settings.web.pixelRatioMobile:r.scene.publish.settings.web.pixelRatioDesktop);if(this._renderer.setPixelRatio(p),this._renderer.pipeline.enableUIOverlay(),this._renderer.pipeline.addEventListener("smaaloaded",this._requestRenderAutoMode),r.shared.images.SplineWatermark){let f=this._sharedAssetsManager.getImage("SplineWatermark");await f.loadPromise;let m=f.getTexture(1001);this._renderer.pipeline.setWatermark(m)}}Rie(r)&&this._scene.initializeSplatViewer(),r.scene.blueNoiseTextureData!==void 0&&this._renderer.pipeline.updateBlueNoiseTexture(r.scene.blueNoiseTextureData);let h=Object.values(r.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 HFe(this._renderer,this._camera,new J(this._viewportWidth,this._viewportHeight)),this._frameView.enableResponsive=(h.allowResponsive??!1)&&h.preset==="fullscreen"),t){let c=new SFe(this._renderer,this.data.scene.publish,this._scene,()=>this._scene.activeCamera,this._sharedAssetsManager,this._requestRenderAutoMode,!0,h);this._scene.updateMatrixWorld(!0),this._controls=new B5e(c),this._animationControls=new bVe(this._scene,this._requestRenderAutoMode),this._eventManager=new FFe(r.scene.publish,this._controls,this._animationControls,c,r.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=r.scene.publish.htmlContent?.html;if(t&&d&&this._htmlContentMode!=="none"){let c={shared:this._sharedAssetsManager,findEntity:p=>this._scene?.getObjectByProperty("uuid",p)??this._scene?.getObjectByName(p)};this._htmlContentOverlay=(this._htmlContentMode==="inline"?RAe.mount(this,this.canvas,d,c):CAe.mount(this,this.canvas,d,c))??void 0}}setVariables(e){if(this._data!==void 0){let t=Object.entries(e);for(let[i,r]of t)this.setVariable(i,r)}}setVariable(e,t){let i=this._getVariableByName(e);if(i&&!("dynamicVariableType"in i.data)){let r=t;typeof i.data.value=="number"?r=typeof t=="number"?t:typeof t=="boolean"?t===!0?1:0:parseFloat(t):typeof i.data.value=="boolean"?r=typeof t=="number"?!!t:typeof t=="boolean"?t:t.toLocaleLowerCase()!=="false"&&!!t:typeof i.data.value!="string"&&i.data.value.textValue!==void 0&&(r=t.toString());let n=typeof r=="string"?{textValue:r}:r;this._sharedAssetsManager?.updateVariable(i.id,n),this.requestRender(),this._requestRenderAutoMode()}else i===void 0?console.warn(`No variable named ${e} was found in your Spline file. Make sure to create it from Spline editor.`):"dynamicVariableType"in i.data&&console.warn(`Dynamic variables like ${e} cannot be updated from code.`)}getVariables(){let e={};return this._data&&this._data.shared.variables.forEach(t=>{e[t.data.name]===void 0&&(e[t.data.name]=this._getVariableValue(this._sharedAssetsManager.getVariable(t.id)))}),e}getVariable(e){let t=this._getVariableByName(e);if(t){let i=this._sharedAssetsManager.getVariable(t.id);return this._getVariableValue(i)}}_getVariableValue(e){return typeof e!="string"&&Eo.isTextValue(e)?Eo.getDisplayedValue(e):e}_getVariableByName(e){if(this._data){if(this._variablesCache.has(e))return this._variablesCache.get(e);let t=this._data.shared.variables.find(i=>i.data.name===e);return t&&this._variablesCache.set(e,t),t}}_getPixelRatio(e){switch(e){case 0:return window.devicePixelRatio;case 1:return 1;case 2:return 2}}findObjectById(e){let t=this._scene?.getObjectByProperty("uuid",e);return this._createProxyObject(t)}findObjectByName(e){let t=this._scene?.getObjectByName(e);return this._createProxyObject(t)}getAllObjects(){let e=[];return this._scene?.traverseEntity(t=>{if(!(t.uuid===a1||this._scene.isInvisibleObjects(t)||t instanceof Ks)){let i=this._createProxyObject(t);i&&e.push(i)}}),e}getSplineEvents(){return(this._eventManager?.handlers?.Spline).splineEvents}emitEvent(e,t){(this.findObjectById(t)||this.findObjectByName(t))?.emitEvent(e)}emitEventReverse(e,t){(this.findObjectById(t)||this.findObjectByName(t))?.emitEventReverse(e)}addEventListener(e,t){this.canvas.addEventListener(e,t)}removeEventListener(e,t){this.canvas.removeEventListener(e,t)}setZoom(e){this._controls?.orbitControls instanceof REe&&this._controls?.orbitControls.setZoom(e)}get eventManager(){return this._eventManager}get controls(){return this._controls}setSize(e,t){this._viewportWidth=e,this._viewportHeight=t,this._viewportMode=2,this._resize()}setBackgroundColor(e){let t=Ive(e);this._scene?.activePage.setBackgroundColor(t),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,xE&&xE.disposeAll(),this._sharedAssetsManager?.setRequestRender(()=>{}),this._sharedAssetsManager?.dispose(),this._sharedAssetsManager=void 0,this._proxyObjectCache.forEach(e=>{q9.unsubscribe(e)}),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(e){e.removeEventListener("pointerdown",oJ,!0),e.removeEventListener("pointerdown",jC,!0),e.removeEventListener("pointermove",jC,!0),e.removeEventListener("pointerup",F1,!0),e.removeEventListener("pointercancel",F1,!0),e.removeEventListener("pointerleave",F1,!0),window.removeEventListener("keydown",lJ,!0),window.removeEventListener("keyup",hJ,!0)}(this.canvas),document.removeEventListener("scroll",this._onScroll),Bs.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(e){this._eventManager?.updateUseWindowEvents(e)}get data(){return this._data}_createProxyObject(e){if(!this._scene)return;let t,i=this._scene;if(e==null)return;if(this._proxyObjectCache.has(e.uuid))return this._proxyObjectCache.get(e.uuid);e.traverseAncestors(h=>{h instanceof Ks&&(t=h.name)});let r=this._sharedAssetsManager,n={shared:r,scene:this._scene},s=h=>{if(h===null||h==="Base State")return null;if(h&&e.data.states){let d=e.data.states.find(c=>c.data.name===h);return d?d.id:void 0}},a="material"in e?e.material:void 0,o=e.materialOverride,l={name:e.name,uuid:e.uuid,visible:e.visible,intensity:e.intensity,position:e.position,rotation:e.rotation,scale:e.scale,type:e.data.type,page:t,material:o??(a?FVe(a):void 0),parentUuid:e.parent instanceof Ks||e instanceof Pg?void 0:e.parent?.uuid,emitEvent(h){e.dispatchEvent({type:"userEvent",eventName:h})},emitEventReverse(h){e.dispatchEvent({type:"userEvent",eventName:h,reverse:!0})},hide(){e.visible&&(e.visible=!1,n.shared.requestRender())},show(){e.visible||(e.visible=!0,n.shared.requestRender())},get state(){let h=e.stateSelection;if(h!==null)return e.data.states.find(({id:d})=>d===h)?.data.name},set state(h){let d;if(h!==void 0){let c=typeof h=="string"?e.data.states.find(({id:p})=>p===h):e.data.states[h];if(c)d=c.id;else{let p=typeof h=="string"?s(h):void 0;p&&(d=p)}}e.changeSelectedState(d??null,n),e.currentState=d??null,e.dispatchEvent({type:"completeState",state:d??null}),n.shared.requestRender()},transition(h){let d=MAe;if(d===null)return Ma("transitions","obj.transition()"),{transition(b){return this},play(){return this},pause(){return this},reset(){return this},seek(b){return this}};let c,p,f=this,m=[],g=!1,v=()=>{p=new dAe({delay:0,delayDirection:"start-once",direction:"normal",repeat:0,runMode:"Repeat"},m.map(b=>b.runner))},y={update(b){p?.update(b),p?.isPlaying!==!0&&Bs.remove(y)}},_={transition({from:b,to:x,duration:w,delay:S,...M}){let T=s(b);T===void 0&&(T=c);let E=s(x);return c=E,m.push(new d(e,T,E,{state:E,repeat:0,delay:S??0,delayDirection:"start-once",direction:"normal",duration:w??1e3,...M,...M.easing===6?Tg.defaultData:M.easing===5?tw.defaultData:{}},r,!1,i.activePage,{onBegin:()=>{(b&&T||b==="Base State"&&!T)&&(f.state=T??void 0)},onComplete:()=>{f.state=E??void 0}})),v(),this},play(){return p?(g=!0,p.play(Bs.time),p.isPlaying&&Bs.add(y),this):this},pause(){return p?.stop(),Bs.remove(y),this},reset(){return this.pause(),g=!1,v(),p?.seek(0),this},seek(b){let x=m.reduce((w,S)=>w+S.runner.duration,0);return x>0&&p?.seek(b/1e3/x),this}};return _.transition(h),(h.autoPlay??!0)&&queueMicrotask(()=>{g||_.play()}),_},set color(h){let d=Ive(h);if(SL.is(e))return void(e.color=d);if(!(e.type==="Mesh"&&"material"in e&&e instanceof bl))return;let c={r:d.r,g:d.g,b:d.b,a:d.a},p=e.materialOverride;if(p!==void 0){let g=p.color;return void(g?.isColor===!0&&typeof g.setStyle=="function"&&(g.setStyle(h),n.shared.requestRender()))}let f=Array.isArray(e.material)?e.material[0]:e.material,m=f.data.layers.find(g=>g.data.type==="color")?.id;if(m)f.updateByOp({type:0,path:["layers",m],props:{color:{...c}}},f.data,n);else{let g=f.data,v=g.layers.find(S=>S.data.type==="light");if(!v)return;let y=g.layers.indexOf(v)===0?v:null,_=g.layers.at(y?g.layers.indexOf(y)+1:0),b={type:4,fi:y?y.fi+(_?(_.fi-y.fi)/2:1):_?_.fi/2:1,id:ht.generateUUID(),data:{...os.defaultData("color"),color:c},localIndex:0},x=g.layers.insertAfterHelper(y?.id??null,1),w=g.layers.runOp({...b,fi:x[0]}).data;Object.assign(f.data,{layers:w}),f.updateByOp({...b,path:["layers"]},f.data,n)}}},u=q9(l,(h,d)=>{let c=e[h],p=function(f){return f.split(".")}(h);p[0]==="material"&&a&&o===void 0&&function(f,m,g){let v=Array.isArray(g)?g[0]:g;if(f[0]==="layers"){let y=parseInt(f[1]),_=v.layers[y],b=f[2];_&&b&&function(x,w,S){let M=x[0];try{if(function(T,E){return!!kVe[E]?.includes(T)}(M,S.type,x.slice(1)))if(M==="colors"){if(x.length<2)throw new Error("You cannot mutate the colors array, only its items");let T=parseInt(x[1]),E=S.getValue(M)?.[T];if(!E)throw new Error("Color index out of range");aM.setStyle(w),E.set(aM.r,aM.g,aM.b,aM.a)}else S.getValue(M)?.setStyle(w);else if(M==="texture"||M==="video"){let T=S.color;(function(E,A,R,N){let D=E[0];if(D==="repeat"||D==="offset"||D==="rotation"){let O=N.getNode("mat"),z=O&&typeof O.updateMatrix=="function"?O:N.getValue("mat");if(!z)return;if(D==="rotation")z.rotation=parseFloat(A);else{let U=E[1];if(U===void 0)A instanceof Array&&A.length===2&&Object.assign(z,{[D]:A});else{let G=z[D],j=parseInt(U)===0?[parseFloat(A),G[1]]:[G[0],parseFloat(A)];Object.assign(z,{[D]:j})}}z.updateMatrix()}else D==="wrapping"||D==="minFilter"||D==="magFilter"?D==="wrapping"?R.texture.wrap=A:R.texture[D]=A:D==="image"&&E[1]==="data"&&R.texture.image.updateSrc(A)})(x.slice(1),w,T,S)}else{let T=x[1],E=S.getValue(M);E?.isVector3&&T!==void 0||E?.isVector2&&T!==void 0?E.setComponent(parseInt(T),w):S.setValue(M,w)}}catch(T){console.error("Error setting material value",T)}}(f.slice(2),m,_)}else f[0]==="alpha"&&v.layers.forEach(y=>{y.type==="light"&&y.node.alphaOverride!==void 0&&(y.node.alphaOverride.value=m,m<1&&(v.transparent=!0))})}(p.slice(1),d,a),typeof c!="object"&&Object.getOwnPropertyDescriptor(e,h)?.writable&&(e[h]=d),this._requestRenderAutoMode(),e.updateMatrix()});return this._proxyObjectCache.set(e.uuid,u),u}setUIWasmUrl(e){(function(t){cL=t,I4?.setHanaUIWasmUrl(t)})(e)}pauseGameControls(){this._eventManager?.controlsManager.gameControl?.pause()}resumeGameControls(){this._eventManager?.controlsManager.gameControl?.resume()}async swapGeometry(e,t){let i;if(typeof t=="string"){if(!t.endsWith(".splinegeometry"))throw new Error("Only .splinegeometry format is supported");{let l=await(await fetch(t)).arrayBuffer();i=new Uint8Array(l)}}else i=t;let r=sA.deserialize(i),n="data"in r&&r.data.draco!==void 0;n&&await Eve(this._wasmPath);let s=this._scene?.getObjectByProperty("uuid",e)??this._scene?.getObjectByName(e);if(!s)return void console.warn(`Object ${e} not found`);if(s.data.type!=="Mesh"||!(s instanceof bl))return void console.warn(`Object ${e} is not a mesh`);let a=s,o={...a.data,geometry:r};n&&await Ave([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 u={...l.data};a.states||(a.states={}),a.states[l.id]=Eg.patch(o,u)}return i}_applyDocumentTransaction(e){this._data=e.data,this._scene&&(this._scene.data=this._data.scene),this._sharedAssetsManager&&(this._sharedAssetsManager.data=this._data.shared);for(let t of e.actual){let i=t.path;Array.isArray(i)&&i.length===2&&i[0]==="scene"&&i[1]==="objects"&&this._scene?.updateTreeByOp({...t,path:[]},this._sharedAssetsManager)}}_findEntity(e){return this._scene?.getObjectByProperty("uuid",e)??this._scene?.getObjectByName(e)}_resolveParentId(e){if(e===void 0)return this._scene.activePage.uuid;let t=typeof e=="string"?e:e.uuid,i=this._findEntity(t);if(!i)throw new Error(`parent '${t}' \u2014 no object with that name or uuid in the scene.`);return i.uuid}async createCustomMaterial(e){if(this.disposed)throw new Error("createCustomMaterial: this Application was disposed.");if(typeof e!="function")throw new Error("createCustomMaterial: expected a factory function \u2014 createCustomMaterial((three) => new three.MeshStandardNodeMaterial()).");let t=HH();if(t===void 0&&(this._rendererBackend==="webgpu"&&(await Promise.resolve().then(()=>(P9(),rO)),t=HH()),t===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=e(t);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(e,t){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 r=typeof e=="string"?e:e.uuid,n=this._findEntity(r);if(!n)throw new Error(`setMaterial: '${r}' \u2014 no object with that name or uuid in the scene.`);if(!(n instanceof bl))throw new Error(`setMaterial: '${r}' is not a mesh \u2014 lights, groups, and cameras have no material.`);let s=typeof t=="function"?await this.createCustomMaterial(t):t;if(xL()!=="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=Rve({material:s});if(a.material===void 0)throw new Error("setMaterial: expected a three.js material instance or a (three) => material factory.");return n.setMaterialOverride(a.material,{scene:i,shared:this._sharedAssetsManager}),this._proxyObjectCache.delete(n.uuid),this._requestRenderAutoMode(),a.material}async createObject(e,t={}){if(this.disposed)throw new Error("createObject: this Application was disposed.");let i=this._scene,r=this._data;if(!i||!r)throw new Error("createObject: no scene loaded \u2014 call load() or start() first.");let n=function(g){if(typeof g!="string"||g.length===0)throw new Error(`createObject: expected a type name string \u2014 one of ${Pve}.`);let v=g.replace(/Geometry$/i,"").replace(/[\s_-]/g,"").toLowerCase(),y=PVe[v];if(y)return{objectType:y};let _=RVe[v];if(_)return{objectType:"Mesh",geometryType:_};let b=DVe[v];throw b?new Error(`createObject: '${g}' is not supported \u2014 ${b}`):new Error(`createObject: '${g}' is not a creatable Spline type \u2014 use one of ${Pve}, e.g. createObject('Cube', { width: 200 }).`)}(e);typeof t.material=="function"&&(t={...t,material:await this.createCustomMaterial(t.material)});let s,a,{options:o,material:l}=Rve(t);if(l!==void 0){if(n.objectType!=="Mesh")throw new Error("createObject: a three.js material instance only applies to mesh types \u2014 lights and groups have no material.");if(xL()!=="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(n.geometryType==="TextGeometry"){if(!TX.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 h0e(),a=t.font??Pb,r.shared.fonts[a]===void 0){if(a!==Pb){let g=Object.keys(r.shared.fonts).join(", ");throw new Error(`createObject: font '${a}' is not in this document \u2014 available fonts: ${g||"(none)"}.`)}s={name:Pb,url:I1e}}}let u=this._resolveParentId(t.parent),h=BVe(n,o,r),d=ht.generateUUID(),[c,p]=bM(r);s&&(c.shared.fonts[Pb]=s),c.scene.objects.insertAfter(u,null,[{id:d,data:h,children:[]}]);let f=p.result();if(s&&this._sharedAssetsManager.addFont(Pb,s),a!==void 0){let g=this._sharedAssetsManager.getFont(a);g&&await g.loadingPromise}this._applyDocumentTransaction(f);let m=i.find(d);return l!==void 0&&m.setMaterialOverride(l,{scene:i,shared:this._sharedAssetsManager}),this._requestRenderAutoMode(),this._createProxyObject(m)}cloneObject(e,t={}){if(this.disposed)throw new Error("cloneObject: this Application was disposed.");let i=this._scene,r=this._data;if(!i||!r)throw new Error("cloneObject: no scene loaded \u2014 call load() or start() first.");let n=typeof e=="string"?e:e?.uuid,s=n?this._findEntity(n):void 0;if(!s)throw new Error(`cloneObject: '${n}' \u2014 no object with that name or uuid in the scene.`);if(s instanceof Ks)throw new Error("cloneObject: pages cannot be cloned.");let a=r.scene.objects.get(s.uuid);if(!a)throw new Error(`cloneObject: '${n}' 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,m){let g={...p.data};return f.position!==void 0&&(g.position=RA(f.position,[0,0,0])),f.rotation!==void 0&&(g.rotation=RA(f.rotation,[0,0,0])),f.scale!==void 0&&(g.scale=DAe(f.scale)),f.visible!==void 0&&(g.visible=f.visible),g.name=f.name??NAe(`${p.data.name??"Object"} Copy`,m),{...p,data:g}}(UVe(a),t,r.scene.objects),l=t.parent!==void 0?this._resolveParentId(t.parent):r.scene.objects.parent(s.uuid)??null,u=t.parent!==void 0?null:s.uuid,[h,d]=bM(r);h.scene.objects.insertAfter(l,u,[o]),this._applyDocumentTransaction(d.result());let c=i.find(o.id);return this._requestRenderAutoMode(),this._createProxyObject(c)}removeObject(e){let t=this._scene,i=this._data;if(this.disposed||!t||!i)return!1;let r=typeof e=="string"?e:e?.uuid,n=r?this._findEntity(r):void 0;if(!n)return!1;if(n instanceof Ks)throw new Error("removeObject: pages cannot be removed.");if(n.data.type==="PerspectiveCamera"||n.data.type==="OrthographicCamera")throw new Error("removeObject: cameras cannot be removed.");if(i.scene.objects.get(n.uuid)===void 0)throw new Error(`removeObject: '${r}' is not part of the document tree (expanded clones and instanced children cannot be removed individually).`);let s=[];n.traverseEntity(l=>{s.push(l.uuid)});let[a,o]=bM(i);a.scene.objects.delete(n.uuid),this._applyDocumentTransaction(o.result());for(let l of s){let u=this._proxyObjectCache.get(l);u&&(q9.unsubscribe(u),this._proxyObjectCache.delete(l))}return this._requestRenderAutoMode(),!0}};var xB=window,wB=xB.ShadowRoot&&(xB.ShadyCSS===void 0||xB.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,_K=Symbol(),LAe=new WeakMap,WA=class{constructor(t,i,r){if(this._$cssResult$=!0,r!==_K)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=i}get styleSheet(){let t=this.o,i=this.t;if(wB&&t===void 0){let r=i!==void 0&&i.length===1;r&&(t=LAe.get(i)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&LAe.set(i,t))}return t}toString(){return this.cssText}},BAe=e=>new WA(typeof e=="string"?e:e+"",void 0,_K),bK=(e,...t)=>{let i=e.length===1?e[0]:t.reduce((r,n,s)=>r+(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.")})(n)+e[s+1],e[0]);return new WA(i,e,_K)},xK=(e,t)=>{wB?e.adoptedStyleSheets=t.map(i=>i instanceof CSSStyleSheet?i:i.styleSheet):t.forEach(i=>{let r=document.createElement("style"),n=xB.litNonce;n!==void 0&&r.setAttribute("nonce",n),r.textContent=i.cssText,e.appendChild(r)})},SB=wB?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let i="";for(let r of t.cssRules)i+=r.cssText;return BAe(i)})(e):e;var wK,TB=window,UAe=TB.trustedTypes,GVe=UAe?UAe.emptyScript:"",FAe=TB.reactiveElementPolyfillSupport,TK={toAttribute(e,t){switch(t){case Boolean:e=e?GVe:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let i=e;switch(t){case Boolean:i=e!==null;break;case Number:i=e===null?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch{i=null}}return i}},zAe=(e,t)=>t!==e&&(t==t||e==e),SK={attribute:!0,type:String,converter:TK,reflect:!1,hasChanged:zAe},MK="finalized",Zf=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(t){var i;this.finalize(),((i=this.h)!==null&&i!==void 0?i:this.h=[]).push(t)}static get observedAttributes(){this.finalize();let t=[];return this.elementProperties.forEach((i,r)=>{let n=this._$Ep(r,i);n!==void 0&&(this._$Ev.set(n,r),t.push(n))}),t}static createProperty(t,i=SK){if(i.state&&(i.attribute=!1),this.finalize(),this.elementProperties.set(t,i),!i.noAccessor&&!this.prototype.hasOwnProperty(t)){let r=typeof t=="symbol"?Symbol():"__"+t,n=this.getPropertyDescriptor(t,r,i);n!==void 0&&Object.defineProperty(this.prototype,t,n)}}static getPropertyDescriptor(t,i,r){return{get(){return this[i]},set(n){let s=this[t];this[i]=n,this.requestUpdate(t,s,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||SK}static finalize(){if(this.hasOwnProperty(MK))return!1;this[MK]=!0;let t=Object.getPrototypeOf(this);if(t.finalize(),t.h!==void 0&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){let i=this.properties,r=[...Object.getOwnPropertyNames(i),...Object.getOwnPropertySymbols(i)];for(let n of r)this.createProperty(n,i[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){let i=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let n of r)i.unshift(SB(n))}else t!==void 0&&i.push(SB(t));return i}static _$Ep(t,i){let r=i.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}_$Eu(){var t;this._$E_=new Promise(i=>this.enableUpdating=i),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(t=this.constructor.h)===null||t===void 0||t.forEach(i=>i(this))}addController(t){var i,r;((i=this._$ES)!==null&&i!==void 0?i:this._$ES=[]).push(t),this.renderRoot!==void 0&&this.isConnected&&((r=t.hostConnected)===null||r===void 0||r.call(t))}removeController(t){var i;(i=this._$ES)===null||i===void 0||i.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((t,i)=>{this.hasOwnProperty(i)&&(this._$Ei.set(i,this[i]),delete this[i])})}createRenderRoot(){var t;let i=(t=this.shadowRoot)!==null&&t!==void 0?t:this.attachShadow(this.constructor.shadowRootOptions);return xK(i,this.constructor.elementStyles),i}connectedCallback(){var t;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$ES)===null||t===void 0||t.forEach(i=>{var r;return(r=i.hostConnected)===null||r===void 0?void 0:r.call(i)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$ES)===null||t===void 0||t.forEach(i=>{var r;return(r=i.hostDisconnected)===null||r===void 0?void 0:r.call(i)})}attributeChangedCallback(t,i,r){this._$AK(t,r)}_$EO(t,i,r=SK){var n;let s=this.constructor._$Ep(t,r);if(s!==void 0&&r.reflect===!0){let a=(((n=r.converter)===null||n===void 0?void 0:n.toAttribute)!==void 0?r.converter:TK).toAttribute(i,r.type);this._$El=t,a==null?this.removeAttribute(s):this.setAttribute(s,a),this._$El=null}}_$AK(t,i){var r;let n=this.constructor,s=n._$Ev.get(t);if(s!==void 0&&this._$El!==s){let a=n.getPropertyOptions(s),o=typeof a.converter=="function"?{fromAttribute:a.converter}:((r=a.converter)===null||r===void 0?void 0:r.fromAttribute)!==void 0?a.converter:TK;this._$El=s,this[s]=o.fromAttribute(i,a.type),this._$El=null}}requestUpdate(t,i,r){let n=!0;t!==void 0&&(((r=r||this.constructor.getPropertyOptions(t)).hasChanged||zAe)(this[t],i)?(this._$AL.has(t)||this._$AL.set(t,i),r.reflect===!0&&this._$El!==t&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(t,r))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(i){Promise.reject(i)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((n,s)=>this[s]=n),this._$Ei=void 0);let i=!1,r=this._$AL;try{i=this.shouldUpdate(r),i?(this.willUpdate(r),(t=this._$ES)===null||t===void 0||t.forEach(n=>{var s;return(s=n.hostUpdate)===null||s===void 0?void 0:s.call(n)}),this.update(r)):this._$Ek()}catch(n){throw i=!1,this._$Ek(),n}i&&this._$AE(r)}willUpdate(t){}_$AE(t){var i;(i=this._$ES)===null||i===void 0||i.forEach(r=>{var n;return(n=r.hostUpdated)===null||n===void 0?void 0:n.call(r)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){this._$EC!==void 0&&(this._$EC.forEach((i,r)=>this._$EO(r,this[r],i)),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}};Zf[MK]=!0,Zf.elementProperties=new Map,Zf.elementStyles=[],Zf.shadowRootOptions={mode:"open"},FAe?.({ReactiveElement:Zf}),((wK=TB.reactiveElementVersions)!==null&&wK!==void 0?wK:TB.reactiveElementVersions=[]).push("1.6.3");var EK,MB=window,Ow=MB.trustedTypes,kAe=Ow?Ow.createPolicy("lit-html",{createHTML:e=>e}):void 0,CK="$lit$",t0=`lit$${(Math.random()+"").slice(9)}$`,$Ae="?"+t0,jVe=`<${$Ae}>`,p1=document,$A=()=>p1.createComment(""),XA=e=>e===null||typeof e!="object"&&typeof e!="function",XAe=Array.isArray,HVe=e=>XAe(e)||typeof e?.[Symbol.iterator]=="function",AK=`[
12981
12981
  \f\r]`,qA=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,VAe=/-->/g,GAe=/>/g,d1=RegExp(`>|${AK}(?:([^\\s"'>=/]+)(${AK}*=${AK}*(?:[^
12982
12982
  \f\r"'\`<>=]|("|')|))|$)`,"g"),jAe=/'/g,HAe=/"/g,YAe=/^(?:script|style|textarea|title)$/i,KAe=e=>(t,...i)=>({_$litType$:e,strings:t,values:i}),ZAe=KAe(1),Ket=KAe(2),f1=Symbol.for("lit-noChange"),ro=Symbol.for("lit-nothing"),WAe=new WeakMap,c1=p1.createTreeWalker(p1,129,null,!1);function QAe(e,t){if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return kAe!==void 0?kAe.createHTML(t):t}var WVe=(e,t)=>{let i=e.length-1,r=[],n,s=t===2?"<svg>":"",a=qA;for(let o=0;o<i;o++){let l=e[o],u,h,d=-1,c=0;for(;c<l.length&&(a.lastIndex=c,h=a.exec(l),h!==null);)c=a.lastIndex,a===qA?h[1]==="!--"?a=VAe:h[1]!==void 0?a=GAe:h[2]!==void 0?(YAe.test(h[2])&&(n=RegExp("</"+h[2],"g")),a=d1):h[3]!==void 0&&(a=d1):a===d1?h[0]===">"?(a=n??qA,d=-1):h[1]===void 0?d=-2:(d=a.lastIndex-h[2].length,u=h[1],a=h[3]===void 0?d1:h[3]==='"'?HAe:jAe):a===HAe||a===jAe?a=d1:a===VAe||a===GAe?a=qA:(a=d1,n=void 0);let p=a===d1&&e[o+1].startsWith("/>")?" ":"";s+=a===qA?l+jVe:d>=0?(r.push(u),l.slice(0,d)+CK+l.slice(d)+t0+p):l+t0+(d===-2?(r.push(void 0),o):p)}return[QAe(e,s+(e[i]||"<?>")+(t===2?"</svg>":"")),r]},m1=class{constructor({strings:t,_$litType$:i},r){let n;this.parts=[];let s=0,a=0,o=t.length-1,l=this.parts,[u,h]=WVe(t,i);if(this.el=m1.createElement(u,r),c1.currentNode=this.el.content,i===2){let d=this.el.content,c=d.firstChild;c.remove(),d.append(...c.childNodes)}for(;(n=c1.nextNode())!==null&&l.length<o;){if(n.nodeType===1){if(n.hasAttributes()){let d=[];for(let c of n.getAttributeNames())if(c.endsWith(CK)||c.startsWith(t0)){let p=h[a++];if(d.push(c),p!==void 0){let f=n.getAttribute(p.toLowerCase()+CK).split(t0),m=/([.?@])?(.*)/.exec(p);l.push({type:1,index:s,name:m[2],strings:f,ctor:m[1]==="."?PK:m[1]==="?"?DK:m[1]==="@"?NK:Bw})}else l.push({type:6,index:s})}for(let c of d)n.removeAttribute(c)}if(YAe.test(n.tagName)){let d=n.textContent.split(t0),c=d.length-1;if(c>0){n.textContent=Ow?Ow.emptyScript:"";for(let p=0;p<c;p++)n.append(d[p],$A()),c1.nextNode(),l.push({type:2,index:++s});n.append(d[c],$A())}}}else if(n.nodeType===8)if(n.data===$Ae)l.push({type:2,index:s});else{let d=-1;for(;(d=n.data.indexOf(t0,d+1))!==-1;)l.push({type:7,index:s}),d+=t0.length-1}s++}}static createElement(t,i){let r=p1.createElement("template");return r.innerHTML=t,r}};function Lw(e,t,i=e,r){var n,s,a,o;if(t===f1)return t;let l=r!==void 0?(n=i._$Co)===null||n===void 0?void 0:n[r]:i._$Cl,u=XA(t)?void 0:t._$litDirective$;return l?.constructor!==u&&((s=l?._$AO)===null||s===void 0||s.call(l,!1),u===void 0?l=void 0:(l=new u(e),l._$AT(e,i,r)),r!==void 0?((a=(o=i)._$Co)!==null&&a!==void 0?a:o._$Co=[])[r]=l:i._$Cl=l),l!==void 0&&(t=Lw(e,l._$AS(e,t.values),l,r)),t}var RK=class{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var i;let{el:{content:r},parts:n}=this._$AD,s=((i=t?.creationScope)!==null&&i!==void 0?i:p1).importNode(r,!0);c1.currentNode=s;let a=c1.nextNode(),o=0,l=0,u=n[0];for(;u!==void 0;){if(o===u.index){let h;u.type===2?h=new g1(a,a.nextSibling,this,t):u.type===1?h=new u.ctor(a,u.name,u.strings,this,t):u.type===6&&(h=new IK(a,this,t)),this._$AV.push(h),u=n[++l]}o!==u?.index&&(a=c1.nextNode(),o++)}return c1.currentNode=p1,s}v(t){let i=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,i),i+=r.strings.length-2):r._$AI(t[i])),i++}},g1=class{constructor(t,i,r,n){var s;this.type=2,this._$AH=ro,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=r,this.options=n,this._$Cp=(s=n?.isConnected)===null||s===void 0||s}get _$AU(){var t,i;return(i=(t=this._$AM)===null||t===void 0?void 0:t._$AU)!==null&&i!==void 0?i:this._$Cp}get parentNode(){let t=this._$AA.parentNode,i=this._$AM;return i!==void 0&&t?.nodeType===11&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=Lw(this,t,i),XA(t)?t===ro||t==null||t===""?(this._$AH!==ro&&this._$AR(),this._$AH=ro):t!==this._$AH&&t!==f1&&this._(t):t._$litType$!==void 0?this.g(t):t.nodeType!==void 0?this.$(t):HVe(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==ro&&XA(this._$AH)?this._$AA.nextSibling.data=t:this.$(p1.createTextNode(t)),this._$AH=t}g(t){var i;let{values:r,_$litType$:n}=t,s=typeof n=="number"?this._$AC(t):(n.el===void 0&&(n.el=m1.createElement(QAe(n.h,n.h[0]),this.options)),n);if(((i=this._$AH)===null||i===void 0?void 0:i._$AD)===s)this._$AH.v(r);else{let a=new RK(s,this),o=a.u(this.options);a.v(r),this.$(o),this._$AH=a}}_$AC(t){let i=WAe.get(t.strings);return i===void 0&&WAe.set(t.strings,i=new m1(t)),i}T(t){XAe(this._$AH)||(this._$AH=[],this._$AR());let i=this._$AH,r,n=0;for(let s of t)n===i.length?i.push(r=new g1(this.k($A()),this.k($A()),this,this.options)):r=i[n],r._$AI(s),n++;n<i.length&&(this._$AR(r&&r._$AB.nextSibling,n),i.length=n)}_$AR(t=this._$AA.nextSibling,i){var r;for((r=this._$AP)===null||r===void 0||r.call(this,!1,!0,i);t&&t!==this._$AB;){let n=t.nextSibling;t.remove(),t=n}}setConnected(t){var i;this._$AM===void 0&&(this._$Cp=t,(i=this._$AP)===null||i===void 0||i.call(this,t))}},Bw=class{constructor(t,i,r,n,s){this.type=1,this._$AH=ro,this._$AN=void 0,this.element=t,this.name=i,this._$AM=n,this.options=s,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=ro}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,r,n){let s=this.strings,a=!1;if(s===void 0)t=Lw(this,t,i,0),a=!XA(t)||t!==this._$AH&&t!==f1,a&&(this._$AH=t);else{let o=t,l,u;for(t=s[0],l=0;l<s.length-1;l++)u=Lw(this,o[r+l],i,l),u===f1&&(u=this._$AH[l]),a||(a=!XA(u)||u!==this._$AH[l]),u===ro?t=ro:t!==ro&&(t+=(u??"")+s[l+1]),this._$AH[l]=u}a&&!n&&this.j(t)}j(t){t===ro?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},PK=class extends Bw{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===ro?void 0:t}},qVe=Ow?Ow.emptyScript:"",DK=class extends Bw{constructor(){super(...arguments),this.type=4}j(t){t&&t!==ro?this.element.setAttribute(this.name,qVe):this.element.removeAttribute(this.name)}},NK=class extends Bw{constructor(t,i,r,n,s){super(t,i,r,n,s),this.type=5}_$AI(t,i=this){var r;if((t=(r=Lw(this,t,i,0))!==null&&r!==void 0?r:ro)===f1)return;let n=this._$AH,s=t===ro&&n!==ro||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,a=t!==ro&&(n===ro||s);s&&this.element.removeEventListener(this.name,this,n),a&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var i,r;typeof this._$AH=="function"?this._$AH.call((r=(i=this.options)===null||i===void 0?void 0:i.host)!==null&&r!==void 0?r:this.element,t):this._$AH.handleEvent(t)}},IK=class{constructor(t,i,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){Lw(this,t)}};var qAe=MB.litHtmlPolyfillSupport;qAe?.(m1,g1),((EK=MB.litHtmlVersions)!==null&&EK!==void 0?EK:MB.litHtmlVersions=[]).push("2.8.0");var YA=(e,t,i)=>{var r,n;let s=(r=i?.renderBefore)!==null&&r!==void 0?r:t,a=s._$litPart$;if(a===void 0){let o=(n=i?.renderBefore)!==null&&n!==void 0?n:null;s._$litPart$=a=new g1(t.insertBefore($A(),o),o,void 0,i??{})}return a._$AI(e),a};var OK,LK;var i0=class extends Zf{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,i;let r=super.createRenderRoot();return(t=(i=this.renderOptions).renderBefore)!==null&&t!==void 0||(i.renderBefore=r.firstChild),r}update(t){let i=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=YA(i,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)===null||t===void 0||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)===null||t===void 0||t.setConnected(!1)}render(){return f1}};i0.finalized=!0,i0._$litElement$=!0,(OK=globalThis.litElementHydrateSupport)===null||OK===void 0||OK.call(globalThis,{LitElement:i0});var JAe=globalThis.litElementPolyfillSupport;JAe?.({LitElement:i0});((LK=globalThis.litElementVersions)!==null&&LK!==void 0?LK:globalThis.litElementVersions=[]).push("3.3.3");var eCe=e=>t=>typeof t=="function"?((i,r)=>(customElements.define(i,r),r))(e,t):((i,r)=>{let{kind:n,elements:s}=r;return{kind:n,elements:s,finisher(a){customElements.define(i,a)}}})(e,t);var $Ve=(e,t)=>t.kind==="method"&&t.descriptor&&!("value"in t.descriptor)?{...t,finisher(i){i.createProperty(t.key,e)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:t.key,initializer(){typeof t.initializer=="function"&&(this[t.key]=t.initializer.call(this))},finisher(i){i.createProperty(t.key,e)}},XVe=(e,t,i)=>{t.constructor.createProperty(i,e)};function Bh(e){return(t,i)=>i!==void 0?XVe(e,t,i):$Ve(e,t)}var BK,Stt=((BK=window.HTMLSlotElement)===null||BK===void 0?void 0:BK.prototype.assignedElements)!=null?(e,t)=>e.assignedElements(t):(e,t)=>e.assignedNodes(t).filter(i=>i.nodeType===Node.ELEMENT_NODE);var EB=window.IntersectionObserver!=null;var tCe=(e=32,t=2)=>{let i=e/2;return ZAe` <style>
12983
12983
  :host {