/* global global */ /* global proj4 */ import "regenerator-runtime/runtime.js"; import * as L from "leaflet"; import { rawToRgb } from "pixel-utils"; import densePolygon from "bbox-fns/dense-polygon.js"; import isUTM from "utm-utils/src/isUTM.js"; import getProjString from "utm-utils/src/getProjString.js"; import type { Coords, DoneCallback, LatLngBounds, LatLngTuple } from "leaflet"; import proj4collect from "proj4-collect"; import reprojectGeoJSON from "reproject-geojson"; import bboxMerge from "bbox-fns/merge.js"; import bboxPolygon from "bbox-fns/polygon.js"; import fastMin from "fast-min"; import fastMax from "fast-max"; import { GeoExtent } from "geo-extent"; import geowarp_core from "geowarp"; import geowarp_canvas from "geowarp-canvas"; import snap from "snap-bbox"; import { GeoRasterStack } from "georaster-stack/web"; import type { CustomCRS, CustomCSSStyleDeclaration, GeoRasterLayerOptions, GeoRaster, GeoRasterKeys, DrawTileOptions, Mask, MaskStrategy, PixelValuesToColorFn, Tile } from "./types"; declare global {} const EPSG4326 = 4326; const ORIGIN: LatLngTuple = [0, 0]; const geowarp = geowarp_canvas(geowarp_core); const isDefaultCRS = (crs: any) => crs === L.CRS.EPSG3857 || crs.code === "EPSG:3857"; // figure out if simple CRS // even if not created with same instance of LeafletJS const isSimpleCRS = (crs: CustomCRS) => crs === L.CRS.Simple || (!crs.code && crs.infinite && crs?.transformation?._a === 1 && crs?.transformation?._b === 0 && crs?.transformation?._c === -1 && crs?.transformation?._d === 0); if (!L) console.warn( "[georaster-layer-for-leaflet] can't find Leaflet. If you are loading via