File: /home/dronicaehy/www/EDAR_MONTSENY/lib/tdvgs.js
import*as i from"three";import{UniformsUtils as rA,UniformsLib as eA,MathUtils as FA}from"three";function YA(g,A){return new Promise(I=>{g.addEventListener("message",function Q({data:C}){C?.type===A&&(g.removeEventListener("message",Q),I(C))})})}YA(self,"wasm_bindgen_worker_init").then(async({init:g,receiver:A})=>{const I=await Promise.resolve().then(()=>NI);await I.default(g),postMessage({type:"wasm_bindgen_worker_ready"}),I.wbg_rayon_start_worker(A)});async function zA(g,A,I){if(I.numThreads()===0)throw new Error("num_threads must be > 0.");const Q={type:"wasm_bindgen_worker_init",init:{module_or_path:g,memory:A},receiver:I.receiver()};await Promise.all(Array.from({length:I.numThreads()},async()=>{const C=new Worker(new URL(""+new URL("tdvgs/worker0.js",import.meta.url).href,import.meta.url),{type:"module"});return C.postMessage(Q),await YA(C,"wasm_bindgen_worker_ready"),C})),I.build()}let B;function q(g){return g==null}function p(g){const A=B.__externref_table_alloc();return B.__wbindgen_export_1.set(A,g),A}function Y(g,A){try{return g.apply(this,A)}catch(I){const Q=p(I);B.__wbindgen_exn_store(Q)}}let z=null;function s(){return(z===null||z.buffer!==B.memory.buffer)&&(z=new DataView(B.memory.buffer)),z}let c=0;function sA(g,A){const I=A(g.length*4,4)>>>0;for(let Q=0;Q<g.length;Q++){const C=p(g[Q]);s().setUint32(I+4*Q,C,!0)}return c=g.length,I}let u=null;function j(){return(u===null||u.buffer!==B.memory.buffer)&&(u=new Uint8Array(B.memory.buffer)),u}let QA=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});QA.decode();const uA=2146435072;let kA=0;function vA(g,A){return kA+=A,kA>=uA&&(QA=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),QA.decode(),kA=A),QA.decode(j().slice(g,g+A))}function T(g,A){return g=g>>>0,vA(g,A)}const CA=new TextEncoder;CA.encodeInto=function(g,A){const I=CA.encode(g);return A.set(I),{read:g.length,written:I.length}};function W(g,A,I){if(I===void 0){const w=CA.encode(g),o=A(w.length,1)>>>0;return j().subarray(o,o+w.length).set(w),c=w.length,o}let Q=g.length,C=A(Q,1)>>>0;const E=j();let D=0;for(;D<Q;D++){const w=g.charCodeAt(D);if(w>127)break;E[C+D]=w}if(D!==Q){D!==0&&(g=g.slice(D)),C=I(C,Q,Q=D+g.length*3,1)>>>0;const w=j().subarray(C+D,C+Q),o=CA.encodeInto(g,w);D+=o.written,C=I(C,Q,D,1)>>>0}return c=D,C}function RA(g,A){return g=g>>>0,j().subarray(g/1,g/1+A)}function yA(g){const A=typeof g;if(A=="number"||A=="boolean"||g==null)return`${g}`;if(A=="string")return`"${g}"`;if(A=="symbol"){const C=g.description;return C==null?"Symbol":`Symbol(${C})`}if(A=="function"){const C=g.name;return typeof C=="string"&&C.length>0?`Function(${C})`:"Function"}if(Array.isArray(g)){const C=g.length;let E="[";C>0&&(E+=yA(g[0]));for(let D=1;D<C;D++)E+=", "+yA(g[D]);return E+="]",E}const I=/\[object ([^\]]+)\]/.exec(toString.call(g));let Q;if(I&&I.length>1)Q=I[1];else return toString.call(g);if(Q=="Object")try{return"Object("+JSON.stringify(g)+")"}catch{return"Object"}return g instanceof Error?`${g.name}: ${g.message}
${g.stack}`:Q}const LA=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(g=>{B.__wbindgen_export_7.get(g.dtor)(g.a,g.b)});function UA(g,A,I,Q){const C={a:g,b:A,cnt:1,dtor:I},E=(...D)=>{C.cnt++;const w=C.a;C.a=0;try{return Q(w,C.b,...D)}finally{--C.cnt===0?(B.__wbindgen_export_7.get(C.dtor)(w,C.b),LA.unregister(C)):C.a=w}};return E.original=C,LA.register(E,C,C),E}function aA(){B.init_console_error()}function KA(){return B.get_bytes_per_covariance()}function HA(){return B.get_bytes_per_color()}function qA(){return B.get_bytes_per_covariance()}function BA(){return B.is_position_f16()!==0}function dA(g,A,I){const Q=W(g,B.__wbindgen_malloc,B.__wbindgen_realloc),C=c;return B.load_url(Q,C,A,q(I)?0:p(I))}function _A(g,A){if(!(g instanceof A))throw new Error(`expected instance of ${A.name}`)}function tA(g,A){const I=A(g.length*1,1)>>>0;return j().set(g,I/1),c=g.length,I}let v=null;function VA(){return(v===null||v.buffer!==B.memory.buffer)&&(v=new Uint32Array(B.memory.buffer)),v}function $A(g,A){const I=A(g.length*4,4)>>>0;return VA().set(g,I/4),c=g.length,I}function AI(g,A){return g=g>>>0,VA().subarray(g/4,g/4+A)}let _=null;function II(){return(_===null||_.buffer!==B.memory.buffer)&&(_=new Float32Array(B.memory.buffer)),_}function $(g,A){return g=g>>>0,II().subarray(g/4,g/4+A)}function gI(g,A){g=g>>>0;const I=s(),Q=[];for(let C=g;C<g+4*A;C+=4)Q.push(B.__wbindgen_export_1.get(I.getUint32(C,!0)));return B.__externref_drop_slice(g,A),Q}function QI(g){const A=B.__wbindgen_export_1.get(g);return B.__externref_table_dealloc(g),A}function xA(g){return B.initThreadPool(g)}function CI(g){B.wbg_rayon_start_worker(g)}function BI(g,A,I){B.closure163_externref_shim(g,A,I)}function pA(g,A,I){B.closure225_externref_shim(g,A,I)}function EI(g,A,I,Q){B.closure1056_externref_shim(g,A,I,Q)}const TA=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(g=>B.__wbg_hit_free(g>>>0,1));class m{static __wrap(A){A=A>>>0;const I=Object.create(m.prototype);return I.__wbg_ptr=A,TA.register(I,I.__wbg_ptr,I),I}__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,TA.unregister(this),A}free(){const A=this.__destroy_into_raw();B.__wbg_hit_free(A,0)}get point(){const A=B.__wbg_get_hit_point(this.__wbg_ptr);return n.__wrap(A)}set point(A){_A(A,n);var I=A.__destroy_into_raw();B.__wbg_set_hit_point(this.__wbg_ptr,I)}get distance(){return B.__wbg_get_hit_distance(this.__wbg_ptr)}set distance(A){B.__wbg_set_hit_distance(this.__wbg_ptr,A)}get index(){return B.__wbg_get_hit_index(this.__wbg_ptr)>>>0}set index(A){B.__wbg_set_hit_index(this.__wbg_ptr,A)}}Symbol.dispose&&(m.prototype[Symbol.dispose]=m.prototype.free);const ZA=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(g=>B.__wbg_point_free(g>>>0,1));class n{static __wrap(A){A=A>>>0;const I=Object.create(n.prototype);return I.__wbg_ptr=A,ZA.register(I,I.__wbg_ptr,I),I}__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,ZA.unregister(this),A}free(){const A=this.__destroy_into_raw();B.__wbg_point_free(A,0)}get x(){return B.__wbg_get_point_x(this.__wbg_ptr)}set x(A){B.__wbg_set_point_x(this.__wbg_ptr,A)}get y(){return B.__wbg_get_point_y(this.__wbg_ptr)}set y(A){B.__wbg_set_point_y(this.__wbg_ptr,A)}get z(){return B.__wbg_get_point_z(this.__wbg_ptr)}set z(A){B.__wbg_set_point_z(this.__wbg_ptr,A)}}Symbol.dispose&&(n.prototype[Symbol.dispose]=n.prototype.free);const lA=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(g=>B.__wbg_sortdata_free(g>>>0,1));class EA{__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,lA.unregister(this),A}free(){const A=this.__destroy_into_raw();B.__wbg_sortdata_free(A,0)}get splat_count(){return B.__wbg_get_sortdata_splat_count(this.__wbg_ptr)>>>0}set splat_count(A){B.__wbg_set_sortdata_splat_count(this.__wbg_ptr,A)}get use_shared_memory(){return B.__wbg_get_sortdata_use_shared_memory(this.__wbg_ptr)!==0}set use_shared_memory(A){B.__wbg_set_sortdata_use_shared_memory(this.__wbg_ptr,A)}get dynamic_mode(){return B.__wbg_get_sortdata_dynamic_mode(this.__wbg_ptr)!==0}set dynamic_mode(A){B.__wbg_set_sortdata_dynamic_mode(this.__wbg_ptr,A)}constructor(A,I,Q,C){const E=B.sortdata_new(A,I,Q,C);return this.__wbg_ptr=E>>>0,lA.register(this,this.__wbg_ptr,this),this}setPositions(A,I,Q){const C=tA(A,B.__wbindgen_malloc),E=c;B.sortdata_setPositions(this.__wbg_ptr,C,E,I,Q)}setBounds(A,I){B.sortdata_setBounds(this.__wbg_ptr,A,I)}setTransformIndices(A){const I=$A(A,B.__wbindgen_malloc),Q=c;B.sortdata_setTransformIndices(this.__wbg_ptr,I,Q)}setTransforms(A){const I=sA(A,B.__wbindgen_malloc),Q=c;B.sortdata_setTransforms(this.__wbg_ptr,I,Q)}setTransform(A,I){B.sortdata_setTransform(this.__wbg_ptr,A,I)}getSortedIndices(){const A=B.sortdata_getSortedIndices(this.__wbg_ptr);var I=AI(A[0],A[1]).slice();return B.__wbindgen_free(A[0],A[1]*4,4),I}getSortedIndicesPtr(){return B.sortdata_getSortedIndicesPtr(this.__wbg_ptr)>>>0}sort(A,I){return B.sortdata_sort(this.__wbg_ptr,A,I)>>>0}}Symbol.dispose&&(EA.prototype[Symbol.dispose]=EA.prototype.free);const OA=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(g=>B.__wbg_splatbuffer_free(g>>>0,1));class r{static __wrap(A){A=A>>>0;const I=Object.create(r.prototype);return I.__wbg_ptr=A,OA.register(I,I.__wbg_ptr,I),I}__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,OA.unregister(this),A}free(){const A=this.__destroy_into_raw();B.__wbg_splatbuffer_free(A,0)}setTransform(A){B.splatbuffer_setTransform(this.__wbg_ptr,q(A)?0:p(A))}getMetadata(){let A,I;try{const Q=B.splatbuffer_getMetadata(this.__wbg_ptr);return A=Q[0],I=Q[1],T(Q[0],Q[1])}finally{B.__wbindgen_free(A,I,1)}}getTransform(){const A=B.splatbuffer_getTransform(this.__wbg_ptr);let I;return A[0]!==0&&(I=$(A[0],A[1]).slice(),B.__wbindgen_free(A[0],A[1]*4,4)),I}getGaussianCount(){return B.splatbuffer_getGaussianCount(this.__wbg_ptr)>>>0}getSHDegree(){return B.splatbuffer_getSHDegree(this.__wbg_ptr)}getSHCBCount(){return B.splatbuffer_getSHCBCount(this.__wbg_ptr)>>>0}getSceneCenter(){const A=B.splatbuffer_getSceneCenter(this.__wbg_ptr);var I=$(A[0],A[1]).slice();return B.__wbindgen_free(A[0],A[1]*4,4),I}getCenterRadiusList(){const A=B.splatbuffer_getCenterRadiusList(this.__wbg_ptr);var I=$(A[0],A[1]).slice();return B.__wbindgen_free(A[0],A[1]*4,4),I}getCenterRadiusStep(){return B.splatbuffer_getCenterRadiusStep(this.__wbg_ptr)>>>0}getCurrentRadius(){return B.splatbuffer_getCurrentRadius(this.__wbg_ptr)}getMaximumRadius(){return B.splatbuffer_getMaximumRadius(this.__wbg_ptr)}getBoundsMin(){const A=B.splatbuffer_getBoundsMin(this.__wbg_ptr);var I=$(A[0],A[1]).slice();return B.__wbindgen_free(A[0],A[1]*4,4),I}getBoundsMax(){const A=B.splatbuffer_getBoundsMax(this.__wbg_ptr);var I=$(A[0],A[1]).slice();return B.__wbindgen_free(A[0],A[1]*4,4),I}getPositionsBufferPtr(){return B.splatbuffer_getPositionsBufferPtr(this.__wbg_ptr)>>>0}getCovariancesBufferPtr(){return B.splatbuffer_getCovariancesBufferPtr(this.__wbg_ptr)>>>0}getColorsBufferPtr(){return B.splatbuffer_getColorsBufferPtr(this.__wbg_ptr)>>>0}getShCoeffsBufferPtr(){const A=B.splatbuffer_getShCoeffsBufferPtr(this.__wbg_ptr);return A===4294967297?void 0:A}getShCoeffsIndicesBufferPtr(){const A=B.splatbuffer_getShCoeffsIndicesBufferPtr(this.__wbg_ptr);return A===4294967297?void 0:A}getShCoeffsCBBufferPtr(){const A=B.splatbuffer_getShCoeffsCBBufferPtr(this.__wbg_ptr);return A===4294967297?void 0:A}getLoadedPositionsCount(){return B.splatbuffer_getLoadedPositionsCount(this.__wbg_ptr)>>>0}getLoadedColorsCount(){return B.splatbuffer_getLoadedColorsCount(this.__wbg_ptr)>>>0}getLoadedShCoeffsCount(){return B.splatbuffer_getLoadedShCoeffsCount(this.__wbg_ptr)>>>0}getLoadedShCoeffsIndicesCount(){return B.splatbuffer_getLoadedShCoeffsIndicesCount(this.__wbg_ptr)>>>0}getLoadedShCoeffsCBCount(){return B.splatbuffer_getLoadedShCoeffsCBCount(this.__wbg_ptr)>>>0}getLoadedCovariancesCount(){return B.splatbuffer_getLoadedCovariancesCount(this.__wbg_ptr)>>>0}getDistanceLoadedFromSceneCenter(){return B.splatbuffer_getDistanceLoadedFromSceneCenter(this.__wbg_ptr)}computeVisibleIndices(A,I,Q){return B.splatbuffer_computeVisibleIndices(this.__wbg_ptr,A,I,Q)>>>0}getVisibleIndicesBufferPtr(){return B.splatbuffer_getVisibleIndicesBufferPtr(this.__wbg_ptr)>>>0}raycast(A,I,Q,C){const E=B.splatbuffer_raycast(this.__wbg_ptr,A,I,Q,C);var D=gI(E[0],E[1]).slice();return B.__wbindgen_free(E[0],E[1]*4,4),D}getOctree(){return B.splatbuffer_getOctree(this.__wbg_ptr)}export(A,I,Q,C){const E=W(I,B.__wbindgen_malloc,B.__wbindgen_realloc),D=c;var w=q(Q)?0:tA(Q,B.__wbindgen_malloc),o=c;const G=B.splatbuffer_export(this.__wbg_ptr,A,E,D,w,o,q(C)?0:p(C));if(G[3])throw QI(G[2]);var R=RA(G[0],G[1]).slice();return B.__wbindgen_free(G[0],G[1]*1,1),R}}Symbol.dispose&&(r.prototype[Symbol.dispose]=r.prototype.free);const XA=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(g=>B.__wbg_wbg_rayon_poolbuilder_free(g>>>0,1));class e{static __wrap(A){A=A>>>0;const I=Object.create(e.prototype);return I.__wbg_ptr=A,XA.register(I,I.__wbg_ptr,I),I}__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,XA.unregister(this),A}free(){const A=this.__destroy_into_raw();B.__wbg_wbg_rayon_poolbuilder_free(A,0)}numThreads(){return B.wbg_rayon_poolbuilder_numThreads(this.__wbg_ptr)>>>0}receiver(){return B.wbg_rayon_poolbuilder_receiver(this.__wbg_ptr)>>>0}build(){B.wbg_rayon_poolbuilder_build(this.__wbg_ptr)}}Symbol.dispose&&(e.prototype[Symbol.dispose]=e.prototype.free);const DI=new Set(["basic","cors","default"]);async function iI(g,A){if(typeof Response=="function"&&g instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(g,A)}catch(Q){if(g.ok&&DI.has(g.type)&&g.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",Q);else throw Q}const I=await g.arrayBuffer();return await WebAssembly.instantiate(I,A)}else{const I=await WebAssembly.instantiate(g,A);return I instanceof WebAssembly.Instance?{instance:I,module:g}:I}}function wI(){const g={};return g.wbg={},g.wbg.__wbg_Window_925630dd9364b9e7=function(A){return A.Window},g.wbg.__wbg_WorkerGlobalScope_f8a15b453de109c0=function(A){return A.WorkerGlobalScope},g.wbg.__wbg_async_d65ec5b7c88f9d4a=function(A){return A.async},g.wbg.__wbg_body_4851aa049324a851=function(A){const I=A.body;return q(I)?0:p(I)},g.wbg.__wbg_buffer_40c0928cc927f62a=function(A){return A.buffer},g.wbg.__wbg_call_13410aac570ffff7=function(){return Y(function(A,I){return A.call(I)},arguments)},g.wbg.__wbg_call_641db1bb5db5a579=function(){return Y(function(A,I,Q,C){return A.call(I,Q,C)},arguments)},g.wbg.__wbg_call_a5400b25a865cfd8=function(){return Y(function(A,I,Q){return A.call(I,Q)},arguments)},g.wbg.__wbg_call_f1fd202ba222e0ec=function(){return Y(function(A,I,Q,C,E){return A.call(I,Q,C,E)},arguments)},g.wbg.__wbg_data_9ab529722bcc4e6c=function(A){return A.data},g.wbg.__wbg_elements_a81bc7dfdce748ad=function(A,I){const Q=I.elements,C=sA(Q,B.__wbindgen_malloc),E=c;s().setInt32(A+4*1,E,!0),s().setInt32(A+4*0,C,!0)},g.wbg.__wbg_error_7534b8e9a36f1ab4=function(A,I){let Q,C;try{Q=A,C=I,console.error(T(A,I))}finally{B.__wbindgen_free(Q,C,1)}},g.wbg.__wbg_fetch_44b6058021aef5e3=function(A,I){return A.fetch(I)},g.wbg.__wbg_fetch_87aed7f306ec6d63=function(A,I){return A.fetch(I)},g.wbg.__wbg_getRandomValues_80578b2ff2a093ba=function(){return Y(function(A){globalThis.crypto.getRandomValues(A)},arguments)},g.wbg.__wbg_getReader_b31811cbe47772c1=function(A){return A.getReader()},g.wbg.__wbg_get_458e874b43b18b25=function(){return Y(function(A,I){return Reflect.get(A,I)},arguments)},g.wbg.__wbg_get_987e262901d6471e=function(){return Y(function(A,I,Q,C){const E=I.get(T(Q,C));var D=q(E)?0:W(E,B.__wbindgen_malloc,B.__wbindgen_realloc),w=c;s().setInt32(A+4*1,w,!0),s().setInt32(A+4*0,D,!0)},arguments)},g.wbg.__wbg_headers_29fec3c72865cd75=function(A){return A.headers},g.wbg.__wbg_hit_new=function(A){return m.__wrap(A)},g.wbg.__wbg_instanceof_File_9b203ca2ca274154=function(A){let I;try{I=A instanceof File}catch{I=!1}return I},g.wbg.__wbg_instanceof_Object_fbf5fef4952ff29b=function(A){let I;try{I=A instanceof Object}catch{I=!1}return I},g.wbg.__wbg_instanceof_Response_50fde2cd696850bf=function(A){let I;try{I=A instanceof Response}catch{I=!1}return I},g.wbg.__wbg_instanceof_Uint8Array_9a8378d955933db7=function(A){let I;try{I=A instanceof Uint8Array}catch{I=!1}return I},g.wbg.__wbg_instanceof_Window_12d20d558ef92592=function(A){let I;try{I=A instanceof Window}catch{I=!1}return I},g.wbg.__wbg_length_6bb7e81f9d7713e4=function(A){return A.length},g.wbg.__wbg_new_19c25a3f2fa63a02=function(){return new Object},g.wbg.__wbg_new_1f3a344cf3123716=function(){return new Array},g.wbg.__wbg_new_2368e31ffa149431=function(A){return new Int32Array(A)},g.wbg.__wbg_new_2e3c58a15f39f5f9=function(A,I){try{var Q={a:A,b:I},C=(D,w)=>{const o=Q.a;Q.a=0;try{return EI(o,Q.b,D,w)}finally{Q.a=o}};return new Promise(C)}finally{Q.a=Q.b=0}},g.wbg.__wbg_new_638ebfaedbf32a5e=function(A){return new Uint8Array(A)},g.wbg.__wbg_new_66b9434b4e59b63e=function(){return Y(function(){return new AbortController},arguments)},g.wbg.__wbg_new_8a6f238a6ece86ea=function(){return new Error},g.wbg.__wbg_new_95e31b8bc5de31d6=function(){return Y(function(A,I){return new URL(T(A,I))},arguments)},g.wbg.__wbg_new_9d476835fd376de6=function(){return Y(function(A,I){return new Worker(T(A,I))},arguments)},g.wbg.__wbg_new_bd4cca60314f67a3=function(){return Y(function(){return new FileReader},arguments)},g.wbg.__wbg_newfromslice_074c56947bd43469=function(A,I){return new Uint8Array(RA(A,I))},g.wbg.__wbg_newnoargs_254190557c45b4ec=function(A,I){return new Function(T(A,I))},g.wbg.__wbg_newwithlength_a167dcc7aaa3ba77=function(A){return new Uint8Array(A>>>0)},g.wbg.__wbg_newwithstrandinit_b5d168a29a3fd85f=function(){return Y(function(A,I,Q){return new Request(T(A,I),Q)},arguments)},g.wbg.__wbg_of_26ef42cc9a4270a1=function(A,I,Q){return Array.of(A,I,Q)},g.wbg.__wbg_pathname_e7278f48b2a6a5ad=function(A,I){const Q=I.pathname,C=W(Q,B.__wbindgen_malloc,B.__wbindgen_realloc),E=c;s().setInt32(A+4*1,E,!0),s().setInt32(A+4*0,C,!0)},g.wbg.__wbg_postMessage_50e57097ede408b9=function(){return Y(function(A,I){A.postMessage(I)},arguments)},g.wbg.__wbg_prototypesetcall_3d4a26c1ed734349=function(A,I,Q){Uint8Array.prototype.set.call(RA(A,I),Q)},g.wbg.__wbg_queueMicrotask_25d0739ac89e8c88=function(A){queueMicrotask(A)},g.wbg.__wbg_queueMicrotask_4488407636f5bf24=function(A){return A.queueMicrotask},g.wbg.__wbg_readAsArrayBuffer_a9f65e0c524f16a0=function(){return Y(function(A,I){A.readAsArrayBuffer(I)},arguments)},g.wbg.__wbg_read_bc925c758aa4d897=function(A){return A.read()},g.wbg.__wbg_resolve_4055c623acdd6a1b=function(A){return Promise.resolve(A)},g.wbg.__wbg_result_f3b8657ddb4b49e7=function(){return Y(function(A){return A.result},arguments)},g.wbg.__wbg_set_3f1d0b984ed272ed=function(A,I,Q){A[I]=Q},g.wbg.__wbg_set_90f6c0f7bd8c0415=function(A,I,Q){A[I>>>0]=Q},g.wbg.__wbg_setonerror_8ba91af1a63fd378=function(A,I){A.onerror=I},g.wbg.__wbg_setonload_d46edf64d5803ccb=function(A,I){A.onload=I},g.wbg.__wbg_setonmessage_c943f7891405ab22=function(A,I){A.onmessage=I},g.wbg.__wbg_setsignal_8c45ad1247a74809=function(A,I){A.signal=I},g.wbg.__wbg_signal_da4d466ce86118b5=function(A){return A.signal},g.wbg.__wbg_size_8f84e7768fba0589=function(A){return A.size},g.wbg.__wbg_slice_36c55c8c1a260c46=function(){return Y(function(A,I,Q){return A.slice(I,Q)},arguments)},g.wbg.__wbg_splatbuffer_new=function(A){return r.__wrap(A)},g.wbg.__wbg_stack_0ed75d68575b0f3c=function(A,I){const Q=I.stack,C=W(Q,B.__wbindgen_malloc,B.__wbindgen_realloc),E=c;s().setInt32(A+4*1,E,!0),s().setInt32(A+4*0,C,!0)},g.wbg.__wbg_startWorkers_2ca11761e08ff5d5=function(A,I,Q){return zA(A,I,e.__wrap(Q))},g.wbg.__wbg_static_accessor_GLOBAL_8921f820c2ce3f12=function(){const A=typeof global>"u"?null:global;return q(A)?0:p(A)},g.wbg.__wbg_static_accessor_GLOBAL_THIS_f0a4409105898184=function(){const A=typeof globalThis>"u"?null:globalThis;return q(A)?0:p(A)},g.wbg.__wbg_static_accessor_SELF_995b214ae681ff99=function(){const A=typeof self>"u"?null:self;return q(A)?0:p(A)},g.wbg.__wbg_static_accessor_WINDOW_cde3890479c675ea=function(){const A=typeof window>"u"?null:window;return q(A)?0:p(A)},g.wbg.__wbg_status_3fea3036088621d6=function(A){return A.status},g.wbg.__wbg_subarray_70fd07feefe14294=function(A,I,Q){return A.subarray(I>>>0,Q>>>0)},g.wbg.__wbg_then_b33a773d723afa3e=function(A,I,Q){return A.then(I,Q)},g.wbg.__wbg_then_e22500defe16819f=function(A,I){return A.then(I)},g.wbg.__wbg_value_ade0f87d71d4aecc=function(A){return A.value},g.wbg.__wbg_waitAsync_213e79486ffecd82=function(){return Atomics.waitAsync},g.wbg.__wbg_waitAsync_402c2db0645a44e0=function(A,I,Q){return Atomics.waitAsync(A,I>>>0,Q)},g.wbg.__wbg_wbindgenbooleanget_3fe6f642c7d97746=function(A){const I=A,Q=typeof I=="boolean"?I:void 0;return q(Q)?16777215:Q?1:0},g.wbg.__wbg_wbindgencbdrop_eb10308566512b88=function(A){const I=A.original;return I.cnt--==1?(I.a=0,!0):!1},g.wbg.__wbg_wbindgendebugstring_99ef257a3ddda34d=function(A,I){const Q=yA(I),C=W(Q,B.__wbindgen_malloc,B.__wbindgen_realloc),E=c;s().setInt32(A+4*1,E,!0),s().setInt32(A+4*0,C,!0)},g.wbg.__wbg_wbindgenisfunction_8cee7dce3725ae74=function(A){return typeof A=="function"},g.wbg.__wbg_wbindgenisundefined_c4b71d073b92f3c5=function(A){return A===void 0},g.wbg.__wbg_wbindgenmemory_d84da70f7c42d172=function(){return B.memory},g.wbg.__wbg_wbindgenmodule_7e59019f6366ff9c=function(){return DA.__wbindgen_wasm_module},g.wbg.__wbg_wbindgennumberget_f74b4c7525ac05cb=function(A,I){const Q=I,C=typeof Q=="number"?Q:void 0;s().setFloat64(A+8*1,q(C)?0:C,!0),s().setInt32(A+4*0,!q(C),!0)},g.wbg.__wbg_wbindgenrethrow_01815c9239d70cc2=function(A){throw A},g.wbg.__wbg_wbindgenthrow_451ec1a8469d7eb6=function(A,I){throw new Error(T(A,I))},g.wbg.__wbg_x_ee17d5da172d082f=function(A){return A.x},g.wbg.__wbg_y_74842f81d209bef6=function(A){return A.y},g.wbg.__wbg_z_a3f29b8ed2d03d80=function(A){return A.z},g.wbg.__wbindgen_cast_2241b6af4c4b2941=function(A,I){return T(A,I)},g.wbg.__wbindgen_cast_3d001ea28249329b=function(A,I){return UA(A,I,224,pA)},g.wbg.__wbindgen_cast_8cc70cdaf8bb2c84=function(A,I){return UA(A,I,224,pA)},g.wbg.__wbindgen_cast_9273d5b20bc8118a=function(A,I){return UA(A,I,162,BI)},g.wbg.__wbindgen_cast_d6cd19b81560fd6e=function(A){return A},g.wbg.__wbindgen_init_externref_table=function(){const A=B.__wbindgen_export_1,I=A.grow(4);A.set(0,void 0),A.set(I+0,void 0),A.set(I+1,null),A.set(I+2,!0),A.set(I+3,!1)},g.wbg.__wbindgen_link_dd5153a359f2e504=function(A){const I=`onmessage = function (ev) {
let [ia, index, value] = ev.data;
ia = new Int32Array(ia.buffer);
let result = Atomics.wait(ia, index, value);
postMessage(result);
};
`,Q=typeof URL.createObjectURL>"u"?"data:application/javascript,"+encodeURIComponent(I):URL.createObjectURL(new Blob([I],{type:"text/javascript"})),C=W(Q,B.__wbindgen_malloc,B.__wbindgen_realloc),E=c;s().setInt32(A+4*1,E,!0),s().setInt32(A+4*0,C,!0)},g}function GI(g,A){g.wbg.memory=A||new WebAssembly.Memory({initial:24,maximum:65536,shared:!0})}function oI(g,A,I){if(B=g.exports,DA.__wbindgen_wasm_module=A,z=null,_=null,v=null,u=null,typeof I<"u"&&(typeof I!="number"||I===0||I%65536!==0))throw"invalid stack size";return B.__wbindgen_start(I),B}async function DA(g,A){if(B!==void 0)return B;let I;typeof g<"u"&&(Object.getPrototypeOf(g)===Object.prototype?{module_or_path:g,memory:A,thread_stack_size:I}=g:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof g>"u"&&(g=new URL("./tdvgs/gslib_bg.wasm",import.meta.url));const Q=wI();(typeof g=="string"||typeof Request=="function"&&g instanceof Request||typeof URL=="function"&&g instanceof URL)&&(g=fetch(g)),GI(Q,A);const{instance:C,module:E}=await iI(await g,Q);return oI(C,E,I)}const NI=Object.freeze(Object.defineProperty({__proto__:null,Hit:m,Point:n,SortData:EA,SplatBuffer:r,default:DA,get_bytes_per_color:HA,get_bytes_per_covariance:qA,get_bytes_per_position:KA,initThreadPool:xA,init_console_error:aA,is_position_f16:BA,load_url:dA,wbg_rayon_PoolBuilder:e,wbg_rayon_start_worker:CI},Symbol.toStringTag,{value:"Module"})),FI=()=>(async g=>{try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(g)}catch{return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11])),kI=function(){return/iPad|iPhone|iPod/.test(navigator.userAgent)},RI=function(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)},WA=function(){return/\sVR\s|OculusBrowser|PicoBrowser/i.test(navigator.userAgent)};let iA=!1,MA;async function nA(g){iA||(iA=!0,MA=(await DA(void 0,kI()||WA()?new WebAssembly.Memory({initial:24,maximum:8192,shared:!0}):void 0)).memory,aA(),g>1&&!RI()&&!WA()&&await FI()&&await xA(g))}function yI(){iA&&(MA=void 0,iA=!1)}function f(){return MA}let d;var Z=(g=>(g[g.Init=0]="Init",g[g.Positions=1]="Positions",g[g.Bounds=2]="Bounds",g[g.Sort=3]="Sort",g[g.Dispose=4]="Dispose",g))(Z||{});onmessage=async function(g){const A=g.data;if(A&&A.method!==void 0){if(A.method!=0&&!d)return;switch(A.method){case 0:await nA(1);const I=A.payload;UI(I),postMessage({method:A.method});break;case 1:const Q=A.payload;postMessage({method:A.method,payload:hI(Q)});break;case 2:const C=A.payload;postMessage({method:A.method,payload:JI(C)});break;case 3:const E=A.payload;postMessage({method:A.method,payload:cI(E)});break;case 4:MI();break;default:console.error("Unknown method:",A.method);break}}};function UI(g){d&&d.free(),d=new EA(g.splatCount,g.dynamicMode,g.useSharedMemory,g.maxScenes)}function MI(){d&&(d.free(),d=void 0),yI()}function hI(g){return d.setPositions(new Uint8Array(g.positions.buffer),g.offset,g.halfPrecision),{offset:g.offset,length:g.positions.length/3}}function JI(g){return d.setBounds(g.min,g.max),{}}function cI(g){let A=performance.now(),I=d.sort(g.cameraPos,g.cameraDir);return{sortedIndices:d.use_shared_memory?new Uint32Array(f().buffer,d.getSortedIndicesPtr(),I):new Uint32Array(d.getSortedIndices().buffer,0,I),renderCount:I,time:performance.now()-A}}function SI(g){return new Worker(""+new URL("tdvgs/worker1.js",import.meta.url).href,{type:"module",name:g?.name})}class hA{static MaxScenes=32}const bA={type:"change"};class b extends i.EventDispatcher{ui;stats;static#A;constructor(){if(b.#A!==void 0)return b.#A;super(),b.#A=this}async activate(A){if(!this.isActive()){try{const I=await import("lil-gui");this.ui=new I.GUI({closeFolders:!0}),this.ui.close()}catch{console.error("lil-gui not found");return}try{const I=(await import("stats-gl")).default;this.stats=new I({trackGPU:!0}),document.body.appendChild(this.stats.dom),await this.stats.init(A)}catch{console.error("stats-gl not found");return}this.dispatchEvent(bA)}}dispose(){this.isActive()&&(this.ui&&(this.ui.destroy(),this.ui=void 0),this.stats&&(this.stats.dom.remove(),this.stats=void 0),this.dispatchEvent(bA))}isActive(){return this.ui!==void 0}}var JA=(g=>(g.INIT="init",g.READY="ready",g))(JA||{});class YI extends i.EventDispatcher{lastSortTime=0;maxSortTime=0;#A=!1;#I;#g;#Q;#C=!1;#B=0;#E=new b;#D=!1;#i=1;constructor(A,I){super(),this.#I=A,this.#g=I}dispose(){this.#A&&(this.#Q&&(this.#Q.postMessage({method:Z.Dispose}),this.#Q.terminate(),this.#Q=void 0),this.#C=!1,this.#A=!1)}init(A){this.dispose(),this.#w();const I={splatCount:A,useSharedMemory:this.#g,dynamicMode:this.#I,maxScenes:hA.MaxScenes};this.#Q.postMessage({method:Z.Init,payload:I})}addPositions(A,I,Q){const C={positions:A,offset:I,halfPrecision:Q};this.#Q.postMessage({method:Z.Positions,payload:C})}setBounds(A,I){this.#i=Math.min(1,I.distanceTo(A)*.001);const Q={min:A,max:I};this.#Q?.postMessage({method:Z.Bounds,payload:Q})}#w(){this.#Q=new SI,this.#Q.onmessage=this.#G.bind(this)}#G=A=>{switch(A.data.method){case Z.Init:this.#A=!0,this.dispatchEvent({type:"init"});break;case Z.Positions:const I=A.data.payload;this.#B=I.offset+I.length,this.#D=!0;break;case Z.Sort:const Q=A.data.payload;this.#C=!1,this.lastSortTime=Q.time,this.#E.isActive()&&(this.maxSortTime=Math.max(this.maxSortTime,this.lastSortTime)),this.dispatchEvent({type:"ready",data:{indices:Q.sortedIndices,renderCount:Q.renderCount}});break}};update=(()=>{const A=new i.Vector3,I=new i.Vector3,Q=new i.Vector3,C=new i.Vector3,E=new i.Vector3;return D=>{if(this.#C||!this.#A)return;let w,o,G=!1,R=!1;C.setFromMatrixPosition(D);let h=D.elements;if(Q.set(h[8],h[9],h[10]).negate().normalize(),w=Q.dot(A),o=E.copy(C).sub(I).length(),!this.#D&&!this.#I&&(w<=.99&&(G=!0),o>=this.#i&&(R=!0),!G&&!R))return;this.#C=!0;const t={cameraPos:C,cameraDir:Q};this.#Q.postMessage({method:Z.Sort,payload:t}),I.copy(C),A.copy(Q),this.#D=!1}})()}const sI="cHJlY2lzaW9uIGhpZ2hwIGZsb2F0O3ByZWNpc2lvbiBoaWdocCBpbnQ7cHJlY2lzaW9uIGhpZ2hwIHNhbXBsZXIyRDtwcmVjaXNpb24gaGlnaHAgdXNhbXBsZXIyRDsKI2RlZmluZSB2YXJ5aW5nIG91dAp1bmlmb3JtIG1hdDQgbW9kZWxWaWV3TWF0cml4LHByb2plY3Rpb25NYXRyaXg7aW4gdmVjMiBwb3NpdGlvbjtpbiBpbnQgdjt1bmlmb3JtIGhpZ2hwIHVzYW1wbGVyMkQgUzsKI2lmZGVmIFNUCnVuaWZvcm0gbG93cCB1c2FtcGxlcjJEIHg7Y29uc3QgdmVjNCBoPXZlYzQoMSwuODcsMCwuOSkscj12ZWM0KDAs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uLngqZCtwb3NpdGlvbi55KmopKncsQS56LDEpOwojaWZkZWYgVVNFX0ZPRwp2Rm9nRGVwdGg9LVQuejsKI2VuZGlmCn0=",LI=Object.freeze(Object.defineProperty({__proto__:null,code:sI},Symbol.toStringTag,{value:"Module"})),aI="cHJlY2lzaW9uIGhpZ2hwIGZsb2F0OwojZGVmaW5lIHZhcnlpbmcgaW4KdmFyeWluZyB2ZWM0IHZDb2xvcjt2YXJ5aW5nIHZlYzIgdlBvc2l0aW9uO3ZhcnlpbmcgZmxvYXQgdkRlcHRoOwojaW5jbHVkZSA8Zm9nX3BhcnNfZnJhZ21lbnQ+Cm91dCB2ZWM0IG91dENvbG9yO3ZvaWQgbWFpbigpe2Zsb2F0IHY9ZG90KHZQb3NpdGlvbix2UG9zaXRpb24pO2lmKHY+NC4pZGlzY2FyZDtvdXRDb2xvcj12ZWM0KHZDb2xvci54eXosZXhwKC12KSp2Q29sb3Iudyk7CiNkZWZpbmUgZ2xfRnJhZ0NvbG9yIG91dENvbG9yCgojaW5jbHVkZSA8Zm9nX2ZyYWdtZW50PgoKI3VuZGVmIGdsX0ZyYWdDb2xvcgpnbF9GcmFnRGVwdGg9dkRlcHRoO30=",KI=Object.freeze(Object.defineProperty({__proto__:null,code:aI},Symbol.toStringTag,{value:"Module"}));class cA extends i.RawShaderMaterial{get#A(){return this.uniforms.S.value}set#A(A){this.#A&&this.#A.dispose(),this.uniforms.S.value=A,this.uniformsNeedUpdate=!0}get#I(){return this.uniforms.x.value}set#I(A){this.#I&&this.#I.dispose(),this.uniforms.x.value=A,this.uniformsNeedUpdate=!0}get#g(){return this.uniforms.y.value}set#g(A){this.#g&&this.#g.dispose(),this.uniforms.y.value=A,this.uniformsNeedUpdate=!0}set basisViewport(A){this.uniforms.w.value.set(2/A.x,2/A.y),this.uniformsNeedUpdate=!0}set cameraNear(A){this.uniforms.z.value=A,this.uniformsNeedUpdate=!0}get cameraNear(){return this.uniforms.z.value}set cameraPosition(A){this.uniforms.f.value.copy(A),this.uniformsNeedUpdate=!0}get cameraPosition(){return this.uniforms.f.value}set dynamicMode(A){if(this.dynamicMode!==A){if(A){const I=[];for(let Q=0;Q<hA.MaxScenes;Q++)I.push(new i.Matrix4);this.uniforms.m={value:I},this.defines.DM=1}else delete this.defines.DM;this.needsUpdate=!0}}get dynamicMode(){return this.defines.DM===1}set focalLength(A){this.uniforms.t.value.copy(A),this.uniformsNeedUpdate=!0}set fog(A){this.fog!==A&&(A?this.defines.USE_FOG=1:delete this.defines.USE_FOG,this.needsUpdate=!0)}get fog(){return this.defines.USE_FOG===1}set fogExp2(A){this.fogExp2!==A&&(A?this.defines.FOG_EXP2=1:delete this.defines.FOG_EXP2,this.needsUpdate=!0)}get fogExp2(){return this.defines.FOG_EXP2===1}set halfPrecisionPositions(A){this.halfPrecisionPositions!==A&&(A?this.defines.PHF=1:delete this.defines.PHF,this.needsUpdate=!0)}get halfPrecisionPositions(){return this.defines.PHF===1}get nativeAntialiasing(){return this.defines.NAA===1}set nativeAntialiasing(A){this.nativeAntialiasing!==A&&(A?this.defines.NAA=1:delete this.defines.NAA,this.needsUpdate=!0)}set useStates(A){this.useStates!==A&&(A?this.defines.ST=1:(this.#I!==void 0&&(this.#I.dispose(),this.#I=void 0),delete this.defines.ST),this.needsUpdate=!0)}get useStates(){return this.defines.ST===1}get stateBuffer(){return this.#I?.image.data}constructor(){const{uniforms:A,defines:I}=cA.#C();super({uniforms:A,defines:I,vertexShader:atob(HI.code),fragmentShader:atob(qI.code),transparent:!0,alphaTest:1,blending:i.NormalBlending,depthTest:!0,depthWrite:!1,side:i.FrontSide,glslVersion:i.GLSL3}),this.needsUpdate=!1}setTransform(A,I){const Q=this.uniforms.m;Q&&(Q.value[I].copy(A),this.uniformsNeedUpdate=!0)}dispose(){super.dispose(),this.disposeTextures()}disposeTextures(){this.#A&&(this.#A.dispose(),this.#A=void 0),this.#I&&(this.#I.dispose(),this.#I=void 0),this.#g&&(this.#g.dispose(),this.#g=void 0)}buildTextures(A){this.disposeTextures();const I=1,Q=1,C=1,E=3,D=3,w=.5,o=4,G=E+C+D+w;let R=A.getGaussianCount();const h=this.defines.DM===1,t=this.defines.ST===1,a=this.defines.PHF===1,L=new Uint32Array(R*D),S=new(a?Uint16Array:Uint32Array)(R*E),O=new Uint32Array(R*C);this.#Q(A,L,S,O);const y=this.computeTextureInfo(R,o,G),K=new Uint32Array(y.dataLength),P=a?(F,U)=>{K[F]=S[U]|S[U+1]<<16,K[F+1]=S[U+2]}:(F,U)=>{K[F]=S[U],K[F+1]=S[U+1],K[F+2]=S[U+2]};for(let F=0;F<R;F++){const U=F*8,N=F*3;P(U,N),K[U+4]=L[N],K[U+5]=L[N+1],K[U+6]=L[N+2],K[U+7]=O[F]}const H=new i.DataTexture(K,y.width,y.height,i.RGBAIntegerFormat,i.UnsignedIntType,i.UVMapping,i.ClampToEdgeWrapping,i.ClampToEdgeWrapping,i.NearestFilter,i.NearestFilter,0);if(H.internalFormat="RGBA32UI",H.needsUpdate=!0,this.#A=H,t){const F=this.computeTextureInfo(R,1,1),U=new Uint8Array(F.dataLength),N=new i.DataTexture(U,F.width,F.height,i.RedIntegerFormat,i.UnsignedByteType,i.UVMapping,i.ClampToEdgeWrapping,i.ClampToEdgeWrapping,i.NearestFilter,i.NearestFilter,0);N.needsUpdate=!0,this.#I=N;const x=Math.floor(F.width/F.texelsPerSplat)-1,M=Math.floor(Math.log2(F.width/F.texelsPerSplat));(this.defines.STWOTPS!==x||this.defines.SETWOTPS!==M)&&(this.defines.STWOTPS=x,this.defines.SETWOTPS=M,this.needsUpdate=!0)}if(h){const F=this.computeTextureInfo(R,I,Q),U=new Uint32Array(F.width*F.height*I);let N=0,x=0;for(let k=0;k<A.numClouds();++k){const SA=A.getCloudAt(k),mA=SA.buffer.getGaussianCount();for(let NA=x;NA<mA;++NA)U[NA]=N;++N,x+=SA.globalSplatOffset}const M=new i.DataTexture(U,F.width,F.height,i.RedIntegerFormat,i.UnsignedIntType,i.UVMapping,i.ClampToEdgeWrapping,i.ClampToEdgeWrapping,i.NearestFilter,i.NearestFilter,0);M.internalFormat="R32UI",M.needsUpdate=!0,this.#g=M}const J=Math.floor(y.width/y.texelsPerSplat)-1,X=Math.floor(Math.log2(y.width/y.texelsPerSplat));(this.defines.TWOTPS!==J||this.defines.ETWOTPS!==X||this.defines.TPS!==y.texelsPerSplat)&&(this.defines.TWOTPS=J,this.defines.ETWOTPS=X,this.defines.TPS=y.texelsPerSplat,this.needsUpdate=!0)}computeTextureInfo(A,I,Q){const E=Math.ceil(Q/I),D=E*I,w=A*E,o=A*D;let G=1;for(;G*G<w;)G*=2;G>8192&&(G=8192,console.warn("Maximum splats count reached. Limiting to %s splats.",A));const R=Math.max(Math.ceil(o/G/I),1);return{width:G,height:R,dataLength:G*R*I,texelsPerSplat:E,paddedElementsPerSplat:D}}invalidateState(){this.#I&&(this.#I.needsUpdate=!0,this.needsUpdate=!0)}fillSHIndices(A){const I=new Uint32Array(this.#A.image.data.buffer),Q=A.length;for(let C=0;C<Q;++C)I[C*8+3]|=A[C]<<16;this.#A.needsUpdate=!0}#Q(A,I,Q,C){for(let E=0;E<A.numClouds();++E){const D=A.getCloudAt(E);I&&D.fillPendingCovariancesData(I),Q&&D.fillPendingPositionsData(Q),C&&D.fillPendingColorsData(C)}}static#C(){const A=rA.merge([{S:{value:null},R:{value:null},x:{value:null},y:{value:null},t:{value:new i.Vector2},w:{value:new i.Vector2},z:{value:.1},f:{value:new i.Vector3}},eA.fog]),I={MAX_SCENES:hA.MaxScenes,TWOTPS:1,ETWOTPS:1,TPS:1};return{uniforms:A,defines:I}}}const HI=LI,qI=KI,dI={type:"change"};class AA extends i.EventDispatcher{_uniforms;get uniforms(){return this._uniforms}_defines;get defines(){return this._defines}constructor(){super(),this._uniforms=[],this._defines=[]}dispose(){}init(A){}update(A,I){}dispatchChange(){this.dispatchEvent(dI)}}var V=(g=>(g.IDLE="idle",g.PLAYING="playing",g.COMPLETED="completed",g))(V||{});class IA extends AA{disposeOnComplete=!0;#A=V.IDLE;get state(){return this.#A}play(){this.#A==V.IDLE&&this.setState(V.PLAYING)}stop(){this.#A==V.PLAYING&&this.setState(V.IDLE)}setState(A){this.#A=A,this.dispatchEvent({type:"stateChanged",state:A})}}const tI={type:"refresh"};class oA extends i.Mesh{isGaussianSplattingGroup=!0;boundingBox=null;gaussianState;#A;#I=!1;#g;#Q;#C;#B;#E;#D;set fx(A){A instanceof AA&&(A=[A]),this.#G(this.#D,A),this.#D=A}get fx(){return this.#D}constructor(A){super(oA.#i(0),new cA),this.type="GaussianSplattingGroup",this.#C=(A?.useSharedMemory??!0)&&crossOriginIsolated,this.#Q=A?.dynamicMode??!1,this.#B=A?.useStates??!1,this.#A=new YI(this.#Q,this.#C),this.#A.addEventListener(JA.INIT,this.#J.bind(this)),this.#A.addEventListener(JA.READY,this.#c.bind(this)),this.frustumCulled=!1,this.#E=new i.Matrix4,this.#g=()=>{this.#o()}}add(...A){let I=0;if(this.children.length>0){const C=this.children[this.children.length-1];I=C.globalSplatOffset+C.buffer.getGaussianCount()}const Q=this.children.length;for(const C of A)C.isGaussianCloud&&(C.globalSplatOffset=I,I+=C.buffer.getGaussianCount(),super.add(C));return Q!==this.children.length&&(this.#I=!0),this}remove(...A){const I=this.children.length;for(const Q of A)Q.isGaussianCloud&&super.remove(Q);return I!==this.children.length&&(this.#I=!0),this}removeCloudAt(A){if(A<0||A>=this.children.length)throw new Error("SplatMesh::getScene() -> Invalid scene index.");return this.remove(this.getCloudAt(A)),this.#I=!0,this}getCloudAt(A){if(A<0||A>=this.children.length)throw new Error("SplatMesh::getScene() -> Invalid scene index.");return this.children[A]}numClouds(){return this.children.length}getGaussianCount(){return this.children.reduce((A,I)=>A+I.buffer.getGaussianCount(),0)}computeBoundingBox(){this.boundingBox===null?this.boundingBox=new i.Box3:this.boundingBox.makeEmpty();for(const A of this.children){const I=A;I.boundingBox===null&&I.computeBoundingBox();const Q=I.boundingBox.applyMatrix4(I.matrix);this.boundingBox.union(Q)}}raycast(A,I){}updateMatrix(){super.updateMatrix(),this.#k()}static#i(A){const I=new i.InstancedBufferGeometry;I.setIndex([0,1,2,0,2,3]);const Q=new i.BufferAttribute(new Float32Array([-2,-2,2,-2,2,2,2,2,-2,2,-2,-2]),3);I.setAttribute("position",Q),I.boundingSphere=new i.Sphere(new i.Vector3,1),Q.needsUpdate=!0;const C=new Int32Array(A),E=new i.InstancedBufferAttribute(C,1,!1);return E.setUsage(i.DynamicDrawUsage),E.gpuType=i.IntType,I.setAttribute("v",E),I.instanceCount=0,I}#w(){const A=this.getGaussianCount();this.geometry=oA.#i(A),this.material.dynamicMode=this.#Q,this.material.useStates=this.#B,this.material.halfPrecisionPositions=BA(),this.material.buildTextures(this),this.gaussianState=this.material.stateBuffer,this.fx&&this.#G(void 0,this.fx),this.#A.init(A)}#G(A,I){A=A??[],I=I??[];const Q=A.filter(E=>!I.includes(E)),C=I.filter(E=>!A.includes(E));if(this.material&&(C.length>0||Q.length>0)){for(const E of Q){if(E.uniforms)for(const D of E.uniforms)delete this.material.uniforms[D];if(E.defines)for(const D of E.defines)delete this.material.defines[D];E.removeEventListener("change",this.#g),E instanceof IA&&E.removeEventListener("stateChanged",this.#g)}for(const E of C)E.init(this.material),E.addEventListener("change",this.#g),E instanceof IA&&E.addEventListener("stateChanged",this.#g);this.material.needsUpdate=!0}}#o(){this.dispatchEvent(tI)}dispose(){this.#N(),this.#A.dispose(),this.#I=!0}invalidateState(){this.#B&&(this.material.invalidateState(),this.#o())}#N(){this.geometry.dispose(),this.material&&this.material.dispose()}#F(A,I){const Q=this.geometry,C=Q.attributes.v;C.set(A,0),C.addUpdateRange(0,A.length),C.needsUpdate=!0,Q.instanceCount=I}#k(){const A=this.material;let I=!1;for(let Q=0;Q<this.children.length;Q++){const C=this.children[Q];C.matrixNeedsUpdate&&(C.updateMatrix(),this.#Q&&A.setTransform(C.matrix,Q),I=!0)}I&&this.boundingBox!==null&&this.computeBoundingBox()}#R=(()=>{const A=new i.Vector2,I=new i.Vector2,Q=new i.Vector2;return(C,E)=>{C.getSize(I);let D=C.getPixelRatio();if(C.xr.isPresenting&&(D*=window.devicePixelRatio/D),I.multiplyScalar(D),Q.set(E.projectionMatrix.elements[0]*I.x*.5,E.projectionMatrix.elements[5]*I.y*.5),!Q.equals(A)||this.#I){E instanceof i.PerspectiveCamera&&(E.aspect=I.x/I.y,E.updateProjectionMatrix()),A.copy(Q);const w=this.material;w.basisViewport=I,w.focalLength=Q}}})();#y=(()=>{let A=new i.Vector3;return I=>{const Q=this.material;this.#E.copy(this.matrixWorld).invert().multiply(I.matrixWorld),A.setFromMatrixPosition(this.#E),(!A.equals(Q.cameraPosition)||this.#I)&&(Q.cameraPosition=A),I instanceof i.PerspectiveCamera&&(I.near!=Q.cameraNear||this.#I)&&(Q.cameraNear=I.near)}})();#U(A){if(this.fx)for(let I=this.fx.length-1;I>=0;--I){const Q=this.fx[I];if(Q instanceof IA&&Q.state===V.COMPLETED&&Q.disposeOnComplete){Q.dispose();const C=this.fx.concat();C.splice(I,1),this.fx=C}Q.update(this,A)}}#M(A){const I=this.material;I.fog=A.fog!==null,I.fogExp2=A.fog!==null&&A.fog.isFogExp2}#h(){const A=BA()?Uint16Array:Float32Array,I=new A(this.getGaussianCount()*3);let Q=0;for(const C of this.children){const E=C,D=E.buffer.getGaussianCount()*3,w=new A(f().buffer,E.buffer.getPositionsBufferPtr(),D);I.set(w,Q),Q+=D}return I}#J(A){this.#A.addPositions(this.#h(),0,BA()),this.computeBoundingBox(),this.#A.setBounds(this.boundingBox.min,this.boundingBox.max),this.#o()}#c(A){const I=A.data;this.#F(I.indices,I.renderCount),this.#o()}onBeforeRender(A,I,Q){this.#I&&(this.dispose(),this.numClouds()>0&&this.#w()),this.children.length!==0&&(this.#y(Q),this.#R(A,Q),this.#U(Q),this.#M(I),this.#A.update(this.#E),this.#I=!1)}}const PA=new i.Matrix4,wA=new i.Ray;class jA extends i.Object3D{isGaussianCloud=!0;buffer;centerRadiusStep;centerRadiusList;sceneCenter;globalSplatOffset=0;matrixNeedsUpdate=!0;boundingBox=null;#A=0;#I=0;#g=0;get gaussianState(){const A=this.parent;if(A&&A.gaussianState)return new Uint8Array(A.gaussianState.buffer,this.globalSplatOffset,this.buffer.getGaussianCount())}get metadata(){return JSON.parse(this.buffer.getMetadata())}constructor(A){super(),this.buffer=A,this.frustumCulled=!1,this.type="GaussianCloud",this.centerRadiusList=A.getCenterRadiusList(),this.centerRadiusStep=A.getCenterRadiusStep();const I=A.getSceneCenter();this.sceneCenter=new i.Vector3(I[0],I[1],I[2])}dispose(){this.buffer&&this.buffer.free()}computeBoundingBox(){this.boundingBox===null?this.boundingBox=new i.Box3:this.boundingBox.makeEmpty();let A=this.buffer.getBoundsMin(),I=this.buffer.getBoundsMax();this.boundingBox.set(new i.Vector3(A[0],A[1],A[2]),new i.Vector3(I[0],I[1],I[2]))}raycast(A,I){if(PA.copy(this.matrixWorld).invert(),wA.copy(A.ray).applyMatrix4(PA),this.boundingBox===null&&this.computeBoundingBox(),!wA.intersectsBox(this.boundingBox))return;const Q=this.buffer.raycast(wA.origin,wA.direction,!1,A.firstHitOnly??!1);for(const C of Q)C.distance>=A.near&&C.distance<=A.far&&I.push({distance:C.distance,point:new i.Vector3().set(C.point.x,C.point.y,C.point.z).applyMatrix4(this.matrixWorld),object:this,instanceId:C.index}),C.point.free(),C.free()}updateMatrix(){this.matrixNeedsUpdate&&(super.updateMatrix(),this.matrixNeedsUpdate=!1)}fillPendingPositionsData(A){const I=this.buffer.getLoadedPositionsCount();this.#Q(A,KA()/A.BYTES_PER_ELEMENT,this.#A,I,this.buffer.getPositionsBufferPtr()),this.#A=I}fillPendingColorsData(A){const I=this.buffer.getLoadedColorsCount();this.#Q(A,HA()/A.BYTES_PER_ELEMENT,this.#I,I,this.buffer.getColorsBufferPtr()),this.#I=I}fillPendingCovariancesData(A){const I=this.buffer.getLoadedCovariancesCount();this.#Q(A,qA()/A.BYTES_PER_ELEMENT,this.#g,I,this.buffer.getCovariancesBufferPtr()),this.#g=I}#Q(A,I,Q,C,E){const D=C-Q;if(D>0){let w=Object.getPrototypeOf(A).constructor,o=new w(f().buffer,E+Q*I,D*I);A.set(o,(this.globalSplatOffset+Q)*I)}}invalidateState(){const A=this.parent;A&&A.invalidateState()}}var fA=(g=>(g[g.NONE=0]="NONE",g[g.SELECTED=1]="SELECTED",g[g.DELETED=2]="DELETED",g[g.HIDDEN=4]="HIDDEN",g[g.HOVERED=8]="HOVERED",g))(fA||{});class l extends i.Loader{static#A=[];static#I=!1;#g;constructor(A){super(A),this.#g=Math.min(navigator.hardwareConcurrency,4)}setWorkerLimit(A){return this.#g=A,this}async load(A,I,Q,C){if(l.#I){l.#A.push({url:A,onLoad:I,onProgress:Q,onError:C,loader:this});return}l.#I=!0,await nA(this.#g),dA(A,(E,D)=>{Q&&Q(new ProgressEvent("progress",{loaded:E,total:D}))}).then(E=>{l.#I=!1;let D=new jA(E);this.#Q(),I(D)}).catch(E=>{l.#I=!1,this.#Q(),C&&C(E)})}#Q(){if(l.#A.length>0){let A=l.#A.shift();A.loader.load(A.url,A.onLoad,A.onProgress,A.onError)}}}class VI extends AA{#A=.3;#I=!1;get value(){return this.#A}set value(A){A=Math.max(0,Math.min(1,A)),this.#A!=A&&(this.#A=A,this.#g=!0,this.dispatchChange())}get native(){return this.#I}set native(A){this.#I!=A&&(this.#I=A,this.#g=!0,this.dispatchChange())}#g=!0;constructor(){super(),this._uniforms.push("u"),this._defines.push("COVAA","NAA"),this.#Q()}#Q(){const A=new b;A.isActive()?(A.ui?.add(this,"value",0,1,.01).name("Antialias"),A.ui?.add(this,"native",!1).name("Native Antialias")):A.addEventListener("change",I=>{this.#Q()})}init(A){A.uniforms.u={value:this.#A},A.defines[this._defines[0]]=1}update(A,I){const Q=A.material;this.#g&&(this.#I?(Q.defines.NAA=1,Q.needsUpdate=!0):(Q.defines.NAA&&(delete Q.defines.NAA,Q.needsUpdate=!0),Q.uniforms.u.value=this.#A,Q.uniformsNeedUpdate=!0),this.#g=!1)}}class xI extends AA{#A=3;get maxDegree(){return this.#A}set maxDegree(A){this.#A!=A&&(this.#A=A,this.#B=!0,this.dispatchChange())}#I;#g;#Q;#C;#B=!0;#E=!1;constructor(){super(),this._uniforms.push("R"),this._defines.push("SH","SH1","SH2","SH3","SHCB16","TWOTPS_SH","TPS_SH","ETWOTPS_SH");for(let A=0;A<15;A++)this._defines.push(`SHL${A}`),this._defines.push(`SHH${A}`);this.#D()}#D(){const A=new b;A.isActive()?A.ui?.add(this,"maxDegree",0,3,1).name("SH degree"):A.addEventListener("change",I=>{this.#D()})}init(A){A.uniforms.R={value:void 0}}dispose(){this.#I&&(this.#I.dispose(),this.#I=void 0),this.#g&&(this.#g.dispose(),this.#g=void 0),this.#Q&&(this.#Q.dispose(),this.#Q=void 0),this.#C&&(this.#C.dispose(),this.#C=void 0)}update(A,I){const Q=A.material;if(!this.#I&&!this.#g&&!this.#Q&&!this.#C&&(this.#E=A.children.some(C=>{if(C.isGaussianCloud){const E=C;return E.buffer.getSHCBCount()==0&&E.buffer.getSHDegree()>0}return!1}),this.#E?(this.#G(A),Q.uniforms.H={value:this.#g},Q.uniforms.A={value:this.#Q},Q.uniforms.B={value:this.#C},this.#B=!0):(this.#w(A),this.#i(A),Q.uniforms.R={value:this.#I}),Q.uniformsNeedUpdate=!0),this.#B){for(const C of this._defines)delete Q.defines[C];if(this.#A>0){Q.defines.SH=1,this.#E||(Q.defines.SHCB16=1);for(let C=0;C<this.#A;C++)Q.defines[`SH${C+1}`]=1}if(this.#E){const C=this.#g.image.width,E=C-1,D=Math.floor(Math.log2(C));Q.defines.TWOTPS_SH=E,Q.defines.ETWOTPS_SH=D}Q.needsUpdate=!0,this.#B=!1}}#i(A){const I=A.getGaussianCount();let Q=0;const C=new Uint16Array(I);for(let D=0,w=A.numClouds();D<w;++D){const o=A.getCloudAt(D),G=o.buffer.getGaussianCount(),R=new Uint16Array(f().buffer,o.buffer.getShCoeffsIndicesBufferPtr(),G);C.set(R,Q),Q+=G}A.material.fillSHIndices(C)}#w(A){let D=0;for(let h=0,t=A.numClouds();h<t;++h){const a=A.getCloudAt(h);D+=a.buffer.getSHCBCount()}const w=1024/4,o=new i.Vector2(1024,Math.max(Math.ceil(D/w)*4,1)),G=new Uint16Array(o.x*o.y*3);let R=0;for(let h=0,t=A.numClouds();h<t;++h){const a=A.getCloudAt(h),L=a.buffer.getSHCBCount(),S=new Uint16Array(f().buffer,a.buffer.getShCoeffsCBBufferPtr(),L*45);for(let O=0;O<L;++O){const y=O+R,K=y%w,P=Math.floor(y/w);let H=y*45;for(let J=0;J<4;++J){const X=(P*4+J)*1024*3;for(let F=0;F<4;++F){const U=(K*4+F)*3,N=X+U;G[N]=S[H++],G[N+1]=S[H++],G[N+2]=S[H++]}}}R+=L}this.#I=new i.DataTexture(G,o.x,o.y,i.RGBFormat,i.HalfFloatType),this.#I.internalFormat="RGB16F",this.#I.needsUpdate=!0}#G(A){let C=A.getGaussianCount();const D=A.material.computeTextureInfo(C,4,15),w=D.dataLength*4,o=new Uint8Array(w),G=new Uint8Array(w),R=new Uint8Array(w),h=Math.floor(.5*255);for(let a=0,L=A.numClouds();a<L;++a){const S=A.getCloudAt(a),O=S.buffer.getSHCBCount(),y=S.buffer.getSHDegree(),P=((y+1)*(y+1)-1)*3,H=S.buffer.getGaussianCount();if(y<3&&(R.fill(h,0,H*D.paddedElementsPerSplat),y<2&&(G.fill(h,0,H*D.paddedElementsPerSplat),y<1&&o.fill(h,0,H*D.paddedElementsPerSplat))),O==0){const J=new Uint8Array(f().buffer,S.buffer.getShCoeffsBufferPtr(),H*P),X=y>1?15:12,F=y>2?15:12,U=y==3?15:12;let N=0;for(let x=0;x<H;++x)if(y>=1){const M=x*D.paddedElementsPerSplat;N=x*P;for(let k=0;k<X;k+=4,N+=4)o[M+k]=J[N+3],o[M+k+1]=J[N+2],o[M+k+2]=J[N+1],o[M+k+3]=J[N];if(y>=2){N--;for(let k=0;k<F;k+=4,N+=4)G[M+k]=J[N+3],G[M+k+1]=J[N+2],G[M+k+2]=J[N+1],G[M+k+3]=J[N];if(y==3){N--;for(let k=0;k<U;k+=4,N+=4)R[M+k]=J[N+3],R[M+k+1]=J[N+2],R[M+k+2]=J[N+1],R[M+k+3]=J[N]}else for(let k=F;k<D.paddedElementsPerSplat;++k)G[M+k]=h}else for(let k=X;k<D.paddedElementsPerSplat;++k)o[M+k]=h}}}const t=[o,G,R].map(a=>{const L=new i.DataTexture(new Uint32Array(a.buffer),D.width,D.height,i.RGBAIntegerFormat,i.UnsignedIntType);return L.internalFormat="RGBA32UI",L.needsUpdate=!0,L});this.#g=t[0],this.#Q=t[1],this.#C=t[2]}}class pI extends IA{sparseFadeFactor=.1;denseFadeFactor=.1;denseTimeDelay=3;speedFactor=.25;minimumPointSize=2;#A;#I=0;#g=0;#Q=0;#C=0;#B=0;#E=0;#D=0;#i=0;#w=0;constructor(){super(),this._uniforms.push("D","i","p","n"),this._defines.push("RFIA","RFIA_SS")}dispose(){super.dispose(),this.#A&&(this.#A.stop(),this.#A=void 0)}stop(){this.state==V.PLAYING&&(this.#I=0,this.#g=0,this.#Q=0,this.#C=0,this.#B=0,this.#E=0,this.#D=0,this.#i=0,this.#w=0,this.#A&&(this.#A.stop(),this.#A=void 0)),super.stop()}init(A){A.uniforms.D={value:new i.Vector2},A.uniforms.i={value:new i.Vector2},A.uniforms.p={value:new i.Vector2},A.uniforms.n={value:new i.Vector3},A.defines[this._defines[0]]=1}update(A,I){if(this.state!=V.PLAYING)return;const Q=A.getCloudAt(0),C=Q.buffer,E=A.material;this.#A||(this.#A=new i.Clock,this.speedFactor=FA.clamp(this.speedFactor,.01,1),this.sparseFadeFactor=FA.clamp(this.sparseFadeFactor,0,.99),this.denseFadeFactor=FA.clamp(this.denseFadeFactor,0,.99),E.uniforms.n.value.copy(Q.sceneCenter.clone()),E.defines[this._defines[1]]!=this.minimumPointSize&&(E.defines[this._defines[1]]=this.minimumPointSize,E.needsUpdate=!0));const D=C.getMaximumRadius()*1.05;if(this.#I>=.99&&this.#g>=.99&&this.#B>=D&&this.#i>=D){this.#A.stop(),this.#A=void 0,this.setState(V.COMPLETED);return}const w=Math.max(C.getCurrentRadius(),.001),o=this.#A.getElapsedTime();this.#I=this.#I*.9+w*.1,this.#g=this.#g*.95+w*.05,this.#Q=1/(this.#I-this.#g);let G=Math.max(this.#G(o)*D,.001);this.#C=G*(1+this.sparseFadeFactor),this.#B=G*(1-this.sparseFadeFactor),this.#E=1/(this.#C-this.#B),G=Math.max(this.#G(Math.max(o-this.denseTimeDelay,0))*D,.001),this.#D=G*(1+this.denseFadeFactor),this.#i=G*(1-this.denseFadeFactor),this.#w=1/(this.#D-this.#i),E.uniforms.i.value.set(this.#I,this.#Q),E.uniforms.p.value.set(this.#C,this.#E),E.uniforms.D.value.set(this.#D,this.#w),E.uniformsNeedUpdate=!0,this.dispatchChange()}#G(A){return Math.pow(A*this.speedFactor,2.5)}}new i.Matrix4,new i.Euler(0,0,0,"YXZ"),new i.Quaternion,new i.Vector3;const gA=32,GA=5;class TI{data;size;constructor(A,I=A.length*gA){this.data=A,this.size=I}get(A){if(A<0||A>=this.size)return!1;const I=A>>>GA,Q=A&gA-1;return(this.data[I]>>>Q&1)!==0}set(A,I){if(A<0||A>=this.size)return;const Q=A>>>GA,C=A&gA-1;I?this.data[Q]|=1<<C:this.data[Q]&=~(1<<C)}has(A){if(A<0||A>=this.size)return!1;const I=A>>>GA,Q=A&gA-1;return(this.data[I]&1<<Q)!==0}getIndicesArray(){return Array.from(this.indices())}*indices(){for(let A=0,I=this.data.length;A<I;A++){let Q=this.data[A]|0;for(;Q!==0;){const C=Q&-Q,E=gA-1-Math.clz32(C);yield A<<GA|E,Q&=Q-1}}}toString(){let A="";for(const I of this.indices()){for(;A.length<I;)A+="0";A+="1"}return A.padEnd(this.size,"0")}}const ZI=new i.Vector3(-1,-1,1),lI="0.1.40";export{IA as AnimationFx,VI as AntialiasingFx,TI as BitArray,AA as Fx,ZI as GLOBAL_SCALE,jA as GaussianCloud,l as GaussianCloudLoader,oA as GaussianSplattingGroup,fA as GaussianState,pI as RadialFadeInAnimationFx,xI as SphericalHarmonicsFx,V as StateFx,lI as version};