PageSourceSearch

https://unkjd.vercel.app/glxp/loaders/draco/worker_4.0.0-alpha.10/draco-worker.js

js unkjd.vercel.app collected 2026-10-03 07:57:34 UTC 30,699 bytes, 862 lines download raw bytes

1(() => {
2  var __create = Object.create;
3  var __defProp = Object.defineProperty;
4  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5  var __getOwnPropNames = Object.getOwnPropertyNames;
6  var __getProtoOf = Object.getPrototypeOf;
7  var __hasOwnProp = Object.prototype.hasOwnProperty;
8  var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
9  var __commonJS = (cb, mod) => function __require() {
10    return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
11  };
12  var __reExport = (target, module, desc) => {
13    if (module && typeof module === "object" || typeof module === "function") {
14      for (let key of __getOwnPropNames(module))
15        if (!__hasOwnProp.call(target, key) && key !== "default")
16          __defProp(target, key, { get: () => module[key], enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable });
17    }
18    return target;
19  };
20  var __toModule = (module) => {
21    return __reExport(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", module && module.__esModule && "default" in module ? { get: () => module.default, enumerable: true } : { value: module, enumerable: true })), module);
22  };
23
24  // (disabled):../worker-utils/src/lib/node/require-utils.node
25  var require_require_utils = __commonJS({
26    "(disabled):../worker-utils/src/lib/node/require-utils.node"() {
27    }
28  });
29
30  
30// ../worker-utils/src/lib/env-utils/version.ts
31  var VERSION = true ? "4.0.0-alpha.10" : DEFAULT_VERSION;
32  if (false) {
33    console.error("loaders.gl: The __VERSION__ variable is not injected using babel plugin. Latest unstable workers would be fetched from the CDN.");
34  }
35
36  
36// ../worker-utils/src/lib/env-utils/assert.ts
37  function assert(condition, message) {
38    if (!condition) {
39      throw new Error(message || "loaders.gl assertion failed.");
40    }
41  }
42
43  
43// ../worker-utils/src/lib/env-utils/globals.ts
44  var globals = {
45    self: typeof self !== "undefined" && self,
46    window: typeof window !== "undefined" && window,
47    global: typeof global !== "undefined" && global,
48    document: typeof document !== "undefined" && document
49  };
50  var self_ = globals.self || globals.window || globals.global || {};
51  var window_ = globals.window || globals.self || globals.global || {};
52  var global_ = globals.global || globals.self || globals.window || {};
53  var document_ = globals.document || {};
54  var isBrowser = typeof process !== "object" || String(process) !== "[object process]" || process.browser;
55  var isWorker = typeof importScripts === "function";
56  var isMobile = typeof window !== "undefined" && typeof window.orientation !== "undefined";
57  var matches = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
58  var nodeVersion = matches && parseFloat(matches[1]) || 0;
59
60  
vendor: 1,130 bytes, lines 60-95
60// ../worker-utils/src/lib/worker-utils/get-transfer-list.ts
61  function getTransferList(object, recursive = true, transfers) {
62    const transfersSet = transfers || new Set();
63    if (!object) {
64    } else if (isTransferable(object)) {
65      transfersSet.add(object);
66    } else if (isTransferable(object.buffer)) {
67      transfersSet.add(object.buffer);
68    } else if (ArrayBuffer.isView(object)) {
69    } else if (recursive && typeof object === "object") {
70      for (const key in object) {
71        getTransferList(object[key], recursive, transfersSet);
72      }
73    }
74    return transfers === void 0 ? Array.from(transfersSet) : [];
75  }
76  function isTransferable(object) {
77    if (!object) {
78      return false;
79    }
80    if (object instanceof ArrayBuffer) {
81      return true;
82    }
83    if (typeof MessagePort !== "undefined" && object instanceof MessagePort) {
84      return true;
85    }
86    if (typeof ImageBitmap !== "undefined" && object instanceof ImageBitmap) {
87      return true;
88    }
89    if (typeof OffscreenCanvas !== "undefined" && object instanceof OffscreenCanvas) {
90      return true;
91    }
92    return false;
93  }
94
95  
95// ../worker-utils/src/lib/worker-farm/worker-body.ts
96  function getParentPort() {
97    let parentPort;
98    try {
99      eval("globalThis.parentPort = require('worker_threads').parentPort");
100      parentPort = globalThis.parentPort;
101    } catch {
102    }
103    return parentPort;
104  }
105  var onMessageWrapperMap = new Map();
106  var WorkerBody = class {
107    static inWorkerThread() {
108      return typeof self !== "undefined" || Boolean(getParentPort());
109    }
110    static set onmessage(onMessage) {
111      function handleMessage(message) {
112        const parentPort3 = getParentPort();
113        const { type, payload } = parentPort3 ? message : message.data;
114        onMessage(type, payload);
115      }
116      const parentPort2 = getParentPort();
117      if (parentPort2) {
118        parentPort2.on("message", handleMessage);
119        parentPort2.on("exit", () => console.debug("Node worker closing"));
120      } else {
121        globalThis.onmessage = handleMessage;
122      }
123    }
124    static addEventListener(onMessage) {
125      let onMessageWrapper = onMessageWrapperMap.get(onMessage);
126      if (!onMessageWrapper) {
127        onMessageWrapper = (message) => {
128          if (!isKnownMessage(message)) {
129            return;
130          }
131          const parentPort3 = getParentPort();
132          const { type, payload } = parentPort3 ? message : message.data;
133          onMessage(type, payload);
134        };
135      }
136      const parentPort2 = getParentPort();
137      if (parentPort2) {
138        console.error("not implemented");
139      } else {
140        globalThis.addEventListener("message", onMessageWrapper);
141      }
142    }
143    static removeEventListener(onMessage) {
144      const onMessageWrapper = onMessageWrapperMap.get(onMessage);
145      onMessageWrapperMap.delete(onMessage);
146      const parentPort2 = getParentPort();
147      if (parentPort2) {
148        console.error("not implemented");
149      } else {
150        globalThis.removeEventListener("message", onMessageWrapper);
151      }
152    }
153    static postMessage(type, payload) {
154      const data = { source: "loaders.gl", type, payload };
155      const transferList = getTransferList(payload);
156      const parentPort2 = getParentPort();
157      if (parentPort2) {
158        parentPort2.postMessage(data, transferList);
159      } else {
160        globalThis.postMessage(data, transferList);
161      }
162    }
163  };
164  function isKnownMessage(message) {
165    const { type, data } = message;
166    return type === "message" && data && typeof data.source === "string" && data.source.startsWith("loaders.gl");
167  }
168
169  
169// ../worker-utils/src/lib/library-utils/library-utils.ts
170  var node = __toModule(require_require_utils());
171  var LATEST = "beta";
172  var VERSION2 = typeof VERSION !== "undefined" ? VERSION : LATEST;
173  var loadLibraryPromises = {};
174  async function loadLibrary(libraryUrl, moduleName = null, options = {}) {
175    if (moduleName) {
176      libraryUrl = getLibraryUrl(libraryUrl, moduleName, options);
177    }
178    loadLibraryPromises[libraryUrl] = loadLibraryPromises[libraryUrl] || loadLibraryFromFile(libraryUrl);
179    return await loadLibraryPromises[libraryUrl];
180  }
181  function getLibraryUrl(library, moduleName, options) {
182    if (library.startsWith("http")) {
183      return library;
184    }
185    const modules = options.modules || {};
186    if (modules[library]) {
187      return modules[library];
188    }
189    if (!isBrowser) {
190      return `modules/${moduleName}/dist/libs/${library}`;
191    }
192    if (options.CDN) {
193      assert(options.CDN.startsWith("http"));
194      return `${options.CDN}/${moduleName}@${VERSION2}/dist/libs/${library}`;
195    }
196    if (isWorker) {
197      return `../${library}`;
198    }
199    return `modules/${moduleName}/src/libs/${library}`;
200  }
201  async function loadLibraryFromFile(libraryUrl) {
202    if (libraryUrl.endsWith("wasm")) {
203      const response2 = await fetch(libraryUrl);
204      return await response2.arrayBuffer();
205    }
206    if (!isBrowser) {
207      try {
208        return node && node.requireFromFile && await node.requireFromFile(libraryUrl);
209      } catch {
210        return null;
211      }
212    }
213    if (isWorker) {
214      return importScripts(libraryUrl);
215    }
216    const response = await fetch(libraryUrl);
217    const scriptSource = await response.text();
218    return loadLibraryFromString(scriptSource, libraryUrl);
219  }
220  function loadLibraryFromString(scriptSource, id) {
221    if (!isBrowser) {
222      return node.requireFromString && node.requireFromString(scriptSource, id);
223    }
224    if (isWorker) {
225      eval.call(global_, scriptSource);
226      return null;
227    }
228    const script = document.createElement("script");
229    script.id = id;
230    try {
231      script.appendChild(document.createTextNode(scriptSource));
232    } catch (e) {
233      script.text = scriptSource;
234    }
235    document.body.appendChild(script);
236    return null;
237  }
238
239  
239// ../loader-utils/src/lib/worker-loader-utils/create-loader-worker.ts
240  var requestId = 0;
241  function createLoaderWorker(loader) {
242    if (!WorkerBody.inWorkerThread()) {
243      return;
244    }
245    WorkerBody.onmessage = async (type, payload) => {
246      switch (type) {
247        case "process":
248          try {
249            const { input, options = {}, context = {} } = payload;
250            const result = await parseData({
251              loader,
252              arrayBuffer: input,
253              options,
254              context: {
255                ...context,
256                parse: parseOnMainThread
257              }
258            });
259            WorkerBody.postMessage("done", { result });
260          } catch (error) {
261            const message = error instanceof Error ? error.message : "";
262            WorkerBody.postMessage("error", { error: message });
263          }
264          break;
265        default:
266      }
267    };
268  }
269  function parseOnMainThread(arrayBuffer, options) {
270    return new Promise((resolve, reject) => {
271      const id = requestId++;
272      const onMessage = (type, payload2) => {
273        if (payload2.id !== id) {
274          return;
275        }
276        switch (type) {
277          case "done":
278            WorkerBody.removeEventListener(onMessage);
279            resolve(payload2.result);
280            break;
281          case "error":
282            WorkerBody.removeEventListener(onMessage);
283            reject(payload2.error);
284            break;
285          default:
286        }
287      };
288      WorkerBody.addEventListener(onMessage);
289      const payload = { id, input: arrayBuffer, options };
290      WorkerBody.postMessage("process", payload);
291    });
292  }
293  async function parseData({ loader, arrayBuffer, options, context }) {
294    let data;
295    let parser;
296    if (loader.parseSync || loader.parse) {
297      data = arrayBuffer;
298      parser = loader.parseSync || loader.parse;
299    } else if (loader.parseTextSync) {
300      const textDecoder = new TextDecoder();
301      data = textDecoder.decode(arrayBuffer);
302      parser = loader.parseTextSync;
303    } else {
304      throw new Error(`Could not load data with ${loader.name} loader`);
305    }
306    options = {
307      ...options,
308      modules: loader && loader.options && loader.options.modules || {},
309      worker: false
310    };
311    return await parser(data, { ...options }, context, loader);
312  }
313
314  
314// src/lib/utils/version.ts
315  var VERSION3 = true ? "4.0.0-alpha.10" : "latest";
316
317  
317// src/draco-loader.ts
318  var DEFAULT_DRACO_OPTIONS = {
319    draco: {
320      decoderType: typeof WebAssembly === "object" ? "wasm" : "js",
321      libraryPath: "libs/",
322      extraAttributes: {},
323      attributeNameEntry: void 0
324    }
325  };
326  var DracoLoader = {
327    name: "Draco",
328    id: "draco",
329    module: "draco",
330    version: VERSION3,
331    worker: true,
332    extensions: ["drc"],
333    mimeTypes: ["application/octet-stream"],
334    binary: true,
335    tests: ["DRACO"],
336    options: DEFAULT_DRACO_OPTIONS
337  };
338
339  
339// ../schema/src/lib/table/simple-table/data-type.ts
340  function getDataTypeFromTypedArray(array) {
341    switch (array.constructor) {
342      case Int8Array:
343        return "int8";
344      case Uint8Array:
345      case Uint8ClampedArray:
346        return "uint8";
347      case Int16Array:
348        return "int16";
349      case Uint16Array:
350        return "uint16";
351      case Int32Array:
352        return "int32";
353      case Uint32Array:
354        return "uint32";
355      case Float32Array:
356        return "float32";
357      case Float64Array:
358        return "float64";
359      default:
360        return "null";
361    }
362  }
363
364  
vendor: 785 bytes, lines 364-391
364// ../schema/src/lib/mesh/mesh-utils.ts
365  function getMeshBoundingBox(attributes) {
366    let minX = Infinity;
367    let minY = Infinity;
368    let minZ = Infinity;
369    let maxX = -Infinity;
370    let maxY = -Infinity;
371    let maxZ = -Infinity;
372    const positions = attributes.POSITION ? attributes.POSITION.value : [];
373    const len = positions && positions.length;
374    for (let i = 0; i < len; i += 3) {
375      const x = positions[i];
376      const y = positions[i + 1];
377      const z = positions[i + 2];
378      minX = x < minX ? x : minX;
379      minY = y < minY ? y : minY;
380      minZ = z < minZ ? z : minZ;
381      maxX = x > maxX ? x : maxX;
382      maxY = y > maxY ? y : maxY;
383      maxZ = z > maxZ ? z : maxZ;
384    }
385    return [
386      [minX, minY, minZ],
387      [maxX, maxY, maxZ]
388    ];
389  }
390
391  
391// ../schema/src/lib/mesh/deduce-mesh-schema.ts
392  function deduceMeshField(name, attribute, optionalMetadata) {
393    const type = getDataTypeFromTypedArray(attribute.value);
394    const metadata = optionalMetadata ? optionalMetadata : makeMeshAttributeMetadata(attribute);
395    return {
396      name,
397      type: { type: "fixed-size-list", listSize: attribute.size, children: [{ name: "value", type }] },
398      nullable: false,
399      metadata
400    };
401  }
402  function makeMeshAttributeMetadata(attribute) {
403    const result = {};
404    if ("byteOffset" in attribute) {
405      result.byteOffset = attribute.byteOffset.toString(10);
406    }
407    if ("byteStride" in attribute) {
408      result.byteStride = attribute.byteStride.toString(10);
409    }
410    if ("normalized" in attribute) {
411      result.normalized = attribute.normalized.toString();
412    }
413    return result;
414  }
415
416  
vendor: 14,365 bytes, lines 416-794
416// src/lib/utils/get-draco-schema.ts
417  function getDracoSchema(attributes, loaderData, indices) {
418    const metadata = makeMetadata(loaderData.metadata);
419    const fields = [];
420    const namedLoaderDataAttributes = transformAttributesLoaderData(loaderData.attributes);
421    for (const attributeName in attributes) {
422      const attribute = attributes[attributeName];
423      const field = getArrowFieldFromAttribute(attributeName, attribute, namedLoaderDataAttributes[attributeName]);
424      fields.push(field);
425    }
426    if (indices) {
427      const indicesField = getArrowFieldFromAttribute("indices", indices);
428      fields.push(indicesField);
429    }
430    return { fields, metadata };
431  }
432  function transformAttributesLoaderData(loaderData) {
433    const result = {};
434    for (const key in loaderData) {
435      const dracoAttribute = loaderData[key];
436      result[dracoAttribute.name || "undefined"] = dracoAttribute;
437    }
438    return result;
439  }
440  function getArrowFieldFromAttribute(attributeName, attribute, loaderData) {
441    const metadataMap = loaderData ? makeMetadata(loaderData.metadata) : void 0;
442    const field = deduceMeshField(attributeName, attribute, metadataMap);
443    return field;
444  }
445  function makeMetadata(metadata) {
446    Object.entries(metadata);
447    const serializedMetadata = {};
448    for (const key in metadata) {
449      serializedMetadata[`${key}.string`] = JSON.stringify(metadata[key]);
450    }
451    return serializedMetadata;
452  }
453
454  // src/lib/draco-parser.ts
455  var DRACO_TO_GLTF_ATTRIBUTE_NAME_MAP = {
456    POSITION: "POSITION",
457    NORMAL: "NORMAL",
458    COLOR: "COLOR_0",
459    TEX_COORD: "TEXCOORD_0"
460  };
461  var DRACO_DATA_TYPE_TO_TYPED_ARRAY_MAP = {
462    1: Int8Array,
463    2: Uint8Array,
464    3: Int16Array,
465    4: Uint16Array,
466    5: Int32Array,
467    6: Uint32Array,
468    9: Float32Array
469  };
470  var INDEX_ITEM_SIZE = 4;
471  var DracoParser = class {
472    constructor(draco) {
473      this.draco = draco;
474      this.decoder = new this.draco.Decoder();
475      this.metadataQuerier = new this.draco.MetadataQuerier();
476    }
477    destroy() {
478      this.draco.destroy(this.decoder);
479      this.draco.destroy(this.metadataQuerier);
480    }
481    parseSync(arrayBuffer, options = {}) {
482      const buffer = new this.draco.DecoderBuffer();
483      buffer.Init(new Int8Array(arrayBuffer), arrayBuffer.byteLength);
484      this._disableAttributeTransforms(options);
485      const geometry_type = this.decoder.GetEncodedGeometryType(buffer);
486      const dracoGeometry = geometry_type === this.draco.TRIANGULAR_MESH ? new this.draco.Mesh() : new this.draco.PointCloud();
487      try {
488        let dracoStatus;
489        switch (geometry_type) {
490          case this.draco.TRIANGULAR_MESH:
491            dracoStatus = this.decoder.DecodeBufferToMesh(buffer, dracoGeometry);
492            break;
493          case this.draco.POINT_CLOUD:
494            dracoStatus = this.decoder.DecodeBufferToPointCloud(buffer, dracoGeometry);
495            break;
496          default:
497            throw new Error("DRACO: Unknown geometry type.");
498        }
499        if (!dracoStatus.ok() || !dracoGeometry.ptr) {
500          const message = `DRACO decompression failed: ${dracoStatus.error_msg()}`;
501          throw new Error(message);
502        }
503        const loaderData = this._getDracoLoaderData(dracoGeometry, geometry_type, options);
504        const geometry = this._getMeshData(dracoGeometry, loaderData, options);
505        const boundingBox = getMeshBoundingBox(geometry.attributes);
506        const schema = getDracoSchema(geometry.attributes, loaderData, geometry.indices);
507        const data = {
508          loader: "draco",
509          loaderData,
510          header: {
511            vertexCount: dracoGeometry.num_points(),
512            boundingBox
513          },
514          ...geometry,
515          schema
516        };
517        return data;
518      } finally {
519        this.draco.destroy(buffer);
520        if (dracoGeometry) {
521          this.draco.destroy(dracoGeometry);
522        }
523      }
524    }
525    _getDracoLoaderData(dracoGeometry, geometry_type, options) {
526      const metadata = this._getTopLevelMetadata(dracoGeometry);
527      const attributes = this._getDracoAttributes(dracoGeometry, options);
528      return {
529        geometry_type,
530        num_attributes: dracoGeometry.num_attributes(),
531        num_points: dracoGeometry.num_points(),
532        num_faces: dracoGeometry instanceof this.draco.Mesh ? dracoGeometry.num_faces() : 0,
533        metadata,
534        attributes
535      };
536    }
537    _getDracoAttributes(dracoGeometry, options) {
538      const dracoAttributes = {};
539      for (let attributeId = 0; attributeId < dracoGeometry.num_attributes(); attributeId++) {
540        const dracoAttribute = this.decoder.GetAttribute(dracoGeometry, attributeId);
541        const metadata = this._getAttributeMetadata(dracoGeometry, attributeId);
542        dracoAttributes[dracoAttribute.unique_id()] = {
543          unique_id: dracoAttribute.unique_id(),
544          attribute_type: dracoAttribute.attribute_type(),
545          data_type: dracoAttribute.data_type(),
546          num_components: dracoAttribute.num_components(),
547          byte_offset: dracoAttribute.byte_offset(),
548          byte_stride: dracoAttribute.byte_stride(),
549          normalized: dracoAttribute.normalized(),
550          attribute_index: attributeId,
551          metadata
552        };
553        const quantization = this._getQuantizationTransform(dracoAttribute, options);
554        if (quantization) {
555          dracoAttributes[dracoAttribute.unique_id()].quantization_transform = quantization;
556        }
557        const octahedron = this._getOctahedronTransform(dracoAttribute, options);
558        if (octahedron) {
559          dracoAttributes[dracoAttribute.unique_id()].octahedron_transform = octahedron;
560        }
561      }
562      return dracoAttributes;
563    }
564    _getMeshData(dracoGeometry, loaderData, options) {
565      const attributes = this._getMeshAttributes(loaderData, dracoGeometry, options);
566      const positionAttribute = attributes.POSITION;
567      if (!positionAttribute) {
568        throw new Error("DRACO: No position attribute found.");
569      }
570      if (dracoGeometry instanceof this.draco.Mesh) {
571        switch (options.topology) {
572          case "triangle-strip":
573            return {
574              topology: "triangle-strip",
575              mode: 4,
576              attributes,
577              indices: {
578                value: this._getTriangleStripIndices(dracoGeometry),
579                size: 1
580              }
581            };
582          case "triangle-list":
583          default:
584            return {
585              topology: "triangle-list",
586              mode: 5,
587              attributes,
588              indices: {
589                value: this._getTriangleListIndices(dracoGeometry),
590                size: 1
591              }
592            };
593        }
594      }
595      return {
596        topology: "point-list",
597        mode: 0,
598        attributes
599      };
600    }
601    _getMeshAttributes(loaderData, dracoGeometry, options) {
602      const attributes = {};
603      for (const loaderAttribute of Object.values(loaderData.attributes)) {
604        const attributeName = this._deduceAttributeName(loaderAttribute, options);
605        loaderAttribute.name = attributeName;
606        const { value, size } = this._getAttributeValues(dracoGeometry, loaderAttribute);
607        attributes[attributeName] = {
608          value,
609          size,
610          byteOffset: loaderAttribute.byte_offset,
611          byteStride: loaderAttribute.byte_stride,
612          normalized: loaderAttribute.normalized
613        };
614      }
615      return attributes;
616    }
617    _getTriangleListIndices(dracoGeometry) {
618      const numFaces = dracoGeometry.num_faces();
619      const numIndices = numFaces * 3;
620      const byteLength = numIndices * INDEX_ITEM_SIZE;
621      const ptr = this.draco._malloc(byteLength);
622      try {
623        this.decoder.GetTrianglesUInt32Array(dracoGeometry, byteLength, ptr);
624        return new Uint32Array(this.draco.HEAPF32.buffer, ptr, numIndices).slice();
625      } finally {
626        this.draco._free(ptr);
627      }
628    }
629    _getTriangleStripIndices(dracoGeometry) {
630      const dracoArray = new this.draco.DracoInt32Array();
631      try {
632        this.decoder.GetTriangleStripsFromMesh(dracoGeometry, dracoArray);
633        return getUint32Array(dracoArray);
634      } finally {
635        this.draco.destroy(dracoArray);
636      }
637    }
638    _getAttributeValues(dracoGeometry, attribute) {
639      const TypedArrayCtor = DRACO_DATA_TYPE_TO_TYPED_ARRAY_MAP[attribute.data_type];
640      const numComponents = attribute.num_components;
641      const numPoints = dracoGeometry.num_points();
642      const numValues = numPoints * numComponents;
643      const byteLength = numValues * TypedArrayCtor.BYTES_PER_ELEMENT;
644      const dataType = getDracoDataType(this.draco, TypedArrayCtor);
645      let value;
646      const ptr = this.draco._malloc(byteLength);
647      try {
648        const dracoAttribute = this.decoder.GetAttribute(dracoGeometry, attribute.attribute_index);
649        this.decoder.GetAttributeDataArrayForAllPoints(dracoGeometry, dracoAttribute, dataType, byteLength, ptr);
650        value = new TypedArrayCtor(this.draco.HEAPF32.buffer, ptr, numValues).slice();
651      } finally {
652        this.draco._free(ptr);
653      }
654      return { value, size: numComponents };
655    }
656    _deduceAttributeName(attribute, options) {
657      const uniqueId = attribute.unique_id;
658      for (const [attributeName, attributeUniqueId] of Object.entries(options.extraAttributes || {})) {
659        if (attributeUniqueId === uniqueId) {
660          return attributeName;
661        }
662      }
663      const thisAttributeType = attribute.attribute_type;
664      for (const dracoAttributeConstant in DRACO_TO_GLTF_ATTRIBUTE_NAME_MAP) {
665        const attributeType = this.draco[dracoAttributeConstant];
666        if (attributeType === thisAttributeType) {
667          return DRACO_TO_GLTF_ATTRIBUTE_NAME_MAP[dracoAttributeConstant];
668        }
669      }
670      const entryName = options.attributeNameEntry || "name";
671      if (attribute.metadata[entryName]) {
672        return attribute.metadata[entryName].string;
673      }
674      return `CUSTOM_ATTRIBUTE_${uniqueId}`;
675    }
676    _getTopLevelMetadata(dracoGeometry) {
677      const dracoMetadata = this.decoder.GetMetadata(dracoGeometry);
678      return this._getDracoMetadata(dracoMetadata);
679    }
680    _getAttributeMetadata(dracoGeometry, attributeId) {
681      const dracoMetadata = this.decoder.GetAttributeMetadata(dracoGeometry, attributeId);
682      return this._getDracoMetadata(dracoMetadata);
683    }
684    _getDracoMetadata(dracoMetadata) {
685      if (!dracoMetadata || !dracoMetadata.ptr) {
686        return {};
687      }
688      const result = {};
689      const numEntries = this.metadataQuerier.NumEntries(dracoMetadata);
690      for (let entryIndex = 0; entryIndex < numEntries; entryIndex++) {
691        const entryName = this.metadataQuerier.GetEntryName(dracoMetadata, entryIndex);
692        result[entryName] = this._getDracoMetadataField(dracoMetadata, entryName);
693      }
694      return result;
695    }
696    _getDracoMetadataField(dracoMetadata, entryName) {
697      const dracoArray = new this.draco.DracoInt32Array();
698      try {
699        this.metadataQuerier.GetIntEntryArray(dracoMetadata, entryName, dracoArray);
700        const intArray = getInt32Array(dracoArray);
701        return {
702          int: this.metadataQuerier.GetIntEntry(dracoMetadata, entryName),
703          string: this.metadataQuerier.GetStringEntry(dracoMetadata, entryName),
704          double: this.metadataQuerier.GetDoubleEntry(dracoMetadata, entryName),
705          intArray
706        };
707      } finally {
708        this.draco.destroy(dracoArray);
709      }
710    }
711    _disableAttributeTransforms(options) {
712      const { quantizedAttributes = [], octahedronAttributes = [] } = options;
713      const skipAttributes = [...quantizedAttributes, ...octahedronAttributes];
714      for (const dracoAttributeName of skipAttributes) {
715        this.decoder.SkipAttributeTransform(this.draco[dracoAttributeName]);
716      }
717    }
718    _getQuantizationTransform(dracoAttribute, options) {
719      const { quantizedAttributes = [] } = options;
720      const attribute_type = dracoAttribute.attribute_type();
721      const skip = quantizedAttributes.map((type) => this.decoder[type]).includes(attribute_type);
722      if (skip) {
723        const transform = new this.draco.AttributeQuantizationTransform();
724        try {
725          if (transform.InitFromAttribute(dracoAttribute)) {
726            return {
727              quantization_bits: transform.quantization_bits(),
728              range: transform.range(),
729              min_values: new Float32Array([1, 2, 3]).map((i) => transform.min_value(i))
730            };
731          }
732        } finally {
733          this.draco.destroy(transform);
734        }
735      }
736      return null;
737    }
738    _getOctahedronTransform(dracoAttribute, options) {
739      const { octahedronAttributes = [] } = options;
740      const attribute_type = dracoAttribute.attribute_type();
741      const octahedron = octahedronAttributes.map((type) => this.decoder[type]).includes(attribute_type);
742      if (octahedron) {
743        const transform = new this.draco.AttributeQuantizationTransform();
744        try {
745          if (transform.InitFromAttribute(dracoAttribute)) {
746            return {
747              quantization_bits: transform.quantization_bits()
748            };
749          }
750        } finally {
751          this.draco.destroy(transform);
752        }
753      }
754      return null;
755    }
756  };
757  function getDracoDataType(draco, attributeType) {
758    switch (attributeType) {
759      case Float32Array:
760        return draco.DT_FLOAT32;
761      case Int8Array:
762        return draco.DT_INT8;
763      case Int16Array:
764        return draco.DT_INT16;
765      case Int32Array:
766        return draco.DT_INT32;
767      case Uint8Array:
768        return draco.DT_UINT8;
769      case Uint16Array:
770        return draco.DT_UINT16;
771      case Uint32Array:
772        return draco.DT_UINT32;
773      default:
774        return draco.DT_INVALID;
775    }
776  }
777  function getInt32Array(dracoArray) {
778    const numValues = dracoArray.size();
779    const intArray = new Int32Array(numValues);
780    for (let i = 0; i < numValues; i++) {
781      intArray[i] = dracoArray.GetValue(i);
782    }
783    return intArray;
784  }
785  function getUint32Array(dracoArray) {
786    const numValues = dracoArray.size();
787    const intArray = new Int32Array(numValues);
788    for (let i = 0; i < numValues; i++) {
789      intArray[i] = dracoArray.GetValue(i);
790    }
791    return intArray;
792  }
793
794  
794// src/lib/draco-module-loader.ts
795  var DRACO_DECODER_VERSION = "1.5.5";
796  var DRACO_ENCODER_VERSION = "1.4.1";
797  // CHANGED FOR ASTROGL
798  var STATIC_DECODER_URL = `decoder_${DRACO_DECODER_VERSION}`;
799  var DRACO_JS_DECODER_URL = `${STATIC_DECODER_URL}/draco_decoder.js`;
800  var DRACO_WASM_WRAPPER_URL = `${STATIC_DECODER_URL}/draco_wasm_wrapper.js`;
801  var DRACO_WASM_DECODER_URL = `${STATIC_DECODER_URL}/draco_decoder.wasm`;
802  var DRACO_ENCODER_URL = `https://raw.githubusercontent.com/google/draco/${DRACO_ENCODER_VERSION}/javascript/draco_encoder.js`;
803  var loadDecoderPromise;
804  async function loadDracoDecoderModule(options) {
805    const modules = options.modules || {};
806    if (modules.draco3d) {
807      loadDecoderPromise = loadDecoderPromise || modules.draco3d.createDecoderModule({}).then((draco) => {
808        return { draco };
809      });
810    } else {
811      loadDecoderPromise = loadDecoderPromise || loadDracoDecoder(options);
812    }
813    return await loadDecoderPromise;
814  }
815  async function loadDracoDecoder(options) {
816    let DracoDecoderModule;
817    let wasmBinary;
818    switch (options.draco && options.draco.decoderType) {
819      case "js":
820        DracoDecoderModule = await loadLibrary(DRACO_JS_DECODER_URL, "draco", options);
821        break;
822      case "wasm":
823      default:
824        [DracoDecoderModule, wasmBinary] = await Promise.all([
825          await loadLibrary(DRACO_WASM_WRAPPER_URL, "draco", options),
826          await loadLibrary(DRACO_WASM_DECODER_URL, "draco", options)
827        ]);
828    }
829    DracoDecoderModule = DracoDecoderModule || globalThis.DracoDecoderModule;
830    return await initializeDracoDecoder(DracoDecoderModule, wasmBinary);
831  }
832  function initializeDracoDecoder(DracoDecoderModule, wasmBinary) {
833    const options = {};
834    if (wasmBinary) {
835      options.wasmBinary = wasmBinary;
836    }
837    return new Promise((resolve) => {
838      DracoDecoderModule({
839        ...options,
840        onModuleLoaded: (draco) => resolve({ draco })
841      });
842    });
843  }
844
845  
845// src/index.ts
846  var DracoLoader2 = {
847    ...DracoLoader,
848    parse
849  };
850  async function parse(arrayBuffer, options) {
851    const { draco } = await loadDracoDecoderModule(options);
852    const dracoParser = new DracoParser(draco);
853    try {
854      return dracoParser.parseSync(arrayBuffer, options?.draco);
855    } finally {
856      dracoParser.destroy();
857    }
858  }
859
860  
860// src/workers/draco-worker.ts
861  createLoaderWorker(DracoLoader2);
862})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.