@loaders.gl/draco
Advanced tools
Comparing version 4.0.0-alpha.17 to 4.0.0-alpha.18
@@ -1,4 +0,4 @@ | ||
(()=>{var ft=Object.create;var D=Object.defineProperty;var bt=Object.getOwnPropertyDescriptor;var ht=Object.getOwnPropertyNames;var At=Object.getPrototypeOf,gt=Object.prototype.hasOwnProperty;var B=o=>D(o,"__esModule",{value:!0});var u=(o,t)=>()=>(o&&(t=o(o=0)),t);var k=(o,t)=>()=>(t||o((t={exports:{}}).exports,t),t.exports),Dt=(o,t)=>{B(o);for(var e in t)D(o,e,{get:t[e],enumerable:!0})},_t=(o,t,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ht(t))!gt.call(o,r)&&r!=="default"&&D(o,r,{get:()=>t[r],enumerable:!(e=bt(t,r))||e.enumerable});return o},Tt=o=>_t(B(D(o!=null?ft(At(o)):{},"default",o&&o.__esModule&&"default"in o?{get:()=>o.default,enumerable:!0}:{value:o,enumerable:!0})),o);var f,_=u(()=>{f=typeof __VERSION__!="undefined"?__VERSION__:"latest"});var Mt,E,C=u(()=>{_();Mt={draco:{decoderType:typeof WebAssembly=="object"?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}},E={name:"Draco",id:"draco",module:"draco",version:f,worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:Mt}});function F(o){switch(o.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}var U=u(()=>{});function I(o){let t=1/0,e=1/0,r=1/0,a=-1/0,n=-1/0,i=-1/0,s=o.POSITION?o.POSITION.value:[],c=s&&s.length;for(let d=0;d<c;d+=3){let l=s[d],p=s[d+1],m=s[d+2];t=l<t?l:t,e=p<e?p:e,r=m<r?m:r,a=l>a?l:a,n=p>n?p:n,i=m>i?m:i}return[[t,e,r],[a,n,i]]}var z=u(()=>{});function R(o,t,e){let r=F(t.value),a=e||W(t);return{name:o,type:{type:"fixed-size-list",listSize:t.size,children:[{name:"value",type:r}]},nullable:!1,metadata:a}}function W(o){let t={};return"byteOffset"in o&&(t.byteOffset=o.byteOffset.toString(10)),"byteStride"in o&&(t.byteStride=o.byteStride.toString(10)),"normalized"in o&&(t.normalized=o.normalized.toString()),t}var v=u(()=>{U()});var x=u(()=>{z();v()});function G(o,t,e){let r=q(t.metadata),a=[],n=Ot(t.attributes);for(let i in o){let s=o[i],c=j(i,s,n[i]);a.push(c)}if(e){let i=j("indices",e);a.push(i)}return{fields:a,metadata:r}}function Ot(o){let t={};for(let e in o){let r=o[e];t[r.name||"undefined"]=r}return t}function j(o,t,e){let r=e?q(e.metadata):void 0;return R(o,t,r)}function q(o){Object.entries(o);let t={};for(let e in o)t[`${e}.string`]=JSON.stringify(o[e]);return t}var V=u(()=>{x()});function It(o,t){switch(t){case Float32Array:return o.DT_FLOAT32;case Int8Array:return o.DT_INT8;case Int16Array:return o.DT_INT16;case Int32Array:return o.DT_INT32;case Uint8Array:return o.DT_UINT8;case Uint16Array:return o.DT_UINT16;case Uint32Array:return o.DT_UINT32;default:return o.DT_INVALID}}function Rt(o){let t=o.size(),e=new Int32Array(t);for(let r=0;r<t;r++)e[r]=o.GetValue(r);return e}function xt(o){let t=o.size(),e=new Int32Array(t);for(let r=0;r<t;r++)e[r]=o.GetValue(r);return e}var $,wt,Et,T,Q=u(()=>{x();V();$={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},wt={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},Et=4,T=class{constructor(t){this.draco=t,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(t,e={}){let r=new this.draco.DecoderBuffer;r.Init(new Int8Array(t),t.byteLength),this._disableAttributeTransforms(e);let a=this.decoder.GetEncodedGeometryType(r),n=a===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let i;switch(a){case this.draco.TRIANGULAR_MESH:i=this.decoder.DecodeBufferToMesh(r,n);break;case this.draco.POINT_CLOUD:i=this.decoder.DecodeBufferToPointCloud(r,n);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!i.ok()||!n.ptr){let m=`DRACO decompression failed: ${i.error_msg()}`;throw new Error(m)}let s=this._getDracoLoaderData(n,a,e),c=this._getMeshData(n,s,e),d=I(c.attributes),l=G(c.attributes,s,c.indices);return{loader:"draco",loaderData:s,header:{vertexCount:n.num_points(),boundingBox:d},...c,schema:l}}finally{this.draco.destroy(r),n&&this.draco.destroy(n)}}_getDracoLoaderData(t,e,r){let a=this._getTopLevelMetadata(t),n=this._getDracoAttributes(t,r);return{geometry_type:e,num_attributes:t.num_attributes(),num_points:t.num_points(),num_faces:t instanceof this.draco.Mesh?t.num_faces():0,metadata:a,attributes:n}}_getDracoAttributes(t,e){let r={};for(let a=0;a<t.num_attributes();a++){let n=this.decoder.GetAttribute(t,a),i=this._getAttributeMetadata(t,a);r[n.unique_id()]={unique_id:n.unique_id(),attribute_type:n.attribute_type(),data_type:n.data_type(),num_components:n.num_components(),byte_offset:n.byte_offset(),byte_stride:n.byte_stride(),normalized:n.normalized(),attribute_index:a,metadata:i};let s=this._getQuantizationTransform(n,e);s&&(r[n.unique_id()].quantization_transform=s);let c=this._getOctahedronTransform(n,e);c&&(r[n.unique_id()].octahedron_transform=c)}return r}_getMeshData(t,e,r){let a=this._getMeshAttributes(e,t,r);if(!a.POSITION)throw new Error("DRACO: No position attribute found.");if(t instanceof this.draco.Mesh)switch(r.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:a,indices:{value:this._getTriangleStripIndices(t),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:a,indices:{value:this._getTriangleListIndices(t),size:1}}}return{topology:"point-list",mode:0,attributes:a}}_getMeshAttributes(t,e,r){let a={};for(let n of Object.values(t.attributes)){let i=this._deduceAttributeName(n,r);n.name=i;let{value:s,size:c}=this._getAttributeValues(e,n);a[i]={value:s,size:c,byteOffset:n.byte_offset,byteStride:n.byte_stride,normalized:n.normalized}}return a}_getTriangleListIndices(t){let r=t.num_faces()*3,a=r*Et,n=this.draco._malloc(a);try{return this.decoder.GetTrianglesUInt32Array(t,a,n),new Uint32Array(this.draco.HEAPF32.buffer,n,r).slice()}finally{this.draco._free(n)}}_getTriangleStripIndices(t){let e=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(t,e),xt(e)}finally{this.draco.destroy(e)}}_getAttributeValues(t,e){let r=wt[e.data_type],a=e.num_components,i=t.num_points()*a,s=i*r.BYTES_PER_ELEMENT,c=It(this.draco,r),d,l=this.draco._malloc(s);try{let p=this.decoder.GetAttribute(t,e.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(t,p,c,s,l),d=new r(this.draco.HEAPF32.buffer,l,i).slice()}finally{this.draco._free(l)}return{value:d,size:a}}_deduceAttributeName(t,e){let r=t.unique_id;for(let[i,s]of Object.entries(e.extraAttributes||{}))if(s===r)return i;let a=t.attribute_type;for(let i in $)if(this.draco[i]===a)return $[i];let n=e.attributeNameEntry||"name";return t.metadata[n]?t.metadata[n].string:`CUSTOM_ATTRIBUTE_${r}`}_getTopLevelMetadata(t){let e=this.decoder.GetMetadata(t);return this._getDracoMetadata(e)}_getAttributeMetadata(t,e){let r=this.decoder.GetAttributeMetadata(t,e);return this._getDracoMetadata(r)}_getDracoMetadata(t){if(!t||!t.ptr)return{};let e={},r=this.metadataQuerier.NumEntries(t);for(let a=0;a<r;a++){let n=this.metadataQuerier.GetEntryName(t,a);e[n]=this._getDracoMetadataField(t,n)}return e}_getDracoMetadataField(t,e){let r=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(t,e,r);let a=Rt(r);return{int:this.metadataQuerier.GetIntEntry(t,e),string:this.metadataQuerier.GetStringEntry(t,e),double:this.metadataQuerier.GetDoubleEntry(t,e),intArray:a}}finally{this.draco.destroy(r)}}_disableAttributeTransforms(t){let{quantizedAttributes:e=[],octahedronAttributes:r=[]}=t,a=[...e,...r];for(let n of a)this.decoder.SkipAttributeTransform(this.draco[n])}_getQuantizationTransform(t,e){let{quantizedAttributes:r=[]}=e,a=t.attribute_type();if(r.map(i=>this.decoder[i]).includes(a)){let i=new this.draco.AttributeQuantizationTransform;try{if(i.InitFromAttribute(t))return{quantization_bits:i.quantization_bits(),range:i.range(),min_values:new Float32Array([1,2,3]).map(s=>i.min_value(s))}}finally{this.draco.destroy(i)}}return null}_getOctahedronTransform(t,e){let{octahedronAttributes:r=[]}=e,a=t.attribute_type();if(r.map(i=>this.decoder[i]).includes(a)){let i=new this.draco.AttributeQuantizationTransform;try{if(i.InitFromAttribute(t))return{quantization_bits:i.quantization_bits()}}finally{this.draco.destroy(i)}}return null}}});var Lt,L,X=u(()=>{Lt="beta",L=typeof __VERSION__!="undefined"?__VERSION__:Lt;typeof __VERSION__=="undefined"&&console.error("loaders.gl: The __VERSION__ variable is not injected using babel plugin. Latest unstable workers would be fetched from the CDN.")});function Y(o,t){if(!o)throw new Error(t||"loaders.gl assertion failed.")}var H=u(()=>{});var y,De,_e,J,Te,M,O,Me,Z,Oe,K=u(()=>{y={self:typeof self!="undefined"&&self,window:typeof window!="undefined"&&window,global:typeof global!="undefined"&&global,document:typeof document!="undefined"&&document},De=y.self||y.window||y.global||{},_e=y.window||y.self||y.global||{},J=y.global||y.self||y.window||{},Te=y.document||{},M=typeof process!="object"||String(process)!=="[object process]"||process.browser,O=typeof importScripts=="function",Me=typeof window!="undefined"&&typeof window.orientation!="undefined",Z=typeof process!="undefined"&&process.version&&/v([0-9]*)/.exec(process.version),Oe=Z&&parseFloat(Z[1])||0});var tt=k(()=>{});async function b(o,t=null,e={}){return t&&(o=et(o,t,e)),P[o]=P[o]||St(o),await P[o]}function et(o,t,e){if(o.startsWith("http"))return o;let r=e.modules||{};return r[o]?r[o]:M?e.CDN?(Y(e.CDN.startsWith("http")),`${e.CDN}/${t}@${Nt}/dist/libs/${o}`):O?`../src/libs/${o}`:`modules/${t}/src/libs/${o}`:`modules/${t}/dist/libs/${o}`}async function St(o){if(o.endsWith("wasm"))return await(await fetch(o)).arrayBuffer();if(!M)try{return h&&h.requireFromFile&&await h.requireFromFile(o)}catch{return null}if(O)return importScripts(o);let e=await(await fetch(o)).text();return Bt(e,o)}function Bt(o,t){if(!M)return h.requireFromString&&h.requireFromString(o,t);if(O)return eval.call(J,o),null;let e=document.createElement("script");e.id=t;try{e.appendChild(document.createTextNode(o))}catch{e.text=o}return document.body.appendChild(e),null}var h,Pt,Nt,P,rt=u(()=>{K();h=Tt(tt());H();X();Pt="beta",Nt=typeof L!="undefined"?L:Pt,P={}});var ot=u(()=>{rt()});async function at(o){let t=o.modules||{};return t.draco3d?A=A||t.draco3d.createDecoderModule({}).then(e=>({draco:e})):A=A||vt(o),await A}async function nt(o){let t=o.modules||{};return t.draco3d?g=g||t.draco3d.createEncoderModule({}).then(e=>({draco:e})):g=g||jt(o),await g}async function vt(o){let t,e;switch(o.draco&&o.draco.decoderType){case"js":t=await b(Ft,"draco",o);break;case"wasm":default:[t,e]=await Promise.all([await b(Ut,"draco",o),await b(zt,"draco",o)])}return t=t||globalThis.DracoDecoderModule,await Gt(t,e)}function Gt(o,t){let e={};return t&&(e.wasmBinary=t),new Promise(r=>{o({...e,onModuleLoaded:a=>r({draco:a})})})}async function jt(o){let t=await b(Wt,"draco",o);return t=t||globalThis.DracoEncoderModule,new Promise(e=>{t({onModuleLoaded:r=>e({draco:r})})})}var kt,Ct,N,Ft,Ut,zt,Wt,A,g,S=u(()=>{ot();kt="1.5.5",Ct="1.4.1",N=`https://www.gstatic.com/draco/versioned/decoders/${kt}`,Ft=`${N}/draco_decoder.js`,Ut=`${N}/draco_wasm_wrapper.js`,zt=`${N}/draco_decoder.wasm`,Wt=`https://raw.githubusercontent.com/google/draco/${Ct}/javascript/draco_encoder.js`});function st(o){let t=o.size(),e=new ArrayBuffer(t),r=new Int8Array(e);for(let a=0;a<t;++a)r[a]=o.GetValue(a);return e}function Vt(o){return o.entries&&!o.hasOwnProperty("entries")?o.entries():Object.entries(o)}var it,qt,w,ct=u(()=>{it={POSITION:"POSITION",NORMAL:"NORMAL",COLOR_0:"COLOR",TEXCOORD_0:"TEX_COORD"},qt=()=>{},w=class{constructor(t){this.draco=t,this.dracoEncoder=new this.draco.Encoder,this.dracoMeshBuilder=new this.draco.MeshBuilder,this.dracoMetadataBuilder=new this.draco.MetadataBuilder}destroy(){this.destroyEncodedObject(this.dracoMeshBuilder),this.destroyEncodedObject(this.dracoEncoder),this.destroyEncodedObject(this.dracoMetadataBuilder),this.dracoMeshBuilder=null,this.dracoEncoder=null,this.draco=null}destroyEncodedObject(t){t&&this.draco.destroy(t)}encodeSync(t,e={}){return this.log=qt,this._setOptions(e),e.pointcloud?this._encodePointCloud(t,e):this._encodeMesh(t,e)}_getAttributesFromMesh(t){let e={...t,...t.attributes};return t.indices&&(e.indices=t.indices),e}_encodePointCloud(t,e){let r=new this.draco.PointCloud;e.metadata&&this._addGeometryMetadata(r,e.metadata);let a=this._getAttributesFromMesh(t);this._createDracoPointCloud(r,a,e);let n=new this.draco.DracoInt8Array;try{let i=this.dracoEncoder.EncodePointCloudToDracoBuffer(r,!1,n);if(!(i>0))throw new Error("Draco encoding failed.");return this.log(`DRACO encoded ${r.num_points()} points | ||
with ${r.num_attributes()} attributes into ${i} bytes`),st(n)}finally{this.destroyEncodedObject(n),this.destroyEncodedObject(r)}}_encodeMesh(t,e){let r=new this.draco.Mesh;e.metadata&&this._addGeometryMetadata(r,e.metadata);let a=this._getAttributesFromMesh(t);this._createDracoMesh(r,a,e);let n=new this.draco.DracoInt8Array;try{let i=this.dracoEncoder.EncodeMeshToDracoBuffer(r,n);if(i<=0)throw new Error("Draco encoding failed.");return this.log(`DRACO encoded ${r.num_points()} points | ||
with ${r.num_attributes()} attributes into ${i} bytes`),st(n)}finally{this.destroyEncodedObject(n),this.destroyEncodedObject(r)}}_setOptions(t){if("speed"in t&&this.dracoEncoder.SetSpeedOptions(...t.speed),"method"in t){let e=this.draco[t.method||"MESH_SEQUENTIAL_ENCODING"];this.dracoEncoder.SetEncodingMethod(e)}if("quantization"in t)for(let e in t.quantization){let r=t.quantization[e],a=this.draco[e];this.dracoEncoder.SetAttributeQuantization(a,r)}}_createDracoMesh(t,e,r){let a=r.attributesMetadata||{};try{let n=this._getPositionAttribute(e);if(!n)throw new Error("positions");let i=n.length/3;for(let s in e){let c=e[s];s=it[s]||s;let d=this._addAttributeToMesh(t,s,c,i);d!==-1&&this._addAttributeMetadata(t,d,{name:s,...a[s]||{}})}}catch(n){throw this.destroyEncodedObject(t),n}return t}_createDracoPointCloud(t,e,r){let a=r.attributesMetadata||{};try{let n=this._getPositionAttribute(e);if(!n)throw new Error("positions");let i=n.length/3;for(let s in e){let c=e[s];s=it[s]||s;let d=this._addAttributeToMesh(t,s,c,i);d!==-1&&this._addAttributeMetadata(t,d,{name:s,...a[s]||{}})}}catch(n){throw this.destroyEncodedObject(t),n}return t}_addAttributeToMesh(t,e,r,a){if(!ArrayBuffer.isView(r))return-1;let n=this._getDracoAttributeType(e),i=r.length/a;if(n==="indices"){let d=r.length/3;return this.log(`Adding attribute ${e}, size ${d}`),this.dracoMeshBuilder.AddFacesToMesh(t,d,r),-1}this.log(`Adding attribute ${e}, size ${i}`);let s=this.dracoMeshBuilder,{buffer:c}=r;switch(r.constructor){case Int8Array:return s.AddInt8Attribute(t,n,a,i,new Int8Array(c));case Int16Array:return s.AddInt16Attribute(t,n,a,i,new Int16Array(c));case Int32Array:return s.AddInt32Attribute(t,n,a,i,new Int32Array(c));case Uint8Array:case Uint8ClampedArray:return s.AddUInt8Attribute(t,n,a,i,new Uint8Array(c));case Uint16Array:return s.AddUInt16Attribute(t,n,a,i,new Uint16Array(c));case Uint32Array:return s.AddUInt32Attribute(t,n,a,i,new Uint32Array(c));case Float32Array:default:return s.AddFloatAttribute(t,n,a,i,new Float32Array(c))}}_getDracoAttributeType(t){switch(t.toLowerCase()){case"indices":return"indices";case"position":case"positions":case"vertices":return this.draco.POSITION;case"normal":case"normals":return this.draco.NORMAL;case"color":case"colors":return this.draco.COLOR;case"texcoord":case"texcoords":return this.draco.TEX_COORD;default:return this.draco.GENERIC}}_getPositionAttribute(t){for(let e in t){let r=t[e];if(this._getDracoAttributeType(e)===this.draco.POSITION)return r}return null}_addGeometryMetadata(t,e){let r=new this.draco.Metadata;this._populateDracoMetadata(r,e),this.dracoMeshBuilder.AddMetadata(t,r)}_addAttributeMetadata(t,e,r){let a=new this.draco.Metadata;this._populateDracoMetadata(a,r),this.dracoMeshBuilder.SetMetadataForAttribute(t,e,a)}_populateDracoMetadata(t,e){for(let[r,a]of Vt(e))switch(typeof a){case"number":Math.trunc(a)===a?this.dracoMetadataBuilder.AddIntEntry(t,r,a):this.dracoMetadataBuilder.AddDoubleEntry(t,r,a);break;case"object":a instanceof Int32Array&&this.dracoMetadataBuilder.AddIntEntryArray(t,r,a,a.length);break;case"string":default:this.dracoMetadataBuilder.AddStringEntry(t,r,a)}}}});async function Qt(o,t={}){let{draco:e}=await nt(t),r=new w(e);try{return r.encodeSync(o,t.draco)}finally{r.destroy()}}var $t,dt,ut=u(()=>{ct();S();_();$t={pointcloud:!1,attributeNameEntry:"name"},dt={name:"DRACO",id:"draco",module:"draco",version:f,extensions:["drc"],encode:Qt,options:{draco:$t}}});var yt={};Dt(yt,{DracoLoader:()=>lt,DracoWorkerLoader:()=>E,DracoWriter:()=>dt,DracoWriterWorker:()=>Xt,_TypecheckDracoLoader:()=>Ht});async function Yt(o,t){let{draco:e}=await at(t),r=new T(e);try{return r.parseSync(o,t?.draco)}finally{r.destroy()}}var Xt,lt,Ht,pt=u(()=>{C();Q();S();_();ut();Xt={id:"draco-writer",name:"Draco compressed geometry writer",module:"draco",version:f,worker:!0,options:{draco:{},source:null}},lt={...E,parse:Yt};Ht=lt});var Zt=k(($e,mt)=>{var Jt=(pt(),yt);globalThis.loaders=globalThis.loaders||{};mt.exports=Object.assign(globalThis.loaders,Jt)});Zt();})(); | ||
(()=>{var ft=Object.create;var D=Object.defineProperty;var bt=Object.getOwnPropertyDescriptor;var ht=Object.getOwnPropertyNames;var At=Object.getPrototypeOf,gt=Object.prototype.hasOwnProperty;var B=r=>D(r,"__esModule",{value:!0});var u=(r,t)=>()=>(r&&(t=r(r=0)),t);var F=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),Dt=(r,t)=>{B(r);for(var e in t)D(r,e,{get:t[e],enumerable:!0})},_t=(r,t,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ht(t))!gt.call(r,o)&&o!=="default"&&D(r,o,{get:()=>t[o],enumerable:!(e=bt(t,o))||e.enumerable});return r},Tt=r=>_t(B(D(r!=null?ft(At(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var b,_=u(()=>{b=typeof __VERSION__!="undefined"?__VERSION__:"latest"});var Mt,E,k=u(()=>{_();Mt={draco:{decoderType:typeof WebAssembly=="object"?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}},E={name:"Draco",id:"draco",module:"draco",version:b,worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:Mt}});function C(r){switch(r.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}var U=u(()=>{});function I(r){let t=1/0,e=1/0,o=1/0,a=-1/0,n=-1/0,i=-1/0,s=r.POSITION?r.POSITION.value:[],c=s&&s.length;for(let d=0;d<c;d+=3){let l=s[d],m=s[d+1],f=s[d+2];t=l<t?l:t,e=m<e?m:e,o=f<o?f:o,a=l>a?l:a,n=m>n?m:n,i=f>i?f:i}return[[t,e,o],[a,n,i]]}var z=u(()=>{});function x(r,t,e){let o=C(t.value),a=e||W(t);return{name:r,type:{type:"fixed-size-list",listSize:t.size,children:[{name:"value",type:o}]},nullable:!1,metadata:a}}function W(r){let t={};return"byteOffset"in r&&(t.byteOffset=r.byteOffset.toString(10)),"byteStride"in r&&(t.byteStride=r.byteStride.toString(10)),"normalized"in r&&(t.normalized=r.normalized.toString()),t}var v=u(()=>{U()});var R=u(()=>{z();v()});function G(r,t,e){let o=q(t.metadata),a=[],n=Ot(t.attributes);for(let i in r){let s=r[i],c=j(i,s,n[i]);a.push(c)}if(e){let i=j("indices",e);a.push(i)}return{fields:a,metadata:o}}function Ot(r){let t={};for(let e in r){let o=r[e];t[o.name||"undefined"]=o}return t}function j(r,t,e){let o=e?q(e.metadata):void 0;return x(r,t,o)}function q(r){Object.entries(r);let t={};for(let e in r)t[`${e}.string`]=JSON.stringify(r[e]);return t}var V=u(()=>{R()});function It(r,t){switch(t){case Float32Array:return r.DT_FLOAT32;case Int8Array:return r.DT_INT8;case Int16Array:return r.DT_INT16;case Int32Array:return r.DT_INT32;case Uint8Array:return r.DT_UINT8;case Uint16Array:return r.DT_UINT16;case Uint32Array:return r.DT_UINT32;default:return r.DT_INVALID}}function xt(r){let t=r.size(),e=new Int32Array(t);for(let o=0;o<t;o++)e[o]=r.GetValue(o);return e}function Rt(r){let t=r.size(),e=new Int32Array(t);for(let o=0;o<t;o++)e[o]=r.GetValue(o);return e}var $,wt,Et,T,Q=u(()=>{R();V();$={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},wt={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},Et=4,T=class{constructor(t){this.draco=t,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(t,e={}){let o=new this.draco.DecoderBuffer;o.Init(new Int8Array(t),t.byteLength),this._disableAttributeTransforms(e);let a=this.decoder.GetEncodedGeometryType(o),n=a===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let i;switch(a){case this.draco.TRIANGULAR_MESH:i=this.decoder.DecodeBufferToMesh(o,n);break;case this.draco.POINT_CLOUD:i=this.decoder.DecodeBufferToPointCloud(o,n);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!i.ok()||!n.ptr){let f=`DRACO decompression failed: ${i.error_msg()}`;throw new Error(f)}let s=this._getDracoLoaderData(n,a,e),c=this._getMeshData(n,s,e),d=I(c.attributes),l=G(c.attributes,s,c.indices);return{loader:"draco",loaderData:s,header:{vertexCount:n.num_points(),boundingBox:d},...c,schema:l}}finally{this.draco.destroy(o),n&&this.draco.destroy(n)}}_getDracoLoaderData(t,e,o){let a=this._getTopLevelMetadata(t),n=this._getDracoAttributes(t,o);return{geometry_type:e,num_attributes:t.num_attributes(),num_points:t.num_points(),num_faces:t instanceof this.draco.Mesh?t.num_faces():0,metadata:a,attributes:n}}_getDracoAttributes(t,e){let o={};for(let a=0;a<t.num_attributes();a++){let n=this.decoder.GetAttribute(t,a),i=this._getAttributeMetadata(t,a);o[n.unique_id()]={unique_id:n.unique_id(),attribute_type:n.attribute_type(),data_type:n.data_type(),num_components:n.num_components(),byte_offset:n.byte_offset(),byte_stride:n.byte_stride(),normalized:n.normalized(),attribute_index:a,metadata:i};let s=this._getQuantizationTransform(n,e);s&&(o[n.unique_id()].quantization_transform=s);let c=this._getOctahedronTransform(n,e);c&&(o[n.unique_id()].octahedron_transform=c)}return o}_getMeshData(t,e,o){let a=this._getMeshAttributes(e,t,o);if(!a.POSITION)throw new Error("DRACO: No position attribute found.");if(t instanceof this.draco.Mesh)switch(o.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:a,indices:{value:this._getTriangleStripIndices(t),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:a,indices:{value:this._getTriangleListIndices(t),size:1}}}return{topology:"point-list",mode:0,attributes:a}}_getMeshAttributes(t,e,o){let a={};for(let n of Object.values(t.attributes)){let i=this._deduceAttributeName(n,o);n.name=i;let{value:s,size:c}=this._getAttributeValues(e,n);a[i]={value:s,size:c,byteOffset:n.byte_offset,byteStride:n.byte_stride,normalized:n.normalized}}return a}_getTriangleListIndices(t){let o=t.num_faces()*3,a=o*Et,n=this.draco._malloc(a);try{return this.decoder.GetTrianglesUInt32Array(t,a,n),new Uint32Array(this.draco.HEAPF32.buffer,n,o).slice()}finally{this.draco._free(n)}}_getTriangleStripIndices(t){let e=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(t,e),Rt(e)}finally{this.draco.destroy(e)}}_getAttributeValues(t,e){let o=wt[e.data_type],a=e.num_components,i=t.num_points()*a,s=i*o.BYTES_PER_ELEMENT,c=It(this.draco,o),d,l=this.draco._malloc(s);try{let m=this.decoder.GetAttribute(t,e.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(t,m,c,s,l),d=new o(this.draco.HEAPF32.buffer,l,i).slice()}finally{this.draco._free(l)}return{value:d,size:a}}_deduceAttributeName(t,e){let o=t.unique_id;for(let[i,s]of Object.entries(e.extraAttributes||{}))if(s===o)return i;let a=t.attribute_type;for(let i in $)if(this.draco[i]===a)return $[i];let n=e.attributeNameEntry||"name";return t.metadata[n]?t.metadata[n].string:`CUSTOM_ATTRIBUTE_${o}`}_getTopLevelMetadata(t){let e=this.decoder.GetMetadata(t);return this._getDracoMetadata(e)}_getAttributeMetadata(t,e){let o=this.decoder.GetAttributeMetadata(t,e);return this._getDracoMetadata(o)}_getDracoMetadata(t){if(!t||!t.ptr)return{};let e={},o=this.metadataQuerier.NumEntries(t);for(let a=0;a<o;a++){let n=this.metadataQuerier.GetEntryName(t,a);e[n]=this._getDracoMetadataField(t,n)}return e}_getDracoMetadataField(t,e){let o=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(t,e,o);let a=xt(o);return{int:this.metadataQuerier.GetIntEntry(t,e),string:this.metadataQuerier.GetStringEntry(t,e),double:this.metadataQuerier.GetDoubleEntry(t,e),intArray:a}}finally{this.draco.destroy(o)}}_disableAttributeTransforms(t){let{quantizedAttributes:e=[],octahedronAttributes:o=[]}=t,a=[...e,...o];for(let n of a)this.decoder.SkipAttributeTransform(this.draco[n])}_getQuantizationTransform(t,e){let{quantizedAttributes:o=[]}=e,a=t.attribute_type();if(o.map(i=>this.decoder[i]).includes(a)){let i=new this.draco.AttributeQuantizationTransform;try{if(i.InitFromAttribute(t))return{quantization_bits:i.quantization_bits(),range:i.range(),min_values:new Float32Array([1,2,3]).map(s=>i.min_value(s))}}finally{this.draco.destroy(i)}}return null}_getOctahedronTransform(t,e){let{octahedronAttributes:o=[]}=e,a=t.attribute_type();if(o.map(i=>this.decoder[i]).includes(a)){let i=new this.draco.AttributeQuantizationTransform;try{if(i.InitFromAttribute(t))return{quantization_bits:i.quantization_bits()}}finally{this.draco.destroy(i)}}return null}}});var Pt,P,X=u(()=>{Pt="beta",P=typeof __VERSION__!="undefined"?__VERSION__:Pt;typeof __VERSION__=="undefined"&&console.error("loaders.gl: The __VERSION__ variable is not injected using babel plugin. Latest unstable workers would be fetched from the CDN.")});function Y(r,t){if(!r)throw new Error(t||"loaders.gl assertion failed.")}var H=u(()=>{});var y,Te,Me,J,Oe,M,O,we,Z,Ee,K=u(()=>{y={self:typeof self!="undefined"&&self,window:typeof window!="undefined"&&window,global:typeof global!="undefined"&&global,document:typeof document!="undefined"&&document},Te=y.self||y.window||y.global||{},Me=y.window||y.self||y.global||{},J=y.global||y.self||y.window||{},Oe=y.document||{},M=typeof process!="object"||String(process)!=="[object process]"||process.browser,O=typeof importScripts=="function",we=typeof window!="undefined"&&typeof window.orientation!="undefined",Z=typeof process!="undefined"&&process.version&&/v([0-9]*)/.exec(process.version),Ee=Z&&parseFloat(Z[1])||0});var tt=F(()=>{});async function h(r,t=null,e={}){return t&&(r=et(r,t,e)),L[r]=L[r]||St(r),await L[r]}function et(r,t,e){if(r.startsWith("http"))return r;let o=e.modules||{};return o[r]?o[r]:M?e.CDN?(Y(e.CDN.startsWith("http")),`${e.CDN}/${t}@${Nt}/dist/libs/${r}`):O?`../src/libs/${r}`:`modules/${t}/src/libs/${r}`:`modules/${t}/dist/libs/${r}`}async function St(r){if(r.endsWith("wasm"))return await Ft(r);if(!M)try{return p&&p.requireFromFile&&await p.requireFromFile(r)}catch{return null}if(O)return importScripts(r);let t=await kt(r);return Bt(t,r)}function Bt(r,t){if(!M)return p.requireFromString&&p.requireFromString(r,t);if(O)return eval.call(J,r),null;let e=document.createElement("script");e.id=t;try{e.appendChild(document.createTextNode(r))}catch{e.text=r}return document.body.appendChild(e),null}async function Ft(r){return!p.readFileAsArrayBuffer||r.startsWith("http")?await(await fetch(r)).arrayBuffer():await p.readFileAsArrayBuffer(r)}async function kt(r){return!p.readFileAsText||r.startsWith("http")?await(await fetch(r)).text():await p.readFileAsText(r)}var p,Lt,Nt,L,rt=u(()=>{K();p=Tt(tt());H();X();Lt="beta",Nt=typeof P!="undefined"?P:Lt,L={}});var ot=u(()=>{rt()});async function at(r){let t=r.modules||{};return t.draco3d?A=A||t.draco3d.createDecoderModule({}).then(e=>({draco:e})):A=A||jt(r),await A}async function nt(r){let t=r.modules||{};return t.draco3d?g=g||t.draco3d.createEncoderModule({}).then(e=>({draco:e})):g=g||Vt(r),await g}async function jt(r){let t,e;switch(r.draco&&r.draco.decoderType){case"js":t=await h(zt,"draco",r);break;case"wasm":default:[t,e]=await Promise.all([await h(Wt,"draco",r),await h(vt,"draco",r)])}return t=t||globalThis.DracoDecoderModule,await qt(t,e)}function qt(r,t){let e={};return t&&(e.wasmBinary=t),new Promise(o=>{r({...e,onModuleLoaded:a=>o({draco:a})})})}async function Vt(r){let t=await h(Gt,"draco",r);return t=t||globalThis.DracoEncoderModule,new Promise(e=>{t({onModuleLoaded:o=>e({draco:o})})})}var Ct,Ut,N,zt,Wt,vt,Gt,A,g,S=u(()=>{ot();Ct="1.5.5",Ut="1.4.1",N=`https://www.gstatic.com/draco/versioned/decoders/${Ct}`,zt=`${N}/draco_decoder.js`,Wt=`${N}/draco_wasm_wrapper.js`,vt=`${N}/draco_decoder.wasm`,Gt=`https://raw.githubusercontent.com/google/draco/${Ut}/javascript/draco_encoder.js`});function st(r){let t=r.size(),e=new ArrayBuffer(t),o=new Int8Array(e);for(let a=0;a<t;++a)o[a]=r.GetValue(a);return e}function Qt(r){return r.entries&&!r.hasOwnProperty("entries")?r.entries():Object.entries(r)}var it,$t,w,ct=u(()=>{it={POSITION:"POSITION",NORMAL:"NORMAL",COLOR_0:"COLOR",TEXCOORD_0:"TEX_COORD"},$t=()=>{},w=class{constructor(t){this.draco=t,this.dracoEncoder=new this.draco.Encoder,this.dracoMeshBuilder=new this.draco.MeshBuilder,this.dracoMetadataBuilder=new this.draco.MetadataBuilder}destroy(){this.destroyEncodedObject(this.dracoMeshBuilder),this.destroyEncodedObject(this.dracoEncoder),this.destroyEncodedObject(this.dracoMetadataBuilder),this.dracoMeshBuilder=null,this.dracoEncoder=null,this.draco=null}destroyEncodedObject(t){t&&this.draco.destroy(t)}encodeSync(t,e={}){return this.log=$t,this._setOptions(e),e.pointcloud?this._encodePointCloud(t,e):this._encodeMesh(t,e)}_getAttributesFromMesh(t){let e={...t,...t.attributes};return t.indices&&(e.indices=t.indices),e}_encodePointCloud(t,e){let o=new this.draco.PointCloud;e.metadata&&this._addGeometryMetadata(o,e.metadata);let a=this._getAttributesFromMesh(t);this._createDracoPointCloud(o,a,e);let n=new this.draco.DracoInt8Array;try{let i=this.dracoEncoder.EncodePointCloudToDracoBuffer(o,!1,n);if(!(i>0))throw new Error("Draco encoding failed.");return this.log(`DRACO encoded ${o.num_points()} points | ||
with ${o.num_attributes()} attributes into ${i} bytes`),st(n)}finally{this.destroyEncodedObject(n),this.destroyEncodedObject(o)}}_encodeMesh(t,e){let o=new this.draco.Mesh;e.metadata&&this._addGeometryMetadata(o,e.metadata);let a=this._getAttributesFromMesh(t);this._createDracoMesh(o,a,e);let n=new this.draco.DracoInt8Array;try{let i=this.dracoEncoder.EncodeMeshToDracoBuffer(o,n);if(i<=0)throw new Error("Draco encoding failed.");return this.log(`DRACO encoded ${o.num_points()} points | ||
with ${o.num_attributes()} attributes into ${i} bytes`),st(n)}finally{this.destroyEncodedObject(n),this.destroyEncodedObject(o)}}_setOptions(t){if("speed"in t&&this.dracoEncoder.SetSpeedOptions(...t.speed),"method"in t){let e=this.draco[t.method||"MESH_SEQUENTIAL_ENCODING"];this.dracoEncoder.SetEncodingMethod(e)}if("quantization"in t)for(let e in t.quantization){let o=t.quantization[e],a=this.draco[e];this.dracoEncoder.SetAttributeQuantization(a,o)}}_createDracoMesh(t,e,o){let a=o.attributesMetadata||{};try{let n=this._getPositionAttribute(e);if(!n)throw new Error("positions");let i=n.length/3;for(let s in e){let c=e[s];s=it[s]||s;let d=this._addAttributeToMesh(t,s,c,i);d!==-1&&this._addAttributeMetadata(t,d,{name:s,...a[s]||{}})}}catch(n){throw this.destroyEncodedObject(t),n}return t}_createDracoPointCloud(t,e,o){let a=o.attributesMetadata||{};try{let n=this._getPositionAttribute(e);if(!n)throw new Error("positions");let i=n.length/3;for(let s in e){let c=e[s];s=it[s]||s;let d=this._addAttributeToMesh(t,s,c,i);d!==-1&&this._addAttributeMetadata(t,d,{name:s,...a[s]||{}})}}catch(n){throw this.destroyEncodedObject(t),n}return t}_addAttributeToMesh(t,e,o,a){if(!ArrayBuffer.isView(o))return-1;let n=this._getDracoAttributeType(e),i=o.length/a;if(n==="indices"){let d=o.length/3;return this.log(`Adding attribute ${e}, size ${d}`),this.dracoMeshBuilder.AddFacesToMesh(t,d,o),-1}this.log(`Adding attribute ${e}, size ${i}`);let s=this.dracoMeshBuilder,{buffer:c}=o;switch(o.constructor){case Int8Array:return s.AddInt8Attribute(t,n,a,i,new Int8Array(c));case Int16Array:return s.AddInt16Attribute(t,n,a,i,new Int16Array(c));case Int32Array:return s.AddInt32Attribute(t,n,a,i,new Int32Array(c));case Uint8Array:case Uint8ClampedArray:return s.AddUInt8Attribute(t,n,a,i,new Uint8Array(c));case Uint16Array:return s.AddUInt16Attribute(t,n,a,i,new Uint16Array(c));case Uint32Array:return s.AddUInt32Attribute(t,n,a,i,new Uint32Array(c));case Float32Array:default:return s.AddFloatAttribute(t,n,a,i,new Float32Array(c))}}_getDracoAttributeType(t){switch(t.toLowerCase()){case"indices":return"indices";case"position":case"positions":case"vertices":return this.draco.POSITION;case"normal":case"normals":return this.draco.NORMAL;case"color":case"colors":return this.draco.COLOR;case"texcoord":case"texcoords":return this.draco.TEX_COORD;default:return this.draco.GENERIC}}_getPositionAttribute(t){for(let e in t){let o=t[e];if(this._getDracoAttributeType(e)===this.draco.POSITION)return o}return null}_addGeometryMetadata(t,e){let o=new this.draco.Metadata;this._populateDracoMetadata(o,e),this.dracoMeshBuilder.AddMetadata(t,o)}_addAttributeMetadata(t,e,o){let a=new this.draco.Metadata;this._populateDracoMetadata(a,o),this.dracoMeshBuilder.SetMetadataForAttribute(t,e,a)}_populateDracoMetadata(t,e){for(let[o,a]of Qt(e))switch(typeof a){case"number":Math.trunc(a)===a?this.dracoMetadataBuilder.AddIntEntry(t,o,a):this.dracoMetadataBuilder.AddDoubleEntry(t,o,a);break;case"object":a instanceof Int32Array&&this.dracoMetadataBuilder.AddIntEntryArray(t,o,a,a.length);break;case"string":default:this.dracoMetadataBuilder.AddStringEntry(t,o,a)}}}});async function Yt(r,t={}){let{draco:e}=await nt(t),o=new w(e);try{return o.encodeSync(r,t.draco)}finally{o.destroy()}}var Xt,dt,ut=u(()=>{ct();S();_();Xt={pointcloud:!1,attributeNameEntry:"name"},dt={name:"DRACO",id:"draco",module:"draco",version:b,extensions:["drc"],encode:Yt,options:{draco:Xt}}});var yt={};Dt(yt,{DracoLoader:()=>lt,DracoWorkerLoader:()=>E,DracoWriter:()=>dt,DracoWriterWorker:()=>Ht,_TypecheckDracoLoader:()=>Zt});async function Jt(r,t){let{draco:e}=await at(t),o=new T(e);try{return o.parseSync(r,t?.draco)}finally{o.destroy()}}var Ht,lt,Zt,pt=u(()=>{k();Q();S();_();ut();Ht={id:"draco-writer",name:"Draco compressed geometry writer",module:"draco",version:b,worker:!0,options:{draco:{},source:null}},lt={...E,parse:Jt};Zt=lt});var te=F((Xe,mt)=>{var Kt=(pt(),yt);globalThis.loaders=globalThis.loaders||{};mt.exports=Object.assign(globalThis.loaders,Kt)});te();})(); | ||
//# sourceMappingURL=dist.min.js.map |
@@ -1,2 +0,2 @@ | ||
(()=>{var j=Object.create;var _=Object.defineProperty;var Y=Object.getOwnPropertyDescriptor;var J=Object.getOwnPropertyNames;var X=Object.getPrototypeOf,H=Object.prototype.hasOwnProperty;var Z=t=>_(t,"__esModule",{value:!0});var K=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var ee=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of J(e))!H.call(t,o)&&o!=="default"&&_(t,o,{get:()=>e[o],enumerable:!(r=Y(e,o))||r.enumerable});return t},te=t=>ee(Z(_(t!=null?j(X(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var F=K(()=>{});var w="4.0.0-alpha.17";function E(t,e){if(!t)throw new Error(e||"loaders.gl assertion failed.")}var p={self:typeof self!="undefined"&&self,window:typeof window!="undefined"&&window,global:typeof global!="undefined"&&global,document:typeof document!="undefined"&&document},ke=p.self||p.window||p.global||{},Le=p.window||p.self||p.global||{},S=p.global||p.self||p.window||{},Pe=p.document||{};var A=typeof process!="object"||String(process)!=="[object process]"||process.browser,T=typeof importScripts=="function",Ee=typeof window!="undefined"&&typeof window.orientation!="undefined",R=typeof process!="undefined"&&process.version&&/v([0-9]*)/.exec(process.version),Se=R&&parseFloat(R[1])||0;function x(t,e=!0,r){let o=r||new Set;if(t){if(N(t))o.add(t);else if(N(t.buffer))o.add(t.buffer);else if(!ArrayBuffer.isView(t)){if(e&&typeof t=="object")for(let a in t)x(t[a],e,o)}}return r===void 0?Array.from(o):[]}function N(t){return t?t instanceof ArrayBuffer||typeof MessagePort!="undefined"&&t instanceof MessagePort||typeof ImageBitmap!="undefined"&&t instanceof ImageBitmap||typeof OffscreenCanvas!="undefined"&&t instanceof OffscreenCanvas:!1}function f(){let parentPort;try{eval("globalThis.parentPort = require('worker_threads').parentPort"),parentPort=globalThis.parentPort}catch{}return parentPort}var M=new Map,l=class{static inWorkerThread(){return typeof self!="undefined"||Boolean(f())}static set onmessage(e){function r(a){let s=f(),{type:n,payload:i}=s?a:a.data;e(n,i)}let o=f();o?(o.on("message",r),o.on("exit",()=>console.debug("Node worker closing"))):globalThis.onmessage=r}static addEventListener(e){let r=M.get(e);r||(r=a=>{if(!re(a))return;let s=f(),{type:n,payload:i}=s?a:a.data;e(n,i)}),f()?console.error("not implemented"):globalThis.addEventListener("message",r)}static removeEventListener(e){let r=M.get(e);M.delete(e),f()?console.error("not implemented"):globalThis.removeEventListener("message",r)}static postMessage(e,r){let o={source:"loaders.gl",type:e,payload:r},a=x(r),s=f();s?s.postMessage(o,a):globalThis.postMessage(o,a)}};function re(t){let{type:e,data:r}=t;return e==="message"&&r&&typeof r.source=="string"&&r.source.startsWith("loaders.gl")}var b=te(F());var oe="beta",ae=typeof w!="undefined"?w:oe,O={};async function g(t,e=null,r={}){return e&&(t=B(t,e,r)),O[t]=O[t]||se(t),await O[t]}function B(t,e,r){if(t.startsWith("http"))return t;let o=r.modules||{};return o[t]?o[t]:A?r.CDN?(E(r.CDN.startsWith("http")),`${r.CDN}/${e}@${ae}/dist/libs/${t}`):T?`../src/libs/${t}`:`modules/${e}/src/libs/${t}`:`modules/${e}/dist/libs/${t}`}async function se(t){if(t.endsWith("wasm"))return await(await fetch(t)).arrayBuffer();if(!A)try{return b&&b.requireFromFile&&await b.requireFromFile(t)}catch{return null}if(T)return importScripts(t);let r=await(await fetch(t)).text();return ne(r,t)}function ne(t,e){if(!A)return b.requireFromString&&b.requireFromString(t,e);if(T)return eval.call(S,t),null;let r=document.createElement("script");r.id=e;try{r.appendChild(document.createTextNode(t))}catch{r.text=t}return document.body.appendChild(r),null}var ie=0;function I(t){!l.inWorkerThread()||(l.onmessage=async(e,r)=>{switch(e){case"process":try{let{input:o,options:a={},context:s={}}=r,n=await le({loader:t,arrayBuffer:o,options:a,context:{...s,parse:ce}});l.postMessage("done",{result:n})}catch(o){let a=o instanceof Error?o.message:"";l.postMessage("error",{error:a})}break;default:}})}function ce(t,e){return new Promise((r,o)=>{let a=ie++,s=(i,c)=>{if(c.id===a)switch(i){case"done":l.removeEventListener(s),r(c.result);break;case"error":l.removeEventListener(s),o(c.error);break;default:}};l.addEventListener(s);let n={id:a,input:t,options:e};l.postMessage("process",n)})}async function le({loader:t,arrayBuffer:e,options:r,context:o}){let a,s;if(t.parseSync||t.parse)a=e,s=t.parseSync||t.parse;else if(t.parseTextSync)a=new TextDecoder().decode(e),s=t.parseTextSync;else throw new Error(`Could not load data with ${t.name} loader`);return r={...r,modules:t&&t.options&&t.options.modules||{},worker:!1},await s(a,{...r},o,t)}var W="4.0.0-alpha.17";var de={draco:{decoderType:typeof WebAssembly=="object"?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}},C={name:"Draco",id:"draco",module:"draco",version:W,worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:de};function v(t){switch(t.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}function k(t){let e=1/0,r=1/0,o=1/0,a=-1/0,s=-1/0,n=-1/0,i=t.POSITION?t.POSITION.value:[],c=i&&i.length;for(let d=0;d<c;d+=3){let u=i[d],y=i[d+1],m=i[d+2];e=u<e?u:e,r=y<r?y:r,o=m<o?m:o,a=u>a?u:a,s=y>s?y:s,n=m>n?m:n}return[[e,r,o],[a,s,n]]}function L(t,e,r){let o=v(e.value),a=r||z(e);return{name:t,type:{type:"fixed-size-list",listSize:e.size,children:[{name:"value",type:o}]},nullable:!1,metadata:a}}function z(t){let e={};return"byteOffset"in t&&(e.byteOffset=t.byteOffset.toString(10)),"byteStride"in t&&(e.byteStride=t.byteStride.toString(10)),"normalized"in t&&(e.normalized=t.normalized.toString()),e}function V(t,e,r){let o=q(e.metadata),a=[],s=ue(e.attributes);for(let n in t){let i=t[n],c=U(n,i,s[n]);a.push(c)}if(r){let n=U("indices",r);a.push(n)}return{fields:a,metadata:o}}function ue(t){let e={};for(let r in t){let o=t[r];e[o.name||"undefined"]=o}return e}function U(t,e,r){let o=r?q(r.metadata):void 0;return L(t,e,o)}function q(t){Object.entries(t);let e={};for(let r in t)e[`${r}.string`]=JSON.stringify(t[r]);return e}var G={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},pe={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},ye=4,D=class{constructor(e){this.draco=e,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(e,r={}){let o=new this.draco.DecoderBuffer;o.Init(new Int8Array(e),e.byteLength),this._disableAttributeTransforms(r);let a=this.decoder.GetEncodedGeometryType(o),s=a===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let n;switch(a){case this.draco.TRIANGULAR_MESH:n=this.decoder.DecodeBufferToMesh(o,s);break;case this.draco.POINT_CLOUD:n=this.decoder.DecodeBufferToPointCloud(o,s);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!n.ok()||!s.ptr){let m=`DRACO decompression failed: ${n.error_msg()}`;throw new Error(m)}let i=this._getDracoLoaderData(s,a,r),c=this._getMeshData(s,i,r),d=k(c.attributes),u=V(c.attributes,i,c.indices);return{loader:"draco",loaderData:i,header:{vertexCount:s.num_points(),boundingBox:d},...c,schema:u}}finally{this.draco.destroy(o),s&&this.draco.destroy(s)}}_getDracoLoaderData(e,r,o){let a=this._getTopLevelMetadata(e),s=this._getDracoAttributes(e,o);return{geometry_type:r,num_attributes:e.num_attributes(),num_points:e.num_points(),num_faces:e instanceof this.draco.Mesh?e.num_faces():0,metadata:a,attributes:s}}_getDracoAttributes(e,r){let o={};for(let a=0;a<e.num_attributes();a++){let s=this.decoder.GetAttribute(e,a),n=this._getAttributeMetadata(e,a);o[s.unique_id()]={unique_id:s.unique_id(),attribute_type:s.attribute_type(),data_type:s.data_type(),num_components:s.num_components(),byte_offset:s.byte_offset(),byte_stride:s.byte_stride(),normalized:s.normalized(),attribute_index:a,metadata:n};let i=this._getQuantizationTransform(s,r);i&&(o[s.unique_id()].quantization_transform=i);let c=this._getOctahedronTransform(s,r);c&&(o[s.unique_id()].octahedron_transform=c)}return o}_getMeshData(e,r,o){let a=this._getMeshAttributes(r,e,o);if(!a.POSITION)throw new Error("DRACO: No position attribute found.");if(e instanceof this.draco.Mesh)switch(o.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:a,indices:{value:this._getTriangleStripIndices(e),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:a,indices:{value:this._getTriangleListIndices(e),size:1}}}return{topology:"point-list",mode:0,attributes:a}}_getMeshAttributes(e,r,o){let a={};for(let s of Object.values(e.attributes)){let n=this._deduceAttributeName(s,o);s.name=n;let{value:i,size:c}=this._getAttributeValues(r,s);a[n]={value:i,size:c,byteOffset:s.byte_offset,byteStride:s.byte_stride,normalized:s.normalized}}return a}_getTriangleListIndices(e){let o=e.num_faces()*3,a=o*ye,s=this.draco._malloc(a);try{return this.decoder.GetTrianglesUInt32Array(e,a,s),new Uint32Array(this.draco.HEAPF32.buffer,s,o).slice()}finally{this.draco._free(s)}}_getTriangleStripIndices(e){let r=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(e,r),be(r)}finally{this.draco.destroy(r)}}_getAttributeValues(e,r){let o=pe[r.data_type],a=r.num_components,n=e.num_points()*a,i=n*o.BYTES_PER_ELEMENT,c=fe(this.draco,o),d,u=this.draco._malloc(i);try{let y=this.decoder.GetAttribute(e,r.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(e,y,c,i,u),d=new o(this.draco.HEAPF32.buffer,u,n).slice()}finally{this.draco._free(u)}return{value:d,size:a}}_deduceAttributeName(e,r){let o=e.unique_id;for(let[n,i]of Object.entries(r.extraAttributes||{}))if(i===o)return n;let a=e.attribute_type;for(let n in G)if(this.draco[n]===a)return G[n];let s=r.attributeNameEntry||"name";return e.metadata[s]?e.metadata[s].string:`CUSTOM_ATTRIBUTE_${o}`}_getTopLevelMetadata(e){let r=this.decoder.GetMetadata(e);return this._getDracoMetadata(r)}_getAttributeMetadata(e,r){let o=this.decoder.GetAttributeMetadata(e,r);return this._getDracoMetadata(o)}_getDracoMetadata(e){if(!e||!e.ptr)return{};let r={},o=this.metadataQuerier.NumEntries(e);for(let a=0;a<o;a++){let s=this.metadataQuerier.GetEntryName(e,a);r[s]=this._getDracoMetadataField(e,s)}return r}_getDracoMetadataField(e,r){let o=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(e,r,o);let a=me(o);return{int:this.metadataQuerier.GetIntEntry(e,r),string:this.metadataQuerier.GetStringEntry(e,r),double:this.metadataQuerier.GetDoubleEntry(e,r),intArray:a}}finally{this.draco.destroy(o)}}_disableAttributeTransforms(e){let{quantizedAttributes:r=[],octahedronAttributes:o=[]}=e,a=[...r,...o];for(let s of a)this.decoder.SkipAttributeTransform(this.draco[s])}_getQuantizationTransform(e,r){let{quantizedAttributes:o=[]}=r,a=e.attribute_type();if(o.map(n=>this.decoder[n]).includes(a)){let n=new this.draco.AttributeQuantizationTransform;try{if(n.InitFromAttribute(e))return{quantization_bits:n.quantization_bits(),range:n.range(),min_values:new Float32Array([1,2,3]).map(i=>n.min_value(i))}}finally{this.draco.destroy(n)}}return null}_getOctahedronTransform(e,r){let{octahedronAttributes:o=[]}=r,a=e.attribute_type();if(o.map(n=>this.decoder[n]).includes(a)){let n=new this.draco.AttributeQuantizationTransform;try{if(n.InitFromAttribute(e))return{quantization_bits:n.quantization_bits()}}finally{this.draco.destroy(n)}}return null}};function fe(t,e){switch(e){case Float32Array:return t.DT_FLOAT32;case Int8Array:return t.DT_INT8;case Int16Array:return t.DT_INT16;case Int32Array:return t.DT_INT32;case Uint8Array:return t.DT_UINT8;case Uint16Array:return t.DT_UINT16;case Uint32Array:return t.DT_UINT32;default:return t.DT_INVALID}}function me(t){let e=t.size(),r=new Int32Array(e);for(let o=0;o<e;o++)r[o]=t.GetValue(o);return r}function be(t){let e=t.size(),r=new Int32Array(e);for(let o=0;o<e;o++)r[o]=t.GetValue(o);return r}var ge="1.5.5",he="1.4.1",P=`https://www.gstatic.com/draco/versioned/decoders/${ge}`,Ae=`${P}/draco_decoder.js`,Te=`${P}/draco_wasm_wrapper.js`,De=`${P}/draco_decoder.wasm`,mt=`https://raw.githubusercontent.com/google/draco/${he}/javascript/draco_encoder.js`,h;async function Q(t){let e=t.modules||{};return e.draco3d?h=h||e.draco3d.createDecoderModule({}).then(r=>({draco:r})):h=h||_e(t),await h}async function _e(t){let e,r;switch(t.draco&&t.draco.decoderType){case"js":e=await g(Ae,"draco",t);break;case"wasm":default:[e,r]=await Promise.all([await g(Te,"draco",t),await g(De,"draco",t)])}return e=e||globalThis.DracoDecoderModule,await we(e,r)}function we(t,e){let r={};return e&&(r.wasmBinary=e),new Promise(o=>{t({...r,onModuleLoaded:a=>o({draco:a})})})}var $={...C,parse:xe};async function xe(t,e){let{draco:r}=await Q(e),o=new D(r);try{return o.parseSync(t,e?.draco)}finally{o.destroy()}}I($);})(); | ||
(()=>{var j=Object.create;var w=Object.defineProperty;var Y=Object.getOwnPropertyDescriptor;var J=Object.getOwnPropertyNames;var X=Object.getPrototypeOf,H=Object.prototype.hasOwnProperty;var Z=t=>w(t,"__esModule",{value:!0});var K=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var ee=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of J(e))!H.call(t,o)&&o!=="default"&&w(t,o,{get:()=>e[o],enumerable:!(r=Y(e,o))||r.enumerable});return t},te=t=>ee(Z(w(t!=null?j(X(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var N=K(()=>{});var _="4.0.0-alpha.18";function E(t,e){if(!t)throw new Error(e||"loaders.gl assertion failed.")}var p={self:typeof self!="undefined"&&self,window:typeof window!="undefined"&&window,global:typeof global!="undefined"&&global,document:typeof document!="undefined"&&document},Pe=p.self||p.window||p.global||{},Ee=p.window||p.self||p.global||{},S=p.global||p.self||p.window||{},Se=p.document||{};var A=typeof process!="object"||String(process)!=="[object process]"||process.browser,T=typeof importScripts=="function",Re=typeof window!="undefined"&&typeof window.orientation!="undefined",R=typeof process!="undefined"&&process.version&&/v([0-9]*)/.exec(process.version),Fe=R&&parseFloat(R[1])||0;function x(t,e=!0,r){let o=r||new Set;if(t){if(F(t))o.add(t);else if(F(t.buffer))o.add(t.buffer);else if(!ArrayBuffer.isView(t)){if(e&&typeof t=="object")for(let a in t)x(t[a],e,o)}}return r===void 0?Array.from(o):[]}function F(t){return t?t instanceof ArrayBuffer||typeof MessagePort!="undefined"&&t instanceof MessagePort||typeof ImageBitmap!="undefined"&&t instanceof ImageBitmap||typeof OffscreenCanvas!="undefined"&&t instanceof OffscreenCanvas:!1}function m(){let parentPort;try{eval("globalThis.parentPort = require('worker_threads').parentPort"),parentPort=globalThis.parentPort}catch{}return parentPort}var M=new Map,l=class{static inWorkerThread(){return typeof self!="undefined"||Boolean(m())}static set onmessage(e){function r(a){let s=m(),{type:n,payload:i}=s?a:a.data;e(n,i)}let o=m();o?(o.on("message",r),o.on("exit",()=>console.debug("Node worker closing"))):globalThis.onmessage=r}static addEventListener(e){let r=M.get(e);r||(r=a=>{if(!re(a))return;let s=m(),{type:n,payload:i}=s?a:a.data;e(n,i)}),m()?console.error("not implemented"):globalThis.addEventListener("message",r)}static removeEventListener(e){let r=M.get(e);M.delete(e),m()?console.error("not implemented"):globalThis.removeEventListener("message",r)}static postMessage(e,r){let o={source:"loaders.gl",type:e,payload:r},a=x(r),s=m();s?s.postMessage(o,a):globalThis.postMessage(o,a)}};function re(t){let{type:e,data:r}=t;return e==="message"&&r&&typeof r.source=="string"&&r.source.startsWith("loaders.gl")}var y=te(N());var oe="beta",ae=typeof _!="undefined"?_:oe,O={};async function g(t,e=null,r={}){return e&&(t=B(t,e,r)),O[t]=O[t]||se(t),await O[t]}function B(t,e,r){if(t.startsWith("http"))return t;let o=r.modules||{};return o[t]?o[t]:A?r.CDN?(E(r.CDN.startsWith("http")),`${r.CDN}/${e}@${ae}/dist/libs/${t}`):T?`../src/libs/${t}`:`modules/${e}/src/libs/${t}`:`modules/${e}/dist/libs/${t}`}async function se(t){if(t.endsWith("wasm"))return await ie(t);if(!A)try{return y&&y.requireFromFile&&await y.requireFromFile(t)}catch{return null}if(T)return importScripts(t);let e=await ce(t);return ne(e,t)}function ne(t,e){if(!A)return y.requireFromString&&y.requireFromString(t,e);if(T)return eval.call(S,t),null;let r=document.createElement("script");r.id=e;try{r.appendChild(document.createTextNode(t))}catch{r.text=t}return document.body.appendChild(r),null}async function ie(t){return!y.readFileAsArrayBuffer||t.startsWith("http")?await(await fetch(t)).arrayBuffer():await y.readFileAsArrayBuffer(t)}async function ce(t){return!y.readFileAsText||t.startsWith("http")?await(await fetch(t)).text():await y.readFileAsText(t)}var le=0;function I(t){!l.inWorkerThread()||(l.onmessage=async(e,r)=>{switch(e){case"process":try{let{input:o,options:a={},context:s={}}=r,n=await ue({loader:t,arrayBuffer:o,options:a,context:{...s,parse:de}});l.postMessage("done",{result:n})}catch(o){let a=o instanceof Error?o.message:"";l.postMessage("error",{error:a})}break;default:}})}function de(t,e){return new Promise((r,o)=>{let a=le++,s=(i,c)=>{if(c.id===a)switch(i){case"done":l.removeEventListener(s),r(c.result);break;case"error":l.removeEventListener(s),o(c.error);break;default:}};l.addEventListener(s);let n={id:a,input:t,options:e};l.postMessage("process",n)})}async function ue({loader:t,arrayBuffer:e,options:r,context:o}){let a,s;if(t.parseSync||t.parse)a=e,s=t.parseSync||t.parse;else if(t.parseTextSync)a=new TextDecoder().decode(e),s=t.parseTextSync;else throw new Error(`Could not load data with ${t.name} loader`);return r={...r,modules:t&&t.options&&t.options.modules||{},worker:!1},await s(a,{...r},o,t)}var W="4.0.0-alpha.18";var pe={draco:{decoderType:typeof WebAssembly=="object"?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}},C={name:"Draco",id:"draco",module:"draco",version:W,worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:pe};function v(t){switch(t.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}function k(t){let e=1/0,r=1/0,o=1/0,a=-1/0,s=-1/0,n=-1/0,i=t.POSITION?t.POSITION.value:[],c=i&&i.length;for(let d=0;d<c;d+=3){let u=i[d],f=i[d+1],b=i[d+2];e=u<e?u:e,r=f<r?f:r,o=b<o?b:o,a=u>a?u:a,s=f>s?f:s,n=b>n?b:n}return[[e,r,o],[a,s,n]]}function L(t,e,r){let o=v(e.value),a=r||z(e);return{name:t,type:{type:"fixed-size-list",listSize:e.size,children:[{name:"value",type:o}]},nullable:!1,metadata:a}}function z(t){let e={};return"byteOffset"in t&&(e.byteOffset=t.byteOffset.toString(10)),"byteStride"in t&&(e.byteStride=t.byteStride.toString(10)),"normalized"in t&&(e.normalized=t.normalized.toString()),e}function V(t,e,r){let o=q(e.metadata),a=[],s=ye(e.attributes);for(let n in t){let i=t[n],c=U(n,i,s[n]);a.push(c)}if(r){let n=U("indices",r);a.push(n)}return{fields:a,metadata:o}}function ye(t){let e={};for(let r in t){let o=t[r];e[o.name||"undefined"]=o}return e}function U(t,e,r){let o=r?q(r.metadata):void 0;return L(t,e,o)}function q(t){Object.entries(t);let e={};for(let r in t)e[`${r}.string`]=JSON.stringify(t[r]);return e}var G={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},fe={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},me=4,D=class{constructor(e){this.draco=e,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(e,r={}){let o=new this.draco.DecoderBuffer;o.Init(new Int8Array(e),e.byteLength),this._disableAttributeTransforms(r);let a=this.decoder.GetEncodedGeometryType(o),s=a===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let n;switch(a){case this.draco.TRIANGULAR_MESH:n=this.decoder.DecodeBufferToMesh(o,s);break;case this.draco.POINT_CLOUD:n=this.decoder.DecodeBufferToPointCloud(o,s);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!n.ok()||!s.ptr){let b=`DRACO decompression failed: ${n.error_msg()}`;throw new Error(b)}let i=this._getDracoLoaderData(s,a,r),c=this._getMeshData(s,i,r),d=k(c.attributes),u=V(c.attributes,i,c.indices);return{loader:"draco",loaderData:i,header:{vertexCount:s.num_points(),boundingBox:d},...c,schema:u}}finally{this.draco.destroy(o),s&&this.draco.destroy(s)}}_getDracoLoaderData(e,r,o){let a=this._getTopLevelMetadata(e),s=this._getDracoAttributes(e,o);return{geometry_type:r,num_attributes:e.num_attributes(),num_points:e.num_points(),num_faces:e instanceof this.draco.Mesh?e.num_faces():0,metadata:a,attributes:s}}_getDracoAttributes(e,r){let o={};for(let a=0;a<e.num_attributes();a++){let s=this.decoder.GetAttribute(e,a),n=this._getAttributeMetadata(e,a);o[s.unique_id()]={unique_id:s.unique_id(),attribute_type:s.attribute_type(),data_type:s.data_type(),num_components:s.num_components(),byte_offset:s.byte_offset(),byte_stride:s.byte_stride(),normalized:s.normalized(),attribute_index:a,metadata:n};let i=this._getQuantizationTransform(s,r);i&&(o[s.unique_id()].quantization_transform=i);let c=this._getOctahedronTransform(s,r);c&&(o[s.unique_id()].octahedron_transform=c)}return o}_getMeshData(e,r,o){let a=this._getMeshAttributes(r,e,o);if(!a.POSITION)throw new Error("DRACO: No position attribute found.");if(e instanceof this.draco.Mesh)switch(o.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:a,indices:{value:this._getTriangleStripIndices(e),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:a,indices:{value:this._getTriangleListIndices(e),size:1}}}return{topology:"point-list",mode:0,attributes:a}}_getMeshAttributes(e,r,o){let a={};for(let s of Object.values(e.attributes)){let n=this._deduceAttributeName(s,o);s.name=n;let{value:i,size:c}=this._getAttributeValues(r,s);a[n]={value:i,size:c,byteOffset:s.byte_offset,byteStride:s.byte_stride,normalized:s.normalized}}return a}_getTriangleListIndices(e){let o=e.num_faces()*3,a=o*me,s=this.draco._malloc(a);try{return this.decoder.GetTrianglesUInt32Array(e,a,s),new Uint32Array(this.draco.HEAPF32.buffer,s,o).slice()}finally{this.draco._free(s)}}_getTriangleStripIndices(e){let r=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(e,r),he(r)}finally{this.draco.destroy(r)}}_getAttributeValues(e,r){let o=fe[r.data_type],a=r.num_components,n=e.num_points()*a,i=n*o.BYTES_PER_ELEMENT,c=be(this.draco,o),d,u=this.draco._malloc(i);try{let f=this.decoder.GetAttribute(e,r.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(e,f,c,i,u),d=new o(this.draco.HEAPF32.buffer,u,n).slice()}finally{this.draco._free(u)}return{value:d,size:a}}_deduceAttributeName(e,r){let o=e.unique_id;for(let[n,i]of Object.entries(r.extraAttributes||{}))if(i===o)return n;let a=e.attribute_type;for(let n in G)if(this.draco[n]===a)return G[n];let s=r.attributeNameEntry||"name";return e.metadata[s]?e.metadata[s].string:`CUSTOM_ATTRIBUTE_${o}`}_getTopLevelMetadata(e){let r=this.decoder.GetMetadata(e);return this._getDracoMetadata(r)}_getAttributeMetadata(e,r){let o=this.decoder.GetAttributeMetadata(e,r);return this._getDracoMetadata(o)}_getDracoMetadata(e){if(!e||!e.ptr)return{};let r={},o=this.metadataQuerier.NumEntries(e);for(let a=0;a<o;a++){let s=this.metadataQuerier.GetEntryName(e,a);r[s]=this._getDracoMetadataField(e,s)}return r}_getDracoMetadataField(e,r){let o=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(e,r,o);let a=ge(o);return{int:this.metadataQuerier.GetIntEntry(e,r),string:this.metadataQuerier.GetStringEntry(e,r),double:this.metadataQuerier.GetDoubleEntry(e,r),intArray:a}}finally{this.draco.destroy(o)}}_disableAttributeTransforms(e){let{quantizedAttributes:r=[],octahedronAttributes:o=[]}=e,a=[...r,...o];for(let s of a)this.decoder.SkipAttributeTransform(this.draco[s])}_getQuantizationTransform(e,r){let{quantizedAttributes:o=[]}=r,a=e.attribute_type();if(o.map(n=>this.decoder[n]).includes(a)){let n=new this.draco.AttributeQuantizationTransform;try{if(n.InitFromAttribute(e))return{quantization_bits:n.quantization_bits(),range:n.range(),min_values:new Float32Array([1,2,3]).map(i=>n.min_value(i))}}finally{this.draco.destroy(n)}}return null}_getOctahedronTransform(e,r){let{octahedronAttributes:o=[]}=r,a=e.attribute_type();if(o.map(n=>this.decoder[n]).includes(a)){let n=new this.draco.AttributeQuantizationTransform;try{if(n.InitFromAttribute(e))return{quantization_bits:n.quantization_bits()}}finally{this.draco.destroy(n)}}return null}};function be(t,e){switch(e){case Float32Array:return t.DT_FLOAT32;case Int8Array:return t.DT_INT8;case Int16Array:return t.DT_INT16;case Int32Array:return t.DT_INT32;case Uint8Array:return t.DT_UINT8;case Uint16Array:return t.DT_UINT16;case Uint32Array:return t.DT_UINT32;default:return t.DT_INVALID}}function ge(t){let e=t.size(),r=new Int32Array(e);for(let o=0;o<e;o++)r[o]=t.GetValue(o);return r}function he(t){let e=t.size(),r=new Int32Array(e);for(let o=0;o<e;o++)r[o]=t.GetValue(o);return r}var Ae="1.5.5",Te="1.4.1",P=`https://www.gstatic.com/draco/versioned/decoders/${Ae}`,De=`${P}/draco_decoder.js`,we=`${P}/draco_wasm_wrapper.js`,_e=`${P}/draco_decoder.wasm`,gt=`https://raw.githubusercontent.com/google/draco/${Te}/javascript/draco_encoder.js`,h;async function Q(t){let e=t.modules||{};return e.draco3d?h=h||e.draco3d.createDecoderModule({}).then(r=>({draco:r})):h=h||xe(t),await h}async function xe(t){let e,r;switch(t.draco&&t.draco.decoderType){case"js":e=await g(De,"draco",t);break;case"wasm":default:[e,r]=await Promise.all([await g(we,"draco",t),await g(_e,"draco",t)])}return e=e||globalThis.DracoDecoderModule,await Me(e,r)}function Me(t,e){let r={};return e&&(r.wasmBinary=e),new Promise(o=>{t({...r,onModuleLoaded:a=>o({draco:a})})})}var $={...C,parse:Oe};async function Oe(t,e){let{draco:r}=await Q(e),o=new D(r);try{return o.parseSync(t,e?.draco)}finally{o.destroy()}}I($);})(); | ||
//# sourceMappingURL=draco-worker.js.map |
@@ -1,4 +0,4 @@ | ||
(()=>{var L=Object.create;var b=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var F=Object.getPrototypeOf,V=Object.prototype.hasOwnProperty;var $=t=>b(t,"__esModule",{value:!0});var q=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var U=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of v(e))!V.call(t,o)&&o!=="default"&&b(t,o,{get:()=>e[o],enumerable:!(r=x(e,o))||r.enumerable});return t},j=t=>U($(b(t!=null?L(F(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var R=q(()=>{});var w="4.0.0-alpha.17";function O(t,e){if(!t)throw new Error(e||"loaders.gl assertion failed.")}var c={self:typeof self!="undefined"&&self,window:typeof window!="undefined"&&window,global:typeof global!="undefined"&&global,document:typeof document!="undefined"&&document},ie=c.self||c.window||c.global||{},de=c.window||c.self||c.global||{},k=c.global||c.self||c.window||{},ce=c.document||{};var h=typeof process!="object"||String(process)!=="[object process]"||process.browser,g=typeof importScripts=="function",le=typeof window!="undefined"&&typeof window.orientation!="undefined",T=typeof process!="undefined"&&process.version&&/v([0-9]*)/.exec(process.version),ue=T&&parseFloat(T[1])||0;function M(t,e=!0,r){let o=r||new Set;if(t){if(P(t))o.add(t);else if(P(t.buffer))o.add(t.buffer);else if(!ArrayBuffer.isView(t)){if(e&&typeof t=="object")for(let a in t)M(t[a],e,o)}}return r===void 0?Array.from(o):[]}function P(t){return t?t instanceof ArrayBuffer||typeof MessagePort!="undefined"&&t instanceof MessagePort||typeof ImageBitmap!="undefined"&&t instanceof ImageBitmap||typeof OffscreenCanvas!="undefined"&&t instanceof OffscreenCanvas:!1}function f(){let parentPort;try{eval("globalThis.parentPort = require('worker_threads').parentPort"),parentPort=globalThis.parentPort}catch{}return parentPort}var _=new Map,u=class{static inWorkerThread(){return typeof self!="undefined"||Boolean(f())}static set onmessage(e){function r(a){let s=f(),{type:i,payload:n}=s?a:a.data;e(i,n)}let o=f();o?(o.on("message",r),o.on("exit",()=>console.debug("Node worker closing"))):globalThis.onmessage=r}static addEventListener(e){let r=_.get(e);r||(r=a=>{if(!G(a))return;let s=f(),{type:i,payload:n}=s?a:a.data;e(i,n)}),f()?console.error("not implemented"):globalThis.addEventListener("message",r)}static removeEventListener(e){let r=_.get(e);_.delete(e),f()?console.error("not implemented"):globalThis.removeEventListener("message",r)}static postMessage(e,r){let o={source:"loaders.gl",type:e,payload:r},a=M(r),s=f();s?s.postMessage(o,a):globalThis.postMessage(o,a)}};function G(t){let{type:e,data:r}=t;return e==="message"&&r&&typeof r.source=="string"&&r.source.startsWith("loaders.gl")}var p=j(R());var z="beta",Q=typeof w!="undefined"?w:z,E={};async function A(t,e=null,r={}){return e&&(t=I(t,e,r)),E[t]=E[t]||H(t),await E[t]}function I(t,e,r){if(t.startsWith("http"))return t;let o=r.modules||{};return o[t]?o[t]:h?r.CDN?(O(r.CDN.startsWith("http")),`${r.CDN}/${e}@${Q}/dist/libs/${t}`):g?`../src/libs/${t}`:`modules/${e}/src/libs/${t}`:`modules/${e}/dist/libs/${t}`}async function H(t){if(t.endsWith("wasm"))return await(await fetch(t)).arrayBuffer();if(!h)try{return p&&p.requireFromFile&&await p.requireFromFile(t)}catch{return null}if(g)return importScripts(t);let r=await(await fetch(t)).text();return X(r,t)}function X(t,e){if(!h)return p.requireFromString&&p.requireFromString(t,e);if(g)return eval.call(k,t),null;let r=document.createElement("script");r.id=e;try{r.appendChild(document.createTextNode(t))}catch{r.text=t}return document.body.appendChild(r),null}var W={POSITION:"POSITION",NORMAL:"NORMAL",COLOR_0:"COLOR",TEXCOORD_0:"TEX_COORD"},J=()=>{},m=class{constructor(e){this.draco=e,this.dracoEncoder=new this.draco.Encoder,this.dracoMeshBuilder=new this.draco.MeshBuilder,this.dracoMetadataBuilder=new this.draco.MetadataBuilder}destroy(){this.destroyEncodedObject(this.dracoMeshBuilder),this.destroyEncodedObject(this.dracoEncoder),this.destroyEncodedObject(this.dracoMetadataBuilder),this.dracoMeshBuilder=null,this.dracoEncoder=null,this.draco=null}destroyEncodedObject(e){e&&this.draco.destroy(e)}encodeSync(e,r={}){return this.log=J,this._setOptions(r),r.pointcloud?this._encodePointCloud(e,r):this._encodeMesh(e,r)}_getAttributesFromMesh(e){let r={...e,...e.attributes};return e.indices&&(r.indices=e.indices),r}_encodePointCloud(e,r){let o=new this.draco.PointCloud;r.metadata&&this._addGeometryMetadata(o,r.metadata);let a=this._getAttributesFromMesh(e);this._createDracoPointCloud(o,a,r);let s=new this.draco.DracoInt8Array;try{let i=this.dracoEncoder.EncodePointCloudToDracoBuffer(o,!1,s);if(!(i>0))throw new Error("Draco encoding failed.");return this.log(`DRACO encoded ${o.num_points()} points | ||
with ${o.num_attributes()} attributes into ${i} bytes`),B(s)}finally{this.destroyEncodedObject(s),this.destroyEncodedObject(o)}}_encodeMesh(e,r){let o=new this.draco.Mesh;r.metadata&&this._addGeometryMetadata(o,r.metadata);let a=this._getAttributesFromMesh(e);this._createDracoMesh(o,a,r);let s=new this.draco.DracoInt8Array;try{let i=this.dracoEncoder.EncodeMeshToDracoBuffer(o,s);if(i<=0)throw new Error("Draco encoding failed.");return this.log(`DRACO encoded ${o.num_points()} points | ||
with ${o.num_attributes()} attributes into ${i} bytes`),B(s)}finally{this.destroyEncodedObject(s),this.destroyEncodedObject(o)}}_setOptions(e){if("speed"in e&&this.dracoEncoder.SetSpeedOptions(...e.speed),"method"in e){let r=this.draco[e.method||"MESH_SEQUENTIAL_ENCODING"];this.dracoEncoder.SetEncodingMethod(r)}if("quantization"in e)for(let r in e.quantization){let o=e.quantization[r],a=this.draco[r];this.dracoEncoder.SetAttributeQuantization(a,o)}}_createDracoMesh(e,r,o){let a=o.attributesMetadata||{};try{let s=this._getPositionAttribute(r);if(!s)throw new Error("positions");let i=s.length/3;for(let n in r){let d=r[n];n=W[n]||n;let l=this._addAttributeToMesh(e,n,d,i);l!==-1&&this._addAttributeMetadata(e,l,{name:n,...a[n]||{}})}}catch(s){throw this.destroyEncodedObject(e),s}return e}_createDracoPointCloud(e,r,o){let a=o.attributesMetadata||{};try{let s=this._getPositionAttribute(r);if(!s)throw new Error("positions");let i=s.length/3;for(let n in r){let d=r[n];n=W[n]||n;let l=this._addAttributeToMesh(e,n,d,i);l!==-1&&this._addAttributeMetadata(e,l,{name:n,...a[n]||{}})}}catch(s){throw this.destroyEncodedObject(e),s}return e}_addAttributeToMesh(e,r,o,a){if(!ArrayBuffer.isView(o))return-1;let s=this._getDracoAttributeType(r),i=o.length/a;if(s==="indices"){let l=o.length/3;return this.log(`Adding attribute ${r}, size ${l}`),this.dracoMeshBuilder.AddFacesToMesh(e,l,o),-1}this.log(`Adding attribute ${r}, size ${i}`);let n=this.dracoMeshBuilder,{buffer:d}=o;switch(o.constructor){case Int8Array:return n.AddInt8Attribute(e,s,a,i,new Int8Array(d));case Int16Array:return n.AddInt16Attribute(e,s,a,i,new Int16Array(d));case Int32Array:return n.AddInt32Attribute(e,s,a,i,new Int32Array(d));case Uint8Array:case Uint8ClampedArray:return n.AddUInt8Attribute(e,s,a,i,new Uint8Array(d));case Uint16Array:return n.AddUInt16Attribute(e,s,a,i,new Uint16Array(d));case Uint32Array:return n.AddUInt32Attribute(e,s,a,i,new Uint32Array(d));case Float32Array:default:return n.AddFloatAttribute(e,s,a,i,new Float32Array(d))}}_getDracoAttributeType(e){switch(e.toLowerCase()){case"indices":return"indices";case"position":case"positions":case"vertices":return this.draco.POSITION;case"normal":case"normals":return this.draco.NORMAL;case"color":case"colors":return this.draco.COLOR;case"texcoord":case"texcoords":return this.draco.TEX_COORD;default:return this.draco.GENERIC}}_getPositionAttribute(e){for(let r in e){let o=e[r];if(this._getDracoAttributeType(r)===this.draco.POSITION)return o}return null}_addGeometryMetadata(e,r){let o=new this.draco.Metadata;this._populateDracoMetadata(o,r),this.dracoMeshBuilder.AddMetadata(e,o)}_addAttributeMetadata(e,r,o){let a=new this.draco.Metadata;this._populateDracoMetadata(a,o),this.dracoMeshBuilder.SetMetadataForAttribute(e,r,a)}_populateDracoMetadata(e,r){for(let[o,a]of K(r))switch(typeof a){case"number":Math.trunc(a)===a?this.dracoMetadataBuilder.AddIntEntry(e,o,a):this.dracoMetadataBuilder.AddDoubleEntry(e,o,a);break;case"object":a instanceof Int32Array&&this.dracoMetadataBuilder.AddIntEntryArray(e,o,a,a.length);break;case"string":default:this.dracoMetadataBuilder.AddStringEntry(e,o,a)}}};function B(t){let e=t.size(),r=new ArrayBuffer(e),o=new Int8Array(r);for(let a=0;a<e;++a)o[a]=t.GetValue(a);return r}function K(t){return t.entries&&!t.hasOwnProperty("entries")?t.entries():Object.entries(t)}var Y="1.5.5",Z="1.4.1",D=`https://www.gstatic.com/draco/versioned/decoders/${Y}`,Te=`${D}/draco_decoder.js`,Pe=`${D}/draco_wasm_wrapper.js`,Re=`${D}/draco_decoder.wasm`,ee=`https://raw.githubusercontent.com/google/draco/${Z}/javascript/draco_encoder.js`;var y;async function S(t){let e=t.modules||{};return e.draco3d?y=y||e.draco3d.createEncoderModule({}).then(r=>({draco:r})):y=y||re(t),await y}async function re(t){let e=await A(ee,"draco",t);return e=e||globalThis.DracoEncoderModule,new Promise(r=>{e({onModuleLoaded:o=>r({draco:o})})})}var N="4.0.0-alpha.17";var te={pointcloud:!1,attributeNameEntry:"name"},C={name:"DRACO",id:"draco",module:"draco",version:N,extensions:["drc"],encode:oe,options:{draco:te}};async function oe(t,e={}){let{draco:r}=await S(e),o=new m(r);try{return o.encodeSync(t,e.draco)}finally{o.destroy()}}(()=>{!u.inWorkerThread()||(u.onmessage=async(t,e)=>{switch(t){case"process":try{let{input:r,options:o}=e,a=await C.encode(r,o);u.postMessage("done",{result:a})}catch(r){let o=r instanceof Error?r.message:"";u.postMessage("error",{error:o})}break;default:}})})();})(); | ||
(()=>{var C=Object.create;var w=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var F=Object.getPrototypeOf,V=Object.prototype.hasOwnProperty;var $=r=>w(r,"__esModule",{value:!0});var q=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var U=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of v(e))!V.call(r,o)&&o!=="default"&&w(r,o,{get:()=>e[o],enumerable:!(t=L(e,o))||t.enumerable});return r},j=r=>U($(w(r!=null?C(F(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var W=q(()=>{});var b="4.0.0-alpha.18";function O(r,e){if(!r)throw new Error(e||"loaders.gl assertion failed.")}var c={self:typeof self!="undefined"&&self,window:typeof window!="undefined"&&window,global:typeof global!="undefined"&&global,document:typeof document!="undefined"&&document},ce=c.self||c.window||c.global||{},ue=c.window||c.self||c.global||{},k=c.global||c.self||c.window||{},le=c.document||{};var h=typeof process!="object"||String(process)!=="[object process]"||process.browser,g=typeof importScripts=="function",fe=typeof window!="undefined"&&typeof window.orientation!="undefined",T=typeof process!="undefined"&&process.version&&/v([0-9]*)/.exec(process.version),pe=T&&parseFloat(T[1])||0;function M(r,e=!0,t){let o=t||new Set;if(r){if(P(r))o.add(r);else if(P(r.buffer))o.add(r.buffer);else if(!ArrayBuffer.isView(r)){if(e&&typeof r=="object")for(let a in r)M(r[a],e,o)}}return t===void 0?Array.from(o):[]}function P(r){return r?r instanceof ArrayBuffer||typeof MessagePort!="undefined"&&r instanceof MessagePort||typeof ImageBitmap!="undefined"&&r instanceof ImageBitmap||typeof OffscreenCanvas!="undefined"&&r instanceof OffscreenCanvas:!1}function p(){let parentPort;try{eval("globalThis.parentPort = require('worker_threads').parentPort"),parentPort=globalThis.parentPort}catch{}return parentPort}var A=new Map,f=class{static inWorkerThread(){return typeof self!="undefined"||Boolean(p())}static set onmessage(e){function t(a){let s=p(),{type:i,payload:n}=s?a:a.data;e(i,n)}let o=p();o?(o.on("message",t),o.on("exit",()=>console.debug("Node worker closing"))):globalThis.onmessage=t}static addEventListener(e){let t=A.get(e);t||(t=a=>{if(!G(a))return;let s=p(),{type:i,payload:n}=s?a:a.data;e(i,n)}),p()?console.error("not implemented"):globalThis.addEventListener("message",t)}static removeEventListener(e){let t=A.get(e);A.delete(e),p()?console.error("not implemented"):globalThis.removeEventListener("message",t)}static postMessage(e,t){let o={source:"loaders.gl",type:e,payload:t},a=M(t),s=p();s?s.postMessage(o,a):globalThis.postMessage(o,a)}};function G(r){let{type:e,data:t}=r;return e==="message"&&t&&typeof t.source=="string"&&t.source.startsWith("loaders.gl")}var u=j(W());var z="beta",Q=typeof b!="undefined"?b:z,_={};async function E(r,e=null,t={}){return e&&(r=B(r,e,t)),_[r]=_[r]||H(r),await _[r]}function B(r,e,t){if(r.startsWith("http"))return r;let o=t.modules||{};return o[r]?o[r]:h?t.CDN?(O(t.CDN.startsWith("http")),`${t.CDN}/${e}@${Q}/dist/libs/${r}`):g?`../src/libs/${r}`:`modules/${e}/src/libs/${r}`:`modules/${e}/dist/libs/${r}`}async function H(r){if(r.endsWith("wasm"))return await J(r);if(!h)try{return u&&u.requireFromFile&&await u.requireFromFile(r)}catch{return null}if(g)return importScripts(r);let e=await K(r);return X(e,r)}function X(r,e){if(!h)return u.requireFromString&&u.requireFromString(r,e);if(g)return eval.call(k,r),null;let t=document.createElement("script");t.id=e;try{t.appendChild(document.createTextNode(r))}catch{t.text=r}return document.body.appendChild(t),null}async function J(r){return!u.readFileAsArrayBuffer||r.startsWith("http")?await(await fetch(r)).arrayBuffer():await u.readFileAsArrayBuffer(r)}async function K(r){return!u.readFileAsText||r.startsWith("http")?await(await fetch(r)).text():await u.readFileAsText(r)}var R={POSITION:"POSITION",NORMAL:"NORMAL",COLOR_0:"COLOR",TEXCOORD_0:"TEX_COORD"},Y=()=>{},m=class{constructor(e){this.draco=e,this.dracoEncoder=new this.draco.Encoder,this.dracoMeshBuilder=new this.draco.MeshBuilder,this.dracoMetadataBuilder=new this.draco.MetadataBuilder}destroy(){this.destroyEncodedObject(this.dracoMeshBuilder),this.destroyEncodedObject(this.dracoEncoder),this.destroyEncodedObject(this.dracoMetadataBuilder),this.dracoMeshBuilder=null,this.dracoEncoder=null,this.draco=null}destroyEncodedObject(e){e&&this.draco.destroy(e)}encodeSync(e,t={}){return this.log=Y,this._setOptions(t),t.pointcloud?this._encodePointCloud(e,t):this._encodeMesh(e,t)}_getAttributesFromMesh(e){let t={...e,...e.attributes};return e.indices&&(t.indices=e.indices),t}_encodePointCloud(e,t){let o=new this.draco.PointCloud;t.metadata&&this._addGeometryMetadata(o,t.metadata);let a=this._getAttributesFromMesh(e);this._createDracoPointCloud(o,a,t);let s=new this.draco.DracoInt8Array;try{let i=this.dracoEncoder.EncodePointCloudToDracoBuffer(o,!1,s);if(!(i>0))throw new Error("Draco encoding failed.");return this.log(`DRACO encoded ${o.num_points()} points | ||
with ${o.num_attributes()} attributes into ${i} bytes`),I(s)}finally{this.destroyEncodedObject(s),this.destroyEncodedObject(o)}}_encodeMesh(e,t){let o=new this.draco.Mesh;t.metadata&&this._addGeometryMetadata(o,t.metadata);let a=this._getAttributesFromMesh(e);this._createDracoMesh(o,a,t);let s=new this.draco.DracoInt8Array;try{let i=this.dracoEncoder.EncodeMeshToDracoBuffer(o,s);if(i<=0)throw new Error("Draco encoding failed.");return this.log(`DRACO encoded ${o.num_points()} points | ||
with ${o.num_attributes()} attributes into ${i} bytes`),I(s)}finally{this.destroyEncodedObject(s),this.destroyEncodedObject(o)}}_setOptions(e){if("speed"in e&&this.dracoEncoder.SetSpeedOptions(...e.speed),"method"in e){let t=this.draco[e.method||"MESH_SEQUENTIAL_ENCODING"];this.dracoEncoder.SetEncodingMethod(t)}if("quantization"in e)for(let t in e.quantization){let o=e.quantization[t],a=this.draco[t];this.dracoEncoder.SetAttributeQuantization(a,o)}}_createDracoMesh(e,t,o){let a=o.attributesMetadata||{};try{let s=this._getPositionAttribute(t);if(!s)throw new Error("positions");let i=s.length/3;for(let n in t){let d=t[n];n=R[n]||n;let l=this._addAttributeToMesh(e,n,d,i);l!==-1&&this._addAttributeMetadata(e,l,{name:n,...a[n]||{}})}}catch(s){throw this.destroyEncodedObject(e),s}return e}_createDracoPointCloud(e,t,o){let a=o.attributesMetadata||{};try{let s=this._getPositionAttribute(t);if(!s)throw new Error("positions");let i=s.length/3;for(let n in t){let d=t[n];n=R[n]||n;let l=this._addAttributeToMesh(e,n,d,i);l!==-1&&this._addAttributeMetadata(e,l,{name:n,...a[n]||{}})}}catch(s){throw this.destroyEncodedObject(e),s}return e}_addAttributeToMesh(e,t,o,a){if(!ArrayBuffer.isView(o))return-1;let s=this._getDracoAttributeType(t),i=o.length/a;if(s==="indices"){let l=o.length/3;return this.log(`Adding attribute ${t}, size ${l}`),this.dracoMeshBuilder.AddFacesToMesh(e,l,o),-1}this.log(`Adding attribute ${t}, size ${i}`);let n=this.dracoMeshBuilder,{buffer:d}=o;switch(o.constructor){case Int8Array:return n.AddInt8Attribute(e,s,a,i,new Int8Array(d));case Int16Array:return n.AddInt16Attribute(e,s,a,i,new Int16Array(d));case Int32Array:return n.AddInt32Attribute(e,s,a,i,new Int32Array(d));case Uint8Array:case Uint8ClampedArray:return n.AddUInt8Attribute(e,s,a,i,new Uint8Array(d));case Uint16Array:return n.AddUInt16Attribute(e,s,a,i,new Uint16Array(d));case Uint32Array:return n.AddUInt32Attribute(e,s,a,i,new Uint32Array(d));case Float32Array:default:return n.AddFloatAttribute(e,s,a,i,new Float32Array(d))}}_getDracoAttributeType(e){switch(e.toLowerCase()){case"indices":return"indices";case"position":case"positions":case"vertices":return this.draco.POSITION;case"normal":case"normals":return this.draco.NORMAL;case"color":case"colors":return this.draco.COLOR;case"texcoord":case"texcoords":return this.draco.TEX_COORD;default:return this.draco.GENERIC}}_getPositionAttribute(e){for(let t in e){let o=e[t];if(this._getDracoAttributeType(t)===this.draco.POSITION)return o}return null}_addGeometryMetadata(e,t){let o=new this.draco.Metadata;this._populateDracoMetadata(o,t),this.dracoMeshBuilder.AddMetadata(e,o)}_addAttributeMetadata(e,t,o){let a=new this.draco.Metadata;this._populateDracoMetadata(a,o),this.dracoMeshBuilder.SetMetadataForAttribute(e,t,a)}_populateDracoMetadata(e,t){for(let[o,a]of Z(t))switch(typeof a){case"number":Math.trunc(a)===a?this.dracoMetadataBuilder.AddIntEntry(e,o,a):this.dracoMetadataBuilder.AddDoubleEntry(e,o,a);break;case"object":a instanceof Int32Array&&this.dracoMetadataBuilder.AddIntEntryArray(e,o,a,a.length);break;case"string":default:this.dracoMetadataBuilder.AddStringEntry(e,o,a)}}};function I(r){let e=r.size(),t=new ArrayBuffer(e),o=new Int8Array(t);for(let a=0;a<e;++a)o[a]=r.GetValue(a);return t}function Z(r){return r.entries&&!r.hasOwnProperty("entries")?r.entries():Object.entries(r)}var ee="1.5.5",re="1.4.1",D=`https://www.gstatic.com/draco/versioned/decoders/${ee}`,We=`${D}/draco_decoder.js`,Be=`${D}/draco_wasm_wrapper.js`,Re=`${D}/draco_decoder.wasm`,te=`https://raw.githubusercontent.com/google/draco/${re}/javascript/draco_encoder.js`;var y;async function S(r){let e=r.modules||{};return e.draco3d?y=y||e.draco3d.createEncoderModule({}).then(t=>({draco:t})):y=y||oe(r),await y}async function oe(r){let e=await E(te,"draco",r);return e=e||globalThis.DracoEncoderModule,new Promise(t=>{e({onModuleLoaded:o=>t({draco:o})})})}var N="4.0.0-alpha.18";var ae={pointcloud:!1,attributeNameEntry:"name"},x={name:"DRACO",id:"draco",module:"draco",version:N,extensions:["drc"],encode:se,options:{draco:ae}};async function se(r,e={}){let{draco:t}=await S(e),o=new m(t);try{return o.encodeSync(r,e.draco)}finally{o.destroy()}}(()=>{!f.inWorkerThread()||(f.onmessage=async(r,e)=>{switch(r){case"process":try{let{input:t,options:o}=e,a=await x.encode(t,o);f.postMessage("done",{result:a})}catch(t){let o=t instanceof Error?t.message:"";f.postMessage("error",{error:o})}break;default:}})})();})(); | ||
//# sourceMappingURL=draco-writer-worker.js.map |
@@ -7,4 +7,4 @@ "use strict"; | ||
exports.VERSION = void 0; | ||
var VERSION = typeof "4.0.0-alpha.17" !== 'undefined' ? "4.0.0-alpha.17" : 'latest'; | ||
var VERSION = typeof "4.0.0-alpha.18" !== 'undefined' ? "4.0.0-alpha.18" : 'latest'; | ||
exports.VERSION = VERSION; | ||
//# sourceMappingURL=version.js.map |
@@ -1,2 +0,2 @@ | ||
export const VERSION = typeof "4.0.0-alpha.17" !== 'undefined' ? "4.0.0-alpha.17" : 'latest'; | ||
export const VERSION = typeof "4.0.0-alpha.18" !== 'undefined' ? "4.0.0-alpha.18" : 'latest'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@loaders.gl/draco", | ||
"version": "4.0.0-alpha.17", | ||
"version": "4.0.0-alpha.18", | ||
"description": "Framework-independent loader and writer for Draco compressed meshes and point clouds", | ||
@@ -45,11 +45,11 @@ "license": "MIT", | ||
"@babel/runtime": "^7.3.1", | ||
"@loaders.gl/loader-utils": "4.0.0-alpha.17", | ||
"@loaders.gl/schema": "4.0.0-alpha.17", | ||
"@loaders.gl/worker-utils": "4.0.0-alpha.17", | ||
"@loaders.gl/loader-utils": "4.0.0-alpha.18", | ||
"@loaders.gl/schema": "4.0.0-alpha.18", | ||
"@loaders.gl/worker-utils": "4.0.0-alpha.18", | ||
"draco3d": "1.5.5" | ||
}, | ||
"devDependencies": { | ||
"@loaders.gl/polyfills": "4.0.0-alpha.17" | ||
"@loaders.gl/polyfills": "4.0.0-alpha.18" | ||
}, | ||
"gitHead": "68a743e2460cc89bf89edabfd08b395380d7d10c" | ||
"gitHead": "7bc633f46560f661bdd46cf1015ea27b3694ebce" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
7991532
14183
68
+ Added@loaders.gl/loader-utils@4.0.0-alpha.18(transitive)
+ Added@loaders.gl/schema@4.0.0-alpha.18(transitive)
+ Added@loaders.gl/worker-utils@4.0.0-alpha.18(transitive)
- Removed@loaders.gl/loader-utils@4.0.0-alpha.17(transitive)
- Removed@loaders.gl/schema@4.0.0-alpha.17(transitive)
- Removed@loaders.gl/worker-utils@4.0.0-alpha.17(transitive)