"use strict";
(self["webpackChunk_itwin_rpcinterface_full_stack_tests"] = self["webpackChunk_itwin_rpcinterface_full_stack_tests"] || []).push([["vendors-common_temp_node_modules_pnpm_loaders_gl_draco_4_3_4__loaders_gl_core_4_3_4_node_modu-4c1fc9"],{

/***/ "../../common/temp/node_modules/.pnpm/@loaders.gl+draco@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/draco/dist/draco-loader.js":
/*!***********************************************************************************************************************************************!*\
  !*** ../../common/temp/node_modules/.pnpm/@loaders.gl+draco@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/draco/dist/draco-loader.js ***!
  \***********************************************************************************************************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   DracoLoader: () => (/* binding */ DracoLoader)
/* harmony export */ });
/* harmony import */ var _lib_utils_version_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./lib/utils/version.js */ "../../common/temp/node_modules/.pnpm/@loaders.gl+draco@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/draco/dist/lib/utils/version.js");
// loaders.gl
// SPDX-License-Identifier: MIT
// Copyright (c) vis.gl contributors

/**
 * Worker loader for Draco3D compressed geometries
 */
const DracoLoader = {
    dataType: null,
    batchType: null,
    name: 'Draco',
    id: 'draco',
    module: 'draco',
    // shapes: ['mesh'],
    version: _lib_utils_version_js__WEBPACK_IMPORTED_MODULE_0__.VERSION,
    worker: true,
    extensions: ['drc'],
    mimeTypes: ['application/octet-stream'],
    binary: true,
    tests: ['DRACO'],
    options: {
        draco: {
            decoderType: typeof WebAssembly === 'object' ? 'wasm' : 'js', // 'js' for IE11
            libraryPath: 'libs/',
            extraAttributes: {},
            attributeNameEntry: undefined
        }
    }
};


/***/ }),

/***/ "../../common/temp/node_modules/.pnpm/@loaders.gl+draco@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/draco/dist/draco-writer.js":
/*!***********************************************************************************************************************************************!*\
  !*** ../../common/temp/node_modules/.pnpm/@loaders.gl+draco@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/draco/dist/draco-writer.js ***!
  \***********************************************************************************************************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   DracoWriter: () => (/* binding */ DracoWriter)
/* harmony export */ });
/* harmony import */ var _lib_draco_builder_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./lib/draco-builder.js */ "../../common/temp/node_modules/.pnpm/@loaders.gl+draco@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/draco/dist/lib/draco-builder.js");
/* harmony import */ var _lib_draco_module_loader_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./lib/draco-module-loader.js */ "../../common/temp/node_modules/.pnpm/@loaders.gl+draco@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/draco/dist/lib/draco-module-loader.js");
/* harmony import */ var _lib_utils_version_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./lib/utils/version.js */ "../../common/temp/node_modules/.pnpm/@loaders.gl+draco@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/draco/dist/lib/utils/version.js");



const DEFAULT_DRACO_WRITER_OPTIONS = {
    pointcloud: false, // Set to true if pointcloud (mode: 0, no indices)
    attributeNameEntry: 'name'
    // Draco Compression Parameters
    // method: 'MESH_EDGEBREAKER_ENCODING', // Use draco defaults
    // speed: [5, 5], // Use draco defaults
    // quantization: { // Use draco defaults
    //   POSITION: 10
    // }
};
/**
 * Exporter for Draco3D compressed geometries
 */
const DracoWriter = {
    name: 'DRACO',
    id: 'draco',
    module: 'draco',
    version: _lib_utils_version_js__WEBPACK_IMPORTED_MODULE_0__.VERSION,
    extensions: ['drc'],
    options: {
        draco: DEFAULT_DRACO_WRITER_OPTIONS
    },
    encode
};
async function encode(data, options = {}) {
    // Dynamically load draco
    const { draco } = await (0,_lib_draco_module_loader_js__WEBPACK_IMPORTED_MODULE_1__.loadDracoEncoderModule)(options);
    const dracoBuilder = new _lib_draco_builder_js__WEBPACK_IMPORTED_MODULE_2__["default"](draco);
    try {
        return dracoBuilder.encodeSync(data, options.draco);
    }
    finally {
        dracoBuilder.destroy();
    }
}


/***/ }),

/***/ "../../common/temp/node_modules/.pnpm/@loaders.gl+draco@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/draco/dist/index.js":
/*!****************************************************************************************************************************************!*\
  !*** ../../common/temp/node_modules/.pnpm/@loaders.gl+draco@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/draco/dist/index.js ***!
  \****************************************************************************************************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   DRACO_EXTERNAL_LIBRARIES: () => (/* reexport safe */ _lib_draco_module_loader_js__WEBPACK_IMPORTED_MODULE_0__.DRACO_EXTERNAL_LIBRARIES),
/* harmony export */   DRACO_EXTERNAL_LIBRARY_URLS: () => (/* reexport safe */ _lib_draco_module_loader_js__WEBPACK_IMPORTED_MODULE_0__.DRACO_EXTERNAL_LIBRARY_URLS),
/* harmony export */   DracoLoader: () => (/* binding */ DracoLoader),
/* harmony export */   DracoWorkerLoader: () => (/* reexport safe */ _draco_loader_js__WEBPACK_IMPORTED_MODULE_3__.DracoLoader),
/* harmony export */   DracoWriter: () => (/* reexport safe */ _draco_writer_js__WEBPACK_IMPORTED_MODULE_1__.DracoWriter),
/* harmony export */   DracoWriterWorker: () => (/* binding */ DracoWriterWorker)
/* harmony export */ });
/* harmony import */ var _draco_loader_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./draco-loader.js */ "../../common/temp/node_modules/.pnpm/@loaders.gl+draco@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/draco/dist/draco-loader.js");
/* harmony import */ var _lib_draco_parser_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./lib/draco-parser.js */ "../../common/temp/node_modules/.pnpm/@loaders.gl+draco@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/draco/dist/lib/draco-parser.js");
/* harmony import */ var _lib_draco_module_loader_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./lib/draco-module-loader.js */ "../../common/temp/node_modules/.pnpm/@loaders.gl+draco@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/draco/dist/lib/draco-module-loader.js");
/* harmony import */ var _lib_utils_version_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./lib/utils/version.js */ "../../common/temp/node_modules/.pnpm/@loaders.gl+draco@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/draco/dist/lib/utils/version.js");
/* harmony import */ var _draco_writer_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./draco-writer.js */ "../../common/temp/node_modules/.pnpm/@loaders.gl+draco@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/draco/dist/draco-writer.js");




// Module constants


/**
 * Browser worker doesn't work because of issue during "draco_encoder.js" loading.
 * Refused to execute script from 'https://raw.githubusercontent.com/google/draco/1.4.1/javascript/draco_encoder.js' because its MIME type ('') is not executable.
 */
const DracoWriterWorker = {
    id: 'draco-writer',
    name: 'Draco compressed geometry writer',
    module: 'draco',
    version: _lib_utils_version_js__WEBPACK_IMPORTED_MODULE_2__.VERSION,
    worker: true,
    options: {
        draco: {},
        source: null
    }
};

/**
 * Loader for Draco3D compressed geometries
 */
const DracoLoader = {
    ..._draco_loader_js__WEBPACK_IMPORTED_MODULE_3__.DracoLoader,
    parse
};
async function parse(arrayBuffer, options) {
    const { draco } = await (0,_lib_draco_module_loader_js__WEBPACK_IMPORTED_MODULE_0__.loadDracoDecoderModule)(options);
    const dracoParser = new _lib_draco_parser_js__WEBPACK_IMPORTED_MODULE_4__["default"](draco);
    try {
        return dracoParser.parseSync(arrayBuffer, options?.draco);
    }
    finally {
        dracoParser.destroy();
    }
}


/***/ }),

/***/ "../../common/temp/node_modules/.pnpm/@loaders.gl+draco@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/draco/dist/lib/draco-builder.js":
/*!****************************************************************************************************************************************************!*\
  !*** ../../common/temp/node_modules/.pnpm/@loaders.gl+draco@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/draco/dist/lib/draco-builder.js ***!
  \****************************************************************************************************************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (/* binding */ DracoBuilder)
/* harmony export */ });
// Native Draco attribute names to GLTF attribute names.
const GLTF_TO_DRACO_ATTRIBUTE_NAME_MAP = {
    POSITION: 'POSITION',
    NORMAL: 'NORMAL',
    COLOR_0: 'COLOR',
    TEXCOORD_0: 'TEX_COORD'
};
const noop = () => { };
class DracoBuilder {
    draco;
    dracoEncoder;
    dracoMeshBuilder;
    dracoMetadataBuilder;
    log;
    // draco - the draco decoder, either import `draco3d` or load dynamically
    constructor(draco) {
        this.draco = draco;
        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);
        // @ts-ignore
        this.dracoMeshBuilder = null;
        // @ts-ignore
        this.dracoEncoder = null;
        // @ts-ignore
        this.draco = null;
    }
    // TBD - when does this need to be called?
    destroyEncodedObject(object) {
        if (object) {
            this.draco.destroy(object);
        }
    }
    /**
     * Encode mesh or point cloud
     * @param mesh =({})
     * @param options
     */
    encodeSync(mesh, options = {}) {
        this.log = noop; // TODO
        this._setOptions(options);
        return options.pointcloud
            ? this._encodePointCloud(mesh, options)
            : this._encodeMesh(mesh, options);
    }
    // PRIVATE
    _getAttributesFromMesh(mesh) {
        // TODO - Change the encodePointCloud interface instead?
        const attributes = { ...mesh, ...mesh.attributes };
        // Fold indices into the attributes
        if (mesh.indices) {
            attributes.indices = mesh.indices;
        }
        return attributes;
    }
    _encodePointCloud(pointcloud, options) {
        const dracoPointCloud = new this.draco.PointCloud();
        if (options.metadata) {
            this._addGeometryMetadata(dracoPointCloud, options.metadata);
        }
        const attributes = this._getAttributesFromMesh(pointcloud);
        // Build a `DracoPointCloud` from the input data
        this._createDracoPointCloud(dracoPointCloud, attributes, options);
        const dracoData = new this.draco.DracoInt8Array();
        try {
            const encodedLen = this.dracoEncoder.EncodePointCloudToDracoBuffer(dracoPointCloud, false, dracoData);
            if (!(encodedLen > 0)) {
                throw new Error('Draco encoding failed.');
            }
            this.log(`DRACO encoded ${dracoPointCloud.num_points()} points
        with ${dracoPointCloud.num_attributes()} attributes into ${encodedLen} bytes`);
            return dracoInt8ArrayToArrayBuffer(dracoData);
        }
        finally {
            this.destroyEncodedObject(dracoData);
            this.destroyEncodedObject(dracoPointCloud);
        }
    }
    _encodeMesh(mesh, options) {
        const dracoMesh = new this.draco.Mesh();
        if (options.metadata) {
            this._addGeometryMetadata(dracoMesh, options.metadata);
        }
        const attributes = this._getAttributesFromMesh(mesh);
        // Build a `DracoMesh` from the input data
        this._createDracoMesh(dracoMesh, attributes, options);
        const dracoData = new this.draco.DracoInt8Array();
        try {
            const encodedLen = this.dracoEncoder.EncodeMeshToDracoBuffer(dracoMesh, dracoData);
            if (encodedLen <= 0) {
                throw new Error('Draco encoding failed.');
            }
            this.log(`DRACO encoded ${dracoMesh.num_points()} points
        with ${dracoMesh.num_attributes()} attributes into ${encodedLen} bytes`);
            return dracoInt8ArrayToArrayBuffer(dracoData);
        }
        finally {
            this.destroyEncodedObject(dracoData);
            this.destroyEncodedObject(dracoMesh);
        }
    }
    /**
     * Set encoding options.
     * @param {{speed?: any; method?: any; quantization?: any;}} options
     */
    _setOptions(options) {
        if ('speed' in options) {
            // @ts-ignore
            this.dracoEncoder.SetSpeedOptions(...options.speed);
        }
        if ('method' in options) {
            const dracoMethod = this.draco[options.method || 'MESH_SEQUENTIAL_ENCODING'];
            // assert(dracoMethod)
            this.dracoEncoder.SetEncodingMethod(dracoMethod);
        }
        if ('quantization' in options) {
            for (const attribute in options.quantization) {
                const bits = options.quantization[attribute];
                const dracoPosition = this.draco[attribute];
                this.dracoEncoder.SetAttributeQuantization(dracoPosition, bits);
            }
        }
    }
    /**
     * @param {Mesh} dracoMesh
     * @param {object} attributes
     * @returns {Mesh}
     */
    _createDracoMesh(dracoMesh, attributes, options) {
        const optionalMetadata = options.attributesMetadata || {};
        try {
            const positions = this._getPositionAttribute(attributes);
            if (!positions) {
                throw new Error('positions');
            }
            const vertexCount = positions.length / 3;
            for (let attributeName in attributes) {
                const attribute = attributes[attributeName];
                attributeName = GLTF_TO_DRACO_ATTRIBUTE_NAME_MAP[attributeName] || attributeName;
                const uniqueId = this._addAttributeToMesh(dracoMesh, attributeName, attribute, vertexCount);
                if (uniqueId !== -1) {
                    this._addAttributeMetadata(dracoMesh, uniqueId, {
                        name: attributeName,
                        ...(optionalMetadata[attributeName] || {})
                    });
                }
            }
        }
        catch (error) {
            this.destroyEncodedObject(dracoMesh);
            throw error;
        }
        return dracoMesh;
    }
    /**
     * @param {} dracoPointCloud
     * @param {object} attributes
     */
    _createDracoPointCloud(dracoPointCloud, attributes, options) {
        const optionalMetadata = options.attributesMetadata || {};
        try {
            const positions = this._getPositionAttribute(attributes);
            if (!positions) {
                throw new Error('positions');
            }
            const vertexCount = positions.length / 3;
            for (let attributeName in attributes) {
                const attribute = attributes[attributeName];
                attributeName = GLTF_TO_DRACO_ATTRIBUTE_NAME_MAP[attributeName] || attributeName;
                const uniqueId = this._addAttributeToMesh(dracoPointCloud, attributeName, attribute, vertexCount);
                if (uniqueId !== -1) {
                    this._addAttributeMetadata(dracoPointCloud, uniqueId, {
                        name: attributeName,
                        ...(optionalMetadata[attributeName] || {})
                    });
                }
            }
        }
        catch (error) {
            this.destroyEncodedObject(dracoPointCloud);
            throw error;
        }
        return dracoPointCloud;
    }
    /**
     * @param mesh
     * @param attributeName
     * @param attribute
     * @param vertexCount
     */
    _addAttributeToMesh(mesh, attributeName, attribute, vertexCount) {
        if (!ArrayBuffer.isView(attribute)) {
            return -1;
        }
        const type = this._getDracoAttributeType(attributeName);
        // @ts-ignore TODO/fix types
        const size = attribute.length / vertexCount;
        if (type === 'indices') {
            // @ts-ignore TODO/fix types
            const numFaces = attribute.length / 3;
            this.log(`Adding attribute ${attributeName}, size ${numFaces}`);
            // @ts-ignore assumes mesh is a Mesh, not a point cloud
            this.dracoMeshBuilder.AddFacesToMesh(mesh, numFaces, attribute);
            return -1;
        }
        this.log(`Adding attribute ${attributeName}, size ${size}`);
        const builder = this.dracoMeshBuilder;
        const { buffer } = attribute;
        switch (attribute.constructor) {
            case Int8Array:
                return builder.AddInt8Attribute(mesh, type, vertexCount, size, new Int8Array(buffer));
            case Int16Array:
                return builder.AddInt16Attribute(mesh, type, vertexCount, size, new Int16Array(buffer));
            case Int32Array:
                return builder.AddInt32Attribute(mesh, type, vertexCount, size, new Int32Array(buffer));
            case Uint8Array:
            case Uint8ClampedArray:
                return builder.AddUInt8Attribute(mesh, type, vertexCount, size, new Uint8Array(buffer));
            case Uint16Array:
                return builder.AddUInt16Attribute(mesh, type, vertexCount, size, new Uint16Array(buffer));
            case Uint32Array:
                return builder.AddUInt32Attribute(mesh, type, vertexCount, size, new Uint32Array(buffer));
            case Float32Array:
                return builder.AddFloatAttribute(mesh, type, vertexCount, size, new Float32Array(buffer));
            default:
                // eslint-disable-next-line no-console
                console.warn('Unsupported attribute type', attribute);
                return -1;
        }
        // case Float64Array:
        // Add attribute does not seem to be exposed
        //   return builder.AddAttribute(mesh, type, vertexCount, size, new Float32Array(buffer));
    }
    /**
     * DRACO can compress attributes of know type better
     * TODO - expose an attribute type map?
     * @param attributeName
     */
    _getDracoAttributeType(attributeName) {
        switch (attributeName.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(attributes) {
        for (const attributeName in attributes) {
            const attribute = attributes[attributeName];
            const dracoType = this._getDracoAttributeType(attributeName);
            if (dracoType === this.draco.POSITION) {
                return attribute;
            }
        }
        return null;
    }
    /**
     * Add metadata for the geometry.
     * @param dracoGeometry - WASM Draco Object
     * @param metadata
     */
    _addGeometryMetadata(dracoGeometry, metadata) {
        const dracoMetadata = new this.draco.Metadata();
        this._populateDracoMetadata(dracoMetadata, metadata);
        this.dracoMeshBuilder.AddMetadata(dracoGeometry, dracoMetadata);
    }
    /**
     * Add metadata for an attribute to geometry.
     * @param dracoGeometry - WASM Draco Object
     * @param uniqueAttributeId
     * @param metadata
     */
    _addAttributeMetadata(dracoGeometry, uniqueAttributeId, metadata) {
        // Note: Draco JS IDL doesn't seem to expose draco.AttributeMetadata, however it seems to
        // create such objects automatically from draco.Metadata object.
        const dracoAttributeMetadata = new this.draco.Metadata();
        this._populateDracoMetadata(dracoAttributeMetadata, metadata);
        // Draco3d doc note: Directly add attribute metadata to geometry.
        // You can do this without explicitly adding |GeometryMetadata| to mesh.
        this.dracoMeshBuilder.SetMetadataForAttribute(dracoGeometry, uniqueAttributeId, dracoAttributeMetadata);
    }
    /**
     * Add contents of object or map to a WASM Draco Metadata Object
     * @param dracoMetadata - WASM Draco Object
     * @param metadata
     */
    _populateDracoMetadata(dracoMetadata, metadata) {
        for (const [key, value] of getEntries(metadata)) {
            switch (typeof value) {
                case 'number':
                    if (Math.trunc(value) === value) {
                        this.dracoMetadataBuilder.AddIntEntry(dracoMetadata, key, value);
                    }
                    else {
                        this.dracoMetadataBuilder.AddDoubleEntry(dracoMetadata, key, value);
                    }
                    break;
                case 'object':
                    if (value instanceof Int32Array) {
                        this.dracoMetadataBuilder.AddIntEntryArray(dracoMetadata, key, value, value.length);
                    }
                    break;
                case 'string':
                default:
                    this.dracoMetadataBuilder.AddStringEntry(dracoMetadata, key, value);
            }
        }
    }
}
// HELPER FUNCTIONS
/**
 * Copy encoded data to buffer
 * @param dracoData
 */
function dracoInt8ArrayToArrayBuffer(dracoData) {
    const byteLength = dracoData.size();
    const outputBuffer = new ArrayBuffer(byteLength);
    const outputData = new Int8Array(outputBuffer);
    for (let i = 0; i < byteLength; ++i) {
        outputData[i] = dracoData.GetValue(i);
    }
    return outputBuffer;
}
/** Enable iteration over either an object or a map */
function getEntries(container) {
    const hasEntriesFunc = container.entries && !container.hasOwnProperty('entries');
    return hasEntriesFunc ? container.entries() : Object.entries(container);
}


/***/ }),

/***/ "../../common/temp/node_modules/.pnpm/@loaders.gl+draco@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/draco/dist/lib/draco-module-loader.js":
/*!**********************************************************************************************************************************************************!*\
  !*** ../../common/temp/node_modules/.pnpm/@loaders.gl+draco@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/draco/dist/lib/draco-module-loader.js ***!
  \**********************************************************************************************************************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   DRACO_EXTERNAL_LIBRARIES: () => (/* binding */ DRACO_EXTERNAL_LIBRARIES),
/* harmony export */   DRACO_EXTERNAL_LIBRARY_URLS: () => (/* binding */ DRACO_EXTERNAL_LIBRARY_URLS),
/* harmony export */   loadDracoDecoderModule: () => (/* binding */ loadDracoDecoderModule),
/* harmony export */   loadDracoEncoderModule: () => (/* binding */ loadDracoEncoderModule)
/* harmony export */ });
/* harmony import */ var _loaders_gl_worker_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @loaders.gl/worker-utils */ "../../common/temp/node_modules/.pnpm/@loaders.gl+worker-utils@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/worker-utils/dist/lib/library-utils/library-utils.js");
// Dynamic DRACO module loading inspired by THREE.DRACOLoader
// https://github.com/mrdoob/three.js/blob/398c4f39ebdb8b23eefd4a7a5ec49ec0c96c7462/examples/jsm/loaders/DRACOLoader.js
// by Don McCurdy / https://www.donmccurdy.com / MIT license

const DRACO_DECODER_VERSION = '1.5.6';
const DRACO_ENCODER_VERSION = '1.4.1';
const STATIC_DECODER_URL = `https://www.gstatic.com/draco/versioned/decoders/${DRACO_DECODER_VERSION}`;
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_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}`
};
let loadDecoderPromise;
let loadEncoderPromise;
async function loadDracoDecoderModule(options) {
    const modules = options.modules || {};
    // Check if a bundled draco3d library has been supplied by application
    if (modules.draco3d) {
        loadDecoderPromise ||= modules.draco3d.createDecoderModule({}).then((draco) => {
            return { draco };
        });
    }
    else {
        // If not, dynamically load the WASM script from our CDN
        loadDecoderPromise ||= loadDracoDecoder(options);
    }
    return await loadDecoderPromise;
}
async function loadDracoEncoderModule(options) {
    const modules = options.modules || {};
    // Check if a bundled draco3d library has been supplied by application
    if (modules.draco3d) {
        loadEncoderPromise ||= modules.draco3d.createEncoderModule({}).then((draco) => {
            return { draco };
        });
    }
    else {
        // If not, dynamically load the WASM script from our CDN
        loadEncoderPromise ||= loadDracoEncoder(options);
    }
    return await loadEncoderPromise;
}
// DRACO DECODER LOADING
async function loadDracoDecoder(options) {
    let DracoDecoderModule;
    let wasmBinary;
    switch (options.draco && options.draco.decoderType) {
        case 'js':
            DracoDecoderModule = await (0,_loaders_gl_worker_utils__WEBPACK_IMPORTED_MODULE_0__.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 (0,_loaders_gl_worker_utils__WEBPACK_IMPORTED_MODULE_0__.loadLibrary)(DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.DECODER], 'draco', options, DRACO_EXTERNAL_LIBRARIES.DECODER),
                await (0,_loaders_gl_worker_utils__WEBPACK_IMPORTED_MODULE_0__.loadLibrary)(DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.DECODER_WASM], 'draco', options, DRACO_EXTERNAL_LIBRARIES.DECODER_WASM)
            ]);
    }
    // Depends on how import happened...
    // @ts-ignore
    DracoDecoderModule = DracoDecoderModule || globalThis.DracoDecoderModule;
    return await initializeDracoDecoder(DracoDecoderModule, wasmBinary);
}
function initializeDracoDecoder(DracoDecoderModule, wasmBinary) {
    const options = {};
    if (wasmBinary) {
        options.wasmBinary = wasmBinary;
    }
    return new Promise((resolve) => {
        DracoDecoderModule({
            ...options,
            onModuleLoaded: (draco) => resolve({ draco }) // Module is Promise-like. Wrap in object to avoid loop.
        });
    });
}
// ENCODER
async function loadDracoEncoder(options) {
    let DracoEncoderModule = await (0,_loaders_gl_worker_utils__WEBPACK_IMPORTED_MODULE_0__.loadLibrary)(DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.ENCODER], 'draco', options, DRACO_EXTERNAL_LIBRARIES.ENCODER);
    // @ts-ignore
    DracoEncoderModule = DracoEncoderModule || globalThis.DracoEncoderModule;
    return new Promise((resolve) => {
        DracoEncoderModule({
            onModuleLoaded: (draco) => resolve({ draco }) // Module is Promise-like. Wrap in object to avoid loop.
        });
    });
}


/***/ }),

/***/ "../../common/temp/node_modules/.pnpm/@loaders.gl+draco@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/draco/dist/lib/draco-parser.js":
/*!***************************************************************************************************************************************************!*\
  !*** ../../common/temp/node_modules/.pnpm/@loaders.gl+draco@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/draco/dist/lib/draco-parser.js ***!
  \***************************************************************************************************************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (/* binding */ DracoParser)
/* harmony export */ });
/* harmony import */ var _loaders_gl_schema__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @loaders.gl/schema */ "../../common/temp/node_modules/.pnpm/@loaders.gl+schema@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/schema/dist/lib/mesh/mesh-utils.js");
/* harmony import */ var _utils_get_draco_schema_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils/get-draco-schema.js */ "../../common/temp/node_modules/.pnpm/@loaders.gl+draco@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/draco/dist/lib/utils/get-draco-schema.js");
/* eslint-disable camelcase */


// @ts-ignore
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const GEOMETRY_TYPE = {
    TRIANGULAR_MESH: 0,
    POINT_CLOUD: 1
};
// Native Draco attribute names to GLTF attribute names.
const DRACO_TO_GLTF_ATTRIBUTE_NAME_MAP = {
    POSITION: 'POSITION',
    NORMAL: 'NORMAL',
    COLOR: 'COLOR_0',
    TEX_COORD: 'TEXCOORD_0'
};
const DRACO_DATA_TYPE_TO_TYPED_ARRAY_MAP = {
    1: Int8Array,
    2: Uint8Array,
    3: Int16Array,
    4: Uint16Array,
    5: Int32Array,
    6: Uint32Array,
    // 7: BigInt64Array,
    // 8: BigUint64Array,
    9: Float32Array
    // 10: Float64Array
    // 11: BOOL - What array type do we use for this?
};
const INDEX_ITEM_SIZE = 4;
class DracoParser {
    draco;
    decoder;
    metadataQuerier;
    // draco - the draco decoder, either import `draco3d` or load dynamically
    constructor(draco) {
        this.draco = draco;
        this.decoder = new this.draco.Decoder();
        this.metadataQuerier = new this.draco.MetadataQuerier();
    }
    /**
     * Destroy draco resources
     */
    destroy() {
        this.draco.destroy(this.decoder);
        this.draco.destroy(this.metadataQuerier);
    }
    /**
     * NOTE: caller must call `destroyGeometry` on the return value after using it
     * @param arrayBuffer
     * @param options
     */
    parseSync(arrayBuffer, options = {}) {
        const buffer = new this.draco.DecoderBuffer();
        buffer.Init(new Int8Array(arrayBuffer), arrayBuffer.byteLength);
        this._disableAttributeTransforms(options);
        const geometry_type = this.decoder.GetEncodedGeometryType(buffer);
        const dracoGeometry = geometry_type === this.draco.TRIANGULAR_MESH
            ? new this.draco.Mesh()
            : new this.draco.PointCloud();
        try {
            let dracoStatus;
            switch (geometry_type) {
                case this.draco.TRIANGULAR_MESH:
                    dracoStatus = this.decoder.DecodeBufferToMesh(buffer, dracoGeometry);
                    break;
                case this.draco.POINT_CLOUD:
                    dracoStatus = this.decoder.DecodeBufferToPointCloud(buffer, dracoGeometry);
                    break;
                default:
                    throw new Error('DRACO: Unknown geometry type.');
            }
            if (!dracoStatus.ok() || !dracoGeometry.ptr) {
                const message = `DRACO decompression failed: ${dracoStatus.error_msg()}`;
                // console.error(message);
                throw new Error(message);
            }
            const loaderData = this._getDracoLoaderData(dracoGeometry, geometry_type, options);
            const geometry = this._getMeshData(dracoGeometry, loaderData, options);
            const boundingBox = (0,_loaders_gl_schema__WEBPACK_IMPORTED_MODULE_0__.getMeshBoundingBox)(geometry.attributes);
            const schema = (0,_utils_get_draco_schema_js__WEBPACK_IMPORTED_MODULE_1__.getDracoSchema)(geometry.attributes, loaderData, geometry.indices);
            const data = {
                loader: 'draco',
                loaderData,
                header: {
                    vertexCount: dracoGeometry.num_points(),
                    boundingBox
                },
                ...geometry,
                schema
            };
            return data;
        }
        finally {
            this.draco.destroy(buffer);
            if (dracoGeometry) {
                this.draco.destroy(dracoGeometry);
            }
        }
    }
    // Draco specific "loader data"
    /**
     * Extract
     * @param dracoGeometry
     * @param geometry_type
     * @param options
     * @returns
     */
    _getDracoLoaderData(dracoGeometry, geometry_type, options) {
        const metadata = this._getTopLevelMetadata(dracoGeometry);
        const attributes = this._getDracoAttributes(dracoGeometry, options);
        return {
            geometry_type,
            num_attributes: dracoGeometry.num_attributes(),
            num_points: dracoGeometry.num_points(),
            num_faces: dracoGeometry instanceof this.draco.Mesh ? dracoGeometry.num_faces() : 0,
            metadata,
            attributes
        };
    }
    /**
     * Extract all draco provided information and metadata for each attribute
     * @param dracoGeometry
     * @param options
     * @returns
     */
    _getDracoAttributes(dracoGeometry, options) {
        const dracoAttributes = {};
        for (let attributeId = 0; attributeId < dracoGeometry.num_attributes(); attributeId++) {
            // Note: Draco docs do not seem clear on `GetAttribute` ids just being a zero-based index,
            // but it does seems to work this way
            const dracoAttribute = this.decoder.GetAttribute(dracoGeometry, attributeId);
            const metadata = this._getAttributeMetadata(dracoGeometry, attributeId);
            dracoAttributes[dracoAttribute.unique_id()] = {
                unique_id: dracoAttribute.unique_id(),
                attribute_type: dracoAttribute.attribute_type(),
                data_type: dracoAttribute.data_type(),
                num_components: dracoAttribute.num_components(),
                byte_offset: dracoAttribute.byte_offset(),
                byte_stride: dracoAttribute.byte_stride(),
                normalized: dracoAttribute.normalized(),
                attribute_index: attributeId,
                metadata
            };
            // Add transformation parameters for any attributes app wants untransformed
            const quantization = this._getQuantizationTransform(dracoAttribute, options);
            if (quantization) {
                dracoAttributes[dracoAttribute.unique_id()].quantization_transform = quantization;
            }
            const octahedron = this._getOctahedronTransform(dracoAttribute, options);
            if (octahedron) {
                dracoAttributes[dracoAttribute.unique_id()].octahedron_transform = octahedron;
            }
        }
        return dracoAttributes;
    }
    /**
     * Get standard loaders.gl mesh category data
     * Extracts the geometry from draco
     * @param dracoGeometry
     * @param options
     */
    _getMeshData(dracoGeometry, loaderData, options) {
        const attributes = this._getMeshAttributes(loaderData, dracoGeometry, options);
        const positionAttribute = attributes.POSITION;
        if (!positionAttribute) {
            throw new Error('DRACO: No position attribute found.');
        }
        // For meshes, we need indices to define the faces.
        if (dracoGeometry instanceof this.draco.Mesh) {
            switch (options.topology) {
                case 'triangle-strip':
                    return {
                        topology: 'triangle-strip',
                        mode: 4, // GL.TRIANGLES
                        attributes,
                        indices: {
                            value: this._getTriangleStripIndices(dracoGeometry),
                            size: 1
                        }
                    };
                case 'triangle-list':
                default:
                    return {
                        topology: 'triangle-list',
                        mode: 5, // GL.TRIANGLE_STRIP
                        attributes,
                        indices: {
                            value: this._getTriangleListIndices(dracoGeometry),
                            size: 1
                        }
                    };
            }
        }
        // PointCloud - must come last as Mesh inherits from PointCloud
        return {
            topology: 'point-list',
            mode: 0, // GL.POINTS
            attributes
        };
    }
    _getMeshAttributes(loaderData, dracoGeometry, options) {
        const attributes = {};
        for (const loaderAttribute of Object.values(loaderData.attributes)) {
            const attributeName = this._deduceAttributeName(loaderAttribute, options);
            loaderAttribute.name = attributeName;
            const values = this._getAttributeValues(dracoGeometry, loaderAttribute);
            if (values) {
                const { value, size } = values;
                attributes[attributeName] = {
                    value,
                    size,
                    byteOffset: loaderAttribute.byte_offset,
                    byteStride: loaderAttribute.byte_stride,
                    normalized: loaderAttribute.normalized
                };
            }
        }
        return attributes;
    }
    // MESH INDICES EXTRACTION
    /**
     * For meshes, we need indices to define the faces.
     * @param dracoGeometry
     */
    _getTriangleListIndices(dracoGeometry) {
        // Example on how to retrieve mesh and attributes.
        const numFaces = dracoGeometry.num_faces();
        const numIndices = numFaces * 3;
        const byteLength = numIndices * INDEX_ITEM_SIZE;
        const ptr = this.draco._malloc(byteLength);
        try {
            this.decoder.GetTrianglesUInt32Array(dracoGeometry, byteLength, ptr);
            return new Uint32Array(this.draco.HEAPF32.buffer, ptr, numIndices).slice();
        }
        finally {
            this.draco._free(ptr);
        }
    }
    /**
     * For meshes, we need indices to define the faces.
     * @param dracoGeometry
     */
    _getTriangleStripIndices(dracoGeometry) {
        const dracoArray = new this.draco.DracoInt32Array();
        try {
            /* const numStrips = */ this.decoder.GetTriangleStripsFromMesh(dracoGeometry, dracoArray);
            return getUint32Array(dracoArray);
        }
        finally {
            this.draco.destroy(dracoArray);
        }
    }
    /**
     *
     * @param dracoGeometry
     * @param dracoAttribute
     * @param attributeName
     */
    _getAttributeValues(dracoGeometry, attribute) {
        const TypedArrayCtor = DRACO_DATA_TYPE_TO_TYPED_ARRAY_MAP[attribute.data_type];
        if (!TypedArrayCtor) {
            // eslint-disable-next-line no-console
            console.warn(`DRACO: Unsupported attribute type ${attribute.data_type}`);
            return null;
        }
        const numComponents = attribute.num_components;
        const numPoints = dracoGeometry.num_points();
        const numValues = numPoints * numComponents;
        const byteLength = numValues * TypedArrayCtor.BYTES_PER_ELEMENT;
        const dataType = getDracoDataType(this.draco, TypedArrayCtor);
        let value;
        const ptr = this.draco._malloc(byteLength);
        try {
            const dracoAttribute = this.decoder.GetAttribute(dracoGeometry, attribute.attribute_index);
            this.decoder.GetAttributeDataArrayForAllPoints(dracoGeometry, dracoAttribute, dataType, byteLength, ptr);
            value = new TypedArrayCtor(this.draco.HEAPF32.buffer, ptr, numValues).slice();
        }
        finally {
            this.draco._free(ptr);
        }
        return { value, size: numComponents };
    }
    // Attribute names
    /**
     * DRACO does not store attribute names - We need to deduce an attribute name
     * for each attribute
    _getAttributeNames(
      dracoGeometry: Mesh | PointCloud,
      options: DracoParseOptions
    ): {[unique_id: number]: string} {
      const attributeNames: {[unique_id: number]: string} = {};
      for (let attributeId = 0; attributeId < dracoGeometry.num_attributes(); attributeId++) {
        const dracoAttribute = this.decoder.GetAttribute(dracoGeometry, attributeId);
        const attributeName = this._deduceAttributeName(dracoAttribute, options);
        attributeNames[attributeName] = attributeName;
      }
      return attributeNames;
    }
     */
    /**
     * Deduce an attribute name.
     * @note DRACO does not save attribute names, just general type (POSITION, COLOR)
     * to help optimize compression. We generate GLTF compatible names for the Draco-recognized
     * types
     * @param attributeData
     */
    _deduceAttributeName(attribute, options) {
        // Deduce name based on application provided map
        const uniqueId = attribute.unique_id;
        for (const [attributeName, attributeUniqueId] of Object.entries(options.extraAttributes || {})) {
            if (attributeUniqueId === uniqueId) {
                return attributeName;
            }
        }
        // Deduce name based on attribute type
        const thisAttributeType = attribute.attribute_type;
        for (const dracoAttributeConstant in DRACO_TO_GLTF_ATTRIBUTE_NAME_MAP) {
            const attributeType = this.draco[dracoAttributeConstant];
            if (attributeType === thisAttributeType) {
                // TODO - Return unique names if there multiple attributes per type
                // (e.g. multiple TEX_COORDS or COLORS)
                return DRACO_TO_GLTF_ATTRIBUTE_NAME_MAP[dracoAttributeConstant];
            }
        }
        // Look up in metadata
        // TODO - shouldn't this have priority?
        const entryName = options.attributeNameEntry || 'name';
        if (attribute.metadata[entryName]) {
            return attribute.metadata[entryName].string;
        }
        // Attribute of "GENERIC" type, we need to assign some name
        return `CUSTOM_ATTRIBUTE_${uniqueId}`;
    }
    // METADATA EXTRACTION
    /** Get top level metadata */
    _getTopLevelMetadata(dracoGeometry) {
        const dracoMetadata = this.decoder.GetMetadata(dracoGeometry);
        return this._getDracoMetadata(dracoMetadata);
    }
    /** Get per attribute metadata */
    _getAttributeMetadata(dracoGeometry, attributeId) {
        const dracoMetadata = this.decoder.GetAttributeMetadata(dracoGeometry, attributeId);
        return this._getDracoMetadata(dracoMetadata);
    }
    /**
     * Extract metadata field values
     * @param dracoMetadata
     * @returns
     */
    _getDracoMetadata(dracoMetadata) {
        // The not so wonderful world of undocumented Draco APIs :(
        if (!dracoMetadata || !dracoMetadata.ptr) {
            return {};
        }
        const result = {};
        const numEntries = this.metadataQuerier.NumEntries(dracoMetadata);
        for (let entryIndex = 0; entryIndex < numEntries; entryIndex++) {
            const entryName = this.metadataQuerier.GetEntryName(dracoMetadata, entryIndex);
            result[entryName] = this._getDracoMetadataField(dracoMetadata, entryName);
        }
        return result;
    }
    /**
     * Extracts possible values for one metadata entry by name
     * @param dracoMetadata
     * @param entryName
     */
    _getDracoMetadataField(dracoMetadata, entryName) {
        const dracoArray = new this.draco.DracoInt32Array();
        try {
            // Draco metadata fields can hold int32 arrays
            this.metadataQuerier.GetIntEntryArray(dracoMetadata, entryName, dracoArray);
            const intArray = getInt32Array(dracoArray);
            return {
                int: this.metadataQuerier.GetIntEntry(dracoMetadata, entryName),
                string: this.metadataQuerier.GetStringEntry(dracoMetadata, entryName),
                double: this.metadataQuerier.GetDoubleEntry(dracoMetadata, entryName),
                intArray
            };
        }
        finally {
            this.draco.destroy(dracoArray);
        }
    }
    // QUANTIZED ATTRIBUTE SUPPORT (NO DECOMPRESSION)
    /** Skip transforms for specific attribute types */
    _disableAttributeTransforms(options) {
        const { quantizedAttributes = [], octahedronAttributes = [] } = options;
        const skipAttributes = [...quantizedAttributes, ...octahedronAttributes];
        for (const dracoAttributeName of skipAttributes) {
            this.decoder.SkipAttributeTransform(this.draco[dracoAttributeName]);
        }
    }
    /**
     * Extract (and apply?) Position Transform
     * @todo not used
     */
    _getQuantizationTransform(dracoAttribute, options) {
        const { quantizedAttributes = [] } = options;
        const attribute_type = dracoAttribute.attribute_type();
        const skip = quantizedAttributes.map((type) => this.decoder[type]).includes(attribute_type);
        if (skip) {
            const transform = new this.draco.AttributeQuantizationTransform();
            try {
                if (transform.InitFromAttribute(dracoAttribute)) {
                    return {
                        quantization_bits: transform.quantization_bits(),
                        range: transform.range(),
                        min_values: new Float32Array([1, 2, 3]).map((i) => transform.min_value(i))
                    };
                }
            }
            finally {
                this.draco.destroy(transform);
            }
        }
        return null;
    }
    _getOctahedronTransform(dracoAttribute, options) {
        const { octahedronAttributes = [] } = options;
        const attribute_type = dracoAttribute.attribute_type();
        const octahedron = octahedronAttributes
            .map((type) => this.decoder[type])
            .includes(attribute_type);
        if (octahedron) {
            const transform = new this.draco.AttributeQuantizationTransform();
            try {
                if (transform.InitFromAttribute(dracoAttribute)) {
                    return {
                        quantization_bits: transform.quantization_bits()
                    };
                }
            }
            finally {
                this.draco.destroy(transform);
            }
        }
        return null;
    }
}
/**
 * Get draco specific data type by TypedArray constructor type
 * @param attributeType
 * @returns draco specific data type
 */
function getDracoDataType(draco, attributeType) {
    switch (attributeType) {
        case Float32Array:
            return draco.DT_FLOAT32;
        case Int8Array:
            return draco.DT_INT8;
        case Int16Array:
            return draco.DT_INT16;
        case Int32Array:
            return draco.DT_INT32;
        case Uint8Array:
            return draco.DT_UINT8;
        case Uint16Array:
            return draco.DT_UINT16;
        case Uint32Array:
            return draco.DT_UINT32;
        default:
            return draco.DT_INVALID;
    }
}
/**
 * Copy a Draco int32 array into a JS typed array
 */
function getInt32Array(dracoArray) {
    const numValues = dracoArray.size();
    const intArray = new Int32Array(numValues);
    for (let i = 0; i < numValues; i++) {
        intArray[i] = dracoArray.GetValue(i);
    }
    return intArray;
}
/**
 * Copy a Draco int32 array into a JS typed array
 */
function getUint32Array(dracoArray) {
    const numValues = dracoArray.size();
    const intArray = new Int32Array(numValues);
    for (let i = 0; i < numValues; i++) {
        intArray[i] = dracoArray.GetValue(i);
    }
    return intArray;
}


/***/ }),

/***/ "../../common/temp/node_modules/.pnpm/@loaders.gl+draco@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/draco/dist/lib/utils/get-draco-schema.js":
/*!*************************************************************************************************************************************************************!*\
  !*** ../../common/temp/node_modules/.pnpm/@loaders.gl+draco@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/draco/dist/lib/utils/get-draco-schema.js ***!
  \*************************************************************************************************************************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   getDracoSchema: () => (/* binding */ getDracoSchema)
/* harmony export */ });
/* harmony import */ var _loaders_gl_schema__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @loaders.gl/schema */ "../../common/temp/node_modules/.pnpm/@loaders.gl+schema@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/schema/dist/lib/mesh/deduce-mesh-schema.js");

/** Extract an arrow-like schema from a Draco mesh */
function getDracoSchema(attributes, loaderData, indices) {
    const metadata = makeMetadata(loaderData.metadata);
    const fields = [];
    const namedLoaderDataAttributes = transformAttributesLoaderData(loaderData.attributes);
    for (const attributeName in attributes) {
        const attribute = attributes[attributeName];
        const field = getArrowFieldFromAttribute(attributeName, attribute, namedLoaderDataAttributes[attributeName]);
        fields.push(field);
    }
    if (indices) {
        const indicesField = getArrowFieldFromAttribute('indices', indices);
        fields.push(indicesField);
    }
    return { fields, metadata };
}
function transformAttributesLoaderData(loaderData) {
    const result = {};
    for (const key in loaderData) {
        const dracoAttribute = loaderData[key];
        result[dracoAttribute.name || 'undefined'] = dracoAttribute;
    }
    return result;
}
function getArrowFieldFromAttribute(attributeName, attribute, loaderData) {
    const metadataMap = loaderData ? makeMetadata(loaderData.metadata) : undefined;
    const field = (0,_loaders_gl_schema__WEBPACK_IMPORTED_MODULE_0__.deduceMeshField)(attributeName, attribute, metadataMap);
    return field;
}
function makeMetadata(metadata) {
    Object.entries(metadata);
    const serializedMetadata = {};
    for (const key in metadata) {
        serializedMetadata[`${key}.string`] = JSON.stringify(metadata[key]);
    }
    return serializedMetadata;
}


/***/ }),

/***/ "../../common/temp/node_modules/.pnpm/@loaders.gl+draco@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/draco/dist/lib/utils/version.js":
/*!****************************************************************************************************************************************************!*\
  !*** ../../common/temp/node_modules/.pnpm/@loaders.gl+draco@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/draco/dist/lib/utils/version.js ***!
  \****************************************************************************************************************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   VERSION: () => (/* binding */ VERSION)
/* harmony export */ });
// Version constant cannot be imported, it needs to correspond to the build version of **this** module.
// __VERSION__ is injected by babel-plugin-version-inline
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
const VERSION =  true ? "4.3.3" : 0;


/***/ }),

/***/ "../../common/temp/node_modules/.pnpm/@loaders.gl+schema@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/schema/dist/lib/mesh/deduce-mesh-schema.js":
/*!****************************************************************************************************************************************************************!*\
  !*** ../../common/temp/node_modules/.pnpm/@loaders.gl+schema@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/schema/dist/lib/mesh/deduce-mesh-schema.js ***!
  \****************************************************************************************************************************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   deduceMeshField: () => (/* binding */ deduceMeshField),
/* harmony export */   deduceMeshSchema: () => (/* binding */ deduceMeshSchema),
/* harmony export */   makeMeshAttributeMetadata: () => (/* binding */ makeMeshAttributeMetadata)
/* harmony export */ });
/* harmony import */ var _table_simple_table_data_type_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../table/simple-table/data-type.js */ "../../common/temp/node_modules/.pnpm/@loaders.gl+schema@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/schema/dist/lib/table/simple-table/data-type.js");
// loaders.gl
// SPDX-License-Identifier: MIT
// Copyright (c) vis.gl contributors

/**
 * Create a schema for mesh attributes data
 * @param attributes
 * @param metadata
 * @returns
 */
function deduceMeshSchema(attributes, metadata = {}) {
    const fields = deduceMeshFields(attributes);
    return { fields, metadata };
}
/**
 * Create arrow-like schema field for mesh attribute
 * @param attributeName
 * @param attribute
 * @param optionalMetadata
 * @returns
 */
function deduceMeshField(name, attribute, optionalMetadata) {
    const type = (0,_table_simple_table_data_type_js__WEBPACK_IMPORTED_MODULE_0__.getDataTypeFromTypedArray)(attribute.value);
    const metadata = optionalMetadata ? optionalMetadata : makeMeshAttributeMetadata(attribute);
    return {
        name,
        type: { type: 'fixed-size-list', listSize: attribute.size, children: [{ name: 'value', type }] },
        nullable: false,
        metadata
    };
}
/**
 * Create fields array for mesh attributes
 * @param attributes
 * @returns
 */
function deduceMeshFields(attributes) {
    const fields = [];
    for (const attributeName in attributes) {
        const attribute = attributes[attributeName];
        fields.push(deduceMeshField(attributeName, attribute));
    }
    return fields;
}
/**
 * Make metadata by mesh attribute properties
 * @param attribute
 * @returns
 */
function makeMeshAttributeMetadata(attribute) {
    const result = {};
    if ('byteOffset' in attribute) {
        result.byteOffset = attribute.byteOffset.toString(10);
    }
    if ('byteStride' in attribute) {
        result.byteStride = attribute.byteStride.toString(10);
    }
    if ('normalized' in attribute) {
        result.normalized = attribute.normalized.toString();
    }
    return result;
}


/***/ }),

/***/ "../../common/temp/node_modules/.pnpm/@loaders.gl+schema@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/schema/dist/lib/mesh/mesh-utils.js":
/*!********************************************************************************************************************************************************!*\
  !*** ../../common/temp/node_modules/.pnpm/@loaders.gl+schema@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/schema/dist/lib/mesh/mesh-utils.js ***!
  \********************************************************************************************************************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   getMeshBoundingBox: () => (/* binding */ getMeshBoundingBox),
/* harmony export */   getMeshSize: () => (/* binding */ getMeshSize)
/* harmony export */ });
/**
 * Get number of vertices in mesh
 * @param attributes
 */
function getMeshSize(attributes) {
    let size = 0;
    for (const attributeName in attributes) {
        const attribute = attributes[attributeName];
        if (ArrayBuffer.isView(attribute)) {
            // @ts-ignore DataView doesn't have BYTES_PER_ELEMENT
            size += attribute.byteLength * attribute.BYTES_PER_ELEMENT;
        }
    }
    return size;
}
/**
 * Get the (axis aligned) bounding box of a mesh
 * @param attributes
 * @returns array of two vectors representing the axis aligned bounding box
 */
// eslint-disable-next-line complexity
function getMeshBoundingBox(attributes) {
    let minX = Infinity;
    let minY = Infinity;
    let minZ = Infinity;
    let maxX = -Infinity;
    let maxY = -Infinity;
    let maxZ = -Infinity;
    const positions = attributes.POSITION ? attributes.POSITION.value : [];
    const len = positions && positions.length;
    for (let i = 0; i < len; i += 3) {
        const x = positions[i];
        const y = positions[i + 1];
        const z = positions[i + 2];
        minX = x < minX ? x : minX;
        minY = y < minY ? y : minY;
        minZ = z < minZ ? z : minZ;
        maxX = x > maxX ? x : maxX;
        maxY = y > maxY ? y : maxY;
        maxZ = z > maxZ ? z : maxZ;
    }
    return [
        [minX, minY, minZ],
        [maxX, maxY, maxZ]
    ];
}


/***/ }),

/***/ "../../common/temp/node_modules/.pnpm/@loaders.gl+schema@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/schema/dist/lib/table/simple-table/data-type.js":
/*!*********************************************************************************************************************************************************************!*\
  !*** ../../common/temp/node_modules/.pnpm/@loaders.gl+schema@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/schema/dist/lib/table/simple-table/data-type.js ***!
  \*********************************************************************************************************************************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   getArrayTypeFromDataType: () => (/* binding */ getArrayTypeFromDataType),
/* harmony export */   getDataTypeFromArray: () => (/* binding */ getDataTypeFromArray),
/* harmony export */   getDataTypeFromTypedArray: () => (/* binding */ getDataTypeFromTypedArray),
/* harmony export */   getDataTypeFromValue: () => (/* binding */ getDataTypeFromValue)
/* harmony export */ });
// loaders.gl
// SPDX-License-Identifier: MIT
// Copyright (c) vis.gl contributors
/** Deduce column types from values */
function getDataTypeFromValue(value, defaultNumberType = 'float32') {
    if (value instanceof Date) {
        return 'date-millisecond';
    }
    if (value instanceof Number) {
        return defaultNumberType;
    }
    if (typeof value === 'string') {
        return 'utf8';
    }
    if (value === null || value === 'undefined') {
        return 'null';
    }
    return 'null';
}
/**
 * Deduces a simple data type "descriptor from a typed array instance
 */
function getDataTypeFromArray(array) {
    let type = getDataTypeFromTypedArray(array);
    if (type !== 'null') {
        return { type, nullable: false };
    }
    if (array.length > 0) {
        type = getDataTypeFromValue(array[0]);
        return { type, nullable: true };
    }
    return { type: 'null', nullable: true };
}
/**
 * Deduces a simple data type "descriptor from a typed array instance
 */
function getDataTypeFromTypedArray(array) {
    switch (array.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 getArrayTypeFromDataType(type, nullable) {
    if (!nullable) {
        switch (type) {
            case 'int8':
                return Int8Array;
            case 'uint8':
                return Uint8Array;
            case 'int16':
                return Int16Array;
            case 'uint16':
                return Uint16Array;
            case 'int32':
                return Int32Array;
            case 'uint32':
                return Uint32Array;
            case 'float32':
                return Float32Array;
            case 'float64':
                return Float64Array;
            default:
                break;
        }
    }
    // if (typeof BigInt64Array !== 'undefined') {
    //   TYPED_ARRAY_TO_TYPE.BigInt64Array = new Int64();
    //   TYPED_ARRAY_TO_TYPE.BigUint64Array = new Uint64();
    // }
    return Array;
}


/***/ }),

/***/ "../../common/temp/node_modules/.pnpm/@loaders.gl+worker-utils@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/worker-utils/dist/lib/env-utils/assert.js":
/*!*********************************************************************************************************************************************************************!*\
  !*** ../../common/temp/node_modules/.pnpm/@loaders.gl+worker-utils@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/worker-utils/dist/lib/env-utils/assert.js ***!
  \*********************************************************************************************************************************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   assert: () => (/* binding */ assert)
/* harmony export */ });
// loaders.gl
// SPDX-License-Identifier: MIT
// Copyright (c) vis.gl contributors
// Replacement for the external assert method to reduce bundle size
// Note: We don't use the second "message" argument in calling code,
// so no need to support it here
/** Throws an `Error` with the optional `message` if `condition` is falsy */
function assert(condition, message) {
    if (!condition) {
        throw new Error(message || 'loaders.gl assertion failed.');
    }
}


/***/ }),

/***/ "../../common/temp/node_modules/.pnpm/@loaders.gl+worker-utils@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/worker-utils/dist/lib/env-utils/globals.js":
/*!**********************************************************************************************************************************************************************!*\
  !*** ../../common/temp/node_modules/.pnpm/@loaders.gl+worker-utils@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/worker-utils/dist/lib/env-utils/globals.js ***!
  \**********************************************************************************************************************************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   document: () => (/* binding */ document_),
/* harmony export */   global: () => (/* binding */ global_),
/* harmony export */   isBrowser: () => (/* binding */ isBrowser),
/* harmony export */   isMobile: () => (/* binding */ isMobile),
/* harmony export */   isWorker: () => (/* binding */ isWorker),
/* harmony export */   nodeVersion: () => (/* binding */ nodeVersion),
/* harmony export */   self: () => (/* binding */ self_),
/* harmony export */   window: () => (/* binding */ window_)
/* harmony export */ });
// loaders.gl
// SPDX-License-Identifier: MIT
// Copyright (c) vis.gl contributors
// Purpose: include this in your module to avoids adding dependencies on
// micro modules like 'global' and 'is-browser';
/* eslint-disable no-restricted-globals */
const globals = {
    self: typeof self !== 'undefined' && self,
    window: typeof window !== 'undefined' && window,
    global: typeof global !== 'undefined' && global,
    document: typeof document !== 'undefined' && document
};
const self_ = globals.self || globals.window || globals.global || {};
const window_ = globals.window || globals.self || globals.global || {};
const global_ = globals.global || globals.self || globals.window || {};
const document_ = globals.document || {};

/** true if running in the browser, false if running in Node.js */
const isBrowser = 
// @ts-ignore process.browser
typeof process !== 'object' || String(process) !== '[object process]' || process.browser;
/** true if running on a worker thread */
const isWorker = typeof importScripts === 'function';
/** true if running on a mobile device */
const isMobile = typeof window !== 'undefined' && typeof window.orientation !== 'undefined';
// Extract node major version
const matches = typeof process !== 'undefined' && process.version && /v([0-9]*)/.exec(process.version);
/** Version of Node.js if running under Node, otherwise 0 */
const nodeVersion = (matches && parseFloat(matches[1])) || 0;


/***/ }),

/***/ "../../common/temp/node_modules/.pnpm/@loaders.gl+worker-utils@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/worker-utils/dist/lib/env-utils/version.js":
/*!**********************************************************************************************************************************************************************!*\
  !*** ../../common/temp/node_modules/.pnpm/@loaders.gl+worker-utils@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/worker-utils/dist/lib/env-utils/version.js ***!
  \**********************************************************************************************************************************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   NPM_TAG: () => (/* binding */ NPM_TAG),
/* harmony export */   VERSION: () => (/* binding */ VERSION)
/* harmony export */ });
// loaders.gl
// SPDX-License-Identifier: MIT
// Copyright (c) vis.gl contributors
// Version constant cannot be imported, it needs to correspond to the build version of **this** module.
/**
 * TODO - unpkg.com doesn't seem to have a `latest` specifier for alpha releases...
 * 'beta' on beta branch, 'latest' on prod branch
 */
const NPM_TAG = 'latest';
function getVersion() {
    if (!globalThis._loadersgl_?.version) {
        globalThis._loadersgl_ = globalThis._loadersgl_ || {};
        // __VERSION__ is injected by babel-plugin-version-inline
        if (false) {}
        else {
            globalThis._loadersgl_.version = "4.3.3";
        }
    }
    return globalThis._loadersgl_.version;
}
const VERSION = getVersion();


/***/ }),

/***/ "../../common/temp/node_modules/.pnpm/@loaders.gl+worker-utils@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/worker-utils/dist/lib/library-utils/library-utils.js":
/*!********************************************************************************************************************************************************************************!*\
  !*** ../../common/temp/node_modules/.pnpm/@loaders.gl+worker-utils@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/worker-utils/dist/lib/library-utils/library-utils.js ***!
  \********************************************************************************************************************************************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   getLibraryUrl: () => (/* binding */ getLibraryUrl),
/* harmony export */   loadLibrary: () => (/* binding */ loadLibrary)
/* harmony export */ });
/* harmony import */ var _env_utils_globals_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../env-utils/globals.js */ "../../common/temp/node_modules/.pnpm/@loaders.gl+worker-utils@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/worker-utils/dist/lib/env-utils/globals.js");
/* harmony import */ var _env_utils_assert_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../env-utils/assert.js */ "../../common/temp/node_modules/.pnpm/@loaders.gl+worker-utils@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/worker-utils/dist/lib/env-utils/assert.js");
/* harmony import */ var _env_utils_version_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../env-utils/version.js */ "../../common/temp/node_modules/.pnpm/@loaders.gl+worker-utils@4.3.4_@loaders.gl+core@4.3.4/node_modules/@loaders.gl/worker-utils/dist/lib/env-utils/version.js");
// loaders.gl
// SPDX-License-Identifier: MIT
// Copyright (c) vis.gl contributors
/* global importScripts */



const loadLibraryPromises = {}; // promises
/**
 * Dynamically loads a library ("module")
 *
 * - wasm library: Array buffer is returned
 * - js library: Parse JS is returned
 *
 * Method depends on environment
 * - browser - script element is created and installed on document
 * - worker - eval is called on global context
 * - node - file is required
 *
 * @param libraryUrl
 * @param moduleName
 * @param options
 */
async function loadLibrary(libraryUrl, moduleName = null, options = {}, libraryName = null) {
    if (moduleName) {
        libraryUrl = getLibraryUrl(libraryUrl, moduleName, options, libraryName);
    }
    // Ensure libraries are only loaded once
    loadLibraryPromises[libraryUrl] =
        // eslint-disable-next-line @typescript-eslint/no-misused-promises
        loadLibraryPromises[libraryUrl] || loadLibraryFromFile(libraryUrl);
    return await loadLibraryPromises[libraryUrl];
}
// TODO - sort out how to resolve paths for main/worker and dev/prod
function getLibraryUrl(library, moduleName, options = {}, libraryName = null) {
    // Check if already a URL
    if (!options.useLocalLibraries && library.startsWith('http')) {
        return library;
    }
    libraryName = libraryName || library;
    // Allow application to import and supply libraries through `options.modules`
    // TODO - See js-module-utils in loader-utils
    const modules = options.modules || {};
    if (modules[libraryName]) {
        return modules[libraryName];
    }
    // Load from local files, not from CDN scripts in Node.js
    // TODO - needs to locate the modules directory when installed!
    if (!_env_utils_globals_js__WEBPACK_IMPORTED_MODULE_0__.isBrowser) {
        return `modules/${moduleName}/dist/libs/${libraryName}`;
    }
    // In browser, load from external scripts
    if (options.CDN) {
        (0,_env_utils_assert_js__WEBPACK_IMPORTED_MODULE_1__.assert)(options.CDN.startsWith('http'));
        return `${options.CDN}/${moduleName}@${_env_utils_version_js__WEBPACK_IMPORTED_MODULE_2__.VERSION}/dist/libs/${libraryName}`;
    }
    // TODO - loading inside workers requires paths relative to worker script location...
    if (_env_utils_globals_js__WEBPACK_IMPORTED_MODULE_0__.isWorker) {
        return `../src/libs/${libraryName}`;
    }
    return `modules/${moduleName}/src/libs/${libraryName}`;
}
async function loadLibraryFromFile(libraryUrl) {
    if (libraryUrl.endsWith('wasm')) {
        return await loadAsArrayBuffer(libraryUrl);
    }
    if (!_env_utils_globals_js__WEBPACK_IMPORTED_MODULE_0__.isBrowser) {
        // TODO - Node doesn't yet support dynamic import from https URLs
        // try {
        //   return await import(libraryUrl);
        // } catch (error) {
        //   console.error(error);
        // }
        try {
            const { requireFromFile } = globalThis.loaders || {};
            return await requireFromFile?.(libraryUrl);
        }
        catch (error) {
            console.error(error); // eslint-disable-line no-console
            return null;
        }
    }
    if (_env_utils_globals_js__WEBPACK_IMPORTED_MODULE_0__.isWorker) {
        return importScripts(libraryUrl);
    }
    // TODO - fix - should be more secure than string parsing since observes CORS
    // if (isBrowser) {
    //   return await loadScriptFromFile(libraryUrl);
    // }
    const scriptSource = await loadAsText(libraryUrl);
    return loadLibraryFromString(scriptSource, libraryUrl);
}
/*
async function loadScriptFromFile(libraryUrl) {
  const script = document.createElement('script');
  script.src = libraryUrl;
  return await new Promise((resolve, reject) => {
    script.onload = data => {
      resolve(data);
    };
    script.onerror = reject;
  });
}
*/
// TODO - Needs security audit...
//  - Raw eval call
//  - Potentially bypasses CORS
// Upside is that this separates fetching and parsing
// we could create a`LibraryLoader` or`ModuleLoader`
function loadLibraryFromString(scriptSource, id) {
    if (!_env_utils_globals_js__WEBPACK_IMPORTED_MODULE_0__.isBrowser) {
        const { requireFromString } = globalThis.loaders || {};
        return requireFromString?.(scriptSource, id);
    }
    if (_env_utils_globals_js__WEBPACK_IMPORTED_MODULE_0__.isWorker) {
        // Use lvalue trick to make eval run in global scope
        eval.call(globalThis, scriptSource); // eslint-disable-line no-eval
        // https://stackoverflow.com/questions/9107240/1-evalthis-vs-evalthis-in-javascript
        // http://perfectionkills.com/global-eval-what-are-the-options/
        return null;
    }
    const script = document.createElement('script');
    script.id = id;
    // most browsers like a separate text node but some throw an error. The second method covers those.
    try {
        script.appendChild(document.createTextNode(scriptSource));
    }
    catch (e) {
        script.text = scriptSource;
    }
    document.body.appendChild(script);
    return null;
}
// TODO - technique for module injection into worker, from THREE.DracoLoader...
/*
function combineWorkerWithLibrary(worker, jsContent) {
  var fn = wWorker.toString();
  var body = [
    '// injected',
    jsContent,
    '',
    '// worker',
    fn.substring(fn.indexOf('{') + 1, fn.lastIndexOf('}'))
  ].join('\n');
  this.workerSourceURL = URL.createObjectURL(new Blob([body]));
}
*/
async function loadAsArrayBuffer(url) {
    const { readFileAsArrayBuffer } = globalThis.loaders || {};
    if (_env_utils_globals_js__WEBPACK_IMPORTED_MODULE_0__.isBrowser || !readFileAsArrayBuffer || url.startsWith('http')) {
        const response = await fetch(url);
        return await response.arrayBuffer();
    }
    return await readFileAsArrayBuffer(url);
}
/**
 * Load a file from local file system
 * @param filename
 * @returns
 */
async function loadAsText(url) {
    const { readFileAsText } = globalThis.loaders || {};
    if (_env_utils_globals_js__WEBPACK_IMPORTED_MODULE_0__.isBrowser || !readFileAsText || url.startsWith('http')) {
        const response = await fetch(url);
        return await response.text();
    }
    return await readFileAsText(url);
}


/***/ })

}]);
//# sourceMappingURL=vendors-common_temp_node_modules_pnpm_loaders_gl_draco_4_3_4__loaders_gl_core_4_3_4_node_modu-4c1fc9.bundled-tests.js.map