@loaders.gl/draco 3.1.3 → 4.0.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/dist/bundle.js +2 -2
  2. package/dist/bundle.js.map +1 -0
  3. package/dist/dist.min.js +2 -2
  4. package/dist/dist.min.js.map +2 -2
  5. package/dist/draco-loader.js +21 -27
  6. package/dist/draco-loader.js.map +1 -0
  7. package/dist/draco-worker.js +1 -1
  8. package/dist/draco-worker.js.map +2 -2
  9. package/dist/draco-writer.js +27 -39
  10. package/dist/draco-writer.js.map +1 -0
  11. package/dist/draco3d/draco3d-types.js +44 -47
  12. package/dist/draco3d/draco3d-types.js.map +1 -0
  13. package/dist/index.js +21 -28
  14. package/dist/index.js.map +1 -0
  15. package/dist/lib/draco-builder.js +329 -313
  16. package/dist/lib/draco-builder.js.map +1 -0
  17. package/dist/lib/draco-module-loader.js +72 -78
  18. package/dist/lib/draco-module-loader.js.map +1 -0
  19. package/dist/lib/draco-parser.js +416 -440
  20. package/dist/lib/draco-parser.js.map +1 -0
  21. package/dist/lib/draco-types.js +2 -3
  22. package/dist/{es5/lib → lib}/draco-types.js.map +0 -0
  23. package/dist/lib/utils/get-draco-schema.js +41 -35
  24. package/dist/lib/utils/get-draco-schema.js.map +1 -0
  25. package/dist/lib/utils/version.js +2 -7
  26. package/dist/lib/utils/version.js.map +1 -0
  27. package/dist/workers/draco-worker.js +4 -5
  28. package/dist/workers/draco-worker.js.map +1 -0
  29. package/package.json +8 -8
  30. package/dist/es5/bundle.js +0 -7
  31. package/dist/es5/bundle.js.map +0 -1
  32. package/dist/es5/draco-loader.js +0 -38
  33. package/dist/es5/draco-loader.js.map +0 -1
  34. package/dist/es5/draco-writer.js +0 -78
  35. package/dist/es5/draco-writer.js.map +0 -1
  36. package/dist/es5/draco3d/draco3d-types.js +0 -58
  37. package/dist/es5/draco3d/draco3d-types.js.map +0 -1
  38. package/dist/es5/index.js +0 -85
  39. package/dist/es5/index.js.map +0 -1
  40. package/dist/es5/lib/draco-builder.js +0 -409
  41. package/dist/es5/lib/draco-builder.js.map +0 -1
  42. package/dist/es5/lib/draco-module-loader.js +0 -229
  43. package/dist/es5/lib/draco-module-loader.js.map +0 -1
  44. package/dist/es5/lib/draco-parser.js +0 -528
  45. package/dist/es5/lib/draco-parser.js.map +0 -1
  46. package/dist/es5/lib/draco-types.js +0 -2
  47. package/dist/es5/lib/utils/get-draco-schema.js +0 -55
  48. package/dist/es5/lib/utils/get-draco-schema.js.map +0 -1
  49. package/dist/es5/lib/utils/version.js +0 -9
  50. package/dist/es5/lib/utils/version.js.map +0 -1
  51. package/dist/es5/workers/draco-worker.js +0 -8
  52. package/dist/es5/workers/draco-worker.js.map +0 -1
  53. package/dist/esm/bundle.js +0 -5
  54. package/dist/esm/bundle.js.map +0 -1
  55. package/dist/esm/draco-loader.js +0 -24
  56. package/dist/esm/draco-loader.js.map +0 -1
  57. package/dist/esm/draco-writer.js +0 -32
  58. package/dist/esm/draco-writer.js.map +0 -1
  59. package/dist/esm/draco3d/draco3d-types.js +0 -48
  60. package/dist/esm/draco3d/draco3d-types.js.map +0 -1
  61. package/dist/esm/index.js +0 -24
  62. package/dist/esm/index.js.map +0 -1
  63. package/dist/esm/lib/draco-builder.js +0 -354
  64. package/dist/esm/lib/draco-builder.js.map +0 -1
  65. package/dist/esm/lib/draco-module-loader.js +0 -85
  66. package/dist/esm/lib/draco-module-loader.js.map +0 -1
  67. package/dist/esm/lib/draco-parser.js +0 -452
  68. package/dist/esm/lib/draco-parser.js.map +0 -1
  69. package/dist/esm/lib/draco-types.js +0 -2
  70. package/dist/esm/lib/draco-types.js.map +0 -1
  71. package/dist/esm/lib/utils/get-draco-schema.js +0 -48
  72. package/dist/esm/lib/utils/get-draco-schema.js.map +0 -1
  73. package/dist/esm/lib/utils/version.js +0 -2
  74. package/dist/esm/lib/utils/version.js.map +0 -1
  75. package/dist/esm/workers/draco-worker.js +0 -4
  76. package/dist/esm/workers/draco-worker.js.map +0 -1
package/dist/bundle.js CHANGED
@@ -1,5 +1,5 @@
1
- "use strict";
2
- // @ts-nocheck
3
1
  const moduleExports = require('./index');
2
+
4
3
  globalThis.loaders = globalThis.loaders || {};
5
4
  module.exports = Object.assign(globalThis.loaders, moduleExports);
5
+ //# sourceMappingURL=bundle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/bundle.ts"],"names":["moduleExports","require","globalThis","loaders","module","exports","Object","assign"],"mappings":"AACA,MAAMA,aAAa,GAAGC,OAAO,CAAC,SAAD,CAA7B;;AACAC,UAAU,CAACC,OAAX,GAAqBD,UAAU,CAACC,OAAX,IAAsB,EAA3C;AACAC,MAAM,CAACC,OAAP,GAAiBC,MAAM,CAACC,MAAP,CAAcL,UAAU,CAACC,OAAzB,EAAkCH,aAAlC,CAAjB","sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.loaders = globalThis.loaders || {};\nmodule.exports = Object.assign(globalThis.loaders, moduleExports);\n"],"file":"bundle.js"}
package/dist/dist.min.js CHANGED
@@ -1,4 +1,4 @@
1
- (()=>{var Xt=Object.create;var R=Object.defineProperty;var Jt=Object.getOwnPropertyDescriptor;var Zt=Object.getOwnPropertyNames;var Kt=Object.getPrototypeOf,te=Object.prototype.hasOwnProperty;var it=r=>R(r,"__esModule",{value:!0});var l=(r,t)=>()=>(r&&(t=r(r=0)),t);var st=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),ee=(r,t)=>{it(r);for(var e in t)R(r,e,{get:t[e],enumerable:!0})},re=(r,t,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Zt(t))!te.call(r,o)&&o!=="default"&&R(r,o,{get:()=>t[o],enumerable:!(e=Jt(t,o))||e.enumerable});return r},oe=r=>re(it(R(r!=null?Xt(Kt(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var C,G=l(()=>{C=typeof __VERSION__!="undefined"?__VERSION__:"latest"});var ae,q,ct=l(()=>{G();ae={draco:{decoderType:typeof WebAssembly=="object"?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}},q={name:"Draco",id:"draco",module:"draco",shapes:["mesh"],version:C,worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:ae}});function V(r){let t=1/0,e=1/0,o=1/0,a=-1/0,i=-1/0,s=-1/0,c=r.POSITION?r.POSITION.value:[],u=c&&c.length;for(let m=0;m<u;m+=3){let h=c[m],A=c[m+1],D=c[m+2];t=h<t?h:t,e=A<e?A:e,o=D<o?D:o,a=h>a?h:a,i=A>i?A:i,s=D>s?D:s}return[[t,e,o],[a,i,s]]}var dt=l(()=>{});function ut(r,t){if(!r)throw new Error(t||"loader assertion failed.")}var lt=l(()=>{});function ne(r){let t={};for(let e of r)t[e.name]&&console.warn("Schema: duplicated field name",e.name,e),t[e.name]=!0}function mt(r,t){return new Map([...r||new Map,...t||new Map])}var y,pt=l(()=>{lt();y=class{constructor(t,e){ut(Array.isArray(t)),ne(t),this.fields=t,this.metadata=e||new Map}compareTo(t){if(this.metadata!==t.metadata||this.fields.length!==t.fields.length)return!1;for(let e=0;e<this.fields.length;++e)if(!this.fields[e].compareTo(t.fields[e]))return!1;return!0}select(...t){let e=Object.create(null);for(let a of t)e[a]=!0;let o=this.fields.filter(a=>e[a.name]);return new y(o,this.metadata)}selectAt(...t){let e=t.map(o=>this.fields[o]).filter(Boolean);return new y(e,this.metadata)}assign(t){let e,o=this.metadata;if(t instanceof y){let s=t;e=s.fields,o=mt(mt(new Map,this.metadata),s.metadata)}else e=t;let a=Object.create(null);for(let s of this.fields)a[s.name]=s;for(let s of e)a[s.name]=s;let i=Object.values(a);return new y(i,o)}}});var b,yt=l(()=>{b=class{constructor(t,e,o=!1,a=new Map){this.name=t,this.type=e,this.nullable=o,this.metadata=a}get typeId(){return this.type&&this.type.typeId}clone(){return new b(this.name,this.type,this.nullable,this.metadata)}compareTo(t){return this.name===t.name&&this.type===t.type&&this.nullable===t.nullable&&this.metadata===t.metadata}toString(){return`${this.type}${this.nullable?", nullable":""}${this.metadata?`, metadata: ${this.metadata}`:""}`}}});var d,ht=l(()=>{(function(n){n[n.NONE=0]="NONE",n[n.Null=1]="Null",n[n.Int=2]="Int",n[n.Float=3]="Float",n[n.Binary=4]="Binary",n[n.Utf8=5]="Utf8",n[n.Bool=6]="Bool",n[n.Decimal=7]="Decimal",n[n.Date=8]="Date",n[n.Time=9]="Time",n[n.Timestamp=10]="Timestamp",n[n.Interval=11]="Interval",n[n.List=12]="List",n[n.Struct=13]="Struct",n[n.Union=14]="Union",n[n.FixedSizeBinary=15]="FixedSizeBinary",n[n.FixedSizeList=16]="FixedSizeList",n[n.Map=17]="Map",n[n.Dictionary=-1]="Dictionary",n[n.Int8=-2]="Int8",n[n.Int16=-3]="Int16",n[n.Int32=-4]="Int32",n[n.Int64=-5]="Int64",n[n.Uint8=-6]="Uint8",n[n.Uint16=-7]="Uint16",n[n.Uint32=-8]="Uint32",n[n.Uint64=-9]="Uint64",n[n.Float16=-10]="Float16",n[n.Float32=-11]="Float32",n[n.Float64=-12]="Float64",n[n.DateDay=-13]="DateDay",n[n.DateMillisecond=-14]="DateMillisecond",n[n.TimestampSecond=-15]="TimestampSecond",n[n.TimestampMillisecond=-16]="TimestampMillisecond",n[n.TimestampMicrosecond=-17]="TimestampMicrosecond",n[n.TimestampNanosecond=-18]="TimestampNanosecond",n[n.TimeSecond=-19]="TimeSecond",n[n.TimeMillisecond=-20]="TimeMillisecond",n[n.TimeMicrosecond=-21]="TimeMicrosecond",n[n.TimeNanosecond=-22]="TimeNanosecond",n[n.DenseUnion=-23]="DenseUnion",n[n.SparseUnion=-24]="SparseUnion",n[n.IntervalDayTime=-25]="IntervalDayTime",n[n.IntervalYearMonth=-26]="IntervalYearMonth"})(d||(d={}))});var p,Q,Y,g,_,I,w,O,T,x,ft,S,E,F,H,X,ie,J,bt,Z,K,se,tt,N,et,gt=l(()=>{ht();p=class{static isNull(t){return t&&t.typeId===d.Null}static isInt(t){return t&&t.typeId===d.Int}static isFloat(t){return t&&t.typeId===d.Float}static isBinary(t){return t&&t.typeId===d.Binary}static isUtf8(t){return t&&t.typeId===d.Utf8}static isBool(t){return t&&t.typeId===d.Bool}static isDecimal(t){return t&&t.typeId===d.Decimal}static isDate(t){return t&&t.typeId===d.Date}static isTime(t){return t&&t.typeId===d.Time}static isTimestamp(t){return t&&t.typeId===d.Timestamp}static isInterval(t){return t&&t.typeId===d.Interval}static isList(t){return t&&t.typeId===d.List}static isStruct(t){return t&&t.typeId===d.Struct}static isUnion(t){return t&&t.typeId===d.Union}static isFixedSizeBinary(t){return t&&t.typeId===d.FixedSizeBinary}static isFixedSizeList(t){return t&&t.typeId===d.FixedSizeList}static isMap(t){return t&&t.typeId===d.Map}static isDictionary(t){return t&&t.typeId===d.Dictionary}get typeId(){return d.NONE}compareTo(t){return this===t}},Q=class extends p{get typeId(){return d.Null}get[Symbol.toStringTag](){return"Null"}toString(){return"Null"}},Y=class extends p{get typeId(){return d.Bool}get[Symbol.toStringTag](){return"Bool"}toString(){return"Bool"}},g=class extends p{constructor(t,e){super();this.isSigned=t,this.bitWidth=e}get typeId(){return d.Int}get[Symbol.toStringTag](){return"Int"}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}},_=class extends g{constructor(){super(!0,8)}},I=class extends g{constructor(){super(!0,16)}},w=class extends g{constructor(){super(!0,32)}},O=class extends g{constructor(){super(!1,8)}},T=class extends g{constructor(){super(!1,16)}},x=class extends g{constructor(){super(!1,32)}},ft={HALF:16,SINGLE:32,DOUBLE:64},S=class extends p{constructor(t){super();this.precision=t}get typeId(){return d.Float}get[Symbol.toStringTag](){return"Float"}toString(){return`Float${this.precision}`}},E=class extends S{constructor(){super(ft.SINGLE)}},F=class extends S{constructor(){super(ft.DOUBLE)}},H=class extends p{constructor(){super()}get typeId(){return d.Binary}toString(){return"Binary"}get[Symbol.toStringTag](){return"Binary"}},X=class extends p{get typeId(){return d.Utf8}get[Symbol.toStringTag](){return"Utf8"}toString(){return"Utf8"}},ie={DAY:0,MILLISECOND:1},J=class extends p{constructor(t){super();this.unit=t}get typeId(){return d.Date}get[Symbol.toStringTag](){return"Date"}toString(){return`Date${(this.unit+1)*32}<${ie[this.unit]}>`}},bt={SECOND:1,MILLISECOND:1e3,MICROSECOND:1e6,NANOSECOND:1e9},Z=class extends p{constructor(t,e){super();this.unit=t,this.bitWidth=e}get typeId(){return d.Time}toString(){return`Time${this.bitWidth}<${bt[this.unit]}>`}get[Symbol.toStringTag](){return"Time"}},K=class extends p{constructor(t,e=null){super();this.unit=t,this.timezone=e}get typeId(){return d.Timestamp}get[Symbol.toStringTag](){return"Timestamp"}toString(){return`Timestamp<${bt[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}},se={DAY_TIME:0,YEAR_MONTH:1},tt=class extends p{constructor(t){super();this.unit=t}get typeId(){return d.Interval}get[Symbol.toStringTag](){return"Interval"}toString(){return`Interval<${se[this.unit]}>`}},N=class extends p{constructor(t,e){super();this.listSize=t,this.children=[e]}get typeId(){return d.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get[Symbol.toStringTag](){return"FixedSizeList"}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}},et=class extends p{constructor(t){super();this.children=t}get typeId(){return d.Struct}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}get[Symbol.toStringTag](){return"Struct"}}});var k=l(()=>{pt();yt();gt()});function At(r){switch(r.constructor){case Int8Array:return new _;case Uint8Array:return new O;case Int16Array:return new I;case Uint16Array:return new T;case Int32Array:return new w;case Uint32Array:return new x;case Float32Array:return new E;case Float64Array:return new F;default:throw new Error("array type not supported")}}var Dt=l(()=>{k()});function rt(r,t,e){let o=At(t.value),a=e||Mt(t);return new b(r,new N(t.size,new b("value",o)),!1,a)}function Mt(r){let t=new Map;return"byteOffset"in r&&t.set("byteOffset",r.byteOffset.toString(10)),"byteStride"in r&&t.set("byteStride",r.byteStride.toString(10)),"normalized"in r&&t.set("normalized",r.normalized.toString()),t}var _t=l(()=>{k();Dt()});var U=l(()=>{dt();_t();k()});function It(r,t,e){let o=Ot(t.metadata),a=[],i=Me(t.attributes);for(let s in r){let c=r[s],u=wt(s,c,i[s]);a.push(u)}if(e){let s=wt("indices",e);a.push(s)}return new y(a,o)}function Me(r){let t={};for(let e in r){let o=r[e];t[o.name||"undefined"]=o}return t}function wt(r,t,e){let o=e?Ot(e.metadata):void 0;return rt(r,t,o)}function Ot(r){let t=new Map;for(let e in r)t.set(`${e}.string`,JSON.stringify(r[e]));return t}var Tt=l(()=>{U();U()});function we(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 Oe(r){let t=r.size(),e=new Int32Array(t);for(let o=0;o<t;o++)e[o]=r.GetValue(o);return e}function Te(r){let t=r.size(),e=new Int32Array(t);for(let o=0;o<t;o++)e[o]=r.GetValue(o);return e}var xt,_e,Ie,v,St=l(()=>{U();Tt();xt={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},_e={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},Ie=4,v=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),i=a===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let s;switch(a){case this.draco.TRIANGULAR_MESH:s=this.decoder.DecodeBufferToMesh(o,i);break;case this.draco.POINT_CLOUD:s=this.decoder.DecodeBufferToPointCloud(o,i);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!s.ok()||!i.ptr){let D=`DRACO decompression failed: ${s.error_msg()}`;throw new Error(D)}let c=this._getDracoLoaderData(i,a,e),u=this._getMeshData(i,c,e),m=V(u.attributes),h=It(u.attributes,c,u.indices);return{loader:"draco",loaderData:c,header:{vertexCount:i.num_points(),boundingBox:m},...u,schema:h}}finally{this.draco.destroy(o),i&&this.draco.destroy(i)}}_getDracoLoaderData(t,e,o){let a=this._getTopLevelMetadata(t),i=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:i}}_getDracoAttributes(t,e){let o={};for(let a=0;a<t.num_attributes();a++){let i=this.decoder.GetAttribute(t,a),s=this._getAttributeMetadata(t,a);o[i.unique_id()]={unique_id:i.unique_id(),attribute_type:i.attribute_type(),data_type:i.data_type(),num_components:i.num_components(),byte_offset:i.byte_offset(),byte_stride:i.byte_stride(),normalized:i.normalized(),attribute_index:a,metadata:s};let c=this._getQuantizationTransform(i,e);c&&(o[i.unique_id()].quantization_transform=c);let u=this._getOctahedronTransform(i,e);u&&(o[i.unique_id()].octahedron_transform=u)}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 i of Object.values(t.attributes)){let s=this._deduceAttributeName(i,o);i.name=s;let{value:c,size:u}=this._getAttributeValues(e,i);a[s]={value:c,size:u,byteOffset:i.byte_offset,byteStride:i.byte_stride,normalized:i.normalized}}return a}_getTriangleListIndices(t){let o=t.num_faces()*3,a=o*Ie,i=this.draco._malloc(a);try{return this.decoder.GetTrianglesUInt32Array(t,a,i),new Uint32Array(this.draco.HEAPF32.buffer,i,o).slice()}finally{this.draco._free(i)}}_getTriangleStripIndices(t){let e=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(t,e),Te(e)}finally{this.draco.destroy(e)}}_getAttributeValues(t,e){let o=_e[e.data_type],a=e.num_components,s=t.num_points()*a,c=s*o.BYTES_PER_ELEMENT,u=we(this.draco,o),m,h=this.draco._malloc(c);try{let A=this.decoder.GetAttribute(t,e.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(t,A,u,c,h),m=new o(this.draco.HEAPF32.buffer,h,s).slice()}finally{this.draco._free(h)}return{value:m,size:a}}_deduceAttributeName(t,e){let o=t.unique_id;for(let[s,c]of Object.entries(e.extraAttributes||{}))if(c===o)return s;let a=t.attribute_type;for(let s in xt)if(this.draco[s]===a)return xt[s];let i=e.attributeNameEntry||"name";return t.metadata[i]?t.metadata[i].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 i=this.metadataQuerier.GetEntryName(t,a);e[i]=this._getDracoMetadataField(t,i)}return e}_getDracoMetadataField(t,e){let o=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(t,e,o);let a=Oe(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 i of a)this.decoder.SkipAttributeTransform(this.draco[i])}_getQuantizationTransform(t,e){let{quantizedAttributes:o=[]}=e,a=t.attribute_type();if(o.map(s=>this.decoder[s]).includes(a)){let s=new this.draco.AttributeQuantizationTransform;try{if(s.InitFromAttribute(t))return{quantization_bits:s.quantization_bits(),range:s.range(),min_values:new Float32Array([1,2,3]).map(c=>s.min_value(c))}}finally{this.draco.destroy(s)}}return null}_getOctahedronTransform(t,e){let{octahedronAttributes:o=[]}=e,a=t.attribute_type();if(o.map(s=>this.decoder[s]).includes(a)){let s=new this.draco.AttributeQuantizationTransform;try{if(s.InitFromAttribute(t))return{quantization_bits:s.quantization_bits()}}finally{this.draco.destroy(s)}}return null}}});var xe,ot,Et=l(()=>{xe="latest",ot=typeof __VERSION__!="undefined"?__VERSION__:xe;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 Ft(r,t){if(!r)throw new Error(t||"loaders.gl assertion failed.")}var Nt=l(()=>{});var f,Nr,Lr,Lt,Br,z,$,Pr,Bt,Rr,Pt=l(()=>{f={self:typeof self!="undefined"&&self,window:typeof window!="undefined"&&window,global:typeof global!="undefined"&&global,document:typeof document!="undefined"&&document},Nr=f.self||f.window||f.global||{},Lr=f.window||f.self||f.global||{},Lt=f.global||f.self||f.window||{},Br=f.document||{},z=typeof process!="object"||String(process)!=="[object process]"||process.browser,$=typeof importScripts=="function",Pr=typeof window!="undefined"&&typeof window.orientation!="undefined",Bt=typeof process!="undefined"&&process.version&&/v([0-9]*)/.exec(process.version),Rr=Bt&&parseFloat(Bt[1])||0});var Rt=st(()=>{});async function M(r,t=null,e={}){return t&&(r=Ct(r,t,e)),at[r]=at[r]||Fe(r),await at[r]}function Ct(r,t,e){if(r.startsWith("http"))return r;let o=e.modules||{};return o[r]?o[r]:z?e.CDN?(Ft(e.CDN.startsWith("http")),`${e.CDN}/${t}@${Ee}/dist/libs/${r}`):$?`../src/libs/${r}`:`modules/${t}/src/libs/${r}`:`modules/${t}/dist/libs/${r}`}async function Fe(r){if(r.endsWith("wasm"))return await(await fetch(r)).arrayBuffer();if(!z)try{return L&&L.requireFromFile&&await L.requireFromFile(r)}catch{return null}if($)return importScripts(r);let e=await(await fetch(r)).text();return Ne(e,r)}function Ne(r,t){if(!z)return L.requireFromString&&L.requireFromString(r,t);if($)return eval.call(Lt,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}var L,Se,Ee,at,kt=l(()=>{Pt();L=oe(Rt());Nt();Et();Se="latest",Ee=typeof ot!="undefined"?ot:Se,at={}});var Ut=l(()=>{kt()});async function vt(r){let t=r.modules||{};return t.draco3d?B=B||t.draco3d.createDecoderModule({}).then(e=>({draco:e})):B=B||Ce(r),await B}async function zt(r){let t=r.modules||{};return t.draco3d?P=P||t.draco3d.createEncoderModule({}).then(e=>({draco:e})):P=P||Ue(r),await P}async function Ce(r){let t,e;switch(r.draco&&r.draco.decoderType){case"js":t=await M(Le,"draco",r);break;case"wasm":default:[t,e]=await Promise.all([await M(Be,"draco",r),await M(Pe,"draco",r)])}return t=t||globalThis.DracoDecoderModule,await ke(t,e)}function ke(r,t){let e={};return t&&(e.wasmBinary=t),new Promise(o=>{r({...e,onModuleLoaded:a=>o({draco:a})})})}async function Ue(r){let t=await M(Re,"draco",r);return t=t||globalThis.DracoEncoderModule,new Promise(e=>{t({onModuleLoaded:o=>e({draco:o})})})}var W,Le,Be,Pe,Re,B,P,nt=l(()=>{Ut();W="1.4.1",Le=`https://www.gstatic.com/draco/versioned/decoders/${W}/draco_decoder.js`,Be=`https://www.gstatic.com/draco/versioned/decoders/${W}/draco_wasm_wrapper.js`,Pe=`https://www.gstatic.com/draco/versioned/decoders/${W}/draco_decoder.wasm`,Re=`https://raw.githubusercontent.com/google/draco/${W}/javascript/draco_encoder.js`});function Wt(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 ze(r){return r.entries&&!r.hasOwnProperty("entries")?r.entries():Object.entries(r)}var $t,ve,j,jt=l(()=>{$t={POSITION:"POSITION",NORMAL:"NORMAL",COLOR_0:"COLOR",TEXCOORD_0:"TEX_COORD"},ve=()=>{},j=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=ve,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 i=new this.draco.DracoInt8Array;try{let s=this.dracoEncoder.EncodePointCloudToDracoBuffer(o,!1,i);if(!(s>0))throw new Error("Draco encoding failed.");return this.log(`DRACO encoded ${o.num_points()} points
1
+ (()=>{var Xt=Object.create;var R=Object.defineProperty;var Jt=Object.getOwnPropertyDescriptor;var Zt=Object.getOwnPropertyNames;var Kt=Object.getPrototypeOf,te=Object.prototype.hasOwnProperty;var it=r=>R(r,"__esModule",{value:!0});var l=(r,t)=>()=>(r&&(t=r(r=0)),t);var st=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),ee=(r,t)=>{it(r);for(var e in t)R(r,e,{get:t[e],enumerable:!0})},re=(r,t,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Zt(t))!te.call(r,o)&&o!=="default"&&R(r,o,{get:()=>t[o],enumerable:!(e=Jt(t,o))||e.enumerable});return r},oe=r=>re(it(R(r!=null?Xt(Kt(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var C,j=l(()=>{C=typeof __VERSION__!="undefined"?__VERSION__:"latest"});var ae,q,ct=l(()=>{j();ae={draco:{decoderType:typeof WebAssembly=="object"?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}},q={name:"Draco",id:"draco",module:"draco",shapes:["mesh"],version:C,worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:ae}});function V(r){let t=1/0,e=1/0,o=1/0,a=-1/0,i=-1/0,s=-1/0,c=r.POSITION?r.POSITION.value:[],u=c&&c.length;for(let m=0;m<u;m+=3){let h=c[m],A=c[m+1],D=c[m+2];t=h<t?h:t,e=A<e?A:e,o=D<o?D:o,a=h>a?h:a,i=A>i?A:i,s=D>s?D:s}return[[t,e,o],[a,i,s]]}var dt=l(()=>{});function ut(r,t){if(!r)throw new Error(t||"loader assertion failed.")}var lt=l(()=>{});function ne(r){let t={};for(let e of r)t[e.name]&&console.warn("Schema: duplicated field name",e.name,e),t[e.name]=!0}function mt(r,t){return new Map([...r||new Map,...t||new Map])}var y,pt=l(()=>{lt();y=class{constructor(t,e){ut(Array.isArray(t)),ne(t),this.fields=t,this.metadata=e||new Map}compareTo(t){if(this.metadata!==t.metadata||this.fields.length!==t.fields.length)return!1;for(let e=0;e<this.fields.length;++e)if(!this.fields[e].compareTo(t.fields[e]))return!1;return!0}select(...t){let e=Object.create(null);for(let a of t)e[a]=!0;let o=this.fields.filter(a=>e[a.name]);return new y(o,this.metadata)}selectAt(...t){let e=t.map(o=>this.fields[o]).filter(Boolean);return new y(e,this.metadata)}assign(t){let e,o=this.metadata;if(t instanceof y){let s=t;e=s.fields,o=mt(mt(new Map,this.metadata),s.metadata)}else e=t;let a=Object.create(null);for(let s of this.fields)a[s.name]=s;for(let s of e)a[s.name]=s;let i=Object.values(a);return new y(i,o)}}});var b,yt=l(()=>{b=class{constructor(t,e,o=!1,a=new Map){this.name=t,this.type=e,this.nullable=o,this.metadata=a}get typeId(){return this.type&&this.type.typeId}clone(){return new b(this.name,this.type,this.nullable,this.metadata)}compareTo(t){return this.name===t.name&&this.type===t.type&&this.nullable===t.nullable&&this.metadata===t.metadata}toString(){return`${this.type}${this.nullable?", nullable":""}${this.metadata?`, metadata: ${this.metadata}`:""}`}}});var d,ht=l(()=>{(function(n){n[n.NONE=0]="NONE",n[n.Null=1]="Null",n[n.Int=2]="Int",n[n.Float=3]="Float",n[n.Binary=4]="Binary",n[n.Utf8=5]="Utf8",n[n.Bool=6]="Bool",n[n.Decimal=7]="Decimal",n[n.Date=8]="Date",n[n.Time=9]="Time",n[n.Timestamp=10]="Timestamp",n[n.Interval=11]="Interval",n[n.List=12]="List",n[n.Struct=13]="Struct",n[n.Union=14]="Union",n[n.FixedSizeBinary=15]="FixedSizeBinary",n[n.FixedSizeList=16]="FixedSizeList",n[n.Map=17]="Map",n[n.Dictionary=-1]="Dictionary",n[n.Int8=-2]="Int8",n[n.Int16=-3]="Int16",n[n.Int32=-4]="Int32",n[n.Int64=-5]="Int64",n[n.Uint8=-6]="Uint8",n[n.Uint16=-7]="Uint16",n[n.Uint32=-8]="Uint32",n[n.Uint64=-9]="Uint64",n[n.Float16=-10]="Float16",n[n.Float32=-11]="Float32",n[n.Float64=-12]="Float64",n[n.DateDay=-13]="DateDay",n[n.DateMillisecond=-14]="DateMillisecond",n[n.TimestampSecond=-15]="TimestampSecond",n[n.TimestampMillisecond=-16]="TimestampMillisecond",n[n.TimestampMicrosecond=-17]="TimestampMicrosecond",n[n.TimestampNanosecond=-18]="TimestampNanosecond",n[n.TimeSecond=-19]="TimeSecond",n[n.TimeMillisecond=-20]="TimeMillisecond",n[n.TimeMicrosecond=-21]="TimeMicrosecond",n[n.TimeNanosecond=-22]="TimeNanosecond",n[n.DenseUnion=-23]="DenseUnion",n[n.SparseUnion=-24]="SparseUnion",n[n.IntervalDayTime=-25]="IntervalDayTime",n[n.IntervalYearMonth=-26]="IntervalYearMonth"})(d||(d={}))});var p,Q,Y,g,_,I,w,O,T,x,ft,S,E,F,H,X,ie,J,bt,Z,K,se,tt,N,et,gt=l(()=>{ht();p=class{static isNull(t){return t&&t.typeId===d.Null}static isInt(t){return t&&t.typeId===d.Int}static isFloat(t){return t&&t.typeId===d.Float}static isBinary(t){return t&&t.typeId===d.Binary}static isUtf8(t){return t&&t.typeId===d.Utf8}static isBool(t){return t&&t.typeId===d.Bool}static isDecimal(t){return t&&t.typeId===d.Decimal}static isDate(t){return t&&t.typeId===d.Date}static isTime(t){return t&&t.typeId===d.Time}static isTimestamp(t){return t&&t.typeId===d.Timestamp}static isInterval(t){return t&&t.typeId===d.Interval}static isList(t){return t&&t.typeId===d.List}static isStruct(t){return t&&t.typeId===d.Struct}static isUnion(t){return t&&t.typeId===d.Union}static isFixedSizeBinary(t){return t&&t.typeId===d.FixedSizeBinary}static isFixedSizeList(t){return t&&t.typeId===d.FixedSizeList}static isMap(t){return t&&t.typeId===d.Map}static isDictionary(t){return t&&t.typeId===d.Dictionary}get typeId(){return d.NONE}compareTo(t){return this===t}},Q=class extends p{get typeId(){return d.Null}get[Symbol.toStringTag](){return"Null"}toString(){return"Null"}},Y=class extends p{get typeId(){return d.Bool}get[Symbol.toStringTag](){return"Bool"}toString(){return"Bool"}},g=class extends p{constructor(t,e){super();this.isSigned=t,this.bitWidth=e}get typeId(){return d.Int}get[Symbol.toStringTag](){return"Int"}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}},_=class extends g{constructor(){super(!0,8)}},I=class extends g{constructor(){super(!0,16)}},w=class extends g{constructor(){super(!0,32)}},O=class extends g{constructor(){super(!1,8)}},T=class extends g{constructor(){super(!1,16)}},x=class extends g{constructor(){super(!1,32)}},ft={HALF:16,SINGLE:32,DOUBLE:64},S=class extends p{constructor(t){super();this.precision=t}get typeId(){return d.Float}get[Symbol.toStringTag](){return"Float"}toString(){return`Float${this.precision}`}},E=class extends S{constructor(){super(ft.SINGLE)}},F=class extends S{constructor(){super(ft.DOUBLE)}},H=class extends p{constructor(){super()}get typeId(){return d.Binary}toString(){return"Binary"}get[Symbol.toStringTag](){return"Binary"}},X=class extends p{get typeId(){return d.Utf8}get[Symbol.toStringTag](){return"Utf8"}toString(){return"Utf8"}},ie={DAY:0,MILLISECOND:1},J=class extends p{constructor(t){super();this.unit=t}get typeId(){return d.Date}get[Symbol.toStringTag](){return"Date"}toString(){return`Date${(this.unit+1)*32}<${ie[this.unit]}>`}},bt={SECOND:1,MILLISECOND:1e3,MICROSECOND:1e6,NANOSECOND:1e9},Z=class extends p{constructor(t,e){super();this.unit=t,this.bitWidth=e}get typeId(){return d.Time}toString(){return`Time${this.bitWidth}<${bt[this.unit]}>`}get[Symbol.toStringTag](){return"Time"}},K=class extends p{constructor(t,e=null){super();this.unit=t,this.timezone=e}get typeId(){return d.Timestamp}get[Symbol.toStringTag](){return"Timestamp"}toString(){return`Timestamp<${bt[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}},se={DAY_TIME:0,YEAR_MONTH:1},tt=class extends p{constructor(t){super();this.unit=t}get typeId(){return d.Interval}get[Symbol.toStringTag](){return"Interval"}toString(){return`Interval<${se[this.unit]}>`}},N=class extends p{constructor(t,e){super();this.listSize=t,this.children=[e]}get typeId(){return d.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get[Symbol.toStringTag](){return"FixedSizeList"}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}},et=class extends p{constructor(t){super();this.children=t}get typeId(){return d.Struct}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}get[Symbol.toStringTag](){return"Struct"}}});var k=l(()=>{pt();yt();gt()});function At(r){switch(r.constructor){case Int8Array:return new _;case Uint8Array:return new O;case Int16Array:return new I;case Uint16Array:return new T;case Int32Array:return new w;case Uint32Array:return new x;case Float32Array:return new E;case Float64Array:return new F;default:throw new Error("array type not supported")}}var Dt=l(()=>{k()});function rt(r,t,e){let o=At(t.value),a=e||Mt(t);return new b(r,new N(t.size,new b("value",o)),!1,a)}function Mt(r){let t=new Map;return"byteOffset"in r&&t.set("byteOffset",r.byteOffset.toString(10)),"byteStride"in r&&t.set("byteStride",r.byteStride.toString(10)),"normalized"in r&&t.set("normalized",r.normalized.toString()),t}var _t=l(()=>{k();Dt()});var U=l(()=>{dt();_t();k()});function It(r,t,e){let o=Ot(t.metadata),a=[],i=Me(t.attributes);for(let s in r){let c=r[s],u=wt(s,c,i[s]);a.push(u)}if(e){let s=wt("indices",e);a.push(s)}return new y(a,o)}function Me(r){let t={};for(let e in r){let o=r[e];t[o.name||"undefined"]=o}return t}function wt(r,t,e){let o=e?Ot(e.metadata):void 0;return rt(r,t,o)}function Ot(r){let t=new Map;for(let e in r)t.set(`${e}.string`,JSON.stringify(r[e]));return t}var Tt=l(()=>{U();U()});function we(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 Oe(r){let t=r.size(),e=new Int32Array(t);for(let o=0;o<t;o++)e[o]=r.GetValue(o);return e}function Te(r){let t=r.size(),e=new Int32Array(t);for(let o=0;o<t;o++)e[o]=r.GetValue(o);return e}var xt,_e,Ie,v,St=l(()=>{U();Tt();xt={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},_e={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},Ie=4,v=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),i=a===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let s;switch(a){case this.draco.TRIANGULAR_MESH:s=this.decoder.DecodeBufferToMesh(o,i);break;case this.draco.POINT_CLOUD:s=this.decoder.DecodeBufferToPointCloud(o,i);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!s.ok()||!i.ptr){let D=`DRACO decompression failed: ${s.error_msg()}`;throw new Error(D)}let c=this._getDracoLoaderData(i,a,e),u=this._getMeshData(i,c,e),m=V(u.attributes),h=It(u.attributes,c,u.indices);return{loader:"draco",loaderData:c,header:{vertexCount:i.num_points(),boundingBox:m},...u,schema:h}}finally{this.draco.destroy(o),i&&this.draco.destroy(i)}}_getDracoLoaderData(t,e,o){let a=this._getTopLevelMetadata(t),i=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:i}}_getDracoAttributes(t,e){let o={};for(let a=0;a<t.num_attributes();a++){let i=this.decoder.GetAttribute(t,a),s=this._getAttributeMetadata(t,a);o[i.unique_id()]={unique_id:i.unique_id(),attribute_type:i.attribute_type(),data_type:i.data_type(),num_components:i.num_components(),byte_offset:i.byte_offset(),byte_stride:i.byte_stride(),normalized:i.normalized(),attribute_index:a,metadata:s};let c=this._getQuantizationTransform(i,e);c&&(o[i.unique_id()].quantization_transform=c);let u=this._getOctahedronTransform(i,e);u&&(o[i.unique_id()].octahedron_transform=u)}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 i of Object.values(t.attributes)){let s=this._deduceAttributeName(i,o);i.name=s;let{value:c,size:u}=this._getAttributeValues(e,i);a[s]={value:c,size:u,byteOffset:i.byte_offset,byteStride:i.byte_stride,normalized:i.normalized}}return a}_getTriangleListIndices(t){let o=t.num_faces()*3,a=o*Ie,i=this.draco._malloc(a);try{return this.decoder.GetTrianglesUInt32Array(t,a,i),new Uint32Array(this.draco.HEAPF32.buffer,i,o).slice()}finally{this.draco._free(i)}}_getTriangleStripIndices(t){let e=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(t,e),Te(e)}finally{this.draco.destroy(e)}}_getAttributeValues(t,e){let o=_e[e.data_type],a=e.num_components,s=t.num_points()*a,c=s*o.BYTES_PER_ELEMENT,u=we(this.draco,o),m,h=this.draco._malloc(c);try{let A=this.decoder.GetAttribute(t,e.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(t,A,u,c,h),m=new o(this.draco.HEAPF32.buffer,h,s).slice()}finally{this.draco._free(h)}return{value:m,size:a}}_deduceAttributeName(t,e){let o=t.unique_id;for(let[s,c]of Object.entries(e.extraAttributes||{}))if(c===o)return s;let a=t.attribute_type;for(let s in xt)if(this.draco[s]===a)return xt[s];let i=e.attributeNameEntry||"name";return t.metadata[i]?t.metadata[i].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 i=this.metadataQuerier.GetEntryName(t,a);e[i]=this._getDracoMetadataField(t,i)}return e}_getDracoMetadataField(t,e){let o=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(t,e,o);let a=Oe(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 i of a)this.decoder.SkipAttributeTransform(this.draco[i])}_getQuantizationTransform(t,e){let{quantizedAttributes:o=[]}=e,a=t.attribute_type();if(o.map(s=>this.decoder[s]).includes(a)){let s=new this.draco.AttributeQuantizationTransform;try{if(s.InitFromAttribute(t))return{quantization_bits:s.quantization_bits(),range:s.range(),min_values:new Float32Array([1,2,3]).map(c=>s.min_value(c))}}finally{this.draco.destroy(s)}}return null}_getOctahedronTransform(t,e){let{octahedronAttributes:o=[]}=e,a=t.attribute_type();if(o.map(s=>this.decoder[s]).includes(a)){let s=new this.draco.AttributeQuantizationTransform;try{if(s.InitFromAttribute(t))return{quantization_bits:s.quantization_bits()}}finally{this.draco.destroy(s)}}return null}}});var xe,ot,Et=l(()=>{xe="beta",ot=typeof __VERSION__!="undefined"?__VERSION__:xe;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 Ft(r,t){if(!r)throw new Error(t||"loaders.gl assertion failed.")}var Nt=l(()=>{});var f,Nr,Lr,Lt,Br,z,$,Pr,Bt,Rr,Pt=l(()=>{f={self:typeof self!="undefined"&&self,window:typeof window!="undefined"&&window,global:typeof global!="undefined"&&global,document:typeof document!="undefined"&&document},Nr=f.self||f.window||f.global||{},Lr=f.window||f.self||f.global||{},Lt=f.global||f.self||f.window||{},Br=f.document||{},z=typeof process!="object"||String(process)!=="[object process]"||process.browser,$=typeof importScripts=="function",Pr=typeof window!="undefined"&&typeof window.orientation!="undefined",Bt=typeof process!="undefined"&&process.version&&/v([0-9]*)/.exec(process.version),Rr=Bt&&parseFloat(Bt[1])||0});var Rt=st(()=>{});async function M(r,t=null,e={}){return t&&(r=Ct(r,t,e)),at[r]=at[r]||Fe(r),await at[r]}function Ct(r,t,e){if(r.startsWith("http"))return r;let o=e.modules||{};return o[r]?o[r]:z?e.CDN?(Ft(e.CDN.startsWith("http")),`${e.CDN}/${t}@${Ee}/dist/libs/${r}`):$?`../src/libs/${r}`:`modules/${t}/src/libs/${r}`:`modules/${t}/dist/libs/${r}`}async function Fe(r){if(r.endsWith("wasm"))return await(await fetch(r)).arrayBuffer();if(!z)try{return L&&L.requireFromFile&&await L.requireFromFile(r)}catch{return null}if($)return importScripts(r);let e=await(await fetch(r)).text();return Ne(e,r)}function Ne(r,t){if(!z)return L.requireFromString&&L.requireFromString(r,t);if($)return eval.call(Lt,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}var L,Se,Ee,at,kt=l(()=>{Pt();L=oe(Rt());Nt();Et();Se="beta",Ee=typeof ot!="undefined"?ot:Se,at={}});var Ut=l(()=>{kt()});async function vt(r){let t=r.modules||{};return t.draco3d?B=B||t.draco3d.createDecoderModule({}).then(e=>({draco:e})):B=B||Ce(r),await B}async function zt(r){let t=r.modules||{};return t.draco3d?P=P||t.draco3d.createEncoderModule({}).then(e=>({draco:e})):P=P||Ue(r),await P}async function Ce(r){let t,e;switch(r.draco&&r.draco.decoderType){case"js":t=await M(Le,"draco",r);break;case"wasm":default:[t,e]=await Promise.all([await M(Be,"draco",r),await M(Pe,"draco",r)])}return t=t||globalThis.DracoDecoderModule,await ke(t,e)}function ke(r,t){let e={};return t&&(e.wasmBinary=t),new Promise(o=>{r({...e,onModuleLoaded:a=>o({draco:a})})})}async function Ue(r){let t=await M(Re,"draco",r);return t=t||globalThis.DracoEncoderModule,new Promise(e=>{t({onModuleLoaded:o=>e({draco:o})})})}var W,Le,Be,Pe,Re,B,P,nt=l(()=>{Ut();W="1.4.1",Le=`https://www.gstatic.com/draco/versioned/decoders/${W}/draco_decoder.js`,Be=`https://www.gstatic.com/draco/versioned/decoders/${W}/draco_wasm_wrapper.js`,Pe=`https://www.gstatic.com/draco/versioned/decoders/${W}/draco_decoder.wasm`,Re=`https://raw.githubusercontent.com/google/draco/${W}/javascript/draco_encoder.js`});function Wt(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 ze(r){return r.entries&&!r.hasOwnProperty("entries")?r.entries():Object.entries(r)}var $t,ve,G,Gt=l(()=>{$t={POSITION:"POSITION",NORMAL:"NORMAL",COLOR_0:"COLOR",TEXCOORD_0:"TEX_COORD"},ve=()=>{},G=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=ve,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 i=new this.draco.DracoInt8Array;try{let s=this.dracoEncoder.EncodePointCloudToDracoBuffer(o,!1,i);if(!(s>0))throw new Error("Draco encoding failed.");return this.log(`DRACO encoded ${o.num_points()} points
2
2
  with ${o.num_attributes()} attributes into ${s} bytes`),Wt(i)}finally{this.destroyEncodedObject(i),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 i=new this.draco.DracoInt8Array;try{let s=this.dracoEncoder.EncodeMeshToDracoBuffer(o,i);if(s<=0)throw new Error("Draco encoding failed.");return this.log(`DRACO encoded ${o.num_points()} points
3
- with ${o.num_attributes()} attributes into ${s} bytes`),Wt(i)}finally{this.destroyEncodedObject(i),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 i=this._getPositionAttribute(e);if(!i)throw new Error("positions");let s=i.length/3;for(let c in e){let u=e[c];c=$t[c]||c;let m=this._addAttributeToMesh(t,c,u,s);m!==-1&&this._addAttributeMetadata(t,m,{name:c,...a[c]||{}})}}catch(i){throw this.destroyEncodedObject(t),i}return t}_createDracoPointCloud(t,e,o){let a=o.attributesMetadata||{};try{let i=this._getPositionAttribute(e);if(!i)throw new Error("positions");let s=i.length/3;for(let c in e){let u=e[c];c=$t[c]||c;let m=this._addAttributeToMesh(t,c,u,s);m!==-1&&this._addAttributeMetadata(t,m,{name:c,...a[c]||{}})}}catch(i){throw this.destroyEncodedObject(t),i}return t}_addAttributeToMesh(t,e,o,a){if(!ArrayBuffer.isView(o))return-1;let i=this._getDracoAttributeType(e),s=o.length/a;if(i==="indices"){let m=o.length/3;return this.log(`Adding attribute ${e}, size ${m}`),this.dracoMeshBuilder.AddFacesToMesh(t,m,o),-1}this.log(`Adding attribute ${e}, size ${s}`);let c=this.dracoMeshBuilder,{buffer:u}=o;switch(o.constructor){case Int8Array:return c.AddInt8Attribute(t,i,a,s,new Int8Array(u));case Int16Array:return c.AddInt16Attribute(t,i,a,s,new Int16Array(u));case Int32Array:return c.AddInt32Attribute(t,i,a,s,new Int32Array(u));case Uint8Array:case Uint8ClampedArray:return c.AddUInt8Attribute(t,i,a,s,new Uint8Array(u));case Uint16Array:return c.AddUInt16Attribute(t,i,a,s,new Uint16Array(u));case Uint32Array:return c.AddUInt32Attribute(t,i,a,s,new Uint32Array(u));case Float32Array:default:return c.AddFloatAttribute(t,i,a,s,new Float32Array(u))}}_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 ze(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 We(r,t={}){let{draco:e}=await zt(t),o=new j(e);try{return o.encodeSync(r,t.draco)}finally{o.destroy()}}var $e,Gt,qt=l(()=>{jt();nt();G();$e={pointcloud:!1,attributeNameEntry:"name"},Gt={name:"DRACO",id:"draco",module:"draco",version:C,extensions:["drc"],encode:We,options:{draco:$e}}});var Qt={};ee(Qt,{DracoLoader:()=>Vt,DracoWorkerLoader:()=>q,DracoWriter:()=>Gt,_TypecheckDracoLoader:()=>Ge});async function je(r,t){let{draco:e}=await vt(t),o=new v(e);try{return o.parseSync(r,t?.draco)}finally{o.destroy()}}var Vt,Ge,Yt=l(()=>{ct();St();nt();qt();Vt={...q,parse:je};Ge=Vt});var Ve=st((ro,Ht)=>{var qe=(Yt(),Qt);globalThis.loaders=globalThis.loaders||{};Ht.exports=Object.assign(globalThis.loaders,qe)});Ve();})();
3
+ with ${o.num_attributes()} attributes into ${s} bytes`),Wt(i)}finally{this.destroyEncodedObject(i),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 i=this._getPositionAttribute(e);if(!i)throw new Error("positions");let s=i.length/3;for(let c in e){let u=e[c];c=$t[c]||c;let m=this._addAttributeToMesh(t,c,u,s);m!==-1&&this._addAttributeMetadata(t,m,{name:c,...a[c]||{}})}}catch(i){throw this.destroyEncodedObject(t),i}return t}_createDracoPointCloud(t,e,o){let a=o.attributesMetadata||{};try{let i=this._getPositionAttribute(e);if(!i)throw new Error("positions");let s=i.length/3;for(let c in e){let u=e[c];c=$t[c]||c;let m=this._addAttributeToMesh(t,c,u,s);m!==-1&&this._addAttributeMetadata(t,m,{name:c,...a[c]||{}})}}catch(i){throw this.destroyEncodedObject(t),i}return t}_addAttributeToMesh(t,e,o,a){if(!ArrayBuffer.isView(o))return-1;let i=this._getDracoAttributeType(e),s=o.length/a;if(i==="indices"){let m=o.length/3;return this.log(`Adding attribute ${e}, size ${m}`),this.dracoMeshBuilder.AddFacesToMesh(t,m,o),-1}this.log(`Adding attribute ${e}, size ${s}`);let c=this.dracoMeshBuilder,{buffer:u}=o;switch(o.constructor){case Int8Array:return c.AddInt8Attribute(t,i,a,s,new Int8Array(u));case Int16Array:return c.AddInt16Attribute(t,i,a,s,new Int16Array(u));case Int32Array:return c.AddInt32Attribute(t,i,a,s,new Int32Array(u));case Uint8Array:case Uint8ClampedArray:return c.AddUInt8Attribute(t,i,a,s,new Uint8Array(u));case Uint16Array:return c.AddUInt16Attribute(t,i,a,s,new Uint16Array(u));case Uint32Array:return c.AddUInt32Attribute(t,i,a,s,new Uint32Array(u));case Float32Array:default:return c.AddFloatAttribute(t,i,a,s,new Float32Array(u))}}_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 ze(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 We(r,t={}){let{draco:e}=await zt(t),o=new G(e);try{return o.encodeSync(r,t.draco)}finally{o.destroy()}}var $e,jt,qt=l(()=>{Gt();nt();j();$e={pointcloud:!1,attributeNameEntry:"name"},jt={name:"DRACO",id:"draco",module:"draco",version:C,extensions:["drc"],encode:We,options:{draco:$e}}});var Qt={};ee(Qt,{DracoLoader:()=>Vt,DracoWorkerLoader:()=>q,DracoWriter:()=>jt,_TypecheckDracoLoader:()=>je});async function Ge(r,t){let{draco:e}=await vt(t),o=new v(e);try{return o.parseSync(r,t?.draco)}finally{o.destroy()}}var Vt,je,Yt=l(()=>{ct();St();nt();qt();Vt={...q,parse:Ge};je=Vt});var Ve=st((ro,Ht)=>{var qe=(Yt(),Qt);globalThis.loaders=globalThis.loaders||{};Ht.exports=Object.assign(globalThis.loaders,qe)});Ve();})();
4
4
  //# sourceMappingURL=dist.min.js.map