Server : LiteSpeed System : Linux server 3.10.0-1160.90.1.el7.x86_64 #1 SMP Thu May 4 15:21:22 UTC 2023 x86_64 User : alsaif ( 1057) PHP Version : 7.4.33 Disable Function : show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/alsaif/public_html/media/plg_system_nrframework/js/vendor/ |
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("leaflet")):"function"==typeof define&&define.amd?define(["exports","leaflet"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).L=t.L||{},t.L.esri={}),t.L)}(this,function(t,m){"use strict";var e=window.XMLHttpRequest&&"withCredentials"in new window.XMLHttpRequest,i=""===document.documentElement.style.pointerEvents,a={cors:e,pointerEvents:i},G={attributionWidthOffset:55},D=0;function l(t){var e,i,s,r="";for(e in t.f=t.f||"json",t)Object.prototype.hasOwnProperty.call(t,e)&&(i=t[e],s=Object.prototype.toString.call(i),r.length&&(r+="&"),s="[object Array]"===s?"[object Object]"===Object.prototype.toString.call(i[0])?JSON.stringify(i):i.join(","):"[object Object]"===s?JSON.stringify(i):"[object Date]"===s?i.valueOf():i,r+=encodeURIComponent(e)+"="+encodeURIComponent(s));return r}function u(s,r){var o=new window.XMLHttpRequest;return o.onerror=function(t){o.onreadystatechange=m.Util.falseFn,s.call(r,{error:{code:500,message:"XMLHttpRequest error"}},null)},o.onreadystatechange=function(){var e,i;if(4===o.readyState){try{e=JSON.parse(o.responseText)}catch(t){e=null,i={code:500,message:"Could not parse response as JSON. This could also be caused by a CORS or XMLHttpRequest error."}}!i&&e.error&&(i=e.error,e=null),o.onerror=m.Util.falseFn,s.call(r,i,e)}},o.ontimeout=function(){this.onerror()},o}function q(t,e,i,s){i=u(i,s);return i.open("POST",t),null!=s&&void 0!==s.options&&(i.timeout=s.options.timeout),i.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),i.send(l(e)),i}function B(t,e,i,s){i=u(i,s);return i.open("GET",t+"?"+l(e),!0),null!=s&&void 0!==s.options&&(i.timeout=s.options.timeout,s.options.withCredentials&&(i.withCredentials=!0)),i.send(null),i}function s(t,e,i,s){var r=l(e),o=u(i,s),n=(t+"?"+r).length;if(n<=2e3&&a.cors?o.open("GET",t+"?"+r):2e3<n&&a.cors&&(o.open("POST",t),o.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8")),null!=s&&void 0!==s.options&&(o.timeout=s.options.timeout,s.options.withCredentials&&(o.withCredentials=!0)),n<=2e3&&a.cors)o.send(null);else{if(!(2e3<n&&a.cors))return n<=2e3&&!a.cors?h(t,e,i,s):void c("a request to "+t+" 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/");o.send(r)}return o}function h(t,e,s,r){window._EsriLeafletCallbacks=window._EsriLeafletCallbacks||{};var o="c"+D,i=(e.callback="window._EsriLeafletCallbacks."+o,window._EsriLeafletCallbacks[o]=function(t){var e,i;!0!==window._EsriLeafletCallbacks[o]&&("[object Object]"!==(i=Object.prototype.toString.call(t))&&"[object Array]"!==i&&(e={error:{code:500,message:"Expected array or object as JSONP response"}},t=null),!e&&t.error&&(e=t,t=null),s.call(r,e,t),window._EsriLeafletCallbacks[o]=!0)},m.DomUtil.create("script",null,document.body));return i.type="text/javascript",i.src=t+"?"+l(e),i.id=o,i.onerror=function(t){t&&!0!==window._EsriLeafletCallbacks[o]&&(s.call(r,{error:{code:500,message:"An unknown error occurred"}}),window._EsriLeafletCallbacks[o]=!0)},m.DomUtil.addClass(i,"esri-leaflet-jsonp"),D++,{id:o,url:i.src,abort:function(){window._EsriLeafletCallbacks._callback[o]({code:0,message:"Request aborted."})}}}var r=a.cors?B:h;function c(){console&&console.warn&&console.warn.apply(console,arguments)}r.CORS=B,r.JSONP=h;function E(t,e){for(var i=0;i<t.length-1;i++)for(var s=0;s<e.length-1;s++)if(function(t,e,i,s){var r=(s[0]-i[0])*(t[1]-i[1])-(s[1]-i[1])*(t[0]-i[0]),o=(e[0]-t[0])*(t[1]-i[1])-(e[1]-t[1])*(t[0]-i[0]),s=(s[1]-i[1])*(e[0]-t[0])-(s[0]-i[0])*(e[1]-t[1]);if(0!=s){i=r/s,e=o/s;if(0<=i&&i<=1&&0<=e&&e<=1)return!0}return!1}(t[i],t[i+1],e[s],e[s+1]))return!0;return!1}function f(t){return function(t,e){for(var i=0;i<t.length;i++)if(t[i]!==e[i])return;return 1}(t[0],t[t.length-1])||t.push(t[0]),t}function y(t){for(var e,i=0,s=0,r=t.length,o=t[s];s<r-1;s++)i+=((e=t[s+1])[0]-o[0])*(e[1]+o[1]),o=e;return 0<=i}function o(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],t.coordinates[2]&&(r.z=t.coordinates[2]),r.spatialReference=s;break;case"MultiPoint":r.points=t.coordinates.slice(0),t.coordinates[0][2]&&(r.hasZ=!0),r.spatialReference=s;break;case"LineString":r.paths=[t.coordinates.slice(0)],t.coordinates[0][2]&&(r.hasZ=!0),r.spatialReference=s;break;case"MultiLineString":r.paths=t.coordinates.slice(0),t.coordinates[0][0][2]&&(r.hasZ=!0),r.spatialReference=s;break;case"Polygon":r.rings=N(t.coordinates.slice(0)),t.coordinates[0][0][2]&&(r.hasZ=!0),r.spatialReference=s;break;case"MultiPolygon":r.rings=function(t){for(var e=[],i=0;i<t.length;i++)for(var s=N(t[i]),r=s.length-1;0<=r;r--){var o=s[r].slice(0);e.push(o)}return e}(t.coordinates.slice(0)),t.coordinates[0][0][0][2]&&(r.hasZ=!0),r.spatialReference=s;break;case"Feature":t.geometry&&(r.geometry=o(t.geometry,e)),r.attributes=t.properties?z(t.properties):{},t.id&&(r.attributes[e]=t.id);break;case"FeatureCollection":for(r=[],i=0;i<t.features.length;i++)r.push(o(t.features[i],e));break;case"GeometryCollection":for(r=[],i=0;i<t.geometries.length;i++)r.push(o(t.geometries[i],e))}return r}var p={request:s,get:r,post:q},z=function(t){var e,i={};for(e in t)t.hasOwnProperty(e)&&(i[e]=t[e]);return i},Z=function t(e,r){var i={};if(e.features){i.type="FeatureCollection",i.features=[];for(var s=0;s<e.features.length;s++)i.features.push(t(e.features[s],r))}if("number"==typeof e.x&&"number"==typeof e.y&&(i.type="Point",i.coordinates=[e.x,e.y],"number"==typeof e.z&&i.coordinates.push(e.z)),e.points&&(i.type="MultiPoint",i.coordinates=e.points.slice(0)),e.paths&&(1===e.paths.length?(i.type="LineString",i.coordinates=e.paths[0].slice(0)):(i.type="MultiLineString",i.coordinates=e.paths.slice(0))),e.rings&&(i=function(t){for(var e,i=[],s=[],r=0;r<t.length;r++){var o,n=f(t[r].slice(0));n.length<4||(y(n)?(o=[n.slice().reverse()],i.push(o)):s.push(n.slice().reverse()))}for(var a,l,u,h=[];s.length;){for(var c=s.pop(),p=!1,d=i.length-1;0<=d;d--)if(e=i[d][0],u=void 0,u=E(a=e,l=c),a=function(t,e){for(var i=!1,s=-1,r=t.length,o=r-1;++s<r;o=s)(t[s][1]<=e[1]&&e[1]<t[o][1]||t[o][1]<=e[1]&&e[1]<t[s][1])&&e[0]<(t[o][0]-t[s][0])*(e[1]-t[s][1])/(t[o][1]-t[s][1])+t[s][0]&&(i=!i);return i}(a,l[0]),!(u||!a)){i[d].push(c),p=!0;break}p||h.push(c)}for(;h.length;){c=h.pop();var m=!1;for(d=i.length-1;0<=d;d--)if(e=i[d][0],E(e,c)){i[d].push(c),m=!0;break}m||i.push([c.reverse()])}return 1===i.length?{type:"Polygon",coordinates:i[0]}:{type:"MultiPolygon",coordinates:i}}(e.rings.slice(0))),"number"==typeof e.xmin&&"number"==typeof e.ymin&&"number"==typeof e.xmax&&"number"==typeof e.ymax&&(i.type="Polygon",i.coordinates=[[[e.xmax,e.ymax],[e.xmin,e.ymax],[e.xmin,e.ymin],[e.xmax,e.ymin],[e.xmax,e.ymax]]]),(e.geometry||e.attributes)&&(i.type="Feature",i.geometry=e.geometry?t(e.geometry):null,i.properties=e.attributes?z(e.attributes):null,e.attributes))try{i.id=function(t){for(var e=r?[r,"OBJECTID","FID"]:["OBJECTID","FID"],i=0;i<e.length;i++){var s=e[i];if(s in t&&("string"==typeof t[s]||"number"==typeof t[s]))return t[s]}throw Error("No valid id attribute found")}(e.attributes)}catch(t){}return JSON.stringify(i.geometry)===JSON.stringify({})&&(i.geometry=null),e.spatialReference&&e.spatialReference.wkid&&4326!==e.spatialReference.wkid&&console.warn("Object converted in non-standard crs - "+JSON.stringify(e.spatialReference)),i},N=function(t){var e=[],i=t.slice(0),t=f(i.shift().slice(0));if(4<=t.length){y(t)||t.reverse(),e.push(t);for(var s=0;s<i.length;s++){var r=f(i[s].slice(0));4<=r.length&&(y(r)&&r.reverse(),e.push(r))}}return e},j='<a href="http://leafletjs.com" title="A JS library for interactive maps">Leaflet</a>';function n(t,e){return o(t,e)}function W(t,e){return Z(t,e)}function d(t){var e;return"NaN"!==t.xmin&&"NaN"!==t.ymin&&"NaN"!==t.xmax&&"NaN"!==t.ymax?(e=m.latLng(t.ymin,t.xmin),t=m.latLng(t.ymax,t.xmax),m.latLngBounds(e,t)):null}function g(t){return{xmin:(t=m.latLngBounds(t)).getSouthWest().lng,ymin:t.getSouthWest().lat,xmax:t.getNorthEast().lng,ymax:t.getNorthEast().lat,spatialReference:{wkid:4326}}}var J=/^(OBJECTID|FID|OID|ID)$/i;function V(t){var e;if(t.objectIdFieldName)e=t.objectIdFieldName;else if(t.fields){for(var i=0;i<=t.fields.length-1;i++)if("esriFieldTypeOID"===t.fields[i].type){e=t.fields[i].name;break}if(!e)for(i=0;i<=t.fields.length-1;i++)if(t.fields[i].name.match(J)){e=t.fields[i].name;break}}return e}function Q(t){for(var e in t.attributes)if(e.match(J))return e}function _(t,e){var i=t.features||t.results,s=i&&i.length,r=e||V(t),o={type:"FeatureCollection",features:[]};if(s)for(var n=i.length-1;0<=n;n--){var a=W(i[n],r||Q(i[n]));o.features.push(a)}return o}function v(t){return"/"!==(t=m.Util.trim(t))[t.length-1]&&(t+="/"),t}function b(t){var e;return-1!==t.url.indexOf("?")&&(t.requestParams=t.requestParams||{},e=t.url.substring(t.url.indexOf("?")+1),t.url=t.url.split("?")[0],t.requestParams=JSON.parse('{"'+decodeURI(e).replace(/"/g,'\\"').replace(/&/g,'","').replace(/=/g,'":"')+'"}')),t.url=v(t.url.split("?")[0]),t}function K(t){return/^(?!.*utility\.arcgis\.com).*\.arcgis\.com.*FeatureServer/i.test(t)}function x(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 L(t){return t.getSize().x-G.attributionWidthOffset+"px"}function S(e){var t;e.attributionControl&&(e.attributionControl._esriAttributionLayerCount||(e.attributionControl._esriAttributionLayerCount=0),0===e.attributionControl._esriAttributionLayerCount&&(e.attributionControl._esriAttributionAddedOnce||((t=document.createElement("style")).type="text/css",t.innerHTML=".esri-truncated-attribution:hover {white-space: normal;}",document.getElementsByTagName("head")[0].appendChild(t),(t=document.createElement("style")).type="text/css",t.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: "+L(e)+";}",document.getElementsByTagName("head")[0].appendChild(t),e.on("resize",function(t){e.attributionControl&&(e.attributionControl._container.style.maxWidth=L(t.target))}),e.attributionControl._esriAttributionAddedOnce=!0),e.attributionControl.setPrefix(j+' | Powered by <a href="https://www.esri.com">Esri</a>'),m.DomUtil.addClass(e.attributionControl._container,"esri-truncated-attribution:hover"),m.DomUtil.addClass(e.attributionControl._container,"esri-truncated-attribution")),e.attributionControl._esriAttributionLayerCount=e.attributionControl._esriAttributionLayerCount+1)}function A(t){t.attributionControl&&(t.attributionControl._esriAttributionLayerCount&&1===t.attributionControl._esriAttributionLayerCount&&(t.attributionControl.setPrefix(j),m.DomUtil.removeClass(t.attributionControl._container,"esri-truncated-attribution:hover"),m.DomUtil.removeClass(t.attributionControl._container,"esri-truncated-attribution")),t.attributionControl._esriAttributionLayerCount=t.attributionControl._esriAttributionLayerCount-1)}function I(t){var e={geometry:null,geometryType:null};return t instanceof m.LatLngBounds?(e.geometry=g(t),e.geometryType="esriGeometryEnvelope",e):((t=(t=t.getLatLng?t.getLatLng():t)instanceof m.LatLng?{type:"Point",coordinates:[t.lng,t.lat]}:t)instanceof m.GeoJSON&&(t=t.getLayers()[0].feature.geometry,e.geometry=n(t),e.geometryType=x(t.type)),"Point"===(t="Feature"===(t=t.toGeoJSON?t.toGeoJSON():t).type?t.geometry:t).type||"LineString"===t.type||"Polygon"===t.type||"MultiPolygon"===t.type?(e.geometry=n(t),e.geometryType=x(t.type),e):void c("invalid geometry passed to spatial query. Should be L.LatLng, L.LatLngBounds, L.Marker or a GeoJSON Point, Line, Polygon or MultiPolygon object"))}function H(t,l){a.cors&&s(t,{},m.Util.bind(function(t,e){if(!t){l._esriAttributions=[];for(var i=0;i<e.contributors.length;i++)for(var s=e.contributors[i],r=0;r<s.coverageAreas.length;r++){var o=s.coverageAreas[r],n=m.latLng(o.bbox[0],o.bbox[1]),a=m.latLng(o.bbox[2],o.bbox[3]);l._esriAttributions.push({attribution:s.attribution,score:o.score,bounds:m.latLngBounds(n,a),minZoom:o.zoomMin,maxZoom:o.zoomMax})}l._esriAttributions.sort(function(t,e){return e.score-t.score}),T({target:l})}},this))}function T(t){var t=t.target,e=t._esriAttributions;if(t&&t.attributionControl){var i=t.attributionControl._container.querySelector(".esri-dynamic-attribution");if(i&&e){for(var s="",r=t.getBounds(),o=m.latLngBounds(r.getSouthWest().wrap(),r.getNorthEast().wrap()),n=t.getZoom(),a=0;a<e.length;a++){var l=e[a],u=l.attribution;!s.match(u)&&l.bounds.intersects(o)&&n>=l.minZoom&&n<=l.maxZoom&&(s+=", "+u)}s=s.substr(2),i.innerHTML=s,i.style.maxWidth=L(t),t.fire("attributionupdated",{attribution:s})}}}var X={warn:c,cleanUrl:v,getUrlParams:b,isArcgisOnline:K,geojsonTypeToArcGIS:x,responseToFeatureCollection:_,geojsonToArcGIS:n,arcgisToGeoJSON:W,boundsToExtent:g,extentToBounds:d,calcAttributionWidth:L,setEsriAttribution:S,_setGeometry:I,_getAttributionData:H,_updateMapAttribution:T,_findIdAttributeFromFeature:Q,_findIdAttributeFromResponse:V},C=m.Class.extend({options:{proxy:!1,useCors:e},generateSetter:function(e,t){return m.Util.bind(function(t){return this.params[e]=t,this},t)},initialize:function(t){if(t.request&&t.options?(this._service=t,m.Util.setOptions(this,t.options)):(m.Util.setOptions(this,t),this.options.url=v(t.url)),this.params=m.Util.extend({},this.params||{}),this.setters)for(var e in this.setters){var i=this.setters[e];this[e]=this.generateSetter(i,this)}},token:function(t){return this._service?this._service.authenticate(t):this.params.token=t,this},apikey:function(t){return this.token(t)},format:function(t){return this.params.returnUnformattedValues=!t,this},request:function(t,e){return this.options.requestParams&&m.Util.extend(this.params,this.options.requestParams),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){e=this.options.proxy?this.options.proxy+"?"+this.options.url+e:this.options.url+e;return"get"!==t&&"request"!==t||this.options.useCors?p[t](e,i,s,r):p.get.JSONP(e,i,s,r)}}),Y=C.extend({setters:{offset:"resultOffset",limit:"resultRecordCount",fields:"outFields",precision:"geometryPrecision",featureIds:"objectIds",returnGeometry:"returnGeometry",returnM:"returnM",transform:"datumTransformation",token:"token"},path:"query",params:{returnGeometry:!0,where:"1=1",outSR:4326,outFields:"*"},within:function(t){return this._setGeometryParams(t),this.params.spatialRel="esriSpatialRelContains",this},intersects:function(t){return this._setGeometryParams(t),this.params.spatialRel="esriSpatialRelIntersects",this},contains:function(t){return this._setGeometryParams(t),this.params.spatialRel="esriSpatialRelWithin",this},crosses:function(t){return this._setGeometryParams(t),this.params.spatialRel="esriSpatialRelCrosses",this},touches:function(t){return this._setGeometryParams(t),this.params.spatialRel="esriSpatialRelTouches",this},overlaps:function(t){return this._setGeometryParams(t),this.params.spatialRel="esriSpatialRelOverlaps",this},bboxIntersects:function(t){return this._setGeometryParams(t),this.params.spatialRel="esriSpatialRelEnvelopeIntersects",this},indexIntersects:function(t){return this._setGeometryParams(t),this.params.spatialRel="esriSpatialRelIndexIntersects",this},nearby:function(t,e){return t=m.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=e,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(i,s){return this._cleanParams(),this.options.isModern||K(this.options.url)&&void 0===this.options.isModern?(this.params.f="geojson",this.request(function(t,e){this._trapSQLerrors(t),i.call(s,t,e,e)},this)):this.request(function(t,e){this._trapSQLerrors(t),i.call(s,t,e&&_(e),e)},this)},count:function(i,t){return this._cleanParams(),this.params.returnCountOnly=!0,this.request(function(t,e){i.call(this,t,e&&e.count,e)},t)},ids:function(i,t){return this._cleanParams(),this.params.returnIdsOnly=!0,this.request(function(t,e){i.call(this,t,e&&e.objectIds,e)},t)},bounds:function(i,s){return this._cleanParams(),this.params.returnExtentOnly=!0,this.request(function(t,e){e&&e.extent&&d(e.extent)?i.call(s,t,d(e.extent),e):i.call(s,t={message:"Invalid Bounds"},null,e)},s)},distinct:function(){return this.params.returnGeometry=!1,this.params.returnDistinctValues=!0,this},pixelSize:function(t){t=m.point(t);return this.params.pixelSize=[t.x,t.y],this},layer:function(t){return this.path=t+"/query",this},_trapSQLerrors:function(t){t&&"400"===t.code&&c("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},_setGeometryParams:function(t){this.params.inSR=4326;t=I(t);this.params.geometry=t.geometry,this.params.geometryType=t.geometryType}});function w(t){return new Y(t)}var $=C.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(i,s){return this.request(function(t,e){i.call(s,t,e&&_(e),e)},s)}});function tt(t){return new $(t)}var R=C.extend({path:"identify",between:function(t,e){return this.params.time=[t.valueOf(),e.valueOf()],this}}),et=R.extend({setters:{layers:"layers",precision:"geometryPrecision",tolerance:"tolerance",returnGeometry:"returnGeometry"},params:{sr:4326,layers:"all",tolerance:3,returnGeometry:!0},on:function(t){var e=g(t.getBounds()),t=t.getSize();return this.params.imageDisplay=[t.x,t.y,96],this.params.mapExtent=[e.xmin,e.ymin,e.xmax,e.ymax],this},at:function(t){return 2===t.length&&(t=m.latLng(t)),this._setGeometryParams(t),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(r,o){return this.request(function(t,e){if(t)r.call(o,t,void 0,e);else{var i=_(e);e.results=e.results.reverse();for(var s=0;s<i.features.length;s++)i.features[s].layerId=e.results[s].layerId;r.call(o,void 0,i,e)}})},_setGeometryParams:function(t){t=I(t);this.params.geometry=t.geometry,this.params.geometryType=t.geometryType}});function it(t){return new et(t)}var st=R.extend({setters:{setMosaicRule:"mosaicRule",setRenderingRule:"renderingRule",setPixelSize:"pixelSize",returnCatalogItems:"returnCatalogItems",returnGeometry:"returnGeometry"},params:{returnGeometry:!1},at:function(t){return t=m.latLng(t),this.params.geometry=JSON.stringify({x:t.lng,y:t.lat,spatialReference:{wkid:4326}}),this.params.geometryType="esriGeometryPoint",this},getMosaicRule:function(){return this.params.mosaicRule},getRenderingRule:function(){return this.params.renderingRule},getPixelSize:function(){return this.params.pixelSize},run:function(i,s){return this.request(function(t,e){i.call(s,t,e&&this._responseToGeoJSON(e),e)},this)},_responseToGeoJSON:function(t){var e=t.location,i=t.catalogItems,s=t.catalogItemVisibilities,r={pixel:{type:"Feature",geometry:{type:"Point",coordinates:[e.x,e.y]},crs:{type:"EPSG",properties:{code:e.spatialReference.wkid}},properties:{OBJECTID:t.objectId,name:t.name,value:t.value},id:t.objectId}};if(t.properties&&t.properties.Values&&(r.pixel.properties.values=t.properties.Values),i&&i.features&&(r.catalogItems=_(i),s&&s.length===r.catalogItems.features.length))for(var o=s.length-1;0<=o;o--)r.catalogItems.features[o].properties.catalogItemVisibility=s[o];return r}});function rt(t){return new st(t)}var P=m.Evented.extend({options:{proxy:!1,useCors:e,timeout:0},initialize:function(t){t=t||{},this._requestQueue=[],this._authenticating=!1,m.Util.setOptions(this,t),this.options.url=v(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 o,n=this._createServiceCallback(t,e,i,s,r);if(this.options.token&&(i.token=this.options.token),this.options.requestParams&&m.Util.extend(i,this.options.requestParams),!this._authenticating)return o=this.options.proxy?this.options.proxy+"?"+this.options.url+e:this.options.url+e,"get"!==t&&"request"!==t||this.options.useCors?p[t](o,i,n,r):p.get.JSONP(o,i,n,r);this._requestQueue.push([t,e,i,s,r])},_createServiceCallback:function(i,s,r,o,n){return m.Util.bind(function(t,e){!t||499!==t.code&&498!==t.code||(this._authenticating=!0,this._requestQueue.push([i,s,r,o,n]),this.fire("authenticationrequired",{authenticate:m.Util.bind(this.authenticate,this)},!0),t.authenticate=m.Util.bind(this.authenticate,this)),o.call(n,t,e),t?this.fire("requesterror",{url:this.options.url+s,params:r,message:t.message,code:t.code,method:i},!0):this.fire("requestsuccess",{url:this.options.url+s,params:r,response:e,method:i},!0),this.fire("requestend",{url:this.options.url+s,params:r,method:i},!0)},this)},_runQueue:function(){for(var t=this._requestQueue.length-1;0<=t;t--){var e=this._requestQueue[t];this[e.shift()].apply(this,e)}this._requestQueue=[]}}),ot=P.extend({identify:function(){return it(this)},find:function(){return tt(this)},query:function(){return w(this)}});function nt(t){return new ot(t)}var at=P.extend({query:function(){return w(this)},identify:function(){return rt(this)}});function lt(t){return new at(t)}var ut=P.extend({options:{idAttribute:"OBJECTID"},query:function(){return w(this)},addFeature:function(t,e,i){this.addFeatures(t,e,i)},addFeatures:function(t,s,r){for(var e=t.features||[t],i=e.length-1;0<=i;i--)delete e[i].id;return t=n(t),t=1<e.length?t:[t],this.post("addFeatures",{features:t},function(t,e){var i=e&&e.addResults?1<e.addResults.length?e.addResults:e.addResults[0]:void 0;s&&s.call(r,t||e.addResults[0].error,i)},r)},updateFeature:function(t,e,i){this.updateFeatures(t,e,i)},updateFeatures:function(t,s,r){var e=t.features||[t];return t=n(t,this.options.idAttribute),t=1<e.length?t:[t],this.post("updateFeatures",{features:t},function(t,e){var i=e&&e.updateResults?1<e.updateResults.length?e.updateResults:e.updateResults[0]:void 0;s&&s.call(r,t||e.updateResults[0].error,i)},r)},deleteFeature:function(t,e,i){this.deleteFeatures(t,e,i)},deleteFeatures:function(t,s,r){return this.post("deleteFeatures",{objectIds:t},function(t,e){var i=e&&e.deleteResults?1<e.deleteResults.length?e.deleteResults:e.deleteResults[0]:void 0;s&&s.call(r,t||e.deleteResults[0].error,i)},r)}});function ht(t){return new ut(t)}var O="https:"!==window.location.protocol?"http:":"https:",F=m.TileLayer.extend({statics:{TILES:{Streets:{urlTemplate:O+"//{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:O+"//{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:O+"//{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:O+"//{s}.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Reference/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:16,subdomains:["server","services"],pane:i?"esri-labels":"tilePane",attribution:""}},NationalGeographic:{urlTemplate:O+"//{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:O+"//{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:O+"//{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:i?"esri-labels":"tilePane",attribution:""}},Gray:{urlTemplate:O+"//{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:O+"//{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:i?"esri-labels":"tilePane",attribution:""}},Imagery:{urlTemplate:O+"//{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",attributionUrl:"https://static.arcgis.com/attribution/World_Imagery"}},ImageryLabels:{urlTemplate:O+"//{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:i?"esri-labels":"tilePane",attribution:""}},ImageryTransportation:{urlTemplate:O+"//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Transportation/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:19,subdomains:["server","services"],pane:i?"esri-labels":"tilePane",attribution:""}},ShadedRelief:{urlTemplate:O+"//{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:O+"//{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:i?"esri-labels":"tilePane",attribution:""}},Terrain:{urlTemplate:O+"//{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:O+"//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Reference_Overlay/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:13,subdomains:["server","services"],pane:i?"esri-labels":"tilePane",attribution:""}},USATopo:{urlTemplate:O+"//{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"}},ImageryClarity:{urlTemplate:O+"//clarity.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:19,attribution:"Esri, DigitalGlobe, GeoEye, Earthstar Geographics, CNES/Airbus DS, USDA, USGS, AeroGRID, IGN, and the GIS User Community"}},Physical:{urlTemplate:O+"//{s}.arcgisonline.com/arcgis/rest/services/World_Physical_Map/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:8,subdomains:["server","services"],attribution:"U.S. National Park Service"}},ImageryFirefly:{urlTemplate:O+"//fly.maptiles.arcgis.com/arcgis/rest/services/World_Imagery_Firefly/MapServer/tile/{z}/{y}/{x}",options:{minZoom:1,maxZoom:19,attribution:"Esri, DigitalGlobe, GeoEye, Earthstar Geographics, CNES/Airbus DS, USDA, USGS, AeroGRID, IGN, and the GIS User Community",attributionUrl:"https://static.arcgis.com/attribution/World_Imagery"}}}},initialize:function(t,e){var i;if("object"==typeof t&&t.urlTemplate&&t.options)i=t;else{if("string"!=typeof t||!F.TILES[t])throw new Error('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"');i=F.TILES[t]}t=m.Util.extend(i.options,e);m.Util.setOptions(this,t),this.options.ignoreDeprecationWarning||console.warn("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"),this.options.token&&-1===i.urlTemplate.indexOf("token=")&&(i.urlTemplate+="?token="+this.options.token),this.options.proxy&&(i.urlTemplate=this.options.proxy+"?"+i.urlTemplate),m.TileLayer.prototype.initialize.call(this,i.urlTemplate,t)},onAdd:function(t){S(t),"esri-labels"===this.options.pane&&this._initPane(),this.options.attributionUrl&&H((this.options.proxy?this.options.proxy+"?":"")+this.options.attributionUrl,t),t.on("moveend",T),m.TileLayer.prototype.onAdd.call(this,t)},onRemove:function(t){A(t),t.off("moveend",T),m.TileLayer.prototype.onRemove.call(this,t)},_initPane:function(){var t;this._map.getPane(this.options.pane)||((t=this._map.createPane(this.options.pane)).style.pointerEvents="none",t.style.zIndex=500)},getAttribution:function(){var t;return t=this.options.attribution?'<span class="esri-dynamic-attribution">'+this.options.attribution+"</span>":t}}),ct=m.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=b(t=m.Util.setOptions(this,t)),this.tileUrl=(t.proxy?t.proxy+"?":"")+t.url+"tile/{z}/{y}/{x}"+(t.requestParams&&0<Object.keys(t.requestParams).length?m.Util.getParamString(t.requestParams):""),-1!==t.url.indexOf("{s}")&&t.subdomains&&(t.url=t.url.replace("{s}",t.subdomains[0])),this.service=nt(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),m.TileLayer.prototype.initialize.call(this,this.tileUrl,t)},getTileUrl:function(t){var e=this._getZoomForUrl();return m.Util.template(this.tileUrl,m.Util.extend({s:this._getSubdomain(t),x:t.x,y:t.y,z:this._lodMap&&this._lodMap[e]?this._lodMap[e]:e},this.options))},createTile:function(t,e){var i=document.createElement("img");return m.DomEvent.on(i,"load",m.Util.bind(this._tileOnLoad,this,e,i)),m.DomEvent.on(i,"error",m.Util.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(l){S(l),this._lodMap||this.metadata(function(t,e){if(!t&&e.spatialReference){t=e.spatialReference.latestWkid||e.spatialReference.wkid;if(!this.options.attribution&&l.attributionControl&&e.copyrightText&&(this.options.attribution=e.copyrightText,l.attributionControl.addAttribution(this.getAttribution())),l.options.crs!==m.CRS.EPSG3857||102100!==t&&3857!==t)l.options.crs&&l.options.crs.code&&-1<l.options.crs.code.indexOf(t)||c("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/");else{this._lodMap={};for(var i=e.tileInfo.lods,s=ct.MercatorZoomLevels,r=0;r<i.length;r++){var o,n=i[r];for(o in s){var a=s[o];if(this._withinPercentage(n.resolution,a,this.options.zoomOffsetAllowance)){this._lodMap[o]=n.level;break}}}this.fire("lodmap")}}},this),m.TileLayer.prototype.onAdd.call(this,l)},onRemove:function(t){A(t),m.TileLayer.prototype.onRemove.call(this,t)},metadata:function(t,e){return this.service.metadata(t,e),this},identify:function(){return this.service.identify()},find:function(){return this.service.find()},query:function(){return this.service.query()},authenticate:function(t){var e="?token="+t;return this.tileUrl=this.options.token?this.tileUrl.replace(/\?token=(.+)/g,e):this.tileUrl+e,this.options.token=t,this.service.authenticate(t),this},_withinPercentage:function(t,e,i){return Math.abs(t/e-1)<i}}),pt=m.ImageOverlay.extend({onAdd:function(t){this._topLeft=t.getPixelBounds().min,m.ImageOverlay.prototype.onAdd.call(this,t)},_reset:function(){this._map.options.crs===m.CRS.EPSG3857?m.ImageOverlay.prototype._reset.call(this):m.DomUtil.setPosition(this._image,this._topLeft.subtract(this._map.getPixelOrigin()))}}),i=m.Layer.extend({options:{opacity:1,position:"front",f:"image",useCors:e,attribution:null,interactive:!1,alt:""},onAdd:function(i){S(i),this.options.zIndex&&(this.options.position=null),this._update=m.Util.throttle(this._update,this.options.updateInterval,this),i.on("moveend",this._update,this),this._currentImage&&this._currentImage._bounds.equals(this._map.getBounds())?i.addLayer(this._currentImage):this._currentImage&&(this._map.removeLayer(this._currentImage),this._currentImage=null),this._update(),this._popup&&(this._map.on("click",this._getPopupData,this),this._map.on("dblclick",this._resetPopupState,this)),this.metadata(function(t,e){!t&&!this.options.attribution&&i.attributionControl&&e.copyrightText&&(this.options.attribution=e.copyrightText,i.attributionControl.addAttribution(this.getAttribution()))},this)},onRemove:function(t){A(t),this._currentImage&&this._map.removeLayer(this._currentImage),this._popup&&(this._map.off("click",this._getPopupData,this),this._map.off("dblclick",this._resetPopupState,this)),this._map.off("moveend",this._update,this)},bindPopup:function(t,e){return this._shouldRenderPopup=!1,this._lastClick=!1,this._popup=m.popup(e),this._popupFunction=t,this._map&&(this._map.on("click",this._getPopupData,this),this._map.on("dblclick",this._resetPopupState,this)),this},unbindPopup:function(){return this._map&&(this._map.closePopup(this._popup),this._map.off("click",this._getPopupData,this),this._map.off("dblclick",this._resetPopupState,this)),this._popup=!1,this},bringToFront:function(){return this.options.position="front",this._currentImage&&(this._currentImage.bringToFront(),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this.options.position="back",this._currentImage&&(this._currentImage.bringToBack(),this._setAutoZIndex(Math.min)),this},setZIndex:function(t){return this.options.zIndex=t,this._currentImage&&this._currentImage.setZIndex(t),this},_setAutoZIndex:function(t){if(this._currentImage){for(var e,i=this._currentImage.getPane().children,s=-t(-1/0,1/0),r=0,o=i.length;r<o;r++)e=i[r].style.zIndex,i[r]!==this._currentImage._image&&e&&(s=t(s,+e));isFinite(s)&&(this.options.zIndex=s+t(-1,1),this.setZIndex(this.options.zIndex))}},getAttribution:function(){return this.options.attribution},getOpacity:function(){return this.options.opacity},setOpacity:function(t){return this.options.opacity=t,this._currentImage&&this._currentImage.setOpacity(t),this},getTimeRange:function(){return[this.options.from,this.options.to]},setTimeRange:function(t,e){return this.options.from=t,this.options.to=e,this._update(),this},metadata:function(t,e){return this.service.metadata(t,e),this},authenticate:function(t){return this.service.authenticate(t),this},redraw:function(){this._update()},_renderImage:function(t,i,e){var s,r,o;this._map&&(t=e?"data:"+e+";base64,"+t:t)&&(s=new pt(t,i,{opacity:0,crossOrigin:this.options.withCredentials?"use-credentials":this.options.useCors,alt:this.options.alt,pane:this.options.pane||this.getPane(),interactive:this.options.interactive}).addTo(this._map),r=function(){this._map.removeLayer(s),this.fire("error"),s.off("load",o,this)},o=function(t){var e;s.off("error",r,this),this._map&&(t=t.target,e=this._currentImage,t._bounds.equals(i)&&t._bounds.equals(this._map.getBounds())?(this._currentImage=t,"front"===this.options.position?this.bringToFront():"back"===this.options.position&&this.bringToBack(),this.options.zIndex&&this.setZIndex(this.options.zIndex),this._map&&this._currentImage._map?this._currentImage.setOpacity(this.options.opacity):this._currentImage._map.removeLayer(this._currentImage),e&&this._map&&this._map.removeLayer(e),e&&e._map&&e._map.removeLayer(e)):this._map.removeLayer(t)),this.fire("load",{bounds:i})},s.once("error",r,this),s.once("load",o,this))},_update:function(){var t,e;this._map&&(e=this._map.getZoom(),t=this._map.getBounds(),this._animatingZoom||this._map._panTransition&&this._map._panTransition._inProgress||(e>this.options.maxZoom||e<this.options.minZoom?this._currentImage&&(this._currentImage._map.removeLayer(this._currentImage),this._currentImage=null):(e=this._buildExportParams(),m.Util.extend(e,this.options.requestParams),e?(this._requestExport(e,t),this.fire("loading",{bounds:t})):this._currentImage&&(this._currentImage._map.removeLayer(this._currentImage),this._currentImage=null))))},_renderPopup:function(t,e,i,s){t=m.latLng(t),this._shouldRenderPopup&&this._lastClick.equals(t)&&(e=this._popupFunction(e,i,s))&&this._popup.setLatLng(t).setContent(e).openOn(this._map)},_resetPopupState:function(t){this._shouldRenderPopup=!1,this._lastClick=t.latlng},_calculateBbox:function(){var t=this._map.getPixelBounds(),e=this._map.unproject(t.getBottomLeft()),t=this._map.unproject(t.getTopRight()),t=this._map.options.crs.project(t),e=this._map.options.crs.project(e),t=m.bounds(t,e);return[t.getBottomLeft().x,t.getBottomLeft().y,t.getTopRight().x,t.getTopRight().y].join(",")},_calculateImageSize:function(){var t=this._map.getPixelBounds(),e=this._map.getSize(),i=this._map.unproject(t.getBottomLeft()),t=this._map.unproject(t.getTopRight()),t=this._map.latLngToLayerPoint(t).y,i=this._map.latLngToLayerPoint(i).y;return(0<t||i<e.y)&&(e.y=i-t),e.x+","+e.y}}),dt=i.extend({options:{updateInterval:150,format:"jpgpng",transparent:!0,f:"image"},query:function(){return this.service.query()},identify:function(){return this.service.identify()},initialize:function(t){t=b(t),this.service=lt(t),this.service.addEventParent(this),m.Util.setOptions(this,t)},setPixelType:function(t){return this.options.pixelType=t,this._update(),this},getPixelType:function(){return this.options.pixelType},setBandIds:function(t){return m.Util.isArray(t)?this.options.bandIds=t.join(","):this.options.bandIds=t.toString(),this._update(),this},getBandIds:function(){return this.options.bandIds},setNoData:function(t,e){return m.Util.isArray(t)?this.options.noData=t.join(","):this.options.noData=t.toString(),e&&(this.options.noDataInterpretation=e),this._update(),this},getNoData:function(){return this.options.noData},getNoDataInterpretation:function(){return this.options.noDataInterpretation},setRenderingRule:function(t){this.options.renderingRule=t,this._update()},getRenderingRule:function(){return this.options.renderingRule},setMosaicRule:function(t){this.options.mosaicRule=t,this._update()},getMosaicRule:function(){return this.options.mosaicRule},_getPopupData:function(s){var t=m.Util.bind(function(t,e,i){t||setTimeout(m.Util.bind(function(){this._renderPopup(s.latlng,t,e,i)},this),300)},this),e=this.identify().at(s.latlng);this.options.mosaicRule&&e.setMosaicRule(this.options.mosaicRule),e.run(t),this._shouldRenderPopup=!0,this._lastClick=s.latlng},_buildExportParams:function(){var t=parseInt(this._map.options.crs.code.split(":")[1],10),t={bbox:this._calculateBbox(),size:this._calculateImageSize(),format:this.options.format,transparent:this.options.transparent,bboxSR:t,imageSR:t};return this.options.from&&this.options.to&&(t.time=this.options.from.valueOf()+","+this.options.to.valueOf()),this.options.pixelType&&(t.pixelType=this.options.pixelType),this.options.interpolation&&(t.interpolation=this.options.interpolation),this.options.compressionQuality&&(t.compressionQuality=this.options.compressionQuality),this.options.bandIds&&(t.bandIds=this.options.bandIds),0!==this.options.noData&&!this.options.noData||(t.noData=this.options.noData),this.options.noDataInterpretation&&(t.noDataInterpretation=this.options.noDataInterpretation),this.service.options.token&&(t.token=this.service.options.token),this.options.renderingRule&&(t.renderingRule=JSON.stringify(this.options.renderingRule)),this.options.mosaicRule&&(t.mosaicRule=JSON.stringify(this.options.mosaicRule)),t},_requestExport:function(t,i){"json"===this.options.f?this.service.request("exportImage",t,function(t,e){t||(this.options.token&&(e.href+="?token="+this.options.token),this.options.proxy&&(e.href=this.options.proxy+"?"+e.href),this._renderImage(e.href,i))},this):(t.f="image",t=this.options.url+"exportImage"+m.Util.getParamString(t),this.options.proxy&&(t=this.options.proxy+"?"+t),this._renderImage(t,i))}}),mt=i.extend({options:{updateInterval:150,layers:!1,layerDefs:!1,timeOptions:!1,format:"png32",transparent:!0,f:"json"},initialize:function(t){t=b(t),this.service=nt(t),this.service.addEventParent(this),m.Util.setOptions(this,t)},getDynamicLayers:function(){return this.options.dynamicLayers},setDynamicLayers:function(t){return this.options.dynamicLayers=t,this._update(),this},getLayers:function(){return this.options.layers},setLayers:function(t){return this.options.layers=t,this._update(),this},getLayerDefs:function(){return this.options.layerDefs},setLayerDefs:function(t){return this.options.layerDefs=t,this._update(),this},getTimeOptions:function(){return this.options.timeOptions},setTimeOptions:function(t){return this.options.timeOptions=t,this._update(),this},query:function(){return this.service.query()},identify:function(){return this.service.identify()},find:function(){return this.service.find()},_getPopupData:function(s){var t,e=m.Util.bind(function(t,e,i){t||setTimeout(m.Util.bind(function(){this._renderPopup(s.latlng,t,e,i)},this),300)},this);if((t=(this.options.popup||this.identify()).on(this._map).at(s.latlng)).params.maxAllowableOffset||t.simplify(this._map,.5),this.options.popup&&this.options.popup.params&&this.options.popup.params.layers||(this.options.layers?t.layers("visible:"+this.options.layers.join(",")):t.layers("visible")),this.options.layerDefs&&"string"!=typeof this.options.layerDefs&&!t.params.layerDefs)for(var i in this.options.layerDefs)Object.prototype.hasOwnProperty.call(this.options.layerDefs,i)&&t.layerDef(i,this.options.layerDefs[i]);t.run(e),this._shouldRenderPopup=!0,this._lastClick=s.latlng},_buildExportParams:function(){var t=parseInt(this._map.options.crs.code.split(":")[1],10),t={bbox:this._calculateBbox(),size:this._calculateImageSize(),dpi:96,format:this.options.format,transparent:this.options.transparent,bboxSR:t,imageSR:t};if(this.options.dynamicLayers&&(t.dynamicLayers=this.options.dynamicLayers),this.options.layers){if(0===this.options.layers.length)return;t.layers="show:"+this.options.layers.join(",")}return this.options.layerDefs&&(t.layerDefs="string"==typeof this.options.layerDefs?this.options.layerDefs:JSON.stringify(this.options.layerDefs)),this.options.timeOptions&&(t.timeOptions=JSON.stringify(this.options.timeOptions)),this.options.from&&this.options.to&&(t.time=this.options.from.valueOf()+","+this.options.to.valueOf()),this.service.options.token&&(t.token=this.service.options.token),this.options.proxy&&(t.proxy=this.options.proxy),this.options.disableCache&&(t._ts=Date.now()),t},_requestExport:function(t,i){"json"===this.options.f?this.service.request("export",t,function(t,e){t||(this.options.token&&e.href&&(e.href+="?token="+this.options.token),this.options.proxy&&e.href&&(e.href=this.options.proxy+"?"+e.href),e.href?this._renderImage(e.href,i):this._renderImage(e.imageData,i,e.contentType))},this):(t.f="image",t=this.options.url+"export"+m.Util.getParamString(t),this.options.proxy&&(t=this.options.proxy+"?"+t),this._renderImage(t,i))}}),k=m.Layer.extend({options:{cellSize:512,updateWhenIdle:m.Browser.mobile,updateInterval:150,noWrap:!1,keepBuffer:1.5},initialize:function(t){m.Util.setOptions(this,t)},onAdd:function(t){this._cells={},this._activeCells={},this._resetView(),this._update()},onRemove:function(t){this._removeAllCells(),this._cellZoom=void 0},isLoading:function(){return this._loading},redraw:function(){return this._map&&(this._removeAllCells(),this._update()),this},getEvents:function(){var t={viewprereset:this._invalidateAll,viewreset:this._resetView,zoom:this._resetView,moveend:this._onMoveEnd};return this.options.updateWhenIdle||(this._onMove||(this._onMove=m.Util.throttle(this._onMoveEnd,this.options.updateInterval,this)),t.move=this._onMove),t},createCell:function(){return document.createElement("div")},removeCell:function(){},reuseCell:function(){},cellLeave:function(){},cellEnter:function(){},getCellSize:function(){var t=this.options.cellSize;return t instanceof m.Point?t:new m.Point(t,t)},_pruneCells:function(){if(this._map){var t,e,i;for(t in this._cells)(e=this._cells[t]).retain=e.current;for(t in this._cells)(e=this._cells[t]).current&&!e.active&&(i=e.coords,this._retainParent(i.x,i.y,i.z,i.z-5)||this._retainChildren(i.x,i.y,i.z,i.z+2));for(t in this._cells)this._cells[t].retain||this._removeCell(t)}},_removeAllCells:function(){for(var t in this._cells)this._removeCell(t)},_invalidateAll:function(){this._removeAllCells(),this._cellZoom=void 0},_retainParent:function(t,e,i,s){var t=Math.floor(t/2),e=Math.floor(e/2),i=i-1,r=new m.Point(+t,+e),r=(r.z=i,this._cellCoordsToKey(r)),r=this._cells[r];return r&&r.active?r.retain=!0:(r&&r.loaded&&(r.retain=!0),s<i&&this._retainParent(t,e,i,s))},_retainChildren:function(t,e,i,s){for(var r=2*t;r<2*t+2;r++)for(var o=2*e;o<2*e+2;o++){var n=new m.Point(r,o),n=(n.z=i+1,this._cellCoordsToKey(n)),n=this._cells[n];n&&n.active?n.retain=!0:(n&&n.loaded&&(n.retain=!0),i+1<s&&this._retainChildren(r,o,i+1,s))}},_resetView:function(t){t=t&&(t.pinch||t.flyTo);t||this._setView(this._map.getCenter(),this._map.getZoom(),t,t)},_setView:function(t,e,i,s){e=Math.round(e);s||(this._cellZoom=e,this._abortLoading&&this._abortLoading(),this._resetGrid(),void 0!==e&&this._update(t),i||this._pruneCells(),this._noPrune=!!i)},_resetGrid:function(){var t=this._map,e=t.options.crs,i=this._cellSize=this.getCellSize(),s=this._cellZoom,r=this._map.getPixelWorldBounds(this._cellZoom);r&&(this._globalCellRange=this._pxBoundsToCellRange(r)),this._wrapX=e.wrapLng&&!this.options.noWrap&&[Math.floor(t.project([0,e.wrapLng[0]],s).x/i.x),Math.ceil(t.project([0,e.wrapLng[1]],s).x/i.y)],this._wrapY=e.wrapLat&&!this.options.noWrap&&[Math.floor(t.project([e.wrapLat[0],0],s).y/i.x),Math.ceil(t.project([e.wrapLat[1],0],s).y/i.y)]},_onMoveEnd:function(t){t&&(t.pinch||t.flyTo)||!this._map||this._map._animatingZoom||this._update()},_getCelldPixelBounds:function(t){var e=this._map,i=e._animatingZoom?Math.max(e._animateToZoom,e.getZoom()):e.getZoom(),i=e.getZoomScale(i,this._cellZoom),t=e.project(t,this._cellZoom).floor(),e=e.getSize().divideBy(2*i);return new m.Bounds(t.subtract(e),t.add(e))},_update:function(t){var e=this._map;if(e){var i,s=Math.round(e.getZoom()),e=(void 0===t&&(t=e.getCenter()),this._getCelldPixelBounds(t)),r=this._pxBoundsToCellRange(e),o=r.getCenter(),n=[],e=this.options.keepBuffer,a=new m.Bounds(r.getBottomLeft().subtract([e,-e]),r.getTopRight().add([e,-e]));if(!(isFinite(r.min.x)&&isFinite(r.min.y)&&isFinite(r.max.x)&&isFinite(r.max.y)))throw new Error("Attempted to load an infinite number of cells");for(i in this._cells){var l=this._cells[i].coords;l.z===this._cellZoom&&a.contains(new m.Point(l.x,l.y))||(this._cells[i].current=!1)}if(1<Math.abs(s-this._cellZoom))this._setView(t,s);else{for(var u=r.min.y;u<=r.max.y;u++)for(var h=r.min.x;h<=r.max.x;h++){var c,p=new m.Point(h,u);p.z=this._cellZoom,this._isValidCell(p)&&((c=this._cells[this._cellCoordsToKey(p)])?c.current=!0:n.push(p))}if(n.sort(function(t,e){return t.distanceTo(o)-e.distanceTo(o)}),0!==n.length)for(this._loading||(this._loading=!0),h=0;h<n.length;h++){var d=this._cellCoordsToKey(n[h]),d=this._keyToCellCoords(d);this._activeCells[d]?this._reuseCell(n[h]):this._createCell(n[h])}}}},_isValidCell:function(t){var e=this._map.options.crs;if(!e.infinite){var i=this._globalCellRange;if(!e.wrapLng&&(t.x<i.min.x||t.x>i.max.x)||!e.wrapLat&&(t.y<i.min.y||t.y>i.max.y))return!1}if(!this.options.bounds)return!0;e=this._cellCoordsToBounds(t);return m.toLatLngBounds(this.options.bounds).overlaps(e)},_keyToBounds:function(t){return this._cellCoordsToBounds(this._keyToCellCoords(t))},_cellCoordsToNwSe:function(t){var e=this._map,i=this.getCellSize(),s=t.scaleBy(i),i=s.add(i);return[e.unproject(s,t.z),e.unproject(i,t.z)]},_cellCoordsToBounds:function(t){t=this._cellCoordsToNwSe(t),t=new m.LatLngBounds(t[0],t[1]);return t=this.options.noWrap?t:this._map.wrapLatLngBounds(t)},_cellCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToCellCoords:function(t){var t=t.split(":"),e=new m.Point(+t[0],+t[1]);return e.z=+t[2],e},_removeCell:function(t){var e,i,s=this._cells[t];s&&(i=this._keyToCellCoords(t),e=this._wrapCoords(i),i=this._cellCoordsToBounds(this._wrapCoords(i)),s.current=!1,delete this._cells[t],this._activeCells[t]=s,this.cellLeave(i,e,t),this.fire("cellleave",{key:t,coords:e,bounds:i}))},_reuseCell:function(t){var e=this._cellCoordsToKey(t),i=(this._cells[e]=this._activeCells[e],this._cells[e].current=!0,this._wrapCoords(t)),t=this._cellCoordsToBounds(this._wrapCoords(t));this.cellEnter(t,i,e),this.fire("cellenter",{key:e,coords:i,bounds:t})},_createCell:function(t){var e=this._cellCoordsToKey(t),i=this._wrapCoords(t),s=this._cellCoordsToBounds(this._wrapCoords(t));this.createCell(s,i,e),this.fire("cellcreate",{key:e,coords:i,bounds:s}),this._cells[e]={coords:t,current:!0},m.Util.requestAnimFrame(this._pruneCells,this)},_cellReady:function(t,e,i){t=this._cellCoordsToKey(t);(i=this._cells[t])&&(i.loaded=+new Date,i.active=!0)},_getCellPos:function(t){return t.scaleBy(this.getCellSize())},_wrapCoords:function(t){var e=new m.Point(this._wrapX?m.Util.wrapNum(t.x,this._wrapX):t.x,this._wrapY?m.Util.wrapNum(t.y,this._wrapY):t.y);return e.z=t.z,e},_pxBoundsToCellRange:function(t){var e=this.getCellSize();return new m.Bounds(t.min.unscaleBy(e).floor(),t.max.unscaleBy(e).ceil().subtract([1,1]))}});function M(t){this.values=[].concat(t||[])}M.prototype.query=function(t){t=this.getIndex(t);return this.values[t]},M.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=1+e;else{if(!(+i.value>+t))return e;r=e-1}return Math.abs(~r)},M.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)},M.prototype.insert=function(t){return this.values.splice(this.getIndex(t.value),0,t),this},M.prototype.bulkAdd=function(t,e){return this.values=this.values.concat([].concat(t||[])),e?this.sort():this.dirty=!0,this};var U=k.extend({options:{attribution:null,where:"1=1",fields:["*"],from:!(M.prototype.sort=function(){return this.values.sort(function(t,e){return+e.value-+t.value}).reverse(),this.dirty=!1,this}),to:!1,timeField:!1,timeFilterMode:"server",simplifyFactor:0,precision:6,fetchAllFeatures:!1},initialize:function(t){if(k.prototype.initialize.call(this,t),t=b(t),t=m.Util.setOptions(this,t),this.service=ht(t),this.service.addEventParent(this),"*"!==this.options.fields[0]){for(var e=!1,i=0;i<this.options.fields.length;i++)this.options.fields[i].match(/^(OBJECTID|FID|OID|ID)$/i)&&(e=!0);!1===e&&c("no known esriFieldTypeOID field detected in fields Array. Please add an attribute field containing unique IDs to ensure the layer can be drawn correctly.")}this.options.timeField.start&&this.options.timeField.end?(this._startTimeIndex=new M,this._endTimeIndex=new M):this.options.timeField&&(this._timeIndex=new M),this._cache={},this._currentSnapshot=[],this._activeRequests=0},onAdd:function(s){return S(s),this.service.metadata(function(t,e){var i;t||(t=e.supportedQueryFormats,!(i=(i=!1)!==this.service.options.isModern&&!this.options.fetchAllFeatures?i:!0)&&t&&-1!==t.indexOf("geoJSON")&&(this.service.options.isModern=!0),e.objectIdField&&(this.service.options.idAttribute=e.objectIdField),!this.options.attribution&&s.attributionControl&&e.copyrightText&&(this.options.attribution=e.copyrightText,s.attributionControl.addAttribution(this.getAttribution())))},this),s.on("zoomend",this._handleZoomChange,this),k.prototype.onAdd.call(this,s)},onRemove:function(t){return A(t),t.off("zoomend",this._handleZoomChange,this),k.prototype.onRemove.call(this,t)},getAttribution:function(){return this.options.attribution},createCell:function(t,e){this._visibleZoom()&&this._requestFeatures(t,e)},_requestFeatures:function(s,r,o,n){this._activeRequests++,n=n||0;var a=this.options.where;return 1===this._activeRequests&&this.fire("loading",{bounds:s},!0),this._buildQuery(s,n).run(function(t,e,i){i&&i.exceededTransferLimit&&this.fire("drawlimitexceeded"),this.options.where===a&&(!t&&e&&e.features.length&&m.Util.requestAnimFrame(m.Util.bind(function(){this._addFeatures(e.features,r),this._postProcessFeatures(s)},this)),t||!e||e.features.length||this._postProcessFeatures(s),t&&this._postProcessFeatures(s),o&&o.call(this,t,e),i&&(i.exceededTransferLimit||i.properties&&i.properties.exceededTransferLimit)&&this.options.fetchAllFeatures&&this._requestFeatures(s,r,o,n+e.features.length))},this)},_postProcessFeatures:function(t){this._activeRequests--,this._activeRequests<=0&&this.fire("load",{bounds:t})},_cacheKey:function(t){return t.z+":"+t.x+":"+t.y},_addFeatures:function(t,e){var i;e&&(i=this._cacheKey(e),this._cache[i]=this._cache[i]||[]);for(var s=t.length-1;0<=s;s--){var r=t[s].id;-1===this._currentSnapshot.indexOf(r)&&this._currentSnapshot.push(r),void 0!==i&&-1===this._cache[i].indexOf(r)&&this._cache[i].push(r)}this.options.timeField&&this._buildTimeIndexes(t),this.createLayers(t)},_buildQuery:function(t,e){t=this.service.query().intersects(t).where(this.options.where).fields(this.options.fields).precision(this.options.precision);return(t=this.options.fetchAllFeatures&&!isNaN(parseInt(e))?t.offset(e):t).params.resultType="tile",this.options.requestParams&&m.Util.extend(t.params,this.options.requestParams),this.options.simplifyFactor&&t.simplify(this._map,this.options.simplifyFactor),"server"===this.options.timeFilterMode&&this.options.from&&this.options.to&&t.between(this.options.from,this.options.to),t},setWhere:function(s,r,o){this.options.where=s&&s.length?s:"1=1";for(var t,n=[],a=[],l=0,u=null,e=m.Util.bind(function(t,e){if(t&&(u=t),e)for(var i=e.features.length-1;0<=i;i--)a.push(e.features[i].id);--l<=0&&this._visibleZoom()&&s===this.options.where&&(this._currentSnapshot=a,m.Util.requestAnimFrame(m.Util.bind(function(){this.removeLayers(n),this.addLayers(a),r&&r.call(o,u)},this)))},this),i=this._currentSnapshot.length-1;0<=i;i--)n.push(this._currentSnapshot[i]);for(t in this._cache={},this._cells){l++;var h=this._keyToCellCoords(t),c=this._cellCoordsToBounds(h);this._requestFeatures(c,h,e)}return this},getWhere:function(){return this.options.where},getTimeRange:function(){return[this.options.from,this.options.to]},setTimeRange:function(e,i,s,r){var o=this.options.from,n=this.options.to,a=0,l=null,t=m.Util.bind(function(t){t&&(l=t),this._filterExistingFeatures(o,n,e,i),a--,s&&a<=0&&s.call(r,l)},this);if(this.options.from=e,this.options.to=i,this._filterExistingFeatures(o,n,e,i),"server"===this.options.timeFilterMode)for(var u in this._cells){a++;var u=this._keyToCellCoords(u),h=this._cellCoordsToBounds(u);this._requestFeatures(h,u,t)}return this},refresh:function(){this.setWhere(this.options.where)},_filterExistingFeatures:function(t,e,i,s){var r=t&&e?this._getFeaturesInTimeRange(t,e):this._currentSnapshot,o=this._getFeaturesInTimeRange(i,s);if(o.indexOf)for(var n=0;n<o.length;n++){var a=r.indexOf(o[n]);0<=a&&r.splice(a,1)}m.Util.requestAnimFrame(m.Util.bind(function(){this.removeLayers(r),this.addLayers(o)},this))},_getFeaturesInTimeRange:function(t,e){var i=[];if(this.options.timeField.start&&this.options.timeField.end)var s=this._startTimeIndex.between(t,e),r=this._endTimeIndex.between(t,e),o=s.concat(r);else{if(!this._timeIndex)return c("You must set timeField in the layer constructor in order to manipulate the start and end time filter."),[];o=this._timeIndex.between(t,e)}for(var n=o.length-1;0<=n;n--)i.push(o[n].id);return i},_buildTimeIndexes:function(t){var e;if(this.options.timeField.start&&this.options.timeField.end){for(var i=[],s=[],r=t.length-1;0<=r;r--)e=t[r],i.push({id:e.id,value:new Date(e.properties[this.options.timeField.start])}),s.push({id:e.id,value:new Date(e.properties[this.options.timeField.end])});this._startTimeIndex.bulkAdd(i),this._endTimeIndex.bulkAdd(s)}else{var o=[];for(r=t.length-1;0<=r;r--)e=t[r],o.push({id:e.id,value:new Date(e.properties[this.options.timeField])});this._timeIndex.bulkAdd(o)}},_featureWithinTimeRange:function(t){if(!this.options.from||!this.options.to)return!0;var e,i=+this.options.from.valueOf(),s=+this.options.to.valueOf();return"string"==typeof this.options.timeField?i<=(e=+t.properties[this.options.timeField])&&e<=s:this.options.timeField.start&&this.options.timeField.end?(e=+t.properties[this.options.timeField.start],t=+t.properties[this.options.timeField.end],i<=e&&e<=s||i<=t&&t<=s||e<=i&&s<=t):void 0},_visibleZoom:function(){if(!this._map)return!1;var t=this._map.getZoom();return!(t>this.options.maxZoom||t<this.options.minZoom)},_handleZoomChange:function(){if(this._visibleZoom())for(var t in this._cells){t=this._cells[t].coords,t=this._cacheKey(t);this._cache[t]&&this.addLayers(this._cache[t])}else this.removeLayers(this._currentSnapshot),this._currentSnapshot=[]},authenticate:function(t){return this.service.authenticate(t),this},metadata:function(t,e){return this.service.metadata(t,e),this},query:function(){return this.service.query()},_getMetadata:function(i){this._metadata?i(void 0,this._metadata):this.metadata(m.Util.bind(function(t,e){this._metadata=e,i(t,this._metadata)},this))},addFeature:function(t,e,i){this.addFeatures(t,e,i)},addFeatures:function(e,o,n){this._getMetadata(m.Util.bind(function(t,s){var r;t?o&&o.call(this,t,null):(r=e.features||[e],this.service.addFeatures(e,m.Util.bind(function(t,e){if(!t){for(var i=r.length-1;0<=i;i--)r[i].properties[s.objectIdField]=(1<r.length?e[i]:e).objectId,r[i].id=(1<r.length?e[i]:e).objectId;this._addFeatures(r)}o&&o.call(n,t,e)},this)))},this))},updateFeature:function(t,e,i){this.updateFeatures(t,e,i)},updateFeatures:function(t,s,r){var o=t.features||[t];this.service.updateFeatures(t,function(t,e){if(!t){for(var i=o.length-1;0<=i;i--)this.removeLayers([o[i].id],!0);this._addFeatures(o)}s&&s.call(r,t,e)},this)},deleteFeature:function(t,e,i){this.deleteFeatures(t,e,i)},deleteFeatures:function(t,r,o){return this.service.deleteFeatures(t,function(t,e){var i=e.length?e:[e];if(!t&&0<i.length)for(var s=i.length-1;0<=s;s--)this.removeLayers([i[s].objectId],!0);r&&r.call(o,t,e)},this)}}),ft=U.extend({options:{cacheLayers:!0},initialize:function(t){t.apikey&&(t.token=t.apikey),U.prototype.initialize.call(this,t),this._originalStyle=this.options.style,this._layers={}},onRemove:function(t){for(var e in this._layers)t.removeLayer(this._layers[e]),this.fire("removefeature",{feature:this._layers[e].feature,permanent:!1},!0);return U.prototype.onRemove.call(this,t)},createNewLayer:function(t){t=m.GeoJSON.geometryToLayer(t,this.options);return t&&(t.defaultOptions=t.options),t},_updateLayer:function(t,e){var i=[],s=this.options.coordsToLatLng||m.GeoJSON.coordsToLatLng;switch(e.properties&&(t.feature.properties=e.properties),e.geometry.type){case"Point":i=m.GeoJSON.coordsToLatLng(e.geometry.coordinates),t.setLatLng(i);break;case"LineString":i=m.GeoJSON.coordsToLatLngs(e.geometry.coordinates,0,s),t.setLatLngs(i);break;case"MultiLineString":case"Polygon":i=m.GeoJSON.coordsToLatLngs(e.geometry.coordinates,1,s),t.setLatLngs(i);break;case"MultiPolygon":i=m.GeoJSON.coordsToLatLngs(e.geometry.coordinates,2,s),t.setLatLngs(i)}this.redraw(t.feature.id)},createLayers:function(t){for(var e=t.length-1;0<=e;e--){var i=t[e],s=this._layers[i.id];!this._visibleZoom()||!s||this._map.hasLayer(s)||this.options.timeField&&!this._featureWithinTimeRange(i)||(this._map.addLayer(s),this.fire("addfeature",{feature:s.feature},!0)),s&&(s.setLatLngs||s.setLatLng)&&this._updateLayer(s,i),s||((s=this.createNewLayer(i))?(s.feature=i,s.addEventParent(this),this.options.onEachFeature&&this.options.onEachFeature(s.feature,s),this._layers[s.feature.id]=s,this.setFeatureStyle(s.feature.id,this.options.style),this.fire("createfeature",{feature:s.feature},!0),this._visibleZoom()&&(!this.options.timeField||this.options.timeField&&this._featureWithinTimeRange(i))&&this._map.addLayer(s)):c("invalid GeoJSON encountered"))}},addLayers:function(t){for(var e=t.length-1;0<=e;e--){var i=this._layers[t[e]];!i||this.options.timeField&&!this._featureWithinTimeRange(i.feature)||(this._map.addLayer(i),this.fire("addfeature",{feature:i.feature},!0))}},removeLayers:function(t,e){for(var i=t.length-1;0<=i;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&&m.Util.requestAnimFrame(m.Util.bind(function(){var t=this._cacheKey(i),e=this._cellCoordsToKey(i),t=this._cache[t];this._activeCells[e]&&t&&this.addLayers(t)},this))},cellLeave:function(t,a){this._zooming||m.Util.requestAnimFrame(m.Util.bind(function(){if(this._map){var t=this._cacheKey(a),e=this._cellCoordsToKey(a),i=this._cache[t],s=this._map.getBounds();if(!this._activeCells[e]&&i){for(var r=!0,o=0;o<i.length;o++){var n=this._layers[i[o]];n&&n.getBounds&&s.intersects(n.getBounds())&&(r=!1)}r&&this.removeLayers(i,!this.options.cacheLayers),!this.options.cacheLayers&&r&&(delete this._cache[t],delete this._cells[e],delete this._activeCells[e])}}},this))},resetStyle:function(){return this.options.style=this._originalStyle,this.eachFeature(function(t){this.resetFeatureStyle(t.feature.id)},this),this},setStyle:function(e){return this.options.style=e,this.eachFeature(function(t){this.setFeatureStyle(t.feature.id,e)},this),this},resetFeatureStyle:function(t){var e=this._layers[t],i=this._originalStyle||m.Path.prototype.options;return e&&(m.Util.extend(e.options,e.defaultOptions),this.setFeatureStyle(t,i)),this},setFeatureStyle:function(t,e){t=this._layers[t];return"function"==typeof e&&(e=e(t.feature)),t.setStyle&&t.setStyle(e),this},eachActiveFeature:function(t,e){if(this._map){var i,s=this._map.getBounds();for(i in this._layers)-1!==this._currentSnapshot.indexOf(this._layers[i].feature.id)&&("function"==typeof this._layers[i].getLatLng&&s.contains(this._layers[i].getLatLng())||"function"==typeof this._layers[i].getBounds&&s.intersects(this._layers[i].getBounds()))&&t.call(e,this._layers[i])}return this},eachFeature:function(t,e){for(var i in this._layers)t.call(e,this._layers[i]);return this},getFeature:function(t){return this._layers[t]},bringToBack:function(){this.eachFeature(function(t){t.bringToBack&&t.bringToBack()})},bringToFront:function(){this.eachFeature(function(t){t.bringToFront&&t.bringToFront()})},redraw:function(t){return t&&this._redraw(t),this},_redraw:function(t){var e,t=this._layers[t],i=t.feature;t&&t.setIcon&&this.options.pointToLayer&&this.options.pointToLayer&&(e=this.options.pointToLayer(i,m.latLng(i.geometry.coordinates[1],i.geometry.coordinates[0])).options.icon,t.setIcon(e)),t&&t.setStyle&&this.options.pointToLayer&&(e=this.options.pointToLayer(i,m.latLng(i.geometry.coordinates[1],i.geometry.coordinates[0])).options,this.setFeatureStyle(i.id,e)),t&&t.setStyle&&this.options.style&&this.resetFeatureStyle(i.id)},openPopup(t){return this._popup&&this._popup._prepareOpen(t||this._latlng)&&this._popup.openOn(this._map),this},openTooltip(t){return this._tooltip&&this._tooltip._prepareOpen(t)&&(this._tooltip.openOn(this._map),this.getElement?this._setAriaDescribedByOnLayer(this):this.eachLayer&&this.eachLayer(this._setAriaDescribedByOnLayer,this)),this}});t.BasemapLayer=F,t.DynamicMapLayer=mt,t.FeatureLayer=ft,t.FeatureLayerService=ut,t.FeatureManager=U,t.Find=$,t.Identify=R,t.IdentifyFeatures=et,t.IdentifyImage=st,t.ImageMapLayer=dt,t.ImageService=at,t.MapService=ot,t.Query=Y,t.RasterLayer=i,t.Service=P,t.Support=a,t.Task=C,t.TiledMapLayer=ct,t.Util=X,t.VERSION="3.0.10",t.basemapLayer=function(t,e){return new F(t,e)},t.dynamicMapLayer=function(t,e){return new mt(t,e)},t.featureLayer=function(t){return new ft(t)},t.featureLayerService=ht,t.find=tt,t.get=r,t.identify=function(t){return new R(t)},t.identifyFeatures=it,t.identifyImage=rt,t.imageMapLayer=function(t,e){return new dt(t,e)},t.imageService=lt,t.mapService=nt,t.options=G,t.post=q,t.query=w,t.request=s,t.service=function(t){return t=b(t),new P(t)},t.task=function(t){return t=b(t),new C(t)},t.tiledMapLayer=function(t,e){return new ct(t,e)},Object.defineProperty(t,"__esModule",{value:!0})});