Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@loaders.gl/draco

Package Overview
Dependencies
Maintainers
9
Versions
339
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@loaders.gl/draco - npm Package Compare versions

Comparing version 4.0.0-alpha.18 to 4.0.0-alpha.19

dist/es5/libs/draco_decoder.wasm

6

dist/dist.min.js

@@ -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=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();})();
(()=>{var ht=Object.create;var T=Object.defineProperty;var At=Object.getOwnPropertyDescriptor;var gt=Object.getOwnPropertyNames;var Dt=Object.getPrototypeOf,_t=Object.prototype.hasOwnProperty;var F=o=>T(o,"__esModule",{value:!0});var l=(o,t)=>()=>(o&&(t=o(o=0)),t);var k=(o,t)=>()=>(t||o((t={exports:{}}).exports,t),t.exports),Tt=(o,t)=>{F(o);for(var e in t)T(o,e,{get:t[e],enumerable:!0})},Ot=(o,t,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of gt(t))!_t.call(o,r)&&r!=="default"&&T(o,r,{get:()=>t[r],enumerable:!(e=At(t,r))||e.enumerable});return o},Mt=o=>Ot(F(T(o!=null?ht(Dt(o)):{},"default",o&&o.__esModule&&"default"in o?{get:()=>o.default,enumerable:!0}:{value:o,enumerable:!0})),o);var h,O=l(()=>{h=typeof __VERSION__!="undefined"?__VERSION__:"latest"});var Et,L,W=l(()=>{O();Et={draco:{decoderType:typeof WebAssembly=="object"?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}},L={name:"Draco",id:"draco",module:"draco",version:h,worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:Et}});function z(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=l(()=>{});function x(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 y=s[d],f=s[d+1],b=s[d+2];t=y<t?y:t,e=f<e?f:e,r=b<r?b:r,a=y>a?y:a,n=f>n?f:n,i=b>i?b:i}return[[t,e,r],[a,n,i]]}var v=l(()=>{});function C(o,t,e){let r=z(t.value),a=e||G(t);return{name:o,type:{type:"fixed-size-list",listSize:t.size,children:[{name:"value",type:r}]},nullable:!1,metadata:a}}function G(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 j=l(()=>{U()});var S=l(()=>{v();j()});function q(o,t,e){let r=$(t.metadata),a=[],n=wt(t.attributes);for(let i in o){let s=o[i],c=V(i,s,n[i]);a.push(c)}if(e){let i=V("indices",e);a.push(i)}return{fields:a,metadata:r}}function wt(o){let t={};for(let e in o){let r=o[e];t[r.name||"undefined"]=r}return t}function V(o,t,e){let r=e?$(e.metadata):void 0;return C(o,t,r)}function $(o){Object.entries(o);let t={};for(let e in o)t[`${e}.string`]=JSON.stringify(o[e]);return t}var Q=l(()=>{S()});function Lt(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 xt(o){let t=o.size(),e=new Int32Array(t);for(let r=0;r<t;r++)e[r]=o.GetValue(r);return e}function Ct(o){let t=o.size(),e=new Int32Array(t);for(let r=0;r<t;r++)e[r]=o.GetValue(r);return e}var X,It,Rt,M,Y=l(()=>{S();Q();X={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},It={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},Rt=4,M=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 b=`DRACO decompression failed: ${i.error_msg()}`;throw new Error(b)}let s=this._getDracoLoaderData(n,a,e),c=this._getMeshData(n,s,e),d=x(c.attributes),y=q(c.attributes,s,c.indices);return{loader:"draco",loaderData:s,header:{vertexCount:n.num_points(),boundingBox:d},...c,schema:y}}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*Rt,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),Ct(e)}finally{this.draco.destroy(e)}}_getAttributeValues(t,e){let r=It[e.data_type],a=e.num_components,i=t.num_points()*a,s=i*r.BYTES_PER_ELEMENT,c=Lt(this.draco,r),d,y=this.draco._malloc(s);try{let f=this.decoder.GetAttribute(t,e.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(t,f,c,s,y),d=new r(this.draco.HEAPF32.buffer,y,i).slice()}finally{this.draco._free(y)}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 X)if(this.draco[i]===a)return X[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=xt(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 St,B,H=l(()=>{St="beta",B=typeof __VERSION__!="undefined"?__VERSION__:St;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 J(o,t){if(!o)throw new Error(t||"loaders.gl assertion failed.")}var K=l(()=>{});var p,De,_e,Z,Te,E,w,Oe,tt,Me,et=l(()=>{p={self:typeof self!="undefined"&&self,window:typeof window!="undefined"&&window,global:typeof global!="undefined"&&global,document:typeof document!="undefined"&&document},De=p.self||p.window||p.global||{},_e=p.window||p.self||p.global||{},Z=p.global||p.self||p.window||{},Te=p.document||{},E=typeof process!="object"||String(process)!=="[object process]"||process.browser,w=typeof importScripts=="function",Oe=typeof window!="undefined"&&typeof window.orientation!="undefined",tt=typeof process!="undefined"&&process.version&&/v([0-9]*)/.exec(process.version),Me=tt&&parseFloat(tt[1])||0});var rt=k(()=>{});async function A(o,t=null,e={},r=null){return t&&(o=ot(o,t,e,r)),P[o]=P[o]||Nt(o),await P[o]}function ot(o,t,e={},r=null){if(!e.useLocalLibraries&&o.startsWith("http"))return o;r=r||o;let a=e.modules||{};return a[r]?a[r]:E?e.CDN?(J(e.CDN.startsWith("http")),`${e.CDN}/${t}@${Pt}/dist/libs/${r}`):w?`../src/libs/${r}`:`modules/${t}/src/libs/${r}`:`modules/${t}/dist/libs/${r}`}async function Nt(o){if(o.endsWith("wasm"))return await kt(o);if(!E)try{return m&&m.requireFromFile&&await m.requireFromFile(o)}catch{return null}if(w)return importScripts(o);let t=await Wt(o);return Ft(t,o)}function Ft(o,t){if(!E)return m.requireFromString&&m.requireFromString(o,t);if(w)return eval.call(Z,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}async function kt(o){return!m.readFileAsArrayBuffer||o.startsWith("http")?await(await fetch(o)).arrayBuffer():await m.readFileAsArrayBuffer(o)}async function Wt(o){return!m.readFileAsText||o.startsWith("http")?await(await fetch(o)).text():await m.readFileAsText(o)}var m,Bt,Pt,P,at=l(()=>{et();m=Mt(rt());K();H();Bt="beta",Pt=typeof B!="undefined"?B:Bt,P={}});var nt=l(()=>{at()});async function it(o){let t=o.modules||{};return t.draco3d?D=D||t.draco3d.createDecoderModule({}).then(e=>({draco:e})):D=D||vt(o),await D}async function st(o){let t=o.modules||{};return t.draco3d?_=_||t.draco3d.createEncoderModule({}).then(e=>({draco:e})):_=_||jt(o),await _}async function vt(o){let t,e;switch(o.draco&&o.draco.decoderType){case"js":t=await A(g[u.FALLBACK_DECODER],"draco",o,u.FALLBACK_DECODER);break;case"wasm":default:[t,e]=await Promise.all([await A(g[u.DECODER],"draco",o,u.DECODER),await A(g[u.DECODER_WASM],"draco",o,u.DECODER_WASM)])}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 A(g[u.ENCODER],"draco",o,u.ENCODER);return t=t||globalThis.DracoEncoderModule,new Promise(e=>{t({onModuleLoaded:r=>e({draco:r})})})}var zt,Ut,N,u,g,D,_,I=l(()=>{nt();zt="1.5.5",Ut="1.4.1",N=`https://www.gstatic.com/draco/versioned/decoders/${zt}`,u={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},g={[u.DECODER]:`${N}/${u.DECODER}`,[u.DECODER_WASM]:`${N}/${u.DECODER_WASM}`,[u.FALLBACK_DECODER]:`${N}/${u.FALLBACK_DECODER}`,[u.ENCODER]:`https://raw.githubusercontent.com/google/draco/${Ut}/javascript/${u.ENCODER}`}});function dt(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 ct,qt,R,ut=l(()=>{ct={POSITION:"POSITION",NORMAL:"NORMAL",COLOR_0:"COLOR",TEXCOORD_0:"TEX_COORD"},qt=()=>{},R=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`),dt(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`),dt(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=ct[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=ct[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 st(t),r=new R(e);try{return r.encodeSync(o,t.draco)}finally{r.destroy()}}var $t,lt,yt=l(()=>{ut();I();O();$t={pointcloud:!1,attributeNameEntry:"name"},lt={name:"DRACO",id:"draco",module:"draco",version:h,extensions:["drc"],encode:Qt,options:{draco:$t}}});var mt={};Tt(mt,{DRACO_EXTERNAL_LIBRARIES:()=>u,DRACO_EXTERNAL_LIBRARY_URLS:()=>g,DracoLoader:()=>pt,DracoWorkerLoader:()=>L,DracoWriter:()=>lt,DracoWriterWorker:()=>Xt,_TypecheckDracoLoader:()=>Ht});async function Yt(o,t){let{draco:e}=await it(t),r=new M(e);try{return r.parseSync(o,t?.draco)}finally{r.destroy()}}var Xt,pt,Ht,ft=l(()=>{W();Y();I();O();I();yt();Xt={id:"draco-writer",name:"Draco compressed geometry writer",module:"draco",version:h,worker:!0,options:{draco:{},source:null}},pt={...L,parse:Yt};Ht=pt});var Kt=k((Qe,bt)=>{var Jt=(ft(),mt);globalThis.loaders=globalThis.loaders||{};bt.exports=Object.assign(globalThis.loaders,Jt)});Kt();})();
//# sourceMappingURL=dist.min.js.map

@@ -1,2 +0,2 @@

(()=>{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($);})();
(()=>{var X=Object.create;var w=Object.defineProperty;var J=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var H=Object.getPrototypeOf,Z=Object.prototype.hasOwnProperty;var ee=t=>w(t,"__esModule",{value:!0});var te=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var re=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of K(e))!Z.call(t,o)&&o!=="default"&&w(t,o,{get:()=>e[o],enumerable:!(r=J(e,o))||r.enumerable});return t},oe=t=>re(ee(w(t!=null?X(H(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var B=te(()=>{});var x="4.0.0-alpha.19";function S(t,e){if(!t)throw new Error(e||"loaders.gl assertion failed.")}var f={self:typeof self!="undefined"&&self,window:typeof window!="undefined"&&window,global:typeof global!="undefined"&&global,document:typeof document!="undefined"&&document},Ie=f.self||f.window||f.global||{},Re=f.window||f.self||f.global||{},C=f.global||f.self||f.window||{},ke=f.document||{};var D=typeof process!="object"||String(process)!=="[object process]"||process.browser,T=typeof importScripts=="function",Pe=typeof window!="undefined"&&typeof window.orientation!="undefined",F=typeof process!="undefined"&&process.version&&/v([0-9]*)/.exec(process.version),Se=F&&parseFloat(F[1])||0;function M(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)M(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 b(){let parentPort;try{eval("globalThis.parentPort = require('worker_threads').parentPort"),parentPort=globalThis.parentPort}catch{}return parentPort}var O=new Map,d=class{static inWorkerThread(){return typeof self!="undefined"||Boolean(b())}static set onmessage(e){function r(a){let s=b(),{type:n,payload:i}=s?a:a.data;e(n,i)}let o=b();o?(o.on("message",r),o.on("exit",()=>console.debug("Node worker closing"))):globalThis.onmessage=r}static addEventListener(e){let r=O.get(e);r||(r=a=>{if(!ae(a))return;let s=b(),{type:n,payload:i}=s?a:a.data;e(n,i)}),b()?console.error("not implemented"):globalThis.addEventListener("message",r)}static removeEventListener(e){let r=O.get(e);O.delete(e),b()?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=b();s?s.postMessage(o,a):globalThis.postMessage(o,a)}};function ae(t){let{type:e,data:r}=t;return e==="message"&&r&&typeof r.source=="string"&&r.source.startsWith("loaders.gl")}var y=oe(B());var se="beta",ne=typeof x!="undefined"?x:se,E={};async function h(t,e=null,r={},o=null){return e&&(t=W(t,e,r,o)),E[t]=E[t]||ie(t),await E[t]}function W(t,e,r={},o=null){if(!r.useLocalLibraries&&t.startsWith("http"))return t;o=o||t;let a=r.modules||{};return a[o]?a[o]:D?r.CDN?(S(r.CDN.startsWith("http")),`${r.CDN}/${e}@${ne}/dist/libs/${o}`):T?`../src/libs/${o}`:`modules/${e}/src/libs/${o}`:`modules/${e}/dist/libs/${o}`}async function ie(t){if(t.endsWith("wasm"))return await le(t);if(!D)try{return y&&y.requireFromFile&&await y.requireFromFile(t)}catch{return null}if(T)return importScripts(t);let e=await de(t);return ce(e,t)}function ce(t,e){if(!D)return y.requireFromString&&y.requireFromString(t,e);if(T)return eval.call(C,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 le(t){return!y.readFileAsArrayBuffer||t.startsWith("http")?await(await fetch(t)).arrayBuffer():await y.readFileAsArrayBuffer(t)}async function de(t){return!y.readFileAsText||t.startsWith("http")?await(await fetch(t)).text():await y.readFileAsText(t)}var ue=0;function L(t){!d.inWorkerThread()||(d.onmessage=async(e,r)=>{switch(e){case"process":try{let{input:o,options:a={},context:s={}}=r,n=await fe({loader:t,arrayBuffer:o,options:a,context:{...s,parse:pe}});d.postMessage("done",{result:n})}catch(o){let a=o instanceof Error?o.message:"";d.postMessage("error",{error:a})}break;default:}})}function pe(t,e){return new Promise((r,o)=>{let a=ue++,s=(i,c)=>{if(c.id===a)switch(i){case"done":d.removeEventListener(s),r(c.result);break;case"error":d.removeEventListener(s),o(c.error);break;default:}};d.addEventListener(s);let n={id:a,input:t,options:e};d.postMessage("process",n)})}async function fe({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 v="4.0.0-alpha.19";var ye={draco:{decoderType:typeof WebAssembly=="object"?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}},z={name:"Draco",id:"draco",module:"draco",version:v,worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:ye};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 I(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 u=0;u<c;u+=3){let p=i[u],m=i[u+1],g=i[u+2];e=p<e?p:e,r=m<r?m:r,o=g<o?g:o,a=p>a?p:a,s=m>s?m:s,n=g>n?g:n}return[[e,r,o],[a,s,n]]}function R(t,e,r){let o=V(e.value),a=r||U(e);return{name:t,type:{type:"fixed-size-list",listSize:e.size,children:[{name:"value",type:o}]},nullable:!1,metadata:a}}function U(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 q(t,e,r){let o=$(e.metadata),a=[],s=me(e.attributes);for(let n in t){let i=t[n],c=G(n,i,s[n]);a.push(c)}if(r){let n=G("indices",r);a.push(n)}return{fields:a,metadata:o}}function me(t){let e={};for(let r in t){let o=t[r];e[o.name||"undefined"]=o}return e}function G(t,e,r){let o=r?$(r.metadata):void 0;return R(t,e,o)}function $(t){Object.entries(t);let e={};for(let r in t)e[`${r}.string`]=JSON.stringify(t[r]);return e}var Q={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},be={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},ge=4,_=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 g=`DRACO decompression failed: ${n.error_msg()}`;throw new Error(g)}let i=this._getDracoLoaderData(s,a,r),c=this._getMeshData(s,i,r),u=I(c.attributes),p=q(c.attributes,i,c.indices);return{loader:"draco",loaderData:i,header:{vertexCount:s.num_points(),boundingBox:u},...c,schema:p}}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*ge,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),De(r)}finally{this.draco.destroy(r)}}_getAttributeValues(e,r){let o=be[r.data_type],a=r.num_components,n=e.num_points()*a,i=n*o.BYTES_PER_ELEMENT,c=he(this.draco,o),u,p=this.draco._malloc(i);try{let m=this.decoder.GetAttribute(e,r.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(e,m,c,i,p),u=new o(this.draco.HEAPF32.buffer,p,n).slice()}finally{this.draco._free(p)}return{value:u,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 Q)if(this.draco[n]===a)return Q[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=Ae(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 he(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 Ae(t){let e=t.size(),r=new Int32Array(e);for(let o=0;o<e;o++)r[o]=t.GetValue(o);return r}function De(t){let e=t.size(),r=new Int32Array(e);for(let o=0;o<e;o++)r[o]=t.GetValue(o);return r}var Te="1.5.5",_e="1.4.1",k=`https://www.gstatic.com/draco/versioned/decoders/${Te}`,l={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},P={[l.DECODER]:`${k}/${l.DECODER}`,[l.DECODER_WASM]:`${k}/${l.DECODER_WASM}`,[l.FALLBACK_DECODER]:`${k}/${l.FALLBACK_DECODER}`,[l.ENCODER]:`https://raw.githubusercontent.com/google/draco/${_e}/javascript/${l.ENCODER}`},A;async function j(t){let e=t.modules||{};return e.draco3d?A=A||e.draco3d.createDecoderModule({}).then(r=>({draco:r})):A=A||we(t),await A}async function we(t){let e,r;switch(t.draco&&t.draco.decoderType){case"js":e=await h(P[l.FALLBACK_DECODER],"draco",t,l.FALLBACK_DECODER);break;case"wasm":default:[e,r]=await Promise.all([await h(P[l.DECODER],"draco",t,l.DECODER),await h(P[l.DECODER_WASM],"draco",t,l.DECODER_WASM)])}return e=e||globalThis.DracoDecoderModule,await xe(e,r)}function xe(t,e){let r={};return e&&(r.wasmBinary=e),new Promise(o=>{t({...r,onModuleLoaded:a=>o({draco:a})})})}var Y={...z,parse:Me};async function Me(t,e){let{draco:r}=await j(e),o=new _(r);try{return o.parseSync(t,e?.draco)}finally{o.destroy()}}L(Y);})();
//# sourceMappingURL=draco-worker.js.map

@@ -1,4 +0,4 @@

(()=>{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:}})})();})();
(()=>{var N=Object.create;var w=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var $=Object.getPrototypeOf,V=Object.prototype.hasOwnProperty;var q=t=>w(t,"__esModule",{value:!0});var j=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var G=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of v(e))!V.call(t,o)&&o!=="default"&&w(t,o,{get:()=>e[o],enumerable:!(r=F(e,o))||r.enumerable});return t},z=t=>G(q(w(t!=null?N($(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var C=j(()=>{});var A="4.0.0-alpha.19";function R(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},le=c.self||c.window||c.global||{},ue=c.window||c.self||c.global||{},k=c.global||c.self||c.window||{},fe=c.document||{};var g=typeof process!="object"||String(process)!=="[object process]"||process.browser,m=typeof importScripts=="function",pe=typeof window!="undefined"&&typeof window.orientation!="undefined",T=typeof process!="undefined"&&process.version&&/v([0-9]*)/.exec(process.version),ye=T&&parseFloat(T[1])||0;function D(t,e=!0,r){let o=r||new Set;if(t){if(B(t))o.add(t);else if(B(t.buffer))o.add(t.buffer);else if(!ArrayBuffer.isView(t)){if(e&&typeof t=="object")for(let a in t)D(t[a],e,o)}}return r===void 0?Array.from(o):[]}function B(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 y(){let parentPort;try{eval("globalThis.parentPort = require('worker_threads').parentPort"),parentPort=globalThis.parentPort}catch{}return parentPort}var b=new Map,p=class{static inWorkerThread(){return typeof self!="undefined"||Boolean(y())}static set onmessage(e){function r(a){let n=y(),{type:i,payload:s}=n?a:a.data;e(i,s)}let o=y();o?(o.on("message",r),o.on("exit",()=>console.debug("Node worker closing"))):globalThis.onmessage=r}static addEventListener(e){let r=b.get(e);r||(r=a=>{if(!U(a))return;let n=y(),{type:i,payload:s}=n?a:a.data;e(i,s)}),y()?console.error("not implemented"):globalThis.addEventListener("message",r)}static removeEventListener(e){let r=b.get(e);b.delete(e),y()?console.error("not implemented"):globalThis.removeEventListener("message",r)}static postMessage(e,r){let o={source:"loaders.gl",type:e,payload:r},a=D(r),n=y();n?n.postMessage(o,a):globalThis.postMessage(o,a)}};function U(t){let{type:e,data:r}=t;return e==="message"&&r&&typeof r.source=="string"&&r.source.startsWith("loaders.gl")}var u=z(C());var K="beta",X=typeof A!="undefined"?A:K,M={};async function _(t,e=null,r={},o=null){return e&&(t=W(t,e,r,o)),M[t]=M[t]||Q(t),await M[t]}function W(t,e,r={},o=null){if(!r.useLocalLibraries&&t.startsWith("http"))return t;o=o||t;let a=r.modules||{};return a[o]?a[o]:g?r.CDN?(R(r.CDN.startsWith("http")),`${r.CDN}/${e}@${X}/dist/libs/${o}`):m?`../src/libs/${o}`:`modules/${e}/src/libs/${o}`:`modules/${e}/dist/libs/${o}`}async function Q(t){if(t.endsWith("wasm"))return await J(t);if(!g)try{return u&&u.requireFromFile&&await u.requireFromFile(t)}catch{return null}if(m)return importScripts(t);let e=await Y(t);return H(e,t)}function H(t,e){if(!g)return u.requireFromString&&u.requireFromString(t,e);if(m)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}async function J(t){return!u.readFileAsArrayBuffer||t.startsWith("http")?await(await fetch(t)).arrayBuffer():await u.readFileAsArrayBuffer(t)}async function Y(t){return!u.readFileAsText||t.startsWith("http")?await(await fetch(t)).text():await u.readFileAsText(t)}var I={POSITION:"POSITION",NORMAL:"NORMAL",COLOR_0:"COLOR",TEXCOORD_0:"TEX_COORD"},Z=()=>{},E=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=Z,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 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`),P(n)}finally{this.destroyEncodedObject(n),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 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`),P(n)}finally{this.destroyEncodedObject(n),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 n=this._getPositionAttribute(r);if(!n)throw new Error("positions");let i=n.length/3;for(let s in r){let d=r[s];s=I[s]||s;let f=this._addAttributeToMesh(e,s,d,i);f!==-1&&this._addAttributeMetadata(e,f,{name:s,...a[s]||{}})}}catch(n){throw this.destroyEncodedObject(e),n}return e}_createDracoPointCloud(e,r,o){let a=o.attributesMetadata||{};try{let n=this._getPositionAttribute(r);if(!n)throw new Error("positions");let i=n.length/3;for(let s in r){let d=r[s];s=I[s]||s;let f=this._addAttributeToMesh(e,s,d,i);f!==-1&&this._addAttributeMetadata(e,f,{name:s,...a[s]||{}})}}catch(n){throw this.destroyEncodedObject(e),n}return e}_addAttributeToMesh(e,r,o,a){if(!ArrayBuffer.isView(o))return-1;let n=this._getDracoAttributeType(r),i=o.length/a;if(n==="indices"){let f=o.length/3;return this.log(`Adding attribute ${r}, size ${f}`),this.dracoMeshBuilder.AddFacesToMesh(e,f,o),-1}this.log(`Adding attribute ${r}, size ${i}`);let s=this.dracoMeshBuilder,{buffer:d}=o;switch(o.constructor){case Int8Array:return s.AddInt8Attribute(e,n,a,i,new Int8Array(d));case Int16Array:return s.AddInt16Attribute(e,n,a,i,new Int16Array(d));case Int32Array:return s.AddInt32Attribute(e,n,a,i,new Int32Array(d));case Uint8Array:case Uint8ClampedArray:return s.AddUInt8Attribute(e,n,a,i,new Uint8Array(d));case Uint16Array:return s.AddUInt16Attribute(e,n,a,i,new Uint16Array(d));case Uint32Array:return s.AddUInt32Attribute(e,n,a,i,new Uint32Array(d));case Float32Array:default:return s.AddFloatAttribute(e,n,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 ee(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 P(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 ee(t){return t.entries&&!t.hasOwnProperty("entries")?t.entries():Object.entries(t)}var re="1.5.5",te="1.4.1",O=`https://www.gstatic.com/draco/versioned/decoders/${re}`,l={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},oe={[l.DECODER]:`${O}/${l.DECODER}`,[l.DECODER_WASM]:`${O}/${l.DECODER_WASM}`,[l.FALLBACK_DECODER]:`${O}/${l.FALLBACK_DECODER}`,[l.ENCODER]:`https://raw.githubusercontent.com/google/draco/${te}/javascript/${l.ENCODER}`};var h;async function L(t){let e=t.modules||{};return e.draco3d?h=h||e.draco3d.createEncoderModule({}).then(r=>({draco:r})):h=h||ae(t),await h}async function ae(t){let e=await _(oe[l.ENCODER],"draco",t,l.ENCODER);return e=e||globalThis.DracoEncoderModule,new Promise(r=>{e({onModuleLoaded:o=>r({draco:o})})})}var S="4.0.0-alpha.19";var ne={pointcloud:!1,attributeNameEntry:"name"},x={name:"DRACO",id:"draco",module:"draco",version:S,extensions:["drc"],encode:se,options:{draco:ne}};async function se(t,e={}){let{draco:r}=await L(e),o=new E(r);try{return o.encodeSync(t,e.draco)}finally{o.destroy()}}(()=>{!p.inWorkerThread()||(p.onmessage=async(t,e)=>{switch(t){case"process":try{let{input:r,options:o}=e,a=await x.encode(r,o);p.postMessage("done",{result:a})}catch(r){let o=r instanceof Error?r.message:"";p.postMessage("error",{error:o})}break;default:}})})();})();
//# sourceMappingURL=draco-writer-worker.js.map

@@ -7,2 +7,14 @@ "use strict";

});
Object.defineProperty(exports, "DRACO_EXTERNAL_LIBRARIES", {
enumerable: true,
get: function get() {
return _dracoModuleLoader.DRACO_EXTERNAL_LIBRARIES;
}
});
Object.defineProperty(exports, "DRACO_EXTERNAL_LIBRARY_URLS", {
enumerable: true,
get: function get() {
return _dracoModuleLoader.DRACO_EXTERNAL_LIBRARY_URLS;
}
});
exports.DracoLoader = void 0;

@@ -9,0 +21,0 @@ Object.defineProperty(exports, "DracoWorkerLoader", {

@@ -7,2 +7,3 @@ "use strict";

});
exports.DRACO_EXTERNAL_LIBRARY_URLS = exports.DRACO_EXTERNAL_LIBRARIES = void 0;
exports.loadDracoDecoderModule = loadDracoDecoderModule;

@@ -12,5 +13,6 @@ exports.loadDracoEncoderModule = loadDracoEncoderModule;

var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _workerUtils = require("@loaders.gl/worker-utils");
var _DRACO_EXTERNAL_LIBRA;
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }

@@ -21,6 +23,11 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }

var STATIC_DECODER_URL = "https://www.gstatic.com/draco/versioned/decoders/".concat(DRACO_DECODER_VERSION);
var DRACO_JS_DECODER_URL = "".concat(STATIC_DECODER_URL, "/draco_decoder.js");
var DRACO_WASM_WRAPPER_URL = "".concat(STATIC_DECODER_URL, "/draco_wasm_wrapper.js");
var DRACO_WASM_DECODER_URL = "".concat(STATIC_DECODER_URL, "/draco_decoder.wasm");
var DRACO_ENCODER_URL = "https://raw.githubusercontent.com/google/draco/".concat(DRACO_ENCODER_VERSION, "/javascript/draco_encoder.js");
var DRACO_EXTERNAL_LIBRARIES = {
DECODER: 'draco_wasm_wrapper.js',
DECODER_WASM: 'draco_decoder.wasm',
FALLBACK_DECODER: 'draco_decoder.js',
ENCODER: 'draco_encoder.js'
};
exports.DRACO_EXTERNAL_LIBRARIES = DRACO_EXTERNAL_LIBRARIES;
var DRACO_EXTERNAL_LIBRARY_URLS = (_DRACO_EXTERNAL_LIBRA = {}, (0, _defineProperty2.default)(_DRACO_EXTERNAL_LIBRA, DRACO_EXTERNAL_LIBRARIES.DECODER, "".concat(STATIC_DECODER_URL, "/").concat(DRACO_EXTERNAL_LIBRARIES.DECODER)), (0, _defineProperty2.default)(_DRACO_EXTERNAL_LIBRA, DRACO_EXTERNAL_LIBRARIES.DECODER_WASM, "".concat(STATIC_DECODER_URL, "/").concat(DRACO_EXTERNAL_LIBRARIES.DECODER_WASM)), (0, _defineProperty2.default)(_DRACO_EXTERNAL_LIBRA, DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER, "".concat(STATIC_DECODER_URL, "/").concat(DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER)), (0, _defineProperty2.default)(_DRACO_EXTERNAL_LIBRA, DRACO_EXTERNAL_LIBRARIES.ENCODER, "https://raw.githubusercontent.com/google/draco/".concat(DRACO_ENCODER_VERSION, "/javascript/").concat(DRACO_EXTERNAL_LIBRARIES.ENCODER)), _DRACO_EXTERNAL_LIBRA);
exports.DRACO_EXTERNAL_LIBRARY_URLS = DRACO_EXTERNAL_LIBRARY_URLS;
var loadDecoderPromise;

@@ -104,3 +111,3 @@ var loadEncoderPromise;

_context3.next = 5;
return (0, _workerUtils.loadLibrary)(DRACO_JS_DECODER_URL, 'draco', options);
return (0, _workerUtils.loadLibrary)(DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER], 'draco', options, DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER);
case 5:

@@ -112,7 +119,7 @@ DracoDecoderModule = _context3.sent;

_context3.next = 10;
return (0, _workerUtils.loadLibrary)(DRACO_WASM_WRAPPER_URL, 'draco', options);
return (0, _workerUtils.loadLibrary)(DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.DECODER], 'draco', options, DRACO_EXTERNAL_LIBRARIES.DECODER);
case 10:
_context3.t2 = _context3.sent;
_context3.next = 13;
return (0, _workerUtils.loadLibrary)(DRACO_WASM_DECODER_URL, 'draco', options);
return (0, _workerUtils.loadLibrary)(DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.DECODER_WASM], 'draco', options, DRACO_EXTERNAL_LIBRARIES.DECODER_WASM);
case 13:

@@ -167,3 +174,3 @@ _context3.t3 = _context3.sent;

_context4.next = 2;
return (0, _workerUtils.loadLibrary)(DRACO_ENCODER_URL, 'draco', options);
return (0, _workerUtils.loadLibrary)(DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.ENCODER], 'draco', options, DRACO_EXTERNAL_LIBRARIES.ENCODER);
case 2:

@@ -170,0 +177,0 @@ DracoEncoderModule = _context4.sent;

@@ -7,4 +7,4 @@ "use strict";

exports.VERSION = void 0;
var VERSION = typeof "4.0.0-alpha.18" !== 'undefined' ? "4.0.0-alpha.18" : 'latest';
var VERSION = typeof "4.0.0-alpha.19" !== 'undefined' ? "4.0.0-alpha.19" : 'latest';
exports.VERSION = VERSION;
//# sourceMappingURL=version.js.map

@@ -5,2 +5,3 @@ import { DracoLoader as DracoWorkerLoader } from './draco-loader';

import { VERSION } from './lib/utils/version';
export { DRACO_EXTERNAL_LIBRARIES, DRACO_EXTERNAL_LIBRARY_URLS } from './lib/draco-module-loader';
export { DracoWriter } from './draco-writer';

@@ -7,0 +8,0 @@ export const DracoWriterWorker = {

@@ -5,6 +5,14 @@ import { loadLibrary } from '@loaders.gl/worker-utils';

const STATIC_DECODER_URL = "https://www.gstatic.com/draco/versioned/decoders/".concat(DRACO_DECODER_VERSION);
const DRACO_JS_DECODER_URL = "".concat(STATIC_DECODER_URL, "/draco_decoder.js");
const DRACO_WASM_WRAPPER_URL = "".concat(STATIC_DECODER_URL, "/draco_wasm_wrapper.js");
const DRACO_WASM_DECODER_URL = "".concat(STATIC_DECODER_URL, "/draco_decoder.wasm");
const DRACO_ENCODER_URL = "https://raw.githubusercontent.com/google/draco/".concat(DRACO_ENCODER_VERSION, "/javascript/draco_encoder.js");
export const DRACO_EXTERNAL_LIBRARIES = {
DECODER: 'draco_wasm_wrapper.js',
DECODER_WASM: 'draco_decoder.wasm',
FALLBACK_DECODER: 'draco_decoder.js',
ENCODER: 'draco_encoder.js'
};
export const DRACO_EXTERNAL_LIBRARY_URLS = {
[DRACO_EXTERNAL_LIBRARIES.DECODER]: "".concat(STATIC_DECODER_URL, "/").concat(DRACO_EXTERNAL_LIBRARIES.DECODER),
[DRACO_EXTERNAL_LIBRARIES.DECODER_WASM]: "".concat(STATIC_DECODER_URL, "/").concat(DRACO_EXTERNAL_LIBRARIES.DECODER_WASM),
[DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER]: "".concat(STATIC_DECODER_URL, "/").concat(DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER),
[DRACO_EXTERNAL_LIBRARIES.ENCODER]: "https://raw.githubusercontent.com/google/draco/".concat(DRACO_ENCODER_VERSION, "/javascript/").concat(DRACO_EXTERNAL_LIBRARIES.ENCODER)
};
let loadDecoderPromise;

@@ -43,7 +51,7 @@ let loadEncoderPromise;

case 'js':
DracoDecoderModule = await loadLibrary(DRACO_JS_DECODER_URL, 'draco', options);
DracoDecoderModule = await loadLibrary(DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER], 'draco', options, DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER);
break;
case 'wasm':
default:
[DracoDecoderModule, wasmBinary] = await Promise.all([await loadLibrary(DRACO_WASM_WRAPPER_URL, 'draco', options), await loadLibrary(DRACO_WASM_DECODER_URL, 'draco', options)]);
[DracoDecoderModule, wasmBinary] = await Promise.all([await loadLibrary(DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.DECODER], 'draco', options, DRACO_EXTERNAL_LIBRARIES.DECODER), await loadLibrary(DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.DECODER_WASM], 'draco', options, DRACO_EXTERNAL_LIBRARIES.DECODER_WASM)]);
}

@@ -68,3 +76,3 @@ DracoDecoderModule = DracoDecoderModule || globalThis.DracoDecoderModule;

async function loadDracoEncoder(options) {
let DracoEncoderModule = await loadLibrary(DRACO_ENCODER_URL, 'draco', options);
let DracoEncoderModule = await loadLibrary(DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.ENCODER], 'draco', options, DRACO_EXTERNAL_LIBRARIES.ENCODER);
DracoEncoderModule = DracoEncoderModule || globalThis.DracoEncoderModule;

@@ -71,0 +79,0 @@ return new Promise(resolve => {

@@ -1,2 +0,2 @@

export const VERSION = typeof "4.0.0-alpha.18" !== 'undefined' ? "4.0.0-alpha.18" : 'latest';
export const VERSION = typeof "4.0.0-alpha.19" !== 'undefined' ? "4.0.0-alpha.19" : 'latest';
//# sourceMappingURL=version.js.map

@@ -5,2 +5,3 @@ import type { LoaderWithParser } from '@loaders.gl/loader-utils';

import { DracoLoader as DracoWorkerLoader } from './draco-loader';
export { DRACO_EXTERNAL_LIBRARIES, DRACO_EXTERNAL_LIBRARY_URLS } from './lib/draco-module-loader';
export type { DracoMesh, DracoLoaderData };

@@ -7,0 +8,0 @@ export type { DracoWriterOptions } from './draco-writer';

@@ -6,3 +6,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports._TypecheckDracoLoader = exports.DracoLoader = exports.DracoWorkerLoader = exports.DracoWriterWorker = exports.DracoWriter = void 0;
exports._TypecheckDracoLoader = exports.DracoLoader = exports.DracoWorkerLoader = exports.DracoWriterWorker = exports.DracoWriter = exports.DRACO_EXTERNAL_LIBRARY_URLS = exports.DRACO_EXTERNAL_LIBRARIES = void 0;
const draco_loader_1 = require("./draco-loader");

@@ -13,2 +13,6 @@ Object.defineProperty(exports, "DracoWorkerLoader", { enumerable: true, get: function () { return draco_loader_1.DracoLoader; } });

const version_1 = require("./lib/utils/version");
// Module constants
var draco_module_loader_2 = require("./lib/draco-module-loader");
Object.defineProperty(exports, "DRACO_EXTERNAL_LIBRARIES", { enumerable: true, get: function () { return draco_module_loader_2.DRACO_EXTERNAL_LIBRARIES; } });
Object.defineProperty(exports, "DRACO_EXTERNAL_LIBRARY_URLS", { enumerable: true, get: function () { return draco_module_loader_2.DRACO_EXTERNAL_LIBRARY_URLS; } });
var draco_writer_1 = require("./draco-writer");

@@ -15,0 +19,0 @@ Object.defineProperty(exports, "DracoWriter", { enumerable: true, get: function () { return draco_writer_1.DracoWriter; } });

@@ -0,3 +1,16 @@

export declare const DRACO_EXTERNAL_LIBRARIES: {
/** The primary Draco3D encoder, javascript wrapper part */
DECODER: string;
/** The primary draco decoder, compiled web assembly part */
DECODER_WASM: string;
/** Fallback decoder for non-webassebly environments. Very big bundle, lower performance */
FALLBACK_DECODER: string;
/** Draco encoder */
ENCODER: string;
};
export declare const DRACO_EXTERNAL_LIBRARY_URLS: {
[x: string]: string;
};
export declare function loadDracoDecoderModule(options: any): Promise<any>;
export declare function loadDracoEncoderModule(options: any): Promise<any>;
//# sourceMappingURL=draco-module-loader.d.ts.map

@@ -6,3 +6,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.loadDracoEncoderModule = exports.loadDracoDecoderModule = void 0;
exports.loadDracoEncoderModule = exports.loadDracoDecoderModule = exports.DRACO_EXTERNAL_LIBRARY_URLS = exports.DRACO_EXTERNAL_LIBRARIES = void 0;
const worker_utils_1 = require("@loaders.gl/worker-utils");

@@ -12,6 +12,18 @@ const DRACO_DECODER_VERSION = '1.5.5';

const STATIC_DECODER_URL = `https://www.gstatic.com/draco/versioned/decoders/${DRACO_DECODER_VERSION}`;
const DRACO_JS_DECODER_URL = `${STATIC_DECODER_URL}/draco_decoder.js`;
const DRACO_WASM_WRAPPER_URL = `${STATIC_DECODER_URL}/draco_wasm_wrapper.js`;
const DRACO_WASM_DECODER_URL = `${STATIC_DECODER_URL}/draco_decoder.wasm`;
const DRACO_ENCODER_URL = `https://raw.githubusercontent.com/google/draco/${DRACO_ENCODER_VERSION}/javascript/draco_encoder.js`;
exports.DRACO_EXTERNAL_LIBRARIES = {
/** The primary Draco3D encoder, javascript wrapper part */
DECODER: 'draco_wasm_wrapper.js',
/** The primary draco decoder, compiled web assembly part */
DECODER_WASM: 'draco_decoder.wasm',
/** Fallback decoder for non-webassebly environments. Very big bundle, lower performance */
FALLBACK_DECODER: 'draco_decoder.js',
/** Draco encoder */
ENCODER: 'draco_encoder.js'
};
exports.DRACO_EXTERNAL_LIBRARY_URLS = {
[exports.DRACO_EXTERNAL_LIBRARIES.DECODER]: `${STATIC_DECODER_URL}/${exports.DRACO_EXTERNAL_LIBRARIES.DECODER}`,
[exports.DRACO_EXTERNAL_LIBRARIES.DECODER_WASM]: `${STATIC_DECODER_URL}/${exports.DRACO_EXTERNAL_LIBRARIES.DECODER_WASM}`,
[exports.DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER]: `${STATIC_DECODER_URL}/${exports.DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER}`,
[exports.DRACO_EXTERNAL_LIBRARIES.ENCODER]: `https://raw.githubusercontent.com/google/draco/${DRACO_ENCODER_VERSION}/javascript/${exports.DRACO_EXTERNAL_LIBRARIES.ENCODER}`
};
let loadDecoderPromise;

@@ -59,3 +71,3 @@ let loadEncoderPromise;

case 'js':
DracoDecoderModule = await (0, worker_utils_1.loadLibrary)(DRACO_JS_DECODER_URL, 'draco', options);
DracoDecoderModule = await (0, worker_utils_1.loadLibrary)(exports.DRACO_EXTERNAL_LIBRARY_URLS[exports.DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER], 'draco', options, exports.DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER);
break;

@@ -65,4 +77,4 @@ case 'wasm':

[DracoDecoderModule, wasmBinary] = await Promise.all([
await (0, worker_utils_1.loadLibrary)(DRACO_WASM_WRAPPER_URL, 'draco', options),
await (0, worker_utils_1.loadLibrary)(DRACO_WASM_DECODER_URL, 'draco', options)
await (0, worker_utils_1.loadLibrary)(exports.DRACO_EXTERNAL_LIBRARY_URLS[exports.DRACO_EXTERNAL_LIBRARIES.DECODER], 'draco', options, exports.DRACO_EXTERNAL_LIBRARIES.DECODER),
await (0, worker_utils_1.loadLibrary)(exports.DRACO_EXTERNAL_LIBRARY_URLS[exports.DRACO_EXTERNAL_LIBRARIES.DECODER_WASM], 'draco', options, exports.DRACO_EXTERNAL_LIBRARIES.DECODER_WASM)
]);

@@ -89,3 +101,3 @@ }

async function loadDracoEncoder(options) {
let DracoEncoderModule = await (0, worker_utils_1.loadLibrary)(DRACO_ENCODER_URL, 'draco', options);
let DracoEncoderModule = await (0, worker_utils_1.loadLibrary)(exports.DRACO_EXTERNAL_LIBRARY_URLS[exports.DRACO_EXTERNAL_LIBRARIES.ENCODER], 'draco', options, exports.DRACO_EXTERNAL_LIBRARIES.ENCODER);
// @ts-ignore

@@ -92,0 +104,0 @@ DracoEncoderModule = DracoEncoderModule || globalThis.DracoEncoderModule;

{
"name": "@loaders.gl/draco",
"version": "4.0.0-alpha.18",
"version": "4.0.0-alpha.19",
"description": "Framework-independent loader and writer for Draco compressed meshes and point clouds",

@@ -35,3 +35,4 @@ "license": "MIT",

"scripts": {
"pre-build": "npm run build-bundle && npm run build-workers",
"pre-build": "npm run copy-libs && npm run build-bundle && npm run build-workers",
"copy-libs": "cp -rf ./src/libs ./dist/libs",
"build-bundle": "esbuild src/bundle.ts --outfile=dist/dist.min.js --bundle --minify --sourcemap",

@@ -46,11 +47,11 @@ "build-workers": "yarn build-loader-worker && yarn build-loader-worker-node && yarn build-writer-worker && yarn build-writer-worker-node",

"@babel/runtime": "^7.3.1",
"@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",
"@loaders.gl/loader-utils": "4.0.0-alpha.19",
"@loaders.gl/schema": "4.0.0-alpha.19",
"@loaders.gl/worker-utils": "4.0.0-alpha.19",
"draco3d": "1.5.5"
},
"devDependencies": {
"@loaders.gl/polyfills": "4.0.0-alpha.18"
"@loaders.gl/polyfills": "4.0.0-alpha.19"
},
"gitHead": "7bc633f46560f661bdd46cf1015ea27b3694ebce"
"gitHead": "2ca50ec4e1d312c124eb7c93c60ab6fd17ee833e"
}

@@ -10,2 +10,5 @@ // loaders.gl, MIT license

// Module constants
export {DRACO_EXTERNAL_LIBRARIES, DRACO_EXTERNAL_LIBRARY_URLS} from './lib/draco-module-loader';
// Draco data types

@@ -12,0 +15,0 @@

@@ -12,7 +12,19 @@ // Dynamic DRACO module loading inspired by THREE.DRACOLoader

const DRACO_JS_DECODER_URL = `${STATIC_DECODER_URL}/draco_decoder.js`;
const DRACO_WASM_WRAPPER_URL = `${STATIC_DECODER_URL}/draco_wasm_wrapper.js`;
const DRACO_WASM_DECODER_URL = `${STATIC_DECODER_URL}/draco_decoder.wasm`;
export const DRACO_EXTERNAL_LIBRARIES = {
/** The primary Draco3D encoder, javascript wrapper part */
DECODER: 'draco_wasm_wrapper.js',
/** The primary draco decoder, compiled web assembly part */
DECODER_WASM: 'draco_decoder.wasm',
/** Fallback decoder for non-webassebly environments. Very big bundle, lower performance */
FALLBACK_DECODER: 'draco_decoder.js',
/** Draco encoder */
ENCODER: 'draco_encoder.js'
};
const DRACO_ENCODER_URL = `https://raw.githubusercontent.com/google/draco/${DRACO_ENCODER_VERSION}/javascript/draco_encoder.js`;
export const DRACO_EXTERNAL_LIBRARY_URLS = {
[DRACO_EXTERNAL_LIBRARIES.DECODER]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.DECODER}`,
[DRACO_EXTERNAL_LIBRARIES.DECODER_WASM]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.DECODER_WASM}`,
[DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER]: `${STATIC_DECODER_URL}/${DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER}`,
[DRACO_EXTERNAL_LIBRARIES.ENCODER]: `https://raw.githubusercontent.com/google/draco/${DRACO_ENCODER_VERSION}/javascript/${DRACO_EXTERNAL_LIBRARIES.ENCODER}`
};

@@ -63,3 +75,8 @@ let loadDecoderPromise;

case 'js':
DracoDecoderModule = await loadLibrary(DRACO_JS_DECODER_URL, 'draco', options);
DracoDecoderModule = await loadLibrary(
DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER],
'draco',
options,
DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER
);
break;

@@ -70,4 +87,14 @@

[DracoDecoderModule, wasmBinary] = await Promise.all([
await loadLibrary(DRACO_WASM_WRAPPER_URL, 'draco', options),
await loadLibrary(DRACO_WASM_DECODER_URL, 'draco', options)
await loadLibrary(
DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.DECODER],
'draco',
options,
DRACO_EXTERNAL_LIBRARIES.DECODER
),
await loadLibrary(
DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.DECODER_WASM],
'draco',
options,
DRACO_EXTERNAL_LIBRARIES.DECODER_WASM
)
]);

@@ -98,3 +125,8 @@ }

async function loadDracoEncoder(options) {
let DracoEncoderModule = await loadLibrary(DRACO_ENCODER_URL, 'draco', options);
let DracoEncoderModule = await loadLibrary(
DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.ENCODER],
'draco',
options,
DRACO_EXTERNAL_LIBRARIES.ENCODER
);
// @ts-ignore

@@ -101,0 +133,0 @@ DracoEncoderModule = DracoEncoderModule || globalThis.DracoEncoderModule;

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

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 not supported yet

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 not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc