# HG changeset patch # User Thierry Florac # Date 1540290187 -7200 # Node ID 77c839e343af9dd19f69c7491307d645b919db7c # Parent 2c4dc7ef5ccb85f15cf325f8b7d2262c0dd0520b Version 0.1.12 diff -r 2c4dc7ef5ccb -r 77c839e343af .installed.cfg --- a/.installed.cfg Wed Oct 17 16:09:48 2018 +0200 +++ b/.installed.cfg Tue Oct 23 12:23:07 2018 +0200 @@ -15,14 +15,14 @@ [package] __buildout_installed__ = /home/tflorac/Dropbox/src/PyAMS/pyams_gis/bin/pcreate - /home/tflorac/Dropbox/src/PyAMS/pyams_gis/bin/prequest + /home/tflorac/Dropbox/src/PyAMS/pyams_gis/bin/pviews + /home/tflorac/Dropbox/src/PyAMS/pyams_gis/bin/pshell + /home/tflorac/Dropbox/src/PyAMS/pyams_gis/bin/proutes /home/tflorac/Dropbox/src/PyAMS/pyams_gis/bin/pdistreport /home/tflorac/Dropbox/src/PyAMS/pyams_gis/bin/pserve - /home/tflorac/Dropbox/src/PyAMS/pyams_gis/bin/pviews - /home/tflorac/Dropbox/src/PyAMS/pyams_gis/bin/proutes - /home/tflorac/Dropbox/src/PyAMS/pyams_gis/bin/pshell + /home/tflorac/Dropbox/src/PyAMS/pyams_gis/bin/prequest /home/tflorac/Dropbox/src/PyAMS/pyams_gis/bin/ptweens -__buildout_signature__ = zc.recipe.egg-8f8815b05e6871a2c4acf8d9c9b6e98f zc.buildout-2.10.0-py3.5.egg setuptools-8f8815b05e6871a2c4acf8d9c9b6e98f +__buildout_signature__ = zc.recipe.egg-1cfa1feb0fa42aa4d8579505a97c12a0 zc.buildout-1cfa1feb0fa42aa4d8579505a97c12a0 setuptools-1cfa1feb0fa42aa4d8579505a97c12a0 _b = /home/tflorac/Dropbox/src/PyAMS/pyams_gis/bin _d = /home/tflorac/Dropbox/src/PyAMS/pyams_gis/develop-eggs _e = /var/local/env/pyams/eggs @@ -40,7 +40,7 @@ __buildout_installed__ = /home/tflorac/Dropbox/src/PyAMS/pyams_gis/bin/pybabel /home/tflorac/Dropbox/src/PyAMS/pyams_gis/bin/pot-create /home/tflorac/Dropbox/src/PyAMS/pyams_gis/bin/polint -__buildout_signature__ = zc.recipe.egg-8f8815b05e6871a2c4acf8d9c9b6e98f zc.buildout-2.10.0-py3.5.egg setuptools-8f8815b05e6871a2c4acf8d9c9b6e98f +__buildout_signature__ = zc.recipe.egg-1cfa1feb0fa42aa4d8579505a97c12a0 zc.buildout-1cfa1feb0fa42aa4d8579505a97c12a0 setuptools-1cfa1feb0fa42aa4d8579505a97c12a0 _b = /home/tflorac/Dropbox/src/PyAMS/pyams_gis/bin _d = /home/tflorac/Dropbox/src/PyAMS/pyams_gis/develop-eggs _e = /var/local/env/pyams/eggs @@ -55,7 +55,7 @@ [pyflakes] __buildout_installed__ = /home/tflorac/Dropbox/src/PyAMS/pyams_gis/bin/pyflakes /home/tflorac/Dropbox/src/PyAMS/pyams_gis/bin/pyflakes -__buildout_signature__ = zc.recipe.egg-8f8815b05e6871a2c4acf8d9c9b6e98f zc.buildout-2.10.0-py3.5.egg setuptools-8f8815b05e6871a2c4acf8d9c9b6e98f +__buildout_signature__ = zc.recipe.egg-1cfa1feb0fa42aa4d8579505a97c12a0 zc.buildout-1cfa1feb0fa42aa4d8579505a97c12a0 setuptools-1cfa1feb0fa42aa4d8579505a97c12a0 _b = /home/tflorac/Dropbox/src/PyAMS/pyams_gis/bin _d = /home/tflorac/Dropbox/src/PyAMS/pyams_gis/develop-eggs _e = /var/local/env/pyams/eggs @@ -72,7 +72,7 @@ [test] __buildout_installed__ = /home/tflorac/Dropbox/src/PyAMS/pyams_gis/parts/test /home/tflorac/Dropbox/src/PyAMS/pyams_gis/bin/test -__buildout_signature__ = six-8f8815b05e6871a2c4acf8d9c9b6e98f zc.recipe.testrunner-8f8815b05e6871a2c4acf8d9c9b6e98f zc.recipe.egg-8f8815b05e6871a2c4acf8d9c9b6e98f zc.buildout-2.10.0-py3.5.egg zope.exceptions-8f8815b05e6871a2c4acf8d9c9b6e98f zope.interface-8f8815b05e6871a2c4acf8d9c9b6e98f zope.testrunner-8f8815b05e6871a2c4acf8d9c9b6e98f setuptools-8f8815b05e6871a2c4acf8d9c9b6e98f +__buildout_signature__ = six-1cfa1feb0fa42aa4d8579505a97c12a0 zc.recipe.testrunner-1cfa1feb0fa42aa4d8579505a97c12a0 zc.recipe.egg-1cfa1feb0fa42aa4d8579505a97c12a0 zc.buildout-1cfa1feb0fa42aa4d8579505a97c12a0 zope.exceptions-1cfa1feb0fa42aa4d8579505a97c12a0 zope.interface-1cfa1feb0fa42aa4d8579505a97c12a0 zope.testrunner-1cfa1feb0fa42aa4d8579505a97c12a0 setuptools-1cfa1feb0fa42aa4d8579505a97c12a0 _b = /home/tflorac/Dropbox/src/PyAMS/pyams_gis/bin _d = /home/tflorac/Dropbox/src/PyAMS/pyams_gis/develop-eggs _e = /var/local/env/pyams/eggs diff -r 2c4dc7ef5ccb -r 77c839e343af bootstrap.py --- a/bootstrap.py Wed Oct 17 16:09:48 2018 +0200 +++ b/bootstrap.py Tue Oct 23 12:23:07 2018 +0200 @@ -25,7 +25,10 @@ from optparse import OptionParser -tmpeggs = tempfile.mkdtemp() +__version__ = '2015-07-01' +# See zc.buildout's changelog if this version is up to date. + +tmpeggs = tempfile.mkdtemp(prefix='bootstrap-') usage = '''\ [DESIRED PYTHON FOR BUILDOUT] bootstrap.py [options] @@ -35,18 +38,19 @@ Simply run this script in a directory containing a buildout.cfg, using the Python that you want bin/buildout to use. -Note that by using --find-links to point to local resources, you can keep +Note that by using --find-links to point to local resources, you can keep this script from going over the network. ''' parser = OptionParser(usage=usage) -parser.add_option("-v", "--version", help="use a specific zc.buildout version") - +parser.add_option("--version", + action="store_true", default=False, + help=("Return bootstrap.py version.")) parser.add_option("-t", "--accept-buildout-test-releases", dest='accept_buildout_test_releases', action="store_true", default=False, - help=("Normally, if you do not specify a --version, the " - "bootstrap script and buildout gets the newest " + help=("Normally, if you do not specify a --buildout-version, " + "the bootstrap script and buildout gets the newest " "*final* versions of zc.buildout and its recipes and " "extensions for you. If you use this flag, " "bootstrap and buildout will get the newest releases " @@ -59,36 +63,57 @@ parser.add_option("--allow-site-packages", action="store_true", default=False, help=("Let bootstrap.py use existing site packages")) - +parser.add_option("--buildout-version", + help="Use a specific zc.buildout version") +parser.add_option("--setuptools-version", + help="Use a specific setuptools version") +parser.add_option("--setuptools-to-dir", + help=("Allow for re-use of existing directory of " + "setuptools versions")) options, args = parser.parse_args() +if options.version: + print("bootstrap.py version %s" % __version__) + sys.exit(0) + ###################################################################### # load/install setuptools try: - if options.allow_site_packages: - import setuptools - import pkg_resources from urllib.request import urlopen except ImportError: from urllib2 import urlopen ez = {} -exec(urlopen('https://bootstrap.pypa.io/ez_setup.py').read(), ez) +if os.path.exists('ez_setup.py'): + exec(open('ez_setup.py').read(), ez) +else: + exec(urlopen('https://bootstrap.pypa.io/ez_setup.py').read(), ez) if not options.allow_site_packages: # ez_setup imports site, which adds site packages - # this will remove them from the path to ensure that incompatible versions + # this will remove them from the path to ensure that incompatible versions # of setuptools are not in the path import site - # inside a virtualenv, there is no 'getsitepackages'. + # inside a virtualenv, there is no 'getsitepackages'. # We can't remove these reliably if hasattr(site, 'getsitepackages'): for sitepackage_path in site.getsitepackages(): - sys.path[:] = [x for x in sys.path if sitepackage_path not in x] + # Strip all site-packages directories from sys.path that + # are not sys.prefix; this is because on Windows + # sys.prefix is a site-package directory. + if sitepackage_path != sys.prefix: + sys.path[:] = [x for x in sys.path + if sitepackage_path not in x] setup_args = dict(to_dir=tmpeggs, download_delay=0) + +if options.setuptools_version is not None: + setup_args['version'] = options.setuptools_version +if options.setuptools_to_dir is not None: + setup_args['to_dir'] = options.setuptools_to_dir + ez['use_setuptools'](**setup_args) import setuptools import pkg_resources @@ -104,7 +129,12 @@ ws = pkg_resources.working_set +setuptools_path = ws.find( + pkg_resources.Requirement.parse('setuptools')).location + +# Fix sys.path here as easy_install.pth added before PYTHONPATH cmd = [sys.executable, '-c', + 'import sys; sys.path[0:0] = [%r]; ' % setuptools_path + 'from setuptools.command.easy_install import main; main()', '-mZqNxd', tmpeggs] @@ -117,21 +147,23 @@ if find_links: cmd.extend(['-f', find_links]) -setuptools_path = ws.find( - pkg_resources.Requirement.parse('setuptools')).location - requirement = 'zc.buildout' -version = options.version +version = options.buildout_version if version is None and not options.accept_buildout_test_releases: # Figure out the most recent final version of zc.buildout. import setuptools.package_index _final_parts = '*final-', '*final' def _final_version(parsed_version): - for part in parsed_version: - if (part[:1] == '*') and (part not in _final_parts): - return False - return True + try: + return not parsed_version.is_prerelease + except AttributeError: + # Older setuptools + for part in parsed_version: + if (part[:1] == '*') and (part not in _final_parts): + return False + return True + index = setuptools.package_index.PackageIndex( search_path=[setuptools_path]) if find_links: @@ -156,7 +188,7 @@ cmd.append(requirement) import subprocess -if subprocess.call(cmd, env=dict(os.environ, PYTHONPATH=setuptools_path)) != 0: +if subprocess.call(cmd) != 0: raise Exception( "Failed to execute command:\n%s" % repr(cmd)[1:-1]) diff -r 2c4dc7ef5ccb -r 77c839e343af buildout.cfg --- a/buildout.cfg Wed Oct 17 16:09:48 2018 +0200 +++ b/buildout.cfg Tue Oct 23 12:23:07 2018 +0200 @@ -70,5 +70,5 @@ eggs = pyams_gis [test] [versions] -pyams_gis = 0.1.11 +pyams_gis = 0.1.12 GDAL = 2.1.0 diff -r 2c4dc7ef5ccb -r 77c839e343af docs/HISTORY.txt --- a/docs/HISTORY.txt Wed Oct 17 16:09:48 2018 +0200 +++ b/docs/HISTORY.txt Tue Oct 23 12:23:07 2018 +0200 @@ -1,6 +1,10 @@ History ======= +0.1.12 +------ + - updated internal objects forms templates + 0.1.11 ------ - updated widgets templates diff -r 2c4dc7ef5ccb -r 77c839e343af setup.py --- a/setup.py Wed Oct 17 16:09:48 2018 +0200 +++ b/setup.py Tue Oct 23 12:23:07 2018 +0200 @@ -22,7 +22,7 @@ README = os.path.join(DOCS, 'README.txt') HISTORY = os.path.join(DOCS, 'HISTORY.txt') -version = '0.1.11' +version = '0.1.12' long_description = open(README).read() + '\n\n' + open(HISTORY).read() tests_require = [] diff -r 2c4dc7ef5ccb -r 77c839e343af src/pyams_gis.egg-info/PKG-INFO --- a/src/pyams_gis.egg-info/PKG-INFO Wed Oct 17 16:09:48 2018 +0200 +++ b/src/pyams_gis.egg-info/PKG-INFO Tue Oct 23 12:23:07 2018 +0200 @@ -1,12 +1,11 @@ -Metadata-Version: 1.1 +Metadata-Version: 2.1 Name: pyams-gis -Version: 0.1.11 +Version: 0.1.12 Summary: PyAMS GIS helpers interfaces and classes Home-page: http://hg.ztfy.org/pyams/pyams_gis Author: Thierry Florac Author-email: tflorac@ulthar.net License: ZPL -Description-Content-Type: UNKNOWN Description: sudo apt-get install libgdal-dev @@ -18,6 +17,10 @@ History ======= + 0.1.12 + ------ + - updated internal objects forms templates + 0.1.11 ------ - updated widgets templates @@ -83,3 +86,4 @@ Classifier: Programming Language :: Python Classifier: Framework :: Pyramid Classifier: Topic :: Software Development :: Libraries :: Python Modules +Provides-Extra: test diff -r 2c4dc7ef5ccb -r 77c839e343af src/pyams_gis/resources/js/leaflet-esri-2.0.8.min.js --- a/src/pyams_gis/resources/js/leaflet-esri-2.0.8.min.js Wed Oct 17 16:09:48 2018 +0200 +++ b/src/pyams_gis/resources/js/leaflet-esri-2.0.8.min.js Tue Oct 23 12:23:07 2018 +0200 @@ -1,1 +1,1 @@ -(function(b,a){typeof exports==="object"&&typeof module!=="undefined"?a(exports,require("leaflet")):typeof define==="function"&&define.amd?define(["exports","leaflet"],a):(a((b.L=b.L||{},b.L.esri=b.L.esri||{}),b.L))}(this,function(O,S){var Y="default" in S?S["default"]:S;var s="2.0.8";var aJ=((window.XMLHttpRequest&&"withCredentials" in new window.XMLHttpRequest()));var a=document.documentElement.style.pointerEvents==="";var ag={cors:aJ,pointerEvents:a};var W={attributionWidthOffset:55};var o=0;function c(aP){var aN="";aP.f=aP.f||"json";for(var aK in aP){if(aP.hasOwnProperty(aK)){var aO=aP[aK];var aL=Object.prototype.toString.call(aO);var aM;if(aN.length){aN+="&"}if(aL==="[object Array]"){aM=(Object.prototype.toString.call(aO[0])==="[object Object]")?JSON.stringify(aO):aO.join(",")}else{if(aL==="[object Object]"){aM=JSON.stringify(aO)}else{if(aL==="[object Date]"){aM=aO.valueOf()}else{aM=aO}}}aN+=encodeURIComponent(aK)+"="+encodeURIComponent(aM)}}return aN}function y(aM,aL){var aK=new window.XMLHttpRequest();aK.onerror=function(aN){aK.onreadystatechange=S.Util.falseFn;aM.call(aL,{error:{code:500,message:"XMLHttpRequest error"}},null)};aK.onreadystatechange=function(){var aN;var aO;if(aK.readyState===4){try{aN=JSON.parse(aK.responseText)}catch(aP){aN=null;aO={code:500,message:"Could not parse response as JSON. This could also be caused by a CORS or XMLHttpRequest error."}}if(!aO&&aN.error){aO=aN.error;aN=null}aK.onerror=S.Util.falseFn;aM.call(aL,aO,aN)}};aK.ontimeout=function(){this.onerror()};return aK}function aA(aL,aN,aO,aM){var aK=y(aO,aM);aK.open("POST",aL);if(typeof aM!=="undefined"&&aM!==null){if(typeof aM.options!=="undefined"){aK.timeout=aM.options.timeout}}aK.setRequestHeader("Content-Type","application/x-www-form-urlencoded");aK.send(c(aN));return aK}function b(aL,aN,aO,aM){var aK=y(aO,aM);aK.open("GET",aL+"?"+c(aN),true);if(typeof aM!=="undefined"&&aM!==null){if(typeof aM.options!=="undefined"){aK.timeout=aM.options.timeout}}aK.send(null);return aK}function ah(aL,aP,aQ,aN){var aO=c(aP);var aK=y(aQ,aN);var aM=(aL+"?"+aO).length;if(aM<=2000&&ag.cors){aK.open("GET",aL+"?"+aO)}else{if(aM>2000&&ag.cors){aK.open("POST",aL);aK.setRequestHeader("Content-Type","application/x-www-form-urlencoded")}}if(typeof aN!=="undefined"&&aN!==null){if(typeof aN.options!=="undefined"){aK.timeout=aN.options.timeout}}if(aM<=2000&&ag.cors){aK.send(null)}else{if(aM>2000&&ag.cors){aK.send(aO)}else{if(aM<=2000&&!ag.cors){return g(aL,aP,aQ,aN)}else{aF("a request to "+aL+" was longer then 2000 characters and this browser cannot make a cross-domain post request. Please use a proxy http://esri.github.io/esri-leaflet/api-reference/request.html");return}}}return aK}function g(aL,aO,aP,aM){window._EsriLeafletCallbacks=window._EsriLeafletCallbacks||{};var aN="c"+o;aO.callback="window._EsriLeafletCallbacks."+aN;window._EsriLeafletCallbacks[aN]=function(aQ){if(window._EsriLeafletCallbacks[aN]!==true){var aS;var aR=Object.prototype.toString.call(aQ);if(!(aR==="[object Object]"||aR==="[object Array]")){aS={error:{code:500,message:"Expected array or object as JSONP response"}};aQ=null}if(!aS&&aQ.error){aS=aQ;aQ=null}aP.call(aM,aS,aQ);window._EsriLeafletCallbacks[aN]=true}};var aK=S.DomUtil.create("script",null,document.body);aK.type="text/javascript";aK.src=aL+"?"+c(aO);aK.id=aN;o++;return{id:aN,url:aK.src,abort:function(){window._EsriLeafletCallbacks._callback[aN]({code:0,message:"Request aborted."})}}}var al=((ag.cors)?b:g);al.CORS=b;al.JSONP=g;var G={request:ah,get:al,post:aA};function af(aL,aK){for(var aM=0;aM=0)}function u(aO,aN,aS,aR){var aL=(aR[0]-aS[0])*(aO[1]-aS[1])-(aR[1]-aS[1])*(aO[0]-aS[0]);var aQ=(aN[0]-aO[0])*(aO[1]-aS[1])-(aN[1]-aO[1])*(aO[0]-aS[0]);var aP=(aR[1]-aS[1])*(aN[0]-aO[0])-(aR[0]-aS[0])*(aN[1]-aO[1]);if(aP!==0){var aM=aL/aP;var aK=aQ/aP;if(aM>=0&&aM<=1&&aK>=0&&aK<=1){return true}}return false}function h(aL,aK){for(var aN=0;aN=0;aU--){aP=aQ[aU][0];if(an(aP,aK)){aQ[aU].push(aK);aR=true;break}}if(!aR){aV.push(aK)}}while(aV.length){aK=aV.pop();var aO=false;for(aU=aQ.length-1;aU>=0;aU--){aP=aQ[aU][0];if(h(aP,aK)){aQ[aU].push(aK);aO=true;break}}if(!aO){aQ.push([aK.reverse()])}}if(aQ.length===1){return{type:"Polygon",coordinates:aQ[0]}}else{return{type:"MultiPolygon",coordinates:aQ}}}function I(aP){var aL=[];var aN=aP.slice(0);var aK=D(aN.shift().slice(0));if(aK.length>=4){if(!t(aK)){aK.reverse()}aL.push(aK);for(var aM=0;aM=4){if(t(aO)){aO.reverse()}aL.push(aO)}}}return aL}function p(aP){var aL=[];for(var aO=0;aO=0;aK--){var aM=aN[aK].slice(0);aL.push(aM)}}return aL}function ak(aM){var aL={};for(var aK in aM){if(aM.hasOwnProperty(aK)){aL[aK]=aM[aK]}}return aL}function e(aM,aL){var aK={};if(typeof aM.x==="number"&&typeof aM.y==="number"){aK.type="Point";aK.coordinates=[aM.x,aM.y]}if(aM.points){aK.type="MultiPoint";aK.coordinates=aM.points.slice(0)}if(aM.paths){if(aM.paths.length===1){aK.type="LineString";aK.coordinates=aM.paths[0].slice(0)}else{aK.type="MultiLineString";aK.coordinates=aM.paths.slice(0)}}if(aM.rings){aK=k(aM.rings.slice(0))}if(aM.geometry||aM.attributes){aK.type="Feature";aK.geometry=(aM.geometry)?e(aM.geometry):null;aK.properties=(aM.attributes)?ak(aM.attributes):null;if(aM.attributes){aK.id=aM.attributes[aL]||aM.attributes.OBJECTID||aM.attributes.FID}}return aK}function v(aL,aO){aO=aO||"OBJECTID";var aN={wkid:4326};var aK={};var aM;switch(aL.type){case"Point":aK.x=aL.coordinates[0];aK.y=aL.coordinates[1];aK.spatialReference=aN;break;case"MultiPoint":aK.points=aL.coordinates.slice(0);aK.spatialReference=aN;break;case"LineString":aK.paths=[aL.coordinates.slice(0)];aK.spatialReference=aN;break;case"MultiLineString":aK.paths=aL.coordinates.slice(0);aK.spatialReference=aN;break;case"Polygon":aK.rings=I(aL.coordinates.slice(0));aK.spatialReference=aN;break;case"MultiPolygon":aK.rings=p(aL.coordinates.slice(0));aK.spatialReference=aN;break;case"Feature":if(aL.geometry){aK.geometry=v(aL.geometry,aO)}aK.attributes=(aL.properties)?ak(aL.properties):{};if(aL.id){aK.attributes[aO]=aL.id}break;case"FeatureCollection":aK=[];for(aM=0;aM=0;aO--){var aT=ac(aL[aO],aQ);aK.features.push(aT)}}return aK}function T(aK){aK=S.Util.trim(aK);if(aK[aK.length-1]!=="/"){aK+="/"}return aK}function z(aK){return(/^(?!.*utility\.arcgis\.com).*\.arcgis\.com.*FeatureServer/i).test(aK)}function aI(aK){var aL;switch(aK){case"Point":aL="esriGeometryPoint";break;case"MultiPoint":aL="esriGeometryMultipoint";break;case"LineString":aL="esriGeometryPolyline";break;case"MultiLineString":aL="esriGeometryPolyline";break;case"Polygon":aL="esriGeometryPolygon";break;case"MultiPolygon":aL="esriGeometryPolygon";break}return aL}function aF(){if(console&&console.warn){console.warn.apply(console,arguments)}}function C(aK){return(aK.getSize().x-W.attributionWidthOffset)+"px"}function ay(aM){if(aM.attributionControl&&!aM.attributionControl._esriAttributionAdded){aM.attributionControl.setPrefix('Leaflet | Powered by Esri');var aL=document.createElement("style");aL.type="text/css";aL.innerHTML=".esri-truncated-attribution:hover {white-space: normal;}";document.getElementsByTagName("head")[0].appendChild(aL);S.DomUtil.addClass(aM.attributionControl._container,"esri-truncated-attribution:hover");var aK=document.createElement("style");aK.type="text/css";aK.innerHTML=".esri-truncated-attribution {vertical-align: -3px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;display: inline-block;transition: 0s white-space;transition-delay: 1s;max-width: "+C(aM)+";}";document.getElementsByTagName("head")[0].appendChild(aK);S.DomUtil.addClass(aM.attributionControl._container,"esri-truncated-attribution");aM.on("resize",function(aN){aM.attributionControl._container.style.maxWidth=C(aN.target)});aM.attributionControl._esriAttributionAdded=true}}function V(aK,aL){g(aK,{},S.Util.bind(function(aU,aM){if(aU){return}aL._esriAttributions=[];for(var aT=0;aT=aS.minZoom&&aU<=aS.maxZoom){aO+=(", "+aR)}}aO=aO.substr(2);var aT=aM.attributionControl._container.querySelector(".esri-dynamic-attribution");aT.innerHTML=aO;aT.style.maxWidth=C(aM);aM.fire("attributionupdated",{attribution:aO})}}var X={shallowClone:aD,warn:aF,cleanUrl:T,isArcgisOnline:z,geojsonTypeToArcGIS:aI,responseToFeatureCollection:r,geojsonToArcGIS:ap,arcgisToGeoJSON:ac,boundsToExtent:aj,extentToBounds:Q,calcAttributionWidth:C,setEsriAttribution:ay,_getAttributionData:V,_updateMapAttribution:aB};var aC=S.Class.extend({options:{proxy:false,useCors:aJ},generateSetter:function(aL,aK){return S.Util.bind(function(aM){this.params[aL]=aM;return this},aK)},initialize:function(aL){if(aL.request&&aL.options){this._service=aL;S.Util.setOptions(this,aL.options)}else{S.Util.setOptions(this,aL);this.options.url=T(aL.url)}this.params=S.Util.extend({},this.params||{});if(this.setters){for(var aM in this.setters){var aK=this.setters[aM];this[aM]=this.generateSetter(aK,this)}}},token:function(aK){if(this._service){this._service.authenticate(aK)}else{this.params.token=aK}return this},request:function(aL,aK){if(this._service){return this._service.request(this.path,this.params,aL,aK)}return this._request("request",this.path,this.params,aL,aK)},_request:function(aP,aM,aN,aO,aL){var aK=(this.options.proxy)?this.options.proxy+"?"+this.options.url+aM:this.options.url+aM;if((aP==="get"||aP==="request")&&!this.options.useCors){return G.get.JSONP(aK,aN,aO,aL)}return G[aP](aK,aN,aO,aL)}});function am(aK){return new aC(aK)}var R=aC.extend({setters:{offset:"resultOffset",limit:"resultRecordCount",fields:"outFields",precision:"geometryPrecision",featureIds:"objectIds",returnGeometry:"returnGeometry",token:"token"},path:"query",params:{returnGeometry:true,where:"1=1",outSr:4326,outFields:"*"},within:function(aK){this._setGeometry(aK);this.params.spatialRel="esriSpatialRelContains";return this},intersects:function(aK){this._setGeometry(aK);this.params.spatialRel="esriSpatialRelIntersects";return this},contains:function(aK){this._setGeometry(aK);this.params.spatialRel="esriSpatialRelWithin";return this},crosses:function(aK){this._setGeometry(aK);this.params.spatialRel="esriSpatialRelCrosses";return this},touches:function(aK){this._setGeometry(aK);this.params.spatialRel="esriSpatialRelTouches";return this},overlaps:function(aK){this._setGeometry(aK);this.params.spatialRel="esriSpatialRelOverlaps";return this},bboxIntersects:function(aK){this._setGeometry(aK);this.params.spatialRel="esriSpatialRelEnvelopeIntersects";return this},indexIntersects:function(aK){this._setGeometry(aK);this.params.spatialRel="esriSpatialRelIndexIntersects";return this},nearby:function(aL,aK){aL=S.latLng(aL);this.params.geometry=[aL.lng,aL.lat];this.params.geometryType="esriGeometryPoint";this.params.spatialRel="esriSpatialRelIntersects";this.params.units="esriSRUnit_Meter";this.params.distance=aK;this.params.inSr=4326;return this},where:function(aK){this.params.where=aK;return this},between:function(aL,aK){this.params.time=[aL.valueOf(),aK.valueOf()];return this},simplify:function(aM,aL){var aK=Math.abs(aM.getBounds().getWest()-aM.getBounds().getEast());this.params.maxAllowableOffset=(aK/aM.getSize().y)*aL;return this},orderBy:function(aL,aK){aK=aK||"ASC";this.params.orderByFields=(this.params.orderByFields)?this.params.orderByFields+",":"";this.params.orderByFields+=([aL,aK]).join(" ");return this},run:function(aL,aK){this._cleanParams();if(this.options.isModern||z(this.options.url)){this.params.f="geojson";return this.request(function(aN,aM){this._trapSQLerrors(aN);aL.call(aK,aN,aM,aM)},this)}else{return this.request(function(aN,aM){this._trapSQLerrors(aN);aL.call(aK,aN,(aM&&r(aM)),aM)},this)}},count:function(aL,aK){this._cleanParams();this.params.returnCountOnly=true;return this.request(function(aN,aM){aL.call(this,aN,(aM&&aM.count),aM)},aK)},ids:function(aL,aK){this._cleanParams();this.params.returnIdsOnly=true;return this.request(function(aN,aM){aL.call(this,aN,(aM&&aM.objectIds),aM)},aK)},bounds:function(aL,aK){this._cleanParams();this.params.returnExtentOnly=true;return this.request(function(aN,aM){if(aM&&aM.extent&&Q(aM.extent)){aL.call(aK,aN,Q(aM.extent),aM)}else{aN={message:"Invalid Bounds"};aL.call(aK,aN,null,aM)}},aK)},pixelSize:function(aK){var aL=S.point(aK);this.params.pixelSize=[aL.x,aL.y];return this},layer:function(aK){this.path=aK+"/query";return this},_trapSQLerrors:function(aK){if(aK){if(aK.code==="400"){aF("one common syntax error in query requests is encasing string values in double quotes instead of single quotes")}}},_cleanParams:function(){delete this.params.returnIdsOnly;delete this.params.returnExtentOnly;delete this.params.returnCountOnly},_setGeometry:function(aK){this.params.inSr=4326;if(aK instanceof S.LatLngBounds){this.params.geometry=aj(aK);this.params.geometryType="esriGeometryEnvelope";return}if(aK.getLatLng){aK=aK.getLatLng()}if(aK instanceof S.LatLng){aK={type:"Point",coordinates:[aK.lng,aK.lat]}}if(aK instanceof S.GeoJSON){aK=aK.getLayers()[0].feature.geometry;this.params.geometry=ap(aK);this.params.geometryType=aI(aK.type)}if(aK.toGeoJSON){aK=aK.toGeoJSON()}if(aK.type==="Feature"){aK=aK.geometry}if(aK.type==="Point"||aK.type==="LineString"||aK.type==="Polygon"||aK.type==="MultiPolygon"){this.params.geometry=ap(aK);this.params.geometryType=aI(aK.type);return}aF("invalid geometry passed to spatial query. Should be L.LatLng, L.LatLngBounds, L.Marker or a GeoJSON Point, Line, Polygon or MultiPolygon object");return}});function K(aK){return new R(aK)}var l=aC.extend({setters:{contains:"contains",text:"searchText",fields:"searchFields",spatialReference:"sr",sr:"sr",layers:"layers",returnGeometry:"returnGeometry",maxAllowableOffset:"maxAllowableOffset",precision:"geometryPrecision",dynamicLayers:"dynamicLayers",returnZ:"returnZ",returnM:"returnM",gdbVersion:"gdbVersion",token:"token"},path:"find",params:{sr:4326,contains:true,returnGeometry:true,returnZ:true,returnM:false},layerDefs:function(aL,aK){this.params.layerDefs=(this.params.layerDefs)?this.params.layerDefs+";":"";this.params.layerDefs+=([aL,aK]).join(":");return this},simplify:function(aM,aL){var aK=Math.abs(aM.getBounds().getWest()-aM.getBounds().getEast());this.params.maxAllowableOffset=(aK/aM.getSize().y)*aL;return this},run:function(aL,aK){return this.request(function(aN,aM){aL.call(aK,aN,(aM&&r(aM)),aM)},aK)}});function aH(aK){return new l(aK)}var ax=aC.extend({path:"identify",between:function(aL,aK){this.params.time=[aL.valueOf(),aK.valueOf()];return this}});function ao(aK){return new ax(aK)}var au=ax.extend({setters:{layers:"layers",precision:"geometryPrecision",tolerance:"tolerance",returnGeometry:"returnGeometry"},params:{sr:4326,layers:"all",tolerance:3,returnGeometry:true},on:function(aM){var aL=aj(aM.getBounds());var aK=aM.getSize();this.params.imageDisplay=[aK.x,aK.y,96];this.params.mapExtent=[aL.xmin,aL.ymin,aL.xmax,aL.ymax];return this},at:function(aK){aK=S.latLng(aK);this.params.geometry=[aK.lng,aK.lat];this.params.geometryType="esriGeometryPoint";return this},layerDef:function(aL,aK){this.params.layerDefs=(this.params.layerDefs)?this.params.layerDefs+";":"";this.params.layerDefs+=([aL,aK]).join(":");return this},simplify:function(aM,aL){var aK=Math.abs(aM.getBounds().getWest()-aM.getBounds().getEast());this.params.maxAllowableOffset=(aK/aM.getSize().y)*aL;return this},run:function(aL,aK){return this.request(function(aN,aM){if(aN){aL.call(aK,aN,undefined,aM);return}else{var aQ=r(aM);aM.results=aM.results.reverse();for(var aP=0;aP=0;aM--){aP.catalogItems.features[aM].properties.catalogItemVisibility=aO[aM]}}}return aP}});function n(aK){return new d(aK)}var ae=S.Evented.extend({options:{proxy:false,useCors:aJ,timeout:0},initialize:function(aK){aK=aK||{};this._requestQueue=[];this._authenticating=false;S.Util.setOptions(this,aK);this.options.url=T(this.options.url)},get:function(aL,aM,aN,aK){return this._request("get",aL,aM,aN,aK)},post:function(aL,aM,aN,aK){return this._request("post",aL,aM,aN,aK)},request:function(aL,aM,aN,aK){return this._request("request",aL,aM,aN,aK)},metadata:function(aL,aK){return this._request("get","",{},aL,aK)},authenticate:function(aK){this._authenticating=false;this.options.token=aK;this._runQueue();return this},getTimeout:function(){return this.options.timeout},setTimeout:function(aK){this.options.timeout=aK},_request:function(aQ,aM,aO,aP,aL){this.fire("requeststart",{url:this.options.url+aM,params:aO,method:aQ},true);var aN=this._createServiceCallback(aQ,aM,aO,aP,aL);if(this.options.token){aO.token=this.options.token}if(this._authenticating){this._requestQueue.push([aQ,aM,aO,aP,aL]);return}else{var aK=(this.options.proxy)?this.options.proxy+"?"+this.options.url+aM:this.options.url+aM;if((aQ==="get"||aQ==="request")&&!this.options.useCors){return G.get.JSONP(aK,aO,aN,aL)}else{return G[aQ](aK,aO,aN,aL)}}},_createServiceCallback:function(aO,aL,aM,aN,aK){return S.Util.bind(function(aQ,aP){if(aQ&&(aQ.code===499||aQ.code===498)){this._authenticating=true;this._requestQueue.push([aO,aL,aM,aN,aK]);this.fire("authenticationrequired",{authenticate:S.Util.bind(this.authenticate,this)},true);aQ.authenticate=S.Util.bind(this.authenticate,this)}aN.call(aK,aQ,aP);if(aQ){this.fire("requesterror",{url:this.options.url+aL,params:aM,message:aQ.message,code:aQ.code,method:aO},true)}else{this.fire("requestsuccess",{url:this.options.url+aL,params:aM,response:aP,method:aO},true)}this.fire("requestend",{url:this.options.url+aL,params:aM,method:aO},true)},this)},_runQueue:function(){for(var aK=this._requestQueue.length-1;aK>=0;aK--){var aL=this._requestQueue[aK];var aM=aL.shift();this[aM].apply(this,aL)}this._requestQueue=[]}});function aG(aK){return new ae(aK)}var m=ae.extend({identify:function(){return N(this)},find:function(){return aH(this)},query:function(){return K(this)}});function f(aK){return new m(aK)}var ar=ae.extend({query:function(){return K(this)},identify:function(){return n(this)}});function P(aK){return new ar(aK)}var az=ae.extend({options:{idAttribute:"OBJECTID"},query:function(){return K(this)},addFeature:function(aL,aM,aK){delete aL.id;aL=ap(aL);return this.post("addFeatures",{features:[aL]},function(aP,aO){var aN=(aO&&aO.addResults)?aO.addResults[0]:undefined;if(aM){aM.call(aK,aP||aO.addResults[0].error,aN)}},aK)},updateFeature:function(aL,aM,aK){aL=ap(aL,this.options.idAttribute);return this.post("updateFeatures",{features:[aL]},function(aP,aO){var aN=(aO&&aO.updateResults)?aO.updateResults[0]:undefined;if(aM){aM.call(aK,aP||aO.updateResults[0].error,aN)}},aK)},deleteFeature:function(aM,aL,aK){return this.post("deleteFeatures",{objectIds:aM},function(aP,aO){var aN=(aO&&aO.deleteResults)?aO.deleteResults[0]:undefined;if(aL){aL.call(aK,aP||aO.deleteResults[0].error,aN)}},aK)},deleteFeatures:function(aL,aM,aK){return this.post("deleteFeatures",{objectIds:aL},function(aP,aO){var aN=(aO&&aO.deleteResults)?aO.deleteResults:undefined;if(aM){aM.call(aK,aP||aO.deleteResults[0].error,aN)}},aK)}});function ab(aK){return new az(aK)}var x=(window.location.protocol!=="https:")?"http:":"https:";var ad=S.TileLayer.extend({statics:{TILES:{Streets:{urlTemplate:x+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:19,subdomains:["server","services"],attribution:"USGS, NOAA",attributionUrl:"https://static.arcgis.com/attribution/World_Street_Map"}},Topographic:{urlTemplate:x+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:19,subdomains:["server","services"],attribution:"USGS, NOAA",attributionUrl:"https://static.arcgis.com/attribution/World_Topo_Map"}},Oceans:{urlTemplate:x+"//{s}.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Base/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:16,subdomains:["server","services"],attribution:"USGS, NOAA",attributionUrl:"https://static.arcgis.com/attribution/Ocean_Basemap"}},OceansLabels:{urlTemplate:x+"//{s}.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Reference/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:16,subdomains:["server","services"],pane:(a)?"esri-labels":"tilePane"}},NationalGeographic:{urlTemplate:x+"//{s}.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:16,subdomains:["server","services"],attribution:"National Geographic, DeLorme, HERE, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, increment P Corp."}},DarkGray:{urlTemplate:x+"//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Dark_Gray_Base/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:16,subdomains:["server","services"],attribution:"HERE, DeLorme, MapmyIndia, © OpenStreetMap contributors"}},DarkGrayLabels:{urlTemplate:x+"//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Dark_Gray_Reference/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:16,subdomains:["server","services"],pane:(a)?"esri-labels":"tilePane",attribution:""}},Gray:{urlTemplate:x+"//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:16,subdomains:["server","services"],attribution:"HERE, DeLorme, MapmyIndia, © OpenStreetMap contributors"}},GrayLabels:{urlTemplate:x+"//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:16,subdomains:["server","services"],pane:(a)?"esri-labels":"tilePane",attribution:""}},Imagery:{urlTemplate:x+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:19,subdomains:["server","services"],attribution:"DigitalGlobe, GeoEye, i-cubed, USDA, USGS, AEX, Getmapping, Aerogrid, IGN, IGP, swisstopo, and the GIS User Community"}},ImageryLabels:{urlTemplate:x+"//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:19,subdomains:["server","services"],pane:(a)?"esri-labels":"tilePane",attribution:""}},ImageryTransportation:{urlTemplate:x+"//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Transportation/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:19,subdomains:["server","services"],pane:(a)?"esri-labels":"tilePane"}},ShadedRelief:{urlTemplate:x+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:13,subdomains:["server","services"],attribution:"USGS"}},ShadedReliefLabels:{urlTemplate:x+"//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places_Alternate/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:12,subdomains:["server","services"],pane:(a)?"esri-labels":"tilePane",attribution:""}},Terrain:{urlTemplate:x+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:13,subdomains:["server","services"],attribution:"USGS, NOAA"}},TerrainLabels:{urlTemplate:x+"//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Reference_Overlay/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:13,subdomains:["server","services"],pane:(a)?"esri-labels":"tilePane",attribution:""}},USATopo:{urlTemplate:x+"//{s}.arcgisonline.com/ArcGIS/rest/services/USA_Topo_Maps/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:15,subdomains:["server","services"],attribution:"USGS, National Geographic Society, i-cubed"}}}},initialize:function(aM,aL){var aK;if(typeof aM==="object"&&aM.urlTemplate&&aM.options){aK=aM}else{if(typeof aM==="string"&&ad.TILES[aM]){aK=ad.TILES[aM]}else{throw new Error('L.esri.BasemapLayer: Invalid parameter. Use one of "Streets", "Topographic", "Oceans", "OceansLabels", "NationalGeographic", "Gray", "GrayLabels", "DarkGray", "DarkGrayLabels", "Imagery", "ImageryLabels", "ImageryTransportation", "ShadedRelief", "ShadedReliefLabels", "Terrain", "TerrainLabels" or "USATopo"')}}var aN=S.Util.extend(aK.options,aL);S.Util.setOptions(this,aN);if(this.options.token){aK.urlTemplate+=("?token="+this.options.token)}S.TileLayer.prototype.initialize.call(this,aK.urlTemplate,aN)},onAdd:function(aK){ay(aK);if(this.options.pane==="esri-labels"){this._initPane()}if(this.options.attributionUrl){V(this.options.attributionUrl,aK)}aK.on("moveend",aB);S.TileLayer.prototype.onAdd.call(this,aK)},onRemove:function(aK){aK.off("moveend",aB);S.TileLayer.prototype.onRemove.call(this,aK)},_initPane:function(){if(!this._map.getPane(this.options.pane)){var aK=this._map.createPane(this.options.pane);aK.style.pointerEvents="none";aK.style.zIndex=500}},getAttribution:function(){if(this.options.attribution){var aK=''+this.options.attribution+""}return aK}});function w(aL,aK){return new ad(aL,aK)}var q=S.TileLayer.extend({options:{zoomOffsetAllowance:0.1,errorTileUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEABAMAAACuXLVVAAAAA1BMVEUzNDVszlHHAAAAAXRSTlMAQObYZgAAAAlwSFlzAAAAAAAAAAAB6mUWpAAAADZJREFUeJztwQEBAAAAgiD/r25IQAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA7waBAAABw08RwAAAAABJRU5ErkJggg=="},statics:{MercatorZoomLevels:{"0":156543.033928,"1":78271.5169639999,"2":39135.7584820001,"3":19567.8792409999,"4":9783.93962049996,"5":4891.96981024998,"6":2445.98490512499,"7":1222.99245256249,"8":611.49622628138,"9":305.748113140558,"10":152.874056570411,"11":76.4370282850732,"12":38.2185141425366,"13":19.1092570712683,"14":9.55462853563415,"15":4.77731426794937,"16":2.38865713397468,"17":1.19432856685505,"18":0.597164283559817,"19":0.298582141647617,"20":0.14929107082381,"21":0.07464553541191,"22":0.0373227677059525,"23":0.0186613838529763}},initialize:function(aK){aK.url=T(aK.url);aK=S.Util.setOptions(this,aK);this.tileUrl=aK.url+"tile/{z}/{y}/{x}";this.service=f(aK);this.service.addEventParent(this);var aL=new RegExp(/tiles.arcgis(online)?\.com/g);if(aL.test(aK.url)){this.tileUrl=this.tileUrl.replace("://tiles","://tiles{s}");aK.subdomains=["1","2","3","4"]}if(this.options.token){this.tileUrl+=("?token="+this.options.token)}S.TileLayer.prototype.initialize.call(this,this.tileUrl,aK)},getTileUrl:function(aK){var aL=this._getZoomForUrl();return S.Util.template(this.tileUrl,S.Util.extend({s:this._getSubdomain(aK),x:aK.x,y:aK.y,z:(this._lodMap&&this._lodMap[aL])?this._lodMap[aL]:aL},this.options))},createTile:function(aM,aK){var aL=document.createElement("img");L.DomEvent.on(aL,"load",L.bind(this._tileOnLoad,this,aK,aL));L.DomEvent.on(aL,"error",L.bind(this._tileOnError,this,aK,aL));if(this.options.crossOrigin){aL.crossOrigin=""}aL.alt="";if(!this._lodMap||(this._lodMap&&this._lodMap[this._getZoomForUrl()])){aL.src=this.getTileUrl(aM)}else{this.once("lodmap",function(){aL.src=this.getTileUrl(aM)},this)}return aL},onAdd:function(aK){ay(aK);if(!this._lodMap){this.metadata(function(aP,aQ){if(!aP&&aQ.spatialReference){var aL=aQ.spatialReference.latestWkid||aQ.spatialReference.wkid;if(!this.options.attribution&&aK.attributionControl&&aQ.copyrightText){this.options.attribution=aQ.copyrightText;aK.attributionControl.addAttribution(this.getAttribution())}if(aK.options.crs===L.CRS.EPSG3857&&aL===102100||aL===3857){this._lodMap={};var aM=aQ.tileInfo.lods;var aN=q.MercatorZoomLevels;for(var aO=0;aOthis.options.maxZoom||aL0||aL.y0||aL.yaM.max.x))||(!aK.wrapLat&&(aN.yaM.max.y))){return false}}if(!this.options.bounds){return true}var aL=this._cellCoordsToBounds(aN);return Y.latLngBounds(this.options.bounds).intersects(aL)},_cellCoordsToBounds:function(aO){var aP=this._map;var aQ=this.options.cellSize;var aM=aO.multiplyBy(aQ);var aK=aM.add([aQ,aQ]);var aL=aP.wrapLatLng(aP.unproject(aM,aO.z));var aN=aP.wrapLatLng(aP.unproject(aK,aO.z));return Y.latLngBounds(aL,aN)},_cellCoordsToKey:function(aK){return aK.x+":"+aK.y},_keyToCellCoords:function(aL){var aM=aL.split(":");var aK=parseInt(aM[0],10);var aN=parseInt(aM[1],10);return Y.point(aK,aN)},_removeOtherCells:function(aL){for(var aK in this._cells){if(!aL.contains(this._keyToCellCoords(aK))){this._removeCell(aK)}}},_removeCell:function(aL){var aK=this._activeCells[aL];if(aK){delete this._activeCells[aL];if(this.cellLeave){this.cellLeave(aK.bounds,aK.coords)}this.fire("cellleave",{bounds:aK.bounds,coords:aK.coords})}},_removeCells:function(){for(var aK in this._cells){var aL=this._cells[aK].bounds;var aM=this._cells[aK].coords;if(this.cellLeave){this.cellLeave(aL,aM)}this.fire("cellleave",{bounds:aL,coords:aM})}},_addCell:function(aM){this._wrapCoords(aM);var aL=this._cellCoordsToKey(aM);var aK=this._cells[aL];if(aK&&!this._activeCells[aL]){if(this.cellEnter){this.cellEnter(aK.bounds,aM)}this.fire("cellenter",{bounds:aK.bounds,coords:aM});this._activeCells[aL]=aK}if(!aK){aK={coords:aM,bounds:this._cellCoordsToBounds(aM)};this._cells[aL]=aK;this._activeCells[aL]=aK;if(this.createCell){this.createCell(aK.bounds,aM)}this.fire("cellcreate",{bounds:aK.bounds,coords:aM})}},_wrapCoords:function(aK){aK.x=this._wrapLng?Y.Util.wrapNum(aK.x,this._wrapLng):aK.x;aK.y=this._wrapLat?Y.Util.wrapNum(aK.y,this._wrapLat):aK.y},_getCellNumBounds:function(){var aL=this._map.getPixelWorldBounds();var aK=this._getCellSize();return aL?Y.bounds(aL.min.divideBy(aK).floor(),aL.max.divideBy(aK).ceil().subtract([1,1])):null}});function aa(aK){this.values=[].concat(aK||[])}aa.prototype.query=function(aL){var aK=this.getIndex(aL);return this.values[aK]};aa.prototype.getIndex=function i(aO){if(this.dirty){this.sort()}var aM=0;var aN=this.values.length-1;var aK;var aL;while(aM<=aN){aK=(aM+aN)/2|0;aL=this.values[Math.round(aK)];if(+aL.value<+aO){aM=aK+1}else{if(+aL.value>+aO){aN=aK-1}else{return aK}}}return Math.abs(~aN)};aa.prototype.between=function H(aN,aK){var aM=this.getIndex(aN);var aL=this.getIndex(aK);if(aM===0&&aL===0){return[]}while(this.values[aM-1]&&this.values[aM-1].value===aN){aM--}while(this.values[aL+1]&&this.values[aL+1].value===aK){aL++}if(this.values[aL]&&this.values[aL].value===aK&&this.values[aL+1]){aL++}return this.values.slice(aM,aL)};aa.prototype.insert=function B(aK){this.values.splice(this.getIndex(aK.value),0,aK);return this};aa.prototype.bulkAdd=function A(aK,aL){this.values=this.values.concat([].concat(aK||[]));if(aL){this.sort()}else{this.dirty=true}return this};aa.prototype.sort=function F(){this.values.sort(function(aL,aK){return +aK.value-+aL.value}).reverse();this.dirty=false;return this};var av=Z.extend({options:{attribution:null,where:"1=1",fields:["*"],from:false,to:false,timeField:false,timeFilterMode:"server",simplifyFactor:0,precision:6},initialize:function(aK){Z.prototype.initialize.call(this,aK);aK.url=T(aK.url);aK=S.setOptions(this,aK);this.service=ab(aK);this.service.addEventParent(this);if(this.options.fields[0]!=="*"){var aM=false;for(var aL=0;aL=0;aK--){var aO=aM[aK].id;if(this._currentSnapshot.indexOf(aO)===-1){this._currentSnapshot.push(aO)}if(this._cache[aL].indexOf(aO)===-1){this._cache[aL].push(aO)}}if(this.options.timeField){this._buildTimeIndexes(aM)}this.createLayers(aM)},_buildQuery:function(aK){var aL=this.service.query().intersects(aK).where(this.options.where).fields(this.options.fields).precision(this.options.precision);if(this.options.simplifyFactor){aL.simplify(this._map,this.options.simplifyFactor)}if(this.options.timeFilterMode==="server"&&this.options.from&&this.options.to){aL.between(this.options.from,this.options.to)}return aL},setWhere:function(aP,aU,aL){this.options.where=(aP&&aP.length)?aP:"1=1";var aN=[];var aT=[];var aM=0;var aR=null;var aV=S.Util.bind(function(aW,aY){if(aW){aR=aW}if(aY){for(var aX=aY.features.length-1;aX>=0;aX--){aT.push(aY.features[aX].id)}}aM--;if(aM<=0){this._currentSnapshot=aT;S.Util.requestAnimFrame(S.Util.bind(function(){this.removeLayers(aN);this.addLayers(aT);if(aU){aU.call(aL,aR)}},this))}},this);for(var aO=this._currentSnapshot.length-1;aO>=0;aO--){aN.push(this._currentSnapshot[aO])}for(var aS in this._activeCells){aM++;var aQ=this._keyToCellCoords(aS);var aK=this._cellCoordsToBounds(aQ);this._requestFeatures(aK,aS,aV)}return this},getWhere:function(){return this.options.where},getTimeRange:function(){return[this.options.from,this.options.to]},setTimeRange:function(aO,aP,aU,aL){var aT=this.options.from;var aS=this.options.to;var aM=0;var aQ=null;var aV=S.Util.bind(function(aW){if(aW){aQ=aW}this._filterExistingFeatures(aT,aS,aO,aP);aM--;if(aU&&aM<=0){aU.call(aL,aQ)}},this);this.options.from=aO;this.options.to=aP;this._filterExistingFeatures(aT,aS,aO,aP);if(this.options.timeFilterMode==="server"){for(var aR in this._activeCells){aM++;var aN=this._keyToCellCoords(aR);var aK=this._cellCoordsToBounds(aN);this._requestFeatures(aK,aR,aV)}}return this},refresh:function(){for(var aK in this._activeCells){var aM=this._keyToCellCoords(aK);var aL=this._cellCoordsToBounds(aM);this._requestFeatures(aL,aK)}if(this.redraw){this.once("load",function(){this.eachFeature(function(aN){this._redraw(aN.feature.id)},this)},this)}},_filterExistingFeatures:function(aL,aR,aP,aM){var aO=(aL&&aR)?this._getFeaturesInTimeRange(aL,aR):this._currentSnapshot;var aQ=this._getFeaturesInTimeRange(aP,aM);if(aQ.indexOf){for(var aN=0;aN=0){aO.splice(aK,1)}}}S.Util.requestAnimFrame(S.Util.bind(function(){this.removeLayers(aO);this.addLayers(aQ)},this))},_getFeaturesInTimeRange:function(aQ,aK){var aP=[];var aO;if(this.options.timeField.start&&this.options.timeField.end){var aN=this._startTimeIndex.between(aQ,aK);var aL=this._endTimeIndex.between(aQ,aK);aO=aN.concat(aL)}else{aO=this._timeIndex.between(aQ,aK)}for(var aM=aO.length-1;aM>=0;aM--){aP.push(aO[aM].id)}return aP},_buildTimeIndexes:function(aL){var aO;var aN;if(this.options.timeField.start&&this.options.timeField.end){var aP=[];var aK=[];for(aO=aL.length-1;aO>=0;aO--){aN=aL[aO];aP.push({id:aN.id,value:new Date(aN.properties[this.options.timeField.start])});aK.push({id:aN.id,value:new Date(aN.properties[this.options.timeField.end])})}this._startTimeIndex.bulkAdd(aP);this._endTimeIndex.bulkAdd(aK)}else{var aM=[];for(aO=aL.length-1;aO>=0;aO--){aN=aL[aO];aM.push({id:aN.id,value:new Date(aN.properties[this.options.timeField])})}this._timeIndex.bulkAdd(aM)}},_featureWithinTimeRange:function(aM){if(!this.options.from||!this.options.to){return true}var aP=+this.options.from.valueOf();var aO=+this.options.to.valueOf();if(typeof this.options.timeField==="string"){var aL=+aM.properties[this.options.timeField];return(aL>=aP)&&(aL<=aO)}if(this.options.timeField.start&&this.options.timeField.end){var aK=+aM.properties[this.options.timeField.start];var aN=+aM.properties[this.options.timeField.end];return((aK>=aP)&&(aK<=aO))||((aN>=aP)&&(aN<=aO))}},_visibleZoom:function(){if(!this._map){return false}var aK=this._map.getZoom();if(aK>this.options.maxZoom||aK0){for(var aP=0;aP=0;aM--){var aK=aO[aM];var aL=this._layers[aK.id];var aN;if(this._visibleZoom()&&aL&&!this._map.hasLayer(aL)){this._map.addLayer(aL);this.fire("addfeature",{feature:aL.feature},true)}if(aL&&this.options.simplifyFactor>0&&(aL.setLatLngs||aL.setLatLng)){this._updateLayer(aL,aK)}if(!aL){aN=this.createNewLayer(aK);aN.feature=aK;aN.addEventParent(this);if(this.options.onEachFeature){this.options.onEachFeature(aN.feature,aN)}this._layers[aN.feature.id]=aN;this.setFeatureStyle(aN.feature.id,this.options.style);this.fire("createfeature",{feature:aN.feature},true);if(this._visibleZoom()&&(!this.options.timeField||(this.options.timeField&&this._featureWithinTimeRange(aK)))){this._map.addLayer(aN)}}}},addLayers:function(aM){for(var aL=aM.length-1;aL>=0;aL--){var aK=this._layers[aM[aL]];if(aK){this._map.addLayer(aK)}}},removeLayers:function(aM,aN){for(var aL=aM.length-1;aL>=0;aL--){var aO=aM[aL];var aK=this._layers[aO];if(aK){this.fire("removefeature",{feature:aK.feature,permanent:aN},true);this._map.removeLayer(aK)}if(aK&&aN){delete this._layers[aO]}}},cellEnter:function(aK,aL){if(this._visibleZoom()&&!this._zooming&&this._map){S.Util.requestAnimFrame(S.Util.bind(function(){var aN=this._cacheKey(aL);var aO=this._cellCoordsToKey(aL);var aM=this._cache[aN];if(this._activeCells[aO]&&aM){this.addLayers(aM)}},this))}},cellLeave:function(aK,aL){if(!this._zooming){S.Util.requestAnimFrame(S.Util.bind(function(){if(this._map){var aR=this._cacheKey(aL);var aS=this._cellCoordsToKey(aL);var aQ=this._cache[aR];var aM=this._map.getBounds();if(!this._activeCells[aS]&&aQ){var aN=true;for(var aP=0;aP2e3&&J.cors&&(u.open("POST",t),u.setRequestHeader("Content-Type","application/x-www-form-urlencoded")),void 0!==n&&null!==n&&void 0!==n.options&&(u.timeout=n.options.timeout),l<=2e3&&J.cors)u.send(null);else{if(!(l>2e3&&J.cors))return l<=2e3&&!J.cors?a(t,e,r,n):void O("a request to "+t+" was longer then 2000 characters and this browser cannot make a cross-domain post request. Please use a proxy http://esri.github.io/esri-leaflet/api-reference/request.html");u.send(o)}return u}function a(t,s,r,n){window._EsriLeafletCallbacks=window._EsriLeafletCallbacks||{};var o="c"+H;s.callback="window._EsriLeafletCallbacks."+o,window._EsriLeafletCallbacks[o]=function(t){if(!0!==window._EsriLeafletCallbacks[o]){var e,i=Object.prototype.toString.call(t);"[object Object]"!==i&&"[object Array]"!==i&&(e={error:{code:500,message:"Expected array or object as JSONP response"}},t=null),!e&&t.error&&(e=t,t=null),r.call(n,e,t),window._EsriLeafletCallbacks[o]=!0}};var a=e.DomUtil.create("script",null,document.body);return a.type="text/javascript",a.src=t+"?"+i(s),a.id=o,H++,{id:o,url:a.src,abort:function(){window._EsriLeafletCallbacks._callback[o]({code:0,message:"Request aborted."})}}}function u(t,e){for(var i=0;i=0}function c(t,e,i,s){var r=(s[0]-i[0])*(t[1]-i[1])-(s[1]-i[1])*(t[0]-i[0]),n=(e[0]-t[0])*(t[1]-i[1])-(e[1]-t[1])*(t[0]-i[0]),o=(s[1]-i[1])*(e[0]-t[0])-(s[0]-i[0])*(e[1]-t[1]);if(0!==o){var a=r/o,u=n/o;if(a>=0&&a<=1&&u>=0&&u<=1)return!0}return!1}function p(t,e){for(var i=0;i=0;e--)if(i=r[e][0],m(i,s)){r[e].push(s),d=!0;break}d||c.push(s)}for(;c.length;){s=c.pop();var f=!1;for(e=r.length-1;e>=0;e--)if(i=r[e][0],p(i,s)){r[e].push(s),f=!0;break}f||r.push([s.reverse()])}return 1===r.length?{type:"Polygon",coordinates:r[0]}:{type:"MultiPolygon",coordinates:r}}function y(t){var e=[],i=t.slice(0),s=l(i.shift().slice(0));if(s.length>=4){h(s)||s.reverse(),e.push(s);for(var r=0;r=4&&(h(n)&&n.reverse(),e.push(n))}}return e}function g(t){for(var e=[],i=0;i=0;r--){var n=s[r].slice(0);e.push(n)}return e}function _(t){var e={};for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e}function v(t,e){var i={};return"number"==typeof t.x&&"number"==typeof t.y&&(i.type="Point",i.coordinates=[t.x,t.y]),t.points&&(i.type="MultiPoint",i.coordinates=t.points.slice(0)),t.paths&&(1===t.paths.length?(i.type="LineString",i.coordinates=t.paths[0].slice(0)):(i.type="MultiLineString",i.coordinates=t.paths.slice(0))),t.rings&&(i=f(t.rings.slice(0))),(t.geometry||t.attributes)&&(i.type="Feature",i.geometry=t.geometry?v(t.geometry):null,i.properties=t.attributes?_(t.attributes):null,t.attributes&&(i.id=t.attributes[e]||t.attributes.OBJECTID||t.attributes.FID)),i}function b(t,e){e=e||"OBJECTID";var i,s={wkid:4326},r={};switch(t.type){case"Point":r.x=t.coordinates[0],r.y=t.coordinates[1],r.spatialReference=s;break;case"MultiPoint":r.points=t.coordinates.slice(0),r.spatialReference=s;break;case"LineString":r.paths=[t.coordinates.slice(0)],r.spatialReference=s;break;case"MultiLineString":r.paths=t.coordinates.slice(0),r.spatialReference=s;break;case"Polygon":r.rings=y(t.coordinates.slice(0)),r.spatialReference=s;break;case"MultiPolygon":r.rings=g(t.coordinates.slice(0)),r.spatialReference=s;break;case"Feature":t.geometry&&(r.geometry=b(t.geometry,e)),r.attributes=t.properties?_(t.properties):{},t.id&&(r.attributes[e]=t.id);break;case"FeatureCollection":for(r=[],i=0;i=0;u--){var l=S(s[u],i);a.features.push(l)}return a}function w(t){return"/"!==(t=e.Util.trim(t))[t.length-1]&&(t+="/"),t}function R(t){return/^(?!.*utility\.arcgis\.com).*\.arcgis\.com.*FeatureServer/i.test(t)}function C(t){var e;switch(t){case"Point":e="esriGeometryPoint";break;case"MultiPoint":e="esriGeometryMultipoint";break;case"LineString":case"MultiLineString":e="esriGeometryPolyline";break;case"Polygon":case"MultiPolygon":e="esriGeometryPolygon"}return e}function O(){console&&console.warn&&console.warn.apply(console,arguments)}function F(t){return t.getSize().x-Q.attributionWidthOffset+"px"}function P(t){if(t.attributionControl&&!t.attributionControl._esriAttributionAdded){t.attributionControl.setPrefix('Leaflet | Powered by Esri');var i=document.createElement("style");i.type="text/css",i.innerHTML=".esri-truncated-attribution:hover {white-space: normal;}",document.getElementsByTagName("head")[0].appendChild(i),e.DomUtil.addClass(t.attributionControl._container,"esri-truncated-attribution:hover");var s=document.createElement("style");s.type="text/css",s.innerHTML=".esri-truncated-attribution {vertical-align: -3px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;display: inline-block;transition: 0s white-space;transition-delay: 1s;max-width: "+F(t)+";}",document.getElementsByTagName("head")[0].appendChild(s),e.DomUtil.addClass(t.attributionControl._container,"esri-truncated-attribution"),t.on("resize",function(e){t.attributionControl._container.style.maxWidth=F(e.target)}),t.attributionControl._esriAttributionAdded=!0}}function k(t,i){a(t,{},e.Util.bind(function(t,s){if(!t){i._esriAttributions=[];for(var r=0;r=l.minZoom&&a<=l.maxZoom&&(r+=", "+h)}r=r.substr(2);var c=i.attributionControl._container.querySelector(".esri-dynamic-attribution");c.innerHTML=r,c.style.maxWidth=F(i),i.fire("attributionupdated",{attribution:r})}}function G(t){return new Y(t)}function E(t){return new tt(t)}function U(t){return new it(t)}function q(t){return new st(t)}function D(t){return new nt(t)}function B(t){return new ot(t)}function z(t){return new at(t)}function N(t){this.values=[].concat(t||[])}var j="default"in e?e.default:e,Z=window.XMLHttpRequest&&"withCredentials"in new window.XMLHttpRequest,W=""===document.documentElement.style.pointerEvents,J={cors:Z,pointerEvents:W},Q={attributionWidthOffset:55},H=0,V=J.cors?n:a;V.CORS=n,V.JSONP=a;var K={request:o,get:V,post:r},X={shallowClone:function(t){var e={};for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e},warn:O,cleanUrl:w,isArcgisOnline:R,geojsonTypeToArcGIS:C,responseToFeatureCollection:I,geojsonToArcGIS:x,arcgisToGeoJSON:S,boundsToExtent:T,extentToBounds:A,calcAttributionWidth:F,setEsriAttribution:P,_getAttributionData:k,_updateMapAttribution:M},$=e.Class.extend({options:{proxy:!1,useCors:Z},generateSetter:function(t,i){return e.Util.bind(function(e){return this.params[t]=e,this},i)},initialize:function(t){if(t.request&&t.options?(this._service=t,e.Util.setOptions(this,t.options)):(e.Util.setOptions(this,t),this.options.url=w(t.url)),this.params=e.Util.extend({},this.params||{}),this.setters)for(var i in this.setters){var s=this.setters[i];this[i]=this.generateSetter(s,this)}},token:function(t){return this._service?this._service.authenticate(t):this.params.token=t,this},request:function(t,e){return this._service?this._service.request(this.path,this.params,t,e):this._request("request",this.path,this.params,t,e)},_request:function(t,e,i,s,r){var n=this.options.proxy?this.options.proxy+"?"+this.options.url+e:this.options.url+e;return"get"!==t&&"request"!==t||this.options.useCors?K[t](n,i,s,r):K.get.JSONP(n,i,s,r)}}),Y=$.extend({setters:{offset:"resultOffset",limit:"resultRecordCount",fields:"outFields",precision:"geometryPrecision",featureIds:"objectIds",returnGeometry:"returnGeometry",token:"token"},path:"query",params:{returnGeometry:!0,where:"1=1",outSr:4326,outFields:"*"},within:function(t){return this._setGeometry(t),this.params.spatialRel="esriSpatialRelContains",this},intersects:function(t){return this._setGeometry(t),this.params.spatialRel="esriSpatialRelIntersects",this},contains:function(t){return this._setGeometry(t),this.params.spatialRel="esriSpatialRelWithin",this},crosses:function(t){return this._setGeometry(t),this.params.spatialRel="esriSpatialRelCrosses",this},touches:function(t){return this._setGeometry(t),this.params.spatialRel="esriSpatialRelTouches",this},overlaps:function(t){return this._setGeometry(t),this.params.spatialRel="esriSpatialRelOverlaps",this},bboxIntersects:function(t){return this._setGeometry(t),this.params.spatialRel="esriSpatialRelEnvelopeIntersects",this},indexIntersects:function(t){return this._setGeometry(t),this.params.spatialRel="esriSpatialRelIndexIntersects",this},nearby:function(t,i){return t=e.latLng(t),this.params.geometry=[t.lng,t.lat],this.params.geometryType="esriGeometryPoint",this.params.spatialRel="esriSpatialRelIntersects",this.params.units="esriSRUnit_Meter",this.params.distance=i,this.params.inSr=4326,this},where:function(t){return this.params.where=t,this},between:function(t,e){return this.params.time=[t.valueOf(),e.valueOf()],this},simplify:function(t,e){var i=Math.abs(t.getBounds().getWest()-t.getBounds().getEast());return this.params.maxAllowableOffset=i/t.getSize().y*e,this},orderBy:function(t,e){return e=e||"ASC",this.params.orderByFields=this.params.orderByFields?this.params.orderByFields+",":"",this.params.orderByFields+=[t,e].join(" "),this},run:function(t,e){return this._cleanParams(),this.options.isModern||R(this.options.url)?(this.params.f="geojson",this.request(function(i,s){this._trapSQLerrors(i),t.call(e,i,s,s)},this)):this.request(function(i,s){this._trapSQLerrors(i),t.call(e,i,s&&I(s),s)},this)},count:function(t,e){return this._cleanParams(),this.params.returnCountOnly=!0,this.request(function(e,i){t.call(this,e,i&&i.count,i)},e)},ids:function(t,e){return this._cleanParams(),this.params.returnIdsOnly=!0,this.request(function(e,i){t.call(this,e,i&&i.objectIds,i)},e)},bounds:function(t,e){return this._cleanParams(),this.params.returnExtentOnly=!0,this.request(function(i,s){s&&s.extent&&A(s.extent)?t.call(e,i,A(s.extent),s):(i={message:"Invalid Bounds"},t.call(e,i,null,s))},e)},pixelSize:function(t){var i=e.point(t);return this.params.pixelSize=[i.x,i.y],this},layer:function(t){return this.path=t+"/query",this},_trapSQLerrors:function(t){t&&"400"===t.code&&O("one common syntax error in query requests is encasing string values in double quotes instead of single quotes")},_cleanParams:function(){delete this.params.returnIdsOnly,delete this.params.returnExtentOnly,delete this.params.returnCountOnly},_setGeometry:function(t){return this.params.inSr=4326,t instanceof e.LatLngBounds?(this.params.geometry=T(t),void(this.params.geometryType="esriGeometryEnvelope")):(t.getLatLng&&(t=t.getLatLng()),t instanceof e.LatLng&&(t={type:"Point",coordinates:[t.lng,t.lat]}),t instanceof e.GeoJSON&&(t=t.getLayers()[0].feature.geometry,this.params.geometry=x(t),this.params.geometryType=C(t.type)),t.toGeoJSON&&(t=t.toGeoJSON()),"Feature"===t.type&&(t=t.geometry),"Point"===t.type||"LineString"===t.type||"Polygon"===t.type||"MultiPolygon"===t.type?(this.params.geometry=x(t),void(this.params.geometryType=C(t.type))):void O("invalid geometry passed to spatial query. Should be L.LatLng, L.LatLngBounds, L.Marker or a GeoJSON Point, Line, Polygon or MultiPolygon object"))}}),tt=$.extend({setters:{contains:"contains",text:"searchText",fields:"searchFields",spatialReference:"sr",sr:"sr",layers:"layers",returnGeometry:"returnGeometry",maxAllowableOffset:"maxAllowableOffset",precision:"geometryPrecision",dynamicLayers:"dynamicLayers",returnZ:"returnZ",returnM:"returnM",gdbVersion:"gdbVersion",token:"token"},path:"find",params:{sr:4326,contains:!0,returnGeometry:!0,returnZ:!0,returnM:!1},layerDefs:function(t,e){return this.params.layerDefs=this.params.layerDefs?this.params.layerDefs+";":"",this.params.layerDefs+=[t,e].join(":"),this},simplify:function(t,e){var i=Math.abs(t.getBounds().getWest()-t.getBounds().getEast());return this.params.maxAllowableOffset=i/t.getSize().y*e,this},run:function(t,e){return this.request(function(i,s){t.call(e,i,s&&I(s),s)},e)}}),et=$.extend({path:"identify",between:function(t,e){return this.params.time=[t.valueOf(),e.valueOf()],this}}),it=et.extend({setters:{layers:"layers",precision:"geometryPrecision",tolerance:"tolerance",returnGeometry:"returnGeometry"},params:{sr:4326,layers:"all",tolerance:3,returnGeometry:!0},on:function(t){var e=T(t.getBounds()),i=t.getSize();return this.params.imageDisplay=[i.x,i.y,96],this.params.mapExtent=[e.xmin,e.ymin,e.xmax,e.ymax],this},at:function(t){return t=e.latLng(t),this.params.geometry=[t.lng,t.lat],this.params.geometryType="esriGeometryPoint",this},layerDef:function(t,e){return this.params.layerDefs=this.params.layerDefs?this.params.layerDefs+";":"",this.params.layerDefs+=[t,e].join(":"),this},simplify:function(t,e){var i=Math.abs(t.getBounds().getWest()-t.getBounds().getEast());return this.params.maxAllowableOffset=i/t.getSize().y*e,this},run:function(t,e){return this.request(function(i,s){if(i)t.call(e,i,void 0,s);else{var r=I(s);s.results=s.results.reverse();for(var n=0;n=0;n--)r.catalogItems.features[n].properties.catalogItemVisibility=s[n];return r}}),rt=e.Evented.extend({options:{proxy:!1,useCors:Z,timeout:0},initialize:function(t){t=t||{},this._requestQueue=[],this._authenticating=!1,e.Util.setOptions(this,t),this.options.url=w(this.options.url)},get:function(t,e,i,s){return this._request("get",t,e,i,s)},post:function(t,e,i,s){return this._request("post",t,e,i,s)},request:function(t,e,i,s){return this._request("request",t,e,i,s)},metadata:function(t,e){return this._request("get","",{},t,e)},authenticate:function(t){return this._authenticating=!1,this.options.token=t,this._runQueue(),this},getTimeout:function(){return this.options.timeout},setTimeout:function(t){this.options.timeout=t},_request:function(t,e,i,s,r){this.fire("requeststart",{url:this.options.url+e,params:i,method:t},!0);var n=this._createServiceCallback(t,e,i,s,r);this.options.token&&(i.token=this.options.token);{if(!this._authenticating){var o=this.options.proxy?this.options.proxy+"?"+this.options.url+e:this.options.url+e;return"get"!==t&&"request"!==t||this.options.useCors?K[t](o,i,n,r):K.get.JSONP(o,i,n,r)}this._requestQueue.push([t,e,i,s,r])}},_createServiceCallback:function(t,i,s,r,n){return e.Util.bind(function(o,a){!o||499!==o.code&&498!==o.code||(this._authenticating=!0,this._requestQueue.push([t,i,s,r,n]),this.fire("authenticationrequired",{authenticate:e.Util.bind(this.authenticate,this)},!0),o.authenticate=e.Util.bind(this.authenticate,this)),r.call(n,o,a),o?this.fire("requesterror",{url:this.options.url+i,params:s,message:o.message,code:o.code,method:t},!0):this.fire("requestsuccess",{url:this.options.url+i,params:s,response:a,method:t},!0),this.fire("requestend",{url:this.options.url+i,params:s,method:t},!0)},this)},_runQueue:function(){for(var t=this._requestQueue.length-1;t>=0;t--){var e=this._requestQueue[t];this[e.shift()].apply(this,e)}this._requestQueue=[]}}),nt=rt.extend({identify:function(){return U(this)},find:function(){return E(this)},query:function(){return G(this)}}),ot=rt.extend({query:function(){return G(this)},identify:function(){return q(this)}}),at=rt.extend({options:{idAttribute:"OBJECTID"},query:function(){return G(this)},addFeature:function(t,e,i){return delete t.id,t=x(t),this.post("addFeatures",{features:[t]},function(t,s){var r=s&&s.addResults?s.addResults[0]:void 0;e&&e.call(i,t||s.addResults[0].error,r)},i)},updateFeature:function(t,e,i){return t=x(t,this.options.idAttribute),this.post("updateFeatures",{features:[t]},function(t,s){var r=s&&s.updateResults?s.updateResults[0]:void 0;e&&e.call(i,t||s.updateResults[0].error,r)},i)},deleteFeature:function(t,e,i){return this.post("deleteFeatures",{objectIds:t},function(t,s){var r=s&&s.deleteResults?s.deleteResults[0]:void 0;e&&e.call(i,t||s.deleteResults[0].error,r)},i)},deleteFeatures:function(t,e,i){return this.post("deleteFeatures",{objectIds:t},function(t,s){var r=s&&s.deleteResults?s.deleteResults:void 0;e&&e.call(i,t||s.deleteResults[0].error,r)},i)}}),ut="https:"!==window.location.protocol?"http:":"https:",lt=e.TileLayer.extend({statics:{TILES:{Streets:{urlTemplate:ut+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:19,subdomains:["server","services"],attribution:"USGS, NOAA",attributionUrl:"https://static.arcgis.com/attribution/World_Street_Map"}},Topographic:{urlTemplate:ut+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:19,subdomains:["server","services"],attribution:"USGS, NOAA",attributionUrl:"https://static.arcgis.com/attribution/World_Topo_Map"}},Oceans:{urlTemplate:ut+"//{s}.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Base/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:16,subdomains:["server","services"],attribution:"USGS, NOAA",attributionUrl:"https://static.arcgis.com/attribution/Ocean_Basemap"}},OceansLabels:{urlTemplate:ut+"//{s}.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Reference/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:16,subdomains:["server","services"],pane:W?"esri-labels":"tilePane"}},NationalGeographic:{urlTemplate:ut+"//{s}.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:16,subdomains:["server","services"],attribution:"National Geographic, DeLorme, HERE, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, increment P Corp."}},DarkGray:{urlTemplate:ut+"//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Dark_Gray_Base/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:16,subdomains:["server","services"],attribution:"HERE, DeLorme, MapmyIndia, © OpenStreetMap contributors"}},DarkGrayLabels:{urlTemplate:ut+"//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Dark_Gray_Reference/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:16,subdomains:["server","services"],pane:W?"esri-labels":"tilePane",attribution:""}},Gray:{urlTemplate:ut+"//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:16,subdomains:["server","services"],attribution:"HERE, DeLorme, MapmyIndia, © OpenStreetMap contributors"}},GrayLabels:{urlTemplate:ut+"//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:16,subdomains:["server","services"],pane:W?"esri-labels":"tilePane",attribution:""}},Imagery:{urlTemplate:ut+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:19,subdomains:["server","services"],attribution:"DigitalGlobe, GeoEye, i-cubed, USDA, USGS, AEX, Getmapping, Aerogrid, IGN, IGP, swisstopo, and the GIS User Community"}},ImageryLabels:{urlTemplate:ut+"//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:19,subdomains:["server","services"],pane:W?"esri-labels":"tilePane",attribution:""}},ImageryTransportation:{urlTemplate:ut+"//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Transportation/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:19,subdomains:["server","services"],pane:W?"esri-labels":"tilePane"}},ShadedRelief:{urlTemplate:ut+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:13,subdomains:["server","services"],attribution:"USGS"}},ShadedReliefLabels:{urlTemplate:ut+"//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places_Alternate/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:12,subdomains:["server","services"],pane:W?"esri-labels":"tilePane",attribution:""}},Terrain:{urlTemplate:ut+"//{s}.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:13,subdomains:["server","services"],attribution:"USGS, NOAA"}},TerrainLabels:{urlTemplate:ut+"//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Reference_Overlay/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:13,subdomains:["server","services"],pane:W?"esri-labels":"tilePane",attribution:""}},USATopo:{urlTemplate:ut+"//{s}.arcgisonline.com/ArcGIS/rest/services/USA_Topo_Maps/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:15,subdomains:["server","services"],attribution:"USGS, National Geographic Society, i-cubed"}}}},initialize:function(t,i){var s;if("object"==typeof t&&t.urlTemplate&&t.options)s=t;else{if("string"!=typeof t||!lt.TILES[t])throw new Error('L.esri.BasemapLayer: Invalid parameter. Use one of "Streets", "Topographic", "Oceans", "OceansLabels", "NationalGeographic", "Gray", "GrayLabels", "DarkGray", "DarkGrayLabels", "Imagery", "ImageryLabels", "ImageryTransportation", "ShadedRelief", "ShadedReliefLabels", "Terrain", "TerrainLabels" or "USATopo"');s=lt.TILES[t]}var r=e.Util.extend(s.options,i);e.Util.setOptions(this,r),this.options.token&&(s.urlTemplate+="?token="+this.options.token),e.TileLayer.prototype.initialize.call(this,s.urlTemplate,r)},onAdd:function(t){P(t),"esri-labels"===this.options.pane&&this._initPane(),this.options.attributionUrl&&k(this.options.attributionUrl,t),t.on("moveend",M),e.TileLayer.prototype.onAdd.call(this,t)},onRemove:function(t){t.off("moveend",M),e.TileLayer.prototype.onRemove.call(this,t)},_initPane:function(){if(!this._map.getPane(this.options.pane)){var t=this._map.createPane(this.options.pane);t.style.pointerEvents="none",t.style.zIndex=500}},getAttribution:function(){if(this.options.attribution)var t=''+this.options.attribution+"";return t}}),ht=e.TileLayer.extend({options:{zoomOffsetAllowance:.1,errorTileUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEABAMAAACuXLVVAAAAA1BMVEUzNDVszlHHAAAAAXRSTlMAQObYZgAAAAlwSFlzAAAAAAAAAAAB6mUWpAAAADZJREFUeJztwQEBAAAAgiD/r25IQAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA7waBAAABw08RwAAAAABJRU5ErkJggg=="},statics:{MercatorZoomLevels:{0:156543.033928,1:78271.5169639999,2:39135.7584820001,3:19567.8792409999,4:9783.93962049996,5:4891.96981024998,6:2445.98490512499,7:1222.99245256249,8:611.49622628138,9:305.748113140558,10:152.874056570411,11:76.4370282850732,12:38.2185141425366,13:19.1092570712683,14:9.55462853563415,15:4.77731426794937,16:2.38865713397468,17:1.19432856685505,18:.597164283559817,19:.298582141647617,20:.14929107082381,21:.07464553541191,22:.0373227677059525,23:.0186613838529763}},initialize:function(t){t.url=w(t.url),t=e.Util.setOptions(this,t),this.tileUrl=t.url+"tile/{z}/{y}/{x}",this.service=D(t),this.service.addEventParent(this),new RegExp(/tiles.arcgis(online)?\.com/g).test(t.url)&&(this.tileUrl=this.tileUrl.replace("://tiles","://tiles{s}"),t.subdomains=["1","2","3","4"]),this.options.token&&(this.tileUrl+="?token="+this.options.token),e.TileLayer.prototype.initialize.call(this,this.tileUrl,t)},getTileUrl:function(t){var i=this._getZoomForUrl();return e.Util.template(this.tileUrl,e.Util.extend({s:this._getSubdomain(t),x:t.x,y:t.y,z:this._lodMap&&this._lodMap[i]?this._lodMap[i]:i},this.options))},createTile:function(t,e){var i=document.createElement("img");return L.DomEvent.on(i,"load",L.bind(this._tileOnLoad,this,e,i)),L.DomEvent.on(i,"error",L.bind(this._tileOnError,this,e,i)),this.options.crossOrigin&&(i.crossOrigin=""),i.alt="",!this._lodMap||this._lodMap&&this._lodMap[this._getZoomForUrl()]?i.src=this.getTileUrl(t):this.once("lodmap",function(){i.src=this.getTileUrl(t)},this),i},onAdd:function(t){P(t),this._lodMap||this.metadata(function(e,i){if(!e&&i.spatialReference){var s=i.spatialReference.latestWkid||i.spatialReference.wkid;if(!this.options.attribution&&t.attributionControl&&i.copyrightText&&(this.options.attribution=i.copyrightText,t.attributionControl.addAttribution(this.getAttribution())),t.options.crs===L.CRS.EPSG3857&&102100===s||3857===s){this._lodMap={};for(var r=i.tileInfo.lods,n=ht.MercatorZoomLevels,o=0;othis.options.maxZoom||t0||n.y0||o.yi.max.x)||!e.wrapLat&&(t.yi.max.y))return!1}if(!this.options.bounds)return!0;var s=this._cellCoordsToBounds(t);return j.latLngBounds(this.options.bounds).intersects(s)},_cellCoordsToBounds:function(t){var e=this._map,i=this.options.cellSize,s=t.multiplyBy(i),r=s.add([i,i]),n=e.wrapLatLng(e.unproject(s,t.z)),o=e.wrapLatLng(e.unproject(r,t.z));return j.latLngBounds(n,o)},_cellCoordsToKey:function(t){return t.x+":"+t.y},_keyToCellCoords:function(t){var e=t.split(":"),i=parseInt(e[0],10),s=parseInt(e[1],10);return j.point(i,s)},_removeOtherCells:function(t){for(var e in this._cells)t.contains(this._keyToCellCoords(e))||this._removeCell(e)},_removeCell:function(t){var e=this._activeCells[t];e&&(delete this._activeCells[t],this.cellLeave&&this.cellLeave(e.bounds,e.coords),this.fire("cellleave",{bounds:e.bounds,coords:e.coords}))},_removeCells:function(){for(var t in this._cells){var e=this._cells[t].bounds,i=this._cells[t].coords;this.cellLeave&&this.cellLeave(e,i),this.fire("cellleave",{bounds:e,coords:i})}},_addCell:function(t){this._wrapCoords(t);var e=this._cellCoordsToKey(t),i=this._cells[e];i&&!this._activeCells[e]&&(this.cellEnter&&this.cellEnter(i.bounds,t),this.fire("cellenter",{bounds:i.bounds,coords:t}),this._activeCells[e]=i),i||(i={coords:t,bounds:this._cellCoordsToBounds(t)},this._cells[e]=i,this._activeCells[e]=i,this.createCell&&this.createCell(i.bounds,t),this.fire("cellcreate",{bounds:i.bounds,coords:t}))},_wrapCoords:function(t){t.x=this._wrapLng?j.Util.wrapNum(t.x,this._wrapLng):t.x,t.y=this._wrapLat?j.Util.wrapNum(t.y,this._wrapLat):t.y},_getCellNumBounds:function(){var t=this._map.getPixelWorldBounds(),e=this._getCellSize();return t?j.bounds(t.min.divideBy(e).floor(),t.max.divideBy(e).ceil().subtract([1,1])):null}});N.prototype.query=function(t){var e=this.getIndex(t);return this.values[e]},N.prototype.getIndex=function(t){this.dirty&&this.sort();for(var e,i,s=0,r=this.values.length-1;s<=r;)if(e=(s+r)/2|0,+(i=this.values[Math.round(e)]).value<+t)s=e+1;else{if(!(+i.value>+t))return e;r=e-1}return Math.abs(~r)},N.prototype.between=function(t,e){var i=this.getIndex(t),s=this.getIndex(e);if(0===i&&0===s)return[];for(;this.values[i-1]&&this.values[i-1].value===t;)i--;for(;this.values[s+1]&&this.values[s+1].value===e;)s++;return this.values[s]&&this.values[s].value===e&&this.values[s+1]&&s++,this.values.slice(i,s)},N.prototype.insert=function(t){return this.values.splice(this.getIndex(t.value),0,t),this},N.prototype.bulkAdd=function(t,e){return this.values=this.values.concat([].concat(t||[])),e?this.sort():this.dirty=!0,this},N.prototype.sort=function(){return this.values.sort(function(t,e){return+e.value-+t.value}).reverse(),this.dirty=!1,this};var yt=ft.extend({options:{attribution:null,where:"1=1",fields:["*"],from:!1,to:!1,timeField:!1,timeFilterMode:"server",simplifyFactor:0,precision:6},initialize:function(t){if(ft.prototype.initialize.call(this,t),t.url=w(t.url),t=e.setOptions(this,t),this.service=z(t),this.service.addEventParent(this),"*"!==this.options.fields[0]){for(var i=!1,s=0;s=0;s--){var r=t[s].id;-1===this._currentSnapshot.indexOf(r)&&this._currentSnapshot.push(r),-1===this._cache[i].indexOf(r)&&this._cache[i].push(r)}this.options.timeField&&this._buildTimeIndexes(t),this.createLayers(t)},_buildQuery:function(t){var e=this.service.query().intersects(t).where(this.options.where).fields(this.options.fields).precision(this.options.precision);return this.options.simplifyFactor&&e.simplify(this._map,this.options.simplifyFactor),"server"===this.options.timeFilterMode&&this.options.from&&this.options.to&&e.between(this.options.from,this.options.to),e},setWhere:function(t,i,s){this.options.where=t&&t.length?t:"1=1";for(var r=[],n=[],o=0,a=null,u=e.Util.bind(function(t,u){if(t&&(a=t),u)for(var l=u.features.length-1;l>=0;l--)n.push(u.features[l].id);--o<=0&&(this._currentSnapshot=n,e.Util.requestAnimFrame(e.Util.bind(function(){this.removeLayers(r),this.addLayers(n),i&&i.call(s,a)},this)))},this),l=this._currentSnapshot.length-1;l>=0;l--)r.push(this._currentSnapshot[l]);for(var h in this._activeCells){o++;var c=this._keyToCellCoords(h),p=this._cellCoordsToBounds(c);this._requestFeatures(p,h,u)}return this},getWhere:function(){return this.options.where},getTimeRange:function(){return[this.options.from,this.options.to]},setTimeRange:function(t,i,s,r){var n=this.options.from,o=this.options.to,a=0,u=null,l=e.Util.bind(function(e){e&&(u=e),this._filterExistingFeatures(n,o,t,i),a--,s&&a<=0&&s.call(r,u)},this);if(this.options.from=t,this.options.to=i,this._filterExistingFeatures(n,o,t,i),"server"===this.options.timeFilterMode)for(var h in this._activeCells){a++;var c=this._keyToCellCoords(h),p=this._cellCoordsToBounds(c);this._requestFeatures(p,h,l)}return this},refresh:function(){for(var t in this._activeCells){var e=this._keyToCellCoords(t),i=this._cellCoordsToBounds(e);this._requestFeatures(i,t)}this.redraw&&this.once("load",function(){this.eachFeature(function(t){this._redraw(t.feature.id)},this)},this)},_filterExistingFeatures:function(t,i,s,r){var n=t&&i?this._getFeaturesInTimeRange(t,i):this._currentSnapshot,o=this._getFeaturesInTimeRange(s,r);if(o.indexOf)for(var a=0;a=0&&n.splice(u,1)}e.Util.requestAnimFrame(e.Util.bind(function(){this.removeLayers(n),this.addLayers(o)},this))},_getFeaturesInTimeRange:function(t,e){var i,s=[];if(this.options.timeField.start&&this.options.timeField.end){var r=this._startTimeIndex.between(t,e),n=this._endTimeIndex.between(t,e);i=r.concat(n)}else i=this._timeIndex.between(t,e);for(var o=i.length-1;o>=0;o--)s.push(i[o].id);return s},_buildTimeIndexes:function(t){var e,i;if(this.options.timeField.start&&this.options.timeField.end){var s=[],r=[];for(e=t.length-1;e>=0;e--)i=t[e],s.push({id:i.id,value:new Date(i.properties[this.options.timeField.start])}),r.push({id:i.id,value:new Date(i.properties[this.options.timeField.end])});this._startTimeIndex.bulkAdd(s),this._endTimeIndex.bulkAdd(r)}else{var n=[];for(e=t.length-1;e>=0;e--)i=t[e],n.push({id:i.id,value:new Date(i.properties[this.options.timeField])});this._timeIndex.bulkAdd(n)}},_featureWithinTimeRange:function(t){if(!this.options.from||!this.options.to)return!0;var e=+this.options.from.valueOf(),i=+this.options.to.valueOf();if("string"==typeof this.options.timeField){var s=+t.properties[this.options.timeField];return s>=e&&s<=i}if(this.options.timeField.start&&this.options.timeField.end){var r=+t.properties[this.options.timeField.start],n=+t.properties[this.options.timeField.end];return r>=e&&r<=i||n>=e&&n<=i}},_visibleZoom:function(){if(!this._map)return!1;var t=this._map.getZoom();return!(t>this.options.maxZoom||t0)for(var r=0;r=0;e--){var i,s=t[e],r=this._layers[s.id];this._visibleZoom()&&r&&!this._map.hasLayer(r)&&(this._map.addLayer(r),this.fire("addfeature",{feature:r.feature},!0)),r&&this.options.simplifyFactor>0&&(r.setLatLngs||r.setLatLng)&&this._updateLayer(r,s),r||((i=this.createNewLayer(s)).feature=s,i.addEventParent(this),this.options.onEachFeature&&this.options.onEachFeature(i.feature,i),this._layers[i.feature.id]=i,this.setFeatureStyle(i.feature.id,this.options.style),this.fire("createfeature",{feature:i.feature},!0),this._visibleZoom()&&(!this.options.timeField||this.options.timeField&&this._featureWithinTimeRange(s))&&this._map.addLayer(i))}},addLayers:function(t){for(var e=t.length-1;e>=0;e--){var i=this._layers[t[e]];i&&this._map.addLayer(i)}},removeLayers:function(t,e){for(var i=t.length-1;i>=0;i--){var s=t[i],r=this._layers[s];r&&(this.fire("removefeature",{feature:r.feature,permanent:e},!0),this._map.removeLayer(r)),r&&e&&delete this._layers[s]}},cellEnter:function(t,i){this._visibleZoom()&&!this._zooming&&this._map&&e.Util.requestAnimFrame(e.Util.bind(function(){var t=this._cacheKey(i),e=this._cellCoordsToKey(i),s=this._cache[t];this._activeCells[e]&&s&&this.addLayers(s)},this))},cellLeave:function(t,i){this._zooming||e.Util.requestAnimFrame(e.Util.bind(function(){if(this._map){var t=this._cacheKey(i),e=this._cellCoordsToKey(i),s=this._cache[t],r=this._map.getBounds();if(!this._activeCells[e]&&s){for(var n=!0,o=0;o