maplibre-gl-raster 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +362 -0
- package/dist/LercDecode.es-CZm5toNk.js +442 -0
- package/dist/LercDecode.es-CZm5toNk.js.map +1 -0
- package/dist/RasterControl-B7XdXYSu.js +18838 -0
- package/dist/RasterControl-B7XdXYSu.js.map +1 -0
- package/dist/__vite-browser-external-BgMKmFg9.js +9 -0
- package/dist/__vite-browser-external-BgMKmFg9.js.map +1 -0
- package/dist/assets/LercDecode.es-Bvg6-wb5.js +442 -0
- package/dist/assets/LercDecode.es-Bvg6-wb5.js.map +1 -0
- package/dist/assets/__vite-browser-external-BgMKmFg9.js +9 -0
- package/dist/assets/__vite-browser-external-BgMKmFg9.js.map +1 -0
- package/dist/assets/chunk-FDOR9p9I.js +24 -0
- package/dist/assets/decode-BvR5vy7g.js +940 -0
- package/dist/assets/decode-BvR5vy7g.js.map +1 -0
- package/dist/assets/lerc-By2TvjAX.js +34 -0
- package/dist/assets/lerc-By2TvjAX.js.map +1 -0
- package/dist/assets/lzw-CQJJDca2.js +174 -0
- package/dist/assets/lzw-CQJJDca2.js.map +1 -0
- package/dist/assets/worker-C6cg9T3Y.js +51 -0
- package/dist/assets/worker-C6cg9T3Y.js.map +1 -0
- package/dist/assets/zstd-DBZv9xja.js +569 -0
- package/dist/assets/zstd-DBZv9xja.js.map +1 -0
- package/dist/chunk-FDOR9p9I.js +24 -0
- package/dist/decode-BMFOVF9X.js +1966 -0
- package/dist/decode-BMFOVF9X.js.map +1 -0
- package/dist/index.mjs +223 -0
- package/dist/index.mjs.map +1 -0
- package/dist/lerc-B7WY-v3y.js +34 -0
- package/dist/lerc-B7WY-v3y.js.map +1 -0
- package/dist/lzw-YEsReV21.js +174 -0
- package/dist/lzw-YEsReV21.js.map +1 -0
- package/dist/maplibre-gl-raster.css +670 -0
- package/dist/react.mjs +145 -0
- package/dist/react.mjs.map +1 -0
- package/dist/types/index.d.ts +649 -0
- package/dist/types/react.d.ts +477 -0
- package/dist/zstd-DBZv9xja.js +569 -0
- package/dist/zstd-DBZv9xja.js.map +1 -0
- package/package.json +125 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decode-BMFOVF9X.js","names":["decode","decode","decodeDeflate","decodeViaCanvas"],"sources":["../node_modules/@cogeotiff/core/build/const/tiff.endian.js","../node_modules/@cogeotiff/core/build/const/tiff.tag.id.js","../node_modules/@cogeotiff/core/build/const/tiff.mime.js","../node_modules/@cogeotiff/core/build/const/tiff.tag.value.js","../node_modules/@cogeotiff/core/build/const/tiff.version.js","../node_modules/@cogeotiff/core/build/read/tiff.value.reader.js","../node_modules/@cogeotiff/core/build/util/bytes.js","../node_modules/@cogeotiff/core/build/read/data.view.offset.js","../node_modules/@cogeotiff/core/build/read/endian.js","../node_modules/@cogeotiff/core/build/read/tiff.tag.factory.js","../node_modules/@cogeotiff/core/build/tiff.image.js","../node_modules/@cogeotiff/core/build/read/tiff.gdal.js","../node_modules/@cogeotiff/core/build/read/tiff.ifd.config.js","../node_modules/@cogeotiff/core/build/util/util.hex.js","../node_modules/@cogeotiff/core/build/tiff.js","../node_modules/@developmentseed/geotiff/dist/codecs/canvas.js","../node_modules/@developmentseed/geotiff/dist/codecs/decompression-stream.js","../node_modules/@developmentseed/geotiff/dist/codecs/deflate.js","../node_modules/@developmentseed/geotiff/dist/codecs/predictor.js","../node_modules/@developmentseed/geotiff/dist/decode.js"],"sourcesContent":["/**\n * Tiff format\n *\n * The header of a Tiff file contains the endianness of the file\n */\nexport var TiffEndian;\n(function (TiffEndian) {\n TiffEndian[TiffEndian[\"Big\"] = 19789] = \"Big\";\n TiffEndian[TiffEndian[\"Little\"] = 18761] = \"Little\";\n})(TiffEndian || (TiffEndian = {}));\n","/** Sub file type for tag 254 {@link TiffTag.SubFileType} */\nexport var SubFileType;\n(function (SubFileType) {\n /** Reduced resolution version */\n SubFileType[SubFileType[\"ReducedImage\"] = 1] = \"ReducedImage\";\n /** One page of many */\n SubFileType[SubFileType[\"Page\"] = 2] = \"Page\";\n /** Transparency mask */\n SubFileType[SubFileType[\"Mask\"] = 4] = \"Mask\";\n})(SubFileType || (SubFileType = {}));\nexport var Orientation;\n(function (Orientation) {\n /* row 0 top, col 0 lhs */\n Orientation[Orientation[\"TopLeft\"] = 1] = \"TopLeft\";\n /* row 0 top, col 0 rhs */\n Orientation[Orientation[\"TopRight\"] = 2] = \"TopRight\";\n /* row 0 bottom, col 0 rhs */\n Orientation[Orientation[\"BottomRight\"] = 3] = \"BottomRight\";\n /* row 0 Bottom, col 0 lhs */\n Orientation[Orientation[\"BottomLeft\"] = 4] = \"BottomLeft\";\n /* row 0 lhs, col 0 Top */\n Orientation[Orientation[\"LeftTop\"] = 5] = \"LeftTop\";\n /* row 0 rhs, col 0 Top */\n Orientation[Orientation[\"RightTOP\"] = 6] = \"RightTOP\";\n /* row 0 rhs, col 0 Bottom */\n Orientation[Orientation[\"RightBottom\"] = 7] = \"RightBottom\";\n /* row 0 lhs, col 0 Bottom */\n Orientation[Orientation[\"LeftBottom\"] = 8] = \"LeftBottom\";\n})(Orientation || (Orientation = {}));\nexport var RasterTypeKey;\n(function (RasterTypeKey) {\n /**\n * PixelIsArea (default) a pixel is treated as an area,\n * the raster coordinate (0,0) is the top left corner of the top left pixel.\n */\n RasterTypeKey[RasterTypeKey[\"PixelIsArea\"] = 1] = \"PixelIsArea\";\n /**\n * PixelIsPoint treats pixels as point samples with empty space between the \"pixel\" samples.\n * the raster coordinate (0,0) is the location of the top left raster pixel.\n */\n RasterTypeKey[RasterTypeKey[\"PixelIsPoint\"] = 2] = \"PixelIsPoint\";\n})(RasterTypeKey || (RasterTypeKey = {}));\nexport var ModelTypeCode;\n(function (ModelTypeCode) {\n ModelTypeCode[ModelTypeCode[\"Unknown\"] = 0] = \"Unknown\";\n /** Projection Coordinate System */\n ModelTypeCode[ModelTypeCode[\"Projected\"] = 1] = \"Projected\";\n /** Geographic latitude-longitude System */\n ModelTypeCode[ModelTypeCode[\"Geographic\"] = 2] = \"Geographic\";\n /** Geocentric (X,Y,Z) Coordinate System */\n ModelTypeCode[ModelTypeCode[\"Geocentric\"] = 3] = \"Geocentric\";\n ModelTypeCode[ModelTypeCode[\"UserDefined\"] = 32767] = \"UserDefined\";\n})(ModelTypeCode || (ModelTypeCode = {}));\n/** Sub file type for tag 255 {@link TiffTag.OldSubFileType} */\nexport var OldSubFileType;\n(function (OldSubFileType) {\n /** Full resolution image data */\n OldSubFileType[OldSubFileType[\"Image\"] = 1] = \"Image\";\n /** Reduced resolution version */\n OldSubFileType[OldSubFileType[\"ReducedImage\"] = 2] = \"ReducedImage\";\n /** One page of many */\n OldSubFileType[OldSubFileType[\"Page\"] = 3] = \"Page\";\n})(OldSubFileType || (OldSubFileType = {}));\n/** Tiff compression types */\nexport var Compression;\n(function (Compression) {\n Compression[Compression[\"None\"] = 1] = \"None\";\n Compression[Compression[\"Ccittrle\"] = 2] = \"Ccittrle\";\n Compression[Compression[\"CcittT4\"] = 3] = \"CcittT4\";\n Compression[Compression[\"CcittT6\"] = 4] = \"CcittT6\";\n Compression[Compression[\"Lzw\"] = 5] = \"Lzw\";\n Compression[Compression[\"Jpeg6\"] = 6] = \"Jpeg6\";\n Compression[Compression[\"Jpeg\"] = 7] = \"Jpeg\";\n Compression[Compression[\"DeflateOther\"] = 8] = \"DeflateOther\";\n Compression[Compression[\"T85\"] = 9] = \"T85\";\n Compression[Compression[\"T43\"] = 10] = \"T43\";\n Compression[Compression[\"Next\"] = 32766] = \"Next\";\n Compression[Compression[\"Ccittrlew\"] = 32771] = \"Ccittrlew\";\n Compression[Compression[\"PackBits\"] = 32773] = \"PackBits\";\n Compression[Compression[\"ThunderScan\"] = 32809] = \"ThunderScan\";\n Compression[Compression[\"It8ctpad\"] = 32895] = \"It8ctpad\";\n Compression[Compression[\"It8lw\"] = 32896] = \"It8lw\";\n Compression[Compression[\"It8mp\"] = 32897] = \"It8mp\";\n Compression[Compression[\"It8bl\"] = 32898] = \"It8bl\";\n Compression[Compression[\"PixarFilm\"] = 32908] = \"PixarFilm\";\n Compression[Compression[\"PixarLog\"] = 32909] = \"PixarLog\";\n Compression[Compression[\"Deflate\"] = 32946] = \"Deflate\";\n Compression[Compression[\"Dcs\"] = 32947] = \"Dcs\";\n Compression[Compression[\"Jbig\"] = 34661] = \"Jbig\";\n Compression[Compression[\"SgiLog\"] = 34676] = \"SgiLog\";\n Compression[Compression[\"SgiLog24\"] = 34677] = \"SgiLog24\";\n Compression[Compression[\"Jp2000\"] = 34712] = \"Jp2000\";\n Compression[Compression[\"Lerc\"] = 34887] = \"Lerc\";\n Compression[Compression[\"Lzma\"] = 34925] = \"Lzma\";\n Compression[Compression[\"Zstd\"] = 50000] = \"Zstd\";\n Compression[Compression[\"Webp\"] = 50001] = \"Webp\";\n Compression[Compression[\"JpegXl\"] = 50002] = \"JpegXl\";\n Compression[Compression[\"JpegXlDng17\"] = 52546] = \"JpegXlDng17\";\n})(Compression || (Compression = {}));\nexport var PlanarConfiguration;\n(function (PlanarConfiguration) {\n /** single image plane */\n PlanarConfiguration[PlanarConfiguration[\"Contig\"] = 1] = \"Contig\";\n /** separate planes of data */\n PlanarConfiguration[PlanarConfiguration[\"Separate\"] = 2] = \"Separate\";\n})(PlanarConfiguration || (PlanarConfiguration = {}));\nexport var Predictor;\n(function (Predictor) {\n Predictor[Predictor[\"None\"] = 1] = \"None\";\n /** Horizontal differencing */\n Predictor[Predictor[\"Horizontal\"] = 2] = \"Horizontal\";\n /** Floating point */\n Predictor[Predictor[\"FloatingPoint\"] = 3] = \"FloatingPoint\";\n})(Predictor || (Predictor = {}));\nexport var SampleFormat;\n(function (SampleFormat) {\n /** Unsigned integer data */\n SampleFormat[SampleFormat[\"Uint\"] = 1] = \"Uint\";\n /** Signed integer data */\n SampleFormat[SampleFormat[\"Int\"] = 2] = \"Int\";\n /** IEEE floating point data */\n SampleFormat[SampleFormat[\"Float\"] = 3] = \"Float\";\n /** Untyped data */\n SampleFormat[SampleFormat[\"Void\"] = 4] = \"Void\";\n /** Complex signed int */\n SampleFormat[SampleFormat[\"ComplexInt\"] = 5] = \"ComplexInt\";\n /** Complex ieee floating */\n SampleFormat[SampleFormat[\"ComplexFloat\"] = 6] = \"ComplexFloat\";\n})(SampleFormat || (SampleFormat = {}));\nexport var Photometric;\n(function (Photometric) {\n /** min value is white */\n Photometric[Photometric[\"MinIsWhite\"] = 0] = \"MinIsWhite\";\n /** min value is black */\n Photometric[Photometric[\"MinIsBlack\"] = 1] = \"MinIsBlack\";\n /** RGB color model */\n Photometric[Photometric[\"Rgb\"] = 2] = \"Rgb\";\n /** color map indexed */\n Photometric[Photometric[\"Palette\"] = 3] = \"Palette\";\n /** $holdout mask */\n Photometric[Photometric[\"Mask\"] = 4] = \"Mask\";\n /** !color separations */\n Photometric[Photometric[\"Separated\"] = 5] = \"Separated\";\n /** !CCIR 601 */\n Photometric[Photometric[\"Ycbcr\"] = 6] = \"Ycbcr\";\n /** !1976 CIE L*a*b* */\n Photometric[Photometric[\"Cielab\"] = 8] = \"Cielab\";\n /** ICC L*a*b* [Adobe TIFF Technote 4] */\n Photometric[Photometric[\"Icclab\"] = 9] = \"Icclab\";\n /** ITU L*a*b* */\n Photometric[Photometric[\"Itulab\"] = 10] = \"Itulab\";\n /** color filter array */\n Photometric[Photometric[\"Cfa\"] = 32803] = \"Cfa\";\n /** CIE Log2(L) */\n Photometric[Photometric[\"Logl\"] = 32844] = \"Logl\";\n Photometric[Photometric[\"Logluv\"] = 32845] = \"Logluv\";\n})(Photometric || (Photometric = {}));\n/**\n * Tiff tags as defined by libtiff and libgeotiff\n *\n * - {@link https://gitlab.com/libtiff/libtiff}\n * - {@link https://github.com/OSGeo/libgeotiff/}\n */\nexport var TiffTag;\n(function (TiffTag) {\n /**\n * Type of the sub file\n *\n * @see {@link SubFileType}\n */\n TiffTag[TiffTag[\"SubFileType\"] = 254] = \"SubFileType\";\n /**\n * Type of sub file\n *\n * @see {@link OldSubFileType}\n */\n TiffTag[TiffTag[\"OldSubFileType\"] = 255] = \"OldSubFileType\";\n /** Width of image in pixels */\n TiffTag[TiffTag[\"ImageWidth\"] = 256] = \"ImageWidth\";\n /** Height of image in pixels */\n TiffTag[TiffTag[\"ImageHeight\"] = 257] = \"ImageHeight\";\n /**\n * Number of bits per channel\n *\n * @example\n * ```typescript\n * [8,8,8] // 8 bit RGB\n * [16] // 16bit\n * ```\n */\n TiffTag[TiffTag[\"BitsPerSample\"] = 258] = \"BitsPerSample\";\n /**\n *\n * Data type of the image\n *\n * See {@link SampleFormat}\n *\n * @example\n * ```typescript\n * [1] // SampleFormat.Uint\n * [1,1,1,1] // 4 band Uint\n * ```\n */\n TiffTag[TiffTag[\"SampleFormat\"] = 339] = \"SampleFormat\";\n /**\n * Compression Type\n *\n * @see {@link Compression}\n *\n * @example\n * ```typescript\n * 5 // Compression.Lzw\n * ```\n */\n TiffTag[TiffTag[\"Compression\"] = 259] = \"Compression\";\n /**\n * Photometric interpretation\n *\n * @see {@link Photometric}\n *\n * @example\n * ```typescript\n * 2 // Photometric.Rgb\n * ```\n */\n TiffTag[TiffTag[\"Photometric\"] = 262] = \"Photometric\";\n /** Tile width in pixels */\n TiffTag[TiffTag[\"TileWidth\"] = 322] = \"TileWidth\";\n /** Tile height in pixels */\n TiffTag[TiffTag[\"TileHeight\"] = 323] = \"TileHeight\";\n /**\n * Offsets to data tiles\n * `0` means the tile has no data (sparse tiff)\n *\n * @example\n * ```typescript\n * [0, 3200, 1406] // three tiles, first tile does not exist\n * ```\n */\n TiffTag[TiffTag[\"TileOffsets\"] = 324] = \"TileOffsets\";\n /**\n * Byte counts for tiles\n * `0 means the tile does not exist (sparse tiff)\n *\n * @example\n * ```typescript\n * [0, 3200, 1406] // three tiles, first tile does not exist\n * ```\n **/\n TiffTag[TiffTag[\"TileByteCounts\"] = 325] = \"TileByteCounts\";\n /** JPEG table stream */\n TiffTag[TiffTag[\"JpegTables\"] = 347] = \"JpegTables\";\n TiffTag[TiffTag[\"StripOffsets\"] = 273] = \"StripOffsets\";\n TiffTag[TiffTag[\"StripByteCounts\"] = 279] = \"StripByteCounts\";\n // GDAL\n /**\n * GDAL metadata\n * Generally a xml document with lots of information about the tiff and how it was created\n */\n TiffTag[TiffTag[\"GdalMetadata\"] = 42112] = \"GdalMetadata\";\n /**\n * No data value encoded as a string\n *\n * @example \"-9999\"\n */\n TiffTag[TiffTag[\"GdalNoData\"] = 42113] = \"GdalNoData\";\n /** GeoTiff Tags */\n /**\n * Pixel scale in meters\n * in the format [scaleX, scaleY, scaleZ]\n *\n * Requires {@link ModelTiePoint} to be set and {@link ModelTransformation} not to be set\n *\n * @example\n * ```typescript\n * [100.0, 100.0, 0.0]\n * ```\n */\n TiffTag[TiffTag[\"ModelPixelScale\"] = 33550] = \"ModelPixelScale\";\n /**\n * Position of the tiff\n *\n * contains a list of tie points that contain\n * [x,y,z] of position in the in the tiff, generally [0,0,0]\n * [x,y,z] of the position in the projected\n *\n * @example\n * Mapping tiff point `[0,0,0]` to projected coordinates `[350807.4, 5316081.3, 0.0]`\n * ```\n * [0, 0, 0, 350807.4, 5316081.3, 0.0]\n * ```\n */\n TiffTag[TiffTag[\"ModelTiePoint\"] = 33922] = \"ModelTiePoint\";\n /**\n * Exact affine transformation between the tiff and the projected location\n *\n * this tag should not be defined when {@link ModelTiePoint} or {@link ModelPixelScale} are used\n *\n * @example\n *```typescript\n * [ 0, 100.0, 0, 400000.0,\n * 100.0, 0, 0, 500000.0,\n * 0, 0, 0, 0,\n * 0, 0, 0, 1]\n * ```\n */\n TiffTag[TiffTag[\"ModelTransformation\"] = 34264] = \"ModelTransformation\";\n /**\n * List of GeoTiff tags\n * {@link TiffTagGeo}\n *\n * {@link https://docs.ogc.org/is/19-008r4/19-008r4.html#_requirements_class_geokeydirectorytag}\n */\n TiffTag[TiffTag[\"GeoKeyDirectory\"] = 34735] = \"GeoKeyDirectory\";\n /**\n * Double Parameters for GeoTiff Tags\n *\n * {@link TiffTagGeo}\n */\n TiffTag[TiffTag[\"GeoDoubleParams\"] = 34736] = \"GeoDoubleParams\";\n /**\n * Ascii Parameters for GeoTiff Tags\n *\n * {@link TiffTagGeo}\n */\n TiffTag[TiffTag[\"GeoAsciiParams\"] = 34737] = \"GeoAsciiParams\";\n /**\n * Stores the LERC version and additional compression\n *\n * @example\n * ```typescript\n * [4, 0] // version 4, no extra compression\n * ```\n */\n TiffTag[TiffTag[\"LercParameters\"] = 50674] = \"LercParameters\";\n TiffTag[TiffTag[\"PlanarConfiguration\"] = 284] = \"PlanarConfiguration\";\n /** Untyped values */\n TiffTag[TiffTag[\"CellLength\"] = 265] = \"CellLength\";\n TiffTag[TiffTag[\"CellWidth\"] = 264] = \"CellWidth\";\n TiffTag[TiffTag[\"ColorMap\"] = 320] = \"ColorMap\";\n TiffTag[TiffTag[\"Copyright\"] = 33432] = \"Copyright\";\n TiffTag[TiffTag[\"DateTime\"] = 306] = \"DateTime\";\n TiffTag[TiffTag[\"ExtraSamples\"] = 338] = \"ExtraSamples\";\n TiffTag[TiffTag[\"FillOrder\"] = 266] = \"FillOrder\";\n TiffTag[TiffTag[\"FreeByteCounts\"] = 289] = \"FreeByteCounts\";\n TiffTag[TiffTag[\"FreeOffsets\"] = 288] = \"FreeOffsets\";\n TiffTag[TiffTag[\"GrayResponseCurve\"] = 291] = \"GrayResponseCurve\";\n TiffTag[TiffTag[\"GrayResponseUnit\"] = 290] = \"GrayResponseUnit\";\n TiffTag[TiffTag[\"HostComputer\"] = 316] = \"HostComputer\";\n TiffTag[TiffTag[\"ImageDescription\"] = 270] = \"ImageDescription\";\n TiffTag[TiffTag[\"Make\"] = 271] = \"Make\";\n TiffTag[TiffTag[\"MaxSampleValue\"] = 281] = \"MaxSampleValue\";\n TiffTag[TiffTag[\"MinSampleValue\"] = 280] = \"MinSampleValue\";\n TiffTag[TiffTag[\"Model\"] = 272] = \"Model\";\n TiffTag[TiffTag[\"Orientation\"] = 274] = \"Orientation\";\n TiffTag[TiffTag[\"ResolutionUnit\"] = 296] = \"ResolutionUnit\";\n TiffTag[TiffTag[\"RowsPerStrip\"] = 278] = \"RowsPerStrip\";\n TiffTag[TiffTag[\"SamplesPerPixel\"] = 277] = \"SamplesPerPixel\";\n TiffTag[TiffTag[\"Software\"] = 305] = \"Software\";\n TiffTag[TiffTag[\"Threshholding\"] = 263] = \"Threshholding\";\n TiffTag[TiffTag[\"XResolution\"] = 282] = \"XResolution\";\n TiffTag[TiffTag[\"YResolution\"] = 283] = \"YResolution\";\n TiffTag[TiffTag[\"BadFaxLines\"] = 326] = \"BadFaxLines\";\n TiffTag[TiffTag[\"CleanFaxData\"] = 327] = \"CleanFaxData\";\n TiffTag[TiffTag[\"ClipPath\"] = 343] = \"ClipPath\";\n TiffTag[TiffTag[\"ConsecutiveBadFaxLines\"] = 328] = \"ConsecutiveBadFaxLines\";\n TiffTag[TiffTag[\"Decode\"] = 433] = \"Decode\";\n TiffTag[TiffTag[\"DefaultImageColor\"] = 434] = \"DefaultImageColor\";\n TiffTag[TiffTag[\"DocumentName\"] = 269] = \"DocumentName\";\n TiffTag[TiffTag[\"DotRange\"] = 336] = \"DotRange\";\n TiffTag[TiffTag[\"HalftoneHints\"] = 321] = \"HalftoneHints\";\n TiffTag[TiffTag[\"Indexed\"] = 346] = \"Indexed\";\n TiffTag[TiffTag[\"PageName\"] = 285] = \"PageName\";\n TiffTag[TiffTag[\"PageNumber\"] = 297] = \"PageNumber\";\n TiffTag[TiffTag[\"Predictor\"] = 317] = \"Predictor\";\n TiffTag[TiffTag[\"PrimaryChromaticities\"] = 319] = \"PrimaryChromaticities\";\n TiffTag[TiffTag[\"ReferenceBlackWhite\"] = 532] = \"ReferenceBlackWhite\";\n TiffTag[TiffTag[\"SMinSampleValue\"] = 340] = \"SMinSampleValue\";\n TiffTag[TiffTag[\"SMaxSampleValue\"] = 341] = \"SMaxSampleValue\";\n TiffTag[TiffTag[\"StripRowCounts\"] = 559] = \"StripRowCounts\";\n TiffTag[TiffTag[\"SubIFDs\"] = 330] = \"SubIFDs\";\n TiffTag[TiffTag[\"T4Options\"] = 292] = \"T4Options\";\n TiffTag[TiffTag[\"T6Options\"] = 293] = \"T6Options\";\n TiffTag[TiffTag[\"TransferFunction\"] = 301] = \"TransferFunction\";\n TiffTag[TiffTag[\"WhitePoint\"] = 318] = \"WhitePoint\";\n TiffTag[TiffTag[\"XClipPathUnits\"] = 344] = \"XClipPathUnits\";\n TiffTag[TiffTag[\"XPosition\"] = 286] = \"XPosition\";\n TiffTag[TiffTag[\"YCbCrCoefficients\"] = 529] = \"YCbCrCoefficients\";\n TiffTag[TiffTag[\"YCbCrPositioning\"] = 531] = \"YCbCrPositioning\";\n TiffTag[TiffTag[\"YCbCrSubSampling\"] = 530] = \"YCbCrSubSampling\";\n TiffTag[TiffTag[\"YClipPathUnits\"] = 345] = \"YClipPathUnits\";\n TiffTag[TiffTag[\"YPosition\"] = 287] = \"YPosition\";\n TiffTag[TiffTag[\"ApertureValue\"] = 37378] = \"ApertureValue\";\n TiffTag[TiffTag[\"ColorSpace\"] = 40961] = \"ColorSpace\";\n TiffTag[TiffTag[\"DateTimeDigitized\"] = 36868] = \"DateTimeDigitized\";\n TiffTag[TiffTag[\"DateTimeOriginal\"] = 36867] = \"DateTimeOriginal\";\n TiffTag[TiffTag[\"ExifIFD\"] = 34665] = \"ExifIFD\";\n TiffTag[TiffTag[\"ExifVersion\"] = 36864] = \"ExifVersion\";\n TiffTag[TiffTag[\"ExposureTime\"] = 33434] = \"ExposureTime\";\n TiffTag[TiffTag[\"FileSource\"] = 41728] = \"FileSource\";\n TiffTag[TiffTag[\"Flash\"] = 37385] = \"Flash\";\n TiffTag[TiffTag[\"FlashpixVersion\"] = 40960] = \"FlashpixVersion\";\n TiffTag[TiffTag[\"FNumber\"] = 33437] = \"FNumber\";\n TiffTag[TiffTag[\"ImageUniqueID\"] = 42016] = \"ImageUniqueID\";\n TiffTag[TiffTag[\"LightSource\"] = 37384] = \"LightSource\";\n TiffTag[TiffTag[\"MakerNote\"] = 37500] = \"MakerNote\";\n TiffTag[TiffTag[\"ShutterSpeedValue\"] = 37377] = \"ShutterSpeedValue\";\n TiffTag[TiffTag[\"UserComment\"] = 37510] = \"UserComment\";\n TiffTag[TiffTag[\"IPTC\"] = 33723] = \"IPTC\";\n TiffTag[TiffTag[\"ICCProfile\"] = 34675] = \"ICCProfile\";\n TiffTag[TiffTag[\"XMP\"] = 700] = \"XMP\";\n})(TiffTag || (TiffTag = {}));\n/**\n * Geotiff tags as defined by OGC GeoTiff 1.1\n *\n * {@link https://docs.ogc.org/is/19-008r4/19-008r4.html#_summary_of_geokey_ids_and_names}\n */\nexport var TiffTagGeo;\n(function (TiffTagGeo) {\n // GeoTIFF Configuration Keys\n /**\n * This GeoKey defines the type of Model coordinate reference system used, to which the transformation from the raster space is made:\n *\n * {@link https://docs.ogc.org/is/19-008r4/19-008r4.html#_requirements_class_gtmodeltypegeokey}\n *\n * {@link ModelTypeCode}\n */\n TiffTagGeo[TiffTagGeo[\"GTModelTypeGeoKey\"] = 1024] = \"GTModelTypeGeoKey\";\n /**\n * There are currently only two options: `RasterPixelIsPoint` and `RasterPixelIsArea`\n *\n * {@link https://docs.ogc.org/is/19-008r4/19-008r4.html#_requirements_class_gtrastertypegeokey}\n *\n * {@link RasterTypeKey}\n */\n TiffTagGeo[TiffTagGeo[\"GTRasterTypeGeoKey\"] = 1025] = \"GTRasterTypeGeoKey\";\n /**\n * ASCII reference to published documentation on the overall configuration of the GeoTIFF file.\n *\n * @example \"NZGD2000 / New Zealand Transverse Mercator 2000\"\n */\n TiffTagGeo[TiffTagGeo[\"GTCitationGeoKey\"] = 1026] = \"GTCitationGeoKey\";\n // Geodetic CRS Parameter Keys\n /**\n * Renamed from GeographicTypeGeoKey in OGC GeoTiff\n */\n TiffTagGeo[TiffTagGeo[\"GeodeticCRSGeoKey\"] = 2048] = \"GeodeticCRSGeoKey\";\n /**\n * Renamed from GeogCitationGeoKey in OGC GeoTiff\n *\n * @example \"NZTM\"\n */\n TiffTagGeo[TiffTagGeo[\"GeodeticCitationGeoKey\"] = 2049] = \"GeodeticCitationGeoKey\";\n /**\n * Renamed from GeogGeodeticDatumGeoKey in OGC GeoTiff\n */\n TiffTagGeo[TiffTagGeo[\"GeodeticDatumGeoKey\"] = 2050] = \"GeodeticDatumGeoKey\";\n /**\n * Renamed from \"GeogPrimeMeridianGeoKey\" in OGC GeoTiff\n */\n TiffTagGeo[TiffTagGeo[\"PrimeMeridianGeoKey\"] = 2051] = \"PrimeMeridianGeoKey\";\n /**\n * Linear unit of measure\n * @example 9001 // Metre\n */\n TiffTagGeo[TiffTagGeo[\"GeogLinearUnitsGeoKey\"] = 2052] = \"GeogLinearUnitsGeoKey\";\n TiffTagGeo[TiffTagGeo[\"GeogLinearUnitSizeGeoKey\"] = 2053] = \"GeogLinearUnitSizeGeoKey\";\n /**\n * Angular unit of measure\n *\n * @example 9102 // Degree\n */\n TiffTagGeo[TiffTagGeo[\"GeogAngularUnitsGeoKey\"] = 2054] = \"GeogAngularUnitsGeoKey\";\n TiffTagGeo[TiffTagGeo[\"GeogAngularUnitSizeGeoKey\"] = 2055] = \"GeogAngularUnitSizeGeoKey\";\n /**\n * Renamed from \"GeogEllipsoidGeoKey\" in OGC GeoTiff\n */\n TiffTagGeo[TiffTagGeo[\"EllipsoidGeoKey\"] = 2056] = \"EllipsoidGeoKey\";\n /**\n * Renamed from \"GeogSemiMajorAxisGeoKey\" in OGC GeoTiff\n */\n TiffTagGeo[TiffTagGeo[\"EllipsoidSemiMajorAxisGeoKey\"] = 2057] = \"EllipsoidSemiMajorAxisGeoKey\";\n /**\n * Renamed from \"GeogSemiMinorAxisGeoKey\" in OGC GeoTiff\n */\n TiffTagGeo[TiffTagGeo[\"EllipsoidSemiMinorAxisGeoKey\"] = 2058] = \"EllipsoidSemiMinorAxisGeoKey\";\n /**\n * Renamed from \"GeogInvFlatteningGeoKey\" in OGC GeoTiff\n */\n TiffTagGeo[TiffTagGeo[\"EllipsoidInvFlatteningGeoKey\"] = 2059] = \"EllipsoidInvFlatteningGeoKey\";\n /**\n * Renamed from \"GeogPrimeMeridianLongGeoKey\" in OGC GeoTiff\n */\n TiffTagGeo[TiffTagGeo[\"PrimeMeridianLongitudeGeoKey\"] = 2061] = \"PrimeMeridianLongitudeGeoKey\";\n TiffTagGeo[TiffTagGeo[\"GeogTOWGS84GeoKey\"] = 2062] = \"GeogTOWGS84GeoKey\";\n // Projected CRS Parameter Keys\n TiffTagGeo[TiffTagGeo[\"GeogAzimuthUnitsGeoKey\"] = 2060] = \"GeogAzimuthUnitsGeoKey\";\n /**\n * EPSG code of the tiff\n *\n * Renamed from \"ProjectedCSTypeGeoKey\" in OGC GeoTiff\n *\n * @example\n * ```typescript\n * 2193 // NZTM\n * 3857 // WebMercatorQuad\n * ```\n */\n TiffTagGeo[TiffTagGeo[\"ProjectedCRSGeoKey\"] = 3072] = \"ProjectedCRSGeoKey\";\n /**\n * ASCII reference to published documentation on the Projected Coordinate System\n *\n * Renamed from \"PCSCitationGeoKey\" in OGC GeoTiff\n *\n * @example \"UTM Zone 60 N with WGS 84\"\n */\n TiffTagGeo[TiffTagGeo[\"ProjectedCitationGeoKey\"] = 3073] = \"ProjectedCitationGeoKey\";\n /**\n * Specifies a map projection from the GeoTIFF CRS register or to indicate that the map projection is user-defined.\n *\n * {@link https://docs.ogc.org/is/19-008r4/19-008r4.html#_map_projection_geokeys}\n *\n * @example 2193\n */\n TiffTagGeo[TiffTagGeo[\"ProjectionGeoKey\"] = 3074] = \"ProjectionGeoKey\";\n TiffTagGeo[TiffTagGeo[\"ProjMethodGeoKey\"] = 3075] = \"ProjMethodGeoKey\";\n TiffTagGeo[TiffTagGeo[\"ProjLinearUnitsGeoKey\"] = 3076] = \"ProjLinearUnitsGeoKey\";\n TiffTagGeo[TiffTagGeo[\"ProjLinearUnitSizeGeoKey\"] = 3077] = \"ProjLinearUnitSizeGeoKey\";\n TiffTagGeo[TiffTagGeo[\"ProjStdParallel1GeoKey\"] = 3078] = \"ProjStdParallel1GeoKey\";\n TiffTagGeo[TiffTagGeo[\"ProjStdParallel2GeoKey\"] = 3079] = \"ProjStdParallel2GeoKey\";\n TiffTagGeo[TiffTagGeo[\"ProjNatOriginLongGeoKey\"] = 3080] = \"ProjNatOriginLongGeoKey\";\n TiffTagGeo[TiffTagGeo[\"ProjNatOriginLatGeoKey\"] = 3081] = \"ProjNatOriginLatGeoKey\";\n TiffTagGeo[TiffTagGeo[\"ProjFalseEastingGeoKey\"] = 3082] = \"ProjFalseEastingGeoKey\";\n TiffTagGeo[TiffTagGeo[\"ProjFalseNorthingGeoKey\"] = 3083] = \"ProjFalseNorthingGeoKey\";\n TiffTagGeo[TiffTagGeo[\"ProjFalseOriginLongGeoKey\"] = 3084] = \"ProjFalseOriginLongGeoKey\";\n TiffTagGeo[TiffTagGeo[\"ProjFalseOriginLatGeoKey\"] = 3085] = \"ProjFalseOriginLatGeoKey\";\n TiffTagGeo[TiffTagGeo[\"ProjFalseOriginEastingGeoKey\"] = 3086] = \"ProjFalseOriginEastingGeoKey\";\n TiffTagGeo[TiffTagGeo[\"ProjFalseOriginNorthingGeoKey\"] = 3087] = \"ProjFalseOriginNorthingGeoKey\";\n TiffTagGeo[TiffTagGeo[\"ProjCenterLongGeoKey\"] = 3088] = \"ProjCenterLongGeoKey\";\n TiffTagGeo[TiffTagGeo[\"ProjCenterLatGeoKey\"] = 3089] = \"ProjCenterLatGeoKey\";\n TiffTagGeo[TiffTagGeo[\"ProjCenterEastingGeoKey\"] = 3090] = \"ProjCenterEastingGeoKey\";\n TiffTagGeo[TiffTagGeo[\"ProjCenterNorthingGeoKey\"] = 3091] = \"ProjCenterNorthingGeoKey\";\n TiffTagGeo[TiffTagGeo[\"ProjScaleAtNatOriginGeoKey\"] = 3092] = \"ProjScaleAtNatOriginGeoKey\";\n TiffTagGeo[TiffTagGeo[\"ProjScaleAtCenterGeoKey\"] = 3093] = \"ProjScaleAtCenterGeoKey\";\n TiffTagGeo[TiffTagGeo[\"ProjAzimuthAngleGeoKey\"] = 3094] = \"ProjAzimuthAngleGeoKey\";\n TiffTagGeo[TiffTagGeo[\"ProjStraightVertPoleLongGeoKey\"] = 3095] = \"ProjStraightVertPoleLongGeoKey\";\n TiffTagGeo[TiffTagGeo[\"ProjRectifiedGridAngleGeoKey\"] = 3096] = \"ProjRectifiedGridAngleGeoKey\";\n // Vertical CRS Parameter Keys (4096-5119)\n /**\n * This key is provided to specify the vertical coordinate reference system from the GeoTIFF CRS register or to indicate that the CRS is a user-defined vertical coordinate reference system. The value for VerticalGeoKey should follow the\n *\n * {@link https://docs.ogc.org/is/19-008r4/19-008r4.html#_requirements_class_verticalgeokey}\n *\n * @example 4979\n */\n TiffTagGeo[TiffTagGeo[\"VerticalGeoKey\"] = 4096] = \"VerticalGeoKey\";\n /**\n *\n * @example \"Geographic 3D WGS 84, Ellipsoidal height\"\n */\n TiffTagGeo[TiffTagGeo[\"VerticalCitationGeoKey\"] = 4097] = \"VerticalCitationGeoKey\";\n /**\n * vertical datum for a user-defined vertical coordinate reference system.\n */\n TiffTagGeo[TiffTagGeo[\"VerticalDatumGeoKey\"] = 4098] = \"VerticalDatumGeoKey\";\n /**\n * Linear Unit for vertical CRS\n *\n * @example 9001\n */\n TiffTagGeo[TiffTagGeo[\"VerticalUnitsGeoKey\"] = 4099] = \"VerticalUnitsGeoKey\";\n})(TiffTagGeo || (TiffTagGeo = {}));\n/**\n * EPSG Angular Units. exist between [9100, 9199]\n *\n * Taken from libgeotiff\n */\nexport var AngularUnit;\n(function (AngularUnit) {\n AngularUnit[AngularUnit[\"Radian\"] = 9101] = \"Radian\";\n AngularUnit[AngularUnit[\"Degree\"] = 9102] = \"Degree\";\n AngularUnit[AngularUnit[\"ArcMinute\"] = 9103] = \"ArcMinute\";\n AngularUnit[AngularUnit[\"ArcDegree\"] = 9104] = \"ArcDegree\";\n AngularUnit[AngularUnit[\"Grad\"] = 9105] = \"Grad\";\n AngularUnit[AngularUnit[\"Gon\"] = 9106] = \"Gon\";\n AngularUnit[AngularUnit[\"Dms\"] = 9107] = \"Dms\";\n})(AngularUnit || (AngularUnit = {}));\n/**\n * ESPG Liner units exist between [9000, 9099]\n *\n * Taken from libgeotiff\n */\nexport var LinearUnit;\n(function (LinearUnit) {\n LinearUnit[LinearUnit[\"Metre\"] = 9001] = \"Metre\";\n LinearUnit[LinearUnit[\"Foot\"] = 9002] = \"Foot\";\n LinearUnit[LinearUnit[\"FootUsSurvey\"] = 9003] = \"FootUsSurvey\";\n LinearUnit[LinearUnit[\"FootModifiedAmerican\"] = 9004] = \"FootModifiedAmerican\";\n LinearUnit[LinearUnit[\"FootClarke\"] = 9005] = \"FootClarke\";\n LinearUnit[LinearUnit[\"FootIndian\"] = 9006] = \"FootIndian\";\n LinearUnit[LinearUnit[\"Link\"] = 9007] = \"Link\";\n LinearUnit[LinearUnit[\"LinkBenoit\"] = 9008] = \"LinkBenoit\";\n LinearUnit[LinearUnit[\"LinkSears\"] = 9009] = \"LinkSears\";\n LinearUnit[LinearUnit[\"ChainBenoit\"] = 9010] = \"ChainBenoit\";\n LinearUnit[LinearUnit[\"ChainSears\"] = 9011] = \"ChainSears\";\n LinearUnit[LinearUnit[\"YardSears\"] = 9012] = \"YardSears\";\n LinearUnit[LinearUnit[\"YardIndian\"] = 9013] = \"YardIndian\";\n LinearUnit[LinearUnit[\"Fathom\"] = 9014] = \"Fathom\";\n LinearUnit[LinearUnit[\"MileInternationalNautical\"] = 9015] = \"MileInternationalNautical\";\n})(LinearUnit || (LinearUnit = {}));\n/**\n * Convert tiff tag values when being read.\n */\nexport const TiffTagConvertArray = {\n [TiffTag.TileByteCounts]: true,\n [TiffTag.TileOffsets]: true,\n [TiffTag.StripOffsets]: true,\n [TiffTag.StripByteCounts]: true,\n [TiffTag.BitsPerSample]: true,\n [TiffTag.SampleFormat]: true,\n [TiffTag.GeoKeyDirectory]: true,\n [TiffTag.GeoDoubleParams]: true,\n};\n","import { Compression } from './tiff.tag.id.js';\n/**\n * MimeType conversion for common tif image compresson types\n */\nexport var TiffMimeType;\n(function (TiffMimeType) {\n TiffMimeType[\"None\"] = \"application/octet-stream\";\n TiffMimeType[\"Jbig\"] = \"image/jbig\";\n TiffMimeType[\"Dcs\"] = \"image/x-kodak-dcs\";\n TiffMimeType[\"PackBits\"] = \"application/packbits\";\n TiffMimeType[\"Jpeg\"] = \"image/jpeg\";\n TiffMimeType[\"Jp2000\"] = \"image/jp2\";\n TiffMimeType[\"JpegXl\"] = \"image/jpegxl\";\n TiffMimeType[\"Webp\"] = \"image/webp\";\n TiffMimeType[\"Zstd\"] = \"application/zstd\";\n TiffMimeType[\"Lzw\"] = \"application/lzw\";\n TiffMimeType[\"Deflate\"] = \"application/deflate\";\n TiffMimeType[\"Lerc\"] = \"application/lerc\";\n TiffMimeType[\"Lzma\"] = \"application/x-lzma\";\n})(TiffMimeType || (TiffMimeType = {}));\nexport const TiffCompressionMimeType = {\n [Compression.None]: TiffMimeType.None,\n [Compression.Lzw]: TiffMimeType.Lzw,\n [Compression.Jpeg6]: TiffMimeType.Jpeg,\n [Compression.Jpeg]: TiffMimeType.Jpeg,\n [Compression.DeflateOther]: TiffMimeType.Deflate,\n [Compression.Deflate]: TiffMimeType.Deflate,\n [Compression.Lerc]: TiffMimeType.Lerc,\n [Compression.Lzma]: TiffMimeType.Lzma,\n [Compression.Jp2000]: TiffMimeType.Jp2000,\n [Compression.Zstd]: TiffMimeType.Zstd,\n [Compression.Webp]: TiffMimeType.Webp,\n [Compression.JpegXl]: TiffMimeType.JpegXl,\n [Compression.Ccittrle]: TiffMimeType.None,\n [Compression.CcittT4]: TiffMimeType.None,\n [Compression.CcittT6]: TiffMimeType.None,\n [Compression.T85]: TiffMimeType.Jbig,\n [Compression.T43]: TiffMimeType.Jbig,\n [Compression.Next]: TiffMimeType.None,\n [Compression.Ccittrlew]: TiffMimeType.None,\n [Compression.PackBits]: TiffMimeType.PackBits,\n [Compression.ThunderScan]: TiffMimeType.None,\n [Compression.It8ctpad]: TiffMimeType.None,\n [Compression.It8lw]: TiffMimeType.None,\n [Compression.It8mp]: TiffMimeType.None,\n [Compression.It8bl]: TiffMimeType.None,\n [Compression.PixarFilm]: TiffMimeType.None,\n [Compression.PixarLog]: TiffMimeType.None,\n [Compression.Dcs]: TiffMimeType.Dcs,\n [Compression.Jbig]: TiffMimeType.Jbig,\n [Compression.SgiLog]: TiffMimeType.None,\n [Compression.SgiLog24]: TiffMimeType.None,\n [Compression.JpegXlDng17]: TiffMimeType.JpegXl,\n};\n/**\n * Lookup the related mimetype for a compression id\n *\n * @param c Compression id\n * @returns mime type for compression\n */\nexport function getCompressionMimeType(c) {\n if (c == null)\n return null;\n return TiffCompressionMimeType[c];\n}\n","export var TiffTagValueType;\n(function (TiffTagValueType) {\n TiffTagValueType[TiffTagValueType[\"Uint8\"] = 1] = \"Uint8\";\n TiffTagValueType[TiffTagValueType[\"Ascii\"] = 2] = \"Ascii\";\n TiffTagValueType[TiffTagValueType[\"Uint16\"] = 3] = \"Uint16\";\n TiffTagValueType[TiffTagValueType[\"Uint32\"] = 4] = \"Uint32\";\n TiffTagValueType[TiffTagValueType[\"Rational\"] = 5] = \"Rational\";\n TiffTagValueType[TiffTagValueType[\"Int8\"] = 6] = \"Int8\";\n TiffTagValueType[TiffTagValueType[\"Undefined\"] = 7] = \"Undefined\";\n TiffTagValueType[TiffTagValueType[\"Int16\"] = 8] = \"Int16\";\n TiffTagValueType[TiffTagValueType[\"Int32\"] = 9] = \"Int32\";\n TiffTagValueType[TiffTagValueType[\"SignedRational\"] = 10] = \"SignedRational\";\n TiffTagValueType[TiffTagValueType[\"Float32\"] = 11] = \"Float32\";\n TiffTagValueType[TiffTagValueType[\"Float64\"] = 12] = \"Float64\";\n // IFD offset: https://owl.phy.queensu.ca/~phil/exiftool/standards.html\n TiffTagValueType[TiffTagValueType[\"Ifd\"] = 13] = \"Ifd\";\n // BigTiff\n TiffTagValueType[TiffTagValueType[\"Uint64\"] = 16] = \"Uint64\";\n TiffTagValueType[TiffTagValueType[\"Int64\"] = 17] = \"Int64\";\n TiffTagValueType[TiffTagValueType[\"Ifd8\"] = 18] = \"Ifd8\";\n})(TiffTagValueType || (TiffTagValueType = {}));\n","/**\n * Tif version number that is stored at the start of a tif file\n */\nexport var TiffVersion;\n(function (TiffVersion) {\n /**\n * Big tif's,\n * generally uses 64bit numbers for offsets\n * @see http://bigtiff.org/\n **/\n TiffVersion[TiffVersion[\"BigTiff\"] = 43] = \"BigTiff\";\n /**\n * Original tif\n * Uses 32 bit or smaller numbers for offsets and counters\n */\n TiffVersion[TiffVersion[\"Tiff\"] = 42] = \"Tiff\";\n})(TiffVersion || (TiffVersion = {}));\n","import { TiffTagValueType } from '../const/tiff.tag.value.js';\nexport function getTiffTagSize(fieldType) {\n switch (fieldType) {\n case TiffTagValueType.Uint8:\n case TiffTagValueType.Ascii:\n case TiffTagValueType.Int8:\n case TiffTagValueType.Undefined:\n return 1;\n case TiffTagValueType.Uint16:\n case TiffTagValueType.Int16:\n return 2;\n case TiffTagValueType.Uint32:\n case TiffTagValueType.Int32:\n case TiffTagValueType.Float32:\n case TiffTagValueType.Ifd:\n return 4;\n case TiffTagValueType.Rational:\n case TiffTagValueType.SignedRational:\n case TiffTagValueType.Float64:\n case TiffTagValueType.Uint64:\n case TiffTagValueType.Int64:\n case TiffTagValueType.Ifd8:\n return 8;\n default:\n throw new Error(`Invalid fieldType ${String(fieldType)}`);\n }\n}\n","export var ByteSizeFloat;\n(function (ByteSizeFloat) {\n ByteSizeFloat[ByteSizeFloat[\"Double\"] = 8] = \"Double\";\n ByteSizeFloat[ByteSizeFloat[\"Float32\"] = 4] = \"Float32\";\n})(ByteSizeFloat || (ByteSizeFloat = {}));\nexport var ByteSize;\n(function (ByteSize) {\n ByteSize[ByteSize[\"UInt64\"] = 8] = \"UInt64\";\n ByteSize[ByteSize[\"UInt32\"] = 4] = \"UInt32\";\n ByteSize[ByteSize[\"UInt16\"] = 2] = \"UInt16\";\n ByteSize[ByteSize[\"UInt8\"] = 1] = \"UInt8\";\n})(ByteSize || (ByteSize = {}));\n/** Shifting `<< 32` does not work in javascript */\nconst POW_32 = 2 ** 32;\n/**\n * Read a uint64 at the offset\n *\n * This is not precise for large numbers\n * @see {DataView.getBigUint64}\n * @param offset offset to read\n */\nexport function getUint64(view, offset, isLittleEndian) {\n // split 64-bit number into two 32-bit (4-byte) parts\n const left = view.getUint32(offset, isLittleEndian);\n const right = view.getUint32(offset + 4, isLittleEndian);\n // combine the two 32-bit values\n const combined = isLittleEndian ? left + POW_32 * right : POW_32 * left + right;\n if (!Number.isSafeInteger(combined)) {\n throw new Error(combined + ' exceeds MAX_SAFE_INTEGER. Precision may is lost');\n }\n return combined;\n}\nexport function getUint(view, offset, bs, isLittleEndian) {\n switch (bs) {\n case ByteSize.UInt8:\n return view.getUint8(offset);\n case ByteSize.UInt16:\n return view.getUint16(offset, isLittleEndian);\n case ByteSize.UInt32:\n return view.getUint32(offset, isLittleEndian);\n case ByteSize.UInt64:\n return getUint64(view, offset, isLittleEndian);\n }\n}\n","/** Convert the dataview to a dataview with a offset */\nexport function toDataViewOffset(d, offset) {\n d.sourceOffset = offset;\n}\n/**\n * Does a DataviewOffset include the absolute bytes of the source file\n *\n * @param view DataViewOffset to check\n * @param targetOffset the absolute offset in the file\n * @param count number of bytes to include\n */\nexport function hasBytes(view, targetOffset, count) {\n if (targetOffset < view.sourceOffset)\n return false;\n if (view.sourceOffset + view.byteLength < targetOffset + count)\n return false;\n return true;\n}\n","const buffer = new ArrayBuffer(4);\nconst uint32 = new Uint32Array(buffer);\nconst uint8 = new Uint8Array(buffer);\nuint32[0] = 1;\nexport const isLittleEndian = uint8[0] === 1;\n","/* eslint-disable @typescript-eslint/no-unsafe-enum-comparison */\nimport { TiffTag, TiffTagConvertArray } from '../const/tiff.tag.id.js';\nimport { TiffTagValueType } from '../const/tiff.tag.value.js';\nimport { getUint, getUint64 } from '../util/bytes.js';\nimport { hasBytes } from './data.view.offset.js';\nimport { isLittleEndian } from './endian.js';\nimport { getTiffTagSize } from './tiff.value.reader.js';\nfunction readTagValue(fieldType, bytes, offset, isLittleEndian) {\n switch (fieldType) {\n case TiffTagValueType.Ascii:\n return String.fromCharCode(bytes.getUint8(offset));\n case TiffTagValueType.Undefined:\n case TiffTagValueType.Uint8:\n return bytes.getUint8(offset);\n case TiffTagValueType.Int8:\n return bytes.getInt8(offset);\n case TiffTagValueType.Uint16:\n return bytes.getUint16(offset, isLittleEndian);\n case TiffTagValueType.Int16:\n return bytes.getInt16(offset, isLittleEndian);\n case TiffTagValueType.Uint32:\n case TiffTagValueType.Ifd:\n return bytes.getUint32(offset, isLittleEndian);\n case TiffTagValueType.Int32:\n return bytes.getInt32(offset, isLittleEndian);\n case TiffTagValueType.Rational:\n return [bytes.getUint32(offset, isLittleEndian), bytes.getUint32(offset + 4, isLittleEndian)];\n case TiffTagValueType.SignedRational:\n return [bytes.getInt32(offset, isLittleEndian), bytes.getInt32(offset + 4, isLittleEndian)];\n case TiffTagValueType.Float64:\n return bytes.getFloat64(offset, isLittleEndian);\n case TiffTagValueType.Float32:\n return bytes.getFloat32(offset, isLittleEndian);\n case TiffTagValueType.Uint64:\n return getUint64(bytes, offset, isLittleEndian);\n default:\n throw new Error(`Unknown read type \"${fieldType}\" \"${TiffTagValueType[fieldType]}\"`);\n }\n}\n/**\n * Convert a tiff tag value to a typed array if the local endian matches the tiff endian\n *\n * @param tiff\n * @param bytes\n * @param offset Offset in the data view to read from\n * @param length Number of bytes to read\n * @param type type of tiff tag\n * @returns the value if the type is a typed array and the endianness matches otherwise null\n */\nexport function readTypedValue(tiff, bytes, offset, length, type) {\n switch (type) {\n case TiffTagValueType.Uint8:\n return new Uint8Array(bytes.buffer.slice(bytes.byteOffset + offset, bytes.byteOffset + offset + length));\n case TiffTagValueType.Uint16:\n if (tiff.isLittleEndian !== isLittleEndian)\n return null;\n return new Uint16Array(bytes.buffer.slice(bytes.byteOffset + offset, bytes.byteOffset + offset + length));\n case TiffTagValueType.Uint32:\n if (tiff.isLittleEndian !== isLittleEndian)\n return null;\n return new Uint32Array(bytes.buffer.slice(bytes.byteOffset + offset, bytes.byteOffset + offset + length));\n }\n return null;\n}\nfunction readValue(tiff, tagId, bytes, offset, type, count) {\n const typeSize = getTiffTagSize(type);\n const dataLength = count * typeSize;\n if (count === 1) {\n const val = readTagValue(type, bytes, offset, tiff.isLittleEndian);\n // Force some single values to be arrays eg BitsPerSample\n // makes it easier to not check for number | number[]\n if (tagId && TiffTagConvertArray[tagId])\n return [val];\n return val;\n }\n switch (type) {\n case TiffTagValueType.Ascii:\n return String.fromCharCode.apply(null, new Uint8Array(bytes.buffer, offset, dataLength - 1));\n }\n // TODO should we convert all tag values to typed arrays if possible?\n if (tagId === TiffTag.TileOffsets ||\n tagId === TiffTag.TileByteCounts ||\n tagId === TiffTag.StripOffsets ||\n tagId === TiffTag.StripByteCounts) {\n const typedOutput = readTypedValue(tiff, bytes, offset, dataLength, type);\n if (typedOutput)\n return typedOutput;\n }\n const output = [];\n for (let i = 0; i < dataLength; i += typeSize) {\n output.push(readTagValue(type, bytes, offset + i, tiff.isLittleEndian));\n }\n return output;\n}\n/**\n * Determine if all the data for the tiff tag is loaded in and use that to create the specific CogTiffTag\n *\n * @see {@link Tag}\n *\n * @param tiff\n * @param view Bytes to read from\n * @param offset Offset in the dataview to read a tag\n */\nexport function createTag(tiff, view, offset) {\n const tagId = view.getUint16(offset + 0, tiff.isLittleEndian);\n const dataType = view.getUint16(offset + 2, tiff.isLittleEndian);\n const dataCount = getUint(view, offset + 4, tiff.ifdConfig.pointer, tiff.isLittleEndian);\n const dataTypeSize = getTiffTagSize(dataType);\n const dataLength = dataTypeSize * dataCount;\n // Tag value is inline read the value\n if (dataLength <= tiff.ifdConfig.pointer) {\n const value = readValue(tiff, tagId, view, offset + 4 + tiff.ifdConfig.pointer, dataType, dataCount);\n return { type: 'inline', id: tagId, name: TiffTag[tagId], count: dataCount, value, dataType, tagOffset: offset };\n }\n const dataOffset = getUint(view, offset + 4 + tiff.ifdConfig.pointer, tiff.ifdConfig.pointer, tiff.isLittleEndian);\n switch (tagId) {\n case TiffTag.TileOffsets:\n case TiffTag.TileByteCounts:\n case TiffTag.StripByteCounts:\n case TiffTag.StripOffsets:\n const tag = {\n type: 'offset',\n id: tagId,\n name: TiffTag[tagId],\n count: dataCount,\n dataType,\n dataOffset,\n isLoaded: false,\n value: [],\n tagOffset: offset,\n };\n if (hasBytes(view, dataOffset, dataLength)) {\n const val = readTypedValue(tiff, view, dataOffset - view.sourceOffset, dataLength, dataType);\n if (val) {\n tag.value = val;\n tag.isLoaded = true;\n }\n else {\n setBytes(tag, view);\n }\n }\n return tag;\n }\n // If we already have the bytes in the view read them in\n if (hasBytes(view, dataOffset, dataLength)) {\n const value = readValue(tiff, tagId, view, dataOffset - view.sourceOffset, dataType, dataCount);\n return { type: 'inline', id: tagId, name: TiffTag[tagId], count: dataCount, value, dataType, tagOffset: offset };\n }\n return { type: 'lazy', id: tagId, name: TiffTag[tagId], count: dataCount, dataOffset, dataType, tagOffset: offset };\n}\n/** Fetch the value from a {@link TagLazy} tag */\nexport async function fetchLazy(tag, tiff, options) {\n if (tag.value != null)\n return tag.value;\n const dataTypeSize = getTiffTagSize(tag.dataType);\n const dataLength = dataTypeSize * tag.count;\n const bytes = await tiff.source.fetch(tag.dataOffset, dataLength, options);\n const view = new DataView(bytes);\n tag.value = readValue(tiff, tag.id, view, 0, tag.dataType, tag.count);\n return tag.value;\n}\n/**\n * Fetch all the values from a {@link TagOffset}\n */\nexport async function fetchAllOffsets(tiff, tag, options) {\n const dataTypeSize = getTiffTagSize(tag.dataType);\n if (tag.view == null) {\n const bytes = await tiff.source.fetch(tag.dataOffset, dataTypeSize * tag.count, options);\n tag.view = new DataView(bytes);\n tag.view.sourceOffset = tag.dataOffset;\n }\n tag.value = readValue(tiff, tag.id, tag.view, 0, tag.dataType, tag.count);\n tag.view = undefined;\n tag.isLoaded = true;\n return tag.value;\n}\nexport function setBytes(tag, view) {\n const dataTypeSize = getTiffTagSize(tag.dataType);\n const startBytes = view.byteOffset + tag.dataOffset - view.sourceOffset;\n tag.view = new DataView(view.buffer.slice(startBytes, startBytes + dataTypeSize * tag.count));\n tag.view.sourceOffset = tag.dataOffset;\n}\n/** Partially fetch the values of a {@link TagOffset} and return the value for the offset */\nexport async function getValueAt(tiff, tag, index, options) {\n if (index > tag.count || index < 0)\n throw new Error('TagOffset: out of bounds :' + index);\n if (tag.value[index] != null)\n return tag.value[index];\n const dataTypeSize = getTiffTagSize(tag.dataType);\n if (tag.view == null) {\n const bytes = await tiff.source.fetch(tag.dataOffset + index * dataTypeSize, dataTypeSize, options);\n const view = new DataView(bytes);\n // Skip type conversion to array by using undefined tiff tag id\n const value = readValue(tiff, undefined, view, 0, tag.dataType, 1);\n if (typeof value !== 'number')\n throw new Error('Value is not a number');\n tag.value[index] = value;\n return value;\n }\n // Skip type conversion to array by using undefined tiff tag id\n const value = readValue(tiff, undefined, tag.view, index * dataTypeSize, tag.dataType, 1);\n if (typeof value !== 'number')\n throw new Error('Value is not a number');\n tag.value[index] = value;\n return value;\n}\nexport function getValueAtSync(tiff, tag, index) {\n if (index > tag.count || index < 0)\n throw new Error('TagOffset: out of bounds :' + index);\n if (tag.value[index] != null)\n return tag.value[index];\n if (tag.view == null)\n return null;\n const dataTypeSize = getTiffTagSize(tag.dataType);\n const value = readValue(tiff, undefined, tag.view, index * dataTypeSize, tag.dataType, 1);\n if (typeof value !== 'number')\n throw new Error('Value is not a number');\n tag.value[index] = value;\n return value;\n}\n","import { getCompressionMimeType, TiffCompressionMimeType, TiffMimeType } from './const/tiff.mime.js';\nimport { Compression, ModelTypeCode, SubFileType, TiffTag, TiffTagGeo } from './const/tiff.tag.id.js';\nimport { fetchAllOffsets, fetchLazy, getValueAt, getValueAtSync } from './read/tiff.tag.factory.js';\nimport { getUint } from './util/bytes.js';\n/** Invalid EPSG code */\nexport const InvalidProjectionCode = 32767;\n/** Tags that are commonly accessed for geotiffs */\nexport const ImportantTags = new Set([\n TiffTag.Compression,\n TiffTag.ImageHeight,\n TiffTag.ImageWidth,\n TiffTag.ModelPixelScale,\n TiffTag.ModelTiePoint,\n TiffTag.ModelTransformation,\n TiffTag.TileHeight,\n TiffTag.TileWidth,\n]);\nexport const ImportantGeoTags = new Set([TiffTag.GeoKeyDirectory, TiffTag.GeoAsciiParams, TiffTag.GeoDoubleParams]);\nexport class TiffImage {\n /**\n * Id of the tif image, generally the image index inside the tif\n * where 0 is the root image, and every sub image is +1\n *\n * @example 0, 1, 2\n */\n id;\n /** Reference to the TIFF that owns this image */\n tiff;\n /** Has loadGeoTiffTags been called */\n isGeoTagsLoaded = false;\n /** Sub tags stored in TiffTag.GeoKeyDirectory */\n tagsGeo = new Map();\n /** All IFD tags that have been read for the image */\n tags;\n constructor(tiff, id, tags) {\n this.tiff = tiff;\n this.id = id;\n this.tags = tags;\n }\n /**\n * Force loading of important tags if they have not already been loaded\n *\n * @param loadGeoTags Whether to load the GeoKeyDirectory and unpack it\n */\n async init(loadGeoTags = true, options) {\n const requiredTags = [];\n ImportantTags.forEach((tag) => {\n requiredTags.push(this.fetch(tag, options));\n });\n if (loadGeoTags) {\n ImportantGeoTags.forEach((tag) => {\n requiredTags.push(this.fetch(tag, options));\n });\n }\n await Promise.all(requiredTags);\n if (loadGeoTags)\n await this.loadGeoTiffTags();\n }\n /**\n * Get the value of a TiffTag if it has been loaded, null otherwise.\n *\n * If the value is not loaded use {@link TiffImage.fetch} to load the value\n * Or use {@link TiffImage.has} to check if the tag exists\n *\n *\n * @returns value if loaded, null otherwise\n */\n value(tag) {\n const sourceTag = this.tags.get(tag);\n if (sourceTag == null)\n return null;\n if (sourceTag.type === 'offset' && sourceTag.isLoaded === false)\n return null;\n // TODO would be good to type check this\n return sourceTag.value;\n }\n /**\n * Does the tag exist\n *\n * @example\n * ```typescript\n * img.has(TiffTag.ImageWidth) // true\n * ```\n *\n * @param tag Tag to check\n * @returns true if the tag exists, false otherwise\n */\n has(tag) {\n return this.tags.has(tag);\n }\n /**\n * Load a tag.\n *\n * If it is not currently loaded, fetch the required data for the tag.\n *\n * @example\n * ```typescript\n * await img.fetch(TiffTag.ImageWidth) // 512 (px)\n * ```\n *\n * @param tag tag to fetch\n */\n async fetch(tag, options) {\n const sourceTag = this.tags.get(tag);\n if (sourceTag == null)\n return null;\n if (sourceTag.type === 'inline')\n return sourceTag.value;\n if (sourceTag.type === 'lazy')\n return fetchLazy(sourceTag, this.tiff, options);\n if (sourceTag.isLoaded)\n return sourceTag.value;\n if (sourceTag.type === 'offset')\n return fetchAllOffsets(this.tiff, sourceTag, options);\n throw new Error('Cannot fetch:' + tag);\n }\n /**\n * Get the associated TiffTagGeo\n *\n * @example\n * ```typescript\n * image.valueGeo(TiffTagGeo.GTRasterTypeGeoKey)\n * ```\n * @throws if {@link loadGeoTiffTags} has not been called\n */\n valueGeo(tag) {\n if (this.isGeoTagsLoaded === false)\n throw new Error('loadGeoTiffTags() has not been called');\n return this.tagsGeo.get(tag);\n }\n /**\n * Load and parse the GDAL_NODATA Tifftag\n *\n * @throws if the tag is not loaded\n * @returns null if the tag does not exist\n */\n get noData() {\n const tag = this.tags.get(TiffTag.GdalNoData);\n if (tag == null)\n return null;\n if (tag.value != null)\n return Number(tag.value);\n throw new Error('GdalNoData tag is not loaded');\n }\n /**\n * Load and unpack the GeoKeyDirectory\n *\n * @see {TiffTag.GeoKeyDirectory}\n */\n async loadGeoTiffTags() {\n // Already loaded\n if (this.isGeoTagsLoaded)\n return;\n const sourceTag = this.tags.get(TiffTag.GeoKeyDirectory);\n if (sourceTag == null) {\n this.isGeoTagsLoaded = true;\n return;\n }\n if (sourceTag.type === 'lazy' && sourceTag.value == null) {\n // Load all the required keys\n await Promise.all([\n this.fetch(TiffTag.GeoKeyDirectory),\n this.fetch(TiffTag.GeoAsciiParams),\n this.fetch(TiffTag.GeoDoubleParams),\n ]);\n }\n this.isGeoTagsLoaded = true;\n if (sourceTag.value == null)\n return;\n const geoTags = sourceTag.value;\n if (typeof geoTags === 'number')\n throw new Error('Invalid geo tags found');\n for (let i = 4; i <= geoTags[3] * 4; i += 4) {\n const key = geoTags[i];\n const locationTagId = geoTags[i + 1];\n const offset = geoTags[i + 3];\n if (locationTagId === 0) {\n this.tagsGeo.set(key, offset);\n continue;\n }\n const tag = this.tags.get(locationTagId);\n if (tag == null || tag.value == null)\n continue;\n const count = geoTags[i + 2];\n if (typeof tag.value === 'string') {\n this.tagsGeo.set(key, tag.value.slice(offset, offset + count - 1).trim());\n }\n else if (Array.isArray(tag.value)) {\n if (count === 1)\n this.tagsGeo.set(key, tag.value[offset]);\n else\n this.tagsGeo.set(key, tag.value.slice(offset, offset + count));\n }\n else {\n throw new Error('Failed to extract GeoTiffTags');\n }\n }\n }\n /**\n * Get the origin point for the image\n *\n * @returns origin point of the image\n */\n get origin() {\n const tiePoints = this.value(TiffTag.ModelTiePoint);\n if (tiePoints != null && tiePoints.length === 6) {\n return [tiePoints[3], tiePoints[4], tiePoints[5]];\n }\n const modelTransformation = this.value(TiffTag.ModelTransformation);\n if (modelTransformation != null) {\n return [modelTransformation[3], modelTransformation[7], modelTransformation[11]];\n }\n // If this is a sub image, use the origin from the top level image\n if (this.value(TiffTag.SubFileType) === SubFileType.ReducedImage && this.id !== 0) {\n return this.tiff.images[0].origin;\n }\n throw new Error('Image does not have a geo transformation.');\n }\n /** Is there enough geo information on this image to figure out where its actually located */\n get isGeoLocated() {\n const isImageLocated = this.value(TiffTag.ModelPixelScale) != null || this.value(TiffTag.ModelTransformation) != null;\n if (isImageLocated)\n return true;\n // If this is a sub image, use the isGeoLocated from the top level image\n if (this.isSubImage && this.id !== 0)\n return this.tiff.images[0].isGeoLocated;\n return false;\n }\n /**\n * Get the resolution of the image\n *\n * @returns [x,y,z] pixel scale\n */\n get resolution() {\n const modelPixelScale = this.value(TiffTag.ModelPixelScale);\n if (modelPixelScale != null) {\n return [modelPixelScale[0], -modelPixelScale[1], modelPixelScale[2]];\n }\n const modelTransformation = this.value(TiffTag.ModelTransformation);\n if (modelTransformation != null) {\n return [modelTransformation[0], modelTransformation[5], modelTransformation[10]];\n }\n // If this is a sub image, use the resolution from the top level image\n if (this.isSubImage && this.id !== 0) {\n const firstImg = this.tiff.images[0];\n const [resX, resY, resZ] = firstImg.resolution;\n const firstImgSize = firstImg.size;\n const imgSize = this.size;\n // scale resolution based on the size difference between the two images\n return [(resX * firstImgSize.width) / imgSize.width, (resY * firstImgSize.height) / imgSize.height, resZ];\n }\n throw new Error('Image does not have a geo transformation.');\n }\n /**\n * Is this image a reduced size image\n * @see {@link TiffTag.SubFileType}\n * @returns true if SubFileType is Reduces image, false otherwise\n */\n get isSubImage() {\n return this.value(TiffTag.SubFileType) === SubFileType.ReducedImage;\n }\n /**\n * Bounding box of the image\n *\n * @returns [minX, minY, maxX, maxY] bounding box\n */\n get bbox() {\n const size = this.size;\n const origin = this.origin;\n const resolution = this.resolution;\n if (origin == null || size == null || resolution == null) {\n throw new Error('Unable to calculate bounding box');\n }\n const x1 = origin[0];\n const y1 = origin[1];\n const x2 = x1 + resolution[0] * size.width;\n const y2 = y1 + resolution[1] * size.height;\n return [Math.min(x1, x2), Math.min(y1, y2), Math.max(x1, x2), Math.max(y1, y2)];\n }\n /**\n * Get the compression used by the tile\n *\n * @see {@link TiffCompressionMimeType}\n *\n * @returns Compression type eg webp\n */\n get compression() {\n const compression = this.value(TiffTag.Compression);\n if (compression == null)\n return null;\n return TiffCompressionMimeType[compression];\n }\n /**\n * Attempt to read the EPSG Code from TiffGeoTags\n *\n * looks at TiffTagGeo.ProjectionGeoKey, TiffTagGeo.ProjectedCRSGeoKey and TiffTagGeo.GeodeticCRSGeoKey\n *\n * @returns EPSG Code if it exists and is not user defined.\n */\n get epsg() {\n const proj = this.valueGeo(TiffTagGeo.ProjectionGeoKey);\n if (proj != null && proj !== InvalidProjectionCode)\n return proj;\n let projection = null;\n switch (this.valueGeo(TiffTagGeo.GTModelTypeGeoKey)) {\n case ModelTypeCode.Unknown:\n return null;\n case ModelTypeCode.Projected:\n projection = this.valueGeo(TiffTagGeo.ProjectedCRSGeoKey);\n break;\n case ModelTypeCode.Geographic:\n projection = this.valueGeo(TiffTagGeo.GeodeticCRSGeoKey);\n break;\n case ModelTypeCode.Geocentric:\n projection = this.valueGeo(TiffTagGeo.GeodeticCRSGeoKey);\n break;\n case ModelTypeCode.UserDefined:\n return null;\n }\n if (projection === InvalidProjectionCode)\n return null;\n return projection;\n }\n /**\n * Get the size of the image\n *\n * @returns Size in pixels\n */\n get size() {\n const width = this.value(TiffTag.ImageWidth);\n const height = this.value(TiffTag.ImageHeight);\n if (width == null || height == null)\n throw new Error('Tiff has no height or width');\n return { width, height };\n }\n /**\n * Determine if this image is tiled\n */\n isTiled() {\n return this.value(TiffTag.TileWidth) !== null;\n }\n /**\n * Get size of individual tiles\n */\n get tileSize() {\n const width = this.value(TiffTag.TileWidth);\n const height = this.value(TiffTag.TileHeight);\n if (width == null || height == null)\n throw new Error('Tiff is not tiled');\n return { width, height };\n }\n /**\n * Number of tiles used to create this image\n */\n get tileCount() {\n const size = this.size;\n const tileSize = this.tileSize;\n const x = Math.ceil(size.width / tileSize.width);\n const y = Math.ceil(size.height / tileSize.height);\n return { x, y };\n }\n /**\n * Get the pointer to where the tiles start in the Tiff file\n *\n * @remarks Used to read tiled tiffs\n *\n * @returns file offset to where the tiffs are stored\n */\n get tileOffset() {\n const tileOffset = this.tags.get(TiffTag.TileOffsets);\n if (tileOffset == null)\n throw new Error('No tile offsets found');\n return tileOffset;\n }\n /**\n * Get the number of strip's inside this tiff\n *\n * @remarks Used to read striped tiffs\n *\n * @returns number of strips present\n */\n get stripCount() {\n return this.tags.get(TiffTag.StripByteCounts)?.count ?? 0;\n }\n // Clamp the bounds of the output image to the size of the image, as sometimes the edge tiles are not full tiles\n getTileBounds(x, y) {\n const { size, tileSize } = this;\n const top = y * tileSize.height;\n const left = x * tileSize.width;\n const width = left + tileSize.width >= size.width ? size.width - left : tileSize.width;\n const height = top + tileSize.height >= size.height ? size.height - top : tileSize.height;\n return { x: left, y: top, width, height };\n }\n /**\n * Read a strip into a ArrayBuffer\n *\n * Image has to be striped see {@link stripCount}\n *\n * @param index Strip index to read\n */\n async getStrip(index, options) {\n if (this.isTiled())\n throw new Error('Cannot read stripes, tiff is tiled: ' + index);\n const byteCounts = this.tags.get(TiffTag.StripByteCounts);\n const offsets = this.tags.get(TiffTag.StripOffsets);\n if (index >= byteCounts.count)\n throw new Error('Cannot read strip, index out of bounds');\n const [byteCount, offset] = await Promise.all([\n getOffset(this.tiff, offsets, index, options),\n getOffset(this.tiff, byteCounts, index, options),\n ]);\n return this.getBytes(byteCount, offset, options);\n }\n /** The jpeg header is stored in the IFD, read the JPEG header and adjust the byte array to include it */\n getJpegHeader(bytes) {\n // Both the JPEGTable and the Bytes with have the start of image and end of image markers\n // StartOfImage 0xffd8 EndOfImage 0xffd9\n const tables = this.value(TiffTag.JpegTables);\n if (tables == null)\n throw new Error('Unable to find Jpeg header');\n // Remove EndOfImage marker\n const tableData = tables.slice(0, tables.length - 2);\n const actualBytes = new Uint8Array(bytes.byteLength + tableData.length - 2);\n actualBytes.set(tableData, 0);\n actualBytes.set(new Uint8Array(bytes).slice(2), tableData.length);\n return actualBytes.buffer.slice(actualBytes.byteOffset, actualBytes.byteOffset + actualBytes.byteLength);\n }\n /** Read image bytes at the given offset */\n async getBytes(offset, byteCount, options) {\n if (byteCount === 0)\n return null;\n const bytes = await this.tiff.source.fetch(offset, byteCount, options);\n if (bytes.byteLength < byteCount) {\n throw new Error(`Failed to fetch bytes from offset:${offset} wanted:${byteCount} got:${bytes.byteLength}`);\n }\n let compression = this.value(TiffTag.Compression);\n if (compression == null)\n compression = Compression.None; // No compression found default ??\n const mimeType = getCompressionMimeType(compression) ?? TiffMimeType.None;\n if (compression === Compression.Jpeg)\n return { mimeType, bytes: this.getJpegHeader(bytes), compression };\n return { mimeType, bytes, compression };\n }\n /**\n * Load a tile into a ArrayBuffer\n *\n * if the tile compression is JPEG, This will also apply the JPEG compression tables to the resulting ArrayBuffer see {@link getJpegHeader}\n *\n * @param x Tile x offset\n * @param y Tile y offset\n */\n async getTile(x, y, options) {\n const size = this.size;\n const tiles = this.tileSize;\n if (tiles == null)\n throw new Error('Tiff is not tiled');\n // TODO support GhostOptionTileOrder\n const nyTiles = Math.ceil(size.height / tiles.height);\n const nxTiles = Math.ceil(size.width / tiles.width);\n if (x >= nxTiles || y >= nyTiles) {\n throw new Error(`Tile index is outside of range x:${x} >= ${nxTiles} or y:${y} >= ${nyTiles}`);\n }\n const idx = y * nxTiles + x;\n const totalTiles = nxTiles * nyTiles;\n if (idx >= totalTiles)\n throw new Error(`Tile index is outside of tile range: ${idx} >= ${totalTiles}`);\n const { offset, imageSize } = await this.getTileSize(idx, options);\n return this.getBytes(offset, imageSize, options);\n }\n /**\n * Does this tile exist in the tiff and does it actually have a value\n *\n * Sparse tiffs can have a lot of empty tiles, they set the tile size to `0 bytes` when the tile is empty\n * this checks the tile byte size to validate if it actually has any data.\n *\n * @param x Tile x offset\n * @param y Tile y offset\n *\n * @returns if the tile exists and has data\n */\n async hasTile(x, y, options) {\n const tiles = this.tileSize;\n const size = this.size;\n if (tiles == null)\n throw new Error('Tiff is not tiled');\n // TODO support GhostOptionTileOrder\n const nyTiles = Math.ceil(size.height / tiles.height);\n const nxTiles = Math.ceil(size.width / tiles.width);\n if (x >= nxTiles || y >= nyTiles)\n return false;\n const idx = y * nxTiles + x;\n const ret = await this.getTileSize(idx, options);\n return ret.offset > 0;\n }\n /**\n * Load the offset and byteCount of a tile\n *\n * if the tiff is sparse, offset and byteCount will be zero if the tile is empty\n *\n * @param index index in the tile array\n * @returns Offset and byteCount for the tile\n */\n async getTileSize(index, options) {\n // If both the tile offset and tile byte counts are loaded,\n // we can get the offset and byte count synchronously without needing to fetch any additional data\n const byteCounts = this.tags.get(TiffTag.TileByteCounts);\n const tileOffset = getOffsetSync(this.tiff, this.tileOffset, index);\n const tileSize = getOffsetSync(this.tiff, byteCounts, index);\n if (tileOffset != null && tileSize != null)\n return { offset: tileOffset, imageSize: tileSize };\n // GDAL optimizes tiles by storing the size of the tile in\n // the few bytes leading up to the tile\n const leaderBytes = this.tiff.options?.tileLeaderByteSize;\n if (leaderBytes) {\n const offset = tileOffset ?? (await getOffset(this.tiff, this.tileOffset, index, options));\n // Sparse tiff no data found\n if (offset === 0)\n return { offset: 0, imageSize: 0 };\n // This fetch will generally load in the bytes needed for the image too\n // provided the image size is less than the size of a chunk\n const bytes = await this.tiff.source.fetch(offset - leaderBytes, leaderBytes, options);\n return { offset, imageSize: getUint(new DataView(bytes), 0, leaderBytes, this.tiff.isLittleEndian) };\n }\n if (byteCounts == null)\n throw new Error('No tile byte counts found');\n const [offset, imageSize] = await Promise.all([\n tileOffset ?? getOffset(this.tiff, this.tileOffset, index, options),\n tileSize ?? getOffset(this.tiff, byteCounts, index, options),\n ]);\n return { offset, imageSize };\n }\n}\nfunction getOffset(tiff, x, index, options) {\n const val = getOffsetSync(tiff, x, index);\n if (val != null)\n return Promise.resolve(val);\n return getValueAt(tiff, x, index, options);\n}\nfunction getOffsetSync(tiff, x, index) {\n if (index < 0) {\n throw new Error(`Tiff: ${tiff.source.url.href} out of bounds ${TiffTag[x.id]} index:${index} total:${x.count}`);\n }\n // Sparse tiffs may not have the full tileWidth * tileHeight in their offset arrays\n if (index >= x.count)\n return 0;\n if (x.type === 'inline')\n return x.value[index];\n if (x.isLoaded)\n return x.value[index];\n return getValueAtSync(tiff, x, index);\n}\n","import { ByteSize } from '../util/bytes.js';\nexport var GhostOption;\n(function (GhostOption) {\n GhostOption[\"GdalStructuralMetadataSize\"] = \"GDAL_STRUCTURAL_METADATA_SIZE\";\n GhostOption[\"Layout\"] = \"LAYOUT\";\n GhostOption[\"BlockOrder\"] = \"BLOCK_ORDER\";\n GhostOption[\"BlockLeader\"] = \"BLOCK_LEADER\";\n GhostOption[\"BlockTrailer\"] = \"BLOCK_TRAILER\";\n GhostOption[\"KnownIncompatibleEdition\"] = \"KNOWN_INCOMPATIBLE_EDITION\";\n GhostOption[\"MaskInterleavedWithImagery\"] = \"MASK_INTERLEAVED_WITH_IMAGERY\";\n})(GhostOption || (GhostOption = {}));\nexport var GhostOptionTileOrder;\n(function (GhostOptionTileOrder) {\n GhostOptionTileOrder[\"RowMajor\"] = \"ROW_MAJOR\";\n})(GhostOptionTileOrder || (GhostOptionTileOrder = {}));\nexport var GhostOptionTileLeader;\n(function (GhostOptionTileLeader) {\n GhostOptionTileLeader[\"uint32\"] = \"SIZE_AS_UINT4\";\n})(GhostOptionTileLeader || (GhostOptionTileLeader = {}));\n/**\n * GDAL has made a ghost set of options for Tiff files\n * this class represents the optimizations that GDAL has applied\n */\nexport class TiffGhostOptions {\n options = new Map();\n /**\n * Has GDAL optimized this tiff\n */\n get isCogOptimized() {\n if (this.isBroken)\n return false;\n return this.options.get(GhostOption.Layout) === 'IFDS_BEFORE_DATA';\n }\n /**\n * Has GDAL determined this tiff is now broken\n */\n get isBroken() {\n return this.options.get(GhostOption.KnownIncompatibleEdition) === 'YES';\n }\n /**\n * Load the ghost options from a source\n * @param bytes the ghost header bytes\n */\n process(bytes, offset, ghostSize) {\n let key = '';\n let value = '';\n let setValue = false;\n for (let i = 0; i < ghostSize; i++) {\n const charCode = bytes.getUint8(offset + i);\n if (charCode === 0)\n break;\n const char = String.fromCharCode(charCode);\n if (char === '\\n') {\n this.options.set(key.trim(), value.trim());\n key = '';\n value = '';\n setValue = false;\n }\n else if (char === '=') {\n setValue = true;\n }\n else {\n if (setValue)\n value += char;\n else\n key += char;\n }\n }\n }\n /**\n * If the tile leader is set, how many bytes are allocated to the tile size\n */\n get tileLeaderByteSize() {\n switch (this.options.get(GhostOption.BlockLeader)) {\n case GhostOptionTileLeader.uint32:\n return ByteSize.UInt32;\n default:\n return null;\n }\n }\n get isMaskInterleaved() {\n return this.options.get(GhostOption.MaskInterleavedWithImagery) === 'YES';\n }\n}\n","import { TiffVersion } from '../const/tiff.version.js';\nimport { ByteSize } from '../util/bytes.js';\nexport const TagTiffConfig = {\n version: TiffVersion.Tiff,\n pointer: ByteSize.UInt32,\n offset: ByteSize.UInt16,\n /**\n * Each tag entry is specified as\n * UInt16:TagCode\n * UInt16:TagType\n * UInt32:TagCount\n * UInt32:Pointer To Value or value\n */\n ifd: ByteSize.UInt16 + ByteSize.UInt16 + 2 * ByteSize.UInt32,\n};\nexport const TagTiffBigConfig = {\n version: TiffVersion.BigTiff,\n /** Size of most pointers */\n pointer: ByteSize.UInt64,\n /** Size of offsets */\n offset: ByteSize.UInt64,\n /**\n * Each tag entry is specified as\n * UInt16:TagCode\n * UInt16:TagType\n * UInt64:TagCount\n * UInt64:Pointer To Value or value\n */\n ifd: ByteSize.UInt16 + ByteSize.UInt16 + 2 * ByteSize.UInt64,\n};\nexport const TiffIfdEntry = {\n [TiffVersion.BigTiff]: TagTiffBigConfig,\n [TiffVersion.Tiff]: TagTiffConfig,\n};\n","/**\n * Convert a number to a formatted hex string\n *\n * @param num number to convert\n * @param padding number of 0's to pad the digit with\n * @param prefix should a `0x` be prefixed to the string\n *\n * @returns hex string eg 0x0015\n **/\nexport function toHex(num, padding = 4, prefix = true) {\n const hex = num.toString(16).padStart(padding, '0');\n if (prefix)\n return '0x' + hex;\n return hex;\n}\n","import { TiffEndian } from './const/tiff.endian.js';\nimport { TiffVersion } from './const/tiff.version.js';\nimport { hasBytes } from './read/data.view.offset.js';\nimport { TiffGhostOptions } from './read/tiff.gdal.js';\nimport { TagTiffBigConfig, TagTiffConfig } from './read/tiff.ifd.config.js';\nimport { createTag } from './read/tiff.tag.factory.js';\nimport { TiffImage } from './tiff.image.js';\nimport { getUint } from './util/bytes.js';\nimport { toHex } from './util/util.hex.js';\nexport class Tiff {\n /** Read 16KB blocks at a time */\n static DefaultReadSize = 16 * 1024;\n /** Read 16KB blocks at a time */\n defaultReadSize = Tiff.DefaultReadSize;\n /** Where this cog is fetching its data from */\n source;\n /** Big or small Tiff */\n version = TiffVersion.Tiff;\n /** List of images, o is the base image */\n images = [];\n /** Ghost header options */\n options;\n /** Configuration for the size of the IFD */\n ifdConfig = TagTiffConfig;\n /** Is the tiff being read is little Endian */\n isLittleEndian = false;\n /** Has init() been called */\n isInitialized = false;\n _initPromise;\n /** A Tiff constructed from a source will not be pre-initialized with {@link init}. */\n constructor(source, options = { defaultReadSize: Tiff.DefaultReadSize }) {\n this.source = source;\n this.defaultReadSize = options.defaultReadSize;\n }\n /** Create a tiff and initialize it by reading the tiff headers */\n static create(source, options = { defaultReadSize: Tiff.DefaultReadSize }) {\n return new Tiff(source, options).init(options);\n }\n /**\n * Initialize the tiff loading in the header and all image headers.\n *\n * This is only required if the Tiff was created with the constructor, if you\n * used {@link create} this will have already been called.\n */\n init(options) {\n if (this.isInitialized)\n return Promise.resolve(this);\n if (this._initPromise)\n return this._initPromise;\n this._initPromise = this.readHeader(options);\n return this._initPromise;\n }\n /**\n * Find a image which has a resolution similar to the provided resolution\n *\n * @param resolution resolution to find\n */\n getImageByResolution(resolution) {\n const firstImage = this.images[0];\n const firstImageSize = firstImage.size;\n const [refX] = firstImage.resolution;\n const resolutionBaseX = refX * firstImageSize.width;\n // const resolutionBaseY = refY * firstImageSize.height;\n for (let i = this.images.length - 1; i > 0; i--) {\n const img = this.images[i];\n const imgSize = img.size;\n const imgResolutionX = resolutionBaseX / imgSize.width;\n // TODO do we care about y resolution\n // const imgResolutionY = resolutionBaseY / imgSize.height;\n if (imgResolutionX - resolution <= 0.01)\n return img;\n }\n return firstImage;\n }\n /** Read the Starting header and all Image headers from the source */\n async readHeader(options) {\n if (this.isInitialized)\n return this;\n // limit the read to the size of the file if it is known, for small tiffs\n const bytes = new DataView(await this.source.fetch(0, getMaxLength(this.source, 0, this.defaultReadSize), options));\n if (bytes.byteLength === 0)\n throw new Error('Unable to read empty tiff');\n bytes.sourceOffset = 0;\n let offset = 0;\n const endian = bytes.getUint16(offset, this.isLittleEndian);\n offset += 2;\n this.isLittleEndian = endian === TiffEndian.Little;\n this.version = bytes.getUint16(offset, this.isLittleEndian);\n offset += 2;\n let nextOffsetIfd;\n if (this.version === TiffVersion.BigTiff) {\n this.ifdConfig = TagTiffBigConfig;\n const pointerSize = bytes.getUint16(offset, this.isLittleEndian);\n offset += 2;\n if (pointerSize !== 8)\n throw new Error('Only 8byte pointers are supported');\n const zeros = bytes.getUint16(offset, this.isLittleEndian);\n offset += 2;\n if (zeros !== 0)\n throw new Error('Invalid big tiff header');\n nextOffsetIfd = getUint(bytes, offset, this.ifdConfig.pointer, this.isLittleEndian);\n offset += this.ifdConfig.pointer;\n }\n else if (this.version === TiffVersion.Tiff) {\n nextOffsetIfd = getUint(bytes, offset, this.ifdConfig.pointer, this.isLittleEndian);\n offset += this.ifdConfig.pointer;\n }\n else {\n throw new Error(`Only tiff supported version:${String(this.version)}`);\n }\n const ghostSize = nextOffsetIfd - offset;\n // GDAL now stores metadata between the IFD inside a ghost storage area\n if (ghostSize > 0 && ghostSize < 16 * 1024) {\n this.options = new TiffGhostOptions();\n this.options.process(bytes, offset, ghostSize);\n }\n while (nextOffsetIfd !== 0) {\n let lastView = bytes;\n // Ensure at least 1KB near at the IFD offset is ready for reading\n // TODO is 1KB enough, most IFD entries are in the order of 100-300 bytes\n if (!hasBytes(lastView, nextOffsetIfd, 1024)) {\n const bytes = await this.source.fetch(nextOffsetIfd, getMaxLength(this.source, nextOffsetIfd, this.defaultReadSize), options);\n lastView = new DataView(bytes);\n lastView.sourceOffset = nextOffsetIfd;\n }\n nextOffsetIfd = this.readIfd(nextOffsetIfd, lastView);\n }\n await Promise.all(this.images.map((i) => i.init(true, options)));\n this.isInitialized = true;\n return this;\n }\n /**\n * Read a IFD at a the provided offset\n *\n * @param offset file offset to read the header from\n * @param view offset that contains the bytes for the header\n */\n readIfd(offset, view) {\n const viewOffset = offset - view.sourceOffset;\n const tagCount = getUint(view, viewOffset, this.ifdConfig.offset, this.isLittleEndian);\n const tags = new Map();\n // We now know how many bytes we need so ensure the ifd bytes are all read\n const ifdBytes = tagCount * this.ifdConfig.ifd;\n if (!hasBytes(view, offset, ifdBytes)) {\n throw new Error('IFD out of range @ ' + toHex(offset) + ' IFD' + this.images.length);\n }\n const ifdSize = this.ifdConfig.ifd;\n const startOffset = viewOffset + this.ifdConfig.offset;\n for (let i = 0; i < tagCount; i++) {\n const tag = createTag(this, view, startOffset + i * ifdSize);\n tags.set(tag.id, tag);\n }\n this.images.push(new TiffImage(this, this.images.length, tags));\n return getUint(view, startOffset + tagCount * ifdSize, this.ifdConfig.pointer, this.isLittleEndian);\n }\n}\nfunction getMaxLength(source, offset, length) {\n const size = source.metadata?.size;\n // max length is unknown, roll the dice and hope the chunk exists\n if (size == null || size < 0)\n return length;\n // Read was going to happen past the end of the file limit it to the end of the file\n if (offset + length > size)\n return size - offset;\n return length;\n}\n","// TODO: in the future, have an API that returns an ImageBitmap directly from\n// the decoder, to avoid copying pixel data from GPU -> CPU memory\n// Then deck.gl could use the ImageBitmap directly as a texture source without\n// copying again from CPU -> GPU memory\n// https://github.com/developmentseed/deck.gl-raster/issues/228\nexport async function decode(bytes, metadata) {\n const blob = new Blob([bytes]);\n const imageBitmap = await createImageBitmap(blob);\n const canvas = new OffscreenCanvas(imageBitmap.width, imageBitmap.height);\n const ctx = canvas.getContext(\"2d\");\n ctx.drawImage(imageBitmap, 0, 0);\n imageBitmap.close();\n const { width, height } = canvas;\n const imageData = ctx.getImageData(0, 0, width, height);\n const rgba = imageData.data;\n const samplesPerPixel = metadata.samplesPerPixel;\n if (samplesPerPixel === 4) {\n return { layout: \"pixel-interleaved\", data: rgba };\n }\n if (samplesPerPixel === 3) {\n const pixelCount = width * height;\n const rgb = new Uint8ClampedArray(pixelCount * 3);\n for (let i = 0, j = 0; i < rgb.length; i += 3, j += 4) {\n rgb[i] = rgba[j];\n rgb[i + 1] = rgba[j + 1];\n rgb[i + 2] = rgba[j + 2];\n }\n return { layout: \"pixel-interleaved\", data: rgb };\n }\n throw new Error(`Unsupported SamplesPerPixel for JPEG: ${samplesPerPixel}`);\n}\n//# sourceMappingURL=canvas.js.map","export function assert(expression, msg = \"\") {\n if (!expression) {\n throw new Error(msg);\n }\n}\nexport async function decompressWithDecompressionStream(data, { format, signal }) {\n const response = data instanceof Response ? data : new Response(data);\n assert(response.body, \"Response does not contain body.\");\n try {\n const decompressedResponse = new Response(response.body.pipeThrough(new DecompressionStream(format), { signal }));\n const buffer = await decompressedResponse.arrayBuffer();\n return buffer;\n }\n catch {\n signal?.throwIfAborted();\n throw new Error(`Failed to decode ${format}`);\n }\n}\n//# sourceMappingURL=decompression-stream.js.map","import { decompressWithDecompressionStream } from \"./decompression-stream.js\";\nexport async function decode(bytes) {\n return decompressWithDecompressionStream(bytes, { format: \"deflate\" });\n}\n//# sourceMappingURL=deflate.js.map","import { PlanarConfiguration, Predictor } from \"@cogeotiff/core\";\n/**\n * Undo TIFF horizontal differencing (predictor 2) or floating-point\n * prediction (predictor 3) in-place on a decoded tile buffer.\n *\n * Mirrors the applyPredictor logic in geotiff.js.\n */\n/** Undo horizontal differencing for integer samples (predictor 2). */\nfunction decodeRowAcc(row, stride) {\n const r = row;\n let offset = 0;\n let length = row.length - stride;\n do {\n for (let i = stride; i > 0; i--) {\n r[offset + stride] = (r[offset + stride] ?? 0) + (r[offset] ?? 0);\n offset++;\n }\n length -= stride;\n } while (length > 0);\n}\n/** Undo floating-point horizontal differencing (predictor 3). */\nfunction decodeRowFloatingPoint(row, stride, bytesPerSample) {\n let index = 0;\n let count = row.length;\n const wc = count / bytesPerSample;\n while (count > stride) {\n for (let i = stride; i > 0; i--) {\n row[index + stride] += row[index];\n index++;\n }\n count -= stride;\n }\n const copy = row.slice();\n for (let i = 0; i < wc; i++) {\n for (let b = 0; b < bytesPerSample; b++) {\n row[bytesPerSample * i + b] = copy[(bytesPerSample - b - 1) * wc + i];\n }\n }\n}\n/**\n * Apply TIFF predictor decoding to a raw decoded tile buffer in-place.\n *\n * @param block Decoded tile bytes.\n * @param predictor Predictor enum value.\n * @param width Tile width in pixels.\n * @param height Tile height in pixels.\n * @param bitsPerSample Bits per sample (all samples must be equal).\n * @param samplesPerPixel Number of bands.\n * @param planarConfiguration PlanarConfiguration enum value.\n */\nexport function applyPredictor(block, predictor, width, height, bitsPerSample, samplesPerPixel, planarConfiguration) {\n if (predictor === Predictor.None) {\n return block;\n }\n const bytesPerSample = bitsPerSample / 8;\n const stride = planarConfiguration === PlanarConfiguration.Separate ? 1 : samplesPerPixel;\n for (let i = 0; i < height; i++) {\n const byteOffset = i * stride * width * bytesPerSample;\n if (byteOffset >= block.byteLength) {\n break;\n }\n if (predictor === Predictor.Horizontal) {\n let row;\n const length = stride * width;\n switch (bitsPerSample) {\n case 8:\n row = new Uint8Array(block, byteOffset, length);\n break;\n case 16:\n row = new Uint16Array(block, byteOffset, length);\n break;\n case 32:\n row = new Uint32Array(block, byteOffset, length);\n break;\n default:\n throw new Error(`Predictor 2 not supported for ${bitsPerSample} bits per sample.`);\n }\n decodeRowAcc(row, stride);\n }\n else if (predictor === Predictor.FloatingPoint) {\n const row = new Uint8Array(block, byteOffset, stride * width * bytesPerSample);\n decodeRowFloatingPoint(row, stride, bytesPerSample);\n }\n }\n return block;\n}\n//# sourceMappingURL=predictor.js.map","import { Compression, SampleFormat } from \"@cogeotiff/core\";\nimport { decode as decodeViaCanvas } from \"./codecs/canvas.js\";\nimport { decode as decodeDeflate } from \"./codecs/deflate.js\";\nimport { applyPredictor } from \"./codecs/predictor.js\";\nasync function decodeUncompressed(bytes) {\n return bytes;\n}\n/**\n * The global registry of decoders for each compression type.\n *\n * This maps a {@link Compression} value to a function that returns a promise of\n * a {@link Decoder}.\n */\nexport const DECODER_REGISTRY = new Map();\nDECODER_REGISTRY.set(Compression.None, () => Promise.resolve(decodeUncompressed));\nDECODER_REGISTRY.set(Compression.Deflate, () => Promise.resolve(decodeDeflate));\nDECODER_REGISTRY.set(Compression.DeflateOther, () => Promise.resolve(decodeDeflate));\nDECODER_REGISTRY.set(Compression.Lzw, () => import(\"./codecs/lzw.js\").then((m) => m.decode));\nDECODER_REGISTRY.set(Compression.Zstd, () => import(\"./codecs/zstd.js\").then((m) => m.decode));\n// DECODER_REGISTRY.set(Compression.Lzma, () =>\n// import(\"../codecs/lzma.js\").then((m) => m.decode),\n// );\n// DECODER_REGISTRY.set(Compression.Jp2000, () =>\n// import(\"../codecs/jp2000.js\").then((m) => m.decode),\n// );\nDECODER_REGISTRY.set(Compression.Jpeg, () => Promise.resolve(decodeViaCanvas));\nDECODER_REGISTRY.set(Compression.Jpeg6, () => Promise.resolve(decodeViaCanvas));\nDECODER_REGISTRY.set(Compression.Webp, () => Promise.resolve(decodeViaCanvas));\nDECODER_REGISTRY.set(Compression.Lerc, () => import(\"./codecs/lerc.js\").then((m) => m.decode));\n/**\n * Decode a tile's bytes according to its compression and image metadata.\n */\nexport async function decode(bytes, compression, metadata) {\n const loader = DECODER_REGISTRY.get(compression);\n if (!loader) {\n throw new Error(`Unsupported compression: ${compression}`);\n }\n const decoder = await loader();\n const result = await decoder(bytes, metadata);\n if (result instanceof ArrayBuffer) {\n const { predictor, width, height, bitsPerSample, samplesPerPixel, planarConfiguration, } = metadata;\n const predicted = applyPredictor(result, predictor, width, height, bitsPerSample, samplesPerPixel, planarConfiguration);\n return {\n layout: \"pixel-interleaved\",\n data: toTypedArray(predicted, metadata),\n };\n }\n return result;\n}\n/**\n * Unpack a 1-bit packed mask buffer (MSB-first) into a Uint8Array of 0/255.\n * Each input byte holds 8 pixels; bit 7 is the first pixel in that byte.\n */\n// TODO: check for FillOrder tag and reverse bit order if needed\n// https://web.archive.org/web/20240329145342/https://www.awaresystems.be/imaging/tiff/tifftags/fillorder.html\nexport function unpackBitPacked(buffer, pixelCount) {\n const packed = new Uint8Array(buffer);\n const out = new Uint8Array(pixelCount);\n for (let i = 0; i < pixelCount; i++) {\n out[i] = (packed[i >> 3] >> (7 - (i & 7))) & 1 ? 255 : 0;\n }\n return out;\n}\n/**\n * Convert a raw ArrayBuffer of pixel data into a typed array based on the\n * sample format and bits per sample. This is used for codecs that return raw\n * bytes.\n */\nfunction toTypedArray(buffer, metadata) {\n const { sampleFormat, bitsPerSample } = metadata;\n switch (sampleFormat) {\n case SampleFormat.Uint:\n switch (bitsPerSample) {\n case 1:\n return unpackBitPacked(buffer, metadata.width * metadata.height * metadata.samplesPerPixel);\n case 8:\n return new Uint8Array(buffer);\n case 16:\n return new Uint16Array(buffer);\n case 32:\n return new Uint32Array(buffer);\n }\n break;\n case SampleFormat.Int:\n switch (bitsPerSample) {\n case 8:\n return new Int8Array(buffer);\n case 16:\n return new Int16Array(buffer);\n case 32:\n return new Int32Array(buffer);\n }\n break;\n case SampleFormat.Float:\n switch (bitsPerSample) {\n case 32:\n return new Float32Array(buffer);\n case 64:\n return new Float64Array(buffer);\n }\n break;\n }\n throw new Error(`Unsupported sample format/depth: SampleFormat=${sampleFormat}, BitsPerSample=${bitsPerSample}`);\n}\n//# sourceMappingURL=decode.js.map"],"x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19],"mappings":";;;;;;AAKA,IAAW;CACV,SAAU,YAAY;CACnB,WAAW,WAAW,SAAS,SAAS;CACxC,WAAW,WAAW,YAAY,SAAS;AAC/C,GAAG,eAAe,aAAa,CAAC,EAAE;;;;ACRlC,IAAW;CACV,SAAU,aAAa;;CAEpB,YAAY,YAAY,kBAAkB,KAAK;;CAE/C,YAAY,YAAY,UAAU,KAAK;;CAEvC,YAAY,YAAY,UAAU,KAAK;AAC3C,GAAG,gBAAgB,cAAc,CAAC,EAAE;AACpC,IAAW;CACV,SAAU,aAAa;CAEpB,YAAY,YAAY,aAAa,KAAK;CAE1C,YAAY,YAAY,cAAc,KAAK;CAE3C,YAAY,YAAY,iBAAiB,KAAK;CAE9C,YAAY,YAAY,gBAAgB,KAAK;CAE7C,YAAY,YAAY,aAAa,KAAK;CAE1C,YAAY,YAAY,cAAc,KAAK;CAE3C,YAAY,YAAY,iBAAiB,KAA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IAAI,IAAI,GAAG,IAAI,YAAY,KAC5B,IAAI,KAAM,OAAO,KAAK,MAAO,KAAK,IAAI,KAAO,IAAI,MAAM;CAE3D,OAAO;AACX;;;;;;AAMA,SAAS,aAAa,QAAQ,UAAU;CACpC,MAAM,EAAE,cAAc,kBAAkB;CACxC,QAAQ,cAAR;EACI,KAAK,aAAa;GACd,QAAQ,eAAR;IACI,KAAK,GACD,OAAO,gBAAgB,QAAQ,SAAS,QAAQ,SAAS,SAAS,SAAS,eAAe;IAC9F,KAAK,GACD,OAAO,IAAI,WAAW,MAAM;IAChC,KAAK,IACD,OAAO,IAAI,YAAY,MAAM;IACjC,KAAK,IACD,OAAO,IAAI,YAAY,MAAM;GACrC;GACA;EACJ,KAAK,aAAa;GACd,QAAQ,eAAR;IACI,KAAK,GACD,OAAO,IAAI,UAAU,MAAM;IAC/B,KAAK,IACD,OAAO,IAAI,WAAW,MAAM;IAChC,KAAK,IACD,OAAO,IAAI,WAAW,MAAM;GACpC;GACA;EACJ,KAAK,aAAa;GACd,QAAQ,eAAR;IACI,KAAK,IACD,OAAO,IAAI,aAAa,MAAM;IAClC,KAAK,IACD,OAAO,IAAI,aAAa,MAAM;GACtC;GACA;CACR;CACA,MAAM,IAAI,MAAM,iDAAiD,aAAa,kBAAkB,eAAe;AACnH"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { _ as colormaps_default, a as debounce, c as throttle, d as percentileFromHistogram, f as readBandNames, g as COLORMAP_ROW_COUNT, h as COLORMAP_OPTIONS, i as classNames, l as MAX_SAMPLE_TILES, m as COLORMAP_NAMES, n as PALETTE_COLORMAP, o as formatNumericValue, p as loadGeoTIFF, r as clamp, s as generateId, t as RasterControl, u as computeAutoStats } from "./RasterControl-B7XdXYSu.js";
|
|
2
|
+
import { a as Photometric, d as TiffTag, i as Compression, l as SampleFormat, o as PlanarConfiguration, s as Predictor } from "./decode-BMFOVF9X.js";
|
|
3
|
+
//#region src/lib/raster/metadata.ts
|
|
4
|
+
var SAMPLE_FORMAT_LABELS = {
|
|
5
|
+
[SampleFormat.Uint]: "uint",
|
|
6
|
+
[SampleFormat.Int]: "int",
|
|
7
|
+
[SampleFormat.Float]: "float",
|
|
8
|
+
[SampleFormat.Void]: "void",
|
|
9
|
+
[SampleFormat.ComplexInt]: "cint",
|
|
10
|
+
[SampleFormat.ComplexFloat]: "cfloat"
|
|
11
|
+
};
|
|
12
|
+
var PHOTOMETRIC_LABELS = {
|
|
13
|
+
[Photometric.MinIsWhite]: "min-is-white",
|
|
14
|
+
[Photometric.MinIsBlack]: "min-is-black",
|
|
15
|
+
[Photometric.Rgb]: "RGB",
|
|
16
|
+
[Photometric.Palette]: "palette",
|
|
17
|
+
[Photometric.Mask]: "mask",
|
|
18
|
+
[Photometric.Separated]: "separated",
|
|
19
|
+
[Photometric.Ycbcr]: "YCbCr",
|
|
20
|
+
[Photometric.Cielab]: "CIE L*a*b*",
|
|
21
|
+
[Photometric.Icclab]: "ICC L*a*b*",
|
|
22
|
+
[Photometric.Itulab]: "ITU L*a*b*",
|
|
23
|
+
[Photometric.Cfa]: "CFA",
|
|
24
|
+
[Photometric.Logl]: "LogL",
|
|
25
|
+
[Photometric.Logluv]: "LogLuv"
|
|
26
|
+
};
|
|
27
|
+
var COMPRESSION_LABELS = {
|
|
28
|
+
[Compression.None]: "none",
|
|
29
|
+
[Compression.Ccittrle]: "CCITT RLE",
|
|
30
|
+
[Compression.CcittT4]: "CCITT T.4",
|
|
31
|
+
[Compression.CcittT6]: "CCITT T.6",
|
|
32
|
+
[Compression.Lzw]: "LZW",
|
|
33
|
+
[Compression.Jpeg6]: "old-JPEG",
|
|
34
|
+
[Compression.Jpeg]: "JPEG",
|
|
35
|
+
[Compression.DeflateOther]: "Deflate (Adobe)",
|
|
36
|
+
[Compression.PackBits]: "PackBits",
|
|
37
|
+
[Compression.Deflate]: "Deflate",
|
|
38
|
+
[Compression.Lerc]: "LERC",
|
|
39
|
+
[Compression.Lzma]: "LZMA",
|
|
40
|
+
[Compression.Zstd]: "ZSTD",
|
|
41
|
+
[Compression.Webp]: "WebP",
|
|
42
|
+
[Compression.JpegXl]: "JPEG XL",
|
|
43
|
+
[Compression.JpegXlDng17]: "JPEG XL (DNG 1.7)",
|
|
44
|
+
[Compression.Jp2000]: "JPEG 2000"
|
|
45
|
+
};
|
|
46
|
+
var PREDICTOR_LABELS = {
|
|
47
|
+
[Predictor.None]: "none",
|
|
48
|
+
[Predictor.Horizontal]: "horizontal",
|
|
49
|
+
[Predictor.FloatingPoint]: "floating-point"
|
|
50
|
+
};
|
|
51
|
+
var PLANAR_LABELS = {
|
|
52
|
+
[PlanarConfiguration.Contig]: "chunky (interleaved)",
|
|
53
|
+
[PlanarConfiguration.Separate]: "planar"
|
|
54
|
+
};
|
|
55
|
+
function labelOr(map, code) {
|
|
56
|
+
if (code === null || code === void 0) return "unknown";
|
|
57
|
+
return map[code] ?? `unknown (${code})`;
|
|
58
|
+
}
|
|
59
|
+
/** "uint8" / "float32" / etc. Falls back to e.g. "uint?" when bit-depth is
|
|
60
|
+
* unknown. */
|
|
61
|
+
function dtypeLabel(format, bits) {
|
|
62
|
+
const base = labelOr(SAMPLE_FORMAT_LABELS, format ?? null);
|
|
63
|
+
if (!bits) return `${base}?`;
|
|
64
|
+
return `${base}${bits}`;
|
|
65
|
+
}
|
|
66
|
+
function compressionLabel(code) {
|
|
67
|
+
return labelOr(COMPRESSION_LABELS, code ?? null);
|
|
68
|
+
}
|
|
69
|
+
function photometricLabel(code) {
|
|
70
|
+
return labelOr(PHOTOMETRIC_LABELS, code ?? null);
|
|
71
|
+
}
|
|
72
|
+
function predictorLabel(code) {
|
|
73
|
+
if (code === null || code === void 0 || code === Predictor.None) return null;
|
|
74
|
+
return labelOr(PREDICTOR_LABELS, code);
|
|
75
|
+
}
|
|
76
|
+
function planarConfigLabel(code) {
|
|
77
|
+
return labelOr(PLANAR_LABELS, code ?? null);
|
|
78
|
+
}
|
|
79
|
+
/** Parse every `<Item>` under `<GDALMetadata>`. Returns `[]` on missing,
|
|
80
|
+
* empty, or unparsable input. The `sample` attribute is normalized to a
|
|
81
|
+
* 1-based number to match GDAL's external convention; absent → null. */
|
|
82
|
+
function parseGdalItems(raw) {
|
|
83
|
+
if (typeof raw !== "string" || raw.length === 0) return [];
|
|
84
|
+
let doc;
|
|
85
|
+
try {
|
|
86
|
+
doc = new DOMParser().parseFromString(raw, "text/xml");
|
|
87
|
+
} catch {
|
|
88
|
+
return [];
|
|
89
|
+
}
|
|
90
|
+
if (doc.getElementsByTagName("parsererror").length > 0) return [];
|
|
91
|
+
const out = [];
|
|
92
|
+
for (const item of Array.from(doc.querySelectorAll("Item"))) {
|
|
93
|
+
const name = item.getAttribute("name");
|
|
94
|
+
if (!name) continue;
|
|
95
|
+
const sampleAttr = item.getAttribute("sample");
|
|
96
|
+
let sample = null;
|
|
97
|
+
if (sampleAttr !== null) {
|
|
98
|
+
const n = parseInt(sampleAttr, 10);
|
|
99
|
+
sample = Number.isFinite(n) && n >= 0 ? n + 1 : null;
|
|
100
|
+
}
|
|
101
|
+
out.push({
|
|
102
|
+
name,
|
|
103
|
+
value: item.textContent?.trim() ?? "",
|
|
104
|
+
sample,
|
|
105
|
+
role: item.getAttribute("role")
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
return out;
|
|
109
|
+
}
|
|
110
|
+
var BAND_RESERVED_NAMES = new Set([
|
|
111
|
+
"DESCRIPTION",
|
|
112
|
+
"BAND_NAME",
|
|
113
|
+
"STATISTICS_MINIMUM",
|
|
114
|
+
"STATISTICS_MAXIMUM",
|
|
115
|
+
"STATISTICS_MEAN",
|
|
116
|
+
"STATISTICS_STDDEV",
|
|
117
|
+
"STATISTICS_VALID_PERCENT"
|
|
118
|
+
]);
|
|
119
|
+
/** Drop the items that are already surfaced under Bands so they don't
|
|
120
|
+
* duplicate in the "GDAL items" list. */
|
|
121
|
+
function filterUserGdalItems(items) {
|
|
122
|
+
return items.filter((it) => !(it.sample !== null && BAND_RESERVED_NAMES.has(it.name)));
|
|
123
|
+
}
|
|
124
|
+
/** Resolve the EPSG code (or null) and a display label from a `crs` value. */
|
|
125
|
+
function crsLabel(crs) {
|
|
126
|
+
if (typeof crs === "number") return {
|
|
127
|
+
code: crs,
|
|
128
|
+
label: `EPSG:${crs}`
|
|
129
|
+
};
|
|
130
|
+
if (crs && typeof crs === "object" && "name" in crs && typeof crs.name === "string") return {
|
|
131
|
+
code: null,
|
|
132
|
+
label: `User-defined: ${crs.name}`
|
|
133
|
+
};
|
|
134
|
+
return {
|
|
135
|
+
code: null,
|
|
136
|
+
label: "unknown"
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
/** Pure derivation from an already-loaded GeoTIFF: no fetches, no I/O. */
|
|
140
|
+
function summarizeGeoTIFF(tiff) {
|
|
141
|
+
const cached = tiff.cachedTags;
|
|
142
|
+
const sampleFormat = cached.sampleFormat?.[0] ?? null;
|
|
143
|
+
const bits = cached.bitsPerSample?.[0] ?? null;
|
|
144
|
+
const rawXml = tiff.image.value(TiffTag.GdalMetadata) ?? null;
|
|
145
|
+
const items = parseGdalItems(rawXml);
|
|
146
|
+
const itemsBySample = /* @__PURE__ */ new Map();
|
|
147
|
+
for (const it of items) {
|
|
148
|
+
if (it.sample === null) continue;
|
|
149
|
+
const arr = itemsBySample.get(it.sample) ?? [];
|
|
150
|
+
arr.push(it);
|
|
151
|
+
itemsBySample.set(it.sample, arr);
|
|
152
|
+
}
|
|
153
|
+
const bands = [];
|
|
154
|
+
for (let i = 1; i <= tiff.count; i++) {
|
|
155
|
+
const own = itemsBySample.get(i) ?? [];
|
|
156
|
+
const find = (n) => own.find((it) => it.name === n)?.value ?? null;
|
|
157
|
+
const num = (s) => {
|
|
158
|
+
if (s === null) return null;
|
|
159
|
+
const n = Number(s);
|
|
160
|
+
return Number.isFinite(n) ? n : null;
|
|
161
|
+
};
|
|
162
|
+
const name = find("DESCRIPTION") ?? find("BAND_NAME");
|
|
163
|
+
const stats = own.some((it) => BAND_RESERVED_NAMES.has(it.name) && it.name.startsWith("STATISTICS_")) ? {
|
|
164
|
+
min: num(find("STATISTICS_MINIMUM")),
|
|
165
|
+
max: num(find("STATISTICS_MAXIMUM")),
|
|
166
|
+
mean: num(find("STATISTICS_MEAN")),
|
|
167
|
+
std: num(find("STATISTICS_STDDEV")),
|
|
168
|
+
validPercent: num(find("STATISTICS_VALID_PERCENT"))
|
|
169
|
+
} : null;
|
|
170
|
+
bands.push({
|
|
171
|
+
index: i,
|
|
172
|
+
name,
|
|
173
|
+
scale: tiff.scales[i - 1] ?? 1,
|
|
174
|
+
offset: tiff.offsets[i - 1] ?? 0,
|
|
175
|
+
nodata: tiff.nodata,
|
|
176
|
+
stats
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
const { code, label } = crsLabel(tiff.crs);
|
|
180
|
+
const gkd = tiff.gkd;
|
|
181
|
+
const citation = gkd.citation || gkd.projectedCitation || gkd.geodeticCitation || null;
|
|
182
|
+
const pixelScale = cached.modelPixelScale !== null && cached.modelPixelScale !== void 0 ? [cached.modelPixelScale[0], cached.modelPixelScale[1]] : null;
|
|
183
|
+
const overviews = tiff.overviews.map((ov) => ({
|
|
184
|
+
width: ov.width,
|
|
185
|
+
height: ov.height,
|
|
186
|
+
tileWidth: ov.tileWidth,
|
|
187
|
+
tileHeight: ov.tileHeight,
|
|
188
|
+
tileCount: {
|
|
189
|
+
x: ov.tileCount.x,
|
|
190
|
+
y: ov.tileCount.y
|
|
191
|
+
}
|
|
192
|
+
}));
|
|
193
|
+
return {
|
|
194
|
+
image: {
|
|
195
|
+
width: tiff.width,
|
|
196
|
+
height: tiff.height,
|
|
197
|
+
bandCount: tiff.count,
|
|
198
|
+
dtype: dtypeLabel(sampleFormat, bits),
|
|
199
|
+
photometric: photometricLabel(cached.photometric),
|
|
200
|
+
compression: compressionLabel(cached.compression),
|
|
201
|
+
predictor: predictorLabel(cached.predictor),
|
|
202
|
+
planarConfig: planarConfigLabel(cached.planarConfiguration),
|
|
203
|
+
tileWidth: tiff.tileWidth,
|
|
204
|
+
tileHeight: tiff.tileHeight,
|
|
205
|
+
nodata: tiff.nodata
|
|
206
|
+
},
|
|
207
|
+
crs: {
|
|
208
|
+
code,
|
|
209
|
+
label,
|
|
210
|
+
citation,
|
|
211
|
+
bbox: tiff.bbox,
|
|
212
|
+
pixelScale
|
|
213
|
+
},
|
|
214
|
+
overviews,
|
|
215
|
+
bands,
|
|
216
|
+
gdalItems: filterUserGdalItems(items),
|
|
217
|
+
rawGdalXml: rawXml
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
//#endregion
|
|
221
|
+
export { COLORMAP_NAMES, COLORMAP_OPTIONS, COLORMAP_ROW_COUNT, MAX_SAMPLE_TILES, PALETTE_COLORMAP, RasterControl, clamp, classNames, colormaps_default as colormapsPngUrl, computeAutoStats, debounce, formatNumericValue, generateId, loadGeoTIFF, percentileFromHistogram, readBandNames, summarizeGeoTIFF, throttle };
|
|
222
|
+
|
|
223
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/lib/raster/metadata.ts"],"sourcesContent":["import {\n Compression,\n Photometric,\n PlanarConfiguration,\n Predictor,\n SampleFormat,\n TiffTag,\n} from '@cogeotiff/core';\nimport type { GeoTIFF, Overview } from '@developmentseed/geotiff';\n\n/** A single `<Item>` from `<GDALMetadata>`. `sample` is 1-based when present\n * (GDAL writes 0-based; we normalize). `role` is the optional `role` attribute\n * (e.g. `\"description\"`). */\nexport type GdalItem = {\n name: string;\n value: string;\n sample: number | null;\n role: string | null;\n};\n\nexport type BandSummary = {\n /** 1-based band index. */\n index: number;\n /** Human label from `<Item name=\"DESCRIPTION\" sample=\"N-1\">…</Item>` or\n * the `BAND_NAME` alias. */\n name: string | null;\n /** GDAL scale; defaults to 1. */\n scale: number;\n /** GDAL offset; defaults to 0. */\n offset: number;\n /** Per-band nodata (currently always the dataset-level value — TIFF\n * doesn't carry per-band nodata in the common path). */\n nodata: number | null;\n /** Author-supplied min/max/mean/std/validPercent from `STATISTICS_*` items. */\n stats: {\n min: number | null;\n max: number | null;\n mean: number | null;\n std: number | null;\n validPercent: number | null;\n } | null;\n};\n\nexport type ImageSummary = {\n width: number;\n height: number;\n bandCount: number;\n dtype: string;\n photometric: string;\n compression: string;\n predictor: string | null;\n planarConfig: string;\n tileWidth: number;\n tileHeight: number;\n nodata: number | null;\n};\n\nexport type CrsSummary = {\n /** EPSG code when the COG declares one; null for user-defined CRSes. */\n code: number | null;\n /** Display label: `\"EPSG:3857\"` or `\"User-defined: <name>\"`. */\n label: string;\n /** `GTCitationGeoKey` or projected / geodetic citation, when present. */\n citation: string | null;\n /** Geographic-or-projected bbox `[minX, minY, maxX, maxY]` in the CRS. */\n bbox: [number, number, number, number];\n /** `ModelPixelScale` `[scaleX, scaleY]` when present. */\n pixelScale: [number, number] | null;\n};\n\nexport type OverviewSummary = {\n width: number;\n height: number;\n tileWidth: number;\n tileHeight: number;\n tileCount: { x: number; y: number };\n};\n\nexport type MetadataSummary = {\n image: ImageSummary;\n crs: CrsSummary;\n overviews: OverviewSummary[];\n bands: BandSummary[];\n /** GDAL `<Item>` entries that aren't already shown under Bands\n * (i.e. excludes `STATISTICS_*`, `DESCRIPTION`, `BAND_NAME`).\n * Dataset-level items first, then per-band, in document order. */\n gdalItems: GdalItem[];\n rawGdalXml: string | null;\n};\n\nconst SAMPLE_FORMAT_LABELS: Record<number, string> = {\n [SampleFormat.Uint]: 'uint',\n [SampleFormat.Int]: 'int',\n [SampleFormat.Float]: 'float',\n [SampleFormat.Void]: 'void',\n [SampleFormat.ComplexInt]: 'cint',\n [SampleFormat.ComplexFloat]: 'cfloat',\n};\n\nconst PHOTOMETRIC_LABELS: Record<number, string> = {\n [Photometric.MinIsWhite]: 'min-is-white',\n [Photometric.MinIsBlack]: 'min-is-black',\n [Photometric.Rgb]: 'RGB',\n [Photometric.Palette]: 'palette',\n [Photometric.Mask]: 'mask',\n [Photometric.Separated]: 'separated',\n [Photometric.Ycbcr]: 'YCbCr',\n [Photometric.Cielab]: 'CIE L*a*b*',\n [Photometric.Icclab]: 'ICC L*a*b*',\n [Photometric.Itulab]: 'ITU L*a*b*',\n [Photometric.Cfa]: 'CFA',\n [Photometric.Logl]: 'LogL',\n [Photometric.Logluv]: 'LogLuv',\n};\n\nconst COMPRESSION_LABELS: Record<number, string> = {\n [Compression.None]: 'none',\n [Compression.Ccittrle]: 'CCITT RLE',\n [Compression.CcittT4]: 'CCITT T.4',\n [Compression.CcittT6]: 'CCITT T.6',\n [Compression.Lzw]: 'LZW',\n [Compression.Jpeg6]: 'old-JPEG',\n [Compression.Jpeg]: 'JPEG',\n [Compression.DeflateOther]: 'Deflate (Adobe)',\n [Compression.PackBits]: 'PackBits',\n [Compression.Deflate]: 'Deflate',\n [Compression.Lerc]: 'LERC',\n [Compression.Lzma]: 'LZMA',\n [Compression.Zstd]: 'ZSTD',\n [Compression.Webp]: 'WebP',\n [Compression.JpegXl]: 'JPEG XL',\n [Compression.JpegXlDng17]: 'JPEG XL (DNG 1.7)',\n [Compression.Jp2000]: 'JPEG 2000',\n};\n\nconst PREDICTOR_LABELS: Record<number, string> = {\n [Predictor.None]: 'none',\n [Predictor.Horizontal]: 'horizontal',\n [Predictor.FloatingPoint]: 'floating-point',\n};\n\nconst PLANAR_LABELS: Record<number, string> = {\n [PlanarConfiguration.Contig]: 'chunky (interleaved)',\n [PlanarConfiguration.Separate]: 'planar',\n};\n\nfunction labelOr(map: Record<number, string>, code: number | null | undefined): string {\n if (code === null || code === undefined) return 'unknown';\n return map[code] ?? `unknown (${code})`;\n}\n\n/** \"uint8\" / \"float32\" / etc. Falls back to e.g. \"uint?\" when bit-depth is\n * unknown. */\nexport function dtypeLabel(format: number | null | undefined, bits: number | null | undefined): string {\n const base = labelOr(SAMPLE_FORMAT_LABELS, format ?? null);\n if (!bits) return `${base}?`;\n return `${base}${bits}`;\n}\n\nexport function compressionLabel(code: number | null | undefined): string {\n return labelOr(COMPRESSION_LABELS, code ?? null);\n}\n\nexport function photometricLabel(code: number | null | undefined): string {\n return labelOr(PHOTOMETRIC_LABELS, code ?? null);\n}\n\nexport function predictorLabel(code: number | null | undefined): string | null {\n if (code === null || code === undefined || code === Predictor.None) return null;\n return labelOr(PREDICTOR_LABELS, code);\n}\n\nexport function planarConfigLabel(code: number | null | undefined): string {\n return labelOr(PLANAR_LABELS, code ?? null);\n}\n\n/** Parse every `<Item>` under `<GDALMetadata>`. Returns `[]` on missing,\n * empty, or unparsable input. The `sample` attribute is normalized to a\n * 1-based number to match GDAL's external convention; absent → null. */\nexport function parseGdalItems(raw: string | null | undefined): GdalItem[] {\n if (typeof raw !== 'string' || raw.length === 0) return [];\n let doc: Document;\n try {\n doc = new DOMParser().parseFromString(raw, 'text/xml');\n } catch {\n return [];\n }\n // DOMParser returns a document with a <parsererror> element on failure\n // rather than throwing — check for that explicitly.\n if (doc.getElementsByTagName('parsererror').length > 0) return [];\n\n const out: GdalItem[] = [];\n for (const item of Array.from(doc.querySelectorAll('Item'))) {\n const name = item.getAttribute('name');\n if (!name) continue;\n const sampleAttr = item.getAttribute('sample');\n let sample: number | null = null;\n if (sampleAttr !== null) {\n const n = parseInt(sampleAttr, 10);\n sample = Number.isFinite(n) && n >= 0 ? n + 1 : null;\n }\n out.push({\n name,\n value: item.textContent?.trim() ?? '',\n sample,\n role: item.getAttribute('role'),\n });\n }\n return out;\n}\n\nconst BAND_RESERVED_NAMES = new Set([\n 'DESCRIPTION',\n 'BAND_NAME',\n 'STATISTICS_MINIMUM',\n 'STATISTICS_MAXIMUM',\n 'STATISTICS_MEAN',\n 'STATISTICS_STDDEV',\n 'STATISTICS_VALID_PERCENT',\n]);\n\n/** Drop the items that are already surfaced under Bands so they don't\n * duplicate in the \"GDAL items\" list. */\nexport function filterUserGdalItems(items: GdalItem[]): GdalItem[] {\n return items.filter(\n (it) => !(it.sample !== null && BAND_RESERVED_NAMES.has(it.name)),\n );\n}\n\n/** Pretty-print a GDAL_METADATA XML string with 2-space indentation. Returns\n * the input verbatim when parsing fails so the user can still see the raw\n * bytes. */\nexport function prettyPrintGdalXml(raw: string): string {\n let doc: Document;\n try {\n doc = new DOMParser().parseFromString(raw, 'text/xml');\n } catch {\n return raw;\n }\n if (doc.getElementsByTagName('parsererror').length > 0) return raw;\n const root = doc.documentElement;\n if (!root) return raw;\n const lines: string[] = [];\n serialize(root, 0, lines);\n return lines.join('\\n');\n}\n\nfunction serialize(node: Element, depth: number, out: string[]): void {\n const indent = ' '.repeat(depth);\n const attrs = Array.from(node.attributes)\n .map((a) => ` ${a.name}=\"${escapeAttr(a.value)}\"`)\n .join('');\n const children = Array.from(node.childNodes);\n const elementChildren = children.filter(\n (c): c is Element => c.nodeType === 1,\n );\n const text = children\n .filter((c) => c.nodeType === 3)\n .map((c) => c.textContent ?? '')\n .join('')\n .trim();\n\n if (elementChildren.length === 0) {\n if (text.length === 0) {\n out.push(`${indent}<${node.nodeName}${attrs}/>`);\n } else {\n out.push(`${indent}<${node.nodeName}${attrs}>${escapeText(text)}</${node.nodeName}>`);\n }\n return;\n }\n out.push(`${indent}<${node.nodeName}${attrs}>`);\n for (const child of elementChildren) serialize(child, depth + 1, out);\n out.push(`${indent}</${node.nodeName}>`);\n}\n\nfunction escapeAttr(s: string): string {\n return s.replace(/&/g, '&').replace(/\"/g, '"').replace(/</g, '<');\n}\nfunction escapeText(s: string): string {\n return s.replace(/&/g, '&').replace(/</g, '<');\n}\n\n/** Resolve the EPSG code (or null) and a display label from a `crs` value. */\nexport function crsLabel(crs: number | { name?: string } | null | undefined): {\n code: number | null;\n label: string;\n} {\n if (typeof crs === 'number') {\n return { code: crs, label: `EPSG:${crs}` };\n }\n if (crs && typeof crs === 'object' && 'name' in crs && typeof crs.name === 'string') {\n return { code: null, label: `User-defined: ${crs.name}` };\n }\n return { code: null, label: 'unknown' };\n}\n\n/** Structural subset of `GeoTIFF` we read from. Lets tests construct stubs\n * without instantiating the whole class. The real `GeoTIFF` satisfies this. */\ntype MetadataInput = Pick<\n GeoTIFF,\n | 'image'\n | 'width'\n | 'height'\n | 'count'\n | 'tileWidth'\n | 'tileHeight'\n | 'nodata'\n | 'crs'\n | 'bbox'\n | 'cachedTags'\n | 'gkd'\n | 'offsets'\n | 'scales'\n | 'storedStats'\n | 'overviews'\n>;\n\n/** Pure derivation from an already-loaded GeoTIFF: no fetches, no I/O. */\nexport function summarizeGeoTIFF(tiff: MetadataInput): MetadataSummary {\n const cached = tiff.cachedTags;\n const sampleFormat = cached.sampleFormat?.[0] ?? null;\n const bits = cached.bitsPerSample?.[0] ?? null;\n\n const rawXml =\n (tiff.image.value(TiffTag.GdalMetadata) as string | undefined) ?? null;\n const items = parseGdalItems(rawXml);\n const itemsBySample = new Map<number, GdalItem[]>();\n for (const it of items) {\n if (it.sample === null) continue;\n const arr = itemsBySample.get(it.sample) ?? [];\n arr.push(it);\n itemsBySample.set(it.sample, arr);\n }\n\n const bands: BandSummary[] = [];\n for (let i = 1; i <= tiff.count; i++) {\n const own = itemsBySample.get(i) ?? [];\n const find = (n: string): string | null =>\n own.find((it) => it.name === n)?.value ?? null;\n const num = (s: string | null): number | null => {\n if (s === null) return null;\n const n = Number(s);\n return Number.isFinite(n) ? n : null;\n };\n const name = find('DESCRIPTION') ?? find('BAND_NAME');\n const stats = own.some((it) => BAND_RESERVED_NAMES.has(it.name) && it.name.startsWith('STATISTICS_'))\n ? {\n min: num(find('STATISTICS_MINIMUM')),\n max: num(find('STATISTICS_MAXIMUM')),\n mean: num(find('STATISTICS_MEAN')),\n std: num(find('STATISTICS_STDDEV')),\n validPercent: num(find('STATISTICS_VALID_PERCENT')),\n }\n : null;\n bands.push({\n index: i,\n name,\n scale: tiff.scales[i - 1] ?? 1,\n offset: tiff.offsets[i - 1] ?? 0,\n nodata: tiff.nodata,\n stats,\n });\n }\n\n const { code, label } = crsLabel(tiff.crs as never);\n const gkd = tiff.gkd;\n const citation =\n gkd.citation || gkd.projectedCitation || gkd.geodeticCitation || null;\n const pixelScale =\n cached.modelPixelScale !== null && cached.modelPixelScale !== undefined\n ? ([\n cached.modelPixelScale[0],\n cached.modelPixelScale[1],\n ] as [number, number])\n : null;\n\n const overviews: OverviewSummary[] = tiff.overviews.map((ov: Overview) => ({\n width: ov.width,\n height: ov.height,\n tileWidth: ov.tileWidth,\n tileHeight: ov.tileHeight,\n tileCount: { x: ov.tileCount.x, y: ov.tileCount.y },\n }));\n\n return {\n image: {\n width: tiff.width,\n height: tiff.height,\n bandCount: tiff.count,\n dtype: dtypeLabel(sampleFormat, bits),\n photometric: photometricLabel(cached.photometric),\n compression: compressionLabel(cached.compression),\n predictor: predictorLabel(cached.predictor),\n planarConfig: planarConfigLabel(cached.planarConfiguration),\n tileWidth: tiff.tileWidth,\n tileHeight: tiff.tileHeight,\n nodata: tiff.nodata,\n },\n crs: {\n code,\n label,\n citation,\n bbox: tiff.bbox,\n pixelScale,\n },\n overviews,\n bands,\n gdalItems: filterUserGdalItems(items),\n rawGdalXml: rawXml,\n };\n}\n"],"mappings":";;;AA0FA,IAAM,uBAA+C;EAClD,aAAa,OAAO;EACpB,aAAa,MAAM;EACnB,aAAa,QAAQ;EACrB,aAAa,OAAO;EACpB,aAAa,aAAa;EAC1B,aAAa,eAAe;AAC/B;AAEA,IAAM,qBAA6C;EAChD,YAAY,aAAa;EACzB,YAAY,aAAa;EACzB,YAAY,MAAM;EAClB,YAAY,UAAU;EACtB,YAAY,OAAO;EACnB,YAAY,YAAY;EACxB,YAAY,QAAQ;EACpB,YAAY,SAAS;EACrB,YAAY,SAAS;EACrB,YAAY,SAAS;EACrB,YAAY,MAAM;EAClB,YAAY,OAAO;EACnB,YAAY,SAAS;AACxB;AAEA,IAAM,qBAA6C;EAChD,YAAY,OAAO;EACnB,YAAY,WAAW;EACvB,YAAY,UAAU;EACtB,YAAY,UAAU;EACtB,YAAY,MAAM;EAClB,YAAY,QAAQ;EACpB,YAAY,OAAO;E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AAgB,EACzB,IACA;CAEN,MAAM,YAA+B,KAAK,UAAU,KAAK,QAAkB;EACzE,OAAO,GAAG;EACV,QAAQ,GAAG;EACX,WAAW,GAAG;EACd,YAAY,GAAG;EACf,WAAW;GAAE,GAAG,GAAG,UAAU;GAAG,GAAG,GAAG,UAAU;EAAE;CACpD,EAAE;CAEF,OAAO;EACL,OAAO;GACL,OAAO,KAAK;GACZ,QAAQ,KAAK;GACb,WAAW,KAAK;GAChB,OAAO,WAAW,cAAc,IAAI;GACpC,aAAa,iBAAiB,OAAO,WAAW;GAChD,aAAa,iBAAiB,OAAO,WAAW;GAChD,WAAW,eAAe,OAAO,SAAS;GAC1C,cAAc,kBAAkB,OAAO,mBAAmB;GAC1D,WAAW,KAAK;GAChB,YAAY,KAAK;GACjB,QAAQ,KAAK;EACf;EACA,KAAK;GACH;GACA;GACA;GACA,MAAM,KAAK;GACX;EACF;EACA;EACA;EACA,WAAW,oBAAoB,KAAK;EACpC,YAAY;CACd;AACF"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { i as Compression, t as DECODER_REGISTRY } from "./decode-BMFOVF9X.js";
|
|
2
|
+
//#region node_modules/@developmentseed/geotiff/dist/codecs/lerc.js
|
|
3
|
+
/** Inner compression type encoded in LercParameters[1]. */
|
|
4
|
+
var LercCompression;
|
|
5
|
+
(function(LercCompression) {
|
|
6
|
+
LercCompression[LercCompression["None"] = 0] = "None";
|
|
7
|
+
LercCompression[LercCompression["Deflate"] = 1] = "Deflate";
|
|
8
|
+
LercCompression[LercCompression["Zstd"] = 2] = "Zstd";
|
|
9
|
+
})(LercCompression || (LercCompression = {}));
|
|
10
|
+
var wasmInitialized = false;
|
|
11
|
+
async function getLerc() {
|
|
12
|
+
const lerc = await import("./LercDecode.es-CZm5toNk.js");
|
|
13
|
+
if (!wasmInitialized) {
|
|
14
|
+
await lerc.load();
|
|
15
|
+
wasmInitialized = true;
|
|
16
|
+
}
|
|
17
|
+
return lerc;
|
|
18
|
+
}
|
|
19
|
+
async function decode(bytes, metadata) {
|
|
20
|
+
const lercCompressionType = metadata.lercParameters?.[1] ?? LercCompression.None;
|
|
21
|
+
let lercInput = bytes;
|
|
22
|
+
if (lercCompressionType === LercCompression.Deflate || lercCompressionType === LercCompression.Zstd) {
|
|
23
|
+
const innerCompression = lercCompressionType === LercCompression.Deflate ? Compression.Deflate : Compression.Zstd;
|
|
24
|
+
lercInput = await (await DECODER_REGISTRY.get(innerCompression)())(bytes, metadata);
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
layout: "band-separate",
|
|
28
|
+
bands: (await getLerc()).decode(lercInput).pixels
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { decode };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=lerc-B7WY-v3y.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lerc-B7WY-v3y.js","names":[],"sources":["../node_modules/@developmentseed/geotiff/dist/codecs/lerc.js"],"sourcesContent":["import { Compression } from \"@cogeotiff/core\";\nimport { DECODER_REGISTRY } from \"../decode.js\";\n/** Inner compression type encoded in LercParameters[1]. */\nvar LercCompression;\n(function (LercCompression) {\n LercCompression[LercCompression[\"None\"] = 0] = \"None\";\n LercCompression[LercCompression[\"Deflate\"] = 1] = \"Deflate\";\n LercCompression[LercCompression[\"Zstd\"] = 2] = \"Zstd\";\n})(LercCompression || (LercCompression = {}));\nlet wasmInitialized = false;\nasync function getLerc() {\n // This import is cached by the module loader\n const lerc = await import(\"lerc\");\n if (!wasmInitialized) {\n await lerc.load();\n wasmInitialized = true;\n }\n return lerc;\n}\nexport async function decode(bytes, metadata) {\n const lercCompressionType = metadata.lercParameters?.[1] ??\n LercCompression.None;\n let lercInput = bytes;\n if (lercCompressionType === LercCompression.Deflate ||\n lercCompressionType === LercCompression.Zstd) {\n const innerCompression = lercCompressionType === LercCompression.Deflate\n ? Compression.Deflate\n : Compression.Zstd;\n const decoderEntry = DECODER_REGISTRY.get(innerCompression);\n const decoder = await decoderEntry();\n lercInput = (await decoder(bytes, metadata));\n }\n const lerc = await getLerc();\n const result = lerc.decode(lercInput);\n return { layout: \"band-separate\", bands: result.pixels };\n}\n//# sourceMappingURL=lerc.js.map"],"x_google_ignoreList":[0],"mappings":";;;AAGA,IAAI;CACH,SAAU,iBAAiB;CACxB,gBAAgB,gBAAgB,UAAU,KAAK;CAC/C,gBAAgB,gBAAgB,aAAa,KAAK;CAClD,gBAAgB,gBAAgB,UAAU,KAAK;AACnD,GAAG,oBAAoB,kBAAkB,CAAC,EAAE;AAC5C,IAAI,kBAAkB;AACtB,eAAe,UAAU;CAErB,MAAM,OAAO,MAAM,OAAO;CAC1B,IAAI,CAAC,iBAAiB;EAClB,MAAM,KAAK,KAAK;EAChB,kBAAkB;CACtB;CACA,OAAO;AACX;AACA,eAAsB,OAAO,OAAO,UAAU;CAC1C,MAAM,sBAAsB,SAAS,iBAAiB,MAClD,gBAAgB;CACpB,IAAI,YAAY;CAChB,IAAI,wBAAwB,gBAAgB,WACxC,wBAAwB,gBAAgB,MAAM;EAC9C,MAAM,mBAAmB,wBAAwB,gBAAgB,UAC3D,YAAY,UACZ,YAAY;EAGlB,YAAa,OAAM,MAFE,iBAAiB,IAAI,gBACT,EAAE,GACR,OAAO,QAAQ;CAC9C;CAGA,OAAO;EAAE,QAAQ;EAAiB,QADnB,MADI,QAAQ,GACP,OAAO,SACmB,EAAE;CAAO;AAC3D"}
|