{
  "version": 3,
  "sources": ["../src/index.ts", "../src/lib/get-schemas-from-tilejson.ts", "../src/lib/parse-tilejson.ts", "../src/tilejson-loader.ts", "../src/lib/parse-mvt.ts", "../src/lib/utils/geometry-utils.ts", "../src/lib/vector-tile/vector-tile-feature.ts", "../src/lib/vector-tile/vector-tile-layer.ts", "../src/lib/vector-tile/vector-tile.ts", "../src/mvt-format.ts", "../src/mvt-loader.ts", "../src/lib/mapbox-vt-pbf/to-vector-tile.ts", "../src/lib/mvt-pbf/mvt-constants.ts", "../src/lib/mvt-pbf/write-mvt-to-pbf.ts", "../src/lib/mapbox-vt-pbf/geojson-wrapper.ts", "../src/lib/encode-mvt.ts", "../src/mvt-writer.ts", "../src/mvt-source.ts", "../src/table-tile-source.ts", "../src/lib/vector-tiler/proto-tile.ts", "../src/lib/vector-tiler/transform-tile.ts", "../src/lib/vector-tiler/tile-to-geojson.ts", "../src/lib/vector-tiler/features/proto-feature.ts", "../src/lib/vector-tiler/features/simplify-path.ts", "../src/lib/vector-tiler/features/convert-feature.ts", "../src/lib/vector-tiler/features/clip-features.ts", "../src/lib/vector-tiler/features/wrap-features.ts"],
  "sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// TileJSONLoader\n\nexport {TileJSONLoader} from './tilejson-loader';\nexport type {TileJSONLoaderOptions} from './tilejson-loader';\nexport type {TileJSON} from './lib/parse-tilejson';\n\n// MVTLoader\n\nexport {MVTLoader, MVTWorkerLoader} from './mvt-loader';\nexport type {MVTLoaderOptions} from './mvt-loader';\n\n// MVTWriter\n\nexport {MVTWriter} from './mvt-writer';\nexport type {MVTWriterOptions} from './lib/encode-mvt';\n\n// MVTSource\n\nexport {MVTSource} from './mvt-source';\nexport type {MVTTileSource, MVTSourceOptions} from './mvt-source';\n\n// TableTileSource (dynamically tiles a table)\n\nexport type {TableTileSourceOptions, TableVectorTileSource} from './table-tile-source';\nexport {TableTileSource} from './table-tile-source';\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Schema, Field, DataType, SchemaMetadata, FieldMetadata} from '@loaders.gl/schema';\nimport type {TileJSONLayer, TileJSONField} from './parse-tilejson';\n\n// LAYERS\n\nexport function getSchemaFromTileJSONLayer(layer: TileJSONLayer): Schema {\n  const fields: Field[] = [];\n  if (layer.fields) {\n    for (const field of layer.fields) {\n      fields.push({\n        name: field.name,\n        type: getDataTypeFromTileJSONField(field),\n        metadata: getMetadataFromTileJSONField(field)\n      });\n    }\n  }\n  return {\n    metadata: getMetadataFromTileJSONLayer(layer),\n    fields\n  };\n}\n\nfunction getMetadataFromTileJSONLayer(layer: TileJSONLayer): SchemaMetadata {\n  const metadata: Record<string, string> = {};\n  for (const [key, value] of Object.entries(layer)) {\n    if (key !== 'fields' && value) {\n      metadata[key] = JSON.stringify(value);\n    }\n  }\n  return metadata;\n}\n\n// FIELDS\n\nfunction getDataTypeFromTileJSONField(field: TileJSONField): DataType {\n  switch (field.type.toLowerCase()) {\n    case 'float32':\n      return 'float32';\n    case 'number':\n    case 'float64':\n      return 'float64';\n    case 'string':\n    case 'utf8':\n      return 'utf8';\n    case 'boolean':\n      return 'bool';\n    default:\n      return 'null';\n  }\n}\n\nfunction getMetadataFromTileJSONField(field: TileJSONField): FieldMetadata {\n  const metadata: Record<string, string> = {};\n  for (const [key, value] of Object.entries(field)) {\n    if (key !== 'name' && value) {\n      metadata[key] = JSON.stringify(value);\n    }\n  }\n  return metadata;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {Schema} from '@loaders.gl/schema';\nimport {getSchemaFromTileJSONLayer} from './get-schemas-from-tilejson';\n\nexport type TileJSONOptions = {\n  /** max number of values. If not provided, include all values in the source tilestats */\n  maxValues?: number;\n};\n\n/** Parsed and typed TileJSON, merges Tilestats information if present */\nexport type TileJSON = {\n  /** Name of the tileset (for presentation in UI) */\n  name?: string;\n  /** A description of the contents or purpose of the tileset */\n  description?: string;\n  /** The version of the tileset */\n  version?: string;\n\n  tileFormat?: string;\n  tilesetType?: string;\n\n  /** Generating application. Tippecanoe adds this. */\n  generator?: string;\n  /** Generating application options. Tippecanoe adds this. */\n  generatorOptions?: string;\n\n  /** Tile indexing scheme */\n  scheme?: 'xyz' | 'tms';\n  /** Sharded URLs */\n  tiles?: string[];\n  /** `[[w, s], [e, n]]`, indicates the limits of the bounding box using the axis units and order of the specified CRS. */\n  boundingBox?: [min: [w: number, s: number], max: [e: number, n: number]];\n  /** May be set to the maxZoom of the first layer */\n  maxZoom?: number | null;\n  /** May be set to the minZoom of the first layer */\n  minZoom?: number | null;\n  center?: number[] | null;\n  htmlAttribution?: string;\n  htmlLegend?: string;\n\n  // Combination of tilestats (if present) and tilejson layer information\n  layers?: TileJSONLayer[];\n\n  /** Any nested JSON metadata */\n  metaJson?: any | null;\n};\n\nexport type TileJSONLayer = {\n  /** The name (id) of this layer (tilejson.vector_layers[].id / tilestats.layers[].layer) */\n  name: string;\n\n  /** The description of this layer (tilejson.layer.description) */\n  description?: string;\n\n  // tilestats\n\n  /** The number of features in this layer (tilestats.layer.count) */\n  featureCount?: number;\n  /** The dominant geometry type in this layer (tilestats.layer.geometry) */\n  dominantGeometry?: string;\n  /** An array of details about the first 100 attributes in this layer */\n\n  /**  */\n  minZoom?: number;\n  maxZoom?: number;\n  fields: TileJSONField[];\n\n  schema?: Schema;\n};\n\nexport type TileJSONField = {\n  /** The name of this attribute */\n  name: string;\n  description?: string;\n\n  // tilestats\n\n  type: string;\n  /** min value (if there are *any* numbers in the values) */\n  min?: number;\n  /** max value (if there are *any* numbers in the values) */\n  max?: number;\n  /** Number of unique values across the tileset */\n  uniqueValueCount?: number;\n  /** An array of this attribute's first 100 unique values */\n  values?: unknown[];\n};\n\n/**\n * The raw/unparsed tilestats layer type\n * @see https://github.com/mapbox/mapbox-geostats#output-the-stats\n */\ntype TilestatsLayer = {\n  /** The name of this layer */\n  layer: string;\n  /** The number of features in this layer */\n  count: number;\n  /** The dominant geometry type in this layer */\n  geometry: string;\n  /** The number of unique attributes in this layer (max. 1000) */\n  attributeCount: number;\n  /** Fields for this layer */\n  attributes?: TilestatsLayerAttribute[];\n};\n\n/**\n * The raw/unparsed tilestats attribute type\n * @see https://github.com/mapbox/mapbox-geostats#output-the-stats\n */\ntype TilestatsLayerAttribute = {\n  /** The name of this layer */\n  attribute?: string;\n  /** Each attribute has one of the following types:\n   * - 'string' if all its values are strings (or null).\n   * - 'number' if all its values are numbers (or null).\n   * - 'boolean' if all its values are booleans (or null).\n   * - 'null' if its only value is null.\n   * - 'mixed' if it has values of multiple types.\n   * - Array and object values are coerced to strings.\n   */\n  type?: string;\n  /** min value (if there are *any* numbers in the values) */\n  min?: number;\n  /** max value (if there are *any* numbers in the values) */\n  max?: number;\n  /** Number of unique values */\n  count?: number;\n  /** First 100 values */\n  values?: unknown[];\n};\n\nconst isObject: (x: unknown) => boolean = (x) => x !== null && typeof x === 'object';\n\n/**\n * Parse TileJSON from metadata\n * @param jsonMetadata - metadata object\n * @param options - options\n * @returns - parsed TileJSON\n */\n// eslint-disable-next-line complexity\nexport function parseTileJSON(jsonMetadata: any, options: TileJSONOptions): TileJSON | null {\n  if (!jsonMetadata || !isObject(jsonMetadata)) {\n    return null;\n  }\n\n  let tileJSON: TileJSON = {\n    name: jsonMetadata.name || '',\n    description: jsonMetadata.description || ''\n  };\n\n  // tippecanoe\n\n  if (typeof jsonMetadata.generator === 'string') {\n    tileJSON.generator = jsonMetadata.generator;\n  }\n  if (typeof jsonMetadata.generator_options === 'string') {\n    tileJSON.generatorOptions = jsonMetadata.generator_options;\n  }\n\n  // Tippecanoe emits `antimeridian_adjusted_bounds` instead of `bounds`\n  tileJSON.boundingBox =\n    parseBounds(jsonMetadata.bounds) || parseBounds(jsonMetadata.antimeridian_adjusted_bounds);\n\n  // TODO - can be undefined - we could set to center of bounds...\n  tileJSON.center = parseCenter(jsonMetadata.center);\n  // TODO - can be undefined, we could extract from layers...\n  tileJSON.maxZoom = safeParseFloat(jsonMetadata.maxzoom);\n  // TODO - can be undefined, we could extract from layers...\n  tileJSON.minZoom = safeParseFloat(jsonMetadata.minzoom);\n\n  // Look for nested metadata embedded in .json field\n  // TODO - document what source this applies to, when is this needed?\n  if (typeof jsonMetadata?.json === 'string') {\n    // try to parse json\n    try {\n      tileJSON.metaJson = JSON.parse(jsonMetadata.json);\n    } catch (error) {\n      // eslint-disable-next-line no-console\n      console.warn('Failed to parse tilejson.json field', error);\n      // do nothing\n    }\n  }\n\n  // Look for fields in tilestats\n\n  const tilestats = jsonMetadata.tilestats || tileJSON.metaJson?.tilestats;\n  const tileStatsLayers = parseTilestatsLayers(tilestats, options);\n  const tileJSONlayers = parseTileJSONLayers(jsonMetadata.vector_layers); // eslint-disable-line camelcase\n  // TODO - merge in description from tilejson\n  const layers = mergeLayers(tileJSONlayers, tileStatsLayers);\n\n  tileJSON = {\n    ...tileJSON,\n    layers\n  };\n\n  if (tileJSON.maxZoom === null && layers.length > 0) {\n    tileJSON.maxZoom = layers[0].maxZoom || null;\n  }\n\n  if (tileJSON.minZoom === null && layers.length > 0) {\n    tileJSON.minZoom = layers[0].minZoom || null;\n  }\n\n  return tileJSON;\n}\n\nfunction parseTileJSONLayers(layers: any[]): TileJSONLayer[] {\n  // Look for fields in vector_layers\n  if (!Array.isArray(layers)) {\n    return [];\n  }\n  return layers.map((layer) => parseTileJSONLayer(layer));\n}\n\nfunction parseTileJSONLayer(layer: any): TileJSONLayer {\n  const fields = Object.entries(layer.fields || []).map(([key, datatype]) => ({\n    name: key,\n    ...attributeTypeToFieldType(String(datatype))\n  }));\n  const layer2 = {...layer};\n  delete layer2.fields;\n  return {\n    name: layer.id || '',\n    ...layer2,\n    fields\n  };\n}\n\n/** parse Layers array from tilestats */\nfunction parseTilestatsLayers(tilestats: any, options: TileJSONOptions): TileJSONLayer[] {\n  if (isObject(tilestats) && Array.isArray(tilestats.layers)) {\n    // we are in luck!\n    return tilestats.layers.map((layer) => parseTilestatsForLayer(layer, options));\n  }\n  return [];\n}\n\nfunction parseTilestatsForLayer(layer: TilestatsLayer, options: TileJSONOptions): TileJSONLayer {\n  const fields: TileJSONField[] = [];\n  const indexedAttributes: {[key: string]: TilestatsLayerAttribute[]} = {};\n\n  const attributes = layer.attributes || [];\n  for (const attribute of attributes) {\n    const name = attribute.attribute;\n    if (typeof name === 'string') {\n      // TODO - code copied from kepler.gl, need sample tilestats files to test\n      if (name.split('|').length > 1) {\n        // indexed field\n        const fname = name.split('|')[0];\n        indexedAttributes[fname] = indexedAttributes[fname] || [];\n        indexedAttributes[fname].push(attribute);\n        // eslint-disable-next-line no-console\n        console.warn('ignoring tilestats indexed field', fname);\n      } else if (!fields[name]) {\n        fields.push(attributeToField(attribute, options));\n      } else {\n        // return (fields[name], attribute);\n      }\n    }\n  }\n  return {\n    name: layer.layer || '',\n    dominantGeometry: layer.geometry,\n    fields\n  };\n}\n\nfunction mergeLayers(layers: TileJSONLayer[], tilestatsLayers: TileJSONLayer[]): TileJSONLayer[] {\n  return layers.map((layer: TileJSONLayer): TileJSONLayer => {\n    const tilestatsLayer = tilestatsLayers.find((tsLayer) => tsLayer.name === layer.name);\n    const fields = tilestatsLayer?.fields || layer.fields || [];\n    const mergedLayer = {\n      ...layer,\n      ...tilestatsLayer,\n      fields\n    } as TileJSONLayer;\n    mergedLayer.schema = getSchemaFromTileJSONLayer(mergedLayer);\n    return mergedLayer;\n  });\n}\n\n/**\n * bounds should be [minLng, minLat, maxLng, maxLat]\n *`[[w, s], [e, n]]`, indicates the limits of the bounding box using the axis units and order of the specified CRS.\n */\nfunction parseBounds(\n  bounds: string | number[]\n): [[east: number, south: number], [west: number, north: number]] | undefined {\n  // supported formats\n  // string: \"-96.657715,40.126127,-90.140061,43.516689\",\n  // array: [ -180, -85.05112877980659, 180, 85.0511287798066 ]\n  const result = fromArrayOrString(bounds);\n  // validate bounds\n  if (\n    Array.isArray(result) &&\n    result.length === 4 &&\n    [result[0], result[2]].every(isLng) &&\n    [result[1], result[3]].every(isLat)\n  ) {\n    return [\n      [result[0], result[1]],\n      [result[2], result[3]]\n    ];\n  }\n  return undefined;\n}\n\nfunction parseCenter(center: string | number[]): number[] | null {\n  // supported formats\n  // string: \"-96.657715,40.126127,-90.140061,43.516689\",\n  // array: [-91.505127,41.615442,14]\n  const result = fromArrayOrString(center);\n  if (\n    Array.isArray(result) &&\n    result.length === 3 &&\n    isLng(result[0]) &&\n    isLat(result[1]) &&\n    isZoom(result[2])\n  ) {\n    return result;\n  }\n  return null;\n}\n\nfunction safeParseFloat(input: unknown): number | null {\n  const result =\n    typeof input === 'string' ? parseFloat(input) : typeof input === 'number' ? input : null;\n  return result === null || isNaN(result) ? null : result;\n}\n\n// https://github.com/mapbox/tilejson-spec/tree/master/2.2.0\nfunction isLat(num: any): boolean {\n  return Number.isFinite(num) && num <= 90 && num >= -90;\n}\nfunction isLng(num: any): boolean {\n  return Number.isFinite(num) && num <= 180 && num >= -180;\n}\nfunction isZoom(num: any): boolean {\n  return Number.isFinite(num) && num >= 0 && num <= 22;\n}\nfunction fromArrayOrString(data: string | number[]): number[] | null {\n  if (typeof data === 'string') {\n    return data.split(',').map(parseFloat);\n  } else if (Array.isArray(data)) {\n    return data;\n  }\n  return null;\n}\n\n// possible types https://github.com/mapbox/tippecanoe#modifying-feature-attributes\nconst attrTypeMap = {\n  number: {\n    type: 'float32'\n  },\n  numeric: {\n    type: 'float32'\n  },\n  string: {\n    type: 'utf8'\n  },\n  vachar: {\n    type: 'utf8'\n  },\n  float: {\n    type: 'float32'\n  },\n  int: {\n    type: 'int32'\n  },\n  int4: {\n    type: 'int32'\n  },\n  boolean: {\n    type: 'boolean'\n  },\n  bool: {\n    type: 'boolean'\n  }\n};\n\nfunction attributeToField(\n  attribute: TilestatsLayerAttribute = {},\n  options: TileJSONOptions\n): TileJSONField {\n  const fieldTypes = attributeTypeToFieldType(attribute.type!);\n  const field: TileJSONField = {\n    name: attribute.attribute as string,\n    // what happens if attribute type is string...\n    // filterProps: getFilterProps(fieldTypes.type, attribute),\n    ...fieldTypes\n  };\n\n  // attribute: \"_season_peaks_color\"\n  // count: 1000\n  // max: 0.95\n  // min: 0.24375\n  // type: \"number\"\n\n  if (typeof attribute.min === 'number') {\n    field.min = attribute.min;\n  }\n  if (typeof attribute.max === 'number') {\n    field.max = attribute.max;\n  }\n  if (typeof attribute.count === 'number') {\n    field.uniqueValueCount = attribute.count;\n  }\n  if (attribute.values) {\n    // Too much data? Add option?\n    field.values = attribute.values;\n  }\n\n  if (field.values && typeof options.maxValues === 'number') {\n    // Too much data? Add option?\n    field.values = field.values?.slice(0, options.maxValues);\n  }\n\n  return field;\n}\n\nfunction attributeTypeToFieldType(aType: string): {type: string} {\n  const type = aType.toLowerCase();\n  if (!type || !attrTypeMap[type]) {\n    // console.warn(\n    //   `cannot convert attribute type ${type} to loaders.gl data type, use string by default`\n    // );\n  }\n  return attrTypeMap[type] || {type: 'string'};\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport type {TileJSON} from './lib/parse-tilejson';\nimport {parseTileJSON} from './lib/parse-tilejson';\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 TileJSONLoaderOptions = LoaderOptions & {\n  /** Options for the TileJSONLoader */\n  tilejson?: {\n    /** Max number of unique values */\n    maxValues?: number;\n  };\n};\n\n/**\n * Loader for TileJSON metadata\n */\nexport const TileJSONLoader = {\n  dataType: null as unknown as TileJSON,\n  batchType: null as never,\n\n  name: 'TileJSON',\n  id: 'tilejson',\n  module: 'pmtiles',\n  version: VERSION,\n  worker: true,\n  extensions: ['json'],\n  mimeTypes: ['application/json'],\n  text: true,\n  options: {\n    tilejson: {\n      maxValues: undefined\n    }\n  },\n  parse: async (arrayBuffer: ArrayBuffer, options?: TileJSONLoaderOptions) => {\n    const jsonString = new TextDecoder().decode(arrayBuffer);\n    const json = JSON.parse(jsonString);\n    const tilejsonOptions = {...TileJSONLoader.options.tilejson, ...options?.tilejson};\n    return parseTileJSON(json, tilejsonOptions) as TileJSON;\n  },\n  parseTextSync: (text: string, options?: TileJSONLoaderOptions) => {\n    const json = JSON.parse(text);\n    const tilejsonOptions = {...TileJSONLoader.options.tilejson, ...options?.tilejson};\n    return parseTileJSON(json, tilejsonOptions) as TileJSON;\n  }\n} as const satisfies LoaderWithParser<TileJSON, never, TileJSONLoaderOptions>;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\n\nimport type {FlatFeature, Feature, GeoJSONTable, BinaryFeatureCollection} from '@loaders.gl/schema';\nimport {flatGeojsonToBinary, GeojsonGeometryInfo} from '@loaders.gl/gis';\nimport {log} from '@loaders.gl/loader-utils';\nimport Protobuf from 'pbf';\n\nimport {VectorTile} from './vector-tile/vector-tile';\nimport {VectorTileFeature} from './vector-tile/vector-tile-feature';\n\nimport type {MVTLoaderOptions} from '../mvt-loader';\ntype MVTOptions = Required<MVTLoaderOptions>['mvt'];\n\n/**\n * Parse MVT arrayBuffer and return GeoJSON.\n *\n * @param arrayBuffer A MVT arrayBuffer\n * @param options\n * @returns A GeoJSON geometry object or a binary representation\n */\nexport function parseMVT(arrayBuffer: ArrayBuffer, options?: MVTLoaderOptions) {\n  const mvtOptions = checkOptions(options);\n\n  const shape: string | undefined =\n    (options?.gis as {format?: string} | undefined)?.format ||\n    options?.mvt?.shape ||\n    (options as {shape?: string} | undefined)?.shape;\n  switch (shape) {\n    case 'columnar-table': // binary + some JS arrays\n      return {shape: 'columnar-table', data: parseToBinary(arrayBuffer, mvtOptions)};\n    case 'geojson-table': {\n      const table: GeoJSONTable = {\n        shape: 'geojson-table',\n        type: 'FeatureCollection',\n        features: parseToGeojsonFeatures(arrayBuffer, mvtOptions)\n      };\n      return table;\n    }\n    case 'geojson':\n      return parseToGeojsonFeatures(arrayBuffer, mvtOptions);\n    case 'binary-geometry':\n      return parseToBinary(arrayBuffer, mvtOptions);\n    case 'binary':\n      return parseToBinary(arrayBuffer, mvtOptions);\n    default:\n      throw new Error(shape || 'undefined shape');\n  }\n}\n\nfunction parseToBinary(arrayBuffer: ArrayBuffer, options: MVTOptions): BinaryFeatureCollection {\n  const [flatGeoJsonFeatures, geometryInfo] = parseToFlatGeoJson(arrayBuffer, options);\n\n  const binaryData = flatGeojsonToBinary(flatGeoJsonFeatures, geometryInfo);\n  // Add the original byteLength (as a reasonable approximation of the size of the binary data)\n  // TODO decide where to store extra fields like byteLength (header etc) and document\n  // @ts-ignore\n  binaryData.byteLength = arrayBuffer.byteLength;\n  return binaryData;\n}\n\nfunction parseToFlatGeoJson(\n  arrayBuffer: ArrayBuffer,\n  options: MVTOptions\n): [FlatFeature[], GeojsonGeometryInfo] {\n  const features: FlatFeature[] = [];\n  const geometryInfo: GeojsonGeometryInfo = {\n    coordLength: 2,\n    pointPositionsCount: 0,\n    pointFeaturesCount: 0,\n    linePositionsCount: 0,\n    linePathsCount: 0,\n    lineFeaturesCount: 0,\n    polygonPositionsCount: 0,\n    polygonObjectsCount: 0,\n    polygonRingsCount: 0,\n    polygonFeaturesCount: 0\n  };\n\n  if (arrayBuffer.byteLength <= 0) {\n    return [features, geometryInfo];\n  }\n\n  const tile = new VectorTile(new Protobuf(arrayBuffer));\n\n  const selectedLayers =\n    options && Array.isArray(options.layers) ? options.layers : Object.keys(tile.layers);\n\n  selectedLayers.forEach((layerName: string) => {\n    const vectorTileLayer = tile.layers[layerName];\n    if (!vectorTileLayer) {\n      return;\n    }\n\n    for (let i = 0; i < vectorTileLayer.length; i++) {\n      const vectorTileFeature = vectorTileLayer.getBinaryFeature(i, geometryInfo);\n      const decodedFeature = getDecodedFeatureBinary(vectorTileFeature, options, layerName);\n      features.push(decodedFeature);\n    }\n  });\n\n  return [features, geometryInfo];\n}\n\nfunction parseToGeojsonFeatures(arrayBuffer: ArrayBuffer, options: MVTOptions): Feature[] {\n  if (arrayBuffer.byteLength <= 0) {\n    return [];\n  }\n\n  const features: Feature[] = [];\n  const tile = new VectorTile(new Protobuf(arrayBuffer));\n\n  const selectedLayers = Array.isArray(options.layers) ? options.layers : Object.keys(tile.layers);\n\n  selectedLayers.forEach((layerName: string) => {\n    const vectorTileLayer = tile.layers[layerName];\n    if (!vectorTileLayer) {\n      return;\n    }\n\n    for (let i = 0; i < vectorTileLayer.length; i++) {\n      const vectorTileFeature = vectorTileLayer.getGeoJSONFeature(i);\n      const decodedFeature = getDecodedFeature(vectorTileFeature, options, layerName);\n      features.push(decodedFeature);\n    }\n  });\n\n  return features;\n}\n\n/** Check that options are good */\nfunction checkOptions(options?: MVTLoaderOptions): MVTOptions {\n  if (!options?.mvt) {\n    throw new Error('mvt options required');\n  }\n\n  if (options.mvt?.coordinates === 'wgs84' && !options.mvt.tileIndex) {\n    throw new Error('MVT Loader: WGS84 coordinates need tileIndex property');\n  }\n\n  if (options.gis) {\n    log.warn('MVTLoader: \"options.gis\" is deprecated, use \"options.mvt.shape\" instead')();\n  }\n\n  return options.mvt;\n}\n\n/**\n * @param feature\n * @param options\n * @returns decoded feature\n */\nfunction getDecodedFeature(\n  feature: VectorTileFeature,\n  options: MVTOptions,\n  layerName: string\n): Feature {\n  const decodedFeature = feature.toGeoJSONFeature(\n    options.coordinates || 'local',\n    options.tileIndex\n  );\n\n  // Add layer name to GeoJSON properties\n  if (options.layerProperty) {\n    decodedFeature.properties ||= {};\n    decodedFeature.properties[options.layerProperty] = layerName;\n  }\n\n  return decodedFeature;\n}\n\n/**\n * @param feature\n * @param options\n * @returns decoded binary feature\n */\nfunction getDecodedFeatureBinary(\n  feature: VectorTileFeature,\n  options: MVTOptions,\n  layerName: string\n): FlatFeature {\n  const decodedFeature = feature.toBinaryFeature(options.coordinates || 'local', options.tileIndex);\n\n  // Add layer name to GeoJSON properties\n  if (options.layerProperty && decodedFeature.properties) {\n    decodedFeature.properties[options.layerProperty] = layerName;\n  }\n\n  return decodedFeature;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\n\nimport {getPolygonSignedArea} from '@math.gl/polygon';\nimport {FlatIndexedGeometry, FlatPolygon} from '@loaders.gl/schema';\n\n/**\n *\n * @param ring\n * @returns sum\n */\nexport function signedArea(ring: number[][]) {\n  let sum = 0;\n  for (let i = 0, j = ring.length - 1, p1: number[], p2: number[]; i < ring.length; j = i++) {\n    p1 = ring[i];\n    p2 = ring[j];\n    sum += (p2[0] - p1[0]) * (p1[1] + p2[1]);\n  }\n  return sum;\n}\n\n/**\n * This function projects local coordinates in a\n * [0 - bufferSize, this.extent + bufferSize] range to a\n * [0 - (bufferSize / this.extent), 1 + (bufferSize / this.extent)] range.\n * The resulting extent would be 1.\n * @param line\n * @param feature\n */\nexport function convertToLocalCoordinates(\n  coordinates: number[] | number[][] | number[][][] | number[][][][],\n  extent: number\n): void {\n  if (Array.isArray(coordinates[0])) {\n    for (const subcoords of coordinates) {\n      convertToLocalCoordinates(subcoords as number[] | number[][] | number[][][], extent);\n    }\n    return;\n  }\n\n  // Just a point\n  const p = coordinates as number[];\n  p[0] /= extent;\n  p[1] /= extent;\n}\n\n/**\n * For the binary code path, the feature data is just\n * one big flat array, so we just divide each value\n * @param data\n * @param feature\n */\nexport function convertToLocalCoordinatesFlat(data: number[], extent: number): void {\n  for (let i = 0; i < data.length; ++i) {\n    data[i] /= extent;\n  }\n}\n\n/**\n * Projects local tile coordinates to lngLat in place.\n * @param points\n * @param tileIndex\n */\nexport function projectToLngLat(\n  line: number[] | number[][] | number[][][],\n  tileIndex: {x: number; y: number; z: number},\n  extent: number\n): void {\n  if (typeof line[0][0] !== 'number') {\n    for (const point of line) {\n      // @ts-expect-error\n      projectToLngLat(point, tileIndex, extent);\n    }\n    return;\n  }\n  const size = extent * Math.pow(2, tileIndex.z);\n  const x0 = extent * tileIndex.x;\n  const y0 = extent * tileIndex.y;\n  for (let j = 0; j < line.length; j++) {\n    const p = line[j];\n    p[0] = ((p[0] + x0) * 360) / size - 180;\n    const y2 = 180 - ((p[1] + y0) * 360) / size;\n    p[1] = (360 / Math.PI) * Math.atan(Math.exp((y2 * Math.PI) / 180)) - 90;\n  }\n}\n\n/**\n * Projects local tile coordinates to lngLat in place.\n * @param points\n * @param tileIndex\nexport function projectTileCoordinatesToLngLat(\n  points: number[][],\n  tileIndex: {x: number; y: number; z: number},\n  extent: number\n): void {\n  const {x, y, z} = tileIndex;\n  const size = extent * Math.pow(2, z);\n  const x0 = extent * x;\n  const y0 = extent * y;\n\n  for (const p of points) {\n    p[0] = ((p[0] + x0) * 360) / size - 180;\n    const y2 = 180 - ((p[1] + y0) * 360) / size;\n    p[1] = (360 / Math.PI) * Math.atan(Math.exp((y2 * Math.PI) / 180)) - 90;\n  }\n}\n */\n\n/**\n *\n * @param data\n * @param x0\n * @param y0\n * @param size\n */\nexport function projectToLngLatFlat(\n  data: number[],\n  tileIndex: {x: number; y: number; z: number},\n  extent: number\n): void {\n  const {x, y, z} = tileIndex;\n  const size = extent * Math.pow(2, z);\n  const x0 = extent * x;\n  const y0 = extent * y;\n\n  for (let j = 0, jl = data.length; j < jl; j += 2) {\n    data[j] = ((data[j] + x0) * 360) / size - 180;\n    const y2 = 180 - ((data[j + 1] + y0) * 360) / size;\n    data[j + 1] = (360 / Math.PI) * Math.atan(Math.exp((y2 * Math.PI) / 180)) - 90;\n  }\n}\n\n/**\n * Classifies an array of rings into polygons with outer rings and holes\n * @param rings\n * @returns polygons\n */\nexport function classifyRings(rings: number[][][]): number[][][][] {\n  const len = rings.length;\n\n  if (len <= 1) return [rings];\n\n  const polygons: number[][][][] = [];\n  let polygon: number[][][] | undefined;\n  let ccw: boolean | undefined;\n\n  for (let i = 0; i < len; i++) {\n    const area = signedArea(rings[i]);\n    if (area === 0) continue; // eslint-disable-line no-continue\n\n    if (ccw === undefined) ccw = area < 0;\n\n    if (ccw === area < 0) {\n      if (polygon) polygons.push(polygon);\n      polygon = [rings[i]];\n    } else if (polygon) polygon.push(rings[i]);\n  }\n  if (polygon) polygons.push(polygon);\n\n  return polygons;\n}\n\n/**\n * Classifies an array of rings into polygons with outer rings and holes\n * The function also detects holes which have zero area and\n * removes them. In doing so it modifies the input\n * `geom.data` array to remove the unneeded data\n *\n * @param geometry\n * @returns object\n */\n// eslint-disable-next-line max-statements\nexport function classifyRingsFlat(geom: FlatIndexedGeometry): FlatPolygon {\n  const len = geom.indices.length;\n  const type = 'Polygon';\n\n  if (len <= 1) {\n    return {\n      type,\n      data: geom.data,\n      areas: [[getPolygonSignedArea(geom.data)]],\n      indices: [geom.indices]\n    };\n  }\n\n  const areas: any[] = [];\n  const polygons: any[] = [];\n  let ringAreas: number[] = [];\n  let polygon: number[] = [];\n  let ccw: boolean | undefined;\n  let offset = 0;\n\n  for (let endIndex: number, i = 0, startIndex: number; i < len; i++) {\n    startIndex = geom.indices[i] - offset;\n\n    endIndex = geom.indices[i + 1] - offset || geom.data.length;\n    const shape = geom.data.slice(startIndex, endIndex);\n    const area = getPolygonSignedArea(shape);\n\n    if (area === 0) {\n      // This polygon has no area, so remove it from the shape\n      // Remove the section from the data array\n      const before = geom.data.slice(0, startIndex);\n      const after = geom.data.slice(endIndex);\n      geom.data = before.concat(after);\n\n      // Need to offset any remaining indices as we have\n      // modified the data buffer\n      offset += endIndex - startIndex;\n\n      // Do not add this index to the output and process next shape\n      continue; // eslint-disable-line no-continue\n    }\n\n    if (ccw === undefined) ccw = area < 0;\n\n    if (ccw === area < 0) {\n      if (polygon.length) {\n        areas.push(ringAreas);\n        polygons.push(polygon);\n      }\n      polygon = [startIndex];\n      ringAreas = [area];\n    } else {\n      ringAreas.push(area);\n      polygon.push(startIndex);\n    }\n  }\n  if (ringAreas) areas.push(ringAreas);\n  if (polygon.length) polygons.push(polygon);\n\n  return {type, areas, indices: polygons, data: geom.data};\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\n\n// This code is forked from https://github.com/mapbox/vector-tile-js under BSD 3-clause license.\n\nimport type {Feature, FlatFeature, FlatIndexedGeometry} from '@loaders.gl/schema';\nimport type {GeojsonGeometryInfo} from '@loaders.gl/gis';\nimport Protobuf from 'pbf';\nimport {\n  classifyRings,\n  classifyRingsFlat,\n  projectToLngLat,\n  projectToLngLatFlat,\n  convertToLocalCoordinates,\n  convertToLocalCoordinatesFlat\n} from '../utils/geometry-utils';\n\nexport class VectorTileFeature {\n  properties: {[x: string]: string | number | boolean | null};\n  extent: any;\n  type: number;\n  id: number | null;\n  _pbf: Protobuf;\n  _geometry: number;\n  _keys: string[];\n  _values: (string | number | boolean | null)[];\n  _geometryInfo: GeojsonGeometryInfo;\n\n  static types: Readonly<string[]> = ['Unknown', 'Point', 'LineString', 'Polygon'];\n\n  // eslint-disable-next-line max-params\n  constructor(\n    pbf: Protobuf,\n    end: number,\n    extent: any,\n    keys: string[],\n    values: (string | number | boolean | null)[],\n    geometryInfo?: GeojsonGeometryInfo\n  ) {\n    // Public\n    this.properties = {};\n    this.extent = extent;\n    this.type = 0;\n    this.id = null;\n\n    // Private\n    this._pbf = pbf;\n    this._geometry = -1;\n    this._keys = keys;\n    this._values = values;\n\n    // Only used by binary tiles\n    this._geometryInfo = geometryInfo!;\n\n    pbf.readFields(readFeature, this, end);\n  }\n\n  toGeoJSONFeature(\n    coordinates: 'wgs84' | 'local',\n    tileIndex?: {x: number; y: number; z: number}\n  ): Feature {\n    const coords = this.loadGeometry();\n\n    switch (coordinates) {\n      case 'wgs84':\n        return _toGeoJSONFeature(this, coords, (line: number[][]) =>\n          projectToLngLat(line, tileIndex!, this.extent)\n        );\n\n      default:\n        return _toGeoJSONFeature(this, coords, convertToLocalCoordinates);\n    }\n  }\n  /**\n   *\n   * @param options\n   * @returns\n   */\n  toBinaryFeature(\n    coordinates: 'wgs84' | 'local',\n    tileIndex?: {x: number; y: number; z: number}\n  ): FlatFeature {\n    const geom = this.loadFlatGeometry();\n\n    switch (coordinates) {\n      case 'wgs84':\n        return this._toBinaryCoordinates(geom, (coords: number[]) =>\n          projectToLngLatFlat(coords, tileIndex!, this.extent)\n        );\n\n      default:\n        return this._toBinaryCoordinates(geom, convertToLocalCoordinatesFlat);\n    }\n  }\n\n  /** Read a bounding box from the feature */\n  // eslint-disable-next-line max-statements\n  bbox() {\n    const pbf = this._pbf;\n    pbf.pos = this._geometry;\n\n    const end = pbf.readVarint() + pbf.pos;\n    let cmd = 1;\n    let length = 0;\n    let x = 0;\n    let y = 0;\n    let x1 = Infinity;\n    let x2 = -Infinity;\n    let y1 = Infinity;\n    let y2 = -Infinity;\n\n    while (pbf.pos < end) {\n      if (length <= 0) {\n        const cmdLen = pbf.readVarint();\n        cmd = cmdLen & 0x7;\n        length = cmdLen >> 3;\n      }\n\n      length--;\n\n      if (cmd === 1 || cmd === 2) {\n        x += pbf.readSVarint();\n        y += pbf.readSVarint();\n        if (x < x1) x1 = x;\n        if (x > x2) x2 = x;\n        if (y < y1) y1 = y;\n        if (y > y2) y2 = y;\n      } else if (cmd !== 7) {\n        throw new Error(`unknown command ${cmd}`);\n      }\n    }\n\n    return [x1, y1, x2, y2];\n  }\n\n  // BINARY HELPERS\n\n  /**\n   *\n   * @param transform\n   * @returns result\n   */\n  _toBinaryCoordinates(\n    geom: FlatIndexedGeometry,\n    transform: (data: number[], extent: number) => void\n  ) {\n    let geometry;\n\n    // Apply the supplied transformation to data\n    transform(geom.data, this.extent);\n\n    const coordLength = 2;\n\n    // eslint-disable-next-line default-case\n    switch (this.type) {\n      case 1: // Point\n        this._geometryInfo.pointFeaturesCount++;\n        this._geometryInfo.pointPositionsCount += geom.indices.length;\n        geometry = {type: 'Point', ...geom};\n        break;\n\n      case 2: // LineString\n        this._geometryInfo.lineFeaturesCount++;\n        this._geometryInfo.linePathsCount += geom.indices.length;\n        this._geometryInfo.linePositionsCount += geom.data.length / coordLength;\n        geometry = {type: 'LineString', ...geom};\n        break;\n\n      case 3: // Polygon\n        geometry = classifyRingsFlat(geom);\n\n        // Unlike Point & LineString geom.indices is a 2D array, thanks\n        // to the classifyRings method\n        this._geometryInfo.polygonFeaturesCount++;\n        this._geometryInfo.polygonObjectsCount += geometry.indices.length;\n\n        for (const indices of geometry.indices) {\n          this._geometryInfo.polygonRingsCount += indices.length;\n        }\n        this._geometryInfo.polygonPositionsCount += geometry.data.length / coordLength;\n\n        break;\n      default:\n        throw new Error(`Invalid geometry type: ${this.type}`);\n    }\n\n    const result: FlatFeature = {type: 'Feature', geometry, properties: this.properties};\n\n    if (this.id !== null) {\n      result.id = this.id;\n    }\n\n    return result;\n  }\n\n  // GEOJSON HELPER\n\n  // eslint-disable-next-line complexity, max-statements\n  loadGeometry(): number[][][] {\n    const pbf = this._pbf;\n    pbf.pos = this._geometry;\n\n    const end = pbf.readVarint() + pbf.pos;\n    let cmd = 1;\n    let length = 0;\n    let x = 0;\n    let y = 0;\n    const lines: number[][][] = [];\n    let line: number[][] | undefined;\n\n    while (pbf.pos < end) {\n      if (length <= 0) {\n        const cmdLen = pbf.readVarint();\n        cmd = cmdLen & 0x7;\n        length = cmdLen >> 3;\n      }\n\n      length--;\n\n      switch (cmd) {\n        case 1:\n        case 2:\n          x += pbf.readSVarint();\n          y += pbf.readSVarint();\n\n          if (cmd === 1) {\n            // moveTo\n            if (line) lines.push(line);\n            line = [];\n          }\n          if (line) line.push([x, y]);\n          break;\n        case 7:\n          // Workaround for https://github.com/mapbox/mapnik-vector-tile/issues/90\n          if (line) {\n            line.push(line[0].slice()); // closePolygon\n          }\n          break;\n        default:\n          throw new Error(`unknown command ${cmd}`);\n      }\n    }\n\n    if (line) lines.push(line);\n\n    return lines;\n  }\n\n  /**\n   * Expands the protobuf data to an intermediate Flat GeoJSON\n   * data format, which maps closely to the binary data buffers.\n   * It is similar to GeoJSON, but rather than storing the coordinates\n   * in multidimensional arrays, we have a 1D `data` with all the\n   * coordinates, and then index into this using the `indices`\n   * parameter, e.g.\n   *\n   * geometry: {\n   *   type: 'Point', data: [1,2], indices: [0]\n   * }\n   * geometry: {\n   *   type: 'LineString', data: [1,2,3,4,...], indices: [0]\n   * }\n   * geometry: {\n   *   type: 'Polygon', data: [1,2,3,4,...], indices: [[0, 2]]\n   * }\n   * Thus the indices member lets us look up the relevant range\n   * from the data array.\n   * The Multi* versions of the above types share the same data\n   * structure, just with multiple elements in the indices array\n   */\n  // eslint-disable-next-line complexity, max-statements\n  loadFlatGeometry(): FlatIndexedGeometry {\n    const pbf = this._pbf;\n    pbf.pos = this._geometry;\n\n    const endPos = pbf.readVarint() + pbf.pos;\n    let cmd = 1;\n    let cmdLen: number;\n    let length = 0;\n    let x = 0;\n    let y = 0;\n    let i = 0;\n\n    // Note: I attempted to replace the `data` array with a\n    // Float32Array, but performance was worse, both using\n    // `set()` and direct index access. Also, we cannot\n    // know how large the buffer should be, so it would\n    // increase memory usage\n    const indices: number[] = []; // Indices where geometries start\n    const data: number[] = []; // Flat array of coordinate data\n\n    while (pbf.pos < endPos) {\n      if (length <= 0) {\n        cmdLen = pbf.readVarint();\n        cmd = cmdLen & 0x7;\n        length = cmdLen >> 3;\n      }\n\n      length--;\n\n      if (cmd === 1 || cmd === 2) {\n        x += pbf.readSVarint();\n        y += pbf.readSVarint();\n\n        if (cmd === 1) {\n          // New line\n          indices.push(i);\n        }\n        data.push(x, y);\n        i += 2;\n      } else if (cmd === 7) {\n        // Workaround for https://github.com/mapbox/mapnik-vector-tile/issues/90\n        if (i > 0) {\n          const start = indices[indices.length - 1]; // start index of polygon\n          data.push(data[start], data[start + 1]); // closePolygon\n          i += 2;\n        }\n      } else {\n        throw new Error(`unknown command ${cmd}`);\n      }\n    }\n\n    return {data, indices};\n  }\n}\n\nfunction _toGeoJSONFeature(\n  vtFeature: VectorTileFeature,\n  coords: number[][][],\n  transform: (data: number[][], extent: number) => void\n): Feature {\n  let type = VectorTileFeature.types[vtFeature.type];\n  let i: number;\n  let j: number;\n\n  let coordinates: number[][] | number[][][] | number[][][][];\n  switch (vtFeature.type) {\n    case 1:\n      const points: number[][] = [];\n      for (i = 0; i < coords.length; i++) {\n        points[i] = coords[i][0];\n      }\n      coordinates = points;\n      transform(coordinates, vtFeature.extent);\n      break;\n\n    case 2:\n      coordinates = coords;\n      for (i = 0; i < coordinates.length; i++) {\n        transform(coordinates[i], vtFeature.extent);\n      }\n      break;\n\n    case 3:\n      coordinates = classifyRings(coords);\n      for (i = 0; i < coordinates.length; i++) {\n        for (j = 0; j < coordinates[i].length; j++) {\n          transform(coordinates[i][j], vtFeature.extent);\n        }\n      }\n      break;\n\n    default:\n      throw new Error('illegal vector tile type');\n  }\n\n  if (coordinates.length === 1) {\n    // @ts-expect-error\n    coordinates = coordinates[0];\n  } else {\n    type = `Multi${type}`;\n  }\n\n  const result: Feature = {\n    type: 'Feature',\n    geometry: {\n      type: type as any,\n      coordinates: coordinates as any\n    },\n    properties: vtFeature.properties\n  };\n\n  if (vtFeature.id !== null) {\n    result.properties ||= {};\n    result.properties.id = vtFeature.id;\n  }\n\n  return result;\n}\n\n// PBF READER UTILS\n\n/**\n *\n * @param tag\n * @param feature\n * @param pbf\n */\nfunction readFeature(tag: number, feature?: VectorTileFeature, pbf?: Protobuf): void {\n  if (feature && pbf) {\n    if (tag === 1) feature.id = pbf.readVarint();\n    else if (tag === 2) readTag(pbf, feature);\n    else if (tag === 3) feature.type = pbf.readVarint();\n    else if (tag === 4) feature._geometry = pbf.pos;\n  }\n}\n\n/**\n *\n * @param pbf\n * @param feature\n */\nfunction readTag(pbf: Protobuf, feature: VectorTileFeature): void {\n  const end = pbf.readVarint() + pbf.pos;\n\n  while (pbf.pos < end) {\n    const key = feature._keys[pbf.readVarint()];\n    const value = feature._values[pbf.readVarint()];\n    feature.properties[key] = value;\n  }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\n\n/* eslint-disable indent */\n// This code is forked from https://github.com/mapbox/vector-tile-js under BSD 3-clause license.\n\nimport Protobuf from 'pbf';\nimport {VectorTileFeature} from './vector-tile-feature';\nimport {GeojsonGeometryInfo} from '@loaders.gl/gis';\n\nexport class VectorTileLayer {\n  version: number;\n  name: string;\n  extent: number;\n  length: number;\n  _pbf: Protobuf;\n  _keys: string[];\n  _values: (string | number | boolean | null)[];\n  _features: number[];\n\n  constructor(pbf: Protobuf, end: number) {\n    // Public\n    this.version = 1;\n    this.name = '';\n    this.extent = 4096;\n    this.length = 0;\n\n    // Private\n    this._pbf = pbf;\n    this._keys = [];\n    this._values = [];\n    this._features = [];\n\n    pbf.readFields(readLayer, this, end);\n\n    this.length = this._features.length;\n  }\n\n  /**\n   * return feature `i` from this layer as a `VectorTileFeature`\n   * @param index\n   * @returns feature\n   */\n  getGeoJSONFeature(i: number): VectorTileFeature {\n    if (i < 0 || i >= this._features.length) {\n      throw new Error('feature index out of bounds');\n    }\n\n    this._pbf.pos = this._features[i];\n\n    const end = this._pbf.readVarint() + this._pbf.pos;\n    return new VectorTileFeature(this._pbf, end, this.extent, this._keys, this._values);\n  }\n\n  /**\n   * return binary feature `i` from this layer as a `VectorTileFeature`\n   *\n   * @param index\n   * @param geometryInfo\n   * @returns binary feature\n   */\n  getBinaryFeature(i: number, geometryInfo: GeojsonGeometryInfo): VectorTileFeature {\n    if (i < 0 || i >= this._features.length) {\n      throw new Error('feature index out of bounds');\n    }\n\n    this._pbf.pos = this._features[i];\n\n    const end = this._pbf.readVarint() + this._pbf.pos;\n    return new VectorTileFeature(\n      this._pbf,\n      end,\n      this.extent,\n      this._keys,\n      this._values,\n      geometryInfo\n    );\n  }\n}\n\n/**\n *\n * @param tag\n * @param layer\n * @param pbf\n */\nfunction readLayer(tag: number, layer?: VectorTileLayer, pbf?: Protobuf): void {\n  if (layer && pbf) {\n    if (tag === 15) layer.version = pbf.readVarint();\n    else if (tag === 1) layer.name = pbf.readString();\n    else if (tag === 5) layer.extent = pbf.readVarint();\n    else if (tag === 2) layer._features.push(pbf.pos);\n    else if (tag === 3) layer._keys.push(pbf.readString());\n    else if (tag === 4) layer._values.push(readValueMessage(pbf));\n  }\n}\n\n/**\n *\n * @param pbf\n * @returns value\n */\nfunction readValueMessage(pbf: Protobuf) {\n  let value: string | number | boolean | null = null;\n  const end = pbf.readVarint() + pbf.pos;\n\n  while (pbf.pos < end) {\n    const tag = pbf.readVarint() >> 3;\n\n    value =\n      tag === 1\n        ? pbf.readString()\n        : tag === 2\n          ? pbf.readFloat()\n          : tag === 3\n            ? pbf.readDouble()\n            : tag === 4\n              ? pbf.readVarint64()\n              : tag === 5\n                ? pbf.readVarint()\n                : tag === 6\n                  ? pbf.readSVarint()\n                  : tag === 7\n                    ? pbf.readBoolean()\n                    : null;\n  }\n\n  return value;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\n\n// This code is forked from https://github.com/mapbox/vector-tile-js under BSD 3-clause license.\n\nimport {VectorTileLayer} from './vector-tile-layer';\nimport Protobuf from 'pbf';\n\nexport class VectorTile {\n  layers: {[x: string]: VectorTileLayer};\n  constructor(pbf: Protobuf, end?: number) {\n    this.layers = pbf.readFields(readTile, {}, end);\n  }\n}\n\n/**\n *\n * @param tag\n * @param layers\n * @param pbf\n */\nfunction readTile(tag: number, layers?: {[x: string]: VectorTileLayer}, pbf?: Protobuf): void {\n  if (tag === 3) {\n    if (pbf) {\n      const layer = new VectorTileLayer(pbf, pbf.readVarint() + pbf.pos);\n      if (layer.length && layers) {\n        layers[layer.name] = layer;\n      }\n    }\n  }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\n\nimport type {Format} from '@loaders.gl/loader-utils';\n\n/**\n * Worker loader for the Mapbox Vector Tile format\n */\nexport const MVTFormat = {\n  name: 'Mapbox Vector Tile',\n  id: 'mvt',\n  module: 'mvt',\n  // Note: ArcGIS uses '.pbf' extension and 'application/octet-stream'\n  extensions: ['mvt', 'pbf'],\n  mimeTypes: [\n    // https://www.iana.org/assignments/media-types/application/vnd.mapbox-vector-tile\n    'application/vnd.mapbox-vector-tile',\n    'application/x-protobuf'\n    // 'application/octet-stream'\n  ],\n  category: 'geometry'\n} as const satisfies Format;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\n\nimport type {Loader, LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\n// import type {MVTOptions} from './lib/types';\nimport {parseMVT} from './lib/parse-mvt';\nimport {MVTFormat} from './mvt-format';\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 MVTLoaderOptions = LoaderOptions & {\n  mvt?: {\n    /** Shape of returned data */\n    shape?: 'geojson-table' | 'columnar-table' | 'geojson' | 'binary' | 'binary-geometry';\n    /** `wgs84`: coordinates in long, lat (`tileIndex` must be provided. `local` coordinates are `0-1` from tile origin */\n    coordinates?: 'wgs84' | 'local';\n    /** An object containing tile index values (`x`, `y`, `z`) to reproject features' coordinates into WGS84. Mandatory with `wgs84` coordinates option. */\n    tileIndex?: {x: number; y: number; z: number};\n    /** If provided, stored the layer name of each feature is added to `feature.properties[layerProperty]`. */\n    layerProperty?: string | number;\n    /** layer filter. If provided, only features belonging to the named layers will be included, otherwise features from all layers are returned. */\n    layers?: string[];\n    /** Override the URL to the worker bundle (by default loads from unpkg.com) */\n    workerUrl?: string;\n  };\n  gis?: {\n    /** @deprecated Use options.mvt.shape === 'binary-geometry' */\n    binary?: boolean;\n    /** @deprecated. Use options.mvt.shape */\n    format?: 'geojson-table' | 'columnar-table' | 'geojson' | 'binary' | 'binary-geometry';\n  };\n};\n\n/**\n * Worker loader for the Mapbox Vector Tile format\n */\nexport const MVTWorkerLoader = {\n  ...MVTFormat,\n  dataType: null as any,\n  batchType: null as never,\n  version: VERSION,\n  worker: true,\n  options: {\n    mvt: {\n      shape: 'geojson',\n      coordinates: 'local',\n      layerProperty: 'layerName',\n      layers: undefined!,\n      tileIndex: undefined!\n    }\n  }\n} as const satisfies Loader<\n  any, // BinaryFeatureCollection | GeoJSONTable | Feature<Geometry, GeoJsonProperties>,\n  never,\n  MVTLoaderOptions\n>;\n\n/**\n * Loader for the Mapbox Vector Tile format\n */\nexport const MVTLoader = {\n  ...MVTWorkerLoader,\n  parse: async (arrayBuffer, options?: MVTLoaderOptions) => parseMVT(arrayBuffer, options),\n  parseSync: parseMVT,\n  binary: true\n} as const satisfies LoaderWithParser<\n  any, // BinaryFeatureCollection | GeoJSONTable | Feature<Geometry, GeoJsonProperties>,\n  never,\n  MVTLoaderOptions\n>;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\n\n// Forked from https://github.com/mapbox/vt-pbf under MIT License Copyright (c) 2015 Anand Thakker\n\nimport Pbf from 'pbf';\nimport type {MVTTile} from '../mvt-pbf/mvt-types';\nimport {writeMVT} from '../mvt-pbf/write-mvt-to-pbf';\nimport GeoJSONWrapper from './geojson-wrapper';\nimport type {GeoJSON, FeatureCollection, Geometry} from '@loaders.gl/schema';\nimport {copyToArrayBuffer} from '@loaders.gl/loader-utils';\n\nexport type FromGeojsonOptions = {\n  layerName?: string;\n  version?: number;\n  extent?: number;\n  tileIndex?: {x: number; y: number; z: number};\n};\n\n/**\n * Serialize a map of geojson layers\n * loaders.gl addition\n *\n * @param geojson\n * @param [options] - An object specifying the vector-tile specification version and extent that were used to create `layers`.\n * @param [options.extent=4096] - Extent of the vector tile\n * @return  uncompressed, pbf-serialized tile data\n */\nexport function fromGeojson(geojson: FeatureCollection, options: FromGeojsonOptions): ArrayBuffer {\n  options = options || {};\n  geojson = normalizeGeojson(geojson);\n  const extent = options.extent || 4096;\n  const features = convertFeaturesToVectorTileFeatures(geojson.features, extent, options.tileIndex);\n  const layer = new GeoJSONWrapper(features, {...options, extent});\n  // TODO - this is broken\n  (layer as any).name = options.layerName || 'geojsonLayer';\n  (layer as any).version = options.version || 1;\n  (layer as any).extent = options.extent || 4096;\n\n  // @ts-expect-error\n  return fromVectorTileJs({layers: {[layer.name]: layer}});\n}\n\n/**\n * Serialize a vector-tile-js-created tile to pbf\n *\n * @param tile\n * @return  uncompressed, pbf-serialized tile data\n */\nexport function fromVectorTileJs(tile: MVTTile): ArrayBuffer {\n  const pbf = new Pbf();\n  writeMVT(tile, pbf);\n  const uint8Array = pbf.finish();\n  // TODO - make sure no byteOffsets/byteLenghts are used?\n  return copyToArrayBuffer(\n    uint8Array.buffer,\n    uint8Array.byteOffset,\n    uint8Array.byteOffset + uint8Array.byteLength\n  );\n}\n\n/**\n * Serialized a geojson-vt-created tile to pbf.\n *\n * @param vtLayers - An object mapping layer names to geojson-vt-created vector tile objects\n * @param  [options] - An object specifying the vector-tile specification version and extent that were used to create `layers`.\n * @param  [options.version=1] - Version of vector-tile spec used\n * @param  [options.extent=4096] - Extent of the vector tile\n * @return uncompressed, pbf-serialized tile data\n *\nexport function fromGeojsonVt(vtLayers, options): ArrayBuffer {\n  options = options || {};\n  const layers = {};\n  for (const key in vtLayers) {\n    layers[key] = new GeoJSONWrapper(vtLayers[key].features, options);\n    layers[key].name = key;\n    layers[key].version = options.version;\n    layers[key].extent = options.extent;\n  }\n  return fromVectorTileJs({layers});\n}\n*/\n\nexport function normalizeGeojson(geojson: GeoJSON): FeatureCollection {\n  // Array of features\n  if (Array.isArray(geojson)) {\n    return {\n      type: 'FeatureCollection',\n      features: geojson\n    };\n  }\n  // A single feature\n  if (geojson.type === 'Feature') {\n    return {\n      type: 'FeatureCollection',\n      features: [geojson]\n    };\n  }\n  throw new Error('Invalid GeoJSON object');\n}\n\nfunction convertFeaturesToVectorTileFeatures(\n  features,\n  extent: number,\n  tileIndex?: {x: number; y: number; z: number}\n) {\n  if (features.every(isVectorTileFeature)) {\n    return features;\n  }\n\n  return features.map((feature) => convertFeatureToVectorTile(feature, extent, tileIndex));\n}\n\nfunction convertFeatureToVectorTile(\n  feature,\n  extent: number,\n  tileIndex?: {x: number; y: number; z: number}\n) {\n  const geometry = feature.geometry as Geometry;\n  const type = getVectorTileType(geometry.type);\n\n  return {\n    id: typeof feature.id === 'number' ? feature.id : undefined,\n    type,\n    geometry: projectGeometryToTileSpace(geometry, extent, tileIndex),\n    tags: feature.properties || {}\n  };\n}\n\nfunction projectGeometryToTileSpace(\n  geometry: Geometry,\n  extent: number,\n  tileIndex?: {x: number; y: number; z: number}\n) {\n  switch (geometry.type) {\n    case 'Point':\n      return [projectPointToTile(geometry.coordinates as number[], extent, tileIndex)];\n    case 'MultiPoint':\n      return geometry.coordinates.map((coord) =>\n        projectPointToTile(coord as number[], extent, tileIndex)\n      );\n    case 'LineString':\n      return [\n        geometry.coordinates.map((coord) =>\n          projectPointToTile(coord as number[], extent, tileIndex)\n        )\n      ];\n    case 'MultiLineString':\n      return geometry.coordinates.map((line) =>\n        line.map((coord) => projectPointToTile(coord as number[], extent, tileIndex))\n      );\n    case 'Polygon':\n      return geometry.coordinates.map((ring) =>\n        ring.map((coord) => projectPointToTile(coord as number[], extent, tileIndex))\n      );\n    case 'MultiPolygon':\n      return geometry.coordinates.flatMap((polygon) =>\n        polygon.map((ring) =>\n          ring.map((coord) => projectPointToTile(coord as number[], extent, tileIndex))\n        )\n      );\n    default:\n      throw new Error(`Unsupported geometry type: ${geometry.type}`);\n  }\n}\n\nfunction projectPointToTile(\n  point: number[],\n  extent: number,\n  tileIndex?: {x: number; y: number; z: number}\n) {\n  if (isNormalizedPoint(point)) {\n    return [Math.round(point[0] * extent), Math.round(point[1] * extent)];\n  }\n\n  if (tileIndex && isLngLatPoint(point)) {\n    return projectLngLatToTile(point, tileIndex, extent);\n  }\n\n  return [Math.round(point[0]), Math.round(point[1])];\n}\n\nfunction isNormalizedPoint(point: number[]) {\n  return Math.abs(point[0]) <= 1 && Math.abs(point[1]) <= 1;\n}\n\nfunction isLngLatPoint(point: number[]) {\n  return Math.abs(point[0]) <= 180 && Math.abs(point[1]) <= 90;\n}\n\nfunction projectLngLatToTile(\n  point: number[],\n  tileIndex: {x: number; y: number; z: number},\n  extent: number\n) {\n  const [lng, lat] = point;\n  const {x, y, z} = tileIndex;\n  const size = extent * Math.pow(2, z);\n  const x0 = extent * x;\n  const y0 = extent * y;\n\n  const worldX = ((lng + 180) / 360) * size;\n  const worldY =\n    ((180 - (180 / Math.PI) * Math.log(Math.tan(Math.PI / 4 + (lat * Math.PI) / 180 / 2))) * size) /\n    360;\n\n  return [Math.round(worldX - x0), Math.round(worldY - y0)];\n}\n\nfunction isVectorTileFeature(feature): boolean {\n  return typeof feature?.type === 'number' && Array.isArray(feature.geometry);\n}\n\nfunction getVectorTileType(type: Geometry['type']): 1 | 2 | 3 {\n  switch (type) {\n    case 'Point':\n    case 'MultiPoint':\n      return 1;\n    case 'LineString':\n    case 'MultiLineString':\n      return 2;\n    case 'Polygon':\n    case 'MultiPolygon':\n      return 3;\n    default:\n      throw new Error(`Unknown geometry type: ${type}`);\n  }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\n\n/**\n * MVT spec constants\n * @see https://github.com/mapbox/vector-tile-spec/blob/master/2.1/README.md\n */\nexport enum TileInfo {\n  /** repeated Layer */\n  layers = 3\n}\n\n/**\n * MVT spec constants\n * @see https://github.com/mapbox/vector-tile-spec/blob/master/2.1/README.md\n * @note Layers are described in section 4.1 of the specification\n */\nexport enum LayerInfo {\n  /**\n   * Any compliant implementation must first read the version\n   * number encoded in this message and choose the correct\n   * implementation for this version number before proceeding to\n   * decode other parts of this message.\n   * required uint32  [ default = 1 ];\n   */\n  version = 15,\n\n  /** PBF: required string */\n  name = 1,\n\n  /** The actual features in this tile.\n   * PBF: repeated Feature\n   */\n  features = 2,\n\n  /**\n   * Dictionary encoding for keys\n   * PBF: repeated string\n   */\n  keys = 3,\n\n  /**\n   * Dictionary encoding for values\n   * PBF: repeated Value\n   */\n  values = 4,\n\n  /**\n   * Although this is an \"optional\" field it is required by the specification.\n   * See https://github.com/mapbox/vector-tile-spec/issues/47\n   * PBF: optional uint32 [ default = 4096 ];\n   */\n  extent = 5\n\n  // extensions 16 to max;\n}\n\n/**\n * @see https://github.com/mapbox/vector-tile-spec/blob/master/2.1/README.md\n * Features are described in section 4.2 of the specification\n */\nexport enum FeatureInfo {\n  /** optional uint64 [ default = 0 ]; */\n  id = 1,\n\n  /**\n   * Tags of this feature are encoded as repeated pairs of integers.\n   * A detailed description of tags is located in sections 4.2 and 4.4 of the specification\n   * repeated uint32  [ packed = true ];\n   */\n  tags = 2,\n\n  /**\n   * The type of geometry stored in this feature.\n   * GeomType  [ default = UNKNOWN ];\n   */\n  type = 3,\n\n  /**\n   * Contains a stream of commands and parameters (vertices).\n   * A detailed description on geometry encoding is located in\n   * section 4.3 of the specification.\n   * repeated uint32  [ packed = true ];\n   */\n  geometry = 4\n}\n\n/**\n * GeomType is described in section 4.3.4 of the specification\n * @see https://github.com/mapbox/vector-tile-spec/blob/master/2.1/README.md\n * */\nexport enum GeometryType {\n  UNKNOWN = 0,\n  POINT = 1,\n  LINESTRING = 2,\n  POLYGON = 3\n}\n\n/**\n * Variant type encoding\n * The use of values is described in section 4.1 of the specification\n * @note Exactly one of these values must be present in a valid message\n * @see https://github.com/mapbox/vector-tile-spec/blob/master/2.1/README.md\n */\nexport enum PropertyType {\n  /** string */\n  string_value = 1, //\n  /** float */\n  float_value = 2,\n  /** double */\n  double_value = 3,\n  /** int64 */\n  int_value = 4,\n  /** uint64 */\n  uint_value = 5,\n  /** sint64 */\n  sint_value = 6,\n  /** bool */\n  bool_value = 7\n  // extensions 8 to max;\n}\n\n/**\n * \"Turtle graphics\" style geometry commands\n * @see https://github.com/mapbox/vector-tile-spec/blob/master/2.1/README.md\n */\nexport enum Command {\n  /** 2 Parameters: dX, dY */\n  MoveTo = 1,\n  /** 2 Parameters dX, dY */\n  LineTo = 2,\n  /** No parameters */\n  ClosePath = 7\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\n\n// Forked from https://github.com/mapbox/vt-pbf under MIT License Copyright (c) 2015 Anand Thakker\n\nimport Protobuf from 'pbf';\nimport type {MVTTile, MVTLayer} from './mvt-types';\nimport * as MVT from './mvt-constants';\n\ntype WriteContext = {\n  layer: MVTLayer | any;\n  keys: string[];\n  values: unknown[];\n  keycache: Record<string, number>;\n  valuecache: Record<string, number>;\n  feature?: any;\n};\n\nexport function writeMVT(tile: MVTTile, pbf?: Protobuf): void {\n  for (const key in tile.layers) {\n    const context: WriteContext = {\n      layer: tile.layers[key],\n      keys: [],\n      values: [],\n      keycache: {},\n      valuecache: {}\n    };\n\n    pbf!.writeMessage(MVT.TileInfo.layers, writeLayer, context);\n  }\n}\n\nfunction writeLayer(context: WriteContext, pbf?: Protobuf): void {\n  const {layer} = context;\n\n  pbf!.writeVarintField(MVT.LayerInfo.version, layer.version || 1);\n  pbf!.writeStringField(MVT.LayerInfo.name, layer.name || '');\n  pbf!.writeVarintField(MVT.LayerInfo.extent, layer.extent || 4096);\n\n  for (let i = 0; i < layer.length; i++) {\n    context.feature = layer.feature(i);\n    pbf!.writeMessage(MVT.LayerInfo.features, writeFeature, context);\n  }\n\n  const keys = context.keys;\n  for (let i = 0; i < keys.length; i++) {\n    pbf!.writeStringField(MVT.LayerInfo.keys, keys[i]);\n  }\n\n  const values = context.values;\n  for (let i = 0; i < values.length; i++) {\n    pbf!.writeMessage(MVT.LayerInfo.values, writeValue, values[i]);\n  }\n}\n\nfunction writeFeature(context: WriteContext, pbf?: Protobuf): void {\n  const feature = context.feature!;\n\n  if (feature.id !== undefined) {\n    pbf!.writeVarintField(MVT.FeatureInfo.id, feature.id);\n  }\n\n  pbf!.writeMessage(MVT.FeatureInfo.tags, writeProperties, context);\n  pbf!.writeVarintField(MVT.FeatureInfo.type, feature.type);\n  pbf!.writeMessage(MVT.FeatureInfo.geometry, writeGeometry, feature);\n}\n\nfunction writeProperties(context: WriteContext, pbf?: Protobuf): void {\n  const feature = context.feature!;\n  const {keys, values, keycache, valuecache} = context;\n\n  for (const key in feature.properties) {\n    let keyIndex = keycache[key];\n    if (typeof keyIndex === 'undefined') {\n      keys.push(key);\n      keyIndex = keys.length - 1;\n      keycache[key] = keyIndex;\n    }\n    pbf!.writeVarint(keyIndex);\n\n    let value = feature.properties[key];\n    const type = typeof value;\n    if (type !== 'string' && type !== 'boolean' && type !== 'number') {\n      value = JSON.stringify(value);\n    }\n    const valueKey = `${type}:${value}`;\n    let valueIndex = valuecache[valueKey];\n    if (typeof valueIndex === 'undefined') {\n      values.push(value);\n      valueIndex = values.length - 1;\n      valuecache[valueKey] = valueIndex;\n    }\n    pbf!.writeVarint(valueIndex);\n  }\n}\n\nfunction command(cmd, length) {\n  return (length << 3) + (cmd & 0x7);\n}\n\nfunction zigzag(num) {\n  return (num << 1) ^ (num >> 31);\n}\n\nfunction writeGeometry(feature, pbf?: Protobuf): void {\n  const geometry = feature.loadGeometry();\n  const type = feature.type;\n  let x = 0;\n  let y = 0;\n  const rings = geometry.length;\n  for (let r = 0; r < rings; r++) {\n    const ring = geometry[r];\n    let count = 1;\n    if (type === 1) {\n      count = ring.length;\n    }\n    pbf!.writeVarint(command(1, count)); // moveto\n    // do not write polygon closing path as lineto\n    const lineCount = type === 3 ? ring.length - 1 : ring.length;\n    for (let i = 0; i < lineCount; i++) {\n      if (i === 1 && type !== 1) {\n        pbf!.writeVarint(command(2, lineCount - 1)); // lineto\n      }\n      const dx = ring[i].x - x;\n      const dy = ring[i].y - y;\n      pbf!.writeVarint(zigzag(dx));\n      pbf!.writeVarint(zigzag(dy));\n      x += dx;\n      y += dy;\n    }\n    if (type === 3) {\n      pbf!.writeVarint(command(7, 1)); // closepath\n    }\n  }\n}\n\nfunction writeValue(value: unknown, pbf?: Protobuf): void {\n  switch (typeof value) {\n    case 'string':\n      pbf!.writeStringField(1, value);\n      break;\n    case 'boolean':\n      pbf!.writeBooleanField(7, value);\n      break;\n    case 'number':\n      if (value % 1 !== 0) {\n        pbf!.writeDoubleField(3, value);\n      } else if (value < 0) {\n        pbf!.writeSVarintField(6, value);\n      } else {\n        pbf!.writeVarintField(5, value);\n      }\n      break;\n    default:\n    // ignore\n  }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\n\n// Forked from https://github.com/mapbox/vt-pbf under MIT License Copyright (c) 2015 Anand Thakker\n\nclass Point {\n  x: number;\n  y: number;\n  constructor(x: number, y: number) {\n    this.x = x;\n    this.y = y;\n  }\n}\n\n// conform to vectortile api\nexport default class GeoJSONWrapper {\n  options;\n  features: any[];\n  length: number;\n\n  constructor(features, options = {}) {\n    this.options = options;\n    this.features = features;\n    this.length = features.length;\n  }\n\n  feature(index) {\n    return new FeatureWrapper(this.features[index], this.options.extent);\n  }\n}\n\nclass FeatureWrapper {\n  id;\n  type;\n  rawGeometry: any;\n  properties;\n  extent;\n  geometry: Point[][] = [];\n\n  constructor(feature, extent) {\n    this.id = typeof feature.id === 'number' ? feature.id : undefined;\n    this.type = feature.type;\n    this.rawGeometry = feature.type === 1 ? [feature.geometry] : feature.geometry;\n    this.properties = feature.tags;\n    this.extent = extent || 4096;\n  }\n\n  loadGeometry() {\n    const rings = this.rawGeometry;\n    this.geometry = [];\n\n    for (const ring of rings) {\n      const newRing: Point[] = [];\n      for (const coord of ring) {\n        newRing.push(new Point(coord[0], coord[1]));\n      }\n      this.geometry.push(newRing);\n    }\n    return this.geometry;\n  }\n\n  bbox() {\n    if (!this.geometry) {\n      this.loadGeometry();\n    }\n\n    const rings = this.geometry;\n    let x1 = Infinity;\n    let x2 = -Infinity;\n    let y1 = Infinity;\n    let y2 = -Infinity;\n\n    for (const ring of rings) {\n      for (const coord of ring) {\n        x1 = Math.min(x1, coord.x);\n        x2 = Math.max(x2, coord.x);\n        y1 = Math.min(y1, coord.y);\n        y2 = Math.max(y2, coord.y);\n      }\n    }\n\n    return [x1, y1, x2, y2];\n  }\n\n  // toGeoJSON(x, y, z) {\n  //   return VectorTileFeature.prototype.toGeoJSON.call(this, x, y, z);\n  // }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {WriterOptions} from '@loaders.gl/loader-utils';\nimport {fromGeojson} from './mapbox-vt-pbf/to-vector-tile';\n\nexport type MVTWriterOptions = WriterOptions & {\n  mvt?: {\n    /** Name of the single layer that will be written into the tile */\n    layerName?: string;\n    /** Vector tile specification version */\n    version?: number;\n    /** Extent of the vector tile grid */\n    extent?: number;\n    /** Optional tile index for projecting WGS84 coordinates into tile space */\n    tileIndex?: {x: number; y: number; z: number};\n  };\n};\n\nexport function encodeMVT(data, options?: MVTWriterOptions) {\n  const {mvt} = options || {};\n  const encodeOptions = {\n    layerName: mvt?.layerName || 'geojsonLayer',\n    version: mvt?.version || 1,\n    extent: mvt?.extent || 4096,\n    tileIndex: mvt?.tileIndex\n  };\n\n  return fromGeojson(data, encodeOptions);\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {WriterWithEncoder} from '@loaders.gl/loader-utils';\nimport {MVTFormat} from './mvt-format';\nimport {encodeMVT, type MVTWriterOptions} from './lib/encode-mvt';\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 * Writer for the Mapbox Vector Tile format\n *\n * Experimental: The API may change in minor/patch releases.\n */\nexport const MVTWriter = {\n  ...MVTFormat,\n  version: VERSION,\n  binary: true,\n  options: {\n    mvt: {\n      layerName: 'geojsonLayer',\n      version: 1,\n      extent: 4096\n    }\n  },\n  async encode(data, options?: MVTWriterOptions) {\n    return encodeMVT(data, options);\n  },\n  encodeSync(data, options?: MVTWriterOptions) {\n    return encodeMVT(data, options);\n  }\n} as const satisfies WriterWithEncoder<any, never, MVTWriterOptions>;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {\n  Source,\n  ImageType,\n  DataSourceOptions,\n  ImageTileSource,\n  VectorTileSource,\n  GetTileParameters,\n  GetTileDataParameters\n} from '@loaders.gl/loader-utils';\nimport {DataSource} from '@loaders.gl/loader-utils';\nimport {ImageLoader, ImageLoaderOptions, getBinaryImageMetadata} from '@loaders.gl/images';\nimport {\n  MVTLoader,\n  MVTLoaderOptions,\n  TileJSONLoader,\n  TileJSON,\n  TileJSONLoaderOptions\n} from '@loaders.gl/mvt';\nimport {MVTFormat} from './mvt-format';\n\n/** Properties for a Mapbox Vector Tile Source */\nexport type MVTSourceOptions = DataSourceOptions & {\n  mvt?: {\n    // TODO - add options here\n    /** if not supplied, loads tilejson.json, If null does not load metadata */\n    metadataUrl?: string | null;\n    /** Override extension (necessary if no metadata) */\n    extension?: string;\n    /** Additional attribution, adds to any attribution loaded from tileset metadata */\n    attributions?: string[];\n    /** Specify load options for all sub loaders */\n    loadOptions?: TileJSONLoaderOptions & MVTLoaderOptions & ImageLoaderOptions;\n  };\n};\n\n/** Creates an MVTTileSource */\nexport const MVTSource = {\n  ...MVTFormat,\n  version: '0.0.0',\n  type: 'mvt',\n  fromUrl: true,\n  fromBlob: false,\n\n  defaultOptions: {\n    mvt: {\n      // TODO - add options here\n    }\n  },\n\n  testURL: (url: string): boolean => true,\n  createDataSource(url: string, options: MVTSourceOptions): MVTTileSource {\n    return new MVTTileSource(url, options);\n  }\n} as const satisfies Source<MVTTileSource>;\n\n/**\n * MVT data source for Mapbox Vector Tiles v1.\n */\n/**\n * A PMTiles data source\n * @note Can be either a raster or vector tile source depending on the contents of the PMTiles file.\n */\nexport class MVTTileSource\n  extends DataSource<string, MVTSourceOptions>\n  implements ImageTileSource, VectorTileSource\n{\n  readonly metadataUrl: string | null = null;\n  schema: 'tms' | 'xyz' | 'template' = 'tms';\n  metadata: Promise<TileJSON | null>;\n  extension: string;\n  mimeType: string | null = null;\n\n  constructor(url: string, options: MVTSourceOptions) {\n    super(url, options, MVTSource.defaultOptions);\n    this.metadataUrl = options.mvt?.metadataUrl || `${this.url}/tilejson.json`;\n    this.extension = options.mvt?.extension || '.png';\n\n    this.getTileData = this.getTileData.bind(this);\n    this.metadata = this.getMetadata();\n\n    if (isURLTemplate(this.url)) {\n      this.schema = 'template';\n    }\n  }\n\n  // @ts-ignore - Metadata type misalignment\n  async getMetadata(): Promise<TileJSON | null> {\n    if (!this.metadataUrl) {\n      return null;\n    }\n\n    let response: Response;\n    try {\n      // Annoyingly, on CORS errors, fetch doesn't use the response status/ok mechanism but instead throws\n      // CORS errors are common when requesting an unavailable sub resource such as a metadata file or an unavailable tile)\n      response = await this.fetch(this.metadataUrl);\n    } catch (error: unknown) {\n      // eslint-disable-next-line no-console\n      console.error((error as TypeError).message);\n      return null;\n    }\n    if (!response.ok) {\n      // eslint-disable-next-line no-console\n      console.error(response.statusText);\n      return null;\n    }\n    const tileJSON = await response.text();\n    const metadata = TileJSONLoader.parseTextSync?.(tileJSON) || null;\n\n    // TODO add metadata attributions\n    // metadata.attributions = [...this.options.attributions, ...(metadata.attributions || [])];\n    // if (metadata?.mimeType) {\n    //   this.mimeType = metadata?.tileMIMEType;\n    // }\n\n    return metadata;\n  }\n\n  getTileMIMEType(): string | null {\n    return this.mimeType;\n  }\n\n  async getTile(parameters: GetTileParameters): Promise<ArrayBuffer | null> {\n    const {x, y, z} = parameters;\n    const tileUrl = this.getTileURL(x, y, z);\n    const response = await this.fetch(tileUrl);\n    if (!response.ok) {\n      return null;\n    }\n    const arrayBuffer = await response.arrayBuffer();\n    return arrayBuffer;\n  }\n\n  // Tile Source interface implementation: deck.gl compatible API\n  // TODO - currently only handles image tiles, not vector tiles\n\n  async getTileData(parameters: GetTileDataParameters): Promise<any> {\n    const {x, y, z} = parameters.index;\n    // const metadata = await this.metadata;\n    // mimeType = metadata?.tileMIMEType || 'application/vnd.mapbox-vector-tile';\n\n    const arrayBuffer = await this.getTile({x, y, z, layers: []});\n    if (arrayBuffer === null) {\n      return null;\n    }\n\n    const imageMetadata = getBinaryImageMetadata(arrayBuffer);\n    this.mimeType =\n      this.mimeType || imageMetadata?.mimeType || 'application/vnd.mapbox-vector-tile';\n    switch (this.mimeType) {\n      case 'application/vnd.mapbox-vector-tile':\n        return await this._parseVectorTile(arrayBuffer, {x, y, z, layers: []});\n      default:\n        return await this._parseImageTile(arrayBuffer);\n    }\n  }\n\n  // ImageTileSource interface implementation\n\n  async getImageTile(tileParams: GetTileParameters): Promise<ImageType | null> {\n    const arrayBuffer = await this.getTile(tileParams);\n    return arrayBuffer ? this._parseImageTile(arrayBuffer) : null;\n  }\n\n  protected async _parseImageTile(arrayBuffer: ArrayBuffer): Promise<ImageType> {\n    return await ImageLoader.parse(arrayBuffer, this.loadOptions);\n  }\n\n  // VectorTileSource interface implementation\n\n  async getVectorTile(tileParams: GetTileParameters): Promise<unknown | null> {\n    const arrayBuffer = await this.getTile(tileParams);\n    return arrayBuffer ? this._parseVectorTile(arrayBuffer, tileParams) : null;\n  }\n\n  protected async _parseVectorTile(\n    arrayBuffer: ArrayBuffer,\n    tileParams: GetTileParameters\n  ): Promise<unknown | null> {\n    const loadOptions: MVTLoaderOptions = {\n      mvt: {\n        shape: 'geojson-table',\n        coordinates: 'wgs84',\n        tileIndex: {x: tileParams.x, y: tileParams.y, z: tileParams.z},\n        ...(this.loadOptions as MVTLoaderOptions)?.mvt\n      },\n      ...this.loadOptions\n    };\n\n    return await MVTLoader.parse(arrayBuffer, loadOptions);\n  }\n\n  getMetadataUrl(): string | null {\n    return this.metadataUrl;\n  }\n\n  getTileURL(x: number, y: number, z: number) {\n    switch (this.schema) {\n      case 'xyz':\n        return `${this.url}/${x}/${y}/${z}${this.extension}`;\n      case 'tms':\n        return `${this.url}/${z}/${x}/${y}${this.extension}`;\n      case 'template':\n        return getURLFromTemplate(this.url, x, y, z, '0');\n      default:\n        throw new Error(this.schema);\n    }\n  }\n}\n\nexport function isURLTemplate(s: string): boolean {\n  return /(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))|(?=.*{x})(?=.*({y}|{-y})(?=.*{z}))/.test(s);\n}\n\nexport type URLTemplate = string | string[];\n\nconst xRegex = new RegExp('{x}', 'g');\nconst yRegex = new RegExp('{y}', 'g');\nconst zRegex = new RegExp('{z}', 'g');\n\n/**\n * Get a URL from a URL template\n * @note copied from deck.gl/modules/geo-layers/src/tileset-2d/utils.ts\n * @param template - URL template\n * @param x - tile x coordinate\n * @param y - tile y coordinate\n * @param z - tile z coordinate\n * @param id - tile id\n * @returns URL\n */\nexport function getURLFromTemplate(\n  template: URLTemplate,\n  x: number,\n  y: number,\n  z: number,\n  id: string = '0'\n): string {\n  if (Array.isArray(template)) {\n    const i = stringHash(id) % template.length;\n    template = template[i];\n  }\n\n  let url = template;\n  url = url.replace(xRegex, String(x));\n  url = url.replace(yRegex, String(y));\n  url = url.replace(zRegex, String(z));\n\n  // Back-compatible support for {-y}\n  if (Number.isInteger(y) && Number.isInteger(z)) {\n    url = url.replace(/\\{-y\\}/g, String(Math.pow(2, z) - y - 1));\n  }\n\n  return url;\n}\n\nfunction stringHash(s: string): number {\n  return Math.abs(s.split('').reduce((a, b) => ((a << 5) - a + b.charCodeAt(0)) | 0, 0));\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT AND ISC\n// Copyright (c) vis.gl contributors\n// Based on https://github.com/mapbox/geojson-vt under compatible ISC license\n\nimport type {\n  Source,\n  DataSourceOptions,\n  VectorTileSource,\n  TileSourceMetadata,\n  GetTileDataParameters,\n  GetTileParameters,\n  LoaderWithParser\n} from '@loaders.gl/loader-utils';\nimport {DataSource, getRequiredOptions, log} from '@loaders.gl/loader-utils';\nimport type {Schema, GeoJSONTable, Feature, BinaryFeatureCollection} from '@loaders.gl/schema';\nimport {deduceTableSchema} from '@loaders.gl/schema-utils';\nimport {Stats, Stat} from '@probe.gl/stats';\n\nimport type {ProtoFeature} from './lib/vector-tiler/features/proto-feature';\nimport type {ProtoTile} from './lib/vector-tiler/proto-tile';\nimport {createProtoTile} from './lib/vector-tiler/proto-tile';\nimport {transformTile} from './lib/vector-tiler/transform-tile'; // coordinate transformation\nimport {convertTileToGeoJSON} from './lib/vector-tiler/tile-to-geojson'; // tile clipping and wrapping\nimport {convertFeaturesToProtoFeature} from './lib/vector-tiler/features/convert-feature';\nimport {clipFeatures} from './lib/vector-tiler/features/clip-features'; // stripe clipping algorithm\nimport {wrapFeatures} from './lib/vector-tiler/features/wrap-features'; // date line processing\n\n/** Options to configure tiling */\nexport type TableTileSourceOptions = DataSourceOptions & {\n  table?: {\n    coordinates?: 'local' | 'wgs84' | 'EPSG:4326';\n    /** max zoom to preserve detail on */\n    maxZoom?: number;\n    /** max zoom in the tile index */\n    indexMaxZoom?: number;\n    /** max number of points per tile in the tile index */\n    maxPointsPerTile?: number;\n    /** simplification tolerance (higher means simpler) */\n    tolerance?: number;\n    /** tile extent */\n    extent?: number;\n    /** tile buffer on each side */\n    buffer?: number;\n    /** name of a feature property to be promoted to feature.id */\n    promoteId?: string;\n    /** whether to generate feature ids. Cannot be used with promoteId */\n    generateId?: boolean;\n    /** logging level (0, 1 or 2) */\n    debug?: number;\n    /** whether to calculate line metrics */\n    lineMetrics?: boolean;\n  };\n};\n\n/** Options to configure tiling */\nexport const TableTileSource = {\n  name: 'TableTiler',\n  id: 'table-tiler',\n  module: 'mvt',\n  version: '0.0.0',\n  extensions: ['mvt'],\n  mimeTypes: ['application/octet-stream'],\n  type: 'table',\n  fromUrl: false,\n  fromBlob: false,\n\n  defaultOptions: {\n    table: {\n      coordinates: 'local',\n      promoteId: undefined!,\n      maxZoom: 14,\n      indexMaxZoom: 5,\n      maxPointsPerTile: 10000,\n      tolerance: 3,\n      extent: 4096,\n      buffer: 64,\n      generateId: undefined\n    }\n  },\n\n  testURL: (url: string): boolean => url.endsWith('.geojson'),\n  createDataSource(\n    url: string | Blob | GeoJSONTable | Promise<GeoJSONTable>,\n    options: TableTileSourceOptions\n  ): TableVectorTileSource {\n    const needsLoading = typeof url === 'string' || url instanceof Blob;\n    const loader = options?.core?.loaders?.[0] as LoaderWithParser;\n    const tablePromise = needsLoading ? loadTable(url, loader) : url;\n    return new TableVectorTileSource(tablePromise, options);\n  }\n} as const satisfies Source<TableVectorTileSource>;\n\n/**\n * Dynamically vector tiles a table (the table needs a geometry column)\n * - Tiles are generated when requested.\n * - Each tile contains a tables of clipped features.\n *\n * @note - Currently only accepts `GeoJSONTable` tables\n * @note - Currently only outputs `GeoJSONTable`\n * @note - (can be initialized with a promise that resolves to GeoJSONTable).\n *\n * @todo - metadata should scan all rows to determine schema\n * @todo - metadata scan all rows to determine tilestats (field values[] etc).\n * @todo - handle binary input tables\n * @todo - generate binary output tables\n * @todo - how does TileSourceLayer specify coordinates / decided which layer to render with\n */\nexport class TableVectorTileSource\n  extends DataSource<GeoJSONTable | Promise<GeoJSONTable>, TableTileSourceOptions>\n  implements VectorTileSource\n{\n  /** Global stats for all DynamicVectorTileSources */\n  static stats = new Stats({\n    id: 'table-tile-source-all',\n    stats: [new Stat('count', 'tiles'), new Stat('count', 'features')]\n  });\n\n  /** Stats for this TableVectorTileSource */\n  stats = new Stats({\n    id: 'table-tile-source',\n    stats: [new Stat('tiles', 'count'), new Stat('features', 'count')]\n  });\n\n  /** MIME type of the tiles emitted by this tile source */\n  readonly mimeType = 'application/vnd.mapbox-vector-tile';\n  readonly localCoordinates = true;\n  readonly tableOptions: Required<Required<TableTileSourceOptions>['table']>;\n\n  /* Schema of the data */\n  schema: Schema | null = null;\n\n  /** Map of generated tiles, indexed by stringified tile coordinates */\n  tiles: Record<string, ProtoTile> = {};\n  /** Array of tile coordinates */\n  tileCoords: {x: number; y: number; z: number}[] = [];\n\n  /** Input data has loaded, initial top-level tiling is done, sync methods can now be called */\n  ready: Promise<void>;\n  /** Metadata for the tile source (generated TileJSON/tilestats */\n  metadata: Promise<unknown>;\n\n  constructor(table: GeoJSONTable | Promise<GeoJSONTable>, options: TableTileSourceOptions) {\n    super(table, options, TableTileSource.defaultOptions);\n    this.tableOptions = getRequiredOptions(this.options).table;\n    this.getTileData = this.getTileData.bind(this);\n    this.ready = this.initializeTilesAsync(table);\n    this.metadata = this.getMetadata();\n  }\n\n  async initializeTilesAsync(tablePromise: GeoJSONTable | Promise<GeoJSONTable>): Promise<void> {\n    const table = await tablePromise;\n    this.schema = deduceTableSchema(table);\n    this.createRootTiles(table);\n  }\n\n  async getMetadata(): Promise<TileSourceMetadata & {schema: Schema | null}> {\n    await this.ready;\n    return {schema: this.schema, minZoom: 0, maxZoom: this.tableOptions.maxZoom};\n  }\n\n  async getSchema(): Promise<Schema> {\n    await this.ready;\n    return this.schema!;\n  }\n\n  /**\n   * Get a tile at the specified index\n   * @param tileIndex z, x, y of tile\n   * @returns\n   */\n  async getVectorTile(tileIndex: GetTileParameters): Promise<GeoJSONTable | null> {\n    await this.ready;\n    const table = this.getTileSync(tileIndex);\n    log.info(2, 'getVectorTile', tileIndex, table)();\n    return table;\n  }\n\n  async getTile(tileIndex: {z: number; x: number; y: number}): Promise<GeoJSONTable | null> {\n    await this.ready;\n    return this.getTileSync(tileIndex);\n  }\n\n  async getTileData(\n    tileParams: GetTileDataParameters\n  ): Promise<Feature[] | BinaryFeatureCollection> {\n    const {x, y, z} = tileParams.index;\n    const tile = await this.getVectorTile({x, y, z});\n    return tile?.features || [];\n  }\n\n  // Implementation\n\n  /**\n   * Synchronously request a tile\n   * @note Application must await `source.ready` before calling sync methods.\n   */\n  getTileSync(tileIndex: {z: number; x: number; y: number}): GeoJSONTable | null {\n    const protoTile = this.getProtoTile(tileIndex);\n    if (!protoTile) {\n      return null;\n    }\n\n    return convertTileToGeoJSON(protoTile, {\n      coordinates: this.tableOptions.coordinates,\n      tileIndex,\n      extent: this.tableOptions.extent\n    });\n  }\n\n  /**\n   * Create the initial tiles\n   * @note the tiles stores all the features together with additional data\n   */\n  createRootTiles(table: GeoJSONTable): void {\n    if (this.tableOptions.maxZoom < 0 || this.tableOptions.maxZoom > 24) {\n      throw new Error('maxZoom should be in the 0-24 range');\n    }\n    if (this.tableOptions.promoteId && this.tableOptions.generateId) {\n      throw new Error('promoteId and generateId cannot be used together.');\n    }\n\n    log.log(1, 'TableVectorTileSource creating root tiles', this.tableOptions)();\n\n    // projects and adds simplification info\n    log.time(1, 'preprocess table')();\n    let features = convertFeaturesToProtoFeature(table, this.tableOptions);\n    log.timeEnd(1, 'preprocess table')();\n\n    // wraps features (ie extreme west and extreme east)\n    log.time(1, 'generate tiles')();\n\n    features = wrapFeatures(features, this.tableOptions);\n\n    // start slicing from the top tile down\n    if (features.length === 0) {\n      log.log(1, 'TableVectorTileSource: no features generated')();\n      return;\n    }\n\n    this.splitTile(features, 0, 0, 0);\n\n    const rootTile = this.tiles[0];\n    log.log(1, `root tile features: ${rootTile.numFeatures}, points: ${rootTile.numPoints}`)();\n\n    log.timeEnd(1, 'generate tiles')();\n    log.log(\n      1,\n      `TableVectorTileSource: tiles generated: ${this.stats.get('total').count}`,\n      this.stats\n    )();\n  }\n\n  /**\n   * Return geojsonvt-style \"half formed\" vector tile\n   * @note Application must await `source.ready` before calling sync methods.\n   */\n  // eslint-disable-next-line complexity, max-statements\n  getProtoTile(tileIndex: {z: number; x: number; y: number}): ProtoTile | null {\n    const {z, y} = tileIndex;\n    let {x} = tileIndex;\n    // z = +z;\n    // x = +x;\n    // y = +y;\n\n    const {extent} = this.tableOptions;\n\n    if (z < 0 || z > 24) {\n      return null;\n    }\n\n    const z2 = 1 << z;\n    x = (x + z2) & (z2 - 1); // wrapFeatures tile x coordinate\n\n    const id = toID(z, x, y);\n    if (this.tiles[id]) {\n      return transformTile(this.tiles[id], extent);\n    }\n\n    log.log(log, 'drilling down to z%d-%d-%d', z, x, y)();\n\n    let z0 = z;\n    let x0 = x;\n    let y0 = y;\n    let parent;\n\n    while (!parent && z0 > 0) {\n      z0--;\n      x0 = x0 >> 1;\n      y0 = y0 >> 1;\n      parent = this.tiles[toID(z0, x0, y0)];\n    }\n\n    if (!parent || !parent.sourceFeatures) {\n      return null;\n    }\n\n    // if we found a parent tile containing the original geometry, we can drill down from it\n    log.log(1, 'found parent tile z%d-%d-%d', z0, x0, y0)();\n    log.time(1, 'drilling down')();\n\n    this.splitTile(parent.sourceFeatures, z0, x0, y0, z, x, y);\n\n    log.timeEnd(1, 'drilling down')();\n\n    return this.tiles[id] ? transformTile(this.tiles[id], extent) : null;\n  }\n\n  /**\n   * splits features from a parent tile to sub-tiles.\n   * @param z, x, and y are the coordinates of the parent tile\n   * @param cz, cx, and cy are the coordinates of the target tile\n   *\n   * If no target tile is specified, splitting stops when we reach the maximum\n   * zoom or the number of points is low as specified in the options.\n   */\n  // eslint-disable-next-line max-params, max-statements, complexity\n  splitTile(\n    features: ProtoFeature[],\n    z: number,\n    x: number,\n    y: number,\n    cz?: number,\n    cx?: number,\n    cy?: number\n  ): void {\n    const stack: any[] = [features, z, x, y];\n\n    // avoid recursion by using a processing queue\n    while (stack.length) {\n      y = stack.pop();\n      x = stack.pop();\n      z = stack.pop();\n      features = stack.pop();\n\n      const z2 = 1 << z;\n      const id = toID(z, x, y);\n      let tile = this.tiles[id];\n\n      if (!tile) {\n        log.time(2, 'tile creation')();\n\n        tile = this.tiles[id] = createProtoTile(features, z, x, y, this.tableOptions);\n        this.tileCoords.push({z, x, y});\n\n        const key = `z${z}`;\n        let stat = this.stats.get(key, 'count');\n        stat.incrementCount();\n\n        stat = this.stats.get('total');\n        stat.incrementCount();\n\n        stat = TableVectorTileSource.stats.get(key, 'count');\n        stat.incrementCount();\n\n        stat = TableVectorTileSource.stats.get('total');\n        stat.incrementCount();\n\n        log.log(\n          2,\n          'tile z%d-%d-%d (features: %d, points: %d, simplified: %d)',\n          z,\n          x,\n          y,\n          tile.numFeatures,\n          tile.numPoints,\n          tile.numSimplified\n        )();\n        log.timeEnd(2, 'tile creation')();\n      }\n\n      // save reference to original geometry in tile so that we can drill down later if we stop now\n      tile.sourceFeatures = features;\n\n      /* eslint-disable no-continue */\n\n      // if it's the first-pass tiling\n      if (cz === undefined) {\n        // stop tiling if we reached max zoom, or if the tile is too simple\n        if (\n          z === this.tableOptions.indexMaxZoom ||\n          tile.numPoints <= this.tableOptions.maxPointsPerTile\n        ) {\n          continue;\n        }\n        // if a drilldown to a specific tile\n      } else if (z === this.tableOptions.maxZoom || z === cz) {\n        // stop tiling if we reached base zoom or our target tile zoom\n        continue;\n      } else if (cz !== undefined) {\n        // stop tiling if it's not an ancestor of the target tile\n        const zoomSteps = cz - z;\n        // @ts-expect-error TODO fix the types of cx cy\n        if (x !== cx >> zoomSteps || y !== cy >> zoomSteps) {\n          continue;\n        }\n      }\n\n      // if we slice further down, no need to keep source geometry\n      tile.sourceFeatures = null;\n\n      if (features.length === 0) continue;\n\n      log.time(2, 'clipping tile')();\n\n      // values we'll use for clipping\n      const k1 = (0.5 * this.tableOptions.buffer) / this.tableOptions.extent;\n      const k2 = 0.5 - k1;\n      const k3 = 0.5 + k1;\n      const k4 = 1 + k1;\n\n      let tl: ProtoFeature[] | null = null;\n      let bl: ProtoFeature[] | null = null;\n      let tr: ProtoFeature[] | null = null;\n      let br: ProtoFeature[] | null = null;\n\n      let left = clipFeatures(\n        features,\n        z2,\n        x - k1,\n        x + k3,\n        0,\n        tile.minX,\n        tile.maxX,\n        this.tableOptions\n      );\n      let right = clipFeatures(\n        features,\n        z2,\n        x + k2,\n        x + k4,\n        0,\n        tile.minX,\n        tile.maxX,\n        this.tableOptions\n      );\n\n      // @ts-expect-error - unclear why this is needed?\n      features = null;\n\n      if (left) {\n        tl = clipFeatures(left, z2, y - k1, y + k3, 1, tile.minY, tile.maxY, this.tableOptions);\n        bl = clipFeatures(left, z2, y + k2, y + k4, 1, tile.minY, tile.maxY, this.tableOptions);\n        left = null;\n      }\n\n      if (right) {\n        tr = clipFeatures(right, z2, y - k1, y + k3, 1, tile.minY, tile.maxY, this.tableOptions);\n        br = clipFeatures(right, z2, y + k2, y + k4, 1, tile.minY, tile.maxY, this.tableOptions);\n        right = null;\n      }\n\n      log.timeEnd(2, 'clipping tile')();\n\n      stack.push(tl || [], z + 1, x * 2, y * 2);\n      stack.push(bl || [], z + 1, x * 2, y * 2 + 1);\n      stack.push(tr || [], z + 1, x * 2 + 1, y * 2);\n      stack.push(br || [], z + 1, x * 2 + 1, y * 2 + 1);\n    }\n  }\n}\n\nfunction toID(z, x, y): number {\n  return ((1 << z) * y + x) * 32 + z;\n}\n\nasync function loadTable(url: string | Blob, loader: LoaderWithParser): Promise<GeoJSONTable> {\n  if (typeof url === 'string') {\n    const response = await fetch(url);\n    const data = await response.arrayBuffer();\n    return (await loader.parse(data)) as GeoJSONTable;\n  }\n\n  const data = await url.arrayBuffer();\n  return (await loader.parse(data)) as GeoJSONTable; //  options.loaders, options.loadOptions)\n}\n\n/*\n\n// eslint-disable-next-line max-statements, complexity\nfunction convertToGeoJSONTable(\n  vtTile: ProtoTile,\n  options: {\n    coordinates: 'local' | 'wgs84' | 'EPSG:4326';\n    tileIndex: {x: number; y: number; z: number};\n    extent: number;\n  }\n): GeoJSONTable | null {\n  const features: Feature[] = [];\n  for (const rawFeature of vtTile.features) {\n    if (!rawFeature || !rawFeature.geometry) {\n      continue;\n    }\n\n    let type:\n      | 'Point'\n      | 'MultiPoint'\n      | 'LineString'\n      | 'MultiLineString'\n      | 'Polygon'\n      | 'MultiPolygon';\n\n    let coordinates: any;\n\n    // raw geometry\n    switch (rawFeature.type) {\n      case 1:\n        if (rawFeature.geometry.length === 1) {\n          type = 'Point';\n          coordinates = rawFeature.geometry[0];\n        } else {\n          type = 'MultiPoint';\n          coordinates = rawFeature.geometry;\n        }\n        break;\n      case 2:\n        if (rawFeature.geometry.length === 1) {\n          type = 'LineString';\n          coordinates = rawFeature.geometry[0];\n        } else {\n          type = 'MultiLineString';\n          coordinates = rawFeature.geometry;\n        }\n        break;\n      case 3:\n        if (rawFeature.geometry.length > 1) {\n          type = 'MultiPolygon';\n          coordinates = [rawFeature.geometry];\n        } else {\n          type = 'Polygon';\n          coordinates = rawFeature.geometry;\n        }\n        break;\n      default:\n        continue;\n    }\n\n    switch (options.coordinates) {\n      case 'EPSG:4326':\n      case 'wgs84':\n        projectToLngLat(coordinates, options.tileIndex, options.extent);\n        break;\n\n      case 'local':\n        convertToLocalCoordinates(coordinates, options.extent);\n        break;\n\n      default:\n        throw new Error(`Unsupported CRS ${options.coordinates}`);\n    }\n\n    const feature: Feature = {\n      type: 'Feature',\n      geometry: {\n        type,\n        coordinates\n      },\n      properties: rawFeature.tags || {},\n      id: rawFeature.id\n    };\n\n    features.push(feature);\n  }\n\n  if (features.length === 0) {\n    return null;\n  }\n\n  const table: GeoJSONTable = {\n    shape: 'geojson-table',\n    type: 'FeatureCollection',\n    features\n  };\n\n  return table;\n}\n*/\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Forked from https://github.com/mapbox/geojson-vt under compatible ISC license\n\nimport type {ProtoFeature} from './features/proto-feature';\n\nexport type ProtoTile = {\n  /** Processed features */\n  protoFeatures: ProtoFeature[];\n  /** if we slice further down, no need to keep source geometry */\n  sourceFeatures: ProtoFeature[] | null;\n\n  /** Properties */\n  tags?: Record<string, string>;\n\n  /** tile x coordinate */\n  x: number;\n  /** tile y coordinate */\n  y: number;\n  /** tile z coordinate */\n  z: number;\n\n  /** spatial extent */\n  minX: number;\n  /** spatial extent */\n  maxX: number;\n  /** spatial extent */\n  minY: number;\n  /** spatial extent */\n  maxY: number;\n\n  /** Whether this tile has been transformed */\n  transformed: boolean;\n  numPoints: number;\n  numSimplified: number;\n  /** Number of features in this tile */\n  numFeatures: number;\n};\n\nexport type CreateTileOptions = {\n  maxZoom?: number;\n  tolerance: number;\n  extent: number;\n  lineMetrics: boolean;\n};\n\n/**\n * Create a tile from features and tile index\n */\nexport function createProtoTile(\n  features: ProtoFeature[],\n  z,\n  tx,\n  ty,\n  options: CreateTileOptions\n): ProtoTile {\n  const tolerance = z === options.maxZoom ? 0 : options.tolerance / ((1 << z) * options.extent);\n  const tile: ProtoTile = {\n    protoFeatures: [],\n    sourceFeatures: null,\n    numPoints: 0,\n    numSimplified: 0,\n    numFeatures: features.length,\n    x: tx,\n    y: ty,\n    z,\n    transformed: false,\n    minX: 2,\n    minY: 1,\n    maxX: -1,\n    maxY: 0\n  };\n  for (const feature of features) {\n    addProtoFeature(tile, feature, tolerance, options);\n  }\n  return tile;\n}\n\n// eslint-disable-next-line complexity, max-statements\nfunction addProtoFeature(\n  tile: ProtoTile,\n  feature: ProtoFeature,\n  tolerance: number,\n  options: CreateTileOptions\n) {\n  const geometry = feature.geometry;\n  const type = feature.type;\n  const simplifiedGeometry: number[] = [];\n\n  tile.minX = Math.min(tile.minX, feature.minX);\n  tile.minY = Math.min(tile.minY, feature.minY);\n  tile.maxX = Math.max(tile.maxX, feature.maxX);\n  tile.maxY = Math.max(tile.maxY, feature.maxY);\n\n  let simplifiedType: 1 | 2 | 3;\n  switch (type) {\n    case 'Point':\n    case 'MultiPoint':\n      simplifiedType = 1;\n      for (let i = 0; i < geometry.length; i += 3) {\n        simplifiedGeometry.push(geometry[i], geometry[i + 1]);\n        tile.numPoints++;\n        tile.numSimplified++;\n      }\n      break;\n\n    case 'LineString':\n      simplifiedType = 2;\n      addProtoLine(simplifiedGeometry, geometry, tile, tolerance, false, false);\n      break;\n\n    case 'MultiLineString':\n      simplifiedType = 2;\n      for (let i = 0; i < geometry.length; i++) {\n        addProtoLine(simplifiedGeometry, geometry[i], tile, tolerance, false, i === 0);\n      }\n      break;\n\n    case 'Polygon':\n      simplifiedType = 3;\n      for (let i = 0; i < geometry.length; i++) {\n        addProtoLine(simplifiedGeometry, geometry[i], tile, tolerance, true, i === 0);\n      }\n      break;\n\n    case 'MultiPolygon':\n      simplifiedType = 3;\n      for (let k = 0; k < geometry.length; k++) {\n        const polygon = geometry[k];\n        for (let i = 0; i < polygon.length; i++) {\n          addProtoLine(simplifiedGeometry, polygon[i], tile, tolerance, true, i === 0);\n        }\n      }\n      break;\n\n    default:\n      throw new Error(`Unknown geometry type: ${type}`);\n  }\n\n  if (simplifiedGeometry.length) {\n    let tags: Record<string, unknown> | null = feature.tags || null;\n\n    if (type === 'LineString' && options.lineMetrics) {\n      tags = {};\n      for (const key in feature.tags) {\n        tags[key] = feature.tags[key];\n      }\n      // @ts-expect-error adding fields to arrays\n      // eslint-disable-next-line camelcase\n      tags.mapbox_clip_start = geometry.start / geometry.size;\n      // @ts-expect-error adding fields to arrays\n      // eslint-disable-next-line camelcase\n      tags.mapbox_clip_end = geometry.end / geometry.size;\n    }\n\n    const tileFeature: ProtoFeature = {\n      geometry: simplifiedGeometry,\n      simplifiedType,\n      // @ts-expect-error\n      tags\n    };\n    if (feature.id !== null) {\n      tileFeature.id = feature.id;\n    }\n\n    tile.protoFeatures.push(tileFeature);\n  }\n}\n\n// eslint-disable-next-line max-params, max-statements\nfunction addProtoLine(\n  result: any[],\n  geometry: any,\n  tile: ProtoTile,\n  tolerance: number,\n  isPolygon: boolean,\n  isOuter: boolean\n): void {\n  const sqTolerance = tolerance * tolerance;\n\n  if (tolerance > 0 && geometry.size < (isPolygon ? sqTolerance : tolerance)) {\n    tile.numPoints += geometry.length / 3;\n    return;\n  }\n\n  const ring: number[] = [];\n\n  for (let i = 0; i < geometry.length; i += 3) {\n    if (tolerance === 0 || geometry[i + 2] > sqTolerance) {\n      tile.numSimplified++;\n      ring.push(geometry[i], geometry[i + 1]);\n    }\n    tile.numPoints++;\n  }\n\n  if (isPolygon) rewind(ring, isOuter);\n\n  result.push(ring);\n}\n\nfunction rewind(ring: number[], clockwise?: boolean): void {\n  let area = 0;\n  for (let i = 0, j = ring.length - 2; i < ring.length; j = i, i += 2) {\n    area += (ring[i] - ring[j]) * (ring[i + 1] + ring[j + 1]);\n  }\n  if (area > 0 === clockwise) {\n    for (let i = 0, len = ring.length; i < len / 2; i += 2) {\n      const x = ring[i];\n      const y = ring[i + 1];\n      ring[i] = ring[len - 2 - i];\n      ring[i + 1] = ring[len - 1 - i];\n      ring[len - 2 - i] = x;\n      ring[len - 1 - i] = y;\n    }\n  }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Forked from https://github.com/mapbox/geojson-vt under compatible ISC license\n\nimport type {ProtoTile} from './proto-tile';\n\n/**\n * Transforms the coordinates of each protoFeature in the given protoTile from\n * mercator-projected space into (extent x extent) protoTile space.\n */\nexport function transformTile(protoTile: ProtoTile, extent: number): ProtoTile {\n  if (protoTile.transformed) {\n    return protoTile;\n  }\n\n  const z2 = 1 << protoTile.z;\n  const tx = protoTile.x;\n  const ty = protoTile.y;\n\n  for (const protoFeature of protoTile.protoFeatures) {\n    const geom = protoFeature.geometry;\n    const simplifiedType = protoFeature.simplifiedType;\n\n    protoFeature.geometry = [];\n\n    if (simplifiedType === 1) {\n      for (let j = 0; j < geom.length; j += 2) {\n        protoFeature.geometry.push(transformPoint(geom[j], geom[j + 1], extent, z2, tx, ty));\n      }\n    } else {\n      for (let j = 0; j < geom.length; j++) {\n        const ring: number[][] = [];\n        for (let k = 0; k < geom[j].length; k += 2) {\n          ring.push(transformPoint(geom[j][k], geom[j][k + 1], extent, z2, tx, ty));\n        }\n        protoFeature.geometry.push(ring);\n      }\n    }\n  }\n\n  protoTile.transformed = true;\n\n  return protoTile;\n}\n\n// eslint-disable-next-line max-params\nfunction transformPoint(\n  x: number,\n  y: number,\n  extent: number,\n  z2: number,\n  tx: number,\n  ty: number\n): number[] {\n  return [Math.round(extent * (x * z2 - tx)), Math.round(extent * (y * z2 - ty))];\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Forked from https://github.com/mapbox/geojson-vt under compatible ISC license\n\nimport {ProtoTile} from './proto-tile';\nimport {Feature, GeoJSONTable} from '@loaders.gl/schema';\n\nimport {projectToLngLat, convertToLocalCoordinates} from '../utils/geometry-utils';\n\n// eslint-disable-next-line max-statements, complexity\nexport function convertTileToGeoJSON(\n  protoTile: ProtoTile,\n  props: {\n    coordinates: 'EPSG:4326' | 'wgs84' | 'local';\n    tileIndex: {x: number; y: number; z: number};\n    extent: number;\n  }\n): GeoJSONTable | null {\n  const features: Feature[] = [];\n  for (const rawFeature of protoTile.protoFeatures) {\n    if (!rawFeature || !rawFeature.geometry) {\n      // eslint-disable-next-line no-continue\n      continue;\n    }\n\n    let type:\n      | 'Point'\n      | 'MultiPoint'\n      | 'LineString'\n      | 'MultiLineString'\n      | 'Polygon'\n      | 'MultiPolygon';\n\n    let coordinates: any;\n\n    // raw geometry\n    switch (rawFeature.simplifiedType) {\n      case 1:\n        if (rawFeature.geometry.length === 1) {\n          type = 'Point';\n          coordinates = rawFeature.geometry[0];\n        } else {\n          type = 'MultiPoint';\n          coordinates = rawFeature.geometry;\n        }\n        break;\n      case 2:\n        if (rawFeature.geometry.length === 1) {\n          type = 'LineString';\n          coordinates = rawFeature.geometry[0];\n        } else {\n          type = 'MultiLineString';\n          coordinates = rawFeature.geometry;\n        }\n        break;\n      case 3:\n        if (rawFeature.geometry.length > 1) {\n          type = 'MultiPolygon';\n          coordinates = [rawFeature.geometry];\n        } else {\n          type = 'Polygon';\n          coordinates = rawFeature.geometry;\n        }\n        break;\n      default:\n        throw new Error(`${rawFeature.simplifiedType}is not a valid simplified type`);\n    }\n\n    switch (props.coordinates) {\n      case 'EPSG:4326':\n      case 'wgs84':\n        projectToLngLat(coordinates, props.tileIndex, props.extent);\n        break;\n      default:\n        convertToLocalCoordinates(coordinates, props.extent);\n        break;\n    }\n\n    const feature: Feature = {\n      type: 'Feature',\n      geometry: {\n        type,\n        coordinates\n      },\n      properties: rawFeature.tags || {},\n      id: rawFeature.id\n    };\n\n    features.push(feature);\n  }\n\n  if (features.length === 0) {\n    return null;\n  }\n\n  const table: GeoJSONTable = {\n    shape: 'geojson-table',\n    type: 'FeatureCollection',\n    features\n  };\n\n  return table;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Forked from https://github.com/mapbox/geojson-vt under compatible ISC license\n\nexport type ProtoFeature = {\n  type: 'Point' | 'MultiPoint' | 'LineString' | 'MultiLineString' | 'Polygon' | 'MultiPolygon';\n  simplifiedType: 1 | 2 | 3;\n  geometry: any[];\n\n  // book keeping\n  id?: string;\n  tags?: Record<string, unknown>;\n\n  /** spatial extents */\n  minX: number;\n  /** spatial extents */\n  maxX: number;\n  /** spatial extents */\n  minY: number;\n  /** spatial extents */\n  maxY: number;\n};\n\nexport type GeoJSONTileGeometry =\n  | GeoJSONTilePointGeometry\n  | GeoJSONTileLineGeometry\n  | GeoJSONTilePolygonGeometry;\n\nexport type GeoJSONTilePointGeometry = {\n  simplifiedType: 1;\n  geometry: number[];\n};\n\nexport type GeoJSONTileLineGeometry = {\n  simplifiedType: 1;\n  geometry: number[][];\n};\n\nexport type GeoJSONTilePolygonGeometry = {\n  simplifiedType: 1;\n  geometry: number[][][];\n};\n\nexport function createProtoFeature(\n  id: any,\n  type: 'Point' | 'MultiPoint' | 'LineString' | 'MultiLineString' | 'Polygon' | 'MultiPolygon',\n  geometry: any[],\n  tags\n): ProtoFeature {\n  const feature: ProtoFeature = {\n    // eslint-disable-next-line\n    id: id == null ? null : id,\n    type,\n    simplifiedType: undefined!, // TODO\n    geometry,\n    tags,\n    minX: Infinity,\n    minY: Infinity,\n    maxX: -Infinity,\n    maxY: -Infinity\n  };\n\n  // TODO break out into separate function\n  switch (type) {\n    case 'Point':\n    case 'MultiPoint':\n    case 'LineString':\n      calcLineBBox(feature, geometry);\n      break;\n\n    case 'MultiLineString':\n      for (const line of geometry) {\n        calcLineBBox(feature, line);\n      }\n      break;\n\n    case 'Polygon':\n      // the outer ring (ie [0]) contains all inner rings\n      calcLineBBox(feature, geometry[0]);\n      break;\n\n    case 'MultiPolygon':\n      for (const polygon of geometry) {\n        // the outer ring (ie [0]) contains all inner rings\n        calcLineBBox(feature, polygon[0]);\n      }\n      break;\n\n    default:\n      throw new Error(String(type));\n  }\n\n  return feature;\n}\n\nfunction calcLineBBox(feature, geometry) {\n  for (let i = 0; i < geometry.length; i += 3) {\n    feature.minX = Math.min(feature.minX, geometry[i]);\n    feature.minY = Math.min(feature.minY, geometry[i + 1]);\n    feature.maxX = Math.max(feature.maxX, geometry[i]);\n    feature.maxY = Math.max(feature.maxY, geometry[i + 1]);\n  }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Forked from https://github.com/mapbox/geojson-vt under compatible ISC license\n\n/**\n * Calculate simplification data using optimized Douglas-Peucker algorithm\n *\n * @param coords contiguous list of coordinates\n * @param first first coord to simplify\n * @param last last coord to simplify\n * @param sqTolerance tolerance (square distance)\n */\nexport function simplifyPath(\n  coords: number[],\n  first: number,\n  last: number,\n  sqTolerance: number\n): void {\n  let maxSqDist = sqTolerance;\n  const mid = (last - first) >> 1;\n  let minPosToMid = last - first;\n  let index;\n\n  const ax = coords[first];\n  const ay = coords[first + 1];\n  const bx = coords[last];\n  const by = coords[last + 1];\n\n  for (let i = first + 3; i < last; i += 3) {\n    const d = getSqSegDist(coords[i], coords[i + 1], ax, ay, bx, by);\n\n    if (d > maxSqDist) {\n      index = i;\n      maxSqDist = d;\n    } else if (d === maxSqDist) {\n      // a workaround to ensure we choose a pivot close to the middle of the list,\n      // reducing recursion depth, for certain degenerate inputs\n      // https://github.com/mapbox/geojson-vt/issues/104\n      const posToMid = Math.abs(i - mid);\n      if (posToMid < minPosToMid) {\n        index = i;\n        minPosToMid = posToMid;\n      }\n    }\n  }\n\n  if (maxSqDist > sqTolerance) {\n    if (index - first > 3) simplifyPath(coords, first, index, sqTolerance);\n    coords[index + 2] = maxSqDist;\n    if (last - index > 3) simplifyPath(coords, index, last, sqTolerance);\n  }\n}\n\n/** square distance from a point to a segment */\n// eslint-disable-next-line max-params\nfunction getSqSegDist(\n  px: number,\n  py: number,\n  x: number,\n  y: number,\n  bx: number,\n  by: number\n): number {\n  let dx = bx - x;\n  let dy = by - y;\n\n  if (dx !== 0 || dy !== 0) {\n    const t = ((px - x) * dx + (py - y) * dy) / (dx * dx + dy * dy);\n\n    if (t > 1) {\n      x = bx;\n      y = by;\n    } else if (t > 0) {\n      x += dx * t;\n      y += dy * t;\n    }\n  }\n\n  dx = px - x;\n  dy = py - y;\n\n  return dx * dx + dy * dy;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Forked from https://github.com/mapbox/geojson-vt under compatible ISC license\n\n/* eslint-disable */\n// @ts-nocheck\n\nimport type {Feature, FeatureCollection} from '@loaders.gl/schema';\nimport type {ProtoFeature} from './proto-feature';\n\nimport {createProtoFeature} from './proto-feature';\nimport {simplifyPath} from './simplify-path';\n\nexport type ConvertFeatureOptions = {\n  /** max zoom to preserve detail on */\n  maxZoom?: number;\n  /** simplification tolerance (higher means simpler) */\n  tolerance?: number;\n  /** tile extent */\n  extent?: number;\n  /** whether to calculate line metrics */\n  lineMetrics?: boolean;\n};\n\n/**\n * converts a GeoJSON feature into an intermediate projected JSON vector format\n * with simplification data\n */\nexport function convertFeaturesToProtoFeature(\n  data: Feature | FeatureCollection,\n  options: ConvertFeatureOptions\n): ProtoFeature[] {\n  const protoFeatures = [];\n  switch (data.type) {\n    case 'FeatureCollection':\n      let i = 0;\n      for (const feature of data.features) {\n        protoFeatures.push(convertFeature(feature, options, i++));\n      }\n      break;\n    case 'Feature':\n      protoFeatures.push(convertFeature(data, options));\n      break;\n    default:\n      // single geometry or a geometry collection\n      protoFeatures.push(convertFeature({geometry: data}, options));\n  }\n\n  return protoFeatures;\n}\n\n/**\n * converts a GeoJSON feature into an intermediate projected JSON vector format\n * with simplification data\n */\nfunction convertFeature(\n  geojson: Feature,\n  options: ConvertFeatureOptions,\n  index: number\n): ProtoFeature {\n  // GeoJSON geometries can be null, but no vector tile will include them.\n  if (!geojson.geometry) {\n    return;\n  }\n\n  const coords = geojson.geometry.coordinates;\n  const type = geojson.geometry.type;\n  const tolerance = Math.pow(options.tolerance / ((1 << options.maxZoom) * options.extent), 2);\n  let geometry = [];\n  let id = geojson.id;\n  if (options.promoteId) {\n    id = geojson.properties[options.promoteId];\n  } else if (options.generateId) {\n    id = index || 0;\n  }\n\n  switch (type) {\n    case 'Point':\n      convertPoint(coords, geometry);\n      break;\n\n    case 'MultiPoint':\n      for (const p of coords) {\n        convertPoint(p, geometry);\n      }\n      break;\n\n    case 'LineString':\n      convertLine(coords, geometry, tolerance, false);\n      break;\n\n    case 'MultiLineString':\n      if (options.lineMetrics) {\n        // explode into linestrings to be able to track metrics\n        for (const line of coords) {\n          geometry = [];\n          convertLine(line, geometry, tolerance, false);\n          features.push(createProtoFeature(id, 'LineString', geometry, geojson.properties));\n        }\n        return;\n        convertLines(coords, geometry, tolerance, false);\n      }\n      break;\n\n    case 'Polygon':\n      convertLines(coords, geometry, tolerance, true);\n      break;\n\n    case 'MultiPolygon':\n      for (const polygon of coords) {\n        const newPolygon = [];\n        convertLines(polygon, newPolygon, tolerance, true);\n        geometry.push(newPolygon);\n      }\n      break;\n\n    case 'GeometryCollection':\n      for (const singleGeometry of geojson.geometry.geometries) {\n        convertFeature(\n          features,\n          {\n            id,\n            geometry: singleGeometry,\n            properties: geojson.properties\n          },\n          options,\n          index\n        );\n      }\n      break;\n\n    default:\n      throw new Error('Input data is not a valid GeoJSON object.');\n  }\n\n  return createProtoFeature(id, type, geometry, geojson.properties);\n}\n\nfunction convertPoint(coords, out): void {\n  out.push(projectX(coords[0]), projectY(coords[1]), 0);\n}\n\nfunction convertLine(ring: number[], out, tolerance: number, isPolygon: boolean): void {\n  let x0, y0;\n  let size = 0;\n\n  for (let j = 0; j < ring.length; j++) {\n    const x = projectX(ring[j][0]);\n    const y = projectY(ring[j][1]);\n\n    out.push(x, y, 0);\n\n    if (j > 0) {\n      if (isPolygon) {\n        size += (x0 * y - x * y0) / 2; // area\n      } else {\n        size += Math.sqrt(Math.pow(x - x0, 2) + Math.pow(y - y0, 2)); // length\n      }\n    }\n    x0 = x;\n    y0 = y;\n  }\n\n  const last = out.length - 3;\n  out[2] = 1;\n  simplifyPath(out, 0, last, tolerance);\n  out[last + 2] = 1;\n\n  out.size = Math.abs(size);\n  out.start = 0;\n  out.end = out.size;\n}\n\nfunction convertLines(rings: number[][], out, tolerance: number, isPolygon: boolean): void {\n  for (let i = 0; i < rings.length; i++) {\n    const geom = [];\n    convertLine(rings[i], geom, tolerance, isPolygon);\n    out.push(geom);\n  }\n}\n\nfunction projectX(x: number): number {\n  return x / 360 + 0.5;\n}\n\nfunction projectY(y: number): number {\n  const sin = Math.sin((y * Math.PI) / 180);\n  const y2 = 0.5 - (0.25 * Math.log((1 + sin) / (1 - sin))) / Math.PI;\n  return y2 < 0 ? 0 : y2 > 1 ? 1 : y2;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Forked from https://github.com/mapbox/geojson-vt under compatible ISC license\n\nimport type {ProtoFeature} from './proto-feature';\nimport {createProtoFeature} from './proto-feature';\n\n/* eslint-disable no-continue */\n\n/**\n * Clip features between two vertical or horizontal axis-parallel lines:\n *     |        |\n *  ___|___     |     /\n * /   |   \\____|____/\n *     |        |\n *\n * @param k1 and k2 are the line coordinates\n * @param axis: 0 for x, 1 for y\n * @param minAll and maxAll: minimum and maximum coordinate value for all features\n */\n// eslint-disable-next-line max-params, complexity, max-statements\nexport function clipFeatures(\n  features: ProtoFeature[],\n  scale: number,\n  k1: number,\n  k2: number,\n  axis,\n  minAll: number,\n  maxAll: number,\n  options: {lineMetrics: boolean}\n): ProtoFeature[] | null {\n  k1 /= scale;\n  k2 /= scale;\n\n  if (minAll >= k1 && maxAll < k2) {\n    return features;\n  }\n  // trivial accept\n  else if (maxAll < k1 || minAll >= k2) {\n    return null; // trivial reject\n  }\n\n  const clipped: ProtoFeature[] = [];\n\n  for (const feature of features) {\n    const geometry = feature.geometry;\n    let type = feature.type;\n\n    const min = axis === 0 ? feature.minX : feature.minY;\n    const max = axis === 0 ? feature.maxX : feature.maxY;\n\n    if (min >= k1 && max < k2) {\n      // trivial accept\n      clipped.push(feature);\n      continue;\n    } else if (max < k1 || min >= k2) {\n      // trivial reject\n      continue;\n    }\n\n    let newGeometry: number[][][] | number[][] = [];\n\n    if (type === 'Point' || type === 'MultiPoint') {\n      clipPoints(geometry, newGeometry, k1, k2, axis);\n    } else if (type === 'LineString') {\n      clipLine(geometry, newGeometry, k1, k2, axis, false, options.lineMetrics);\n    } else if (type === 'MultiLineString') {\n      clipLines(geometry, newGeometry, k1, k2, axis, false);\n    } else if (type === 'Polygon') {\n      clipLines(geometry, newGeometry, k1, k2, axis, true);\n    } else if (type === 'MultiPolygon') {\n      for (const polygon of geometry) {\n        const newPolygon = [];\n        clipLines(polygon, newPolygon, k1, k2, axis, true);\n        if (newPolygon.length) {\n          newGeometry.push(newPolygon);\n        }\n      }\n    }\n\n    if (newGeometry.length) {\n      if (options.lineMetrics && type === 'LineString') {\n        for (const line of newGeometry) {\n          clipped.push(createProtoFeature(feature.id, type, line, feature.tags));\n        }\n        continue;\n      }\n\n      if (type === 'LineString' || type === 'MultiLineString') {\n        if (newGeometry.length === 1) {\n          type = 'LineString';\n          // @ts-expect-error TODO - use proper GeoJSON geometry types\n          newGeometry = newGeometry[0];\n        } else {\n          type = 'MultiLineString';\n        }\n      }\n      if (type === 'Point' || type === 'MultiPoint') {\n        type = newGeometry.length === 3 ? 'Point' : 'MultiPoint';\n      }\n\n      clipped.push(createProtoFeature(feature.id, type, newGeometry, feature.tags));\n    }\n  }\n\n  return clipped.length ? clipped : null;\n}\n\nfunction clipPoints(geom, newGeom, k1: number, k2: number, axis): void {\n  for (let i = 0; i < geom.length; i += 3) {\n    const a = geom[i + axis];\n\n    if (a >= k1 && a <= k2) {\n      addPoint(newGeom, geom[i], geom[i + 1], geom[i + 2]);\n    }\n  }\n}\n\n// eslint-disable-next-line max-params, complexity, max-statements\nfunction clipLine(\n  geom,\n  newGeom,\n  k1: number,\n  k2: number,\n  axis,\n  isPolygon: boolean,\n  trackMetrics: boolean\n): void {\n  let slice = newSlice(geom);\n  const intersect = axis === 0 ? intersectX : intersectY;\n  let len = geom.start;\n  let segLen;\n  let t;\n\n  for (let i = 0; i < geom.length - 3; i += 3) {\n    const ax = geom[i];\n    const ay = geom[i + 1];\n    const az = geom[i + 2];\n    const bx = geom[i + 3];\n    const by = geom[i + 4];\n    const a = axis === 0 ? ax : ay;\n    const b = axis === 0 ? bx : by;\n    let exited = false;\n\n    if (trackMetrics) {\n      segLen = Math.sqrt(Math.pow(ax - bx, 2) + Math.pow(ay - by, 2));\n    }\n\n    if (a < k1) {\n      // ---|-->  | (line enters the clip region from the left)\n      if (b > k1) {\n        t = intersect(slice, ax, ay, bx, by, k1);\n        if (trackMetrics) {\n          slice.start = len + segLen * t;\n        }\n      }\n    } else if (a > k2) {\n      // |  <--|--- (line enters the clip region from the right)\n      if (b < k2) {\n        t = intersect(slice, ax, ay, bx, by, k2);\n        if (trackMetrics) {\n          slice.start = len + segLen * t;\n        }\n      }\n    } else {\n      addPoint(slice, ax, ay, az);\n    }\n    if (b < k1 && a >= k1) {\n      // <--|---  | or <--|-----|--- (line exits the clip region on the left)\n      t = intersect(slice, ax, ay, bx, by, k1);\n      exited = true;\n    }\n    if (b > k2 && a <= k2) {\n      // |  ---|--> or ---|-----|--> (line exits the clip region on the right)\n      t = intersect(slice, ax, ay, bx, by, k2);\n      exited = true;\n    }\n\n    if (!isPolygon && exited) {\n      if (trackMetrics) {\n        slice.end = len + segLen * t;\n      }\n      newGeom.push(slice);\n      slice = newSlice(geom);\n    }\n\n    if (trackMetrics) {\n      len += segLen;\n    }\n  }\n\n  // add the last point\n  let last = geom.length - 3;\n  const ax = geom[last];\n  const ay = geom[last + 1];\n  const az = geom[last + 2];\n  const a = axis === 0 ? ax : ay;\n  if (a >= k1 && a <= k2) addPoint(slice, ax, ay, az);\n\n  // close the polygon if its endpoints are not the same after clipping\n  last = slice.length - 3;\n  if (isPolygon && last >= 3 && (slice[last] !== slice[0] || slice[last + 1] !== slice[1])) {\n    addPoint(slice, slice[0], slice[1], slice[2]);\n  }\n\n  // add the final slice\n  if (slice.length) {\n    newGeom.push(slice);\n  }\n}\n\nclass Slice extends Array<number> {\n  size?: number;\n  start?: number;\n  end?: number;\n}\n\nfunction newSlice(line: {size: number; start: number; end: number}): Slice {\n  const slice: Slice = [];\n  slice.size = line.size;\n  slice.start = line.start;\n  slice.end = line.end;\n  return slice;\n}\n\n// eslint-disable-next-line max-params\nfunction clipLines(geom, newGeom, k1: number, k2: number, axis, isPolygon: boolean): void {\n  for (const line of geom) {\n    clipLine(line, newGeom, k1, k2, axis, isPolygon, false);\n  }\n}\n\nfunction addPoint(out: number[], x: number, y: number, z: number): void {\n  out.push(x, y, z);\n}\n\n// eslint-disable-next-line max-params\nfunction intersectX(out, ax: number, ay: number, bx: number, by: number, x: number): number {\n  const t = (x - ax) / (bx - ax);\n  addPoint(out, x, ay + (by - ay) * t, 1);\n  return t;\n}\n\n// eslint-disable-next-line max-params\nfunction intersectY(out, ax: number, ay: number, bx: number, by: number, y): number {\n  const t = (y - ay) / (by - ay);\n  addPoint(out, ax + (bx - ax) * t, y, 1);\n  return t;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Forked from https://github.com/mapbox/geojson-vt under compatible ISC license\n\nimport type {ProtoFeature} from './proto-feature';\nimport {createProtoFeature} from './proto-feature';\nimport {clipFeatures} from './clip-features';\n\n/**\n * Options for wrap()\n */\nexport type WrapFeaturesOptions = {\n  buffer: number /** number of pixels of buffer for the tile */;\n  extent: number /** extent of each tile */;\n  lineMetrics: boolean;\n};\n\n/**\n * Wrap across antemeridian, by clipping into two tiles, shifting the overflowing x coordinates\n * @param list of features to be wrapped\n * @param options buffer and extent\n * @returns\n */\nexport function wrapFeatures(\n  features: ProtoFeature[],\n  options: WrapFeaturesOptions\n): ProtoFeature[] {\n  const buffer = options.buffer / options.extent;\n  let merged: ProtoFeature[] = features;\n  const left = clipFeatures(features, 1, -1 - buffer, buffer, 0, -1, 2, options); // left world copy\n  const right = clipFeatures(features, 1, 1 - buffer, 2 + buffer, 0, -1, 2, options); // right world copy\n\n  if (left || right) {\n    merged = clipFeatures(features, 1, -buffer, 1 + buffer, 0, -1, 2, options) || []; // center world copy\n\n    if (left) {\n      merged = shiftFeatureCoords(left, 1).concat(merged); // merge left into center\n    }\n    if (right) {\n      merged = merged.concat(shiftFeatureCoords(right, -1)); // merge right into center\n    }\n  }\n\n  return merged;\n}\n\n/**\n * Shift the x coordinates of a list of features\n * @param features list of features to shift x coordinates for\n * @param offset\n * @returns\n */\nfunction shiftFeatureCoords(features: ProtoFeature[], offset: number): ProtoFeature[] {\n  const newFeatures: ProtoFeature[] = [];\n\n  for (let i = 0; i < features.length; i++) {\n    const feature = features[i];\n    const type = feature.type;\n\n    let newGeometry;\n\n    switch (type) {\n      case 'Point':\n      case 'MultiPoint':\n      case 'LineString':\n        newGeometry = shiftCoords(feature.geometry, offset);\n        break;\n\n      case 'MultiLineString':\n      case 'Polygon':\n        newGeometry = [];\n        for (const line of feature.geometry) {\n          newGeometry.push(shiftCoords(line, offset));\n        }\n        break;\n\n      case 'MultiPolygon':\n        newGeometry = [];\n        for (const polygon of feature.geometry) {\n          const newPolygon: Points = [];\n          for (const line of polygon) {\n            // @ts-expect-error TODO\n            newPolygon.push(shiftCoords(line, offset));\n          }\n          newGeometry.push(newPolygon);\n        }\n        break;\n\n      default:\n        throw new Error(String(type));\n    }\n\n    newFeatures.push(createProtoFeature(feature.id, type, newGeometry, feature.tags));\n  }\n\n  return newFeatures;\n}\n\nclass Points extends Array<number> {\n  size?: number;\n  start?: number;\n  end?: number;\n}\n\n/**\n * Shift the x coordinate of every point\n * @param points\n * @param offset\n * @returns\n */\nfunction shiftCoords(points: Points, offset: number): Points {\n  const newPoints: Points = [];\n  newPoints.size = points.size;\n\n  if (points.start !== undefined) {\n    newPoints.start = points.start;\n    newPoints.end = points.end;\n  }\n\n  for (let i = 0; i < points.length; i += 3) {\n    newPoints.push(points[i] + offset, points[i + 1], points[i + 2]);\n  }\n  return newPoints;\n}\n"],
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;ACSM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;AACvF,aAAK,aAAa,OAAO,IAAI,IAAI,IAAI,IAAI,IAAI,GAAG,KAAK,MAAM,KAAK,MAAM,KAAK,YAAY;AACvF,gBAAQ;MACV;AAEA,+BAAI,QAAQ,GAAG,eAAe,EAAC;AAE/B,YAAM,KAAK,MAAM,CAAA,GAAI,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AACxC,YAAM,KAAK,MAAM,CAAA,GAAI,IAAI,GAAG,IAAI,GAAG,IAAI,IAAI,CAAC;AAC5C,YAAM,KAAK,MAAM,CAAA,GAAI,IAAI,GAAG,IAAI,IAAI,GAAG,IAAI,CAAC;AAC5C,YAAM,KAAK,MAAM,CAAA,GAAI,IAAI,GAAG,IAAI,IAAI,GAAG,IAAI,IAAI,CAAC;IAClD;EACF;;AA/VI,IAAO,wBAAP;;AAKJ,cALW,uBAKJ,SAAQ,IAAI,mBAAM;EACvB,IAAI;EACJ,OAAO,CAAC,IAAI,kBAAK,SAAS,OAAO,GAAG,IAAI,kBAAK,SAAS,UAAU,CAAC;CAClE;AA0VH,SAAS,KAAK,GAAG,GAAG,GAAC;AACnB,WAAS,KAAK,KAAK,IAAI,KAAK,KAAK;AACnC;AAEA,eAAe,UAAU,KAAoB,QAAwB;AACnE,MAAI,OAAO,QAAQ,UAAU;AAC3B,UAAM,WAAW,MAAM,MAAM,GAAG;AAChC,UAAMC,QAAO,MAAM,SAAS,YAAW;AACvC,WAAQ,MAAM,OAAO,MAAMA,KAAI;EACjC;AAEA,QAAM,OAAO,MAAM,IAAI,YAAW;AAClC,SAAQ,MAAM,OAAO,MAAM,IAAI;AACjC;",
  "names": ["features", "Protobuf", "VERSION", "import_pbf", "TileInfo", "LayerInfo", "FeatureInfo", "GeometryType", "PropertyType", "Command", "features", "import_loader_utils", "features", "Pbf", "VERSION", "import_loader_utils", "import_loader_utils", "features", "features", "features", "ax", "ay", "az", "a", "features", "features", "data"]
}
