@splinetool/viewer 2.0.30 → 2.0.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -32,7 +32,7 @@ property scaling ${t.scaling.method}
32
32
  property quaternion ${t.quaternion.method}`;if(t.harmonics&&t.harmonics.length>0)for(let M=0;M<t.harmonics.length;M++)s=`${s}
33
33
  property harmonics_${M} ${t.harmonics[M].method}`;s=`${s}
34
34
  end_header
35
- `;let n=new TextEncoder().encode(s),a=r*2*4,o=t.xyz.quantized.data.buffer.byteLength,l=t.xyz instanceof Ms?a:0,u=t.color.quantized.data.buffer.byteLength,h=t.color instanceof Ms?a:0,d=t.opacity.quantized.data.buffer.byteLength,c=t.opacity instanceof Ms?a:0,p=t.scaling.quantized.data.buffer.byteLength,m=t.scaling instanceof Ms?a:0,f=t.quaternion.quantized.data.buffer.byteLength,g=t.quaternion instanceof Ms?a:0,y=t.variableChunkSize?Uint16Array.from(t.variableChunkSize):void 0,v=y?y.byteLength:0,b=n.byteLength+v+o+l+u+h+d+c+p+m+f+g,_=0,x=0;if(t.harmonics&&t.harmonics.length>0)for(let M=0;M<t.harmonics.length;M++)_+=t.harmonics[M].quantized.data.buffer.byteLength,x+=t.harmonics[M]instanceof Ms?a:0;_=0,x=0,b+=_+x;let S=new Uint8Array(b),w=0;if(S.set(n,w),w+=n.byteLength,v>0&&(S.set(new Uint8Array(y.buffer),w),w+=v),t.xyz instanceof Ms&&(S.set(new Uint8Array(t.xyz.minmaxMatrix.data.buffer),w),w+=a),S.set(new Uint8Array(t.xyz.quantized.data.buffer),w),w+=o,t.color instanceof Ms&&(S.set(new Uint8Array(t.color.minmaxMatrix.data.buffer),w),w+=a),S.set(new Uint8Array(t.color.quantized.data.buffer),w),w+=u,t.opacity instanceof Ms&&(S.set(new Uint8Array(t.opacity.minmaxMatrix.data.buffer),w),w+=a),S.set(new Uint8Array(t.opacity.quantized.data.buffer),w),w+=d,t.scaling instanceof Ms&&(S.set(new Uint8Array(t.scaling.minmaxMatrix.data.buffer),w),w+=a),S.set(new Uint8Array(t.scaling.quantized.data.buffer),w),w+=p,t.quaternion instanceof Ms&&(S.set(new Uint8Array(t.quaternion.minmaxMatrix.data.buffer),w),w+=a),S.set(new Uint8Array(t.quaternion.quantized.data.buffer),w),w+=f,_>0&&t.harmonics&&t.harmonics.length>0)for(let M=0;M<t.harmonics.length;M++){let T=t.harmonics[M];T instanceof Ms&&(S.set(new Uint8Array(T.minmaxMatrix.data.buffer),w),w+=a),S.set(new Uint8Array(T.quantized.data.buffer),w),w+=T.quantized.data.byteLength}return new sN(S.buffer)}}});async function mq(t){return createImageBitmap(new Blob([t]))}async function fq(t){return fetch(t).then(e=>{if(!e.ok)throw new Error(`Failed to fetch image: ${e.statusText}`);return e.blob()}).then(e=>createImageBitmap(e))}function Hwt(t){if(typeof t.requestVideoFrameCallback!="function"){t.hanaClockBase=++oN*Gwt;return}t.hanaPresentedFrames=++oN;let e=()=>{t.hanaDisposed||(t.hanaPresentedFrames=++oN)};t.addEventListener("seeked",e);let i=()=>{e(),!t.hanaDisposed&&(t.hanaFrameCallback=t.requestVideoFrameCallback(i))};t.hanaFrameCallback=t.requestVideoFrameCallback(i)}function gq(t){let e=t.hanaPresentedFrames;return e===void 0?t.hanaClockBase+t.currentTime:e}function $wt(t,e){t.hanaObjectUrl=URL.createObjectURL(e),t.src=t.hanaObjectUrl}function lN(t){if(t.hanaDisposed)return;t.hanaDisposed=!0;let e=t.hanaFrameCallback;e!==void 0&&(t.hanaFrameCallback=void 0,typeof t.cancelVideoFrameCallback=="function"&&t.cancelVideoFrameCallback(e));let i=t.hanaObjectUrl;i!==void 0&&(t.hanaObjectUrl=void 0,URL.revokeObjectURL(i)),t.pause(),t.removeAttribute("src"),t.load()}function Xwt(t){let e=r=>{let s=t.error;return new Error(s===null?r:`${r} (code ${s.code}: ${s.message})`)},i=r=>{let s=e(r);return lN(t),s};return t.error!==null?Promise.reject(i("video failed to load")):t.readyState>=Wwt?Promise.resolve(t):new Promise((r,s)=>{let n=setTimeout(()=>a(s,i("video timed out before presenting a frame")),qwt),a=(u,h)=>{clearTimeout(n),t.removeEventListener("loadeddata",o),t.removeEventListener("canplay",o),t.removeEventListener("error",l),u(h)},o=()=>a(r,t),l=()=>a(s,i("video failed to load"));t.addEventListener("loadeddata",o),t.addEventListener("canplay",o),t.addEventListener("error",l)})}function yq(t){return t.preload="auto",t.autoplay=!0,t.loop=!0,t.muted=!0,t.playsInline=!0,t.currentTime=.01,t.load(),t.onloadeddata=()=>{t.muted=!0;let e=t.play();e!==void 0&&e.then(i=>{}).catch(()=>{t.play()}).finally(()=>{t.pause()})},Hwt(t),Xwt(t)}async function vq(t){let e=document.createElement("video");return $wt(e,new Blob([t])),yq(e)}async function bq(t){let e=document.createElement("video");return e.crossOrigin="anonymous",e.src=t,yq(e)}var oN,Gwt,Wwt,qwt,_q=nT(()=>{"use strict";oN=0,Gwt=1e6,Wwt=2,qwt=3e4});var Oq={};kW(Oq,{DeviceLostPromise:()=>kc,Engine:()=>zc,PixelReadPromise:()=>sd,SceneController:()=>Sb,addRealizedChild:()=>Ywt,componentInstanceRefreshOps:()=>Kwt,default:()=>Z2t,dematerializeInstance:()=>Zwt,duplicateComponentInstance:()=>Qwt,initSync:()=>K2t,overrideForRealizedEdit:()=>Jwt,realizeComponentInstance:()=>t2t,removeRealizedNode:()=>e2t,web_init:()=>i2t});function Ywt(t,e,i,r,s){let n=Y.addRealizedChild($(t),$(e),$(i),$(r),$(s));return Oe(n)}function Kwt(t,e,i,r,s){let n=Y.componentInstanceRefreshOps($(t),$(e),$(i),$(r),$(s));return Oe(n)}function Zwt(t,e,i,r){let s=Y.dematerializeInstance($(t),$(e),$(i),$(r));return Oe(s)}function Qwt(t,e,i,r){let s=Y.duplicateComponentInstance($(t),$(e),$(i),$(r));return Oe(s)}function Jwt(t,e,i,r,s){let n=Y.overrideForRealizedEdit($(t),$(e),$(i),$(r),$(s));return Oe(n)}function t2t(t,e,i){let r=Y.realizeComponentInstance($(t),$(e),$(i));return Oe(r)}function e2t(t,e,i,r){let s=Y.removeRealizedNode($(t),$(e),$(i),$(r));return Oe(s)}function i2t(){Y.web_init()}function Nq(){return{__proto__:null,"./hana_bg.js":{__proto__:null,__wbg_Error_ef53bc310eb298a0:function(e,i){let r=Error(hi(e,i));return $(r)},__wbg_Number_6b506e6536831eaa:function(e){return Number(E(e))},__wbg_Window_afcc911b2f9c92e2:function(e){let i=E(e).Window;return $(i)},__wbg_WorkerGlobalScope_5d19ebc889ff397e:function(e){let i=E(e).WorkerGlobalScope;return $(i)},__wbg___wbindgen_bigint_get_as_i64_38130e98eecd467d:function(e,i){let r=E(i),s=typeof r=="bigint"?r:void 0;ze().setBigInt64(e+8,Fe(s)?BigInt(0):s,!0),ze().setInt32(e+0,!Fe(s),!0)},__wbg___wbindgen_boolean_get_1a45e2c38d4d41b9:function(e){let i=E(e),r=typeof i=="boolean"?i:void 0;return Fe(r)?16777215:r?1:0},__wbg___wbindgen_debug_string_0accd80f45e5faa2:function(e,i){let r=vN(E(i)),s=As(r,Y.__wbindgen_export,Y.__wbindgen_export2),n=kr;ze().setInt32(e+4,n,!0),ze().setInt32(e+0,s,!0)},__wbg___wbindgen_in_70a403a56e771704:function(e,i){return E(e)in E(i)},__wbg___wbindgen_is_bigint_6ffd6468a9bc44b9:function(e){return typeof E(e)=="bigint"},__wbg___wbindgen_is_function_754e9f305ff6029e:function(e){return typeof E(e)=="function"},__wbg___wbindgen_is_null_87c3bfe968c6a5ad:function(e){return E(e)===null},__wbg___wbindgen_is_null_or_undefined_cf617b836541fad3:function(e){return E(e)==null},__wbg___wbindgen_is_object_56732c2bc353f41d:function(e){let i=E(e);return typeof i=="object"&&i!==null},__wbg___wbindgen_is_string_c236cabd84a4d769:function(e){return typeof E(e)=="string"},__wbg___wbindgen_is_undefined_67b456be8673d3d7:function(e){return E(e)===void 0},__wbg___wbindgen_jsval_eq_1068e624fa87f6ab:function(e,i){return E(e)===E(i)},__wbg___wbindgen_jsval_loose_eq_2c56564c75129511:function(e,i){return E(e)==E(i)},__wbg___wbindgen_number_get_9bb1761122181af2:function(e,i){let r=E(i),s=typeof r=="number"?r:void 0;ze().setFloat64(e+8,Fe(s)?0:s,!0),ze().setInt32(e+0,!Fe(s),!0)},__wbg___wbindgen_string_get_72bdf95d3ae505b1:function(e,i){let r=E(i),s=typeof r=="string"?r:void 0;var n=Fe(s)?0:As(s,Y.__wbindgen_export,Y.__wbindgen_export2),a=kr;ze().setInt32(e+4,a,!0),ze().setInt32(e+0,n,!0)},__wbg___wbindgen_throw_1506f2235d1bdba0:function(e,i){throw new Error(hi(e,i))},__wbg__wbg_cb_unref_61db23ac97f16c31:function(e){E(e)._wbg_cb_unref()},__wbg_activeTexture_7a0d6fe7120979ce:function(e,i){E(e).activeTexture(i>>>0)},__wbg_activeTexture_dd15c31d50b73529:function(e,i){E(e).activeTexture(i>>>0)},__wbg_addEventListener_5593b0efd622abd6:function(){return De(function(e,i,r,s,n){E(e).addEventListener(hi(i,r),E(s),E(n))},arguments)},__wbg_arrayBuffer_05927079aabe6d46:function(){return De(function(e){let i=E(e).arrayBuffer();return $(i)},arguments)},__wbg_assign_551ec2d000f70c24:function(){return De(function(e,i,r){E(e).assign(hi(i,r))},arguments)},__wbg_attachShader_5c6a46e7c0fc637a:function(e,i,r){E(e).attachShader(E(i),E(r))},__wbg_attachShader_c2b12b36afa45936:function(e,i,r){E(e).attachShader(E(i),E(r))},__wbg_beginComputePass_431a159006c13c7c:function(e,i){let r=E(e).beginComputePass(E(i));return $(r)},__wbg_beginRenderPass_aa22c432e793359a:function(){return De(function(e,i){let r=E(e).beginRenderPass(E(i));return $(r)},arguments)},__wbg_bindBuffer_3841df88ccee4ed0:function(e,i,r){E(e).bindBuffer(i>>>0,E(r))},__wbg_bindBuffer_aa5dc7dc1c8ad1c8:function(e,i,r){E(e).bindBuffer(i>>>0,E(r))},__wbg_bindFramebuffer_10bbdf7040d89a17:function(e,i,r){E(e).bindFramebuffer(i>>>0,E(r))},__wbg_bindFramebuffer_ee8e42543c29c602:function(e,i,r){E(e).bindFramebuffer(i>>>0,E(r))},__wbg_bindRenderbuffer_7808d8eabbe18554:function(e,i,r){E(e).bindRenderbuffer(i>>>0,E(r))},__wbg_bindRenderbuffer_c0360bfb79c193c2:function(e,i,r){E(e).bindRenderbuffer(i>>>0,E(r))},__wbg_bindTexture_28d1d695d4801955:function(e,i,r){E(e).bindTexture(i>>>0,E(r))},__wbg_bindTexture_a1a012a31e1419d5:function(e,i,r){E(e).bindTexture(i>>>0,E(r))},__wbg_bindVertexArrayOES_15e48910a5d208b1:function(e,i){E(e).bindVertexArrayOES(E(i))},__wbg_bindVertexArray_4f2f0a7892280041:function(e,i){E(e).bindVertexArray(E(i))},__wbg_blendEquation_1ced323efc9ce0f8:function(e,i){E(e).blendEquation(i>>>0)},__wbg_blendEquation_a12f5acd9d14fb9b:function(e,i){E(e).blendEquation(i>>>0)},__wbg_blendFunc_d5202c7fe94c67ee:function(e,i,r){E(e).blendFunc(i>>>0,r>>>0)},__wbg_blendFunc_fbff85cd0fce280e:function(e,i,r){E(e).blendFunc(i>>>0,r>>>0)},__wbg_blitFramebuffer_acb954bfb30ed714:function(e,i,r,s,n,a,o,l,u,h,d){E(e).blitFramebuffer(i,r,s,n,a,o,l,u,h>>>0,d>>>0)},__wbg_bufferData_043a7e5da22f40d9:function(e,i,r,s){E(e).bufferData(i>>>0,r,s>>>0)},__wbg_bufferData_7b6881381d415425:function(e,i,r,s){E(e).bufferData(i>>>0,E(r),s>>>0)},__wbg_bufferData_9fddca30299e6114:function(e,i,r,s){E(e).bufferData(i>>>0,r,s>>>0)},__wbg_bufferData_f0837cec09725cc0:function(e,i,r,s){E(e).bufferData(i>>>0,E(r),s>>>0)},__wbg_bufferSubData_885e4f8d5833cf11:function(e,i,r,s){E(e).bufferSubData(i>>>0,r,E(s))},__wbg_bufferSubData_8fc824b6a9503f12:function(e,i,r,s){E(e).bufferSubData(i>>>0,r,E(s))},__wbg_call_8a89609d89f6608a:function(){return De(function(e,i){let r=E(e).call(E(i));return $(r)},arguments)},__wbg_call_9c758de292015997:function(){return De(function(e,i,r){let s=E(e).call(E(i),E(r));return $(s)},arguments)},__wbg_clearBufferfv_2e2858bd8bcf1715:function(e,i,r,s,n){E(e).clearBufferfv(i>>>0,r,Ho(s,n))},__wbg_clearBufferiv_e356514eb1d165fe:function(e,i,r,s,n){E(e).clearBufferiv(i>>>0,r,Pq(s,n))},__wbg_compileShader_8810a4868b23621b:function(e,i){E(e).compileShader(E(i))},__wbg_compileShader_ec8d5eb7f2b70a48:function(e,i){E(e).compileShader(E(i))},__wbg_configure_0e4789c0f6b35c8e:function(){return De(function(e,i){E(e).configure(E(i))},arguments)},__wbg_copyBufferSubData_9936fdf5e53e1832:function(e,i,r,s,n,a){E(e).copyBufferSubData(i>>>0,r>>>0,s,n,a)},__wbg_copyBufferToBuffer_5e2cd8f10ae78183:function(){return De(function(e,i,r,s,n){E(e).copyBufferToBuffer(E(i),r,E(s),n)},arguments)},__wbg_copyBufferToBuffer_ca30deb8de65f5d5:function(){return De(function(e,i,r,s,n,a){E(e).copyBufferToBuffer(E(i),r,E(s),n,a)},arguments)},__wbg_copyExternalImageToTexture_4df105bb39517948:function(){return De(function(e,i,r,s){E(e).copyExternalImageToTexture(E(i),E(r),E(s))},arguments)},__wbg_copyTextureToBuffer_ed6e67a77ecb768d:function(){return De(function(e,i,r,s){E(e).copyTextureToBuffer(E(i),E(r),E(s))},arguments)},__wbg_createBindGroupLayout_49a7e2b3d076afcf:function(){return De(function(e,i){let r=E(e).createBindGroupLayout(E(i));return $(r)},arguments)},__wbg_createBindGroup_655c6e6c0258530e:function(e,i){let r=E(e).createBindGroup(E(i));return $(r)},__wbg_createBuffer_0726dd2ab09ea1d2:function(){return De(function(e,i){let r=E(e).createBuffer(E(i));return $(r)},arguments)},__wbg_createBuffer_333d6aae40284594:function(e){let i=E(e).createBuffer();return Fe(i)?0:$(i)},__wbg_createBuffer_3ae54605e5676c83:function(e){let i=E(e).createBuffer();return Fe(i)?0:$(i)},__wbg_createCommandEncoder_ec1f40f0cb4d09df:function(e,i){let r=E(e).createCommandEncoder(E(i));return $(r)},__wbg_createComputePipelineAsync_afe7021ac5a02993:function(e,i){let r=E(e).createComputePipelineAsync(E(i));return $(r)},__wbg_createFramebuffer_6f42ff976bb98152:function(e){let i=E(e).createFramebuffer();return Fe(i)?0:$(i)},__wbg_createFramebuffer_ef1247e8b2e9b09f:function(e){let i=E(e).createFramebuffer();return Fe(i)?0:$(i)},__wbg_createPipelineLayout_2c8cd4528b06c108:function(e,i){let r=E(e).createPipelineLayout(E(i));return $(r)},__wbg_createProgram_b48c3323af547213:function(e){let i=E(e).createProgram();return Fe(i)?0:$(i)},__wbg_createProgram_f6a8df4491031d57:function(e){let i=E(e).createProgram();return Fe(i)?0:$(i)},__wbg_createQuerySet_cb7b21d1d405b890:function(){return De(function(e,i){let r=E(e).createQuerySet(E(i));return $(r)},arguments)},__wbg_createRenderPipelineAsync_eecad1e54ef27acf:function(e,i){let r=E(e).createRenderPipelineAsync(E(i));return $(r)},__wbg_createRenderPipeline_cf98d4d699bfb03c:function(){return De(function(e,i){let r=E(e).createRenderPipeline(E(i));return $(r)},arguments)},__wbg_createRenderbuffer_a2f947c7fa8c8bf0:function(e){let i=E(e).createRenderbuffer();return Fe(i)?0:$(i)},__wbg_createRenderbuffer_c09d5809ac95924e:function(e){let i=E(e).createRenderbuffer();return Fe(i)?0:$(i)},__wbg_createSampler_c8ffb3c8d565f704:function(e,i){let r=E(e).createSampler(E(i));return $(r)},__wbg_createShaderModule_2e44fc7677c6288b:function(e,i){let r=E(e).createShaderModule(E(i));return $(r)},__wbg_createShader_0e3f814b69e9e184:function(e,i){let r=E(e).createShader(i>>>0);return Fe(r)?0:$(r)},__wbg_createShader_383b3295276271d2:function(e,i){let r=E(e).createShader(i>>>0);return Fe(r)?0:$(r)},__wbg_createTexture_1bac74c999b8a48e:function(){return De(function(e,i){let r=E(e).createTexture(E(i));return $(r)},arguments)},__wbg_createTexture_461a3048c40e7175:function(e){let i=E(e).createTexture();return Fe(i)?0:$(i)},__wbg_createTexture_d6e2c1f04a554a15:function(e){let i=E(e).createTexture();return Fe(i)?0:$(i)},__wbg_createVertexArrayOES_2f67d3679ba9a29c:function(e){let i=E(e).createVertexArrayOES();return Fe(i)?0:$(i)},__wbg_createVertexArray_febd1d11636d15ad:function(e){let i=E(e).createVertexArray();return Fe(i)?0:$(i)},__wbg_createView_ceaf2f5881adbd34:function(){return De(function(e,i){let r=E(e).createView(E(i));return $(r)},arguments)},__wbg_cullFace_a4ee8b8c3c126388:function(e,i){E(e).cullFace(i>>>0)},__wbg_cullFace_c6b39a55ccade015:function(e,i){E(e).cullFace(i>>>0)},__wbg_currentTime_0b40b60bc76843cb:function(e){return E(e).currentTime},__wbg_debug_78b457f1effb3792:function(e){console.debug(E(e))},__wbg_deleteBuffer_520156dc8a1f81af:function(e,i){E(e).deleteBuffer(E(i))},__wbg_deleteBuffer_a925fdd1b590fbbc:function(e,i){E(e).deleteBuffer(E(i))},__wbg_deleteFramebuffer_aa4bf9f184123318:function(e,i){E(e).deleteFramebuffer(E(i))},__wbg_deleteFramebuffer_cc043e5a8cb9a556:function(e,i){E(e).deleteFramebuffer(E(i))},__wbg_deleteProgram_0c859ebcab2b7b5a:function(e,i){E(e).deleteProgram(E(i))},__wbg_deleteProgram_df6a6609c7d91a6e:function(e,i){E(e).deleteProgram(E(i))},__wbg_deleteRenderbuffer_37c079dbc257fcf9:function(e,i){E(e).deleteRenderbuffer(E(i))},__wbg_deleteRenderbuffer_4b7a888363766554:function(e,i){E(e).deleteRenderbuffer(E(i))},__wbg_deleteShader_170dea06bd074d01:function(e,i){E(e).deleteShader(E(i))},__wbg_deleteShader_944accd60733a9cb:function(e,i){E(e).deleteShader(E(i))},__wbg_deleteTexture_54dee8e15570751e:function(e,i){E(e).deleteTexture(E(i))},__wbg_deleteTexture_be3eaabebb89a85e:function(e,i){E(e).deleteTexture(E(i))},__wbg_deleteVertexArrayOES_4262d2d0e9fb77c5:function(e,i){E(e).deleteVertexArrayOES(E(i))},__wbg_deleteVertexArray_8f0fb3b3d54c7483:function(e,i){E(e).deleteVertexArray(E(i))},__wbg_depthMask_95332b64c5ef8b45:function(e,i){E(e).depthMask(i!==0)},__wbg_depthMask_f55bea4b6c3b9531:function(e,i){E(e).depthMask(i!==0)},__wbg_description_02485704e69b1e7f:function(e,i){let r=E(i).description,s=As(r,Y.__wbindgen_export,Y.__wbindgen_export2),n=kr;ze().setInt32(e+4,n,!0),ze().setInt32(e+0,s,!0)},__wbg_disable_2cf98ccb81612ef9:function(e,i){E(e).disable(i>>>0)},__wbg_disable_6b825656c54f5646:function(e,i){E(e).disable(i>>>0)},__wbg_dispatchWorkgroups_afb2344298c62227:function(e,i,r,s){E(e).dispatchWorkgroups(i>>>0,r>>>0,s>>>0)},__wbg_displayHeight_465673c1823a1db3:function(e){return E(e).displayHeight},__wbg_displayWidth_73729fd8eb965076:function(e){return E(e).displayWidth},__wbg_disposeVideo_c94c1ccd57a63f68:function(e){lN(E(e))},__wbg_document_aceb08cd6489baf5:function(e){let i=E(e).document;return Fe(i)?0:$(i)},__wbg_done_60cf307fcc680536:function(e){return E(e).done},__wbg_drawArrays_6eb87620c1dcbfb4:function(e,i,r,s){E(e).drawArrays(i>>>0,r,s)},__wbg_drawArrays_f332b526550a641e:function(e,i,r,s){E(e).drawArrays(i>>>0,r,s)},__wbg_drawBuffersWEBGL_10cdfe87c17cd93f:function(e,i){E(e).drawBuffersWEBGL(E(i))},__wbg_drawBuffers_c5a9ee312b2d6fa8:function(e,i){E(e).drawBuffers(E(i))},__wbg_drawElements_23ec4847dad548e0:function(e,i,r,s,n){E(e).drawElements(i>>>0,r,s>>>0,n)},__wbg_drawElements_fe4671e9c358058d:function(e,i,r,s,n){E(e).drawElements(i>>>0,r,s>>>0,n)},__wbg_drawIndexed_d31913e79d58fbac:function(e,i,r,s,n,a){E(e).drawIndexed(i>>>0,r>>>0,s>>>0,n,a>>>0)},__wbg_draw_6877f98847e1e36c:function(e,i,r,s,n){E(e).draw(i>>>0,r>>>0,s>>>0,n>>>0)},__wbg_duration_d6a6a568a0baf72d:function(e){return E(e).duration},__wbg_enableVertexAttribArray_cc09a0312b6adee5:function(e,i){E(e).enableVertexAttribArray(i>>>0)},__wbg_enableVertexAttribArray_f88d3d499ab40ea6:function(e,i){E(e).enableVertexAttribArray(i>>>0)},__wbg_enable_1928c361308989d5:function(e,i){E(e).enable(i>>>0)},__wbg_enable_2cc4ff32a0fd985f:function(e,i){E(e).enable(i>>>0)},__wbg_end_c36889de8ddef882:function(e){E(e).end()},__wbg_end_f99ebed53d4e198a:function(e){E(e).end()},__wbg_engine_new:function(e){let i=zc.__wrap(e);return $(i)},__wbg_entries_04b37a02507f1713:function(e){let i=Object.entries(E(e));return $(i)},__wbg_error_78ff5b3a29b770e0:function(e){console.error(E(e))},__wbg_error_a6fa202b58aa1cd3:function(e,i){let r,s;try{r=e,s=i,console.error(hi(e,i))}finally{Y.__wbindgen_export4(r,s,1)}},__wbg_features_2b07a28fe18ad0ce:function(e){let i=E(e).features;return $(i)},__wbg_features_d4d2020319592cbe:function(e){let i=E(e).features;return $(i)},__wbg_fetch_ce1af4d1b59a60be:function(e,i){let r=E(e).fetch(E(i));return $(r)},__wbg_finish_4d91de5e927dd13f:function(e,i){let r=E(e).finish(E(i));return $(r)},__wbg_finish_6e06b68ab68cd9f6:function(e){let i=E(e).finish();return $(i)},__wbg_flush_2088ebca1fd13068:function(e){E(e).flush()},__wbg_flush_3be48fce9f195fa5:function(e){E(e).flush()},__wbg_framebufferRenderbuffer_0c9d0e5587497683:function(e,i,r,s,n){E(e).framebufferRenderbuffer(i>>>0,r>>>0,s>>>0,E(n))},__wbg_framebufferRenderbuffer_599e58ad30dcfeb3:function(e,i,r,s,n){E(e).framebufferRenderbuffer(i>>>0,r>>>0,s>>>0,E(n))},__wbg_framebufferTexture2D_44caed1725e57636:function(e,i,r,s,n,a){E(e).framebufferTexture2D(i>>>0,r>>>0,s>>>0,E(n),a)},__wbg_framebufferTexture2D_fbba21b750c2316a:function(e,i,r,s,n,a){E(e).framebufferTexture2D(i>>>0,r>>>0,s>>>0,E(n),a)},__wbg_from_d300fe49deab18f5:function(e){let i=Array.from(E(e));return $(i)},__wbg_generateMipmap_1403959fc241438f:function(e,i){E(e).generateMipmap(i>>>0)},__wbg_generateMipmap_b261c040d5707fe5:function(e,i){E(e).generateMipmap(i>>>0)},__wbg_getActiveUniform_3a275fd8fdf7a327:function(e,i,r){let s=E(e).getActiveUniform(E(i),r>>>0);return Fe(s)?0:$(s)},__wbg_getActiveUniform_86f7a30e1a52aca4:function(e,i,r){let s=E(e).getActiveUniform(E(i),r>>>0);return Fe(s)?0:$(s)},__wbg_getContext_469d34698d869fc1:function(){return De(function(e,i,r){let s=E(e).getContext(hi(i,r));return Fe(s)?0:$(s)},arguments)},__wbg_getContext_5b39fff76491fded:function(){return De(function(e,i,r,s){let n=E(e).getContext(hi(i,r),E(s));return Fe(n)?0:$(n)},arguments)},__wbg_getContext_7d3a8f461c828713:function(){return De(function(e,i,r){let s=E(e).getContext(hi(i,r));return Fe(s)?0:$(s)},arguments)},__wbg_getCurrentTexture_20714d1bd9051cab:function(){return De(function(e){let i=E(e).getCurrentTexture();return $(i)},arguments)},__wbg_getExtension_454cdc5ffd07bf03:function(){return De(function(e,i,r){let s=E(e).getExtension(hi(i,r));return Fe(s)?0:$(s)},arguments)},__wbg_getMappedRange_d0bf3141224111b6:function(){return De(function(e,i,r){let s=E(e).getMappedRange(i,r);return $(s)},arguments)},__wbg_getParameter_015942a7ad566b20:function(){return De(function(e,i){let r=E(e).getParameter(i>>>0);return $(r)},arguments)},__wbg_getParameter_1e77e23f5ccf0300:function(){return De(function(e,i){let r=E(e).getParameter(i>>>0);return $(r)},arguments)},__wbg_getPreferredCanvasFormat_8b57039d1801a506:function(e){let i=E(e).getPreferredCanvasFormat();return(Rm.indexOf(i)+1||102)-1},__wbg_getProgramInfoLog_2f9cfcecc4f772e1:function(e,i,r){let s=E(i).getProgramInfoLog(E(r));var n=Fe(s)?0:As(s,Y.__wbindgen_export,Y.__wbindgen_export2),a=kr;ze().setInt32(e+4,a,!0),ze().setInt32(e+0,n,!0)},__wbg_getProgramInfoLog_f0d48f606547aed7:function(e,i,r){let s=E(i).getProgramInfoLog(E(r));var n=Fe(s)?0:As(s,Y.__wbindgen_export,Y.__wbindgen_export2),a=kr;ze().setInt32(e+4,a,!0),ze().setInt32(e+0,n,!0)},__wbg_getProgramParameter_08beabb2736d5769:function(e,i,r){let s=E(e).getProgramParameter(E(i),r>>>0);return $(s)},__wbg_getProgramParameter_aee848e1db52b7cd:function(e,i,r){let s=E(e).getProgramParameter(E(i),r>>>0);return $(s)},__wbg_getRandomValues_3f44b700395062e5:function(){return De(function(e,i){globalThis.crypto.getRandomValues(Vc(e,i))},arguments)},__wbg_getRandomValues_bf16787eede473f5:function(){return De(function(e,i){globalThis.crypto.getRandomValues(Vc(e,i))},arguments)},__wbg_getShaderInfoLog_510365af17f29a35:function(e,i,r){let s=E(i).getShaderInfoLog(E(r));var n=Fe(s)?0:As(s,Y.__wbindgen_export,Y.__wbindgen_export2),a=kr;ze().setInt32(e+4,a,!0),ze().setInt32(e+0,n,!0)},__wbg_getShaderInfoLog_cd77c7b7bdb9ce65:function(e,i,r){let s=E(i).getShaderInfoLog(E(r));var n=Fe(s)?0:As(s,Y.__wbindgen_export,Y.__wbindgen_export2),a=kr;ze().setInt32(e+4,a,!0),ze().setInt32(e+0,n,!0)},__wbg_getSupportedExtensions_7a31b3412a25d9ba:function(e){let i=E(e).getSupportedExtensions();return Fe(i)?0:$(i)},__wbg_getUniformLocation_010256f946f9a865:function(e,i,r,s){let n=E(e).getUniformLocation(E(i),hi(r,s));return Fe(n)?0:$(n)},__wbg_getUniformLocation_f9774d4f157f5914:function(e,i,r,s){let n=E(e).getUniformLocation(E(i),hi(r,s));return Fe(n)?0:$(n)},__wbg_get_1f8f054ddbaa7db2:function(){return De(function(e,i){let r=Reflect.get(E(e),E(i));return $(r)},arguments)},__wbg_get_2b48c7d0d006a781:function(e,i){let r=E(e)[i>>>0];return $(r)},__wbg_get_cb935c1402921898:function(e,i){let r=E(e)[i>>>0];return Fe(r)?0:$(r)},__wbg_get_de6a0f7d4d18a304:function(){return De(function(e,i){let r=Reflect.get(E(e),E(i));return $(r)},arguments)},__wbg_get_index_ab123d64c89e3156:function(e,i){return E(e)[i>>>0]},__wbg_get_unchecked_33f6e5c9e2f2d6b2:function(e,i){let r=E(e)[i>>>0];return $(r)},__wbg_get_with_ref_key_6412cf3094599694:function(e,i){let r=E(e)[E(i)];return $(r)},__wbg_get_with_ref_key_7e638bba08a44478:function(e,i){let r=E(e)[E(i)];return $(r)},__wbg_gpu_2ccc250735d24a2a:function(e){let i=E(e).gpu;return $(i)},__wbg_has_0c97053e877f47cc:function(e,i,r){return E(e).has(hi(i,r))},__wbg_has_73740b27f436fed3:function(){return De(function(e,i){return Reflect.has(E(e),E(i))},arguments)},__wbg_height_4e7694e4e2110bdb:function(e){return E(e).height},__wbg_info_af7f45292ba9b0ea:function(e){console.info(E(e))},__wbg_info_cf0d9a286850cd24:function(e){let i=E(e).info;return $(i)},__wbg_innerHeight_8b6ee2571dbedb9d:function(){return De(function(e){let i=E(e).innerHeight;return $(i)},arguments)},__wbg_innerWidth_7475bec19f48fe43:function(){return De(function(e){let i=E(e).innerWidth;return $(i)},arguments)},__wbg_instanceof_ArrayBuffer_8f49811467741499:function(e){let i;try{i=E(e)instanceof ArrayBuffer}catch{i=!1}return i},__wbg_instanceof_GpuOutOfMemoryError_6429c750997f1c8d:function(e){let i;try{i=E(e)instanceof GPUOutOfMemoryError}catch{i=!1}return i},__wbg_instanceof_GpuValidationError_75fa3611f065f4df:function(e){let i;try{i=E(e)instanceof GPUValidationError}catch{i=!1}return i},__wbg_instanceof_HtmlVideoElement_95590e1ff107ba83:function(e){let i;try{i=E(e)instanceof HTMLVideoElement}catch{i=!1}return i},__wbg_instanceof_ImageBitmap_beed1259521cd66d:function(e){let i;try{i=E(e)instanceof ImageBitmap}catch{i=!1}return i},__wbg_instanceof_Response_cb984bd66d7bd408:function(e){let i;try{i=E(e)instanceof Response}catch{i=!1}return i},__wbg_instanceof_Uint8Array_86f30649f63ef9c2:function(e){let i;try{i=E(e)instanceof Uint8Array}catch{i=!1}return i},__wbg_instanceof_WebGl2RenderingContext_39d13e3f953130c7:function(e){let i;try{i=E(e)instanceof WebGL2RenderingContext}catch{i=!1}return i},__wbg_instanceof_Window_e093be59ee9a8e14:function(e){let i;try{i=E(e)instanceof Window}catch{i=!1}return i},__wbg_invalidateFramebuffer_6b8dae55a3debb1d:function(){return De(function(e,i,r){E(e).invalidateFramebuffer(i>>>0,E(r))},arguments)},__wbg_isArray_67c2c9c4313f4448:function(e){return Array.isArray(E(e))},__wbg_isFallbackAdapter_8ccb967428491dcb:function(e){return E(e).isFallbackAdapter},__wbg_isSafeInteger_66acec27e09e99a7:function(e){return Number.isSafeInteger(E(e))},__wbg_iterator_8732428d309e270e:function(){return $(Symbol.iterator)},__wbg_label_7ed42f25f841996b:function(e,i){let r=E(i).label,s=As(r,Y.__wbindgen_export,Y.__wbindgen_export2),n=kr;ze().setInt32(e+4,n,!0),ze().setInt32(e+0,s,!0)},__wbg_length_280688879ee7deb5:function(e){return E(e).length},__wbg_length_4a591ecaa01354d9:function(e){return E(e).length},__wbg_length_66f1a4b2e9026940:function(e){return E(e).length},__wbg_limits_20c6f56636df7d38:function(e){let i=E(e).limits;return $(i)},__wbg_limits_328c61cd41512420:function(e){let i=E(e).limits;return $(i)},__wbg_linkProgram_3ccc9beaa6dace28:function(e,i){E(e).linkProgram(E(i))},__wbg_linkProgram_fe2b1bf26336c4a5:function(e,i){E(e).linkProgram(E(i))},__wbg_loadImageFromBytes_3d42766b73aca4ca:function(e){let i=mq(Oe(e));return $(i)},__wbg_loadImageFromUrl_50be99dbf040255b:function(e,i){let r,s;try{r=e,s=i;let n=fq(hi(e,i));return $(n)}finally{Y.__wbindgen_export4(r,s,1)}},__wbg_loadVideoFromBytes_3d884aadcf4d2139:function(e){let i=vq(Oe(e));return $(i)},__wbg_loadVideoFromUrl_7997ffb030d4b08b:function(e,i){let r,s;try{r=e,s=i;let n=bq(hi(e,i));return $(n)}finally{Y.__wbindgen_export4(r,s,1)}},__wbg_location_efdf1fea18b5552a:function(e){let i=E(e).location;return $(i)},__wbg_log_cf2e968649f3384e:function(e){console.log(E(e))},__wbg_lost_0fa164c88f543338:function(e){let i=E(e).lost;return $(i)},__wbg_mapAsync_52b01fa9e8f765fd:function(e,i,r,s){let n=E(e).mapAsync(i>>>0,r,s);return $(n)},__wbg_maxBindGroupsPlusVertexBuffers_33e5006b23e20478:function(e){return E(e).maxBindGroupsPlusVertexBuffers},__wbg_maxBindGroups_f6d26f3a67826666:function(e){return E(e).maxBindGroups},__wbg_maxBindingsPerBindGroup_edab2e8dabbf6060:function(e){return E(e).maxBindingsPerBindGroup},__wbg_maxBufferSize_bbc69284c14aa7da:function(e){return E(e).maxBufferSize},__wbg_maxColorAttachmentBytesPerSample_63ebe4f81de2f34c:function(e){return E(e).maxColorAttachmentBytesPerSample},__wbg_maxColorAttachments_aed8c38beabf3a5c:function(e){return E(e).maxColorAttachments},__wbg_maxComputeInvocationsPerWorkgroup_2d964564c37f1c65:function(e){return E(e).maxComputeInvocationsPerWorkgroup},__wbg_maxComputeWorkgroupSizeX_a3e3206570da184f:function(e){return E(e).maxComputeWorkgroupSizeX},__wbg_maxComputeWorkgroupSizeY_dffa4a62244b7563:function(e){return E(e).maxComputeWorkgroupSizeY},__wbg_maxComputeWorkgroupSizeZ_976ebcb760f6d07d:function(e){return E(e).maxComputeWorkgroupSizeZ},__wbg_maxComputeWorkgroupStorageSize_2e8dbece6e532e2a:function(e){return E(e).maxComputeWorkgroupStorageSize},__wbg_maxComputeWorkgroupsPerDimension_bb7d36b4d20c80f4:function(e){return E(e).maxComputeWorkgroupsPerDimension},__wbg_maxDynamicStorageBuffersPerPipelineLayout_1ca859cb96a414e0:function(e){return E(e).maxDynamicStorageBuffersPerPipelineLayout},__wbg_maxDynamicUniformBuffersPerPipelineLayout_e968f2c8cd8f4d46:function(e){return E(e).maxDynamicUniformBuffersPerPipelineLayout},__wbg_maxInterStageShaderVariables_138ac882c4d6a3d3:function(e){return E(e).maxInterStageShaderVariables},__wbg_maxSampledTexturesPerShaderStage_bb3e6b2698321fa6:function(e){return E(e).maxSampledTexturesPerShaderStage},__wbg_maxSamplersPerShaderStage_98c00a1829fa414b:function(e){return E(e).maxSamplersPerShaderStage},__wbg_maxStorageBufferBindingSize_e500e31f479e669e:function(e){return E(e).maxStorageBufferBindingSize},__wbg_maxStorageBuffersPerShaderStage_eb663f6d7521b6a7:function(e){return E(e).maxStorageBuffersPerShaderStage},__wbg_maxStorageTexturesPerShaderStage_bb3ad93b53e618c0:function(e){return E(e).maxStorageTexturesPerShaderStage},__wbg_maxTextureArrayLayers_2a56d05fb261c99a:function(e){return E(e).maxTextureArrayLayers},__wbg_maxTextureDimension1D_84590c1d4770d319:function(e){return E(e).maxTextureDimension1D},__wbg_maxTextureDimension2D_7f2b5c8b2727e3fc:function(e){return E(e).maxTextureDimension2D},__wbg_maxTextureDimension3D_7f3babddf55c32a6:function(e){return E(e).maxTextureDimension3D},__wbg_maxUniformBufferBindingSize_d80a09e23c0b284c:function(e){return E(e).maxUniformBufferBindingSize},__wbg_maxUniformBuffersPerShaderStage_0b8b2de676fa740e:function(e){return E(e).maxUniformBuffersPerShaderStage},__wbg_maxVertexAttributes_a693dd921316649b:function(e){return E(e).maxVertexAttributes},__wbg_maxVertexBufferArrayStride_f256d91f281076cb:function(e){return E(e).maxVertexBufferArrayStride},__wbg_maxVertexBuffers_70ab564b25d5ac20:function(e){return E(e).maxVertexBuffers},__wbg_message_28959d6ca4d7dda0:function(e,i){let r=E(i).message,s=As(r,Y.__wbindgen_export,Y.__wbindgen_export2),n=kr;ze().setInt32(e+4,n,!0),ze().setInt32(e+0,s,!0)},__wbg_message_4ada57a3710f1502:function(e,i){let r=E(i).message,s=As(r,Y.__wbindgen_export,Y.__wbindgen_export2),n=kr;ze().setInt32(e+4,n,!0),ze().setInt32(e+0,s,!0)},__wbg_minStorageBufferOffsetAlignment_3248ed00dcdbf79f:function(e){return E(e).minStorageBufferOffsetAlignment},__wbg_minUniformBufferOffsetAlignment_3b9fa4caae03e903:function(e){return E(e).minUniformBufferOffsetAlignment},__wbg_name_b7fa2500fc153b89:function(e,i){let r=E(i).name,s=As(r,Y.__wbindgen_export,Y.__wbindgen_export2),n=kr;ze().setInt32(e+4,n,!0),ze().setInt32(e+0,s,!0)},__wbg_navigator_3833ecdbc19d2757:function(e){let i=E(e).navigator;return $(i)},__wbg_navigator_391291470f58c650:function(e){let i=E(e).navigator;return $(i)},__wbg_new_227d7c05414eb861:function(){let e=new Error;return $(e)},__wbg_new_3b242422c588a8f3:function(){return De(function(e,i){let r=new OffscreenCanvas(e>>>0,i>>>0);return $(r)},arguments)},__wbg_new_578aeef4b6b94378:function(e){let i=new Uint8Array(E(e));return $(i)},__wbg_new_b682b81e8eaaf027:function(e,i){try{var r={a:e,b:i},s=(a,o)=>{let l=r.a;r.a=0;try{return xq(l,r.b,a,o)}finally{r.a=l}};let n=new Promise(s);return $(n)}finally{r.a=0}},__wbg_new_ce1ab61c1c2b300d:function(){let e=new Object;return $(e)},__wbg_new_d90091b82fdf5b91:function(){let e=new Array;return $(e)},__wbg_new_from_slice_18fa1f71286d66b8:function(e,i){let r=new Uint8Array(Vc(e,i));return $(r)},__wbg_new_from_slice_3c93d0bc613de8f0:function(e,i){let r=new Float64Array(I2t(e,i));return $(r)},__wbg_new_from_slice_47be4219028de35d:function(e,i){let r=new Uint32Array(db(e,i));return $(r)},__wbg_new_from_slice_956df4f769fb782c:function(e,i){let r=new Float32Array(Ho(e,i));return $(r)},__wbg_new_typed_41c97238ee4583e3:function(){let e=new Object;return $(e)},__wbg_new_typed_bf31d18f92484486:function(e,i){try{var r={a:e,b:i},s=(a,o)=>{let l=r.a;r.a=0;try{return xq(l,r.b,a,o)}finally{r.a=l}};let n=new Promise(s);return $(n)}finally{r.a=0}},__wbg_new_with_byte_offset_and_length_d836f26d916dd9ad:function(e,i,r){let s=new Uint8Array(E(e),i>>>0,r>>>0);return $(s)},__wbg_new_with_length_36a4998e27b014c5:function(e){let i=new Uint8Array(e>>>0);return $(i)},__wbg_new_with_length_b4a87ccced374381:function(e){let i=new Float64Array(e>>>0);return $(i)},__wbg_new_with_str_and_init_bcd02b79a793d27f:function(){return De(function(e,i,r){let s=new Request(hi(e,i),E(r));return $(s)},arguments)},__wbg_next_9e03acdf51c4960d:function(e){let i=E(e).next;return $(i)},__wbg_next_eb8ca7351fa27906:function(){return De(function(e){let i=E(e).next();return $(i)},arguments)},__wbg_now_f565250295e2d180:function(e){return E(e).now()},__wbg_of_57145fdec12d159f:function(e){let i=Array.of(E(e));return $(i)},__wbg_ok_fb13c30bc1893039:function(e){return E(e).ok},__wbg_onSubmittedWorkDone_270d6b5a45520e79:function(e){let i=E(e).onSubmittedWorkDone();return $(i)},__wbg_open_177ad1dcc06b9106:function(){return De(function(e,i,r,s,n,a,o){let l=E(e).open(hi(i,r),hi(s,n),hi(a,o));return Fe(l)?0:$(l)},arguments)},__wbg_open_feb75fe4d9971c50:function(){return De(function(e,i,r,s,n){let a=E(e).open(hi(i,r),hi(s,n));return Fe(a)?0:$(a)},arguments)},__wbg_ownKeys_0587b8fe286a40e6:function(){return De(function(e){let i=Reflect.ownKeys(E(e));return $(i)},arguments)},__wbg_pause_adce2b37e004ae49:function(){return De(function(e){E(e).pause()},arguments)},__wbg_performance_68499ca0718837f5:function(e){let i=E(e).performance;return Fe(i)?0:$(i)},__wbg_pixelStorei_6e42d231aa75bd00:function(e,i,r){E(e).pixelStorei(i>>>0,r)},__wbg_pixelStorei_84dc1952dc699c94:function(e,i,r){E(e).pixelStorei(i>>>0,r)},__wbg_play_4ed9ece3cae2c100:function(){return De(function(e){let i=E(e).play();return $(i)},arguments)},__wbg_popErrorScope_8e7f4cbff8b758dd:function(e){let i=E(e).popErrorScope();return $(i)},__wbg_prototypesetcall_3249fc62a0fafa30:function(e,i,r){Uint8Array.prototype.set.call(Vc(e,i),E(r))},__wbg_prototypesetcall_59640349d2c6d881:function(e,i,r){Uint32Array.prototype.set.call(db(e,i),E(r))},__wbg_provokingVertexWEBGL_0354dc7ad44d69bf:function(e,i){E(e).provokingVertexWEBGL(i>>>0)},__wbg_pushErrorScope_fa23d1206bc26dce:function(e,i){E(e).pushErrorScope(v2t[i])},__wbg_push_a6822215aa43e71c:function(e,i){return E(e).push(E(i))},__wbg_querySelectorAll_4dcc230a2f8a2498:function(){return De(function(e,i,r){let s=E(e).querySelectorAll(hi(i,r));return $(s)},arguments)},__wbg_queueMicrotask_35c611f4a14830b2:function(e){queueMicrotask(E(e))},__wbg_queueMicrotask_404ed0a58e0b63cc:function(e){let i=E(e).queueMicrotask;return $(i)},__wbg_queue_adce34608fd0c893:function(e){let i=E(e).queue;return $(i)},__wbg_readBuffer_2027f7cdd7533f2d:function(e,i){E(e).readBuffer(i>>>0)},__wbg_readPixels_a04f5cf5019be695:function(){return De(function(e,i,r,s,n,a,o,l){E(e).readPixels(i,r,s,n,a>>>0,o>>>0,E(l))},arguments)},__wbg_readPixels_bf9ee726d9179d3c:function(){return De(function(e,i,r,s,n,a,o,l){E(e).readPixels(i,r,s,n,a>>>0,o>>>0,E(l))},arguments)},__wbg_readPixels_d00c1cae608273d8:function(){return De(function(e,i,r,s,n,a,o,l){E(e).readPixels(i,r,s,n,a>>>0,o>>>0,l)},arguments)},__wbg_readyState_77b1b1db1b8c2a5f:function(e){return E(e).readyState},__wbg_reason_b02cd587d1a09948:function(e){let i=E(e).reason;return(y2t.indexOf(i)+1||3)-1},__wbg_renderbufferStorageMultisample_75bba97a8e59bc6e:function(e,i,r,s,n,a){E(e).renderbufferStorageMultisample(i>>>0,r,s>>>0,n,a)},__wbg_renderbufferStorage_3f5b0ec8fca2f9f8:function(e,i,r,s,n){E(e).renderbufferStorage(i>>>0,r>>>0,s,n)},__wbg_renderbufferStorage_c34a47cacbbc5fff:function(e,i,r,s,n){E(e).renderbufferStorage(i>>>0,r>>>0,s,n)},__wbg_requestAdapter_2e6718811c735a57:function(e,i){let r=E(e).requestAdapter(E(i));return $(r)},__wbg_requestDevice_ab46d0519ea1cc34:function(e,i){let r=E(e).requestDevice(E(i));return $(r)},__wbg_resolveQuerySet_0f32dc3de3f09701:function(e,i,r,s,n,a){E(e).resolveQuerySet(E(i),r>>>0,s>>>0,E(n),a>>>0)},__wbg_resolve_25a7e548d5881dca:function(e){let i=Promise.resolve(E(e));return $(i)},__wbg_scissor_079b7c4a5c9fcb63:function(e,i,r,s,n){E(e).scissor(i,r,s,n)},__wbg_scissor_e69faa631ab6fdc0:function(e,i,r,s,n){E(e).scissor(i,r,s,n)},__wbg_setBindGroup_268fd1714fff0ef5:function(){return De(function(e,i,r,s,n,a,o){E(e).setBindGroup(i>>>0,E(r),db(s,n),a,o>>>0)},arguments)},__wbg_setBindGroup_3e4ce136bc833ea1:function(){return De(function(e,i,r,s,n,a,o){E(e).setBindGroup(i>>>0,E(r),db(s,n),a,o>>>0)},arguments)},__wbg_setBindGroup_c22a1b95c0b17f37:function(e,i,r){E(e).setBindGroup(i>>>0,E(r))},__wbg_setBindGroup_f0de6cb2c7dbfc2c:function(e,i,r){E(e).setBindGroup(i>>>0,E(r))},__wbg_setIndexBuffer_2531a9103450445e:function(e,i,r,s){E(e).setIndexBuffer(E(i),dN[r],s)},__wbg_setIndexBuffer_7f3cf667b4d71566:function(e,i,r,s,n){E(e).setIndexBuffer(E(i),dN[r],s,n)},__wbg_setPipeline_c41bf46790f27f9e:function(e,i){E(e).setPipeline(E(i))},__wbg_setPipeline_d73f019e98c76d2d:function(e,i){E(e).setPipeline(E(i))},__wbg_setStencilReference_66c74be6232bb9da:function(e,i){E(e).setStencilReference(i>>>0)},__wbg_setTimeout_b5f25e402b6e8ff9:function(){return De(function(e,i,r){return E(e).setTimeout(E(i),r)},arguments)},__wbg_setVertexBuffer_1e448859663dd400:function(e,i,r,s){E(e).setVertexBuffer(i>>>0,E(r),s)},__wbg_setVertexBuffer_7cf533d694e747f3:function(e,i,r,s,n){E(e).setVertexBuffer(i>>>0,E(r),s,n)},__wbg_setViewport_d9fc3eac343de7d0:function(e,i,r,s,n,a,o){E(e).setViewport(i,r,s,n,a,o)},__wbg_set_29c99a8aac1c01e5:function(e,i,r){E(e).set(Vc(i,r))},__wbg_set_6e30c9374c26414c:function(){return De(function(e,i,r){return Reflect.set(E(e),E(i),E(r))},arguments)},__wbg_set_6f7e2d6e41d9a122:function(e,i,r){E(e)[Oe(i)]=Oe(r)},__wbg_set_a_88262a42340d0b1c:function(e,i){E(e).a=i},__wbg_set_access_9a5092f05dc45fad:function(e,i){E(e).access=M2t[i]},__wbg_set_address_mode_u_9e2695575a219e33:function(e,i){E(e).addressModeU=hN[i]},__wbg_set_address_mode_v_f479b2e6cccbcac4:function(e,i){E(e).addressModeV=hN[i]},__wbg_set_address_mode_w_46273e153230180d:function(e,i){E(e).addressModeW=hN[i]},__wbg_set_alpha_bfd2df62e7bc581b:function(e,i){E(e).alpha=E(i)},__wbg_set_alpha_mode_df805952892caa9c:function(e,i){E(e).alphaMode=m2t[i]},__wbg_set_alpha_to_coverage_enabled_8b5dc2b0a225b3b2:function(e,i){E(e).alphaToCoverageEnabled=i!==0},__wbg_set_array_layer_count_7312f0f31af94e7c:function(e,i){E(e).arrayLayerCount=i>>>0},__wbg_set_array_stride_f64_27ffaf4fffd74e61:function(e,i){E(e).arrayStride=i},__wbg_set_aspect_0d453bca3d012f02:function(e,i){E(e).aspect=fN[i]},__wbg_set_aspect_210da747c9d77aba:function(e,i){E(e).aspect=fN[i]},__wbg_set_aspect_4962514fe99e68e6:function(e,i){E(e).aspect=fN[i]},__wbg_set_attributes_7537844a7e6dafdc:function(e,i,r){E(e).attributes=rh(i,r)},__wbg_set_b_c47befe0af3261eb:function(e,i){E(e).b=i},__wbg_set_base_array_layer_f176bb9f1b37b342:function(e,i){E(e).baseArrayLayer=i>>>0},__wbg_set_base_mip_level_1df145d9f8db32a9:function(e,i){E(e).baseMipLevel=i>>>0},__wbg_set_beginning_of_pass_write_index_0d4fa06109208ad7:function(e,i){E(e).beginningOfPassWriteIndex=i>>>0},__wbg_set_beginning_of_pass_write_index_e9f5d016947893bd:function(e,i){E(e).beginningOfPassWriteIndex=i>>>0},__wbg_set_bind_group_layouts_5a9cfea401c020ab:function(e,i,r){E(e).bindGroupLayouts=rh(i,r)},__wbg_set_binding_155b0440b4307793:function(e,i){E(e).binding=i>>>0},__wbg_set_binding_f74df3510792aba1:function(e,i){E(e).binding=i>>>0},__wbg_set_blend_7493c2066c3e9970:function(e,i){E(e).blend=E(i)},__wbg_set_buffer_9c01e3b6d6765ea2:function(e,i){E(e).buffer=E(i)},__wbg_set_buffer_c3410572051920ba:function(e,i){E(e).buffer=E(i)},__wbg_set_buffer_ef7f75306cf663ed:function(e,i){E(e).buffer=E(i)},__wbg_set_buffers_7d0d8f507699e956:function(e,i,r){E(e).buffers=rh(i,r)},__wbg_set_bytes_per_row_c54ca96953f35774:function(e,i){E(e).bytesPerRow=i>>>0},__wbg_set_bytes_per_row_d69b88eee3929c07:function(e,i){E(e).bytesPerRow=i>>>0},__wbg_set_c775d84916be79ea:function(e,i,r){E(e).set(E(i),r>>>0)},__wbg_set_clear_value_gpu_color_dict_6211425789c76e59:function(e,i){E(e).clearValue=E(i)},__wbg_set_code_b4f37f81f45b5b25:function(e,i,r){E(e).code=hi(i,r)},__wbg_set_color_83aa977526e88cbb:function(e,i){E(e).color=E(i)},__wbg_set_color_attachments_581fdb3310e4abfa:function(e,i,r){E(e).colorAttachments=rh(i,r)},__wbg_set_compare_cd9b62cdb92eb580:function(e,i){E(e).compare=uN[i]},__wbg_set_compare_f36b34abfaa08ccb:function(e,i){E(e).compare=uN[i]},__wbg_set_compute_d0c2d276b6d4b18d:function(e,i){E(e).compute=E(i)},__wbg_set_count_069a4eac409bac55:function(e,i){E(e).count=i>>>0},__wbg_set_count_3ab1c1220e4ceeb3:function(e,i){E(e).count=i>>>0},__wbg_set_cull_mode_fc649853947a3d0c:function(e,i){E(e).cullMode=g2t[i]},__wbg_set_currentTime_7c37e2312e9d2687:function(e,i){E(e).currentTime=i},__wbg_set_depth_bias_clamp_1c0d695df7f092e5:function(e,i){E(e).depthBiasClamp=i},__wbg_set_depth_bias_d7cd16096242a657:function(e,i){E(e).depthBias=i},__wbg_set_depth_bias_slope_scale_c4e52ec743ef55ba:function(e,i){E(e).depthBiasSlopeScale=i},__wbg_set_depth_clear_value_beda3ec5b1a5c43a:function(e,i){E(e).depthClearValue=i},__wbg_set_depth_compare_0c8631eb2eae98e3:function(e,i){E(e).depthCompare=uN[i]},__wbg_set_depth_fail_op_668155ae33d3c06f:function(e,i){E(e).depthFailOp=pN[i]},__wbg_set_depth_load_op_511c513eab4e56a9:function(e,i){E(e).depthLoadOp=cN[i]},__wbg_set_depth_or_array_layers_89371305ed0bd962:function(e,i){E(e).depthOrArrayLayers=i>>>0},__wbg_set_depth_read_only_7f41a74741c144ec:function(e,i){E(e).depthReadOnly=i!==0},__wbg_set_depth_stencil_97506c7bea4f53da:function(e,i){E(e).depthStencil=E(i)},__wbg_set_depth_stencil_attachment_73b79e8b4e948222:function(e,i){E(e).depthStencilAttachment=E(i)},__wbg_set_depth_store_op_c89f33b39b43361c:function(e,i){E(e).depthStoreOp=mN[i]},__wbg_set_depth_write_enabled_ce89750042940350:function(e,i){E(e).depthWriteEnabled=i!==0},__wbg_set_device_e275d1d4f3c9eb74:function(e,i){E(e).device=E(i)},__wbg_set_dimension_868eee80f4b90011:function(e,i){E(e).dimension=A2t[i]},__wbg_set_dimension_e325282e613ca0a4:function(e,i){E(e).dimension=gN[i]},__wbg_set_dst_factor_ec7407f19be1aff9:function(e,i){E(e).dstFactor=Sq[i]},__wbg_set_end_of_pass_write_index_0d546e46b86ea069:function(e,i){E(e).endOfPassWriteIndex=i>>>0},__wbg_set_end_of_pass_write_index_49a6ddbb2b888bfa:function(e,i){E(e).endOfPassWriteIndex=i>>>0},__wbg_set_entries_86a29dd6291c95e7:function(e,i,r){E(e).entries=rh(i,r)},__wbg_set_entries_a12aca1e458b0456:function(e,i,r){E(e).entries=rh(i,r)},__wbg_set_entry_point_207540f042015ce5:function(e,i,r){E(e).entryPoint=hi(i,r)},__wbg_set_entry_point_5f26aacbe4c545eb:function(e,i,r){E(e).entryPoint=hi(i,r)},__wbg_set_entry_point_e87e79251dd3144f:function(e,i,r){E(e).entryPoint=hi(i,r)},__wbg_set_external_texture_386483d8dd82ab56:function(e,i){E(e).externalTexture=E(i)},__wbg_set_fail_op_92f716dbc88b6973:function(e,i){E(e).failOp=pN[i]},__wbg_set_flip_y_4e1632b36ad0413a:function(e,i){E(e).flipY=i!==0},__wbg_set_format_1fcaa7d60546b490:function(e,i){E(e).format=Rm[i]},__wbg_set_format_2c1414a817c213f8:function(e,i){E(e).format=Rm[i]},__wbg_set_format_533f9ffa7eef563d:function(e,i){E(e).format=Rm[i]},__wbg_set_format_5d2f25cc93654ecc:function(e,i){E(e).format=E2t[i]},__wbg_set_format_5ff53724ed6cedf2:function(e,i){E(e).format=Rm[i]},__wbg_set_format_815efd4dc4817bbb:function(e,i){E(e).format=Rm[i]},__wbg_set_format_e52bdcca880d2c8e:function(e,i){E(e).format=Rm[i]},__wbg_set_fragment_8b780f00a0b0e6f3:function(e,i){E(e).fragment=E(i)},__wbg_set_front_face_28ffdf524eedce5b:function(e,i){E(e).frontFace=b2t[i]},__wbg_set_g_5983abfc46e0cf4e:function(e,i){E(e).g=i},__wbg_set_has_dynamic_offset_62bc230bdb7c54d0:function(e,i){E(e).hasDynamicOffset=i!==0},__wbg_set_height_0739170de8653cc4:function(e,i){E(e).height=i>>>0},__wbg_set_height_14335c4047cf9c1b:function(e,i){E(e).height=i>>>0},__wbg_set_height_c661af0c0b5376f9:function(e,i){E(e).height=i>>>0},__wbg_set_label_08d9be3e4719c226:function(e,i,r){E(e).label=hi(i,r)},__wbg_set_label_17eb9fe3a02f62b0:function(e,i,r){E(e).label=hi(i,r)},__wbg_set_label_206558c8adc3780f:function(e,i,r){E(e).label=hi(i,r)},__wbg_set_label_48e6b787d256f621:function(e,i,r){E(e).label=hi(i,r)},__wbg_set_label_547d0d4aec39fbe9:function(e,i,r){E(e).label=hi(i,r)},__wbg_set_label_5ee7427342869829:function(e,i,r){E(e).label=hi(i,r)},__wbg_set_label_60ad96c811e0d109:function(e,i,r){E(e).label=hi(i,r)},__wbg_set_label_6db0393d3fdc90a5:function(e,i,r){E(e).label=hi(i,r)},__wbg_set_label_72bb4f41ef0cb893:function(e,i,r){E(e).label=hi(i,r)},__wbg_set_label_79387decda299036:function(e,i,r){E(e).label=hi(i,r)},__wbg_set_label_9556af8b5cda3c9d:function(e,i,r){E(e).label=hi(i,r)},__wbg_set_label_d010f237b26f2c55:function(e,i,r){E(e).label=hi(i,r)},__wbg_set_label_e16e2dbe51349c7f:function(e,i,r){E(e).label=hi(i,r)},__wbg_set_label_e3944e54881b8c50:function(e,i,r){E(e).label=hi(i,r)},__wbg_set_label_e922700240417ab5:function(e,i,r){E(e).label=hi(i,r)},__wbg_set_label_ef44793ddf4455c5:function(e,i,r){E(e).label=hi(i,r)},__wbg_set_layout_41021cfd2a2f62df:function(e,i){E(e).layout=E(i)},__wbg_set_layout_50ab727f44b38f26:function(e,i){E(e).layout=E(i)},__wbg_set_layout_913d53c17194c989:function(e,i){E(e).layout=E(i)},__wbg_set_layout_gpu_auto_layout_mode_0a5a185b3d52b726:function(e,i){E(e).layout=wq[i]},__wbg_set_layout_gpu_auto_layout_mode_aeba193938b47882:function(e,i){E(e).layout=wq[i]},__wbg_set_load_op_99661da6c4eab9b0:function(e,i){E(e).loadOp=cN[i]},__wbg_set_lod_max_clamp_dd2d9f9f052f4f44:function(e,i){E(e).lodMaxClamp=i},__wbg_set_lod_min_clamp_6d20c97916baeb93:function(e,i){E(e).lodMinClamp=i},__wbg_set_loop_b622b726769860be:function(e,i){E(e).loop=i!==0},__wbg_set_mag_filter_b5adebc99cb938e1:function(e,i){E(e).magFilter=Tq[i]},__wbg_set_mapped_at_creation_81b586dc90a50347:function(e,i){E(e).mappedAtCreation=i!==0},__wbg_set_mask_70a8a59ce09e5997:function(e,i){E(e).mask=i>>>0},__wbg_set_max_anisotropy_2beada0e2db62c45:function(e,i){E(e).maxAnisotropy=i},__wbg_set_method_7a6811dec7a4feff:function(e,i,r){E(e).method=hi(i,r)},__wbg_set_min_binding_size_f64_5005a6904cdf43da:function(e,i){E(e).minBindingSize=i},__wbg_set_min_filter_c72f17375e135f0a:function(e,i){E(e).minFilter=Tq[i]},__wbg_set_mip_level_13253f3afc7aa58a:function(e,i){E(e).mipLevel=i>>>0},__wbg_set_mip_level_count_534caaa7e68e68b8:function(e,i){E(e).mipLevelCount=i>>>0},__wbg_set_mip_level_count_776c8c218b65bc08:function(e,i){E(e).mipLevelCount=i>>>0},__wbg_set_mip_level_f7ac79e8c54f59ad:function(e,i){E(e).mipLevel=i>>>0},__wbg_set_mipmap_filter_5bf66195a3639700:function(e,i){E(e).mipmapFilter=_2t[i]},__wbg_set_mode_9990b3393ba469ae:function(e,i){E(e).mode=f2t[i]},__wbg_set_mode_c90e3667002857d4:function(e,i){E(e).mode=R2t[i]},__wbg_set_module_5db9b76ee2dd2a59:function(e,i){E(e).module=E(i)},__wbg_set_module_d0e2098713606cae:function(e,i){E(e).module=E(i)},__wbg_set_module_f02e076ca7e7daf8:function(e,i){E(e).module=E(i)},__wbg_set_multisample_37ddafe88b5cd466:function(e,i){E(e).multisample=E(i)},__wbg_set_multisampled_7913fd7183272840:function(e,i){E(e).multisampled=i!==0},__wbg_set_muted_16f1e7acd8244e28:function(e,i){E(e).muted=i!==0},__wbg_set_offset_f64_28c24dc15000932e:function(e,i){E(e).offset=i},__wbg_set_offset_f64_89f0ce01a689839e:function(e,i){E(e).offset=i},__wbg_set_offset_f64_b562d1367e34ef93:function(e,i){E(e).offset=i},__wbg_set_offset_f64_fa66068813376ca3:function(e,i){E(e).offset=i},__wbg_set_once_27df5233613a51cd:function(e,i){E(e).once=i!==0},__wbg_set_operation_62ce44e1728c4047:function(e,i){E(e).operation=c2t[i]},__wbg_set_origin_gpu_origin_2d_dict_1240202973e56f92:function(e,i){E(e).origin=E(i)},__wbg_set_origin_gpu_origin_3d_dict_37222d7b3d238123:function(e,i){E(e).origin=E(i)},__wbg_set_origin_gpu_origin_3d_dict_631c04520718091f:function(e,i){E(e).origin=E(i)},__wbg_set_pass_op_cf02fa088d6352a7:function(e,i){E(e).passOp=pN[i]},__wbg_set_power_preference_8fdca0b7af640d49:function(e,i){E(e).powerPreference=x2t[i]},__wbg_set_premultiplied_alpha_3f27816ad319d5a9:function(e,i){E(e).premultipliedAlpha=i!==0},__wbg_set_primitive_43c23761a55b4088:function(e,i){E(e).primitive=E(i)},__wbg_set_query_set_41de86d2401aee04:function(e,i){E(e).querySet=E(i)},__wbg_set_query_set_4889dd944d5ec0fd:function(e,i){E(e).querySet=E(i)},__wbg_set_r_c6f4c68f4804d655:function(e,i){E(e).r=i},__wbg_set_required_features_1baf274a8669db60:function(e,i,r){E(e).requiredFeatures=rh(i,r)},__wbg_set_required_limits_871ed33c68613dcb:function(e,i){E(e).requiredLimits=E(i)},__wbg_set_resolve_target_gpu_texture_view_b19a4f2debf79b96:function(e,i){E(e).resolveTarget=E(i)},__wbg_set_resource_5ae7b5e67924f234:function(e,i){E(e).resource=E(i)},__wbg_set_resource_gpu_buffer_binding_e5dbca063e7cb67b:function(e,i){E(e).resource=E(i)},__wbg_set_resource_gpu_texture_view_eb46c355d51ad7e5:function(e,i){E(e).resource=E(i)},__wbg_set_rows_per_image_5011f97318ee71af:function(e,i){E(e).rowsPerImage=i>>>0},__wbg_set_rows_per_image_59a813ac5006e10e:function(e,i){E(e).rowsPerImage=i>>>0},__wbg_set_sample_count_eb86a8b18545b54f:function(e,i){E(e).sampleCount=i>>>0},__wbg_set_sample_type_c32e1dfff94e63eb:function(e,i){E(e).sampleType=C2t[i]},__wbg_set_sampler_c0e1258543a33bce:function(e,i){E(e).sampler=E(i)},__wbg_set_shader_location_7e1832a74f912217:function(e,i){E(e).shaderLocation=i>>>0},__wbg_set_size_f64_6bcd40704bf4cfdc:function(e,i){E(e).size=i},__wbg_set_size_f64_8b8f6bba5d678162:function(e,i){E(e).size=i},__wbg_set_size_gpu_extent_3d_dict_7e42e1c98fa36434:function(e,i){E(e).size=E(i)},__wbg_set_source_0c40b87cfdd5d704:function(e,i){E(e).source=E(i)},__wbg_set_source_html_canvas_element_f657e39507ba2fe5:function(e,i){E(e).source=E(i)},__wbg_set_source_html_image_element_fcc7cba0635adac1:function(e,i){E(e).source=E(i)},__wbg_set_source_html_video_element_e63a39653665f651:function(e,i){E(e).source=E(i)},__wbg_set_source_image_data_68478f1afce208b8:function(e,i){E(e).source=E(i)},__wbg_set_source_offscreen_canvas_266a3de949693e62:function(e,i){E(e).source=E(i)},__wbg_set_source_video_frame_3083c0ce54b9cb73:function(e,i){E(e).source=E(i)},__wbg_set_src_factor_9bfe84af9b7b5cac:function(e,i){E(e).srcFactor=Sq[i]},__wbg_set_stencil_back_85b22f1db5b1940a:function(e,i){E(e).stencilBack=E(i)},__wbg_set_stencil_clear_value_42be608809151e2a:function(e,i){E(e).stencilClearValue=i>>>0},__wbg_set_stencil_front_525526164a798a44:function(e,i){E(e).stencilFront=E(i)},__wbg_set_stencil_load_op_31838c036993098a:function(e,i){E(e).stencilLoadOp=cN[i]},__wbg_set_stencil_read_mask_5cc26495e8b3ae82:function(e,i){E(e).stencilReadMask=i>>>0},__wbg_set_stencil_read_only_bf1d0c1897e25c62:function(e,i){E(e).stencilReadOnly=i!==0},__wbg_set_stencil_store_op_e6be1cbc3a8fc210:function(e,i){E(e).stencilStoreOp=mN[i]},__wbg_set_stencil_write_mask_d9cb40ec4b4bee5b:function(e,i){E(e).stencilWriteMask=i>>>0},__wbg_set_step_mode_a97bb24714da41a9:function(e,i){E(e).stepMode=P2t[i]},__wbg_set_storage_texture_939a097db4b18bd4:function(e,i){E(e).storageTexture=E(i)},__wbg_set_store_op_b5fdf672436f13f3:function(e,i){E(e).storeOp=mN[i]},__wbg_set_strip_index_format_9f787be6c5fc9e87:function(e,i){E(e).stripIndexFormat=dN[i]},__wbg_set_targets_c38bd200c836d66f:function(e,i,r){E(e).targets=rh(i,r)},__wbg_set_texture_016561d5911339e5:function(e,i){E(e).texture=E(i)},__wbg_set_texture_1f64653a5d2d7b4d:function(e,i){E(e).texture=E(i)},__wbg_set_texture_9dcedde1bb31eda6:function(e,i){E(e).texture=E(i)},__wbg_set_timestamp_writes_59c2d19ed8aecd97:function(e,i){E(e).timestampWrites=E(i)},__wbg_set_timestamp_writes_98bed1a8bbc6682d:function(e,i){E(e).timestampWrites=E(i)},__wbg_set_tone_mapping_b3464f1baa4cff92:function(e,i){E(e).toneMapping=E(i)},__wbg_set_topology_da25f2cc5af203d2:function(e,i){E(e).topology=w2t[i]},__wbg_set_type_7f0457c6084dde9b:function(e,i){E(e).type=S2t[i]},__wbg_set_type_ccf8472d40abcddf:function(e,i){E(e).type=T2t[i]},__wbg_set_type_d09829f59932a0fc:function(e,i){E(e).type=p2t[i]},__wbg_set_unclipped_depth_04524a2b44e1e3c1:function(e,i){E(e).unclippedDepth=i!==0},__wbg_set_usage_a137f82ca163b0a9:function(e,i){E(e).usage=i>>>0},__wbg_set_usage_b2a2935f37bf3d08:function(e,i){E(e).usage=i>>>0},__wbg_set_usage_ba5b0f8b333ab325:function(e,i){E(e).usage=i>>>0},__wbg_set_usage_ddd42599bbba7779:function(e,i){E(e).usage=i>>>0},__wbg_set_vertex_0be5d146f9ff6f36:function(e,i){E(e).vertex=E(i)},__wbg_set_view_dimension_0df554032f1f3a85:function(e,i){E(e).viewDimension=gN[i]},__wbg_set_view_dimension_4818d4c18ce5815e:function(e,i){E(e).viewDimension=gN[i]},__wbg_set_view_formats_4347dc8363331086:function(e,i,r){E(e).viewFormats=rh(i,r)},__wbg_set_view_formats_5797d2fff3c11808:function(e,i,r){E(e).viewFormats=rh(i,r)},__wbg_set_view_gpu_texture_view_9b2d86b6b99d9fd9:function(e,i){E(e).view=E(i)},__wbg_set_view_gpu_texture_view_c0f35f8857c25206:function(e,i){E(e).view=E(i)},__wbg_set_visibility_9570b037224c4cc2:function(e,i){E(e).visibility=i>>>0},__wbg_set_volume_520cdc6b7ada8f76:function(e,i){E(e).volume=i},__wbg_set_width_7ca43f32db1cfe8e:function(e,i){E(e).width=i>>>0},__wbg_set_width_87301412247f3343:function(e,i){E(e).width=i>>>0},__wbg_set_width_9f685402c2cbee70:function(e,i){E(e).width=i>>>0},__wbg_set_write_mask_d45279e56abbfcb5:function(e,i){E(e).writeMask=i>>>0},__wbg_set_x_232d24fdc32d8351:function(e,i){E(e).x=i>>>0},__wbg_set_x_876d592971db129a:function(e,i){E(e).x=i>>>0},__wbg_set_y_18fe375093e59dfb:function(e,i){E(e).y=i>>>0},__wbg_set_y_2b1f5ac0dd5586a5:function(e,i){E(e).y=i>>>0},__wbg_set_z_ef005d82bc9d24e3:function(e,i){E(e).z=i>>>0},__wbg_shaderSource_7d18b5a43a504f5c:function(e,i,r,s){E(e).shaderSource(E(i),hi(r,s))},__wbg_shaderSource_df5bb6320451f3cd:function(e,i,r,s){E(e).shaderSource(E(i),hi(r,s))},__wbg_size_211f88d386430781:function(e){return E(e).size},__wbg_src_f0e9281991fbd919:function(e,i){let r=E(i).src,s=As(r,Y.__wbindgen_export,Y.__wbindgen_export2),n=kr;ze().setInt32(e+4,n,!0),ze().setInt32(e+0,s,!0)},__wbg_stack_3b0d974bbf31e44f:function(e,i){let r=E(i).stack,s=As(r,Y.__wbindgen_export,Y.__wbindgen_export2),n=kr;ze().setInt32(e+4,n,!0),ze().setInt32(e+0,s,!0)},__wbg_static_accessor_GLOBAL_9d53f2689e622ca1:function(){let e=typeof global>"u"?null:global;return Fe(e)?0:$(e)},__wbg_static_accessor_GLOBAL_THIS_a1a35cec07001a8a:function(){let e=typeof globalThis>"u"?null:globalThis;return Fe(e)?0:$(e)},__wbg_static_accessor_SELF_4c59f6c7ea29a144:function(){let e=typeof self>"u"?null:self;return Fe(e)?0:$(e)},__wbg_static_accessor_WINDOW_e70ae9f2eb052253:function(){let e=typeof window>"u"?null:window;return Fe(e)?0:$(e)},__wbg_stencilFunc_8f53a5508560354d:function(e,i,r,s){E(e).stencilFunc(i>>>0,r,s>>>0)},__wbg_stencilFunc_c7553215f237ee38:function(e,i,r,s){E(e).stencilFunc(i>>>0,r,s>>>0)},__wbg_stencilOp_a844a4e9824eee70:function(e,i,r,s){E(e).stencilOp(i>>>0,r>>>0,s>>>0)},__wbg_stencilOp_e82bd7ea13f18adf:function(e,i,r,s){E(e).stencilOp(i>>>0,r>>>0,s>>>0)},__wbg_subgroupMaxSize_1527c5f7a8fe91bb:function(e){return E(e).subgroupMaxSize},__wbg_subgroupMinSize_d6c5ad4bddc828e9:function(e){return E(e).subgroupMinSize},__wbg_submit_ce44115121cd166c:function(e,i,r){E(e).submit(rh(i,r))},__wbg_texImage2D_01c22558517ee8db:function(){return De(function(e,i,r,s,n,a,o){E(e).texImage2D(i>>>0,r,s,n>>>0,a>>>0,E(o))},arguments)},__wbg_texImage2D_152e9dcd4bc3a464:function(){return De(function(e,i,r,s,n,a,o,l,u,h){E(e).texImage2D(i>>>0,r,s,n,a,o,l>>>0,u>>>0,E(h))},arguments)},__wbg_texImage2D_3704db20a16b6c35:function(){return De(function(e,i,r,s,n,a,o,l,u,h){E(e).texImage2D(i>>>0,r,s,n,a,o,l>>>0,u>>>0,E(h))},arguments)},__wbg_texImage2D_63d0b87d5ebe4a7f:function(){return De(function(e,i,r,s,n,a,o){E(e).texImage2D(i>>>0,r,s,n>>>0,a>>>0,E(o))},arguments)},__wbg_texImage2D_90633e994ded3d2b:function(){return De(function(e,i,r,s,n,a,o){E(e).texImage2D(i>>>0,r,s,n>>>0,a>>>0,E(o))},arguments)},__wbg_texImage2D_ea94e8a2df5f97e2:function(){return De(function(e,i,r,s,n,a,o,l,u,h){E(e).texImage2D(i>>>0,r,s,n,a,o,l>>>0,u>>>0,h)},arguments)},__wbg_texImage2D_facfa039fb461b66:function(){return De(function(e,i,r,s,n,a,o){E(e).texImage2D(i>>>0,r,s,n>>>0,a>>>0,E(o))},arguments)},__wbg_texParameteri_87ebfcefb0af2c50:function(e,i,r,s){E(e).texParameteri(i>>>0,r>>>0,s)},__wbg_texParameteri_e5ad2054e239066e:function(e,i,r,s){E(e).texParameteri(i>>>0,r>>>0,s)},__wbg_texStorage2D_bb2a1bd1ab0b9184:function(e,i,r,s,n,a){E(e).texStorage2D(i>>>0,r,s>>>0,n,a)},__wbg_texSubImage2D_3483ba5f10ee42c2:function(){return De(function(e,i,r,s,n,a,o,l){E(e).texSubImage2D(i>>>0,r,s,n,a>>>0,o>>>0,E(l))},arguments)},__wbg_texSubImage2D_4ca4c3faa4392438:function(){return De(function(e,i,r,s,n,a,o,l,u,h){E(e).texSubImage2D(i>>>0,r,s,n,a,o,l>>>0,u>>>0,E(h))},arguments)},__wbg_texSubImage2D_54d18572b1ba74ab:function(){return De(function(e,i,r,s,n,a,o,l,u,h){E(e).texSubImage2D(i>>>0,r,s,n,a,o,l>>>0,u>>>0,h)},arguments)},__wbg_texSubImage2D_5bebe93724e6ed61:function(){return De(function(e,i,r,s,n,a,o,l,u,h){E(e).texSubImage2D(i>>>0,r,s,n,a,o,l>>>0,u>>>0,E(h))},arguments)},__wbg_texSubImage2D_5e1594de0416e9f6:function(){return De(function(e,i,r,s,n,a,o,l){E(e).texSubImage2D(i>>>0,r,s,n,a>>>0,o>>>0,E(l))},arguments)},__wbg_then_18f476d590e58992:function(e,i,r){let s=E(e).then(E(i),E(r));return $(s)},__wbg_then_47213a40b6aeb86c:function(e,i){let r=E(e).then(E(i));return $(r)},__wbg_then_ac7b025999b52837:function(e,i){let r=E(e).then(E(i));return $(r)},__wbg_type_71742b859467fa3c:function(e){return E(e).type},__wbg_unconfigure_0a07a0a40de8988d:function(e){E(e).unconfigure()},__wbg_uniform1f_8c3b3e6e3723fe14:function(e,i,r){E(e).uniform1f(E(i),r)},__wbg_uniform1f_d6619faa73c2a45f:function(e,i,r){E(e).uniform1f(E(i),r)},__wbg_uniform1fv_11d5842aff79c8a3:function(e,i,r,s){E(e).uniform1fv(E(i),Ho(r,s))},__wbg_uniform1fv_b4b087b4d6e2bb25:function(e,i,r,s){E(e).uniform1fv(E(i),Ho(r,s))},__wbg_uniform1i_14982bb8438243b4:function(e,i,r){E(e).uniform1i(E(i),r)},__wbg_uniform1i_cf11d5b364eed1c8:function(e,i,r){E(e).uniform1i(E(i),r)},__wbg_uniform1ui_d177882f473d2afc:function(e,i,r){E(e).uniform1ui(E(i),r>>>0)},__wbg_uniform2f_19fb96222ae72e1a:function(e,i,r,s){E(e).uniform2f(E(i),r,s)},__wbg_uniform2f_44cee47e30b82f96:function(e,i,r,s){E(e).uniform2f(E(i),r,s)},__wbg_uniform2fv_2f06d989ec4b5d8f:function(e,i,r,s){E(e).uniform2fv(E(i),Ho(r,s))},__wbg_uniform2fv_f022309b362a80c3:function(e,i,r,s){E(e).uniform2fv(E(i),Ho(r,s))},__wbg_uniform2i_16e8a2c966614be6:function(e,i,r,s){E(e).uniform2i(E(i),r,s)},__wbg_uniform2i_d353da02172ea38d:function(e,i,r,s){E(e).uniform2i(E(i),r,s)},__wbg_uniform3f_360c1ea4c73cacef:function(e,i,r,s,n){E(e).uniform3f(E(i),r,s,n)},__wbg_uniform3f_b616f9e06266a25f:function(e,i,r,s,n){E(e).uniform3f(E(i),r,s,n)},__wbg_uniform4f_f1a670d511b34878:function(e,i,r,s,n,a){E(e).uniform4f(E(i),r,s,n,a)},__wbg_uniform4f_f97f3f59af09856f:function(e,i,r,s,n,a){E(e).uniform4f(E(i),r,s,n,a)},__wbg_uniformMatrix3fv_f45b91f173d7fbed:function(e,i,r,s,n){E(e).uniformMatrix3fv(E(i),r!==0,Ho(s,n))},__wbg_uniformMatrix3fv_feab3f952d705f51:function(e,i,r,s,n){E(e).uniformMatrix3fv(E(i),r!==0,Ho(s,n))},__wbg_uniformMatrix3x2fv_ab13f9742e5fcb2f:function(e,i,r,s,n){E(e).uniformMatrix3x2fv(E(i),r!==0,Ho(s,n))},__wbg_uniformMatrix4fv_540dc6bf792eba8f:function(e,i,r,s,n){E(e).uniformMatrix4fv(E(i),r!==0,Ho(s,n))},__wbg_uniformMatrix4fv_e3dac9dd429d6adc:function(e,i,r,s,n){E(e).uniformMatrix4fv(E(i),r!==0,Ho(s,n))},__wbg_uniformMatrix4x3fv_115d029ad3124cef:function(e,i,r,s,n){E(e).uniformMatrix4x3fv(E(i),r!==0,Ho(s,n))},__wbg_unmap_adaf93276fdf9aaf:function(e){E(e).unmap()},__wbg_useProgram_55a3e940abb19137:function(e,i){E(e).useProgram(E(i))},__wbg_useProgram_e24dadf4c06636f5:function(e,i){E(e).useProgram(E(i))},__wbg_userAgent_8def8135d886414b:function(){return De(function(e,i){let r=E(i).userAgent,s=As(r,Y.__wbindgen_export,Y.__wbindgen_export2),n=kr;ze().setInt32(e+4,n,!0),ze().setInt32(e+0,s,!0)},arguments)},__wbg_valueOf_41ae57308c1f031c:function(e){return E(e).valueOf()},__wbg_value_f3625092ee4b37f4:function(e){let i=E(e).value;return $(i)},__wbg_vertexAttrib4f_6444504b25f4d43e:function(e,i,r,s,n,a){E(e).vertexAttrib4f(i>>>0,r,s,n,a)},__wbg_vertexAttrib4f_aad41fe000407191:function(e,i,r,s,n,a){E(e).vertexAttrib4f(i>>>0,r,s,n,a)},__wbg_vertexAttribIPointer_ed1c3507e84527e2:function(e,i,r,s,n,a){E(e).vertexAttribIPointer(i>>>0,r,s>>>0,n,a)},__wbg_vertexAttribPointer_39eddea7c20e350c:function(e,i,r,s,n,a,o){E(e).vertexAttribPointer(i>>>0,r,s>>>0,n!==0,a,o)},__wbg_vertexAttribPointer_3bc50c0431082f73:function(e,i,r,s,n,a,o){E(e).vertexAttribPointer(i>>>0,r,s>>>0,n!==0,a,o)},__wbg_videoFrameToken_6f05524e85fa2b75:function(e){return gq(E(e))},__wbg_videoHeight_e267fd1e74bb1b06:function(e){return E(e).videoHeight},__wbg_videoWidth_670b8e775ea04b5d:function(e){return E(e).videoWidth},__wbg_viewport_14d947f2faf58e85:function(e,i,r,s,n){E(e).viewport(i,r,s,n)},__wbg_viewport_24055b0754803788:function(e,i,r,s,n){E(e).viewport(i,r,s,n)},__wbg_warn_410c3261e3c6d686:function(e){console.warn(E(e))},__wbg_width_f1791280fae1517a:function(e){return E(e).width},__wbg_writeTexture_53ba204c494b042c:function(){return De(function(e,i,r,s,n,a){E(e).writeTexture(E(i),Vc(r,s),E(n),E(a))},arguments)},__wbindgen_cast_0000000000000001:function(e,i){let r=rd(e,i,a2t);return $(r)},__wbindgen_cast_0000000000000002:function(e,i){let r=rd(e,i,s2t);return $(r)},__wbindgen_cast_0000000000000003:function(e,i){let r=rd(e,i,o2t);return $(r)},__wbindgen_cast_0000000000000004:function(e,i){let r=rd(e,i,l2t);return $(r)},__wbindgen_cast_0000000000000005:function(e,i){let r=rd(e,i,n2t);return $(r)},__wbindgen_cast_0000000000000006:function(e,i){let r=rd(e,i,h2t);return $(r)},__wbindgen_cast_0000000000000007:function(e,i){let r=rd(e,i,u2t);return $(r)},__wbindgen_cast_0000000000000008:function(e,i){let r=rd(e,i,d2t);return $(r)},__wbindgen_cast_0000000000000009:function(e,i){let r=rd(e,i,r2t);return $(r)},__wbindgen_cast_000000000000000a:function(e){return $(e)},__wbindgen_cast_000000000000000b:function(e,i){let r=Ho(e,i);return $(r)},__wbindgen_cast_000000000000000c:function(e,i){let r=B2t(e,i);return $(r)},__wbindgen_cast_000000000000000d:function(e,i){let r=Pq(e,i);return $(r)},__wbindgen_cast_000000000000000e:function(e,i){let r=V2t(e,i);return $(r)},__wbindgen_cast_000000000000000f:function(e,i){let r=k2t(e,i);return $(r)},__wbindgen_cast_0000000000000010:function(e,i){let r=db(e,i);return $(r)},__wbindgen_cast_0000000000000011:function(e,i){let r=Vc(e,i);return $(r)},__wbindgen_cast_0000000000000012:function(e,i){let r=hi(e,i);return $(r)},__wbindgen_cast_0000000000000013:function(e){let i=BigInt.asUintN(64,e);return $(i)},__wbindgen_cast_0000000000000014:function(e,i){var r=Vc(e,i).slice();return Y.__wbindgen_export4(e,i*1,1),$(r)},__wbindgen_object_clone_ref:function(e){let i=E(e);return $(i)},__wbindgen_object_drop_ref:function(e){Oe(e)}}}}function r2t(t,e){Y.__wasm_bindgen_func_elem_12547(t,e)}function s2t(t,e,i){Y.__wasm_bindgen_func_elem_5119(t,e,$(i))}function n2t(t,e,i){Y.__wasm_bindgen_func_elem_11141(t,e,$(i))}function a2t(t,e,i){try{let n=Y.__wbindgen_add_to_stack_pointer(-16);Y.__wasm_bindgen_func_elem_14184(n,t,e,$(i));var r=ze().getInt32(n+4*0,!0),s=ze().getInt32(n+4*1,!0);if(s)throw Oe(r)}finally{Y.__wbindgen_add_to_stack_pointer(16)}}function o2t(t,e,i){try{let n=Y.__wbindgen_add_to_stack_pointer(-16);Y.__wasm_bindgen_func_elem_11140(n,t,e,$(i));var r=ze().getInt32(n+4*0,!0),s=ze().getInt32(n+4*1,!0);if(s)throw Oe(r)}finally{Y.__wbindgen_add_to_stack_pointer(16)}}function l2t(t,e,i){try{let n=Y.__wbindgen_add_to_stack_pointer(-16);Y.__wasm_bindgen_func_elem_11140_3(n,t,e,$(i));var r=ze().getInt32(n+4*0,!0),s=ze().getInt32(n+4*1,!0);if(s)throw Oe(r)}finally{Y.__wbindgen_add_to_stack_pointer(16)}}function h2t(t,e,i){try{let n=Y.__wbindgen_add_to_stack_pointer(-16);Y.__wasm_bindgen_func_elem_11140_5(n,t,e,$(i));var r=ze().getInt32(n+4*0,!0),s=ze().getInt32(n+4*1,!0);if(s)throw Oe(r)}finally{Y.__wbindgen_add_to_stack_pointer(16)}}function u2t(t,e,i){try{let n=Y.__wbindgen_add_to_stack_pointer(-16);Y.__wasm_bindgen_func_elem_11140_6(n,t,e,$(i));var r=ze().getInt32(n+4*0,!0),s=ze().getInt32(n+4*1,!0);if(s)throw Oe(r)}finally{Y.__wbindgen_add_to_stack_pointer(16)}}function d2t(t,e,i){try{let n=Y.__wbindgen_add_to_stack_pointer(-16);Y.__wasm_bindgen_func_elem_11140_7(n,t,e,$(i));var r=ze().getInt32(n+4*0,!0),s=ze().getInt32(n+4*1,!0);if(s)throw Oe(r)}finally{Y.__wbindgen_add_to_stack_pointer(16)}}function xq(t,e,i,r){Y.__wasm_bindgen_func_elem_14186(t,e,$(i),$(r))}function $(t){xb===sh.length&&sh.push(sh.length+1);let e=xb;return xb=sh[e],sh[e]=t,e}function D2t(t){if(uT==1)throw new Error("out of js stack");return sh[--uT]=t,uT}function vN(t){let e=typeof t;if(e=="number"||e=="boolean"||t==null)return`${t}`;if(e=="string")return`"${t}"`;if(e=="symbol"){let s=t.description;return s==null?"Symbol":`Symbol(${s})`}if(e=="function"){let s=t.name;return typeof s=="string"&&s.length>0?`Function(${s})`:"Function"}if(Array.isArray(t)){let s=t.length,n="[";s>0&&(n+=vN(t[0]));for(let a=1;a<s;a++)n+=", "+vN(t[a]);return n+="]",n}let i=/\[object ([^\]]+)\]/.exec(toString.call(t)),r;if(i&&i.length>1)r=i[1];else return toString.call(t);if(r=="Object")try{return"Object("+JSON.stringify(t)+")"}catch{return"Object"}return t instanceof Error?`${t.name}: ${t.message}
35
+ `;let n=new TextEncoder().encode(s),a=r*2*4,o=t.xyz.quantized.data.buffer.byteLength,l=t.xyz instanceof Ms?a:0,u=t.color.quantized.data.buffer.byteLength,h=t.color instanceof Ms?a:0,d=t.opacity.quantized.data.buffer.byteLength,c=t.opacity instanceof Ms?a:0,p=t.scaling.quantized.data.buffer.byteLength,m=t.scaling instanceof Ms?a:0,f=t.quaternion.quantized.data.buffer.byteLength,g=t.quaternion instanceof Ms?a:0,y=t.variableChunkSize?Uint16Array.from(t.variableChunkSize):void 0,v=y?y.byteLength:0,b=n.byteLength+v+o+l+u+h+d+c+p+m+f+g,_=0,x=0;if(t.harmonics&&t.harmonics.length>0)for(let M=0;M<t.harmonics.length;M++)_+=t.harmonics[M].quantized.data.buffer.byteLength,x+=t.harmonics[M]instanceof Ms?a:0;_=0,x=0,b+=_+x;let S=new Uint8Array(b),w=0;if(S.set(n,w),w+=n.byteLength,v>0&&(S.set(new Uint8Array(y.buffer),w),w+=v),t.xyz instanceof Ms&&(S.set(new Uint8Array(t.xyz.minmaxMatrix.data.buffer),w),w+=a),S.set(new Uint8Array(t.xyz.quantized.data.buffer),w),w+=o,t.color instanceof Ms&&(S.set(new Uint8Array(t.color.minmaxMatrix.data.buffer),w),w+=a),S.set(new Uint8Array(t.color.quantized.data.buffer),w),w+=u,t.opacity instanceof Ms&&(S.set(new Uint8Array(t.opacity.minmaxMatrix.data.buffer),w),w+=a),S.set(new Uint8Array(t.opacity.quantized.data.buffer),w),w+=d,t.scaling instanceof Ms&&(S.set(new Uint8Array(t.scaling.minmaxMatrix.data.buffer),w),w+=a),S.set(new Uint8Array(t.scaling.quantized.data.buffer),w),w+=p,t.quaternion instanceof Ms&&(S.set(new Uint8Array(t.quaternion.minmaxMatrix.data.buffer),w),w+=a),S.set(new Uint8Array(t.quaternion.quantized.data.buffer),w),w+=f,_>0&&t.harmonics&&t.harmonics.length>0)for(let M=0;M<t.harmonics.length;M++){let T=t.harmonics[M];T instanceof Ms&&(S.set(new Uint8Array(T.minmaxMatrix.data.buffer),w),w+=a),S.set(new Uint8Array(T.quantized.data.buffer),w),w+=T.quantized.data.byteLength}return new sN(S.buffer)}}});async function mq(t){return createImageBitmap(new Blob([t]))}async function fq(t){return fetch(t).then(e=>{if(!e.ok)throw new Error(`Failed to fetch image: ${e.statusText}`);return e.blob()}).then(e=>createImageBitmap(e))}function Hwt(t){if(typeof t.requestVideoFrameCallback!="function"){t.hanaClockBase=++oN*Gwt;return}t.hanaPresentedFrames=++oN;let e=()=>{t.hanaDisposed||(t.hanaPresentedFrames=++oN)};t.addEventListener("seeked",e);let i=()=>{e(),!t.hanaDisposed&&(t.hanaFrameCallback=t.requestVideoFrameCallback(i))};t.hanaFrameCallback=t.requestVideoFrameCallback(i)}function gq(t){let e=t.hanaPresentedFrames;return e===void 0?t.hanaClockBase+t.currentTime:e}function $wt(t,e){t.hanaObjectUrl=URL.createObjectURL(e),t.src=t.hanaObjectUrl}function lN(t){if(t.hanaDisposed)return;t.hanaDisposed=!0;let e=t.hanaFrameCallback;e!==void 0&&(t.hanaFrameCallback=void 0,typeof t.cancelVideoFrameCallback=="function"&&t.cancelVideoFrameCallback(e));let i=t.hanaObjectUrl;i!==void 0&&(t.hanaObjectUrl=void 0,URL.revokeObjectURL(i)),t.pause(),t.removeAttribute("src"),t.load()}function Xwt(t){let e=r=>{let s=t.error;return new Error(s===null?r:`${r} (code ${s.code}: ${s.message})`)},i=r=>{let s=e(r);return lN(t),s};return t.error!==null?Promise.reject(i("video failed to load")):t.readyState>=Wwt?Promise.resolve(t):new Promise((r,s)=>{let n=setTimeout(()=>a(s,i("video timed out before presenting a frame")),qwt),a=(u,h)=>{clearTimeout(n),t.removeEventListener("loadeddata",o),t.removeEventListener("canplay",o),t.removeEventListener("error",l),u(h)},o=()=>a(r,t),l=()=>a(s,i("video failed to load"));t.addEventListener("loadeddata",o),t.addEventListener("canplay",o),t.addEventListener("error",l)})}function yq(t){return t.preload="auto",t.autoplay=!0,t.loop=!0,t.muted=!0,t.playsInline=!0,t.currentTime=.01,t.load(),t.onloadeddata=()=>{t.muted=!0;let e=t.play();e!==void 0&&e.then(i=>{}).catch(()=>{t.play()}).finally(()=>{t.pause()})},Hwt(t),Xwt(t)}async function vq(t){let e=document.createElement("video");return $wt(e,new Blob([t])),yq(e)}async function bq(t){let e=document.createElement("video");return e.crossOrigin="anonymous",e.src=t,yq(e)}var oN,Gwt,Wwt,qwt,_q=nT(()=>{"use strict";oN=0,Gwt=1e6,Wwt=2,qwt=3e4});var Oq={};kW(Oq,{DeviceLostPromise:()=>kc,Engine:()=>zc,PixelReadPromise:()=>sd,SceneController:()=>Sb,addRealizedChild:()=>Ywt,componentInstanceRefreshOps:()=>Kwt,default:()=>Z2t,dematerializeInstance:()=>Zwt,duplicateComponentInstance:()=>Qwt,initSync:()=>K2t,overrideForRealizedEdit:()=>Jwt,realizeComponentInstance:()=>t2t,removeRealizedNode:()=>e2t,web_init:()=>i2t});function Ywt(t,e,i,r,s){let n=Y.addRealizedChild($(t),$(e),$(i),$(r),$(s));return Oe(n)}function Kwt(t,e,i,r,s){let n=Y.componentInstanceRefreshOps($(t),$(e),$(i),$(r),$(s));return Oe(n)}function Zwt(t,e,i,r){let s=Y.dematerializeInstance($(t),$(e),$(i),$(r));return Oe(s)}function Qwt(t,e,i,r){let s=Y.duplicateComponentInstance($(t),$(e),$(i),$(r));return Oe(s)}function Jwt(t,e,i,r,s){let n=Y.overrideForRealizedEdit($(t),$(e),$(i),$(r),$(s));return Oe(n)}function t2t(t,e,i){let r=Y.realizeComponentInstance($(t),$(e),$(i));return Oe(r)}function e2t(t,e,i,r){let s=Y.removeRealizedNode($(t),$(e),$(i),$(r));return Oe(s)}function i2t(){Y.web_init()}function Nq(){return{__proto__:null,"./hana_bg.js":{__proto__:null,__wbg_Error_ef53bc310eb298a0:function(e,i){let r=Error(hi(e,i));return $(r)},__wbg_Number_6b506e6536831eaa:function(e){return Number(E(e))},__wbg_Window_afcc911b2f9c92e2:function(e){let i=E(e).Window;return $(i)},__wbg_WorkerGlobalScope_5d19ebc889ff397e:function(e){let i=E(e).WorkerGlobalScope;return $(i)},__wbg___wbindgen_bigint_get_as_i64_38130e98eecd467d:function(e,i){let r=E(i),s=typeof r=="bigint"?r:void 0;ze().setBigInt64(e+8,Fe(s)?BigInt(0):s,!0),ze().setInt32(e+0,!Fe(s),!0)},__wbg___wbindgen_boolean_get_1a45e2c38d4d41b9:function(e){let i=E(e),r=typeof i=="boolean"?i:void 0;return Fe(r)?16777215:r?1:0},__wbg___wbindgen_debug_string_0accd80f45e5faa2:function(e,i){let r=vN(E(i)),s=As(r,Y.__wbindgen_export,Y.__wbindgen_export2),n=kr;ze().setInt32(e+4,n,!0),ze().setInt32(e+0,s,!0)},__wbg___wbindgen_in_70a403a56e771704:function(e,i){return E(e)in E(i)},__wbg___wbindgen_is_bigint_6ffd6468a9bc44b9:function(e){return typeof E(e)=="bigint"},__wbg___wbindgen_is_function_754e9f305ff6029e:function(e){return typeof E(e)=="function"},__wbg___wbindgen_is_null_87c3bfe968c6a5ad:function(e){return E(e)===null},__wbg___wbindgen_is_null_or_undefined_cf617b836541fad3:function(e){return E(e)==null},__wbg___wbindgen_is_object_56732c2bc353f41d:function(e){let i=E(e);return typeof i=="object"&&i!==null},__wbg___wbindgen_is_string_c236cabd84a4d769:function(e){return typeof E(e)=="string"},__wbg___wbindgen_is_undefined_67b456be8673d3d7:function(e){return E(e)===void 0},__wbg___wbindgen_jsval_eq_1068e624fa87f6ab:function(e,i){return E(e)===E(i)},__wbg___wbindgen_jsval_loose_eq_2c56564c75129511:function(e,i){return E(e)==E(i)},__wbg___wbindgen_number_get_9bb1761122181af2:function(e,i){let r=E(i),s=typeof r=="number"?r:void 0;ze().setFloat64(e+8,Fe(s)?0:s,!0),ze().setInt32(e+0,!Fe(s),!0)},__wbg___wbindgen_string_get_72bdf95d3ae505b1:function(e,i){let r=E(i),s=typeof r=="string"?r:void 0;var n=Fe(s)?0:As(s,Y.__wbindgen_export,Y.__wbindgen_export2),a=kr;ze().setInt32(e+4,a,!0),ze().setInt32(e+0,n,!0)},__wbg___wbindgen_throw_1506f2235d1bdba0:function(e,i){throw new Error(hi(e,i))},__wbg__wbg_cb_unref_61db23ac97f16c31:function(e){E(e)._wbg_cb_unref()},__wbg_activeTexture_7a0d6fe7120979ce:function(e,i){E(e).activeTexture(i>>>0)},__wbg_activeTexture_dd15c31d50b73529:function(e,i){E(e).activeTexture(i>>>0)},__wbg_addEventListener_5593b0efd622abd6:function(){return De(function(e,i,r,s,n){E(e).addEventListener(hi(i,r),E(s),E(n))},arguments)},__wbg_arrayBuffer_05927079aabe6d46:function(){return De(function(e){let i=E(e).arrayBuffer();return $(i)},arguments)},__wbg_assign_551ec2d000f70c24:function(){return De(function(e,i,r){E(e).assign(hi(i,r))},arguments)},__wbg_attachShader_5c6a46e7c0fc637a:function(e,i,r){E(e).attachShader(E(i),E(r))},__wbg_attachShader_c2b12b36afa45936:function(e,i,r){E(e).attachShader(E(i),E(r))},__wbg_beginComputePass_431a159006c13c7c:function(e,i){let r=E(e).beginComputePass(E(i));return $(r)},__wbg_beginRenderPass_aa22c432e793359a:function(){return De(function(e,i){let r=E(e).beginRenderPass(E(i));return $(r)},arguments)},__wbg_bindBuffer_3841df88ccee4ed0:function(e,i,r){E(e).bindBuffer(i>>>0,E(r))},__wbg_bindBuffer_aa5dc7dc1c8ad1c8:function(e,i,r){E(e).bindBuffer(i>>>0,E(r))},__wbg_bindFramebuffer_10bbdf7040d89a17:function(e,i,r){E(e).bindFramebuffer(i>>>0,E(r))},__wbg_bindFramebuffer_ee8e42543c29c602:function(e,i,r){E(e).bindFramebuffer(i>>>0,E(r))},__wbg_bindRenderbuffer_7808d8eabbe18554:function(e,i,r){E(e).bindRenderbuffer(i>>>0,E(r))},__wbg_bindRenderbuffer_c0360bfb79c193c2:function(e,i,r){E(e).bindRenderbuffer(i>>>0,E(r))},__wbg_bindTexture_28d1d695d4801955:function(e,i,r){E(e).bindTexture(i>>>0,E(r))},__wbg_bindTexture_a1a012a31e1419d5:function(e,i,r){E(e).bindTexture(i>>>0,E(r))},__wbg_bindVertexArrayOES_15e48910a5d208b1:function(e,i){E(e).bindVertexArrayOES(E(i))},__wbg_bindVertexArray_4f2f0a7892280041:function(e,i){E(e).bindVertexArray(E(i))},__wbg_blendEquation_1ced323efc9ce0f8:function(e,i){E(e).blendEquation(i>>>0)},__wbg_blendEquation_a12f5acd9d14fb9b:function(e,i){E(e).blendEquation(i>>>0)},__wbg_blendFunc_d5202c7fe94c67ee:function(e,i,r){E(e).blendFunc(i>>>0,r>>>0)},__wbg_blendFunc_fbff85cd0fce280e:function(e,i,r){E(e).blendFunc(i>>>0,r>>>0)},__wbg_blitFramebuffer_acb954bfb30ed714:function(e,i,r,s,n,a,o,l,u,h,d){E(e).blitFramebuffer(i,r,s,n,a,o,l,u,h>>>0,d>>>0)},__wbg_bufferData_043a7e5da22f40d9:function(e,i,r,s){E(e).bufferData(i>>>0,r,s>>>0)},__wbg_bufferData_7b6881381d415425:function(e,i,r,s){E(e).bufferData(i>>>0,E(r),s>>>0)},__wbg_bufferData_9fddca30299e6114:function(e,i,r,s){E(e).bufferData(i>>>0,r,s>>>0)},__wbg_bufferData_f0837cec09725cc0:function(e,i,r,s){E(e).bufferData(i>>>0,E(r),s>>>0)},__wbg_bufferSubData_885e4f8d5833cf11:function(e,i,r,s){E(e).bufferSubData(i>>>0,r,E(s))},__wbg_bufferSubData_8fc824b6a9503f12:function(e,i,r,s){E(e).bufferSubData(i>>>0,r,E(s))},__wbg_call_8a89609d89f6608a:function(){return De(function(e,i){let r=E(e).call(E(i));return $(r)},arguments)},__wbg_call_9c758de292015997:function(){return De(function(e,i,r){let s=E(e).call(E(i),E(r));return $(s)},arguments)},__wbg_clearBufferfv_2e2858bd8bcf1715:function(e,i,r,s,n){E(e).clearBufferfv(i>>>0,r,Ho(s,n))},__wbg_clearBufferiv_e356514eb1d165fe:function(e,i,r,s,n){E(e).clearBufferiv(i>>>0,r,Pq(s,n))},__wbg_compileShader_8810a4868b23621b:function(e,i){E(e).compileShader(E(i))},__wbg_compileShader_ec8d5eb7f2b70a48:function(e,i){E(e).compileShader(E(i))},__wbg_configure_0e4789c0f6b35c8e:function(){return De(function(e,i){E(e).configure(E(i))},arguments)},__wbg_copyBufferSubData_9936fdf5e53e1832:function(e,i,r,s,n,a){E(e).copyBufferSubData(i>>>0,r>>>0,s,n,a)},__wbg_copyBufferToBuffer_5e2cd8f10ae78183:function(){return De(function(e,i,r,s,n){E(e).copyBufferToBuffer(E(i),r,E(s),n)},arguments)},__wbg_copyBufferToBuffer_ca30deb8de65f5d5:function(){return De(function(e,i,r,s,n,a){E(e).copyBufferToBuffer(E(i),r,E(s),n,a)},arguments)},__wbg_copyExternalImageToTexture_4df105bb39517948:function(){return De(function(e,i,r,s){E(e).copyExternalImageToTexture(E(i),E(r),E(s))},arguments)},__wbg_copyTextureToBuffer_ed6e67a77ecb768d:function(){return De(function(e,i,r,s){E(e).copyTextureToBuffer(E(i),E(r),E(s))},arguments)},__wbg_createBindGroupLayout_49a7e2b3d076afcf:function(){return De(function(e,i){let r=E(e).createBindGroupLayout(E(i));return $(r)},arguments)},__wbg_createBindGroup_655c6e6c0258530e:function(e,i){let r=E(e).createBindGroup(E(i));return $(r)},__wbg_createBuffer_0726dd2ab09ea1d2:function(){return De(function(e,i){let r=E(e).createBuffer(E(i));return $(r)},arguments)},__wbg_createBuffer_333d6aae40284594:function(e){let i=E(e).createBuffer();return Fe(i)?0:$(i)},__wbg_createBuffer_3ae54605e5676c83:function(e){let i=E(e).createBuffer();return Fe(i)?0:$(i)},__wbg_createCommandEncoder_ec1f40f0cb4d09df:function(e,i){let r=E(e).createCommandEncoder(E(i));return $(r)},__wbg_createComputePipelineAsync_afe7021ac5a02993:function(e,i){let r=E(e).createComputePipelineAsync(E(i));return $(r)},__wbg_createFramebuffer_6f42ff976bb98152:function(e){let i=E(e).createFramebuffer();return Fe(i)?0:$(i)},__wbg_createFramebuffer_ef1247e8b2e9b09f:function(e){let i=E(e).createFramebuffer();return Fe(i)?0:$(i)},__wbg_createPipelineLayout_2c8cd4528b06c108:function(e,i){let r=E(e).createPipelineLayout(E(i));return $(r)},__wbg_createProgram_b48c3323af547213:function(e){let i=E(e).createProgram();return Fe(i)?0:$(i)},__wbg_createProgram_f6a8df4491031d57:function(e){let i=E(e).createProgram();return Fe(i)?0:$(i)},__wbg_createQuerySet_cb7b21d1d405b890:function(){return De(function(e,i){let r=E(e).createQuerySet(E(i));return $(r)},arguments)},__wbg_createRenderPipelineAsync_eecad1e54ef27acf:function(e,i){let r=E(e).createRenderPipelineAsync(E(i));return $(r)},__wbg_createRenderPipeline_cf98d4d699bfb03c:function(){return De(function(e,i){let r=E(e).createRenderPipeline(E(i));return $(r)},arguments)},__wbg_createRenderbuffer_a2f947c7fa8c8bf0:function(e){let i=E(e).createRenderbuffer();return Fe(i)?0:$(i)},__wbg_createRenderbuffer_c09d5809ac95924e:function(e){let i=E(e).createRenderbuffer();return Fe(i)?0:$(i)},__wbg_createSampler_c8ffb3c8d565f704:function(e,i){let r=E(e).createSampler(E(i));return $(r)},__wbg_createShaderModule_2e44fc7677c6288b:function(e,i){let r=E(e).createShaderModule(E(i));return $(r)},__wbg_createShader_0e3f814b69e9e184:function(e,i){let r=E(e).createShader(i>>>0);return Fe(r)?0:$(r)},__wbg_createShader_383b3295276271d2:function(e,i){let r=E(e).createShader(i>>>0);return Fe(r)?0:$(r)},__wbg_createTexture_1bac74c999b8a48e:function(){return De(function(e,i){let r=E(e).createTexture(E(i));return $(r)},arguments)},__wbg_createTexture_461a3048c40e7175:function(e){let i=E(e).createTexture();return Fe(i)?0:$(i)},__wbg_createTexture_d6e2c1f04a554a15:function(e){let i=E(e).createTexture();return Fe(i)?0:$(i)},__wbg_createVertexArrayOES_2f67d3679ba9a29c:function(e){let i=E(e).createVertexArrayOES();return Fe(i)?0:$(i)},__wbg_createVertexArray_febd1d11636d15ad:function(e){let i=E(e).createVertexArray();return Fe(i)?0:$(i)},__wbg_createView_ceaf2f5881adbd34:function(){return De(function(e,i){let r=E(e).createView(E(i));return $(r)},arguments)},__wbg_cullFace_a4ee8b8c3c126388:function(e,i){E(e).cullFace(i>>>0)},__wbg_cullFace_c6b39a55ccade015:function(e,i){E(e).cullFace(i>>>0)},__wbg_currentTime_0b40b60bc76843cb:function(e){return E(e).currentTime},__wbg_debug_78b457f1effb3792:function(e){console.debug(E(e))},__wbg_deleteBuffer_520156dc8a1f81af:function(e,i){E(e).deleteBuffer(E(i))},__wbg_deleteBuffer_a925fdd1b590fbbc:function(e,i){E(e).deleteBuffer(E(i))},__wbg_deleteFramebuffer_aa4bf9f184123318:function(e,i){E(e).deleteFramebuffer(E(i))},__wbg_deleteFramebuffer_cc043e5a8cb9a556:function(e,i){E(e).deleteFramebuffer(E(i))},__wbg_deleteProgram_0c859ebcab2b7b5a:function(e,i){E(e).deleteProgram(E(i))},__wbg_deleteProgram_df6a6609c7d91a6e:function(e,i){E(e).deleteProgram(E(i))},__wbg_deleteRenderbuffer_37c079dbc257fcf9:function(e,i){E(e).deleteRenderbuffer(E(i))},__wbg_deleteRenderbuffer_4b7a888363766554:function(e,i){E(e).deleteRenderbuffer(E(i))},__wbg_deleteShader_170dea06bd074d01:function(e,i){E(e).deleteShader(E(i))},__wbg_deleteShader_944accd60733a9cb:function(e,i){E(e).deleteShader(E(i))},__wbg_deleteTexture_54dee8e15570751e:function(e,i){E(e).deleteTexture(E(i))},__wbg_deleteTexture_be3eaabebb89a85e:function(e,i){E(e).deleteTexture(E(i))},__wbg_deleteVertexArrayOES_4262d2d0e9fb77c5:function(e,i){E(e).deleteVertexArrayOES(E(i))},__wbg_deleteVertexArray_8f0fb3b3d54c7483:function(e,i){E(e).deleteVertexArray(E(i))},__wbg_depthMask_95332b64c5ef8b45:function(e,i){E(e).depthMask(i!==0)},__wbg_depthMask_f55bea4b6c3b9531:function(e,i){E(e).depthMask(i!==0)},__wbg_description_02485704e69b1e7f:function(e,i){let r=E(i).description,s=As(r,Y.__wbindgen_export,Y.__wbindgen_export2),n=kr;ze().setInt32(e+4,n,!0),ze().setInt32(e+0,s,!0)},__wbg_disable_2cf98ccb81612ef9:function(e,i){E(e).disable(i>>>0)},__wbg_disable_6b825656c54f5646:function(e,i){E(e).disable(i>>>0)},__wbg_dispatchWorkgroups_afb2344298c62227:function(e,i,r,s){E(e).dispatchWorkgroups(i>>>0,r>>>0,s>>>0)},__wbg_displayHeight_465673c1823a1db3:function(e){return E(e).displayHeight},__wbg_displayWidth_73729fd8eb965076:function(e){return E(e).displayWidth},__wbg_disposeVideo_c94c1ccd57a63f68:function(e){lN(E(e))},__wbg_document_aceb08cd6489baf5:function(e){let i=E(e).document;return Fe(i)?0:$(i)},__wbg_done_60cf307fcc680536:function(e){return E(e).done},__wbg_drawArrays_6eb87620c1dcbfb4:function(e,i,r,s){E(e).drawArrays(i>>>0,r,s)},__wbg_drawArrays_f332b526550a641e:function(e,i,r,s){E(e).drawArrays(i>>>0,r,s)},__wbg_drawBuffersWEBGL_10cdfe87c17cd93f:function(e,i){E(e).drawBuffersWEBGL(E(i))},__wbg_drawBuffers_c5a9ee312b2d6fa8:function(e,i){E(e).drawBuffers(E(i))},__wbg_drawElements_23ec4847dad548e0:function(e,i,r,s,n){E(e).drawElements(i>>>0,r,s>>>0,n)},__wbg_drawElements_fe4671e9c358058d:function(e,i,r,s,n){E(e).drawElements(i>>>0,r,s>>>0,n)},__wbg_drawIndexed_d31913e79d58fbac:function(e,i,r,s,n,a){E(e).drawIndexed(i>>>0,r>>>0,s>>>0,n,a>>>0)},__wbg_draw_6877f98847e1e36c:function(e,i,r,s,n){E(e).draw(i>>>0,r>>>0,s>>>0,n>>>0)},__wbg_duration_d6a6a568a0baf72d:function(e){return E(e).duration},__wbg_enableVertexAttribArray_cc09a0312b6adee5:function(e,i){E(e).enableVertexAttribArray(i>>>0)},__wbg_enableVertexAttribArray_f88d3d499ab40ea6:function(e,i){E(e).enableVertexAttribArray(i>>>0)},__wbg_enable_1928c361308989d5:function(e,i){E(e).enable(i>>>0)},__wbg_enable_2cc4ff32a0fd985f:function(e,i){E(e).enable(i>>>0)},__wbg_end_c36889de8ddef882:function(e){E(e).end()},__wbg_end_f99ebed53d4e198a:function(e){E(e).end()},__wbg_engine_new:function(e){let i=zc.__wrap(e);return $(i)},__wbg_entries_04b37a02507f1713:function(e){let i=Object.entries(E(e));return $(i)},__wbg_error_78ff5b3a29b770e0:function(e){console.error(E(e))},__wbg_error_a6fa202b58aa1cd3:function(e,i){let r,s;try{r=e,s=i,console.error(hi(e,i))}finally{Y.__wbindgen_export4(r,s,1)}},__wbg_features_2b07a28fe18ad0ce:function(e){let i=E(e).features;return $(i)},__wbg_features_d4d2020319592cbe:function(e){let i=E(e).features;return $(i)},__wbg_fetch_ce1af4d1b59a60be:function(e,i){let r=E(e).fetch(E(i));return $(r)},__wbg_finish_4d91de5e927dd13f:function(e,i){let r=E(e).finish(E(i));return $(r)},__wbg_finish_6e06b68ab68cd9f6:function(e){let i=E(e).finish();return $(i)},__wbg_flush_2088ebca1fd13068:function(e){E(e).flush()},__wbg_flush_3be48fce9f195fa5:function(e){E(e).flush()},__wbg_framebufferRenderbuffer_0c9d0e5587497683:function(e,i,r,s,n){E(e).framebufferRenderbuffer(i>>>0,r>>>0,s>>>0,E(n))},__wbg_framebufferRenderbuffer_599e58ad30dcfeb3:function(e,i,r,s,n){E(e).framebufferRenderbuffer(i>>>0,r>>>0,s>>>0,E(n))},__wbg_framebufferTexture2D_44caed1725e57636:function(e,i,r,s,n,a){E(e).framebufferTexture2D(i>>>0,r>>>0,s>>>0,E(n),a)},__wbg_framebufferTexture2D_fbba21b750c2316a:function(e,i,r,s,n,a){E(e).framebufferTexture2D(i>>>0,r>>>0,s>>>0,E(n),a)},__wbg_from_d300fe49deab18f5:function(e){let i=Array.from(E(e));return $(i)},__wbg_generateMipmap_1403959fc241438f:function(e,i){E(e).generateMipmap(i>>>0)},__wbg_generateMipmap_b261c040d5707fe5:function(e,i){E(e).generateMipmap(i>>>0)},__wbg_getActiveUniform_3a275fd8fdf7a327:function(e,i,r){let s=E(e).getActiveUniform(E(i),r>>>0);return Fe(s)?0:$(s)},__wbg_getActiveUniform_86f7a30e1a52aca4:function(e,i,r){let s=E(e).getActiveUniform(E(i),r>>>0);return Fe(s)?0:$(s)},__wbg_getContext_469d34698d869fc1:function(){return De(function(e,i,r){let s=E(e).getContext(hi(i,r));return Fe(s)?0:$(s)},arguments)},__wbg_getContext_5b39fff76491fded:function(){return De(function(e,i,r,s){let n=E(e).getContext(hi(i,r),E(s));return Fe(n)?0:$(n)},arguments)},__wbg_getContext_7d3a8f461c828713:function(){return De(function(e,i,r){let s=E(e).getContext(hi(i,r));return Fe(s)?0:$(s)},arguments)},__wbg_getCurrentTexture_20714d1bd9051cab:function(){return De(function(e){let i=E(e).getCurrentTexture();return $(i)},arguments)},__wbg_getExtension_454cdc5ffd07bf03:function(){return De(function(e,i,r){let s=E(e).getExtension(hi(i,r));return Fe(s)?0:$(s)},arguments)},__wbg_getMappedRange_d0bf3141224111b6:function(){return De(function(e,i,r){let s=E(e).getMappedRange(i,r);return $(s)},arguments)},__wbg_getParameter_015942a7ad566b20:function(){return De(function(e,i){let r=E(e).getParameter(i>>>0);return $(r)},arguments)},__wbg_getParameter_1e77e23f5ccf0300:function(){return De(function(e,i){let r=E(e).getParameter(i>>>0);return $(r)},arguments)},__wbg_getPreferredCanvasFormat_8b57039d1801a506:function(e){let i=E(e).getPreferredCanvasFormat();return(Rm.indexOf(i)+1||102)-1},__wbg_getProgramInfoLog_2f9cfcecc4f772e1:function(e,i,r){let s=E(i).getProgramInfoLog(E(r));var n=Fe(s)?0:As(s,Y.__wbindgen_export,Y.__wbindgen_export2),a=kr;ze().setInt32(e+4,a,!0),ze().setInt32(e+0,n,!0)},__wbg_getProgramInfoLog_f0d48f606547aed7:function(e,i,r){let s=E(i).getProgramInfoLog(E(r));var n=Fe(s)?0:As(s,Y.__wbindgen_export,Y.__wbindgen_export2),a=kr;ze().setInt32(e+4,a,!0),ze().setInt32(e+0,n,!0)},__wbg_getProgramParameter_08beabb2736d5769:function(e,i,r){let s=E(e).getProgramParameter(E(i),r>>>0);return $(s)},__wbg_getProgramParameter_aee848e1db52b7cd:function(e,i,r){let s=E(e).getProgramParameter(E(i),r>>>0);return $(s)},__wbg_getRandomValues_3f44b700395062e5:function(){return De(function(e,i){globalThis.crypto.getRandomValues(Vc(e,i))},arguments)},__wbg_getRandomValues_bf16787eede473f5:function(){return De(function(e,i){globalThis.crypto.getRandomValues(Vc(e,i))},arguments)},__wbg_getShaderInfoLog_510365af17f29a35:function(e,i,r){let s=E(i).getShaderInfoLog(E(r));var n=Fe(s)?0:As(s,Y.__wbindgen_export,Y.__wbindgen_export2),a=kr;ze().setInt32(e+4,a,!0),ze().setInt32(e+0,n,!0)},__wbg_getShaderInfoLog_cd77c7b7bdb9ce65:function(e,i,r){let s=E(i).getShaderInfoLog(E(r));var n=Fe(s)?0:As(s,Y.__wbindgen_export,Y.__wbindgen_export2),a=kr;ze().setInt32(e+4,a,!0),ze().setInt32(e+0,n,!0)},__wbg_getSupportedExtensions_7a31b3412a25d9ba:function(e){let i=E(e).getSupportedExtensions();return Fe(i)?0:$(i)},__wbg_getUniformLocation_010256f946f9a865:function(e,i,r,s){let n=E(e).getUniformLocation(E(i),hi(r,s));return Fe(n)?0:$(n)},__wbg_getUniformLocation_f9774d4f157f5914:function(e,i,r,s){let n=E(e).getUniformLocation(E(i),hi(r,s));return Fe(n)?0:$(n)},__wbg_get_1f8f054ddbaa7db2:function(){return De(function(e,i){let r=Reflect.get(E(e),E(i));return $(r)},arguments)},__wbg_get_2b48c7d0d006a781:function(e,i){let r=E(e)[i>>>0];return $(r)},__wbg_get_cb935c1402921898:function(e,i){let r=E(e)[i>>>0];return Fe(r)?0:$(r)},__wbg_get_de6a0f7d4d18a304:function(){return De(function(e,i){let r=Reflect.get(E(e),E(i));return $(r)},arguments)},__wbg_get_index_ab123d64c89e3156:function(e,i){return E(e)[i>>>0]},__wbg_get_unchecked_33f6e5c9e2f2d6b2:function(e,i){let r=E(e)[i>>>0];return $(r)},__wbg_get_with_ref_key_6412cf3094599694:function(e,i){let r=E(e)[E(i)];return $(r)},__wbg_get_with_ref_key_7e638bba08a44478:function(e,i){let r=E(e)[E(i)];return $(r)},__wbg_gpu_2ccc250735d24a2a:function(e){let i=E(e).gpu;return $(i)},__wbg_has_0c97053e877f47cc:function(e,i,r){return E(e).has(hi(i,r))},__wbg_has_73740b27f436fed3:function(){return De(function(e,i){return Reflect.has(E(e),E(i))},arguments)},__wbg_height_4e7694e4e2110bdb:function(e){return E(e).height},__wbg_info_af7f45292ba9b0ea:function(e){console.info(E(e))},__wbg_info_cf0d9a286850cd24:function(e){let i=E(e).info;return $(i)},__wbg_innerHeight_8b6ee2571dbedb9d:function(){return De(function(e){let i=E(e).innerHeight;return $(i)},arguments)},__wbg_innerWidth_7475bec19f48fe43:function(){return De(function(e){let i=E(e).innerWidth;return $(i)},arguments)},__wbg_instanceof_ArrayBuffer_8f49811467741499:function(e){let i;try{i=E(e)instanceof ArrayBuffer}catch{i=!1}return i},__wbg_instanceof_GpuOutOfMemoryError_6429c750997f1c8d:function(e){let i;try{i=E(e)instanceof GPUOutOfMemoryError}catch{i=!1}return i},__wbg_instanceof_GpuValidationError_75fa3611f065f4df:function(e){let i;try{i=E(e)instanceof GPUValidationError}catch{i=!1}return i},__wbg_instanceof_HtmlVideoElement_95590e1ff107ba83:function(e){let i;try{i=E(e)instanceof HTMLVideoElement}catch{i=!1}return i},__wbg_instanceof_ImageBitmap_beed1259521cd66d:function(e){let i;try{i=E(e)instanceof ImageBitmap}catch{i=!1}return i},__wbg_instanceof_Response_cb984bd66d7bd408:function(e){let i;try{i=E(e)instanceof Response}catch{i=!1}return i},__wbg_instanceof_Uint8Array_86f30649f63ef9c2:function(e){let i;try{i=E(e)instanceof Uint8Array}catch{i=!1}return i},__wbg_instanceof_WebGl2RenderingContext_39d13e3f953130c7:function(e){let i;try{i=E(e)instanceof WebGL2RenderingContext}catch{i=!1}return i},__wbg_instanceof_Window_e093be59ee9a8e14:function(e){let i;try{i=E(e)instanceof Window}catch{i=!1}return i},__wbg_invalidateFramebuffer_6b8dae55a3debb1d:function(){return De(function(e,i,r){E(e).invalidateFramebuffer(i>>>0,E(r))},arguments)},__wbg_isArray_67c2c9c4313f4448:function(e){return Array.isArray(E(e))},__wbg_isFallbackAdapter_8ccb967428491dcb:function(e){return E(e).isFallbackAdapter},__wbg_isSafeInteger_66acec27e09e99a7:function(e){return Number.isSafeInteger(E(e))},__wbg_iterator_8732428d309e270e:function(){return $(Symbol.iterator)},__wbg_label_7ed42f25f841996b:function(e,i){let r=E(i).label,s=As(r,Y.__wbindgen_export,Y.__wbindgen_export2),n=kr;ze().setInt32(e+4,n,!0),ze().setInt32(e+0,s,!0)},__wbg_length_280688879ee7deb5:function(e){return E(e).length},__wbg_length_4a591ecaa01354d9:function(e){return E(e).length},__wbg_length_66f1a4b2e9026940:function(e){return E(e).length},__wbg_limits_20c6f56636df7d38:function(e){let i=E(e).limits;return $(i)},__wbg_limits_328c61cd41512420:function(e){let i=E(e).limits;return $(i)},__wbg_linkProgram_3ccc9beaa6dace28:function(e,i){E(e).linkProgram(E(i))},__wbg_linkProgram_fe2b1bf26336c4a5:function(e,i){E(e).linkProgram(E(i))},__wbg_loadImageFromBytes_3d42766b73aca4ca:function(e){let i=mq(Oe(e));return $(i)},__wbg_loadImageFromUrl_50be99dbf040255b:function(e,i){let r,s;try{r=e,s=i;let n=fq(hi(e,i));return $(n)}finally{Y.__wbindgen_export4(r,s,1)}},__wbg_loadVideoFromBytes_3d884aadcf4d2139:function(e){let i=vq(Oe(e));return $(i)},__wbg_loadVideoFromUrl_7997ffb030d4b08b:function(e,i){let r,s;try{r=e,s=i;let n=bq(hi(e,i));return $(n)}finally{Y.__wbindgen_export4(r,s,1)}},__wbg_location_efdf1fea18b5552a:function(e){let i=E(e).location;return $(i)},__wbg_log_cf2e968649f3384e:function(e){console.log(E(e))},__wbg_lost_0fa164c88f543338:function(e){let i=E(e).lost;return $(i)},__wbg_mapAsync_52b01fa9e8f765fd:function(e,i,r,s){let n=E(e).mapAsync(i>>>0,r,s);return $(n)},__wbg_maxBindGroupsPlusVertexBuffers_33e5006b23e20478:function(e){return E(e).maxBindGroupsPlusVertexBuffers},__wbg_maxBindGroups_f6d26f3a67826666:function(e){return E(e).maxBindGroups},__wbg_maxBindingsPerBindGroup_edab2e8dabbf6060:function(e){return E(e).maxBindingsPerBindGroup},__wbg_maxBufferSize_bbc69284c14aa7da:function(e){return E(e).maxBufferSize},__wbg_maxColorAttachmentBytesPerSample_63ebe4f81de2f34c:function(e){return E(e).maxColorAttachmentBytesPerSample},__wbg_maxColorAttachments_aed8c38beabf3a5c:function(e){return E(e).maxColorAttachments},__wbg_maxComputeInvocationsPerWorkgroup_2d964564c37f1c65:function(e){return E(e).maxComputeInvocationsPerWorkgroup},__wbg_maxComputeWorkgroupSizeX_a3e3206570da184f:function(e){return E(e).maxComputeWorkgroupSizeX},__wbg_maxComputeWorkgroupSizeY_dffa4a62244b7563:function(e){return E(e).maxComputeWorkgroupSizeY},__wbg_maxComputeWorkgroupSizeZ_976ebcb760f6d07d:function(e){return E(e).maxComputeWorkgroupSizeZ},__wbg_maxComputeWorkgroupStorageSize_2e8dbece6e532e2a:function(e){return E(e).maxComputeWorkgroupStorageSize},__wbg_maxComputeWorkgroupsPerDimension_bb7d36b4d20c80f4:function(e){return E(e).maxComputeWorkgroupsPerDimension},__wbg_maxDynamicStorageBuffersPerPipelineLayout_1ca859cb96a414e0:function(e){return E(e).maxDynamicStorageBuffersPerPipelineLayout},__wbg_maxDynamicUniformBuffersPerPipelineLayout_e968f2c8cd8f4d46:function(e){return E(e).maxDynamicUniformBuffersPerPipelineLayout},__wbg_maxInterStageShaderVariables_138ac882c4d6a3d3:function(e){return E(e).maxInterStageShaderVariables},__wbg_maxSampledTexturesPerShaderStage_bb3e6b2698321fa6:function(e){return E(e).maxSampledTexturesPerShaderStage},__wbg_maxSamplersPerShaderStage_98c00a1829fa414b:function(e){return E(e).maxSamplersPerShaderStage},__wbg_maxStorageBufferBindingSize_e500e31f479e669e:function(e){return E(e).maxStorageBufferBindingSize},__wbg_maxStorageBuffersPerShaderStage_eb663f6d7521b6a7:function(e){return E(e).maxStorageBuffersPerShaderStage},__wbg_maxStorageTexturesPerShaderStage_bb3ad93b53e618c0:function(e){return E(e).maxStorageTexturesPerShaderStage},__wbg_maxTextureArrayLayers_2a56d05fb261c99a:function(e){return E(e).maxTextureArrayLayers},__wbg_maxTextureDimension1D_84590c1d4770d319:function(e){return E(e).maxTextureDimension1D},__wbg_maxTextureDimension2D_7f2b5c8b2727e3fc:function(e){return E(e).maxTextureDimension2D},__wbg_maxTextureDimension3D_7f3babddf55c32a6:function(e){return E(e).maxTextureDimension3D},__wbg_maxUniformBufferBindingSize_d80a09e23c0b284c:function(e){return E(e).maxUniformBufferBindingSize},__wbg_maxUniformBuffersPerShaderStage_0b8b2de676fa740e:function(e){return E(e).maxUniformBuffersPerShaderStage},__wbg_maxVertexAttributes_a693dd921316649b:function(e){return E(e).maxVertexAttributes},__wbg_maxVertexBufferArrayStride_f256d91f281076cb:function(e){return E(e).maxVertexBufferArrayStride},__wbg_maxVertexBuffers_70ab564b25d5ac20:function(e){return E(e).maxVertexBuffers},__wbg_message_28959d6ca4d7dda0:function(e,i){let r=E(i).message,s=As(r,Y.__wbindgen_export,Y.__wbindgen_export2),n=kr;ze().setInt32(e+4,n,!0),ze().setInt32(e+0,s,!0)},__wbg_message_4ada57a3710f1502:function(e,i){let r=E(i).message,s=As(r,Y.__wbindgen_export,Y.__wbindgen_export2),n=kr;ze().setInt32(e+4,n,!0),ze().setInt32(e+0,s,!0)},__wbg_minStorageBufferOffsetAlignment_3248ed00dcdbf79f:function(e){return E(e).minStorageBufferOffsetAlignment},__wbg_minUniformBufferOffsetAlignment_3b9fa4caae03e903:function(e){return E(e).minUniformBufferOffsetAlignment},__wbg_name_b7fa2500fc153b89:function(e,i){let r=E(i).name,s=As(r,Y.__wbindgen_export,Y.__wbindgen_export2),n=kr;ze().setInt32(e+4,n,!0),ze().setInt32(e+0,s,!0)},__wbg_navigator_3833ecdbc19d2757:function(e){let i=E(e).navigator;return $(i)},__wbg_navigator_391291470f58c650:function(e){let i=E(e).navigator;return $(i)},__wbg_new_227d7c05414eb861:function(){let e=new Error;return $(e)},__wbg_new_3b242422c588a8f3:function(){return De(function(e,i){let r=new OffscreenCanvas(e>>>0,i>>>0);return $(r)},arguments)},__wbg_new_578aeef4b6b94378:function(e){let i=new Uint8Array(E(e));return $(i)},__wbg_new_b682b81e8eaaf027:function(e,i){try{var r={a:e,b:i},s=(a,o)=>{let l=r.a;r.a=0;try{return xq(l,r.b,a,o)}finally{r.a=l}};let n=new Promise(s);return $(n)}finally{r.a=0}},__wbg_new_ce1ab61c1c2b300d:function(){let e=new Object;return $(e)},__wbg_new_d90091b82fdf5b91:function(){let e=new Array;return $(e)},__wbg_new_from_slice_18fa1f71286d66b8:function(e,i){let r=new Uint8Array(Vc(e,i));return $(r)},__wbg_new_from_slice_3c93d0bc613de8f0:function(e,i){let r=new Float64Array(I2t(e,i));return $(r)},__wbg_new_from_slice_47be4219028de35d:function(e,i){let r=new Uint32Array(db(e,i));return $(r)},__wbg_new_from_slice_956df4f769fb782c:function(e,i){let r=new Float32Array(Ho(e,i));return $(r)},__wbg_new_typed_41c97238ee4583e3:function(){let e=new Object;return $(e)},__wbg_new_typed_bf31d18f92484486:function(e,i){try{var r={a:e,b:i},s=(a,o)=>{let l=r.a;r.a=0;try{return xq(l,r.b,a,o)}finally{r.a=l}};let n=new Promise(s);return $(n)}finally{r.a=0}},__wbg_new_with_byte_offset_and_length_d836f26d916dd9ad:function(e,i,r){let s=new Uint8Array(E(e),i>>>0,r>>>0);return $(s)},__wbg_new_with_length_36a4998e27b014c5:function(e){let i=new Uint8Array(e>>>0);return $(i)},__wbg_new_with_length_b4a87ccced374381:function(e){let i=new Float64Array(e>>>0);return $(i)},__wbg_new_with_str_and_init_bcd02b79a793d27f:function(){return De(function(e,i,r){let s=new Request(hi(e,i),E(r));return $(s)},arguments)},__wbg_next_9e03acdf51c4960d:function(e){let i=E(e).next;return $(i)},__wbg_next_eb8ca7351fa27906:function(){return De(function(e){let i=E(e).next();return $(i)},arguments)},__wbg_now_f565250295e2d180:function(e){return E(e).now()},__wbg_of_57145fdec12d159f:function(e){let i=Array.of(E(e));return $(i)},__wbg_ok_fb13c30bc1893039:function(e){return E(e).ok},__wbg_onSubmittedWorkDone_270d6b5a45520e79:function(e){let i=E(e).onSubmittedWorkDone();return $(i)},__wbg_open_177ad1dcc06b9106:function(){return De(function(e,i,r,s,n,a,o){let l=E(e).open(hi(i,r),hi(s,n),hi(a,o));return Fe(l)?0:$(l)},arguments)},__wbg_open_feb75fe4d9971c50:function(){return De(function(e,i,r,s,n){let a=E(e).open(hi(i,r),hi(s,n));return Fe(a)?0:$(a)},arguments)},__wbg_ownKeys_0587b8fe286a40e6:function(){return De(function(e){let i=Reflect.ownKeys(E(e));return $(i)},arguments)},__wbg_pause_adce2b37e004ae49:function(){return De(function(e){E(e).pause()},arguments)},__wbg_performance_68499ca0718837f5:function(e){let i=E(e).performance;return Fe(i)?0:$(i)},__wbg_pixelStorei_6e42d231aa75bd00:function(e,i,r){E(e).pixelStorei(i>>>0,r)},__wbg_pixelStorei_84dc1952dc699c94:function(e,i,r){E(e).pixelStorei(i>>>0,r)},__wbg_play_4ed9ece3cae2c100:function(){return De(function(e){let i=E(e).play();return $(i)},arguments)},__wbg_popErrorScope_8e7f4cbff8b758dd:function(e){let i=E(e).popErrorScope();return $(i)},__wbg_prototypesetcall_3249fc62a0fafa30:function(e,i,r){Uint8Array.prototype.set.call(Vc(e,i),E(r))},__wbg_prototypesetcall_59640349d2c6d881:function(e,i,r){Uint32Array.prototype.set.call(db(e,i),E(r))},__wbg_provokingVertexWEBGL_0354dc7ad44d69bf:function(e,i){E(e).provokingVertexWEBGL(i>>>0)},__wbg_pushErrorScope_fa23d1206bc26dce:function(e,i){E(e).pushErrorScope(v2t[i])},__wbg_push_a6822215aa43e71c:function(e,i){return E(e).push(E(i))},__wbg_querySelectorAll_4dcc230a2f8a2498:function(){return De(function(e,i,r){let s=E(e).querySelectorAll(hi(i,r));return $(s)},arguments)},__wbg_queueMicrotask_35c611f4a14830b2:function(e){queueMicrotask(E(e))},__wbg_queueMicrotask_404ed0a58e0b63cc:function(e){let i=E(e).queueMicrotask;return $(i)},__wbg_queue_adce34608fd0c893:function(e){let i=E(e).queue;return $(i)},__wbg_readBuffer_2027f7cdd7533f2d:function(e,i){E(e).readBuffer(i>>>0)},__wbg_readPixels_a04f5cf5019be695:function(){return De(function(e,i,r,s,n,a,o,l){E(e).readPixels(i,r,s,n,a>>>0,o>>>0,E(l))},arguments)},__wbg_readPixels_bf9ee726d9179d3c:function(){return De(function(e,i,r,s,n,a,o,l){E(e).readPixels(i,r,s,n,a>>>0,o>>>0,E(l))},arguments)},__wbg_readPixels_d00c1cae608273d8:function(){return De(function(e,i,r,s,n,a,o,l){E(e).readPixels(i,r,s,n,a>>>0,o>>>0,l)},arguments)},__wbg_readyState_77b1b1db1b8c2a5f:function(e){return E(e).readyState},__wbg_reason_b02cd587d1a09948:function(e){let i=E(e).reason;return(y2t.indexOf(i)+1||3)-1},__wbg_renderbufferStorageMultisample_75bba97a8e59bc6e:function(e,i,r,s,n,a){E(e).renderbufferStorageMultisample(i>>>0,r,s>>>0,n,a)},__wbg_renderbufferStorage_3f5b0ec8fca2f9f8:function(e,i,r,s,n){E(e).renderbufferStorage(i>>>0,r>>>0,s,n)},__wbg_renderbufferStorage_c34a47cacbbc5fff:function(e,i,r,s,n){E(e).renderbufferStorage(i>>>0,r>>>0,s,n)},__wbg_requestAdapter_2e6718811c735a57:function(e,i){let r=E(e).requestAdapter(E(i));return $(r)},__wbg_requestDevice_ab46d0519ea1cc34:function(e,i){let r=E(e).requestDevice(E(i));return $(r)},__wbg_resolveQuerySet_0f32dc3de3f09701:function(e,i,r,s,n,a){E(e).resolveQuerySet(E(i),r>>>0,s>>>0,E(n),a>>>0)},__wbg_resolve_25a7e548d5881dca:function(e){let i=Promise.resolve(E(e));return $(i)},__wbg_scissor_079b7c4a5c9fcb63:function(e,i,r,s,n){E(e).scissor(i,r,s,n)},__wbg_scissor_e69faa631ab6fdc0:function(e,i,r,s,n){E(e).scissor(i,r,s,n)},__wbg_setBindGroup_268fd1714fff0ef5:function(){return De(function(e,i,r,s,n,a,o){E(e).setBindGroup(i>>>0,E(r),db(s,n),a,o>>>0)},arguments)},__wbg_setBindGroup_3e4ce136bc833ea1:function(){return De(function(e,i,r,s,n,a,o){E(e).setBindGroup(i>>>0,E(r),db(s,n),a,o>>>0)},arguments)},__wbg_setBindGroup_c22a1b95c0b17f37:function(e,i,r){E(e).setBindGroup(i>>>0,E(r))},__wbg_setBindGroup_f0de6cb2c7dbfc2c:function(e,i,r){E(e).setBindGroup(i>>>0,E(r))},__wbg_setIndexBuffer_2531a9103450445e:function(e,i,r,s){E(e).setIndexBuffer(E(i),dN[r],s)},__wbg_setIndexBuffer_7f3cf667b4d71566:function(e,i,r,s,n){E(e).setIndexBuffer(E(i),dN[r],s,n)},__wbg_setPipeline_c41bf46790f27f9e:function(e,i){E(e).setPipeline(E(i))},__wbg_setPipeline_d73f019e98c76d2d:function(e,i){E(e).setPipeline(E(i))},__wbg_setStencilReference_66c74be6232bb9da:function(e,i){E(e).setStencilReference(i>>>0)},__wbg_setTimeout_b5f25e402b6e8ff9:function(){return De(function(e,i,r){return E(e).setTimeout(E(i),r)},arguments)},__wbg_setVertexBuffer_1e448859663dd400:function(e,i,r,s){E(e).setVertexBuffer(i>>>0,E(r),s)},__wbg_setVertexBuffer_7cf533d694e747f3:function(e,i,r,s,n){E(e).setVertexBuffer(i>>>0,E(r),s,n)},__wbg_setViewport_d9fc3eac343de7d0:function(e,i,r,s,n,a,o){E(e).setViewport(i,r,s,n,a,o)},__wbg_set_29c99a8aac1c01e5:function(e,i,r){E(e).set(Vc(i,r))},__wbg_set_6e30c9374c26414c:function(){return De(function(e,i,r){return Reflect.set(E(e),E(i),E(r))},arguments)},__wbg_set_6f7e2d6e41d9a122:function(e,i,r){E(e)[Oe(i)]=Oe(r)},__wbg_set_a_88262a42340d0b1c:function(e,i){E(e).a=i},__wbg_set_access_9a5092f05dc45fad:function(e,i){E(e).access=M2t[i]},__wbg_set_address_mode_u_9e2695575a219e33:function(e,i){E(e).addressModeU=hN[i]},__wbg_set_address_mode_v_f479b2e6cccbcac4:function(e,i){E(e).addressModeV=hN[i]},__wbg_set_address_mode_w_46273e153230180d:function(e,i){E(e).addressModeW=hN[i]},__wbg_set_alpha_bfd2df62e7bc581b:function(e,i){E(e).alpha=E(i)},__wbg_set_alpha_mode_df805952892caa9c:function(e,i){E(e).alphaMode=m2t[i]},__wbg_set_alpha_to_coverage_enabled_8b5dc2b0a225b3b2:function(e,i){E(e).alphaToCoverageEnabled=i!==0},__wbg_set_array_layer_count_7312f0f31af94e7c:function(e,i){E(e).arrayLayerCount=i>>>0},__wbg_set_array_stride_f64_27ffaf4fffd74e61:function(e,i){E(e).arrayStride=i},__wbg_set_aspect_0d453bca3d012f02:function(e,i){E(e).aspect=fN[i]},__wbg_set_aspect_210da747c9d77aba:function(e,i){E(e).aspect=fN[i]},__wbg_set_aspect_4962514fe99e68e6:function(e,i){E(e).aspect=fN[i]},__wbg_set_attributes_7537844a7e6dafdc:function(e,i,r){E(e).attributes=rh(i,r)},__wbg_set_b_c47befe0af3261eb:function(e,i){E(e).b=i},__wbg_set_base_array_layer_f176bb9f1b37b342:function(e,i){E(e).baseArrayLayer=i>>>0},__wbg_set_base_mip_level_1df145d9f8db32a9:function(e,i){E(e).baseMipLevel=i>>>0},__wbg_set_beginning_of_pass_write_index_0d4fa06109208ad7:function(e,i){E(e).beginningOfPassWriteIndex=i>>>0},__wbg_set_beginning_of_pass_write_index_e9f5d016947893bd:function(e,i){E(e).beginningOfPassWriteIndex=i>>>0},__wbg_set_bind_group_layouts_5a9cfea401c020ab:function(e,i,r){E(e).bindGroupLayouts=rh(i,r)},__wbg_set_binding_155b0440b4307793:function(e,i){E(e).binding=i>>>0},__wbg_set_binding_f74df3510792aba1:function(e,i){E(e).binding=i>>>0},__wbg_set_blend_7493c2066c3e9970:function(e,i){E(e).blend=E(i)},__wbg_set_buffer_9c01e3b6d6765ea2:function(e,i){E(e).buffer=E(i)},__wbg_set_buffer_c3410572051920ba:function(e,i){E(e).buffer=E(i)},__wbg_set_buffer_ef7f75306cf663ed:function(e,i){E(e).buffer=E(i)},__wbg_set_buffers_7d0d8f507699e956:function(e,i,r){E(e).buffers=rh(i,r)},__wbg_set_bytes_per_row_c54ca96953f35774:function(e,i){E(e).bytesPerRow=i>>>0},__wbg_set_bytes_per_row_d69b88eee3929c07:function(e,i){E(e).bytesPerRow=i>>>0},__wbg_set_c775d84916be79ea:function(e,i,r){E(e).set(E(i),r>>>0)},__wbg_set_clear_value_gpu_color_dict_6211425789c76e59:function(e,i){E(e).clearValue=E(i)},__wbg_set_code_b4f37f81f45b5b25:function(e,i,r){E(e).code=hi(i,r)},__wbg_set_color_83aa977526e88cbb:function(e,i){E(e).color=E(i)},__wbg_set_color_attachments_581fdb3310e4abfa:function(e,i,r){E(e).colorAttachments=rh(i,r)},__wbg_set_compare_cd9b62cdb92eb580:function(e,i){E(e).compare=uN[i]},__wbg_set_compare_f36b34abfaa08ccb:function(e,i){E(e).compare=uN[i]},__wbg_set_compute_d0c2d276b6d4b18d:function(e,i){E(e).compute=E(i)},__wbg_set_count_069a4eac409bac55:function(e,i){E(e).count=i>>>0},__wbg_set_count_3ab1c1220e4ceeb3:function(e,i){E(e).count=i>>>0},__wbg_set_cull_mode_fc649853947a3d0c:function(e,i){E(e).cullMode=g2t[i]},__wbg_set_currentTime_7c37e2312e9d2687:function(e,i){E(e).currentTime=i},__wbg_set_depth_bias_clamp_1c0d695df7f092e5:function(e,i){E(e).depthBiasClamp=i},__wbg_set_depth_bias_d7cd16096242a657:function(e,i){E(e).depthBias=i},__wbg_set_depth_bias_slope_scale_c4e52ec743ef55ba:function(e,i){E(e).depthBiasSlopeScale=i},__wbg_set_depth_clear_value_beda3ec5b1a5c43a:function(e,i){E(e).depthClearValue=i},__wbg_set_depth_compare_0c8631eb2eae98e3:function(e,i){E(e).depthCompare=uN[i]},__wbg_set_depth_fail_op_668155ae33d3c06f:function(e,i){E(e).depthFailOp=pN[i]},__wbg_set_depth_load_op_511c513eab4e56a9:function(e,i){E(e).depthLoadOp=cN[i]},__wbg_set_depth_or_array_layers_89371305ed0bd962:function(e,i){E(e).depthOrArrayLayers=i>>>0},__wbg_set_depth_read_only_7f41a74741c144ec:function(e,i){E(e).depthReadOnly=i!==0},__wbg_set_depth_stencil_97506c7bea4f53da:function(e,i){E(e).depthStencil=E(i)},__wbg_set_depth_stencil_attachment_73b79e8b4e948222:function(e,i){E(e).depthStencilAttachment=E(i)},__wbg_set_depth_store_op_c89f33b39b43361c:function(e,i){E(e).depthStoreOp=mN[i]},__wbg_set_depth_write_enabled_ce89750042940350:function(e,i){E(e).depthWriteEnabled=i!==0},__wbg_set_device_e275d1d4f3c9eb74:function(e,i){E(e).device=E(i)},__wbg_set_dimension_868eee80f4b90011:function(e,i){E(e).dimension=A2t[i]},__wbg_set_dimension_e325282e613ca0a4:function(e,i){E(e).dimension=gN[i]},__wbg_set_dst_factor_ec7407f19be1aff9:function(e,i){E(e).dstFactor=Sq[i]},__wbg_set_end_of_pass_write_index_0d546e46b86ea069:function(e,i){E(e).endOfPassWriteIndex=i>>>0},__wbg_set_end_of_pass_write_index_49a6ddbb2b888bfa:function(e,i){E(e).endOfPassWriteIndex=i>>>0},__wbg_set_entries_86a29dd6291c95e7:function(e,i,r){E(e).entries=rh(i,r)},__wbg_set_entries_a12aca1e458b0456:function(e,i,r){E(e).entries=rh(i,r)},__wbg_set_entry_point_207540f042015ce5:function(e,i,r){E(e).entryPoint=hi(i,r)},__wbg_set_entry_point_5f26aacbe4c545eb:function(e,i,r){E(e).entryPoint=hi(i,r)},__wbg_set_entry_point_e87e79251dd3144f:function(e,i,r){E(e).entryPoint=hi(i,r)},__wbg_set_external_texture_386483d8dd82ab56:function(e,i){E(e).externalTexture=E(i)},__wbg_set_fail_op_92f716dbc88b6973:function(e,i){E(e).failOp=pN[i]},__wbg_set_flip_y_4e1632b36ad0413a:function(e,i){E(e).flipY=i!==0},__wbg_set_format_1fcaa7d60546b490:function(e,i){E(e).format=Rm[i]},__wbg_set_format_2c1414a817c213f8:function(e,i){E(e).format=Rm[i]},__wbg_set_format_533f9ffa7eef563d:function(e,i){E(e).format=Rm[i]},__wbg_set_format_5d2f25cc93654ecc:function(e,i){E(e).format=E2t[i]},__wbg_set_format_5ff53724ed6cedf2:function(e,i){E(e).format=Rm[i]},__wbg_set_format_815efd4dc4817bbb:function(e,i){E(e).format=Rm[i]},__wbg_set_format_e52bdcca880d2c8e:function(e,i){E(e).format=Rm[i]},__wbg_set_fragment_8b780f00a0b0e6f3:function(e,i){E(e).fragment=E(i)},__wbg_set_front_face_28ffdf524eedce5b:function(e,i){E(e).frontFace=b2t[i]},__wbg_set_g_5983abfc46e0cf4e:function(e,i){E(e).g=i},__wbg_set_has_dynamic_offset_62bc230bdb7c54d0:function(e,i){E(e).hasDynamicOffset=i!==0},__wbg_set_height_0739170de8653cc4:function(e,i){E(e).height=i>>>0},__wbg_set_height_14335c4047cf9c1b:function(e,i){E(e).height=i>>>0},__wbg_set_height_c661af0c0b5376f9:function(e,i){E(e).height=i>>>0},__wbg_set_label_08d9be3e4719c226:function(e,i,r){E(e).label=hi(i,r)},__wbg_set_label_17eb9fe3a02f62b0:function(e,i,r){E(e).label=hi(i,r)},__wbg_set_label_206558c8adc3780f:function(e,i,r){E(e).label=hi(i,r)},__wbg_set_label_48e6b787d256f621:function(e,i,r){E(e).label=hi(i,r)},__wbg_set_label_547d0d4aec39fbe9:function(e,i,r){E(e).label=hi(i,r)},__wbg_set_label_5ee7427342869829:function(e,i,r){E(e).label=hi(i,r)},__wbg_set_label_60ad96c811e0d109:function(e,i,r){E(e).label=hi(i,r)},__wbg_set_label_6db0393d3fdc90a5:function(e,i,r){E(e).label=hi(i,r)},__wbg_set_label_72bb4f41ef0cb893:function(e,i,r){E(e).label=hi(i,r)},__wbg_set_label_79387decda299036:function(e,i,r){E(e).label=hi(i,r)},__wbg_set_label_9556af8b5cda3c9d:function(e,i,r){E(e).label=hi(i,r)},__wbg_set_label_d010f237b26f2c55:function(e,i,r){E(e).label=hi(i,r)},__wbg_set_label_e16e2dbe51349c7f:function(e,i,r){E(e).label=hi(i,r)},__wbg_set_label_e3944e54881b8c50:function(e,i,r){E(e).label=hi(i,r)},__wbg_set_label_e922700240417ab5:function(e,i,r){E(e).label=hi(i,r)},__wbg_set_label_ef44793ddf4455c5:function(e,i,r){E(e).label=hi(i,r)},__wbg_set_layout_41021cfd2a2f62df:function(e,i){E(e).layout=E(i)},__wbg_set_layout_50ab727f44b38f26:function(e,i){E(e).layout=E(i)},__wbg_set_layout_913d53c17194c989:function(e,i){E(e).layout=E(i)},__wbg_set_layout_gpu_auto_layout_mode_0a5a185b3d52b726:function(e,i){E(e).layout=wq[i]},__wbg_set_layout_gpu_auto_layout_mode_aeba193938b47882:function(e,i){E(e).layout=wq[i]},__wbg_set_load_op_99661da6c4eab9b0:function(e,i){E(e).loadOp=cN[i]},__wbg_set_lod_max_clamp_dd2d9f9f052f4f44:function(e,i){E(e).lodMaxClamp=i},__wbg_set_lod_min_clamp_6d20c97916baeb93:function(e,i){E(e).lodMinClamp=i},__wbg_set_loop_b622b726769860be:function(e,i){E(e).loop=i!==0},__wbg_set_mag_filter_b5adebc99cb938e1:function(e,i){E(e).magFilter=Tq[i]},__wbg_set_mapped_at_creation_81b586dc90a50347:function(e,i){E(e).mappedAtCreation=i!==0},__wbg_set_mask_70a8a59ce09e5997:function(e,i){E(e).mask=i>>>0},__wbg_set_max_anisotropy_2beada0e2db62c45:function(e,i){E(e).maxAnisotropy=i},__wbg_set_method_7a6811dec7a4feff:function(e,i,r){E(e).method=hi(i,r)},__wbg_set_min_binding_size_f64_5005a6904cdf43da:function(e,i){E(e).minBindingSize=i},__wbg_set_min_filter_c72f17375e135f0a:function(e,i){E(e).minFilter=Tq[i]},__wbg_set_mip_level_13253f3afc7aa58a:function(e,i){E(e).mipLevel=i>>>0},__wbg_set_mip_level_count_534caaa7e68e68b8:function(e,i){E(e).mipLevelCount=i>>>0},__wbg_set_mip_level_count_776c8c218b65bc08:function(e,i){E(e).mipLevelCount=i>>>0},__wbg_set_mip_level_f7ac79e8c54f59ad:function(e,i){E(e).mipLevel=i>>>0},__wbg_set_mipmap_filter_5bf66195a3639700:function(e,i){E(e).mipmapFilter=_2t[i]},__wbg_set_mode_9990b3393ba469ae:function(e,i){E(e).mode=f2t[i]},__wbg_set_mode_c90e3667002857d4:function(e,i){E(e).mode=R2t[i]},__wbg_set_module_5db9b76ee2dd2a59:function(e,i){E(e).module=E(i)},__wbg_set_module_d0e2098713606cae:function(e,i){E(e).module=E(i)},__wbg_set_module_f02e076ca7e7daf8:function(e,i){E(e).module=E(i)},__wbg_set_multisample_37ddafe88b5cd466:function(e,i){E(e).multisample=E(i)},__wbg_set_multisampled_7913fd7183272840:function(e,i){E(e).multisampled=i!==0},__wbg_set_muted_16f1e7acd8244e28:function(e,i){E(e).muted=i!==0},__wbg_set_offset_f64_28c24dc15000932e:function(e,i){E(e).offset=i},__wbg_set_offset_f64_89f0ce01a689839e:function(e,i){E(e).offset=i},__wbg_set_offset_f64_b562d1367e34ef93:function(e,i){E(e).offset=i},__wbg_set_offset_f64_fa66068813376ca3:function(e,i){E(e).offset=i},__wbg_set_once_27df5233613a51cd:function(e,i){E(e).once=i!==0},__wbg_set_operation_62ce44e1728c4047:function(e,i){E(e).operation=c2t[i]},__wbg_set_origin_gpu_origin_2d_dict_1240202973e56f92:function(e,i){E(e).origin=E(i)},__wbg_set_origin_gpu_origin_3d_dict_37222d7b3d238123:function(e,i){E(e).origin=E(i)},__wbg_set_origin_gpu_origin_3d_dict_631c04520718091f:function(e,i){E(e).origin=E(i)},__wbg_set_pass_op_cf02fa088d6352a7:function(e,i){E(e).passOp=pN[i]},__wbg_set_power_preference_8fdca0b7af640d49:function(e,i){E(e).powerPreference=x2t[i]},__wbg_set_premultiplied_alpha_3f27816ad319d5a9:function(e,i){E(e).premultipliedAlpha=i!==0},__wbg_set_primitive_43c23761a55b4088:function(e,i){E(e).primitive=E(i)},__wbg_set_query_set_41de86d2401aee04:function(e,i){E(e).querySet=E(i)},__wbg_set_query_set_4889dd944d5ec0fd:function(e,i){E(e).querySet=E(i)},__wbg_set_r_c6f4c68f4804d655:function(e,i){E(e).r=i},__wbg_set_required_features_1baf274a8669db60:function(e,i,r){E(e).requiredFeatures=rh(i,r)},__wbg_set_required_limits_871ed33c68613dcb:function(e,i){E(e).requiredLimits=E(i)},__wbg_set_resolve_target_gpu_texture_view_b19a4f2debf79b96:function(e,i){E(e).resolveTarget=E(i)},__wbg_set_resource_5ae7b5e67924f234:function(e,i){E(e).resource=E(i)},__wbg_set_resource_gpu_buffer_binding_e5dbca063e7cb67b:function(e,i){E(e).resource=E(i)},__wbg_set_resource_gpu_texture_view_eb46c355d51ad7e5:function(e,i){E(e).resource=E(i)},__wbg_set_rows_per_image_5011f97318ee71af:function(e,i){E(e).rowsPerImage=i>>>0},__wbg_set_rows_per_image_59a813ac5006e10e:function(e,i){E(e).rowsPerImage=i>>>0},__wbg_set_sample_count_eb86a8b18545b54f:function(e,i){E(e).sampleCount=i>>>0},__wbg_set_sample_type_c32e1dfff94e63eb:function(e,i){E(e).sampleType=C2t[i]},__wbg_set_sampler_c0e1258543a33bce:function(e,i){E(e).sampler=E(i)},__wbg_set_shader_location_7e1832a74f912217:function(e,i){E(e).shaderLocation=i>>>0},__wbg_set_size_f64_6bcd40704bf4cfdc:function(e,i){E(e).size=i},__wbg_set_size_f64_8b8f6bba5d678162:function(e,i){E(e).size=i},__wbg_set_size_gpu_extent_3d_dict_7e42e1c98fa36434:function(e,i){E(e).size=E(i)},__wbg_set_source_0c40b87cfdd5d704:function(e,i){E(e).source=E(i)},__wbg_set_source_html_canvas_element_f657e39507ba2fe5:function(e,i){E(e).source=E(i)},__wbg_set_source_html_image_element_fcc7cba0635adac1:function(e,i){E(e).source=E(i)},__wbg_set_source_html_video_element_e63a39653665f651:function(e,i){E(e).source=E(i)},__wbg_set_source_image_data_68478f1afce208b8:function(e,i){E(e).source=E(i)},__wbg_set_source_offscreen_canvas_266a3de949693e62:function(e,i){E(e).source=E(i)},__wbg_set_source_video_frame_3083c0ce54b9cb73:function(e,i){E(e).source=E(i)},__wbg_set_src_factor_9bfe84af9b7b5cac:function(e,i){E(e).srcFactor=Sq[i]},__wbg_set_stencil_back_85b22f1db5b1940a:function(e,i){E(e).stencilBack=E(i)},__wbg_set_stencil_clear_value_42be608809151e2a:function(e,i){E(e).stencilClearValue=i>>>0},__wbg_set_stencil_front_525526164a798a44:function(e,i){E(e).stencilFront=E(i)},__wbg_set_stencil_load_op_31838c036993098a:function(e,i){E(e).stencilLoadOp=cN[i]},__wbg_set_stencil_read_mask_5cc26495e8b3ae82:function(e,i){E(e).stencilReadMask=i>>>0},__wbg_set_stencil_read_only_bf1d0c1897e25c62:function(e,i){E(e).stencilReadOnly=i!==0},__wbg_set_stencil_store_op_e6be1cbc3a8fc210:function(e,i){E(e).stencilStoreOp=mN[i]},__wbg_set_stencil_write_mask_d9cb40ec4b4bee5b:function(e,i){E(e).stencilWriteMask=i>>>0},__wbg_set_step_mode_a97bb24714da41a9:function(e,i){E(e).stepMode=P2t[i]},__wbg_set_storage_texture_939a097db4b18bd4:function(e,i){E(e).storageTexture=E(i)},__wbg_set_store_op_b5fdf672436f13f3:function(e,i){E(e).storeOp=mN[i]},__wbg_set_strip_index_format_9f787be6c5fc9e87:function(e,i){E(e).stripIndexFormat=dN[i]},__wbg_set_targets_c38bd200c836d66f:function(e,i,r){E(e).targets=rh(i,r)},__wbg_set_texture_016561d5911339e5:function(e,i){E(e).texture=E(i)},__wbg_set_texture_1f64653a5d2d7b4d:function(e,i){E(e).texture=E(i)},__wbg_set_texture_9dcedde1bb31eda6:function(e,i){E(e).texture=E(i)},__wbg_set_timestamp_writes_59c2d19ed8aecd97:function(e,i){E(e).timestampWrites=E(i)},__wbg_set_timestamp_writes_98bed1a8bbc6682d:function(e,i){E(e).timestampWrites=E(i)},__wbg_set_tone_mapping_b3464f1baa4cff92:function(e,i){E(e).toneMapping=E(i)},__wbg_set_topology_da25f2cc5af203d2:function(e,i){E(e).topology=w2t[i]},__wbg_set_type_7f0457c6084dde9b:function(e,i){E(e).type=S2t[i]},__wbg_set_type_ccf8472d40abcddf:function(e,i){E(e).type=T2t[i]},__wbg_set_type_d09829f59932a0fc:function(e,i){E(e).type=p2t[i]},__wbg_set_unclipped_depth_04524a2b44e1e3c1:function(e,i){E(e).unclippedDepth=i!==0},__wbg_set_usage_a137f82ca163b0a9:function(e,i){E(e).usage=i>>>0},__wbg_set_usage_b2a2935f37bf3d08:function(e,i){E(e).usage=i>>>0},__wbg_set_usage_ba5b0f8b333ab325:function(e,i){E(e).usage=i>>>0},__wbg_set_usage_ddd42599bbba7779:function(e,i){E(e).usage=i>>>0},__wbg_set_vertex_0be5d146f9ff6f36:function(e,i){E(e).vertex=E(i)},__wbg_set_view_dimension_0df554032f1f3a85:function(e,i){E(e).viewDimension=gN[i]},__wbg_set_view_dimension_4818d4c18ce5815e:function(e,i){E(e).viewDimension=gN[i]},__wbg_set_view_formats_4347dc8363331086:function(e,i,r){E(e).viewFormats=rh(i,r)},__wbg_set_view_formats_5797d2fff3c11808:function(e,i,r){E(e).viewFormats=rh(i,r)},__wbg_set_view_gpu_texture_view_9b2d86b6b99d9fd9:function(e,i){E(e).view=E(i)},__wbg_set_view_gpu_texture_view_c0f35f8857c25206:function(e,i){E(e).view=E(i)},__wbg_set_visibility_9570b037224c4cc2:function(e,i){E(e).visibility=i>>>0},__wbg_set_volume_520cdc6b7ada8f76:function(e,i){E(e).volume=i},__wbg_set_width_7ca43f32db1cfe8e:function(e,i){E(e).width=i>>>0},__wbg_set_width_87301412247f3343:function(e,i){E(e).width=i>>>0},__wbg_set_width_9f685402c2cbee70:function(e,i){E(e).width=i>>>0},__wbg_set_write_mask_d45279e56abbfcb5:function(e,i){E(e).writeMask=i>>>0},__wbg_set_x_232d24fdc32d8351:function(e,i){E(e).x=i>>>0},__wbg_set_x_876d592971db129a:function(e,i){E(e).x=i>>>0},__wbg_set_y_18fe375093e59dfb:function(e,i){E(e).y=i>>>0},__wbg_set_y_2b1f5ac0dd5586a5:function(e,i){E(e).y=i>>>0},__wbg_set_z_ef005d82bc9d24e3:function(e,i){E(e).z=i>>>0},__wbg_shaderSource_7d18b5a43a504f5c:function(e,i,r,s){E(e).shaderSource(E(i),hi(r,s))},__wbg_shaderSource_df5bb6320451f3cd:function(e,i,r,s){E(e).shaderSource(E(i),hi(r,s))},__wbg_size_211f88d386430781:function(e){return E(e).size},__wbg_src_f0e9281991fbd919:function(e,i){let r=E(i).src,s=As(r,Y.__wbindgen_export,Y.__wbindgen_export2),n=kr;ze().setInt32(e+4,n,!0),ze().setInt32(e+0,s,!0)},__wbg_stack_3b0d974bbf31e44f:function(e,i){let r=E(i).stack,s=As(r,Y.__wbindgen_export,Y.__wbindgen_export2),n=kr;ze().setInt32(e+4,n,!0),ze().setInt32(e+0,s,!0)},__wbg_static_accessor_GLOBAL_9d53f2689e622ca1:function(){let e=typeof global>"u"?null:global;return Fe(e)?0:$(e)},__wbg_static_accessor_GLOBAL_THIS_a1a35cec07001a8a:function(){let e=typeof globalThis>"u"?null:globalThis;return Fe(e)?0:$(e)},__wbg_static_accessor_SELF_4c59f6c7ea29a144:function(){let e=typeof self>"u"?null:self;return Fe(e)?0:$(e)},__wbg_static_accessor_WINDOW_e70ae9f2eb052253:function(){let e=typeof window>"u"?null:window;return Fe(e)?0:$(e)},__wbg_stencilFunc_8f53a5508560354d:function(e,i,r,s){E(e).stencilFunc(i>>>0,r,s>>>0)},__wbg_stencilFunc_c7553215f237ee38:function(e,i,r,s){E(e).stencilFunc(i>>>0,r,s>>>0)},__wbg_stencilOp_a844a4e9824eee70:function(e,i,r,s){E(e).stencilOp(i>>>0,r>>>0,s>>>0)},__wbg_stencilOp_e82bd7ea13f18adf:function(e,i,r,s){E(e).stencilOp(i>>>0,r>>>0,s>>>0)},__wbg_subgroupMaxSize_1527c5f7a8fe91bb:function(e){return E(e).subgroupMaxSize},__wbg_subgroupMinSize_d6c5ad4bddc828e9:function(e){return E(e).subgroupMinSize},__wbg_submit_ce44115121cd166c:function(e,i,r){E(e).submit(rh(i,r))},__wbg_texImage2D_01c22558517ee8db:function(){return De(function(e,i,r,s,n,a,o){E(e).texImage2D(i>>>0,r,s,n>>>0,a>>>0,E(o))},arguments)},__wbg_texImage2D_152e9dcd4bc3a464:function(){return De(function(e,i,r,s,n,a,o,l,u,h){E(e).texImage2D(i>>>0,r,s,n,a,o,l>>>0,u>>>0,E(h))},arguments)},__wbg_texImage2D_3704db20a16b6c35:function(){return De(function(e,i,r,s,n,a,o,l,u,h){E(e).texImage2D(i>>>0,r,s,n,a,o,l>>>0,u>>>0,E(h))},arguments)},__wbg_texImage2D_63d0b87d5ebe4a7f:function(){return De(function(e,i,r,s,n,a,o){E(e).texImage2D(i>>>0,r,s,n>>>0,a>>>0,E(o))},arguments)},__wbg_texImage2D_90633e994ded3d2b:function(){return De(function(e,i,r,s,n,a,o){E(e).texImage2D(i>>>0,r,s,n>>>0,a>>>0,E(o))},arguments)},__wbg_texImage2D_ea94e8a2df5f97e2:function(){return De(function(e,i,r,s,n,a,o,l,u,h){E(e).texImage2D(i>>>0,r,s,n,a,o,l>>>0,u>>>0,h)},arguments)},__wbg_texImage2D_facfa039fb461b66:function(){return De(function(e,i,r,s,n,a,o){E(e).texImage2D(i>>>0,r,s,n>>>0,a>>>0,E(o))},arguments)},__wbg_texParameteri_87ebfcefb0af2c50:function(e,i,r,s){E(e).texParameteri(i>>>0,r>>>0,s)},__wbg_texParameteri_e5ad2054e239066e:function(e,i,r,s){E(e).texParameteri(i>>>0,r>>>0,s)},__wbg_texStorage2D_bb2a1bd1ab0b9184:function(e,i,r,s,n,a){E(e).texStorage2D(i>>>0,r,s>>>0,n,a)},__wbg_texSubImage2D_3483ba5f10ee42c2:function(){return De(function(e,i,r,s,n,a,o,l){E(e).texSubImage2D(i>>>0,r,s,n,a>>>0,o>>>0,E(l))},arguments)},__wbg_texSubImage2D_4ca4c3faa4392438:function(){return De(function(e,i,r,s,n,a,o,l,u,h){E(e).texSubImage2D(i>>>0,r,s,n,a,o,l>>>0,u>>>0,E(h))},arguments)},__wbg_texSubImage2D_54d18572b1ba74ab:function(){return De(function(e,i,r,s,n,a,o,l,u,h){E(e).texSubImage2D(i>>>0,r,s,n,a,o,l>>>0,u>>>0,h)},arguments)},__wbg_texSubImage2D_5bebe93724e6ed61:function(){return De(function(e,i,r,s,n,a,o,l,u,h){E(e).texSubImage2D(i>>>0,r,s,n,a,o,l>>>0,u>>>0,E(h))},arguments)},__wbg_texSubImage2D_5e1594de0416e9f6:function(){return De(function(e,i,r,s,n,a,o,l){E(e).texSubImage2D(i>>>0,r,s,n,a>>>0,o>>>0,E(l))},arguments)},__wbg_then_18f476d590e58992:function(e,i,r){let s=E(e).then(E(i),E(r));return $(s)},__wbg_then_47213a40b6aeb86c:function(e,i){let r=E(e).then(E(i));return $(r)},__wbg_then_ac7b025999b52837:function(e,i){let r=E(e).then(E(i));return $(r)},__wbg_type_71742b859467fa3c:function(e){return E(e).type},__wbg_unconfigure_0a07a0a40de8988d:function(e){E(e).unconfigure()},__wbg_uniform1f_8c3b3e6e3723fe14:function(e,i,r){E(e).uniform1f(E(i),r)},__wbg_uniform1f_d6619faa73c2a45f:function(e,i,r){E(e).uniform1f(E(i),r)},__wbg_uniform1fv_11d5842aff79c8a3:function(e,i,r,s){E(e).uniform1fv(E(i),Ho(r,s))},__wbg_uniform1fv_b4b087b4d6e2bb25:function(e,i,r,s){E(e).uniform1fv(E(i),Ho(r,s))},__wbg_uniform1i_14982bb8438243b4:function(e,i,r){E(e).uniform1i(E(i),r)},__wbg_uniform1i_cf11d5b364eed1c8:function(e,i,r){E(e).uniform1i(E(i),r)},__wbg_uniform1ui_d177882f473d2afc:function(e,i,r){E(e).uniform1ui(E(i),r>>>0)},__wbg_uniform2f_19fb96222ae72e1a:function(e,i,r,s){E(e).uniform2f(E(i),r,s)},__wbg_uniform2f_44cee47e30b82f96:function(e,i,r,s){E(e).uniform2f(E(i),r,s)},__wbg_uniform2fv_2f06d989ec4b5d8f:function(e,i,r,s){E(e).uniform2fv(E(i),Ho(r,s))},__wbg_uniform2fv_f022309b362a80c3:function(e,i,r,s){E(e).uniform2fv(E(i),Ho(r,s))},__wbg_uniform2i_16e8a2c966614be6:function(e,i,r,s){E(e).uniform2i(E(i),r,s)},__wbg_uniform2i_d353da02172ea38d:function(e,i,r,s){E(e).uniform2i(E(i),r,s)},__wbg_uniform3f_360c1ea4c73cacef:function(e,i,r,s,n){E(e).uniform3f(E(i),r,s,n)},__wbg_uniform3f_b616f9e06266a25f:function(e,i,r,s,n){E(e).uniform3f(E(i),r,s,n)},__wbg_uniform4f_f1a670d511b34878:function(e,i,r,s,n,a){E(e).uniform4f(E(i),r,s,n,a)},__wbg_uniform4f_f97f3f59af09856f:function(e,i,r,s,n,a){E(e).uniform4f(E(i),r,s,n,a)},__wbg_uniformMatrix3fv_f45b91f173d7fbed:function(e,i,r,s,n){E(e).uniformMatrix3fv(E(i),r!==0,Ho(s,n))},__wbg_uniformMatrix3fv_feab3f952d705f51:function(e,i,r,s,n){E(e).uniformMatrix3fv(E(i),r!==0,Ho(s,n))},__wbg_uniformMatrix3x2fv_ab13f9742e5fcb2f:function(e,i,r,s,n){E(e).uniformMatrix3x2fv(E(i),r!==0,Ho(s,n))},__wbg_uniformMatrix4fv_540dc6bf792eba8f:function(e,i,r,s,n){E(e).uniformMatrix4fv(E(i),r!==0,Ho(s,n))},__wbg_uniformMatrix4fv_e3dac9dd429d6adc:function(e,i,r,s,n){E(e).uniformMatrix4fv(E(i),r!==0,Ho(s,n))},__wbg_uniformMatrix4x3fv_115d029ad3124cef:function(e,i,r,s,n){E(e).uniformMatrix4x3fv(E(i),r!==0,Ho(s,n))},__wbg_unmap_adaf93276fdf9aaf:function(e){E(e).unmap()},__wbg_useProgram_55a3e940abb19137:function(e,i){E(e).useProgram(E(i))},__wbg_useProgram_e24dadf4c06636f5:function(e,i){E(e).useProgram(E(i))},__wbg_userAgent_8def8135d886414b:function(){return De(function(e,i){let r=E(i).userAgent,s=As(r,Y.__wbindgen_export,Y.__wbindgen_export2),n=kr;ze().setInt32(e+4,n,!0),ze().setInt32(e+0,s,!0)},arguments)},__wbg_valueOf_41ae57308c1f031c:function(e){return E(e).valueOf()},__wbg_value_f3625092ee4b37f4:function(e){let i=E(e).value;return $(i)},__wbg_vertexAttrib4f_6444504b25f4d43e:function(e,i,r,s,n,a){E(e).vertexAttrib4f(i>>>0,r,s,n,a)},__wbg_vertexAttrib4f_aad41fe000407191:function(e,i,r,s,n,a){E(e).vertexAttrib4f(i>>>0,r,s,n,a)},__wbg_vertexAttribIPointer_ed1c3507e84527e2:function(e,i,r,s,n,a){E(e).vertexAttribIPointer(i>>>0,r,s>>>0,n,a)},__wbg_vertexAttribPointer_39eddea7c20e350c:function(e,i,r,s,n,a,o){E(e).vertexAttribPointer(i>>>0,r,s>>>0,n!==0,a,o)},__wbg_vertexAttribPointer_3bc50c0431082f73:function(e,i,r,s,n,a,o){E(e).vertexAttribPointer(i>>>0,r,s>>>0,n!==0,a,o)},__wbg_videoFrameToken_6f05524e85fa2b75:function(e){return gq(E(e))},__wbg_videoHeight_e267fd1e74bb1b06:function(e){return E(e).videoHeight},__wbg_videoWidth_670b8e775ea04b5d:function(e){return E(e).videoWidth},__wbg_viewport_14d947f2faf58e85:function(e,i,r,s,n){E(e).viewport(i,r,s,n)},__wbg_viewport_24055b0754803788:function(e,i,r,s,n){E(e).viewport(i,r,s,n)},__wbg_warn_410c3261e3c6d686:function(e){console.warn(E(e))},__wbg_width_f1791280fae1517a:function(e){return E(e).width},__wbg_writeTexture_53ba204c494b042c:function(){return De(function(e,i,r,s,n,a){E(e).writeTexture(E(i),Vc(r,s),E(n),E(a))},arguments)},__wbindgen_cast_0000000000000001:function(e,i){let r=rd(e,i,a2t);return $(r)},__wbindgen_cast_0000000000000002:function(e,i){let r=rd(e,i,s2t);return $(r)},__wbindgen_cast_0000000000000003:function(e,i){let r=rd(e,i,o2t);return $(r)},__wbindgen_cast_0000000000000004:function(e,i){let r=rd(e,i,l2t);return $(r)},__wbindgen_cast_0000000000000005:function(e,i){let r=rd(e,i,n2t);return $(r)},__wbindgen_cast_0000000000000006:function(e,i){let r=rd(e,i,h2t);return $(r)},__wbindgen_cast_0000000000000007:function(e,i){let r=rd(e,i,u2t);return $(r)},__wbindgen_cast_0000000000000008:function(e,i){let r=rd(e,i,d2t);return $(r)},__wbindgen_cast_0000000000000009:function(e,i){let r=rd(e,i,r2t);return $(r)},__wbindgen_cast_000000000000000a:function(e){return $(e)},__wbindgen_cast_000000000000000b:function(e,i){let r=Ho(e,i);return $(r)},__wbindgen_cast_000000000000000c:function(e,i){let r=B2t(e,i);return $(r)},__wbindgen_cast_000000000000000d:function(e,i){let r=Pq(e,i);return $(r)},__wbindgen_cast_000000000000000e:function(e,i){let r=V2t(e,i);return $(r)},__wbindgen_cast_000000000000000f:function(e,i){let r=k2t(e,i);return $(r)},__wbindgen_cast_0000000000000010:function(e,i){let r=db(e,i);return $(r)},__wbindgen_cast_0000000000000011:function(e,i){let r=Vc(e,i);return $(r)},__wbindgen_cast_0000000000000012:function(e,i){let r=hi(e,i);return $(r)},__wbindgen_cast_0000000000000013:function(e){let i=BigInt.asUintN(64,e);return $(i)},__wbindgen_cast_0000000000000014:function(e,i){var r=Vc(e,i).slice();return Y.__wbindgen_export4(e,i*1,1),$(r)},__wbindgen_object_clone_ref:function(e){let i=E(e);return $(i)},__wbindgen_object_drop_ref:function(e){Oe(e)}}}}function r2t(t,e){Y.__wasm_bindgen_func_elem_12552(t,e)}function s2t(t,e,i){Y.__wasm_bindgen_func_elem_5119(t,e,$(i))}function n2t(t,e,i){Y.__wasm_bindgen_func_elem_11146(t,e,$(i))}function a2t(t,e,i){try{let n=Y.__wbindgen_add_to_stack_pointer(-16);Y.__wasm_bindgen_func_elem_14189(n,t,e,$(i));var r=ze().getInt32(n+4*0,!0),s=ze().getInt32(n+4*1,!0);if(s)throw Oe(r)}finally{Y.__wbindgen_add_to_stack_pointer(16)}}function o2t(t,e,i){try{let n=Y.__wbindgen_add_to_stack_pointer(-16);Y.__wasm_bindgen_func_elem_11145(n,t,e,$(i));var r=ze().getInt32(n+4*0,!0),s=ze().getInt32(n+4*1,!0);if(s)throw Oe(r)}finally{Y.__wbindgen_add_to_stack_pointer(16)}}function l2t(t,e,i){try{let n=Y.__wbindgen_add_to_stack_pointer(-16);Y.__wasm_bindgen_func_elem_11145_3(n,t,e,$(i));var r=ze().getInt32(n+4*0,!0),s=ze().getInt32(n+4*1,!0);if(s)throw Oe(r)}finally{Y.__wbindgen_add_to_stack_pointer(16)}}function h2t(t,e,i){try{let n=Y.__wbindgen_add_to_stack_pointer(-16);Y.__wasm_bindgen_func_elem_11145_5(n,t,e,$(i));var r=ze().getInt32(n+4*0,!0),s=ze().getInt32(n+4*1,!0);if(s)throw Oe(r)}finally{Y.__wbindgen_add_to_stack_pointer(16)}}function u2t(t,e,i){try{let n=Y.__wbindgen_add_to_stack_pointer(-16);Y.__wasm_bindgen_func_elem_11145_6(n,t,e,$(i));var r=ze().getInt32(n+4*0,!0),s=ze().getInt32(n+4*1,!0);if(s)throw Oe(r)}finally{Y.__wbindgen_add_to_stack_pointer(16)}}function d2t(t,e,i){try{let n=Y.__wbindgen_add_to_stack_pointer(-16);Y.__wasm_bindgen_func_elem_11145_7(n,t,e,$(i));var r=ze().getInt32(n+4*0,!0),s=ze().getInt32(n+4*1,!0);if(s)throw Oe(r)}finally{Y.__wbindgen_add_to_stack_pointer(16)}}function xq(t,e,i,r){Y.__wasm_bindgen_func_elem_14191(t,e,$(i),$(r))}function $(t){xb===sh.length&&sh.push(sh.length+1);let e=xb;return xb=sh[e],sh[e]=t,e}function D2t(t){if(uT==1)throw new Error("out of js stack");return sh[--uT]=t,uT}function vN(t){let e=typeof t;if(e=="number"||e=="boolean"||t==null)return`${t}`;if(e=="string")return`"${t}"`;if(e=="symbol"){let s=t.description;return s==null?"Symbol":`Symbol(${s})`}if(e=="function"){let s=t.name;return typeof s=="string"&&s.length>0?`Function(${s})`:"Function"}if(Array.isArray(t)){let s=t.length,n="[";s>0&&(n+=vN(t[0]));for(let a=1;a<s;a++)n+=", "+vN(t[a]);return n+="]",n}let i=/\[object ([^\]]+)\]/.exec(toString.call(t)),r;if(i&&i.length>1)r=i[1];else return toString.call(t);if(r=="Object")try{return"Object("+JSON.stringify(t)+")"}catch{return"Object"}return t instanceof Error?`${t.name}: ${t.message}
36
36
  ${t.stack}`:r}function O2t(t){t<1028||(sh[t]=xb,xb=t)}function Ho(t,e){return t=t>>>0,z2t().subarray(t/4,t/4+e)}function I2t(t,e){return t=t>>>0,L2t().subarray(t/8,t/8+e)}function B2t(t,e){return t=t>>>0,F2t().subarray(t/2,t/2+e)}function Pq(t,e){return t=t>>>0,U2t().subarray(t/4,t/4+e)}function V2t(t,e){return t=t>>>0,j2t().subarray(t/1,t/1+e)}function ub(t,e){t=t>>>0;let i=ze(),r=[];for(let s=t;s<t+4*e;s+=4)r.push(Oe(i.getUint32(s,!0)));return r}function rh(t,e){t=t>>>0;let i=ze(),r=[];for(let s=t;s<t+4*e;s+=4)r.push(E(i.getUint32(s,!0)));return r}function k2t(t,e){return t=t>>>0,G2t().subarray(t/2,t/2+e)}function db(t,e){return t=t>>>0,W2t().subarray(t/4,t/4+e)}function Vc(t,e){return t=t>>>0,_b().subarray(t/1,t/1+e)}function ze(){return(Nm===null||Nm.buffer.detached===!0||Nm.buffer.detached===void 0&&Nm.buffer!==Y.memory.buffer)&&(Nm=new DataView(Y.memory.buffer)),Nm}function z2t(){return(cb===null||cb.byteLength===0)&&(cb=new Float32Array(Y.memory.buffer)),cb}function L2t(){return(pb===null||pb.byteLength===0)&&(pb=new Float64Array(Y.memory.buffer)),pb}function F2t(){return(mb===null||mb.byteLength===0)&&(mb=new Int16Array(Y.memory.buffer)),mb}function U2t(){return(fb===null||fb.byteLength===0)&&(fb=new Int32Array(Y.memory.buffer)),fb}function j2t(){return(gb===null||gb.byteLength===0)&&(gb=new Int8Array(Y.memory.buffer)),gb}function hi(t,e){return H2t(t>>>0,e)}function G2t(){return(yb===null||yb.byteLength===0)&&(yb=new Uint16Array(Y.memory.buffer)),yb}function W2t(){return(vb===null||vb.byteLength===0)&&(vb=new Uint32Array(Y.memory.buffer)),vb}function _b(){return(bb===null||bb.byteLength===0)&&(bb=new Uint8Array(Y.memory.buffer)),bb}function E(t){return sh[t]}function De(t,e){try{return t.apply(this,e)}catch(i){Y.__wbindgen_export3($(i))}}function Fe(t){return t==null}function rd(t,e,i){let r={a:t,b:e,cnt:1},s=(...n)=>{r.cnt++;let a=r.a;r.a=0;try{return i(a,r.b,...n)}finally{r.a=a,s._wbg_cb_unref()}};return s._wbg_cb_unref=()=>{--r.cnt===0&&(Y.__wbindgen_export5(r.a,r.b),r.a=0,Eq.unregister(r))},Eq.register(s,r,r),s}function Rq(t,e){let i=e(t.length*4,4)>>>0,r=ze();for(let s=0;s<t.length;s++)r.setUint32(i+4*s,$(t[s]),!0);return kr=t.length,i}function As(t,e,i){if(i===void 0){let o=wb.encode(t),l=e(o.length,1)>>>0;return _b().subarray(l,l+o.length).set(o),kr=o.length,l}let r=t.length,s=e(r,1)>>>0,n=_b(),a=0;for(;a<r;a++){let o=t.charCodeAt(a);if(o>127)break;n[s+a]=o}if(a!==r){a!==0&&(t=t.slice(a)),s=i(s,r,r=a+t.length*3,1)>>>0;let o=_b().subarray(s+a,s+r),l=wb.encodeInto(t,o);a+=l.written,s=i(s,r,a,1)>>>0}return kr=a,s}function Oe(t){let e=E(t);return O2t(t),e}function H2t(t,e){return yN+=e,yN>=q2t&&(dT=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),dT.decode(),yN=e),dT.decode(_b().subarray(t,t+e))}function Dq(t,e){return X2t=t,Y=t.exports,$2t=e,Nm=null,cb=null,pb=null,mb=null,fb=null,gb=null,yb=null,vb=null,bb=null,Y.__wbindgen_start(),Y}async function Y2t(t,e){if(typeof Response=="function"&&t instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(s){if(t.ok&&i(t.type)&&t.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",s);else throw s}let r=await t.arrayBuffer();return await WebAssembly.instantiate(r,e)}else{let r=await WebAssembly.instantiate(t,e);return r instanceof WebAssembly.Instance?{instance:r,module:t}:r}function i(r){switch(r){case"basic":case"cors":case"default":return!0}return!1}}function K2t(t){if(Y!==void 0)return Y;t!==void 0&&(Object.getPrototypeOf(t)===Object.prototype?{module:t}=t:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let e=Nq();t instanceof WebAssembly.Module||(t=new WebAssembly.Module(t));let i=new WebAssembly.Instance(t,e);return Dq(i,t)}async function Z2t(t){if(Y!==void 0)return Y;t!==void 0&&(Object.getPrototypeOf(t)===Object.prototype?{module_or_path:t}=t:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),t===void 0&&(t=new URL("hana-ui.wasm",import.meta.url));let e=Nq();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));let{instance:i,module:r}=await Y2t(await t,e);return Dq(i,r)}var kc,zc,sd,Sb,hN,wq,Sq,c2t,p2t,m2t,f2t,uN,g2t,y2t,v2t,Tq,b2t,dN,cN,_2t,x2t,w2t,S2t,T2t,pN,M2t,mN,fN,A2t,Rm,C2t,gN,E2t,P2t,R2t,Mq,Aq,Cq,N2t,Eq,Nm,cb,pb,mb,fb,gb,yb,vb,bb,sh,xb,uT,dT,q2t,yN,wb,kr,$2t,X2t,Y,Iq=nT(()=>{"use strict";_q();kc=class{static __wrap(e){let i=Object.create(kc.prototype);return i.__wbg_ptr=e,Mq.register(i,i.__wbg_ptr,i),i}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Mq.unregister(this),e}free(){let e=this.__destroy_into_raw();Y.__wbg_devicelostpromise_free(e,0)}wait(){let e=this.__destroy_into_raw(),i=Y.devicelostpromise_wait(e);return Oe(i)}};Symbol.dispose&&(kc.prototype[Symbol.dispose]=kc.prototype.free);zc=class{static __wrap(e){let i=Object.create(zc.prototype);return i.__wbg_ptr=e,Aq.register(i,i.__wbg_ptr,i),i}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Aq.unregister(this),e}free(){let e=this.__destroy_into_raw();Y.__wbg_engine_free(e,0)}static create(e,i,r){let s=Y.engine_create($(e),$(i),r);return Oe(s)}getDeviceLostPromise(){let e=Y.engine_getDeviceLostPromise(this.__wbg_ptr);return e===0?void 0:kc.__wrap(e)}getGpuFrameTimeMs(){try{let r=Y.__wbindgen_add_to_stack_pointer(-16);Y.engine_getGpuFrameTimeMs(r,this.__wbg_ptr);var e=ze().getInt32(r+4*0,!0),i=ze().getFloat64(r+8*1,!0);return e===0?void 0:i}finally{Y.__wbindgen_add_to_stack_pointer(16)}}isWebgpu(){return Y.engine_isWebgpu(this.__wbg_ptr)!==0}onFrame(e){Y.engine_onFrame(this.__wbg_ptr,!Fe(e),Fe(e)?0:e)}removeTexture(e){Y.engine_removeTexture(this.__wbg_ptr,$(e))}renderRegion(e,i,r){let s=Y.engine_renderRegion(this.__wbg_ptr,$(e),$(i),r);return sd.__wrap(s)}reset(e){Y.engine_reset(this.__wbg_ptr,$(e))}resize(e,i){Y.engine_resize(this.__wbg_ptr,$(e),i)}samplePixels(e,i){let r=Y.engine_samplePixels(this.__wbg_ptr,$(e),$(i));return sd.__wrap(r)}};Symbol.dispose&&(zc.prototype[Symbol.dispose]=zc.prototype.free);sd=class{static __wrap(e){let i=Object.create(sd.prototype);return i.__wbg_ptr=e,Cq.register(i,i.__wbg_ptr,i),i}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Cq.unregister(this),e}free(){let e=this.__destroy_into_raw();Y.__wbg_pixelreadpromise_free(e,0)}wait(){let e=this.__destroy_into_raw(),i=Y.pixelreadpromise_wait(e);return Oe(i)}};Symbol.dispose&&(sd.prototype[Symbol.dispose]=sd.prototype.free);Sb=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,N2t.unregister(this),e}free(){let e=this.__destroy_into_raw();Y.__wbg_scenecontroller_free(e,0)}get is_play_mode(){return Y.__wbg_get_scenecontroller_is_play_mode(this.__wbg_ptr)!==0}get needs_video_update(){return Y.__wbg_get_scenecontroller_needs_video_update(this.__wbg_ptr)!==0}get show_pixel_grid(){return Y.__wbg_get_scenecontroller_show_pixel_grid(this.__wbg_ptr)!==0}addEmojiArt(e,i){let r=As(e,Y.__wbindgen_export,Y.__wbindgen_export2),s=kr;Y.scenecontroller_addEmojiArt(this.__wbg_ptr,r,s,$(i))}addImage(e,i){Y.scenecontroller_addImage(this.__wbg_ptr,$(e),$(i))}addLocalFont(e,i,r,s,n){var a=Fe(r)?0:As(r,Y.__wbindgen_export,Y.__wbindgen_export2),o=kr,l=Fe(s)?0:As(s,Y.__wbindgen_export,Y.__wbindgen_export2),u=kr,h=Fe(n)?0:As(n,Y.__wbindgen_export,Y.__wbindgen_export2),d=kr;Y.scenecontroller_addLocalFont(this.__wbg_ptr,$(e),$(i),a,o,l,u,h,d)}addModel3DGeometry(e,i){Y.scenecontroller_addModel3DGeometry(this.__wbg_ptr,$(e),$(i))}addVideo(e,i){Y.scenecontroller_addVideo(this.__wbg_ptr,$(e),$(i))}addWebFont(e,i){let r=As(i,Y.__wbindgen_export,Y.__wbindgen_export2),s=kr,n=Y.scenecontroller_addWebFont(this.__wbg_ptr,$(e),r,s);return Oe(n)}applyDeltaToVectorVertexPositionSelection(e,i,r){let s=Y.scenecontroller_applyDeltaToVectorVertexPositionSelection(this.__wbg_ptr,$(e),$(i),$(r));return Oe(s)}axisAlignedBoundingBox(e){let i=Y.scenecontroller_axisAlignedBoundingBox(this.__wbg_ptr,$(e));return Oe(i)}boundingBox(){let e=Y.scenecontroller_boundingBox(this.__wbg_ptr);return Oe(e)}boxIntersectsObjects(e,i,r,s,n){try{let u=Y.__wbindgen_add_to_stack_pointer(-16);Y.scenecontroller_boxIntersectsObjects(u,this.__wbg_ptr,$(e),$(i),r,s,Fe(n)?0:$(n));var a=ze().getInt32(u+4*0,!0),o=ze().getInt32(u+4*1,!0),l=ub(a,o).slice();return Y.__wbindgen_export4(a,o*4,4),l}finally{Y.__wbindgen_add_to_stack_pointer(16)}}calcTextAutoSize(e,i){let r=Y.scenecontroller_calcTextAutoSize(this.__wbg_ptr,$(e),Fe(i)?Number.MAX_SAFE_INTEGER:Math.fround(i));return Oe(r)}centerPencilData(e){let i=Y.scenecontroller_centerPencilData(this.__wbg_ptr,$(e));return Oe(i)}centerVectorData(){let e=Y.scenecontroller_centerVectorData(this.__wbg_ptr);return Oe(e)}clearVideoExportFrame(e){Y.scenecontroller_clearVideoExportFrame(this.__wbg_ptr,$(e))}clearVideoExportFrames(){Y.scenecontroller_clearVideoExportFrames(this.__wbg_ptr)}figmaVectorToVecNet(e,i){let r=Y.scenecontroller_figmaVectorToVecNet(this.__wbg_ptr,$(e),$(i));return Oe(r)}flattenShape(e){let i=Y.scenecontroller_flattenShape(this.__wbg_ptr,$(e));return Oe(i)}flushLayout(e){try{let n=Y.__wbindgen_add_to_stack_pointer(-16);Y.scenecontroller_flushLayout(n,this.__wbg_ptr,$(e));var i=ze().getInt32(n+4*0,!0),r=ze().getInt32(n+4*1,!0),s=ub(i,r).slice();return Y.__wbindgen_export4(i,r*4,4),s}finally{Y.__wbindgen_add_to_stack_pointer(16)}}getCurrentFrameIndex(){let e=Y.scenecontroller_getCurrentFrameIndex(this.__wbg_ptr);return e===Number.MAX_SAFE_INTEGER?void 0:e}getTotalFramesAmount(){return Y.scenecontroller_getTotalFramesAmount(this.__wbg_ptr)>>>0}getUpdatedPencilData(){let e=Y.scenecontroller_getUpdatedPencilData(this.__wbg_ptr);return Oe(e)}getUpdatedVecNetData(){let e=Y.scenecontroller_getUpdatedVecNetData(this.__wbg_ptr);return Oe(e)}getVectorBoxSelectionBoundsAndLocalMatrix(e){let i=Y.scenecontroller_getVectorBoxSelectionBoundsAndLocalMatrix(this.__wbg_ptr,e);return Oe(i)}getVectorCursor(){let e=Y.scenecontroller_getVectorCursor(this.__wbg_ptr);return Oe(e)}getVectorEditMode(){let e=Y.scenecontroller_getVectorEditMode(this.__wbg_ptr);return Oe(e)}getVectorEditingState(){let e=Y.scenecontroller_getVectorEditingState(this.__wbg_ptr);return Oe(e)}getVectorSelectedVerts(){let e=Y.scenecontroller_getVectorSelectedVerts(this.__wbg_ptr);return Oe(e)}getVectorSelectionCount(){return Y.scenecontroller_getVectorSelectionCount(this.__wbg_ptr)>>>0}hasFontAssetsChanges(){return Y.scenecontroller_hasFontAssetsChanges(this.__wbg_ptr)!==0}hasSingleVectorSelectedSegment(){return Y.scenecontroller_hasSingleVectorSelectedSegment(this.__wbg_ptr)!==0}instanceRootOf(e){let i=Y.scenecontroller_instanceRootOf(this.__wbg_ptr,$(e));return Oe(i)}intersectsObject(e,i,r,s){return Y.scenecontroller_intersectsObject(this.__wbg_ptr,$(e),$(i),Fe(r)?Number.MAX_SAFE_INTEGER:Math.fround(r),Fe(s)?16777215:s?1:0)!==0}intersectsObjects(e,i,r){try{let o=Y.__wbindgen_add_to_stack_pointer(-16);Y.scenecontroller_intersectsObjects(o,this.__wbg_ptr,$(e),Fe(i)?16777215:i?1:0,Fe(r)?Number.MAX_SAFE_INTEGER:Math.fround(r));var s=ze().getInt32(o+4*0,!0),n=ze().getInt32(o+4*1,!0),a=ub(s,n).slice();return Y.__wbindgen_export4(s,n*4,4),a}finally{Y.__wbindgen_add_to_stack_pointer(16)}}isEditedVectorEmpty(){return Y.scenecontroller_isEditedVectorEmpty(this.__wbg_ptr)!==0}isObjectInViewport(e){return Y.scenecontroller_isObjectInViewport(this.__wbg_ptr,$(e))!==0}isUiFontLoaded(){return Y.scenecontroller_isUiFontLoaded(this.__wbg_ptr)!==0}isVectorBoxSelectAllowed(){return Y.scenecontroller_isVectorBoxSelectAllowed(this.__wbg_ptr)!==0}isVectorPointUnderCursor(e){return Y.scenecontroller_isVectorPointUnderCursor(this.__wbg_ptr,$(e))!==0}layout(){Y.scenecontroller_layout(this.__wbg_ptr)}layoutFromResize(){try{let s=Y.__wbindgen_add_to_stack_pointer(-16);Y.scenecontroller_layoutFromResize(s,this.__wbg_ptr);var e=ze().getInt32(s+4*0,!0),i=ze().getInt32(s+4*1,!0),r=ub(e,i).slice();return Y.__wbindgen_export4(e,i*4,4),r}finally{Y.__wbindgen_add_to_stack_pointer(16)}}markNeedsLayoutResolve(e){Y.scenecontroller_markNeedsLayoutResolve(this.__wbg_ptr,$(e))}measureTextNaturalSize(e){let i=Y.scenecontroller_measureTextNaturalSize(this.__wbg_ptr,$(e));return Oe(i)}model3DAnimationClipIndex(e){let i=Y.scenecontroller_model3DAnimationClipIndex(this.__wbg_ptr,$(e));return i===Number.MAX_SAFE_INTEGER?void 0:i}model3DAnimationIsPlaying(e){return Y.scenecontroller_model3DAnimationIsPlaying(this.__wbg_ptr,$(e))!==0}model3DAnimationLocalTime(e){let i=Y.scenecontroller_model3DAnimationLocalTime(this.__wbg_ptr,$(e));return i===Number.MAX_SAFE_INTEGER?void 0:i}moveVectorSelectionByDelta(e){Y.scenecontroller_moveVectorSelectionByDelta(this.__wbg_ptr,$(e))}objectAlignedBoundingBox(e){let i=Y.scenecontroller_objectAlignedBoundingBox(this.__wbg_ptr,$(e));return Oe(i)}objectData(e){let i=Y.scenecontroller_objectData(this.__wbg_ptr,$(e));return Oe(i)}objectLocalMatrix(e){let i=Y.scenecontroller_objectLocalMatrix(this.__wbg_ptr,$(e));return Oe(i)}objectWorldMatrix(e){let i=Y.scenecontroller_objectWorldMatrix(this.__wbg_ptr,$(e));return Oe(i)}objectWorldMatrixWithChildrenOffset(e){let i=Y.scenecontroller_objectWorldMatrixWithChildrenOffset(this.__wbg_ptr,$(e));return Oe(i)}onKeyDown(e){let i=As(e,Y.__wbindgen_export,Y.__wbindgen_export2),r=kr;Y.scenecontroller_onKeyDown(this.__wbg_ptr,i,r)}onKeyUp(e){let i=As(e,Y.__wbindgen_export,Y.__wbindgen_export2),r=kr;Y.scenecontroller_onKeyUp(this.__wbg_ptr,i,r)}onPointerDown(e,i,r){Y.scenecontroller_onPointerDown(this.__wbg_ptr,$(e),i,r)}onPointerEnter(){Y.scenecontroller_onPointerEnter(this.__wbg_ptr)}onPointerLeave(){Y.scenecontroller_onPointerLeave(this.__wbg_ptr)}onPointerMove(e,i,r){Y.scenecontroller_onPointerMove(this.__wbg_ptr,$(e),i,r)}onPointerUp(e,i,r){Y.scenecontroller_onPointerUp(this.__wbg_ptr,$(e),i,r)}outermostInstanceRootOf(e){let i=Y.scenecontroller_outermostInstanceRootOf(this.__wbg_ptr,$(e));return Oe(i)}parentAlignedBoundingBox(e,i){let r=Y.scenecontroller_parentAlignedBoundingBox(this.__wbg_ptr,$(e),$(i));return Oe(r)}parseSvgPath(e,i){let r=As(e,Y.__wbindgen_export,Y.__wbindgen_export2),s=kr,n=Y.scenecontroller_parseSvgPath(this.__wbg_ptr,r,s,i);return Oe(n)}pencilShiftDown(){Y.scenecontroller_pencilShiftDown(this.__wbg_ptr)}pencilShiftUp(){Y.scenecontroller_pencilShiftUp(this.__wbg_ptr)}pendingAssetLoads(){return Y.scenecontroller_pendingAssetLoads(this.__wbg_ptr)>>>0}playInEditorFrame(e){Y.scenecontroller_playInEditorFrame(this.__wbg_ptr,$(e))}present(e,i){Y.scenecontroller_present(this.__wbg_ptr,Fe(e)?0:$(e),Fe(i)?16777215:i?1:0)}previewTransition(e,i,r){Y.scenecontroller_previewTransition(this.__wbg_ptr,$(e),Fe(i)?0:$(i),$(r))}projectionEffectBoundingBox(e){let i=Y.scenecontroller_projectionEffectBoundingBox(this.__wbg_ptr,$(e));return Oe(i)}readVectorCornerRadiiForSelection(e,i){let r=Y.scenecontroller_readVectorCornerRadiiForSelection(this.__wbg_ptr,$(e),$(i));return Oe(r)}readVectorCornerSmoothing(e){return Y.scenecontroller_readVectorCornerSmoothing(this.__wbg_ptr,$(e))}readVectorVertexPositionsForSelection(e,i){let r=Y.scenecontroller_readVectorVertexPositionsForSelection(this.__wbg_ptr,$(e),$(i));return Oe(r)}reanchorObject(e){Y.scenecontroller_reanchorObject(this.__wbg_ptr,$(e))}resetAllStates(e,i){let r=Rq(i,Y.__wbindgen_export),s=kr;Y.scenecontroller_resetAllStates(this.__wbg_ptr,Fe(e)?0:$(e),r,s)}resizeGroup(e,i,r){try{let o=Y.__wbindgen_add_to_stack_pointer(-16);Y.scenecontroller_resizeGroup(o,this.__wbg_ptr,$(e),i,r);var s=ze().getInt32(o+4*0,!0),n=ze().getInt32(o+4*1,!0),a=ub(s,n).slice();return Y.__wbindgen_export4(s,n*4,4),a}finally{Y.__wbindgen_add_to_stack_pointer(16)}}saveVectorSelectionInitialPositions(){Y.scenecontroller_saveVectorSelectionInitialPositions(this.__wbg_ptr)}screenToWorld(e){let i=Y.scenecontroller_screenToWorld(this.__wbg_ptr,$(e));return Oe(i)}seekVideos(e){let i=Y.scenecontroller_seekVideos(this.__wbg_ptr,e);return Oe(i)}setBytesForVectorCornerRadiusSelection(e,i,r){let s=Y.scenecontroller_setBytesForVectorCornerRadiusSelection(this.__wbg_ptr,$(e),$(i),r);return Oe(s)}setBytesForVectorCornerSmoothing(e,i){let r=Y.scenecontroller_setBytesForVectorCornerSmoothing(this.__wbg_ptr,$(e),i);return Oe(r)}setBytesForVectorVertexPositionSelection(e,i,r,s){let n=Y.scenecontroller_setBytesForVectorVertexPositionSelection(this.__wbg_ptr,$(e),$(i),r,s);return Oe(n)}setModel3DAnimation(e,i,r){Y.scenecontroller_setModel3DAnimation(this.__wbg_ptr,$(e),Fe(i)?Number.MAX_SAFE_INTEGER:i>>>0,r)}setModel3DAnimationLocalTime(e,i){Y.scenecontroller_setModel3DAnimationLocalTime(this.__wbg_ptr,$(e),i)}setPresentationPadding(e){Y.scenecontroller_setPresentationPadding(this.__wbg_ptr,$(e))}setShowPixelGrid(e){Y.scenecontroller_setShowPixelGrid(this.__wbg_ptr,e)}setVectorEditingState(e){try{Y.scenecontroller_setVectorEditingState(this.__wbg_ptr,D2t(e))}finally{sh[uT++]=void 0}}setVectorTool(e){Y.scenecontroller_setVectorTool(this.__wbg_ptr,$(e))}setVideoExportFrame(e,i){Y.scenecontroller_setVideoExportFrame(this.__wbg_ptr,$(e),$(i))}snapVectorResizeHandle(e,i,r){let s=Y.scenecontroller_snapVectorResizeHandle(this.__wbg_ptr,$(e),i,r);return Oe(s)}start(){Y.scenecontroller_start(this.__wbg_ptr)}startPencil(e,i,r){Y.scenecontroller_startPencil(this.__wbg_ptr,$(e),i,$(r))}startVectorEditing(e,i){Y.scenecontroller_startVectorEditing(this.__wbg_ptr,$(e),i)}stopInEditorFrame(){Y.scenecontroller_stopInEditorFrame(this.__wbg_ptr)}stopPencil(){Y.scenecontroller_stopPencil(this.__wbg_ptr)}stopPresenting(){Y.scenecontroller_stopPresenting(this.__wbg_ptr)}stopPreviewTransition(){Y.scenecontroller_stopPreviewTransition(this.__wbg_ptr)}stopVectorEditing(){Y.scenecontroller_stopVectorEditing(this.__wbg_ptr)}strokeShape(e){let i=Y.scenecontroller_strokeShape(this.__wbg_ptr,$(e));return Oe(i)}switchScene(e){Y.scenecontroller_switchScene(this.__wbg_ptr,$(e))}transformBoundingBoxByAlignObject(e,i,r,s){let n=Y.scenecontroller_transformBoundingBoxByAlignObject(this.__wbg_ptr,$(e),$(i),$(r),$(s));return Oe(n)}transformVectorSelection(e,i,r,s){return Y.scenecontroller_transformVectorSelection(this.__wbg_ptr,$(e),$(i),r,s)!==0}triggerEventForObjectIds(e){let i=Rq(e,Y.__wbindgen_export),r=kr;Y.scenecontroller_triggerEventForObjectIds(this.__wbg_ptr,i,r)}updateByOp(e){Y.scenecontroller_updateByOp(this.__wbg_ptr,$(e))}updateCached(){Y.scenecontroller_updateCached(this.__wbg_ptr)}updateCamera(e){Y.scenecontroller_updateCamera(this.__wbg_ptr,$(e))}updateComponents(e){Y.scenecontroller_updateComponents(this.__wbg_ptr,$(e))}updatePublish(e){Y.scenecontroller_updatePublish(this.__wbg_ptr,$(e))}updateSceneOp(e){Y.scenecontroller_updateSceneOp(this.__wbg_ptr,$(e))}updateUiShapes(e){Y.scenecontroller_updateUiShapes(this.__wbg_ptr,$(e))}vectorAllowMultiSelect(e){Y.scenecontroller_vectorAllowMultiSelect(this.__wbg_ptr,e)}vectorBoxSelect(e,i){Y.scenecontroller_vectorBoxSelect(this.__wbg_ptr,$(e),$(i))}vectorClearSnapping(){Y.scenecontroller_vectorClearSnapping(this.__wbg_ptr)}vectorDeleteSelection(e){Y.scenecontroller_vectorDeleteSelection(this.__wbg_ptr,e)}vectorResize(e,i){let r=Y.scenecontroller_vectorResize(this.__wbg_ptr,$(e),$(i));return Oe(r)}vectorResizeWithCornerRadii(e,i,r){let s=Y.scenecontroller_vectorResizeWithCornerRadii(this.__wbg_ptr,$(e),$(i),r);return Oe(s)}vectorSetIsAltPressed(e){Y.scenecontroller_vectorSetIsAltPressed(this.__wbg_ptr,e)}vectorSetIsSnapping(e){Y.scenecontroller_vectorSetIsSnapping(this.__wbg_ptr,e)}vectorSetIsSnappingControlAngles(e){Y.scenecontroller_vectorSetIsSnappingControlAngles(this.__wbg_ptr,e)}vectorStopContinueSubpath(){Y.scenecontroller_vectorStopContinueSubpath(this.__wbg_ptr)}videoFillSources(e){let i=Y.scenecontroller_videoFillSources(this.__wbg_ptr,$(e));return Oe(i)}worldToScreen(e){let i=Y.scenecontroller_worldToScreen(this.__wbg_ptr,$(e));return Oe(i)}set is_play_mode(e){Y.__wbg_set_scenecontroller_is_play_mode(this.__wbg_ptr,e)}set needs_video_update(e){Y.__wbg_set_scenecontroller_needs_video_update(this.__wbg_ptr,e)}set show_pixel_grid(e){Y.__wbg_set_scenecontroller_show_pixel_grid(this.__wbg_ptr,e)}};Symbol.dispose&&(Sb.prototype[Symbol.dispose]=Sb.prototype.free);hN=["clamp-to-edge","repeat","mirror-repeat"],wq=["auto"],Sq=["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"],c2t=["add","subtract","reverse-subtract","min","max"],p2t=["uniform","storage","read-only-storage"],m2t=["opaque","premultiplied"],f2t=["standard","extended"],uN=["never","less","equal","less-equal","greater","not-equal","greater-equal","always"],g2t=["none","front","back"],y2t=["unknown","destroyed"],v2t=["validation","out-of-memory","internal"],Tq=["nearest","linear"],b2t=["ccw","cw"],dN=["uint16","uint32"],cN=["load","clear"],_2t=["nearest","linear"],x2t=["low-power","high-performance"],w2t=["point-list","line-list","line-strip","triangle-list","triangle-strip"],S2t=["occlusion","timestamp"],T2t=["filtering","non-filtering","comparison"],pN=["keep","zero","replace","invert","increment-clamp","decrement-clamp","increment-wrap","decrement-wrap"],M2t=["write-only","read-only","read-write"],mN=["store","discard"],fN=["all","stencil-only","depth-only"],A2t=["1d","2d","3d"],Rm=["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"],C2t=["float","unfilterable-float","depth","sint","uint"],gN=["1d","2d","2d-array","cube","cube-array","3d"],E2t=["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"],P2t=["vertex","instance"],R2t=["same-origin","no-cors","cors","navigate"],Mq=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Y.__wbg_devicelostpromise_free(t,1)),Aq=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Y.__wbg_engine_free(t,1)),Cq=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Y.__wbg_pixelreadpromise_free(t,1)),N2t=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Y.__wbg_scenecontroller_free(t,1));Eq=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Y.__wbindgen_export5(t.a,t.b));Nm=null;cb=null;pb=null;mb=null;fb=null;gb=null;yb=null;vb=null;bb=null;sh=new Array(1024).fill(void 0);sh.push(void 0,null,!0,!1);xb=sh.length;uT=1024;dT=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});dT.decode();q2t=2146435072,yN=0;wb=new TextEncoder;"encodeInto"in wb||(wb.encodeInto=function(t,e){let i=wb.encode(t);return e.set(i),{read:t.length,written:i.length}});kr=0});var Q2t=Object.create,uR=Object.defineProperty,J2t=Object.getOwnPropertyDescriptor,tSt=Object.getOwnPropertyNames,eSt=Object.getPrototypeOf,iSt=Object.prototype.hasOwnProperty,W=(t,e)=>()=>(t&&(e=t(t=0)),e),Wv=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),DS=(t,e)=>{for(var i in e)uR(t,i,{get:e[i],enumerable:!0})},qv=(t,e,i)=>(i=t!=null?Q2t(eSt(t)):{},((r,s,n,a)=>{if(s&&typeof s=="object"||typeof s=="function")for(let o of tSt(s))!iSt.call(r,o)&&o!==void 0&&uR(r,o,{get:()=>s[o],enumerable:!(a=J2t(s,o))||a.enumerable});return r})(!e&&t&&t.__esModule?i:uR(i,"default",{value:t,enumerable:!0}),t)),cc=(t,e,i)=>(((r,s,n)=>{s in r?uR(r,s,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[s]=n})(t,typeof e!="symbol"?e+"":e,i),i);function cT(t,e){return new Uct[t](e)}function _F(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function WE(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function xF(...t){let e="THREE."+t.shift();$g?$g("log",e,...t):console.log(e,...t)}function gdt(t){let e=t[0];if(typeof e=="string"&&e.startsWith("TSL:")){let i=t[1];i&&i.isStackTrace?t[0]+=" "+i.getLocation():t[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return t}function ae(...t){let e="THREE."+(t=gdt(t)).shift();if($g)$g("warn",e,...t);else{let i=t[0];i&&i.isStackTrace?console.warn(i.getError(e)):console.warn(e,...t)}}function Kt(...t){let e="THREE."+(t=gdt(t)).shift();if($g)$g("error",e,...t);else{let i=t[0];i&&i.isStackTrace?console.error(i.getError(e)):console.error(e,...t)}}function Zi(...t){let e=t.join(" ");e in OF||(OF[e]=!0,ae(...t))}function Ml(){let t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,i=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return(ba[255&t]+ba[t>>8&255]+ba[t>>16&255]+ba[t>>24&255]+"-"+ba[255&e]+ba[e>>8&255]+"-"+ba[e>>16&15|64]+ba[e>>24&255]+"-"+ba[63&i|128]+ba[i>>8&255]+"-"+ba[i>>16&255]+ba[i>>24&255]+ba[255&r]+ba[r>>8&255]+ba[r>>16&255]+ba[r>>24&255]).toLowerCase()}function ei(t,e,i){return Math.max(e,Math.min(i,t))}function wF(t,e){return(t%e+e)%e}function rSt(t,e,i,r,s){return r+(t-e)*(s-r)/(i-e)}function sSt(t,e,i){return t!==e?(i-t)/(e-t):0}function xw(t,e,i){return(1-i)*t+i*e}function nSt(t,e,i,r){return xw(t,e,1-Math.exp(-i*r))}function aSt(t,e=1){return e-Math.abs(wF(t,2*e)-e)}function oSt(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*(3-2*t)}function lSt(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*t*(t*(6*t-15)+10)}function hSt(t,e){return t+Math.floor(Math.random()*(e-t+1))}function uSt(t,e){return t+Math.random()*(e-t)}function dSt(t){return t*(.5-Math.random())}function cSt(t){t!==void 0&&(IF=t);let e=IF+=1831565813;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}function pSt(t){return t*y1}function mSt(t){return t*v1}function fSt(t){return!(t&t-1)&&t!==0}function gSt(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function ySt(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function vSt(t,e,i,r,s){let n=Math.cos,a=Math.sin,o=n(i/2),l=a(i/2),u=n((e+r)/2),h=a((e+r)/2),d=n((e-r)/2),c=a((e-r)/2),p=n((r-e)/2),m=a((r-e)/2);switch(s){case"XYX":t.set(o*h,l*d,l*c,o*u);break;case"YZY":t.set(l*c,o*h,l*d,o*u);break;case"ZXZ":t.set(l*d,l*c,o*h,o*u);break;case"XZX":t.set(o*h,l*m,l*p,o*u);break;case"YXY":t.set(l*p,o*h,l*m,o*u);break;case"ZYZ":t.set(l*m,l*p,o*h,o*u);break;default:ae("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}}function so(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function yi(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function nd(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function y0(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}function bN(t){return typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap?Gct.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(ae("Texture: Unable to serialize Texture."),{})}function _N(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}function xN(t,e,i,r,s){for(let n=0,a=t.length-3;n<=a;n+=3){Ep.fromArray(t,n);let o=s.x*Math.abs(Ep.x)+s.y*Math.abs(Ep.y)+s.z*Math.abs(Ep.z),l=e.dot(Ep),u=i.dot(Ep),h=r.dot(Ep);if(Math.max(-Math.max(l,u,h),Math.min(l,u,h))>o)return!1}return!0}function _o(t){Math.abs(t)>65504&&ae("DataUtils.toHalfFloat(): Value out of range."),t=ei(t,-65504,65504),Fu.floatView[0]=t;let e=Fu.uint32View[0],i=e>>23&511;return Fu.baseTable[i]+((8388607&e)>>Fu.shiftTable[i])}function Tb(t){let e=t>>10;return Fu.uint32View[0]=Fu.mantissaTable[Fu.offsetTable[e]+(1023&t)]+Fu.exponentTable[e],Fu.floatView[0]}function pT(t,e,i,r,s,n){Qf.subVectors(t,i).addScalar(.5).multiply(r),s!==void 0?(b1.x=n*Qf.x-s*Qf.y,b1.y=s*Qf.x+n*Qf.y):b1.copy(Qf),t.copy(e),t.x+=b1.x,t.y+=b1.y,t.applyMatrix4(LF)}function mT(t,e,i,r,s,n,a,o,l,u){t.getVertexPosition(o,Aw),t.getVertexPosition(l,Cw),t.getVertexPosition(u,Ew);let h=function(d,c,p,m,f,g,y,v){let b;if(b=c.side===$a?m.intersectTriangle(y,g,f,!0,v):m.intersectTriangle(f,g,y,c.side===Hh,v),b===null)return null;Pw.copy(v),Pw.applyMatrix4(d.matrixWorld);let _=p.ray.origin.distanceTo(Pw);return _<p.near||_>p.far?null:{distance:_,point:Pw.clone(),object:d}}(t,e,i,r,Aw,Cw,Ew,UF);if(h){let d=new P;Os.getBarycoord(UF,Aw,Cw,Ew,d),s&&(h.uv=Os.getInterpolatedAttribute(s,o,l,u,d,new Z)),n&&(h.uv1=Os.getInterpolatedAttribute(n,o,l,u,d,new Z)),a&&(h.normal=Os.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};Os.getNormal(Aw,Cw,Ew,c.normal),h.face=c,h.barycoord=d}return h}function fT(t,e,i,r,s,n,a){let o=t.geometry.attributes.position;if(C2.fromBufferAttribute(o,s),E2.fromBufferAttribute(o,n),i.distanceSqToSegment(C2,E2,iP,WF)>r)return;iP.applyMatrix4(t.matrixWorld);let l=e.ray.origin.distanceTo(iP);return l<e.near||l>e.far?void 0:{distance:l,point:WF.clone().applyMatrix4(t.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:t}}function wN(){let t=0,e=0,i=0,r=0;function s(n,a,o,l){t=n,e=o,i=-3*n+3*a-2*o-l,r=2*n-2*a+o+l}return{initCatmullRom:function(n,a,o,l,u){s(a,o,u*(o-n),u*(l-a))},initNonuniformCatmullRom:function(n,a,o,l,u,h,d){let c=(a-n)/u-(o-n)/(u+h)+(o-a)/h,p=(o-a)/h-(l-a)/(h+d)+(l-o)/d;c*=h,p*=h,s(a,o,c,p)},calc:function(n){let a=n*n;return t+e*n+i*a+r*(a*n)}}}function Bq(t,e,i,r,s){let n=.5*(r-e),a=.5*(s-i),o=t*t;return(2*i-2*r+n+a)*(t*o)+(-3*i+3*r-2*n-a)*o+n*t+i}function Mb(t,e,i,r){return function(s,n){let a=1-s;return a*a*n}(t,e)+function(s,n){return 2*(1-s)*s*n}(t,i)+function(s,n){return s*s*n}(t,r)}function Ab(t,e,i,r,s){return function(n,a){let o=1-n;return o*o*o*a}(t,e)+function(n,a){let o=1-n;return 3*o*o*n*a}(t,i)+function(n,a){return 3*(1-n)*n*n*a}(t,r)+function(n,a){return n*n*n*a}(t,s)}function Vq(t,e,i,r,s){let n;if(s===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}(t,e,i,r)>0)for(let a=e;a<i;a+=r)n=kq(a/r|0,t[a],t[a+1],n);else for(let a=i-r;a>=e;a-=r)n=kq(a/r|0,t[a],t[a+1],n);return n&&Ev(n,n.next)&&(nS(n),n=n.next),n}function Hg(t,e){if(!t)return t;e||(e=t);let i,r=t;do if(i=!1,r.steiner||!Ev(r,r.next)&&Ts(r.prev,r,r.next)!==0)r=r.next;else{if(nS(r),r=e=r.prev,r===r.next)break;i=!0}while(i||r!==e);return e}function rS(t,e,i,r,s,n,a){if(!t)return;!a&&n&&function(l,u,h,d){let c=l;do c.z===0&&(c.z=SF(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 m,f=1;do{let g,y=p;p=null;let v=null;for(m=0;y;){m++;let b=y,_=0;for(let S=0;S<f&&(_++,b=b.nextZ,b);S++);let x=f;for(;_>0||x>0&&b;)_!==0&&(x===0||!b||y.z<=b.z)?(g=y,y=y.nextZ,_--):(g=b,b=b.nextZ,x--),v?v.nextZ=g:p=g,g.prevZ=v,v=g;y=b}v.nextZ=null,f*=2}while(m>1)}(c)}(t,r,s,n);let o=t;for(;t.prev!==t.next;){let l=t.prev,u=t.next;if(n?_St(t,r,s,n):bSt(t))e.push(l.i,t.i,u.i),nS(t),t=u.next,o=u.next;else if((t=u)===o){a?a===1?rS(t=xSt(Hg(t),e),e,i,r,s,n,2):a===2&&wSt(t,e,i,r,s,n):rS(Hg(t),e,i,r,s,n,1);break}}}function bSt(t){let e=t.prev,i=t,r=t.next;if(Ts(e,i,r)>=0)return!1;let s=e.x,n=i.x,a=r.x,o=e.y,l=i.y,u=r.y,h=Math.min(s,n,a),d=Math.min(o,l,u),c=Math.max(s,n,a),p=Math.max(o,l,u),m=r.next;for(;m!==e;){if(m.x>=h&&m.x<=c&&m.y>=d&&m.y<=p&&ww(s,o,n,l,a,u,m.x,m.y)&&Ts(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function _St(t,e,i,r){let s=t.prev,n=t,a=t.next;if(Ts(s,n,a)>=0)return!1;let o=s.x,l=n.x,u=a.x,h=s.y,d=n.y,c=a.y,p=Math.min(o,l,u),m=Math.min(h,d,c),f=Math.max(o,l,u),g=Math.max(h,d,c),y=SF(p,m,e,i,r),v=SF(f,g,e,i,r),b=t.prevZ,_=t.nextZ;for(;b&&b.z>=y&&_&&_.z<=v;){if(b.x>=p&&b.x<=f&&b.y>=m&&b.y<=g&&b!==s&&b!==a&&ww(o,h,l,d,u,c,b.x,b.y)&&Ts(b.prev,b,b.next)>=0||(b=b.prevZ,_.x>=p&&_.x<=f&&_.y>=m&&_.y<=g&&_!==s&&_!==a&&ww(o,h,l,d,u,c,_.x,_.y)&&Ts(_.prev,_,_.next)>=0))return!1;_=_.nextZ}for(;b&&b.z>=y;){if(b.x>=p&&b.x<=f&&b.y>=m&&b.y<=g&&b!==s&&b!==a&&ww(o,h,l,d,u,c,b.x,b.y)&&Ts(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;_&&_.z<=v;){if(_.x>=p&&_.x<=f&&_.y>=m&&_.y<=g&&_!==s&&_!==a&&ww(o,h,l,d,u,c,_.x,_.y)&&Ts(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}function xSt(t,e){let i=t;do{let r=i.prev,s=i.next.next;!Ev(r,s)&&vdt(r,i,i.next,s)&&sS(r,s)&&sS(s,r)&&(e.push(r.i,i.i,s.i),nS(i),nS(i.next),i=t=s),i=i.next}while(i!==t);return Hg(i)}function wSt(t,e,i,r,s,n){let a=t;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&CSt(a,o)){let l=bdt(a,o);return a=Hg(a,a.next),l=Hg(l,l.next),rS(a,e,i,r,s,n,0),void rS(l,e,i,r,s,n,0)}o=o.next}a=a.next}while(a!==t)}function SSt(t,e){let i=t.x-e.x;return i===0&&(i=t.y-e.y,i===0)&&(i=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)),i}function TSt(t,e){let i=function(s,n){let a,o=n,l=s.x,u=s.y,h=-1/0;if(Ev(s,o))return o;do{if(Ev(s,o.next))return o.next;if(u<=o.y&&u>=o.next.y&&o.next.y!==o.y){let f=o.x+(u-o.y)*(o.next.x-o.x)/(o.next.y-o.y);if(f<=l&&f>h&&(h=f,a=o.x<o.next.x?o:o.next,f===l))return a}o=o.next}while(o!==n);if(!a)return null;let d=a,c=a.x,p=a.y,m=1/0;o=a;do{if(l>=o.x&&o.x>=c&&l!==o.x&&ydt(u<p?l:h,u,c,p,u<p?h:l,u,o.x,o.y)){let f=Math.abs(u-o.y)/(l-o.x);sS(o,s)&&(f<m||f===m&&(o.x>a.x||o.x===a.x&&MSt(a,o)))&&(a=o,m=f)}o=o.next}while(o!==d);return a}(t,e);if(!i)return e;let r=bdt(i,t);return Hg(r,r.next),Hg(i,i.next)}function MSt(t,e){return Ts(t.prev,t,e.prev)<0&&Ts(e.next,t,t.next)<0}function SF(t,e,i,r,s){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*s|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*s|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function ASt(t){let e=t,i=t;do(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next;while(e!==t);return i}function ydt(t,e,i,r,s,n,a,o){return(s-a)*(e-o)>=(t-a)*(n-o)&&(t-a)*(r-o)>=(i-a)*(e-o)&&(i-a)*(n-o)>=(s-a)*(r-o)}function ww(t,e,i,r,s,n,a,o){return!(t===a&&e===o)&&ydt(t,e,i,r,s,n,a,o)}function CSt(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(i,r){let s=i;do{if(s.i!==i.i&&s.next.i!==i.i&&s.i!==r.i&&s.next.i!==r.i&&vdt(s,s.next,i,r))return!0;s=s.next}while(s!==i);return!1}(t,e)&&(sS(t,e)&&sS(e,t)&&function(i,r){let s=i,n=!1,a=(i.x+r.x)/2,o=(i.y+r.y)/2;do s.y>o!=s.next.y>o&&s.next.y!==s.y&&a<(s.next.x-s.x)*(o-s.y)/(s.next.y-s.y)+s.x&&(n=!n),s=s.next;while(s!==i);return n}(t,e)&&(Ts(t.prev,t,e.prev)||Ts(t,e.prev,e))||Ev(t,e)&&Ts(t.prev,t,t.next)>0&&Ts(e.prev,e,e.next)>0)}function Ts(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Ev(t,e){return t.x===e.x&&t.y===e.y}function vdt(t,e,i,r){let s=yT(Ts(t,e,i)),n=yT(Ts(t,e,r)),a=yT(Ts(i,r,t)),o=yT(Ts(i,r,e));return!!(s!==n&&a!==o||s===0&&gT(t,i,e)||n===0&&gT(t,r,e)||a===0&&gT(i,t,r)||o===0&&gT(i,e,r))}function gT(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function yT(t){return t>0?1:t<0?-1:0}function sS(t,e){return Ts(t.prev,t,t.next)<0?Ts(t,e,t.next)>=0&&Ts(t,t.prev,e)>=0:Ts(t,e,t.prev)<0||Ts(t,t.next,e)<0}function bdt(t,e){let i=TF(t.i,t.x,t.y),r=TF(e.i,e.x,e.y),s=t.next,n=e.prev;return t.next=e,e.prev=t,i.next=s,s.prev=i,r.next=i,i.prev=r,n.next=r,r.prev=n,r}function kq(t,e,i,r){let s=TF(t,e,i);return r?(s.next=r.next,s.prev=r,r.next.prev=s,r.next=s):(s.prev=s,s.next=s),s}function nS(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function TF(t,e,i){return{i:t,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function zq(t){let e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function Lq(t,e){for(let i=0;i<e.length;i++)t.push(e[i].x),t.push(e[i].y)}function Fq(t){return t&&(t.isColor||t.isMatrix3||t.isMatrix4||t.isVector2||t.isVector3||t.isVector4||t.isTexture||t.isQuaternion)}function vT(t,e){return t&&t.constructor!==e?typeof e.BYTES_PER_ELEMENT=="number"?new e(t):Array.prototype.slice.call(t):t}function ESt(t){let e=t.length,i=new Array(e);for(let r=0;r!==e;++r)i[r]=r;return i.sort(function(r,s){return t[r]-t[s]}),i}function Uq(t,e,i){let r=t.length,s=new t.constructor(r);for(let n=0,a=0;a!==r;++n){let o=i[n]*e;for(let l=0;l!==e;++l)s[a++]=t[o+l]}return s}function PSt(t){if(t.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");let e=function(i){switch(i.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return t8;case"vector":case"vector2":case"vector3":case"vector4":return ipt;case"color":return ept;case"quaternion":return e8;case"bool":case"boolean":return x1;case"string":return w1}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+i)}(t.type);if(t.times===void 0){let i=[],r=[];(function(s,n,a,o){let l=1,u=s[0];for(;u!==void 0&&u[o]===void 0;)u=s[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&&(n.push(u.time),a.push(...h)),u=s[l++];while(u!==void 0);else if(h.toArray!==void 0)do h=u[o],h!==void 0&&(n.push(u.time),h.toArray(a,a.length)),u=s[l++];while(u!==void 0);else do h=u[o],h!==void 0&&(n.push(u.time),a.push(h)),u=s[l++];while(u!==void 0)})(t.keys,i,r,"value"),t.times=i,t.values=r}return e.parse!==void 0?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}function jq(t){try{let e=t.slice(t.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}function Gq(t,e){return t.distance-e.distance}function MF(t,e,i,r){let s=!0;if(t.layers.test(e.layers)&&t.raycast(e,i)===!1&&(s=!1),s===!0&&r===!0){let n=t.children;for(let a=0,o=n.length;a<o;a++)MF(n[a],e,i,!0)}}function ks(t,e,i,r,s,n,a){Iw.set(s,n,a).unproject(r);let o=e[t];if(o!==void 0){let l=i.getAttribute("position");for(let u=0,h=o.length;u<h;u++)l.setXYZ(o[u],Iw.x,Iw.y,Iw.z)}}var rm,al,_dt,dR,xdt,m1,Hh,$a,Pa,vr,zh,cR,pR,mR,fR,AF,iv,wdt,Sdt,Tdt,Mdt,Adt,gR,Cdt,Edt,_2,Og,Pdt,Rdt,Ndt,Ddt,Odt,qE,HE,$E,f1,XE,YE,KE,ZE,Sw,Idt,Bdt,dl,Vdt,kdt,zdt,J9,t7,e7,QE,Ig,x2,yR,vR,w2,Tn,Mn,Bg,Ne,Ldt,Tw,ge,CF,ta,Fdt,vl,S2,T2,j1,gl,An,Je,Qe,Udt,jdt,M2,i7,r7,Gdt,bR,an,Hp,rv,ra,_R,Bo,xR,EF,s7,Wdt,qdt,Hdt,$dt,Xdt,Ydt,Kdt,Zdt,Qdt,n7,Jdt,tct,ect,ict,rct,sct,nct,act,oct,lct,hct,uct,dct,cct,pct,mct,fct,gct,yct,vct,a7,bct,PF,RF,wR,Cb,bT,_T,Dm,Om,Eb,Iu,_ct,A2,Ns,Yu,SN,Tr,JE,NF,xct,wct,Cp,Sct,Tct,Mct,Act,Cct,Ect,Pct,Rct,Nct,Dct,Oct,Ict,Bct,tP,Vct,DF,kct,Mw,eP,zct,g1,Lct,yg,$h,Fct,Io,zo,Kf,Zf,Uct,OF,$g,jct,Kn,ba,IF,y1,v1,Yt,TN,Z,Pe,MN,P,xT,AN,Wq,Ss,wT,CN,EN,Qi,v0,Gct,qq,ST,Hq,TT,mi,PN,Ae,We,hg,Wct,RN,At,Im,Al,$q,Xq,ad,Pb,xo,NN,DN,ur,ON,Yq,IN,Bm,su,Rb,b0,Kq,Zq,BN,VN,kN,zN,Qq,Vm,MT,hr,Hv,LN,od,Nb,oe,ca,BF,Ku,Cl,nu,AT,au,km,zm,FN,CT,ET,PT,RT,NT,DT,Os,dr,ou,El,Db,Lm,Fm,Um,ld,hd,Lc,_0,Ob,Ib,Ep,Fu,Xh,zs,Bb,Jq,Se,VF,sm,kF,me,tH,x0,OT,Zn,eH,$o,IT,jm,wo,w0,fn,ye,G1,Ba,Vp,iH,ho,zF,S0,T0,Gm,Wm,Qf,b1,LF,Vb,M0,kb,UN,BT,jN,FF,lu,VT,zb,ud,kT,Lb,zT,pc,Uo,GN,Fc,Fb,WN,Aw,Cw,Ew,LT,Ub,UF,Pw,Ar,jF,br,qN,rH,SR,po,qm,HN,jb,$N,sH,A0,C0,Z4,FT,nH,aH,Ra,Uc,oH,Gb,Rw,XN,GF,Vh,C2,E2,YN,E0,Wb,iP,WF,Nw,KN,ZN,_1,qct,o7,rP,Dw,l7,Ya,Hct,Kh,P2,TR,UT,qF,nh,Ow,lH,QN,JN,jT,GT,WT,hH,Yl,R2,cl,HF,oc,uH,sP,tD,$F,N2,aS,dH,XF,YF,KF,Ac,Tc,MR,ZF,$ct,Pv,Xct,QF,Yct,Kct,Zct,Qct,Jct,tpt,JF,P0,cH,eD,pH,mH,ah,x1,ept,t8,fH,e8,w1,ipt,nP,R0,gH,Jf,hu,yH,D2,Hm,vH,rpt,spt,qd,Q4,qT,iD,rD,HT,qb,Hb,oh,vg,dd,sD,nD,Bh,bH,Vg,N0,_H,oS,Rv,xH,lS,npt,apt,wH,opt,aP,AR,h7,$m,lpt,SH,$T,TH,XT,MH,AH,CH,EH,PH,RH,NH,DH,Er,OH,IH,hpt,i8,u7,aD,d7,r8,BH,c7,oD,J4,lD,$b,Xm,Ym,YT,VH,kH,yl,hD,upt,dpt,uD,Xb,dD,cpt,Iw,fs,hS,uS,ppt,zH,LH,FH,UH,jH,GH,WH,mpt,dS,OS,fpt,Fo,s8,gpt,yt=W(()=>{rm="185",al={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},_dt=0,dR=1,xdt=2,m1=3,Hh=0,$a=1,Pa=2,vr=0,zh=1,cR=2,pR=3,mR=4,fR=5,AF=6,iv=100,wdt=101,Sdt=102,Tdt=103,Mdt=104,Adt=200,gR=201,Cdt=202,Edt=203,_2=204,Og=205,Pdt=206,Rdt=207,Ndt=208,Ddt=209,Odt=210,qE=0,HE=1,$E=2,f1=3,XE=4,YE=5,KE=6,ZE=7,Sw=0,Idt=1,Bdt=2,dl=0,Vdt=1,kdt=2,zdt=3,J9=4,t7=6,e7=7,QE=300,Ig=301,x2=302,yR=303,vR=304,w2=306,Tn=1e3,Mn=1001,Bg=1002,Ne=1003,Ldt=1004,Tw=1005,ge=1006,CF=1007,ta=1008,Fdt=1008,vl=1009,S2=1010,T2=1011,j1=1012,gl=1013,An=1014,Je=1015,Qe=1016,Udt=1017,jdt=1018,M2=1020,i7=35902,r7=35899,Gdt=1021,bR=1022,an=1023,Hp=1026,rv=1027,ra=1028,_R=1029,Bo=1030,xR=1031,EF=1032,s7=1033,Wdt=33776,qdt=33777,Hdt=33778,$dt=33779,Xdt=36196,Ydt=37492,Kdt=37496,Zdt=37488,Qdt=37489,n7=37490,Jdt=37491,tct=37808,ect=37809,ict=37810,rct=37811,sct=37812,nct=37813,act=37814,oct=37815,lct=37816,hct=37817,uct=37818,dct=37819,cct=37820,pct=37821,mct=36492,fct=36494,gct=36495,yct=36283,vct=36284,a7=36285,bct=36286,PF=2200,RF=2201,wR=2202,Cb=2300,bT=2301,_T=2302,Dm=2400,Om=2401,Eb=2402,Iu=0,_ct=1,A2="",Ns="srgb",Yu="srgb-linear",SN="linear",Tr="srgb",JE="",NF="rg",xct="ga",wct=0,Cp=7680,Sct=7681,Tct=7682,Mct=7683,Act=34055,Cct=34056,Ect=5386,Pct=512,Rct=513,Nct=514,Dct=515,Oct=516,Ict=517,Bct=518,tP=519,Vct=512,DF=513,kct=514,Mw=515,eP=516,zct=517,g1=518,Lct=519,yg=35044,$h=35048,Fct="300 es",Io=2e3,zo=2001,Kf={COMPUTE:"compute",RENDER:"render"},Zf={TEXTURE_COMPARE:"depthTextureCompare"},Uct={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array},OF={},$g=null,jct={[qE]:HE,[$E]:KE,[XE]:ZE,[f1]:YE,[HE]:qE,[KE]:$E,[ZE]:XE,[YE]:f1},Kn=class{addEventListener(t,e){this._listeners===void 0&&(this._listeners={});let i=this._listeners;i[t]===void 0&&(i[t]=[]),i[t].indexOf(e)===-1&&i[t].push(e)}hasEventListener(t,e){let i=this._listeners;return i!==void 0&&i[t]!==void 0&&i[t].indexOf(e)!==-1}removeEventListener(t,e){let i=this._listeners;if(i===void 0)return;let r=i[t];if(r!==void 0){let s=r.indexOf(e);s!==-1&&r.splice(s,1)}}dispatchEvent(t){let e=this._listeners;if(e===void 0)return;let i=e[t.type];if(i!==void 0){t.target=this;let r=i.slice(0);for(let s=0,n=r.length;s<n;s++)r[s].call(this,t);t.target=null}}},ba=["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"],IF=1234567,y1=Math.PI/180,v1=180/Math.PI,Yt={DEG2RAD:y1,RAD2DEG:v1,generateUUID:Ml,clamp:ei,euclideanModulo:wF,mapLinear:rSt,inverseLerp:sSt,lerp:xw,damp:nSt,pingpong:aSt,smoothstep:oSt,smootherstep:lSt,randInt:hSt,randFloat:uSt,randFloatSpread:dSt,seededRandom:cSt,degToRad:pSt,radToDeg:mSt,isPowerOfTwo:fSt,ceilPowerOfTwo:gSt,floorPowerOfTwo:ySt,setQuaternionFromProperEuler:vSt,normalize:yi,denormalize:so},TN=class{constructor(t=0,e=0){this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("THREE.Vector2: index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){let e=this.x,i=this.y,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6],this.y=r[1]*e+r[4]*i+r[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=ei(this.x,t.x,e.x),this.y=ei(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=ei(this.x,t,e),this.y=ei(this.y,t,e),this}clampLength(t,e){let i=this.length();return this.divideScalar(i||1).multiplyScalar(ei(i,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let i=this.dot(t)/e;return Math.acos(ei(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){let i=Math.cos(e),r=Math.sin(e),s=this.x-t.x,n=this.y-t.y;return this.x=s*i-n*r+t.x,this.y=s*r+n*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Z=TN,TN.prototype.isVector2=!0,Pe=class{constructor(t=0,e=0,i=0,r=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=i,this._w=r}static slerpFlat(t,e,i,r,s,n,a){let o=i[r+0],l=i[r+1],u=i[r+2],h=i[r+3],d=s[n+0],c=s[n+1],p=s[n+2],m=s[n+3];if(h!==m||o!==d||l!==c||u!==p){let f=o*d+l*c+u*p+h*m;f<0&&(d=-d,c=-c,p=-p,m=-m,f=-f);let g=1-a;if(f<.9995){let y=Math.acos(f),v=Math.sin(y);g=Math.sin(g*y)/v,o=o*g+d*(a=Math.sin(a*y)/v),l=l*g+c*a,u=u*g+p*a,h=h*g+m*a}else{o=o*g+d*a,l=l*g+c*a,u=u*g+p*a,h=h*g+m*a;let y=1/Math.sqrt(o*o+l*l+u*u+h*h);o*=y,l*=y,u*=y,h*=y}}t[e]=o,t[e+1]=l,t[e+2]=u,t[e+3]=h}static multiplyQuaternionsFlat(t,e,i,r,s,n){let a=i[r],o=i[r+1],l=i[r+2],u=i[r+3],h=s[n],d=s[n+1],c=s[n+2],p=s[n+3];return t[e]=a*p+u*h+o*c-l*d,t[e+1]=o*p+u*d+l*h-a*c,t[e+2]=l*p+u*c+a*d-o*h,t[e+3]=u*p-a*h-o*d-l*c,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,r){return this._x=t,this._y=e,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){let i=t._x,r=t._y,s=t._z,n=t._order,a=Math.cos,o=Math.sin,l=a(i/2),u=a(r/2),h=a(s/2),d=o(i/2),c=o(r/2),p=o(s/2);switch(n){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:ae("Quaternion: .setFromEuler() encountered an unknown order: "+n)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){let i=e/2,r=Math.sin(i);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){let e=t.elements,i=e[0],r=e[4],s=e[8],n=e[1],a=e[5],o=e[9],l=e[2],u=e[6],h=e[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=(s-l)*c,this._z=(n-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+n)/c,this._z=(s+l)/c}else if(a>h){let c=2*Math.sqrt(1+a-i-h);this._w=(s-l)/c,this._x=(r+n)/c,this._y=.25*c,this._z=(o+u)/c}else{let c=2*Math.sqrt(1+h-i-a);this._w=(n-r)/c,this._x=(s+l)/c,this._y=(o+u)/c,this._z=.25*c}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<1e-8?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(ei(this.dot(t),-1,1)))}rotateTowards(t,e){let i=this.angleTo(t);if(i===0)return this;let r=Math.min(1,e/i);return this.slerp(t,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(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){let i=t._x,r=t._y,s=t._z,n=t._w,a=e._x,o=e._y,l=e._z,u=e._w;return this._x=i*u+n*a+r*l-s*o,this._y=r*u+n*o+s*a-i*l,this._z=s*u+n*l+i*o-r*a,this._w=n*u-i*a-r*o-s*l,this._onChangeCallback(),this}slerp(t,e){let i=t._x,r=t._y,s=t._z,n=t._w,a=this.dot(t);a<0&&(i=-i,r=-r,s=-s,n=-n,a=-a);let o=1-e;if(a<.9995){let l=Math.acos(a),u=Math.sin(l);o=Math.sin(o*l)/u,e=Math.sin(e*l)/u,this._x=this._x*o+i*e,this._y=this._y*o+r*e,this._z=this._z*o+s*e,this._w=this._w*o+n*e,this._onChangeCallback()}else this._x=this._x*o+i*e,this._y=this._y*o+r*e,this._z=this._z*o+s*e,this._w=this._w*o+n*e,this.normalize();return this}slerpQuaternions(t,e,i){return this.copy(t).slerp(e,i)}random(){let t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),i=Math.random(),r=Math.sqrt(1-i),s=Math.sqrt(i);return this.set(r*Math.sin(t),r*Math.cos(t),s*Math.sin(e),s*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},MN=class{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.z=i}set(t,e,i){return i===void 0&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("THREE.Vector3: index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("THREE.Vector3: index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(AN.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(AN.setFromAxisAngle(t,e))}applyMatrix3(t){let e=this.x,i=this.y,r=this.z,s=t.elements;return this.x=s[0]*e+s[3]*i+s[6]*r,this.y=s[1]*e+s[4]*i+s[7]*r,this.z=s[2]*e+s[5]*i+s[8]*r,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let e=this.x,i=this.y,r=this.z,s=t.elements,n=1/(s[3]*e+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*e+s[4]*i+s[8]*r+s[12])*n,this.y=(s[1]*e+s[5]*i+s[9]*r+s[13])*n,this.z=(s[2]*e+s[6]*i+s[10]*r+s[14])*n,this}applyQuaternion(t){let e=this.x,i=this.y,r=this.z,s=t.x,n=t.y,a=t.z,o=t.w,l=2*(n*r-a*i),u=2*(a*e-s*r),h=2*(s*i-n*e);return this.x=e+o*l+n*h-a*u,this.y=i+o*u+a*l-s*h,this.z=r+o*h+s*u-n*l,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){let e=this.x,i=this.y,r=this.z,s=t.elements;return this.x=s[0]*e+s[4]*i+s[8]*r,this.y=s[1]*e+s[5]*i+s[9]*r,this.z=s[2]*e+s[6]*i+s[10]*r,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=ei(this.x,t.x,e.x),this.y=ei(this.y,t.y,e.y),this.z=ei(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=ei(this.x,t,e),this.y=ei(this.y,t,e),this.z=ei(this.z,t,e),this}clampLength(t,e){let i=this.length();return this.divideScalar(i||1).multiplyScalar(ei(i,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){let i=t.x,r=t.y,s=t.z,n=e.x,a=e.y,o=e.z;return this.x=r*o-s*a,this.y=s*n-i*o,this.z=i*a-r*n,this}projectOnVector(t){let e=t.lengthSq();if(e===0)return this.set(0,0,0);let i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return xT.copy(this).projectOnVector(t),this.sub(xT)}reflect(t){return this.sub(xT.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let i=this.dot(t)/e;return Math.acos(ei(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,i=this.y-t.y,r=this.z-t.z;return e*e+i*i+r*r}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,i){let r=Math.sin(e)*t;return this.x=r*Math.sin(i),this.y=Math.cos(e)*t,this.z=r*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){let e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=r,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let t=Math.random()*Math.PI*2,e=2*Math.random()-1,i=Math.sqrt(1-e*e);return this.x=i*Math.cos(t),this.y=e,this.z=i*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},P=MN,MN.prototype.isVector3=!0,xT=new P,AN=new Pe,Ss=Wq=class{constructor(t,e,i,r,s,n,a,o,l){this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,i,r,s,n,a,o,l)}set(t,e,i,r,s,n,a,o,l){let u=this.elements;return u[0]=t,u[1]=r,u[2]=a,u[3]=e,u[4]=s,u[5]=o,u[6]=i,u[7]=n,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){let e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let i=t.elements,r=e.elements,s=this.elements,n=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],m=r[0],f=r[3],g=r[6],y=r[1],v=r[4],b=r[7],_=r[2],x=r[5],S=r[8];return s[0]=n*m+a*y+o*_,s[3]=n*f+a*v+o*x,s[6]=n*g+a*b+o*S,s[1]=l*m+u*y+h*_,s[4]=l*f+u*v+h*x,s[7]=l*g+u*b+h*S,s[2]=d*m+c*y+p*_,s[5]=d*f+c*v+p*x,s[8]=d*g+c*b+p*S,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){let t=this.elements,e=t[0],i=t[1],r=t[2],s=t[3],n=t[4],a=t[5],o=t[6],l=t[7],u=t[8];return e*n*u-e*a*l-i*s*u+i*a*o+r*s*l-r*n*o}invert(){let t=this.elements,e=t[0],i=t[1],r=t[2],s=t[3],n=t[4],a=t[5],o=t[6],l=t[7],u=t[8],h=u*n-a*l,d=a*o-u*s,c=l*s-n*o,p=e*h+i*d+r*c;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);let m=1/p;return t[0]=h*m,t[1]=(r*l-u*i)*m,t[2]=(a*i-r*n)*m,t[3]=d*m,t[4]=(u*e-r*o)*m,t[5]=(r*s-a*e)*m,t[6]=c*m,t[7]=(i*o-l*e)*m,t[8]=(n*e-i*s)*m,this}transpose(){let t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,i,r,s,n,a){let o=Math.cos(s),l=Math.sin(s);return this.set(i*o,i*l,-i*(o*n+l*a)+n+t,-r*l,r*o,-r*(-l*n+o*a)+a+e,0,0,1),this}scale(t,e){return Zi("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(wT.makeScale(t,e)),this}rotate(t){return Zi("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(wT.makeRotation(-t)),this}translate(t,e){return Zi("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(wT.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){let e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,i,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){let e=this.elements,i=t.elements;for(let r=0;r<9;r++)if(e[r]!==i[r])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){let i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return new this.constructor().fromArray(this.elements)}},Wq.prototype.isMatrix3=!0,wT=new Ss,CN=new Ss().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),EN=new Ss().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715),Qi=function(){let t={enabled:!1,workingColorSpace:Yu,spaces:{},convert:function(s,n,a){return this.enabled===!1||n===a||!n||!a||(this.spaces[n].transfer===Tr&&(s.r=nd(s.r),s.g=nd(s.g),s.b=nd(s.b)),this.spaces[n].primaries!==this.spaces[a].primaries&&(s.applyMatrix3(this.spaces[n].toXYZ),s.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===Tr&&(s.r=y0(s.r),s.g=y0(s.g),s.b=y0(s.b))),s},workingToColorSpace:function(s,n){return this.convert(s,this.workingColorSpace,n)},colorSpaceToWorking:function(s,n){return this.convert(s,n,this.workingColorSpace)},getPrimaries:function(s){return this.spaces[s].primaries},getTransfer:function(s){return s===A2?SN:this.spaces[s].transfer},getToneMappingMode:function(s){return this.spaces[s].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(s,n=this.workingColorSpace){return s.fromArray(this.spaces[n].luminanceCoefficients)},define:function(s){Object.assign(this.spaces,s)},_getMatrix:function(s,n,a){return s.copy(this.spaces[n].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(s){return this.spaces[s].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(s=this.workingColorSpace){return this.spaces[s].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(s,n){return Zi("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),t.workingToColorSpace(s,n)},toWorkingColorSpace:function(s,n){return Zi("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),t.colorSpaceToWorking(s,n)}},e=[.64,.33,.3,.6,.15,.06],i=[.2126,.7152,.0722],r=[.3127,.329];return t.define({[Yu]:{primaries:e,whitePoint:r,transfer:SN,toXYZ:CN,fromXYZ:EN,luminanceCoefficients:i,workingColorSpaceConfig:{unpackColorSpace:Ns},outputColorSpaceConfig:{drawingBufferColorSpace:Ns}},[Ns]:{primaries:e,whitePoint:r,transfer:Tr,toXYZ:CN,fromXYZ:EN,luminanceCoefficients:i,outputColorSpaceConfig:{drawingBufferColorSpace:Ns}}}),t}(),Gct=class{static getDataURL(t,e="image/png"){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement>"u")return t.src;let i;if(t instanceof HTMLCanvasElement)i=t;else{v0===void 0&&(v0=WE("canvas")),v0.width=t.width,v0.height=t.height;let r=v0.getContext("2d");t instanceof ImageData?r.putImageData(t,0,0):r.drawImage(t,0,0,t.width,t.height),i=v0}return i.toDataURL(e)}static sRGBToLinear(t){if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap){let e=WE("canvas");e.width=t.width,e.height=t.height;let i=e.getContext("2d");i.drawImage(t,0,0,t.width,t.height);let r=i.getImageData(0,0,t.width,t.height),s=r.data;for(let n=0;n<s.length;n++)s[n]=255*nd(s[n]/255);return i.putImageData(r,0,0),e}if(t.data){let e=t.data.slice(0);for(let i=0;i<e.length;i++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[i]=Math.floor(255*nd(e[i]/255)):e[i]=nd(e[i]);return{data:e,width:t.width,height:t.height}}return ae("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}},qq=0,ST=class{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:qq++}),this.uuid=Ml(),this.data=t,this.dataReady=!0,this.version=0}getSize(t){let e=this.data;return typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement?t.set(e.videoWidth,e.videoHeight,0):typeof VideoFrame<"u"&&e instanceof VideoFrame?t.set(e.displayWidth,e.displayHeight,0):e!==null?t.set(e.width,e.height,e.depth||0):t.set(0,0,0),t}set needsUpdate(t){t===!0&&this.version++}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.images[this.uuid]!==void 0)return t.images[this.uuid];let i={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let n=0,a=r.length;n<a;n++)r[n].isDataTexture?s.push(bN(r[n].image)):s.push(bN(r[n]))}else s=bN(r);i.url=s}return e||(t.images[this.uuid]=i),i}},Hq=0,TT=new P,(mi=class extends Kn{constructor(t=mi.DEFAULT_IMAGE,e=mi.DEFAULT_MAPPING,i=Mn,r=Mn,s=ge,n=ta,a=an,o=vl,l=mi.DEFAULT_ANISOTROPY,u=A2){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Hq++}),this.uuid=Ml(),this.name="",this.source=new ST(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=s,this.minFilter=n,this.anisotropy=l,this.format=a,this.internalFormat=null,this.type=o,this.offset=new Z(0,0),this.repeat=new Z(1,1),this.center=new Z(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ss,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=!!(t&&t.depth&&t.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(TT).x}get height(){return this.source.getSize(TT).y}get depth(){return this.source.getSize(TT).z}get image(){return this.source.data}set image(t){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.normalized=t.normalized,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isArrayTexture=t.isArrayTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}setValues(t){for(let e in t){let i=t[e];if(i===void 0){ae(`Texture.setValues(): parameter '${e}' has value of undefined.`);continue}let r=this[e];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[e]=i:ae(`Texture.setValues(): property '${e}' does not exist.`)}}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];let i={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),e||(t.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==QE)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case Tn:t.x=t.x-Math.floor(t.x);break;case Mn:t.x=t.x<0?0:1;break;case Bg:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case Tn:t.y=t.y-Math.floor(t.y);break;case Mn:t.y=t.y<0?0:1;break;case Bg:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){t===!0&&this.pmremVersion++}}).DEFAULT_IMAGE=null,mi.DEFAULT_MAPPING=QE,mi.DEFAULT_ANISOTROPY=1,PN=class{constructor(t=0,e=0,i=0,r=1){this.x=t,this.y=e,this.z=i,this.w=r}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,i,r){return this.x=t,this.y=e,this.z=i,this.w=r,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("THREE.Vector4: index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("THREE.Vector4: index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){let e=this.x,i=this.y,r=this.z,s=this.w,n=t.elements;return this.x=n[0]*e+n[4]*i+n[8]*r+n[12]*s,this.y=n[1]*e+n[5]*i+n[9]*r+n[13]*s,this.z=n[2]*e+n[6]*i+n[10]*r+n[14]*s,this.w=n[3]*e+n[7]*i+n[11]*r+n[15]*s,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);let e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,i,r,s,n=t.elements,a=n[0],o=n[4],l=n[8],u=n[1],h=n[5],d=n[9],c=n[2],p=n[6],m=n[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+m-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;let g=(a+1)/2,y=(h+1)/2,v=(m+1)/2,b=(o+u)/4,_=(l+c)/4,x=(d+p)/4;return g>y&&g>v?g<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(g),r=b/i,s=_/i):y>v?y<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(y),i=b/r,s=x/r):v<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(v),i=_/s,r=x/s),this.set(i,r,s,e),this}let f=Math.sqrt((p-d)*(p-d)+(l-c)*(l-c)+(u-o)*(u-o));return Math.abs(f)<.001&&(f=1),this.x=(p-d)/f,this.y=(l-c)/f,this.z=(u-o)/f,this.w=Math.acos((a+h+m-1)/2),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=ei(this.x,t.x,e.x),this.y=ei(this.y,t.y,e.y),this.z=ei(this.z,t.z,e.z),this.w=ei(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=ei(this.x,t,e),this.y=ei(this.y,t,e),this.z=ei(this.z,t,e),this.w=ei(this.w,t,e),this}clampLength(t,e){let i=this.length();return this.divideScalar(i||1).multiplyScalar(ei(i,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}},Ae=PN,PN.prototype.isVector4=!0,We=class extends Kn{constructor(t=1,e=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:ge,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},i),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=i.depth,this.scissor=new Ae(0,0,t,e),this.scissorTest=!1,this.viewport=new Ae(0,0,t,e),this.textures=[];let r={width:t,height:e,depth:i.depth},s=new mi(r),n=i.count;for(let a=0;a<n;a++)this.textures[a]=s.clone(),this.textures[a].isRenderTargetTexture=!0,this.textures[a].renderTarget=this;this._setTextureOptions(i),this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=i.depthTexture,this.samples=i.samples,this.multiview=i.multiview,this.useArrayDepthTexture=i.useArrayDepthTexture}_setTextureOptions(t={}){let e={minFilter:ge,generateMipmaps:!1,flipY:!1,internalFormat:null};t.mapping!==void 0&&(e.mapping=t.mapping),t.wrapS!==void 0&&(e.wrapS=t.wrapS),t.wrapT!==void 0&&(e.wrapT=t.wrapT),t.wrapR!==void 0&&(e.wrapR=t.wrapR),t.magFilter!==void 0&&(e.magFilter=t.magFilter),t.minFilter!==void 0&&(e.minFilter=t.minFilter),t.format!==void 0&&(e.format=t.format),t.type!==void 0&&(e.type=t.type),t.anisotropy!==void 0&&(e.anisotropy=t.anisotropy),t.colorSpace!==void 0&&(e.colorSpace=t.colorSpace),t.flipY!==void 0&&(e.flipY=t.flipY),t.generateMipmaps!==void 0&&(e.generateMipmaps=t.generateMipmaps),t.internalFormat!==void 0&&(e.internalFormat=t.internalFormat);for(let i=0;i<this.textures.length;i++)this.textures[i].setValues(e)}get texture(){return this.textures[0]}set texture(t){this.textures[0]=t}set depthTexture(t){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),t!==null&&(t.renderTarget=this),this._depthTexture=t}get depthTexture(){return this._depthTexture}setSize(t,e,i=1){if(this.width!==t||this.height!==e||this.depth!==i){this.width=t,this.height=e,this.depth=i;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=t,this.textures[r].image.height=e,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,t,e),this.scissor.set(0,0,t,e)}clone(){return new this.constructor().copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let e=0,i=t.textures.length;e<i;e++){this.textures[e]=t.textures[e].clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;let r=Object.assign({},t.textures[e].image);this.textures[e].source=new ST(r)}return this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.resolveDepthBuffer=t.resolveDepthBuffer,this.resolveStencilBuffer=t.resolveStencilBuffer,t.depthTexture!==null&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this.multiview=t.multiview,this.useArrayDepthTexture=t.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}},hg=class extends We{constructor(t=1,e=1,i={}){super(t,e,i),this.isWebGLRenderTarget=!0}},Wct=class extends mi{constructor(t=null,e=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:i,depth:r},this.magFilter=Ne,this.minFilter=Ne,this.wrapR=Mn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}},At=RN=class{constructor(t,e,i,r,s,n,a,o,l,u,h,d,c,p,m,f){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,e,i,r,s,n,a,o,l,u,h,d,c,p,m,f)}set(t,e,i,r,s,n,a,o,l,u,h,d,c,p,m,f){let g=this.elements;return g[0]=t,g[4]=e,g[8]=i,g[12]=r,g[1]=s,g[5]=n,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]=m,g[15]=f,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 RN().fromArray(this.elements)}copy(t){let e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){let e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}setFromMatrix3(t){let e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,i){return this.determinantAffine()===0?(t.set(1,0,0),e.set(0,1,0),i.set(0,0,1),this):(t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this)}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){if(t.determinantAffine()===0)return this.identity();let e=this.elements,i=t.elements,r=1/Im.setFromMatrixColumn(t,0).length(),s=1/Im.setFromMatrixColumn(t,1).length(),n=1/Im.setFromMatrixColumn(t,2).length();return e[0]=i[0]*r,e[1]=i[1]*r,e[2]=i[2]*r,e[3]=0,e[4]=i[4]*s,e[5]=i[5]*s,e[6]=i[6]*s,e[7]=0,e[8]=i[8]*n,e[9]=i[9]*n,e[10]=i[10]*n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){let e=this.elements,i=t.x,r=t.y,s=t.z,n=Math.cos(i),a=Math.sin(i),o=Math.cos(r),l=Math.sin(r),u=Math.cos(s),h=Math.sin(s);if(t.order==="XYZ"){let d=n*u,c=n*h,p=a*u,m=a*h;e[0]=o*u,e[4]=-o*h,e[8]=l,e[1]=c+p*l,e[5]=d-m*l,e[9]=-a*o,e[2]=m-d*l,e[6]=p+c*l,e[10]=n*o}else if(t.order==="YXZ"){let d=o*u,c=o*h,p=l*u,m=l*h;e[0]=d+m*a,e[4]=p*a-c,e[8]=n*l,e[1]=n*h,e[5]=n*u,e[9]=-a,e[2]=c*a-p,e[6]=m+d*a,e[10]=n*o}else if(t.order==="ZXY"){let d=o*u,c=o*h,p=l*u,m=l*h;e[0]=d-m*a,e[4]=-n*h,e[8]=p+c*a,e[1]=c+p*a,e[5]=n*u,e[9]=m-d*a,e[2]=-n*l,e[6]=a,e[10]=n*o}else if(t.order==="ZYX"){let d=n*u,c=n*h,p=a*u,m=a*h;e[0]=o*u,e[4]=p*l-c,e[8]=d*l+m,e[1]=o*h,e[5]=m*l+d,e[9]=c*l-p,e[2]=-l,e[6]=a*o,e[10]=n*o}else if(t.order==="YZX"){let d=n*o,c=n*l,p=a*o,m=a*l;e[0]=o*u,e[4]=m-d*h,e[8]=p*h+c,e[1]=h,e[5]=n*u,e[9]=-a*u,e[2]=-l*u,e[6]=c*h+p,e[10]=d-m*h}else if(t.order==="XZY"){let d=n*o,c=n*l,p=a*o,m=a*l;e[0]=o*u,e[4]=-h,e[8]=l*u,e[1]=d*h+m,e[5]=n*u,e[9]=c*h-p,e[2]=p*h-c,e[6]=a*u,e[10]=m*h+d}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose($q,t,Xq)}lookAt(t,e,i){let r=this.elements;return xo.subVectors(t,e),xo.lengthSq()===0&&(xo.z=1),xo.normalize(),ad.crossVectors(i,xo),ad.lengthSq()===0&&(Math.abs(i.z)===1?xo.x+=1e-4:xo.z+=1e-4,xo.normalize(),ad.crossVectors(i,xo)),ad.normalize(),Pb.crossVectors(xo,ad),r[0]=ad.x,r[4]=Pb.x,r[8]=xo.x,r[1]=ad.y,r[5]=Pb.y,r[9]=xo.y,r[2]=ad.z,r[6]=Pb.z,r[10]=xo.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let i=t.elements,r=e.elements,s=this.elements,n=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],m=i[6],f=i[10],g=i[14],y=i[3],v=i[7],b=i[11],_=i[15],x=r[0],S=r[4],w=r[8],M=r[12],T=r[1],A=r[5],C=r[9],R=r[13],O=r[2],D=r[6],B=r[10],k=r[14],j=r[3],z=r[7],V=r[11],H=r[15];return s[0]=n*x+a*T+o*O+l*j,s[4]=n*S+a*A+o*D+l*z,s[8]=n*w+a*C+o*B+l*V,s[12]=n*M+a*R+o*k+l*H,s[1]=u*x+h*T+d*O+c*j,s[5]=u*S+h*A+d*D+c*z,s[9]=u*w+h*C+d*B+c*V,s[13]=u*M+h*R+d*k+c*H,s[2]=p*x+m*T+f*O+g*j,s[6]=p*S+m*A+f*D+g*z,s[10]=p*w+m*C+f*B+g*V,s[14]=p*M+m*R+f*k+g*H,s[3]=y*x+v*T+b*O+_*j,s[7]=y*S+v*A+b*D+_*z,s[11]=y*w+v*C+b*B+_*V,s[15]=y*M+v*R+b*k+_*H,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){let t=this.elements,e=t[0],i=t[4],r=t[8],s=t[12],n=t[1],a=t[5],o=t[9],l=t[13],u=t[2],h=t[6],d=t[10],c=t[14],p=t[3],m=t[7],f=t[11],g=t[15],y=o*c-l*d,v=a*c-l*h,b=a*d-o*h,_=n*c-l*u,x=n*d-o*u,S=n*h-a*u;return e*(m*y-f*v+g*b)-i*(p*y-f*_+g*x)+r*(p*v-m*_+g*S)-s*(p*b-m*x+f*S)}determinantAffine(){let t=this.elements,e=t[0],i=t[4],r=t[8],s=t[1],n=t[5],a=t[9],o=t[2],l=t[6],u=t[10];return e*(n*u-a*l)-i*(s*u-a*o)+r*(s*l-n*o)}transpose(){let t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(t,e,i){let r=this.elements;return t.isVector3?(r[12]=t.x,r[13]=t.y,r[14]=t.z):(r[12]=t,r[13]=e,r[14]=i),this}invert(){let t=this.elements,e=t[0],i=t[1],r=t[2],s=t[3],n=t[4],a=t[5],o=t[6],l=t[7],u=t[8],h=t[9],d=t[10],c=t[11],p=t[12],m=t[13],f=t[14],g=t[15],y=e*a-i*n,v=e*o-r*n,b=e*l-s*n,_=i*o-r*a,x=i*l-s*a,S=r*l-s*o,w=u*m-h*p,M=u*f-d*p,T=u*g-c*p,A=h*f-d*m,C=h*g-c*m,R=d*g-c*f,O=y*R-v*C+b*A+_*T-x*M+S*w;if(O===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let D=1/O;return t[0]=(a*R-o*C+l*A)*D,t[1]=(r*C-i*R-s*A)*D,t[2]=(m*S-f*x+g*_)*D,t[3]=(d*x-h*S-c*_)*D,t[4]=(o*T-n*R-l*M)*D,t[5]=(e*R-r*T+s*M)*D,t[6]=(f*b-p*S-g*v)*D,t[7]=(u*S-d*b+c*v)*D,t[8]=(n*C-a*T+l*w)*D,t[9]=(i*T-e*C-s*w)*D,t[10]=(p*x-m*b+g*y)*D,t[11]=(h*b-u*x-c*y)*D,t[12]=(a*M-n*A-o*w)*D,t[13]=(e*A-i*M+r*w)*D,t[14]=(m*v-p*_-f*y)*D,t[15]=(u*_-h*v+d*y)*D,this}scale(t){let e=this.elements,i=t.x,r=t.y,s=t.z;return e[0]*=i,e[4]*=r,e[8]*=s,e[1]*=i,e[5]*=r,e[9]*=s,e[2]*=i,e[6]*=r,e[10]*=s,e[3]*=i,e[7]*=r,e[11]*=s,this}getMaxScaleOnAxis(){let t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],r=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,r))}makeTranslation(t,e,i){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){let e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){let e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){let e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){let i=Math.cos(e),r=Math.sin(e),s=1-i,n=t.x,a=t.y,o=t.z,l=s*n,u=s*a;return this.set(l*n+i,l*a-r*o,l*o+r*a,0,l*a+r*o,u*a+i,u*o-r*n,0,l*o-r*a,u*o+r*n,s*o*o+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i,r,s,n){return this.set(1,i,s,0,t,1,n,0,e,r,1,0,0,0,0,1),this}compose(t,e,i){let r=this.elements,s=e._x,n=e._y,a=e._z,o=e._w,l=s+s,u=n+n,h=a+a,d=s*l,c=s*u,p=s*h,m=n*u,f=n*h,g=a*h,y=o*l,v=o*u,b=o*h,_=i.x,x=i.y,S=i.z;return r[0]=(1-(m+g))*_,r[1]=(c+b)*_,r[2]=(p-v)*_,r[3]=0,r[4]=(c-b)*x,r[5]=(1-(d+g))*x,r[6]=(f+y)*x,r[7]=0,r[8]=(p+v)*S,r[9]=(f-y)*S,r[10]=(1-(d+m))*S,r[11]=0,r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=1,this}decompose(t,e,i){let r=this.elements;t.x=r[12],t.y=r[13],t.z=r[14];let s=this.determinantAffine();if(s===0)return i.set(1,1,1),e.identity(),this;let n=Im.set(r[0],r[1],r[2]).length(),a=Im.set(r[4],r[5],r[6]).length(),o=Im.set(r[8],r[9],r[10]).length();s<0&&(n=-n),Al.copy(this);let l=1/n,u=1/a,h=1/o;return Al.elements[0]*=l,Al.elements[1]*=l,Al.elements[2]*=l,Al.elements[4]*=u,Al.elements[5]*=u,Al.elements[6]*=u,Al.elements[8]*=h,Al.elements[9]*=h,Al.elements[10]*=h,e.setFromRotationMatrix(Al),i.x=n,i.y=a,i.z=o,this}makePerspective(t,e,i,r,s,n,a=Io,o=!1){let l,u,h=this.elements,d=2*s/(e-t),c=2*s/(i-r),p=(e+t)/(e-t),m=(i+r)/(i-r);if(o)l=s/(n-s),u=n*s/(n-s);else if(a===Io)l=-(n+s)/(n-s),u=-2*n*s/(n-s);else{if(a!==zo)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);l=-n/(n-s),u=-n*s/(n-s)}return h[0]=d,h[4]=0,h[8]=p,h[12]=0,h[1]=0,h[5]=c,h[9]=m,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(t,e,i,r,s,n,a=Io,o=!1){let l,u,h=this.elements,d=2/(e-t),c=2/(i-r),p=-(e+t)/(e-t),m=-(i+r)/(i-r);if(o)l=1/(n-s),u=n/(n-s);else if(a===Io)l=-2/(n-s),u=-(n+s)/(n-s);else{if(a!==zo)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);l=-1/(n-s),u=-s/(n-s)}return h[0]=d,h[4]=0,h[8]=0,h[12]=p,h[1]=0,h[5]=c,h[9]=0,h[13]=m,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(t){let e=this.elements,i=t.elements;for(let r=0;r<16;r++)if(e[r]!==i[r])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){let i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}},RN.prototype.isMatrix4=!0,Im=new P,Al=new At,$q=new P(0,0,0),Xq=new P(1,1,1),ad=new P,Pb=new P,xo=new P,NN=new At,DN=new Pe,(ur=class{constructor(t=0,e=0,i=0,r=ur.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=i,this._order=r}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,i,r=this._order){return this._x=t,this._y=e,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,i=!0){let r=t.elements,s=r[0],n=r[4],a=r[8],o=r[1],l=r[5],u=r[9],h=r[2],d=r[6],c=r[10];switch(e){case"XYZ":this._y=Math.asin(ei(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,c),this._z=Math.atan2(-n,s)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-ei(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,c),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(ei(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,c),this._z=Math.atan2(-n,l)):(this._y=0,this._z=Math.atan2(o,s));break;case"ZYX":this._y=Math.asin(-ei(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,c),this._z=Math.atan2(o,s)):(this._x=0,this._z=Math.atan2(-n,l));break;case"YZX":this._z=Math.asin(ei(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(a,c));break;case"XZY":this._z=Math.asin(-ei(n,-1,1)),Math.abs(n)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,c),this._y=0);break;default:ae("Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,i===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,i){return NN.makeRotationFromQuaternion(t),this.setFromRotationMatrix(NN,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return DN.setFromEuler(this),this.setFromQuaternion(DN,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}).DEFAULT_ORDER="XYZ",ON=class{constructor(){this.mask=1}set(t){this.mask=1<<t>>>0}enable(t){this.mask|=1<<t}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t}disable(t){this.mask&=~(1<<t)}disableAll(){this.mask=0}test(t){return(this.mask&t.mask)!==0}isEnabled(t){return!!(this.mask&1<<t)}},Yq=0,IN=new P,Bm=new Pe,su=new At,Rb=new P,b0=new P,Kq=new P,Zq=new Pe,BN=new P(1,0,0),VN=new P(0,1,0),kN=new P(0,0,1),zN={type:"added"},Qq={type:"removed"},Vm={type:"childadded",child:null},MT={type:"childremoved",child:null},(hr=class extends Kn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Yq++}),this.uuid=Ml(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=hr.DEFAULT_UP.clone();let t=new P,e=new ur,i=new Pe,r=new P(1,1,1);e._onChange(function(){i.setFromEuler(e,!1)}),i._onChange(function(){e.setFromQuaternion(i,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new At},normalMatrix:{value:new Ss}}),this.matrix=new At,this.matrixWorld=new At,this.matrixAutoUpdate=hr.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=hr.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new ON,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return Bm.setFromAxisAngle(t,e),this.quaternion.multiply(Bm),this}rotateOnWorldAxis(t,e){return Bm.setFromAxisAngle(t,e),this.quaternion.premultiply(Bm),this}rotateX(t){return this.rotateOnAxis(BN,t)}rotateY(t){return this.rotateOnAxis(VN,t)}rotateZ(t){return this.rotateOnAxis(kN,t)}translateOnAxis(t,e){return IN.copy(t).applyQuaternion(this.quaternion),this.position.add(IN.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(BN,t)}translateY(t){return this.translateOnAxis(VN,t)}translateZ(t){return this.translateOnAxis(kN,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(su.copy(this.matrixWorld).invert())}lookAt(t,e,i){t.isVector3?Rb.copy(t):Rb.set(t,e,i);let r=this.parent;this.updateWorldMatrix(!0,!1),b0.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?su.lookAt(b0,Rb,this.up):su.lookAt(Rb,b0,this.up),this.quaternion.setFromRotationMatrix(su),r&&(su.extractRotation(r.matrixWorld),Bm.setFromRotationMatrix(su),this.quaternion.premultiply(Bm.invert()))}add(t){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(Kt("Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(zN),Vm.child=t,this.dispatchEvent(Vm),Vm.child=null):Kt("Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}let e=this.children.indexOf(t);return e!==-1&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(Qq),MT.child=t,this.dispatchEvent(MT),MT.child=null),this}removeFromParent(){let t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),su.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),su.multiply(t.parent.matrixWorld)),t.applyMatrix4(su),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(zN),Vm.child=t,this.dispatchEvent(Vm),Vm.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let i=0,r=this.children.length;i<r;i++){let s=this.children[i].getObjectByProperty(t,e);if(s!==void 0)return s}}getObjectsByProperty(t,e,i=[]){this[t]===e&&i.push(this);let r=this.children;for(let s=0,n=r.length;s<n;s++)r[s].getObjectsByProperty(t,e,i);return i}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(b0,t,Kq),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(b0,Zq,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);let e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);let e=this.children;for(let i=0,r=e.length;i<r;i++)e[i].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);let e=this.children;for(let i=0,r=e.length;i<r;i++)e[i].traverseVisible(t)}traverseAncestors(t){let e=this.parent;e!==null&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let t=this.pivot;if(t!==null){let e=t.x,i=t.y,r=t.z,s=this.matrix.elements;s[12]+=e-s[0]*e-s[4]*i-s[8]*r,s[13]+=i-s[1]*e-s[5]*i-s[9]*r,s[14]+=r-s[2]*e-s[6]*i-s[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);let e=this.children;for(let i=0,r=e.length;i<r;i++)e[i].updateMatrixWorld(t)}updateWorldMatrix(t,e,i=!1){let r=this.parent;if(t===!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),e===!0){let s=this.children;for(let n=0,a=s.length;n<a;n++)s[n].updateWorldMatrix(!1,!0,i)}}toJSON(t){let e=t===void 0||typeof t=="string",i={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let r={};function s(a,o){return a[o.uuid]===void 0&&(a[o.uuid]=o.toJSON(t)),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(t),r.indirectTexture=this._indirectTexture.toJSON(t),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(t)),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(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(t.geometries,this.geometry);let a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){let o=a.shapes;if(Array.isArray(o))for(let l=0,u=o.length;l<u;l++){let h=o[l];s(t.shapes,h)}else s(t.shapes,o)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(t.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(s(t.materials,this.material[o]));r.material=a}else r.material=s(t.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(t).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(s(t.animations,o))}}if(e){let a=n(t.geometries),o=n(t.materials),l=n(t.textures),u=n(t.images),h=n(t.shapes),d=n(t.skeletons),c=n(t.animations),p=n(t.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 n(a){let o=[];for(let l in a){let u=a[l];delete u.metadata,o.push(u)}return o}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.pivot=t.pivot!==null?t.pivot.clone():null,this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.static=t.static,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(let i=0;i<t.children.length;i++){let r=t.children[i];this.add(r.clone())}return this}}).DEFAULT_UP=new P(0,1,0),hr.DEFAULT_MATRIX_AUTO_UPDATE=!0,hr.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0,Hv=class extends hr{constructor(){super(),this.isGroup=!0,this.type="Group"}},LN={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},od={h:0,s:0,l:0},Nb={h:0,s:0,l:0},oe=class{constructor(t,e,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,i)}set(t,e,i){if(e===void 0&&i===void 0){let r=t;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(t,e,i);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=Ns){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,Qi.colorSpaceToWorking(this,e),this}setRGB(t,e,i,r=Qi.workingColorSpace){return this.r=t,this.g=e,this.b=i,Qi.colorSpaceToWorking(this,r),this}setHSL(t,e,i,r=Qi.workingColorSpace){if(t=wF(t,1),e=ei(e,0,1),i=ei(i,0,1),e===0)this.r=this.g=this.b=i;else{let s=i<=.5?i*(1+e):i+e-i*e,n=2*i-s;this.r=_N(n,s,t+1/3),this.g=_N(n,s,t),this.b=_N(n,s,t-1/3)}return Qi.colorSpaceToWorking(this,r),this}setStyle(t,e=Ns){function i(s){s!==void 0&&parseFloat(s)<1&&ae("Color: Alpha component of "+t+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(t)){let s,n=r[1],a=r[2];switch(n){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,e);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,e);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,e);break;default:ae("Color: Unknown color model "+t)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(t)){let s=r[1],n=s.length;if(n===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,e);if(n===6)return this.setHex(parseInt(s,16),e);ae("Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=Ns){let i=LN[t.toLowerCase()];return i!==void 0?this.setHex(i,e):ae("Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=nd(t.r),this.g=nd(t.g),this.b=nd(t.b),this}copyLinearToSRGB(t){return this.r=y0(t.r),this.g=y0(t.g),this.b=y0(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=Ns){return Qi.workingToColorSpace(ca.copy(this),t),65536*Math.round(ei(255*ca.r,0,255))+256*Math.round(ei(255*ca.g,0,255))+Math.round(ei(255*ca.b,0,255))}getHexString(t=Ns){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Qi.workingColorSpace){Qi.workingToColorSpace(ca.copy(this),e);let i,r,s=ca.r,n=ca.g,a=ca.b,o=Math.max(s,n,a),l=Math.min(s,n,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 s:i=(n-a)/h+(n<a?6:0);break;case n:i=(a-s)/h+2;break;case a:i=(s-n)/h+4}i/=6}return t.h=i,t.s=r,t.l=u,t}getRGB(t,e=Qi.workingColorSpace){return Qi.workingToColorSpace(ca.copy(this),e),t.r=ca.r,t.g=ca.g,t.b=ca.b,t}getStyle(t=Ns){Qi.workingToColorSpace(ca.copy(this),t);let e=ca.r,i=ca.g,r=ca.b;return t!==Ns?`color(${t} ${e.toFixed(3)} ${i.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(255*e)},${Math.round(255*i)},${Math.round(255*r)})`}offsetHSL(t,e,i){return this.getHSL(od),this.setHSL(od.h+t,od.s+e,od.l+i)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,i){return this.r=t.r+(e.r-t.r)*i,this.g=t.g+(e.g-t.g)*i,this.b=t.b+(e.b-t.b)*i,this}lerpHSL(t,e){this.getHSL(od),t.getHSL(Nb);let i=xw(od.h,Nb.h,e),r=xw(od.s,Nb.s,e),s=xw(od.l,Nb.l,e);return this.setHSL(i,r,s),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){let e=this.r,i=this.g,r=this.b,s=t.elements;return this.r=s[0]*e+s[3]*i+s[6]*r,this.g=s[1]*e+s[4]*i+s[7]*r,this.b=s[2]*e+s[5]*i+s[8]*r,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},ca=new oe,oe.NAMES=LN,BF=class{constructor(t,e=1,i=1e3){this.isFog=!0,this.name="",this.color=new oe(t),this.near=e,this.far=i}clone(){return new BF(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}},Ku=class extends hr{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 ur,this.environmentIntensity=1,this.environmentRotation=new ur,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),t.background!==null&&(this.background=t.background.clone()),t.environment!==null&&(this.environment=t.environment.clone()),t.fog!==null&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),t.overrideMaterial!==null&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){let e=super.toJSON(t);return this.fog!==null&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}},Cl=new P,nu=new P,AT=new P,au=new P,km=new P,zm=new P,FN=new P,CT=new P,ET=new P,PT=new P,RT=new Ae,NT=new Ae,DT=new Ae,Os=class{constructor(t=new P,e=new P,i=new P){this.a=t,this.b=e,this.c=i}static getNormal(t,e,i,r){r.subVectors(i,e),Cl.subVectors(t,e),r.cross(Cl);let s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(t,e,i,r,s){Cl.subVectors(r,e),nu.subVectors(i,e),AT.subVectors(t,e);let n=Cl.dot(Cl),a=Cl.dot(nu),o=Cl.dot(AT),l=nu.dot(nu),u=nu.dot(AT),h=n*l-a*a;if(h===0)return s.set(0,0,0),null;let d=1/h,c=(l*o-a*u)*d,p=(n*u-a*o)*d;return s.set(1-c-p,p,c)}static containsPoint(t,e,i,r){return this.getBarycoord(t,e,i,r,au)!==null&&au.x>=0&&au.y>=0&&au.x+au.y<=1}static getInterpolation(t,e,i,r,s,n,a,o){return this.getBarycoord(t,e,i,r,au)===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(s,au.x),o.addScaledVector(n,au.y),o.addScaledVector(a,au.z),o)}static getInterpolatedAttribute(t,e,i,r,s,n){return RT.setScalar(0),NT.setScalar(0),DT.setScalar(0),RT.fromBufferAttribute(t,e),NT.fromBufferAttribute(t,i),DT.fromBufferAttribute(t,r),n.setScalar(0),n.addScaledVector(RT,s.x),n.addScaledVector(NT,s.y),n.addScaledVector(DT,s.z),n}static isFrontFacing(t,e,i,r){return Cl.subVectors(i,e),nu.subVectors(t,e),Cl.cross(nu).dot(r)<0}set(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this}setFromPointsAndIndices(t,e,i,r){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[r]),this}setFromAttributeAndIndices(t,e,i,r){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,i),this.c.fromBufferAttribute(t,r),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Cl.subVectors(this.c,this.b),nu.subVectors(this.a,this.b),.5*Cl.cross(nu).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return Os.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return Os.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,i,r,s){return Os.getInterpolation(t,this.a,this.b,this.c,e,i,r,s)}containsPoint(t){return Os.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return Os.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){let i,r,s=this.a,n=this.b,a=this.c;km.subVectors(n,s),zm.subVectors(a,s),CT.subVectors(t,s);let o=km.dot(CT),l=zm.dot(CT);if(o<=0&&l<=0)return e.copy(s);ET.subVectors(t,n);let u=km.dot(ET),h=zm.dot(ET);if(u>=0&&h<=u)return e.copy(n);let d=o*h-u*l;if(d<=0&&o>=0&&u<=0)return i=o/(o-u),e.copy(s).addScaledVector(km,i);PT.subVectors(t,a);let c=km.dot(PT),p=zm.dot(PT);if(p>=0&&c<=p)return e.copy(a);let m=c*l-o*p;if(m<=0&&l>=0&&p<=0)return r=l/(l-p),e.copy(s).addScaledVector(zm,r);let f=u*p-c*h;if(f<=0&&h-u>=0&&c-p>=0)return FN.subVectors(a,n),r=(h-u)/(h-u+(c-p)),e.copy(n).addScaledVector(FN,r);let g=1/(f+m+d);return i=m*g,r=d*g,e.copy(s).addScaledVector(km,i).addScaledVector(zm,r)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},dr=class{constructor(t=new P(1/0,1/0,1/0),e=new P(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e+=3)this.expandByPoint(El.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,i=t.count;e<i;e++)this.expandByPoint(El.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){let i=El.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);let i=t.geometry;if(i!==void 0){let s=i.getAttribute("position");if(e===!0&&s!==void 0&&t.isInstancedMesh!==!0)for(let n=0,a=s.count;n<a;n++)t.isMesh===!0?t.getVertexPosition(n,El):El.fromBufferAttribute(s,n),El.applyMatrix4(t.matrixWorld),this.expandByPoint(El);else t.boundingBox!==void 0?(t.boundingBox===null&&t.computeBoundingBox(),Db.copy(t.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),Db.copy(i.boundingBox)),Db.applyMatrix4(t.matrixWorld),this.union(Db)}let r=t.children;for(let s=0,n=r.length;s<n;s++)this.expandByObject(r[s],e);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,El),El.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(_0),Ob.subVectors(this.max,_0),Lm.subVectors(t.a,_0),Fm.subVectors(t.b,_0),Um.subVectors(t.c,_0),ld.subVectors(Fm,Lm),hd.subVectors(Um,Fm),Lc.subVectors(Lm,Um);let e=[0,-ld.z,ld.y,0,-hd.z,hd.y,0,-Lc.z,Lc.y,ld.z,0,-ld.x,hd.z,0,-hd.x,Lc.z,0,-Lc.x,-ld.y,ld.x,0,-hd.y,hd.x,0,-Lc.y,Lc.x,0];return!(!xN(e,Lm,Fm,Um,Ob)||(e=[1,0,0,0,1,0,0,0,1],!xN(e,Lm,Fm,Um,Ob)))&&(Ib.crossVectors(ld,hd),e=[Ib.x,Ib.y,Ib.z],xN(e,Lm,Fm,Um,Ob))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,El).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(El).length()),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(ou[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),ou[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),ou[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),ou[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),ou[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),ou[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),ou[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),ou[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(ou)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(t){return this.min.fromArray(t.min),this.max.fromArray(t.max),this}},ou=[new P,new P,new P,new P,new P,new P,new P,new P],El=new P,Db=new dr,Lm=new P,Fm=new P,Um=new P,ld=new P,hd=new P,Lc=new P,_0=new P,Ob=new P,Ib=new P,Ep=new P,Fu=function(){let t=new ArrayBuffer(4),e=new Float32Array(t),i=new Uint32Array(t),r=new Uint32Array(512),s=new Uint32Array(512);for(let l=0;l<256;++l){let u=l-127;u<-27?(r[l]=0,r[256|l]=32768,s[l]=24,s[256|l]=24):u<-14?(r[l]=1024>>-u-14,r[256|l]=1024>>-u-14|32768,s[l]=-u-1,s[256|l]=-u-1):u<=15?(r[l]=u+15<<10,r[256|l]=u+15<<10|32768,s[l]=13,s[256|l]=13):u<128?(r[l]=31744,r[256|l]=64512,s[l]=24,s[256|l]=24):(r[l]=31744,r[256|l]=64512,s[l]=13,s[256|l]=13)}let n=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,n[l]=u|h}for(let l=1024;l<2048;++l)n[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)a[l]=l<<23;a[31]=1199570944,a[32]=2147483648;for(let l=33;l<63;++l)a[l]=2147483648+(l-32<<23);a[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(o[l]=1024);return{floatView:e,uint32View:i,baseTable:r,shiftTable:s,mantissaTable:n,exponentTable:a,offsetTable:o}}(),Xh=class{static toHalfFloat(t){return _o(t)}static fromHalfFloat(t){return Tb(t)}},zs=new P,Bb=new Z,Jq=0,Se=class extends Kn{constructor(t,e,i=!1){if(super(),Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Jq++}),this.name="",this.array=t,this.itemSize=e,this.count=t!==void 0?t.length/e:0,this.normalized=i,this.usage=yg,this.updateRanges=[],this.gpuType=Je,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,i){t*=this.itemSize,i*=e.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[t+r]=e.array[i+r];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(this.itemSize===2)for(let e=0,i=this.count;e<i;e++)Bb.fromBufferAttribute(this,e),Bb.applyMatrix3(t),this.setXY(e,Bb.x,Bb.y);else if(this.itemSize===3)for(let e=0,i=this.count;e<i;e++)zs.fromBufferAttribute(this,e),zs.applyMatrix3(t),this.setXYZ(e,zs.x,zs.y,zs.z);return this}applyMatrix4(t){for(let e=0,i=this.count;e<i;e++)zs.fromBufferAttribute(this,e),zs.applyMatrix4(t),this.setXYZ(e,zs.x,zs.y,zs.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)zs.fromBufferAttribute(this,e),zs.applyNormalMatrix(t),this.setXYZ(e,zs.x,zs.y,zs.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)zs.fromBufferAttribute(this,e),zs.transformDirection(t),this.setXYZ(e,zs.x,zs.y,zs.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let i=this.array[t*this.itemSize+e];return this.normalized&&(i=so(i,this.array)),i}setComponent(t,e,i){return this.normalized&&(i=yi(i,this.array)),this.array[t*this.itemSize+e]=i,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=so(e,this.array)),e}setX(t,e){return this.normalized&&(e=yi(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=so(e,this.array)),e}setY(t,e){return this.normalized&&(e=yi(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=so(e,this.array)),e}setZ(t,e){return this.normalized&&(e=yi(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=so(e,this.array)),e}setW(t,e){return this.normalized&&(e=yi(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,i){return t*=this.itemSize,this.normalized&&(e=yi(e,this.array),i=yi(i,this.array)),this.array[t+0]=e,this.array[t+1]=i,this}setXYZ(t,e,i,r){return t*=this.itemSize,this.normalized&&(e=yi(e,this.array),i=yi(i,this.array),r=yi(r,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=r,this}setXYZW(t,e,i,r,s){return t*=this.itemSize,this.normalized&&(e=yi(e,this.array),i=yi(i,this.array),r=yi(r,this.array),s=yi(s,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=r,this.array[t+3]=s,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(t.name=this.name),this.usage!==yg&&(t.usage=this.usage),t}dispose(){this.dispatchEvent({type:"dispose"})}},VF=class extends Se{constructor(t,e,i){super(new Uint16Array(t),e,i)}},sm=class extends Se{constructor(t,e,i){super(new Uint32Array(t),e,i)}},kF=class extends Se{constructor(t,e,i){super(new Uint16Array(t),e,i),this.isFloat16BufferAttribute=!0}getX(t){let e=Tb(this.array[t*this.itemSize]);return this.normalized&&(e=so(e,this.array)),e}setX(t,e){return this.normalized&&(e=yi(e,this.array)),this.array[t*this.itemSize]=_o(e),this}getY(t){let e=Tb(this.array[t*this.itemSize+1]);return this.normalized&&(e=so(e,this.array)),e}setY(t,e){return this.normalized&&(e=yi(e,this.array)),this.array[t*this.itemSize+1]=_o(e),this}getZ(t){let e=Tb(this.array[t*this.itemSize+2]);return this.normalized&&(e=so(e,this.array)),e}setZ(t,e){return this.normalized&&(e=yi(e,this.array)),this.array[t*this.itemSize+2]=_o(e),this}getW(t){let e=Tb(this.array[t*this.itemSize+3]);return this.normalized&&(e=so(e,this.array)),e}setW(t,e){return this.normalized&&(e=yi(e,this.array)),this.array[t*this.itemSize+3]=_o(e),this}setXY(t,e,i){return t*=this.itemSize,this.normalized&&(e=yi(e,this.array),i=yi(i,this.array)),this.array[t+0]=_o(e),this.array[t+1]=_o(i),this}setXYZ(t,e,i,r){return t*=this.itemSize,this.normalized&&(e=yi(e,this.array),i=yi(i,this.array),r=yi(r,this.array)),this.array[t+0]=_o(e),this.array[t+1]=_o(i),this.array[t+2]=_o(r),this}setXYZW(t,e,i,r,s){return t*=this.itemSize,this.normalized&&(e=yi(e,this.array),i=yi(i,this.array),r=yi(r,this.array),s=yi(s,this.array)),this.array[t+0]=_o(e),this.array[t+1]=_o(i),this.array[t+2]=_o(r),this.array[t+3]=_o(s),this}},me=class extends Se{constructor(t,e,i){super(new Float32Array(t),e,i)}},tH=new dr,x0=new P,OT=new P,Zn=class{constructor(t=new P,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){let i=this.center;e!==void 0?i.copy(e):tH.setFromPoints(t).getCenter(i);let r=0;for(let s=0,n=t.length;s<n;s++)r=Math.max(r,i.distanceToSquared(t[s]));return this.radius=Math.sqrt(r),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){let e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){let i=this.center.distanceToSquared(t);return e.copy(t),i>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;x0.subVectors(t,this.center);let e=x0.lengthSq();if(e>this.radius*this.radius){let i=Math.sqrt(e),r=.5*(i-this.radius);this.center.addScaledVector(x0,r/i),this.radius+=r}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):(OT.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(x0.copy(t.center).add(OT)),this.expandByPoint(x0.copy(t.center).sub(OT))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(t){return this.radius=t.radius,this.center.fromArray(t.center),this}},eH=0,$o=new At,IT=new hr,jm=new P,wo=new dr,w0=new dr,fn=new P,ye=class extends Kn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:eH++}),this.uuid=Ml(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(function(e){for(let i=e.length-1;i>=0;--i)if(e[i]>=65535)return!0;return!1}(t)?sm:VF)(t,1):this.index=t,this}setIndirect(t,e=0){return this.indirect=t,this.indirectOffset=e,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return this.attributes[t]!==void 0}addGroup(t,e,i=0){this.groups.push({start:t,count:e,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){let e=this.attributes.position;e!==void 0&&(e.applyMatrix4(t),e.needsUpdate=!0);let i=this.attributes.normal;if(i!==void 0){let s=new Ss().getNormalMatrix(t);i.applyNormalMatrix(s),i.needsUpdate=!0}let r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(t),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(t){return $o.makeRotationFromQuaternion(t),this.applyMatrix4($o),this}rotateX(t){return $o.makeRotationX(t),this.applyMatrix4($o),this}rotateY(t){return $o.makeRotationY(t),this.applyMatrix4($o),this}rotateZ(t){return $o.makeRotationZ(t),this.applyMatrix4($o),this}translate(t,e,i){return $o.makeTranslation(t,e,i),this.applyMatrix4($o),this}scale(t,e,i){return $o.makeScale(t,e,i),this.applyMatrix4($o),this}lookAt(t){return IT.lookAt(t),IT.updateMatrix(),this.applyMatrix4(IT.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(jm).negate(),this.translate(jm.x,jm.y,jm.z),this}setFromPoints(t){let e=this.getAttribute("position");if(e===void 0){let i=[];for(let r=0,s=t.length;r<s;r++){let n=t[r];i.push(n.x,n.y,n.z||0)}this.setAttribute("position",new me(i,3))}else{let i=Math.min(t.length,e.count);for(let r=0;r<i;r++){let s=t[r];e.setXYZ(r,s.x,s.y,s.z||0)}t.length>e.count&&ae("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new dr);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return Kt("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(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),e)for(let i=0,r=e.length;i<r;i++){let s=e[i];wo.setFromBufferAttribute(s),this.morphTargetsRelative?(fn.addVectors(this.boundingBox.min,wo.min),this.boundingBox.expandByPoint(fn),fn.addVectors(this.boundingBox.max,wo.max),this.boundingBox.expandByPoint(fn)):(this.boundingBox.expandByPoint(wo.min),this.boundingBox.expandByPoint(wo.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Kt('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 Zn);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return Kt("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),void this.boundingSphere.set(new P,1/0);if(t){let i=this.boundingSphere.center;if(wo.setFromBufferAttribute(t),e)for(let s=0,n=e.length;s<n;s++){let a=e[s];w0.setFromBufferAttribute(a),this.morphTargetsRelative?(fn.addVectors(wo.min,w0.min),wo.expandByPoint(fn),fn.addVectors(wo.max,w0.max),wo.expandByPoint(fn)):(wo.expandByPoint(w0.min),wo.expandByPoint(w0.max))}wo.getCenter(i);let r=0;for(let s=0,n=t.count;s<n;s++)fn.fromBufferAttribute(t,s),r=Math.max(r,i.distanceToSquared(fn));if(e)for(let s=0,n=e.length;s<n;s++){let a=e[s],o=this.morphTargetsRelative;for(let l=0,u=a.count;l<u;l++)fn.fromBufferAttribute(a,l),o&&(jm.fromBufferAttribute(t,l),fn.add(jm)),r=Math.max(r,i.distanceToSquared(fn))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&Kt('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let t=this.index,e=this.attributes;if(t===null||e.position===void 0||e.normal===void 0||e.uv===void 0)return void Kt("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");let i=e.position,r=e.normal,s=e.uv,n=this.getAttribute("tangent");(n===void 0||n.count!==i.count)&&(n=new Se(new Float32Array(4*i.count),4),this.setAttribute("tangent",n));let a=[],o=[];for(let w=0;w<i.count;w++)a[w]=new P,o[w]=new P;let l=new P,u=new P,h=new P,d=new Z,c=new Z,p=new Z,m=new P,f=new P;function g(w,M,T){l.fromBufferAttribute(i,w),u.fromBufferAttribute(i,M),h.fromBufferAttribute(i,T),d.fromBufferAttribute(s,w),c.fromBufferAttribute(s,M),p.fromBufferAttribute(s,T),u.sub(l),h.sub(l),c.sub(d),p.sub(d);let A=1/(c.x*p.y-p.x*c.y);!isFinite(A)||(m.copy(u).multiplyScalar(p.y).addScaledVector(h,-c.y).multiplyScalar(A),f.copy(h).multiplyScalar(c.x).addScaledVector(u,-p.x).multiplyScalar(A),a[w].add(m),a[M].add(m),a[T].add(m),o[w].add(f),o[M].add(f),o[T].add(f))}let y=this.groups;y.length===0&&(y=[{start:0,count:t.count}]);for(let w=0,M=y.length;w<M;++w){let T=y[w],A=T.start;for(let C=A,R=A+T.count;C<R;C+=3)g(t.getX(C+0),t.getX(C+1),t.getX(C+2))}let v=new P,b=new P,_=new P,x=new P;function S(w){_.fromBufferAttribute(r,w),x.copy(_);let M=a[w];v.copy(M),v.sub(_.multiplyScalar(_.dot(M))).normalize(),b.crossVectors(x,M);let T=b.dot(o[w])<0?-1:1;n.setXYZW(w,v.x,v.y,v.z,T)}for(let w=0,M=y.length;w<M;++w){let T=y[w],A=T.start;for(let C=A,R=A+T.count;C<R;C+=3)S(t.getX(C+0)),S(t.getX(C+1)),S(t.getX(C+2))}this._transformed=!0}computeVertexNormals(){let t=this.index,e=this.getAttribute("position");if(e!==void 0){let i=this.getAttribute("normal");if(i===void 0||i.count!==e.count)i=new Se(new Float32Array(3*e.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,s=new P,n=new P,a=new P,o=new P,l=new P,u=new P,h=new P;if(t)for(let d=0,c=t.count;d<c;d+=3){let p=t.getX(d+0),m=t.getX(d+1),f=t.getX(d+2);r.fromBufferAttribute(e,p),s.fromBufferAttribute(e,m),n.fromBufferAttribute(e,f),u.subVectors(n,s),h.subVectors(r,s),u.cross(h),a.fromBufferAttribute(i,p),o.fromBufferAttribute(i,m),l.fromBufferAttribute(i,f),a.add(u),o.add(u),l.add(u),i.setXYZ(p,a.x,a.y,a.z),i.setXYZ(m,o.x,o.y,o.z),i.setXYZ(f,l.x,l.y,l.z)}else for(let d=0,c=e.count;d<c;d+=3)r.fromBufferAttribute(e,d+0),s.fromBufferAttribute(e,d+1),n.fromBufferAttribute(e,d+2),u.subVectors(n,s),h.subVectors(r,s),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 t=this.attributes.normal;for(let e=0,i=t.count;e<i;e++)fn.fromBufferAttribute(t,e),fn.normalize(),t.setXYZ(e,fn.x,fn.y,fn.z)}toNonIndexed(){function t(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 m=0,f=o.length;m<f;m++){c=a.isInterleavedBufferAttribute?o[m]*a.data.stride+a.offset:o[m]*u;for(let g=0;g<u;g++)d[p++]=l[c++]}return new Se(d,u,h)}if(this.index===null)return ae("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let e=new ye,i=this.index.array,r=this.attributes;for(let a in r){let o=t(r[a],i);e.setAttribute(a,o)}let s=this.morphAttributes;for(let a in s){let o=[],l=s[a];for(let u=0,h=l.length;u<h;u++){let d=t(l[u],i);o.push(d)}e.morphAttributes[a]=o}e.morphTargetsRelative=this.morphTargetsRelative;let n=this.groups;for(let a=0,o=n.length;a<o;a++){let l=n[a];e.addGroup(l.start,l.count,l.materialIndex)}return e}toJSON(){let t={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,this.name!==""&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){let o=this.parameters;for(let l in o)o[l]!==void 0&&(t[l]=o[l]);return t}t.data={attributes:{}};let e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});let i=this.attributes;for(let o in i){let l=i[o];t.data.attributes[o]=l.toJSON(t.data)}let r={},s=!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(t.data))}u.length>0&&(r[o]=u,s=!0)}s&&(t.data.morphAttributes=r,t.data.morphTargetsRelative=this.morphTargetsRelative);let n=this.groups;n.length>0&&(t.data.groups=JSON.parse(JSON.stringify(n)));let a=this.boundingSphere;return a!==null&&(t.data.boundingSphere=a.toJSON()),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let e={};this.name=t.name;let i=t.index;i!==null&&this.setIndex(i.clone());let r=t.attributes;for(let l in r){let u=r[l];this.setAttribute(l,u.clone(e))}let s=t.morphAttributes;for(let l in s){let u=[],h=s[l];for(let d=0,c=h.length;d<c;d++)u.push(h[d].clone(e));this.morphAttributes[l]=u}this.morphTargetsRelative=t.morphTargetsRelative;let n=t.groups;for(let l=0,u=n.length;l<u;l++){let h=n[l];this.addGroup(h.start,h.count,h.materialIndex)}let a=t.boundingBox;a!==null&&(this.boundingBox=a.clone());let o=t.boundingSphere;return o!==null&&(this.boundingSphere=o.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this._transformed=t._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}},G1=class{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=t!==void 0?t.length/e:0,this.usage=yg,this.updateRanges=[],this.version=0,this.uuid=Ml()}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,i){t*=this.stride,i*=e.stride;for(let r=0,s=this.stride;r<s;r++)this.array[t+r]=e.array[i+r];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Ml()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(e,this.stride);return i.setUsage(this.usage),i}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Ml()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}},Ba=new P,Vp=class{constructor(t,e,i,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=e,this.offset=i,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,i=this.data.count;e<i;e++)Ba.fromBufferAttribute(this,e),Ba.applyMatrix4(t),this.setXYZ(e,Ba.x,Ba.y,Ba.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)Ba.fromBufferAttribute(this,e),Ba.applyNormalMatrix(t),this.setXYZ(e,Ba.x,Ba.y,Ba.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)Ba.fromBufferAttribute(this,e),Ba.transformDirection(t),this.setXYZ(e,Ba.x,Ba.y,Ba.z);return this}getComponent(t,e){let i=this.array[t*this.data.stride+this.offset+e];return this.normalized&&(i=so(i,this.array)),i}setComponent(t,e,i){return this.normalized&&(i=yi(i,this.array)),this.data.array[t*this.data.stride+this.offset+e]=i,this}setX(t,e){return this.normalized&&(e=yi(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.normalized&&(e=yi(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.normalized&&(e=yi(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.normalized&&(e=yi(e,this.array)),this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){let e=this.data.array[t*this.data.stride+this.offset];return this.normalized&&(e=so(e,this.array)),e}getY(t){let e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=so(e,this.array)),e}getZ(t){let e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=so(e,this.array)),e}getW(t){let e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=so(e,this.array)),e}setXY(t,e,i){return t=t*this.data.stride+this.offset,this.normalized&&(e=yi(e,this.array),i=yi(i,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=i,this}setXYZ(t,e,i,r){return t=t*this.data.stride+this.offset,this.normalized&&(e=yi(e,this.array),i=yi(i,this.array),r=yi(r,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=r,this}setXYZW(t,e,i,r,s){return t=t*this.data.stride+this.offset,this.normalized&&(e=yi(e,this.array),i=yi(i,this.array),r=yi(r,this.array),s=yi(s,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=r,this.data.array[t+3]=s,this}clone(t){if(t===void 0){xF("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let i=0;i<this.count;i++){let r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)e.push(this.data.array[r+s])}return new Se(new this.array.constructor(e),this.itemSize,this.normalized)}return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new Vp(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(t===void 0){xF("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let i=0;i<this.count;i++){let r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)e.push(this.data.array[r+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}},iH=0,ho=class extends Kn{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:iH++}),this.uuid=Ml(),this.name="",this.type="Material",this.blending=zh,this.side=Hh,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=_2,this.blendDst=Og,this.blendEquation=iv,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new oe(0,0,0),this.blendAlpha=0,this.depthFunc=f1,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=tP,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Cp,this.stencilZFail=Cp,this.stencilZPass=Cp,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(t!==void 0)for(let e in t){let i=t[e];if(i===void 0){ae(`Material: parameter '${e}' has value of undefined.`);continue}let r=this[e];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[e]=i:ae(`Material: '${e}' is not a property of THREE.${this.type}.`)}}toJSON(t){let e=t===void 0||typeof t=="string";e&&(t={textures:{},images:{}});let i={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};function r(s){let n=[];for(let a in s){let o=s[a];delete o.metadata,n.push(o)}return n}if(i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(t).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(t).uuid),this.dispersion!==void 0&&(i.dispersion=this.dispersion),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(t).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(t).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(t).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(t).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==zh&&(i.blending=this.blending),this.side!==Hh&&(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!==_2&&(i.blendSrc=this.blendSrc),this.blendDst!==Og&&(i.blendDst=this.blendDst),this.blendEquation!==iv&&(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!==f1&&(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!==tP&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Cp&&(i.stencilFail=this.stencilFail),this.stencilZFail!==Cp&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==Cp&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.allowOverride===!1&&(i.allowOverride=!1),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData),e){let s=r(t.textures),n=r(t.images);s.length>0&&(i.textures=s),n.length>0&&(i.images=n)}return i}fromJSON(t,e){if(t.uuid!==void 0&&(this.uuid=t.uuid),t.name!==void 0&&(this.name=t.name),t.color!==void 0&&this.color!==void 0&&this.color.setHex(t.color),t.roughness!==void 0&&(this.roughness=t.roughness),t.metalness!==void 0&&(this.metalness=t.metalness),t.sheen!==void 0&&(this.sheen=t.sheen),t.sheenColor!==void 0&&(this.sheenColor=new oe().setHex(t.sheenColor)),t.sheenRoughness!==void 0&&(this.sheenRoughness=t.sheenRoughness),t.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(t.emissive),t.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(t.specular),t.specularIntensity!==void 0&&(this.specularIntensity=t.specularIntensity),t.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(t.specularColor),t.shininess!==void 0&&(this.shininess=t.shininess),t.clearcoat!==void 0&&(this.clearcoat=t.clearcoat),t.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=t.clearcoatRoughness),t.dispersion!==void 0&&(this.dispersion=t.dispersion),t.iridescence!==void 0&&(this.iridescence=t.iridescence),t.iridescenceIOR!==void 0&&(this.iridescenceIOR=t.iridescenceIOR),t.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=t.iridescenceThicknessRange),t.transmission!==void 0&&(this.transmission=t.transmission),t.thickness!==void 0&&(this.thickness=t.thickness),t.attenuationDistance!==void 0&&(this.attenuationDistance=t.attenuationDistance),t.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(t.attenuationColor),t.anisotropy!==void 0&&(this.anisotropy=t.anisotropy),t.anisotropyRotation!==void 0&&(this.anisotropyRotation=t.anisotropyRotation),t.fog!==void 0&&(this.fog=t.fog),t.flatShading!==void 0&&(this.flatShading=t.flatShading),t.blending!==void 0&&(this.blending=t.blending),t.combine!==void 0&&(this.combine=t.combine),t.side!==void 0&&(this.side=t.side),t.shadowSide!==void 0&&(this.shadowSide=t.shadowSide),t.opacity!==void 0&&(this.opacity=t.opacity),t.transparent!==void 0&&(this.transparent=t.transparent),t.alphaTest!==void 0&&(this.alphaTest=t.alphaTest),t.alphaHash!==void 0&&(this.alphaHash=t.alphaHash),t.depthFunc!==void 0&&(this.depthFunc=t.depthFunc),t.depthTest!==void 0&&(this.depthTest=t.depthTest),t.depthWrite!==void 0&&(this.depthWrite=t.depthWrite),t.colorWrite!==void 0&&(this.colorWrite=t.colorWrite),t.blendSrc!==void 0&&(this.blendSrc=t.blendSrc),t.blendDst!==void 0&&(this.blendDst=t.blendDst),t.blendEquation!==void 0&&(this.blendEquation=t.blendEquation),t.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=t.blendSrcAlpha),t.blendDstAlpha!==void 0&&(this.blendDstAlpha=t.blendDstAlpha),t.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=t.blendEquationAlpha),t.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(t.blendColor),t.blendAlpha!==void 0&&(this.blendAlpha=t.blendAlpha),t.stencilWriteMask!==void 0&&(this.stencilWriteMask=t.stencilWriteMask),t.stencilFunc!==void 0&&(this.stencilFunc=t.stencilFunc),t.stencilRef!==void 0&&(this.stencilRef=t.stencilRef),t.stencilFuncMask!==void 0&&(this.stencilFuncMask=t.stencilFuncMask),t.stencilFail!==void 0&&(this.stencilFail=t.stencilFail),t.stencilZFail!==void 0&&(this.stencilZFail=t.stencilZFail),t.stencilZPass!==void 0&&(this.stencilZPass=t.stencilZPass),t.stencilWrite!==void 0&&(this.stencilWrite=t.stencilWrite),t.wireframe!==void 0&&(this.wireframe=t.wireframe),t.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=t.wireframeLinewidth),t.wireframeLinecap!==void 0&&(this.wireframeLinecap=t.wireframeLinecap),t.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=t.wireframeLinejoin),t.rotation!==void 0&&(this.rotation=t.rotation),t.linewidth!==void 0&&(this.linewidth=t.linewidth),t.dashSize!==void 0&&(this.dashSize=t.dashSize),t.gapSize!==void 0&&(this.gapSize=t.gapSize),t.scale!==void 0&&(this.scale=t.scale),t.polygonOffset!==void 0&&(this.polygonOffset=t.polygonOffset),t.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=t.polygonOffsetFactor),t.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=t.polygonOffsetUnits),t.dithering!==void 0&&(this.dithering=t.dithering),t.alphaToCoverage!==void 0&&(this.alphaToCoverage=t.alphaToCoverage),t.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=t.premultipliedAlpha),t.forceSinglePass!==void 0&&(this.forceSinglePass=t.forceSinglePass),t.allowOverride!==void 0&&(this.allowOverride=t.allowOverride),t.visible!==void 0&&(this.visible=t.visible),t.toneMapped!==void 0&&(this.toneMapped=t.toneMapped),t.userData!==void 0&&(this.userData=t.userData),t.vertexColors!==void 0&&(typeof t.vertexColors=="number"?this.vertexColors=t.vertexColors>0:this.vertexColors=t.vertexColors),t.size!==void 0&&(this.size=t.size),t.sizeAttenuation!==void 0&&(this.sizeAttenuation=t.sizeAttenuation),t.map!==void 0&&(this.map=e[t.map]||null),t.matcap!==void 0&&(this.matcap=e[t.matcap]||null),t.alphaMap!==void 0&&(this.alphaMap=e[t.alphaMap]||null),t.bumpMap!==void 0&&(this.bumpMap=e[t.bumpMap]||null),t.bumpScale!==void 0&&(this.bumpScale=t.bumpScale),t.normalMap!==void 0&&(this.normalMap=e[t.normalMap]||null),t.normalMapType!==void 0&&(this.normalMapType=t.normalMapType),t.normalScale!==void 0){let i=t.normalScale;Array.isArray(i)===!1&&(i=[i,i]),this.normalScale=new Z().fromArray(i)}return t.displacementMap!==void 0&&(this.displacementMap=e[t.displacementMap]||null),t.displacementScale!==void 0&&(this.displacementScale=t.displacementScale),t.displacementBias!==void 0&&(this.displacementBias=t.displacementBias),t.roughnessMap!==void 0&&(this.roughnessMap=e[t.roughnessMap]||null),t.metalnessMap!==void 0&&(this.metalnessMap=e[t.metalnessMap]||null),t.emissiveMap!==void 0&&(this.emissiveMap=e[t.emissiveMap]||null),t.emissiveIntensity!==void 0&&(this.emissiveIntensity=t.emissiveIntensity),t.specularMap!==void 0&&(this.specularMap=e[t.specularMap]||null),t.specularIntensityMap!==void 0&&(this.specularIntensityMap=e[t.specularIntensityMap]||null),t.specularColorMap!==void 0&&(this.specularColorMap=e[t.specularColorMap]||null),t.envMap!==void 0&&(this.envMap=e[t.envMap]||null),t.envMapRotation!==void 0&&this.envMapRotation.fromArray(t.envMapRotation),t.envMapIntensity!==void 0&&(this.envMapIntensity=t.envMapIntensity),t.reflectivity!==void 0&&(this.reflectivity=t.reflectivity),t.refractionRatio!==void 0&&(this.refractionRatio=t.refractionRatio),t.lightMap!==void 0&&(this.lightMap=e[t.lightMap]||null),t.lightMapIntensity!==void 0&&(this.lightMapIntensity=t.lightMapIntensity),t.aoMap!==void 0&&(this.aoMap=e[t.aoMap]||null),t.aoMapIntensity!==void 0&&(this.aoMapIntensity=t.aoMapIntensity),t.gradientMap!==void 0&&(this.gradientMap=e[t.gradientMap]||null),t.clearcoatMap!==void 0&&(this.clearcoatMap=e[t.clearcoatMap]||null),t.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=e[t.clearcoatRoughnessMap]||null),t.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=e[t.clearcoatNormalMap]||null),t.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new Z().fromArray(t.clearcoatNormalScale)),t.iridescenceMap!==void 0&&(this.iridescenceMap=e[t.iridescenceMap]||null),t.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=e[t.iridescenceThicknessMap]||null),t.transmissionMap!==void 0&&(this.transmissionMap=e[t.transmissionMap]||null),t.thicknessMap!==void 0&&(this.thicknessMap=e[t.thicknessMap]||null),t.anisotropyMap!==void 0&&(this.anisotropyMap=e[t.anisotropyMap]||null),t.sheenColorMap!==void 0&&(this.sheenColorMap=e[t.sheenColorMap]||null),t.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=e[t.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;let e=t.clippingPlanes,i=null;if(e!==null){let r=e.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=e[s].clone()}return this.clippingPlanes=i,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.allowOverride=t.allowOverride,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){t===!0&&this.version++}},zF=class extends ho{constructor(t){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new oe(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}},T0=new P,Gm=new P,Wm=new P,Qf=new Z,b1=new Z,LF=new At,Vb=new P,M0=new P,kb=new P,UN=new Z,BT=new Z,jN=new Z,FF=class extends hr{constructor(t=new zF){if(super(),this.isSprite=!0,this.type="Sprite",S0===void 0){S0=new ye;let e=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),i=new G1(e,5);S0.setIndex([0,1,2,0,2,3]),S0.setAttribute("position",new Vp(i,3,0,!1)),S0.setAttribute("uv",new Vp(i,2,3,!1))}this.geometry=S0,this.material=t,this.center=new Z(.5,.5),this.count=1}raycast(t,e){t.camera===null&&Kt('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Gm.setFromMatrixScale(this.matrixWorld),LF.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),Wm.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Gm.multiplyScalar(-Wm.z);let i,r,s=this.material.rotation;s!==0&&(r=Math.cos(s),i=Math.sin(s));let n=this.center;pT(Vb.set(-.5,-.5,0),Wm,n,Gm,i,r),pT(M0.set(.5,-.5,0),Wm,n,Gm,i,r),pT(kb.set(.5,.5,0),Wm,n,Gm,i,r),UN.set(0,0),BT.set(1,0),jN.set(1,1);let a=t.ray.intersectTriangle(Vb,M0,kb,!1,T0);if(a===null&&(pT(M0.set(-.5,.5,0),Wm,n,Gm,i,r),BT.set(0,1),a=t.ray.intersectTriangle(Vb,kb,M0,!1,T0),a===null))return;let o=t.ray.origin.distanceTo(T0);o<t.near||o>t.far||e.push({distance:o,point:T0.clone(),uv:Os.getInterpolation(T0,Vb,M0,kb,UN,BT,jN,new Z),face:null,object:this})}copy(t,e){return super.copy(t,e),t.center!==void 0&&this.center.copy(t.center),this.material=t.material,this}},lu=new P,VT=new P,zb=new P,ud=new P,kT=new P,Lb=new P,zT=new P,pc=class{constructor(t=new P,e=new P(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,lu)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);let i=e.dot(this.direction);return i<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){let e=lu.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(lu.copy(this.origin).addScaledVector(this.direction,e),lu.distanceToSquared(t))}distanceSqToSegment(t,e,i,r){VT.copy(t).add(e).multiplyScalar(.5),zb.copy(e).sub(t).normalize(),ud.copy(this.origin).sub(VT);let s,n,a,o,l=.5*t.distanceTo(e),u=-this.direction.dot(zb),h=ud.dot(this.direction),d=-ud.dot(zb),c=ud.lengthSq(),p=Math.abs(1-u*u);if(p>0)if(s=u*d-h,n=u*h-d,o=l*p,s>=0)if(n>=-o)if(n<=o){let m=1/p;s*=m,n*=m,a=s*(s+u*n+2*h)+n*(u*s+n+2*d)+c}else n=l,s=Math.max(0,-(u*n+h)),a=-s*s+n*(n+2*d)+c;else n=-l,s=Math.max(0,-(u*n+h)),a=-s*s+n*(n+2*d)+c;else n<=-o?(s=Math.max(0,-(-u*l+h)),n=s>0?-l:Math.min(Math.max(-l,-d),l),a=-s*s+n*(n+2*d)+c):n<=o?(s=0,n=Math.min(Math.max(-l,-d),l),a=n*(n+2*d)+c):(s=Math.max(0,-(u*l+h)),n=s>0?l:Math.min(Math.max(-l,-d),l),a=-s*s+n*(n+2*d)+c);else n=u>0?-l:l,s=Math.max(0,-(u*n+h)),a=-s*s+n*(n+2*d)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,s),r&&r.copy(VT).addScaledVector(zb,n),a}intersectSphere(t,e){lu.subVectors(t.center,this.origin);let i=lu.dot(this.direction),r=lu.dot(lu)-i*i,s=t.radius*t.radius;if(r>s)return null;let n=Math.sqrt(s-r),a=i-n,o=i+n;return o<0?null:a<0?this.at(o,e):this.at(a,e)}intersectsSphere(t){return!(t.radius<0)&&this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){let e=t.normal.dot(this.direction);if(e===0)return t.distanceToPoint(this.origin)===0?0:null;let i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null}intersectPlane(t,e){let i=this.distanceToPlane(t);return i===null?null:this.at(i,e)}intersectsPlane(t){let e=t.distanceToPoint(this.origin);return e===0||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let i,r,s,n,a,o,l=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,d=this.origin;return l>=0?(i=(t.min.x-d.x)*l,r=(t.max.x-d.x)*l):(i=(t.max.x-d.x)*l,r=(t.min.x-d.x)*l),u>=0?(s=(t.min.y-d.y)*u,n=(t.max.y-d.y)*u):(s=(t.max.y-d.y)*u,n=(t.min.y-d.y)*u),i>n||s>r||((s>i||isNaN(i))&&(i=s),(n<r||isNaN(r))&&(r=n),h>=0?(a=(t.min.z-d.z)*h,o=(t.max.z-d.z)*h):(a=(t.max.z-d.z)*h,o=(t.min.z-d.z)*h),i>o||a>r)||((a>i||i!=i)&&(i=a),(o<r||r!=r)&&(r=o),r<0)?null:this.at(i>=0?i:r,e)}intersectsBox(t){return this.intersectBox(t,lu)!==null}intersectTriangle(t,e,i,r,s){kT.subVectors(e,t),Lb.subVectors(i,t),zT.crossVectors(kT,Lb);let n,a=this.direction.dot(zT);if(a>0){if(r)return null;n=1}else{if(!(a<0))return null;n=-1,a=-a}ud.subVectors(this.origin,t);let o=n*this.direction.dot(Lb.crossVectors(ud,Lb));if(o<0)return null;let l=n*this.direction.dot(kT.cross(ud));if(l<0||o+l>a)return null;let u=-n*ud.dot(zT);return u<0?null:this.at(u/a,s)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},Uo=class extends ho{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new oe(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 ur,this.combine=Sw,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}},GN=new At,Fc=new pc,Fb=new Zn,WN=new P,Aw=new P,Cw=new P,Ew=new P,LT=new P,Ub=new P,UF=new P,Pw=new P,Ar=class extends hr{constructor(t=new ye,e=new Uo){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),t.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),t.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){let t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){let i=t[e[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,s=i.length;r<s;r++){let n=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=r}}}}getVertexPosition(t,e){let i=this.geometry,r=i.attributes.position,s=i.morphAttributes.position,n=i.morphTargetsRelative;e.fromBufferAttribute(r,t);let a=this.morphTargetInfluences;if(s&&a){Ub.set(0,0,0);for(let o=0,l=s.length;o<l;o++){let u=a[o],h=s[o];u!==0&&(LT.fromBufferAttribute(h,t),n?Ub.addScaledVector(LT,u):Ub.addScaledVector(LT.sub(e),u))}e.add(Ub)}return e}raycast(t,e){let i=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),Fb.copy(i.boundingSphere),Fb.applyMatrix4(s),Fc.copy(t.ray).recast(t.near),(Fb.containsPoint(Fc.origin)!==!1||!(Fc.intersectSphere(Fb,WN)===null||Fc.origin.distanceToSquared(WN)>(t.far-t.near)**2))&&(GN.copy(s).invert(),Fc.copy(t.ray).applyMatrix4(GN),(i.boundingBox===null||Fc.intersectsBox(i.boundingBox)!==!1)&&this._computeIntersections(t,e,Fc)))}_computeIntersections(t,e,i){let r,s=this.geometry,n=this.material,a=s.index,o=s.attributes.position,l=s.attributes.uv,u=s.attributes.uv1,h=s.attributes.normal,d=s.groups,c=s.drawRange;if(a!==null)if(Array.isArray(n))for(let p=0,m=d.length;p<m;p++){let f=d[p],g=n[f.materialIndex];for(let y=Math.max(f.start,c.start),v=Math.min(a.count,Math.min(f.start+f.count,c.start+c.count));y<v;y+=3)r=mT(this,g,t,i,l,u,h,a.getX(y),a.getX(y+1),a.getX(y+2)),r&&(r.faceIndex=Math.floor(y/3),r.face.materialIndex=f.materialIndex,e.push(r))}else for(let p=Math.max(0,c.start),m=Math.min(a.count,c.start+c.count);p<m;p+=3)r=mT(this,n,t,i,l,u,h,a.getX(p),a.getX(p+1),a.getX(p+2)),r&&(r.faceIndex=Math.floor(p/3),e.push(r));else if(o!==void 0)if(Array.isArray(n))for(let p=0,m=d.length;p<m;p++){let f=d[p],g=n[f.materialIndex];for(let y=Math.max(f.start,c.start),v=Math.min(o.count,Math.min(f.start+f.count,c.start+c.count));y<v;y+=3)r=mT(this,g,t,i,l,u,h,y,y+1,y+2),r&&(r.faceIndex=Math.floor(y/3),r.face.materialIndex=f.materialIndex,e.push(r))}else for(let p=Math.max(0,c.start),m=Math.min(o.count,c.start+c.count);p<m;p+=3)r=mT(this,n,t,i,l,u,h,p,p+1,p+2),r&&(r.faceIndex=Math.floor(p/3),e.push(r))}},jF=class extends hr{constructor(){super(),this.isBone=!0,this.type="Bone"}},br=class extends mi{constructor(t=null,e=1,i=1,r,s,n,a,o,l=Ne,u=Ne,h,d){super(null,n,a,o,l,u,r,s,h,d),this.isDataTexture=!0,this.image={data:t,width:e,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},qN=new At,rH=new At,SR=class{constructor(t=[],e=[]){this.uuid=Ml(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){let t=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(16*t.length),e.length===0)this.calculateInverses();else if(t.length!==e.length){ae("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 At)}}calculateInverses(){this.boneInverses.length=0;for(let t=0,e=this.bones.length;t<e;t++){let i=new At;this.bones[t]&&i.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(i)}}pose(){for(let t=0,e=this.bones.length;t<e;t++){let i=this.bones[t];i&&i.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,e=this.bones.length;t<e;t++){let i=this.bones[t];i&&(i.parent&&i.parent.isBone?(i.matrix.copy(i.parent.matrixWorld).invert(),i.matrix.multiply(i.matrixWorld)):i.matrix.copy(i.matrixWorld),i.matrix.decompose(i.position,i.quaternion,i.scale))}}update(){let t=this.bones,e=this.boneInverses,i=this.boneMatrices,r=this.boneTexture;for(let s=0,n=t.length;s<n;s++){let a=t[s]?t[s].matrixWorld:rH;qN.multiplyMatrices(a,e[s]),qN.toArray(i,16*s)}r!==null&&(r.needsUpdate=!0)}clone(){return new SR(this.bones,this.boneInverses)}computeBoneTexture(){let t=Math.sqrt(4*this.bones.length);t=4*Math.ceil(t/4),t=Math.max(t,4);let e=new Float32Array(t*t*4);e.set(this.boneMatrices);let i=new br(e,t,t,an,Je);return i.needsUpdate=!0,this.boneMatrices=e,this.boneTexture=i,this}getBoneByName(t){for(let e=0,i=this.bones.length;e<i;e++){let r=this.bones[e];if(r.name===t)return r}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(t,e){this.uuid=t.uuid;for(let i=0,r=t.bones.length;i<r;i++){let s=t.bones[i],n=e[s];n===void 0&&(ae("Skeleton: No bone found with UUID:",s),n=new jF),this.bones.push(n),this.boneInverses.push(new At().fromArray(t.boneInverses[i]))}return this.init(),this}toJSON(){let t={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;let e=this.bones,i=this.boneInverses;for(let r=0,s=e.length;r<s;r++){let n=e[r];t.bones.push(n.uuid);let a=i[r];t.boneInverses.push(a.toArray())}return t}},po=class extends Se{constructor(t,e,i,r=1){super(t,e,i),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){let t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}},qm=new At,HN=new At,jb=[],$N=new dr,sH=new At,A0=new Ar,C0=new Zn,Z4=class extends Ar{constructor(t,e,i){super(t,e),this.isInstancedMesh=!0,this.instanceMatrix=new po(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,sH)}computeBoundingBox(){let t=this.geometry,e=this.count;this.boundingBox===null&&(this.boundingBox=new dr),t.boundingBox===null&&t.computeBoundingBox(),this.boundingBox.makeEmpty();for(let i=0;i<e;i++)this.getMatrixAt(i,qm),$N.copy(t.boundingBox).applyMatrix4(qm),this.boundingBox.union($N)}computeBoundingSphere(){let t=this.geometry,e=this.count;this.boundingSphere===null&&(this.boundingSphere=new Zn),t.boundingSphere===null&&t.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let i=0;i<e;i++)this.getMatrixAt(i,qm),C0.copy(t.boundingSphere).applyMatrix4(qm),this.boundingSphere.union(C0)}copy(t,e){return super.copy(t,e),this.instanceMatrix.copy(t.instanceMatrix),t.morphTexture!==null&&(this.morphTexture=t.morphTexture.clone()),t.instanceColor!==null&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone()),t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),this}getColorAt(t,e){return this.instanceColor===null?e.setRGB(1,1,1):e.fromArray(this.instanceColor.array,3*t)}getMatrixAt(t,e){return e.fromArray(this.instanceMatrix.array,16*t)}getMorphAt(t,e){let i=e.morphTargetInfluences,r=this.morphTexture.source.data.data,s=t*(i.length+1)+1;for(let n=0;n<i.length;n++)i[n]=r[s+n]}raycast(t,e){let i=this.matrixWorld,r=this.count;if(A0.geometry=this.geometry,A0.material=this.material,A0.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),C0.copy(this.boundingSphere),C0.applyMatrix4(i),t.ray.intersectsSphere(C0)!==!1))for(let s=0;s<r;s++){this.getMatrixAt(s,qm),HN.multiplyMatrices(i,qm),A0.matrixWorld=HN,A0.raycast(t,jb);for(let n=0,a=jb.length;n<a;n++){let o=jb[n];o.instanceId=s,o.object=this,e.push(o)}jb.length=0}}setColorAt(t,e){return this.instanceColor===null&&(this.instanceColor=new po(new Float32Array(3*this.instanceMatrix.count).fill(1),3)),e.toArray(this.instanceColor.array,3*t),this}setMatrixAt(t,e){return e.toArray(this.instanceMatrix.array,16*t),this}setMorphAt(t,e){let i=e.morphTargetInfluences,r=i.length+1;this.morphTexture===null&&(this.morphTexture=new br(new Float32Array(r*this.count),r,this.count,ra,Je));let s=this.morphTexture.source.data.data,n=0;for(let l=0;l<i.length;l++)n+=i[l];let a=this.geometry.morphTargetsRelative?1:1-n,o=r*t;return s[o]=a,s.set(i,o+1),this}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}},FT=new P,nH=new P,aH=new Ss,Ra=class{constructor(t=new P(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,i,r){return this.normal.set(t,e,i),this.constant=r,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,i){let r=FT.subVectors(i,e).cross(nH.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(r,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){let t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e,i=!0){let r=t.delta(FT),s=this.normal.dot(r);if(s===0)return this.distanceToPoint(t.start)===0?e.copy(t.start):null;let n=-(t.start.dot(this.normal)+this.constant)/s;return i===!0&&(n<0||n>1)?null:e.copy(t.start).addScaledVector(r,n)}intersectsLine(t){let e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){let i=e||aH.getNormalMatrix(t),r=this.coplanarPoint(FT).applyMatrix4(t),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}},Uc=new Zn,oH=new Z(.5,.5),Gb=new P,Rw=class{constructor(t=new Ra,e=new Ra,i=new Ra,r=new Ra,s=new Ra,n=new Ra){this.planes=[t,e,i,r,s,n]}set(t,e,i,r,s,n){let a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(i),a[3].copy(r),a[4].copy(s),a[5].copy(n),this}copy(t){let e=this.planes;for(let i=0;i<6;i++)e[i].copy(t.planes[i]);return this}setFromProjectionMatrix(t,e=Io,i=!1){let r=this.planes,s=t.elements,n=s[0],a=s[1],o=s[2],l=s[3],u=s[4],h=s[5],d=s[6],c=s[7],p=s[8],m=s[9],f=s[10],g=s[11],y=s[12],v=s[13],b=s[14],_=s[15];if(r[0].setComponents(l-n,c-u,g-p,_-y).normalize(),r[1].setComponents(l+n,c+u,g+p,_+y).normalize(),r[2].setComponents(l+a,c+h,g+m,_+v).normalize(),r[3].setComponents(l-a,c-h,g-m,_-v).normalize(),i)r[4].setComponents(o,d,f,b).normalize(),r[5].setComponents(l-o,c-d,g-f,_-b).normalize();else if(r[4].setComponents(l-o,c-d,g-f,_-b).normalize(),e===Io)r[5].setComponents(l+o,c+d,g+f,_+b).normalize();else{if(e!==zo)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);r[5].setComponents(o,d,f,b).normalize()}return this}intersectsObject(t){if(t.boundingSphere!==void 0)t.boundingSphere===null&&t.computeBoundingSphere(),Uc.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{let e=t.geometry;e.boundingSphere===null&&e.computeBoundingSphere(),Uc.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(Uc)}intersectsSprite(t){Uc.center.set(0,0,0);let e=oH.distanceTo(t.center);return Uc.radius=.7071067811865476+e,Uc.applyMatrix4(t.matrixWorld),this.intersectsSphere(Uc)}intersectsSphere(t){let e=this.planes,i=t.center,r=-t.radius;for(let s=0;s<6;s++)if(e[s].distanceToPoint(i)<r)return!1;return!0}intersectsBox(t){let e=this.planes;for(let i=0;i<6;i++){let r=e[i];if(Gb.x=r.normal.x>0?t.max.x:t.min.x,Gb.y=r.normal.y>0?t.max.y:t.min.y,Gb.z=r.normal.z>0?t.max.z:t.min.z,r.distanceToPoint(Gb)<0)return!1}return!0}containsPoint(t){let e=this.planes;for(let i=0;i<6;i++)if(e[i].distanceToPoint(t)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},XN=new At,GF=class{constructor(){this.coordinateSystem=Io,this._frustums=[],this._count=0}setFromArrayCamera(t){let e=t.cameras,i=this._frustums;for(let r=0;r<e.length;r++){let s=e[r];XN.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),i[r]===void 0&&(i[r]=new Rw),i[r].setFromProjectionMatrix(XN,s.coordinateSystem,s.reversedDepth)}return this._count=e.length,this}intersectsObject(t){let e=this._frustums;for(let i=0;i<this._count;i++)if(e[i].intersectsObject(t))return!0;return!1}intersectsSprite(t){let e=this._frustums;for(let i=0;i<this._count;i++)if(e[i].intersectsSprite(t))return!0;return!1}intersectsSphere(t){let e=this._frustums;for(let i=0;i<this._count;i++)if(e[i].intersectsSphere(t))return!0;return!1}intersectsBox(t){let e=this._frustums;for(let i=0;i<this._count;i++)if(e[i].intersectsBox(t))return!0;return!1}containsPoint(t){let e=this._frustums;for(let i=0;i<this._count;i++)if(e[i].containsPoint(t))return!0;return!1}copy(t){this.coordinateSystem=t.coordinateSystem;let e=this._frustums,i=t._frustums;for(let r=0;r<t._count;r++)e[r]===void 0&&(e[r]=new Rw),e[r].copy(i[r]);return this._count=t._count,this}clone(){return new GF().copy(this)}},Vh=class extends ho{constructor(t){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new oe(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.fog=t.fog,this}},C2=new P,E2=new P,YN=new At,E0=new pc,Wb=new Zn,iP=new P,WF=new P,Nw=class extends hr{constructor(t=new ye,e=new Vh){super(),this.isLine=!0,this.type="Line",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}computeLineDistances(){let t=this.geometry;if(t.index===null){let e=t.attributes.position,i=[0];for(let r=1,s=e.count;r<s;r++)C2.fromBufferAttribute(e,r-1),E2.fromBufferAttribute(e,r),i[r]=i[r-1],i[r]+=C2.distanceTo(E2);t.setAttribute("lineDistance",new me(i,1))}else ae("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(t,e){let i=this.geometry,r=this.matrixWorld,s=t.params.Line.threshold,n=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Wb.copy(i.boundingSphere),Wb.applyMatrix4(r),Wb.radius+=s,t.ray.intersectsSphere(Wb)===!1)return;YN.copy(r).invert(),E0.copy(t.ray).applyMatrix4(YN);let a=s/((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,n.start),c=Math.min(u.count,n.start+n.count);for(let p=d,m=c-1;p<m;p+=l){let f=u.getX(p),g=u.getX(p+1),y=fT(this,t,E0,o,f,g,p);y&&e.push(y)}if(this.isLineLoop){let p=u.getX(c-1),m=u.getX(d),f=fT(this,t,E0,o,p,m,c-1);f&&e.push(f)}}else{let d=Math.max(0,n.start),c=Math.min(h.count,n.start+n.count);for(let p=d,m=c-1;p<m;p+=l){let f=fT(this,t,E0,o,p,p+1,p);f&&e.push(f)}if(this.isLineLoop){let p=fT(this,t,E0,o,c-1,d,c-1);p&&e.push(p)}}}updateMorphTargets(){let t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){let i=t[e[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,s=i.length;r<s;r++){let n=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=r}}}}},KN=new P,ZN=new P,_1=class extends Nw{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let t=this.geometry;if(t.index===null){let e=t.attributes.position,i=[];for(let r=0,s=e.count;r<s;r+=2)KN.fromBufferAttribute(e,r),ZN.fromBufferAttribute(e,r+1),i[r]=r===0?0:i[r-1],i[r+1]=i[r]+KN.distanceTo(ZN);t.setAttribute("lineDistance",new me(i,1))}else ae("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}},qct=class extends ho{constructor(t){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new oe(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}},o7=class extends mi{constructor(t,e,i,r,s=ge,n=ge,a,o,l){super(t,e,i,r,s,n,a,o,l),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;let u=this;"requestVideoFrameCallback"in t&&(this._requestVideoFrameCallbackId=t.requestVideoFrameCallback(function h(){u.needsUpdate=!0,u._requestVideoFrameCallbackId=t.requestVideoFrameCallback(h)}))}clone(){return new this.constructor(this.image).copy(this)}update(){let t=this.image;"requestVideoFrameCallback"in t==0&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}},rP=class extends mi{constructor(t,e){super({width:t,height:e}),this.isFramebufferTexture=!0,this.magFilter=Ne,this.minFilter=Ne,this.generateMipmaps=!1,this.needsUpdate=!0}},Dw=class extends mi{constructor(t=[],e=Ig,i,r,s,n,a,o,l,u){super(t,e,i,r,s,n,a,o,l,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}},l7=class extends mi{constructor(t,e,i,r,s,n,a,o,l){super(t,e,i,r,s,n,a,o,l),this.isCanvasTexture=!0,this.needsUpdate=!0}},Ya=class extends mi{constructor(t,e,i=An,r,s,n,a=Ne,o=Ne,l,u=Hp,h=1){if(u!==Hp&&u!==rv)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super({width:t,height:e,depth:h},r,s,n,a,o,u,i,l),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.source=new ST(Object.assign({},t.image)),this.compareFunction=t.compareFunction,this}toJSON(t){let e=super.toJSON(t);return this.compareFunction!==null&&(e.compareFunction=this.compareFunction),e}},Hct=class extends Ya{constructor(t,e=An,i=Ig,r,s,n=Ne,a=Ne,o,l=Hp){let u={width:t,height:t,depth:1},h=[u,u,u,u,u,u];super(t,t,e,i,r,s,n,a,o,l),this.image=h,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(t){this.image=t}},Kh=class extends ye{constructor(t=1,e=1,i=1,r=1,s=1,n=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:r,heightSegments:s,depthSegments:n};let a=this;r=Math.floor(r),s=Math.floor(s),n=Math.floor(n);let o=[],l=[],u=[],h=[],d=0,c=0;function p(m,f,g,y,v,b,_,x,S,w,M){let T=b/S,A=_/w,C=b/2,R=_/2,O=x/2,D=S+1,B=w+1,k=0,j=0,z=new P;for(let V=0;V<B;V++){let H=V*A-R;for(let U=0;U<D;U++){let et=U*T-C;z[m]=et*y,z[f]=H*v,z[g]=O,l.push(z.x,z.y,z.z),z[m]=0,z[f]=0,z[g]=x>0?1:-1,u.push(z.x,z.y,z.z),h.push(U/S),h.push(1-V/w),k+=1}}for(let V=0;V<w;V++)for(let H=0;H<S;H++){let U=d+H+D*V,et=d+H+D*(V+1),at=d+(H+1)+D*(V+1),Q=d+(H+1)+D*V;o.push(U,et,Q),o.push(et,at,Q),j+=6}a.addGroup(c,j,M),c+=j,d+=k}p("z","y","x",-1,-1,i,e,t,n,s,0),p("z","y","x",1,-1,i,e,-t,n,s,1),p("x","z","y",1,1,t,i,e,r,n,2),p("x","z","y",1,-1,t,i,-e,r,n,3),p("x","y","z",1,-1,t,e,i,r,s,4),p("x","y","z",-1,-1,t,e,-i,r,s,5),this.setIndex(o),this.setAttribute("position",new me(l,3)),this.setAttribute("normal",new me(u,3)),this.setAttribute("uv",new me(h,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Kh(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}},P2=class extends ye{constructor(t=1,e=1,i=1,r=32,s=1,n=!1,a=0,o=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:i,radialSegments:r,heightSegments:s,openEnded:n,thetaStart:a,thetaLength:o};let l=this;r=Math.floor(r),s=Math.floor(s);let u=[],h=[],d=[],c=[],p=0,m=[],f=i/2,g=0;function y(v){let b=p,_=new Z,x=new P,S=0,w=v===!0?t:e,M=v===!0?1:-1;for(let A=1;A<=r;A++)h.push(0,f*M,0),d.push(0,M,0),c.push(.5,.5),p++;let T=p;for(let A=0;A<=r;A++){let C=A/r*o+a,R=Math.cos(C),O=Math.sin(C);x.x=w*O,x.y=f*M,x.z=w*R,h.push(x.x,x.y,x.z),d.push(0,M,0),_.x=.5*R+.5,_.y=.5*O*M+.5,c.push(_.x,_.y),p++}for(let A=0;A<r;A++){let C=b+A,R=T+A;v===!0?u.push(R,R+1,C):u.push(R+1,R,C),S+=3}l.addGroup(g,S,v===!0?1:2),g+=S}(function(){let v=new P,b=new P,_=0,x=(e-t)/i;for(let S=0;S<=s;S++){let w=[],M=S/s,T=M*(e-t)+t;for(let A=0;A<=r;A++){let C=A/r,R=C*o+a,O=Math.sin(R),D=Math.cos(R);b.x=T*O,b.y=-M*i+f,b.z=T*D,h.push(b.x,b.y,b.z),v.set(O,x,D).normalize(),d.push(v.x,v.y,v.z),c.push(C,1-M),w.push(p++)}m.push(w)}for(let S=0;S<r;S++)for(let w=0;w<s;w++){let M=m[w][S],T=m[w+1][S],A=m[w+1][S+1],C=m[w][S+1];(t>0||w!==0)&&(u.push(M,T,C),_+=3),(e>0||w!==s-1)&&(u.push(T,A,C),_+=3)}l.addGroup(g,_,0),g+=_})(),n===!1&&(t>0&&y(!0),e>0&&y(!1)),this.setIndex(u),this.setAttribute("position",new me(h,3)),this.setAttribute("normal",new me(d,3)),this.setAttribute("uv",new me(c,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new P2(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}},TR=class extends P2{constructor(t=1,e=1,i=32,r=1,s=!1,n=0,a=2*Math.PI){super(0,t,e,i,r,s,n,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:r,openEnded:s,thetaStart:n,thetaLength:a}}static fromJSON(t){return new TR(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}},UT=class extends ye{constructor(t=[],e=[],i=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:i,detail:r};let s=[],n=[];function a(c,p,m,f){let g=f+1,y=[];for(let v=0;v<=g;v++){y[v]=[];let b=c.clone().lerp(m,v/g),_=p.clone().lerp(m,v/g),x=g-v;for(let S=0;S<=x;S++)y[v][S]=S===0&&v===g?b:b.clone().lerp(_,S/x)}for(let v=0;v<g;v++)for(let b=0;b<2*(g-v)-1;b++){let _=Math.floor(b/2);b%2==0?(o(y[v][_+1]),o(y[v+1][_]),o(y[v][_])):(o(y[v][_+1]),o(y[v+1][_+1]),o(y[v+1][_]))}}function o(c){s.push(c.x,c.y,c.z)}function l(c,p){let m=3*c;p.x=t[m+0],p.y=t[m+1],p.z=t[m+2]}function u(c,p,m,f){f<0&&c.x===1&&(n[p]=c.x-1),m.x===0&&m.z===0&&(n[p]=f/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,m=new P,f=new P;for(let g=0;g<e.length;g+=3)l(e[g+0],p),l(e[g+1],m),l(e[g+2],f),a(p,m,f,c)})(r),function(c){let p=new P;for(let m=0;m<s.length;m+=3)p.x=s[m+0],p.y=s[m+1],p.z=s[m+2],p.normalize().multiplyScalar(c),s[m+0]=p.x,s[m+1]=p.y,s[m+2]=p.z}(i),function(){let c=new P;for(let p=0;p<s.length;p+=3){c.x=s[p+0],c.y=s[p+1],c.z=s[p+2];let m=h(c)/2/Math.PI+.5,f=d(c)/Math.PI+.5;n.push(m,1-f)}(function(){let p=new P,m=new P,f=new P,g=new P,y=new Z,v=new Z,b=new Z;for(let _=0,x=0;_<s.length;_+=9,x+=6){p.set(s[_+0],s[_+1],s[_+2]),m.set(s[_+3],s[_+4],s[_+5]),f.set(s[_+6],s[_+7],s[_+8]),y.set(n[x+0],n[x+1]),v.set(n[x+2],n[x+3]),b.set(n[x+4],n[x+5]),g.copy(p).add(m).add(f).divideScalar(3);let S=h(g);u(y,x+0,p,S),u(v,x+2,m,S),u(b,x+4,f,S)}})(),function(){for(let p=0;p<n.length;p+=6){let m=n[p+0],f=n[p+2],g=n[p+4],y=Math.max(m,f,g),v=Math.min(m,f,g);y>.9&&v<.1&&(m<.2&&(n[p+0]+=1),f<.2&&(n[p+2]+=1),g<.2&&(n[p+4]+=1))}}()}(),this.setAttribute("position",new me(s,3)),this.setAttribute("normal",new me(s.slice(),3)),this.setAttribute("uv",new me(n,2)),r===0?this.computeVertexNormals():this.normalizeNormals()}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new UT(t.vertices,t.indices,t.radius,t.detail)}},qF=class extends UT{constructor(t=1,e=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],t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new qF(t.radius,t.detail)}},nh=class{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){ae("Curve: .getPoint() not implemented.")}getPointAt(t,e){let i=this.getUtoTmapping(t);return this.getPoint(i,e)}getPoints(t=5){let e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return e}getSpacedPoints(t=5){let e=[];for(let i=0;i<=t;i++)e.push(this.getPointAt(i/t));return e}getLength(){let t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let e,i=[],r=this.getPoint(0),s=0;i.push(0);for(let n=1;n<=t;n++)e=this.getPoint(n/t),s+=e.distanceTo(r),i.push(s),r=e;return this.cacheArcLengths=i,i}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e=null){let i,r=this.getLengths(),s=0,n=r.length;i=e||t*r[n-1];let a,o=0,l=n-1;for(;o<=l;)if(s=Math.floor(o+(l-o)/2),a=r[s]-i,a<0)o=s+1;else{if(!(a>0)){l=s;break}l=s-1}if(s=l,r[s]===i)return s/(n-1);let u=r[s];return(s+(i-u)/(r[s+1]-u))/(n-1)}getTangent(t,e){let i=t-1e-4,r=t+1e-4;i<0&&(i=0),r>1&&(r=1);let s=this.getPoint(i),n=this.getPoint(r),a=e||(s.isVector2?new Z:new P);return a.copy(n).sub(s).normalize(),a}getTangentAt(t,e){let i=this.getUtoTmapping(t);return this.getTangent(i,e)}computeFrenetFrames(t,e=!1){let i=new P,r=[],s=[],n=[],a=new P,o=new At;for(let c=0;c<=t;c++){let p=c/t;r[c]=this.getTangentAt(p,new P)}s[0]=new P,n[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(),s[0].crossVectors(r[0],a),n[0].crossVectors(r[0],s[0]);for(let c=1;c<=t;c++){if(s[c]=s[c-1].clone(),n[c]=n[c-1].clone(),a.crossVectors(r[c-1],r[c]),a.length()>Number.EPSILON){a.normalize();let p=Math.acos(ei(r[c-1].dot(r[c]),-1,1));s[c].applyMatrix4(o.makeRotationAxis(a,p))}n[c].crossVectors(r[c],s[c])}if(e===!0){let c=Math.acos(ei(s[0].dot(s[t]),-1,1));c/=t,r[0].dot(a.crossVectors(s[0],s[t]))>0&&(c=-c);for(let p=1;p<=t;p++)s[p].applyMatrix4(o.makeRotationAxis(r[p],c*p)),n[p].crossVectors(r[p],s[p])}return{tangents:r,normals:s,binormals:n}}clone(){return new this.constructor().copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){let t={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}},Ow=class extends nh{constructor(t=0,e=0,i=1,r=1,s=0,n=2*Math.PI,a=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=i,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=n,this.aClockwise=a,this.aRotation=o}getPoint(t,e=new Z){let i=e,r=2*Math.PI,s=this.aEndAngle-this.aStartAngle,n=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(s=n?0:r),this.aClockwise===!0&&!n&&(s===r?s=-r:s-=r);let a=this.aStartAngle+t*s,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(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){let t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}},lH=class extends Ow{constructor(t,e,i,r,s,n){super(t,e,i,i,r,s,n),this.isArcCurve=!0,this.type="ArcCurve"}},QN=new P,JN=new P,jT=new wN,GT=new wN,WT=new wN,hH=class extends nh{constructor(t=[],e=!1,i="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=i,this.tension=r}getPoint(t,e=new P){let i,r,s=e,n=this.points,a=n.length,o=(a-(this.closed?0:1))*t,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=n[(l-1)%a]:(JN.subVectors(n[0],n[1]).add(n[0]),i=JN);let h=n[l%a],d=n[(l+1)%a];if(this.closed||l+2<a?r=n[(l+2)%a]:(QN.subVectors(n[a-1],n[a-2]).add(n[a-1]),r=QN),this.curveType==="centripetal"||this.curveType==="chordal"){let c=this.curveType==="chordal"?.5:.25,p=Math.pow(i.distanceToSquared(h),c),m=Math.pow(h.distanceToSquared(d),c),f=Math.pow(d.distanceToSquared(r),c);m<1e-4&&(m=1),p<1e-4&&(p=m),f<1e-4&&(f=m),jT.initNonuniformCatmullRom(i.x,h.x,d.x,r.x,p,m,f),GT.initNonuniformCatmullRom(i.y,h.y,d.y,r.y,p,m,f),WT.initNonuniformCatmullRom(i.z,h.z,d.z,r.z,p,m,f)}else this.curveType==="catmullrom"&&(jT.initCatmullRom(i.x,h.x,d.x,r.x,this.tension),GT.initCatmullRom(i.y,h.y,d.y,r.y,this.tension),WT.initCatmullRom(i.z,h.z,d.z,r.z,this.tension));return s.set(jT.calc(u),GT.calc(u),WT.calc(u)),s}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){let r=t.points[e];this.points.push(r.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){let t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){let r=this.points[e];t.points.push(r.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){let r=t.points[e];this.points.push(new P().fromArray(r))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}},Yl=class extends nh{constructor(t=new Z,e=new Z,i=new Z,r=new Z){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=i,this.v3=r}getPoint(t,e=new Z){let i=e,r=this.v0,s=this.v1,n=this.v2,a=this.v3;return i.set(Ab(t,r.x,s.x,n.x,a.x),Ab(t,r.y,s.y,n.y,a.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}},R2=class extends nh{constructor(t=new P,e=new P,i=new P,r=new P){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=i,this.v3=r}getPoint(t,e=new P){let i=e,r=this.v0,s=this.v1,n=this.v2,a=this.v3;return i.set(Ab(t,r.x,s.x,n.x,a.x),Ab(t,r.y,s.y,n.y,a.y),Ab(t,r.z,s.z,n.z,a.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}},cl=class extends nh{constructor(t=new Z,e=new Z){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new Z){let i=e;return t===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new Z){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},HF=class extends nh{constructor(t=new P,e=new P){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new P){let i=e;return t===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new P){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},oc=class extends nh{constructor(t=new Z,e=new Z,i=new Z){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new Z){let i=e,r=this.v0,s=this.v1,n=this.v2;return i.set(Mb(t,r.x,s.x,n.x),Mb(t,r.y,s.y,n.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},uH=class extends nh{constructor(t=new P,e=new P,i=new P){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new P){let i=e,r=this.v0,s=this.v1,n=this.v2;return i.set(Mb(t,r.x,s.x,n.x),Mb(t,r.y,s.y,n.y),Mb(t,r.z,s.z,n.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},sP=class extends nh{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new Z){let i=e,r=this.points,s=(r.length-1)*t,n=Math.floor(s),a=s-n,o=r[n===0?n:n-1],l=r[n],u=r[n>r.length-2?r.length-1:n+1],h=r[n>r.length-3?r.length-1:n+2];return i.set(Bq(a,o.x,l.x,u.x,h.x),Bq(a,o.y,l.y,u.y,h.y)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){let r=t.points[e];this.points.push(r.clone())}return this}toJSON(){let t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){let r=this.points[e];t.points.push(r.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){let r=t.points[e];this.points.push(new Z().fromArray(r))}return this}},tD=Object.freeze({__proto__:null,ArcCurve:lH,CatmullRomCurve3:hH,CubicBezierCurve:Yl,CubicBezierCurve3:R2,EllipseCurve:Ow,LineCurve:cl,LineCurve3:HF,QuadraticBezierCurve:oc,QuadraticBezierCurve3:uH,SplineCurve:sP}),$F=class extends nh{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){let t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);if(!t.equals(e)){let i=t.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new tD[i](e,t))}return this}getPoint(t,e){let i=t*this.getLength(),r=this.getCurveLengths(),s=0;for(;s<r.length;){if(r[s]>=i){let n=r[s]-i,a=this.curves[s],o=a.getLength(),l=o===0?0:1-n/o;return a.getPointAt(l,e)}s++}return null}getLength(){let t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let t=[],e=0;for(let i=0,r=this.curves.length;i<r;i++)e+=this.curves[i].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){let e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){let e,i=[];for(let r=0,s=this.curves;r<s.length;r++){let n=s[r],a=n.isEllipseCurve?2*t:n.isLineCurve||n.isLineCurve3?1:n.isSplineCurve?t*n.points.length:t,o=n.getPoints(a);for(let l=0;l<o.length;l++){let u=o[l];e&&e.equals(u)||(i.push(u),e=u)}}return this.autoClose&&i.length>1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}copy(t){super.copy(t),this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){let r=t.curves[e];this.curves.push(r.clone())}return this.autoClose=t.autoClose,this}toJSON(){let t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,i=this.curves.length;e<i;e++){let r=this.curves[e];t.curves.push(r.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){let r=t.curves[e];this.curves.push(new tD[r.type]().fromJSON(r))}return this}},N2=class extends $F{constructor(t){super(),this.type="Path",this.currentPoint=new Z,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,i=t.length;e<i;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){let i=new cl(this.currentPoint.clone(),new Z(t,e));return this.curves.push(i),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,i,r){let s=new oc(this.currentPoint.clone(),new Z(t,e),new Z(i,r));return this.curves.push(s),this.currentPoint.set(i,r),this}bezierCurveTo(t,e,i,r,s,n){let a=new Yl(this.currentPoint.clone(),new Z(t,e),new Z(i,r),new Z(s,n));return this.curves.push(a),this.currentPoint.set(s,n),this}splineThru(t){let e=[this.currentPoint.clone()].concat(t),i=new sP(e);return this.curves.push(i),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,i,r,s,n){let a=this.currentPoint.x,o=this.currentPoint.y;return this.absarc(t+a,e+o,i,r,s,n),this}absarc(t,e,i,r,s,n){return this.absellipse(t,e,i,i,r,s,n),this}ellipse(t,e,i,r,s,n,a,o){let l=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(t+l,e+u,i,r,s,n,a,o),this}absellipse(t,e,i,r,s,n,a,o){let l=new Ow(t,e,i,r,s,n,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(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){let t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}},aS=class extends N2{constructor(t){super(t),this.uuid=Ml(),this.type="Shape",this.holes=[]}getPointsHoles(t){let e=[];for(let i=0,r=this.holes.length;i<r;i++)e[i]=this.holes[i].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){let r=t.holes[e];this.holes.push(r.clone())}return this}toJSON(){let t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,i=this.holes.length;e<i;e++){let r=this.holes[e];t.holes.push(r.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){let r=t.holes[e];this.holes.push(new N2().fromJSON(r))}return this}},dH=class{static triangulate(t,e,i=2){return function(r,s,n=2){let a,o,l,u=s&&s.length,h=u?s[0]*n:r.length,d=Vq(r,0,h,n,!0),c=[];if(!d||d.next===d.prev)return c;if(u&&(d=function(p,m,f,g){let y=[];for(let v=0,b=m.length;v<b;v++){let _=Vq(p,m[v]*g,v<b-1?m[v+1]*g:p.length,g,!1);_===_.next&&(_.steiner=!0),y.push(ASt(_))}y.sort(SSt);for(let v=0;v<y.length;v++)f=TSt(y[v],f);return f}(r,s,d,n)),r.length>80*n){a=r[0],o=r[1];let p=a,m=o;for(let f=n;f<h;f+=n){let g=r[f],y=r[f+1];g<a&&(a=g),y<o&&(o=y),g>p&&(p=g),y>m&&(m=y)}l=Math.max(p-a,m-o),l=l!==0?32767/l:0}return rS(d,c,n,a,o,l,0),c}(t,e,i)}},XF=class{static area(t){let e=t.length,i=0;for(let r=e-1,s=0;s<e;r=s++)i+=t[r].x*t[s].y-t[s].x*t[r].y;return .5*i}static isClockWise(t){return XF.area(t)<0}static triangulateShape(t,e){let i=[],r=[],s=[];zq(t),Lq(i,t);let n=t.length;e.forEach(zq);for(let o=0;o<e.length;o++)r.push(n),n+=e[o].length,Lq(i,e[o]);let a=dH.triangulate(i,r);for(let o=0;o<a.length;o+=3)s.push(a.slice(o,o+3));return s}},YF=class extends UT{constructor(t=1,e=0){let i=(1+Math.sqrt(5))/2;super([-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],t,e),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new YF(t.radius,t.detail)}},KF=class extends ye{constructor(t=[new Z(0,-.5),new Z(.5,0),new Z(0,.5)],e=12,i=0,r=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:i,phiLength:r},e=Math.floor(e),r=ei(r,0,2*Math.PI);let s=[],n=[],a=[],o=[],l=[],u=1/e,h=new P,d=new Z,c=new P,p=new P,m=new P,f=0,g=0;for(let y=0;y<=t.length-1;y++)switch(y){case 0:f=t[y+1].x-t[y].x,g=t[y+1].y-t[y].y,c.x=1*g,c.y=-f,c.z=0*g,m.copy(c),c.normalize(),o.push(c.x,c.y,c.z);break;case t.length-1:o.push(m.x,m.y,m.z);break;default:f=t[y+1].x-t[y].x,g=t[y+1].y-t[y].y,c.x=1*g,c.y=-f,c.z=0*g,p.copy(c),c.x+=m.x,c.y+=m.y,c.z+=m.z,c.normalize(),o.push(c.x,c.y,c.z),m.copy(p)}for(let y=0;y<=e;y++){let v=i+y*u*r,b=Math.sin(v),_=Math.cos(v);for(let x=0;x<=t.length-1;x++){h.x=t[x].x*b,h.y=t[x].y,h.z=t[x].x*_,n.push(h.x,h.y,h.z),d.x=y/e,d.y=x/(t.length-1),a.push(d.x,d.y);let S=o[3*x+0]*b,w=o[3*x+1],M=o[3*x+0]*_;l.push(S,w,M)}}for(let y=0;y<e;y++)for(let v=0;v<t.length-1;v++){let b=v+y*t.length,_=b,x=b+t.length,S=b+t.length+1,w=b+1;s.push(_,x,w),s.push(S,w,x)}this.setIndex(s),this.setAttribute("position",new me(n,3)),this.setAttribute("uv",new me(a,2)),this.setAttribute("normal",new me(l,3))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new KF(t.points,t.segments,t.phiStart,t.phiLength)}},Ac=class extends ye{constructor(t=1,e=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:r};let s=t/2,n=e/2,a=Math.floor(i),o=Math.floor(r),l=a+1,u=o+1,h=t/a,d=e/o,c=[],p=[],m=[],f=[];for(let g=0;g<u;g++){let y=g*d-n;for(let v=0;v<l;v++){let b=v*h-s;p.push(b,-y,0),m.push(0,0,1),f.push(v/a),f.push(1-g/o)}}for(let g=0;g<o;g++)for(let y=0;y<a;y++){let v=y+l*g,b=y+l*(g+1),_=y+1+l*(g+1),x=y+1+l*g;c.push(v,b,x),c.push(b,_,x)}this.setIndex(c),this.setAttribute("position",new me(p,3)),this.setAttribute("normal",new me(m,3)),this.setAttribute("uv",new me(f,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Ac(t.width,t.height,t.widthSegments,t.heightSegments)}},Tc=class extends ye{constructor(t=1,e=32,i=16,r=0,s=2*Math.PI,n=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:r,phiLength:s,thetaStart:n,thetaLength:a},e=Math.max(3,Math.floor(e)),i=Math.max(2,Math.floor(i));let o=Math.min(n+a,Math.PI),l=0,u=[],h=new P,d=new P,c=[],p=[],m=[],f=[];for(let g=0;g<=i;g++){let y=[],v=g/i,b=n+v*a,_=t*Math.cos(b),x=Math.sqrt(t*t-_*_),S=0;g===0&&n===0?S=.5/e:g===i&&o===Math.PI&&(S=-.5/e);for(let w=0;w<=e;w++){let M=w/e,T=r+M*s;h.x=-x*Math.cos(T),h.y=_,h.z=x*Math.sin(T),p.push(h.x,h.y,h.z),d.copy(h).normalize(),m.push(d.x,d.y,d.z),f.push(M+S,1-v),y.push(l++)}u.push(y)}for(let g=0;g<i;g++)for(let y=0;y<e;y++){let v=u[g][y+1],b=u[g][y],_=u[g+1][y],x=u[g+1][y+1];(g!==0||n>0)&&c.push(v,b,x),(g!==i-1||o<Math.PI)&&c.push(b,_,x)}this.setIndex(c),this.setAttribute("position",new me(p,3)),this.setAttribute("normal",new me(m,3)),this.setAttribute("uv",new me(f,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Tc(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}},MR=class extends ye{constructor(t=1,e=.4,i=12,r=48,s=2*Math.PI,n=0,a=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:i,tubularSegments:r,arc:s,thetaStart:n,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 m=0;m<=i;m++){let f=n+m/i*a;for(let g=0;g<=r;g++){let y=g/r*s;c.x=(t+e*Math.cos(f))*Math.cos(y),c.y=(t+e*Math.cos(f))*Math.sin(y),c.z=e*Math.sin(f),l.push(c.x,c.y,c.z),d.x=t*Math.cos(y),d.y=t*Math.sin(y),p.subVectors(c,d).normalize(),u.push(p.x,p.y,p.z),h.push(g/r),h.push(m/i)}}for(let m=1;m<=i;m++)for(let f=1;f<=r;f++){let g=(r+1)*m+f-1,y=(r+1)*(m-1)+f-1,v=(r+1)*(m-1)+f,b=(r+1)*m+f;o.push(g,y,b),o.push(y,v,b)}this.setIndex(o),this.setAttribute("position",new me(l,3)),this.setAttribute("normal",new me(u,3)),this.setAttribute("uv",new me(h,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new MR(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}},ZF=class extends ye{constructor(t=1,e=.4,i=64,r=8,s=2,n=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:i,radialSegments:r,p:s,q:n},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,m=new P,f=new P,g=new P;for(let v=0;v<=i;++v){let b=v/i*s*Math.PI*2;y(b,s,n,t,c),y(b+.01,s,n,t,p),f.subVectors(p,c),g.addVectors(p,c),m.crossVectors(f,g),g.crossVectors(m,f),m.normalize(),g.normalize();for(let _=0;_<=r;++_){let x=_/r*Math.PI*2,S=-e*Math.cos(x),w=e*Math.sin(x);h.x=c.x+(S*g.x+w*m.x),h.y=c.y+(S*g.y+w*m.y),h.z=c.z+(S*g.z+w*m.z),o.push(h.x,h.y,h.z),d.subVectors(h,c).normalize(),l.push(d.x,d.y,d.z),u.push(v/i),u.push(_/r)}}for(let v=1;v<=i;v++)for(let b=1;b<=r;b++){let _=(r+1)*(v-1)+(b-1),x=(r+1)*v+(b-1),S=(r+1)*v+b,w=(r+1)*(v-1)+b;a.push(_,x,w),a.push(x,S,w)}function y(v,b,_,x,S){let w=Math.cos(v),M=Math.sin(v),T=_/b*v,A=Math.cos(T);S.x=x*(2+A)*.5*w,S.y=x*(2+A)*M*.5,S.z=x*Math.sin(T)*.5}this.setIndex(a),this.setAttribute("position",new me(o,3)),this.setAttribute("normal",new me(l,3)),this.setAttribute("uv",new me(u,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new ZF(t.radius,t.tube,t.tubularSegments,t.radialSegments,t.p,t.q)}},$ct=class extends ho{constructor(t){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new oe(0),this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.fog=t.fog,this}},Pv=class extends ho{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=`void main() {
37
37
  gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
38
38
  }`,this.fragmentShader=`void main() {
@@ -334,14 +334,14 @@ ${t.stack}`:r}function O2t(t){t<1028||(sh[t]=xb,xb=t)}function Ho(t,e){return t=
334
334
  }
335
335
  post({ kind: 'ready' });
336
336
  }, 250);
337
- })();`}),vpt=W(()=>{m7=class{constructor(t,e,i){this.deps=t,this.onConsole=e,this.onEvent=i,this.disposed=!1,this.eventUnsubs=new Map,this.variablePollHandle=null,this.lastVariables=null}dispose(){this.disposed=!0;for(let t of this.eventUnsubs.values())t();this.eventUnsubs.clear(),this.stopVariablePolling()}execute(t,e){let i=this.deps;switch(t){case"setVariable":{let r=i.setVariable(String(e[0]),e[1]);return r.warning&&this.onConsole("warn",r.warning),r.ok}case"setVariables":{let r=e[0]??{},s=!0;for(let[n,a]of Object.entries(r)){let o=i.setVariable(n,a);o.warning&&this.onConsole("warn",o.warning),s=s&&o.ok}return s}case"getVariable":return i.getVariable(String(e[0]));case"getVariables":return i.getVariables();case"getAllObjects":return i.getAllObjects();case"findObjectByName":case"findObjectById":return i.findObject(String(e[0]));case"getGeometry":{let r=i.getGeometry(String(e[0]),e[1]??{});return r.warning&&this.onConsole("warn",r.warning),r.data}case"updateObject":return i.updateObject(String(e[0]),e[1]??{});case"createObject":return i.createObject(String(e[0]),e[1]??{});case"createCustomMaterial":if(i.createCustomMaterial===void 0)throw new Error("createCustomMaterial: not available on this surface \u2014 custom three.js/TSL materials need the inline HTML-content mode (editor Preview/Play and web exports).");return i.createCustomMaterial(e[0]);case"setMaterial":if(i.setMaterial===void 0)throw new Error("setMaterial: not available on this surface \u2014 custom three.js/TSL materials need the inline HTML-content mode (editor Preview/Play and web exports).");return i.setMaterial(String(e[0]),e[1]);case"cloneObject":return i.cloneObject(String(e[0]),e[1]??{});case"removeObject":return i.removeObject(String(e[0]));case"spawnObject":{let r=i.spawnObject(String(e[0]),e[1]??{});return r.warning&&this.onConsole("warn",r.warning),r.object}case"destroyObject":return i.destroyObject(String(e[0]));case"setInstanceTransforms":{let r=e[1]===null||e[1]===void 0?null:e[1],s=i.setInstanceTransforms(String(e[0]),r);return s<0&&this.onConsole("warn",`spline.setInstanceTransforms: "${String(e[0])}" has no cloner \u2014 make the object a cloner first (its copies are what this drives).`),s}case"emitEvent":case"emitEventReverse":{let r=i.emitEvent(String(e[0]),String(e[1]),t==="emitEventReverse");return r.warning&&this.onConsole("warn",r.warning),r.ok}case"requestRender":return i.requestRender(),!0;case"listenEvent":{let r=String(e[0]);return r==="variableChange"?this.startVariablePolling():this.eventUnsubs.has(r)||this.eventUnsubs.set(r,i.addSplineEventListener(r,s=>{this.onEvent(r,s)})),!0}case"unlistenEvent":{let r=String(e[0]);return r==="variableChange"?this.stopVariablePolling():(this.eventUnsubs.get(r)?.(),this.eventUnsubs.delete(r)),!0}default:throw new Error(`Unknown spline bridge method: ${t}`)}}startVariablePolling(){this.variablePollHandle===null&&(this.lastVariables=this.deps.getVariables(),this.variablePollHandle=window.setInterval(()=>{if(this.disposed)return;let t=this.deps.getVariables(),e=function(i,r){let s=[];for(let n of Object.keys(r))i[n]!==r[n]&&s.push({name:n,value:r[n]});return s}(this.lastVariables??{},t);this.lastVariables=t;for(let i of e)this.onEvent("variableChange",i)},100))}stopVariablePolling(){this.variablePollHandle!==null&&(window.clearInterval(this.variablePollHandle),this.variablePollHandle=null),this.lastVariables=null}}});function qSt(t,e,i,r){return[t[0]*e+t[4]*i+t[8]*r+t[12],t[1]*e+t[5]*i+t[9]*r+t[13],t[2]*e+t[6]*i+t[10]*r+t[14]]}var HSt=W(()=>{}),bpt,$St=W(()=>{}),XSt=W(()=>{f7(),vpt(),bpt=class{constructor(t,e,i){this.iframe=t,this.deps=e,this.onConsole=i,this.disposed=!1,this.handshakeSeen=!1,this.handshakeTimer=null,this.onMessage=r=>{if(this.disposed||r.source!==this.iframe.contentWindow)return;let s=r.data;var n;typeof(n=s)!="object"||n===null||n[kp]!==!0||typeof n.kind!="string"||this.handleMessage(s)},this.host=new m7(e,i,(r,s)=>{this.sendEvent(r,s)})}attach(){window.addEventListener("message",this.onMessage),this.send({[kp]:!0,kind:"ready-ack"}),this.handshakeTimer=window.setTimeout(()=>{this.handshakeTimer=null,!this.handshakeSeen&&!this.disposed&&this.onConsole("warn","The HTML content frame has not initialized (no signal from its scripts yet) \u2014 if the page looks frozen, check for errors in its code.")},6e3)}dispose(){this.disposed=!0,window.removeEventListener("message",this.onMessage),this.host.dispose(),this.handshakeTimer!==null&&(window.clearTimeout(this.handshakeTimer),this.handshakeTimer=null)}handleMessage(t){switch(t.kind){case"ready":this.handshakeSeen=!0,this.send({[kp]:!0,kind:"ready-ack"});break;case"console":this.onConsole(t.level,t.text);break;case"call":{let e;try{e=Promise.resolve(this.host.execute(t.method,t.args))}catch(i){e=Promise.reject(i)}e.then(i=>{this.send({[kp]:!0,kind:"result",id:t.id,ok:!0,value:i,error:void 0})},i=>{let r=i instanceof Error?i.message:String(i);this.send({[kp]:!0,kind:"result",id:t.id,ok:!1,value:void 0,error:r}),this.onConsole("error",r)});break}case"input":this.dispatchInput(t.event)}}send(t){this.iframe.contentWindow?.postMessage(t,"*")}sendEvent(t,e){this.send({[kp]:!0,kind:"event",eventName:t,payload:e})}dispatchInput(t){let e=this.deps.getCanvas();if(!e)return;let i=this.iframe.getBoundingClientRect(),r={bubbles:!0,cancelable:!0,view:window,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey};switch(t.type){case"pointerdown":case"pointermove":case"pointerup":case"pointercancel":e.dispatchEvent(new PointerEvent(t.type,{...r,clientX:(t.x??0)+i.left,clientY:(t.y??0)+i.top,button:t.button,buttons:t.buttons,pointerId:t.pointerId,pointerType:t.pointerType,isPrimary:t.isPrimary,movementX:t.movementX,movementY:t.movementY}));break;case"click":case"dblclick":e.dispatchEvent(new MouseEvent(t.type,{...r,clientX:(t.x??0)+i.left,clientY:(t.y??0)+i.top,button:t.button,buttons:t.buttons}));break;case"wheel":{let s=new WheelEvent("wheel",{...r,clientX:(t.x??0)+i.left,clientY:(t.y??0)+i.top,deltaX:t.deltaX,deltaY:t.deltaY,deltaMode:t.deltaMode});typeof t.wheelDeltaX=="number"&&Object.defineProperty(s,"wheelDeltaX",{value:t.wheelDeltaX}),typeof t.wheelDeltaY=="number"&&Object.defineProperty(s,"wheelDeltaY",{value:t.wheelDeltaY}),e.dispatchEvent(s);break}case"keydown":case"keyup":e.dispatchEvent(new KeyboardEvent(t.type,{...r,key:t.key,code:t.code,repeat:t.repeat}))}}}}),cr=W(()=>{p7(),RSt(),NSt(),DSt(),ISt(),BSt(),VSt(),kSt(),zSt(),LSt(),FSt(),GSt(),f7(),WSt(),vpt(),HSt(),$St(),XSt()}),YSt=W(()=>{});function _pt(t){return Array.isArray(t)?t:[t]}function CR(t,e){let i=0;for(;i<t.length&&i<e.length;){if(t[i]<e[i])return-1;if(t[i]>e[i])return 1;i+=1}return i!==e.length?-1:i!==t.length?1:0}var KSt=W(()=>{});function Xa(t,e){return Object.setPrototypeOf(t,e),t}function pD(t){let e={...t};return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),e}function $p(t,e,i){if(t===void 0?e===void 0?(t=0,e=10):t=e-10:e===void 0&&(e=t+10),t>e){let n=t;t=e,e=n}let r=[],s=1/(i+1);for(let n=0;n<i;n++){let a=t+(e-t)*(n+.75+.5*Math.random())*s;r.push(a)}return r}function g7(t){return t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Uint32Array||t instanceof Int8Array||t instanceof Int16Array||t instanceof Int32Array||t instanceof Float32Array||t instanceof Float64Array}var ZSt=W(()=>{});function y7(t){if(t.deepFreeze!==void 0)return void t.deepFreeze(t);let e=Object.getOwnPropertyNames(t);for(let i of e){let r=t[i];r&&typeof r=="object"&&y7(r)}return Object.freeze(t)}function xpt(t){for(let e of Object.keys(t))t[e]===void 0&&delete t[e];return t}var mD,ER,l8,Ve,v7,QSt=W(()=>{}),oa=W(()=>{YSt(),KSt(),ZSt(),QSt()}),b7=W(()=>{mD=class{},ER=class extends mD{constructor(t){super(),this.id=t}},l8=class extends mD{constructor(t){super(),this.data=t}}}),JSt=W(()=>{}),e5=W(()=>{Ve=class{modifyById(t,e){let i=this;if(i[t]===void 0)throw new Error("not expected");{let r={...i,[t]:e};return Object.setPrototypeOf(r,Ve.prototype),r}}add(t,e){return this.runOp({type:1,id:t,data:e})?.data??this}runOp(t){let e=this;if(t.type===1){let i,r=e[t.id];i=r===void 0?{type:2,id:t.id}:{type:1,id:t.id,data:r};let{id:s,data:n}=t,a={...e,[s]:n};return Object.setPrototypeOf(a,Ve.prototype),{data:a,actual:t,reverse:i}}if(t.type===2){let{id:i}=t,r=e[i];if(r===void 0)return null;{let s={...e};return Object.setPrototypeOf(s,Ve.prototype),delete s[i],{data:s,actual:t,reverse:{type:1,id:i,data:r}}}}return null}}}),_7=W(()=>{v7=class extends Error{}});function wpt(t,e){for(let i of t)e(i.id,i.data)!==!0&&wpt(i.children,e)}function Spt(t,e){if(e(t.id,t.data)!==!0)for(let i of t.children)Spt(i,e)}var Nn,ZT,Nv,fe,t0=W(()=>{oa(),_7(),oa(),Nn=class extends Array{constructor(...t){super(...t),cc(this,"partialObjectCaches"),cc(this,"objCaches"),cc(this,"parentCaches"),Object.setPrototypeOf(this,Nn.prototype)}deepFreeze(){let t=0;for(;t<this.length;)y7(this[t]),t++}fillCaches0(t,e){this.objCaches.set(t.id,t),this.parentCaches.set(t.id,e);for(let i of t.children)this.fillCaches0(i,t.id)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,this.parentCaches=new Map;for(let t of this)this.fillCaches0(t,null)}}randomId(){this.fillCaches();let t=Array.from(this.objCaches.keys());if(t.length!==0)return t[Math.max(0,Math.floor(Math.random()*t.length)-1)]}nonExistOrDescendantOf(t,e){if(!this.has(t))return!0;for(;t;){let i=this.parent(t);if(i===e)return!0;t=i}return!1}rootAcestor(t){for(;t;){let e=this.parent(t);if(!e)return t;t=e}return t}isDescendantOf(t,e){for(;t;){let i=this.parent(t);if(i===e)return!0;t=i}return!1}data(t){return this.get(t)?.data}has(t){return this.childrenOf(t)!==void 0}partialCache(t){this.partialObjectCaches===void 0&&(this.partialObjectCaches=new Map);let e=this.get(t);e!==void 0&&this.partialObjectCaches.set(t,e)}get(t){if(this.partialObjectCaches!==void 0){let e=this.partialObjectCaches.get(t);if(e!==void 0)return e}return this.fillCaches(),this.objCaches.get(t)}childrenOf(t){return t===null?this:this.get(t)?.children}traverseFrom(t,e){if(t===null)this.traverse(e);else{let i=this.get(t);i&&Spt(i,e)}}traverse(t){wpt(this,t)}totalSize(){return this.fillCaches(),this.objCaches.size}parent(t){return this.fillCaches(),this.parentCaches.get(t)}childrenArray(t){return t===null?this:this.get(t).children}modifyById(t,e){if(this.get(t)===void 0)throw new Error("not expected");{let i=this.parent(t),r=this.childrenArray(i),s=r.findIndex(o=>o.id===t);if(s<0)throw new Error("not expected");let n=r[s];r=[...r],r[s]={...n,data:e};let a=new Map;return a.set(t,r[s]),this.modifyArrayBy(i,r,a)}}modifyArrayBy(t,e,i=void 0){let r=t,s=e;for(;r!==null;){let a=s,o=r;if(r=this.parent(r),r===void 0)throw new Error;s=this.childrenArray(r);let l=s.findIndex(u=>u.id===o);if(l<0)throw new Error;s=[...s],s[l]={...s[l],children:a},i&&i.set(o,s[l])}Object.setPrototypeOf(s,Nn.prototype);let n=s;if(i&&this.objCaches!==void 0&&this.parentCaches!==void 0){n.objCaches=this.objCaches;for(let[a,o]of i)n.objCaches.set(a,o);n.parentCaches=this.parentCaches,this.objCaches=void 0,this.parentCaches=void 0}else n.fillCaches();return n}runOp(t){switch(t.type){case 7:return this.addOp(t);case 8:return this.deleteOp(t);case 9:return this.moveOp(t)}return null}checkDuplicatedIdRec({id:t,children:e}){if(this.get(t)!==void 0)return!0;for(let i of e)if(this.checkDuplicatedIdRec(i))return!0;return!1}addOp(t){let{parent:e,fi:i,id:r,data:s,children:n}=t;if(e!==null&&this.get(e)===void 0||this.checkDuplicatedIdRec(t))return null;{let a=e,o=this.childrenArray(a),l={fi:i,id:r,data:s,children:n};return o=[...o,l],o.sort((u,h)=>u.fi-h.fi),t.localIndex=o.indexOf(l),{data:this.modifyArrayBy(a,o),actual:t,reverse:{type:8,id:r}}}}deleteOp(t){let{id:e}=t;if(this.get(e)===null)return null;{let i=this.parent(e);if(i===void 0)return null;let r=this.childrenArray(i),s=r.findIndex(a=>a.id===e);t.localIndex=s,r=[...r];let n=r.splice(s,1)[0];return{data:this.modifyArrayBy(i,r),actual:t,reverse:{type:7,...n,parent:i}}}}moveOp(t){let{parent:e,fi:i,id:r}=t;if(e!==null&&this.get(e)===void 0)return this.deleteOp({type:8,id:r});if(e!==null){let d=e;for(;d!==null;){if(d===void 0)throw new Error;if(d===r)throw new v7("cyclic tree");d=this.parent(d)}}let s=this.parent(r);if(s===void 0)return null;let n=s,a=this.childrenArray(s),o=a.findIndex(d=>d.id===r);a=[...a];let l=a.splice(o,1)[0],u=this.modifyArrayBy(s,a);s=e,a=u.childrenArray(s);let h=l.fi;return l={...l,fi:i},a=[...a,l],a.sort((d,c)=>d.fi-c.fi),t.localIndex=a.indexOf(l),u=u.modifyArrayBy(s,a),{data:u,actual:t,reverse:{type:9,parent:n,fi:h,id:r}}}previous(t,e){if(e===null){let r=this.childrenArray(t);return r.length===0?null:r[r.length-1].id}let i=null;for(let r of this.childrenArray(t)){if(r.id===e)return i;i=r.id}return null}traverseSortNext(t){let e=this.parent(t);if(e!==void 0){let i=this.childrenArray(e),r=i.findIndex(s=>s.id===t)+1;if(r<i.length)return i[r].id;if(e)return this.traverseSortNext(e)}}sortNext(t){let e=this.childrenArray(t);return e.length>0?e[0].id:this.traverseSortNext(t)}traverseSortPrevious(t){let e=this.childrenArray(t);return e.length>0?this.traverseSortPrevious(e[e.length-1].id):t}sortPrevious(t){let e=this.parent(t);if(e!==void 0){let i=this.childrenArray(e),r=i.findIndex(s=>s.id===t)-1;return r>=0?this.traverseSortPrevious(i[r].id):e}}getAllSorted(t){let e=[];for(let i of t){let r=this.getWithSortKey(i.id);r!==void 0&&e.push({...i,...r})}e.sort((i,r)=>CR(i.sortKey,r.sortKey));for(let i of e)delete i.sortKey;return e}getAllIdSorted(t){let e=[];for(let i of t){let r=this.getWithSortKey(i);r!==void 0&&e.push(r)}e.sort((i,r)=>CR(i.sortKey,r.sortKey));for(let i of e)delete i.sortKey;return e.map(i=>i.id)}getWithSortKey(t){let e=t,i=[],r=this.get(e),s=r;if(r!==void 0){for(;e;)i.splice(0,0,r.fi),e=this.parent(e),e!==null&&(r=this.get(e));return{...s,sortKey:i}}}insertBeforeHelper(t,e,i){return this.insertAfterHelper(t,this.previous(t,e),i)}insertAfterHelper(t,e,i){let r=this.childrenArray(t);if(e===null){if(r.length===0)return $p(0,i,i);{let s=r[0].fi;return $p(s-i,s,i)}}{let s=this.get(e);if(s===void 0||this.parent(e)!==t)throw new Error("illegal args");let n=r.find(a=>a.fi>s.fi);if(n===void 0){let a=r[r.length-1].fi;return $p(a,a+i,i)}return $p(s.fi,n.fi,i)}}}}),x7=W(()=>{var t;ZT=null,(t=Nv||(Nv={})).setPreservePrototype=function(e){ZT=e},t.tryPreservePrototype=function(e,i){return Object.getPrototypeOf(e)===ZT&&Object.setPrototypeOf(i,ZT),i},t.runOp=function(e,i){if(i.type!==0)return null;if(Array.isArray(e)){let r=i.props,s={},n=[...e],a=!1;if(r)for(let o of Object.keys(r)){let l=parseInt(o);if(isNaN(l))throw new Error("wrong index");s[o]=n[l],n[l]=r[o],a=!0}return a?{data:n,actual:i,reverse:{type:0,props:s}}:null}{let r=i.props,s={},n={...e},a=!1;if(r)for(let o of Object.keys(r)){s[o]=n[o];let l=r[o];l===void 0?delete n[o]:n[o]=l,a=!0}return a?{data:t.tryPreservePrototype(e,n),actual:i,reverse:{type:0,props:s}}:null}}}),e0=W(()=>{oa(),oa(),fe=class extends Array{constructor(...t){super(...t),cc(this,"objCaches"),Object.setPrototypeOf(this,fe.prototype)}deepFreeze(){let t=0;for(;t<this.length;)y7(this[t]),t++}fillCaches0(t){this.objCaches.set(t.id,t)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,Object.getOwnPropertyDescriptor(this,"objCaches").enumerable=!1;for(let t of this)this.fillCaches0(t)}}randomId(){this.fillCaches();let t=Array.from(this.objCaches.keys());if(t.length!==0)return t[Math.max(0,Math.floor(Math.random()*t.length)-1)]}data(t){return this.get(t)?.data}get(t){return this.fillCaches(),this.objCaches.get(t)}modifyById(t,e){if(this.get(t)===void 0)throw new Error("not expected");{let i=this,r=i.findIndex(n=>n.id===t);if(r<0)throw new Error("not expected");let s=i[r];return i=[...i],i[r]={...s,data:e},this.modifyArrayBy(i)}}modifyArrayBy(t){Object.setPrototypeOf(t,fe.prototype);let e=t;return typeof process<"u"||e.fillCaches(),e}runOp(t){switch(t.type){case 4:return this.addOp(t);case 5:return this.deleteOp(t);case 6:return this.moveOp(t)}return null}addOp(t){let{fi:e,id:i,data:r}=t,s=this,n={fi:e,id:i,data:r};return s=[...s,n],s.sort((a,o)=>a.fi-o.fi),t.localIndex=s.indexOf(n),{data:this.modifyArrayBy(s),actual:t,reverse:{type:5,id:i}}}deleteOp(t){let{id:e}=t,i=this,r=i.findIndex(n=>n.id===e);if(r===-1)return null;t.localIndex=r,i=[...i];let s=i.splice(r,1)[0];return{data:this.modifyArrayBy(i),actual:t,reverse:{type:4,...s}}}moveOp(t){let{fi:e,id:i}=t,r=this;r=[...r];let s=r.findIndex(o=>o.id===i);if(s===-1)return null;let n=r[s].fi,a={...r[s],fi:e};return r[s]=a,r.sort((o,l)=>o.fi-l.fi),t.localIndex=r.indexOf(a),{data:this.modifyArrayBy(r),actual:t,reverse:{type:6,fi:n,id:i}}}previous(t){if(t===null)return this.length===0?null:this[this.length-1].id;let e=null;for(let i of this){if(i.id===t)return e;e=i.id}return null}insertBeforeHelper(t,e){return this.insertAfterHelper(this.previous(t),e)}insertAfterHelper(t,e){let i=this;if(t===null){if(i.length===0)return $p(0,e,e);{let r=i[0].fi;return $p(r-e,r,e)}}{let r=this.get(t);if(r===void 0)throw new Error("illegal args");let s=i.find(n=>n.fi>r.fi);if(s===void 0){let n=i[i.length-1].fi;return $p(n,n+e,e)}return $p(r.fi,s.fi,e)}}}});function tTt(t,e){let i={cur:[],result:[],len:0};return[t=nv(t,e,i)??t,i.result]}function oP(t,e){return t===null?null:(t.cur[t.len]=e,t.len+=1,t)}function lP(t){t&&(t.len-=1)}function Tpt(t,e,i){let r=!1,s=t.map(n=>{let a=n.id,o=e[a];if(o!==void 0&&typeof o=="string"&&(r=!0,a=o,i!==null))throw new Error("not supported");let l=nv(n.data,e,oP(i,a));lP(i),r=r||l!==void 0,l===void 0&&(l=n.data);let u=Tpt(n.children,e,i);return u!==void 0?r=!0:u=n.children,{...n,id:a,data:l,children:u}});if(r)return s}function nv(t,e,i){if(t instanceof Nn){let r=Tpt(t,e,i);return r!==void 0&&Object.setPrototypeOf(r,Object.getPrototypeOf(t)),r}if(t instanceof fe)return function(r,s,n){let a=!1,o=r.map(l=>{let u=l.id,h=s[u];if(h!==void 0&&typeof h=="string"&&(a=!0,u=h,n!==null))throw new Error("not supported");let d=nv(l.data,s,oP(n,u));return lP(n),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}(t,e,i);if(Array.isArray(t)){let r=!1,s=t.map((n,a)=>{let o=nv(n,e,oP(i,a));return lP(i),r=r||o!==void 0,o===void 0&&(o=n),o});return r?(Object.setPrototypeOf(s,Object.getPrototypeOf(t)),s):void 0}if(t&&typeof t=="object"&&!g7(t)){let r={},s=!1;for(let[n,a]of Object.entries(t))if(n!=="name"&&n!=="variableId"){let o=e[n];if(typeof o=="string"){if(i!==null)throw new Error("not supported");s=!0,n=o}let l=nv(a,e,oP(i,n));lP(i),s=s||l!==void 0,l===void 0&&(l=a),r[n]=l}else r[n]=a;return s?(Object.setPrototypeOf(r,Object.getPrototypeOf(t)),r):void 0}if(typeof t=="string"){let r=e[t];return r!==void 0&&function(s){if(s===null)return null;s.result.push(s.cur.slice(0,s.len))}(i),r}}var Mpt=W(()=>{t0(),e0(),oa()});function av(t){return t&&typeof t=="object"&&t instanceof $s}function w7(t,e){if(e===void 0)return;let i=!1,r=t.map(s=>{let n=s.id,a=I2(s.data,e[n]);if(i=i||a!==void 0,a===void 0&&(a=s.data),s.children){let o=w7(s.children,e);return o!==void 0?i=!0:o=s.children,{...s,id:n,data:a,children:o}}return{...s,id:n,data:a}});return i?r:void 0}function I2(t,e){if(!av(e))return e;if(t instanceof Nn){let i=w7(t,e);return i!==void 0&&Object.setPrototypeOf(i,Object.getPrototypeOf(t)),i}if(t instanceof fe)return function(i,r){if(r===void 0)return;let s=!1,n=i.map(a=>{let o=a.id,l=I2(a.data,r[o]);return s=s||l!==void 0,l===void 0&&(l=a.data),{...a,id:o,data:l}});return s?(Object.setPrototypeOf(n,Object.getPrototypeOf(i)),n):void 0}(t,e);if(Array.isArray(t)){let i=!1,r=t.map((s,n)=>{let a=I2(s,e[n]);return i=i||a!==void 0,a===void 0&&(a=s),a});return i?(Object.setPrototypeOf(r,Object.getPrototypeOf(t)),r):void 0}if(t instanceof $s)return S7(t,e);if(t&&typeof t=="object"){let i={},r=!1;for(let[s,n]of Object.entries(t)){let a=I2(n,e[s]);r=r||a!==void 0,a===void 0&&(a=n),i[s]=a}return r?(Object.setPrototypeOf(i,Object.getPrototypeOf(t)),i):void 0}}function S7(t,e){if(t===void 0)return e;if(e===void 0)return t;if(!av(e))return e;if(!av(t))return nm.apply(t,e);let i=new Set;for(let s of Object.keys(t))i.add(s);for(let s of Object.keys(e))i.add(s);let r=new $s;for(let s of i){let n=S7(t===void 0?void 0:t[s],e===void 0?void 0:e[s]);r[s]=n}return r}var $s,nm,PR,Qn,YH,T7=W(()=>{var t;t0(),e0(),s5(),oa(),$s=class{unusedFunOverridesTable(e){}runOp(e){let i=[],r=this,s=0,n={};for(;s<e.path.length;){if(i.push(r),r=r===void 0?void 0:r[e.path[s]],r!==void 0&&!av(r))return null;s+=1}r=r?pD(r):new $s;for(let[a,o]of Object.entries(e.props)){let l=r[a];n[a]=l,o===void 0?delete r[a]:r[a]=o}for(;s>0;){if(Object.keys(r).length===0){let a=i[s-1];a&&(r=pD(a),delete r[e.path[s-1]])}else{let a=i[s-1];if(a){let o=pD(a);o[e.path[s-1]]=r,r=o}else{let o=new $s;o[e.path[s-1]]=r,r=o}}s-=1}return{data:Object.setPrototypeOf(r,$s.prototype),actual:e,reverse:{...e,props:n}}}},(t=nm||(nm={})).apply=function(e,i){return I2(e,i)??e},t.merge=function(e,i){return S7(e,i)},t.filterOp=function(e,i){let r=0,s=i.path,n=e;for(;r<s.length&&n!==void 0;){if(n=En.zoomOnce(n,s[r]),n===void 0)return i;if(!av(n))return;r+=1}if(n===void 0)return i;if(av(n)){if(i.type===0){let a={...i.props};for(let o of Object.keys(n))delete a[o];return{...i,props:a}}if(i.type===1||i.type===4||i.type===7){let a=w7([i],n);return a?a[0]:i}return i}}}),eTt=W(()=>{s5(),e5(),t0(),_7(),x7(),e0(),Mpt(),T7(),(PR||(PR={})).replaceProps=function(t,e){let i=En.zoom(e,t.path);if(typeof i=="object"){let r={};for(let s of Object.keys(t.props))r[s]=i[s];return{...t,props:r}}return{...t,props:{}}},(t=>{function e(s,n){let a=n.path,o=[];for(;;){let l;if(s instanceof $s&&n.type===0&&(l=s.runOp({...n,path:a.slice(o.length)}),l===null&&(l=void 0)),l===void 0&&o.length===a.length&&(l=s instanceof Nn||s instanceof fe||s instanceof Ve?s.runOp(n):Nv.runOp(s,n)),l!==void 0){if(l!==null){let d=l.data;for(let c=o.length-1;c>=0;c--){let p=a[c],m=o[c];if(m instanceof Nn){if(typeof p=="number")throw new Error("illegal arg");d=m.modifyById(p,d)}else if(m instanceof fe){if(typeof p=="number")throw new Error("illegal arg");d=m.modifyById(p,d)}else if(m instanceof Ve){if(typeof p=="number")throw new Error("illegal arg");d=m.modifyById(p,d)}else if(m instanceof $s){let f={...m,[p]:d};d=Object.setPrototypeOf(f,$s.prototype)}else{if(typeof m!="object")return null;if(Array.isArray(m)){if(typeof p=="string"&&(p=parseInt(p),isNaN(p)))throw new Error("Invalid path");let f=d;d=[...m],d[p]=f}else d=Nv.tryPreservePrototype(m,{...m,[p]:d})}}return{data:d,actual:{...l.actual,path:a},reverse:{...l.reverse,path:a}}}return null}let u,h=a[o.length];if(s instanceof Nn){if(typeof h=="number")throw new Error("");u=s.get(h)?.data}else if(s instanceof fe){if(typeof h=="number")throw new Error("");u=s.get(h)?.data}else s!==null&&(u=s[h]);if(u===void 0)return null;o.push(s),s=u}}function i(s,n){for(let a=0;a<s.length&&a<n.length;a++)if(s[a]!==n[a])return!0;return!1}function r(s,n){if(s.length!==n.length)return!1;for(let a=0;a<s.length;a++)if(s[a]!==n[a])return!1;return!0}t.drop=function(s,n){return{...s,path:s.path.slice(n)}},t.applySimple=function(s,n){return e(s,n)?.data??s},t.apply=e,t.pathDisjoint=i,t.pathEq=r,t.commutative=function(s,n){return i(s.path,n.path)},t.subsumed=function(s,n){return!(s.type!==0||n.type!==0||!r(s.path,n.path))&&Object.keys(s.props).every(a=>n.props[a]!==void 0)}})(Qn||(Qn={})),(t=>{function e(i,r){let s=i,n=[],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=En.zoom(s,[...o.path,o.id]),h=Qn.apply(s,{...o,type:2})):(l=En.zoom(s,[...o.path,o.id,"value"]),h=Qn.apply(s,o)),h!==null){s=h.data;let[d,c]=tTt(s,{[o.id]:l});s=d;for(let p=0;p<c.length;p++){let m=c[p],f=m.pop();if(typeof f=="number"){let g=[f];for(let v=p+1;v<c.length;v++){let b=c[v],_=b[b.length-1];if(typeof _!="number"||!En.equal(m,b.slice(0,b.length-1)))break;g.push(_),c.splice(v,1)}let y=En.zoom(s,m);u=y.map((v,b)=>g.includes(b)?o.id:v),l=y,f=m.pop()}else{if(f==="alphaOverride"||f==="alpha"){l/=100;let g=l,y=En.zoom(s,m.slice(0,m.length-2)),v=y.layers.map(b=>b.id===m[m.length-1]?{...b,data:{...b.data,[f]:g}}:b);Object.setPrototypeOf(v,Object.getPrototypeOf(y.layers)),y.layers=v}u=o.id}n.push({type:0,path:m,props:{[f]:l}}),a.push({type:0,path:m,props:{[f]:u}})}a.push(h.reverse),n.push(h.actual)}}else{let l=Qn.apply(s,o);l!==null&&(n.push(l.actual),s=l.data,a.push(l.reverse))}}catch(l){if(l instanceof v7)return null;throw l}return{data:s,actual:n,reverse:a.reverse()}}t.empty=function(){return[]},t.removePrefix=function(i,r){let s=[];for(let n of i){let[a,...o]=n.path;a===r&&s.push({...n,path:o})}return s},t.addPrefix=function(i,r){return i.map(s=>({...s,path:[r,...s.path]}))},t.concat=function(i,r){return[...i,...r]},t.compress=function(i,r){return[...i.filter(s=>!r.some(n=>Qn.subsumed(s,n))),...r]},t.commutative=function(i,r){return i.every(s=>r.every(n=>Qn.commutative(s,n)))},t.applyAll=function(i,r){for(let s of r){let n=e(i,s);n!==null&&(i=n.data)}return i},t.apply=e})(YH||(YH={}))});function fD(t,e,i){if(t.length>0){let r=t[t.length-1];if(r.type===0&&e.type===0&&En.equal(r.path,i))return void Object.assign(r.props,e.props)}t.push({...e,path:i})}function hP(t,e,i){return i instanceof Nn?new i5(t,e,i):i instanceof fe?new r5(t,e,i):i instanceof Ve?new Proxy(new Cpt(t,e,i),Ppt):i!==null&&typeof i=="object"?g7(i)?i:new Proxy(new Apt(t,e,i),Ept):i}function Bw(t){let e=new u8(t);return[hP(e,"",t),e]}function RR(t,e){let[i,r]=Bw(t);return e(i),r.result()}function js(t){return t instanceof i5||t instanceof r5?t._current:t!==null&&typeof t=="object"?t[h8]:t}var h8,KH,Kb,O0,Apt,Cpt,gD,Ept,Ppt,i5,r5,u8,En,Rpt=W(()=>{e5(),t0(),x7(),e0(),oa(),s5(),h8=Symbol(),KH=Symbol(),Kb=Symbol(),O0=class{reportOp(t,e,i=[]){let r=this;if(e===null)return;r._current=e.data;let s=i;for(;!(r instanceof u8);){let n=r._path,a=r._current;if(n!==""&&s.splice(0,0,n),r=r._parent,r===null)return;r.update(n,a)}r.push(s,t,e.actual,e.reverse)}deleteChildren(t){if(this._children){let e=this._children[t];if(e){let i=e[Kb];i&&i(),delete this._children[t]}}}},Apt=class extends O0{constructor(t,e,i){super(),this._parent=t,this._path=e,this._current=i}update(t,e){if(Array.isArray(this._current)){if(typeof t=="string"&&(t=parseInt(t),isNaN(t)))throw new Error("Invalid path");this._current=[...this._current],this._current[t]=e}else this._current=Nv.tryPreservePrototype(this._current,{...this._current,[t]:e})}runOp(t){this.reportOp(t,Nv.runOp(this._current,t),t.path)}},Cpt=class extends O0{constructor(t,e,i){super(),this._parent=t,this._path=e,this._current=i}update(t,e){this._current={...this._current,[t]:e},Object.setPrototypeOf(this._current,Ve.prototype)}runOp(t){this.reportOp(t,this._current.runOp(t))}},gD={get(t,e){if(e===Kb)return()=>{t._parent=null};if(e===h8)return t._current;if(e===KH)return t;let{_current:i,_children:r}=t;if(e==="push"&&Array.isArray(i))throw new Error("not supported to expand array");let s=r===void 0?void 0:r[e];if(s!==void 0)return s;let n=i[e],a=hP(t,e,n);return a!==n?(r===void 0&&(r={},t._children=r),r[e]=a,a):n},has:(t,e)=>e in t._current,ownKeys:t=>Reflect.ownKeys(t._current),defineProperty(){throw Error("not supported")},getPrototypeOf:t=>Object.getPrototypeOf(t._current),setPrototypeOf(){throw Error("not supported")},getOwnPropertyDescriptor(t,e){let i=t._current,r=Reflect.getOwnPropertyDescriptor(i,e);return r&&{writable:!0,configurable:!0,enumerable:r.enumerable,value:i[e]}}},Ept={...gD,set(t,e,i){let r={type:0,props:{[e]:js(i)??i}};return t.deleteChildren(e),t.runOp(r),!0},deleteProperty(t,e){let i={type:0,props:{[e]:void 0}};return t.deleteChildren(e),t.runOp(i),!0}},Ppt={...gD,set(t,e,i){return i===void 0?this.deleteProperty(t,e):(t.deleteChildren(e),t.runOp({type:1,id:e,data:i})),!0},deleteProperty:(t,e)=>(t.runOp({type:2,id:e}),!0)},i5=class extends O0{constructor(t,e,i){super(),this._children={},this._parent=t,this._path=e,this._current=i,this[Kb]=()=>{this._parent=null}}unproxy(){return this._current}update(t,e){this._current=this._current.modifyById(t,e)}runOp(t){this.reportOp(t,this._current.runOp(t))}randomId(){return this._current.randomId()}isDescendantOf(t,e){return this._current.isDescendantOf(t,e)}childrenOf(t){return this._current.childrenOf(t)}get(t){return this._current.get(t)}parent(t){return this._current.parent(t)}traverse(t){this._current.traverse((e,i)=>{t(e,this.data(e))})}data(t){let{_current:e,_children:i}=this,r=i===void 0?void 0:i[t];if(r!==void 0)return r;let s=e.get(t)?.data,n=hP(this,t,s);return n!==s?(i===void 0&&(i={},this._children=i),i[t]=n,n):s}add(t,e,i,r,s){this.runOp({type:7,parent:t,fi:e,id:i,data:r,children:s})}move(t,e,i){this.runOp({type:9,parent:t,fi:e,id:i})}insertAfter(t,e,i){let r=this._current.insertAfterHelper(t,e,i.length);for(let s=0;s<i.length;s++){let n=i[s];this.add(t,r[s],n.id,n.data,n.children)}}insertBefore(t,e,i){let r=this._current.insertBeforeHelper(t,e,i.length);for(let s=0;s<i.length;s++){let n=i[s];this.add(t,r[s],n.id,n.data,n.children)}}moveAfter(t,e,i){let r=this._current.insertAfterHelper(t,e,i.length);for(let s=0;s<i.length;s++){let n=i[s];this.move(t,r[s],n)}}moveBefore(t,e,i){let r=this._current.insertBeforeHelper(t,e,i.length);for(let s=0;s<i.length;s++){let n=i[s];this.move(t,r[s],n)}}delete(t){this.deleteChildren(t),this.runOp({type:8,id:t})}sortNext(t){return this._current.sortNext(t)}sortPrevious(t){return this._current.sortPrevious(t)}getAllSorted(t){return this._current.getAllSorted(t)}},r5=class extends O0{constructor(t,e,i){super(),this._children={},this._parent=t,this._path=e,this._current=i,this[Kb]=()=>{this._parent=null}}unproxy(){return this._current}get length(){return this._current.length}forEach(t){let e=this.length;for(let i=0;i<e;i++){let r=this._current[i].id,s=this._current[i].fi;t(this.data(this._current[i].id),r,s,i)}}find(t){let e=this.length;for(let i=0;i<e;i++){let r=this._current[i].id;if(t(this.data(r),r))return this.get(r)}}update(t,e){this._current=this._current.modifyById(t,e)}randomId(){return this._current.randomId()}get(t){return{...this._current.get(t),data:this.data(t)}}at(t){let{id:e,fi:i}=this._current.at(t);return{id:e,fi:i,data:this.data(e)}}data(t){let{_current:e,_children:i}=this,r=i===void 0?void 0:i[t];if(r!==void 0)return r;let s=e.get(t)?.data,n=hP(this,t,s);return n!==s?(i===void 0&&(i={},this._children=i),i[t]=n,n):s}runOp(t){this.reportOp(t,this._current.runOp(t))}add(t,e,i){this.runOp({type:4,fi:t,id:e,data:i})}move(t,e){this.runOp({type:6,fi:t,id:e})}insertAfter(t,e){let i=this._current.insertAfterHelper(t,e.length);for(let r=0;r<e.length;r++){let s=e[r];this.add(i[r],s.id,s.data)}}insertBefore(t,e){let i=this._current.insertBeforeHelper(t,e.length);for(let r=0;r<e.length;r++){let s=e[r];this.add(i[r],s.id,s.data)}}moveAfter(t,e){let i=this._current.insertAfterHelper(t,e.length);for(let r=0;r<e.length;r++){let s=e[r];this.move(i[r],s)}}moveBefore(t,e){let i=this._current.insertBeforeHelper(t,e.length);for(let r=0;r<e.length;r++){let s=e[r];this.move(i[r],s)}}delete(t){this.deleteChildren(t),this.runOp({type:5,id:t})}},u8=class extends O0{constructor(t){super(),this.ts=[],this.actual=[],this.reverse=[],this._current=t}update(t,e){if(t!=="")throw new Error("");this._current=e}push(t,e,i,r){fD(this.ts,e,t),fD(this.actual,i,t),fD(this.reverse,r,t)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}}}),s5=W(()=>{b7(),Rpt(),e0(),t0(),oa(),(t=>{function e(r,s){return(r instanceof Nn||r instanceof i5)&&typeof s=="string"||(r instanceof fe||r instanceof r5)&&typeof s=="string"?r.data(s):typeof s=="number"&&Array.isArray(r)||typeof s=="string"&&typeof r=="object"&&r!==null?r[s]:void 0}function i(r,s,n=0){for(;n<s.length&&r!==void 0;)r=e(r,s[n]),n+=1;return r}t.equal=function(r,s){if(s.length!==r.length)return!1;{let n=0;for(;n<r.length;){if(r[n]!==s[n])return!1;n+=1}}return!0},t.removeOverridden=function(r,s,n){let a=i(n,r);if(a!==void 0&&typeof a=="object"&&a!==null){let o={...s};return Object.keys(a).forEach(l=>{delete o[l]}),o}return s},t.zoomOnce=e,t.zoom=i,t.findPathes=function(r,s){let n=[];return function a(o,l){if(o instanceof ER&&o.id===s.id)n.push(l);else if(o instanceof fe)for(let u=0;u<o.length;u++)a(o[u].data,[...l,o[u].id]);else if(o instanceof Nn)o.traverse((u,h)=>{a(u,[...l,h])});else if(Array.isArray(o))for(let u=0;u<o.length;u++)a(o[u],[...l,u]);else{if(g7(o))return;if(typeof o=="object"&&o!==null)for(let u in o)a(o[u],[...l,u])}}(r,[]),n}})(En||(En={}))}),iTt=W(()=>{});function tr(t,e){let i=[];if(!(e.length<=t.length))return null;{let r=0;for(;r<e.length;){if(e[r]==="*")i.push(t[r]);else if(t[r]!==e[r])return null;r+=1}}return i}var rTt=W(()=>{});function QT(t){try{if(!Rr.trusted&&!fc){let i=Wi.sharedLength||0;i<Wi.length&&(Wi.length=i)}let e;if(Rr.randomAccessStructure&&pe[bt]<64&&pe[bt]>=32&&i$?(e=i$(pe,bt,Zl,Rr),pe=null,!(t&&t.lazy)&&e&&(e=e.toJSON()),bt=Zl):e=Hs(),Na&&(bt=Na.postBundlePosition,Na=null),fc&&(Wi.restoreStructures=null),bt==Zl)Wi&&Wi.restoreStructures&&ZH(),Wi=null,pe=null,mc&&(mc=null);else{if(bt>Zl)throw new Error("Unexpected end of MessagePack data");if(!fc){let i;try{i=JSON.stringify(e,(r,s)=>typeof s=="bigint"?`${s}n`:s).slice(0,100)}catch(r){i="(JSON view not available "+r+")"}throw new Error("Data read, but end of buffer not reached "+i)}}return e}catch(e){throw Wi&&Wi.restoreStructures&&ZH(),c8(),(e instanceof RangeError||e.message.startsWith("Unexpected end of buffer")||bt>Zl)&&(e.incomplete=!0),e}}function ZH(){for(let t in Wi.restoreStructures)Wi[t]=Wi.restoreStructures[t];Wi.restoreStructures=null}function Hs(){let t=pe[bt++];if(t<160){if(t<128){if(t<64)return t;{let e=Wi[63&t]||Rr.getStructures&&Npt()[63&t];return e?(e.read||(e.read=d8(e,63&t)),e.read()):t}}if(t<144){if(t-=128,Rr.mapsAsObjects){let e={};for(let i=0;i<t;i++){let r=Opt();r==="__proto__"&&(r="__proto_"),e[r]=Hs()}return e}{let e=new Map;for(let i=0;i<t;i++)e.set(Hs(),Hs());return e}}{t-=144;let e=new Array(t);for(let i=0;i<t;i++)e[i]=Hs();return Rr.freezeData?Object.freeze(e):e}}if(t<192){let e=t-160;if(Gh>=bt)return Xp.slice(bt-pl,(bt+=e)-pl);if(Gh==0&&Zl<140){let i=e<16?M7(e):Dpt(e);if(i!=null)return i}return OR(e)}{let e;switch(t){case 192:return null;case 193:return Na?(e=Hs(),e>0?Na[1].slice(Na.position1,Na.position1+=e):Na[0].slice(Na.position0,Na.position0-=e)):Vpt;case 194:return!1;case 195:return!0;case 196:if(e=pe[bt++],e===void 0)throw new Error("Unexpected end of buffer");return yD(e);case 197:return e=zi.getUint16(bt),bt+=2,yD(e);case 198:return e=zi.getUint32(bt),bt+=4,yD(e);case 199:return Km(pe[bt++]);case 200:return e=zi.getUint16(bt),bt+=2,Km(e);case 201:return e=zi.getUint32(bt),bt+=4,Km(e);case 202:if(e=zi.getFloat32(bt),Rr.useFloat32>2){let i=v8[(127&pe[bt])<<1|pe[bt+1]>>7];return bt+=4,(i*e+(e>0?.5:-.5)|0)/i}return bt+=4,e;case 203:return e=zi.getFloat64(bt),bt+=8,e;case 204:return pe[bt++];case 205:return e=zi.getUint16(bt),bt+=2,e;case 206:return e=zi.getUint32(bt),bt+=4,e;case 207:return Rr.int64AsType==="number"?(e=4294967296*zi.getUint32(bt),e+=zi.getUint32(bt+4)):Rr.int64AsType==="string"?e=zi.getBigUint64(bt).toString():Rr.int64AsType==="auto"?(e=zi.getBigUint64(bt),e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=zi.getBigUint64(bt),bt+=8,e;case 208:return zi.getInt8(bt++);case 209:return e=zi.getInt16(bt),bt+=2,e;case 210:return e=zi.getInt32(bt),bt+=4,e;case 211:return Rr.int64AsType==="number"?(e=4294967296*zi.getInt32(bt),e+=zi.getUint32(bt+4)):Rr.int64AsType==="string"?e=zi.getBigInt64(bt).toString():Rr.int64AsType==="auto"?(e=zi.getBigInt64(bt),e>=BigInt(-2)<<BigInt(52)&&e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=zi.getBigInt64(bt),bt+=8,e;case 212:if(e=pe[bt++],e==114)return y8(63&pe[bt++]);{let i=Ma[e];if(i)return i.read?(bt++,i.read(Hs())):i.noBuffer?(bt++,i()):i(pe.subarray(bt,++bt));throw new Error("Unknown extension "+e)}case 213:return e=pe[bt],e==114?(bt++,y8(63&pe[bt++],pe[bt++])):Km(2);case 214:return Km(4);case 215:return Km(8);case 216:return Km(16);case 217:return e=pe[bt++],Gh>=bt?Xp.slice(bt-pl,(bt+=e)-pl):zpt(e);case 218:return e=zi.getUint16(bt),Gh>=(bt+=2)?Xp.slice(bt-pl,(bt+=e)-pl):Lpt(e);case 219:return e=zi.getUint32(bt),Gh>=(bt+=4)?Xp.slice(bt-pl,(bt+=e)-pl):Fpt(e);case 220:return e=zi.getUint16(bt),bt+=2,QH(e);case 221:return e=zi.getUint32(bt),bt+=4,QH(e);case 222:return e=zi.getUint16(bt),bt+=2,JH(e);case 223:return e=zi.getUint32(bt),bt+=4,JH(e);default:if(t>=224)return t-256;if(t===void 0){let i=new Error("Unexpected end of MessagePack data");throw i.incomplete=!0,i}throw new Error("Unknown MessagePack token "+t)}}}function d8(t,e){function i(){if(i.count++>m8){let s;try{s=t.read=new Function("r","return function(){return "+(Rr.freezeData?"Object.freeze":"")+"({"+t.map(n=>n==="__proto__"?"__proto_:r()":kpt.test(n)?n+":r()":"["+JSON.stringify(n)+"]:r()").join(",")+"})}")(Hs)}catch{return m8=1/0,i()}return t.read0=s,t.highByte===0&&(t.read=f8(e,t.read)),s()}let r={};for(let s=0,n=t.length;s<n;s++){let a=t[s];a==="__proto__"&&(a="__proto_"),r[a]=Hs()}return Rr.freezeData?Object.freeze(r):r}return i.count=0,t.read0=i,t.highByte===0?f8(e,i):i}function Npt(){let t=Bpt(()=>(pe=null,Rr.getStructures()));return Wi=Rr._mergeStructures(t,Wi)}function Vw(t){let e;if(t<16&&(e=M7(t)))return e;if(t>64&&p8)return p8.decode(pe.subarray(bt,bt+=t));let i=bt+t,r=[];for(e="";bt<i;){let s=pe[bt++];if(128&s)if((224&s)==192){let n=(31&s)<<6|63&pe[bt++];n<128?r.push(65533):r.push(n)}else if((240&s)==224){let n=(31&s)<<12|(63&pe[bt++])<<6|63&pe[bt++];n<2048||n>=55296&&n<=57343?r.push(65533):r.push(n)}else if((248&s)==240){let n=(7&s)<<18|(63&pe[bt++])<<12|(63&pe[bt++])<<6|63&pe[bt++];n<65536||n>1114111?r.push(65533):(n>65535&&(n-=65536,r.push(n>>>10&1023|55296),n=56320|1023&n),r.push(n))}else r.push(65533);else r.push(s);r.length>=4096&&(e+=wn.apply(String,r),r.length=0)}return r.length>0&&(e+=wn.apply(String,r)),e}function QH(t){let e=new Array(t);for(let i=0;i<t;i++)e[i]=Hs();return Rr.freezeData?Object.freeze(e):e}function JH(t){if(Rr.mapsAsObjects){let e={};for(let i=0;i<t;i++){let r=Opt();r==="__proto__"&&(r="__proto_"),e[r]=Hs()}return e}{let e=new Map;for(let i=0;i<t;i++)e.set(Hs(),Hs());return e}}function Dpt(t){let e=bt,i=new Array(t);for(let r=0;r<t;r++){let s=pe[bt++];if((128&s)>0)return void(bt=e);i[r]=s}return wn.apply(String,i)}function M7(t){if(t<4){if(t<2){if(t===0)return"";{let e=pe[bt++];return(128&e)>1?void(bt-=1):wn(e)}}{let e=pe[bt++],i=pe[bt++];if((128&e)>0||(128&i)>0)return void(bt-=2);if(t<3)return wn(e,i);let r=pe[bt++];return(128&r)>0?void(bt-=3):wn(e,i,r)}}{let e=pe[bt++],i=pe[bt++],r=pe[bt++],s=pe[bt++];if((128&e)>0||(128&i)>0||(128&r)>0||(128&s)>0)return void(bt-=4);if(t<6){if(t===4)return wn(e,i,r,s);{let n=pe[bt++];return(128&n)>0?void(bt-=5):wn(e,i,r,s,n)}}if(t<8){let n=pe[bt++],a=pe[bt++];if((128&n)>0||(128&a)>0)return void(bt-=6);if(t<7)return wn(e,i,r,s,n,a);let o=pe[bt++];return(128&o)>0?void(bt-=7):wn(e,i,r,s,n,a,o)}{let n=pe[bt++],a=pe[bt++],o=pe[bt++],l=pe[bt++];if((128&n)>0||(128&a)>0||(128&o)>0||(128&l)>0)return void(bt-=8);if(t<10){if(t===8)return wn(e,i,r,s,n,a,o,l);{let u=pe[bt++];return(128&u)>0?void(bt-=9):wn(e,i,r,s,n,a,o,l,u)}}if(t<12){let u=pe[bt++],h=pe[bt++];if((128&u)>0||(128&h)>0)return void(bt-=10);if(t<11)return wn(e,i,r,s,n,a,o,l,u,h);let d=pe[bt++];return(128&d)>0?void(bt-=11):wn(e,i,r,s,n,a,o,l,u,h,d)}{let u=pe[bt++],h=pe[bt++],d=pe[bt++],c=pe[bt++];if((128&u)>0||(128&h)>0||(128&d)>0||(128&c)>0)return void(bt-=12);if(t<14){if(t===12)return wn(e,i,r,s,n,a,o,l,u,h,d,c);{let p=pe[bt++];return(128&p)>0?void(bt-=13):wn(e,i,r,s,n,a,o,l,u,h,d,c,p)}}{let p=pe[bt++],m=pe[bt++];if((128&p)>0||(128&m)>0)return void(bt-=14);if(t<15)return wn(e,i,r,s,n,a,o,l,u,h,d,c,p,m);let f=pe[bt++];return(128&f)>0?void(bt-=15):wn(e,i,r,s,n,a,o,l,u,h,d,c,p,m,f)}}}}}function t$(){let t,e=pe[bt++];if(e<192)t=e-160;else switch(e){case 217:t=pe[bt++];break;case 218:t=zi.getUint16(bt),bt+=2;break;case 219:t=zi.getUint32(bt),bt+=4;break;default:throw new Error("Expected string")}return Vw(t)}function yD(t){return Rr.copyBuffers?Uint8Array.prototype.slice.call(pe,bt,bt+=t):pe.subarray(bt,bt+=t)}function Km(t){let e=pe[bt++];if(Ma[e]){let i;return Ma[e](pe.subarray(bt,i=bt+=t),r=>{bt=r;try{return Hs()}finally{bt=i}})}throw new Error("Unknown extension type "+e)}function Opt(){let t=pe[bt++];if(!(t>=160&&t<192))return bt--,Ipt(Hs());if(t-=160,Gh>=bt)return Xp.slice(bt-pl,(bt+=t)-pl);if(!(Gh==0&&Zl<180))return OR(t);let e,i=4095&(t<<5^(t>1?zi.getUint16(bt):t>0?pe[bt]:0)),r=g8[i],s=bt,n=bt+t-3,a=0;if(r&&r.bytes==t){for(;s<n;){if(e=zi.getUint32(s),e!=r[a++]){s=1879048192;break}s+=4}for(n+=3;s<n;)if(e=pe[s++],e!=r[a++]){s=1879048192;break}if(s===n)return bt=s,r.string;n-=3,s=bt}for(r=[],g8[i]=r,r.bytes=t;s<n;)e=zi.getUint32(s),r.push(e),s+=4;for(n+=3;s<n;)e=pe[s++],r.push(e);let o=t<16?M7(t):Dpt(t);return r.string=o??OR(t)}function Ipt(t){if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean"||typeof t=="bigint")return t.toString();if(t==null)return t+"";if(Rr.allowArraysInMapKeys&&Array.isArray(t)&&t.flat().every(e=>["string","number","boolean","bigint"].includes(typeof e)))return t.flat().toString();throw new Error("Invalid property type for record: "+typeof t)}function Bpt(t){r$&&r$();let e=Zl,i=bt,r=DR,s=pl,n=Gh,a=Xp,o=NR,l=mc,u=Na,h=new Uint8Array(pe.slice(0,Zl)),d=Wi,c=Wi.slice(0,Wi.length),p=Rr,m=fc,f=t();return Zl=e,bt=i,DR=r,pl=s,Gh=n,Xp=a,NR=o,mc=l,Na=u,pe=h,fc=m,(Wi=d).splice(0,Wi.length,...c),Rr=p,zi=new DataView(pe.buffer,pe.byteOffset,pe.byteLength),f}function c8(){pe=null,mc=null,Wi=null}function sTt(t){t.unpack?Ma[t.type]=t.unpack:Ma[t.type]=t}var p8,pe,Zl,bt,e$,NR,DR,Rr,Wi,Xp,pl,Gh,Na,mc,Ma,zi,vD,Vpt,fc,m8,i$,r$,kw,kpt,f8,OR,zpt,Lpt,Fpt,wn,g8,y8,bD,s$,n$,a$,v8,JT,o$,l$,h$,b8,_D,mS,nTt=W(()=>{try{p8=new TextDecoder}catch{}bt=0,NR=e$=[],DR=0,Rr={},pl=0,Gh=0,Ma=[],vD={useRecords:!1,mapsAsObjects:!0},(Vpt=new class{}).name="MessagePack 0xC1",fc=!1,m8=2,kw=class{constructor(t){t&&(t.useRecords===!1&&t.mapsAsObjects===void 0&&(t.mapsAsObjects=!0),t.sequential&&t.trusted!==!1&&(t.trusted=!0,!t.structures&&t.useRecords!=0&&(t.structures=[],t.maxSharedStructures||(t.maxSharedStructures=0))),t.structures?t.structures.sharedLength=t.structures.length:t.getStructures&&((t.structures=[]).uninitialized=!0,t.structures.sharedLength=0),t.int64AsNumber&&(t.int64AsType="number")),Object.assign(this,t)}unpack(t,e){if(pe)return Bpt(()=>(c8(),this?this.unpack(t,e):kw.prototype.unpack.call(vD,t,e)));!t.buffer&&t.constructor===ArrayBuffer&&(t=typeof Buffer<"u"?Buffer.from(t):new Uint8Array(t)),typeof e=="object"?(Zl=e.end||t.length,bt=e.start||0):(bt=0,Zl=e>-1?e:t.length),DR=0,Gh=0,Xp=null,NR=e$,Na=null,pe=t;try{zi=t.dataView||(t.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength))}catch(i){throw pe=null,t instanceof Uint8Array?i:new Error("Source must be a Uint8Array or Buffer but was a "+(t&&typeof t=="object"?t.constructor.name:typeof t))}if(this instanceof kw){if(Rr=this,this.structures)return Wi=this.structures,QT(e);(!Wi||Wi.length>0)&&(Wi=[])}else Rr=vD,(!Wi||Wi.length>0)&&(Wi=[]);return QT(e)}unpackMultiple(t,e){let i,r=0;try{fc=!0;let s=t.length,n=this?this.unpack(t,s):JT.unpack(t,s);if(!e){for(i=[n];bt<s;)r=bt,i.push(QT());return i}if(e(n,r,bt)===!1)return;for(;bt<s;)if(r=bt,e(QT(),r,bt)===!1)return}catch(s){throw s.lastPosition=r,s.values=i,s}finally{fc=!1,c8()}}_mergeStructures(t,e){t=t||[],Object.isFrozen(t)&&(t=t.map(i=>i.slice(0)));for(let i=0,r=t.length;i<r;i++){let s=t[i];s&&(s.isShared=!0,i>=32&&(s.highByte=i-32>>5))}t.sharedLength=t.length;for(let i in e||[])if(i>=0){let r=t[i],s=e[i];s&&(r&&((t.restoreStructures||(t.restoreStructures=[]))[i]=r),t[i]=s)}return this.structures=t}decode(t,e){return this.unpack(t,e)}},kpt=/^[a-zA-Z_$][a-zA-Z\d_$]*$/,f8=(t,e)=>function(){let i=pe[bt++];if(i===0)return e();let r=t<32?-(t+(i<<5)):t+(i<<5),s=Wi[r]||Npt()[r];if(!s)throw new Error("Record id is not defined for "+r);return s.read||(s.read=d8(s,t)),s.read()},OR=Vw,zpt=Vw,Lpt=Vw,Fpt=Vw,wn=String.fromCharCode,g8=new Array(4096),y8=(t,e)=>{let i=Hs().map(Ipt),r=t;e!==void 0&&(t=t<32?-((e<<5)+t):(e<<5)+t,i.highByte=e);let s=Wi[t];return s&&(s.isShared||fc)&&((Wi.restoreStructures||(Wi.restoreStructures=[]))[t]=s),Wi[t]=i,i.read=d8(i,r),(i.read0||i.read)()},Ma[0]=()=>{},Ma[0].noBuffer=!0,Ma[66]=t=>{let e=t.byteLength%8||8,i=BigInt(128&t[0]?t[0]-256:t[0]);for(let r=1;r<e;r++)i<<=BigInt(8),i+=BigInt(t[r]);if(t.byteLength!==e){let r=new DataView(t.buffer,t.byteOffset,t.byteLength),s=(n,a)=>{let o=a-n;if(o<=40){let d=r.getBigUint64(n);for(let c=n+8;c<a;c+=8)d<<=BigInt(64),d|=r.getBigUint64(c);return d}let l=n+(o>>4<<3),u=s(n,l),h=s(l,a);return u<<BigInt(8*(a-l))|h};i=i<<BigInt(8*(r.byteLength-e))|s(e,r.byteLength)}return i},bD={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError:typeof AggregateError=="function"?AggregateError:null},Ma[101]=()=>{let t=Hs();if(!bD[t[0]]){let e=Error(t[1],{cause:t[2]});return e.name=t[0],e}return bD[t[0]](t[1],{cause:t[2]})},Ma[105]=t=>{if(Rr.structuredClone===!1)throw new Error("Structured clone extension is disabled");let e=zi.getUint32(bt-4);mc||(mc=new Map);let i,r=pe[bt];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)&&pe[bt+1]===115?new Set:{};let s={target:i};mc.set(e,s);let n=Hs();if(!s.used)return s.target=n;if(Object.assign(i,n),i instanceof Map)for(let[a,o]of n.entries())i.set(a,o);if(i instanceof Set)for(let a of Array.from(n))i.add(a);return i},Ma[112]=t=>{if(Rr.structuredClone===!1)throw new Error("Structured clone extension is disabled");let e=zi.getUint32(bt-4),i=mc.get(e);return i.used=!0,i.target},Ma[115]=()=>new Set(Hs()),s$=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(t=>t+"Array"),n$=typeof globalThis=="object"?globalThis:window,Ma[116]=t=>{let e=t[0],i=Uint8Array.prototype.slice.call(t,1).buffer,r=s$[e];if(!r){if(e===16)return i;if(e===17)return new DataView(i);throw new Error("Could not find typed array for code "+e)}return new n$[r](i)},Ma[120]=()=>{let t=Hs();return new RegExp(t[0],t[1])},a$=[],Ma[98]=t=>{let e=(t[0]<<24)+(t[1]<<16)+(t[2]<<8)+t[3],i=bt;return bt+=e-t.length,Na=a$,(Na=[t$(),t$()]).position0=0,Na.position1=0,Na.postBundlePosition=bt,bt=i,Hs()},Ma[255]=t=>t.length==4?new Date(1e3*(16777216*t[0]+(t[1]<<16)+(t[2]<<8)+t[3])):t.length==8?new Date(((t[0]<<22)+(t[1]<<14)+(t[2]<<6)+(t[3]>>2))/1e6+1e3*(4294967296*(3&t[3])+16777216*t[4]+(t[5]<<16)+(t[6]<<8)+t[7])):t.length==12?new Date(((t[0]<<24)+(t[1]<<16)+(t[2]<<8)+t[3])/1e6+1e3*((128&t[4]?-281474976710656:0)+1099511627776*t[6]+4294967296*t[7]+16777216*t[8]+(t[9]<<16)+(t[10]<<8)+t[11])):new Date("invalid"),v8=new Array(147);for(let t=0;t<256;t++)v8[t]=+("1e"+Math.floor(45.15-.30103*t));(JT=new kw({useRecords:!1})).unpack,JT.unpackMultiple,JT.unpack,o$=new Float32Array(1),new Uint8Array(o$.buffer,0,4)}),aTt=W(()=>{nTt(),b7(),T7(),e0(),e5(),t0(),l$=[{Class:Ve.prototype.constructor,type:1,write:t=>({...t}),read:t=>(Object.setPrototypeOf(t,Ve.prototype),t)},{Class:fe.prototype.constructor,type:2,write:t=>[...t],read:t=>(Object.setPrototypeOf(t,fe.prototype),t)},{Class:Nn.prototype.constructor,type:3,write:t=>[...t],read:t=>(Object.setPrototypeOf(t,Nn.prototype),t)},{Class:ER.prototype.constructor,type:4,write:t=>t.id,read:t=>new ER(t)},{Class:l8.prototype.constructor,type:5,write:t=>t.data,read:t=>new l8(t)},{Class:$s.prototype.constructor,type:6,write:t=>({...t}),read:t=>(Object.setPrototypeOf(t,$s.prototype),t)}];for(let t of l$)sTt(t);h$=new kw({structuredClone:!0}),(b8||(b8={})).deserialize=function(t){return h$.unpack(t)}}),oTt=W(()=>{aTt(),_D=t=>()=>{throw new Error(t+" is not available in the runtime build (decode-only CollabSerialize)")},mS={deserialize:b8.deserialize,serialize:_D("CollabSerialize.serialize"),checksum:_D("CollabSerialize.checksum")}}),Fi=W(()=>{s5(),JSt(),_7(),t0(),e5(),x7(),e0(),eTt(),iTt(),Rpt(),rTt(),b7(),oTt(),Mpt(),T7()});function _8(t){return t==="MouseDown"||t==="MouseUp"||t==="KeyDown"||t==="KeyUp"||t==="Collision"||t==="Trigger"}var u$,x8,q1,tM,xD,d$,c$,p$,w8,S8,m$,f$,g$,y$,v$,T8,M8,b$,_$,x$,w$,Upt=W(()=>{var t,e,i;Fi(),yt(),(t=u$||(u$={})).toEventUIType=function(r){return r.type==="Conditional"?r.condition.type==="Distance"?"Distance":"StateChange":r.type},t.fromEventUIType=function(r){return r==="Distance"||r==="StateChange"?"Conditional":r},x8={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(s){return s.type==="MouseDown"||s.type==="MouseUp"||s.type==="MousePress"||s.type==="KeyDown"||s.type==="KeyUp"||s.type==="KeyPress"},r.defaultData=function(s){return s==="MouseDown"||s==="MouseUp"||s==="MousePress"?{type:s,mode:"Object",disabled:!1,name:"",actions:new fe}:{type:s,disabled:!1,name:"",key:void 0,actions:new fe}}})(q1||(q1={})),(r=>{r.propertyDefaultData=function(s){return{type:"Property",value:[s??null,"position","x"]}},r.valueDefaultData={type:"Literal",value:0}})(tM||(tM={})),(e=xD||(xD={})).comparisonDefaultData=function(r){return{type:"Comparison",operator:"==",lOperand:tM.propertyDefaultData(r),rOperand:{...tM.valueDefaultData}}},e.distanceDefaultData=function(r){return{type:"Distance",toObject:r??null,fromObject:r??null,distance:200}},e.stateDefaultData=function(r,s){return{type:"State",object:r??null,state:s??null}},(d$||(d$={})).isConditionalSubActions=function(r){return r.find(s=>s==="ifActions"||s==="elseActions")!==void 0},(r=>{r.is=function(s){return s.type==="Conditional"},r.defaultData=function(s){return{type:"Conditional",disabled:!1,name:"",inActions:new fe,outActions:new fe,condition:xD.distanceDefaultData(s)}}})(c$||(c$={})),(p$||(p$={})).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 fe,drop:new fe}},(w8||(w8={})).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 fe},(S8||(S8={})).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(s){return s.type==="MouseHover"},r.defaultData=function(){return{type:"MouseHover",disabled:!1,name:"",actions:new fe}}})(m$||(m$={})),(r=>{r.is=function(s){return s.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 fe}}})(f$||(f$={})),(r=>{r.is=function(s){return s.type==="Start"},r.defaultData=function(){return{type:"Start",disabled:!1,name:"",actions:new fe}}})(g$||(g$={})),(r=>{r.is=function(s){return s.type==="Collision"},r.defaultData=function(){return{type:"Collision",disabled:!1,name:"",target:"character",actions:new fe}}})(y$||(y$={})),(r=>{r.is=function(s){return s.type==="Trigger"},r.defaultData=function(s,n){return{type:"Trigger",name:"",disabled:!1,target:"all",triggeringObjects:[],actions:new fe,triggerZone:"box",position:n.toArray(),rotation:[0,0,0],size:s.toArray(),radius:s.length()/2,helperVisible:!0}}})(v$||(v$={})),(i=T8||(T8={})).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 fe},s={size:"tablet",operator:"<",actions:new fe},n={size:[...i.defaultSizes.custom],operator:"<>",actions:new fe},a=new fe;return a.push({id:Yt.generateUUID(),fi:0,data:r},{id:Yt.generateUUID(),fi:1,data:s},{id:Yt.generateUUID(),fi:2,data:n}),{type:"Resize",disabled:!1,name:"",orientation:"horizontal",breakpoints:a}},i.defaultBreakpointData=function(){return{size:[...i.defaultSizes.custom],operator:"<>",actions:new fe}},(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(s){return s.type==="VariableChange"},r.defaultData=function(){return{disabled:!1,type:"VariableChange",name:"",actions:new fe,variableId:"",objectId:null,property:"Position X"}}})(M8||(M8={})),(r=>{r.is=function(s){return s.type==="API"},r.defaultData=function(){return{disabled:!1,type:"API",name:"",successActions:new fe,errorActions:new fe,userAPIId:""}}})(b$||(b$={})),(r=>{r.is=function(s){return s.type==="WEBHOOK"},r.defaultData=function(){return{disabled:!1,type:"WEBHOOK",name:"",actions:new fe,userWebhookId:""}}})(_$||(_$={})),(r=>{r.is=function(s){return s.type==="AIAssistantListener"},r.defaultData=function(){return{disabled:!1,type:"AIAssistantListener",name:"",actions:new fe,analysis:"average",analysisRange:[0,71],analysisSingle:0}}})(x$||(x$={})),(r=>{r.is=function(s){return s.type==="AIAssistantTrigger"},r.defaultData=function(){return{disabled:!1,description:"",name:"",type:"AIAssistantTrigger",actions:new fe}}})(w$||(w$={}))});function S$(t){let e=typeof t;return t!==null&&(e==="object"||e==="function")}function T$(t){return typeof t=="string"&&t.length===36&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t)}var i0,ov,jpt,Xg,M$,Hu,am,fS,A$,lv,nn,Hi,A8,C$,Yp,Dv,E$,P$,R$,N$,D$,O$,I$,B$,wD,V$,k$,SD,z$,L$,F$,TD,U$,MD,j$,G$,W$,q$,H$,$$,X$,Y$,K$,Yg,gc,Kp,C8,E8,IR,BR,VR,kR,zR,P8,R8,LR,N8,hv,Z$,AD,CD,D8,Q$,FR,J$,tX,O8,eX,iX,rX,sX,nX,aX,oX,lX,hX,n5,A7,Gs,ds,T1,Gpt,gS,UR,ug,I8,C7,jR,GR,B8,lc,uP,Jn,ED,Gp,_l=W(()=>{var t,e,i,r,s,n,a,o;i0="personal camera",ov="a218fcc3-276b-49b9-b485-49037fd14f5f",jpt=2500134,Xg=5526619,(t=M$||{}).x="x",t.y="y",t.z="z",M$=t,(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,m){let f=l.sub(p,c),g=l.sub(m,c),y=l.dot(f,g)/l.dot(f,f),v=l.scalarMultiply(f,y);return l.add(c,v)}l.isEqual=function(c,p){return c[0]===p[0]&&c[1]===p[1]},l.lerp=function(c,p,m){return[c[0]+(p[0]-c[0])*m,c[1]+(p[1]-c[1])*m]},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,m){return h(c,d(c,p,m))},l.center=function(c,p){return[.5*(c[0]+p[0]),.5*(c[1]+p[1])]}})(Hu||(Hu={})),(e=am||(am={})).isEqual=function(l,u){return l[0]===u[0]&&l[1]===u[1]&&l[2]===u[2]},e.add=function(l,u){return[l[0]+u[0],l[1]+u[1],l[2]+u[2]]},e.sub=function(l,u){return[l[0]-u[0],l[1]-u[1],l[2]-u[2]]},e.div=function(l,u){return[l[0]/u[0],l[1]/u[1],l[2]/u[2]]},e.mul=function(l,u){return[l[0]*u[0],l[1]*u[1],l[2]*u[2]]},e.dist=function(l,u){return Math.hypot(l[0]-u[0],l[1]-u[1],l[2]-u[2])},e.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=fS||(fS={})).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])]}})(A$||(A$={})),(r=lv||(lv={})).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},(s=nn||(nn={})).isRGB=function(l){return typeof l=="object"&&typeof l.r=="number"&&typeof l.g=="number"&&typeof l.b=="number"},s.white={r:1,g:1,b:1},s.red={r:1,g:0,b:0},s.black={r:0,g:0,b:0},s.toRgb255a1=function(l){return{r:Math.round(255*l.r),g:Math.round(255*l.g),b:Math.round(255*l.b),a:1}},s.clone=function(l){return{r:l.r,g:l.g,b:l.b}},s.fromHex=function(l){return{r:((l=Math.floor(l))>>16&255)/255,g:(l>>8&255)/255,b:(255&l)/255}},s.toHex=function(l){return 65536*Math.round(255*l.r)+256*Math.round(255*l.g)+Math.round(255*l.b)},s.equals=function(l,u){return l.r===u.r&&l.g===u.g&&l.b===u.b},s.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)},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}},s.is=function(l){return!!S$(l)&&"r"in l&&"g"in l&&"b"in l&&!("a"in l)},(n=Hi||(Hi={})).white={...nn.white,a:1},n.is=function(l){return!!S$(l)&&"r"in l&&"g"in l&&"b"in l&&"a"in l},n.transparent={...nn.white,a:0},n.from0to1=function(l){return{r:l[0],g:l[1],b:l[2],a:l[3]}},n.fromHexAndA=function(l,u){return{...nn.fromHex(l),a:u}},n.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}},n.equals=function(l,u){return nn.equals(l,u)&&l.a===u.a},n.equalsFixed=function(l,u){return nn.equalsFixed(l,u)&&l.a.toFixed(2)===u.a.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,a:l.a+(u.a-l.a)*h}},n.toStyle=function({r:l,g:u,b:h,a:d}=n.white){return`rgba(${255*l}, ${255*u}, ${255*h}, ${d})`},(A8||(A8={})).identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1],pivot:[0,0,0],pivotRotation:[0,0,0]},(a=C$||{})[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",C$=a,(Yp||(Yp={})).defaultData={mass:1,stiffness:80,damping:10,velocity:0},(Dv||(Dv={})).defaultData={control1:[.5,0],control2:[.5,1]},(o=E$||(E$={})).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]}),lTt=W(()=>{var t,e;Fi(),Upt(),(P$||(P$={})).defaultData={type:"SwitchCamera",name:"",targetCamera:"",delay:0,animate:!0,duration:1e3,easing:4,runMode:"Normal"},(R$||(R$={})).defaultData={type:"SceneTransition",name:"",target:"",delay:0,duration:1,transition:"none"},(N$||(N$={})).defaultData={type:"Link",name:"",url:null,context:"tab"},(D$||(D$={})).defaultData={type:"Destroy",name:"",objects:[],delay:0},(O$||(O$={})).defaultData={type:"Particles",name:"",emitterObjectId:"",delay:0,emission:"start",triggerAfter:"any"},(I$||(I$={})).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"},(B$||(B$={})).defaultData={type:"Reset",name:"",delay:0},(wD||(wD={})).defaultData={interaction:"play",delay:0,volume:.5,loop:1},(t=V$||(V$={})).pauseDefaultData={interaction:"pause",delay:0},t.stopDefaultData={interaction:"stop",delay:0},(e=k$||(k$={})).defaultData={type:"Audio",name:"",...wD.defaultData},e.hasAudioByActions=i=>i.some(({data:r})=>r.type==="Audio"&&r.interaction==="play"&&r.audio),e.hasAudioByEvents=i=>{for(let{data:r}of i)if(q1.is(r)||r.type==="Start"||r.type==="Collision"){if(e.hasAudioByActions(r.actions))return!0}else if(r.type==="Conditional"){if(e.hasAudioByActions(r.inActions)||e.hasAudioByActions(r.outActions))return!0}else if(r.type==="GameControl"&&Object.values(r.gameActions).find(s=>e.hasAudioByActions(s)))return!0},e.getAudiosByActions=i=>{let r=[];return i.forEach(s=>{let n=s.data;n.type==="Audio"&&n.interaction==="play"&&n.audio&&r.push(s),n.type==="Conditional"&&(r.push(...e.getAudiosByActions(n.ifActions)),r.push(...e.getAudiosByActions(n.elseActions)))}),r},e.getAudiosByEvents=i=>{let r=[];return i.forEach(({data:s})=>{q1.is(s)||s.type==="Collision"||s.type==="Start"||s.type==="Trigger"?r.push(...e.getAudiosByActions(s.actions)):s.type==="Conditional"?(r.push(...e.getAudiosByActions(s.inActions)),r.push(...e.getAudiosByActions(s.outActions))):s.type==="GameControl"?Object.values(s.gameActions).forEach(n=>{r.push(...e.getAudiosByActions(n))}):s.type==="DragDrop"&&(r.push(...e.getAudiosByActions(s.dragDropActions.drag)),r.push(...e.getAudiosByActions(s.dragDropActions.drop)))}),r},(SD||(SD={})).defaultData={interaction:"play",delay:0,volume:.5,loop:1/0},(i=>{i.pauseDefaultData={interaction:"pause",delay:0},i.stopDefaultData={interaction:"stop",delay:0}})(z$||(z$={})),(i=>{i.defaultData={type:"Video",name:"",triggerAfter:"autoplay",...SD.defaultData},i.hasVideoByActions=r=>r.some(({data:s})=>s.type==="Video"&&s.interaction==="play"&&s.layerId),i.hasVideoByObject=r=>{if(r.events){for(let{data:s}of r.events)if((q1.is(s)||s.type==="Start")&&i.hasVideoByActions(s.actions))return!0}},i.getVideosByActions=r=>{let s=[];return r.forEach(n=>{let a=n.data;a.type==="Video"&&a.interaction==="play"&&a.layerId&&s.push(n)}),s},i.getVideosByEvents=r=>{let s=[];return r.forEach(({data:n})=>{(q1.is(n)||n.type==="Start")&&s.push(...i.getVideosByActions(n.actions))}),s}})(L$||(L$={})),(F$||(F$={})).defaultData=function(i){return{state:i,repeat:0,delay:0,delayDirection:"start-once",direction:"normal",duration:1e3,easing:4}},(TD||(TD={})).defaultData=function(){return{tweens:new fe,repeat:0,delay:0,delayDirection:"start-once",direction:"normal"}},(U$||(U$={})).defaultData=function(i){return{type:"Transition",name:"",runMode:"Once",object:i??null,...TD.defaultData()}},(MD||(MD={})).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}})(j$||(j$={})),(G$||(G$={})).defaultData=function(i){return{type:"TimelineAnimation",name:"",...MD.defaultData(i)}},(W$||(W$={})).defaultData=function(i,r,s){return{type:"Animation",name:"",object:i,clipId:r,crop:s,crop2:s,repeat:-1,delay:0,delayDirection:"start-once",direction:"normal",runMode:"Normal"}},(q$||(q$={})).defaultData={type:"SetVariable",name:"",variableId:"",expression:[]},(H$||(H$={})).defaultData=()=>({type:"Conditional",name:"",ifActions:new fe,elseActions:new fe,condition:[]}),($$||($$={})).defaultData={type:"DynamicVariablePlay",name:"",variableId:"",mode:"PlayPause",delay:0,pauseDelay:0},(X$||(X$={})).defaultData={type:"ClearLocalStorage",name:"",target:"all"},(Y$||(Y$={})).defaultData={name:"",type:"UserAPI"}}),hTt=W(()=>{var t;(t=K$||(K$={})).emptyAudio={data:Uint8Array.from(atob("UklGRjIAAABXQVZFZm10IBIAAAABAAEAQB8AAEAfAAABAAgAAABmYWN0BAAAAAAAAABkYXRhAAAAAA=="),e=>e.charCodeAt(0)),mimeType:"audio/wav",filename:"unknown"},t.maxSize=2e6}),Wpt=W(()=>{var t;(t=Yg||(Yg={})).all=["PerspectiveCamera","OrthographicCamera"],t.is=function(e){return t.all.includes(e)},(e=>{e.DefaultUp=[0,1,0],e.DefaultTargetOffset=1e3,e.MinTargetOffset=.001,e.sanitizeTargetOffset=function(n){return n===void 0||!Number.isFinite(n)||n<e.MinTargetOffset?e.DefaultTargetOffset:n},e.DefaultAzimuth=-24,e.DefaultElevation=15;let i=e.DefaultAzimuth*Math.PI/180,r=e.DefaultElevation*Math.PI/180,s=180/Math.PI;e.DefaultPosition=[e.DefaultTargetOffset*Math.sin(i)*Math.cos(r),e.DefaultTargetOffset*Math.sin(r),e.DefaultTargetOffset*Math.cos(i)*Math.cos(r)],e.DefaultRotation=[Math.atan2(-Math.sin(r),Math.cos(i)*Math.cos(r))*s,Math.asin(Math.sin(i)*Math.cos(r))*s,Math.atan2(Math.sin(i)*Math.sin(r),Math.cos(i))*s],e.defaultData={far:1e5,type:"PerspectiveCamera",perspective:{near:70,fov:45,zoom:1},orthographic:{near:-1e5,zoom:1},up:e.DefaultUp,isUpVectorFlipped:!1,targetOffset:e.DefaultTargetOffset},e.getZoom=function(n){return n.type==="PerspectiveCamera"?n.perspective?.zoom??1:n.orthographic?.zoom??1}})(gc||(gc={}))}),qpt=W(()=>{var t;(t=Kp||(Kp={})).defaultData=function(e,i=.1){return{disabled:!1,type:"linear",hideBase:!1,instanced:!1,count:3,radial:{radius:2*Math.max(typeof e[0]=="number"?e[0]:1,typeof e[1]=="number"?e[1]:1),start:0,end:360,alignment:!1,axis:"y",scale:[1,1,1],rotation:[0,0,0],position:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},toObject:{object:"",spreadType:"random",scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],axis:"x",seed:0,count:99,align:"normal",pivot:[0,0,0],pivotRotation:[0,0,0]},linear:{scale:[1,1,1],rotation:[0,0,0],position:[(typeof e[0]=="number"?e[0]+e[0]:1)*i,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},grid:{count:[2,2,2],size:e.map(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"}}},t.merge=function(e,i){let r={...e};if(E8.forEach(s=>{Object.assign(r,{[s]:i[s]??e[s]})}),r.radial={...e.radial},i.radial){let s=e.radial,n=i.radial;IR.forEach(a=>{Object.assign(r.radial,{[a]:n[a]??s[a]})})}if(r.linear={...e.linear},i.linear){let s=e.linear,n=i.linear;BR.forEach(a=>{Object.assign(r.linear,{[a]:n[a]??s[a]})})}if(r.grid={...e.grid},i.grid){let s=e.grid,n=i.grid;VR.forEach(a=>{Object.assign(r.grid,{[a]:n[a]??s[a]})})}if(r.toObject={...e.toObject},i.toObject){let s=e.toObject,n=i.toObject;kR.forEach(a=>{Object.assign(r.toObject,{[a]:n[a]??s[a]})})}if(r.randomnessObject={...e.randomnessObject},i.randomnessObject){let s=e.randomnessObject,n=i.randomnessObject;zR.forEach(a=>{Object.assign(r.randomnessObject,{[a]:n[a]??s[a]})})}return r},t.isPartial=function(e){return!(!e.randomnessObject&&!e.toObject)},(e=>{e.defaultData={radial:{},linear:{},grid:{},toObject:{},randomnessObject:{}};let i=["radial","linear","grid","toObject","randomnessObject"];e.toOps=function(r,s){let n=[];r.count!==void 0&&n.push({type:0,path:s,props:{count:r.count}});for(let a of i){let o=r[a];o&&Object.keys(o).length>0&&n.push({type:0,path:[...s,a],props:o})}return n}})(C8||(C8={})),E8=["count"],IR=["radius","start","end","position","scale","rotation"],BR=["position","scale","rotation"],VR=["count","size"],kR=["count","position","scale","rotation"],zR=["strength","scale","rotation","position","movement","seed","freqScale"]}),Hpt=W(()=>{var t;_l(),(t=P8||(P8={})).all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"],t.is=function(e){return t.all.includes(e)},(R8||(R8={})).defaultData=function(e){return function(i){if(i==="PointLight")return{type:i,color:Hi.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,penumbraSize:.5,depth:1e5};if(i==="SpotLight")return{type:i,color:Hi.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:Hi.white,intensity:1,shadows:!0,size:2e3,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};throw new Error("not implemented")}(e)}}),$pt=W(()=>{var t;(t=LR||(LR={})).defaultShapeData={type:"PlaneEmitterShape",size:[100,100,100]},t.defaultCollisionData={colliderEntityId:null,collisionBounce:.75},t.defaultData={renderMaterial:{type:"particleMaterial",color:{r:1,g:.2,b:.545,a:1},color2:{r:.945,g:.714,b:.184,a:1},coloring:"gradient",ease:"linearFadeOut",easeSize:"linearFadeOut",transparent:!0,size:[40,40],texture:"pt_default_particle",spriteRotation:[0,0]},birthRatePerSec:50,gravity:1,noiseStrength:0,noiseScale:0,noiseSeed:1,noiseType:"curl",randomRotation:0,randomScale:.2,randomMass:.5,rootObjectType:"instancedMesh",life:1,direction:[0,0,0],directionMode:"axis",speed:10,shape:t.defaultShapeData,autoPlay:!0,emitTimeDelay:0,emitTimeCycle:"infinity",emitTimeDuration:1,...t.defaultCollisionData}}),Xpt=W(()=>{var t;(t=N8||(N8={})).defaultData={gravity:10,damping:.03,localStiffness:.67,globalStiffness:.5,globalRange:.15,stiffnessFalloff:.1,windStrength:0,vspCoefficient:.01,elasticity:.15,hairLength:.75,tipSeparation:.8,kink:0,kinkFrequency:0,clumpStrength:0,clumpSize:32,clumpTipScale:1.5,spreadRadius:.03,guideStrands:8192,headShape:"sphere",baseObjectId:null,hairColorSource:"custom",hairShadeRoot:.6,hairShadeTip:1.15,hairRootColor:{r:.29,g:.102,b:.039,a:1},hairMidColor:{r:.8,g:.267,b:.133,a:1},hairTipColor:{r:.545,g:.18,b:.18,a:1},headColor:{r:.325,g:.137,b:.114,a:1},noiseEnabled:!1,noiseColorA:{r:.545,g:.184,b:.788,a:1},noiseColorB:{r:.914,g:.188,b:.914,a:1},noiseColorC:{r:.2,g:.4,b:1,a:1},noiseColorD:{r:.2,g:1,b:.6,a:1},noiseScale:1.8,noiseMixHair:.75,noiseMixHead:.8,castShadow:!0,receiveShadow:!0,hairWidth:1.75,specularPower:40,specularIntensity:.4,diffuseIntensity:.6,ambientIntensity:.25,opacity:1,tipFade:.4,autoPlay:!0},t.regenProps=["hairLength","spreadRadius","guideStrands","headShape","baseObjectId"]}),E7=W(()=>{(hv||(hv={})).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]}}),Ypt=W(()=>{var t,e;(t=Z$||{})[t.Front=0]="Front",t[t.Back=1]="Back",t[t.Double=2]="Double",Z$=t,(e=AD||(AD={})).defaultData={castShadow:!0,receiveShadow:!0},e.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,s){return r.flatShading===s.flatShading&&r.side===s.side&&r.wireframe===s.wireframe&&(r.shadowCatcher??!1)===(s.shadowCatcher??!1)}})(CD||(CD={})),(D8||(D8={})).defaultData={...CD.defaultData,...AD.defaultData},(Q$||(Q$={})).getMaterialData=function(i,r){let s=[];if("material"in i){let n=typeof i.material=="string"?r.materials[i.material]??r.lib.materials[i.material]?.asset:i.material;n&&s.push(n)}else if("materials"in i)for(let n of i.materials){let a=typeof n=="string"?r.materials[n]??r.lib.materials[n]?.asset:n;a&&s.push(a)}return s}}),Kpt=W(()=>{var t;(t=FR||(FR={})).defaultVideo={data:"",thumb:"/_assets/_videos/catThumb.png",type:"video",name:"Cat video"},t.maxSize=3e7}),IS=W(()=>{var t,e,i,r;Fi(),_l(),Kpt(),_l(),(J$||(J$={})).is=function(s){return s==="texture"||s==="video"||s==="color"||s==="depth"||s==="normal"||s==="gradient"||s==="noise"||s==="fresnel"||s==="cavity"||s==="dust"||s==="rainbow"||s==="toon"||s==="outline"||s==="particle"||s==="transmission"||s==="reflection"||s==="matcap"||s==="displace"||s==="pattern"||s==="vertexColor"||s==="light"},(tX||(tX={})).is=function(s){return s==="luminance"||s==="r"||s==="g"||s==="b"||s==="a"},(O8||(O8={})).is=function(s){return typeof s=="object"&&s!==null&&s.image!=null},(eX||(eX={})).is=function(s){return s==="phong"||s==="toon"||s==="lambert"||s==="physical"},(r=iX||{})[r.Linear=0]="Linear",r[r.Radial=1]="Radial",r[r.Polar=2]="Polar",iX=r,rX=(s=>(s[s.RepeatWrapping=1e3]="RepeatWrapping",s[s.ClampToEdgeWrapping=1001]="ClampToEdgeWrapping",s[s.MirroredRepeatWrapping=1002]="MirroredRepeatWrapping",s))(rX||{}),sX=(s=>(s[s.NearestFilter=1003]="NearestFilter",s[s.LinearFilter=1006]="LinearFilter",s[s.LinearMipmapLinearFilter=1008]="LinearMipmapLinearFilter",s))(sX||{}),(i=nX||{})[i.UV=0]="UV",i[i.Planar=1]="Planar",i[i.Spherical=2]="Spherical",i[i.Cylindrical=3]="Cylindrical",i[i.Triplanar=4]="Triplanar",nX=i,(e=aX||{})[e.Simplex=0]="Simplex",e[e.SimplexFractal=1]="SimplexFractal",e[e.Ashima=2]="Ashima",e[e.Fbm=3]="Fbm",e[e.Perlin=4]="Perlin",e[e.Voronoi=5]="Voronoi",aX=e,(t=oX||{})[t.F1=0]="F1",t[t.F2=1]="F2",t[t.F2MinusF1=2]="F2MinusF1",t[t.SmoothBlend=3]="SmoothBlend",t[t.Edge=4]="Edge",t[t.Power=5]="Power",t[t.Lines=6]="Lines",t[t.Cells=7]="Cells",oX=t,lX=(s=>(s[s.Lights=0]="Lights",s[s.Static=1]="Static",s[s.Camera=2]="Camera",s))(lX||{}),hX=(s=>(s[s.Circle=0]="Circle",s[s.Ring=1]="Ring",s[s.Polygon=2]="Polygon",s[s.Cross=3]="Cross",s[s.Diamond=4]="Diamond",s[s.Checkerboard=5]="Checkerboard",s[s.Line=6]="Line",s[s.Wave=7]="Wave",s))(hX||{}),n5=["mode","gradientType","noiseType","tracingMode","mirror","displacementType","projection","cnormal","crop","axis","side","roughnessMapChannel","metalnessMap","metalnessMapChannel","normalMap","aoMap","aoMapChannel","emissiveMap","style"],A7=["wrapping","image","video","name","minFilter","magFilter"],(s=>{s.patch=function(n,a){let{texture:o,...l}=a;if(Object.assign(n,l),o){let u=n.texture;u&&Object.assign(u,o)}},s.defaultColorLayer=function(n){return{...s.defaultData("color"),color:n}},s.defaultData=function(n,a){return n==="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:FR.defaultVideo,wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"color":return{...l,type:"color",color:nn.fromHex(Xg)};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:{...nn.fromHex(6710886),a:1},colorB:{...nn.fromHex(6710886),a:1},colorC:{...nn.fromHex(16777215),a:1},colorD:{...nn.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:Hi.fromHexAndA(16777215,1),bias:.1,scale:1,intensity:2,factor:1};case"dust":return{...l,type:"dust",color:Hi.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:Hi.fromHexAndA(0,0),offset:[0,0,0]};case"outline":return{...l,type:"outline",outlineColor:Hi.fromHexAndA(0,1),contourColor:Hi.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:{...nn.fromHex(0),a:1},colorB:{...nn.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}}}(n)}})(Gs||(Gs={})),(s=>{function n(a,o="layer1",l="layer2",u=nn.fromHex(16777215)){let h=new fe;return h.push({fi:0,data:Gs.defaultData("light",a),id:o}),h.push({fi:1,data:Gs.defaultData("color"),id:l}),{layers:h}}s.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")},s.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},s.defaultEmptyData=function(){return{layers:new fe}},s.defaultData=function(a="layer1",o="layer2"){return n("physical",a,o)},s.withName=function(a,o){return{...a,name:o}},s.defaultTwoLayerData=n,s.defaultColorMaterial=function(a,o,l="layer1",u="layer2"){let h=new fe;return h.push({fi:0,data:Gs.defaultData("light",o),id:l}),h.push({fi:1,data:Gs.defaultColorLayer(a),id:u}),{layers:h}},s.defaultUIObjectMaterial=function(a){let o=Gs.defaultData("texture");a&&Object.assign(o.texture,{image:a});let l=new fe;return l.push({fi:0,data:o,id:"layer1"}),l.push({fi:1,data:{...Gs.defaultData("transmission"),alpha:1},id:"layer2"}),l.push({fi:2,data:{...Gs.defaultData("light","lambert"),alpha:0},id:"layer3"}),{layers:l}},s.defaultTwoLayerTextureData=function(a,o="physical",l="layer1",u="layer2"){let h=Gs.defaultData("texture");Object.assign(h.texture,{image:a});let d=new fe;return d.push({fi:0,data:h,id:l}),d.push({fi:1,data:Gs.defaultData("light",o),id:u}),{layers:d}},s.defaultTwoLayerVideoTextureData=function(a,o="physical",l="layer1",u="layer2"){let h=Gs.defaultData("video");Object.assign(h.texture,{video:a});let d=new fe;return d.push({fi:0,data:h,id:l}),d.push({fi:1,data:Gs.defaultData("light",o),id:u}),{layers:d}}})(ds||(ds={}))}),uTt=W(()=>{T1="Roboto_regular",Gpt="https://fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Me5WZLCzYlKw.ttf"}),Zpt=W(()=>{Fi(),(gS||(gS={})).defaultData=function(){return{points:new fe,roundness:0,shapeHoles:[],isClosed:!1}}}),Qpt=W(()=>{Fi(),(UR||(UR={})).defaultData=function(){return{points:new fe,lastInsertionPlane:null,subdivisions:12,isClosed:!1,subdivisionMode:"parametric"}},ug={type:"Ellipse",width:50,height:50,spikes:16,angle:360,innerRadius:0},(I8||(I8={})).merge=function(t,e){let i={...t};return jR.forEach(r=>{Object.assign(i,{[r]:e[r]??t[r]})}),i},C7={shape:ug,depth:1,offset:0,bevel:50,bevelSides:6,angle:0,twist:0,startScale:1,endScale:1,capType:"flat"},jR=["depth","offset","angle","twist","startScale","endScale"]}),P7=W(()=>{var t,e;Zpt(),Qpt(),(t=GR||(GR={})).is2DParametricMesh=function(i){return i==="PolygonGeometry"||i==="RectangleGeometry"||i==="StarGeometry"||i==="TriangleGeometry"||i==="EllipseGeometry"||i==="UIGeometry"},t.isParametricMesh=function(i){return i==="PolygonGeometry"||i==="RectangleGeometry"||i==="StarGeometry"||i==="TriangleGeometry"||i==="EllipseGeometry"||i==="PathGeometry"||i==="VectorGeometry"||i==="ConeGeometry"||i==="CubeGeometry"||i==="CylinderGeometry"||i==="DodecahedronGeometry"||i==="HelixGeometry"||i==="IcosahedronGeometry"||i==="LatheGeometry"||i==="PyramidGeometry"||i==="SphereGeometry"||i==="PlaneGeometry"||i==="BackdropGeometry"||i==="TorusGeometry"||i==="TorusKnotGeometry"||i==="BooleanGeometry"||i==="TextGeometry"||i==="InputGeometry"||i==="DecalGeometry"},t.isSwappableGeometry=function(i){return i==="PolygonGeometry"||i==="RectangleGeometry"||i==="StarGeometry"||i==="TriangleGeometry"||i==="EllipseGeometry"||i==="PathGeometry"||i==="VectorGeometry"||i==="ConeGeometry"||i==="CubeGeometry"||i==="CylinderGeometry"||i==="DodecahedronGeometry"||i==="HelixGeometry"||i==="IcosahedronGeometry"||i==="LatheGeometry"||i==="PyramidGeometry"||i==="SphereGeometry"||i==="PlaneGeometry"||i==="BackdropGeometry"||i==="TorusGeometry"||i==="TorusKnotGeometry"||i==="TextGeometry"||i==="SubdivGeometry"||i==="NonParametricGeometry"},(B8||(B8={})).merge=function(i,r){let s={...i};return Object.assign(s,r),s.type==="PathGeometry"&&"extrusion"in r&&r.extrusion&&(s.extrusion={...i.extrusion},Object.assign(s.extrusion,I8.merge(s.extrusion,r.extrusion))),s},(e=lc||(lc={})).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:UR.defaultData(),extrusion:C7};if(i==="VectorGeometry")return{width:1,height:1,type:i,subdivisions:12,shape:gS.defaultData(),depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if(i==="BooleanGeometry")return{type:i,operation:2,width:0,height:0,depth:0,phongAngle:35};if(i==="ShapeBlendGeometry")return{type:i,width:0,height:0,depth:0,resolutionLevel:6,blendRange:100,useChildrenColors:!1};if(i==="DecalGeometry")return{type:i,width:200,height:200,depth:200,offset:1};if(i==="TextGeometry")return{type:i,width:100,height:100,depth:0,horizontalAlign:1,verticalAlign:1,fontSize:16,lineHeight:1.2,letterSpacing:0,text:{textValue:""},textTransform:1,font:"Roboto_regular",editable:!1,extrudeBevelSize:0,extrudeBevelSegments:1};if(i==="InputGeometry")return{...e.defaultData("TextGeometry"),type:i,editable:!0};if(i==="SphereGeometry")return{type:"SphereGeometry",width:100,height:100,depth:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180};throw new Error("not implemented")},uP=["width","height","depth"]}),Jpt=W(()=>{_l(),(t=>{function e(i){return i.mode??"linear"}t.defaultData={enabled:!1,useBackgroundColor:!1,color:nn.white,near:.1,far:2e3,mode:"linear",density:.005,heightFalloff:.01,heightBase:0},t.getMode=e,t.getModeIndex=function(i){let r=e(i);return r==="height"?1:r==="both"?2:0},t.getDensity=function(i){return i.density??t.defaultData.density},t.getHeightFalloff=function(i){return i.heightFalloff??t.defaultData.heightFalloff},t.getHeightBase=function(i){return i.heightBase??t.defaultData.heightBase}})(Jn||(Jn={}))}),R7=W(()=>{(ED||(ED={})).defaultData={image:null,rotation:0,blur:32,showBackground:!0},(Gp||(Gp={})).defaultData={enabled:!1,mode:"hdri",hdri:ED.defaultData,timeOfDay:10,weather:"partlyCloudy",lighting:!0,lightingIntensity:1,lightingQuality:"full",clouds:!0,windSpeed:2,animateWind:!0,exposure:1,seed:2}});function dTt(t){let e=typeof t=="string"?Number.parseInt(t,10):t;return typeof e=="number"&&Number.isFinite(e)?Math.min(5,Math.max(0,Math.round(e))):3}var WR,uv,PD,RD,ND,dv,DD,V8,k8,uX,I0,tmt,rn,qR,dX,cX,pX,mX,Bu,B2,HR,$R,yc,kg,fX,Zp,XR,vc,OD,ID,bg,Kg,_g,V2,z8,gX,Da,BD,yX,vX,hc,Kl,cv,L8,emt=W(()=>{(()=>{let t={opacity:1,blendFunction:13,enabled:!1};(WR||(WR={})).defaultData={enabled:!1,pixelation:{...t,blendFunction:16,granularity:15},bloom:{...t,blendFunction:16,intensity:1,blurScale:1,luminanceThreshold:.25,luminanceSmoothing:.025,kernelSize:3},chromaticAberration:{...t,offset:[2,2]},vignette:{...t,darkness:1,offset:0},hueSaturation:{...t,hue:3,saturation:0},brightnessContrast:{...t,brightness:.25,contrast:0},depthOfField:{...t,focusDistance:100,focalLength:20,bokehScale:5},noise:{...t,blendFunction:16}}})()}),N7=W(()=>{var t;Jpt(),R7(),emt(),_l(),(t=uv||(uv={})).defaultData={type:"normal",softShadowQuality:"low"},t.isSoft=function(e){return e!=null&&(e.type===void 0||e.type==="soft")},(PD||(PD={})).defaultData={enabled:!0,color:{r:.8274509803921568,g:.8274509803921568,b:.8274509803921568},intensity:.75},(RD||(RD={})).defaultData={occlusion:!1,aoFullRes:!1,radius:256,bias:.5,aoColor:{r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}},(e=>{e.defaultData={pipeline:"classic",toneMapping:"aces",exposure:1},e.isUntouched=function(i){return i===void 0||i.pipeline==="classic"&&(i.toneMapping==="none"||i.toneMapping==="aces")&&i.exposure===1}})(ND||(ND={})),(dv||(dv={})).defaultData={usePhysics:!1,gravity:-10},(DD||(DD={})).defaultData={playCamera:i0,gameControlObject:null},(V8||(V8={})).defaultData={backgroundColor:Hi.fromHexAndA(jpt,1),postprocessing:WR.defaultData,fog:Jn.defaultData,sky:Gp.defaultData,globalPhysics:dv.defaultData,ambient:PD.defaultData,ao:RD.defaultData,shadow:uv.defaultData,publish:DD.defaultData,grading:ND.defaultData}}),cTt=W(()=>{(k8||(k8={})).defaultData={colliderType:"box",size:[100,100,100],colliderHelperVisible:!0,forceType:"collider",forceRange:"global",forceIntensity:.5,forceDambing:.95}}),a5=W(()=>{var t,e,i;Fi(),Wpt(),Hpt(),$pt(),Xpt(),E7(),Ypt(),_l(),IS(),P7(),qpt(),oa(),N7(),cTt(),(t=uX||(uX={})).isComponentRelated=function(r){return r==="Component"||r==="Instance"},t.isEmptyOrComponent=function(r){return r==="Empty"||r==="Instance"},(e=I0||(I0={})).identity={...A8.identity,hiddenMatrix:lv.identity},e.fromObject=function(r){return{position:r.position,rotation:r.rotation,scale:r.scale,pivot:r.pivot,pivotRotation:r.pivotRotation,hiddenMatrix:r.hiddenMatrix}},e.merge=function(r,s){return{position:s?.position||r.position,rotation:s?.rotation||r.rotation,pivot:s?.pivot||r.pivot,pivotRotation:s?.pivotRotation||r.pivotRotation,scale:s?.scale||r.scale,hiddenMatrix:s?.hiddenMatrix||r.hiddenMatrix}},e.diff=function(r,s){return xpt({position:am.isEqual(r.position,s.position)?void 0:s.position,rotation:am.isEqual(r.rotation,s.rotation)?void 0:s.rotation,scale:am.isEqual(r.scale,s.scale)?null:s.scale,hiddenMatrix:lv.isEqual(r.hiddenMatrix,s.hiddenMatrix)?void 0:s.hiddenMatrix})},tmt=["slide","offset"],(rn||(rn={})).defaultData={states:new fe,events:new fe,visible:!0,raycastLock:!1,physics:hv.defaultData,pathSnapping:{pathId:null,slide:0,offset:0,orientation:"tangential"},...I0.identity,cloner:null},(qR||(qR={})).defaultData={type:"Empty",...rn.defaultData},(dX||(dX={})).defaultData={type:"ParticleCollider",...k8.defaultData,...rn.defaultData},(cX||(cX={})).defaultData={type:"Component",...rn.defaultData},(pX||(pX={})).defaultData={type:"Particle",...rn.defaultData,...LR.defaultData},(mX||(mX={})).defaultData={type:"Hair",...rn.defaultData,...N8.defaultData},(Bu||(Bu={})).defaultData={type:"Mesh",...rn.defaultData,...D8.defaultData},(B2||(B2={})).defaultData={...rn.defaultData,...I0.identity,position:gc.DefaultPosition,rotation:gc.DefaultRotation,...gc.defaultData},(r=>{r.defaultData=function(s){return{...rn.defaultData,...R8.defaultData(s)}},r.defaultDirectionalLightData={...r.defaultData("DirectionalLight"),position:[200,300,300],name:"Directional Light",intensity:.7}})(HR||(HR={})),(r=>{function s(n,a,o=0){for(;o<a.length;){let l=n?n[a[o]]:void 0;if(a.length===o+1)return l;if(!l)return;n=l.descendants,o+=1}}r.resolveWithDes=s,r.resolve=function(n,a,o=0){let l=s(n,a,o);if(l){let u=Object.keys(l);if(u.length===1&&u[0]==="descendants")return}return l}})($R||($R={})),(r=>{function s(n,a){return{...rn.defaultData,...a,component:n,overrides:new $s,physics:void 0,events:void 0,type:"Instance"}}r.rootOverrideProps=["physics","events"],r.compositeNonOptionalOverrideProps=["geometry"],r.compositeEntireOverrideOverrideProps=["material"],r.ofComponent=s,r.fromComponentData=function(n){let a=I0.fromObject(n.data);return s(n.id,a)}})(yc||(yc={})),(r=>{r.defaultData={type:"Page",...rn.defaultData,physics:{...hv.defaultData,fusedBody:!1},...V8.defaultData,camera:B2.defaultData,timelines:new Ve},r.isUIPage=function(s){return s.uiScene!==void 0}})(kg||(kg={})),(i=fX||(fX={})).defaultCamera={position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0],hiddenMatrix:lv.identity,name:"Play Camera",visible:!0,raycastLock:!1,physics:hv.defaultData,states:new fe,events:new fe,cloner:null,pathSnapping:{pathId:null,orientation:"tangential",slide:0,offset:0},...gc.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",...rn.defaultData,...Bu.defaultData,geometry:lc.defaultData("RectangleGeometry"),material:ds.defaultTwoLayerData("physical","layer1","layer2")},i.defaultBooleanObject={name:"Boolean",...rn.defaultData,...Bu.defaultData,geometry:lc.defaultData("BooleanGeometry"),material:ds.defaultTwoLayerData("physical","layer1","layer2")},i.defaultShapeBlendObject={name:"Shape Blend",...rn.defaultData,...Bu.defaultData,geometry:lc.defaultData("ShapeBlendGeometry"),material:ds.defaultTwoLayerData("physical","layer1","layer2")},i.defaultTextObject={name:"Text",...rn.defaultData,...Bu.defaultData,geometry:lc.defaultData("TextGeometry"),material:ds.defaultTwoLayerData("physical","layer1","layer2")},i.defaultInputObject={name:"Input",...rn.defaultData,...Bu.defaultData,geometry:lc.defaultData("InputGeometry"),material:ds.defaultTwoLayerData("physical","layer1","layer2")},(r=>{r.newEmpty=function(s,n){let a={name:n};return s.type==="Mesh"?(a.geometry={},"material"in s&&(a.material={layers:new $s}),"materials"in s&&(a.materials=s.materials.map(o=>({layers:new $s})))):Yg.is(s.type)&&(a.perspective={},a.orthographic={}),a},r.toOps=function(s,n){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:m,...f}=p;if(m!==void 0&&Object.keys(m).length>0){let g={path:[...h,"layers",c,"texture"],props:m,type:0};o.push(g)}if(Object.keys(f).length>0){let g={path:[...h,"layers",c],props:f,type:0};o.push(g)}}}for(let[h,d]of Object.entries(n)){let c=d;if(h!=="name")if(h==="cloner")o.push(...C8.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,m]of Object.entries(c))u(["materials",p],m);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(s,n){if(n===void 0)return s;let a={...s};if(Object.assign(a,I0.merge(a,n)),Object.assign(a,{pathSnapping:Object.assign({},a.pathSnapping,{slide:n.pathSnapping?.slide??a.pathSnapping?.slide??0,offset:n.pathSnapping?.offset??a.pathSnapping?.offset??0})}),Yg.is(s.type)){a.orthographic={...a.orthographic},a.perspective={...a.perspective};let o=n;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(s.type==="Mesh")"geometry"in n&&Object.assign(a,{geometry:B8.merge(a.geometry,n.geometry)}),(n.material||n.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=RR(u.material,h=>{if(typeof h!="string")for(let[d,c]of Object.entries(l.material.layers)){let p=h.layers.data(d);p&&Gs.patch(p,c)}}).data),u.materials&&l.materials&&(u.materials=RR(u.materials,h=>{for(let d=0;d<u.materials.length;d++){let c=l.materials[d];if(typeof c!="string")for(let[p,m]of Object.entries(c.layers)){let f=h[d]?.layers?.data(p);f&&Gs.patch(f,m)}}}).data),u}(a,n)),a.cloner&&"cloner"in n&&Object.assign(a,{cloner:Kp.merge(a.cloner,n.cloner)});else if(s.type==="Empty")a.cloner&&"cloner"in n&&Object.assign(a,{cloner:Kp.merge(a.cloner,n.cloner)});else if(P8.is(s.type)){let o=n;o.intensity!==void 0&&(a.intensity=o.intensity),o.color!==void 0&&(typeof o.color=="string"?a.color=o.color:a.color=nn.clone(o.color))}return a}})(Zp||(Zp={}))}),D7=W(()=>{(XR||(XR={})).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}}),o5=W(()=>{D7(),_l(),(vc||(vc={})).defaultData={orbitControls:XR.defaultData,playPage:ov,withBackground:!0,preventScroll:!1,preventTouchScroll:!1,hideCursor:!1,mouseEventTarget:"canvas",joystickSizeAndXYOffset:Array(12).fill(0).map((t,e)=>{let i=0,r=0;return e<5?r=-30:e<10&&(r=30),e===0||e===10||e===5?i=30:(e===4||e===11||e===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}}),imt=W(()=>{var t;(OD||(OD={})).defaultData={id:"basic",label:"Basic",style:"None",prompt:""},(ID||(ID={})).defaultData={weather:0,shadows:0,lightOrigin:0,temperature:0,sun:0,camera:0,environment:0,particles:0,nature:0,floor:0},(t=bg||(bg={})).defaultData=()=>({mode:"line-art-both",prompt:"",negativePrompt:"",style:{...OD.defaultData},isRandomSeed:!0,seed:t.generateSeed(),guessMode:!1,advanced:!1,steps:20,guidanceScale:7.5,controlNetScale:1,modifiers:ID.defaultData}),t.generateSeed=()=>Math.round(1e5*Math.random())}),O7=W(()=>{a5(),Fi(),o5(),_l(),oa(),imt(),(t=>{function e(i,r){let s=i.scene.objects.get(r);if(s&&s.data.type==="Component")return s;{let n=i.shared.lib.components[r];if(n)return{...n.asset,id:r}}}t.physicsEnabled=function(i){return i.find(r=>r.data.type==="Page"&&r.data.globalPhysics.usePhysics)!==void 0},t.findTimeline=function(i,r){let s=i.find(n=>n.data.type==="Page"&&n.data.timelines?.[r]!==void 0);return s&&s.data.timelines?.[r]},t.getComponentData=e,t.traverseModuleInstances=function(i,r,s){i.scene.objects.traverseFrom(r,(n,a)=>{if(a.type==="Instance"){let o=e(i,a.component)?.data;o&&s(n,a,o.events)}else s(n,a,a.events)})}})(Kg||(Kg={})),(t=>{function e(r=!0,s=[]){let n=[];r&&n.push({...t.defaultLight}),n.push(...s);let a=new Nn;return a.push({fi:1,id:ov,data:{...kg.defaultData,name:"Scene 1"},children:n}),a}function i(r){return{...t.defaultData,objects:Xa(r,Nn.prototype)}}t.TRASH_CAN_ID="830a2708-8ed9-49cf-a68e-085299892222",t.defaultLight={fi:-1,data:HR.defaultDirectionalLightData,id:"830a2708-8ed9-49cf-a68e-085299899103",children:[]},t.createDefaultObjectTreeWithPage=e,t.defaultData={objects:e(),publish:vc.defaultData,styles:bg.defaultData()},t.emptyDataWithoutPage=function(){return{objects:new Nn,publish:vc.defaultData,styles:bg.defaultData()}},t.emptyDataWithPage=function(r=!0){return{objects:e(r),publish:vc.defaultData,styles:bg.defaultData()}},t.emptyData=function(){return{objects:new Nn,publish:{...vc.defaultData},styles:bg.defaultData()}},t.withObjs=i,t.withObj=function(r,s){return i([{id:r,data:s,children:[],fi:0}])}})(_g||(_g={}))}),rmt=W(()=>{(V2||(V2={})).defaultData={preset:"fullscreen",allowResponsive:!1,size:[512,512],coords:[0,0],sceneScale:1,color:{r:0,g:0,b:0,a:.5}}}),I7=W(()=>{var t,e;Fi(),oa(),(t=z8||(z8={})).defaultData=i=>({url:i,name:"New Webhook",parametersSchemas:new fe}),t.defaultParameterValueByType=i=>i==="number"?0:i!=="boolean"&&"",(gX||(gX={})).defaultData=(i,r="GET")=>({url:i,method:r,name:"New API",headers:new fe,queries:new fe,autoStart:!0}),(i=>{function r(n){return n.textValue!==void 0}function s(n){return typeof n=="boolean"}i.isTextValue=r,i.isNumber=function(n){return typeof n=="number"},i.isBoolean=s,i.typeOfVariable=function(n){return r(n)?"string":s(n)?"boolean":"number"},i.getDisplayedValue=function(n){return i.isTextValue(n)?Array.isArray(n.textValue)?n.textValue.map(a=>a.toString().padStart(n.padding??2,"0")).join(n.deliminator??":")+(n.suffix!==void 0?" "+n.suffix:""):n.textValue.toString():i.isBoolean(n)?n?"True":"False":i.isNumber(n)?parseFloat(n.toFixed(3)).toString():n.toString()}})(Da||(Da={})),(BD||(BD={})).all=["images","videos","colors","audios","particles","fonts","materials","variables"],(yX||(yX={})).all=[...BD.all,"components"],(vX||(vX={})).defaultData=function(){return{images:new Ve,videos:new Ve,colors:new Ve,audios:new Ve,particles:new Ve,fonts:new Ve,materials:new Ve,components:new Ve,variables:new Ve,userAPIs:new Ve,userWebhooks:new Ve}},(hc||(hc={})).defaultData=function(){return{images:new Ve,videos:new Ve,colors:new Ve,audios:new Ve,particles:new Ve,fonts:new Ve,materials:new Ve,components:new Ve,variables:new Ve,userAPIs:new Ve,userWebhooks:new Ve}},(e=Kl||(Kl={})).defaultColors=function(){return Xa({"89b10010-844c-11ec-a8a3-0242ac120002":{r:.5,g:.5,b:.5,a:1,name:"Default Color"}},Ve.prototype)},e.defaultImages=function(){return Xa({},Ve.prototype)},e.emptyData=function(){return{catelogs:new Ve,materials:new Ve,images:new Ve,videos:new Ve,colors:new Ve,audios:new Ve,particles:new Ve,fonts:new Ve,variables:new fe,userAPIs:new Ve,userWebhooks:new Ve,lib:hc.defaultData()}},e.defaultVariables=function(i){switch(i){case"number":return{value:0,name:"Number"};case"boolean":return{value:!1,name:"Boolean"};case"string":return{value:{textValue:"String value"},name:"String"};case"time":{let 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)}},e.getFormattedTimerTime=function(i,r){if(r.format==="HH:mm:ss"){let s=Math.floor(i/3600),n=Math.floor((i-3600*s)/60);return{textValue:[s,n,Math.round(i-3600*s-60*n)]}}if(r.format==="mm:ss"){let s=Math.floor(i/60);return{textValue:[s,Math.round(i-60*s)]}}return r.format==="number"?Math.round(i):Math.round(1e3*i)/1e3}}),pTt=W(()=>{}),smt=W(()=>{var t;Fi(),O7(),rmt(),I7(),(t=cv||(cv={})).defaultData={schema:131,scene:_g.defaultData,frames:new Ve().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",V2.defaultData),shared:{...Kl.emptyData(),colors:Kl.defaultColors()}},t.createDefaultData=function(){return mS.deserialize(mS.serialize(t.defaultData))},t.emptyDataForImports=function(){return{schema:131,scene:_g.emptyDataWithPage(),frames:new Ve().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",V2.defaultData),shared:{...Kl.emptyData(),colors:Kl.defaultColors(),images:Kl.defaultImages()}}},t.emptyData=function(){return{schema:131,scene:_g.emptyDataWithPage(),frames:new Ve().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",V2.defaultData),shared:Kl.emptyData()}},t.clipboard2dData=function(){return{schema:131,scene:_g.emptyData(),frames:new Ve,shared:Kl.emptyData()}},t.withoutLib=function(e){return{...e,shared:{...e.shared,lib:hc.defaultData()}}},t.getComponentData=function(e,i){return Kg.getComponentData(e,i)},t.hasSensitiveData=function(e){let i=Object.values(e.shared.userAPIs);for(let r of i){let s=r.headers;for(let n of s)if(n.data.key.toLowerCase()==="authorization"&&n.data.value!=="")return!0}return!1}}),mTt=W(()=>{(L8||(L8={})).emptyImage={data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=",name:"empty"}});function zg(t,e=[0,0]){return[t&&!isNaN(t[0])?t[0]:e[0],t&&!isNaN(t[1])?t[1]:e[1]]}function Zb(t,e,i){switch(t){case 0:return"cubicBezier( 0, 0, 1, 1 )";case 1:return"cubicBezier( .25, .1, .25, 1 )";case 2:return"cubicBezier( .42, 0, 1, 1 )";case 3:return"cubicBezier( 0, 0, .58, 1 )";case 4:return"cubicBezier( .42, 0, .58, 1 )";case 7:return"cubicBezier( .25, 1, .5, 1 )";case 5:{let{control1:r,control2:s}=e??{...Dv.defaultData};return`cubicBezier( ${r[0]}, ${r[1]}, ${s[0]}, ${s[1]} )`}case 6:{let{mass:r,stiffness:s,damping:n,velocity:a}=i??{...Yp.defaultData},o=new nmt(r,s,n,a),l=o.solve(1);return()=>u=>o.solve(u)/l}case 8:return()=>r=>Math.floor(r)}}var bX,_X,Lg,yS,nmt,YR,KR,amt=W(()=>{Fi(),_l(),(bX||(bX={})).defaultData=function(t,e){return{id:t,name:e,duration:5,objectTimelines:new Ve}},(_X||(_X={})).is=function(t){return t&&typeof t.x=="number"&&typeof t.y=="number"&&typeof t.z=="number"},(t=>{function e(h,d){let c=[0,0],p=[1,1];if(h?.cubicControls)c=zg(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=zg(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(!t.BEZIER_PRESETS.includes(h))return;let d={type:h};return{control1:e(d).control1,control2:e(void 0,d).control2}}function r(h,d){return Math.abs(h[0]-d[0])<.001&&Math.abs(h[1]-d[1])<.001}function s(h){let d=t.ROOT_PROPERTY_ORDER.indexOf(h[0]);return d===-1?t.ROOT_PROPERTY_ORDER.length:d}function n(h){return h.layerId??h.path.join(".")}function a(h){let d=h[h.length-1];return yS.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]}}}}}t.getControlsWithDefault=e,t.BEZIER_PRESETS=[0,1,2,3,4,7],t.presetHandles=i,t.presetForHandles=function(h){return t.BEZIER_PRESETS.find(d=>{let c=i(d);return c!==void 0&&r(c.control1,h.control1)&&r(c.control2,h.control2)})},t.defaultData=function(h){return{id:h,keyframes:new fe}},t.ROOT_PROPERTY_ORDER=["position","rotation","scale","shape size","material","opacity","camera","light","cloner","path extrusion","path snapping"],t.rowOrder=s,t.propertyKey=n,t.groupKeyframes=function(h,d){let c=new Map;for(let p of h){let m=p.data;if(d?.(m))continue;let f=n(m),g=c.get(f);g||(g={id:f,path:m.path,keyframes:[],layerId:m.layerId,index:m.index},c.set(f,g)),m.isPlaceholder?g.placeholder=p.id:g.keyframes.push(p)}return[...c.values()].sort((p,m)=>{let f=s(p.path)-s(m.path);return f!==0?f:(p.index??0)-(m.index??0)})},t.rowAxis=a,t.drawnRowKey=o,t.drawnRows=function(h){let d=new Map;for(let c of h){let p=a(c.path),m=p?c.path.slice(0,-1):c.path,f=o(c),g=d.get(f);g||(g={id:f,path:m,layerId:c.layerId,index:c.index,tracks:[]},d.set(f,g)),g.tracks.push({axis:p,property:c})}return[...d.values()]},t.sortedKeyframes=function(h){return[...h].sort((d,c)=>d.data.time-c.data.time)},t.materialLayerPath=l,t.createMaterialGroup=function(h,d){return h.map(({data:c,id:p},m)=>u(d(),l(c),{layerId:p,index:m}))},t.placeholderKeyframe=u,t.createName=function(h){return Object.entries(h).reduce((d,[c,p])=>(typeof p!="string"&&d.push({name:p.name}),d),[])},t.Presets=[{name:"Slide in",animationParams:{translateX:{value:[-20,0],easing:Zb(3),duration:1e3},opacity:{value:[0,1],easing:Zb(3),duration:1e3},endDelay:250,loop:!0}},{name:"Rotate",animationParams:{rotate:{value:[0,"1turn"],easing:Zb(5),duration:700},endDelay:250,loop:!0}},{name:"Scale Out",animationParams:{scale:{value:[1,1.5],easing:Zb(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:Zb(5),duration:500},endDelay:500,loop:!0}},{name:"Bounce",animationParams:{translateY:{value:["20px","-20px"],duration:575,easing:"easeOutQuad"},direction:"alternate",loop:!0}}]})(Lg||(Lg={})),yS=["x","y","z"],nmt=class{constructor(t=1,e=100,i=10,r=0){this.mass=t,this.stiffness=e,this.damping=i,this.initialVelocity=r,this.m_w0=Math.sqrt(e/t),this.m_zeta=i/(2*Math.sqrt(e*t)),this.m_zeta<1?(this.m_wd=this.m_w0*Math.sqrt(1-this.m_zeta*this.m_zeta),this.m_A=1,this.m_B=(this.m_zeta*this.m_w0-r)/this.m_wd):(this.m_wd=0,this.m_A=1,this.m_B=-r+this.m_w0)}solve(t){return 1-(this.m_zeta<1?Math.exp(-t*this.m_zeta*this.m_w0)*(this.m_A*Math.cos(this.m_wd*t)+this.m_B*Math.sin(this.m_wd*t)):(this.m_A+this.m_B*t)*Math.exp(-t*this.m_w0))}getDuration(){let t=.16666666666666666,e=0,i=0;for(;;)if(e+=t,this.solve(e)===1){if(i++,i>=16)break}else i=0;return e*t*1e3}}}),B7=W(()=>{var t;_l(),Fi(),(YR||(YR={})).list=["idle","move","jump","run"],(t=KR||(KR={})).defaultColliderData={type:"capsule",height:200,radius:50,position:[0,0,0],rotation:[0,0,0]},t.defaultDataThirdPerson={moveMode:"walk",forwardDirection:"+z",speedTranslate:1e3,speedRotate:100,runMultiplier:2,rotationMode:"normal",rotBy:"keys",rotByTouch:"drag",delayPos:[.3,.3],delayRot:[.3,.3],keyAssignments:[["moveNegZ","W"],["moveNegX","A"],["movePosZ","S"],["movePosX","D"],["rotPosX","\u25B2"],["rotPosY","\u25C0"],["rotNegX","\u25BC"],["rotNegY","\u25B6"],["jump","Space"],["run","\u21E7"],["none","Ctrl"]],touchControl:!0,joystickPosLoc:5,joystickRotLoc:11,jumpTouchButtonLoc:9,collider:t.defaultColliderData,colliderHelperVisible:!0,collisionEnabled:!0,jumpPower:100,resetYPosition:3e3,alignToGround:!1,autoOrientMove:!0,orientWith:"camera",orientMode:"radial",delayPosCamera:.3,delayRotCamera:.3,camera:"",cameraXAxis:"Limit",cameraYAxis:"Free",cameraRotXLimits:[0,Math.PI/2],cameraRotYLimits:[-Math.PI/2,Math.PI/2],gameActions:{idle:new fe,move:new fe,jump:new fe,run:new fe},navmesh:{enabled:!1,ch:6,cs:6,walkableClimb:5,walkableHeight:1,walkableRadius:0,zones:"all",objects:[],helperVisible:!0,destinationHelperRadius:0,destinationHelperColor:Hi.fromHexAndA(3728051,1)}}});function tg(t,...e){let i={};for(let r of e.flat())t!=null&&r in t&&(i[r]=t[r]);return i}function xX(t){t.layers.forEach(e=>{if(e.type==="depth"&&e.colorA!==void 0){let i=e.colorA,r=e.colorB,s=[[i.r,i.g,i.b,i.a],[r.r,r.g,r.b,r.a]],n=[0,1];for(let o=2;o<10;o++)s.push(s[1]),n.push(1);let a={...tg(js(e),"type","visible","isVector","isWorldSpace","origin","alpha","mode"),near:Math.max(0,e.near),far:Math.max(0,e.far),colors:s,steps:n,num:2,direction:[1,0,0],smooth:!1,gradientType:1};Object.assign(e,a)}else if(e.type==="depth"&&e.gradientType===1&&(e.near<0||e.far<0)){let i={...js(e),near:Math.max(e.near,0),far:Math.max(e.far,0)};Object.assign(e,i)}})}function Kd(t,e){Object.values(t.shared.materials).forEach(i=>e(i))}function Zd(t,e){t.scene.objects.traverse((i,r)=>{"materials"in r?r.materials.forEach((s,n)=>{s===void 0&&(r.materials[n]=ds.defaultTwoLayerData("phong"),s=r.materials[n]),typeof s!="string"&&e(s)}):"material"in r?typeof r.material!="string"&&(r.material===void 0&&(r.material=ds.defaultTwoLayerData("phong")),e(r.material)):r.type==="Mesh"&&(r.material===void 0&&(r.material=ds.defaultTwoLayerData("phong")),e(r.material)),"overrides"in r&&Object.values(r.overrides).forEach(s=>{s.material&&typeof s.material!="string"&&Object.getPrototypeOf(s.material)!==$s.prototype&&e(s.material)})})}function wX(t){t.layers===void 0&&Object.assign(t,ds.defaultTwoLayerData("lambert"))}function VD(t){!t.layers||t.layers.forEach(e=>{if(e.type==="depth"&&e.colors.length===10){let i=[...e.colors];i.push(e.colors[9]);let r=[...e.steps];r.push(e.steps[9]);let s={...js(e),colors:i,steps:r};Object.assign(e,s)}})}function SX(t){t.scene.objects.traverse((e,i)=>{"materials"in i?i.materials.forEach(r=>{typeof r!="string"&&VD(r)}):"material"in i&&typeof i.material!="string"&&VD(i.material)}),Object.values(t.shared.materials).forEach(e=>VD(e))}function TX(t){t.layers&&t.layers.forEach(e=>{e.type==="depth"&&e.num!==void 0&&(e.colors=e.colors.slice(0,e.num),e.steps=e.steps.slice(0,e.num),delete e.num)})}function MX(t){t.layers&&t.layers.forEach(e=>{(function(i){return i.type!=="displace"})(e)&&e.isMask===void 0&&(e.isMask=!1),(e.type==="texture"||e.type==="video")&&e.blending===void 0&&(e.blending=0),(e.type==="noise"||e.type==="displace"&&e.displacementType==="noise")&&(e.voronoiStyle===void 0&&(e.voronoiStyle=0),e.highCut===void 0&&(e.highCut=1),e.lowCut===void 0&&(e.lowCut=0),e.smoothness===void 0&&(e.smoothness=.3),e.seed===void 0&&(e.seed=0),e.quality===void 0&&(e.quality=1))})}function AX(t){let e=t.layers.find(i=>i.type==="light")?.data;if(e?.category==="basic"){let i=Gs.defaultData("light","phong"),r=e;Object.assign(r,i),r.visible=!1}}function CX(t){Kd(t,AX),Zd(t,AX)}function EX(t){t.layers.forEach(e=>{e.type==="light"&&e.category!=="toon"&&e.occlusion===void 0&&(e.occlusion=!0)})}function PX(t){t.layers&&t.layers.forEach(e=>{e.type==="light"&&e.bumpMapIntensity===void 0&&(e.bumpMapIntensity=5)})}var fTt=W(()=>{IS(),_l(),D7(),a5(),Fi(),o5(),oa(),yt(),P7(),B7(),imt(),O7(),E7(),N7()}),omt={};function RX(t){t.layers&&t.layers.forEach(e=>{e.type==="light"&&e.alphaOverride===void 0&&(e.alphaOverride=1)})}function NX(t){t.rotation=t.rotation.slice(0,3).map(e=>e*dg)}function lmt(t){NX(t),t.type==="Page"&&NX(t.camera),t.states?.forEach(i=>{i.rotation===void 0||i.rotation===null||(i.rotation=i.rotation.slice(0,3).map(r=>r*dg))});let e=t.geometry;e&&e.type==="SphereGeometry"&&(e.thetaLength=(e.thetaLength??180)*dg),e&&e.type==="TorusGeometry"&&(e.arc=e.arc*dg),e&&e.type==="PathGeometry"&&(e.extrusion.angle*=dg,e.extrusion.twist*=dg),t.type==="Mesh"&&t.geometry.type==="TextGeometry"&&(t.geometry.text={textValue:t.geometry.text}),Array.isArray(js(t.events))&&t.events?.forEach(i=>{(i.type==="MouseDown"||i.type==="MouseUp"||i.type==="MousePress"||i.type==="KeyDown"||i.type==="KeyUp"||i.type==="KeyPress"||i.type==="Collision"||i.type==="Trigger")&&(i.runMode=i.toggle?"Toggle":"Repeat")})}function gTt(t){t.scene.objects.traverse((e,i)=>{})}function yTt(t){let e=t.schema??104;e!==131&&e<130&&(ZR(t.asset),t.schema=130)}function H1(t,e){e(t.data);for(let i of t.children)H1(i,e)}function hmt(t){let e=t.schema??104;e!==131&&(e<105&&(H1(t.asset,lmt),t.schema=105),e<118&&(H1(t.asset,dmt),t.schema=118),e<121&&(H1(t.asset,U8),t.schema=121),e<130&&(H1(t.asset,vTt),t.schema=130))}function umt(t,e){Zd(t,e),Kd(t,e),Object.values(t.shared.lib.materials).forEach(i=>e(i.asset))}function ZR(t){t.layers===void 0&&Object.assign(t,ds.defaultTwoLayerData("phong"))}function vTt(t){"materials"in t?t.materials.forEach(e=>{e!==void 0&&typeof e!="string"&&ZR(e)}):"material"in t&&t.material!==void 0&&typeof t.material!="string"&&ZR(t.material)}function dmt(t){t.timelineAnimations=Xa({},Ve.prototype)}function bTt(t){let e=[];return t?(t.forEach((i,r)=>{let{path:s,keyframes:n}=i.data,a=s[0]==="material"?i.id:void 0;n?.length?n.forEach(({id:o,data:l})=>{e.push({id:o,data:{...l,path:s,layerId:a,index:r}})}):e.push(Lg.placeholderKeyframe(i.id,s,{layerId:a,index:r}))}),e.sort((i,r)=>i.data.time-r.data.time),new fe(...e.map((i,r)=>({...i,fi:r})))):new fe}function _Tt(t){for(let{id:e,data:i}of[...t.unproxy()]){let r=i.path?.[0];if(!r||!cmt.includes(r))continue;let s=F8(i.value);if(!s.length)continue;let n=t.data(e);if(!n)continue;let a=i.value,[o,...l]=s;for(let u of l){let h=Yt.generateUUID();t.insertBefore(null,[{id:h,data:{...i,id:h,path:[r,u],value:a[u],easing:xTt(i.easing)}}])}n.path=[r,o],n.value=a[o]}}function F8(t){return t===null||typeof t!="object"?[]:yS.filter(e=>e in t)}function xTt(t){let e=t?.cubicControls;return{...t,cubicControls:{control1:[...e?.control1??[0,0]],control2:[...e?.control2??[1,1]]},...t?.springParameters?{springParameters:{...t.springParameters}}:{}}}function wTt(t,e){return Math.abs(t[0]-e[0])<1e-6&&Math.abs(t[1]-e[1])<1e-6}function STt(t){let e=function(n){let a=[];for(let o of Lg.groupKeyframes(n)){let l=new Set(o.keyframes.flatMap(h=>F8(h.data.value))),u=l.size?[...l].map(h=>o.keyframes.filter(d=>F8(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}([...t.unproxy()]),i=new Map,r=new Set;for(let{left:n,right:a}of e){let o=n.data.easing?.type,l=(o===void 0?void 0:Lg.presetHandles(o))?.control2??(o===5?zg(a.data.easing?.cubicControls?.control2,[1,1]):void 0);if(!l)continue;let u=i.get(a.id);u?wTt(u,l)||r.add(a.id):i.set(a.id,l)}let s=new Map;for(let{id:n,data:a}of t.unproxy()){let o=a.easing?.type,l=o===void 0?void 0:Lg.presetHandles(o);l&&s.set(n,l.control1)}for(let{left:n,right:a}of e)r.has(a.id)&&s.delete(n.id);for(let[n,a]of s){let o=t.data(n);!o?.easing||(o.easing.cubicControls={control1:a,control2:zg(o.easing.cubicControls?.control2,[1,1])},o.easing.type=5)}for(let{left:n,right:a}of e){if(!s.has(n.id))continue;let o=t.data(a.id),l=i.get(a.id);!o?.easing||!l||(o.easing.cubicControls={control1:zg(o.easing.cubicControls?.control1,[0,0]),control2:l})}}function DX(t,e){t.scene.objects.traverse((i,r)=>{let s=r;if(s.type==="Page"&&s.timelines)for(let n of Object.values(s.timelines))for(let a of Object.values(n.objectTimelines??{}))e(a.keyframes)})}function U8(t){t.pivot=[0,0,0],t.pivotRotation=[0,0,0]}function TTt(t){}function MTt(t){let e=t.schema??0;if(e!==131){if(e>131)return void console.error(`This scene was created with a newer version of Spline (file format ${e}, this runtime reads 131). Update @splinetool/runtime to the latest version to load it correctly.`);console.warn("updating from ",e,"to ",131),function(i,r){if(r<1&&(Zd(i,xX),Kd(i,xX),i.schema=1),r<2&&(function(s){Object.assign(s.scene.publish,{orbitControls:{...XR.defaultData,...js(s.scene.publish.orbitControls)}})}(i),i.schema=2),r<3&&(function(s){function n(a){if(a.layers){for(let o of Object.values(a.layers))if(o){for(let[l,u]of Object.entries(o))if((n5.includes(l)||typeof u=="boolean")&&delete o[l],l==="texture")for(let[h,d]of Object.entries(u))(A7.includes(h)||typeof d=="boolean")&&delete u[h]}}}s.scene.objects.traverse((a,o)=>{o.states.forEach(l=>{let u=l;u.material?n(u.material):u.materials&&u.materials.forEach(h=>{n(h)})})})}(i),i.schema=3),r<4&&(function(s){s.scene.publish.withBackground=!0}(i),i.schema=4),r<5&&(function(s){s.scene.publish.settings.web={compress:!0,preload:!0,preset:1,logo:!0,hint:!1}}(i),i.schema=5),r<6&&(function(s){s.scene.objects.traverse((n,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(s){s.scene.objects.traverse((n,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&&(SX(i),i.schema=9),r<10&&(function(s){s.scene.objects.traverse((n,a)=>{a.type==="Mesh"&&(a.geometry.type==="BooleanGeometry"||a.geometry.type==="SubdivGeometry")&&(a.geometry.phongAngle=35)})}(i),i.schema=10),r<11&&(function(s){s.scene.environment.ambientLight.softShadows=!1,s.scene.environment.ambientLight.softShadowQuality="low",s.scene.objects.traverse((n,a)=>{(a.type==="DirectionalLight"||a.type==="SpotLight")&&(a.shadowResolution=1024,a.shadowRadius=1,a.depth=1e5)}),s.shared.penumbraSize=new Array(5).fill(.5)}(i),i.schema=11),r<12&&(SX(i),i.schema=12),r<13&&(function(s){s.shared.audios=Xa({},Ve.prototype)}(i),i.schema=13),r<14&&(function(s){let n=s.shared.materials;Object.entries(n).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(n,{[a]:l})}})}(i),i.schema=14),r<15&&(function(s){Object.entries(js(s.shared.images)).filter(n=>n[1].asset===!1).map(n=>n[0]).forEach(n=>{delete s.shared.images[n]}),Object.entries(js(s.shared.audios)).filter(n=>n[1].asset===!1).map(n=>n[0]).forEach(n=>{delete s.shared.audios[n]})}(i),i.schema=15),r<16&&(function(s){s.scene.publish.settings.web.preload=!1}(i),i.schema=16),r<17&&(Zd(i,TX),Kd(i,TX),i.schema=17),r<18&&(Zd(i,wX),Kd(i,wX),i.schema=18),r<19&&(function(s){Object.assign(s.scene.publish.settings,{video:{...vc.defaultData.settings.video,...js(s.scene.publish.settings.video)}})}(i),i.schema=19),r<20&&(function(s){s.shared.fonts=Xa({},Ve.prototype)}(i),function(s){let n=[];s.scene.objects.traverse((a,o)=>{let l=o;if(l.type==="TextFrame"){let u=ds.defaultTwoLayerData("phong"),h=typeof l.color=="string"?s.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(m){return m.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(f=>f.charAt(0).toUpperCase()+f.slice(1)).join(" ")}(l.font);s.shared.fonts[d]===void 0&&(s.shared.fonts[d]={name:d});let c={name:l.name,...rn.defaultData,...Bu.defaultData,flatShading:!1,wireframe:!1,geometry:{...lc.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:js(l.states),events:js(l.events),visible:l.visible,raycastLock:l.raycastLock,position:l.position,rotation:l.rotation,scale:l.scale,hiddenMatrix:l.hiddenMatrix},p=js(s.scene.objects).parent(a);s.scene.objects.insertAfter(p??null,a,[{id:a+"new",data:c,children:[]}]),n.push(a)}}),n.forEach(a=>{s.scene.objects.delete(a)})}(i),i.schema=20),r<21&&(function(s){let n={0:"MouseDown",1:"MouseUp",2:"MouseHover",5:"KeyDown",6:"KeyUp",7:"Start",9:"LookAt",10:"Follow",11:"Scroll",12:"Audio",13:"GameControl"};s.scene.objects.traverse((a,o)=>{o.events.forEach(l=>{if(n[Number(l.type)])if(Object.assign(l,{type:n[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 fe,move:new fe,jump:new fe}});else{let u=new fe;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:Yt.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,tg(h,"mass","stiffness","damping","velocity")):h.easing===5&&Object.assign(p,{control1:{...h.control1},control2:{...h.control2}});let m={repeat:h.repeat?-1:0,delay:h.delay,delayDirection:h.delayDirection,direction:h.cycle&&h.rewind?"pingpong-rewind":h.cycle?"pingpong":"normal"},f={state:h.state,...m,...p},g={allowSlerp:!0,type:"Transition",object:h.object,repeat:0,delay:0,delayDirection:void 0,direction:"normal",tweens:new fe({fi:0,id:Yt.generateUUID(),data:{state:void 0,repeat:0,delay:0,delayDirection:void 0,direction:"normal",duration:0,easing:4}},{fi:1,id:Yt.generateUUID(),data:f})};u.push({fi:c,id:d,data:g})}),delete l.targets)}})})}(i),function(s){s.scene.objects.traverse((n,a)=>{function o(l,u){let h=new fe,d=[];if(a.events.forEach((c,p,m)=>{if(c.type==="Audio"&&c.trigger===u){let f;d.push(p),c.interaction==="play"?f={...tg(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")&&(f={...tg(c,"interaction","delay","object","playAudio"),type:"Audio"}),f&&h.push({fi:m,id:p,data:f})}}),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:Yt.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&&(CX(i),i.schema=22),r<23&&(function(s){s.scene.objects.traverse((n,a)=>{a.type==="Mesh"&&a.geometry.type==="SubdivGeometry"&&(a.geometry.scaleBaked||(a.geometry.scaleBaked=[1,1,1]))})}(i),i.schema=23),r<24&&(function(s){s.scene.objects.traverse((n,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(s){s.shared.videos=Xa({},Ve.prototype)}(i),r<25&&(i.schema=25)),r<26&&(function(s){s.scene.objects.traverse((n,a)=>{let o=s.scene.objects.unproxy().parent(n);if(o){let l=js(s.scene.objects.data(o));l&&l.type==="Mesh"&&l.geometry.type==="BooleanGeometry"&&a.type==="Mesh"&&(a.visible=js(a).booleanExclude!==!0)}})}(i),i.schema=26),r<27&&(function(s){s.scene.objects.traverse((n,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&&(CX(i),i.schema=28),r<29&&(function(s){function n(o){Object.setPrototypeOf(o,$s.prototype),o.texture&&Object.setPrototypeOf(o.texture,$s.prototype)}function a(o){Object.setPrototypeOf(o,$s.prototype);for(let l in o)n(o[l])}s.scene.objects.traverse((o,l)=>{l.states.forEach(u=>{let h=u;if(h.material){let d=js(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=js(c).layers;a(p),c.layers=p}})})}(i),i.schema=29),r<30&&(function(s){s.scene.objects.traverse((n,a)=>{a.type==="Mesh"&&a.geometry.type==="NonParametricGeometry"&&!("material"in a)&&!("materials"in a)&&(a.material=ds.defaultTwoLayerData("phong"))})}(i),i.schema=30),r<31&&(function(s){s.scene.publish.orbitControls.autoZoom===void 0&&(s.scene.publish.orbitControls.autoZoom=!1),s.scene.objects.traverse((n,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(s){s.scene.objects.traverse((n,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(s){s.scene.publish.mouseEventTarget===void 0&&(s.scene.publish.mouseEventTarget="canvas"),s.scene.publish.settings.web.hint===void 0&&(s.scene.publish.settings.web.hint=!1)}(i),i.schema=34),r<35&&(function(s){let{video:n}=s.scene.publish.settings;n.format==="gif"&&n.fps>48&&(n.fps=15)}(i),i.schema=35),r<36&&(function(s){s.scene.objects.traverse((n,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&(o.resetYPosition=Math.abs(o.resetYPosition-a.position[1]))})})}(i),i.schema=36),r<37&&(function(s){let n=s.scene.environment.usePhysics;s.scene.objects.traverse((a,o)=>{n&&o.physics===null?o.collision=!1:o.collision="visibility"})}(i),i.schema=37),r<38&&(Zd(i,MX),Kd(i,MX),i.schema=38),r<39&&(function(s){s.scene.objects.traverse((n,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&(o.navmesh=KR.defaultDataThirdPerson.navmesh)})})}(i),i.schema=39),r<40&&(function(s){s.scene.styles||(s.scene.styles=bg.defaultData())}(i),i.schema=40),r<41&&(function(s){s.scene.environment.ambientLight.occlusion===void 0&&(s.scene.environment.ambientLight.occlusion=!1),s.scene.environment.ambientLight.aoFullRes===void 0&&(s.scene.environment.ambientLight.aoFullRes=!1),s.scene.environment.ambientLight.radius===void 0&&(s.scene.environment.ambientLight.radius=256),s.scene.environment.ambientLight.bias===void 0&&(s.scene.environment.ambientLight.bias=.5),s.scene.environment.ambientLight.aoColor===void 0&&(s.scene.environment.ambientLight.aoColor={r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}),Zd(s,EX),Kd(s,EX)}(i),i.schema=41),r<42&&(function(s){s.scene.objects.traverse((n,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&Object.assign(o.gameActions,{run:new fe})})})}(i),i.schema=42),r<43&&(function(s){s.scene.objects.traverse((n,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&(o.keyAssignments=[...o.keyAssignments,["run","\u21E7"],["none","Ctrl"]])})})}(i),i.schema=43),r<99){Zd(i,PX),Kd(i,PX),i.scene.publish.playCamera===null&&(i.scene.publish.playCamera=i0);let s=js(i.scene.objects),n=i.scene.objects;i.scene.publish.playPage=ov,n.insertBefore(null,null,[{id:ov,data:{...kg.defaultData,backgroundColor:i.scene.backgroundColor,fog:i.scene.fog,postprocessing:i.scene.postprocessing,ao:tg(i.scene.environment.ambientLight,"occlusion","aoFullRes","radius","bias","aoColor"),publish:{playCamera:i.scene.publish.playCamera,gameControlObject:i.scene.publish.gameControlObject},shadow:tg(i.scene.environment.ambientLight,"softShadowQuality"),globalPhysics:{...dv.defaultData,...tg(i.scene.environment,"usePhysics","gravity")},camera:js(i.scene.ownerCamera)??kg.defaultData.camera,name:"Scene"},children:[]}]);for(let l of s)l.id!==_g.TRASH_CAN_ID&&n.move(ov,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,hv.defaultData)),u.physics!==void 0&&u.physics!==null&&(u.physics.enabled=u.collision??"visibility",delete u.collision)}),i.schema=99}}(t,e),e<100&&(t.scene.publish.joystickSizeAndXYOffset===void 0&&(t.scene.publish.joystickSizeAndXYOffset=vc.defaultData.joystickSizeAndXYOffset),t.schema=100),e<101&&(Zd(t,RX),Kd(t,RX),t.schema=101),e<102&&(function(i){i.scene.objects.traverse((r,s)=>{let n=s.geometry;n&&n.type==="PathGeometry"&&(n.extrusion.capType="flat",n.extrusion.bevel=50,n.extrusion.bevelSides=6,n.extrusion.shape.type==="Custom"&&(n.extrusion.shape.shapeQuality="low"))})}(t),t.schema=102),e<104&&(t.shared.catelogs=new Ve,t.shared.lib=hc.defaultData(),t.schema=104),e<105&&(function(i){i.shared.variables=Xa({},Ve.prototype)}(t),t.scene.objects.traverse((i,r)=>{lmt(r)}),t.schema=105);for(let i of Object.values(t.shared.lib.components))hmt(i);e<106&&(function(i){let r=js(i.shared.variables);i.shared.variables=Xa(Object.entries(r??{}).map(([s,n],a)=>({fi:a,id:s,data:n})),fe.prototype)}(t),t.schema=106),e<107&&(t.shared.lib.variables=hc.defaultData().variables,t.schema=107),e<109&&(function(i){i.shared.particles=Xa({},Ve.prototype),i.shared.lib&&(i.shared.lib.particles=hc.defaultData().particles)}(t),t.schema=109),e<110&&(function(i){i.scene.objects.traverse((r,s)=>{s.type==="Particle"&&typeof s.renderMaterial.size=="number"&&Object.assign(s.renderMaterial,{size:[s.renderMaterial.size,s.renderMaterial.size]})})}(t),t.schema=110),e<111&&(t.scene.objects.traverse((i,r)=>{(function(s){Array.isArray(js(s.events))&&s.events?.forEach(n=>{"disabled"in n||(n.disabled=!1),(n.type==="MouseDown"||n.type==="MouseUp"||n.type==="MousePress")&&(n.mode=n.mode||"Object")})})(r)}),t.schema=111),e<112&&(function(i){i.scene.objects.traverse((r,s)=>{s.type==="Page"&&(s.postprocessing.depthOfField.focusDistance=100,s.postprocessing.depthOfField.focalLength=20,s.postprocessing.depthOfField.bokehScale=5)})}(t),t.schema=112),e<113&&(function(i){i.scene.objects.traverse((r,s)=>{Array.isArray(js(s.events))!==!1&&s.events?.forEach(n=>{let a=n.runMode;n.type==="MouseDown"||n.type==="MouseUp"||n.type==="KeyDown"||n.type==="KeyUp"||n.type==="Collision"||n.type==="Trigger"?n.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode=a??"Repeat"),(o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode=a==="Toggle"?"Toggle":"Normal")}):n.type==="MouseHover"||n.type==="MousePress"||n.type==="KeyPress"?n.actions?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Toggle")}):n.type==="GameControl"?(delete n.actions,Object.keys(n.gameActions).forEach(o=>{n.gameActions[o]?.forEach(l=>{l.type==="Transition"&&(l.runMode="Repeat"),l.type==="Animation"&&(l.runMode="Normal")})})):n.type==="DragDrop"?(delete n.actions,n.dragDropActions?.drag?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Toggle")}),n.dragDropActions?.drop?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Toggle")})):n.type==="Resize"?(delete n.actions,n.breakpoints?.forEach(o=>{o.actions?.forEach(l=>{(l.type==="Transition"||l.type==="Animation"||l.type==="SwitchCamera")&&(l.runMode="Toggle")})})):n.type==="Start"?n.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Once"),(o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Normal")}):n.type==="VariableChange"||n.type==="Scroll"?n.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Normal")}):n.type==="Conditional"&&(delete n.actions,n.inActions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Normal")}),n.outActions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Normal")}))})})}(t),t.schema=113),e<114&&(t.scene.publish.settings.web.imageQuality===void 0&&(t.scene.publish.settings.web.imageQuality=70),t.schema=114),e<115&&(function(i){i.shared.userAPIs=Xa({},Ve.prototype),i.shared.userWebhooks=Xa({},Ve.prototype),i.shared.lib&&(i.shared.lib.userAPIs=hc.defaultData().userAPIs,i.shared.lib.userWebhooks=hc.defaultData().userWebhooks)}(t),t.schema=115),e<116&&(function(i){i.scene.publish.settings.videoStatic===void 0&&(i.scene.publish.settings.videoStatic=vc.defaultData.settings.videoStatic)}(t),t.schema=116),e<117&&(t.scene.publish.settings.web.pixelRatioMobile===void 0&&(t.scene.publish.settings.web.pixelRatioMobile=0),t.scene.publish.settings.web.pixelRatioDesktop===void 0&&(t.scene.publish.settings.web.pixelRatioDesktop=0),t.schema=117),e<118&&(t.shared.timelineAnimations=Xa({},Ve.prototype),t.scene.objects.traverse((i,r)=>{dmt(r)}),t.schema=118),e<119&&(t.scene.publish.settings.videoStatic.format=cv.defaultData.scene.publish.settings.videoStatic.format,t.scene.publish.settings.videoStatic.imageFormat=cv.defaultData.scene.publish.settings.videoStatic.imageFormat,t.schema=119),e<120&&(t.scene.publish.settings.image.colorSpace="display-p3",t.scene.publish.settings.videoStatic.colorSpace="display-p3",t.schema=120),e<121&&(t.scene.objects.traverse((i,r)=>{U8(r),r.type==="Page"&&r.camera!==void 0&&U8(r.camera)}),t.schema=121),e<122&&(delete t.scene.publish.settings.video,t.scene.publish.orbitControls.rotationSpeed=cv.defaultData.scene.publish.orbitControls.rotationSpeed,t.schema=122),e<123&&(t.scene.objects.traverse((i,r)=>{r.type==="Page"&&r.sky===void 0&&(r.sky=Gp.defaultData)}),t.schema=123),e<124&&(e>=123&&t.scene.objects.traverse((i,r)=>{let s=r.sky;r.type==="Page"&&s!==void 0&&(typeof s.exposure=="number"&&(s.exposure=Math.round(s.exposure/5e-4*1e4)/1e4),s.lighting===void 0&&(s.lighting=Gp.defaultData.lighting))}),t.schema=124),e<125&&(t.scene.objects.traverse((i,r)=>{let s=r.sky;r.type==="Page"&&s!==void 0&&s.lightingIntensity===void 0&&(s.lightingIntensity=Gp.defaultData.lightingIntensity)}),t.schema=125),e<126&&(t.scene.objects.traverse((i,r)=>{let s=r.sky;r.type==="Page"&&s!==void 0&&(s.mode===void 0&&(s.mode="physical"),s.hdri===void 0?s.hdri={...Gp.defaultData.hdri}:(s.hdri.blur===void 0&&(s.hdri.blur=Gp.defaultData.hdri.blur),Array.isArray(s.hdri.rotation)&&(s.hdri.rotation=s.hdri.rotation[1]??0)))}),t.schema=126),e<127&&(t.scene.objects.traverse((i,r)=>{let s=r.sky;r.type==="Page"&&s?.hdri!==void 0&&s.hdri.showBackground===void 0&&(s.hdri.showBackground=!0)}),t.schema=127),e<128&&(t.scene.objects.traverse((i,r)=>{let s=r.sky;r.type==="Page"&&s!==void 0&&s.lightingQuality===void 0&&(s.lightingQuality="full")}),t.schema=128),e<129&&(t.scene.objects.traverse((i,r)=>{if(r.type==="Page"){r.camera===void 0&&(r.camera=kg.defaultData.camera);let s=r.camera;s.far=1e5,s.perspective?s.perspective.near=70:s.perspective={near:70,fov:45,zoom:1}}}),t.schema=129),e<130&&(umt(t,ZR),t.schema=130),e<131&&(function(i){i.scene.objects.traverse((r,s)=>{let n=s.states;if(!n)return;let a=s.timelineAnimations,o=[];n.forEach((l,u)=>{(l.isAnimation||a?.[u])&&o.push(u)}),o.forEach(l=>n.delete(l))})}(t),function(i){let r=i.shared,s=r.timelineAnimations;if(!s)return;let n=i.scene.objects,a=n.unproxy().find(o=>o.data.type==="Page")?.id;for(let[o,l]of Object.entries(s)){let u=Xa({},Ve.prototype),h=0,d=Boolean(l.loop);for(let[m,f]of Object.entries(l.mapping??{})){let g=n.data(m)?.timelineAnimations?.[f];!g||(h=Math.max(h,g.to??0),d=d||Boolean(g.loop),u[m]={id:m,keyframes:bTt(g.properties?.unproxy())})}let c=l.page??a,p=c?n.data(c):void 0;p&&p.type==="Page"&&((p.timelines??(p.timelines=Xa({},Ve.prototype)))[o]={id:o,name:l.name,duration:h||5,...d?{loop:d}:{},objectTimelines:u})}delete r.timelineAnimations,n.traverse((o,l)=>{delete l.timelineAnimations})}(t),DX(t,_Tt),DX(t,STt),t.schema=131)}}DS(omt,{updateAllMaterials:()=>umt,updateDocumentSchema:()=>MTt,updateLibSchema:()=>TTt,updateMaterialSchema:()=>yTt,updateObjectStateRec:()=>H1,updateObjectsSchema:()=>hmt,updateTextValues:()=>gTt});var dg,cmt,OX,eM,kD,IX,iM,xg,Qb,B0,rM,zD,dP,LD,FD,BX,cP,UD,Fg,j8,l5=W(()=>{yt(),smt(),Fi(),amt(),fTt(),o5(),IS(),oa(),I7(),a5(),R7(),dg=180/Math.PI,cmt=["position","rotation","scale","shape size"]}),ATt=W(()=>{var t,e,i;_l(),Fi(),oa(),(OX||(OX={})).is=function(r){return!0},(t=eM||(eM={})).defaultData={position:[0,0],scale:[1,1],rotation:0,shear:[0,0]},t.merge=function(r,s){return{position:s?.position??r.position,rotation:s?.rotation??r.rotation,scale:s?.scale??r.scale,shear:s?.shear??r.shear}},t.diff=function(r,s){return xpt({position:Hu.isEqual(r.position,s.position)?void 0:s.position,rotation:r.rotation===s.rotation?void 0:s.rotation,scale:Hu.isEqual(r.scale,s.scale)?void 0:s.scale,shear:r.shear&&s.shear&&Hu.isEqual(r.shear,s.shear)?void 0:s.shear})},(kD||(kD={})).defaultData={horizontalConstraint:0,verticalConstraint:0},(IX||(IX={})).defaultData={direction:"row",wrap:"unwrap",align:"top-left",gap:10,rowGap:10,autoGap:!1,autoRowGap:!1,leftPadding:8,rightPadding:8,topPadding:8,bottomPadding:8},(iM||(iM={})).defaultData={opacity:1,fill:{color:Hi.fromHexAndA(Xg,1),enabled:!0},stroke:{color:Hi.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:Hi.from0to1([0,0,0,1]),enabled:!1,spread:0},innerShadow:{offset:[10,10],blurRadius:10,color:Hi.from0to1([0,0,0,1]),enabled:!1,spread:0}},(e=xg||(xg={})).newEmpty=function(r,s){return{name:s}},e.patch=function(r,s){if(s===void 0)return r;let n={...r};return Object.assign(n,eM.merge(n,s)),n=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}(n,s),n=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}(n,s),n},e.toOps=function(r,s){let n,a=[];for(let[o,l]of Object.entries(s))o!=="name"&&(n===void 0&&(n={path:[],props:{},type:0},a.push(n)),n.props[o]=l);return a},(Qb||(Qb={})).defaultData={...eM.defaultData,...kD.defaultData,states:new fe,events:new fe,visible:!0,raycastLock:!1},(B0||(B0={})).defaultData={...Qb.defaultData,...iM.defaultData},(rM||(rM={})).defaultData={cornerRadius:[0,0,0,0]},(zD||(zD={})).defaultData={...B0.defaultData,type:"ellipse2d",width:100,height:100,name:"Ellipse"},(dP||(dP={})).defaultData={...B0.defaultData,...rM.defaultData,type:"rectangle2d",width:100,height:100,name:"Rectangle"},(LD||(LD={})).defaultData={...B0.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"},(FD||(FD={})).defaultData={...B0.defaultData,type:"path2d",path:"",name:"Path"},(BX||(BX={})).is=function(r){return r.type==="ellipse2d"||r.type==="rectangle2d"||r.type==="text2d"||r.type==="vector2d"||r.type==="path2d"},(cP||(cP={})).defaultData={...Qb.defaultData,name:"Group",type:"group2d"},(UD||(UD={})).defaultData=()=>({...Qb.defaultData,...rM.defaultData,...iM.defaultData,name:"Frame",type:"frame2d",clipped:!0,width:200,height:200,fill:{color:Hi.fromHexAndA(4737101,1),enabled:!0},stroke:{color:Hi.fromHexAndA(0,1),thickness:1,enabled:!1,mode:"inside"},backgroundBlur:{radius:2,enabled:!1},layerBlur:{radius:2,enabled:!1}}),(r=>{r.defaultData=function(s){switch(s){case"rectangle2d":case"vector2d":return{...dP.defaultData};case"ellipse2d":return{...zD.defaultData};case"text2d":return{...LD.defaultData};case"path2d":return{...FD.defaultData};case"frame2d":return{...UD.defaultData()};case"group2d":return{...cP.defaultData}}},r.getPivot=function(s){return"width"in s&&"height"in s?[typeof s.width=="number"?.5*s.width:0,typeof s.height=="number"?.5*s.height:0]:[0,0]},r.isResizeable=function(s){return s.type==="rectangle2d"||s.type==="ellipse2d"||s.type==="text2d"||s.type==="frame2d"},r.isAutoLayoutable=function(s){return s.type==="frame2d"&&s.autoLayout!==void 0},r.hasCorners=function(s){return s.type==="rectangle2d"||s.type==="frame2d"}})(Fg||(Fg={})),(i=j8||(j8={})).defaultData={name:"UI",type:"scene2d",objects:new Nn},i.emptyData=function(){return{type:"scene2d",objects:new Nn}}}),CTt=W(()=>{lTt(),hTt(),Wpt(),qpt(),smt(),Upt(),mTt(),Kpt(),Jpt(),R7(),l5(),rmt(),P7(),E7(),Hpt(),IS(),Ypt(),emt(),_l(),o5(),a5(),D7(),Qpt(),I7(),O7(),uTt(),Zpt(),B7(),N7(),$pt(),Xpt(),ATt()});function wg(t,e=!1){let i=t[0].index!==null,r=new Set(Object.keys(t[0].attributes)),s=new Set(Object.keys(t[0].morphAttributes)),n={},a={},o=t[0].morphTargetsRelative,l=new ye,u=0;for(let h=0;h<t.length;++h){let d=t[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;n[p]===void 0&&(n[p]=[]),n[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(!s.has(p))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphAttributes must be consistent throughout all geometries."),null;a[p]===void 0&&(a[p]=[]),a[p].push(d.morphAttributes[p])}if(e){let p;if(i)p=d.index.count;else{if(d.attributes.position===void 0)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". The geometry must have either an index or a position attribute"),null;p=d.attributes.position.count}l.addGroup(u,p,h),u+=p}}if(i){let h=0,d=[];for(let c=0;c<t.length;++c){let p=t[c].index;for(let m=0;m<p.count;++m)d.push(p.getX(m)+h);h+=t[c].attributes.position.count}l.setIndex(d)}for(let h in n){let d=VX(n[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 f=0;f<a[h].length;++f)p.push(a[h][f][c]);let m=VX(p);if(!m)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+h+" morphAttribute."),null;l.morphAttributes[h].push(m)}}}return l}function VX(t){let e,i,r,s=-1,n=0;for(let u=0;u<t.length;++u){let h=t[u];if(e===void 0&&(e=h.array.constructor),e!==h.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(i===void 0&&(i=h.itemSize),i!==h.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(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(s===-1&&(s=h.gpuType),s!==h.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;n+=h.count*i}let a=new e(n),o=new Se(a,i,r),l=0;for(let u=0;u<t.length;++u){let h=t[u];if(h.isInterleavedBufferAttribute){let d=l/i;for(let c=0,p=h.count;c<p;c++)for(let m=0;m<i;m++){let f=h.getComponent(c,m);o.setComponent(c+d,m,f)}}else a.set(h.array,l);l+=h.count*i}return s!==void 0&&(o.gpuType=s),o}var BS=W(()=>{yt()});function pmt(t){let e=t.points.length/7,i=new fe;for(let r=0;r<e;r++){let s=7*r,n=t.points[s+0],a=t.points[s+1],o=t.points[s+2],l=t.points[s+3],u=t.points[s+4],h=t.points[s+5],d=t.points[s+6];i.push({fi:r,id:Yt.generateUUID(),data:{roundness:d,position:[n,a],areControlsDirectionsMirrored:!0,controlPrevious:{position:[o,l]},controlNext:{position:[u,h]}}})}return{points:i,isClosed:t.isClosed,roundness:t.roundness,shapeHoles:t.shapeHoles?.map(r=>pmt(r))??[]}}function mmt(t){let{userData:e,uuid:i,...r}=t;if(e===void 0||e.type==="NonParametricGeometry")return function(a){let o,{userData:l,data:u}=a,h=u?.groups,d=u?.attributes??{},c=u?.morphAttributes??{},p=u?.interleavedBuffers,m=u?.arrayBuffers,f=u?.index;d.position!==void 0&&Array.isArray(d.position.array)&&(o=function(y){let v=1/0,b=1/0,_=1/0,x=-1/0,S=-1/0,w=-1/0;for(let M=0;M<y.length;M+=3){let T=y[M],A=y[M+1],C=y[M+2];v=Math.min(v,T),b=Math.min(b,A),_=Math.min(_,C),x=Math.max(x,T),S=Math.max(S,A),w=Math.max(w,C)}return{width:x-v,height:S-b,depth:w-_}}(d.position.array));let g={...l===void 0?{}:l.parameters,data:{attributes:d,morphAttributes:c,interleavedBuffers:p,arrayBuffers:m},...o===void 0?{}:o,type:"NonParametricGeometry"};return f!==void 0&&Object.assign(g.data,{index:f}),h!==void 0&&Object.assign(g.data,{groups:h.map(y=>({...y,materialIndex:y.materialIndex??0}))}),g}(t);if(e.type==="SubdivGeometry"){let a="SubdivGeometry",o=r.data?.attributes;if(o?.positionWASM===void 0){let u=new ye;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 me(h,3)),u.setIndex(new sm(c,1));let p=function(y,v=1e-4){v=Math.max(v,Number.EPSILON);let b={},_=y.getIndex(),x=y.getAttribute("position"),S=_?_.count:x.count,w=0,M=Object.keys(y.attributes),T={},A={},C=[],R=["getX","getY","getZ","getW"],O=["setX","setY","setZ","setW"];for(let V=0,H=M.length;V<H;V++){let U=M[V],et=y.attributes[U];T[U]=new et.constructor(new et.array.constructor(et.count*et.itemSize),et.itemSize,et.normalized);let at=y.morphAttributes[U];at&&(A[U]||(A[U]=[]),at.forEach((Q,ut)=>{let ht=new Q.array.constructor(Q.count*Q.itemSize);A[U][ut]=new Q.constructor(ht,Q.itemSize,Q.normalized)}))}let D=.5*v,B=Math.log10(1/v),k=Math.pow(10,B),j=D*k;for(let V=0;V<S;V++){let H=_?_.getX(V):V,U="";for(let et=0,at=M.length;et<at;et++){let Q=M[et],ut=y.getAttribute(Q),ht=ut.itemSize;for(let q=0;q<ht;q++)U+=~~(ut[R[q]](H)*k+j)+","}if(U in b)C.push(b[U]);else{for(let et=0,at=M.length;et<at;et++){let Q=M[et],ut=y.getAttribute(Q),ht=y.morphAttributes[Q],q=ut.itemSize,nt=T[Q],Tt=A[Q];for(let gt=0;gt<q;gt++){let vt=R[gt],ct=O[gt];if(nt[ct](w,ut[vt](H)),ht)for(let St=0,Mt=ht.length;St<Mt;St++)Tt[St][ct](w,ht[St][vt](H))}}b[U]=w,C.push(w),w++}}let z=y.clone();for(let V in y.attributes){let H=T[V];if(z.setAttribute(V,new H.constructor(H.array.slice(0,w*H.itemSize),H.itemSize,H.normalized)),V in A)for(let U=0;U<A[V].length;U++){let et=A[V][U];z.morphAttributes[V][U]=new et.constructor(et.array.slice(0,w*et.itemSize),et.itemSize,et.normalized)}}return z.setIndex(C),z}(u),m=[],f=new Array(d[d.length-1]+1).fill(3),g=p.getIndex().array;for(let y=0,v=d.length;y<v;)d[y]===d[y+1]?(f[d[y]]++,m.push(...new Set(g.slice(3*y,3*y+6))),y+=2):(m.push(...g.slice(3*y,3*y+3)),y++);o.indexWASM={array:m},o.positionWASM=p.attributes.position,o.verticesPerFaceWASM={array:f}}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,...ETt(o.positionWASM.array)};l.subdivisions=e.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 s=e.type,n=e.parameters;return s==="VectorGeometry"?(n.extrudeDepth&&(n.depth=n.extrudeDepth),{...n,width:100,height:100,shape:pmt(e.shape),type:s}):s==="LatheGeometry"?{...e.parameters,type:s,points:(e?.parameters.points??[]).map(a=>[a.x,a.y])}:(n.extrudeDepth&&(n.depth=n.extrudeDepth),{...n,type:s})}function ETt(t){return G8.setFromArray(t),G8.getSize(zw),{width:zw.x,height:zw.y,depth:zw.z}}var G8,zw,fmt,W8,pP,gmt,$v,Jb,sM,jD,Xv,kX,GD,zX,WD,Ov,jc,Gc,cd,qD,LX,FX,HD,q8,bc,PTt=W(()=>{Fi(),yt(),BS(),new At,new Pe,new ur,new P,new P,G8=new dr,zw=new P}),RTt=W(()=>{}),NTt=W(()=>{Fi(),l5()}),DTt=W(()=>{IS(),[...n5],new Set(A7)}),Le=W(()=>{CTt(),RTt(),pTt(),l5(),NTt(),amt(),DTt(),B7(),Fi()}),V7=W(()=>{fmt=[3,4,8,9],W8=5,pP=3,gmt=32}),VS=W(()=>{yt(),$v=t=>{var e;return(e=class extends t{}).geometryHelper=new Kh(30,30,30),e}}),kS=W(()=>{yt(),Jb=new pc,sM=new Zn,jD=new At,Xv=(t,e,i,r,s=!1,n=t)=>{let a=e,o=n.matrixWorld;if(a.boundingSphere===null&&a.computeBoundingSphere(),sM.copy(a.boundingSphere),sM.applyMatrix4(o),i.ray.intersectsSphere(sM)===!1||(jD.copy(o).invert(),Jb.copy(i.ray).applyMatrix4(jD),a.boundingBox!==null&&Jb.intersectsBox(a.boundingBox)===!1))return;let l,u,h,d,c,p,m=a.index,f=a.attributes.position,g=a.drawRange;if(s===!1){for(c=Math.max(0,g.start),p=Math.min(m.count,g.start+g.count);c<p;c+=3)if(u=m.getX(c),h=m.getX(c+1),d=m.getX(c+2),l=y(t,i,Jb,f,u,h,d),l)return l.faceIndex=Math.floor(c/3),void r.push(l)}else{let v=a.attributes.position,b=new P,_=new P,x=new P,S=new P,w=2,M=1/((n.scale.x+n.scale.y+n.scale.z)/3),T=M*M;for(let A=Math.max(0,g.start),C=Math.min(v.count,g.start+g.count)-1;A<C;A+=w){if(b.fromBufferAttribute(v,A),_.fromBufferAttribute(v,A+1),Jb.distanceSqToSegment(b,_,S,x)>T)continue;S.applyMatrix4(n.matrixWorld);let R=i.ray.origin.distanceTo(S);R<i.near||R>i.far||r.push({distance:R,point:x.clone().applyMatrix4(n.matrixWorld),object:t})}}function y(v,b,_,x,S,w,M){let T=new P,A=new P,C=new P,R=new P,O=new P;if(T.fromBufferAttribute(x,S),A.fromBufferAttribute(x,w),C.fromBufferAttribute(x,M),_.intersectTriangle(T,A,C,!1,R)===null)return null;O.copy(R),O.applyMatrix4(v.matrixWorld);let D=b.ray.origin.distanceTo(O);return D<b.near||D>b.far?null:{faceIndex:1,distance:D,point:O.clone(),object:v}}}}),h5=W(()=>{yt(),VS(),kS(),kX=new P(1,1,1),GD=new P,zX=new P,WD=new Pe,Ov=class extends $v(ppt){constructor(t,e=15){super(e),this.object=t,this.dummy=new Hv,this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${t.uuid}`,this.matrix=this.dummy.matrixWorld,this.matrixAutoUpdate=!1,this.object.isBone&&(this.visible=!1)}raycast(t,e){Xv(this.object,Ov.geometryHelper,t,e,!1,this.dummy)}update(){}updateMatrix(){}updateMatrixWorld(t){this.object.matrixWorld.decompose(GD,WD,zX),this.matrix.compose(GD,WD,kX),super.updateMatrixWorld(t)}updateWorldMatrix(t,e){}}}),OTt=W(()=>{yt(),jc=new P,Gc=new P,cd=new At,qD=[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)],LX=[[0,3],[1,2],[5,6],[4,7],[0,1],[3,2],[7,6],[4,5],[0,4],[1,5],[2,6],[3,7]],FX=[[0,2],[7,5],[4,1],[3,6],[4,3],[1,6]],HD=(t,e,i)=>{t.updateEntityBoxSize(jc,Gc),cd.copy(e).multiply(t.matrixWorld),Gc.x===0&&Gc.y===0&&Gc.z===0?i.push(new P(jc.x,jc.y,jc.z).applyMatrix4(cd)):qD.forEach(r=>{i.push(r.clone().multiply(Gc).add(jc).applyMatrix4(cd))})},q8=class extends dr{constructor(){super(...arguments),this.matrix=new At,this.vertices=[],this.faces=[],this.edges=[],this.centerEdges=[]}copy(t){return super.copy(t),this.matrix.copy(t.matrix),this.vertices=t.vertices.map(e=>e.clone()),this.faces=t.faces.map(e=>e.clone()),this.edges=t.edges.map(e=>e.clone()),this.centerEdges=t.centerEdges.map(e=>e.clone()),this}setFromObjectSize(t,e=!1){t.updateWorldMatrix(!1,e),this.makeEmpty(),this.matrix.copy(t.matrixWorld);let i=new At().copy(t.matrixWorld).invert();return this.expandByObjectSize(t,i,e)}expandByObjectSize(t,e,i=!1){let r=[];if(i===!0){let s=[];t.traverseEntity(n=>{if(n.visible||n.cloner&&n.data.visible){if(!("geometry"in n))return cd.copy(e).multiply(n.matrixWorld),void s.push(new P().applyMatrix4(cd));HD(n,e,r)}}),r.length===0&&r.push(...s)}else HD(t,e,r);return this.setFromPoints(r)}getCenter(t){return(t=super.getCenter(t)).applyMatrix4(this.matrix),t}getPositionToCenter(t){return(t=super.getCenter(t)).applyMatrix4(cd.copy(this.matrix).setPosition(0,0,0)),t}computeVertices(){this.getSize(Gc).multiplyScalar(.5),this.getCenter(jc),cd.copy(this.matrix).setPosition(jc),this.vertices=qD.map(t=>t.clone().multiply(Gc).applyMatrix4(cd))}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=LX.map(([t,e])=>new yl(this.vertices[t],this.vertices[e])),this.centerEdges=this.edges.map(t=>t.getCenter(new P))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=FX.map(([t,e])=>this.vertices[t].clone().add(this.vertices[e]).multiplyScalar(.5))}}}),QR=W(()=>{bc={Cloner:null,changeEntityProptotype:()=>{},createEntity:()=>{}}});function k2(t){return t?.isParticleSystem===!0}function Zg(t){return t?.isHairSystem===!0}function cm(t){return t?.isShapeBlendEntity===!0}function u5(t){return t?.isPathObject===!0}function jo(t){return t?.isObject2D===!0}function Ka(t){return t?.isUIObject===!0}function $1(t){return t?.isCloner===!0}function Sg(t){return t?.isClone===!0}function mP(t){return t?.isComponentObject===!0}var ss=W(()=>{});function Or(t){k7.add(t)}function Pn(t,e){let i=`${t}:${e}`;X8.has(i)||X8.add(i)}function JR(t,e){z7.set(t,e)}function $D(t){return z7.get(t)}function Yv(t,e){L7.set(t,e)}function XD(t){return L7.get(t)}function H8(t,e){F7.set(t,e)}function ymt(t){return F7.get(t)}function $8(){return d5}var k7,X8,z7,L7,F7,d5,t4,Ii=W(()=>{k7=new Set,X8=new Set,z7=new Map,L7=new Map,F7=new Map,d5=null,t4=null});function vmt(t){let e=t.elements;Lh.set(e[0],e[1],e[2]),Fh.set(e[4],e[5],e[6]),ku.set(e[8],e[9],e[10])}function bmt(){let t=Math.max(Lh.lengthSq(),Fh.lengthSq(),ku.lengthSq());Lh.lengthSq()>Lw*t?ml.copy(Lh).normalize():ml.set(1,0,0),fl.crossVectors(ku,ml),fl.lengthSq()<=Lw*t&&(fl.copy(Fh).addScaledVector(ml,-Fh.dot(ml)),fl.lengthSq()<=Lw*t&&function(e,i){e.set(1,0,0).cross(i),e.lengthSq()<=Lw&&e.set(0,1,0).cross(i),e.normalize()}(fl,ml)),fl.normalize(),Tg.crossVectors(ml,fl)}function _mt(t){return vmt(t),bmt(),xmt.makeBasis(ml,fl,Tg)}var Lh,Fh,ku,ml,fl,Tg,xmt,Lw,Fw,nM,Mg,c5,wmt=W(()=>{yt(),Lh=new P,Fh=new P,ku=new P,ml=new P,fl=new P,Tg=new P,xmt=new At,Lw=1e-12,Fw=.01}),zS=W(()=>{yt(),wmt(),nM=new At,(Mg||(Mg={})).is=function(t){return t&&t.__isSPEObject},c5=t=>class extends t{constructor(){super(...arguments),this.previousModelViewMatrix=new At,this.copyPreviousMatrix=!0,this.hiddenMatrix=new At,this.pivotMatrix=new At,this.matrixWorldRigid=new At,this.shearScale=new At,this.shearScaleInv=new At}get __isSPEObject(){return!0}getPhysicsLocalMatrix(e){return!!this.rigidBody?.isDynamic()&&(e.copy(this.matrixWorld),this.hasNonUniformScale&&e.multiply(this.shearScaleInv),this.parent&&e.premultiply(nM.copy(this.parent.matrixWorld).invert()),e.premultiply(nM.copy(this.hiddenMatrix).invert()),e.multiply(nM.copy(this.pivotMatrix).invert()),!0)}isDescendantOf(e){e instanceof hr&&(e=e.uuid);let i=this;for(;i.parent;){if(i.parent.uuid===e)return!0;i=i.parent}return!1}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorld.multiply(this.pivotMatrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(let i of this.children)i.updateMatrixWorld(e)}updateWorldMatrix(e,i){let r=this.parent;if(e&&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 s of this.children)s.updateWorldMatrix(!1,!0)}traverseChildren(e,i=0){for(let r of this.children)Mg.is(r)&&r.traverseObject(e,i+1)}traverseObject(e,i=0){if(e(this,i)!==!0)for(let r of this.children)Mg.is(r)&&r.traverseObject(e,i+1)}updateMatrixWorldRigid(){this.hasNonUniformScale=function(e,i,r){return vmt(e),bmt(),i.makeBasis(ml,fl,Tg),r.set(ml.dot(Lh),ml.dot(Fh),ml.dot(ku),0,fl.dot(Lh),fl.dot(Fh),fl.dot(ku),0,Tg.dot(Lh),Tg.dot(Fh),Tg.dot(ku),0,0,0,0,1),function(){let s=Lh.length(),n=Fh.length(),a=ku.length(),o=Math.max(s,n,a);if(o-s>Fw||o-n>Fw||o-a>Fw)return!0;let l=Fw*o*o;return Math.abs(Lh.dot(Fh))>l||Math.abs(Lh.dot(ku))>l||Math.abs(Fh.dot(ku))>l}()}(this.matrixWorld,this.matrixWorldRigid,this.shearScale),this.matrixWorldRigid.copyPosition(this.matrixWorld),this.shearScaleInv.copy(this.shearScale).invert()}attach(e,i){this.updateWorldMatrix(!0,!1);let r=new At().copy(this.matrixWorld).invert();return e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),r.multiply(e.parent.matrixWorld)),"hiddenMatrix"in e&&e.hiddenMatrix instanceof At?e.hiddenMatrix.premultiply(r):e.applyMatrix4(r),e.updateWorldMatrix(!1,!1),this.add(e),i!==void 0&&(this.children.pop(),this.children.splice(i,0,e)),this}copy(e,i=!1){return super.copy(e,i),this.hasNonUniformScale=e.hasNonUniformScale,this}onAfterRender(e,i,r,s,n,a){this.copyPreviousMatrix&&this.previousModelViewMatrix.copy(this.modelViewMatrix)}}});function UX(t,e,i){return Wp.subVectors(e,t),vS.subVectors(e,i),Wp.cross(vS).length()<=z2}function Smt(t){let e=Z8.get(t.points);if(e!==void 0&&e.isClosed===t.isClosed)return e.curve;let i=function(r){let s=r.points,n=[s[0]],a=[new P(...s[0].data.position)];eg.copy(a[0]);for(let y=0;y<s.length-1;y++)Wp.fromArray(s[y].data.position),vS.fromArray(s[y+1].data.position),M1.subVectors(Wp,eg),A1.subVectors(Wp,vS),M1.cross(A1).length()>z2&&(n.push(s[y]),a.push(new P().copy(Wp)),eg.copy(Wp));let o=s[s.length-1];n.push(o),a.push(new P(...o.data.position));let l=r.isClosed,u=n.length-(l?0:1),h=n.length,d=[],c=[];for(let y=0;y<h;y++){let v=n[y].data;d.push(new P(...v.controlPrevious.position)),c.push(new P(...v.controlNext.position))}let p=[];for(let y=0;y<u;y++){let v=y===h-1?0:y+1;p.push(UX(a[y],c[y],a[v])&&UX(a[y],d[v],a[v]))}let m=[];for(let y=0;y<h;y++){let v=n[y].data,b=a[y],_={position:b,prevDir:void 0,nextDir:void 0,controlPrevious:d[y],controlNext:c[y],tan:void 0,baseRoundness:v.roundness,removedLength:0};if(m.push(_),v.roundness===0||!l&&(y===0||y===h-1))continue;let x=l&&y==0?h-1:y-1,S=l&&y==h-1?0:y+1,w=new P().subVectors(a[x],b).normalize(),M=new P().subVectors(a[S],b).normalize();_.prevDir=w,_.nextDir=M;let T=p[l&&y===0?h-1:y-1],A=p[y];if(T&&A){ig.addVectors(w,M).normalize();let C=eg.crossVectors(ig,w).length()/w.dot(ig);_.tan=C,_.removedLength=v.roundness/C}}for(let y=0;y<u;y++){let v=l&&y===h-1?0:y+1,b=m[y],_=m[v];if(b.removedLength!==0||_.removedLength!==0){let x=b.position.distanceTo(_.position);b.removedLength=Math.min(b.removedLength,x/2),_.removedLength=Math.min(_.removedLength,x/2)}}let f=new Array(2*h).fill(null);for(let y=0;y<u;y++){let v=l&&y===h-1?0:y+1,b=m[y],_=m[v],x=null;if(p[y]){let S=b.position.clone(),w=_.position.clone();(b.removedLength!==0||_.removedLength!==0)&&(b.nextDir&&S.add(eg.copy(b.nextDir).setLength(b.removedLength)),_.prevDir&&w.add(eg.copy(_.prevDir).setLength(_.removedLength))),S.distanceTo(w)>z2&&(x=new R2(S,S.clone().lerp(w,.3),w.clone().lerp(S,.3),w))}else b.position.distanceTo(_.position)>z2&&(x=new R2(b.position,b.controlNext,_.controlPrevious,_.position));f[2*y+1]=x}for(let y=0;y<h;y++){let v=m[y];if(v.removedLength===0)continue;let b=v.position,_=v.prevDir.clone().multiplyScalar(v.removedLength).add(b),x=v.nextDir.clone().multiplyScalar(v.removedLength).add(b),S=v.tan*v.removedLength;ig.addVectors(v.prevDir,v.nextDir).normalize(),M1.copy(_).lerp(x,.5);let w=_.distanceTo(x)/2;K8.copy(ig).multiplyScalar(Math.sqrt(Math.pow(S,2)-Math.pow(w,2))).add(M1),fP.copy(ig).multiplyScalar(-S).add(K8);let M=b.distanceTo(fP)/b.distanceTo(M1);A1.copy(v.prevDir).multiplyScalar(M*b.distanceTo(_)).add(b),Y8.copy(A1).lerp(fP,2);let T=_.clone().lerp(A1,4/3),A=x.clone().lerp(Y8,4/3);f[2*y]=new R2(_,T,A,x)}let g=new Tmt;for(let y=0;y<f.length;y++){let v=f[y];v&&g.add(v)}return g}(t);return Z8.set(t.points,{isClosed:t.isClosed,curve:i}),i}var Tmt,z2,Wp,vS,eg,ig,M1,fP,A1,Y8,K8,Z8,Ai,Vu,jX,GX,V0,YD,aM,oM,WX,KD,ZD,p5,Q8,r0,zu,Mmt=W(()=>{yt(),Tmt=class extends $F{constructor(){super()}getPoints(t=12){let e,i=[],r=this.getCurveLengths(),s=r[r.length-1]/r.length;for(let n=0,a=this.curves;n<a.length;n++){let o=a[n],l=n===0?r[n]:r[n]-r[n-1],u=Math.ceil(t*l/s),h=o.getPoints(u);for(let d=0;d<h.length;d++){let c=h[d];e&&e.equals(c)||(i.push(c),e=c)}}return this.autoClose&&i.length>1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}},z2=.001,Wp=new P,vS=new P,eg=new P,ig=new P,M1=new P,fP=new P,A1=new P,Y8=new P,K8=new P,Z8=new WeakMap}),vo=W(()=>{yt(),Le(),OTt(),Fi(),QR(),ss(),Ii(),zS(),Mmt(),cr(),(Ai||(Ai={})).is=function(t){return t&&t.__isEntity},Vu=t=>Ai.is(t),jX={type:"completeState",isfromEntity:!0},GX=["x","y","z"],V0=new P,YD=new P(1,1,1),aM=new Pe,oM=new ur,WX=new P().set(0,1,0),KD=new At,ZD=new At,p5=t=>class extends c5(t){constructor(){super(...arguments),this.raycastLock=!1,this.scaleLock=!1,this.disposed=!1,this.stateSelection=null,this.destroyedInAction=!1,this.instances=[],this.prevState=null,this.currentState=null,this.currentAnimationAction=null,this.reversibleToState=null,this.transitionState={settled:!0,state:null},this.currentTransitionEvent=null,this.previousAction=null,this._singleBBox=new q8,this._recursiveBBox=new q8,this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0,this._needApplyPathSnapping=!0,this.attachedPaths=new Set}get __isEntity(){return!0}entityChildren(e){let i=this.children[e];if(Ai.is(i))return i}entityChildrenCount(){let e=this.children.length;for(;e--;)if(Ai.is(this.children[e]))return e+1;return 0}get isConcreteEntity(){return typeof this.identity=="string"}get isVirtualEntity(){return typeof this.identity!="string"}get isInstanceRoot(){return this.isConcreteEntity&&this.data.type==="Instance"}nearestInstanceSelfOrParent(){let e=this;for(;e.data.type!=="Instance";){let i=e.parent;if(!Ai.is(i))return;e=i}return e}forInstancesRec(e){this.instances.forEach(i=>{i.disposed||e(i),i.forInstancesRec(e)})}super_Entity(e,i){typeof e=="string"&&(this.uuid=e),this.identity=e,this.data=i,this.matrixAutoUpdate=!1,this.dataPatched=this.data}changeSelectedState(e,i,r=!1){if(this.data.states.length!==0||r){for(let s of this.data.states)Zp.toOps(this.data,s.data).forEach(n=>{let a=PR.replaceProps(n,this.data);this.dataPatched=this.data,this.updateByPatchedOp(a,this.data,i)});if(e!==null){let s=this.data.states.data(e);s&&(this.dataPatched=Zp.patch(this.data,s),Zp.toOps(this.data,s).forEach(n=>{this.updateByPatchedOp(n,this.dataPatched,i)}))}r&&this.updateTransformState(this.dataPatched,i),this.stateSelection=e,this.updatePathSnapping(this.dataPatched.pathSnapping)}}get singleBBox(){return this.singleBBoxNeedsUpdate&&(this.singleBBoxNeedsUpdate=!1,this._singleBBox.setFromObjectSize(this,!1),this._singleBBox.computeVertices(),this._singleBBox.computeEdges(),this._singleBBox.computeFaces()),this._singleBBox}get recursiveBBox(){return this.recursiveBBoxNeedsUpdate&&(this.recursiveBBoxNeedsUpdate=!1,this._recursiveBBox.setFromObjectSize(this,!0),this._recursiveBBox.computeVertices(),this._recursiveBBox.computeEdges(),this._recursiveBBox.computeFaces()),this._recursiveBBox}updateEntityBoxSize(e,i){e.setScalar(0),i.setScalar(0)}resetBBoxNeedsUpdateSelf(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}resetBBoxNeedsUpdate(){this.resetBBoxNeedsUpdateSelf(),this.traverseAncestors(e=>{Vu(e)&&e.resetBBoxNeedsUpdateSelf()}),this.traverseEntity(e=>{e.resetBBoxNeedsUpdateSelf()})}find(e){let i;return this.traverseEntity(r=>{r.uuid===e&&(i=r)}),i}traverseSortNextHelper(){let e=this.parent;if(e){let i=e.children,r=i.indexOf(this)+1;if(Ai.is(i[r]))return i[r];if(Ai.is(e))return e.traverseSortNextHelper()}}sortNext(){let e=this.children;return this.children.length>0&&Ai.is(this.children[0])?e[0]:this.traverseSortNextHelper()}goUp(e){let i=this;for(;e>0&&i!==null;)i=i.parent,e-=1;return i}hasAnccestorOrSelf(e){return this===e||this.hasAnccestor(e)}hasAnccestor(e){let i=this.parent;for(;i;){if(e===i)return!0;i=i.parent}return!1}countToAccestor(e){let i=0,r=this;for(;r!==e;){if(r===null)return-1;r=r.parent,i+=1}return i}forEachEntity(e){for(let i of this.children)Vu(i)&&e(i)}traverseEntityAncestors(e){this.traverseAncestors(i=>{Ai.is(i)&&e(i)})}traverseConcreteEntity(e,i=0){if(e(this,i)!==!0)for(let r of this.children)Vu(r)&&r.isConcreteEntity&&r.traverseEntity(e,i+1)}traverseEntity(e,i=0){if(e(this,i)!==!0)for(let r of this.children)Vu(r)&&r.traverseEntity(e,i+1)}traverseVisibleEntity(e){e(this);for(let i of this.children)Vu(i)&&i.visible&&i.traverseVisibleEntity(e)}updateMatrix(){super.updateMatrix(),this.cloner&&this.cloner.onObjUpdateMatrix(),this.dispatchEvent({type:"updateMatrix"})}updateMatrixWorld(e){super.updateMatrixWorld(e),this.dispatchEvent({type:"updateMatrixWorld"})}copy(e,i=!1){return super.copy(e,i),this.dataPatched=e.dataPatched,this.raycastLock=e.raycastLock,this.scaleLock=e.scaleLock,this.hiddenMatrix.copy(e.hiddenMatrix),this}hasEntityChild(){return this.children.some(e=>Vu(e))}isAncestorOf(e){if(this.uuid===e)return!1;let i=!1;return this.traverseEntity(r=>{r.uuid===e&&(i=!0)}),i}toObjectTransformState(e=[]){return this.updateWorldMatrix(!0,!1),o8({position:this.position.toArray(),rotation:[this.rotation.x*Yt.RAD2DEG,this.rotation.y*Yt.RAD2DEG,this.rotation.z*Yt.RAD2DEG],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray(),pivot:[0,0,0],pivotRotation:[0,0,0]},e)}getTransformValues(e,i,r){return i[e].map((s,n)=>r?.shared.getVariable(s,[this.uuid,e,GX[n]])??s)}updateTransformState(e,i){let r=!1;if(e.position&&(this.position.fromArray(this.getTransformValues("position",e,i)),r=!0),e.rotation&&(V0.fromArray(this.getTransformValues("rotation",e,i)).multiplyScalar(Yt.DEG2RAD),this.rotation.setFromVector3(V0),r=!0),e.scale&&(this.scale.fromArray(this.getTransformValues("scale",e,i)),r=!0),e.hiddenMatrix!==void 0&&(r=!0,this.hiddenMatrix.fromArray(e.hiddenMatrix??lv.identity)),e.pivot!==void 0||e.pivotRotation!==void 0){if(r=!0,e.pivot!==void 0&&e.pivotRotation!==void 0)this.pivotMatrix.compose(V0.fromArray(e.pivot).negate(),aM.setFromEuler(oM.fromArray(e.pivotRotation.map(s=>s*Yt.DEG2RAD))).invert(),YD);else if(e.pivot!==void 0)this.pivotMatrix.setPosition(-e.pivot[0],-e.pivot[1],-e.pivot[2]);else if(e.pivotRotation!==void 0){let s=V0.setFromMatrixPosition(this.pivotMatrix);aM.setFromEuler(oM.fromArray(e.pivotRotation.map(n=>n*Yt.DEG2RAD))).invert(),this.pivotMatrix.compose(s,aM,YD)}}return r&&(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(s=>{s.invalidateClonerTransform(this)})),e.position&&e.rotation&&e.scale&&e.hiddenMatrix!==void 0&&this.updateWorldMatrix(!1,!0),r}onVariableUpdate(e=!1){e?this.resetBBoxNeedsUpdate():(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(i=>{i.invalidateClonerTransform(this)}),this.requestRender())}dispose(){this.disposed=!0,this.cloner&&(this.cloner.dispose(),this.cloner=void 0)}disposeChildrenRecursively(){for(let e of this.children)Ai.is(e)&&e.disposeRecursively()}disposeRecursively(){this.dispose(),this.children.forEach(e=>{Ai.is(e)&&e.disposeRecursively()})}toState(e=[]){return o8({name:this.name,visible:this.visible,raycastLock:this.raycastLock,...this.toObjectTransformState(e)},e)}updateByObjUpdateOp(e,i){e!==void 0&&this.updateByOp({type:0,props:e,path:[]},{...this.data,...e},i,!1)}updateByOp(e,i,r,s){let n=this.data;this.data=i;let a=e,o=tr(e.path,["states","*"]);if(o!==null){if(e.type===0){let[l]=o;if(this?.stateSelection===l){let u={...e.props};if(delete u.name,Object.values(e.props).some(h=>h===void 0)){let h=this.data;if(h!==void 0){let d=En.zoom(h,e.path.slice(2));if(d)for(let c in e.props)e.props[c]===void 0&&c in d&&(u[c]=d[c])}}a={...e,props:u,path:e.path.slice(2)}}}}else if(e.type===0){let l=this.stateSelection?this.data.states.data(this.stateSelection):void 0;if(l!==void 0){if(e.props.name!==void 0&&l.name){let{name:h,...d}=l;l=d}if(e.props.material!==void 0&&"material"in l){let{material:h,...d}=l;l=d}let u=En.removeOverridden(e.path,e.props,l);a={...e,props:u}}}if(this.updateByPatchedOpBase(a,Zp.patch(this.data,this.stateSelection?this.data.states.data(this.stateSelection):void 0),r),tr(e.path,["overrides"])){let l=[],u=[...e.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(e.type===0)for(let h of Object.keys(e.props)){l[l.length-1]=h;let d=r.scene.findInstance([this.uuid,...l]);d&&(d.overrideData=e.props[h],d.updateState(nm.apply(d.component.data,d.overrideData),r))}}else{let h=r.scene.findInstance([this.uuid,...l]);if(h){let d=En.zoom(h.component.data,u);if((e={...e,path:u}).type===0){let c=e.props;if(d)for(let[p,m]of Object.entries(e.props))m===void 0&&(c===e.props&&(c={...e.props}),c[p]=d[p]);e={...e,props:c}}h.overrideData=$R.resolve(i.overrides,l),h.updateByOp(e,Qn.applySimple(h.data,e),r,!1)}}}else if(this.instances.length>0){let l;if(e.path.length===0&&e.type===0){let u;for(let h of yc.rootOverrideProps)h in e.props&&(u===void 0&&(u={}),u[h]=e.props[h]);u&&(l={...e,props:u})}else for(let u of yc.rootOverrideProps)if(tr(e.path,[u])){l=e;break}l!==void 0&&this.instances.forEach(u=>{if(u.isInstanceRoot){let h=nm.filterOp(u.overrideData,l);h&&u.updateByOp(h,Qn.applySimple(u.data,h),r,!0)}}),this.instances.forEach(u=>{if(!u.isInstanceRoot){let h=nm.filterOp(u.overrideData,e);if(h){let d;d=n===u.data&&e===h?i:Qn.applySimple(u.data,h),u.updateByOp(h,d,r,!0)}}})}}updateByPatchedOpBase(e,i,r){if(this.dataPatched=i,e.path.length===0&&e.type===0)e.props.type!==void 0&&!Yg.is(e.props.type)&&bc.changeEntityProptotype(this,i,r);else if(e.path.length===1&&e.path[0]==="geometry"&&e.type===0&&"type"in e.props){bc.changeEntityProptotype(this,i,r);for(let s of this.children)Ai.is(s)&&s.updateVisible(r.scene)}this.updateByPatchedOp(e,i,r)}updateByPatchedOp(e,i,r){if(e.path.length===0&&e.type===0?this.updateState(e.props,r):e.type===0&&("resolutionLevel"in e.props||"useChildrenColors"in e.props)&&this.updateState(i,r),e.path[0]==="morphTargetInfluences"&&e.type===0){let s=i.morphTargetInfluences.get(e.path[1])?.data.name;s&&this.updateMorphInfluences(s,r.shared.getVariable(e.props.value,[this.uuid,"morphTargetInfluences",s]))}if(tr(e.path,["pathSnapping"])!==null&&this.updatePathSnapping(i.pathSnapping),tr(e.path,["cloner"])!==null){let s=Qn.drop(e,1);s.path.length===0&&s.type===0&&s.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(e=this.dataPatched.pathSnapping){this._updatedPathSnapping=e,this._needApplyPathSnapping=!0}get updatedPathSnapping(){return this._updatedPathSnapping}applyPathSnapping(e){if(this._needApplyPathSnapping===!1)return;let i=this._updatedPathSnapping?.pathId??this.dataPatched.pathSnapping.pathId,r=this._updatedPathSnapping?.slide??this.dataPatched.pathSnapping.slide??0,s=this._updatedPathSnapping?.offset??this.dataPatched.pathSnapping.offset??0,n=this._updatedPathSnapping?.orientation??this.dataPatched.pathSnapping.orientation;if(i===null)return;let a=e.find(i);if(!a)return;this._needApplyPathSnapping=!1;let o=a.data;if(o.geometry.path.points.length<=1)return;let l=Smt(o.geometry.path),u=(r+s)%1;r+s===1&&u===0&&(u=1);let h=null;try{h=l.curves.length?l.getPointAt(u):null}catch{}if(h===null)return;a.updateMatrixWorld();let d=this.parent?KD.copy(this.parent.matrixWorld).invert():KD.identity();d.multiply(a.matrixWorld),h.applyMatrix4(d);let c={position:h.toArray(),rotation:o.rotation};if(n==="tangential"){let p=ZD.extractRotation(a.matrixWorld),m=l.getTangentAt(u).applyMatrix4(p).add(h),f=ZD.lookAt(h,m,WX),g=V0.setFromEuler(oM.setFromRotationMatrix(f)).multiplyScalar(Yt.RAD2DEG);c={...c,rotation:g.toArray()}}this.updateTransformState(c),this.traverseEntity(p=>{p._cameraType&&p.dispatchEvent(jX)})}updateVisible(e){if(this.visible=this.dataPatched.visible&&(!this.dataPatched.cloner||(this.dataPatched.cloner.disabled??!1)||this.dataPatched.cloner?.hideBase!==!0),!e)return;let i=!1;this.traverseEntity(r=>{if(r.data.type==="Splat")return i=!0,!0}),i&&e.reloadSplats()}updateState_Entity(e,i){e.name!==void 0&&(this.name=e.name),e.raycastLock!==void 0&&(this.raycastLock=e.raycastLock),e.visible!==void 0&&(this.updateVisible(i?.scene),this.resetBBoxNeedsUpdate()),i&&"cloner"in e&&e.cloner!==void 0&&(this.setFromClonerState(e.cloner,i),this.updateVisible(i.scene)),this.updateTransformState(e,i)}get attachedSurfaceCloners(){return this.children.filter(e=>$1(e)&&e.parameters.type==="toObject")}setFromClonerState(e,i){if(!this.disposed)if(e===null||e.disabled)this.cloner&&this.cloner.dispose(),this.cloner=void 0;else if(this.cloner===void 0){if(bc.Cloner===null)return void Pn("cloners","a cloner");this.cloner=new bc.Cloner(this,e),i.scene.addPendingExpandCloner(this)}else this.cloner.updateState(e,i)}expandCloner(e){!this.disposed&&this.cloner&&this.cloner.expandClones(e)}invalidateClonerTransform(e){this.cloner&&this.cloner.invalidateTransform(e)}requestRender(){this.dispatchEvent({type:"requestRender"})}}}),s0=W(()=>{yt(),vo(),(Q8||(Q8={})).is=t=>"objectHelper"in t,r0=(t,e)=>class extends p5(t){constructor(){super(...arguments),this.objectHelper=new e(this),this.gizmos={}}get geometryHelper(){return e.geometryHelper}raycast(i,r){this.objectHelper.raycast(i,r)}showGizmos(){for(let i in this.gizmos){let r=this.gizmos[i];r instanceof uS&&(r.visible=!0)}}updateEntityBoxSize(i,r){this.objectHelper.visible&&this.geometryHelper instanceof Kh?(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 uS&&(r.visible=!1)}}}}),m5=W(()=>{yt(),h5(),s0(),zu=class extends r0(Hv,Ov){constructor(t,e){super(),this.super_Entity(t,e),this.objectHelper.update(),this.data.type==="Empty"&&(this.objectHelper.visible=!1)}updateState(t,e){this.updateState_Entity(t,e),"buffer"in t&&Object.keys(t).length===1&&e.scene.reloadSplats()}}});function lh(t,e,i,r,s,n,a){Uw.set(s,n,a).unproject(r);let o=e[t];if(o!==void 0){let l=i.getAttribute("position");for(let u=0,h=o.length;u<h;u++)l.setXYZ(o[u],Uw.x,Uw.y,Uw.z)}}var Uw,Xo,qX,Amt,ITt=W(()=>{yt(),VS(),kS(),Uw=new P,Xo=new vg,qX=class extends _1{constructor(t){let e=new ye,i=new Vh({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],s=[],n={},a=new oe(15711266),o=new oe(15711266),l=new oe(2857471);function u(d,c,p){h(d,p),h(c,p)}function h(d,c){r.push(0,0,0),s.push(c.r,c.g,c.b),n[d]===void 0&&(n[d]=[]),n[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),e.setAttribute("position",new me(r,3)),e.setAttribute("color",new me(s,3)),super(e,i),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=n,this.update()}update(){let t=this.geometry,e=this.pointMap;Xo.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let i=.8;lh("n1",e,t,Xo,-1,-1,i),lh("n2",e,t,Xo,1,-1,i),lh("n3",e,t,Xo,-1,1,i),lh("n4",e,t,Xo,1,1,i);let r=i;lh("f1",e,t,Xo,-1,-1,r),lh("f2",e,t,Xo,1,-1,r),lh("f3",e,t,Xo,-1,1,r),lh("f4",e,t,Xo,1,1,r);let s=r;lh("u1",e,t,Xo,.35,1.1,s),lh("u2",e,t,Xo,-.35,1.1,s),lh("u3",e,t,Xo,0,1.55,s),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}},Amt=class extends $v(qX){constructor(t){super(t),this.object=t,this.name=`CombinedCameraHelper: ${t.uuid}`}updateMatrixWorld(t){super.updateMatrixWorld(t),this.updateTarget()}updateTarget(){let t=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(t)}raycast(t,e){Xv(this.object,this.geometry,t,e,!0)}}});function HX(t){return 1-Math.pow(1-t,3)}var Zm,lM,hM,uM,k0,dM,uu,ln,Zh=W(()=>{yt(),ITt(),Le(),s0(),cr(),Zm=new P,lM=new P,hM=new Pe,uM=new P,k0=new P,dM=new P,uu=class extends r0(vg,Amt){constructor(t="",e={...B2.defaultData,name:""}){super(),this._cameraType="OrthographicCamera",this.targetOffset=gc.DefaultTargetOffset,this.isUpVectorFlipped=!1,this.angleOffsetFromUp=0,this.wasMovedByUser=!1,this.wasMovedBySwitchCameraAction=!1,this._createdAt=typeof performance<"u"?performance.now():0,this._tickProjectionTransition=()=>{let s=this._projectionTransition;if(s===void 0)return;if(this.disposed)return void this._endProjectionTransition();s.raf=requestAnimationFrame(this._tickProjectionTransition);let n=uu.projectionTransitionRequestRender??s.requestRender;this.updateProjectionMatrix(),n?.()},this.super_Entity(t,e),this.previousProjectionMatrix=new At,this.matrixAutoUpdate=!0,this.width=window.innerWidth,this.height=window.innerHeight;let i=this.width,r=this.height;this.orthoCamera=new Rv(-.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(t){let e=uu.projectionTransitionsEnabled;uu.projectionTransitionsEnabled=!1;try{return t()}finally{uu.projectionTransitionsEnabled=e}}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}set fov(t){this.perspCamera.fov=t}get fov(){return this.perspCamera.fov}setNear(t,e){t==="PerspectiveCamera"?this.perspCamera.near=e:this.orthoCamera.near=e}setZoom(t,e){e>=0&&(t==="PerspectiveCamera"?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}set cameraType(t){t==="PerspectiveCamera"?this.toPerspective():t==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(t){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=t:this.orthoCamera.near=t}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(t){t>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=t:this.orthoCamera.zoom=t)}lookAt(t,e,i){typeof t=="number"&&(t=new P(t,e,i)),super.lookAt(t),this.getWorldPosition(Zm),this.targetOffset=Zm.distanceTo(t)}getTarget(t=new P){return this.getWorldDirection(lM),this.getWorldPosition(Zm),lM.multiplyScalar(this.targetOffset),t.copy(Zm).add(lM),t}getDistanceToTarget(){let t=this.getTarget();return this.getWorldPosition(Zm),Zm.distanceTo(t)}updateUp(){this.getWorldQuaternion(hM),uM.set(0,0,1).applyQuaternion(hM),k0.copy(hr.DEFAULT_UP),this.isUpVectorFlipped&&k0.negate(),k0.applyQuaternion(hM),dM.copy(hr.DEFAULT_UP).projectOnPlane(uM),this.angleOffsetFromUp=dM.angleTo(k0),this.angleOffsetFromUp*=dM.cross(k0).dot(uM)>=0?1:-1}updateTransformState(t,e){let i=super.updateTransformState(t,e);return t.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=t.isUpVectorFlipped),this.updateUp(),i}getViewFrontToObject(t){let e=t.getWorldPosition(new P),i=t.getWorldDirection(new P).multiplyScalar(this.targetOffset);return{position:e.clone().add(i),target:e}}getViewToTarget(t){let e=this.getWorldDirection(new P).multiplyScalar(this.targetOffset);return{position:t.clone().sub(e),target:t}}getViewToObject(t){let e=new P;return t.getWorldPosition(e),this.getViewToTarget(e)}setViewplaneSize(t,e,i=!1){if(this.aspect=t/e,i){let r=t>e?this.aspect:1,s=t>e?1:this.aspect;this.left=-395*r,this.right=395*r,this.top=1/s*395,this.bottom=1/s*-395}else this.left=.5*-t,this.right=.5*t,this.top=.5*e,this.bottom=.5*-e;this.updateProjectionMatrix()}copyViewPlaneSize(t){this.aspect=t.aspect,this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.updateProjectionMatrix()}toOrthographic(){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}toPerspective(){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}get isProjectionTransitioning(){return this._projectionTransition!==void 0}get projectionTransitionProgress(){let t=this._projectionTransition;if(t===void 0)return 1;let e=(performance.now()-t.start)/t.duration;return e>=1?1:e<=0?0:HX(e)}get _activeSubCamera(){return this._cameraType==="PerspectiveCamera"?this.perspCamera:this.orthoCamera}_canAnimateProjection(){return uu.projectionTransitionsEnabled&&typeof requestAnimationFrame=="function"&&typeof performance<"u"&&performance.now()-this._createdAt>=uu.projectionTransitionMinAgeMs}_beginProjectionTransition(t){let e=this._projectionTransition;e===void 0&&(e={from:new At,blend:new At,blendInverse:new At,start:0,duration:uu.projectionTransitionDuration,referenceDepth:1,raf:0,requestRender:t},this._projectionTransition=e),e.from.copy(this.projectionMatrix),e.start=performance.now(),e.duration=uu.projectionTransitionDuration,e.referenceDepth=Number.isFinite(this.targetOffset)?Math.max(1,this.targetOffset):1,t&&(e.requestRender=t),e.raf!==0&&cancelAnimationFrame(e.raf),e.raf=requestAnimationFrame(this._tickProjectionTransition)}_applyProjectionTransition(){let t=this._projectionTransition;if(t===void 0)return;let e=(performance.now()-t.start)/t.duration;if(e>=1)return void this._endProjectionTransition();let i=HX(e),r=t.from.elements,s=this._activeSubCamera.projectionMatrix.elements,n=t.blend.elements,a=t.referenceDepth,o=Math.max(1e-6,r[15]-r[11]*a),l=i*o/(i*o+(1-i)*Math.max(1e-6,s[15]-s[11]*a));for(let u=0;u<16;u++)n[u]=r[u]+(s[u]-r[u])*l;t.blendInverse.copy(t.blend).invert(),this.projectionMatrix=t.blend,this.projectionMatrixInverse=t.blendInverse}_endProjectionTransition(){let t=this._projectionTransition;if(t===void 0)return;t.raf!==0&&cancelAnimationFrame(t.raf),this._projectionTransition=void 0;let e=this._activeSubCamera;this.projectionMatrix=e.projectionMatrix,this.projectionMatrixInverse=e.projectionMatrixInverse}_syncProjectionTransition(t){let e=t._projectionTransition;if(e===void 0)return void(this._projectionTransition!==void 0&&this._endProjectionTransition());let i=this._projectionTransition;i===void 0?(i={from:new At,blend:new At,blendInverse:new At,start:0,duration:1,referenceDepth:1,raf:0,requestRender:void 0},this._projectionTransition=i):i.raf!==0&&(cancelAnimationFrame(i.raf),i.raf=0),i.requestRender=void 0,i.from.copy(e.from),i.start=e.start,i.duration=e.duration,i.referenceDepth=e.referenceDepth,this._applyProjectionTransition()}setFocalLength(t){this.perspCamera.setFocalLength(t),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(t,e,i,r,s,n){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(t,e,i,r,s,n):this.orthoCamera.setViewOffset(t,e,i,r,s,n),this._applyProjectionTransition()}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}copyHistory(){this.previousProjectionMatrix&&this.previousProjectionMatrix.copy(this.projectionMatrix)}updateProjectionMatrix(){this._cameraType==="PerspectiveCamera"?this.toPerspective():this._cameraType==="OrthographicCamera"&&this.toOrthographic()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(t,e){return super.copy(t,e),this.parent=t.parent,this.orthoCamera.copy(t.orthoCamera),this.perspCamera.copy(t.perspCamera),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.far=t.far,this.view=t.view===null?null:Object.assign({},t.view),this._cameraType=t._cameraType,this.aspect=t.aspect,this.fov=t.fov,this.focus=t.focus,this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this.targetOffset=gc.sanitizeTargetOffset(t.targetOffset),this.updateProjectionMatrix(),this._syncProjectionTransition(t),this}toCameraState(t=[]){return o8({type:this.cameraType,far:this.far,orthographic:{near:this.orthoCamera.near,zoom:this.orthoCamera.zoom},perspective:{near:this.perspCamera.near,fov:this.perspCamera.fov,zoom:this.perspCamera.zoom},up:this.up.toArray(),targetOffset:this.targetOffset,isUpVectorFlipped:this.isUpVectorFlipped},t)}updateCameraSubtype(t,e){let i=t==="perspective"?"PerspectiveCamera":"OrthographicCamera";e.zoom!==void 0&&this.setZoom(i,e.zoom),e.near!==void 0&&this.setNear(i,e.near),e.fov!==void 0&&i==="PerspectiveCamera"&&(this.fov=e.fov)}updateState(t,e){this.updateCameraState(t,e)}updateCameraState(t,e){this.updateState_Entity(t,e),t.far!==void 0&&(this.far=t.far),t.orthographic!==void 0&&this.updateCameraSubtype("orthographic",t.orthographic),t.perspective!==void 0&&this.updateCameraSubtype("perspective",t.perspective),t.type!==void 0&&(t.type!==this._cameraType&&this._canAnimateProjection()&&this._beginProjectionTransition(e?.shared.requestRender),this.cameraType=t.type),t.up!==void 0&&this.up.fromArray(t.up.map(i=>typeof i=="number"?i:0)),t.targetOffset!==void 0&&(this.targetOffset=gc.sanitizeTargetOffset(t.targetOffset)),t.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=t.isUpVectorFlipped),this.updateProjectionMatrix()}updateByPatchedOp(t,e,i){super.updateByPatchedOp(t,e,i),t.path.length===1&&t.type===0&&this.updateCameraSubtype(t.path[0],t.props)}toState(t){return{...super.toState(t),...this.toCameraState(t),type:this.cameraType}}},(ln=uu).projectionTransitionsEnabled=!1,ln.projectionTransitionDuration=350,ln.projectionTransitionMinAgeMs=1e3});function Cmt(t){return t.type==="TorusGeometry"&&t.arc===360}var Emt,cM,J8,bS=W(()=>{yt(),Emt=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,revolutions:2,segments:40,pathRadius:10,pathType:0,pathSegments:30,cornerRadius:30,cornerSegments:4},t.parameters),r=Math.abs(i.width),s=Math.abs(i.height??r),n=Math.abs(i.depth??r),a=Math.abs(Math.min(r,n))/2;return{parameters:Object.assign(i,{width:r,height:s,depth:n,radius:a,segments:Math.round(i.segments),pathSegments:Math.round(i.pathSegments),cornerSegments:Math.round(i.cornerSegments)})}}static build(t){let{width:e,height:i,depth:r,radius:s,revolutions:n,segments:a,pathRadius:o,pathType:l,pathSegments:u,cornerRadius:h,cornerSegments:d}=t.parameters,c=new J8(!1,e,i,r,s,n,a,o,l,u,h,d);return Object.assign(c,{userData:{...t,type:"HelixGeometry"}})}},cM=new sm([0,0,0],1),J8=class extends ye{constructor(t=!0,e=1,i=1,r=1,s=1,n=1,a=1,o=1,l=1,u=1,h=1,d=1){if(super(),n===0)return;let c=t&&n===1;c&&(d=0),h>100&&(h=100),h===0&&(d=0);let p,m,f,g,y,v,b,_,x=()=>new P,S=new P,w=x(),M=x(),T=x(),A=x(),C=x(),R=x(),O=x(),D=x(),B=x(),k=x(),j=x(),z=i-2*o+.001,V=z/n,H=Math.ceil(a*n),U=H+1,et=z/H,at=-z/2,Q=u+1,ut=2*Math.PI/u,ht=Math.PI/2/d,q=Math.min((1-h/100)*o,o-.01),nt=o-q,Tt=0,gt=2*d+2,vt=Q*gt/2,ct=vt+Q*U,St=Math.max(0,Q*(U+gt)),[Mt,Ct,Vt]=[3,3,2].map(Be=>Array(St*Be).fill(0)),Pt=[],Dt=s-o;function It(Be,ee){let oi=Math.PI/2;v=ee*et,_=2*Math.PI*(v%V)/V+oi,v+=at,b=Math.sin(_)*Dt,y=Math.cos(_)*Dt,t?Be.set(y,b,v):Be.set(y,v,b)}It(S,-1e-10),It(w,0),A.copy(S),It(S,1);let Ot=S.distanceTo(w),Qt=c?0:nt+q,Lt=Ot*H+2*Qt,Jt=q,qt=Lt-Qt;for(let Be=0;Be<=H;Be++){It(M,Be),j.subVectors(M,A).normalize(),A.copy(M),B.copy(M).setComponent(+t+1,0).normalize(),k.crossVectors(j,B).normalize();let ee=Be===0,oi=Be===H,xi=ee?3*Math.PI/2:ht,Xs=ee?Jt:qt,$i=ee?Q:ct,li=ee?0:St-Q,jr=j.clone().multiplyScalar(ee?-nt:nt).add(M),Jr=j.clone().multiplyScalar(ee?-1:1).normalize();for(let Gr=0;Gr<Q;Gr++){let Ui=Gr*ut;if(C.addVectors(S.copy(B).multiplyScalar(o*Math.cos(Ui)),w.copy(k).multiplyScalar(o*Math.sin(Ui))),R.copy(C).normalize(),ee||oi){c||(Tt=li+Gr,[0,1,2].forEach(Ci=>{Mt[3*Tt+Ci]=jr.getComponent(Ci),Ct[3*Tt+Ci]=Jr.getComponent(Ci)}),Vt[2*Tt]=+oi,Vt[2*Tt+1]=Gr/u),w.copy(R).multiplyScalar(q),T.addVectors(M,w);for(let Ci=0;Ci<d;Ci++){let Ys=Ci*ht+xi;O.addVectors(S.copy(j).multiplyScalar(nt*Math.sin(Ys)),w.copy(R).multiplyScalar(nt*Math.cos(Ys))),D.copy(O).normalize(),w.addVectors(T,O),O.normalize(),Tt=$i+Ci*Q+Gr,[0,1,2].forEach(_r=>{Mt[3*Tt+_r]=w.getComponent(_r),Ct[3*Tt+_r]=D.getComponent(_r)});let cs=+ee+Math.sin(Ys);Vt[2*Tt]=(Xs+nt*cs)/Lt,Vt[2*Tt+1]=Gr/u}}w.addVectors(M,C),Tt=vt+Be*Q+Gr,[0,1,2].forEach(Ci=>{Mt[3*Tt+Ci]=w.getComponent(Ci),Ct[3*Tt+Ci]=R.getComponent(Ci)}),Vt[2*Tt]=(Qt+Be*Ot)/Lt,Vt[2*Tt+1]=Gr/u}}let X=U+2*d+2,[$t,Te]=[+c,X-1];for(let Be=$t;Be<=Te-1;Be++){let ee=c&&Be===Te-1;for(let oi=0;oi<Q-1;oi++)p=Be*Q+oi,m=p+1,f=(ee?oi:p)+Q,g=(ee?oi+1:m)+Q,Be===0?Pt.push(m,g,f):Be===X-2?Pt.push(p,m,f):Pt.push(p,m,f,m,g,f)}this.setIndex(Pt),this.setAttribute("position",new me(Mt,3)),this.setAttribute("normal",new me(Ct,3)),this.setAttribute("uv",new me(Vt,2))}getClosedTorusIndicesForBooleanOrSubdiv(){let t,e,i,r,s=this.userData.parameters,n=Math.ceil(s.tubularSegments),a=s.radialSegments,o=a+1,l=[];for(let u=1;u<n;u++)for(let h=0;h<a;h++)t=u*o+h,e=t+1,i=t+o,r=e+o,l.push(t,e,i,e,r,i);for(let u=0;u<a;u++)t=n*o+u,e=t+1,i=u+o,r=u+1+o,l.push(t,e,i,e,r,i);return cM.array=new Uint32Array(l),cM.count=l.length,cM}}});function BTt(t){return XX||(XX=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.30/build",i=import("./boolean.js"),[r,s]=await Promise.all([i,fetch(`${e}/boolean.wasm`).then(n=>n.arrayBuffer())]);await r.default({module_or_path:s}),_S=r}())}function e4(){if(_S===void 0)throw new Error("boolean-wasm is not loaded");return _S}function U7(t){let e=xS.get(t);if(e===void 0)throw new Error("Unknown csg mesh set handle "+t);return e}function j7(t){return xS.set(++tU,t),tU}function VTt(t,e,i){if(_S===void 0)return-1;let{positions:r,indices:s,normals:n}=function(a,o){if(o&&a.userData.positions!==void 0){let p=a.userData,m=[];for(let f=0,g=0;f<p.verticesPerFace.length;f++){let y=p.verticesPerFace[f];for(let v=1;v<y-1;v++)m.push(p.indices[g],p.indices[g+v],p.indices[g+v+1]);g+=y}return{positions:p.positions instanceof Float32Array?p.positions:new Float32Array(p.positions),indices:new Uint32Array(m)}}let l;l=Cmt(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}}(t,e);return j7(new _S.CsgMesh(r,s,n))}function $X(t,e){let i=e4(),r=Rmt[e];if(r===void 0)throw new Error("Unknown boolean operation "+e);let s=t.map(U7);if(s.length===1)return i.clone_mesh(s[0]);let n,a=[];if(e===2&&s.length>2){let o=s[0];for(let l=1;l<s.length-1;l++)o=i.boolean_mesh(o,s[l],0),a.push(o);n=i.boolean_mesh(s[s.length-1],o,2)}else if(e===2)n=i.boolean_mesh(s[1],s[0],2);else{let o=s[s.length-1];for(let l=0;l<s.length-1&&(o=i.boolean_mesh(o,s[l],r),a.push(o),o.tri_count()!==0);l++);n=o,a.pop()}for(let o of a)o.free();return n}function QD(t,e){U7(t).transform(new Float32Array(e.elements))}function Pmt(t){let e=xS.get(t);e!==void 0&&(e.free(),xS.delete(t))}var _S,xS,tU,XX,Rmt,f5=W(()=>{yt(),bS(),xS=new Map,tU=0,Rmt={0:0,1:1,2:2}});function Qm(t){return t!==null&&"booleanOp"in t}var eU,Nmt,kTt=W(()=>{yt(),vo(),f5(),eU=class extends p5(Ar){constructor(){super(...arguments),this.booleanMeshSetAddress=-1,this.booleanWasTransformed=!1,this.booleanMatrixInvOld=new At}updateVisible(t){super.updateVisible(t),this.visible=!Qm(this.parent)&&this.visible,Qm(this.parent)&&this.parent.invalidateDownstreamBooleanData()}onClonerLayoutUpdated(){Qm(this.parent)&&this.invalidateDownstreamBooleanData()}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(Pmt(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(t=!1){return t?this.booleanWasTransformed=!0:this.freeBooleanPointer(),Qm(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let t of this.children)t instanceof eU&&(t.freeBooleanPointer(),Qm(t)&&t.invalidateUpstreamBooleanData())}updateTransformState(t,e){let i=super.updateTransformState(t,e);return i&&Qm(this.parent)&&this.invalidateDownstreamBooleanData(!0),i}onVariableUpdate(t=!1){super.onVariableUpdate(t),Qm(this.parent)&&this.invalidateDownstreamBooleanData(!0)}}}),zTt=W(()=>{Nmt=null});function G7(t,e=0,i=t.count,r,s){let n=1/0,a=1/0,o=1/0,l=-1/0,u=-1/0,h=-1/0;for(let d=e;d<i;d++){let c=t.getX(d),p=t.getY(d),m=t.getZ(d);c<n&&(n=c),p<a&&(a=p),m<o&&(o=m),c>l&&(l=c),p>u&&(u=p),m>h&&(h=m)}jw.min.set(n,a,o),jw.max.set(l,u,h),jw.getCenter(r),jw.getSize(s).multiplyScalar(.5)}var jw,YX,KX,Is,la=W(()=>{yt(),kTt(),zTt(),jw=new dr,YX=new ye,KX=new Uo,Is=class extends eU{constructor(t,e){super(YX,KX),this.super_Entity(t,e)}updateState(t,e){this.updateState_Entity(t,e)}raycast(t,e){let i=Nmt;i===null?super.raycast(t,e):i(this,t,e)}updateEntityBoxSize(t,e){let i=this.geometry.getAttribute("position");i!==void 0?G7(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,t,e):super.updateEntityBoxSize(t,e)}}});function i4(t){return t?.isClassicNodeMaterial===!0}var Dr,iU,Dmt,Omt,L2,Imt,Bmt,Vmt,W7=W(()=>{}),Pc=W(()=>{yt(),Dr=class extends oe{constructor(t,e,i,r){super(t,e,i),this.isColorA=!0,this.a=r}setRGBA(t,e,i,r){super.setRGB(t,e,i),this.a=r}copy(t){return super.copy(t),this.a="a"in t?t.a:1,this}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}equals(t){return super.equals(t)&&this.a===t.a}setStyle(t,e="srgb"){let i;if(t==="transparent")return this.setRGBA(0,0,0,0),this;if(i=/^((?:rgb|hsl)a?)\(([^)]*)\)/.exec(t)){let r,s=i[1],n=i[2];switch(s){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(n))return this.a=s==="rgba"?parseFloat(r[4]):1,super.setStyle(t,e);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)%\s*,\s*(\d*\.?\d+)%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(n))return this.a=s==="hsla"?parseFloat(r[4]):1,super.setStyle(t,e)}}return super.setStyle(t,e)}get x(){return this.r}get y(){return this.g}get z(){return this.b}get w(){return this.a}set x(t){this.r=t}set y(t){this.g=t}set z(t){this.b=t}set w(t){this.a=t}}}),LTt=W(()=>{Pc(),iU=class extends Dr{}}),FTt=W(()=>{Dmt=class{constructor(t=1e4){this.timeout=t,this.cache=new Map,this.head={data:null,time:0,src:null,next:null,prev:null},this.tail={data:null,time:1/0,src:null,next:null,prev:null},this.hasClean=!1,this.cleanupTimer=null,this.head.next=this.tail,this.tail.prev=this.head}log(...t){}remove(t){let e=this.cache.get(t);e&&(this.dispose(t,e.data),this.cache.delete(t),e.prev.next=e.next,e.next.prev=e.prev,e.next=null,e.prev=null,e.data=null)}scheduleCleanup(){this.hasClean||(this.log("scheduled cleanup"),this.hasClean=!0,this.cleanupTimer=setTimeout(()=>{this.hasClean=!1,this.cleanupTimer=null,this.log("cleaning");let t=Date.now(),e=this.head.next;for(;e.time<t-this.timeout;){this.dispose(e.src,e.data),this.cache.delete(e.src);let i=e;e=e.next,e.prev=this.head,this.head.next=e,i.next=null,i.prev=null,i.data=null}this.head.next!==this.tail?this.scheduleCleanup():this.log("no more cleanup")},this.timeout+1e3))}has(t){return this.cache.get(t)?.data}load(t){let e=Date.now(),i=this.cache.get(t);return i===void 0?(i={data:this.create(t),src:t,time:e,next:null,prev:null},this.cache.set(t,i)):(i.time=e,i.prev.next=i.next,i.next.prev=i.prev),i.prev=this.tail.prev,i.next=this.tail,this.tail.prev.next=i,this.tail.prev=i,this.scheduleCleanup(),i.data}disposeAll(){this.cleanupTimer!==null&&(clearTimeout(this.cleanupTimer),this.cleanupTimer=null),this.hasClean=!1,this.cache.forEach((t,e)=>{this.dispose(e,t.data),t.next=null,t.prev=null,t.data=null}),this.cache.clear(),this.head.next=this.tail,this.tail.prev=this.head}destroy(){this.disposeAll(),this.head=null,this.tail=null}}}),kmt=W(()=>{FTt(),Omt=class extends Dmt{create(t){return URL.createObjectURL(new Blob([t]))}dispose(t,e){URL.revokeObjectURL(e)}}}),zmt=W(()=>{Imt=class{constructor(t,e){this.data=t,this.cache=e,this.refCount=0}deref(){this.refCount,this.refCount-=1,this.refCount===0&&(this.cache.remove(this),this.dispose())}dispose(){this.refCount}},Bmt=class{constructor(){this.cache=new Map}remove(t){this.cache.delete(t.data)}load(t){let e=this.cache.get(t);return e===void 0&&(e=this.create(t),this.cache.set(t,e)),e.refCount+=1,e}}}),UTt=W(()=>{yt(),Vmt=class extends rpt{constructor(t){super(t),this.type=Qe}parse(t){let e=function(p,m){switch(p){case 1:throw new Error("THREE.HDRLoader: Read Error: "+(m||""));case 2:throw new Error("THREE.HDRLoader: Write Error: "+(m||""));case 3:throw new Error("THREE.HDRLoader: Bad File Format: "+(m||""));default:throw new Error("THREE.HDRLoader: Memory Error: "+(m||""))}},i=function(p,m,f){m=m||1024;let g=p.pos,y=-1,v=0,b="",_=String.fromCharCode.apply(null,new Uint16Array(p.subarray(g,g+128)));for(;0>(y=_.indexOf(`
337
+ })();`}),vpt=W(()=>{m7=class{constructor(t,e,i){this.deps=t,this.onConsole=e,this.onEvent=i,this.disposed=!1,this.eventUnsubs=new Map,this.variablePollHandle=null,this.lastVariables=null}dispose(){this.disposed=!0;for(let t of this.eventUnsubs.values())t();this.eventUnsubs.clear(),this.stopVariablePolling()}execute(t,e){let i=this.deps;switch(t){case"setVariable":{let r=i.setVariable(String(e[0]),e[1]);return r.warning&&this.onConsole("warn",r.warning),r.ok}case"setVariables":{let r=e[0]??{},s=!0;for(let[n,a]of Object.entries(r)){let o=i.setVariable(n,a);o.warning&&this.onConsole("warn",o.warning),s=s&&o.ok}return s}case"getVariable":return i.getVariable(String(e[0]));case"getVariables":return i.getVariables();case"getAllObjects":return i.getAllObjects();case"findObjectByName":case"findObjectById":return i.findObject(String(e[0]));case"getGeometry":{let r=i.getGeometry(String(e[0]),e[1]??{});return r.warning&&this.onConsole("warn",r.warning),r.data}case"updateObject":return i.updateObject(String(e[0]),e[1]??{});case"createObject":return i.createObject(String(e[0]),e[1]??{});case"createCustomMaterial":if(i.createCustomMaterial===void 0)throw new Error("createCustomMaterial: not available on this surface \u2014 custom three.js/TSL materials need the inline HTML-content mode (editor Preview/Play and web exports).");return i.createCustomMaterial(e[0]);case"setMaterial":if(i.setMaterial===void 0)throw new Error("setMaterial: not available on this surface \u2014 custom three.js/TSL materials need the inline HTML-content mode (editor Preview/Play and web exports).");return i.setMaterial(String(e[0]),e[1]);case"cloneObject":return i.cloneObject(String(e[0]),e[1]??{});case"removeObject":return i.removeObject(String(e[0]));case"spawnObject":{let r=i.spawnObject(String(e[0]),e[1]??{});return r.warning&&this.onConsole("warn",r.warning),r.object}case"destroyObject":return i.destroyObject(String(e[0]));case"setInstanceTransforms":{let r=e[1]===null||e[1]===void 0?null:e[1],s=i.setInstanceTransforms(String(e[0]),r);return s<0&&this.onConsole("warn",`spline.setInstanceTransforms: "${String(e[0])}" has no cloner \u2014 make the object a cloner first (its copies are what this drives).`),s}case"emitEvent":case"emitEventReverse":{let r=i.emitEvent(String(e[0]),String(e[1]),t==="emitEventReverse");return r.warning&&this.onConsole("warn",r.warning),r.ok}case"requestRender":return i.requestRender(),!0;case"listenEvent":{let r=String(e[0]);return r==="variableChange"?this.startVariablePolling():this.eventUnsubs.has(r)||this.eventUnsubs.set(r,i.addSplineEventListener(r,s=>{this.onEvent(r,s)})),!0}case"unlistenEvent":{let r=String(e[0]);return r==="variableChange"?this.stopVariablePolling():(this.eventUnsubs.get(r)?.(),this.eventUnsubs.delete(r)),!0}default:throw new Error(`Unknown spline bridge method: ${t}`)}}startVariablePolling(){this.variablePollHandle===null&&(this.lastVariables=this.deps.getVariables(),this.variablePollHandle=window.setInterval(()=>{if(this.disposed)return;let t=this.deps.getVariables(),e=function(i,r){let s=[];for(let n of Object.keys(r))i[n]!==r[n]&&s.push({name:n,value:r[n]});return s}(this.lastVariables??{},t);this.lastVariables=t;for(let i of e)this.onEvent("variableChange",i)},100))}stopVariablePolling(){this.variablePollHandle!==null&&(window.clearInterval(this.variablePollHandle),this.variablePollHandle=null),this.lastVariables=null}}});function qSt(t,e,i,r){return[t[0]*e+t[4]*i+t[8]*r+t[12],t[1]*e+t[5]*i+t[9]*r+t[13],t[2]*e+t[6]*i+t[10]*r+t[14]]}var HSt=W(()=>{}),bpt,$St=W(()=>{}),XSt=W(()=>{f7(),vpt(),bpt=class{constructor(t,e,i){this.iframe=t,this.deps=e,this.onConsole=i,this.disposed=!1,this.handshakeSeen=!1,this.handshakeTimer=null,this.onMessage=r=>{if(this.disposed||r.source!==this.iframe.contentWindow)return;let s=r.data;var n;typeof(n=s)!="object"||n===null||n[kp]!==!0||typeof n.kind!="string"||this.handleMessage(s)},this.host=new m7(e,i,(r,s)=>{this.sendEvent(r,s)})}attach(){window.addEventListener("message",this.onMessage),this.send({[kp]:!0,kind:"ready-ack"}),this.handshakeTimer=window.setTimeout(()=>{this.handshakeTimer=null,!this.handshakeSeen&&!this.disposed&&this.onConsole("warn","The HTML content frame has not initialized (no signal from its scripts yet) \u2014 if the page looks frozen, check for errors in its code.")},6e3)}dispose(){this.disposed=!0,window.removeEventListener("message",this.onMessage),this.host.dispose(),this.handshakeTimer!==null&&(window.clearTimeout(this.handshakeTimer),this.handshakeTimer=null)}handleMessage(t){switch(t.kind){case"ready":this.handshakeSeen=!0,this.send({[kp]:!0,kind:"ready-ack"});break;case"console":this.onConsole(t.level,t.text);break;case"call":{let e;try{e=Promise.resolve(this.host.execute(t.method,t.args))}catch(i){e=Promise.reject(i)}e.then(i=>{this.send({[kp]:!0,kind:"result",id:t.id,ok:!0,value:i,error:void 0})},i=>{let r=i instanceof Error?i.message:String(i);this.send({[kp]:!0,kind:"result",id:t.id,ok:!1,value:void 0,error:r}),this.onConsole("error",r)});break}case"input":this.dispatchInput(t.event)}}send(t){this.iframe.contentWindow?.postMessage(t,"*")}sendEvent(t,e){this.send({[kp]:!0,kind:"event",eventName:t,payload:e})}dispatchInput(t){let e=this.deps.getCanvas();if(!e)return;let i=this.iframe.getBoundingClientRect(),r={bubbles:!0,cancelable:!0,view:window,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey};switch(t.type){case"pointerdown":case"pointermove":case"pointerup":case"pointercancel":e.dispatchEvent(new PointerEvent(t.type,{...r,clientX:(t.x??0)+i.left,clientY:(t.y??0)+i.top,button:t.button,buttons:t.buttons,pointerId:t.pointerId,pointerType:t.pointerType,isPrimary:t.isPrimary,movementX:t.movementX,movementY:t.movementY}));break;case"click":case"dblclick":e.dispatchEvent(new MouseEvent(t.type,{...r,clientX:(t.x??0)+i.left,clientY:(t.y??0)+i.top,button:t.button,buttons:t.buttons}));break;case"wheel":{let s=new WheelEvent("wheel",{...r,clientX:(t.x??0)+i.left,clientY:(t.y??0)+i.top,deltaX:t.deltaX,deltaY:t.deltaY,deltaMode:t.deltaMode});typeof t.wheelDeltaX=="number"&&Object.defineProperty(s,"wheelDeltaX",{value:t.wheelDeltaX}),typeof t.wheelDeltaY=="number"&&Object.defineProperty(s,"wheelDeltaY",{value:t.wheelDeltaY}),e.dispatchEvent(s);break}case"keydown":case"keyup":e.dispatchEvent(new KeyboardEvent(t.type,{...r,key:t.key,code:t.code,repeat:t.repeat}))}}}}),cr=W(()=>{p7(),RSt(),NSt(),DSt(),ISt(),BSt(),VSt(),kSt(),zSt(),LSt(),FSt(),GSt(),f7(),WSt(),vpt(),HSt(),$St(),XSt()}),YSt=W(()=>{});function _pt(t){return Array.isArray(t)?t:[t]}function CR(t,e){let i=0;for(;i<t.length&&i<e.length;){if(t[i]<e[i])return-1;if(t[i]>e[i])return 1;i+=1}return i!==e.length?-1:i!==t.length?1:0}var KSt=W(()=>{});function Xa(t,e){return Object.setPrototypeOf(t,e),t}function pD(t){let e={...t};return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),e}function $p(t,e,i){if(t===void 0?e===void 0?(t=0,e=10):t=e-10:e===void 0&&(e=t+10),t>e){let n=t;t=e,e=n}let r=[],s=1/(i+1);for(let n=0;n<i;n++){let a=t+(e-t)*(n+.75+.5*Math.random())*s;r.push(a)}return r}function g7(t){return t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Uint32Array||t instanceof Int8Array||t instanceof Int16Array||t instanceof Int32Array||t instanceof Float32Array||t instanceof Float64Array}var ZSt=W(()=>{});function y7(t){if(t.deepFreeze!==void 0)return void t.deepFreeze(t);let e=Object.getOwnPropertyNames(t);for(let i of e){let r=t[i];r&&typeof r=="object"&&y7(r)}return Object.freeze(t)}function xpt(t){for(let e of Object.keys(t))t[e]===void 0&&delete t[e];return t}var mD,ER,l8,Ve,v7,QSt=W(()=>{}),oa=W(()=>{YSt(),KSt(),ZSt(),QSt()}),b7=W(()=>{mD=class{},ER=class extends mD{constructor(t){super(),this.id=t}},l8=class extends mD{constructor(t){super(),this.data=t}}}),JSt=W(()=>{}),e5=W(()=>{Ve=class{modifyById(t,e){let i=this;if(i[t]===void 0)throw new Error("not expected");{let r={...i,[t]:e};return Object.setPrototypeOf(r,Ve.prototype),r}}add(t,e){return this.runOp({type:1,id:t,data:e})?.data??this}runOp(t){let e=this;if(t.type===1){let i,r=e[t.id];i=r===void 0?{type:2,id:t.id}:{type:1,id:t.id,data:r};let{id:s,data:n}=t,a={...e,[s]:n};return Object.setPrototypeOf(a,Ve.prototype),{data:a,actual:t,reverse:i}}if(t.type===2){let{id:i}=t,r=e[i];if(r===void 0)return null;{let s={...e};return Object.setPrototypeOf(s,Ve.prototype),delete s[i],{data:s,actual:t,reverse:{type:1,id:i,data:r}}}}return null}}}),_7=W(()=>{v7=class extends Error{}});function wpt(t,e){for(let i of t)e(i.id,i.data)!==!0&&wpt(i.children,e)}function Spt(t,e){if(e(t.id,t.data)!==!0)for(let i of t.children)Spt(i,e)}var Nn,ZT,Nv,fe,t0=W(()=>{oa(),_7(),oa(),Nn=class extends Array{constructor(...t){super(...t),cc(this,"partialObjectCaches"),cc(this,"objCaches"),cc(this,"parentCaches"),Object.setPrototypeOf(this,Nn.prototype)}deepFreeze(){let t=0;for(;t<this.length;)y7(this[t]),t++}fillCaches0(t,e){this.objCaches.set(t.id,t),this.parentCaches.set(t.id,e);for(let i of t.children)this.fillCaches0(i,t.id)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,this.parentCaches=new Map;for(let t of this)this.fillCaches0(t,null)}}randomId(){this.fillCaches();let t=Array.from(this.objCaches.keys());if(t.length!==0)return t[Math.max(0,Math.floor(Math.random()*t.length)-1)]}nonExistOrDescendantOf(t,e){if(!this.has(t))return!0;for(;t;){let i=this.parent(t);if(i===e)return!0;t=i}return!1}rootAcestor(t){for(;t;){let e=this.parent(t);if(!e)return t;t=e}return t}isDescendantOf(t,e){for(;t;){let i=this.parent(t);if(i===e)return!0;t=i}return!1}data(t){return this.get(t)?.data}has(t){return this.childrenOf(t)!==void 0}partialCache(t){this.partialObjectCaches===void 0&&(this.partialObjectCaches=new Map);let e=this.get(t);e!==void 0&&this.partialObjectCaches.set(t,e)}get(t){if(this.partialObjectCaches!==void 0){let e=this.partialObjectCaches.get(t);if(e!==void 0)return e}return this.fillCaches(),this.objCaches.get(t)}childrenOf(t){return t===null?this:this.get(t)?.children}traverseFrom(t,e){if(t===null)this.traverse(e);else{let i=this.get(t);i&&Spt(i,e)}}traverse(t){wpt(this,t)}totalSize(){return this.fillCaches(),this.objCaches.size}parent(t){return this.fillCaches(),this.parentCaches.get(t)}childrenArray(t){return t===null?this:this.get(t).children}modifyById(t,e){if(this.get(t)===void 0)throw new Error("not expected");{let i=this.parent(t),r=this.childrenArray(i),s=r.findIndex(o=>o.id===t);if(s<0)throw new Error("not expected");let n=r[s];r=[...r],r[s]={...n,data:e};let a=new Map;return a.set(t,r[s]),this.modifyArrayBy(i,r,a)}}modifyArrayBy(t,e,i=void 0){let r=t,s=e;for(;r!==null;){let a=s,o=r;if(r=this.parent(r),r===void 0)throw new Error;s=this.childrenArray(r);let l=s.findIndex(u=>u.id===o);if(l<0)throw new Error;s=[...s],s[l]={...s[l],children:a},i&&i.set(o,s[l])}Object.setPrototypeOf(s,Nn.prototype);let n=s;if(i&&this.objCaches!==void 0&&this.parentCaches!==void 0){n.objCaches=this.objCaches;for(let[a,o]of i)n.objCaches.set(a,o);n.parentCaches=this.parentCaches,this.objCaches=void 0,this.parentCaches=void 0}else n.fillCaches();return n}runOp(t){switch(t.type){case 7:return this.addOp(t);case 8:return this.deleteOp(t);case 9:return this.moveOp(t)}return null}checkDuplicatedIdRec({id:t,children:e}){if(this.get(t)!==void 0)return!0;for(let i of e)if(this.checkDuplicatedIdRec(i))return!0;return!1}addOp(t){let{parent:e,fi:i,id:r,data:s,children:n}=t;if(e!==null&&this.get(e)===void 0||this.checkDuplicatedIdRec(t))return null;{let a=e,o=this.childrenArray(a),l={fi:i,id:r,data:s,children:n};return o=[...o,l],o.sort((u,h)=>u.fi-h.fi),t.localIndex=o.indexOf(l),{data:this.modifyArrayBy(a,o),actual:t,reverse:{type:8,id:r}}}}deleteOp(t){let{id:e}=t;if(this.get(e)===null)return null;{let i=this.parent(e);if(i===void 0)return null;let r=this.childrenArray(i),s=r.findIndex(a=>a.id===e);t.localIndex=s,r=[...r];let n=r.splice(s,1)[0];return{data:this.modifyArrayBy(i,r),actual:t,reverse:{type:7,...n,parent:i}}}}moveOp(t){let{parent:e,fi:i,id:r}=t;if(e!==null&&this.get(e)===void 0)return this.deleteOp({type:8,id:r});if(e!==null){let d=e;for(;d!==null;){if(d===void 0)throw new Error;if(d===r)throw new v7("cyclic tree");d=this.parent(d)}}let s=this.parent(r);if(s===void 0)return null;let n=s,a=this.childrenArray(s),o=a.findIndex(d=>d.id===r);a=[...a];let l=a.splice(o,1)[0],u=this.modifyArrayBy(s,a);s=e,a=u.childrenArray(s);let h=l.fi;return l={...l,fi:i},a=[...a,l],a.sort((d,c)=>d.fi-c.fi),t.localIndex=a.indexOf(l),u=u.modifyArrayBy(s,a),{data:u,actual:t,reverse:{type:9,parent:n,fi:h,id:r}}}previous(t,e){if(e===null){let r=this.childrenArray(t);return r.length===0?null:r[r.length-1].id}let i=null;for(let r of this.childrenArray(t)){if(r.id===e)return i;i=r.id}return null}traverseSortNext(t){let e=this.parent(t);if(e!==void 0){let i=this.childrenArray(e),r=i.findIndex(s=>s.id===t)+1;if(r<i.length)return i[r].id;if(e)return this.traverseSortNext(e)}}sortNext(t){let e=this.childrenArray(t);return e.length>0?e[0].id:this.traverseSortNext(t)}traverseSortPrevious(t){let e=this.childrenArray(t);return e.length>0?this.traverseSortPrevious(e[e.length-1].id):t}sortPrevious(t){let e=this.parent(t);if(e!==void 0){let i=this.childrenArray(e),r=i.findIndex(s=>s.id===t)-1;return r>=0?this.traverseSortPrevious(i[r].id):e}}getAllSorted(t){let e=[];for(let i of t){let r=this.getWithSortKey(i.id);r!==void 0&&e.push({...i,...r})}e.sort((i,r)=>CR(i.sortKey,r.sortKey));for(let i of e)delete i.sortKey;return e}getAllIdSorted(t){let e=[];for(let i of t){let r=this.getWithSortKey(i);r!==void 0&&e.push(r)}e.sort((i,r)=>CR(i.sortKey,r.sortKey));for(let i of e)delete i.sortKey;return e.map(i=>i.id)}getWithSortKey(t){let e=t,i=[],r=this.get(e),s=r;if(r!==void 0){for(;e;)i.splice(0,0,r.fi),e=this.parent(e),e!==null&&(r=this.get(e));return{...s,sortKey:i}}}insertBeforeHelper(t,e,i){return this.insertAfterHelper(t,this.previous(t,e),i)}insertAfterHelper(t,e,i){let r=this.childrenArray(t);if(e===null){if(r.length===0)return $p(0,i,i);{let s=r[0].fi;return $p(s-i,s,i)}}{let s=this.get(e);if(s===void 0||this.parent(e)!==t)throw new Error("illegal args");let n=r.find(a=>a.fi>s.fi);if(n===void 0){let a=r[r.length-1].fi;return $p(a,a+i,i)}return $p(s.fi,n.fi,i)}}}}),x7=W(()=>{var t;ZT=null,(t=Nv||(Nv={})).setPreservePrototype=function(e){ZT=e},t.tryPreservePrototype=function(e,i){return Object.getPrototypeOf(e)===ZT&&Object.setPrototypeOf(i,ZT),i},t.runOp=function(e,i){if(i.type!==0)return null;if(Array.isArray(e)){let r=i.props,s={},n=[...e],a=!1;if(r)for(let o of Object.keys(r)){let l=parseInt(o);if(isNaN(l))throw new Error("wrong index");s[o]=n[l],n[l]=r[o],a=!0}return a?{data:n,actual:i,reverse:{type:0,props:s}}:null}{let r=i.props,s={},n={...e},a=!1;if(r)for(let o of Object.keys(r)){s[o]=n[o];let l=r[o];l===void 0?delete n[o]:n[o]=l,a=!0}return a?{data:t.tryPreservePrototype(e,n),actual:i,reverse:{type:0,props:s}}:null}}}),e0=W(()=>{oa(),oa(),fe=class extends Array{constructor(...t){super(...t),cc(this,"objCaches"),Object.setPrototypeOf(this,fe.prototype)}deepFreeze(){let t=0;for(;t<this.length;)y7(this[t]),t++}fillCaches0(t){this.objCaches.set(t.id,t)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,Object.getOwnPropertyDescriptor(this,"objCaches").enumerable=!1;for(let t of this)this.fillCaches0(t)}}randomId(){this.fillCaches();let t=Array.from(this.objCaches.keys());if(t.length!==0)return t[Math.max(0,Math.floor(Math.random()*t.length)-1)]}data(t){return this.get(t)?.data}get(t){return this.fillCaches(),this.objCaches.get(t)}modifyById(t,e){if(this.get(t)===void 0)throw new Error("not expected");{let i=this,r=i.findIndex(n=>n.id===t);if(r<0)throw new Error("not expected");let s=i[r];return i=[...i],i[r]={...s,data:e},this.modifyArrayBy(i)}}modifyArrayBy(t){Object.setPrototypeOf(t,fe.prototype);let e=t;return typeof process<"u"||e.fillCaches(),e}runOp(t){switch(t.type){case 4:return this.addOp(t);case 5:return this.deleteOp(t);case 6:return this.moveOp(t)}return null}addOp(t){let{fi:e,id:i,data:r}=t,s=this,n={fi:e,id:i,data:r};return s=[...s,n],s.sort((a,o)=>a.fi-o.fi),t.localIndex=s.indexOf(n),{data:this.modifyArrayBy(s),actual:t,reverse:{type:5,id:i}}}deleteOp(t){let{id:e}=t,i=this,r=i.findIndex(n=>n.id===e);if(r===-1)return null;t.localIndex=r,i=[...i];let s=i.splice(r,1)[0];return{data:this.modifyArrayBy(i),actual:t,reverse:{type:4,...s}}}moveOp(t){let{fi:e,id:i}=t,r=this;r=[...r];let s=r.findIndex(o=>o.id===i);if(s===-1)return null;let n=r[s].fi,a={...r[s],fi:e};return r[s]=a,r.sort((o,l)=>o.fi-l.fi),t.localIndex=r.indexOf(a),{data:this.modifyArrayBy(r),actual:t,reverse:{type:6,fi:n,id:i}}}previous(t){if(t===null)return this.length===0?null:this[this.length-1].id;let e=null;for(let i of this){if(i.id===t)return e;e=i.id}return null}insertBeforeHelper(t,e){return this.insertAfterHelper(this.previous(t),e)}insertAfterHelper(t,e){let i=this;if(t===null){if(i.length===0)return $p(0,e,e);{let r=i[0].fi;return $p(r-e,r,e)}}{let r=this.get(t);if(r===void 0)throw new Error("illegal args");let s=i.find(n=>n.fi>r.fi);if(s===void 0){let n=i[i.length-1].fi;return $p(n,n+e,e)}return $p(r.fi,s.fi,e)}}}});function tTt(t,e){let i={cur:[],result:[],len:0};return[t=nv(t,e,i)??t,i.result]}function oP(t,e){return t===null?null:(t.cur[t.len]=e,t.len+=1,t)}function lP(t){t&&(t.len-=1)}function Tpt(t,e,i){let r=!1,s=t.map(n=>{let a=n.id,o=e[a];if(o!==void 0&&typeof o=="string"&&(r=!0,a=o,i!==null))throw new Error("not supported");let l=nv(n.data,e,oP(i,a));lP(i),r=r||l!==void 0,l===void 0&&(l=n.data);let u=Tpt(n.children,e,i);return u!==void 0?r=!0:u=n.children,{...n,id:a,data:l,children:u}});if(r)return s}function nv(t,e,i){if(t instanceof Nn){let r=Tpt(t,e,i);return r!==void 0&&Object.setPrototypeOf(r,Object.getPrototypeOf(t)),r}if(t instanceof fe)return function(r,s,n){let a=!1,o=r.map(l=>{let u=l.id,h=s[u];if(h!==void 0&&typeof h=="string"&&(a=!0,u=h,n!==null))throw new Error("not supported");let d=nv(l.data,s,oP(n,u));return lP(n),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}(t,e,i);if(Array.isArray(t)){let r=!1,s=t.map((n,a)=>{let o=nv(n,e,oP(i,a));return lP(i),r=r||o!==void 0,o===void 0&&(o=n),o});return r?(Object.setPrototypeOf(s,Object.getPrototypeOf(t)),s):void 0}if(t&&typeof t=="object"&&!g7(t)){let r={},s=!1;for(let[n,a]of Object.entries(t))if(n!=="name"&&n!=="variableId"){let o=e[n];if(typeof o=="string"){if(i!==null)throw new Error("not supported");s=!0,n=o}let l=nv(a,e,oP(i,n));lP(i),s=s||l!==void 0,l===void 0&&(l=a),r[n]=l}else r[n]=a;return s?(Object.setPrototypeOf(r,Object.getPrototypeOf(t)),r):void 0}if(typeof t=="string"){let r=e[t];return r!==void 0&&function(s){if(s===null)return null;s.result.push(s.cur.slice(0,s.len))}(i),r}}var Mpt=W(()=>{t0(),e0(),oa()});function av(t){return t&&typeof t=="object"&&t instanceof $s}function w7(t,e){if(e===void 0)return;let i=!1,r=t.map(s=>{let n=s.id,a=I2(s.data,e[n]);if(i=i||a!==void 0,a===void 0&&(a=s.data),s.children){let o=w7(s.children,e);return o!==void 0?i=!0:o=s.children,{...s,id:n,data:a,children:o}}return{...s,id:n,data:a}});return i?r:void 0}function I2(t,e){if(!av(e))return e;if(t instanceof Nn){let i=w7(t,e);return i!==void 0&&Object.setPrototypeOf(i,Object.getPrototypeOf(t)),i}if(t instanceof fe)return function(i,r){if(r===void 0)return;let s=!1,n=i.map(a=>{let o=a.id,l=I2(a.data,r[o]);return s=s||l!==void 0,l===void 0&&(l=a.data),{...a,id:o,data:l}});return s?(Object.setPrototypeOf(n,Object.getPrototypeOf(i)),n):void 0}(t,e);if(Array.isArray(t)){let i=!1,r=t.map((s,n)=>{let a=I2(s,e[n]);return i=i||a!==void 0,a===void 0&&(a=s),a});return i?(Object.setPrototypeOf(r,Object.getPrototypeOf(t)),r):void 0}if(t instanceof $s)return S7(t,e);if(t&&typeof t=="object"){let i={},r=!1;for(let[s,n]of Object.entries(t)){let a=I2(n,e[s]);r=r||a!==void 0,a===void 0&&(a=n),i[s]=a}return r?(Object.setPrototypeOf(i,Object.getPrototypeOf(t)),i):void 0}}function S7(t,e){if(t===void 0)return e;if(e===void 0)return t;if(!av(e))return e;if(!av(t))return nm.apply(t,e);let i=new Set;for(let s of Object.keys(t))i.add(s);for(let s of Object.keys(e))i.add(s);let r=new $s;for(let s of i){let n=S7(t===void 0?void 0:t[s],e===void 0?void 0:e[s]);r[s]=n}return r}var $s,nm,PR,Qn,YH,T7=W(()=>{var t;t0(),e0(),s5(),oa(),$s=class{unusedFunOverridesTable(e){}runOp(e){let i=[],r=this,s=0,n={};for(;s<e.path.length;){if(i.push(r),r=r===void 0?void 0:r[e.path[s]],r!==void 0&&!av(r))return null;s+=1}r=r?pD(r):new $s;for(let[a,o]of Object.entries(e.props)){let l=r[a];n[a]=l,o===void 0?delete r[a]:r[a]=o}for(;s>0;){if(Object.keys(r).length===0){let a=i[s-1];a&&(r=pD(a),delete r[e.path[s-1]])}else{let a=i[s-1];if(a){let o=pD(a);o[e.path[s-1]]=r,r=o}else{let o=new $s;o[e.path[s-1]]=r,r=o}}s-=1}return{data:Object.setPrototypeOf(r,$s.prototype),actual:e,reverse:{...e,props:n}}}},(t=nm||(nm={})).apply=function(e,i){return I2(e,i)??e},t.merge=function(e,i){return S7(e,i)},t.filterOp=function(e,i){let r=0,s=i.path,n=e;for(;r<s.length&&n!==void 0;){if(n=En.zoomOnce(n,s[r]),n===void 0)return i;if(!av(n))return;r+=1}if(n===void 0)return i;if(av(n)){if(i.type===0){let a={...i.props};for(let o of Object.keys(n))delete a[o];return{...i,props:a}}if(i.type===1||i.type===4||i.type===7){let a=w7([i],n);return a?a[0]:i}return i}}}),eTt=W(()=>{s5(),e5(),t0(),_7(),x7(),e0(),Mpt(),T7(),(PR||(PR={})).replaceProps=function(t,e){let i=En.zoom(e,t.path);if(typeof i=="object"){let r={};for(let s of Object.keys(t.props))r[s]=i[s];return{...t,props:r}}return{...t,props:{}}},(t=>{function e(s,n){let a=n.path,o=[];for(;;){let l;if(s instanceof $s&&n.type===0&&(l=s.runOp({...n,path:a.slice(o.length)}),l===null&&(l=void 0)),l===void 0&&o.length===a.length&&(l=s instanceof Nn||s instanceof fe||s instanceof Ve?s.runOp(n):Nv.runOp(s,n)),l!==void 0){if(l!==null){let d=l.data;for(let c=o.length-1;c>=0;c--){let p=a[c],m=o[c];if(m instanceof Nn){if(typeof p=="number")throw new Error("illegal arg");d=m.modifyById(p,d)}else if(m instanceof fe){if(typeof p=="number")throw new Error("illegal arg");d=m.modifyById(p,d)}else if(m instanceof Ve){if(typeof p=="number")throw new Error("illegal arg");d=m.modifyById(p,d)}else if(m instanceof $s){let f={...m,[p]:d};d=Object.setPrototypeOf(f,$s.prototype)}else{if(typeof m!="object")return null;if(Array.isArray(m)){if(typeof p=="string"&&(p=parseInt(p),isNaN(p)))throw new Error("Invalid path");let f=d;d=[...m],d[p]=f}else d=Nv.tryPreservePrototype(m,{...m,[p]:d})}}return{data:d,actual:{...l.actual,path:a},reverse:{...l.reverse,path:a}}}return null}let u,h=a[o.length];if(s instanceof Nn){if(typeof h=="number")throw new Error("");u=s.get(h)?.data}else if(s instanceof fe){if(typeof h=="number")throw new Error("");u=s.get(h)?.data}else s!==null&&(u=s[h]);if(u===void 0)return null;o.push(s),s=u}}function i(s,n){for(let a=0;a<s.length&&a<n.length;a++)if(s[a]!==n[a])return!0;return!1}function r(s,n){if(s.length!==n.length)return!1;for(let a=0;a<s.length;a++)if(s[a]!==n[a])return!1;return!0}t.drop=function(s,n){return{...s,path:s.path.slice(n)}},t.applySimple=function(s,n){return e(s,n)?.data??s},t.apply=e,t.pathDisjoint=i,t.pathEq=r,t.commutative=function(s,n){return i(s.path,n.path)},t.subsumed=function(s,n){return!(s.type!==0||n.type!==0||!r(s.path,n.path))&&Object.keys(s.props).every(a=>n.props[a]!==void 0)}})(Qn||(Qn={})),(t=>{function e(i,r){let s=i,n=[],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=En.zoom(s,[...o.path,o.id]),h=Qn.apply(s,{...o,type:2})):(l=En.zoom(s,[...o.path,o.id,"value"]),h=Qn.apply(s,o)),h!==null){s=h.data;let[d,c]=tTt(s,{[o.id]:l});s=d;for(let p=0;p<c.length;p++){let m=c[p],f=m.pop();if(typeof f=="number"){let g=[f];for(let v=p+1;v<c.length;v++){let b=c[v],_=b[b.length-1];if(typeof _!="number"||!En.equal(m,b.slice(0,b.length-1)))break;g.push(_),c.splice(v,1)}let y=En.zoom(s,m);u=y.map((v,b)=>g.includes(b)?o.id:v),l=y,f=m.pop()}else{if(f==="alphaOverride"||f==="alpha"){l/=100;let g=l,y=En.zoom(s,m.slice(0,m.length-2)),v=y.layers.map(b=>b.id===m[m.length-1]?{...b,data:{...b.data,[f]:g}}:b);Object.setPrototypeOf(v,Object.getPrototypeOf(y.layers)),y.layers=v}u=o.id}n.push({type:0,path:m,props:{[f]:l}}),a.push({type:0,path:m,props:{[f]:u}})}a.push(h.reverse),n.push(h.actual)}}else{let l=Qn.apply(s,o);l!==null&&(n.push(l.actual),s=l.data,a.push(l.reverse))}}catch(l){if(l instanceof v7)return null;throw l}return{data:s,actual:n,reverse:a.reverse()}}t.empty=function(){return[]},t.removePrefix=function(i,r){let s=[];for(let n of i){let[a,...o]=n.path;a===r&&s.push({...n,path:o})}return s},t.addPrefix=function(i,r){return i.map(s=>({...s,path:[r,...s.path]}))},t.concat=function(i,r){return[...i,...r]},t.compress=function(i,r){return[...i.filter(s=>!r.some(n=>Qn.subsumed(s,n))),...r]},t.commutative=function(i,r){return i.every(s=>r.every(n=>Qn.commutative(s,n)))},t.applyAll=function(i,r){for(let s of r){let n=e(i,s);n!==null&&(i=n.data)}return i},t.apply=e})(YH||(YH={}))});function fD(t,e,i){if(t.length>0){let r=t[t.length-1];if(r.type===0&&e.type===0&&En.equal(r.path,i))return void Object.assign(r.props,e.props)}t.push({...e,path:i})}function hP(t,e,i){return i instanceof Nn?new i5(t,e,i):i instanceof fe?new r5(t,e,i):i instanceof Ve?new Proxy(new Cpt(t,e,i),Ppt):i!==null&&typeof i=="object"?g7(i)?i:new Proxy(new Apt(t,e,i),Ept):i}function Bw(t){let e=new u8(t);return[hP(e,"",t),e]}function RR(t,e){let[i,r]=Bw(t);return e(i),r.result()}function js(t){return t instanceof i5||t instanceof r5?t._current:t!==null&&typeof t=="object"?t[h8]:t}var h8,KH,Kb,O0,Apt,Cpt,gD,Ept,Ppt,i5,r5,u8,En,Rpt=W(()=>{e5(),t0(),x7(),e0(),oa(),s5(),h8=Symbol(),KH=Symbol(),Kb=Symbol(),O0=class{reportOp(t,e,i=[]){let r=this;if(e===null)return;r._current=e.data;let s=i;for(;!(r instanceof u8);){let n=r._path,a=r._current;if(n!==""&&s.splice(0,0,n),r=r._parent,r===null)return;r.update(n,a)}r.push(s,t,e.actual,e.reverse)}deleteChildren(t){if(this._children){let e=this._children[t];if(e){let i=e[Kb];i&&i(),delete this._children[t]}}}},Apt=class extends O0{constructor(t,e,i){super(),this._parent=t,this._path=e,this._current=i}update(t,e){if(Array.isArray(this._current)){if(typeof t=="string"&&(t=parseInt(t),isNaN(t)))throw new Error("Invalid path");this._current=[...this._current],this._current[t]=e}else this._current=Nv.tryPreservePrototype(this._current,{...this._current,[t]:e})}runOp(t){this.reportOp(t,Nv.runOp(this._current,t),t.path)}},Cpt=class extends O0{constructor(t,e,i){super(),this._parent=t,this._path=e,this._current=i}update(t,e){this._current={...this._current,[t]:e},Object.setPrototypeOf(this._current,Ve.prototype)}runOp(t){this.reportOp(t,this._current.runOp(t))}},gD={get(t,e){if(e===Kb)return()=>{t._parent=null};if(e===h8)return t._current;if(e===KH)return t;let{_current:i,_children:r}=t;if(e==="push"&&Array.isArray(i))throw new Error("not supported to expand array");let s=r===void 0?void 0:r[e];if(s!==void 0)return s;let n=i[e],a=hP(t,e,n);return a!==n?(r===void 0&&(r={},t._children=r),r[e]=a,a):n},has:(t,e)=>e in t._current,ownKeys:t=>Reflect.ownKeys(t._current),defineProperty(){throw Error("not supported")},getPrototypeOf:t=>Object.getPrototypeOf(t._current),setPrototypeOf(){throw Error("not supported")},getOwnPropertyDescriptor(t,e){let i=t._current,r=Reflect.getOwnPropertyDescriptor(i,e);return r&&{writable:!0,configurable:!0,enumerable:r.enumerable,value:i[e]}}},Ept={...gD,set(t,e,i){let r={type:0,props:{[e]:js(i)??i}};return t.deleteChildren(e),t.runOp(r),!0},deleteProperty(t,e){let i={type:0,props:{[e]:void 0}};return t.deleteChildren(e),t.runOp(i),!0}},Ppt={...gD,set(t,e,i){return i===void 0?this.deleteProperty(t,e):(t.deleteChildren(e),t.runOp({type:1,id:e,data:i})),!0},deleteProperty:(t,e)=>(t.runOp({type:2,id:e}),!0)},i5=class extends O0{constructor(t,e,i){super(),this._children={},this._parent=t,this._path=e,this._current=i,this[Kb]=()=>{this._parent=null}}unproxy(){return this._current}update(t,e){this._current=this._current.modifyById(t,e)}runOp(t){this.reportOp(t,this._current.runOp(t))}randomId(){return this._current.randomId()}isDescendantOf(t,e){return this._current.isDescendantOf(t,e)}childrenOf(t){return this._current.childrenOf(t)}get(t){return this._current.get(t)}parent(t){return this._current.parent(t)}traverse(t){this._current.traverse((e,i)=>{t(e,this.data(e))})}data(t){let{_current:e,_children:i}=this,r=i===void 0?void 0:i[t];if(r!==void 0)return r;let s=e.get(t)?.data,n=hP(this,t,s);return n!==s?(i===void 0&&(i={},this._children=i),i[t]=n,n):s}add(t,e,i,r,s){this.runOp({type:7,parent:t,fi:e,id:i,data:r,children:s})}move(t,e,i){this.runOp({type:9,parent:t,fi:e,id:i})}insertAfter(t,e,i){let r=this._current.insertAfterHelper(t,e,i.length);for(let s=0;s<i.length;s++){let n=i[s];this.add(t,r[s],n.id,n.data,n.children)}}insertBefore(t,e,i){let r=this._current.insertBeforeHelper(t,e,i.length);for(let s=0;s<i.length;s++){let n=i[s];this.add(t,r[s],n.id,n.data,n.children)}}moveAfter(t,e,i){let r=this._current.insertAfterHelper(t,e,i.length);for(let s=0;s<i.length;s++){let n=i[s];this.move(t,r[s],n)}}moveBefore(t,e,i){let r=this._current.insertBeforeHelper(t,e,i.length);for(let s=0;s<i.length;s++){let n=i[s];this.move(t,r[s],n)}}delete(t){this.deleteChildren(t),this.runOp({type:8,id:t})}sortNext(t){return this._current.sortNext(t)}sortPrevious(t){return this._current.sortPrevious(t)}getAllSorted(t){return this._current.getAllSorted(t)}},r5=class extends O0{constructor(t,e,i){super(),this._children={},this._parent=t,this._path=e,this._current=i,this[Kb]=()=>{this._parent=null}}unproxy(){return this._current}get length(){return this._current.length}forEach(t){let e=this.length;for(let i=0;i<e;i++){let r=this._current[i].id,s=this._current[i].fi;t(this.data(this._current[i].id),r,s,i)}}find(t){let e=this.length;for(let i=0;i<e;i++){let r=this._current[i].id;if(t(this.data(r),r))return this.get(r)}}update(t,e){this._current=this._current.modifyById(t,e)}randomId(){return this._current.randomId()}get(t){return{...this._current.get(t),data:this.data(t)}}at(t){let{id:e,fi:i}=this._current.at(t);return{id:e,fi:i,data:this.data(e)}}data(t){let{_current:e,_children:i}=this,r=i===void 0?void 0:i[t];if(r!==void 0)return r;let s=e.get(t)?.data,n=hP(this,t,s);return n!==s?(i===void 0&&(i={},this._children=i),i[t]=n,n):s}runOp(t){this.reportOp(t,this._current.runOp(t))}add(t,e,i){this.runOp({type:4,fi:t,id:e,data:i})}move(t,e){this.runOp({type:6,fi:t,id:e})}insertAfter(t,e){let i=this._current.insertAfterHelper(t,e.length);for(let r=0;r<e.length;r++){let s=e[r];this.add(i[r],s.id,s.data)}}insertBefore(t,e){let i=this._current.insertBeforeHelper(t,e.length);for(let r=0;r<e.length;r++){let s=e[r];this.add(i[r],s.id,s.data)}}moveAfter(t,e){let i=this._current.insertAfterHelper(t,e.length);for(let r=0;r<e.length;r++){let s=e[r];this.move(i[r],s)}}moveBefore(t,e){let i=this._current.insertBeforeHelper(t,e.length);for(let r=0;r<e.length;r++){let s=e[r];this.move(i[r],s)}}delete(t){this.deleteChildren(t),this.runOp({type:5,id:t})}},u8=class extends O0{constructor(t){super(),this.ts=[],this.actual=[],this.reverse=[],this._current=t}update(t,e){if(t!=="")throw new Error("");this._current=e}push(t,e,i,r){fD(this.ts,e,t),fD(this.actual,i,t),fD(this.reverse,r,t)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}}}),s5=W(()=>{b7(),Rpt(),e0(),t0(),oa(),(t=>{function e(r,s){return(r instanceof Nn||r instanceof i5)&&typeof s=="string"||(r instanceof fe||r instanceof r5)&&typeof s=="string"?r.data(s):typeof s=="number"&&Array.isArray(r)||typeof s=="string"&&typeof r=="object"&&r!==null?r[s]:void 0}function i(r,s,n=0){for(;n<s.length&&r!==void 0;)r=e(r,s[n]),n+=1;return r}t.equal=function(r,s){if(s.length!==r.length)return!1;{let n=0;for(;n<r.length;){if(r[n]!==s[n])return!1;n+=1}}return!0},t.removeOverridden=function(r,s,n){let a=i(n,r);if(a!==void 0&&typeof a=="object"&&a!==null){let o={...s};return Object.keys(a).forEach(l=>{delete o[l]}),o}return s},t.zoomOnce=e,t.zoom=i,t.findPathes=function(r,s){let n=[];return function a(o,l){if(o instanceof ER&&o.id===s.id)n.push(l);else if(o instanceof fe)for(let u=0;u<o.length;u++)a(o[u].data,[...l,o[u].id]);else if(o instanceof Nn)o.traverse((u,h)=>{a(u,[...l,h])});else if(Array.isArray(o))for(let u=0;u<o.length;u++)a(o[u],[...l,u]);else{if(g7(o))return;if(typeof o=="object"&&o!==null)for(let u in o)a(o[u],[...l,u])}}(r,[]),n}})(En||(En={}))}),iTt=W(()=>{});function tr(t,e){let i=[];if(!(e.length<=t.length))return null;{let r=0;for(;r<e.length;){if(e[r]==="*")i.push(t[r]);else if(t[r]!==e[r])return null;r+=1}}return i}var rTt=W(()=>{});function QT(t){try{if(!Rr.trusted&&!fc){let i=Wi.sharedLength||0;i<Wi.length&&(Wi.length=i)}let e;if(Rr.randomAccessStructure&&pe[bt]<64&&pe[bt]>=32&&i$?(e=i$(pe,bt,Zl,Rr),pe=null,!(t&&t.lazy)&&e&&(e=e.toJSON()),bt=Zl):e=Hs(),Na&&(bt=Na.postBundlePosition,Na=null),fc&&(Wi.restoreStructures=null),bt==Zl)Wi&&Wi.restoreStructures&&ZH(),Wi=null,pe=null,mc&&(mc=null);else{if(bt>Zl)throw new Error("Unexpected end of MessagePack data");if(!fc){let i;try{i=JSON.stringify(e,(r,s)=>typeof s=="bigint"?`${s}n`:s).slice(0,100)}catch(r){i="(JSON view not available "+r+")"}throw new Error("Data read, but end of buffer not reached "+i)}}return e}catch(e){throw Wi&&Wi.restoreStructures&&ZH(),c8(),(e instanceof RangeError||e.message.startsWith("Unexpected end of buffer")||bt>Zl)&&(e.incomplete=!0),e}}function ZH(){for(let t in Wi.restoreStructures)Wi[t]=Wi.restoreStructures[t];Wi.restoreStructures=null}function Hs(){let t=pe[bt++];if(t<160){if(t<128){if(t<64)return t;{let e=Wi[63&t]||Rr.getStructures&&Npt()[63&t];return e?(e.read||(e.read=d8(e,63&t)),e.read()):t}}if(t<144){if(t-=128,Rr.mapsAsObjects){let e={};for(let i=0;i<t;i++){let r=Opt();r==="__proto__"&&(r="__proto_"),e[r]=Hs()}return e}{let e=new Map;for(let i=0;i<t;i++)e.set(Hs(),Hs());return e}}{t-=144;let e=new Array(t);for(let i=0;i<t;i++)e[i]=Hs();return Rr.freezeData?Object.freeze(e):e}}if(t<192){let e=t-160;if(Gh>=bt)return Xp.slice(bt-pl,(bt+=e)-pl);if(Gh==0&&Zl<140){let i=e<16?M7(e):Dpt(e);if(i!=null)return i}return OR(e)}{let e;switch(t){case 192:return null;case 193:return Na?(e=Hs(),e>0?Na[1].slice(Na.position1,Na.position1+=e):Na[0].slice(Na.position0,Na.position0-=e)):Vpt;case 194:return!1;case 195:return!0;case 196:if(e=pe[bt++],e===void 0)throw new Error("Unexpected end of buffer");return yD(e);case 197:return e=zi.getUint16(bt),bt+=2,yD(e);case 198:return e=zi.getUint32(bt),bt+=4,yD(e);case 199:return Km(pe[bt++]);case 200:return e=zi.getUint16(bt),bt+=2,Km(e);case 201:return e=zi.getUint32(bt),bt+=4,Km(e);case 202:if(e=zi.getFloat32(bt),Rr.useFloat32>2){let i=v8[(127&pe[bt])<<1|pe[bt+1]>>7];return bt+=4,(i*e+(e>0?.5:-.5)|0)/i}return bt+=4,e;case 203:return e=zi.getFloat64(bt),bt+=8,e;case 204:return pe[bt++];case 205:return e=zi.getUint16(bt),bt+=2,e;case 206:return e=zi.getUint32(bt),bt+=4,e;case 207:return Rr.int64AsType==="number"?(e=4294967296*zi.getUint32(bt),e+=zi.getUint32(bt+4)):Rr.int64AsType==="string"?e=zi.getBigUint64(bt).toString():Rr.int64AsType==="auto"?(e=zi.getBigUint64(bt),e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=zi.getBigUint64(bt),bt+=8,e;case 208:return zi.getInt8(bt++);case 209:return e=zi.getInt16(bt),bt+=2,e;case 210:return e=zi.getInt32(bt),bt+=4,e;case 211:return Rr.int64AsType==="number"?(e=4294967296*zi.getInt32(bt),e+=zi.getUint32(bt+4)):Rr.int64AsType==="string"?e=zi.getBigInt64(bt).toString():Rr.int64AsType==="auto"?(e=zi.getBigInt64(bt),e>=BigInt(-2)<<BigInt(52)&&e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=zi.getBigInt64(bt),bt+=8,e;case 212:if(e=pe[bt++],e==114)return y8(63&pe[bt++]);{let i=Ma[e];if(i)return i.read?(bt++,i.read(Hs())):i.noBuffer?(bt++,i()):i(pe.subarray(bt,++bt));throw new Error("Unknown extension "+e)}case 213:return e=pe[bt],e==114?(bt++,y8(63&pe[bt++],pe[bt++])):Km(2);case 214:return Km(4);case 215:return Km(8);case 216:return Km(16);case 217:return e=pe[bt++],Gh>=bt?Xp.slice(bt-pl,(bt+=e)-pl):zpt(e);case 218:return e=zi.getUint16(bt),Gh>=(bt+=2)?Xp.slice(bt-pl,(bt+=e)-pl):Lpt(e);case 219:return e=zi.getUint32(bt),Gh>=(bt+=4)?Xp.slice(bt-pl,(bt+=e)-pl):Fpt(e);case 220:return e=zi.getUint16(bt),bt+=2,QH(e);case 221:return e=zi.getUint32(bt),bt+=4,QH(e);case 222:return e=zi.getUint16(bt),bt+=2,JH(e);case 223:return e=zi.getUint32(bt),bt+=4,JH(e);default:if(t>=224)return t-256;if(t===void 0){let i=new Error("Unexpected end of MessagePack data");throw i.incomplete=!0,i}throw new Error("Unknown MessagePack token "+t)}}}function d8(t,e){function i(){if(i.count++>m8){let s;try{s=t.read=new Function("r","return function(){return "+(Rr.freezeData?"Object.freeze":"")+"({"+t.map(n=>n==="__proto__"?"__proto_:r()":kpt.test(n)?n+":r()":"["+JSON.stringify(n)+"]:r()").join(",")+"})}")(Hs)}catch{return m8=1/0,i()}return t.read0=s,t.highByte===0&&(t.read=f8(e,t.read)),s()}let r={};for(let s=0,n=t.length;s<n;s++){let a=t[s];a==="__proto__"&&(a="__proto_"),r[a]=Hs()}return Rr.freezeData?Object.freeze(r):r}return i.count=0,t.read0=i,t.highByte===0?f8(e,i):i}function Npt(){let t=Bpt(()=>(pe=null,Rr.getStructures()));return Wi=Rr._mergeStructures(t,Wi)}function Vw(t){let e;if(t<16&&(e=M7(t)))return e;if(t>64&&p8)return p8.decode(pe.subarray(bt,bt+=t));let i=bt+t,r=[];for(e="";bt<i;){let s=pe[bt++];if(128&s)if((224&s)==192){let n=(31&s)<<6|63&pe[bt++];n<128?r.push(65533):r.push(n)}else if((240&s)==224){let n=(31&s)<<12|(63&pe[bt++])<<6|63&pe[bt++];n<2048||n>=55296&&n<=57343?r.push(65533):r.push(n)}else if((248&s)==240){let n=(7&s)<<18|(63&pe[bt++])<<12|(63&pe[bt++])<<6|63&pe[bt++];n<65536||n>1114111?r.push(65533):(n>65535&&(n-=65536,r.push(n>>>10&1023|55296),n=56320|1023&n),r.push(n))}else r.push(65533);else r.push(s);r.length>=4096&&(e+=wn.apply(String,r),r.length=0)}return r.length>0&&(e+=wn.apply(String,r)),e}function QH(t){let e=new Array(t);for(let i=0;i<t;i++)e[i]=Hs();return Rr.freezeData?Object.freeze(e):e}function JH(t){if(Rr.mapsAsObjects){let e={};for(let i=0;i<t;i++){let r=Opt();r==="__proto__"&&(r="__proto_"),e[r]=Hs()}return e}{let e=new Map;for(let i=0;i<t;i++)e.set(Hs(),Hs());return e}}function Dpt(t){let e=bt,i=new Array(t);for(let r=0;r<t;r++){let s=pe[bt++];if((128&s)>0)return void(bt=e);i[r]=s}return wn.apply(String,i)}function M7(t){if(t<4){if(t<2){if(t===0)return"";{let e=pe[bt++];return(128&e)>1?void(bt-=1):wn(e)}}{let e=pe[bt++],i=pe[bt++];if((128&e)>0||(128&i)>0)return void(bt-=2);if(t<3)return wn(e,i);let r=pe[bt++];return(128&r)>0?void(bt-=3):wn(e,i,r)}}{let e=pe[bt++],i=pe[bt++],r=pe[bt++],s=pe[bt++];if((128&e)>0||(128&i)>0||(128&r)>0||(128&s)>0)return void(bt-=4);if(t<6){if(t===4)return wn(e,i,r,s);{let n=pe[bt++];return(128&n)>0?void(bt-=5):wn(e,i,r,s,n)}}if(t<8){let n=pe[bt++],a=pe[bt++];if((128&n)>0||(128&a)>0)return void(bt-=6);if(t<7)return wn(e,i,r,s,n,a);let o=pe[bt++];return(128&o)>0?void(bt-=7):wn(e,i,r,s,n,a,o)}{let n=pe[bt++],a=pe[bt++],o=pe[bt++],l=pe[bt++];if((128&n)>0||(128&a)>0||(128&o)>0||(128&l)>0)return void(bt-=8);if(t<10){if(t===8)return wn(e,i,r,s,n,a,o,l);{let u=pe[bt++];return(128&u)>0?void(bt-=9):wn(e,i,r,s,n,a,o,l,u)}}if(t<12){let u=pe[bt++],h=pe[bt++];if((128&u)>0||(128&h)>0)return void(bt-=10);if(t<11)return wn(e,i,r,s,n,a,o,l,u,h);let d=pe[bt++];return(128&d)>0?void(bt-=11):wn(e,i,r,s,n,a,o,l,u,h,d)}{let u=pe[bt++],h=pe[bt++],d=pe[bt++],c=pe[bt++];if((128&u)>0||(128&h)>0||(128&d)>0||(128&c)>0)return void(bt-=12);if(t<14){if(t===12)return wn(e,i,r,s,n,a,o,l,u,h,d,c);{let p=pe[bt++];return(128&p)>0?void(bt-=13):wn(e,i,r,s,n,a,o,l,u,h,d,c,p)}}{let p=pe[bt++],m=pe[bt++];if((128&p)>0||(128&m)>0)return void(bt-=14);if(t<15)return wn(e,i,r,s,n,a,o,l,u,h,d,c,p,m);let f=pe[bt++];return(128&f)>0?void(bt-=15):wn(e,i,r,s,n,a,o,l,u,h,d,c,p,m,f)}}}}}function t$(){let t,e=pe[bt++];if(e<192)t=e-160;else switch(e){case 217:t=pe[bt++];break;case 218:t=zi.getUint16(bt),bt+=2;break;case 219:t=zi.getUint32(bt),bt+=4;break;default:throw new Error("Expected string")}return Vw(t)}function yD(t){return Rr.copyBuffers?Uint8Array.prototype.slice.call(pe,bt,bt+=t):pe.subarray(bt,bt+=t)}function Km(t){let e=pe[bt++];if(Ma[e]){let i;return Ma[e](pe.subarray(bt,i=bt+=t),r=>{bt=r;try{return Hs()}finally{bt=i}})}throw new Error("Unknown extension type "+e)}function Opt(){let t=pe[bt++];if(!(t>=160&&t<192))return bt--,Ipt(Hs());if(t-=160,Gh>=bt)return Xp.slice(bt-pl,(bt+=t)-pl);if(!(Gh==0&&Zl<180))return OR(t);let e,i=4095&(t<<5^(t>1?zi.getUint16(bt):t>0?pe[bt]:0)),r=g8[i],s=bt,n=bt+t-3,a=0;if(r&&r.bytes==t){for(;s<n;){if(e=zi.getUint32(s),e!=r[a++]){s=1879048192;break}s+=4}for(n+=3;s<n;)if(e=pe[s++],e!=r[a++]){s=1879048192;break}if(s===n)return bt=s,r.string;n-=3,s=bt}for(r=[],g8[i]=r,r.bytes=t;s<n;)e=zi.getUint32(s),r.push(e),s+=4;for(n+=3;s<n;)e=pe[s++],r.push(e);let o=t<16?M7(t):Dpt(t);return r.string=o??OR(t)}function Ipt(t){if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean"||typeof t=="bigint")return t.toString();if(t==null)return t+"";if(Rr.allowArraysInMapKeys&&Array.isArray(t)&&t.flat().every(e=>["string","number","boolean","bigint"].includes(typeof e)))return t.flat().toString();throw new Error("Invalid property type for record: "+typeof t)}function Bpt(t){r$&&r$();let e=Zl,i=bt,r=DR,s=pl,n=Gh,a=Xp,o=NR,l=mc,u=Na,h=new Uint8Array(pe.slice(0,Zl)),d=Wi,c=Wi.slice(0,Wi.length),p=Rr,m=fc,f=t();return Zl=e,bt=i,DR=r,pl=s,Gh=n,Xp=a,NR=o,mc=l,Na=u,pe=h,fc=m,(Wi=d).splice(0,Wi.length,...c),Rr=p,zi=new DataView(pe.buffer,pe.byteOffset,pe.byteLength),f}function c8(){pe=null,mc=null,Wi=null}function sTt(t){t.unpack?Ma[t.type]=t.unpack:Ma[t.type]=t}var p8,pe,Zl,bt,e$,NR,DR,Rr,Wi,Xp,pl,Gh,Na,mc,Ma,zi,vD,Vpt,fc,m8,i$,r$,kw,kpt,f8,OR,zpt,Lpt,Fpt,wn,g8,y8,bD,s$,n$,a$,v8,JT,o$,l$,h$,b8,_D,mS,nTt=W(()=>{try{p8=new TextDecoder}catch{}bt=0,NR=e$=[],DR=0,Rr={},pl=0,Gh=0,Ma=[],vD={useRecords:!1,mapsAsObjects:!0},(Vpt=new class{}).name="MessagePack 0xC1",fc=!1,m8=2,kw=class{constructor(t){t&&(t.useRecords===!1&&t.mapsAsObjects===void 0&&(t.mapsAsObjects=!0),t.sequential&&t.trusted!==!1&&(t.trusted=!0,!t.structures&&t.useRecords!=0&&(t.structures=[],t.maxSharedStructures||(t.maxSharedStructures=0))),t.structures?t.structures.sharedLength=t.structures.length:t.getStructures&&((t.structures=[]).uninitialized=!0,t.structures.sharedLength=0),t.int64AsNumber&&(t.int64AsType="number")),Object.assign(this,t)}unpack(t,e){if(pe)return Bpt(()=>(c8(),this?this.unpack(t,e):kw.prototype.unpack.call(vD,t,e)));!t.buffer&&t.constructor===ArrayBuffer&&(t=typeof Buffer<"u"?Buffer.from(t):new Uint8Array(t)),typeof e=="object"?(Zl=e.end||t.length,bt=e.start||0):(bt=0,Zl=e>-1?e:t.length),DR=0,Gh=0,Xp=null,NR=e$,Na=null,pe=t;try{zi=t.dataView||(t.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength))}catch(i){throw pe=null,t instanceof Uint8Array?i:new Error("Source must be a Uint8Array or Buffer but was a "+(t&&typeof t=="object"?t.constructor.name:typeof t))}if(this instanceof kw){if(Rr=this,this.structures)return Wi=this.structures,QT(e);(!Wi||Wi.length>0)&&(Wi=[])}else Rr=vD,(!Wi||Wi.length>0)&&(Wi=[]);return QT(e)}unpackMultiple(t,e){let i,r=0;try{fc=!0;let s=t.length,n=this?this.unpack(t,s):JT.unpack(t,s);if(!e){for(i=[n];bt<s;)r=bt,i.push(QT());return i}if(e(n,r,bt)===!1)return;for(;bt<s;)if(r=bt,e(QT(),r,bt)===!1)return}catch(s){throw s.lastPosition=r,s.values=i,s}finally{fc=!1,c8()}}_mergeStructures(t,e){t=t||[],Object.isFrozen(t)&&(t=t.map(i=>i.slice(0)));for(let i=0,r=t.length;i<r;i++){let s=t[i];s&&(s.isShared=!0,i>=32&&(s.highByte=i-32>>5))}t.sharedLength=t.length;for(let i in e||[])if(i>=0){let r=t[i],s=e[i];s&&(r&&((t.restoreStructures||(t.restoreStructures=[]))[i]=r),t[i]=s)}return this.structures=t}decode(t,e){return this.unpack(t,e)}},kpt=/^[a-zA-Z_$][a-zA-Z\d_$]*$/,f8=(t,e)=>function(){let i=pe[bt++];if(i===0)return e();let r=t<32?-(t+(i<<5)):t+(i<<5),s=Wi[r]||Npt()[r];if(!s)throw new Error("Record id is not defined for "+r);return s.read||(s.read=d8(s,t)),s.read()},OR=Vw,zpt=Vw,Lpt=Vw,Fpt=Vw,wn=String.fromCharCode,g8=new Array(4096),y8=(t,e)=>{let i=Hs().map(Ipt),r=t;e!==void 0&&(t=t<32?-((e<<5)+t):(e<<5)+t,i.highByte=e);let s=Wi[t];return s&&(s.isShared||fc)&&((Wi.restoreStructures||(Wi.restoreStructures=[]))[t]=s),Wi[t]=i,i.read=d8(i,r),(i.read0||i.read)()},Ma[0]=()=>{},Ma[0].noBuffer=!0,Ma[66]=t=>{let e=t.byteLength%8||8,i=BigInt(128&t[0]?t[0]-256:t[0]);for(let r=1;r<e;r++)i<<=BigInt(8),i+=BigInt(t[r]);if(t.byteLength!==e){let r=new DataView(t.buffer,t.byteOffset,t.byteLength),s=(n,a)=>{let o=a-n;if(o<=40){let d=r.getBigUint64(n);for(let c=n+8;c<a;c+=8)d<<=BigInt(64),d|=r.getBigUint64(c);return d}let l=n+(o>>4<<3),u=s(n,l),h=s(l,a);return u<<BigInt(8*(a-l))|h};i=i<<BigInt(8*(r.byteLength-e))|s(e,r.byteLength)}return i},bD={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError:typeof AggregateError=="function"?AggregateError:null},Ma[101]=()=>{let t=Hs();if(!bD[t[0]]){let e=Error(t[1],{cause:t[2]});return e.name=t[0],e}return bD[t[0]](t[1],{cause:t[2]})},Ma[105]=t=>{if(Rr.structuredClone===!1)throw new Error("Structured clone extension is disabled");let e=zi.getUint32(bt-4);mc||(mc=new Map);let i,r=pe[bt];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)&&pe[bt+1]===115?new Set:{};let s={target:i};mc.set(e,s);let n=Hs();if(!s.used)return s.target=n;if(Object.assign(i,n),i instanceof Map)for(let[a,o]of n.entries())i.set(a,o);if(i instanceof Set)for(let a of Array.from(n))i.add(a);return i},Ma[112]=t=>{if(Rr.structuredClone===!1)throw new Error("Structured clone extension is disabled");let e=zi.getUint32(bt-4),i=mc.get(e);return i.used=!0,i.target},Ma[115]=()=>new Set(Hs()),s$=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(t=>t+"Array"),n$=typeof globalThis=="object"?globalThis:window,Ma[116]=t=>{let e=t[0],i=Uint8Array.prototype.slice.call(t,1).buffer,r=s$[e];if(!r){if(e===16)return i;if(e===17)return new DataView(i);throw new Error("Could not find typed array for code "+e)}return new n$[r](i)},Ma[120]=()=>{let t=Hs();return new RegExp(t[0],t[1])},a$=[],Ma[98]=t=>{let e=(t[0]<<24)+(t[1]<<16)+(t[2]<<8)+t[3],i=bt;return bt+=e-t.length,Na=a$,(Na=[t$(),t$()]).position0=0,Na.position1=0,Na.postBundlePosition=bt,bt=i,Hs()},Ma[255]=t=>t.length==4?new Date(1e3*(16777216*t[0]+(t[1]<<16)+(t[2]<<8)+t[3])):t.length==8?new Date(((t[0]<<22)+(t[1]<<14)+(t[2]<<6)+(t[3]>>2))/1e6+1e3*(4294967296*(3&t[3])+16777216*t[4]+(t[5]<<16)+(t[6]<<8)+t[7])):t.length==12?new Date(((t[0]<<24)+(t[1]<<16)+(t[2]<<8)+t[3])/1e6+1e3*((128&t[4]?-281474976710656:0)+1099511627776*t[6]+4294967296*t[7]+16777216*t[8]+(t[9]<<16)+(t[10]<<8)+t[11])):new Date("invalid"),v8=new Array(147);for(let t=0;t<256;t++)v8[t]=+("1e"+Math.floor(45.15-.30103*t));(JT=new kw({useRecords:!1})).unpack,JT.unpackMultiple,JT.unpack,o$=new Float32Array(1),new Uint8Array(o$.buffer,0,4)}),aTt=W(()=>{nTt(),b7(),T7(),e0(),e5(),t0(),l$=[{Class:Ve.prototype.constructor,type:1,write:t=>({...t}),read:t=>(Object.setPrototypeOf(t,Ve.prototype),t)},{Class:fe.prototype.constructor,type:2,write:t=>[...t],read:t=>(Object.setPrototypeOf(t,fe.prototype),t)},{Class:Nn.prototype.constructor,type:3,write:t=>[...t],read:t=>(Object.setPrototypeOf(t,Nn.prototype),t)},{Class:ER.prototype.constructor,type:4,write:t=>t.id,read:t=>new ER(t)},{Class:l8.prototype.constructor,type:5,write:t=>t.data,read:t=>new l8(t)},{Class:$s.prototype.constructor,type:6,write:t=>({...t}),read:t=>(Object.setPrototypeOf(t,$s.prototype),t)}];for(let t of l$)sTt(t);h$=new kw({structuredClone:!0}),(b8||(b8={})).deserialize=function(t){return h$.unpack(t)}}),oTt=W(()=>{aTt(),_D=t=>()=>{throw new Error(t+" is not available in the runtime build (decode-only CollabSerialize)")},mS={deserialize:b8.deserialize,serialize:_D("CollabSerialize.serialize"),checksum:_D("CollabSerialize.checksum")}}),Fi=W(()=>{s5(),JSt(),_7(),t0(),e5(),x7(),e0(),eTt(),iTt(),Rpt(),rTt(),b7(),oTt(),Mpt(),T7()});function _8(t){return t==="MouseDown"||t==="MouseUp"||t==="KeyDown"||t==="KeyUp"||t==="Collision"||t==="Trigger"}var u$,x8,q1,tM,xD,d$,c$,p$,w8,S8,m$,f$,g$,y$,v$,T8,M8,b$,_$,x$,w$,Upt=W(()=>{var t,e,i;Fi(),yt(),(t=u$||(u$={})).toEventUIType=function(r){return r.type==="Conditional"?r.condition.type==="Distance"?"Distance":"StateChange":r.type},t.fromEventUIType=function(r){return r==="Distance"||r==="StateChange"?"Conditional":r},x8={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(s){return s.type==="MouseDown"||s.type==="MouseUp"||s.type==="MousePress"||s.type==="KeyDown"||s.type==="KeyUp"||s.type==="KeyPress"},r.defaultData=function(s){return s==="MouseDown"||s==="MouseUp"||s==="MousePress"?{type:s,mode:"Object",disabled:!1,name:"",actions:new fe}:{type:s,disabled:!1,name:"",key:void 0,actions:new fe}}})(q1||(q1={})),(r=>{r.propertyDefaultData=function(s){return{type:"Property",value:[s??null,"position","x"]}},r.valueDefaultData={type:"Literal",value:0}})(tM||(tM={})),(e=xD||(xD={})).comparisonDefaultData=function(r){return{type:"Comparison",operator:"==",lOperand:tM.propertyDefaultData(r),rOperand:{...tM.valueDefaultData}}},e.distanceDefaultData=function(r){return{type:"Distance",toObject:r??null,fromObject:r??null,distance:200}},e.stateDefaultData=function(r,s){return{type:"State",object:r??null,state:s??null}},(d$||(d$={})).isConditionalSubActions=function(r){return r.find(s=>s==="ifActions"||s==="elseActions")!==void 0},(r=>{r.is=function(s){return s.type==="Conditional"},r.defaultData=function(s){return{type:"Conditional",disabled:!1,name:"",inActions:new fe,outActions:new fe,condition:xD.distanceDefaultData(s)}}})(c$||(c$={})),(p$||(p$={})).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 fe,drop:new fe}},(w8||(w8={})).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 fe},(S8||(S8={})).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(s){return s.type==="MouseHover"},r.defaultData=function(){return{type:"MouseHover",disabled:!1,name:"",actions:new fe}}})(m$||(m$={})),(r=>{r.is=function(s){return s.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 fe}}})(f$||(f$={})),(r=>{r.is=function(s){return s.type==="Start"},r.defaultData=function(){return{type:"Start",disabled:!1,name:"",actions:new fe}}})(g$||(g$={})),(r=>{r.is=function(s){return s.type==="Collision"},r.defaultData=function(){return{type:"Collision",disabled:!1,name:"",target:"character",actions:new fe}}})(y$||(y$={})),(r=>{r.is=function(s){return s.type==="Trigger"},r.defaultData=function(s,n){return{type:"Trigger",name:"",disabled:!1,target:"all",triggeringObjects:[],actions:new fe,triggerZone:"box",position:n.toArray(),rotation:[0,0,0],size:s.toArray(),radius:s.length()/2,helperVisible:!0}}})(v$||(v$={})),(i=T8||(T8={})).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 fe},s={size:"tablet",operator:"<",actions:new fe},n={size:[...i.defaultSizes.custom],operator:"<>",actions:new fe},a=new fe;return a.push({id:Yt.generateUUID(),fi:0,data:r},{id:Yt.generateUUID(),fi:1,data:s},{id:Yt.generateUUID(),fi:2,data:n}),{type:"Resize",disabled:!1,name:"",orientation:"horizontal",breakpoints:a}},i.defaultBreakpointData=function(){return{size:[...i.defaultSizes.custom],operator:"<>",actions:new fe}},(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(s){return s.type==="VariableChange"},r.defaultData=function(){return{disabled:!1,type:"VariableChange",name:"",actions:new fe,variableId:"",objectId:null,property:"Position X"}}})(M8||(M8={})),(r=>{r.is=function(s){return s.type==="API"},r.defaultData=function(){return{disabled:!1,type:"API",name:"",successActions:new fe,errorActions:new fe,userAPIId:""}}})(b$||(b$={})),(r=>{r.is=function(s){return s.type==="WEBHOOK"},r.defaultData=function(){return{disabled:!1,type:"WEBHOOK",name:"",actions:new fe,userWebhookId:""}}})(_$||(_$={})),(r=>{r.is=function(s){return s.type==="AIAssistantListener"},r.defaultData=function(){return{disabled:!1,type:"AIAssistantListener",name:"",actions:new fe,analysis:"average",analysisRange:[0,71],analysisSingle:0}}})(x$||(x$={})),(r=>{r.is=function(s){return s.type==="AIAssistantTrigger"},r.defaultData=function(){return{disabled:!1,description:"",name:"",type:"AIAssistantTrigger",actions:new fe}}})(w$||(w$={}))});function S$(t){let e=typeof t;return t!==null&&(e==="object"||e==="function")}function T$(t){return typeof t=="string"&&t.length===36&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t)}var i0,ov,jpt,Xg,M$,Hu,am,fS,A$,lv,nn,Hi,A8,C$,Yp,Dv,E$,P$,R$,N$,D$,O$,I$,B$,wD,V$,k$,SD,z$,L$,F$,TD,U$,MD,j$,G$,W$,q$,H$,$$,X$,Y$,K$,Yg,gc,Kp,C8,E8,IR,BR,VR,kR,zR,P8,R8,LR,N8,hv,Z$,AD,CD,D8,Q$,FR,J$,tX,O8,eX,iX,rX,sX,nX,aX,oX,lX,hX,n5,A7,Gs,ds,T1,Gpt,gS,UR,ug,I8,C7,jR,GR,B8,lc,uP,Jn,ED,Gp,_l=W(()=>{var t,e,i,r,s,n,a,o;i0="personal camera",ov="a218fcc3-276b-49b9-b485-49037fd14f5f",jpt=2500134,Xg=5526619,(t=M$||{}).x="x",t.y="y",t.z="z",M$=t,(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,m){let f=l.sub(p,c),g=l.sub(m,c),y=l.dot(f,g)/l.dot(f,f),v=l.scalarMultiply(f,y);return l.add(c,v)}l.isEqual=function(c,p){return c[0]===p[0]&&c[1]===p[1]},l.lerp=function(c,p,m){return[c[0]+(p[0]-c[0])*m,c[1]+(p[1]-c[1])*m]},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,m){return h(c,d(c,p,m))},l.center=function(c,p){return[.5*(c[0]+p[0]),.5*(c[1]+p[1])]}})(Hu||(Hu={})),(e=am||(am={})).isEqual=function(l,u){return l[0]===u[0]&&l[1]===u[1]&&l[2]===u[2]},e.add=function(l,u){return[l[0]+u[0],l[1]+u[1],l[2]+u[2]]},e.sub=function(l,u){return[l[0]-u[0],l[1]-u[1],l[2]-u[2]]},e.div=function(l,u){return[l[0]/u[0],l[1]/u[1],l[2]/u[2]]},e.mul=function(l,u){return[l[0]*u[0],l[1]*u[1],l[2]*u[2]]},e.dist=function(l,u){return Math.hypot(l[0]-u[0],l[1]-u[1],l[2]-u[2])},e.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=fS||(fS={})).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])]}})(A$||(A$={})),(r=lv||(lv={})).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},(s=nn||(nn={})).isRGB=function(l){return typeof l=="object"&&typeof l.r=="number"&&typeof l.g=="number"&&typeof l.b=="number"},s.white={r:1,g:1,b:1},s.red={r:1,g:0,b:0},s.black={r:0,g:0,b:0},s.toRgb255a1=function(l){return{r:Math.round(255*l.r),g:Math.round(255*l.g),b:Math.round(255*l.b),a:1}},s.clone=function(l){return{r:l.r,g:l.g,b:l.b}},s.fromHex=function(l){return{r:((l=Math.floor(l))>>16&255)/255,g:(l>>8&255)/255,b:(255&l)/255}},s.toHex=function(l){return 65536*Math.round(255*l.r)+256*Math.round(255*l.g)+Math.round(255*l.b)},s.equals=function(l,u){return l.r===u.r&&l.g===u.g&&l.b===u.b},s.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)},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}},s.is=function(l){return!!S$(l)&&"r"in l&&"g"in l&&"b"in l&&!("a"in l)},(n=Hi||(Hi={})).white={...nn.white,a:1},n.is=function(l){return!!S$(l)&&"r"in l&&"g"in l&&"b"in l&&"a"in l},n.transparent={...nn.white,a:0},n.from0to1=function(l){return{r:l[0],g:l[1],b:l[2],a:l[3]}},n.fromHexAndA=function(l,u){return{...nn.fromHex(l),a:u}},n.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}},n.equals=function(l,u){return nn.equals(l,u)&&l.a===u.a},n.equalsFixed=function(l,u){return nn.equalsFixed(l,u)&&l.a.toFixed(2)===u.a.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,a:l.a+(u.a-l.a)*h}},n.toStyle=function({r:l,g:u,b:h,a:d}=n.white){return`rgba(${255*l}, ${255*u}, ${255*h}, ${d})`},(A8||(A8={})).identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1],pivot:[0,0,0],pivotRotation:[0,0,0]},(a=C$||{})[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",C$=a,(Yp||(Yp={})).defaultData={mass:1,stiffness:80,damping:10,velocity:0},(Dv||(Dv={})).defaultData={control1:[.5,0],control2:[.5,1]},(o=E$||(E$={})).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]}),lTt=W(()=>{var t,e;Fi(),Upt(),(P$||(P$={})).defaultData={type:"SwitchCamera",name:"",targetCamera:"",delay:0,animate:!0,duration:1e3,easing:4,runMode:"Normal"},(R$||(R$={})).defaultData={type:"SceneTransition",name:"",target:"",delay:0,duration:1,transition:"none"},(N$||(N$={})).defaultData={type:"Link",name:"",url:null,context:"tab"},(D$||(D$={})).defaultData={type:"Destroy",name:"",objects:[],delay:0},(O$||(O$={})).defaultData={type:"Particles",name:"",emitterObjectId:"",delay:0,emission:"start",triggerAfter:"any"},(I$||(I$={})).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"},(B$||(B$={})).defaultData={type:"Reset",name:"",delay:0},(wD||(wD={})).defaultData={interaction:"play",delay:0,volume:.5,loop:1},(t=V$||(V$={})).pauseDefaultData={interaction:"pause",delay:0},t.stopDefaultData={interaction:"stop",delay:0},(e=k$||(k$={})).defaultData={type:"Audio",name:"",...wD.defaultData},e.hasAudioByActions=i=>i.some(({data:r})=>r.type==="Audio"&&r.interaction==="play"&&r.audio),e.hasAudioByEvents=i=>{for(let{data:r}of i)if(q1.is(r)||r.type==="Start"||r.type==="Collision"){if(e.hasAudioByActions(r.actions))return!0}else if(r.type==="Conditional"){if(e.hasAudioByActions(r.inActions)||e.hasAudioByActions(r.outActions))return!0}else if(r.type==="GameControl"&&Object.values(r.gameActions).find(s=>e.hasAudioByActions(s)))return!0},e.getAudiosByActions=i=>{let r=[];return i.forEach(s=>{let n=s.data;n.type==="Audio"&&n.interaction==="play"&&n.audio&&r.push(s),n.type==="Conditional"&&(r.push(...e.getAudiosByActions(n.ifActions)),r.push(...e.getAudiosByActions(n.elseActions)))}),r},e.getAudiosByEvents=i=>{let r=[];return i.forEach(({data:s})=>{q1.is(s)||s.type==="Collision"||s.type==="Start"||s.type==="Trigger"?r.push(...e.getAudiosByActions(s.actions)):s.type==="Conditional"?(r.push(...e.getAudiosByActions(s.inActions)),r.push(...e.getAudiosByActions(s.outActions))):s.type==="GameControl"?Object.values(s.gameActions).forEach(n=>{r.push(...e.getAudiosByActions(n))}):s.type==="DragDrop"&&(r.push(...e.getAudiosByActions(s.dragDropActions.drag)),r.push(...e.getAudiosByActions(s.dragDropActions.drop)))}),r},(SD||(SD={})).defaultData={interaction:"play",delay:0,volume:.5,loop:1/0},(i=>{i.pauseDefaultData={interaction:"pause",delay:0},i.stopDefaultData={interaction:"stop",delay:0}})(z$||(z$={})),(i=>{i.defaultData={type:"Video",name:"",triggerAfter:"autoplay",...SD.defaultData},i.hasVideoByActions=r=>r.some(({data:s})=>s.type==="Video"&&s.interaction==="play"&&s.layerId),i.hasVideoByObject=r=>{if(r.events){for(let{data:s}of r.events)if((q1.is(s)||s.type==="Start")&&i.hasVideoByActions(s.actions))return!0}},i.getVideosByActions=r=>{let s=[];return r.forEach(n=>{let a=n.data;a.type==="Video"&&a.interaction==="play"&&a.layerId&&s.push(n)}),s},i.getVideosByEvents=r=>{let s=[];return r.forEach(({data:n})=>{(q1.is(n)||n.type==="Start")&&s.push(...i.getVideosByActions(n.actions))}),s}})(L$||(L$={})),(F$||(F$={})).defaultData=function(i){return{state:i,repeat:0,delay:0,delayDirection:"start-once",direction:"normal",duration:1e3,easing:4}},(TD||(TD={})).defaultData=function(){return{tweens:new fe,repeat:0,delay:0,delayDirection:"start-once",direction:"normal"}},(U$||(U$={})).defaultData=function(i){return{type:"Transition",name:"",runMode:"Once",object:i??null,...TD.defaultData()}},(MD||(MD={})).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}})(j$||(j$={})),(G$||(G$={})).defaultData=function(i){return{type:"TimelineAnimation",name:"",...MD.defaultData(i)}},(W$||(W$={})).defaultData=function(i,r,s){return{type:"Animation",name:"",object:i,clipId:r,crop:s,crop2:s,repeat:-1,delay:0,delayDirection:"start-once",direction:"normal",runMode:"Normal"}},(q$||(q$={})).defaultData={type:"SetVariable",name:"",variableId:"",expression:[]},(H$||(H$={})).defaultData=()=>({type:"Conditional",name:"",ifActions:new fe,elseActions:new fe,condition:[]}),($$||($$={})).defaultData={type:"DynamicVariablePlay",name:"",variableId:"",mode:"PlayPause",delay:0,pauseDelay:0},(X$||(X$={})).defaultData={type:"ClearLocalStorage",name:"",target:"all"},(Y$||(Y$={})).defaultData={name:"",type:"UserAPI"}}),hTt=W(()=>{var t;(t=K$||(K$={})).emptyAudio={data:Uint8Array.from(atob("UklGRjIAAABXQVZFZm10IBIAAAABAAEAQB8AAEAfAAABAAgAAABmYWN0BAAAAAAAAABkYXRhAAAAAA=="),e=>e.charCodeAt(0)),mimeType:"audio/wav",filename:"unknown"},t.maxSize=2e6}),Wpt=W(()=>{var t;(t=Yg||(Yg={})).all=["PerspectiveCamera","OrthographicCamera"],t.is=function(e){return t.all.includes(e)},(e=>{e.DefaultUp=[0,1,0],e.DefaultTargetOffset=1e3,e.MinTargetOffset=.001,e.sanitizeTargetOffset=function(n){return n===void 0||!Number.isFinite(n)||n<e.MinTargetOffset?e.DefaultTargetOffset:n},e.DefaultAzimuth=-24,e.DefaultElevation=15;let i=e.DefaultAzimuth*Math.PI/180,r=e.DefaultElevation*Math.PI/180,s=180/Math.PI;e.DefaultPosition=[e.DefaultTargetOffset*Math.sin(i)*Math.cos(r),e.DefaultTargetOffset*Math.sin(r),e.DefaultTargetOffset*Math.cos(i)*Math.cos(r)],e.DefaultRotation=[Math.atan2(-Math.sin(r),Math.cos(i)*Math.cos(r))*s,Math.asin(Math.sin(i)*Math.cos(r))*s,Math.atan2(Math.sin(i)*Math.sin(r),Math.cos(i))*s],e.defaultData={far:1e5,type:"PerspectiveCamera",perspective:{near:70,fov:45,zoom:1},orthographic:{near:-1e5,zoom:1},up:e.DefaultUp,isUpVectorFlipped:!1,targetOffset:e.DefaultTargetOffset},e.getZoom=function(n){return n.type==="PerspectiveCamera"?n.perspective?.zoom??1:n.orthographic?.zoom??1}})(gc||(gc={}))}),qpt=W(()=>{var t;(t=Kp||(Kp={})).defaultData=function(e,i=.1){return{disabled:!1,type:"linear",hideBase:!1,instanced:!1,count:3,radial:{radius:2*Math.max(typeof e[0]=="number"?e[0]:1,typeof e[1]=="number"?e[1]:1),start:0,end:360,alignment:!1,axis:"y",scale:[1,1,1],rotation:[0,0,0],position:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},toObject:{object:"",spreadType:"random",scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],axis:"x",seed:0,count:99,align:"normal",pivot:[0,0,0],pivotRotation:[0,0,0]},linear:{scale:[1,1,1],rotation:[0,0,0],position:[(typeof e[0]=="number"?e[0]+e[0]:1)*i,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},grid:{count:[2,2,2],size:e.map(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"}}},t.merge=function(e,i){let r={...e};if(E8.forEach(s=>{Object.assign(r,{[s]:i[s]??e[s]})}),r.radial={...e.radial},i.radial){let s=e.radial,n=i.radial;IR.forEach(a=>{Object.assign(r.radial,{[a]:n[a]??s[a]})})}if(r.linear={...e.linear},i.linear){let s=e.linear,n=i.linear;BR.forEach(a=>{Object.assign(r.linear,{[a]:n[a]??s[a]})})}if(r.grid={...e.grid},i.grid){let s=e.grid,n=i.grid;VR.forEach(a=>{Object.assign(r.grid,{[a]:n[a]??s[a]})})}if(r.toObject={...e.toObject},i.toObject){let s=e.toObject,n=i.toObject;kR.forEach(a=>{Object.assign(r.toObject,{[a]:n[a]??s[a]})})}if(r.randomnessObject={...e.randomnessObject},i.randomnessObject){let s=e.randomnessObject,n=i.randomnessObject;zR.forEach(a=>{Object.assign(r.randomnessObject,{[a]:n[a]??s[a]})})}return r},t.isPartial=function(e){return!(!e.randomnessObject&&!e.toObject)},(e=>{e.defaultData={radial:{},linear:{},grid:{},toObject:{},randomnessObject:{}};let i=["radial","linear","grid","toObject","randomnessObject"];e.toOps=function(r,s){let n=[];r.count!==void 0&&n.push({type:0,path:s,props:{count:r.count}});for(let a of i){let o=r[a];o&&Object.keys(o).length>0&&n.push({type:0,path:[...s,a],props:o})}return n}})(C8||(C8={})),E8=["count"],IR=["radius","start","end","position","scale","rotation"],BR=["position","scale","rotation"],VR=["count","size"],kR=["count","position","scale","rotation"],zR=["strength","scale","rotation","position","movement","seed","freqScale"]}),Hpt=W(()=>{var t;_l(),(t=P8||(P8={})).all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"],t.is=function(e){return t.all.includes(e)},(R8||(R8={})).defaultData=function(e){return function(i){if(i==="PointLight")return{type:i,color:Hi.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,penumbraSize:.5,depth:1e5};if(i==="SpotLight")return{type:i,color:Hi.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:Hi.white,intensity:1,shadows:!0,size:2e3,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};throw new Error("not implemented")}(e)}}),$pt=W(()=>{var t;(t=LR||(LR={})).defaultShapeData={type:"PlaneEmitterShape",size:[100,100,100]},t.defaultCollisionData={colliderEntityId:null,collisionBounce:.75},t.defaultData={renderMaterial:{type:"particleMaterial",color:{r:1,g:.2,b:.545,a:1},color2:{r:.945,g:.714,b:.184,a:1},coloring:"gradient",ease:"linearFadeOut",easeSize:"linearFadeOut",transparent:!0,size:[40,40],texture:"pt_default_particle",spriteRotation:[0,0]},birthRatePerSec:50,gravity:1,noiseStrength:0,noiseScale:0,noiseSeed:1,noiseType:"curl",randomRotation:0,randomScale:.2,randomMass:.5,rootObjectType:"instancedMesh",life:1,direction:[0,0,0],directionMode:"axis",speed:10,shape:t.defaultShapeData,autoPlay:!0,emitTimeDelay:0,emitTimeCycle:"infinity",emitTimeDuration:1,...t.defaultCollisionData}}),Xpt=W(()=>{var t;(t=N8||(N8={})).defaultData={gravity:10,damping:.03,localStiffness:.67,globalStiffness:.5,globalRange:.15,stiffnessFalloff:.1,windStrength:0,vspCoefficient:.01,elasticity:.15,hairLength:.75,tipSeparation:.8,kink:0,kinkFrequency:0,clumpStrength:0,clumpSize:32,clumpTipScale:1.5,spreadRadius:.03,guideStrands:8192,headShape:"sphere",baseObjectId:null,hairColorSource:"custom",hairShadeRoot:.6,hairShadeTip:1.15,hairRootColor:{r:.29,g:.102,b:.039,a:1},hairMidColor:{r:.8,g:.267,b:.133,a:1},hairTipColor:{r:.545,g:.18,b:.18,a:1},headColor:{r:.325,g:.137,b:.114,a:1},noiseEnabled:!1,noiseColorA:{r:.545,g:.184,b:.788,a:1},noiseColorB:{r:.914,g:.188,b:.914,a:1},noiseColorC:{r:.2,g:.4,b:1,a:1},noiseColorD:{r:.2,g:1,b:.6,a:1},noiseScale:1.8,noiseMixHair:.75,noiseMixHead:.8,castShadow:!0,receiveShadow:!0,hairWidth:1.75,specularPower:40,specularIntensity:.4,diffuseIntensity:.6,ambientIntensity:.25,opacity:1,tipFade:.4,autoPlay:!0},t.regenProps=["hairLength","spreadRadius","guideStrands","headShape","baseObjectId"]}),E7=W(()=>{(hv||(hv={})).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]}}),Ypt=W(()=>{var t,e;(t=Z$||{})[t.Front=0]="Front",t[t.Back=1]="Back",t[t.Double=2]="Double",Z$=t,(e=AD||(AD={})).defaultData={castShadow:!0,receiveShadow:!0},e.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,s){return r.flatShading===s.flatShading&&r.side===s.side&&r.wireframe===s.wireframe&&(r.shadowCatcher??!1)===(s.shadowCatcher??!1)}})(CD||(CD={})),(D8||(D8={})).defaultData={...CD.defaultData,...AD.defaultData},(Q$||(Q$={})).getMaterialData=function(i,r){let s=[];if("material"in i){let n=typeof i.material=="string"?r.materials[i.material]??r.lib.materials[i.material]?.asset:i.material;n&&s.push(n)}else if("materials"in i)for(let n of i.materials){let a=typeof n=="string"?r.materials[n]??r.lib.materials[n]?.asset:n;a&&s.push(a)}return s}}),Kpt=W(()=>{var t;(t=FR||(FR={})).defaultVideo={data:"",thumb:"/_assets/_videos/catThumb.png",type:"video",name:"Cat video"},t.maxSize=3e7}),IS=W(()=>{var t,e,i,r;Fi(),_l(),Kpt(),_l(),(J$||(J$={})).is=function(s){return s==="texture"||s==="video"||s==="color"||s==="depth"||s==="normal"||s==="gradient"||s==="noise"||s==="fresnel"||s==="cavity"||s==="dust"||s==="rainbow"||s==="toon"||s==="outline"||s==="particle"||s==="transmission"||s==="reflection"||s==="matcap"||s==="displace"||s==="pattern"||s==="vertexColor"||s==="light"},(tX||(tX={})).is=function(s){return s==="luminance"||s==="r"||s==="g"||s==="b"||s==="a"},(O8||(O8={})).is=function(s){return typeof s=="object"&&s!==null&&s.image!=null},(eX||(eX={})).is=function(s){return s==="phong"||s==="toon"||s==="lambert"||s==="physical"},(r=iX||{})[r.Linear=0]="Linear",r[r.Radial=1]="Radial",r[r.Polar=2]="Polar",iX=r,rX=(s=>(s[s.RepeatWrapping=1e3]="RepeatWrapping",s[s.ClampToEdgeWrapping=1001]="ClampToEdgeWrapping",s[s.MirroredRepeatWrapping=1002]="MirroredRepeatWrapping",s))(rX||{}),sX=(s=>(s[s.NearestFilter=1003]="NearestFilter",s[s.LinearFilter=1006]="LinearFilter",s[s.LinearMipmapLinearFilter=1008]="LinearMipmapLinearFilter",s))(sX||{}),(i=nX||{})[i.UV=0]="UV",i[i.Planar=1]="Planar",i[i.Spherical=2]="Spherical",i[i.Cylindrical=3]="Cylindrical",i[i.Triplanar=4]="Triplanar",nX=i,(e=aX||{})[e.Simplex=0]="Simplex",e[e.SimplexFractal=1]="SimplexFractal",e[e.Ashima=2]="Ashima",e[e.Fbm=3]="Fbm",e[e.Perlin=4]="Perlin",e[e.Voronoi=5]="Voronoi",aX=e,(t=oX||{})[t.F1=0]="F1",t[t.F2=1]="F2",t[t.F2MinusF1=2]="F2MinusF1",t[t.SmoothBlend=3]="SmoothBlend",t[t.Edge=4]="Edge",t[t.Power=5]="Power",t[t.Lines=6]="Lines",t[t.Cells=7]="Cells",oX=t,lX=(s=>(s[s.Lights=0]="Lights",s[s.Static=1]="Static",s[s.Camera=2]="Camera",s))(lX||{}),hX=(s=>(s[s.Circle=0]="Circle",s[s.Ring=1]="Ring",s[s.Polygon=2]="Polygon",s[s.Cross=3]="Cross",s[s.Diamond=4]="Diamond",s[s.Checkerboard=5]="Checkerboard",s[s.Line=6]="Line",s[s.Wave=7]="Wave",s))(hX||{}),n5=["mode","gradientType","noiseType","tracingMode","mirror","displacementType","projection","cnormal","crop","axis","side","roughnessMapChannel","metalnessMap","metalnessMapChannel","normalMap","aoMap","aoMapChannel","emissiveMap","style"],A7=["wrapping","image","video","name","minFilter","magFilter"],(s=>{s.patch=function(n,a){let{texture:o,...l}=a;if(Object.assign(n,l),o){let u=n.texture;u&&Object.assign(u,o)}},s.defaultColorLayer=function(n){return{...s.defaultData("color"),color:n}},s.defaultData=function(n,a){return n==="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:FR.defaultVideo,wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"color":return{...l,type:"color",color:nn.fromHex(Xg)};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:{...nn.fromHex(6710886),a:1},colorB:{...nn.fromHex(6710886),a:1},colorC:{...nn.fromHex(16777215),a:1},colorD:{...nn.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:Hi.fromHexAndA(16777215,1),bias:.1,scale:1,intensity:2,factor:1};case"dust":return{...l,type:"dust",color:Hi.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:Hi.fromHexAndA(0,0),offset:[0,0,0]};case"outline":return{...l,type:"outline",outlineColor:Hi.fromHexAndA(0,1),contourColor:Hi.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:{...nn.fromHex(0),a:1},colorB:{...nn.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}}}(n)}})(Gs||(Gs={})),(s=>{function n(a,o="layer1",l="layer2",u=nn.fromHex(16777215)){let h=new fe;return h.push({fi:0,data:Gs.defaultData("light",a),id:o}),h.push({fi:1,data:Gs.defaultData("color"),id:l}),{layers:h}}s.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")},s.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},s.defaultEmptyData=function(){return{layers:new fe}},s.defaultData=function(a="layer1",o="layer2"){return n("physical",a,o)},s.withName=function(a,o){return{...a,name:o}},s.defaultTwoLayerData=n,s.defaultColorMaterial=function(a,o,l="layer1",u="layer2"){let h=new fe;return h.push({fi:0,data:Gs.defaultData("light",o),id:l}),h.push({fi:1,data:Gs.defaultColorLayer(a),id:u}),{layers:h}},s.defaultUIObjectMaterial=function(a){let o=Gs.defaultData("texture");a&&Object.assign(o.texture,{image:a});let l=new fe;return l.push({fi:0,data:o,id:"layer1"}),l.push({fi:1,data:{...Gs.defaultData("transmission"),alpha:1},id:"layer2"}),l.push({fi:2,data:{...Gs.defaultData("light","lambert"),alpha:0},id:"layer3"}),{layers:l}},s.defaultTwoLayerTextureData=function(a,o="physical",l="layer1",u="layer2"){let h=Gs.defaultData("texture");Object.assign(h.texture,{image:a});let d=new fe;return d.push({fi:0,data:h,id:l}),d.push({fi:1,data:Gs.defaultData("light",o),id:u}),{layers:d}},s.defaultTwoLayerVideoTextureData=function(a,o="physical",l="layer1",u="layer2"){let h=Gs.defaultData("video");Object.assign(h.texture,{video:a});let d=new fe;return d.push({fi:0,data:h,id:l}),d.push({fi:1,data:Gs.defaultData("light",o),id:u}),{layers:d}}})(ds||(ds={}))}),uTt=W(()=>{T1="Roboto_regular",Gpt="https://fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Me5WZLCzYlKw.ttf"}),Zpt=W(()=>{Fi(),(gS||(gS={})).defaultData=function(){return{points:new fe,roundness:0,shapeHoles:[],isClosed:!1}}}),Qpt=W(()=>{Fi(),(UR||(UR={})).defaultData=function(){return{points:new fe,lastInsertionPlane:null,subdivisions:12,isClosed:!1,subdivisionMode:"parametric"}},ug={type:"Ellipse",width:50,height:50,spikes:16,angle:360,innerRadius:0},(I8||(I8={})).merge=function(t,e){let i={...t};return jR.forEach(r=>{Object.assign(i,{[r]:e[r]??t[r]})}),i},C7={shape:ug,depth:1,offset:0,bevel:50,bevelSides:6,angle:0,twist:0,startScale:1,endScale:1,capType:"flat"},jR=["depth","offset","angle","twist","startScale","endScale"]}),P7=W(()=>{var t,e;Zpt(),Qpt(),(t=GR||(GR={})).is2DParametricMesh=function(i){return i==="PolygonGeometry"||i==="RectangleGeometry"||i==="StarGeometry"||i==="TriangleGeometry"||i==="EllipseGeometry"||i==="UIGeometry"},t.isParametricMesh=function(i){return i==="PolygonGeometry"||i==="RectangleGeometry"||i==="StarGeometry"||i==="TriangleGeometry"||i==="EllipseGeometry"||i==="PathGeometry"||i==="VectorGeometry"||i==="ConeGeometry"||i==="CubeGeometry"||i==="CylinderGeometry"||i==="DodecahedronGeometry"||i==="HelixGeometry"||i==="IcosahedronGeometry"||i==="LatheGeometry"||i==="PyramidGeometry"||i==="SphereGeometry"||i==="PlaneGeometry"||i==="BackdropGeometry"||i==="TorusGeometry"||i==="TorusKnotGeometry"||i==="BooleanGeometry"||i==="TextGeometry"||i==="InputGeometry"||i==="DecalGeometry"},t.isSwappableGeometry=function(i){return i==="PolygonGeometry"||i==="RectangleGeometry"||i==="StarGeometry"||i==="TriangleGeometry"||i==="EllipseGeometry"||i==="PathGeometry"||i==="VectorGeometry"||i==="ConeGeometry"||i==="CubeGeometry"||i==="CylinderGeometry"||i==="DodecahedronGeometry"||i==="HelixGeometry"||i==="IcosahedronGeometry"||i==="LatheGeometry"||i==="PyramidGeometry"||i==="SphereGeometry"||i==="PlaneGeometry"||i==="BackdropGeometry"||i==="TorusGeometry"||i==="TorusKnotGeometry"||i==="TextGeometry"||i==="SubdivGeometry"||i==="NonParametricGeometry"},(B8||(B8={})).merge=function(i,r){let s={...i};return Object.assign(s,r),s.type==="PathGeometry"&&"extrusion"in r&&r.extrusion&&(s.extrusion={...i.extrusion},Object.assign(s.extrusion,I8.merge(s.extrusion,r.extrusion))),s},(e=lc||(lc={})).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:UR.defaultData(),extrusion:C7};if(i==="VectorGeometry")return{width:1,height:1,type:i,subdivisions:12,shape:gS.defaultData(),depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if(i==="BooleanGeometry")return{type:i,operation:2,width:0,height:0,depth:0,phongAngle:35};if(i==="ShapeBlendGeometry")return{type:i,width:0,height:0,depth:0,resolutionLevel:6,blendRange:100,useChildrenColors:!1};if(i==="DecalGeometry")return{type:i,width:200,height:200,depth:200,offset:1};if(i==="TextGeometry")return{type:i,width:100,height:100,depth:0,horizontalAlign:1,verticalAlign:1,fontSize:16,lineHeight:1.2,letterSpacing:0,text:{textValue:""},textTransform:1,font:"Roboto_regular",editable:!1,extrudeBevelSize:0,extrudeBevelSegments:1};if(i==="InputGeometry")return{...e.defaultData("TextGeometry"),type:i,editable:!0};if(i==="SphereGeometry")return{type:"SphereGeometry",width:100,height:100,depth:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180};throw new Error("not implemented")},uP=["width","height","depth"]}),Jpt=W(()=>{_l(),(t=>{function e(i){return i.mode??"linear"}t.defaultData={enabled:!1,useBackgroundColor:!1,color:nn.white,near:.1,far:2e3,mode:"linear",density:.005,heightFalloff:.01,heightBase:0},t.getMode=e,t.getModeIndex=function(i){let r=e(i);return r==="height"?1:r==="both"?2:0},t.getDensity=function(i){return i.density??t.defaultData.density},t.getHeightFalloff=function(i){return i.heightFalloff??t.defaultData.heightFalloff},t.getHeightBase=function(i){return i.heightBase??t.defaultData.heightBase}})(Jn||(Jn={}))}),R7=W(()=>{(ED||(ED={})).defaultData={image:null,rotation:0,blur:32,showBackground:!0},(Gp||(Gp={})).defaultData={enabled:!1,mode:"hdri",hdri:ED.defaultData,timeOfDay:10,weather:"partlyCloudy",lighting:!0,lightingIntensity:1,lightingQuality:"full",clouds:!0,windSpeed:2,animateWind:!0,exposure:1,seed:2}});function dTt(t){let e=typeof t=="string"?Number.parseInt(t,10):t;return typeof e=="number"&&Number.isFinite(e)?Math.min(5,Math.max(0,Math.round(e))):3}var WR,uv,PD,RD,ND,dv,DD,V8,k8,uX,I0,tmt,rn,qR,dX,cX,pX,mX,Bu,B2,HR,$R,yc,kg,fX,Zp,XR,vc,OD,ID,bg,Kg,_g,V2,z8,gX,Da,BD,yX,vX,hc,Kl,cv,L8,emt=W(()=>{(()=>{let t={opacity:1,blendFunction:13,enabled:!1};(WR||(WR={})).defaultData={enabled:!1,pixelation:{...t,blendFunction:16,granularity:15},bloom:{...t,blendFunction:16,intensity:1,blurScale:1,luminanceThreshold:.25,luminanceSmoothing:.025,kernelSize:3},chromaticAberration:{...t,offset:[2,2]},vignette:{...t,darkness:1,offset:0},hueSaturation:{...t,hue:3,saturation:0},brightnessContrast:{...t,brightness:.25,contrast:0},depthOfField:{...t,focusDistance:100,focalLength:20,bokehScale:5},noise:{...t,blendFunction:16}}})()}),N7=W(()=>{var t;Jpt(),R7(),emt(),_l(),(t=uv||(uv={})).defaultData={type:"normal",softShadowQuality:"low"},t.isSoft=function(e){return e!=null&&(e.type===void 0||e.type==="soft")},(PD||(PD={})).defaultData={enabled:!0,color:{r:.8274509803921568,g:.8274509803921568,b:.8274509803921568},intensity:.75},(RD||(RD={})).defaultData={occlusion:!1,aoFullRes:!1,radius:256,bias:.5,aoColor:{r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}},(e=>{e.defaultData={pipeline:"classic",toneMapping:"aces",exposure:1},e.isUntouched=function(i){return i===void 0||i.pipeline==="classic"&&(i.toneMapping==="none"||i.toneMapping==="aces")&&i.exposure===1}})(ND||(ND={})),(dv||(dv={})).defaultData={usePhysics:!1,gravity:-10},(DD||(DD={})).defaultData={playCamera:i0,gameControlObject:null},(V8||(V8={})).defaultData={backgroundColor:Hi.fromHexAndA(jpt,1),postprocessing:WR.defaultData,fog:Jn.defaultData,sky:Gp.defaultData,globalPhysics:dv.defaultData,ambient:PD.defaultData,ao:RD.defaultData,shadow:uv.defaultData,publish:DD.defaultData,grading:ND.defaultData}}),cTt=W(()=>{(k8||(k8={})).defaultData={colliderType:"box",size:[100,100,100],colliderHelperVisible:!0,forceType:"collider",forceRange:"global",forceIntensity:.5,forceDambing:.95}}),a5=W(()=>{var t,e,i;Fi(),Wpt(),Hpt(),$pt(),Xpt(),E7(),Ypt(),_l(),IS(),P7(),qpt(),oa(),N7(),cTt(),(t=uX||(uX={})).isComponentRelated=function(r){return r==="Component"||r==="Instance"},t.isEmptyOrComponent=function(r){return r==="Empty"||r==="Instance"},(e=I0||(I0={})).identity={...A8.identity,hiddenMatrix:lv.identity},e.fromObject=function(r){return{position:r.position,rotation:r.rotation,scale:r.scale,pivot:r.pivot,pivotRotation:r.pivotRotation,hiddenMatrix:r.hiddenMatrix}},e.merge=function(r,s){return{position:s?.position||r.position,rotation:s?.rotation||r.rotation,pivot:s?.pivot||r.pivot,pivotRotation:s?.pivotRotation||r.pivotRotation,scale:s?.scale||r.scale,hiddenMatrix:s?.hiddenMatrix||r.hiddenMatrix}},e.diff=function(r,s){return xpt({position:am.isEqual(r.position,s.position)?void 0:s.position,rotation:am.isEqual(r.rotation,s.rotation)?void 0:s.rotation,scale:am.isEqual(r.scale,s.scale)?null:s.scale,hiddenMatrix:lv.isEqual(r.hiddenMatrix,s.hiddenMatrix)?void 0:s.hiddenMatrix})},tmt=["slide","offset"],(rn||(rn={})).defaultData={states:new fe,events:new fe,visible:!0,raycastLock:!1,physics:hv.defaultData,pathSnapping:{pathId:null,slide:0,offset:0,orientation:"tangential"},...I0.identity,cloner:null},(qR||(qR={})).defaultData={type:"Empty",...rn.defaultData},(dX||(dX={})).defaultData={type:"ParticleCollider",...k8.defaultData,...rn.defaultData},(cX||(cX={})).defaultData={type:"Component",...rn.defaultData},(pX||(pX={})).defaultData={type:"Particle",...rn.defaultData,...LR.defaultData},(mX||(mX={})).defaultData={type:"Hair",...rn.defaultData,...N8.defaultData},(Bu||(Bu={})).defaultData={type:"Mesh",...rn.defaultData,...D8.defaultData},(B2||(B2={})).defaultData={...rn.defaultData,...I0.identity,position:gc.DefaultPosition,rotation:gc.DefaultRotation,...gc.defaultData},(r=>{r.defaultData=function(s){return{...rn.defaultData,...R8.defaultData(s)}},r.defaultDirectionalLightData={...r.defaultData("DirectionalLight"),position:[200,300,300],name:"Directional Light",intensity:.7}})(HR||(HR={})),(r=>{function s(n,a,o=0){for(;o<a.length;){let l=n?n[a[o]]:void 0;if(a.length===o+1)return l;if(!l)return;n=l.descendants,o+=1}}r.resolveWithDes=s,r.resolve=function(n,a,o=0){let l=s(n,a,o);if(l){let u=Object.keys(l);if(u.length===1&&u[0]==="descendants")return}return l}})($R||($R={})),(r=>{function s(n,a){return{...rn.defaultData,...a,component:n,overrides:new $s,physics:void 0,events:void 0,type:"Instance"}}r.rootOverrideProps=["physics","events"],r.compositeNonOptionalOverrideProps=["geometry"],r.compositeEntireOverrideOverrideProps=["material"],r.ofComponent=s,r.fromComponentData=function(n){let a=I0.fromObject(n.data);return s(n.id,a)}})(yc||(yc={})),(r=>{r.defaultData={type:"Page",...rn.defaultData,physics:{...hv.defaultData,fusedBody:!1},...V8.defaultData,camera:B2.defaultData,timelines:new Ve},r.isUIPage=function(s){return s.uiScene!==void 0}})(kg||(kg={})),(i=fX||(fX={})).defaultCamera={position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0],hiddenMatrix:lv.identity,name:"Play Camera",visible:!0,raycastLock:!1,physics:hv.defaultData,states:new fe,events:new fe,cloner:null,pathSnapping:{pathId:null,orientation:"tangential",slide:0,offset:0},...gc.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",...rn.defaultData,...Bu.defaultData,geometry:lc.defaultData("RectangleGeometry"),material:ds.defaultTwoLayerData("physical","layer1","layer2")},i.defaultBooleanObject={name:"Boolean",...rn.defaultData,...Bu.defaultData,geometry:lc.defaultData("BooleanGeometry"),material:ds.defaultTwoLayerData("physical","layer1","layer2")},i.defaultShapeBlendObject={name:"Shape Blend",...rn.defaultData,...Bu.defaultData,geometry:lc.defaultData("ShapeBlendGeometry"),material:ds.defaultTwoLayerData("physical","layer1","layer2")},i.defaultTextObject={name:"Text",...rn.defaultData,...Bu.defaultData,geometry:lc.defaultData("TextGeometry"),material:ds.defaultTwoLayerData("physical","layer1","layer2")},i.defaultInputObject={name:"Input",...rn.defaultData,...Bu.defaultData,geometry:lc.defaultData("InputGeometry"),material:ds.defaultTwoLayerData("physical","layer1","layer2")},(r=>{r.newEmpty=function(s,n){let a={name:n};return s.type==="Mesh"?(a.geometry={},"material"in s&&(a.material={layers:new $s}),"materials"in s&&(a.materials=s.materials.map(o=>({layers:new $s})))):Yg.is(s.type)&&(a.perspective={},a.orthographic={}),a},r.toOps=function(s,n){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:m,...f}=p;if(m!==void 0&&Object.keys(m).length>0){let g={path:[...h,"layers",c,"texture"],props:m,type:0};o.push(g)}if(Object.keys(f).length>0){let g={path:[...h,"layers",c],props:f,type:0};o.push(g)}}}for(let[h,d]of Object.entries(n)){let c=d;if(h!=="name")if(h==="cloner")o.push(...C8.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,m]of Object.entries(c))u(["materials",p],m);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(s,n){if(n===void 0)return s;let a={...s};if(Object.assign(a,I0.merge(a,n)),Object.assign(a,{pathSnapping:Object.assign({},a.pathSnapping,{slide:n.pathSnapping?.slide??a.pathSnapping?.slide??0,offset:n.pathSnapping?.offset??a.pathSnapping?.offset??0})}),Yg.is(s.type)){a.orthographic={...a.orthographic},a.perspective={...a.perspective};let o=n;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(s.type==="Mesh")"geometry"in n&&Object.assign(a,{geometry:B8.merge(a.geometry,n.geometry)}),(n.material||n.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=RR(u.material,h=>{if(typeof h!="string")for(let[d,c]of Object.entries(l.material.layers)){let p=h.layers.data(d);p&&Gs.patch(p,c)}}).data),u.materials&&l.materials&&(u.materials=RR(u.materials,h=>{for(let d=0;d<u.materials.length;d++){let c=l.materials[d];if(typeof c!="string")for(let[p,m]of Object.entries(c.layers)){let f=h[d]?.layers?.data(p);f&&Gs.patch(f,m)}}}).data),u}(a,n)),a.cloner&&"cloner"in n&&Object.assign(a,{cloner:Kp.merge(a.cloner,n.cloner)});else if(s.type==="Empty")a.cloner&&"cloner"in n&&Object.assign(a,{cloner:Kp.merge(a.cloner,n.cloner)});else if(P8.is(s.type)){let o=n;o.intensity!==void 0&&(a.intensity=o.intensity),o.color!==void 0&&(typeof o.color=="string"?a.color=o.color:a.color=nn.clone(o.color))}return a}})(Zp||(Zp={}))}),D7=W(()=>{(XR||(XR={})).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}}),o5=W(()=>{D7(),_l(),(vc||(vc={})).defaultData={orbitControls:XR.defaultData,playPage:ov,withBackground:!0,preventScroll:!1,preventTouchScroll:!1,hideCursor:!1,mouseEventTarget:"canvas",joystickSizeAndXYOffset:Array(12).fill(0).map((t,e)=>{let i=0,r=0;return e<5?r=-30:e<10&&(r=30),e===0||e===10||e===5?i=30:(e===4||e===11||e===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}}),imt=W(()=>{var t;(OD||(OD={})).defaultData={id:"basic",label:"Basic",style:"None",prompt:""},(ID||(ID={})).defaultData={weather:0,shadows:0,lightOrigin:0,temperature:0,sun:0,camera:0,environment:0,particles:0,nature:0,floor:0},(t=bg||(bg={})).defaultData=()=>({mode:"line-art-both",prompt:"",negativePrompt:"",style:{...OD.defaultData},isRandomSeed:!0,seed:t.generateSeed(),guessMode:!1,advanced:!1,steps:20,guidanceScale:7.5,controlNetScale:1,modifiers:ID.defaultData}),t.generateSeed=()=>Math.round(1e5*Math.random())}),O7=W(()=>{a5(),Fi(),o5(),_l(),oa(),imt(),(t=>{function e(i,r){let s=i.scene.objects.get(r);if(s&&s.data.type==="Component")return s;{let n=i.shared.lib.components[r];if(n)return{...n.asset,id:r}}}t.physicsEnabled=function(i){return i.find(r=>r.data.type==="Page"&&r.data.globalPhysics.usePhysics)!==void 0},t.findTimeline=function(i,r){let s=i.find(n=>n.data.type==="Page"&&n.data.timelines?.[r]!==void 0);return s&&s.data.timelines?.[r]},t.getComponentData=e,t.traverseModuleInstances=function(i,r,s){i.scene.objects.traverseFrom(r,(n,a)=>{if(a.type==="Instance"){let o=e(i,a.component)?.data;o&&s(n,a,o.events)}else s(n,a,a.events)})}})(Kg||(Kg={})),(t=>{function e(r=!0,s=[]){let n=[];r&&n.push({...t.defaultLight}),n.push(...s);let a=new Nn;return a.push({fi:1,id:ov,data:{...kg.defaultData,name:"Scene 1"},children:n}),a}function i(r){return{...t.defaultData,objects:Xa(r,Nn.prototype)}}t.TRASH_CAN_ID="830a2708-8ed9-49cf-a68e-085299892222",t.defaultLight={fi:-1,data:HR.defaultDirectionalLightData,id:"830a2708-8ed9-49cf-a68e-085299899103",children:[]},t.createDefaultObjectTreeWithPage=e,t.defaultData={objects:e(),publish:vc.defaultData,styles:bg.defaultData()},t.emptyDataWithoutPage=function(){return{objects:new Nn,publish:vc.defaultData,styles:bg.defaultData()}},t.emptyDataWithPage=function(r=!0){return{objects:e(r),publish:vc.defaultData,styles:bg.defaultData()}},t.emptyData=function(){return{objects:new Nn,publish:{...vc.defaultData},styles:bg.defaultData()}},t.withObjs=i,t.withObj=function(r,s){return i([{id:r,data:s,children:[],fi:0}])}})(_g||(_g={}))}),rmt=W(()=>{(V2||(V2={})).defaultData={preset:"fullscreen",allowResponsive:!1,size:[512,512],coords:[0,0],sceneScale:1,color:{r:0,g:0,b:0,a:.5}}}),I7=W(()=>{var t,e;Fi(),oa(),(t=z8||(z8={})).defaultData=i=>({url:i,name:"New Webhook",parametersSchemas:new fe}),t.defaultParameterValueByType=i=>i==="number"?0:i!=="boolean"&&"",(gX||(gX={})).defaultData=(i,r="GET")=>({url:i,method:r,name:"New API",headers:new fe,queries:new fe,autoStart:!0}),(i=>{function r(n){return n.textValue!==void 0}function s(n){return typeof n=="boolean"}i.isTextValue=r,i.isNumber=function(n){return typeof n=="number"},i.isBoolean=s,i.typeOfVariable=function(n){return r(n)?"string":s(n)?"boolean":"number"},i.getDisplayedValue=function(n){return i.isTextValue(n)?Array.isArray(n.textValue)?n.textValue.map(a=>a.toString().padStart(n.padding??2,"0")).join(n.deliminator??":")+(n.suffix!==void 0?" "+n.suffix:""):n.textValue.toString():i.isBoolean(n)?n?"True":"False":i.isNumber(n)?parseFloat(n.toFixed(3)).toString():n.toString()}})(Da||(Da={})),(BD||(BD={})).all=["images","videos","colors","audios","particles","fonts","materials","variables"],(yX||(yX={})).all=[...BD.all,"components"],(vX||(vX={})).defaultData=function(){return{images:new Ve,videos:new Ve,colors:new Ve,audios:new Ve,particles:new Ve,fonts:new Ve,materials:new Ve,components:new Ve,variables:new Ve,userAPIs:new Ve,userWebhooks:new Ve}},(hc||(hc={})).defaultData=function(){return{images:new Ve,videos:new Ve,colors:new Ve,audios:new Ve,particles:new Ve,fonts:new Ve,materials:new Ve,components:new Ve,variables:new Ve,userAPIs:new Ve,userWebhooks:new Ve}},(e=Kl||(Kl={})).defaultColors=function(){return Xa({"89b10010-844c-11ec-a8a3-0242ac120002":{r:.5,g:.5,b:.5,a:1,name:"Default Color"}},Ve.prototype)},e.defaultImages=function(){return Xa({},Ve.prototype)},e.emptyData=function(){return{catelogs:new Ve,materials:new Ve,images:new Ve,videos:new Ve,colors:new Ve,audios:new Ve,particles:new Ve,fonts:new Ve,variables:new fe,userAPIs:new Ve,userWebhooks:new Ve,lib:hc.defaultData()}},e.defaultVariables=function(i){switch(i){case"number":return{value:0,name:"Number"};case"boolean":return{value:!1,name:"Boolean"};case"string":return{value:{textValue:"String value"},name:"String"};case"time":{let 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)}},e.getFormattedTimerTime=function(i,r){if(r.format==="HH:mm:ss"){let s=Math.floor(i/3600),n=Math.floor((i-3600*s)/60);return{textValue:[s,n,Math.round(i-3600*s-60*n)]}}if(r.format==="mm:ss"){let s=Math.floor(i/60);return{textValue:[s,Math.round(i-60*s)]}}return r.format==="number"?Math.round(i):Math.round(1e3*i)/1e3}}),pTt=W(()=>{}),smt=W(()=>{var t;Fi(),O7(),rmt(),I7(),(t=cv||(cv={})).defaultData={schema:131,scene:_g.defaultData,frames:new Ve().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",V2.defaultData),shared:{...Kl.emptyData(),colors:Kl.defaultColors()}},t.createDefaultData=function(){return mS.deserialize(mS.serialize(t.defaultData))},t.emptyDataForImports=function(){return{schema:131,scene:_g.emptyDataWithPage(),frames:new Ve().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",V2.defaultData),shared:{...Kl.emptyData(),colors:Kl.defaultColors(),images:Kl.defaultImages()}}},t.emptyData=function(){return{schema:131,scene:_g.emptyDataWithPage(),frames:new Ve().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",V2.defaultData),shared:Kl.emptyData()}},t.clipboard2dData=function(){return{schema:131,scene:_g.emptyData(),frames:new Ve,shared:Kl.emptyData()}},t.withoutLib=function(e){return{...e,shared:{...e.shared,lib:hc.defaultData()}}},t.getComponentData=function(e,i){return Kg.getComponentData(e,i)},t.hasSensitiveData=function(e){let i=Object.values(e.shared.userAPIs);for(let r of i){let s=r.headers;for(let n of s)if(n.data.key.toLowerCase()==="authorization"&&n.data.value!=="")return!0}return!1}}),mTt=W(()=>{(L8||(L8={})).emptyImage={data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=",name:"empty"}});function zg(t,e=[0,0]){return[t&&!isNaN(t[0])?t[0]:e[0],t&&!isNaN(t[1])?t[1]:e[1]]}function Zb(t,e,i){switch(t){case 0:return"cubicBezier( 0, 0, 1, 1 )";case 1:return"cubicBezier( .25, .1, .25, 1 )";case 2:return"cubicBezier( .42, 0, 1, 1 )";case 3:return"cubicBezier( 0, 0, .58, 1 )";case 4:return"cubicBezier( .42, 0, .58, 1 )";case 7:return"cubicBezier( .25, 1, .5, 1 )";case 5:{let{control1:r,control2:s}=e??{...Dv.defaultData};return`cubicBezier( ${r[0]}, ${r[1]}, ${s[0]}, ${s[1]} )`}case 6:{let{mass:r,stiffness:s,damping:n,velocity:a}=i??{...Yp.defaultData},o=new nmt(r,s,n,a),l=o.solve(1);return()=>u=>o.solve(u)/l}case 8:return()=>r=>Math.floor(r)}}var bX,_X,Lg,yS,nmt,YR,KR,amt=W(()=>{Fi(),_l(),(bX||(bX={})).defaultData=function(t,e){return{id:t,name:e,duration:5,objectTimelines:new Ve}},(_X||(_X={})).is=function(t){return t&&typeof t.x=="number"&&typeof t.y=="number"&&typeof t.z=="number"},(t=>{function e(h,d){let c=[0,0],p=[1,1];if(h?.cubicControls)c=zg(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=zg(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(!t.BEZIER_PRESETS.includes(h))return;let d={type:h};return{control1:e(d).control1,control2:e(void 0,d).control2}}function r(h,d){return Math.abs(h[0]-d[0])<.001&&Math.abs(h[1]-d[1])<.001}function s(h){let d=t.ROOT_PROPERTY_ORDER.indexOf(h[0]);return d===-1?t.ROOT_PROPERTY_ORDER.length:d}function n(h){return h.layerId??h.path.join(".")}function a(h){let d=h[h.length-1];return yS.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]}}}}}t.getControlsWithDefault=e,t.BEZIER_PRESETS=[0,1,2,3,4,7],t.presetHandles=i,t.presetForHandles=function(h){return t.BEZIER_PRESETS.find(d=>{let c=i(d);return c!==void 0&&r(c.control1,h.control1)&&r(c.control2,h.control2)})},t.defaultData=function(h){return{id:h,keyframes:new fe}},t.ROOT_PROPERTY_ORDER=["position","rotation","scale","shape size","material","opacity","camera","light","cloner","path extrusion","path snapping"],t.rowOrder=s,t.propertyKey=n,t.groupKeyframes=function(h,d){let c=new Map;for(let p of h){let m=p.data;if(d?.(m))continue;let f=n(m),g=c.get(f);g||(g={id:f,path:m.path,keyframes:[],layerId:m.layerId,index:m.index},c.set(f,g)),m.isPlaceholder?g.placeholder=p.id:g.keyframes.push(p)}return[...c.values()].sort((p,m)=>{let f=s(p.path)-s(m.path);return f!==0?f:(p.index??0)-(m.index??0)})},t.rowAxis=a,t.drawnRowKey=o,t.drawnRows=function(h){let d=new Map;for(let c of h){let p=a(c.path),m=p?c.path.slice(0,-1):c.path,f=o(c),g=d.get(f);g||(g={id:f,path:m,layerId:c.layerId,index:c.index,tracks:[]},d.set(f,g)),g.tracks.push({axis:p,property:c})}return[...d.values()]},t.sortedKeyframes=function(h){return[...h].sort((d,c)=>d.data.time-c.data.time)},t.materialLayerPath=l,t.createMaterialGroup=function(h,d){return h.map(({data:c,id:p},m)=>u(d(),l(c),{layerId:p,index:m}))},t.placeholderKeyframe=u,t.createName=function(h){return Object.entries(h).reduce((d,[c,p])=>(typeof p!="string"&&d.push({name:p.name}),d),[])},t.Presets=[{name:"Slide in",animationParams:{translateX:{value:[-20,0],easing:Zb(3),duration:1e3},opacity:{value:[0,1],easing:Zb(3),duration:1e3},endDelay:250,loop:!0}},{name:"Rotate",animationParams:{rotate:{value:[0,"1turn"],easing:Zb(5),duration:700},endDelay:250,loop:!0}},{name:"Scale Out",animationParams:{scale:{value:[1,1.5],easing:Zb(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:Zb(5),duration:500},endDelay:500,loop:!0}},{name:"Bounce",animationParams:{translateY:{value:["20px","-20px"],duration:575,easing:"easeOutQuad"},direction:"alternate",loop:!0}}]})(Lg||(Lg={})),yS=["x","y","z"],nmt=class{constructor(t=1,e=100,i=10,r=0){this.mass=t,this.stiffness=e,this.damping=i,this.initialVelocity=r,this.m_w0=Math.sqrt(e/t),this.m_zeta=i/(2*Math.sqrt(e*t)),this.m_zeta<1?(this.m_wd=this.m_w0*Math.sqrt(1-this.m_zeta*this.m_zeta),this.m_A=1,this.m_B=(this.m_zeta*this.m_w0-r)/this.m_wd):(this.m_wd=0,this.m_A=1,this.m_B=-r+this.m_w0)}solve(t){return 1-(this.m_zeta<1?Math.exp(-t*this.m_zeta*this.m_w0)*(this.m_A*Math.cos(this.m_wd*t)+this.m_B*Math.sin(this.m_wd*t)):(this.m_A+this.m_B*t)*Math.exp(-t*this.m_w0))}getDuration(){let t=.16666666666666666,e=0,i=0;for(;;)if(e+=t,this.solve(e)===1){if(i++,i>=16)break}else i=0;return e*t*1e3}}}),B7=W(()=>{var t;_l(),Fi(),(YR||(YR={})).list=["idle","move","jump","run"],(t=KR||(KR={})).defaultColliderData={type:"capsule",height:200,radius:50,position:[0,0,0],rotation:[0,0,0]},t.defaultDataThirdPerson={moveMode:"walk",forwardDirection:"+z",speedTranslate:1e3,speedRotate:100,runMultiplier:2,rotationMode:"normal",rotBy:"keys",rotByTouch:"drag",delayPos:[.3,.3],delayRot:[.3,.3],keyAssignments:[["moveNegZ","W"],["moveNegX","A"],["movePosZ","S"],["movePosX","D"],["rotPosX","\u25B2"],["rotPosY","\u25C0"],["rotNegX","\u25BC"],["rotNegY","\u25B6"],["jump","Space"],["run","\u21E7"],["none","Ctrl"]],touchControl:!0,joystickPosLoc:5,joystickRotLoc:11,jumpTouchButtonLoc:9,collider:t.defaultColliderData,colliderHelperVisible:!0,collisionEnabled:!0,jumpPower:100,resetYPosition:3e3,alignToGround:!1,autoOrientMove:!0,orientWith:"camera",orientMode:"radial",delayPosCamera:.3,delayRotCamera:.3,camera:"",cameraXAxis:"Limit",cameraYAxis:"Free",cameraRotXLimits:[0,Math.PI/2],cameraRotYLimits:[-Math.PI/2,Math.PI/2],gameActions:{idle:new fe,move:new fe,jump:new fe,run:new fe},navmesh:{enabled:!1,ch:6,cs:6,walkableClimb:5,walkableHeight:1,walkableRadius:0,zones:"all",objects:[],helperVisible:!0,destinationHelperRadius:0,destinationHelperColor:Hi.fromHexAndA(3728051,1)}}});function tg(t,...e){let i={};for(let r of e.flat())t!=null&&r in t&&(i[r]=t[r]);return i}function xX(t){t.layers.forEach(e=>{if(e.type==="depth"&&e.colorA!==void 0){let i=e.colorA,r=e.colorB,s=[[i.r,i.g,i.b,i.a],[r.r,r.g,r.b,r.a]],n=[0,1];for(let o=2;o<10;o++)s.push(s[1]),n.push(1);let a={...tg(js(e),"type","visible","isVector","isWorldSpace","origin","alpha","mode"),near:Math.max(0,e.near),far:Math.max(0,e.far),colors:s,steps:n,num:2,direction:[1,0,0],smooth:!1,gradientType:1};Object.assign(e,a)}else if(e.type==="depth"&&e.gradientType===1&&(e.near<0||e.far<0)){let i={...js(e),near:Math.max(e.near,0),far:Math.max(e.far,0)};Object.assign(e,i)}})}function Kd(t,e){Object.values(t.shared.materials).forEach(i=>e(i))}function Zd(t,e){t.scene.objects.traverse((i,r)=>{"materials"in r?r.materials.forEach((s,n)=>{s===void 0&&(r.materials[n]=ds.defaultTwoLayerData("phong"),s=r.materials[n]),typeof s!="string"&&e(s)}):"material"in r?typeof r.material!="string"&&(r.material===void 0&&(r.material=ds.defaultTwoLayerData("phong")),e(r.material)):r.type==="Mesh"&&(r.material===void 0&&(r.material=ds.defaultTwoLayerData("phong")),e(r.material)),"overrides"in r&&Object.values(r.overrides).forEach(s=>{s.material&&typeof s.material!="string"&&Object.getPrototypeOf(s.material)!==$s.prototype&&e(s.material)})})}function wX(t){t.layers===void 0&&Object.assign(t,ds.defaultTwoLayerData("lambert"))}function VD(t){!t.layers||t.layers.forEach(e=>{if(e.type==="depth"&&e.colors.length===10){let i=[...e.colors];i.push(e.colors[9]);let r=[...e.steps];r.push(e.steps[9]);let s={...js(e),colors:i,steps:r};Object.assign(e,s)}})}function SX(t){t.scene.objects.traverse((e,i)=>{"materials"in i?i.materials.forEach(r=>{typeof r!="string"&&VD(r)}):"material"in i&&typeof i.material!="string"&&VD(i.material)}),Object.values(t.shared.materials).forEach(e=>VD(e))}function TX(t){t.layers&&t.layers.forEach(e=>{e.type==="depth"&&e.num!==void 0&&(e.colors=e.colors.slice(0,e.num),e.steps=e.steps.slice(0,e.num),delete e.num)})}function MX(t){t.layers&&t.layers.forEach(e=>{(function(i){return i.type!=="displace"})(e)&&e.isMask===void 0&&(e.isMask=!1),(e.type==="texture"||e.type==="video")&&e.blending===void 0&&(e.blending=0),(e.type==="noise"||e.type==="displace"&&e.displacementType==="noise")&&(e.voronoiStyle===void 0&&(e.voronoiStyle=0),e.highCut===void 0&&(e.highCut=1),e.lowCut===void 0&&(e.lowCut=0),e.smoothness===void 0&&(e.smoothness=.3),e.seed===void 0&&(e.seed=0),e.quality===void 0&&(e.quality=1))})}function AX(t){let e=t.layers.find(i=>i.type==="light")?.data;if(e?.category==="basic"){let i=Gs.defaultData("light","phong"),r=e;Object.assign(r,i),r.visible=!1}}function CX(t){Kd(t,AX),Zd(t,AX)}function EX(t){t.layers.forEach(e=>{e.type==="light"&&e.category!=="toon"&&e.occlusion===void 0&&(e.occlusion=!0)})}function PX(t){t.layers&&t.layers.forEach(e=>{e.type==="light"&&e.bumpMapIntensity===void 0&&(e.bumpMapIntensity=5)})}var fTt=W(()=>{IS(),_l(),D7(),a5(),Fi(),o5(),oa(),yt(),P7(),B7(),imt(),O7(),E7(),N7()}),omt={};function RX(t){t.layers&&t.layers.forEach(e=>{e.type==="light"&&e.alphaOverride===void 0&&(e.alphaOverride=1)})}function NX(t){t.rotation=t.rotation.slice(0,3).map(e=>e*dg)}function lmt(t){NX(t),t.type==="Page"&&NX(t.camera),t.states?.forEach(i=>{i.rotation===void 0||i.rotation===null||(i.rotation=i.rotation.slice(0,3).map(r=>r*dg))});let e=t.geometry;e&&e.type==="SphereGeometry"&&(e.thetaLength=(e.thetaLength??180)*dg),e&&e.type==="TorusGeometry"&&(e.arc=e.arc*dg),e&&e.type==="PathGeometry"&&(e.extrusion.angle*=dg,e.extrusion.twist*=dg),t.type==="Mesh"&&t.geometry.type==="TextGeometry"&&(t.geometry.text={textValue:t.geometry.text}),Array.isArray(js(t.events))&&t.events?.forEach(i=>{(i.type==="MouseDown"||i.type==="MouseUp"||i.type==="MousePress"||i.type==="KeyDown"||i.type==="KeyUp"||i.type==="KeyPress"||i.type==="Collision"||i.type==="Trigger")&&(i.runMode=i.toggle?"Toggle":"Repeat")})}function gTt(t){t.scene.objects.traverse((e,i)=>{})}function yTt(t){let e=t.schema??104;e!==131&&e<130&&(ZR(t.asset),t.schema=130)}function H1(t,e){e(t.data);for(let i of t.children)H1(i,e)}function hmt(t){let e=t.schema??104;e!==131&&(e<105&&(H1(t.asset,lmt),t.schema=105),e<118&&(H1(t.asset,dmt),t.schema=118),e<121&&(H1(t.asset,U8),t.schema=121),e<130&&(H1(t.asset,vTt),t.schema=130))}function umt(t,e){Zd(t,e),Kd(t,e),Object.values(t.shared.lib.materials).forEach(i=>e(i.asset))}function ZR(t){t.layers===void 0&&Object.assign(t,ds.defaultTwoLayerData("phong"))}function vTt(t){"materials"in t?t.materials.forEach(e=>{e!==void 0&&typeof e!="string"&&ZR(e)}):"material"in t&&t.material!==void 0&&typeof t.material!="string"&&ZR(t.material)}function dmt(t){t.timelineAnimations=Xa({},Ve.prototype)}function bTt(t){let e=[];return t?(t.forEach((i,r)=>{let{path:s,keyframes:n}=i.data,a=s[0]==="material"?i.id:void 0;n?.length?n.forEach(({id:o,data:l})=>{e.push({id:o,data:{...l,path:s,layerId:a,index:r}})}):e.push(Lg.placeholderKeyframe(i.id,s,{layerId:a,index:r}))}),e.sort((i,r)=>i.data.time-r.data.time),new fe(...e.map((i,r)=>({...i,fi:r})))):new fe}function _Tt(t){for(let{id:e,data:i}of[...t.unproxy()]){let r=i.path?.[0];if(!r||!cmt.includes(r))continue;let s=F8(i.value);if(!s.length)continue;let n=t.data(e);if(!n)continue;let a=i.value,[o,...l]=s;for(let u of l){let h=Yt.generateUUID();t.insertBefore(null,[{id:h,data:{...i,id:h,path:[r,u],value:a[u],easing:xTt(i.easing)}}])}n.path=[r,o],n.value=a[o]}}function F8(t){return t===null||typeof t!="object"?[]:yS.filter(e=>e in t)}function xTt(t){let e=t?.cubicControls;return{...t,cubicControls:{control1:[...e?.control1??[0,0]],control2:[...e?.control2??[1,1]]},...t?.springParameters?{springParameters:{...t.springParameters}}:{}}}function wTt(t,e){return Math.abs(t[0]-e[0])<1e-6&&Math.abs(t[1]-e[1])<1e-6}function STt(t){let e=function(n){let a=[];for(let o of Lg.groupKeyframes(n)){let l=new Set(o.keyframes.flatMap(h=>F8(h.data.value))),u=l.size?[...l].map(h=>o.keyframes.filter(d=>F8(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}([...t.unproxy()]),i=new Map,r=new Set;for(let{left:n,right:a}of e){let o=n.data.easing?.type,l=(o===void 0?void 0:Lg.presetHandles(o))?.control2??(o===5?zg(a.data.easing?.cubicControls?.control2,[1,1]):void 0);if(!l)continue;let u=i.get(a.id);u?wTt(u,l)||r.add(a.id):i.set(a.id,l)}let s=new Map;for(let{id:n,data:a}of t.unproxy()){let o=a.easing?.type,l=o===void 0?void 0:Lg.presetHandles(o);l&&s.set(n,l.control1)}for(let{left:n,right:a}of e)r.has(a.id)&&s.delete(n.id);for(let[n,a]of s){let o=t.data(n);!o?.easing||(o.easing.cubicControls={control1:a,control2:zg(o.easing.cubicControls?.control2,[1,1])},o.easing.type=5)}for(let{left:n,right:a}of e){if(!s.has(n.id))continue;let o=t.data(a.id),l=i.get(a.id);!o?.easing||!l||(o.easing.cubicControls={control1:zg(o.easing.cubicControls?.control1,[0,0]),control2:l})}}function DX(t,e){t.scene.objects.traverse((i,r)=>{let s=r;if(s.type==="Page"&&s.timelines)for(let n of Object.values(s.timelines))for(let a of Object.values(n.objectTimelines??{}))e(a.keyframes)})}function U8(t){t.pivot=[0,0,0],t.pivotRotation=[0,0,0]}function TTt(t){}function MTt(t){let e=t.schema??0;if(e!==131){if(e>131)return void console.error(`This scene was created with a newer version of Spline (file format ${e}, this runtime reads 131). Update @splinetool/runtime to the latest version to load it correctly.`);console.warn("updating from ",e,"to ",131),function(i,r){if(r<1&&(Zd(i,xX),Kd(i,xX),i.schema=1),r<2&&(function(s){Object.assign(s.scene.publish,{orbitControls:{...XR.defaultData,...js(s.scene.publish.orbitControls)}})}(i),i.schema=2),r<3&&(function(s){function n(a){if(a.layers){for(let o of Object.values(a.layers))if(o){for(let[l,u]of Object.entries(o))if((n5.includes(l)||typeof u=="boolean")&&delete o[l],l==="texture")for(let[h,d]of Object.entries(u))(A7.includes(h)||typeof d=="boolean")&&delete u[h]}}}s.scene.objects.traverse((a,o)=>{o.states.forEach(l=>{let u=l;u.material?n(u.material):u.materials&&u.materials.forEach(h=>{n(h)})})})}(i),i.schema=3),r<4&&(function(s){s.scene.publish.withBackground=!0}(i),i.schema=4),r<5&&(function(s){s.scene.publish.settings.web={compress:!0,preload:!0,preset:1,logo:!0,hint:!1}}(i),i.schema=5),r<6&&(function(s){s.scene.objects.traverse((n,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(s){s.scene.objects.traverse((n,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&&(SX(i),i.schema=9),r<10&&(function(s){s.scene.objects.traverse((n,a)=>{a.type==="Mesh"&&(a.geometry.type==="BooleanGeometry"||a.geometry.type==="SubdivGeometry")&&(a.geometry.phongAngle=35)})}(i),i.schema=10),r<11&&(function(s){s.scene.environment.ambientLight.softShadows=!1,s.scene.environment.ambientLight.softShadowQuality="low",s.scene.objects.traverse((n,a)=>{(a.type==="DirectionalLight"||a.type==="SpotLight")&&(a.shadowResolution=1024,a.shadowRadius=1,a.depth=1e5)}),s.shared.penumbraSize=new Array(5).fill(.5)}(i),i.schema=11),r<12&&(SX(i),i.schema=12),r<13&&(function(s){s.shared.audios=Xa({},Ve.prototype)}(i),i.schema=13),r<14&&(function(s){let n=s.shared.materials;Object.entries(n).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(n,{[a]:l})}})}(i),i.schema=14),r<15&&(function(s){Object.entries(js(s.shared.images)).filter(n=>n[1].asset===!1).map(n=>n[0]).forEach(n=>{delete s.shared.images[n]}),Object.entries(js(s.shared.audios)).filter(n=>n[1].asset===!1).map(n=>n[0]).forEach(n=>{delete s.shared.audios[n]})}(i),i.schema=15),r<16&&(function(s){s.scene.publish.settings.web.preload=!1}(i),i.schema=16),r<17&&(Zd(i,TX),Kd(i,TX),i.schema=17),r<18&&(Zd(i,wX),Kd(i,wX),i.schema=18),r<19&&(function(s){Object.assign(s.scene.publish.settings,{video:{...vc.defaultData.settings.video,...js(s.scene.publish.settings.video)}})}(i),i.schema=19),r<20&&(function(s){s.shared.fonts=Xa({},Ve.prototype)}(i),function(s){let n=[];s.scene.objects.traverse((a,o)=>{let l=o;if(l.type==="TextFrame"){let u=ds.defaultTwoLayerData("phong"),h=typeof l.color=="string"?s.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(m){return m.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(f=>f.charAt(0).toUpperCase()+f.slice(1)).join(" ")}(l.font);s.shared.fonts[d]===void 0&&(s.shared.fonts[d]={name:d});let c={name:l.name,...rn.defaultData,...Bu.defaultData,flatShading:!1,wireframe:!1,geometry:{...lc.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:js(l.states),events:js(l.events),visible:l.visible,raycastLock:l.raycastLock,position:l.position,rotation:l.rotation,scale:l.scale,hiddenMatrix:l.hiddenMatrix},p=js(s.scene.objects).parent(a);s.scene.objects.insertAfter(p??null,a,[{id:a+"new",data:c,children:[]}]),n.push(a)}}),n.forEach(a=>{s.scene.objects.delete(a)})}(i),i.schema=20),r<21&&(function(s){let n={0:"MouseDown",1:"MouseUp",2:"MouseHover",5:"KeyDown",6:"KeyUp",7:"Start",9:"LookAt",10:"Follow",11:"Scroll",12:"Audio",13:"GameControl"};s.scene.objects.traverse((a,o)=>{o.events.forEach(l=>{if(n[Number(l.type)])if(Object.assign(l,{type:n[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 fe,move:new fe,jump:new fe}});else{let u=new fe;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:Yt.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,tg(h,"mass","stiffness","damping","velocity")):h.easing===5&&Object.assign(p,{control1:{...h.control1},control2:{...h.control2}});let m={repeat:h.repeat?-1:0,delay:h.delay,delayDirection:h.delayDirection,direction:h.cycle&&h.rewind?"pingpong-rewind":h.cycle?"pingpong":"normal"},f={state:h.state,...m,...p},g={allowSlerp:!0,type:"Transition",object:h.object,repeat:0,delay:0,delayDirection:void 0,direction:"normal",tweens:new fe({fi:0,id:Yt.generateUUID(),data:{state:void 0,repeat:0,delay:0,delayDirection:void 0,direction:"normal",duration:0,easing:4}},{fi:1,id:Yt.generateUUID(),data:f})};u.push({fi:c,id:d,data:g})}),delete l.targets)}})})}(i),function(s){s.scene.objects.traverse((n,a)=>{function o(l,u){let h=new fe,d=[];if(a.events.forEach((c,p,m)=>{if(c.type==="Audio"&&c.trigger===u){let f;d.push(p),c.interaction==="play"?f={...tg(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")&&(f={...tg(c,"interaction","delay","object","playAudio"),type:"Audio"}),f&&h.push({fi:m,id:p,data:f})}}),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:Yt.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&&(CX(i),i.schema=22),r<23&&(function(s){s.scene.objects.traverse((n,a)=>{a.type==="Mesh"&&a.geometry.type==="SubdivGeometry"&&(a.geometry.scaleBaked||(a.geometry.scaleBaked=[1,1,1]))})}(i),i.schema=23),r<24&&(function(s){s.scene.objects.traverse((n,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(s){s.shared.videos=Xa({},Ve.prototype)}(i),r<25&&(i.schema=25)),r<26&&(function(s){s.scene.objects.traverse((n,a)=>{let o=s.scene.objects.unproxy().parent(n);if(o){let l=js(s.scene.objects.data(o));l&&l.type==="Mesh"&&l.geometry.type==="BooleanGeometry"&&a.type==="Mesh"&&(a.visible=js(a).booleanExclude!==!0)}})}(i),i.schema=26),r<27&&(function(s){s.scene.objects.traverse((n,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&&(CX(i),i.schema=28),r<29&&(function(s){function n(o){Object.setPrototypeOf(o,$s.prototype),o.texture&&Object.setPrototypeOf(o.texture,$s.prototype)}function a(o){Object.setPrototypeOf(o,$s.prototype);for(let l in o)n(o[l])}s.scene.objects.traverse((o,l)=>{l.states.forEach(u=>{let h=u;if(h.material){let d=js(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=js(c).layers;a(p),c.layers=p}})})}(i),i.schema=29),r<30&&(function(s){s.scene.objects.traverse((n,a)=>{a.type==="Mesh"&&a.geometry.type==="NonParametricGeometry"&&!("material"in a)&&!("materials"in a)&&(a.material=ds.defaultTwoLayerData("phong"))})}(i),i.schema=30),r<31&&(function(s){s.scene.publish.orbitControls.autoZoom===void 0&&(s.scene.publish.orbitControls.autoZoom=!1),s.scene.objects.traverse((n,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(s){s.scene.objects.traverse((n,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(s){s.scene.publish.mouseEventTarget===void 0&&(s.scene.publish.mouseEventTarget="canvas"),s.scene.publish.settings.web.hint===void 0&&(s.scene.publish.settings.web.hint=!1)}(i),i.schema=34),r<35&&(function(s){let{video:n}=s.scene.publish.settings;n.format==="gif"&&n.fps>48&&(n.fps=15)}(i),i.schema=35),r<36&&(function(s){s.scene.objects.traverse((n,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&(o.resetYPosition=Math.abs(o.resetYPosition-a.position[1]))})})}(i),i.schema=36),r<37&&(function(s){let n=s.scene.environment.usePhysics;s.scene.objects.traverse((a,o)=>{n&&o.physics===null?o.collision=!1:o.collision="visibility"})}(i),i.schema=37),r<38&&(Zd(i,MX),Kd(i,MX),i.schema=38),r<39&&(function(s){s.scene.objects.traverse((n,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&(o.navmesh=KR.defaultDataThirdPerson.navmesh)})})}(i),i.schema=39),r<40&&(function(s){s.scene.styles||(s.scene.styles=bg.defaultData())}(i),i.schema=40),r<41&&(function(s){s.scene.environment.ambientLight.occlusion===void 0&&(s.scene.environment.ambientLight.occlusion=!1),s.scene.environment.ambientLight.aoFullRes===void 0&&(s.scene.environment.ambientLight.aoFullRes=!1),s.scene.environment.ambientLight.radius===void 0&&(s.scene.environment.ambientLight.radius=256),s.scene.environment.ambientLight.bias===void 0&&(s.scene.environment.ambientLight.bias=.5),s.scene.environment.ambientLight.aoColor===void 0&&(s.scene.environment.ambientLight.aoColor={r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}),Zd(s,EX),Kd(s,EX)}(i),i.schema=41),r<42&&(function(s){s.scene.objects.traverse((n,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&Object.assign(o.gameActions,{run:new fe})})})}(i),i.schema=42),r<43&&(function(s){s.scene.objects.traverse((n,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&(o.keyAssignments=[...o.keyAssignments,["run","\u21E7"],["none","Ctrl"]])})})}(i),i.schema=43),r<99){Zd(i,PX),Kd(i,PX),i.scene.publish.playCamera===null&&(i.scene.publish.playCamera=i0);let s=js(i.scene.objects),n=i.scene.objects;i.scene.publish.playPage=ov,n.insertBefore(null,null,[{id:ov,data:{...kg.defaultData,backgroundColor:i.scene.backgroundColor,fog:i.scene.fog,postprocessing:i.scene.postprocessing,ao:tg(i.scene.environment.ambientLight,"occlusion","aoFullRes","radius","bias","aoColor"),publish:{playCamera:i.scene.publish.playCamera,gameControlObject:i.scene.publish.gameControlObject},shadow:tg(i.scene.environment.ambientLight,"softShadowQuality"),globalPhysics:{...dv.defaultData,...tg(i.scene.environment,"usePhysics","gravity")},camera:js(i.scene.ownerCamera)??kg.defaultData.camera,name:"Scene"},children:[]}]);for(let l of s)l.id!==_g.TRASH_CAN_ID&&n.move(ov,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,hv.defaultData)),u.physics!==void 0&&u.physics!==null&&(u.physics.enabled=u.collision??"visibility",delete u.collision)}),i.schema=99}}(t,e),e<100&&(t.scene.publish.joystickSizeAndXYOffset===void 0&&(t.scene.publish.joystickSizeAndXYOffset=vc.defaultData.joystickSizeAndXYOffset),t.schema=100),e<101&&(Zd(t,RX),Kd(t,RX),t.schema=101),e<102&&(function(i){i.scene.objects.traverse((r,s)=>{let n=s.geometry;n&&n.type==="PathGeometry"&&(n.extrusion.capType="flat",n.extrusion.bevel=50,n.extrusion.bevelSides=6,n.extrusion.shape.type==="Custom"&&(n.extrusion.shape.shapeQuality="low"))})}(t),t.schema=102),e<104&&(t.shared.catelogs=new Ve,t.shared.lib=hc.defaultData(),t.schema=104),e<105&&(function(i){i.shared.variables=Xa({},Ve.prototype)}(t),t.scene.objects.traverse((i,r)=>{lmt(r)}),t.schema=105);for(let i of Object.values(t.shared.lib.components))hmt(i);e<106&&(function(i){let r=js(i.shared.variables);i.shared.variables=Xa(Object.entries(r??{}).map(([s,n],a)=>({fi:a,id:s,data:n})),fe.prototype)}(t),t.schema=106),e<107&&(t.shared.lib.variables=hc.defaultData().variables,t.schema=107),e<109&&(function(i){i.shared.particles=Xa({},Ve.prototype),i.shared.lib&&(i.shared.lib.particles=hc.defaultData().particles)}(t),t.schema=109),e<110&&(function(i){i.scene.objects.traverse((r,s)=>{s.type==="Particle"&&typeof s.renderMaterial.size=="number"&&Object.assign(s.renderMaterial,{size:[s.renderMaterial.size,s.renderMaterial.size]})})}(t),t.schema=110),e<111&&(t.scene.objects.traverse((i,r)=>{(function(s){Array.isArray(js(s.events))&&s.events?.forEach(n=>{"disabled"in n||(n.disabled=!1),(n.type==="MouseDown"||n.type==="MouseUp"||n.type==="MousePress")&&(n.mode=n.mode||"Object")})})(r)}),t.schema=111),e<112&&(function(i){i.scene.objects.traverse((r,s)=>{s.type==="Page"&&(s.postprocessing.depthOfField.focusDistance=100,s.postprocessing.depthOfField.focalLength=20,s.postprocessing.depthOfField.bokehScale=5)})}(t),t.schema=112),e<113&&(function(i){i.scene.objects.traverse((r,s)=>{Array.isArray(js(s.events))!==!1&&s.events?.forEach(n=>{let a=n.runMode;n.type==="MouseDown"||n.type==="MouseUp"||n.type==="KeyDown"||n.type==="KeyUp"||n.type==="Collision"||n.type==="Trigger"?n.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode=a??"Repeat"),(o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode=a==="Toggle"?"Toggle":"Normal")}):n.type==="MouseHover"||n.type==="MousePress"||n.type==="KeyPress"?n.actions?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Toggle")}):n.type==="GameControl"?(delete n.actions,Object.keys(n.gameActions).forEach(o=>{n.gameActions[o]?.forEach(l=>{l.type==="Transition"&&(l.runMode="Repeat"),l.type==="Animation"&&(l.runMode="Normal")})})):n.type==="DragDrop"?(delete n.actions,n.dragDropActions?.drag?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Toggle")}),n.dragDropActions?.drop?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Toggle")})):n.type==="Resize"?(delete n.actions,n.breakpoints?.forEach(o=>{o.actions?.forEach(l=>{(l.type==="Transition"||l.type==="Animation"||l.type==="SwitchCamera")&&(l.runMode="Toggle")})})):n.type==="Start"?n.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Once"),(o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Normal")}):n.type==="VariableChange"||n.type==="Scroll"?n.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Normal")}):n.type==="Conditional"&&(delete n.actions,n.inActions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Normal")}),n.outActions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Normal")}))})})}(t),t.schema=113),e<114&&(t.scene.publish.settings.web.imageQuality===void 0&&(t.scene.publish.settings.web.imageQuality=70),t.schema=114),e<115&&(function(i){i.shared.userAPIs=Xa({},Ve.prototype),i.shared.userWebhooks=Xa({},Ve.prototype),i.shared.lib&&(i.shared.lib.userAPIs=hc.defaultData().userAPIs,i.shared.lib.userWebhooks=hc.defaultData().userWebhooks)}(t),t.schema=115),e<116&&(function(i){i.scene.publish.settings.videoStatic===void 0&&(i.scene.publish.settings.videoStatic=vc.defaultData.settings.videoStatic)}(t),t.schema=116),e<117&&(t.scene.publish.settings.web.pixelRatioMobile===void 0&&(t.scene.publish.settings.web.pixelRatioMobile=0),t.scene.publish.settings.web.pixelRatioDesktop===void 0&&(t.scene.publish.settings.web.pixelRatioDesktop=0),t.schema=117),e<118&&(t.shared.timelineAnimations=Xa({},Ve.prototype),t.scene.objects.traverse((i,r)=>{dmt(r)}),t.schema=118),e<119&&(t.scene.publish.settings.videoStatic.format=cv.defaultData.scene.publish.settings.videoStatic.format,t.scene.publish.settings.videoStatic.imageFormat=cv.defaultData.scene.publish.settings.videoStatic.imageFormat,t.schema=119),e<120&&(t.scene.publish.settings.image.colorSpace="display-p3",t.scene.publish.settings.videoStatic.colorSpace="display-p3",t.schema=120),e<121&&(t.scene.objects.traverse((i,r)=>{U8(r),r.type==="Page"&&r.camera!==void 0&&U8(r.camera)}),t.schema=121),e<122&&(delete t.scene.publish.settings.video,t.scene.publish.orbitControls.rotationSpeed=cv.defaultData.scene.publish.orbitControls.rotationSpeed,t.schema=122),e<123&&(t.scene.objects.traverse((i,r)=>{r.type==="Page"&&r.sky===void 0&&(r.sky=Gp.defaultData)}),t.schema=123),e<124&&(e>=123&&t.scene.objects.traverse((i,r)=>{let s=r.sky;r.type==="Page"&&s!==void 0&&(typeof s.exposure=="number"&&(s.exposure=Math.round(s.exposure/5e-4*1e4)/1e4),s.lighting===void 0&&(s.lighting=Gp.defaultData.lighting))}),t.schema=124),e<125&&(t.scene.objects.traverse((i,r)=>{let s=r.sky;r.type==="Page"&&s!==void 0&&s.lightingIntensity===void 0&&(s.lightingIntensity=Gp.defaultData.lightingIntensity)}),t.schema=125),e<126&&(t.scene.objects.traverse((i,r)=>{let s=r.sky;r.type==="Page"&&s!==void 0&&(s.mode===void 0&&(s.mode="physical"),s.hdri===void 0?s.hdri={...Gp.defaultData.hdri}:(s.hdri.blur===void 0&&(s.hdri.blur=Gp.defaultData.hdri.blur),Array.isArray(s.hdri.rotation)&&(s.hdri.rotation=s.hdri.rotation[1]??0)))}),t.schema=126),e<127&&(t.scene.objects.traverse((i,r)=>{let s=r.sky;r.type==="Page"&&s?.hdri!==void 0&&s.hdri.showBackground===void 0&&(s.hdri.showBackground=!0)}),t.schema=127),e<128&&(t.scene.objects.traverse((i,r)=>{let s=r.sky;r.type==="Page"&&s!==void 0&&s.lightingQuality===void 0&&(s.lightingQuality="full")}),t.schema=128),e<129&&(t.scene.objects.traverse((i,r)=>{if(r.type==="Page"){r.camera===void 0&&(r.camera=kg.defaultData.camera);let s=r.camera;s.far=1e5,s.perspective?s.perspective.near=70:s.perspective={near:70,fov:45,zoom:1}}}),t.schema=129),e<130&&(umt(t,ZR),t.schema=130),e<131&&(function(i){i.scene.objects.traverse((r,s)=>{let n=s.states;if(!n)return;let a=s.timelineAnimations,o=[];n.forEach((l,u)=>{(l.isAnimation||a?.[u])&&o.push(u)}),o.forEach(l=>n.delete(l))})}(t),function(i){let r=i.shared,s=r.timelineAnimations;if(!s)return;let n=i.scene.objects,a=n.unproxy().find(o=>o.data.type==="Page")?.id;for(let[o,l]of Object.entries(s)){let u=Xa({},Ve.prototype),h=0,d=Boolean(l.loop);for(let[m,f]of Object.entries(l.mapping??{})){let g=n.data(m)?.timelineAnimations?.[f];!g||(h=Math.max(h,g.to??0),d=d||Boolean(g.loop),u[m]={id:m,keyframes:bTt(g.properties?.unproxy())})}let c=l.page??a,p=c?n.data(c):void 0;p&&p.type==="Page"&&((p.timelines??(p.timelines=Xa({},Ve.prototype)))[o]={id:o,name:l.name,duration:h||5,...d?{loop:d}:{},objectTimelines:u})}delete r.timelineAnimations,n.traverse((o,l)=>{delete l.timelineAnimations})}(t),DX(t,_Tt),DX(t,STt),t.schema=131)}}DS(omt,{updateAllMaterials:()=>umt,updateDocumentSchema:()=>MTt,updateLibSchema:()=>TTt,updateMaterialSchema:()=>yTt,updateObjectStateRec:()=>H1,updateObjectsSchema:()=>hmt,updateTextValues:()=>gTt});var dg,cmt,OX,eM,kD,IX,iM,xg,Qb,B0,rM,zD,dP,LD,FD,BX,cP,UD,Fg,j8,l5=W(()=>{yt(),smt(),Fi(),amt(),fTt(),o5(),IS(),oa(),I7(),a5(),R7(),dg=180/Math.PI,cmt=["position","rotation","scale","shape size"]}),ATt=W(()=>{var t,e,i;_l(),Fi(),oa(),(OX||(OX={})).is=function(r){return!0},(t=eM||(eM={})).defaultData={position:[0,0],scale:[1,1],rotation:0,shear:[0,0]},t.merge=function(r,s){return{position:s?.position??r.position,rotation:s?.rotation??r.rotation,scale:s?.scale??r.scale,shear:s?.shear??r.shear}},t.diff=function(r,s){return xpt({position:Hu.isEqual(r.position,s.position)?void 0:s.position,rotation:r.rotation===s.rotation?void 0:s.rotation,scale:Hu.isEqual(r.scale,s.scale)?void 0:s.scale,shear:r.shear&&s.shear&&Hu.isEqual(r.shear,s.shear)?void 0:s.shear})},(kD||(kD={})).defaultData={horizontalConstraint:0,verticalConstraint:0},(IX||(IX={})).defaultData={direction:"row",wrap:"unwrap",align:"top-left",gap:10,rowGap:10,autoGap:!1,autoRowGap:!1,leftPadding:8,rightPadding:8,topPadding:8,bottomPadding:8},(iM||(iM={})).defaultData={opacity:1,fill:{color:Hi.fromHexAndA(Xg,1),enabled:!0},stroke:{color:Hi.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:Hi.from0to1([0,0,0,1]),enabled:!1,spread:0},innerShadow:{offset:[10,10],blurRadius:10,color:Hi.from0to1([0,0,0,1]),enabled:!1,spread:0}},(e=xg||(xg={})).newEmpty=function(r,s){return{name:s}},e.patch=function(r,s){if(s===void 0)return r;let n={...r};return Object.assign(n,eM.merge(n,s)),n=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}(n,s),n=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}(n,s),n},e.toOps=function(r,s){let n,a=[];for(let[o,l]of Object.entries(s))o!=="name"&&(n===void 0&&(n={path:[],props:{},type:0},a.push(n)),n.props[o]=l);return a},(Qb||(Qb={})).defaultData={...eM.defaultData,...kD.defaultData,states:new fe,events:new fe,visible:!0,raycastLock:!1},(B0||(B0={})).defaultData={...Qb.defaultData,...iM.defaultData},(rM||(rM={})).defaultData={cornerRadius:[0,0,0,0]},(zD||(zD={})).defaultData={...B0.defaultData,type:"ellipse2d",width:100,height:100,name:"Ellipse"},(dP||(dP={})).defaultData={...B0.defaultData,...rM.defaultData,type:"rectangle2d",width:100,height:100,name:"Rectangle"},(LD||(LD={})).defaultData={...B0.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"},(FD||(FD={})).defaultData={...B0.defaultData,type:"path2d",path:"",name:"Path"},(BX||(BX={})).is=function(r){return r.type==="ellipse2d"||r.type==="rectangle2d"||r.type==="text2d"||r.type==="vector2d"||r.type==="path2d"},(cP||(cP={})).defaultData={...Qb.defaultData,name:"Group",type:"group2d"},(UD||(UD={})).defaultData=()=>({...Qb.defaultData,...rM.defaultData,...iM.defaultData,name:"Frame",type:"frame2d",clipped:!0,width:200,height:200,fill:{color:Hi.fromHexAndA(4737101,1),enabled:!0},stroke:{color:Hi.fromHexAndA(0,1),thickness:1,enabled:!1,mode:"inside"},backgroundBlur:{radius:2,enabled:!1},layerBlur:{radius:2,enabled:!1}}),(r=>{r.defaultData=function(s){switch(s){case"rectangle2d":case"vector2d":return{...dP.defaultData};case"ellipse2d":return{...zD.defaultData};case"text2d":return{...LD.defaultData};case"path2d":return{...FD.defaultData};case"frame2d":return{...UD.defaultData()};case"group2d":return{...cP.defaultData}}},r.getPivot=function(s){return"width"in s&&"height"in s?[typeof s.width=="number"?.5*s.width:0,typeof s.height=="number"?.5*s.height:0]:[0,0]},r.isResizeable=function(s){return s.type==="rectangle2d"||s.type==="ellipse2d"||s.type==="text2d"||s.type==="frame2d"},r.isAutoLayoutable=function(s){return s.type==="frame2d"&&s.autoLayout!==void 0},r.hasCorners=function(s){return s.type==="rectangle2d"||s.type==="frame2d"}})(Fg||(Fg={})),(i=j8||(j8={})).defaultData={name:"UI",type:"scene2d",objects:new Nn},i.emptyData=function(){return{type:"scene2d",objects:new Nn}}}),CTt=W(()=>{lTt(),hTt(),Wpt(),qpt(),smt(),Upt(),mTt(),Kpt(),Jpt(),R7(),l5(),rmt(),P7(),E7(),Hpt(),IS(),Ypt(),emt(),_l(),o5(),a5(),D7(),Qpt(),I7(),O7(),uTt(),Zpt(),B7(),N7(),$pt(),Xpt(),ATt()});function wg(t,e=!1){let i=t[0].index!==null,r=new Set(Object.keys(t[0].attributes)),s=new Set(Object.keys(t[0].morphAttributes)),n={},a={},o=t[0].morphTargetsRelative,l=new ye,u=0;for(let h=0;h<t.length;++h){let d=t[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;n[p]===void 0&&(n[p]=[]),n[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(!s.has(p))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphAttributes must be consistent throughout all geometries."),null;a[p]===void 0&&(a[p]=[]),a[p].push(d.morphAttributes[p])}if(e){let p;if(i)p=d.index.count;else{if(d.attributes.position===void 0)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". The geometry must have either an index or a position attribute"),null;p=d.attributes.position.count}l.addGroup(u,p,h),u+=p}}if(i){let h=0,d=[];for(let c=0;c<t.length;++c){let p=t[c].index;for(let m=0;m<p.count;++m)d.push(p.getX(m)+h);h+=t[c].attributes.position.count}l.setIndex(d)}for(let h in n){let d=VX(n[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 f=0;f<a[h].length;++f)p.push(a[h][f][c]);let m=VX(p);if(!m)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+h+" morphAttribute."),null;l.morphAttributes[h].push(m)}}}return l}function VX(t){let e,i,r,s=-1,n=0;for(let u=0;u<t.length;++u){let h=t[u];if(e===void 0&&(e=h.array.constructor),e!==h.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(i===void 0&&(i=h.itemSize),i!==h.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(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(s===-1&&(s=h.gpuType),s!==h.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;n+=h.count*i}let a=new e(n),o=new Se(a,i,r),l=0;for(let u=0;u<t.length;++u){let h=t[u];if(h.isInterleavedBufferAttribute){let d=l/i;for(let c=0,p=h.count;c<p;c++)for(let m=0;m<i;m++){let f=h.getComponent(c,m);o.setComponent(c+d,m,f)}}else a.set(h.array,l);l+=h.count*i}return s!==void 0&&(o.gpuType=s),o}var BS=W(()=>{yt()});function pmt(t){let e=t.points.length/7,i=new fe;for(let r=0;r<e;r++){let s=7*r,n=t.points[s+0],a=t.points[s+1],o=t.points[s+2],l=t.points[s+3],u=t.points[s+4],h=t.points[s+5],d=t.points[s+6];i.push({fi:r,id:Yt.generateUUID(),data:{roundness:d,position:[n,a],areControlsDirectionsMirrored:!0,controlPrevious:{position:[o,l]},controlNext:{position:[u,h]}}})}return{points:i,isClosed:t.isClosed,roundness:t.roundness,shapeHoles:t.shapeHoles?.map(r=>pmt(r))??[]}}function mmt(t){let{userData:e,uuid:i,...r}=t;if(e===void 0||e.type==="NonParametricGeometry")return function(a){let o,{userData:l,data:u}=a,h=u?.groups,d=u?.attributes??{},c=u?.morphAttributes??{},p=u?.interleavedBuffers,m=u?.arrayBuffers,f=u?.index;d.position!==void 0&&Array.isArray(d.position.array)&&(o=function(y){let v=1/0,b=1/0,_=1/0,x=-1/0,S=-1/0,w=-1/0;for(let M=0;M<y.length;M+=3){let T=y[M],A=y[M+1],C=y[M+2];v=Math.min(v,T),b=Math.min(b,A),_=Math.min(_,C),x=Math.max(x,T),S=Math.max(S,A),w=Math.max(w,C)}return{width:x-v,height:S-b,depth:w-_}}(d.position.array));let g={...l===void 0?{}:l.parameters,data:{attributes:d,morphAttributes:c,interleavedBuffers:p,arrayBuffers:m},...o===void 0?{}:o,type:"NonParametricGeometry"};return f!==void 0&&Object.assign(g.data,{index:f}),h!==void 0&&Object.assign(g.data,{groups:h.map(y=>({...y,materialIndex:y.materialIndex??0}))}),g}(t);if(e.type==="SubdivGeometry"){let a="SubdivGeometry",o=r.data?.attributes;if(o?.positionWASM===void 0){let u=new ye;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 me(h,3)),u.setIndex(new sm(c,1));let p=function(y,v=1e-4){v=Math.max(v,Number.EPSILON);let b={},_=y.getIndex(),x=y.getAttribute("position"),S=_?_.count:x.count,w=0,M=Object.keys(y.attributes),T={},A={},C=[],R=["getX","getY","getZ","getW"],O=["setX","setY","setZ","setW"];for(let V=0,H=M.length;V<H;V++){let U=M[V],et=y.attributes[U];T[U]=new et.constructor(new et.array.constructor(et.count*et.itemSize),et.itemSize,et.normalized);let at=y.morphAttributes[U];at&&(A[U]||(A[U]=[]),at.forEach((Q,ut)=>{let ht=new Q.array.constructor(Q.count*Q.itemSize);A[U][ut]=new Q.constructor(ht,Q.itemSize,Q.normalized)}))}let D=.5*v,B=Math.log10(1/v),k=Math.pow(10,B),j=D*k;for(let V=0;V<S;V++){let H=_?_.getX(V):V,U="";for(let et=0,at=M.length;et<at;et++){let Q=M[et],ut=y.getAttribute(Q),ht=ut.itemSize;for(let q=0;q<ht;q++)U+=~~(ut[R[q]](H)*k+j)+","}if(U in b)C.push(b[U]);else{for(let et=0,at=M.length;et<at;et++){let Q=M[et],ut=y.getAttribute(Q),ht=y.morphAttributes[Q],q=ut.itemSize,nt=T[Q],Tt=A[Q];for(let gt=0;gt<q;gt++){let vt=R[gt],ct=O[gt];if(nt[ct](w,ut[vt](H)),ht)for(let St=0,Mt=ht.length;St<Mt;St++)Tt[St][ct](w,ht[St][vt](H))}}b[U]=w,C.push(w),w++}}let z=y.clone();for(let V in y.attributes){let H=T[V];if(z.setAttribute(V,new H.constructor(H.array.slice(0,w*H.itemSize),H.itemSize,H.normalized)),V in A)for(let U=0;U<A[V].length;U++){let et=A[V][U];z.morphAttributes[V][U]=new et.constructor(et.array.slice(0,w*et.itemSize),et.itemSize,et.normalized)}}return z.setIndex(C),z}(u),m=[],f=new Array(d[d.length-1]+1).fill(3),g=p.getIndex().array;for(let y=0,v=d.length;y<v;)d[y]===d[y+1]?(f[d[y]]++,m.push(...new Set(g.slice(3*y,3*y+6))),y+=2):(m.push(...g.slice(3*y,3*y+3)),y++);o.indexWASM={array:m},o.positionWASM=p.attributes.position,o.verticesPerFaceWASM={array:f}}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,...ETt(o.positionWASM.array)};l.subdivisions=e.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 s=e.type,n=e.parameters;return s==="VectorGeometry"?(n.extrudeDepth&&(n.depth=n.extrudeDepth),{...n,width:100,height:100,shape:pmt(e.shape),type:s}):s==="LatheGeometry"?{...e.parameters,type:s,points:(e?.parameters.points??[]).map(a=>[a.x,a.y])}:(n.extrudeDepth&&(n.depth=n.extrudeDepth),{...n,type:s})}function ETt(t){return G8.setFromArray(t),G8.getSize(zw),{width:zw.x,height:zw.y,depth:zw.z}}var G8,zw,fmt,W8,pP,gmt,$v,Jb,sM,jD,Xv,kX,GD,zX,WD,Ov,jc,Gc,cd,qD,LX,FX,HD,q8,bc,PTt=W(()=>{Fi(),yt(),BS(),new At,new Pe,new ur,new P,new P,G8=new dr,zw=new P}),RTt=W(()=>{}),NTt=W(()=>{Fi(),l5()}),DTt=W(()=>{IS(),[...n5],new Set(A7)}),Le=W(()=>{CTt(),RTt(),pTt(),l5(),NTt(),amt(),DTt(),B7(),Fi()}),V7=W(()=>{fmt=[3,4,8,9],W8=5,pP=3,gmt=32}),VS=W(()=>{yt(),$v=t=>{var e;return(e=class extends t{}).geometryHelper=new Kh(30,30,30),e}}),kS=W(()=>{yt(),Jb=new pc,sM=new Zn,jD=new At,Xv=(t,e,i,r,s=!1,n=t)=>{let a=e,o=n.matrixWorld;if(a.boundingSphere===null&&a.computeBoundingSphere(),sM.copy(a.boundingSphere),sM.applyMatrix4(o),i.ray.intersectsSphere(sM)===!1||(jD.copy(o).invert(),Jb.copy(i.ray).applyMatrix4(jD),a.boundingBox!==null&&Jb.intersectsBox(a.boundingBox)===!1))return;let l,u,h,d,c,p,m=a.index,f=a.attributes.position,g=a.drawRange;if(s===!1){for(c=Math.max(0,g.start),p=Math.min(m.count,g.start+g.count);c<p;c+=3)if(u=m.getX(c),h=m.getX(c+1),d=m.getX(c+2),l=y(t,i,Jb,f,u,h,d),l)return l.faceIndex=Math.floor(c/3),void r.push(l)}else{let v=a.attributes.position,b=new P,_=new P,x=new P,S=new P,w=2,M=1/((n.scale.x+n.scale.y+n.scale.z)/3),T=M*M;for(let A=Math.max(0,g.start),C=Math.min(v.count,g.start+g.count)-1;A<C;A+=w){if(b.fromBufferAttribute(v,A),_.fromBufferAttribute(v,A+1),Jb.distanceSqToSegment(b,_,S,x)>T)continue;S.applyMatrix4(n.matrixWorld);let R=i.ray.origin.distanceTo(S);R<i.near||R>i.far||r.push({distance:R,point:x.clone().applyMatrix4(n.matrixWorld),object:t})}}function y(v,b,_,x,S,w,M){let T=new P,A=new P,C=new P,R=new P,O=new P;if(T.fromBufferAttribute(x,S),A.fromBufferAttribute(x,w),C.fromBufferAttribute(x,M),_.intersectTriangle(T,A,C,!1,R)===null)return null;O.copy(R),O.applyMatrix4(v.matrixWorld);let D=b.ray.origin.distanceTo(O);return D<b.near||D>b.far?null:{faceIndex:1,distance:D,point:O.clone(),object:v}}}}),h5=W(()=>{yt(),VS(),kS(),kX=new P(1,1,1),GD=new P,zX=new P,WD=new Pe,Ov=class extends $v(ppt){constructor(t,e=15){super(e),this.object=t,this.dummy=new Hv,this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${t.uuid}`,this.matrix=this.dummy.matrixWorld,this.matrixAutoUpdate=!1,this.object.isBone&&(this.visible=!1)}raycast(t,e){Xv(this.object,Ov.geometryHelper,t,e,!1,this.dummy)}update(){}updateMatrix(){}updateMatrixWorld(t){this.object.matrixWorld.decompose(GD,WD,zX),this.matrix.compose(GD,WD,kX),super.updateMatrixWorld(t)}updateWorldMatrix(t,e){}}}),OTt=W(()=>{yt(),jc=new P,Gc=new P,cd=new At,qD=[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)],LX=[[0,3],[1,2],[5,6],[4,7],[0,1],[3,2],[7,6],[4,5],[0,4],[1,5],[2,6],[3,7]],FX=[[0,2],[7,5],[4,1],[3,6],[4,3],[1,6]],HD=(t,e,i)=>{t.updateEntityBoxSize(jc,Gc),cd.copy(e).multiply(t.matrixWorld),Gc.x===0&&Gc.y===0&&Gc.z===0?i.push(new P(jc.x,jc.y,jc.z).applyMatrix4(cd)):qD.forEach(r=>{i.push(r.clone().multiply(Gc).add(jc).applyMatrix4(cd))})},q8=class extends dr{constructor(){super(...arguments),this.matrix=new At,this.vertices=[],this.faces=[],this.edges=[],this.centerEdges=[]}copy(t){return super.copy(t),this.matrix.copy(t.matrix),this.vertices=t.vertices.map(e=>e.clone()),this.faces=t.faces.map(e=>e.clone()),this.edges=t.edges.map(e=>e.clone()),this.centerEdges=t.centerEdges.map(e=>e.clone()),this}setFromObjectSize(t,e=!1){t.updateWorldMatrix(!1,e),this.makeEmpty(),this.matrix.copy(t.matrixWorld);let i=new At().copy(t.matrixWorld).invert();return this.expandByObjectSize(t,i,e)}expandByObjectSize(t,e,i=!1){let r=[];if(i===!0){let s=[];t.traverseEntity(n=>{if(n.visible||n.cloner&&n.data.visible){if(!("geometry"in n))return cd.copy(e).multiply(n.matrixWorld),void s.push(new P().applyMatrix4(cd));HD(n,e,r)}}),r.length===0&&r.push(...s)}else HD(t,e,r);return this.setFromPoints(r)}getCenter(t){return(t=super.getCenter(t)).applyMatrix4(this.matrix),t}getPositionToCenter(t){return(t=super.getCenter(t)).applyMatrix4(cd.copy(this.matrix).setPosition(0,0,0)),t}computeVertices(){this.getSize(Gc).multiplyScalar(.5),this.getCenter(jc),cd.copy(this.matrix).setPosition(jc),this.vertices=qD.map(t=>t.clone().multiply(Gc).applyMatrix4(cd))}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=LX.map(([t,e])=>new yl(this.vertices[t],this.vertices[e])),this.centerEdges=this.edges.map(t=>t.getCenter(new P))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=FX.map(([t,e])=>this.vertices[t].clone().add(this.vertices[e]).multiplyScalar(.5))}}}),QR=W(()=>{bc={Cloner:null,changeEntityProptotype:()=>{},createEntity:()=>{}}});function k2(t){return t?.isParticleSystem===!0}function Zg(t){return t?.isHairSystem===!0}function cm(t){return t?.isShapeBlendEntity===!0}function u5(t){return t?.isPathObject===!0}function jo(t){return t?.isObject2D===!0}function Ka(t){return t?.isUIObject===!0}function $1(t){return t?.isCloner===!0}function Sg(t){return t?.isClone===!0}function mP(t){return t?.isComponentObject===!0}var ss=W(()=>{});function Or(t){k7.add(t)}function Pn(t,e){let i=`${t}:${e}`;X8.has(i)||X8.add(i)}function JR(t,e){z7.set(t,e)}function $D(t){return z7.get(t)}function Yv(t,e){L7.set(t,e)}function XD(t){return L7.get(t)}function H8(t,e){F7.set(t,e)}function ymt(t){return F7.get(t)}function $8(){return d5}var k7,X8,z7,L7,F7,d5,t4,Ii=W(()=>{k7=new Set,X8=new Set,z7=new Map,L7=new Map,F7=new Map,d5=null,t4=null});function vmt(t){let e=t.elements;Lh.set(e[0],e[1],e[2]),Fh.set(e[4],e[5],e[6]),ku.set(e[8],e[9],e[10])}function bmt(){let t=Math.max(Lh.lengthSq(),Fh.lengthSq(),ku.lengthSq());Lh.lengthSq()>Lw*t?ml.copy(Lh).normalize():ml.set(1,0,0),fl.crossVectors(ku,ml),fl.lengthSq()<=Lw*t&&(fl.copy(Fh).addScaledVector(ml,-Fh.dot(ml)),fl.lengthSq()<=Lw*t&&function(e,i){e.set(1,0,0).cross(i),e.lengthSq()<=Lw&&e.set(0,1,0).cross(i),e.normalize()}(fl,ml)),fl.normalize(),Tg.crossVectors(ml,fl)}function _mt(t){return vmt(t),bmt(),xmt.makeBasis(ml,fl,Tg)}var Lh,Fh,ku,ml,fl,Tg,xmt,Lw,Fw,nM,Mg,c5,wmt=W(()=>{yt(),Lh=new P,Fh=new P,ku=new P,ml=new P,fl=new P,Tg=new P,xmt=new At,Lw=1e-12,Fw=.01}),zS=W(()=>{yt(),wmt(),nM=new At,(Mg||(Mg={})).is=function(t){return t&&t.__isSPEObject},c5=t=>class extends t{constructor(){super(...arguments),this.previousModelViewMatrix=new At,this.copyPreviousMatrix=!0,this.hiddenMatrix=new At,this.pivotMatrix=new At,this.matrixWorldRigid=new At,this.shearScale=new At,this.shearScaleInv=new At}get __isSPEObject(){return!0}getPhysicsLocalMatrix(e){return!!this.rigidBody?.isDynamic()&&(e.copy(this.matrixWorld),this.hasNonUniformScale&&e.multiply(this.shearScaleInv),this.parent&&e.premultiply(nM.copy(this.parent.matrixWorld).invert()),e.premultiply(nM.copy(this.hiddenMatrix).invert()),e.multiply(nM.copy(this.pivotMatrix).invert()),!0)}isDescendantOf(e){e instanceof hr&&(e=e.uuid);let i=this;for(;i.parent;){if(i.parent.uuid===e)return!0;i=i.parent}return!1}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorld.multiply(this.pivotMatrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(let i of this.children)i.updateMatrixWorld(e)}updateWorldMatrix(e,i){let r=this.parent;if(e&&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 s of this.children)s.updateWorldMatrix(!1,!0)}traverseChildren(e,i=0){for(let r of this.children)Mg.is(r)&&r.traverseObject(e,i+1)}traverseObject(e,i=0){if(e(this,i)!==!0)for(let r of this.children)Mg.is(r)&&r.traverseObject(e,i+1)}updateMatrixWorldRigid(){this.hasNonUniformScale=function(e,i,r){return vmt(e),bmt(),i.makeBasis(ml,fl,Tg),r.set(ml.dot(Lh),ml.dot(Fh),ml.dot(ku),0,fl.dot(Lh),fl.dot(Fh),fl.dot(ku),0,Tg.dot(Lh),Tg.dot(Fh),Tg.dot(ku),0,0,0,0,1),function(){let s=Lh.length(),n=Fh.length(),a=ku.length(),o=Math.max(s,n,a);if(o-s>Fw||o-n>Fw||o-a>Fw)return!0;let l=Fw*o*o;return Math.abs(Lh.dot(Fh))>l||Math.abs(Lh.dot(ku))>l||Math.abs(Fh.dot(ku))>l}()}(this.matrixWorld,this.matrixWorldRigid,this.shearScale),this.matrixWorldRigid.copyPosition(this.matrixWorld),this.shearScaleInv.copy(this.shearScale).invert()}attach(e,i){this.updateWorldMatrix(!0,!1);let r=new At().copy(this.matrixWorld).invert();return e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),r.multiply(e.parent.matrixWorld)),"hiddenMatrix"in e&&e.hiddenMatrix instanceof At?e.hiddenMatrix.premultiply(r):e.applyMatrix4(r),e.updateWorldMatrix(!1,!1),this.add(e),i!==void 0&&(this.children.pop(),this.children.splice(i,0,e)),this}copy(e,i=!1){return super.copy(e,i),this.hasNonUniformScale=e.hasNonUniformScale,this}onAfterRender(e,i,r,s,n,a){this.copyPreviousMatrix&&this.previousModelViewMatrix.copy(this.modelViewMatrix)}}});function UX(t,e,i){return Wp.subVectors(e,t),vS.subVectors(e,i),Wp.cross(vS).length()<=z2}function Smt(t){let e=Z8.get(t.points);if(e!==void 0&&e.isClosed===t.isClosed)return e.curve;let i=function(r){let s=r.points,n=[s[0]],a=[new P(...s[0].data.position)];eg.copy(a[0]);for(let y=0;y<s.length-1;y++)Wp.fromArray(s[y].data.position),vS.fromArray(s[y+1].data.position),M1.subVectors(Wp,eg),A1.subVectors(Wp,vS),M1.cross(A1).length()>z2&&(n.push(s[y]),a.push(new P().copy(Wp)),eg.copy(Wp));let o=s[s.length-1];n.push(o),a.push(new P(...o.data.position));let l=r.isClosed,u=n.length-(l?0:1),h=n.length,d=[],c=[];for(let y=0;y<h;y++){let v=n[y].data;d.push(new P(...v.controlPrevious.position)),c.push(new P(...v.controlNext.position))}let p=[];for(let y=0;y<u;y++){let v=y===h-1?0:y+1;p.push(UX(a[y],c[y],a[v])&&UX(a[y],d[v],a[v]))}let m=[];for(let y=0;y<h;y++){let v=n[y].data,b=a[y],_={position:b,prevDir:void 0,nextDir:void 0,controlPrevious:d[y],controlNext:c[y],tan:void 0,baseRoundness:v.roundness,removedLength:0};if(m.push(_),v.roundness===0||!l&&(y===0||y===h-1))continue;let x=l&&y==0?h-1:y-1,S=l&&y==h-1?0:y+1,w=new P().subVectors(a[x],b).normalize(),M=new P().subVectors(a[S],b).normalize();_.prevDir=w,_.nextDir=M;let T=p[l&&y===0?h-1:y-1],A=p[y];if(T&&A){ig.addVectors(w,M).normalize();let C=eg.crossVectors(ig,w).length()/w.dot(ig);_.tan=C,_.removedLength=v.roundness/C}}for(let y=0;y<u;y++){let v=l&&y===h-1?0:y+1,b=m[y],_=m[v];if(b.removedLength!==0||_.removedLength!==0){let x=b.position.distanceTo(_.position);b.removedLength=Math.min(b.removedLength,x/2),_.removedLength=Math.min(_.removedLength,x/2)}}let f=new Array(2*h).fill(null);for(let y=0;y<u;y++){let v=l&&y===h-1?0:y+1,b=m[y],_=m[v],x=null;if(p[y]){let S=b.position.clone(),w=_.position.clone();(b.removedLength!==0||_.removedLength!==0)&&(b.nextDir&&S.add(eg.copy(b.nextDir).setLength(b.removedLength)),_.prevDir&&w.add(eg.copy(_.prevDir).setLength(_.removedLength))),S.distanceTo(w)>z2&&(x=new R2(S,S.clone().lerp(w,.3),w.clone().lerp(S,.3),w))}else b.position.distanceTo(_.position)>z2&&(x=new R2(b.position,b.controlNext,_.controlPrevious,_.position));f[2*y+1]=x}for(let y=0;y<h;y++){let v=m[y];if(v.removedLength===0)continue;let b=v.position,_=v.prevDir.clone().multiplyScalar(v.removedLength).add(b),x=v.nextDir.clone().multiplyScalar(v.removedLength).add(b),S=v.tan*v.removedLength;ig.addVectors(v.prevDir,v.nextDir).normalize(),M1.copy(_).lerp(x,.5);let w=_.distanceTo(x)/2;K8.copy(ig).multiplyScalar(Math.sqrt(Math.pow(S,2)-Math.pow(w,2))).add(M1),fP.copy(ig).multiplyScalar(-S).add(K8);let M=b.distanceTo(fP)/b.distanceTo(M1);A1.copy(v.prevDir).multiplyScalar(M*b.distanceTo(_)).add(b),Y8.copy(A1).lerp(fP,2);let T=_.clone().lerp(A1,4/3),A=x.clone().lerp(Y8,4/3);f[2*y]=new R2(_,T,A,x)}let g=new Tmt;for(let y=0;y<f.length;y++){let v=f[y];v&&g.add(v)}return g}(t);return Z8.set(t.points,{isClosed:t.isClosed,curve:i}),i}var Tmt,z2,Wp,vS,eg,ig,M1,fP,A1,Y8,K8,Z8,Ai,Vu,jX,GX,V0,YD,aM,oM,WX,KD,ZD,p5,Q8,r0,zu,Mmt=W(()=>{yt(),Tmt=class extends $F{constructor(){super()}getPoints(t=12){let e,i=[],r=this.getCurveLengths(),s=r[r.length-1]/r.length;for(let n=0,a=this.curves;n<a.length;n++){let o=a[n],l=n===0?r[n]:r[n]-r[n-1],u=Math.ceil(t*l/s),h=o.getPoints(u);for(let d=0;d<h.length;d++){let c=h[d];e&&e.equals(c)||(i.push(c),e=c)}}return this.autoClose&&i.length>1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}},z2=.001,Wp=new P,vS=new P,eg=new P,ig=new P,M1=new P,fP=new P,A1=new P,Y8=new P,K8=new P,Z8=new WeakMap}),vo=W(()=>{yt(),Le(),OTt(),Fi(),QR(),ss(),Ii(),zS(),Mmt(),cr(),(Ai||(Ai={})).is=function(t){return t&&t.__isEntity},Vu=t=>Ai.is(t),jX={type:"completeState",isfromEntity:!0},GX=["x","y","z"],V0=new P,YD=new P(1,1,1),aM=new Pe,oM=new ur,WX=new P().set(0,1,0),KD=new At,ZD=new At,p5=t=>class extends c5(t){constructor(){super(...arguments),this.raycastLock=!1,this.scaleLock=!1,this.disposed=!1,this.stateSelection=null,this.destroyedInAction=!1,this.instances=[],this.prevState=null,this.currentState=null,this.currentAnimationAction=null,this.reversibleToState=null,this.transitionState={settled:!0,state:null},this.currentTransitionEvent=null,this.previousAction=null,this._singleBBox=new q8,this._recursiveBBox=new q8,this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0,this._needApplyPathSnapping=!0,this.attachedPaths=new Set}get __isEntity(){return!0}entityChildren(e){let i=this.children[e];if(Ai.is(i))return i}entityChildrenCount(){let e=this.children.length;for(;e--;)if(Ai.is(this.children[e]))return e+1;return 0}get isConcreteEntity(){return typeof this.identity=="string"}get isVirtualEntity(){return typeof this.identity!="string"}get isInstanceRoot(){return this.isConcreteEntity&&this.data.type==="Instance"}nearestInstanceSelfOrParent(){let e=this;for(;e.data.type!=="Instance";){let i=e.parent;if(!Ai.is(i))return;e=i}return e}forInstancesRec(e){this.instances.forEach(i=>{i.disposed||e(i),i.forInstancesRec(e)})}super_Entity(e,i){typeof e=="string"&&(this.uuid=e),this.identity=e,this.data=i,this.matrixAutoUpdate=!1,this.dataPatched=this.data}changeSelectedState(e,i,r=!1){if(this.data.states.length!==0||r){for(let s of this.data.states)Zp.toOps(this.data,s.data).forEach(n=>{let a=PR.replaceProps(n,this.data);this.dataPatched=this.data,this.updateByPatchedOp(a,this.data,i)});if(e!==null){let s=this.data.states.data(e);s&&(this.dataPatched=Zp.patch(this.data,s),Zp.toOps(this.data,s).forEach(n=>{this.updateByPatchedOp(n,this.dataPatched,i)}))}r&&this.updateTransformState(this.dataPatched,i),this.stateSelection=e,this.updatePathSnapping(this.dataPatched.pathSnapping)}}get singleBBox(){return this.singleBBoxNeedsUpdate&&(this.singleBBoxNeedsUpdate=!1,this._singleBBox.setFromObjectSize(this,!1),this._singleBBox.computeVertices(),this._singleBBox.computeEdges(),this._singleBBox.computeFaces()),this._singleBBox}get recursiveBBox(){return this.recursiveBBoxNeedsUpdate&&(this.recursiveBBoxNeedsUpdate=!1,this._recursiveBBox.setFromObjectSize(this,!0),this._recursiveBBox.computeVertices(),this._recursiveBBox.computeEdges(),this._recursiveBBox.computeFaces()),this._recursiveBBox}updateEntityBoxSize(e,i){e.setScalar(0),i.setScalar(0)}resetBBoxNeedsUpdateSelf(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}resetBBoxNeedsUpdate(){this.resetBBoxNeedsUpdateSelf(),this.traverseAncestors(e=>{Vu(e)&&e.resetBBoxNeedsUpdateSelf()}),this.traverseEntity(e=>{e.resetBBoxNeedsUpdateSelf()})}find(e){let i;return this.traverseEntity(r=>{r.uuid===e&&(i=r)}),i}traverseSortNextHelper(){let e=this.parent;if(e){let i=e.children,r=i.indexOf(this)+1;if(Ai.is(i[r]))return i[r];if(Ai.is(e))return e.traverseSortNextHelper()}}sortNext(){let e=this.children;return this.children.length>0&&Ai.is(this.children[0])?e[0]:this.traverseSortNextHelper()}goUp(e){let i=this;for(;e>0&&i!==null;)i=i.parent,e-=1;return i}hasAnccestorOrSelf(e){return this===e||this.hasAnccestor(e)}hasAnccestor(e){let i=this.parent;for(;i;){if(e===i)return!0;i=i.parent}return!1}countToAccestor(e){let i=0,r=this;for(;r!==e;){if(r===null)return-1;r=r.parent,i+=1}return i}forEachEntity(e){for(let i of this.children)Vu(i)&&e(i)}traverseEntityAncestors(e){this.traverseAncestors(i=>{Ai.is(i)&&e(i)})}traverseConcreteEntity(e,i=0){if(e(this,i)!==!0)for(let r of this.children)Vu(r)&&r.isConcreteEntity&&r.traverseEntity(e,i+1)}traverseEntity(e,i=0){if(e(this,i)!==!0)for(let r of this.children)Vu(r)&&r.traverseEntity(e,i+1)}traverseVisibleEntity(e){e(this);for(let i of this.children)Vu(i)&&i.visible&&i.traverseVisibleEntity(e)}updateMatrix(){super.updateMatrix(),this.cloner&&this.cloner.onObjUpdateMatrix(),this.dispatchEvent({type:"updateMatrix"})}updateMatrixWorld(e){super.updateMatrixWorld(e),this.dispatchEvent({type:"updateMatrixWorld"})}copy(e,i=!1){return super.copy(e,i),this.dataPatched=e.dataPatched,this.raycastLock=e.raycastLock,this.scaleLock=e.scaleLock,this.hiddenMatrix.copy(e.hiddenMatrix),this}hasEntityChild(){return this.children.some(e=>Vu(e))}isAncestorOf(e){if(this.uuid===e)return!1;let i=!1;return this.traverseEntity(r=>{r.uuid===e&&(i=!0)}),i}toObjectTransformState(e=[]){return this.updateWorldMatrix(!0,!1),o8({position:this.position.toArray(),rotation:[this.rotation.x*Yt.RAD2DEG,this.rotation.y*Yt.RAD2DEG,this.rotation.z*Yt.RAD2DEG],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray(),pivot:[0,0,0],pivotRotation:[0,0,0]},e)}getTransformValues(e,i,r){return i[e].map((s,n)=>r?.shared.getVariable(s,[this.uuid,e,GX[n]])??s)}updateTransformState(e,i){let r=!1;if(e.position&&(this.position.fromArray(this.getTransformValues("position",e,i)),r=!0),e.rotation&&(V0.fromArray(this.getTransformValues("rotation",e,i)).multiplyScalar(Yt.DEG2RAD),this.rotation.setFromVector3(V0),r=!0),e.scale&&(this.scale.fromArray(this.getTransformValues("scale",e,i)),r=!0),e.hiddenMatrix!==void 0&&(r=!0,this.hiddenMatrix.fromArray(e.hiddenMatrix??lv.identity)),e.pivot!==void 0||e.pivotRotation!==void 0){if(r=!0,e.pivot!==void 0&&e.pivotRotation!==void 0)this.pivotMatrix.compose(V0.fromArray(e.pivot).negate(),aM.setFromEuler(oM.fromArray(e.pivotRotation.map(s=>s*Yt.DEG2RAD))).invert(),YD);else if(e.pivot!==void 0)this.pivotMatrix.setPosition(-e.pivot[0],-e.pivot[1],-e.pivot[2]);else if(e.pivotRotation!==void 0){let s=V0.setFromMatrixPosition(this.pivotMatrix);aM.setFromEuler(oM.fromArray(e.pivotRotation.map(n=>n*Yt.DEG2RAD))).invert(),this.pivotMatrix.compose(s,aM,YD)}}return r&&(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(s=>{s.invalidateClonerTransform(this)})),e.position&&e.rotation&&e.scale&&e.hiddenMatrix!==void 0&&this.updateWorldMatrix(!1,!0),r}onVariableUpdate(e=!1){e?this.resetBBoxNeedsUpdate():(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(i=>{i.invalidateClonerTransform(this)}),this.requestRender())}dispose(){this.disposed=!0,this.cloner&&(this.cloner.dispose(),this.cloner=void 0)}disposeChildrenRecursively(){for(let e of this.children)Ai.is(e)&&e.disposeRecursively()}disposeRecursively(){this.dispose(),this.children.forEach(e=>{Ai.is(e)&&e.disposeRecursively()})}toState(e=[]){return o8({name:this.name,visible:this.visible,raycastLock:this.raycastLock,...this.toObjectTransformState(e)},e)}updateByObjUpdateOp(e,i){e!==void 0&&this.updateByOp({type:0,props:e,path:[]},{...this.data,...e},i,!1)}updateByOp(e,i,r,s){let n=this.data;this.data=i;let a=e,o=tr(e.path,["states","*"]);if(o!==null){if(e.type===0){let[l]=o;if(this?.stateSelection===l){let u={...e.props};if(delete u.name,Object.values(e.props).some(h=>h===void 0)){let h=this.data;if(h!==void 0){let d=En.zoom(h,e.path.slice(2));if(d)for(let c in e.props)e.props[c]===void 0&&c in d&&(u[c]=d[c])}}a={...e,props:u,path:e.path.slice(2)}}}}else if(e.type===0){let l=this.stateSelection?this.data.states.data(this.stateSelection):void 0;if(l!==void 0){if(e.props.name!==void 0&&l.name){let{name:h,...d}=l;l=d}if(e.props.material!==void 0&&"material"in l){let{material:h,...d}=l;l=d}let u=En.removeOverridden(e.path,e.props,l);a={...e,props:u}}}if(this.updateByPatchedOpBase(a,Zp.patch(this.data,this.stateSelection?this.data.states.data(this.stateSelection):void 0),r),tr(e.path,["overrides"])){let l=[],u=[...e.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(e.type===0)for(let h of Object.keys(e.props)){l[l.length-1]=h;let d=r.scene.findInstance([this.uuid,...l]);d&&(d.overrideData=e.props[h],d.updateState(nm.apply(d.component.data,d.overrideData),r))}}else{let h=r.scene.findInstance([this.uuid,...l]);if(h){let d=En.zoom(h.component.data,u);if((e={...e,path:u}).type===0){let c=e.props;if(d)for(let[p,m]of Object.entries(e.props))m===void 0&&(c===e.props&&(c={...e.props}),c[p]=d[p]);e={...e,props:c}}h.overrideData=$R.resolve(i.overrides,l),h.updateByOp(e,Qn.applySimple(h.data,e),r,!1)}}}else if(this.instances.length>0){let l;if(e.path.length===0&&e.type===0){let u;for(let h of yc.rootOverrideProps)h in e.props&&(u===void 0&&(u={}),u[h]=e.props[h]);u&&(l={...e,props:u})}else for(let u of yc.rootOverrideProps)if(tr(e.path,[u])){l=e;break}l!==void 0&&this.instances.forEach(u=>{if(u.isInstanceRoot){let h=nm.filterOp(u.overrideData,l);h&&u.updateByOp(h,Qn.applySimple(u.data,h),r,!0)}}),this.instances.forEach(u=>{if(!u.isInstanceRoot){let h=nm.filterOp(u.overrideData,e);if(h){let d;d=n===u.data&&e===h?i:Qn.applySimple(u.data,h),u.updateByOp(h,d,r,!0)}}})}}updateByPatchedOpBase(e,i,r){if(this.dataPatched=i,e.path.length===0&&e.type===0)e.props.type!==void 0&&!Yg.is(e.props.type)&&bc.changeEntityProptotype(this,i,r);else if(e.path.length===1&&e.path[0]==="geometry"&&e.type===0&&"type"in e.props){bc.changeEntityProptotype(this,i,r);for(let s of this.children)Ai.is(s)&&s.updateVisible(r.scene)}this.updateByPatchedOp(e,i,r)}updateByPatchedOp(e,i,r){if(e.path.length===0&&e.type===0?this.updateState(e.props,r):e.type===0&&("resolutionLevel"in e.props||"useChildrenColors"in e.props)&&this.updateState(i,r),e.path[0]==="morphTargetInfluences"&&e.type===0){let s=i.morphTargetInfluences.get(e.path[1])?.data.name;s&&this.updateMorphInfluences(s,r.shared.getVariable(e.props.value,[this.uuid,"morphTargetInfluences",s]))}if(tr(e.path,["pathSnapping"])!==null&&this.updatePathSnapping(i.pathSnapping),tr(e.path,["cloner"])!==null){let s=Qn.drop(e,1);s.path.length===0&&s.type===0&&s.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(e=this.dataPatched.pathSnapping){this._updatedPathSnapping=e,this._needApplyPathSnapping=!0}get updatedPathSnapping(){return this._updatedPathSnapping}applyPathSnapping(e){if(this._needApplyPathSnapping===!1)return;let i=this._updatedPathSnapping?.pathId??this.dataPatched.pathSnapping.pathId,r=this._updatedPathSnapping?.slide??this.dataPatched.pathSnapping.slide??0,s=this._updatedPathSnapping?.offset??this.dataPatched.pathSnapping.offset??0,n=this._updatedPathSnapping?.orientation??this.dataPatched.pathSnapping.orientation;if(i===null)return;let a=e.find(i);if(!a)return;this._needApplyPathSnapping=!1;let o=a.data;if(o.geometry.path.points.length<=1)return;let l=Smt(o.geometry.path),u=(r+s)%1;r+s===1&&u===0&&(u=1);let h=null;try{h=l.curves.length?l.getPointAt(u):null}catch{}if(h===null)return;a.updateMatrixWorld();let d=this.parent?KD.copy(this.parent.matrixWorld).invert():KD.identity();d.multiply(a.matrixWorld),h.applyMatrix4(d);let c={position:h.toArray(),rotation:o.rotation};if(n==="tangential"){let p=ZD.extractRotation(a.matrixWorld),m=l.getTangentAt(u).applyMatrix4(p).add(h),f=ZD.lookAt(h,m,WX),g=V0.setFromEuler(oM.setFromRotationMatrix(f)).multiplyScalar(Yt.RAD2DEG);c={...c,rotation:g.toArray()}}this.updateTransformState(c),this.traverseEntity(p=>{p._cameraType&&p.dispatchEvent(jX)})}updateVisible(e){if(this.visible=this.dataPatched.visible&&(!this.dataPatched.cloner||(this.dataPatched.cloner.disabled??!1)||this.dataPatched.cloner?.hideBase!==!0),!e)return;let i=!1;this.traverseEntity(r=>{if(r.data.type==="Splat")return i=!0,!0}),i&&e.reloadSplats()}updateState_Entity(e,i){e.name!==void 0&&(this.name=e.name),e.raycastLock!==void 0&&(this.raycastLock=e.raycastLock),e.visible!==void 0&&(this.updateVisible(i?.scene),this.resetBBoxNeedsUpdate()),i&&"cloner"in e&&e.cloner!==void 0&&(this.setFromClonerState(e.cloner,i),this.updateVisible(i.scene)),this.updateTransformState(e,i)}get attachedSurfaceCloners(){return this.children.filter(e=>$1(e)&&e.parameters.type==="toObject")}setFromClonerState(e,i){if(!this.disposed)if(e===null||e.disabled)this.cloner&&this.cloner.dispose(),this.cloner=void 0;else if(this.cloner===void 0){if(bc.Cloner===null)return void Pn("cloners","a cloner");this.cloner=new bc.Cloner(this,e),i.scene.addPendingExpandCloner(this)}else this.cloner.updateState(e,i)}expandCloner(e){!this.disposed&&this.cloner&&this.cloner.expandClones(e)}invalidateClonerTransform(e){this.cloner&&this.cloner.invalidateTransform(e)}requestRender(){this.dispatchEvent({type:"requestRender"})}}}),s0=W(()=>{yt(),vo(),(Q8||(Q8={})).is=t=>"objectHelper"in t,r0=(t,e)=>class extends p5(t){constructor(){super(...arguments),this.objectHelper=new e(this),this.gizmos={}}get geometryHelper(){return e.geometryHelper}raycast(i,r){this.objectHelper.raycast(i,r)}showGizmos(){for(let i in this.gizmos){let r=this.gizmos[i];r instanceof uS&&(r.visible=!0)}}updateEntityBoxSize(i,r){this.objectHelper.visible&&this.geometryHelper instanceof Kh?(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 uS&&(r.visible=!1)}}}}),m5=W(()=>{yt(),h5(),s0(),zu=class extends r0(Hv,Ov){constructor(t,e){super(),this.super_Entity(t,e),this.objectHelper.update(),this.data.type==="Empty"&&(this.objectHelper.visible=!1)}updateState(t,e){this.updateState_Entity(t,e),"buffer"in t&&Object.keys(t).length===1&&e.scene.reloadSplats()}}});function lh(t,e,i,r,s,n,a){Uw.set(s,n,a).unproject(r);let o=e[t];if(o!==void 0){let l=i.getAttribute("position");for(let u=0,h=o.length;u<h;u++)l.setXYZ(o[u],Uw.x,Uw.y,Uw.z)}}var Uw,Xo,qX,Amt,ITt=W(()=>{yt(),VS(),kS(),Uw=new P,Xo=new vg,qX=class extends _1{constructor(t){let e=new ye,i=new Vh({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],s=[],n={},a=new oe(15711266),o=new oe(15711266),l=new oe(2857471);function u(d,c,p){h(d,p),h(c,p)}function h(d,c){r.push(0,0,0),s.push(c.r,c.g,c.b),n[d]===void 0&&(n[d]=[]),n[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),e.setAttribute("position",new me(r,3)),e.setAttribute("color",new me(s,3)),super(e,i),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=n,this.update()}update(){let t=this.geometry,e=this.pointMap;Xo.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let i=.8;lh("n1",e,t,Xo,-1,-1,i),lh("n2",e,t,Xo,1,-1,i),lh("n3",e,t,Xo,-1,1,i),lh("n4",e,t,Xo,1,1,i);let r=i;lh("f1",e,t,Xo,-1,-1,r),lh("f2",e,t,Xo,1,-1,r),lh("f3",e,t,Xo,-1,1,r),lh("f4",e,t,Xo,1,1,r);let s=r;lh("u1",e,t,Xo,.35,1.1,s),lh("u2",e,t,Xo,-.35,1.1,s),lh("u3",e,t,Xo,0,1.55,s),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}},Amt=class extends $v(qX){constructor(t){super(t),this.object=t,this.name=`CombinedCameraHelper: ${t.uuid}`}updateMatrixWorld(t){super.updateMatrixWorld(t),this.updateTarget()}updateTarget(){let t=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(t)}raycast(t,e){Xv(this.object,this.geometry,t,e,!0)}}});function HX(t){return 1-Math.pow(1-t,3)}var Zm,lM,hM,uM,k0,dM,uu,ln,Zh=W(()=>{yt(),ITt(),Le(),s0(),cr(),Zm=new P,lM=new P,hM=new Pe,uM=new P,k0=new P,dM=new P,uu=class extends r0(vg,Amt){constructor(t="",e={...B2.defaultData,name:""}){super(),this._cameraType="OrthographicCamera",this.targetOffset=gc.DefaultTargetOffset,this.isUpVectorFlipped=!1,this.angleOffsetFromUp=0,this.wasMovedByUser=!1,this.wasMovedBySwitchCameraAction=!1,this._createdAt=typeof performance<"u"?performance.now():0,this._tickProjectionTransition=()=>{let s=this._projectionTransition;if(s===void 0)return;if(this.disposed)return void this._endProjectionTransition();s.raf=requestAnimationFrame(this._tickProjectionTransition);let n=uu.projectionTransitionRequestRender??s.requestRender;this.updateProjectionMatrix(),n?.()},this.super_Entity(t,e),this.previousProjectionMatrix=new At,this.matrixAutoUpdate=!0,this.width=window.innerWidth,this.height=window.innerHeight;let i=this.width,r=this.height;this.orthoCamera=new Rv(-.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(t){let e=uu.projectionTransitionsEnabled;uu.projectionTransitionsEnabled=!1;try{return t()}finally{uu.projectionTransitionsEnabled=e}}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}set fov(t){this.perspCamera.fov=t}get fov(){return this.perspCamera.fov}setNear(t,e){t==="PerspectiveCamera"?this.perspCamera.near=e:this.orthoCamera.near=e}setZoom(t,e){e>=0&&(t==="PerspectiveCamera"?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}set cameraType(t){t==="PerspectiveCamera"?this.toPerspective():t==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(t){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=t:this.orthoCamera.near=t}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(t){t>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=t:this.orthoCamera.zoom=t)}lookAt(t,e,i){typeof t=="number"&&(t=new P(t,e,i)),super.lookAt(t),this.getWorldPosition(Zm),this.targetOffset=Zm.distanceTo(t)}getTarget(t=new P){return this.getWorldDirection(lM),this.getWorldPosition(Zm),lM.multiplyScalar(this.targetOffset),t.copy(Zm).add(lM),t}getDistanceToTarget(){let t=this.getTarget();return this.getWorldPosition(Zm),Zm.distanceTo(t)}updateUp(){this.getWorldQuaternion(hM),uM.set(0,0,1).applyQuaternion(hM),k0.copy(hr.DEFAULT_UP),this.isUpVectorFlipped&&k0.negate(),k0.applyQuaternion(hM),dM.copy(hr.DEFAULT_UP).projectOnPlane(uM),this.angleOffsetFromUp=dM.angleTo(k0),this.angleOffsetFromUp*=dM.cross(k0).dot(uM)>=0?1:-1}updateTransformState(t,e){let i=super.updateTransformState(t,e);return t.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=t.isUpVectorFlipped),this.updateUp(),i}getViewFrontToObject(t){let e=t.getWorldPosition(new P),i=t.getWorldDirection(new P).multiplyScalar(this.targetOffset);return{position:e.clone().add(i),target:e}}getViewToTarget(t){let e=this.getWorldDirection(new P).multiplyScalar(this.targetOffset);return{position:t.clone().sub(e),target:t}}getViewToObject(t){let e=new P;return t.getWorldPosition(e),this.getViewToTarget(e)}setViewplaneSize(t,e,i=!1){if(this.aspect=t/e,i){let r=t>e?this.aspect:1,s=t>e?1:this.aspect;this.left=-395*r,this.right=395*r,this.top=1/s*395,this.bottom=1/s*-395}else this.left=.5*-t,this.right=.5*t,this.top=.5*e,this.bottom=.5*-e;this.updateProjectionMatrix()}copyViewPlaneSize(t){this.aspect=t.aspect,this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.updateProjectionMatrix()}toOrthographic(){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}toPerspective(){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}get isProjectionTransitioning(){return this._projectionTransition!==void 0}get projectionTransitionProgress(){let t=this._projectionTransition;if(t===void 0)return 1;let e=(performance.now()-t.start)/t.duration;return e>=1?1:e<=0?0:HX(e)}get _activeSubCamera(){return this._cameraType==="PerspectiveCamera"?this.perspCamera:this.orthoCamera}_canAnimateProjection(){return uu.projectionTransitionsEnabled&&typeof requestAnimationFrame=="function"&&typeof performance<"u"&&performance.now()-this._createdAt>=uu.projectionTransitionMinAgeMs}_beginProjectionTransition(t){let e=this._projectionTransition;e===void 0&&(e={from:new At,blend:new At,blendInverse:new At,start:0,duration:uu.projectionTransitionDuration,referenceDepth:1,raf:0,requestRender:t},this._projectionTransition=e),e.from.copy(this.projectionMatrix),e.start=performance.now(),e.duration=uu.projectionTransitionDuration,e.referenceDepth=Number.isFinite(this.targetOffset)?Math.max(1,this.targetOffset):1,t&&(e.requestRender=t),e.raf!==0&&cancelAnimationFrame(e.raf),e.raf=requestAnimationFrame(this._tickProjectionTransition)}_applyProjectionTransition(){let t=this._projectionTransition;if(t===void 0)return;let e=(performance.now()-t.start)/t.duration;if(e>=1)return void this._endProjectionTransition();let i=HX(e),r=t.from.elements,s=this._activeSubCamera.projectionMatrix.elements,n=t.blend.elements,a=t.referenceDepth,o=Math.max(1e-6,r[15]-r[11]*a),l=i*o/(i*o+(1-i)*Math.max(1e-6,s[15]-s[11]*a));for(let u=0;u<16;u++)n[u]=r[u]+(s[u]-r[u])*l;t.blendInverse.copy(t.blend).invert(),this.projectionMatrix=t.blend,this.projectionMatrixInverse=t.blendInverse}_endProjectionTransition(){let t=this._projectionTransition;if(t===void 0)return;t.raf!==0&&cancelAnimationFrame(t.raf),this._projectionTransition=void 0;let e=this._activeSubCamera;this.projectionMatrix=e.projectionMatrix,this.projectionMatrixInverse=e.projectionMatrixInverse}_syncProjectionTransition(t){let e=t._projectionTransition;if(e===void 0)return void(this._projectionTransition!==void 0&&this._endProjectionTransition());let i=this._projectionTransition;i===void 0?(i={from:new At,blend:new At,blendInverse:new At,start:0,duration:1,referenceDepth:1,raf:0,requestRender:void 0},this._projectionTransition=i):i.raf!==0&&(cancelAnimationFrame(i.raf),i.raf=0),i.requestRender=void 0,i.from.copy(e.from),i.start=e.start,i.duration=e.duration,i.referenceDepth=e.referenceDepth,this._applyProjectionTransition()}setFocalLength(t){this.perspCamera.setFocalLength(t),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(t,e,i,r,s,n){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(t,e,i,r,s,n):this.orthoCamera.setViewOffset(t,e,i,r,s,n),this._applyProjectionTransition()}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}copyHistory(){this.previousProjectionMatrix&&this.previousProjectionMatrix.copy(this.projectionMatrix)}updateProjectionMatrix(){this._cameraType==="PerspectiveCamera"?this.toPerspective():this._cameraType==="OrthographicCamera"&&this.toOrthographic()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(t,e){return super.copy(t,e),this.parent=t.parent,this.orthoCamera.copy(t.orthoCamera),this.perspCamera.copy(t.perspCamera),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.far=t.far,this.view=t.view===null?null:Object.assign({},t.view),this._cameraType=t._cameraType,this.aspect=t.aspect,this.fov=t.fov,this.focus=t.focus,this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this.targetOffset=gc.sanitizeTargetOffset(t.targetOffset),this.updateProjectionMatrix(),this._syncProjectionTransition(t),this}toCameraState(t=[]){return o8({type:this.cameraType,far:this.far,orthographic:{near:this.orthoCamera.near,zoom:this.orthoCamera.zoom},perspective:{near:this.perspCamera.near,fov:this.perspCamera.fov,zoom:this.perspCamera.zoom},up:this.up.toArray(),targetOffset:this.targetOffset,isUpVectorFlipped:this.isUpVectorFlipped},t)}updateCameraSubtype(t,e){let i=t==="perspective"?"PerspectiveCamera":"OrthographicCamera";e.zoom!==void 0&&this.setZoom(i,e.zoom),e.near!==void 0&&this.setNear(i,e.near),e.fov!==void 0&&i==="PerspectiveCamera"&&(this.fov=e.fov)}updateState(t,e){this.updateCameraState(t,e)}updateCameraState(t,e){this.updateState_Entity(t,e),t.far!==void 0&&(this.far=t.far),t.orthographic!==void 0&&this.updateCameraSubtype("orthographic",t.orthographic),t.perspective!==void 0&&this.updateCameraSubtype("perspective",t.perspective),t.type!==void 0&&(t.type!==this._cameraType&&this._canAnimateProjection()&&this._beginProjectionTransition(e?.shared.requestRender),this.cameraType=t.type),t.up!==void 0&&this.up.fromArray(t.up.map(i=>typeof i=="number"?i:0)),t.targetOffset!==void 0&&(this.targetOffset=gc.sanitizeTargetOffset(t.targetOffset)),t.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=t.isUpVectorFlipped),this.updateProjectionMatrix()}updateByPatchedOp(t,e,i){super.updateByPatchedOp(t,e,i),t.path.length===1&&t.type===0&&this.updateCameraSubtype(t.path[0],t.props)}toState(t){return{...super.toState(t),...this.toCameraState(t),type:this.cameraType}}},(ln=uu).projectionTransitionsEnabled=!1,ln.projectionTransitionDuration=350,ln.projectionTransitionMinAgeMs=1e3});function Cmt(t){return t.type==="TorusGeometry"&&t.arc===360}var Emt,cM,J8,bS=W(()=>{yt(),Emt=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,revolutions:2,segments:40,pathRadius:10,pathType:0,pathSegments:30,cornerRadius:30,cornerSegments:4},t.parameters),r=Math.abs(i.width),s=Math.abs(i.height??r),n=Math.abs(i.depth??r),a=Math.abs(Math.min(r,n))/2;return{parameters:Object.assign(i,{width:r,height:s,depth:n,radius:a,segments:Math.round(i.segments),pathSegments:Math.round(i.pathSegments),cornerSegments:Math.round(i.cornerSegments)})}}static build(t){let{width:e,height:i,depth:r,radius:s,revolutions:n,segments:a,pathRadius:o,pathType:l,pathSegments:u,cornerRadius:h,cornerSegments:d}=t.parameters,c=new J8(!1,e,i,r,s,n,a,o,l,u,h,d);return Object.assign(c,{userData:{...t,type:"HelixGeometry"}})}},cM=new sm([0,0,0],1),J8=class extends ye{constructor(t=!0,e=1,i=1,r=1,s=1,n=1,a=1,o=1,l=1,u=1,h=1,d=1){if(super(),n===0)return;let c=t&&n===1;c&&(d=0),h>100&&(h=100),h===0&&(d=0);let p,m,f,g,y,v,b,_,x=()=>new P,S=new P,w=x(),M=x(),T=x(),A=x(),C=x(),R=x(),O=x(),D=x(),B=x(),k=x(),j=x(),z=i-2*o+.001,V=z/n,H=Math.ceil(a*n),U=H+1,et=z/H,at=-z/2,Q=u+1,ut=2*Math.PI/u,ht=Math.PI/2/d,q=Math.min((1-h/100)*o,o-.01),nt=o-q,Tt=0,gt=2*d+2,vt=Q*gt/2,ct=vt+Q*U,St=Math.max(0,Q*(U+gt)),[Mt,Ct,Vt]=[3,3,2].map(Be=>Array(St*Be).fill(0)),Pt=[],Dt=s-o;function It(Be,ee){let oi=Math.PI/2;v=ee*et,_=2*Math.PI*(v%V)/V+oi,v+=at,b=Math.sin(_)*Dt,y=Math.cos(_)*Dt,t?Be.set(y,b,v):Be.set(y,v,b)}It(S,-1e-10),It(w,0),A.copy(S),It(S,1);let Ot=S.distanceTo(w),Qt=c?0:nt+q,Lt=Ot*H+2*Qt,Jt=q,qt=Lt-Qt;for(let Be=0;Be<=H;Be++){It(M,Be),j.subVectors(M,A).normalize(),A.copy(M),B.copy(M).setComponent(+t+1,0).normalize(),k.crossVectors(j,B).normalize();let ee=Be===0,oi=Be===H,xi=ee?3*Math.PI/2:ht,Xs=ee?Jt:qt,$i=ee?Q:ct,li=ee?0:St-Q,jr=j.clone().multiplyScalar(ee?-nt:nt).add(M),Jr=j.clone().multiplyScalar(ee?-1:1).normalize();for(let Gr=0;Gr<Q;Gr++){let Ui=Gr*ut;if(C.addVectors(S.copy(B).multiplyScalar(o*Math.cos(Ui)),w.copy(k).multiplyScalar(o*Math.sin(Ui))),R.copy(C).normalize(),ee||oi){c||(Tt=li+Gr,[0,1,2].forEach(Ci=>{Mt[3*Tt+Ci]=jr.getComponent(Ci),Ct[3*Tt+Ci]=Jr.getComponent(Ci)}),Vt[2*Tt]=+oi,Vt[2*Tt+1]=Gr/u),w.copy(R).multiplyScalar(q),T.addVectors(M,w);for(let Ci=0;Ci<d;Ci++){let Ys=Ci*ht+xi;O.addVectors(S.copy(j).multiplyScalar(nt*Math.sin(Ys)),w.copy(R).multiplyScalar(nt*Math.cos(Ys))),D.copy(O).normalize(),w.addVectors(T,O),O.normalize(),Tt=$i+Ci*Q+Gr,[0,1,2].forEach(_r=>{Mt[3*Tt+_r]=w.getComponent(_r),Ct[3*Tt+_r]=D.getComponent(_r)});let cs=+ee+Math.sin(Ys);Vt[2*Tt]=(Xs+nt*cs)/Lt,Vt[2*Tt+1]=Gr/u}}w.addVectors(M,C),Tt=vt+Be*Q+Gr,[0,1,2].forEach(Ci=>{Mt[3*Tt+Ci]=w.getComponent(Ci),Ct[3*Tt+Ci]=R.getComponent(Ci)}),Vt[2*Tt]=(Qt+Be*Ot)/Lt,Vt[2*Tt+1]=Gr/u}}let X=U+2*d+2,[$t,Te]=[+c,X-1];for(let Be=$t;Be<=Te-1;Be++){let ee=c&&Be===Te-1;for(let oi=0;oi<Q-1;oi++)p=Be*Q+oi,m=p+1,f=(ee?oi:p)+Q,g=(ee?oi+1:m)+Q,Be===0?Pt.push(m,g,f):Be===X-2?Pt.push(p,m,f):Pt.push(p,m,f,m,g,f)}this.setIndex(Pt),this.setAttribute("position",new me(Mt,3)),this.setAttribute("normal",new me(Ct,3)),this.setAttribute("uv",new me(Vt,2))}getClosedTorusIndicesForBooleanOrSubdiv(){let t,e,i,r,s=this.userData.parameters,n=Math.ceil(s.tubularSegments),a=s.radialSegments,o=a+1,l=[];for(let u=1;u<n;u++)for(let h=0;h<a;h++)t=u*o+h,e=t+1,i=t+o,r=e+o,l.push(t,e,i,e,r,i);for(let u=0;u<a;u++)t=n*o+u,e=t+1,i=u+o,r=u+1+o,l.push(t,e,i,e,r,i);return cM.array=new Uint32Array(l),cM.count=l.length,cM}}});function BTt(t){return XX||(XX=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.32/build",i=import("./boolean.js"),[r,s]=await Promise.all([i,fetch(`${e}/boolean.wasm`).then(n=>n.arrayBuffer())]);await r.default({module_or_path:s}),_S=r}())}function e4(){if(_S===void 0)throw new Error("boolean-wasm is not loaded");return _S}function U7(t){let e=xS.get(t);if(e===void 0)throw new Error("Unknown csg mesh set handle "+t);return e}function j7(t){return xS.set(++tU,t),tU}function VTt(t,e,i){if(_S===void 0)return-1;let{positions:r,indices:s,normals:n}=function(a,o){if(o&&a.userData.positions!==void 0){let p=a.userData,m=[];for(let f=0,g=0;f<p.verticesPerFace.length;f++){let y=p.verticesPerFace[f];for(let v=1;v<y-1;v++)m.push(p.indices[g],p.indices[g+v],p.indices[g+v+1]);g+=y}return{positions:p.positions instanceof Float32Array?p.positions:new Float32Array(p.positions),indices:new Uint32Array(m)}}let l;l=Cmt(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}}(t,e);return j7(new _S.CsgMesh(r,s,n))}function $X(t,e){let i=e4(),r=Rmt[e];if(r===void 0)throw new Error("Unknown boolean operation "+e);let s=t.map(U7);if(s.length===1)return i.clone_mesh(s[0]);let n,a=[];if(e===2&&s.length>2){let o=s[0];for(let l=1;l<s.length-1;l++)o=i.boolean_mesh(o,s[l],0),a.push(o);n=i.boolean_mesh(s[s.length-1],o,2)}else if(e===2)n=i.boolean_mesh(s[1],s[0],2);else{let o=s[s.length-1];for(let l=0;l<s.length-1&&(o=i.boolean_mesh(o,s[l],r),a.push(o),o.tri_count()!==0);l++);n=o,a.pop()}for(let o of a)o.free();return n}function QD(t,e){U7(t).transform(new Float32Array(e.elements))}function Pmt(t){let e=xS.get(t);e!==void 0&&(e.free(),xS.delete(t))}var _S,xS,tU,XX,Rmt,f5=W(()=>{yt(),bS(),xS=new Map,tU=0,Rmt={0:0,1:1,2:2}});function Qm(t){return t!==null&&"booleanOp"in t}var eU,Nmt,kTt=W(()=>{yt(),vo(),f5(),eU=class extends p5(Ar){constructor(){super(...arguments),this.booleanMeshSetAddress=-1,this.booleanWasTransformed=!1,this.booleanMatrixInvOld=new At}updateVisible(t){super.updateVisible(t),this.visible=!Qm(this.parent)&&this.visible,Qm(this.parent)&&this.parent.invalidateDownstreamBooleanData()}onClonerLayoutUpdated(){Qm(this.parent)&&this.invalidateDownstreamBooleanData()}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(Pmt(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(t=!1){return t?this.booleanWasTransformed=!0:this.freeBooleanPointer(),Qm(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let t of this.children)t instanceof eU&&(t.freeBooleanPointer(),Qm(t)&&t.invalidateUpstreamBooleanData())}updateTransformState(t,e){let i=super.updateTransformState(t,e);return i&&Qm(this.parent)&&this.invalidateDownstreamBooleanData(!0),i}onVariableUpdate(t=!1){super.onVariableUpdate(t),Qm(this.parent)&&this.invalidateDownstreamBooleanData(!0)}}}),zTt=W(()=>{Nmt=null});function G7(t,e=0,i=t.count,r,s){let n=1/0,a=1/0,o=1/0,l=-1/0,u=-1/0,h=-1/0;for(let d=e;d<i;d++){let c=t.getX(d),p=t.getY(d),m=t.getZ(d);c<n&&(n=c),p<a&&(a=p),m<o&&(o=m),c>l&&(l=c),p>u&&(u=p),m>h&&(h=m)}jw.min.set(n,a,o),jw.max.set(l,u,h),jw.getCenter(r),jw.getSize(s).multiplyScalar(.5)}var jw,YX,KX,Is,la=W(()=>{yt(),kTt(),zTt(),jw=new dr,YX=new ye,KX=new Uo,Is=class extends eU{constructor(t,e){super(YX,KX),this.super_Entity(t,e)}updateState(t,e){this.updateState_Entity(t,e)}raycast(t,e){let i=Nmt;i===null?super.raycast(t,e):i(this,t,e)}updateEntityBoxSize(t,e){let i=this.geometry.getAttribute("position");i!==void 0?G7(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,t,e):super.updateEntityBoxSize(t,e)}}});function i4(t){return t?.isClassicNodeMaterial===!0}var Dr,iU,Dmt,Omt,L2,Imt,Bmt,Vmt,W7=W(()=>{}),Pc=W(()=>{yt(),Dr=class extends oe{constructor(t,e,i,r){super(t,e,i),this.isColorA=!0,this.a=r}setRGBA(t,e,i,r){super.setRGB(t,e,i),this.a=r}copy(t){return super.copy(t),this.a="a"in t?t.a:1,this}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}equals(t){return super.equals(t)&&this.a===t.a}setStyle(t,e="srgb"){let i;if(t==="transparent")return this.setRGBA(0,0,0,0),this;if(i=/^((?:rgb|hsl)a?)\(([^)]*)\)/.exec(t)){let r,s=i[1],n=i[2];switch(s){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(n))return this.a=s==="rgba"?parseFloat(r[4]):1,super.setStyle(t,e);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)%\s*,\s*(\d*\.?\d+)%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(n))return this.a=s==="hsla"?parseFloat(r[4]):1,super.setStyle(t,e)}}return super.setStyle(t,e)}get x(){return this.r}get y(){return this.g}get z(){return this.b}get w(){return this.a}set x(t){this.r=t}set y(t){this.g=t}set z(t){this.b=t}set w(t){this.a=t}}}),LTt=W(()=>{Pc(),iU=class extends Dr{}}),FTt=W(()=>{Dmt=class{constructor(t=1e4){this.timeout=t,this.cache=new Map,this.head={data:null,time:0,src:null,next:null,prev:null},this.tail={data:null,time:1/0,src:null,next:null,prev:null},this.hasClean=!1,this.cleanupTimer=null,this.head.next=this.tail,this.tail.prev=this.head}log(...t){}remove(t){let e=this.cache.get(t);e&&(this.dispose(t,e.data),this.cache.delete(t),e.prev.next=e.next,e.next.prev=e.prev,e.next=null,e.prev=null,e.data=null)}scheduleCleanup(){this.hasClean||(this.log("scheduled cleanup"),this.hasClean=!0,this.cleanupTimer=setTimeout(()=>{this.hasClean=!1,this.cleanupTimer=null,this.log("cleaning");let t=Date.now(),e=this.head.next;for(;e.time<t-this.timeout;){this.dispose(e.src,e.data),this.cache.delete(e.src);let i=e;e=e.next,e.prev=this.head,this.head.next=e,i.next=null,i.prev=null,i.data=null}this.head.next!==this.tail?this.scheduleCleanup():this.log("no more cleanup")},this.timeout+1e3))}has(t){return this.cache.get(t)?.data}load(t){let e=Date.now(),i=this.cache.get(t);return i===void 0?(i={data:this.create(t),src:t,time:e,next:null,prev:null},this.cache.set(t,i)):(i.time=e,i.prev.next=i.next,i.next.prev=i.prev),i.prev=this.tail.prev,i.next=this.tail,this.tail.prev.next=i,this.tail.prev=i,this.scheduleCleanup(),i.data}disposeAll(){this.cleanupTimer!==null&&(clearTimeout(this.cleanupTimer),this.cleanupTimer=null),this.hasClean=!1,this.cache.forEach((t,e)=>{this.dispose(e,t.data),t.next=null,t.prev=null,t.data=null}),this.cache.clear(),this.head.next=this.tail,this.tail.prev=this.head}destroy(){this.disposeAll(),this.head=null,this.tail=null}}}),kmt=W(()=>{FTt(),Omt=class extends Dmt{create(t){return URL.createObjectURL(new Blob([t]))}dispose(t,e){URL.revokeObjectURL(e)}}}),zmt=W(()=>{Imt=class{constructor(t,e){this.data=t,this.cache=e,this.refCount=0}deref(){this.refCount,this.refCount-=1,this.refCount===0&&(this.cache.remove(this),this.dispose())}dispose(){this.refCount}},Bmt=class{constructor(){this.cache=new Map}remove(t){this.cache.delete(t.data)}load(t){let e=this.cache.get(t);return e===void 0&&(e=this.create(t),this.cache.set(t,e)),e.refCount+=1,e}}}),UTt=W(()=>{yt(),Vmt=class extends rpt{constructor(t){super(t),this.type=Qe}parse(t){let e=function(p,m){switch(p){case 1:throw new Error("THREE.HDRLoader: Read Error: "+(m||""));case 2:throw new Error("THREE.HDRLoader: Write Error: "+(m||""));case 3:throw new Error("THREE.HDRLoader: Bad File Format: "+(m||""));default:throw new Error("THREE.HDRLoader: Memory Error: "+(m||""))}},i=function(p,m,f){m=m||1024;let g=p.pos,y=-1,v=0,b="",_=String.fromCharCode.apply(null,new Uint16Array(p.subarray(g,g+128)));for(;0>(y=_.indexOf(`
338
338
  `))&&v<m&&g<p.byteLength;)b+=_,v+=_.length,g+=128,_=String.fromCharCode.apply(null,new Uint16Array(p.subarray(g,g+128)));return-1<y&&(f!==!1&&(p.pos+=v+y+1),b+_.slice(0,y))},r=function(p,m,f,g){let y=p[m+3],v=Math.pow(2,y-128)/255;f[g+0]=p[m+0]*v,f[g+1]=p[m+1]*v,f[g+2]=p[m+2]*v,f[g+3]=1},s=function(p,m,f,g){let y=p[m+3],v=Math.pow(2,y-128)/255;f[g+0]=Xh.toHalfFloat(Math.min(p[m+0]*v,65504)),f[g+1]=Xh.toHalfFloat(Math.min(p[m+1]*v,65504)),f[g+2]=Xh.toHalfFloat(Math.min(p[m+2]*v,65504)),f[g+3]=Xh.toHalfFloat(1)},n=new Uint8Array(t);n.pos=0;let a,o,l,u=function(p){let m,f,g=/^#\?(\S+)/,y=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,v=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,b=/^\s*FORMAT=(\S+)\s*$/,_=/^\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||!(m=i(p)))&&e(1,"no header found"),(f=m.match(g))||e(3,"bad initial token"),x.valid|=1,x.programtype=f[1],x.string+=m+`
339
339
  `;m=i(p),m!==!1;)if(x.string+=m+`
340
340
  `,m.charAt(0)!=="#"){if((f=m.match(y))&&(x.gamma=parseFloat(f[1])),(f=m.match(v))&&(x.exposure=parseFloat(f[1])),(f=m.match(b))&&(x.valid|=2,x.format=f[1]),(f=m.match(_))&&(x.valid|=4,x.height=parseInt(f[1],10),x.width=parseInt(f[2],10)),2&x.valid&&4&x.valid)break}else x.comments+=m+`
341
341
  `;return 2&x.valid||e(3,"missing format specifier"),4&x.valid||e(3,"missing image size specifier"),x}(n),h=u.width,d=u.height,c=function(p,m,f){let g=m;if(g<8||g>32767||p[0]!==2||p[1]!==2||128&p[2])return new Uint8Array(p);g!==(p[2]<<8|p[3])&&e(3,"wrong scanline width");let y=new Uint8Array(4*m*f);y.length||e(4,"unable to allocate buffer space");let v=0,b=0,_=4*g,x=new Uint8Array(4),S=new Uint8Array(_),w=f;for(;w>0&&b<p.byteLength;){b+4>p.byteLength&&e(1),x[0]=p[b++],x[1]=p[b++],x[2]=p[b++],x[3]=p[b++],(x[0]!=2||x[1]!=2||(x[2]<<8|x[3])!=g)&&e(3,"bad rgbe scanline format");let M,T=0;for(;T<_&&b<p.byteLength;){M=p[b++];let C=M>128;if(C&&(M-=128),(M===0||T+M>_)&&e(3,"bad scanline data"),C){let R=p[b++];for(let O=0;O<M;O++)S[T++]=R}else S.set(p.subarray(b,b+M),T),T+=M,b+=M}let A=g;for(let C=0;C<A;C++){let R=0;y[v]=S[C+R],R+=g,y[v+1]=S[C+R],R+=g,y[v+2]=S[C+R],R+=g,y[v+3]=S[C+R],v+=4}w--}return y}(n.subarray(n.pos),h,d);switch(this.type){case Je:l=c.length/4;let p=new Float32Array(4*l);for(let f=0;f<l;f++)r(c,4*f,p,4*f);a=p,o=Je;break;case Qe:l=c.length/4;let m=new Uint16Array(4*l);for(let f=0;f<l;f++)s(c,4*f,m,4*f);a=m,o=Qe;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:Yu,minFilter:ge,magFilter:ge,generateMipmaps:!1,flipY:!0}}setDataType(t){return this.type=t,this}}});function ZX(t){return t.length>2&&t[0]===35&&t[1]===63}function JD(t){return typeof t=="object"&&t!==null&&t.isSplineHdr===!0}function Lmt(t){let e=new br(t.data,t.width,t.height,an,Qe);return e.flipY=!1,e.image.isSplineHdr=!0,e.needsUpdate=!0,e}var QX,q7,cg,Fmt=W(()=>{yt(),UTt()}),Umt=W(()=>{yt(),kmt(),zmt(),Fmt(),QX=0,q7=class extends Imt{constructor(t,e){super(t,e.imageHolderCache),this.data=t,this.shared=e,this.instanceId=++QX,this.loaded=!1,this.isVideo=!1,this.isBuffer=!1,this.isHdr=!1,this._cache={1e3:{},1001:{},1002:{}},this.isVideo=t.type==="video",this.isBuffer=t.isWebGLRenderTarget===!0,this.loadPromise=this.updateSrc(this.isBuffer?t:t.data)}async updateSrc(t){if(typeof document>"u")return;this.disposeTextures(),this.loaded=!1,this.isHdr=!1;let e=()=>{this.loaded=!0;for(let r of Object.values(this._cache))for(let s of Object.values(r))for(let n of Object.values(s))n&&(n.image=this.img,n.needsUpdate=!0);this.shared.requestRender()};if(this.isBuffer)this.img=t,this.loaded=!0;else if(this.isVideo){if(this.img=document.createElement("video"),this.img.preload="auto",this.img.playsInline=!0,this.img.currentTime=.01,typeof t!="string"){let r,s=new FileReader;s.readAsDataURL(new Blob([t],{type:"video/mp4"})),await new Promise(n=>{s.onloadend=a=>{r=a.target?.result,n(null)}}),this.img.src=r}else this.img.src=t;this.img.onloadeddata=()=>{e()}}else if(t instanceof Uint8Array?ZX(t):typeof t=="string"&&/\.hdr($|[?#])/i.test(t)){let r=t instanceof Uint8Array?t:null;if(r===null)try{r=new Uint8Array(await(await fetch(t)).arrayBuffer())}catch{r=null}let s=r!==null&&ZX(r)?function(n){try{let a=new Vmt().parse(n.buffer.slice(n.byteOffset,n.byteOffset+n.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=f=>Xh.toHalfFloat(Math.pow(Math.max(Xh.fromHalfFloat(f),0),1/2.2)),p=new Map,m=f=>{let g=p.get(f);return g===void 0&&(g=c(f),p.set(f,g)),g};for(let f=0;f<l;f++){let g=f*d,y=(l-1-f)*d;for(let v=0;v<d;v+=4)h[y+v]=m(u[g+v]),h[y+v+1]=m(u[g+v+1]),h[y+v+2]=m(u[g+v+2]),h[y+v+3]=u[g+v+3]}return{isSplineHdr:!0,data:h,width:o,height:l}}catch{return null}}(r):null;s!==null&&(this.isHdr=!0,this.img=s,e())}else this.img=new Image,this.img.src=typeof(i=t)=="string"?i:(L2||(L2=new Omt),L2.load(i)),this.img.onload=e,await new Promise(r=>{this.img.onload=()=>{e(),r(null)}});var i}getTexture(t,e=1008,i=1006){let r=this._cache[t]?.[e]?.[i];if(r)return r;{let s;return this.isBuffer?s=this.img.texture:this.isVideo?s=new o7(this.img,void 0,t,t):this.isHdr?(s=Lmt(this.img),s.wrapS=t,s.wrapT=t,s.magFilter=i,s.minFilter=e):s=new mi(this.img,void 0,t,t,i,e),this.isBuffer||(s.anisotropy=8,s.generateMipmaps=e===1008),this.loaded&&(s.needsUpdate=!0),this._cache[t]===void 0&&(this._cache[t]={}),this._cache[t][e]===void 0&&(this._cache[t][e]={}),this._cache[t][e][i]=s,s}}setNeedsUpdate(t){if(!this.isBuffer)for(let e of Object.values(this._cache))for(let i of Object.values(e))for(let r of Object.values(i))r&&(r.needsUpdate=t)}disposeTextures(){for(let[t,e]of Object.entries(this._cache))for(let[i,r]of Object.entries(e))for(let[s,n]of Object.entries(r))n?.dispose(),this._cache[t]!==void 0&&this._cache[t][i]!==void 0&&(this._cache[t][i][s]=void 0)}dispose(){super.dispose(),this.disposeTextures()}}}),jmt=W(()=>{Umt(),cg=class extends q7{}});function jTt(t){if(typeof t=="string")return t;let e=rU.get(t);return e||(e={url:URL.createObjectURL(new Blob([t]))},rU.set(t,e)),e.url}var rU,GTt=W(()=>{rU=new Map});function WTt(){if(!sU)return JX||(JX=async function(){await Promise.resolve().then(()=>(zW(),c_t)),Gmt(window!==void 0?window:global),sU=!0}())}var Gmt,Wmt,sU,JX,qmt=W(()=>{Wmt=new Promise(t=>{Gmt=t}),sU=!1});function tY(t,e){t.forEach(i=>{"dragDropActions"in i.data?(e.push(...i.data.dragDropActions.drag),e.push(...i.data.dragDropActions.drop)):"inActions"in i.data?(e.push(...i.data.inActions),e.push(...i.data.outActions)):"gameActions"in i.data?(e.push(...i.data.gameActions.idle),e.push(...i.data.gameActions.move),e.push(...i.data.gameActions.jump),e.push(...i.data.gameActions.run)):"breakpoints"in i.data?i.data.breakpoints.forEach(r=>{e.push(...r.data.actions)}):"actions"in i.data&&(e.push(...i.data.actions),i.data.actions.forEach(r=>{r.data.type==="Conditional"&&r.data.ifActions&&(e.push(...r.data.ifActions),e.push(...r.data.elseActions))}))})}function qTt(t){let e=!1,i=[];return t.scene.objects.traverse((r,s)=>{if(s.type==="Page"&&s.uiScene!==void 0&&s.uiScene.objects.traverse((n,a)=>{if(a.events===void 0||Array.isArray(a.events)===!1)return!0;tY(a.events,i),e=e||i.some(o=>o.data.type==="Audio")}),s.events===void 0||Array.isArray(s.events)===!1)return!0;tY(s.events,i),e=e||i.some(n=>n.data.type==="Audio")}),e}var eY,X1,H7=W(()=>{GTt(),qmt(),Wmt.then(t=>eY=t),X1=class{constructor({src:t,volume:e,delay:i,loop:r}){let s;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)},s=typeof t=="string"?{src:t}:{src:jTt(t),format:"wav"},this.sound=new eY.Howl(s),this.sound.on("end",this.onEnd),this.src=t,e!==void 0&&(this.volume=e),i!==void 0&&(this.delay=i),r!==void 0&&(this.loop=r)}get status(){return this._status}get volume(){return this._volume}set volume(t){this._volume=t,this.sound.volume(t)}get loop(){return this._loop}set loop(t){this._loop=t,this.loopsRemaining=t}replay(){this.clearDelay(),this.delayTimerId=window.setTimeout(()=>{this.sound.play(),this.clearDelay()},this.delay)}fade(t,e=1e3){t?(this.sound.volume(this._volume),this.clearFade(),this.fadeTimerId=window.setTimeout(()=>{this.sound.fade(this._volume,0,e),this.clearFade()},t)):this.sound.fade(this._volume,0,e)}on(t,e,i){this.sound.on(t,e,i)}off(t,e,i){this.sound.off(t,e,i)}play(){this._status==="playing"||this.sound.playing()||(this._status==="paused"?(this.sound.seek()===0?this.replay():this.sound.play(),this._status="playing"):this._status==="stopped"&&(this.replay(),this._status="playing"))}pause(){this._status==="playing"&&(this.sound.pause(),this.clearFade(),this.clearDelay(),this._status="paused")}stop(){this.sound.stop(),this.loopsRemaining=this._loop,this.clearFade(),this.clearDelay(),this._status="stopped"}clearFade(){this.fadeTimerId&&(clearTimeout(this.fadeTimerId),delete this.fadeTimerId)}clearDelay(){this.delayTimerId&&(clearTimeout(this.delayTimerId),delete this.delayTimerId)}dispose(t=!1){this.off(),this.stop(),this.clearFade(),this.clearDelay()}}});function iY(t){let e=!1;return t.scene.objects.traverse((i,r)=>{r.type==="Mesh"&&(r.geometry.type==="TextGeometry"||r.geometry.type==="InputGeometry")&&(e=!0)}),e}var $7,X7=W(()=>{$7=null});function rY(t){return new Z(t.y,-t.x)}var Y7,nU,Hmt,$mt,pM,sY,r4,Xmt,tO,s4=W(()=>{yt(),Y7=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=t.parameters?.radiusTop,r=t.parameters?.radiusBottom,s=Object.assign({},e?.parameters??{width:100,radialSegments:64,heightSegments:1,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadius:8,cornerSegments:8,hollow:0},t.parameters);s.thetaLength=Yt.clamp(s.thetaLength,0,360),s.hollow=Yt.clamp(s.hollow??0,0,1);let n=s.width/2,a=s.radiusTop??n,o=s.radiusBottom??n;if(a===o?(a=n,o=n):a>o?(a=n,o=o*n/a):(a=a*n/o,o=n),s.shapeBlendNode){a=i??n,o=r??n;let l=2*Math.max(a,o);s.width=l,s.depth=l}return{parameters:Object.assign(s,{width:Math.abs(s.width),height:Math.abs(s.height??s.width),depth:Math.abs(s.depth??s.width),radiusTop:a,radiusBottom:o})}}static build(t){let e,{width:i,depth:r,height:s,radialSegments:n,heightSegments:a,openEnded:o,thetaStart:l,thetaLength:u,radiusTop:h,radiusBottom:d,cornerRadius:c,cornerSegments:p,hollow:m}=t.parameters;u===0?(e=new ye,e.setAttribute("position",new me([],3))):e=c||m?new nU(h,d,s,n,a,o,l,u*Math.PI/180,c,c,p,m):new P2(h,d,s,n,a,o,l,u*Math.PI/180);let f=r/i;return f!==1&&e.scale(1,1,f),Object.assign(e,{userData:{...t,type:"CylinderGeometry"}})}},nU=class extends ye{constructor(t,e,i,r,s,n,a,o,l,u,h,d,c=!1){super(),this.type="RoundedCylinderBufferGeometry",t=t!==void 0?t:1,e=e!==void 0?e:1,i=i||1,r=Math.floor(r)||8,s=Math.floor(s)||1,n=n!==void 0&&n,a=a!==void 0?a:0,o=o!==void 0?o:2*Math.PI,n&&(l=0,u=0);let p=i/2;c&&t==0&&(t=l),c&&e==0&&(e=u);let m=new Z(t,p),f=new Z(e,-p),g=null,y=null,v=null,b=null,_=m.clone().sub(f),x=0,S=0,w=0;d>0&&(x=Math.min(t,e)*(1-d),S=t-x,w=e-x);let M=m.clone();M.x-=x;let T=Math.PI-_.angle(),A=_.angle(),C=Math.tan(A/2),R=Math.tan(T/2),O=C+R,D=d?O:R,B=d?O:C;if(l=Math.min(l,(t-S)/D,_.length()/O),u=Math.min(u,(e-w)/B,_.length()/O),l>0){let Pt=l/C;g=m.clone().sub(new Z(Pt,l)),d&&(v=g.clone(),v.x-=x-O*l),m.sub(_.clone().setLength(Pt))}if(u>0){let Pt=u/R;y=f.clone().sub(new Z(Pt,-u)),f.add(_.clone().setLength(Pt)),d&&(b=y.clone(),b.x-=x-O*u,M.sub(_.clone().setLength(Pt)))}_=m.clone().sub(f);let k=_.length()<.5,j=[],z=[],V=[],H=[],U=[],et=[],at=(Pt,Dt,It,Ot,Qt)=>{for(let Lt=0;Lt<h+1;Lt++){let Jt=Lt/h,qt=Ot<0?Jt:1-Jt;Qt&&(qt-=1),qt*=Pt;let X=Math.sin(qt),$t=Math.cos(qt)*Ot,Te=$t*Dt+It.y;j.push(X*Dt+It.x),z.push(Te),V.push(X),H.push($t),U.push(.5+Te/i),et.push(!1)}},Q=(Pt,Dt,It)=>{let Ot=[Pt,Dt];It<0&&Ot.reverse();for(let Qt of Ot)j.push(Qt),z.push(p*It),V.push(0),H.push(It),U.push(.5),et.push(!0)};if(b&&y?(at(T,u,b,-1,!0),at(A,u,y,-1,!1)):y?(Q(y.x,0,-1),at(A,u,y,-1,!1)):n||Q(e,w,-1),!k){let Pt=rY(_).normalize();for(let Dt=0;Dt<=s;Dt++){let It=Dt/s,Ot=_.y*It+f.y;j.push(_.x*It+f.x),z.push(Ot),V.push(Pt.x),H.push(Pt.y),U.push(.5+Ot/i),et.push(!1)}}if(v&&g?(at(T,l,g,1,!1),at(A,l,v,1,!0)):g?(at(T,l,g,1,!1),Q(g.x,0,1)):n||Q(t,S,1),d&&!k){let Pt=rY(_).multiplyScalar(-1).normalize();for(let Dt=0;Dt<=s;Dt++){let It=Dt/s,Ot=_.y*-It+M.y;j.push(_.x*-It+M.x),z.push(Ot),V.push(Pt.x),H.push(Pt.y),U.push(.5+Ot/i),et.push(!1)}}let ut=j.length,ht=ut+(d&&!n?1:0),q=(Pt,Dt)=>Pt*ut+(Dt===ut?0:Dt),nt=o<2*Math.PI,Tt=(r+1)*ut+(nt?2*(1+ht):0),gt=new Float32Array(3*Tt),vt=new Float32Array(3*Tt),ct=new Float32Array(2*Tt),St=Tt-1>65535?new Uint32Array(r*Math.max(0,ht-1)*6+(nt?2*(ht+1)*3:0)):new Uint16Array(r*Math.max(0,ht-1)*6+(nt?2*(ht+1)*3:0)),Mt=0,Ct=0;for(let Pt=0;Pt<=r;Pt++){let Dt=Pt/r,It=Dt*o+a,Ot=Math.sin(It),Qt=Math.cos(It);for(let Lt=0;Lt<ut;Lt++){let Jt=3*Ct,qt=2*Ct,X=j[Lt],$t=V[Lt];gt[Jt]=X*Ot,gt[Jt+1]=z[Lt],gt[Jt+2]=X*Qt,vt[Jt]=$t*Ot,vt[Jt+1]=H[Lt],vt[Jt+2]=$t*Qt,et[Lt]?(ct[qt]=.5,ct[qt+1]=.5):(ct[qt]=Dt,ct[qt+1]=U[Lt]),Ct++}}for(let Pt=0;Pt<r;Pt++)for(let Dt=0;Dt<ht-1;Dt++){if(n&&d&&Dt==s)continue;let It=q(Pt,Dt),Ot=q(Pt+1,Dt),Qt=q(Pt+1,Dt+1),Lt=q(Pt,Dt+1),Jt=gt[3*Qt+0],qt=gt[3*Qt+2];St[Mt++]=It,St[Mt++]=Ot,St[Mt++]=Lt,(Jt!=0||qt!=0)&&(St[Mt++]=Ot,St[Mt++]=Qt,St[Mt++]=Lt)}function Vt(Pt,Dt,It){let Ot=Math.sin(It),Qt=Math.cos(It),Lt=-Qt,Jt=Ot,qt=Pt<0?(ee,oi,xi)=>{St[Mt++]=ee,St[Mt++]=oi,St[Mt++]=xi}:(ee,oi,xi)=>{St[Mt++]=ee,St[Mt++]=xi,St[Mt++]=oi},X=(t+e+S+w)/4,$t=3*Ct,Te=2*Ct;gt[$t]=X*Ot,gt[$t+1]=0,gt[$t+2]=X*Qt,vt[$t]=Lt,vt[$t+1]=0,vt[$t+2]=Jt,ct[Te]=.5,ct[Te+1]=.5;let Be=Ct++;for(let ee=0;ee<ht;ee++){let oi=3*(Dt+(ee===ut?0:ee));$t=3*Ct,Te=2*Ct,gt[$t]=gt[oi],gt[$t+1]=gt[oi+1],gt[$t+2]=gt[oi+2],vt[$t]=Lt,vt[$t+1]=0,vt[$t+2]=Jt;let xi=oi/3*2|0;ct[Te]=ct[xi],ct[Te+1]=ct[xi+1],Ct++}for(let ee=Be+1;ee<Ct-1;ee++)qt(Be,ee,ee+1);qt(Be,Ct-1,Be+1)}nt&&(Vt(-1,0,a),Vt(1,r*ut,a+o)),this.setIndex(new Se(St.slice(0,Mt),1)),this.setAttribute("position",new Se(gt,3)),this.setAttribute("normal",new Se(vt,3)),this.setAttribute("uv",new Se(ct,2))}}}),nY=W(()=>{yt(),s4(),Hmt=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,radialSegments:32,heightSegments:8,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadiusTop:8,cornerRadiusBottom:8,cornerSegments:8},t.parameters);return i.thetaLength=Yt.clamp(i.thetaLength,0,360),{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let e,{width:i,depth:r,height:s,radialSegments:n,heightSegments:a,openEnded:o,thetaStart:l,thetaLength:u,cornerRadiusTop:h,cornerRadiusBottom:d,cornerSegments:c}=t.parameters;u===0?(e=new ye,e.setAttribute("position",new me([],3))):e=h>0||d>0||u<360?new nU(0,i/2,s,n,a,o,l,u*Math.PI/180,h,d,c,0,!0):new TR(i/2,s,n,a,o);let p=r/i;return p!==1&&e.scale(1,1,p),Object.assign(e,{userData:{...t,type:"ConeGeometry"}})}}}),aY=W(()=>{yt(),$mt=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,widthSegments:1,heightSegments:1,depthSegments:1,cornerRadius:8,cornerSegments:8},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let e,{width:i,height:r,depth:s,widthSegments:n,heightSegments:a,depthSegments:o,cornerRadius:l,cornerSegments:u}=t.parameters;return e=l===0?new Kh(i,r,s,n,a,o):new sY(i,r,s,n,a,o,l,u),Object.assign(e,{userData:{...t,type:"CubeGeometry"}})}},pM=Math.PI/2,sY=class extends ye{constructor(t=1,e=1,i=1,r=1,s=1,n=1,a=0,o=4){super(),this.type="BoxGeometry",r=Math.floor(r),s=Math.floor(s),n=Math.floor(n),o=Math.floor(o);let l=(a=Math.min(a,t/2,e/2,i/2))>0,u=o+1,h=2*((n+1)*(s+1)+(r+1)*(n+1)+(r+1)*(s+1))+(l?4*u*(n+1+(r+1)+(s+1))+u*(u+1)/2*8:0),d=2*(n*s+r*n+r*s)+(l?4*o*(n+r+s):0),c=l?8*o*o:0,p=new Float32Array(3*h),m=new Float32Array(3*h),f=new Float32Array(2*h),g=h-1>65535?new Uint32Array(6*d+3*c):new Uint16Array(6*d+3*c),y=0,v=0,b=new Float64Array(u),_=new Float64Array(u),x=new Float64Array(u),S=new Float64Array(u);for(let O=0;O<u;O++){let D=O/o*pM;b[O]=Math.sin(D)*a,_[O]=(1-Math.cos(D))*a,x[O]=Math.sin(D),S[O]=Math.cos(D)}let w=u*(u+1)/2,M=new Float64Array(3*w),T=new Float64Array(3*w);{let O=new P(t/2,e/2,i/2);O.subScalar(a);let D=0;for(let B=0;B<=o;B++){let k=pM*(1-B/o),j=Math.cos(k),z=Math.sin(k),V=0;for(let H=0;H<=B;H++){let U=j*Math.cos(V),et=z,at=j*Math.sin(V);M[3*D]=U,M[3*D+1]=et,M[3*D+2]=at,T[3*D]=O.x+U*a,T[3*D+1]=O.y+et*a,T[3*D+2]=O.z+at*a,D++,V+=pM/B}}}function A(O,D,B,k,j,z,V,H,U,et){let at=(z-2*a)/U,Q=(V-2*a)/et,ut=z/2-a,ht=V/2-a,q=H/2,nt=U+1,Tt=et+1,gt=0,vt=new P;for(let ct=0;ct<Tt;ct++){let St=ct*Q-ht;for(let Mt=0;Mt<nt;Mt++){let Ct=Mt*at-ut,Vt=3*(y+gt),Pt=2*(y+gt);vt[O]=Ct*k,vt[D]=St*j,vt[B]=q,p[Vt]=vt.x,p[Vt+1]=vt.y,p[Vt+2]=vt.z,vt[O]=0,vt[D]=0,vt[B]=H>0?1:-1,m[Vt]=vt.x,m[Vt+1]=vt.y,m[Vt+2]=vt.z,f[Pt]=Mt/U,f[Pt+1]=1-ct/et,gt+=1}}for(let ct=0;ct<et;ct++)for(let St=0;St<U;St++){let Mt=y+St+nt*ct,Ct=y+St+nt*(ct+1),Vt=y+(St+1)+nt*(ct+1),Pt=y+(St+1)+nt*ct;g[v++]=Mt,g[v++]=Ct,g[v++]=Pt,g[v++]=Ct,g[v++]=Vt,g[v++]=Pt}y+=gt}function C(O,D,B,k,j,z,V,H,U,et){let at=(V-2*a)/et,Q=V/2-a,ut=H/2-a,ht=U/2,q=et+1,nt=0,Tt=new P,gt=new P;for(let vt=0;vt<o+1;vt++){Tt[D]=(ut+b[vt])*j,Tt[B]=(ht-_[vt])*z,gt[O]=0,gt[D]=x[vt]*Math.sign(Tt[D]),gt[B]=S[vt]*Math.sign(Tt[B]);for(let ct=0;ct<q;ct++){let St=ct*at-Q;Tt[O]=St*k;let Mt=3*(y+nt),Ct=2*(y+nt);p[Mt]=Tt.x,p[Mt+1]=Tt.y,p[Mt+2]=Tt.z,m[Mt]=gt.x,m[Mt+1]=gt.y,m[Mt+2]=gt.z,f[Ct]=ct/et,f[Ct+1]=0,nt+=1}}for(let vt=0;vt<o;vt++)for(let ct=0;ct<et;ct++){let St=y+ct+q*vt,Mt=y+ct+q*(vt+1),Ct=y+(ct+1)+q*(vt+1),Vt=y+(ct+1)+q*vt;g[v++]=St,g[v++]=Mt,g[v++]=Vt,g[v++]=Mt,g[v++]=Ct,g[v++]=Vt}y+=nt}function R(O,D,B){let k=O*D*B>0?(z,V,H)=>{g[v++]=z,g[v++]=V,g[v++]=H}:(z,V,H)=>{g[v++]=z,g[v++]=H,g[v++]=V},j=y;for(let z=0;z<w;z++){let V=3*z,H=3*y,U=2*y;p[H]=O*T[V],p[H+1]=D*T[V+1],p[H+2]=B*T[V+2],m[H]=O*M[V],m[H+1]=D*M[V+1],m[H+2]=B*M[V+2],f[U]=0,f[U+1]=0,y++}for(let z=0;z<o;z++){let V=j+z*(z+1)/2,H=j+(z+1)*(z+2)/2;k(V,H+1,H);for(let U=1;U<=z;U++)k(V+U-1,V+U,H+U),k(V+U,H+U+1,H+U)}}A("z","y","x",-1,-1,i,e,t,n,s),A("z","y","x",1,-1,i,e,-t,n,s),A("x","z","y",1,1,t,i,e,r,n),A("x","z","y",1,-1,t,i,-e,r,n),A("x","y","z",1,-1,t,e,i,r,s),A("x","y","z",-1,-1,t,e,-i,r,s),a>0&&(C("z","y","x",-1,-1,1,i,e,t,n),C("z","y","x",1,-1,-1,i,e,t,n),C("z","y","x",-1,1,-1,i,e,t,n),C("z","y","x",1,1,1,i,e,t,n),C("x","y","z",-1,-1,-1,t,e,i,r),C("x","y","z",1,-1,1,t,e,i,r),C("x","y","z",-1,1,1,t,e,i,r),C("x","y","z",1,1,-1,t,e,i,r),C("y","x","z",-1,-1,1,e,t,i,s),C("y","x","z",1,-1,-1,e,t,i,s),C("y","x","z",1,1,1,e,t,i,s),C("y","x","z",-1,1,-1,e,t,i,s),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 Se(g,1)),this.setAttribute("position",new Se(p,3)),this.setAttribute("normal",new Se(m,3)),this.setAttribute("uv",new Se(f,2))}}}),Ymt=W(()=>{yt(),r4=class extends ye{constructor(t=[],e=[],i="",r=1,s=.2,n=4){super(),this.type="PolyhedronGeometryRound";let a,o,l,u=0;return function(){(s=Math.min(.99999,s))==0&&(n=0);let h={IcosahedronGeometry:5,DodecahedronGeometry:3,HexahedronGeometry:3,OctahedronGeometry:4,TetrahedronGeometry:3}[i],d=new P,c=d.clone(),p=new Os,m=s*r,f=r-m,g=n+1,y=new P,v=(q,nt)=>y.subVectors(q,nt).normalize(),b=(q,nt)=>Array(q).fill(void 0).map(nt),_=b(t.length/3,(q,nt)=>new P().fromArray(t,3*nt).setLength(r)),x=[],S=1e6;for(let q=0;q<_.length;q++){let nt,Tt,gt,vt=_[q],ct=[],St=1e10,Mt=-1;for(;(Mt=e.indexOf(q,Mt+1))!=-1;){let Dt=Mt-Mt%3;nt=e[Dt+(Mt+1)%3],Tt=e[Dt+(Mt+2)%3],gt=vt.distanceToSquared(_[nt]),St=Math.min(St,gt),ct.push([nt,Tt,gt])}St+=1e-6;let Ct=[],Vt=0,Pt=ct.length;for(let Dt=0;Dt<Pt;Dt++){[nt,Tt,gt]=ct[Vt];let It=x[nt]?.includes(q)==1;gt<=St&&Ct.push(nt+ +It*S),Vt=ct.findIndex(Ot=>Ot[0]==Tt)}x.push(Ct)}let w=[];{let q,nt,Tt=0,gt=0,vt=h==3;for(let ct=0;ct<=n;ct++){q=ct*(ct+1)/2,nt=(ct+1)*(ct+2)/2;for(let St=0;St<n-ct;St++)[Tt,gt]=[q+St+ct+2,nt+St+ct+3],w.push(q,nt,...vt?[gt,q]:[Tt,nt],gt,Tt),[q,nt]=[Tt,gt];w.push(q,nt,q+n+2)}}let M=0;for(let q=0;q<x.length;q++)for(let nt=0;nt<h;nt++)x[q][nt]<S&&M++;let T=_.length*h*w.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 A=(q,nt,Tt)=>{let gt=u/3*2;l[gt]=Math.atan2(Tt,-q)/2/Math.PI+.5,l[gt+1]=1-(Math.atan2(-nt,Math.sqrt(q*q+Tt*Tt))/Math.PI+.5)},C=q=>{a[u]=q.x,a[u+1]=q.y,a[u+2]=q.z,o[u]=y.x,o[u+1]=y.y,o[u+2]=y.z,A(q.x,q.y,q.z),u+=3},R=q=>{a[u]=q[0].x,a[u+1]=q[0].y,a[u+2]=q[0].z,o[u]=q[1].x,o[u+1]=q[1].y,o[u+2]=q[1].z,A(q[0].x,q[0].y,q[0].z),u+=3},O=(n+2)*(n+3)/2,D=new Float64Array(3*O),B=new Float64Array(3*O),k=new Float64Array(2*O),j=b(2*h*g,()=>new P),z=b(n*Math.max(0,n-1)/2,()=>new P),V=d.clone(),H=d.clone(),U=d.clone(),et=d.clone(),at=d.clone(),Q=[],ut=b(_.length,()=>b(h,()=>d.clone()));for(let q=0;q<_.length;q++){d.copy(_[q]).normalize(),V.copy(d).multiplyScalar(f);let nt=x[q];for(let Ct=0;Ct<nt.length;Ct++){let Vt=nt[Ct],Pt=nt[(Ct+1)%h];p.setFromPointsAndIndices(_,q,Vt%S,Pt%S),p.b.sub(p.a).setLength(1e10).add(p.a),p.c.sub(p.a).setLength(1e10).add(p.a),p.closestPointToPoint(V,ut[q][Ct])}let Tt=0,gt=[],vt=[],ct=new P;n==0&&[...ut[q]].reduce((Ct,Vt)=>Ct.add(Vt),ct).multiplyScalar(1/h);for(let Ct=0;Ct<h;Ct++){let Vt=[],Pt=(Ct-1+h)%h,Dt=ut[q][Pt],It=ut[q][Ct];d.copy(Dt).sub(V),c.copy(It).sub(V);let Ot=V.angleTo(d),Qt=d.angleTo(c),Lt=Math.cos(Ot)*m;n==0?H.copy(ct):H.copy(V).setLength(f+Lt),gt.push(Lt);let Jt=[H,Dt,It];for(let qt=0;qt<2;qt++){let X=Jt[qt],$t=Jt[qt+1];et.subVectors(X,V),at.subVectors($t,V),U.crossVectors(et,at).normalize();for(let Te=0;Te<g;Te++){let Be=[Ot,Qt][qt]*Te/g;d.copy(et).applyAxisAngle(U,Be).add(V),j[Tt++].copy(d),qt&&(v(d,V),Vt.push([Te==0?X:d.clone(),y.clone()]))}qt&&(v($t,V),Vt.push([$t,y.clone()]))}vt.push(Vt)}Q.push(vt);let St=2*g,Mt=2;for(let Ct=0;Ct<h;Ct++){let Vt=St*Ct,Pt=St*((Ct+1)%h),Dt=0,It=[j[Vt]];for(let Ot=1;Ot<g;Ot++){let Qt=j[Vt+Ot],Lt=j[Pt+Ot];It.push(Qt);for(let Jt=1,qt=Ot-Mt+1;Jt<=qt;Jt++)d.lerpVectors(Qt,Lt,Jt/(qt+1)),d.sub(V).setLength(gt[Ct]).add(V),It.push(z[Dt++].copy(d));It.push(Lt)}for(let Ot=0;Ot<g;Ot++)It.push(j[Ot+g+Vt]);It.push(j[Pt+g]);for(let Ot=0,Qt=It.length;Ot<Qt;Ot++){let Lt=It[Ot],Jt=3*Ot,qt=2*Ot;D[Jt]=Lt.x,D[Jt+1]=Lt.y,D[Jt+2]=Lt.z,v(Lt,V),B[Jt]=y.x,B[Jt+1]=y.y,B[Jt+2]=y.z,k[qt]=Math.atan2(Lt.z,-Lt.x)/2/Math.PI+.5,k[qt+1]=1-(Math.atan2(-Lt.y,Math.sqrt(Lt.x*Lt.x+Lt.z*Lt.z))/Math.PI+.5)}for(let Ot=0,Qt=w.length;Ot<Qt;Ot++){let Lt=3*w[Ot],Jt=2*w[Ot],qt=u/3*2;a[u]=D[Lt],a[u+1]=D[Lt+1],a[u+2]=D[Lt+2],o[u]=B[Lt],o[u+1]=B[Lt+1],o[u+2]=B[Lt+2],l[qt]=k[Jt],l[qt+1]=k[Jt+1],u+=3}}}let ht=[];for(let q=0;q<x.length;q++)for(let nt=0;nt<h;nt++){let Tt=x[q][nt];if(Tt<S){let gt=x[Tt].findIndex(St=>St%S==q),vt=Q[q][nt],ct=Q[Tt][gt];for(let St=0;St<g;St++){let Mt=vt[St],Ct=ct[g-St],Vt=vt[St+1],Pt=ct[g-(St+1)];R(Mt),R(Ct),R(Vt),R(Vt),R(Ct),R(Pt)}ht.push(vt[0][0],ct[g][0],vt[g][0],ct[0][0])}}for(;ht.length;){let q,nt,Tt,[gt,vt]=ht.splice(0,2);q=vt;let ct=[gt];for(;gt!=q;)ct.push(q),nt=ht.indexOf(q),Tt=nt%2,q=ht.splice(nt-Tt,2)[1-Tt];y.subVectors(ct[0],ct[1]).cross(d.subVectors(ct[0],ct[2])).normalize();let St=y.dot(ct[0])<0;St&&y.negate();for(let Mt=1;Mt<=ct.length-2;Mt++)C(ct[Mt+ +St]),C(ct[Mt+1-+St]),C(ct[0])}}(),function(){let h=new P,d=new P,c=new P,p=new P,m=new Z,f=new Z,g=new Z,y=(_,x,S,w)=>{w<0&&_.x===1&&(l[x]=_.x-1),S.x===0&&S.z===0&&(l[x]=w/2/Math.PI+.5)};for(let _=0,x=0;_<u;_+=9,x+=6){h.set(a[_+0],a[_+1],a[_+2]),d.set(a[_+3],a[_+4],a[_+5]),c.set(a[_+6],a[_+7],a[_+8]),m.set(l[x+0],l[x+1]),f.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 S=b(p);y(m,x+0,h,S),y(f,x+2,d,S),y(g,x+4,c,S)}let v=u/3*2;for(let _=0;_<v;_+=6){let x=l[_+0],S=l[_+2],w=l[_+4],M=Math.max(x,S,w),T=Math.min(x,S,w);M>.9&&T<.1&&(x<.2&&(l[_+0]+=1),S<.2&&(l[_+2]+=1),w<.2&&(l[_+4]+=1))}function b(_){return Math.atan2(_.z,-_.x)}}(),this.setAttribute("position",new Se(new Float32Array(a.subarray(0,u)),3)),this.setAttribute("normal",new Se(new Float32Array(o.subarray(0,u)),3)),void this.setAttribute("uv",new Se(new Float32Array(l.subarray(0,u/3*2)),2))}static fromJSON(t){return new r4(t.vertices,t.indices,t.radius,t.corner,t.cornerSides)}}}),oY=W(()=>{Ymt(),yt(),Xmt=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,detail:0,corner:0,cornerSides:4},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let{width:e,height:i,depth:r,detail:s,corner:n,cornerSides:a}=t.parameters,o=s===0&&n!==0?new tO(.5*e,n,a):new qF(.5*e,s),l=i/e,u=r/e;return(l!==1||u!==1)&&o.scale(1,l,u),Object.assign(o,{userData:{...t,type:"DodecahedronGeometry"}})}},tO=class extends r4{constructor(t=1,e=.2,i=4){let r=(1+Math.sqrt(5))/2,s=1/r,n="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,-s,-r,0,-s,r,0,s,-r,0,s,r,-s,-r,0,-s,r,0,s,-r,0,s,r,0,-r,0,-s,r,0,-s,-r,0,s,r,0,s],[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],n,t,e,i),this.type=n}static fromJSON(t){return new tO(t.radius,t.corner,t.cornerSides)}}});function lY(t,e=new Z){let i=t.length();return e.set(-t.y/i,t.x/i)}function HTt(t){let e=new Z;e.addVectors(t.v0,Cg.subVectors(t.v1,t.v0).multiplyScalar(2/3));let i=new Z;return i.addVectors(t.v2,wS.subVectors(t.v1,t.v2).multiplyScalar(2/3)),new Yl(t.v0,e,i,t.v2)}function Gw(t,e,i=Number.EPSILON){return Math.abs(t-e)<i}function $Tt(t,e,i=Number.EPSILON){return t.distanceTo(e)<i}function XTt(t,e,i=Number.EPSILON){return t.distanceTo(e)<i}function Kmt(t,e,i){let r=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),s=Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2)),n=Math.sqrt(Math.pow(i.x-t.x,2)+Math.pow(i.y-t.y,2));return Math.acos((s*s+r*r-n*n)/(2*s*r))}function YTt(t,e,i){return uY(t,e)&&uY(e,i)&&aU(t.position,e.position,i.position)}function aU(t,e,i){return Cg.copy(e).sub(t).cross(wS.copy(i).sub(t))===0}function KTt(t,e,i,r,s){let n=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),a=(t.y+e.y)/2,o=(t.x+e.x)/2,l=Math.sqrt(Math.pow(i,2)-Math.pow(n/2,2))*(t.y-e.y)/n,u=Math.sqrt(Math.pow(i,2)-Math.pow(n/2,2))*(e.x-t.x)/n;return r.set(o+l,a+u),s.set(o-l,a-u),[r,s]}function ZTt(t,e,i){return t.distanceTo(i)<e.distanceTo(i)?e:t}function QTt(t,e,i,r,s,n){let a,o=e.x-t.x,l=e.y-t.y,u=i.x-t.x,h=i.y-t.y,d=Math.sqrt((o+u)*(o+u)+(l+h)*(l+h));return Kmt(e,t,i)>Math.PI&&(d*=-1),a=Gw(h,l)?(l+h)*(r/d-.5)*8/3/(o-u):(o+u)*(r/d-.5)*8/3/(h-l),s.set(e.x-a*l,e.y+a*o),n.set(i.x+a*h,i.y-a*u),[s,n]}function hY(t,e){return t.position.equals(t.controls[1].position)&&e.position.equals(e.controls[0].position)}function uY(t,e){return aU(t.position,t.controls[1].position,e.position)&&aU(t.position,e.controls[0].position,e.position)}function dY(t,e=12,i=!1){let r=[];for(let s=0,n=t.length;s<n;s++){let a=t[s],o=0;if(i&&a.roundedCurveCorner!==void 0){let l=.5*Ag(a.roundedCurveCorner,e);s>0&&(r[s-1]+=l),o+=l}a.curveAfter!==void 0&&(o+=Ag(a.curveAfter,e)),r.push(o)}return t.length>0&&i&&t[0].roundedCurveCorner!==void 0&&(r[t.length-1]+=.5*Ag(t[0].roundedCurveCorner,e)),r}function Ag(t,e=12){return t&&t instanceof Ow?2*e:t&&(t instanceof cl||t instanceof HF)?1:t&&t instanceof sP?e*t.points.length:e}var C1,mM,fM,Ug,gP,Cg,wS,Zmt,Qmt,Jmt,tft,oU,lU,gM,cY,pY,mY,fY,gY,us,eft=W(()=>{yt(),C1=1e-12,mM=class{constructor(t){this.position=new Z,this.startPosition=new Z,this.uuid=Yt.generateUUID(),this.position=t.clone()}start(){this.reset()}reset(){this.startPosition.copy(this.position)}applyOffset(t){this.position.copy(this.startPosition).add(t)}copy(t){return this.position.copy(t.position),this.startPosition.copy(t.startPosition),this}clone(){return new mM(this.position).copy(this)}toJSON(){return[this.position.x,this.position.y]}},fM=class extends mM{constructor(t){super(t.position),this.parent=t}copy(t){return super.copy(t),this}clone(){return new fM(this.parent).copy(this)}},Ug=class extends mM{constructor(t,e){super(e),this.controls=[],this.roundness=0,this.areControlsDirectionsMirrored=!0,this.uuid=t,this.controls.push(new fM(this),new fM(this))}static create(t,e){let i=new Ug(t,new Z(...e.position));return i.controls[0].position.set(...e.controlPrevious.position),i.controls[1].position.set(...e.controlNext.position),i.roundness=e.roundness,i.areControlsDirectionsMirrored=e.areControlsDirectionsMirrored,i}getOppositeControl(t){let e=this.controls.indexOf(t);return e===0?this.controls[1]:e===1?this.controls[0]:null}applyOffsetToControls(t,e=1){for(let i=0,r=this.controls.length;i<r;i++){let s=this.controls[i];this.position.distanceTo(s.position)<=e?s.position.copy(this.position):s.applyOffset(t)}}controlsMoved(){return!(this.position.equals(this.controls[0].position)&&this.position.equals(this.controls[1].position))}copy(t){return super.copy(t),this.controls[0].copy(t.controls[0]),this.controls[1].copy(t.controls[1]),this.roundness=t.roundness,this.uuid=t.uuid,this}clone(){return new Ug(this.uuid,this.position).copy(this)}toJSON(){return super.toJSON().concat(this.controls[0].toJSON(),this.controls[1].toJSON(),[this.roundness])}computeTangents(){let t=this.curveBefore?.getTangentAt(1),e=this.curveAfter?.getTangentAt(0);return[t,e]}computeNormals(t=new Z,e=new Z){let[i,r]=this.computeTangents();return i&&r&&(lY(i,t),lY(r,e)),[t,e]}computeTangent(t=new Z){let[e,i]=this.computeTangents();return e&&i&&t.copy(e).add(i).normalize(),t}computeNormal(t=new Z){let[e,i]=this.computeNormals();return t.copy(e).add(i).normalize(),t}},gP=t=>t,Cg=new Z,wS=new Z,Zmt=new Z,Qmt=new Z,Jmt=new Z,tft=new Z,oU=new P,lU=new P}),vm=W(()=>{yt(),eft(),gM=new Z,cY=new Z,pY=new Z,mY=new Z,fY=new Z,gY=new Z,us=class extends aS{constructor(t=100,e=100){super(),this.points=[],this.shapeHoles=[],this.plane=new Ra(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=Yt.generateUUID(),this.needsUpdate=!1,this.roundedCurves=[],this._width=t,this._height=e}static createFromState(t,e,i){let r=new us;return r.isClosed=t.isClosed,r.points=t.points.map(s=>Ug.create(s.id,s.data)),typeof t.roundness=="number"&&(r.roundness=t.roundness),r.shapeHoles=t.shapeHoles.map(s=>us.createFromState(s)),e!==void 0&&i!==void 0&&r.applySize(e,i),r.update(),r}get width(){return this._width}get height(){return this._height}get roundness(){return this._roundness}set roundness(t){if(this._roundness!==t){this._roundness=t;for(let e=0,i=this.points.length;e<i;e++)this.points[e].roundness=t;this.needsUpdate=!0}}getPointsIndexesByIds(t){return t.map(e=>this.getPointIndexById(e)).filter(e=>e>=0)}getPointIndexById(t){let e=this.points.length,i=this.points.findIndex(r=>r.uuid===t);if(i<0){let r=e;for(let s=0,n=this.shapeHoles.length;s<n;s++){let a=this.shapeHoles[s],o=a.points.length,l=a.getPointIndexById(t);if(!(l<0))return l+r;r+=o}}return i}getLineIndexById(t){return this.getPointIndexById(t)}getBezierPoint(t){if(t<=this.points.length-1)return this.points[t];if(this.shapeHoles.length>0){let e=this.points.length;for(let i=0,r=this.shapeHoles.length;i<r;i++){let s=this.shapeHoles[i],n=t-e;if(n<=s.points.length-1)return s.points[n];e+=s.points.length}}throw new Error("This shape does not have a point for this index: "+t)}getBezierPointIndex(t){let e=this.points.indexOf(t);if(e>=0)return e;if(e=this.points.length,this.shapeHoles.length>0)for(let i=0,r=this.shapeHoles.length;i<r;i++){let s=this.shapeHoles[i],n=s.points.indexOf(t);if(n>=0)return e+n;e+=s.points.length}return-1}getAllPoints(){let t=[].concat(...this.shapeHoles.map(e=>e.points));return[...this.points,...t]}applySize(t,e){t===0&&(t=.001),e===0&&(e=.001),this._width=t,this._height=e}applyScale(t,e){let i=gM.set(t,e);for(let r=0,s=this.points.length;r<s;r++){let n=this.points[r];n.position.multiply(i),n.controls[0].position.multiply(i),n.controls[1].position.multiply(i)}for(let r=0,s=this.shapeHoles.length;r<s;r++)this.shapeHoles[r].applyScale(t,e);this._update()}createPoint(t,e=0,i=Yt.generateUUID()){let r;r=t instanceof Z?t:new Z(t,e);let s=new Ug(i,r);return s.roundness=this.roundness,s}addPoint(t){this.points.push(t),this.needsUpdate=!0}addPointAt(t,e){this.points.splice(e,0,t),this.needsUpdate=!0}getPointByUuid(t){for(let e=0,i=this.points.length;e<i;e++){let r=this.points[e];if(r.uuid===t)return r}for(let e=0,i=this.shapeHoles.length;e<i;e++){let r=this.shapeHoles[e].getPointByUuid(t);if(r)return r}}getFirstPoint(){return this.points[0]}getLastPoint(){return this.points[this.points.length-1]}removePoint(t){let e=this.points.indexOf(t);e>=0&&this.points.splice(e,1),this.needsUpdate=!0}removePointById(t){let e=this.points.find(i=>i.uuid===t);e&&this.removePoint(e)}update(){for(let t=0,e=this.shapeHoles.length;t<e;t++)this.shapeHoles[t].update();this._update()}extractShapePointsToBuffer(t,e=12,i=!1){this.subdivision=e,this.curveDivisions===void 0&&this.computeCurveDivisions(e);let r=i?this.roundedCurveDivisions:this.curveDivisions;return function(s,n,a=12,o=!0){let l,u=lU.set(0,0,0),h=0,d=[];for(let c=0;c<n.length;c++){let p=gP(n[c]),m=Cg,f=Ag(p,a);d.push(f);for(let g=0;g<=f;g++)if(p instanceof Yl||p instanceof oc||p instanceof cl){if(p.getPoint(g/f,m),u.set(m.x,m.y,0),l!==void 0&&XTt(l,u))continue;l===void 0&&(l=oU),l.copy(u),s.setXYZ(h,u.x,u.y,u.z),h++}}o&&h>1&&(s.getX(h-1)!==s.getX(0)||s.getY(h-1)!==s.getY(0)||s.getZ(h-1)!==s.getZ(0))&&(s.setXYZ(h,s.getX(0),s.getY(0),s.getZ(0)),h++)}(t,i?this.roundedCurves:this.curves,e,this.autoClose),r.reduce((s,n)=>s+n,0)+1}computeCurveDivisions(t=12){return this.curveDivisions=dY(this.points,t,!1),this.roundedCurveDivisions=dY(this.points,t,!0),this.curveDivisions}extractFilteredShapePointsToBuffer(t,e,i=12){return 2*function(r,s,n,a=12,o=!0){let l=lU.set(0,0,0),u=0,h=[];for(let d=0;d<s.length;d++){if(n[d]===!1)continue;let c,p=gP(s[d]),m=Cg,f=Ag(p,a);h.push(f);for(let g=0;g<=f;g++)if(p instanceof Yl||p instanceof oc||p instanceof cl){if(p.getPoint(g/f,m),l.set(m.x,m.y,0),c?.equals(l))continue;c===void 0?c=oU:(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}(t,this.curves,e,i,this.autoClose).reduce((r,s)=>r+s,0)}extractShapePointsToFlatArray(t,e=12){return this.subdivision=e,this.curveDivisions===void 0&&this.computeCurveDivisions(e),function(i,r,s=12,n=!0){let a,o=0;for(let l=0;l<r.length;l++){let u=gP(r[l]),h=Ag(u,s),d=Cg;for(let c=0;c<=h;c++)if(u instanceof Yl||u instanceof oc||u instanceof cl){if(u.getPoint(c/h,d),a!==void 0&&$Tt(a,d,C1))continue;a===void 0&&(a=wS),a.copy(d),i.push(d.x,d.y),o++}}return Gw(i[0],i[i.length-2],C1)&&Gw(i[1],i[i.length-1],C1)&&(i.pop(),i.pop()),n&&o>1&&!(Gw(i[o-1],i[1],C1)&&Gw(i[o-2],i[0],C1))&&(i.push(i[0],i[1]),o++),i}(t,this.roundedCurves,e,this.autoClose)}getCurveIndexFromVertexId(t,e=!1){let i=0;this.curveDivisions===void 0&&this.computeCurveDivisions(this.subdivision);let r=e?this.roundedCurveDivisions:this.curveDivisions,s=0;e&&this.points[0].roundedCurveCorner!==void 0&&(s=.5*Ag(this.points[0].roundedCurveCorner,this.subdivision));let n=t-s;n<0&&(n+=r.reduce((a,o)=>a+o,0));for(let a=0,o=r.length;a<o;a++){let l=r[a];if(n<i+l)return[a,(n-i+1)/l];i+=l}return[0,1]}getCurveT(t,e,i){let r=this.points[t],s=this.points[t>=this.points.length-1?0:t+1],n=this.curveDivisions,a=n[t];if(hY(r,s)){let l=r.position.distanceTo(s.position);return r.position.distanceTo(gM.set(i.x,i.y))/l}let o=0;for(let l=0;l<t;l++)o+=n[l];return(e-o)/a}dispose(){}_applyCurveForPoint(t,e){hY(e,t)?this.lineTo(t.position.x,t.position.y):this.bezierCurveTo(e.controls[1].position.x,e.controls[1].position.y,t.controls[0].position.x,t.controls[0].position.y,t.position.x,t.position.y);let i=this.curves[this.curves.length-1];t.curveBefore=i,e.curveAfter=i;let r=i.clone();t.roundedCurveBefore=r,e.roundedCurveAfter=r,t.roundedCurveCorner=void 0,this.roundedCurves.push(r)}_update(){if(this.curves=[],this.roundedCurves=[],!this.points.length)return;for(let e=0,i=this.points.length;e<i;e++){let r=this.points[e];if(e===0)this.moveTo(r.position.x,r.position.y);else{let s=this.points[e-1];this._applyCurveForPoint(r,s)}}let t=this.getLastPoint();if(t?.curveAfter&&(t.curveAfter=void 0),this.isClosed){let e=this.points[0],i=this.points[this.points.length-1];this._applyCurveForPoint(e,i)}if(this.points.length>2){let e=0;for(let i=0,r=this.points.length;i<r;i++){let s=this.points[i],n=this.points[i-1]??this.points[this.points.length-1],a=this.points[i+1]??this.points[0],o=s.roundness,l=n&&a&&YTt(n,s,a);if(!s.controlsMoved()&&o>0&&!l){let u=s.curveBefore,h=s.curveAfter;if(u===void 0||h===void 0)continue;let d,c=s.roundedCurveBefore,p=s.roundedCurveAfter,m=u instanceof cl?u.v1.distanceTo(u.v2):u.getLength(),f=h instanceof cl?h.v1.distanceTo(h.v2):h.getLength(),g=Math.min(o,.499*m),y=Math.min(o,.499*f),v=Math.min(g,y),b=1-v/m,_=v/f,x=u.getPointAt(b,gM),S=h.getPointAt(_,cY);if(this._subSplitCurve(u,c,b,x,void 0),this._subSplitCurve(h,p,_,void 0,S),this.useCubicForRoundedCorners){let w=Kmt(x,s.position,S)/2,M=Math.tan(w)*x.distanceTo(s.position),[T,A]=KTt(x,S,M,pY,mY),C=ZTt(T,A,s.position),[R,O]=QTt(C,x,S,M,fY,gY);d=new Yl(x.clone(),R.clone(),O.clone(),S.clone())}else d=new oc(x.clone(),s.position.clone(),S.clone());s.roundedCurveCorner=d,this.roundedCurves.splice(i+e,0,d),e++}}}}_subSplitCurve(t,e,i,r,s){if(!(t instanceof cl)){let n=t,a=e,o=n.getUtoTmapping(i,0),l=function(u,h,d,c,p=.5){let m=Cg.subVectors(h,u).multiplyScalar(p).add(u),f=wS.subVectors(d,h).multiplyScalar(p).add(h),g=Zmt.subVectors(c,d).multiplyScalar(p).add(d),y=m,v=Qmt.subVectors(f,m).multiplyScalar(p).add(m),b=Jmt.subVectors(g,f).multiplyScalar(p).add(f),_=g,x=tft.subVectors(b,v).multiplyScalar(p).add(v);return[u.x,u.y,y.x,y.y,v.x,v.y,x.x,x.y,b.x,b.y,_.x,_.y,c.x,c.y]}(n.v0,n.v1,n.v2,n.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])),s!==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&&e.v2.copy(r),s!==void 0&&e.v1.copy(s),e}clone(){let t=new us(this._width,this._height);return t.points=this.points.map(e=>e.clone()),t.isClosed=this.isClosed,t.roundness=this.roundness,t.isMesh2D=this.isMesh2D,t.shapeHoles=this.shapeHoles.map(e=>e.clone()),t}toJSON(){return{points:this.points.reduce((t,e)=>t.concat(e.toJSON()),[]),shapeHoles:this.shapeHoles.map(t=>t.toJSON()),isClosed:this.isClosed,roundness:this.roundness}}fromJSON(t){this.points=[],this.pointIDs=0;let e=t.points.length/7;for(let i=0;i<e;i++){let r=7*i,s=t.points[r+0],n=t.points[r+1],a=t.points[r+2],o=t.points[r+3],l=t.points[r+4],u=t.points[r+5],h=t.points[r+6],d=new Ug(Yt.generateUUID(),new Z(s,n));d.controls[0].position.set(a,o),d.controls[1].position.set(l,u),d.roundness=h,this.points.push(d)}return this.shapeHoles=t.shapeHoles?.length?t.shapeHoles.map(i=>{let r=new us;return r.fromJSON(i),r}):[],this.isClosed=t.isClosed,this._roundness=t.roundness,this._update(),this}fromShape(t,e=!1){this.isText=e;let i=(r,s)=>{s instanceof Yl&&s.v3.equals(r.position)&&r.controls[0].position.copy(s.v2)};return this.points=(r=>{let s,n,a=[];for(s=0,n=r.length;s<n;s++)r[s]instanceof oc&&(r[s]=HTt(r[s]));for(s=0,n=r.length;s<n;s++){let u,h=r[s],d=s>0?r[s-1]:null;h instanceof Yl?(u=this.createPoint(h.v0),u.controls[1].position.copy(h.v1)):h instanceof cl&&(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 Yl?o.v3.equals(a[0].position)&&(a[0].controls[0].position.copy(o.v2),l=!0):o instanceof cl&&o.v2.equals(a[0].position)&&(l=!0),this.isClosed=l,a})(t.curves),t instanceof aS&&(this.shapeHoles=t.holes.map(r=>{let s=new us;return s.fromShape(r),s})),this.update(),this}updatePoint(t,e){let i=this.getPointByUuid(t);i&&(e.position!==void 0&&i.position.fromArray(e.position),e.roundness!==void 0&&(i.roundness=e.roundness),e.areControlsDirectionsMirrored!==void 0&&(i.areControlsDirectionsMirrored=e.areControlsDirectionsMirrored),this.needsUpdate=!0)}updatePreviousControl(t,e){let i=this.getPointByUuid(t)?.controls[0];i&&(e.position&&i.position.fromArray(e.position),this.needsUpdate=!0)}updateNextControl(t,e){let i=this.getPointByUuid(t)?.controls[1];i&&(e.position&&i.position.fromArray(e.position),this.needsUpdate=!0)}}});function eO({x:t,y:e},i,r,s,n){return{x:t*i+s,y:e*r+n}}function JTt(t,e){let i=e===1.5707963267948966?.551915024494:e===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(e/4),r=Math.cos(t),s=Math.sin(t),n=Math.cos(t+e),a=Math.sin(t+e);return[{x:r-s*i,y:s+r*i},{x:n+a*i,y:a-n*i},{x:n,y:a}]}function yY(t,e,i,r){let s=t*r-e*i<0?-1:1,n=Math.min(1,Math.max(-1,t*i+e*r));return s*Math.acos(n)}var yP,tMt=W(()=>{yP=2*Math.PI});function Ye(t,e){if(!t)throw e||"Assertion Failed!"}function Qp(t){var e=t.windingRule,i=e===void 0?yr.ODD:e,r=t.elementType,s=r===void 0?sn.POLYGONS:r,n=t.polySize,a=n===void 0?3:n,o=t.vertexSize,l=o===void 0?2:o,u=t.normal,h=u===void 0?[0,0,1]:u,d=t.contours,c=d===void 0?[]:d,p=t.strict,m=p===void 0||p,f=t.debug,g=f!==void 0&&f;if(!c&&m)throw new Error("Contours can't be empty");if(c){var y=new ift;t.edgeCreateCallback&&(y.edgeCreateCallback=t.edgeCreateCallback),t.vertexIdCallback&&(y.vertexIdCallback=t.vertexIdCallback);for(var v=0;v<c.length;v++)y.addContour(l||2,c[v]);return y.tesselate(i,s,a,l,h,m),{vertices:y.vertices,vertexIndices:y.vertexIndices,vertexCount:y.vertexCount,elements:y.elements,elementCount:y.elementCount,mesh:g?y.mesh:void 0}}}var yr,sn,Ue,z0,t_,Jm,iO,rO,sO,vY,yM,nO,bY,_Y,ift,aO,rft,sft,Kv=W(()=>{var t;(t=yr||(yr={}))[t.ODD=0]="ODD",t[t.NONZERO=1]="NONZERO",t[t.POSITIVE=2]="POSITIVE",t[t.NEGATIVE=3]="NEGATIVE",t[t.ABS_GEQ_TWO=4]="ABS_GEQ_TWO",function(e){e[e.POLYGONS=0]="POLYGONS",e[e.CONNECTED_POLYGONS=1]="CONNECTED_POLYGONS",e[e.BOUNDARY_CONTOURS=2]="BOUNDARY_CONTOURS"}(sn||(sn={})),Ue=function(){function e(){}return e.vertEq=function(i,r){return i.s===r.s&&i.t===r.t},e.vertLeq=function(i,r){return i.s<r.s||i.s===r.s&&i.t<=r.t},e.transLeq=function(i,r){return i.t<r.t||i.t===r.t&&i.s<=r.s},e.edgeGoesLeft=function(i){return e.vertLeq(i.Dst,i.Org)},e.edgeGoesRight=function(i){return e.vertLeq(i.Org,i.Dst)},e.vertL1dist=function(i,r){return Math.abs(i.s-r.s)+Math.abs(i.t-r.t)},e.edgeEval=function(i,r,s){Ye(e.vertLeq(i,r)&&e.vertLeq(r,s));var n=r.s-i.s,a=s.s-r.s;return n+a>0?n<a?r.t-i.t+(i.t-s.t)*(n/(n+a)):r.t-s.t+(s.t-i.t)*(a/(n+a)):0},e.edgeSign=function(i,r,s){Ye(e.vertLeq(i,r)&&e.vertLeq(r,s));var n=r.s-i.s,a=s.s-r.s;return n+a>0?(r.t-s.t)*n+(r.t-i.t)*a:0},e.transEval=function(i,r,s){Ye(e.transLeq(i,r)&&e.transLeq(r,s));var n=r.t-i.t,a=s.t-r.t;return n+a>0?n<a?r.s-i.s+(i.s-s.s)*(n/(n+a)):r.s-s.s+(s.s-i.s)*(a/(n+a)):0},e.transSign=function(i,r,s){Ye(e.transLeq(i,r)&&e.transLeq(r,s));var n=r.t-i.t,a=s.t-r.t;return n+a>0?(r.s-s.s)*n+(r.s-i.s)*a:0},e.vertCCW=function(i,r,s){return i.s*(r.t-s.t)+r.s*(s.t-i.t)+s.s*(i.t-r.t)>=0},e.interpolate=function(i,r,s,n){return(i=i<0?0:i)<=(s=s<0?0:s)?s===0?(r+n)/2:r+i/(i+s)*(n-r):n+s/(i+s)*(r-n)},e.intersect=function(i,r,s,n,a){var o,l,u;e.vertLeq(i,r)||(u=i,i=r,r=u),e.vertLeq(s,n)||(u=s,s=n,n=u),e.vertLeq(i,s)||(u=i,i=s,s=u,u=r,r=n,n=u),e.vertLeq(s,r)?e.vertLeq(r,n)?((o=e.edgeEval(i,s,r))+(l=e.edgeEval(s,r,n))<0&&(o=-o,l=-l),a.s=e.interpolate(o,s.s,l,r.s)):((o=e.edgeSign(i,s,r))+(l=-e.edgeSign(i,n,r))<0&&(o=-o,l=-l),a.s=e.interpolate(o,s.s,l,n.s)):a.s=(s.s+r.s)/2,e.transLeq(i,r)||(u=i,i=r,r=u),e.transLeq(s,n)||(u=s,s=n,n=u),e.transLeq(i,s)||(u=i,i=s,s=u,u=r,r=n,n=u),e.transLeq(s,r)?e.transLeq(r,n)?((o=e.transEval(i,s,r))+(l=e.transEval(s,r,n))<0&&(o=-o,l=-l),a.t=e.interpolate(o,s.t,l,r.t)):((o=e.transSign(i,s,r))+(l=-e.transSign(i,n,r))<0&&(o=-o,l=-l),a.t=e.interpolate(o,s.t,l,n.t)):a.t=(s.t+r.t)/2},e}(),z0=function(){this.next=null,this.prev=null,this.anEdge=null,this.trail=null,this.n=0,this.marked=!1,this.inside=!1},t_=function(){function e(i){this.side=i,this.next=null,this.Org=null,this.Sym=null,this.Onext=null,this.Lnext=null,this.Lface=null,this.activeRegion=null,this.winding=0}return Object.defineProperty(e.prototype,"Rface",{get:function(){return this.Sym.Lface},set:function(i){this.Sym.Lface=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dst",{get:function(){return this.Sym.Org},set:function(i){this.Sym.Org=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Oprev",{get:function(){return this.Sym.Lnext},set:function(i){this.Sym.Lnext=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Lprev",{get:function(){return this.Onext.Sym},set:function(i){this.Onext.Sym=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dprev",{get:function(){return this.Lnext.Sym},set:function(i){this.Lnext.Sym=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Rprev",{get:function(){return this.Sym.Onext},set:function(i){this.Sym.Onext=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dnext",{get:function(){return this.Sym.Onext.Sym},set:function(i){this.Sym.Onext.Sym=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Rnext",{get:function(){return this.Sym.Lnext.Sym},set:function(i){this.Sym.Lnext.Sym=i},enumerable:!0,configurable:!0}),e}(),Jm=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},iO=function(){function e(){var i=new Jm,r=new z0,s=new t_(0),n=new t_(1);i.next=i.prev=i,i.anEdge=null,r.next=r.prev=r,s.next=s,s.Sym=n,n.next=n,n.Sym=s,this.vHead=i,this.fHead=r,this.eHead=s,this.eHeadSym=n}return e.prototype.makeEdge_=function(i){var r=new t_(0),s=new t_(1);i.Sym.side<i.side&&(i=i.Sym);var n=i.Sym.next;return s.next=n,n.Sym.next=r,r.next=i,i.Sym.next=s,r.Sym=s,r.Onext=r,r.Lnext=s,r.Org=null,r.Lface=null,r.winding=0,r.activeRegion=null,s.Sym=r,s.Onext=s,s.Lnext=r,s.Org=null,s.Lface=null,s.winding=0,s.activeRegion=null,r},e.prototype.splice_=function(i,r){var s=i.Onext,n=r.Onext;s.Sym.Lnext=r,n.Sym.Lnext=i,i.Onext=n,r.Onext=s},e.prototype.makeVertex_=function(i,r,s){var n=i;Ye(n,"Vertex can't be null!");var a=s.prev;n.prev=a,a.next=n,n.next=s,s.prev=n,n.anEdge=r;var o=r;do o.Org=n,o=o.Onext;while(o!==r)},e.prototype.makeFace_=function(i,r,s){var n=i;Ye(n,"Face can't be null");var a=s.prev;n.prev=a,a.next=n,n.next=s,s.prev=n,n.anEdge=r,n.trail=null,n.marked=!1,n.inside=s.inside;var o=r;do o.Lface=n,o=o.Lnext;while(o!==r)},e.prototype.killEdge_=function(i){i.Sym.side<i.side&&(i=i.Sym);var r=i.next,s=i.Sym.next;r.Sym.next=s,s.Sym.next=r},e.prototype.killVertex_=function(i,r){var s=i.anEdge,n=s;do n.Org=r,n=n.Onext;while(n!==s);var a=i.prev,o=i.next;o.prev=a,a.next=o},e.prototype.killFace_=function(i,r){var s=i.anEdge,n=s;do n.Lface=r,n=n.Lnext;while(n!==s);var a=i.prev,o=i.next;o.prev=a,a.next=o},e.prototype.makeEdge=function(){var i=new Jm,r=new Jm,s=new z0,n=this.makeEdge_(this.eHead);return this.makeVertex_(i,n,this.vHead),this.makeVertex_(r,n.Sym,this.vHead),this.makeFace_(s,n,this.fHead),n},e.prototype.splice=function(i,r){var s=!1,n=!1;if(i!==r){if(r.Org!==i.Org&&(n=!0,this.killVertex_(r.Org,i.Org)),r.Lface!==i.Lface&&(s=!0,this.killFace_(r.Lface,i.Lface)),this.splice_(r,i),!n){var a=new Jm;this.makeVertex_(a,r,i.Org),i.Org.anEdge=i}if(!s){var o=new z0;this.makeFace_(o,r,i.Lface),i.Lface.anEdge=i}}},e.prototype.delete=function(i){var r=i.Sym,s=!1;if(i.Lface!==i.Rface&&(s=!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),!s){var n=new z0;this.makeFace_(n,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)},e.prototype.addEdgeVertex=function(i){var r=this.makeEdge_(i),s=r.Sym;this.splice_(r,i.Lnext),r.Org=i.Dst;var n=new Jm;return this.makeVertex_(n,s,r.Org),r.Lface=s.Lface=i.Lface,r},e.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},e.prototype.connect=function(i,r){var s=!1,n=this.makeEdge_(i),a=n.Sym;if(r.Lface!==i.Lface&&(s=!0,this.killFace_(r.Lface,i.Lface)),this.splice_(n,i.Lnext),this.splice_(a,r),n.Org=i.Dst,a.Org=r.Org,n.Lface=a.Lface=i.Lface,i.Lface.anEdge=a,!s){var o=new z0;this.makeFace_(o,n,i.Lface)}return n},e.prototype.zapFace=function(i){var r,s,n,a,o,l=i.anEdge;s=l.Lnext;do s=(r=s).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)),(n=r.Sym).Onext===n?this.killVertex_(n.Org,null):(n.Org.anEdge=n.Onext,this.splice_(n,n.Oprev)),this.killEdge_(r));while(r!=l);a=i.prev,(o=i.next).prev=a,a.next=o},e.prototype.countFaceVerts_=function(i){var r=i.anEdge,s=0;do s++,r=r.Lnext;while(r!==i.anEdge);return s},e.prototype.mergeConvexFaces=function(i){var r,s,n,a,o;for(r=this.fHead.next;r!==this.fHead;r=r.next)if(r.inside)for(o=(s=r.anEdge).Org;n=s.Lnext,(a=s.Sym)&&a.Lface&&a.Lface.inside&&this.countFaceVerts_(r)+this.countFaceVerts_(a.Lface)-2<=i&&Ue.vertCCW(s.Lprev.Org,s.Org,a.Lnext.Lnext.Org)&&Ue.vertCCW(a.Lprev.Org,a.Org,s.Lnext.Lnext.Org)&&(n=a.Lnext,this.delete(a),s=null,a=null),!s||s.Lnext.Org!==o;)s=n;return!0},e.prototype.check=function(){var i,r,s,n,a,o,l=this.fHead,u=this.vHead,h=this.eHead;for(r=l,r=l;(i=r.next)!==l;r=i){Ye(i.prev===r),a=i.anEdge;do Ye(a.Sym!==a),Ye(a.Sym.Sym===a),Ye(a.Lnext.Onext.Sym===a),Ye(a.Onext.Sym.Lnext===a),Ye(a.Lface===i),a=a.Lnext;while(a!==i.anEdge)}for(Ye(i.prev===r&&i.anEdge===null),n=u,n=u;(s=n.next)!==u;n=s){Ye(s.prev===n),a=s.anEdge;do Ye(a.Sym!==a),Ye(a.Sym.Sym===a),Ye(a.Lnext.Onext.Sym===a),Ye(a.Onext.Sym.Lnext===a),Ye(a.Org===s),a=a.Onext;while(a!==s.anEdge)}for(Ye(s.prev===n&&s.anEdge===null),o=h,o=h;(a=o.next)!==h;o=a)Ye(a.Sym.next===o.Sym),Ye(a.Sym!==a),Ye(a.Sym.Sym===a),Ye(a.Org!==null),Ye(a.Dst!==null),Ye(a.Lnext.Onext.Sym===a),Ye(a.Onext.Sym.Lnext===a);Ye(a.Sym.next===o.Sym&&a.Sym===this.eHeadSym&&a.Sym.Sym===a&&a.Org===null&&a.Dst===null&&a.Lface===null&&a.Rface===null)},e}(),rO=function(){this.handle=null},sO=function(){this.key=null,this.node=0},vY=function(){function e(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 s=0;s<i+1;s++)this.nodes[s]=new rO,this.handles[s]=new sO;this.initialized=!1,this.nodes[1].handle=1,this.handles[1].key=null}return e.prototype.floatDown_=function(i){var r,s,n,a=this.nodes,o=this.handles;for(r=a[i].handle;;){if((n=i<<1)<this.size&&this.leq(o[a[n+1].handle].key,o[a[n].handle].key)&&++n,Ye(n<=this.max),s=a[n].handle,n>this.size||this.leq(o[r].key,o[s].key)){a[i].handle=r,o[r].node=i;break}a[i].handle=s,o[s].node=i,i=n}},e.prototype.floatUp_=function(i){var r,s,n,a=this.nodes,o=this.handles;for(r=a[i].handle;;){if(s=a[n=i>>1].handle,n===0||this.leq(o[s].key,o[r].key)){a[i].handle=r,o[r].node=i;break}a[i].handle=s,o[s].node=i,i=n}},e.prototype.init=function(){for(var i=this.size;i>=1;--i)this.floatDown_(i);this.initialized=!0},e.prototype.min=function(){return this.handles[this.nodes[1].handle].key},e.prototype.insert=function(i){var r,s;if(2*(r=++this.size)>this.max){var n,a;for(this.max*=2,a=this.nodes.length,this.nodes.length=this.max+1,n=a;n<this.nodes.length;n++)this.nodes[n]=new rO;for(a=this.handles.length,this.handles.length=this.max+1,n=a;n<this.handles.length;n++)this.handles[n]=new sO}return this.freeList===0?s=r:(s=this.freeList,this.freeList=this.handles[s].node),this.nodes[r].handle=s,this.handles[s].node=r,this.handles[s].key=i,this.initialized&&this.floatUp_(r),s},e.prototype.extractMin=function(){var i=this.nodes,r=this.handles,s=i[1].handle,n=r[s].key;return this.size>0&&(i[1].handle=i[this.size].handle,r[i[1].handle].node=1,r[s].key=null,r[s].node=this.freeList,this.freeList=s,--this.size,this.size>0&&this.floatDown_(1)),n},e.prototype.delete=function(i){var r,s=this.nodes,n=this.handles;Ye(i>=1&&i<=this.max&&n[i].key!==null),s[r=n[i].node].handle=s[this.size].handle,n[s[r].handle].node=r,--this.size,r<=this.size&&(r<=1||this.leq(n[s[r>>1].handle].key,n[s[r].handle].key)?this.floatDown_(r):this.floatUp_(r)),n[i].key=null,n[i].node=this.freeList,this.freeList=i},e}(),yM=function(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1},nO=function(){this.key=null,this.next=null,this.prev=null},bY=function(){function e(i,r){this.frame=i,this.leq=r,this.head=new nO,this.head.next=this.head,this.head.prev=this.head}return e.prototype.min=function(){return this.head.next},e.prototype.max=function(){return this.head.prev},e.prototype.insert=function(i){return this.insertBefore(this.head,i)},e.prototype.search=function(i){var r=this.head;do r=r.next;while(r.key!==null&&!this.leq(this.frame,i,r.key));return r},e.prototype.insertBefore=function(i,r){do i=i.prev;while(i.key!==null&&!this.leq(this.frame,i.key,r));var s=new nO;return s.key=r,s.next=i.next,i.next.prev=s,s.prev=i,i.next=s,s},e.prototype.delete=function(i){i.next.prev=i.prev,i.prev.next=i.next},e}(),_Y=function(){function e(){}return e.regionBelow=function(i){return i.nodeUp.prev.key},e.regionAbove=function(i){return i.nodeUp.next.key},e.debugEvent=function(i){},e.addWinding=function(i,r){i.winding+=r.winding,i.Sym.winding+=r.Sym.winding},e.edgeLeq=function(i,r,s){var n=i.event,a=r.eUp,o=s.eUp;return a.Dst===n?o.Dst===n?Ue.vertLeq(a.Org,o.Org)?Ue.edgeSign(o.Dst,a.Org,o.Org)<=0:Ue.edgeSign(a.Dst,o.Org,a.Org)>=0:Ue.edgeSign(o.Dst,n,o.Org)<=0:o.Dst===n?Ue.edgeSign(a.Dst,n,a.Org)>=0:Ue.edgeEval(a.Dst,n,a.Org)>=Ue.edgeEval(o.Dst,n,o.Org)},e.deleteRegion=function(i,r){r.fixUpperEdge&&Ye(r.eUp.winding===0),r.eUp.activeRegion=null,i.dict.delete(r.nodeUp)},e.fixUpperEdge=function(i,r,s){Ye(r.fixUpperEdge),i.mesh.delete(r.eUp),r.fixUpperEdge=!1,r.eUp=s,s.activeRegion=r},e.topLeftRegion=function(i,r){var s,n=r.eUp.Org;do r=e.regionAbove(r);while(r.eUp.Org===n);if(r.fixUpperEdge){if((s=i.mesh.connect(e.regionBelow(r).eUp.Sym,r.eUp.Lnext))===null)return null;e.fixUpperEdge(i,r,s),r=e.regionAbove(r)}return r},e.topRightRegion=function(i){var r=i.eUp.Dst;do i=e.regionAbove(i);while(i.eUp.Dst===r);return i},e.addRegionBelow=function(i,r,s){var n=new yM;return n.eUp=s,n.nodeUp=i.dict.insertBefore(r.nodeUp,n),n.fixUpperEdge=!1,n.sentinel=!1,n.dirty=!1,s.activeRegion=n,n},e.isWindingInside=function(i,r){switch(i.windingRule){case yr.ODD:return!!(1&r);case yr.NONZERO:return r!==0;case yr.POSITIVE:return r>0;case yr.NEGATIVE:return r<0;case yr.ABS_GEQ_TWO:return r>=2||r<=-2}throw new Error("Invalid winding rulle")},e.computeWinding=function(i,r){r.windingNumber=e.regionAbove(r).windingNumber+r.eUp.winding,r.inside=e.isWindingInside(i,r.windingNumber)},e.finishRegion=function(i,r){var s=r.eUp,n=s.Lface;n.inside=r.inside,n.anEdge=s,e.deleteRegion(i,r)},e.finishLeftRegions=function(i,r,s){for(var n,a=null,o=r,l=r.eUp;o!==s;){if(o.fixUpperEdge=!1,(n=(a=e.regionBelow(o)).eUp).Org!=l.Org){if(!a.fixUpperEdge){e.finishRegion(i,o);break}n=i.mesh.connect(l.Lprev,n.Sym),e.fixUpperEdge(i,a,n)}l.Onext!==n&&(i.mesh.splice(n.Oprev,n),i.mesh.splice(l,n)),e.finishRegion(i,o),l=a.eUp,o=a}return l},e.addRightEdges=function(i,r,s,n,a,o){var l,u,h,d,c=!0;h=s;do Ye(Ue.vertLeq(h.Org,h.Dst)),e.addRegionBelow(i,r,h.Sym),h=h.Onext;while(h!==n);for(a===null&&(a=e.regionBelow(r).eUp.Rprev),u=r,d=a;(h=(l=e.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=e.isWindingInside(i,l.windingNumber),u.dirty=!0,!c&&e.checkForRightSplice(i,u)&&(e.addWinding(h,d),e.deleteRegion(i,u),i.mesh.delete(d)),c=!1,u=l,d=h;u.dirty=!0,Ye(u.windingNumber-h.winding===l.windingNumber),o&&e.walkDirtyRegions(i,u)},e.spliceMergeVertices=function(i,r,s){i.mesh.splice(r,s)},e.vertexWeights=function(i,r,s){var n=Ue.vertL1dist(r,i),a=Ue.vertL1dist(s,i),o=.5*a/(n+a),l=.5*n/(n+a);i.coords[0]+=o*r.coords[0]+l*s.coords[0],i.coords[1]+=o*r.coords[1]+l*s.coords[1],i.coords[2]+=o*r.coords[2]+l*s.coords[2]},e.getIntersectData=function(i,r,s,n,a,o){r.coords[0]=r.coords[1]=r.coords[2]=0,r.idx=-1,e.vertexWeights(r,s,n),e.vertexWeights(r,a,o)},e.checkForRightSplice=function(i,r){var s=e.regionBelow(r),n=r.eUp,a=s.eUp;if(Ue.vertLeq(n.Org,a.Org)){if(Ue.edgeSign(a.Dst,n.Org,a.Org)>0)return!1;Ue.vertEq(n.Org,a.Org)?n.Org!==a.Org&&(i.pq.delete(n.Org.pqHandle),e.spliceMergeVertices(i,a.Oprev,n)):(i.mesh.splitEdge(a.Sym),i.mesh.splice(n,a.Oprev),r.dirty=s.dirty=!0)}else{if(Ue.edgeSign(n.Dst,a.Org,n.Org)<0)return!1;e.regionAbove(r).dirty=r.dirty=!0,i.mesh.splitEdge(n.Sym),i.mesh.splice(a.Oprev,n)}return!0},e.checkForLeftSplice=function(i,r){var s,n=e.regionBelow(r),a=r.eUp,o=n.eUp;if(Ye(!Ue.vertEq(a.Dst,o.Dst)),Ue.vertLeq(a.Dst,o.Dst)){if(Ue.edgeSign(a.Dst,o.Dst,a.Org)<0)return!1;e.regionAbove(r).dirty=r.dirty=!0,s=i.mesh.splitEdge(a),i.mesh.splice(o.Sym,s),s.Lface.inside=r.inside}else{if(Ue.edgeSign(o.Dst,a.Dst,o.Org)>0)return!1;r.dirty=n.dirty=!0,s=i.mesh.splitEdge(o),i.mesh.splice(a.Lnext,o.Sym),s.Rface.inside=r.inside}return!0},e.checkForIntersect=function(i,r){var s,n,a=e.regionBelow(r),o=r.eUp,l=a.eUp,u=o.Org,h=l.Org,d=o.Dst,c=l.Dst,p=new Jm;if(Ye(!Ue.vertEq(c,d)),Ye(Ue.edgeSign(d,i.event,u)<=0),Ye(Ue.edgeSign(c,i.event,h)>=0),Ye(u!==i.event&&h!==i.event),Ye(!r.fixUpperEdge&&!a.fixUpperEdge),u===h||Math.min(u.t,d.t)>Math.max(h.t,c.t))return!1;if(Ue.vertLeq(u,h)){if(Ue.edgeSign(c,u,h)>0)return!1}else if(Ue.edgeSign(d,h,u)<0)return!1;return e.debugEvent(i),Ue.intersect(d,u,c,h,p),Ye(Math.min(u.t,d.t)<=p.t),Ye(p.t<=Math.max(h.t,c.t)),Ye(Math.min(c.s,d.s)<=p.s),Ye(p.s<=Math.max(h.s,u.s)),Ue.vertLeq(p,i.event)&&(p.s=i.event.s,p.t=i.event.t),s=Ue.vertLeq(u,h)?u:h,Ue.vertLeq(s,p)&&(p.s=s.s,p.t=s.t),Ue.vertEq(p,u)||Ue.vertEq(p,h)?(e.checkForRightSplice(i,r),!1):!Ue.vertEq(d,i.event)&&Ue.edgeSign(d,i.event,p)>=0||!Ue.vertEq(c,i.event)&&Ue.edgeSign(c,i.event,p)<=0?c===i.event?(i.mesh.splitEdge(o.Sym),i.mesh.splice(l.Sym,o),r=e.topLeftRegion(i,r),o=e.regionBelow(r).eUp,e.finishLeftRegions(i,e.regionBelow(r),a),e.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=e.topRightRegion(r),n=e.regionBelow(r).eUp.Rprev,a.eUp=l.Oprev,l=e.finishLeftRegions(i,a,null),e.addRightEdges(i,r,l.Onext,o.Rprev,n,!0),!0):(Ue.edgeSign(d,i.event,p)>=0&&(e.regionAbove(r).dirty=r.dirty=!0,i.mesh.splitEdge(o.Sym),o.Org.s=i.event.s,o.Org.t=i.event.t),Ue.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),e.getIntersectData(i,o.Org,u,d,h,c),e.regionAbove(r).dirty=r.dirty=a.dirty=!0,!1)},e.walkDirtyRegions=function(i,r){for(var s,n,a=e.regionBelow(r);;){for(;a.dirty;)r=a,a=e.regionBelow(a);if(!r.dirty&&(a=r,(r=e.regionAbove(r))===null||!r.dirty))return;if(r.dirty=!1,s=r.eUp,n=a.eUp,s.Dst!==n.Dst&&e.checkForLeftSplice(i,r)&&(a.fixUpperEdge?(e.deleteRegion(i,a),i.mesh.delete(n),n=(a=e.regionBelow(r)).eUp):r.fixUpperEdge&&(e.deleteRegion(i,r),i.mesh.delete(s),s=(r=e.regionAbove(a)).eUp)),s.Org!==n.Org){if(s.Dst===n.Dst||r.fixUpperEdge||a.fixUpperEdge||s.Dst!==i.event&&n.Dst!==i.event)e.checkForRightSplice(i,r);else if(e.checkForIntersect(i,r))return}s.Org===n.Org&&s.Dst===n.Dst&&(e.addWinding(n,s),e.deleteRegion(i,r),i.mesh.delete(s),r=e.regionAbove(a))}},e.connectRightVertex=function(i,r,s){var n,a=s.Onext,o=e.regionBelow(r),l=r.eUp,u=o.eUp,h=!1;l.Dst!==u.Dst&&e.checkForIntersect(i,r),Ue.vertEq(l.Org,i.event)&&(i.mesh.splice(a.Oprev,l),r=e.topLeftRegion(i,r),a=e.regionBelow(r).eUp,e.finishLeftRegions(i,e.regionBelow(r),o),h=!0),Ue.vertEq(u.Org,i.event)&&(i.mesh.splice(s,u.Oprev),s=e.finishLeftRegions(i,o,null),h=!0),h?e.addRightEdges(i,r,s.Onext,a,a,!0):(n=Ue.vertLeq(u.Org,l.Org)?u.Oprev:l,n=i.mesh.connect(s.Lprev,n),e.addRightEdges(i,r,n,n.Onext,n.Onext,!1),n.Sym.activeRegion.fixUpperEdge=!0,e.walkDirtyRegions(i,r))},e.connectLeftDegenerate=function(i,r,s){var n,a,o,l,u;return n=r.eUp,Ue.vertEq(n.Org,s)?(Ye(!1),void e.spliceMergeVertices(i,n,s.anEdge)):Ue.vertEq(n.Dst,s)?(Ye(!1),r=e.topRightRegion(r),a=l=(o=(u=e.regionBelow(r)).eUp.Sym).Onext,u.fixUpperEdge&&(Ye(a!==o),e.deleteRegion(i,u),i.mesh.delete(o),o=a.Oprev),i.mesh.splice(s.anEdge,o),Ue.edgeGoesLeft(a)||(a=null),void e.addRightEdges(i,r,o.Onext,l,a,!0)):(i.mesh.splitEdge(n.Sym),r.fixUpperEdge&&(i.mesh.delete(n.Onext),r.fixUpperEdge=!1),i.mesh.splice(s.anEdge,n),void e.sweepEvent(i,s))},e.connectLeftVertex=function(i,r){var s,n,a,o,l,u,h=new yM;if(h.eUp=r.anEdge.Sym,s=i.dict.search(h).key,n=e.regionBelow(s)){if(o=s.eUp,l=n.eUp,Ue.edgeSign(o.Dst,r,o.Org)===0)return void e.connectLeftDegenerate(i,s,r);a=Ue.vertLeq(l.Dst,o.Dst)?s:n,s.inside||a.fixUpperEdge?(u=a===s?i.mesh.connect(r.anEdge.Sym,o.Lnext):i.mesh.connect(l.Dnext,r.anEdge).Sym,a.fixUpperEdge?e.fixUpperEdge(i,a,u):e.computeWinding(i,e.addRegionBelow(i,s,u)),e.sweepEvent(i,r)):e.addRightEdges(i,s,r.anEdge,r.anEdge,null,!0)}},e.sweepEvent=function(i,r){i.event=r,e.debugEvent(i);for(var s=r.anEdge;s.activeRegion===null;)if((s=s.Onext)===r.anEdge)return void e.connectLeftVertex(i,r);var n=e.topLeftRegion(i,s.activeRegion);Ye(n!==null);var a=e.regionBelow(n),o=a.eUp,l=e.finishLeftRegions(i,a,null);l.Onext===o?e.connectRightVertex(i,n,l):e.addRightEdges(i,n,l.Onext,o,o,!0)},e.addSentinel=function(i,r,s,n){var a=new yM,o=i.mesh.makeEdge();o.Org.s=s,o.Org.t=n,o.Dst.s=r,o.Dst.t=n,i.event=o.Dst,a.eUp=o,a.windingNumber=0,a.inside=!1,a.fixUpperEdge=!1,a.sentinel=!0,a.dirty=!1,a.nodeUp=i.dict.insert(a)},e.initEdgeDict=function(i){i.dict=new bY(i,e.edgeLeq);var r=i.bmax[0]-i.bmin[0],s=i.bmax[1]-i.bmin[1],n=i.bmin[0]-r,a=i.bmax[0]+r,o=i.bmin[1]-s,l=i.bmax[1]+s;e.addSentinel(i,n,a,o),e.addSentinel(i,n,a,l)},e.doneEdgeDict=function(i){for(var r,s=0;(r=i.dict.min().key)!==null;)r.sentinel||(Ye(r.fixUpperEdge),Ye(++s===1)),Ye(r.windingNumber===0),e.deleteRegion(i,r)},e.removeDegenerateEdges=function(i){var r,s,n,a=i.mesh.eHead;for(r=a.next;r!==a;r=s)s=r.next,n=r.Lnext,Ue.vertEq(r.Org,r.Dst)&&r.Lnext.Lnext!==r&&(e.spliceMergeVertices(i,n,r),i.mesh.delete(r),n=(r=n).Lnext),n.Lnext===r&&(n!==r&&((n===s||n===s.Sym)&&(s=s.next),i.mesh.delete(n)),(r===s||r===s.Sym)&&(s=s.next),i.mesh.delete(r))},e.initPriorityQ=function(i){var r,s,n,a=0;for(s=(n=i.mesh.vHead).next;s!==n;s=s.next)a++;for(a+=8,r=i.pq=new vY(a,Ue.vertLeq),s=(n=i.mesh.vHead).next;s!==n;s=s.next)s.pqHandle=r.insert(s);return s===n&&(r.init(),!0)},e.donePriorityQ=function(i){i.pq=null},e.removeDegenerateFaces=function(i,r){var s,n,a;for(s=r.fHead.next;s!==r.fHead;s=n)n=s.next,Ye((a=s.anEdge).Lnext!==a),a.Lnext.Lnext===a&&(e.addWinding(a.Onext,a),i.mesh.delete(a));return!0},e.computeInterior=function(i,r){var s,n;if(r===void 0&&(r=!0),e.removeDegenerateEdges(i),!e.initPriorityQ(i))return!1;for(e.initEdgeDict(i);(s=i.pq.extractMin())!==null;){for(;(n=i.pq.min())!==null&&Ue.vertEq(n,s);)n=i.pq.extractMin(),e.spliceMergeVertices(i,s.anEdge,n.anEdge);e.sweepEvent(i,s)}return i.event=i.dict.min().key.eUp.Org,e.debugEvent(i),e.doneEdgeDict(i),e.donePriorityQ(i),!!e.removeDegenerateFaces(i,i.mesh)&&(r&&i.mesh.check(),!0)},e}(),ift=function(){function e(){this.mesh=new iO,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=yr.ODD,this.dict=null,this.pq=null,this.event=null,this.vertexIndexCounter=0,this.vertices=[],this.vertexIndices=[],this.vertexCount=0,this.elements=[],this.elementCount=0}return e.prototype.dot_=function(i,r){return i[0]*r[0]+i[1]*r[1]+i[2]*r[2]},e.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},e.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},e.prototype.computeNormal_=function(i){var r,s,n,a,o,l,u=[0,0,0],h=[0,0,0],d=[0,0,0],c=[0,0,0],p=[0,0,0],m=[null,null,null],f=[null,null,null],g=this.mesh.vHead;r=g.next;for(var y=0;y<3;++y)a=r.coords[y],h[y]=a,f[y]=r,u[y]=a,m[y]=r;for(r=g.next;r!==g;r=r.next)for(var v=0;v<3;++v)(a=r.coords[v])<h[v]&&(h[v]=a,f[v]=r),a>u[v]&&(u[v]=a,m[v]=r);var b=0;if(u[1]-h[1]>u[0]-h[0]&&(b=1),u[2]-h[2]>u[b]-h[b]&&(b=2),h[b]>=u[b])return i[0]=0,i[1]=0,void(i[2]=1);for(l=0,s=f[b],n=m[b],d[0]=s.coords[0]-n.coords[0],d[1]=s.coords[1]-n.coords[1],d[2]=s.coords[2]-n.coords[2],r=g.next;r!==g;r=r.next)c[0]=r.coords[0]-n.coords[0],c[1]=r.coords[1]-n.coords[1],c[2]=r.coords[2]-n.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)},e.prototype.checkOrientation_=function(){for(var i,r,s=this.mesh.fHead,n=this.mesh.vHead,a=0,o=s.next;o!==s;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=n.next;i!==n;i=i.next)i.t=-i.t;this.tUnit[0]=-this.tUnit[0],this.tUnit[1]=-this.tUnit[1],this.tUnit[2]=-this.tUnit[2]}},e.prototype.projectPolygon_=function(){var i,r,s=this.mesh.vHead,n=[0,0,0],a=!1;n[0]=this.normal[0],n[1]=this.normal[1],n[2]=this.normal[2],!n[0]&&!n[1]&&!n[2]&&(this.computeNormal_(n),a=!0),i=this.sUnit,r=this.tUnit;var o=this.longAxis_(n);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]=n[o]>0?1:-1;for(var l=s.next;l!==s;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=s.next;h!==s;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))},e.prototype.addWinding_=function(i,r){i.winding+=r.winding,i.Sym.winding+=r.Sym.winding},e.prototype.tessellateMonoRegion_=function(i,r){var s,n;if((s=r.anEdge).Lnext===s||s.Lnext.Lnext===s)throw"Mono region invalid";for(;Ue.vertLeq(s.Dst,s.Org);s=s.Lprev);for(;Ue.vertLeq(s.Org,s.Dst);s=s.Lnext);for(n=s.Lprev;s.Lnext!==n;)if(Ue.vertLeq(s.Dst,n.Org)){for(;n.Lnext!==s&&(Ue.edgeGoesLeft(n.Lnext)||Ue.edgeSign(n.Org,n.Dst,n.Lnext.Dst)<=0);)n=i.connect(n.Lnext,n).Sym;n=n.Lprev}else{for(;n.Lnext!==s&&(Ue.edgeGoesRight(s.Lprev)||Ue.edgeSign(s.Dst,s.Org,s.Lprev.Org)>=0);)s=i.connect(s,s.Lprev).Sym;s=s.Lnext}if(n.Lnext===s)throw"Mono region invalid";for(;n.Lnext.Lnext!==s;)n=i.connect(n.Lnext,n).Sym;return!0},e.prototype.tessellateInterior_=function(i){for(var r,s=i.fHead.next;s!==i.fHead;s=r)if(r=s.next,s.inside&&!this.tessellateMonoRegion_(i,s))return!1;return!0},e.prototype.discardExterior_=function(i){for(var r,s=i.fHead.next;s!==i.fHead;s=r)r=s.next,s.inside||i.zapFace(s)},e.prototype.setWindingNumber_=function(i,r,s){for(var n,a=i.eHead.next;a!==i.eHead;a=n)n=a.next,a.Rface.inside!==a.Lface.inside?a.winding=a.Lface.inside?r:-r:s?i.delete(a):a.winding=0},e.prototype.getNeighbourFace_=function(i){return i.Rface&&i.Rface.inside?i.Rface.n:-1},e.prototype.outputPolymesh_=function(i,r,s,n){var a,o,l=0,u=0;s>3&&i.mergeConvexFaces(s);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>s)throw"Face vertex greater that support polygon";d.n=l,++l}for(this.elementCount=l,r===sn.CONNECTED_POLYGONS&&(l*=2),this.elements=[],this.elements.length=l*s,this.vertexCount=u,this.vertices=[],this.vertices.length=u*n,this.vertexIndices=[],this.vertexIndices.length=u,h=i.vHead.next;h!==i.vHead;h=h.next)if(h.n!==-1){var c=h.n*n;this.vertices[c+0]=h.coords[0],this.vertices[c+1]=h.coords[1],n>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 m=o;m<s;++m)this.elements[p++]=-1;if(r===sn.CONNECTED_POLYGONS){a=d.anEdge;do this.elements[p++]=this.getNeighbourFace_(a),a=a.Lnext;while(a!==d.anEdge);for(var f=o;f<s;++f)this.elements[p++]=-1}}},e.prototype.outputContours_=function(i,r){var s,n,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){n=s=l.anEdge;do this.vertexCount++,s=s.Lnext;while(s!==n);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,n=s=l.anEdge;do this.vertices[u++]=s.Org.coords[0],this.vertices[u++]=s.Org.coords[1],r>2&&(this.vertices[u++]=s.Org.coords[2]),this.vertexIndices[h++]=this.vertexIdCallback?this.vertexIdCallback(s):s.Org.idx,o++,s=s.Lnext;while(s!==n);this.elements[d++]=a,this.elements[d++]=o,a+=o}},e.prototype.addContour=function(i,r){this.mesh===null&&(this.mesh=new iO),i<2&&(i=2),i>3&&(i=3);for(var s=null,n=0;n<r.length;n+=i)s===null?(s=this.mesh.makeEdge(),this.mesh.splice(s,s.Sym)):(this.mesh.splitEdge(s),s=s.Lnext),s.Org.coords[0]=r[n+0],s.Org.coords[1]=r[n+1],s.Org.coords[2]=i>2?r[n+2]:0,s.Org.idx=this.vertexIndexCounter++,this.edgeCreateCallback&&this.edgeCreateCallback(s),s.winding=1,s.Sym.winding=-1},e.prototype.tesselate=function(i,r,s,n,a,o){if(i===void 0&&(i=yr.ODD),r===void 0&&(r=sn.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,n<2&&(n=2),n>3&&(n=3),!this.mesh)return!1;this.projectPolygon_(),_Y.computeInterior(this,o);var l=this.mesh;return r===sn.BOUNDARY_CONTOURS?this.setWindingNumber_(l,1,!0):this.tessellateInterior_(l),o&&l.check(),r===sn.BOUNDARY_CONTOURS?this.outputContours_(l,n):this.outputPolymesh_(l,r,s,n),!0},e}(),yr.ODD,yr.NONZERO,yr.POSITIVE,yr.NEGATIVE,yr.ABS_GEQ_TWO,sn.POLYGONS,sn.CONNECTED_POLYGONS,sn.BOUNDARY_CONTOURS}),eMt=W(()=>{(rft=aO=class{constructor(t=256,e=!1){this.capacity=t,this.size=0,this.debug=e,this.debug&&console.log(`allocating with cap ${t}`);let i=t*aO.eSize;this.buffer=new ArrayBuffer(i);let r=Float32Array.BYTES_PER_ELEMENT,s=0;this.positions=new Float32Array(this.buffer,s*r,3*t),s+=3*t,this.normals=new Float32Array(this.buffer,s*r,3*t),s+=3*t,this.uvs=new Float32Array(this.buffer,s*r,2*t)}realloc(t,e=!1){if(t<this.size)throw Error("cannot shrink buffer");if(t<=this.capacity&&!e)return;this.debug&&console.log(`resizing from ${this.capacity} \u2192 ${t}`);let i=t*aO.eSize,r=new ArrayBuffer(i),s=Float32Array.BYTES_PER_ELEMENT,n=0,a=new Float32Array(r,n*s,3*t);n+=3*t;let o=new Float32Array(r,n*s,3*t);n+=3*t;let l=new Float32Array(r,n*s,2*t);e?(a.set(this.positions.subarray(0,3*this.size)),o.set(this.normals.subarray(0,3*this.size)),l.set(this.uvs.subarray(0,2*this.size))):(a.set(this.positions),o.set(this.normals),l.set(this.uvs)),this.buffer=r,this.positions=a,this.normals=o,this.uvs=l,this.capacity=t}get(t=1){let e=this.size+t;if(e>this.capacity){let r=this.capacity;for(;e>r;)r*=2;this.realloc(r)}let i=this.size;return this.size=e,i}reserve(t){let e=this.size+t;e>this.capacity&&this.realloc(e)}shrink(){this.debug&&console.log(`shrinking ${this.capacity} \u2192 ${this.size}`),this.realloc(this.size,!0)}}).eSize=8*Float32Array.BYTES_PER_ELEMENT}),iMt=W(()=>{sft=class{constructor(t=[],e=(i,r)=>i<r?-1:i>r?1:0){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;let t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:e,compare:i}=this,r=e[t];for(;t>0;){let s=t-1>>1,n=e[s];if(i(r,n)>=0)break;e[t]=n,t=s}e[t]=r}_down(t){let{data:e,compare:i}=this,r=this.length>>1,s=e[t];for(;t<r;){let n=1+(t<<1),a=n+1;if(a<this.length&&i(e[a],e[n])<0&&(n=a),i(e[n],s)>=0)break;e[t]=e[n],t=n}e[t]=s}}});function vM(t,e,i,r){this.x=t,this.y=e,this.h=i,this.d=function(s,n,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],m=u[c];p[1]>n!=m[1]>n&&s<(m[0]-p[0])*(n-p[1])/(m[1]-p[1])+p[0]&&(o=!o),l=Math.min(l,rMt(s,n,p,m))}return l===0?0:(o?1:-1)*Math.sqrt(l)}(t,e,r),this.max=this.d+this.h*Math.SQRT2}function rMt(t,e,i,r){let s=i[0],n=i[1],a=r[0]-s,o=r[1]-n;if(a!==0||o!==0){let l=((t-s)*a+(e-n)*o)/(a*a+o*o);l>1?(s=r[0],n=r[1]):l>0&&(s+=a*l,n+=o*l)}return a=t-s,o=e-n,a*a+o*o}var n4,hU,uU,bM,a4,dU,cU,bm,sMt=W(()=>{iMt()}),K7=W(()=>{yt(),Kv(),eMt(),cr(),sMt(),n4={vertices:[160,160,-160,160,-160,-160,160,-160],vertexIndices:[1,0,3,2],vertexCount:4,elements:[0,4],elementCount:1,mesh:void 0},hU={vertices:[],vertexIndices:[],vertexCount:0,elements:[],elementCount:0,mesh:void 0},uU={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},bM=(t,e)=>([i,r])=>(r<i&&(r+=e),(t>=i?t:t+e)<=r),a4=class extends ye{constructor(t,e,i=0,r=12,s=3,n=yr.ODD,a=!1){super(),this.forPathBevel=a,this.type="ShapeGeometry",this.vertexCache={},this._shape=t,this._depth=e,this._curveSegments=r,this._bevelSegmentsInput=s;let o,l,u,h=this._shape.extractShapePointsToFlatArray([],r),d=this._shape.shapeHoles.map(T=>{let A=T.extractShapePointsToFlatArray([],r),C=[];for(let R=A.length-1;R>=1;R-=2){let O=A[R-1],D=A[R-0];C.push(O,D)}return C}),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 A=d[T],C=[];for(let R=0;R<A.length;R+=2)C.push([A[R],A[R+1]]);c.push(C)}o=t.isText?.1*new J4().setFromPoints(t.points.map(T=>T.position)).getSize(new Z).length():c[0].length===0?i:i>0?function(T,A,C=1,R=!1){let O=1/0,D=1/0,B=-1/0,k=-1/0;for(let[q,nt]of T[0])q<O&&(O=q),nt<D&&(D=nt),q>B&&(B=q),nt>k&&(k=nt);let j=B-O,z=k-D,V=Math.max(C,Math.min(j,z));if(V===C){let q=[O,D];return q.distance=0,q.distance}let H=new sft([],(q,nt)=>nt.max-q.max),U=function(q){let nt=0,Tt=0,gt=0,vt=q[0];for(let St=0,Mt=vt.length,Ct=Mt-1;St<Mt;Ct=St++){let Vt=vt[St],Pt=vt[Ct],Dt=Vt[0]*Pt[1]-Pt[0]*Vt[1];Tt+=(Vt[0]+Pt[0])*Dt,gt+=(Vt[1]+Pt[1])*Dt,nt+=3*Dt}let ct=new vM(Tt/nt,gt/nt,0,q);return nt===0||ct.d<0?new vM(vt[0][0],vt[0][1],0,q):ct}(T),et=new vM(O+j/2,D+z/2,0,T);et.d>U.d&&(U=et);let at=2;function Q(q,nt,Tt){let gt=new vM(q,nt,Tt,T);if(at++,gt.max>U.d+C&&H.push(gt),gt.d>U.d&&(U=gt,R&&console.log(`found best ${Math.round(1e4*gt.d)/1e4} after ${at} probes`),U.d>A))return A}let ut=V/2;for(let q=O;q<B;q+=V)for(let nt=D;nt<k;nt+=V)Q(q+ut,nt+ut,ut);for(;H.length;){let{max:q,x:nt,y:Tt,h:gt}=H.pop();if(q-U.d<=C)break;ut=gt/2,Q(nt-ut,Tt-ut,ut),Q(nt+ut,Tt-ut,ut),Q(nt-ut,Tt+ut,ut),Q(nt+ut,Tt+ut,ut)}R&&console.log(`num probes: ${at}
342
342
  best distance: ${U.d}`);let ht=[U.x,U.y];return ht.distance=U.d,ht.distance}(c,i):1e-5,i<=0?(this._bevel=0,this._bevelSegments=0):(this._bevel=Math.min(i,o,e/2),this._bevelSegments=Math.floor(s));try{l=Qp({windingRule:n,elementType:sn.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[h]})}catch{l=n4}try{u=Qp({windingRule:yr.ODD,elementType:sn.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...d]})}catch{u=hU}if(!l)throw new Error("error generating geometry");let m=l.elementCount;if(u){l.elementCount+=u.elementCount;for(let T=0;T<u.elements.length;T++){let A=u.elements[T],C=T%2==0?l.vertexCount:0;l.elements.push(A+C)}for(let T=0;T<u.vertexIndices.length;T++){let A=u.vertexIndices[T],C=l.vertexCount;l.vertexIndices.push(A+C)}for(let T=0;T<u.vertices.length;T++){let A=u.vertices[T];l.vertices.push(A)}}let f=1/0,g=-1/0,y=1/0,v=-1/0;for(let T=0,A=l.vertexCount;T<A;T++){let C=2*T,R=l.vertices[C+0],O=l.vertices[C+1];R<f&&(f=R),R>g&&(g=R),O<y&&(y=O),O>v&&(v=O)}this._minX=f,this._minY=y,this._width=g-f,this._height=v-y,this._buffer=new rft(this._computeBufferEstimatedSize(l));let b=[],_=[];for(let T=l.elementCount-1;T>=0;T--){let A=T>=m,C=2*T,R=l.elements[C+0],O=l.elements[C+1],D=R+O,B={start:R,count:O,normals:[],continuous:[],concave:[]},k=R,j=D-1,z=R+1,V=this._shape.roundedCurves.length;do{let Q=k-R,ut=l.vertices[2*j+0],ht=l.vertices[2*j+1],q=l.vertices[2*k+0],nt=l.vertices[2*k+1],Tt=l.vertices[2*z+0],gt=l.vertices[2*z+1],vt=q-ut,ct=nt-ht,St=Math.sqrt(vt*vt+ct*ct);vt/=St,ct/=St;let Mt=q-Tt,Ct=nt-gt,Vt=Math.sqrt(Mt*Mt+Ct*Ct);Mt/=Vt,Ct/=Vt,B.normals[2*Q+0]=-Ct,B.normals[2*Q+1]=Mt,B.concave[Q]=vt*Ct-ct*Mt>0;let Pt=l.vertexIndices[k];if(Array.isArray(Pt))B.continuous[Q]=!1;else{let[Dt,It]=this._shape.getCurveIndexFromVertexId(Pt-1,!0);if(It>0&&It<1)B.continuous[Q]=!0;else{let Ot=It===1?Dt+1:Dt-1;Ot=(Ot+V)%V;let Qt=It===1?0:1,Lt=this._shape.roundedCurves[Dt].getTangent(It),Jt=this._shape.roundedCurves[Ot].getTangent(Qt);B.continuous[Q]=Lt.dot(Jt)>.95}}A&&(B.normals[2*Q+0]*=-1,B.normals[2*Q+1]*=-1),[j,k,z]=[k,z,z+1],z>=D&&(z-=O)}while(z!==R+1);let H=[];H.push({bevelI:0,angle:0,size:0,boundary:{vertices:l.vertices.slice(2*R,2*D),vertexCount:O,vertexIndices:new Array(O).fill(!0).map((Q,ut)=>[ut,ut]),elements:[0,O],elementCount:1,mesh:null},reverseMap:[],insetPoints:l.vertices.slice(2*R,2*D)});let U=0;for(let Q=1;Q<=this._bevelSegments;Q++){let ut=Q/this._bevelSegments*Math.PI/2,ht=(1-Math.cos(ut))*this._bevel,q=[],nt=[],Tt=[],gt=[],vt=0;for(let St=0;St<O;St++){let Mt=2*St,Ct=(St-1+O)%O*2,Vt=l.vertices[2*B.start+Mt+0],Pt=l.vertices[2*B.start+Mt+1],Dt=-B.normals[Ct+0]*ht,It=-B.normals[Ct+1]*ht,Ot=-B.normals[Mt+0]*ht,Qt=-B.normals[Mt+1]*ht;if(B.concave[St]||!B.concave[St]&&A){let Lt=Math.atan2(It,Dt),Jt=Math.atan2(Qt,Ot);Jt>Lt&&(Jt-=2*Math.PI);let qt=Jt-Lt;if(B.continuous[St]||A){let X=Lt+qt/2,$t=Math.cos(X)*ht,Te=Math.sin(X)*ht;q[2*vt+0]=Vt+$t*(A?-1:1),q[2*vt+1]=Pt+Te*(A?-1:1),gt[vt]=St,vt++}else{let X=Math.max(1,Math.floor(r/4*Math.abs(qt)/Math.PI));for(let $t=0;$t<=X;$t++){let Te=Lt+qt*($t/X),Be=Math.cos(Te)*ht,ee=Math.sin(Te)*ht;q[2*vt+0]=Vt+Be,q[2*vt+1]=Pt+ee,gt[vt]=St,vt++}}}else q[2*vt+0]=Vt+Dt,q[2*vt+1]=Pt+It,gt[vt]=St,nt[St]=vt,vt++,q[2*vt+0]=Vt,q[2*vt+1]=Pt,gt[vt]=St,vt++,q[2*vt+0]=Vt+Ot,q[2*vt+1]=Pt+Qt,gt[vt]=St,Tt[St]=vt,vt++}let ct=Qp({windingRule:yr.POSITIVE,elementType:sn.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[q],edgeCreateCallback:St=>{let Mt=St.Org.idx,Ct=gt[Mt],Vt=gt[(Mt+1)%gt.length];St.idx=[Ct,Vt],St.Sym.idx=[Vt,Ct]},vertexIdCallback:St=>{let Mt=St.Lprev.idx;return[Mt?Mt[1]:0,St.idx?St.idx[0]:0]}});if(!ct)throw console.log("Error"),new Error(`error generating bevel geometry for ${Q}'th loop`);if(!ct.vertexCount){let St=(Q-1)/this._bevelSegments*Math.PI/2;U=(1-Math.sin(St))*this._bevel;break}for(let St=0;St<ct.vertexIndices.length;St++){let[Mt,Ct]=ct.vertexIndices[St];if(Mt===Ct)continue;let Vt=Ct;Ct<Mt&&(Vt+=O);for(let Pt=Mt;Pt<Vt;Pt++){let Dt=Pt%O,It=(Pt+1)%O;if(!B.continuous[Dt]||!B.continuous[It]){ct.vertexIndices[St]=[Mt,Dt],ct.vertexIndices.splice(St+1,0,[It,Ct]),ct.vertices.splice(2*(St+1),0,ct.vertices[2*St],ct.vertices[2*St+1]);break}}}H.push({bevelI:Q,angle:ut,size:ht,boundary:ct,reverseMap:gt,insetPoints:q})}let et=(Q,ut,ht)=>{let q=0,nt=Q.boundary.vertexIndices.length;for(;q<nt&&ht(Q.boundary.vertexIndices[ut]);)ut=(ut+1)%nt,q++;return q},at=b.length;for(let Q=1;Q<H.length;Q++){let ut=H[Q-1],ht=H[Q],q=ut.boundary.vertexIndices.length,nt=ht.boundary.vertexIndices.length;if(!q||!nt)break;let Tt=B.concave.length,gt=0,vt=bM(gt,O);for(;!ut.boundary.vertexIndices.filter(vt).length||!ht.boundary.vertexIndices.filter(vt).length;)gt++,vt=bM(gt,O);let ct=ut.boundary.vertexIndices.findIndex(vt),St=ht.boundary.vertexIndices.findIndex(vt);do ct=(ct+1)%q;while(vt(ut.boundary.vertexIndices[ct]));do St=(St+1)%nt;while(vt(ht.boundary.vertexIndices[St]));gt=(gt+1)%O;let Mt,Ct,Vt=gt,Pt=0,Dt=this._buildBevelVert(B,ut,(ct-1+q)%q,void 0,Pt),It=this._buildBevelVert(B,ht,(St-1+nt)%nt,void 0,Pt),Ot=!1;do{Pt=(gt||Tt)/Tt,vt=bM(gt,O);let Qt=et(ut,ct,vt),Lt=et(ht,St,vt),Jt=Ot;if(Ot=!1,Qt&&!Lt){for(let qt=0;qt<Qt;qt++)Mt=this._buildBevelVert(B,ut,(ct+qt)%q,qt/(Qt-1),Pt),b.push(Dt.topN,Mt.topP,It.topN),a===!1&&b.push(Mt.bottomP,Dt.bottomN,It.bottomN),Dt=Mt;Ot=!0}else if(!Qt&&Lt)for(let qt=0;qt<Lt;qt++)Ct=this._buildBevelVert(B,ht,(St+qt)%nt,qt/(Lt-1),Pt),b.push(It.topN,Dt.topP,Ct.topP),a===!1&&b.push(Dt.bottomP,It.bottomN,Ct.bottomP),It=Ct;else if(Qt&&Lt)if(Mt=this._buildBevelVert(B,ut,ct,0,Pt),Ct=this._buildBevelVert(B,ht,St,0,Pt),Jt?(b.push(Dt.topN,Ct.topP,It.topN),b.push(Dt.topN,Mt.topP,Ct.topP),a===!1&&(b.push(Ct.bottomP,Dt.bottomN,It.bottomN),b.push(Ct.bottomP,Mt.bottomP,Dt.bottomN))):(b.push(It.topN,Dt.topN,Mt.topP),b.push(It.topN,Mt.topP,Ct.topP),a===!1&&(b.push(Mt.bottomP,Dt.bottomN,It.bottomN),b.push(Mt.bottomP,It.bottomN,Ct.bottomP))),Dt=Mt,It=Ct,Qt===Lt)for(let qt=1;qt<Qt;qt++)Mt=this._buildBevelVert(B,ut,(ct+qt)%q,qt/(Qt-1),Pt),Ct=this._buildBevelVert(B,ht,(St+qt)%nt,qt/(Lt-1),Pt),b.push(Dt.topN,Mt.topP,It.topN),b.push(It.topN,Mt.topP,Ct.topP),a===!1&&(b.push(Mt.bottomP,Dt.bottomN,It.bottomN),b.push(Mt.bottomP,It.bottomN,Ct.bottomP)),Dt=Mt,It=Ct;else if(Qt>Lt){let qt=Qt/Lt,X=0;for(let $t=1;$t<Qt;$t++)Mt=this._buildBevelVert(B,ut,(ct+$t)%q,$t/(Qt-1),Pt),b.push(Dt.topN,Mt.topP,It.topN),a===!1&&b.push(Mt.bottomP,Dt.bottomN,It.bottomN),Dt=Mt,$t>(X+1)*qt&&(X++,Ct=this._buildBevelVert(B,ht,(St+X)%nt,X/(Lt-1),Pt),b.push(It.topN,Mt.topP,Ct.topP),a===!1&&b.push(Mt.bottomP,It.bottomN,Ct.bottomP),It=Ct)}else{let qt=Lt/Qt,X=0;for(let $t=1;$t<Lt;$t++)Ct=this._buildBevelVert(B,ht,(St+$t)%nt,$t/(Lt-1),Pt),b.push(It.topN,Mt.topP,Ct.topP),a===!1&&b.push(Mt.bottomP,It.bottomN,Ct.bottomP),It=Ct,$t>(X+1)*qt&&(X++,Mt=this._buildBevelVert(B,ut,(ct+X)%q,X/(Qt-1),Pt),b.push(Dt.topN,Mt.topP,It.topN),a===!1&&b.push(Mt.bottomP,Dt.bottomN,It.bottomN),Dt=Mt)}ct=(ct+Qt)%q,St=(St+Lt)%nt,gt=(gt+1)%Tt}while(gt!==Vt)}if(a===!1&&this._depth>2*this._bevel&&this._buildWall(H,B,b),A){let Q=[];for(let ut=b.length-1;ut>=at+2;ut-=3){let ht=b[ut-2],q=b[ut-1],nt=b[ut-0];Q.push(nt,q,ht)}b.splice(at,b.length-at,...Q)}if(A){let Q=[];for(let ut=H[H.length-1].boundary.vertices.length-1;ut>=1;ut-=2){let ht=H[H.length-1].boundary.vertices[ut-1],q=H[H.length-1].boundary.vertices[ut-0];Q.push(ht,q)}_.push(Q)}if(!A){let Q,ut=H[H.length-1];try{Q=Qp({windingRule:H.length>1?yr.POSITIVE:yr.ODD,elementType:sn.POLYGONS,vertexSize:2,strict:!0,contours:[ut.insetPoints,..._]})}catch{Q=uU}if(!Q)throw new Error("Error generating geometry for surface");d.length===0&&this._bevel<o&&Object.assign(this,{useNgonForTopBottomFaceDuringBake:!0});for(let ht=0;ht<3*Q.elementCount;ht+=3){let q=this._buildSurfaceVert(Q,Q.elements[ht+0],U),nt=this._buildSurfaceVert(Q,Q.elements[ht+1],U),Tt=this._buildSurfaceVert(Q,Q.elements[ht+2],U);b.push(q.top,nt.top,Tt.top),a===!1&&b.push(Tt.bottom,nt.bottom,q.bottom)}}this.vertexCache={}}this._buffer.shrink();let x=new Se(Uint32Array.from(b),1),S=new Se(this._buffer.positions,3),w=new Se(this._buffer.normals,3),M=new Se(this._buffer.uvs,2);S.needsUpdate=!0,w.needsUpdate=!0,M.needsUpdate=!0,x.needsUpdate=!0,this.setAttribute("position",S),this.setAttribute("normal",w),this.setAttribute("uv",M),this.setIndex(x)}_computeBufferEstimatedSize(t){return 2*t.vertexCount*(2+this._bevelSegments)}_buildWall(t,e,i){let r=t[0];for(let s=0,n=r.boundary.vertexCount;s<n;s++){let a=this._buildBevelVert(e,r,s),o=this._buildBevelVert(e,r,(s+1)%n);i.push(o.topP,a.topN,a.bottomN),i.push(o.topP,a.bottomN,o.bottomP)}}_buildSurfaceVert(t,e,i){let r=e.toString();if(r in this.vertexCache)return this.vertexCache[r];let s=t.vertices[2*e+0],n=t.vertices[2*e+1],a=(s-this._minX)/this._width,o=(n-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]=s,this._buffer.positions[u+1]=n,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]=s,this._buffer.positions[u+4]=n,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(t,e,i,r=1,s){let n=`${e.bevelI}:${i}`;if(n in this.vertexCache&&s!==0&&s!==1&&(!s||s===this.vertexCache[n].pathBevelUCoord))return this.vertexCache[n];let a,o,l,u,[h,d]=e.boundary.vertexIndices[i];h!==d?(o=h,a=d,u=!1,l=t.continuous[o]&&t.continuous[a]):(a=h,o=(a-1+t.count)%t.count,u=t.concave[a]&&e.bevelI>0,l=t.continuous[a]||u);let c=Math.cos(e.angle),p=Math.sin(e.angle),m=2*i,f=2*a,g=2*o,y=e.boundary.vertices[m+0],v=e.boundary.vertices[m+1],b=(1-p)*this._bevel,_=(y-this._minX)/this._width,x=(v-this._minY)/this._height;this.forPathBevel&&(s!==void 0&&(_=s),x=1);let S=t.normals[f+0],w=t.normals[f+1],M=t.normals[g+0],T=t.normals[g+1];if(u){S+=(M-S)*(1-r),w+=(T-w)*(1-r);let D=Math.sqrt(S*S+w*w);S/=D,w/=D}let A=this.forPathBevel?this._buffer.get(l?1:2):this._buffer.get(l?2:4),C=3*A,R=2*A,O={i,fi:a,topP:A+0,topN:A+0,bottomP:A+1,bottomN:A+1,pathBevelUCoord:s};return this._buffer.positions[C+0]=y,this._buffer.positions[C+1]=v,this._buffer.positions[C+2]=(this.forPathBevel?this._bevel:this._depth)-b,this._buffer.normals[C+0]=S*c,this._buffer.normals[C+1]=w*c,this._buffer.normals[C+2]=p,this._buffer.uvs[R+0]=_,this._buffer.uvs[R+1]=x,this.forPathBevel===!1&&(this._buffer.positions[C+3]=y,this._buffer.positions[C+4]=v,this._buffer.positions[C+5]=b,this._buffer.normals[C+3]=S*c,this._buffer.normals[C+4]=w*c,this._buffer.normals[C+5]=-p,this._buffer.uvs[R+2]=x,this._buffer.uvs[R+3]=_),l||(this.forPathBevel?(A+=1,C+=3,R+=2):(A+=2,C+=6,R+=4),O.topP=A+0,O.bottomP=A+1,this._buffer.positions[C+0]=y,this._buffer.positions[C+1]=v,this._buffer.positions[C+2]=(this.forPathBevel?this._bevel:this._depth)-b,this._buffer.normals[C+0]=M*c,this._buffer.normals[C+1]=T*c,this._buffer.normals[C+2]=p,this._buffer.uvs[R+0]=_,this._buffer.uvs[R+1]=x,this.forPathBevel===!1&&(this._buffer.positions[C+3]=y,this._buffer.positions[C+4]=v,this._buffer.positions[C+5]=b,this._buffer.normals[C+3]=M*c,this._buffer.normals[C+4]=T*c,this._buffer.normals[C+5]=-p,this._buffer.uvs[R+2]=x,this._buffer.uvs[R+3]=_)),this.vertexCache[n]=O,O}clone(){let t=new a4(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegmentsInput);return t.userData=t5(this.userData),t}}}),nft=W(()=>{yt(),Kv(),cr(),K7(),dU=class extends ye{constructor(t,e=12,i={}){super(),this.type="ShapeGeometry",this.windingRule=yr.ODD,this.elementType=sn.POLYGONS,this.polySize=3,this.vertexSize=2,this.strict=!0,this._shape=t,this._curveSegments=e,this._triangulationOptions=Object.assign({windingRule:yr.ODD,elementType:sn.POLYGONS,polySize:3,vertexSize:2,strict:!0},i);let r,s,n,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 m=2*c,f=a[m+0],g=a[m+1];if(s!==void 0&&f!==s&&(l=!1),n!==void 0&&g!==n&&(u=!1),s=f,n=g,!l&&!u)break}if(!l&&!u)try{r=Qp({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=n4}let h=r?.vertexCount??1,d=r?.elementCount??1;if(this._positionAttribute=new Se(new Float32Array(3*h),3),this._normalAttribute=new Se(new Float32Array(3*h),3),this._uvAttribute=new Se(new Float32Array(2*h),2),this._indexAttribute=new Se(new Uint32Array(3*d),1),r){let c=1/0,p=-1/0,m=1/0,f=-1/0;for(let v=0,b=h;v<b;v++){let _=2*v,x=r.vertices[_+0],S=r.vertices[_+1];x<c&&(c=x),x>p&&(p=x),S<m&&(m=S),S>f&&(f=S)}let g=p-c,y=f-m;for(let v=0,b=h;v<b;v++){let _=2*v,x=r.vertices[_+0],S=r.vertices[_+1],w=(x-c)/g,M=(S-m)/y;this._positionAttribute.setXYZ(v,x,S,0),this._normalAttribute.setXYZ(v,0,0,1),this._uvAttribute.setXY(v,w,M)}for(let v=0,b=d;v<b;v++){let _=3*v,x=r.elements[_+0],S=r.elements[_+1],w=r.elements[_+2];this._indexAttribute.setX(_+0,x),this._indexAttribute.setX(_+1,S),this._indexAttribute.setX(_+2,w)}}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 t=new dU(this._shape,this._curveSegments);return t.userData=t5(this.userData),t}}}),nMt=W(()=>{Kv(),cr(),K7(),cU=class extends a4{constructor(t,e,i=0,r=12,s=3,n=yr.ODD){super(t,e,i,r,s,n),this.type="ShapeGeometry"}_computeBufferEstimatedSize(t){return 2*t.vertexCount*(2+this._bevelSegments)}_buildWall(t,e,i){let r=t[0];for(let s=0,n=r.boundary.vertexCount;s<n;s++){let a=this._buildBevelVert(e,r,s),o=this._buildBevelVert(e,r,(s+1)%n);i.push(o.topP,a.topN,a.bottomN),i.push(o.topP,a.bottomN,o.bottomP)}}clone(){let t=new cU(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegmentsInput);return t.userData=t5(this.userData),t}}}),pm=W(()=>{vm(),nft(),nMt(),Kv(),bm=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i,r=Object.assign({},e?.parameters??{width:100,subdivisions:40,roundness:0,extrudeBevelSize:0,extrudeBevelSegments:3,windingRule:yr.ODD},t.parameters),s=Math.abs(r.width),n=Math.abs(r.height??r.width),a=Math.abs(r.depth??0),o=t.shape??e?.shape,l=o?.roundness??r.roundness;o!==void 0&&(o instanceof us?(i=o,(i.width!==s||i.height!==n)&&i.applySize(s,n)):i=new us(s,n).fromJSON(o),t.parameters?.roundness!==void 0&&t.parameters?.roundness>0&&i.update());let u=i??new us(s,n);return{parameters:Object.assign(r,{width:s,height:n,depth:a,roundness:l}),shape:u}}static build(t){let e,{depth:i,extrudeBevelSize:r,extrudeBevelSegments:s,subdivisions:n,roundness:a,windingRule:o}=t.parameters;return t.shape.roundness=a,e=i<=0?new dU(t.shape,n,{windingRule:o}):new cU(t.shape,i,r,n,s,o),Object.assign(e,{userData:{...t,type:"VectorGeometry"}})}}});function aMt(t,e,i,r,s,n){if(r>=Z7)return s>30||s%4==0?(function(h,d,c,p=0,m=0,f=0){let g=.5522847498,y=d*g,v=c*g;h.addPoint(_M(m-d,f,m-d,f-v,m-d,f+v)),h.addPoint(_M(m,f+c,m-y,f+c,m+y,f+c)),h.addPoint(_M(m+d,f,m+d,f+v,m+d,f-v)),h.addPoint(_M(m,f-c,m+y,f-c,m-y,f-c)),p>0&&oft(h,d,c,p)}(t,e,i,n),Math.round(s/4)):xY(t,r,s,e,i,n);let a={x:0,y:i},o=(r=Math.max(r,.001))+.5*Math.PI,l={x:Math.cos(o)*e,y:Math.sin(o)*i},u=function({px:h,py:d,cx:c,cy:p,rx:m,ry:f,largeArcFlag:g,sweepFlag:y}){let v=[];if(m===0||f===0)return[];let b=(h-c)/2,_=(d-p)/2;if(b===0&&_===0)return[];m=Math.abs(m),f=Math.abs(f);let x=Math.pow(b,2)/Math.pow(m,2)+Math.pow(_,2)/Math.pow(f,2);x>1&&(m*=Math.sqrt(x),f*=Math.sqrt(x));let S=function(O,D,B,k,j,z,V,H,U,et){let at=Math.pow(j,2),Q=Math.pow(z,2),ut=Math.pow(V,2),ht=Math.pow(H,2),q=at*Q-at*ht-Q*ut;q<0&&(q=0),q/=at*ht+Q*ut,q=Math.sqrt(q)*(U===et?-1:1);let nt=q*j/z*H,Tt=q*-z/j*V,gt=nt+(O+B)/2,vt=Tt+(D+k)/2,ct=(V-nt)/j,St=(H-Tt)/z,Mt=(-V-nt)/j,Ct=(-H-Tt)/z,Vt=yY(1,0,ct,St),Pt=yY(ct,St,Mt,Ct);return!et&&Pt>0&&(Pt-=yP),et&&Pt<0&&(Pt+=yP),{centerx:gt,centery:vt,ang1:Vt,ang2:Pt}}(h,d,c,p,m,f,b,_,g,y),{ang1:w,ang2:M}=S,{centerx:T,centery:A}=S,C=Math.abs(M)/(yP/4);Math.abs(1-C)<1e-7&&(C=1);let R=Math.max(Math.ceil(C),1);M/=R;for(let O=0;O<R;O++)v.push(JTt(w,M)),w+=M;return v.map(O=>{let{x:D,y:B}=eO(O[0],m,f,T,A),{x:k,y:j}=eO(O[1],m,f,T,A),{x:z,y:V}=eO(O[2],m,f,T,A);return{x1:D,y1:B,x2:k,y2:j,x:z,y:V}})}({px:a.x,py:a.y,cx:l.x,cy:l.y,rx:e,ry:i,largeArcFlag:r>Math.PI,sweepFlag:!0});return s>30||s%u.length===0?function(h,d,c,p,m,f,g,y){let v=Math.round(m/p.length);h.addPoint(pv(d,c));for(let b=0,_=p.length;b<_;b++){let x=p[b],S=h.points[b],w=pv(x.x,x.y);S.controls[1].position.set(x.x1,x.y1),w.controls[0].position.set(x.x2,x.y2),h.addPoint(w)}return y>0?aft(h,f,g,y):h.addPoint(pv(0,0)),v}(t,a.x,a.y,u,s,e,i,n):xY(t,r,s,e,i,n)}function xY(t,e,i,r,s,n){let a=-e/i;for(let o=0;o<=i;o++){let l=a*o,u=Math.sin(l)*r,h=Math.cos(l)*s;t.addPoint(pv(u,h))}return e<Z7?n>0?aft(t,r,s,n):t.addPoint(pv(0,0)):(t.removePoint(t.points[t.points.length-1]),n>0&&oft(t,r,s,n)),1}function pv(t,e){return new Ug(Yt.generateUUID(),new Z(t,e))}function _M(t,e,i,r,s,n){let a=pv(t,e);return a.controls[0].position.set(i,r),a.controls[1].position.set(s,n),a}function aft(t,e,i,r){lft(t,e,i,r).forEach(s=>t.addPoint(s))}function oft(t,e,i,r){let s=lft(t,e,i,r),n=new us;s.forEach(a=>n.addPoint(a)),n.isClosed=!0,t.shapeHoles.push(n)}function lft(t,e,i,r){let s=r*e/100,n=s*(Math.abs(i)/Math.abs(e)),a=new Z(s/e,n/i),o=t.points.map(l=>{let u=l.clone();return u.uuid=Yt.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 Z7,g5,hft,oO,uft,o4=W(()=>{vm(),eft(),tMt(),pm(),yt(),Z7=2*Math.PI,g5=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,spikes:64,angle:360,innerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1},t.parameters);return i.angle=Yt.clamp(i.angle,0,360),{shape:t.shape&&t.shape instanceof us?t.shape:new us,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(t){let e,{width:i,height:r,spikes:s,angle:n,innerRadius:a,depth:o,extrudeBevelSize:l,extrudeBevelSegments:u}=t.parameters,h=t.shape,d=aMt(h,.5*i,.5*r,n*Math.PI/180,s,a);return h.isClosed=!0,h.update(),n===0?(e=new ye,e.setAttribute("position",new me([],3))):e=bm.create({shape:h,parameters:{subdivisions:d,depth:o,extrudeBevelSize:l,extrudeBevelSegments:u}}),Object.assign(e,{userData:{...t,type:"EllipseGeometry"}})}}}),wY=W(()=>{yt(),Ymt(),hft=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,detail:0,corner:0,cornerSides:4},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let{width:e,height:i,depth:r,detail:s,corner:n,cornerSides:a}=t.parameters,o=s===0&&n!==0?new oO(.5*e,n,a):new YF(.5*e,s),l=i/e,u=r/e;return(l!==1||u!==1)&&o.scale(1,l,u),Object.assign(o,{userData:{...t,type:"IcosahedronGeometry"}})}},oO=class extends r4{constructor(t=1,e=.2,i=4){let r=(1+Math.sqrt(5))/2,s="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],s,t,e,i),this.type=s}static fromJSON(t){return new oO(t.radius,t.corner,t.cornerSides)}}}),SY=W(()=>{yt(),uft=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){(t.parameters?.points??[]).forEach(r=>{Array.isArray(r)&&(r.x=r[0],r.y=r[1])});let i=Object.assign({},e?.parameters??{width:100,segments:64,verticalSegments:64,points:[{x:0,y:-50,id:0},{x:50,y:-50,id:1},{x:50,y:50,id:2},{x:0,y:50,id:3}]},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let{points:e,segments:i,verticalSegments:r}=t.parameters,s=new aS;s.moveTo(e[0].x,e[0].y),s.bezierCurveTo(e[1].x,e[1].y,e[2].x,e[2].y,e[3].x,e[3].y);let n=new KF(s.extractPoints(r).shape,i);return n.rotateZ(Math.PI),Object.assign(n,{userData:{...t,type:"LatheGeometry"}})}}});function L0(t,e){return Math.abs(e-t)/2+Math.min(t,e)}function oMt(t){let{positions:e,faces:i,materialIndices:r,uvs:s}=t,n=e.length/3,a=i.length/3,o=s!==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),m=0,f=8;for(;f<2*l;)f*=2;let g=f-1,y=new Int32Array(f).fill(-1),v=(D,B)=>{let k=(Math.imul(D,2654435761)^B)&g;for(;;){let j=y[k];if(j===-1)return y[k]=m,u[m]=D,h[m]=B,m++;if(u[j]===D&&h[j]===B)return j;k=k+1&g}},b=(D,B)=>{let k=D<B?D:B,j=D<B?B:D,z=(Math.imul(k,2654435761)^j)&g;for(;;){let V=y[z];if(u[V]===k&&h[V]===j)return V;z=z+1&g}},_=new Uint32Array(n),x=new Float64Array(3*n),S=(D,B,k)=>{let j=D<B?v(D,B):v(B,D),z=++d[j];z===1?c[j]=k:z===2&&(p[j]=k),_[D]++,_[B]++,x[3*D]+=e[3*B],x[3*D+1]+=e[3*B+1],x[3*D+2]+=e[3*B+2],x[3*B]+=e[3*D],x[3*B+1]+=e[3*D+1],x[3*B+2]+=e[3*D+2]};for(let D=0;D<a;D++){let B=i[3*D],k=i[3*D+1],j=i[3*D+2];S(B,k,j),S(k,j,B),S(j,B,k)}let w=new Float64Array(3*m);for(let D=0;D<m;D++){let B=3*u[D],k=3*h[D];if(d[D]===2){let j=3*c[D],z=3*p[D];w[3*D]=.375*(e[B]+e[k])+.125*(e[j]+e[z]),w[3*D+1]=.375*(e[B+1]+e[k+1])+.125*(e[j+1]+e[z+1]),w[3*D+2]=.375*(e[B+2]+e[k+2])+.125*(e[j+2]+e[z+2])}else w[3*D]=.5*(e[B]+e[k]),w[3*D+1]=.5*(e[B+1]+e[k+1]),w[3*D+2]=.5*(e[B+2]+e[k+2])}let M,T=new Float64Array(3*n);for(let D=0;D<n;D++){let B=_[D];B===3?M=3/16:B>3&&(M=3/(8*B));let k=1-B*Number(M),j=Number(M);B===2&&(k=3/4,j=1/8),T[3*D]=e[3*D]*k+x[3*D]*j,T[3*D+1]=e[3*D+1]*k+x[3*D+1]*j,T[3*D+2]=e[3*D+2]*k+x[3*D+2]*j}let A=new Float64Array(3*(n+m));A.set(T),A.set(w,3*n);let C=new Uint32Array(12*a),R=new Array(4*a),O=o?new Float64Array(24*a):null;for(let D=0;D<a;D++){let B=i[3*D],k=i[3*D+1],j=i[3*D+2],z=b(B,k)+n,V=b(k,j)+n,H=b(j,B)+n,U=12*D;C[U++]=z,C[U++]=V,C[U++]=H,C[U++]=B,C[U++]=z,C[U++]=H,C[U++]=k,C[U++]=V,C[U++]=z,C[U++]=j,C[U++]=H,C[U++]=V;let et=r[D];if(R[4*D]=et,R[4*D+1]=et,R[4*D+2]=et,R[4*D+3]=et,O!==null){let at=6*D,Q=s[at],ut=s[at+1],ht=s[at+2],q=s[at+3],nt=s[at+4],Tt=s[at+5],gt=L0(Q,ht),vt=L0(ut,q),ct=L0(ht,nt),St=L0(q,Tt),Mt=L0(Q,nt),Ct=L0(ut,Tt),Vt=24*D;O[Vt++]=gt,O[Vt++]=vt,O[Vt++]=ct,O[Vt++]=St,O[Vt++]=Mt,O[Vt++]=Ct,O[Vt++]=Q,O[Vt++]=ut,O[Vt++]=gt,O[Vt++]=vt,O[Vt++]=Mt,O[Vt++]=Ct,O[Vt++]=ht,O[Vt++]=q,O[Vt++]=ct,O[Vt++]=St,O[Vt++]=gt,O[Vt++]=vt,O[Vt++]=nt,O[Vt++]=Tt,O[Vt++]=Mt,O[Vt++]=Ct,O[Vt++]=ct,O[Vt++]=St}}return{positions:A,faces:C,materialIndices:R,uvs:O}}var xM,dft,Js,cft,Q7,lMt=W(()=>{yt(),xM=1e4,dft=class{constructor(t=1){this.subdivisions=t}modify(t){let e=function(r){let s=r.getAttribute("position");if(s===void 0)return console.error("SubdivisionModifier: Position attribute required for subdivision."),{positions:new Float64Array(0),faces:new Uint32Array(0),materialIndices:[],uvs:null};let n=r.getAttribute("uv"),a=r.getIndex(),o=s.count,l=new Map,u=new Uint32Array(o),h=[],d=0;for(let v=0;v<o;v++){let b=s.getX(v),_=s.getY(v),x=s.getZ(v),S=Math.round(b*xM),w=Math.round(_*xM),M=Math.round(x*xM),T=l.get(S);T===void 0&&(T=new Map,l.set(S,T));let A=T.get(w);A===void 0&&(A=new Map,T.set(w,A));let C=A.get(M);C===void 0&&(C=d++,A.set(M,C),h.push(b,_,x)),u[v]=C}let c=[],p=[],m=n===void 0?null:[],f=a!==null?a.count:o,g=(v,b)=>{let _=a!==null?a.getX(v):v,x=a!==null?a.getX(v+1):v+1,S=a!==null?a.getX(v+2):v+2;if(!(_<o&&x<o&&S<o))return;let w=u[_],M=u[x],T=u[S];w===M||M===T||T===w||(c.push(w,M,T),p.push(b),m!==null&&m.push(n.getX(_),n.getY(_),n.getX(x),n.getY(x),n.getX(S),n.getY(S)))},y=r.groups;if(y.length>0)for(let v=0;v<y.length;v++){let b=y[v],_=b.materialIndex===void 0?0:b.materialIndex,x=Math.max(b.start,0),S=Math.min(b.start+b.count,f);for(let w=x;w<S&&w+2<f;w+=3)g(w,_)}else for(let v=0;v+2<f;v+=3)g(v,0);return{positions:Float64Array.from(h),faces:Uint32Array.from(c),materialIndices:p,uvs:m===null?null:Float64Array.from(m)}}(t),i=this.subdivisions;for(;i-- >0;)e=oMt(e);return function(r,s){let{positions:n,faces:a,materialIndices:o,uvs:l}=r,u=n.length/3,h=a.length/3,d=new Float64Array(3*u);for(let y=0;y<h;y++){let v=3*a[3*y],b=3*a[3*y+1],_=3*a[3*y+2],x=n[_]-n[b],S=n[_+1]-n[b+1],w=n[_+2]-n[b+2],M=n[v]-n[b],T=n[v+1]-n[b+1],A=n[v+2]-n[b+2],C=S*A-w*T,R=w*M-x*A,O=x*T-S*M;d[v]+=C,d[v+1]+=R,d[v+2]+=O,d[b]+=C,d[b+1]+=R,d[b+2]+=O,d[_]+=C,d[_+1]+=R,d[_+2]+=O}for(let y=0;y<u;y++){let v=d[3*y],b=d[3*y+1],_=d[3*y+2],x=Math.sqrt(v*v+b*b+_*_)||1;d[3*y]=v/x,d[3*y+1]=b/x,d[3*y+2]=_/x}let c=3*h,p=new Float32Array(3*c),m=new Float32Array(3*c),f=l!==null&&l.length>0?new Float32Array(2*c):null;for(let y=0;y<c;y++){let v=3*a[y];p[3*y]=n[v],p[3*y+1]=n[v+1],p[3*y+2]=n[v+2],m[3*y]=d[v],m[3*y+1]=d[v+1],m[3*y+2]=d[v+2]}f!==null&&f.set(l.subarray(0,2*c));let g=new ye;g.setAttribute("position",new Se(p,3)),c>0&&(g.setAttribute("normal",new Se(m,3)),g.setAttribute("color",new Se(new Float32Array(3*c).fill(1),3))),f!==null&&g.setAttribute("uv",new Se(f,2));for(let y=0;y<h;){let v=o[y],b=y;do y++;while(y<h&&o[y]===v);g.addGroup(3*b,3*(y-b),v)}return s.boundingBox!==null&&(g.boundingBox=s.boundingBox.clone()),s.boundingSphere!==null&&(g.boundingSphere=s.boundingSphere.clone()),g}(e,t)}}}),TY=W(()=>{yt(),lMt(),Js=new P,cft=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i,r=t.geometry??e?.geometry??new ye().copy(new Kh(100,100,100));e===void 0?(r.computeBoundingBox(),r.boundingBox.getSize(Js),i={width:Js.x,height:Js.y,depth:Js.z,subdivisions:0}):i=e.parameters;let s={...i,...t.parameters};return{parameters:{width:Math.abs(s.width),height:Math.abs(s.height),depth:Math.abs(s.depth),subdivisions:Math.abs(s.subdivisions)},geometry:r}}static build(t){let{width:e,height:i,depth:r,subdivisions:s}=t.parameters,n=t.geometry??new ye().copy(new Kh(100,100,100)),a=n.userData.parameters;a===void 0?(n.boundingBox=function(l){let u=new dr,h=l.attributes.position;return h?(u.setFromBufferAttribute(h),u):(u.makeEmpty(),u)}(n),n.boundingBox.getSize(Js)):Js.set(a.width,a.height,a.depth),(e!==Js.x||i!==Js.y||r!==Js.z)&&n.scale(Js.x===0?1:e/Js.x,Js.y===0?1:i/Js.y,Js.z===0?1:r/Js.z);let o=n.originalGeometry;try{s>0?(o===void 0||a?.subdivisions!==s)&&(o===void 0&&(o=n),n=new dft(s).modify(o)):(o!==void 0&&(n=o),o=void 0,n.getAttribute("normal")===void 0&&n.computeVertexNormals())}catch{o!==void 0&&(n=o),o=void 0,n.getAttribute("normal")===void 0&&n.computeVertexNormals()}return o!==void 0&&Object.assign(n,{originalGeometry:o}),delete t.geometry,Object.assign(n,{userData:{...t,type:"NonParametricGeometry"}})}static loadFromUrl(t,e,i){new h7(i).load(t,r=>{let s=this.normalizeInputs({geometry:r});r.boundingBox.getSize(Js);let n=100/Js.x;Object.assign(s.parameters,{width:100,height:Js.y*n,depth:Js.z*n}),e(this.build(s))})}}}),pU=W(()=>{vm(),pm(),Q7=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:3},t.parameters);return{shape:t.shape&&t.shape instanceof us?t.shape:new us,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(t){let{width:e,height:i,spikes:r,cornerRadius:s,depth:n,extrudeBevelSize:a,extrudeBevelSegments:o}=t.parameters,l=t.shape,u=.5*e,h=.5*i,d=2*Math.PI/r;for(let p=0;p<r;p++){let m=d*p,f=0+Math.sin(m)*u,g=0+Math.cos(m)*h;l.addPoint(l.createPoint(f,g))}l.isClosed=!0;for(let p=0,m=l.points.length;p<m;p++)l.points[p].roundness=s;l.roundness=s,l.update();let c=bm.create({shape:l,parameters:{roundness:s,depth:n,extrudeBevelSize:a,extrudeBevelSegments:o}});return Object.assign(c,{userData:{...t,type:"PolygonGeometry"}})}}});function e_(t,e,i){i.x=t.x*e.x,i.y=t.y,i.z=t.x*e.y}function lO(t,e,i,r,s,n){let a=mft.copy(e).sub(t),o=fft.copy(i).sub(t),l=a.angleTo(o);if(a.normalize(),o.normalize(),r===s){let u=a.add(o).normalize();n.copy(t).addScaledVector(u,r/Math.sin(l/2))}else{let u=a.angleTo(o);n.copy(t),n.addScaledVector(a,s/Math.sin(u)),n.addScaledVector(o,r/Math.sin(u))}}function hMt(t,e,i){let r=t.clone().sub(e),s=i.clone().sub(e);return r.projectOnVector(s),r.add(e)}var pft,mft,fft,MY,y5,gft,yft,vft,AY,J7,bft,_ft,xft,wft,CY=W(()=>{yt(),pft=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,radialSegments:4,heightSegments:1,cornerRadius:0,cornerSegments:8,openEnded:!1},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let{width:e,height:i,depth:r,radialSegments:s,heightSegments:n,openEnded:a,cornerRadius:o,cornerSegments:l}=t.parameters,u=new MY(.5*e,i,s,n,a,o,l),h=r/e;return h!==1&&u.scale(1,1,h),Object.assign(u,{userData:{...t,type:"PyramidGeometry"}})}},mft=new P,fft=new P,MY=class extends ye{constructor(t=.5,e=1,i=4,r=1,s=!1,n=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=e/2,m=Math.PI/i,f=t*Math.cos(Math.PI/i),g=2*Math.PI/i,y=(i-2)*Math.PI/i,v=Math.PI-y,b=new P(0,-p,0),_=new P(0,p,0),x=new Z(t,-p),S=new Z(f,-p),w=new Z(0,_.y).sub(S),M=new Z(0,_.y).sub(x),T=new Z(w.y,-w.x).normalize(),A=new Z(M.y,-M.x).normalize(),C=t*Math.cos(Math.PI/i)*Math.tan((Math.PI-w.angle())/2)-1e-8;n=Math.min(n,C);{let z=new P(T.x,T.y,0),V=new P(Math.cos(g)*z.x,z.y,Math.sin(g)*z.x);o=z.angleTo(V)}let R=n/Math.tan((Math.PI-w.angle())/2),O=n/Math.tan((Math.PI-o)/2),D=new P;if(!s){u.push(b.x,b.y,b.z),h.push(0,-1,0),d.push(0,0);let z=c++,V=[],H=x.clone(),U=R/Math.cos(Math.PI/i);H.x-=U;for(let et=0;et<i;et++){let at=et/i*Math.PI*2+m;e_(H,new Z(Math.sin(at),Math.cos(at)),D),u.push(D.x,D.y,D.z),h.push(0,-1,0),d.push(0,0),V.push(c++)}for(let et=0;et<V.length;et++)l.push(V[et],z,V[(et+1)%V.length])}let B=[];{let z=new P,V=new P,H=new P,U=new P,et=new P,at=new P;for(let Q=0;Q<i;Q++){let ut=Q/i*Math.PI*2+m,ht=(Q+.5)/i*Math.PI*2+m,q=(Q+1)/i*Math.PI*2+m,nt=new Z(Math.sin(ut),Math.cos(ut)),Tt=new Z(Math.sin(ht),Math.cos(ht)),gt=new Z(Math.sin(q),Math.cos(q));e_(x,nt,V),e_(x,gt,H),e_(T,Tt,z),lO(_,V,H,O,O,U),u.push(U.x,U.y,U.z),lO(V,_,H,O,R,et),u.push(et.x,et.y,et.z),lO(H,V,_,R,O,at),u.push(at.x,at.y,at.z),h.push(z.x,z.y,z.z),h.push(z.x,z.y,z.z),h.push(z.x,z.y,z.z),d.push(0,0),d.push(0,0),d.push(0,0);let vt=c++,ct=c++,St=c++;if(l.push(vt,ct,St),n>0){{let Vt=V.clone().add(H).multiplyScalar(.5),Pt=_.clone().sub(Vt).normalize(),Dt=b.clone().sub(Vt).normalize().add(Pt).normalize().multiplyScalar(-1);k(Vt,at.clone().sub(et),Dt,w.angle())}let Mt,Ct;{let Vt=new P;e_(A,gt,Vt);let Pt=at.clone().add(U).multiplyScalar(.5);Pt=hMt(Pt,H,_);let Dt=at.clone().sub(U);[Mt,Ct]=k(Pt,Dt,Vt,o,U.y)}{let Vt=Mt,Pt=Vt.clone().setY(0).normalize(),Dt=new P(0,-1,0),It=Pt.clone().cross(Dt);j(Vt,Pt,Dt,It)}B.concat(Ct);{let Vt=w.angle(),Pt=Math.PI-Vt,Dt=_.clone();Dt.y-=n/Math.sin(Vt-Math.PI/2);let It=new P,Ot=[];for(let Lt=0;Lt<a;Lt++){let Jt=[],qt=Math.PI/2-Pt*Lt/a,X=Math.cos(qt),$t=Math.sin(qt),Te=ht;for(let Be=0;Be<=Lt;Be++){let ee=Math.cos(Te),oi=Math.sin(Te);z.x=X*oi,z.y=$t,z.z=X*ee,It.copy(Dt).addScaledVector(z,n),u.push(It.x,It.y,It.z),h.push(z.x,z.y,z.z),d.push(0,0),Jt.push(c++),Te+=2*Math.PI/Lt/i}Ot.push(Jt)}Ct.reverse(),Ot.push(Ct);let Qt=Ot.length-1;for(let Lt=0;Lt<Qt;Lt++){let Jt=Ot[Lt],qt=Ot[Lt+1],X=Jt.length-1;l.push(qt[1],Jt[0],qt[0]);for(let $t=1;$t<=X;$t++)l.push(Jt[$t],Jt[$t-1],qt[$t]),l.push(qt[$t+1],Jt[$t],qt[$t])}}}}}function k(z,V,H,U,et){let at=-U/2,Q=(Math.PI-U)/2,ut=V.clone().normalize().cross(H);z.addScaledVector(H,-n/Math.sin(Q));let ht=new P,q=new P,nt=c,Tt=[];for(let gt=0;gt<=a;gt++){let vt=at+gt/a*U;q.set(0,0,0),q.addScaledVector(ut,Math.sin(vt)),q.addScaledVector(H,Math.cos(vt));for(let ct=0;ct<=1;ct++){let St=ct/1-.5;if(ht.copy(z),ht.addScaledVector(V,St),ht.addScaledVector(q,n),et!=null){let Mt=Math.max(0,ht.y-et);ht.addScaledVector(V,-Mt/V.y)}u.push(ht.x,ht.y,ht.z),h.push(q.x,q.y,q.z),d.push(0,0),ct===0&&Tt.push(c),c++}}for(let gt=0;gt<a;gt++)for(let vt=0;vt<1;vt++){let ct=nt+vt+2*gt,St=ct+2,Mt=St+1,Ct=ct+1;l.push(ct,St,Ct),l.push(St,Mt,Ct)}return[z.clone().addScaledVector(V,.5),Tt]}function j(z,V,H,U){let et=Math.PI/2,at=M.angle()-et,Q=[],ut=new P,ht=new P;for(let nt=0;nt<=a;nt++){let Tt=[],gt=nt/a;for(let vt=0;vt<=nt;vt++){let ct=((nt?vt/nt:0)-.5)*v,St=Math.cos(ct),Mt=Math.sin(ct),Ct=(et+Math.atan(Math.tan(at)*St))*gt,Vt=Math.cos(Ct),Pt=Math.sin(Ct);ut.set(0,0,0),ut.addScaledVector(V,Pt*St),ut.addScaledVector(H,Vt),ut.addScaledVector(U,Pt*Mt),ht.copy(z).addScaledVector(ut,n),u.push(ht.x,ht.y,ht.z),h.push(ut.x,ut.y,ut.z),d.push(0,0),Tt.push(c++)}Q.push(Tt)}let q=Q.length-1;for(let nt=0;nt<q;nt++){let Tt=Q[nt],gt=Q[nt+1],vt=Tt.length-1;l.push(Tt[0],gt[1],gt[0]);for(let ct=1;ct<=vt;ct++)l.push(Tt[ct-1],Tt[ct],gt[ct]),l.push(Tt[ct],gt[ct+1],gt[ct])}}this.setIndex(l),this.setAttribute("position",new me(u,3)),this.setAttribute("normal",new me(h,3)),this.setAttribute("uv",new me(d,2))}}}),l4=W(()=>{vm(),pm(),y5=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,cornerRadius:[0,0,0,0],cornerType:1,extrudeBevelSize:0,extrudeBevelSegments:1},t.parameters),r=Object.assign(e?.ui??{enabledIndieCorners:!1},t.ui);return{shape:t.shape&&t.shape instanceof us?t.shape:new us,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(t){let e=t.shape,{width:i,height:r,cornerRadius:s,cornerType:n,depth:a,extrudeBevelSize:o,extrudeBevelSegments:l}=t.parameters,u={x:.5*i,y:.5*r},h={x:-u.x,y:-u.y},d={x:u.x,y:u.y};function c(_,x,S){return x>i&&S>r?Math.min(_*i/x,_*r/S):x>i?_*i/x:S>r?_*r/S:_}let p=[];p[0]=s[0]===0?0:c(s[0],s[0]+s[3],s[0]+s[1]),p[1]=s[1]===0?0:c(s[1],s[1]+s[2],s[1]+s[0]),p[2]=s[2]===0?0:c(s[2],s[2]+s[1],s[2]+s[3]),p[3]=s[3]===0?0:c(s[3],s[3]+s[0],s[3]+s[2]);let m=h.x,f=d.x,g=d.y,y=h.y;e.addPoint(e.createPoint(m,g)),e.addPoint(e.createPoint(f,g)),e.addPoint(e.createPoint(f,y)),e.addPoint(e.createPoint(m,y)),e.isClosed=!0;let v=!0;for(let _=0,x=e.points.length;_<x;_++)e.points[_].roundness=p[_],_>0&&p[_]!==p[_-1]&&(v=!1);v&&(e.roundness=p[0]),e.useCubicForRoundedCorners=n!==1,e.update();let b=bm.create({shape:e,parameters:{depth:a,extrudeBevelSize:o,extrudeBevelSegments:l}});return Object.assign(b,{userData:{...t,type:"RectangleGeometry"}})}}}),EY=W(()=>{yt(),gft=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180},t.parameters);return i.thetaLength=Yt.clamp(i.thetaLength,0,180),{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let e,{width:i=100,height:r=i,depth:s=i,widthSegments:n=64,heightSegments:a=64,phiStart:o,phiLength:l,thetaStart:u,thetaLength:h}=t.parameters;return h===0?(e=new ye,e.setAttribute("position",new me([],3))):e=new Tc(.5*i,n,a,o,l,u,h*Yt.DEG2RAD),e.scale(1,r/i,s/i),Object.assign(e,{userData:{...t,type:"SphereGeometry"}})}}}),PY=W(()=>{yt(),yft=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,widthSegments:8,heightSegments:8},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:0})}}static build(t){let{width:e=100,height:i=e,widthSegments:r=8,heightSegments:s=8}=t.parameters,n=new Ac(e,i,r,s);return n.scale(1,1,1),Object.assign(n,{userData:{...t,type:"PlaneGeometry"}})}}}),RY=W(()=>{yt(),vft=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,angle:90,cornerRadius:24,cornerSegments:8},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let{width:e,height:i,depth:r,angle:s,cornerRadius:n,cornerSegments:a}=t.parameters,o=new AY(e,i,r,s,n,a);return Object.assign(o,{userData:{...t,type:"BackdropGeometry"}})}},AY=class extends ye{constructor(t=1,e=1,i=1,r=90,s=10,n=24){super(),this.type="BackdropGeometry";let a=[],o=[],l=[],u=.001;s==0&&(n=1),n=Math.max(1,Math.floor(n)),s=Math.min(s,100),r=Math.min(180-u,r),r*=Math.PI/180;let h=[],d=Math.PI/2,c=(ht=0,q=0,nt=0)=>new P(ht,q,nt),p=c(),m=c(),[f,g,y]=[e/2,t/2,i/2],v=-g,b=+g,[_,x,S]=[c(v,-f,+y),c(v,-f,-y),c(v,+f,-y)],w=(ht,q=!1)=>Math.sin(ht-Math.PI/(+q+1)),M=(ht,q=!1)=>Math.cos(ht-Math.PI/(+q+1));S.y=Math.sin(r)*e-f;let T=Math.cos(r)*e-y,A=_.z-u;r<=d?(S.z=Math.min(T,A),S.z==A&&(S.y-=(T-A)/Math.tan(d-r))):x.z=Math.min(x.z-T-y,_.z-u),p.subVectors(_,x),m.subVectors(S,x);let C=Math.min(p.length(),m.length())*s/100,R=C*Math.tan(r/2),O=C/Math.cos(r/2),D=p.clone().normalize().add(m.normalize()).setLength(O).add(x);p.set(0,w(r,!0),M(r,!0)),h.push([S,p.clone()]);let B=(Math.PI-r)/n;for(let ht=0;ht<=n;ht++){let q=d+r+ht*B;p.set(0,Math.sin(q)*R,Math.cos(q)*R),p.add(D),m.set(0,w(q),M(q)),h.push([p.clone(),m.clone()])}h.push([_,c(0,1,0)]);let k=Math.sin(B/2)*R*2,j=h.length-1,z=h[0][0].distanceTo(h[1][0]),V=z+k*n+h[j-1][0].distanceTo(h[j][0]);h[0].push(1);for(let ht=0;ht<=n;ht++)h[ht+1].push(1-(z+ht*k)/V);h[j].push(0);let H,U,et,[at,Q,ut]=h[0];for(let ht=1;ht<h.length;ht++)[H,U,et]=h[ht],a.push(v,at.y,at.z,v,H.y,H.z,b,at.y,at.z,b,at.y,at.z,v,H.y,H.z,b,H.y,H.z),o.push(0,Q.y,Q.z,0,U.y,U.z,0,Q.y,Q.z,0,Q.y,Q.z,0,U.y,U.z,0,U.y,U.z),l.push(0,ut,0,et,1,ut,1,ut,0,et,1,et),[at,Q,ut]=[H,U,et];this.setAttribute("position",new me(a,3)),this.setAttribute("normal",new me(o,3)),this.setAttribute("uv",new me(l,2))}}}),mU=W(()=>{vm(),pm(),J7=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,innerRadiusPercent:38.19,spikes:5,cornerRadius:0,angle:360,extrudeBevelSize:0,extrudeBevelSegments:1},t.parameters);return{shape:t.shape&&t.shape instanceof us?t.shape:new us,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(t){let{width:e,height:i,innerRadiusPercent:r,spikes:s,cornerRadius:n,angle:a,depth:o,extrudeBevelSize:l,extrudeBevelSegments:u}=t.parameters,h=t.shape,d=.5*e,c=.5*i,p=a*Math.PI/360/s,m=Math.PI/2*3*-1,f=d*r/100,g=c*r/100;if(s===3&&r===50){p=2*Math.PI/s;for(let v=0;v<s;v++){let b=p*v,_=0+Math.sin(b)*d,x=0+Math.cos(b)*c;h.addPoint(h.createPoint(_,x))}}else for(let v=0;v<s;v++){let b=0+Math.cos(m)*d,_=0+Math.sin(m)*c;h.addPoint(h.createPoint(b,_)),m+=p,b=0+Math.cos(m)*f,_=0+Math.sin(m)*g,h.addPoint(h.createPoint(b,_)),m+=p}h.isClosed=!0;for(let v=0,b=h.points.length;v<b;v++)h.points[v].roundness=n;h.roundness=n,h.update();let y=bm.create({shape:h,parameters:{roundness:n,depth:o,extrudeBevelSize:l,extrudeBevelSegments:u}});return Object.assign(y,{userData:{...t,type:"StarGeometry"}})}}}),NY=W(()=>{yt(),bft=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(t){let{width:e,height:i}=t.parameters,r=new Ac(e,i);return Object.assign(r,{userData:{...t,type:"TextFrameGeometry"}})}}}),DY=W(()=>{yt(),bS(),_ft=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,radialSegments:32,tubularSegments:64,arc:360,cornerRadius:30,cornerSegments:8},t.parameters),r=Math.abs(i.width),s=Math.abs(i.height??i.width);i.shapeBlendNode&&(s=r);let n=Math.round(Math.abs(i.depth??.25*i.width));return{parameters:Object.assign(i,{width:r,height:s,depth:n})}}static build(t){let{width:e,height:i,depth:r,radialSegments:s,tubularSegments:n,arc:a,cornerRadius:o,cornerSegments:l}=t.parameters,u=function(h,d,c,p,m,f,g,y,v,b,_){[d,c]=[c,d],g=d/2;let x=Yt.clamp(m/360,0,1);if(x===0){let S=new ye;return S.setAttribute("position",new me([],3)),S}return x===1&&(b=0),new J8(!0,h,d,c,p,x,f,g,0,v,b,_)}(e,i,r,.5*e,a,n,0,0,s,o,l);return u.scale(1,i/e,1),Object.assign(u,{userData:{...t,type:"TorusGeometry"}})}}}),OY=W(()=>{yt(),xft=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,tubularSegments:64,radialSegments:32,p:2,q:3},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width),tube:i.tube??.125*i.width})}}static build(t){let{width:e,tube:i,tubularSegments:r,radialSegments:s,p:n,q:a}=t.parameters,o=.5*e;o!==i&&(o-=i);let l=new ZF(o,i,r,s,n,a);return Object.assign(l,{userData:{...t,type:"TorusKnotGeometry"}})}}}),IY=W(()=>{vm(),pm(),wft=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1,isRect:!1},t.parameters);return{shape:t.shape&&t.shape instanceof us?t.shape:new us,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width*(i.isRect?1:Math.sqrt(3)/2)),depth:Math.abs(i.depth??0)})}}static build(t){let{width:e=100,height:i,cornerRadius:r,depth:s,extrudeBevelSize:n,extrudeBevelSegments:a,isRect:o}=t.parameters,l=t.shape,u=.5*e,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=bm.create({shape:l,parameters:{roundness:r,depth:s,extrudeBevelSize:n,extrudeBevelSegments:a}});return Object.assign(d,{userData:{...t,type:"TriangleGeometry"}})}}}),uMt=W(()=>{yt()}),dMt=W(()=>{yt(),new Zn,new At,new pc,new P,new P,new P,new P});function BY(){let t=new ye;return t.setAttribute("position",new Se(new Float32Array([]),3)),t.setIndex(new Se(new Uint16Array([]),1)),t}var VY,fU,Sft=W(()=>{oa(),Le(),Kv(),yt(),BS(),vm(),pm(),VY=BY().attributes,fU=class extends ye{constructor(t,e){super(),this.isTextGeometry=!0,this.charWidths=[],this.charCoords=[],this.wrappedText=[],this.isLowResolution=!1,this.vectorShapes=[],Object.assign(this.attributes,VY),this.userData={parameters:t,type:"TextGeometry"};let i=e.getFont(t.font);i?.isLoaded?(this.font=i,this.update(t,e)):this.updateFont(t.font,e).then(()=>{this.update(t,e),e?.requestRender()})}async updateFont(t,e){let i=e.getFont(t);i&&(this.font=i,await i.loadingPromise)}update(t,e){let i=this.font;if(this.userData={parameters:t,type:"TextGeometry"},!i?.isLoaded)return void console.warn("Cannot update text because its font is not loaded");let{width:r,height:s,depth:n,extrudeBevelSize:a,extrudeBevelSegments:o,text:l,textTransform:u}=t,h=Da.getDisplayedValue(l),d=function(_,x,S,w){let M=typeof _.width=="string"?Number(w.getVariable(_.width)):_.width,T=[""],A="";for(let C of S)A+=C,C===" "||C===`
343
343
  `?(T[T.length-1]+=A,A="",C===`
344
- `&&T.push("")):x.getTextWidth(T[T.length-1]+A,_)>M&&(T[T.length-1].length&&T.push(""),x.getTextWidth(T[T.length-1]+A,_)>M&&(A.length===1?(T[T.length-1]+=A,A=""):(T[T.length-1]+=A.slice(0,-1),A=A[A.length-1],T.push(""))));return T[T.length-1]+=A,T}(t,i,u===2?h.toUpperCase():u===3?h.toLowerCase():h,e),{shapes:c,charWidths:p,charCoords:m}=i.generateShapes(d,t,e),f=.5*(typeof r=="number"?r:Number(e.getVariable(r))),g=.5*(typeof s=="number"?s:Number(e.getVariable(s))),y=c.map(_=>new us().fromShape(_,!0));this.vectorShapes=y;let v=y.map(_=>bm.create({shape:_,parameters:{depth:n,extrudeBevelSegments:o,extrudeBevelSize:a,windingRule:n<=0?yr.NONZERO:yr.ODD,subdivisions:this.isLowResolution&&n>0?1:12}})),b=v.length?wg(v):BY();b.translate(-f,g,0),this.dispose(),this.wrappedText=d,this.charCoords=m,this.charWidths=p,this.deleteAttribute("extrudeNormal"),Object.entries(b.attributes).forEach(([_,x])=>{this.setAttribute(_,x)}),this.setIndex(b.index),this.computeBoundingSphere()}clone(){let t=Xa(new ye,fU.prototype);return t.copy(this),console.log("CloneGeometry",this,t),t}copy(t){return Object.entries(t.attributes).forEach(([e,i])=>{this.setAttribute(e,i)}),this.setIndex(t.index),this.userData={parameters:{...t.userData.parameters},type:"TextGeometry"},this}async setText(t,e){this.font&&await this.font.loadingPromise,await this.update({...this.userData.parameters,text:{textValue:t}},e)}get text(){return this.userData.parameters.text??""}}});function cMt(t){if(!gU)return kY||(kY=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.30/build",i=import("./process.js"),[r,s]=await Promise.all([i,fetch(`${e}/process.wasm`).then(o=>o.arrayBuffer())]),n=r.default,a=await n({wasmBinary:s});Tft(a),gU=!0}())}var Tft,tG,gU,kY,v5=W(()=>{tG=new Promise(t=>{Tft=t}),gU=!1});function hO(t,e){if(Object.keys(t.morphAttributes).length>0||Object.keys(e.morphAttributes).length>0)return!1;let i=Object.keys(t.attributes),r=Object.keys(e.attributes);if(i.length!==r.length)return!1;for(let o of r){let l=t.attributes[o],u=e.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 s=t.index,n=e.index;if(s===null!=(n===null))return!1;let a=!1;if(s!==null&&n!==null){if(s.array.length!==n.array.length)return!1;let o=s.array.constructor,l=n.array.constructor;if(o!==l){if(o!==Uint32Array||l!==Uint16Array)return!1;a=!0}}if(t.groups.length!==e.groups.length)return!1;for(let o=0;o<e.groups.length;o++){let l=t.groups[o],u=e.groups[o];if(l.start!==u.start||l.count!==u.count||l.materialIndex!==u.materialIndex)return!1}for(let o of r){let l=t.attributes[o],u=e.attributes[o];l.array.set(u.array),l.needsUpdate=!0}if(s!==null&&n!==null){if(a){let o=s.array,l=n.array;for(let u=0,h=l.length;u<h;u++){let d=l[u];o[u]=d===65535?4294967295:d}}else s.array.set(n.array);s.needsUpdate=!0}return t.drawRange.start=e.drawRange.start,t.drawRange.count=e.drawRange.count,t.userData=e.userData,t.boundingBox=null,t.boundingSphere=null,!0}function yU(t,e,i,r){let s,n,a,o=t.position.array,l=t.normal.array,u=Mft.makeScale(e,i,r).invert().elements;for(let h=0,d=o.length;h<d;h+=3)o[h]*=e,o[h+1]*=i,o[h+2]*=r,s=l[h],n=l[h+1],a=l[h+2],l[h]=u[0]*s+u[4]*n+u[8]*a,l[h+1]=u[1]*s+u[5]*n+u[9]*a,l[h+2]=u[2]*s+u[6]*n+u[10]*a;t.position.needsUpdate=!0,t.normal.needsUpdate=!0}var Mft,Aft=W(()=>{yt(),Mft=new At});function Cft(t){let e=Object.keys(t);return e.length===1&&e[0]==="subdivisions"}function eG(t,e){let i=e?e.count:t.count,r=0,s=1e4,n=new Map,a=new Uint32Array(i),o=[];for(let h=0;h<i;h++){let d=e?e.getX(h):h,c=t.getX(d),p=t.getY(d),m=t.getZ(d),f=Math.round(c*s),g=Math.round(p*s),y=Math.round(m*s),v=n.get(f);v===void 0&&(v=new Map,n.set(f,v));let b=v.get(g);b===void 0&&(b=new Map,v.set(g,b));let _=b.get(y);_===void 0&&(_=r++,b.set(y,_),o.push(c,p,m)),a[h]=_}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(e?e.getX(h):h,e?e.getX(h+1):h+1,e?e.getX(h+2):h+2));return{positions:o,triIndices:l,triOriginals:u}}var i_,tf,Ie,uO,dO,cO,hs,r_,wM,SM,TM,vU,vP,Zv=W(()=>{yt(),v5(),Le(),b5(),Aft(),bS(),i_=new dr,tf=new P,tG.then(t=>{Ie=t}),uO=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),dO=new Uint32Array([0,1,2,3]),cO=new Uint8Array([4]),hs=class extends ye{constructor(t,e){super(),this.data=t,this.flatShading=e,this.subdivPointer=0,this.rebuild(),this.freeSubdivPointer()}mutateDirectlyScaleBaked(t,e){this.freeSubdivPointer();let i=this.data.scaleBaked.map(a=>typeof a=="number"?a:1),r=am.div(e.map(a=>typeof a=="number"?a:0),i);if(r.every(a=>a===1))return;this.subdividedGeometry&&yU(this.subdividedGeometry.attributes,...r),this.originalGeometry&&yU(this.originalGeometry.attributes,...r),this.data=t;let s=this.userData.parameters;this.userData.parameters={width:s.width*r[0],height:s.height*r[1],depth:s.depth*r[2]},this.originalGeometry.boundingSphere.center.multiply(tf.fromArray(r));let n=tf.set(s.width,s.height,s.depth).length();this.originalGeometry.boundingSphere.radius=n/2}ensureSubdivPointer(){return this.subdivPointer===0&&this.rebuild(),this.subdivPointer}mutateDirectlySubdivisions(t){this.freeSubdivPointer(),this.data=t;let e=t.phongAngle??35;this.flatShading&&(e=-1);let i=null;if(t.subdivisions>0){let s=0;try{s=hs.allocate(t),i=hs.buildRefined(s,t.subdivisions,e)}catch(n){console.error(n,t)}finally{s&&hs.freeSubdivPointer(s)}}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 t,e,i;try{({originalGeometry:t,subdividedGeometry:e,subdivPointer:i}=hs.build(this.data,void 0,!this.flatShading,void 0))}catch{t=new Kh(100,100,100),i=0}this.subdivPointer=i,this.originalGeometry=t,this.subdividedGeometry=e??void 0;let r=this.subdividedGeometry??this.originalGeometry;Object.assign(this,r),this.calcBoundingBox()}freeSubdivPointer(){this.subdivPointer&&(hs.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0)}dispose(){super.dispose(),this.freeSubdivPointer()}calcBoundingBox(){let t=this.originalGeometry;t.boundingSphere===null&&(t.boundingSphere=new Zn,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=t.boundingSphere));let e=t.attributes.position,i=t.boundingSphere.center;i_.setFromBufferAttribute(e),i_.getCenter(i),t.boundingSphere.radius=i.distanceTo(i_.max),isNaN(t.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),i_.getSize(tf);let r={width:tf.x,height:tf.y,depth:tf.z};return this.userData.parameters=r,r}static build(t,e,i,r){let s,n,a=t?.phongAngle??35;i===!1&&(a=-1),e&&(Ie.free_bvh(e),Ie.free_subdivision_surface(e));try{s=hs.allocate(t,r)}catch(l){console.error(l,t),s=hs.allocate({positionWASM:uO,indexWASM:dO,verticesPerFaceWASM:cO},r)}Ie.set_destination_refinement_level(s,0);let o=hs.buildLevel(s,!0,a);return n=t.subdivisions>0?hs.buildRefined(s,t.subdivisions,a):null,{subdivPointer:s,originalGeometry:o,subdividedGeometry:n}}static buildRefined(t,e,i){try{return Ie.set_destination_refinement_level(t,e),hs.buildLevel(t,!1,i)??null}catch{try{return Ie.set_destination_refinement_level(t,e-1),hs.buildLevel(t,!1,i)??null}catch{return null}}}static primitiveToQuads(t,e,i){t.widthSegments>16&&(t.widthSegments=16),t.heightSegments>16&&(t.heightSegments=16),t.depthSegments>16&&(t.depthSegments=16),t.radialSegments>16&&(t.radialSegments=16),t.type==="DodecahedronGeometry"&&(t.detail=0);let r,s=t.shape!==void 0||t.path!==void 0?e.geometry:Jp(t,i,!1,e);r=Cmt(t)?s.getClosedTorusIndicesForBooleanOrSubdiv():s.getIndex();let n,{positions:a,triIndices:o,triOriginals:l}=eG(s.getAttribute("position"),r);if(t.type==="CylinderGeometry"&&t.cornerRadius===0&&t.hollow===0&&t.openEnded===!1){let c=t.radialSegments*t.heightSegments*3*2;n=[c,c+3*t.radialSegments]}let{indices:u,verticesPerFace:h,uvs:d}=function(c,p,m,f,g){let y=[],v=[],b=g?m.getAttribute("uv"):void 0,_=b&&b.itemSize===2?[]:void 0,x=M=>{if(_){let T=g[M];_.push(b.getX(T),b.getY(T))}};if(m.userData.shape!==void 0&&m.userData.parameters.depth===0&&m.userData.shape.shapeHoles.length===0){let M=m.userData.shape.extractShapePointsToFlatArray([]),T=m.userData.parameters.spikes;if(m.userData.type==="EllipseGeometry"&&T<=24&&T%4==0&&m.userData.parameters.angle>=360){let R=M.length/2/T;M=M.filter((O,D)=>Math.floor(D/2)%R===0)}let A=0;for(let R=0;R<M.length;R+=2)A+=(M[R]-M[(R===0?M.length:R)-2])*(M[R+1]+M[(R===0?M.length:R)-1]);c.length=0;let C=0;if(A<0)for(let R=0;R<M.length;R+=2)c.push(M[R],M[R+1],0),y.push(C++);else for(let R=M.length-2;R>=0;R-=2)c.push(M[R],M[R+1],0),y.push(C++);return v.push(C),{indices:y,verticesPerFace:v}}let S=new Float32Array([m.userData.parameters.depth])[0],w=0;for(;w<p.length;){if(m.useNgonForTopBottomFaceDuringBake){let M=0;if((c[3*p[w]+2]===S||c[3*p[w]+2]===0)&&M++,(c[3*p[w+1]+2]===S||c[3*p[w+1]+2]===0)&&M++,(c[3*p[w+2]+2]===S||c[3*p[w+2]+2]===0)&&M++,M===3)break}if(p[w+1]===p[w+3]&&p[w+2]===p[w+5]||p[w+0]===p[w+3]&&p[w+2]===p[w+4]){r_.set(c[3*p[w]],c[3*p[w]+1],c[3*p[w]+2]),wM.set(c[3*p[w+1]],c[3*p[w+1]+1],c[3*p[w+1]+2]),SM.set(c[3*p[w+4]],c[3*p[w+4]+1],c[3*p[w+4]+2]),TM.set(c[3*p[w+5]],c[3*p[w+5]+1],c[3*p[w+5]+2]),wM.sub(r_).normalize(),SM.sub(r_).normalize(),TM.sub(r_).normalize();let M=wM.cross(SM).dot(TM),T=w;Math.abs(M)>.005||f&&f.some((A,C)=>C%2!=1&&T>=f[C]&&T<f[C+1])?(y.push(p[w],p[w+1],p[w+2]),x(w),x(w+1),x(w+2),v.push(3),w+=3):(y.push(p[w],p[w+1],p[w+4],p[w+5]),x(w),x(w+1),x(w+4),x(w+5),v.push(4),w+=6)}else y.push(p[w],p[w+1],p[w+2]),x(w),x(w+1),x(w+2),v.push(3),w+=3}if(m.useNgonForTopBottomFaceDuringBake){let M=[],T=[],A=0;for(let C=0,R=0;C<c.length;C+=3,R++)c[C+2]===0&&(M.push(R),A++),c[C+2]===S&&T.push(R);if(m.userData.parameters.extrudeBevelSize===0){let C=T[0];T[0]=T[1],T[1]=C}M.reverse(),y.push(...M,...T),v.push(A,A),_=void 0}return{indices:y,verticesPerFace:v,uvs:_}}(a,o,s,n,l);return{positions:a,indices:u,verticesPerFace:h,uvs:d}}static allocate(t,e){let i,r,s,n=[],a=[];t.positionWASM&&t.positionWASM.length>0?(i=t.positionWASM,r=t.indexWASM,s=t.verticesPerFaceWASM,Ie.alloc_subdivision_surface_uvs&&t.uvWASM&&t.uvWASM.length===2*r.length&&(a=t.uvWASM)):(i=uO,r=dO,s=cO);let o,l=i.length,u=r.length,h=s.length,d=i.length+n.length+a.length,c=r.length+s.length,p=d*Float32Array.BYTES_PER_ELEMENT+c*Uint32Array.BYTES_PER_ELEMENT,m=d*Float32Array.BYTES_PER_ELEMENT,f=Ie._malloc(p),g=new Float32Array(Ie.HEAPF32.buffer,f,d),y=new Uint32Array(Ie.HEAPU32.buffer,f+m,c);g.set(i,0),g.set(n,i.length),g.set(a,i.length+n.length),y.set(r,0),y.set(s,r.length),t?.scaleBaked?.some(_=>_!==1)&&(o=new At().makeScale(...t.scaleBaked.map(_=>typeof _=="number"?_:1))),e&&(o?o.premultiply(e):o=e);let v=f+(i.length+n.length)*Float32Array.BYTES_PER_ELEMENT,b=a.length?o?Ie.alloc_subdivision_surface_uvs2(f,l,f+m,u,f+m+r.length*Uint32Array.BYTES_PER_ELEMENT,h,v,a.length,o.elements):Ie.alloc_subdivision_surface_uvs(f,l,f+m,u,f+m+r.length*Uint32Array.BYTES_PER_ELEMENT,h,v,a.length):o?Ie.alloc_subdivision_surface2(f,l,f+m,u,f+m+r.length*Uint32Array.BYTES_PER_ELEMENT,h,o.elements):Ie.alloc_subdivision_surface(f,l,f+m,u,f+m+r.length*Uint32Array.BYTES_PER_ELEMENT,h);return Ie._free(f),b}static buildLevel(t,e,i,r,s,n=!1){let a=s?Ie.get_mesh_data2(t,e?Ie.Level.CONTROL:Ie.Level.REFINED,i,s.elements):Ie.get_mesh_data(t,e?Ie.Level.CONTROL:Ie.Level.REFINED,i),o=Ie.HEAPU32.subarray(a>>2,10+(a>>2)),l=o.subarray(4,8),u=0,h=Ie.HEAPU32[o[u]>>2],d=Ie.HEAPF32.subarray(h>>2,(h>>2)+l[u]);u++;let c=Ie.HEAPU32[o[u]>>2],p=Ie.HEAPF32.subarray(c>>2,(c>>2)+l[u]);u++;let m=Ie.HEAPU32[o[u]>>2],f=Ie.HEAPU32.subarray(m>>2,(m>>2)+l[u]);u++;let g,y=Ie.HEAPU32[o[u]>>2],v=Ie.HEAPU32.subarray(y>>2,(y>>2)+l[u]);if(u++,Ie.alloc_subdivision_surface_uvs){let _=o[9];if(_>0){let x=Ie.HEAPU32[o[8]>>2];g=Ie.HEAPF32.subarray(x>>2,(x>>2)+_)}}if(r===void 0){let _=new ye;if(_.setIndex(new sm(v,1)),_.setAttribute("position",new me(d,3)),_.setAttribute("normal",new me(p,3)),g&&_.setAttribute("uv",new me(g,2)),e){_.setAttribute("faceMap",new sm(f,1));let x=new Float32Array(p.length/3*4).fill(0);_.setAttribute("color",new Se(x,4))}return Ie.free_mesh_data(a),_.userData.type="SubdivGeometry",_}if(r.getAttribute("position").copyArray(d),r.getAttribute("normal").copyArray(p),r.attributes.position.needsUpdate=!0,r.attributes.normal.needsUpdate=!0,n){let _=r.getIndex();_!==null&&_.array.length===v.length&&(_.copyArray(v),_.needsUpdate=!0)}let b=r.getAttribute("uv");g&&b&&b.array.length===g.length&&(b.copyArray(g),b.needsUpdate=!0),Ie.free_mesh_data(a)}static freeSubdivPointer(t){Ie.free_bvh(t),Ie.free_subdivision_surface(t)}static buildControlCageWireframe(t,e,i){let r=Ie.get_wireframe_data_for_base_level(t),s=Ie.HEAPU32.subarray(r>>2,4+(r>>2)),n=s.subarray(2,4),a=0,o=Ie.HEAPU32[s[a]>>2],l=Ie.HEAPF32.subarray(o>>2,(o>>2)+n[a]);a++;let u=Ie.HEAPU32[s[a]>>2],h=Ie.HEAPU32.subarray(u>>2,(u>>2)+n[a]);if(e===void 0){let d=new ye;d.setAttribute("position",new me(l,3));let c=new Float32Array(l.length);for(let p=0,m=l.length;p<m;)c[p++]=i.r,c[p++]=i.g,c[p++]=i.b;return d.setAttribute("color",new Se(c,3)),d.setIndex(new sm(h,1)),Ie.free_wireframe_data_for_base_level(r),d}e.getAttribute("position").copyArray(l),e.attributes.position.needsUpdate=!0,Ie.free_wireframe_data_for_base_level(r)}static updateCollabMesh(t,e,i){let r=e===0;r||Ie.set_destination_refinement_level(t,e);let s=i?Ie.get_topological_data2(t,r?Ie.Level.CONTROL:Ie.Level.REFINED,i.elements):Ie.get_topological_data(t,r?Ie.Level.CONTROL:Ie.Level.REFINED),n=Ie.HEAPU32.subarray(s>>2,8+(s>>2)),a=n.subarray(3,6),o=0,l=Ie.HEAPU32[n[o]>>2],u=new Float32Array(Ie.HEAPF32.subarray(l>>2,(l>>2)+a[o]));o++;let h=Ie.HEAPU32[n[o]>>2],d=new Uint32Array(Ie.HEAPU32.subarray(h>>2,(h>>2)+a[o]));o++;let c,p=Ie.HEAPU32[n[o]>>2],m=new Uint8Array(Ie.HEAPU32.subarray(p>>2,(p>>2)+a[o]));if(Ie.alloc_subdivision_surface_uvs){let f=n[7];if(f>0){let g=Ie.HEAPU32[n[6]>>2];c=new Float32Array(Ie.HEAPF32.subarray(g>>2,(g>>2)+f))}}return Ie.free_topological_data(s),{positions:u,indices:d,verticesPerFace:m,uvs:c}}},r_=new P,wM=new P,SM=new P,TM=new P}),Eft=W(()=>{nY(),aY(),s4(),oY(),o4(),bS(),wY(),SY(),TY(),pU(),CY(),l4(),EY(),PY(),RY(),mU(),NY(),DY(),OY(),IY(),pm(),Ii(),nY(),aY(),s4(),oY(),o4(),uMt(),bS(),wY(),SY(),TY(),pU(),CY(),l4(),EY(),PY(),RY(),mU(),NY(),DY(),OY(),IY(),pm(),dMt(),nft(),Sft(),Zv(),v5(),f5(),vU={ConeGeometry:Hmt,CubeGeometry:$mt,CylinderGeometry:Y7,DodecahedronGeometry:Xmt,EllipseGeometry:g5,HelixGeometry:Emt,IcosahedronGeometry:hft,LatheGeometry:uft,NonParametricGeometry:cft,PolygonGeometry:Q7,PyramidGeometry:pft,RectangleGeometry:y5,SphereGeometry:gft,PlaneGeometry:yft,BackdropGeometry:vft,StarGeometry:J7,TextFrameGeometry:bft,TorusGeometry:_ft,TorusKnotGeometry:xft,TriangleGeometry:wft,VectorGeometry:bm},vP=t=>{let e=vU[t.type]??ymt(t.type);if(e===void 0)throw new Error(`No geometry factory registered for "${t.type}" \u2014 was its feature compiled out of this runtime build?`);return e.create(t)}});function Jp(t,e,i,r){let s,n,a;t.type==="PathGeometry"?(n=JSON.parse(JSON.stringify(t)),a=[[],["extrusion"]]):(n={...t},a=[[]]);for(let u of a){let h=n;for(let d of u)h=h[d];for(s in h){let d=h[s];T$(d)&&!Pft.includes(s)&&(h[s]=e.getVariable(d,[r.uuid,"geometry",...u,s]),T$(h[s])&&(h[s]=1))}}let o,l={parameters:n,type:n.type};if(n.type==="PathGeometry")l.path=n.path;else if(n.type==="VectorGeometry"){let u=us.createFromState(n.shape,n.width,n.height);l.shape=u}else if(n.type==="NonParametricGeometry"){if(n.data.groups&&n.data.groups?.forEach(u=>u.materialIndex=Math.max(u.materialIndex??0,0)),l.geometry=new h7().parse(n),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(n.type==="SubdivGeometry"){let u=new hs(n,i);return u.data=t,u}if(n.type==="TextGeometry"||n.type==="InputGeometry"){let u=ymt(n.type);if(u)return u.create(n,e);Pn("text",`a ${n.type}`);let h=us.createFromState(gS.defaultData(),100,100);return vP({...n,shape:h,type:"VectorGeometry"})}if(n.type==="UIGeometry")return y5.create({parameters:{width:n.width,height:n.height,cornerRadius:n.cornerRadius,cornerType:n.cornerType}})}try{o=vP(l)}catch(u){console.error(u),console.error(`Error generating geometry with inputs: ${l}`);let h=us.createFromState(gS.defaultData(),100,100);l.shape=h,l.type="VectorGeometry",o=vP(l)}return o}var Pft,zY,bU,b5=W(()=>{Le(),yt(),Eft(),Ii(),l4(),vm(),Zv(),Pft=["font"]}),pMt=W(()=>{b5(),zY=class{constructor(){this.objects=new Map,this.unreachable=new Set}getCached(t){return this.objects.get(t)}get size(){return this.objects.size}get(t,e,i){let r=this.objects.get(t);return r===void 0?(r=this.createObject(t,e,i),this.objects.set(t,r)):r.isShared=!0,r}forceDelete(t){let e=this.objects.get(t);e&&(this.disposeObject(e),this.objects.delete(t))}adopt(t,e){this.objects.set(t,e)}mutateIfUnique(t,e){let i=this.objects.get(t);if(i&&i.isShared!==!0)return this.objects.delete(t),this.objects.set(e,i),i}startGc(){this.unreachable=new Set(this.objects.keys())}markAsReachable(t,e){e===this.objects.get(t)&&this.unreachable.delete(t)}endGc(){this.unreachable.forEach(t=>{this.disposeObject(this.objects.get(t)),this.objects.delete(t)}),this.unreachable.clear()}dispose(){this.objects.forEach(t=>{this.disposeObject(t)}),this.objects.clear()}},bU=class extends zY{constructor(t){super(),this.flatShading=t}disposeObject(t){t.dispose()}createObject(t,e,i){let r=Jp(t,e,this.flatShading,i);return r.computeBoundingSphere(),r}}});function h4(){return LS}function Rft(){if(LS==="webgpu"){if(xU!==void 0)return xU;wU||(wU=!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(UY===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 UY}function Nft(t,e){return Rft().createRootMaterial(t,e)}function LY(t,e,i){return Rft().createSharedMaterial(t,e,i)}function FY(t){return t.getLayersOfType===void 0&&Object.assign(t,{layers:[],getLayersOfType:()=>[],hasAO:!1,assetsLoaded:()=>!0}),t}function _U(){return Dft}var LS,xU,UY,wU,SU,Dft,Oft,_m=W(()=>{LS="webgl",wU=!1}),mMt=W(()=>{Oft={markNeedsUpdateRendererDirty:()=>{}}});function Eg(t,e){let i=0;if(!t.layers||t.layers.length===0)return!1;let r=t.layers?.find(s=>s.data.type==="light");if(r){let s=r.data,n=Number(e.getVariable(s.alphaOverride));if((typeof s.alphaOverride=="string"?n/100:s.alphaOverride)<1)return!0}for(let s of t.layers){if(s.data.type!=="displace"&&s.data.isMask)return!0;if(s.data.type!=="displace"&&"alpha"in s.data&&s.data.type!=="light"&&s.data.type!=="fresnel"&&s.data.type!=="cavity"&&s.data.type!=="dust"&&s.data.type!=="texture"&&s.data.type!=="matcap"&&s.data.type!=="rainbow"&&s.data.type!=="outline"&&s.data.type!=="pattern"){let n=s.data.visible?s.data.alpha:0;if(typeof n=="string"&&(n=Math.max(0,Math.min(1,Number(e.getVariable(n)??100)/100))),n===1&&s.data.type==="depth"||s.data.type==="gradient"){for(let a of s.data.colors)if(a[3]<1){n=a[3];break}}else if(n===1&&s.data.type==="noise"){let a=e.color(s.data.colorA).a,o=e.color(s.data.colorB).a,l=e.color(s.data.colorC).a,u=e.color(s.data.colorD).a,h=Math.min(a,Math.min(o,Math.min(l,u)));h<1&&(n=h)}i+=(1-i)*n}}return i<1}var iG=W(()=>{});function mv(t){return typeof t=="string"||typeof t=="number"&&t!==0}var Iv,Sn,FS,Ift,jY,GY,bl,Qv=W(()=>{Iv=(t,e,i)=>Math.max(0,Math.min(1,Number(e.getVariable(typeof t=="number"?100*t:t,i)??100)/100))??1,Sn=(t,e,i)=>typeof t=="number"?t:e.getVariable(t,i),FS={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"]},Ift={depth:["colors"],gradient:["colors","steps"],toon:["colors","steps"]}}),Jv=W(()=>{yt(),zS(),jY=class extends c5(hr){},GY=t=>t.type==="Mesh",bl=class extends jY{constructor(t){super(),this.object=t,this.isClone=!0,this.matrixAutoUpdate=!1,this.hasNonUniformScale=t.hasNonUniformScale}raycast(t,e){}expand(){let t=0,e=this.object.entityChildren(t);for(;e;){let i=this.children[t];i?.object!==e&&(i&&this.remove(i),i=new bl(e),this.add(i),this.children.splice(t,0,this.children.pop()),i.matrixWorldNeedsUpdate=!0,i.matrixAutoUpdate=!1,i.matrix=e.matrix,i.hiddenMatrix=e.hiddenMatrix,i.pivotMatrix=e.pivotMatrix),i.expand(),t+=1,e=this.object.entityChildren(t)}for(;this.children.length>t;)this.remove(this.children[t]);this.pivotMatrix=this.object.pivotMatrix}get visible(){let t=this.object.cloner;return(t===void 0||this.parent!==t||!t.instancingActive&&!t.insideBoolean)&&(this.playModeVisible!==void 0?this.playModeVisible:this.object.visible||this.object.dataPatched.visible&&this.object.dataPatched.cloner?.hideBase===!0)}set visible(t){}get castShadow(){return this.object.castShadow}set castShadow(t){}get receiveShadow(){return this.object.receiveShadow}set receiveShadow(t){}get isMesh(){return GY(this.object)}get isLight(){return this.object.isLight}get layers(){return this.object.layers}set layers(t){}get isCamera(){return!1}get geometry(){if(this.object.geometry)return this.object.geometry}get material(){if(this.object.material)return this.object.material}get morphTargetInfluences(){if(this.object.morphTargetInfluences)return this.object.morphTargetInfluences}set morphTargetInfluences(t){}}});function WY(){return rG}var rG,sG,nG=W(()=>{rG=null,sG=null});function TU(t){return"variable_"+t}var pO,mO,fO,qY,gO,HY,$Y,u4,aG=W(()=>{Le(),LTt(),Umt(),jmt(),Pc(),H7(),X7(),pMt(),_m(),zmt(),mMt(),iG(),Qv(),vo(),Jv(),Fi(),yt(),nG(),Ii(),pO=new At,mO=new P,fO=new Pe,qY=new P,gO=new ur,HY=class extends Bmt{constructor(t){super(),this.shared=t}create(t){return new q7(t,this.shared)}},(u4=$Y=class{constructor(t,e={},i=!0,r=!1){if(this.data=t,this.needsJitter=i,this.enableLocalStorageForPersistentVariables=r,this.geometryCache=new bU(!0),this.geometryCache2=new bU(!1),this.imageHolderCache=new HY(this),this.thisContext={scene:Oft,shared:this},this.deletedImage=new cg(L8.emptyImage,this),this.deletedVideo=new cg(FR.defaultVideo,this),this.materials={},this.images={},this.uiBuffers={},this.videos={},this.colors={},this.audios={},this.particles={},this.fonts={},this.variables={},this.userAPIs={},this.userWebhooks={},this.mouseProperty=null,this.raycastProperty=null,this.requestRender=()=>{this._requestRender&&this._requestRender()},this.transientGeometryKeys=new WeakSet,e.images)for(let[s,n]of Object.entries(e.images))this.addImage(s,n);if(e.videos)for(let[s,n]of Object.entries(e.videos))this.addVideo(s,n);if(e.audios)for(let[s,n]of Object.entries(e.audios))this.addAudio(s,n);if(e.particles)for(let[s,n]of Object.entries(e.particles))this.addParticle(s,n);this.reset(t)}get deletedMaterial(){return this._deletedMaterial??(this._deletedMaterial=LY(ds.defaultTwoLayerData("phong"),this.thisContext,"")),this._deletedMaterial}setRequestRender(t){this._requestRender=t}getImageLoadPromises(){return Object.values(this.images).map(t=>t.loadPromise)}setEntityOpContext(t){this.entityOpContext=t}reset(t,e=!1,i=!1){this.data=t,this.resetLib(t.lib);for(let{id:r,data:s}of t.variables)this.addVariableHolder(r,s),e&&this.updateVariableHolder(r,s);for(let[r,s]of Object.entries(t.userAPIs??{}))this.addUserAPI(r,s);for(let[r,s]of Object.entries(t.userWebhooks??{}))this.addUserWebhook(r,s);if(!i){for(let[r,s]of Object.entries(t.images))this.addImage(r,s);for(let[r,s]of Object.entries(t.videos))this.addVideo(r,s)}for(let[r,s]of Object.entries(t.colors))this.addColor(r,s);for(let[r,s]of Object.entries(t.lib.materials))this.addMaterial(r,s.asset);for(let[r,s]of Object.entries(t.materials))this.addMaterial(r,s);for(let[r,s]of Object.entries(t.audios))this.addAudio(r,s);for(let[r,s]of Object.entries(t.particles))this.addParticle(r,s);for(let[r,s]of Object.entries(t.fonts))this.addFont(r,s)}addMaterial(t,e){if(e.layers===void 0&&(e={...e,layers:ds.defaultTwoLayerData("phong").layers}),this.materials[t]){let i=this.materials[t];i.reset(e,this.thisContext),i.dispose()}else{let i=LY(e,this.thisContext,t);this.materials[t]=i}}deleteMaterial(t){this.materials[t]&&(this.materials[t].nodeMaterialDispose(),delete this.materials[t])}getMaterial(t){return this.materials[t]}getMaterialOrDeletedPlaceholder(t){return this.materials[t]??this.deletedMaterial}material(t){return typeof t=="string"?this.getMaterialOrDeletedPlaceholder(t):t==null?(console.error("material is undefined or null"),this.deletedMaterial):(t.layers===void 0&&(t={...t,layers:ds.defaultTwoLayerData("phong").layers}),Nft(t,this.thisContext))}getMaterials(){return this.materials}addImage(t,e){return this.images[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.images[t].updateSrc(e.data),!0):(this.images[t]=new cg(e,this),!1)}deleteImage(t){let e=this.images[t];e&&(e.dispose(),delete this.images[t])}getDefaultImage(){return this.images.image_0}getImage(t){return this.images[t]??this.deletedImage}image(t){return typeof t=="string"?this.getImage(t):this.imageHolderCache.load(t)}addUIBuffer(t,e){return this.uiBuffers[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.uiBuffers[t].updateSrc(e),!0):(this.uiBuffers[t]=new cg(e,this),!1)}uiBuffer(t){return this.uiBuffers[t]}addVideo(t,e){return this.videos[t]?(this.videos[t].updateSrc(e.data),!0):(this.videos[t]=new cg(e,this),!1)}deleteVideo(t){let e=this.videos[t];e&&(e.dispose(),delete this.videos[t])}getVideo(t){return this.videos[t]??this.deletedVideo}video(t){return typeof t=="string"?this.getVideo(t):this.imageHolderCache.load(t)}addColor(t,e){return this.colors[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),"a"in e?this.colors[t].setRGBA(e.r,e.g,e.b,e.a):this.colors[t].setRGBA(e.r,e.g,e.b,1),!0):(this.colors[t]=new iU(e.r,e.g,e.b,"a"in e?e.a:1),!1)}updateColor(t,e){if(this.colors[t]){this.onColorOrImageUpdate&&this.onColorOrImageUpdate();let i=this.colors[t];return this.colors[t].r=e.r??i.r,this.colors[t].g=e.g??i.g,this.colors[t].b=e.b??i.b,this.colors[t].a=e.a??i.a,!0}return!1}deleteColor(t){this.colors[t]&&delete this.colors[t]}getColor(t){return this.colors[t]}getColorNames(){return Object.values(this.data.colors).map(t=>t.name)}getColorByName(t){for(let e in this.data.colors)if(this.data.colors[e].name===t)return{color:this.colors[e],id:e}}color(t){let e;if(typeof t!="string")return new Dr(t.r,t.g,t.b,"a"in t?t.a:1);{let i=this.getColor(t);i?e=i:(console.warn("Tried to create color layer params with a color key that does not exist in the assets manager"),e=new Dr(0,0,0,0))}return e}addAudio(t,e){this.audios[t]=e}getAudio(t){let e=this.audios[t];if(e instanceof X1)return e;{let i=new X1({src:e.data});return this.audios[t]=i,i}}addParticle(t,e){this.particles[t]=e}getParticle(t){return this.particles[t]}deleteParticle(t){this.particles[t]&&delete this.particles[t]}deleteAudio(t){let e=this.audios[t];e&&(e instanceof X1&&e.dispose(),delete this.audios[t])}addFont(t,e){let i=$7;i!==null?(this.fonts[t]=new i(e),this.fonts[t].loadingPromise.then(()=>this.requestRender())):Pn("text","a font asset")}getFont(t){return this.fonts[t]}deleteFont(t){this.fonts[t]&&delete this.fonts[t]}dispose(){Object.keys(this.materials).forEach(t=>this.deleteMaterial(t)),this._requestRender=void 0,Object.values(this.audios).forEach(t=>{t instanceof X1&&t.dispose()}),this.audios={},this.particles={},this.geometryCache.dispose(),this.geometryCache2.dispose()}addVariableHolder(t,e){if(this.variables[t]===void 0){let i=e.value;if(this.enableLocalStorageForPersistentVariables&&e.persistent){let r=localStorage.getItem(TU(t));i=r!==null?JSON.parse(r):e.value}return this.variables[t]={value:i,locations:[],persistent:e.persistent},"dynamicVariableType"in e&&(this.variables[t].dynamicVariablePlayState="Playing",this.variables[t].dynamicVariableToggleIsForward=void 0),!0}return this.variables[t].value=e.value,!1}resetDynamicVariablePlayState(){for(let t in this.variables)this.variables[t].dynamicVariablePlayState!==void 0&&(this.variables[t].dynamicVariablePlayState="Playing",this.variables[t].dynamicVariableToggleIsForward=void 0)}updateVariableHolder(t,e){this.updateVariable(t,e.value)}updateVariable(t,e){if(this.variables[t]===void 0)return!1;this.variables[t].value=e,this.enableLocalStorageForPersistentVariables&&this.variables[t].persistent&&localStorage.setItem(TU(t),JSON.stringify(e));let i=e;for(;typeof i=="string";)i=this.variables[i].value;let r=this.entityOpContext.scene,s=!1;for(let n=this.variables[t].locations.length-1;n>=0;n--){let a=this.variables[t].locations[n];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[t].locations.splice(n,1);continue}if(s=!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*Yt.DEG2RAD:o[a[a.length-1]]=i}if(o=r.find(a[0]),o.type==="ParticleEmitter"&&o.updateVariableState(i,a),Ai.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 s&&r.markShadowsDirty(),this.requestRender(),!0}updateEntityGeometryParams(t,e){let i=t;if(i.component&&(i=i.component),typeof i.chooseGeoemtryCache!="function")return!1;let r=i.dataPatched,s=r?.geometry;if(!s||typeof s.type!="string"||s.type==="VectorGeometry"||s.type==="PathGeometry")return!1;let n=u=>u.toLowerCase().replace(/[\s_.-]+/g,""),a=new Map;for(let u of Object.keys(s))a.set(n(u),u);let o={};for(let[u,h]of Object.entries(e??{})){let d=a.get(n(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=s[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={...s,...o};return i.dataPatched={...r,geometry:l},this.transientGeometryKeys.has(s)&&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(t){let e=t;if(e.component&&(e=e.component),typeof e.chooseGeoemtryCache!="function")return!1;let i=e.dataPatched?.geometry;return!(!i||!this.transientGeometryKeys.has(i)||(e.dataPatched=e.data,e.chooseGeoemtryCache(this).forceDelete(i),e.createGeometryDelayed(this.entityOpContext),e.onVariableUpdate(!0),e.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),0))}updateEntityGeometryVertices(t,e){let i=t;if(i.component&&(i=i.component),typeof i.chooseGeoemtryCache!="function")return!1;let r=i.dataPatched,s=r?.geometry;if(!s||s.type!=="NonParametricGeometry")return!1;let n=e?.vertices;if(n===void 0||typeof n.length!="number"||n.length<9||n.length%3!=0||n.length/3>$Y.MAX_TRANSIENT_VERTICES)return!1;let a,o,l,u=n instanceof Float32Array?n:Float32Array.from(n),h=u.length/3;if(e.normals!==void 0){if(e.normals.length!==u.length)return!1;a=e.normals instanceof Float32Array?e.normals:Float32Array.from(e.normals)}if(e.uvs!==void 0){if(e.uvs.length!==2*h)return!1;o=e.uvs instanceof Float32Array?e.uvs:Float32Array.from(e.uvs)}if(e.indices!==void 0){let x=h>65535?Uint32Array.from(e.indices):Uint16Array.from(e.indices);if(x.length===0||x.length%3!=0)return!1;for(let S=0;S<x.length;S++)if(x[S]>=h)return!1;l={array:x,itemSize:1,type:x.constructor.name,normalized:!1}}else{let x=s.data,S=x?.index;if(S?.array?.length){if(h<(x?.attributes?.position?.array?.length??0)/3){let w=S.array;for(let M=0;M<w.length;M++)if(w[M]>=h)return!1}l=S}}let d=1/0,c=1/0,p=1/0,m=-1/0,f=-1/0,g=-1/0;for(let x=0;x<u.length;x+=3){let S=u[x],w=u[x+1],M=u[x+2];S<d&&(d=S),S>m&&(m=S),w<c&&(c=w),w>f&&(f=w),M<p&&(p=M),M>g&&(g=M)}let y=(x,S)=>({array:x,itemSize:S,type:"Float32Array",normalized:!1}),v={position:y(u,3)};a&&(v.normal=y(a,3)),o&&(v.uv=y(o,2));let b={...s,width:m-d,height:f-c,depth:g-p,data:{attributes:v,...l?{index:l}:{}}},_=this.transientGeometryKeys.has(s);return i.dataPatched={...r,geometry:b},this.transientGeometryKeys.add(b),i.applyTransientGeometryData(this.entityOpContext,_),i.onVariableUpdate(!0),i.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}setEntityInstanceTransforms(t,e){let i=t;i.component&&(i=i.component);let r=i.cloner;if(r===void 0)return-1;let s=r.children,n=Math.PI/180,a=!1;if(e===null)for(let o of s)o.transformOverride!==void 0&&(o.transformOverride=void 0,a=!0);else{if(!Array.isArray(e))return s.length;{let o=Math.min(e.length,s.length);for(let l=0;l<o;l++){let u=e[l],h=s[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*n),typeof u.rotation.y=="number"&&(d.rotation[1]=u.rotation.y*n),typeof u.rotation.z=="number"&&(d.rotation[2]=u.rotation.z*n)),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(),s.length}spawnRuntimeClone(t,e={}){if(typeof t.entityChildren!="function")return;let i=t.parent;if(i===null)return;let r=new bl(t);r.playModeVisible=e.visible!==!1,r.expand(),typeof e.name=="string"&&(r.name=e.name);let s=Math.PI/180;return r.position.copy(t.position),r.rotation.copy(t.rotation),r.scale.copy(t.scale),r.hiddenMatrix.copy(t.hiddenMatrix),e.position&&(typeof e.position.x=="number"&&(r.position.x=e.position.x),typeof e.position.y=="number"&&(r.position.y=e.position.y),typeof e.position.z=="number"&&(r.position.z=e.position.z)),e.rotation&&(typeof e.rotation.x=="number"&&(r.rotation.x=e.rotation.x*s),typeof e.rotation.y=="number"&&(r.rotation.y=e.rotation.y*s),typeof e.rotation.z=="number"&&(r.rotation.z=e.rotation.z*s)),e.scale&&(typeof e.scale.x=="number"&&(r.scale.x=e.scale.x),typeof e.scale.y=="number"&&(r.scale.y=e.scale.y),typeof e.scale.z=="number"&&(r.scale.z=e.scale.z)),r.updateMatrix(),i.add(r),r.updateWorldMatrix(!0,!0),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),r}destroyRuntimeClone(t){t.removeFromParent(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender()}updateEntityMaterialParams(t,e){let i=t.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 s={scene:this.entityOpContext.scene,shared:this},n=u=>u.toLowerCase().replace(/[\s_.-]+/g,""),a=u=>{if(typeof u=="string"){let h=new Dr(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 iU?u.setValue(h,new Dr(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(e.color!==void 0){let c=a(e.color),p=h.find(f=>f.data.type==="color"),m=p&&d(p.id);if(c&&m&&o(m,"color",c)&&(l=!0,c.a!==void 0)){let f=c.a<1||Eg(u.data,this);u.setTransparent?u.setTransparent(f,s.scene):u.transparent=f}}typeof e.alpha=="number"&&isFinite(e.alpha)&&(u.onVariableUpdate?.(["alphaOverride"],Math.max(0,Math.min(e.alpha,100)),s),l=!0);for(let c of e.layers??[]){if(!c||typeof c!="object")continue;let p=typeof c.id=="string"?h.find(y=>y.id===c.id):typeof c.index=="number"?h[c.index]:typeof c.type=="string"?h.find(y=>y.data.type===c.type):void 0,m=p&&d(p.id);if(!p||!m)continue;let f=FS[p.data.type]??[],g=Object.keys(p.data);for(let[y,v]of Object.entries(c)){if(y==="id"||y==="index"||y==="type")continue;let b=g.find(x=>x===y)??g.find(x=>n(x)===n(y))??y;if(f.includes(b))continue;let _=a(v);if(_&&o(m,b,_))l=!0;else if(typeof v=="number"&&isFinite(v))u.onVariableUpdate?.(["layer",p.id,b],v,s),l=!0;else if(Array.isArray(v)&&v.length<=3&&v.every(x=>typeof x=="number"&&isFinite(x))){let x=["x","y","z"];v.forEach((S,w)=>{u.onVariableUpdate?.(["layer",p.id,b,x[w]],S,s)}),l=!0}}}}return l&&this.requestRender(),l}deleteVariable(t){this.variables[t]&&delete this.variables[t]}getVariable(t,e){if(Array.isArray(t)){if(t[0]==="mouse")return this.mouseProperty?.[t[1]]??0;if(t[0]==="raycast")return this.raycastProperty?.[t[1]]??0;let i=this.entityOpContext.scene.find(t[0]);if(t[1]==="width"||t[1]==="height"||t[1]==="depth")return i.geometry.userData.parameters[t[1]];if((t[1]==="position"||t[1]==="rotation")&&t.length>2&&i?.getPhysicsLocalMatrix?.(pO))return pO.decompose(mO,fO,qY),t[1]==="position"?mO[t[2]]:(gO.setFromQuaternion(fO,i.rotation.order),gO[t[2]]*Yt.RAD2DEG);for(let r=1;r<t.length;r++)i=i[t[r]];return t[1]==="rotation"&&(i*=Yt.RAD2DEG),i}for(let i in this.variables){if(e===void 0)break;let r=this.variables[i],s=r.locations?.findIndex(n=>En.equal(n,e));s!==void 0&&s!==-1&&r.locations.splice(s,1)}if(typeof t=="string"){let i=t,r=t;do{if(r=i,this.variables[i]===void 0)break;let s=this.variables[i].value;e&&this.variables[r]!==void 0&&this.variables[r].locations.push(e),i=s}while(typeof i=="string");return i}return t}getVariables(){return this.variables}getVariablesNames(){return this.data.variables.map(t=>t.data.name)}getVariableByName(t){for(let e of this.data.variables)if(e.data.name===t)return{variable:e.data,id:e.id}}getDynamicVariablePlayState(t){return this.variables[t]?.dynamicVariablePlayState}setDynamicVariablePlayState(t,e){this.variables[t]!==void 0&&(this.variables[t].dynamicVariablePlayState=e)}getDynamicVariableToggleIsForward(t){return this.variables[t]?.dynamicVariableToggleIsForward}setDynamicVariableToggleIsForward(t,e){this.variables[t]!==void 0&&(this.variables[t].dynamicVariableToggleIsForward=e)}resetLib(t){for(let[e,i]of Object.entries(t.images))this.addImage(e,i.asset);for(let[e,i]of Object.entries(t.audios))this.addAudio(e,i.asset);for(let[e,i]of Object.entries(t.particles))this.addParticle(e,i.asset);for(let[e,i]of Object.entries(t.colors))this.addColor(e,i.asset);for(let[e,i]of Object.entries(t.fonts))this.addFont(e,i.asset);for(let[e,i]of Object.entries(t.videos))this.addVideo(e,i.asset);for(let[e,i]of Object.entries(t.variables))this.addVariableHolder(e,i.asset)}updateLibByOp(t,e){t.path[0]==="images"?t.path.length===1&&t.type===1?this.addImage(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteImage(t.id):t.path[0]==="videos"?t.path.length===1&&t.type===1?this.addVideo(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteVideo(t.id):t.path[0]==="audios"?t.path.length===1&&t.type===1?this.addAudio(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteAudio(t.id):t.path[0]==="particles"?t.path.length===1&&t.type===1?this.addParticle(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteParticle(t.id):t.path[0]==="colors"?t.path.length===1&&t.type===1?this.addColor(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteColor(t.id):t.path[0]==="materials"?t.path.length===1&&t.type===1?this.addMaterial(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteMaterial(t.id):t.path[0]==="fonts"?t.path.length===1&&t.type===1?this.addFont(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteFont(t.id):t.path[0]==="variables"?t.path.length===1&&t.type===1?this.addVariableHolder(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteVariable(t.id):t.path[0]==="components"&&e.updateByLibOp(t,this)}updateByOp(t,e,i){if(this.data=e,t.path[0]==="images")t.path.length===2&&t.type===0?t.props.data&&this.getImage(t.path[1]).updateSrc(t.props.data):t.path.length===1&&t.type===1?this.addImage(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteImage(t.id);else if(t.path[0]==="videos")t.path.length===2&&t.type===0?t.props.data&&this.getVideo(t.path[1]).updateSrc(t.props.data):t.path.length===1&&t.type===1?this.addVideo(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteVideo(t.id);else if(t.path[0]==="audios")t.path.length===2&&t.type===0?t.props.data&&this.addAudio(t.path[1],e.audios[t.path[1]]):t.path.length===1&&t.type===1?this.addAudio(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteAudio(t.id);else if(t.path[0]==="particles")t.path.length===2&&t.type===0?t.props.data&&this.addParticle(t.path[1],e.particles[t.path[1]]):t.path.length===1&&t.type===1?this.addParticle(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteParticle(t.id);else if(t.path[0]==="colors")t.path.length===2&&t.type===0?this.updateColor(t.path[1],t.props):t.path.length===1&&t.type===1?this.addColor(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteColor(t.id);else if(t.path[0]==="materials")t.path.length===1&&t.type===1?this.addMaterial(t.id,t.data):t.path.length===1&&t.type===2?this.deleteMaterial(t.id):t.path.length>1&&this.getMaterial(t.path[1]).updateByOp(Qn.drop(t,2),e.materials[t.path[1]],{shared:this,scene:i});else if(t.path[0]==="fonts")t.path.length===2&&t.type===0?this.updateFont(t.path[1],t,i):t.path.length===1&&t.type===1?this.addFont(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteFont(t.id);else if(t.path[0]==="variables")t.path.length===2&&t.type===0?"value"in t.props?this.updateVariable(t.path[1],t.props.value):"persistent"in t.props&&(this.variables[t.path[1]].persistent=t.props.persistent):t.path.length===1&&t.type===4?this.addVariableHolder(t.id,t.data):t.path.length===1&&t.type===5&&this.deleteVariable(t.id);else if(t.path[0]==="userAPIs"){if(t.path.length===1&&t.type===1)this.addUserAPI(t.id,t.data);else if(t.path.length===1&&t.type===2)this.deleteUserAPI(t.id);else if(typeof t.path[1]=="string"){let r=e.userAPIs[t.path[1]];if(r){let s=t.type===0&&t.props.debounce===void 0,n=this.getUserAPI(t.path[1]);n!==void 0&&n===this.openAIRealtime?n.update(r):n?.update(r,this,s)}}}else if(t.path[0]==="userWebhooks"){if(t.path.length===1&&t.type===1)this.addUserWebhook(t.id,t.data);else if(t.path.length===1&&t.type===2)this.deleteUserWebhook(t.id);else if(typeof t.path[1]=="string"){let r=e.userWebhooks[t.path[1]];r&&this.getUserWebhook(t.path[1])?.update(r)}}else t.path[0]==="lib"&&this.updateLibByOp(Qn.drop(t,1),i)}updateFont(t,e,i){if(e.props.url){let r=this.getFont(t),s={...this.data.fonts[t],url:e.props.url};r.update(s),r.loadingPromise.then(()=>this.requestRender()),i.updateFont(t,this)}}addUserAPI(t,e){if(this.userAPIs[t])return this.userAPIs[t].update(e,this),!0;if(this.openAIRealtime?.id===t)return this.openAIRealtime.update(e),!0;if(e.integration?.type==="VoiceAssistant"){let i=sG;return i===null?(Pn("ai-assistant","a voice-assistant integration"),!1):(this.openAIRealtime=i(e,t,this),!1)}{let i=WY();return i===null?(Pn("api-services","a user API integration"),!1):(this.userAPIs[t]=i.createUserAPI(t,e,this),!1)}}getUserAPI(t){return this.openAIRealtime?.id===t?this.openAIRealtime:this.userAPIs[t]}getUserAPIs(){return this.userAPIs}deleteUserAPI(t){let e=this.userAPIs[t];e&&(e.dispose(),delete this.userAPIs[t])}addUserWebhook(t,e){if(this.userWebhooks[t])return this.userWebhooks[t].update(e),!0;{let i=WY();return i===null?(Pn("api-services","a user webhook"),!1):(this.userWebhooks[t]=i.createUserWebhook(t,e),!1)}}getUserWebhook(t){return this.userWebhooks[t]}getUserWebhooks(){return this.userWebhooks}deleteUserWebhook(t){let e=this.userWebhooks[t];e&&(e.dispose(),delete this.userWebhooks[t])}get scene(){return this.entityOpContext.scene}}).MAX_TRANSIENT_VERTICES=6e4,new u4(Kl.emptyData())});function Bft(t){return i4(t)||t?.isTSLNodeMaterial===!0}var yo,yO,vO,bO,XY,_O,Fr,Vft=W(()=>{W7()}),n0=W(()=>{Le(),la(),_m(),Vft(),Fi(),oa(),yo=class extends Is{setMaterialOverride(t,e){this.materialOverride=FY(t),this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.materialOverride,this.layers.set(0),this.syncShapeBlendNodeLayer(),e.scene.markNeedsUpdateRendererDirty())}updateByPatchedOp(t,e,i){if(super.updateByPatchedOp(t,e,i),tr(t.path,["geometry"])&&this.syncShadowCatcher(i),function(r,s){let n=[];if(s.length!==r.length)return null;{let a=0;for(;a<r.length;){if(s[a]==="*")n.push(r[a]);else if(r[a]!==s[a])return null;a+=1}}return n}(t.path,["materials"])!==null&&t.type===0&&Array.isArray(this.material))for(let[r,s]of Object.entries(t.props)){let n=this.material[Number(r)],a=i.shared.material(s);a!==n&&yo.disposeOneMaterial(n),this.material[Number(r)]=a}else if(tr(t.path,["material"])){let r=this.material;!Array.isArray(r)&&typeof r?.updateByOp=="function"&&"material"in e&&typeof e.material!="string"&&r.updateByOp(Qn.drop(t,1),e.material,i)}else if(tr(t.path,["materials","*"])&&Array.isArray(this.material)){let r=t.path[1];if("materials"in e&&r<this.material.length){let s=e.materials[r];typeof s!="string"&&this.material[r].updateByOp(Qn.drop(t,2),s,i)}}}get needsAO(){return this.material!==void 0&&(Array.isArray(this.material)?this.material[0]:this.material).hasAO}syncShapeBlendNodeLayer(){this.dataPatched.type==="Mesh"&&this.dataPatched.geometry.shapeBlendNode?this.layers.set(9):512&this.layers.mask&&this.layers.set(0)}updateState(t,e){super.updateState(t,e),t.castShadow!==void 0&&(this.castShadow=t.castShadow),t.receiveShadow!==void 0&&(this.receiveShadow=t.receiveShadow);let i,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 s=this.materialOverride!==void 0;!s&&t.geometry?.type!=="NonParametricGeometry"&&"material"in t&&t.material!==void 0&&(this.disposeMaterial(),this.material=e.shared.material(t.material).getFlavor(r.flatShading,r.side,r.wireframe,i),e.scene.markNeedsUpdateRendererDirty()),!s&&(t.geometry?.type==="NonParametricGeometry"||"materials"in t)&&("materials"in t&&t.materials!==void 0?(this.disposeMaterial(),this.material=t.materials.map(a=>e.shared.material(a).getFlavor(r.flatShading,r.side,r.wireframe)),e.scene.markNeedsUpdateRendererDirty()):"material"in t&&t.material!==void 0&&(this.disposeMaterial(),this.material=[e.shared.material(t.material).getFlavor(r.flatShading,r.side,r.wireframe)],e.scene.markNeedsUpdateRendererDirty()));let n=this.data;if(!s&&n.geometry?.type!=="NonParametricGeometry"&&"materials"in n&&n.materials!==void 0&&(this.disposeMaterial(),this.material=e.shared.material(n.materials[0]).getFlavor(r.flatShading,r.side,r.wireframe)),!s&&(t.flatShading!==void 0||t.wireframe!==void 0||t.side!==void 0))if(Array.isArray(this.material))for(let a=0;a<this.material.length;a++)this.material[a]=this.material[a].getFlavor(r.flatShading,r.side,r.wireframe);else this.material=this.material.getFlavor(r.flatShading,r.side,r.wireframe,i);this.syncShadowCatcher(e)}shadowCatcherActive(){let t=this.dataPatched,e=t.geometry?.type;return t.shadowCatcher===!0&&(e==="RectangleGeometry"||e==="PlaneGeometry")}syncShadowCatcher(t){let e=this.dataPatched;if(this.shadowCatcherActive()){if(this.shadowCatcherMaterial===void 0){let i=function(){let r=LS==="webgpu"&&SU!==void 0?SU:void 0;return r===void 0?null:FY(r())}();if(i===null)return;this.shadowCatcherMaterial=i}this.shadowCatcherMaterial.side=e.side,this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.shadowCatcherMaterial,t.scene.markNeedsUpdateRendererDirty()),this.castShadow=!1,this.receiveShadow=!0,this.layers.set(0)}else this.shadowCatcherMaterial!==void 0&&this.material===this.shadowCatcherMaterial&&(this.materialOverride!==void 0?(this.material=this.materialOverride,t.scene.markNeedsUpdateRendererDirty()):"material"in e&&e.material!==void 0&&(this.material=t.shared.material(e.material).getFlavor(e.flatShading,e.side,e.wireframe),t.scene.markNeedsUpdateRendererDirty(),this.needsAO&&this.layers.enable(5)),this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow)}static disposeOneMaterial(t){var e;Bft(t)&&!function(i){return i?.isClassicSharedMaterial===!0}(e=t)&&e?.isTSLSharedMaterial!==!0&&t.nodeMaterialDispose()}disposeMaterial(){this.material&&_pt(this.material).forEach(t=>{yo.disposeOneMaterial(t)})}dispose(){this.disposeMaterial(),this.shadowCatcherMaterial?.dispose(),super.dispose()}}}),bo=W(()=>{Le(),Fi(),aG(),n0(),yt(),b5(),Zv(),Aft(),yO=new P,vO=new Ae,bO=new Ae,XY=new P,_O=new At,Fr=class extends yo{constructor(t,e,i){super(t,e),this.data=e,this.isSkinnedMesh=!1,this.localGeometry=void 0,e.bindMode&&e.bindMatrix&&(this.bindMode=e.bindMode,this.bindMatrix=new At().fromArray(e.bindMatrix),this.bindMatrixInverse=new At)}chooseGeoemtryCache(t){return t.geometryCache}supportsInPlaceGeometryUpdate(t){return t.isTextGeometry!==!0}markGeometryAsReachable(t){this.geometryCreateDeleyed instanceof ye&&this.chooseGeoemtryCache(t).markAsReachable(this.dataPatched.geometry,this.geometryCreateDeleyed)}get builtSharedGeometry(){if(this.localGeometry===void 0)return this.geometryCreateDeleyed instanceof ye?this.geometryCreateDeleyed:void 0}get geometry(){if(this.localGeometry!==void 0)return this.localGeometry;if(this.geometryCreateDeleyed instanceof u4){let t=this.geometryCreateDeleyed,e=this.chooseGeoemtryCache(t),i=this.dataPatched.geometry;this.geometryCreateDeleyed=e.get(i,t,this),this._geometryCacheKey=i}return this.geometryCreateDeleyed}set geometry(t){this.localGeometry=t}get is2DAndNoDepth(){let t=this.dataPatched.geometry;return GR.is2DParametricMesh(t.type)&&t.depth===0}get is2DType(){return GR.is2DParametricMesh(this.geometry.userData.type)}get isNonParametric(){return this.geometry.userData.type==="NonParametricGeometry"}updateByPatchedOp(t,e,i){super.updateByPatchedOp(t,e,i),tr(t.path,["geometry"])&&this.updateByPatchedOpGeometry(Qn.drop(t,1),e.geometry,i)}removeInteractionGeometry(t){this.localGeometry?.dispose(),this.localGeometry=void 0}get appliedGeometrySize(){let t=this.localGeometry?.userData;if(t!==void 0&&t.sxPrev!==void 0)return[t.sxPrev,t.syPrev,t.szPrev]}updateGeometryInteractions(t,e){this.invalidateDownstreamBooleanData();let i=this.data.geometry.type;if(i==="NonParametricGeometry"||i==="SubdivGeometry"){let r,s,n,a=t;if(this.localGeometry===void 0){let d={...this.data.geometry,...a};this.localGeometry=Jp(d,e,this.data.flatShading,this)}a.scaleBaked?[r,s,n]=a.scaleBaked:{width:r,height:s,depth:n}=a;let o=this.localGeometry.userData,l=typeof r=="number"?r:1,u=typeof s=="number"?s:1,h=typeof n=="number"?n:1;o.sxPrev!==void 0&&yU(this.localGeometry.attributes,l/o.sxPrev,u/o.syPrev,h/o.szPrev),o.sxPrev=l,o.syPrev=u,o.szPrev=h}else{let r=Jp({...this.data.geometry,...t},e,this.data.flatShading,this);this.localGeometry!==void 0&&this.supportsInPlaceGeometryUpdate(this.localGeometry)&&hO(this.localGeometry,r)?r.dispose():(this.localGeometry?.dispose(),this.localGeometry=r)}}refreshAttachedClonersInteractions(t){for(let e of this.attachedSurfaceCloners)e.update(t)}refreshAttachedCloners(t){for(let e of this.attachedSurfaceCloners)t.scene.addPendingUpdateCloner(e.object)}refreshAttachedPaths(t){for(let e of this.attachedPaths)t.scene.addPendingCommand(()=>e.updateShape())}createGeometryDelayed(t){this.geometryCreateDeleyed=t.shared,this.refreshAttachedCloners(t),this.refreshAttachedPaths(t)}updateByPatchedOpGeometry(t,e,i){let r=!1;if(t.type===0&&t.path.length===0&&Object.keys(t.props).includes("scaleBaked")&&this.geometryCreateDeleyed instanceof hs&&this.chooseGeoemtryCache(i.shared).mutateIfUnique(this.geometryCreateDeleyed.data,e)===this.geometryCreateDeleyed&&(r=!0,this.geometryCreateDeleyed.mutateDirectlyScaleBaked(e,t.props.scaleBaked),this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)),!r&&t.type===0&&t.path.length===0&&Cft(t.props)&&this.geometryCreateDeleyed instanceof hs&&this.chooseGeoemtryCache(i.shared).mutateIfUnique(this.geometryCreateDeleyed.data,e)===this.geometryCreateDeleyed&&(r=!0,this.geometryCreateDeleyed.mutateDirectlySubdivisions(e),this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)),!r&&t.type===0&&t.path.length===0&&this.geometryCreateDeleyed instanceof ye&&!(this.geometryCreateDeleyed instanceof hs)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let s=i.shared,n=this.chooseGeoemtryCache(s),a=this.geometryCreateDeleyed;if(n.getCached(this._geometryCacheKey)===a&&a.isShared!==!0){let o=this.dataPatched.geometry,l=Jp(o,s,this.data.flatShading,this);hO(a,l)?(l.dispose(),a.computeBoundingSphere(),n.mutateIfUnique(this._geometryCacheKey,o)):(l.computeBoundingSphere(),n.forceDelete(this._geometryCacheKey),n.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(t,e){this.createGeometryDelayed(e)}applyTransientGeometryData(t,e){let i=t.shared,r=this.dataPatched.geometry;if(this.geometryCreateDeleyed instanceof ye&&!(this.geometryCreateDeleyed instanceof hs)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let s=this.chooseGeoemtryCache(i),n=this.geometryCreateDeleyed;if(s.getCached(this._geometryCacheKey)===n&&n.isShared!==!0){let a=Jp(r,i,this.data.flatShading,this);return hO(n,a)?(a.dispose(),n.computeBoundingSphere(),s.mutateIfUnique(this._geometryCacheKey,r)):(a.computeBoundingSphere(),s.forceDelete(this._geometryCacheKey),s.adopt(r,a),this.geometryCreateDeleyed=a),this._geometryCacheKey=r,this.refreshAttachedCloners(t),void this.refreshAttachedPaths(t)}}e&&this._geometryCacheKey!==void 0&&this.chooseGeoemtryCache(i).forceDelete(this._geometryCacheKey),t.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(t)}updateState(t,e){t.geometry!==void 0&&this.updateGeometryOnStateUpdate(t.geometry,e);let i=t.morphTargetInfluences;if(i){this.updateMorphTargets(),this.geometry.morphTargetsRelative=!0;for(let{data:{name:r,value:s}}of i)this.updateMorphInfluences(r,e.shared.getVariable(s,[this.uuid,"morphTargetInfluences",r]))}super.updateState(t,e)}updateMorphInfluences(t,e){if(this.morphTargetDictionary===void 0)return;let i=this.morphTargetDictionary[t];i!==void 0&&(this.morphTargetInfluences[i]=e)}updateGeometryGroupsIfNeeded(){Array.isArray(this.material)&&this.geometry.groups.length===0&&this.geometry.addGroup(0,Math.max(this.geometry.getIndex()?.count??0,this.geometry.getAttribute("position").count),0)}updateEntityBoxSize(t,e){let i=this.geometry.userData.parameters;this.is2DType?t.set(0,0,.5*i.depth):this.isNonParametric?(t.setScalar(0),this.geometry.boundingSphere&&t.copy(this.geometry.boundingSphere.center),e.set(i.width,i.height,i.depth??0).multiplyScalar(.5)):i.centerOffset?t.fromArray(i.centerOffset):t.setScalar(0),e.set(i.width,i.height,i.depth??0).multiplyScalar(.5)}updateMatrixWorld(t){super.updateMatrixWorld(t),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"&&this.bindMatrixInverse.copy(this.bindMatrix).invert()}bind(t,e){this.skeleton=t,this.isSkinnedMesh=!0,e===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(t){let e=new Ae,i=this.geometry.attributes.skinWeight;for(let r=0,s=i.count;r<s;r++){e.fromBufferAttribute(i,r);let n=1/e.manhattanLength();n!==1/0?e.multiplyScalar(n):e.set(1,0,0,0),i.setXYZW(r,e.x,e.y,e.z,e.w)}}boneTransform(t,e){let i=this.skeleton;if(i===void 0)return;let r=this.geometry;vO.fromBufferAttribute(r.attributes.skinIndex,t),bO.fromBufferAttribute(r.attributes.skinWeight,t),yO.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let s=0;s<4;s++){let n=bO.getComponent(s);if(n!==0){let a=vO.getComponent(s);_O.multiplyMatrices(i.bones[a].matrixWorld,i.boneInverses[a]),e.addScaledVector(XY.copy(yO).applyMatrix4(_O),n)}}return e.applyMatrix4(this.bindMatrixInverse)}}});function fv(t){if(Array.isArray(t.material)){for(let e of t.material)if(e.getLayersOfType("outline").length===0)return}else if(!i4(t.material)||t.material.getLayersOfType("outline").length===0)return;t instanceof Fr&&t.is2DAndNoDepth?function(e){if(e.geometry.attributes.extrudeNormals||!e.geometry.attributes.position)return;let i=e.geometry.attributes.position.array,r=new Float32Array(i.length),s=new P;for(let n=0;n<i.length;n+=3)s.set(i[n],i[n+1],i[n+2]).normalize(),r[n]=s.x,r[n+1]=s.y,r[n+2]=s.z;e.geometry.setAttribute("extrudeNormal",new me(r,3))}(t):function(e){if(e.geometry.attributes.extrudeNormal||!e.geometry.attributes.position||!e.geometry.attributes.normal)return;let i=new Map,r=e.geometry.attributes,s=r.position.array,n=r.normal.array,a=new Float32Array(s.length);for(let o=0;o<s.length;o+=3){let l=`${s[o]}_${s[o+1]}_${s[o+2]}`,u=new P(n[o],n[o+1],n[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<s.length;o+=3){let l=`${s[o]}_${s[o+1]}_${s[o+2]}`,u=i.get(l)?.result;u&&(a[o]=u.x,a[o+1]=u.y,a[o+2]=u.z)}e.geometry.setAttribute("extrudeNormal",new me(a,3))}(t)}function xO(t){return Math.min(2047,Math.max(1,Math.round(2048*t)))/2048}function gv(t){if(!t.geometry.attributes.position)return;let e=t.geometry.attributes,i=e.position.array,r=e.randomColor;if(r!==void 0&&3*r.count===i.length)return;let s=new Float32Array(i.length),n=parseInt(t.uuid.replace(/\D/g,"")),a=[xO(Yt.seededRandom(n)),xO(Yt.seededRandom(n+1e4)),xO(Yt.seededRandom(n+2e4))];for(let o=0;o<i.length;o++)s[o]=a[o%3];t.geometry.setAttribute("randomColor",new Se(s,3))}var _5=W(()=>{yt(),W7(),bo()});function YY(t){let e=!1;return t.scene.objects.traverse((i,r)=>{r.geometry?.type==="BooleanGeometry"&&(e=!0)}),e}function fMt(t,e){let i=t.cloner;return i!==void 0&&i.parent===e?i:void 0}function KY(t,e,i,r){let s=16*(e.children.length+1);Ww.length<s&&(Ww=new Float32Array(s));let n=0,a=l=>{l.toArray(Ww,16*n),n++},o=e.parameters.hideBase!==!0;o&&a(r),MU.multiplyMatrices(t.hiddenMatrix,t.matrix);for(let l of e.children)!Sg(l)||l.playModeVisible===!1||(AU.multiplyMatrices(l.hiddenMatrix,l.matrix).multiply(l.pivotMatrix),bP.multiplyMatrices(MU,AU),(!o||!bP.equals(r))&&a(bP));try{return n===0?0:function(l,u){return j7(e4().instanced_union(U7(l),u))}(i,Ww.subarray(0,16*n))}finally{Pmt(i)}}var pd,ZY,MU,AU,bP,Ww,om,d4,x5,Wh,$u,c4,US=W(()=>{la(),yt(),f5(),_5(),n0(),ss(),pd=new At,ZY=new At,MU=new At,AU=new At,bP=new At,Ww=new Float32Array(0),om=class extends yo{constructor(t,e,i){super(t,e),this.data=e,this.meshSetAddresses=[],this.needsTransformForDownstream=!1,this.geometry=new ye,this.onAfterRender=(r,s,n,a,o,l)=>{super.onAfterRender(r,s,n,a,o,l),this.recomputeBoolean()},this.geometry.userData.parameters={width:0,height:0,depth:0}}get booleanOp(){return this.data.geometry.operation}get phongAngle(){return this.data.geometry.phongAngle??45}get isLOD(){return this.recomputeBoolean(),!1}updateByPatchedOp(t,e,i){super.updateByPatchedOp(t,e,i),t.path.length===1&&t.path[0]==="geometry"&&t.type===0&&t.props.operation!==void 0&&(this.freeBooleanPointer(),this.resetBBoxNeedsUpdate())}freeBooleanPointer(){super.freeBooleanPointer(),this.geometry.dispose()}recomputeBoolean(t,e=!0){if(this.booleanMeshSetAddress!==-1&&!t)return;for(let r=0;r<this.children.length;r++){let s=this.children[r];s instanceof om&&s.dataPatched.visible===!0&&s.recomputeBoolean(t===!0,e)}this.meshSetAddresses=[];for(let r=0;r<this.children.length;r++){let s=this.children[r];if(s instanceof Is&&s.dataPatched.visible===!0&&s.geometry.attributes.position?.count>0&&s.geometry.drawRange.count>0&&s.booleanMeshSetAddress!==0){pd.multiplyMatrices(s.hiddenMatrix,s.matrix).multiply(s.pivotMatrix);try{let n=fMt(s,this);if(s.booleanMeshSetAddress===-1){if((s.geometry.index??s.geometry.getAttribute("position")).count/3<15e5){let a=VTt(s.geometry,t===!0);s.booleanMeshSetAddress=n===void 0||a===-1?a:KY(s,n,a,pd)}if(s.booleanMeshSetAddress===-1)return;n===void 0&&QD(s.booleanMeshSetAddress,pd),s.booleanMatrixInvOld.copy(pd).invert(),s.booleanWasTransformed=!1}else s instanceof om&&s.needsTransformForDownstream===!0?(n===void 0?QD(s.booleanMeshSetAddress,pd):s.booleanMeshSetAddress=KY(s,n,s.booleanMeshSetAddress,pd),s.needsTransformForDownstream=!1):s.booleanWasTransformed===!0&&(QD(s.booleanMeshSetAddress,ZY.multiplyMatrices(pd,s.booleanMatrixInvOld)),s.booleanMatrixInvOld.copy(pd).invert(),s.booleanWasTransformed=!1)}catch(n){console.error(n),s.booleanMeshSetAddress=0,s.geometry.userData.booleanOperationDidFail=!0;continue}if(s.booleanMeshSetAddress===0)continue;this.meshSetAddresses.push(s.booleanMeshSetAddress),s.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 ye,this.geometry.userData=r.userData,this.geometry.boundingSphere=r.boundingSphere,this.geometry.setAttribute("position",new me([],3))}return void this.geometry.setDrawRange(0,0)}if(t===!0)return function(r,s){let n=e4(),a=$X(r,s),o=n.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 ye,this.geometry.userData=i.userData,this.geometry.boundingSphere=i.boundingSphere;try{this.booleanMeshSetAddress=function(r,s,n,a){let o=e4(),l=$X(r,s),u=o.mesh_render_data(l,Math.max(a,0));if(n.setAttribute("position",new me(u.positions(),3)),n.setAttribute("normal",new me(u.normals(),3)),u.free(),n.boundingSphere===null&&(n.boundingSphere=new Zn),l.tri_count()===0)n.boundingSphere.center.set(0,0,0),n.boundingSphere.radius=0,n.userData.parameters={width:0,height:0,depth:0};else{let h=l.bounds();n.boundingSphere.center.set(h[0],h[1],h[2]),n.boundingSphere.radius=(h[3]**2+h[4]**2+h[5]**2)**.5,n.userData.parameters={width:2*h[3],height:2*h[4],depth:2*h[5]}}return j7(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,fv(this),gv(this)}dispose(){super.dispose(),this.geometry.dispose()}}}),jS=W(()=>{yt(),vo(),s0(),(d4||(d4={})).is=function(t){return Ai.is(t)&&t instanceof qd},x5=(t,e)=>class extends r0(t,e){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 s=this.shadow;s.camera.far=i.depth,s.needsUpdate=!0}i.shadows!==void 0&&(this.castShadow=i.shadows)}}}),xm=W(()=>{yt(),US(),la(),s0(),Wh=t=>t instanceof Is,$u=t=>t!==null&&t instanceof om,c4=t=>Q8.is(t)});function Sa(t,e){return e.color(t)}function QY(t=new Date,e){let i=e.format,r=t.getSeconds(),s=t;e&&e.timeZone!==null&&(s=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),m=f=>Number(p.find(g=>g.type===f)?.value);return new Date(m("year"),m("month")-1,m("day"),m("hour"),m("minute"),m("second"),d.getMilliseconds())}catch{return new Date(NaN)}}(new Date,e.timeZone));let n,a=s.getHours(),o=s.getMinutes();e.format12h24h==="12ampm"&&(n=a>=12?"PM":"AM");let l,u,h=a;switch(e.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],n=void 0;break;case"mm":l=[o],n=void 0;break;case"ss":l=[r],n=void 0;break;case"year":u=s.getFullYear();break;case"month":u=s.getMonth()+1;break;case"dayOfYear":u=Math.floor((s.getTime()-new Date(s.getFullYear(),0,0).getTime())/864e5);break;case"dayOfMonth":u=s.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:n}:u}var CU,tb,oG=W(()=>{}),gMt=W(()=>{yt(),VS(),kS(),CU=class extends $v(cpt){constructor(t,e=15,i=10066329){super(t,e,i),this.object=t,this.added=!1,this.name=`DirectionalLightHelper: ${t.uuid}`}raycast(t,e){Xv(this.object,CU.geometryHelper,t,e)}}}),w5=W(()=>{yt(),gMt(),jS(),tb=class extends x5(lS,CU){constructor(t,e,i){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=2048,this.shadow.mapSize.height=2048,this.shadow.normalBias=1,this.layers.enable(3);let r=this.shadow.camera;r.top=1250,r.bottom=-1250,r.right=1250,r.left=-1250,r.near=-1e4,r.far=2500;let s=new hS(this.shadow.camera);s.visible=!1,this.gizmos.shadowmap=s}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this.gizmos){let e=this.gizmos[t];e instanceof hS&&e.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e);let i=t.depth!==void 0&&t.depth!==this.shadow.camera.far||t.size!==void 0&&t.size/2!==this.shadow.camera.right;t.size!==void 0&&function(r,s){r.shadow.camera.right=s/2,r.shadow.camera.left=-s/2,r.shadow.camera.top=s/2,r.shadow.camera.bottom=-s/2,r.shadow.needsUpdate=!0}(this,t.size),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),t.penumbraSize!==void 0&&e.scene.markPenumbraSizeDirty(),i&&this.update()}}});function lG(t){return t instanceof yo&&t.needsAO&&!cm(t)&&t.isDecalObject!==!0}function hG(t){let e=t.cloner;if(e&&Array.isArray(e.children))for(let i of e.children)i?.layers&&(i.layers.mask=t.layers.mask)}function uG(t){return t.getLayersOfType("reflection").filter(e=>e.data.visible).length}function yMt(t){let e=1/0,i=-1/0;for(let r of t.getLayersOfType("reflection")){let s=r.data;if(!s.visible||s.mirror===1)continue;let n=typeof s.blur=="number"?s.blur:null;e=Math.min(e,n??0),i=Math.max(i,n??10)}return e===1/0?null:{min:e,max:i}}function vMt(t){for(let e of t.getLayersOfType("reflection")){let i=e.data;if(!i.visible)continue;let{blur:r,thickness:s,steps:n,stepSize:a}=i;return typeof r!="number"||typeof s!="number"||typeof n!="number"||typeof a!="number"?"variable":{blur:r,thickness:s,steps:n,stepSize:a,tracingMode:i.tracingMode===1?1:0}}return null}function JY(t,e){let i={outline:!1,cavity:!1},r=t.layers.mask&S5,s=e.getLayersOfType("transmission"),n=e.getLayersOfType("outline"),a=uG(e),o=e.getLayersOfType("cavity");return(n.length>0||o.length>0)&&(t.layers.set(8),s.length>0&&t.layers.enable(3),a>0&&t.layers.enable(4),i.outline=n.length>0,i.cavity=o.length>0,gv(t),fv(t)),s.length===0&&n.length===0&&o.length===0&&a===0&&t.layers.set(0),r&&t.layers.set(9),!r&&lG(t)&&t.layers.enable(5),hG(t),i}function tK(t,e){if(!e.layers)return!1;let i=t.layers.mask&S5,r=!1,s=e.getLayersOfType("transmission").filter(l=>l.data.visible),n=e.getLayersOfType("outline").filter(l=>l.data.visible),a=uG(e),o=e.getLayersOfType("cavity").filter(l=>l.data.visible);return s.length>0&&(t.layers.set(3),(n.length>0||o.length>0)&&t.layers.enable(8),a>0&&t.layers.enable(4),r=!0),s.length===0&&n.length===0&&o.length===0&&a===0&&t.layers.set(0),i&&t.layers.set(9),!i&&lG(t)&&t.layers.enable(5),hG(t),r}function eK(t,e){var i;if(!e.layers)return!1;let r=t.layers.mask&S5,s=!1,n=uG(e),a=e.getLayersOfType("transmission").filter(u=>u.data.visible),o=e.getLayersOfType("outline").filter(u=>u.data.visible),l=e.getLayersOfType("cavity").filter(u=>u.data.visible);return n>0&&((i=t.userData).__splinePlanarMirror??(i.__splinePlanarMirror=0),t.layers.set(4),a.length>0&&t.layers.enable(3),(o.length>0||l.length>0)&&t.layers.enable(8),s=!0),n===0&&a.length===0&&o.length===0&&l.length===0&&t.layers.set(0),r&&t.layers.set(9),!r&&lG(t)&&t.layers.enable(5),hG(t),s}function EU(t,e,i,r=!1){let s=t.cloner;if(s){let n=null;if(t.raycast===Ar.prototype.raycast||t.raycast===Is.prototype.raycast){let a=t.geometry;a&&(a.boundingSphere===null&&a.computeBoundingSphere(),n=a.boundingSphere)}for(let a of s.children){if(n!==null&&(PU.copy(n).applyMatrix4(a.matrixWorld),!e.ray.intersectsSphere(PU)))continue;let o=zft.copy(a.matrixWorld).invert(),l=Lft.copy(e.ray).applyMatrix4(o),u=t.matrixWorld;l.applyMatrix4(u);let h=kft;h.set(l.origin,l.direction),h.near=e.near,h.far=e.far,h.layers.mask=e.layers.mask;let d=h.intersectObject(t,!1);d.length>0&&i.push({...d[0],object:r?a:t})}}}var S5,kft,zft,Lft,PU,MM,Fft,wO,SO,TO,eb,qs,dG=W(()=>{ss(),_5(),la(),n0(),yt(),S5=512,kft=new d7,zft=new At,Lft=new pc,PU=new Zn}),bMt=W(()=>{yt(),VS(),kS(),MM=class extends $v(upt){constructor(t,e=6710886){super(t,e),this.object=t,this.matrix=t.matrixWorld,this.name=`SpotLightHelper: ${t.uuid}`}raycast(t,e){Xv(this.object,MM.geometryHelper,t,e)}update(){if(this.object!==void 0){let t=MM._vector,e=this.object.distance?this.object.distance:1e3,i=e*Math.tan(this.object.angle);this.cone.scale.set(i,i,e),t.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(t);let r=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let s=0,n=this.cone.material.length;s<n;s++)this.cone.material[s].color.set(r);else this.cone.material.color.set(r)}}},(Fft=MM)._vector=new P}),T5=W(()=>{yt(),bMt(),jS(),wO=new P,SO=new P,TO=new Pe,eb=class extends x5(Vg,Fft){constructor(t,e,i){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let r=this.shadow.camera;r.fov=2*Yt.RAD2DEG*this.angle,r.aspect=1,r.near=100,r.far=2500;let s=new hS(this.shadow.camera);s.visible=!1,this.gizmos.shadowmap=s,this.update()}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this.gizmos){let e=this.gizmos[t];e instanceof hS&&e.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),SO.setFromMatrixPosition(this.matrixWorld),TO.setFromRotationMatrix(this.matrixWorld),wO.copy(this.up).applyQuaternion(TO).negate().multiplyScalar(this.distance),this.target.position.copy(SO).add(wO),this.target.updateMatrixWorld(),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.angle!==void 0&&(this.angle=t.angle),t.penumbra!==void 0&&(this.penumbra=t.penumbra),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.penumbraSize!==void 0&&e.scene.markPenumbraSizeDirty(),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null))}}}),Rc=W(()=>{Le(),Zh(),yt(),vo(),Pc(),oG(),V7(),w5(),Fi(),_m(),yt(),n0(),xm(),dG(),T5(),Ii(),US(),qs=class extends p5(Ku){constructor(t,e,i){if(super(),this.data=e,this.bgColor=new Dr(1,1,1,1),this.fog=null,this.backupFog=new BF(16777215,.1,2e3),this.fogUseBGColor=!1,this.fogMode="linear",this.fogDensity=Jn.getDensity({}),this.fogHeightFalloff=Jn.getHeightFalloff({}),this.fogHeightBase=Jn.getHeightBase({}),this.isActive=!1,this.skyState=null,this.skyStateVersion=0,this.gradingState=null,this.skyHdriHolder=null,this.aoColor=new oe,this.penumbraSizeArrayCache=null,this.super_Entity(t,e),this.personalCamera=new ln(i0,{...B2.defaultData,...e.camera,name:"Personal Camera"}),this.personalCamera.objectHelper.visible=!1,this.add(this.personalCamera),this.activeCamera=this.personalCamera,this.ambientLight=new Q4(13882323,8553090,.75*Math.PI),this.ambientLight.name="Default Ambient Light",this.ambientLight.layers.enable(3),this.ambientLight.removeFromParent(),this.add(this.ambientLight),e.uiScene){let r=$8();r===null?Pn("ui-2d","a page's 2D scene"):this.uiScene=new r.Scene2D((Array.isArray(t)?t[0]:t)+"-ui",e.uiScene,{dpr:window.devicePixelRatio,shared:i.shared})}else e.uiFrame&&this.createUICanvas(e.uiFrame,i)}get scene(){return this.parent}get postprocessing(){return this.data.postprocessing}get frameId(){return this.data.uiFrame}get frame(){return this.uiCanvas?.frame}createUICanvas(t,e){let i=$8();i!==null?(this.uiCanvas=new i.UICanvas(this.uuid+"-uiscreen",window.innerWidth,window.innerHeight,e),this.uiCanvas.isScreenSpace=!0,this.uiCanvas.promise.then(()=>{this.uiCanvas?.applyFrame(t),this.uiCanvas?.applySize()})):Pn("ui-2d","a page's UI canvas")}updateVisible(){}setBackgroundColor(t){this.bgColor=t,this.fogUseBGColor===!0&&(this.backupFog.color=t)}entityChildrenCount(){return this.uiScene?this.uiScene.children.length:super.entityChildrenCount()}updateAmbientLight(t,e){t.color!==void 0&&(this.ambientLight.color=Sa(t.color,e)),t.intensity!==void 0&&(this.ambientLight.intensity=t.intensity*Math.PI),t.enabled!==void 0&&(t.enabled?this.add(this.ambientLight):this.remove(this.ambientLight))}onDeactive(){this.isActive=!1}onActive(t){this.isActive=!0,t.fog=this.fog,this.traverseEntity(e=>{e instanceof om&&e.recomputeBoolean()}),this.updateShadow(this.data.shadow)}forceMaterialsUpdate(){this.traverseEntity(t=>{if(t instanceof yo)if(Array.isArray(t.material))for(let e of t.material)e.needsUpdate=!0;else t.material.needsUpdate=!0,t.material.dispose()})}updateShadow(t){if(t.softShadowQuality===void 0&&t.type===void 0||!this.isActive)return;let e=this.data.shadow;uv.isSoft(e)}updateFog(t,e){t.enabled?this.fog=this.backupFog:this.fog=null,this.isActive&&(this.scene.fog=this.fog),this.fogUseBGColor=t.useBackgroundColor,t.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=Sa(t.color,e),this.backupFog.near=t.near,this.backupFog.far=t.far,this.fogMode=Jn.getMode(t),this.fogDensity=Jn.getDensity(t),this.fogHeightFalloff=Jn.getHeightFalloff(t),this.fogHeightBase=Jn.getHeightBase(t)}updateSky(t,e){this.skyState=t??null,this.skyStateVersion++;let i=t?.hdri?.image;this.skyHdriHolder=i!=null?e.image(i):null}updateAo(t,e){t.aoColor!==void 0&&(this.aoColor=Sa(t.aoColor,e))}updateByOp(t,e,i,r){let s=this.data.uiFrame;super.updateByOp(t,e,i,r);let n=e;tr(t.path,["fog"])?this.updateFog(n.fog,i.shared):tr(t.path,["sky"])?this.updateSky(n.sky,i.shared):tr(t.path,["grading"])?this.gradingState=n.grading??null:tr(t.path,["ao"])?this.updateAo(n.ao,i.shared):tr(t.path,["ambient"])?this.updateAmbientLight(n.ambient,i.shared):tr(t.path,["shadow"])?this.updateShadow(n.shadow):t.type===0&&t.path.length===0&&(t.props.uiFrame!==void 0||s!==n.uiFrame)&&this.updateUIFrame(t.props.uiFrame,i)}updateUIFrame(t,e){t?(this.uiCanvas||this.createUICanvas(t,e),this.uiCanvas.enabled=!0,this.uiCanvas.applyFrame(t)):this.uiCanvas&&(this.uiCanvas.enabled=!1)}updateState(t,e){this.updateState_Entity(t,e),t.backgroundColor!==void 0&&this.setBackgroundColor(Sa(t.backgroundColor,e.shared)),t.fog!==void 0&&this.updateFog(t.fog,e.shared),t.sky!==void 0&&this.updateSky(t.sky,e.shared),t.grading!==void 0&&(this.gradingState=t.grading),t.ambient!==void 0&&this.updateAmbientLight(t.ambient,e.shared),t.ao!==void 0&&this.updateAo(t.ao,e.shared),t.shadow!==void 0&&this.updateShadow(t.shadow)}createFrame(t,e){}raycast(t,e){super.raycast(t,e)}switchActiveCamera(t){t&&t.isDescendantOf(this)&&(this.activeCamera!==this.personalCamera&&(this.activeCamera.objectHelper.visible=!0),this.activeCamera=t,t.objectHelper.visible=!1)}get playCamera(){return this.scene?.find(this.data.publish.playCamera)??this.personalCamera}switchToPlayCamera(){this.switchActiveCamera(this.playCamera)}get penumbraSizeArray(){return this.penumbraSizeArrayCache===null&&this.updatePenumbraSizeArray(),this.penumbraSizeArrayCache}updatePenumbraSizeArray(){this.penumbraSizeArrayCache=new Array(W8).fill(.5);let t=0,e=0;this.traverseEntity(i=>{if(!i.visible)return!0;i instanceof tb&&i.visible&&t<pP&&(this.penumbraSizeArrayCache[t]=i.data.penumbraSize??.5,t+=1),i instanceof eb&&i.visible&&t<W8-pP&&(this.penumbraSizeArrayCache[pP+e]=i.data.penumbraSize??.5,e+=1)})}raycastWithClones(t){let e=[],i=r=>{for(let s of r.children){let n=s.cloner;Ai.is(s)&&(s.visible||n?.object.data.visible)&&((Wh(s)||c4(s)&&this.scene.enableHelpers&&s.objectHelper.visible)&&(t.intersectObject(s,!1,e),EU(s,t,e,!0)),i(s))}};return i(this),e}updateEntity2DByOp(t,e,i,r){this.uiCanvas?.updateEntity2DByOp(t,e,i,r)}}});function iK(){return cG}function MO(){if(RU===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 RU}function AO(t){return t?.isWebGPUSplineRenderer===!0}var cG,RU,Uft=W(()=>{cG=null,RU=null});function NU(){return mG}var pG,mG,fG=W(()=>{pG=null,mG=null});function rK(t,e,i){return qw.setRGB(t,e,i,Ns),{r:qw.r,g:qw.g,b:qw.b}}function _Mt(t,e,i){let r,s=SS(t.angle,0),[n,a]=DU(t.offset),[o,l]=DU(t.morph),u=t.colors??[],h=t.steps??[],d=Math.min(10,u.length,h.length);if(d===0)return[1,1,1,1];if(t.gradientType===1){let g=3*(e+o)-(e+n)-1,y=3*(i+l)-(i+a)-1;r=Math.hypot(g,y)+s}else if(t.gradientType===2){let g=-1*Math.atan2(e+o-.5+n,i+l-.5+a),y=s/Math.PI/-2+.5*g/Math.PI;r=y-Math.floor(y)}else{let g=.5+o/(e!==0?e:1e-6),y=l/(i!==0?i:1e-6),v=Math.cos(s)*g-Math.sin(s)*y,b=Math.sin(s)*g+Math.cos(s)*y,_=v*v+b*b;r=_>1e-12?(((e-.5+n)/2+v/2)*v+((i-.5+a)/2+b/2)*b)/_:0}let c=u[0][0],p=u[0][1],m=u[0][2],f=u[0][3];for(let g=1;g<d;g++){let y=h[g-1],v=h[g]-y,b=v!==0?Math.min(1,Math.max(0,(r-y)/v)):r>=y?1:0;t.smooth&&(b=b*b*(3-2*b)),c+=(u[g][0]-c)*b,p+=(u[g][1]-p)*b,m+=(u[g][2]-m)*b,f+=(u[g][3]-f)*b}return[c,p,m,f]}function xMt(t,e){let i=t,r=i?.data?.layers;if(r&&typeof r.forEach=="function"){let s=e,n=[];return r.forEach(a=>{let o=a.data;if(o.visible===!1||o.isMask===!0)return;let l=SS(o.alpha,1);if(!(l<=0))if(o.type==="color"){let u,h=o.color;typeof h=="string"?u=typeof s?.color=="function"?s.color(h):void 0:h&&typeof h.r=="number"&&(u=h),u&&n.push({kind:"color",layer:o,rgb:{...rK(u.r,u.g,u.b),a:u.a??1},alpha:l})}else o.type==="gradient"&&n.push({kind:"gradient",layer:o,alpha:l})}),n.length===0?null:(a,o)=>{let l=1,u=1,h=1,d=!0;for(let c of n){let p,m,f,g;if(c.kind==="color")({r:p,g:m,b:f}=c.rgb),g=c.rgb.a;else{let[v,b,_,x]=_Mt(c.layer,a,o);({r:p,g:m,b:f}=rK(v,b,_)),g=x}let y=d?1:Math.min(1,Math.max(0,g*c.alpha));l+=(p-l)*y,u+=(m-u)*y,h+=(f-h)*y,d=!1}return{r:l,g:u,b:h}}}if(i?.color&&i.color.isColor===!0){let{r:s,g:n,b:a}=i.color;return()=>({r:s,g:n,b:a})}return null}var qw,SS,DU,wMt=W(()=>{yt(),qw=new oe,SS=(t,e)=>typeof t=="number"&&Number.isFinite(t)?t:e,DU=t=>Array.isArray(t)&&typeof t[0]=="number"&&typeof t[1]=="number"?[t[0],t[1]]:[0,0]});function SMt(t,e){if(t==="torus"){let l=e()*Math.PI*2,u=e()*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(t==="cylinder"){let l=e()*Math.PI*2,u=Math.cos(l),h=Math.sin(l);return{x:.8*u,y:1.6*(e()-.5),z:.8*h,nx:u,ny:0,nz:h,cr:1,cg:1,cb:1}}let i=e()*Math.PI*2,r=2*e()-1,s=Math.acos(r),n=Math.sin(s)*Math.cos(i),a=Math.cos(s),o=Math.sin(s)*Math.sin(i);return{x:n,y:a,z:o,nx:n,ny:a,nz:o,cr:1,cg:1,cb:1}}function TMt(t){let{geometry:e,matrix:i}=t,r=e.getAttribute("position");if(!r||r.count<3)return null;let s=e.getAttribute("normal"),n=e.getAttribute("uv"),a=e.getAttribute("color"),o=e.getIndex(),l=o?o.count/3:r.count/3;if(l<1)return null;let u=(y,v)=>o?o.getX(3*y+v):3*y+v,h=i?i.elements:null,d=i?new Ss().getNormalMatrix(i).elements:null,c=y=>{let v=r.getX(y),b=r.getY(y),_=r.getZ(y);return h?h[0]*v+h[4]*b+h[8]*_+h[12]:v},p=y=>{let v=r.getX(y),b=r.getY(y),_=r.getZ(y);return h?h[1]*v+h[5]*b+h[9]*_+h[13]:b},m=y=>{let v=r.getX(y),b=r.getY(y),_=r.getZ(y);return h?h[2]*v+h[6]*b+h[10]*_+h[14]:_},f=new Float64Array(l),g=0;for(let y=0;y<l;y++){let v=u(y,0),b=u(y,1),_=u(y,2),x=c(v),S=p(v),w=m(v),M=c(b)-x,T=p(b)-S,A=m(b)-w,C=c(_)-x,R=p(_)-S,O=m(_)-w,D=T*O-A*R,B=A*C-M*O,k=M*R-T*C;g+=.5*Math.sqrt(D*D+B*B+k*k),f[y]=g}return g<=0?null:{total:g,sample:(y,v)=>{let b=0,_=l-1;for(;b<_;){let et=b+_>>1;f[et]<y?b=et+1:_=et}let x=b,S=u(x,0),w=u(x,1),M=u(x,2),T=v(),A=v();T+A>1&&(T=1-T,A=1-A);let C,R,O,D=1-T-A,B=c(S)*D+c(w)*T+c(M)*A,k=p(S)*D+p(w)*T+p(M)*A,j=m(S)*D+m(w)*T+m(M)*A;if(s){if(C=s.getX(S)*D+s.getX(w)*T+s.getX(M)*A,R=s.getY(S)*D+s.getY(w)*T+s.getY(M)*A,O=s.getZ(S)*D+s.getZ(w)*T+s.getZ(M)*A,d){let et=d[0]*C+d[3]*R+d[6]*O,at=d[1]*C+d[4]*R+d[7]*O,Q=d[2]*C+d[5]*R+d[8]*O;C=et,R=at,O=Q}}else{let et=c(S),at=p(S),Q=m(S),ut=c(w)-et,ht=p(w)-at,q=m(w)-Q,nt=c(M)-et,Tt=p(M)-at,gt=m(M)-Q;C=ht*gt-q*Tt,R=q*nt-ut*gt,O=ut*Tt-ht*nt}let z=Math.sqrt(C*C+R*R+O*O)||1,V=1,H=1,U=1;if(a)V=a.getX(S)*D+a.getX(w)*T+a.getX(M)*A,H=a.getY(S)*D+a.getY(w)*T+a.getY(M)*A,U=a.getZ(S)*D+a.getZ(w)*T+a.getZ(M)*A;else if(t.sampleColor){let et=n?n.getX(S)*D+n.getX(w)*T+n.getX(M)*A:.5,at=n?n.getY(S)*D+n.getY(w)*T+n.getY(M)*A:.5,Q=t.sampleColor(et,at);Q&&(V=Q.r,H=Q.g,U=Q.b)}return{x:B,y:k,z:j,nx:C/z,ny:R/z,nz:O/z,cr:V,cg:H,cb:U}}}}function sK(t){let e=Math.min(Math.max(1,Math.floor(t.guideStrands)),yv),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}}(t.seed??1337),r=t.shape==="object"&&t.sampler,s=r?t.samplerRadius??kh:kh,n=new Float32Array(4*ec),a=new Float32Array(ec),o=new Float32Array(4*yv).fill(1);for(let l=0;l<e;l++){let u=r?t.sampler(i):SMt(t.shape,i),h=r?u.x:u.x*s,d=r?u.y:u.y*s,c=r?u.z:u.z*s,{nx:p,ny:m,nz:f}=u;o[4*l+0]=u.cr,o[4*l+1]=u.cg,o[4*l+2]=u.cb;let g,y,v,b=l*pg,_=(1.8+.8*i())*t.hairLength*s/(pg-1),x=.5+1.5*i(),S=(.02+.06*i())*s;Math.abs(m)<.99?(g=-f,y=0,v=p):(g=1,y=0,v=0);let w=Math.sqrt(g*g+y*y+v*v)||1;for(let M=0;M<pg;M++){let T=M/(pg-1),A=T*T*.4*s,C=S*Math.sin(T*x*Math.PI*2),R=4*(b+M);n[R+0]=h+p*_*M+C*g/w,n[R+1]=d+m*_*M-A+C*y/w,n[R+2]=c+f*_*M+C*v/w,n[R+3]=M===0?0:1,M<pg-1&&(a[b+M]=_)}}return{initialPositions:n,restLengths:a,unitScale:s,rootColors:o}}var pg,yv,ec,kh,zp,s_,F0,ef,U0,_P,jft=W(()=>{yt(),ec=(yv=16384)*(pg=32),kh=100}),Gft=W(()=>{yt(),la(),fG(),wMt(),jft(),zp=1/60,s_=new At,F0=new Pe,ef=new P,U0=new P,_P=class extends Is{constructor(t,e,i){super(t,e),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 Pe,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=e,this.geometry.setAttribute("position",new Se(new Float32Array(0),3)),this.material=new Uo({colorWrite:!1,depthWrite:!1}),this.frustumCulled=!1,this.scalpMesh=new Ar(new Tc(kh,48,32),new Uo({color:5448477})),this.scalpMesh.name="HairScalp",this.add(this.scalpMesh);let r=new AR;r.setAttribute("position",new Se(new Float32Array(12),3)),r.setIndex([0,2,1,2,3,1]),r.instanceCount=0,this.ribbonMesh=new Ar(r,new Uo({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=e.guideStrands,this.roots=this.buildRoots(),this.regenSnapshot={guideStrands:e.guideStrands,hairLength:e.hairLength,spreadRadius:e.spreadRadius,headShape:e.headShape,baseObjectId:e.baseObjectId},this.applyScalpState(),this.applyShadowState(),this.syncSimRunning()}update(t){!this.simRunning||(this.pendingSimSeconds=Math.min(this.pendingSimSeconds+t/1e3,4*zp*2),this.trackMotionRest(t/1e3))}trackMotionRest(t){this.boneTransform(F0,ef);let e=this.hasLastBone&&(Math.abs(this.lastBoneQuat.dot(F0))<.9999995||this.lastBonePos.distanceToSquared(ef)>1e-8),i=this.motionFingerprint(),r=!this.hasLastBone||e||this.resetRequested||i!==this.lastMotionFingerprint||this.data.windStrength>.001;this.lastBoneQuat.copy(F0),this.lastBonePos.copy(ef),this.lastMotionFingerprint=i,this.hasLastBone=!0,this.settledSimSeconds=r?0:this.settledSimSeconds+t}motionFingerprint(){let t=this.data;return t.gravity+2*t.damping+3*t.localStiffness+4*t.globalStiffness+5*t.globalRange+6*t.stiffnessFalloff+7*t.windStrength+8*t.vspCoefficient+9*t.kink+10*t.kinkFrequency+11*t.clumpStrength+12*t.clumpSize+13*t.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(t){this.playModeActive=t,t&&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(t,e){super.updateState(t,e),this.updateHairState(t)}updateHairState(t){if((t.guideStrands!==void 0||t.hairLength!==void 0||t.spreadRadius!==void 0||t.headShape!==void 0||t.baseObjectId!==void 0)&&this.regenerate(),(t.headShape!==void 0||t.baseObjectId!==void 0)&&this.applyScalpState(),t.headColor!==void 0){let e=this.scalpMesh.material;e.isMeshBasicMaterial===!0&&e.color.setRGB(t.headColor.r,t.headColor.g,t.headColor.b,Ns)}(t.castShadow!==void 0||t.receiveShadow!==void 0)&&this.applyShadowState(),t.autoPlay!==void 0&&this.syncSimRunning()}applyShadowState(){let t=this.data.castShadow??!0,e=this.data.receiveShadow??!0;this.castShadow=t,this.receiveShadow=e,this.scalpMesh.castShadow=t,this.scalpMesh.receiveShadow=e,this.ribbonMesh.castShadow=t,this.ribbonMesh.receiveShadow=e}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 t=this.data,e=this.regenSnapshot;if(e===null||e.guideStrands!==t.guideStrands||e.hairLength!==t.hairLength||e.spreadRadius!==t.spreadRadius||e.headShape!==t.headShape||e.baseObjectId!==t.baseObjectId){let i=e===null||e.headShape!==t.headShape||e.baseObjectId!==t.baseObjectId;this.regenerate(),i&&this.applyScalpState()}this.syncSimRunning(),this.applyShadowState(),this.checkBaseDrift()}buildRoots(){let{headShape:t,baseObjectId:e,guideStrands:i,hairLength:r}=this.data;if(this.baseFoundAtRegen=!1,this.baseSourceGeomsAtRegen=[],this.baseSourceHashesAtRegen=[],this.baseColorHashAtRegen=0,this.baseScaleAtRegen=0,t==="object"&&e){let s=this.context.scene.find(e);if(s){this.baseFoundAtRegen=!0,s.updateWorldMatrix(!0,!0);let n=this.collectBaseSources(s),a=n?function(o){let l=[];for(let d of o){let c=TMt(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,m=l.length-1;for(;p<m;){let g=p+m>>1;u[g]<c?p=g+1:m=g}let f=p===0?c:c-u[p-1];return l[p].sample(f,d)}}(n.sources):null;if(this.baseSourceGeomsAtRegen=n?.sources.map(o=>o.geometry)??[],this.baseSourceHashesAtRegen=n?.hashes??[],this.baseColorHashAtRegen=n?.colorHash??0,n&&a){let o=this.baseWorldScale(s),l=Math.max(n.radius*o,.001);this.baseScaleAtRegen=o;let u=o;return sK({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 sK({shape:t==="object"?"sphere":t,guideStrands:i,hairLength:r})}collectBaseSources(t){let e=[],i=[],r=0,s=0;s_.copy(t.matrixWorld).invert();let n=s_.clone(),a=o=>{if(o.isHairSystem===!0||o!==t&&o.visible===!1)return;let l=o.geometry;if(o.isMesh===!0&&l&&(l.getAttribute("position")?.count??0)>=3){let u=o===t?void 0:new At().multiplyMatrices(n,o.matrixWorld),h=Array.isArray(o.material)?o.material[0]:o.material;e.push({geometry:l,matrix:u,sampleColor:xMt(h,this.context.shared)??void 0}),i.push(_P.matrixHash(u)),s+=function(c,p){let m=c,f=0,g=1,y=b=>{f+=b*g,g+=1},v=m?.data?.layers;if(v&&typeof v.forEach=="function"){let b=p;v.forEach(_=>{let x=_.data;if(x.visible!==!1){if(x.type==="color"){let S=x.color,w=typeof S=="string"?typeof b?.color=="function"?b.color(S):void 0:S;w&&typeof w.r=="number"&&(y(w.r),y(w.g),y(w.b)),y(SS(x.alpha,1))}else if(x.type==="gradient"){let S=x;for(let w of S.colors??[])y(w[0]),y(w[1]),y(w[2]),y(w[3]);for(let w of S.steps??[])y(w);y(SS(S.angle,0)),y(S.gradientType),y(S.smooth?1:0)}}})}else m?.color&&m.color.isColor===!0&&(y(m.color.r),y(m.color.g),y(m.color.b));return f}(h,this.context.shared),l.boundingSphere===null&&l.computeBoundingSphere();let d=l.boundingSphere;if(d){let c=0,p=1;u?(ef.copy(d.center).applyMatrix4(u),c=ef.length(),p=_P.matrixMaxScale(u)):c=d.center.length(),r=Math.max(r,c+d.radius*p)}}for(let u of o.children)a(u)};return a(t),e.length===0?null:{sources:e,hashes:i,radius:Math.max(r,.001),colorHash:s}}static matrixHash(t){if(!t)return 0;let e=t.elements,i=0;for(let r=0;r<16;r++)i+=e[r]*(r+1);return i}static matrixMaxScale(t){let e=t.elements,i=Math.hypot(e[0],e[1],e[2]),r=Math.hypot(e[4],e[5],e[6]),s=Math.hypot(e[8],e[9],e[10]);return Math.max(i,r,s,1e-6)}baseWorldScale(t){return s_.copy(t.matrixWorld).decompose(ef,F0,U0),Math.max(Math.abs(U0.x),Math.abs(U0.y),Math.abs(U0.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 t=this.context.scene.find(this.data.baseObjectId);if(!t)return;if(!this.baseFoundAtRegen)return void this.regenerate();t.updateWorldMatrix(!0,!0);let e=this.collectBaseSources(t),i=e?.sources??[],r=e?.hashes??[],s=this.baseSourceGeomsAtRegen,n=this.baseSourceHashesAtRegen,a=i.length!==s.length;if(!a){for(let o=0;o<i.length;o++)if(i[o].geometry!==s[o]||Math.abs(r[o]-n[o])>1e-4*Math.max(Math.abs(n[o]),1)){a=!0;break}}if(!a&&this.data.hairColorSource==="object"&&(e?.colorHash??0)!==this.baseColorHashAtRegen&&(a=!0),!a&&i.length>0){let o=this.baseWorldScale(t);a=Math.abs(o-this.baseScaleAtRegen)>.001*Math.max(this.baseScaleAtRegen,1e-6)}a&&this.regenerate()}applyScalpState(){let t=this.data.headShape,e=t==="object"&&this.data.baseObjectId!==null;this.scalpMesh.visible=!e,!e&&(this.scalpMesh.geometry.dispose(),this.scalpMesh.geometry=t==="torus"?new MR(1.4*kh,.7*kh,24,48):t==="cylinder"?new P2(.8*kh,.8*kh,1.6*kh,48,1):new Tc(kh,48,32))}boneTransform(t,e){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)}s_.copy(i).decompose(e,t,U0)}raycast(t,e){if(!this.scalpMesh.visible)return;let i=[];this.scalpMesh.raycast(t,i);for(let r of i)r.object=this,e.push(r)}get shadowBoundsRadius(){let t=this.data.headShape==="torus"?2.6:1.5;return this.roots.unitScale*(t+2.6*Math.max(this.data.hairLength,0))}getShadowBoundsCenter(t){return this.boneTransform(F0,t),t}updateEntityBoxSize(t,e){let i=this.shadowBoundsRadius;t.set(0,0,0),e.set(i,i,i)}dispose(){super.dispose(),this.scalpMesh.geometry.dispose(),this.scalpMesh.material.dispose(),this.ribbonMesh.geometry.dispose(),this.ribbonMesh.material.dispose?.(),NU()?.release(this)}}});function xP(){return{shapeInput:()=>`
344
+ `&&T.push("")):x.getTextWidth(T[T.length-1]+A,_)>M&&(T[T.length-1].length&&T.push(""),x.getTextWidth(T[T.length-1]+A,_)>M&&(A.length===1?(T[T.length-1]+=A,A=""):(T[T.length-1]+=A.slice(0,-1),A=A[A.length-1],T.push(""))));return T[T.length-1]+=A,T}(t,i,u===2?h.toUpperCase():u===3?h.toLowerCase():h,e),{shapes:c,charWidths:p,charCoords:m}=i.generateShapes(d,t,e),f=.5*(typeof r=="number"?r:Number(e.getVariable(r))),g=.5*(typeof s=="number"?s:Number(e.getVariable(s))),y=c.map(_=>new us().fromShape(_,!0));this.vectorShapes=y;let v=y.map(_=>bm.create({shape:_,parameters:{depth:n,extrudeBevelSegments:o,extrudeBevelSize:a,windingRule:n<=0?yr.NONZERO:yr.ODD,subdivisions:this.isLowResolution&&n>0?1:12}})),b=v.length?wg(v):BY();b.translate(-f,g,0),this.dispose(),this.wrappedText=d,this.charCoords=m,this.charWidths=p,this.deleteAttribute("extrudeNormal"),Object.entries(b.attributes).forEach(([_,x])=>{this.setAttribute(_,x)}),this.setIndex(b.index),this.computeBoundingSphere()}clone(){let t=Xa(new ye,fU.prototype);return t.copy(this),console.log("CloneGeometry",this,t),t}copy(t){return Object.entries(t.attributes).forEach(([e,i])=>{this.setAttribute(e,i)}),this.setIndex(t.index),this.userData={parameters:{...t.userData.parameters},type:"TextGeometry"},this}async setText(t,e){this.font&&await this.font.loadingPromise,await this.update({...this.userData.parameters,text:{textValue:t}},e)}get text(){return this.userData.parameters.text??""}}});function cMt(t){if(!gU)return kY||(kY=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.32/build",i=import("./process.js"),[r,s]=await Promise.all([i,fetch(`${e}/process.wasm`).then(o=>o.arrayBuffer())]),n=r.default,a=await n({wasmBinary:s});Tft(a),gU=!0}())}var Tft,tG,gU,kY,v5=W(()=>{tG=new Promise(t=>{Tft=t}),gU=!1});function hO(t,e){if(Object.keys(t.morphAttributes).length>0||Object.keys(e.morphAttributes).length>0)return!1;let i=Object.keys(t.attributes),r=Object.keys(e.attributes);if(i.length!==r.length)return!1;for(let o of r){let l=t.attributes[o],u=e.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 s=t.index,n=e.index;if(s===null!=(n===null))return!1;let a=!1;if(s!==null&&n!==null){if(s.array.length!==n.array.length)return!1;let o=s.array.constructor,l=n.array.constructor;if(o!==l){if(o!==Uint32Array||l!==Uint16Array)return!1;a=!0}}if(t.groups.length!==e.groups.length)return!1;for(let o=0;o<e.groups.length;o++){let l=t.groups[o],u=e.groups[o];if(l.start!==u.start||l.count!==u.count||l.materialIndex!==u.materialIndex)return!1}for(let o of r){let l=t.attributes[o],u=e.attributes[o];l.array.set(u.array),l.needsUpdate=!0}if(s!==null&&n!==null){if(a){let o=s.array,l=n.array;for(let u=0,h=l.length;u<h;u++){let d=l[u];o[u]=d===65535?4294967295:d}}else s.array.set(n.array);s.needsUpdate=!0}return t.drawRange.start=e.drawRange.start,t.drawRange.count=e.drawRange.count,t.userData=e.userData,t.boundingBox=null,t.boundingSphere=null,!0}function yU(t,e,i,r){let s,n,a,o=t.position.array,l=t.normal.array,u=Mft.makeScale(e,i,r).invert().elements;for(let h=0,d=o.length;h<d;h+=3)o[h]*=e,o[h+1]*=i,o[h+2]*=r,s=l[h],n=l[h+1],a=l[h+2],l[h]=u[0]*s+u[4]*n+u[8]*a,l[h+1]=u[1]*s+u[5]*n+u[9]*a,l[h+2]=u[2]*s+u[6]*n+u[10]*a;t.position.needsUpdate=!0,t.normal.needsUpdate=!0}var Mft,Aft=W(()=>{yt(),Mft=new At});function Cft(t){let e=Object.keys(t);return e.length===1&&e[0]==="subdivisions"}function eG(t,e){let i=e?e.count:t.count,r=0,s=1e4,n=new Map,a=new Uint32Array(i),o=[];for(let h=0;h<i;h++){let d=e?e.getX(h):h,c=t.getX(d),p=t.getY(d),m=t.getZ(d),f=Math.round(c*s),g=Math.round(p*s),y=Math.round(m*s),v=n.get(f);v===void 0&&(v=new Map,n.set(f,v));let b=v.get(g);b===void 0&&(b=new Map,v.set(g,b));let _=b.get(y);_===void 0&&(_=r++,b.set(y,_),o.push(c,p,m)),a[h]=_}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(e?e.getX(h):h,e?e.getX(h+1):h+1,e?e.getX(h+2):h+2));return{positions:o,triIndices:l,triOriginals:u}}var i_,tf,Ie,uO,dO,cO,hs,r_,wM,SM,TM,vU,vP,Zv=W(()=>{yt(),v5(),Le(),b5(),Aft(),bS(),i_=new dr,tf=new P,tG.then(t=>{Ie=t}),uO=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),dO=new Uint32Array([0,1,2,3]),cO=new Uint8Array([4]),hs=class extends ye{constructor(t,e){super(),this.data=t,this.flatShading=e,this.subdivPointer=0,this.rebuild(),this.freeSubdivPointer()}mutateDirectlyScaleBaked(t,e){this.freeSubdivPointer();let i=this.data.scaleBaked.map(a=>typeof a=="number"?a:1),r=am.div(e.map(a=>typeof a=="number"?a:0),i);if(r.every(a=>a===1))return;this.subdividedGeometry&&yU(this.subdividedGeometry.attributes,...r),this.originalGeometry&&yU(this.originalGeometry.attributes,...r),this.data=t;let s=this.userData.parameters;this.userData.parameters={width:s.width*r[0],height:s.height*r[1],depth:s.depth*r[2]},this.originalGeometry.boundingSphere.center.multiply(tf.fromArray(r));let n=tf.set(s.width,s.height,s.depth).length();this.originalGeometry.boundingSphere.radius=n/2}ensureSubdivPointer(){return this.subdivPointer===0&&this.rebuild(),this.subdivPointer}mutateDirectlySubdivisions(t){this.freeSubdivPointer(),this.data=t;let e=t.phongAngle??35;this.flatShading&&(e=-1);let i=null;if(t.subdivisions>0){let s=0;try{s=hs.allocate(t),i=hs.buildRefined(s,t.subdivisions,e)}catch(n){console.error(n,t)}finally{s&&hs.freeSubdivPointer(s)}}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 t,e,i;try{({originalGeometry:t,subdividedGeometry:e,subdivPointer:i}=hs.build(this.data,void 0,!this.flatShading,void 0))}catch{t=new Kh(100,100,100),i=0}this.subdivPointer=i,this.originalGeometry=t,this.subdividedGeometry=e??void 0;let r=this.subdividedGeometry??this.originalGeometry;Object.assign(this,r),this.calcBoundingBox()}freeSubdivPointer(){this.subdivPointer&&(hs.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0)}dispose(){super.dispose(),this.freeSubdivPointer()}calcBoundingBox(){let t=this.originalGeometry;t.boundingSphere===null&&(t.boundingSphere=new Zn,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=t.boundingSphere));let e=t.attributes.position,i=t.boundingSphere.center;i_.setFromBufferAttribute(e),i_.getCenter(i),t.boundingSphere.radius=i.distanceTo(i_.max),isNaN(t.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),i_.getSize(tf);let r={width:tf.x,height:tf.y,depth:tf.z};return this.userData.parameters=r,r}static build(t,e,i,r){let s,n,a=t?.phongAngle??35;i===!1&&(a=-1),e&&(Ie.free_bvh(e),Ie.free_subdivision_surface(e));try{s=hs.allocate(t,r)}catch(l){console.error(l,t),s=hs.allocate({positionWASM:uO,indexWASM:dO,verticesPerFaceWASM:cO},r)}Ie.set_destination_refinement_level(s,0);let o=hs.buildLevel(s,!0,a);return n=t.subdivisions>0?hs.buildRefined(s,t.subdivisions,a):null,{subdivPointer:s,originalGeometry:o,subdividedGeometry:n}}static buildRefined(t,e,i){try{return Ie.set_destination_refinement_level(t,e),hs.buildLevel(t,!1,i)??null}catch{try{return Ie.set_destination_refinement_level(t,e-1),hs.buildLevel(t,!1,i)??null}catch{return null}}}static primitiveToQuads(t,e,i){t.widthSegments>16&&(t.widthSegments=16),t.heightSegments>16&&(t.heightSegments=16),t.depthSegments>16&&(t.depthSegments=16),t.radialSegments>16&&(t.radialSegments=16),t.type==="DodecahedronGeometry"&&(t.detail=0);let r,s=t.shape!==void 0||t.path!==void 0?e.geometry:Jp(t,i,!1,e);r=Cmt(t)?s.getClosedTorusIndicesForBooleanOrSubdiv():s.getIndex();let n,{positions:a,triIndices:o,triOriginals:l}=eG(s.getAttribute("position"),r);if(t.type==="CylinderGeometry"&&t.cornerRadius===0&&t.hollow===0&&t.openEnded===!1){let c=t.radialSegments*t.heightSegments*3*2;n=[c,c+3*t.radialSegments]}let{indices:u,verticesPerFace:h,uvs:d}=function(c,p,m,f,g){let y=[],v=[],b=g?m.getAttribute("uv"):void 0,_=b&&b.itemSize===2?[]:void 0,x=M=>{if(_){let T=g[M];_.push(b.getX(T),b.getY(T))}};if(m.userData.shape!==void 0&&m.userData.parameters.depth===0&&m.userData.shape.shapeHoles.length===0){let M=m.userData.shape.extractShapePointsToFlatArray([]),T=m.userData.parameters.spikes;if(m.userData.type==="EllipseGeometry"&&T<=24&&T%4==0&&m.userData.parameters.angle>=360){let R=M.length/2/T;M=M.filter((O,D)=>Math.floor(D/2)%R===0)}let A=0;for(let R=0;R<M.length;R+=2)A+=(M[R]-M[(R===0?M.length:R)-2])*(M[R+1]+M[(R===0?M.length:R)-1]);c.length=0;let C=0;if(A<0)for(let R=0;R<M.length;R+=2)c.push(M[R],M[R+1],0),y.push(C++);else for(let R=M.length-2;R>=0;R-=2)c.push(M[R],M[R+1],0),y.push(C++);return v.push(C),{indices:y,verticesPerFace:v}}let S=new Float32Array([m.userData.parameters.depth])[0],w=0;for(;w<p.length;){if(m.useNgonForTopBottomFaceDuringBake){let M=0;if((c[3*p[w]+2]===S||c[3*p[w]+2]===0)&&M++,(c[3*p[w+1]+2]===S||c[3*p[w+1]+2]===0)&&M++,(c[3*p[w+2]+2]===S||c[3*p[w+2]+2]===0)&&M++,M===3)break}if(p[w+1]===p[w+3]&&p[w+2]===p[w+5]||p[w+0]===p[w+3]&&p[w+2]===p[w+4]){r_.set(c[3*p[w]],c[3*p[w]+1],c[3*p[w]+2]),wM.set(c[3*p[w+1]],c[3*p[w+1]+1],c[3*p[w+1]+2]),SM.set(c[3*p[w+4]],c[3*p[w+4]+1],c[3*p[w+4]+2]),TM.set(c[3*p[w+5]],c[3*p[w+5]+1],c[3*p[w+5]+2]),wM.sub(r_).normalize(),SM.sub(r_).normalize(),TM.sub(r_).normalize();let M=wM.cross(SM).dot(TM),T=w;Math.abs(M)>.005||f&&f.some((A,C)=>C%2!=1&&T>=f[C]&&T<f[C+1])?(y.push(p[w],p[w+1],p[w+2]),x(w),x(w+1),x(w+2),v.push(3),w+=3):(y.push(p[w],p[w+1],p[w+4],p[w+5]),x(w),x(w+1),x(w+4),x(w+5),v.push(4),w+=6)}else y.push(p[w],p[w+1],p[w+2]),x(w),x(w+1),x(w+2),v.push(3),w+=3}if(m.useNgonForTopBottomFaceDuringBake){let M=[],T=[],A=0;for(let C=0,R=0;C<c.length;C+=3,R++)c[C+2]===0&&(M.push(R),A++),c[C+2]===S&&T.push(R);if(m.userData.parameters.extrudeBevelSize===0){let C=T[0];T[0]=T[1],T[1]=C}M.reverse(),y.push(...M,...T),v.push(A,A),_=void 0}return{indices:y,verticesPerFace:v,uvs:_}}(a,o,s,n,l);return{positions:a,indices:u,verticesPerFace:h,uvs:d}}static allocate(t,e){let i,r,s,n=[],a=[];t.positionWASM&&t.positionWASM.length>0?(i=t.positionWASM,r=t.indexWASM,s=t.verticesPerFaceWASM,Ie.alloc_subdivision_surface_uvs&&t.uvWASM&&t.uvWASM.length===2*r.length&&(a=t.uvWASM)):(i=uO,r=dO,s=cO);let o,l=i.length,u=r.length,h=s.length,d=i.length+n.length+a.length,c=r.length+s.length,p=d*Float32Array.BYTES_PER_ELEMENT+c*Uint32Array.BYTES_PER_ELEMENT,m=d*Float32Array.BYTES_PER_ELEMENT,f=Ie._malloc(p),g=new Float32Array(Ie.HEAPF32.buffer,f,d),y=new Uint32Array(Ie.HEAPU32.buffer,f+m,c);g.set(i,0),g.set(n,i.length),g.set(a,i.length+n.length),y.set(r,0),y.set(s,r.length),t?.scaleBaked?.some(_=>_!==1)&&(o=new At().makeScale(...t.scaleBaked.map(_=>typeof _=="number"?_:1))),e&&(o?o.premultiply(e):o=e);let v=f+(i.length+n.length)*Float32Array.BYTES_PER_ELEMENT,b=a.length?o?Ie.alloc_subdivision_surface_uvs2(f,l,f+m,u,f+m+r.length*Uint32Array.BYTES_PER_ELEMENT,h,v,a.length,o.elements):Ie.alloc_subdivision_surface_uvs(f,l,f+m,u,f+m+r.length*Uint32Array.BYTES_PER_ELEMENT,h,v,a.length):o?Ie.alloc_subdivision_surface2(f,l,f+m,u,f+m+r.length*Uint32Array.BYTES_PER_ELEMENT,h,o.elements):Ie.alloc_subdivision_surface(f,l,f+m,u,f+m+r.length*Uint32Array.BYTES_PER_ELEMENT,h);return Ie._free(f),b}static buildLevel(t,e,i,r,s,n=!1){let a=s?Ie.get_mesh_data2(t,e?Ie.Level.CONTROL:Ie.Level.REFINED,i,s.elements):Ie.get_mesh_data(t,e?Ie.Level.CONTROL:Ie.Level.REFINED,i),o=Ie.HEAPU32.subarray(a>>2,10+(a>>2)),l=o.subarray(4,8),u=0,h=Ie.HEAPU32[o[u]>>2],d=Ie.HEAPF32.subarray(h>>2,(h>>2)+l[u]);u++;let c=Ie.HEAPU32[o[u]>>2],p=Ie.HEAPF32.subarray(c>>2,(c>>2)+l[u]);u++;let m=Ie.HEAPU32[o[u]>>2],f=Ie.HEAPU32.subarray(m>>2,(m>>2)+l[u]);u++;let g,y=Ie.HEAPU32[o[u]>>2],v=Ie.HEAPU32.subarray(y>>2,(y>>2)+l[u]);if(u++,Ie.alloc_subdivision_surface_uvs){let _=o[9];if(_>0){let x=Ie.HEAPU32[o[8]>>2];g=Ie.HEAPF32.subarray(x>>2,(x>>2)+_)}}if(r===void 0){let _=new ye;if(_.setIndex(new sm(v,1)),_.setAttribute("position",new me(d,3)),_.setAttribute("normal",new me(p,3)),g&&_.setAttribute("uv",new me(g,2)),e){_.setAttribute("faceMap",new sm(f,1));let x=new Float32Array(p.length/3*4).fill(0);_.setAttribute("color",new Se(x,4))}return Ie.free_mesh_data(a),_.userData.type="SubdivGeometry",_}if(r.getAttribute("position").copyArray(d),r.getAttribute("normal").copyArray(p),r.attributes.position.needsUpdate=!0,r.attributes.normal.needsUpdate=!0,n){let _=r.getIndex();_!==null&&_.array.length===v.length&&(_.copyArray(v),_.needsUpdate=!0)}let b=r.getAttribute("uv");g&&b&&b.array.length===g.length&&(b.copyArray(g),b.needsUpdate=!0),Ie.free_mesh_data(a)}static freeSubdivPointer(t){Ie.free_bvh(t),Ie.free_subdivision_surface(t)}static buildControlCageWireframe(t,e,i){let r=Ie.get_wireframe_data_for_base_level(t),s=Ie.HEAPU32.subarray(r>>2,4+(r>>2)),n=s.subarray(2,4),a=0,o=Ie.HEAPU32[s[a]>>2],l=Ie.HEAPF32.subarray(o>>2,(o>>2)+n[a]);a++;let u=Ie.HEAPU32[s[a]>>2],h=Ie.HEAPU32.subarray(u>>2,(u>>2)+n[a]);if(e===void 0){let d=new ye;d.setAttribute("position",new me(l,3));let c=new Float32Array(l.length);for(let p=0,m=l.length;p<m;)c[p++]=i.r,c[p++]=i.g,c[p++]=i.b;return d.setAttribute("color",new Se(c,3)),d.setIndex(new sm(h,1)),Ie.free_wireframe_data_for_base_level(r),d}e.getAttribute("position").copyArray(l),e.attributes.position.needsUpdate=!0,Ie.free_wireframe_data_for_base_level(r)}static updateCollabMesh(t,e,i){let r=e===0;r||Ie.set_destination_refinement_level(t,e);let s=i?Ie.get_topological_data2(t,r?Ie.Level.CONTROL:Ie.Level.REFINED,i.elements):Ie.get_topological_data(t,r?Ie.Level.CONTROL:Ie.Level.REFINED),n=Ie.HEAPU32.subarray(s>>2,8+(s>>2)),a=n.subarray(3,6),o=0,l=Ie.HEAPU32[n[o]>>2],u=new Float32Array(Ie.HEAPF32.subarray(l>>2,(l>>2)+a[o]));o++;let h=Ie.HEAPU32[n[o]>>2],d=new Uint32Array(Ie.HEAPU32.subarray(h>>2,(h>>2)+a[o]));o++;let c,p=Ie.HEAPU32[n[o]>>2],m=new Uint8Array(Ie.HEAPU32.subarray(p>>2,(p>>2)+a[o]));if(Ie.alloc_subdivision_surface_uvs){let f=n[7];if(f>0){let g=Ie.HEAPU32[n[6]>>2];c=new Float32Array(Ie.HEAPF32.subarray(g>>2,(g>>2)+f))}}return Ie.free_topological_data(s),{positions:u,indices:d,verticesPerFace:m,uvs:c}}},r_=new P,wM=new P,SM=new P,TM=new P}),Eft=W(()=>{nY(),aY(),s4(),oY(),o4(),bS(),wY(),SY(),TY(),pU(),CY(),l4(),EY(),PY(),RY(),mU(),NY(),DY(),OY(),IY(),pm(),Ii(),nY(),aY(),s4(),oY(),o4(),uMt(),bS(),wY(),SY(),TY(),pU(),CY(),l4(),EY(),PY(),RY(),mU(),NY(),DY(),OY(),IY(),pm(),dMt(),nft(),Sft(),Zv(),v5(),f5(),vU={ConeGeometry:Hmt,CubeGeometry:$mt,CylinderGeometry:Y7,DodecahedronGeometry:Xmt,EllipseGeometry:g5,HelixGeometry:Emt,IcosahedronGeometry:hft,LatheGeometry:uft,NonParametricGeometry:cft,PolygonGeometry:Q7,PyramidGeometry:pft,RectangleGeometry:y5,SphereGeometry:gft,PlaneGeometry:yft,BackdropGeometry:vft,StarGeometry:J7,TextFrameGeometry:bft,TorusGeometry:_ft,TorusKnotGeometry:xft,TriangleGeometry:wft,VectorGeometry:bm},vP=t=>{let e=vU[t.type]??ymt(t.type);if(e===void 0)throw new Error(`No geometry factory registered for "${t.type}" \u2014 was its feature compiled out of this runtime build?`);return e.create(t)}});function Jp(t,e,i,r){let s,n,a;t.type==="PathGeometry"?(n=JSON.parse(JSON.stringify(t)),a=[[],["extrusion"]]):(n={...t},a=[[]]);for(let u of a){let h=n;for(let d of u)h=h[d];for(s in h){let d=h[s];T$(d)&&!Pft.includes(s)&&(h[s]=e.getVariable(d,[r.uuid,"geometry",...u,s]),T$(h[s])&&(h[s]=1))}}let o,l={parameters:n,type:n.type};if(n.type==="PathGeometry")l.path=n.path;else if(n.type==="VectorGeometry"){let u=us.createFromState(n.shape,n.width,n.height);l.shape=u}else if(n.type==="NonParametricGeometry"){if(n.data.groups&&n.data.groups?.forEach(u=>u.materialIndex=Math.max(u.materialIndex??0,0)),l.geometry=new h7().parse(n),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(n.type==="SubdivGeometry"){let u=new hs(n,i);return u.data=t,u}if(n.type==="TextGeometry"||n.type==="InputGeometry"){let u=ymt(n.type);if(u)return u.create(n,e);Pn("text",`a ${n.type}`);let h=us.createFromState(gS.defaultData(),100,100);return vP({...n,shape:h,type:"VectorGeometry"})}if(n.type==="UIGeometry")return y5.create({parameters:{width:n.width,height:n.height,cornerRadius:n.cornerRadius,cornerType:n.cornerType}})}try{o=vP(l)}catch(u){console.error(u),console.error(`Error generating geometry with inputs: ${l}`);let h=us.createFromState(gS.defaultData(),100,100);l.shape=h,l.type="VectorGeometry",o=vP(l)}return o}var Pft,zY,bU,b5=W(()=>{Le(),yt(),Eft(),Ii(),l4(),vm(),Zv(),Pft=["font"]}),pMt=W(()=>{b5(),zY=class{constructor(){this.objects=new Map,this.unreachable=new Set}getCached(t){return this.objects.get(t)}get size(){return this.objects.size}get(t,e,i){let r=this.objects.get(t);return r===void 0?(r=this.createObject(t,e,i),this.objects.set(t,r)):r.isShared=!0,r}forceDelete(t){let e=this.objects.get(t);e&&(this.disposeObject(e),this.objects.delete(t))}adopt(t,e){this.objects.set(t,e)}mutateIfUnique(t,e){let i=this.objects.get(t);if(i&&i.isShared!==!0)return this.objects.delete(t),this.objects.set(e,i),i}startGc(){this.unreachable=new Set(this.objects.keys())}markAsReachable(t,e){e===this.objects.get(t)&&this.unreachable.delete(t)}endGc(){this.unreachable.forEach(t=>{this.disposeObject(this.objects.get(t)),this.objects.delete(t)}),this.unreachable.clear()}dispose(){this.objects.forEach(t=>{this.disposeObject(t)}),this.objects.clear()}},bU=class extends zY{constructor(t){super(),this.flatShading=t}disposeObject(t){t.dispose()}createObject(t,e,i){let r=Jp(t,e,this.flatShading,i);return r.computeBoundingSphere(),r}}});function h4(){return LS}function Rft(){if(LS==="webgpu"){if(xU!==void 0)return xU;wU||(wU=!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(UY===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 UY}function Nft(t,e){return Rft().createRootMaterial(t,e)}function LY(t,e,i){return Rft().createSharedMaterial(t,e,i)}function FY(t){return t.getLayersOfType===void 0&&Object.assign(t,{layers:[],getLayersOfType:()=>[],hasAO:!1,assetsLoaded:()=>!0}),t}function _U(){return Dft}var LS,xU,UY,wU,SU,Dft,Oft,_m=W(()=>{LS="webgl",wU=!1}),mMt=W(()=>{Oft={markNeedsUpdateRendererDirty:()=>{}}});function Eg(t,e){let i=0;if(!t.layers||t.layers.length===0)return!1;let r=t.layers?.find(s=>s.data.type==="light");if(r){let s=r.data,n=Number(e.getVariable(s.alphaOverride));if((typeof s.alphaOverride=="string"?n/100:s.alphaOverride)<1)return!0}for(let s of t.layers){if(s.data.type!=="displace"&&s.data.isMask)return!0;if(s.data.type!=="displace"&&"alpha"in s.data&&s.data.type!=="light"&&s.data.type!=="fresnel"&&s.data.type!=="cavity"&&s.data.type!=="dust"&&s.data.type!=="texture"&&s.data.type!=="matcap"&&s.data.type!=="rainbow"&&s.data.type!=="outline"&&s.data.type!=="pattern"){let n=s.data.visible?s.data.alpha:0;if(typeof n=="string"&&(n=Math.max(0,Math.min(1,Number(e.getVariable(n)??100)/100))),n===1&&s.data.type==="depth"||s.data.type==="gradient"){for(let a of s.data.colors)if(a[3]<1){n=a[3];break}}else if(n===1&&s.data.type==="noise"){let a=e.color(s.data.colorA).a,o=e.color(s.data.colorB).a,l=e.color(s.data.colorC).a,u=e.color(s.data.colorD).a,h=Math.min(a,Math.min(o,Math.min(l,u)));h<1&&(n=h)}i+=(1-i)*n}}return i<1}var iG=W(()=>{});function mv(t){return typeof t=="string"||typeof t=="number"&&t!==0}var Iv,Sn,FS,Ift,jY,GY,bl,Qv=W(()=>{Iv=(t,e,i)=>Math.max(0,Math.min(1,Number(e.getVariable(typeof t=="number"?100*t:t,i)??100)/100))??1,Sn=(t,e,i)=>typeof t=="number"?t:e.getVariable(t,i),FS={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"]},Ift={depth:["colors"],gradient:["colors","steps"],toon:["colors","steps"]}}),Jv=W(()=>{yt(),zS(),jY=class extends c5(hr){},GY=t=>t.type==="Mesh",bl=class extends jY{constructor(t){super(),this.object=t,this.isClone=!0,this.matrixAutoUpdate=!1,this.hasNonUniformScale=t.hasNonUniformScale}raycast(t,e){}expand(){let t=0,e=this.object.entityChildren(t);for(;e;){let i=this.children[t];i?.object!==e&&(i&&this.remove(i),i=new bl(e),this.add(i),this.children.splice(t,0,this.children.pop()),i.matrixWorldNeedsUpdate=!0,i.matrixAutoUpdate=!1,i.matrix=e.matrix,i.hiddenMatrix=e.hiddenMatrix,i.pivotMatrix=e.pivotMatrix),i.expand(),t+=1,e=this.object.entityChildren(t)}for(;this.children.length>t;)this.remove(this.children[t]);this.pivotMatrix=this.object.pivotMatrix}get visible(){let t=this.object.cloner;return(t===void 0||this.parent!==t||!t.instancingActive&&!t.insideBoolean)&&(this.playModeVisible!==void 0?this.playModeVisible:this.object.visible||this.object.dataPatched.visible&&this.object.dataPatched.cloner?.hideBase===!0)}set visible(t){}get castShadow(){return this.object.castShadow}set castShadow(t){}get receiveShadow(){return this.object.receiveShadow}set receiveShadow(t){}get isMesh(){return GY(this.object)}get isLight(){return this.object.isLight}get layers(){return this.object.layers}set layers(t){}get isCamera(){return!1}get geometry(){if(this.object.geometry)return this.object.geometry}get material(){if(this.object.material)return this.object.material}get morphTargetInfluences(){if(this.object.morphTargetInfluences)return this.object.morphTargetInfluences}set morphTargetInfluences(t){}}});function WY(){return rG}var rG,sG,nG=W(()=>{rG=null,sG=null});function TU(t){return"variable_"+t}var pO,mO,fO,qY,gO,HY,$Y,u4,aG=W(()=>{Le(),LTt(),Umt(),jmt(),Pc(),H7(),X7(),pMt(),_m(),zmt(),mMt(),iG(),Qv(),vo(),Jv(),Fi(),yt(),nG(),Ii(),pO=new At,mO=new P,fO=new Pe,qY=new P,gO=new ur,HY=class extends Bmt{constructor(t){super(),this.shared=t}create(t){return new q7(t,this.shared)}},(u4=$Y=class{constructor(t,e={},i=!0,r=!1){if(this.data=t,this.needsJitter=i,this.enableLocalStorageForPersistentVariables=r,this.geometryCache=new bU(!0),this.geometryCache2=new bU(!1),this.imageHolderCache=new HY(this),this.thisContext={scene:Oft,shared:this},this.deletedImage=new cg(L8.emptyImage,this),this.deletedVideo=new cg(FR.defaultVideo,this),this.materials={},this.images={},this.uiBuffers={},this.videos={},this.colors={},this.audios={},this.particles={},this.fonts={},this.variables={},this.userAPIs={},this.userWebhooks={},this.mouseProperty=null,this.raycastProperty=null,this.requestRender=()=>{this._requestRender&&this._requestRender()},this.transientGeometryKeys=new WeakSet,e.images)for(let[s,n]of Object.entries(e.images))this.addImage(s,n);if(e.videos)for(let[s,n]of Object.entries(e.videos))this.addVideo(s,n);if(e.audios)for(let[s,n]of Object.entries(e.audios))this.addAudio(s,n);if(e.particles)for(let[s,n]of Object.entries(e.particles))this.addParticle(s,n);this.reset(t)}get deletedMaterial(){return this._deletedMaterial??(this._deletedMaterial=LY(ds.defaultTwoLayerData("phong"),this.thisContext,"")),this._deletedMaterial}setRequestRender(t){this._requestRender=t}getImageLoadPromises(){return Object.values(this.images).map(t=>t.loadPromise)}setEntityOpContext(t){this.entityOpContext=t}reset(t,e=!1,i=!1){this.data=t,this.resetLib(t.lib);for(let{id:r,data:s}of t.variables)this.addVariableHolder(r,s),e&&this.updateVariableHolder(r,s);for(let[r,s]of Object.entries(t.userAPIs??{}))this.addUserAPI(r,s);for(let[r,s]of Object.entries(t.userWebhooks??{}))this.addUserWebhook(r,s);if(!i){for(let[r,s]of Object.entries(t.images))this.addImage(r,s);for(let[r,s]of Object.entries(t.videos))this.addVideo(r,s)}for(let[r,s]of Object.entries(t.colors))this.addColor(r,s);for(let[r,s]of Object.entries(t.lib.materials))this.addMaterial(r,s.asset);for(let[r,s]of Object.entries(t.materials))this.addMaterial(r,s);for(let[r,s]of Object.entries(t.audios))this.addAudio(r,s);for(let[r,s]of Object.entries(t.particles))this.addParticle(r,s);for(let[r,s]of Object.entries(t.fonts))this.addFont(r,s)}addMaterial(t,e){if(e.layers===void 0&&(e={...e,layers:ds.defaultTwoLayerData("phong").layers}),this.materials[t]){let i=this.materials[t];i.reset(e,this.thisContext),i.dispose()}else{let i=LY(e,this.thisContext,t);this.materials[t]=i}}deleteMaterial(t){this.materials[t]&&(this.materials[t].nodeMaterialDispose(),delete this.materials[t])}getMaterial(t){return this.materials[t]}getMaterialOrDeletedPlaceholder(t){return this.materials[t]??this.deletedMaterial}material(t){return typeof t=="string"?this.getMaterialOrDeletedPlaceholder(t):t==null?(console.error("material is undefined or null"),this.deletedMaterial):(t.layers===void 0&&(t={...t,layers:ds.defaultTwoLayerData("phong").layers}),Nft(t,this.thisContext))}getMaterials(){return this.materials}addImage(t,e){return this.images[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.images[t].updateSrc(e.data),!0):(this.images[t]=new cg(e,this),!1)}deleteImage(t){let e=this.images[t];e&&(e.dispose(),delete this.images[t])}getDefaultImage(){return this.images.image_0}getImage(t){return this.images[t]??this.deletedImage}image(t){return typeof t=="string"?this.getImage(t):this.imageHolderCache.load(t)}addUIBuffer(t,e){return this.uiBuffers[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.uiBuffers[t].updateSrc(e),!0):(this.uiBuffers[t]=new cg(e,this),!1)}uiBuffer(t){return this.uiBuffers[t]}addVideo(t,e){return this.videos[t]?(this.videos[t].updateSrc(e.data),!0):(this.videos[t]=new cg(e,this),!1)}deleteVideo(t){let e=this.videos[t];e&&(e.dispose(),delete this.videos[t])}getVideo(t){return this.videos[t]??this.deletedVideo}video(t){return typeof t=="string"?this.getVideo(t):this.imageHolderCache.load(t)}addColor(t,e){return this.colors[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),"a"in e?this.colors[t].setRGBA(e.r,e.g,e.b,e.a):this.colors[t].setRGBA(e.r,e.g,e.b,1),!0):(this.colors[t]=new iU(e.r,e.g,e.b,"a"in e?e.a:1),!1)}updateColor(t,e){if(this.colors[t]){this.onColorOrImageUpdate&&this.onColorOrImageUpdate();let i=this.colors[t];return this.colors[t].r=e.r??i.r,this.colors[t].g=e.g??i.g,this.colors[t].b=e.b??i.b,this.colors[t].a=e.a??i.a,!0}return!1}deleteColor(t){this.colors[t]&&delete this.colors[t]}getColor(t){return this.colors[t]}getColorNames(){return Object.values(this.data.colors).map(t=>t.name)}getColorByName(t){for(let e in this.data.colors)if(this.data.colors[e].name===t)return{color:this.colors[e],id:e}}color(t){let e;if(typeof t!="string")return new Dr(t.r,t.g,t.b,"a"in t?t.a:1);{let i=this.getColor(t);i?e=i:(console.warn("Tried to create color layer params with a color key that does not exist in the assets manager"),e=new Dr(0,0,0,0))}return e}addAudio(t,e){this.audios[t]=e}getAudio(t){let e=this.audios[t];if(e instanceof X1)return e;{let i=new X1({src:e.data});return this.audios[t]=i,i}}addParticle(t,e){this.particles[t]=e}getParticle(t){return this.particles[t]}deleteParticle(t){this.particles[t]&&delete this.particles[t]}deleteAudio(t){let e=this.audios[t];e&&(e instanceof X1&&e.dispose(),delete this.audios[t])}addFont(t,e){let i=$7;i!==null?(this.fonts[t]=new i(e),this.fonts[t].loadingPromise.then(()=>this.requestRender())):Pn("text","a font asset")}getFont(t){return this.fonts[t]}deleteFont(t){this.fonts[t]&&delete this.fonts[t]}dispose(){Object.keys(this.materials).forEach(t=>this.deleteMaterial(t)),this._requestRender=void 0,Object.values(this.audios).forEach(t=>{t instanceof X1&&t.dispose()}),this.audios={},this.particles={},this.geometryCache.dispose(),this.geometryCache2.dispose()}addVariableHolder(t,e){if(this.variables[t]===void 0){let i=e.value;if(this.enableLocalStorageForPersistentVariables&&e.persistent){let r=localStorage.getItem(TU(t));i=r!==null?JSON.parse(r):e.value}return this.variables[t]={value:i,locations:[],persistent:e.persistent},"dynamicVariableType"in e&&(this.variables[t].dynamicVariablePlayState="Playing",this.variables[t].dynamicVariableToggleIsForward=void 0),!0}return this.variables[t].value=e.value,!1}resetDynamicVariablePlayState(){for(let t in this.variables)this.variables[t].dynamicVariablePlayState!==void 0&&(this.variables[t].dynamicVariablePlayState="Playing",this.variables[t].dynamicVariableToggleIsForward=void 0)}updateVariableHolder(t,e){this.updateVariable(t,e.value)}updateVariable(t,e){if(this.variables[t]===void 0)return!1;this.variables[t].value=e,this.enableLocalStorageForPersistentVariables&&this.variables[t].persistent&&localStorage.setItem(TU(t),JSON.stringify(e));let i=e;for(;typeof i=="string";)i=this.variables[i].value;let r=this.entityOpContext.scene,s=!1;for(let n=this.variables[t].locations.length-1;n>=0;n--){let a=this.variables[t].locations[n];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[t].locations.splice(n,1);continue}if(s=!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*Yt.DEG2RAD:o[a[a.length-1]]=i}if(o=r.find(a[0]),o.type==="ParticleEmitter"&&o.updateVariableState(i,a),Ai.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 s&&r.markShadowsDirty(),this.requestRender(),!0}updateEntityGeometryParams(t,e){let i=t;if(i.component&&(i=i.component),typeof i.chooseGeoemtryCache!="function")return!1;let r=i.dataPatched,s=r?.geometry;if(!s||typeof s.type!="string"||s.type==="VectorGeometry"||s.type==="PathGeometry")return!1;let n=u=>u.toLowerCase().replace(/[\s_.-]+/g,""),a=new Map;for(let u of Object.keys(s))a.set(n(u),u);let o={};for(let[u,h]of Object.entries(e??{})){let d=a.get(n(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=s[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={...s,...o};return i.dataPatched={...r,geometry:l},this.transientGeometryKeys.has(s)&&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(t){let e=t;if(e.component&&(e=e.component),typeof e.chooseGeoemtryCache!="function")return!1;let i=e.dataPatched?.geometry;return!(!i||!this.transientGeometryKeys.has(i)||(e.dataPatched=e.data,e.chooseGeoemtryCache(this).forceDelete(i),e.createGeometryDelayed(this.entityOpContext),e.onVariableUpdate(!0),e.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),0))}updateEntityGeometryVertices(t,e){let i=t;if(i.component&&(i=i.component),typeof i.chooseGeoemtryCache!="function")return!1;let r=i.dataPatched,s=r?.geometry;if(!s||s.type!=="NonParametricGeometry")return!1;let n=e?.vertices;if(n===void 0||typeof n.length!="number"||n.length<9||n.length%3!=0||n.length/3>$Y.MAX_TRANSIENT_VERTICES)return!1;let a,o,l,u=n instanceof Float32Array?n:Float32Array.from(n),h=u.length/3;if(e.normals!==void 0){if(e.normals.length!==u.length)return!1;a=e.normals instanceof Float32Array?e.normals:Float32Array.from(e.normals)}if(e.uvs!==void 0){if(e.uvs.length!==2*h)return!1;o=e.uvs instanceof Float32Array?e.uvs:Float32Array.from(e.uvs)}if(e.indices!==void 0){let x=h>65535?Uint32Array.from(e.indices):Uint16Array.from(e.indices);if(x.length===0||x.length%3!=0)return!1;for(let S=0;S<x.length;S++)if(x[S]>=h)return!1;l={array:x,itemSize:1,type:x.constructor.name,normalized:!1}}else{let x=s.data,S=x?.index;if(S?.array?.length){if(h<(x?.attributes?.position?.array?.length??0)/3){let w=S.array;for(let M=0;M<w.length;M++)if(w[M]>=h)return!1}l=S}}let d=1/0,c=1/0,p=1/0,m=-1/0,f=-1/0,g=-1/0;for(let x=0;x<u.length;x+=3){let S=u[x],w=u[x+1],M=u[x+2];S<d&&(d=S),S>m&&(m=S),w<c&&(c=w),w>f&&(f=w),M<p&&(p=M),M>g&&(g=M)}let y=(x,S)=>({array:x,itemSize:S,type:"Float32Array",normalized:!1}),v={position:y(u,3)};a&&(v.normal=y(a,3)),o&&(v.uv=y(o,2));let b={...s,width:m-d,height:f-c,depth:g-p,data:{attributes:v,...l?{index:l}:{}}},_=this.transientGeometryKeys.has(s);return i.dataPatched={...r,geometry:b},this.transientGeometryKeys.add(b),i.applyTransientGeometryData(this.entityOpContext,_),i.onVariableUpdate(!0),i.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}setEntityInstanceTransforms(t,e){let i=t;i.component&&(i=i.component);let r=i.cloner;if(r===void 0)return-1;let s=r.children,n=Math.PI/180,a=!1;if(e===null)for(let o of s)o.transformOverride!==void 0&&(o.transformOverride=void 0,a=!0);else{if(!Array.isArray(e))return s.length;{let o=Math.min(e.length,s.length);for(let l=0;l<o;l++){let u=e[l],h=s[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*n),typeof u.rotation.y=="number"&&(d.rotation[1]=u.rotation.y*n),typeof u.rotation.z=="number"&&(d.rotation[2]=u.rotation.z*n)),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(),s.length}spawnRuntimeClone(t,e={}){if(typeof t.entityChildren!="function")return;let i=t.parent;if(i===null)return;let r=new bl(t);r.playModeVisible=e.visible!==!1,r.expand(),typeof e.name=="string"&&(r.name=e.name);let s=Math.PI/180;return r.position.copy(t.position),r.rotation.copy(t.rotation),r.scale.copy(t.scale),r.hiddenMatrix.copy(t.hiddenMatrix),e.position&&(typeof e.position.x=="number"&&(r.position.x=e.position.x),typeof e.position.y=="number"&&(r.position.y=e.position.y),typeof e.position.z=="number"&&(r.position.z=e.position.z)),e.rotation&&(typeof e.rotation.x=="number"&&(r.rotation.x=e.rotation.x*s),typeof e.rotation.y=="number"&&(r.rotation.y=e.rotation.y*s),typeof e.rotation.z=="number"&&(r.rotation.z=e.rotation.z*s)),e.scale&&(typeof e.scale.x=="number"&&(r.scale.x=e.scale.x),typeof e.scale.y=="number"&&(r.scale.y=e.scale.y),typeof e.scale.z=="number"&&(r.scale.z=e.scale.z)),r.updateMatrix(),i.add(r),r.updateWorldMatrix(!0,!0),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),r}destroyRuntimeClone(t){t.removeFromParent(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender()}updateEntityMaterialParams(t,e){let i=t.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 s={scene:this.entityOpContext.scene,shared:this},n=u=>u.toLowerCase().replace(/[\s_.-]+/g,""),a=u=>{if(typeof u=="string"){let h=new Dr(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 iU?u.setValue(h,new Dr(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(e.color!==void 0){let c=a(e.color),p=h.find(f=>f.data.type==="color"),m=p&&d(p.id);if(c&&m&&o(m,"color",c)&&(l=!0,c.a!==void 0)){let f=c.a<1||Eg(u.data,this);u.setTransparent?u.setTransparent(f,s.scene):u.transparent=f}}typeof e.alpha=="number"&&isFinite(e.alpha)&&(u.onVariableUpdate?.(["alphaOverride"],Math.max(0,Math.min(e.alpha,100)),s),l=!0);for(let c of e.layers??[]){if(!c||typeof c!="object")continue;let p=typeof c.id=="string"?h.find(y=>y.id===c.id):typeof c.index=="number"?h[c.index]:typeof c.type=="string"?h.find(y=>y.data.type===c.type):void 0,m=p&&d(p.id);if(!p||!m)continue;let f=FS[p.data.type]??[],g=Object.keys(p.data);for(let[y,v]of Object.entries(c)){if(y==="id"||y==="index"||y==="type")continue;let b=g.find(x=>x===y)??g.find(x=>n(x)===n(y))??y;if(f.includes(b))continue;let _=a(v);if(_&&o(m,b,_))l=!0;else if(typeof v=="number"&&isFinite(v))u.onVariableUpdate?.(["layer",p.id,b],v,s),l=!0;else if(Array.isArray(v)&&v.length<=3&&v.every(x=>typeof x=="number"&&isFinite(x))){let x=["x","y","z"];v.forEach((S,w)=>{u.onVariableUpdate?.(["layer",p.id,b,x[w]],S,s)}),l=!0}}}}return l&&this.requestRender(),l}deleteVariable(t){this.variables[t]&&delete this.variables[t]}getVariable(t,e){if(Array.isArray(t)){if(t[0]==="mouse")return this.mouseProperty?.[t[1]]??0;if(t[0]==="raycast")return this.raycastProperty?.[t[1]]??0;let i=this.entityOpContext.scene.find(t[0]);if(t[1]==="width"||t[1]==="height"||t[1]==="depth")return i.geometry.userData.parameters[t[1]];if((t[1]==="position"||t[1]==="rotation")&&t.length>2&&i?.getPhysicsLocalMatrix?.(pO))return pO.decompose(mO,fO,qY),t[1]==="position"?mO[t[2]]:(gO.setFromQuaternion(fO,i.rotation.order),gO[t[2]]*Yt.RAD2DEG);for(let r=1;r<t.length;r++)i=i[t[r]];return t[1]==="rotation"&&(i*=Yt.RAD2DEG),i}for(let i in this.variables){if(e===void 0)break;let r=this.variables[i],s=r.locations?.findIndex(n=>En.equal(n,e));s!==void 0&&s!==-1&&r.locations.splice(s,1)}if(typeof t=="string"){let i=t,r=t;do{if(r=i,this.variables[i]===void 0)break;let s=this.variables[i].value;e&&this.variables[r]!==void 0&&this.variables[r].locations.push(e),i=s}while(typeof i=="string");return i}return t}getVariables(){return this.variables}getVariablesNames(){return this.data.variables.map(t=>t.data.name)}getVariableByName(t){for(let e of this.data.variables)if(e.data.name===t)return{variable:e.data,id:e.id}}getDynamicVariablePlayState(t){return this.variables[t]?.dynamicVariablePlayState}setDynamicVariablePlayState(t,e){this.variables[t]!==void 0&&(this.variables[t].dynamicVariablePlayState=e)}getDynamicVariableToggleIsForward(t){return this.variables[t]?.dynamicVariableToggleIsForward}setDynamicVariableToggleIsForward(t,e){this.variables[t]!==void 0&&(this.variables[t].dynamicVariableToggleIsForward=e)}resetLib(t){for(let[e,i]of Object.entries(t.images))this.addImage(e,i.asset);for(let[e,i]of Object.entries(t.audios))this.addAudio(e,i.asset);for(let[e,i]of Object.entries(t.particles))this.addParticle(e,i.asset);for(let[e,i]of Object.entries(t.colors))this.addColor(e,i.asset);for(let[e,i]of Object.entries(t.fonts))this.addFont(e,i.asset);for(let[e,i]of Object.entries(t.videos))this.addVideo(e,i.asset);for(let[e,i]of Object.entries(t.variables))this.addVariableHolder(e,i.asset)}updateLibByOp(t,e){t.path[0]==="images"?t.path.length===1&&t.type===1?this.addImage(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteImage(t.id):t.path[0]==="videos"?t.path.length===1&&t.type===1?this.addVideo(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteVideo(t.id):t.path[0]==="audios"?t.path.length===1&&t.type===1?this.addAudio(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteAudio(t.id):t.path[0]==="particles"?t.path.length===1&&t.type===1?this.addParticle(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteParticle(t.id):t.path[0]==="colors"?t.path.length===1&&t.type===1?this.addColor(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteColor(t.id):t.path[0]==="materials"?t.path.length===1&&t.type===1?this.addMaterial(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteMaterial(t.id):t.path[0]==="fonts"?t.path.length===1&&t.type===1?this.addFont(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteFont(t.id):t.path[0]==="variables"?t.path.length===1&&t.type===1?this.addVariableHolder(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteVariable(t.id):t.path[0]==="components"&&e.updateByLibOp(t,this)}updateByOp(t,e,i){if(this.data=e,t.path[0]==="images")t.path.length===2&&t.type===0?t.props.data&&this.getImage(t.path[1]).updateSrc(t.props.data):t.path.length===1&&t.type===1?this.addImage(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteImage(t.id);else if(t.path[0]==="videos")t.path.length===2&&t.type===0?t.props.data&&this.getVideo(t.path[1]).updateSrc(t.props.data):t.path.length===1&&t.type===1?this.addVideo(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteVideo(t.id);else if(t.path[0]==="audios")t.path.length===2&&t.type===0?t.props.data&&this.addAudio(t.path[1],e.audios[t.path[1]]):t.path.length===1&&t.type===1?this.addAudio(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteAudio(t.id);else if(t.path[0]==="particles")t.path.length===2&&t.type===0?t.props.data&&this.addParticle(t.path[1],e.particles[t.path[1]]):t.path.length===1&&t.type===1?this.addParticle(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteParticle(t.id);else if(t.path[0]==="colors")t.path.length===2&&t.type===0?this.updateColor(t.path[1],t.props):t.path.length===1&&t.type===1?this.addColor(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteColor(t.id);else if(t.path[0]==="materials")t.path.length===1&&t.type===1?this.addMaterial(t.id,t.data):t.path.length===1&&t.type===2?this.deleteMaterial(t.id):t.path.length>1&&this.getMaterial(t.path[1]).updateByOp(Qn.drop(t,2),e.materials[t.path[1]],{shared:this,scene:i});else if(t.path[0]==="fonts")t.path.length===2&&t.type===0?this.updateFont(t.path[1],t,i):t.path.length===1&&t.type===1?this.addFont(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteFont(t.id);else if(t.path[0]==="variables")t.path.length===2&&t.type===0?"value"in t.props?this.updateVariable(t.path[1],t.props.value):"persistent"in t.props&&(this.variables[t.path[1]].persistent=t.props.persistent):t.path.length===1&&t.type===4?this.addVariableHolder(t.id,t.data):t.path.length===1&&t.type===5&&this.deleteVariable(t.id);else if(t.path[0]==="userAPIs"){if(t.path.length===1&&t.type===1)this.addUserAPI(t.id,t.data);else if(t.path.length===1&&t.type===2)this.deleteUserAPI(t.id);else if(typeof t.path[1]=="string"){let r=e.userAPIs[t.path[1]];if(r){let s=t.type===0&&t.props.debounce===void 0,n=this.getUserAPI(t.path[1]);n!==void 0&&n===this.openAIRealtime?n.update(r):n?.update(r,this,s)}}}else if(t.path[0]==="userWebhooks"){if(t.path.length===1&&t.type===1)this.addUserWebhook(t.id,t.data);else if(t.path.length===1&&t.type===2)this.deleteUserWebhook(t.id);else if(typeof t.path[1]=="string"){let r=e.userWebhooks[t.path[1]];r&&this.getUserWebhook(t.path[1])?.update(r)}}else t.path[0]==="lib"&&this.updateLibByOp(Qn.drop(t,1),i)}updateFont(t,e,i){if(e.props.url){let r=this.getFont(t),s={...this.data.fonts[t],url:e.props.url};r.update(s),r.loadingPromise.then(()=>this.requestRender()),i.updateFont(t,this)}}addUserAPI(t,e){if(this.userAPIs[t])return this.userAPIs[t].update(e,this),!0;if(this.openAIRealtime?.id===t)return this.openAIRealtime.update(e),!0;if(e.integration?.type==="VoiceAssistant"){let i=sG;return i===null?(Pn("ai-assistant","a voice-assistant integration"),!1):(this.openAIRealtime=i(e,t,this),!1)}{let i=WY();return i===null?(Pn("api-services","a user API integration"),!1):(this.userAPIs[t]=i.createUserAPI(t,e,this),!1)}}getUserAPI(t){return this.openAIRealtime?.id===t?this.openAIRealtime:this.userAPIs[t]}getUserAPIs(){return this.userAPIs}deleteUserAPI(t){let e=this.userAPIs[t];e&&(e.dispose(),delete this.userAPIs[t])}addUserWebhook(t,e){if(this.userWebhooks[t])return this.userWebhooks[t].update(e),!0;{let i=WY();return i===null?(Pn("api-services","a user webhook"),!1):(this.userWebhooks[t]=i.createUserWebhook(t,e),!1)}}getUserWebhook(t){return this.userWebhooks[t]}getUserWebhooks(){return this.userWebhooks}deleteUserWebhook(t){let e=this.userWebhooks[t];e&&(e.dispose(),delete this.userWebhooks[t])}get scene(){return this.entityOpContext.scene}}).MAX_TRANSIENT_VERTICES=6e4,new u4(Kl.emptyData())});function Bft(t){return i4(t)||t?.isTSLNodeMaterial===!0}var yo,yO,vO,bO,XY,_O,Fr,Vft=W(()=>{W7()}),n0=W(()=>{Le(),la(),_m(),Vft(),Fi(),oa(),yo=class extends Is{setMaterialOverride(t,e){this.materialOverride=FY(t),this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.materialOverride,this.layers.set(0),this.syncShapeBlendNodeLayer(),e.scene.markNeedsUpdateRendererDirty())}updateByPatchedOp(t,e,i){if(super.updateByPatchedOp(t,e,i),tr(t.path,["geometry"])&&this.syncShadowCatcher(i),function(r,s){let n=[];if(s.length!==r.length)return null;{let a=0;for(;a<r.length;){if(s[a]==="*")n.push(r[a]);else if(r[a]!==s[a])return null;a+=1}}return n}(t.path,["materials"])!==null&&t.type===0&&Array.isArray(this.material))for(let[r,s]of Object.entries(t.props)){let n=this.material[Number(r)],a=i.shared.material(s);a!==n&&yo.disposeOneMaterial(n),this.material[Number(r)]=a}else if(tr(t.path,["material"])){let r=this.material;!Array.isArray(r)&&typeof r?.updateByOp=="function"&&"material"in e&&typeof e.material!="string"&&r.updateByOp(Qn.drop(t,1),e.material,i)}else if(tr(t.path,["materials","*"])&&Array.isArray(this.material)){let r=t.path[1];if("materials"in e&&r<this.material.length){let s=e.materials[r];typeof s!="string"&&this.material[r].updateByOp(Qn.drop(t,2),s,i)}}}get needsAO(){return this.material!==void 0&&(Array.isArray(this.material)?this.material[0]:this.material).hasAO}syncShapeBlendNodeLayer(){this.dataPatched.type==="Mesh"&&this.dataPatched.geometry.shapeBlendNode?this.layers.set(9):512&this.layers.mask&&this.layers.set(0)}updateState(t,e){super.updateState(t,e),t.castShadow!==void 0&&(this.castShadow=t.castShadow),t.receiveShadow!==void 0&&(this.receiveShadow=t.receiveShadow);let i,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 s=this.materialOverride!==void 0;!s&&t.geometry?.type!=="NonParametricGeometry"&&"material"in t&&t.material!==void 0&&(this.disposeMaterial(),this.material=e.shared.material(t.material).getFlavor(r.flatShading,r.side,r.wireframe,i),e.scene.markNeedsUpdateRendererDirty()),!s&&(t.geometry?.type==="NonParametricGeometry"||"materials"in t)&&("materials"in t&&t.materials!==void 0?(this.disposeMaterial(),this.material=t.materials.map(a=>e.shared.material(a).getFlavor(r.flatShading,r.side,r.wireframe)),e.scene.markNeedsUpdateRendererDirty()):"material"in t&&t.material!==void 0&&(this.disposeMaterial(),this.material=[e.shared.material(t.material).getFlavor(r.flatShading,r.side,r.wireframe)],e.scene.markNeedsUpdateRendererDirty()));let n=this.data;if(!s&&n.geometry?.type!=="NonParametricGeometry"&&"materials"in n&&n.materials!==void 0&&(this.disposeMaterial(),this.material=e.shared.material(n.materials[0]).getFlavor(r.flatShading,r.side,r.wireframe)),!s&&(t.flatShading!==void 0||t.wireframe!==void 0||t.side!==void 0))if(Array.isArray(this.material))for(let a=0;a<this.material.length;a++)this.material[a]=this.material[a].getFlavor(r.flatShading,r.side,r.wireframe);else this.material=this.material.getFlavor(r.flatShading,r.side,r.wireframe,i);this.syncShadowCatcher(e)}shadowCatcherActive(){let t=this.dataPatched,e=t.geometry?.type;return t.shadowCatcher===!0&&(e==="RectangleGeometry"||e==="PlaneGeometry")}syncShadowCatcher(t){let e=this.dataPatched;if(this.shadowCatcherActive()){if(this.shadowCatcherMaterial===void 0){let i=function(){let r=LS==="webgpu"&&SU!==void 0?SU:void 0;return r===void 0?null:FY(r())}();if(i===null)return;this.shadowCatcherMaterial=i}this.shadowCatcherMaterial.side=e.side,this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.shadowCatcherMaterial,t.scene.markNeedsUpdateRendererDirty()),this.castShadow=!1,this.receiveShadow=!0,this.layers.set(0)}else this.shadowCatcherMaterial!==void 0&&this.material===this.shadowCatcherMaterial&&(this.materialOverride!==void 0?(this.material=this.materialOverride,t.scene.markNeedsUpdateRendererDirty()):"material"in e&&e.material!==void 0&&(this.material=t.shared.material(e.material).getFlavor(e.flatShading,e.side,e.wireframe),t.scene.markNeedsUpdateRendererDirty(),this.needsAO&&this.layers.enable(5)),this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow)}static disposeOneMaterial(t){var e;Bft(t)&&!function(i){return i?.isClassicSharedMaterial===!0}(e=t)&&e?.isTSLSharedMaterial!==!0&&t.nodeMaterialDispose()}disposeMaterial(){this.material&&_pt(this.material).forEach(t=>{yo.disposeOneMaterial(t)})}dispose(){this.disposeMaterial(),this.shadowCatcherMaterial?.dispose(),super.dispose()}}}),bo=W(()=>{Le(),Fi(),aG(),n0(),yt(),b5(),Zv(),Aft(),yO=new P,vO=new Ae,bO=new Ae,XY=new P,_O=new At,Fr=class extends yo{constructor(t,e,i){super(t,e),this.data=e,this.isSkinnedMesh=!1,this.localGeometry=void 0,e.bindMode&&e.bindMatrix&&(this.bindMode=e.bindMode,this.bindMatrix=new At().fromArray(e.bindMatrix),this.bindMatrixInverse=new At)}chooseGeoemtryCache(t){return t.geometryCache}supportsInPlaceGeometryUpdate(t){return t.isTextGeometry!==!0}markGeometryAsReachable(t){this.geometryCreateDeleyed instanceof ye&&this.chooseGeoemtryCache(t).markAsReachable(this.dataPatched.geometry,this.geometryCreateDeleyed)}get builtSharedGeometry(){if(this.localGeometry===void 0)return this.geometryCreateDeleyed instanceof ye?this.geometryCreateDeleyed:void 0}get geometry(){if(this.localGeometry!==void 0)return this.localGeometry;if(this.geometryCreateDeleyed instanceof u4){let t=this.geometryCreateDeleyed,e=this.chooseGeoemtryCache(t),i=this.dataPatched.geometry;this.geometryCreateDeleyed=e.get(i,t,this),this._geometryCacheKey=i}return this.geometryCreateDeleyed}set geometry(t){this.localGeometry=t}get is2DAndNoDepth(){let t=this.dataPatched.geometry;return GR.is2DParametricMesh(t.type)&&t.depth===0}get is2DType(){return GR.is2DParametricMesh(this.geometry.userData.type)}get isNonParametric(){return this.geometry.userData.type==="NonParametricGeometry"}updateByPatchedOp(t,e,i){super.updateByPatchedOp(t,e,i),tr(t.path,["geometry"])&&this.updateByPatchedOpGeometry(Qn.drop(t,1),e.geometry,i)}removeInteractionGeometry(t){this.localGeometry?.dispose(),this.localGeometry=void 0}get appliedGeometrySize(){let t=this.localGeometry?.userData;if(t!==void 0&&t.sxPrev!==void 0)return[t.sxPrev,t.syPrev,t.szPrev]}updateGeometryInteractions(t,e){this.invalidateDownstreamBooleanData();let i=this.data.geometry.type;if(i==="NonParametricGeometry"||i==="SubdivGeometry"){let r,s,n,a=t;if(this.localGeometry===void 0){let d={...this.data.geometry,...a};this.localGeometry=Jp(d,e,this.data.flatShading,this)}a.scaleBaked?[r,s,n]=a.scaleBaked:{width:r,height:s,depth:n}=a;let o=this.localGeometry.userData,l=typeof r=="number"?r:1,u=typeof s=="number"?s:1,h=typeof n=="number"?n:1;o.sxPrev!==void 0&&yU(this.localGeometry.attributes,l/o.sxPrev,u/o.syPrev,h/o.szPrev),o.sxPrev=l,o.syPrev=u,o.szPrev=h}else{let r=Jp({...this.data.geometry,...t},e,this.data.flatShading,this);this.localGeometry!==void 0&&this.supportsInPlaceGeometryUpdate(this.localGeometry)&&hO(this.localGeometry,r)?r.dispose():(this.localGeometry?.dispose(),this.localGeometry=r)}}refreshAttachedClonersInteractions(t){for(let e of this.attachedSurfaceCloners)e.update(t)}refreshAttachedCloners(t){for(let e of this.attachedSurfaceCloners)t.scene.addPendingUpdateCloner(e.object)}refreshAttachedPaths(t){for(let e of this.attachedPaths)t.scene.addPendingCommand(()=>e.updateShape())}createGeometryDelayed(t){this.geometryCreateDeleyed=t.shared,this.refreshAttachedCloners(t),this.refreshAttachedPaths(t)}updateByPatchedOpGeometry(t,e,i){let r=!1;if(t.type===0&&t.path.length===0&&Object.keys(t.props).includes("scaleBaked")&&this.geometryCreateDeleyed instanceof hs&&this.chooseGeoemtryCache(i.shared).mutateIfUnique(this.geometryCreateDeleyed.data,e)===this.geometryCreateDeleyed&&(r=!0,this.geometryCreateDeleyed.mutateDirectlyScaleBaked(e,t.props.scaleBaked),this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)),!r&&t.type===0&&t.path.length===0&&Cft(t.props)&&this.geometryCreateDeleyed instanceof hs&&this.chooseGeoemtryCache(i.shared).mutateIfUnique(this.geometryCreateDeleyed.data,e)===this.geometryCreateDeleyed&&(r=!0,this.geometryCreateDeleyed.mutateDirectlySubdivisions(e),this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)),!r&&t.type===0&&t.path.length===0&&this.geometryCreateDeleyed instanceof ye&&!(this.geometryCreateDeleyed instanceof hs)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let s=i.shared,n=this.chooseGeoemtryCache(s),a=this.geometryCreateDeleyed;if(n.getCached(this._geometryCacheKey)===a&&a.isShared!==!0){let o=this.dataPatched.geometry,l=Jp(o,s,this.data.flatShading,this);hO(a,l)?(l.dispose(),a.computeBoundingSphere(),n.mutateIfUnique(this._geometryCacheKey,o)):(l.computeBoundingSphere(),n.forceDelete(this._geometryCacheKey),n.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(t,e){this.createGeometryDelayed(e)}applyTransientGeometryData(t,e){let i=t.shared,r=this.dataPatched.geometry;if(this.geometryCreateDeleyed instanceof ye&&!(this.geometryCreateDeleyed instanceof hs)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let s=this.chooseGeoemtryCache(i),n=this.geometryCreateDeleyed;if(s.getCached(this._geometryCacheKey)===n&&n.isShared!==!0){let a=Jp(r,i,this.data.flatShading,this);return hO(n,a)?(a.dispose(),n.computeBoundingSphere(),s.mutateIfUnique(this._geometryCacheKey,r)):(a.computeBoundingSphere(),s.forceDelete(this._geometryCacheKey),s.adopt(r,a),this.geometryCreateDeleyed=a),this._geometryCacheKey=r,this.refreshAttachedCloners(t),void this.refreshAttachedPaths(t)}}e&&this._geometryCacheKey!==void 0&&this.chooseGeoemtryCache(i).forceDelete(this._geometryCacheKey),t.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(t)}updateState(t,e){t.geometry!==void 0&&this.updateGeometryOnStateUpdate(t.geometry,e);let i=t.morphTargetInfluences;if(i){this.updateMorphTargets(),this.geometry.morphTargetsRelative=!0;for(let{data:{name:r,value:s}}of i)this.updateMorphInfluences(r,e.shared.getVariable(s,[this.uuid,"morphTargetInfluences",r]))}super.updateState(t,e)}updateMorphInfluences(t,e){if(this.morphTargetDictionary===void 0)return;let i=this.morphTargetDictionary[t];i!==void 0&&(this.morphTargetInfluences[i]=e)}updateGeometryGroupsIfNeeded(){Array.isArray(this.material)&&this.geometry.groups.length===0&&this.geometry.addGroup(0,Math.max(this.geometry.getIndex()?.count??0,this.geometry.getAttribute("position").count),0)}updateEntityBoxSize(t,e){let i=this.geometry.userData.parameters;this.is2DType?t.set(0,0,.5*i.depth):this.isNonParametric?(t.setScalar(0),this.geometry.boundingSphere&&t.copy(this.geometry.boundingSphere.center),e.set(i.width,i.height,i.depth??0).multiplyScalar(.5)):i.centerOffset?t.fromArray(i.centerOffset):t.setScalar(0),e.set(i.width,i.height,i.depth??0).multiplyScalar(.5)}updateMatrixWorld(t){super.updateMatrixWorld(t),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"&&this.bindMatrixInverse.copy(this.bindMatrix).invert()}bind(t,e){this.skeleton=t,this.isSkinnedMesh=!0,e===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(t){let e=new Ae,i=this.geometry.attributes.skinWeight;for(let r=0,s=i.count;r<s;r++){e.fromBufferAttribute(i,r);let n=1/e.manhattanLength();n!==1/0?e.multiplyScalar(n):e.set(1,0,0,0),i.setXYZW(r,e.x,e.y,e.z,e.w)}}boneTransform(t,e){let i=this.skeleton;if(i===void 0)return;let r=this.geometry;vO.fromBufferAttribute(r.attributes.skinIndex,t),bO.fromBufferAttribute(r.attributes.skinWeight,t),yO.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let s=0;s<4;s++){let n=bO.getComponent(s);if(n!==0){let a=vO.getComponent(s);_O.multiplyMatrices(i.bones[a].matrixWorld,i.boneInverses[a]),e.addScaledVector(XY.copy(yO).applyMatrix4(_O),n)}}return e.applyMatrix4(this.bindMatrixInverse)}}});function fv(t){if(Array.isArray(t.material)){for(let e of t.material)if(e.getLayersOfType("outline").length===0)return}else if(!i4(t.material)||t.material.getLayersOfType("outline").length===0)return;t instanceof Fr&&t.is2DAndNoDepth?function(e){if(e.geometry.attributes.extrudeNormals||!e.geometry.attributes.position)return;let i=e.geometry.attributes.position.array,r=new Float32Array(i.length),s=new P;for(let n=0;n<i.length;n+=3)s.set(i[n],i[n+1],i[n+2]).normalize(),r[n]=s.x,r[n+1]=s.y,r[n+2]=s.z;e.geometry.setAttribute("extrudeNormal",new me(r,3))}(t):function(e){if(e.geometry.attributes.extrudeNormal||!e.geometry.attributes.position||!e.geometry.attributes.normal)return;let i=new Map,r=e.geometry.attributes,s=r.position.array,n=r.normal.array,a=new Float32Array(s.length);for(let o=0;o<s.length;o+=3){let l=`${s[o]}_${s[o+1]}_${s[o+2]}`,u=new P(n[o],n[o+1],n[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<s.length;o+=3){let l=`${s[o]}_${s[o+1]}_${s[o+2]}`,u=i.get(l)?.result;u&&(a[o]=u.x,a[o+1]=u.y,a[o+2]=u.z)}e.geometry.setAttribute("extrudeNormal",new me(a,3))}(t)}function xO(t){return Math.min(2047,Math.max(1,Math.round(2048*t)))/2048}function gv(t){if(!t.geometry.attributes.position)return;let e=t.geometry.attributes,i=e.position.array,r=e.randomColor;if(r!==void 0&&3*r.count===i.length)return;let s=new Float32Array(i.length),n=parseInt(t.uuid.replace(/\D/g,"")),a=[xO(Yt.seededRandom(n)),xO(Yt.seededRandom(n+1e4)),xO(Yt.seededRandom(n+2e4))];for(let o=0;o<i.length;o++)s[o]=a[o%3];t.geometry.setAttribute("randomColor",new Se(s,3))}var _5=W(()=>{yt(),W7(),bo()});function YY(t){let e=!1;return t.scene.objects.traverse((i,r)=>{r.geometry?.type==="BooleanGeometry"&&(e=!0)}),e}function fMt(t,e){let i=t.cloner;return i!==void 0&&i.parent===e?i:void 0}function KY(t,e,i,r){let s=16*(e.children.length+1);Ww.length<s&&(Ww=new Float32Array(s));let n=0,a=l=>{l.toArray(Ww,16*n),n++},o=e.parameters.hideBase!==!0;o&&a(r),MU.multiplyMatrices(t.hiddenMatrix,t.matrix);for(let l of e.children)!Sg(l)||l.playModeVisible===!1||(AU.multiplyMatrices(l.hiddenMatrix,l.matrix).multiply(l.pivotMatrix),bP.multiplyMatrices(MU,AU),(!o||!bP.equals(r))&&a(bP));try{return n===0?0:function(l,u){return j7(e4().instanced_union(U7(l),u))}(i,Ww.subarray(0,16*n))}finally{Pmt(i)}}var pd,ZY,MU,AU,bP,Ww,om,d4,x5,Wh,$u,c4,US=W(()=>{la(),yt(),f5(),_5(),n0(),ss(),pd=new At,ZY=new At,MU=new At,AU=new At,bP=new At,Ww=new Float32Array(0),om=class extends yo{constructor(t,e,i){super(t,e),this.data=e,this.meshSetAddresses=[],this.needsTransformForDownstream=!1,this.geometry=new ye,this.onAfterRender=(r,s,n,a,o,l)=>{super.onAfterRender(r,s,n,a,o,l),this.recomputeBoolean()},this.geometry.userData.parameters={width:0,height:0,depth:0}}get booleanOp(){return this.data.geometry.operation}get phongAngle(){return this.data.geometry.phongAngle??45}get isLOD(){return this.recomputeBoolean(),!1}updateByPatchedOp(t,e,i){super.updateByPatchedOp(t,e,i),t.path.length===1&&t.path[0]==="geometry"&&t.type===0&&t.props.operation!==void 0&&(this.freeBooleanPointer(),this.resetBBoxNeedsUpdate())}freeBooleanPointer(){super.freeBooleanPointer(),this.geometry.dispose()}recomputeBoolean(t,e=!0){if(this.booleanMeshSetAddress!==-1&&!t)return;for(let r=0;r<this.children.length;r++){let s=this.children[r];s instanceof om&&s.dataPatched.visible===!0&&s.recomputeBoolean(t===!0,e)}this.meshSetAddresses=[];for(let r=0;r<this.children.length;r++){let s=this.children[r];if(s instanceof Is&&s.dataPatched.visible===!0&&s.geometry.attributes.position?.count>0&&s.geometry.drawRange.count>0&&s.booleanMeshSetAddress!==0){pd.multiplyMatrices(s.hiddenMatrix,s.matrix).multiply(s.pivotMatrix);try{let n=fMt(s,this);if(s.booleanMeshSetAddress===-1){if((s.geometry.index??s.geometry.getAttribute("position")).count/3<15e5){let a=VTt(s.geometry,t===!0);s.booleanMeshSetAddress=n===void 0||a===-1?a:KY(s,n,a,pd)}if(s.booleanMeshSetAddress===-1)return;n===void 0&&QD(s.booleanMeshSetAddress,pd),s.booleanMatrixInvOld.copy(pd).invert(),s.booleanWasTransformed=!1}else s instanceof om&&s.needsTransformForDownstream===!0?(n===void 0?QD(s.booleanMeshSetAddress,pd):s.booleanMeshSetAddress=KY(s,n,s.booleanMeshSetAddress,pd),s.needsTransformForDownstream=!1):s.booleanWasTransformed===!0&&(QD(s.booleanMeshSetAddress,ZY.multiplyMatrices(pd,s.booleanMatrixInvOld)),s.booleanMatrixInvOld.copy(pd).invert(),s.booleanWasTransformed=!1)}catch(n){console.error(n),s.booleanMeshSetAddress=0,s.geometry.userData.booleanOperationDidFail=!0;continue}if(s.booleanMeshSetAddress===0)continue;this.meshSetAddresses.push(s.booleanMeshSetAddress),s.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 ye,this.geometry.userData=r.userData,this.geometry.boundingSphere=r.boundingSphere,this.geometry.setAttribute("position",new me([],3))}return void this.geometry.setDrawRange(0,0)}if(t===!0)return function(r,s){let n=e4(),a=$X(r,s),o=n.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 ye,this.geometry.userData=i.userData,this.geometry.boundingSphere=i.boundingSphere;try{this.booleanMeshSetAddress=function(r,s,n,a){let o=e4(),l=$X(r,s),u=o.mesh_render_data(l,Math.max(a,0));if(n.setAttribute("position",new me(u.positions(),3)),n.setAttribute("normal",new me(u.normals(),3)),u.free(),n.boundingSphere===null&&(n.boundingSphere=new Zn),l.tri_count()===0)n.boundingSphere.center.set(0,0,0),n.boundingSphere.radius=0,n.userData.parameters={width:0,height:0,depth:0};else{let h=l.bounds();n.boundingSphere.center.set(h[0],h[1],h[2]),n.boundingSphere.radius=(h[3]**2+h[4]**2+h[5]**2)**.5,n.userData.parameters={width:2*h[3],height:2*h[4],depth:2*h[5]}}return j7(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,fv(this),gv(this)}dispose(){super.dispose(),this.geometry.dispose()}}}),jS=W(()=>{yt(),vo(),s0(),(d4||(d4={})).is=function(t){return Ai.is(t)&&t instanceof qd},x5=(t,e)=>class extends r0(t,e){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 s=this.shadow;s.camera.far=i.depth,s.needsUpdate=!0}i.shadows!==void 0&&(this.castShadow=i.shadows)}}}),xm=W(()=>{yt(),US(),la(),s0(),Wh=t=>t instanceof Is,$u=t=>t!==null&&t instanceof om,c4=t=>Q8.is(t)});function Sa(t,e){return e.color(t)}function QY(t=new Date,e){let i=e.format,r=t.getSeconds(),s=t;e&&e.timeZone!==null&&(s=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),m=f=>Number(p.find(g=>g.type===f)?.value);return new Date(m("year"),m("month")-1,m("day"),m("hour"),m("minute"),m("second"),d.getMilliseconds())}catch{return new Date(NaN)}}(new Date,e.timeZone));let n,a=s.getHours(),o=s.getMinutes();e.format12h24h==="12ampm"&&(n=a>=12?"PM":"AM");let l,u,h=a;switch(e.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],n=void 0;break;case"mm":l=[o],n=void 0;break;case"ss":l=[r],n=void 0;break;case"year":u=s.getFullYear();break;case"month":u=s.getMonth()+1;break;case"dayOfYear":u=Math.floor((s.getTime()-new Date(s.getFullYear(),0,0).getTime())/864e5);break;case"dayOfMonth":u=s.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:n}:u}var CU,tb,oG=W(()=>{}),gMt=W(()=>{yt(),VS(),kS(),CU=class extends $v(cpt){constructor(t,e=15,i=10066329){super(t,e,i),this.object=t,this.added=!1,this.name=`DirectionalLightHelper: ${t.uuid}`}raycast(t,e){Xv(this.object,CU.geometryHelper,t,e)}}}),w5=W(()=>{yt(),gMt(),jS(),tb=class extends x5(lS,CU){constructor(t,e,i){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=2048,this.shadow.mapSize.height=2048,this.shadow.normalBias=1,this.layers.enable(3);let r=this.shadow.camera;r.top=1250,r.bottom=-1250,r.right=1250,r.left=-1250,r.near=-1e4,r.far=2500;let s=new hS(this.shadow.camera);s.visible=!1,this.gizmos.shadowmap=s}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this.gizmos){let e=this.gizmos[t];e instanceof hS&&e.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e);let i=t.depth!==void 0&&t.depth!==this.shadow.camera.far||t.size!==void 0&&t.size/2!==this.shadow.camera.right;t.size!==void 0&&function(r,s){r.shadow.camera.right=s/2,r.shadow.camera.left=-s/2,r.shadow.camera.top=s/2,r.shadow.camera.bottom=-s/2,r.shadow.needsUpdate=!0}(this,t.size),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),t.penumbraSize!==void 0&&e.scene.markPenumbraSizeDirty(),i&&this.update()}}});function lG(t){return t instanceof yo&&t.needsAO&&!cm(t)&&t.isDecalObject!==!0}function hG(t){let e=t.cloner;if(e&&Array.isArray(e.children))for(let i of e.children)i?.layers&&(i.layers.mask=t.layers.mask)}function uG(t){return t.getLayersOfType("reflection").filter(e=>e.data.visible).length}function yMt(t){let e=1/0,i=-1/0;for(let r of t.getLayersOfType("reflection")){let s=r.data;if(!s.visible||s.mirror===1)continue;let n=typeof s.blur=="number"?s.blur:null;e=Math.min(e,n??0),i=Math.max(i,n??10)}return e===1/0?null:{min:e,max:i}}function vMt(t){for(let e of t.getLayersOfType("reflection")){let i=e.data;if(!i.visible)continue;let{blur:r,thickness:s,steps:n,stepSize:a}=i;return typeof r!="number"||typeof s!="number"||typeof n!="number"||typeof a!="number"?"variable":{blur:r,thickness:s,steps:n,stepSize:a,tracingMode:i.tracingMode===1?1:0}}return null}function JY(t,e){let i={outline:!1,cavity:!1},r=t.layers.mask&S5,s=e.getLayersOfType("transmission"),n=e.getLayersOfType("outline"),a=uG(e),o=e.getLayersOfType("cavity");return(n.length>0||o.length>0)&&(t.layers.set(8),s.length>0&&t.layers.enable(3),a>0&&t.layers.enable(4),i.outline=n.length>0,i.cavity=o.length>0,gv(t),fv(t)),s.length===0&&n.length===0&&o.length===0&&a===0&&t.layers.set(0),r&&t.layers.set(9),!r&&lG(t)&&t.layers.enable(5),hG(t),i}function tK(t,e){if(!e.layers)return!1;let i=t.layers.mask&S5,r=!1,s=e.getLayersOfType("transmission").filter(l=>l.data.visible),n=e.getLayersOfType("outline").filter(l=>l.data.visible),a=uG(e),o=e.getLayersOfType("cavity").filter(l=>l.data.visible);return s.length>0&&(t.layers.set(3),(n.length>0||o.length>0)&&t.layers.enable(8),a>0&&t.layers.enable(4),r=!0),s.length===0&&n.length===0&&o.length===0&&a===0&&t.layers.set(0),i&&t.layers.set(9),!i&&lG(t)&&t.layers.enable(5),hG(t),r}function eK(t,e){var i;if(!e.layers)return!1;let r=t.layers.mask&S5,s=!1,n=uG(e),a=e.getLayersOfType("transmission").filter(u=>u.data.visible),o=e.getLayersOfType("outline").filter(u=>u.data.visible),l=e.getLayersOfType("cavity").filter(u=>u.data.visible);return n>0&&((i=t.userData).__splinePlanarMirror??(i.__splinePlanarMirror=0),t.layers.set(4),a.length>0&&t.layers.enable(3),(o.length>0||l.length>0)&&t.layers.enable(8),s=!0),n===0&&a.length===0&&o.length===0&&l.length===0&&t.layers.set(0),r&&t.layers.set(9),!r&&lG(t)&&t.layers.enable(5),hG(t),s}function EU(t,e,i,r=!1){let s=t.cloner;if(s){let n=null;if(t.raycast===Ar.prototype.raycast||t.raycast===Is.prototype.raycast){let a=t.geometry;a&&(a.boundingSphere===null&&a.computeBoundingSphere(),n=a.boundingSphere)}for(let a of s.children){if(n!==null&&(PU.copy(n).applyMatrix4(a.matrixWorld),!e.ray.intersectsSphere(PU)))continue;let o=zft.copy(a.matrixWorld).invert(),l=Lft.copy(e.ray).applyMatrix4(o),u=t.matrixWorld;l.applyMatrix4(u);let h=kft;h.set(l.origin,l.direction),h.near=e.near,h.far=e.far,h.layers.mask=e.layers.mask;let d=h.intersectObject(t,!1);d.length>0&&i.push({...d[0],object:r?a:t})}}}var S5,kft,zft,Lft,PU,MM,Fft,wO,SO,TO,eb,qs,dG=W(()=>{ss(),_5(),la(),n0(),yt(),S5=512,kft=new d7,zft=new At,Lft=new pc,PU=new Zn}),bMt=W(()=>{yt(),VS(),kS(),MM=class extends $v(upt){constructor(t,e=6710886){super(t,e),this.object=t,this.matrix=t.matrixWorld,this.name=`SpotLightHelper: ${t.uuid}`}raycast(t,e){Xv(this.object,MM.geometryHelper,t,e)}update(){if(this.object!==void 0){let t=MM._vector,e=this.object.distance?this.object.distance:1e3,i=e*Math.tan(this.object.angle);this.cone.scale.set(i,i,e),t.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(t);let r=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let s=0,n=this.cone.material.length;s<n;s++)this.cone.material[s].color.set(r);else this.cone.material.color.set(r)}}},(Fft=MM)._vector=new P}),T5=W(()=>{yt(),bMt(),jS(),wO=new P,SO=new P,TO=new Pe,eb=class extends x5(Vg,Fft){constructor(t,e,i){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let r=this.shadow.camera;r.fov=2*Yt.RAD2DEG*this.angle,r.aspect=1,r.near=100,r.far=2500;let s=new hS(this.shadow.camera);s.visible=!1,this.gizmos.shadowmap=s,this.update()}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this.gizmos){let e=this.gizmos[t];e instanceof hS&&e.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),SO.setFromMatrixPosition(this.matrixWorld),TO.setFromRotationMatrix(this.matrixWorld),wO.copy(this.up).applyQuaternion(TO).negate().multiplyScalar(this.distance),this.target.position.copy(SO).add(wO),this.target.updateMatrixWorld(),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.angle!==void 0&&(this.angle=t.angle),t.penumbra!==void 0&&(this.penumbra=t.penumbra),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.penumbraSize!==void 0&&e.scene.markPenumbraSizeDirty(),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null))}}}),Rc=W(()=>{Le(),Zh(),yt(),vo(),Pc(),oG(),V7(),w5(),Fi(),_m(),yt(),n0(),xm(),dG(),T5(),Ii(),US(),qs=class extends p5(Ku){constructor(t,e,i){if(super(),this.data=e,this.bgColor=new Dr(1,1,1,1),this.fog=null,this.backupFog=new BF(16777215,.1,2e3),this.fogUseBGColor=!1,this.fogMode="linear",this.fogDensity=Jn.getDensity({}),this.fogHeightFalloff=Jn.getHeightFalloff({}),this.fogHeightBase=Jn.getHeightBase({}),this.isActive=!1,this.skyState=null,this.skyStateVersion=0,this.gradingState=null,this.skyHdriHolder=null,this.aoColor=new oe,this.penumbraSizeArrayCache=null,this.super_Entity(t,e),this.personalCamera=new ln(i0,{...B2.defaultData,...e.camera,name:"Personal Camera"}),this.personalCamera.objectHelper.visible=!1,this.add(this.personalCamera),this.activeCamera=this.personalCamera,this.ambientLight=new Q4(13882323,8553090,.75*Math.PI),this.ambientLight.name="Default Ambient Light",this.ambientLight.layers.enable(3),this.ambientLight.removeFromParent(),this.add(this.ambientLight),e.uiScene){let r=$8();r===null?Pn("ui-2d","a page's 2D scene"):this.uiScene=new r.Scene2D((Array.isArray(t)?t[0]:t)+"-ui",e.uiScene,{dpr:window.devicePixelRatio,shared:i.shared})}else e.uiFrame&&this.createUICanvas(e.uiFrame,i)}get scene(){return this.parent}get postprocessing(){return this.data.postprocessing}get frameId(){return this.data.uiFrame}get frame(){return this.uiCanvas?.frame}createUICanvas(t,e){let i=$8();i!==null?(this.uiCanvas=new i.UICanvas(this.uuid+"-uiscreen",window.innerWidth,window.innerHeight,e),this.uiCanvas.isScreenSpace=!0,this.uiCanvas.promise.then(()=>{this.uiCanvas?.applyFrame(t),this.uiCanvas?.applySize()})):Pn("ui-2d","a page's UI canvas")}updateVisible(){}setBackgroundColor(t){this.bgColor=t,this.fogUseBGColor===!0&&(this.backupFog.color=t)}entityChildrenCount(){return this.uiScene?this.uiScene.children.length:super.entityChildrenCount()}updateAmbientLight(t,e){t.color!==void 0&&(this.ambientLight.color=Sa(t.color,e)),t.intensity!==void 0&&(this.ambientLight.intensity=t.intensity*Math.PI),t.enabled!==void 0&&(t.enabled?this.add(this.ambientLight):this.remove(this.ambientLight))}onDeactive(){this.isActive=!1}onActive(t){this.isActive=!0,t.fog=this.fog,this.traverseEntity(e=>{e instanceof om&&e.recomputeBoolean()}),this.updateShadow(this.data.shadow)}forceMaterialsUpdate(){this.traverseEntity(t=>{if(t instanceof yo)if(Array.isArray(t.material))for(let e of t.material)e.needsUpdate=!0;else t.material.needsUpdate=!0,t.material.dispose()})}updateShadow(t){if(t.softShadowQuality===void 0&&t.type===void 0||!this.isActive)return;let e=this.data.shadow;uv.isSoft(e)}updateFog(t,e){t.enabled?this.fog=this.backupFog:this.fog=null,this.isActive&&(this.scene.fog=this.fog),this.fogUseBGColor=t.useBackgroundColor,t.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=Sa(t.color,e),this.backupFog.near=t.near,this.backupFog.far=t.far,this.fogMode=Jn.getMode(t),this.fogDensity=Jn.getDensity(t),this.fogHeightFalloff=Jn.getHeightFalloff(t),this.fogHeightBase=Jn.getHeightBase(t)}updateSky(t,e){this.skyState=t??null,this.skyStateVersion++;let i=t?.hdri?.image;this.skyHdriHolder=i!=null?e.image(i):null}updateAo(t,e){t.aoColor!==void 0&&(this.aoColor=Sa(t.aoColor,e))}updateByOp(t,e,i,r){let s=this.data.uiFrame;super.updateByOp(t,e,i,r);let n=e;tr(t.path,["fog"])?this.updateFog(n.fog,i.shared):tr(t.path,["sky"])?this.updateSky(n.sky,i.shared):tr(t.path,["grading"])?this.gradingState=n.grading??null:tr(t.path,["ao"])?this.updateAo(n.ao,i.shared):tr(t.path,["ambient"])?this.updateAmbientLight(n.ambient,i.shared):tr(t.path,["shadow"])?this.updateShadow(n.shadow):t.type===0&&t.path.length===0&&(t.props.uiFrame!==void 0||s!==n.uiFrame)&&this.updateUIFrame(t.props.uiFrame,i)}updateUIFrame(t,e){t?(this.uiCanvas||this.createUICanvas(t,e),this.uiCanvas.enabled=!0,this.uiCanvas.applyFrame(t)):this.uiCanvas&&(this.uiCanvas.enabled=!1)}updateState(t,e){this.updateState_Entity(t,e),t.backgroundColor!==void 0&&this.setBackgroundColor(Sa(t.backgroundColor,e.shared)),t.fog!==void 0&&this.updateFog(t.fog,e.shared),t.sky!==void 0&&this.updateSky(t.sky,e.shared),t.grading!==void 0&&(this.gradingState=t.grading),t.ambient!==void 0&&this.updateAmbientLight(t.ambient,e.shared),t.ao!==void 0&&this.updateAo(t.ao,e.shared),t.shadow!==void 0&&this.updateShadow(t.shadow)}createFrame(t,e){}raycast(t,e){super.raycast(t,e)}switchActiveCamera(t){t&&t.isDescendantOf(this)&&(this.activeCamera!==this.personalCamera&&(this.activeCamera.objectHelper.visible=!0),this.activeCamera=t,t.objectHelper.visible=!1)}get playCamera(){return this.scene?.find(this.data.publish.playCamera)??this.personalCamera}switchToPlayCamera(){this.switchActiveCamera(this.playCamera)}get penumbraSizeArray(){return this.penumbraSizeArrayCache===null&&this.updatePenumbraSizeArray(),this.penumbraSizeArrayCache}updatePenumbraSizeArray(){this.penumbraSizeArrayCache=new Array(W8).fill(.5);let t=0,e=0;this.traverseEntity(i=>{if(!i.visible)return!0;i instanceof tb&&i.visible&&t<pP&&(this.penumbraSizeArrayCache[t]=i.data.penumbraSize??.5,t+=1),i instanceof eb&&i.visible&&t<W8-pP&&(this.penumbraSizeArrayCache[pP+e]=i.data.penumbraSize??.5,e+=1)})}raycastWithClones(t){let e=[],i=r=>{for(let s of r.children){let n=s.cloner;Ai.is(s)&&(s.visible||n?.object.data.visible)&&((Wh(s)||c4(s)&&this.scene.enableHelpers&&s.objectHelper.visible)&&(t.intersectObject(s,!1,e),EU(s,t,e,!0)),i(s))}};return i(this),e}updateEntity2DByOp(t,e,i,r){this.uiCanvas?.updateEntity2DByOp(t,e,i,r)}}});function iK(){return cG}function MO(){if(RU===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 RU}function AO(t){return t?.isWebGPUSplineRenderer===!0}var cG,RU,Uft=W(()=>{cG=null,RU=null});function NU(){return mG}var pG,mG,fG=W(()=>{pG=null,mG=null});function rK(t,e,i){return qw.setRGB(t,e,i,Ns),{r:qw.r,g:qw.g,b:qw.b}}function _Mt(t,e,i){let r,s=SS(t.angle,0),[n,a]=DU(t.offset),[o,l]=DU(t.morph),u=t.colors??[],h=t.steps??[],d=Math.min(10,u.length,h.length);if(d===0)return[1,1,1,1];if(t.gradientType===1){let g=3*(e+o)-(e+n)-1,y=3*(i+l)-(i+a)-1;r=Math.hypot(g,y)+s}else if(t.gradientType===2){let g=-1*Math.atan2(e+o-.5+n,i+l-.5+a),y=s/Math.PI/-2+.5*g/Math.PI;r=y-Math.floor(y)}else{let g=.5+o/(e!==0?e:1e-6),y=l/(i!==0?i:1e-6),v=Math.cos(s)*g-Math.sin(s)*y,b=Math.sin(s)*g+Math.cos(s)*y,_=v*v+b*b;r=_>1e-12?(((e-.5+n)/2+v/2)*v+((i-.5+a)/2+b/2)*b)/_:0}let c=u[0][0],p=u[0][1],m=u[0][2],f=u[0][3];for(let g=1;g<d;g++){let y=h[g-1],v=h[g]-y,b=v!==0?Math.min(1,Math.max(0,(r-y)/v)):r>=y?1:0;t.smooth&&(b=b*b*(3-2*b)),c+=(u[g][0]-c)*b,p+=(u[g][1]-p)*b,m+=(u[g][2]-m)*b,f+=(u[g][3]-f)*b}return[c,p,m,f]}function xMt(t,e){let i=t,r=i?.data?.layers;if(r&&typeof r.forEach=="function"){let s=e,n=[];return r.forEach(a=>{let o=a.data;if(o.visible===!1||o.isMask===!0)return;let l=SS(o.alpha,1);if(!(l<=0))if(o.type==="color"){let u,h=o.color;typeof h=="string"?u=typeof s?.color=="function"?s.color(h):void 0:h&&typeof h.r=="number"&&(u=h),u&&n.push({kind:"color",layer:o,rgb:{...rK(u.r,u.g,u.b),a:u.a??1},alpha:l})}else o.type==="gradient"&&n.push({kind:"gradient",layer:o,alpha:l})}),n.length===0?null:(a,o)=>{let l=1,u=1,h=1,d=!0;for(let c of n){let p,m,f,g;if(c.kind==="color")({r:p,g:m,b:f}=c.rgb),g=c.rgb.a;else{let[v,b,_,x]=_Mt(c.layer,a,o);({r:p,g:m,b:f}=rK(v,b,_)),g=x}let y=d?1:Math.min(1,Math.max(0,g*c.alpha));l+=(p-l)*y,u+=(m-u)*y,h+=(f-h)*y,d=!1}return{r:l,g:u,b:h}}}if(i?.color&&i.color.isColor===!0){let{r:s,g:n,b:a}=i.color;return()=>({r:s,g:n,b:a})}return null}var qw,SS,DU,wMt=W(()=>{yt(),qw=new oe,SS=(t,e)=>typeof t=="number"&&Number.isFinite(t)?t:e,DU=t=>Array.isArray(t)&&typeof t[0]=="number"&&typeof t[1]=="number"?[t[0],t[1]]:[0,0]});function SMt(t,e){if(t==="torus"){let l=e()*Math.PI*2,u=e()*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(t==="cylinder"){let l=e()*Math.PI*2,u=Math.cos(l),h=Math.sin(l);return{x:.8*u,y:1.6*(e()-.5),z:.8*h,nx:u,ny:0,nz:h,cr:1,cg:1,cb:1}}let i=e()*Math.PI*2,r=2*e()-1,s=Math.acos(r),n=Math.sin(s)*Math.cos(i),a=Math.cos(s),o=Math.sin(s)*Math.sin(i);return{x:n,y:a,z:o,nx:n,ny:a,nz:o,cr:1,cg:1,cb:1}}function TMt(t){let{geometry:e,matrix:i}=t,r=e.getAttribute("position");if(!r||r.count<3)return null;let s=e.getAttribute("normal"),n=e.getAttribute("uv"),a=e.getAttribute("color"),o=e.getIndex(),l=o?o.count/3:r.count/3;if(l<1)return null;let u=(y,v)=>o?o.getX(3*y+v):3*y+v,h=i?i.elements:null,d=i?new Ss().getNormalMatrix(i).elements:null,c=y=>{let v=r.getX(y),b=r.getY(y),_=r.getZ(y);return h?h[0]*v+h[4]*b+h[8]*_+h[12]:v},p=y=>{let v=r.getX(y),b=r.getY(y),_=r.getZ(y);return h?h[1]*v+h[5]*b+h[9]*_+h[13]:b},m=y=>{let v=r.getX(y),b=r.getY(y),_=r.getZ(y);return h?h[2]*v+h[6]*b+h[10]*_+h[14]:_},f=new Float64Array(l),g=0;for(let y=0;y<l;y++){let v=u(y,0),b=u(y,1),_=u(y,2),x=c(v),S=p(v),w=m(v),M=c(b)-x,T=p(b)-S,A=m(b)-w,C=c(_)-x,R=p(_)-S,O=m(_)-w,D=T*O-A*R,B=A*C-M*O,k=M*R-T*C;g+=.5*Math.sqrt(D*D+B*B+k*k),f[y]=g}return g<=0?null:{total:g,sample:(y,v)=>{let b=0,_=l-1;for(;b<_;){let et=b+_>>1;f[et]<y?b=et+1:_=et}let x=b,S=u(x,0),w=u(x,1),M=u(x,2),T=v(),A=v();T+A>1&&(T=1-T,A=1-A);let C,R,O,D=1-T-A,B=c(S)*D+c(w)*T+c(M)*A,k=p(S)*D+p(w)*T+p(M)*A,j=m(S)*D+m(w)*T+m(M)*A;if(s){if(C=s.getX(S)*D+s.getX(w)*T+s.getX(M)*A,R=s.getY(S)*D+s.getY(w)*T+s.getY(M)*A,O=s.getZ(S)*D+s.getZ(w)*T+s.getZ(M)*A,d){let et=d[0]*C+d[3]*R+d[6]*O,at=d[1]*C+d[4]*R+d[7]*O,Q=d[2]*C+d[5]*R+d[8]*O;C=et,R=at,O=Q}}else{let et=c(S),at=p(S),Q=m(S),ut=c(w)-et,ht=p(w)-at,q=m(w)-Q,nt=c(M)-et,Tt=p(M)-at,gt=m(M)-Q;C=ht*gt-q*Tt,R=q*nt-ut*gt,O=ut*Tt-ht*nt}let z=Math.sqrt(C*C+R*R+O*O)||1,V=1,H=1,U=1;if(a)V=a.getX(S)*D+a.getX(w)*T+a.getX(M)*A,H=a.getY(S)*D+a.getY(w)*T+a.getY(M)*A,U=a.getZ(S)*D+a.getZ(w)*T+a.getZ(M)*A;else if(t.sampleColor){let et=n?n.getX(S)*D+n.getX(w)*T+n.getX(M)*A:.5,at=n?n.getY(S)*D+n.getY(w)*T+n.getY(M)*A:.5,Q=t.sampleColor(et,at);Q&&(V=Q.r,H=Q.g,U=Q.b)}return{x:B,y:k,z:j,nx:C/z,ny:R/z,nz:O/z,cr:V,cg:H,cb:U}}}}function sK(t){let e=Math.min(Math.max(1,Math.floor(t.guideStrands)),yv),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}}(t.seed??1337),r=t.shape==="object"&&t.sampler,s=r?t.samplerRadius??kh:kh,n=new Float32Array(4*ec),a=new Float32Array(ec),o=new Float32Array(4*yv).fill(1);for(let l=0;l<e;l++){let u=r?t.sampler(i):SMt(t.shape,i),h=r?u.x:u.x*s,d=r?u.y:u.y*s,c=r?u.z:u.z*s,{nx:p,ny:m,nz:f}=u;o[4*l+0]=u.cr,o[4*l+1]=u.cg,o[4*l+2]=u.cb;let g,y,v,b=l*pg,_=(1.8+.8*i())*t.hairLength*s/(pg-1),x=.5+1.5*i(),S=(.02+.06*i())*s;Math.abs(m)<.99?(g=-f,y=0,v=p):(g=1,y=0,v=0);let w=Math.sqrt(g*g+y*y+v*v)||1;for(let M=0;M<pg;M++){let T=M/(pg-1),A=T*T*.4*s,C=S*Math.sin(T*x*Math.PI*2),R=4*(b+M);n[R+0]=h+p*_*M+C*g/w,n[R+1]=d+m*_*M-A+C*y/w,n[R+2]=c+f*_*M+C*v/w,n[R+3]=M===0?0:1,M<pg-1&&(a[b+M]=_)}}return{initialPositions:n,restLengths:a,unitScale:s,rootColors:o}}var pg,yv,ec,kh,zp,s_,F0,ef,U0,_P,jft=W(()=>{yt(),ec=(yv=16384)*(pg=32),kh=100}),Gft=W(()=>{yt(),la(),fG(),wMt(),jft(),zp=1/60,s_=new At,F0=new Pe,ef=new P,U0=new P,_P=class extends Is{constructor(t,e,i){super(t,e),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 Pe,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=e,this.geometry.setAttribute("position",new Se(new Float32Array(0),3)),this.material=new Uo({colorWrite:!1,depthWrite:!1}),this.frustumCulled=!1,this.scalpMesh=new Ar(new Tc(kh,48,32),new Uo({color:5448477})),this.scalpMesh.name="HairScalp",this.add(this.scalpMesh);let r=new AR;r.setAttribute("position",new Se(new Float32Array(12),3)),r.setIndex([0,2,1,2,3,1]),r.instanceCount=0,this.ribbonMesh=new Ar(r,new Uo({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=e.guideStrands,this.roots=this.buildRoots(),this.regenSnapshot={guideStrands:e.guideStrands,hairLength:e.hairLength,spreadRadius:e.spreadRadius,headShape:e.headShape,baseObjectId:e.baseObjectId},this.applyScalpState(),this.applyShadowState(),this.syncSimRunning()}update(t){!this.simRunning||(this.pendingSimSeconds=Math.min(this.pendingSimSeconds+t/1e3,4*zp*2),this.trackMotionRest(t/1e3))}trackMotionRest(t){this.boneTransform(F0,ef);let e=this.hasLastBone&&(Math.abs(this.lastBoneQuat.dot(F0))<.9999995||this.lastBonePos.distanceToSquared(ef)>1e-8),i=this.motionFingerprint(),r=!this.hasLastBone||e||this.resetRequested||i!==this.lastMotionFingerprint||this.data.windStrength>.001;this.lastBoneQuat.copy(F0),this.lastBonePos.copy(ef),this.lastMotionFingerprint=i,this.hasLastBone=!0,this.settledSimSeconds=r?0:this.settledSimSeconds+t}motionFingerprint(){let t=this.data;return t.gravity+2*t.damping+3*t.localStiffness+4*t.globalStiffness+5*t.globalRange+6*t.stiffnessFalloff+7*t.windStrength+8*t.vspCoefficient+9*t.kink+10*t.kinkFrequency+11*t.clumpStrength+12*t.clumpSize+13*t.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(t){this.playModeActive=t,t&&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(t,e){super.updateState(t,e),this.updateHairState(t)}updateHairState(t){if((t.guideStrands!==void 0||t.hairLength!==void 0||t.spreadRadius!==void 0||t.headShape!==void 0||t.baseObjectId!==void 0)&&this.regenerate(),(t.headShape!==void 0||t.baseObjectId!==void 0)&&this.applyScalpState(),t.headColor!==void 0){let e=this.scalpMesh.material;e.isMeshBasicMaterial===!0&&e.color.setRGB(t.headColor.r,t.headColor.g,t.headColor.b,Ns)}(t.castShadow!==void 0||t.receiveShadow!==void 0)&&this.applyShadowState(),t.autoPlay!==void 0&&this.syncSimRunning()}applyShadowState(){let t=this.data.castShadow??!0,e=this.data.receiveShadow??!0;this.castShadow=t,this.receiveShadow=e,this.scalpMesh.castShadow=t,this.scalpMesh.receiveShadow=e,this.ribbonMesh.castShadow=t,this.ribbonMesh.receiveShadow=e}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 t=this.data,e=this.regenSnapshot;if(e===null||e.guideStrands!==t.guideStrands||e.hairLength!==t.hairLength||e.spreadRadius!==t.spreadRadius||e.headShape!==t.headShape||e.baseObjectId!==t.baseObjectId){let i=e===null||e.headShape!==t.headShape||e.baseObjectId!==t.baseObjectId;this.regenerate(),i&&this.applyScalpState()}this.syncSimRunning(),this.applyShadowState(),this.checkBaseDrift()}buildRoots(){let{headShape:t,baseObjectId:e,guideStrands:i,hairLength:r}=this.data;if(this.baseFoundAtRegen=!1,this.baseSourceGeomsAtRegen=[],this.baseSourceHashesAtRegen=[],this.baseColorHashAtRegen=0,this.baseScaleAtRegen=0,t==="object"&&e){let s=this.context.scene.find(e);if(s){this.baseFoundAtRegen=!0,s.updateWorldMatrix(!0,!0);let n=this.collectBaseSources(s),a=n?function(o){let l=[];for(let d of o){let c=TMt(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,m=l.length-1;for(;p<m;){let g=p+m>>1;u[g]<c?p=g+1:m=g}let f=p===0?c:c-u[p-1];return l[p].sample(f,d)}}(n.sources):null;if(this.baseSourceGeomsAtRegen=n?.sources.map(o=>o.geometry)??[],this.baseSourceHashesAtRegen=n?.hashes??[],this.baseColorHashAtRegen=n?.colorHash??0,n&&a){let o=this.baseWorldScale(s),l=Math.max(n.radius*o,.001);this.baseScaleAtRegen=o;let u=o;return sK({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 sK({shape:t==="object"?"sphere":t,guideStrands:i,hairLength:r})}collectBaseSources(t){let e=[],i=[],r=0,s=0;s_.copy(t.matrixWorld).invert();let n=s_.clone(),a=o=>{if(o.isHairSystem===!0||o!==t&&o.visible===!1)return;let l=o.geometry;if(o.isMesh===!0&&l&&(l.getAttribute("position")?.count??0)>=3){let u=o===t?void 0:new At().multiplyMatrices(n,o.matrixWorld),h=Array.isArray(o.material)?o.material[0]:o.material;e.push({geometry:l,matrix:u,sampleColor:xMt(h,this.context.shared)??void 0}),i.push(_P.matrixHash(u)),s+=function(c,p){let m=c,f=0,g=1,y=b=>{f+=b*g,g+=1},v=m?.data?.layers;if(v&&typeof v.forEach=="function"){let b=p;v.forEach(_=>{let x=_.data;if(x.visible!==!1){if(x.type==="color"){let S=x.color,w=typeof S=="string"?typeof b?.color=="function"?b.color(S):void 0:S;w&&typeof w.r=="number"&&(y(w.r),y(w.g),y(w.b)),y(SS(x.alpha,1))}else if(x.type==="gradient"){let S=x;for(let w of S.colors??[])y(w[0]),y(w[1]),y(w[2]),y(w[3]);for(let w of S.steps??[])y(w);y(SS(S.angle,0)),y(S.gradientType),y(S.smooth?1:0)}}})}else m?.color&&m.color.isColor===!0&&(y(m.color.r),y(m.color.g),y(m.color.b));return f}(h,this.context.shared),l.boundingSphere===null&&l.computeBoundingSphere();let d=l.boundingSphere;if(d){let c=0,p=1;u?(ef.copy(d.center).applyMatrix4(u),c=ef.length(),p=_P.matrixMaxScale(u)):c=d.center.length(),r=Math.max(r,c+d.radius*p)}}for(let u of o.children)a(u)};return a(t),e.length===0?null:{sources:e,hashes:i,radius:Math.max(r,.001),colorHash:s}}static matrixHash(t){if(!t)return 0;let e=t.elements,i=0;for(let r=0;r<16;r++)i+=e[r]*(r+1);return i}static matrixMaxScale(t){let e=t.elements,i=Math.hypot(e[0],e[1],e[2]),r=Math.hypot(e[4],e[5],e[6]),s=Math.hypot(e[8],e[9],e[10]);return Math.max(i,r,s,1e-6)}baseWorldScale(t){return s_.copy(t.matrixWorld).decompose(ef,F0,U0),Math.max(Math.abs(U0.x),Math.abs(U0.y),Math.abs(U0.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 t=this.context.scene.find(this.data.baseObjectId);if(!t)return;if(!this.baseFoundAtRegen)return void this.regenerate();t.updateWorldMatrix(!0,!0);let e=this.collectBaseSources(t),i=e?.sources??[],r=e?.hashes??[],s=this.baseSourceGeomsAtRegen,n=this.baseSourceHashesAtRegen,a=i.length!==s.length;if(!a){for(let o=0;o<i.length;o++)if(i[o].geometry!==s[o]||Math.abs(r[o]-n[o])>1e-4*Math.max(Math.abs(n[o]),1)){a=!0;break}}if(!a&&this.data.hairColorSource==="object"&&(e?.colorHash??0)!==this.baseColorHashAtRegen&&(a=!0),!a&&i.length>0){let o=this.baseWorldScale(t);a=Math.abs(o-this.baseScaleAtRegen)>.001*Math.max(this.baseScaleAtRegen,1e-6)}a&&this.regenerate()}applyScalpState(){let t=this.data.headShape,e=t==="object"&&this.data.baseObjectId!==null;this.scalpMesh.visible=!e,!e&&(this.scalpMesh.geometry.dispose(),this.scalpMesh.geometry=t==="torus"?new MR(1.4*kh,.7*kh,24,48):t==="cylinder"?new P2(.8*kh,.8*kh,1.6*kh,48,1):new Tc(kh,48,32))}boneTransform(t,e){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)}s_.copy(i).decompose(e,t,U0)}raycast(t,e){if(!this.scalpMesh.visible)return;let i=[];this.scalpMesh.raycast(t,i);for(let r of i)r.object=this,e.push(r)}get shadowBoundsRadius(){let t=this.data.headShape==="torus"?2.6:1.5;return this.roots.unitScale*(t+2.6*Math.max(this.data.hairLength,0))}getShadowBoundsCenter(t){return this.boneTransform(F0,t),t}updateEntityBoxSize(t,e){let i=this.shadowBoundsRadius;t.set(0,0,0),e.set(i,i,i)}dispose(){super.dispose(),this.scalpMesh.geometry.dispose(),this.scalpMesh.material.dispose(),this.ribbonMesh.geometry.dispose(),this.ribbonMesh.material.dispose?.(),NU()?.release(this)}}});function xP(){return{shapeInput:()=>`
345
345
  const float posRowCoord = ${.5/uc};
346
346
  const float quatRowCoord = ${1.5/uc};
347
347
  const float param1RowCoord = ${2.5/uc};
@@ -5076,11 +5076,11 @@ void main() {
5076
5076
  void main() {
5077
5077
  vec4 texel = texture2D( tDiffuse, vUv );
5078
5078
  gl_FragColor = texel;
5079
- }`}),tEt=new class{constructor(t){this._mesh=new Ar(JCt,t)}dispose(){this._mesh.geometry.dispose()}render(t){t.render(this._mesh,QCt)}get material(){return this._mesh.material}set material(t){this._mesh.material=t}}($vt),OL=null,IL=null,eEt=ri.identity(),Xvt=class{constructor(t,e,i,r){var s;this.uuid=t,this.width=e,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||G2.add(this),this.context.shared.requestRender()},this._innerApplySize=()=>{let n=this.width,a=this.height;this.renderer.dpr=Uht(n,a,this.dpr,this.isScreenSpace),this.renderer.setSize(n,a)},this.onFrameOverrideObjectEvent=n=>{if(n.target?.uuid!==void 0){let a=this.frameRoot?.find(n.target.uuid);a&&a.dispatchEvent({...n,target:a})}},this.scene2d=new uW(Yt.generateUUID(),j8.defaultData,{dpr:window.devicePixelRatio,shared:r.shared}),this.canvas=(OL===null&&(OL=document.createElement("canvas")),OL),this.renderer=(s=this.canvas,IL===null&&(IL=new qCt(s)),IL),this.promise=this.init(),this.renderTarget=new hg(1,1,{type:Qe,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 l7(this.canvas)),this._canvasTexture}async init(){await this.renderer.init(),this.renderer.uiFontReady?.then(()=>{this.frameOverride&&this.onRenderRequestedDownstream()})}render(t){if(this.isFrameDirty){if(this.isFrameDirty=!1,this._innerApplySize(),this.renderer.clear(),this.frameOverride?.draw(this.renderer),this.renderer.render(),this.canvasTexture.needsUpdate=!0,t.blitTextureToTarget)t.blitTextureToTarget(this.canvasTexture,this.renderTarget);else{$vt.uniforms.tDiffuse.value=this.canvasTexture;let e=t.getRenderTarget();t.setRenderTarget(this.renderTarget),t.clear(),tEt.render(t),t.setRenderTarget(e)}this.textureHolder?.setNeedsUpdate(!0)}}updateEntity2DByOp(t,e,i,r){this.scene2d.updateEntityByOp(t,e,i,r),this.applySize()}updateTreeByOp(t,e){this.scene2d.updateTreeByOp(t,e),this.applySize()}applyOverrides(t){if(this.frameOverride&&this.frameRoot){this.frameOverride.position=[0,0],this.frameOverride.rotation=0;let e=t?.width??this.width,i=t?.height??this.height;this.frameOverride.width=e,this.frameOverride.height=i,this.frameOverride.localMatrix=eEt,this.isScreenSpace&&(this.frameOverride.fill.color=Hi.from0to1([0,0,0,0])),this.frameOverride.data={...this.frameOverride.data,width:e,height:i},Yvt({objectOverride:this.frameOverride,objectRoot:this.frameRoot,newParentWidth:this.frameOverride.width,newParentHeight:this.frameOverride.height,initialParentWidth:this.frameRoot.width,initialParentHeight:this.frameRoot.height}),this.frameOverride.updateWorldMatrix(!0,!1,!0)}}applySize(t,e=window.devicePixelRatio){let i=Math.max(1,t?.width??this.width),r=Math.max(1,t?.height??this.height);this.dpr=e,this.width=i,this.height=r,this._innerApplySize();let s=function(n,a,o,l){let u=Uht(n,a,o,l),h=Math.max(o,512/Math.min(n,a)),d=Math.min(h,u);return{width:Math.max(1,Math.ceil(n*d)),height:Math.max(1,Math.ceil(a*d))}}(i,r,e,this.isScreenSpace);this.renderTarget.setSize(s.width,s.height),this._canvasTexture?.dispose(),this._canvasTexture=void 0,this.applyOverrides(t),this.frameOverride?.requestRender()}applyFrame(t){let e=this.context.scene.find2D(t);if(e&&e instanceof Qu)return this.disposeFrameOverride(),this.frameRoot=e,this.frameOverride=e.clone({dpr:this.renderer.dpr,shared:this.context.shared}),this.scene2d.add(this.frameOverride),this.applySize(),this.frame?.addEventListener("render",this.onRenderRequestedDownstream),this.frameOverride.traverse(i=>{i.addEventListener("beginState",this.onFrameOverrideObjectEvent),i.addEventListener("completeState",this.onFrameOverrideObjectEvent)}),this.frame?.requestRender(),e}get frame(){return this.frameOverride}get frameId(){return this.frame?.uuid}find(t){return this.scene2d.find(t)}get texture(){return this.textureHolder?.getTexture(1001)}disposeFrameOverride(){this.frameOverride?.removeEventListener("render",this.onRenderRequestedDownstream),this.frameOverride?.traverse(t=>{t.removeEventListener("beginState",this.onFrameOverrideObjectEvent),t.removeEventListener("completeState",this.onFrameOverrideObjectEvent)}),this.frameOverride&&this.scene2d.remove(this.frameOverride)}};function Yvt({objectOverride:t,objectRoot:e,newParentWidth:i,newParentHeight:r,initialParentWidth:s,initialParentHeight:n}){if(t instanceof Qu&&e instanceof Qu||t instanceof um&&e instanceof um)for(let a=0,o=t.children.length;a<o;a++){let l=t.children[a],u=e.children[a];l&&u&&l.uuid===u.uuid&&iEt({objectOverride:l,objectRoot:u,newParentWidth:i,newParentHeight:r,initialParentWidth:s,initialParentHeight:n})}}function iEt({objectOverride:t,objectRoot:e,newParentWidth:i,newParentHeight:r,initialParentWidth:s,initialParentHeight:n}){let[a,o]=function(d){if(BL(d))return[d.width,d.height];if(d instanceof G4){let[c,p]=d.getHalfSize();return[2*c,2*p]}if(d instanceof um){let[c,p]=d.recursiveBBox.getHalfSize();return[2*c,2*p]}return[0,0]}(e),{width:l,height:u,position:h}=Hvt({constraints:t.data,newParentWidth:i,newParentHeight:r,initialParentWidth:s,initialParentHeight:n,objectInitialWidth:a,objectInitialHeight:o,objectInitialPosition:e.position});if(t.position=h,t.data={...t.data,position:h},t.states)for(let d in t.states)rEt({stateId:d,objectOverride:t,objectRoot:e,newParentWidth:i,newParentHeight:r,initialParentWidth:s,initialParentHeight:n});if(BL(t)||t instanceof um)BL(t)&&(t.width=l,t.height=u,t.data={...t.data,width:l,height:u}),Yvt({objectOverride:t,objectRoot:e,newParentWidth:l,newParentHeight:u,initialParentWidth:a,initialParentHeight:o});else if(t instanceof G4){let d=e,c=a!==0?l/a:1,p=o!==0?u/o:1;t.path=function(m,f=1,g=1){if(f<=0||g<=0)return m;if(Wvt(m))return console.warn("Cannot scale invalid path",m),DL([]);if(f===1&&g===1)return m;try{return DL((0,ZCt.parseSVG)(m).map(y=>{let v={...y};return"x"in v&&(v.x=v.x*f),"y"in v&&(v.y=v.y*g),"x1"in v&&(v.x1=v.x1*f),"x2"in v&&(v.x2=v.x2*f),"y1"in v&&(v.y1=v.y1*g),"y2"in v&&(v.y2=v.y2*g),"rx"in v&&(v.rx=v.rx*f),"ry"in v&&(v.ry=v.ry*g),v}))}catch(y){return console.warn("Error parsing SVG path",y),DL([])}}(d.path,c,p),t.data={...t.data,path:t.path}}}function rEt({stateId:t,objectOverride:e,objectRoot:i,newParentWidth:r,newParentHeight:s,initialParentWidth:n,initialParentHeight:a}){let o=e.states?.[t],l=i.states?.[t];if(o&&l){let{width:u,height:h,position:d}=Hvt({constraints:e.data,newParentWidth:r,newParentHeight:s,initialParentWidth:n,initialParentHeight:a,objectInitialWidth:Fg.isResizeable(l)?l.width:0,objectInitialHeight:Fg.isResizeable(l)?l.height:0,objectInitialPosition:l.position});Object.assign(e.states[t],{position:d}),Fg.isResizeable(o)&&Object.assign(e.states[t],{width:u,height:h})}}function BL(t){return t instanceof XS||t instanceof Qu||t instanceof lW||t instanceof hW}b5();var jht,sEt=class extends Fr{constructor(t,e,i){super(t,e,i),this.isUIObject=!0,this.uiCanvas=new Xvt(t+"-canvas",e.geometry.width,e.geometry.height,i),this.uiCanvas.promise.then(()=>{this.applyFrame(this.dataPatched.geometry.frame,i.shared)})}updateByPatchedOpGeometry(t,e,i){super.updateByPatchedOpGeometry(t,e,i),t.type===0&&(t.props.frame!==void 0&&this.applyFrame(t.props.frame,i.shared),(t.props.width!==void 0||t.props.height!==void 0)&&this.applySize(t.props,i.shared))}applySize(t,e){let i=t?.width??this.dataPatched.geometry.width,r=t?.height??this.dataPatched.geometry.height;this.uiCanvas.applySize({width:i,height:r}),this.applyGeometryParametersFromFrame(e)}applyFrame(t,e){this.uiCanvas.applyFrame(t),this.applyGeometryParametersFromFrame(e),this.applyMaterialParametersFromFrame({shared:e})}applyGeometryParametersFromFrame(t){let e=this.frame;e&&(Object.assign(this.data,{geometry:Object.assign(this.data.geometry,{cornerRadius:e.cornerRadius,cornerType:0})}),Object.assign(this.dataPatched,{geometry:Object.assign(this.dataPatched.geometry,{cornerRadius:e.cornerRadius,cornerType:0})}),this.localGeometry?.dispose(),this.localGeometry=Jp(this.dataPatched.geometry,t,this.data.flatShading,this))}applyMaterialParametersFromFrame(t){let e=this.frame;if(e){let i=e.data.backgroundBlur;Object.assign(this.data.material.layers[0].data.texture,{image:this.uiCanvas.uuid}),Object.assign(this.data.material.layers[1].data,{roughness:i.radius,alpha:i.enabled?1:0}),Object.assign(this.dataPatched.material.layers[0].data.texture,{image:this.uiCanvas.uuid}),Object.assign(this.dataPatched.material.layers[1].data,{roughness:i.radius,alpha:i.enabled?1:0}),this.material.reset?.(this.dataPatched.material,t,!0)}}updateEntity2DByOp(t,e,i,r){this.uiCanvas.updateEntity2DByOp(t,e,i,r),t===this.frameId&&e.type===0&&(e.props.cornerRadius!==void 0?this.applyGeometryParametersFromFrame(r):tr(e.path,["backgroundBlur"])&&this.applyMaterialParametersFromFrame({shared:r}))}get frame(){return this.uiCanvas.frame}get frameId(){return this.frame?.uuid}removeInteractionGeometry(t){super.removeInteractionGeometry(t),this.applySize({},t)}updateGeometryInteractions(t,e){super.updateGeometryInteractions(t,e),this.applySize({width:t.width,height:t.height},e);let i={...this.data.geometry,...t};this.localGeometry?.dispose(),this.localGeometry=Jp(i,e,this.data.flatShading,this)}};Ii(),Yv("UIGeometry",(t,e,i)=>new sEt(t,e,i)),d5=jht={Scene2D:uW,UICanvas:Xvt,loadHanaUIRUNTIME:function(){return F4||(F4=async()=>async function(t,e){return await t.default(e?{module_or_path:e}:void 0),Object.getOwnPropertyDescriptor(t.Engine.prototype,"scene")||Object.defineProperty(t.Engine.prototype,"scene",{get:function(){let i=Object.create(t.SceneController.prototype);return i.__wbg_ptr=this.__wbg_ptr,i}}),{createEngine:i=>t.Engine.create(i,JSON.parse('{"schema":13,"scenes":[{"fi":0,"id":"32603ebf4-bd9a-54ba-c1e9-6645c3ee7a53","data":{"name":"Page","backgroundColor":[0,0,0,0],"objects":[]}}],"assets":{"images":{},"videos":{},"colors":{},"audios":{},"numbers":{},"booleans":{},"strings":{},"dynamicVariables":{"counters":{},"randoms":{},"timers":{},"times":{}},"fonts":{},"animations":{},"geometries":{},"emojiArt":{}},"publish":{"logo":true,"presentationSizing":"Contain","allowPageScroll":true,"showBackground":true},"framePublish":{},"components":{}}'),!0)}}(await Promise.resolve().then(()=>(Iq(),Oq)),Eht??function(){let t=typeof process<"u"?"2.0.30":void 0;return`https://cdn.spline.design/@splinetool/runtime${t?`@${t}`:""}/build/hana-ui.wasm`}())),jvt().then(()=>{})},setHanaUIWasmUrl:function(t){Eht=t}},t4!==null&&jht.setHanaUIWasmUrl(t4),Or("ui-2d"),bG(),Sft(),yt();var Kvt,VL,nEt=class{constructor(){this.type="ShapePath",this.color=new oe,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new N2,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath?.lineTo(t,e),this}quadraticCurveTo(t,e,i,r){return this.currentPath?.quadraticCurveTo(t,e,i,r),this}bezierCurveTo(t,e,i,r,s,n){return this.currentPath?.bezierCurveTo(t,e,i,r,s,n),this}splineThru(t){return this.currentPath?.splineThru(t),this}toShapes(){let t={loc:0,t:0};function e(u,h,d,c){let p=u.x,m=h.x,f=d.x,g=c.x,y=u.y,v=h.y,b=d.y,_=c.y,x=(g-f)*(y-b)-(_-b)*(p-f),S=(_-b)*(m-p)-(g-f)*(v-y),w=x/S,M=((m-p)*(y-b)-(v-y)*(p-f))/S;if(S===0&&x!==0||w<=0||w>=1||M<0||M>1)return null;if(x===0&&S===0){for(let T=0;T<2;T++){if(i(T===0?d:c,u,h),t.loc===0){let A=T===0?d:c;return{x:A.x,y:A.y,t:t.t}}if(t.loc===2)return{x:+(p+t.t*(m-p)).toPrecision(10),y:+(y+t.t*(v-y)).toPrecision(10),t:t.t}}return null}for(let T=0;T<2;T++)if(i(T===0?d:c,u,h),t.loc===0){let A=T===0?d:c;return{x:A.x,y:A.y,t:t.t}}return{x:+(p+w*(m-p)).toPrecision(10),y:+(y+w*(v-y)).toPrecision(10),t:w}}function i(u,h,d){let c,p=d.x-h.x,m=d.y-h.y,f=u.x-h.x,g=u.y-h.y,y=p*g-f*m;return u.x===h.x&&u.y===h.y?(t.loc=0,void(t.t=0)):u.x===d.x&&u.y===d.y?(t.loc=1,void(t.t=1)):void(y<-Number.EPSILON?t.loc=3:y>Number.EPSILON?t.loc=4:p*f<0||m*g<0?t.loc=5:Math.sqrt(p*p+m*m)<Math.sqrt(f*f+g*g)?t.loc=6:(c=p!==0?f/p:g/m,t.loc=2,t.t=c))}let r=0,s=999999999,n=-999999999,a=[];this.subPaths.forEach(u=>{let h=u.getPoints(),d=-999999999,c=999999999,p=-999999999,m=999999999;for(let f=0;f<h.length;f++){let g=h[f];g.y>d&&(d=g.y),g.y<c&&(c=g.y),g.x>p&&(p=g.x),g.x<m&&(m=g.x)}n<=p&&(n=p+1),s>=m&&(s=m-1),h.length&&a.push({curves:u.curves,points:h,isCW:XF.isClockWise(h),identifier:r++,boundingBox:new J4(new Z(m,c),new Z(p,d))})});let o=a.map(u=>function(h,d,c,p,m){(m==null||m==="")&&(m="nonzero");let f=new Z;h.boundingBox.getCenter(f);let g=function(S,w,M){let T=new Z;w.getCenter(T);let A=[];return M.forEach(C=>{C.boundingBox.containsPoint(T)&&function(R,O){let D=[],B=[];for(let k=1;k<R.length;k++){let j=R[k-1],z=R[k];for(let V=1;V<O.length;V++){let H=e(j,z,O[V-1],O[V]);H!==null&&D.find(U=>U.t<=H.t+Number.EPSILON&&U.t>=H.t-Number.EPSILON)===void 0&&(D.push(H),B.push(new Z(H.x,H.y)))}}return B}(S,C.points).forEach(R=>{A.push({identifier:C.identifier,isCW:C.isCW,point:R})})}),A.sort((C,R)=>C.point.x-R.point.x),A}([new Z(c,f.y),new Z(p,f.y)],h.boundingBox,d);g.sort((S,w)=>S.point.x-w.point.x);let y=[],v=[];g.forEach(S=>{S.identifier===h.identifier?y.push(S):v.push(S)});let b=y[0].point.x,_=[],x=0;for(;x<v.length&&v[x].point.x<b;)_.length>0&&_[_.length-1]===v[x].identifier?_.pop():_.push(v[x].identifier),x++;if(_.push(h.identifier),m==="evenodd"){let S=_.length%2==0,w=_[_.length-2];return{identifier:h.identifier,isHole:S,for:w}}if(m==="nonzero"){let S=!0,w=null,M=null;for(let T=0;T<_.length;T++){let A=_[T];d[A]&&(S?(M=d[A].isCW,S=!1,w=A):M!==d[A].isCW&&(M=d[A].isCW,S=!0))}return{identifier:h.identifier,isHole:S,for:w}}console.warn('fill-rule: "'+m+'" is currently not implemented.')}(u,a,s,n,this.userData?.style.fillRule)),l=[];return a.forEach(u=>{let h=o[u.identifier];if(h&&!h.isHole){let d=new aS;d.curves=u.curves,o.filter(c=>c?.isHole&&c.for===u.identifier).forEach(c=>{if(c){let p=a[c.identifier],m=new N2;m.curves=p.curves,d.holes.push(m)}}),l.push(d)}}),l}},Zvt=!1,Ght=new Promise(t=>{Kvt=t}),Wht=!1;function qht(){if(Zvt=!0,!Wht)return VL||(VL=async function(){let t=await import("./opentype.js");Kvt(t),Wht=!0}(),VL)}var aEt=new class{async load(t,e,i=()=>{}){let{load:r}=await Ght;r(t,(s,n)=>{s||!n?i(s??"Something went wrong"):e(n)})}async parse(t){let{parse:e,Bidi:i}=await Ght;try{let r=e(t),s=new i,n=a=>r.charToGlyphIndex(a.char);return s.registerModifier("glyphIndex",null,n),s.applyFeatures(r,r.defaultRenderOptions.features),{font:r,bidi:s}}catch(r){console.error(r)}}};function oEt(t,e){return e.state.glyphIndex===t||e.state.fina===t||e.state.medi===t||e.state.init===t}yt(),X7(),Ii(),Yv("TextGeometry",(t,e,i)=>new A5(t,e,i));var Hht={create:(t,e)=>new fU(t,e)};H8("TextGeometry",Hht),H8("InputGeometry",Hht),$7=class{constructor(t){this._arrayBuffer=new ArrayBuffer(1),this._isLoaded=!1,this._intercepted=!1,this._layoutErrorWarned=!1,this._isUserFont=t.isUserFont??!1,this._loadingPromise=this.load(t)}update(t){this._isLoaded=!1,this._isUserFont=t.isUserFont??!1,this._loadingPromise=this.load(t)}async load(t){try{this._layoutErrorWarned=!1;let e=await async function(i){let r,s,n=!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),s=i.url,n=i.url.startsWith("/")):i.data&&(r=i.data.buffer.slice(i.data.byteOffset,i.data.byteOffset+i.data.byteLength)),r){if(!Zvt)return{font:void 0,url:s,intercepted:n,arr:r,bidi:null};{let a=await aEt.parse(r);if(a)return{font:a.font,url:s,intercepted:n,arr:r,bidi:a.bidi}}}}(t);e&&(this._arrayBuffer=e.arr,this._url=e.url,this.font=e.font,this._intercepted=e.intercepted,this._isLoaded=!0,this._bidi=e.bidi)}catch(e){console.warn(`Could not load the font "${t.url??"(inline data)"}"`,e)}}warnLayoutError(t){this._layoutErrorWarned||(this._layoutErrorWarned=!0,console.warn(`Text layout failed for the font "${this._url??"(inline data)"}"`,t))}get url(){return this._url}get intercepted(){return this._intercepted}get isLoaded(){return this._isLoaded}get loadingPromise(){return this._loadingPromise}reverseLigaturesTable(t,e,i){if(!this._bidi)return[];let r=this._bidi;r.getTextGlyphs(e);let s=r.tokenizer.tokens,n=[],a=0,o=i.length===s.length;for(let l=0;l<i.length;l++){let u=i[l].index,h=String.fromCharCode(i[l].unicode),d=s[a];if(oEt(u,d)||o)n.push({char:h,index:u,replacements:[d.state.glyphIndex],replacementChars:[d.char]}),a++;else{let c=d.char,p="",m=[d.state.glyphIndex],f=[],g=!1;for(;!g;)a++,p=e.charAt(a),c+=p,m.push(t.charToGlyphIndex(p)),f=t.stringToGlyphs(c),f.length===1&&f[0].index===u&&(g=!0),a>e.length&&(g=!0);n.push({char:h,index:u,replacements:m,replacementChars:Array.from(c)}),a++}}return n}generateShapes(t,e,i){if(!this._isLoaded)return;let r=this.font,s=e.fontSize/this.unitsPerEm,n=e.fontSize*e.lineHeight,a=t.map(y=>this.getTextWidth(y,e)),o=typeof e.width=="string"?Number(i.getVariable(e.width)):e.width,l=typeof e.height=="string"?Number(i.getVariable(e.height)):e.height,u=this.getCharWidth(`
5079
+ }`}),tEt=new class{constructor(t){this._mesh=new Ar(JCt,t)}dispose(){this._mesh.geometry.dispose()}render(t){t.render(this._mesh,QCt)}get material(){return this._mesh.material}set material(t){this._mesh.material=t}}($vt),OL=null,IL=null,eEt=ri.identity(),Xvt=class{constructor(t,e,i,r){var s;this.uuid=t,this.width=e,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||G2.add(this),this.context.shared.requestRender()},this._innerApplySize=()=>{let n=this.width,a=this.height;this.renderer.dpr=Uht(n,a,this.dpr,this.isScreenSpace),this.renderer.setSize(n,a)},this.onFrameOverrideObjectEvent=n=>{if(n.target?.uuid!==void 0){let a=this.frameRoot?.find(n.target.uuid);a&&a.dispatchEvent({...n,target:a})}},this.scene2d=new uW(Yt.generateUUID(),j8.defaultData,{dpr:window.devicePixelRatio,shared:r.shared}),this.canvas=(OL===null&&(OL=document.createElement("canvas")),OL),this.renderer=(s=this.canvas,IL===null&&(IL=new qCt(s)),IL),this.promise=this.init(),this.renderTarget=new hg(1,1,{type:Qe,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 l7(this.canvas)),this._canvasTexture}async init(){await this.renderer.init(),this.renderer.uiFontReady?.then(()=>{this.frameOverride&&this.onRenderRequestedDownstream()})}render(t){if(this.isFrameDirty){if(this.isFrameDirty=!1,this._innerApplySize(),this.renderer.clear(),this.frameOverride?.draw(this.renderer),this.renderer.render(),this.canvasTexture.needsUpdate=!0,t.blitTextureToTarget)t.blitTextureToTarget(this.canvasTexture,this.renderTarget);else{$vt.uniforms.tDiffuse.value=this.canvasTexture;let e=t.getRenderTarget();t.setRenderTarget(this.renderTarget),t.clear(),tEt.render(t),t.setRenderTarget(e)}this.textureHolder?.setNeedsUpdate(!0)}}updateEntity2DByOp(t,e,i,r){this.scene2d.updateEntityByOp(t,e,i,r),this.applySize()}updateTreeByOp(t,e){this.scene2d.updateTreeByOp(t,e),this.applySize()}applyOverrides(t){if(this.frameOverride&&this.frameRoot){this.frameOverride.position=[0,0],this.frameOverride.rotation=0;let e=t?.width??this.width,i=t?.height??this.height;this.frameOverride.width=e,this.frameOverride.height=i,this.frameOverride.localMatrix=eEt,this.isScreenSpace&&(this.frameOverride.fill.color=Hi.from0to1([0,0,0,0])),this.frameOverride.data={...this.frameOverride.data,width:e,height:i},Yvt({objectOverride:this.frameOverride,objectRoot:this.frameRoot,newParentWidth:this.frameOverride.width,newParentHeight:this.frameOverride.height,initialParentWidth:this.frameRoot.width,initialParentHeight:this.frameRoot.height}),this.frameOverride.updateWorldMatrix(!0,!1,!0)}}applySize(t,e=window.devicePixelRatio){let i=Math.max(1,t?.width??this.width),r=Math.max(1,t?.height??this.height);this.dpr=e,this.width=i,this.height=r,this._innerApplySize();let s=function(n,a,o,l){let u=Uht(n,a,o,l),h=Math.max(o,512/Math.min(n,a)),d=Math.min(h,u);return{width:Math.max(1,Math.ceil(n*d)),height:Math.max(1,Math.ceil(a*d))}}(i,r,e,this.isScreenSpace);this.renderTarget.setSize(s.width,s.height),this._canvasTexture?.dispose(),this._canvasTexture=void 0,this.applyOverrides(t),this.frameOverride?.requestRender()}applyFrame(t){let e=this.context.scene.find2D(t);if(e&&e instanceof Qu)return this.disposeFrameOverride(),this.frameRoot=e,this.frameOverride=e.clone({dpr:this.renderer.dpr,shared:this.context.shared}),this.scene2d.add(this.frameOverride),this.applySize(),this.frame?.addEventListener("render",this.onRenderRequestedDownstream),this.frameOverride.traverse(i=>{i.addEventListener("beginState",this.onFrameOverrideObjectEvent),i.addEventListener("completeState",this.onFrameOverrideObjectEvent)}),this.frame?.requestRender(),e}get frame(){return this.frameOverride}get frameId(){return this.frame?.uuid}find(t){return this.scene2d.find(t)}get texture(){return this.textureHolder?.getTexture(1001)}disposeFrameOverride(){this.frameOverride?.removeEventListener("render",this.onRenderRequestedDownstream),this.frameOverride?.traverse(t=>{t.removeEventListener("beginState",this.onFrameOverrideObjectEvent),t.removeEventListener("completeState",this.onFrameOverrideObjectEvent)}),this.frameOverride&&this.scene2d.remove(this.frameOverride)}};function Yvt({objectOverride:t,objectRoot:e,newParentWidth:i,newParentHeight:r,initialParentWidth:s,initialParentHeight:n}){if(t instanceof Qu&&e instanceof Qu||t instanceof um&&e instanceof um)for(let a=0,o=t.children.length;a<o;a++){let l=t.children[a],u=e.children[a];l&&u&&l.uuid===u.uuid&&iEt({objectOverride:l,objectRoot:u,newParentWidth:i,newParentHeight:r,initialParentWidth:s,initialParentHeight:n})}}function iEt({objectOverride:t,objectRoot:e,newParentWidth:i,newParentHeight:r,initialParentWidth:s,initialParentHeight:n}){let[a,o]=function(d){if(BL(d))return[d.width,d.height];if(d instanceof G4){let[c,p]=d.getHalfSize();return[2*c,2*p]}if(d instanceof um){let[c,p]=d.recursiveBBox.getHalfSize();return[2*c,2*p]}return[0,0]}(e),{width:l,height:u,position:h}=Hvt({constraints:t.data,newParentWidth:i,newParentHeight:r,initialParentWidth:s,initialParentHeight:n,objectInitialWidth:a,objectInitialHeight:o,objectInitialPosition:e.position});if(t.position=h,t.data={...t.data,position:h},t.states)for(let d in t.states)rEt({stateId:d,objectOverride:t,objectRoot:e,newParentWidth:i,newParentHeight:r,initialParentWidth:s,initialParentHeight:n});if(BL(t)||t instanceof um)BL(t)&&(t.width=l,t.height=u,t.data={...t.data,width:l,height:u}),Yvt({objectOverride:t,objectRoot:e,newParentWidth:l,newParentHeight:u,initialParentWidth:a,initialParentHeight:o});else if(t instanceof G4){let d=e,c=a!==0?l/a:1,p=o!==0?u/o:1;t.path=function(m,f=1,g=1){if(f<=0||g<=0)return m;if(Wvt(m))return console.warn("Cannot scale invalid path",m),DL([]);if(f===1&&g===1)return m;try{return DL((0,ZCt.parseSVG)(m).map(y=>{let v={...y};return"x"in v&&(v.x=v.x*f),"y"in v&&(v.y=v.y*g),"x1"in v&&(v.x1=v.x1*f),"x2"in v&&(v.x2=v.x2*f),"y1"in v&&(v.y1=v.y1*g),"y2"in v&&(v.y2=v.y2*g),"rx"in v&&(v.rx=v.rx*f),"ry"in v&&(v.ry=v.ry*g),v}))}catch(y){return console.warn("Error parsing SVG path",y),DL([])}}(d.path,c,p),t.data={...t.data,path:t.path}}}function rEt({stateId:t,objectOverride:e,objectRoot:i,newParentWidth:r,newParentHeight:s,initialParentWidth:n,initialParentHeight:a}){let o=e.states?.[t],l=i.states?.[t];if(o&&l){let{width:u,height:h,position:d}=Hvt({constraints:e.data,newParentWidth:r,newParentHeight:s,initialParentWidth:n,initialParentHeight:a,objectInitialWidth:Fg.isResizeable(l)?l.width:0,objectInitialHeight:Fg.isResizeable(l)?l.height:0,objectInitialPosition:l.position});Object.assign(e.states[t],{position:d}),Fg.isResizeable(o)&&Object.assign(e.states[t],{width:u,height:h})}}function BL(t){return t instanceof XS||t instanceof Qu||t instanceof lW||t instanceof hW}b5();var jht,sEt=class extends Fr{constructor(t,e,i){super(t,e,i),this.isUIObject=!0,this.uiCanvas=new Xvt(t+"-canvas",e.geometry.width,e.geometry.height,i),this.uiCanvas.promise.then(()=>{this.applyFrame(this.dataPatched.geometry.frame,i.shared)})}updateByPatchedOpGeometry(t,e,i){super.updateByPatchedOpGeometry(t,e,i),t.type===0&&(t.props.frame!==void 0&&this.applyFrame(t.props.frame,i.shared),(t.props.width!==void 0||t.props.height!==void 0)&&this.applySize(t.props,i.shared))}applySize(t,e){let i=t?.width??this.dataPatched.geometry.width,r=t?.height??this.dataPatched.geometry.height;this.uiCanvas.applySize({width:i,height:r}),this.applyGeometryParametersFromFrame(e)}applyFrame(t,e){this.uiCanvas.applyFrame(t),this.applyGeometryParametersFromFrame(e),this.applyMaterialParametersFromFrame({shared:e})}applyGeometryParametersFromFrame(t){let e=this.frame;e&&(Object.assign(this.data,{geometry:Object.assign(this.data.geometry,{cornerRadius:e.cornerRadius,cornerType:0})}),Object.assign(this.dataPatched,{geometry:Object.assign(this.dataPatched.geometry,{cornerRadius:e.cornerRadius,cornerType:0})}),this.localGeometry?.dispose(),this.localGeometry=Jp(this.dataPatched.geometry,t,this.data.flatShading,this))}applyMaterialParametersFromFrame(t){let e=this.frame;if(e){let i=e.data.backgroundBlur;Object.assign(this.data.material.layers[0].data.texture,{image:this.uiCanvas.uuid}),Object.assign(this.data.material.layers[1].data,{roughness:i.radius,alpha:i.enabled?1:0}),Object.assign(this.dataPatched.material.layers[0].data.texture,{image:this.uiCanvas.uuid}),Object.assign(this.dataPatched.material.layers[1].data,{roughness:i.radius,alpha:i.enabled?1:0}),this.material.reset?.(this.dataPatched.material,t,!0)}}updateEntity2DByOp(t,e,i,r){this.uiCanvas.updateEntity2DByOp(t,e,i,r),t===this.frameId&&e.type===0&&(e.props.cornerRadius!==void 0?this.applyGeometryParametersFromFrame(r):tr(e.path,["backgroundBlur"])&&this.applyMaterialParametersFromFrame({shared:r}))}get frame(){return this.uiCanvas.frame}get frameId(){return this.frame?.uuid}removeInteractionGeometry(t){super.removeInteractionGeometry(t),this.applySize({},t)}updateGeometryInteractions(t,e){super.updateGeometryInteractions(t,e),this.applySize({width:t.width,height:t.height},e);let i={...this.data.geometry,...t};this.localGeometry?.dispose(),this.localGeometry=Jp(i,e,this.data.flatShading,this)}};Ii(),Yv("UIGeometry",(t,e,i)=>new sEt(t,e,i)),d5=jht={Scene2D:uW,UICanvas:Xvt,loadHanaUIRUNTIME:function(){return F4||(F4=async()=>async function(t,e){return await t.default(e?{module_or_path:e}:void 0),Object.getOwnPropertyDescriptor(t.Engine.prototype,"scene")||Object.defineProperty(t.Engine.prototype,"scene",{get:function(){let i=Object.create(t.SceneController.prototype);return i.__wbg_ptr=this.__wbg_ptr,i}}),{createEngine:i=>t.Engine.create(i,JSON.parse('{"schema":13,"scenes":[{"fi":0,"id":"32603ebf4-bd9a-54ba-c1e9-6645c3ee7a53","data":{"name":"Page","backgroundColor":[0,0,0,0],"objects":[]}}],"assets":{"images":{},"videos":{},"colors":{},"audios":{},"numbers":{},"booleans":{},"strings":{},"dynamicVariables":{"counters":{},"randoms":{},"timers":{},"times":{}},"fonts":{},"animations":{},"geometries":{},"emojiArt":{}},"publish":{"logo":true,"presentationSizing":"Contain","allowPageScroll":true,"showBackground":true},"framePublish":{},"components":{}}'),!0)}}(await Promise.resolve().then(()=>(Iq(),Oq)),Eht??function(){let t=typeof process<"u"?"2.0.32":void 0;return`https://cdn.spline.design/@splinetool/runtime${t?`@${t}`:""}/build/hana-ui.wasm`}())),jvt().then(()=>{})},setHanaUIWasmUrl:function(t){Eht=t}},t4!==null&&jht.setHanaUIWasmUrl(t4),Or("ui-2d"),bG(),Sft(),yt();var Kvt,VL,nEt=class{constructor(){this.type="ShapePath",this.color=new oe,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new N2,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath?.lineTo(t,e),this}quadraticCurveTo(t,e,i,r){return this.currentPath?.quadraticCurveTo(t,e,i,r),this}bezierCurveTo(t,e,i,r,s,n){return this.currentPath?.bezierCurveTo(t,e,i,r,s,n),this}splineThru(t){return this.currentPath?.splineThru(t),this}toShapes(){let t={loc:0,t:0};function e(u,h,d,c){let p=u.x,m=h.x,f=d.x,g=c.x,y=u.y,v=h.y,b=d.y,_=c.y,x=(g-f)*(y-b)-(_-b)*(p-f),S=(_-b)*(m-p)-(g-f)*(v-y),w=x/S,M=((m-p)*(y-b)-(v-y)*(p-f))/S;if(S===0&&x!==0||w<=0||w>=1||M<0||M>1)return null;if(x===0&&S===0){for(let T=0;T<2;T++){if(i(T===0?d:c,u,h),t.loc===0){let A=T===0?d:c;return{x:A.x,y:A.y,t:t.t}}if(t.loc===2)return{x:+(p+t.t*(m-p)).toPrecision(10),y:+(y+t.t*(v-y)).toPrecision(10),t:t.t}}return null}for(let T=0;T<2;T++)if(i(T===0?d:c,u,h),t.loc===0){let A=T===0?d:c;return{x:A.x,y:A.y,t:t.t}}return{x:+(p+w*(m-p)).toPrecision(10),y:+(y+w*(v-y)).toPrecision(10),t:w}}function i(u,h,d){let c,p=d.x-h.x,m=d.y-h.y,f=u.x-h.x,g=u.y-h.y,y=p*g-f*m;return u.x===h.x&&u.y===h.y?(t.loc=0,void(t.t=0)):u.x===d.x&&u.y===d.y?(t.loc=1,void(t.t=1)):void(y<-Number.EPSILON?t.loc=3:y>Number.EPSILON?t.loc=4:p*f<0||m*g<0?t.loc=5:Math.sqrt(p*p+m*m)<Math.sqrt(f*f+g*g)?t.loc=6:(c=p!==0?f/p:g/m,t.loc=2,t.t=c))}let r=0,s=999999999,n=-999999999,a=[];this.subPaths.forEach(u=>{let h=u.getPoints(),d=-999999999,c=999999999,p=-999999999,m=999999999;for(let f=0;f<h.length;f++){let g=h[f];g.y>d&&(d=g.y),g.y<c&&(c=g.y),g.x>p&&(p=g.x),g.x<m&&(m=g.x)}n<=p&&(n=p+1),s>=m&&(s=m-1),h.length&&a.push({curves:u.curves,points:h,isCW:XF.isClockWise(h),identifier:r++,boundingBox:new J4(new Z(m,c),new Z(p,d))})});let o=a.map(u=>function(h,d,c,p,m){(m==null||m==="")&&(m="nonzero");let f=new Z;h.boundingBox.getCenter(f);let g=function(S,w,M){let T=new Z;w.getCenter(T);let A=[];return M.forEach(C=>{C.boundingBox.containsPoint(T)&&function(R,O){let D=[],B=[];for(let k=1;k<R.length;k++){let j=R[k-1],z=R[k];for(let V=1;V<O.length;V++){let H=e(j,z,O[V-1],O[V]);H!==null&&D.find(U=>U.t<=H.t+Number.EPSILON&&U.t>=H.t-Number.EPSILON)===void 0&&(D.push(H),B.push(new Z(H.x,H.y)))}}return B}(S,C.points).forEach(R=>{A.push({identifier:C.identifier,isCW:C.isCW,point:R})})}),A.sort((C,R)=>C.point.x-R.point.x),A}([new Z(c,f.y),new Z(p,f.y)],h.boundingBox,d);g.sort((S,w)=>S.point.x-w.point.x);let y=[],v=[];g.forEach(S=>{S.identifier===h.identifier?y.push(S):v.push(S)});let b=y[0].point.x,_=[],x=0;for(;x<v.length&&v[x].point.x<b;)_.length>0&&_[_.length-1]===v[x].identifier?_.pop():_.push(v[x].identifier),x++;if(_.push(h.identifier),m==="evenodd"){let S=_.length%2==0,w=_[_.length-2];return{identifier:h.identifier,isHole:S,for:w}}if(m==="nonzero"){let S=!0,w=null,M=null;for(let T=0;T<_.length;T++){let A=_[T];d[A]&&(S?(M=d[A].isCW,S=!1,w=A):M!==d[A].isCW&&(M=d[A].isCW,S=!0))}return{identifier:h.identifier,isHole:S,for:w}}console.warn('fill-rule: "'+m+'" is currently not implemented.')}(u,a,s,n,this.userData?.style.fillRule)),l=[];return a.forEach(u=>{let h=o[u.identifier];if(h&&!h.isHole){let d=new aS;d.curves=u.curves,o.filter(c=>c?.isHole&&c.for===u.identifier).forEach(c=>{if(c){let p=a[c.identifier],m=new N2;m.curves=p.curves,d.holes.push(m)}}),l.push(d)}}),l}},Zvt=!1,Ght=new Promise(t=>{Kvt=t}),Wht=!1;function qht(){if(Zvt=!0,!Wht)return VL||(VL=async function(){let t=await import("./opentype.js");Kvt(t),Wht=!0}(),VL)}var aEt=new class{async load(t,e,i=()=>{}){let{load:r}=await Ght;r(t,(s,n)=>{s||!n?i(s??"Something went wrong"):e(n)})}async parse(t){let{parse:e,Bidi:i}=await Ght;try{let r=e(t),s=new i,n=a=>r.charToGlyphIndex(a.char);return s.registerModifier("glyphIndex",null,n),s.applyFeatures(r,r.defaultRenderOptions.features),{font:r,bidi:s}}catch(r){console.error(r)}}};function oEt(t,e){return e.state.glyphIndex===t||e.state.fina===t||e.state.medi===t||e.state.init===t}yt(),X7(),Ii(),Yv("TextGeometry",(t,e,i)=>new A5(t,e,i));var Hht={create:(t,e)=>new fU(t,e)};H8("TextGeometry",Hht),H8("InputGeometry",Hht),$7=class{constructor(t){this._arrayBuffer=new ArrayBuffer(1),this._isLoaded=!1,this._intercepted=!1,this._layoutErrorWarned=!1,this._isUserFont=t.isUserFont??!1,this._loadingPromise=this.load(t)}update(t){this._isLoaded=!1,this._isUserFont=t.isUserFont??!1,this._loadingPromise=this.load(t)}async load(t){try{this._layoutErrorWarned=!1;let e=await async function(i){let r,s,n=!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),s=i.url,n=i.url.startsWith("/")):i.data&&(r=i.data.buffer.slice(i.data.byteOffset,i.data.byteOffset+i.data.byteLength)),r){if(!Zvt)return{font:void 0,url:s,intercepted:n,arr:r,bidi:null};{let a=await aEt.parse(r);if(a)return{font:a.font,url:s,intercepted:n,arr:r,bidi:a.bidi}}}}(t);e&&(this._arrayBuffer=e.arr,this._url=e.url,this.font=e.font,this._intercepted=e.intercepted,this._isLoaded=!0,this._bidi=e.bidi)}catch(e){console.warn(`Could not load the font "${t.url??"(inline data)"}"`,e)}}warnLayoutError(t){this._layoutErrorWarned||(this._layoutErrorWarned=!0,console.warn(`Text layout failed for the font "${this._url??"(inline data)"}"`,t))}get url(){return this._url}get intercepted(){return this._intercepted}get isLoaded(){return this._isLoaded}get loadingPromise(){return this._loadingPromise}reverseLigaturesTable(t,e,i){if(!this._bidi)return[];let r=this._bidi;r.getTextGlyphs(e);let s=r.tokenizer.tokens,n=[],a=0,o=i.length===s.length;for(let l=0;l<i.length;l++){let u=i[l].index,h=String.fromCharCode(i[l].unicode),d=s[a];if(oEt(u,d)||o)n.push({char:h,index:u,replacements:[d.state.glyphIndex],replacementChars:[d.char]}),a++;else{let c=d.char,p="",m=[d.state.glyphIndex],f=[],g=!1;for(;!g;)a++,p=e.charAt(a),c+=p,m.push(t.charToGlyphIndex(p)),f=t.stringToGlyphs(c),f.length===1&&f[0].index===u&&(g=!0),a>e.length&&(g=!0);n.push({char:h,index:u,replacements:m,replacementChars:Array.from(c)}),a++}}return n}generateShapes(t,e,i){if(!this._isLoaded)return;let r=this.font,s=e.fontSize/this.unitsPerEm,n=e.fontSize*e.lineHeight,a=t.map(y=>this.getTextWidth(y,e)),o=typeof e.width=="string"?Number(i.getVariable(e.width)):e.width,l=typeof e.height=="string"?Number(i.getVariable(e.height)):e.height,u=this.getCharWidth(`
5080
5080
  `,e),h=e.horizontalAlign===1?u:0,d=this.getLineInitialOffsetX(a[0],o,e.horizontalAlign,t[0],u),c=this.getLineInitialOffsetY(n,t.length,l,s,e.verticalAlign),p=[],m=t.map(()=>[]),f=t.map(()=>[]);for(let y=0;y<t.length;y++){let v=t[y],b={features:{liga:!0},letterSpacing:e.letterSpacing},_=[];try{_=r.stringToGlyphs(v,b)}catch(T){this.warnLayoutError(T)}d=this.getLineInitialOffsetX(a[y],o,e.horizontalAlign,v,u);let x=[];try{x=this.reverseLigaturesTable(r,v,_)}catch(T){this.warnLayoutError(T)}let S=this.computeSpaceWidthForLine(t,y,e,i),w=0,M=_[0];M&&e.horizontalAlign===2&&M.leftSideBearing!==void 0&&(d-=M.leftSideBearing*s);try{this.font?.forEachGlyph(v,d,c,e.fontSize,b,(T,A,C,R,O)=>{let D=T.index===0?`
5081
5081
  `:T.unicode?String.fromCharCode(T.unicode):void 0,B=x[w],k=0;if(D===`
5082
5082
  `)k=h;else if(D===" ")k=S;else{let j=this.createPath(T,s,A,C,e);j&&(k=j.offsetX,p.push(j.path))}if(B&&B.replacements.length!==1){let j=B.replacements.map(U=>(r.glyphs.get(U).advanceWidth??0)*s),z=j.reduce((U,et)=>U+et,0),V=j.map(U=>U/z),H=A;for(let U=0;U<V.length;U++){let et=k*V[U];f[y].push([H,C]),m[y].push(et),H+=et}}else f[y].push([A,C]),m[y].push(k);w++})}catch(T){this.warnLayoutError(T)}c-=n}let g=[];for(let y=0,v=p.length;y<v;y++)g.push(...p[y].toShapes());return{shapes:g,charWidths:m,lineWidths:a,charCoords:f}}get isUserFont(){return this._isUserFont}get arrayBuffer(){return this._arrayBuffer}get ascender(){return this.font?.ascender??0}get descender(){return this.font?.descender??0}get familyName(){return this.font?.names.fontFamily??""}get subfamilyName(){return this.font?.names.fontSubfamily??""}get unitsPerEm(){return this.font?.unitsPerEm??1}getLineInitialOffsetX(t,e,i,r,s){return(i===3||i===2)&&r.indexOf(`
5083
- `)>=0&&(t-=s),i===3?.5*e-.5*t:i===2?e-t:0}getLineInitialOffsetY(t,e,i,r,s){let n=e*t,a=t-Math.abs(this.ascender-this.descender)*r,o=-this.ascender*r-a/2;return s===3?-(i-n-o):s===2?-(.5*i-.5*n-o):o}createPath(t,e,i,r,s){let n=t.getPath(i,-r,s.fontSize,{kerning:!1,letterSpacing:s.letterSpacing});if(!n)return void console.error('THREE.Font: character "'+t+'" does not exists in font family '+this.familyName+".");let a=new nEt,o=(t.advanceWidth??1)*e;if(t)for(let l of n.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 cl)return d.v1;if(d instanceof Yl||d instanceof oc)return d.v0}}(l.curves);u!==void 0&&l.currentPoint.distanceTo(u)>0&&l.lineTo(u.x,u.y)}),{offsetX:o,path:a}}getCharWidth(t,e){try{return this.font?.getAdvanceWidth(t,e.fontSize,{kerning:!0,letterSpacing:e.letterSpacing})??0}catch(i){return this.warnLayoutError(i),0}}getTextWidth(t,e){try{return this.font?.getAdvanceWidth(t,e.fontSize,{kerning:!0,letterSpacing:e.letterSpacing})??0}catch(i){return this.warnLayoutError(i),0}}computeSpaceWidthForLine(t,e,i,r){let s=this.getCharWidth(" ",i),n=t[e];if(n){let a=this.countSpaces(n.trimEnd());if(i.horizontalAlign===4&&e<t.length-1&&a)return((typeof i.width=="string"?Number(r.getVariable(i.width)):i.width)-(this.getTextWidth(n,i)-a*s))/a}return s}countSpaces(t){return(t.match(/ /g)||[]).length}},Or("text"),Le();var Qvt=null;function $ht(){return Qvt}function lEt(t){let e=!1;return t.scene.objects.forEach(i=>{i.data.type==="Page"&&!e&&i.data.publish.gameControlObject&&Kg.traverseModuleInstances(t,i.id,(r,s,n)=>{for(let a of n)a.data.type==="GameControl"&&a.data.navmesh.enabled&&(e=!0)})}),e}cr();var cE=(t,e)=>{let i=e.x-t.x,r=e.y-t.y;return Math.sqrt(i*i+r*r)},kL=t=>t*(Math.PI/180),pE=new Map,W4=(t,e,i)=>{let r,s=e.split(/[ ,]+/g);for(let n=0;n<s.length;n+=1)r=s[n],t.addEventListener?t.addEventListener(r,i,!1):t.attachEvent&&t.attachEvent(r,i)},q4=(t,e,i)=>{let r,s=e.split(/[ ,]+/g);for(let n=0;n<s.length;n+=1)r=s[n],t.removeEventListener?t.removeEventListener(r,i):t.detachEvent&&t.detachEvent(r,i)},Jvt=t=>(t.preventDefault(),t.type.match(/^touch/)?t.changedTouches:t),Xht=()=>{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}},zL=(t,e)=>{e.top||e.right||e.bottom||e.left?(t.style.top=e.top,t.style.right=e.right,t.style.bottom=e.bottom,t.style.left=e.left):(t.style.left=e.x+"px",t.style.top=e.y+"px")},LL=(t,e,i)=>{let r=tbt(t);for(let s in r)if(Object.prototype.hasOwnProperty.call(r,s))if(typeof e=="string")r[s]=e+" "+i;else{let n="";for(let a=0,o=e.length;a<o;a+=1)n+=e[a]+" "+i+", ";r[s]=n.slice(0,-2)}return r},tbt=t=>{let e={};return e[t]="",["webkit","Moz","o"].forEach(function(i){e[i+t.charAt(0).toUpperCase()+t.slice(1)]=""}),e},FL=(t,e)=>{for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},D9=(t,e)=>{if(t.length)for(let i=0,r=t.length;i<r;i+=1)e(t[i]);else e(t)};typeof window<"u"&&(ebt="ontouchstart"in window,ibt=!!window.PointerEvent,rbt=!!window.MSPointerEvent);var ebt,ibt,rbt,Yy,Yht={start:"mousedown",move:"mousemove",end:"mouseup"},aw={};function og(){}ibt?Yy={start:"pointerdown",move:"pointermove",end:"pointerup, pointercancel"}:rbt?Yy={start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:ebt?(Yy={start:"touchstart",move:"touchmove",end:"touchend, touchcancel"},aw=Yht):Yy=Yht,og.prototype.on=function(t,e){var i,r=this,s=t.split(/[ ,]+/g);r._handlers_=r._handlers_||{};for(var n=0;n<s.length;n+=1)i=s[n],r._handlers_[i]=r._handlers_[i]||[],r._handlers_[i].push(e);return r},og.prototype.off=function(t,e){var i=this;return i._handlers_=i._handlers_||{},t===void 0?i._handlers_={}:e===void 0?i._handlers_[t]=null:i._handlers_[t]&&i._handlers_[t].indexOf(e)>=0&&i._handlers_[t].splice(i._handlers_[t].indexOf(e),1),i},og.prototype.trigger=function(t,e){var i,r=this,s=t.split(/[ ,]+/g);r._handlers_=r._handlers_||{};for(var n=0;n<s.length;n+=1)i=s[n],r._handlers_[i]&&r._handlers_[i].length&&r._handlers_[i].forEach(function(a){a.call(r,{type:i,target:r},e)})},og.prototype.config=function(t){var e=this;e.options=e.defaults||{},t&&(e.options=((i,r)=>{let s={};for(let n in i)Object.prototype.hasOwnProperty.call(i,n)&&Object.prototype.hasOwnProperty.call(r,n)?s[n]=r[n]:Object.prototype.hasOwnProperty.call(i,n)&&(s[n]=i[n]);return s})(e.options,t))},og.prototype.bindEvt=function(t,e){var i=this;return i._domHandlers_=i._domHandlers_||{},i._domHandlers_[e]=function(){typeof i["on"+e]=="function"?i["on"+e].apply(i,arguments):console.warn('[WARNING] : Missing "on'+e+'" handler.')},W4(t,Yy[e],i._domHandlers_[e]),aw[e]&&W4(t,aw[e],i._domHandlers_[e]),i},og.prototype.unbindEvt=function(t,e){var i=this;return i._domHandlers_=i._domHandlers_||{},q4(t,Yy[e],i._domHandlers_[e]),aw[e]&&q4(t,aw[e],i._domHandlers_[e]),delete i._domHandlers_[e],this};var dW=og;function xn(t,e){return this.identifier=e.identifier,this.position=e.position,this.frontPosition=e.frontPosition,this.collection=t,this.defaults={size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,mode:"dynamic",zone:document.body,lockX:!1,lockY:!1,shape:"circle"},this.config(e),this.options.mode==="dynamic"&&(this.options.restOpacity=0),this.id=xn.id,xn.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}xn.prototype=new dW,xn.constructor=xn,xn.id=0,xn.prototype.buildEl=function(t){return this.ui={},this.options.dataOnly||(this.ui.el=document.createElement("div"),this.ui.back=document.createElement("div"),this.ui.front=document.createElement("div"),this.ui.el.className="nipple collection_"+this.collection.id,this.ui.back.className="back",this.ui.front.className="front",this.ui.el.setAttribute("id","nipple_"+this.collection.id+"_"+this.id),this.ui.el.appendChild(this.ui.back),this.ui.el.appendChild(this.ui.front)),this},xn.prototype.stylize=function(){if(this.options.dataOnly)return this;var t=this.options.fadeTime+"ms",e=(()=>{let s=tbt("borderRadius");for(let n in s)Object.prototype.hasOwnProperty.call(s,n)&&(s[n]="50%");return s})(),i=LL("transition","opacity",t),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)"},FL(r.el,i),this.options.shape==="circle"&&FL(r.back,e),FL(r.front,e),this.applyStyles(r),this},xn.prototype.applyStyles=function(t){for(var e in this.ui)if(Object.prototype.hasOwnProperty.call(this.ui,e))for(var i in t[e])this.ui[e].style[i]=t[e][i];return this},xn.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)||this.options.zone.appendChild(this.ui.el),this},xn.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)||this.options.zone.removeChild(this.ui.el),this},xn.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},xn.prototype.show=function(t){var e=this;return e.options.dataOnly||(clearTimeout(e.removeTimeout),clearTimeout(e.showTimeout),clearTimeout(e.restTimeout),e.addToDom(),e.restCallback(),setTimeout(function(){e.ui.el.style.opacity=1},0),e.showTimeout=setTimeout(function(){e.trigger("shown",e.instance),typeof t=="function"&&t.call(this)},e.options.fadeTime)),e},xn.prototype.hide=function(t){var e=this;if(e.options.dataOnly)return e;if(e.ui.el.style.opacity=e.options.restOpacity,clearTimeout(e.removeTimeout),clearTimeout(e.showTimeout),clearTimeout(e.restTimeout),e.removeTimeout=setTimeout(function(){var i=e.options.mode==="dynamic"?"none":"block";e.ui.el.style.display=i,typeof t=="function"&&t.call(e),e.trigger("hidden",e.instance)},e.options.fadeTime),e.options.restJoystick){let i=e.options.restJoystick,r={};r.x=i===!0||i.x!==!1?0:e.instance.frontPosition.x,r.y=i===!0||i.y!==!1?0:e.instance.frontPosition.y,e.setPosition(t,r)}return e},xn.prototype.setPosition=function(t,e){var i=this;i.frontPosition={x:e.x,y:e.y};var r=i.options.fadeTime+"ms",s={};s.front=LL("transition",["top","left"],r);var n={front:{}};n.front={left:i.frontPosition.x+"px",top:i.frontPosition.y+"px"},i.applyStyles(s),i.applyStyles(n),i.restTimeout=setTimeout(function(){typeof t=="function"&&t.call(i),i.restCallback()},i.options.fadeTime)},xn.prototype.restCallback=function(){var t=this,e={};e.front=LL("transition","none",""),t.applyStyles(e),t.trigger("rested",t.instance)},xn.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}},xn.prototype.computeDirection=function(t){var e,i,r,s=t.angle.radian,n=Math.PI/4,a=Math.PI/2;if(s>n&&s<3*n&&!t.lockX?e="up":s>-n&&s<=n&&!t.lockY?e="left":s>3*-n&&s<=-n&&!t.lockX?e="down":t.lockY||(e="right"),t.lockY||(i=s>-a&&s<a?"left":"right"),t.lockX||(r=s>0?"up":"down"),t.force>this.options.threshold){var o,l={};for(o in this.direction)Object.prototype.hasOwnProperty.call(this.direction,o)&&(l[o]=this.direction[o]);var u={};for(o in this.direction={x:i,y:r,angle:e},t.direction=this.direction,l)l[o]===this.direction[o]&&(u[o]=!0);if(u.x&&u.y&&u.angle)return t;(!u.x||!u.y)&&this.trigger("plain",t),u.x||this.trigger("plain:"+i,t),u.y||this.trigger("plain:"+r,t),u.angle||this.trigger("dir dir:"+e,t)}else this.resetDirection();return t};var hEt=xn;function Us(t,e){var i=this;i.nipples=[],i.idles=[],i.actives=[],i.ids=[],i.pressureIntervals={},i.manager=t,i.id=Us.id,Us.id+=1,i.defaults={zone:document.body,multitouch:!1,maxNumberOfNipples:10,mode:"dynamic",position:{top:0,left:0},catchDistance:200,size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,lockX:!1,lockY:!1,shape:"circle",dynamicPage:!1,follow:!1},i.config(e),(i.options.mode==="static"||i.options.mode==="semi")&&(i.options.multitouch=!1),i.options.multitouch||(i.options.maxNumberOfNipples=1);let r=getComputedStyle(i.options.zone.parentElement);return r&&r.display==="flex"&&(i.parentIsFlex=!0),i.updateBox(),i.prepareNipples(),i.bindings(),i.begin(),i.nipples}Us.prototype=new dW,Us.constructor=Us,Us.id=0,Us.prototype.prepareNipples=function(){var t=this,e=t.nipples;e.on=t.on.bind(t),e.off=t.off.bind(t),e.options=t.options,e.destroy=t.destroy.bind(t),e.ids=t.ids,e.id=t.id,e.processOnMove=t.processOnMove.bind(t),e.processOnEnd=t.processOnEnd.bind(t),e.get=function(i){if(i===void 0)return e[0];for(var r=0,s=e.length;r<s;r+=1)if(e[r].identifier===i)return e[r];return!1}},Us.prototype.bindings=function(){var t=this;t.bindEvt(t.options.zone,"start"),t.options.zone.style.touchAction="none",t.options.zone.style.msTouchAction="none"},Us.prototype.begin=function(){var t=this,e=t.options;if(e.mode==="static"){var i=t.createNipple(e.position,t.manager.getIdentifier());i.add(),t.idles.push(i)}},Us.prototype.createNipple=function(t,e){var i=this,r=i.manager.scroll,s={},n=i.options,a=i.parentIsFlex?r.x:r.x+i.box.left,o=i.parentIsFlex?r.y:r.y+i.box.top;if(t.x&&t.y)s={x:t.x-a,y:t.y-o};else if(t.top||t.right||t.bottom||t.left){var l=document.createElement("DIV");l.style.display="hidden",l.style.top=t.top,l.style.right=t.right,l.style.bottom=t.bottom,l.style.left=t.left,l.style.position="absolute",n.zone.appendChild(l);var u=l.getBoundingClientRect();n.zone.removeChild(l),s=t,t={x:u.left+r.x,y:u.top+r.y}}var h=new hEt(i,{color:n.color,size:n.size,threshold:n.threshold,fadeTime:n.fadeTime,dataOnly:n.dataOnly,restJoystick:n.restJoystick,restOpacity:n.restOpacity,mode:n.mode,identifier:e,position:t,zone:n.zone,frontPosition:{x:0,y:0},shape:n.shape});return n.dataOnly||(zL(h.ui.el,s),zL(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},Us.prototype.updateBox=function(){this.box=this.options.zone.getBoundingClientRect()},Us.prototype.bindNipple=function(t){var e,i=this,r=function(s,n){e=s.type+" "+n.id+":"+s.type,i.trigger(e,n)};t.on("destroyed",i.onDestroyed.bind(i)),t.on("shown hidden rested dir plain",r),t.on("dir:up dir:right dir:down dir:left",r),t.on("plain:up plain:right plain:down plain:left",r)},Us.prototype.pressureFn=function(t,e,i){var r=this,s=0;clearInterval(r.pressureIntervals[i]),r.pressureIntervals[i]=setInterval(function(){var n=t.force||t.pressure||t.webkitForce||0;n!==s&&(e.trigger("pressure",n),r.trigger("pressure "+e.identifier+":pressure",n),s=n)}.bind(r),100)},Us.prototype.onstart=function(t){var e=this,i=e.options,r=t;return t=Jvt(t),e.updateBox(),D9(t,function(s){e.actives.length<i.maxNumberOfNipples?e.processOnStart(s):r.type.match(/^touch/)&&(Object.keys(e.manager.ids).forEach(function(n){if(Object.values(r.touches).findIndex(function(o){return o.identifier===n})<0){var a=[t[0]];a.identifier=n,e.processOnEnd(a)}}),e.actives.length<i.maxNumberOfNipples&&e.processOnStart(s))}),e.manager.bindDocument(),!1},Us.prototype.processOnStart=function(t){var e,i=this,r=i.options,s=i.manager.getIdentifier(t),n=t.force||t.pressure||t.webkitForce||0,a={x:t.pageX,y:t.pageY},o=i.getOrCreate(s,a);o.identifier!==s&&i.manager.removeIdentifier(o.identifier),o.identifier=s;var l=function(u){u.trigger("start",u),i.trigger("start "+u.id+":start",u),u.show(),n>0&&i.pressureFn(t,u,u.identifier),i.processOnMove(t)};if((e=i.idles.indexOf(o))>=0&&i.idles.splice(e,1),i.actives.push(o),i.ids.push(o.identifier),r.mode!=="semi")l(o);else{if(!(cE(a,o.position)<=r.catchDistance))return o.destroy(),void i.processOnStart(t);l(o)}return o},Us.prototype.getOrCreate=function(t,e){var i,r=this,s=r.options;return/(semi|static)/.test(s.mode)?(i=r.idles[0])?(r.idles.splice(0,1),i):s.mode==="semi"?r.createNipple(e,t):(console.warn("Coudln't find the needed nipple."),!1):i=r.createNipple(e,t)},Us.prototype.processOnMove=function(t){var e=this,i=e.options,r=e.manager.getIdentifier(t),s=e.nipples.get(r),n=e.manager.scroll;if((b=>isNaN(b.buttons)?b.pressure!==0:b.buttons!==0)(t)){if(!s)return console.error("Found zombie joystick with ID "+r),void e.manager.removeIdentifier(r);if(i.dynamicPage){var a=s.el.getBoundingClientRect();s.position={x:n.x+a.left,y:n.y+a.top}}s.identifier=r;var o=s.options.size/2,l={x:t.pageX,y:t.pageY};i.lockX&&(l.y=s.position.y),i.lockY&&(l.x=s.position.x);var u,h,d=cE(l,s.position),c=((b,_)=>{let x=_.x-b.x,S=_.y-b.y;return(w=>w*(180/Math.PI))(Math.atan2(S,x))})(l,s.position),p=kL(c),m=d/o,f={distance:d,position:l};if(s.options.shape==="circle"?(u=Math.min(d,o),h=((b,_,x)=>{let S={x:0,y:0};return x=kL(x),S.x=b.x-_*Math.cos(x),S.y=b.y-_*Math.sin(x),S})(s.position,u,c)):(h=((b,_,x)=>({x:Math.min(Math.max(b.x,_.x-x),_.x+x),y:Math.min(Math.max(b.y,_.y-x),_.y+x)}))(l,s.position,o),u=cE(h,s.position)),i.follow){if(d>o){let b=l.x-h.x,_=l.y-h.y;s.position.x+=b,s.position.y+=_,s.el.style.top=s.position.y-(e.box.top+n.y)+"px",s.el.style.left=s.position.x-(e.box.left+n.x)+"px",d=cE(l,s.position)}}else l=h,d=u;var g=l.x-s.position.x,y=l.y-s.position.y;s.frontPosition={x:g,y},i.dataOnly||zL(s.ui.front,s.frontPosition);var v={identifier:s.identifier,position:l,force:m,pressure:t.force||t.pressure||t.webkitForce||0,distance:d,angle:{radian:p,degree:c},vector:{x:g/o,y:-y/o},raw:f,instance:s,lockX:i.lockX,lockY:i.lockY};(v=s.computeDirection(v)).angle={radian:kL(180-c),degree:180-c},s.trigger("move",v),e.trigger("move "+s.id+":move",v)}else this.processOnEnd(t)},Us.prototype.processOnEnd=function(t){var e=this,i=e.options,r=e.manager.getIdentifier(t),s=e.nipples.get(r),n=e.manager.removeIdentifier(s.identifier);!s||(i.dataOnly||s.hide(function(){i.mode==="dynamic"&&(s.trigger("removed",s),e.trigger("removed "+s.id+":removed",s),e.manager.trigger("removed "+s.id+":removed",s),s.destroy())}),clearInterval(e.pressureIntervals[s.identifier]),s.resetDirection(),s.trigger("end",s),e.trigger("end "+s.id+":end",s),e.ids.indexOf(s.identifier)>=0&&e.ids.splice(e.ids.indexOf(s.identifier),1),e.actives.indexOf(s)>=0&&e.actives.splice(e.actives.indexOf(s),1),/(semi|static)/.test(i.mode)?e.idles.push(s):e.nipples.indexOf(s)>=0&&e.nipples.splice(e.nipples.indexOf(s),1),e.manager.unbindDocument(),/(semi|static)/.test(i.mode)&&(e.manager.ids[n.id]=n.identifier))},Us.prototype.onDestroyed=function(t,e){var i=this;i.nipples.indexOf(e)>=0&&i.nipples.splice(i.nipples.indexOf(e),1),i.actives.indexOf(e)>=0&&i.actives.splice(i.actives.indexOf(e),1),i.idles.indexOf(e)>=0&&i.idles.splice(i.idles.indexOf(e),1),i.ids.indexOf(e.identifier)>=0&&i.ids.splice(i.ids.indexOf(e.identifier),1),i.manager.removeIdentifier(e.identifier),i.manager.unbindDocument()},Us.prototype.destroy=function(){var t=this;for(var e in t.unbindEvt(t.options.zone,"start"),t.nipples.forEach(function(i){i.destroy()}),t.pressureIntervals)Object.prototype.hasOwnProperty.call(t.pressureIntervals,e)&&clearInterval(t.pressureIntervals[e]);t.trigger("destroyed",t.nipples),t.manager.unbindDocument(),t.off(),t.pressureIntervals={},t.nipples=[],t.idles=[],t.actives=[],t.ids=[],t.manager=null};var uEt=Us;function en(t){var e=this;e.ids={},e.index=0,e.collections=[],e.scroll=Xht(),e._windowBound=!1,e.config(t),e.prepareCollections();var i=function(){var r;e.collections.forEach(function(s){s.forEach(function(n){r=n.el.getBoundingClientRect(),n.position={x:e.scroll.x+r.left,y:e.scroll.y+r.top}})})};return e._onResize=function(){(r=>{pE.has(r)&&clearTimeout(pE.get(r)),pE.set(r,setTimeout(function(){pE.delete(r),r()},100))})(i)},e._onScroll=function(){e.scroll=Xht()},e.collections}en.prototype=new dW,en.constructor=en,en.prototype.prepareCollections=function(){var t=this;t.collections.create=t.create.bind(t),t.collections.on=t.on.bind(t),t.collections.off=t.off.bind(t),t.collections.destroy=t.destroy.bind(t),t.collections.get=function(e){var i;return t.collections.every(function(r){return!(i=r.get(e))}),i}},en.prototype.create=function(t){return this.createCollection(t)},en.prototype.bindWindowEvents=function(){var t=this;t._windowBound||typeof window>"u"||(t._windowBound=!0,W4(window,"resize",t._onResize),W4(window,"scroll",t._onScroll))},en.prototype.unbindWindowEvents=function(){var t=this;!t._windowBound||typeof window>"u"||(t._windowBound=!1,q4(window,"resize",t._onResize),q4(window,"scroll",t._onScroll))},en.prototype.createCollection=function(t){var e=this,i=new uEt(e,t);return e.bindCollection(i),e.collections.push(i),e.bindWindowEvents(),i},en.prototype.bindCollection=function(t){var e,i=this,r=function(s,n){e=s.type+" "+n.id+":"+s.type,i.trigger(e,n)};t.on("destroyed",i.onDestroyed.bind(i)),t.on("shown hidden rested dir plain",r),t.on("dir:up dir:right dir:down dir:left",r),t.on("plain:up plain:right plain:down plain:left",r)},en.prototype.bindDocument=function(){var t=this;t.binded||(t.bindEvt(document,"move").bindEvt(document,"end"),t.binded=!0)},en.prototype.unbindDocument=function(t){var e=this;(!Object.keys(e.ids).length||t===!0)&&(e.unbindEvt(document,"move").unbindEvt(document,"end"),e.binded=!1)},en.prototype.getIdentifier=function(t){var e;return t?(e=t.identifier===void 0?t.pointerId:t.identifier)===void 0&&(e=this.latest||0):e=this.index,this.ids[e]===void 0&&(this.ids[e]=this.index,this.index+=1),this.latest=e,this.ids[e]},en.prototype.removeIdentifier=function(t){var e={};for(var i in this.ids)if(this.ids[i]===t){e.id=i,e.identifier=this.ids[i],delete this.ids[i];break}return e},en.prototype.onmove=function(t){return this.onAny("move",t),!1},en.prototype.onend=function(t){return this.onAny("end",t),!1},en.prototype.oncancel=function(t){return this.onAny("end",t),!1},en.prototype.onAny=function(t,e){var i,r=this,s="processOn"+t.charAt(0).toUpperCase()+t.slice(1);e=Jvt(e);var n=function(a,o,l){l.ids.indexOf(o)>=0&&(l[s](a),a._found_=!0)};return D9(e,function(a){i=r.getIdentifier(a),D9(r.collections,n.bind(null,a,i)),a._found_||r.removeIdentifier(i)}),!1},en.prototype.destroy=function(){var t=this;t.unbindDocument(!0),t.unbindWindowEvents(),t.ids={},t.index=0,t.collections.forEach(function(e){e.destroy()}),t.collections=[],t.off()},en.prototype.onDestroyed=function(t,e){var i=this;if(i.collections.indexOf(e)<0)return!1;i.collections.splice(i.collections.indexOf(e),1),i.collections.length===0&&i.unbindWindowEvents()};var dEt=en,Cv=null;function Kht(){return Cv||(Cv=new dEt),Cv}var cEt={create:function(t){return Kht().create(t)},destroy:function(){Cv&&(Cv.destroy(),Cv=null)},get factory(){return Kht()}},pEt=cEt;cr(),Le(),yt(),Zh(),vo(),Le();var sbt=null;function UL(){return sbt}var nbt,jL,mEt=new Promise(t=>{nbt=t});function fEt(t){return jL||(jL=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.30/build",i=import("./physics.js"),[r,s]=await Promise.all([i,fetch(`${e}/physics.wasm`).then(n=>n.arrayBuffer())]);await r.init(s),nbt(r)}(),jL)}function abt(t){let e=t.elements,i=e[0]**2+e[1]**2+e[2]**2,r=e[4]**2+e[5]**2+e[6]**2,s=e[8]**2+e[9]**2+e[10]**2,n=e[0]**2+e[4]**2+e[8]**2,a=e[1]**2+e[5]**2+e[9]**2,o=e[2]**2+e[6]**2+e[10]**2,l=1e-8;return i<l||r<l||s<l||n<l||a<l||o<l}function ac(t,e){let i=new ye;if(e&&abt(e))return i.setAttribute("position",new me([],3)),i.setIndex([]),i;if(!t.getAttribute("position"))return i.setAttribute("position",new me([],3)),i.setIndex([]),i;let{positions:r,triIndices:s}=eG(t.getAttribute("position"),t.getIndex());return i.setAttribute("position",new me(r,3)),i.setIndex(s),e&&i.applyMatrix4(e),i}ss(),vo(),Ii(),gG(),yt(),yt(),Zv(),BS();var ki,gEt=class{constructor(t,e,i,r,s,n){this.id=t,this.data=e,this.object=i,this.initialDisabled=!1,this.actions=hn(e,e.actions,r,s,n,i),this.target=e.target}disconnect(){sa(this.actions)}dispatch(t){this.initialDisabled||(this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Collision"}),this.actions.Transition.forEach(e=>e.play()),this.actions.Animation.forEach(e=>{e.data.runMode==="Toggle"?e.toggle():e.play()}),this.actions.TimelineAnimation.forEach(e=>{"runMode"in e.data&&e.data.runMode==="Toggle"?e.toggle():e.play()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Link.forEach(e=>{e.dispatch()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Create.forEach(e=>{e.dispatch()}),this.actions.Destroy.forEach(e=>{e.dispatch(t??!1)}),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.Audio.forEach(e=>{e.dispatchBasic()}),this.actions.Particles.forEach(e=>{e.dispatchBasic()}),this.actions.Video.forEach(e=>{e.dispatchBasic()}),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch()))}},Zht=class{constructor(t,e,i,r,s,n){this.id=t,this.data=e,this.object=i,this.page=r,this.currentIntersectedObjects=[],this.actions=hn(e,e.actions,r,s,n,i),this.target=e.target,this.triggeringObjects=[];for(let a of e.triggeringObjects){let o=r.scene.find(a);o&&this.triggeringObjects.push(o)}}isValidTriggeringObject(t){return this.target==="all"||this.triggeringObjects.some(e=>e===t||e.isAncestorOf(t.uuid)||t.isAncestorOf(e.uuid))}disconnect(){sa(this.actions)}dispatch(){this.object.destroyedInAction||(this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Trigger"}),this.actions.Transition.forEach(t=>t.play()),this.actions.SwitchCamera.forEach(t=>{t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.TimelineAnimation.forEach(t=>{"runMode"in t.data&&t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.Link.forEach(t=>{t.dispatch()}),this.actions.Reset.forEach(t=>{t.dispatch()}),this.actions.Create.forEach(t=>{t.dispatch()}),this.actions.Destroy.forEach(t=>{t.dispatch(!1)}),this.actions.Audio.forEach(t=>{t.dispatchBasic()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()}),this.actions.Video.forEach(t=>{t.dispatchBasic()}),this.actions.SceneTransition.forEach(t=>{t.dispatch()}),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch()))}};ss(),mEt.then(t=>ki=t);var tn=new P,jl=new Pe,wp=new P,Qht=(new ur(0,0,0,"YXZ"),new ur(0,0,0,"XYZ")),Eh=new P,GL=new P,WL=new P(1,1,1),Ky=new Pe,mE=new At,Jht=new At,yEt={type:"updateMatrix"},tut=new Pe,qL=new Zn,HL=.01,O9={type:"beginEvent",eventName:"Collision"},vEt={type:"beginEvent",eventName:"Trigger"},H4=t=>t.states.some(e=>e.data.position!==void 0||e.data.rotation!==void 0||e.data.hiddenMatrix!==void 0||e.data.cloner!==void 0||e.data.pathSnapping!==void 0);function Zy(t){return function(e){return typeof e=="object"&&e!==null&&"booleanOp"in e}(Sg(t)?t.object:t)}var bEt=class{constructor(t){this.eventContext=t,this.isEnabled=!1,this.gameControl=null,this.joysticks=[],this.joystickToGameControls=[],this.sharedGameControlGlobals={entitiesWithTransformAnim:[],entityToCollisionEvents:{},colliderToEntity:new Map,kinematicBodyToEntity:new Map,triggers:[],gamePads:[],createdObjects:[],nCreatedPerAction:{}},this.sensorToTriggerEvent={},this.eventManager=void 0,this.needsCollisionDetection=!1,this.initializationCounter=-1,this.fixedBodiesToWatch=[],this.rigidBodyToMesh=new Map,this.nActiveRigidBodies=0,this.collisionEvents=[],this.isExport=!1,this.skipRender=!0,this._staticBVHAttrIds=new WeakMap,this._staticBVHNextAttrId=1,this.processRigidBody=e=>{if(e.bodyType()!==ki.RigidBodyType.Dynamic)return;e.isSleeping()||this.nActiveRigidBodies++;let[i,r,s]=this.rigidBodyToMesh.get(e.handle);if(tn.copy(e.translation()).multiplyScalar(this.pixelsPerMeter),jl.copy(e.rotation()),i.matrixWorld.compose(tn,jl,r),i.hasNonUniformScale&&i.matrixWorld.multiply(i.shearScale),i.dispatchEvent(yEt),s){let n=i.cloner;if(n&&n.objectForSample===void 0){n.matrixWorld.copy(i.matrixWorld);for(let a of n.children)a.updateMatrixWorld(!0)}for(let a of i.children)a.updateMatrixWorld(!0)}},this.accumulator=0,this.handleCollisionEvents=(e,i,r)=>{if(r===!1)return;let s,n;if(this.sensorToTriggerEvent[e]?(s=this.sensorToTriggerEvent[e],n=this.sharedGameControlGlobals.colliderToEntity.get(i)):this.sensorToTriggerEvent[i]&&(s=this.sensorToTriggerEvent[i],n=this.sharedGameControlGlobals.colliderToEntity.get(e)),s&&n&&s.isValidTriggeringObject(n))s.dispatch();else{for(let a=this.sharedGameControlGlobals.createdObjects.length-1;a>=0;a--){let o=this.sharedGameControlGlobals.createdObjects[a];if(o.userData.hasCollisionDestroy&&(o.rigidBody?.collider(0).handle===e||o.rigidBody?.collider(0).handle===i)){this.sharedGameControlGlobals.createdObjects.splice(a,1),o.removeFromParent();let l=o.rigidBody;requestAnimationFrame(()=>{o.rigidBody===l&&(this.sharedGameControlGlobals.rapierWorld?.removeRigidBody(l),o.rigidBody=void 0)});break}}if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(e)){let a=this.sharedGameControlGlobals.colliderToEntity.get(i),o=this.sharedGameControlGlobals.entityToCollisionEvents[a.uuid];if(o===void 0)return;for(let l of o)l.data.target==="character"&&this.dispatchCollisionEvent(l,a,i)}else if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(i)){let a=this.sharedGameControlGlobals.colliderToEntity.get(e),o=this.sharedGameControlGlobals.entityToCollisionEvents[a.uuid];if(o===void 0)return;for(let l of o)l.data.target==="character"&&this.dispatchCollisionEvent(l,a,e)}else{let a=this.sharedGameControlGlobals.colliderToEntity.get(e),o=this.sharedGameControlGlobals.entityToCollisionEvents[a.uuid];if(o!==void 0)for(let h of o)h.data.target==="scene"&&this.dispatchCollisionEvent(h,a,e);let l=this.sharedGameControlGlobals.colliderToEntity.get(i),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=t.isExport,this.sharedAssets=t.sharedAssets,this.renderer=t.renderer,this.requestRender=t.requestRender,this.domElement=this.renderer.domElement,this.pixelsPerMeter=200,this.gravity=this.page.data.globalPhysics.gravity}get page(){return this.eventContext.page}markIsDestroyTarget(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let i of e.events){if(i.data.disabled===!0)continue;let r=i.data.actions?.find(s=>s.data.type==="Destroy")?.data;if(r)for(let s of r.objects){let n=this.page.scene.find(s);n&&(n.userData.hasDestroy=!0)}}})}markIsDragObject(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let i of e.events)if(i.data.disabled!==!0&&i.data.type==="DragDrop")for(let r of i.data.objects){let s=this.page.scene.find(r);s&&(s.userData.hasDrag=!0)}})}_staticBVHIdOf(t){let e=this._staticBVHAttrIds.get(t);return e===void 0&&(e=this._staticBVHNextAttrId++,this._staticBVHAttrIds.set(t,e)),e}initBVH(){if(UL()===null)return void Pn("collision-bvh","trigger/collision detection");let t=[],e=[];if(this.page.traverseChildren(i=>{let r,s=i instanceof vv,n=k2(i);if($1(i)||s||n)return;r=Sg(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(H4(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){t.push({geometry:o,matrixWorld:i.matrixWorld}),e.push(o.id,this._staticBVHIdOf(h),h.version,o.index!==null?this._staticBVHIdOf(o.index):-1,o.index!==null?o.index.version:-1);for(let d of i.matrixWorld.elements)e.push(d)}}return!!Zy(i)||void 0}),t.length>0){let i=this._staticBVHCache;if(i!==void 0&&i.signature.length===e.length&&i.signature.every((n,a)=>n===e[a]))return void(this.sharedGameControlGlobals.staticMeshBVH=i.bvh);let r=wg(t.map(n=>ac(n.geometry,n.matrixWorld)),!1),s=new(UL())(r);this._staticBVHCache={signature:e,bvh:s},this.sharedGameControlGlobals.staticMeshBVH=s}}addRigidBody(t,e,i){if(abt(t.matrixWorld))return;let r=[],s="geometry"in t?t.geometry:void 0,n=e.dataPatched;if(s?.getAttribute("position")!==void 0&&r.push(ac(s,t.shearScale)),n.physics.fusedBody){let a=this.gatherChildrenGeom(t,r);t.traverseObject(a),t.children.forEach(l=>l.updateMatrixWorld(!0));let o=t.cloner;o&&o.objectForSample===void 0&&n.physics.rigidBody==="dynamic"&&(o.traverseObject(a),o.children.forEach(l=>l.updateMatrixWorld(!0)))}if(r.length>0){let a,o=!1,l=!i.fromCreate&&n.physics.rigidBody==="dynamic"||i.fromCreate&&i.dynamic;l?(a=ki.RigidBodyDesc.dynamic(),a.setLinearDamping(n.physics.damping).setAngularDamping(n.physics.damping).setAdditionalMass(1e-9).setGravityScale(n.physics.gravityScale).enabledRotations(...n.physics.enabledRotation).enabledTranslations(...n.physics.enabledTranslation)):(i.hasTransformAnim||i.hasFollow||i.hasDrag)&&!i.fromCreate?(a=ki.RigidBodyDesc.kinematicPositionBased(),o=!0):a=ki.RigidBodyDesc.fixed();let u=wg(r);(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(tn,jl,wp),t.position0=tn.clone().divideScalar(this.pixelsPerMeter),t.rotation0=jl.clone(),tn.divideScalar(this.pixelsPerMeter),a.setTranslation(tn.x,tn.y,tn.z).setRotation(jl),s?u?.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter):u?.scale(wp.x/this.pixelsPerMeter,wp.y/this.pixelsPerMeter,wp.z/this.pixelsPerMeter);let h=this.sharedGameControlGlobals.rapierWorld.createRigidBody(a),d=!(n.geometry===void 0||n.geometry.type==="SubdivGeometry"||n.geometry.type==="NonParametricGeometry"||n.geometry.type==="BooleanGeometry"||n.geometry.type==="VectorGeometry"||n.geometry.type==="StarGeometry"||n.geometry.type==="RectangleGeometry"||n.geometry.type==="EllipseGeometry"||n.geometry.type==="TriangleGeometry"||n.geometry.type==="TorusGeometry"||n.geometry.type==="HelixGeometry");try{this.addCollider(h,n.physics,u,e,d)}catch{try{this.addCollider(h,n.physics,u,e,!1)}catch(c){console.error(c)}}if(h.numColliders()===0)return void this.sharedGameControlGlobals.rapierWorld.removeRigidBody(h);l?this.rigidBodyToMesh.set(h.handle,[t,wp.clone(),n.physics.fusedBody]):o?(this.sharedGameControlGlobals.kinematicBodyToEntity.set(h.handle,t),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t)):this.fixedBodiesToWatch.push([t,h,(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).clone()]),t.rigidBody=h}}addBoundsTree(t){let e=[];if(t.geometry?.getAttribute("position")!==void 0&&t.geometry?.getAttribute("position").count>0&&e.push(ac(t.geometry,t.shearScale)),t.traverseObject(this.gatherChildrenGeom(t,e)),t.children.forEach(i=>i.updateMatrixWorld(!0)),e.length>0){let i=wg(e,!1);t.bvhGeometry=i,i.getAttribute("position").count>0&&(t.bvhGeometry.boundsTree=new(UL())(i),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t))}}addCollider(t,e,i,r,s=!0){if(i?.getAttribute("position").count===0||i?.getIndex()?.count===0)return;let n;i&&(n=e.colliderType==="trimesh"?ki.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array):ki.ColliderDesc.convexMesh(i.getAttribute("position").array,s?i.getIndex().array:void 0)),n.setFrictionCombineRule(ki.CoefficientCombineRule.Average).setRestitutionCombineRule(ki.CoefficientCombineRule.Average).setDensity(e.density).setFriction(e.friction).setRestitution(e.restitution);let a=this.sharedGameControlGlobals.rapierWorld.createCollider(n,t);this.sharedGameControlGlobals.colliderToEntity.set(a.handle,r),this.sharedGameControlGlobals.entityToCollisionEvents[r.uuid]?.some(o=>o.target==="scene")&&a.setActiveEvents(ki.ActiveEvents.COLLISION_EVENTS)}gatherChildrenGeom(t,e){let i=Zy(t);return(r,s)=>{if(s===0)return;if(i&&r.parent===t)return!0;let n;if($1(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;n=r.object}else if(Sg(r))n=r.object;else if(n=r,n.dataPatched.cloner?.hideBase)return!0;let a=n.dataPatched;if(a.physics.enabled==="visibility"?!a.visible:!a.physics.enabled)return!0;s===1?t.hasNonUniformScale?r.matrixWorld.multiplyMatrices(t.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&&e.push(ac(o,r.matrixWorld)),!!Zy(r)||void 0}}activate(t){if(this.isEnabled)return;this.isEnabled=!0,this.eventManager=t,this.usePhysics=this.page.data.globalPhysics.usePhysics;let e=this.page.playCamera,i=!1;this.page.traverseEntity(a=>{for(let o of a.dataPatched.events)if(o.data.disabled===!1&&o.data.type==="Trigger")return this.needsCollisionDetection=!0,!0});let r=$ht();if(r!==null?i=r.setup({manager:this,camera:e,renderer:this.renderer,sharedAssets:this.sharedAssets,eventContext:this.eventContext,isExport:this.isExport})||i:this.page.data.publish.gameControlObject!==null&&Pn("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 kvt(e,this.renderer.domElement,{isExport:this.isExport,isPlayMode:!0}),this.orbitControls.addEventListener("change",this.requestRender),this.orbitControls.addEventListener("end",this.requestRender),this.orbitControls.addEventListener("start",this.requestRender),this.orbitControls.fromJSON(this.eventManager.publish.orbitControls,this.eventManager.publish.mouseEventTarget),this.orbitControls.useKeyEvents=!1,this.orbitControls.addEventListenersToCamera(),this.orbitControls.connect(),this.orbitControls.update())}let s=this.renderer.domElement.width/this.renderer.getPixelRatio(),n=this.renderer.domElement.height/this.renderer.getPixelRatio();$ht()?.createJoysticks(this,s,n),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 ki.World(new ki.Vector3(0,this.gravity,0)),this.events=new ki.EventQueue(!0);let t=[],e=[];if(this.page.traverseChildren(a=>{let o;if($1(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(Sg(a))o=a.object;else{if(k2(a)||Zg(a)||a instanceof vv)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=H4(u),d=!1,c=o.userData.hasDestroy,p=o.userData.hasDrag,m=!1;for(let g of u.events)if(g.data.disabled!==!0){if(g.data.type==="Collision"){d=!0;let y=new gEt(g.id,g.data,o,this.page,this.sharedAssets,this.eventManager);y.initialDisabled=!0,this.collisionEvents.push(y),this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid]&&this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid].every(v=>v.id!==g.id)?this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid].push(y):this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid]=[y]}else if(g.data.type==="Follow"){m=!0;let y=g.data.target;a.traverseVisible(v=>{v.userData.isFollowingObj=y})}}u.physics.rigidBody==="dynamic"&&u.physics.fusedBody===!1&&(a.matrixWorldFusedFalse=a.matrixWorld.clone());let f=a.geometry;if(l!==void 0){let g=ki.RigidBodyDesc.kinematicPositionBased();(a.hasNonUniformScale?a.matrixWorldRigid:a.matrixWorld).decompose(tn,jl,wp),a.position0=tn.clone().divideScalar(this.pixelsPerMeter),a.rotation0=jl.clone(),tn.divideScalar(this.pixelsPerMeter),g.setTranslation(tn.x,tn.y,tn.z).setRotation(jl);let y,v=this.sharedGameControlGlobals.rapierWorld.createRigidBody(g);a.rigidBody=v,y=l.collider.type==="sphere"?ki.ColliderDesc.ball(l.collider.radius/this.pixelsPerMeter):l.collider.type==="capsule"?ki.ColliderDesc.capsule((l.collider.height/2-l.collider.radius)/this.pixelsPerMeter,l.collider.radius/this.pixelsPerMeter):ki.ColliderDesc.cuboid(l.collider.width/this.pixelsPerMeter/2,l.collider.height/this.pixelsPerMeter/2,l.collider.depth/this.pixelsPerMeter/2),y.setFrictionCombineRule(ki.CoefficientCombineRule.Average).setDensity(u.physics.density).setFriction(u.physics.friction).setRestitution(0).setRestitutionCombineRule(ki.CoefficientCombineRule.Min);let b=this.sharedGameControlGlobals.rapierWorld.createCollider(y,v);this.sharedGameControlGlobals.colliderToEntity.set(b.handle,o),tn.fromArray(l.collider.position.map(x=>typeof x=="number"?x:0)).multiply(wp.setFromMatrixScale(o.matrixWorld)).divideScalar(this.pixelsPerMeter),b.setTranslationWrtParent(tn);let _=new Pe().setFromEuler(new ur().setFromVector3(new P().fromArray(l.collider.rotation.map(x=>typeof x=="number"?x:0))));b.setRotationWrtParent(_),b.setActiveEvents(ki.ActiveEvents.COLLISION_EVENTS),this.generateSensorColliderDescs(o,!0)}else u.physics.rigidBody==="dynamic"||h||m||c||p||d?(this.addRigidBody(a,o,{hasFollow:m,hasTransformAnim:h,hasDrag:p}),this.generateSensorColliderDescs(o,u.physics.fusedBody)):(f&&t.push(ac(f,a.matrixWorld)),u.physics.fusedBody&&!Zy(a)&&a.traverseObject((g,y)=>{if(y===0)return;let v;if($1(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;v=g.object}else{if(k2(g)||Zg(g)||g instanceof vv)return;if(Sg(g))v=g.object;else if(v=g,v.dataPatched.cloner?.hideBase)return!0}let b=v.dataPatched;if(b.physics.enabled==="visibility"?!b.visible:!b.physics.enabled)return!0;let _=g.geometry;return _?.getAttribute("position")!==void 0&&t.push(ac(_,g.matrixWorld)),!!Zy(g)||void 0}),this.generateSensorColliderDescs(o,u.physics.fusedBody,e));return!(u.physics?.fusedBody!==!0&&!l&&!Zy(a))||void 0}),t.length===0)return;let i=wg(t),r=i.getIndex().count>0;if(!r&&e.length===0)return;i.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter);let s=ki.RigidBodyDesc.fixed(),n=this.sharedGameControlGlobals.rapierWorld.createRigidBody(s);if(r){let a=ki.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array).setFrictionCombineRule(ki.CoefficientCombineRule.Multiply).setRestitutionCombineRule(ki.CoefficientCombineRule.Multiply).setFriction(1).setRestitution(1);this.sharedGameControlGlobals.rapierWorld.createCollider(a,n)}for(let[a,o]of e){let l=this.sharedGameControlGlobals.rapierWorld.createCollider(a,n);this.sensorToTriggerEvent[l.handle]=o}}updatePositions(){return this.nActiveRigidBodies=0,this.sharedGameControlGlobals.rapierWorld.forEachRigidBody(this.processRigidBody),this.nActiveRigidBodies>0}rebuildBVH(){this.usePhysics?this.initPhysics():(this.page.traverseEntity(t=>{for(let e of t.dataPatched.events)if(e.data.type==="Trigger"&&e.data.disabled!==!0){let i=new Zht(e.id,e.data,t,this.page,this.sharedAssets,this.eventManager),r=new At().compose(Eh.fromArray(e.data.position.map(s=>typeof s=="number"?s:0)),Ky.setFromEuler(Qht.fromArray(e.data.rotation.map(s=>typeof s=="number"?s:0))),WL);if(e.data.triggerZone==="box"){let s=new dr;s.min.fromArray(e.data.size.map(n=>typeof n=="number"?n:0)).multiplyScalar(-.5),s.max.fromArray(e.data.size.map(n=>typeof n=="number"?n:0)).multiplyScalar(.5),this.sharedGameControlGlobals.triggers.push([s,r,t,i])}else this.sharedGameControlGlobals.triggers.push([e.data.radius,r,t,i])}}),this.needsCollisionDetection&&this.initBVH())}disconnectEvents(){this.collisionEvents.forEach(t=>t.disconnect()),this.sharedGameControlGlobals.triggers.forEach(t=>t[3].disconnect()),this.sharedGameControlGlobals.triggers.length=0}deactivate(){if(this.isEnabled){this.isEnabled=!1,this.page.traverse(t=>{let e=t;e.matrixWorldFusedFalse&&(e.matrixWorldFusedFalse=void 0),e.rigidBody&&(e.rigidBody=void 0),e.position0&&(e.position0=void 0),e.rotation0&&(e.rotation0=void 0)}),this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=void 0,this.sharedGameControlGlobals.staticMeshBVH=void 0,this.accumulator=0,this.sharedGameControlGlobals.entitiesWithTransformAnim=[],this.sharedGameControlGlobals.kinematicBodyToEntity.clear(),this.fixedBodiesToWatch=[],this.disconnectEvents(),this.gameControl?.reset(),this.gameControl?.dispose(),this.gameControl=null,this.initializationCounter=-1,this.joysticks.forEach(([t,e])=>{t?.destroy(),e.remove()}),this.joystickToGameControls=[],this.joysticks=[],this.orbitControls&&(this.orbitControls.dispose(),this.orbitControls=void 0),this.navigationMeshWrapper?.dispose(),this.navigationMeshWrapper=void 0;for(let t of Object.values(this.sharedGameControlGlobals.entityToCollisionEvents))t.forEach(e=>e.disconnect());this.sharedGameControlGlobals.entityToCollisionEvents={},this.page.updateMatrixWorld(!0)}}update(t){if(!this.isEnabled)return!0;let e=!0;if(this.orbitControls!==void 0&&this.orbitControls.needsUpdate&&(this.orbitControls.update(),e=!this.orbitControls.isCurrentlyDamping),this.initializationCounter>=0&&this.initializationCounter<2?(this.initializationCounter++,e=!1):this.initializationCounter===2&&this.gameControl&&(e=!this.gameControl.update(t)&&e),this.usePhysics===!1&&this.checkTrigger(),this.usePhysics){let i=.016666666666666666;if(t===0)e=this.stepPhysics()&&e;else{let r=t/1e3;r<i&&r>.55*i&&(r=i),this.accumulator+=r;let s=performance.now(),n=0,a=6;for(;this.accumulator>=i&&n<a&&(e=this.stepPhysics()&&e,this.accumulator-=i,n++,!(performance.now()-s>1e3*i)););this.accumulator=this.accumulator%i}}this.skipRender=e}recordPhysicsPose(t){(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(tn,jl,wp);let e=t;e.prevQ===void 0?(e.prevQ=jl.clone(),e.prevT=tn.clone()):(e.prevQ.copy(jl),e.prevT.copy(tn))}promoteMovedFixedBodies(){for(let t=this.fixedBodiesToWatch.length-1;t>=0;t--){let[e,i,r]=this.fixedBodiesToWatch[t];(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).equals(r)||(i.setBodyType(ki.RigidBodyType.KinematicPositionBased,!0),this.sharedGameControlGlobals.kinematicBodyToEntity.set(i.handle,e),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e),this.fixedBodiesToWatch.splice(t,1))}}clampPushedBodies(){let t=this.gameControl?.object.rigidBody;if(t===void 0)return;let e=this.sharedGameControlGlobals.rapierWorld,i=t.linvel(),r=t.translation(),s=Math.hypot(i.x,i.z);for(let n=0;n<t.numColliders();n++){let a=t.collider(n);e.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(e.contactPair(a,o,y=>{let v=y.normal(),b=v.x*(u.x-r.x)+v.y*(u.y-r.y)+v.z*(u.z-r.z)<0?-1:1;if(Math.abs(v.y)>.7)return;let _=b*v.x,x=b*v.z,S=Math.hypot(_,x);if(S<1e-4)return;let w=(i.x*_+i.z*x)/S;w>h&&(h=w,d=_/S,c=x/S)}),h===-1/0)return;let p=i.x*d+i.z*c;if(p<-HL)return;let m=l.linvel();if(s>HL&&p>HL){let y=m.x*d+m.z*c;if(y<=0)return;let v=Math.min(y,p);return void l.setLinvel({x:d*v,y:m.y,z:c*v},!0)}let f=m.x*d+m.z*c-Math.max(0,p);if(f<=0)return;let g=.5*f;l.setLinvel({x:m.x-d*g,y:m.y,z:m.z-c*g},!0)})}}stepPhysics(){this.promoteMovedFixedBodies();for(let t of this.sharedGameControlGlobals.kinematicBodyToEntity.values())this.recordPhysicsPose(t),t.rigidBody.setNextKinematicTranslation(tn.divideScalar(this.pixelsPerMeter)),t.rigidBody.setNextKinematicRotation(jl);for(let t of this.sharedGameControlGlobals.entitiesWithTransformAnim)t.rigidBody?.isKinematic()!==!0&&this.recordPhysicsPose(t);return this.sharedGameControlGlobals.rapierWorld.step(this.events),this.clampPushedBodies(),this.events?.drainCollisionEvents(this.handleCollisionEvents),!this.updatePositions()}dispatchCollisionEvent(t,e,i){let r,s=(this.sharedGameControlGlobals.rapierWorld?.getCollider(i))._parent;if(e.cloner){for(let n of e.cloner.children)if(n.rigidBody===s){r=n;break}}t.dispatch(r),e.dispatchEvent(O9)}updateUseWindowEvents(t){this.orbitControls?.updateUseWindowEvents(t)}generateSensorColliderDescs(t,e,i){let r=Jht.copy(t.matrixWorld).invert();t.traverseEntity((s,n)=>{if(e===!1&&n===1)return!0;for(let a of s.dataPatched.events)if(a.data.type==="Trigger"&&a.data.disabled!==!0){let o,l=new Zht(a.id,a.data,s,this.page,this.sharedAssets,this.eventManager);if(o=a.data.triggerZone==="box"?ki.ColliderDesc.cuboid(...a.data.size.map(u=>(typeof u=="number"?u:1)/(2*this.pixelsPerMeter))):ki.ColliderDesc.ball(a.data.radius/this.pixelsPerMeter),o.setDensity(0).setSensor(!0).setActiveEvents(ki.ActiveEvents.COLLISION_EVENTS),Eh.fromArray(a.data.position.map(u=>typeof u=="number"?u:0)),Ky.setFromEuler(Qht.fromArray(a.data.rotation.map(u=>typeof u=="number"?u:0))),mE.compose(Eh,Ky,WL).premultiply(s.matrixWorld),i?(mE.decompose(Eh,Ky,GL),o.setActiveCollisionTypes(ki.ActiveCollisionTypes.KINEMATIC_FIXED|ki.ActiveCollisionTypes.DYNAMIC_FIXED)):(mE.premultiply(r).decompose(Eh,Ky,GL),t.rigidBody.bodyType()===ki.RigidBodyType.Dynamic||(t.rigidBody.bodyType()===ki.RigidBodyType.Fixed?o.setActiveCollisionTypes(ki.ActiveCollisionTypes.KINEMATIC_FIXED|ki.ActiveCollisionTypes.DYNAMIC_FIXED):o.setActiveCollisionTypes(ki.ActiveCollisionTypes.KINEMATIC_KINEMATIC|ki.ActiveCollisionTypes.DYNAMIC_KINEMATIC))),Eh.divideScalar(this.pixelsPerMeter),o.setTranslation(Eh.x,Eh.y,Eh.z),o.setRotation(Ky),i)i.push([o,l]);else{let u=this.sharedGameControlGlobals.rapierWorld.createCollider(o,t.rigidBody);this.sensorToTriggerEvent[u.handle]=l}}})}checkTrigger(){let t;for(let e=0;e<this.sharedGameControlGlobals.triggers.length;e++){let[i,r,s,n]=this.sharedGameControlGlobals.triggers[e];for(let a=0;a<this.sharedGameControlGlobals.entitiesWithTransformAnim.length;a++){let o=this.sharedGameControlGlobals.entitiesWithTransformAnim[a];if(s===o||n.isValidTriggeringObject(Ai.is(o)?o:o.object)===!1)continue;let l=Jht.copy(s.matrixWorld).decompose(Eh,tut,GL).compose(Eh,tut,WL).multiply(r),u=mE.copy(o.matrixWorld).invert().multiply(l),h=o.bvhGeometry.boundsTree;i instanceof dr?t=h.intersectsBox(i,u):(qL.radius=i,qL.center.setFromMatrixPosition(u),t=h.intersectsSphere(qL)),t?n.currentIntersectedObjects.indexOf(o)===-1&&(n.currentIntersectedObjects.push(o),n.dispatch(),s.dispatchEvent(vEt)):n.currentIntersectedObjects=n.currentIntersectedObjects.filter(d=>d!==o)}}}};Jv(),yt(),s4(),Fi(),_m();var $L=.02,eut=new P,iut=new P,_Et=new P,qa=new P,Fd=new P,Qy=new P,XL=new At,rut=new At,xEt=new At,nl=new Pe,Wf=new Pe,Jy=new ur(0,0,0,"YXZ"),wEt=new P(1,0,0),Eu=new P(0,1,0),SEt=new P(0,0,1),sut=new P(1,1,1),nut=[],aut=t=>nut[t]??(nut[t]=new P),YL=new P,TEt=new P,MEt=new P,AEt=new P,out=new Pe,CEt=new P,lut=new Pe,Wn=new yl,Gl=new dr,EEt={type:"requestRender"},PEt={type:"updateMatrix"},I9=class extends Kn{constructor(t,e,i,r,s,n,a,o,l){super(),this.object=t,this.domElement=e,this.data=i,this.gloabalPhysics=r,this.controlsManager=s,this.cameraFollow=n,this.camera=a,this.page=o,this.sharedAssets=l,this.enableDamping=!0,this.hiddenMatrix0=new At,this.target0=new P,this.zoom0=1,this.rotForce=1,this.moveForce=1,this.pixelsPerMeter=200,this.euler0=new ur(0,0,0,"YXZ"),this.position0Cam=new P,this.quat0Cam=new Pe,this.scale0Cam=new P,this.hiddenMatrix0Cam=new At,this.threshEndTranslate=.01,this.threshEndRotate=1e-8,this.threshEndRotVel=.005,this.collider={type:"capsule",radius:40,segment:new yl(new P(0,-40,0),new P(0,40,0)),matrix:new At,position:new P,rotation:new Pe},this.euler=new ur(0,0,0,"YXZ"),this.eulerDelta=new P,this.lastPosition=new P,this.lastCameraQuaternion=new Pe,this.lastCameraPosition=new P,this.PI_2=Math.PI/2,this.prevMouse=new Z,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 At,this.nonColliderPosOffset=new At,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 At,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 Pe,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 Pe,this.objXZQuatInv=new Pe,this.objXZRotMat=new At,this.isFirstPerson=!1,this.didHit=!1,this.groundVelocity=new P,this.pushedVelocity=new P,this.groundYRotation=0,this.objectRealQuat=new Pe,this.colliderWorldQuat=new Pe,this.groundNormal=new P,this.groundTilt=new Pe,this.groundTiltInv=new Pe,this.lastHitObj=null,this.isFirstFrame=!0,this.rotationAccumWhenOrientWithCamera=0,this.navMeshPathDest=null,this.position=new P,this.quaternion=new Pe,this.scale=new P,this.initialAction=!0,this.onPointerDown=m=>{!(m.target===this.domElement||m.target instanceof HTMLElement&&m.target.tagName==="SPLINE-VIEWER"&&m.target.shadowRoot?.contains(this.domElement))||this.firstPointerId!==-1||(this.firstPointerId=m.pointerId,this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp),this.rotBy!=="keys"&&!Fo&&!s8&&this.domElement.requestPointerLock(),this.prevMouse.set(m.clientX,m.clientY))},this.onPointerUp=m=>{this.firstPointerId=-1,this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp),m.pointerType==="mouse"&&this.domElement.ownerDocument.exitPointerLock()},this.onPointerMove=m=>{if(m.pointerId!==this.firstPointerId)return;let f=m.clientX-this.prevMouse.x,g=m.clientY-this.prevMouse.y;this.prevMouse.set(m.clientX,m.clientY),m.pointerType==="mouse"&&this.rotBy!=="keys"&&(s8&&gpt<15.5&&!Fo?(this.eulerDelta.y=-f*this.mouseOrbitSensitivity,this.eulerDelta.x=-g*this.mouseOrbitSensitivity):(this.eulerDelta.y=-m.movementX*this.mouseOrbitSensitivity,this.eulerDelta.x=-m.movementY*this.mouseOrbitSensitivity)),m.pointerType!=="mouse"&&this.rotByTouch==="drag"&&(this.eulerDelta.y=-f*this.mouseOrbitSensitivity*5,this.eulerDelta.x=-g*this.mouseOrbitSensitivity*5),this.controlsManager.requestRender()},this.onPointerlockChange=m=>{this.domElement.ownerDocument.pointerLockElement===this.domElement?I9.isLocked=!0:I9.isLocked=!1},this.onPointerlockError=()=>{console.error("SPE.GameControls: Unable to use Pointer Lock API")},this.handleVisibilityChange=()=>{if(document?.hidden)for(let m in this.movementState)this.movementState[m]=0},this.onKeyDown=m=>{!(m.target instanceof HTMLInputElement)&&(m.code==="ArrowLeft"||m.code==="ArrowUp"||m.code==="ArrowRight"||m.code==="ArrowDown"||m.code==="Space")&&m.preventDefault();for(let f of this.keyAssignments)if(m.key.toUpperCase()===f[1]||m.key===f[1]){this.movementState[f[0]]=1;break}this.controlsManager.requestRender()},this.onKeyUp=m=>{for(let f of this.keyAssignments)if(m.key.toUpperCase()===f[1]||m.key===f[1]||m.code.slice(3,m.code.length).toUpperCase()===f[1]){this.movementState[f[0]]=0;break}},this.copyVRGamePadValues=(m,f)=>{for(let g=2;g<4;g++){let y=m.axes[g];f===0?g===2?this.movementState.movePosX=y:this.movementState.movePosZ=y:(m.buttons[3].pressed?this.movementState.jump=1:this.movementState.jump=0,g===2?this.movementState.rotPosY=y:this.moveMode==="fly"&&(this.movementState.moveNegY=y))}},this.sharedGameControlGlobals=s.sharedGameControlGlobals,t===a&&(this.isFirstPerson=!0),this.hiddenMatrix0.copy(this.object.hiddenMatrix),this.object.parent?this.object.hiddenMatrix.copy(this.object.parent.matrixWorld).invert():this.object.hiddenMatrix.identity(),this.object.matrix.copy(this.object.matrixWorld),this.object.matrix.decompose(this.position,this.quaternion,this.scale),this.euler0.setFromQuaternion(this.quaternion,"YXZ");let 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 m,f=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(f.y)<1e-6?(g.y=0,f.y=0,m=g.projectOnVector(f)):m=g.y/f.y>0?f.multiplyScalar(g.y/f.y):f.multiplyScalar(g.length()),this.targetToCamera0.copy(m).negate();let y=this.camera.position.clone().add(m);this.objectToTarget0.subVectors(y,this.position);let v=new ur().setFromQuaternion(this.camera.quaternion,"YXZ");this.cameraPolarOffset=-v.x,v.x=0,v.z=0,v.y-=Math.PI/2,this.cameraPolarAxis0.set(0,0,-1).applyEuler(v)}if(this.object instanceof ln&&(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(m=>{let f=[m[0],m[1]];return f[1]==="\u25B2"?f[1]="ArrowUp":f[1]==="\u25C0"?f[1]="ArrowLeft":f[1]==="\u25BC"?f[1]="ArrowDown":f[1]==="\u25B6"?f[1]="ArrowRight":f[1]==="\u21E7"?f[1]="Shift":f[1]==="\u21B5"?f[1]="Enter":f[1]==="Space"?f[1]=" ":f[1]==="\u2318"?f[1]="Meta":f[1]==="Ctrl"?f[1]="Control":f[1]==="Esc"&&(f[1]="Escape"),f}),i.rotBy==="mouse"){let m;m=this.keyAssignments.findIndex(f=>f[0]==="rotNegX"),m!==-1&&(this.keyAssignments[m][1]=""),m=this.keyAssignments.findIndex(f=>f[0]==="rotPosX"),m!==-1&&(this.keyAssignments[m][1]=""),m=this.keyAssignments.findIndex(f=>f[0]==="rotPosY"),m!==-1&&(this.keyAssignments[m][1]=""),m=this.keyAssignments.findIndex(f=>f[0]==="rotNegY"),m!==-1&&(this.keyAssignments[m][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??dv.defaultData.gravity),this.usePhysics=this.gloabalPhysics.usePhysics??dv.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??KR.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*$L/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*$L/this.pixelsPerMeter,this.stepThresh=2*i.collider.radius*.3/this.pixelsPerMeter,this.colliderHeight=2*i.collider.radius):(this.offset=i.collider.height*$L/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(m=>typeof m=="number"?m:0)),c=new Pe().setFromEuler(new ur().fromArray([...i.collider.rotation.map(m=>typeof m=="number"?m:0),"XYZ"]));this.collider.position.copy(d).multiply(this.scale),this.collider.rotation.copy(c),this.collider.matrix.compose(d,c,sut),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 m=new fe;m.push({fi:0,data:{...Gs.defaultData("light","phong"),alpha:0},id:"layer1"}),m.push({fi:0,data:{...Gs.defaultData("color"),color:i.navmesh.destinationHelperColor,alpha:i.navmesh.destinationHelperColor.a},id:"layer2"});let f=Nft({layers:m},{scene:this.page.scene,shared:this.sharedAssets});this.navMeshPathDest=new Ar(Y7.create({parameters:{width:p,height:p/10,hollow:.7}}),f),this.navMeshPathDest.material.userData.opacity0=i.navmesh.destinationHelperColor.a}this.activate()}reset(t=!1){if(this.object.hiddenMatrix.copy(this.hiddenMatrix0),t){this.object.updateMatrix(),this.object.updateMatrixWorld(),this.object.matrix.copy(this.object.matrixWorld),this.object.matrix.decompose(this.position,this.quaternion,this.scale),this.object.parent?this.object.hiddenMatrix.copy(this.object.parent.matrixWorld).invert():this.object.hiddenMatrix.identity();let e=new ur().setFromQuaternion(this.quaternion,"YXZ"),i=e.y;this.objectRealQuat.copy(this.quaternion),e.y=0,this.quaternion.setFromEuler(e),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),e.set(0,i,0),this.quaternion.setFromEuler(e),this.rot.setFromEuler(e),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.velocityTarget.set(0,0,0),this.velocity.set(0,0,0)}else this.object instanceof ln?this.object.matrixAutoUpdate=!0:this.object.updateMatrix();this.cameraFollow===!0&&(this.camera.quaternion.copy(this.quat0Cam),this.camera.position.copy(this.position0Cam),this.camera.scale.copy(this.scale0Cam),this.camera.hiddenMatrix.copy(this.hiddenMatrix0Cam),this.camera.matrixAutoUpdate=!0),this.controlsManager.requestRender()}activate(){this.instantiateActions(),this.domElement.ownerDocument.addEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.addEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.addEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.addEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.addEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.addEventListener("visibilitychange",this.handleVisibilityChange)}deactivate(){this.disposeActions(),this.domElement.ownerDocument.removeEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.removeEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.removeEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.removeEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.removeEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.removeEventListener("visibilitychange",this.handleVisibilityChange)}dispose(){this.deactivate(),this.navMeshPathDest?.parent&&this.page.remove(this.navMeshPathDest)}instantiateActions(){let t=this.data,e=this.sharedAssets;t.gameActions!==void 0&&(this.actions={},YR.list.forEach(i=>{this.actions[i]=hn({...t,disabled:!1,type:"GameControl"},t.gameActions[i],this.page,e,this.controlsManager.eventManager,this.object)})),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"),this.initialAction&&(this.initialAction=!1)}disposeActions(){this.initialAction=!1,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),sa(this.actions.idle),sa(this.actions.move),sa(this.actions.run),sa(this.actions.jump)}dispatchStartEvent(t){this.actions[t]!==void 0&&(this.actionState[t]||(this.actionState[t]=!0,this.actions[t].Transition.forEach(e=>{e.play()}),this.actions[t].Animation.forEach(e=>{e.play(this.initialAction===!1)}),this.actions[t].TimelineAnimation.forEach(e=>{e.play()}),this.actions[t].Create.forEach(e=>{e.dispatchStart()}),this.actions[t].Audio.forEach(e=>{e.dispatchGameControl("start")}),this.actions[t].Particles.forEach(e=>{e.dispatchGameControl("start")})))}dispatchStopEvent(t){this.actions[t]!==void 0&&(!this.actionState[t]||(this.actionState[t]=!1,this.actions[t].Transition.forEach(e=>{e.stop(),e.object.currentState!==null&&e.object.changeSelectedState(null,{scene:this.page.scene,shared:this.sharedAssets})}),this.actions[t].TimelineAnimation.forEach(e=>{e.stop()}),this.actions[t].Create.forEach(e=>{e.dispatchStop()}),this.actions[t].Audio.forEach(e=>{e.dispatchGameControl("stop")}),this.actions[t].Particles.forEach(e=>{e.dispatchGameControl("stop")})))}get colliderWorldPosition(){return qa.copy(this.collider.position).applyQuaternion(this.objectRealQuat).add(this.position)}update(t){if(this.gravity<0?this.position.y<this.resetYPosition:this.position.y>this.resetYPosition)return this.reset(!0),!0;this.sharedGameControlGlobals.gamePads.forEach(this.copyVRGamePadValues);let e=(this.isFirstFrame?16.6:t)/1e3;this.isFirstFrame&&(this.isFirstFrame=!1);let i=60*e,r=!1;if(this.groundYRotation=0,this.groundVelocity.set(0,0,0),this.usePhysics&&this.collisionEnabled&&this.object.rigidBody?.collider(0).shape){let n=Fd.set(0,(this.velocity.y===0?this.pixelsPerMeter*Math.max(Math.abs(this.gravity)/120,1)*(this.gravity>0?1:-1):this.velocity.y)*e,0).divideScalar(this.pixelsPerMeter),a=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter),this.colliderWorldQuat,n,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(qa).add(this.collider.position).divideScalar(this.pixelsPerMeter),d=l.velocityAtPoint(h);this.groundVelocity.set(d.x,d.y,d.z).multiplyScalar(this.pixelsPerMeter),this.groundYRotation=l.angvel().y*e}}else this.onObject=!1}if(this.moveMode==="walk"&&this.collisionEnabled&&(this.movementState.jump===1&&this.onObject&&(this.velocityTarget.y=this.jumpPower,this.movementState.jump=0,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("jump"),this.onObject=!1),this.onObject?this.velocityTarget.y/=2:this.velocityTarget.y+=this.gravity*i),this.moveMode==="fly"&&(this.velocityTarget.y=(this.movementState.movePosY-this.movementState.moveNegY)*this.speedTranslate),this.directionXZ.z=this.movementState.movePosZ-this.movementState.moveNegZ,this.directionXZ.x=this.movementState.movePosX-this.movementState.moveNegX,this.forwardDir==="+z"&&this.directionXZ.multiplyScalar(-1),this.directionXZ.manhattanLength()>0&&(this.path=[]),this.navMeshPathDest){let n=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=qa.subVectors(this.path[1],this.position),o=Fd.subVectors(this.path[1],this.path[0]);a.dot(o)<0?this.path.shift():(this.directionXZ.x=o.x,this.directionXZ.z=o.z),n.opacity=n.userData.opacity0}else n.opacity-=.05*n.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 s=_Et.copy(this.velocity);if(this.orientMode!=="none"&&this.isFirstPerson===!1){let n=Fd.copy(s);n.y=0,s.set(0,s.y,n.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 n=qa;this.camera.getWorldDirection(n);let a=Qy.copy(Eu).multiplyScalar(n.dot(Eu));n.sub(a);let o=Fd.copy(this.directionXZ);o.x*=-1,this.rot.y=n.angleTo(o)*(n.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(Jy.setFromVector3(this.rot),this.moveMode==="walk"&&(Jy.x=0),s.applyEuler(Jy),r&&(Wf.setFromUnitVectors(Eu,this.groundNormal),s.applyQuaternion(Wf)),this.usePhysics===!0&&this.object.rigidBody){this.pushedVelocity.set(0,0,0);let n=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(YL,out,TEt);let o=this.object.getWorldPosition(MEt).add(this.collider.position).sub(YL);lut.copy(a.prevQ).invert().premultiply(out);let l=Qy.subVectors(YL,a.prevT).add(AEt.copy(o).applyQuaternion(lut).sub(o)).divideScalar(e).divideScalar(this.pixelsPerMeter),u=a.rigidBody.collider(0).castCollider(l,this.object.rigidBody.collider(0),qa.copy(s).divideScalar(this.pixelsPerMeter),0,e,!1);l.multiplyScalar(this.pixelsPerMeter);let h=Ai.is(a)?a:a.object;if(u!==null&&this.lastHitObj!==h){let d;a instanceof bl&&(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(O9));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),aut(n++).copy(u.normal1).applyQuaternion(a.quaternion))}if(n>0){for(let a=0;a<n;a++){let o=aut(a),l=o.dot(s);l<0&&s.addScaledVector(o,-l)}s.add(this.pushedVelocity)}else s.add(this.groundVelocity)}if(this.rotDirection.y=Number(this.movementState.rotPosY)-Number(this.movementState.rotNegY),this.rotDirection.x=Number(this.movementState.rotPosX)-Number(this.movementState.rotNegX),this.rotDirection.normalize(),this.rotationMode==="normal"&&(this.movementState.rotPosX||this.movementState.rotNegX)||this.rotationMode==="steer"&&(this.movementState.rotPosX||this.movementState.rotNegX)&&(this.movementState.movePosZ||this.movementState.moveNegZ||this.moveMode==="walk")?this.rotVelocityStick.x=-this.rotDirection.x*this.speedOrbit*this.rotForce:this.rotVelocityStick.x=0,this.rotationMode==="normal"&&(this.movementState.rotPosY||this.movementState.rotNegY)||this.rotationMode==="steer"&&(this.movementState.rotPosY||this.movementState.rotNegY)&&(this.movementState.movePosZ||this.movementState.moveNegZ)?this.rotVelocityStick.y=-this.rotDirection.y*this.speedOrbit*this.rotForce:this.rotVelocityStick.y=0,this.rotVelocityTarget.subVectors(this.eulerDelta.divideScalar(e),this.rotVelocityStick),this.rotVelocityTarget.manhattanLength()===0?this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotEnd)**i):this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotStart)**i),this.euler.x+=this.rotVelocity.x*e,this.euler.y+=this.rotVelocity.y*e+this.groundYRotation,this.rotVelocityTarget.y===0&&this.directionXZ.manhattanLength()===0?this.rotationAccumWhenOrientWithCamera=0:(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.rotationAccumWhenOrientWithCamera+=this.rotVelocity.y*e),this.isFirstPerson===!1&&this.orientMode!=="none"&&this.directionXZ.manhattanLength()>0){if(this.orientMode==="radial"){this.objectToCamXZ.copy(this.objectToCamXZ0).applyAxisAngle(Eu,this.euler.y-this.euler0.y);let n=Fd.copy(this.objectToCamXZ).normalize(),a=Qy.copy(s).multiplyScalar(e);a.y=0;let o=a.sub(qa.copy(n).multiplyScalar(a.dot(n))).cross(n).y;this.euler.y-=Math.atan2(o,this.objectToCamXZ.length())}}else this.rot.y+=this.rotVelocity.y*e+this.groundYRotation,this.rotVelocityTarget.y!==0&&(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.euler.y=this.rot.y);if(this.cameraFollow===!0&&(this.moveMode==="walk"?this.cameraXAxis==="Limit"?this.euler.x=Yt.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):this.euler.x=Yt.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset,this.PI_2+this.cameraPolarOffset):this.cameraXAxis==="Limit"&&(this.euler.x=Yt.clamp(this.euler.x,-this.PI_2,this.PI_2))),this.moveMode==="fly"?this.rot.x=this.euler.x:this.isFirstPerson&&(Jy.copy(this.euler),Jy.y=0,this.nonColliderRotOffset.makeRotationFromEuler(Jy)),nl.setFromAxisAngle(wEt,this.rot.x),Wf.setFromAxisAngle(Eu,this.rot.y),Wf.multiply(nl),nl.setFromAxisAngle(SEt,this.rot.z),Wf.multiply(nl),this.quaternion.copy(Wf),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 n=Fd.copy(s).multiplyScalar(e/this.pixelsPerMeter),a=null;this.didHit=!1;let o=new P;for(let h=0;h<5;h++){let d=n.length(),c=Qy.copy(n).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(n);break}{this.didHit=!0;let p=this.sharedGameControlGlobals.colliderToEntity.get(a.collider.handle);if(p!==this.lastHitObj&&h===0){this.lastHitObj=p;let y=this.sharedGameControlGlobals.entityToCollisionEvents[p?.uuid];if(y){for(let v of y)if(v.data.target==="character"){let b,_=(this.sharedGameControlGlobals.rapierWorld?.getCollider(a.collider.handle))._parent;if(p.cloner){for(let x of p.cloner.children)if(x.rigidBody===_){b=x;break}}v.dispatch(b),p.dispatchEvent(O9)}}}let m=eut.set(a.normal2.x,a.normal2.y,a.normal2.z).applyQuaternion(this.colliderWorldQuat),f=iut.copy(c).multiplyScalar(a.time_of_impact).dot(m),g=a.time_of_impact;if(g===0&&(this.position.y+=this.offset*this.pixelsPerMeter),f>this.offset&&(g=a.time_of_impact*(f-this.offset)/f,o.addScaledVector(c,g)),n.copy(c).multiplyScalar(d-g),Math.acos(-m.y)>this.slopeThresh){let y=this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(o),v=Qy.copy(a.witness2).applyQuaternion(this.colliderWorldQuat);v.y=0;let b=y.add(v);b.y+=this.stepThresh;let _=this.sharedGameControlGlobals.rapierWorld.castShape(b,this.colliderWorldQuat,n,this.object.rigidBody?.collider(0).shape,0,1,!1,12,void 0,void 0,this.object.rigidBody);_!==null&&_.time_of_impact===0&&(m.y=0,m.normalize())}n.addScaledVector(m,-n.dot(m))}}this.position.addScaledVector(o,this.pixelsPerMeter),qa.copy(this.position).divideScalar(this.pixelsPerMeter),nl.copy(this.quaternion).premultiply(this.groundTilt).multiply(this.objXZQuat);let l=this.object.rigidBody,u=l!==void 0&&CEt.copy(qa).sub(l.translation()).lengthSq()>1;l!==void 0&&(u?(l.setTranslation(qa,!0),l.setRotation(nl,!0)):(l.setNextKinematicTranslation(qa),l.setNextKinematicRotation(nl)))}else{let n=this.onObject?1:5,a=s.multiplyScalar(e/n);for(let o=0;o<n;o++)this.position.add(a),this.collisionAdjustment(e/n)}else this.position.addScaledVector(s,e);if(this.moveMode==="walk"&&this.onObject&&(this.velocityTarget.y=0,this.velocity.y=0),this.quaternion.premultiply(this.groundTilt).multiply(this.objXZQuat),this.object.matrix.compose(this.position,this.quaternion,this.scale),this.object.matrixWorldNeedsUpdate=!0,this.object.matrix.multiply(this.nonColliderPosOffset).multiply(this.nonColliderRotOffset),this.quaternion.premultiply(this.groundTiltInv).multiply(this.objXZQuatInv),this.cameraFollow===!0){this.updateFollowArms();let n=this.objectToTarget.add(this.position),a=this.targetToCamera.add(n);XL.lookAt(a,n,Eu).setPosition(a),XL.decompose(this.targetPos,this.targetQuat,qa),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=Yt.clamp(this.euler.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel)),this.euler.x=Yt.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(PEt),!(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(EEt),0))}updateFollowArms(){this.objectToTarget.copy(this.objectToTarget0),this.targetToCamera.copy(this.targetToCamera0);let t,e=nl.setFromAxisAngle(Eu,this.cameraYAxis==="Limit"&&this.orientMode!=="radial"?Yt.clamp(this.euler.y-this.euler0.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel):this.euler.y-this.euler0.y);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&this.objectToTarget.applyQuaternion(e),t=this.cameraXAxis==="Limit"?Yt.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):Yt.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset+1e-6,this.PI_2+this.cameraPolarOffset-1e-6);let i=qa.copy(this.cameraPolarAxis0);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&i.applyQuaternion(e);let r=Wf.setFromAxisAngle(i,t);this.cameraYAxis!=="Locked"&&this.targetToCamera.applyQuaternion(e),this.cameraXAxis!=="Locked"&&this.targetToCamera.applyQuaternion(r)}groundTiltAdjustment(t){180*Eu.angleTo(t)/Math.PI<15||180*Eu.angleTo(t)/Math.PI>85?nl.identity():nl.setFromUnitVectors(Eu,t),this.groundTilt.slerp(nl,.06),this.groundTiltInv.copy(this.groundTilt).invert()}collisionAdjustment(t){let e=iut.set(0,0,0);this.object.matrix.compose(this.position,this.quaternion,this.scale);let i=XL.multiplyMatrices(this.object.matrix,this.objXZRotMat).multiply(this.collider.matrix).decompose(qa,nl,Fd).compose(qa,nl,sut);this.sharedGameControlGlobals.entitiesWithTransformAnim.forEach(s=>{if(s===this.object||s.isDescendantOf(this.object)||!s.bvhGeometry||!s.bvhGeometry.boundsTree)return;Gl.makeEmpty(),s.updateMatrixWorldRigid();let n=s.matrixWorldRigid,a=rut.copy(n).invert(),o=xEt.copy(rut).multiply(i);Wn.copy(this.collider.segment),Wn.start.applyMatrix4(o),Wn.end.applyMatrix4(o);let l=eut.copy(this.position).applyMatrix4(a);Gl.expandByPoint(Wn.start),Gl.expandByPoint(Wn.end),Gl.min.addScalar(-this.collider.radius),Gl.max.addScalar(this.collider.radius),s.bvhGeometry.boundsTree.shapecast({boundsTraverseOrder:u=>u.distanceToPoint(Wn.end),intersectsBounds:u=>u.intersectsBox(Gl),intersectsTriangle:u=>{let h=qa,d=Fd,c=u.closestPointToSegment(Wn,h,d);if(c<this.collider.radius){let p=this.collider.radius-c,m=d.sub(h).normalize(),f=Qy.copy(l);f.addScaledVector(m,p);let g=f.applyMatrix4(n).sub(this.position);e.add(g),Wn.start.addScaledVector(m,p),Wn.end.addScaledVector(m,p)}}})}),Gl.makeEmpty(),Wn.copy(this.collider.segment),Wn.start.applyMatrix4(i),Wn.end.applyMatrix4(i),Gl.expandByPoint(Wn.start),Gl.expandByPoint(Wn.end),Gl.min.addScalar(-this.collider.radius),Gl.max.addScalar(this.collider.radius),this.sharedGameControlGlobals.staticMeshBVH?.shapecast({boundsTraverseOrder:s=>s.distanceToPoint(Wn.end),intersectsBounds:s=>s.intersectsBox(Gl),intersectsTriangle:s=>{let n=qa,a=Fd,o=s.closestPointToSegment(Wn,n,a);if(o<this.collider.radius){let l=this.collider.radius-o,u=a.sub(n).normalize();this.alignToGround&&this.groundTiltAdjustment(u),e.addScaledVector(u,l),Wn.start.addScaledVector(u,l),Wn.end.addScaledVector(u,l)}}}),this.onObject=Math.abs(e.y)>Math.abs(t*this.velocity.y*.25),this.onObject&&this.dispatchStopEvent("jump");let r=Math.max(0,e.length()-1e-5);e.normalize().multiplyScalar(r),this.position.add(e)}pause(){this.firstPointerId=-1,this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0},this.deactivate()}resume(){this.activate()}},obt=I9;obt.isLocked=!1,yt(),BS(),C5(),Jv(),Zv();var lbt,hbt,KL,REt=new Promise(t=>{lbt=t});function NEt(t){return KL||(KL=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.30/build";typeof window<"u"&&(hbt=new URL(e.endsWith("/")?e:`${e}/`,window.location.href).href);let i=import("./navmesh.js"),[r,s]=await Promise.all([i,fetch(`${e}/navmesh.wasm`).then(o=>o.arrayBuffer())]),n=r.default,a=await n({wasmBinary:s});lbt(a)}(),KL)}cr();var ubt,Di,_a,DEt=t=>`
5083
+ `)>=0&&(t-=s),i===3?.5*e-.5*t:i===2?e-t:0}getLineInitialOffsetY(t,e,i,r,s){let n=e*t,a=t-Math.abs(this.ascender-this.descender)*r,o=-this.ascender*r-a/2;return s===3?-(i-n-o):s===2?-(.5*i-.5*n-o):o}createPath(t,e,i,r,s){let n=t.getPath(i,-r,s.fontSize,{kerning:!1,letterSpacing:s.letterSpacing});if(!n)return void console.error('THREE.Font: character "'+t+'" does not exists in font family '+this.familyName+".");let a=new nEt,o=(t.advanceWidth??1)*e;if(t)for(let l of n.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 cl)return d.v1;if(d instanceof Yl||d instanceof oc)return d.v0}}(l.curves);u!==void 0&&l.currentPoint.distanceTo(u)>0&&l.lineTo(u.x,u.y)}),{offsetX:o,path:a}}getCharWidth(t,e){try{return this.font?.getAdvanceWidth(t,e.fontSize,{kerning:!0,letterSpacing:e.letterSpacing})??0}catch(i){return this.warnLayoutError(i),0}}getTextWidth(t,e){try{return this.font?.getAdvanceWidth(t,e.fontSize,{kerning:!0,letterSpacing:e.letterSpacing})??0}catch(i){return this.warnLayoutError(i),0}}computeSpaceWidthForLine(t,e,i,r){let s=this.getCharWidth(" ",i),n=t[e];if(n){let a=this.countSpaces(n.trimEnd());if(i.horizontalAlign===4&&e<t.length-1&&a)return((typeof i.width=="string"?Number(r.getVariable(i.width)):i.width)-(this.getTextWidth(n,i)-a*s))/a}return s}countSpaces(t){return(t.match(/ /g)||[]).length}},Or("text"),Le();var Qvt=null;function $ht(){return Qvt}function lEt(t){let e=!1;return t.scene.objects.forEach(i=>{i.data.type==="Page"&&!e&&i.data.publish.gameControlObject&&Kg.traverseModuleInstances(t,i.id,(r,s,n)=>{for(let a of n)a.data.type==="GameControl"&&a.data.navmesh.enabled&&(e=!0)})}),e}cr();var cE=(t,e)=>{let i=e.x-t.x,r=e.y-t.y;return Math.sqrt(i*i+r*r)},kL=t=>t*(Math.PI/180),pE=new Map,W4=(t,e,i)=>{let r,s=e.split(/[ ,]+/g);for(let n=0;n<s.length;n+=1)r=s[n],t.addEventListener?t.addEventListener(r,i,!1):t.attachEvent&&t.attachEvent(r,i)},q4=(t,e,i)=>{let r,s=e.split(/[ ,]+/g);for(let n=0;n<s.length;n+=1)r=s[n],t.removeEventListener?t.removeEventListener(r,i):t.detachEvent&&t.detachEvent(r,i)},Jvt=t=>(t.preventDefault(),t.type.match(/^touch/)?t.changedTouches:t),Xht=()=>{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}},zL=(t,e)=>{e.top||e.right||e.bottom||e.left?(t.style.top=e.top,t.style.right=e.right,t.style.bottom=e.bottom,t.style.left=e.left):(t.style.left=e.x+"px",t.style.top=e.y+"px")},LL=(t,e,i)=>{let r=tbt(t);for(let s in r)if(Object.prototype.hasOwnProperty.call(r,s))if(typeof e=="string")r[s]=e+" "+i;else{let n="";for(let a=0,o=e.length;a<o;a+=1)n+=e[a]+" "+i+", ";r[s]=n.slice(0,-2)}return r},tbt=t=>{let e={};return e[t]="",["webkit","Moz","o"].forEach(function(i){e[i+t.charAt(0).toUpperCase()+t.slice(1)]=""}),e},FL=(t,e)=>{for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},D9=(t,e)=>{if(t.length)for(let i=0,r=t.length;i<r;i+=1)e(t[i]);else e(t)};typeof window<"u"&&(ebt="ontouchstart"in window,ibt=!!window.PointerEvent,rbt=!!window.MSPointerEvent);var ebt,ibt,rbt,Yy,Yht={start:"mousedown",move:"mousemove",end:"mouseup"},aw={};function og(){}ibt?Yy={start:"pointerdown",move:"pointermove",end:"pointerup, pointercancel"}:rbt?Yy={start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:ebt?(Yy={start:"touchstart",move:"touchmove",end:"touchend, touchcancel"},aw=Yht):Yy=Yht,og.prototype.on=function(t,e){var i,r=this,s=t.split(/[ ,]+/g);r._handlers_=r._handlers_||{};for(var n=0;n<s.length;n+=1)i=s[n],r._handlers_[i]=r._handlers_[i]||[],r._handlers_[i].push(e);return r},og.prototype.off=function(t,e){var i=this;return i._handlers_=i._handlers_||{},t===void 0?i._handlers_={}:e===void 0?i._handlers_[t]=null:i._handlers_[t]&&i._handlers_[t].indexOf(e)>=0&&i._handlers_[t].splice(i._handlers_[t].indexOf(e),1),i},og.prototype.trigger=function(t,e){var i,r=this,s=t.split(/[ ,]+/g);r._handlers_=r._handlers_||{};for(var n=0;n<s.length;n+=1)i=s[n],r._handlers_[i]&&r._handlers_[i].length&&r._handlers_[i].forEach(function(a){a.call(r,{type:i,target:r},e)})},og.prototype.config=function(t){var e=this;e.options=e.defaults||{},t&&(e.options=((i,r)=>{let s={};for(let n in i)Object.prototype.hasOwnProperty.call(i,n)&&Object.prototype.hasOwnProperty.call(r,n)?s[n]=r[n]:Object.prototype.hasOwnProperty.call(i,n)&&(s[n]=i[n]);return s})(e.options,t))},og.prototype.bindEvt=function(t,e){var i=this;return i._domHandlers_=i._domHandlers_||{},i._domHandlers_[e]=function(){typeof i["on"+e]=="function"?i["on"+e].apply(i,arguments):console.warn('[WARNING] : Missing "on'+e+'" handler.')},W4(t,Yy[e],i._domHandlers_[e]),aw[e]&&W4(t,aw[e],i._domHandlers_[e]),i},og.prototype.unbindEvt=function(t,e){var i=this;return i._domHandlers_=i._domHandlers_||{},q4(t,Yy[e],i._domHandlers_[e]),aw[e]&&q4(t,aw[e],i._domHandlers_[e]),delete i._domHandlers_[e],this};var dW=og;function xn(t,e){return this.identifier=e.identifier,this.position=e.position,this.frontPosition=e.frontPosition,this.collection=t,this.defaults={size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,mode:"dynamic",zone:document.body,lockX:!1,lockY:!1,shape:"circle"},this.config(e),this.options.mode==="dynamic"&&(this.options.restOpacity=0),this.id=xn.id,xn.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}xn.prototype=new dW,xn.constructor=xn,xn.id=0,xn.prototype.buildEl=function(t){return this.ui={},this.options.dataOnly||(this.ui.el=document.createElement("div"),this.ui.back=document.createElement("div"),this.ui.front=document.createElement("div"),this.ui.el.className="nipple collection_"+this.collection.id,this.ui.back.className="back",this.ui.front.className="front",this.ui.el.setAttribute("id","nipple_"+this.collection.id+"_"+this.id),this.ui.el.appendChild(this.ui.back),this.ui.el.appendChild(this.ui.front)),this},xn.prototype.stylize=function(){if(this.options.dataOnly)return this;var t=this.options.fadeTime+"ms",e=(()=>{let s=tbt("borderRadius");for(let n in s)Object.prototype.hasOwnProperty.call(s,n)&&(s[n]="50%");return s})(),i=LL("transition","opacity",t),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)"},FL(r.el,i),this.options.shape==="circle"&&FL(r.back,e),FL(r.front,e),this.applyStyles(r),this},xn.prototype.applyStyles=function(t){for(var e in this.ui)if(Object.prototype.hasOwnProperty.call(this.ui,e))for(var i in t[e])this.ui[e].style[i]=t[e][i];return this},xn.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)||this.options.zone.appendChild(this.ui.el),this},xn.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)||this.options.zone.removeChild(this.ui.el),this},xn.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},xn.prototype.show=function(t){var e=this;return e.options.dataOnly||(clearTimeout(e.removeTimeout),clearTimeout(e.showTimeout),clearTimeout(e.restTimeout),e.addToDom(),e.restCallback(),setTimeout(function(){e.ui.el.style.opacity=1},0),e.showTimeout=setTimeout(function(){e.trigger("shown",e.instance),typeof t=="function"&&t.call(this)},e.options.fadeTime)),e},xn.prototype.hide=function(t){var e=this;if(e.options.dataOnly)return e;if(e.ui.el.style.opacity=e.options.restOpacity,clearTimeout(e.removeTimeout),clearTimeout(e.showTimeout),clearTimeout(e.restTimeout),e.removeTimeout=setTimeout(function(){var i=e.options.mode==="dynamic"?"none":"block";e.ui.el.style.display=i,typeof t=="function"&&t.call(e),e.trigger("hidden",e.instance)},e.options.fadeTime),e.options.restJoystick){let i=e.options.restJoystick,r={};r.x=i===!0||i.x!==!1?0:e.instance.frontPosition.x,r.y=i===!0||i.y!==!1?0:e.instance.frontPosition.y,e.setPosition(t,r)}return e},xn.prototype.setPosition=function(t,e){var i=this;i.frontPosition={x:e.x,y:e.y};var r=i.options.fadeTime+"ms",s={};s.front=LL("transition",["top","left"],r);var n={front:{}};n.front={left:i.frontPosition.x+"px",top:i.frontPosition.y+"px"},i.applyStyles(s),i.applyStyles(n),i.restTimeout=setTimeout(function(){typeof t=="function"&&t.call(i),i.restCallback()},i.options.fadeTime)},xn.prototype.restCallback=function(){var t=this,e={};e.front=LL("transition","none",""),t.applyStyles(e),t.trigger("rested",t.instance)},xn.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}},xn.prototype.computeDirection=function(t){var e,i,r,s=t.angle.radian,n=Math.PI/4,a=Math.PI/2;if(s>n&&s<3*n&&!t.lockX?e="up":s>-n&&s<=n&&!t.lockY?e="left":s>3*-n&&s<=-n&&!t.lockX?e="down":t.lockY||(e="right"),t.lockY||(i=s>-a&&s<a?"left":"right"),t.lockX||(r=s>0?"up":"down"),t.force>this.options.threshold){var o,l={};for(o in this.direction)Object.prototype.hasOwnProperty.call(this.direction,o)&&(l[o]=this.direction[o]);var u={};for(o in this.direction={x:i,y:r,angle:e},t.direction=this.direction,l)l[o]===this.direction[o]&&(u[o]=!0);if(u.x&&u.y&&u.angle)return t;(!u.x||!u.y)&&this.trigger("plain",t),u.x||this.trigger("plain:"+i,t),u.y||this.trigger("plain:"+r,t),u.angle||this.trigger("dir dir:"+e,t)}else this.resetDirection();return t};var hEt=xn;function Us(t,e){var i=this;i.nipples=[],i.idles=[],i.actives=[],i.ids=[],i.pressureIntervals={},i.manager=t,i.id=Us.id,Us.id+=1,i.defaults={zone:document.body,multitouch:!1,maxNumberOfNipples:10,mode:"dynamic",position:{top:0,left:0},catchDistance:200,size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,lockX:!1,lockY:!1,shape:"circle",dynamicPage:!1,follow:!1},i.config(e),(i.options.mode==="static"||i.options.mode==="semi")&&(i.options.multitouch=!1),i.options.multitouch||(i.options.maxNumberOfNipples=1);let r=getComputedStyle(i.options.zone.parentElement);return r&&r.display==="flex"&&(i.parentIsFlex=!0),i.updateBox(),i.prepareNipples(),i.bindings(),i.begin(),i.nipples}Us.prototype=new dW,Us.constructor=Us,Us.id=0,Us.prototype.prepareNipples=function(){var t=this,e=t.nipples;e.on=t.on.bind(t),e.off=t.off.bind(t),e.options=t.options,e.destroy=t.destroy.bind(t),e.ids=t.ids,e.id=t.id,e.processOnMove=t.processOnMove.bind(t),e.processOnEnd=t.processOnEnd.bind(t),e.get=function(i){if(i===void 0)return e[0];for(var r=0,s=e.length;r<s;r+=1)if(e[r].identifier===i)return e[r];return!1}},Us.prototype.bindings=function(){var t=this;t.bindEvt(t.options.zone,"start"),t.options.zone.style.touchAction="none",t.options.zone.style.msTouchAction="none"},Us.prototype.begin=function(){var t=this,e=t.options;if(e.mode==="static"){var i=t.createNipple(e.position,t.manager.getIdentifier());i.add(),t.idles.push(i)}},Us.prototype.createNipple=function(t,e){var i=this,r=i.manager.scroll,s={},n=i.options,a=i.parentIsFlex?r.x:r.x+i.box.left,o=i.parentIsFlex?r.y:r.y+i.box.top;if(t.x&&t.y)s={x:t.x-a,y:t.y-o};else if(t.top||t.right||t.bottom||t.left){var l=document.createElement("DIV");l.style.display="hidden",l.style.top=t.top,l.style.right=t.right,l.style.bottom=t.bottom,l.style.left=t.left,l.style.position="absolute",n.zone.appendChild(l);var u=l.getBoundingClientRect();n.zone.removeChild(l),s=t,t={x:u.left+r.x,y:u.top+r.y}}var h=new hEt(i,{color:n.color,size:n.size,threshold:n.threshold,fadeTime:n.fadeTime,dataOnly:n.dataOnly,restJoystick:n.restJoystick,restOpacity:n.restOpacity,mode:n.mode,identifier:e,position:t,zone:n.zone,frontPosition:{x:0,y:0},shape:n.shape});return n.dataOnly||(zL(h.ui.el,s),zL(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},Us.prototype.updateBox=function(){this.box=this.options.zone.getBoundingClientRect()},Us.prototype.bindNipple=function(t){var e,i=this,r=function(s,n){e=s.type+" "+n.id+":"+s.type,i.trigger(e,n)};t.on("destroyed",i.onDestroyed.bind(i)),t.on("shown hidden rested dir plain",r),t.on("dir:up dir:right dir:down dir:left",r),t.on("plain:up plain:right plain:down plain:left",r)},Us.prototype.pressureFn=function(t,e,i){var r=this,s=0;clearInterval(r.pressureIntervals[i]),r.pressureIntervals[i]=setInterval(function(){var n=t.force||t.pressure||t.webkitForce||0;n!==s&&(e.trigger("pressure",n),r.trigger("pressure "+e.identifier+":pressure",n),s=n)}.bind(r),100)},Us.prototype.onstart=function(t){var e=this,i=e.options,r=t;return t=Jvt(t),e.updateBox(),D9(t,function(s){e.actives.length<i.maxNumberOfNipples?e.processOnStart(s):r.type.match(/^touch/)&&(Object.keys(e.manager.ids).forEach(function(n){if(Object.values(r.touches).findIndex(function(o){return o.identifier===n})<0){var a=[t[0]];a.identifier=n,e.processOnEnd(a)}}),e.actives.length<i.maxNumberOfNipples&&e.processOnStart(s))}),e.manager.bindDocument(),!1},Us.prototype.processOnStart=function(t){var e,i=this,r=i.options,s=i.manager.getIdentifier(t),n=t.force||t.pressure||t.webkitForce||0,a={x:t.pageX,y:t.pageY},o=i.getOrCreate(s,a);o.identifier!==s&&i.manager.removeIdentifier(o.identifier),o.identifier=s;var l=function(u){u.trigger("start",u),i.trigger("start "+u.id+":start",u),u.show(),n>0&&i.pressureFn(t,u,u.identifier),i.processOnMove(t)};if((e=i.idles.indexOf(o))>=0&&i.idles.splice(e,1),i.actives.push(o),i.ids.push(o.identifier),r.mode!=="semi")l(o);else{if(!(cE(a,o.position)<=r.catchDistance))return o.destroy(),void i.processOnStart(t);l(o)}return o},Us.prototype.getOrCreate=function(t,e){var i,r=this,s=r.options;return/(semi|static)/.test(s.mode)?(i=r.idles[0])?(r.idles.splice(0,1),i):s.mode==="semi"?r.createNipple(e,t):(console.warn("Coudln't find the needed nipple."),!1):i=r.createNipple(e,t)},Us.prototype.processOnMove=function(t){var e=this,i=e.options,r=e.manager.getIdentifier(t),s=e.nipples.get(r),n=e.manager.scroll;if((b=>isNaN(b.buttons)?b.pressure!==0:b.buttons!==0)(t)){if(!s)return console.error("Found zombie joystick with ID "+r),void e.manager.removeIdentifier(r);if(i.dynamicPage){var a=s.el.getBoundingClientRect();s.position={x:n.x+a.left,y:n.y+a.top}}s.identifier=r;var o=s.options.size/2,l={x:t.pageX,y:t.pageY};i.lockX&&(l.y=s.position.y),i.lockY&&(l.x=s.position.x);var u,h,d=cE(l,s.position),c=((b,_)=>{let x=_.x-b.x,S=_.y-b.y;return(w=>w*(180/Math.PI))(Math.atan2(S,x))})(l,s.position),p=kL(c),m=d/o,f={distance:d,position:l};if(s.options.shape==="circle"?(u=Math.min(d,o),h=((b,_,x)=>{let S={x:0,y:0};return x=kL(x),S.x=b.x-_*Math.cos(x),S.y=b.y-_*Math.sin(x),S})(s.position,u,c)):(h=((b,_,x)=>({x:Math.min(Math.max(b.x,_.x-x),_.x+x),y:Math.min(Math.max(b.y,_.y-x),_.y+x)}))(l,s.position,o),u=cE(h,s.position)),i.follow){if(d>o){let b=l.x-h.x,_=l.y-h.y;s.position.x+=b,s.position.y+=_,s.el.style.top=s.position.y-(e.box.top+n.y)+"px",s.el.style.left=s.position.x-(e.box.left+n.x)+"px",d=cE(l,s.position)}}else l=h,d=u;var g=l.x-s.position.x,y=l.y-s.position.y;s.frontPosition={x:g,y},i.dataOnly||zL(s.ui.front,s.frontPosition);var v={identifier:s.identifier,position:l,force:m,pressure:t.force||t.pressure||t.webkitForce||0,distance:d,angle:{radian:p,degree:c},vector:{x:g/o,y:-y/o},raw:f,instance:s,lockX:i.lockX,lockY:i.lockY};(v=s.computeDirection(v)).angle={radian:kL(180-c),degree:180-c},s.trigger("move",v),e.trigger("move "+s.id+":move",v)}else this.processOnEnd(t)},Us.prototype.processOnEnd=function(t){var e=this,i=e.options,r=e.manager.getIdentifier(t),s=e.nipples.get(r),n=e.manager.removeIdentifier(s.identifier);!s||(i.dataOnly||s.hide(function(){i.mode==="dynamic"&&(s.trigger("removed",s),e.trigger("removed "+s.id+":removed",s),e.manager.trigger("removed "+s.id+":removed",s),s.destroy())}),clearInterval(e.pressureIntervals[s.identifier]),s.resetDirection(),s.trigger("end",s),e.trigger("end "+s.id+":end",s),e.ids.indexOf(s.identifier)>=0&&e.ids.splice(e.ids.indexOf(s.identifier),1),e.actives.indexOf(s)>=0&&e.actives.splice(e.actives.indexOf(s),1),/(semi|static)/.test(i.mode)?e.idles.push(s):e.nipples.indexOf(s)>=0&&e.nipples.splice(e.nipples.indexOf(s),1),e.manager.unbindDocument(),/(semi|static)/.test(i.mode)&&(e.manager.ids[n.id]=n.identifier))},Us.prototype.onDestroyed=function(t,e){var i=this;i.nipples.indexOf(e)>=0&&i.nipples.splice(i.nipples.indexOf(e),1),i.actives.indexOf(e)>=0&&i.actives.splice(i.actives.indexOf(e),1),i.idles.indexOf(e)>=0&&i.idles.splice(i.idles.indexOf(e),1),i.ids.indexOf(e.identifier)>=0&&i.ids.splice(i.ids.indexOf(e.identifier),1),i.manager.removeIdentifier(e.identifier),i.manager.unbindDocument()},Us.prototype.destroy=function(){var t=this;for(var e in t.unbindEvt(t.options.zone,"start"),t.nipples.forEach(function(i){i.destroy()}),t.pressureIntervals)Object.prototype.hasOwnProperty.call(t.pressureIntervals,e)&&clearInterval(t.pressureIntervals[e]);t.trigger("destroyed",t.nipples),t.manager.unbindDocument(),t.off(),t.pressureIntervals={},t.nipples=[],t.idles=[],t.actives=[],t.ids=[],t.manager=null};var uEt=Us;function en(t){var e=this;e.ids={},e.index=0,e.collections=[],e.scroll=Xht(),e._windowBound=!1,e.config(t),e.prepareCollections();var i=function(){var r;e.collections.forEach(function(s){s.forEach(function(n){r=n.el.getBoundingClientRect(),n.position={x:e.scroll.x+r.left,y:e.scroll.y+r.top}})})};return e._onResize=function(){(r=>{pE.has(r)&&clearTimeout(pE.get(r)),pE.set(r,setTimeout(function(){pE.delete(r),r()},100))})(i)},e._onScroll=function(){e.scroll=Xht()},e.collections}en.prototype=new dW,en.constructor=en,en.prototype.prepareCollections=function(){var t=this;t.collections.create=t.create.bind(t),t.collections.on=t.on.bind(t),t.collections.off=t.off.bind(t),t.collections.destroy=t.destroy.bind(t),t.collections.get=function(e){var i;return t.collections.every(function(r){return!(i=r.get(e))}),i}},en.prototype.create=function(t){return this.createCollection(t)},en.prototype.bindWindowEvents=function(){var t=this;t._windowBound||typeof window>"u"||(t._windowBound=!0,W4(window,"resize",t._onResize),W4(window,"scroll",t._onScroll))},en.prototype.unbindWindowEvents=function(){var t=this;!t._windowBound||typeof window>"u"||(t._windowBound=!1,q4(window,"resize",t._onResize),q4(window,"scroll",t._onScroll))},en.prototype.createCollection=function(t){var e=this,i=new uEt(e,t);return e.bindCollection(i),e.collections.push(i),e.bindWindowEvents(),i},en.prototype.bindCollection=function(t){var e,i=this,r=function(s,n){e=s.type+" "+n.id+":"+s.type,i.trigger(e,n)};t.on("destroyed",i.onDestroyed.bind(i)),t.on("shown hidden rested dir plain",r),t.on("dir:up dir:right dir:down dir:left",r),t.on("plain:up plain:right plain:down plain:left",r)},en.prototype.bindDocument=function(){var t=this;t.binded||(t.bindEvt(document,"move").bindEvt(document,"end"),t.binded=!0)},en.prototype.unbindDocument=function(t){var e=this;(!Object.keys(e.ids).length||t===!0)&&(e.unbindEvt(document,"move").unbindEvt(document,"end"),e.binded=!1)},en.prototype.getIdentifier=function(t){var e;return t?(e=t.identifier===void 0?t.pointerId:t.identifier)===void 0&&(e=this.latest||0):e=this.index,this.ids[e]===void 0&&(this.ids[e]=this.index,this.index+=1),this.latest=e,this.ids[e]},en.prototype.removeIdentifier=function(t){var e={};for(var i in this.ids)if(this.ids[i]===t){e.id=i,e.identifier=this.ids[i],delete this.ids[i];break}return e},en.prototype.onmove=function(t){return this.onAny("move",t),!1},en.prototype.onend=function(t){return this.onAny("end",t),!1},en.prototype.oncancel=function(t){return this.onAny("end",t),!1},en.prototype.onAny=function(t,e){var i,r=this,s="processOn"+t.charAt(0).toUpperCase()+t.slice(1);e=Jvt(e);var n=function(a,o,l){l.ids.indexOf(o)>=0&&(l[s](a),a._found_=!0)};return D9(e,function(a){i=r.getIdentifier(a),D9(r.collections,n.bind(null,a,i)),a._found_||r.removeIdentifier(i)}),!1},en.prototype.destroy=function(){var t=this;t.unbindDocument(!0),t.unbindWindowEvents(),t.ids={},t.index=0,t.collections.forEach(function(e){e.destroy()}),t.collections=[],t.off()},en.prototype.onDestroyed=function(t,e){var i=this;if(i.collections.indexOf(e)<0)return!1;i.collections.splice(i.collections.indexOf(e),1),i.collections.length===0&&i.unbindWindowEvents()};var dEt=en,Cv=null;function Kht(){return Cv||(Cv=new dEt),Cv}var cEt={create:function(t){return Kht().create(t)},destroy:function(){Cv&&(Cv.destroy(),Cv=null)},get factory(){return Kht()}},pEt=cEt;cr(),Le(),yt(),Zh(),vo(),Le();var sbt=null;function UL(){return sbt}var nbt,jL,mEt=new Promise(t=>{nbt=t});function fEt(t){return jL||(jL=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.32/build",i=import("./physics.js"),[r,s]=await Promise.all([i,fetch(`${e}/physics.wasm`).then(n=>n.arrayBuffer())]);await r.init(s),nbt(r)}(),jL)}function abt(t){let e=t.elements,i=e[0]**2+e[1]**2+e[2]**2,r=e[4]**2+e[5]**2+e[6]**2,s=e[8]**2+e[9]**2+e[10]**2,n=e[0]**2+e[4]**2+e[8]**2,a=e[1]**2+e[5]**2+e[9]**2,o=e[2]**2+e[6]**2+e[10]**2,l=1e-8;return i<l||r<l||s<l||n<l||a<l||o<l}function ac(t,e){let i=new ye;if(e&&abt(e))return i.setAttribute("position",new me([],3)),i.setIndex([]),i;if(!t.getAttribute("position"))return i.setAttribute("position",new me([],3)),i.setIndex([]),i;let{positions:r,triIndices:s}=eG(t.getAttribute("position"),t.getIndex());return i.setAttribute("position",new me(r,3)),i.setIndex(s),e&&i.applyMatrix4(e),i}ss(),vo(),Ii(),gG(),yt(),yt(),Zv(),BS();var ki,gEt=class{constructor(t,e,i,r,s,n){this.id=t,this.data=e,this.object=i,this.initialDisabled=!1,this.actions=hn(e,e.actions,r,s,n,i),this.target=e.target}disconnect(){sa(this.actions)}dispatch(t){this.initialDisabled||(this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Collision"}),this.actions.Transition.forEach(e=>e.play()),this.actions.Animation.forEach(e=>{e.data.runMode==="Toggle"?e.toggle():e.play()}),this.actions.TimelineAnimation.forEach(e=>{"runMode"in e.data&&e.data.runMode==="Toggle"?e.toggle():e.play()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Link.forEach(e=>{e.dispatch()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Create.forEach(e=>{e.dispatch()}),this.actions.Destroy.forEach(e=>{e.dispatch(t??!1)}),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.Audio.forEach(e=>{e.dispatchBasic()}),this.actions.Particles.forEach(e=>{e.dispatchBasic()}),this.actions.Video.forEach(e=>{e.dispatchBasic()}),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch()))}},Zht=class{constructor(t,e,i,r,s,n){this.id=t,this.data=e,this.object=i,this.page=r,this.currentIntersectedObjects=[],this.actions=hn(e,e.actions,r,s,n,i),this.target=e.target,this.triggeringObjects=[];for(let a of e.triggeringObjects){let o=r.scene.find(a);o&&this.triggeringObjects.push(o)}}isValidTriggeringObject(t){return this.target==="all"||this.triggeringObjects.some(e=>e===t||e.isAncestorOf(t.uuid)||t.isAncestorOf(e.uuid))}disconnect(){sa(this.actions)}dispatch(){this.object.destroyedInAction||(this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Trigger"}),this.actions.Transition.forEach(t=>t.play()),this.actions.SwitchCamera.forEach(t=>{t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.TimelineAnimation.forEach(t=>{"runMode"in t.data&&t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.Link.forEach(t=>{t.dispatch()}),this.actions.Reset.forEach(t=>{t.dispatch()}),this.actions.Create.forEach(t=>{t.dispatch()}),this.actions.Destroy.forEach(t=>{t.dispatch(!1)}),this.actions.Audio.forEach(t=>{t.dispatchBasic()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()}),this.actions.Video.forEach(t=>{t.dispatchBasic()}),this.actions.SceneTransition.forEach(t=>{t.dispatch()}),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch()))}};ss(),mEt.then(t=>ki=t);var tn=new P,jl=new Pe,wp=new P,Qht=(new ur(0,0,0,"YXZ"),new ur(0,0,0,"XYZ")),Eh=new P,GL=new P,WL=new P(1,1,1),Ky=new Pe,mE=new At,Jht=new At,yEt={type:"updateMatrix"},tut=new Pe,qL=new Zn,HL=.01,O9={type:"beginEvent",eventName:"Collision"},vEt={type:"beginEvent",eventName:"Trigger"},H4=t=>t.states.some(e=>e.data.position!==void 0||e.data.rotation!==void 0||e.data.hiddenMatrix!==void 0||e.data.cloner!==void 0||e.data.pathSnapping!==void 0);function Zy(t){return function(e){return typeof e=="object"&&e!==null&&"booleanOp"in e}(Sg(t)?t.object:t)}var bEt=class{constructor(t){this.eventContext=t,this.isEnabled=!1,this.gameControl=null,this.joysticks=[],this.joystickToGameControls=[],this.sharedGameControlGlobals={entitiesWithTransformAnim:[],entityToCollisionEvents:{},colliderToEntity:new Map,kinematicBodyToEntity:new Map,triggers:[],gamePads:[],createdObjects:[],nCreatedPerAction:{}},this.sensorToTriggerEvent={},this.eventManager=void 0,this.needsCollisionDetection=!1,this.initializationCounter=-1,this.fixedBodiesToWatch=[],this.rigidBodyToMesh=new Map,this.nActiveRigidBodies=0,this.collisionEvents=[],this.isExport=!1,this.skipRender=!0,this._staticBVHAttrIds=new WeakMap,this._staticBVHNextAttrId=1,this.processRigidBody=e=>{if(e.bodyType()!==ki.RigidBodyType.Dynamic)return;e.isSleeping()||this.nActiveRigidBodies++;let[i,r,s]=this.rigidBodyToMesh.get(e.handle);if(tn.copy(e.translation()).multiplyScalar(this.pixelsPerMeter),jl.copy(e.rotation()),i.matrixWorld.compose(tn,jl,r),i.hasNonUniformScale&&i.matrixWorld.multiply(i.shearScale),i.dispatchEvent(yEt),s){let n=i.cloner;if(n&&n.objectForSample===void 0){n.matrixWorld.copy(i.matrixWorld);for(let a of n.children)a.updateMatrixWorld(!0)}for(let a of i.children)a.updateMatrixWorld(!0)}},this.accumulator=0,this.handleCollisionEvents=(e,i,r)=>{if(r===!1)return;let s,n;if(this.sensorToTriggerEvent[e]?(s=this.sensorToTriggerEvent[e],n=this.sharedGameControlGlobals.colliderToEntity.get(i)):this.sensorToTriggerEvent[i]&&(s=this.sensorToTriggerEvent[i],n=this.sharedGameControlGlobals.colliderToEntity.get(e)),s&&n&&s.isValidTriggeringObject(n))s.dispatch();else{for(let a=this.sharedGameControlGlobals.createdObjects.length-1;a>=0;a--){let o=this.sharedGameControlGlobals.createdObjects[a];if(o.userData.hasCollisionDestroy&&(o.rigidBody?.collider(0).handle===e||o.rigidBody?.collider(0).handle===i)){this.sharedGameControlGlobals.createdObjects.splice(a,1),o.removeFromParent();let l=o.rigidBody;requestAnimationFrame(()=>{o.rigidBody===l&&(this.sharedGameControlGlobals.rapierWorld?.removeRigidBody(l),o.rigidBody=void 0)});break}}if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(e)){let a=this.sharedGameControlGlobals.colliderToEntity.get(i),o=this.sharedGameControlGlobals.entityToCollisionEvents[a.uuid];if(o===void 0)return;for(let l of o)l.data.target==="character"&&this.dispatchCollisionEvent(l,a,i)}else if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(i)){let a=this.sharedGameControlGlobals.colliderToEntity.get(e),o=this.sharedGameControlGlobals.entityToCollisionEvents[a.uuid];if(o===void 0)return;for(let l of o)l.data.target==="character"&&this.dispatchCollisionEvent(l,a,e)}else{let a=this.sharedGameControlGlobals.colliderToEntity.get(e),o=this.sharedGameControlGlobals.entityToCollisionEvents[a.uuid];if(o!==void 0)for(let h of o)h.data.target==="scene"&&this.dispatchCollisionEvent(h,a,e);let l=this.sharedGameControlGlobals.colliderToEntity.get(i),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=t.isExport,this.sharedAssets=t.sharedAssets,this.renderer=t.renderer,this.requestRender=t.requestRender,this.domElement=this.renderer.domElement,this.pixelsPerMeter=200,this.gravity=this.page.data.globalPhysics.gravity}get page(){return this.eventContext.page}markIsDestroyTarget(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let i of e.events){if(i.data.disabled===!0)continue;let r=i.data.actions?.find(s=>s.data.type==="Destroy")?.data;if(r)for(let s of r.objects){let n=this.page.scene.find(s);n&&(n.userData.hasDestroy=!0)}}})}markIsDragObject(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let i of e.events)if(i.data.disabled!==!0&&i.data.type==="DragDrop")for(let r of i.data.objects){let s=this.page.scene.find(r);s&&(s.userData.hasDrag=!0)}})}_staticBVHIdOf(t){let e=this._staticBVHAttrIds.get(t);return e===void 0&&(e=this._staticBVHNextAttrId++,this._staticBVHAttrIds.set(t,e)),e}initBVH(){if(UL()===null)return void Pn("collision-bvh","trigger/collision detection");let t=[],e=[];if(this.page.traverseChildren(i=>{let r,s=i instanceof vv,n=k2(i);if($1(i)||s||n)return;r=Sg(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(H4(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){t.push({geometry:o,matrixWorld:i.matrixWorld}),e.push(o.id,this._staticBVHIdOf(h),h.version,o.index!==null?this._staticBVHIdOf(o.index):-1,o.index!==null?o.index.version:-1);for(let d of i.matrixWorld.elements)e.push(d)}}return!!Zy(i)||void 0}),t.length>0){let i=this._staticBVHCache;if(i!==void 0&&i.signature.length===e.length&&i.signature.every((n,a)=>n===e[a]))return void(this.sharedGameControlGlobals.staticMeshBVH=i.bvh);let r=wg(t.map(n=>ac(n.geometry,n.matrixWorld)),!1),s=new(UL())(r);this._staticBVHCache={signature:e,bvh:s},this.sharedGameControlGlobals.staticMeshBVH=s}}addRigidBody(t,e,i){if(abt(t.matrixWorld))return;let r=[],s="geometry"in t?t.geometry:void 0,n=e.dataPatched;if(s?.getAttribute("position")!==void 0&&r.push(ac(s,t.shearScale)),n.physics.fusedBody){let a=this.gatherChildrenGeom(t,r);t.traverseObject(a),t.children.forEach(l=>l.updateMatrixWorld(!0));let o=t.cloner;o&&o.objectForSample===void 0&&n.physics.rigidBody==="dynamic"&&(o.traverseObject(a),o.children.forEach(l=>l.updateMatrixWorld(!0)))}if(r.length>0){let a,o=!1,l=!i.fromCreate&&n.physics.rigidBody==="dynamic"||i.fromCreate&&i.dynamic;l?(a=ki.RigidBodyDesc.dynamic(),a.setLinearDamping(n.physics.damping).setAngularDamping(n.physics.damping).setAdditionalMass(1e-9).setGravityScale(n.physics.gravityScale).enabledRotations(...n.physics.enabledRotation).enabledTranslations(...n.physics.enabledTranslation)):(i.hasTransformAnim||i.hasFollow||i.hasDrag)&&!i.fromCreate?(a=ki.RigidBodyDesc.kinematicPositionBased(),o=!0):a=ki.RigidBodyDesc.fixed();let u=wg(r);(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(tn,jl,wp),t.position0=tn.clone().divideScalar(this.pixelsPerMeter),t.rotation0=jl.clone(),tn.divideScalar(this.pixelsPerMeter),a.setTranslation(tn.x,tn.y,tn.z).setRotation(jl),s?u?.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter):u?.scale(wp.x/this.pixelsPerMeter,wp.y/this.pixelsPerMeter,wp.z/this.pixelsPerMeter);let h=this.sharedGameControlGlobals.rapierWorld.createRigidBody(a),d=!(n.geometry===void 0||n.geometry.type==="SubdivGeometry"||n.geometry.type==="NonParametricGeometry"||n.geometry.type==="BooleanGeometry"||n.geometry.type==="VectorGeometry"||n.geometry.type==="StarGeometry"||n.geometry.type==="RectangleGeometry"||n.geometry.type==="EllipseGeometry"||n.geometry.type==="TriangleGeometry"||n.geometry.type==="TorusGeometry"||n.geometry.type==="HelixGeometry");try{this.addCollider(h,n.physics,u,e,d)}catch{try{this.addCollider(h,n.physics,u,e,!1)}catch(c){console.error(c)}}if(h.numColliders()===0)return void this.sharedGameControlGlobals.rapierWorld.removeRigidBody(h);l?this.rigidBodyToMesh.set(h.handle,[t,wp.clone(),n.physics.fusedBody]):o?(this.sharedGameControlGlobals.kinematicBodyToEntity.set(h.handle,t),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t)):this.fixedBodiesToWatch.push([t,h,(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).clone()]),t.rigidBody=h}}addBoundsTree(t){let e=[];if(t.geometry?.getAttribute("position")!==void 0&&t.geometry?.getAttribute("position").count>0&&e.push(ac(t.geometry,t.shearScale)),t.traverseObject(this.gatherChildrenGeom(t,e)),t.children.forEach(i=>i.updateMatrixWorld(!0)),e.length>0){let i=wg(e,!1);t.bvhGeometry=i,i.getAttribute("position").count>0&&(t.bvhGeometry.boundsTree=new(UL())(i),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t))}}addCollider(t,e,i,r,s=!0){if(i?.getAttribute("position").count===0||i?.getIndex()?.count===0)return;let n;i&&(n=e.colliderType==="trimesh"?ki.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array):ki.ColliderDesc.convexMesh(i.getAttribute("position").array,s?i.getIndex().array:void 0)),n.setFrictionCombineRule(ki.CoefficientCombineRule.Average).setRestitutionCombineRule(ki.CoefficientCombineRule.Average).setDensity(e.density).setFriction(e.friction).setRestitution(e.restitution);let a=this.sharedGameControlGlobals.rapierWorld.createCollider(n,t);this.sharedGameControlGlobals.colliderToEntity.set(a.handle,r),this.sharedGameControlGlobals.entityToCollisionEvents[r.uuid]?.some(o=>o.target==="scene")&&a.setActiveEvents(ki.ActiveEvents.COLLISION_EVENTS)}gatherChildrenGeom(t,e){let i=Zy(t);return(r,s)=>{if(s===0)return;if(i&&r.parent===t)return!0;let n;if($1(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;n=r.object}else if(Sg(r))n=r.object;else if(n=r,n.dataPatched.cloner?.hideBase)return!0;let a=n.dataPatched;if(a.physics.enabled==="visibility"?!a.visible:!a.physics.enabled)return!0;s===1?t.hasNonUniformScale?r.matrixWorld.multiplyMatrices(t.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&&e.push(ac(o,r.matrixWorld)),!!Zy(r)||void 0}}activate(t){if(this.isEnabled)return;this.isEnabled=!0,this.eventManager=t,this.usePhysics=this.page.data.globalPhysics.usePhysics;let e=this.page.playCamera,i=!1;this.page.traverseEntity(a=>{for(let o of a.dataPatched.events)if(o.data.disabled===!1&&o.data.type==="Trigger")return this.needsCollisionDetection=!0,!0});let r=$ht();if(r!==null?i=r.setup({manager:this,camera:e,renderer:this.renderer,sharedAssets:this.sharedAssets,eventContext:this.eventContext,isExport:this.isExport})||i:this.page.data.publish.gameControlObject!==null&&Pn("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 kvt(e,this.renderer.domElement,{isExport:this.isExport,isPlayMode:!0}),this.orbitControls.addEventListener("change",this.requestRender),this.orbitControls.addEventListener("end",this.requestRender),this.orbitControls.addEventListener("start",this.requestRender),this.orbitControls.fromJSON(this.eventManager.publish.orbitControls,this.eventManager.publish.mouseEventTarget),this.orbitControls.useKeyEvents=!1,this.orbitControls.addEventListenersToCamera(),this.orbitControls.connect(),this.orbitControls.update())}let s=this.renderer.domElement.width/this.renderer.getPixelRatio(),n=this.renderer.domElement.height/this.renderer.getPixelRatio();$ht()?.createJoysticks(this,s,n),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 ki.World(new ki.Vector3(0,this.gravity,0)),this.events=new ki.EventQueue(!0);let t=[],e=[];if(this.page.traverseChildren(a=>{let o;if($1(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(Sg(a))o=a.object;else{if(k2(a)||Zg(a)||a instanceof vv)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=H4(u),d=!1,c=o.userData.hasDestroy,p=o.userData.hasDrag,m=!1;for(let g of u.events)if(g.data.disabled!==!0){if(g.data.type==="Collision"){d=!0;let y=new gEt(g.id,g.data,o,this.page,this.sharedAssets,this.eventManager);y.initialDisabled=!0,this.collisionEvents.push(y),this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid]&&this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid].every(v=>v.id!==g.id)?this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid].push(y):this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid]=[y]}else if(g.data.type==="Follow"){m=!0;let y=g.data.target;a.traverseVisible(v=>{v.userData.isFollowingObj=y})}}u.physics.rigidBody==="dynamic"&&u.physics.fusedBody===!1&&(a.matrixWorldFusedFalse=a.matrixWorld.clone());let f=a.geometry;if(l!==void 0){let g=ki.RigidBodyDesc.kinematicPositionBased();(a.hasNonUniformScale?a.matrixWorldRigid:a.matrixWorld).decompose(tn,jl,wp),a.position0=tn.clone().divideScalar(this.pixelsPerMeter),a.rotation0=jl.clone(),tn.divideScalar(this.pixelsPerMeter),g.setTranslation(tn.x,tn.y,tn.z).setRotation(jl);let y,v=this.sharedGameControlGlobals.rapierWorld.createRigidBody(g);a.rigidBody=v,y=l.collider.type==="sphere"?ki.ColliderDesc.ball(l.collider.radius/this.pixelsPerMeter):l.collider.type==="capsule"?ki.ColliderDesc.capsule((l.collider.height/2-l.collider.radius)/this.pixelsPerMeter,l.collider.radius/this.pixelsPerMeter):ki.ColliderDesc.cuboid(l.collider.width/this.pixelsPerMeter/2,l.collider.height/this.pixelsPerMeter/2,l.collider.depth/this.pixelsPerMeter/2),y.setFrictionCombineRule(ki.CoefficientCombineRule.Average).setDensity(u.physics.density).setFriction(u.physics.friction).setRestitution(0).setRestitutionCombineRule(ki.CoefficientCombineRule.Min);let b=this.sharedGameControlGlobals.rapierWorld.createCollider(y,v);this.sharedGameControlGlobals.colliderToEntity.set(b.handle,o),tn.fromArray(l.collider.position.map(x=>typeof x=="number"?x:0)).multiply(wp.setFromMatrixScale(o.matrixWorld)).divideScalar(this.pixelsPerMeter),b.setTranslationWrtParent(tn);let _=new Pe().setFromEuler(new ur().setFromVector3(new P().fromArray(l.collider.rotation.map(x=>typeof x=="number"?x:0))));b.setRotationWrtParent(_),b.setActiveEvents(ki.ActiveEvents.COLLISION_EVENTS),this.generateSensorColliderDescs(o,!0)}else u.physics.rigidBody==="dynamic"||h||m||c||p||d?(this.addRigidBody(a,o,{hasFollow:m,hasTransformAnim:h,hasDrag:p}),this.generateSensorColliderDescs(o,u.physics.fusedBody)):(f&&t.push(ac(f,a.matrixWorld)),u.physics.fusedBody&&!Zy(a)&&a.traverseObject((g,y)=>{if(y===0)return;let v;if($1(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;v=g.object}else{if(k2(g)||Zg(g)||g instanceof vv)return;if(Sg(g))v=g.object;else if(v=g,v.dataPatched.cloner?.hideBase)return!0}let b=v.dataPatched;if(b.physics.enabled==="visibility"?!b.visible:!b.physics.enabled)return!0;let _=g.geometry;return _?.getAttribute("position")!==void 0&&t.push(ac(_,g.matrixWorld)),!!Zy(g)||void 0}),this.generateSensorColliderDescs(o,u.physics.fusedBody,e));return!(u.physics?.fusedBody!==!0&&!l&&!Zy(a))||void 0}),t.length===0)return;let i=wg(t),r=i.getIndex().count>0;if(!r&&e.length===0)return;i.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter);let s=ki.RigidBodyDesc.fixed(),n=this.sharedGameControlGlobals.rapierWorld.createRigidBody(s);if(r){let a=ki.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array).setFrictionCombineRule(ki.CoefficientCombineRule.Multiply).setRestitutionCombineRule(ki.CoefficientCombineRule.Multiply).setFriction(1).setRestitution(1);this.sharedGameControlGlobals.rapierWorld.createCollider(a,n)}for(let[a,o]of e){let l=this.sharedGameControlGlobals.rapierWorld.createCollider(a,n);this.sensorToTriggerEvent[l.handle]=o}}updatePositions(){return this.nActiveRigidBodies=0,this.sharedGameControlGlobals.rapierWorld.forEachRigidBody(this.processRigidBody),this.nActiveRigidBodies>0}rebuildBVH(){this.usePhysics?this.initPhysics():(this.page.traverseEntity(t=>{for(let e of t.dataPatched.events)if(e.data.type==="Trigger"&&e.data.disabled!==!0){let i=new Zht(e.id,e.data,t,this.page,this.sharedAssets,this.eventManager),r=new At().compose(Eh.fromArray(e.data.position.map(s=>typeof s=="number"?s:0)),Ky.setFromEuler(Qht.fromArray(e.data.rotation.map(s=>typeof s=="number"?s:0))),WL);if(e.data.triggerZone==="box"){let s=new dr;s.min.fromArray(e.data.size.map(n=>typeof n=="number"?n:0)).multiplyScalar(-.5),s.max.fromArray(e.data.size.map(n=>typeof n=="number"?n:0)).multiplyScalar(.5),this.sharedGameControlGlobals.triggers.push([s,r,t,i])}else this.sharedGameControlGlobals.triggers.push([e.data.radius,r,t,i])}}),this.needsCollisionDetection&&this.initBVH())}disconnectEvents(){this.collisionEvents.forEach(t=>t.disconnect()),this.sharedGameControlGlobals.triggers.forEach(t=>t[3].disconnect()),this.sharedGameControlGlobals.triggers.length=0}deactivate(){if(this.isEnabled){this.isEnabled=!1,this.page.traverse(t=>{let e=t;e.matrixWorldFusedFalse&&(e.matrixWorldFusedFalse=void 0),e.rigidBody&&(e.rigidBody=void 0),e.position0&&(e.position0=void 0),e.rotation0&&(e.rotation0=void 0)}),this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=void 0,this.sharedGameControlGlobals.staticMeshBVH=void 0,this.accumulator=0,this.sharedGameControlGlobals.entitiesWithTransformAnim=[],this.sharedGameControlGlobals.kinematicBodyToEntity.clear(),this.fixedBodiesToWatch=[],this.disconnectEvents(),this.gameControl?.reset(),this.gameControl?.dispose(),this.gameControl=null,this.initializationCounter=-1,this.joysticks.forEach(([t,e])=>{t?.destroy(),e.remove()}),this.joystickToGameControls=[],this.joysticks=[],this.orbitControls&&(this.orbitControls.dispose(),this.orbitControls=void 0),this.navigationMeshWrapper?.dispose(),this.navigationMeshWrapper=void 0;for(let t of Object.values(this.sharedGameControlGlobals.entityToCollisionEvents))t.forEach(e=>e.disconnect());this.sharedGameControlGlobals.entityToCollisionEvents={},this.page.updateMatrixWorld(!0)}}update(t){if(!this.isEnabled)return!0;let e=!0;if(this.orbitControls!==void 0&&this.orbitControls.needsUpdate&&(this.orbitControls.update(),e=!this.orbitControls.isCurrentlyDamping),this.initializationCounter>=0&&this.initializationCounter<2?(this.initializationCounter++,e=!1):this.initializationCounter===2&&this.gameControl&&(e=!this.gameControl.update(t)&&e),this.usePhysics===!1&&this.checkTrigger(),this.usePhysics){let i=.016666666666666666;if(t===0)e=this.stepPhysics()&&e;else{let r=t/1e3;r<i&&r>.55*i&&(r=i),this.accumulator+=r;let s=performance.now(),n=0,a=6;for(;this.accumulator>=i&&n<a&&(e=this.stepPhysics()&&e,this.accumulator-=i,n++,!(performance.now()-s>1e3*i)););this.accumulator=this.accumulator%i}}this.skipRender=e}recordPhysicsPose(t){(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(tn,jl,wp);let e=t;e.prevQ===void 0?(e.prevQ=jl.clone(),e.prevT=tn.clone()):(e.prevQ.copy(jl),e.prevT.copy(tn))}promoteMovedFixedBodies(){for(let t=this.fixedBodiesToWatch.length-1;t>=0;t--){let[e,i,r]=this.fixedBodiesToWatch[t];(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).equals(r)||(i.setBodyType(ki.RigidBodyType.KinematicPositionBased,!0),this.sharedGameControlGlobals.kinematicBodyToEntity.set(i.handle,e),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e),this.fixedBodiesToWatch.splice(t,1))}}clampPushedBodies(){let t=this.gameControl?.object.rigidBody;if(t===void 0)return;let e=this.sharedGameControlGlobals.rapierWorld,i=t.linvel(),r=t.translation(),s=Math.hypot(i.x,i.z);for(let n=0;n<t.numColliders();n++){let a=t.collider(n);e.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(e.contactPair(a,o,y=>{let v=y.normal(),b=v.x*(u.x-r.x)+v.y*(u.y-r.y)+v.z*(u.z-r.z)<0?-1:1;if(Math.abs(v.y)>.7)return;let _=b*v.x,x=b*v.z,S=Math.hypot(_,x);if(S<1e-4)return;let w=(i.x*_+i.z*x)/S;w>h&&(h=w,d=_/S,c=x/S)}),h===-1/0)return;let p=i.x*d+i.z*c;if(p<-HL)return;let m=l.linvel();if(s>HL&&p>HL){let y=m.x*d+m.z*c;if(y<=0)return;let v=Math.min(y,p);return void l.setLinvel({x:d*v,y:m.y,z:c*v},!0)}let f=m.x*d+m.z*c-Math.max(0,p);if(f<=0)return;let g=.5*f;l.setLinvel({x:m.x-d*g,y:m.y,z:m.z-c*g},!0)})}}stepPhysics(){this.promoteMovedFixedBodies();for(let t of this.sharedGameControlGlobals.kinematicBodyToEntity.values())this.recordPhysicsPose(t),t.rigidBody.setNextKinematicTranslation(tn.divideScalar(this.pixelsPerMeter)),t.rigidBody.setNextKinematicRotation(jl);for(let t of this.sharedGameControlGlobals.entitiesWithTransformAnim)t.rigidBody?.isKinematic()!==!0&&this.recordPhysicsPose(t);return this.sharedGameControlGlobals.rapierWorld.step(this.events),this.clampPushedBodies(),this.events?.drainCollisionEvents(this.handleCollisionEvents),!this.updatePositions()}dispatchCollisionEvent(t,e,i){let r,s=(this.sharedGameControlGlobals.rapierWorld?.getCollider(i))._parent;if(e.cloner){for(let n of e.cloner.children)if(n.rigidBody===s){r=n;break}}t.dispatch(r),e.dispatchEvent(O9)}updateUseWindowEvents(t){this.orbitControls?.updateUseWindowEvents(t)}generateSensorColliderDescs(t,e,i){let r=Jht.copy(t.matrixWorld).invert();t.traverseEntity((s,n)=>{if(e===!1&&n===1)return!0;for(let a of s.dataPatched.events)if(a.data.type==="Trigger"&&a.data.disabled!==!0){let o,l=new Zht(a.id,a.data,s,this.page,this.sharedAssets,this.eventManager);if(o=a.data.triggerZone==="box"?ki.ColliderDesc.cuboid(...a.data.size.map(u=>(typeof u=="number"?u:1)/(2*this.pixelsPerMeter))):ki.ColliderDesc.ball(a.data.radius/this.pixelsPerMeter),o.setDensity(0).setSensor(!0).setActiveEvents(ki.ActiveEvents.COLLISION_EVENTS),Eh.fromArray(a.data.position.map(u=>typeof u=="number"?u:0)),Ky.setFromEuler(Qht.fromArray(a.data.rotation.map(u=>typeof u=="number"?u:0))),mE.compose(Eh,Ky,WL).premultiply(s.matrixWorld),i?(mE.decompose(Eh,Ky,GL),o.setActiveCollisionTypes(ki.ActiveCollisionTypes.KINEMATIC_FIXED|ki.ActiveCollisionTypes.DYNAMIC_FIXED)):(mE.premultiply(r).decompose(Eh,Ky,GL),t.rigidBody.bodyType()===ki.RigidBodyType.Dynamic||(t.rigidBody.bodyType()===ki.RigidBodyType.Fixed?o.setActiveCollisionTypes(ki.ActiveCollisionTypes.KINEMATIC_FIXED|ki.ActiveCollisionTypes.DYNAMIC_FIXED):o.setActiveCollisionTypes(ki.ActiveCollisionTypes.KINEMATIC_KINEMATIC|ki.ActiveCollisionTypes.DYNAMIC_KINEMATIC))),Eh.divideScalar(this.pixelsPerMeter),o.setTranslation(Eh.x,Eh.y,Eh.z),o.setRotation(Ky),i)i.push([o,l]);else{let u=this.sharedGameControlGlobals.rapierWorld.createCollider(o,t.rigidBody);this.sensorToTriggerEvent[u.handle]=l}}})}checkTrigger(){let t;for(let e=0;e<this.sharedGameControlGlobals.triggers.length;e++){let[i,r,s,n]=this.sharedGameControlGlobals.triggers[e];for(let a=0;a<this.sharedGameControlGlobals.entitiesWithTransformAnim.length;a++){let o=this.sharedGameControlGlobals.entitiesWithTransformAnim[a];if(s===o||n.isValidTriggeringObject(Ai.is(o)?o:o.object)===!1)continue;let l=Jht.copy(s.matrixWorld).decompose(Eh,tut,GL).compose(Eh,tut,WL).multiply(r),u=mE.copy(o.matrixWorld).invert().multiply(l),h=o.bvhGeometry.boundsTree;i instanceof dr?t=h.intersectsBox(i,u):(qL.radius=i,qL.center.setFromMatrixPosition(u),t=h.intersectsSphere(qL)),t?n.currentIntersectedObjects.indexOf(o)===-1&&(n.currentIntersectedObjects.push(o),n.dispatch(),s.dispatchEvent(vEt)):n.currentIntersectedObjects=n.currentIntersectedObjects.filter(d=>d!==o)}}}};Jv(),yt(),s4(),Fi(),_m();var $L=.02,eut=new P,iut=new P,_Et=new P,qa=new P,Fd=new P,Qy=new P,XL=new At,rut=new At,xEt=new At,nl=new Pe,Wf=new Pe,Jy=new ur(0,0,0,"YXZ"),wEt=new P(1,0,0),Eu=new P(0,1,0),SEt=new P(0,0,1),sut=new P(1,1,1),nut=[],aut=t=>nut[t]??(nut[t]=new P),YL=new P,TEt=new P,MEt=new P,AEt=new P,out=new Pe,CEt=new P,lut=new Pe,Wn=new yl,Gl=new dr,EEt={type:"requestRender"},PEt={type:"updateMatrix"},I9=class extends Kn{constructor(t,e,i,r,s,n,a,o,l){super(),this.object=t,this.domElement=e,this.data=i,this.gloabalPhysics=r,this.controlsManager=s,this.cameraFollow=n,this.camera=a,this.page=o,this.sharedAssets=l,this.enableDamping=!0,this.hiddenMatrix0=new At,this.target0=new P,this.zoom0=1,this.rotForce=1,this.moveForce=1,this.pixelsPerMeter=200,this.euler0=new ur(0,0,0,"YXZ"),this.position0Cam=new P,this.quat0Cam=new Pe,this.scale0Cam=new P,this.hiddenMatrix0Cam=new At,this.threshEndTranslate=.01,this.threshEndRotate=1e-8,this.threshEndRotVel=.005,this.collider={type:"capsule",radius:40,segment:new yl(new P(0,-40,0),new P(0,40,0)),matrix:new At,position:new P,rotation:new Pe},this.euler=new ur(0,0,0,"YXZ"),this.eulerDelta=new P,this.lastPosition=new P,this.lastCameraQuaternion=new Pe,this.lastCameraPosition=new P,this.PI_2=Math.PI/2,this.prevMouse=new Z,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 At,this.nonColliderPosOffset=new At,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 At,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 Pe,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 Pe,this.objXZQuatInv=new Pe,this.objXZRotMat=new At,this.isFirstPerson=!1,this.didHit=!1,this.groundVelocity=new P,this.pushedVelocity=new P,this.groundYRotation=0,this.objectRealQuat=new Pe,this.colliderWorldQuat=new Pe,this.groundNormal=new P,this.groundTilt=new Pe,this.groundTiltInv=new Pe,this.lastHitObj=null,this.isFirstFrame=!0,this.rotationAccumWhenOrientWithCamera=0,this.navMeshPathDest=null,this.position=new P,this.quaternion=new Pe,this.scale=new P,this.initialAction=!0,this.onPointerDown=m=>{!(m.target===this.domElement||m.target instanceof HTMLElement&&m.target.tagName==="SPLINE-VIEWER"&&m.target.shadowRoot?.contains(this.domElement))||this.firstPointerId!==-1||(this.firstPointerId=m.pointerId,this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp),this.rotBy!=="keys"&&!Fo&&!s8&&this.domElement.requestPointerLock(),this.prevMouse.set(m.clientX,m.clientY))},this.onPointerUp=m=>{this.firstPointerId=-1,this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp),m.pointerType==="mouse"&&this.domElement.ownerDocument.exitPointerLock()},this.onPointerMove=m=>{if(m.pointerId!==this.firstPointerId)return;let f=m.clientX-this.prevMouse.x,g=m.clientY-this.prevMouse.y;this.prevMouse.set(m.clientX,m.clientY),m.pointerType==="mouse"&&this.rotBy!=="keys"&&(s8&&gpt<15.5&&!Fo?(this.eulerDelta.y=-f*this.mouseOrbitSensitivity,this.eulerDelta.x=-g*this.mouseOrbitSensitivity):(this.eulerDelta.y=-m.movementX*this.mouseOrbitSensitivity,this.eulerDelta.x=-m.movementY*this.mouseOrbitSensitivity)),m.pointerType!=="mouse"&&this.rotByTouch==="drag"&&(this.eulerDelta.y=-f*this.mouseOrbitSensitivity*5,this.eulerDelta.x=-g*this.mouseOrbitSensitivity*5),this.controlsManager.requestRender()},this.onPointerlockChange=m=>{this.domElement.ownerDocument.pointerLockElement===this.domElement?I9.isLocked=!0:I9.isLocked=!1},this.onPointerlockError=()=>{console.error("SPE.GameControls: Unable to use Pointer Lock API")},this.handleVisibilityChange=()=>{if(document?.hidden)for(let m in this.movementState)this.movementState[m]=0},this.onKeyDown=m=>{!(m.target instanceof HTMLInputElement)&&(m.code==="ArrowLeft"||m.code==="ArrowUp"||m.code==="ArrowRight"||m.code==="ArrowDown"||m.code==="Space")&&m.preventDefault();for(let f of this.keyAssignments)if(m.key.toUpperCase()===f[1]||m.key===f[1]){this.movementState[f[0]]=1;break}this.controlsManager.requestRender()},this.onKeyUp=m=>{for(let f of this.keyAssignments)if(m.key.toUpperCase()===f[1]||m.key===f[1]||m.code.slice(3,m.code.length).toUpperCase()===f[1]){this.movementState[f[0]]=0;break}},this.copyVRGamePadValues=(m,f)=>{for(let g=2;g<4;g++){let y=m.axes[g];f===0?g===2?this.movementState.movePosX=y:this.movementState.movePosZ=y:(m.buttons[3].pressed?this.movementState.jump=1:this.movementState.jump=0,g===2?this.movementState.rotPosY=y:this.moveMode==="fly"&&(this.movementState.moveNegY=y))}},this.sharedGameControlGlobals=s.sharedGameControlGlobals,t===a&&(this.isFirstPerson=!0),this.hiddenMatrix0.copy(this.object.hiddenMatrix),this.object.parent?this.object.hiddenMatrix.copy(this.object.parent.matrixWorld).invert():this.object.hiddenMatrix.identity(),this.object.matrix.copy(this.object.matrixWorld),this.object.matrix.decompose(this.position,this.quaternion,this.scale),this.euler0.setFromQuaternion(this.quaternion,"YXZ");let 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 m,f=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(f.y)<1e-6?(g.y=0,f.y=0,m=g.projectOnVector(f)):m=g.y/f.y>0?f.multiplyScalar(g.y/f.y):f.multiplyScalar(g.length()),this.targetToCamera0.copy(m).negate();let y=this.camera.position.clone().add(m);this.objectToTarget0.subVectors(y,this.position);let v=new ur().setFromQuaternion(this.camera.quaternion,"YXZ");this.cameraPolarOffset=-v.x,v.x=0,v.z=0,v.y-=Math.PI/2,this.cameraPolarAxis0.set(0,0,-1).applyEuler(v)}if(this.object instanceof ln&&(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(m=>{let f=[m[0],m[1]];return f[1]==="\u25B2"?f[1]="ArrowUp":f[1]==="\u25C0"?f[1]="ArrowLeft":f[1]==="\u25BC"?f[1]="ArrowDown":f[1]==="\u25B6"?f[1]="ArrowRight":f[1]==="\u21E7"?f[1]="Shift":f[1]==="\u21B5"?f[1]="Enter":f[1]==="Space"?f[1]=" ":f[1]==="\u2318"?f[1]="Meta":f[1]==="Ctrl"?f[1]="Control":f[1]==="Esc"&&(f[1]="Escape"),f}),i.rotBy==="mouse"){let m;m=this.keyAssignments.findIndex(f=>f[0]==="rotNegX"),m!==-1&&(this.keyAssignments[m][1]=""),m=this.keyAssignments.findIndex(f=>f[0]==="rotPosX"),m!==-1&&(this.keyAssignments[m][1]=""),m=this.keyAssignments.findIndex(f=>f[0]==="rotPosY"),m!==-1&&(this.keyAssignments[m][1]=""),m=this.keyAssignments.findIndex(f=>f[0]==="rotNegY"),m!==-1&&(this.keyAssignments[m][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??dv.defaultData.gravity),this.usePhysics=this.gloabalPhysics.usePhysics??dv.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??KR.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*$L/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*$L/this.pixelsPerMeter,this.stepThresh=2*i.collider.radius*.3/this.pixelsPerMeter,this.colliderHeight=2*i.collider.radius):(this.offset=i.collider.height*$L/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(m=>typeof m=="number"?m:0)),c=new Pe().setFromEuler(new ur().fromArray([...i.collider.rotation.map(m=>typeof m=="number"?m:0),"XYZ"]));this.collider.position.copy(d).multiply(this.scale),this.collider.rotation.copy(c),this.collider.matrix.compose(d,c,sut),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 m=new fe;m.push({fi:0,data:{...Gs.defaultData("light","phong"),alpha:0},id:"layer1"}),m.push({fi:0,data:{...Gs.defaultData("color"),color:i.navmesh.destinationHelperColor,alpha:i.navmesh.destinationHelperColor.a},id:"layer2"});let f=Nft({layers:m},{scene:this.page.scene,shared:this.sharedAssets});this.navMeshPathDest=new Ar(Y7.create({parameters:{width:p,height:p/10,hollow:.7}}),f),this.navMeshPathDest.material.userData.opacity0=i.navmesh.destinationHelperColor.a}this.activate()}reset(t=!1){if(this.object.hiddenMatrix.copy(this.hiddenMatrix0),t){this.object.updateMatrix(),this.object.updateMatrixWorld(),this.object.matrix.copy(this.object.matrixWorld),this.object.matrix.decompose(this.position,this.quaternion,this.scale),this.object.parent?this.object.hiddenMatrix.copy(this.object.parent.matrixWorld).invert():this.object.hiddenMatrix.identity();let e=new ur().setFromQuaternion(this.quaternion,"YXZ"),i=e.y;this.objectRealQuat.copy(this.quaternion),e.y=0,this.quaternion.setFromEuler(e),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),e.set(0,i,0),this.quaternion.setFromEuler(e),this.rot.setFromEuler(e),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.velocityTarget.set(0,0,0),this.velocity.set(0,0,0)}else this.object instanceof ln?this.object.matrixAutoUpdate=!0:this.object.updateMatrix();this.cameraFollow===!0&&(this.camera.quaternion.copy(this.quat0Cam),this.camera.position.copy(this.position0Cam),this.camera.scale.copy(this.scale0Cam),this.camera.hiddenMatrix.copy(this.hiddenMatrix0Cam),this.camera.matrixAutoUpdate=!0),this.controlsManager.requestRender()}activate(){this.instantiateActions(),this.domElement.ownerDocument.addEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.addEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.addEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.addEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.addEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.addEventListener("visibilitychange",this.handleVisibilityChange)}deactivate(){this.disposeActions(),this.domElement.ownerDocument.removeEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.removeEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.removeEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.removeEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.removeEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.removeEventListener("visibilitychange",this.handleVisibilityChange)}dispose(){this.deactivate(),this.navMeshPathDest?.parent&&this.page.remove(this.navMeshPathDest)}instantiateActions(){let t=this.data,e=this.sharedAssets;t.gameActions!==void 0&&(this.actions={},YR.list.forEach(i=>{this.actions[i]=hn({...t,disabled:!1,type:"GameControl"},t.gameActions[i],this.page,e,this.controlsManager.eventManager,this.object)})),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"),this.initialAction&&(this.initialAction=!1)}disposeActions(){this.initialAction=!1,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),sa(this.actions.idle),sa(this.actions.move),sa(this.actions.run),sa(this.actions.jump)}dispatchStartEvent(t){this.actions[t]!==void 0&&(this.actionState[t]||(this.actionState[t]=!0,this.actions[t].Transition.forEach(e=>{e.play()}),this.actions[t].Animation.forEach(e=>{e.play(this.initialAction===!1)}),this.actions[t].TimelineAnimation.forEach(e=>{e.play()}),this.actions[t].Create.forEach(e=>{e.dispatchStart()}),this.actions[t].Audio.forEach(e=>{e.dispatchGameControl("start")}),this.actions[t].Particles.forEach(e=>{e.dispatchGameControl("start")})))}dispatchStopEvent(t){this.actions[t]!==void 0&&(!this.actionState[t]||(this.actionState[t]=!1,this.actions[t].Transition.forEach(e=>{e.stop(),e.object.currentState!==null&&e.object.changeSelectedState(null,{scene:this.page.scene,shared:this.sharedAssets})}),this.actions[t].TimelineAnimation.forEach(e=>{e.stop()}),this.actions[t].Create.forEach(e=>{e.dispatchStop()}),this.actions[t].Audio.forEach(e=>{e.dispatchGameControl("stop")}),this.actions[t].Particles.forEach(e=>{e.dispatchGameControl("stop")})))}get colliderWorldPosition(){return qa.copy(this.collider.position).applyQuaternion(this.objectRealQuat).add(this.position)}update(t){if(this.gravity<0?this.position.y<this.resetYPosition:this.position.y>this.resetYPosition)return this.reset(!0),!0;this.sharedGameControlGlobals.gamePads.forEach(this.copyVRGamePadValues);let e=(this.isFirstFrame?16.6:t)/1e3;this.isFirstFrame&&(this.isFirstFrame=!1);let i=60*e,r=!1;if(this.groundYRotation=0,this.groundVelocity.set(0,0,0),this.usePhysics&&this.collisionEnabled&&this.object.rigidBody?.collider(0).shape){let n=Fd.set(0,(this.velocity.y===0?this.pixelsPerMeter*Math.max(Math.abs(this.gravity)/120,1)*(this.gravity>0?1:-1):this.velocity.y)*e,0).divideScalar(this.pixelsPerMeter),a=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter),this.colliderWorldQuat,n,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(qa).add(this.collider.position).divideScalar(this.pixelsPerMeter),d=l.velocityAtPoint(h);this.groundVelocity.set(d.x,d.y,d.z).multiplyScalar(this.pixelsPerMeter),this.groundYRotation=l.angvel().y*e}}else this.onObject=!1}if(this.moveMode==="walk"&&this.collisionEnabled&&(this.movementState.jump===1&&this.onObject&&(this.velocityTarget.y=this.jumpPower,this.movementState.jump=0,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("jump"),this.onObject=!1),this.onObject?this.velocityTarget.y/=2:this.velocityTarget.y+=this.gravity*i),this.moveMode==="fly"&&(this.velocityTarget.y=(this.movementState.movePosY-this.movementState.moveNegY)*this.speedTranslate),this.directionXZ.z=this.movementState.movePosZ-this.movementState.moveNegZ,this.directionXZ.x=this.movementState.movePosX-this.movementState.moveNegX,this.forwardDir==="+z"&&this.directionXZ.multiplyScalar(-1),this.directionXZ.manhattanLength()>0&&(this.path=[]),this.navMeshPathDest){let n=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=qa.subVectors(this.path[1],this.position),o=Fd.subVectors(this.path[1],this.path[0]);a.dot(o)<0?this.path.shift():(this.directionXZ.x=o.x,this.directionXZ.z=o.z),n.opacity=n.userData.opacity0}else n.opacity-=.05*n.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 s=_Et.copy(this.velocity);if(this.orientMode!=="none"&&this.isFirstPerson===!1){let n=Fd.copy(s);n.y=0,s.set(0,s.y,n.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 n=qa;this.camera.getWorldDirection(n);let a=Qy.copy(Eu).multiplyScalar(n.dot(Eu));n.sub(a);let o=Fd.copy(this.directionXZ);o.x*=-1,this.rot.y=n.angleTo(o)*(n.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(Jy.setFromVector3(this.rot),this.moveMode==="walk"&&(Jy.x=0),s.applyEuler(Jy),r&&(Wf.setFromUnitVectors(Eu,this.groundNormal),s.applyQuaternion(Wf)),this.usePhysics===!0&&this.object.rigidBody){this.pushedVelocity.set(0,0,0);let n=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(YL,out,TEt);let o=this.object.getWorldPosition(MEt).add(this.collider.position).sub(YL);lut.copy(a.prevQ).invert().premultiply(out);let l=Qy.subVectors(YL,a.prevT).add(AEt.copy(o).applyQuaternion(lut).sub(o)).divideScalar(e).divideScalar(this.pixelsPerMeter),u=a.rigidBody.collider(0).castCollider(l,this.object.rigidBody.collider(0),qa.copy(s).divideScalar(this.pixelsPerMeter),0,e,!1);l.multiplyScalar(this.pixelsPerMeter);let h=Ai.is(a)?a:a.object;if(u!==null&&this.lastHitObj!==h){let d;a instanceof bl&&(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(O9));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),aut(n++).copy(u.normal1).applyQuaternion(a.quaternion))}if(n>0){for(let a=0;a<n;a++){let o=aut(a),l=o.dot(s);l<0&&s.addScaledVector(o,-l)}s.add(this.pushedVelocity)}else s.add(this.groundVelocity)}if(this.rotDirection.y=Number(this.movementState.rotPosY)-Number(this.movementState.rotNegY),this.rotDirection.x=Number(this.movementState.rotPosX)-Number(this.movementState.rotNegX),this.rotDirection.normalize(),this.rotationMode==="normal"&&(this.movementState.rotPosX||this.movementState.rotNegX)||this.rotationMode==="steer"&&(this.movementState.rotPosX||this.movementState.rotNegX)&&(this.movementState.movePosZ||this.movementState.moveNegZ||this.moveMode==="walk")?this.rotVelocityStick.x=-this.rotDirection.x*this.speedOrbit*this.rotForce:this.rotVelocityStick.x=0,this.rotationMode==="normal"&&(this.movementState.rotPosY||this.movementState.rotNegY)||this.rotationMode==="steer"&&(this.movementState.rotPosY||this.movementState.rotNegY)&&(this.movementState.movePosZ||this.movementState.moveNegZ)?this.rotVelocityStick.y=-this.rotDirection.y*this.speedOrbit*this.rotForce:this.rotVelocityStick.y=0,this.rotVelocityTarget.subVectors(this.eulerDelta.divideScalar(e),this.rotVelocityStick),this.rotVelocityTarget.manhattanLength()===0?this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotEnd)**i):this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotStart)**i),this.euler.x+=this.rotVelocity.x*e,this.euler.y+=this.rotVelocity.y*e+this.groundYRotation,this.rotVelocityTarget.y===0&&this.directionXZ.manhattanLength()===0?this.rotationAccumWhenOrientWithCamera=0:(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.rotationAccumWhenOrientWithCamera+=this.rotVelocity.y*e),this.isFirstPerson===!1&&this.orientMode!=="none"&&this.directionXZ.manhattanLength()>0){if(this.orientMode==="radial"){this.objectToCamXZ.copy(this.objectToCamXZ0).applyAxisAngle(Eu,this.euler.y-this.euler0.y);let n=Fd.copy(this.objectToCamXZ).normalize(),a=Qy.copy(s).multiplyScalar(e);a.y=0;let o=a.sub(qa.copy(n).multiplyScalar(a.dot(n))).cross(n).y;this.euler.y-=Math.atan2(o,this.objectToCamXZ.length())}}else this.rot.y+=this.rotVelocity.y*e+this.groundYRotation,this.rotVelocityTarget.y!==0&&(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.euler.y=this.rot.y);if(this.cameraFollow===!0&&(this.moveMode==="walk"?this.cameraXAxis==="Limit"?this.euler.x=Yt.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):this.euler.x=Yt.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset,this.PI_2+this.cameraPolarOffset):this.cameraXAxis==="Limit"&&(this.euler.x=Yt.clamp(this.euler.x,-this.PI_2,this.PI_2))),this.moveMode==="fly"?this.rot.x=this.euler.x:this.isFirstPerson&&(Jy.copy(this.euler),Jy.y=0,this.nonColliderRotOffset.makeRotationFromEuler(Jy)),nl.setFromAxisAngle(wEt,this.rot.x),Wf.setFromAxisAngle(Eu,this.rot.y),Wf.multiply(nl),nl.setFromAxisAngle(SEt,this.rot.z),Wf.multiply(nl),this.quaternion.copy(Wf),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 n=Fd.copy(s).multiplyScalar(e/this.pixelsPerMeter),a=null;this.didHit=!1;let o=new P;for(let h=0;h<5;h++){let d=n.length(),c=Qy.copy(n).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(n);break}{this.didHit=!0;let p=this.sharedGameControlGlobals.colliderToEntity.get(a.collider.handle);if(p!==this.lastHitObj&&h===0){this.lastHitObj=p;let y=this.sharedGameControlGlobals.entityToCollisionEvents[p?.uuid];if(y){for(let v of y)if(v.data.target==="character"){let b,_=(this.sharedGameControlGlobals.rapierWorld?.getCollider(a.collider.handle))._parent;if(p.cloner){for(let x of p.cloner.children)if(x.rigidBody===_){b=x;break}}v.dispatch(b),p.dispatchEvent(O9)}}}let m=eut.set(a.normal2.x,a.normal2.y,a.normal2.z).applyQuaternion(this.colliderWorldQuat),f=iut.copy(c).multiplyScalar(a.time_of_impact).dot(m),g=a.time_of_impact;if(g===0&&(this.position.y+=this.offset*this.pixelsPerMeter),f>this.offset&&(g=a.time_of_impact*(f-this.offset)/f,o.addScaledVector(c,g)),n.copy(c).multiplyScalar(d-g),Math.acos(-m.y)>this.slopeThresh){let y=this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(o),v=Qy.copy(a.witness2).applyQuaternion(this.colliderWorldQuat);v.y=0;let b=y.add(v);b.y+=this.stepThresh;let _=this.sharedGameControlGlobals.rapierWorld.castShape(b,this.colliderWorldQuat,n,this.object.rigidBody?.collider(0).shape,0,1,!1,12,void 0,void 0,this.object.rigidBody);_!==null&&_.time_of_impact===0&&(m.y=0,m.normalize())}n.addScaledVector(m,-n.dot(m))}}this.position.addScaledVector(o,this.pixelsPerMeter),qa.copy(this.position).divideScalar(this.pixelsPerMeter),nl.copy(this.quaternion).premultiply(this.groundTilt).multiply(this.objXZQuat);let l=this.object.rigidBody,u=l!==void 0&&CEt.copy(qa).sub(l.translation()).lengthSq()>1;l!==void 0&&(u?(l.setTranslation(qa,!0),l.setRotation(nl,!0)):(l.setNextKinematicTranslation(qa),l.setNextKinematicRotation(nl)))}else{let n=this.onObject?1:5,a=s.multiplyScalar(e/n);for(let o=0;o<n;o++)this.position.add(a),this.collisionAdjustment(e/n)}else this.position.addScaledVector(s,e);if(this.moveMode==="walk"&&this.onObject&&(this.velocityTarget.y=0,this.velocity.y=0),this.quaternion.premultiply(this.groundTilt).multiply(this.objXZQuat),this.object.matrix.compose(this.position,this.quaternion,this.scale),this.object.matrixWorldNeedsUpdate=!0,this.object.matrix.multiply(this.nonColliderPosOffset).multiply(this.nonColliderRotOffset),this.quaternion.premultiply(this.groundTiltInv).multiply(this.objXZQuatInv),this.cameraFollow===!0){this.updateFollowArms();let n=this.objectToTarget.add(this.position),a=this.targetToCamera.add(n);XL.lookAt(a,n,Eu).setPosition(a),XL.decompose(this.targetPos,this.targetQuat,qa),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=Yt.clamp(this.euler.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel)),this.euler.x=Yt.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(PEt),!(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(EEt),0))}updateFollowArms(){this.objectToTarget.copy(this.objectToTarget0),this.targetToCamera.copy(this.targetToCamera0);let t,e=nl.setFromAxisAngle(Eu,this.cameraYAxis==="Limit"&&this.orientMode!=="radial"?Yt.clamp(this.euler.y-this.euler0.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel):this.euler.y-this.euler0.y);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&this.objectToTarget.applyQuaternion(e),t=this.cameraXAxis==="Limit"?Yt.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):Yt.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset+1e-6,this.PI_2+this.cameraPolarOffset-1e-6);let i=qa.copy(this.cameraPolarAxis0);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&i.applyQuaternion(e);let r=Wf.setFromAxisAngle(i,t);this.cameraYAxis!=="Locked"&&this.targetToCamera.applyQuaternion(e),this.cameraXAxis!=="Locked"&&this.targetToCamera.applyQuaternion(r)}groundTiltAdjustment(t){180*Eu.angleTo(t)/Math.PI<15||180*Eu.angleTo(t)/Math.PI>85?nl.identity():nl.setFromUnitVectors(Eu,t),this.groundTilt.slerp(nl,.06),this.groundTiltInv.copy(this.groundTilt).invert()}collisionAdjustment(t){let e=iut.set(0,0,0);this.object.matrix.compose(this.position,this.quaternion,this.scale);let i=XL.multiplyMatrices(this.object.matrix,this.objXZRotMat).multiply(this.collider.matrix).decompose(qa,nl,Fd).compose(qa,nl,sut);this.sharedGameControlGlobals.entitiesWithTransformAnim.forEach(s=>{if(s===this.object||s.isDescendantOf(this.object)||!s.bvhGeometry||!s.bvhGeometry.boundsTree)return;Gl.makeEmpty(),s.updateMatrixWorldRigid();let n=s.matrixWorldRigid,a=rut.copy(n).invert(),o=xEt.copy(rut).multiply(i);Wn.copy(this.collider.segment),Wn.start.applyMatrix4(o),Wn.end.applyMatrix4(o);let l=eut.copy(this.position).applyMatrix4(a);Gl.expandByPoint(Wn.start),Gl.expandByPoint(Wn.end),Gl.min.addScalar(-this.collider.radius),Gl.max.addScalar(this.collider.radius),s.bvhGeometry.boundsTree.shapecast({boundsTraverseOrder:u=>u.distanceToPoint(Wn.end),intersectsBounds:u=>u.intersectsBox(Gl),intersectsTriangle:u=>{let h=qa,d=Fd,c=u.closestPointToSegment(Wn,h,d);if(c<this.collider.radius){let p=this.collider.radius-c,m=d.sub(h).normalize(),f=Qy.copy(l);f.addScaledVector(m,p);let g=f.applyMatrix4(n).sub(this.position);e.add(g),Wn.start.addScaledVector(m,p),Wn.end.addScaledVector(m,p)}}})}),Gl.makeEmpty(),Wn.copy(this.collider.segment),Wn.start.applyMatrix4(i),Wn.end.applyMatrix4(i),Gl.expandByPoint(Wn.start),Gl.expandByPoint(Wn.end),Gl.min.addScalar(-this.collider.radius),Gl.max.addScalar(this.collider.radius),this.sharedGameControlGlobals.staticMeshBVH?.shapecast({boundsTraverseOrder:s=>s.distanceToPoint(Wn.end),intersectsBounds:s=>s.intersectsBox(Gl),intersectsTriangle:s=>{let n=qa,a=Fd,o=s.closestPointToSegment(Wn,n,a);if(o<this.collider.radius){let l=this.collider.radius-o,u=a.sub(n).normalize();this.alignToGround&&this.groundTiltAdjustment(u),e.addScaledVector(u,l),Wn.start.addScaledVector(u,l),Wn.end.addScaledVector(u,l)}}}),this.onObject=Math.abs(e.y)>Math.abs(t*this.velocity.y*.25),this.onObject&&this.dispatchStopEvent("jump");let r=Math.max(0,e.length()-1e-5);e.normalize().multiplyScalar(r),this.position.add(e)}pause(){this.firstPointerId=-1,this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0},this.deactivate()}resume(){this.activate()}},obt=I9;obt.isLocked=!1,yt(),BS(),C5(),Jv(),Zv();var lbt,hbt,KL,REt=new Promise(t=>{lbt=t});function NEt(t){return KL||(KL=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.32/build";typeof window<"u"&&(hbt=new URL(e.endsWith("/")?e:`${e}/`,window.location.href).href);let i=import("./navmesh.js"),[r,s]=await Promise.all([i,fetch(`${e}/navmesh.wasm`).then(o=>o.arrayBuffer())]),n=r.default,a=await n({wasmBinary:s});lbt(a)}(),KL)}cr();var ubt,Di,_a,DEt=t=>`
5084
5084
  (async function() {
5085
5085
  const [wasmImport, wasmBinary] = await Promise.all([
5086
5086
  import('${t}' + 'navmesh.js'),
@@ -5090,7 +5090,7 @@ void main() {
5090
5090
  self.module = await wasmModule({ wasmBinary });
5091
5091
  postMessage('ready');
5092
5092
  })();
5093
- `,OEt={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};REt.then(t=>{ubt=t,Di=new t.Vec3,_a=new t.Vec3});var IEt=new P,BEt=class{constructor(t=!1,e=!1){this.usePhysics=t,this.isExport=e,this.onPointerDown=i=>{if(Ge.length!==1)return;let{raycaster:r,page:s}=this.eventContext;this.eventContext.updateRaycaster(i);let n=s.raycastWithClones(r);if(n.length!==0){if(this.gameControl){let a=IEt.copy(this.gameControl.colliderWorldPosition);a.y-=this.gameControl.colliderHeight/2,this.gameControl.path=this.computePath(a,n[0].point)}this.eventContext.requestRender()}},this.traverseWithPhysics=(i,r)=>s=>{let n;if(s instanceof lm){if(!s.objectForSample)return s.object.dataPatched.physics.fusedBody===!0&&s.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(s.objectForSample.dataPatched.physics.fusedBody)return;n=s.object}else if(s instanceof bl)n=s.object;else if(n=s,n.dataPatched.cloner?.disabled===!1&&n.dataPatched.cloner?.hideBase&&n.dataPatched.physics?.fusedBody!==!0)return!0;if(r&&!n.userData.navmesh)return;let a=n.dataPatched;if(!a.visible&&a.physics?.enabled!==!0)return!0;s.updateMatrixWorldRigid();let o=H4(a),l=n.userData.hasDestroy,u=n.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 s&&s.geometry&&i.push(ac(s.geometry,s.matrixWorld)),this.usePhysics&&a.physics?.fusedBody)return s.traverseObject((c,p)=>{if(p===0)return;let m;if(c instanceof lm){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;m=c.object}else if(c instanceof bl)m=c.object;else if(m=c,c.dataPatched.cloner?.hideBase)return!0;let f=m.dataPatched;if(!f.visible&&f.physics?.enabled!==!0)return!0;"geometry"in c&&c.geometry&&i.push(ac(c.geometry,c.matrixWorld))}),!0},this.traverseNoPhysics=(i,r)=>s=>{let n;if(s instanceof lm)return;n=s instanceof bl?s.object:s;let a=n.dataPatched;if(a.physics.enabled==="visibility"?!a.visible:!a.physics.enabled)return!0;if(r&&!n.userData.navmesh)return;let o=s.geometry,l=n.userData.hasDestroy===!0,u=n.userData.hasDrag===!0;if(H4(a)||l||u||n.dataPatched.events.some(h=>h.data.disabled!==!0&&h.data.type==="GameControl"))return!0;o&&i.push(ac(o,s.matrixWorld))},this.navmeshWasm=ubt,this.navMesh=new this.navmeshWasm.NavMesh,this._workerURL=URL.createObjectURL(new Blob([(e?DEt(hbt??"https://cdn.spline.design/@splinetool/runtime@2.0.30/build/"):`
5093
+ `,OEt={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};REt.then(t=>{ubt=t,Di=new t.Vec3,_a=new t.Vec3});var IEt=new P,BEt=class{constructor(t=!1,e=!1){this.usePhysics=t,this.isExport=e,this.onPointerDown=i=>{if(Ge.length!==1)return;let{raycaster:r,page:s}=this.eventContext;this.eventContext.updateRaycaster(i);let n=s.raycastWithClones(r);if(n.length!==0){if(this.gameControl){let a=IEt.copy(this.gameControl.colliderWorldPosition);a.y-=this.gameControl.colliderHeight/2,this.gameControl.path=this.computePath(a,n[0].point)}this.eventContext.requestRender()}},this.traverseWithPhysics=(i,r)=>s=>{let n;if(s instanceof lm){if(!s.objectForSample)return s.object.dataPatched.physics.fusedBody===!0&&s.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(s.objectForSample.dataPatched.physics.fusedBody)return;n=s.object}else if(s instanceof bl)n=s.object;else if(n=s,n.dataPatched.cloner?.disabled===!1&&n.dataPatched.cloner?.hideBase&&n.dataPatched.physics?.fusedBody!==!0)return!0;if(r&&!n.userData.navmesh)return;let a=n.dataPatched;if(!a.visible&&a.physics?.enabled!==!0)return!0;s.updateMatrixWorldRigid();let o=H4(a),l=n.userData.hasDestroy,u=n.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 s&&s.geometry&&i.push(ac(s.geometry,s.matrixWorld)),this.usePhysics&&a.physics?.fusedBody)return s.traverseObject((c,p)=>{if(p===0)return;let m;if(c instanceof lm){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;m=c.object}else if(c instanceof bl)m=c.object;else if(m=c,c.dataPatched.cloner?.hideBase)return!0;let f=m.dataPatched;if(!f.visible&&f.physics?.enabled!==!0)return!0;"geometry"in c&&c.geometry&&i.push(ac(c.geometry,c.matrixWorld))}),!0},this.traverseNoPhysics=(i,r)=>s=>{let n;if(s instanceof lm)return;n=s instanceof bl?s.object:s;let a=n.dataPatched;if(a.physics.enabled==="visibility"?!a.visible:!a.physics.enabled)return!0;if(r&&!n.userData.navmesh)return;let o=s.geometry,l=n.userData.hasDestroy===!0,u=n.userData.hasDrag===!0;if(H4(a)||l||u||n.dataPatched.events.some(h=>h.data.disabled!==!0&&h.data.type==="GameControl"))return!0;o&&i.push(ac(o,s.matrixWorld))},this.navmeshWasm=ubt,this.navMesh=new this.navmeshWasm.NavMesh,this._workerURL=URL.createObjectURL(new Blob([(e?DEt(hbt??"https://cdn.spline.design/@splinetool/runtime@2.0.32/build/"):`
5094
5094
  (async function() {
5095
5095
  const [wasmImport, wasmBinary] = await Promise.all([
5096
5096
  import(self.location.origin + '/_libraries/navmesh.js'),
@@ -5165,7 +5165,7 @@ onmessage = function(messageEvent) {
5165
5165
  [${hR}] { pointer-events: none; }
5166
5166
  [${hR}] > * { pointer-events: auto; }
5167
5167
  [${hR}] [data-spline-passthrough] { pointer-events: none; }
5168
- `,Vbt=class{constructor(t,e,i,r,s){this.container=t,this.host=e,this.observer=i,this.previousSplineGlobal=r,this.removeLateLifecycleShim=s}static mount(t,e,i,r){if(typeof document>"u")return null;let s=e.parentElement;if(!s)return null;getComputedStyle(s).position==="static"&&(s.style.position="relative");let n=document.createElement("div");n.setAttribute(hR,"");let a=n.style;a.position="absolute",a.overflow="hidden";let o=()=>{a.left=`${e.offsetLeft}px`,a.top=`${e.offsetTop}px`,a.width=`${e.offsetWidth}px`,a.height=`${e.offsetHeight}px`};o();let l=new ResizeObserver(o);l.observe(e),l.observe(s);let u=document.createElement("style");u.textContent=l4t,n.appendChild(u);let h=new DOMParser().parseFromString(i,"text/html"),d=Array.from(h.querySelectorAll("script"));for(let v of d)v.remove();for(let v of Array.from(h.head.children))(v.tagName==="STYLE"||v.tagName==="LINK"&&v.rel==="stylesheet")&&n.appendChild(v);for(;h.body.firstChild;)n.appendChild(h.body.firstChild);s.insertBefore(n,e.nextSibling);let c=new Map,p=new m7(Ibt(t,e,r),(v,b)=>{v==="warn"?console.warn(`[spline html] ${b}`):v==="error"&&console.error(`[spline html] ${b}`)},(v,b)=>{let _=c.get(v);if(_)for(let x of _)try{x(b)}catch(S){console.error(S)}}),m=(v,b)=>{try{return Promise.resolve(p.execute(v,b))}catch(_){return Promise.reject(_)}},f={ready:Promise.resolve(),setVariable:(v,b)=>m("setVariable",[v,b]),setVariables:v=>m("setVariables",[v]),getVariable:v=>m("getVariable",[v]),getVariables:()=>m("getVariables",[]),getAllObjects:()=>m("getAllObjects",[]),findObjectByName:v=>m("findObjectByName",[v]),findObjectById:v=>m("findObjectById",[v]),getGeometry:(v,b)=>m("getGeometry",[v,b??{}]),updateObject:(v,b)=>m("updateObject",[v,b]),createObject:(v,b)=>m("createObject",[v,b??{}]),createCustomMaterial:v=>m("createCustomMaterial",[v]),setMaterial:(v,b)=>m("setMaterial",[v,b]),cloneObject:(v,b)=>m("cloneObject",[v,b??{}]),removeObject:v=>m("removeObject",[v]),spawnObject:(v,b)=>m("spawnObject",[v,b??{}]),destroyObject:v=>m("destroyObject",[v]),setInstanceTransforms:(v,b)=>m("setInstanceTransforms",[v,b??null]),emitEvent:(v,b)=>m("emitEvent",[v,b]),emitEventReverse:(v,b)=>m("emitEventReverse",[v,b]),requestRender:()=>m("requestRender",[]),addEventListener:(v,b)=>{if(typeof b!="function")return;let _=c.get(v);_||(_=new Set,c.set(v,_),m("listenEvent",[v])),_.add(b)},removeEventListener:(v,b)=>{let _=c.get(v);!_||(_.delete(b),_.size===0&&(c.delete(v),m("unlistenEvent",[v])))}},g=window.spline;window.spline=f;let y=function(){if(typeof document>"u"||document.readyState==="loading")return()=>{};let v=[],b=(x,S)=>{let w=new Set,M=x.addEventListener.bind(x),T=x.removeEventListener.bind(x);Object.defineProperty(x,"addEventListener",{configurable:!0,writable:!0,value:(A,C,R)=>{if(M(A,C,R),!S.includes(A)||C==null)return;let O={type:A,listener:C};w.add(O),queueMicrotask(()=>{!w.delete(O)||((D,B,k)=>{let j=new Event(k);try{typeof B=="function"?B.call(D,j):B.handleEvent?.(j)}catch(z){console.error(z)}})(x,O.listener,O.type)})}}),Object.defineProperty(x,"removeEventListener",{configurable:!0,writable:!0,value:(A,C,R)=>{T(A,C,R);for(let O of w)O.type===A&&O.listener===C&&w.delete(O)}}),v.push(()=>{delete x.addEventListener,delete x.removeEventListener,w.clear()})};b(document,["DOMContentLoaded"]),b(window,["load"]);let _=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(S){console.error(S)}})}}),v.push(()=>{_?Object.defineProperty(window,"onload",_):delete window.onload}),()=>{for(let x of v)x()}}();for(let v of d){let b=document.createElement("script");for(let _ of Array.from(v.attributes))b.setAttribute(_.name,_.value);v.src?b.async=!1:b.textContent=v.textContent,n.appendChild(b)}return new Vbt(n,p,l,g,y)}dispose(){this.removeLateLifecycleShim(),this.host.dispose(),this.observer.disconnect(),this.container.remove(),window.spline!==void 0&&(window.spline=this.previousSplineGlobal)}};function kbt(t){return typeof t=="object"&&t!==null&&t.isMaterial===!0}function ddt(t){if(typeof t.material=="function")throw new Error("createObject: a (three) => material factory must be resolved to a material instance before object creation \u2014 this entry point does not support it.");if(!kbt(t.material))return{options:t};let e=t.material;if(e.isNodeMaterial===!0){let i=_U()?.NodeMaterial;if(i!==void 0&&e instanceof i)return{options:{...t,material:void 0},material:e};throw new Error("createObject: this TSL NodeMaterial comes from your own three/webgpu module instance, which cannot compile in the runtime's bundled three. Build it with app.createCustomMaterial((three) => \u2026) instead, or use a built-in material (MeshStandardMaterial, MeshBasicMaterial, \u2026).")}if(e.isShaderMaterial===!0)throw new Error("createObject: a GLSL ShaderMaterial cannot compile on the WebGPU backend \u2014 port the shader to TSL with app.createCustomMaterial((three) => \u2026), or use a built-in material (MeshStandardMaterial, \u2026).");return{options:{...t,material:void 0},material:e}}Le(),Fi(),yt(),Eft(),Pc(),Fi(),Le(),PTt(),_m();var h4t=new Set(["name","parent","position","rotation","scale","visible","castShadow","receiveShadow","color","material"]),cdt="'Cube', 'Sphere', 'Plane', 'Rectangle', 'Ellipse', 'Triangle', 'Polygon', 'Star', 'Cone', 'Cylinder', 'Pyramid', 'Torus', 'TorusKnot', 'Dodecahedron', 'Icosahedron', 'Helix', 'Backdrop', 'Lathe', 'Text', 'CustomMesh', 'Group', 'PointLight', 'SpotLight', 'DirectionalLight'",u4t={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"},d4t={group:"Empty",empty:"Empty",pointlight:"PointLight",spotlight:"SpotLight",directionallight:"DirectionalLight"},c4t={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')."},p4t={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"},m4t={Empty:"Group",PointLight:"Point Light",SpotLight:"Spot Light",DirectionalLight:"Directional Light"};function NS(t,e){return t===void 0?[e[0],e[1],e[2]]:Array.isArray(t)?[t[0]??e[0],t[1]??e[1],t[2]??e[2]]:[t.x??e[0],t.y??e[1],t.z??e[2]]}function zbt(t){return typeof t=="number"?[t,t,t]:NS(t,[1,1,1])}function Q9(t){let e=new Dr(0,0,0,1);return e.setStyle(t),{r:e.r,g:e.g,b:e.b}}function pdt(t,e){let i=t.material??(t.color!==void 0?{color:t.color}:void 0);if(i===void 0)return ds.defaultColorMaterial(mdt(Xg),"physical","layer1","layer2");if(typeof i=="string"){for(let[a,o]of Object.entries(e.shared.materials))if(a===i||o.name===i)return a;if(function(a){let o=a.trim().toLowerCase();return/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(o)||/^(rgb|hsl)a?\(/.test(o)||oe.NAMES[o]!==void 0}(i))return ds.defaultColorMaterial(Q9(i),"physical","layer1","layer2");throw new Error(`createObject: material '${i}' matches no shared material in this document (available: ${function(a){let o=Object.entries(a.shared.materials).map(([,l])=>`'${l.name}'`).filter(l=>l!=="'undefined'");return o.length?o.join(", "):"(none)"}(e)}) and is not a valid CSS color.`)}if(typeof i=="function")throw new Error("createObject: a (three) => material factory must be resolved to a material instance before object creation \u2014 this entry point does not support it.");if(kbt(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?Q9(i.color):mdt(Xg),s=ds.defaultColorMaterial(r,"physical","layer1","layer2"),n=s.layers.find(a=>a.data.type==="light");if(n){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(n.data,a)}if(i.alpha!==void 0){let a=s.layers.find(o=>o.data.type==="color");a&&Object.assign(a.data,{alpha:i.alpha})}return s}function mdt(t){return{r:(t>>16&255)/255,g:(t>>8&255)/255,b:(255&t)/255}}function f4t(t){let e=lc.defaultData("TextGeometry"),{text:i,...r}=t,s=r.fontSize;return s!==void 0&&r.width===void 0&&(r.width=350*s/16),s!==void 0&&r.height===void 0&&(r.height=50*s/16),Object.assign(e,r),i!==void 0&&Object.assign(e,{text:{textValue:String(i)}}),e}function GE(t){return Array.isArray(t)?t:!ArrayBuffer.isView(t)||t instanceof DataView?null:Array.from(t)}function g4t(t,e){return mmt({userData:{type:t,...vU[t].normalizeInputs({parameters:e})}})}function y4t(t,e,i){let{objectType:r,geometryType:s}=t,n=function(l){let u={};for(let[h,d]of Object.entries(l))!h4t.has(h)&&d!==void 0&&(u[h]=d);return u}(e),a={states:new fe,events:new fe};if(r==="Mesh"&&s){if(s==="NonParametricGeometry"){let{geometry:l,doubleSide:u}=function(h){let d=GE(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=GE(h.indices);if(p&&p.length){let b=p.find(_=>!Number.isInteger(_)||_<0||_>=c);if(b!==void 0)throw new Error(`createObject('CustomMesh'): index ${b} is out of range (mesh has ${c} vertices).`)}else p=null;let m=new ye;m.setAttribute("position",new me(d,3));let f=GE(h.normals),g=f!==null&&f.length===d.length;g&&m.setAttribute("normal",new me(f,3));let y=GE(h.uvs);y&&y.length===2*c&&m.setAttribute("uv",new me(y,2));let v=!1;if(!g){let b=p??Array.from({length:c},(S,w)=>w),{closed:_,inverted:x}=function(S,w){let M=S.length/3,T=new Map,A=new Array(M);for(let D=0;D<M;D++){let B=`${Math.round(1e4*S[3*D])},${Math.round(1e4*S[3*D+1])},${Math.round(1e4*S[3*D+2])}`,k=T.get(B);k===void 0?(T.set(B,D),A[D]=D):A[D]=k}let C=new Map;for(let D=0;D+2<w.length;D+=3){let B=A[w[D]],k=A[w[D+1]],j=A[w[D+2]];for(let[z,V]of[[B,k],[k,j],[j,B]]){if(z===V)continue;let H=z<V?z+"_"+V:V+"_"+z;C.set(H,(C.get(H)??0)+1)}}let R=C.size>0;for(let D of C.values())if(D!==2){R=!1;break}if(!R)return{closed:!1,inverted:!1};let O=0;for(let D=0;D+2<w.length;D+=3){let B=3*w[D],k=3*w[D+1],j=3*w[D+2],z=S[B],V=S[B+1],H=S[B+2],U=S[k],et=S[k+1],at=S[k+2],Q=S[j],ut=S[j+1],ht=S[j+2];O+=z*(et*ht-at*ut)+V*(at*Q-U*ht)+H*(U*ut-et*Q)}return{closed:!0,inverted:O<0}}(d,b);if(_&&x){for(let S=0;S+2<b.length;S+=3){let w=b[S+1];b[S+1]=b[S+2],b[S+2]=w}p=b}else _||(v=!0)}return p&&m.setIndex(p),g||m.computeVertexNormals(),{geometry:mmt({userData:{type:"NonParametricGeometry",parameters:{subdivisions:0}},data:m.toJSON().data}),doubleSide:v}}(n);Object.assign(a,Bu.defaultData,{geometry:l,materials:[pdt(e,i)]}),u&&(a.side=2)}else Object.assign(a,Bu.defaultData,{geometry:s==="TextGeometry"?f4t(n):g4t(s,n),material:pdt(e,i)});e.castShadow!==void 0&&(a.castShadow=e.castShadow),e.receiveShadow!==void 0&&(a.receiveShadow=e.receiveShadow)}else r==="Empty"?Object.assign(a,qR.defaultData):(Object.assign(a,HR.defaultData(r),n),e.color!==void 0&&(a.color=Q9(e.color)));a.visible=e.visible??!0,a.position=NS(e.position,[0,0,0]),a.rotation=NS(e.rotation,[0,0,0]),a.scale=zbt(e.scale);let o=(s&&p4t[s])??m4t[r]??r;return a.name=e.name??Lbt(o,i.scene.objects),a}function Lbt(t,e){let i=new Set;if(e.traverse((s,n)=>{i.add(n.name??"")}),!i.has(t))return t;let r=2;for(;i.has(`${t} ${r}`);)r++;return`${t} ${r}`}function Fbt(t,e){let i=Yt.generateUUID();if(t.data.type==="Component")return{data:{...yc.fromComponentData(t),name:t.data.name+" Instance"},id:i,fi:t.fi,children:[]};e[t.id]=i;let r=t.data;return r.type==="Empty"&&r.animations?.length&&(r={...r,animations:r.animations.map(([s,n,a])=>{let o=Yt.generateUUID(),l=a.indexOf(s);return[o,n,l!==-1?a.slice(0,l)+o+a.slice(l+s.length):a]})}),{...t,id:i,data:r,children:t.children.map(s=>Fbt(s,e))}}function v4t(t){let e={};return function(i,r){return nv(i,r,null)??i}(Fbt(t,e),e)}function b4t(t){let e=Array.isArray(t)?t[0]:t,i=e.layers?.map(_4t)??[],r=e.layers?.find(s=>s.type==="light");return{layers:i,alpha:r?.node.alphaOverride?.value??1}}function _4t(t){return t.type==="texture"||t.type==="video"||t.type==="matcap"?{...t.data,updateTexture:e=>t.color.texture.image.updateSrc(e)}:{...t.data}}_m(),ss(),H7(),Pc();var _w=new Dr(0,0,0,1),x4t={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:[]};Le(),Le();var w4t=new Z;function fdt(t){let e=new Dr(0,0,0,1);try{e.setStyle(t)}catch(i){console.error(i)}return e}var Ubt=class{constructor(t,{renderOnDemand:e,renderMode:i="auto",wasmPath:r,renderer:s,htmlContentMode:n="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<gmt?this._skipRender=!1:this.currentTAAFrame=0):this.currentTAAFrame=0,this._scene?.traverseVisibleEntity(o=>{o.type==="ParticleSystem"&&(o.update(this.dt),this._skipRender=!1),Zg(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=w4t.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=pS(this._resize,10),this._onScroll=a=>{this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect())},this.canvas=t,this._htmlContentMode=n,this.renderMode=e?"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=s??"webgl",s===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(()=>(f3t(),iyt)).then(({Perfs:a})=>{this._perfs=new a({x:10,y:10})}),function(a){a.addEventListener("pointerdown",HH,!0),a.addEventListener("pointerdown",KT,!0),a.addEventListener("pointermove",KT,!0),a.addEventListener("pointerup",D0,!0),a.addEventListener("pointercancel",D0,!0),a.addEventListener("pointerleave",D0,!0),window.addEventListener("keydown",$H,!0),window.addEventListener("keyup",XH,!0)}(t)}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:t,isWebGPUSupported:e}=await Promise.resolve().then(()=>(SL(),rR));e();let i=!0,r=!1,s=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"?s=!1:(l==="on"||l==="1"||l==="true"||l==="always")&&(s=!0)}catch{}let n=await t({canvas:this.canvas,antialias:!1,alpha:!0,powerPreference:"high-performance",sceneBundles:!r&&i,forceWebGL:r,asyncCompilation:!r&&s});return n.onBackgroundWorkReady=()=>{this._skipRender=!1,this._renderRequested=!0},n.skyAnimationAllowed=!0,n}catch(t){console.error("[spline] Failed to initialize the WebGPU renderer, falling back to WebGL:",t),this._rendererBackend="webgl"}throw this._failWebGPURequired(),new Error("[spline] This runtime build is WebGPU-only and the browser provides no WebGPU adapter.")}_failWebGPURequired(){console.error('[spline] This scene was exported for WebGPU only and this browser does not provide a WebGPU adapter. Re-export with renderer "Both" or "WebGL 2" to support this browser.');try{let t=window.devicePixelRatio||1,e=this.canvas.clientWidth||300,i=this.canvas.clientHeight||150;this.canvas.width=e*t,this.canvas.height=i*t;let r=this.canvas.getContext("2d");r&&(r.scale(t,t),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.",e/2,i/2))}catch{}this.canvas.dispatchEvent(new CustomEvent("splineerror",{bubbles:!0,detail:{reason:"webgpu-required"}}))}async load(t,e,i){(function(s){let n="The Spline Runtime only accepts .splinecode files that are generated from Spline export panel.";s.endsWith(".spline")?console.warn(n+" The .spline files are only meant to be used by the Editor."):s.endsWith(".splinecode")||console.warn(n)})(t),this.disposed=!1;let r=await(await fetch(t,i)).arrayBuffer();await this.start(r,{variables:e})}async start(t,{interactive:e=!0,variables:i}={}){if(this.disposed)return;ia.init();let r=await async function(c){let[p,m]=Bw(mS.deserialize(new Uint8Array(c)));if((p.schema??0)!==131){let{updateDocumentSchema:f}=await Promise.resolve().then(()=>(l5(),omt));f(p)}return m.result().data}(t);this._data=r;let s=function(c){let p=[];return c.scene.objects.traverse((m,f)=>{f.type==="Mesh"&&f.geometry.type==="NonParametricGeometry"&&f.geometry.data.draco!==void 0&&p.push(f)}),p}(r);r.version&&(0,a4t.default)(r.version,"2.0.30")>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){WU=c}(this._wasmPath));let n=async function(){}();await Promise.all([n,s.length&&ldt(this._wasmPath),YY(r)&&BTt(this._wasmPath),EMt(r)&&cMt(this._wasmPath),Kg.physicsEnabled(r.scene.objects)&&fEt(this._wasmPath),iY(r)&&qht(),gK(r)&&KMt(),qTt(r)&&WTt(),kht(r)&&n.then(()=>$8()?.loadHanaUIRUNTIME()),lEt(r)&&NEt(this._wasmPath)].filter(Boolean)),s.length&&await hdt(s),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((m,f)=>{if(f.type!=="Page")return;let g=f.postprocessing;if(g&&typeof g=="object"&&g.enabled===!0)for(let[y,v]of Object.entries(g))y!=="enabled"&&v&&typeof v=="object"&&v.enabled===!0&&p.add(y)}),[...p]}(r);if(this._rendererBackend==="webgpu")try{await Promise.all([Promise.resolve().then(()=>(SL(),rR)),n4t(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"}if(this._rendererBackend!=="webgpu")return void this._failWebGPURequired();(function(c){LS=c})(this._rendererBackend==="webgpu"?"webgpu":"webgl");let l=new t4t(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(()=>(qAt(),xvt)),p=performance.now();c(r,l.scene);let m=performance.now();console.log("Merged geometries in ",m-p," ms")}YY(r)&&this._scene.traverse(c=>{$u(c)&&c.recomputeBoolean()}),this._sharedAssetsManager.setRequestRender(()=>{this._requestRenderAutoMode(),this._scene?.traverse(c=>{$1(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()),Zg(c)&&c.setPlayMode(!0)});let u=Object.keys(r.shared.fonts).map(c=>this._sharedAssetsManager.getFont(c).loadingPromise);if(Promise.all(u).then(()=>{this.disposed||(l.scene.markNeedsUpdateRendererDirty(),this._requestRenderAutoMode())}),iY(r)&&function(c){if(Kg.physicsEnabled(c.scene.objects))return!0;let p=!1;return c.scene.objects.traverse((m,f)=>{if(f.events){if(Array.isArray(f.events)){for(let g of f.events)if(g.data.disabled!==!0&&g.data.type==="GameControl"&&g.data.collisionEnabled){p=!0;break}}else for(let g of Object.values(f.events))if(g.disabled!==!0&&g.type==="GameControl"&&g.collisionEnabled){p=!0;break}}}),p}(r)&&await Promise.all(u),kht(r)){let c=[];this._scene.traverseEntity(p=>{(Ka(p)||p instanceof qs)&&p.uiCanvas&&c.push(p.uiCanvas)}),await Promise.all(c.map(p=>p.promise))}if(this._scene.rewriteEventsBeforeGoToPlayMode(),yW(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 m=this._sharedAssetsManager.getImage("SplineWatermark");await m.loadPromise;let f=m.getTexture(1001);this._renderer.pipeline.setWatermark(f)}}gK(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 ACt(this._renderer,this._camera,new Z(this._viewportWidth,this._viewportHeight)),this._frameView.enableResponsive=(h.allowResponsive??!1)&&h.preset==="fullscreen"),e){let c=new nCt(this._renderer,this.data.scene.publish,this._scene,()=>this._scene.activeCamera,this._sharedAssetsManager,this._requestRenderAutoMode,!0,h);this._scene.updateMatrixWorld(!0),this._controls=new bEt(c),this._animationControls=new r4t(this._scene,this._requestRenderAutoMode),this._eventManager=new _Ct(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(e&&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"?Vbt.mount(this,this.canvas,d,c):Bbt.mount(this,this.canvas,d,c))??void 0}}setVariables(t){if(this._data!==void 0){let e=Object.entries(t);for(let[i,r]of e)this.setVariable(i,r)}}setVariable(t,e){let i=this._getVariableByName(t);if(i&&!("dynamicVariableType"in i.data)){let r=e;typeof i.data.value=="number"?r=typeof e=="number"?e:typeof e=="boolean"?e===!0?1:0:parseFloat(e):typeof i.data.value=="boolean"?r=typeof e=="number"?!!e:typeof e=="boolean"?e:e.toLocaleLowerCase()!=="false"&&!!e:typeof i.data.value!="string"&&i.data.value.textValue!==void 0&&(r=e.toString());let s=typeof r=="string"?{textValue:r}:r;this._sharedAssetsManager?.updateVariable(i.id,s),this.requestRender(),this._requestRenderAutoMode()}else i===void 0?console.warn(`No variable named ${t} was found in your Spline file. Make sure to create it from Spline editor.`):"dynamicVariableType"in i.data&&console.warn(`Dynamic variables like ${t} cannot be updated from code.`)}getVariables(){let t={};return this._data&&this._data.shared.variables.forEach(e=>{t[e.data.name]===void 0&&(t[e.data.name]=this._getVariableValue(this._sharedAssetsManager.getVariable(e.id)))}),t}getVariable(t){let e=this._getVariableByName(t);if(e){let i=this._sharedAssetsManager.getVariable(e.id);return this._getVariableValue(i)}}_getVariableValue(t){return typeof t!="string"&&Da.isTextValue(t)?Da.getDisplayedValue(t):t}_getVariableByName(t){if(this._data){if(this._variablesCache.has(t))return this._variablesCache.get(t);let e=this._data.shared.variables.find(i=>i.data.name===t);return e&&this._variablesCache.set(t,e),e}}_getPixelRatio(t){switch(t){case 0:return window.devicePixelRatio;case 1:return 1;case 2:return 2}}findObjectById(t){let e=this._scene?.getObjectByProperty("uuid",t);return this._createProxyObject(e)}findObjectByName(t){let e=this._scene?.getObjectByName(t);return this._createProxyObject(e)}getAllObjects(){let t=[];return this._scene?.traverseEntity(e=>{if(!(e.uuid===i0||this._scene.isInvisibleObjects(e)||e instanceof qs)){let i=this._createProxyObject(e);i&&t.push(i)}}),t}getSplineEvents(){return(this._eventManager?.handlers?.Spline).splineEvents}emitEvent(t,e){(this.findObjectById(e)||this.findObjectByName(e))?.emitEvent(t)}emitEventReverse(t,e){(this.findObjectById(e)||this.findObjectByName(e))?.emitEventReverse(t)}addEventListener(t,e){this.canvas.addEventListener(t,e)}removeEventListener(t,e){this.canvas.removeEventListener(t,e)}setZoom(t){this._controls?.orbitControls instanceof kvt&&this._controls?.orbitControls.setZoom(t)}get eventManager(){return this._eventManager}get controls(){return this._controls}setSize(t,e){this._viewportWidth=t,this._viewportHeight=e,this._viewportMode=2,this._resize()}setBackgroundColor(t){let e=fdt(t);this._scene?.activePage.setBackgroundColor(e),this._requestRenderAutoMode()}dispose(){this.disposed=!0,this._htmlContentOverlay?.dispose(),this._htmlContentOverlay=void 0,this._eventManager?.dispose(),this._scene?.dispose(),this._scene=void 0,this._camera=void 0,L2&&L2.disposeAll(),this._sharedAssetsManager?.setRequestRender(()=>{}),this._sharedAssetsManager?.dispose(),this._sharedAssetsManager=void 0,this._proxyObjectCache.forEach(t=>{TL.unsubscribe(t)}),this._proxyObjectCache.clear(),this._variablesCache.clear(),this._renderer?.pipeline.removeEventListener("smaaloaded",this._requestRenderAutoMode),this._renderer?.setAnimationLoop(null),this._renderer?.dispose(),this._renderer=void 0,this._debouncedResize.cancel(),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=void 0),this._resizeObserverTimeout!==void 0&&(clearTimeout(this._resizeObserverTimeout),this._resizeObserverTimeout=void 0),this.canvas.style.width="",this.canvas.style.height="",this.canvas.removeAttribute("width"),this.canvas.removeAttribute("height"),this._frameView=void 0,this._controls?.deactivate(),this._controls=void 0,this._animationControls=void 0,this._eventManager?.eventContext.dispose(),this._eventManager=void 0,this._splatViewer=void 0,this._data=void 0,this._perfs=void 0,this.dt=0,this._lastTime=void 0,function(t){t.removeEventListener("pointerdown",HH,!0),t.removeEventListener("pointerdown",KT,!0),t.removeEventListener("pointermove",KT,!0),t.removeEventListener("pointerup",D0,!0),t.removeEventListener("pointercancel",D0,!0),t.removeEventListener("pointerleave",D0,!0),window.removeEventListener("keydown",$H,!0),window.removeEventListener("keyup",XH,!0)}(this.canvas),document.removeEventListener("scroll",this._onScroll),ia.dispose()}get isStopped(){return this._isPaused}stop(){this._isPaused||(this._renderer?.setAnimationLoop(null),this._isPaused=!0,this._eventManager?.pause(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!1))}play(){!this._isPaused||(this._isPaused=!1,this._eventManager?.resume(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!0),this._renderer?.setAnimationLoop(this.render))}setGlobalEvents(t){this._eventManager?.updateUseWindowEvents(t)}get data(){return this._data}_createProxyObject(t){if(!this._scene)return;let e,i=this._scene;if(t==null)return;if(this._proxyObjectCache.has(t.uuid))return this._proxyObjectCache.get(t.uuid);t.traverseAncestors(h=>{h instanceof qs&&(e=h.name)});let r=this._sharedAssetsManager,s={shared:r,scene:this._scene},n=h=>{if(h===null||h==="Base State")return null;if(h&&t.data.states){let d=t.data.states.find(c=>c.data.name===h);return d?d.id:void 0}},a="material"in t?t.material:void 0,o=t.materialOverride,l={name:t.name,uuid:t.uuid,visible:t.visible,intensity:t.intensity,position:t.position,rotation:t.rotation,scale:t.scale,type:t.data.type,page:e,material:o??(a?b4t(a):void 0),parentUuid:t.parent instanceof qs||t instanceof Pg?void 0:t.parent?.uuid,emitEvent(h){t.dispatchEvent({type:"userEvent",eventName:h})},emitEventReverse(h){t.dispatchEvent({type:"userEvent",eventName:h,reverse:!0})},hide(){t.visible&&(t.visible=!1,s.shared.requestRender())},show(){t.visible||(t.visible=!0,s.shared.requestRender())},get state(){let h=t.stateSelection;if(h!==null)return t.data.states.find(({id:d})=>d===h)?.data.name},set state(h){let d;if(h!==void 0){let c=typeof h=="string"?t.data.states.find(({id:p})=>p===h):t.data.states[h];if(c)d=c.id;else{let p=typeof h=="string"?n(h):void 0;p&&(d=p)}}t.changeSelectedState(d??null,s),t.currentState=d??null,t.dispatchEvent({type:"completeState",state:d??null}),s.shared.requestRender()},transition(h){let d=Obt;if(d===null)return Pn("transitions","obj.transition()"),{transition(_){return this},play(){return this},pause(){return this},reset(){return this},seek(_){return this}};let c,p,m=this,f=[],g=!1,y=()=>{p=new Mbt({delay:0,delayDirection:"start-once",direction:"normal",repeat:0,runMode:"Repeat"},f.map(_=>_.runner))},v={update(_){p?.update(_),p?.isPlaying!==!0&&ia.remove(v)}},b={transition({from:_,to:x,duration:S,delay:w,...M}){let T=n(_);T===void 0&&(T=c);let A=n(x);return c=A,f.push(new d(t,T,A,{state:A,repeat:0,delay:w??0,delayDirection:"start-once",direction:"normal",duration:S??1e3,...M,...M.easing===6?Yp.defaultData:M.easing===5?Dv.defaultData:{}},r,!1,i.activePage,{onBegin:()=>{(_&&T||_==="Base State"&&!T)&&(m.state=T??void 0)},onComplete:()=>{m.state=A??void 0}})),y(),this},play(){return p?(g=!0,p.play(ia.time),p.isPlaying&&ia.add(v),this):this},pause(){return p?.stop(),ia.remove(v),this},reset(){return this.pause(),g=!1,y(),p?.seek(0),this},seek(_){let x=f.reduce((S,w)=>S+w.runner.duration,0);return x>0&&p?.seek(_/1e3/x),this}};return b.transition(h),(h.autoPlay??!0)&&queueMicrotask(()=>{g||b.play()}),b},set color(h){let d=fdt(h);if(d4.is(t))return void(t.color=d);if(!(t.type==="Mesh"&&"material"in t&&t instanceof yo))return;let c={r:d.r,g:d.g,b:d.b,a:d.a},p=t.materialOverride;if(p!==void 0){let g=p.color;return void(g?.isColor===!0&&typeof g.setStyle=="function"&&(g.setStyle(h),s.shared.requestRender()))}let m=Array.isArray(t.material)?t.material[0]:t.material,f=m.data.layers.find(g=>g.data.type==="color")?.id;if(f)m.updateByOp({type:0,path:["layers",f],props:{color:{...c}}},m.data,s);else{let g=m.data,y=g.layers.find(w=>w.data.type==="light");if(!y)return;let v=g.layers.indexOf(y)===0?y:null,b=g.layers.at(v?g.layers.indexOf(v)+1:0),_={type:4,fi:v?v.fi+(b?(b.fi-v.fi)/2:1):b?b.fi/2:1,id:Yt.generateUUID(),data:{...Gs.defaultData("color"),color:c},localIndex:0},x=g.layers.insertAfterHelper(v?.id??null,1),S=g.layers.runOp({..._,fi:x[0]}).data;Object.assign(m.data,{layers:S}),m.updateByOp({..._,path:["layers"]},m.data,s)}}},u=TL(l,(h,d)=>{let c=t[h],p=function(m){return m.split(".")}(h);p[0]==="material"&&a&&o===void 0&&function(m,f,g){let y=Array.isArray(g)?g[0]:g;if(m[0]==="layers"){let v=parseInt(m[1]),b=y.layers[v],_=m[2];b&&_&&function(x,S,w){let M=x[0];try{if(function(T,A){return!!x4t[A]?.includes(T)}(M,w.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]),A=w.getValue(M)?.[T];if(!A)throw new Error("Color index out of range");_w.setStyle(S),A.set(_w.r,_w.g,_w.b,_w.a)}else w.getValue(M)?.setStyle(S);else if(M==="texture"||M==="video"){let T=w.color;(function(A,C,R,O){let D=A[0];if(D==="repeat"||D==="offset"||D==="rotation"){let B=O.getNode("mat"),k=B&&typeof B.updateMatrix=="function"?B:O.getValue("mat");if(!k)return;if(D==="rotation")k.rotation=parseFloat(C);else{let j=A[1];if(j===void 0)C instanceof Array&&C.length===2&&Object.assign(k,{[D]:C});else{let z=k[D],V=parseInt(j)===0?[parseFloat(C),z[1]]:[z[0],parseFloat(C)];Object.assign(k,{[D]:V})}}k.updateMatrix()}else D==="wrapping"||D==="minFilter"||D==="magFilter"?D==="wrapping"?R.texture.wrap=C:R.texture[D]=C:D==="image"&&A[1]==="data"&&R.texture.image.updateSrc(C)})(x.slice(1),S,T,w)}else{let T=x[1],A=w.getValue(M);A?.isVector3&&T!==void 0||A?.isVector2&&T!==void 0?A.setComponent(parseInt(T),S):w.setValue(M,S)}}catch(T){console.error("Error setting material value",T)}}(m.slice(2),f,b)}else m[0]==="alpha"&&y.layers.forEach(v=>{v.type==="light"&&v.node.alphaOverride!==void 0&&(v.node.alphaOverride.value=f,f<1&&(y.transparent=!0))})}(p.slice(1),d,a),typeof c!="object"&&Object.getOwnPropertyDescriptor(t,h)?.writable&&(t[h]=d),this._requestRenderAutoMode(),t.updateMatrix()});return this._proxyObjectCache.set(t.uuid,u),u}setUIWasmUrl(t){(function(e){t4=e,d5?.setHanaUIWasmUrl(e)})(t)}pauseGameControls(){this._eventManager?.controlsManager.gameControl?.pause()}resumeGameControls(){this._eventManager?.controlsManager.gameControl?.resume()}async swapGeometry(t,e){let i;if(typeof e=="string"){if(!e.endsWith(".splinegeometry"))throw new Error("Only .splinegeometry format is supported");{let l=await(await fetch(e)).arrayBuffer();i=new Uint8Array(l)}}else i=e;let r=mS.deserialize(i),s="data"in r&&r.data.draco!==void 0;s&&await ldt(this._wasmPath);let n=this._scene?.getObjectByProperty("uuid",t)??this._scene?.getObjectByName(t);if(!n)return void console.warn(`Object ${t} not found`);if(n.data.type!=="Mesh"||!(n instanceof yo))return void console.warn(`Object ${t} is not a mesh`);let a=n,o={...a.data,geometry:r};s&&await hdt([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]=Zp.patch(o,u)}return i}_applyDocumentTransaction(t){this._data=t.data,this._scene&&(this._scene.data=this._data.scene),this._sharedAssetsManager&&(this._sharedAssetsManager.data=this._data.shared);for(let e of t.actual){let i=e.path;Array.isArray(i)&&i.length===2&&i[0]==="scene"&&i[1]==="objects"&&this._scene?.updateTreeByOp({...e,path:[]},this._sharedAssetsManager)}}_findEntity(t){return this._scene?.getObjectByProperty("uuid",t)??this._scene?.getObjectByName(t)}_resolveParentId(t){if(t===void 0)return this._scene.activePage.uuid;let e=typeof t=="string"?t:t.uuid,i=this._findEntity(e);if(!i)throw new Error(`parent '${e}' \u2014 no object with that name or uuid in the scene.`);return i.uuid}async createCustomMaterial(t){if(this.disposed)throw new Error("createCustomMaterial: this Application was disposed.");if(typeof t!="function")throw new Error("createCustomMaterial: expected a factory function \u2014 createCustomMaterial((three) => new three.MeshStandardNodeMaterial()).");let e=_U();if(e===void 0&&(this._rendererBackend==="webgpu"&&(await Promise.resolve().then(()=>(SL(),rR)),e=_U()),e===void 0))throw new Error("createCustomMaterial: requires the webgpu backend (the runtime default where WebGPU is available). This Application is on the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } or drop any ?renderer=webgl2 override.");let i=t(e);if(typeof i!="object"||i===null||i.isMaterial!==!0)throw new Error("createCustomMaterial: the factory must return a three.js material built from the namespace it receives \u2014 e.g. (three) => new three.MeshStandardNodeMaterial().");return i}async setMaterial(t,e){if(this.disposed)throw new Error("setMaterial: this Application was disposed.");let i=this._scene;if(!i)throw new Error("setMaterial: no scene loaded \u2014 call load() or start() first.");let r=typeof t=="string"?t:t.uuid,s=this._findEntity(r);if(!s)throw new Error(`setMaterial: '${r}' \u2014 no object with that name or uuid in the scene.`);if(!(s instanceof yo))throw new Error(`setMaterial: '${r}' is not a mesh \u2014 lights, groups, and cameras have no material.`);let n=typeof e=="function"?await this.createCustomMaterial(e):e;if(h4()!=="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=ddt({material:n});if(a.material===void 0)throw new Error("setMaterial: expected a three.js material instance or a (three) => material factory.");return s.setMaterialOverride(a.material,{scene:i,shared:this._sharedAssetsManager}),this._proxyObjectCache.delete(s.uuid),this._requestRenderAutoMode(),a.material}async createObject(t,e={}){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 s=function(g){if(typeof g!="string"||g.length===0)throw new Error(`createObject: expected a type name string \u2014 one of ${cdt}.`);let y=g.replace(/Geometry$/i,"").replace(/[\s_-]/g,"").toLowerCase(),v=d4t[y];if(v)return{objectType:v};let b=u4t[y];if(b)return{objectType:"Mesh",geometryType:b};let _=c4t[y];throw _?new Error(`createObject: '${g}' is not supported \u2014 ${_}`):new Error(`createObject: '${g}' is not a creatable Spline type \u2014 use one of ${cdt}, e.g. createObject('Cube', { width: 200 }).`)}(t);typeof e.material=="function"&&(e={...e,material:await this.createCustomMaterial(e.material)});let n,a,{options:o,material:l}=ddt(e);if(l!==void 0){if(s.objectType!=="Mesh")throw new Error("createObject: a three.js material instance only applies to mesh types \u2014 lights and groups have no material.");if(h4()!=="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(s.geometryType==="TextGeometry"){if(!k7.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 qht(),a=e.font??T1,r.shared.fonts[a]===void 0){if(a!==T1){let g=Object.keys(r.shared.fonts).join(", ");throw new Error(`createObject: font '${a}' is not in this document \u2014 available fonts: ${g||"(none)"}.`)}n={name:T1,url:Gpt}}}let u=this._resolveParentId(e.parent),h=y4t(s,o,r),d=Yt.generateUUID(),[c,p]=Bw(r);n&&(c.shared.fonts[T1]=n),c.scene.objects.insertAfter(u,null,[{id:d,data:h,children:[]}]);let m=p.result();if(n&&this._sharedAssetsManager.addFont(T1,n),a!==void 0){let g=this._sharedAssetsManager.getFont(a);g&&await g.loadingPromise}this._applyDocumentTransaction(m);let f=i.find(d);return l!==void 0&&f.setMaterialOverride(l,{scene:i,shared:this._sharedAssetsManager}),this._requestRenderAutoMode(),this._createProxyObject(f)}cloneObject(t,e={}){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 s=typeof t=="string"?t:t?.uuid,n=s?this._findEntity(s):void 0;if(!n)throw new Error(`cloneObject: '${s}' \u2014 no object with that name or uuid in the scene.`);if(n instanceof qs)throw new Error("cloneObject: pages cannot be cloned.");let a=r.scene.objects.get(n.uuid);if(!a)throw new Error(`cloneObject: '${s}' 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,m,f){let g={...p.data};return m.position!==void 0&&(g.position=NS(m.position,[0,0,0])),m.rotation!==void 0&&(g.rotation=NS(m.rotation,[0,0,0])),m.scale!==void 0&&(g.scale=zbt(m.scale)),m.visible!==void 0&&(g.visible=m.visible),g.name=m.name??Lbt(`${p.data.name??"Object"} Copy`,f),{...p,data:g}}(v4t(a),e,r.scene.objects),l=e.parent!==void 0?this._resolveParentId(e.parent):r.scene.objects.parent(n.uuid)??null,u=e.parent!==void 0?null:n.uuid,[h,d]=Bw(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(t){let e=this._scene,i=this._data;if(this.disposed||!e||!i)return!1;let r=typeof t=="string"?t:t?.uuid,s=r?this._findEntity(r):void 0;if(!s)return!1;if(s instanceof qs)throw new Error("removeObject: pages cannot be removed.");if(s.data.type==="PerspectiveCamera"||s.data.type==="OrthographicCamera")throw new Error("removeObject: cameras cannot be removed.");if(i.scene.objects.get(s.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 n=[];s.traverseEntity(l=>{n.push(l.uuid)});let[a,o]=Bw(i);a.scene.objects.delete(s.uuid),this._applyDocumentTransaction(o.result());for(let l of n){let u=this._proxyObjectCache.get(l);u&&(TL.unsubscribe(u),this._proxyObjectCache.delete(l))}return this._requestRenderAutoMode(),!0}};var G5=window,W5=G5.ShadowRoot&&(G5.ShadyCSS===void 0||G5.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,vW=Symbol(),jbt=new WeakMap,YS=class{constructor(e,i,r){if(this._$cssResult$=!0,r!==vW)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=i}get styleSheet(){let e=this.o,i=this.t;if(W5&&e===void 0){let r=i!==void 0&&i.length===1;r&&(e=jbt.get(i)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&jbt.set(i,e))}return e}toString(){return this.cssText}},Gbt=t=>new YS(typeof t=="string"?t:t+"",void 0,vW),bW=(t,...e)=>{let i=t.length===1?t[0]:e.reduce((r,s,n)=>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.")})(s)+t[n+1],t[0]);return new YS(i,t,vW)},_W=(t,e)=>{W5?t.adoptedStyleSheets=e.map(i=>i instanceof CSSStyleSheet?i:i.styleSheet):e.forEach(i=>{let r=document.createElement("style"),s=G5.litNonce;s!==void 0&&r.setAttribute("nonce",s),r.textContent=i.cssText,t.appendChild(r)})},q5=W5?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let i="";for(let r of e.cssRules)i+=r.cssText;return Gbt(i)})(t):t;var xW,H5=window,Wbt=H5.trustedTypes,S4t=Wbt?Wbt.emptyScript:"",qbt=H5.reactiveElementPolyfillSupport,SW={toAttribute(t,e){switch(e){case Boolean:t=t?S4t:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=t!==null;break;case Number:i=t===null?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch{i=null}}return i}},Hbt=(t,e)=>e!==t&&(e==e||t==t),wW={attribute:!0,type:String,converter:SW,reflect:!1,hasChanged:Hbt},TW="finalized",Nc=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var i;this.finalize(),((i=this.h)!==null&&i!==void 0?i:this.h=[]).push(e)}static get observedAttributes(){this.finalize();let e=[];return this.elementProperties.forEach((i,r)=>{let s=this._$Ep(r,i);s!==void 0&&(this._$Ev.set(s,r),e.push(s))}),e}static createProperty(e,i=wW){if(i.state&&(i.attribute=!1),this.finalize(),this.elementProperties.set(e,i),!i.noAccessor&&!this.prototype.hasOwnProperty(e)){let r=typeof e=="symbol"?Symbol():"__"+e,s=this.getPropertyDescriptor(e,r,i);s!==void 0&&Object.defineProperty(this.prototype,e,s)}}static getPropertyDescriptor(e,i,r){return{get(){return this[i]},set(s){let n=this[e];this[i]=s,this.requestUpdate(e,n,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||wW}static finalize(){if(this.hasOwnProperty(TW))return!1;this[TW]=!0;let e=Object.getPrototypeOf(this);if(e.finalize(),e.h!==void 0&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){let i=this.properties,r=[...Object.getOwnPropertyNames(i),...Object.getOwnPropertySymbols(i)];for(let s of r)this.createProperty(s,i[s])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){let i=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let s of r)i.unshift(q5(s))}else e!==void 0&&i.push(q5(e));return i}static _$Ep(e,i){let r=i.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise(i=>this.enableUpdating=i),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(e=this.constructor.h)===null||e===void 0||e.forEach(i=>i(this))}addController(e){var i,r;((i=this._$ES)!==null&&i!==void 0?i:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((r=e.hostConnected)===null||r===void 0||r.call(e))}removeController(e){var i;(i=this._$ES)===null||i===void 0||i.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((e,i)=>{this.hasOwnProperty(i)&&(this._$Ei.set(i,this[i]),delete this[i])})}createRenderRoot(){var e;let i=(e=this.shadowRoot)!==null&&e!==void 0?e:this.attachShadow(this.constructor.shadowRootOptions);return _W(i,this.constructor.elementStyles),i}connectedCallback(){var e;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)===null||e===void 0||e.forEach(i=>{var r;return(r=i.hostConnected)===null||r===void 0?void 0:r.call(i)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(i=>{var r;return(r=i.hostDisconnected)===null||r===void 0?void 0:r.call(i)})}attributeChangedCallback(e,i,r){this._$AK(e,r)}_$EO(e,i,r=wW){var s;let n=this.constructor._$Ep(e,r);if(n!==void 0&&r.reflect===!0){let a=(((s=r.converter)===null||s===void 0?void 0:s.toAttribute)!==void 0?r.converter:SW).toAttribute(i,r.type);this._$El=e,a==null?this.removeAttribute(n):this.setAttribute(n,a),this._$El=null}}_$AK(e,i){var r;let s=this.constructor,n=s._$Ev.get(e);if(n!==void 0&&this._$El!==n){let a=s.getPropertyOptions(n),o=typeof a.converter=="function"?{fromAttribute:a.converter}:((r=a.converter)===null||r===void 0?void 0:r.fromAttribute)!==void 0?a.converter:SW;this._$El=n,this[n]=o.fromAttribute(i,a.type),this._$El=null}}requestUpdate(e,i,r){let s=!0;e!==void 0&&(((r=r||this.constructor.getPropertyOptions(e)).hasChanged||Hbt)(this[e],i)?(this._$AL.has(e)||this._$AL.set(e,i),r.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,r))):s=!1),!this.isUpdatePending&&s&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(i){Promise.reject(i)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((s,n)=>this[n]=s),this._$Ei=void 0);let i=!1,r=this._$AL;try{i=this.shouldUpdate(r),i?(this.willUpdate(r),(e=this._$ES)===null||e===void 0||e.forEach(s=>{var n;return(n=s.hostUpdate)===null||n===void 0?void 0:n.call(s)}),this.update(r)):this._$Ek()}catch(s){throw i=!1,this._$Ek(),s}i&&this._$AE(r)}willUpdate(e){}_$AE(e){var i;(i=this._$ES)===null||i===void 0||i.forEach(r=>{var s;return(s=r.hostUpdated)===null||s===void 0?void 0:s.call(r)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){this._$EC!==void 0&&(this._$EC.forEach((i,r)=>this._$EO(r,this[r],i)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}};Nc[TW]=!0,Nc.elementProperties=new Map,Nc.elementStyles=[],Nc.shadowRootOptions={mode:"open"},qbt?.({ReactiveElement:Nc}),((xW=H5.reactiveElementVersions)!==null&&xW!==void 0?xW:H5.reactiveElementVersions=[]).push("1.6.3");var MW,$5=window,sb=$5.trustedTypes,$bt=sb?sb.createPolicy("lit-html",{createHTML:t=>t}):void 0,CW="$lit$",wm=`lit$${(Math.random()+"").slice(9)}$`,t_t="?"+wm,T4t=`<${t_t}>`,l0=document,ZS=()=>l0.createComment(""),QS=t=>t===null||typeof t!="object"&&typeof t!="function",e_t=Array.isArray,M4t=t=>e_t(t)||typeof t?.[Symbol.iterator]=="function",AW=`[
5168
+ `,Vbt=class{constructor(t,e,i,r,s){this.container=t,this.host=e,this.observer=i,this.previousSplineGlobal=r,this.removeLateLifecycleShim=s}static mount(t,e,i,r){if(typeof document>"u")return null;let s=e.parentElement;if(!s)return null;getComputedStyle(s).position==="static"&&(s.style.position="relative");let n=document.createElement("div");n.setAttribute(hR,"");let a=n.style;a.position="absolute",a.overflow="hidden";let o=()=>{a.left=`${e.offsetLeft}px`,a.top=`${e.offsetTop}px`,a.width=`${e.offsetWidth}px`,a.height=`${e.offsetHeight}px`};o();let l=new ResizeObserver(o);l.observe(e),l.observe(s);let u=document.createElement("style");u.textContent=l4t,n.appendChild(u);let h=new DOMParser().parseFromString(i,"text/html"),d=Array.from(h.querySelectorAll("script"));for(let v of d)v.remove();for(let v of Array.from(h.head.children))(v.tagName==="STYLE"||v.tagName==="LINK"&&v.rel==="stylesheet")&&n.appendChild(v);for(;h.body.firstChild;)n.appendChild(h.body.firstChild);s.insertBefore(n,e.nextSibling);let c=new Map,p=new m7(Ibt(t,e,r),(v,b)=>{v==="warn"?console.warn(`[spline html] ${b}`):v==="error"&&console.error(`[spline html] ${b}`)},(v,b)=>{let _=c.get(v);if(_)for(let x of _)try{x(b)}catch(S){console.error(S)}}),m=(v,b)=>{try{return Promise.resolve(p.execute(v,b))}catch(_){return Promise.reject(_)}},f={ready:Promise.resolve(),setVariable:(v,b)=>m("setVariable",[v,b]),setVariables:v=>m("setVariables",[v]),getVariable:v=>m("getVariable",[v]),getVariables:()=>m("getVariables",[]),getAllObjects:()=>m("getAllObjects",[]),findObjectByName:v=>m("findObjectByName",[v]),findObjectById:v=>m("findObjectById",[v]),getGeometry:(v,b)=>m("getGeometry",[v,b??{}]),updateObject:(v,b)=>m("updateObject",[v,b]),createObject:(v,b)=>m("createObject",[v,b??{}]),createCustomMaterial:v=>m("createCustomMaterial",[v]),setMaterial:(v,b)=>m("setMaterial",[v,b]),cloneObject:(v,b)=>m("cloneObject",[v,b??{}]),removeObject:v=>m("removeObject",[v]),spawnObject:(v,b)=>m("spawnObject",[v,b??{}]),destroyObject:v=>m("destroyObject",[v]),setInstanceTransforms:(v,b)=>m("setInstanceTransforms",[v,b??null]),emitEvent:(v,b)=>m("emitEvent",[v,b]),emitEventReverse:(v,b)=>m("emitEventReverse",[v,b]),requestRender:()=>m("requestRender",[]),addEventListener:(v,b)=>{if(typeof b!="function")return;let _=c.get(v);_||(_=new Set,c.set(v,_),m("listenEvent",[v])),_.add(b)},removeEventListener:(v,b)=>{let _=c.get(v);!_||(_.delete(b),_.size===0&&(c.delete(v),m("unlistenEvent",[v])))}},g=window.spline;window.spline=f;let y=function(){if(typeof document>"u"||document.readyState==="loading")return()=>{};let v=[],b=(x,S)=>{let w=new Set,M=x.addEventListener.bind(x),T=x.removeEventListener.bind(x);Object.defineProperty(x,"addEventListener",{configurable:!0,writable:!0,value:(A,C,R)=>{if(M(A,C,R),!S.includes(A)||C==null)return;let O={type:A,listener:C};w.add(O),queueMicrotask(()=>{!w.delete(O)||((D,B,k)=>{let j=new Event(k);try{typeof B=="function"?B.call(D,j):B.handleEvent?.(j)}catch(z){console.error(z)}})(x,O.listener,O.type)})}}),Object.defineProperty(x,"removeEventListener",{configurable:!0,writable:!0,value:(A,C,R)=>{T(A,C,R);for(let O of w)O.type===A&&O.listener===C&&w.delete(O)}}),v.push(()=>{delete x.addEventListener,delete x.removeEventListener,w.clear()})};b(document,["DOMContentLoaded"]),b(window,["load"]);let _=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(S){console.error(S)}})}}),v.push(()=>{_?Object.defineProperty(window,"onload",_):delete window.onload}),()=>{for(let x of v)x()}}();for(let v of d){let b=document.createElement("script");for(let _ of Array.from(v.attributes))b.setAttribute(_.name,_.value);v.src?b.async=!1:b.textContent=v.textContent,n.appendChild(b)}return new Vbt(n,p,l,g,y)}dispose(){this.removeLateLifecycleShim(),this.host.dispose(),this.observer.disconnect(),this.container.remove(),window.spline!==void 0&&(window.spline=this.previousSplineGlobal)}};function kbt(t){return typeof t=="object"&&t!==null&&t.isMaterial===!0}function ddt(t){if(typeof t.material=="function")throw new Error("createObject: a (three) => material factory must be resolved to a material instance before object creation \u2014 this entry point does not support it.");if(!kbt(t.material))return{options:t};let e=t.material;if(e.isNodeMaterial===!0){let i=_U()?.NodeMaterial;if(i!==void 0&&e instanceof i)return{options:{...t,material:void 0},material:e};throw new Error("createObject: this TSL NodeMaterial comes from your own three/webgpu module instance, which cannot compile in the runtime's bundled three. Build it with app.createCustomMaterial((three) => \u2026) instead, or use a built-in material (MeshStandardMaterial, MeshBasicMaterial, \u2026).")}if(e.isShaderMaterial===!0)throw new Error("createObject: a GLSL ShaderMaterial cannot compile on the WebGPU backend \u2014 port the shader to TSL with app.createCustomMaterial((three) => \u2026), or use a built-in material (MeshStandardMaterial, \u2026).");return{options:{...t,material:void 0},material:e}}Le(),Fi(),yt(),Eft(),Pc(),Fi(),Le(),PTt(),_m();var h4t=new Set(["name","parent","position","rotation","scale","visible","castShadow","receiveShadow","color","material"]),cdt="'Cube', 'Sphere', 'Plane', 'Rectangle', 'Ellipse', 'Triangle', 'Polygon', 'Star', 'Cone', 'Cylinder', 'Pyramid', 'Torus', 'TorusKnot', 'Dodecahedron', 'Icosahedron', 'Helix', 'Backdrop', 'Lathe', 'Text', 'CustomMesh', 'Group', 'PointLight', 'SpotLight', 'DirectionalLight'",u4t={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"},d4t={group:"Empty",empty:"Empty",pointlight:"PointLight",spotlight:"SpotLight",directionallight:"DirectionalLight"},c4t={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')."},p4t={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"},m4t={Empty:"Group",PointLight:"Point Light",SpotLight:"Spot Light",DirectionalLight:"Directional Light"};function NS(t,e){return t===void 0?[e[0],e[1],e[2]]:Array.isArray(t)?[t[0]??e[0],t[1]??e[1],t[2]??e[2]]:[t.x??e[0],t.y??e[1],t.z??e[2]]}function zbt(t){return typeof t=="number"?[t,t,t]:NS(t,[1,1,1])}function Q9(t){let e=new Dr(0,0,0,1);return e.setStyle(t),{r:e.r,g:e.g,b:e.b}}function pdt(t,e){let i=t.material??(t.color!==void 0?{color:t.color}:void 0);if(i===void 0)return ds.defaultColorMaterial(mdt(Xg),"physical","layer1","layer2");if(typeof i=="string"){for(let[a,o]of Object.entries(e.shared.materials))if(a===i||o.name===i)return a;if(function(a){let o=a.trim().toLowerCase();return/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(o)||/^(rgb|hsl)a?\(/.test(o)||oe.NAMES[o]!==void 0}(i))return ds.defaultColorMaterial(Q9(i),"physical","layer1","layer2");throw new Error(`createObject: material '${i}' matches no shared material in this document (available: ${function(a){let o=Object.entries(a.shared.materials).map(([,l])=>`'${l.name}'`).filter(l=>l!=="'undefined'");return o.length?o.join(", "):"(none)"}(e)}) and is not a valid CSS color.`)}if(typeof i=="function")throw new Error("createObject: a (three) => material factory must be resolved to a material instance before object creation \u2014 this entry point does not support it.");if(kbt(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?Q9(i.color):mdt(Xg),s=ds.defaultColorMaterial(r,"physical","layer1","layer2"),n=s.layers.find(a=>a.data.type==="light");if(n){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(n.data,a)}if(i.alpha!==void 0){let a=s.layers.find(o=>o.data.type==="color");a&&Object.assign(a.data,{alpha:i.alpha})}return s}function mdt(t){return{r:(t>>16&255)/255,g:(t>>8&255)/255,b:(255&t)/255}}function f4t(t){let e=lc.defaultData("TextGeometry"),{text:i,...r}=t,s=r.fontSize;return s!==void 0&&r.width===void 0&&(r.width=350*s/16),s!==void 0&&r.height===void 0&&(r.height=50*s/16),Object.assign(e,r),i!==void 0&&Object.assign(e,{text:{textValue:String(i)}}),e}function GE(t){return Array.isArray(t)?t:!ArrayBuffer.isView(t)||t instanceof DataView?null:Array.from(t)}function g4t(t,e){return mmt({userData:{type:t,...vU[t].normalizeInputs({parameters:e})}})}function y4t(t,e,i){let{objectType:r,geometryType:s}=t,n=function(l){let u={};for(let[h,d]of Object.entries(l))!h4t.has(h)&&d!==void 0&&(u[h]=d);return u}(e),a={states:new fe,events:new fe};if(r==="Mesh"&&s){if(s==="NonParametricGeometry"){let{geometry:l,doubleSide:u}=function(h){let d=GE(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=GE(h.indices);if(p&&p.length){let b=p.find(_=>!Number.isInteger(_)||_<0||_>=c);if(b!==void 0)throw new Error(`createObject('CustomMesh'): index ${b} is out of range (mesh has ${c} vertices).`)}else p=null;let m=new ye;m.setAttribute("position",new me(d,3));let f=GE(h.normals),g=f!==null&&f.length===d.length;g&&m.setAttribute("normal",new me(f,3));let y=GE(h.uvs);y&&y.length===2*c&&m.setAttribute("uv",new me(y,2));let v=!1;if(!g){let b=p??Array.from({length:c},(S,w)=>w),{closed:_,inverted:x}=function(S,w){let M=S.length/3,T=new Map,A=new Array(M);for(let D=0;D<M;D++){let B=`${Math.round(1e4*S[3*D])},${Math.round(1e4*S[3*D+1])},${Math.round(1e4*S[3*D+2])}`,k=T.get(B);k===void 0?(T.set(B,D),A[D]=D):A[D]=k}let C=new Map;for(let D=0;D+2<w.length;D+=3){let B=A[w[D]],k=A[w[D+1]],j=A[w[D+2]];for(let[z,V]of[[B,k],[k,j],[j,B]]){if(z===V)continue;let H=z<V?z+"_"+V:V+"_"+z;C.set(H,(C.get(H)??0)+1)}}let R=C.size>0;for(let D of C.values())if(D!==2){R=!1;break}if(!R)return{closed:!1,inverted:!1};let O=0;for(let D=0;D+2<w.length;D+=3){let B=3*w[D],k=3*w[D+1],j=3*w[D+2],z=S[B],V=S[B+1],H=S[B+2],U=S[k],et=S[k+1],at=S[k+2],Q=S[j],ut=S[j+1],ht=S[j+2];O+=z*(et*ht-at*ut)+V*(at*Q-U*ht)+H*(U*ut-et*Q)}return{closed:!0,inverted:O<0}}(d,b);if(_&&x){for(let S=0;S+2<b.length;S+=3){let w=b[S+1];b[S+1]=b[S+2],b[S+2]=w}p=b}else _||(v=!0)}return p&&m.setIndex(p),g||m.computeVertexNormals(),{geometry:mmt({userData:{type:"NonParametricGeometry",parameters:{subdivisions:0}},data:m.toJSON().data}),doubleSide:v}}(n);Object.assign(a,Bu.defaultData,{geometry:l,materials:[pdt(e,i)]}),u&&(a.side=2)}else Object.assign(a,Bu.defaultData,{geometry:s==="TextGeometry"?f4t(n):g4t(s,n),material:pdt(e,i)});e.castShadow!==void 0&&(a.castShadow=e.castShadow),e.receiveShadow!==void 0&&(a.receiveShadow=e.receiveShadow)}else r==="Empty"?Object.assign(a,qR.defaultData):(Object.assign(a,HR.defaultData(r),n),e.color!==void 0&&(a.color=Q9(e.color)));a.visible=e.visible??!0,a.position=NS(e.position,[0,0,0]),a.rotation=NS(e.rotation,[0,0,0]),a.scale=zbt(e.scale);let o=(s&&p4t[s])??m4t[r]??r;return a.name=e.name??Lbt(o,i.scene.objects),a}function Lbt(t,e){let i=new Set;if(e.traverse((s,n)=>{i.add(n.name??"")}),!i.has(t))return t;let r=2;for(;i.has(`${t} ${r}`);)r++;return`${t} ${r}`}function Fbt(t,e){let i=Yt.generateUUID();if(t.data.type==="Component")return{data:{...yc.fromComponentData(t),name:t.data.name+" Instance"},id:i,fi:t.fi,children:[]};e[t.id]=i;let r=t.data;return r.type==="Empty"&&r.animations?.length&&(r={...r,animations:r.animations.map(([s,n,a])=>{let o=Yt.generateUUID(),l=a.indexOf(s);return[o,n,l!==-1?a.slice(0,l)+o+a.slice(l+s.length):a]})}),{...t,id:i,data:r,children:t.children.map(s=>Fbt(s,e))}}function v4t(t){let e={};return function(i,r){return nv(i,r,null)??i}(Fbt(t,e),e)}function b4t(t){let e=Array.isArray(t)?t[0]:t,i=e.layers?.map(_4t)??[],r=e.layers?.find(s=>s.type==="light");return{layers:i,alpha:r?.node.alphaOverride?.value??1}}function _4t(t){return t.type==="texture"||t.type==="video"||t.type==="matcap"?{...t.data,updateTexture:e=>t.color.texture.image.updateSrc(e)}:{...t.data}}_m(),ss(),H7(),Pc();var _w=new Dr(0,0,0,1),x4t={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:[]};Le(),Le();var w4t=new Z;function fdt(t){let e=new Dr(0,0,0,1);try{e.setStyle(t)}catch(i){console.error(i)}return e}var Ubt=class{constructor(t,{renderOnDemand:e,renderMode:i="auto",wasmPath:r,renderer:s,htmlContentMode:n="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<gmt?this._skipRender=!1:this.currentTAAFrame=0):this.currentTAAFrame=0,this._scene?.traverseVisibleEntity(o=>{o.type==="ParticleSystem"&&(o.update(this.dt),this._skipRender=!1),Zg(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=w4t.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=pS(this._resize,10),this._onScroll=a=>{this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect())},this.canvas=t,this._htmlContentMode=n,this.renderMode=e?"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=s??"webgl",s===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(()=>(f3t(),iyt)).then(({Perfs:a})=>{this._perfs=new a({x:10,y:10})}),function(a){a.addEventListener("pointerdown",HH,!0),a.addEventListener("pointerdown",KT,!0),a.addEventListener("pointermove",KT,!0),a.addEventListener("pointerup",D0,!0),a.addEventListener("pointercancel",D0,!0),a.addEventListener("pointerleave",D0,!0),window.addEventListener("keydown",$H,!0),window.addEventListener("keyup",XH,!0)}(t)}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:t,isWebGPUSupported:e}=await Promise.resolve().then(()=>(SL(),rR));e();let i=!0,r=!1,s=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"?s=!1:(l==="on"||l==="1"||l==="true"||l==="always")&&(s=!0)}catch{}let n=await t({canvas:this.canvas,antialias:!1,alpha:!0,powerPreference:"high-performance",sceneBundles:!r&&i,forceWebGL:r,asyncCompilation:!r&&s});return n.onBackgroundWorkReady=()=>{this._skipRender=!1,this._renderRequested=!0},n.skyAnimationAllowed=!0,n}catch(t){console.error("[spline] Failed to initialize the WebGPU renderer, falling back to WebGL:",t),this._rendererBackend="webgl"}throw this._failWebGPURequired(),new Error("[spline] This runtime build is WebGPU-only and the browser provides no WebGPU adapter.")}_failWebGPURequired(){console.error('[spline] This scene was exported for WebGPU only and this browser does not provide a WebGPU adapter. Re-export with renderer "Both" or "WebGL 2" to support this browser.');try{let t=window.devicePixelRatio||1,e=this.canvas.clientWidth||300,i=this.canvas.clientHeight||150;this.canvas.width=e*t,this.canvas.height=i*t;let r=this.canvas.getContext("2d");r&&(r.scale(t,t),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.",e/2,i/2))}catch{}this.canvas.dispatchEvent(new CustomEvent("splineerror",{bubbles:!0,detail:{reason:"webgpu-required"}}))}async load(t,e,i){(function(s){let n="The Spline Runtime only accepts .splinecode files that are generated from Spline export panel.";s.endsWith(".spline")?console.warn(n+" The .spline files are only meant to be used by the Editor."):s.endsWith(".splinecode")||console.warn(n)})(t),this.disposed=!1;let r=await(await fetch(t,i)).arrayBuffer();await this.start(r,{variables:e})}async start(t,{interactive:e=!0,variables:i}={}){if(this.disposed)return;ia.init();let r=await async function(c){let[p,m]=Bw(mS.deserialize(new Uint8Array(c)));if((p.schema??0)!==131){let{updateDocumentSchema:f}=await Promise.resolve().then(()=>(l5(),omt));f(p)}return m.result().data}(t);this._data=r;let s=function(c){let p=[];return c.scene.objects.traverse((m,f)=>{f.type==="Mesh"&&f.geometry.type==="NonParametricGeometry"&&f.geometry.data.draco!==void 0&&p.push(f)}),p}(r);r.version&&(0,a4t.default)(r.version,"2.0.32")>0&&console.warn("Your .splinecode file is more recent than the library. Please upgrade @splinetool/runtime to the latest version."),this._wasmPath!==void 0&&(this.setUIWasmUrl(`${this._wasmPath}/hana-ui.wasm`),function(c){WU=c}(this._wasmPath));let n=async function(){}();await Promise.all([n,s.length&&ldt(this._wasmPath),YY(r)&&BTt(this._wasmPath),EMt(r)&&cMt(this._wasmPath),Kg.physicsEnabled(r.scene.objects)&&fEt(this._wasmPath),iY(r)&&qht(),gK(r)&&KMt(),qTt(r)&&WTt(),kht(r)&&n.then(()=>$8()?.loadHanaUIRUNTIME()),lEt(r)&&NEt(this._wasmPath)].filter(Boolean)),s.length&&await hdt(s),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((m,f)=>{if(f.type!=="Page")return;let g=f.postprocessing;if(g&&typeof g=="object"&&g.enabled===!0)for(let[y,v]of Object.entries(g))y!=="enabled"&&v&&typeof v=="object"&&v.enabled===!0&&p.add(y)}),[...p]}(r);if(this._rendererBackend==="webgpu")try{await Promise.all([Promise.resolve().then(()=>(SL(),rR)),n4t(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"}if(this._rendererBackend!=="webgpu")return void this._failWebGPURequired();(function(c){LS=c})(this._rendererBackend==="webgpu"?"webgpu":"webgl");let l=new t4t(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(()=>(qAt(),xvt)),p=performance.now();c(r,l.scene);let m=performance.now();console.log("Merged geometries in ",m-p," ms")}YY(r)&&this._scene.traverse(c=>{$u(c)&&c.recomputeBoolean()}),this._sharedAssetsManager.setRequestRender(()=>{this._requestRenderAutoMode(),this._scene?.traverse(c=>{$1(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()),Zg(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())}),iY(r)&&function(c){if(Kg.physicsEnabled(c.scene.objects))return!0;let p=!1;return c.scene.objects.traverse((m,f)=>{if(f.events){if(Array.isArray(f.events)){for(let g of f.events)if(g.data.disabled!==!0&&g.data.type==="GameControl"&&g.data.collisionEnabled){p=!0;break}}else for(let g of Object.values(f.events))if(g.disabled!==!0&&g.type==="GameControl"&&g.collisionEnabled){p=!0;break}}}),p}(r)&&await Promise.all(u),kht(r)){let c=[];this._scene.traverseEntity(p=>{(Ka(p)||p instanceof qs)&&p.uiCanvas&&c.push(p.uiCanvas)}),await Promise.all(c.map(p=>p.promise))}if(this._scene.rewriteEventsBeforeGoToPlayMode(),yW(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 m=this._sharedAssetsManager.getImage("SplineWatermark");await m.loadPromise;let f=m.getTexture(1001);this._renderer.pipeline.setWatermark(f)}}gK(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 ACt(this._renderer,this._camera,new Z(this._viewportWidth,this._viewportHeight)),this._frameView.enableResponsive=(h.allowResponsive??!1)&&h.preset==="fullscreen"),e){let c=new nCt(this._renderer,this.data.scene.publish,this._scene,()=>this._scene.activeCamera,this._sharedAssetsManager,this._requestRenderAutoMode,!0,h);this._scene.updateMatrixWorld(!0),this._controls=new bEt(c),this._animationControls=new r4t(this._scene,this._requestRenderAutoMode),this._eventManager=new _Ct(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(e&&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"?Vbt.mount(this,this.canvas,d,c):Bbt.mount(this,this.canvas,d,c))??void 0}}setVariables(t){if(this._data!==void 0){let e=Object.entries(t);for(let[i,r]of e)this.setVariable(i,r)}}setVariable(t,e){let i=this._getVariableByName(t);if(i&&!("dynamicVariableType"in i.data)){let r=e;typeof i.data.value=="number"?r=typeof e=="number"?e:typeof e=="boolean"?e===!0?1:0:parseFloat(e):typeof i.data.value=="boolean"?r=typeof e=="number"?!!e:typeof e=="boolean"?e:e.toLocaleLowerCase()!=="false"&&!!e:typeof i.data.value!="string"&&i.data.value.textValue!==void 0&&(r=e.toString());let s=typeof r=="string"?{textValue:r}:r;this._sharedAssetsManager?.updateVariable(i.id,s),this.requestRender(),this._requestRenderAutoMode()}else i===void 0?console.warn(`No variable named ${t} was found in your Spline file. Make sure to create it from Spline editor.`):"dynamicVariableType"in i.data&&console.warn(`Dynamic variables like ${t} cannot be updated from code.`)}getVariables(){let t={};return this._data&&this._data.shared.variables.forEach(e=>{t[e.data.name]===void 0&&(t[e.data.name]=this._getVariableValue(this._sharedAssetsManager.getVariable(e.id)))}),t}getVariable(t){let e=this._getVariableByName(t);if(e){let i=this._sharedAssetsManager.getVariable(e.id);return this._getVariableValue(i)}}_getVariableValue(t){return typeof t!="string"&&Da.isTextValue(t)?Da.getDisplayedValue(t):t}_getVariableByName(t){if(this._data){if(this._variablesCache.has(t))return this._variablesCache.get(t);let e=this._data.shared.variables.find(i=>i.data.name===t);return e&&this._variablesCache.set(t,e),e}}_getPixelRatio(t){switch(t){case 0:return window.devicePixelRatio;case 1:return 1;case 2:return 2}}findObjectById(t){let e=this._scene?.getObjectByProperty("uuid",t);return this._createProxyObject(e)}findObjectByName(t){let e=this._scene?.getObjectByName(t);return this._createProxyObject(e)}getAllObjects(){let t=[];return this._scene?.traverseEntity(e=>{if(!(e.uuid===i0||this._scene.isInvisibleObjects(e)||e instanceof qs)){let i=this._createProxyObject(e);i&&t.push(i)}}),t}getSplineEvents(){return(this._eventManager?.handlers?.Spline).splineEvents}emitEvent(t,e){(this.findObjectById(e)||this.findObjectByName(e))?.emitEvent(t)}emitEventReverse(t,e){(this.findObjectById(e)||this.findObjectByName(e))?.emitEventReverse(t)}addEventListener(t,e){this.canvas.addEventListener(t,e)}removeEventListener(t,e){this.canvas.removeEventListener(t,e)}setZoom(t){this._controls?.orbitControls instanceof kvt&&this._controls?.orbitControls.setZoom(t)}get eventManager(){return this._eventManager}get controls(){return this._controls}setSize(t,e){this._viewportWidth=t,this._viewportHeight=e,this._viewportMode=2,this._resize()}setBackgroundColor(t){let e=fdt(t);this._scene?.activePage.setBackgroundColor(e),this._requestRenderAutoMode()}dispose(){this.disposed=!0,this._htmlContentOverlay?.dispose(),this._htmlContentOverlay=void 0,this._eventManager?.dispose(),this._scene?.dispose(),this._scene=void 0,this._camera=void 0,L2&&L2.disposeAll(),this._sharedAssetsManager?.setRequestRender(()=>{}),this._sharedAssetsManager?.dispose(),this._sharedAssetsManager=void 0,this._proxyObjectCache.forEach(t=>{TL.unsubscribe(t)}),this._proxyObjectCache.clear(),this._variablesCache.clear(),this._renderer?.pipeline.removeEventListener("smaaloaded",this._requestRenderAutoMode),this._renderer?.setAnimationLoop(null),this._renderer?.dispose(),this._renderer=void 0,this._debouncedResize.cancel(),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=void 0),this._resizeObserverTimeout!==void 0&&(clearTimeout(this._resizeObserverTimeout),this._resizeObserverTimeout=void 0),this.canvas.style.width="",this.canvas.style.height="",this.canvas.removeAttribute("width"),this.canvas.removeAttribute("height"),this._frameView=void 0,this._controls?.deactivate(),this._controls=void 0,this._animationControls=void 0,this._eventManager?.eventContext.dispose(),this._eventManager=void 0,this._splatViewer=void 0,this._data=void 0,this._perfs=void 0,this.dt=0,this._lastTime=void 0,function(t){t.removeEventListener("pointerdown",HH,!0),t.removeEventListener("pointerdown",KT,!0),t.removeEventListener("pointermove",KT,!0),t.removeEventListener("pointerup",D0,!0),t.removeEventListener("pointercancel",D0,!0),t.removeEventListener("pointerleave",D0,!0),window.removeEventListener("keydown",$H,!0),window.removeEventListener("keyup",XH,!0)}(this.canvas),document.removeEventListener("scroll",this._onScroll),ia.dispose()}get isStopped(){return this._isPaused}stop(){this._isPaused||(this._renderer?.setAnimationLoop(null),this._isPaused=!0,this._eventManager?.pause(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!1))}play(){!this._isPaused||(this._isPaused=!1,this._eventManager?.resume(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!0),this._renderer?.setAnimationLoop(this.render))}setGlobalEvents(t){this._eventManager?.updateUseWindowEvents(t)}get data(){return this._data}_createProxyObject(t){if(!this._scene)return;let e,i=this._scene;if(t==null)return;if(this._proxyObjectCache.has(t.uuid))return this._proxyObjectCache.get(t.uuid);t.traverseAncestors(h=>{h instanceof qs&&(e=h.name)});let r=this._sharedAssetsManager,s={shared:r,scene:this._scene},n=h=>{if(h===null||h==="Base State")return null;if(h&&t.data.states){let d=t.data.states.find(c=>c.data.name===h);return d?d.id:void 0}},a="material"in t?t.material:void 0,o=t.materialOverride,l={name:t.name,uuid:t.uuid,visible:t.visible,intensity:t.intensity,position:t.position,rotation:t.rotation,scale:t.scale,type:t.data.type,page:e,material:o??(a?b4t(a):void 0),parentUuid:t.parent instanceof qs||t instanceof Pg?void 0:t.parent?.uuid,emitEvent(h){t.dispatchEvent({type:"userEvent",eventName:h})},emitEventReverse(h){t.dispatchEvent({type:"userEvent",eventName:h,reverse:!0})},hide(){t.visible&&(t.visible=!1,s.shared.requestRender())},show(){t.visible||(t.visible=!0,s.shared.requestRender())},get state(){let h=t.stateSelection;if(h!==null)return t.data.states.find(({id:d})=>d===h)?.data.name},set state(h){let d;if(h!==void 0){let c=typeof h=="string"?t.data.states.find(({id:p})=>p===h):t.data.states[h];if(c)d=c.id;else{let p=typeof h=="string"?n(h):void 0;p&&(d=p)}}t.changeSelectedState(d??null,s),t.currentState=d??null,t.dispatchEvent({type:"completeState",state:d??null}),s.shared.requestRender()},transition(h){let d=Obt;if(d===null)return Pn("transitions","obj.transition()"),{transition(_){return this},play(){return this},pause(){return this},reset(){return this},seek(_){return this}};let c,p,m=this,f=[],g=!1,y=()=>{p=new Mbt({delay:0,delayDirection:"start-once",direction:"normal",repeat:0,runMode:"Repeat"},f.map(_=>_.runner))},v={update(_){p?.update(_),p?.isPlaying!==!0&&ia.remove(v)}},b={transition({from:_,to:x,duration:S,delay:w,...M}){let T=n(_);T===void 0&&(T=c);let A=n(x);return c=A,f.push(new d(t,T,A,{state:A,repeat:0,delay:w??0,delayDirection:"start-once",direction:"normal",duration:S??1e3,...M,...M.easing===6?Yp.defaultData:M.easing===5?Dv.defaultData:{}},r,!1,i.activePage,{onBegin:()=>{(_&&T||_==="Base State"&&!T)&&(m.state=T??void 0)},onComplete:()=>{m.state=A??void 0}})),y(),this},play(){return p?(g=!0,p.play(ia.time),p.isPlaying&&ia.add(v),this):this},pause(){return p?.stop(),ia.remove(v),this},reset(){return this.pause(),g=!1,y(),p?.seek(0),this},seek(_){let x=f.reduce((S,w)=>S+w.runner.duration,0);return x>0&&p?.seek(_/1e3/x),this}};return b.transition(h),(h.autoPlay??!0)&&queueMicrotask(()=>{g||b.play()}),b},set color(h){let d=fdt(h);if(d4.is(t))return void(t.color=d);if(!(t.type==="Mesh"&&"material"in t&&t instanceof yo))return;let c={r:d.r,g:d.g,b:d.b,a:d.a},p=t.materialOverride;if(p!==void 0){let g=p.color;return void(g?.isColor===!0&&typeof g.setStyle=="function"&&(g.setStyle(h),s.shared.requestRender()))}let m=Array.isArray(t.material)?t.material[0]:t.material,f=m.data.layers.find(g=>g.data.type==="color")?.id;if(f)m.updateByOp({type:0,path:["layers",f],props:{color:{...c}}},m.data,s);else{let g=m.data,y=g.layers.find(w=>w.data.type==="light");if(!y)return;let v=g.layers.indexOf(y)===0?y:null,b=g.layers.at(v?g.layers.indexOf(v)+1:0),_={type:4,fi:v?v.fi+(b?(b.fi-v.fi)/2:1):b?b.fi/2:1,id:Yt.generateUUID(),data:{...Gs.defaultData("color"),color:c},localIndex:0},x=g.layers.insertAfterHelper(v?.id??null,1),S=g.layers.runOp({..._,fi:x[0]}).data;Object.assign(m.data,{layers:S}),m.updateByOp({..._,path:["layers"]},m.data,s)}}},u=TL(l,(h,d)=>{let c=t[h],p=function(m){return m.split(".")}(h);p[0]==="material"&&a&&o===void 0&&function(m,f,g){let y=Array.isArray(g)?g[0]:g;if(m[0]==="layers"){let v=parseInt(m[1]),b=y.layers[v],_=m[2];b&&_&&function(x,S,w){let M=x[0];try{if(function(T,A){return!!x4t[A]?.includes(T)}(M,w.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]),A=w.getValue(M)?.[T];if(!A)throw new Error("Color index out of range");_w.setStyle(S),A.set(_w.r,_w.g,_w.b,_w.a)}else w.getValue(M)?.setStyle(S);else if(M==="texture"||M==="video"){let T=w.color;(function(A,C,R,O){let D=A[0];if(D==="repeat"||D==="offset"||D==="rotation"){let B=O.getNode("mat"),k=B&&typeof B.updateMatrix=="function"?B:O.getValue("mat");if(!k)return;if(D==="rotation")k.rotation=parseFloat(C);else{let j=A[1];if(j===void 0)C instanceof Array&&C.length===2&&Object.assign(k,{[D]:C});else{let z=k[D],V=parseInt(j)===0?[parseFloat(C),z[1]]:[z[0],parseFloat(C)];Object.assign(k,{[D]:V})}}k.updateMatrix()}else D==="wrapping"||D==="minFilter"||D==="magFilter"?D==="wrapping"?R.texture.wrap=C:R.texture[D]=C:D==="image"&&A[1]==="data"&&R.texture.image.updateSrc(C)})(x.slice(1),S,T,w)}else{let T=x[1],A=w.getValue(M);A?.isVector3&&T!==void 0||A?.isVector2&&T!==void 0?A.setComponent(parseInt(T),S):w.setValue(M,S)}}catch(T){console.error("Error setting material value",T)}}(m.slice(2),f,b)}else m[0]==="alpha"&&y.layers.forEach(v=>{v.type==="light"&&v.node.alphaOverride!==void 0&&(v.node.alphaOverride.value=f,f<1&&(y.transparent=!0))})}(p.slice(1),d,a),typeof c!="object"&&Object.getOwnPropertyDescriptor(t,h)?.writable&&(t[h]=d),this._requestRenderAutoMode(),t.updateMatrix()});return this._proxyObjectCache.set(t.uuid,u),u}setUIWasmUrl(t){(function(e){t4=e,d5?.setHanaUIWasmUrl(e)})(t)}pauseGameControls(){this._eventManager?.controlsManager.gameControl?.pause()}resumeGameControls(){this._eventManager?.controlsManager.gameControl?.resume()}async swapGeometry(t,e){let i;if(typeof e=="string"){if(!e.endsWith(".splinegeometry"))throw new Error("Only .splinegeometry format is supported");{let l=await(await fetch(e)).arrayBuffer();i=new Uint8Array(l)}}else i=e;let r=mS.deserialize(i),s="data"in r&&r.data.draco!==void 0;s&&await ldt(this._wasmPath);let n=this._scene?.getObjectByProperty("uuid",t)??this._scene?.getObjectByName(t);if(!n)return void console.warn(`Object ${t} not found`);if(n.data.type!=="Mesh"||!(n instanceof yo))return void console.warn(`Object ${t} is not a mesh`);let a=n,o={...a.data,geometry:r};s&&await hdt([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]=Zp.patch(o,u)}return i}_applyDocumentTransaction(t){this._data=t.data,this._scene&&(this._scene.data=this._data.scene),this._sharedAssetsManager&&(this._sharedAssetsManager.data=this._data.shared);for(let e of t.actual){let i=e.path;Array.isArray(i)&&i.length===2&&i[0]==="scene"&&i[1]==="objects"&&this._scene?.updateTreeByOp({...e,path:[]},this._sharedAssetsManager)}}_findEntity(t){return this._scene?.getObjectByProperty("uuid",t)??this._scene?.getObjectByName(t)}_resolveParentId(t){if(t===void 0)return this._scene.activePage.uuid;let e=typeof t=="string"?t:t.uuid,i=this._findEntity(e);if(!i)throw new Error(`parent '${e}' \u2014 no object with that name or uuid in the scene.`);return i.uuid}async createCustomMaterial(t){if(this.disposed)throw new Error("createCustomMaterial: this Application was disposed.");if(typeof t!="function")throw new Error("createCustomMaterial: expected a factory function \u2014 createCustomMaterial((three) => new three.MeshStandardNodeMaterial()).");let e=_U();if(e===void 0&&(this._rendererBackend==="webgpu"&&(await Promise.resolve().then(()=>(SL(),rR)),e=_U()),e===void 0))throw new Error("createCustomMaterial: requires the webgpu backend (the runtime default where WebGPU is available). This Application is on the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } or drop any ?renderer=webgl2 override.");let i=t(e);if(typeof i!="object"||i===null||i.isMaterial!==!0)throw new Error("createCustomMaterial: the factory must return a three.js material built from the namespace it receives \u2014 e.g. (three) => new three.MeshStandardNodeMaterial().");return i}async setMaterial(t,e){if(this.disposed)throw new Error("setMaterial: this Application was disposed.");let i=this._scene;if(!i)throw new Error("setMaterial: no scene loaded \u2014 call load() or start() first.");let r=typeof t=="string"?t:t.uuid,s=this._findEntity(r);if(!s)throw new Error(`setMaterial: '${r}' \u2014 no object with that name or uuid in the scene.`);if(!(s instanceof yo))throw new Error(`setMaterial: '${r}' is not a mesh \u2014 lights, groups, and cameras have no material.`);let n=typeof e=="function"?await this.createCustomMaterial(e):e;if(h4()!=="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=ddt({material:n});if(a.material===void 0)throw new Error("setMaterial: expected a three.js material instance or a (three) => material factory.");return s.setMaterialOverride(a.material,{scene:i,shared:this._sharedAssetsManager}),this._proxyObjectCache.delete(s.uuid),this._requestRenderAutoMode(),a.material}async createObject(t,e={}){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 s=function(g){if(typeof g!="string"||g.length===0)throw new Error(`createObject: expected a type name string \u2014 one of ${cdt}.`);let y=g.replace(/Geometry$/i,"").replace(/[\s_-]/g,"").toLowerCase(),v=d4t[y];if(v)return{objectType:v};let b=u4t[y];if(b)return{objectType:"Mesh",geometryType:b};let _=c4t[y];throw _?new Error(`createObject: '${g}' is not supported \u2014 ${_}`):new Error(`createObject: '${g}' is not a creatable Spline type \u2014 use one of ${cdt}, e.g. createObject('Cube', { width: 200 }).`)}(t);typeof e.material=="function"&&(e={...e,material:await this.createCustomMaterial(e.material)});let n,a,{options:o,material:l}=ddt(e);if(l!==void 0){if(s.objectType!=="Mesh")throw new Error("createObject: a three.js material instance only applies to mesh types \u2014 lights and groups have no material.");if(h4()!=="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(s.geometryType==="TextGeometry"){if(!k7.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 qht(),a=e.font??T1,r.shared.fonts[a]===void 0){if(a!==T1){let g=Object.keys(r.shared.fonts).join(", ");throw new Error(`createObject: font '${a}' is not in this document \u2014 available fonts: ${g||"(none)"}.`)}n={name:T1,url:Gpt}}}let u=this._resolveParentId(e.parent),h=y4t(s,o,r),d=Yt.generateUUID(),[c,p]=Bw(r);n&&(c.shared.fonts[T1]=n),c.scene.objects.insertAfter(u,null,[{id:d,data:h,children:[]}]);let m=p.result();if(n&&this._sharedAssetsManager.addFont(T1,n),a!==void 0){let g=this._sharedAssetsManager.getFont(a);g&&await g.loadingPromise}this._applyDocumentTransaction(m);let f=i.find(d);return l!==void 0&&f.setMaterialOverride(l,{scene:i,shared:this._sharedAssetsManager}),this._requestRenderAutoMode(),this._createProxyObject(f)}cloneObject(t,e={}){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 s=typeof t=="string"?t:t?.uuid,n=s?this._findEntity(s):void 0;if(!n)throw new Error(`cloneObject: '${s}' \u2014 no object with that name or uuid in the scene.`);if(n instanceof qs)throw new Error("cloneObject: pages cannot be cloned.");let a=r.scene.objects.get(n.uuid);if(!a)throw new Error(`cloneObject: '${s}' 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,m,f){let g={...p.data};return m.position!==void 0&&(g.position=NS(m.position,[0,0,0])),m.rotation!==void 0&&(g.rotation=NS(m.rotation,[0,0,0])),m.scale!==void 0&&(g.scale=zbt(m.scale)),m.visible!==void 0&&(g.visible=m.visible),g.name=m.name??Lbt(`${p.data.name??"Object"} Copy`,f),{...p,data:g}}(v4t(a),e,r.scene.objects),l=e.parent!==void 0?this._resolveParentId(e.parent):r.scene.objects.parent(n.uuid)??null,u=e.parent!==void 0?null:n.uuid,[h,d]=Bw(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(t){let e=this._scene,i=this._data;if(this.disposed||!e||!i)return!1;let r=typeof t=="string"?t:t?.uuid,s=r?this._findEntity(r):void 0;if(!s)return!1;if(s instanceof qs)throw new Error("removeObject: pages cannot be removed.");if(s.data.type==="PerspectiveCamera"||s.data.type==="OrthographicCamera")throw new Error("removeObject: cameras cannot be removed.");if(i.scene.objects.get(s.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 n=[];s.traverseEntity(l=>{n.push(l.uuid)});let[a,o]=Bw(i);a.scene.objects.delete(s.uuid),this._applyDocumentTransaction(o.result());for(let l of n){let u=this._proxyObjectCache.get(l);u&&(TL.unsubscribe(u),this._proxyObjectCache.delete(l))}return this._requestRenderAutoMode(),!0}};var G5=window,W5=G5.ShadowRoot&&(G5.ShadyCSS===void 0||G5.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,vW=Symbol(),jbt=new WeakMap,YS=class{constructor(e,i,r){if(this._$cssResult$=!0,r!==vW)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=i}get styleSheet(){let e=this.o,i=this.t;if(W5&&e===void 0){let r=i!==void 0&&i.length===1;r&&(e=jbt.get(i)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&jbt.set(i,e))}return e}toString(){return this.cssText}},Gbt=t=>new YS(typeof t=="string"?t:t+"",void 0,vW),bW=(t,...e)=>{let i=t.length===1?t[0]:e.reduce((r,s,n)=>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.")})(s)+t[n+1],t[0]);return new YS(i,t,vW)},_W=(t,e)=>{W5?t.adoptedStyleSheets=e.map(i=>i instanceof CSSStyleSheet?i:i.styleSheet):e.forEach(i=>{let r=document.createElement("style"),s=G5.litNonce;s!==void 0&&r.setAttribute("nonce",s),r.textContent=i.cssText,t.appendChild(r)})},q5=W5?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let i="";for(let r of e.cssRules)i+=r.cssText;return Gbt(i)})(t):t;var xW,H5=window,Wbt=H5.trustedTypes,S4t=Wbt?Wbt.emptyScript:"",qbt=H5.reactiveElementPolyfillSupport,SW={toAttribute(t,e){switch(e){case Boolean:t=t?S4t:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=t!==null;break;case Number:i=t===null?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch{i=null}}return i}},Hbt=(t,e)=>e!==t&&(e==e||t==t),wW={attribute:!0,type:String,converter:SW,reflect:!1,hasChanged:Hbt},TW="finalized",Nc=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var i;this.finalize(),((i=this.h)!==null&&i!==void 0?i:this.h=[]).push(e)}static get observedAttributes(){this.finalize();let e=[];return this.elementProperties.forEach((i,r)=>{let s=this._$Ep(r,i);s!==void 0&&(this._$Ev.set(s,r),e.push(s))}),e}static createProperty(e,i=wW){if(i.state&&(i.attribute=!1),this.finalize(),this.elementProperties.set(e,i),!i.noAccessor&&!this.prototype.hasOwnProperty(e)){let r=typeof e=="symbol"?Symbol():"__"+e,s=this.getPropertyDescriptor(e,r,i);s!==void 0&&Object.defineProperty(this.prototype,e,s)}}static getPropertyDescriptor(e,i,r){return{get(){return this[i]},set(s){let n=this[e];this[i]=s,this.requestUpdate(e,n,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||wW}static finalize(){if(this.hasOwnProperty(TW))return!1;this[TW]=!0;let e=Object.getPrototypeOf(this);if(e.finalize(),e.h!==void 0&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){let i=this.properties,r=[...Object.getOwnPropertyNames(i),...Object.getOwnPropertySymbols(i)];for(let s of r)this.createProperty(s,i[s])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){let i=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let s of r)i.unshift(q5(s))}else e!==void 0&&i.push(q5(e));return i}static _$Ep(e,i){let r=i.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise(i=>this.enableUpdating=i),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(e=this.constructor.h)===null||e===void 0||e.forEach(i=>i(this))}addController(e){var i,r;((i=this._$ES)!==null&&i!==void 0?i:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((r=e.hostConnected)===null||r===void 0||r.call(e))}removeController(e){var i;(i=this._$ES)===null||i===void 0||i.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((e,i)=>{this.hasOwnProperty(i)&&(this._$Ei.set(i,this[i]),delete this[i])})}createRenderRoot(){var e;let i=(e=this.shadowRoot)!==null&&e!==void 0?e:this.attachShadow(this.constructor.shadowRootOptions);return _W(i,this.constructor.elementStyles),i}connectedCallback(){var e;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)===null||e===void 0||e.forEach(i=>{var r;return(r=i.hostConnected)===null||r===void 0?void 0:r.call(i)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(i=>{var r;return(r=i.hostDisconnected)===null||r===void 0?void 0:r.call(i)})}attributeChangedCallback(e,i,r){this._$AK(e,r)}_$EO(e,i,r=wW){var s;let n=this.constructor._$Ep(e,r);if(n!==void 0&&r.reflect===!0){let a=(((s=r.converter)===null||s===void 0?void 0:s.toAttribute)!==void 0?r.converter:SW).toAttribute(i,r.type);this._$El=e,a==null?this.removeAttribute(n):this.setAttribute(n,a),this._$El=null}}_$AK(e,i){var r;let s=this.constructor,n=s._$Ev.get(e);if(n!==void 0&&this._$El!==n){let a=s.getPropertyOptions(n),o=typeof a.converter=="function"?{fromAttribute:a.converter}:((r=a.converter)===null||r===void 0?void 0:r.fromAttribute)!==void 0?a.converter:SW;this._$El=n,this[n]=o.fromAttribute(i,a.type),this._$El=null}}requestUpdate(e,i,r){let s=!0;e!==void 0&&(((r=r||this.constructor.getPropertyOptions(e)).hasChanged||Hbt)(this[e],i)?(this._$AL.has(e)||this._$AL.set(e,i),r.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,r))):s=!1),!this.isUpdatePending&&s&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(i){Promise.reject(i)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((s,n)=>this[n]=s),this._$Ei=void 0);let i=!1,r=this._$AL;try{i=this.shouldUpdate(r),i?(this.willUpdate(r),(e=this._$ES)===null||e===void 0||e.forEach(s=>{var n;return(n=s.hostUpdate)===null||n===void 0?void 0:n.call(s)}),this.update(r)):this._$Ek()}catch(s){throw i=!1,this._$Ek(),s}i&&this._$AE(r)}willUpdate(e){}_$AE(e){var i;(i=this._$ES)===null||i===void 0||i.forEach(r=>{var s;return(s=r.hostUpdated)===null||s===void 0?void 0:s.call(r)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){this._$EC!==void 0&&(this._$EC.forEach((i,r)=>this._$EO(r,this[r],i)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}};Nc[TW]=!0,Nc.elementProperties=new Map,Nc.elementStyles=[],Nc.shadowRootOptions={mode:"open"},qbt?.({ReactiveElement:Nc}),((xW=H5.reactiveElementVersions)!==null&&xW!==void 0?xW:H5.reactiveElementVersions=[]).push("1.6.3");var MW,$5=window,sb=$5.trustedTypes,$bt=sb?sb.createPolicy("lit-html",{createHTML:t=>t}):void 0,CW="$lit$",wm=`lit$${(Math.random()+"").slice(9)}$`,t_t="?"+wm,T4t=`<${t_t}>`,l0=document,ZS=()=>l0.createComment(""),QS=t=>t===null||typeof t!="object"&&typeof t!="function",e_t=Array.isArray,M4t=t=>e_t(t)||typeof t?.[Symbol.iterator]=="function",AW=`[
5169
5169
  \f\r]`,KS=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Xbt=/-->/g,Ybt=/>/g,a0=RegExp(`>|${AW}(?:([^\\s"'>=/]+)(${AW}*=${AW}*(?:[^
5170
5170
  \f\r"'\`<>=]|("|')|))|$)`,"g"),Kbt=/'/g,Zbt=/"/g,i_t=/^(?:script|style|textarea|title)$/i,r_t=t=>(e,...i)=>({_$litType$:t,strings:e,values:i}),s_t=r_t(1),BUt=r_t(2),h0=Symbol.for("lit-noChange"),ha=Symbol.for("lit-nothing"),Qbt=new WeakMap,o0=l0.createTreeWalker(l0,129,null,!1);function n_t(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return $bt!==void 0?$bt.createHTML(e):e}var A4t=(t,e)=>{let i=t.length-1,r=[],s,n=e===2?"<svg>":"",a=KS;for(let o=0;o<i;o++){let l=t[o],u,h,d=-1,c=0;for(;c<l.length&&(a.lastIndex=c,h=a.exec(l),h!==null);)c=a.lastIndex,a===KS?h[1]==="!--"?a=Xbt:h[1]!==void 0?a=Ybt:h[2]!==void 0?(i_t.test(h[2])&&(s=RegExp("</"+h[2],"g")),a=a0):h[3]!==void 0&&(a=a0):a===a0?h[0]===">"?(a=s??KS,d=-1):h[1]===void 0?d=-2:(d=a.lastIndex-h[2].length,u=h[1],a=h[3]===void 0?a0:h[3]==='"'?Zbt:Kbt):a===Zbt||a===Kbt?a=a0:a===Xbt||a===Ybt?a=KS:(a=a0,s=void 0);let p=a===a0&&t[o+1].startsWith("/>")?" ":"";n+=a===KS?l+T4t:d>=0?(r.push(u),l.slice(0,d)+CW+l.slice(d)+wm+p):l+wm+(d===-2?(r.push(void 0),o):p)}return[n_t(t,n+(t[i]||"<?>")+(e===2?"</svg>":"")),r]},u0=class{constructor({strings:e,_$litType$:i},r){let s;this.parts=[];let n=0,a=0,o=e.length-1,l=this.parts,[u,h]=A4t(e,i);if(this.el=u0.createElement(u,r),o0.currentNode=this.el.content,i===2){let d=this.el.content,c=d.firstChild;c.remove(),d.append(...c.childNodes)}for(;(s=o0.nextNode())!==null&&l.length<o;){if(s.nodeType===1){if(s.hasAttributes()){let d=[];for(let c of s.getAttributeNames())if(c.endsWith(CW)||c.startsWith(wm)){let p=h[a++];if(d.push(c),p!==void 0){let m=s.getAttribute(p.toLowerCase()+CW).split(wm),f=/([.?@])?(.*)/.exec(p);l.push({type:1,index:n,name:f[2],strings:m,ctor:f[1]==="."?PW:f[1]==="?"?RW:f[1]==="@"?NW:ab})}else l.push({type:6,index:n})}for(let c of d)s.removeAttribute(c)}if(i_t.test(s.tagName)){let d=s.textContent.split(wm),c=d.length-1;if(c>0){s.textContent=sb?sb.emptyScript:"";for(let p=0;p<c;p++)s.append(d[p],ZS()),o0.nextNode(),l.push({type:2,index:++n});s.append(d[c],ZS())}}}else if(s.nodeType===8)if(s.data===t_t)l.push({type:2,index:n});else{let d=-1;for(;(d=s.data.indexOf(wm,d+1))!==-1;)l.push({type:7,index:n}),d+=wm.length-1}n++}}static createElement(e,i){let r=l0.createElement("template");return r.innerHTML=e,r}};function nb(t,e,i=t,r){var s,n,a,o;if(e===h0)return e;let l=r!==void 0?(s=i._$Co)===null||s===void 0?void 0:s[r]:i._$Cl,u=QS(e)?void 0:e._$litDirective$;return l?.constructor!==u&&((n=l?._$AO)===null||n===void 0||n.call(l,!1),u===void 0?l=void 0:(l=new u(t),l._$AT(t,i,r)),r!==void 0?((a=(o=i)._$Co)!==null&&a!==void 0?a:o._$Co=[])[r]=l:i._$Cl=l),l!==void 0&&(e=nb(t,l._$AS(t,e.values),l,r)),e}var EW=class{constructor(e,i){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var i;let{el:{content:r},parts:s}=this._$AD,n=((i=e?.creationScope)!==null&&i!==void 0?i:l0).importNode(r,!0);o0.currentNode=n;let a=o0.nextNode(),o=0,l=0,u=s[0];for(;u!==void 0;){if(o===u.index){let h;u.type===2?h=new d0(a,a.nextSibling,this,e):u.type===1?h=new u.ctor(a,u.name,u.strings,this,e):u.type===6&&(h=new DW(a,this,e)),this._$AV.push(h),u=s[++l]}o!==u?.index&&(a=o0.nextNode(),o++)}return o0.currentNode=l0,n}v(e){let i=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,i),i+=r.strings.length-2):r._$AI(e[i])),i++}},d0=class{constructor(e,i,r,s){var n;this.type=2,this._$AH=ha,this._$AN=void 0,this._$AA=e,this._$AB=i,this._$AM=r,this.options=s,this._$Cp=(n=s?.isConnected)===null||n===void 0||n}get _$AU(){var e,i;return(i=(e=this._$AM)===null||e===void 0?void 0:e._$AU)!==null&&i!==void 0?i:this._$Cp}get parentNode(){let e=this._$AA.parentNode,i=this._$AM;return i!==void 0&&e?.nodeType===11&&(e=i.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,i=this){e=nb(this,e,i),QS(e)?e===ha||e==null||e===""?(this._$AH!==ha&&this._$AR(),this._$AH=ha):e!==this._$AH&&e!==h0&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):M4t(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==ha&&QS(this._$AH)?this._$AA.nextSibling.data=e:this.$(l0.createTextNode(e)),this._$AH=e}g(e){var i;let{values:r,_$litType$:s}=e,n=typeof s=="number"?this._$AC(e):(s.el===void 0&&(s.el=u0.createElement(n_t(s.h,s.h[0]),this.options)),s);if(((i=this._$AH)===null||i===void 0?void 0:i._$AD)===n)this._$AH.v(r);else{let a=new EW(n,this),o=a.u(this.options);a.v(r),this.$(o),this._$AH=a}}_$AC(e){let i=Qbt.get(e.strings);return i===void 0&&Qbt.set(e.strings,i=new u0(e)),i}T(e){e_t(this._$AH)||(this._$AH=[],this._$AR());let i=this._$AH,r,s=0;for(let n of e)s===i.length?i.push(r=new d0(this.k(ZS()),this.k(ZS()),this,this.options)):r=i[s],r._$AI(n),s++;s<i.length&&(this._$AR(r&&r._$AB.nextSibling,s),i.length=s)}_$AR(e=this._$AA.nextSibling,i){var r;for((r=this._$AP)===null||r===void 0||r.call(this,!1,!0,i);e&&e!==this._$AB;){let s=e.nextSibling;e.remove(),e=s}}setConnected(e){var i;this._$AM===void 0&&(this._$Cp=e,(i=this._$AP)===null||i===void 0||i.call(this,e))}},ab=class{constructor(e,i,r,s,n){this.type=1,this._$AH=ha,this._$AN=void 0,this.element=e,this.name=i,this._$AM=s,this.options=n,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=ha}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,i=this,r,s){let n=this.strings,a=!1;if(n===void 0)e=nb(this,e,i,0),a=!QS(e)||e!==this._$AH&&e!==h0,a&&(this._$AH=e);else{let o=e,l,u;for(e=n[0],l=0;l<n.length-1;l++)u=nb(this,o[r+l],i,l),u===h0&&(u=this._$AH[l]),a||(a=!QS(u)||u!==this._$AH[l]),u===ha?e=ha:e!==ha&&(e+=(u??"")+n[l+1]),this._$AH[l]=u}a&&!s&&this.j(e)}j(e){e===ha?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},PW=class extends ab{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===ha?void 0:e}},C4t=sb?sb.emptyScript:"",RW=class extends ab{constructor(){super(...arguments),this.type=4}j(e){e&&e!==ha?this.element.setAttribute(this.name,C4t):this.element.removeAttribute(this.name)}},NW=class extends ab{constructor(e,i,r,s,n){super(e,i,r,s,n),this.type=5}_$AI(e,i=this){var r;if((e=(r=nb(this,e,i,0))!==null&&r!==void 0?r:ha)===h0)return;let s=this._$AH,n=e===ha&&s!==ha||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,a=e!==ha&&(s===ha||n);n&&this.element.removeEventListener(this.name,this,s),a&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){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,e):this._$AH.handleEvent(e)}},DW=class{constructor(e,i,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=i,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){nb(this,e)}};var Jbt=$5.litHtmlPolyfillSupport;Jbt?.(u0,d0),((MW=$5.litHtmlVersions)!==null&&MW!==void 0?MW:$5.litHtmlVersions=[]).push("2.8.0");var JS=(t,e,i)=>{var r,s;let n=(r=i?.renderBefore)!==null&&r!==void 0?r:e,a=n._$litPart$;if(a===void 0){let o=(s=i?.renderBefore)!==null&&s!==void 0?s:null;n._$litPart$=a=new d0(e.insertBefore(ZS(),o),o,void 0,i??{})}return a._$AI(t),a};var OW,IW;var Sm=class extends Nc{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,i;let r=super.createRenderRoot();return(e=(i=this.renderOptions).renderBefore)!==null&&e!==void 0||(i.renderBefore=r.firstChild),r}update(e){let i=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=JS(i,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!1)}render(){return h0}};Sm.finalized=!0,Sm._$litElement$=!0,(OW=globalThis.litElementHydrateSupport)===null||OW===void 0||OW.call(globalThis,{LitElement:Sm});var a_t=globalThis.litElementPolyfillSupport;a_t?.({LitElement:Sm});((IW=globalThis.litElementVersions)!==null&&IW!==void 0?IW:globalThis.litElementVersions=[]).push("3.3.3");var o_t=t=>e=>typeof e=="function"?((i,r)=>(customElements.define(i,r),r))(t,e):((i,r)=>{let{kind:s,elements:n}=r;return{kind:s,elements:n,finisher(a){customElements.define(i,a)}}})(t,e);var E4t=(t,e)=>e.kind==="method"&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(i){i.createProperty(e.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){typeof e.initializer=="function"&&(this[e.key]=e.initializer.call(this))},finisher(i){i.createProperty(e.key,t)}},P4t=(t,e,i)=>{e.constructor.createProperty(i,t)};function wl(t){return(e,i)=>i!==void 0?P4t(t,e,i):E4t(t,e)}var BW,ljt=((BW=window.HTMLSlotElement)===null||BW===void 0?void 0:BW.prototype.assignedElements)!=null?(t,e)=>t.assignedElements(e):(t,e)=>t.assignedNodes(e).filter(i=>i.nodeType===Node.ELEMENT_NODE);var X5=window.IntersectionObserver!=null;var l_t=(t=32,e=2)=>{let i=t/2;return s_t` <style>
5171
5171
  :host {