{"version":3,"sources":["jsdelivr-header.js","/npm/esri-leaflet@3.0.19/src/Support.js","/npm/esri-leaflet@3.0.19/src/Options.js","/npm/esri-leaflet@3.0.19/src/Request.js","/npm/esri-leaflet@3.0.19/node_modules/@terraformer/arcgis/dist/t-arcgis.esm.js","/npm/esri-leaflet@3.0.19/src/Util.js","/npm/esri-leaflet@3.0.19/src/Tasks/Task.js","/npm/esri-leaflet@3.0.19/src/Tasks/Query.js","/npm/esri-leaflet@3.0.19/src/Tasks/Find.js","/npm/esri-leaflet@3.0.19/src/Tasks/Identify.js","/npm/esri-leaflet@3.0.19/src/Tasks/IdentifyFeatures.js","/npm/esri-leaflet@3.0.19/src/Tasks/IdentifyImage.js","/npm/esri-leaflet@3.0.19/src/Services/Service.js","/npm/esri-leaflet@3.0.19/src/Services/MapService.js","/npm/esri-leaflet@3.0.19/src/Services/ImageService.js","/npm/esri-leaflet@3.0.19/src/Services/FeatureLayerService.js","/npm/esri-leaflet@3.0.19/src/Layers/BasemapLayer.js","/npm/esri-leaflet@3.0.19/src/Layers/TiledMapLayer.js","/npm/esri-leaflet@3.0.19/src/Layers/RasterLayer.js","/npm/esri-leaflet@3.0.19/src/Layers/ImageMapLayer.js","/npm/esri-leaflet@3.0.19/src/Layers/DynamicMapLayer.js","/npm/esri-leaflet@3.0.19/src/Layers/FeatureLayer/FeatureGrid.js","/npm/esri-leaflet@3.0.19/node_modules/tiny-binary-search/index.js","/npm/esri-leaflet@3.0.19/src/Layers/FeatureLayer/FeatureManager.js","/npm/esri-leaflet@3.0.19/src/Layers/FeatureLayer/FeatureLayer.js","/npm/esri-leaflet@3.0.19/src/EsriLeaflet.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,8SCNO,MAAM,EACX,OAAO,gBAAkB,oBAAqB,IAAI,OAAO,eAC9C,EACsC,KAAjD,SAAS,gBAAgB,MAAM,cAEpB,EAAU,CACrB,OACA,iBCPW,EAAU,CACrB,uBAAwB,ICE1B,IAAI,E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MAGrB,IACX,EAIE,WAAA,CAAY,GAaV,OAZI,KAAK,UACH,KAAK,SAAS,aAAa,KAE7B,KAAK,SAAS,OAAO,KAAK,MAEtB,KAAK,WACP,KAAK,2BAA2B,MACvB,KAAK,WACd,KAAK,UAAU,KAAK,2BAA4B,OAI/C,IACX,IC3bK,MAAC,GAAU,E,8UTwST,SAAsB,EAAK,GAChC,OAAO,IAAI,GAAa,EAAK,EAC/B,E,kBI3EO,SAAyB,EAAK,GACnC,OAAO,IAAI,GAAgB,EAAK,EAClC,E,eI6NO,SAAsB,GAC3B,OAAO,IAAI,GAAa,EAC1B,E,qDfvbO,SAAkB,GACvB,OAAO,IAAI,EAAS,EACtB,E,wDUuMO,SAAuB,EAAK,GACjC,OAAO,IAAI,GAAc,EAAK,EAChC,E,uFPvDO,SAAiB,GAEtB,OADA,EAAU,EAAa,GAChB,IAAI,GAAQ,EACrB,E,ON7EO,SAAc,GAEnB,OADA,EAAU,EAAa,GAChB,IAAI,EAAK,EAClB,E,gBW4JO,SAAuB,EAAK,GACjC,OAAO,IAAI,GAAc,EAAK,EAChC,E","file":"/npm/esri-leaflet@3.0.19/dist/esri-leaflet-debug.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/esri-leaflet@3.0.19/dist/esri-leaflet-debug.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","export const cors =\n  window.XMLHttpRequest && \"withCredentials\" in new window.XMLHttpRequest();\nexport const pointerEvents =\n  document.documentElement.style.pointerEvents === \"\";\n\nexport const Support = {\n  cors,\n  pointerEvents,\n};\n\nexport default Support;\n","export const options = {\n  attributionWidthOffset: 55,\n};\n\nexport default options;\n","import { Util, DomUtil } from \"leaflet\";\nimport { Support } from \"./Support.js\";\n\nlet callbacks = 0;\n\nfunction serialize(params) {\n  let data = \"\";\n\n  params.f = params.f || \"json\";\n\n  for (const key in params) {\n    if (Object.hasOwn(params, key)) {\n      const param = params[key];\n      const type = Object.prototype.toString.call(param);\n      let value;\n\n      if (data.length) {\n        data += \"&\";\n      }\n\n      if (type === \"[object Array]\") {\n        value =\n          Object.prototype.toString.call(param[0]) === \"[object Object]\"\n            ? JSON.stringify(param)\n            : param.join(\",\");\n      } else if (type === \"[object Object]\") {\n        value = JSON.stringify(param);\n      } else if (type === \"[object Date]\") {\n        value = param.valueOf();\n      } else {\n        value = param;\n      }\n\n      data += `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;\n    }\n  }\n\n  const APOSTROPHE_URL_ENCODE = \"%27\";\n  return data.replaceAll(\"'\", APOSTROPHE_URL_ENCODE);\n}\n\nfunction createRequest(callback, context) {\n  const httpRequest = new window.XMLHttpRequest();\n\n  httpRequest.onerror = function () {\n    httpRequest.onreadystatechange = Util.falseFn;\n\n    callback.call(\n      context,\n      {\n        error: {\n          code: 500,\n          message: \"XMLHttpRequest error\",\n        },\n      },\n      null,\n    );\n  };\n\n  httpRequest.onreadystatechange = function () {\n    let response;\n    let error;\n\n    if (httpRequest.readyState === 4) {\n      try {\n        response = JSON.parse(httpRequest.responseText);\n      } catch (e) {\n        response = null;\n        error = {\n          code: 500,\n          message:\n            \"Could not parse response as JSON. This could also be caused by a CORS or XMLHttpRequest error.\",\n        };\n      }\n\n      if (!error && response.error) {\n        error = response.error;\n        response = null;\n      }\n\n      httpRequest.onerror = Util.falseFn;\n\n      callback.call(context, error, response);\n    }\n  };\n\n  httpRequest.ontimeout = function () {\n    this.onerror();\n  };\n\n  return httpRequest;\n}\n\nfunction xmlHttpPost(url, params, callback, context) {\n  const httpRequest = createRequest(callback, context);\n  httpRequest.open(\"POST\", url);\n\n  if (typeof context !== \"undefined\" && context !== null) {\n    if (typeof context.options !== \"undefined\") {\n      httpRequest.timeout = context.options.timeout;\n    }\n  }\n  httpRequest.setRequestHeader(\n    \"Content-Type\",\n    \"application/x-www-form-urlencoded; charset=UTF-8\",\n  );\n  httpRequest.send(serialize(params));\n\n  return httpRequest;\n}\n\nfunction xmlHttpGet(url, params, callback, context) {\n  const httpRequest = createRequest(callback, context);\n  httpRequest.open(\"GET\", `${url}?${serialize(params)}`, true);\n\n  if (typeof context !== \"undefined\" && context !== null) {\n    if (typeof context.options !== \"undefined\") {\n      httpRequest.timeout = context.options.timeout;\n      if (context.options.withCredentials) {\n        httpRequest.withCredentials = true;\n      }\n    }\n  }\n  httpRequest.send(null);\n\n  return httpRequest;\n}\n\n// AJAX handlers for CORS (modern browsers) or JSONP (older browsers)\nexport function request(url, params, callback, context) {\n  const paramString = serialize(params);\n  const httpRequest = createRequest(callback, context);\n  const requestLength = `${url}?${paramString}`.length;\n\n  // ie10/11 require the request be opened before a timeout is applied\n  if (requestLength <= 2000 && Support.cors) {\n    httpRequest.open(\"GET\", `${url}?${paramString}`);\n  } else if (requestLength > 2000 && Support.cors) {\n    httpRequest.open(\"POST\", url);\n    httpRequest.setRequestHeader(\n      \"Content-Type\",\n      \"application/x-www-form-urlencoded; charset=UTF-8\",\n    );\n  }\n\n  if (typeof context !== \"undefined\" && context !== null) {\n    if (typeof context.options !== \"undefined\") {\n      httpRequest.timeout = context.options.timeout;\n      if (context.options.withCredentials) {\n        httpRequest.withCredentials = true;\n      }\n    }\n  }\n\n  // request is less than 2000 characters and the browser supports CORS, make GET request with XMLHttpRequest\n  if (requestLength <= 2000 && Support.cors) {\n    httpRequest.send(null);\n\n    // request is more than 2000 characters and the browser supports CORS, make POST request with XMLHttpRequest\n  } else if (requestLength > 2000 && Support.cors) {\n    httpRequest.send(paramString);\n\n    // request is less  than 2000 characters and the browser does not support CORS, make a JSONP request\n  } else if (requestLength <= 2000 && !Support.cors) {\n    return jsonp(url, params, callback, context);\n\n    // request is longer then 2000 characters and the browser does not support CORS, log a warning\n  } else {\n    warn(\n      `a request to ${url} was longer then 2000 characters and this browser cannot make a cross-domain post request. Please use a proxy https://developers.arcgis.com/esri-leaflet/api-reference/request/`,\n    );\n    return;\n  }\n\n  return httpRequest;\n}\n\nexport function jsonp(url, params, callback, context) {\n  window._EsriLeafletCallbacks = window._EsriLeafletCallbacks || {};\n  const callbackId = `c${callbacks}`;\n  params.callback = `window._EsriLeafletCallbacks.${callbackId}`;\n\n  window._EsriLeafletCallbacks[callbackId] = function (response) {\n    if (window._EsriLeafletCallbacks[callbackId] !== true) {\n      let error;\n      const responseType = Object.prototype.toString.call(response);\n\n      if (\n        !(\n          responseType === \"[object Object]\" ||\n          responseType === \"[object Array]\"\n        )\n      ) {\n        error = {\n          error: {\n            code: 500,\n            message: \"Expected array or object as JSONP response\",\n          },\n        };\n        response = null;\n      }\n\n      if (!error && response.error) {\n        error = response;\n        response = null;\n      }\n\n      callback.call(context, error, response);\n      window._EsriLeafletCallbacks[callbackId] = true;\n    }\n  };\n\n  const script = DomUtil.create(\"script\", null, document.body);\n  script.type = \"text/javascript\";\n  script.src = `${url}?${serialize(params)}`;\n  script.id = callbackId;\n  script.onerror = function (error) {\n    if (error && window._EsriLeafletCallbacks[callbackId] !== true) {\n      // Can't get true error code: it can be 404, or 401, or 500\n      const err = {\n        error: {\n          code: 500,\n          message: \"An unknown error occurred\",\n        },\n      };\n\n      callback.call(context, err);\n      window._EsriLeafletCallbacks[callbackId] = true;\n    }\n  };\n  DomUtil.addClass(script, \"esri-leaflet-jsonp\");\n\n  callbacks++;\n\n  return {\n    id: callbackId,\n    url: script.src,\n    abort() {\n      window._EsriLeafletCallbacks._callback[callbackId]({\n        code: 0,\n        message: \"Request aborted.\",\n      });\n    },\n  };\n}\n\nconst get = Support.cors ? xmlHttpGet : jsonp;\nget.CORS = xmlHttpGet;\nget.JSONP = jsonp;\n\nexport function warn(...args) {\n  if (console && console.warn) {\n    console.warn.apply(console, args);\n  }\n}\n\n// choose the correct AJAX handler depending on CORS support\nexport { get };\n\n// always use XMLHttpRequest for posts\nexport { xmlHttpPost as post };\n\n// export the Request object to call the different handlers for debugging\nexport const Request = {\n  request,\n  get,\n  post: xmlHttpPost,\n};\n\nexport default Request;\n","/* @preserve\n* @terraformer/arcgis - v2.0.7 - MIT\n* Copyright (c) 2012-2021 Environmental Systems Research Institute, Inc.\n* Thu Jul 22 2021 13:58:30 GMT-0700 (Pacific Daylight Time)\n*/\n/* Copyright (c) 2012-2019 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nvar edgeIntersectsEdge = function edgeIntersectsEdge(a1, a2, b1, b2) {\n  var uaT = (b2[0] - b1[0]) * (a1[1] - b1[1]) - (b2[1] - b1[1]) * (a1[0] - b1[0]);\n  var ubT = (a2[0] - a1[0]) * (a1[1] - b1[1]) - (a2[1] - a1[1]) * (a1[0] - b1[0]);\n  var uB = (b2[1] - b1[1]) * (a2[0] - a1[0]) - (b2[0] - b1[0]) * (a2[1] - a1[1]);\n\n  if (uB !== 0) {\n    var ua = uaT / uB;\n    var ub = ubT / uB;\n\n    if (ua >= 0 && ua <= 1 && ub >= 0 && ub <= 1) {\n      return true;\n    }\n  }\n\n  return false;\n};\nvar coordinatesContainPoint = function coordinatesContainPoint(coordinates, point) {\n  var contains = false;\n\n  for (var i = -1, l = coordinates.length, j = l - 1; ++i < l; j = i) {\n    if ((coordinates[i][1] <= point[1] && point[1] < coordinates[j][1] || coordinates[j][1] <= point[1] && point[1] < coordinates[i][1]) && point[0] < (coordinates[j][0] - coordinates[i][0]) * (point[1] - coordinates[i][1]) / (coordinates[j][1] - coordinates[i][1]) + coordinates[i][0]) {\n      contains = !contains;\n    }\n  }\n\n  return contains;\n};\nvar pointsEqual = function pointsEqual(a, b) {\n  for (var i = 0; i < a.length; i++) {\n    if (a[i] !== b[i]) {\n      return false;\n    }\n  }\n\n  return true;\n};\nvar arrayIntersectsArray = function arrayIntersectsArray(a, b) {\n  for (var i = 0; i < a.length - 1; i++) {\n    for (var j = 0; j < b.length - 1; j++) {\n      if (edgeIntersectsEdge(a[i], a[i + 1], b[j], b[j + 1])) {\n        return true;\n      }\n    }\n  }\n\n  return false;\n};\n\n/* Copyright (c) 2012-2019 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nvar closeRing = function closeRing(coordinates) {\n  if (!pointsEqual(coordinates[0], coordinates[coordinates.length - 1])) {\n    coordinates.push(coordinates[0]);\n  }\n\n  return coordinates;\n}; // determine if polygon ring coordinates are clockwise. clockwise signifies outer ring, counter-clockwise an inner ring\n// or hole. this logic was found at http://stackoverflow.com/questions/1165647/how-to-determine-if-a-list-of-polygon-\n// points-are-in-clockwise-order\n\nvar ringIsClockwise = function ringIsClockwise(ringToTest) {\n  var total = 0;\n  var i = 0;\n  var rLength = ringToTest.length;\n  var pt1 = ringToTest[i];\n  var pt2;\n\n  for (i; i < rLength - 1; i++) {\n    pt2 = ringToTest[i + 1];\n    total += (pt2[0] - pt1[0]) * (pt2[1] + pt1[1]);\n    pt1 = pt2;\n  }\n\n  return total >= 0;\n}; // This function ensures that rings are oriented in the right directions\n// from http://jsperf.com/cloning-an-object/2\n\nvar shallowClone = function shallowClone(obj) {\n  var target = {};\n\n  for (var i in obj) {\n    // both arcgis attributes and geojson props are just hardcoded keys\n    if (obj.hasOwnProperty(i)) {\n      // eslint-disable-line no-prototype-builtins\n      target[i] = obj[i];\n    }\n  }\n\n  return target;\n};\n\n/* Copyright (c) 2012-2019 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nvar coordinatesContainCoordinates = function coordinatesContainCoordinates(outer, inner) {\n  var intersects = arrayIntersectsArray(outer, inner);\n  var contains = coordinatesContainPoint(outer, inner[0]);\n\n  if (!intersects && contains) {\n    return true;\n  }\n\n  return false;\n}; // do any polygons in this array contain any other polygons in this array?\n// used for checking for holes in arcgis rings\n\n\nvar convertRingsToGeoJSON = function convertRingsToGeoJSON(rings) {\n  var outerRings = [];\n  var holes = [];\n  var x; // iterator\n\n  var outerRing; // current outer ring being evaluated\n\n  var hole; // current hole being evaluated\n  // for each ring\n\n  for (var r = 0; r < rings.length; r++) {\n    var ring = closeRing(rings[r].slice(0));\n\n    if (ring.length < 4) {\n      continue;\n    } // is this ring an outer ring? is it clockwise?\n\n\n    if (ringIsClockwise(ring)) {\n      var polygon = [ring.slice().reverse()]; // wind outer rings counterclockwise for RFC 7946 compliance\n\n      outerRings.push(polygon); // push to outer rings\n    } else {\n      holes.push(ring.slice().reverse()); // wind inner rings clockwise for RFC 7946 compliance\n    }\n  }\n\n  var uncontainedHoles = []; // while there are holes left...\n\n  while (holes.length) {\n    // pop a hole off out stack\n    hole = holes.pop(); // loop over all outer rings and see if they contain our hole.\n\n    var contained = false;\n\n    for (x = outerRings.length - 1; x >= 0; x--) {\n      outerRing = outerRings[x][0];\n\n      if (coordinatesContainCoordinates(outerRing, hole)) {\n        // the hole is contained push it into our polygon\n        outerRings[x].push(hole);\n        contained = true;\n        break;\n      }\n    } // ring is not contained in any outer ring\n    // sometimes this happens https://github.com/Esri/esri-leaflet/issues/320\n\n\n    if (!contained) {\n      uncontainedHoles.push(hole);\n    }\n  } // if we couldn't match any holes using contains we can try intersects...\n\n\n  while (uncontainedHoles.length) {\n    // pop a hole off out stack\n    hole = uncontainedHoles.pop(); // loop over all outer rings and see if any intersect our hole.\n\n    var intersects = false;\n\n    for (x = outerRings.length - 1; x >= 0; x--) {\n      outerRing = outerRings[x][0];\n\n      if (arrayIntersectsArray(outerRing, hole)) {\n        // the hole is contained push it into our polygon\n        outerRings[x].push(hole);\n        intersects = true;\n        break;\n      }\n    }\n\n    if (!intersects) {\n      outerRings.push([hole.reverse()]);\n    }\n  }\n\n  if (outerRings.length === 1) {\n    return {\n      type: 'Polygon',\n      coordinates: outerRings[0]\n    };\n  } else {\n    return {\n      type: 'MultiPolygon',\n      coordinates: outerRings\n    };\n  }\n};\n\nvar getId = function getId(attributes, idAttribute) {\n  var keys = idAttribute ? [idAttribute, 'OBJECTID', 'FID'] : ['OBJECTID', 'FID'];\n\n  for (var i = 0; i < keys.length; i++) {\n    var key = keys[i];\n\n    if (key in attributes && (typeof attributes[key] === 'string' || typeof attributes[key] === 'number')) {\n      return attributes[key];\n    }\n  }\n\n  throw Error('No valid id attribute found');\n};\n\nvar arcgisToGeoJSON = function arcgisToGeoJSON(arcgis, idAttribute) {\n  var geojson = {};\n\n  if (arcgis.features) {\n    geojson.type = 'FeatureCollection';\n    geojson.features = [];\n\n    for (var i = 0; i < arcgis.features.length; i++) {\n      geojson.features.push(arcgisToGeoJSON(arcgis.features[i], idAttribute));\n    }\n  }\n\n  if (typeof arcgis.x === 'number' && typeof arcgis.y === 'number') {\n    geojson.type = 'Point';\n    geojson.coordinates = [arcgis.x, arcgis.y];\n\n    if (typeof arcgis.z === 'number') {\n      geojson.coordinates.push(arcgis.z);\n    }\n  }\n\n  if (arcgis.points) {\n    geojson.type = 'MultiPoint';\n    geojson.coordinates = arcgis.points.slice(0);\n  }\n\n  if (arcgis.paths) {\n    if (arcgis.paths.length === 1) {\n      geojson.type = 'LineString';\n      geojson.coordinates = arcgis.paths[0].slice(0);\n    } else {\n      geojson.type = 'MultiLineString';\n      geojson.coordinates = arcgis.paths.slice(0);\n    }\n  }\n\n  if (arcgis.rings) {\n    geojson = convertRingsToGeoJSON(arcgis.rings.slice(0));\n  }\n\n  if (typeof arcgis.xmin === 'number' && typeof arcgis.ymin === 'number' && typeof arcgis.xmax === 'number' && typeof arcgis.ymax === 'number') {\n    geojson.type = 'Polygon';\n    geojson.coordinates = [[[arcgis.xmax, arcgis.ymax], [arcgis.xmin, arcgis.ymax], [arcgis.xmin, arcgis.ymin], [arcgis.xmax, arcgis.ymin], [arcgis.xmax, arcgis.ymax]]];\n  }\n\n  if (arcgis.geometry || arcgis.attributes) {\n    geojson.type = 'Feature';\n    geojson.geometry = arcgis.geometry ? arcgisToGeoJSON(arcgis.geometry) : null;\n    geojson.properties = arcgis.attributes ? shallowClone(arcgis.attributes) : null;\n\n    if (arcgis.attributes) {\n      try {\n        geojson.id = getId(arcgis.attributes, idAttribute);\n      } catch (err) {// don't set an id\n      }\n    }\n  } // if no valid geometry was encountered\n\n\n  if (JSON.stringify(geojson.geometry) === JSON.stringify({})) {\n    geojson.geometry = null;\n  }\n\n  if (arcgis.spatialReference && arcgis.spatialReference.wkid && arcgis.spatialReference.wkid !== 4326) {\n    console.warn('Object converted in non-standard crs - ' + JSON.stringify(arcgis.spatialReference));\n  }\n\n  return geojson;\n};\n\n/* Copyright (c) 2012-2019 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n// outer rings are clockwise, holes are counterclockwise\n// used for converting GeoJSON Polygons to ArcGIS Polygons\n\nvar orientRings = function orientRings(poly) {\n  var output = [];\n  var polygon = poly.slice(0);\n  var outerRing = closeRing(polygon.shift().slice(0));\n\n  if (outerRing.length >= 4) {\n    if (!ringIsClockwise(outerRing)) {\n      outerRing.reverse();\n    }\n\n    output.push(outerRing);\n\n    for (var i = 0; i < polygon.length; i++) {\n      var hole = closeRing(polygon[i].slice(0));\n\n      if (hole.length >= 4) {\n        if (ringIsClockwise(hole)) {\n          hole.reverse();\n        }\n\n        output.push(hole);\n      }\n    }\n  }\n\n  return output;\n}; // This function flattens holes in multipolygons to one array of polygons\n// used for converting GeoJSON Polygons to ArcGIS Polygons\n\n\nvar flattenMultiPolygonRings = function flattenMultiPolygonRings(rings) {\n  var output = [];\n\n  for (var i = 0; i < rings.length; i++) {\n    var polygon = orientRings(rings[i]);\n\n    for (var x = polygon.length - 1; x >= 0; x--) {\n      var ring = polygon[x].slice(0);\n      output.push(ring);\n    }\n  }\n\n  return output;\n};\n\nvar geojsonToArcGIS = function geojsonToArcGIS(geojson, idAttribute) {\n  idAttribute = idAttribute || 'OBJECTID';\n  var spatialReference = {\n    wkid: 4326\n  };\n  var result = {};\n  var i;\n\n  switch (geojson.type) {\n    case 'Point':\n      result.x = geojson.coordinates[0];\n      result.y = geojson.coordinates[1];\n\n      if (geojson.coordinates[2]) {\n        result.z = geojson.coordinates[2];\n      }\n\n      result.spatialReference = spatialReference;\n      break;\n\n    case 'MultiPoint':\n      result.points = geojson.coordinates.slice(0);\n\n      if (geojson.coordinates[0][2]) {\n        result.hasZ = true;\n      }\n\n      result.spatialReference = spatialReference;\n      break;\n\n    case 'LineString':\n      result.paths = [geojson.coordinates.slice(0)];\n\n      if (geojson.coordinates[0][2]) {\n        result.hasZ = true;\n      }\n\n      result.spatialReference = spatialReference;\n      break;\n\n    case 'MultiLineString':\n      result.paths = geojson.coordinates.slice(0);\n\n      if (geojson.coordinates[0][0][2]) {\n        result.hasZ = true;\n      }\n\n      result.spatialReference = spatialReference;\n      break;\n\n    case 'Polygon':\n      result.rings = orientRings(geojson.coordinates.slice(0));\n\n      if (geojson.coordinates[0][0][2]) {\n        result.hasZ = true;\n      }\n\n      result.spatialReference = spatialReference;\n      break;\n\n    case 'MultiPolygon':\n      result.rings = flattenMultiPolygonRings(geojson.coordinates.slice(0));\n\n      if (geojson.coordinates[0][0][0][2]) {\n        result.hasZ = true;\n      }\n\n      result.spatialReference = spatialReference;\n      break;\n\n    case 'Feature':\n      if (geojson.geometry) {\n        result.geometry = geojsonToArcGIS(geojson.geometry, idAttribute);\n      }\n\n      result.attributes = geojson.properties ? shallowClone(geojson.properties) : {};\n\n      if (geojson.id) {\n        result.attributes[idAttribute] = geojson.id;\n      }\n\n      break;\n\n    case 'FeatureCollection':\n      result = [];\n\n      for (i = 0; i < geojson.features.length; i++) {\n        result.push(geojsonToArcGIS(geojson.features[i], idAttribute));\n      }\n\n      break;\n\n    case 'GeometryCollection':\n      result = [];\n\n      for (i = 0; i < geojson.geometries.length; i++) {\n        result.push(geojsonToArcGIS(geojson.geometries[i], idAttribute));\n      }\n\n      break;\n  }\n\n  return result;\n};\n\n/* Copyright (c) 2012-2019 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nexport { arcgisToGeoJSON, geojsonToArcGIS };\n","import {\n  latLng,\n  latLngBounds,\n  LatLng,\n  LatLngBounds,\n  Util,\n  DomUtil,\n  GeoJSON,\n} from \"leaflet\";\nimport { request, warn } from \"./Request.js\";\nimport { options } from \"./Options.js\";\nimport { Support } from \"./Support.js\";\n\nimport {\n  geojsonToArcGIS as g2a,\n  arcgisToGeoJSON as a2g,\n} from \"@terraformer/arcgis\";\n\nconst POWERED_BY_ESRI_ATTRIBUTION_STRING =\n  'Powered by <a href=\"https://www.esri.com\">Esri</a>';\n\nexport function geojsonToArcGIS(geojson, idAttr) {\n  return g2a(geojson, idAttr);\n}\n\nexport function arcgisToGeoJSON(arcgis, idAttr) {\n  return a2g(arcgis, idAttr);\n}\n\n// convert an extent (ArcGIS) to LatLngBounds (Leaflet)\nexport function extentToBounds(extent) {\n  // \"NaN\" coordinates from ArcGIS Server indicate a null geometry\n  if (\n    extent.xmin !== \"NaN\" &&\n    extent.ymin !== \"NaN\" &&\n    extent.xmax !== \"NaN\" &&\n    extent.ymax !== \"NaN\"\n  ) {\n    const sw = latLng(extent.ymin, extent.xmin);\n    const ne = latLng(extent.ymax, extent.xmax);\n    return latLngBounds(sw, ne);\n  }\n  return null;\n}\n\n// convert an LatLngBounds (Leaflet) to extent (ArcGIS)\nexport function boundsToExtent(bounds) {\n  bounds = latLngBounds(bounds);\n  return {\n    xmin: bounds.getSouthWest().lng,\n    ymin: bounds.getSouthWest().lat,\n    xmax: bounds.getNorthEast().lng,\n    ymax: bounds.getNorthEast().lat,\n    spatialReference: {\n      wkid: 4326,\n    },\n  };\n}\n\nconst knownFieldNames = /^(OBJECTID|FID|OID|ID)$/i;\n\n// Attempts to find the ID Field from response\nexport function _findIdAttributeFromResponse(response) {\n  let result;\n\n  if (response.objectIdFieldName) {\n    // Find Id Field directly\n    result = response.objectIdFieldName;\n  } else if (response.fields) {\n    // Find ID Field based on field type\n    for (let j = 0; j <= response.fields.length - 1; j++) {\n      if (response.fields[j].type === \"esriFieldTypeOID\") {\n        result = response.fields[j].name;\n        break;\n      }\n    }\n    if (!result) {\n      // If no field was marked as being the esriFieldTypeOID try well known field names\n      for (let j = 0; j <= response.fields.length - 1; j++) {\n        if (response.fields[j].name.match(knownFieldNames)) {\n          result = response.fields[j].name;\n          break;\n        }\n      }\n    }\n  }\n  return result;\n}\n\n// This is the 'last' resort, find the Id field from the specified feature\nexport function _findIdAttributeFromFeature(feature) {\n  for (const key in feature.attributes) {\n    if (key.match(knownFieldNames)) {\n      return key;\n    }\n  }\n}\n\nexport function responseToFeatureCollection(response, idAttribute) {\n  let objectIdField;\n  const features = response.features || response.results;\n  const count = features && features.length;\n\n  if (idAttribute) {\n    objectIdField = idAttribute;\n  } else {\n    objectIdField = _findIdAttributeFromResponse(response);\n  }\n\n  const featureCollection = {\n    type: \"FeatureCollection\",\n    features: [],\n  };\n\n  if (count) {\n    for (let i = features.length - 1; i >= 0; i--) {\n      const feature = arcgisToGeoJSON(\n        features[i],\n        objectIdField || _findIdAttributeFromFeature(features[i]),\n      );\n      featureCollection.features.push(feature);\n    }\n  }\n\n  return featureCollection;\n}\n\n// trim url whitespace and add a trailing slash if needed\nexport function cleanUrl(url) {\n  // trim leading and trailing spaces, but not spaces inside the url\n  url = Util.trim(url);\n\n  // add a trailing slash to the url if the user omitted it\n  if (url[url.length - 1] !== \"/\") {\n    url += \"/\";\n  }\n\n  return url;\n}\n\n/* Extract url params if any and store them in requestParams attribute.\n\t Return the options params updated */\nexport function getUrlParams(options) {\n  if (options.url.indexOf(\"?\") !== -1) {\n    options.requestParams = options.requestParams || {};\n    const queryString = options.url.substring(options.url.indexOf(\"?\") + 1);\n    options.url = options.url.split(\"?\")[0];\n    options.requestParams = JSON.parse(\n      `{\"${decodeURI(queryString).replace(/\"/g, '\\\\\"').replace(/&/g, '\",\"').replace(/=/g, '\":\"')}\"}`,\n    );\n  }\n  options.url = cleanUrl(options.url.split(\"?\")[0]);\n  return options;\n}\n\nexport function isArcgisOnline(url) {\n  /* hosted feature services support geojson as an output format\n\tutility.arcgis.com services are proxied from a variety of ArcGIS Server vintages, and may not */\n  return /^(?!.*utility\\.arcgis\\.com).*\\.arcgis\\.com.*FeatureServer/i.test(url);\n}\n\nexport function geojsonTypeToArcGIS(geoJsonType) {\n  let arcgisGeometryType;\n  switch (geoJsonType) {\n    case \"Point\":\n      arcgisGeometryType = \"esriGeometryPoint\";\n      break;\n    case \"MultiPoint\":\n      arcgisGeometryType = \"esriGeometryMultipoint\";\n      break;\n    case \"LineString\":\n      arcgisGeometryType = \"esriGeometryPolyline\";\n      break;\n    case \"MultiLineString\":\n      arcgisGeometryType = \"esriGeometryPolyline\";\n      break;\n    case \"Polygon\":\n      arcgisGeometryType = \"esriGeometryPolygon\";\n      break;\n    case \"MultiPolygon\":\n      arcgisGeometryType = \"esriGeometryPolygon\";\n      break;\n  }\n\n  return arcgisGeometryType;\n}\n\nexport function calcAttributionWidth(map) {\n  // either crop at 55px or user defined buffer\n  return `${map.getSize().x - options.attributionWidthOffset}px`;\n}\n\nexport function setEsriAttribution(map) {\n  if (!map.attributionControl) {\n    return;\n  }\n\n  if (!map.attributionControl._esriAttributionLayerCount) {\n    map.attributionControl._esriAttributionLayerCount = 0;\n  }\n\n  if (map.attributionControl._esriAttributionLayerCount === 0) {\n    // Dynamically creating the CSS rules, only run this once per page load:\n    if (!map.attributionControl._esriAttributionAddedOnce) {\n      const hoverAttributionStyle = document.createElement(\"style\");\n      hoverAttributionStyle.type = \"text/css\";\n      hoverAttributionStyle.innerHTML =\n        \".esri-truncated-attribution:hover {white-space: normal;}\";\n      document\n        .getElementsByTagName(\"head\")[0]\n        .appendChild(hoverAttributionStyle);\n\n      // define a new css class in JS to trim attribution into a single line\n      const attributionStyle = document.createElement(\"style\");\n      attributionStyle.type = \"text/css\";\n      attributionStyle.innerHTML =\n        \".esri-truncated-attribution {\" +\n        \"vertical-align: -3px;\" +\n        \"white-space: nowrap;\" +\n        \"overflow: hidden;\" +\n        \"text-overflow: ellipsis;\" +\n        \"display: inline-block;\" +\n        \"transition: 0s white-space;\" +\n        \"transition-delay: 1s;\" +\n        `max-width: ${calcAttributionWidth(map)};` +\n        \"}\";\n      document.getElementsByTagName(\"head\")[0].appendChild(attributionStyle);\n\n      // update the width used to truncate when the map itself is resized\n      map.on(\"resize\", (e) => {\n        if (map.attributionControl) {\n          map.attributionControl._container.style.maxWidth =\n            calcAttributionWidth(e.target);\n        }\n      });\n\n      map.attributionControl._esriAttributionAddedOnce = true;\n    }\n\n    DomUtil.addClass(\n      map.attributionControl._container,\n      \"esri-truncated-attribution:hover\",\n    );\n    DomUtil.addClass(\n      map.attributionControl._container,\n      \"esri-truncated-attribution\",\n    );\n  }\n\n  // Track the number of esri-leaflet layers that are on the map so we can know when we can remove the attribution (below in removeEsriAttribution)\n  map.attributionControl._esriAttributionLayerCount =\n    map.attributionControl._esriAttributionLayerCount + 1;\n}\n\nexport function getEsriAttributionHtmlString() {\n  return POWERED_BY_ESRI_ATTRIBUTION_STRING;\n}\n\nexport function removeEsriAttribution(map) {\n  if (!map.attributionControl) {\n    return;\n  }\n\n  // Only remove the attribution if we're about to remove the LAST esri-leaflet layer (_esriAttributionLayerCount)\n  if (\n    map.attributionControl._esriAttributionLayerCount &&\n    map.attributionControl._esriAttributionLayerCount === 1\n  ) {\n    DomUtil.removeClass(\n      map.attributionControl._container,\n      \"esri-truncated-attribution:hover\",\n    );\n    DomUtil.removeClass(\n      map.attributionControl._container,\n      \"esri-truncated-attribution\",\n    );\n  }\n  map.attributionControl._esriAttributionLayerCount =\n    map.attributionControl._esriAttributionLayerCount - 1;\n}\n\nexport function _setGeometry(geometry) {\n  const params = {\n    geometry: null,\n    geometryType: null,\n  };\n\n  // convert bounds to extent and finish\n  if (geometry instanceof LatLngBounds) {\n    // set geometry + geometryType\n    params.geometry = boundsToExtent(geometry);\n    params.geometryType = \"esriGeometryEnvelope\";\n    return params;\n  }\n\n  // convert L.Marker > L.LatLng\n  if (geometry.getLatLng) {\n    geometry = geometry.getLatLng();\n  }\n\n  // convert L.LatLng to a geojson point and continue;\n  if (geometry instanceof LatLng) {\n    geometry = {\n      type: \"Point\",\n      coordinates: [geometry.lng, geometry.lat],\n    };\n  }\n\n  // handle L.GeoJSON, pull out the first geometry\n  if (geometry instanceof GeoJSON) {\n    // reassign geometry to the GeoJSON value  (we are assuming that only one feature is present)\n    geometry = geometry.getLayers()[0].feature.geometry;\n    params.geometry = geojsonToArcGIS(geometry);\n    params.geometryType = geojsonTypeToArcGIS(geometry.type);\n  }\n\n  // Handle L.Polyline and L.Polygon\n  if (geometry.toGeoJSON) {\n    geometry = geometry.toGeoJSON();\n  }\n\n  // handle GeoJSON feature by pulling out the geometry\n  if (geometry.type === \"Feature\") {\n    // get the geometry of the geojson feature\n    geometry = geometry.geometry;\n  }\n\n  // confirm that our GeoJSON is a point, line or polygon\n  if (\n    geometry.type === \"Point\" ||\n    geometry.type === \"LineString\" ||\n    geometry.type === \"Polygon\" ||\n    geometry.type === \"MultiPolygon\"\n  ) {\n    params.geometry = geojsonToArcGIS(geometry);\n    params.geometryType = geojsonTypeToArcGIS(geometry.type);\n    return params;\n  }\n\n  // warn the user if we havn't found an appropriate object\n  warn(\n    \"invalid geometry passed to spatial query. Should be L.LatLng, L.LatLngBounds, L.Marker or a GeoJSON Point, Line, Polygon or MultiPolygon object\",\n  );\n}\n\nexport function _getAttributionData(url, map) {\n  if (Support.cors) {\n    request(\n      url,\n      {},\n      Util.bind((error, attributions) => {\n        if (error) {\n          return;\n        }\n        map._esriAttributions = [];\n        for (let c = 0; c < attributions.contributors.length; c++) {\n          const contributor = attributions.contributors[c];\n\n          for (let i = 0; i < contributor.coverageAreas.length; i++) {\n            const coverageArea = contributor.coverageAreas[i];\n            const southWest = latLng(\n              coverageArea.bbox[0],\n              coverageArea.bbox[1],\n            );\n            const northEast = latLng(\n              coverageArea.bbox[2],\n              coverageArea.bbox[3],\n            );\n            map._esriAttributions.push({\n              attribution: contributor.attribution,\n              score: coverageArea.score,\n              bounds: latLngBounds(southWest, northEast),\n              minZoom: coverageArea.zoomMin,\n              maxZoom: coverageArea.zoomMax,\n            });\n          }\n        }\n\n        map._esriAttributions.sort((a, b) => b.score - a.score);\n\n        // pass the same argument as the map's 'moveend' event\n        const obj = { target: map };\n        _updateMapAttribution(obj);\n      }, this),\n    );\n  }\n}\n\nexport function _updateMapAttribution(evt) {\n  const map = evt.target;\n  const oldAttributions = map._esriAttributions;\n\n  if (!map || !map.attributionControl) {\n    return;\n  }\n\n  const attributionElement = map.attributionControl._container.querySelector(\n    \".esri-dynamic-attribution\",\n  );\n\n  if (attributionElement && oldAttributions) {\n    let newAttributions = \"\";\n    const bounds = map.getBounds();\n    const wrappedBounds = latLngBounds(\n      bounds.getSouthWest().wrap(),\n      bounds.getNorthEast().wrap(),\n    );\n    const zoom = map.getZoom();\n\n    for (let i = 0; i < oldAttributions.length; i++) {\n      const attribution = oldAttributions[i];\n      const text = attribution.attribution;\n\n      if (\n        !newAttributions.match(text) &&\n        attribution.bounds.intersects(wrappedBounds) &&\n        zoom >= attribution.minZoom &&\n        zoom <= attribution.maxZoom\n      ) {\n        newAttributions += `, ${text}`;\n      }\n    }\n\n    newAttributions = `${getEsriAttributionHtmlString()} | ${newAttributions.substr(2)}`;\n    attributionElement.innerHTML = newAttributions;\n    attributionElement.style.maxWidth = calcAttributionWidth(map);\n\n    map.fire(\"attributionupdated\", {\n      attribution: newAttributions,\n    });\n  }\n}\n\n// for backwards compatibility\nexport { warn };\n\nexport const EsriUtil = {\n  warn,\n  cleanUrl,\n  getUrlParams,\n  isArcgisOnline,\n  geojsonTypeToArcGIS,\n  responseToFeatureCollection,\n  geojsonToArcGIS,\n  arcgisToGeoJSON,\n  boundsToExtent,\n  extentToBounds,\n  calcAttributionWidth,\n  setEsriAttribution,\n  getEsriAttributionHtmlString,\n  removeEsriAttribution,\n  _setGeometry,\n  _getAttributionData,\n  _updateMapAttribution,\n  _findIdAttributeFromFeature,\n  _findIdAttributeFromResponse,\n};\n\nexport default EsriUtil;\n","import { Class, Util } from \"leaflet\";\nimport { cors } from \"../Support.js\";\nimport { cleanUrl, getUrlParams } from \"../Util.js\";\nimport Request from \"../Request.js\";\n\nexport const Task = Class.extend({\n  options: {\n    proxy: false,\n    useCors: cors,\n  },\n\n  // Generate a method for each methodName:paramName in the setters for this task.\n  generateSetter(param, context) {\n    return Util.bind(function (value) {\n      this.params[param] = value;\n      return this;\n    }, context);\n  },\n\n  initialize(endpoint) {\n    // endpoint can be either a url (and options) for an ArcGIS Rest Service or an instance of EsriLeaflet.Service\n    if (endpoint.request && endpoint.options) {\n      this._service = endpoint;\n      Util.setOptions(this, endpoint.options);\n    } else {\n      Util.setOptions(this, endpoint);\n      this.options.url = cleanUrl(endpoint.url);\n    }\n\n    // clone default params into this object\n    this.params = Util.extend({}, this.params || {});\n\n    // generate setter methods based on the setters object implimented a child class\n    if (this.setters) {\n      for (const setter in this.setters) {\n        const param = this.setters[setter];\n        this[setter] = this.generateSetter(param, this);\n      }\n    }\n  },\n\n  token(token) {\n    if (this._service) {\n      this._service.authenticate(token);\n    } else {\n      this.params.token = token;\n    }\n    return this;\n  },\n\n  apikey(apikey) {\n    return this.token(apikey);\n  },\n\n  // ArcGIS Server Find/Identify 10.5+\n  format(boolean) {\n    // use double negative to expose a more intuitive positive method name\n    this.params.returnUnformattedValues = !boolean;\n    return this;\n  },\n\n  request(callback, context) {\n    if (this.options.requestParams) {\n      Util.extend(this.params, this.options.requestParams);\n    }\n    if (this._service) {\n      return this._service.request(this.path, this.params, callback, context);\n    }\n\n    return this._request(\"request\", this.path, this.params, callback, context);\n  },\n\n  _request(method, path, params, callback, context) {\n    const url = this.options.proxy\n      ? `${this.options.proxy}?${this.options.url}${path}`\n      : this.options.url + path;\n\n    if ((method === \"get\" || method === \"request\") && !this.options.useCors) {\n      return Request.get.JSONP(url, params, callback, context);\n    }\n\n    return Request[method](url, params, callback, context);\n  },\n});\n\nexport function task(options) {\n  options = getUrlParams(options);\n  return new Task(options);\n}\n\nexport default task;\n","import { point, latLng } from \"leaflet\";\nimport { Task } from \"./Task.js\";\nimport {\n  warn,\n  responseToFeatureCollection,\n  isArcgisOnline,\n  extentToBounds,\n  _setGeometry,\n} from \"../Util.js\";\n\nexport const Query = Task.extend({\n  setters: {\n    offset: \"resultOffset\",\n    limit: \"resultRecordCount\",\n    fields: \"outFields\",\n    precision: \"geometryPrecision\",\n    featureIds: \"objectIds\",\n    returnGeometry: \"returnGeometry\",\n    returnM: \"returnM\",\n    transform: \"datumTransformation\",\n    token: \"token\",\n  },\n\n  path: \"query\",\n\n  params: {\n    returnGeometry: true,\n    where: \"1=1\",\n    outSR: 4326,\n    outFields: \"*\",\n  },\n\n  // Returns a feature if its shape is wholly contained within the search geometry. Valid for all shape type combinations.\n  within(geometry) {\n    this._setGeometryParams(geometry);\n    this.params.spatialRel = \"esriSpatialRelContains\"; // to the REST api this reads geometry **contains** layer\n    return this;\n  },\n\n  // Returns a feature if any spatial relationship is found. Applies to all shape type combinations.\n  intersects(geometry) {\n    this._setGeometryParams(geometry);\n    this.params.spatialRel = \"esriSpatialRelIntersects\";\n    return this;\n  },\n\n  // Returns a feature if its shape wholly contains the search geometry. Valid for all shape type combinations.\n  contains(geometry) {\n    this._setGeometryParams(geometry);\n    this.params.spatialRel = \"esriSpatialRelWithin\"; // to the REST api this reads geometry **within** layer\n    return this;\n  },\n\n  // Returns a feature if the intersection of the interiors of the two shapes is not empty and has a lower dimension than the maximum dimension of the two shapes. Two lines that share an endpoint in common do not cross. Valid for Line/Line, Line/Area, Multi-point/Area, and Multi-point/Line shape type combinations.\n  crosses(geometry) {\n    this._setGeometryParams(geometry);\n    this.params.spatialRel = \"esriSpatialRelCrosses\";\n    return this;\n  },\n\n  // Returns a feature if the two shapes share a common boundary. However, the intersection of the interiors of the two shapes must be empty. In the Point/Line case, the point may touch an endpoint only of the line. Applies to all combinations except Point/Point.\n  touches(geometry) {\n    this._setGeometryParams(geometry);\n    this.params.spatialRel = \"esriSpatialRelTouches\";\n    return this;\n  },\n\n  // Returns a feature if the intersection of the two shapes results in an object of the same dimension, but different from both of the shapes. Applies to Area/Area, Line/Line, and Multi-point/Multi-point shape type combinations.\n  overlaps(geometry) {\n    this._setGeometryParams(geometry);\n    this.params.spatialRel = \"esriSpatialRelOverlaps\";\n    return this;\n  },\n\n  // Returns a feature if the envelope of the two shapes intersects.\n  bboxIntersects(geometry) {\n    this._setGeometryParams(geometry);\n    this.params.spatialRel = \"esriSpatialRelEnvelopeIntersects\";\n    return this;\n  },\n\n  // if someone can help decipher the ArcObjects explanation and translate to plain speak, we should mention this method in the doc\n  indexIntersects(geometry) {\n    this._setGeometryParams(geometry);\n    this.params.spatialRel = \"esriSpatialRelIndexIntersects\"; // Returns a feature if the envelope of the query geometry intersects the index entry for the target geometry\n    return this;\n  },\n\n  // only valid for Feature Services running on ArcGIS Server 10.3+ or ArcGIS Online\n  nearby(latlng, radius) {\n    latlng = latLng(latlng);\n    this.params.geometry = [latlng.lng, latlng.lat];\n    this.params.geometryType = \"esriGeometryPoint\";\n    this.params.spatialRel = \"esriSpatialRelIntersects\";\n    this.params.units = \"esriSRUnit_Meter\";\n    this.params.distance = radius;\n    this.params.inSR = 4326;\n    return this;\n  },\n\n  where(string) {\n    // instead of converting double-quotes to single quotes, pass as is, and provide a more informative message if a 400 is encountered\n    this.params.where = string;\n    return this;\n  },\n\n  between(start, end) {\n    this.params.time = [start.valueOf(), end.valueOf()];\n    return this;\n  },\n\n  simplify(map, factor) {\n    const mapWidth = Math.abs(\n      map.getBounds().getWest() - map.getBounds().getEast(),\n    );\n    this.params.maxAllowableOffset = (mapWidth / map.getSize().y) * factor;\n    return this;\n  },\n\n  orderBy(fieldName, order) {\n    order = order || \"ASC\";\n    this.params.orderByFields = this.params.orderByFields\n      ? `${this.params.orderByFields},`\n      : \"\";\n    this.params.orderByFields += [fieldName, order].join(\" \");\n    return this;\n  },\n\n  run(callback, context) {\n    this._cleanParams();\n\n    // services hosted on ArcGIS Online and ArcGIS Server 10.3.1+ support requesting geojson directly\n    if (\n      this.options.isModern ||\n      (isArcgisOnline(this.options.url) && this.options.isModern === undefined)\n    ) {\n      this.params.f = \"geojson\";\n\n      return this.request(function (error, response) {\n        this._trapSQLerrors(error);\n        callback.call(context, error, response, response);\n      }, this);\n\n      // otherwise convert it in the callback then pass it on\n    }\n    return this.request(function (error, response) {\n      this._trapSQLerrors(error);\n      callback.call(\n        context,\n        error,\n        response && responseToFeatureCollection(response),\n        response,\n      );\n    }, this);\n  },\n\n  count(callback, context) {\n    this._cleanParams();\n    this.params.returnCountOnly = true;\n    return this.request(function (error, response) {\n      callback.call(this, error, response && response.count, response);\n    }, context);\n  },\n\n  ids(callback, context) {\n    this._cleanParams();\n    this.params.returnIdsOnly = true;\n    return this.request(function (error, response) {\n      callback.call(this, error, response && response.objectIds, response);\n    }, context);\n  },\n\n  // only valid for Feature Services running on ArcGIS Server 10.3+ or ArcGIS Online\n  bounds(callback, context) {\n    this._cleanParams();\n    this.params.returnExtentOnly = true;\n    return this.request((error, response) => {\n      if (response && response.extent && extentToBounds(response.extent)) {\n        callback.call(\n          context,\n          error,\n          extentToBounds(response.extent),\n          response,\n        );\n      } else {\n        error = {\n          message: \"Invalid Bounds\",\n        };\n        callback.call(context, error, null, response);\n      }\n    }, context);\n  },\n\n  distinct() {\n    // geometry must be omitted for queries requesting distinct values\n    this.params.returnGeometry = false;\n    this.params.returnDistinctValues = true;\n    return this;\n  },\n\n  // only valid for image services\n  pixelSize(rawPoint) {\n    const castPoint = point(rawPoint);\n    this.params.pixelSize = [castPoint.x, castPoint.y];\n    return this;\n  },\n\n  // only valid for map services\n  layer(layer) {\n    this.path = `${layer}/query`;\n    return this;\n  },\n\n  _trapSQLerrors(error) {\n    if (error) {\n      if (error.code === \"400\") {\n        warn(\n          \"one common syntax error in query requests is encasing string values in double quotes instead of single quotes\",\n        );\n      }\n    }\n  },\n\n  _cleanParams() {\n    delete this.params.returnIdsOnly;\n    delete this.params.returnExtentOnly;\n    delete this.params.returnCountOnly;\n  },\n\n  _setGeometryParams(geometry) {\n    this.params.inSR = 4326;\n    const converted = _setGeometry(geometry);\n    this.params.geometry = converted.geometry;\n    this.params.geometryType = converted.geometryType;\n  },\n});\n\nexport function query(options) {\n  return new Query(options);\n}\n\nexport default query;\n","import { Task } from \"./Task.js\";\nimport { responseToFeatureCollection } from \"../Util.js\";\n\nexport const Find = Task.extend({\n  setters: {\n    // method name > param name\n    contains: \"contains\",\n    text: \"searchText\",\n    fields: \"searchFields\", // denote an array or single string\n    spatialReference: \"sr\",\n    sr: \"sr\",\n    layers: \"layers\",\n    returnGeometry: \"returnGeometry\",\n    maxAllowableOffset: \"maxAllowableOffset\",\n    precision: \"geometryPrecision\",\n    dynamicLayers: \"dynamicLayers\",\n    returnZ: \"returnZ\",\n    returnM: \"returnM\",\n    gdbVersion: \"gdbVersion\",\n    // skipped implementing this (for now) because the REST service implementation isnt consistent between operations\n    // 'transform': 'datumTransformations',\n    token: \"token\",\n  },\n\n  path: \"find\",\n\n  params: {\n    sr: 4326,\n    contains: true,\n    returnGeometry: true,\n    returnZ: true,\n    returnM: false,\n  },\n\n  layerDefs(id, where) {\n    this.params.layerDefs = this.params.layerDefs\n      ? `${this.params.layerDefs};`\n      : \"\";\n    this.params.layerDefs += [id, where].join(\":\");\n    return this;\n  },\n\n  simplify(map, factor) {\n    const mapWidth = Math.abs(\n      map.getBounds().getWest() - map.getBounds().getEast(),\n    );\n    this.params.maxAllowableOffset = (mapWidth / map.getSize().y) * factor;\n    return this;\n  },\n\n  run(callback, context) {\n    return this.request((error, response) => {\n      callback.call(\n        context,\n        error,\n        response && responseToFeatureCollection(response),\n        response,\n      );\n    }, context);\n  },\n});\n\nexport function find(options) {\n  return new Find(options);\n}\n\nexport default find;\n","import { Task } from \"./Task.js\";\n\nexport const Identify = Task.extend({\n  path: \"identify\",\n\n  between(start, end) {\n    this.params.time = [start.valueOf(), end.valueOf()];\n    return this;\n  },\n});\n\nexport function identify(options) {\n  return new Identify(options);\n}\n\nexport default identify;\n","import { latLng } from \"leaflet\";\nimport { Identify } from \"./Identify.js\";\nimport {\n  responseToFeatureCollection,\n  boundsToExtent,\n  _setGeometry,\n} from \"../Util.js\";\n\nexport const IdentifyFeatures = Identify.extend({\n  setters: {\n    layers: \"layers\",\n    precision: \"geometryPrecision\",\n    tolerance: \"tolerance\",\n    // skipped implementing this (for now) because the REST service implementation isnt consistent between operations.\n    // 'transform': 'datumTransformations'\n    returnGeometry: \"returnGeometry\",\n  },\n\n  params: {\n    sr: 4326,\n    layers: \"all\",\n    tolerance: 3,\n    returnGeometry: true,\n  },\n\n  on(map) {\n    const extent = boundsToExtent(map.getBounds());\n    const size = map.getSize();\n    this.params.imageDisplay = [size.x, size.y, 96];\n    this.params.mapExtent = [\n      extent.xmin,\n      extent.ymin,\n      extent.xmax,\n      extent.ymax,\n    ];\n    return this;\n  },\n\n  at(geometry) {\n    // cast lat, long pairs in raw array form manually\n    if (geometry.length === 2) {\n      geometry = latLng(geometry);\n    }\n    this._setGeometryParams(geometry);\n    return this;\n  },\n\n  layerDef(id, where) {\n    this.params.layerDefs = this.params.layerDefs\n      ? `${this.params.layerDefs};`\n      : \"\";\n    this.params.layerDefs += [id, where].join(\":\");\n    return this;\n  },\n\n  simplify(map, factor) {\n    const mapWidth = Math.abs(\n      map.getBounds().getWest() - map.getBounds().getEast(),\n    );\n    this.params.maxAllowableOffset = (mapWidth / map.getSize().y) * factor;\n    return this;\n  },\n\n  run(callback, context) {\n    return this.request((error, response) => {\n      // immediately invoke with an error\n      if (error) {\n        callback.call(context, error, undefined, response);\n\n        // ok no error lets just assume we have features...\n      } else {\n        const featureCollection = responseToFeatureCollection(response);\n        response.results = response.results.reverse();\n        for (let i = 0; i < featureCollection.features.length; i++) {\n          const feature = featureCollection.features[i];\n          feature.layerId = response.results[i].layerId;\n        }\n        callback.call(context, undefined, featureCollection, response);\n      }\n    });\n  },\n\n  _setGeometryParams(geometry) {\n    const converted = _setGeometry(geometry);\n    this.params.geometry = converted.geometry;\n    this.params.geometryType = converted.geometryType;\n  },\n});\n\nexport function identifyFeatures(options) {\n  return new IdentifyFeatures(options);\n}\n\nexport default identifyFeatures;\n","import { latLng } from \"leaflet\";\nimport { Identify } from \"./Identify.js\";\nimport { responseToFeatureCollection } from \"../Util.js\";\n\nexport const IdentifyImage = Identify.extend({\n  setters: {\n    setMosaicRule: \"mosaicRule\",\n    setRenderingRule: \"renderingRule\",\n    setPixelSize: \"pixelSize\",\n    returnCatalogItems: \"returnCatalogItems\",\n    returnGeometry: \"returnGeometry\",\n  },\n\n  params: {\n    returnGeometry: false,\n  },\n\n  at(latlng) {\n    latlng = latLng(latlng);\n    this.params.geometry = JSON.stringify({\n      x: latlng.lng,\n      y: latlng.lat,\n      spatialReference: {\n        wkid: 4326,\n      },\n    });\n    this.params.geometryType = \"esriGeometryPoint\";\n    return this;\n  },\n\n  getMosaicRule() {\n    return this.params.mosaicRule;\n  },\n\n  getRenderingRule() {\n    return this.params.renderingRule;\n  },\n\n  getPixelSize() {\n    return this.params.pixelSize;\n  },\n\n  run(callback, context) {\n    return this.request(function (error, response) {\n      callback.call(\n        context,\n        error,\n        response && this._responseToGeoJSON(response),\n        response,\n      );\n    }, this);\n  },\n\n  // get pixel data and return as geoJSON point\n  // populate catalog items (if any)\n  // merging in any catalogItemVisibilities as a propery of each feature\n  _responseToGeoJSON(response) {\n    const location = response.location;\n    const catalogItems = response.catalogItems;\n    const catalogItemVisibilities = response.catalogItemVisibilities;\n    const geoJSON = {\n      pixel: {\n        type: \"Feature\",\n        geometry: {\n          type: \"Point\",\n          coordinates: [location.x, location.y],\n        },\n        crs: {\n          type: \"EPSG\",\n          properties: {\n            code: location.spatialReference.wkid,\n          },\n        },\n        properties: {\n          OBJECTID: response.objectId,\n          name: response.name,\n          value: response.value,\n        },\n        id: response.objectId,\n      },\n    };\n\n    if (response.properties && response.properties.Values) {\n      geoJSON.pixel.properties.values = response.properties.Values;\n    }\n\n    if (catalogItems && catalogItems.features) {\n      geoJSON.catalogItems = responseToFeatureCollection(catalogItems);\n      if (\n        catalogItemVisibilities &&\n        catalogItemVisibilities.length === geoJSON.catalogItems.features.length\n      ) {\n        for (let i = catalogItemVisibilities.length - 1; i >= 0; i--) {\n          geoJSON.catalogItems.features[i].properties.catalogItemVisibility =\n            catalogItemVisibilities[i];\n        }\n      }\n    }\n    return geoJSON;\n  },\n});\n\nexport function identifyImage(params) {\n  return new IdentifyImage(params);\n}\n\nexport default identifyImage;\n","import { Util, Evented } from \"leaflet\";\nimport { cors } from \"../Support.js\";\nimport { cleanUrl, getUrlParams } from \"../Util.js\";\nimport Request from \"../Request.js\";\n\nexport const Service = Evented.extend({\n  options: {\n    proxy: false,\n    useCors: cors,\n    timeout: 0,\n  },\n\n  initialize(options) {\n    options = options || {};\n    this._requestQueue = [];\n    this._authenticating = false;\n    Util.setOptions(this, options);\n    this.options.url = cleanUrl(this.options.url);\n  },\n\n  get(path, params, callback, context) {\n    return this._request(\"get\", path, params, callback, context);\n  },\n\n  post(path, params, callback, context) {\n    return this._request(\"post\", path, params, callback, context);\n  },\n\n  request(path, params, callback, context) {\n    return this._request(\"request\", path, params, callback, context);\n  },\n\n  metadata(callback, context) {\n    return this._request(\"get\", \"\", {}, callback, context);\n  },\n\n  authenticate(token) {\n    this._authenticating = false;\n    this.options.token = token;\n    this._runQueue();\n    return this;\n  },\n\n  getTimeout() {\n    return this.options.timeout;\n  },\n\n  setTimeout(timeout) {\n    this.options.timeout = timeout;\n  },\n\n  _request(method, path, params, callback, context) {\n    this.fire(\n      \"requeststart\",\n      {\n        url: this.options.url + path,\n        params,\n        method,\n      },\n      true,\n    );\n\n    const wrappedCallback = this._createServiceCallback(\n      method,\n      path,\n      params,\n      callback,\n      context,\n    );\n\n    if (this.options.token) {\n      params.token = this.options.token;\n    }\n    if (this.options.requestParams) {\n      Util.extend(params, this.options.requestParams);\n    }\n    if (this._authenticating) {\n      this._requestQueue.push([method, path, params, callback, context]);\n    } else {\n      const url = this.options.proxy\n        ? `${this.options.proxy}?${this.options.url}${path}`\n        : this.options.url + path;\n\n      if ((method === \"get\" || method === \"request\") && !this.options.useCors) {\n        return Request.get.JSONP(url, params, wrappedCallback, context);\n      }\n      return Request[method](url, params, wrappedCallback, context);\n    }\n  },\n\n  _createServiceCallback(method, path, params, callback, context) {\n    return Util.bind(function (error, response) {\n      if (error && (error.code === 499 || error.code === 498)) {\n        this._authenticating = true;\n\n        this._requestQueue.push([method, path, params, callback, context]);\n\n        // fire an event for users to handle and re-authenticate\n        this.fire(\n          \"authenticationrequired\",\n          {\n            authenticate: Util.bind(this.authenticate, this),\n          },\n          true,\n        );\n\n        // if the user has access to a callback they can handle the auth error\n        error.authenticate = Util.bind(this.authenticate, this);\n      }\n\n      callback.call(context, error, response);\n\n      if (error) {\n        this.fire(\n          \"requesterror\",\n          {\n            url: this.options.url + path,\n            params,\n            message: error.message,\n            code: error.code,\n            method,\n          },\n          true,\n        );\n      } else {\n        this.fire(\n          \"requestsuccess\",\n          {\n            url: this.options.url + path,\n            params,\n            response,\n            method,\n          },\n          true,\n        );\n      }\n\n      this.fire(\n        \"requestend\",\n        {\n          url: this.options.url + path,\n          params,\n          method,\n        },\n        true,\n      );\n    }, this);\n  },\n\n  _runQueue() {\n    for (let i = this._requestQueue.length - 1; i >= 0; i--) {\n      const request = this._requestQueue[i];\n      const method = request.shift();\n      this[method].apply(this, request);\n    }\n    this._requestQueue = [];\n  },\n});\n\nexport function service(options) {\n  options = getUrlParams(options);\n  return new Service(options);\n}\n\nexport default service;\n","import { Service } from \"./Service.js\";\nimport identifyFeatures from \"../Tasks/IdentifyFeatures.js\";\nimport query from \"../Tasks/Query.js\";\nimport find from \"../Tasks/Find.js\";\n\nexport const MapService = Service.extend({\n  identify() {\n    return identifyFeatures(this);\n  },\n\n  find() {\n    return find(this);\n  },\n\n  query() {\n    return query(this);\n  },\n});\n\nexport function mapService(options) {\n  return new MapService(options);\n}\n\nexport default mapService;\n","import { Service } from \"./Service.js\";\nimport identifyImage from \"../Tasks/IdentifyImage.js\";\nimport query from \"../Tasks/Query.js\";\n\nexport const ImageService = Service.extend({\n  query() {\n    return query(this);\n  },\n\n  identify() {\n    return identifyImage(this);\n  },\n});\n\nexport function imageService(options) {\n  return new ImageService(options);\n}\n\nexport default imageService;\n","import { Service } from \"./Service.js\";\nimport query from \"../Tasks/Query.js\";\nimport { geojsonToArcGIS } from \"../Util.js\";\n\nexport const FeatureLayerService = Service.extend({\n  options: {\n    idAttribute: \"OBJECTID\",\n  },\n\n  query() {\n    return query(this);\n  },\n\n  addFeature(feature, callback, context) {\n    this.addFeatures(feature, callback, context);\n  },\n\n  addFeatures(features, callback, context) {\n    const featuresArray = features.features ? features.features : [features];\n    for (let i = featuresArray.length - 1; i >= 0; i--) {\n      delete featuresArray[i].id;\n    }\n    features = geojsonToArcGIS(features);\n    features = featuresArray.length > 1 ? features : [features];\n    return this.post(\n      \"addFeatures\",\n      {\n        features,\n      },\n      (error, response) => {\n        // For compatibility reason with former addFeature function,\n        // we return the object in the array and not the array itself\n        const result =\n          response && response.addResults\n            ? response.addResults.length > 1\n              ? response.addResults\n              : response.addResults[0]\n            : undefined;\n        if (callback) {\n          callback.call(context, error || response.addResults[0].error, result);\n        }\n      },\n      context,\n    );\n  },\n\n  updateFeature(feature, callback, context) {\n    this.updateFeatures(feature, callback, context);\n  },\n\n  updateFeatures(features, callback, context) {\n    const featuresArray = features.features ? features.features : [features];\n    features = geojsonToArcGIS(features, this.options.idAttribute);\n    features = featuresArray.length > 1 ? features : [features];\n\n    return this.post(\n      \"updateFeatures\",\n      {\n        features,\n      },\n      (error, response) => {\n        // For compatibility reason with former updateFeature function,\n        // we return the object in the array and not the array itself\n        const result =\n          response && response.updateResults\n            ? response.updateResults.length > 1\n              ? response.updateResults\n              : response.updateResults[0]\n            : undefined;\n        if (callback) {\n          callback.call(\n            context,\n            error || response.updateResults[0].error,\n            result,\n          );\n        }\n      },\n      context,\n    );\n  },\n\n  deleteFeature(id, callback, context) {\n    this.deleteFeatures(id, callback, context);\n  },\n\n  deleteFeatures(ids, callback, context) {\n    return this.post(\n      \"deleteFeatures\",\n      {\n        objectIds: ids,\n      },\n      (error, response) => {\n        // For compatibility reason with former deleteFeature function,\n        // we return the object in the array and not the array itself\n        const result =\n          response && response.deleteResults\n            ? response.deleteResults.length > 1\n              ? response.deleteResults\n              : response.deleteResults[0]\n            : undefined;\n        if (callback) {\n          callback.call(\n            context,\n            error || response.deleteResults[0].error,\n            result,\n          );\n        }\n      },\n      context,\n    );\n  },\n});\n\nexport function featureLayerService(options) {\n  return new FeatureLayerService(options);\n}\n\nexport default featureLayerService;\n","import { TileLayer, Util } from \"leaflet\";\nimport { pointerEvents } from \"../Support.js\";\nimport {\n  setEsriAttribution,\n  removeEsriAttribution,\n  _getAttributionData,\n  _updateMapAttribution,\n} from \"../Util.js\";\n\nconst tileProtocol = window.location.protocol !== \"https:\" ? \"http:\" : \"https:\";\n\nexport const BasemapLayer = TileLayer.extend({\n  statics: {\n    TILES: {\n      Streets: {\n        urlTemplate: `${tileProtocol}//{s}.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}`,\n        options: {\n          minZoom: 1,\n          maxZoom: 19,\n          subdomains: [\"server\", \"services\"],\n          attribution: \"USGS, NOAA\",\n          attributionUrl:\n            \"https://static.arcgis.com/attribution/World_Street_Map\",\n        },\n      },\n      Topographic: {\n        urlTemplate: `${tileProtocol}//{s}.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}`,\n        options: {\n          minZoom: 1,\n          maxZoom: 19,\n          subdomains: [\"server\", \"services\"],\n          attribution: \"USGS, NOAA\",\n          attributionUrl:\n            \"https://static.arcgis.com/attribution/World_Topo_Map\",\n        },\n      },\n      Oceans: {\n        urlTemplate: `${tileProtocol}//{s}.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Base/MapServer/tile/{z}/{y}/{x}`,\n        options: {\n          minZoom: 1,\n          maxZoom: 16,\n          subdomains: [\"server\", \"services\"],\n          attribution: \"USGS, NOAA\",\n          attributionUrl: \"https://static.arcgis.com/attribution/Ocean_Basemap\",\n        },\n      },\n      OceansLabels: {\n        urlTemplate: `${tileProtocol}//{s}.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Reference/MapServer/tile/{z}/{y}/{x}`,\n        options: {\n          minZoom: 1,\n          maxZoom: 16,\n          subdomains: [\"server\", \"services\"],\n          pane: pointerEvents ? \"esri-labels\" : \"tilePane\",\n          attribution: \"\",\n        },\n      },\n      NationalGeographic: {\n        urlTemplate: `${tileProtocol}//{s}.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}`,\n        options: {\n          minZoom: 1,\n          maxZoom: 16,\n          subdomains: [\"server\", \"services\"],\n          attribution:\n            \"National Geographic, DeLorme, HERE, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, increment P Corp.\",\n        },\n      },\n      DarkGray: {\n        urlTemplate: `${tileProtocol}//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Dark_Gray_Base/MapServer/tile/{z}/{y}/{x}`,\n        options: {\n          minZoom: 1,\n          maxZoom: 16,\n          subdomains: [\"server\", \"services\"],\n          attribution:\n            \"HERE, DeLorme, MapmyIndia, &copy; OpenStreetMap contributors\",\n        },\n      },\n      DarkGrayLabels: {\n        urlTemplate: `${tileProtocol}//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Dark_Gray_Reference/MapServer/tile/{z}/{y}/{x}`,\n        options: {\n          minZoom: 1,\n          maxZoom: 16,\n          subdomains: [\"server\", \"services\"],\n          pane: pointerEvents ? \"esri-labels\" : \"tilePane\",\n          attribution: \"\",\n        },\n      },\n      Gray: {\n        urlTemplate: `${tileProtocol}//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}`,\n        options: {\n          minZoom: 1,\n          maxZoom: 16,\n          subdomains: [\"server\", \"services\"],\n          attribution:\n            \"HERE, DeLorme, MapmyIndia, &copy; OpenStreetMap contributors\",\n        },\n      },\n      GrayLabels: {\n        urlTemplate: `${tileProtocol}//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tile/{z}/{y}/{x}`,\n        options: {\n          minZoom: 1,\n          maxZoom: 16,\n          subdomains: [\"server\", \"services\"],\n          pane: pointerEvents ? \"esri-labels\" : \"tilePane\",\n          attribution: \"\",\n        },\n      },\n      Imagery: {\n        urlTemplate: `${tileProtocol}//{s}.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}`,\n        options: {\n          minZoom: 1,\n          maxZoom: 19,\n          subdomains: [\"server\", \"services\"],\n          attribution:\n            \"DigitalGlobe, GeoEye, i-cubed, USDA, USGS, AEX, Getmapping, Aerogrid, IGN, IGP, swisstopo, and the GIS User Community\",\n          attributionUrl: \"https://static.arcgis.com/attribution/World_Imagery\",\n        },\n      },\n      ImageryLabels: {\n        urlTemplate: `${tileProtocol}//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer/tile/{z}/{y}/{x}`,\n        options: {\n          minZoom: 1,\n          maxZoom: 19,\n          subdomains: [\"server\", \"services\"],\n          pane: pointerEvents ? \"esri-labels\" : \"tilePane\",\n          attribution: \"\",\n        },\n      },\n      ImageryTransportation: {\n        urlTemplate: `${tileProtocol}//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Transportation/MapServer/tile/{z}/{y}/{x}`,\n        options: {\n          minZoom: 1,\n          maxZoom: 19,\n          subdomains: [\"server\", \"services\"],\n          pane: pointerEvents ? \"esri-labels\" : \"tilePane\",\n          attribution: \"\",\n        },\n      },\n      ShadedRelief: {\n        urlTemplate: `${tileProtocol}//{s}.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile/{z}/{y}/{x}`,\n        options: {\n          minZoom: 1,\n          maxZoom: 13,\n          subdomains: [\"server\", \"services\"],\n          attribution: \"USGS\",\n        },\n      },\n      ShadedReliefLabels: {\n        urlTemplate: `${tileProtocol}//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places_Alternate/MapServer/tile/{z}/{y}/{x}`,\n        options: {\n          minZoom: 1,\n          maxZoom: 12,\n          subdomains: [\"server\", \"services\"],\n          pane: pointerEvents ? \"esri-labels\" : \"tilePane\",\n          attribution: \"\",\n        },\n      },\n      Terrain: {\n        urlTemplate: `${tileProtocol}//{s}.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer/tile/{z}/{y}/{x}`,\n        options: {\n          minZoom: 1,\n          maxZoom: 13,\n          subdomains: [\"server\", \"services\"],\n          attribution: \"USGS, NOAA\",\n        },\n      },\n      TerrainLabels: {\n        urlTemplate: `${tileProtocol}//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Reference_Overlay/MapServer/tile/{z}/{y}/{x}`,\n        options: {\n          minZoom: 1,\n          maxZoom: 13,\n          subdomains: [\"server\", \"services\"],\n          pane: pointerEvents ? \"esri-labels\" : \"tilePane\",\n          attribution: \"\",\n        },\n      },\n      USATopo: {\n        urlTemplate: `${tileProtocol}//{s}.arcgisonline.com/ArcGIS/rest/services/USA_Topo_Maps/MapServer/tile/{z}/{y}/{x}`,\n        options: {\n          minZoom: 1,\n          maxZoom: 15,\n          subdomains: [\"server\", \"services\"],\n          attribution: \"USGS, National Geographic Society, i-cubed\",\n        },\n      },\n      ImageryClarity: {\n        urlTemplate: `${tileProtocol}//clarity.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}`,\n        options: {\n          minZoom: 1,\n          maxZoom: 19,\n          attribution:\n            \"Esri, DigitalGlobe, GeoEye, Earthstar Geographics, CNES/Airbus DS, USDA, USGS, AeroGRID, IGN, and the GIS User Community\",\n        },\n      },\n      Physical: {\n        urlTemplate: `${tileProtocol}//{s}.arcgisonline.com/arcgis/rest/services/World_Physical_Map/MapServer/tile/{z}/{y}/{x}`,\n        options: {\n          minZoom: 1,\n          maxZoom: 8,\n          subdomains: [\"server\", \"services\"],\n          attribution: \"U.S. National Park Service\",\n        },\n      },\n      ImageryFirefly: {\n        urlTemplate: `${tileProtocol}//fly.maptiles.arcgis.com/arcgis/rest/services/World_Imagery_Firefly/MapServer/tile/{z}/{y}/{x}`,\n        options: {\n          minZoom: 1,\n          maxZoom: 19,\n          attribution:\n            \"Esri, DigitalGlobe, GeoEye, Earthstar Geographics, CNES/Airbus DS, USDA, USGS, AeroGRID, IGN, and the GIS User Community\",\n          attributionUrl: \"https://static.arcgis.com/attribution/World_Imagery\",\n        },\n      },\n    },\n  },\n\n  initialize(key, options) {\n    let config;\n\n    // set the config variable with the appropriate config object\n    if (typeof key === \"object\" && key.urlTemplate && key.options) {\n      config = key;\n    } else if (typeof key === \"string\" && BasemapLayer.TILES[key]) {\n      config = BasemapLayer.TILES[key];\n    } else {\n      throw new Error(\n        'L.esri.BasemapLayer: Invalid parameter. Use one of \"Streets\", \"Topographic\", \"Oceans\", \"OceansLabels\", \"NationalGeographic\", \"Physical\", \"Gray\", \"GrayLabels\", \"DarkGray\", \"DarkGrayLabels\", \"Imagery\", \"ImageryLabels\", \"ImageryTransportation\", \"ImageryClarity\", \"ImageryFirefly\", ShadedRelief\", \"ShadedReliefLabels\", \"Terrain\", \"TerrainLabels\" or \"USATopo\"',\n      );\n    }\n\n    // merge passed options into the config options\n    const tileOptions = Util.extend(config.options, options);\n\n    Util.setOptions(this, tileOptions);\n\n    // Deprecation notice:\n    if (!this.options.ignoreDeprecationWarning) {\n      console.warn(\n        \"WARNING: L.esri.BasemapLayer uses data services that are in mature support and are not being updated. Please use L.esri.Vector.vectorBasemapLayer instead. More info: https://esriurl.com/esri-leaflet-basemap\",\n      );\n    }\n\n    if (this.options.token && config.urlTemplate.indexOf(\"token=\") === -1) {\n      config.urlTemplate += `?token=${this.options.token}`;\n    }\n    if (this.options.proxy) {\n      config.urlTemplate = `${this.options.proxy}?${config.urlTemplate}`;\n    }\n\n    // call the initialize method on L.TileLayer to set everything up\n    TileLayer.prototype.initialize.call(this, config.urlTemplate, tileOptions);\n  },\n\n  onAdd(map) {\n    // include 'Powered by Esri' in map attribution\n    setEsriAttribution(map);\n\n    if (this.options.pane === \"esri-labels\") {\n      this._initPane();\n    }\n    // some basemaps can supply dynamic attribution\n    if (this.options.attributionUrl) {\n      _getAttributionData(\n        (this.options.proxy ? `${this.options.proxy}?` : \"\") +\n          this.options.attributionUrl,\n        map,\n      );\n    }\n\n    map.on(\"moveend\", _updateMapAttribution);\n\n    TileLayer.prototype.onAdd.call(this, map);\n  },\n\n  onRemove(map) {\n    removeEsriAttribution(map);\n\n    map.off(\"moveend\", _updateMapAttribution);\n\n    TileLayer.prototype.onRemove.call(this, map);\n  },\n\n  _initPane() {\n    if (!this._map.getPane(this.options.pane)) {\n      const pane = this._map.createPane(this.options.pane);\n      pane.style.pointerEvents = \"none\";\n      pane.style.zIndex = 500;\n    }\n  },\n\n  getAttribution() {\n    let attribution;\n    if (this.options.attribution) {\n      attribution = `<span class=\"esri-dynamic-attribution\">${this.options.attribution}</span>`;\n    }\n    return attribution;\n  },\n});\n\nexport function basemapLayer(key, options) {\n  return new BasemapLayer(key, options);\n}\n\nexport default basemapLayer;\n","import { CRS, DomEvent, TileLayer, Util } from \"leaflet\";\nimport {\n  warn,\n  getUrlParams,\n  setEsriAttribution,\n  removeEsriAttribution,\n} from \"../Util.js\";\nimport mapService from \"../Services/MapService.js\";\n\nexport const TiledMapLayer = TileLayer.extend({\n  options: {\n    zoomOffsetAllowance: 0.1,\n    errorTileUrl:\n      \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEABAMAAACuXLVVAAAAA1BMVEUzNDVszlHHAAAAAXRSTlMAQObYZgAAAAlwSFlzAAAAAAAAAAAB6mUWpAAAADZJREFUeJztwQEBAAAAgiD/r25IQAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA7waBAAABw08RwAAAAABJRU5ErkJggg==\",\n  },\n\n  statics: {\n    MercatorZoomLevels: {\n      0: 156543.03392799999,\n      1: 78271.516963999893,\n      2: 39135.758482000099,\n      3: 19567.879240999901,\n      4: 9783.9396204999593,\n      5: 4891.9698102499797,\n      6: 2445.9849051249898,\n      7: 1222.9924525624899,\n      8: 611.49622628138002,\n      9: 305.74811314055802,\n      10: 152.874056570411,\n      11: 76.437028285073197,\n      12: 38.218514142536598,\n      13: 19.109257071268299,\n      14: 9.5546285356341496,\n      15: 4.7773142679493699,\n      16: 2.38865713397468,\n      17: 1.1943285668550501,\n      18: 0.59716428355981699,\n      19: 0.29858214164761698,\n      20: 0.14929107082381,\n      21: 0.07464553541191,\n      22: 0.0373227677059525,\n      23: 0.0186613838529763,\n    },\n  },\n\n  initialize(options) {\n    options = Util.setOptions(this, options);\n\n    // support apikey property being passed in\n    if (options.apikey) {\n      options.token = options.apikey;\n    }\n\n    // set the urls\n    options = getUrlParams(options);\n    this.tileUrl = `${(options.proxy ? `${options.proxy}?` : \"\") + options.url}tile/{z}/{y}/{x}${options.requestParams && Object.keys(options.requestParams).length > 0 ? Util.getParamString(options.requestParams) : \"\"}`;\n    // Remove subdomain in url\n    // https://github.com/Esri/esri-leaflet/issues/991\n    if (options.url.indexOf(\"{s}\") !== -1 && options.subdomains) {\n      options.url = options.url.replace(\"{s}\", options.subdomains[0]);\n    }\n    this.service = mapService(options);\n    this.service.addEventParent(this);\n\n    const arcgisonline = new RegExp(/tiles.arcgis(online)?\\.com/g);\n    if (arcgisonline.test(options.url)) {\n      this.tileUrl = this.tileUrl.replace(\"://tiles\", \"://tiles{s}\");\n      options.subdomains = [\"1\", \"2\", \"3\", \"4\"];\n    }\n\n    if (this.options.token) {\n      this.tileUrl += `?token=${this.options.token}`;\n    }\n\n    // init layer by calling TileLayers initialize method\n    TileLayer.prototype.initialize.call(this, this.tileUrl, options);\n  },\n\n  getTileUrl(tilePoint) {\n    const zoom = this._getZoomForUrl();\n\n    return Util.template(\n      this.tileUrl,\n      Util.extend(\n        {\n          s: this._getSubdomain(tilePoint),\n          x: tilePoint.x,\n          y: tilePoint.y,\n          // try lod map first, then just default to zoom level\n          z:\n            this._lodMap && this._lodMap[zoom] !== undefined\n              ? this._lodMap[zoom]\n              : zoom,\n        },\n        this.options,\n      ),\n    );\n  },\n\n  createTile(coords, done) {\n    const tile = document.createElement(\"img\");\n\n    DomEvent.on(tile, \"load\", Util.bind(this._tileOnLoad, this, done, tile));\n    DomEvent.on(tile, \"error\", Util.bind(this._tileOnError, this, done, tile));\n\n    if (this.options.crossOrigin) {\n      tile.crossOrigin = \"\";\n    }\n\n    /*\n     Alt tag is set to empty string to keep screen readers from reading URL and for compliance reasons\n     http://www.w3.org/TR/WCAG20-TECHS/H67\n    */\n    tile.alt = \"\";\n\n    // if this is a map with a custom CRS or an lod map with a proper zoom load the tile\n    // otherwise wait for the lod map to become available\n    if (\n      this._lodMap === \"crs\" ||\n      (this._lodMap && this._lodMap[this._getZoomForUrl()] !== undefined)\n    ) {\n      tile.src = this.getTileUrl(coords);\n    } else {\n      this.once(\n        \"lodmap\",\n        function () {\n          tile.src = this.getTileUrl(coords);\n        },\n        this,\n      );\n    }\n\n    return tile;\n  },\n\n  onAdd(map) {\n    // include 'Powered by Esri' in map attribution\n    setEsriAttribution(map);\n\n    if (!this._lodMap) {\n      this.metadata(function (error, metadata) {\n        if (!error && metadata.spatialReference) {\n          const sr =\n            metadata.spatialReference.latestWkid ||\n            metadata.spatialReference.wkid;\n          // display the copyright text from the service using leaflet's attribution control\n          if (\n            !this.options.attribution &&\n            map.attributionControl &&\n            metadata.copyrightText\n          ) {\n            this.options.attribution = metadata.copyrightText;\n            map.attributionControl.addAttribution(this.getAttribution());\n          }\n\n          // if the service tiles were published in web mercator using conventional LODs but missing levels, we can try and remap them\n          if (\n            map.options.crs === CRS.EPSG3857 &&\n            (sr === 102100 || sr === 3857)\n          ) {\n            this._lodMap = {};\n            // create the zoom level data\n            const arcgisLODs = metadata.tileInfo.lods;\n            const correctResolutions = TiledMapLayer.MercatorZoomLevels;\n\n            for (let i = 0; i < arcgisLODs.length; i++) {\n              const arcgisLOD = arcgisLODs[i];\n              for (const ci in correctResolutions) {\n                const correctRes = correctResolutions[ci];\n\n                if (\n                  this._withinPercentage(\n                    arcgisLOD.resolution,\n                    correctRes,\n                    this.options.zoomOffsetAllowance,\n                  )\n                ) {\n                  this._lodMap[ci] = arcgisLOD.level;\n                  break;\n                }\n              }\n            }\n\n            this.fire(\"lodmap\");\n          } else if (\n            map.options.crs &&\n            map.options.crs.code &&\n            map.options.crs.code.indexOf(sr) > -1\n          ) {\n            // if the projection is WGS84, or the developer is using Proj4 to define a custom CRS, no action is required\n            this._lodMap = \"crs\";\n            this.fire(\"lodmap\");\n          } else {\n            // if the service was cached in a custom projection and an appropriate LOD hasn't been defined in the map, guide the developer to our Proj4 sample\n            warn(\n              \"L.esri.TiledMapLayer is using a non-mercator spatial reference. Support may be available through Proj4Leaflet https://developers.arcgis.com/esri-leaflet/samples/non-mercator-projection/\",\n            );\n          }\n        }\n      }, this);\n    }\n\n    TileLayer.prototype.onAdd.call(this, map);\n  },\n\n  onRemove(map) {\n    removeEsriAttribution(map);\n\n    TileLayer.prototype.onRemove.call(this, map);\n  },\n\n  metadata(callback, context) {\n    this.service.metadata(callback, context);\n    return this;\n  },\n\n  identify() {\n    return this.service.identify();\n  },\n\n  find() {\n    return this.service.find();\n  },\n\n  query() {\n    return this.service.query();\n  },\n\n  authenticate(token) {\n    const tokenQs = `?token=${token}`;\n    this.tileUrl = this.options.token\n      ? this.tileUrl.replace(/\\?token=(.+)/g, tokenQs)\n      : this.tileUrl + tokenQs;\n    this.options.token = token;\n    this.service.authenticate(token);\n    return this;\n  },\n\n  _withinPercentage(a, b, percentage) {\n    const diff = Math.abs(a / b - 1);\n    return diff < percentage;\n  },\n});\n\nexport function tiledMapLayer(url, options) {\n  return new TiledMapLayer(url, options);\n}\n\nexport default tiledMapLayer;\n","import {\n  ImageOverlay,\n  CRS,\n  DomUtil,\n  Util,\n  Layer,\n  popup,\n  latLng,\n  bounds,\n} from \"leaflet\";\nimport { cors } from \"../Support.js\";\nimport { setEsriAttribution, removeEsriAttribution } from \"../Util.js\";\n\nconst Overlay = ImageOverlay.extend({\n  onAdd(map) {\n    this._topLeft = map.getPixelBounds().min;\n    ImageOverlay.prototype.onAdd.call(this, map);\n  },\n  _reset() {\n    if (this._map.options.crs === CRS.EPSG3857) {\n      ImageOverlay.prototype._reset.call(this);\n    } else {\n      DomUtil.setPosition(\n        this._image,\n        this._topLeft.subtract(this._map.getPixelOrigin()),\n      );\n    }\n  },\n});\n\nexport const RasterLayer = Layer.extend({\n  options: {\n    opacity: 1,\n    position: \"front\",\n    f: \"image\",\n    useCors: cors,\n    attribution: null,\n    interactive: false,\n    alt: \"\",\n  },\n\n  onAdd(map) {\n    // include 'Powered by Esri' in map attribution\n    setEsriAttribution(map);\n\n    if (this.options.zIndex) {\n      this.options.position = null;\n    }\n\n    this._update = Util.throttle(\n      this._update,\n      this.options.updateInterval,\n      this,\n    );\n\n    map.on(\"moveend\", this._update, this);\n\n    // if we had an image loaded and it matches the\n    // current bounds show the image otherwise remove it\n    if (\n      this._currentImage &&\n      this._currentImage._bounds.equals(this._map.getBounds())\n    ) {\n      map.addLayer(this._currentImage);\n    } else if (this._currentImage) {\n      this._map.removeLayer(this._currentImage);\n      this._currentImage = null;\n    }\n\n    this._update();\n\n    if (this._popup) {\n      this._map.on(\"click\", this._getPopupData, this);\n      this._map.on(\"dblclick\", this._resetPopupState, this);\n    }\n\n    // add copyright text listed in service metadata\n    this.metadata(function (err, metadata) {\n      if (\n        !err &&\n        !this.options.attribution &&\n        map.attributionControl &&\n        metadata.copyrightText\n      ) {\n        this.options.attribution = metadata.copyrightText;\n        map.attributionControl.addAttribution(this.getAttribution());\n      }\n    }, this);\n  },\n\n  onRemove(map) {\n    removeEsriAttribution(map);\n\n    if (this._currentImage) {\n      this._map.removeLayer(this._currentImage);\n    }\n\n    if (this._popup) {\n      this._map.off(\"click\", this._getPopupData, this);\n      this._map.off(\"dblclick\", this._resetPopupState, this);\n    }\n\n    this._map.off(\"moveend\", this._update, this);\n  },\n\n  bindPopup(fn, popupOptions) {\n    this._shouldRenderPopup = false;\n    this._lastClick = false;\n    this._popup = popup(popupOptions);\n    this._popupFunction = fn;\n    if (this._map) {\n      this._map.on(\"click\", this._getPopupData, this);\n      this._map.on(\"dblclick\", this._resetPopupState, this);\n    }\n    return this;\n  },\n\n  unbindPopup() {\n    if (this._map) {\n      this._map.closePopup(this._popup);\n      this._map.off(\"click\", this._getPopupData, this);\n      this._map.off(\"dblclick\", this._resetPopupState, this);\n    }\n    this._popup = false;\n    return this;\n  },\n\n  bringToFront() {\n    this.options.position = \"front\";\n    if (this._currentImage) {\n      this._currentImage.bringToFront();\n      this._setAutoZIndex(Math.max);\n    }\n    return this;\n  },\n\n  bringToBack() {\n    this.options.position = \"back\";\n    if (this._currentImage) {\n      this._currentImage.bringToBack();\n      this._setAutoZIndex(Math.min);\n    }\n    return this;\n  },\n\n  setZIndex(value) {\n    this.options.zIndex = value;\n    if (this._currentImage) {\n      this._currentImage.setZIndex(value);\n    }\n    return this;\n  },\n\n  _setAutoZIndex(compare) {\n    // go through all other layers of the same pane, set zIndex to max + 1 (front) or min - 1 (back)\n    if (!this._currentImage) {\n      return;\n    }\n    const layers = this._currentImage.getPane().children;\n    let edgeZIndex = -compare(-Infinity, Infinity); // -Infinity for max, Infinity for min\n    for (let i = 0, len = layers.length, zIndex; i < len; i++) {\n      zIndex = layers[i].style.zIndex;\n      if (layers[i] !== this._currentImage._image && zIndex) {\n        edgeZIndex = compare(edgeZIndex, +zIndex);\n      }\n    }\n\n    if (isFinite(edgeZIndex)) {\n      this.options.zIndex = edgeZIndex + compare(-1, 1);\n      this.setZIndex(this.options.zIndex);\n    }\n  },\n\n  getAttribution() {\n    return this.options.attribution;\n  },\n\n  getOpacity() {\n    return this.options.opacity;\n  },\n\n  setOpacity(opacity) {\n    this.options.opacity = opacity;\n    if (this._currentImage) {\n      this._currentImage.setOpacity(opacity);\n    }\n    return this;\n  },\n\n  getTimeRange() {\n    return [this.options.from, this.options.to];\n  },\n\n  setTimeRange(from, to) {\n    this.options.from = from;\n    this.options.to = to;\n    this._update();\n    return this;\n  },\n\n  metadata(callback, context) {\n    this.service.metadata(callback, context);\n    return this;\n  },\n\n  authenticate(token) {\n    this.service.authenticate(token);\n    return this;\n  },\n\n  redraw() {\n    this._update();\n  },\n\n  _renderImage(url, bounds, contentType) {\n    if (this._map) {\n      // if no output directory has been specified for a service, MIME data will be returned\n      if (contentType) {\n        url = `data:${contentType};base64,${url}`;\n      }\n\n      // if server returns an inappropriate response, abort.\n      if (!url) {\n        return;\n      }\n\n      // create a new image overlay and add it to the map\n      // to start loading the image\n      // opacity is 0 while the image is loading\n      const image = new Overlay(url, bounds, {\n        opacity: 0,\n        crossOrigin: this.options.withCredentials\n          ? \"use-credentials\"\n          : this.options.useCors,\n        alt: this.options.alt,\n        pane: this.options.pane || this.getPane(),\n        interactive: this.options.interactive,\n      }).addTo(this._map);\n\n      // eslint-disable-next-line prefer-const\n      let onOverlayLoad;\n\n      const onOverlayError = function () {\n        this._map.removeLayer(image);\n        this.fire(\"error\");\n        image.off(\"load\", onOverlayLoad, this);\n      };\n\n      onOverlayLoad = function (e) {\n        image.off(\"error\", onOverlayError, this);\n        if (this._map) {\n          const newImage = e.target;\n          const oldImage = this._currentImage;\n\n          // if the bounds of this image matches the bounds that\n          // _renderImage was called with and we have a map with the same bounds\n          // hide the old image if there is one and set the opacity\n          // of the new image otherwise remove the new image\n          if (\n            newImage._bounds.equals(bounds) &&\n            newImage._bounds.equals(this._map.getBounds())\n          ) {\n            this._currentImage = newImage;\n\n            if (this.options.position === \"front\") {\n              this.bringToFront();\n            } else if (this.options.position === \"back\") {\n              this.bringToBack();\n            }\n\n            if (this.options.zIndex) {\n              this.setZIndex(this.options.zIndex);\n            }\n\n            if (this._map && this._currentImage._map) {\n              this._currentImage.setOpacity(this.options.opacity);\n            } else {\n              this._currentImage._map.removeLayer(this._currentImage);\n            }\n\n            if (oldImage && this._map) {\n              this._map.removeLayer(oldImage);\n            }\n\n            if (oldImage && oldImage._map) {\n              oldImage._map.removeLayer(oldImage);\n            }\n          } else {\n            this._map.removeLayer(newImage);\n          }\n        }\n\n        this.fire(\"load\", {\n          bounds,\n        });\n      };\n\n      // If loading the image fails\n      image.once(\"error\", onOverlayError, this);\n\n      // once the image loads\n      image.once(\"load\", onOverlayLoad, this);\n    }\n  },\n\n  _update() {\n    if (!this._map) {\n      return;\n    }\n\n    const zoom = this._map.getZoom();\n    const bounds = this._map.getBounds();\n\n    if (this._animatingZoom) {\n      return;\n    }\n\n    if (this._map._panTransition && this._map._panTransition._inProgress) {\n      return;\n    }\n\n    if (zoom > this.options.maxZoom || zoom < this.options.minZoom) {\n      if (this._currentImage) {\n        this._currentImage._map.removeLayer(this._currentImage);\n        this._currentImage = null;\n      }\n      return;\n    }\n\n    const params = this._buildExportParams();\n    Util.extend(params, this.options.requestParams);\n\n    if (params) {\n      this._requestExport(params, bounds);\n\n      this.fire(\"loading\", {\n        bounds,\n      });\n    } else if (this._currentImage) {\n      this._currentImage._map.removeLayer(this._currentImage);\n      this._currentImage = null;\n    }\n  },\n\n  _renderPopup(latlng, error, results, response) {\n    latlng = latLng(latlng);\n    if (this._shouldRenderPopup && this._lastClick.equals(latlng)) {\n      // add the popup to the map where the mouse was clicked at\n      const content = this._popupFunction(error, results, response);\n      if (content) {\n        this._popup.setLatLng(latlng).setContent(content).openOn(this._map);\n      }\n    }\n  },\n\n  _resetPopupState(e) {\n    this._shouldRenderPopup = false;\n    this._lastClick = e.latlng;\n  },\n\n  _calculateBbox() {\n    const pixelBounds = this._map.getPixelBounds();\n\n    const sw = this._map.unproject(pixelBounds.getBottomLeft());\n    const ne = this._map.unproject(pixelBounds.getTopRight());\n\n    const neProjected = this._map.options.crs.project(ne);\n    const swProjected = this._map.options.crs.project(sw);\n\n    // this ensures ne/sw are switched in polar maps where north/top bottom/south is inverted\n    const boundsProjected = bounds(neProjected, swProjected);\n\n    return [\n      boundsProjected.getBottomLeft().x,\n      boundsProjected.getBottomLeft().y,\n      boundsProjected.getTopRight().x,\n      boundsProjected.getTopRight().y,\n    ].join(\",\");\n  },\n\n  _calculateImageSize() {\n    // ensure that we don't ask ArcGIS Server for a taller image than we have actual map displaying within the div\n    const bounds = this._map.getPixelBounds();\n    const size = this._map.getSize();\n\n    const sw = this._map.unproject(bounds.getBottomLeft());\n    const ne = this._map.unproject(bounds.getTopRight());\n\n    const top = this._map.latLngToLayerPoint(ne).y;\n    const bottom = this._map.latLngToLayerPoint(sw).y;\n\n    if (top > 0 || bottom < size.y) {\n      size.y = bottom - top;\n    }\n\n    return `${size.x},${size.y}`;\n  },\n});\n","import { Util } from \"leaflet\";\nimport { RasterLayer } from \"./RasterLayer.js\";\nimport { getUrlParams } from \"../Util.js\";\nimport imageService from \"../Services/ImageService.js\";\n\nexport const ImageMapLayer = RasterLayer.extend({\n  options: {\n    updateInterval: 150,\n    format: \"jpgpng\",\n    transparent: true,\n    f: \"image\",\n  },\n\n  query() {\n    return this.service.query();\n  },\n\n  identify() {\n    return this.service.identify();\n  },\n\n  initialize(options) {\n    options = getUrlParams(options);\n    this.service = imageService(options);\n    this.service.addEventParent(this);\n\n    Util.setOptions(this, options);\n  },\n\n  setPixelType(pixelType) {\n    this.options.pixelType = pixelType;\n    this._update();\n    return this;\n  },\n\n  getPixelType() {\n    return this.options.pixelType;\n  },\n\n  setBandIds(bandIds) {\n    if (Util.isArray(bandIds)) {\n      this.options.bandIds = bandIds.join(\",\");\n    } else {\n      this.options.bandIds = bandIds.toString();\n    }\n    this._update();\n    return this;\n  },\n\n  getBandIds() {\n    return this.options.bandIds;\n  },\n\n  setNoData(noData, noDataInterpretation) {\n    if (Util.isArray(noData)) {\n      this.options.noData = noData.join(\",\");\n    } else {\n      this.options.noData = noData.toString();\n    }\n    if (noDataInterpretation) {\n      this.options.noDataInterpretation = noDataInterpretation;\n    }\n    this._update();\n    return this;\n  },\n\n  getNoData() {\n    return this.options.noData;\n  },\n\n  getNoDataInterpretation() {\n    return this.options.noDataInterpretation;\n  },\n\n  setRenderingRule(renderingRule) {\n    this.options.renderingRule = renderingRule;\n    this._update();\n  },\n\n  getRenderingRule() {\n    return this.options.renderingRule;\n  },\n\n  setMosaicRule(mosaicRule) {\n    this.options.mosaicRule = mosaicRule;\n    this._update();\n  },\n\n  getMosaicRule() {\n    return this.options.mosaicRule;\n  },\n\n  _getPopupData(e) {\n    const callback = Util.bind(function (error, results, response) {\n      if (error) {\n        return;\n      } // we really can't do anything here but authenticate or requesterror will fire\n      setTimeout(\n        Util.bind(function () {\n          this._renderPopup(e.latlng, error, results, response);\n        }, this),\n        300,\n      );\n    }, this);\n\n    const identifyRequest = this.identify().at(e.latlng);\n\n    // set mosaic rule for identify task if it is set for layer\n    if (this.options.mosaicRule) {\n      identifyRequest.setMosaicRule(this.options.mosaicRule);\n      // @TODO: force return catalog items too?\n    }\n\n    // @TODO: set rendering rule? Not sure,\n    // sometimes you want raw pixel values\n    // if (this.options.renderingRule) {\n    //   identifyRequest.setRenderingRule(this.options.renderingRule);\n    // }\n\n    identifyRequest.run(callback);\n\n    // set the flags to show the popup\n    this._shouldRenderPopup = true;\n    this._lastClick = e.latlng;\n  },\n\n  _buildExportParams() {\n    const sr = parseInt(this._map.options.crs.code.split(\":\")[1], 10);\n\n    const params = {\n      bbox: this._calculateBbox(),\n      size: this._calculateImageSize(),\n      format: this.options.format,\n      transparent: this.options.transparent,\n      bboxSR: sr,\n      imageSR: sr,\n    };\n\n    if (this.options.from && this.options.to) {\n      params.time = `${this.options.from.valueOf()},${this.options.to.valueOf()}`;\n    }\n\n    if (this.options.pixelType) {\n      params.pixelType = this.options.pixelType;\n    }\n\n    if (this.options.interpolation) {\n      params.interpolation = this.options.interpolation;\n    }\n\n    if (this.options.compressionQuality) {\n      params.compressionQuality = this.options.compressionQuality;\n    }\n\n    if (this.options.bandIds) {\n      params.bandIds = this.options.bandIds;\n    }\n\n    // 0 is falsy *and* a valid input parameter\n    if (this.options.noData === 0 || this.options.noData) {\n      params.noData = this.options.noData;\n    }\n\n    if (this.options.noDataInterpretation) {\n      params.noDataInterpretation = this.options.noDataInterpretation;\n    }\n\n    if (this.service.options.token) {\n      params.token = this.service.options.token;\n    }\n\n    if (this.options.renderingRule) {\n      params.renderingRule = JSON.stringify(this.options.renderingRule);\n    }\n\n    if (this.options.mosaicRule) {\n      params.mosaicRule = JSON.stringify(this.options.mosaicRule);\n    }\n\n    return params;\n  },\n\n  _requestExport(params, bounds) {\n    if (this.options.f === \"json\") {\n      this.service.request(\n        \"exportImage\",\n        params,\n        function (error, response) {\n          if (error) {\n            return;\n          } // we really can't do anything here but authenticate or requesterror will fire\n          if (this.options.token) {\n            response.href += `?token=${this.options.token}`;\n          }\n          if (this.options.proxy) {\n            response.href = `${this.options.proxy}?${response.href}`;\n          }\n          this._renderImage(response.href, bounds);\n        },\n        this,\n      );\n    } else {\n      params.f = \"image\";\n      let fullUrl = `${this.options.url}exportImage${Util.getParamString(params)}`;\n      if (this.options.proxy) {\n        fullUrl = `${this.options.proxy}?${fullUrl}`;\n      }\n      this._renderImage(fullUrl, bounds);\n    }\n  },\n});\n\nexport function imageMapLayer(url, options) {\n  return new ImageMapLayer(url, options);\n}\n\nexport default imageMapLayer;\n","import { Util } from \"leaflet\";\nimport { RasterLayer } from \"./RasterLayer.js\";\nimport { getUrlParams } from \"../Util.js\";\nimport mapService from \"../Services/MapService.js\";\n\nexport const DynamicMapLayer = RasterLayer.extend({\n  options: {\n    updateInterval: 150,\n    layers: false,\n    layerDefs: false,\n    timeOptions: false,\n    format: \"png32\",\n    transparent: true,\n    f: \"json\",\n  },\n\n  initialize(options) {\n    options = getUrlParams(options);\n    this.service = mapService(options);\n    this.service.addEventParent(this);\n\n    Util.setOptions(this, options);\n  },\n\n  getDynamicLayers() {\n    return this.options.dynamicLayers;\n  },\n\n  setDynamicLayers(dynamicLayers) {\n    this.options.dynamicLayers = dynamicLayers;\n    this._update();\n    return this;\n  },\n\n  getLayers() {\n    return this.options.layers;\n  },\n\n  setLayers(layers) {\n    this.options.layers = layers;\n    this._update();\n    return this;\n  },\n\n  getLayerDefs() {\n    return this.options.layerDefs;\n  },\n\n  setLayerDefs(layerDefs) {\n    this.options.layerDefs = layerDefs;\n    this._update();\n    return this;\n  },\n\n  getTimeOptions() {\n    return this.options.timeOptions;\n  },\n\n  setTimeOptions(timeOptions) {\n    this.options.timeOptions = timeOptions;\n    this._update();\n    return this;\n  },\n\n  query() {\n    return this.service.query();\n  },\n\n  identify() {\n    return this.service.identify();\n  },\n\n  find() {\n    return this.service.find();\n  },\n\n  _getPopupData(e) {\n    const callback = Util.bind(function (error, featureCollection, response) {\n      if (error) {\n        return;\n      } // we really can't do anything here but authenticate or requesterror will fire\n      setTimeout(\n        Util.bind(function () {\n          this._renderPopup(e.latlng, error, featureCollection, response);\n        }, this),\n        300,\n      );\n    }, this);\n\n    let identifyRequest;\n    if (this.options.popup) {\n      identifyRequest = this.options.popup.on(this._map).at(e.latlng);\n    } else {\n      identifyRequest = this.identify().on(this._map).at(e.latlng);\n    }\n\n    // remove extraneous vertices from response features if it has not already been done\n    if (!identifyRequest.params.maxAllowableOffset) {\n      identifyRequest.simplify(this._map, 0.5);\n    }\n\n    if (\n      !(\n        this.options.popup &&\n        this.options.popup.params &&\n        this.options.popup.params.layers\n      )\n    ) {\n      if (this.options.layers) {\n        identifyRequest.layers(`visible:${this.options.layers.join(\",\")}`);\n      } else {\n        identifyRequest.layers(\"visible\");\n      }\n    }\n\n    // if present, pass layer ids and sql filters through to the identify task\n    if (\n      this.options.layerDefs &&\n      typeof this.options.layerDefs !== \"string\" &&\n      !identifyRequest.params.layerDefs\n    ) {\n      for (const id in this.options.layerDefs) {\n        if (Object.hasOwn(this.options.layerDefs, id)) {\n          identifyRequest.layerDef(id, this.options.layerDefs[id]);\n        }\n      }\n    }\n\n    identifyRequest.run(callback);\n\n    // set the flags to show the popup\n    this._shouldRenderPopup = true;\n    this._lastClick = e.latlng;\n  },\n\n  _buildExportParams() {\n    const sr = parseInt(this._map.options.crs.code.split(\":\")[1], 10);\n\n    const params = {\n      bbox: this._calculateBbox(),\n      size: this._calculateImageSize(),\n      dpi: 96,\n      format: this.options.format,\n      transparent: this.options.transparent,\n      bboxSR: sr,\n      imageSR: sr,\n    };\n\n    if (this.options.dynamicLayers) {\n      params.dynamicLayers = this.options.dynamicLayers;\n    }\n\n    if (this.options.layers) {\n      if (this.options.layers.length === 0) {\n        return;\n      }\n      params.layers = `show:${this.options.layers.join(\",\")}`;\n    }\n\n    if (this.options.layerDefs) {\n      params.layerDefs =\n        typeof this.options.layerDefs === \"string\"\n          ? this.options.layerDefs\n          : JSON.stringify(this.options.layerDefs);\n    }\n\n    if (this.options.timeOptions) {\n      params.timeOptions = JSON.stringify(this.options.timeOptions);\n    }\n\n    if (this.options.from && this.options.to) {\n      params.time = `${this.options.from.valueOf()},${this.options.to.valueOf()}`;\n    }\n\n    if (this.service.options.token) {\n      params.token = this.service.options.token;\n    }\n\n    if (this.options.proxy) {\n      params.proxy = this.options.proxy;\n    }\n\n    // use a timestamp to bust server cache\n    if (this.options.disableCache) {\n      params._ts = Date.now();\n    }\n\n    return params;\n  },\n\n  _requestExport(params, bounds) {\n    if (this.options.f === \"json\") {\n      this.service.request(\n        \"export\",\n        params,\n        function (error, response) {\n          if (error) {\n            return;\n          } // we really can't do anything here but authenticate or requesterror will fire\n\n          if (this.options.token && response.href) {\n            response.href += `?token=${this.options.token}`;\n          }\n          if (this.options.proxy && response.href) {\n            response.href = `${this.options.proxy}?${response.href}`;\n          }\n          if (response.href) {\n            this._renderImage(response.href, bounds);\n          } else {\n            this._renderImage(response.imageData, bounds, response.contentType);\n          }\n        },\n        this,\n      );\n    } else {\n      params.f = \"image\";\n      let fullUrl = `${this.options.url}export${Util.getParamString(params)}`;\n      if (this.options.proxy) {\n        fullUrl = `${this.options.proxy}?${fullUrl}`;\n      }\n      this._renderImage(fullUrl, bounds);\n    }\n  },\n});\n\nexport function dynamicMapLayer(url, options) {\n  return new DynamicMapLayer(url, options);\n}\n\nexport default dynamicMapLayer;\n","import {\n  LatLngBounds,\n  latLngBounds,\n  Layer,\n  Browser,\n  Util,\n  Point,\n  Bounds,\n} from \"leaflet\";\n\nexport const FeatureGrid = Layer.extend({\n  // @section\n  // @aka GridLayer options\n  options: {\n    // @option cellSize: Number|Point = 256\n    // Width and height of cells in the grid. Use a number if width and height are equal, or `L.point(width, height)` otherwise.\n    cellSize: 512,\n\n    // @option updateWhenIdle: Boolean = (depends)\n    // Load new cells only when panning ends.\n    // `true` by default on mobile browsers, in order to avoid too many requests and keep smooth navigation.\n    // `false` otherwise in order to display new cells _during_ panning, since it is easy to pan outside the\n    // [`keepBuffer`](#gridlayer-keepbuffer) option in desktop browsers.\n    updateWhenIdle: Browser.mobile,\n\n    // @option updateInterval: Number = 150\n    // Cells will not update more than once every `updateInterval` milliseconds when panning.\n    updateInterval: 150,\n\n    // @option noWrap: Boolean = false\n    // Whether the layer is wrapped around the antimeridian. If `true`, the\n    // GridLayer will only be displayed once at low zoom levels. Has no\n    // effect when the [map CRS](#map-crs) doesn't wrap around. Can be used\n    // in combination with [`bounds`](#gridlayer-bounds) to prevent requesting\n    // cells outside the CRS limits.\n    noWrap: false,\n\n    // @option keepBuffer: Number = 1.5\n    // When panning the map, keep this many rows and columns of cells before unloading them.\n    keepBuffer: 1.5,\n  },\n\n  initialize(options) {\n    Util.setOptions(this, options);\n  },\n\n  onAdd() {\n    this._cells = {};\n    this._activeCells = {};\n    this._resetView();\n    this._update();\n  },\n\n  onRemove() {\n    this._removeAllCells();\n    this._cellZoom = undefined;\n  },\n\n  // @method isLoading: Boolean\n  // Returns `true` if any cell in the grid layer has not finished loading.\n  isLoading() {\n    return this._loading;\n  },\n\n  // @method redraw: this\n  // Causes the layer to clear all the cells and request them again.\n  redraw() {\n    if (this._map) {\n      this._removeAllCells();\n      this._update();\n    }\n    return this;\n  },\n\n  getEvents() {\n    const events = {\n      viewprereset: this._invalidateAll,\n      viewreset: this._resetView,\n      zoom: this._resetView,\n      moveend: this._onMoveEnd,\n    };\n\n    if (!this.options.updateWhenIdle) {\n      // update cells on move, but not more often than once per given interval\n      if (!this._onMove) {\n        this._onMove = Util.throttle(\n          this._onMoveEnd,\n          this.options.updateInterval,\n          this,\n        );\n      }\n\n      events.move = this._onMove;\n    }\n\n    return events;\n  },\n\n  // @section Extension methods\n  // Layers extending `GridLayer` shall reimplement the following method.\n  // @method createCell(coords: Object, done?: Function): HTMLElement\n  // Called only internally, must be overridden by classes extending `GridLayer`.\n  // Returns the `HTMLElement` corresponding to the given `coords`. If the `done` callback\n  // is specified, it must be called when the cell has finished loading and drawing.\n  createCell() {\n    return document.createElement(\"div\");\n  },\n\n  removeCell() {},\n\n  reuseCell() {},\n\n  cellLeave() {},\n\n  cellEnter() {},\n  // @section\n  // @method getCellSize: Point\n  // Normalizes the [cellSize option](#gridlayer-cellsize) into a point. Used by the `createCell()` method.\n  getCellSize() {\n    const s = this.options.cellSize;\n    return s instanceof Point ? s : new Point(s, s);\n  },\n\n  _pruneCells() {\n    if (!this._map) {\n      return;\n    }\n\n    let key, cell;\n\n    for (key in this._cells) {\n      cell = this._cells[key];\n      cell.retain = cell.current;\n    }\n\n    for (key in this._cells) {\n      cell = this._cells[key];\n      if (cell.current && !cell.active) {\n        const coords = cell.coords;\n        if (!this._retainParent(coords.x, coords.y, coords.z, coords.z - 5)) {\n          this._retainChildren(coords.x, coords.y, coords.z, coords.z + 2);\n        }\n      }\n    }\n\n    for (key in this._cells) {\n      if (!this._cells[key].retain) {\n        this._removeCell(key);\n      }\n    }\n  },\n\n  _removeAllCells() {\n    for (const key in this._cells) {\n      this._removeCell(key);\n    }\n  },\n\n  _invalidateAll() {\n    this._removeAllCells();\n\n    this._cellZoom = undefined;\n  },\n\n  _retainParent(x, y, z, minZoom) {\n    const x2 = Math.floor(x / 2);\n    const y2 = Math.floor(y / 2);\n    const z2 = z - 1;\n    const coords2 = new Point(+x2, +y2);\n    coords2.z = +z2;\n\n    const key = this._cellCoordsToKey(coords2);\n    const cell = this._cells[key];\n\n    if (cell && cell.active) {\n      cell.retain = true;\n      return true;\n    } else if (cell && cell.loaded) {\n      cell.retain = true;\n    }\n\n    if (z2 > minZoom) {\n      return this._retainParent(x2, y2, z2, minZoom);\n    }\n\n    return false;\n  },\n\n  _retainChildren(x, y, z, maxZoom) {\n    for (let i = 2 * x; i < 2 * x + 2; i++) {\n      for (let j = 2 * y; j < 2 * y + 2; j++) {\n        const coords = new Point(i, j);\n        coords.z = z + 1;\n\n        const key = this._cellCoordsToKey(coords);\n        const cell = this._cells[key];\n\n        if (cell && cell.active) {\n          cell.retain = true;\n          continue;\n        } else if (cell && cell.loaded) {\n          cell.retain = true;\n        }\n\n        if (z + 1 < maxZoom) {\n          this._retainChildren(i, j, z + 1, maxZoom);\n        }\n      }\n    }\n  },\n\n  _resetView(e) {\n    const animating = e && (e.pinch || e.flyTo);\n\n    if (animating) {\n      return;\n    }\n\n    this._setView(\n      this._map.getCenter(),\n      this._map.getZoom(),\n      animating,\n      animating,\n    );\n  },\n\n  _setView(center, zoom, noPrune, noUpdate) {\n    const cellZoom = Math.round(zoom);\n\n    if (!noUpdate) {\n      this._cellZoom = cellZoom;\n\n      if (this._abortLoading) {\n        this._abortLoading();\n      }\n\n      this._resetGrid();\n\n      if (cellZoom !== undefined) {\n        this._update(center);\n      }\n\n      if (!noPrune) {\n        this._pruneCells();\n      }\n\n      // Flag to prevent _updateOpacity from pruning cells during\n      // a zoom anim or a pinch gesture\n      this._noPrune = !!noPrune;\n    }\n  },\n\n  _resetGrid() {\n    const map = this._map;\n    const crs = map.options.crs;\n    const cellSize = (this._cellSize = this.getCellSize());\n    const cellZoom = this._cellZoom;\n\n    const bounds = this._map.getPixelWorldBounds(this._cellZoom);\n    if (bounds) {\n      this._globalCellRange = this._pxBoundsToCellRange(bounds);\n    }\n\n    this._wrapX = crs.wrapLng &&\n      !this.options.noWrap && [\n        Math.floor(map.project([0, crs.wrapLng[0]], cellZoom).x / cellSize.x),\n        Math.ceil(map.project([0, crs.wrapLng[1]], cellZoom).x / cellSize.y),\n      ];\n    this._wrapY = crs.wrapLat &&\n      !this.options.noWrap && [\n        Math.floor(map.project([crs.wrapLat[0], 0], cellZoom).y / cellSize.x),\n        Math.ceil(map.project([crs.wrapLat[1], 0], cellZoom).y / cellSize.y),\n      ];\n  },\n\n  _onMoveEnd(e) {\n    const animating = e && (e.pinch || e.flyTo);\n\n    if (animating || !this._map || this._map._animatingZoom) {\n      return;\n    }\n\n    this._update();\n  },\n\n  _getCelldPixelBounds(center) {\n    const map = this._map;\n    const mapZoom = map._animatingZoom\n      ? Math.max(map._animateToZoom, map.getZoom())\n      : map.getZoom();\n    const scale = map.getZoomScale(mapZoom, this._cellZoom);\n    const pixelCenter = map.project(center, this._cellZoom).floor();\n    const halfSize = map.getSize().divideBy(scale * 2);\n\n    return new Bounds(\n      pixelCenter.subtract(halfSize),\n      pixelCenter.add(halfSize),\n    );\n  },\n\n  // Private method to load cells in the grid's active zoom level according to map bounds\n  _update(center) {\n    const map = this._map;\n    if (!map) {\n      return;\n    }\n    const zoom = Math.round(map.getZoom());\n\n    if (center === undefined) {\n      center = map.getCenter();\n    }\n\n    const pixelBounds = this._getCelldPixelBounds(center);\n    const cellRange = this._pxBoundsToCellRange(pixelBounds);\n    const cellCenter = cellRange.getCenter();\n    const queue = [];\n    const margin = this.options.keepBuffer;\n    const noPruneRange = new Bounds(\n      cellRange.getBottomLeft().subtract([margin, -margin]),\n      cellRange.getTopRight().add([margin, -margin]),\n    );\n\n    // Sanity check: panic if the cell range contains Infinity somewhere.\n    if (\n      !(\n        isFinite(cellRange.min.x) &&\n        isFinite(cellRange.min.y) &&\n        isFinite(cellRange.max.x) &&\n        isFinite(cellRange.max.y)\n      )\n    ) {\n      throw new Error(\"Attempted to load an infinite number of cells\");\n    }\n\n    for (const key in this._cells) {\n      const c = this._cells[key].coords;\n      if (\n        c.z !== this._cellZoom ||\n        !noPruneRange.contains(new Point(c.x, c.y))\n      ) {\n        this._cells[key].current = false;\n      }\n    }\n\n    // _update just loads more cells. If the cell zoom level differs too much\n    // from the map's, let _setView reset levels and prune old cells.\n    if (Math.abs(zoom - this._cellZoom) > 1) {\n      this._setView(center, zoom);\n      return;\n    }\n\n    // create a queue of coordinates to load cells from\n    for (let j = cellRange.min.y; j <= cellRange.max.y; j++) {\n      for (let i = cellRange.min.x; i <= cellRange.max.x; i++) {\n        const coords = new Point(i, j);\n        coords.z = this._cellZoom;\n\n        if (!this._isValidCell(coords)) {\n          continue;\n        }\n\n        const cell = this._cells[this._cellCoordsToKey(coords)];\n        if (cell) {\n          cell.current = true;\n        } else {\n          queue.push(coords);\n        }\n      }\n    }\n\n    // sort cell queue to load cells in order of their distance to center\n    queue.sort((a, b) => a.distanceTo(cellCenter) - b.distanceTo(cellCenter));\n\n    if (queue.length !== 0) {\n      // if it's the first batch of cells to load\n      if (!this._loading) {\n        this._loading = true;\n      }\n\n      for (let i = 0; i < queue.length; i++) {\n        const _key = this._cellCoordsToKey(queue[i]);\n        const _coords = this._keyToCellCoords(_key);\n        if (this._activeCells[_coords]) {\n          this._reuseCell(queue[i]);\n        } else {\n          this._createCell(queue[i]);\n        }\n      }\n    }\n  },\n\n  _isValidCell(coords) {\n    const crs = this._map.options.crs;\n\n    if (!crs.infinite) {\n      // don't load cell if it's out of bounds and not wrapped\n      const bounds = this._globalCellRange;\n      if (\n        (!crs.wrapLng &&\n          (coords.x < bounds.min.x || coords.x > bounds.max.x)) ||\n        (!crs.wrapLat && (coords.y < bounds.min.y || coords.y > bounds.max.y))\n      ) {\n        return false;\n      }\n    }\n\n    if (!this.options.bounds) {\n      return true;\n    }\n\n    // don't load cell if it doesn't intersect the bounds in options\n    const cellBounds = this._cellCoordsToBounds(coords);\n    return latLngBounds(this.options.bounds).overlaps(cellBounds);\n  },\n\n  _keyToBounds(key) {\n    return this._cellCoordsToBounds(this._keyToCellCoords(key));\n  },\n\n  _cellCoordsToNwSe(coords) {\n    const map = this._map;\n    const cellSize = this.getCellSize();\n    const nwPoint = coords.scaleBy(cellSize);\n    const sePoint = nwPoint.add(cellSize);\n    const nw = map.unproject(nwPoint, coords.z);\n    const se = map.unproject(sePoint, coords.z);\n\n    return [nw, se];\n  },\n\n  // converts cell coordinates to its geographical bounds\n  _cellCoordsToBounds(coords) {\n    const bp = this._cellCoordsToNwSe(coords);\n    let bounds = new LatLngBounds(bp[0], bp[1]);\n\n    if (!this.options.noWrap) {\n      bounds = this._map.wrapLatLngBounds(bounds);\n    }\n    return bounds;\n  },\n  // converts cell coordinates to key for the cell cache\n  _cellCoordsToKey(coords) {\n    return `${coords.x}:${coords.y}:${coords.z}`;\n  },\n\n  // converts cell cache key to coordinates\n  _keyToCellCoords(key) {\n    const k = key.split(\":\");\n    const coords = new Point(+k[0], +k[1]);\n\n    coords.z = +k[2];\n    return coords;\n  },\n\n  _removeCell(key) {\n    const cell = this._cells[key];\n\n    if (!cell) {\n      return;\n    }\n\n    const coords = this._keyToCellCoords(key);\n    const wrappedCoords = this._wrapCoords(coords);\n    const cellBounds = this._cellCoordsToBounds(this._wrapCoords(coords));\n\n    cell.current = false;\n\n    delete this._cells[key];\n    this._activeCells[key] = cell;\n\n    this.cellLeave(cellBounds, wrappedCoords, key);\n\n    this.fire(\"cellleave\", {\n      key,\n      coords: wrappedCoords,\n      bounds: cellBounds,\n    });\n  },\n\n  _reuseCell(coords) {\n    const key = this._cellCoordsToKey(coords);\n\n    // save cell in cache\n    this._cells[key] = this._activeCells[key];\n    this._cells[key].current = true;\n\n    const wrappedCoords = this._wrapCoords(coords);\n    const cellBounds = this._cellCoordsToBounds(this._wrapCoords(coords));\n\n    this.cellEnter(cellBounds, wrappedCoords, key);\n\n    this.fire(\"cellenter\", {\n      key,\n      coords: wrappedCoords,\n      bounds: cellBounds,\n    });\n  },\n\n  _createCell(coords) {\n    const key = this._cellCoordsToKey(coords);\n\n    const wrappedCoords = this._wrapCoords(coords);\n    const cellBounds = this._cellCoordsToBounds(this._wrapCoords(coords));\n\n    this.createCell(cellBounds, wrappedCoords, key);\n\n    this.fire(\"cellcreate\", {\n      key,\n      coords: wrappedCoords,\n      bounds: cellBounds,\n    });\n\n    // save cell in cache\n    this._cells[key] = {\n      coords,\n      current: true,\n    };\n\n    Util.requestAnimFrame(this._pruneCells, this);\n  },\n\n  _cellReady(coords, err, cell) {\n    const key = this._cellCoordsToKey(coords);\n\n    cell = this._cells[key];\n\n    if (!cell) {\n      return;\n    }\n\n    cell.loaded = +new Date();\n\n    cell.active = true;\n  },\n\n  _getCellPos(coords) {\n    return coords.scaleBy(this.getCellSize());\n  },\n\n  _wrapCoords(coords) {\n    const newCoords = new Point(\n      this._wrapX ? Util.wrapNum(coords.x, this._wrapX) : coords.x,\n      this._wrapY ? Util.wrapNum(coords.y, this._wrapY) : coords.y,\n    );\n    newCoords.z = coords.z;\n    return newCoords;\n  },\n\n  _pxBoundsToCellRange(bounds) {\n    const cellSize = this.getCellSize();\n    return new Bounds(\n      bounds.min.unscaleBy(cellSize).floor(),\n      bounds.max.unscaleBy(cellSize).ceil().subtract([1, 1]),\n    );\n  },\n});\n","function BinarySearchIndex (values) {\n  this.values = [].concat(values || []);\n}\n\nBinarySearchIndex.prototype.query = function (value) {\n  var index = this.getIndex(value);\n  return this.values[index];\n};\n\nBinarySearchIndex.prototype.getIndex = function getIndex (value) {\n  if (this.dirty) {\n    this.sort();\n  }\n\n  var minIndex = 0;\n  var maxIndex = this.values.length - 1;\n  var currentIndex;\n  var currentElement;\n\n  while (minIndex <= maxIndex) {\n    currentIndex = (minIndex + maxIndex) / 2 | 0;\n    currentElement = this.values[Math.round(currentIndex)];\n    if (+currentElement.value < +value) {\n      minIndex = currentIndex + 1;\n    } else if (+currentElement.value > +value) {\n      maxIndex = currentIndex - 1;\n    } else {\n      return currentIndex;\n    }\n  }\n\n  return Math.abs(~maxIndex);\n};\n\nBinarySearchIndex.prototype.between = function between (start, end) {\n  var startIndex = this.getIndex(start);\n  var endIndex = this.getIndex(end);\n\n  if (startIndex === 0 && endIndex === 0) {\n    return [];\n  }\n\n  while (this.values[startIndex - 1] && this.values[startIndex - 1].value === start) {\n    startIndex--;\n  }\n\n  while (this.values[endIndex + 1] && this.values[endIndex + 1].value === end) {\n    endIndex++;\n  }\n\n  if (this.values[endIndex] && this.values[endIndex].value === end && this.values[endIndex + 1]) {\n    endIndex++;\n  }\n\n  return this.values.slice(startIndex, endIndex);\n};\n\nBinarySearchIndex.prototype.insert = function insert (item) {\n  this.values.splice(this.getIndex(item.value), 0, item);\n  return this;\n};\n\nBinarySearchIndex.prototype.bulkAdd = function bulkAdd (items, sort) {\n  this.values = this.values.concat([].concat(items || []));\n\n  if (sort) {\n    this.sort();\n  } else {\n    this.dirty = true;\n  }\n\n  return this;\n};\n\nBinarySearchIndex.prototype.sort = function sort () {\n  this.values.sort(function (a, b) {\n    return +b.value - +a.value;\n  }).reverse();\n  this.dirty = false;\n  return this;\n};\n\nexport default BinarySearchIndex;\n","import { Util } from \"leaflet\";\nimport featureLayerService from \"../../Services/FeatureLayerService.js\";\nimport {\n  getUrlParams,\n  warn,\n  setEsriAttribution,\n  removeEsriAttribution,\n} from \"../../Util.js\";\nimport { FeatureGrid } from \"./FeatureGrid.js\";\nimport BinarySearchIndex from \"tiny-binary-search\";\n\nexport const FeatureManager = FeatureGrid.extend({\n  /**\n   * Options\n   */\n\n  options: {\n    attribution: null,\n    where: \"1=1\",\n    fields: [\"*\"],\n    from: false,\n    to: false,\n    timeField: false,\n    timeFilterMode: \"server\",\n    simplifyFactor: 0,\n    precision: 6,\n    fetchAllFeatures: false,\n  },\n\n  /**\n   * Constructor\n   */\n\n  initialize(options) {\n    FeatureGrid.prototype.initialize.call(this, options);\n\n    options = getUrlParams(options);\n    options = Util.setOptions(this, options);\n\n    this.service = featureLayerService(options);\n    this.service.addEventParent(this);\n\n    // use case insensitive regex to look for common fieldnames used for indexing\n    if (this.options.fields[0] !== \"*\") {\n      let oidCheck = false;\n      for (let i = 0; i < this.options.fields.length; i++) {\n        if (this.options.fields[i].match(/^(OBJECTID|FID|OID|ID)$/i)) {\n          oidCheck = true;\n        }\n      }\n      if (oidCheck === false) {\n        warn(\n          \"no known esriFieldTypeOID field detected in fields Array.  Please add an attribute field containing unique IDs to ensure the layer can be drawn correctly.\",\n        );\n      }\n    }\n\n    if (this.options.timeField.start && this.options.timeField.end) {\n      this._startTimeIndex = new BinarySearchIndex();\n      this._endTimeIndex = new BinarySearchIndex();\n    } else if (this.options.timeField) {\n      this._timeIndex = new BinarySearchIndex();\n    }\n\n    this._cache = {};\n    this._currentSnapshot = []; // cache of what layers should be active\n    this._activeRequests = 0;\n  },\n\n  /**\n   * Layer Interface\n   */\n\n  onAdd(map) {\n    // include 'Powered by Esri' in map attribution\n    setEsriAttribution(map);\n\n    this.service.metadata(function (err, metadata) {\n      if (!err) {\n        const supportedFormats = metadata.supportedQueryFormats;\n\n        // Check if someone has requested that we don't use geoJSON, even if it's available\n        let forceJsonFormat = false;\n        if (\n          this.service.options.isModern === false ||\n          this.options.fetchAllFeatures\n        ) {\n          forceJsonFormat = true;\n        }\n\n        // Unless we've been told otherwise, check to see whether service can emit GeoJSON natively\n        if (\n          !forceJsonFormat &&\n          supportedFormats &&\n          supportedFormats.indexOf(\"geoJSON\") !== -1\n        ) {\n          this.service.options.isModern = true;\n        }\n\n        if (metadata.objectIdField) {\n          this.service.options.idAttribute = metadata.objectIdField;\n        }\n\n        // add copyright text listed in service metadata\n        if (\n          !this.options.attribution &&\n          map.attributionControl &&\n          metadata.copyrightText\n        ) {\n          this.options.attribution = metadata.copyrightText;\n          map.attributionControl.addAttribution(this.getAttribution());\n        }\n      }\n    }, this);\n\n    map.on(\"zoomend\", this._handleZoomChange, this);\n\n    return FeatureGrid.prototype.onAdd.call(this, map);\n  },\n\n  onRemove(map) {\n    removeEsriAttribution(map);\n    map.off(\"zoomend\", this._handleZoomChange, this);\n\n    return FeatureGrid.prototype.onRemove.call(this, map);\n  },\n\n  getAttribution() {\n    return this.options.attribution;\n  },\n\n  /**\n   * Feature Management\n   */\n\n  createCell(bounds, coords) {\n    // dont fetch features outside the scale range defined for the layer\n    if (this._visibleZoom()) {\n      this._requestFeatures(bounds, coords);\n    }\n  },\n\n  _requestFeatures(bounds, coords, callback, offset) {\n    this._activeRequests++;\n\n    // default param\n    offset = offset || 0;\n\n    const originalWhere = this.options.where;\n\n    // our first active request fires loading\n    if (this._activeRequests === 1) {\n      this.fire(\n        \"loading\",\n        {\n          bounds,\n        },\n        true,\n      );\n    }\n\n    return this._buildQuery(bounds, offset).run(function (\n      error,\n      featureCollection,\n      response,\n    ) {\n      if (response && response.exceededTransferLimit) {\n        this.fire(\"drawlimitexceeded\");\n      }\n\n      // the where changed while this request was being run so don't it.\n      if (this.options.where !== originalWhere) {\n        return;\n      }\n\n      // no error, features\n      if (!error && featureCollection && featureCollection.features.length) {\n        // schedule adding features until the next animation frame\n        Util.requestAnimFrame(\n          Util.bind(function () {\n            this._addFeatures(featureCollection.features, coords);\n            this._postProcessFeatures(bounds);\n          }, this),\n        );\n      }\n\n      // no error, no features\n      if (!error && featureCollection && !featureCollection.features.length) {\n        this._postProcessFeatures(bounds);\n      }\n\n      if (error) {\n        this._postProcessFeatures(bounds);\n      }\n\n      if (callback) {\n        callback.call(this, error, featureCollection);\n      }\n      if (\n        response &&\n        (response.exceededTransferLimit ||\n          (response.properties && response.properties.exceededTransferLimit)) &&\n        this.options.fetchAllFeatures\n      ) {\n        this._requestFeatures(\n          bounds,\n          coords,\n          callback,\n          offset + featureCollection.features.length,\n        );\n      }\n    }, this);\n  },\n\n  _postProcessFeatures(bounds) {\n    // deincrement the request counter now that we have processed features\n    this._activeRequests--;\n\n    // if there are no more active requests fire a load event for this view\n    if (this._activeRequests <= 0) {\n      this.fire(\"load\", {\n        bounds,\n      });\n    }\n  },\n\n  _cacheKey(coords) {\n    return `${coords.z}:${coords.x}:${coords.y}`;\n  },\n\n  _addFeatures(features, coords) {\n    // coords is optional - will be false if coming from addFeatures() function\n    let key;\n    if (coords) {\n      key = this._cacheKey(coords);\n      this._cache[key] = this._cache[key] || [];\n    }\n\n    for (let i = features.length - 1; i >= 0; i--) {\n      const id = features[i].id;\n\n      if (this._currentSnapshot.indexOf(id) === -1) {\n        this._currentSnapshot.push(id);\n      }\n      if (typeof key !== \"undefined\" && this._cache[key].indexOf(id) === -1) {\n        this._cache[key].push(id);\n      }\n    }\n\n    if (this.options.timeField) {\n      this._buildTimeIndexes(features);\n    }\n\n    this.createLayers(features);\n  },\n\n  _buildQuery(bounds, offset) {\n    let query = this.service\n      .query()\n      .intersects(bounds)\n      .where(this.options.where)\n      .fields(this.options.fields)\n      .precision(this.options.precision);\n\n    if (this.options.fetchAllFeatures && !isNaN(parseInt(offset))) {\n      query = query.offset(offset);\n    }\n\n    query.params[\"resultType\"] = \"tile\";\n\n    if (this.options.requestParams) {\n      Util.extend(query.params, this.options.requestParams);\n    }\n\n    if (this.options.simplifyFactor) {\n      query.simplify(this._map, this.options.simplifyFactor);\n    }\n\n    if (\n      this.options.timeFilterMode === \"server\" &&\n      this.options.from &&\n      this.options.to\n    ) {\n      query.between(this.options.from, this.options.to);\n    }\n\n    return query;\n  },\n\n  /**\n   * Where Methods\n   */\n\n  setWhere(where, callback, context) {\n    this.options.where = where && where.length ? where : \"1=1\";\n\n    const oldSnapshot = [];\n    const newSnapshot = [];\n    let pendingRequests = 0;\n    let requestError = null;\n    const requestCallback = Util.bind(function (error, featureCollection) {\n      if (error) {\n        requestError = error;\n      }\n\n      if (featureCollection) {\n        for (let i = featureCollection.features.length - 1; i >= 0; i--) {\n          newSnapshot.push(featureCollection.features[i].id);\n        }\n      }\n\n      pendingRequests--;\n\n      if (\n        pendingRequests <= 0 &&\n        this._visibleZoom() &&\n        where === this.options.where // the where is still the same so use this one\n      ) {\n        this._currentSnapshot = newSnapshot;\n        // schedule adding features for the next animation frame\n        Util.requestAnimFrame(\n          Util.bind(function () {\n            this.removeLayers(oldSnapshot);\n            this.addLayers(newSnapshot);\n            if (callback) {\n              callback.call(context, requestError);\n            }\n          }, this),\n        );\n      }\n    }, this);\n\n    for (let i = this._currentSnapshot.length - 1; i >= 0; i--) {\n      oldSnapshot.push(this._currentSnapshot[i]);\n    }\n\n    this._cache = {};\n\n    for (const key in this._cells) {\n      pendingRequests++;\n      const coords = this._keyToCellCoords(key);\n      const bounds = this._cellCoordsToBounds(coords);\n      this._requestFeatures(bounds, coords, requestCallback);\n    }\n\n    return this;\n  },\n\n  getWhere() {\n    return this.options.where;\n  },\n\n  /**\n   * Time Range Methods\n   */\n\n  getTimeRange() {\n    return [this.options.from, this.options.to];\n  },\n\n  setTimeRange(from, to, callback, context) {\n    const oldFrom = this.options.from;\n    const oldTo = this.options.to;\n    let pendingRequests = 0;\n    let requestError = null;\n    const requestCallback = Util.bind(function (error) {\n      if (error) {\n        requestError = error;\n      }\n      this._filterExistingFeatures(oldFrom, oldTo, from, to);\n\n      pendingRequests--;\n\n      if (callback && pendingRequests <= 0) {\n        callback.call(context, requestError);\n      }\n    }, this);\n\n    this.options.from = from;\n    this.options.to = to;\n\n    this._filterExistingFeatures(oldFrom, oldTo, from, to);\n\n    if (this.options.timeFilterMode === \"server\") {\n      for (const key in this._cells) {\n        pendingRequests++;\n        const coords = this._keyToCellCoords(key);\n        const bounds = this._cellCoordsToBounds(coords);\n        this._requestFeatures(bounds, coords, requestCallback);\n      }\n    }\n\n    return this;\n  },\n\n  refresh() {\n    this.setWhere(this.options.where);\n  },\n\n  _filterExistingFeatures(oldFrom, oldTo, newFrom, newTo) {\n    const layersToRemove =\n      oldFrom && oldTo\n        ? this._getFeaturesInTimeRange(oldFrom, oldTo)\n        : this._currentSnapshot;\n    const layersToAdd = this._getFeaturesInTimeRange(newFrom, newTo);\n\n    if (layersToAdd.indexOf) {\n      for (let i = 0; i < layersToAdd.length; i++) {\n        const shouldRemoveLayer = layersToRemove.indexOf(layersToAdd[i]);\n        if (shouldRemoveLayer >= 0) {\n          layersToRemove.splice(shouldRemoveLayer, 1);\n        }\n      }\n    }\n\n    // schedule adding features until the next animation frame\n    Util.requestAnimFrame(\n      Util.bind(function () {\n        this.removeLayers(layersToRemove);\n        this.addLayers(layersToAdd);\n      }, this),\n    );\n  },\n\n  _getFeaturesInTimeRange(start, end) {\n    const ids = [];\n    let search;\n\n    if (this.options.timeField.start && this.options.timeField.end) {\n      const startTimes = this._startTimeIndex.between(start, end);\n      const endTimes = this._endTimeIndex.between(start, end);\n      search = startTimes.concat(endTimes);\n    } else if (this._timeIndex) {\n      search = this._timeIndex.between(start, end);\n    } else {\n      warn(\n        \"You must set timeField in the layer constructor in order to manipulate the start and end time filter.\",\n      );\n      return [];\n    }\n\n    for (let i = search.length - 1; i >= 0; i--) {\n      ids.push(search[i].id);\n    }\n\n    return ids;\n  },\n\n  _buildTimeIndexes(geojson) {\n    let i;\n    let feature;\n    if (this.options.timeField.start && this.options.timeField.end) {\n      const startTimeEntries = [];\n      const endTimeEntries = [];\n      for (i = geojson.length - 1; i >= 0; i--) {\n        feature = geojson[i];\n        startTimeEntries.push({\n          id: feature.id,\n          value: new Date(feature.properties[this.options.timeField.start]),\n        });\n        endTimeEntries.push({\n          id: feature.id,\n          value: new Date(feature.properties[this.options.timeField.end]),\n        });\n      }\n      this._startTimeIndex.bulkAdd(startTimeEntries);\n      this._endTimeIndex.bulkAdd(endTimeEntries);\n    } else {\n      const timeEntries = [];\n      for (i = geojson.length - 1; i >= 0; i--) {\n        feature = geojson[i];\n        timeEntries.push({\n          id: feature.id,\n          value: new Date(feature.properties[this.options.timeField]),\n        });\n      }\n\n      this._timeIndex.bulkAdd(timeEntries);\n    }\n  },\n\n  _featureWithinTimeRange(feature) {\n    if (!this.options.from || !this.options.to) {\n      return true;\n    }\n\n    const from = +this.options.from.valueOf();\n    const to = +this.options.to.valueOf();\n\n    if (typeof this.options.timeField === \"string\") {\n      const date = +feature.properties[this.options.timeField];\n      return date >= from && date <= to;\n    }\n\n    if (this.options.timeField.start && this.options.timeField.end) {\n      const startDate = +feature.properties[this.options.timeField.start];\n      const endDate = +feature.properties[this.options.timeField.end];\n      return (\n        (startDate >= from && startDate <= to) ||\n        (endDate >= from && endDate <= to) ||\n        (startDate <= from && endDate >= to)\n      );\n    }\n  },\n\n  _visibleZoom() {\n    // check to see whether the current zoom level of the map is within the optional limit defined for the FeatureLayer\n    if (!this._map) {\n      return false;\n    }\n    const zoom = this._map.getZoom();\n    if (zoom > this.options.maxZoom || zoom < this.options.minZoom) {\n      return false;\n    }\n    return true;\n  },\n\n  _handleZoomChange() {\n    if (!this._visibleZoom()) {\n      // if we have moved outside the visible zoom range clear the current snapshot, no layers should be active\n      this.removeLayers(this._currentSnapshot);\n      this._currentSnapshot = [];\n    } else {\n      /*\n      for every cell in this._cells\n        1. Get the cache key for the coords of the cell\n        2. If this._cache[key] exists it will be an array of feature IDs.\n        3. Call this.addLayers(this._cache[key]) to instruct the feature layer to add the layers back.\n      */\n      for (const i in this._cells) {\n        const coords = this._cells[i].coords;\n        const key = this._cacheKey(coords);\n        if (this._cache[key]) {\n          this.addLayers(this._cache[key]);\n        }\n      }\n    }\n  },\n\n  /**\n   * Service Methods\n   */\n\n  authenticate(token) {\n    this.service.authenticate(token);\n    return this;\n  },\n\n  metadata(callback, context) {\n    this.service.metadata(callback, context);\n    return this;\n  },\n\n  query() {\n    return this.service.query();\n  },\n\n  _getMetadata(callback) {\n    if (this._metadata) {\n      let error;\n      callback(error, this._metadata);\n    } else {\n      this.metadata(\n        Util.bind(function (error, response) {\n          this._metadata = response;\n          callback(error, this._metadata);\n        }, this),\n      );\n    }\n  },\n\n  addFeature(feature, callback, context) {\n    this.addFeatures(feature, callback, context);\n  },\n\n  addFeatures(features, callback, context) {\n    this._getMetadata(\n      Util.bind(function (error, metadata) {\n        if (error) {\n          if (callback) {\n            callback.call(this, error, null);\n          }\n          return;\n        }\n        // GeoJSON featureCollection or simple feature\n        const featuresArray = features.features\n          ? features.features\n          : [features];\n\n        this.service.addFeatures(\n          features,\n          Util.bind(function (error, response) {\n            if (!error) {\n              for (let i = featuresArray.length - 1; i >= 0; i--) {\n                // assign ID from result to appropriate objectid field from service metadata\n                featuresArray[i].properties[metadata.objectIdField] =\n                  featuresArray.length > 1\n                    ? response[i].objectId\n                    : response.objectId;\n                // we also need to update the geojson id for createLayers() to function\n                featuresArray[i].id =\n                  featuresArray.length > 1\n                    ? response[i].objectId\n                    : response.objectId;\n              }\n              this._addFeatures(featuresArray);\n            }\n\n            if (callback) {\n              callback.call(context, error, response);\n            }\n          }, this),\n        );\n      }, this),\n    );\n  },\n\n  updateFeature(feature, callback, context) {\n    this.updateFeatures(feature, callback, context);\n  },\n\n  updateFeatures(features, callback, context) {\n    // GeoJSON featureCollection or simple feature\n    const featuresArray = features.features ? features.features : [features];\n    this.service.updateFeatures(\n      features,\n      function (error, response) {\n        if (!error) {\n          for (let i = featuresArray.length - 1; i >= 0; i--) {\n            this.removeLayers([featuresArray[i].id], true);\n          }\n          this._addFeatures(featuresArray);\n        }\n\n        if (callback) {\n          callback.call(context, error, response);\n        }\n      },\n      this,\n    );\n  },\n\n  deleteFeature(id, callback, context) {\n    this.deleteFeatures(id, callback, context);\n  },\n\n  deleteFeatures(ids, callback, context) {\n    return this.service.deleteFeatures(\n      ids,\n      function (error, response) {\n        const responseArray = response.length ? response : [response];\n        if (!error && responseArray.length > 0) {\n          for (let i = responseArray.length - 1; i >= 0; i--) {\n            this.removeLayers([responseArray[i].objectId], true);\n          }\n        }\n        if (callback) {\n          callback.call(context, error, response);\n        }\n      },\n      this,\n    );\n  },\n});\n","import { Path, Util, GeoJSON, latLng } from \"leaflet\";\nimport { FeatureManager } from \"./FeatureManager.js\";\nimport { warn } from \"../../Util.js\";\n\nexport const FeatureLayer = FeatureManager.extend({\n  options: {\n    cacheLayers: true,\n  },\n\n  /**\n   * Constructor\n   */\n  initialize(options) {\n    if (options.apikey) {\n      options.token = options.apikey;\n    }\n    FeatureManager.prototype.initialize.call(this, options);\n    this._originalStyle = this.options.style;\n    this._layers = {};\n  },\n\n  /**\n   * Layer Interface\n   */\n\n  onRemove(map) {\n    for (const i in this._layers) {\n      map.removeLayer(this._layers[i]);\n      // trigger the event when the entire featureLayer is removed from the map\n      this.fire(\n        \"removefeature\",\n        {\n          feature: this._layers[i].feature,\n          permanent: false,\n        },\n        true,\n      );\n    }\n\n    return FeatureManager.prototype.onRemove.call(this, map);\n  },\n\n  createNewLayer(geojson) {\n    const layer = GeoJSON.geometryToLayer(geojson, this.options);\n    // trap for GeoJSON without geometry\n    if (layer) {\n      layer.defaultOptions = layer.options;\n    }\n    return layer;\n  },\n\n  _updateLayer(layer, geojson) {\n    // convert the geojson coordinates into a Leaflet LatLng array/nested arrays\n    // pass it to setLatLngs to update layer geometries\n    let latlngs = [];\n    const coordsToLatLng =\n      this.options.coordsToLatLng || GeoJSON.coordsToLatLng;\n\n    // copy new attributes, if present\n    if (geojson.properties) {\n      layer.feature.properties = geojson.properties;\n    }\n\n    switch (geojson.geometry.type) {\n      case \"Point\":\n        latlngs = GeoJSON.coordsToLatLng(geojson.geometry.coordinates);\n        layer.setLatLng(latlngs);\n        break;\n      case \"LineString\":\n        latlngs = GeoJSON.coordsToLatLngs(\n          geojson.geometry.coordinates,\n          0,\n          coordsToLatLng,\n        );\n        layer.setLatLngs(latlngs);\n        break;\n      case \"MultiLineString\":\n        latlngs = GeoJSON.coordsToLatLngs(\n          geojson.geometry.coordinates,\n          1,\n          coordsToLatLng,\n        );\n        layer.setLatLngs(latlngs);\n        break;\n      case \"Polygon\":\n        latlngs = GeoJSON.coordsToLatLngs(\n          geojson.geometry.coordinates,\n          1,\n          coordsToLatLng,\n        );\n        layer.setLatLngs(latlngs);\n        break;\n      case \"MultiPolygon\":\n        latlngs = GeoJSON.coordsToLatLngs(\n          geojson.geometry.coordinates,\n          2,\n          coordsToLatLng,\n        );\n        layer.setLatLngs(latlngs);\n        break;\n    }\n\n    // update symbol/style\n    this.redraw(layer.feature.id);\n  },\n\n  /**\n   * Feature Management Methods\n   */\n\n  createLayers(features) {\n    for (let i = features.length - 1; i >= 0; i--) {\n      const geojson = features[i];\n\n      const layer = this._layers[geojson.id];\n      let newLayer;\n\n      if (\n        this._visibleZoom() &&\n        layer &&\n        !this._map.hasLayer(layer) &&\n        (!this.options.timeField || this._featureWithinTimeRange(geojson))\n      ) {\n        this._map.addLayer(layer);\n        this.fire(\n          \"addfeature\",\n          {\n            feature: layer.feature,\n          },\n          true,\n        );\n      }\n\n      // update geometry if the layer already existed.\n      if (layer && (layer.setLatLngs || layer.setLatLng)) {\n        this._updateLayer(layer, geojson);\n      }\n\n      if (!layer) {\n        newLayer = this.createNewLayer(geojson);\n\n        if (!newLayer) {\n          warn(\"invalid GeoJSON encountered\");\n        } else {\n          newLayer.feature = geojson;\n\n          // bubble events from individual layers to the feature layer\n          newLayer.addEventParent(this);\n\n          if (this.options.onEachFeature) {\n            this.options.onEachFeature(newLayer.feature, newLayer);\n          }\n\n          // cache the layer\n          this._layers[newLayer.feature.id] = newLayer;\n\n          // style the layer\n          this.setFeatureStyle(newLayer.feature.id, this.options.style);\n\n          this.fire(\n            \"createfeature\",\n            {\n              feature: newLayer.feature,\n            },\n            true,\n          );\n\n          // add the layer if the current zoom level is inside the range defined for the layer, it is within the current time bounds or our layer is not time enabled\n          if (\n            this._visibleZoom() &&\n            (!this.options.timeField ||\n              (this.options.timeField && this._featureWithinTimeRange(geojson)))\n          ) {\n            this._map.addLayer(newLayer);\n          }\n        }\n      }\n    }\n  },\n\n  addLayers(ids) {\n    for (let i = ids.length - 1; i >= 0; i--) {\n      const layer = this._layers[ids[i]];\n      if (\n        layer &&\n        (!this.options.timeField || this._featureWithinTimeRange(layer.feature))\n      ) {\n        this._map.addLayer(layer);\n        this.fire(\n          \"addfeature\",\n          {\n            feature: layer.feature,\n          },\n          true,\n        );\n      }\n    }\n  },\n\n  removeLayers(ids, permanent) {\n    for (let i = ids.length - 1; i >= 0; i--) {\n      const id = ids[i];\n      const layer = this._layers[id];\n      if (layer) {\n        this.fire(\n          \"removefeature\",\n          {\n            feature: layer.feature,\n            permanent,\n          },\n          true,\n        );\n        this._map.removeLayer(layer);\n      }\n      if (layer && permanent) {\n        delete this._layers[id];\n      }\n    }\n  },\n\n  cellEnter(bounds, coords) {\n    if (this._visibleZoom() && !this._zooming && this._map) {\n      Util.requestAnimFrame(\n        Util.bind(function () {\n          const cacheKey = this._cacheKey(coords);\n          const cellKey = this._cellCoordsToKey(coords);\n          const layers = this._cache[cacheKey];\n          if (this._activeCells[cellKey] && layers) {\n            this.addLayers(layers);\n          }\n        }, this),\n      );\n    }\n  },\n\n  cellLeave(bounds, coords) {\n    if (!this._zooming) {\n      Util.requestAnimFrame(\n        Util.bind(function () {\n          if (this._map) {\n            const cacheKey = this._cacheKey(coords);\n            const cellKey = this._cellCoordsToKey(coords);\n            const layers = this._cache[cacheKey];\n            const mapBounds = this._map.getBounds();\n            if (!this._activeCells[cellKey] && layers) {\n              let removable = true;\n\n              for (let i = 0; i < layers.length; i++) {\n                const layer = this._layers[layers[i]];\n                if (\n                  layer &&\n                  layer.getBounds &&\n                  mapBounds.intersects(layer.getBounds())\n                ) {\n                  removable = false;\n                }\n              }\n\n              if (removable) {\n                this.removeLayers(layers, !this.options.cacheLayers);\n              }\n\n              if (!this.options.cacheLayers && removable) {\n                delete this._cache[cacheKey];\n                delete this._cells[cellKey];\n                delete this._activeCells[cellKey];\n              }\n            }\n          }\n        }, this),\n      );\n    }\n  },\n\n  /**\n   * Styling Methods\n   */\n\n  resetStyle() {\n    this.options.style = this._originalStyle;\n    this.eachFeature(function (layer) {\n      this.resetFeatureStyle(layer.feature.id);\n    }, this);\n    return this;\n  },\n\n  setStyle(style) {\n    this.options.style = style;\n    this.eachFeature(function (layer) {\n      this.setFeatureStyle(layer.feature.id, style);\n    }, this);\n    return this;\n  },\n\n  resetFeatureStyle(id) {\n    const layer = this._layers[id];\n    const style = this._originalStyle || Path.prototype.options;\n    if (layer) {\n      Util.extend(layer.options, layer.defaultOptions);\n      this.setFeatureStyle(id, style);\n    }\n    return this;\n  },\n\n  setFeatureStyle(id, style) {\n    const layer = this._layers[id];\n    if (typeof style === \"function\") {\n      style = style(layer.feature);\n    }\n    if (layer.setStyle) {\n      layer.setStyle(style);\n    }\n    return this;\n  },\n\n  /**\n   * Utility Methods\n   */\n\n  eachActiveFeature(fn, context) {\n    // figure out (roughly) which layers are in view\n    if (this._map) {\n      const activeBounds = this._map.getBounds();\n      for (const i in this._layers) {\n        if (this._currentSnapshot.indexOf(this._layers[i].feature.id) !== -1) {\n          // a simple point in poly test for point geometries\n          if (\n            typeof this._layers[i].getLatLng === \"function\" &&\n            activeBounds.contains(this._layers[i].getLatLng())\n          ) {\n            fn.call(context, this._layers[i]);\n          } else if (\n            typeof this._layers[i].getBounds === \"function\" &&\n            activeBounds.intersects(this._layers[i].getBounds())\n          ) {\n            // intersecting bounds check for polyline and polygon geometries\n            fn.call(context, this._layers[i]);\n          }\n        }\n      }\n    }\n    return this;\n  },\n\n  eachFeature(fn, context) {\n    for (const i in this._layers) {\n      fn.call(context, this._layers[i]);\n    }\n    return this;\n  },\n\n  getFeature(id) {\n    return this._layers[id];\n  },\n\n  bringToBack() {\n    this.eachFeature((layer) => {\n      if (layer.bringToBack) {\n        layer.bringToBack();\n      }\n    });\n  },\n\n  bringToFront() {\n    this.eachFeature((layer) => {\n      if (layer.bringToFront) {\n        layer.bringToFront();\n      }\n    });\n  },\n\n  redraw(id) {\n    if (id) {\n      this._redraw(id);\n    }\n    return this;\n  },\n\n  _redraw(id) {\n    const layer = this._layers[id];\n    const geojson = layer.feature;\n\n    // if this looks like a marker\n    if (layer && layer.setIcon && this.options.pointToLayer) {\n      // update custom symbology, if necessary\n      if (this.options.pointToLayer) {\n        const getIcon = this.options.pointToLayer(\n          geojson,\n          latLng(\n            geojson.geometry.coordinates[1],\n            geojson.geometry.coordinates[0],\n          ),\n        );\n        const updatedIcon = getIcon.options.icon;\n        layer.setIcon(updatedIcon);\n      }\n    }\n\n    // looks like a vector marker (circleMarker)\n    if (layer && layer.setStyle && this.options.pointToLayer) {\n      const getStyle = this.options.pointToLayer(\n        geojson,\n        latLng(\n          geojson.geometry.coordinates[1],\n          geojson.geometry.coordinates[0],\n        ),\n      );\n      const updatedStyle = getStyle.options;\n      this.setFeatureStyle(geojson.id, updatedStyle);\n    }\n\n    // looks like a path (polygon/polyline)\n    if (layer && layer.setStyle && this.options.style) {\n      this.resetFeatureStyle(geojson.id);\n    }\n  },\n\n  // This is the same as the Layer.openPopup method except it excludes the `FeatureGroup`\n  // logic to work around https://github.com/Leaflet/Leaflet/issues/8761\n  openPopup(latlng) {\n    if (this._popup) {\n      if (this._popup._prepareOpen(latlng || this._latlng)) {\n        // open the popup on the map\n        this._popup.openOn(this._map);\n      }\n    }\n    return this;\n  },\n\n  // This is the same as the `Layer.openTooltip` method except it excludes the `FeatureGroup`\n  // logic to work around https://github.com/Leaflet/Leaflet/issues/8761\n  openTooltip(latlng) {\n    if (this._tooltip) {\n      if (this._tooltip._prepareOpen(latlng)) {\n        // open the tooltip on the map\n        this._tooltip.openOn(this._map);\n\n        if (this.getElement) {\n          this._setAriaDescribedByOnLayer(this);\n        } else if (this.eachLayer) {\n          this.eachLayer(this._setAriaDescribedByOnLayer, this);\n        }\n      }\n    }\n    return this;\n  },\n});\n\nexport function featureLayer(options) {\n  return new FeatureLayer(options);\n}\n\nexport default featureLayer;\n","// export version\nimport packageInfo from \"../package.json\";\nconst version = packageInfo.version;\nexport { version as VERSION };\n\n// import base\nexport { Support } from \"./Support.js\";\nexport { options } from \"./Options.js\";\nexport { EsriUtil as Util } from \"./Util.js\";\nexport { get, post, request } from \"./Request.js\";\n\n// export tasks\nexport { Task, task } from \"./Tasks/Task.js\";\nexport { Query, query } from \"./Tasks/Query.js\";\nexport { Find, find } from \"./Tasks/Find.js\";\nexport { Identify, identify } from \"./Tasks/Identify.js\";\nexport {\n  IdentifyFeatures,\n  identifyFeatures,\n} from \"./Tasks/IdentifyFeatures.js\";\nexport { IdentifyImage, identifyImage } from \"./Tasks/IdentifyImage.js\";\n\n// export services\nexport { Service, service } from \"./Services/Service.js\";\nexport { MapService, mapService } from \"./Services/MapService.js\";\nexport { ImageService, imageService } from \"./Services/ImageService.js\";\nexport {\n  FeatureLayerService,\n  featureLayerService,\n} from \"./Services/FeatureLayerService.js\";\n\n// export layers\nexport { BasemapLayer, basemapLayer } from \"./Layers/BasemapLayer.js\";\nexport { TiledMapLayer, tiledMapLayer } from \"./Layers/TiledMapLayer.js\";\nexport { RasterLayer } from \"./Layers/RasterLayer.js\";\nexport { ImageMapLayer, imageMapLayer } from \"./Layers/ImageMapLayer.js\";\nexport { DynamicMapLayer, dynamicMapLayer } from \"./Layers/DynamicMapLayer.js\";\nexport { FeatureManager } from \"./Layers/FeatureLayer/FeatureManager.js\";\nexport {\n  FeatureLayer,\n  featureLayer,\n} from \"./Layers/FeatureLayer/FeatureLayer.js\";\n"]}