/*
 COPYRIGHT 2009 ESRI

 TRADE SECRETS: ESRI PROPRIETARY AND CONFIDENTIAL
 Unpublished material - all rights reserved under the
 Copyright Laws of the United States and applicable international
 laws, treaties, and conventions.

 For additional information, contact:
 Environmental Systems Research Institute, Inc.
 Attn: Contracts and Legal Services Department
 380 New York Street
 Redlands, California, 92373
 USA

 email: contracts@esri.com
 */
//>>built
require({cache:{"esri/layers/FeatureEditResult":function(){define(["dojo/_base/declare","dojo/_base/lang","dojo/has","esri/kernel"],function(_1,_2,_3,_4){var _5=_1(null,{declaredClass:"esri.layers.FeatureEditResult",constructor:function(_6){if(_6&&_2.isObject(_6)){this.objectId=_6.objectId;this.success=_6.success;if(!_6.success){var _7=_6.error;this.error=new Error();this.error.code=_7.code;this.error.message=_7.description;}}}});if(_3("extend-esri")){_2.setObject("layers.FeatureEditResult",_5,_4);}return _5;});},"esri/layers/MapImageLayer":function(){define(["dojo/_base/declare","dojo/_base/connect","dojo/_base/lang","dojo/_base/array","dojo/dom-construct","dojo/dom-style","esri/kernel","esri/config","esri/sniff","esri/domUtils","esri/geometry/Point","esri/geometry/webMercatorUtils","esri/layers/layer"],function(_8,_9,_a,_b,_c,_d,_e,_f,has,_10,_11,_12,_13){var _14=_8([_13],{declaredClass:"esri.layers.MapImageLayer","-chains-":{constructor:"manual"},constructor:function(_15){this.inherited(arguments,[null,_15]);this._mapImages=[];var _16=_a.hitch;this._panStart=_16(this,this._panStart);this._pan=_16(this,this._pan);this._extentChange=_16(this,this._extentChange);this._zoom=_16(this,this._zoom);this._zoomStart=_16(this,this._zoomStart);this._scale=_16(this,this._scale);this._resize=_16(this,this._resize);_9.connect(this,"onSuspend",this,this._onSuspend);_9.connect(this,"onResume",this,this._onResume);this.loaded=true;this.onLoad(this);},opacity:1,_transform:_e._getDOMAccessor("transform"),addImage:function(_17){var _18=this._mapImages.push(_17);_18=_18-1;_17._idx=_18;_17._layer=this;if(this._div){this._createImage(_17,_18);}},removeImage:function(_19){if(_19){var idx=_19._idx,_1a=this._mapImages;if(_1a[idx]===_19){delete _1a[idx];var _1b=_19._node;if(_1b){this._clearEvents(_1b);_1b.e_idx=_1b.e_bl=_1b.e_tr=_1b.e_l=_1b.e_t=_1b.e_w=_1b.e_h=null;if(_1b.parentNode){_1b.parentNode.removeChild(_1b);_c.destroy(_1b);}}_19._node=_19._idx=_19._layer=null;}}},removeAllImages:function(){var _1c=this._mapImages,i,len=_1c.length;for(i=0;i<len;i++){var _1d=_1c[i];if(_1d){this.removeImage(_1d);}}this._mapImages=[];},getImages:function(){var _1e=this._mapImages,_1f=[],i,len=_1e.length;for(i=0;i<len;i++){if(_1e[i]){_1f.push(_1e[i]);}}return _1f;},setOpacity:function(_20){if(this.opacity!=_20){this._opacityChanged(this.opacity=_20);this.onOpacityChange();}},onOpacityChange:function(){},_opacityChanged:function(_21){var div=this._div,i,len,_22;if(div){if(!has("ie")||has("ie")>8){_d.set(div,"opacity",_21);}else{_22=div.childNodes;len=_22.length;for(i=0;i<len;i++){_d.set(_22[i],"opacity",_21);}}}},_createImage:function(_23,idx){var _24=_c.create("img");_d.set(_24,{position:"absolute"});if(has("ie")<=8){_d.set(_24,"opacity",this.opacity);}if(_23.rotation){var _25="rotate("+(360-_23.rotation)+"deg)";if(has("ie")<9){}else{_d.set(_24,this._transform,_25);_d.set(_24,"transform",_25);}}_23._node=_24;_24.e_idx=idx;_24.e_layer=this;_24.e_load=_9.connect(_24,"onload",_14.prototype._imageLoaded);_24.e_error=_9.connect(_24,"onerror",_14.prototype._imageError);_24.e_abort=_9.connect(_24,"onabort",_14.prototype._imageError);_24.src=_23.href;},_imageLoaded:function(evt,img){var _26=img||evt.target||evt.currentTarget,_27=_26.e_layer,_28=_27._mapImages[_26.e_idx],map=_27._map;if(map&&(map.__zooming||map.__panning||!_27._sr)){_27._standby.push(_26);return;}_27._clearEvents(_26);if(!_28||_28._node!==_26){return;}if(map){_27._attach(_28);}},_imageError:function(evt){var _29=evt.target||evt.currentTarget,_2a=_29.e_layer,_2b=_2a._mapImages[_29.e_idx];_2a._clearEvents(_29);if(_2b){_2b._node=null;}},_clearEvents:function(_2c){var _2d=_9.disconnect;_2d(_2c.e_load);_2d(_2c.e_error);_2d(_2c.e_abort);_2c.e_load=_2c.e_error=_2c.e_abort=_2c.e_layer=null;},_attach:function(_2e){var _2f=_2e.extent,_30=_2f.spatialReference,_31=this._sr,div=this._div,_32=_2e._node,_33=new _11({x:_2f.xmin,y:_2f.ymin,spatialReference:_30}),_34=new _11({x:_2f.xmax,y:_2f.ymax,spatialReference:_30});if(!_31.equals(_30)){if(_31.isWebMercator()&&_30.wkid===4326){_33=_12.geographicToWebMercator(_33);_34=_12.geographicToWebMercator(_34);}else{if(_30.isWebMercator()&&_31.wkid===4326){_33=_12.webMercatorToGeographic(_33);_34=_12.webMercatorToGeographic(_34);}}}_32.e_bl=_33;_32.e_tr=_34;if(_2e.visible){this._setPos(_32,div._left,div._top);(this._active||div).appendChild(_32);}},_setPos:function(_35,_36,_37){var _38=_35.e_bl,_39=_35.e_tr,map=this._map;_38=map.toScreen(_38);_39=map.toScreen(_39);var _3a=_38.x-_36,top=_39.y-_37,_3b=Math.abs(_39.x-_38.x),_3c=Math.abs(_38.y-_39.y),css={width:_3b+"px",height:_3c+"px"},_3d=this._mapImages[_35.e_idx];if(map.navigationMode==="css-transforms"){css[_e._css.names.transform]=_e._css.translate(_3a,top)+(_3d.rotation?(" "+_e._css.rotate(360-_3d.rotation)):"");}else{css.left=_3a+"px";css.top=top+"px";}_d.set(_35,css);_35.e_l=_3a;_35.e_t=top;_35.e_w=_3b;_35.e_h=_3c;},managedSuspension:true,_setMap:function(map,_3e){this.inherited(arguments);var div=this._div=_c.create("div",null,_3e),_3f=_e._css.names,css={position:"absolute"},vd=map.__visibleDelta;if(!has("ie")||has("ie")>8){css.opacity=this.opacity;}if(map.navigationMode==="css-transforms"){css[_3f.transform]=_e._css.translate(vd.x,vd.y);_d.set(div,css);div._left=vd.x;div._top=vd.y;css={position:"absolute",width:map.width+"px",height:map.height+"px",overflow:"visible"};this._active=_c.create("div",null,div);_d.set(this._active,css);this._passive=_c.create("div",null,div);_d.set(this._passive,css);}else{div._left=0;div._top=0;_d.set(div,css);}this._standby=[];var _40=this._mapImages,i,len=_40.length;for(i=0;i<len;i++){var _41=_40[i],_42=_41._node;if(!_42){this._createImage(_41,_41._idx);}}_10.hide(div);return div;},_unsetMap:function(map,_43){this._disconnect();var div=this._div;if(div){var _44=this._mapImages,i,len=_44.length;for(i=0;i<len;i++){var _45=_44[i];if(_45){var _46=_45._node;if(_46){this._clearEvents(_46);_46.e_idx=_46.e_bl=_46.e_tr=_46.e_l=_46.e_t=_46.e_w=_46.e_h=null;}_45._node=null;}}_43.removeChild(div);_c.destroy(div);}this._map=this._div=this._sr=this._active=this._passive=this._standby=null;this.inherited(arguments);},_onSuspend:function(){this._disconnect();_10.hide(this._div);},_onResume:function(evt){if(evt.firstOccurrence){this._sr=this._map.spatialReference;this._processStandbyList();}var map=this._map,div=this._div,vd=map.__visibleDelta;if(map.navigationMode==="css-transforms"){div._left=vd.x;div._top=vd.y;_d.set(div,_e._css.names.transform,_e._css.translate(div._left,div._top));}this._redraw(map.navigationMode==="css-transforms");this._connect(map);_10.show(div);},_connect:function(map){if(!this._connections){var _47=_9.connect,_48=(map.navigationMode==="css-transforms");this._connections=[_47(map,"onPanStart",this._panStart),_47(map,"onPan",this._pan),_47(map,"onExtentChange",this._extentChange),_48&&_47(map,"onZoomStart",this._zoomStart),_48?_47(map,"onScale",this._scale):_47(map,"onZoom",this._zoom),_48&&_47(map,"onResize",this._resize)];}},_disconnect:function(){if(this._connections){_b.forEach(this._connections,_9.disconnect);this._connections=null;}},_panStart:function(){this._panL=this._div._left;this._panT=this._div._top;},_pan:function(_49,_4a){var div=this._div;div._left=this._panL+_4a.x;div._top=this._panT+_4a.y;if(this._map.navigationMode==="css-transforms"){_d.set(div,_e._css.names.transform,_e._css.translate(div._left,div._top));}else{_d.set(div,{left:div._left+"px",top:div._top+"px"});}},_extentChange:function(_4b,_4c,_4d){if(_4d){this._redraw(this._map.navigationMode==="css-transforms");}else{if(_4c){this._pan(_4b,_4c);}}this._processStandbyList();},_processStandbyList:function(){var i,_4e=this._standby;if(_4e&&_4e.length){for(i=_4e.length-1;i>=0;i--){this._imageLoaded(null,_4e[i]);_4e.splice(i,1);}}},_redraw:function(_4f){if(_4f){var _50=this._passive,_51=_e._css.names;_d.set(_50,_51.transition,"none");this._moveImages(_50,this._active);_d.set(_50,_51.transform,"none");}var div=this._active||this._div,_52=this._div._left,_53=this._div._top,i,len=div.childNodes.length,_54;for(i=0;i<len;i++){_54=div.childNodes[i];this._setPos(_54,_52,_53);}},_zoom:function(_55,_56,_57){var div=this._div,_58=div._left,_59=div._top,i,len=div.childNodes.length,_5a;for(i=0;i<len;i++){_5a=div.childNodes[i];var _5b=_5a.e_w*_56,_5c=_5a.e_h*_56,_5d=(_57.x-_58-_5a.e_l)*(_5b-_5a.e_w)/_5a.e_w,_5e=(_57.y-_59-_5a.e_t)*(_5c-_5a.e_h)/_5a.e_h;_5d=isNaN(_5d)?0:_5d;_5e=isNaN(_5e)?0:_5e;_d.set(_5a,{left:(_5a.e_l-_5d)+"px",top:(_5a.e_t-_5e)+"px",width:_5b+"px",height:_5c+"px"});}},_zoomStart:function(){this._moveImages(this._active,this._passive);},_moveImages:function(_5f,_60){var _61=_5f.childNodes,i,len=_61.length;if(len>0){for(i=len-1;i>=0;i--){_60.appendChild(_61[i]);}}},_scale:function(mtx,_62){var css={},_63=_e._css.names,_64=this._passive;_d.set(_64,_63.transition,_62?"none":(_63.transformName+" "+_f.defaults.map.zoomDuration+"ms ease"));css[_63.transform]=_e._css.matrix(mtx);_d.set(_64,_63.transform,_e._css.matrix(mtx));},_resize:function(_65,_66,_67){_d.set(this._active,{width:_66+"px",height:_67+"px"});_d.set(this._passive,{width:_66+"px",height:_67+"px"});}});if(has("extend-esri")){_a.setObject("layers.MapImageLayer",_14,_e);}return _14;});},"esri/layers/WebTiledLayer":function(){define(["dojo/_base/declare","dojo/_base/lang","dojo/_base/array","dojo/_base/url","dojo/has","dojo/string","esri/kernel","esri/urlUtils","esri/SpatialReference","esri/geometry/Extent","esri/layers/TiledMapServiceLayer","esri/layers/TileInfo"],function(_68,_69,_6a,Url,has,_6b,_6c,_6d,_6e,_6f,_70,_71){var _72=_68(_70,{declaredClass:"esri.layers.WebTiledLayer",constructor:function(_73,_74){if(!_74){_74={};}this.urlTemplate=_73;var _75=new _6f(-20037508.342787,-20037508.34278,20037508.34278,20037508.342787,new _6e({wkid:102100}));var _76=new _6f(-20037508.342787,-20037508.34278,20037508.34278,20037508.342787,new _6e({wkid:102100}));this.initialExtent=_74.initialExtent||_75;this.fullExtent=_74.fullExtent||_76;if(_74.tileInfo){this.tileInfo=_74.tileInfo;}else{var _77=[{"level":0,"resolution":156543.033928,"scale":591657527.591555},{"level":1,"resolution":78271.5169639999,"scale":295828763.795777},{"level":2,"resolution":39135.7584820001,"scale":147914381.897889},{"level":3,"resolution":19567.8792409999,"scale":73957190.948944},{"level":4,"resolution":9783.93962049996,"scale":36978595.474472},{"level":5,"resolution":4891.96981024998,"scale":18489297.737236},{"level":6,"resolution":2445.98490512499,"scale":9244648.868618},{"level":7,"resolution":1222.99245256249,"scale":4622324.434309},{"level":8,"resolution":611.49622628138,"scale":2311162.217155},{"level":9,"resolution":305.748113140558,"scale":1155581.108577},{"level":10,"resolution":152.874056570411,"scale":577790.554289},{"level":11,"resolution":76.4370282850732,"scale":288895.277144},{"level":12,"resolution":38.2185141425366,"scale":144447.638572},{"level":13,"resolution":19.1092570712683,"scale":72223.819286},{"level":14,"resolution":9.55462853563415,"scale":36111.909643},{"level":15,"resolution":4.77731426794937,"scale":18055.954822},{"level":16,"resolution":2.38865713397468,"scale":9027.977411},{"level":17,"resolution":1.19432856685505,"scale":4513.988705},{"level":18,"resolution":0.597164283559817,"scale":2256.994353},{"level":19,"resolution":0.298582141647617,"scale":1128.497176}];var _78=new _71({"rows":256,"cols":256,"origin":{"x":-20037508.342787,"y":20037508.342787},"spatialReference":{"wkid":102100},"lods":_77});this.tileInfo=_78;}this.spatialReference=new _6e(this.tileInfo.spatialReference.toJson());this.copyright=_74.copyright||"";var url=new Url(_73);var _79=url.scheme+"://"+url.authority+"/";this.urlPath=_73.substring(_79.length);this.tileServers=_74.tileServers||[];if(url.authority.indexOf("{subDomain}")===-1){this.tileServers.push(_79);}if(_74.subDomains&&_74.subDomains.length>0&&url.authority.split(".").length>1){this.subDomains=_74.subDomains;var _7a;_6a.forEach(_74.subDomains,function(_7b,idx){if(url.authority.indexOf("${subDomain}")>-1){_7a=url.scheme+"://"+_6b.substitute(url.authority,{subDomain:_7b})+"/";}else{if(url.authority.indexOf("{subDomain}")>-1){_7a=url.scheme+"://"+url.authority.replace(/\{subDomain\}/gi,_7b)+"/";}}this.tileServers.push(_7a);},this);}this.tileServers=_6a.map(this.tileServers,function(_7c){if(_7c.charAt(_7c.length-1)!=="/"){_7c+="/";}return _7c;});this._levelToLevelValue=[];_6a.forEach(this.tileInfo.lods,function(_7d){this._levelToLevelValue[_7d.level]=_7d.levelValue?_7d.levelValue:_7d.level;},this);this.loaded=true;this.onLoad(this);},getTileUrl:function(_7e,row,col){_7e=this._levelToLevelValue[_7e];var _7f=this.tileServers[row%this.tileServers.length];var _80=_7f+_6b.substitute(this.urlPath,{level:_7e,col:col,row:row});_80=_80.replace(/\{level\}/gi,_7e);_80=_80.replace(/\{row\}/gi,row);_80=_80.replace(/\{col\}/gi,col);return _6d.addProxy(_80);}});if(has("extend-esri")){_69.setObject("layers.WebTiledLayer",_72,_6c);}return _72;});},"esri/layers/ServiceGeneratedFeatureCollection":function(){define(["dojo/_base/declare","dojo/_base/connect","dojo/_base/lang","dojo/_base/array","dojo/dom-construct","dojo/dom-style","dojo/has","esri/kernel","esri/SpatialReference","esri/geometry/Extent","esri/geometry/webMercatorUtils","esri/renderers/SimpleRenderer","esri/layers/layer","esri/layers/FeatureLayer","esri/dijit/PopupTemplate"],function(_81,_82,_83,_84,_85,_86,has,_87,_88,_89,_8a,_8b,_8c,_8d,_8e){var _8f=_81([_8c],{declaredClass:"esri.layers._ServiceGeneratedFeatureCollection",constructor:function(url,_90){this.pointSymbol=_90&&_90.pointSymbol;this.polylineSymbol=_90&&_90.polylineSymbol;this.polygonSymbol=_90&&_90.polygonSymbol;this._outSR=(_90&&(_90.outSpatialReference||_90.outSR))||new _88({wkid:4326});this._options=_90;},parse:function(){console.error("parse function has not been implemented");},getFeatureLayers:function(){var _91=[];if(this._fLayers){_91=_91.concat(this._fLayers);}return _91;},onRefresh:function(){},refresh:function(){if(!this.loaded||!this._map||this._io){return;}this._createLayer();},_createLayer:function(_92){var _93=this;this._fireUpdateStart();var _94=this.parse(_92);_94.addCallback(function(_95){_93._io=null;_93._initLayer(_95);});_94.addErrback(function(err){_93._io=null;err=_83.mixin(new Error(),err);err.message="Unable to load resource: "+_93.url+" "+(err.message||"");_93._fireUpdateEnd(err);_93.onError(err);});},_initLayer:function(_96){if(this.loaded){this._removeInternalLayers();}this.name=_96.name;this.description=_96.description;this.snippet=_96.snippet;if(_96.visibility!==undefined){this.defaultVisibility=this.visible=!!_96.visibility;}else{this.defaultVisibility=this.visible=true;}this.featureInfos=_96.featureInfos;this.fullExtent=this.initialExtent=new _89(_96.lookAtExtent);this.copyright=_96.author||_96.copyright;var _97;var _98=_83.getObject("featureCollection.layers",false,_96);if(_98&&_98.length>0){this._fLayers=[];_84.forEach(_98,function(_99,i){var _9a=_83.getObject("featureSet.features",false,_99),_9b;if(_9a&&_9a.length>0){_97=_83.mixin({outFields:["*"],infoTemplate:_99.popupInfo?new _8e(_99.popupInfo):null,editable:false},this._options);if(_97.id){_97.id=_97.id+"_"+i;}_99.layerDefinition.capabilities="Query,Data";_9b=new _8d(_99,_97);if(_9b.geometryType){this["_"+_9b.geometryType]=_9b;}this._fLayers.push(_9b);}},this);if(this._fLayers.length===0){delete this._fLayers;}}this.items=[];if(this._esriGeometryPoint){this.items=this.items.concat(this._esriGeometryPoint.graphics);if(this.pointSymbol){var _9c=new _8b(this.pointSymbol);this._esriGeometryPoint.setRenderer(_9c);}}if(this._esriGeometryPolyline){this.items=this.items.concat(this._esriGeometryPolyline.graphics);if(this.polylineSymbol){var _9d=new _8b(this.polylineSymbol);this._esriGeometryPolyline.setRenderer(_9d);}}if(this._esriGeometryPolygon){this.items=this.items.concat(this._esriGeometryPolygon.graphics);if(this.polygonSymbol){var _9e=new _8b(this.polygonSymbol);this._esriGeometryPolygon.setRenderer(_9e);}}this._fireUpdateEnd();if(this.loaded){this._addInternalLayers();this.onRefresh();}},_addInternalLayers:function(){var map=this._map;this._fireUpdateStart();var _9f=map.spatialReference,_a0=this._outSR,_a1;if(_9f.wkid){_a1=(_9f._isWebMercator()&&_a0._isWebMercator())||(_9f.wkid===_a0.wkid);}else{if(_9f.wkt){_a1=(_9f.wkt===_a0.wkt);}else{console.log("_setMap - map has invalid spatial reference");return;}}if(!_a1){if(_9f._isWebMercator()&&_a0.wkid===4326){this._converter=_8a.geographicToWebMercator;}else{if(_a0._isWebMercator()&&_9f.wkid===4326){this._converter=_8a.webMercatorToGeographic;}else{console.log("_setMap - unsupported workflow. Spatial reference of the map and layer do not match, and the conversion cannot be done on the client.");return;}}}var _a2=this._fLayers;if(_a2&&_a2.length>0){_84.forEach(_a2,function(_a3){if(this._converter){var _a4=_a3.graphics,i,_a5,len=_a4?_a4.length:0;for(i=0;i<len;i++){_a5=_a4[i].geometry;if(_a5){_a4[i].setGeometry(this._converter(_a5));}}}map.addLayer(_a3);},this);}this.setVisibility(this.visible);},_removeInternalLayers:function(){var map=this._map;if(map){_84.forEach(this.getFeatureLayers(),map.removeLayer,map);}},onVisibilityChange:function(_a6){this._fireUpdateStart();_84.forEach(this.getFeatureLayers(),function(_a7){_a7.setVisibility(_a6);});this._fireUpdateEnd();},_setMap:function(map,_a8){this.inherited(arguments);this._map=map;var div=this._div=_85.create("div",null,_a8);_86.set(div,"position","absolute");this._addInternalLayers();this.evaluateSuspension();return div;},_unsetMap:function(map,_a9){if(this._io){this._io.cancel();}_82.disconnect(this._extChgHandle);delete this._extChgHandle;this._removeInternalLayers();var div=this._div;if(div){_a9.removeChild(div);_85.destroy(div);}this._div=null;this.inherited(arguments);}});if(has("extend-esri")){_83.setObject("layers._ServiceGeneratedFeatureCollection",_8f,_87);}return _8f;});},"esri/layers/KMLGroundOverlay":function(){define(["dojo/_base/declare","dojo/_base/lang","dojo/has","esri/kernel","esri/lang","esri/layers/MapImage"],function(_aa,_ab,has,_ac,_ad,_ae){var _af=_aa([_ae],{declaredClass:"esri.layers.KMLGroundOverlay",constructor:function(_b0){if(_ad.isDefined(this.visibility)){this.visible=!!this.visibility;}}});if(has("extend-esri")){_ab.setObject("layers.KMLGroundOverlay",_af,_ac);}return _af;});},"dojo/data/util/simpleFetch":function(){define(["../../_base/lang","../../_base/kernel","./sorter"],function(_b1,_b2,_b3){var _b4={};_b1.setObject("dojo.data.util.simpleFetch",_b4);_b4.errorHandler=function(_b5,_b6){if(_b6.onError){var _b7=_b6.scope||_b2.global;_b6.onError.call(_b7,_b5,_b6);}};_b4.fetchHandler=function(_b8,_b9){var _ba=_b9.abort||null,_bb=false,_bc=_b9.start?_b9.start:0,_bd=(_b9.count&&(_b9.count!==Infinity))?(_bc+_b9.count):_b8.length;_b9.abort=function(){_bb=true;if(_ba){_ba.call(_b9);}};var _be=_b9.scope||_b2.global;if(!_b9.store){_b9.store=this;}if(_b9.onBegin){_b9.onBegin.call(_be,_b8.length,_b9);}if(_b9.sort){_b8.sort(_b3.createSortFunction(_b9.sort,this));}if(_b9.onItem){for(var i=_bc;(i<_b8.length)&&(i<_bd);++i){var _bf=_b8[i];if(!_bb){_b9.onItem.call(_be,_bf,_b9);}}}if(_b9.onComplete&&!_bb){var _c0=null;if(!_b9.onItem){_c0=_b8.slice(_bc,_bd);}_b9.onComplete.call(_be,_c0,_b9);}};_b4.fetch=function(_c1){_c1=_c1||{};if(!_c1.store){_c1.store=this;}this._fetchItems(_c1,_b1.hitch(this,"fetchHandler"),_b1.hitch(this,"errorHandler"));return _c1;};return _b4;});},"esri/layers/KMLLayer":function(){define(["dojo/_base/kernel","dojo/_base/declare","dojo/_base/connect","dojo/_base/lang","dojo/_base/array","dojo/_base/json","dojo/_base/sniff","dojo/io-query","dojo/dom-construct","dojo/dom-style","esri/kernel","esri/config","esri/lang","esri/request","esri/SpatialReference","esri/geometry/webMercatorUtils","esri/dijit/PopupTemplate","esri/layers/layer","esri/layers/KMLFolder","esri/layers/KMLGroundOverlay","esri/layers/MapImageLayer","esri/layers/FeatureLayer"],function(_c2,_c3,_c4,_c5,_c6,_c7,has,ioq,_c8,_c9,_ca,_cb,_cc,_cd,_ce,_cf,_d0,_d1,_d2,_d3,_d4,_d5){var _d6=_c3([_d1],{declaredClass:"esri.layers.KMLLayer",serviceUrl:location.protocol+"//utility.arcgis.com/sharing/kml",constructor:function(url,_d7){if(!url){console.log("KMLLayer:constructor - please provide url for the KML file");}this._outSR=(_d7&&_d7.outSR)||new _ce({wkid:4326});this._options=_d7;if(_cb.defaults.kmlService){this.serviceUrl=_cb.defaults.kmlService;}var _d8=(this.linkInfo=_d7&&_d7.linkInfo);if(_d8){this.visible=!!_d8.visibility;this._waitingForMap=!!_d8.viewFormat;}if(!_d8||(_d8&&_d8.visibility&&!this._waitingForMap)){this._parseKml();}this.refresh=_c5.hitch(this,this.refresh);this.registerConnectEvents("esri.layers.KMLLayer",true);},getFeature:function(_d9){if(!_d9){return;}var _da=_d9.type,id=_d9.id,_db,i,len;switch(_da){case "esriGeometryPoint":case "esriGeometryPolyline":case "esriGeometryPolygon":var _dc=this["_"+_da];if(_dc){_db=_c5.getObject("_mode._featureMap."+id,false,_dc);}break;case "GroundOverlay":var _dd=this._groundLyr;if(_dd){var _de=_dd.getImages();len=_de.length;for(i=0;i<len;i++){if(_de[i].id===id){_db=_de[i];break;}}}break;case "ScreenOverlay":break;case "NetworkLink":_c6.some(this._links,function(_df){if(_df.linkInfo&&_df.linkInfo.id===id){_db=_df;return true;}else{return false;}});break;case "Folder":var _e0=this.folders;len=_e0?_e0.length:0;for(i=0;i<len;i++){if(_e0[i].id===id){_db=_e0[i];break;}}break;default:console.log("KMLLayer:getFeature - unknown feature type");break;}return _db;},getLayers:function(){var _e1=[];if(this._groundLyr){_e1.push(this._groundLyr);}if(this._fLayers){_e1=_e1.concat(this._fLayers);}if(this._links){_c6.forEach(this._links,function(_e2){if(_e2.declaredClass){_e1.push(_e2);}});}return _e1;},setFolderVisibility:function(_e3,_e4){if(!_e3){return;}this._fireUpdateStart();_e3.visible=_e4;if(_e4){_e4=this._areLocalAncestorsVisible(_e3);}this._setState(_e3,_e4);this._fireUpdateEnd();},onRefresh:function(){},_parseKml:function(map){var _e5=this;this._fireUpdateStart();this._io=_cd({url:this.serviceUrl,content:{url:this._url.path+this._getQueryParameters(map),model:"simple",folders:"",refresh:this.loaded?true:undefined,outSR:_c7.toJson(this._outSR.toJson())},callbackParamName:"callback",load:function(_e6){_e5._io=null;_e5._initLayer(_e6);},error:function(err){_e5._io=null;err=_c5.mixin(new Error(),err);err.message="Unable to load KML: "+_e5.url+" "+(err.message||"");_e5._fireUpdateEnd(err);_e5.onError(err);}});},_initLayer:function(_e7){if(this.loaded){this._removeInternalLayers();}this.name=_e7.name;this.description=_e7.description;this.snippet=_e7.snippet;this.visibility=_e7.visibility;this.featureInfos=_e7.featureInfos;var i,len;var _e8=(this.folders=_e7.folders),_e9=[],_ea;if(_e8){len=_e8.length;for(i=0;i<len;i++){_ea=(_e8[i]=new _d2(_e8[i]));if(_ea.parentFolderId===-1){_e9.push(_ea);}}}var _eb=(this._links=_e7.networkLinks),_ec;len=_eb?_eb.length:0;for(i=0;i<len;i++){if(_eb[i].viewRefreshMode&&_eb[i].viewRefreshMode.toLowerCase().indexOf("onregion")!==-1){continue;}_ec=_c5.mixin({},this._options);_ec.linkInfo=_eb[i];if(_ec.id){_ec.id=_ec.id+"_"+i;}_eb[i]=new _d6(_eb[i].href,_ec);_eb[i]._parentLayer=this;_eb[i]._parentFolderId=this._getLinkParentId(_eb[i].linkInfo.id);}var _ed=_e7.groundOverlays;if(_ed&&_ed.length>0){_ec=_c5.mixin({},this._options);if(_ec.id){_ec.id=_ec.id+"_"+"mapImage";}var _ee=(this._groundLyr=new _d4(_ec));len=_ed.length;for(i=0;i<len;i++){_ee.addImage(new _d3(_ed[i]));}}var _ef=_c5.getObject("featureCollection.layers",false,_e7);if(_ef&&_ef.length>0){this._fLayers=[];_c6.forEach(_ef,function(_f0,i){var _f1=_c5.getObject("featureSet.features",false,_f0),_f2;if(_f1&&_f1.length>0){_ec=_c5.mixin({outFields:["*"],infoTemplate:_f0.popupInfo?new _d0(_f0.popupInfo):null,editable:false},this._options);if(_ec.id){_ec.id=_ec.id+"_"+i;}_f0.layerDefinition.capabilities="Query,Data";_f2=new _d5(_f0,_ec);if(_f2.geometryType){this["_"+_f2.geometryType]=_f2;}this._fLayers.push(_f2);}},this);if(this._fLayers.length===0){delete this._fLayers;}}len=_e9.length;for(i=0;i<len;i++){_ea=_e9[i];this._setState(_ea,_ea.visible);}this._fireUpdateEnd();if(this.loaded){this._addInternalLayers();this.onRefresh();}else{this.loaded=true;this.onLoad(this);}},_addInternalLayers:function(){var map=this._map;this._fireUpdateStart();if(this._links){_c6.forEach(this._links,function(_f3){if(_f3.declaredClass){map.addLayer(_f3);if(_f3._waitingForMap){_f3._waitingForMap=null;if(_f3.visible){_f3._parseKml(map);}else{_f3._wMap=map;}}}});}var _f4=map.spatialReference,_f5=this._outSR,_f6;if(!_f4.equals(_f5)){if(_f4.isWebMercator()&&_f5.wkid===4326){_f6=_cf.geographicToWebMercator;}else{if(_f5.isWebMercator()&&_f4.wkid===4326){_f6=_cf.webMercatorToGeographic;}else{console.log("KMLLayer:_setMap - unsupported workflow. Spatial reference of the map and kml layer do not match, and the conversion cannot be done on the client.");return;}}}if(this._groundLyr){if(_f6){_c6.forEach(this._groundLyr.getImages(),function(_f7){_f7.extent=_f6(_f7.extent);});}map.addLayer(this._groundLyr);}var _f8=this._fLayers;if(_f8&&_f8.length>0){_c6.forEach(_f8,function(_f9){if(_f6){var _fa=_f9.graphics,i,_fb,len=_fa?_fa.length:0;for(i=0;i<len;i++){_fb=_fa[i].geometry;if(_fb){_fa[i].setGeometry(_f6(_fb));}}}map.addLayer(_f9);});}this.onVisibilityChange(this.visible);},_removeInternalLayers:function(){var map=this._map;if(this._links){_c6.forEach(this._links,function(_fc){if(_fc.declaredClass&&_fc._io){_fc._io.cancel();}});}if(map){_c6.forEach(this.getLayers(),map.removeLayer,map);}},_setState:function(_fd,_fe){var _ff=_fd.featureInfos,info,_100,i,len=_ff?_ff.length:0,_101=_fe?"show":"hide";for(i=0;i<len;i++){info=_ff[i];_100=this.getFeature(info);if(!_100){continue;}if(info.type==="Folder"){this._setState(_100,_fe&&_100.visible);}else{if(info.type==="NetworkLink"){this._setInternalVisibility(_100,_fe);}else{_100[_101]();}}}},_areLocalAncestorsVisible:function(_102){var _103=_102.parentFolderId,_104=_102.visible;while(_104&&_103!==-1){var _105=this.getFeature({type:"Folder",id:_103});_104=_104&&_105.visible;_103=_105.parentFolderId;}return _104;},_setInternalVisibility:function(_106,_107){var _108=_106._parentLayer,_109=_106._parentFolderId;_107=_107&&_106.visible;while(_107&&_108){_107=_107&&_108.visible;if(_109>-1){_107=_107&&_108._areLocalAncestorsVisible(_108.getFeature({type:"Folder",id:_109}));}_109=_108._parentFolderId;_108=_108._parentLayer;}this._setIntState(_106,_107);},_setIntState:function(link,_10a){if(!link){return;}_c6.forEach(link.getLayers(),function(_10b){if(_10b.linkInfo){link._setIntState(_10b,_10a&&_10b.visible&&link._areLocalAncestorsVisible(link.getFeature({type:"Folder",id:_10b._parentFolderId})));}else{_10b.setVisibility(_10a);}});},_getLinkParentId:function(id){var _10c=-1;if(this.folders){_c6.some(this.folders,function(_10d){if(_10d.networkLinkIds&&_c6.indexOf(_10d.networkLinkIds,id)!==-1){_10c=_10d.id;return true;}return false;});}return _10c;},_checkAutoRefresh:function(){var _10e=this.linkInfo;if(_10e){if(this.visible){if(this.loaded&&this._map){var _10f=_10e.refreshMode,_110=_10e.refreshInterval,_111=_10e.viewRefreshMode,_112=_10e.viewRefreshTime;if(_10f&&_10f.toLowerCase().indexOf("oninterval")!==-1&&_110>0){this._stopAutoRefresh();this._timeoutHandle=setTimeout(this.refresh,_110*1000);}if(_111&&_111.toLowerCase().indexOf("onstop")!==-1&&_112>0){if(!this._extChgHandle){this._extChgHandle=_c4.connect(this._map,"onExtentChange",this,this._extentChanged);}}}}else{this._stopAutoRefresh();_c4.disconnect(this._extChgHandle);delete this._extChgHandle;}}},_stopAutoRefresh:function(){clearTimeout(this._timeoutHandle);this._timeoutHandle=null;},_getQueryParameters:function(map){map=map||this._map;var _113={},_114=this.linkInfo,_115=map&&map.extent,_116;if(this._url.query){_c5.mixin(_113,this._url.query);_116=!!this._url.query.token;}if(_ca.id&&!_116){var _117=_ca.id.findCredential(this._url.path);if(_117){_113.token=_117.token;}}if(_114){var _118=_114.viewFormat,_119=_114.httpQuery,_11a=_114.viewBoundScale;if(_115&&_118){var _11b=_115,_11c=_115,sr=_115.spatialReference;if(sr){if(sr.isWebMercator()){_11b=_cf.webMercatorToGeographic(_115);}else{if(sr.wkid===4326){_11c=_cf.geographicToWebMercator(_115);}}}var _11d=_11b.getCenter(),_11e=Math.max(_11c.getWidth(),_11c.getHeight());if(_11a){_11b=_11b.expand(_11a);}_118=_118.replace(/\[bboxWest\]/ig,_11b.xmin).replace(/\[bboxEast\]/ig,_11b.xmax).replace(/\[bboxSouth\]/ig,_11b.ymin).replace(/\[bboxNorth\]/ig,_11b.ymax).replace(/\[lookatLon\]/ig,_11d.x).replace(/\[lookatLat\]/ig,_11d.y).replace(/\[lookatRange\]/ig,_11e).replace(/\[lookatTilt\]/ig,0).replace(/\[lookatHeading\]/ig,0).replace(/\[lookatTerrainLon\]/ig,_11d.x).replace(/\[lookatTerrainLat\]/ig,_11d.y).replace(/\[lookatTerrainAlt\]/ig,0).replace(/\[cameraLon\]/ig,_11d.x).replace(/\[cameraLat\]/ig,_11d.y).replace(/\[cameraAlt\]/ig,_11e).replace(/\[horizFov\]/ig,60).replace(/\[vertFov\]/ig,60).replace(/\[horizPixels\]/ig,map.width).replace(/\[vertPixels\]/ig,map.height).replace(/\[terrainEnabled\]/ig,0);_c5.mixin(_113,ioq.queryToObject(_118));}if(_119){_119=_119.replace(/\[clientVersion\]/ig,_ca.version).replace(/\[kmlVersion\]/ig,2.2).replace(/\[clientName\]/ig,"ArcGIS API for JavaScript").replace(/\[language\]/ig,_c2.locale);_c5.mixin(_113,ioq.queryToObject(_119));}}var _11f=[],_120;for(_120 in _113){if(_cc.isDefined(_113[_120])){_11f.push(_120+"="+_113[_120]);}}_11f=_11f.join("&");return _11f?("?"+_11f):"";},_setMap:function(map,_121){this._map=map;var div=this._div=_c8.create("div",null,_121);_c9.set(div,"position","absolute");this._addInternalLayers();return div;},_unsetMap:function(map,_122){if(this._io){this._io.cancel();}this._stopAutoRefresh();_c4.disconnect(this._extChgHandle);delete this._extChgHandle;this._removeInternalLayers();var div=this._div;if(div){_122.removeChild(div);_c8.destroy(div);}this._map=this._wMap=this._div=null;},onVisibilityChange:function(_123){if(!this.loaded){if(this.linkInfo&&_123){if(!this._waitingForMap){this._parseKml(this._wMap);}}return;}this._fireUpdateStart();this._setInternalVisibility(this,_123);this._checkAutoRefresh();this._fireUpdateEnd();},refresh:function(){if(!this.loaded||!this._map||this._io){return;}this._parseKml();},_extentChanged:function(){this._stopAutoRefresh();this._timeoutHandle=setTimeout(this.refresh,this.linkInfo.viewRefreshTime*1000);}});if(has("extend-esri")){_c5.setObject("layers.KMLLayer",_d6,_ca);}return _d6;});},"dojo/data/util/sorter":function(){define(["../../_base/lang"],function(lang){var _124={};lang.setObject("dojo.data.util.sorter",_124);_124.basicComparator=function(a,b){var r=-1;if(a===null){a=undefined;}if(b===null){b=undefined;}if(a==b){r=0;}else{if(a>b||a==null){r=1;}}return r;};_124.createSortFunction=function(_125,_126){var _127=[];function _128(attr,dir,comp,s){return function(_129,_12a){var a=s.getValue(_129,attr);var b=s.getValue(_12a,attr);return dir*comp(a,b);};};var _12b;var map=_126.comparatorMap;var bc=_124.basicComparator;for(var i=0;i<_125.length;i++){_12b=_125[i];var attr=_12b.attribute;if(attr){var dir=(_12b.descending)?-1:1;var comp=bc;if(map){if(typeof attr!=="string"&&("toString" in attr)){attr=attr.toString();}comp=map[attr]||bc;}_127.push(_128(attr,dir,comp,_126));}}return function(rowA,rowB){var i=0;while(i<_127.length){var ret=_127[i++](rowA,rowB);if(ret!==0){return ret;}}return 0;};};return _124;});},"esri/layers/OnDemandMode":function(){define(["dojo/_base/declare","dojo/_base/connect","dojo/_base/lang","dojo/_base/array","dojo/has","esri/kernel","esri/geometry/Point","esri/tasks/query","esri/layers/RenderMode","esri/layers/GridLayout"],function(_12c,_12d,lang,_12e,has,_12f,_130,_131,_132,_133){var _134=_12c([_132],{declaredClass:"esri.layers._OnDemandMode",constructor:function(_135){this.featureLayer=_135;this._featureMap={};this._queryErrorHandler=lang.hitch(this,this._queryErrorHandler);},initialize:function(map){this.inherited(arguments);var _136=this.featureLayer,_137=_136._srInfo;this._gridLayer=new _133(new _130(_137?_137.valid[0]:map.extent.xmin,map.extent.ymax,map.spatialReference),{width:_136._tileWidth,height:_136._tileHeight},{width:map.width,height:map.height},_137);this._cellMap={};this._gridLayer.setResolution(map.extent);},startup:function(){this._ioQueue=[];if(!this.featureLayer.suspended){this._zoomHandler();this._enableConnectors();}},propertyChangeHandler:function(type){if(this._init){if(type<2){this._zoomHandler();}else{console.log("FeatureLayer: layer in on-demand mode does not support time definitions. Layer id = "+this.featureLayer.id+", Layer URL = "+this.featureLayer.url);}}},destroy:function(){this._disableConnectors();this.inherited(arguments);},drawFeature:function(_138){var _139=this._gridLayer,geom=_138.geometry,_13a=[];if(!geom){return;}_13a=_139.getCellsInExtent((geom.type==="point")?{xmin:geom.x,ymin:geom.y,xmax:geom.x,ymax:geom.y}:geom.getExtent(),false).cells;var _13b=this._cellMap,i,cell,oid=_138.attributes[this.featureLayer.objectIdField],_13c,row,col;for(i=0;i<_13a.length;i++){cell=_13a[i];_13c=cell.latticeID;row=cell.row;col=cell.col;if(_13c){cell=(_13b[_13c]=(_13b[_13c]||cell));}else{_13b[row]=_13b[row]||{};cell=(_13b[row][col]=(_13b[row][col]||cell));}cell.features=cell.features||[];cell.features.push(_138);this._addFeatureIIf(oid,_138);this._incRefCount(oid);}},suspend:function(){if(!this._init){return;}this._disableConnectors();},resume:function(){if(!this._init){return;}this._enableConnectors();this._zoomHandler();},refresh:function(){this._zoomHandler();},_enableConnectors:function(){var map=this.map;this._zoomConnect=_12d.connect(map,"onZoomEnd",this,this._zoomHandler);this._panConnect=_12d.connect(map,"onPanEnd",this,this._panHandler);this._resizeConnect=_12d.connect(map,"onResize",this,this._panHandler);},_disableConnectors:function(){_12d.disconnect(this._zoomConnect);_12d.disconnect(this._panConnect);_12d.disconnect(this._resizeConnect);},_zoomHandler:function(){this._processIOQueue(true);var _13d=this.featureLayer,map=this.map;if(_13d.suspended){return;}_13d._fireUpdateStart();this._clearIIf();var _13e=_13d._trackManager;if(_13e){_13e.clearTracks();}this._cellMap={};this._gridLayer.setResolution(map.extent);this._sendRequest();},_panHandler:function(){this.featureLayer._fireUpdateStart();this._sendRequest(this.featureLayer._resized&&arguments[0]);},_getRequestId:function(_13f,cell){var id="_"+_13f.name+_13f.layerId+_13f._ulid+"_"+cell.resolution+"_"+(cell.latticeID||(cell.row+"_"+cell.col));return id.replace(/[^a-zA-Z0-9\_]+/g,"_");},_sendRequest:function(_140){this._exceeds=false;var _141=this.featureLayer,map=this.map,_142=_140||map.extent,_143=this._gridLayer.getCellsInExtent(_142,_141.latticeTiling),_144=_143.cells;if(!_141.isEditable()){var _145=this._cellMap;_144=_12e.filter(_144,function(cell){if(cell.lattice){if(_145[cell.latticeID]){return false;}}else{if(_145[cell.row]&&_145[cell.row][cell.col]){return false;}}return true;});}var _146=_141.getOutFields(),_147=_141.getDefinitionExpression(),time=_141._getOffsettedTE(_141._mapTimeExtent),_148=_141._usePatch,_149=this._ioQueue,i,self=this,func=this._drawFeatures,cell,_14a,_14b;this._pending=this._pending||0;for(i=0;i<_144.length;i++){cell=_144[i];_14a=new _131();_14a.geometry=cell.extent||cell.lattice;_14a.outFields=_146;_14a.where=_147;if(_141.latticeTiling&&cell.extent){_14a.spatialRelationship=_131.SPATIAL_REL_CONTAINS;}_14a.returnGeometry=true;_14a.timeExtent=time;_14a.maxAllowableOffset=_141._maxOffset;if(_141._ts){_14a._ts=(new Date()).getTime();}_14b=null;if(_148){_14b=this._getRequestId(_141,cell);if(this._isPending(_14b)){continue;}}this._pending++;_149.push(_141._task.execute(_14a,function(){var _14c=cell;return function(_14d){func.apply(self,[_14d,_14c]);};}.call(this),this._queryErrorHandler,_14b));}this._removeOldCells(_142);this._endCheck();},_drawFeatures:function(_14e,cell){this._exceeds=this._exceeds||_14e.exceededTransferLimit;this._finalizeIO();var _14f=this.featureLayer,map=this.map,_150=map.extent,_151=cell.extent,row=cell.row,col=cell.col,_152=_14f.objectIdField,_153=_14e.features,_154=this._gridLayer,_155=this._cellMap,i,len,_156=cell.latticeID,_157=_156?_155[_156]:(_155[row]&&_155[row][col]);if((cell.resolution!=_154._resolution)||(_156?(_156!==_154.getLatticeID(_150)):(!_154.intersects(_151,_150)))){if(_157){this._removeCell(row,col,_156);}}else{if(_157){this._updateCell(_157,_153);}else{cell.features=_153;if(_156){_155[_156]=cell;}else{_155[row]=_155[row]||{};_155[row][col]=cell;}len=_153.length;for(i=0;i<len;i++){var _158=_153[i];var oid=_158.attributes[_152];this._addFeatureIIf(oid,_158);this._incRefCount(oid);}}}this._endCheck();},_queryErrorHandler:function(err){this._finalizeIO();this.featureLayer._errorHandler(err);this._endCheck(true);},_finalizeIO:function(){this._purgeRequests();this._pending--;},_endCheck:function(_159){if(this._pending===0){this._processIOQueue();var _15a=this.featureLayer,_15b=_15a._trackManager;if(_15b){_15b.clearTracks();_15b.addFeatures(_15a.graphics);if(_15a._ager){_12e.forEach(_15a.graphics,function(_15c){if(_15c._shape){_15a._repaint(_15c);}});}_15b.moveLatestToFront();_15b.drawTracks();}this.featureLayer._fireUpdateEnd(_159&&new Error("FeatureLayer: an error occurred while updating the layer"),this._exceeds?{queryLimitExceeded:true}:null);if(this._exceeds){_15a.onQueryLimitExceeded();}}},_processIOQueue:function(_15d){this._ioQueue=_12e.filter(this._ioQueue,function(dfd){var keep=dfd.fired>-1?false:true;return keep;});if(_15d){_12e.forEach(this._ioQueue,this._cancelPendingRequest);}},_removeOldCells:function(_15e){var _15f=this._cellMap,_160=this._gridLayer,_161,_162;for(_161 in _15f){if(_15f[_161]){var row=_15f[_161],_163=row.latticeID,_164=0,_165=0;if(_163){_164++;if(_163!==_160.getLatticeID(_15e)){this._removeCell(null,null,_163);_165++;}}else{for(_162 in row){if(row[_162]){_164++;var _166=row[_162].extent;if(!_160.intersects(_166,_15e)){this._removeCell(_161,_162);_165++;}}}}if(_165===_164){delete _15f[_161];}}}},_updateCell:function(cell,_167){var _168=this.featureLayer,_169=_168.objectIdField,_16a=_168._selectedFeatures,i,len=_167.length;cell.features=cell.features||[];for(i=0;i<len;i++){var _16b=_167[i];var oid=_16b.attributes[_169];var _16c=this._addFeatureIIf(oid,_16b);if(_16c===_16b){this._incRefCount(oid);cell.features.push(_16c);}else{if(!(oid in _16a)){_16c.setGeometry(_16b.geometry);_16c.setAttributes(_16b.attributes);}}}},_removeCell:function(row,col,_16d){var _16e=this._cellMap,_16f=this.featureLayer,_170=_16f.objectIdField;var cell=_16d?_16e[_16d]:(_16e[row]&&_16e[row][col]);if(cell){if(_16d){delete _16e[_16d];}else{delete _16e[row][col];}var _171=cell.features,i;for(i=0;i<_171.length;i++){var _172=_171[i];var oid=_172.attributes[_170];this._decRefCount(oid);if(oid in _16f._selectedFeatures){continue;}this._removeFeatureIIf(oid);}}}});if(has("extend-esri")){lang.setObject("layers._OnDemandMode",_134,_12f);}return _134;});},"esri/layers/FeatureLayer":function(){define(["dojo/_base/declare","dojo/_base/connect","dojo/_base/lang","dojo/_base/array","dojo/_base/json","dojo/_base/Deferred","dojo/date/locale","dojo/sniff","dojo/io-query","dojo/dom-construct","dojo/i18n","esri/kernel","esri/lang","esri/request","esri/deferredUtils","esri/SpatialReference","esri/symbols/SimpleMarkerSymbol","esri/symbols/SimpleLineSymbol","esri/symbols/SimpleFillSymbol","esri/symbols/jsonUtils","esri/renderers/SimpleRenderer","esri/renderers/UniqueValueRenderer","esri/renderers/jsonUtils","esri/tasks/QueryTask","esri/tasks/query","esri/tasks/FeatureSet","esri/geometry/Extent","esri/geometry/jsonUtils","esri/geometry/normalizeUtils","esri/layers/GraphicsLayer","esri/layers/Field","esri/layers/TimeInfo","esri/layers/FeatureType","esri/layers/FeatureTemplate","esri/layers/FeatureEditResult","esri/layers/SnapshotMode","esri/layers/OnDemandMode","esri/layers/SelectionMode","esri/layers/TrackManager","dojo/i18n!esri/nls/jsapi","dojo/has!extend-esri?esri/layers/agscommon"],function(_173,_174,lang,_175,_176,_177,_178,has,ioq,_179,i18n,_17a,_17b,_17c,_17d,_17e,_17f,_180,_181,_182,_183,_184,_185,_186,_187,_188,_189,_18a,_18b,_18c,_18d,_18e,_18f,_190,_191,_192,_193,_194,_195){var _196=_173(_18c,{declaredClass:"esri.layers.FeatureLayer",invalidParams:"query contains one or more unsupported parameters",_eventMap:{"add-attachment-complete":["result"],"before-apply-edits":["adds","updates","deletes"],"delete-attachments-complete":["results"],"edits-complete":["adds","updates","deletes"],"query-attachment-infos-complete":["results"],"query-count-complete":["count"],"query-features-complete":["featureSet"],"query-ids-complete":["objectIds"],"query-related-features-complete":["featureSets"],"selection-complete":["features","method"],"update-end":["error","info"]},constructor:function(url,_197){this.i18n=i18n.getLocalization("esri","jsapi");this._outFields=_197&&_197.outFields;this._loadCallback=_197&&_197.loadCallback;var _198=_197&&_197._usePatch;this._usePatch=(_198===null||_198===undefined)?true:_198;this._trackIdField=_197&&_197.trackIdField;this.objectIdField=_197&&_197.objectIdField;this._maxOffset=_197&&_197.maxAllowableOffset;this._optEditable=_197&&_197.editable;this._optAutoGen=_197&&_197.autoGeneralize;this.editSummaryCallback=_197&&_197.editSummaryCallback;this.userId=_197&&_197.userId;this.userIsAdmin=_197&&_197.userIsAdmin;this.useMapTime=(_197&&_197.hasOwnProperty("useMapTime"))?(!!_197.useMapTime):true;this.source=_197&&_197.source;this.gdbVersion=_197&&_197.gdbVersion;this._selectedFeatures={};this._selectedFeaturesArr=[];this._newFeatures=[];this._deletedFeatures={};this._ulid=this._getUniqueId();var ctor=this.constructor,mode=this.mode=(_17b.isDefined(_197&&_197.mode)?_197.mode:ctor.MODE_ONDEMAND);switch(mode){case ctor.MODE_SNAPSHOT:this._mode=new _192(this);this._isSnapshot=true;break;case ctor.MODE_ONDEMAND:this._tileWidth=(_197&&_197.tileWidth)||512;this._tileHeight=(_197&&_197.tileHeight)||512;this._mode=new _193(this);var _199=_197&&_197.latticeTiling;this.latticeTiling=_199;break;case ctor.MODE_SELECTION:this._mode=new _194(this);this._isSelOnly=true;break;}this._initLayer=lang.hitch(this,this._initLayer);this._selectHandler=lang.hitch(this,this._selectHandler);this._editable=false;if(lang.isObject(url)&&url.layerDefinition){var json=url;this._collection=true;this.mode=ctor.MODE_SNAPSHOT;this._initLayer(json);return this;}this._task=new _186(this.url,{source:this.source,gdbVersion:this.gdbVersion});var _19a=this._url.path;this._fserver=false;if(_19a.search(/\/FeatureServer\//i)!==-1){this._fserver=true;}var _19b=_197&&_197.resourceInfo;if(_19b){this._initLayer(_19b);}else{if(this.source){var _19c={source:this.source.toJson()};this._url.query=lang.mixin(this._url.query,{layer:_176.toJson(_19c)});}if(this.gdbVersion){this._url.query=lang.mixin(this._url.query,{gdbVersion:this.gdbVersion});}_17c({url:_19a,content:lang.mixin({f:"json"},this._url.query),callbackParamName:"callback",load:this._initLayer,error:this._errorHandler});}this.registerConnectEvents();},_initLayer:function(_19d,io){if(_19d||io){this._json=_19d;this._findCredential();var ssl=(this.credential&&this.credential.ssl)||(_19d&&_19d._ssl);if(ssl){this._useSSL();this._task._useSSL();}if(this._collection){this._mode=new _192(this);this._isSnapshot=true;this._featureSet=_19d.featureSet;this._nextId=_19d.nextObjectId;_19d=_19d.layerDefinition;}if(_19d.hasOwnProperty("capabilities")){var _19e=(this.capabilities=_19d.capabilities);if(_19e&&_19e.toLowerCase().indexOf("editing")!==-1){this._editable=true;}else{this._editable=false;}}else{if(!this._collection){this._editable=this._fserver;}}if(_17b.isDefined(this._optEditable)){this._editable=this._optEditable;delete this._optEditable;}this._json=_176.toJson(this._json);if(this.isEditable()){delete this._maxOffset;}else{if(this.mode!==this.constructor.MODE_SNAPSHOT&&((_19d.geometryType==="esriGeometryPolyline")||(_19d.geometryType==="esriGeometryPolygon"))){this._autoGeneralize=_17b.isDefined(this._optAutoGen)?this._optAutoGen:(this.mode===this.constructor.MODE_ONDEMAND);delete this._optAutoGen;}}var _19f=_19d.effectiveMinScale||_19d.minScale,_1a0=_19d.effectiveMaxScale||_19d.maxScale;if(!this._hasMin&&_19f){this.setMinScale(_19f);}if(!this._hasMax&&_1a0){this.setMaxScale(_1a0);}this.layerId=_19d.id;this.name=_19d.name;this.description=_19d.description;this.copyright=_19d.copyrightText;this.type=_19d.type;this.geometryType=_19d.geometryType;this.displayField=_19d.displayField;this.defaultDefinitionExpression=_19d.definitionExpression;this.fullExtent=new _189(_19d.extent);this.initialExtent=new _189(this.fullExtent.toJson());if(this.fullExtent.spatialReference){this.spatialReference=new _17e(this.fullExtent.spatialReference.toJson());}this.defaultVisibility=_19d.defaultVisibility;if((this.geometryType==="esriGeometryPoint")||(this.geometryType==="esriGeometryMultipoint")){this.latticeTiling=false;}this.indexedFields=_19d.indexedFields;this.maxRecordCount=_19d.maxRecordCount;this.canModifyLayer=_19d.canModifyLayer;this.supportsStatistics=_19d.supportsStatistics;this.supportsAdvancedQueries=_19d.supportsAdvancedQueries;this.hasLabels=_19d.hasLabels;this.canScaleSymbols=_19d.canScaleSymbols;this.supportsRollbackOnFailure=_19d.supportsRollbackOnFailure;this.syncCanReturnChanges=_19d.syncCanReturnChanges;this.isDataVersioned=_19d.isDataVersioned;this.editFieldsInfo=_19d.editFieldsInfo;this.ownershipBasedAccessControlForFeatures=_19d.ownershipBasedAccessControlForFeatures;if(this.editFieldsInfo&&this.ownershipBasedAccessControlForFeatures){this.creatorField=this.editFieldsInfo.creatorField;}this.relationships=_19d.relationships;this.allowGeometryUpdates=_17b.isDefined(_19d.allowGeometryUpdates)?_19d.allowGeometryUpdates:true;this._isTable=(this.type==="Table");var _1a1=(this.fields=[]),_1a2=_19d.fields,i;for(i=0;i<_1a2.length;i++){_1a1.push(new _18d(_1a2[i]));}if(!this.objectIdField){this.objectIdField=_19d.objectIdField;if(!this.objectIdField){_1a2=_19d.fields;for(i=0;i<_1a2.length;i++){var _1a3=_1a2[i];if(_1a3.type==="esriFieldTypeOID"){this.objectIdField=_1a3.name;break;}}}if(!this.objectIdField){console.debug("esri.layers.FeatureLayer: "+_17b.substitute({url:this.url},"objectIdField is not set [url: ${url}]"));}}if(!_17b.isDefined(this._nextId)){var _1a4=this.objectIdField,_1a5=-1;if(this._collection&&_1a4){var fset=this._featureSet,_1a6=fset&&fset.features,il=_1a6?_1a6.length:0,oid,attr;for(i=0;i<il;i++){attr=_1a6[i].attributes;oid=attr&&attr[_1a4];if(oid>_1a5){_1a5=oid;}}}this._nextId=(_1a5+1);}this.globalIdField=_19d.globalIdField;var _1a7=(this.typeIdField=_19d.typeIdField),_1a8;if(_1a7){_1a8=!this._getField(_1a7)&&this._getField(_1a7,true);if(_1a8){this.typeIdField=_1a8.name;}}this.visibilityField=_19d.visibilityField;var _1a9=_19d.defaultSymbol;if(_1a9){this.defaultSymbol=_182.fromJson(_1a9);}var _1aa=this.types=[],_1ab=_19d.types,_1ac,_1ad,_1ae,_1af=this.editFieldsInfo,_1b0=_1af&&_1af.creatorField,_1b1=_1af&&_1af.editorField,fix=(_1b0||_1b1),_1b2=[];if(_1ab){for(i=0;i<_1ab.length;i++){_1ac=new _18f(_1ab[i]);_1ad=_1ac.templates;if(fix&&_1ad&&_1ad.length){_1b2=_1b2.concat(_1ad);}_1aa.push(_1ac);}}var _1b3=_19d.templates,_1b4,_1b5=this.templates=[];if(_1b3){for(i=0;i<_1b3.length;i++){_1b4=new _190(_1b3[i]);if(fix){_1b2.push(_1b4);}_1b5.push(_1b4);}}for(i=0;i<_1b2.length;i++){_1ae=lang.getObject("prototype.attributes",false,_1b2[i]);if(_1ae){if(_1b0){delete _1ae[_1b0];}if(_1b1){delete _1ae[_1b1];}}}var _1b6=_19d.timeInfo;if(_1b6){this.timeInfo=new _18e(_1b6);this._startTimeField=_1b6.startTimeField;this._endTimeField=_1b6.endTimeField;if(this._startTimeField&&this._endTimeField){this._twoTimeFields=true;}if(this._trackIdField){_1b6.trackIdField=this._trackIdField;}else{this._trackIdField=_1b6.trackIdField;}}this.hasAttachments=(!this._collection&&_19d.hasAttachments)?true:false;this.htmlPopupType=_19d.htmlPopupType;var _1b7=_19d.drawingInfo,_1b8;if(!this.renderer){if(_1b7&&_1b7.renderer){_1b8=_1b7.renderer;this.setRenderer(_185.fromJson(_1b8));if(_1b8.type==="classBreaks"){this.renderer.setMaxInclusive(true);}if(!this._collection){var _1b9=_1b8.type,_1ba=[];_1b8=this.renderer;switch(_1b9){case "simple":_1ba.push(_1b8.symbol);break;case "uniqueValue":case "classBreaks":_1ba.push(_1b8.defaultSymbol);_1ba=_1ba.concat(_175.map(_1b8.infos,function(info){return info.symbol;}));break;}_1ba=_175.filter(_1ba,_17b.isDefined);var _1bb=this._url.path+"/images/",_1bc=this._getToken();_175.forEach(_1ba,function(sym){var url=sym.url;if(url){if((url.search(/https?\:/)===-1)&&(url.indexOf("data:")===-1)){sym.url=_1bb+url;}if(_1bc&&sym.url.search(/https?\:/)!==-1){sym.url+=("?token="+_1bc);}}});}}else{if(_1a9){_1ab=this.types;if(_1ab.length>0){_1b8=new _184(this.defaultSymbol,this.typeIdField);_175.forEach(_1ab,function(type){_1b8.addValue(type.id,type.symbol);});}else{_1b8=new _183(this.defaultSymbol);}this.setRenderer(_1b8);}else{if(!this._isTable){var _1bd;switch(this.geometryType){case "esriGeometryPoint":case "esriGeometryMultipoint":_1bd=new _17f();break;case "esriGeometryPolyline":_1bd=new _180();break;case "esriGeometryPolygon":_1bd=new _181();break;}this.setRenderer(_1bd?new _183(_1bd):null);}}}}var _1be=(_1b7&&_1b7.transparency)||0;if(!_17b.isDefined(this.opacity)&&_1be>0){this.opacity=1-(_1be/100);}this.version=_19d.currentVersion;if(!this.version){var ver;if("capabilities" in _19d||"drawingInfo" in _19d||"hasAttachments" in _19d||"htmlPopupType" in _19d||"relationships" in _19d||"timeInfo" in _19d||"typeIdField" in _19d||"types" in _19d){ver=10;}else{ver=9.3;}this.version=ver;}if((has("ie")||has("safari"))&&this.isEditable()&&this.version<10.02){this._ts=true;}this.loaded=true;this._fixRendererFields();this._checkFields();this._updateCaps();var _1bf=function(){this.onLoad(this);var _1c0=this._loadCallback;if(_1c0){delete this._loadCallback;_1c0(this);}};if(this._collection){this._fireUpdateStart();var _1c1=this._featureSet;delete this._featureSet;this._mode._drawFeatures(new _188(_1c1));this._fcAdded=true;_1bf.call(this);}else{this._forceIdentity(_1bf);}}},setRenderer:function(ren){this.inherited("setRenderer",arguments);var _1c2=this.renderer;if(_1c2){this._ager=(_1c2.declaredClass.indexOf("TemporalRenderer")!==-1&&_1c2.observationAger&&_1c2.observationRenderer);var _1c3=_175.filter([_1c2,_1c2.observationRenderer,_1c2.latestObservationRenderer,_1c2.trackRenderer],_17b.isDefined);var _1c4=[];_175.forEach(_1c3,function(rnd){if(!lang.isFunction(rnd.attributeField)){_1c4.push(rnd.attributeField);}_1c4.push(rnd.attributeField2);_1c4.push(rnd.attributeField3);},this);this._rendererFields=_175.filter(_1c4,_17b.isDefined);}else{this._ager=false;this._rendererFields=[];}if(this.loaded&&this._rendererFields.length>0){this._fixRendererFields();this._checkFields(this._rendererFields);}if(this.loaded&&this._collection){this._typesDirty=true;}},_setMap:function(map){var div=this.inherited(arguments),mode=this._mode;if(mode){mode.initialize(map);}return div;},_unsetMap:function(map){var mode=this._mode;if(mode){mode.suspend();}if(this._trackManager){this._trackManager.destroy();this._trackManager=null;}_174.disconnect(this._zoomConnect);this._zoomConnect=null;this._toggleTime(false);this.inherited("_unsetMap",arguments);},refresh:function(){var mode=this._mode;if(mode){mode.refresh();}},getOutFields:function(){return _175.filter(this._getOutFields(),function(_1c5){return (_1c5==="*"||!!this._getField(_1c5));},this);},setEditable:function(_1c6){if(!this._collection){console.log("FeatureLayer:setEditable - this functionality is not yet supported for layer in a feature service");return this;}if(!this.loaded){this._optEditable=_1c6;return this;}var _1c7=this._editable;this._editable=_1c6;this._updateCaps();if(_1c7!==_1c6){this.onCapabilitiesChange();}return this;},getEditCapabilities:function(_1c8){var _1c9={"canCreate":false,"canUpdate":false,"canDelete":false};if(!this.loaded||!this.isEditable()){return _1c9;}var _1ca=_1c8&&_1c8.feature,_1cb=_1c8&&_1c8.userId,caps=_175.map((this.capabilities?this.capabilities.toLowerCase().split(","):[]),lang.trim),_1cc=_175.indexOf(caps,"editing")>-1,_1cd=_1cc&&(_175.indexOf(caps,"create")>-1),_1ce=_1cc&&(_175.indexOf(caps,"update")>-1),_1cf=_1cc&&(_175.indexOf(caps,"delete")>-1),_1d0=this.ownershipBasedAccessControlForFeatures,_1d1=this.editFieldsInfo,_1d2=_1d1&&_1d1.creatorField,_1d3=_1d1&&_1d1.realm,_1d4=_1ca&&_1ca.attributes,_1d5=(_1d4&&_1d2)?_1d4[_1d2]:undefined,_1d6,_1d7=!!this.userIsAdmin,_1d8=!_1d0||_1d7||!!(_1d0.allowOthersToUpdate||_1d0.allowUpdateToOthers),_1d9=!_1d0||_1d7||!!(_1d0.allowOthersToDelete||_1d0.allowDeleteToOthers);if(_1d7||(_1cc&&!(_1cd||_1ce||_1cf))){_1cd=_1ce=_1cf=true;}_1d6={"canCreate":_1cd,"canUpdate":_1ce,"canDelete":_1cf};if(_1d5===null){_1d6.canUpdate=_1ce&&_1d8;_1d6.canDelete=_1cf&&_1d9;}else{if(_1d5===""){return _1d6;}else{if(_1d5){_1cb=_1cb||this.getUserId();if(_1cb&&_1d3){_1cb=_1cb+"@"+_1d3;}if(_1cb.toLowerCase()===_1d5.toLowerCase()){return _1d6;}else{_1d6.canUpdate=_1ce&&_1d8;_1d6.canDelete=_1cf&&_1d9;}}}}return _1d6;},getUserId:function(){var _1da;if(this.loaded){_1da=(this.credential&&this.credential.userId)||this.userId||"";}return _1da;},setUserIsAdmin:function(_1db){this.userIsAdmin=_1db;},setEditSummaryCallback:function(_1dc){this.editSummaryCallback=_1dc;},getEditSummary:function(_1dd,_1de,_1df){_1df=_17b.isDefined(_1df)?_1df:(new Date()).getTime();var _1e0="",info=this.getEditInfo(_1dd,_1de,_1df),_1e1=(_1de&&_1de.callback)||this.editSummaryCallback;if(_1e1){info=_1e1(_1dd,info)||"";}if(lang.isString(info)){_1e0=info;}else{if(info){var _1e2=info.action,_1e3=info.userId,_1e4=info.timeValue,_1e5=0;if(_1e2){_1e5++;}if(_1e3){_1e5++;}if(_17b.isDefined(_1e4)){_1e5++;}if(_1e5>1){_1e0=(_1e2==="edit"?"edit":"create")+(_1e3?"User":"")+(_17b.isDefined(_1e4)?info.displayPattern:"");}}_1e0=_1e0&&_17b.substitute(info,this.i18n.layers.FeatureLayer[_1e0]);}return _1e0;},getEditInfo:function(_1e6,_1e7,_1e8){if(!this.loaded){return;}_1e8=_17b.isDefined(_1e8)?_1e8:(new Date()).getTime();var _1e9=(_1e7&&_1e7.action)||"last",_1ea=this.editFieldsInfo,_1eb=_1ea&&_1ea.creatorField,_1ec=_1ea&&_1ea.creationDateField,_1ed=_1ea&&_1ea.editorField,_1ee=_1ea&&_1ea.editDateField,_1ef=_1ea&&_1ea.realm,_1f0=_1e6&&_1e6.attributes,_1f1=(_1f0&&_1eb)?_1f0[_1eb]:undefined,_1f2=(_1f0&&_1ec)?_1f0[_1ec]:null,_1f3=(_1f0&&_1ed)?_1f0[_1ed]:undefined,_1f4=(_1f0&&_1ee)?_1f0[_1ee]:null,_1f5=this._getEditData(_1f1,_1f2,_1e8),_1f6=this._getEditData(_1f3,_1f4,_1e8),_1f7;switch(_1e9){case "creation":_1f7=_1f5;break;case "edit":_1f7=_1f6;break;case "last":_1f7=_1f6||_1f5;break;}if(_1f7){_1f7.action=(_1f7===_1f6)?"edit":"creation";}return _1f7;},_getEditData:function(_1f8,_1f9,_1fa){var data,_1fb,_1fc,_1fd=60000,_1fe=3600000,_1ff=2*_1fe,_200=24*_1fe,_201=7*_200;if(_17b.isDefined(_1f9)){_1fb=_1fa-_1f9;if(_1fb<0){_1fc="Full";}else{if(_1fb<_1fd){_1fc="Seconds";}else{if(_1fb<(2*_1fd)){_1fc="Minute";}else{if(_1fb<_1fe){_1fc="Minutes";}else{if(_1fb<_1ff){_1fc="Hour";}else{if(_1fb<_200){_1fc="Hours";}else{if(_1fb<_201){_1fc="WeekDay";}else{_1fc="Full";}}}}}}}}if((_1f8!==undefined)||_1fc){data=data||{};data.userId=_1f8;if(_1fc){var _202=_178.format,_203=new Date(_1f9);data.minutes=Math.floor(_1fb/_1fd);data.hours=Math.floor(_1fb/_1fe);data.weekDay=_202(_203,{datePattern:"EEEE",selector:"date"});data.formattedDate=_202(_203,{selector:"date"});data.formattedTime=_202(_203,{selector:"time"});data.displayPattern=_1fc;data.timeValue=_1f9;}}return data;},isEditable:function(){return !!(this._editable||this.userIsAdmin);},setMaxAllowableOffset:function(_204){if(!this.isEditable()){this._maxOffset=_204;}return this;},getMaxAllowableOffset:function(){return this._maxOffset;},setAutoGeneralize:function(_205){if(!this.loaded){this._optAutoGen=_205;}else{if(!this.isEditable()&&(this.mode!==this.constructor.MODE_SNAPSHOT)&&((this.geometryType==="esriGeometryPolyline")||(this.geometryType==="esriGeometryPolygon"))){this._autoGeneralize=_205;if(_205){var map=this._map;if(map&&map.loaded){this._maxOffset=Math.floor(map.extent.getWidth()/map.width);}}else{delete this._maxOffset;}}}return this;},setGDBVersion:function(_206){if(!this._collection&&(_206!==this.gdbVersion)&&(_206||this.gdbVersion)){this.gdbVersion=_206;this._task.gdbVersion=_206;this._url.query=lang.mixin(this._url.query,{gdbVersion:_206});if(this.loaded){this.clearSelection();if(this._map){this.refresh();}}this.onGDBVersionChange();}return this;},setDefinitionExpression:function(expr){this._defnExpr=expr;var mode=this._mode;if(mode){mode.propertyChangeHandler(1);}return this;},getDefinitionExpression:function(){return this._defnExpr;},setTimeDefinition:function(_207){if(this._isSnapshot){this._timeDefn=_207;var mode=this._mode;if(mode){mode.propertyChangeHandler(2);}}else{console.log("FeatureLayer.setTimeDefinition: layer in on-demand or selection mode does not support time definitions. Layer id = "+this.id+", Layer URL = "+this.url);}return this;},getTimeDefinition:function(){return this._timeDefn;},setTimeOffset:function(_208,_209){this._timeOffset=_208;this._timeOffsetUnits=_209;var mode=this._mode;if(mode){mode.propertyChangeHandler(0);}return this;},setUseMapTime:function(use){this.useMapTime=use;this._toggleTime(!this.suspended);var mode=this._mode;if(mode){mode.propertyChangeHandler(0);}},selectFeatures:function(_20a,_20b,_20c,_20d){_20b=_20b||this.constructor.SELECTION_NEW;var _20e=this._getShallowClone(_20a),map=this._map,_20f,dfd=_17d._fixDfd(new _177(_17d._dfdCanceller));_20e.outFields=this.getOutFields();_20e.returnGeometry=true;if(map){_20e.outSpatialReference=new _17e(map.spatialReference.toJson());}if(!this._applyQueryFilters(_20e)){_20f={features:[]};this._selectHandler(_20f,_20b,_20c,_20d,dfd);return dfd;}var _210=this._canDoClientSideQuery(_20e);if(_210){_20f={features:this._doQuery(_20e,_210)};this._selectHandler(_20f,_20b,_20c,_20d,dfd);return dfd;}else{if(this._collection){var err=new Error("FeatureLayer::selectFeatures - "+this.invalidParams);this._resolve([err],null,_20d,dfd,true);return dfd;}var self=this;if(this._ts){_20e._ts=(new Date()).getTime();}var temp=dfd._pendingDfd=this._task.execute(_20e);temp.addCallbacks(function(_211){self._selectHandler(_211,_20b,_20c,_20d,dfd);},function(err){self._resolve([err],null,_20d,dfd,true);});return dfd;}},getSelectedFeatures:function(){var _212=this._selectedFeatures,_213=[],item;for(item in _212){if(_212.hasOwnProperty(item)){_213.push(_212[item]);}}return _213;},clearSelection:function(_214){var _215=this._selectedFeatures,mode=this._mode,item;for(item in _215){if(_215.hasOwnProperty(item)){this._unSelectFeatureIIf(item,mode);mode._removeFeatureIIf(item);}}this._selectedFeatures={};if(this._isSelOnly){mode._applyTimeFilter(true);}if(!_214){this.onSelectionClear();}return this;},setSelectionSymbol:function(_216){this._selectionSymbol=_216;if(_216){var _217=this._selectedFeatures,item;for(item in _217){if(_217.hasOwnProperty(item)){_217[item].setSymbol(_216);}}}return this;},getSelectionSymbol:function(){return this._selectionSymbol;},__msigns:[{n:"applyEdits",c:5,a:[{i:0},{i:1}],e:4,f:1}],applyEdits:function(adds,_218,_219,_21a,_21b,_21c){var _21d=_21c.assembly,dfd=_21c.dfd;this._applyNormalized(adds,_21d&&_21d[0]);this._applyNormalized(_218,_21d&&_21d[1]);this.onBeforeApplyEdits(adds,_218,_219);var i,_21e={},_21f=this.objectIdField,_220={f:"json"},_221=false;if(this._collection){var _222={};_222.addResults=adds?_175.map(adds,function(){_221=true;return {objectId:this._nextId++,success:true};},this):null;_222.updateResults=_218?_175.map(_218,function(_223){_221=true;var oid=_223.attributes[_21f];_21e[oid]=_223;return {objectId:oid,success:true};},this):null;_222.deleteResults=_219?_175.map(_219,function(_224){_221=true;return {objectId:_224.attributes[_21f],success:true};},this):null;if(_221){this._editHandler(_222,adds,_21e,_21a,_21b,dfd);}return;}if(adds&&adds.length>0){_220.adds=this._convertFeaturesToJson(adds,0,1);_221=true;}if(_218&&_218.length>0){for(i=0;i<_218.length;i++){var _225=_218[i];_21e[_225.attributes[_21f]]=_225;}_220.updates=this._convertFeaturesToJson(_218,0,0,1);_221=true;}if(_219&&_219.length>0){var ids=[];for(i=0;i<_219.length;i++){ids.push(_219[i].attributes[_21f]);}_220.deletes=ids.join(",");_221=true;}if(_221){var self=this;return _17c({url:this._url.path+"/applyEdits",content:lang.mixin(_220,this._url.query),callbackParamName:"callback",load:function(_226){self._editHandler(_226,adds,_21e,_21a,_21b,dfd);},error:function(err){self._resolve([err],null,_21b,dfd,true);}},{usePost:true});}},queryFeatures:function(_227,_228,_229){return this._query("execute","onQueryFeaturesComplete",_227,_228,_229);},queryRelatedFeatures:function(_22a,_22b,_22c){return this._query("executeRelationshipQuery","onQueryRelatedFeaturesComplete",_22a,_22b,_22c);},queryIds:function(_22d,_22e,_22f){return this._query("executeForIds","onQueryIdsComplete",_22d,_22e,_22f);},queryCount:function(_230,_231,_232){return this._query("executeForCount","onQueryCountComplete",_230,_231,_232);},queryAttachmentInfos:function(_233,_234,_235){var url=this._url.path+"/"+_233+"/attachments",dfd=new _177(_17d._dfdCanceller),self=this;dfd._pendingDfd=_17c({url:url,content:lang.mixin({f:"json"},this._url.query),callbackParamName:"callback",load:function(_236){var _237=_236.attachmentInfos,_238;_175.forEach(_237,function(info){_238=ioq.objectToQuery({gdbVersion:self._url.query&&self._url.query.gdbVersion,layer:self._url.query&&self._url.query.layer,token:self._getToken()});info.url=url+"/"+info.id+(_238?("?"+_238):"");info.objectId=_233;});self._resolve([_237],"onQueryAttachmentInfosComplete",_234,dfd);},error:function(err){self._resolve([err],null,_235,dfd,true);}});return dfd;},addAttachment:function(_239,_23a,_23b,_23c){return this._sendAttachment("add",_239,_23a,_23b,_23c);},updateAttachment:function(_23d,_23e,_23f,_240,_241){_23f.appendChild(_179.create("input",{type:"hidden",name:"attachmentId",value:_23e}));return this._sendAttachment("update",_23d,_23f,_240,_241);},deleteAttachments:function(_242,_243,_244,_245){var url=this._url.path+"/"+_242+"/deleteAttachments",dfd=new _177(_17d._dfdCanceller),self=this,_246={f:"json",attachmentIds:_243.join(",")};dfd._pendingDfd=_17c({url:url,content:lang.mixin(_246,this._url.query),callbackParamName:"callback",load:lang.hitch(this,function(_247){var _248=_247.deleteAttachmentResults;_248=_175.map(_248,function(_249){var res=new _191(_249);res.attachmentId=res.objectId;res.objectId=_242;return res;});self._resolve([_248],"onDeleteAttachmentsComplete",_244,dfd);}),error:function(err){self._resolve([err],null,_245,dfd,true);}},{usePost:true});return dfd;},addType:function(_24a){var _24b=this.types;if(_24b){var _24c=_175.some(_24b,function(type){if(type.id==_24a.id){return true;}return false;});if(_24c){return false;}else{_24b.push(_24a);}}else{this.types=[_24a];}this._typesDirty=true;return true;},deleteType:function(_24d){if(!this._collection){return;}var _24e=this.types;if(_24e){var _24f=-1;_175.some(_24e,function(type,_250){if(type.id==_24d){_24f=_250;return true;}return false;});if(_24f>-1){this._typesDirty=true;return _24e.splice(_24f,1)[0];}}},toJson:function(){var _251=this._json,json=lang.isString(_251)?_176.fromJson(_251):lang.clone(_251);if(!json){return;}json=json.layerDefinition?json:{layerDefinition:json};var _252=json.layerDefinition,_253=this._collection;if(_253&&this._typesDirty){_252.types=_175.map(this.types||[],function(type){return type.toJson();});var _254=this.renderer,_255=_252.drawingInfo;if(_255&&_254&&_254.declaredClass.indexOf("TemporalRenderer")===-1){_255.renderer=_254.toJson();}}var _256=null;if(!(_253&&!this._fcAdded)){_256={geometryType:_252.geometryType,features:this._convertFeaturesToJson(this.graphics,true)};}json.featureSet=lang.mixin({},json.featureSet||{},_256);if(_253){json.nextObjectId=this._nextId;_252.capabilities=this.capabilities;}return json;},onSelectionComplete:function(){},onSelectionClear:function(){},onBeforeApplyEdits:function(){},onEditsComplete:function(){},onQueryFeaturesComplete:function(){},onQueryRelatedFeaturesComplete:function(){},onQueryIdsComplete:function(){},onQueryCountComplete:function(){},onQueryAttachmentInfosComplete:function(){},onAddAttachmentComplete:function(){},onUpdateAttachmentComplete:function(){},onDeleteAttachmentsComplete:function(){},onCapabilitiesChange:function(){},onGDBVersionChange:function(){},onQueryLimitExceeded:function(){},_forceIdentity:function(_257){var self=this,path=this._url&&this._url.path;if((this.ownershipBasedAccessControlForFeatures||this.userIsAdmin)&&!this._getToken()&&path&&_17a.id&&_17a.id._hasPortalSession()&&_17a.id._doPortalSignIn(path)){_17a.id.getCredential(path).then(function(){self._findCredential();_257.call(self);},function(){_257.call(self);});}else{_257.call(this);}},_updateCaps:function(){var _258=this._editable,_259=lang.trim(this.capabilities||""),_25a=_175.map((_259?_259.split(","):[]),lang.trim),caps=_175.map((_259?_259.toLowerCase().split(","):[]),lang.trim),_25b=_175.indexOf(caps,"editing"),cap,i,_25c,_25d={"Create":_175.indexOf(caps,"create"),"Update":_175.indexOf(caps,"update"),"Delete":_175.indexOf(caps,"delete")};if(_258&&_25b===-1){_25a.push("Editing");}else{if(!_258&&_25b>-1){_25c=[_25b];for(cap in _25d){if(_25d[cap]>-1){_25c.push(_25d[cap]);}}_25c.sort();for(i=_25c.length-1;i>=0;i--){_25a.splice(_25c[i],1);}}}this.capabilities=_25a.join(",");},_counter:{value:0},_getUniqueId:function(){return this._counter.value++;},onSuspend:function(){this.inherited(arguments);this._toggleTime(false);var mode=this._mode;if(mode){mode.suspend();}},onResume:function(evt){this.inherited(arguments);this._toggleTime(true);this._updateMaxOffset();var mode=this._mode,map=this._map,_25e=this.renderer;if(evt.firstOccurrence){this.clearSelection();if(this.timeInfo){if(this._trackIdField||(_25e&&(_25e.latestObservationRenderer||_25e.trackRenderer))){this._trackManager=new _195(this);this._trackManager.initialize(map);}}this._zoomConnect=_174.connect(map,"onZoomEnd",this,this._updateMaxOffset);}if(mode){evt.firstOccurrence?mode.startup():mode.resume();}},_updateMaxOffset:function(){var map=this._map;if(map&&map.loaded){if(this._autoGeneralize){this._maxOffset=Math.floor(map.extent.getWidth()/map.width);}}},_toggleTime:function(_25f){var map=this._map;if(_25f&&this.timeInfo&&this.useMapTime&&map){this._mapTimeExtent=map.timeExtent;if(!this._timeConnect){this._timeConnect=_174.connect(map,"onTimeExtentChange",this,this._timeChangeHandler);}}else{this._mapTimeExtent=null;_174.disconnect(this._timeConnect);this._timeConnect=null;}},_timeChangeHandler:function(_260){this._mapTimeExtent=_260;var mode=this._mode;if(mode){mode.propertyChangeHandler(0);}},_getOffsettedTE:function(_261){var _262=this._timeOffset,_263=this._timeOffsetUnits;return (_261&&_262&&_263)?_261.offset(-1*_262,_263):_261;},_getTimeOverlap:function(_264,_265){if(_264&&_265){return _264.intersection(_265);}else{return _264||_265;}},_getTimeFilter:function(_266){var _267=this.getTimeDefinition(),_268=null,_269;if(_267||_268){_269=this._getTimeOverlap(_267,_268);if(!_269){return [false];}}if(_266){_266=_269?this._getTimeOverlap(_266,_269):_266;if(!_266){return [false];}}else{_266=_269;}return [true,_266];},_getAttributeFilter:function(_26a){var _26b=this.getDefinitionExpression();if(_26a){_26a=_26b?"("+_26b+") AND ("+_26a+")":_26a;}else{_26a=_26b;}return _26a;},_applyQueryFilters:function(_26c){_26c.where=this._getAttributeFilter(_26c.where);_26c.maxAllowableOffset=this._maxOffset;if(this.timeInfo){var _26d=this._getTimeFilter(_26c.timeExtent);if(!_26d[0]){return false;}else{_26c.timeExtent=_26d[1];}}return true;},_add:function(_26e){var _26f=this._selectionSymbol,attr=_26e.attributes,_270=this.visibilityField;if(_26f&&this._isSelOnly){_26e.setSymbol(_26f);}if(_270&&attr&&attr.hasOwnProperty(_270)){_26e[attr[_270]?"show":"hide"]();}return this.add.apply(this,arguments);},_remove:function(){return this.remove.apply(this,arguments);},_canDoClientSideQuery:function(_271){var _272=[],map=this._map;if(this._isTable||!map){return;}if(_271.text||(_271.where&&_271.where!==this.getDefinitionExpression())){return;}var _273=this._isSnapshot,_274=this._isSelOnly;var _275=_271.geometry;if(_275){if(!_274&&_271.spatialRelationship===_187.SPATIAL_REL_INTERSECTS&&(_275.type==="extent"&&(_273||map.extent.contains(_275)))){_272.push(1);}else{return;}}var ids=_271.objectIds;if(ids){if(_273){_272.push(2);}else{var len=ids.length,mode=this._mode,_276=0,i;for(i=0;i<len;i++){if(mode._getFeature(ids[i])){_276++;}}if(_276===len){_272.push(2);}else{return;}}}if(this.timeInfo){var _277=_271.timeExtent,_278=this._mapTimeExtent;if(_273){if(_277){_272.push(3);}}else{if(_274){if(_277){return;}}else{if(_278){if(_175.indexOf(_272,2)!==-1){if(_277){_272.push(3);}}else{return;}}else{if(_272.length>0){if(_277){_272.push(3);}}else{if(_277){return;}}}}}}return _272.length>0?_272:null;},_doQuery:function(_279,_27a,_27b){var _27c=[],mode=this._mode,_27d=this.objectIdField,i,len,_27e;if(_175.indexOf(_27a,2)!==-1){_27c=[];var ids=_279.objectIds;len=ids.length;for(i=0;i<len;i++){var obj=mode._getFeature(ids[i]);if(obj){_27c.push(obj);}}if(_27c.length===0){return [];}}if(_175.indexOf(_27a,1)!==-1){_27e=_27c.length>0?_27c:this.graphics;len=_27e.length;var _27f=_279.geometry._normalize(null,true);_27c=[];for(i=0;i<len;i++){var _280=_27e[i],_281=_280.geometry;if(_281){if(this.normalization&&_27f.length){if(_27f[0].intersects(_281)||_27f[1].intersects(_281)){_27c.push(_280);}}else{if(_27f.intersects(_281)){_27c.push(_280);}}}}if(_27c.length===0){return [];}}if(_175.indexOf(_27a,3)!==-1){if(this.timeInfo){_27e=_27c.length>0?_27c:this.graphics;var time=_279.timeExtent,_282=this._filterByTime(_27e,time.startTime,time.endTime);_27c=_282.match;}}if(_27b){return _175.map(_27c,function(obj){return obj.attributes[_27d];},this);}else{return _27c;}},_filterByTime:function(_283,_284,_285){var _286=this._startTimeField,_287=this._endTimeField,_288;if(!this._twoTimeFields){_288=_286||_287;}var _289=_17b.isDefined,yea=[],nay=[],i,len=_283.length,_28a,_28b;_284=_284?_284.getTime():-Infinity;_285=_285?_285.getTime():Infinity;if(_288){for(i=0;i<len;i++){_28a=_283[i];_28b=_28a.attributes;var time=_28b[_288];if(time>=_284&&time<=_285){yea.push(_28a);}else{nay.push(_28a);}}}else{for(i=0;i<len;i++){_28a=_283[i];_28b=_28a.attributes;var _28c=_28b[_286],end=_28b[_287];_28c=_289(_28c)?_28c:-Infinity;end=_289(end)?end:Infinity;if((_28c>=_284&&_28c<=_285)||(end>=_284&&end<=_285)||(_284>=_28c&&_285<=end)){yea.push(_28a);}else{nay.push(_28a);}}}return {match:yea,noMatch:nay};},_resolve:function(args,_28d,_28e,dfd,_28f){if(_28d){this[_28d].apply(this,args);}if(_28e){_28e.apply(null,args);}if(dfd){_17d._resDfd(dfd,args,_28f);}},_getShallowClone:function(_290){var _291=new _187(),prop;for(prop in _290){if(_290.hasOwnProperty(prop)){_291[prop]=_290[prop];}}return _291;},_query:function(type,_292,_293,_294,_295){var that=this,map=this._map,dfd=new _177(_17d._dfdCanceller),_296=_293;var _297=function(_298,_299){if(!_299&&type==="execute"&&!that._isTable){var _29a=_298.features,mode=that._mode,_29b=that.objectIdField,il=_29a.length,i;for(i=il-1;i>=0;i--){var oid=_29a[i].attributes[_29b];var _29c=mode._getFeature(oid);if(_29c){_29a.splice(i,1,_29c);}}}that._resolve([_298],_292,_294,dfd);};if(type!=="executeRelationshipQuery"){_296=this._getShallowClone(_293);_296.outFields=this.getOutFields();_296.returnGeometry=_293.hasOwnProperty("returnGeometry")?_293.returnGeometry:true;var _29d;if(map){_296.outSpatialReference=new _17e(map.spatialReference.toJson());}if(!this._applyQueryFilters(_296)){switch(type){case "execute":_29d=new _188({features:[]});break;case "executeForIds":_29d=[];break;case "executeForCount":_29d=0;break;}_297(_29d,true);return dfd;}var _29e=this._canDoClientSideQuery(_296);if(_29e){var _29f=this._doQuery(_296,_29e,(type==="executeForIds"||type==="executeForCount"));switch(type){case "execute":_29d=new _188();_29d.features=_29f;break;case "executeForIds":_29d=_29f;break;case "executeForCount":_29d=_29f.length;break;}_297(_29d,true);return dfd;}}if(this._collection){var err=new Error("FeatureLayer::_query - "+this.invalidParams);this._resolve([err],null,_295,dfd,true);return dfd;}if(this._ts){_296._ts=(new Date()).getTime();}var temp=dfd._pendingDfd=this._task[type](_296);temp.addCallbacks(_297,function(err){that._resolve([err],null,_295,dfd,true);});return dfd;},_convertFeaturesToJson:function(_2a0,_2a1,_2a2,_2a3){var json=[],_2a4=this._selectionSymbol,_2a5=this.visibilityField,i,_2a6,_2a7=this.objectIdField;if(this.loaded&&(_2a2||_2a3)){_2a6=_175.filter(this.fields,function(_2a8){return (_2a8.editable===false)&&(!_2a3||(_2a8.name!==_2a7));});}for(i=0;i<_2a0.length;i++){var _2a9=_2a0[i],_2aa={},_2ab=_2a9.geometry,attr=_2a9.attributes,_2ac=_2a9.symbol;if(_2ab&&(!_2a3||!this.loaded||this.allowGeometryUpdates)){_2aa.geometry=_2ab.toJson();}if(_2a5){_2aa.attributes=attr=lang.mixin({},attr);attr[_2a5]=_2a9.visible?1:0;}else{if(attr){_2aa.attributes=lang.mixin({},attr);}}if(_2aa.attributes&&_2a6&&_2a6.length){_175.forEach(_2a6,function(_2ad){delete _2aa.attributes[_2ad.name];});}if(_2ac&&(_2ac!==_2a4)){_2aa.symbol=_2ac.toJson();}json.push(_2aa);}return _2a1?json:_176.toJson(json);},_selectHandler:function(_2ae,_2af,_2b0,_2b1,dfd){var _2b2,ctor=this.constructor;switch(_2af){case ctor.SELECTION_NEW:this.clearSelection(true);_2b2=true;break;case ctor.SELECTION_ADD:_2b2=true;break;case ctor.SELECTION_SUBTRACT:_2b2=false;break;}var i,_2b3=_2ae.features,mode=this._mode,_2b4=[],_2b5=this.objectIdField,_2b6,oid;if(_2b2){for(i=0;i<_2b3.length;i++){_2b6=_2b3[i];oid=_2b6.attributes[_2b5];var _2b7=mode._addFeatureIIf(oid,_2b6);_2b4.push(_2b7);this._selectFeatureIIf(oid,_2b7,mode);}}else{for(i=0;i<_2b3.length;i++){_2b6=_2b3[i];oid=_2b6.attributes[_2b5];this._unSelectFeatureIIf(oid,mode);var _2b8=mode._removeFeatureIIf(oid);_2b4.push(_2b8||_2b6);}}if(this._isSelOnly){mode._applyTimeFilter(true);}this._resolve([_2b4,_2af,_2ae.exceededTransferLimit?{queryLimitExceeded:true}:null],"onSelectionComplete",_2b0,dfd);if(_2ae.exceededTransferLimit){this.onQueryLimitExceeded();}},_selectFeatureIIf:function(oid,_2b9,mode){var _2ba=this._selectedFeatures,_2bb=_2ba[oid];if(!_2bb){mode._incRefCount(oid);_2ba[oid]=_2b9;if(!this._isTable){this._setSelectSymbol(_2b9);}}return _2bb||_2b9;},_unSelectFeatureIIf:function(oid,mode){var _2bc=this._selectedFeatures[oid];if(_2bc){mode._decRefCount(oid);delete this._selectedFeatures[oid];if(!this._isTable){this._setUnSelectSymbol(_2bc);}}return _2bc;},_isSelected:function(_2bd){},_setSelectSymbol:function(_2be){var _2bf=this._selectionSymbol;if(_2bf&&!this._isSelOnly){_2be.setSymbol(_2bf);}},_setUnSelectSymbol:function(_2c0){var _2c1=this._selectionSymbol;if(_2c1&&!this._isSelOnly){if(_2c1===_2c0.symbol){_2c0.setSymbol(null,true);}}},_getOutFields:function(){var _2c2=_175.filter([this.objectIdField,this.typeIdField,this.creatorField,this._startTimeField,this._endTimeField,this._trackIdField].concat(this._rendererFields),function(_2c3,_2c4,arr){return !!_2c3&&(_175.indexOf(arr,_2c3)===_2c4);});var _2c5=lang.clone(this._outFields);if(_2c5){if(_175.indexOf(_2c5,"*")!==-1){return _2c5;}_175.forEach(_2c2,function(_2c6){if(_175.indexOf(_2c5,_2c6)===-1){_2c5.push(_2c6);}});return _2c5;}else{return _2c2;}},_checkFields:function(_2c7){var _2c8=_2c7||this._getOutFields();_175.forEach(_2c8,function(_2c9){if(_2c9==="*"){return;}if(!this._getField(_2c9)){console.debug("esri.layers.FeatureLayer: "+_17b.substitute({url:this.url,field:_2c9},"unable to find '${field}' field in the layer 'fields' information [url: ${url}]"));}},this);if(!_2c7&&!this._isTable&&!this._fserver&&!this._collection){var _2ca=_175.some(this.fields,function(_2cb){return (_2cb&&_2cb.type==="esriFieldTypeGeometry")?true:false;});if(!_2ca){console.debug("esri.layers.FeatureLayer: "+_17b.substitute({url:this.url},"unable to find a field of type 'esriFieldTypeGeometry' in the layer 'fields' information. If you are using a map service layer, features will not have geometry [url: ${url}]"));}}},_fixRendererFields:function(){var _2cc=this.renderer;if(_2cc&&this.fields.length>0){var _2cd=_175.filter([_2cc,_2cc.observationRenderer,_2cc.latestObservationRenderer,_2cc.trackRenderer],_17b.isDefined);var _2ce=[];_175.forEach(_2cd,function(rnd){var _2cf,_2d0;_2d0=rnd.attributeField;if(_2d0&&!lang.isFunction(_2d0)){_2cf=!this._getField(_2d0)&&this._getField(_2d0,true);if(_2cf){rnd.attributeField=_2cf.name;}}_2d0=rnd.attributeField2;if(_2d0){_2cf=!this._getField(_2d0)&&this._getField(_2d0,true);if(_2cf){rnd.attributeField2=_2cf.name;}}_2d0=rnd.attributeField3;if(_2d0){_2cf=!this._getField(_2d0)&&this._getField(_2d0,true);if(_2cf){rnd.attributeField3=_2cf.name;}}if(!lang.isFunction(rnd.attributeField)){_2ce.push(rnd.attributeField);}_2ce.push(rnd.attributeField2);_2ce.push(rnd.attributeField3);},this);this._rendererFields=_175.filter(_2ce,_17b.isDefined);}},_getField:function(_2d1,_2d2){var _2d3=this.fields;if(!_2d3||_2d3.length===0){return null;}var _2d4;if(_2d2){_2d1=_2d1.toLowerCase();}_175.some(_2d3,function(_2d5){var _2d6=false;if(_2d2){_2d6=(_2d5&&_2d5.name.toLowerCase()===_2d1)?true:false;}else{_2d6=(_2d5&&_2d5.name===_2d1)?true:false;}if(_2d6){_2d4=_2d5;}return _2d6;});return _2d4;},_getDateOpts:function(){if(!this._dtOpts){var _2d7=_175.map(_175.filter(this.fields,function(_2d8){return !!(_2d8&&_2d8.type==="esriFieldTypeDate");}),function(_2d9){return _2d9.name;});this._dtOpts={properties:_2d7};}return this._dtOpts;},_applyNormalized:function(_2da,_2db){if(_2da&&_2db){_175.forEach(_2da,function(_2dc,_2dd){if(_2dc&&_2db[_2dd]){_2dc.setGeometry(_2db[_2dd]);}});}},_editHandler:function(_2de,adds,_2df,_2e0,_2e1,dfd){var _2e2=_2de.addResults,_2e3=_2de.updateResults,_2e4=_2de.deleteResults,i,_2e5,oid,_2e6,attr,_2e7=this.objectIdField,mode=this._mode,_2e8=this._isTable;var _2e9=this.editFieldsInfo,_2ea=this.getOutFields()||[],_2eb=_2e9&&_2e9.creatorField,_2ec=_2e9&&_2e9.creationDateField,_2ed=_2e9&&_2e9.editorField,_2ee=_2e9&&_2e9.editDateField,_2ef=_2e9&&_2e9.realm;if(_175.indexOf(_2ea,"*")===-1){if(_2eb&&_175.indexOf(_2ea,_2eb)===-1){_2eb=null;}if(_2ec&&_175.indexOf(_2ea,_2ec)===-1){_2ec=null;}if(_2ed&&_175.indexOf(_2ea,_2ed)===-1){_2ed=null;}if(_2ee&&_175.indexOf(_2ea,_2ee)===-1){_2ee=null;}}var _2f0=(_2ec||_2ee)?(new Date()).getTime():null,_2f1=(_2eb||_2ed)?this.getUserId():undefined;if(_2f1&&_2ef){_2f1=_2f1+"@"+_2ef;}if(_2e2){for(i=0;i<_2e2.length;i++){_2e2[i]=new _191(_2e2[i]);if(_2e8){continue;}_2e5=_2e2[i];if(_2e5.success){oid=_2e5.objectId;_2e6=adds[i];var gl=_2e6._graphicsLayer;if(gl&&gl!==this){gl.remove(_2e6);}attr=_2e6.attributes||{};attr[_2e7]=oid;if(_2eb){attr[_2eb]=_2f1;}if(_2ed){attr[_2ed]=_2f1;}if(_2ec){attr[_2ec]=_2f0;}if(_2ee){attr[_2ee]=_2f0;}_2e6.setAttributes(attr);if(mode._init){mode.drawFeature(_2e6);}}}}if(_2e3){for(i=0;i<_2e3.length;i++){_2e3[i]=new _191(_2e3[i]);if(_2e8){continue;}_2e5=_2e3[i];if(_2e5.success){oid=_2e5.objectId;_2e6=_2df[oid];var _2f2=mode._getFeature(oid);if(_2f2){if(_2f2.geometry!==_2e6.geometry){_2f2.setGeometry(_18a.fromJson(_2e6.geometry.toJson()));}this._repaint(_2f2,oid);}_2e6=_2f2||_2e6;attr=_2e6.attributes||{};if(_2ed){attr[_2ed]=_2f1;}if(_2ee){attr[_2ee]=_2f0;}_2e6.setAttributes(attr);}}}if(_2e4){var _2f3=[];for(i=0;i<_2e4.length;i++){_2e4[i]=new _191(_2e4[i]);if(_2e8){continue;}_2e5=_2e4[i];if(_2e5.success){oid=_2e5.objectId;_2e6=mode._getFeature(oid);if(_2e6){if(this._unSelectFeatureIIf(oid,mode)){_2f3.push(_2e6);}_2e6._count=0;mode._removeFeatureIIf(oid);}}}if(_2f3.length>0){this.onSelectionComplete(_2f3,this.constructor.SELECTION_SUBTRACT);}}this._resolve([_2e2,_2e3,_2e4],"onEditsComplete",_2e0,dfd);},_sendAttachment:function(type,_2f4,_2f5,_2f6,_2f7){var _2f8=(type==="add")?"addAttachment":"updateAttachment",url=this._url.path+"/"+_2f4+"/"+_2f8,self=this;var dfd=_17c({url:url,form:_2f5,content:lang.mixin(this._url.query,{f:"json",token:this._getToken()||undefined}),callbackParamName:"callback.html",handleAs:"json"}).addCallback(function(_2f9){var _2fa=(type==="add")?"addAttachmentResult":"updateAttachmentResult",_2fb=(type==="add")?"onAddAttachmentComplete":"onUpdateAttachmentComplete",_2fc=new _191(_2f9[_2fa]);_2fc.attachmentId=_2fc.objectId;_2fc.objectId=_2f4;self._resolve([_2fc],_2fb,_2f6);return _2fc;}).addErrback(function(_2fd){self._resolve([_2fd],null,_2f7,null,true);});return dfd;},_repaint:function(_2fe,oid,_2ff){oid=_17b.isDefined(oid)?oid:_2fe.attributes[this.objectIdField];if(!(oid in this._selectedFeatures)||!this._selectionSymbol){_2fe.setSymbol(_2fe.symbol,_2ff);}},_getKind:function(_300){var _301=this._trackManager;if(_301){return _301.isLatestObservation(_300)?1:0;}return 0;}});lang.mixin(_196,{MODE_SNAPSHOT:0,MODE_ONDEMAND:1,MODE_SELECTION:2,SELECTION_NEW:3,SELECTION_ADD:4,SELECTION_SUBTRACT:5,POPUP_NONE:"esriServerHTMLPopupTypeNone",POPUP_HTML_TEXT:"esriServerHTMLPopupTypeAsHTMLText",POPUP_URL:"esriServerHTMLPopupTypeAsURL"});_18b._createWrappers(_196);if(has("extend-esri")){lang.setObject("layers.FeatureLayer",_196,_17a);}return _196;});},"dojo/DeferredList":function(){define(["./_base/kernel","./_base/Deferred","./_base/array"],function(dojo,_302,_303){dojo.DeferredList=function(list,_304,_305,_306,_307){var _308=[];_302.call(this);var self=this;if(list.length===0&&!_304){this.resolve([0,[]]);}var _309=0;_303.forEach(list,function(item,i){item.then(function(_30a){if(_304){self.resolve([i,_30a]);}else{_30b(true,_30a);}},function(_30c){if(_305){self.reject(_30c);}else{_30b(false,_30c);}if(_306){return null;}throw _30c;});function _30b(_30d,_30e){_308[i]=[_30d,_30e];_309++;if(_309===list.length){self.resolve(_308);}};});};dojo.DeferredList.prototype=new _302();dojo.DeferredList.prototype.gatherResults=function(_30f){var d=new dojo.DeferredList(_30f,false,true,false);d.addCallback(function(_310){var ret=[];_303.forEach(_310,function(_311){ret.push(_311[1]);});return ret;});return d;};return dojo.DeferredList;});},"esri/layers/KMLFolder":function(){define(["dojo/_base/declare","dojo/_base/lang","dojo/has","esri/kernel","esri/lang"],function(_312,lang,has,_313,_314){var _315=_312(null,{declaredClass:"esri.layers.KMLFolder",constructor:function(json){lang.mixin(this,json);if(_314.isDefined(this.visibility)){this.visible=!!this.visibility;}}});if(has("extend-esri")){lang.setObject("layers.KMLFolder",_315,_313);}return _315;});},"esri/layers/TrackManager":function(){define(["dojo/_base/declare","dojo/_base/lang","dojo/_base/array","dojo/has","esri/kernel","esri/graphic","esri/geometry/Polyline","esri/layers/GraphicsLayer"],function(_316,lang,_317,has,_318,_319,_31a,_31b){var _31c=_316(null,{declaredClass:"esri.layers._TrackManager",constructor:function(_31d){this.layer=_31d;this.trackMap={};},initialize:function(map){this.map=map;var _31e=this.layer,_31f=_31e.renderer.trackRenderer;if(_31f&&(_31e.geometryType==="esriGeometryPoint")){var _320=(this.container=new _31b._GraphicsLayer({id:_31e.id+"_tracks",_child:true}));_320.loaded=true;_320.onLoad(_320);_320._setMap(map,_31e._div);_320.setRenderer(_31f);}},addFeatures:function(_321){var tkid,_322=this.trackMap,_323=this.layer,_324=_323._trackIdField;_317.forEach(_321,function(_325){var _326=_325.attributes;tkid=_326[_324];var ary=(_322[tkid]=(_322[tkid]||[]));ary.push(_325);});var _327=_323._startTimeField,_328=_323.objectIdField;var _329=function(a,b){var _32a=a.attributes[_327],_32b=b.attributes[_327];if(_32a===_32b){return (a.attributes[_328]<b.attributes[_328])?-1:1;}else{return (_32a<_32b)?-1:1;}};for(tkid in _322){_322[tkid].sort(_329);}},drawTracks:function(){var _32c=this.container;if(!_32c){return;}var _32d=this.trackMap,sr=this.map.spatialReference,tkid,ary,path,i,_32e,_32f=this.layer._trackIdField,_330;for(tkid in _32d){ary=_32d[tkid];path=[];for(i=ary.length-1;i>=0;i--){_32e=ary[i].geometry;if(_32e){path.push([_32e.x,_32e.y]);}}_330={};_330[_32f]=tkid;if(path.length>0){_32c.add(new _319(new _31a({paths:[path],spatialReference:sr}),null,_330));}}},moveLatestToFront:function(){_317.forEach(this.getLatestObservations(),function(_331){var _332=_331._shape;_332&&_332._moveToFront();this._repaint(_331,null,true);},this.layer);},getLatestObservations:function(){var _333=[];if(!this.layer.renderer.latestObservationRenderer){return _333;}var _334=this.trackMap,tkid;for(tkid in _334){var ary=_334[tkid];_333.push(ary[ary.length-1]);}return _333;},clearTracks:function(){var _335=this.getLatestObservations();this.trackMap={};var _336=this.container;if(_336){_336.clear();}_317.forEach(_335,function(_337){this._repaint(_337,null,true);},this.layer);},isLatestObservation:function(_338){var _339=this.layer._trackIdField;var _33a=this.trackMap[_338.attributes[_339]];if(_33a){return (_33a[_33a.length-1]===_338);}return false;},destroy:function(){var _33b=this.container;if(_33b){_33b.clear();_33b._unsetMap(this.map,this.layer._div);this.container=null;}this.map=null;this.layer=null;this.trackMap=null;}});if(has("extend-esri")){lang.setObject("layers._TrackManager",_31c,_318);}return _31c;});},"esri/layers/WMSLayer":function(){define(["require","dojo/_base/kernel","dojo/_base/declare","dojo/_base/lang","dojo/_base/array","dojo/has","esri/kernel","esri/request","esri/urlUtils","esri/SpatialReference","esri/geometry/Extent","esri/layers/DynamicMapServiceLayer","esri/layers/WMSLayerInfo","dojo/query"],function(_33c,_33d,_33e,lang,_33f,has,_340,_341,_342,_343,_344,_345,_346){var _347=_33e([_345],{declaredClass:"esri.layers.WMSLayer",_CRS_TO_EPSG:{84:4326,83:4269,27:4267},_REVERSED_LAT_LONG_RANGES:[[4001,4999],[2044,2045],[2081,2083],[2085,2086],[2093,2093],[2096,2098],[2105,2132],[2169,2170],[2176,2180],[2193,2193],[2200,2200],[2206,2212],[2319,2319],[2320,2462],[2523,2549],[2551,2735],[2738,2758],[2935,2941],[2953,2953],[3006,3030],[3034,3035],[3058,3059],[3068,3068],[3114,3118],[3126,3138],[3300,3301],[3328,3335],[3346,3346],[3350,3352],[3366,3366],[3416,3416],[20004,20032],[20064,20092],[21413,21423],[21473,21483],[21896,21899],[22171,22177],[22181,22187],[22191,22197],[25884,25884],[27205,27232],[27391,27398],[27492,27492],[28402,28432],[28462,28492],[30161,30179],[30800,30800],[31251,31259],[31275,31279],[31281,31290],[31466,31700]],_WEB_MERCATOR:[102100,3857,102113,900913],_WORLD_MERCATOR:[3395,54004],allExtents:[],constructor:function(url,_348){url=this._stripParameters(url,["version","service","request","bbox","format","height","width","layers","srs","crs","styles","transparent","bgcolor","exceptions","time","elevation","sld","wfs"]);this.url=url;this._url=_342.urlToObject(url);this._getCapabilitiesURL=url;this._initLayer=lang.hitch(this,this._initLayer);this._parseCapabilities=lang.hitch(this,this._parseCapabilities);this._getCapabilitiesError=lang.hitch(this,this._getCapabilitiesError);if(_348){this.imageFormat=this._getImageFormat(_348.format);this.imageTransparency=(_348.transparent===false)?false:true;this.visibleLayers=_348.visibleLayers?_348.visibleLayers:[];if(_348.resourceInfo){this._readResourceInfo(_348.resourceInfo);}else{this._getCapabilities();}}else{this.imageFormat="image/png";this.imageTransparency=true;this.visibleLayers=[];this._getCapabilities();}this._blankImageURL=_33c.toUrl("esri/layers")+"/../images/pixel.png";},setVisibleLayers:function(_349){_349=this._checkVisibleLayersList(_349);this.visibleLayers=_349?_349:[];this.refresh(true);},setImageFormat:function(_34a){this.imageFormat=this._getImageFormat(_34a);this.refresh(true);},setImageTransparency:function(_34b){this.imageTransparency=_34b;this.refresh(true);},getImageUrl:function(_34c,_34d,_34e,_34f){if(!this.visibleLayers||this.visibleLayers.length===0){_34f(this._blankImageURL);return;}var wkid=_34c.spatialReference.wkid;if(_33f.some(this._WEB_MERCATOR,function(el){return el==wkid;})){var _350=_33f.filter(this.spatialReferences,function(el){return (_33f.some(this._WEB_MERCATOR,function(el2){return el2==el;}));},this);if(_350.length==0){_350=_33f.filter(this.spatialReferences,function(el){return (_33f.some(this._WORLD_MERCATOR,function(el2){return el2==el;}));},this);}if(_350.length>0){wkid=_350[0];}else{wkid=this._WEB_MERCATOR[0];}}var list=_33f.filter(this.spatialReferences,function(el){return el!==wkid;});this.spatialReferences=list;this.spatialReferences.unshift(wkid);var xmin=_34c.xmin;var xmax=_34c.xmax;var ymin=_34c.ymin;var ymax=_34c.ymax;var _351={};_351.SERVICE="WMS";_351.REQUEST="GetMap";_351.FORMAT=this.imageFormat;_351.TRANSPARENT=this.imageTransparency?"TRUE":"FALSE";_351.STYLES="";_351.VERSION=this.version;_351.LAYERS=this.visibleLayers?this.visibleLayers.toString():null;_351.WIDTH=_34d;_351.HEIGHT=_34e;if(this.maxWidth<_34d){_351.WIDTH=this.maxWidth;}if(this.maxHeight<_34e){_351.HEIGHT=this.maxHeight;}var _352=wkid?wkid:NaN;if(!isNaN(_352)){if(this.version=="1.3.0"){_351.CRS="EPSG:"+_352;}else{_351.SRS="EPSG:"+_352;}}if(this.version=="1.3.0"&&this._useLatLong(_352)){_351.BBOX=ymin+","+xmin+","+ymax+","+xmax;}else{_351.BBOX=xmin+","+ymin+","+xmax+","+ymax;}var _353=this.getMapURL,key;_353+=(_353.indexOf("?")==-1)?"?":"";for(key in _351){_353+=(_353.substring(_353.length-1,_353.length)=="?")?"":"&";_353+=key+"="+_351[key];}_34f(_342.addProxy(_353));},_initLayer:function(_354,io){this.spatialReference=new _343(this.extent.spatialReference);this.initialExtent=new _344(this.extent);this.fullExtent=new _344(this.extent);this.visibleLayers=this._checkVisibleLayersList(this.visibleLayers);this.loaded=true;this.onLoad(this);var _355=this._loadCallback;if(_355){delete this._loadCallback;_355(this);}},_readResourceInfo:function(_356){if(!_356.extent){console.error("esri.layers.WMSLayer: unable to find the 'extent' property in resourceInfo");return;}if(!_356.layerInfos){console.error("esri.layers.WMSLayer: unable to find the 'layerInfos' property in resourceInfo");return;}this.extent=_356.extent;this.allExtents[0]=_356.extent;this.layerInfos=_356.layerInfos;this.description=_356.description?_356.description:"";this.copyright=_356.copyright?_356.copyright:"";this.title=_356.title?_356.title:"";this.getMapURL=_356.getMapURL?_356.getMapURL:this._getCapabilitiesURL;this.version=_356.version?_356.version:"1.3.0";this.maxWidth=_356.maxWidth?_356.maxWidth:5000;this.maxHeight=_356.maxHeight?_356.maxHeight:5000;this.spatialReferences=_356.spatialReferences?_356.spatialReferences:[];this.imageFormat=this._getImageFormat(_356.format);this.setScaleRange(_356.minScale,_356.maxScale);this._initLayer();},_getCapabilities:function(){var _357=this._url.query?this._url.query:{};_357.SERVICE="WMS";_357.REQUEST="GetCapabilities";var uri=this._url.path+"?",key;for(key in _357){uri+=(uri.substring(uri.length-1,uri.length)=="?")?"":"&";uri+=key+"="+_357[key];}var _358=_341({url:uri,handleAs:"xml",headers:{"Content-Type":null},load:this._parseCapabilities,error:this._getCapabilitiesError},{usePost:false});},_parseCapabilities:function(xml){if(!xml){this.onError("GetCapabilities request for "+this._getCapabilitiesURL+" failed. (Response is null.)");return;}this.version=this._getAttributeValue("WMS_Capabilities","version",xml,null);if(!this.version){this.version=this._getAttributeValue("WMT_MS_Capabilities","version",xml,"1.3.0");}var _359=this._getTag("Service",xml);this.title=this._getTagValue("Title",_359,"");if(!this.title||this.title.length==0){this.title=this._getTagValue("Name",_359,"");}this.copyright=this._getTagValue("AccessConstraints",_359,"");this.description=this._getTagValue("Abstract",_359,"");this.maxWidth=parseInt(this._getTagValue("MaxWidth",_359,5000),10);this.maxHeight=parseInt(this._getTagValue("MaxHeight",_359,5000),10);var _35a=this._getTag("Layer",xml);if(!_35a){this._getCapabilitiesError({"error":{"message":"Response does not contain any layers."}});return;}var _35b=this._getLayerInfo(_35a);var _35c=0;var _35d=null;var _35e=this._getTag("Capability",xml);_33f.forEach(_35e.childNodes,function(_35f){if(_35f.nodeName=="Layer"){if(_35c===0){_35d=_35f;}else{if(_35c===1){if(_35b.name){_35b.name="";_35b.subLayers=[];_35b.subLayers.push(this._getLayerInfo(_35d));}_35b.subLayers.push(this._getLayerInfo(_35f));}else{_35b.subLayers.push(this._getLayerInfo(_35f));}}_35c++;}},this);if(_35b){this.layerInfos=_35b.subLayers;if(!this.layerInfos||this.layerInfos.length==0){this.layerInfos=[_35b];}this.extent=_35b.extent;this.allExtents=_35b.allExtents;this.spatialReferences=_35b.spatialReferences;if(this.spatialReferences.length==0&&this.layerInfos.length>0){this.spatialReferences=this.layerInfos[0].spatialReferences;}}this.getMapURL=this._getCapabilitiesURL;var _360=_33d.query("DCPType",this._getTag("GetMap",xml));if(_360&&_360.length>0){var _361=_33d.query("HTTP",_360[0]);if(_361&&_361.length>0){var _362=_33d.query("Get",_361[0]);if(_362&&_362.length>0){var _363=this._getAttributeValue("OnlineResource","xlink:href",_362[0],null);if(_363){if(_363.indexOf("&")==(_363.length-1)){_363=_363.substring(0,_363.length-1);}this.getMapURL=_363;}}}}this.getMapFormats=[];if(_33d.query("Operation",xml).length==0){_33f.forEach(_33d.query("Format",this._getTag("GetMap",xml)),function(_364){this.getMapFormats.push(_364.text?_364.text:_364.textContent);},this);}else{_33f.forEach(_33d.query("Operation",xml),function(_365){if(_365.getAttribute("name")=="GetMap"){_33f.forEach(_33d.query("Format",_365),function(_366){this.getMapFormats.push(_366.text?_366.text:_366.textContent);},this);}},this);}if(!_33f.some(this.getMapFormats,function(el){return el.indexOf(this.imageFormat)>-1;},this)){this.imageFormat=this.getMapFormats[0];}this._initLayer();},_getCapabilitiesError:function(_367,io){this.onError("GetCapabilities request for "+this._getCapabilitiesURL+" failed.",_367);},_getLayerInfo:function(_368){if(!_368){return null;}var _369=new _346();_369.name="";_369.title="";_369.description="";_369.allExtents=[];_369.spatialReferences=[];_369.subLayers=[];var _36a=this._getTag("LatLonBoundingBox",_368);if(_36a){_369.allExtents[0]=this._getExtent(_36a,4326);}var _36b=this._getTag("EX_GeographicBoundingBox",_368);if(_36b){var _36c=new _344(0,0,0,0,new _343({wkid:4326}));_36c.xmin=parseFloat(this._getTagValue("westBoundLongitude",_36b,0));_36c.ymin=parseFloat(this._getTagValue("southBoundLatitude",_36b,0));_36c.xmax=parseFloat(this._getTagValue("eastBoundLongitude",_36b,0));_36c.ymax=parseFloat(this._getTagValue("northBoundLatitude",_36b,0));_369.allExtents[0]=_36c;}_369.extent=_369.allExtents[0];var _36d=(_33f.indexOf(["1.0.0","1.1.0","1.1.1"],this.version)>-1)?"SRS":"CRS";_33f.forEach(_368.childNodes,function(_36e){if(_36e.nodeName=="Name"){_369.name=(_36e.text?_36e.text:_36e.textContent)||"";}else{if(_36e.nodeName=="Title"){_369.title=(_36e.text?_36e.text:_36e.textContent)||"";}else{if(_36e.nodeName=="Abstract"){_369.description=(_36e.text?_36e.text:_36e.textContent)||"";}else{if(_36e.nodeName=="BoundingBox"){var _36f=_36e.getAttribute(_36d),wkid;if(_36f&&_36f.indexOf("EPSG:")===0){wkid=parseInt(_36f.substring(5),10);if(wkid!==0&&!isNaN(wkid)){var _370;if(this.version=="1.3.0"){_370=this._getExtent(_36e,wkid,this._useLatLong(wkid));}else{_370=this._getExtent(_36e,wkid);}_369.allExtents[wkid]=_370;if(!_369.extent){_369.extent=_370;}}}else{if(_36f&&_36f.indexOf("CRS:")===0){wkid=parseInt(_36f.substring(4),10);if(wkid!==0&&!isNaN(wkid)){if(this._CRS_TO_EPSG[wkid]){wkid=this._CRS_TO_EPSG[wkid];}_369.allExtents[wkid]=this._getExtent(_36e,wkid);}}else{wkid=parseInt(_36f,10);if(wkid!==0&&!isNaN(wkid)){_369.allExtents[wkid]=this._getExtent(_36e,wkid);}}}}else{if(_36e.nodeName==_36d){var _371=_36e.text?_36e.text:_36e.textContent;var arr=_371.split(" ");_33f.forEach(arr,function(val){if(val.indexOf(":")>-1){val=parseInt(val.split(":")[1],10);}else{val=parseInt(val,10);}if(val!==0&&!isNaN(val)){if(this._CRS_TO_EPSG[val]){val=this._CRS_TO_EPSG[val];}if(_33f.indexOf(_369.spatialReferences,val)==-1){_369.spatialReferences.push(val);}}},this);}else{if(_36e.nodeName=="Style"){var _372=this._getTag("LegendURL",_36e);if(_372){var _373=this._getTag("OnlineResource",_372);if(_373){_369.legendURL=_373.getAttribute("xlink:href");}}}else{if(_36e.nodeName==="Layer"){_369.subLayers.push(this._getLayerInfo(_36e));}}}}}}}},this);_369.title=_369.title||_369.name;return _369;},_getImageFormat:function(_374){var _375=_374?_374.toLowerCase():"";switch(_375){case "jpg":return "image/jpeg";case "bmp":return "image/bmp";case "gif":return "image/gif";case "svg":return "image/svg+xml";default:return "image/png";}},getImageFormat:function(){var _376=this.imageFormat?this.imageFormat.toLowerCase():"";switch(_376){case "image/jpeg":return "jpg";case "image/bmp":return "bmp";case "image/gif":return "gif";case "image/svg+xml":return "svg";default:return "png";}},_getExtent:function(_377,wkid,_378){var _379;if(_377){_379=new _344();var minx=parseFloat(_377.getAttribute("minx"));var miny=parseFloat(_377.getAttribute("miny"));var maxx=parseFloat(_377.getAttribute("maxx"));var maxy=parseFloat(_377.getAttribute("maxy"));if(_378){_379.xmin=isNaN(miny)?((-1)*Number.MAX_VALUE):miny;_379.ymin=isNaN(minx)?((-1)*Number.MAX_VALUE):minx;_379.xmax=isNaN(maxy)?Number.MAX_VALUE:maxy;_379.ymax=isNaN(maxx)?Number.MAX_VALUE:maxx;}else{_379.xmin=isNaN(minx)?((-1)*Number.MAX_VALUE):minx;_379.ymin=isNaN(miny)?((-1)*Number.MAX_VALUE):miny;_379.xmax=isNaN(maxx)?Number.MAX_VALUE:maxx;_379.ymax=isNaN(maxy)?Number.MAX_VALUE:maxy;}_379.spatialReference=new _343({wkid:wkid});}return _379;},_useLatLong:function(wkid){var _37a,i;for(i=0;i<this._REVERSED_LAT_LONG_RANGES.length;i++){var _37b=this._REVERSED_LAT_LONG_RANGES[i];if(wkid>=_37b[0]&&wkid<=_37b[1]){_37a=true;break;}}return _37a;},_getTag:function(_37c,xml){var tags=_33d.query(_37c,xml);if(tags&&tags.length>0){return tags[0];}else{return null;}},_getTagValue:function(_37d,xml,_37e){var _37f=_33d.query(_37d,xml);if(_37f&&_37f.length>0){if(_37f[0].text){return _37f[0].text;}else{return _37f[0].textContent;}}else{return _37e;}},_getAttributeValue:function(_380,_381,xml,_382){var _383=_33d.query(_380,xml);if(_383&&_383.length>0){return _383[0].getAttribute(_381);}else{return _382;}},_checkVisibleLayersList:function(_384){if(_384&&_384.length>0&&this.layerInfos&&this.layerInfos.length>0){if((typeof _384[0])=="number"){var list=[];_33f.forEach(_384,function(pos){if(pos<this.layerInfos.length){list.push(this.layerInfos[pos].name);}},this);_384=list;}}return _384;},_stripParameters:function(url,_385){var obj=_342.urlToObject(url),prop,qs=[];for(prop in obj.query){if(_33f.indexOf(_385,prop.toLowerCase())===-1){qs.push(prop+"="+obj.query[prop]);}}return obj.path+(qs.length?("?"+qs.join("&")):"");}});if(has("extend-esri")){lang.setObject("layers.WMSLayer",_347,_340);}return _347;});},"esri/layers/SnapshotMode":function(){define(["dojo/_base/declare","dojo/_base/lang","dojo/has","esri/kernel","esri/SpatialReference","esri/tasks/query","esri/layers/RenderMode"],function(_386,lang,has,_387,_388,_389,_38a){var _38b=_386([_38a],{declaredClass:"esri.layers._SnapshotMode",constructor:function(_38c){this.featureLayer=_38c;this._featureMap={};this._drawFeatures=lang.hitch(this,this._drawFeatures);this._queryErrorHandler=lang.hitch(this,this._queryErrorHandler);},startup:function(){if(this.featureLayer._collection){this._applyTimeFilter();}else{this._fetchAll();}},propertyChangeHandler:function(type){if(this._init){if(type){if(this.featureLayer._collection){console.log("FeatureLayer: layer created by value (from a feature collection) does not support definition expressions and time definitions. Layer id = "+this.featureLayer.id);}else{this._fetchAll();}}else{this._applyTimeFilter();}}},drawFeature:function(_38d){var _38e=this.featureLayer,_38f=_38e.objectIdField,oid=_38d.attributes[_38f];this._addFeatureIIf(oid,_38d);this._incRefCount(oid);},resume:function(){this.propertyChangeHandler(0);},refresh:function(){var _390=this.featureLayer;if(_390._collection){_390._fireUpdateStart();_390._refresh(true);_390._fireUpdateEnd();}else{this._fetchAll();}},_getRequestId:function(_391){var id="_"+_391.name+_391.layerId+_391._ulid;return id.replace(/[^a-zA-Z0-9\_]+/g,"_");},_fetchAll:function(){var _392=this.featureLayer;if(_392._collection){return;}_392._fireUpdateStart();this._clearIIf();this._sendRequest();},_sendRequest:function(){var map=this.map,_393=this.featureLayer,_394=_393.getDefinitionExpression();var _395=new _389();_395.outFields=_393.getOutFields();_395.where=_394||"1=1";_395.returnGeometry=true;_395.outSpatialReference=new _388(map.spatialReference.toJson());_395.timeExtent=_393.getTimeDefinition();_395.maxAllowableOffset=_393._maxOffset;if(_393._ts){_395._ts=(new Date()).getTime();}var _396;if(_393._usePatch){_396=this._getRequestId(_393);this._cancelPendingRequest(null,_396);}_393._task.execute(_395,this._drawFeatures,this._queryErrorHandler,_396);},_drawFeatures:function(_397){this._purgeRequests();var _398=_397.features,_399=this.featureLayer,_39a=_399.objectIdField,i,len=_398.length,_39b,oid;for(i=0;i<len;i++){_39b=_398[i];oid=_39b.attributes[_39a];this._addFeatureIIf(oid,_39b);this._incRefCount(oid);}this._applyTimeFilter(true);_399._fireUpdateEnd(null,_397.exceededTransferLimit?{queryLimitExceeded:true}:null);if(_397.exceededTransferLimit){_399.onQueryLimitExceeded();}},_queryErrorHandler:function(err){this._purgeRequests();var _39c=this.featureLayer;_39c._errorHandler(err);_39c._fireUpdateEnd(err);}});if(has("extend-esri")){lang.setObject("layers._SnapshotMode",_38b,_387);}return _38b;});},"esri/layers/SelectionMode":function(){define(["dojo/_base/declare","dojo/_base/lang","dojo/has","esri/kernel","esri/layers/RenderMode"],function(_39d,lang,has,_39e,_39f){var _3a0=_39d([_39f],{declaredClass:"esri.layers._SelectionMode",constructor:function(_3a1){this.featureLayer=_3a1;this._featureMap={};},propertyChangeHandler:function(type){if(this._init&&type===0){this._applyTimeFilter();}},resume:function(){this.propertyChangeHandler(0);}});if(has("extend-esri")){lang.setObject("layers._SelectionMode",_3a0,_39e);}return _3a0;});},"esri/layers/GridLayout":function(){define(["dojo/_base/declare","dojo/_base/lang","dojo/_base/array","dojo/has","esri/kernel","esri/SpatialReference","esri/geometry/Extent","esri/geometry/Polyline"],function(_3a2,lang,_3a3,has,_3a4,_3a5,_3a6,_3a7){var _3a8=_3a2(null,{declaredClass:"esri.layers._GridLayout",constructor:function(_3a9,_3aa,_3ab,_3ac){this.origin=_3a9;this.cellWidth=_3aa.width;this.cellHeight=_3aa.height;this.mapWidth=_3ab.width;this.mapHeight=_3ab.height;this.srInfo=_3ac;},setResolution:function(_3ad){this._resolution=(_3ad.xmax-_3ad.xmin)/this.mapWidth;if(this.srInfo){var _3ae=Math.round((2*this.srInfo.valid[1])/this._resolution),_3af=Math.round(_3ae/this.cellWidth);this._frameStats=[_3af,0,_3af-1];}},getCellCoordinates:function(_3b0){var res=this._resolution,_3b1=this.origin;return {row:Math.floor((_3b1.y-_3b0.y)/(this.cellHeight*res)),col:Math.floor((_3b0.x-_3b1.x)/(this.cellWidth*res))};},normalize:function(col){var _3b2=this._frameStats;if(_3b2){var _3b3=_3b2[0],m180=_3b2[1],p180=_3b2[2];if(col<m180){col=col%_3b3;col=col<m180?col+_3b3:col;}else{if(col>p180){col=col%_3b3;}}}return col;},intersects:function(_3b4,_3b5){var _3b6=this.srInfo;if(_3b6){return _3a3.some(_3b5._getParts(_3b6),function(_3b7){return _3b4.intersects(_3b7.extent);});}else{return _3b4.intersects(_3b5);}},getCellExtent:function(row,col){var res=this._resolution,_3b8=this.origin,_3b9=this.cellWidth,_3ba=this.cellHeight;return new _3a6((col*_3b9*res)+_3b8.x,_3b8.y-((row+1)*_3ba*res),((col+1)*_3b9*res)+_3b8.x,_3b8.y-(row*_3ba*res),new _3a5(_3b8.spatialReference.toJson()));},getLatticeID:function(_3bb){var _3bc=this.getCellCoordinates({x:_3bb.xmin,y:_3bb.ymax}),_3bd=this.getCellCoordinates({x:_3bb.xmax,y:_3bb.ymin}),_3be=_3bc.row,_3bf=_3bd.row,_3c0=this.normalize(_3bc.col),_3c1=this.normalize(_3bd.col);return _3be+"_"+_3bf+"_"+_3c0+"_"+_3c1;},sorter:function(a,b){return (a<b)?-1:1;},getCellsInExtent:function(_3c2,_3c3){var _3c4=this.getCellCoordinates({x:_3c2.xmin,y:_3c2.ymax}),_3c5=this.getCellCoordinates({x:_3c2.xmax,y:_3c2.ymin}),_3c6=_3c4.row,_3c7=_3c5.row,_3c8=_3c4.col,_3c9=_3c5.col,_3ca=[],i,j,nj,_3cb=[],_3cc=[],len,xmin,xmax,ymin,ymax,_3cd=[],_3ce,_3cf;for(i=_3c6;i<=_3c7;i++){for(j=_3c8;j<=_3c9;j++){nj=this.normalize(j);_3c2=this.getCellExtent(i,nj);_3ca.push({row:i,col:nj,extent:_3c2,resolution:this._resolution});if(_3c3){_3cb.push(_3c2.xmin,_3c2.xmax);_3cc.push(_3c2.ymin,_3c2.ymax);}}}_3c8=this.normalize(_3c8);_3c9=this.normalize(_3c9);_3cb.sort(this.sorter);_3cc.sort(this.sorter);len=_3cb.length;for(i=len-1;i>=0;i--){if(i<(len-1)){if(_3cb[i]===_3cb[i+1]){_3cb.splice(i,1);}}}len=_3cc.length;for(i=len-1;i>=0;i--){if(i<(len-1)){if(_3cc[i]===_3cc[i+1]){_3cc.splice(i,1);}}}if(_3cb.length&&_3cc.length){xmin=_3cb[0];xmax=_3cb[_3cb.length-1];ymin=_3cc[0];ymax=_3cc[_3cc.length-1];len=_3cb.length;for(i=0;i<len;i++){_3cd.push([[_3cb[i],ymax],[_3cb[i],ymin]]);}len=_3cc.length;for(i=0;i<len;i++){_3cd.push([[xmin,_3cc[i]],[xmax,_3cc[i]]]);}_3ce=new _3a7({paths:_3cd,spatialReference:this.origin.spatialReference.toJson()});_3cf=_3c6+"_"+_3c7+"_"+_3c8+"_"+_3c9;_3ca.push({latticeID:_3cf,lattice:_3ce,resolution:this._resolution});}return {minRow:_3c6,maxRow:_3c7,minCol:_3c8,maxCol:_3c9,cells:_3ca};}});if(has("extend-esri")){lang.setObject("layers._GridLayout",_3a8,_3a4);}return _3a8;});},"dojox/data/CsvStore":function(){define("dojox/data/CsvStore",["dojo/_base/lang","dojo/_base/declare","dojo/_base/xhr","dojo/_base/kernel","dojo/data/util/filter","dojo/data/util/simpleFetch"],function(lang,_3d0,xhr,_3d1,_3d2,_3d3){var _3d4=_3d0("dojox.data.CsvStore",null,{constructor:function(_3d5){this._attributes=[];this._attributeIndexes={};this._dataArray=[];this._arrayOfAllItems=[];this._loadFinished=false;if(_3d5.url){this.url=_3d5.url;}this._csvData=_3d5.data;if(_3d5.label){this.label=_3d5.label;}else{if(this.label===""){this.label=undefined;}}this._storeProp="_csvStore";this._idProp="_csvId";this._features={"dojo.data.api.Read":true,"dojo.data.api.Identity":true};this._loadInProgress=false;this._queuedFetches=[];this.identifier=_3d5.identifier;if(this.identifier===""){delete this.identifier;}else{this._idMap={};}if("separator" in _3d5){this.separator=_3d5.separator;}if("urlPreventCache" in _3d5){this.urlPreventCache=_3d5.urlPreventCache?true:false;}},url:"",label:"",identifier:"",separator:",",urlPreventCache:false,_assertIsItem:function(item){if(!this.isItem(item)){throw new Error(this.declaredClass+": a function was passed an item argument that was not an item");}},_getIndex:function(item){var idx=this.getIdentity(item);if(this.identifier){idx=this._idMap[idx];}return idx;},getValue:function(item,_3d6,_3d7){this._assertIsItem(item);var _3d8=_3d7;if(typeof _3d6==="string"){var ai=this._attributeIndexes[_3d6];if(ai!=null){var _3d9=this._dataArray[this._getIndex(item)];_3d8=_3d9[ai]||_3d7;}}else{throw new Error(this.declaredClass+": a function was passed an attribute argument that was not a string");}return _3d8;},getValues:function(item,_3da){var _3db=this.getValue(item,_3da);return (_3db?[_3db]:[]);},getAttributes:function(item){this._assertIsItem(item);var _3dc=[];var _3dd=this._dataArray[this._getIndex(item)];for(var i=0;i<_3dd.length;i++){if(_3dd[i]!==""){_3dc.push(this._attributes[i]);}}return _3dc;},hasAttribute:function(item,_3de){this._assertIsItem(item);if(typeof _3de==="string"){var _3df=this._attributeIndexes[_3de];var _3e0=this._dataArray[this._getIndex(item)];return (typeof _3df!=="undefined"&&_3df<_3e0.length&&_3e0[_3df]!=="");}else{throw new Error(this.declaredClass+": a function was passed an attribute argument that was not a string");}},containsValue:function(item,_3e1,_3e2){var _3e3=undefined;if(typeof _3e2==="string"){_3e3=_3d2.patternToRegExp(_3e2,false);}return this._containsValue(item,_3e1,_3e2,_3e3);},_containsValue:function(item,_3e4,_3e5,_3e6){var _3e7=this.getValues(item,_3e4);for(var i=0;i<_3e7.length;++i){var _3e8=_3e7[i];if(typeof _3e8==="string"&&_3e6){return (_3e8.match(_3e6)!==null);}else{if(_3e5===_3e8){return true;}}}return false;},isItem:function(_3e9){if(_3e9&&_3e9[this._storeProp]===this){var _3ea=_3e9[this._idProp];if(this.identifier){var data=this._dataArray[this._idMap[_3ea]];if(data){return true;}}else{if(_3ea>=0&&_3ea<this._dataArray.length){return true;}}}return false;},isItemLoaded:function(_3eb){return this.isItem(_3eb);},loadItem:function(item){},getFeatures:function(){return this._features;},getLabel:function(item){if(this.label&&this.isItem(item)){return this.getValue(item,this.label);}return undefined;},getLabelAttributes:function(item){if(this.label){return [this.label];}return null;},_fetchItems:function(_3ec,_3ed,_3ee){var self=this;var _3ef=function(_3f0,_3f1){var _3f2=null;if(_3f0.query){var key,_3f3;_3f2=[];var _3f4=_3f0.queryOptions?_3f0.queryOptions.ignoreCase:false;var _3f5={};for(key in _3f0.query){_3f3=_3f0.query[key];if(typeof _3f3==="string"){_3f5[key]=_3d2.patternToRegExp(_3f3,_3f4);}}for(var i=0;i<_3f1.length;++i){var _3f6=true;var _3f7=_3f1[i];for(key in _3f0.query){_3f3=_3f0.query[key];if(!self._containsValue(_3f7,key,_3f3,_3f5[key])){_3f6=false;}}if(_3f6){_3f2.push(_3f7);}}}else{_3f2=_3f1.slice(0,_3f1.length);}_3ed(_3f2,_3f0);};if(this._loadFinished){_3ef(_3ec,this._arrayOfAllItems);}else{if(this.url!==""){if(this._loadInProgress){this._queuedFetches.push({args:_3ec,filter:_3ef});}else{this._loadInProgress=true;var _3f8={url:self.url,handleAs:"text",preventCache:self.urlPreventCache};var _3f9=xhr.get(_3f8);_3f9.addCallback(function(data){try{self._processData(data);_3ef(_3ec,self._arrayOfAllItems);self._handleQueuedFetches();}catch(e){_3ee(e,_3ec);}});_3f9.addErrback(function(_3fa){self._loadInProgress=false;if(_3ee){_3ee(_3fa,_3ec);}else{throw _3fa;}});var _3fb=null;if(_3ec.abort){_3fb=_3ec.abort;}_3ec.abort=function(){var df=_3f9;if(df&&df.fired===-1){df.cancel();df=null;}if(_3fb){_3fb.call(_3ec);}};}}else{if(this._csvData){try{this._processData(this._csvData);this._csvData=null;_3ef(_3ec,this._arrayOfAllItems);}catch(e){_3ee(e,_3ec);}}else{var _3fc=new Error(this.declaredClass+": No CSV source data was provided as either URL or String data input.");if(_3ee){_3ee(_3fc,_3ec);}else{throw _3fc;}}}}},close:function(_3fd){},_getArrayOfArraysFromCsvFileContents:function(_3fe){if(lang.isString(_3fe)){var _3ff=new RegExp("^\\s+","g");var _400=new RegExp("\\s+$","g");var _401=new RegExp("\"\"","g");var _402=[];var i;var _403=this._splitLines(_3fe);for(i=0;i<_403.length;++i){var _404=_403[i];if(_404.length>0){var _405=_404.split(this.separator);var j=0;while(j<_405.length){var _406=_405[j];var _407=_406.replace(_3ff,"");var _408=_407.replace(_400,"");var _409=_408.charAt(0);var _40a=_408.charAt(_408.length-1);var _40b=_408.charAt(_408.length-2);var _40c=_408.charAt(_408.length-3);if(_408.length===2&&_408=="\"\""){_405[j]="";}else{if((_409=="\"")&&((_40a!="\"")||((_40a=="\"")&&(_40b=="\"")&&(_40c!="\"")))){if(j+1===_405.length){return;}var _40d=_405[j+1];_405[j]=_407+this.separator+_40d;_405.splice(j+1,1);}else{if((_409=="\"")&&(_40a=="\"")){_408=_408.slice(1,(_408.length-1));_408=_408.replace(_401,"\"");}_405[j]=_408;j+=1;}}}_402.push(_405);}}this._attributes=_402.shift();for(i=0;i<this._attributes.length;i++){this._attributeIndexes[this._attributes[i]]=i;}this._dataArray=_402;}},_splitLines:function(_40e){var _40f=[];var i;var line="";var _410=false;for(i=0;i<_40e.length;i++){var c=_40e.charAt(i);switch(c){case "\"":_410=!_410;line+=c;break;case "\r":if(_410){line+=c;}else{_40f.push(line);line="";if(i<(_40e.length-1)&&_40e.charAt(i+1)=="\n"){i++;}}break;case "\n":if(_410){line+=c;}else{_40f.push(line);line="";}break;default:line+=c;}}if(line!==""){_40f.push(line);}return _40f;},_processData:function(data){this._getArrayOfArraysFromCsvFileContents(data);this._arrayOfAllItems=[];if(this.identifier){if(this._attributeIndexes[this.identifier]===undefined){throw new Error(this.declaredClass+": Identity specified is not a column header in the data set.");}}for(var i=0;i<this._dataArray.length;i++){var id=i;if(this.identifier){var _411=this._dataArray[i];id=_411[this._attributeIndexes[this.identifier]];this._idMap[id]=i;}this._arrayOfAllItems.push(this._createItemFromIdentity(id));}this._loadFinished=true;this._loadInProgress=false;},_createItemFromIdentity:function(_412){var item={};item[this._storeProp]=this;item[this._idProp]=_412;return item;},getIdentity:function(item){if(this.isItem(item)){return item[this._idProp];}return null;},fetchItemByIdentity:function(_413){var item;var _414=_413.scope?_413.scope:_3d1.global;if(!this._loadFinished){var self=this;if(this.url!==""){if(this._loadInProgress){this._queuedFetches.push({args:_413});}else{this._loadInProgress=true;var _415={url:self.url,handleAs:"text"};var _416=xhr.get(_415);_416.addCallback(function(data){try{self._processData(data);var item=self._createItemFromIdentity(_413.identity);if(!self.isItem(item)){item=null;}if(_413.onItem){_413.onItem.call(_414,item);}self._handleQueuedFetches();}catch(error){if(_413.onError){_413.onError.call(_414,error);}}});_416.addErrback(function(_417){this._loadInProgress=false;if(_413.onError){_413.onError.call(_414,_417);}});}}else{if(this._csvData){try{self._processData(self._csvData);self._csvData=null;item=self._createItemFromIdentity(_413.identity);if(!self.isItem(item)){item=null;}if(_413.onItem){_413.onItem.call(_414,item);}}catch(e){if(_413.onError){_413.onError.call(_414,e);}}}}}else{item=this._createItemFromIdentity(_413.identity);if(!this.isItem(item)){item=null;}if(_413.onItem){_413.onItem.call(_414,item);}}},getIdentityAttributes:function(item){if(this.identifier){return [this.identifier];}else{return null;}},_handleQueuedFetches:function(){if(this._queuedFetches.length>0){for(var i=0;i<this._queuedFetches.length;i++){var _418=this._queuedFetches[i];var _419=_418.filter;var _41a=_418.args;if(_419){_419(_41a,this._arrayOfAllItems);}else{this.fetchItemByIdentity(_418.args);}}this._queuedFetches=[];}}});lang.extend(_3d4,_3d3);return _3d4;});},"esri/arcgis/csv":function(){define(["dojo/_base/lang","dojo/_base/array","dojo/_base/Deferred","dojo/sniff","dojo/number","dojox/data/CsvStore","esri/kernel","esri/config","esri/request","esri/SpatialReference","esri/geometry/Point","esri/geometry/jsonUtils","esri/geometry/webMercatorUtils"],function(lang,_41b,_41c,has,_41d,_41e,_41f,_420,_421,_422,_423,_424,_425){var _426=["lat","latitude","y","ycenter","latitude83","latdecdeg","POINT-Y"],_427=["lon","lng","long","longitude","x","xcenter","longitude83","longdecdeg","POINT-X"];function _428(_429){var _42a=[","," ",";","|","\t"];var _42b=0;var _42c="";_41b.forEach(_42a,function(_42d){var _42e=_429.split(_42d).length;if(_42e>_42b){_42b=_42e;_42c=_42d;}});return _42c;};function _42f(d,_430){if(!d||Object.prototype.toString.call(d)!=="[object Date]"||isNaN(d.getTime())){return false;}var _431=true;if(has("chrome")&&/\d+\W*$/.test(_430)){var _432=_430.match(/[a-zA-Z]{2,}/);if(_432){var _433=false,i=0,len=_432.length,_434=/^((jan(uary)?)|(feb(ruary)?)|(mar(ch)?)|(apr(il)?)|(may)|(jun(e)?)|(jul(y)?)|(aug(ust)?)|(sep(tember)?)|(oct(ober)?)|(nov(ember)?)|(dec(ember)?)|(am)|(pm)|(gmt)|(utc))$/i;while(!_433&&(i<=len)&&!(_433=!_434.test(_432[i]))){i++;}_431=!_433;}}return _431;};function _435(data,_436,_437){var _438=data.indexOf("\n");var _439=lang.trim(data.substr(0,_438));var _43a=_436.columnDelimiter;if(!_43a){_43a=_428(_439);}var _43b=new _41e({data:data,separator:_43a});var _43c=(has("ie")<9)?750:1001;_43b.fetch({start:0,count:_43c,onComplete:function(_43d,_43e){var _43f=0;var _440={"layerDefinition":_436.layerDefinition,"featureSet":{"features":[],"geometryType":"esriGeometryPoint"}};var _441=_440.layerDefinition.objectIdField;if(!_441){if(!_41b.some(_440.layerDefinition.fields,function(_442){if(_442.type=="esriFieldTypeOID"){_441=_442.name;return true;}return false;})){_440.layerDefinition.fields.push({"name":"__OBJECTID","alias":"__OBJECTID","type":"esriFieldTypeOID","editable":false,"domain":null});_441="__OBJECTID";}}var _443,_444;var _445=_43b._attributes;var _446=[];var _447=[];_41b.forEach(_440.layerDefinition.fields,function(_448,_449){if(_448.type==="esriFieldTypeDate"){_446.push(_448.name);}else{if(_448.type==="esriFieldTypeDouble"||_448.type==="esriFieldTypeInteger"){_447.push(_448.name);}}});if(_436.locationInfo&&_436.locationInfo.locationType==="coordinates"){_443=_436.locationInfo.latitudeFieldName;_444=_436.locationInfo.longitudeFieldName;}else{_41b.forEach(_445,function(_44a){var _44b;_44b=_41b.indexOf(_426,_44a.toLowerCase());if(_44b!==-1){_443=_44a;}_44b=_41b.indexOf(_427,_44a.toLowerCase());if(_44b!==-1){_444=_44a;}},this);}if(!_443||!_444){setTimeout(function(){console.error("File does not seem to contain fields with point coordinates.");},1);return;}var i=0,il=_43d.length;for(i;i<il;i++){if(_440.featureSet.features.length>=1000){setTimeout(function(){console.error("1000 feature limit reached. Unable to load any more data.");},1);break;}var item=_43d[i];var _44c=_43b.getAttributes(item),_44d={};_41b.forEach(_44c,function(attr,_44e){if(attr){var _44f=attr;if(attr.length===0){_41b.forEach(_440.layerDefinition.fields,function(_450,idx){if(_450.name==="attribute_"+(idx-1)){attr="attribute_"+(idx-1);}});}if(_41b.some(_446,function(a){return a===attr;})){var val=_43b.getValue(item,_44f),date=new Date(val);_44d[attr]=_42f(date,val)?date.getTime():null;}else{if(_41b.some(_447,function(a){return a===attr;})){var _451=_41d.parse(_43b.getValue(item,_44f));if((attr==_443||attr==_444)&&(isNaN(_451)||Math.abs(_451)>181)){_451=parseFloat(_43b.getValue(item,_44f));if(isNaN(_451)){_44d[attr]=null;}else{_44d[attr]=_451;}}else{if(isNaN(_451)){_44d[attr]=null;}else{_44d[attr]=_451;}}}else{_44d[attr]=_43b.getValue(item,_44f);}}}});_44d[_441]=_43f;_43f++;var _452=_44d[_443];var _453=_44d[_444];if(_453==null||_452==null||isNaN(_452)||isNaN(_453)){continue;}var _454=new _423(_453,_452,new _422({wkid:4326}));var _455={"geometry":_454.toJson(),"attributes":_44d};_440.featureSet.features.push(_455);}_440.layerDefinition.name="csv";if(_437){_437(_440);}},onError:function(_456){console.error("Error fetching items from CSV store: ",_456);}});return true;};function _457(_458,_459,inSR,_45a,_45b,_45c){if(_458.length===0){_45b(null);}var _45d=_424.getGeometryType(_459);var _45e=[];_41b.forEach(_458,function(_45f){var _460=new _45d(_45f);_460.spatialReference=inSR;_45e.push(_460);},this);var _461=[102113,102100,3857];if(inSR.wkid&&inSR.wkid===4326&&_45a.wkid&&_41b.indexOf(_461,_45a.wkid)>-1){_41b.forEach(_45e,function(_462){if(_462.xmin){_462.xmin=Math.max(_462.xmin,-180);_462.xmax=Math.min(_462.xmax,180);_462.ymin=Math.max(_462.ymin,-89.99);_462.ymax=Math.min(_462.ymax,89.99);}else{if(_462.rings){_41b.forEach(_462.rings,function(ring){_41b.forEach(ring,function(_463){_463[0]=Math.min(Math.max(_463[0],-180),180);_463[1]=Math.min(Math.max(_463[1],-89.99),89.99);},this);},this);}else{if(_462.paths){_41b.forEach(_462.paths,function(path){_41b.forEach(path,function(_464){_464[0]=Math.min(Math.max(_464[0],-180),180);_464[1]=Math.min(Math.max(_464[1],-89.99),89.99);},this);},this);}else{if(_462.x){_462.x=Math.min(Math.max(_462.x,-180),180);_462.y=Math.min(Math.max(_462.y,-89.99),89.99);}}}}},this);_458=[];_41b.forEach(_45e,function(_465){var _466=_425.geographicToWebMercator(_465);if(_45a.wkid!==102100){_466.spatialReference=_45a;}_458.push(_466.toJson());},this);_45b(_458);}else{if(inSR.wkid!==null&&_41b.indexOf(_461,inSR.wkid)>-1&&_45a.wkid!==null&&_45a.wkid===4326){_458=[];_41b.forEach(_45e,function(_467){_458.push(_425.webMercatorToGeographic(_467).toJson());},this);_45b(_458);}else{var _468=function(_469,args){if(_469&&_469.length===_458.length){_458=[];_41b.forEach(_469,function(_46a){if(_46a&&((_46a.rings&&_46a.rings.length>0&&_46a.rings[0].length>0&&_46a.rings[0][0].length>0&&!isNaN(_46a.rings[0][0][0])&&!isNaN(_46a.rings[0][0][1]))||(_46a.paths&&_46a.paths.length>0&&_46a.paths[0].length>0&&_46a.paths[0][0].length>0&&!isNaN(_46a.paths[0][0][0])&&!isNaN(_46a.paths[0][0][1]))||(_46a.xmin&&!isNaN(_46a.xmin)&&_46a.ymin&&!isNaN(_46a.ymin))||(_46a.x&&!isNaN(_46a.x)&&_46a.y&&!isNaN(_46a.y)))){_458.push(_46a.toJson());}else{_458.push(null);}},this);_45b(_458);}else{_45c(_469,args);}};if(_420.defaults.geometryService){_420.defaults.geometryService.project(_45e,_45a,lang.hitch(this,_468),_45c);}else{_45b(null);}}}};function _46b(sp1,sp2){var _46c=[102113,102100,3857];if(sp1&&sp2&&sp1.wkid===sp2.wkid&&sp1.wkt===sp2.wkt){return true;}else{if(sp1&&sp2&&sp1.wkid&&sp2.wkid&&_41b.indexOf(_46c,sp1.wkid)>-1&&_41b.indexOf(_46c,sp2.wkid)>-1){return true;}}return false;};function _46d(_46e,_46f,_470,_471){if(!_46e.featureSet||_46e.featureSet.length===0){return;}if(_46b(_470,_46f)){_471(_46e);return;}var _472=function(_473){var _474=[];_41b.forEach(_46e.featureSet.features,function(_475,i){if(_473[i]){_475.geometry=_473[i];_474.push(_475);}},this);_471(_46e);};var _476=function(_477,args){console.error("error projecting featureSet ("+_46e.layerDefinition.name+"). Final try.");_471(_46e);};var _478=function(_479,args){console.error("error projecting featureSet ("+_46e.layerDefinition.name+"). Try one more time.");_457(_47a,_46e.featureSet.geometryType,_46f,_470,lang.hitch(this,_472),lang.hitch(this,_476));};if(_46e.featureSet.features&&_46e.featureSet.features.length>0){var _47a=[];_41b.forEach(_46e.featureSet.features,function(_47b){_47a.push(_47b.geometry);});_457(_47a,_46e.featureSet.geometryType,_46f,_470,lang.hitch(this,_472),lang.hitch(this,_478));}else{_471(_46e);}};function _47c(_47d){var _47e=new _41c();var _47f=function(_480){_47e.callback(_480);};var _481=_421({url:_47d.url,handleAs:"text",load:function(_482){_435(_482,_47d,lang.hitch(this,_47f));},error:function(_483){console.error("error: "+_483);}},{usePost:false});return _47e;};function _484(_485,_486){var _487=new _41c();var _488=function(_489){_487.callback(_489);};_46d(_485,new _422({wkid:4326}),_486,lang.hitch(this,_488));return _487;};function _48a(_48b){var _48c=_48b.layerDefinition.fields;var _48d={"esriFieldTypeDouble":1,"esriFieldTypeSingle":1};var _48e={"esriFieldTypeInteger":1,"esriFieldTypeSmallInteger":1};var dt={"esriFieldTypeDate":1};var _48f=null;var _490=_41b.map(_48c,lang.hitch(this,function(item){if(item.name.toUpperCase()==="NAME"){_48f=item.name;}var _491=(item.type!=="esriFieldTypeOID"&&item.type!=="esriFieldTypeGlobalID"&&item.type!=="esriFieldTypeGeometry");var _492=null;if(_491){var f=item.name.toLowerCase();var _493=",stretched value,fnode_,tnode_,lpoly_,rpoly_,poly_,subclass,subclass_,rings_ok,rings_nok,";if(_493.indexOf(","+f+",")>-1||f.indexOf("area")>-1||f.indexOf("length")>-1||f.indexOf("shape")>-1||f.indexOf("perimeter")>-1||f.indexOf("objectid")>-1||f.indexOf("_")===f.length-1||(f.indexOf("_i")===f.length-2&&f.length>1)){_491=false;}if(item.type in _48e){_492={places:0,digitSeparator:true};}else{if(item.type in _48d){_492={places:2,digitSeparator:true};}else{if(item.type in dt){_492={dateFormat:"shortDateShortTime"};}}}}return lang.mixin({},{fieldName:item.name,label:item.alias,isEditable:true,tooltip:"",visible:_491,format:_492,stringFieldOption:"textbox"});}));var _494={title:_48f?"{"+_48f+"}":"",fieldInfos:_490,description:null,showAttachments:false,mediaInfos:[]};return _494;};var csv={latFieldStrings:_426,longFieldStrings:_427,buildCSVFeatureCollection:_47c,projectFeatureCollection:_484,generateDefaultPopupInfo:_48a,_getSeparator:_428,_isValidDate:_42f,_processCsvData:_435,_projectGeometries:_457,_sameSpatialReference:_46b,_projectFeatureSet:_46d};if(has("extend-esri")){lang.setObject("arcgis.csv",csv,_41f);}return csv;});},"dojo/data/util/filter":function(){define(["../../_base/lang"],function(lang){var _495={};lang.setObject("dojo.data.util.filter",_495);_495.patternToRegExp=function(_496,_497){var rxp="^";var c=null;for(var i=0;i<_496.length;i++){c=_496.charAt(i);switch(c){case "\\":rxp+=c;i++;rxp+=_496.charAt(i);break;case "*":rxp+=".*";break;case "?":rxp+=".";break;case "$":case "^":case "/":case "+":case ".":case "|":case "(":case ")":case "{":case "}":case "[":case "]":rxp+="\\";default:rxp+=c;}}rxp+="$";if(_497){return new RegExp(rxp,"mi");}else{return new RegExp(rxp,"m");}};return _495;});},"esri/layers/WMSLayerInfo":function(){define(["dojo/_base/declare","dojo/_base/lang","dojo/_base/array","dojo/has","esri/kernel"],function(_498,lang,_499,has,_49a){var _49b=_498(null,{declaredClass:"esri.layers.WMSLayerInfo",name:null,title:null,description:null,extent:null,legendURL:null,subLayers:[],allExtents:[],spatialReferences:[],constructor:function(_49c){if(_49c){this.name=_49c.name;this.title=_49c.title;this.description=_49c.description;this.extent=_49c.extent;this.legendURL=_49c.legendURL;this.subLayers=_49c.subLayers?_49c.subLayers:[];this.allExtents=_49c.allExtents?_49c.allExtents:[];this.spatialReferences=_49c.spatialReferences?_49c.spatialReferences:[];}},clone:function(){var info={name:this.name,title:this.title,description:this.description,legendURL:this.legendURL},wkid;if(this.extent){info.extent=this.extent.getExtent();}info.subLayers=[];_499.forEach(this.subLayers,function(_49d){info.subLayers.push(_49d.clone());});info.allExtents=[];for(wkid in this.allExtents){wkid=parseInt(wkid,10);if(!isNaN(wkid)){info.allExtents[wkid]=this.allExtents[wkid].getExtent();}}info.spatialReferences=[];_499.forEach(this.spatialReferences,function(wkid){info.spatialReferences.push(wkid);});return info;}});if(has("extend-esri")){lang.setObject("layers.WMSLayerInfo",_49b,_49a);}return _49b;});},"esri/layers/FeatureType":function(){define(["dojo/_base/declare","dojo/_base/lang","dojo/_base/array","dojo/has","esri/kernel","esri/lang","esri/symbols/jsonUtils","esri/layers/RangeDomain","esri/layers/CodedValueDomain","esri/layers/InheritedDomain","esri/layers/FeatureTemplate"],function(_49e,lang,_49f,has,_4a0,_4a1,_4a2,_4a3,_4a4,_4a5,_4a6){var _4a7=_49e(null,{declaredClass:"esri.layers.FeatureType",constructor:function(json){if(json&&lang.isObject(json)){this.id=json.id;this.name=json.name;var _4a8=json.symbol;if(_4a8){this.symbol=_4a2.fromJson(_4a8);}var _4a9=json.domains,_4aa,i;var _4ab=this.domains={};for(_4aa in _4a9){if(_4a9.hasOwnProperty(_4aa)){var _4ac=_4a9[_4aa];switch(_4ac.type){case "range":_4ab[_4aa]=new _4a3(_4ac);break;case "codedValue":_4ab[_4aa]=new _4a4(_4ac);break;case "inherited":_4ab[_4aa]=new _4a5(_4ac);break;}}}var _4ad=json.templates;if(_4ad){var _4ae=this.templates=[];for(i=0;i<_4ad.length;i++){_4ae.push(new _4a6(_4ad[i]));}}}},toJson:function(){var json={id:this.id,name:this.name,symbol:this.symbol&&this.symbol.toJson()};var _4af,_4b0=this.domains,_4b1=this.templates,_4b2=_4a1.fixJson;if(_4b0){var _4b3=json.domains={};for(_4af in _4b0){if(_4b0.hasOwnProperty(_4af)){_4b3[_4af]=_4b0[_4af]&&_4b0[_4af].toJson();}}_4b2(_4b3);}if(_4b1){json.templates=_49f.map(_4b1,function(_4b4){return _4b4.toJson();});}return _4b2(json);}});if(has("extend-esri")){lang.setObject("layers.FeatureType",_4a7,_4a0);}return _4a7;});},"esri/layers/RenderMode":function(){define(["dojo/_base/kernel","dojo/_base/declare","dojo/_base/lang","dojo/_base/array","dojo/has","dojo/io/script","esri/kernel"],function(_4b5,_4b6,lang,_4b7,has,_4b8,_4b9){var _4ba=_4b6(null,{declaredClass:"esri.layers._RenderMode",constructor:function(){this._prefix="jsonp_"+(_4b5._scopeName||"dojo")+"IoScript";},initialize:function(map){this.map=map;this._init=true;},startup:function(){},propertyChangeHandler:function(type){},destroy:function(){this._init=false;},drawFeature:function(_4bb){},suspend:function(){},resume:function(){},refresh:function(){},_incRefCount:function(oid){var _4bc=this._featureMap[oid];if(_4bc){_4bc._count++;}},_decRefCount:function(oid){var _4bd=this._featureMap[oid];if(_4bd){_4bd._count--;}},_getFeature:function(oid){return this._featureMap[oid];},_addFeatureIIf:function(oid,_4be){var fmap=this._featureMap,_4bf=fmap[oid],_4c0=this.featureLayer;if(!_4bf){fmap[oid]=_4be;_4c0._add(_4be);_4be._count=0;}return _4bf||_4be;},_removeFeatureIIf:function(oid){var _4c1=this._featureMap[oid],_4c2=this.featureLayer;if(_4c1){if(_4c1._count){return;}delete this._featureMap[oid];_4c2._remove(_4c1);}return _4c1;},_clearIIf:function(){var i,_4c3=this.featureLayer,_4c4=_4c3.graphics,_4c5=_4c3._selectedFeatures,_4c6=_4c3.objectIdField;for(i=_4c4.length-1;i>=0;i--){var _4c7=_4c4[i];var oid=_4c7.attributes[_4c6];if(oid in _4c5){_4c7._count=1;continue;}_4c7._count=0;this._removeFeatureIIf(oid);}},_isPending:function(id){var dfd=_4b8[this._prefix+id];return dfd?true:false;},_cancelPendingRequest:function(dfd,id){dfd=dfd||_4b8[this._prefix+id];if(dfd){try{dfd.cancel();_4b8._validCheck(dfd);}catch(e){}}},_purgeRequests:function(){_4b8._validCheck(null);},_toggleVisibility:function(show){var _4c8=this.featureLayer,_4c9=_4c8.graphics,_4ca=show?"show":"hide",i,len=_4c9.length;show=show&&_4c8._ager;for(i=0;i<len;i++){var _4cb=_4c9[i];_4cb[_4ca]();if(show){_4c8._repaint(_4cb);}}},_applyTimeFilter:function(_4cc){var _4cd=this.featureLayer;if(!_4cd.timeInfo||_4cd.suspended){return;}if(!_4cc){_4cd._fireUpdateStart();}var _4ce=_4cd._trackManager;if(_4ce){_4ce.clearTracks();}var defn=_4cd.getTimeDefinition(),_4cf=_4cd._getOffsettedTE(_4cd._mapTimeExtent);if(_4cf){_4cf=_4cd._getTimeOverlap(defn,_4cf);if(_4cf){var _4d0=_4cd._filterByTime(_4cd.graphics,_4cf.startTime,_4cf.endTime);if(_4ce){_4ce.addFeatures(_4d0.match);}_4b7.forEach(_4d0.match,function(_4d1){var _4d2=_4d1._shape;if(!_4d1.visible){_4d1.show();_4d2=_4d1._shape;_4d2&&_4d2._moveToFront();}if(_4cd._ager&&_4d2){_4cd._repaint(_4d1);}});_4b7.forEach(_4d0.noMatch,function(_4d3){if(_4d3.visible){_4d3.hide();}});}else{this._toggleVisibility(false);}}else{if(_4ce){_4ce.addFeatures(_4cd.graphics);}this._toggleVisibility(true);}if(_4ce){_4ce.moveLatestToFront();_4ce.drawTracks();}if(!_4cc){_4cd._fireUpdateEnd();}}});if(has("extend-esri")){lang.setObject("layers._RenderMode",_4ba,_4b9);}return _4ba;});},"esri/layers/GeoRSSLayer":function(){define(["dojo/_base/declare","dojo/_base/lang","dojo/_base/json","dojo/has","esri/kernel","esri/config","esri/request","esri/layers/ServiceGeneratedFeatureCollection"],function(_4d4,lang,_4d5,has,_4d6,_4d7,_4d8,_4d9){var _4da=_4d4([_4d9],{declaredClass:"esri.layers.GeoRSSLayer",serviceUrl:location.protocol+"//utility.arcgis.com/sharing/rss",constructor:function(url,_4db){if(_4d7.defaults.geoRSSService){this.serviceUrl=_4d7.defaults.geoRSSService;}this._createLayer();},parse:function(){this._io=_4d8({url:this.serviceUrl,content:{url:this.url,refresh:this.loaded?true:undefined,outSR:this._outSR?_4d5.toJson(this._outSR.toJson()):undefined},callbackParamName:"callback"});return this._io;},_initLayer:function(json){this.inherited(arguments);if(!this.loaded){this.loaded=true;this.onLoad(this);}}});if(has("extend-esri")){lang.setObject("layers.GeoRSSLayer",_4da,_4d6);}return _4da;});},"esri/layers/FeatureTemplate":function(){define(["dojo/_base/declare","dojo/_base/lang","dojo/has","esri/kernel","esri/lang","esri/graphic"],function(_4dc,lang,has,_4dd,_4de,_4df){var _4e0=_4dc(null,{declaredClass:"esri.layers.FeatureTemplate",constructor:function(json){if(json&&lang.isObject(json)){this.name=json.name;this.description=json.description;this.drawingTool=json.drawingTool;var _4e1=json.prototype;this.prototype=new _4df(_4e1.geometry,null,_4e1.attributes);}},toJson:function(){return _4de.fixJson({name:this.name,description:this.description,drawingTool:this.drawingTool,prototype:this.prototype&&this.prototype.toJson()});}});lang.mixin(_4e0,{TOOL_AUTO_COMPLETE_POLYGON:"esriFeatureEditToolAutoCompletePolygon",TOOL_CIRCLE:"esriFeatureEditToolCircle",TOOL_ELLIPSE:"esriFeatureEditToolEllipse",TOOL_FREEHAND:"esriFeatureEditToolFreehand",TOOL_LINE:"esriFeatureEditToolLine",TOOL_NONE:"esriFeatureEditToolNone",TOOL_POINT:"esriFeatureEditToolPoint",TOOL_POLYGON:"esriFeatureEditToolPolygon",TOOL_RECTANGLE:"esriFeatureEditToolRectangle",TOOL_ARROW:"esriFeatureEditToolArrow",TOOL_TRIANGLE:"esriFeatureEditToolTriangle",TOOL_LEFT_ARROW:"esriFeatureEditToolLeftArrow",TOOL_RIGHT_ARROW:"esriFeatureEditToolRightArrow",TOOL_UP_ARROW:"esriFeatureEditToolUpArrow",TOOL_DOWN_ARROW:"esriFeatureEditToolDownArrow"});if(has("extend-esri")){lang.setObject("layers.FeatureTemplate",_4e0,_4dd);}return _4e0;});},"*noref":1}});define("esri/arcgis/utils",["dojo/_base/lang","dojo/_base/array","dojo/_base/connect","dojo/_base/Deferred","dojo/_base/json","dojo/_base/url","dojo/has","dojo/DeferredList","dojo/dom-construct","esri/kernel","esri/config","esri/lang","esri/request","esri/SpatialReference","esri/map","esri/urlUtils","esri/geometry/ScreenPoint","esri/geometry/Extent","esri/geometry/webMercatorUtils","esri/symbols/jsonUtils","esri/renderers/jsonUtils","esri/dijit/PopupTemplate","esri/dijit/Popup","esri/tasks/query","esri/tasks/GeometryService","esri/arcgis/csv","esri/layers/ArcGISTiledMapServiceLayer","esri/layers/ArcGISDynamicMapServiceLayer","esri/layers/ArcGISImageServiceLayer","esri/layers/OpenStreetMapLayer","esri/layers/WebTiledLayer","esri/layers/FeatureLayer","esri/layers/WMSLayer","esri/layers/KMLLayer","esri/layers/GeoRSSLayer","esri/virtualearth/VETiledLayer","esri/layers/TileInfo","esri/layers/DynamicLayerInfo","esri/layers/LayerDrawingOptions","esri/layers/ImageParameters","esri/layers/ImageServiceParameters","esri/layers/RasterFunction","esri/layers/MosaicRule","esri/layers/WMSLayerInfo","dojo/i18n!esri/nls/jsapi"],function(lang,_4e2,_4e3,_4e4,_4e5,Url,has,_4e6,_4e7,_4e8,_4e9,_4ea,_4eb,_4ec,Map,_4ed,_4ee,_4ef,_4f0,_4f1,_4f2,_4f3,_4f4,_4f5,_4f6,csv,_4f7,_4f8,_4f9,_4fa,_4fb,_4fc,_4fd,_4fe,_4ff,_500,_501,_502,_503,_504,_505,_506,_507,_508,_509){String.prototype.endsWith=function(str){return (this.match(str+"$")==str);};var _50a;function _50b(_50c){var url=_50a.arcgisUrl+"/"+_50c.itemId+"/data";var _50d=_4eb({url:url,content:{f:"json"},callbackParamName:"callback"},{disableIdentityLookup:true,_preLookup:true});return _50d;};function _50e(_50f){var _510={f:"json"};if(_4e8.id){var _511=_4e8.id.findCredential(_4ed.urlToObject(_50a.arcgisUrl).path);if(_511){_510.token=_511.token;}}var _512=_4eb({url:_50f,content:_510,callbackParamName:"callback"},{"disableIdentityLookup":true});return _512;};function _513(_514){if(_514.itemProperties.layerDefinition){if(_514.layerDefinition){if(!_514.layerDefinition.drawingInfo){_514.layerDefinition.drawingInfo=_514.itemProperties.layerDefinition.drawingInfo;}if(!_4ea.isDefined(_514.layerDefinition.definitionExpression)){_514.layerDefinition.definitionExpression=_514.itemProperties.layerDefinition.definitionExpression;}if(!_4ea.isDefined(_514.layerDefinition.minScale)){_514.layerDefinition.minScale=_514.itemProperties.layerDefinition.minScale;}if(!_4ea.isDefined(_514.layerDefinition.maxScale)){_514.layerDefinition.maxScale=_514.itemProperties.layerDefinition.maxScale;}}else{_514.layerDefinition=_514.itemProperties.layerDefinition;}}if(_514.itemProperties.popupInfo&&!_514.popupInfo&&!_514.disablePopup){_514.popupInfo=_514.itemProperties.popupInfo;}};function _515(_516,_517){var _518=new _4e4();var _519=_516.itemData;var _51a=[];var _51b=[];_4e2.forEach(_519.operationalLayers,function(_51c){if(_51c.itemId&&!_51c.type){var _51d=_51c.url.toLowerCase();if(_51d.indexOf("/featureserver")>-1){_51b.push(_51c);_51a.push(_50b(_51c));}else{if(_51d.indexOf("/mapserver")>-1&&_51d.indexOf("/mapserver/")===-1&&(!_51c.layers||(!_4ea.isDefined(_51c.minScale)&&!_4ea.isDefined(_51c.maxScale)))){_51b.push(_51c);_51a.push(_50b(_51c));}else{if(_51d.indexOf("/imageserver")>-1&&!_4ea.isDefined(_51c.minScale)&&!_4ea.isDefined(_51c.maxScale)){_51b.push(_51c);_51a.push(_50b(_51c));}}}}});if(_519.baseMap&&_519.baseMap.baseMapLayers){_4e2.forEach(_519.baseMap.baseMapLayers,function(_51e){if((_51e.type==="BingMapsAerial"||_51e.type==="BingMapsRoad"||_51e.type==="BingMapsHybrid")&&_51e.portalUrl){_51b.push(_51e);_51a.push(_50e(_51e.portalUrl));}});}if(_51a.length>0){var _51f=new _4e6(_51a);_51f.addCallback(function(_520){_4e2.forEach(_51b,function(_521,i){if((_521.type==="BingMapsAerial"||_521.type==="BingMapsRoad"||_521.type==="BingMapsHybrid")&&_521.portalUrl){if(_520[i][1].bingKey){_517.bingMapsKey=_520[i][1].bingKey;}else{_521.errors=_521.errors||[];var _522={message:"The owner of the map has not provided a Bing Key for the Bing Map it includes. [type:"+_521.type+"]"};_521.errors.push(_522);}return;}var _523=_520[i][1];if(_523){var _524=_521.url.toLowerCase();if(_524.indexOf("/featureserver")>-1&&_523.layers){_4e2.forEach(_523.layers,function(_525){if(_524.endsWith("/featureserver/"+_525.id)){_521.itemProperties=_525;_513(_521);}});}else{if(_524.indexOf("/mapserver")>-1){if(_523.layers&&!_521.layers){_521.layers=_523.layers;}if(_4ea.isDefined(_523.minScale)&&!_4ea.isDefined(_521.minScale)){_521.minScale=_523.minScale;}if(_4ea.isDefined(_523.maxScale)&&!_4ea.isDefined(_521.maxScale)){_521.maxScale=_523.maxScale;}}else{if(_524.indexOf("/imageserver")>-1){if(_4ea.isDefined(_523.minScale)&&!_4ea.isDefined(_521.minScale)){_521.minScale=_523.minScale;}if(_4ea.isDefined(_523.maxScale)&&!_4ea.isDefined(_521.maxScale)){_521.maxScale=_523.maxScale;}}}}}});_518.callback(_516);});}else{_518.callback(_516);}return _518;};function _526(_527,_528){var _529=_527.dynamicLayerInfos||_527.layerInfos;var _52a=_528.layers;if(_52a&&_529){var _52b=[],ids=[],urls=[];_4e2.forEach(_529,function(_52c){var id=_52c.id,i;if(!_52c.subLayerIds&&_4e2.indexOf(_527.visibleLayers,id)!==-1){for(i=0;i<_52a.length;i++){var _52d=_52a[i];if(_52d.id===id){ids.push(id);_52b.push(_52d.popupInfo);urls.push(_52d.layerUrl||"");break;}}}});if(_52b.length){_527.__popups=_52b;_527.__popupIds=ids;_527.__popupUrls=urls;_527.__resourceInfo=_528.resourceInfo;}}};function _52e(url){if(!url){return false;}var _52f=".arcgis.com/";var _530=(new Url(_50a.arcgisUrl)).authority;return (url.indexOf(_52f)!==-1||url.indexOf(_530)!==-1);};function _531(url){if(!url){return false;}return (url.indexOf("/services.arcgisonline.com/")!==-1||url.indexOf("/server.arcgisonline.com/")!==-1);};function _532(url){if(location.protocol==="https:"&&(_52e(url)||_531(url))){url=url.replace("http:","https:");}return url;};function _533(_534){var _535=[];if(!_534.displayLevels){_535=_4e2.map(_534.resourceInfo.tileInfo.lods,function(lod){return lod.level;});}var _536=new _4f7(_532(_534.url),{resourceInfo:_534.resourceInfo,opacity:_534.opacity,visible:_534.visibility,displayLevels:_534.displayLevels||_535,id:_534.id,minScale:_534.minScale,maxScale:_534.maxScale});_526(_536,_534);return _536;};function _537(_538,_539){if(!_538||!_539||_539.length===0){return [];}var _53a=","+_539+",";var _53b=[];var _53c="";var k,_53d=",";for(k=0;k<_538.length;k++){if(_538[k].subLayerIds!==null){if(_53a.indexOf(","+_538[k].id+",")===-1||_53d.indexOf(","+_538[k].id+",")>-1){_53d+=_538[k].subLayerIds.toString()+",";}}else{if(_53a.indexOf(","+_538[k].id+",")>-1&&_53d.indexOf(","+_538[k].id+",")===-1){_53b.push(_538[k].id);_53c=",";}}}return _53b;};function _53e(_53f){var _540=new _504();_540.format="png24";if(_53f.resourceInfo&&_53f.resourceInfo.supportedImageFormatTypes&&_53f.resourceInfo.supportedImageFormatTypes.indexOf("PNG32")>-1){_540.format="png32";}var _541=new _4f8(_532(_53f.url),{resourceInfo:_53f.resourceInfo,opacity:_53f.opacity,visible:_53f.visibility,id:_53f.id,imageParameters:_540,minScale:_53f.minScale,maxScale:_53f.maxScale});var _542=_53f.visibleLayers;if(!_53f.visibleLayers){var _543="";var _544=_541.layerInfos;_4e2.forEach(_544,function(_545){if(_545.defaultVisibility){_543+=(_543.length>0?",":"")+_545.id;}});_542=_543;}_542=_537(_541.layerInfos,_542);_541.setVisibleLayers(_542);if(_53f.layers&&_53f.layers.length>0){var _546=[],_547=[],_548,_549=[],_54a;_4e2.forEach(_53f.layers,function(_54b){if(_54b.layerDefinition&&_54b.layerDefinition.definitionExpression){_546[_54b.id]=_54b.layerDefinition.definitionExpression;}if(_54b.layerDefinition&&_54b.layerDefinition.source){_548=new _502(lang.mixin(_54b,_54b.layerDefinition));delete _548.layerDefinition;_548.id=_54b.id;if(_53f.visibleLayers){if(_4e2.indexOf(_53f.visibleLayers,_54b.id)>-1){_548.defaultVisibility=true;}else{_548.defaultVisibility=false;}}_547.push(_548);}if(_54b.layerDefinition&&_54b.layerDefinition.source&&_54b.layerDefinition.drawingInfo){_54a=new _503(_54b.layerDefinition.drawingInfo);_549[_54b.id]=_54a;}},this);if(_546.length>0){_541.setLayerDefinitions(_546);}if(_547.length>0){_541.setDynamicLayerInfos(_547,true);if(_549.length>0){_541.setLayerDrawingOptions(_549,true);}}}_526(_541,_53f);return _541;};function _54c(_54d,_54e){var _54f=[102113,102100,3857];var sp1=new _4ec(_54e[0].layerObject.fullExtent.spatialReference);var sp2=new _4ec(_54d.resourceInfo.fullExtent.spatialReference);if(sp1.wkt==sp2.wkt&&(sp1.wkid==sp2.wkid||(esri.isDefined(sp1.latestWkid)&&sp1.latestWkid==sp2.wkid)||(esri.isDefined(sp2.latestWkid)&&sp1.wkid==sp2.latestWkid)||(esri.isDefined(sp1.latestWkid)&&sp1.latestWkid==sp2.latestWkid))){return true;}else{if(sp1.wkid&&sp2.wkid&&_4e2.some(_54f,function(wkid){return wkid===sp2.wkid;})&&_4e2.some(_54f,function(wkid){return wkid===sp1.wkid;})){return true;}}return false;};function _550(_551,_552){if(!_552[0].layerObject.tileInfo){return false;}var _553=[];_4e2.forEach(_552,function(_554){if(_554.baseMapLayer){if(_554.layerObject.tileInfo){_553=_553.concat(_4e2.map(_554.layerObject.tileInfo.lods,function(lod){return lod.scale;}));}}});var _555=_4e2.some(_551.resourceInfo.tileInfo.lods,function(lod){return _4e2.some(_553,function(_556){return _556===lod.scale;});});return _555;};function _557(_558,_559,_55a,_55b){var _55c,_55d=_55a._clazz;if(_558.type==="OpenStreetMap"){_55c=new _4fa({id:_558.id,opacity:_558.opacity,visible:(_558.visibility!==null&&_558.visibility!==undefined)?_558.visibility:true});}else{if(_558.type==="WMS"){var _55e=[];var _55f=[];_4e2.forEach(_558.layers,function(_560){_55f.push(new _508({name:_560.name,title:_560.title,legendURL:_560.legendURL}));_55e.push(_560.name);},this);if(_558.visibleLayers){_55e=_558.visibleLayers;}var _561=new _4ef(_558.extent[0][0],_558.extent[0][1],_558.extent[1][0],_558.extent[1][1],new _4ec({wkid:4326}));var _562={extent:_561,layerInfos:_55f,version:_558.version,maxWidth:_558.maxWidth,maxHeight:_558.maxHeight,getMapUrl:_558.mapUrl,spatialReferences:_558.spatialReferences,title:_558.title,copyright:_558.copyright};_55c=new _4fd(_558.url,{id:_558.id,visibleLayers:_55e,format:"png",transparent:_558.baseMapLayer?false:true,opacity:_558.opacity,visible:(_558.visibility!==null)?_558.visibility:true,resourceInfo:_562});_55c.spatialReference.wkid=_562.spatialReferences[0];}else{if(_558.type==="KML"){_55c=new _4fe(_558.url,{id:_558.id,visible:(_558.visibility!==null)?_558.visibility:true,outSR:_55b});_4e3.connect(_55c,"onLoad",function(){var _563=function(_564){_4e2.forEach(_564,function(_565){if(_565.declaredClass==="esri.layers.FeatureLayer"||_565.declaredClass==="esri.layers.MapImageLayer"){_565.setOpacity(_558.opacity);}else{if(_565.declaredClass==="esri.layers.KMLLayer"){if(_565.loaded){_563(_565.getLayers());}else{_4e3.connect(_565,"onLoad",lang.hitch(this,function(lyr){_563(lyr.getLayers());}));}}}});};if(_558.opacity||_558.opacity===0){_563(_55c.getLayers());}if(_558.visibleFolders){_4e2.forEach(_55c.folders,function(_566){if(_4e2.indexOf(_558.visibleFolders,_566.id)>-1){_55c.setFolderVisibility(_566,true);}else{_55c.setFolderVisibility(_566,false);}},this);}});}else{if(_558.type==="WebTiledLayer"){_55c=new _4fb(_558.templateUrl,{id:_558.id,visible:(_558.visibility!==null)?_558.visibility:true,opacity:_558.opacity,copyright:_558.copyright,fullExtent:_558.fullExtent&&new _4ef(_558.fullExtent),initialExtent:_558.fullExtent&&new _4ef(_558.fullExtent),subDomains:_558.subDomains,tileInfo:_558.tileInfo?new _501(_558.tileInfo):null});_4e3.connect(_55c,"onLoad",function(){if(_4ea.isDefined(_558.minScale)||_4ea.isDefined(_558.maxScale)){_55c.setScaleRange(_558.minScale,_558.maxScale);}});}else{if(_558.type==="GeoRSS"){_55c=new _4ff(_558.url,{id:_558.id,visible:(_558.visibility!==null)?_558.visibility:true,opacity:_558.opacity,outSpatialReference:_55b});_4e3.connect(_55c,"onLoad",function(){var _567=_55c.getFeatureLayers();_4e2.forEach(_567,function(_568){if(_558.pointSymbol&&_568.geometryType==="esriGeometryPoint"){_568.renderer.symbol=_4f1.fromJson(_558.pointSymbol);}else{if(_558.lineSymbol&&_568.geometryType==="esriGeometryPolyline"){_568.renderer.symbol=_4f1.fromJson(_558.lineSymbol);}else{if(_558.polygonSymbol&&_568.geometryType==="esriGeometryPolygon"){_568.renderer.symbol=_4f1.fromJson(_558.polygonSymbol);}}}if(_4ea.isDefined(_558.minScale)||_4ea.isDefined(_558.maxScale)){_568.setScaleRange(_558.minScale,_558.maxScale);}});});}else{if(_558.type=="CSV"&&_558.url){_55c=new _4fc(_558.featureCollection,{infoTemplate:new _4f3(_558.popupInfo?_558.popupInfo:csv.generateDefaultPopupInfo(_558.featureCollection)),id:_558.id?_558.id:null,outFields:["*"],visible:(_558.visibility!==null)?_558.visibility:true,opacity:_558.opacity,autoGeneralize:true});}else{if(_558.layerDefinition&&!_558.url){var _569=_4e5.fromJson(_4e5.toJson(_558));delete _569.id;delete _569.opacity;delete _569.visibility;_55c=new _4fc(_569,{id:_558.id,opacity:_558.opacity,visible:_558.visibility,outFields:["*"],infoTemplate:_569.popupInfo&&new _55d(_569.popupInfo),autoGeneralize:true});}else{if(_558.type==="BingMapsAerial"||_558.type==="BingMapsRoad"||_558.type==="BingMapsHybrid"){if(_55a.bingMapsKey){var _56a=_500.MAP_STYLE_AERIAL_WITH_LABELS;if(_558.type==="BingMapsAerial"){_56a=_500.MAP_STYLE_AERIAL;}else{if(_558.type==="BingMapsRoad"){_56a=_500.MAP_STYLE_ROAD;}}_55c=new _500({bingMapsKey:_55a.bingMapsKey,mapStyle:_56a,opacity:_558.opacity,id:_558.id});}}else{if(_558.resourceInfo&&_558.resourceInfo.mapName){if(_558.resourceInfo.singleFusedMapCache===true){if(!_558.baseMapLayer){if(_54c(_558,_559)){if(_550(_558,_559)){_55c=_533(_558);}else{_55c=_53e(_558);}}else{_55c=_53e(_558);}}else{_55c=_533(_558);}}else{_55c=_53e(_558);}}else{if(_558.resourceInfo&&_558.resourceInfo.pixelSizeX){var _56b=new _505();_56b.bandIds=_558.bandIds;if(_558.format!=null){_56b.format=_558.format;if(_558.compressionQuality!=null){_56b.compressionQuality=_558.compressionQuality;}}if(_558.renderingRule&&_558.renderingRule.rasterFunction){var _56c=new _506(_558.renderingRule);_56b.renderingRule=_56c;}if(_558.mosaicRule){var _56d=new _507(_558.mosaicRule);_56b.mosaicRule=_56d;}if(_4ea.isDefined(_558.noData)){_56b.noData=_558.noData;}if(_4ea.isDefined(_558.noDataInterpretation)){_56b.noDataInterpretation=_558.noDataInterpretation;}if(_4ea.isDefined(_558.interpolation)){_56b.interpolation=_558.interpolation;}_55c=new _4f9(_532(_558.url),{resourceInfo:_558.resourceInfo,opacity:_558.opacity,visible:_558.visibility,id:_558.id,imageServiceParameters:_56b,infoTemplate:_558.popupInfo&&new _55d(_558.popupInfo),minScale:_558.minScale,maxScale:_558.maxScale});if(_558.layerDefinition&&_558.layerDefinition.definitionExpression){_55c.setDefinitionExpression(_558.layerDefinition.definitionExpression,true);}}else{if(_558.resourceInfo&&_558.resourceInfo.type==="Feature Layer"){_55c=new _4fc(_532(_558.url),{resourceInfo:_558.resourceInfo,opacity:_558.opacity,visible:_558.visibility,id:_558.id,mode:_4ea.isDefined(_558.mode)?_558.mode:_4fc.MODE_ONDEMAND,outFields:["*"],infoTemplate:_558.popupInfo&&new _55d(_558.popupInfo),autoGeneralize:true});if(_558.layerDefinition){if(_558.layerDefinition.drawingInfo&&_558.layerDefinition.drawingInfo.renderer){var _56e=_4f2.fromJson(_558.layerDefinition.drawingInfo.renderer);_56e.isMaxInclusive=true;_55c.setRenderer(_56e);}if(_558.layerDefinition.definitionExpression){_55c.setDefinitionExpression(_558.layerDefinition.definitionExpression);}if(_4ea.isDefined(_558.layerDefinition.minScale)){_55c.setMinScale(_558.layerDefinition.minScale);}if(_4ea.isDefined(_558.layerDefinition.maxScale)){_55c.setMaxScale(_558.layerDefinition.maxScale);}}}}}}}}}}}}}if(_55c){_55c.arcgisProps={title:_558.title};if(_558.baseMapLayer){if(_558.isReference){_55c._basemapGalleryLayerType="reference";}else{_55c._basemapGalleryLayerType="basemap";}}}return _55c;};function _56f(_570,_571,_572){_4e2.forEach(_570,function(_573,_574){if(_573.url&&!_573.type){if(_574===0||_570[0].layerObject){_573.layerObject=_557(_573,_570,_571,_572);}}else{if(_573.url&&_573.type=="CSV"){_573.layerObject=_557(_573,_570,_571,_572);}else{_573.layerObject=_557(_573,_570,_571,_572);}}});var _575=_4e2.filter(_570,function(lyr){return !lyr.isReference;});var _576=_4e2.filter(_570,function(lyr){return !!lyr.isReference;});_570=_575.concat(_576);return _570;};function _577(_578){var _579=null;var _57a=_578[0];if(_57a.url&&!_57a.type){if(_57a.resourceInfo.spatialReference){_579=new _4ec();if(_57a.resourceInfo.spatialReference.wkid){_579.wkid=_57a.resourceInfo.spatialReference.wkid;}if(_57a.resourceInfo.spatialReference.wkt){_579.wkt=_57a.resourceInfo.spatialReference.wkt;}}}else{if(_57a.type.indexOf("BingMaps")>-1||_57a.type=="OpenStreetMap"){_579=new _4ec({wkid:102100});}else{if(_57a.type=="WMS"){_579=new _4ec({wkid:_57a.spatialReferences[0]});}}}return _579;};function _57b(_57c,_57d,_57e,_57f,_580){_4e2.forEach(_57d,function(_581,_582){if(_581.url&&!_581.type){_581.resourceInfo=_57c[_581.deferredsPos][1];delete _581.deferredsPos;}else{if(_581.url&&_581.type=="CSV"){_581.featureCollection=_57f[_581.deferredsPos].results[0];delete _581.deferredsPos;}}});var _583=_577(_57d);var _584=[];var _585=new _4e4();_4e2.forEach(_57d,function(_586){if(_586.url&&_586.type=="CSV"){_586.deferredsPos=_584.length;_584.push(csv.projectFeatureCollection(_586.featureCollection,_583));}});if(_584.length==0){_57d=_56f(_57d,_57e,_583);_580.callback(_57d);}else{var _587=new _4e6(_584);_587.addCallback(function(){_4e2.forEach(_57d,function(_588){if(_588.url&&_588.type=="CSV"){_588.featureCollection=_584[_588.deferredsPos].results[0];delete _588.deferredsPos;}});_57d=_56f(_57d,_57e,_583);_580.callback(_57d);});}};function _589(url,_58a){var url2=_532(url);return _4eb({url:url2,content:{f:"json"},callbackParamName:"callback",error:function(_58b,io){if(_58b.message){_58b.message+=" [url:"+url2+"]";}else{_58b.message="[url:"+url2+"]";}_58a.push(_58b);_4e9.defaults.io.errorHandler(_58b,io);}});};function _58c(_58d,_58e){var _58f=[];var _590=[];var _591=[];var _592=new _4e4();_4e2.forEach(_58d.operationalLayers,function(_593,_594){if(_593.featureCollection){_4e2.forEach(_593.featureCollection.layers,function(_595,idx){var _596=true;if(_593.visibleLayers){if(_4e2.indexOf(_593.visibleLayers,idx)==-1){_596=false;}}_595.visibility=(_593.visibility&&_596);_595.opacity=_593.opacity;_595.id=(_593.id||("operational"+_594))+"_"+idx;_591.push(_595);},this);}else{_591.push(_593);}});_4e2.forEach(_58d.baseMap.baseMapLayers,function(_597,_598){_597.baseMapLayer=true;_597.id=_597.id||("base"+_598);_58f.push(_597);});_4e2.forEach(_591,function(_599,_59a){_599.id=_599.id||("operational"+_59a);_58f.push(_599);});_4e2.forEach(_58f,function(_59b){if(_59b.url&&!_59b.type){_59b.deferredsPos=_590.length;_59b.errors=[];_590.push(_589(_59b.url,_59b.errors));}else{if(_59b.url&&_59b.type=="CSV"){_59b.deferredsPos=_590.length;_590.push(csv.buildCSVFeatureCollection(_59b));}}});if(_590.length==0){var _59c=_577(_58f);_58f=_56f(_58f,_58e,_59c);_592.callback(_58f);}else{var _59d=new _4e6(_590);_59d.addCallback(function(_59e){_57b(_59e,_58f,_58e,_590,_592);});}return _592;};function _59f(_5a0,_5a1){if(_5a1.version<=10.1&&_5a0){var i,id=parseInt(_5a1.url.substring(_5a1.url.lastIndexOf("/")+1,_5a1.url.length));for(i=_5a0.length-1;i>=0;i--){if(_5a0[i].id==id){if(_5a1.minScale==0&&_5a0[i].minScale>0){_5a1.minScale=_5a0[i].minScale;}else{if(_5a1.minScale>0&&_5a0[i].minScale==0){_5a1.minScale=_5a1.minScale;}else{if(_5a1.minScale>0&&_5a0[i].minScale>0){_5a1.minScale=Math.min(_5a1.minScale,_5a0[i].minScale);}}}_5a1.maxScale=Math.max(_5a1.maxScale||0,_5a0[i].maxScale||0);if(_5a0[i].parentLayerId>-1){id=_5a0[i].parentLayerId;}else{break;}}}}};function _5a2(_5a3,_5a4,_5a5,map){var url=_5a3.url;var _5a6=_5a3.__popups;var ids=_5a3.__popupIds;var urls=_5a3.__popupUrls;var _5a7=_5a3.__resourceInfo;var _5a8=[];_4e2.forEach(_5a6,function(_5a9,_5aa){if(!_5a9){return;}var _5ab,_5ac=[];_4e2.forEach(_5a9.fieldInfos,function(item){if(item.fieldName.toLowerCase()!=="shape"){_5ac.push(item.fieldName);}});if(_5a3.dynamicLayerInfos&&_5a3.dynamicLayerInfos.length>0){var _5ad=_4e2.filter(_5a3.dynamicLayerInfos,function(item){return ids[_5aa]==item.id;})[0].source;_5ab=new _4fc(url+"/dynamicLayer",{id:_5a3.id+"_"+ids[_5aa],source:_5ad,outFields:_5ac,mode:_4fc.MODE_SELECTION,infoTemplate:_5a9&&new _5a5(_5a9),drawMode:false,visible:_5a3.visible,autoGeneralize:true});}else{var i,_5ae=null;if(_5a4){for(i=0;i<_5a4.length;i++){if(_5a4[i].id===ids[_5aa]){_5ae=_5a4[i];break;}}}var _5af=url+"/"+ids[_5aa];if(urls[_5aa].length){_5af=urls[_5aa];}_5ab=new _4fc(_532(_5af),{id:_5a3.id+"_"+ids[_5aa],outFields:_5ac,mode:_4fc.MODE_SELECTION,infoTemplate:_5a9&&new _5a5(_5a9),drawMode:false,visible:_5a3.visible,resourceInfo:_5ae,autoGeneralize:true});}if(_5ab.loaded){_5ab.setScaleRange(_5a3.minScale,_5a3.maxScale);}else{_4e3.connect(_5ab,"onLoad",function(_5b0){_5b0.setScaleRange(_5a3.minScale,_5a3.maxScale);});}if(_5ab.loaded){_59f(_5a7.layers,_5ab);}else{_4e3.connect(_5ab,"onLoad",function(_5b1){_59f(_5a7.layers,_5b1);});}_5a8.push(_5ab);});if(_5a8.length>0){var _5b2=function(_5b3,_5b4){_4e2.forEach(_5b3,function(_5b5){if(_5b4){_5b5.show();}else{_5b5.hide();}});};_4e3.connect(_5a3,"onVisibilityChange",lang.hitch(this,_5b2,_5a8));var _5b6=function(_5b7,_5b8,_5b9){if(_5b7.id===_5b9.id){_4e2.forEach(_5b8,function(_5ba){map.removeLayer(_5ba);});}};_4e3.connect(map,"onLayerRemove",lang.hitch(this,_5b6,_5a3,_5a8));}delete _5a3.__popups;delete _5a3.__popupIds;delete _5a3.__popupUrls;delete _5a3.__resourceInfo;return _5a8;};function _5bb(_5bc){return _4eb({url:_532(_5bc.url+"/layers"),content:{f:"json"},callbackParamName:"callback",error:function(){}});};function _5bd(_5be,map,_5bf){var _5c0=[];_4e2.forEach(_5be,function(_5c1){var _5c2=_5c1.__popups;if(_5c2&&_5c2.length>1&&_5c1.version>=10){_5c1.__deferredsPos=_5c0.length;_5c0.push(_5bb(_5c1));}});var _5c3=[];if(_5c0.length>0){var _5c4=new _4e6(_5c0);_5c4.addCallback(function(_5c5){_4e2.forEach(_5be,function(_5c6){if(_5c6.__popups&&_5c6.__popups.length>0){if(_5c6.__deferredsPos||_5c6.__deferredsPos===0){var _5c7=_5c5[_5c6.__deferredsPos][1];_5c3=_5c3.concat(_5a2(_5c6,_5c7.layers,_5bf,map));delete _5c6.__deferredsPos;}else{_5c3=_5c3.concat(_5a2(_5c6,null,_5bf,map));}}});map.addLayers(_5c3);});}else{_4e2.forEach(_5be,function(_5c8){if(_5c8.__popups&&_5c8.__popups.length>0){_5c3=_5c3.concat(_5a2(_5c8,null,_5bf,map));}});map.addLayers(_5c3);}};function _5c9(_5ca){_4e2.forEach(_5ca,function(_5cb){var _5cc=_5cb.layer;if(_5cc.toJson){var json=_5cc.toJson();if(json.featureSet&&_5cc.name.indexOf("Text")>-1){_4e2.forEach(json.featureSet.features,function(_5cd,idx){if(_5cd.attributes.TEXT){var _5ce=_5cc.graphics[idx];_5ce.symbol.setText(_5cd.attributes.TEXT);if(_5cd.symbol.horizontalAlignment){_5ce.symbol.align=_5cd.symbol.horizontalAlignment;}_5ce.setSymbol(_5ce.symbol);_5ce.setAttributes(_5cd.attributes);}},this);}}});};function _5cf(_5d0){var _5d1=6;_4e2.forEach(_5d0,function(_5d2){var _5d3=_5d2.renderer;if(_5d3){if(_5d3.declaredClass==="esri.renderer.SimpleRenderer"){var _5d4=_5d3.symbol;if(_5d4&&_5d4.xoffset){_5d1=Math.max(_5d1,Math.abs(_5d4.xoffset));}if(_5d4&&_5d4.yoffset){_5d1=Math.max(_5d1,Math.abs(_5d4.yoffset));}}else{if(_5d3.declaredClass==="esri.renderer.UniqueValueRenderer"||_5d3.declaredClass==="esri.renderer.ClassBreaksRenderer"){_4e2.forEach(_5d3.infos,function(info){var _5d5=info.symbol;if(_5d5&&_5d5.xoffset){_5d1=Math.max(_5d1,Math.abs(_5d5.xoffset));}if(_5d5&&_5d5.yoffset){_5d1=Math.max(_5d1,Math.abs(_5d5.yoffset));}});}}}});return _5d1;};function _5d6(evt){var map=this,_5d7=map.infoWindow,_5d8=evt.graphic;if(!map.loaded){return;}_5d7.hide();_5d7.clearFeatures();var _5d9=[];_4e2.forEach(map.graphicsLayerIds,function(_5da){var _5db=map.getLayer(_5da);if(_5db&&_5db.declaredClass.indexOf("FeatureLayer")!==-1&&_5db.loaded&&_5db.visible){_5db.clearSelection();if(_5db.infoTemplate&&!_5db.suspended){_5d9.push(_5db);}}});_4e2.forEach(map.layerIds,function(_5dc){var _5dd=map.getLayer(_5dc);if(_5dd&&_5dd.declaredClass.indexOf("ArcGISImageServiceLayer")!==-1&&_5dd.loaded&&_5dd.visible&&_5dd.infoTemplate){_5d9.push(_5dd);}});_5d8=(_5d8&&_5d8.getInfoTemplate())?_5d8:null;if(!_5d9.length&&!_5d8){return;}var _5de=_5cf(_5d9);var _5df=evt.screenPoint,_5e0=map.toMap(new _4ee(_5df.x-_5de,_5df.y+_5de)),_5e1=map.toMap(new _4ee(_5df.x+_5de,_5df.y-_5de)),_5e2=new _4ef(_5e0.x,_5e0.y,_5e1.x,_5e1.y,map.spatialReference);var _5e3=new _4f5();_5e3.geometry=_5e2;_5e3.timeExtent=map.timeExtent;var _5e4=true;var _5e5=_4e2.map(_5d9,function(_5e6){var dfd;if(_5e6.declaredClass.indexOf("ArcGISImageServiceLayer")!==-1){_5e4=false;var _5e7={};_5e7.rasterAttributeTableFieldPrefix="Raster.";_5e7.returnDomainValues=true;dfd=_5e6.queryVisibleRasters(_5e3,_5e7);dfd.addCallback(function(){var _5e8=_5e6.getVisibleRasters();return _5e8;});}else{dfd=_5e6.selectFeatures(_5e3);dfd.addCallback(function(){var _5e9=_5e6.getSelectedFeatures();return _5e9;});}return dfd;});if(_5d8){var dfd=new _4e4();dfd.callback([_5d8]);_5e5.splice(0,0,dfd);}var _5ea=_4e2.some(_5e5,function(dfd){return dfd.fired===-1;});if(!_5ea){var _5eb=_5d8?1:0;_4e2.forEach(_5d9,function(_5ec){if(_5ec.declaredClass.indexOf("ArcGISImageServiceLayer")!==-1){_5eb=_5eb+_5ec.getVisibleRasters().length;}else{_5eb=_5eb+_5ec.getSelectedFeatures().length;}});if(!_5eb){return;}}_5d7.setFeatures(_5e5);_5d7.show(evt.mapPoint,{closestFirst:_5e4});};function _5ed(_5ee,_5ef,_5f0,_5f1,_5f2,_5f3){var _5f4=(_5f2.mapOptions||{}),_5f5,_5f6;if(!_5f4.infoWindow){_5f5=new _4f4(null,_4e7.create("div"));_5f4.infoWindow=_5f5;}if(!_4ea.isDefined(_5f4.showInfoWindowOnClick)){_5f4.showInfoWindowOnClick=false;}var map=new Map(_5f1,_5f4);if(_5f2.ignorePopups){_4e2.forEach(_5ee,function(_5f7){delete _5f7.infoTemplate;});}if(!(_5f2.ignorePopups||_5f2.disableClickBehavior)){_5f6=_4e3.connect(map,"onClick",_5d6);}_4e3.connect(map,"onLayersAddResult",_5c9);map.addLayers(_5ee);if(!_5f2.ignorePopups){_5bd(_5ee,map,_5f2._clazz);}var _5f8=[];_4e2.forEach(_5ef,function(_5f9){_5f8=_5f8.concat(_5f9.errors);},this);_5f3.callback({map:map,itemInfo:_5f0,errors:_5f8,clickEventHandle:_5f6,clickEventListener:_5d6});};function _5fa(_5fb,_5fc,_5fd,_5fe,_5ff){try{var _600=_5fd.mapOptions||{};_5fd.mapOptions=_600;var card=_5fb.item;var _601=[];_4e2.forEach(_5ff,function(_602){if(lang.isArray(_602.layerObject)){_4e2.forEach(_602.layerObject,function(l){_601.push(l);});}else{_601.push(_602.layerObject);}});if(!_601[0]){var msg="";if(_5ff[0].errors&&_5ff[0].errors.length){msg=" ("+_5ff[0].errors[0].message+")";}_5fe.errback(new Error(_509.arcgis.utils.baseLayerError+msg));return;}_601=_4e2.filter(_601,_4ea.isDefined);if(card){if(card.extent){if(!_600.extent){var _603=new _4ef(card.extent[0][0],card.extent[0][1],card.extent[1][0],card.extent[1][1],new _4ec({wkid:4326}));var _604=_601[0].spatialReference;if(_604.wkid===4326){_600.extent=_603;_5ed(_601,_5ff,_5fb,_5fc,_5fd,_5fe);}else{if(_604.wkid===102100||_604.wkid===102113||_604.wkid===3857){_603.xmin=Math.max(_603.xmin,-180);_603.xmax=Math.min(_603.xmax,180);_603.ymin=Math.max(_603.ymin,-89.99);_603.ymax=Math.min(_603.ymax,89.99);_600.extent=_4f0.geographicToWebMercator(_603);_5ed(_601,_5ff,_5fb,_5fc,_5fd,_5fe);}else{if(_5fd.geometryServiceURL||_4e9.defaults.geometryService){var gs;if(_5fd.geometryServiceURL){gs=new _4f6(_5fd.geometryServiceURL);}else{gs=_4e9.defaults.geometryService;}gs.project([_603],_604,function(_605){var _606=_605[0];_600.extent=_600.extent||_606;_5ed(_601,_5ff,_5fb,_5fc,_5fd,_5fe);});}else{_5fe.errback(new Error(_509.arcgis.utils.geometryServiceError));}}}}else{_5ed(_601,_5ff,_5fb,_5fc,_5fd,_5fe);}}else{_5ed(_601,_5ff,_5fb,_5fc,_5fd,_5fe);}}else{_5ed(_601,_5ff,_5fb,_5fc,_5fd,_5fe);}}catch(err){_5fe.errback(err);}};function _607(_608){var _609=[];var _60a=_608.baseMap.baseMapLayers.concat(_608.operationalLayers);_4e2.forEach(_60a,function(_60b,_60c){var _60d={};if(_60b.featureCollection&&_60b.type!=="CSV"){if(_60b.featureCollection.showLegend===true){_4e2.forEach(_60b.featureCollection.layers,function(_60e){if(_60e.showLegend!==false){_60d={"layer":_60e.layerObject,"title":_60b.title,"defaultSymbol":(_60e.renderer&&_60e.renderer.defaultSymbol&&_60e.renderer.defaultLabel)?true:false};if(_60b.featureCollection.layers.length>1){_60d.title+=" - "+_60e.layerDefinition.name;}_609.push(_60d);}});}}else{if((_60b.baseMapLayer&&_60b.showLegend===true&&_60b.layerObject)||(!_60b.baseMapLayer&&_60b.showLegend!==false&&_60b.layerObject)){var rend=_60b.layerObject.renderer;var _60f=(!rend||(rend&&rend.defaultSymbol&&rend.defaultLabel))?true:false;if((_60b.layerObject.version<10.1&&(_60b.layerObject instanceof _4f8||_60b.layerObject instanceof _4f7))||(_60b.layerObject instanceof esri.layers.ArcGISImageServiceLayer)){_60f=true;}_60d={"layer":_60b.layerObject,"title":_60b.title,"defaultSymbol":_60f};if(_60b.layers){var _610=_4e2.map(_4e2.filter(_60b.layers,function(lyr){return (lyr.showLegend===false);}),function(lyr){return lyr.id;});if(_610.length){_60d.hideLayers=_610;}}_609.push(_60d);}}});return _609;};function _611(_612){if(_50a._arcgisUrl&&_50a._arcgisUrl.length>0){_50a.arcgisUrl=_50a._arcgisUrl;}var url=_50a.arcgisUrl+"/"+_612;var _613={},_614=new _4e4();_4eb({url:url,content:{f:"json"},callbackParamName:"callback",load:function(_615){_613.item=_615;_4eb({url:url+"/data",content:{f:"json"},callbackParamName:"callback",load:function(_616){_613.itemData=_616;_614.callback(_613);},error:function(_617){_614.errback(_617);}});},error:function(_618){_614.errback(_618);}});return _614;};function _619(arg1,_61a,_61b){var _61c=new _4e4();_61b=_61b||{};var _61d=_61b.infoTemplateClass;_61b._clazz=(_61d&&(lang.isObject(_61d)?_61d:lang.getObject(_61d)))||_4f3;if(lang.isString(arg1)){_611(arg1).addCallback(function(_61e){_515(_61e,_61b).addCallback(function(_61f){_58c(_61f.itemData,_61b).addCallback(lang.hitch(null,_5fa,_61f,_61a,_61b,_61c));});}).addErrback(lang.hitch(_61c,_61c.errback));}else{_515(arg1,_61b).addCallback(function(_620){_58c(_620.itemData,_61b).addCallback(lang.hitch(null,_5fa,_620,_61a,_61b,_61c));});}return _61c;};function _621(_622){if(_622&&_622.itemInfo&&_622.itemInfo.itemData){return _607(_622.itemInfo.itemData);}else{return [];}};_50a={arcgisUrl:location.protocol+"//www.arcgis.com/sharing/rest/content/items",getItem:_611,createMap:_619,getLegendLayers:_621,_arcgisUrl:null,_getItemProps:_515,_getItemData:_50b,_getBingKey:_50e,_processFSItemProperties:_513,_getLayers:_58c,_preBuildLayerObjects:_57b,_buildLayerObjects:_56f,_preCreateMap:_5fa,_getMapSR:_577,_createMap:_5ed,_addSelectionLayers:_5bd,_createSelectionFeatureLayers:_5a2,_getServiceInfo:_589,_getLayersInfo:_5bb,_initLayer:_557,_loadAsCached:_533,_loadAsDynamic:_53e,_processPopups:_526,_onLayersAddResult:_5c9,_sameSpatialReferenceAsBasemap:_54c,_sameTilingSchemeAsBasemap:_550,_showPopup:_5d6,_calculateClickTolerance:_5cf,_getVisibleFeatureLayers:_537,_updateLayerScaleInfo:_59f,_checkUrl:_532,_isHostedService:_52e,_isAgolService:_531,_getLegendLayers:_607};lang.setObject("arcgis.utils",_50a,_4e8);return _50a;});