{
  "version": 3,
  "sources": ["../src/index.ts", "../src/lib/parsers/constants.ts", "../src/i3s-loader.ts", "../src/lib/parsers/parse-i3s-tile-content.ts", "../src/types.ts", "../src/lib/utils/url-utils.ts", "../src/i3s-content-loader.ts", "../src/lib/parsers/parse-i3s.ts", "../src/lib/helpers/i3s-nodepages-tiles.ts", "../src/i3s-node-page-loader.ts", "../src/i3s-slpk-loader.ts", "../src/lib/parsers/parse-slpk/parse-slpk.ts", "../src/lib/parsers/parse-slpk/slpk-archieve.ts", "../src/i3s-attribute-loader.ts", "../src/lib/parsers/parse-i3s-attribute.ts", "../src/lib/parsers/parse-i3s-building-scene-layer.ts", "../src/i3s-building-scene-layer-loader.ts", "../src/lib/parsers/parse-arcgis-webscene.ts", "../src/arcgis-webscene-loader.ts", "../src/lib/utils/customize-colors.ts"],
  "sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport type {\n  BoundingVolumes,\n  Mbs,\n  Obb,\n  I3STilesetHeader,\n  I3STileContent,\n  I3STileHeader,\n  SceneLayer3D,\n  AttributeStorageInfo,\n  Field,\n  ESRIField,\n  PopupInfo,\n  Node3DIndexDocument,\n  LodSelection,\n  NodeReference,\n  Resource,\n  MaxScreenThresholdSQ,\n  NodeInPage,\n  SharedResources,\n  Attribute,\n  Extent,\n  FeatureAttribute,\n  FieldInfo,\n  I3SMaterialDefinition,\n  TextureDefinitionInfo,\n  MaterialDefinitionInfo,\n  FullExtent,\n  StatisticsInfo,\n  StatsInfo,\n  Histogram,\n  ValueCount,\n  BuildingSceneSublayer,\n  OperationalLayer,\n  TextureSetDefinitionFormats\n} from './types';\nexport type {I3SLoaderOptions} from './i3s-loader';\n\nexport {COORDINATE_SYSTEM} from './lib/parsers/constants';\n\nexport {I3SLoader} from './i3s-loader';\nexport {SLPKLoader} from './i3s-slpk-loader';\nexport {I3SContentLoader} from './i3s-content-loader';\nexport {I3SAttributeLoader, loadFeatureAttributes} from './i3s-attribute-loader';\nexport {I3SBuildingSceneLayerLoader} from './i3s-building-scene-layer-loader';\nexport {I3SNodePageLoader} from './i3s-node-page-loader';\nexport {ArcGISWebSceneLoader} from './arcgis-webscene-loader';\n\nexport {SLPKArchive} from './lib/parsers/parse-slpk/slpk-archieve';\nexport {parseSLPKArchive} from './lib/parsers/parse-slpk/parse-slpk';\nexport {LayerError} from './lib/parsers/parse-arcgis-webscene';\nexport {customizeColors} from './lib/utils/customize-colors';\nexport {type I3STileAttributes} from './lib/parsers/parse-i3s-attribute';\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {GL} from '@loaders.gl/math';\n\nexport function getConstructorForDataFormat(dataType: string) {\n  switch (dataType) {\n    case 'UInt8':\n      return Uint8Array;\n    case 'UInt16':\n      return Uint16Array;\n    case 'UInt32':\n      return Uint32Array;\n    case 'Float32':\n      return Float32Array;\n    case 'UInt64':\n      return Float64Array;\n    default:\n      throw new Error(`parse i3s tile content: unknown type of data: ${dataType}`);\n  }\n}\n\nexport const GL_TYPE_MAP: {[key: string]: number} = {\n  UInt8: GL.UNSIGNED_BYTE,\n  UInt16: GL.UNSIGNED_SHORT,\n  Float32: GL.FLOAT,\n  UInt32: GL.UNSIGNED_INT,\n  UInt64: GL.DOUBLE\n};\n/**\n * Returns how many bytes a type occupies\n * @param dataType\n * @returns\n */\nexport function sizeOf(dataType: string): number {\n  switch (dataType) {\n    case 'UInt8':\n      return 1;\n    case 'UInt16':\n    case 'Int16':\n      return 2;\n    case 'UInt32':\n    case 'Int32':\n    case 'Float32':\n      return 4;\n    case 'UInt64':\n    case 'Int64':\n    case 'Float64':\n      return 8;\n    default:\n      throw new Error(`parse i3s tile content: unknown size of data: ${dataType}`);\n  }\n}\n\nexport const STRING_ATTRIBUTE_TYPE = 'String';\nexport const OBJECT_ID_ATTRIBUTE_TYPE = 'Oid32';\nexport const FLOAT_64_TYPE = 'Float64';\nexport const INT_16_ATTRIBUTE_TYPE = 'Int16';\n\n// https://github.com/visgl/deck.gl/blob/9548f43cba2234a1f4877b6b17f6c88eb35b2e08/modules/core/src/lib/constants.js#L27\n// Describes the format of positions\nexport enum COORDINATE_SYSTEM {\n  /**\n   * `LNGLAT` if rendering into a geospatial viewport, `CARTESIAN` otherwise\n   */\n  DEFAULT = -1,\n  /**\n   * Positions are interpreted as [lng, lat, elevation]\n   * lng lat are degrees, elevation is meters. distances as meters.\n   */\n  LNGLAT = 1,\n  /**\n   * Positions are interpreted as meter offsets, distances as meters\n   */\n  METER_OFFSETS = 2,\n  /**\n   * Positions are interpreted as lng lat offsets: [deltaLng, deltaLat, elevation]\n   * deltaLng, deltaLat are delta degrees, elevation is meters.\n   * distances as meters.\n   */\n  LNGLAT_OFFSETS = 3,\n  /**\n   * Non-geospatial\n   */\n  CARTESIAN = 0\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\n\nimport type {LoaderWithParser, StrictLoaderOptions} from '@loaders.gl/loader-utils';\nimport {parse} from '@loaders.gl/core';\nimport type {I3STilesetHeader} from './types';\nimport {I3SContentLoader} from './i3s-content-loader';\nimport {normalizeTileData, normalizeTilesetData} from './lib/parsers/parse-i3s';\nimport {COORDINATE_SYSTEM} from './lib/parsers/constants';\nimport {I3SParseOptions} from './types';\nimport {getUrlWithoutParams} from './lib/utils/url-utils';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nconst TILESET_REGEX = /layers\\/[0-9]+$/;\nconst LOCAL_SLPK_REGEX = /\\.slpk$/;\nconst TILE_HEADER_REGEX = /nodes\\/([0-9-]+|root)$/;\nconst SLPK_HEX = '504b0304';\nconst POINT_CLOUD = 'PointCloud';\n\nexport type I3SLoaderOptions = StrictLoaderOptions & {\n  i3s?: I3SParseOptions & {\n    /** For I3SAttributeLoader */\n    attributeName?: string;\n    /** For I3SAttributeLoader */\n    attributeType?: string;\n  };\n};\n\n/**\n * Loader for I3S - Indexed 3D Scene Layer\n */\nexport const I3SLoader = {\n  dataType: null as unknown as I3STilesetHeader,\n  batchType: null as never,\n\n  name: 'I3S (Indexed Scene Layers)',\n  id: 'i3s',\n  module: 'i3s',\n  version: VERSION,\n  mimeTypes: ['application/octet-stream'],\n  parse: parseI3S,\n  extensions: ['bin'],\n  options: {\n    i3s: {\n      token: undefined,\n      isTileset: 'auto',\n      isTileHeader: 'auto',\n      tile: undefined,\n      tileset: undefined,\n      _tileOptions: undefined,\n      _tilesetOptions: undefined,\n      useDracoGeometry: true,\n      useCompressedTextures: true,\n      decodeTextures: true,\n      coordinateSystem: COORDINATE_SYSTEM.METER_OFFSETS\n    }\n  }\n} as const satisfies LoaderWithParser<I3STilesetHeader, never, I3SLoaderOptions>;\n\nasync function parseI3S(data, options: I3SLoaderOptions = {}, context): Promise<I3STilesetHeader> {\n  const url = context.url;\n  options.i3s = options.i3s || {};\n  const magicNumber = getMagicNumber(data);\n\n  // check if file is slpk\n  if (magicNumber === SLPK_HEX) {\n    throw new Error('Files with .slpk extention currently are not supported by I3SLoader');\n  }\n\n  const urlWithoutParams = getUrlWithoutParams(url);\n\n  // auto detect file type based on url\n  let isTileset;\n  if (options.i3s.isTileset === 'auto') {\n    isTileset = TILESET_REGEX.test(urlWithoutParams) || LOCAL_SLPK_REGEX.test(urlWithoutParams);\n  } else {\n    isTileset = options.i3s.isTileset;\n  }\n\n  let isTileHeader;\n  if (options.i3s.isTileHeader === 'auto') {\n    isTileHeader = TILE_HEADER_REGEX.test(urlWithoutParams);\n  } else {\n    isTileHeader = options.i3s.isTileHeader;\n  }\n\n  if (isTileset) {\n    data = await parseTileset(data, options, context);\n  } else if (isTileHeader) {\n    data = await parseTile(data, context);\n  } else {\n    data = await parseTileContent(data, options);\n  }\n\n  return data;\n}\n\nasync function parseTileContent(arrayBuffer, options: I3SLoaderOptions) {\n  return await parse(arrayBuffer, I3SContentLoader, options);\n}\n\nasync function parseTileset(data, options: I3SLoaderOptions, context) {\n  const tilesetJson = JSON.parse(new TextDecoder().decode(data));\n\n  if (tilesetJson?.layerType === POINT_CLOUD) {\n    throw new Error('Point Cloud layers currently are not supported by I3SLoader');\n  }\n\n  const tilesetPostprocessed = await normalizeTilesetData(tilesetJson, options, context);\n  return tilesetPostprocessed;\n}\n\nasync function parseTile(data, context) {\n  data = JSON.parse(new TextDecoder().decode(data));\n  return normalizeTileData(data, context);\n}\n\nfunction getMagicNumber(data) {\n  if (data instanceof ArrayBuffer) {\n    // slice binary data (4 bytes from the beginning) and transform it to hexadecimal numeral system\n    return [...new Uint8Array(data, 0, 4)]\n      .map((value) => value.toString(16).padStart(2, '0'))\n      .join('');\n  }\n  return null;\n}\n", "import type {TypedArray} from '@loaders.gl/schema';\nimport {load, parse} from '@loaders.gl/core';\nimport {Vector3, Matrix4} from '@math.gl/core';\nimport {Ellipsoid} from '@math.gl/geospatial';\nimport {StrictLoaderOptions, LoaderContext, parseFromContext} from '@loaders.gl/loader-utils';\nimport {ImageLoader} from '@loaders.gl/images';\nimport {DracoLoader, DracoMesh} from '@loaders.gl/draco';\nimport {BasisLoader, CompressedTextureLoader} from '@loaders.gl/textures';\n\nimport {\n  FeatureAttribute,\n  VertexAttribute,\n  I3SMeshAttributes,\n  I3SMeshAttribute,\n  TileContentTexture,\n  HeaderAttributeProperty,\n  I3SMaterialDefinition,\n  I3STileContent,\n  I3STileOptions,\n  I3STilesetOptions\n} from '../../types';\nimport {getUrlWithToken} from '../utils/url-utils';\n\nimport {GL_TYPE_MAP, getConstructorForDataFormat, sizeOf, COORDINATE_SYSTEM} from './constants';\nimport {I3SLoaderOptions} from '../../i3s-loader';\n\nconst scratchVector = new Vector3([0, 0, 0]);\n\nfunction getLoaderForTextureFormat(textureFormat?: 'jpg' | 'png' | 'ktx-etc2' | 'dds' | 'ktx2') {\n  switch (textureFormat) {\n    case 'ktx-etc2':\n    case 'dds':\n      return CompressedTextureLoader;\n    case 'ktx2':\n      return BasisLoader;\n    case 'jpg':\n    case 'png':\n    default:\n      return ImageLoader;\n  }\n}\n\nconst I3S_ATTRIBUTE_TYPE = 'i3s-attribute-type';\n\nexport async function parseI3STileContent(\n  arrayBuffer: ArrayBuffer,\n  tileOptions: I3STileOptions,\n  tilesetOptions: I3STilesetOptions,\n  options?: StrictLoaderOptions,\n  context?: LoaderContext\n): Promise<I3STileContent> {\n  const content: I3STileContent = {\n    attributes: {},\n    indices: null,\n    featureIds: [],\n    vertexCount: 0,\n    modelMatrix: new Matrix4(),\n    coordinateSystem: 0,\n    byteLength: 0,\n    texture: null\n  };\n\n  if (tileOptions.textureUrl) {\n    // @ts-expect-error options is not properly typed\n    const url = getUrlWithToken(tileOptions.textureUrl, options?.i3s?.token);\n    const loader = getLoaderForTextureFormat(tileOptions.textureFormat);\n    const fetchFunc = context?.fetch || fetch;\n    const response = await fetchFunc(url); // options?.fetch\n    const arrayBuffer = await response.arrayBuffer();\n\n    // @ts-expect-error options is not properly typed\n    if (options?.i3s.decodeTextures) {\n      // TODO - replace with switch\n      if (loader === ImageLoader) {\n        const options = {...tileOptions.textureLoaderOptions, image: {type: 'data'}};\n        try {\n          // Image constructor is not supported in worker thread.\n          // Do parsing image data on the main thread by using context to avoid worker issues.\n          const texture: any = await parseFromContext(arrayBuffer, [], options, context!);\n          content.texture = texture;\n        } catch (e) {\n          // context object is different between worker and node.js conversion script.\n          // To prevent error we parse data in ordinary way if it is not parsed by using context.\n          const texture: any = await parse(arrayBuffer, loader, options, context);\n          content.texture = texture;\n        }\n      } else if (loader === CompressedTextureLoader || loader === BasisLoader) {\n        let texture: any = await load(arrayBuffer, loader, tileOptions.textureLoaderOptions);\n        if (loader === BasisLoader) {\n          texture = texture[0];\n        }\n        content.texture = {\n          compressed: true,\n          mipmaps: false,\n          width: texture[0].width,\n          height: texture[0].height,\n          data: texture\n        };\n      }\n    } else {\n      content.texture = arrayBuffer;\n    }\n  }\n\n  content.material = makePbrMaterial(tileOptions.materialDefinition, content.texture);\n  if (content.material) {\n    content.texture = null;\n  }\n\n  return await parseI3SNodeGeometry(arrayBuffer, content, tileOptions, tilesetOptions, options);\n}\n\n/* eslint-disable max-statements */\nasync function parseI3SNodeGeometry(\n  arrayBuffer: ArrayBuffer,\n  content: I3STileContent,\n  tileOptions: I3STileOptions,\n  tilesetOptions: I3STilesetOptions,\n  options?: I3SLoaderOptions\n): Promise<I3STileContent> {\n  const contentByteLength = arrayBuffer.byteLength;\n  let attributes: I3SMeshAttributes;\n  let vertexCount: number;\n  let byteOffset: number = 0;\n  let featureCount: number = 0;\n  let indices: TypedArray | undefined;\n\n  if (tileOptions.isDracoGeometry) {\n    const decompressedGeometry: DracoMesh = await parse(arrayBuffer, DracoLoader, {\n      draco: {\n        attributeNameEntry: I3S_ATTRIBUTE_TYPE\n      }\n    });\n    // @ts-expect-error\n    vertexCount = decompressedGeometry.header.vertexCount;\n    indices = decompressedGeometry.indices?.value;\n    const {\n      POSITION,\n      NORMAL,\n      COLOR_0,\n      TEXCOORD_0,\n      ['feature-index']: featureIndex,\n      ['uv-region']: uvRegion\n    } = decompressedGeometry.attributes;\n\n    attributes = {\n      position: POSITION,\n      normal: NORMAL,\n      color: COLOR_0,\n      uv0: TEXCOORD_0,\n      uvRegion,\n      id: featureIndex\n    };\n\n    updateAttributesMetadata(attributes, decompressedGeometry);\n\n    const featureIds = getFeatureIdsFromFeatureIndexMetadata(featureIndex);\n\n    if (featureIds) {\n      flattenFeatureIdsByFeatureIndices(attributes, featureIds);\n    }\n  } else {\n    const {\n      vertexAttributes,\n      ordering: attributesOrder,\n      featureAttributes,\n      featureAttributeOrder\n    } = tilesetOptions.store.defaultGeometrySchema;\n    // First 8 bytes reserved for header (vertexCount and featureCount)\n    const headers = parseHeaders(arrayBuffer, tilesetOptions);\n    byteOffset = headers.byteOffset;\n    vertexCount = headers.vertexCount;\n    featureCount = headers.featureCount;\n    // Getting vertex attributes such as positions, normals, colors, etc...\n    const {attributes: normalizedVertexAttributes, byteOffset: offset} = normalizeAttributes(\n      arrayBuffer,\n      byteOffset,\n      vertexAttributes,\n      vertexCount,\n      attributesOrder\n    );\n\n    // Getting feature attributes such as featureIds and faceRange\n    const {attributes: normalizedFeatureAttributes} = normalizeAttributes(\n      arrayBuffer,\n      offset,\n      featureAttributes,\n      featureCount,\n      featureAttributeOrder\n    );\n\n    flattenFeatureIdsByFaceRanges(normalizedFeatureAttributes);\n    attributes = concatAttributes(normalizedVertexAttributes, normalizedFeatureAttributes);\n  }\n\n  if (\n    !options?.i3s?.coordinateSystem ||\n    // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison\n    options.i3s.coordinateSystem === COORDINATE_SYSTEM.METER_OFFSETS\n  ) {\n    const enuMatrix = parsePositions(attributes.position, tileOptions);\n    content.modelMatrix = enuMatrix.invert();\n    content.coordinateSystem = COORDINATE_SYSTEM.METER_OFFSETS;\n  } else {\n    content.modelMatrix = getModelMatrix(attributes.position);\n    content.coordinateSystem = COORDINATE_SYSTEM.LNGLAT_OFFSETS;\n  }\n\n  content.attributes = {\n    positions: attributes.position,\n    normals: attributes.normal,\n    colors: normalizeAttribute(attributes.color), // Normalize from UInt8\n    texCoords: attributes.uv0,\n    uvRegions: normalizeAttribute(attributes.uvRegion || attributes.region) // Normalize from UInt16\n  };\n  content.indices = indices || null;\n\n  if (attributes.id && attributes.id.value) {\n    content.featureIds = attributes.id.value;\n  }\n\n  // Remove undefined attributes\n  for (const attributeIndex in content.attributes) {\n    if (!content.attributes[attributeIndex]) {\n      delete content.attributes[attributeIndex];\n    }\n  }\n\n  content.vertexCount = vertexCount;\n  content.byteLength = contentByteLength;\n\n  return content;\n}\n\n/**\n * Update attributes with metadata from decompressed geometry.\n * @param decompressedGeometry\n * @param attributes\n */\nfunction updateAttributesMetadata(\n  attributes: I3SMeshAttributes,\n  decompressedGeometry: DracoMesh\n): void {\n  for (const key in decompressedGeometry.loaderData.attributes) {\n    const dracoAttribute = decompressedGeometry.loaderData.attributes[key];\n\n    switch (dracoAttribute.name) {\n      case 'POSITION':\n        attributes.position.metadata = dracoAttribute.metadata;\n        break;\n      case 'feature-index':\n        attributes.id.metadata = dracoAttribute.metadata;\n        break;\n      default:\n        break;\n    }\n  }\n}\n\n/**\n * Do concatenation of attribute objects.\n * Done as separate fucntion to avoid ts errors.\n * @param normalizedVertexAttributes\n * @param normalizedFeatureAttributes\n * @returns - result of attributes concatenation.\n */\nfunction concatAttributes(\n  normalizedVertexAttributes: I3SMeshAttributes,\n  normalizedFeatureAttributes: I3SMeshAttributes\n): I3SMeshAttributes {\n  return {...normalizedVertexAttributes, ...normalizedFeatureAttributes};\n}\n\n/**\n * Normalize attribute to range [0..1] . Eg. convert colors buffer from [255,255,255,255] to [1,1,1,1]\n * @param attribute - geometry attribute\n * @returns - geometry attribute in right format\n */\nfunction normalizeAttribute(attribute: I3SMeshAttribute): I3SMeshAttribute {\n  if (!attribute) {\n    return attribute;\n  }\n  attribute.normalized = true;\n  return attribute;\n}\n\nfunction parseHeaders(arrayBuffer: ArrayBuffer, options: I3STilesetOptions) {\n  let byteOffset = 0;\n  // First 8 bytes reserved for header (vertexCount and featurecount)\n  let vertexCount = 0;\n  let featureCount = 0;\n  for (const {property, type} of options.store.defaultGeometrySchema.header) {\n    const TypedArrayTypeHeader = getConstructorForDataFormat(type);\n    switch (property) {\n      case HeaderAttributeProperty.vertexCount.toString():\n        vertexCount = new TypedArrayTypeHeader(arrayBuffer, 0, 4)[0];\n        byteOffset += sizeOf(type);\n        break;\n      case HeaderAttributeProperty.featureCount.toString():\n        featureCount = new TypedArrayTypeHeader(arrayBuffer, 4, 4)[0];\n        byteOffset += sizeOf(type);\n        break;\n      default:\n        break;\n    }\n  }\n\n  return {\n    vertexCount,\n    featureCount,\n    byteOffset\n  };\n}\n\n/* eslint-enable max-statements */\n\nfunction normalizeAttributes(\n  arrayBuffer: ArrayBuffer,\n  byteOffset: number,\n  vertexAttributes: VertexAttribute | FeatureAttribute,\n  attributeCount: number,\n  attributesOrder: string[]\n) {\n  const attributes: I3SMeshAttributes = {};\n\n  // the order of attributes depend on the order being added to the vertexAttributes object\n  for (const attribute of attributesOrder) {\n    if (vertexAttributes[attribute]) {\n      const {valueType, valuesPerElement}: {valueType: string; valuesPerElement: number} =\n        vertexAttributes[attribute];\n      // protect from arrayBuffer read overunns by NOT assuming node has regions always even though its declared in defaultGeometrySchema.\n      // In i3s 1.6: client is required to decide that based on ./shared resource of the node (materialDefinitions.[Mat_id].params.vertexRegions == true)\n      // In i3s 1.7 the property has been rolled into the 3d scene layer json/node pages.\n      // Code below does not account when the bytelength is actually bigger than\n      // the calculated value (b\\c the tile potentially could have mesh segmentation information).\n      // In those cases tiles without regions could fail or have garbage values.\n      if (\n        byteOffset + attributeCount * valuesPerElement * sizeOf(valueType) <=\n        arrayBuffer.byteLength\n      ) {\n        const buffer = arrayBuffer.slice(byteOffset);\n        let value: TypedArray;\n\n        if (valueType === 'UInt64') {\n          value = parseUint64Values(buffer, attributeCount * valuesPerElement, sizeOf(valueType));\n        } else {\n          const TypedArrayType = getConstructorForDataFormat(valueType);\n          value = new TypedArrayType(buffer, 0, attributeCount * valuesPerElement);\n        }\n\n        attributes[attribute] = {\n          value,\n          type: GL_TYPE_MAP[valueType],\n          size: valuesPerElement\n        };\n\n        switch (attribute) {\n          case 'color':\n            attributes.color.normalized = true;\n            break;\n          case 'position':\n          case 'region':\n          case 'normal':\n          default:\n        }\n\n        byteOffset = byteOffset + attributeCount * valuesPerElement * sizeOf(valueType);\n      } else if (attribute !== 'uv0') {\n        break;\n      }\n    }\n  }\n\n  return {attributes, byteOffset};\n}\n\n/**\n * Parse buffer to return array of uint64 values\n *\n * @param buffer\n * @param elementsCount\n * @returns 64-bit array of values until precision is lost after Number.MAX_SAFE_INTEGER\n */\nfunction parseUint64Values(\n  buffer: ArrayBuffer,\n  elementsCount: number,\n  attributeSize: number\n): Uint32Array {\n  const values: number[] = [];\n  const dataView = new DataView(buffer);\n  let offset = 0;\n\n  for (let index = 0; index < elementsCount; index++) {\n    // split 64-bit number into two 32-bit parts\n    const left = dataView.getUint32(offset, true);\n    const right = dataView.getUint32(offset + 4, true);\n    // combine the two 32-bit values\n    const value = left + 2 ** 32 * right;\n\n    values.push(value);\n    offset += attributeSize;\n  }\n\n  return new Uint32Array(values);\n}\n\nfunction parsePositions(attribute: I3SMeshAttribute, options: I3STileOptions): Matrix4 {\n  const mbs = options.mbs;\n  const value = attribute.value;\n  const metadata = attribute.metadata;\n  const enuMatrix = new Matrix4();\n  const cartographicOrigin = new Vector3(mbs[0], mbs[1], mbs[2]);\n  const cartesianOrigin = new Vector3();\n  Ellipsoid.WGS84.cartographicToCartesian(cartographicOrigin, cartesianOrigin);\n  Ellipsoid.WGS84.eastNorthUpToFixedFrame(cartesianOrigin, enuMatrix);\n  attribute.value = offsetsToCartesians(value, metadata, cartographicOrigin);\n\n  return enuMatrix;\n}\n\n/**\n * Converts position coordinates to absolute cartesian coordinates\n * @param vertices - \"position\" attribute data\n * @param metadata - When the geometry is DRACO compressed, contain position attribute's metadata\n *  https://github.com/Esri/i3s-spec/blob/master/docs/1.7/compressedAttributes.cmn.md\n * @param cartographicOrigin - Cartographic origin coordinates\n * @returns - converted \"position\" data\n */\nfunction offsetsToCartesians(\n  vertices: number[] | TypedArray,\n  metadata: any = {},\n  cartographicOrigin: Vector3\n): Float64Array {\n  const positions = new Float64Array(vertices.length);\n  const scaleX = (metadata['i3s-scale_x'] && metadata['i3s-scale_x'].double) || 1;\n  const scaleY = (metadata['i3s-scale_y'] && metadata['i3s-scale_y'].double) || 1;\n  for (let i = 0; i < positions.length; i += 3) {\n    positions[i] = vertices[i] * scaleX + cartographicOrigin.x;\n    positions[i + 1] = vertices[i + 1] * scaleY + cartographicOrigin.y;\n    positions[i + 2] = vertices[i + 2] + cartographicOrigin.z;\n  }\n\n  for (let i = 0; i < positions.length; i += 3) {\n    // @ts-ignore\n    Ellipsoid.WGS84.cartographicToCartesian(positions.subarray(i, i + 3), scratchVector);\n    positions[i] = scratchVector.x;\n    positions[i + 1] = scratchVector.y;\n    positions[i + 2] = scratchVector.z;\n  }\n\n  return positions;\n}\n\n/**\n * Get model matrix for loaded vertices\n * @param positions positions attribute\n * @returns Matrix4 - model matrix for geometry transformation\n */\nfunction getModelMatrix(positions: I3SMeshAttribute): Matrix4 {\n  const metadata = positions.metadata;\n  const scaleX: number = metadata?.['i3s-scale_x']?.double || 1;\n  const scaleY: number = metadata?.['i3s-scale_y']?.double || 1;\n  const modelMatrix = new Matrix4();\n  modelMatrix[0] = scaleX;\n  modelMatrix[5] = scaleY;\n  return modelMatrix;\n}\n\n/**\n * Makes a glTF-compatible PBR material from an I3S material definition\n * @param materialDefinition - i3s material definition\n *  https://github.com/Esri/i3s-spec/blob/master/docs/1.7/materialDefinitions.cmn.md\n * @param texture - texture image\n * @returns {object}\n */\nfunction makePbrMaterial(materialDefinition?: I3SMaterialDefinition, texture?: TileContentTexture) {\n  let pbrMaterial;\n  if (materialDefinition) {\n    pbrMaterial = {\n      ...materialDefinition,\n      pbrMetallicRoughness: materialDefinition.pbrMetallicRoughness\n        ? {...materialDefinition.pbrMetallicRoughness}\n        : {baseColorFactor: [255, 255, 255, 255]}\n    };\n  } else {\n    pbrMaterial = {\n      pbrMetallicRoughness: {}\n    };\n    if (texture) {\n      pbrMaterial.pbrMetallicRoughness.baseColorTexture = {texCoord: 0};\n    } else {\n      pbrMaterial.pbrMetallicRoughness.baseColorFactor = [255, 255, 255, 255];\n    }\n  }\n\n  // Set default 0.25 per spec https://github.com/Esri/i3s-spec/blob/master/docs/1.7/materialDefinitions.cmn.md\n  pbrMaterial.alphaCutoff = pbrMaterial.alphaCutoff || 0.25;\n\n  if (pbrMaterial.alphaMode) {\n    // I3S contain alphaMode in lowerCase\n    pbrMaterial.alphaMode = pbrMaterial.alphaMode.toUpperCase();\n  }\n\n  // Convert colors from [255,255,255,255] to [1,1,1,1]\n  if (pbrMaterial.emissiveFactor) {\n    pbrMaterial.emissiveFactor = convertColorFormat(pbrMaterial.emissiveFactor);\n  }\n  if (pbrMaterial.pbrMetallicRoughness && pbrMaterial.pbrMetallicRoughness.baseColorFactor) {\n    pbrMaterial.pbrMetallicRoughness.baseColorFactor = convertColorFormat(\n      pbrMaterial.pbrMetallicRoughness.baseColorFactor\n    );\n  }\n\n  if (texture) {\n    setMaterialTexture(pbrMaterial, texture);\n  }\n\n  return pbrMaterial;\n}\n\n/**\n * Convert color from [255,255,255,255] to [1,1,1,1]\n * @param colorFactor - color array\n * @returns - new color array\n */\nfunction convertColorFormat(colorFactor: number[]): number[] {\n  const normalizedColor = [...colorFactor];\n  for (let index = 0; index < colorFactor.length; index++) {\n    normalizedColor[index] = colorFactor[index] / 255;\n  }\n  return normalizedColor;\n}\n\n/**\n * Set texture in PBR material\n * @param {object} material - i3s material definition\n * @param image - texture image\n * @returns\n */\nfunction setMaterialTexture(material, image: TileContentTexture): void {\n  const texture = {source: {image}};\n  // I3SLoader now support loading only one texture. This elseif sequence will assign this texture to one of\n  // properties defined in materialDefinition\n  if (material.pbrMetallicRoughness && material.pbrMetallicRoughness.baseColorTexture) {\n    material.pbrMetallicRoughness.baseColorTexture = {\n      ...material.pbrMetallicRoughness.baseColorTexture,\n      texture\n    };\n  } else if (material.emissiveTexture) {\n    material.emissiveTexture = {...material.emissiveTexture, texture};\n  } else if (\n    material.pbrMetallicRoughness &&\n    material.pbrMetallicRoughness.metallicRoughnessTexture\n  ) {\n    material.pbrMetallicRoughness.metallicRoughnessTexture = {\n      ...material.pbrMetallicRoughness.metallicRoughnessTexture,\n      texture\n    };\n  } else if (material.normalTexture) {\n    material.normalTexture = {...material.normalTexture, texture};\n  } else if (material.occlusionTexture) {\n    material.occlusionTexture = {...material.occlusionTexture, texture};\n  }\n}\n\n/**\n * Flatten feature ids using face ranges\n * @param normalizedFeatureAttributes\n * @returns\n */\nfunction flattenFeatureIdsByFaceRanges(normalizedFeatureAttributes: I3SMeshAttributes): void {\n  const {id, faceRange} = normalizedFeatureAttributes;\n\n  if (!id || !faceRange) {\n    return;\n  }\n\n  const featureIds = id.value;\n  const range = faceRange.value;\n  const featureIdsLength = range[range.length - 1] + 1;\n  const orderedFeatureIndices = new Uint32Array(featureIdsLength * 3);\n\n  let featureIndex = 0;\n  let startIndex = 0;\n\n  for (let index = 1; index < range.length; index += 2) {\n    const fillId = Number(featureIds[featureIndex]);\n    const endValue = range[index];\n    const prevValue = range[index - 1];\n    const trianglesCount = endValue - prevValue + 1;\n    const endIndex = startIndex + trianglesCount * 3;\n\n    orderedFeatureIndices.fill(fillId, startIndex, endIndex);\n\n    featureIndex++;\n    startIndex = endIndex;\n  }\n\n  normalizedFeatureAttributes.id.value = orderedFeatureIndices;\n}\n\n/**\n * Flatten feature ids using featureIndices\n * @param attributes\n * @param featureIds\n * @returns\n */\nfunction flattenFeatureIdsByFeatureIndices(\n  attributes: I3SMeshAttributes,\n  featureIds: Int32Array\n): void {\n  const featureIndices = attributes.id.value;\n  const result = new Float32Array(featureIndices.length);\n\n  for (let index = 0; index < featureIndices.length; index++) {\n    result[index] = featureIds[featureIndices[index]];\n  }\n\n  attributes.id.value = result;\n}\n\n/**\n * Flatten feature ids using featureIndices\n * @param featureIndex\n * @returns\n */\nfunction getFeatureIdsFromFeatureIndexMetadata(\n  featureIndex: I3SMeshAttribute\n): Int32Array | undefined {\n  return featureIndex?.metadata?.['i3s-feature-ids']?.intArray;\n}\n", "import type {Matrix4, Quaternion, Vector3} from '@math.gl/core';\nimport type {TypedArray, MeshAttribute, TextureLevel} from '@loaders.gl/schema';\nimport {TILESET_TYPE, TILE_REFINEMENT, TILE_TYPE, Tile3D, Tileset3D} from '@loaders.gl/tiles';\nimport I3SNodePagesTiles from './lib/helpers/i3s-nodepages-tiles';\nimport {LoaderWithParser} from '@loaders.gl/loader-utils';\n\nexport type COLOR = [number, number, number, number];\n\n/**\n * Extension of SceneLayer3D JSON with postprocessed loader data\n */\nexport interface I3STilesetHeader extends SceneLayer3D {\n  /** Not in spec, but is necessary for woking */\n  url?: string;\n  /** Base path that non-absolute paths in tileset are relative to. */\n  basePath?: string;\n  /** root node metadata */\n  root: I3STileHeader;\n  /** instance of the NodePages to tiles loader */\n  nodePagesTile?: I3SNodePagesTiles;\n  /** Type of the tileset */\n  type: TILESET_TYPE.I3S;\n  /** LOD metric type per I3S spec*/\n  lodMetricType?: string;\n  /** LOD metric value */\n  lodMetricValue?: number;\n  /** Loader that has to be used to load content */\n  loader: LoaderWithParser;\n}\n/** https://github.com/Esri/i3s-spec/blob/master/docs/1.8/nodePage.cmn.md */\nexport type NodePage = {\n  /** Array of nodes. */\n  nodes: NodeInPage[];\n};\n/**\n * Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/mesh.cmn.md\n */\ntype NodeMesh = {\n  /**\n   * The material definition.\n   */\n  material: MeshMaterial;\n  /** The geometry definition. */\n  geometry: MeshGeometry;\n  /** The attribute set definition. */\n  attribute: meshAttribute;\n};\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/meshMaterial.cmn.md */\nexport type MeshMaterial = {\n  /** The index in layer.materialDefinitions array. */\n  definition: number;\n  /** Resource id for the material textures. i.e: layers/0/nodes/{material.resource}/textures/{tex_name}. Is required if material declares any textures. */\n  resource?: number;\n  /** Estimated number of texel for the highest resolution base color texture. */\n  texelCountHint?: number;\n};\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/meshGeometry.cmn.md */\nexport type MeshGeometry = {\n  /** The index in layer.geometryDefinitions array */\n  definition: number;\n  /** The resource locator to be used to query geometry resources: layers/0/nodes/{this.resource}/geometries/{layer.geometryDefinitions[this.definition].geometryBuffers[0 or 1]}. */\n  resource: number;\n  /** Number of vertices in the geometry buffer of this mesh for the umcompressed mesh buffer. Please note that Draco compressed meshes may have less vertices due to de-duplication (actual number of vertices is part of the Draco binary blob). Default=0 */\n  vertexCount?: number;\n  /** Number of features for this mesh. Default=0. (Must omit or set to 0 if mesh doesn't use features.) */\n  featureCount?: number;\n};\n/** https://github.com/Esri/i3s-spec/blob/master/docs/1.8/meshAttribute.cmn.md */\ntype meshAttribute = {\n  /** The resource identifier to be used to locate attribute resources of this mesh. i.e. layers/0/nodes/<resource id>/attributes/... */\n  resource: number;\n};\n\n/**\n * Texture format\n * @see https://github.com/Esri/i3s-spec/blob/master/docs/1.7/textureSetDefinitionFormat.cmn.md\n */\nexport type I3STextureFormat = 'jpg' | 'png' | 'ktx-etc2' | 'dds' | 'ktx2';\n\n/** Postprocessed I3S Node */\nexport type I3STileHeader = I3SMinimalNodeData & {\n  /** MBS per I3S spec */\n  mbs: Mbs;\n  /** Material definition from the layer metadata per I3S spec */\n  materialDefinition?: I3SMaterialDefinition;\n  /** Bounding volume converted to 3DTiles format. It is generic for `tile` module */\n  boundingVolume: {box?: number[]; sphere?: number[]};\n  /** LOD metric selected for usage */\n  lodMetricType?: string;\n  /** LOD metric value */\n  lodMetricValue?: number;\n  /** Tile content type */\n  type: TILE_TYPE.MESH;\n  /** Tile refinement type. I3S supports only `REPLACE` */\n  refine: TILE_REFINEMENT.REPLACE;\n};\n\n/**\n * Minimal I3S node data is needed for loading\n * These data can come from 3DNodeIndexDocument (I3S spec) or from `I3SNodePagesTiles` instance\n * @see https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md\n */\nexport type I3SMinimalNodeData = {\n  /** Node ID */\n  id: string;\n  /** Node base path */\n  url?: string;\n  /** LOD selection metrics  */\n  lodSelection?: LodSelection[];\n  // OBB per I3S spec\n  obb?: Obb;\n  /** MBS per I3S spec */\n  mbs?: Mbs;\n  /** Geometry content URL */\n  contentUrl?: string;\n  /** Texture image URL */\n  textureUrl?: string;\n  /** Feature attributes URLs */\n  attributeUrls?: string[];\n  /** Material definition from I3S layer metadata */\n  materialDefinition?: I3SMaterialDefinition;\n  /** Texture format per I3S spec */\n  textureFormat: I3STextureFormat;\n  /** Loader options for texture loader. The loader might be `CompressedTextureLoader` for `dds`, BasisLoader for `ktx2` or ImageLoader for `jpg`and `png` */\n  textureLoaderOptions?: {[key: string]: any};\n  /** Child Nodes references  */\n  children: NodeReference[];\n  /** Is the node has Draco compressed geometry */\n  isDracoGeometry: boolean;\n};\n\nexport type I3SParseOptions = {\n  /** ArcGIS access token */\n  token?: string;\n  /** Is 3DSceneLayer json expected in response */\n  isTileset?: string;\n  /** Is 3DNodeIndexDocument json expected in response */\n  isTileHeader?: string;\n  /** Tile3D instance. This property used only to load tile content */\n  /** Tile-specific options */\n  _tileOptions?: I3STileOptions;\n  /** Tileset-specific options */\n  _tilesetOptions?: I3STilesetOptions;\n  /** Load Draco Compressed geometry if available */\n  useDracoGeometry?: boolean;\n  /** Load compressed textures if available */\n  useCompressedTextures?: boolean;\n  /** Set false if don't need to parse textures */\n  decodeTextures?: boolean;\n  /** deck.gl compatible coordinate system.\n   * https://github.com/visgl/deck.gl/blob/master/docs/developer-guide/coordinate-systems.md\n   * Supported coordinate systems: METER_OFFSETS, LNGLAT_OFFSETS\n   */\n  coordinateSystem?: number;\n  /** Options to colorize 3DObjects by attribute value */\n  colorsByAttribute?: {\n    /** Feature attribute name */\n    attributeName: string;\n    /** Minimum attribute value */\n    minValue: number;\n    /** Maximum attribute value */\n    maxValue: number;\n    /** Minimum color. 3DObject will be colorized with gradient from `minColor to `maxColor` */\n    minColor: COLOR;\n    /** Maximum color. 3DObject will be colorized with gradient from `minColor to `maxColor` */\n    maxColor: COLOR;\n    /** Colorization mode. `replace` - replace vertex colors with a new colors, `multiply` - multiply vertex colors with new colors */\n    mode: 'multiply' | 'replace';\n  };\n\n  /** @deprecated */\n  tile?: Tile3D | I3STileOptions;\n  /** Tileset3D instance. This property used only to load tile content */\n  /** @deprecated */\n  tileset?: Tileset3D | I3STilesetOptions;\n};\n\nexport type I3STileOptions = {\n  isDracoGeometry: boolean;\n  textureUrl?: string;\n  textureFormat?: I3STextureFormat;\n  textureLoaderOptions?: any;\n  materialDefinition?: I3SMaterialDefinition;\n  attributeUrls: string[];\n  mbs: Mbs;\n};\n\nexport type I3STilesetOptions = {\n  store: Store;\n  attributeStorageInfo: AttributeStorageInfo[];\n  fields: Field[];\n};\n\n// TODO Replace \"[key: string]: any\" with actual defenition\nexport type I3STileContent = {\n  attributes: I3SMeshAttributes;\n  indices: TypedArray | null;\n  featureIds: number[] | TypedArray;\n  vertexCount: number;\n  modelMatrix: Matrix4;\n  coordinateSystem: number;\n  byteLength: number;\n  texture: TileContentTexture;\n  [key: string]: any;\n};\n\nexport type TileContentTexture =\n  | ArrayBuffer\n  | {\n      compressed: boolean;\n      mipmaps: boolean;\n      width: number;\n      height: number;\n      data: TextureLevel[];\n    }\n  | null;\n\nexport type BoundingVolumes = {\n  mbs: Mbs;\n  obb: Obb;\n};\n\n/**\n * Oriented bounding box per I3S spec\n * @see https://github.com/Esri/i3s-spec/blob/master/docs/1.7/obb.cmn.md\n */\nexport type Obb = {\n  center: number[] | Vector3;\n  halfSize: number[] | Vector3;\n  quaternion: number[] | Quaternion;\n};\n\n/**\n * Minimum bounding sphere per I3S spec\n * @see https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md#properties\n */\nexport type Mbs = [number, number, number, number];\n\n/** SceneLayer3D based on I3S specification - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/3DSceneLayer.cmn.md */\nexport type SceneLayer3D = {\n  /** Unique numeric ID of the layer. */\n  id: number;\n  /** The relative URL to the 3DSceneLayerResource. Only present as part of the SceneServiceInfo resource. */\n  href?: string;\n  /** The user-visible layer type */\n  layerType: '3DObject' | 'IntegratedMesh';\n  /** The spatialReference of the layer including the vertical coordinate reference system (CRS). Well Known Text (WKT) for CRS is included to support custom CRS. */\n  spatialReference?: SpatialReference;\n  /** Enables consuming clients to quickly determine whether this layer is compatible (with respect to its horizontal and vertical coordinate system) with existing content. */\n  heightModelInfo?: HeightModelInfo;\n  /** The ID of the last update session in which any resource belonging to this layer has been updated. */\n  version: string;\n  /** The name of this layer. */\n  name?: string;\n  /** The time of the last update. */\n  serviceUpdateTimeStamp?: {lastUpdate: number};\n  /** The display alias to be used for this layer. */\n  alias?: string;\n  /** Description string for this layer. */\n  description?: string;\n  /** Copyright and usage information for the data in this layer. */\n  copyrightText?: string;\n  /** Capabilities supported by this layer. */\n  capabilities: string[];\n  /** ZFactor to define conversion factor for elevation unit. */\n  ZFactor?: number;\n  /** Indicates if any styling information represented as drawingInfo is captured as part of the binary mesh representation. */\n  cachedDrawingInfo?: CachedDrawingInfo;\n  /** An object containing drawing information. */\n  drawingInfo?: DrawingInfo;\n  /** An object containing elevation drawing information. If absent, any content of the scene layer is drawn at its z coordinate. */\n  elevationInfo?: ElevationInfo;\n  /** PopupInfo of the scene layer. */\n  popupInfo?: PopupInfo;\n  /** Indicates if client application will show the popup information. Default is FALSE. */\n  disablePopup: boolean;\n  /**\n   * The store object describes the exact physical storage of a layer and\n   * enables the client to detect when multiple layers are served from\n   * the same store.\n   */\n  store: Store;\n  /** A collection of objects that describe each attribute field regarding its field name, datatype, and a user friendly name {name,type,alias}. */\n  fields?: Field[];\n  /** Provides the schema and layout used for storing attribute content in binary format in I3S. */\n  attributeStorageInfo?: AttributeStorageInfo[];\n  /** Contains the statistical information for a layer. */\n  statisticsInfo?: StatisticsInfo[];\n  /** The paged-access index description. */\n  nodePages?: NodePageDefinition;\n  /** List of materials classes used in this layer. */\n  materialDefinitions?: I3SMaterialDefinition[];\n  /** Defines the set of textures that can be referenced by meshes. */\n  textureSetDefinitions?: TextureSetDefinition[];\n  /** Define the layouts of mesh geometry and its attributes */\n  geometryDefinitions?: GeometryDefinition[];\n  /** 3D extent. */\n  fullExtent?: FullExtent;\n};\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/cachedDrawingInfo.cmn.md */\nexport type CachedDrawingInfo = {\n  /** If true, the drawingInfo is captured as part of the binary scene layer representation. */\n  color: boolean;\n};\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/drawingInfo.cmn.md */\nexport type DrawingInfo = {\n  /** An object defining the symbology for the layer. See more information about supported renderer types in ArcGIS clients. */\n  renderer: any;\n  /** Scale symbols for the layer. */\n  scaleSymbols: boolean;\n};\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/elevationInfo.cmn.md */\nexport type ElevationInfo = {\n  mode: 'relativeToGround' | 'absoluteHeight' | 'onTheGround' | 'relativeToScene';\n  /** Offset is always added to the result of the above logic except for onTheGround where offset is ignored. */\n  offset: number;\n  /** A string value indicating the unit for the values in elevationInfo */\n  unit: string;\n};\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/statisticsInfo.cmn.md */\nexport type StatisticsInfo = {\n  /** Key indicating the resource of the statistics. */\n  key: string;\n  /** Name of the field of the statistical information. */\n  name: string;\n  /** The URL to the statistics information. */\n  href: string;\n};\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/nodePageDefinition.cmn.md */\nexport type NodePageDefinition = {\n  /** Number of nodes per page for this layer. Must be a power-of-two less than 4096 */\n  nodesPerPage: number;\n  /** Index of the root node. Default = 0. */\n  rootIndex?: number;\n  /** Defines the meaning of nodes[].lodThreshold for this layer. */\n  lodSelectionMetricType: 'maxScreenThresholdSQ';\n};\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/materialDefinitions.cmn.md */\nexport type I3SMaterialDefinition = {\n  /** A set of parameter values that are used to define the metallic-roughness material model from Physically-Based Rendering (PBR) methodology. When not specified, all the default values of pbrMetallicRoughness apply. */\n  pbrMetallicRoughness: I3SPbrMetallicRoughness;\n  /** The normal texture map. */\n  normalTexture?: I3SMaterialTexture;\n  /** The occlusion texture map. */\n  occlusionTexture?: I3SMaterialTexture;\n  /** The emissive texture map. */\n  emissiveTexture?: I3SMaterialTexture;\n  /** The emissive color of the material. */\n  emissiveFactor?: [number, number, number];\n  /** Defines the meaning of the alpha-channel/alpha-mask. */\n  alphaMode: 'opaque' | 'mask' | 'blend';\n  /** The alpha cutoff value of the material. */\n  alphaCutoff?: number;\n  /** Specifies whether the material is double sided. */\n  doubleSided?: boolean;\n  /** Winding order is counterclockwise. */\n  cullFace?: 'none' | 'front' | 'back';\n};\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/pbrMetallicRoughness.cmn.md */\nexport type I3SPbrMetallicRoughness = {\n  /** The material's base color factor. default=[1,1,1,1] */\n  baseColorFactor?: [number, number, number, number];\n  /** The base color texture. */\n  baseColorTexture?: I3SMaterialTexture;\n  /** the metalness of the material. default=1.0 */\n  metallicFactor: number;\n  /** the roughness of the material. default=1.0 */\n  roughnessFactor: number;\n  /** the metallic-roughness texture. */\n  metallicRoughnessTexture?: I3SMaterialTexture;\n};\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/materialTexture.cmn.md */\nexport type I3SMaterialTexture = {\n  /** The index in layer.textureSetDefinitions. */\n  textureSetDefinitionId: number;\n  /** The set index of texture's TEXCOORD attribute used for texture coordinate mapping. Default is 0. Deprecated. */\n  texCoord?: number;\n  /** The normal texture: scalar multiplier applied to each normal vector of the normal texture. For occlusion texture,scalar multiplier controlling the amount of occlusion applied. Default=1 */\n  factor?: number;\n};\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/attributeStorageInfo.cmn.md */\nexport type AttributeStorageInfo = {\n  key: string;\n  name: string;\n  header: {property: string; valueType: string}[];\n  ordering?: string[];\n  attributeValues?: AttributeValue;\n  attributeByteCounts?: AttributeValue;\n  objectIds?: AttributeValue;\n};\n\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/field.cmn.md */\nexport type Field = {\n  name: string;\n  type: ESRIField;\n  alias?: string;\n  domain?: Domain;\n};\n\nexport type ESRIField =\n  | 'esriFieldTypeDate'\n  | 'esriFieldTypeSingle'\n  | 'esriFieldTypeDouble'\n  | 'esriFieldTypeGUID'\n  | 'esriFieldTypeGlobalID'\n  | 'esriFieldTypeInteger'\n  | 'esriFieldTypeOID'\n  | 'esriFieldTypeSmallInteger'\n  | 'esriFieldTypeString';\n\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/popupInfo.cmn.md */\nexport type PopupInfo = {\n  title?: string;\n  description?: string;\n  expressionInfos?: any[];\n  fieldInfos?: FieldInfo[];\n  mediaInfos?: any[];\n  popupElements?: {text?: string; type?: string; fieldInfos?: FieldInfo[]}[];\n};\n\n/**\n * Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md\n */\nexport type Node3DIndexDocument = {\n  id: string;\n  version?: string;\n  level?: number;\n  mbs?: Mbs;\n  obb?: Obb;\n  lodSelection?: LodSelection[];\n  children?: NodeReference[];\n  neighbors?: NodeReference[];\n  parentNode?: NodeReference;\n  sharedResource?: Resource;\n  featureData?: Resource[];\n  geometryData?: Resource[];\n  textureData?: Resource[];\n  attributeData?: Resource[];\n  created?: string;\n  expires?: string;\n};\n\n/**\n * LOD selection metrics per I3S spec\n * @see https://github.com/Esri/i3s-spec/blob/master/docs/1.7/lodSelection.cmn.md\n */\nexport type LodSelection = {\n  /**  */\n  metricType?: string;\n  maxError: number;\n};\n\n/**\n * Node reference per I3S spec\n * @see https://github.com/Esri/i3s-spec/blob/master/docs/1.7/nodeReference.cmn.md\n */\nexport type NodeReference = {\n  /** Tree Key ID of the referenced node represented as string. */\n  id: string;\n  /** Version (store update session ID) of the referenced node. */\n  version?: string;\n  /** An array of four doubles, corresponding to x, y, z and radius of the minimum bounding sphere of a node. */\n  mbs?: Mbs;\n  /** Describes oriented bounding box. */\n  obb?: Obb;\n  /** Number of values per element. */\n  href?: string;\n  /** Number of features in the referenced node and its descendants, down to the leaf nodes. */\n  featureCount?: number;\n};\n\nexport type Resource = {\n  href: string;\n  layerContent?: string[];\n  featureRange?: number[];\n  multiTextureBundle?: string;\n  vertexElements?: number[];\n  faceElements?: number[];\n  nodePath?: string;\n};\n\nexport type MaxScreenThresholdSQ = {\n  maxError: number;\n};\n\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/node.cmn.md */\nexport type NodeInPage = {\n  /**\n   * The index in the node array. May be different than material, geometry and attribute resource id. See mesh for more information.\n   */\n  index: number;\n  /**\n   * The index of the parent node in the node array.\n   */\n  parentIndex?: number;\n  /**\n   * When to switch LoD. See https://github.com/Esri/i3s-spec/blob/master/docs/1.8/nodePageDefinition.cmn.md for more information.\n   */\n  lodThreshold?: number;\n  /**\n   * Oriented bounding box for this node.\n   */\n  obb: Obb;\n  /**\n   * index of the children nodes indices.\n   */\n  children?: number[];\n  /**\n   * The mesh for this node. WARNING: only SINGLE mesh is supported at version 1.7 (i.e. length must be 0 or 1).\n   */\n  mesh?: NodeMesh;\n};\n\n/**\n * https://github.com/Esri/i3s-spec/blob/master/docs/1.8/materialDefinitionInfo.cmn.md\n */\nexport type MaterialDefinitionInfo = {\n  /** A name for the material as assigned in the creating application. */\n  name?: string;\n  /** Indicates the material type, chosen from the supported values. */\n  type?: 'standard' | 'water' | 'billboard' | 'leafcard' | 'reference';\n  /** The href that resolves to the shared resource bundle in which the material definition is contained. */\n  $ref?: string;\n  /** Parameter defined for the material.\n   * https://github.com/Esri/i3s-spec/blob/master/docs/1.8/materialParams.cmn.md\n   */\n  params: {\n    /** Indicates transparency of this material; 0 = opaque, 1 = fully transparent. */\n    transparency?: number;\n    /** Indicates reflectivity of this material. */\n    reflectivity?: number;\n    /** Indicates shininess of this material. */\n    shininess?: number;\n    /** Ambient color of this material. Ambient color is the color of an object where it is in shadow.\n     * This color is what the object reflects when illuminated by ambient light rather than direct light. */\n    ambient?: number[];\n    /** Diffuse color of this material. Diffuse color is the most instinctive meaning of the color of an object.\n     * It is that essential color that the object reveals under pure white light. It is perceived as the color\n     * of the object itself rather than a reflection of the light. */\n    diffuse?: number[];\n    /** Specular color of this material. Specular color is the color of the light of a specular reflection\n     * (specular reflection is the type of reflection that is characteristic of light reflected from a shiny\n     * surface). */\n    specular?: number[];\n    /** Rendering mode. */\n    renderMode: 'textured' | 'solid' | 'untextured' | 'wireframe';\n    /** TRUE if features with this material should cast shadows. */\n    castShadows?: boolean;\n    /** TRUE if features with this material should receive shadows */\n    receiveShadows?: boolean;\n    /** Indicates the material culling options {back, front, none}. */\n    cullFace?: string;\n    /** This flag indicates that the vertex color attribute of the geometry should be used to color the geometry\n     * for rendering. If texture is present, the vertex colors are multiplied by this color.\n     * e.g. pixel_color = [interpolated]vertex_color * texel_color. Default is false. */\n    vertexColors?: boolean;\n    /** This flag indicates that the geometry has uv region vertex attributes. These are used for adressing\n     * subtextures in a texture atlas. The uv coordinates are relative to this subtexture in this case.\n     * This is mostly useful for repeated textures in a texture atlas. Default is false. */\n    vertexRegions?: boolean;\n    /** Indicates whether Vertex Colors also contain a transparency channel. Default is false. */\n    useVertexColorAlpha?: boolean;\n  };\n};\n\n/** https://github.com/Esri/i3s-spec/blob/master/docs/1.8/sharedResource.cmn.md */\nexport type SharedResources = {\n  /** Materials describe how a Feature or a set of Features is to be rendered. */\n  materialDefinitions?: {[key: string]: MaterialDefinitionInfo};\n  /** A Texture is a set of images, with some parameters specific to the texture/uv mapping to geometries. */\n  textureDefinitions?: {[key: string]: TextureDefinitionInfo};\n};\n\n/** https://github.com/Esri/i3s-spec/blob/master/docs/1.8/image.cmn.md */\ntype TextureImage = {\n  /** A unique ID for each image. Generated using the BuildID function. */\n  id: string;\n  /** width of this image, in pixels. */\n  size?: number;\n  /** The maximum size of a single pixel in world units.\n   * This property is used by the client to pick the image to load and render. */\n  pixelInWorldUnits?: number;\n  /** The href to the image(s), one per encoding, in the same order as the encodings. */\n  href?: string[];\n  /** The byte offset of this image's encodings. There is one per encoding,\n   * in the same order as the encodings, in the block in which this texture image resides. */\n  byteOffset?: string[];\n  /** The length in bytes of this image's encodings. There is one per encoding,\n   * in the same order as the encodings. */\n  length?: number[];\n};\n\nexport type Attribute = 'OBJECTID' | 'string' | 'double' | 'Int32' | string;\n\nexport type Extent = [number, number, number, number];\n\nexport type FeatureAttribute = {\n  id: AttributeValue;\n  faceRange: AttributeValue;\n};\n\nexport type BuildingSceneLayerTileset = {\n  header: BuildingSceneLayer;\n  sublayers: BuildingSceneSublayer[];\n};\n\nexport type BuildingSceneLayer = {\n  id: number;\n  name: string;\n  version: string;\n  alias?: string;\n  layerType: 'Building';\n  description?: string;\n  copyrightText?: string;\n  fullExtent: FullExtent;\n  spatialReference: SpatialReference;\n  heightModelInfo?: HeightModelInfo;\n  sublayers: BuildingSceneSublayer[];\n  filters?: Filter[];\n  activeFilterID?: string;\n  statisticsHRef?: string;\n};\n\nexport type BuildingSceneSublayer = {\n  id: number;\n  name: string;\n  alias?: string;\n  discipline?: 'Mechanical' | 'Architectural' | 'Piping' | 'Electrical' | 'Structural';\n  modelName?: string;\n  layerType: 'group' | '3DObject' | 'Point';\n  visibility?: boolean;\n  sublayers?: BuildingSceneSublayer[];\n  isEmpty?: boolean;\n  url?: string;\n};\n\ntype Filter = {\n  id: string;\n  name: string;\n  description: string;\n  isDefaultFilter?: boolean;\n  isVisible?: boolean;\n  filterBlocks: FilterBlock[];\n  filterAuthoringInfo?: FilterAuthoringInfo;\n};\n\ntype FilterAuthoringInfo = {\n  type: string;\n  filterBlocks: FilterBlockAuthoringInfo[];\n};\n\ntype FilterBlockAuthoringInfo = {\n  filterTypes: FilterType[];\n};\n\ntype FilterType = {\n  filterType: string;\n  filterValues: string[];\n};\n\ntype FilterBlock = {\n  title: string;\n  filterMode: FilterModeSolid | FilterModeWireFrame;\n  filterExpression: string;\n};\n\ntype Edges = {\n  type: string;\n  color: number[];\n  size: number;\n  transparency: number;\n  extensionLength: number;\n};\n\ntype FilterModeSolid = {\n  type: 'solid';\n};\n\ntype FilterModeWireFrame = {\n  type: 'wireFrame';\n  edges: Edges;\n};\n\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/spatialReference.cmn.md */\nexport type SpatialReference = {\n  /** The current WKID value of the vertical coordinate system. */\n  latestVcsWkid: number;\n  /** dentifies the current WKID value associated with the same spatial reference. */\n  latestWkid: number;\n  /** The WKID value of the vertical coordinate system. */\n  vcsWkid: number;\n  /** WKID, or Well-Known ID, of the CRS. Specify either WKID or WKT of the CRS. */\n  wkid: number;\n  /** WKT, or Well-Known Text, of the CRS. Specify either WKT or WKID of the CRS but not both. */\n  wkt?: string;\n};\n\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/fullExtent.cmn.md */\nexport type FullExtent = {\n  /** left longitude in decimal degrees */\n  xmin: number;\n  /** right longitude in decimal degrees */\n  xmax: number;\n  /** bottom latitude in decimal degrees*/\n  ymin: number;\n  /** top latitude in decimal degrees*/\n  ymax: number;\n  /** lowest elevation in meters */\n  zmin: number;\n  /** highest elevation in meters */\n  zmax: number;\n  spatialReference?: SpatialReference;\n};\n\n/**\n * https://github.com/Esri/i3s-spec/blob/master/docs/1.8/textureDefinitionInfo.cmn.md\n */\nexport type TextureDefinitionInfo = {\n  /** MIMEtype - The encoding/content type that is used by all images in this map */\n  encoding?: string[];\n  /** UV wrapping modes, from {none, repeat, mirror}. */\n  wrap?: string[];\n  /** TRUE if the Map represents a texture atlas. */\n  atlas?: boolean;\n  /** The name of the UV set to be used as texture coordinates. */\n  uvSet?: string;\n  /** Indicates channels description. */\n  channels?: 'rbg' | 'rgba' | string;\n  /** An image is a binary resource, containing a single raster that can be used to texture a feature or symbol. */\n  images: TextureImage[];\n};\n\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/domain.cmn.md */\ntype Domain = {\n  type: string;\n  name: string;\n  description?: string;\n  fieldType?: string;\n  range?: [number, number];\n  codedValues?: {name: string; code: string | number}[];\n  mergePolicy?: string;\n  splitPolicy?: string;\n};\n/**\n * spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/store.cmn.md\n */\ntype Store = {\n  id?: string | number;\n  profile: string;\n  version: number | string;\n  resourcePattern?: string[];\n  rootNode?: string;\n  extent?: number[];\n  indexCRS?: string;\n  vertexCRS?: string;\n  normalReferenceFrame?: string;\n  lodType?: string;\n  lodModel?: string;\n  defaultGeometrySchema: DefaultGeometrySchema;\n  nidEncoding?: string;\n  textureEncoding?: string[];\n  featureEncoding?: string;\n  geometryEncoding?: string;\n  attributeEncoding?: string;\n  indexingScheme?: string;\n};\n/**\n * Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/defaultGeometrySchema.cmn.md\n */\ntype DefaultGeometrySchema = {\n  geometryType?: 'triangles';\n  topology: 'PerAttributeArray' | 'Indexed';\n  header: HeaderAttribute[];\n  ordering: string[];\n  vertexAttributes: VertexAttribute;\n  faces?: VertexAttribute;\n  featureAttributeOrder: string[];\n  featureAttributes: FeatureAttribute;\n  // TODO Do we realy need this Property?\n  attributesOrder?: string[];\n};\n/**\n * spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/headerAttribute.cmn.md\n */\nexport type HeaderAttribute = {\n  property: HeaderAttributeProperty.vertexCount | HeaderAttributeProperty.featureCount | string;\n  type:\n    | 'UInt8'\n    | 'UInt16'\n    | 'UInt32'\n    | 'UInt64'\n    | 'Int16'\n    | 'Int32'\n    | 'Int64'\n    | 'Float32'\n    | 'Float64';\n};\nexport enum HeaderAttributeProperty {\n  vertexCount = 'vertexCount',\n  featureCount = 'featureCount'\n}\nexport type VertexAttribute = {\n  position: GeometryAttribute;\n  normal: GeometryAttribute;\n  uv0: GeometryAttribute;\n  color: GeometryAttribute;\n  region?: GeometryAttribute;\n};\nexport type GeometryAttribute = {\n  byteOffset?: number;\n  valueType: 'UInt8' | 'UInt16' | 'Int16' | 'Int32' | 'Int64' | 'Float32' | 'Float64';\n  valuesPerElement: number;\n};\nexport type I3SMeshAttributes = {\n  [key: string]: I3SMeshAttribute;\n};\nexport interface I3SMeshAttribute extends MeshAttribute {\n  type?: number;\n  metadata?: any;\n}\n/** https://github.com/Esri/i3s-spec/blob/master/docs/1.8/heightModelInfo.cmn.md */\ntype HeightModelInfo = {\n  heightModel: 'gravity_related_height' | 'ellipsoidal';\n  vertCRS: string;\n  heightUnit:\n    | 'meter'\n    | 'us-foot'\n    | 'foot'\n    | 'clarke-foot'\n    | 'clarke-yard'\n    | 'clarke-link'\n    | 'sears-yard'\n    | 'sears-foot'\n    | 'sears-chain'\n    | 'benoit-1895-b-chain'\n    | 'indian-yard'\n    | 'indian-1937-yard'\n    | 'gold-coast-foot'\n    | 'sears-1922-truncated-chain'\n    | 'us-inch'\n    | 'us-mile'\n    | 'us-yard'\n    | 'millimeter'\n    | 'decimeter'\n    | 'centimeter'\n    | 'kilometer';\n};\n\nexport type TextureSetDefinitionFormats = {name: string; format: I3STextureFormat}[];\n\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/textureSetDefinition.cmn.md */\ntype TextureSetDefinition = {\n  formats: TextureSetDefinitionFormats;\n  atlas?: boolean;\n};\n\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/geometryDefinition.cmn.md */\ntype GeometryDefinition = {\n  topology?: 'triangle';\n  geometryBuffers: GeometryBuffer[];\n};\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/geometryBuffer.cmn.md */\ntype GeometryBuffer = {\n  offset?: number;\n  position?: GeometryBufferItem;\n  normal?: GeometryBufferItem;\n  uv0?: GeometryBufferItem;\n  color?: GeometryBufferItem;\n  uvRegion?: GeometryBufferItem;\n  featureId?: GeometryBufferItem;\n  faceRange?: GeometryBufferItem;\n  compressedAttributes?: {encoding: string; attributes: string[]};\n};\n\ntype GeometryBufferItem = {type: string; component: number; encoding?: string; binding?: string};\n\ntype AttributeValue = {valueType: string; encoding?: string; valuesPerElement?: number};\n\nexport type FieldInfo = {\n  fieldName: string;\n  visible: boolean;\n  isEditable: boolean;\n  label: string;\n};\n\nexport type ArcGISWebSceneData = {\n  header: ArcGISWebScene;\n  layers: OperationalLayer[];\n  unsupportedLayers: OperationalLayer[];\n};\n\n/**\n * ArcGIS WebScene spec - https://developers.arcgis.com/web-scene-specification/objects/webscene/\n */\nexport type ArcGISWebScene = {\n  /**\n   * @todo add type.\n   * Spec - https://developers.arcgis.com/web-scene-specification/objects/applicationProperties/\n   * Configuration of application and UI elements.\n   */\n  applicationProperties?: any;\n  /**\n   * Operational layers contain business data which are used to make thematic scenes.\n   */\n  operationalLayers: OperationalLayer[];\n  /**\n   * Basemaps give the web scene a geographic context.\n   */\n  baseMap: BaseMap;\n  /**\n   * Ground defines the main surface of the web scene, based on elevation layers.\n   */\n  ground: Ground;\n  /**\n   * An object that defines the characteristics of the vertical coordinate system used by the web scene.\n   */\n  heightModelInfo: HeightModelInfo;\n  /**\n   * Root element in the web scene specifying a string value indicating the web scene version.\n   * Valid values: 1.8, 1.9, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.20, 1.21, 1.22, 1.23, 1.24, 1.25, 1.26, 1.27\n   */\n  version: string;\n  /**\n   * String value indicating the application which authored the webmap\n   */\n  authoringApp: string;\n  /**\n   * String value indicating the authoring App's version number.\n   */\n  authoringAppVersion: string;\n  /**\n   * A presentation consists of multiple slides, where each slide is a specific view into the web scene.\n   * Spec - https://developers.arcgis.com/web-scene-specification/objects/presentation/\n   * @todo Add presentation type.\n   */\n  presentation: ArcGISPresentation;\n  /**\n   * An object that provides information about the initial environment settings and viewpoint of the web scene.\n   */\n  initialState: InitialState;\n  /**\n   * An object used to specify the spatial reference of the given geometry.\n   */\n  spatialReference: SpatialReference;\n  viewingMode: 'global' | 'local';\n  /**\n   * @todo add type.\n   * Defines area to be clipped for display.\n   */\n  clippingArea?: any;\n  /**\n   * @todo add type.\n   * Spec - https://developers.arcgis.com/web-scene-specification/objects/mapFloorInfo/\n   * Contains floor-awareness information for the web scene.\n   */\n  mapFloorInfo?: any;\n  /**\n   * @todo add type.\n   * Spec - https://developers.arcgis.com/web-scene-specification/objects/mapRangeInfo/\n   * Map Range Information\n   */\n  mapRangeInfo?: any;\n  /**\n   * @todo add type.\n   * Spec - https://developers.arcgis.com/web-scene-specification/objects/table/\n   * An array of table objects.\n   */\n  tables?: any;\n  /**\n   * @todo add type.\n   * Spec - https://developers.arcgis.com/web-scene-specification/objects/transportationNetwork/\n   * Used to specify the transportation networks of the scene.\n   */\n  transportationNetworks?: any;\n  /**\n   * @todo add type.\n   * Spec - https://developers.arcgis.com/web-scene-specification/objects/widgets/\n   * The widgets object contains widgets that should be exposed to the user.\n   */\n  widgets?: any;\n};\n\n/**\n * Spec - https://developers.arcgis.com/javascript/latest/api-reference/esri-webscene-Presentation.html\n */\ntype ArcGISPresentation = {\n  slides: Slide[];\n};\n\n/**\n * A slide stores a snapshot of several pre-set properties of the WebScene and SceneView,\n * such as the basemap, viewpoint and visible layers.\n * Spec - https://developers.arcgis.com/javascript/latest/api-reference/esri-webscene-Slide.html\n */\ntype Slide = {\n  id: string;\n  title: {\n    text: string;\n  };\n  thumbnail: {\n    url: string;\n  };\n  description: {\n    text: string;\n  };\n  ground: {\n    transparency: number;\n  };\n  baseMap: ArcGISBaseMap;\n  visibleLayers: ArcGISVisibleLayer[];\n  viewpoint: ArcGISViewPoint;\n};\n\n/**\n * The basemap of the scene. Only the base and reference layers of the basemap are stored in a slide.\n * Spec - https://developers.arcgis.com/javascript/latest/api-reference/esri-Basemap.html\n */\ntype ArcGISBaseMap = {\n  id: string;\n  title: string;\n  baseMapLayers: ArcGISBaseMapLayer[];\n};\n\n/**\n * The visible layers of the scene.\n * Spec - https://developers.arcgis.com/javascript/latest/api-reference/esri-webscene-Slide.html#visibleLayers\n */\ntype ArcGISVisibleLayer = {\n  id: string;\n  sublayerIds: number[];\n};\n/**\n * The basemap of the scene.\n * Spec - https://developers.arcgis.com/javascript/latest/api-reference/esri-Basemap.html\n */\ntype ArcGISBaseMapLayer = {\n  id: string;\n  title: string;\n  url: string;\n  layerType: string;\n  visibility: boolean;\n};\n\n/**\n * The viewpoint of the slide. This acts like a bookmark, saving a predefined location or point of view from which to view the scene.\n * Spec - https://developers.arcgis.com/javascript/latest/api-reference/esri-Viewpoint.html\n */\ntype ArcGISViewPoint = {\n  scale: number;\n  rotation?: number;\n  /**\n   * Spec - https://developers.arcgis.com/web-scene-specification/objects/viewpoint/\n   */\n  targetGeometry: any;\n  camera: ArcGISCamera;\n};\n\n/**\n * The camera defines the position, tilt, and heading of the point from which the SceneView's visible extent is observed.\n * It is not associated with device hardware. This class only applies to 3D SceneViews.\n * Spec - https://developers.arcgis.com/javascript/latest/api-reference/esri-Camera.html\n */\nexport type ArcGISCamera = {\n  position: {\n    x: number;\n    y: number;\n    z: number;\n  };\n  spatialReference: {\n    wkid: number;\n    latestWkid: number;\n  };\n  heading: number;\n  tilt: number;\n};\n\n/**\n * Operational layers contain your data. Usually, a basemap sits beneath your operational layers to give them geographic context.\n * Spec- https://developers.arcgis.com/web-scene-specification/objects/operationalLayers/\n */\nexport type OperationalLayer = {\n  id: string;\n  opacity: number;\n  title: string;\n  url: string;\n  visibility: boolean;\n  itemId: string;\n  layerType: string;\n  LayerDefinition: LayerDefinition;\n  screenSizePerspective: boolean;\n  showLabels?: boolean;\n  disablePopup?: boolean;\n  showLegend?: boolean;\n  layers?: OperationalLayer[];\n};\n\ntype LayerDefinition = {\n  elevationInfo: ElevationInfo;\n  drawingInfo: DrawingInfo;\n};\n\ntype BaseMap = {\n  id: string;\n  title: string;\n  baseMapLayers: BaseMapLayer[];\n  elevationLayers: ElevationLayer[];\n};\n\ntype BaseMapLayer = {\n  id: string;\n  opacity: number;\n  title: string;\n  url: string;\n  visibility: boolean;\n  layerType: string;\n};\n\ntype ElevationLayer = {\n  id: string;\n  listMode: string;\n  title: string;\n  url: string;\n  visibility: boolean;\n  layerType: string;\n};\n\ntype Ground = {\n  layers: ElevationLayer[];\n  transparency: number;\n  navigationConstraint: NavigationConstraint;\n};\n\ntype NavigationConstraint = {\n  type: string;\n};\n\ntype InitialState = {\n  environment: Enviroment;\n  viewpoint: ViewPoint;\n};\n\ntype Enviroment = {\n  lighting: Lighting;\n  atmosphereEnabled?: string;\n  starsEnabled?: string;\n};\n\ntype Lighting = {\n  datetime?: number;\n  displayUTCOffset?: number;\n};\n\ntype ViewPoint = {\n  camera: Camera;\n};\n\ntype Camera = {\n  position: CameraPosition;\n  heading: number;\n  tilt: number;\n};\n\ntype CameraPosition = {\n  spatialReference: SpatialReference;\n  x: number;\n  y: number;\n  z: number;\n};\n\n/**\n * Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/statsInfo.cmn.md\n */\nexport type StatsInfo = {\n  /** Represents the count of the value. */\n  totalValuesCount?: number;\n  /** Minimum attribute value for the entire layer. */\n  min?: number;\n  /** Maximum attribute value for the entire layer. */\n  max?: number;\n  /** Count for the entire layer. */\n  count?: number;\n  /** Sum of the attribute values over the entire layer. */\n  sum?: number;\n  /** Representing average or mean value. For example, sum/count. */\n  avg?: number;\n  /** Representing the standard deviation. */\n  stddev?: number;\n  /**\tRepresenting variance. For example, stats.stddev *stats.stddev. */\n  variance?: number;\n  /** Represents the histogram. */\n  histogram?: Histogram;\n  /** An array of most frequently used values within the point cloud scene layer. */\n  mostFrequentValues?: ValueCount[];\n};\n\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/histogram.cmn.md */\nexport type Histogram = {\n  /** Minimum attribute value for the entire layer. */\n  minimum: number;\n  /** Maximum attribute value for the entire layer. Maximum array size for stats.histo.counts is 256. */\n  maximum: number;\n  /** Count for the entire layer. */\n  counts: number[];\n};\n\nexport type ValueCount = {\n  /** Type of the attribute values after decompression, if applicable. Please note that string is not supported for point cloud scene layer attributes. */\n  value: number | string;\n  /** Count of the number of values. May exceed 32 bits. */\n  count: number;\n};\n", "import {Node3DIndexDocument, SceneLayer3D} from '../../types';\n\n/**\n * Return URL seperated from search params\n * @param url - URL that might have search params\n * @returns url without search params\n */\nexport function getUrlWithoutParams(url: string): string {\n  let urlWithoutParams: string | null;\n\n  try {\n    const urlObj = new URL(url);\n    urlWithoutParams = `${urlObj.origin}${urlObj.pathname}`;\n\n    // On Windows `new URL(url)` makes `C:\\...` -> `null\\...`\n    if (urlWithoutParams.startsWith('null')) {\n      urlWithoutParams = null;\n    }\n  } catch (e) {\n    urlWithoutParams = null;\n  }\n  return urlWithoutParams || url;\n}\n\n/**\n * Generates url with token if it is exists.\n * @param url\n * @param token\n * @returns\n */\nexport function getUrlWithToken(url: string, token: string | null = null): string {\n  return token ? `${url}?token=${token}` : url;\n}\n\n/**\n * Generates attribute urls for tile.\n * @param tile\n * @returns list of attribute urls\n */\nexport function generateTileAttributeUrls(url: string, tile: Node3DIndexDocument): string[] {\n  const {attributeData = []} = tile;\n  const attributeUrls: string[] = [];\n\n  for (let index = 0; index < attributeData.length; index++) {\n    const attributeUrl = attributeData[index].href.replace('./', '');\n    attributeUrls.push(`${url}/${attributeUrl}`);\n  }\n\n  return attributeUrls;\n}\n\n/**\n * Generates attribute urls for tileset based on tileset and resource\n * @param tileset - tileset metadata\n * @param url - tileset base url\n * @param resource - resource id per I3S spec\n * @returns {Array}\n */\nexport function generateTilesetAttributeUrls(tileset: SceneLayer3D, url: string, resource: number) {\n  const attributeUrls: string[] = [];\n  const {attributeStorageInfo = []} = tileset;\n\n  for (let index = 0; index < attributeStorageInfo.length; index++) {\n    const fileName = attributeStorageInfo[index].key;\n    attributeUrls.push(`${url}/nodes/${resource}/attributes/${fileName}/0`);\n  }\n\n  return attributeUrls;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\n\nimport type {LoaderWithParser, LoaderContext} from '@loaders.gl/loader-utils';\nimport type {I3SLoaderOptions} from './i3s-loader';\nimport {parseI3STileContent} from './lib/parsers/parse-i3s-tile-content';\nimport {I3STileContent, I3STileOptions, I3STilesetOptions} from './types';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\n\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\n/**\n * Loader for I3S - Indexed 3D Scene Layer\n */\nexport const I3SContentLoader = {\n  dataType: null as unknown as I3STileContent | null,\n  batchType: null as never,\n\n  name: 'I3S Content (Indexed Scene Layers)',\n  id: 'i3s-content',\n  module: 'i3s',\n  worker: true,\n  version: VERSION,\n  mimeTypes: ['application/octet-stream'],\n  parse,\n  extensions: ['bin'],\n  options: {\n    'i3s-content': {}\n  }\n} as const satisfies LoaderWithParser<I3STileContent | null, never, I3SLoaderOptions>;\n\nasync function parse(data, options?: I3SLoaderOptions, context?: LoaderContext) {\n  const {tile, _tileOptions, tileset, _tilesetOptions} = options?.i3s || {};\n  const tileOptions = _tileOptions || tile;\n  const tilesetOptions = _tilesetOptions || tileset;\n  if (!tileOptions || !tilesetOptions) {\n    return null;\n  }\n  return await parseI3STileContent(\n    data,\n    tileOptions as I3STileOptions,\n    tilesetOptions as I3STilesetOptions,\n    options,\n    context\n  );\n}\n", "import {OrientedBoundingBox} from '@math.gl/culling';\nimport {Ellipsoid} from '@math.gl/geospatial';\nimport {load} from '@loaders.gl/core';\nimport {TILE_TYPE, TILE_REFINEMENT, TILESET_TYPE} from '@loaders.gl/tiles';\nimport I3SNodePagesTiles from '../helpers/i3s-nodepages-tiles';\nimport {generateTileAttributeUrls, getUrlWithToken, getUrlWithoutParams} from '../utils/url-utils';\nimport {\n  I3STilesetHeader,\n  I3STileHeader,\n  Mbs,\n  I3SMinimalNodeData,\n  Node3DIndexDocument,\n  SceneLayer3D,\n  I3SParseOptions\n} from '../../types';\nimport type {LoaderOptions, LoaderContext} from '@loaders.gl/loader-utils';\nimport { I3SLoader } from '../../i3s-loader';\n\nexport function normalizeTileData(tile : Node3DIndexDocument, context: LoaderContext): I3STileHeader {\n  const url: string = context.url || '';\n  let contentUrl: string | undefined;\n  if (tile.geometryData) {\n    contentUrl = `${url}/${tile.geometryData[0].href}`;\n  }\n\n  let textureUrl: string | undefined;\n  if (tile.textureData) {\n    textureUrl = `${url}/${tile.textureData[0].href}`;\n  }\n\n  let attributeUrls: string[] | undefined;\n  if (tile.attributeData) {\n    attributeUrls = generateTileAttributeUrls(url, tile);\n  }\n\n  const children = tile.children || [];\n\n  return normalizeTileNonUrlData({\n    ...tile,\n    children,\n    url,\n    contentUrl,\n    textureUrl,\n    textureFormat: 'jpg', // `jpg` format will cause `ImageLoader` usage that will be able to handle `png` as well\n    attributeUrls,\n    isDracoGeometry: false\n  });\n}\n\nexport function normalizeTileNonUrlData(tile : I3SMinimalNodeData): I3STileHeader {\n  const boundingVolume: {box?: number[]; sphere?: number[]} = {};\n  let mbs: Mbs = [0, 0, 0, 1];\n  if (tile.mbs) {\n    mbs = tile.mbs;\n    boundingVolume.sphere = [\n      ...Ellipsoid.WGS84.cartographicToCartesian(tile.mbs.slice(0, 3)), // cartesian center of sphere\n      tile.mbs[3] // radius of sphere\n    ] as Mbs;\n  } else if (tile.obb) {\n    boundingVolume.box = [\n      ...Ellipsoid.WGS84.cartographicToCartesian(tile.obb.center), // cartesian center of box\n      ...tile.obb.halfSize, // halfSize\n      ...tile.obb.quaternion // quaternion\n    ];\n    const obb = new OrientedBoundingBox().fromCenterHalfSizeQuaternion(\n      boundingVolume.box.slice(0, 3),\n      tile.obb.halfSize,\n      tile.obb.quaternion\n    );\n    const boundingSphere = obb.getBoundingSphere();\n    boundingVolume.sphere = [...boundingSphere.center , boundingSphere.radius] as Mbs;\n    mbs = [...tile.obb.center, boundingSphere.radius] as Mbs;\n  }\n\n  const lodMetricType = tile.lodSelection?.[0].metricType;\n  const lodMetricValue = tile.lodSelection?.[0].maxError;\n  const type = TILE_TYPE.MESH;\n  /**\n   * I3S specification supports only REPLACE\n   */\n  const refine = TILE_REFINEMENT.REPLACE;\n\n  return {...tile, mbs, boundingVolume, lodMetricType, lodMetricValue, type, refine};\n}\n\nexport async function normalizeTilesetData(tileset : SceneLayer3D, options : LoaderOptions, context: LoaderContext): Promise<I3STileHeader | I3STilesetHeader> {\n  const url = getUrlWithoutParams(context.url || '');\n  let nodePagesTile: I3SNodePagesTiles | undefined;\n  let root: I3STileHeader | I3STilesetHeader;\n  if (tileset.nodePages) {\n    nodePagesTile = new I3SNodePagesTiles(tileset, url, options);\n    root = await nodePagesTile.formTileFromNodePages(0);\n  } else {\n    const parseOptions =\n      (options.i3s && typeof options.i3s === 'object' ? options.i3s : {}) as I3SParseOptions;\n    const rootNodeUrl = getUrlWithToken(`${url}/nodes/root`, parseOptions.token);\n    // eslint-disable-next-line no-use-before-define\n    root = await load(rootNodeUrl, I3SLoader, {\n      ...options,\n      i3s: {\n        ...parseOptions,\n        loadContent: false,\n        isTileHeader: true,\n        isTileset: false\n      }\n    });\n  }\n\n  return {\n    ...tileset,\n    loader: I3SLoader,\n    url,\n    basePath: url,\n    type: TILESET_TYPE.I3S,\n    nodePagesTile,\n    // @ts-expect-error\n    root,\n    lodMetricType: root.lodMetricType,\n    lodMetricValue: root.lodMetricValue\n  }\n}\n", "import {load} from '@loaders.gl/core';\nimport {I3SNodePageLoader} from '../../i3s-node-page-loader';\nimport {normalizeTileNonUrlData} from '../parsers/parse-i3s';\nimport {getUrlWithToken, generateTilesetAttributeUrls} from '../utils/url-utils';\nimport type {LoaderOptions} from '@loaders.gl/loader-utils';\nimport {\n  LodSelection,\n  NodePage,\n  NodeInPage,\n  Obb,\n  MeshMaterial,\n  I3SMaterialDefinition,\n  I3STextureFormat,\n  MeshGeometry,\n  I3STileHeader,\n  SceneLayer3D\n} from '../../types';\n\nconst BROWSER_PREFIXES = ['', 'WEBKIT_', 'MOZ_'];\nconst WEBGL_EXTENSIONS: Record<string, string> = {\n  /* eslint-disable camelcase */\n  WEBGL_compressed_texture_s3tc: 'dxt',\n  WEBGL_compressed_texture_s3tc_srgb: 'dxt-srgb',\n  WEBGL_compressed_texture_etc1: 'etc1',\n  WEBGL_compressed_texture_etc: 'etc2',\n  WEBGL_compressed_texture_pvrtc: 'pvrtc',\n  WEBGL_compressed_texture_atc: 'atc',\n  WEBGL_compressed_texture_astc: 'astc',\n  EXT_texture_compression_rgtc: 'rgtc'\n  /* eslint-enable camelcase */\n};\n\n/**\n * class I3SNodePagesTiles - loads nodePages and form i3s tiles from them\n */\nexport default class I3SNodePagesTiles {\n  tileset: SceneLayer3D;\n  nodePages: NodePage[] = [];\n  pendingNodePages: {promise: Promise<NodePage>; status: 'Pending' | 'Done'}[] = [];\n  nodesPerPage: number;\n  options: LoaderOptions;\n  lodSelectionMetricType?: string;\n  textureDefinitionsSelectedFormats: ({format: I3STextureFormat; name: string} | null)[] = [];\n  nodesInNodePages: number;\n  url: string;\n  private textureLoaderOptions: {[key: string]: any} = {};\n\n  /**\n   * @constructs\n   * Create a I3SNodePagesTiles instance.\n   * @param tileset - i3s tileset header ('layers/0')\n   * @param url - tileset url\n   * @param options - i3s loader options\n   */\n  constructor(tileset: SceneLayer3D, url: string = '', options: LoaderOptions) {\n    this.tileset = {...tileset}; // spread the tileset to avoid circular reference\n    this.url = url;\n    this.nodesPerPage = tileset.nodePages?.nodesPerPage || 64;\n    this.lodSelectionMetricType = tileset.nodePages?.lodSelectionMetricType;\n    this.options = options;\n    this.nodesInNodePages = 0;\n\n    this.initSelectedFormatsForTextureDefinitions(tileset);\n  }\n\n  /**\n   * Loads some nodePage and return a particular node from it\n   * @param id - id of node through all node pages\n   */\n  async getNodeById(id: number): Promise<NodeInPage> {\n    const pageIndex = Math.floor(id / this.nodesPerPage);\n    if (!this.nodePages[pageIndex] && !this.pendingNodePages[pageIndex]) {\n      const nodePageUrl = getUrlWithToken(\n        `${this.url}/nodepages/${pageIndex}`,\n        // @ts-expect-error this.options is not properly typed\n        this.options.i3s?.token\n      );\n      this.pendingNodePages[pageIndex] = {\n        status: 'Pending',\n        promise: load(nodePageUrl, I3SNodePageLoader, this.options)\n      };\n      this.nodePages[pageIndex] = await this.pendingNodePages[pageIndex].promise;\n      this.nodesInNodePages += this.nodePages[pageIndex].nodes.length;\n      this.pendingNodePages[pageIndex].status = 'Done';\n    }\n    if (this.pendingNodePages[pageIndex].status === 'Pending') {\n      this.nodePages[pageIndex] = await this.pendingNodePages[pageIndex].promise;\n    }\n    const nodeIndex = id % this.nodesPerPage;\n    return this.nodePages[pageIndex].nodes[nodeIndex];\n  }\n\n  /**\n   * Forms tile header using node and tileset data\n   * @param id - id of node through all node pages\n   */\n  // eslint-disable-next-line complexity, max-statements\n  async formTileFromNodePages(id: number): Promise<I3STileHeader> {\n    const node: NodeInPage = await this.getNodeById(id);\n    const children: {id: string; obb: Obb}[] = [];\n    const childNodesPromises: Promise<NodeInPage>[] = [];\n    for (const child of node.children || []) {\n      childNodesPromises.push(this.getNodeById(child));\n    }\n\n    const childNodes = await Promise.all(childNodesPromises);\n    for (const childNode of childNodes) {\n      children.push({\n        id: childNode.index.toString(),\n        obb: childNode.obb\n      });\n    }\n\n    let contentUrl: string | undefined;\n    let textureUrl: string | undefined;\n    let materialDefinition: I3SMaterialDefinition | undefined;\n    let textureFormat: I3STextureFormat = 'jpg';\n    let attributeUrls: string[] = [];\n    let isDracoGeometry: boolean = false;\n\n    if (node && node.mesh) {\n      // Get geometry resource URL and type (compressed / non-compressed)\n      const {url, isDracoGeometry: isDracoGeometryResult} = (node.mesh.geometry &&\n        this.getContentUrl(node.mesh.geometry)) || {isDracoGeometry: false};\n      contentUrl = url;\n      isDracoGeometry = isDracoGeometryResult;\n\n      const {textureData, materialDefinition: nodeMaterialDefinition} =\n        this.getInformationFromMaterial(node.mesh.material);\n      materialDefinition = nodeMaterialDefinition;\n      textureFormat = textureData.format || textureFormat;\n      if (textureData.name) {\n        textureUrl = `${this.url}/nodes/${node.mesh.material.resource}/textures/${textureData.name}`;\n      }\n\n      if (this.tileset.attributeStorageInfo) {\n        attributeUrls = generateTilesetAttributeUrls(\n          this.tileset,\n          this.url,\n          node.mesh.attribute.resource\n        );\n      }\n    }\n\n    const lodSelection = this.getLodSelection(node);\n\n    return normalizeTileNonUrlData({\n      id: id.toString(),\n      lodSelection,\n      obb: node.obb,\n      contentUrl,\n      textureUrl,\n      attributeUrls,\n      materialDefinition,\n      textureFormat,\n      textureLoaderOptions: this.textureLoaderOptions,\n      children,\n      isDracoGeometry\n    });\n  }\n\n  /**\n   * Forms url and type of geometry resource by nodepage's data and `geometryDefinitions` in the tileset\n   * @param - data about the node's mesh from the nodepage\n   * @returns -\n   *   {string} url - url to the geometry resource\n   *   {boolean} isDracoGeometry - whether the geometry resource contain DRACO compressed geometry\n   */\n  private getContentUrl(meshGeometryData: MeshGeometry) {\n    let result: {url: string; isDracoGeometry: boolean} | null = null;\n    // @ts-ignore\n    const geometryDefinition = this.tileset.geometryDefinitions[meshGeometryData.definition];\n    let geometryIndex = -1;\n    // Try to find DRACO geometryDefinition of `useDracoGeometry` option is set\n    const i3sOptions = this.options.i3s as Record<string, any> | undefined;\n    if (i3sOptions && typeof i3sOptions === 'object' && i3sOptions.useDracoGeometry) {\n      geometryIndex = geometryDefinition.geometryBuffers.findIndex(\n        (buffer) => buffer.compressedAttributes && buffer.compressedAttributes.encoding === 'draco'\n      );\n    }\n    // If DRACO geometry is not applicable try to select non-compressed geometry\n    if (geometryIndex === -1) {\n      geometryIndex = geometryDefinition.geometryBuffers.findIndex(\n        (buffer) => !buffer.compressedAttributes\n      );\n    }\n    if (geometryIndex !== -1) {\n      const isDracoGeometry = Boolean(\n        geometryDefinition.geometryBuffers[geometryIndex].compressedAttributes\n      );\n      result = {\n        url: `${this.url}/nodes/${meshGeometryData.resource}/geometries/${geometryIndex}`,\n        isDracoGeometry\n      };\n    }\n    return result;\n  }\n\n  /**\n   * Forms 1.6 compatible LOD selection object from a nodepage's node data\n   * @param node - a node from nodepage\n   * @returns- Array of LodSelection\n   */\n  private getLodSelection(node: NodeInPage): LodSelection[] {\n    const lodSelection: LodSelection[] = [];\n    if (this.lodSelectionMetricType === 'maxScreenThresholdSQ') {\n      lodSelection.push({\n        metricType: 'maxScreenThreshold',\n        // @ts-ignore\n        maxError: Math.sqrt(node.lodThreshold / (Math.PI * 0.25))\n      });\n    }\n    lodSelection.push({\n      metricType: this.lodSelectionMetricType,\n      // @ts-ignore\n      maxError: node.lodThreshold\n    });\n    return lodSelection;\n  }\n\n  /**\n   * Returns information about texture and material from `materialDefinitions`\n   * @param material - material data from nodepage\n   * @returns - Couple {textureData, materialDefinition}\n   * {string} textureData.name - path name of the texture\n   * {string} textureData.format - format of the texture\n   * materialDefinition - PBR-like material definition from `materialDefinitions`\n   */\n  private getInformationFromMaterial(material: MeshMaterial) {\n    const informationFromMaterial: {\n      textureData: {name: string | null; format?: I3STextureFormat};\n      materialDefinition?: I3SMaterialDefinition;\n    } = {textureData: {name: null}};\n\n    if (material) {\n      const materialDefinition = this.tileset.materialDefinitions?.[material.definition];\n      if (materialDefinition) {\n        informationFromMaterial.materialDefinition = materialDefinition;\n        const textureSetDefinitionIndex =\n          materialDefinition?.pbrMetallicRoughness?.baseColorTexture?.textureSetDefinitionId;\n\n        if (typeof textureSetDefinitionIndex === 'number') {\n          informationFromMaterial.textureData =\n            this.textureDefinitionsSelectedFormats[textureSetDefinitionIndex] ||\n            informationFromMaterial.textureData;\n        }\n      }\n    }\n    return informationFromMaterial;\n  }\n\n  /**\n   * Sets preferable and supported format for each textureDefinition of the tileset\n   * @param tileset - I3S layer data\n   * @returns\n   */\n  private initSelectedFormatsForTextureDefinitions(tileset: SceneLayer3D): void {\n    this.textureDefinitionsSelectedFormats = [];\n    const possibleI3sFormats = this.getSupportedTextureFormats();\n    const textureSetDefinitions = tileset.textureSetDefinitions || [];\n    for (const textureSetDefinition of textureSetDefinitions) {\n      const formats = (textureSetDefinition && textureSetDefinition.formats) || [];\n      let selectedFormat: {name: string; format: I3STextureFormat} | null = null;\n      for (const i3sFormat of possibleI3sFormats) {\n        const format = formats.find((value) => value.format === i3sFormat);\n        if (format) {\n          selectedFormat = format;\n          break;\n        }\n      }\n      // For I3S 1.8 need to define basis target format to decode\n      if (selectedFormat && selectedFormat.format === 'ktx2') {\n        this.textureLoaderOptions.basis = {\n          containerFormat: 'ktx2',\n          module: 'encoder'\n        };\n      }\n\n      this.textureDefinitionsSelectedFormats.push(selectedFormat);\n    }\n  }\n\n  /**\n   * Returns the array of supported texture format\n   * @returns list of format strings\n   */\n  private getSupportedTextureFormats(): I3STextureFormat[] {\n    const formats: I3STextureFormat[] = [];\n    const i3sOptions = this.options.i3s as Record<string, any> | undefined;\n    if (!i3sOptions || i3sOptions.useCompressedTextures) {\n      // I3S 1.7 selection\n      const supportedCompressedFormats = getSupportedGPUTextureFormats();\n      // List of possible in i3s formats:\n      // https://github.com/Esri/i3s-spec/blob/master/docs/1.7/textureSetDefinitionFormat.cmn.md\n      if (supportedCompressedFormats.has('etc2')) {\n        formats.push('ktx-etc2');\n      }\n      if (supportedCompressedFormats.has('dxt')) {\n        formats.push('dds');\n      }\n\n      // I3S 1.8 selection\n      // ktx2 wraps basis texture which at the edge case can be decoded as uncompressed image\n      formats.push('ktx2');\n    }\n\n    formats.push('jpg');\n    formats.push('png');\n    return formats;\n  }\n}\n\nfunction getSupportedGPUTextureFormats(gl?: WebGLRenderingContext): Set<string> {\n  const formats = new Set<string>();\n  gl = gl || getWebGLContext() || undefined;\n\n  for (const prefix of BROWSER_PREFIXES) {\n    for (const extension in WEBGL_EXTENSIONS) {\n      if (gl && gl.getExtension(`${prefix}${extension}`)) {\n        formats.add(WEBGL_EXTENSIONS[extension]);\n      }\n    }\n  }\n\n  return formats;\n}\n\nfunction getWebGLContext() {\n  try {\n    const canvas = document.createElement('canvas');\n    return canvas.getContext('webgl');\n  } catch {\n    return null;\n  }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\n\nimport type {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport type {I3SLoaderOptions} from './i3s-loader';\nimport type {NodePage} from './types';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\n/**\n * Loader for I3S node pages\n */\nexport const I3SNodePageLoader = {\n  dataType: null as unknown as NodePage,\n  batchType: null as never,\n\n  name: 'I3S Node Page',\n  id: 'i3s-node-page',\n  module: 'i3s',\n  version: VERSION,\n  mimeTypes: ['application/json'],\n  parse: parseNodePage,\n  extensions: ['json'],\n  options: {\n    i3s: {}\n  }\n} as const satisfies LoaderWithParser<NodePage, never, I3SLoaderOptions>;\n\nasync function parseNodePage(data: ArrayBuffer, options?: LoaderOptions): Promise<NodePage> {\n  return JSON.parse(new TextDecoder().decode(data)) as NodePage;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\n\nimport type {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {DataViewReadableFile} from '@loaders.gl/zip';\nimport {parseSLPKArchive} from './lib/parsers/parse-slpk/parse-slpk';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\n/** options to load data from SLPK */\nexport type SLPKLoaderOptions = LoaderOptions & {\n  slpk?: {\n    /** path inside the slpk archive */\n    path?: string;\n    /** mode of the path */\n    pathMode?: 'http' | 'raw';\n  };\n};\n\n/**\n * Loader for SLPK - Scene Layer Package (Archive I3S format)\n * @todo - this reloads the entire archive for every tile, should be optimized\n * @todo - this should be updated to use `parseFile` and ReadableFile\n */\nexport const SLPKLoader = {\n  dataType: null as unknown as ArrayBuffer,\n  batchType: null as never,\n\n  name: 'I3S SLPK (Scene Layer Package)',\n  id: 'slpk',\n  module: 'i3s',\n  version: VERSION,\n  mimeTypes: ['application/octet-stream'],\n  extensions: ['slpk'],\n  options: {\n    slpk: {\n      path: '',\n      pathMode: undefined\n    }\n  },\n  parse: async (data: ArrayBuffer, options: SLPKLoaderOptions = {}): Promise<ArrayBuffer> => {\n    const archive = await parseSLPKArchive(new DataViewReadableFile(new DataView(data)));\n    return archive.getFile(options.slpk?.path ?? '', options.slpk?.pathMode);\n  }\n} as const satisfies LoaderWithParser<ArrayBuffer, never, SLPKLoaderOptions>;\n", "import type {ReadableFile} from '@loaders.gl/loader-utils';\nimport {\n  parseZipCDFileHeader,\n  CD_HEADER_SIGNATURE,\n  parseZipLocalFileHeader,\n  searchFromTheEnd,\n  parseHashTable,\n  makeHashTableFromZipHeaders,\n  readRange\n} from '@loaders.gl/zip';\nimport {SLPKArchive} from './slpk-archieve';\n\n/**\n * Creates slpk file handler from raw file\n * @param fileProvider raw readable file data\n * @param cb is called with information message during parsing\n * @returns slpk file handler\n */\nexport async function parseSLPKArchive(\n  fileProvider: ReadableFile,\n  cb?: (msg: string) => void,\n  fileName?: string\n): Promise<SLPKArchive> {\n  const hashCDOffset = await searchFromTheEnd(fileProvider, CD_HEADER_SIGNATURE);\n\n  const cdFileHeader = await parseZipCDFileHeader(hashCDOffset, fileProvider);\n\n  let hashTable: Record<string, bigint>;\n  if (cdFileHeader?.fileName !== '@specialIndexFileHASH128@') {\n    hashTable = await makeHashTableFromZipHeaders(fileProvider);\n    cb?.(\n      'SLPK doesnt contain hash file, hash info has been composed according to zip archive headers'\n    );\n  } else {\n    // cb?.('SLPK contains hash file');\n    const localFileHeader = await parseZipLocalFileHeader(\n      cdFileHeader.localHeaderOffset,\n      fileProvider\n    );\n    if (!localFileHeader) {\n      throw new Error('corrupted SLPK');\n    }\n\n    const fileDataOffset = localFileHeader.fileDataOffset;\n    const hashFile = await readRange(\n      fileProvider,\n      fileDataOffset,\n      fileDataOffset + localFileHeader.compressedSize\n    );\n\n    hashTable = parseHashTable(hashFile);\n  }\n\n  return new SLPKArchive(fileProvider, hashTable, fileName);\n}\n", "import {MD5Hash} from '@loaders.gl/crypto';\nimport type {ReadableFile} from '@loaders.gl/loader-utils';\nimport {IndexedArchive, parseZipLocalFileHeader, readRange} from '@loaders.gl/zip';\nimport {GZipCompression} from '@loaders.gl/compression';\n\n/** Description of real paths for different file types */\nconst PATH_DESCRIPTIONS: {test: RegExp; extensions: string[]}[] = [\n  {\n    test: /^$/,\n    extensions: ['3dSceneLayer.json.gz']\n  },\n  {\n    test: /nodepages\\/\\d+$/,\n    extensions: ['.json.gz']\n  },\n  {\n    test: /sublayers\\/\\d+$/,\n    extensions: ['/3dSceneLayer.json.gz']\n  },\n  {\n    test: /nodes\\/(\\d+|root)$/,\n    extensions: ['/3dNodeIndexDocument.json.gz']\n  },\n  {\n    test: /nodes\\/\\d+\\/textures\\/.+$/,\n    extensions: ['.jpg', '.png', '.bin.dds.gz', '.ktx', '.ktx2']\n  },\n  {\n    test: /nodes\\/\\d+\\/geometries\\/\\d+$/,\n    extensions: ['.bin.gz', '.draco.gz']\n  },\n  {\n    test: /nodes\\/\\d+\\/attributes\\/f_\\d+\\/\\d+$/,\n    extensions: ['.bin.gz']\n  },\n  {\n    test: /statistics\\/(f_\\d+\\/\\d+|summary)$/,\n    extensions: ['.json.gz']\n  },\n  {\n    test: /nodes\\/\\d+\\/shared$/,\n    extensions: ['/sharedResource.json.gz']\n  }\n];\n\n/**\n * Class for handling information about slpk file\n */\nexport class SLPKArchive extends IndexedArchive {\n  // Maps hex-encoded md5 filename hashes to bigint offsets into the archive\n  private hashTable?: Record<string, bigint>;\n\n  protected _textEncoder = new TextEncoder();\n  protected _textDecoder = new TextDecoder();\n  protected _md5Hash = new MD5Hash();\n\n  /**\n   * Constructor\n   * @param fileProvider - readable file handle for random access\n   * @param hashTable - pre-loaded hashTable. If presented, getFile will skip reading the hash file\n   * @param fileName - name of the archive. It is used to add to an URL of a loader context\n   */\n  constructor(fileProvider: ReadableFile, hashTable?: Record<string, bigint>, fileName?: string) {\n    super(fileProvider, hashTable, fileName);\n    this.hashTable = hashTable;\n  }\n\n  /**\n   * Returns file with the given path from slpk archive\n   * @param path - path inside the slpk\n   * @param mode - currently only raw mode supported\n   * @returns buffer with ready to use file\n   */\n  async getFile(path: string, mode: 'http' | 'raw' = 'raw'): Promise<ArrayBuffer> {\n    if (mode === 'http') {\n      const extensions = PATH_DESCRIPTIONS.find((val) => val.test.test(path))?.extensions;\n      if (extensions) {\n        let data: ArrayBuffer | undefined;\n        for (const ext of extensions) {\n          data = await this.getDataByPath(`${path}${ext}`);\n          if (data) {\n            break;\n          }\n        }\n        if (data) {\n          return data;\n        }\n      }\n    }\n    if (mode === 'raw') {\n      const decompressedFile = await this.getDataByPath(`${path}.gz`);\n      if (decompressedFile) {\n        return decompressedFile;\n      }\n      const fileWithoutCompression = await this.getFileBytes(path);\n      if (fileWithoutCompression) {\n        return fileWithoutCompression;\n      }\n    }\n\n    throw new Error(`No such file in the archive: ${path}`);\n  }\n\n  /**\n   * returning uncompressed data for paths that ends with .gz and raw data for all other paths\n   * @param path - path inside the archive\n   * @returns buffer with the file data\n   */\n  private async getDataByPath(path: string): Promise<ArrayBuffer | undefined> {\n    // sometimes paths are not in lower case when hash file is created,\n    // so first we're looking for lower case file name and then for original one\n    let data = await this.getFileBytes(path.toLocaleLowerCase());\n    if (!data) {\n      data = await this.getFileBytes(path);\n    }\n    if (!data) {\n      return undefined;\n    }\n    if (/\\.gz$/.test(path)) {\n      const compression = new GZipCompression();\n\n      const decompressedData = await compression.decompress(data);\n      return decompressedData;\n    }\n    return data;\n  }\n\n  /**\n   * Trying to get raw file data by address\n   * @param path - path inside the archive\n   * @returns buffer with the raw file data\n   */\n  private async getFileBytes(path: string): Promise<ArrayBuffer | undefined> {\n    let compressedFile: ArrayBuffer | undefined;\n    if (this.hashTable) {\n      const binaryPath = this._textEncoder.encode(path);\n      const nameHash = await this._md5Hash.hash(binaryPath.buffer, 'hex');\n\n      const offset = this.hashTable[nameHash];\n      if (offset === undefined) {\n        return undefined;\n      }\n\n      const localFileHeader = await parseZipLocalFileHeader(offset, this.file);\n      if (!localFileHeader) {\n        return undefined;\n      }\n\n      compressedFile = await readRange(\n        this.file,\n        localFileHeader.fileDataOffset,\n        localFileHeader.fileDataOffset + localFileHeader.compressedSize\n      );\n    } else {\n      try {\n        compressedFile = await this.getFileWithoutHash(path);\n      } catch {\n        compressedFile = undefined;\n      }\n    }\n\n    return compressedFile;\n  }\n}\n", "import type {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {load} from '@loaders.gl/core';\nimport type {I3SLoaderOptions} from './i3s-loader';\nimport type {I3STileAttributes} from './lib/parsers/parse-i3s-attribute';\nimport {parseI3STileAttribute} from './lib/parsers/parse-i3s-attribute';\nimport {getUrlWithToken} from './lib/utils/url-utils';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\nconst EMPTY_VALUE = '';\nconst REJECTED_STATUS = 'rejected';\n\n/**\n * Loader for I3S attributes\n */\nexport const I3SAttributeLoader = {\n  dataType: null as unknown as I3STileAttributes,\n  batchType: null as never,\n  name: 'I3S Attribute',\n  id: 'i3s-attribute',\n  module: 'i3s',\n  version: VERSION,\n  mimeTypes: ['application/binary'],\n  parse: async (arrayBuffer: ArrayBuffer, options?: LoaderOptions) => parseI3STileAttribute(arrayBuffer, options),\n  extensions: ['bin'],\n  options: {},\n  binary: true\n} as const satisfies LoaderWithParser<I3STileAttributes, never, I3SLoaderOptions>;\n\n\n// TODO - these seem to use the loader rather than being part of the loader. Move to different file...\n\n/**\n * Load attributes based on feature id\n * @param {Object} tile\n * @param {number} featureId\n * @param {Object} options\n * @returns {Promise}\n */\n// eslint-disable-next-line complexity\nexport async function loadFeatureAttributes(tile, featureId, options = {}) {\n  const {attributeStorageInfo, attributeUrls, tilesetFields} = getAttributesData(tile);\n\n  if (!attributeStorageInfo || !attributeUrls || featureId < 0) {\n    return null;\n  }\n\n  let attributes: object[] = [];\n  const attributeLoadPromises: Promise<object>[] = [];\n\n  for (let index = 0; index < attributeStorageInfo.length; index++) {\n    // @ts-ignore\n    const url = getUrlWithToken(attributeUrls[index], options.i3s?.token);\n    const attributeName = attributeStorageInfo[index].name;\n    const attributeType = getAttributeValueType(attributeStorageInfo[index]);\n    const loadOptions = {...options, attributeName, attributeType};\n    const promise = load(url, I3SAttributeLoader, loadOptions);\n\n    attributeLoadPromises.push(promise);\n  }\n  try {\n    attributes = await Promise.allSettled(attributeLoadPromises);\n  } catch (error) {\n    // do nothing\n  }\n\n  if (!attributes.length) {\n    return null;\n  }\n\n  return generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields);\n}\n\n/**\n * Gets attributes data from tile.\n * @param tile \n * @returns \n */\nfunction getAttributesData(tile) {\n  const attributeStorageInfo = tile.tileset?.tileset?.attributeStorageInfo;\n  const attributeUrls = tile.header?.attributeUrls;\n  const tilesetFields = tile.tileset?.tileset?.fields || [];\n\n  return {attributeStorageInfo, attributeUrls, tilesetFields};\n}\n\n/**\n * Get attribute value type based on property names\n * @param {Object} attribute\n * @returns {String}\n */\nexport function getAttributeValueType(attribute) {\n  if (attribute.hasOwnProperty('objectIds')) {\n    return 'Oid32';\n  } else if (attribute.hasOwnProperty('attributeValues')) {\n    return attribute.attributeValues.valueType;\n  }\n  return '';\n}\n\n/**\n * Find in attributeStorageInfo attribute name responsible for feature ids list.\n * @param attributeStorageInfo \n * @returns Feature ids attribute name\n */\nfunction getFeatureIdsAttributeName(attributeStorageInfo) {\n  const objectIdsAttribute = attributeStorageInfo.find(attribute => attribute.name.includes('OBJECTID'));\n\n  return objectIdsAttribute?.name;\n}\n\n/**\n * Generates mapping featureId to feature attributes\n * @param {Array} attributes\n * @param {Object} attributeStorageInfo\n * @param {number} featureId\n * @returns {Object}\n */\nfunction generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields) {\n  const objectIdsAttributeName = getFeatureIdsAttributeName(attributeStorageInfo);\n  const objectIds = attributes.find((attribute) => attribute.value[objectIdsAttributeName]);\n\n  if (!objectIds) {\n    return null;\n  }\n\n  const attributeIndex = objectIds.value[objectIdsAttributeName].indexOf(featureId);\n\n  if (attributeIndex < 0) {\n    return null;\n  }\n\n  return getFeatureAttributesByIndex(attributes, attributeIndex, attributeStorageInfo, tilesetFields);\n}\n\n/**\n * Generates attribute object for feature mapping by feature id\n * @param {Array} attributes\n * @param {Number} featureIdIndex\n * @param {Object} attributeStorageInfo\n * @returns {Object}\n */\nfunction getFeatureAttributesByIndex(attributes, featureIdIndex, attributeStorageInfo, tilesetFields) {\n  const attributesObject = {};\n\n  for (let index = 0; index < attributeStorageInfo.length; index++) {\n    const attributeName = attributeStorageInfo[index].name;\n    const codedValues = getAttributeCodedValues(attributeName, tilesetFields);\n    const attribute = getAttributeByIndexAndAttributeName(attributes, index, attributeName);\n    attributesObject[attributeName] = formatAttributeValue(attribute, featureIdIndex, codedValues);\n  }\n\n  return attributesObject;\n}\n\n/**\n * Get coded values list from tileset.\n * @param attributeName \n * @param tilesetFields \n */\nfunction getAttributeCodedValues(attributeName, tilesetFields) {\n  const attributeField = tilesetFields\n    .find(field => field.name === attributeName || field.alias === attributeName);\n\n  return attributeField?.domain?.codedValues || [];\n}\n\n/**\n * Return attribute value if it presents in atrributes list\n * @param {array} attributes\n * @param {number} index\n * @param {string} attributesName\n */\nfunction getAttributeByIndexAndAttributeName(attributes, index, attributesName) {\n  const attributeObject = attributes[index];\n\n  if (attributeObject.status === REJECTED_STATUS) {\n    return null;\n  }\n\n  return attributeObject.value[attributesName];\n}\n\n/**\n * Do formatting of attribute values or return empty string.\n * @param {Array} attribute\n * @param {Number} featureIdIndex\n * @returns {String}\n */\nfunction formatAttributeValue(attribute, featureIdIndex, codedValues) {\n  let value = EMPTY_VALUE;\n\n  if (attribute && (featureIdIndex in attribute)) {\n    // eslint-disable-next-line no-control-regex\n    value = String(attribute[featureIdIndex]).replace(/\\u0000|NaN/g, '').trim();\n  }\n\n  // Check if coded values are existed. If so we use them.\n  if (codedValues.length) {\n    const codeValue = codedValues.find(codedValue => codedValue.code === Number(value));\n    value = codeValue?.name || EMPTY_VALUE;\n  }\n\n  return value;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {TypedArray} from '@loaders.gl/schema';\n\nimport {\n  STRING_ATTRIBUTE_TYPE,\n  OBJECT_ID_ATTRIBUTE_TYPE,\n  FLOAT_64_TYPE,\n  INT_16_ATTRIBUTE_TYPE\n} from './constants';\n\ntype Attribute = string[] | TypedArray | null;\nexport type I3STileAttributes = Record<string, Attribute>;\n\n/**\n * Get particular tile and creates attribute object inside.\n * @param  arrayBuffer\n * @param {Object} options\n * @returns {Promise<object>}\n */\nexport function parseI3STileAttribute(arrayBuffer: ArrayBuffer, options): I3STileAttributes {\n  const {attributeName, attributeType} = options;\n\n  if (!attributeName) {\n    return {};\n  }\n  return {\n    [attributeName]: attributeType ? parseAttribute(attributeType, arrayBuffer) : null\n  };\n}\n\n/**\n * Parse attributes based on attribute type.\n * @param {String} attributeType\n * @param  arrayBuffer\n * @returns\n */\nfunction parseAttribute(attributeType, arrayBuffer: ArrayBuffer): Attribute {\n  switch (attributeType) {\n    case STRING_ATTRIBUTE_TYPE:\n      return parseStringsAttribute(arrayBuffer);\n    case OBJECT_ID_ATTRIBUTE_TYPE:\n      return parseShortNumberAttribute(arrayBuffer);\n    case FLOAT_64_TYPE:\n      return parseFloatAttribute(arrayBuffer);\n    case INT_16_ATTRIBUTE_TYPE:\n      return parseInt16ShortNumberAttribute(arrayBuffer);\n    default:\n      return parseShortNumberAttribute(arrayBuffer);\n  }\n}\n\n/**\n * Parse short number attribute.\n * Short Integer spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.7/attributeStorageInfo.cmn.md\n * @param  arrayBuffer\n * @returns\n */\nfunction parseShortNumberAttribute(arrayBuffer: ArrayBuffer): Uint32Array {\n  const countOffset = 4;\n  return new Uint32Array(arrayBuffer, countOffset);\n}\n\n/**\n * Parse Int16 short number attribute.\n * Parsing of such data is not documented. Added to handle Building Scene Layer Tileset attributes data.\n * @param  arrayBuffer\n * @returns\n */\nfunction parseInt16ShortNumberAttribute(arrayBuffer: ArrayBuffer): Int16Array {\n  const countOffset = 4;\n  return new Int16Array(arrayBuffer, countOffset);\n}\n\n/**\n * Parse float attribute.\n * Double Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.7/attributeStorageInfo.cmn.md\n * @param  arrayBuffer\n * @returns\n */\nfunction parseFloatAttribute(arrayBuffer: ArrayBuffer): Float64Array {\n  const countOffset = 8;\n  return new Float64Array(arrayBuffer, countOffset);\n}\n\n/**\n * Parse string attribute.\n * String spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.7/attributeStorageInfo.cmn.md\n * @param arrayBuffer\n * @returns list of strings\n */\nfunction parseStringsAttribute(arrayBuffer: ArrayBuffer): string[] {\n  const stringsCountOffset = 0;\n  const dataOffset = 8;\n  const bytesPerStringSize = 4;\n  const stringsArray: string[] = [];\n\n  try {\n    // Use DataView to avoid multiple of 4 error on Uint32Array constructor\n    const stringsCount = new DataView(\n      arrayBuffer,\n      stringsCountOffset,\n      bytesPerStringSize\n    ).getUint32(stringsCountOffset, true);\n    const stringSizes = new Uint32Array(arrayBuffer, dataOffset, stringsCount);\n    let stringOffset = dataOffset + stringsCount * bytesPerStringSize;\n\n    for (const stringByteSize of stringSizes) {\n      const textDecoder = new TextDecoder('utf-8');\n      const stringAttribute = new Uint8Array(arrayBuffer, stringOffset, stringByteSize);\n      stringsArray.push(textDecoder.decode(stringAttribute));\n      stringOffset += stringByteSize;\n    }\n  } catch (error) {\n    console.error('Parse string attribute error: ', (error as Error).message); // eslint-disable-line\n  }\n\n  return stringsArray;\n}\n", "import type {BuildingSceneLayerTileset, BuildingSceneSublayer} from '../../types';\n\nconst OBJECT_3D_LAYER_TYPE = '3DObject';\n\n/**\n * Parses Builiding Scene Layer and creates tileset\n * @param data\n * @param options\n * @param context\n */\nexport async function parseBuildingSceneLayer(\n  data: ArrayBuffer,\n  url: string\n): Promise<BuildingSceneLayerTileset> {\n  const layer0 = JSON.parse(new TextDecoder().decode(data));\n  const {sublayers} = layer0;\n\n  return {\n    header: layer0,\n    sublayers: parseSublayersTree(sublayers, url)\n  };\n}\n\n/**\n * Recursively parses Building Scene Layer sublayers.\n * @param sublayers\n * @param url\n */\nfunction parseSublayersTree(\n  sublayers: BuildingSceneSublayer[],\n  url: string\n): BuildingSceneSublayer[] {\n  let layers: BuildingSceneSublayer[] = [];\n\n  for (let index = 0; index < sublayers.length; index++) {\n    const subLayer = sublayers[index];\n    const {id, layerType, visibility = true, ...rest} = subLayer;\n\n    // Add support only for 3DObject layer type for I3S purposes.\n    if (layerType === OBJECT_3D_LAYER_TYPE) {\n      const sublayerUrl = `${url}/sublayers/${id}`;\n\n      layers.push({\n        url: sublayerUrl,\n        id,\n        layerType,\n        visibility,\n        ...rest\n      });\n    }\n\n    if (subLayer?.sublayers?.length) {\n      layers = [...layers, ...parseSublayersTree(subLayer.sublayers, url)];\n    }\n  }\n\n  return layers;\n}\n", "import type {LoaderWithParser, LoaderOptions, LoaderContext} from '@loaders.gl/loader-utils';\nimport type {I3SLoaderOptions} from './i3s-loader';\nimport type {BuildingSceneLayerTileset} from './types';\n\nimport {parseBuildingSceneLayer} from './lib/parsers/parse-i3s-building-scene-layer';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\n\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\n/**\n * Loader for I3S - Building Scene Layer\n */\nexport const I3SBuildingSceneLayerLoader = {\n  dataType: null as unknown as BuildingSceneLayerTileset,\n  batchType: null as never,\n\n  name: 'I3S Building Scene Layer',\n  id: 'i3s-building-scene-layer',\n  module: 'i3s',\n  version: VERSION,\n  mimeTypes: ['application/json'],\n  parse,\n  extensions: ['json'],\n  options: {}\n} as const satisfies LoaderWithParser<BuildingSceneLayerTileset, never, I3SLoaderOptions>;\n\nasync function parse(\n  data: ArrayBuffer,\n  options?: LoaderOptions,\n  context?: LoaderContext\n): Promise<BuildingSceneLayerTileset> {\n  if (!context?.url) {\n    throw new Error('Url is not provided');\n  }\n\n  return parseBuildingSceneLayer(data, context.url);\n}\n", "import {JSONLoader, load} from '@loaders.gl/core';\nimport type {ArcGISWebSceneData, OperationalLayer} from '../../types';\n\n/**\n * WKID, or Well-Known ID, of the CRS. Specify either WKID or WKT of the CRS.\n * Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/spatialReference.cmn.md\n */\nconst SUPPORTED_WKID = 4326;\n\nconst ARCGIS_SCENE_SERVER_LAYER_TYPE = 'ArcGISSceneServiceLayer';\nconst BUILDING_SCENE_LAYER = 'BuildingSceneLayer';\nconst INTEGRATED_MESH_LAYER = 'IntegratedMeshLayer';\nconst GROUP_LAYER = 'GroupLayer';\n\n/**\n * Supported layers list\n * Possible operational layers in WebScene: https://developers.arcgis.com/web-scene-specification/objects/operationalLayers/\n */\nconst SUPPORTED_LAYERS_TYPES = [\n  ARCGIS_SCENE_SERVER_LAYER_TYPE,\n  INTEGRATED_MESH_LAYER,\n  BUILDING_SCENE_LAYER,\n  GROUP_LAYER\n];\n\nconst NO_AVAILABLE_SUPPORTED_LAYERS_ERROR = 'NO_AVAILABLE_SUPPORTED_LAYERS_ERROR';\nconst NOT_SUPPORTED_CRS_ERROR = 'NOT_SUPPORTED_CRS_ERROR';\n\n/**\n * Provides additional information in the exception Error object, e.g. unsupported layer types.\n * @param message - message used in the Error object\n * @param details - additional information that can be used to handle the exception.\n * @example throw new LayerError(NO_AVAILABLE_SUPPORTED_LAYERS_ERROR, unsupportedLayers);\n */\nexport class LayerError extends Error {\n  constructor(\n    message: string,\n    public details: unknown\n  ) {\n    super(message);\n    this.name = 'LayerError';\n  }\n}\n\n/**\n * Parses ArcGIS WebScene\n * @param data\n */\nexport async function parseWebscene(data: ArrayBuffer): Promise<ArcGISWebSceneData> {\n  const layer0 = JSON.parse(new TextDecoder().decode(data));\n  const {operationalLayers} = layer0;\n  const {layers, unsupportedLayers} = await parseOperationalLayers(operationalLayers, true);\n\n  if (!layers.length) {\n    throw new LayerError(NO_AVAILABLE_SUPPORTED_LAYERS_ERROR, unsupportedLayers);\n  }\n\n  return {\n    header: layer0,\n    layers,\n    unsupportedLayers\n  };\n}\n\n/**\n * Recursively parses WebScene operational layers.\n * @param layersList\n */\nasync function parseOperationalLayers(\n  layersList: OperationalLayer[],\n  needToCheckCRS: boolean\n): Promise<{layers: OperationalLayer[]; unsupportedLayers: OperationalLayer[]}> {\n  const layers: OperationalLayer[] = [];\n  let unsupportedLayers: OperationalLayer[] = [];\n\n  for (let index = 0; index < layersList.length; index++) {\n    const layer = layersList[index];\n    const isLayerSupported = SUPPORTED_LAYERS_TYPES.includes(layer.layerType);\n\n    if (isLayerSupported) {\n      if (needToCheckCRS && layer.layerType !== GROUP_LAYER) {\n        await checkSupportedIndexCRS(layer);\n        needToCheckCRS = false;\n      }\n\n      layers.push(layer);\n    } else {\n      unsupportedLayers.push(layer);\n    }\n\n    if (layer.layers?.length) {\n      const {layers: childLayers, unsupportedLayers: childUnsupportedLayers} =\n        await parseOperationalLayers(layer.layers, needToCheckCRS);\n      layer.layers = childLayers;\n      unsupportedLayers = [...unsupportedLayers, ...childUnsupportedLayers];\n    }\n  }\n\n  return {layers, unsupportedLayers};\n}\n\n/**\n * Check if layer has supported CRS\n * @param layer\n */\nasync function checkSupportedIndexCRS(layer: OperationalLayer) {\n  try {\n    const layerJson = await load(layer.url, JSONLoader);\n    // @ts-expect-error\n    const wkid = layerJson?.spatialReference?.wkid;\n\n    if (wkid !== SUPPORTED_WKID) {\n      throw new Error(NOT_SUPPORTED_CRS_ERROR);\n    }\n  } catch (error) {\n    throw error;\n  }\n}\n", "import type {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport type {ArcGISWebSceneData} from './types';\n\nimport {parseWebscene} from './lib/parsers/parse-arcgis-webscene';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type ArcGISWebSceneLoaderOptions = LoaderOptions & {};\n\n/**\n * Loader for ArcGIS WebScene\n * Spec - https://developers.arcgis.com/web-scene-specification/objects/webscene/\n */\nexport const ArcGISWebSceneLoader = {\n  dataType: null as unknown as ArcGISWebSceneData,\n  batchType: null as never,\n  name: 'ArcGIS Web Scene Loader',\n  id: 'arcgis-web-scene',\n  module: 'i3s',\n  version: VERSION,\n  mimeTypes: ['application/json'],\n  parse,\n  extensions: ['json'],\n  options: {}\n} as const satisfies LoaderWithParser<ArcGISWebSceneData, never, ArcGISWebSceneLoaderOptions>;\n\n/**\n * Parse ArcGIS webscene\n * @param data\n */\nasync function parse(data: ArrayBuffer): Promise<ArcGISWebSceneData> {\n  return parseWebscene(data);\n}\n", "import type {MeshAttribute, TypedArray} from '@loaders.gl/schema';\nimport type {AttributeStorageInfo, COLOR, Field} from '../../types';\n\nimport {load} from '@loaders.gl/core';\nimport {getAttributeValueType, I3SAttributeLoader} from '../../i3s-attribute-loader';\nimport {getUrlWithToken} from './url-utils';\nimport {I3STileAttributes} from '../parsers/parse-i3s-attribute';\n\ntype ColorsByAttribute = {\n  /** Feature attribute name */\n  attributeName: string;\n  /** Minimum attribute value */\n  minValue: number;\n  /** Maximum attribute value */\n  maxValue: number;\n  /** Minimum color. 3DObject will be colorized with gradient from `minColor to `maxColor` */\n  minColor: [number, number, number, number];\n  /** Maximum color. 3DObject will be colorized with gradient from `minColor to `maxColor` */\n  maxColor: [number, number, number, number];\n  /** Colorization mode. `replace` - replace vertex colors with a new colors, `multiply` - multiply vertex colors with new colors */\n  mode: string;\n};\n\n/**\n * Calculate new vertex colors array to visualize 3D objects in a attribute driven way\n * @param colors - vertex colors attribute\n * @param featureIds - feature Ids attribute\n * @param attributeUrls - array of attribute's urls\n * @param fields - array of attribute's fileds\n * @param attributeStorageInfo - array of attributeStorageInfo\n * @param colorsByAttribute - attribute color options\n * @param token - access token\n * @returns new colors attribute\n */\n// eslint-disable-next-line max-params\nexport async function customizeColors(\n  colors: MeshAttribute,\n  featureIds: number[] | TypedArray,\n  attributeUrls: string[],\n  fields: Field[],\n  attributeStorageInfo: AttributeStorageInfo[],\n  colorsByAttribute: ColorsByAttribute | null,\n  token?: string\n): Promise<MeshAttribute> {\n  if (!colorsByAttribute) {\n    return colors;\n  }\n\n  const resultColors = {\n    ...colors,\n    value: new Uint8Array(colors.value)\n  };\n\n  const colorizeAttributeField = fields.find(({name}) => name === colorsByAttribute?.attributeName);\n  if (\n    !colorizeAttributeField ||\n    !['esriFieldTypeDouble', 'esriFieldTypeInteger', 'esriFieldTypeSmallInteger'].includes(\n      colorizeAttributeField.type\n    )\n  ) {\n    return colors;\n  }\n\n  const colorizeAttributeData = await loadFeatureAttributeData(\n    colorizeAttributeField.name,\n    attributeUrls,\n    attributeStorageInfo,\n    token\n  );\n  if (!colorizeAttributeData) {\n    return colors;\n  }\n\n  const objectIdField = fields.find(({type}) => type === 'esriFieldTypeOID');\n  if (!objectIdField) {\n    return colors;\n  }\n\n  const objectIdAttributeData = await loadFeatureAttributeData(\n    objectIdField.name,\n    attributeUrls,\n    attributeStorageInfo,\n    token\n  );\n  if (!objectIdAttributeData) {\n    return colors;\n  }\n\n  const attributeValuesMap: {[key: number]: COLOR} = {};\n  // @ts-expect-error\n  for (let i = 0; i < objectIdAttributeData[objectIdField.name].length; i++) {\n    // @ts-expect-error\n    attributeValuesMap[objectIdAttributeData[objectIdField.name][i]] = calculateColorForAttribute(\n      // @ts-expect-error\n      colorizeAttributeData[colorizeAttributeField.name][i] as number,\n      colorsByAttribute\n    );\n  }\n\n  for (let i = 0; i < featureIds.length; i++) {\n    const color = attributeValuesMap[featureIds[i]];\n    if (!color) {\n      continue; // eslint-disable-line no-continue\n    }\n\n    /* eslint max-statements: [\"error\", 30] */\n    /* eslint complexity: [\"error\", 12] */\n    if (colorsByAttribute.mode === 'multiply') {\n      // multiplying original mesh and calculated for attribute rgba colors in range 0-255\n      color.forEach((colorItem, index) => {\n        resultColors.value[i * 4 + index] = (resultColors.value[i * 4 + index] * colorItem) / 255;\n      });\n    } else {\n      resultColors.value.set(color, i * 4);\n    }\n  }\n\n  return resultColors;\n}\n\n/**\n * Calculate rgba color from the attribute value\n * @param attributeValue - value of the attribute\n * @param colorsByAttribute - attribute color options\n * @returns - color array for a specific attribute value\n */\nfunction calculateColorForAttribute(\n  attributeValue: number,\n  colorsByAttribute: ColorsByAttribute\n): COLOR {\n  if (!colorsByAttribute) {\n    return [255, 255, 255, 255];\n  }\n  const {minValue, maxValue, minColor, maxColor} = colorsByAttribute;\n  const rate = (attributeValue - minValue) / (maxValue - minValue);\n  const color: COLOR = [255, 255, 255, 255];\n  for (let i = 0; i < minColor.length; i++) {\n    color[i] = Math.round((maxColor[i] - minColor[i]) * rate + minColor[i]);\n  }\n  return color;\n}\n\n/**\n * Load feature attribute data from the ArcGIS rest service\n * @param attributeName - attribute name\n * @param attributeUrls - array of attribute's urls\n * @param attributeStorageInfo - array of attributeStorageInfo\n * @param token - access token\n * @returns - Array-like list of the attribute values\n */\nasync function loadFeatureAttributeData(\n  attributeName: string,\n  attributeUrls: string[],\n  attributeStorageInfo: AttributeStorageInfo[],\n  token?: string\n): Promise<I3STileAttributes | null> {\n  const attributeIndex = attributeStorageInfo.findIndex(({name}) => attributeName === name);\n  if (attributeIndex === -1) {\n    return null;\n  }\n  const objectIdAttributeUrl = getUrlWithToken(attributeUrls[attributeIndex], token);\n  const attributeType = getAttributeValueType(attributeStorageInfo[attributeIndex]);\n  const objectIdAttributeData = await load(objectIdAttributeUrl, I3SAttributeLoader, {\n    i3s: {\n      attributeName,\n      attributeType\n    }\n  });\n\n  return objectIdAttributeData;\n}\n"],
  "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;ACIA,kBAAiB;AAEX,SAAU,4BAA4B,UAAgB;AAC1D,UAAQ,UAAU;IAChB,KAAK;AACH,aAAO;IACT,KAAK;AACH,aAAO;IACT,KAAK;AACH,aAAO;IACT,KAAK;AACH,aAAO;IACT,KAAK;AACH,aAAO;IACT;AACE,YAAM,IAAI,MAAM,iDAAiD,UAAU;EAC/E;AACF;AAEO,IAAM,cAAuC;EAClD,OAAO,eAAG;EACV,QAAQ,eAAG;EACX,SAAS,eAAG;EACZ,QAAQ,eAAG;EACX,QAAQ,eAAG;;AAOP,SAAU,OAAO,UAAgB;AACrC,UAA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MACA;;GAEH;AAED,SAAO;AACT;",
  "names": ["COORDINATE_SYSTEM", "import_core", "import_core", "HeaderAttributeProperty", "arrayBuffer", "options", "parse", "import_geospatial", "import_core", "import_core", "VERSION", "VERSION", "import_zip", "import_zip", "VERSION", "import_core", "VERSION", "VERSION", "parse", "import_core", "VERSION", "parse", "import_core"]
}
