// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://js.arcgis.com/3.23/esri/copyright.txt for details.
//>>built
require({cache:{"esri/promiseList":function(){define(["dojo/_base/array","dojo/Deferred","dojo/when"],function(p,n,m){var r=p.forEach;return function(f){function a(a,d){w[d]=a;b.progress([a,d]);0===--h&&b.resolve(w)}var e,k;f instanceof Array?k=f:f&&"object"===typeof f&&(e=f);var w,c=[];if(e){k=[];for(var q in e)Object.hasOwnProperty.call(e,q)&&(c.push(q),k.push(e[q]));w={}}else k&&(w=[]);if(!k||!k.length)return(new n).resolve(w);var b=new n;b.promise.always(function(){w=c=null});var h=k.length;r(k,
function(h,d){e||c.push(d);m(h,function(g){b.isFulfilled()||a(g,c[d])},function(g){b.isFulfilled()||a(g,c[d])})});return b.promise}})},"esri/tasks/QueryTask":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/_base/Deferred dojo/_base/json dojo/has ../kernel ../request ../deferredUtils ../geometry/Extent ../geometry/normalizeUtils ./Task ./FeatureSet".split(" "),function(p,n,m,r,f,a,e,k,w,c,q,b,h){p=p(b,{declaredClass:"esri.tasks.QueryTask",_eventMap:{complete:["featureSet"],
"execute-for-count-complete":["count"],"execute-for-ids-complete":["objectIds"],"execute-relationship-query-complete":["featureSets"]},constructor:function(b,d){this._handler=n.hitch(this,this._handler);this._relationshipQueryHandler=n.hitch(this,this._relationshipQueryHandler);this._executeForIdsHandler=n.hitch(this,this._executeForIdsHandler);this._countHandler=n.hitch(this,this._countHandler);this._extentHandler=n.hitch(this,this._extentHandler);this.source=d&&d.source;this.gdbVersion=d&&d.gdbVersion;
this.registerConnectEvents()},__msigns:[{n:"execute",c:4,a:[{i:0,p:["geometry"]}],e:2},{n:"executeForIds",c:3,a:[{i:0,p:["geometry"]}],e:2},{n:"executeForCount",c:3,a:[{i:0,p:["geometry"]}],e:2},{n:"executeForExtent",c:3,a:[{i:0,p:["geometry"]}],e:2}],onComplete:function(){},onExecuteRelationshipQueryComplete:function(){},onExecuteForIdsComplete:function(){},onExecuteForCountComplete:function(){},onExecuteForExtentComplete:function(){},execute:function(b,d,g,l,a){l=a.assembly;b=this._encode(n.mixin({},
this._url.query,{f:"json"},b.toJson(l&&l[0])));var h=this._handler,c=this._errorHandler;this.source&&(l={source:this.source.toJson()},b.layer=f.toJson(l));this.gdbVersion&&(b.gdbVersion=this.gdbVersion);return k({url:this._url.path+"/query",content:b,callbackParamName:"callback",load:function(b,l){h(b,l,d,g,a.dfd)},error:function(d){c(d,g,a.dfd)}},this.requestOptions)},executeRelationshipQuery:function(b,d,g){b=this._encode(n.mixin({},this._url.query,{f:"json"},b.toJson()));var l=this._relationshipQueryHandler,
a=this._errorHandler;this.gdbVersion&&(b.gdbVersion=this.gdbVersion);var h=new r(w._dfdCanceller);h._pendingDfd=k({url:this._url.path+"/queryRelatedRecords",content:b,callbackParamName:"callback",load:function(b,a){l(b,a,d,g,h)},error:function(b){a(b,g,h)}},this.requestOptions);return h},executeForIds:function(b,d,g,l){var a=l.assembly;b=this._encode(n.mixin({},this._url.query,{f:"json",returnIdsOnly:!0},b.toJson(a&&a[0])));var h=this._executeForIdsHandler,c=this._errorHandler;this.source&&(a={source:this.source.toJson()},
b.layer=f.toJson(a));this.gdbVersion&&(b.gdbVersion=this.gdbVersion);return k({url:this._url.path+"/query",content:b,callbackParamName:"callback",load:function(b,a){h(b,a,d,g,l.dfd)},error:function(b){c(b,g,l.dfd)}},this.requestOptions)},executeForCount:function(b,d,g,l){var a=l.assembly;b=this._encode(n.mixin({},this._url.query,{f:"json",returnIdsOnly:!0,returnCountOnly:!0},b.toJson(a&&a[0])));var h=this._countHandler,c=this._errorHandler;this.source&&(a={source:this.source.toJson()},b.layer=f.toJson(a));
this.gdbVersion&&(b.gdbVersion=this.gdbVersion);return k({url:this._url.path+"/query",content:b,callbackParamName:"callback",load:function(b,a){h(b,a,d,g,l.dfd)},error:function(b){c(b,g,l.dfd)}},this.requestOptions)},executeForExtent:function(b,d,a,l){var g=l.assembly;b=this._encode(n.mixin({},this._url.query,{f:"json",returnExtentOnly:!0,returnCountOnly:!0},b.toJson(g&&g[0])));var h=this._extentHandler,c=this._errorHandler;this.source&&(g={source:this.source.toJson()},b.layer=f.toJson(g));this.gdbVersion&&
(b.gdbVersion=this.gdbVersion);return k({url:this._url.path+"/query",content:b,callbackParamName:"callback",load:function(b,g){h(b,g,d,a,l.dfd)},error:function(b){c(b,a,l.dfd)}},this.requestOptions)},_handler:function(b,d,a,l,c){try{var g=new h(b);this._successHandler([g],"onComplete",a,c)}catch(z){this._errorHandler(z,l,c)}},_relationshipQueryHandler:function(b,d,a,l,c){try{var g=b.geometryType,q=b.spatialReference,e={};m.forEach(b.relatedRecordGroups,function(b){var d={};d.geometryType=g;d.spatialReference=
q;d.features=b.relatedRecords;d=new h(d);if(null!=b.objectId)e[b.objectId]=d;else for(var u in b)b.hasOwnProperty(u)&&"relatedRecords"!==u&&(e[b[u]]=d)});this._successHandler([e],"onExecuteRelationshipQueryComplete",a,c)}catch(y){this._errorHandler(y,l,c)}},_executeForIdsHandler:function(b,d,a,l,h){try{this._successHandler([b.objectIds],"onExecuteForIdsComplete",a,h)}catch(E){this._errorHandler(E,l,h)}},_countHandler:function(b,d,a,l,h){try{var g,c=b.features,q=b.objectIds;if(q)g=q.length;else{if(c)throw Error("Unable to perform query. Please check your parameters.");
g=b.count}this._successHandler([g],"onExecuteForCountComplete",a,h)}catch(y){this._errorHandler(y,l,h)}},_extentHandler:function(b,d,a,l,h){try{b.extent&&(b.extent=new c(b.extent)),this._successHandler([b],"onExecuteForExtentComplete",a,h)}catch(E){this._errorHandler(E,l,h)}}});q._createWrappers(p);a("extend-esri")&&n.setObject("tasks.QueryTask",p,e);return p})},"esri/tasks/Task":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/json dojo/has ../kernel ../deferredUtils ../urlUtils ../Evented".split(" "),
function(p,n,m,r,f,a,e,k){p=p(k,{declaredClass:"esri.tasks._Task",_eventMap:{error:["error"],complete:["result"]},constructor:function(a,c){a&&n.isString(a)&&(this._url=e.urlToObject(this.url=a));c&&c.requestOptions&&(this.requestOptions=c.requestOptions);this.normalization=!0;this._errorHandler=n.hitch(this,this._errorHandler);this.registerConnectEvents()},_useSSL:function(){var a=this._url,c=/^http:/i;this.url&&(this.url=this.url.replace(c,"https:"));a&&a.path&&(a.path=a.path.replace(c,"https:"))},
_encode:function(a,c,q){var b,h,e={},d,g;for(d in a)if("declaredClass"!==d&&(b=a[d],h=typeof b,null!==b&&void 0!==b&&"function"!==h))if(n.isArray(b))for(e[d]=[],g=b.length,h=0;h<g;h++)e[d][h]=this._encode(b[h]);else"object"===h?b.toJson&&(h=b.toJson(q&&q[d]),"esri.tasks.FeatureSet"===b.declaredClass&&h.spatialReference&&(h.sr=h.spatialReference,delete h.spatialReference),e[d]=c?h:m.toJson(h)):e[d]=b;return e},_successHandler:function(e,c,q,b){c&&this[c].apply(this,e);q&&q.apply(null,e);b&&a._resDfd(b,
e)},_errorHandler:function(a,c,q){this.onError(a);c&&c(a);q&&q.errback(a)},setNormalization:function(a){this.normalization=a},onError:function(){}});r("extend-esri")&&(f.Task=p);return p})},"esri/tasks/FeatureSet":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/has ../kernel ../lang ../graphic ../SpatialReference ../graphicsUtils ../geometry/jsonUtils ../symbols/jsonUtils".split(" "),function(p,n,m,r,f,a,e,k,w,c,q){p=p(null,{declaredClass:"esri.tasks.FeatureSet",constructor:function(b){if(b){n.mixin(this,
b);var a=this.features,x=b.spatialReference,d=c.getGeometryType(b.geometryType),x=this.spatialReference=new k(x);this.geometryType=b.geometryType;b.fields&&(this.fields=b.fields);m.forEach(a,function(b,l){var g=b.geometry&&b.geometry.spatialReference;a[l]=new e(d&&b.geometry?new d(b.geometry):null,b.symbol&&q.fromJson(b.symbol),b.attributes);a[l].geometry&&!g&&a[l].geometry.setSpatialReference(x)});this._hydrate()}else this.features=[]},displayFieldName:null,geometryType:null,spatialReference:null,
fieldAliases:null,toJson:function(b){var h={};this.displayFieldName&&(h.displayFieldName=this.displayFieldName);this.fields&&(h.fields=this.fields);this.spatialReference?h.spatialReference=this.spatialReference.toJson():this.features[0]&&this.features[0].geometry&&(h.spatialReference=this.features[0].geometry.spatialReference.toJson());this.features[0]&&(this.features[0].geometry&&(h.geometryType=c.getJsonType(this.features[0].geometry)),h.features=w._encodeGraphics(this.features,b));h.geometryType=
h.geometryType||this.geometryType;h.exceededTransferLimit=this.exceededTransferLimit;h.transform=this.transform;return a.fixJson(h)},_hydrate:function(){var b=this.transform,a=this.geometryType;if(b&&a)for(var c=this.features,d=b.translate[0],g=b.translate[1],l=b.scale[0],q=b.scale[1],e=function(b,a,d){if("esriGeometryPoint"===b)return function(b){b.x=a(b.x);b.y=d(b.y)};if("esriGeometryPolyline"===b||"esriGeometryPolygon"===b)return function(b){b=b.rings||b.paths;var u,l,C,F,g,h,c,q;u=0;for(l=b.length;u<
l;u++)for(g=b[u],C=0,F=g.length;C<F;C++)h=g[C],0<C?(c+=h[0],q+=h[1]):(c=h[0],q=h[1]),h[0]=a(c),h[1]=d(q)};if("esriGeometryEnvelope"===b)return function(b){b.xmin=a(b.xmin);b.ymin=d(b.ymin);b.xmax=a(b.xmax);b.ymax=d(b.ymax)};if("esriGeometryMultipoint"===b)return function(b){b=b.points;var u,l,C,F,g;u=0;for(l=b.length;u<l;u++)C=b[u],0<u?(F+=C[0],g+=C[1]):(F=C[0],g=C[1]),C[0]=a(F),C[1]=d(g)}}(a,function(b){return b*l+d},function(b){return g-b*q}),b=0,a=c.length;b<a;b++)c[b].geometry&&e(c[b].geometry);
this.transform=null},quantize:function(b){if(!this.geometryType)return this.transform=null,this;var a=b.translate[0],c=b.translate[1],d=b.scale[0],g=b.scale[1],l=this.features,q=function(b,a,u){var d,C,l,g,h,c,q=[];d=0;for(C=b.length;d<C;d++)if(l=b[d],0<d){if(c=a(l[0]),l=u(l[1]),c!==g||l!==h)q.push([c-g,l-h]),g=c,h=l}else g=a(l[0]),h=u(l[1]),q.push([g,h]);return 0<q.length?q:null},e=function(b,a,u){if("esriGeometryPoint"===b)return function(b){b.x=a(b.x);b.y=u(b.y);return b};if("esriGeometryPolyline"===
b||"esriGeometryPolygon"===b)return function(b){var d,l,g,h,H;g=b.rings||b.paths;H=[];d=0;for(l=g.length;d<l;d++)h=g[d],(h=q(h,a,u))&&H.push(h);return 0<H.length?(b.rings?b.rings=H:b.paths=H,b):null};if("esriGeometryMultipoint"===b)return function(b){var d;d=q(b.points,a,u);return 0<d.length?(b.points=d,b):null};if("esriGeometryEnvelope"===b)return function(b){return b}}(this.geometryType,function(b){return Math.round((b-a)/d)},function(b){return Math.round((c-b)/g)}),k,f;k=0;for(f=l.length;k<f;k++)l[k].geometry&&
(e(l[k].geometry)||l[k].setGeometry(null));this.transform=b;return this}});r("extend-esri")&&n.setObject("tasks.FeatureSet",p,f);return p})},"esri/tasks/StatisticDefinition":function(){define(["dojo/_base/declare","dojo/_base/lang","dojo/has","../kernel"],function(p,n,m,r){p=p(null,{declaredClass:"esri.tasks.StatisticDefinition",toJson:function(){return{statisticType:this.statisticType,onStatisticField:this.onStatisticField,outStatisticFieldName:this.outStatisticFieldName,maxPointCount:this.maxPointCount,
maxRecordCount:this.maxRecordCount,maxVertexCount:this.maxVertexCount}}});m("extend-esri")&&n.setObject("tasks.StatisticDefinition",p,r);return p})},"esri/layers/FeatureType":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/has ../kernel ../lang ../symbols/jsonUtils ./RangeDomain ./CodedValueDomain ./InheritedDomain ./FeatureTemplate".split(" "),function(p,n,m,r,f,a,e,k,w,c,q){p=p(null,{declaredClass:"esri.layers.FeatureType",constructor:function(b){if(b&&n.isObject(b)){this.id=
b.id;this.name=b.name;var a=b.symbol;a&&(this.symbol=e.fromJson(a));var a=b.domains,x,d=this.domains={};for(x in a)if(a.hasOwnProperty(x)){var g=a[x];switch(g.type){case "range":d[x]=new k(g);break;case "codedValue":d[x]=new w(g);break;case "inherited":d[x]=new c(g)}}if(x=b.templates)for(a=this.templates=[],b=0;b<x.length;b++)a.push(new q(x[b]))}},toJson:function(){var b={id:this.id,name:this.name,symbol:this.symbol&&this.symbol.toJson()},h,c=this.domains,d=this.templates,g=a.fixJson;if(c){var l=
b.domains={};for(h in c)c.hasOwnProperty(h)&&(l[h]=c[h]&&c[h].toJson());g(l)}d&&(b.templates=m.map(d,function(b){return b.toJson()}));return g(b)}});r("extend-esri")&&n.setObject("layers.FeatureType",p,f);return p})},"esri/layers/FeatureTemplate":function(){define("dojo/_base/declare dojo/_base/lang dojo/has ../kernel ../lang ../graphic".split(" "),function(p,n,m,r,f,a){p=p(null,{declaredClass:"esri.layers.FeatureTemplate",constructor:function(e){e&&n.isObject(e)&&(this.name=e.name,this.description=
e.description,this.drawingTool=e.drawingTool,this.thumbnail=e.thumbnail,e=e.prototype,this.prototype=new a(e.geometry,null,e.attributes))},toJson:function(){return f.fixJson({name:this.name,description:this.description,drawingTool:this.drawingTool,thumbnail:f.fixJson(n.clone(this.thumbnail)),prototype:this.prototype&&this.prototype.toJson()})}});n.mixin(p,{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"});
m("extend-esri")&&n.setObject("layers.FeatureTemplate",p,r);return p})},"esri/layers/FeatureEditResult":function(){define(["dojo/_base/declare","dojo/_base/lang","dojo/has","../kernel"],function(p,n,m,r){p=p(null,{declaredClass:"esri.layers.FeatureEditResult",constructor:function(f){f&&n.isObject(f)&&(this.objectId=f.objectId,this.globalId=f.globalId,this.success=f.success,f.success||(f=f.error,this.error=Error(),this.error.code=f.code,this.error.message=f.description))}});m("extend-esri")&&n.setObject("layers.FeatureEditResult",
p,r);return p})},"esri/layers/SnapshotMode":function(){define("dojo/_base/declare dojo/_base/lang dojo/has ../kernel ../SpatialReference ../srUtils ../tasks/query ./RenderMode ./support/ParallelSnapshot".split(" "),function(p,n,m,r,f,a,e,k,w){p=p([k],{declaredClass:"esri.layers._SnapshotMode",maxFeatures:5E4,constructor:function(a){this.featureLayer=a;this._featureMap={};this._hasPartialFeatures=!1;this._drawFeatures=n.hitch(this,this._drawFeatures);this._queryErrorHandler=n.hitch(this,this._queryErrorHandler);
this._handleSuccess=n.hitch(this,this._handleSuccess);this._handleError=n.hitch(this,this._handleError);this._handleProgress=n.hitch(this,this._handleProgress)},startup:function(){if(!this._started){this.inherited(arguments);var a=this.featureLayer,q=a.advancedQueryCapabilities,b=a.reHostedFS.test(a.url);this.pagination=a.queryPagination&&null!=a.maxRecordCount;this._tileQueriesAllowed=b&&q&&q.supportsQueryWithResultType&&a.isFeatureReductionApplied();b&&this.pagination&&(this._parallelSnapshot=new w({layer:a,
mode:this,queryTask:a._task}));a._collection?this._applyTimeFilter():this._fetchAll()}},propertyChangeHandler:function(a){this._init&&(a?this.featureLayer._collection?console.log("FeatureLayer: layer created by value (from a feature collection) does not support definition expressions and time definitions. Layer id \x3d "+this.featureLayer.id):this._fetchAll():this._applyTimeFilter())},destroy:function(){this._cancelPendingRequest(this._pendingRequest);this._parallelSnapshot&&this._parallelSnapshot.destroy();
this.inherited(arguments)},drawFeature:function(a){var c=a.attributes[this.featureLayer.objectIdField];this._addFeatureIIf(c,a);this._incRefCount(c)},resume:function(){this.propertyChangeHandler(0)},refresh:function(){var a=this.featureLayer;a._collection?(a._fireUpdateStart(),a._refresh(!0),a._fireUpdateEnd()):this._fetchAll()},hasAllFeatures:function(){return!this._hasPartialFeatures},_fetchAll:function(){var a=this.featureLayer;a._collection||a.suspended||!a.isQueryable()||(a._fireUpdateStart(),
this._clearIIf(),this._hasPartialFeatures=!1,this._parallelSnapshot?this._parallelSnapshot.fetch(this._createQuery()).then(this._handleSuccess,this._handleError,this._handleProgress):this._sendRequest())},_handleSuccess:function(a){this._hasPartialFeatures=a.hasPartialFeatures;this.featureLayer._fireUpdateEnd(null)},_handleError:function(a){this._queryErrorHandler(a)},_handleProgress:function(a){a.isError?this.featureLayer._errorHandler(a.error):this._addFeatures(a.features)},_sendRequest:function(a){var c=
this.featureLayer,b=this._createQuery();this.pagination&&(this._start=b.start=null==a?0:a,b.num=c.maxRecordCount);this._pendingRequest&&this._cancelPendingRequest(this._pendingRequest);this._pendingRequest=c._task.execute(b,this._drawFeatures,this._queryErrorHandler)},_drawFeatures:function(a){this._pendingRequest=null;var c=this.featureLayer,b=a.exceededTransferLimit,h=b&&!c._collection;a=this._checkMaxLimit(a.features);var e=a.maxLimitReached;this._addFeatures(a.features);this.pagination&&h&&!e||
(this._hasPartialFeatures=!!b,c._fireUpdateEnd(null,b?{queryLimitExceeded:!0}:null));h&&(this.pagination&&!e&&this._sendRequest(this._start+c.maxRecordCount),c.onQueryLimitExceeded())},_queryErrorHandler:function(a){this._pendingRequest=null;this._hasPartialFeatures=!0;var c=this.featureLayer;c._errorHandler(a);c._fireUpdateEnd(a)},_checkMaxLimit:function(a){var c=a?a.length:0,b=this.featureLayer.graphics.length+c,h=b>=this.maxFeatures;if(h){var e=b-this.maxFeatures;e&&a.splice(c-e,e)}return{maxLimitReached:h,
featuresDiscarded:b>this.maxFeatures,features:a}},_createQuery:function(){var c=this.featureLayer,q=new e;q.outFields=c.getOutFields();q.where=c.getDefinitionExpression()||"1\x3d1";q.returnGeometry=!0;q.outSpatialReference=a.createSpatialReference(this.map.spatialReference.toJson());q.timeExtent=c.getTimeDefinition();q.maxAllowableOffset=c._maxOffset;q.quantizationParameters=c._quantizationParameters;q.orderByFields=c.supportsAdvancedQueries?c.getOrderByFields():null;q.multipatchOption=c.multipatchOption;
c._ts&&(q._ts=(new Date).getTime());this._tileQueriesAllowed&&(q.resultType="tile");return q},_addFeatures:function(a){var c=this.featureLayer,b=c.objectIdField,h=a.length,e=c._selectedFeatures,d=c.mode===c.constructor.MODE_AUTO,g,l,k;c._fireUpdateStart();c._sortFeatures(a);for(c=0;c<h;c++)l=a[c],k=l.attributes[b],g=this._addFeatureIIf(k,l),this._incRefCount(k),d&&g!==l&&e[k]&&(g.setGeometry(l.geometry),g.setAttributes(l.attributes));this._applyTimeFilter(!0)}});m("extend-esri")&&n.setObject("layers._SnapshotMode",
p,r);return p})},"esri/layers/RenderMode":function(){define(["dojo/_base/declare","dojo/_base/lang","dojo/_base/array","dojo/has","../kernel"],function(p,n,m,r,f){p=p(null,{declaredClass:"esri.layers._RenderMode",initialize:function(a){this.map=a;this._init=!0},startup:function(){this._started=!0},propertyChangeHandler:function(a){},destroy:function(){this._init=this._started=!1},drawFeature:function(a){},suspend:function(){},resume:function(){},refresh:function(){},hasAllFeatures:function(){return!0},
_incRefCount:function(a){(a=this._featureMap[a])&&a._count++},_decRefCount:function(a){(a=this._featureMap[a])&&a._count--},_getFeature:function(a){return this._featureMap[a]},_addFeatureIIf:function(a,e){var k=this._featureMap,f=k[a],c=this.featureLayer;f||(k[a]=e,c._add(e),e._count=0);return f||e},_removeFeatureIIf:function(a){var e=this._featureMap[a],k=this.featureLayer;if(e){if(e._count)return;delete this._featureMap[a];k._remove(e)}return e},_clearIIf:function(){var a;a=this.featureLayer;var e=
a.graphics,k=a._selectedFeatures,f=a.getSelectedFeatures().length,c=a.objectIdField;if(f)for(a=e.length-1;0<=a;a--){var f=e[a],q=f.attributes[c];q in k?f._count=1:(f._count=0,this._removeFeatureIIf(q))}else a.clear(),this._featureMap={}},_cancelPendingRequest:function(a){if(a)try{a.cancel()}catch(e){}},_toggleVisibility:function(a){var e=this.featureLayer,k=e.graphics,f=a?"show":"hide",c,q=k.length;a=a&&e._ager;for(c=0;c<q;c++){var b=k[c];b[f]();a&&e._repaint(b)}},_applyTimeFilter:function(a){var e=
this.featureLayer;if(e.timeInfo&&!e.suspended){a||e._fireUpdateStart();var k=e._trackManager;k&&k.clearTracks();var f=e.getTimeDefinition(),c=e._getOffsettedTE(e._mapTimeExtent);c?(c=e._getTimeOverlap(f,c))?(f=e._filterByTime(e.graphics,c.startTime,c.endTime),k&&k.addFeatures(f.match),m.forEach(f.match,function(a){var b=a._shape;a.visible||(a.show(),(b=a._shape)&&b._moveToFront());e._ager&&b&&e._repaint(a)}),m.forEach(f.noMatch,function(a){a.visible&&a.hide()})):this._toggleVisibility(!1):(k&&k.addFeatures(e.graphics),
this._toggleVisibility(!0));k&&(k.moveLatestToFront(),k.drawTracks());a||e._fireUpdateEnd()}}});r("extend-esri")&&n.setObject("layers._RenderMode",p,f);return p})},"esri/layers/support/ParallelSnapshot":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/has dojo/Deferred ../../kernel".split(" "),function(p,n,m,r,f,a){p=p(null,{declaredClass:"esri.layers.support.ParallelSnapshot",layer:null,mode:null,queryTask:null,batchSize:5,_query:null,_fetchDfd:null,_startPage:null,_lastPage:null,
_maxPage:null,_requests:null,constructor:function(a){n.mixin(this,a);this._requests={};this._maxPage=Math.ceil(this.mode.maxFeatures/this.layer.maxRecordCount)},destroy:function(){this.cancel()},fetch:function(a){var e=new f;this.cancel(!0);this._query=a;this._fetchDfd=e;this._sendRequests();return e.promise},cancel:function(a){this._cancelPendingRequests(a);this._reset()},_reset:function(){this._startPage=this._lastPage=null;this._requests={}},_sendRequests:function(a){var e=this._query,f=this.queryTask,
c=this._requests,q=this.layer.maxRecordCount,b;a=null==a?1:a;b=a+this.batchSize-1;b>this._maxPage&&(b=this._maxPage);if(!(a>b))for(this._startPage=a,this._lastPage=b;a<=b;a++)e.start=(a-1)*q,e.num=q,c[a]=f.execute(e),c[a].then(n.hitch(this,this._handleSuccess,a)).otherwise(n.hitch(this,this._handleError,a))},_evalNextBatch:function(a){a===this._lastPage&&this._sendRequests(this._lastPage+1)},_handleSuccess:function(a,k){k.exceededTransferLimit||this._cancelLaterRequests(a,!0);var e=this.mode._checkMaxLimit(k.features);
this._fetchDfd.progress({features:e.features,isError:!1});e.maxLimitReached?((e=e.featuresDiscarded||this._hasRejectedRequests())||(e=!!this._getResult(this._getLastSuccessfulRequest()).exceededTransferLimit),this._resolveFetch(e)):(k.exceededTransferLimit&&this._evalNextBatch(a),this._evalResolution())},_handleError:function(a,k){var e=this._requests;e&&e[a]&&(1===a?this._rejectFetch(k):(this._evalNextBatch(a),this._fetchDfd.progress({error:k,isError:!0}),this._evalResolution()))},_evalResolution:function(){this._hasPendingRequests()||
this._resolveFetch(this._hasRejectedRequests())},_resolveFetch:function(a){this.cancel(!0);this._fetchDfd.resolve({hasPartialFeatures:a})},_rejectFetch:function(a){this.cancel(!0);this._fetchDfd.reject(a)},_getResult:function(a){return a&&a.dfd.results[0]},_hasPendingRequests:function(){return!!this._getPendingRequests().length},_getPendingRequests:function(){var a=this._requests,k,f=[];for(k in a){var c=a[k];c.isFulfilled()||f.push({pageId:Number(k),dfd:c})}return f},_getLastSuccessfulRequest:function(){var a=
this._getResolvedRequests(),k=-Infinity,f,a=m.filter(a,function(a){return!!this._getResult(a).features.length||1===a.pageId},this);m.forEach(a,function(a){a.pageId>k&&(k=a.pageId,f=a)});return f},_getResolvedRequests:function(){var a=this._requests,k,f=[];for(k in a){var c=a[k];c.isResolved()&&f.push({pageId:Number(k),dfd:c})}return f},_hasRejectedRequests:function(){var a=this._getRejectedRequests(),k=this._getLastSuccessfulRequest(),f=this._getResult(k);f&&!f.exceededTransferLimit&&(a=m.filter(a,
function(a){return a.pageId<=k.pageId}));return!!a.length},_getRejectedRequests:function(){var a=this._requests,k,f=[];for(k in a){var c=a[k];c.isRejected()&&f.push({pageId:Number(k),dfd:c})}return f},_cancelPendingRequests:function(a){this._cancelRequests(this._getPendingRequests(),a)},_cancelLaterRequests:function(a,k){var e=m.filter(this._getPendingRequests(),function(c){return c.pageId>a});this._cancelRequests(e,k)},_cancelRequests:function(a,k){var e=this.mode,c=this._requests;m.forEach(a,function(a){k&&
delete c[a.pageId];e._cancelPendingRequest(a.dfd)})}});r("extend-esri")&&n.setObject("layers.support.ParallelSnapshot",p,a);return p})},"esri/layers/OnDemandMode":function(){define("dojo/_base/declare dojo/_base/connect dojo/_base/lang dojo/_base/array dojo/has ../kernel ../geometry/Point ../tasks/query ./RenderMode ./GridLayout".split(" "),function(p,n,m,r,f,a,e,k,w,c){p=p([w],{declaredClass:"esri.layers._OnDemandMode",constructor:function(a){this.featureLayer=a;this._featureMap={};this._hasPartialFeatures=
!1;this._queryErrorHandler=m.hitch(this,this._queryErrorHandler)},initialize:function(a){this.inherited(arguments);var b=this.featureLayer,h=b._srInfo;this._gridLayer=new c(new e(h?h.valid[0]:a.extent.xmin,h?h.valid[1]:a.extent.ymax,a.spatialReference),{width:b._tileWidth,height:b._tileHeight},{width:a.width,height:a.height},h);this._cellMap={};this._gridLayer.setResolution(a.extent)},startup:function(){this._started||(this.inherited(arguments),this._ioQueue=[],this.featureLayer.suspended||(this._zoomHandler(),
this._enableConnectors()))},propertyChangeHandler:function(a){this._init&&(2>a?this._zoomHandler():console.log("FeatureLayer: layer in on-demand mode does not support time definitions. Layer id \x3d "+this.featureLayer.id+", Layer URL \x3d "+this.featureLayer.url))},destroy:function(){this._disableConnectors();this._processIOQueue(!0);this.inherited(arguments)},drawFeature:function(a){var b=a.geometry,h=[];if(b){var h=this._gridLayer.getCellsInExtent("point"===b.type?{xmin:b.x,ymin:b.y,xmax:b.x,ymax:b.y}:
b.getExtent(),!1).cells,b=this._cellMap,c,d,g=a.attributes[this.featureLayer.objectIdField],l,e,q;for(c=0;c<h.length;c++)d=h[c],l=d.latticeID,e=d.row,q=d.col,l?d=b[l]=b[l]||d:(b[e]=b[e]||{},d=b[e][q]=b[e][q]||d),d.features=d.features||[],d.features.push(a),this._addFeatureIIf(g,a),this._incRefCount(g)}},suspend:function(){this._init&&this._disableConnectors()},resume:function(){this._init&&(this._enableConnectors(),this._zoomHandler())},refresh:function(){this._zoomHandler()},hasAllFeatures:function(){if(this._hasPartialFeatures)return!1;
var a=!1,b=this._getCurrentCells(),h;for(h=0;h<b.length;h++)if(b[h].hasPartialFeatures){a=!0;break}return!a},_enableConnectors:function(){var a=this.map;this._zoomConnect=n.connect(a,"onZoomEnd",this,this._zoomHandler);this._panConnect=n.connect(a,"onPanEnd",this,this._panHandler);this._resizeConnect=n.connect(a,"onResize",this,this._panHandler)},_disableConnectors:function(){n.disconnect(this._zoomConnect);n.disconnect(this._panConnect);n.disconnect(this._resizeConnect)},_zoomHandler:function(){this._processIOQueue(!0);
var a=this.featureLayer,b=this.map;!a.suspended&&a.isQueryable()&&(a._fireUpdateStart(),this._clearIIf(),this._hasPartialFeatures=!1,(a=a._trackManager)&&a.clearTracks(),this._cellMap={},this._gridLayer.setResolution(b.extent),this._sendRequest())},_panHandler:function(a){if(this.featureLayer.isQueryable()){this.featureLayer._fireUpdateStart();var b=this.featureLayer._resized;a=b?a:null;b&&this._gridLayer.setMapState(a,this.map.width,this.map.height);this._sendRequest(a)}},_sendRequest:function(a){this._exceeds=
!1;var b=this.featureLayer,h=this.map;a=a||h.extent;h=this._gridLayer.getCellsInExtent(a,b.latticeTiling).cells;if(!b.isEditable())var c=this._cellMap,h=r.filter(h,function(a){if(a.lattice){if(c[a.latticeID])return!1}else if(c[a.row]&&c[a.row][a.col])return!1;return!0});var d=b.getOutFields(),g=b.getDefinitionExpression(),l=b._getOffsettedTE(b._mapTimeExtent),e=b.supportsAdvancedQueries?b.getOrderByFields():null,q=this._ioQueue,f,n=this,y=this._drawFeatures,v,u;this._pending=this._pending||0;for(f=
0;f<h.length;f++){v=h[f];u=new k;u.geometry=v.extent||v.lattice;u.outFields=d;u.where=g;b.latticeTiling&&v.extent&&(u.spatialRelationship=k.SPATIAL_REL_CONTAINS);u.returnGeometry=!0;u.timeExtent=l;b._ts&&(u._ts=(new Date).getTime());u.orderByFields=e;u.multipatchOption=b.multipatchOption;u.maxAllowableOffset=b._maxOffset;u.quantizationParameters=b._quantizationParameters;var H=b.advancedQueryCapabilities;H&&H.supportsQueryWithResultType&&(u.resultType="tile");this._pending++;q.push(b._task.execute(u,
function(){var a=v;return function(b){y.apply(n,[b,a])}}.call(this),this._queryErrorHandler))}this._removeOldCells(a);this._endCheck()},_drawFeatures:function(a,b){b.hasPartialFeatures=!!a.exceededTransferLimit;this._exceeds=this._exceeds||a.exceededTransferLimit;this._finalizeIO();var h=this.featureLayer,c=this.map.extent,d=b.extent,g=b.row,l=b.col,e=h.objectIdField,k=a.features,q=this._gridLayer,f=this._cellMap,y=b.latticeID,v=y?f[y]:f[g]&&f[g][l];if(b.resolution==q._resolution&&(y?y===q.getLatticeID(c):
q.intersects(d,c)))if(v)h._sortFeatures(k),this._updateCell(v,k);else for(h._sortFeatures(k),b.features=k,y?f[y]=b:(f[g]=f[g]||{},f[g][l]=b),c=k.length,h=0;h<c;h++)d=k[h],g=d.attributes[e],this._addFeatureIIf(g,d),this._incRefCount(g);else v&&this._removeCell(g,l,y);this._endCheck()},_queryErrorHandler:function(a){this._finalizeIO();this._hasPartialFeatures=!0;this.featureLayer._errorHandler(a);this._endCheck(!0)},_finalizeIO:function(){this._pending--},_endCheck:function(a){if(0===this._pending){this._processIOQueue();
var b=this.featureLayer,h=b._trackManager;h&&(h.clearTracks(),h.addFeatures(b.graphics),b._ager&&r.forEach(b.graphics,function(a){a._shape&&b._repaint(a)}),h.moveLatestToFront(),h.drawTracks());this.featureLayer._fireUpdateEnd(a&&Error("FeatureLayer: an error occurred while updating the layer"),this._exceeds?{queryLimitExceeded:!0}:null);if(this._exceeds)b.onQueryLimitExceeded()}},_processIOQueue:function(a){this._ioQueue=r.filter(this._ioQueue,function(a){return-1<a.fired?!1:!0});a&&r.forEach(this._ioQueue,
this._cancelPendingRequest)},_getCurrentCells:function(a){var b=[];a=a||this._cellMap;for(var h in a)if(a.hasOwnProperty(h)){var c=a[h];c&&(c.hasOwnProperty("row")||c.hasOwnProperty("latticeID")?b.push(c):"object"===typeof c&&b.push.apply(b,this._getCurrentCells(c)))}return b},_removeOldCells:function(a){var b=this._cellMap,h=this._gridLayer,c,d;for(c in b)if(b[c]){var g=b[c],l=g.latticeID,e=0,k=0;if(l)e++,l!==h.getLatticeID(a)&&(this._removeCell(null,null,l),k++);else for(d in g)g[d]&&(e++,h.intersects(g[d].extent,
a)||(this._removeCell(c,d),k++));k===e&&delete b[c]}},_updateCell:function(a,b){var h=this.featureLayer,c=h.objectIdField,h=h._selectedFeatures,d,g=b.length;a.features=a.features||[];for(d=0;d<g;d++){var l=b[d],e=l.attributes[c],k=this._addFeatureIIf(e,l);k===l?(this._incRefCount(e),a.features.push(k)):e in h||(k.setGeometry(l.geometry),k.setAttributes(l.attributes))}},_removeCell:function(a,b,h){var c=this._cellMap,d=this.featureLayer,g=d.objectIdField,l=h?c[h]:c[a]&&c[a][b];if(l)for(h?delete c[h]:
delete c[a][b],a=l.features,b=0;b<a.length;b++)h=a[b].attributes[g],this._decRefCount(h),h in d._selectedFeatures||this._removeFeatureIIf(h)}});f("extend-esri")&&m.setObject("layers._OnDemandMode",p,a);return p})},"esri/layers/GridLayout":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/has ../kernel ../SpatialReference ../geometry/Extent ../geometry/Polyline ../srUtils".split(" "),function(p,n,m,r,f,a,e,k,w){p=p(null,{declaredClass:"esri.layers._GridLayout",constructor:function(a,
e,b,h){this.origin=a;this.cellWidth=e.width;this.cellHeight=e.height;this.mapWidth=b.width;this.mapHeight=b.height;this.srInfo=h},setResolution:function(a){this._resolution=(a.xmax-a.xmin)/this.mapWidth;this.srInfo&&(a=Math.round(Math.round(2*this.srInfo.valid[1]/this._resolution)/this.cellWidth),this._frameStats=[a,0,a-1])},setMapState:function(a,e,b){this.mapWidth=e;this.mapHeight=b;this.setResolution(a)},getCellCoordinates:function(a){var c=this._resolution,b=this.origin;return{row:Math.floor((b.y-
a.y)/(this.cellHeight*c)),col:Math.floor((a.x-b.x)/(this.cellWidth*c))}},normalize:function(a){var c=this._frameStats;if(c){var b=c[0],h=c[1],c=c[2];a<h?(a%=b,a=a<h?a+b:a):a>c&&(a%=b)}return a},intersects:function(a,e){var b=this.srInfo;return b?m.some(e._getParts(b),function(b){return a.intersects(b.extent)}):a.intersects(e)},getCellExtent:function(a,k){var b=this._resolution,h=this.origin,c=this.cellWidth,d=this.cellHeight;return new e(k*c*b+h.x,h.y-(a+1)*d*b,(k+1)*c*b+h.x,h.y-a*d*b,w.createSpatialReference(h.spatialReference.toJson()))},
getLatticeID:function(a){var c=this.getCellCoordinates({x:a.xmin,y:a.ymax}),b=this.getCellCoordinates({x:a.xmax,y:a.ymin});a=c.row;var h=b.row,c=this.normalize(c.col),b=this.normalize(b.col);return a+"_"+h+"_"+c+"_"+b},sorter:function(a,e){return a<e?-1:1},getCellsInExtent:function(a,e){var b=this.getCellCoordinates({x:a.xmin,y:a.ymax}),h=this.getCellCoordinates({x:a.xmax,y:a.ymin}),c=b.row,d=h.row,b=b.col,h=h.col,g=[],l,f,n,q=[],p=[],y,v,u,H,C=[];for(l=c;l<=d;l++)for(f=b;f<=h;f++)n=this.normalize(f),
a=this.getCellExtent(l,n),m.some(g,function(a){return a.row===l&&a.col===n})||g.push({row:l,col:n,extent:a,resolution:this._resolution}),e&&(q.push(a.xmin,a.xmax),p.push(a.ymin,a.ymax));b=this.normalize(b);h=this.normalize(h);q.sort(this.sorter);p.sort(this.sorter);f=q.length;for(l=f-1;0<=l;l--)l<f-1&&q[l]===q[l+1]&&q.splice(l,1);f=p.length;for(l=f-1;0<=l;l--)l<f-1&&p[l]===p[l+1]&&p.splice(l,1);if(q.length&&p.length){y=q[0];v=q[q.length-1];u=p[0];H=p[p.length-1];f=q.length;for(l=0;l<f;l++)C.push([[q[l],
H],[q[l],u]]);f=p.length;for(l=0;l<f;l++)C.push([[y,p[l]],[v,p[l]]]);q=new k({paths:C,spatialReference:this.origin.spatialReference.toJson()});g.push({latticeID:c+"_"+d+"_"+b+"_"+h,lattice:q,resolution:this._resolution})}return{minRow:c,maxRow:d,minCol:b,maxCol:h,cells:g}}});r("extend-esri")&&n.setObject("layers._GridLayout",p,f);return p})},"esri/layers/SelectionMode":function(){define(["dojo/_base/declare","dojo/_base/lang","dojo/has","../kernel","./RenderMode"],function(p,n,m,r,f){p=p([f],{declaredClass:"esri.layers._SelectionMode",
constructor:function(a){this.featureLayer=a;this._featureMap={}},propertyChangeHandler:function(a){this._init&&0===a&&this._applyTimeFilter()},resume:function(){this.propertyChangeHandler(0)},hasAllFeatures:function(){return!this.featureLayer._hasPartialSelectedFeatures}});m("extend-esri")&&n.setObject("layers._SelectionMode",p,r);return p})},"esri/layers/StreamMode":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/Deferred dojo/has ../kernel ../SpatialReference ../tasks/query ../tasks/QueryTask ../geometry/jsonUtils ./RenderMode".split(" "),
function(p,n,m,r,f,a,e,k,w,c,q){p=p([q],{declaredClass:"esri.layers._StreamMode",constructor:function(a,h){this.featureLayer=a;this._featureMap={};this._setRefreshRate();this._drawBuffer={adds:[],updates:[]};this._timeoutId=null;this._flushDrawBuffer=n.hitch(this,this._flushDrawBuffer);this._featuresByTime={};this._lastEndTimeCheck=null;this._maxFeatureAge=0;a.purgeOptions&&a.purgeOptions.age&&"number"===typeof a.purgeOptions.age&&(this._maxFeatureAge=1E3*Math.ceil(60*a.purgeOptions.age));this._drawFeatures=
n.hitch(this,this._drawFeatures);this._queryErrorHandler=n.hitch(this,this._queryErrorHandler)},startup:function(){this._started||this.inherited(arguments)},propertyChangeHandler:function(a){this._init&&(0===a?this._applyTimeFilter():3===a?this._redrawAllTracks():console.debug("StreamLayer: Stream Layer only supports changing map time or maximumTrackPoints. Layer id \x3d "+this.featureLayer.id))},destroy:function(){this.inherited(arguments);clearTimeout(this._timeoutId);this._featuresByTime=this._drawBuffer=
this._featureMap=null},drawFeature:function(a){var b=this.featureLayer,c=b.objectIdField;this._timeoutId||(this._timeoutId=setTimeout(this._flushDrawBuffer,this._refreshRate));b._joinField&&this._getFeature(a.attributes[c])?this._drawBuffer.updates.push({oid:a.attributes[c],updates:a}):this._drawBuffer.adds.push(a)},resume:function(){this.propertyChangeHandler(0)},refresh:function(){this._pendingRequest&&this._cancelPendingRequest(this._pendingRequest);var a=this.featureLayer;a&&(a._relatedUrl||a._keepLatestUrl?
(a._fireUpdateStart(),a._refreshing=!0,a.disconnect(),a.clear(),a._relatedQueried=!1,a._keepLatestQueried=!1,a.connect()):(a._fireUpdateStart(),a.clear(),a._fireUpdateEnd()))},_drawFeatures:function(a,h){var b=this.featureLayer;b._create(a.features||[]);b._fireUpdateEnd(null,h)},_applyTimeFilter:function(a){this.inherited(arguments);this._redrawAllTracks()},_removeFeatures:function(a){var b=this.featureLayer,c=b.objectIdField;a&&m.forEach(a,function(a){a=a.attributes[c];b._unSelectFeatureIIf(a,this);
this._decRefCount(a);this._removeFeatureIIf(a)},this)},_addFeatures:function(a){var b=this.featureLayer,c=b._endTimeField,d=b._startTimeField,g,l,e,k=[],f=[],q=[];g=b._trackManager;l=b.objectIdField;if(g)for(e in a=g.addFeatures(a),a)a.hasOwnProperty(e)&&(k.push(e),a[e].adds&&(f=f.concat(a[e].adds)),a[e].deletes&&(q=q.concat(a[e].deletes)));else f=a;m.forEach(f,function(a){var b=a.attributes[l],u;u=c&&a.attributes[c];!u&&this._maxFeatureAge&&(u=d&&a.attributes[d]?a.attributes[d]+this._maxFeatureAge:
Date.now()+this._maxFeatureAge);u&&(u=1E3*Math.ceil(u/1E3),this._featuresByTime[u]?this._featuresByTime[u].push(b):this._featuresByTime[u]=[b]);this._addFeatureIIf(b,a);this._incRefCount(b)},this);q.length&&this._removeFeatures(q);g&&g.refreshTracks(k)},_updateFeatures:function(a){var b=this.featureLayer,c,d,g=[];c=b._trackManager;d=b._trackIdField;m.forEach(a,function(a){var l=a.updates;a=this._getFeature(a.oid);var h;if(a){l.geometry&&a.setGeometry(l.geometry);l=l.attributes||{};for(h in l)l.hasOwnProperty(h)&&
(a.attributes[h]=l[h]);a.setAttributes(a.attributes);a.visible=this._checkFeatureTimeIntersects(a);c&&a.attributes[d]?g.push(a.attributes[d]):b._repaint(a,null,!0)}},this);g.length&&c.refreshTracks(g)},_redrawAllTracks:function(){var a=this.featureLayer._trackManager,h;a&&(h=a.trimTracks())&&0<h.length&&(this._removeFeatures(h),a.refreshTracks())},_flushDrawBuffer:function(){clearTimeout(this._timeoutId);var a=this._drawBuffer,h=a.adds.splice(0,a.adds.length),c=a.updates.splice(0,a.updates.length),
a=this.featureLayer;if(!a)return!1;a.updating||a._fireUpdateStart();this._addFeatures(h);this._updateFeatures(c);(h=this._getExpiredFeatures())&&h.length&&(this._removeFeatures(h),a._trackManager&&a._trackManager.removeFeatures(h));a._purge();a._fireUpdateEnd();this._timeoutId=null},_clearDrawBuffer:function(){var a=this._timeoutId,h=this._drawBuffer,c=h.adds,h=h.updates;a&&clearTimeout(a);c.splice(0,c.length);h.splice(0,h.length);this._timeoutId=null},_clearTimeBin:function(){this._featuresByTime=
{};this._lastEndTimeCheck=1E3*Math.ceil(Date.now()/1E3)},_clearFeatureMap:function(){this._featureMap={}},_setRefreshRate:function(a){a=a||0===a?a:200;0>a&&(a=200);this._refreshRate=a},_checkFeatureTimeIntersects:function(a){var b=this.featureLayer,c=b.getMap();return(c=c?c.timeExtent:null)&&b.timeInfo&&(b.timeInfo.startTimeField||b.timeInfo.endTimeField)?0<b._filterByTime([a],c.startTime,c.endTime).match.length:!0},_fetchArchive:function(a){var b=new r,f=this.featureLayer,d,g,l,q,n;this._pendingRequest&&
this._cancelPendingRequest(this._pendingRequest);f._fireUpdateStart();a&&this.map?(a=new w(a),d=new k,g=this.map,l=f.getFilter()||{},q=l.where||"1\x3d1",n=l.geometry?c.fromJson(l.geometry):null,l=l.outFields?l.outFields.split(","):["*"],d.geometry=n,d.where=q,d.outFields=l,d.returnGeometry=!0,d.outSpatialReference=new e(g.spatialReference.toJson()),this._pendingRequest=a.execute(d).then(function(a){this._pendingRequest=null;var d=this._fixFieldNameCasing(f,a);a.features=d;this._drawFeatures(a);f._fireUpdateEnd();
b.resolve()}.bind(this)).otherwise(function(a){this._pendingRequest=null;f._errorHandler(a);f._fireUpdateEnd(a);b.reject(a)}.bind(this))):b.resolve();return b.promise},_queryErrorHandler:function(a){var b=this.featureLayer;b._errorHandler(a);b._fireUpdateEnd(a)},_fixFieldNameCasing:function(a,c){var b=c.features||[],d=c.fields;if(!d||!b.length)return b;for(var d=this._mapFieldNameDifferences(a.fields,d),g=[],l,h,e=0,k=c.features.length;e<k;e++)l=b[e],h=this._swizzleResponseAttributes(l.attributes,
d),g.push({geometry:l.geometry,attributes:h});return g},_mapFieldNameDifferences:function(a,c){var b=[],d={},g,l;g=0;for(l=c.length;g<l;g++)b.push(c[g].name);g=0;for(l=a.length;g<l;g++){var h=a[g].name,e=this._checkForStreamFieldName(h,b);e&&(d[e]=h)}return d},_checkForStreamFieldName:function(a,c){for(var b=a.toLowerCase(),d,g=0,l=c.length;g<l;g++)if(c[g].toLowerCase()===b){d=c[g];break}return d},_swizzleResponseAttributes:function(a,c){var b={},d;for(d in a)if(a.hasOwnProperty(d)){var g=a[d];c.hasOwnProperty(d)?
b[c[d]]=g:b[d]=g}return b},_getExpiredFeatures:function(){var a,c,e,d=[],g=[];if(!this.featureLayer._endTimeField&&!this._maxFeatureAge)return g;a=1E3*Math.floor(this._lastEndTimeCheck/1E3);this._lastEndTimeCheck=c=1E3*Math.ceil(Date.now()/1E3);if(a&&a!==c)for(e=this._featuresByTime;a<=c;a+=1E3)e[a]&&(d=d.concat(e[a]),delete e[a]);m.forEach(d,function(a){(a=this._getFeature(a))&&g.push(a)},this);return g}});f("extend-esri")&&n.setObject("layers._StreamMode",p,a);return p})},"esri/layers/TrackManager":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/has dojo/dom-construct dojox/gfx ../kernel ../graphic ../geometry/Polyline ./GraphicsLayer".split(" "),
function(p,n,m,r,f,a,e,k,w,c){var q=-1!==a.renderer.toLowerCase().indexOf("canvas");p=p(null,{declaredClass:"esri.layers._TrackManager",constructor:function(a){this.layer=a;this.trackMap={};this.trackLineMap={}},initialize:function(a){this.map=a;var b=this.layer,e=b._getRenderer(),e=e&&e.trackRenderer;if("esriGeometryPoint"===b.geometryType){var d=this.container=new c._GraphicsLayer({id:b.id+"_tracks",_child:!0,visible:b.visible,minScale:b.minScale,maxScale:b.maxScale});d.loaded=!0;d.onLoad(d);d._setMap(a,
b._div);if(!q){a=d._div.getNode();var g=b._div.getNode();a&&g&&f.place(a,g,"first")}d.setRenderer(e);b.on("visibility-change",n.hitch(this,function(a){this.container.setVisibility(a.visible);this.container.evaluateSuspension()}));b.on("scale-range-change",n.hitch(this,function(){this.container.setScaleRange(this.layer.minScale,this.layer.maxScale)}))}},addFeatures:function(a){var b=this.trackMap,c=this.layer,d=c._trackIdField,g=[];m.forEach(a,function(a){var l=a.attributes[d];(b[l]=b[l]||[]).push(a);
-1===m.indexOf(g,l)&&g.push(l)});var l=c._startTimeField,e=c.objectIdField,k=function(a,b){var d=a.attributes[l],g=b.attributes[l];return d===g?a.attributes[e]<b.attributes[e]?-1:1:d<g?-1:1};m.forEach(g,function(a){b[a].sort(k)})},trimTracks:function(a){function b(a){for(a=c[a]||[];a.length>d;)g.push(a.shift())}var c=this.trackMap,d=this.layer.maximumTrackPoints||0,g=[],l;if(!d)return g;if(a)m.forEach(a,function(a){b(a)});else for(l in c)c.hasOwnProperty(l)&&b(l);return g},drawTracks:function(a){function b(a){var b=
g[a],h,f,u;f=c.trackLineMap[a];d.remove(f);delete c.trackLineMap[a];f=null;if(!b||2>b.length)return!1;f=[];for(h=b.length-1;0<=h;h--)(u=b[h].geometry)&&f.push([u.x,u.y]);b={};b[e]=a;1<f.length&&(f=new k(new w({paths:[f],spatialReference:l}),null,b),d.add(f),c.trackLineMap[a]=f)}var c=this,d=this.container,g,l,e,f;if(d)if(g=this.trackMap,l=this.map.spatialReference,e=this.layer._trackIdField,a)m.forEach(a,function(a){b(a)});else for(f in g)g.hasOwnProperty(f)&&b(f)},refreshTracks:function(a){function b(a){var b,
e;c.drawTracks([a]);if(l&&l.latestObservationRenderer)for(a=d[a]||[],b=a.length,e=0;e<b;e++)g._repaint(a[e],null,!0)}var c=this,d=this.trackMap,g=this.layer,l=g._getRenderer(),e;if(a)m.forEach(a,function(a){b(a)});else for(e in d)d.hasOwnProperty(e)&&b(e);this.moveLatestToFront()},moveLatestToFront:function(a){m.forEach(this.getLatestObservations(a),function(a){var b=a._shape;b&&b._moveToFront();this._repaint(a,null,!0)},this.layer)},getLatestObservations:function(a){function b(a){a=g[a];return a[a.length-
1]}var c=[],d=this.layer._getRenderer(),g=this.trackMap,l;if(!d.latestObservationRenderer)return c;if(a)m.forEach(a,function(a){c.push(b(a))});else for(l in g)g.hasOwnProperty(l)&&c.push(b(l));return c},clearTracks:function(a){var b=this.getLatestObservations(a),c=this.container,d;a?m.forEach(a,function(a){delete this.trackMap[a];c&&(d=this.trackLineMap[a],c.remove(d),delete this.trackLineMap[a])},this):(this.trackMap={},this.trackLineMap={},c&&c.clear());m.forEach(b,function(a){this._repaint(a,null,
!0)},this.layer)},isLatestObservation:function(a){var b=this.trackMap[a.attributes[this.layer._trackIdField]];return b?b[b.length-1]===a:!1},destroy:function(){var a=this.container;a&&(a.clear(),a._unsetMap(this.map,this.layer._div));this.map=this.layer=this.trackMap=this.container=null}});r("extend-esri")&&n.setObject("layers._TrackManager",p,e);return p})},"esri/layers/HeatmapManager":function(){define("dojo/_base/declare dojo/_base/lang dojo/aspect dojo/_base/array require ../kernel ../sniff ../geometry/Point ../geometry/webMercatorUtils ./MapImage ../renderers/HeatmapRenderer ../tasks/query dojo/_base/fx".split(" "),
function(p,n,m,r,f,a,e,k,w,c,q,b,h){function x(){}function d(a){var b=a.layer;return{geometry:a.geometry,attributes:a.attributes,getLayer:function(){return b}}}p=p(null,{declaredClass:"esri.layers.HeatmapManager",heatmapRenderer:null,sourceLayer:null,imageLayer:null,useTiles:!0,useWorker:!1,map:null,constructor:function(a){this.sourceLayer=a;this._hndls=[]},initialize:function(a){this.map=a;var b=this.sourceLayer,d=b.renderer;b.setDrawMode(!1);this.imageLayer=a._getMapImageLyr();var g=this;this.heatmapRenderer=
d instanceof q?d:(d.getRendererInfoByZoom(a.getZoom())||d.getRendererInfoByScale(a.getScale())).renderer;this._setupDraw=this._setupDraw.bind(this);this.recalculateHeatmap=this.recalculateHeatmap.bind(this);this._removeRenderer=this._removeRenderer.bind(this);this._handleRendererChange=this._handleRendererChange.bind(this);this._rendererChangeHandle=this.sourceLayer.on("renderer-change",this._handleRendererChange);this._handleOpacityChange=this._handleOpacityChange.bind(this);this._reprojectFeature=
this._reprojectFeature.bind(this);f(["../workers/heatmapCalculator"],function(a){g._calculator=new a(n.mixin({width:g.map.width,height:g.map.height},g._getOptions()));g._setupRenderer();g.heatmapRenderer.getStats=a.calculateStats;g.heatmapRenderer.getHistogramData=a.getHistogramData})},destroy:function(){this._removeHandlers();this._rendererChangeHandle&&this._rendererChangeHandle.remove();this._rendererChangeHandle=this.sourceLayer=this.imageLayer=this.map=this.heatmapRenderer=this._hndls=null},
_handleRendererChange:function(a){var b=a.renderer,d=b instanceof q;this.heatmapRenderer?d?this.heatmapRenderer=b:this._removeRenderer(a):d&&(this.heatmapRenderer=b,this.sourceLayer&&this.map&&this._setupRenderer())},_handleOpacityChange:function(a){a=a.opacity;var b=this._getImageBySourceId(this.sourceLayer.id);b&&b.setOpacity(a)},_setupRenderer:function(){var a=this._hndls,b=this.sourceLayer,d=this.map,c=this;b._originalDraw=b._draw;b._draw=x;b._div.clear();clearTimeout(this._resetTimer);this._resetTimer=
setTimeout(this._resetGraphics.bind(this),250);a.push(b.on("update-end",this._setupDraw));a.push(b.on("suspend",function(a){(a=c._getImageBySourceId(c.sourceLayer.id))&&a.hide()}));a.push(b.on("resume",function(a){(a=c._getImageBySourceId(c.sourceLayer.id))&&a.show()}));a.push(m.after(b,"redraw",this._setupDraw));a.push(d.on("layer-remove",function(a){a.layer==b&&((a=c._getImageBySourceId(c.sourceLayer.id))&&c.imageLayer.removeImage(a),c._removeRenderer({target:b}))}));b._collection&&a.push(b.on("graphic-add",
function(a){c._reprojectFeature(a.graphic);c._setupDraw()}));1!==b.mode&&(a.push(d.on("resize, pan-end",this._setupDraw)),a.push(d.on("zoom-end",this._setupDraw)));a.push(b.on("opacity-change",this._handleOpacityChange));this.imageLayer.suspended&&this.imageLayer.resume();b.graphics&&b.graphics.length&&(b.graphics[0].geometry&&!d.spatialReference.equals(b.graphics[0].geometry.spatialReference)&&r.forEach(b.graphics,function(a){this._reprojectFeature(a)}.bind(this)),this._setupDraw())},_setupDraw:function(){if(!this._drawTimer){var a=
this;this._drawTimer=setTimeout(function(){clearTimeout(a._drawTimer);a._drawTimer=null;a.sourceLayer._getRenderer().isInstanceOf(q)&&a.recalculateHeatmap()},16)}},_removeRenderer:function(a){var b=a.target;b._draw=b._originalDraw;delete b._originalDraw;b.setDrawMode(!0);this._removeHandlers();this._hndls=[];var d=this._getImageBySourceId(this.sourceLayer.id);d&&this.imageLayer.removeImage(d);clearTimeout(this._drawTimer);clearTimeout(this._resetTimer);this._drawTimer=this._resetTimer=null;b.renderer!=
a.renderer&&b.renderer.getRendererInfo?this.heatmapRenderer=null:(b.redraw(),this.destroy())},recalculateHeatmap:function(){this._calculator?this._doMainCalculation():this._calculatorClient&&this._doWorkerCalculation()},_reprojectFeature:function(a){if(a&&a.geometry){var b=a.geometry,d=this.map.spatialReference;d.equals(b.spatialReference)||(b=w.project(b,d),null==b?console.log("Unable to reproject features to map's spatial reference. Please convert feature geometry before adding to layer"):a.geometry=
b)}},_doWorkerCalculation:function(){},_doMainCalculation:function(){var a=this.sourceLayer,l=this.map,e=this.heatmapRenderer,h=this.map.extent,f=this.map.width,k=this.map.height,y=this._calculator,v=this,u=function(b){b=v._getScreenPoints(b.features,l,a);b=y.calculateImageData(n.mixin({screenPoints:b,mapinfo:{extent:[h.xmin,h.ymin,h.xmax,h.ymax],resolution:l.getResolution()},width:f,height:k},v._getOptions()));b=e.getSymbol(d({geometry:l.extent,attributes:{size:[f,k],imageData:b},layer:a}));b=new c({extent:l.extent,
href:b.url,opacity:0,sourceId:a.id});v._swapMapImages(b,v._getImageBySourceId(a.id));a.suspended&&b.hide()},H={geometry:l.extent,timeExtent:a.useMapTime?l.timeExtent:void 0,spatialRelationship:b.SPATIAL_REL_INTERSECTS};null!=a._canDoClientSideQuery(H)?a.queryFeatures(H,u):u({features:a.graphics})},_getScreenPoints:function(a,b,d){var c=[],g=a.length,l=0,e=0,h,u=new k(b.extent.xmin,b.extent.ymax,b.spatialReference),H=b.toScreen(u),C=H.x,H=H.y,F=b.getResolution(),f;for((e=b.extent.getCacheValue("_parts"))&&
(f=r.map(e,function(a){return d._intersects(b,a.extent)[0]}));g--;)e=a[g],e.geometry&&(h={x:Math.ceil((e.geometry.x-u.x)/F+C),y:Math.floor((u.y-e.geometry.y)/F-H),attributes:e.attributes},f&&(e=1<f.length&&h.x<-f[0]?f[1]:f[0],h.x+=e),c[l++]=h);return c},_getImageBySourceId:function(a){var b=this.imageLayer.getImages(),b=r.filter(b,function(b){return b.sourceId==a});if(b.length)return b[b.length-1]},_swapMapImages:function(a,b){function d(){c.removeImage(b)}var c=this.imageLayer,g=this.sourceLayer.opacity;
c.addImage(a);h.anim(a._node,{opacity:g},null,null,function(){a.opacity=g});null!=b&&h.anim(b._node,{opacity:0},null,null,d)},_removeHandlers:function(){if(null!=this._hndls)for(var a=this._hndls.length;a--;)this._hndls[a].remove()},_getOptions:function(){var a=this.heatmapRenderer;return{blurRadius:a.blurRadius,gradient:a.gradient,maxPixelIntensity:a.maxPixelIntensity,minPixelIntensity:a.minPixelIntensity,field:a.field,fieldOffset:a.fieldOffset}},_resetGraphics:function(){clearTimeout(this._resetTimer);
this._resetTimer=null;for(var a=this.sourceLayer.graphics,b=a.length,d;b--;)d=a[b],d._shape=d._offsets=void 0}});e("extend-esri")&&n.setObject("layers.HeatmapManager",p,a);return p})},"esri/layers/clustering/ClusterManager":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/has ../../kernel ../../Evented ../../graphic ../../lang ../../Color ../../graphicsUtils ../../dijit/PopupTemplate ../../dijit/Legend/utils ../../renderers/ClassBreaksRenderer ../../symbols/SimpleMarkerSymbol ../GraphicsLayer ../Field ./GeohashAggregation ./statUtils dojo/i18n!../../nls/jsapi".split(" "),
function(p,n,m,r,f,a,e,k,w,c,q,b,h,x,d,g,l,B,E){var z=E.layers.clusters,D=E.widgets.popup,y=z.numFeatures,v=Math.pow(2,53)-1;p=p(a,{declaredClass:"esri.layers.clustering.ClusterManager",layer:null,aggregationInfo:null,container:null,defaults:{clusterRadius:80,markerSymbol:{color:[77,77,77,255],size:6,angle:0,xoffset:0,yoffset:0,type:"esriSMS",style:"esriSMSCircle",outline:{color:[255,255,255,255],width:.75,type:"esriSLS",style:"esriSLSSolid"}}},_initialized:!1,_map:null,_eventHandles:null,_clusterRadius:null,
_renderer:null,_statisticInfos:null,_fields:null,_infoTemplate:null,_clusterGenerator:null,_singleGraphics:null,constructor:function(a){this._eventHandles=[];this.layer=a.layer;this.setAggregationInfo(a.aggregationInfo)},initialize:function(a){this._initialized=!0;this._map=a;this.container=this._createContainer();this._clusterGenerator=this._createClusterGenerator();this._initClusterGenerator();this._createLayerEventListeners();this._createMapEventListeners();this._createPopupEventListeners()},destroy:function(a){this._clearSingleGraphics();
this._removeClusterBoundary();this._destroyEventListeners();this._removeFromPopup(this.container);this._removeFromPopup(this.layer);this._resetClusterNav();this._destroyClusterGenerator(a);this._destroyContainer();this.layer=this.aggregationInfo=this._map=null},setAggregationInfo:function(a){this.aggregationInfo=a?n.mixin({},a):null;this._applyAggregationInfo()},getClusterRenderer:function(){return this._renderer},getClusterFields:function(){return this._fields||[]},getFeaturesInCluster:function(a){a=
a&&a.getAggregationInfo();return this._clusterGenerator?this._clusterGenerator.getFeaturesInCluster(a):[]},getAggregateGraphics:function(){return this.container?this.container.graphics.slice(0):[]},getSingleGraphics:function(){return this._singleGraphics?this._singleGraphics.slice(0):[]},redraw:function(){this.container&&this.container.redraw()},isClusteringEnabled:function(){return!(!this._clusterGenerator||!this._clusterGenerator.clustersEnabled)},isClusteringActive:function(){return!!(this._clusterGenerator&&
0<this._clusterGenerator.getNumFeatures())},_createContainer:function(){var a=this.layer,b=new d._GraphicsLayer({_child:!0,id:a.id+"_clusters",visible:a.visible,minScale:a.minScale,maxScale:a.maxScale,infoTemplate:this._infoTemplate});b.fields=this._fields;b.setRenderer(this._renderer);b.loaded=!0;b.onLoad(b);b._setMap(this._map,a._div);return a._childLayer=b},_destroyContainer:function(){var a=this.container;a&&(a.clear(),a._unsetMap(this._map,this.layer._div),this.layer._childLayer=null);this.container=
null},_createClusterGenerator:function(){return new l({map:this._map,layer:this.layer,clusterRadius:this._clusterRadius,statisticInfos:this._statisticInfos})},_initClusterGenerator:function(){var a=this._clusterGenerator;a.loaded?(this._applyRenderer(),this._initClusterUpdates()):this._eventHandles.push(a.on("load",n.hitch(this,function(){this._applyRenderer();this._initClusterUpdates()})),a.on("load-error",n.hitch(this,function(a){console.log(a.error)})))},_destroyClusterGenerator:function(a){this._clusterGenerator&&
this._clusterGenerator.destroy(a);this._clusterGenerator=null},_applyAggregationInfo:function(){this._applyClusterRadius();this._applyRenderer();this._clusterGenerator&&!this._clusterGenerator.isUpdateScheduled()&&this.redraw()},_applyClusterRadius:function(){var a=this.aggregationInfo;this._clusterRadius=a&&a.clusterRadius||this.defaults.clusterRadius;this._clusterGenerator&&this._clusterGenerator.setClusterRadius(this._clusterRadius);this._computeClusterRadius()},_computeClusterRadius:function(){var a=
this.aggregationInfo||{};a.clusterRadius=this._clusterRadius;this.aggregationInfo=a},_applyRenderer:function(){var a=this.container,b=this._getClusterRendererInfo(),d=this._compareStatInfos(this._statisticInfos,b.statisticInfos);d&&(this._statisticInfos=b.statisticInfos,this._clusterGenerator&&(this._clusterGenerator.setStatisticInfos(m.map(this._statisticInfos,function(a){return{attributeInfo:a.attributeInfo,statisticType:a.statisticType}})),a&&m.forEach(a.graphics,function(a){this._applyClusterAttributes(a,
a.getAggregationInfo())},this)));this._renderer=b.renderer;this._applyFields();this._applyInfoTemplate(!!d&&this._initialized);a&&(a.setRenderer(this._renderer),this.emit("renderer-change"))},_applyFields:function(){this._fields=this._getFields(this._statisticInfos);this.container&&(this.container.fields=this._fields)},_applyInfoTemplate:function(a){if(this.layer.infoTemplate){var b=this.aggregationInfo,b=b&&b.infoTemplate||this._infoTemplate;a=a||!b?this._createInfoTemplate():this._updateInfoTemplate(b)}else a=
null;this._infoTemplate=a;this.container&&this.container.setInfoTemplate(this._infoTemplate);this._computeInfoTemplate()},_computeInfoTemplate:function(){var a=this.aggregationInfo||{};a.infoTemplate=this._infoTemplate;this.aggregationInfo=a},_getClusterRendererInfo:function(){var a=this.layer&&this.layer.renderer;return a?this._createClusterRenderer(a):this._getDefaultClusterRenderer()},_getDefaultClusterRenderer:function(){var a=this._createContinuousCountRenderer();this._addSizeByCountVariable(a);
return{renderer:a,statisticInfos:[]}},_createContinuousCountRenderer:function(a){var b=new h(null,"cluster_count");b.addBreak({minValue:-v,maxValue:v,symbol:a?new a.constructor(a.toJson()):new x(n.clone(this.defaults.markerSymbol))});return b},_createClusterRenderer:function(a){if(!this._isSupportedRenderer(a))return this._getDefaultClusterRenderer();var b,d=[];if(this._isSimpleRenderer(a))b=this._createContinuousCountRenderer(a.symbol);else{b=new a.constructor(a.toJson());var c=this._getRendererAttributeInfo(a),
u;this._isCBRenderer(b)?(u=B.getClusterField(c,"avg"),d.push(this._getStatInfo(c,"avg")),b.normalizationType=null,b.normalizationField=null,b.normalizationTotal=null):this._isUVRenderer(b)&&(u=B.getClusterField(c,"type"),d.push(this._getStatInfo(c,"type")));b.attributeField=u;b.setValueExpression(null);b.valueExpressionTitle=null;b.setVisualVariables(null);this._setRendererTitle(b,a)}a=this._getSupportedVariables(a);c=this._createClusterVariables(a.allVars,d);b.setVisualVariables(c);a.sizeVars.length||
this._isCBSizeRenderer(b)||this._addSizeByCountVariable(b);return{renderer:b,statisticInfos:d}},_isSupportedRenderer:function(a){if(this._isSimpleRenderer(a))return!0;if(this._isCBRenderer(a)){var b=a.normalizationType;return"function"===typeof a.attributeField||b&&"field"!==b?!1:!0}return this._isUVRenderer(a)?"function"===typeof a.attributeField||a.attributeField2?!1:!0:!1},_isSimpleRenderer:function(a){return-1<a.declaredClass.toLowerCase().indexOf("simplerenderer")},_isCBRenderer:function(a){return-1<
a.declaredClass.toLowerCase().indexOf("classbreaksrenderer")},_isUVRenderer:function(a){return-1<a.declaredClass.toLowerCase().indexOf("uniquevaluerenderer")},_isCBSizeRenderer:function(a){var b=a.infos;if(!this._isCBRenderer(a)||!b||2>b.length)return!1;var d=Infinity,c=-Infinity;m.forEach(b,function(a){if(a=a.symbol){var b=0;switch(a.type){case "simplemarkersymbol":b=a.size;break;case "picturemarkersymbol":b=(a.width+a.height)/2}d=Math.min(d,b);c=Math.max(c,b)}});return Infinity!==d&&-Infinity!==
c&&d!==c},_getRendererAttributeInfo:function(a){var b=a.attributeField,d=b?this.layer.getField(b):null;return{field:b,attributeType:d&&"esriFieldTypeDate"===d.type?"date":null,rotationType:null,valueExpression:a.valueExpression,valueExpressionTitle:a.valueExpressionTitle,normalizationField:a.normalizationField}},_setRendererTitle:function(a,d){a.legendOptions=n.clone(d.legendOptions);a.legendOptions&&a.legendOptions.title||(a.legendOptions=a.legendOptions||{},a.legendOptions.title=b.getRendererTitle(d,
this.layer))},_getSupportedVariables:function(a){var b=a.getVisualVariablesForType("colorInfo",!1)||[],d=a.getVisualVariablesForType("sizeInfo",!1)||[],c=a.getVisualVariablesForType("opacityInfo",!1)||[];a=a.getVisualVariablesForType("rotationInfo",!1)||[];b=m.filter(b,this._variableFilter);d=m.filter(d,this._variableFilter);c=m.filter(c,this._variableFilter);a=m.filter(a,this._variableFilter);return{sizeVars:d,allVars:b.concat(d).concat(c).concat(a)}},_variableFilter:function(a){return"function"!==
typeof a.field},_createClusterVariables:function(a,b){return m.map(a,function(a){return this._createVarForAvg(a,b)},this)},_createVarForAvg:function(a,b){var d=n.clone(a),c=this._getVariableAttributeInfo(a);d.field=B.getClusterField(c,"avg");d.normalizationField=null;d.valueExpression=null;d.valueExpressionTitle=null;c=this._getStatInfo(c,"avg");this._addStatInfo(b,c);this._setVariableTitle(d,a);return d},_getVariableAttributeInfo:function(a){var b="rotationInfo"===a.type,d=b?"angle":null,b=b?a.rotationType:
null,c=a.legendOptions&&a.legendOptions.title,g=a.field,l=g?this.layer.getField(g):null;l&&"esriFieldTypeDate"===l.type&&(d="date");return{field:g,attributeType:d,rotationType:b,valueExpression:a.valueExpression,valueExpressionTitle:a.valueExpressionTitle||a.valueExpression&&c,normalizationField:a.normalizationField}},_setVariableTitle:function(a,d){a.legendOptions&&a.legendOptions.title||(a.legendOptions=a.legendOptions||{},a.legendOptions.title=b.getVisualVariableTitle(d,this.layer))},_getStatInfo:function(a,
b){return{statisticHash:B.getStatisticHash(a,b),attributeInfo:a,statisticType:b}},_addStatInfo:function(a,b){var d=this._findStatInfo(a,b);d?d.attributeInfo.valueExpressionTitle||(d.attributeInfo.valueExpressionTitle=b.attributeInfo.valueExpressionTitle):a.push(b)},_findStatInfo:function(a,b){var d;m.some(a,function(a){a.statisticHash===b.statisticHash&&(d=a);return!!d});return d},_compareStatInfos:function(a,b){var d=m.filter(a,function(a){return!this._findStatInfo(b,a)},this),c=m.filter(b,function(b){return!this._findStatInfo(a,
b)},this);return c.length||d.length?{added:c,removed:d}:null},_addSizeByCountVariable:function(a){var b=this._createSizeByCountVariable();b&&this._addVariable(a,b)},_getSizeByCountVariable:function(a){a=a.getVisualVariablesForType("sizeInfo",!1)||[];return m.filter(a,function(a){return"cluster_count"===a.field})[0]},_updateSizeByCountVariable:function(){var a=this._renderer,b=this._getSizeByCountVariable(a);if(b){var d=this._createSizeByCountVariable();d&&this._replaceVariable(a,b,d)}},_createSizeByCountVariable:function(){var a=
this._clusterGenerator,b;if(a){b=a.getCurrentLodStats();var d=a.getNumFeatures(),a=a.clusters,c=b.min,g=b.max;1===b.count&&c===d||1===a.length&&a[0].count===d?(c=1,g=d):c&&c===g&&(g=2*c);b={type:"sizeInfo",field:"cluster_count",valueUnit:"unknown",minSize:12,maxSize:50,minDataValue:c,maxDataValue:g,legendOptions:{title:y}}}return b},_addVariable:function(a,b){var d=a.visualVariables||[];d.push(b);a.setVisualVariables(d)},_replaceVariable:function(a,b,d){var c=a.visualVariables;b=m.indexOf(c,b);-1<
b&&c.splice(b,1);c.push(d);a.setVisualVariables(c)},_getFields:function(a){var b=[new g({name:"cluster_count",type:"esriFieldTypeInteger"})];m.forEach(a,function(a){var d=a.statisticType;a=a.attributeInfo;var c;"avg"===d?c="date"===a.attributeType?"esriFieldTypeDate":"esriFieldTypeDouble":"type"===d&&(c=a.field?this.layer.getField(a.field).type:"esriFieldTypeString");b.push(new g({name:B.getClusterField(a,d),type:c}))},this);return b},_createInfoTemplate:function(){var a=this._statisticInfos,b=this._renderer,
d=[{fieldName:"cluster_count",label:y,visible:!0,format:{digitSeparator:!0,places:0}}],c=[],g=[k.substitute({count:"{cluster_count}"},z.countSummary)],l=this._isUVRenderer(b)?b.infos:[];m.forEach(a,function(a){var b,e,C=a.statisticType,F=a.attributeInfo,h=B.getClusterField(F,C),f=this._getFieldLabel(a);"avg"===C?(b={fieldName:h,label:f,visible:!0,format:"date"===F.attributeType?{dateFormat:"shortDateShortTime"}:{digitSeparator:!0,places:1}},e=this._getFieldSummary(a,h)):"type"===C&&(e="expression/"+
h,b={fieldName:e,visible:!0},c.push({name:h,title:f,returnType:"string",expression:this._getExpression(l,h)}),e=this._getFieldSummary(a,e));b&&d.push(b);e&&g.push(e)},this);return new q({fieldInfos:d,expressionInfos:c,description:g.join("\x3cbr/\x3e\x3cbr/\x3e")})},_updateInfoTemplate:function(a){var b=a.toJson(),d=this._isUVRenderer(this._renderer)?this._renderer.infos:[];m.forEach(this._statisticInfos,function(a){var c=a.statisticType;a=B.getClusterField(a.attributeInfo,c);"type"===c&&(c=this._findExpressionInfo(a,
b))&&(c.expression=this._getExpression(d,a))},this);return new q(b)},_findExpressionInfo:function(a,b){var d;m.some(b.expressionInfos,function(b){b.name===a&&(d=b);return!!d});return d},_escapeDoubleQuotes:function(a){return a?a.replace(/"/g,'\\"'):""},_getExpression:function(a,b){return["var uvInfos \x3d ["+this._getObjects(a).join(", ")+"];",'var predominantType \x3d Text($feature["'+b+'"]);','var label \x3d "'+this._escapeDoubleQuotes(z.predominantNoneValue)+'";',"for (var i \x3d 0; i \x3c Count(uvInfos); i++) {\nif (uvInfos[i].value \x3d\x3d predominantType) {\nlabel \x3d uvInfos[i].label;\nbreak;\n}\n}\nreturn label;"].join("\n")},
_getObjects:function(a){return m.map(a,function(a){return'{"value": "'+String(a.value)+'","label": "'+this._escapeDoubleQuotes(String(a.label))+'"}'},this)},_getFieldLabel:function(a){var b=a.statisticType,d=a.attributeInfo,c=d.field;a=d.normalizationField;var g="",e;"avg"===b?e=a?z.avgNormFieldLabel:z.avgFieldLabel:"type"===b&&(e=z.predominantFieldLabel);e&&(b=d.valueExpression?d.valueExpressionTitle:this.layer.getFieldLabel(c),a=a&&this.layer.getFieldLabel(a),g=k.substitute({fieldLabel:b||"",normFieldLabel:a||
""},e));return g},_getFieldSummary:function(a,b){var d=a.statisticType,c=a.attributeInfo,g=c.field,e=c.normalizationField,l="",h;"avg"===d?h=e?z.avgNormFieldSummary:z.avgFieldSummary:"type"===d&&(h=z.predominantFieldSummary);h&&(d=c.valueExpression?c.valueExpressionTitle:this.layer.getFieldLabel(g),e=e&&this.layer.getFieldLabel(e),l=k.substitute({fieldLabel:d||"",normFieldLabel:e||"",fieldValue:"{"+b+"}"},h));return l},_removeFromPopup:function(a){var b=this._map.infoWindow,d=b.features;if(d&&d.length){var c=
m.filter(d,function(b){return b.getLayer()!==a});c.length<d.length&&(c.length?b.setFeatures(c):(b.clearFeatures(),b.hide()))}},_resetClusterNav:function(){this._resetClusterNavPartial();this._popupClusterGraphic=null},_resetClusterNavPartial:function(){this._map.infoWindow.removeActions(this._popupActions);this._hideSingleGraphic(this._popupSingleGraphic);this._popupSingleGraphic=null},_addClusterBoundary:function(a,b){var d=b.clusterFillSymbol;d&&(d=new d.constructor(d.toJson()));d=new e(a,d);this._map.graphics.add(d);
this._clusterBoundary=d},_removeClusterBoundary:function(){this._map.graphics.remove(this._clusterBoundary);this._clusterBoundary=null},_createBrowseFeaturesAction:function(){return this._map.infoWindow.addActions([{title:D.NLS_browseFeatures,className:"browseFeatures",callback:n.hitch(this,function(a){a.preventDefault();a=this._map.infoWindow;var b=a.getSelectedFeature(),d=b.getChildGraphics(),g=a.getCurrentAnchor();a.setFeatures(d,{anchor:g});if(d=c.graphicsExtent(d))this._addClusterBoundary(d,
a),a.show(this._getPopupLocation(d,g));this._popupClusterGraphic=b})}])[0]},_getPopupLocation:function(a,b){var d=a.getCenter();b=b.toLowerCase();-1<b.indexOf("top")?d.update(d.x,a.ymax):-1<b.indexOf("bottom")?d.update(d.x,a.ymin):-1<b.indexOf("left")?d.update(a.xmin,d.y):d.update(a.xmax,d.y);return d},_createViewSummaryAction:function(){return this._map.infoWindow.addActions([{title:D.NLS_viewSummary,className:"viewSummary",callback:n.hitch(this,function(a){a.preventDefault();a=this._popupClusterGraphic;
var b=this._map.infoWindow;b.setFeatures([a]);b.show(a.geometry);this._popupClusterGraphic=null})}])[0]},_initClusterUpdates:function(){this._updateSizeVariable();this._updateClusterGraphics();this._eventHandles.push(this._clusterGenerator.on("update-end",n.hitch(this,function(a){a.mapLevelChange&&this._updateSizeVariable();this._updateClusterGraphics()})),this._clusterGenerator.on("index-complete",n.hitch(this,function(){this._updateSizeVariable()})))},_updateClusterGraphics:function(){this._hideSingleGraphics();
var a=[],b=[];m.forEach(this._clusterGenerator.clusters,function(d){var c=new e(d.centroid);c.setAggregationSourceLayer(this.layer);c.setAggregationInfo(d);this._applyClusterAttributes(c,d);1===d.count?(d=this._getSingleGraphic(c),b.push(d)):a.push(c)},this);this._showSingleGraphics(b);this._addGraphics(a)},_addGraphics:function(a){var b=this.container;b.clear();m.forEach(a,function(a){b.add(a)})},_getSingleGraphic:function(a){var b=this._clusterGenerator.getCell(a.getAggregationInfo().primary).features[0],
d=this.layer.renderer,d=d&&d.getSymbol(b),c=this._getSizeByCountVariable(this._renderer);d&&c&&(a=c?this._renderer.getSize(a,{sizeInfo:c,shape:d.style,resolution:this._map.getResolutionInMeters(),scale:this._map.getScale()}):null,b.setSize(a));return b},_showSingleGraphics:function(a){m.forEach(a,this._showSingleGraphic);this._singleGraphics=a},_hideSingleGraphics:function(){m.forEach(this._singleGraphics,function(a){a.setSize(null);this._hideSingleGraphic(a)},this);this._singleGraphics=null},_clearSingleGraphics:function(){m.forEach(this._singleGraphics,
function(a){a.setSize(null)});this._singleGraphics=null},_showSingleGraphic:function(a){a&&(a._suspended=!1,a.draw())},_hideSingleGraphic:function(a){a&&(a._suspended=!0,a.show(),a.draw())},_updateSizeVariable:function(){this.isClusteringEnabled()&&(this._updateSizeByCountVariable(),this.emit("renderer-change"))},_applyClusterAttributes:function(a,b){a.setAttributes(b.attributes)},_createLayerEventListeners:function(){var a=this.layer;this._eventHandles.push(a.on("visibility-change",n.hitch(this,
function(a){this.container.setVisibility(a.visible)})),a.on("scale-range-change",n.hitch(this,function(){this.container.setScaleRange(this.layer.minScale,this.layer.maxScale)})),a.on("renderer-change",n.hitch(this,function(){this._applyRenderer()})),a.on("info-template-change",n.hitch(this,function(){this._applyInfoTemplate()})))},_createMapEventListeners:function(){this._eventHandles.push(this._map.on("zoom-start",n.hitch(this,function(){this._removeClusterBoundary();this._removeFromPopup(this.container);
this._removeFromPopup(this.layer);this._resetClusterNav();this.container.clear();this._hideSingleGraphics()})))},_createPopupEventListeners:function(){var a=this._map.infoWindow;this._eventHandles.push(a.on("selection-change",n.hitch(this,function(){this._resetClusterNavPartial();var a=this._map.infoWindow.getSelectedFeature(),b=a&&a.getLayer();if(b){var d;b===this.container?(this._removeClusterBoundary(),d=this._createBrowseFeaturesAction()):b===this.layer&&a._suspended?(d=this._createViewSummaryAction(),
this._popupSingleGraphic=a,this._showSingleGraphic(a)):this._removeClusterBoundary();this._popupActions=d?[d]:null}})),a.on("clear-features",n.hitch(this,function(a){this._resetClusterNav();a.isIntermediate||this._removeClusterBoundary()})),a.on("hide",n.hitch(this,function(){this._popupSingleGraphic&&this._popupSingleGraphic.hide();this._clusterBoundary&&this._clusterBoundary.hide()})),a.on("show",n.hitch(this,function(){this._popupSingleGraphic&&this._popupSingleGraphic.show();this._clusterBoundary&&
this._clusterBoundary.show()})))},_destroyEventListeners:function(){m.forEach(this._eventHandles,function(a){a.remove()})}});r("extend-esri")&&n.setObject("layers.clustering.ClusterManager",p,f);return p})},"esri/dijit/PopupTemplate":function(){define("dojo/_base/declare dojo/_base/lang dojo/has dojo/dom-construct ../kernel ../InfoTemplate ../PopupInfo ./PopupRenderer".split(" "),function(p,n,m,r,f,a,e,k){p=p([a,e],{declaredClass:"esri.dijit.PopupTemplate","-chains-":{constructor:"manual"},chartTheme:null,
constructor:function(a,c){n.mixin(this,c);this.initialize(a,c)},getTitle:function(a){var c;this.info&&(c=this.titleHasRelatedFields?"":this._getPopupValues(a,null,!0).title);return c||""},getContent:function(a){return this.info?(new k({template:this,graphic:a,chartTheme:this.chartTheme},r.create("div"))).domNode:""}});m("extend-esri")&&n.setObject("dijit.PopupTemplate",p,f);return p})},"esri/PopupInfo":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/_base/json dojo/i18n dojo/has dojo/Deferred dojo/sniff dojo/promise/all dojox/html/entities ./lang ./kernel ./request ./promiseList ./tasks/query ./tasks/QueryTask ./tasks/RelationshipQuery ./tasks/StatisticDefinition ./support/expressionUtils ./layers/support/attributeUtils dojo/i18n!dojo/cldr/nls/number".split(" "),
function(p,n,m,r,f,a,e,k,w,c,q,b,h,x,d,g,l,B,E,z,D){p=p(null,{declaredClass:"esri.PopupInfo",_reExprField:/^\s*expression\//i,_exprPrefix:"expression/",_relatedFieldPrefix:"relationships/",initialize:function(a,b){if(a){n.mixin(this,b);this.info=a;this.title=this.getTitle;this.content=this.getContent;this._exprCache=this._compileExpressions(this.info.expressionInfos);var d=this._fieldLabels={},c=this._fieldsMap={};this.info.fieldInfos&&m.forEach(this.info.fieldInfos,function(a){var b=a.fieldName.toLowerCase(),
g=this._isExpressionField(b)?this.getExpressionInfo(b):null;d[b]=g?g.title:a.label;c[b]=a},this);this.titleHasRelatedFields=!(!this.info.title||-1===this.info.title.indexOf("{"+this._relatedFieldPrefix))}},toJson:function(){return r.fromJson(r.toJson(this.info))},getTitle:function(){},getContent:function(){},getFieldInfo:function(a){var b;m.some(this.info&&this.info.fieldInfos,function(d){d.fieldName===a&&(b=d);return!!b});return b},getExpressionInfo:function(a){if(this._isExpressionField(a)){a=a.replace(this._reExprField,
"");a=a.toLowerCase();var b;m.some(this.info.expressionInfos,function(d){d.name.toLowerCase()===a&&(b=d);return!!b});return b}},hasGeometryOperations:function(){return m.some(this.info.expressionInfos,function(a){return E.hasGeometryOperations(a.expression)})},getComponents:function(a){var b=this.info,d={};b.fieldInfos&&(b=m.filter(b.fieldInfos,function(a){return-1!==a.fieldName.indexOf(this._relatedFieldPrefix)},this))&&0<b.length&&(d.relatedInfo=this._getRelatedRecords({graphic:a,fieldsInfo:b}));
this._needFullResolutionFeature(a)&&(d.fullResolutionFeature=this._getFullResolutionFeature(a));return x(d).then(n.hitch(this,function(b){return this._getPopupValues(a,b.fullResolutionFeature)}))},getAttachments:function(a){var b=a.getSourceLayer();a=a.attributes;if(this.info.showAttachments&&b&&b.hasAttachments&&b.objectIdField&&(a=a&&a[b.objectIdField]))return b.queryAttachmentInfos(a)},_needFullResolutionFeature:function(a){return(a=a.getSourceLayer())?"esriGeometryPoint"!==a.geometryType&&"function"===
typeof a.getMaxAllowableOffset&&0<a.getMaxAllowableOffset()&&this.hasGeometryOperations():!1},_getFullResolutionFeature:function(a){var b=a.getSourceLayer(),c=b.objectIdField;a=(a=a.attributes)&&c&&a[c];if(null==a)return null;var g=new d;g.objectIds=[a];g.maxAllowableOffset=0;g.outFields=[c];return b.queryFeatures(g).then(function(a){return a.features&&a.features[0]})},_isExpressionField:function(a){return this._reExprField.test(a)},_compileExpressions:function(a){var b={};m.forEach(a,function(a){var d=
a.returnType&&a.returnType.toLowerCase();b[a.name]=z.createAttributeCache({valueExpression:a.expression},"number"!==d)});return b},_fetchAttributes:function(a,b){var d=n.clone(a.attributes)||{},g=b&&b.geometry,e=this._exprPrefix,l=this._exprCache;m.forEach(this.info.expressionInfos,function(b){var h=e+b.name;b=(b=l[b.name])?a._getDataValue(b.attributeInfo,b,E,null,g):null;"string"===typeof b&&(b=c.encode(b));d[h]=b});return d},_getPopupValues:function(a,b,d){var c=this.info,g=a.getSourceLayer(),e=
this._fetchAttributes(a,b),l=n.clone(e);b=c.fieldInfos;var h="",f="",k,A,v,y,u,p=g&&g._getDateOpts&&g._getDateOpts().properties,p=p&&p.slice(0),r={dateFormat:{properties:p,formatter:"DateFormat"+this._insertOffset(this._dateFormats.shortDateShortTime)}};if(this._relatedInfo)for(y in this._relatedInfo)if(this._relatedInfo.hasOwnProperty(y)){var w=this._relatedInfo[y],B=this._relatedLayersInfo[y];w&&(m.forEach(w.relatedFeatures,function(a){for(u in a.attributes)if(a.attributes.hasOwnProperty(u)&&"esriRelCardinalityOneToOne"===
B.relation.cardinality){var b=this._toRelatedFieldName([B.relation.id,u]);e[b]=l[b]=a.attributes[u]}},this),m.forEach(w.relatedStatsFeatures,function(a){for(u in a.attributes)if(a.attributes.hasOwnProperty(u)){var b=this._toRelatedFieldName([B.relation.id,u]);e[b]=l[b]=a.attributes[u]}},this))}b&&m.forEach(b,function(a){A=a.fieldName;var b=this._getLayerFieldInfo(g,A);b&&(A=a.fieldName=b.name);l[A]=this._formatValue(l[A],A,r);p&&a.format&&a.format.dateFormat&&(a=m.indexOf(p,A),-1<a&&p.splice(a,1))},
this);if(g){y=g.types;var z=(w=g.typeIdField)&&e[w];for(A in e)if(e.hasOwnProperty(A)&&-1===A.indexOf(this._relatedFieldPrefix)&&(v=e[A],q.isDefined(v))){var E=this._getDomainName(g,a,y,z,A,v);q.isDefined(E)?l[A]=E:A===w&&(E=this._getTypeName(g,a,v),q.isDefined(E)&&(l[A]=E))}}c.title&&(h=this._processFieldsInLinks(this._fixTokens(c.title,g),e),h=n.trim(q.substitute(l,h,r)||""));if(d)return{title:h};c.description&&(f=this._processFieldsInLinks(this._fixTokens(c.description,g),e),f=n.trim(q.substitute(l,
f,r)||""));b&&(k=[],m.forEach(b,function(a){(A=a.fieldName)&&a.visible&&k.push([this._fieldLabels[A.toLowerCase()]||A,q.substitute(l,"${"+A+"}",r)||""])},this));var x,D;c.mediaInfos&&(x=[],m.forEach(c.mediaInfos,function(a){D=0;v=a.value;switch(a.type){case "image":var b=v.sourceURL,b=b&&n.trim(q.substitute(e,this._fixTokens(b,g)));D=!!b;break;case "piechart":case "linechart":case "columnchart":case "barchart":var d,b=v.normalizeField;v.fields=m.map(v.fields,function(a){return(d=this._getLayerFieldInfo(g,
a))?d.name:a},this);b&&(d=this._getLayerFieldInfo(g,b),v.normalizeField=d?d.name:b);D=m.some(v.fields,function(a){return q.isDefined(e[a])||-1!==a.indexOf(this._relatedFieldPrefix)&&this._relatedInfo},this);break;default:return}if(D){a=n.clone(a);v=a.value;var b=a.title?this._processFieldsInLinks(this._fixTokens(a.title,g),e):"",c=a.caption?this._processFieldsInLinks(this._fixTokens(a.caption,g),e):"";a.title=b?n.trim(q.substitute(l,b,r)||""):"";a.caption=c?n.trim(q.substitute(l,c,r)||""):"";if("image"===
a.type)v.sourceURL=q.substitute(e,this._fixTokens(v.sourceURL,g)),v.linkURL&&(v.linkURL=n.trim(q.substitute(e,this._fixTokens(v.linkURL,g))||""));else{var h,f;m.forEach(v.fields,function(a,b){if(-1!==a.indexOf(this._relatedFieldPrefix))f=this._getRelatedChartInfos(a,v,e,r),f instanceof Array?v.fields=f:v.fields[b]=f;else{var d=e[a],d=void 0===d?null:d;h=e[v.normalizeField]||0;d&&h&&(d/=h);v.fields[b]={y:d,tooltip:(this._fieldLabels[a.toLowerCase()]||a)+":\x3cbr/\x3e"+this._formatValue(d,a,r,!!h)}}},
this)}x.push(a)}},this));return{title:h,description:f,hasDescription:!!c.description,fields:k&&k.length?k:null,mediaInfos:x&&x.length?x:null,formatted:l,editSummary:g&&g.getEditSummary?g.getEditSummary(a):""}},_getRelatedChartInfos:function(a,b,d,c){var g,e,l,h,f,k;g=[];k=this._fromRelatedFieldName(a);f=k[0];e=this._relatedInfo[f];f=this._relatedLayersInfo[f];e&&m.forEach(e.relatedFeatures,function(e){e=e.attributes;var f,F;for(F in e)if(e.hasOwnProperty(F)&&F===k[1]){f={};h=e[F];b.normalizeField&&
(l=-1!==b.normalizeField.indexOf(this._relatedFieldPrefix)?e[this._fromRelatedFieldName(b.normalizeField)[1]]:d[b.normalizeField]);h&&l&&(h/=l);if(b.tooltipField)if(-1!==b.tooltipField.indexOf(this._relatedFieldPrefix)){var C=this._fromRelatedFieldName(b.tooltipField)[1],I=q.isDefined(e[C])?e[C]:C;f.tooltip=I+":\x3cbr/\x3e"+this._formatValue(h,C,c,!!l)}else f.tooltip=(this._fieldLabels[a.toLowerCase()]||a)+":\x3cbr/\x3e"+this._formatValue(h,b.tooltipField,c,!!l);else f.tooltip=h;f.y=h;g.push(f)}},
this);return"esriRelCardinalityOneToMany"===f.relation.cardinality||"esriRelCardinalityManyToMany"===f.relation.cardinality?g:g[0]},_dateFormats:{shortDate:"(datePattern: 'M/d/y', selector: 'date')",shortDateLE:"(datePattern: 'd/M/y', selector: 'date')",longMonthDayYear:"(datePattern: 'MMMM d, y', selector: 'date')",dayShortMonthYear:"(datePattern: 'd MMM y', selector: 'date')",longDate:"(datePattern: 'EEEE, MMMM d, y', selector: 'date')",shortDateShortTime:"(datePattern: 'M/d/y', timePattern: 'h:mm a', selector: 'date and time')",
shortDateLEShortTime:"(datePattern: 'd/M/y', timePattern: 'h:mm a', selector: 'date and time')",shortDateShortTime24:"(datePattern: 'M/d/y', timePattern: 'H:mm', selector: 'date and time')",shortDateLEShortTime24:"(datePattern: 'd/M/y', timePattern: 'H:mm', selector: 'date and time')",shortDateLongTime:"(datePattern: 'M/d/y', timePattern: 'h:mm:ss a', selector: 'date and time')",shortDateLELongTime:"(datePattern: 'd/M/y', timePattern: 'h:mm:ss a', selector: 'date and time')",shortDateLongTime24:"(datePattern: 'M/d/y', timePattern: 'H:mm:ss', selector: 'date and time')",
shortDateLELongTime24:"(datePattern: 'd/M/y', timePattern: 'H:mm:ss', selector: 'date and time')",longMonthYear:"(datePattern: 'MMMM y', selector: 'date')",shortMonthYear:"(datePattern: 'MMM y', selector: 'date')",year:"(datePattern: 'y', selector: 'date')"},_reHref:/href\s*=\s*\"([^\"]+)\"/ig,_reHrefApos:/href\s*=\s*\'([^\']+)\'/ig,_reEmptyHref:/^href\s*=\s*"\s*"$/i,_reEmptyHrefApos:/^href\s*=\s*'\s*'$/i,_fixTokens:function(a,b){var d=this;return a.replace(/(\{([^\{\r\n]+)\})/g,function(a,c,g){a=
d._getLayerFieldInfo(b,g);return"$"+(a?"{"+a.name+"}":c)})},_encodeAttributes:function(a){a=n.clone(a)||{};var b,d;for(b in a)(d=a[b])&&"string"===typeof d&&(d=encodeURIComponent(d).replace(/\'/g,"\x26apos;"),a[b]=d);return a},_processFieldsInLinks:function(a,b){var d=this._encodeAttributes(b),d=n.hitch(this,this._addValuesToHref,b,d);a&&(a=a.replace(this._reHref,d).replace(this._reHrefApos,d));return a},_addValuesToHref:function(a,b,d,c){c=c&&n.trim(c);d=q.substitute(c&&0===c.indexOf("${")?a:b,d);
this._reEmptyHref.test(d)?d='href\x3d"about:blank"':this._reEmptyHrefApos.test(d)&&(d="href\x3d'about:blank'");return d},_getLayerFieldInfo:function(a,b){return a&&a.getField?a.getField(b):null},_formatValue:function(a,b,d,c){var g=this._fieldsMap[b.toLowerCase()],e=g&&g.format;b=-1!==m.indexOf(d.dateFormat.properties,b);var l="number"===typeof a&&!b&&(!e||!e.dateFormat);if(!q.isDefined(a)||!g||!q.isDefined(e))return l?this._forceLTR(a):a;var h="",g=[],f=e.hasOwnProperty("places")||e.hasOwnProperty("digitSeparator"),
k=e.hasOwnProperty("digitSeparator")?e.digitSeparator:!0;if(f&&!b)h="NumberFormat",g.push("places: "+(q.isDefined(e.places)&&(!c||0<e.places)?Number(e.places):"Infinity")),g.length&&(h+="("+g.join(",")+")");else if(e.dateFormat)h="DateFormat"+this._insertOffset(this._dateFormats[e.dateFormat]||this._dateFormats.shortDateShortTime);else return l?this._forceLTR(a):a;var A=this._applyFormatting(a,h,d);f&&-1<a.constructor.toString().indexOf("Array")&&(A="",m.forEach(a,n.hitch(this,function(a,b){b&&(A+=
" ");A+=this._applyFormatting(a,h,d)})));f&&!k&&D.group&&(A=A.replace(new RegExp("\\"+D.group,"g"),""));b&&(A='\x3cspan class\x3d"esriDateValue"\x3e'+A+"\x3c/span\x3e");return l?this._forceLTR(A):A},_applyFormatting:function(a,b,d){return q.substitute({myKey:a},"${myKey:"+b+"}",d)||""},_forceLTR:function(a){var b=k("ie");return b&&10>=b?a:"\x3cspan class\x3d'esriNumericValue'\x3e"+a+"\x3c/span\x3e"},_insertOffset:function(a){a&&(a=q.isDefined(this.utcOffset)?a.replace(/\)\s*$/,", utcOffset:"+this.utcOffset+
")"):a);return a},_getDomainName:function(a,b,d,c,g,e){return(a=a.getDomain&&a.getDomain(g,{feature:b}))&&a.codedValues?a.getName(e):null},_getTypeName:function(a,b,d){return(a=a.getType&&a.getType(b))&&a.name},_getRelatedRecords:function(a){var b=a.graphic,d;this._relatedLayersInfoPromise||(this._relatedLayersInfoPromise=this._getRelatedLayersInfo(a).then(n.hitch(this,function(a){for(d in a)a.hasOwnProperty(d)&&a[d]&&(this._relatedLayersInfo[d].relatedLayerInfo=a[d])})));return this._relatedLayersInfoPromise.then(n.hitch(this,
function(){return this._queryRelatedLayers(b)})).then(n.hitch(this,function(a){this._setRelatedRecords(b,a);return a}))},_getRelatedLayersInfo:function(a){var b=a.fieldsInfo,d,c,g={};d=a.graphic.getSourceLayer();this._relatedLayersInfo||(this._relatedLayersInfo={});m.forEach(b,function(a){var b,c,g,e;b=this._fromRelatedFieldName(a.fieldName);c=b[0];b=b[1];c&&(!this._relatedLayersInfo[c]&&d&&d.relationships&&(m.some(d.relationships,function(a){if(a.id==c)return e=a,!0}),e&&(this._relatedLayersInfo[c]=
{relation:e,relatedFields:[],outStatistics:[]})),this._relatedLayersInfo[c]&&(this._relatedLayersInfo[c].relatedFields.push(b),a.statisticType&&(g=new B,g.statisticType=a.statisticType,g.onStatisticField=b,g.outStatisticFieldName=b,this._relatedLayersInfo[c].outStatistics.push(g))))},this);for(c in this._relatedLayersInfo)this._relatedLayersInfo.hasOwnProperty(c)&&this._relatedLayersInfo[c]&&(a=this._relatedLayersInfo[c].relation,a=d.url.replace(/[0-9]+$/,a.relatedTableId),this._relatedLayersInfo[c].relatedLayerUrl=
a,g[c]=h({url:a,content:{f:"json"},callbackParamName:"callback"}));return w(g)},_queryRelatedLayers:function(a){var b={},d;for(d in this._relatedLayersInfo)this._relatedLayersInfo.hasOwnProperty(d)&&(b[d]=this._queryRelatedLayer({graphic:a,relatedInfo:this._relatedLayersInfo[d]}));return w(b)},_queryRelatedLayer:function(a){var b,c,l,h,f,k,q,I,J,A,p,r,B;b=a.graphic;c=b.getSourceLayer();l=c.url.match(/[0-9]+$/g)[0];p=a.relatedInfo;A=p.relatedLayerInfo;r=p.relatedLayerUrl;a=p.relation;m.some(A.relationships,
function(a){if(a.relatedTableId===parseInt(l,10))return h=a,!0},this);h&&(f=new d,m.some(A.fields,function(a){if(a.name===h.keyField)return I=-1!==m.indexOf(["esriFieldTypeSmallInteger","esriFieldTypeInteger","esriFieldTypeSingle","esriFieldTypeDouble"],a.type)?"number":"string",!0}),h.relationshipTableId&&h.keyFieldInRelationshipTable?(B=new e,this._queryRelatedRecords(b,h).then(n.hitch(this,function(a){var e;(e=a[b.attributes[c.objectIdField]])?(a=m.map(e.features,function(a){return a.attributes[A.objectIdField]},
this),p.outStatistics&&0<p.outStatistics.length&&A.supportsStatistics&&(J=new d,J.objectIds=a,J.outFields=f.outFields,J.outStatistics=p.outStatistics),J&&(k=new g(r),k.execute(J).then(n.hitch(this,function(a){var b=[];b.push(e);b.push(a);B.resolve(b)})))):B.resolve()}))):(q="string"===I?h.keyField+"\x3d'"+b.attributes[a.keyField]+"'":h.keyField+"\x3d"+b.attributes[a.keyField],f.where=q,f.outFields=p.relatedFields,p.outStatistics&&0<p.outStatistics.length&&A.supportsStatistics&&(J=new d,J.where=f.where,
J.outFields=f.outFields,J.outStatistics=p.outStatistics),k=new g(r),q=[],q.push(k.execute(f)),J&&q.push(k.execute(J))));return q?w(q):B?B.promise:void 0},_setRelatedRecords:function(a,b){this._relatedInfo=[];for(var d in b)if(b.hasOwnProperty(d)&&b[d]){var c=b[d];this._relatedInfo[d]={};this._relatedInfo[d].relatedFeatures=c[0].features;q.isDefined(c[1])&&(this._relatedInfo[d].relatedStatsFeatures=c[1].features)}},_handlerErrorResponse:function(a,b){a.reject(b)},_fromRelatedFieldName:function(a){var b=
[];-1!==a.indexOf(this._relatedFieldPrefix)&&(a=a.split("/"),b=a.slice(1));return b},_toRelatedFieldName:function(a){var b="";a&&0<a.length&&(b=this._relatedFieldPrefix+a[0]+"/"+a[1]);return b},_queryRelatedRecords:function(a,b){var d=a.getSourceLayer(),c=new l;c.outFields=["*"];c.relationshipId=b.id;c.objectIds=[a.attributes[d.objectIdField]];return d.queryRelatedFeatures(c)}});a("extend-esri")&&(b.PopupInfo=b.PopupInfoTemplate=p);return p})},"dojox/html/entities":function(){define(["dojo/_base/lang"],
function(p){var n=p.getObject("dojox.html.entities",!0),m=function(f,a){var e,k;if(a._encCache&&a._encCache.regexp&&a._encCache.mapper&&a.length==a._encCache.length)e=a._encCache.mapper,k=a._encCache.regexp;else{e={};k=["["];var n;for(n=0;n<a.length;n++)e[a[n][0]]="\x26"+a[n][1]+";",k.push(a[n][0]);k.push("]");k=new RegExp(k.join(""),"g");a._encCache={mapper:e,regexp:k,length:a.length}}return f=f.replace(k,function(a){return e[a]})},r=function(f,a){var e,k;if(a._decCache&&a._decCache.regexp&&a._decCache.mapper&&
a.length==a._decCache.length)e=a._decCache.mapper,k=a._decCache.regexp;else{e={};k=["("];var n;for(n=0;n<a.length;n++){var c="\x26"+a[n][1]+";";n&&k.push("|");e[c]=a[n][0];k.push(c)}k.push(")");k=new RegExp(k.join(""),"g");a._decCache={mapper:e,regexp:k,length:a.length}}return f=f.replace(k,function(a){return e[a]})};n.html=[["\x26","amp"],['"',"quot"],["\x3c","lt"],["\x3e","gt"],["\u00a0","nbsp"]];n.latin=[["\u00a1","iexcl"],["\u00a2","cent"],["\u00a3","pound"],["\u20ac","euro"],["\u00a4","curren"],
["\u00a5","yen"],["\u00a6","brvbar"],["\u00a7","sect"],["\u00a8","uml"],["\u00a9","copy"],["\u00aa","ordf"],["\u00ab","laquo"],["\u00ac","not"],["\u00ad","shy"],["\u00ae","reg"],["\u00af","macr"],["\u00b0","deg"],["\u00b1","plusmn"],["\u00b2","sup2"],["\u00b3","sup3"],["\u00b4","acute"],["\u00b5","micro"],["\u00b6","para"],["\u00b7","middot"],["\u00b8","cedil"],["\u00b9","sup1"],["\u00ba","ordm"],["\u00bb","raquo"],["\u00bc","frac14"],["\u00bd","frac12"],["\u00be","frac34"],["\u00bf","iquest"],["\u00c0",
"Agrave"],["\u00c1","Aacute"],["\u00c2","Acirc"],["\u00c3","Atilde"],["\u00c4","Auml"],["\u00c5","Aring"],["\u00c6","AElig"],["\u00c7","Ccedil"],["\u00c8","Egrave"],["\u00c9","Eacute"],["\u00ca","Ecirc"],["\u00cb","Euml"],["\u00cc","Igrave"],["\u00cd","Iacute"],["\u00ce","Icirc"],["\u00cf","Iuml"],["\u00d0","ETH"],["\u00d1","Ntilde"],["\u00d2","Ograve"],["\u00d3","Oacute"],["\u00d4","Ocirc"],["\u00d5","Otilde"],["\u00d6","Ouml"],["\u00d7","times"],["\u00d8","Oslash"],["\u00d9","Ugrave"],["\u00da",
"Uacute"],["\u00db","Ucirc"],["\u00dc","Uuml"],["\u00dd","Yacute"],["\u00de","THORN"],["\u00df","szlig"],["\u00e0","agrave"],["\u00e1","aacute"],["\u00e2","acirc"],["\u00e3","atilde"],["\u00e4","auml"],["\u00e5","aring"],["\u00e6","aelig"],["\u00e7","ccedil"],["\u00e8","egrave"],["\u00e9","eacute"],["\u00ea","ecirc"],["\u00eb","euml"],["\u00ec","igrave"],["\u00ed","iacute"],["\u00ee","icirc"],["\u00ef","iuml"],["\u00f0","eth"],["\u00f1","ntilde"],["\u00f2","ograve"],["\u00f3","oacute"],["\u00f4",
"ocirc"],["\u00f5","otilde"],["\u00f6","ouml"],["\u00f7","divide"],["\u00f8","oslash"],["\u00f9","ugrave"],["\u00fa","uacute"],["\u00fb","ucirc"],["\u00fc","uuml"],["\u00fd","yacute"],["\u00fe","thorn"],["\u00ff","yuml"],["\u0192","fnof"],["\u0391","Alpha"],["\u0392","Beta"],["\u0393","Gamma"],["\u0394","Delta"],["\u0395","Epsilon"],["\u0396","Zeta"],["\u0397","Eta"],["\u0398","Theta"],["\u0399","Iota"],["\u039a","Kappa"],["\u039b","Lambda"],["\u039c","Mu"],["\u039d","Nu"],["\u039e","Xi"],["\u039f",
"Omicron"],["\u03a0","Pi"],["\u03a1","Rho"],["\u03a3","Sigma"],["\u03a4","Tau"],["\u03a5","Upsilon"],["\u03a6","Phi"],["\u03a7","Chi"],["\u03a8","Psi"],["\u03a9","Omega"],["\u03b1","alpha"],["\u03b2","beta"],["\u03b3","gamma"],["\u03b4","delta"],["\u03b5","epsilon"],["\u03b6","zeta"],["\u03b7","eta"],["\u03b8","theta"],["\u03b9","iota"],["\u03ba","kappa"],["\u03bb","lambda"],["\u03bc","mu"],["\u03bd","nu"],["\u03be","xi"],["\u03bf","omicron"],["\u03c0","pi"],["\u03c1","rho"],["\u03c2","sigmaf"],["\u03c3",
"sigma"],["\u03c4","tau"],["\u03c5","upsilon"],["\u03c6","phi"],["\u03c7","chi"],["\u03c8","psi"],["\u03c9","omega"],["\u03d1","thetasym"],["\u03d2","upsih"],["\u03d6","piv"],["\u2022","bull"],["\u2026","hellip"],["\u2032","prime"],["\u2033","Prime"],["\u203e","oline"],["\u2044","frasl"],["\u2118","weierp"],["\u2111","image"],["\u211c","real"],["\u2122","trade"],["\u2135","alefsym"],["\u2190","larr"],["\u2191","uarr"],["\u2192","rarr"],["\u2193","darr"],["\u2194","harr"],["\u21b5","crarr"],["\u21d0",
"lArr"],["\u21d1","uArr"],["\u21d2","rArr"],["\u21d3","dArr"],["\u21d4","hArr"],["\u2200","forall"],["\u2202","part"],["\u2203","exist"],["\u2205","empty"],["\u2207","nabla"],["\u2208","isin"],["\u2209","notin"],["\u220b","ni"],["\u220f","prod"],["\u2211","sum"],["\u2212","minus"],["\u2217","lowast"],["\u221a","radic"],["\u221d","prop"],["\u221e","infin"],["\u2220","ang"],["\u2227","and"],["\u2228","or"],["\u2229","cap"],["\u222a","cup"],["\u222b","int"],["\u2234","there4"],["\u223c","sim"],["\u2245",
"cong"],["\u2248","asymp"],["\u2260","ne"],["\u2261","equiv"],["\u2264","le"],["\u2265","ge"],["\u2282","sub"],["\u2283","sup"],["\u2284","nsub"],["\u2286","sube"],["\u2287","supe"],["\u2295","oplus"],["\u2297","otimes"],["\u22a5","perp"],["\u22c5","sdot"],["\u2308","lceil"],["\u2309","rceil"],["\u230a","lfloor"],["\u230b","rfloor"],["\u2329","lang"],["\u232a","rang"],["\u25ca","loz"],["\u2660","spades"],["\u2663","clubs"],["\u2665","hearts"],["\u2666","diams"],["\u0152","OElig"],["\u0153","oelig"],
["\u0160","Scaron"],["\u0161","scaron"],["\u0178","Yuml"],["\u02c6","circ"],["\u02dc","tilde"],["\u2002","ensp"],["\u2003","emsp"],["\u2009","thinsp"],["\u200c","zwnj"],["\u200d","zwj"],["\u200e","lrm"],["\u200f","rlm"],["\u2013","ndash"],["\u2014","mdash"],["\u2018","lsquo"],["\u2019","rsquo"],["\u201a","sbquo"],["\u201c","ldquo"],["\u201d","rdquo"],["\u201e","bdquo"],["\u2020","dagger"],["\u2021","Dagger"],["\u2030","permil"],["\u2039","lsaquo"],["\u203a","rsaquo"]];n.encode=function(f,a){f&&(a?
f=m(f,a):(f=m(f,n.html),f=m(f,n.latin)));return f};n.decode=function(f,a){f&&(a?f=r(f,a):(f=r(f,n.html),f=r(f,n.latin)));return f};return n})},"esri/tasks/RelationshipQuery":function(){define(["dojo/_base/declare","dojo/_base/lang","dojo/_base/json","dojo/has","../kernel"],function(p,n,m,r,f){p=p(null,{declaredClass:"esri.tasks.RelationshipQuery",definitionExpression:"",relationshipId:null,returnGeometry:!1,objectIds:null,outSpatialReference:null,outFields:null,toJson:function(){var a={definitionExpression:this.definitionExpression,
relationshipId:this.relationshipId,returnGeometry:this.returnGeometry,maxAllowableOffset:this.maxAllowableOffset,geometryPrecision:this.geometryPrecision},e=this.objectIds,f=this.outFields,n=this.outSpatialReference;e&&(a.objectIds=e.join(","));f&&(a.outFields=f.join(","));n&&(a.outSR=n.wkid||m.toJson(n.toJson()));a._ts=this._ts;return a}});r("extend-esri")&&n.setObject("tasks.RelationshipQuery",p,f);return p})},"esri/dijit/PopupRenderer":function(){define("require dojo/_base/declare dojo/_base/connect dojo/_base/lang dojo/_base/array dojo/_base/kernel dojo/sniff dojo/query dojo/dom dojo/dom-attr dojo/dom-class dojo/dom-construct dojo/dom-style dojox/html/entities dijit/_Widget dijit/_Templated ../kernel ../lang ../urlUtils ./_EventedWidget dojo/i18n!../nls/jsapi dojo/NodeList-dom".split(" "),
function(p,n,m,r,f,a,e,k,w,c,q,b,h,x,d,g,l,B,E,z,D){var y=0,v=D.widgets.popup,u=D.widgets.templatePicker;n=n([z,d,g],{declaredClass:"esri.dijit._PopupRenderer",constructor:function(){this._nls=r.mixin({},v)},templateString:"\x3cdiv class\x3d'esriViewPopup'\x3e\x3cdiv class\x3d'statusSection hidden' dojoAttachPoint\x3d'_status'\x3e\x3c/div\x3e\x3cdiv class\x3d'mainSection'\x3e\x3cdiv class\x3d'header' dojoAttachPoint\x3d'_title'\x3e\x3c/div\x3e\x3cdiv class\x3d'hzLine'\x3e\x3c/div\x3e\x3cdiv dojoAttachPoint\x3d'_description'\x3e\x3c/div\x3e\x3cdiv class\x3d'break'\x3e\x3c/div\x3e\x3c/div\x3e\x3cdiv class\x3d'attachmentsSection hidden'\x3e\x3cdiv\x3e${_nls.NLS_attach}:\x3c/div\x3e\x3cul dojoAttachPoint\x3d'_attachmentsList'\x3e\x3c/ul\x3e\x3cdiv class\x3d'break'\x3e\x3c/div\x3e\x3c/div\x3e\x3cdiv class\x3d'mediaSection hidden'\x3e\x3cdiv class\x3d'header' dojoAttachPoint\x3d'_mediaTitle'\x3e\x3c/div\x3e\x3cdiv class\x3d'hzLine'\x3e\x3c/div\x3e\x3cdiv class\x3d'caption' dojoAttachPoint\x3d'_mediaCaption'\x3e\x3c/div\x3e\x3cdiv class\x3d'gallery' dojoAttachPoint\x3d'_gallery'\x3e\x3cdiv class\x3d'mediaHandle prev' dojoAttachPoint\x3d'_prevMedia' dojoAttachEvent\x3d'onclick: _goToPrevMedia'\x3e\x3c/div\x3e\x3cdiv class\x3d'mediaHandle next' dojoAttachPoint\x3d'_nextMedia' dojoAttachEvent\x3d'onclick: _goToNextMedia'\x3e\x3c/div\x3e\x3cul class\x3d'summary'\x3e\x3cli class\x3d'image mediaCount hidden' dojoAttachPoint\x3d'_imageCount'\x3e0\x3c/li\x3e\x3cli class\x3d'image mediaIcon hidden'\x3e\x3c/li\x3e\x3cli class\x3d'chart mediaCount hidden' dojoAttachPoint\x3d'_chartCount'\x3e0\x3c/li\x3e\x3cli class\x3d'chart mediaIcon hidden'\x3e\x3c/li\x3e\x3c/ul\x3e\x3cdiv class\x3d'frame' dojoAttachPoint\x3d'_mediaFrame'\x3e\x3c/div\x3e\x3c/div\x3e\x3c/div\x3e\x3cdiv class\x3d'editSummarySection hidden' dojoAttachPoint\x3d'_editSummarySection'\x3e\x3cdiv class\x3d'break'\x3e\x3c/div\x3e\x3cdiv class\x3d'break hidden' dojoAttachPoint\x3d'_mediaBreak'\x3e\x3c/div\x3e\x3cdiv class\x3d'editSummary' dojoAttachPoint\x3d'_editSummary'\x3e\x3c/div\x3e\x3c/div\x3e\x3c/div\x3e",
showTitle:!0,startup:function(){this.inherited(arguments);this._showStatus(u.loading);this._contentDfd=this.template.getComponents(this.graphic).then(r.hitch(this,this._handleComponentsSuccess)).otherwise(r.hitch(this,this._handleComponentsError))},destroy:function(){this._contentDfd&&this._contentDfd.cancel();this._attachmentsDfd&&this._attachmentsDfd.cancel();this._destroyFrame();this.template=this.graphic=this._nls=this._mediaInfos=this._mediaPtr=this._contentDfd=this._attachmentsDfd=null;this.inherited(arguments)},
_goToPrevMedia:function(){0>this._mediaPtr-1||(this._mediaPtr--,this._updateUI(),this._displayMedia())},_goToNextMedia:function(){this._mediaPtr+1!==this._mediaInfos.length&&(this._mediaPtr++,this._updateUI(),this._displayMedia())},_updateUI:function(){var b=this._mediaInfos,d=b.length,g=this.domNode,e=this._prevMedia,l=this._nextMedia;if(1<d){var h=0,k=0;f.forEach(b,function(a){"image"===a.type?h++:-1!==a.type.indexOf("chart")&&k++});h&&(c.set(this._imageCount,"innerHTML",h),a.query(".summary .image",
g).removeClass("hidden"));k&&(c.set(this._chartCount,"innerHTML",k),a.query(".summary .chart",g).removeClass("hidden"))}else a.query(".summary",g).addClass("hidden"),q.add(e,"hidden"),q.add(l,"hidden");b=this._mediaPtr;0===b?q.add(e,"hidden"):q.remove(e,"hidden");b===d-1?q.add(l,"hidden"):q.remove(l,"hidden");this._destroyFrame()},_displayMedia:function(){var b=this._mediaInfos[this._mediaPtr],d=b.title,g=b.caption,e=a.query(".mediaSection .hzLine",this.domNode)[0];c.set(this._mediaTitle,"innerHTML",
d);q[d?"remove":"add"](this._mediaTitle,"hidden");c.set(this._mediaCaption,"innerHTML",g);q[g?"remove":"add"](this._mediaCaption,"hidden");q[d&&g?"remove":"add"](e,"hidden");this._rid=null;if("image"===b.type)this._showImage(b);else{var l=this,d=["dojox/charting/Chart2D","dojox/charting/action2d/Tooltip"],g=b.value.theme||this.chartTheme;r.isString(g)&&(g=g.replace(/\./gi,"/"),-1===g.indexOf("/")&&(g="dojox/charting/themes/"+g));g||(g="./Rainbow");d.push(g);try{var h=this._rid=y++;p(d,function(a,
d,c){h===l._rid&&(l._rid=null,l._showChart(b.type,b.value,a,d,c))})}catch(J){console.log("PopupRenderer: error loading modules")}}},_preventNewTab:function(a){return(a=a&&r.trim(a).toLowerCase())&&(0===a.indexOf("mailto:")||0===a.indexOf("tel:"))},_showImage:function(d){q.add(this._mediaFrame,"image");var c=h.get(this._gallery,"height"),g=d.value,e;g.linkURL&&(e=b.create("a",{href:g.linkURL,target:this._preventNewTab(g.linkURL)?"":"_blank"},this._mediaFrame));g=d.refreshInterval?this._addURLParameter(g.sourceURL,
"timestamp",Date.now()):g.sourceURL;b.create("img",{className:"esriPopupMediaImage",src:g},e||this._mediaFrame);var l=a.query(".esriPopupMediaImage",this._mediaFrame)[0];this._imageLoadHandle=m.connect(l,"onload",this,function(){this._clearImageHandles();this._imageLoaded(l,c);this._initImageRefresh(d)})},_addURLParameter:function(a,b,d){var c=-1===a.indexOf("?")?"?":"\x26";return a+c+b+"\x3d"+d},_initImageRefresh:function(a){if(a.refreshInterval){var b=6E4*a.refreshInterval;this._imageRefreshHandle=
setTimeout(r.hitch(this,function(){this._destroyFrame();this._showImage(a)}),b)}},_clearImageHandles:function(){m.disconnect(this._imageLoadHandle);this._imageLoadHandle=null;clearTimeout(this._imageRefreshHandle);this._imageRefreshHandle=null},_showChart:function(a,d,c,g,e){q.remove(this._mediaFrame,"image");c=this._chart=new c(b.create("div",{"class":"chart"},this._mediaFrame),{margins:{l:4,t:4,r:4,b:4}});e&&c.setTheme(e);switch(a){case "piechart":c.addPlot("default",{type:"Pie",labels:!1});c.addSeries("Series A",
d.fields);break;case "linechart":c.addPlot("default",{type:"Markers"});c.addAxis("x",{min:0,majorTicks:!1,minorTicks:!1,majorLabels:!1,minorLabels:!1});c.addAxis("y",{includeZero:!0,vertical:!0,fixUpper:"minor"});f.forEach(d.fields,function(a,b){a.x=b+1});c.addSeries("Series A",d.fields);break;case "columnchart":c.addPlot("default",{type:"Columns",gap:3});c.addAxis("y",{includeZero:!0,vertical:!0,fixUpper:"minor"});c.addSeries("Series A",d.fields);break;case "barchart":c.addPlot("default",{type:"Bars",
gap:3}),c.addAxis("x",{includeZero:!0,fixUpper:"minor",minorLabels:!1}),c.addAxis("y",{vertical:!0,majorTicks:!1,minorTicks:!1,majorLabels:!1,minorLabels:!1}),c.addSeries("Series A",d.fields)}this._action=new g(c);c.render()},_destroyFrame:function(){this._rid=null;this._clearImageHandles();this._chart&&(this._chart.destroy(),this._chart=null);this._action&&(this._action.destroy(),this._action=null);c.set(this._mediaFrame,"innerHTML","")},_imageLoaded:function(a,b){var d=a.height;d<b&&h.set(a,"marginTop",
Math.round((b-d)/2)+"px")},_attListHandler:function(a,b){if(a===this._attachmentsDfd){this._attachmentsDfd=null;var d="";b instanceof Error||!b||!b.length||f.forEach(b,function(a){d+="\x3cli\x3e";d+="\x3ca href\x3d'"+E.addProxy(a.url)+"' target\x3d'_blank'\x3e"+(a.name||"[No name]")+"\x3c/a\x3e";d+="\x3c/li\x3e"});c.set(this._attachmentsList,"innerHTML",d||"\x3cli\x3e"+this._nls.NLS_noAttach+"\x3c/li\x3e")}},_supportedURIInfos:[{pattern:/^\s*(https?:\/\/([^\s]+))\s*$/i,label:v.NLS_moreInfo},{pattern:/^\s*(tel:([^\s]+))\s*$/i,
label:"${hierPart}"},{pattern:/^\s*(mailto:([^\s]+))\s*$/i,label:"${hierPart}"},{pattern:/^\s*(arcgis-appstudio-player:\/\/([^\s]+))\s*$/i,appName:"App Studio Player",label:v.NLS_openLinkInApp},{pattern:/^\s*(arcgis-collector:\/\/([^\s]+))\s*$/i,appName:"Collector",label:v.NLS_openLinkInApp},{pattern:/^\s*(arcgis-explorer:\/\/([^\s]+))\s*$/i,appName:"Explorer",label:v.NLS_openLinkInApp},{pattern:/^\s*(arcgis-navigator:\/\/([^\s]+))\s*$/i,appName:"Navigator",label:v.NLS_openLinkInApp},{pattern:/^\s*(arcgis-survey123:\/\/([^\s]+))\s*$/i,
appName:"Survey123",label:v.NLS_openLinkInApp},{pattern:/^\s*(arcgis-trek2there:\/\/([^\s]+))\s*$/i,appName:"Trek2There",label:v.NLS_openLinkInApp},{pattern:/^\s*(arcgis-workforce:\/\/([^\s]+))\s*$/i,appName:"Workforce",label:v.NLS_openLinkInApp},{pattern:/^\s*(iform:\/\/([^\s]+))\s*$/i,appName:"iForm",label:v.NLS_openLinkInApp},{pattern:/^\s*(flow:\/\/([^\s]+))\s*$/i,appName:"FlowFinity",label:v.NLS_openLinkInApp},{pattern:/^\s*(lfmobile:\/\/([^\s]+))\s*$/i,appName:"Laserfische",label:v.NLS_openLinkInApp},
{pattern:/^\s*(mspbi:\/\/([^\s]+))\s*$/i,appName:"Microsoft Power BI",label:v.NLS_openLinkInApp}],_findURIInfo:function(a){var b;f.some(this._supportedURIInfos,function(d){d.pattern.test(a)&&(b=d);return!!b});return b},_createLinkIfURI:function(a){var b=this._findURIInfo(a);if(b){var d=a.match(b.pattern);return a.replace(b.pattern,"\x3ca target\x3d'_blank' href\x3d'$1' title\x3d'$1'\x3e"+B.substitute({appName:b.appName,hierPart:d&&d[2]},b.label)+"\x3c/a\x3e")}return a},_showStatus:function(b){c.set(this._status,
"innerHTML",b);q.remove(this._status,"hidden");a.query(".mainSection",this.domNode).addClass("hidden")},_hideStatus:function(){c.set(this._status,"innerHTML","");q.add(this._status,"hidden");a.query(".mainSection",this.domNode).removeClass("hidden")},_handleComponentsSuccess:function(b){if(b){this._hideStatus();var d=this.showTitle?b.title:"",g=b.description,e=b.fields,l=b.mediaInfos,h=this.domNode,k=this._nls,n=this,p=this.template,m=this.graphic;this._prevMedia.title=k.NLS_prevMedia;this._nextMedia.title=
k.NLS_nextMedia;c.set(this._title,"innerHTML",d);d||q.add(this._title,"hidden");!b.hasDescription&&e&&(g="",f.forEach(e,function(a){g+="\x3ctr valign\x3d'top'\x3e";g+="\x3ctd class\x3d'attrName'\x3e"+x.encode(a[0])+"\x3c/td\x3e";g+="\x3ctd class\x3d'attrValue'\x3e"+this._createLinkIfURI(a[1])+"\x3c/td\x3e";g+="\x3c/tr\x3e"},this),g&&(g="\x3ctable class\x3d'attrTable' cellpadding\x3d'0px' cellspacing\x3d'0px'\x3e"+g+"\x3c/table\x3e"));c.set(this._description,"innerHTML",g);g||q.add(this._description,
"hidden");a.query("a",this._description).forEach(function(a){n._preventNewTab(a.href)?"_blank"===a.target&&c.remove(a,"target"):c.set(a,"target","_blank")});d&&g?a.query(".mainSection .hzLine",h).removeClass("hidden"):d||g?a.query(".mainSection .hzLine",h).addClass("hidden"):a.query(".mainSection",h).addClass("hidden");if(d=this._attachmentsDfd=p.getAttachments(m))d.addBoth(r.hitch(this,this._attListHandler,d)),c.set(this._attachmentsList,"innerHTML","\x3cli\x3e"+k.NLS_searching+"...\x3c/li\x3e"),
a.query(".attachmentsSection",h).removeClass("hidden");l&&l.length&&(a.query(".mediaSection",h).removeClass("hidden"),w.setSelectable(this._mediaFrame,!1),this._mediaInfos=l,this._mediaPtr=0,this._updateUI(),this._displayMedia());b.editSummary&&(c.set(this._editSummary,"innerHTML",b.editSummary),l&&l.length&&q.remove(this._mediaBreak,"hidden"),q.remove(this._editSummarySection,"hidden"));this.emit("content-update")}else this._showStatus(v.NLS_noInfo)},_handleComponentsError:function(a){a&&"cancel"===
a.dojoType||(console.log("PopupRenderer: error loading template",a),this._showStatus(v.NLS_noInfo))}});e("extend-esri")&&r.setObject("dijit._PopupRenderer",n,l);return n})},"dijit/_Widget":function(){define("dojo/aspect dojo/_base/config dojo/_base/connect dojo/_base/declare dojo/has dojo/_base/kernel dojo/_base/lang dojo/query dojo/ready ./registry ./_WidgetBase ./_OnDijitClickMixin ./_FocusMixin dojo/uacss ./hccss".split(" "),function(p,n,m,r,f,a,e,k,w,c,q,b,h){function x(){}function d(a){return function(b,
d,c,g){return b&&"string"==typeof d&&b[d]==x?b.on(d.substring(2).toLowerCase(),e.hitch(c,g)):a.apply(m,arguments)}}p.around(m,"connect",d);a.connect&&p.around(a,"connect",d);p=r("dijit._Widget",[q,b,h],{onClick:x,onDblClick:x,onKeyDown:x,onKeyPress:x,onKeyUp:x,onMouseDown:x,onMouseMove:x,onMouseOut:x,onMouseOver:x,onMouseLeave:x,onMouseEnter:x,onMouseUp:x,constructor:function(a){this._toConnect={};for(var b in a)this[b]===x&&(this._toConnect[b.replace(/^on/,"").toLowerCase()]=a[b],delete a[b])},postCreate:function(){this.inherited(arguments);
for(var a in this._toConnect)this.on(a,this._toConnect[a]);delete this._toConnect},on:function(a,b){return this[this._onMap(a)]===x?m.connect(this.domNode,a.toLowerCase(),this,b):this.inherited(arguments)},_setFocusedAttr:function(a){this._focused=a;this._set("focused",a)},setAttribute:function(b,d){a.deprecated(this.declaredClass+"::setAttribute(attr, value) is deprecated. Use set() instead.","","2.0");this.set(b,d)},attr:function(a,b){return 2<=arguments.length||"object"===typeof a?this.set.apply(this,
arguments):this.get(a)},getDescendants:function(){a.deprecated(this.declaredClass+"::getDescendants() is deprecated. Use getChildren() instead.","","2.0");return this.containerNode?k("[widgetId]",this.containerNode).map(c.byNode):[]},_onShow:function(){this.onShow()},onShow:function(){},onHide:function(){},onClose:function(){return!0}});f("dijit-legacy-requires")&&w(0,function(){require(["dijit/_base"])});return p})},"dijit/_WidgetBase":function(){define("require dojo/_base/array dojo/aspect dojo/_base/config dojo/_base/connect dojo/_base/declare dojo/dom dojo/dom-attr dojo/dom-class dojo/dom-construct dojo/dom-geometry dojo/dom-style dojo/has dojo/_base/kernel dojo/_base/lang dojo/on dojo/ready dojo/Stateful dojo/topic dojo/_base/window ./Destroyable dojo/has!dojo-bidi?./_BidiMixin ./registry".split(" "),
function(p,n,m,r,f,a,e,k,w,c,q,b,h,x,d,g,l,B,E,z,D,y,v){function u(a){return function(b){k[b?"set":"remove"](this.domNode,a,b);this._set(a,b)}}h.add("dijit-legacy-requires",!x.isAsync);h.add("dojo-bidi",!1);h("dijit-legacy-requires")&&l(0,function(){p(["dijit/_base/manager"])});var H={};r=a("dijit._WidgetBase",[B,D],{id:"",_setIdAttr:"domNode",lang:"",_setLangAttr:u("lang"),dir:"",_setDirAttr:u("dir"),"class":"",_setClassAttr:{node:"domNode",type:"class"},_setTypeAttr:null,style:"",title:"",tooltip:"",
baseClass:"",srcNodeRef:null,domNode:null,containerNode:null,ownerDocument:null,_setOwnerDocumentAttr:function(a){this._set("ownerDocument",a)},attributeMap:{},_blankGif:r.blankGif||p.toUrl("dojo/resources/blank.gif"),textDir:"",_introspect:function(){var a=this.constructor;if(!a._setterAttrs){var b=a.prototype,d=a._setterAttrs=[],a=a._onMap={},c;for(c in b.attributeMap)d.push(c);for(c in b)/^on/.test(c)&&(a[c.substring(2).toLowerCase()]=c),/^_set[A-Z](.*)Attr$/.test(c)&&(c=c.charAt(4).toLowerCase()+
c.substr(5,c.length-9),b.attributeMap&&c in b.attributeMap||d.push(c))}},postscript:function(a,b){this.create(a,b)},create:function(a,b){this._introspect();this.srcNodeRef=e.byId(b);this._connects=[];this._supportingWidgets=[];this.srcNodeRef&&this.srcNodeRef.id&&"string"==typeof this.srcNodeRef.id&&(this.id=this.srcNodeRef.id);a&&(this.params=a,d.mixin(this,a));this.postMixInProperties();this.id||(this.id=v.getUniqueId(this.declaredClass.replace(/\./g,"_")),this.params&&delete this.params.id);this.ownerDocument=
this.ownerDocument||(this.srcNodeRef?this.srcNodeRef.ownerDocument:document);this.ownerDocumentBody=z.body(this.ownerDocument);v.add(this);this.buildRendering();var c;if(this.domNode){this._applyAttributes();var g=this.srcNodeRef;g&&g.parentNode&&this.domNode!==g&&(g.parentNode.replaceChild(this.domNode,g),c=!0);this.domNode.setAttribute("widgetId",this.id)}this.postCreate();c&&delete this.srcNodeRef;this._created=!0},_applyAttributes:function(){var a={},b;for(b in this.params||{})a[b]=this._get(b);
n.forEach(this.constructor._setterAttrs,function(b){if(!(b in a)){var d=this._get(b);d&&this.set(b,d)}},this);for(b in a)this.set(b,a[b])},postMixInProperties:function(){},buildRendering:function(){this.domNode||(this.domNode=this.srcNodeRef||this.ownerDocument.createElement("div"));if(this.baseClass){var a=this.baseClass.split(" ");this.isLeftToRight()||(a=a.concat(n.map(a,function(a){return a+"Rtl"})));w.add(this.domNode,a)}},postCreate:function(){},startup:function(){this._started||(this._started=
!0,n.forEach(this.getChildren(),function(a){a._started||a._destroyed||!d.isFunction(a.startup)||(a.startup(),a._started=!0)}))},destroyRecursive:function(a){this._beingDestroyed=!0;this.destroyDescendants(a);this.destroy(a)},destroy:function(a){function b(b){b.destroyRecursive?b.destroyRecursive(a):b.destroy&&b.destroy(a)}this._beingDestroyed=!0;this.uninitialize();n.forEach(this._connects,d.hitch(this,"disconnect"));n.forEach(this._supportingWidgets,b);this.domNode&&n.forEach(v.findWidgets(this.domNode,
this.containerNode),b);this.destroyRendering(a);v.remove(this.id);this._destroyed=!0},destroyRendering:function(a){this.bgIframe&&(this.bgIframe.destroy(a),delete this.bgIframe);this.domNode&&(a?k.remove(this.domNode,"widgetId"):c.destroy(this.domNode),delete this.domNode);this.srcNodeRef&&(a||c.destroy(this.srcNodeRef),delete this.srcNodeRef)},destroyDescendants:function(a){n.forEach(this.getChildren(),function(b){b.destroyRecursive&&b.destroyRecursive(a)})},uninitialize:function(){return!1},_setStyleAttr:function(a){var c=
this.domNode;d.isObject(a)?b.set(c,a):c.style.cssText=c.style.cssText?c.style.cssText+("; "+a):a;this._set("style",a)},_attrToDom:function(a,b,c){c=3<=arguments.length?c:this.attributeMap[a];n.forEach(d.isArray(c)?c:[c],function(c){var g=this[c.node||c||"domNode"];switch(c.type||"attribute"){case "attribute":d.isFunction(b)&&(b=d.hitch(this,b));c=c.attribute?c.attribute:/^on[A-Z][a-zA-Z]*$/.test(a)?a.toLowerCase():a;g.tagName?k.set(g,c,b):g.set(c,b);break;case "innerText":g.innerHTML="";g.appendChild(this.ownerDocument.createTextNode(b));
break;case "innerHTML":g.innerHTML=b;break;case "class":w.replace(g,b,this[a]);break;case "toggleClass":w.toggle(g,c.className||a,b)}},this)},get:function(a){var b=this._getAttrNames(a);return this[b.g]?this[b.g]():this._get(a)},set:function(a,b){if("object"===typeof a){for(var c in a)this.set(c,a[c]);return this}c=this._getAttrNames(a);var g=this[c.s];if(d.isFunction(g))var e=g.apply(this,Array.prototype.slice.call(arguments,1));else{var g=this.focusNode&&!d.isFunction(this.focusNode)?"focusNode":
"domNode",l=this[g]&&this[g].tagName,h;if((h=l)&&!(h=H[l])){h=this[g];var f={},k;for(k in h)f[k.toLowerCase()]=!0;h=H[l]=f}k=h;c=a in this.attributeMap?this.attributeMap[a]:c.s in this?this[c.s]:k&&c.l in k&&"function"!=typeof b||/^aria-|^data-|^role$/.test(a)?g:null;null!=c&&this._attrToDom(a,b,c);this._set(a,b)}return e||this},_attrPairNames:{},_getAttrNames:function(a){var b=this._attrPairNames;if(b[a])return b[a];var d=a.replace(/^[a-z]|-[a-zA-Z]/g,function(a){return a.charAt(a.length-1).toUpperCase()});
return b[a]={n:a+"Node",s:"_set"+d+"Attr",g:"_get"+d+"Attr",l:d.toLowerCase()}},_set:function(a,b){var d=this[a];this[a]=b;!this._created||d===b||d!==d&&b!==b||(this._watchCallbacks&&this._watchCallbacks(a,d,b),this.emit("attrmodified-"+a,{detail:{prevValue:d,newValue:b}}))},_get:function(a){return this[a]},emit:function(a,b,d){b=b||{};void 0===b.bubbles&&(b.bubbles=!0);void 0===b.cancelable&&(b.cancelable=!0);b.detail||(b.detail={});b.detail.widget=this;var c,e=this["on"+a];e&&(c=e.apply(this,d?
d:[b]));this._started&&!this._beingDestroyed&&g.emit(this.domNode,a.toLowerCase(),b);return c},on:function(a,b){var d=this._onMap(a);return d?m.after(this,d,b,!0):this.own(g(this.domNode,a,b))[0]},_onMap:function(a){var b=this.constructor,d=b._onMap;if(!d){var d=b._onMap={},c;for(c in b.prototype)/^on/.test(c)&&(d[c.replace(/^on/,"").toLowerCase()]=c)}return d["string"==typeof a&&a.toLowerCase()]},toString:function(){return"[Widget "+this.declaredClass+", "+(this.id||"NO ID")+"]"},getChildren:function(){return this.containerNode?
v.findWidgets(this.containerNode):[]},getParent:function(){return v.getEnclosingWidget(this.domNode.parentNode)},connect:function(a,b,d){return this.own(f.connect(a,b,this,d))[0]},disconnect:function(a){a.remove()},subscribe:function(a,b){return this.own(E.subscribe(a,d.hitch(this,b)))[0]},unsubscribe:function(a){a.remove()},isLeftToRight:function(){return this.dir?"ltr"==this.dir.toLowerCase():q.isBodyLtr(this.ownerDocument)},isFocusable:function(){return this.focus&&"none"!=b.get(this.domNode,"display")},
placeAt:function(a,b){var d=!a.tagName&&v.byId(a);!d||!d.addChild||b&&"number"!==typeof b?(d=d&&"domNode"in d?d.containerNode&&!/after|before|replace/.test(b||"")?d.containerNode:d.domNode:e.byId(a,this.ownerDocument),c.place(this.domNode,d,b),!this._started&&(this.getParent()||{})._started&&this.startup()):d.addChild(this,b);return this},defer:function(a,b){var c=setTimeout(d.hitch(this,function(){c&&(c=null,this._destroyed||d.hitch(this,a)())}),b||0);return{remove:function(){c&&(clearTimeout(c),
c=null);return null}}}});h("dojo-bidi")&&r.extend(y);return r})},"dijit/Destroyable":function(){define(["dojo/_base/array","dojo/aspect","dojo/_base/declare"],function(p,n,m){return m("dijit.Destroyable",null,{destroy:function(n){this._destroyed=!0},own:function(){var m=["destroyRecursive","destroy","remove"];p.forEach(arguments,function(f){function a(){k.remove();p.forEach(r,function(a){a.remove()})}var e,k=n.before(this,"destroy",function(a){f[e](a)}),r=[];f.then?(e="cancel",f.then(a,a)):p.forEach(m,
function(c){"function"===typeof f[c]&&(e||(e=c),r.push(n.after(f,c,a,!0)))})},this);return arguments}})})},"dijit/_OnDijitClickMixin":function(){define("dojo/on dojo/_base/array dojo/keys dojo/_base/declare dojo/has ./a11yclick".split(" "),function(p,n,m,r,f,a){p=r("dijit._OnDijitClickMixin",null,{connect:function(e,f,n){return this.inherited(arguments,[e,"ondijitclick"==f?a:f,n])}});p.a11yclick=a;return p})},"dijit/_FocusMixin":function(){define(["./focus","./_WidgetBase","dojo/_base/declare","dojo/_base/lang"],
function(p,n,m,r){r.extend(n,{focused:!1,onFocus:function(){},onBlur:function(){},_onFocus:function(){this.onFocus()},_onBlur:function(){this.onBlur()}});return m("dijit._FocusMixin",null,{_focusManager:p})})},"dijit/hccss":function(){define(["dojo/dom-class","dojo/hccss","dojo/domReady","dojo/_base/window"],function(p,n,m,r){m(function(){n("highcontrast")&&p.add(r.body(),"dijit_a11y")});return n})},"dojo/hccss":function(){define("require ./_base/config ./dom-class ./dom-style ./has ./domReady ./_base/window".split(" "),
function(p,n,m,r,f,a,e){f.add("highcontrast",function(){var a=e.doc.createElement("div");try{a.style.cssText='border: 1px solid; border-color:red green; position: absolute; height: 5px; top: -999px;background-image: url("'+(n.blankGif||p.toUrl("./resources/blank.gif"))+'");';e.body().appendChild(a);var m=r.getComputedStyle(a),c=m.backgroundImage;return m.borderTopColor==m.borderRightColor||c&&("none"==c||"url(invalid-url:)"==c)}catch(q){return console.warn("hccss: exception detecting high-contrast mode, document is likely hidden: "+
q.toString()),!1}finally{8>=f("ie")?a.outerHTML="":e.body().removeChild(a)}});a(function(){f("highcontrast")&&m.add(e.body(),"dj_a11y")});return f})},"dijit/_Templated":function(){define("./_WidgetBase ./_TemplatedMixin ./_WidgetsInTemplateMixin dojo/_base/array dojo/_base/declare dojo/_base/lang dojo/_base/kernel".split(" "),function(p,n,m,r,f,a,e){a.extend(p,{waiRole:"",waiState:""});return f("dijit._Templated",[n,m],{constructor:function(){e.deprecated(this.declaredClass+": dijit._Templated deprecated, use dijit._TemplatedMixin and if necessary dijit._WidgetsInTemplateMixin",
"","2.0")},_processNode:function(a,e){var c=this.inherited(arguments),f=e(a,"waiRole");f&&a.setAttribute("role",f);(f=e(a,"waiState"))&&r.forEach(f.split(/\s*,\s*/),function(b){-1!=b.indexOf("-")&&(b=b.split("-"),a.setAttribute("aria-"+b[0],b[1]))});return c}})})},"dijit/_TemplatedMixin":function(){define("dojo/cache dojo/_base/declare dojo/dom-construct dojo/_base/lang dojo/on dojo/sniff dojo/string ./_AttachMixin".split(" "),function(p,n,m,r,f,a,e,k){var w=n("dijit._TemplatedMixin",k,{templateString:null,
templatePath:null,_skipNodeCache:!1,searchContainerNode:!0,_stringRepl:function(a){var c=this.declaredClass,b=this;return e.substitute(a,this,function(a,e){"!"==e.charAt(0)&&(a=r.getObject(e.substr(1),!1,b));if("undefined"==typeof a)throw Error(c+" template:"+e);return null==a?"":"!"==e.charAt(0)?a:this._escapeValue(""+a)},this)},_escapeValue:function(a){return a.replace(/["'<>&]/g,function(a){return{"\x26":"\x26amp;","\x3c":"\x26lt;","\x3e":"\x26gt;",'"':"\x26quot;","'":"\x26#x27;"}[a]})},buildRendering:function(){if(!this._rendered){this.templateString||
(this.templateString=p(this.templatePath,{sanitize:!0}));var a=w.getCachedTemplate(this.templateString,this._skipNodeCache,this.ownerDocument),e;if(r.isString(a)){if(e=m.toDom(this._stringRepl(a),this.ownerDocument),1!=e.nodeType)throw Error("Invalid template: "+a);}else e=a.cloneNode(!0);this.domNode=e}this.inherited(arguments);this._rendered||this._fillContent(this.srcNodeRef);this._rendered=!0},_fillContent:function(a){var c=this.containerNode;if(a&&c)for(;a.hasChildNodes();)c.appendChild(a.firstChild)}});
w._templateCache={};w.getCachedTemplate=function(a,f,b){var c=w._templateCache,k=a,d=c[k];if(d){try{if(!d.ownerDocument||d.ownerDocument==(b||document))return d}catch(g){}m.destroy(d)}a=e.trim(a);if(f||a.match(/\$\{([^\}]+)\}/g))return c[k]=a;f=m.toDom(a,b);if(1!=f.nodeType)throw Error("Invalid template: "+a);return c[k]=f};a("ie")&&f(window,"unload",function(){var a=w._templateCache,e;for(e in a){var b=a[e];"object"==typeof b&&m.destroy(b);delete a[e]}});return w})},"dojo/cache":function(){define(["./_base/kernel",
"./text"],function(p){return p.cache})},"dijit/_AttachMixin":function(){define("require dojo/_base/array dojo/_base/connect dojo/_base/declare dojo/_base/lang dojo/mouse dojo/on dojo/touch ./_WidgetBase".split(" "),function(p,n,m,r,f,a,e,k,w){var c=f.delegate(k,{mouseenter:a.enter,mouseleave:a.leave,keypress:m._keypress}),q;m=r("dijit._AttachMixin",null,{constructor:function(){this._attachPoints=[];this._attachEvents=[]},buildRendering:function(){this.inherited(arguments);this._attachTemplateNodes(this.domNode);
this._beforeFillContent()},_beforeFillContent:function(){},_attachTemplateNodes:function(a){for(var b=a;;)if(1==b.nodeType&&(this._processTemplateNode(b,function(a,b){return a.getAttribute(b)},this._attach)||this.searchContainerNode)&&b.firstChild)b=b.firstChild;else{if(b==a)break;for(;!b.nextSibling;)if(b=b.parentNode,b==a)return;b=b.nextSibling}},_processTemplateNode:function(a,c,e){var b=!0,g=this.attachScope||this,l=c(a,"dojoAttachPoint")||c(a,"data-dojo-attach-point");if(l)for(var h=l.split(/\s*,\s*/);l=
h.shift();)f.isArray(g[l])?g[l].push(a):g[l]=a,b="containerNode"!=l,this._attachPoints.push(l);if(c=c(a,"dojoAttachEvent")||c(a,"data-dojo-attach-event"))for(l=c.split(/\s*,\s*/),h=f.trim;c=l.shift();)if(c){var k=null;-1!=c.indexOf(":")?(k=c.split(":"),c=h(k[0]),k=h(k[1])):c=h(c);k||(k=c);this._attachEvents.push(e(a,c,f.hitch(g,k)))}return b},_attach:function(a,f,k){f=f.replace(/^on/,"").toLowerCase();f="dijitclick"==f?q||(q=p("./a11yclick")):c[f]||f;return e(a,f,k)},_detachTemplateNodes:function(){var a=
this.attachScope||this;n.forEach(this._attachPoints,function(b){delete a[b]});this._attachPoints=[];n.forEach(this._attachEvents,function(a){a.remove()});this._attachEvents=[]},destroyRendering:function(){this._detachTemplateNodes();this.inherited(arguments)}});f.extend(w,{dojoAttachEvent:"",dojoAttachPoint:""});return m})},"dijit/_WidgetsInTemplateMixin":function(){define(["dojo/_base/array","dojo/aspect","dojo/_base/declare","dojo/_base/lang","dojo/parser"],function(p,n,m,r,f){return m("dijit._WidgetsInTemplateMixin",
null,{_earlyTemplatedStartup:!1,contextRequire:null,_beforeFillContent:function(){if(/dojoType|data-dojo-type/i.test(this.domNode.innerHTML)){var a=this.domNode;this.containerNode&&!this.searchContainerNode&&(this.containerNode.stopParser=!0);f.parse(a,{noStart:!this._earlyTemplatedStartup,template:!0,inherited:{dir:this.dir,lang:this.lang,textDir:this.textDir},propsThis:this,contextRequire:this.contextRequire,scope:"dojo"}).then(r.hitch(this,function(a){this._startupWidgets=a;for(var e=0;e<a.length;e++)this._processTemplateNode(a[e],
function(a,c){return a[c]},function(a,c,e){return c in a?a.connect(a,c,e):a.on(c,e,!0)});this.containerNode&&this.containerNode.stopParser&&delete this.containerNode.stopParser}));if(!this._startupWidgets)throw Error(this.declaredClass+": parser returned unfilled promise (probably waiting for module auto-load), unsupported by _WidgetsInTemplateMixin.   Must pre-load all supporting widgets before instantiation.");}},_processTemplateNode:function(a,e,f){return e(a,"dojoType")||e(a,"data-dojo-type")?
!0:this.inherited(arguments)},startup:function(){p.forEach(this._startupWidgets,function(a){a&&!a._started&&a.startup&&a.startup()});this._startupWidgets=null;this.inherited(arguments)}})})},"dojo/parser":function(){define("require ./_base/kernel ./_base/lang ./_base/array ./_base/config ./dom ./_base/window ./_base/url ./aspect ./promise/all ./date/stamp ./Deferred ./has ./query ./on ./ready".split(" "),function(p,n,m,r,f,a,e,k,w,c,q,b,h,x,d,g){function l(a){return eval("("+a+")")}function B(a){var b=
a._nameCaseMap,d=a.prototype;if(!b||b._extendCnt<z){var b=a._nameCaseMap={},c;for(c in d)"_"!==c.charAt(0)&&(b[c.toLowerCase()]=c);b._extendCnt=z}return b}function E(a,b){b||(b=p);var d=b._dojoParserCtorMap||(b._dojoParserCtorMap={}),c=a.join();if(!d[c]){for(var g=[],e=0,l=a.length;e<l;e++){var f=a[e];g[g.length]=d[f]=d[f]||m.getObject(f)||~f.indexOf("/")&&b(f)}e=g.shift();d[c]=g.length?e.createSubclass?e.createSubclass(g):e.extend.apply(e,g):e}return d[c]}new Date("X");var z=0;w.after(m,"extend",
function(){z++},!0);var D={_clearCache:function(){z++;_ctorMap={}},_functionFromScript:function(a,b){var d="",c="",g=a.getAttribute(b+"args")||a.getAttribute("args"),e=a.getAttribute("with"),g=(g||"").split(/\s*,\s*/);e&&e.length&&r.forEach(e.split(/\s*,\s*/),function(a){d+="with("+a+"){";c+="}"});return new Function(g,d+a.innerHTML+c)},instantiate:function(a,b,d){b=b||{};d=d||{};var c=(d.scope||n._scopeName)+"Type",g="data-"+(d.scope||n._scopeName)+"-",e=g+"type",l=g+"mixins",f=[];r.forEach(a,function(a){var d=
c in b?b[c]:a.getAttribute(e)||a.getAttribute(c);if(d){var g=a.getAttribute(l),d=g?[d].concat(g.split(/\s*,\s*/)):[d];f.push({node:a,types:d})}});return this._instantiate(f,b,d)},_instantiate:function(a,b,d,g){function e(a){b._started||d.noStart||r.forEach(a,function(a){"function"!==typeof a.startup||a._started||a.startup()});return a}a=r.map(a,function(a){var c=a.ctor||E(a.types,d.contextRequire);if(!c)throw Error("Unable to resolve constructor for: '"+a.types.join()+"'");return this.construct(c,
a.node,b,d,a.scripts,a.inherited)},this);return g?c(a).then(e):e(a)},construct:function(a,b,c,g,e,f){function p(a){z&&m.setObject(z,a);for(M=0;M<C.length;M++)w[C[M].advice||"after"](a,C[M].method,m.hitch(a,C[M].func),!0);for(M=0;M<F.length;M++)F[M].call(a);for(M=0;M<H.length;M++)a.watch(H[M].prop,H[M].func);for(M=0;M<Q.length;M++)d(a,Q[M].event,Q[M].func);return a}var v=a&&a.prototype;g=g||{};var I={};g.defaults&&m.mixin(I,g.defaults);f&&m.mixin(I,f);var J;h("dom-attributes-explicit")?J=b.attributes:
h("dom-attributes-specified-flag")?J=r.filter(b.attributes,function(a){return a.specified}):(f=(/^input$|^img$/i.test(b.nodeName)?b:b.cloneNode(!1)).outerHTML.replace(/=[^\s"']+|="[^"]*"|='[^']*'/g,"").replace(/^\s*<[a-zA-Z0-9]*\s*/,"").replace(/\s*>.*$/,""),J=r.map(f.split(/\s+/),function(a){var d=a.toLowerCase();return{name:a,value:"LI"==b.nodeName&&"value"==a||"enctype"==d?b.getAttribute(d):b.getAttributeNode(d).value}}));var A=g.scope||n._scopeName;f="data-"+A+"-";var K={};"dojo"!==A&&(K[f+"props"]=
"data-dojo-props",K[f+"type"]="data-dojo-type",K[f+"mixins"]="data-dojo-mixins",K[A+"type"]="dojotype",K[f+"id"]="data-dojo-id");for(var M=0,u,A=[],z,E;u=J[M++];){var y=u.name,D=y.toLowerCase();u=u.value;switch(K[D]||D){case "data-dojo-type":case "dojotype":case "data-dojo-mixins":break;case "data-dojo-props":E=u;break;case "data-dojo-id":case "jsid":z=u;break;case "data-dojo-attach-point":case "dojoattachpoint":I.dojoAttachPoint=u;break;case "data-dojo-attach-event":case "dojoattachevent":I.dojoAttachEvent=
u;break;case "class":I["class"]=b.className;break;case "style":I.style=b.style&&b.style.cssText;break;default:if(y in v||(y=B(a)[D]||y),y in v)switch(typeof v[y]){case "string":I[y]=u;break;case "number":I[y]=u.length?Number(u):NaN;break;case "boolean":I[y]="false"!=u.toLowerCase();break;case "function":""===u||-1!=u.search(/[^\w\.]+/i)?I[y]=new Function(u):I[y]=m.getObject(u,!1)||new Function(u);A.push(y);break;default:D=v[y],I[y]=D&&"length"in D?u?u.split(/\s*,\s*/):[]:D instanceof Date?""==u?new Date(""):
"now"==u?new Date:q.fromISOString(u):D instanceof k?n.baseUrl+u:l(u)}else I[y]=u}}for(J=0;J<A.length;J++)K=A[J].toLowerCase(),b.removeAttribute(K),b[K]=null;if(E)try{E=l.call(g.propsThis,"{"+E+"}"),m.mixin(I,E)}catch(P){throw Error(P.toString()+" in data-dojo-props\x3d'"+E+"'");}m.mixin(I,c);e||(e=a&&(a._noScript||v._noScript)?[]:x("\x3e script[type^\x3d'dojo/']",b));var C=[],F=[],H=[],Q=[];if(e)for(M=0;M<e.length;M++)K=e[M],b.removeChild(K),c=K.getAttribute(f+"event")||K.getAttribute("event"),g=
K.getAttribute(f+"prop"),E=K.getAttribute(f+"method"),A=K.getAttribute(f+"advice"),J=K.getAttribute("type"),K=this._functionFromScript(K,f),c?"dojo/connect"==J?C.push({method:c,func:K}):"dojo/on"==J?Q.push({event:c,func:K}):I[c]=K:"dojo/aspect"==J?C.push({method:E,advice:A,func:K}):"dojo/watch"==J?H.push({prop:g,func:K}):F.push(K);a=(e=a.markupFactory||v.markupFactory)?e(I,b,a):new a(I,b);return a.then?a.then(p):p(a)},scan:function(a,d){function c(a){if(!a.inherited){a.inherited={};var b=a.node,d=
c(a.parent),b={dir:b.getAttribute("dir")||d.dir,lang:b.getAttribute("lang")||d.lang,textDir:b.getAttribute(J)||d.textDir},g;for(g in b)b[g]&&(a.inherited[g]=b[g])}return a.inherited}var g=[],e=[],l={},f=(d.scope||n._scopeName)+"Type",k="data-"+(d.scope||n._scopeName)+"-",I=k+"type",J=k+"textdir",k=k+"mixins",m=a.firstChild,q=d.inherited;if(!q){var B=function(a,b){return a.getAttribute&&a.getAttribute(b)||a.parentNode&&B(a.parentNode,b)},q={dir:B(a,"dir"),lang:B(a,"lang"),textDir:B(a,J)},v;for(v in q)q[v]||
delete q[v]}for(var q={inherited:q},w,z;;)if(m)if(1!=m.nodeType)m=m.nextSibling;else if(w&&"script"==m.nodeName.toLowerCase())(y=m.getAttribute("type"))&&/^dojo\/\w/i.test(y)&&w.push(m),m=m.nextSibling;else if(z)m=m.nextSibling;else{var y=m.getAttribute(I)||m.getAttribute(f);v=m.firstChild;if(y||v&&(3!=v.nodeType||v.nextSibling)){z=null;if(y){var D=m.getAttribute(k);w=D?[y].concat(D.split(/\s*,\s*/)):[y];try{z=E(w,d.contextRequire)}catch(T){}z||r.forEach(w,function(a){~a.indexOf("/")&&!l[a]&&(l[a]=
!0,e[e.length]=a)});D=z&&!z.prototype._noScript?[]:null;q={types:w,ctor:z,parent:q,node:m,scripts:D};q.inherited=c(q);g.push(q)}else q={node:m,scripts:w,parent:q};w=D;z=m.stopParser||z&&z.prototype.stopParser&&!d.template;m=v}else m=m.nextSibling}else{if(!q||!q.node)break;m=q.node.nextSibling;z=!1;q=q.parent;w=q.scripts}var x=new b;e.length?(h("dojo-debug-messages")&&console.warn("WARNING: Modules being Auto-Required: "+e.join(", ")),(d.contextRequire||p)(e,function(){x.resolve(r.filter(g,function(a){if(!a.ctor)try{a.ctor=
E(a.types,d.contextRequire)}catch(P){}for(var b=a.parent;b&&!b.types;)b=b.parent;var c=a.ctor&&a.ctor.prototype;a.instantiateChildren=!(c&&c.stopParser&&!d.template);a.instantiate=!b||b.instantiate&&b.instantiateChildren;return a.instantiate}))})):x.resolve(g);return x.promise},_require:function(a,d){var c=l("{"+a.innerHTML+"}"),g=[],e=[],f=new b,h=d&&d.contextRequire||p,k;for(k in c)g.push(k),e.push(c[k]);h(e,function(){for(var a=0;a<g.length;a++)m.setObject(g[a],arguments[a]);f.resolve(arguments)});
return f.promise},_scanAmd:function(a,d){var c=new b,g=c.promise;c.resolve(!0);var e=this;x("script[type\x3d'dojo/require']",a).forEach(function(a){g=g.then(function(){return e._require(a,d)});a.parentNode.removeChild(a)});return g},parse:function(b,d){!b||"string"==typeof b||"nodeType"in b||(d=b,b=d.rootNode);var c=b?a.byId(b):e.body();d=d||{};var g=d.template?{template:!0}:{},l=[],f=this,h=this._scanAmd(c,d).then(function(){return f.scan(c,d)}).then(function(a){return f._instantiate(a,g,d,!0)}).then(function(a){return l=
l.concat(a)}).otherwise(function(a){console.error("dojo/parser::parse() error",a);throw a;});m.mixin(l,h);return l}};n.parser=D;f.parseOnLoad&&g(100,D,"parse");return D})},"dojo/date/stamp":function(){define(["../_base/lang","../_base/array"],function(p,n){var m={};p.setObject("dojo.date.stamp",m);m.fromISOString=function(p,f){m._isoRegExp||(m._isoRegExp=/^(?:(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(.\d+)?)?((?:[+-](\d{2}):(\d{2}))|Z)?)?$/);var a=m._isoRegExp.exec(p),e=null;
if(a){a.shift();a[1]&&a[1]--;a[6]&&(a[6]*=1E3);f&&(f=new Date(f),n.forEach(n.map("FullYear Month Date Hours Minutes Seconds Milliseconds".split(" "),function(a){return f["get"+a]()}),function(c,e){a[e]=a[e]||c}));e=new Date(a[0]||1970,a[1]||0,a[2]||1,a[3]||0,a[4]||0,a[5]||0,a[6]||0);100>a[0]&&e.setFullYear(a[0]||1970);var k=0,r=a[7]&&a[7].charAt(0);"Z"!=r&&(k=60*(a[8]||0)+(Number(a[9])||0),"-"!=r&&(k*=-1));r&&(k-=e.getTimezoneOffset());k&&e.setTime(e.getTime()+6E4*k)}return e};m.toISOString=function(n,
f){var a=function(a){return 10>a?"0"+a:a};f=f||{};var e=[],k=f.zulu?"getUTC":"get",m="";"time"!=f.selector&&(m=n[k+"FullYear"](),m=["0000".substr((m+"").length)+m,a(n[k+"Month"]()+1),a(n[k+"Date"]())].join("-"));e.push(m);if("date"!=f.selector){m=[a(n[k+"Hours"]()),a(n[k+"Minutes"]()),a(n[k+"Seconds"]())].join(":");k=n[k+"Milliseconds"]();f.milliseconds&&(m+="."+(100>k?"0":"")+a(k));if(f.zulu)m+="Z";else if("time"!=f.selector)var k=n.getTimezoneOffset(),c=Math.abs(k),m=m+((0<k?"-":"+")+a(Math.floor(c/
60))+":"+a(c%60));e.push(m)}return e.join("T")};return m})},"esri/dijit/_EventedWidget":function(){define("dojo/_base/declare dojo/_base/lang dojo/aspect dojo/on ../Evented dijit/_WidgetBase".split(" "),function(p,n,m,r,f,a){return p([a,f],{_onMap:function(a){var e=this.constructor._onMap,f;e&&e.FINAL||(delete this.constructor._onMap,e=this.registerConnectEvents(),e.FINAL=!0);a=a.toLowerCase();e[a]?f=this[e[a].method]:(a=this._onCamelCase(a),this[a]&&(f=a));return f},on:function(a,f){var e=this._onMap(a),
c=a.replace(/\-/g,""),k="on"+c in this.domNode;return e||!k?this.inherited(arguments):this.own(r(this.domNode,c,f))[0]},emit:function(a,f,m){var c,e,b,h=a.toLowerCase(),k=this.constructor._onMap||this.registerConnectEvents();e=this[this._onMap(h)];f=f||{};f.target||(f.target=this);e&&k&&k[h]&&(this._onObj2Arr(function(){c=Array.prototype.slice.call(arguments)},k[h].argKeys)(f),b=n.mixin({},arguments),b[2]=c,b[0]=k[h].name.replace(/^on/,""));return this.inherited(b||arguments)}})})},"esri/dijit/Legend/utils":function(){define(["dojo/_base/lang",
"../../lang","dojo/i18n!../../nls/jsapi"],function(p,n,m){var r=m.widgets.legend;return{getVisualVariableTitle:function(f,a){var e,k=f.field,m=f.normalizationField,c=!1,q=!1,b=!1,h,k=p.isFunction(k)?null:k,m=p.isFunction(m)?null:m;if(f.legendOptions&&f.legendOptions.title)e=f.legendOptions.title;else if(f.valueExpressionTitle)e=f.valueExpressionTitle;else{if(a.renderer&&a.renderer.authoringInfo&&a.renderer.authoringInfo.visualVariables){var x=a.renderer.authoringInfo.visualVariables;for(h=0;h<x.length;h++){var d=
x[h];if("colorInfo"===d.type&&"ratio"===d.style){c=!0;break}else if("colorInfo"===d.type&&"percent"===d.style){q=!0;break}else if("colorInfo"===d.type&&"percentTotal"===d.style){b=!0;break}}}(c=b&&"showRatioPercentTotal"||q&&"showRatioPercent"||c&&"showRatio"||m&&"showNormField"||k&&"showField"||null)&&(e=n.substitute({field:k&&a.getFieldLabel(k),normField:m&&a.getFieldLabel(m)},r[c]))}return e},getRendererTitle:function(f,a){var e;if(f){var k,m,c;"esri.renderer.ClassBreaksRenderer"===f.declaredClass&&
(k=f.attributeField,m=f.normalizationField,c="percent-of-total"===f.normalizationType);k=p.isFunction(k)?null:k;m=p.isFunction(m)?null:m;f.legendOptions&&f.legendOptions.title?e=f.legendOptions.title:f.valueExpressionTitle?e=f.valueExpressionTitle:(c=m&&"showNormField"||(c?"showNormPct":null)||k&&"showField"||null)&&(e=n.substitute({field:k&&a.getFieldLabel(k),normField:m&&a.getFieldLabel(m)},r[c]))}return e}}})},"esri/layers/clustering/GeohashAggregation":function(){define("dojo/has dojo/_base/declare dojo/_base/lang dojo/_base/array ../../kernel ../../Evented ../../geometry/Point ../../geometry/Extent ../../geometry/mathUtils ../../support/expressionUtils ../../core/timerUtils ../support/attributeUtils ./geohashUtils ./statUtils".split(" "),
function(p,n,m,r,f,a,e,k,w,c,q,b,h,x){n=n(a,{loaded:!1,map:null,layer:null,lod:null,tolerance:null,clusterMode:null,clusterRadius:null,sortEnabled:!0,filterEnabled:!0,bufferEnabled:!0,updateEnabled:!0,clusters:null,clustersEnabled:!0,statisticInfos:null,defaults:{lod:1,tolerance:0,clusterMode:"auto",clusterRadius:80,sortEnabled:!0,filterEnabled:!0,bufferEnabled:!0,updateEnabled:!0},_eventHandles:null,_updateHandle:null,_cellIndex:null,_globalIndex:null,_perfProfile:null,_cellSizeScaleFactor:1.5,_extentScaleFactor:1.25,
_maxGeohashLength:12,_minClusterRadius:15,_levelChange:!0,_clusterFieldPrefix:"cluster_",_mapLevelChange:!1,constructor:function(a){this._update=m.hitch(this,this._update);this._eventHandles=[];this._globalIndex={numFeatures:null,fullExtent:null,lodStats:null};this._perfProfile={lastIndex:{total:null,numFeatures:0},lastUpdate:{cells:null,clusters:null,total:null}};this.clusters=[];this.map=a.map;this.layer=a.layer;this.setLod(a.lod);this.setTolerance(a.tolerance);this.setClusterMode(a.clusterMode);
this.setClusterRadius(a.clusterRadius);this.setSortEnabled(a.sortEnabled);this.setFilterEnabled(a.filterEnabled);this.setBufferEnabled(a.bufferEnabled);this.setUpdateEnabled(a.updateEnabled);this.setStatisticInfos(a.statisticInfos);this._load();this.loaded?this._startup():this._eventHandles.push(this.on("load",m.hitch(this,this._startup)))},destroy:function(a){this._displayFeatures(!0,a);r.forEach(this._eventHandles,function(a){a.remove()});q.clearTimeout(this._updateHandle);this._cellIndex=this._globalIndex=
this._eventHandles=this._updateHandle=this.map=this.layer=this.clusters=null},setLod:function(a){var b=this.lod;this.lod=a||this.defaults.lod;b!==this.lod&&this.update()},setTolerance:function(a){var b=this.tolerance;this.tolerance=a||this.defaults.tolerance;b!==this.tolerance&&this.update()},setClusterMode:function(a){var b=this.clusterMode;this.clusterMode=a||this.defaults.clusterMode;this._evalClusterParams();b!==this.clusterMode&&this.update()},setClusterRadius:function(a){var b=this.clusterRadius;
this.clusterRadius=null!=a?a:this.defaults.clusterRadius;this._evalClusterParams();b!==this.clusterRadius&&this.update()},setSortEnabled:function(a){var b=this.sortEnabled;this.sortEnabled=null!=a?!!a:this.defaults.sortEnabled;b!==this.sortEnabled&&this.update()},setFilterEnabled:function(a){var b=this.filterEnabled;this.filterEnabled=null!=a?!!a:this.defaults.filterEnabled;b!==this.filterEnabled&&this.update()},setBufferEnabled:function(a){var b=this.bufferEnabled;this.bufferEnabled=null!=a?!!a:
this.defaults.bufferEnabled;b!==this.bufferEnabled&&this.update()},setUpdateEnabled:function(a){var b=this.updateEnabled;(this.updateEnabled=null!=a?!!a:this.defaults.updateEnabled)&&b!==this.updateEnabled&&(this._mapLevelChange=!0,this.update())},setStatisticInfos:function(a){this.statisticInfos=a||[];this.loaded&&this._applyStatInfos(this.statisticInfos)},update:function(){this.loaded&&null==this._updateHandle&&(this._updateHandle=q.setTimeout(this._update,q.priority.HIGH))},isUpdateScheduled:function(){return null!=
this._updateHandle},getCell:function(a){return this._cellIndex[a.length][a]},getCluster:function(a){var b;r.some(this.clusters,function(d){-1<r.indexOf(d.geohashes,a)&&(b=d);return!!b});return b},getCellsInCluster:function(a){var b=[];r.forEach(a&&a.geohashes,function(a){(a=this.getCell(a))&&b.push(a)},this);return b},getFeaturesInCluster:function(a){var b=[];a=this.getCellsInCluster(a);r.forEach(a,function(a){Array.prototype.push.apply(b,a.features)});return b},getCurrentLodStats:function(){var a=
this._globalIndex.lodStats;return a&&a[this.lod]},getNumFeatures:function(){return this._globalIndex.numFeatures},getFullExtent:function(){var a=this._globalIndex.fullExtent;return a&&Infinity!==a.xmin?new k(a):null},_load:function(){this._displayFeatures(!1);this._checkLoadStatus();this.map.loaded||this._eventHandles.push(this.map.on("load",m.hitch(this,this._checkLoadStatus)));this.layer.loaded||this._eventHandles.push(this.layer.on("load",m.hitch(this,this._checkLoadStatus)))},_checkLoadStatus:function(){if(this.map.loaded&&
this.layer.loaded){var a;if("esriGeometryPoint"!==this.layer.geometryType)a=Error("GeohashAggregation is supported only for points");else{var b=this.map.spatialReference;b.isWebMercator()||4326===b.wkid||(a=Error("GeohashAggregation is supported only when map spatial reference is WGS84 or WebMercator"))}a?(this.loadError=a,this.emit("load-error",{error:a})):(this.loaded=!0,this.emit("load"))}},_startup:function(){this._evalUpdateStatus();this._processFeatures();this._processExtentChange();this._eventHandles.push(this.layer.on("update-end",
m.hitch(this,this._processFeatures)),this.layer.on("edits-complete",m.hitch(this,this._processFeatures)),this.layer.on("graphics-clear",m.hitch(this,this._processFeatures)),this.layer.on("suspend",m.hitch(this,this._evalUpdateStatus)),this.layer.on("resume",m.hitch(this,this._evalUpdateStatus)),this.map.on("extent-change",m.hitch(this,this._processExtentChange)))},_processFeatures:function(){this._indexFeatures();this.update()},_evalUpdateStatus:function(){this.setUpdateEnabled(!this.layer.suspended)},
_processExtentChange:function(a){this._mapLevelChange=!(!a||!a.levelChange);this._evalClusterParams();this.update()},_update:function(){this._updateHandle=null;if(this.updateEnabled){this.emit("update-start");if(this.clustersEnabled){var a=this.map.geographicExtent;if(a){var b=this._getIntersectingCells(a),a=this._getClusters(b.cells,a);this.clusters=a.clusters;this._applyStatInfosToClusters();var b=b.profile,a=a.profile,c=b.total+a.total;b.total=this._getElapsedTime(b.total);a.total=this._getElapsedTime(a.total);
var e=this._perfProfile.lastUpdate={};e.cells=b;e.clusters=a;e.total=this._getElapsedTime(c)}}else this.clusters=[],this._perfProfile.lastUpdate=null;b=this._mapLevelChange;this._mapLevelChange=!1;this.emit("update-end",{levelChange:this._levelChange,mapLevelChange:b})}},_displayFeatures:function(a,b){var d=this.layer,c=!a;d.suspendGraphics(c);!1!==b&&(c?d.clearNodes():d.redraw())},_indexFeatures:function(){var a=this._getTime();this._initializeIndexing();var b=0,c=this._globalIndex.fullExtent;r.forEach(this.layer.graphics,
function(a){if(a.visible){var d=a.geometry,e=this._getLngLat(d),g;e&&(g=d.getCacheValue("_geohash"),void 0===g&&(g=h.pointToGeohash(e),d.setCacheValue("_geohash",g||null)));g&&(this._addGeohashToIndex(g,a,e),b++,this._updateExtent(c,e))}},this);this._applyStatInfosToIndex();this._globalIndex.numFeatures=b;for(var e=this._globalIndex.lodStats,f=1;f<=this._maxGeohashLength;f++)e[f]=this._getLODStats(f,b);this._perfProfile.lastIndex.total=this._getElapsedTime(a,this._getTime());this._perfProfile.lastIndex.numFeatures=
b;this.emit("index-complete")},_initializeIndexing:function(){this._globalIndex={numFeatures:0,fullExtent:{xmin:Infinity,ymin:Infinity,xmax:-Infinity,ymax:-Infinity},lodStats:{}};for(var a=this._cellIndex=[],b=1;b<=this._maxGeohashLength;b++)a[b]={}},_getLngLat:function(a){if(a){var b=a.getLongitude();a=a.getLatitude();a=null!=b&&null!=a?{x:b,y:a}:null}return a},_addGeohashToIndex:function(a,b,c){for(var d=this._cellIndex,e="",g=0;g<this._maxGeohashLength;g++){var e=e+a[g],f=d[e.length],l=f[e];l||
(l=f[e]={count:0,centroid:{x:null,y:null},extent:{xmin:Infinity,ymin:Infinity,xmax:-Infinity,ymax:-Infinity},features:[],geohash:e,statistics:null});this._updateItem(l,1,c,!0);l.features.push(b)}},_getLODStats:function(a,b){var d=this._cellIndex[a],c=0,e=Infinity,g=-Infinity,f=null,h;for(h in d){var k=d[h];c++;k.count<e&&(e=k.count);k.count>g&&(g=k.count)}0<c&&(f=Number((b/c).toFixed(2)));return{lod:a,count:c,min:Infinity===e?null:e,max:-Infinity===g?null:g,avg:f}},_evalClusterParams:function(){if(this.loaded&&
"auto"===this.clusterMode){var a=this._getClusterParams(this.map.getResolutionInMeters(),this.clusterRadius,this._minClusterRadius);this._levelChange=this.lod!==a.lod;this.lod=a.lod;this.tolerance=a.tolerance}},_getClusterParams:function(a,b,c){b<c&&(b=c);a=Math.ceil(a*b);b=this._getClosestLODRange(a).max;do c=this._getCellSize(b),(c=a>=this._cellSizeScaleFactor*c||1===c)||(b+=1);while(!c);c=a/this._getCellSize(b);return{lod:b,tolerance:a,multiplier:Number(c.toFixed(2))}},_getClosestLODRange:function(a){for(var b,
d=this._maxGeohashLength;1<=d;d--)if(this._getCellSize(d)>=a){b=d;break}null==b&&(b=1);a=b+1;a>this._maxGeohashLength&&(a=this._maxGeohashLength);return{min:b,max:a}},_getCellSize:function(a){a=h.getCellSizeInMeters(a);return Math.ceil(Math.min(a.width,a.height))},_sorter:function(a,b){var d=a.centroid,c=b.centroid;return a.count>b.count?-1:a.count<b.count?1:d.x>c.x?-1:d.x<c.x?1:0},_getIntersectingCells:function(a){var b=this._getTime();a=a.expand(this._extentScaleFactor);var d=h.getIntersecting(a,
this.lod,this.bufferEnabled?this.tolerance:0);a=this._getTime();var c=[],e=this.tolerance,f=this.sortEnabled;r.forEach(d,function(a){(a=this.getCell(a))&&c.push(a)},this);e&&f&&c.sort(this._sorter);d=this._getTime();return{cells:c,profile:{findCells:this._getElapsedTime(b,a),scanAndSortCells:this._getElapsedTime(a,d),total:d-b}}},_getClusters:function(a,b){var d=this._getTime(),c=[],e={},g={findCells:0};r.forEach(a,function(a,b){var d=this._createCluster(a,e,g);d&&c.push(d)},this);this._markIntersecting(c,
b);this.filterEnabled&&(c=this._getIntersectingClusters(c));var f=this._getTime();return{clusters:c,profile:{findCellsInCluster:this._getElapsedTime(g.findCells),total:f-d}}},_markIntersecting:function(a,b){var d=b.normalize();r.forEach(a,function(a){var b=a.centroid.x,c=a.centroid.y;a.isIntersecting=r.some(d,function(a){return b>=a.xmin&&b<=a.xmax&&c>=a.ymin&&c<=a.ymax})})},_getIntersectingClusters:function(a){return r.filter(a,function(a){return a.isIntersecting})},_createCluster:function(a,b,c){if(!b[a.geohash]){var d=
[{cell:a,distance:0}];if(this.tolerance){var e=this._getTime(),g=h.getNeighborsWithinDistance(a.centroid,this.lod,this.tolerance);c.findCells+=this._getTime()-e;r.forEach(g,function(b){if(b!==a.geohash&&(b=this.getCell(b))){var c=this._calculateDistance(a.centroid,b.centroid);c<=this.tolerance&&d.push({cell:b,distance:c})}},this)}return this._mergeCells(d,b)}},_calculateDistance:function(a,b){return w.getLength(h.geographicToWebMercator(a),h.geographicToWebMercator(b))},_mergeCells:function(a,b){var d=
this._initializeCluster({},a[0].cell.geohash);r.forEach(a,function(a){var c=a.cell,e=c.geohash;a=a.distance;var g=b[e];if(g)if(a<g.distance)this._removeCellFromCluster(e,b);else return;b[e]={cluster:d,distance:a};this._updateItem(d,c.count,c.centroid);d.geohashes.push(e)},this);return d},_removeCellFromCluster:function(a,b){var d=b[a].cluster;delete b[a];var c=r.indexOf(d.geohashes,a);-1<c&&d.geohashes.splice(c,1);this._reevaluateCluster(d)},_reevaluateCluster:function(a){var b=a.geohashes;a=this._initializeCluster(a,
a.primary);r.forEach(b,function(b){var d=this.getCell(b);d&&(this._updateItem(a,d.count,d.centroid),a.geohashes.push(b))},this)},_initializeCluster:function(a,b){a.count=0;a.centroid=new e(null,null);a.geohashes=[];a.primary=b;a.statistics=null;return a},_applyStatInfos:function(a){a=this._getValidStatInfos(a);this._applyStatInfosToIndex(a);this._applyStatInfosToClusters(a)},_getValidStatInfos:function(a){var d=[];r.forEach(a,function(a){var c=a.attributeInfo;a=a.statisticType;var e="angle"===c.attributeType;
if(x.isSupportedStatisticType(a)&&(!e||"avg"===a)){var g="arithmetic"===c.rotationType;d.push({attributeCache:b.createAttributeCache(c,"type"===a),identifier:x.getStatisticId(c,a),statFunctions:x.getStatisticFunctions(a),isAngular:e,isDate:"date"===c.attributeType,isArithmetic:g})}});return d},_applyStatInfosToIndex:function(a){a=a||this._getValidStatInfos(this.statisticInfos);var b=this._cellIndex;if(b)for(var d=1;d<=this._maxGeohashLength;d++){var c=b[d],e;for(e in c)this._applyStatInfosToCell(c[e],
a)}},_applyStatInfosToCell:function(a,b){var d=this._initializeStats(a,b);r.forEach(a.features,function(a){this._calcFeatureStats(a,b,d)},this);this._summarizeStats(a,d,b)},_calcFeatureStats:function(a,b,e){a.attributes&&r.forEach(b,function(b){var d=e[b.identifier],g=b.attributeCache,g=g?a._getDataValue(g.attributeInfo,g,c):null;b.statFunctions.updateCellStat(d,g,b)})},_applyStatInfosToClusters:function(a){a=a||this._getValidStatInfos(this.statisticInfos);var b=this._clusterFieldPrefix;r.forEach(this.clusters,
function(c){var d=this._initializeStats(c,a);r.forEach(this.getCellsInCluster(c),function(b){this._calcCellStats(b,a,d)},this);this._summarizeStats(c,d,a,b);c.attributes[b+"id"]=c.primary},this)},_calcCellStats:function(a,b,c){var d=a.statistics;r.forEach(b,function(a){var b=a.identifier;a.statFunctions.updateClusterStat(c[b],d[b],a)})},_initializeStats:function(a,b){var c=a.statistics={};r.forEach(b,function(a){c[a.identifier]=a.statFunctions.initialize(a)});return c},_summarizeStats:function(a,
b,c,e){var d=a.attributes={};e=e||"";d[e+"count"]=a.count;r.forEach(c,function(a){var c=this._getStatFieldName(a,e);d[c]=a.statFunctions.summarize(b[a.identifier],a)},this)},_getStatFieldName:function(a,b){return(b||"")+a.identifier},_updateItem:function(a,b,c,e){var d=c.y,g=a.centroid,f=a.count;g.x=(f*g.x+b*c.x)/(f+b);g.y=(f*g.y+b*d)/(f+b);a.count+=b;e&&this._updateExtent(a.extent,c)},_updateExtent:function(a,b){var c=b.x,d=b.y;c<a.xmin&&(a.xmin=c);c>a.xmax&&(a.xmax=c);d<a.ymin&&(a.ymin=d);d>a.ymax&&
(a.ymax=d)},_getTime:function(){return window.performance?window.performance.now():(new Date).getTime()},_getElapsedTime:function(a,b){var c,d;d=null!=a&&null!=b?b-a:a;null!=d&&(c="millisecond",1E3<=d&&(d/=1E3,c="second",60<=d&&(d/=60,c="minute")),c={value:Number(d.toFixed(2)),unit:c});return c}});p("extend-esri")&&m.setObject("layers.clustering.GeohashAggregation",n,f);return n})},"esri/core/timerUtils":function(){define([],function(){function p(a){var e,f=a.length;for(e=0;e<f;e++)a[e]()}var n={LOW:1,
HIGH:2},m,r={};r[n.LOW]=[];r[n.HIGH]=[];var f=function(){clearTimeout(m);m=null;var a=r[n.HIGH];r[n.HIGH]=[];p(a);a=r[n.LOW];r[n.LOW]=[];p(a)};return{priority:n,callbackQueue:r,setTimeout:function(a,e){var k=[e,r[e].push(a)-1];m||(m=setTimeout(f,0));return k},clearTimeout:function(a){a&&r[a[0]].splice(a[1],1)}}})},"esri/layers/clustering/geohashUtils":function(){define("dojo/has dojo/string dojo/_base/lang dojo/_base/array ../../kernel ../../geometry/Point ../../geometry/Extent ../../SpatialReference ../../geometry/webMercatorUtils".split(" "),
function(p,n,m,r,f,a,e,k,w){function c(a){var b=a.spatialReference;if(!b)return{x:a.x,y:a.y};var c=b.isWebMercator(),d;4326===b.wkid?d={x:a.x,y:a.y}:c&&(d={x:a.getLongitude(),y:a.getLatitude()});return d}function q(a){var b=a.spatialReference,c=!(!b||!b.isWebMercator()),d;b&&4326===b.wkid?d=new e(a.toJson()):c&&(d=w.webMercatorToGeographic(a,!0));return d}function b(b,c){c.x=a.prototype._normalizeX(b.x,k.prototype._info[4326]);c.y=b.y;return c}function h(a){a=L.decimals[a].toString(2);return n.pad(a,
L.bitsPerBase32Char,"0")}function x(a,b){var c;b=b.slice();b.splice(1,0,0);for(var d=b[0],e=b[2],f=0;f<a.length;f++)Number(a[f])?b[0]=b[1]:b[2]=b[1],c=b[1]=(b[0]+b[2])/2,d=b[0],e=b[2];return{value:c,min:d,max:e}}function d(a,b,c){var d=[];b=b.slice();b.splice(1,0,0);for(var e=b[0],f=b[2],g=0;g<c;g++)a>=b[1]?(b[0]=b[1],e=1):(b[2]=b[1],e=0),b[1]=(b[0]+b[2])/2,d.push(e),e=b[0],f=b[2];return{value:d.join(""),min:e,max:f}}function g(a){var b=a*L.bitsPerBase32Char;0===b%2?a=b/=2:(a=(b+1)/2,b-=a);return{lon:a,
lat:b}}function l(a){var b=0;a=a.split("").reverse().join("");for(var c=0;c<a.length;c++)b+=Number(a[c])*Math.pow(2,c);return L.base32[b]}function B(a,b){var c={x:a.xmin,y:a.ymax},d={x:a.xmax,y:a.ymin},e={x:a.xmax,y:a.ymax};return{sw:N.pointToGeohash({x:a.xmin,y:a.ymin},b),nw:N.pointToGeohash(c,b),se:N.pointToGeohash(d,b),ne:N.pointToGeohash(e,b)}}function E(a,b,c,d,e){var f=a;do e[f]||(e[f]=!0,d.push(f)),(a=f===b)||(f=F(f,c));while(!a)}function z(a,b,c,d){var e=B(a,b);a=[];E(e.sw,e.nw,"n",a,{});
b=[];E(e.se,e.ne,"n",b,{});for(e=0;e<a.length;e++)E(a[e],b[e],"e",c,d)}function D(a){return r.filter(a,function(a){return 180===a.xmax?!0:!1})[0]}function y(a){return r.filter(a,function(a){return-180===a.xmin?!0:!1})[0]}function v(a,b,c,d){var f=N.geographicToWebMercator(a);a={x:f.x-b,y:f.y-b};b=N.webMercatorToGeographic({x:f.x+b,y:f.y+b},!0);a=N.webMercatorToGeographic(a,!0);return new e(null!=c?c:a.x,a.y,null!=d?d:b.x,b.y)}function u(a,b,c,d){var f;a=B(a,b);var g,h;"min"===d?h=180:"max"===d&&(g=
-180);var k=g;d=h;f=N.geohashToCell(a.sw).extent;b=N.geohashToCell(a.ne).extent;a=null!=k?k:f.xmin;f=f.ymin;d=null!=d?d:b.xmax;b=b.ymax;a=v({x:a,y:f},c,g,h);c=v({x:d,y:b},c,g,h);return new e(a.xmin,a.ymin,c.xmax,c.ymax)}function H(a,b,c){var d=a,e=0;do e++,(a=d===b)||(d=F(d,c));while(!a);return e}function C(a,b){var c=B(a,b),d=H(c.nw,c.ne,"e");return{rows:H(c.nw,c.sw,"s"),cols:d}}function F(a,b){var c=a.length%2,d=a.slice(-1),e=L.decimals[d],f=a.slice(0,-1);-1!=L.borders[b][c].indexOf(d)&&f&&(f=F(f,
b));return f+L.neighbors[b][c][e]}var L={base32:"0123456789bcdefghjkmnpqrstuvwxyz",decimals:function(){for(var a={},b=0;32>b;b++)a["0123456789bcdefghjkmnpqrstuvwxyz"[b]]=b;return a}(),neighbors:{n:[null,"238967debc01fg45kmstqrwxuvhjyznp"],s:[null,"bc01fg45238967deuvhjyznpkmstqrwx"],e:[null,"14365h7k9dcfesgujnmqp0r2twvyx8zb"],w:[null,"p0r21436x8zb9dcf5h7kjnmqesgutwvy"]},borders:{n:[null,"bcfguvyz"],s:[null,"0145hjnp"],e:[null,"prxz"],w:[null,"028b"]},bitsPerBase32Char:5,maxGeohashLength:12,longitudeRange:[-180,
180],latitudeRange:[-90,90]};L.neighbors.n[0]="14365h7k9dcfesgujnmqp0r2twvyx8zb";L.neighbors.s[0]="p0r21436x8zb9dcf5h7kjnmqesgutwvy";L.neighbors.e[0]="238967debc01fg45kmstqrwxuvhjyznp";L.neighbors.w[0]="bc01fg45238967deuvhjyznpkmstqrwx";L.borders.n[0]="prxz";L.borders.s[0]="028b";L.borders.e[0]="bcfguvyz";L.borders.w[0]="0145hjnp";var N={geographicToWebMercator:function(b){b=a.lngLatToXY(b.x,b.y);return{x:b[0],y:b[1]}},webMercatorToGeographic:function(b,c){var d=a.xyToLngLat(b.x,b.y,c);return{x:d[0],
y:d[1]}},geohashToCell:function(a){for(var b=[],c=0;c<a.length;c++)b.push(h(a[c]));for(var b=b.join(""),c=[],d=[],e=0;e<b.length;e++)0===e%2?c.push(b[e]):d.push(b[e]);c=c.join("");d=d.join("");c=[c,d];b=x(c[0],L.longitudeRange);c=x(c[1],L.latitudeRange);return{point:{x:b.value,y:c.value},extent:{xmin:b.min,xmax:b.max,ymin:c.min,ymax:c.max},geohash:a}},pointToCell:function(a,e){var f,h,k;e=e||L.maxGeohashLength;var m=c(a);if(m){m=b(m,m);f=g(e);k=d(m.x,L.longitudeRange,f.lon);var n=d(m.y,L.latitudeRange,
f.lat);f=k.value;h=n.value;k={xmin:k.min,xmax:k.max,ymin:n.min,ymax:n.max};for(var n=[],p=Math.ceil((f.length+h.length)/L.bitsPerBase32Char),q=0,r=0,u=0;u<p*L.bitsPerBase32Char;u++){var I=0===u%2?f[q++]:h[r++];null==I&&(I=0);n.push(I)}f=n.join("");h=L.bitsPerBase32Char;n=f.length/h;p=[];for(q=0;q<n;q++)r=f.substr(q*h,h),p.push(l(r));f=p.join("");return{point:m,extent:k,geohash:f}}},geohashToPoint:function(a){return N.geohashToCell(a).point},pointToGeohash:function(a,b){var c=N.pointToCell(a,b);return c&&
c.geohash},getCells:function(a){return r.map(a,function(a){return N.geohashToCell(a)})},getCellSize:function(a){var b=L.longitudeRange,c=L.latitudeRange,b=Math.abs(b[1]-b[0]),c=Math.abs(c[1]-c[0]);a=g(a||1);return{width:b/Math.pow(2,a.lon),height:c/Math.pow(2,a.lat)}},getCellSizeInMeters:function(a){a=N.getCellSize(a);var b=w.metersPerDegree;a.width*=b;a.height*=b;return a},getIntersecting:function(a,b,c){b=b||1;c=c||0;var d=[],e=q(a);if(e){c&&(e=N.expandExtent(a,b,c));a=e.normalize();var f={};r.forEach(a,
function(a){z(a,b,d,f)})}return d},countIntersecting:function(a,c,d){c=c||1;d=d||0;var e=0,f=q(a);if(f){d&&(f=N.expandExtent(a,c,d));a=f.normalize();if(2===a.length){e=D(a);f=y(a);d=C(e,c);var g=C(f,c);a=d.rows;d=d.cols+g.cols;e={x:e.xmin,y:e.ymax};f={x:f.xmax,y:f.ymax};e=b(e,{});f=b(f,{});e=N.pointToGeohash(e,c);c=N.pointToGeohash(f,c);e===c&&d--;c={rows:a,cols:d}}else c=C(a[0],c);e=c.cols*c.rows}return e},getChildren:function(a){a=a||"";var b=[],c;for(c in L.decimals)b.push(a+c);return b},getNeighbors:function(a){var b=
F(a,"n"),c=F(a,"s");return[b,F(b,"e"),F(b,"w"),c,F(c,"e"),F(c,"w"),F(a,"e"),F(a,"w")]},getExtentFromDistance:function(a,b){b=b||1E3;var d,e=c(a);e&&(d=v(e,b));return d},expandExtent:function(a,b,c){b=b||1;c=c||0;if(a=q(a)){if(c){a=a.normalize();if(2===a.length){var d=c;c=D(a);a=y(a);c=u(c,b,d,"min");a=u(a,b,d,"max");360<=c.getWidth()+a.getWidth()?(b=-180,a=180):(b=c.xmin,a=a.xmax);return new e(b,c.ymin,a,c.ymax)}return u(a[0],b,c)}return a}},getNeighborsWithinDistance:function(a,b,d){d=d||1E3;b=b||
1;var e=[];if(a=c(a)){d=v(a,d).normalize();var f={};r.forEach(d,function(a){z(a,b,e,f)})}return e}};p("extend-esri")&&m.setObject("layers.clustering.geohashUtils",N,f);return N})},"esri/layers/clustering/statUtils":function(){define(["dojo/_base/lang","../support/attributeUtils"],function(p,n){function m(a){return"number"===typeof a&&!isNaN(a)&&Infinity!==a&&-Infinity!==a}var r={sum:{initialize:function(){return{count:0,sum:null}},updateCellStat:function(a,e){m(e)&&(a.count++,a.sum+=e)},updateClusterStat:function(a,
e){e.count&&(a.count+=e.count,a.sum+=e.sum)},summarize:function(a){return a.sum}},avg:{initialize:function(a){return{count:0,sum:null,avg:null,sum_cosine:null,sum_sine:null}},updateCellStat:function(a,e,f){m(e)&&(a.count++,f.isAngular?(f.isArithmetic||(e=-1*e+90),a.sum_cosine+=Math.cos(e*Math.PI/180),a.sum_sine+=Math.sin(e*Math.PI/180)):a.sum+=e)},updateClusterStat:function(a,e,f){e.count&&(a.count+=e.count,f.isAngular?(a.sum_cosine+=e.sum_cosine,a.sum_sine+=e.sum_sine):a.sum+=e.sum)},summarize:function(a,
e){if(0<a.count){var f=a.count;e.isAngular?(f=180*Math.atan2(a.sum_sine/f,a.sum_cosine/f)/Math.PI,e.isArithmetic||(f=-1*(f-90)),a.avg=0>f?f+360:f):(a.avg=a.sum/f,e.isDate&&(a.avg=Math.ceil(a.avg)))}return a.avg}},type:{initialize:function(){return{uvInfos:{}}},updateCellStat:function(a,e){if(null==e||""===e||"string"===typeof e&&""===p.trim(e))e=null;var f=a.uvInfos;null==f[e]?f[e]={count:1,value:e}:f[e].count++},updateClusterStat:function(a,e){var f=a.uvInfos,m=e.uvInfos,c;for(c in m){var n=m[c];
null==f[c]?f[c]={count:n.count,value:n.value}:f[c].count+=n.count}},summarize:function(a){a=a.uvInfos;var e,f=-Infinity,m;for(e in a){var c=a[e];c.count>f?(f=c.count,m=c.value):c.count===f&&(m=null)}return m}}},f={isSupportedStatisticType:function(a){return r.hasOwnProperty(a)},getStatisticFunctions:function(a){return r[a]},getStatisticId:function(a,e){var f=n.getAttributeIdSource(a),f=f&&n.getAttributeId(f)||a.field;return e+"_"+f},getClusterField:function(a,e){return"cluster_"+f.getStatisticId(a,
e)},getStatisticHash:function(a,e){var k=[f.getStatisticId(a,e)];a.attributeType&&k.push(a.attributeType.toLowerCase());a.rotationType&&k.push(a.rotationType.toLowerCase());return k.join("_")}};return f})},"*noref":1}});
define("esri/layers/FeatureLayer","require module 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 dojo/when dojo/promise/all ../kernel ../lang ../request ../config ../deferredUtils ../promiseList ../SpatialReference ../symbols/SimpleMarkerSymbol ../symbols/SimpleLineSymbol ../symbols/SimpleFillSymbol ../symbols/jsonUtils ../renderers/SimpleRenderer ../renderers/UniqueValueRenderer ../renderers/jsonUtils ../support/expressionUtils ../tasks/QueryTask ../tasks/query ../tasks/FeatureSet ../tasks/StatisticDefinition ../geometry/Extent ../geometry/jsonUtils ../geometry/normalizeUtils ../geometry/scaleUtils ./GraphicsLayer ./Field ./TimeInfo ./FeatureType ./FeatureTemplate ./FeatureEditResult ./LabelClass ./SnapshotMode ./OnDemandMode ./SelectionMode ./StreamMode ./TrackManager ./HeatmapManager ./clustering/ClusterManager dojo/i18n!../nls/jsapi dojo/has!extend-esri?./agscommon".split(" "),function(p,
n,m,r,f,a,e,k,w,c,q,b,h,x,d,g,l,B,E,z,D,y,v,u,H,C,F,L,N,I,J,A,K,M,S,X,Y,Z,aa,ca,T,da,Q,P,ba,R,V,ea,fa,U,W,ga,ha){var ia=E.defaults,G=m(aa,{declaredClass:"esri.layers.FeatureLayer",invalidParams:"query contains one or more unsupported parameters",reHostedFS:/(https?:)?\/\/services.*\.arcgis\.com/i,maxPointCountForAuto:4E3,maxRecordCountForAuto:2E3,maxVertexCountForAuto:25E4,generalizeForScale:4E3,_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(a,b){this._preventInit||this._initFeatureLayer(a,b)},_initFeatureLayer:function(a,b){this.i18n=ha;b=b||{};this._featureReduction=this._featureReduction||b.featureReduction;
this._featureReductionEnabled=null!=b.featureReductionEnabled?b.featureReductionEnabled:!0;this.showLabels=null!=b.showLabels?b.showLabels:!0;this._outFields=b.outFields;this._defnExpr=b.definitionExpression;this._loadCallback=b.loadCallback;this._trackIdField=b.trackIdField;this.objectIdField=b.objectIdField;this._maxOffset=null!=b.maxAllowableOffset?b.maxAllowableOffset:this.maxAllowableOffset;this.quantize=null!=b.quantize?b.quantize:!0;this._optEditable=b.editable;this._optAutoGen=b.autoGeneralize;
this.editSummaryCallback=b.editSummaryCallback;this.userId=b.userId;this.userIsAdmin=b.userIsAdmin;this.useMapTime=b.hasOwnProperty("useMapTime")?!!b.useMapTime:!0;this.source=b.source;this.gdbVersion=b.gdbVersion;this.orderByFields=b.orderByFields;this.maxPointCountForAuto=null!=b.maxPointCountForAuto?b.maxPointCountForAuto:this.maxPointCountForAuto;this.maxRecordCountForAuto=null!=b.maxRecordCountForAuto?b.maxRecordCountForAuto:this.maxRecordCountForAuto;this.maxVertexCountForAuto=null!=b.maxVertexCountForAuto?
b.maxVertexCountForAuto:this.maxVertexCountForAuto;this.generalizeForScale=null!=b.generalizeForScale?b.generalizeForScale:this.generalizeForScale;this.queryPagination=this._optQueryPagination=null!=b.queryPagination?b.queryPagination:!0;this.multipatchOption=b.multipatchOption;this._selectedFeatures={};this._selectedFeaturesArr=[];this._newFeatures=[];this._deletedFeatures={};this._ulid=this._getUniqueId();var c=l.isDefined(b.mode)?b.mode:G.MODE_ONDEMAND;this._isStream&&(c=G.MODE_STREAM);this.mode=
c;switch(c){case G.MODE_SNAPSHOT:this.currentMode=G.MODE_SNAPSHOT;this._mode=new R(this);break;case G.MODE_ONDEMAND:case G.MODE_AUTO:this.currentMode=G.MODE_ONDEMAND;this._tileWidth=b.tileWidth||512;this._tileHeight=b.tileHeight||512;this._mode=new V(this);this.latticeTiling=b.latticeTiling;break;case G.MODE_SELECTION:this.currentMode=G.MODE_SELECTION;this._mode=new ea(this);this._isSelOnly=!0;break;case G.MODE_STREAM:this.currentMode=G.MODE_STREAM,this._mode=new fa(this),this._isStream=!0}this._initLayer=
f.hitch(this,this._initLayer);this._selectHandler=f.hitch(this,this._selectHandler);this._editable=!1;if(f.isObject(a)&&a.layerDefinition)return this._collection=!0,this.mode=this._isStream?G.MODE_STREAM:G.MODE_SNAPSHOT,this._isStream||this._outFields||(this._outFields=["*"]),this._initLayer(a),this;this._task=new J(this.url,{source:this.source,gdbVersion:this.gdbVersion});c=this._url.path;this._fserver=!1;-1!==c.search(/\/FeatureServer\//i)&&(this._fserver=!0);this.mode===G.MODE_AUTO&&this.reHostedFS.test(this.url)&&
this._queryLimit();var d=b.resourceInfo;d?this._initLayer(d):(this.source&&(d={source:this.source.toJson()},this._url.query=f.mixin(this._url.query,{layer:e.toJson(d)})),this.gdbVersion&&(this._url.query=f.mixin(this._url.query,{gdbVersion:this.gdbVersion})),B({url:c,content:f.mixin({f:"json"},this._url.query),callbackParamName:"callback",load:this._initLayer,error:this._errorHandler}));this.registerConnectEvents()},_initLayer:function(b,d){if(b||d){this._json=b;this._findCredential();if(this.credential&&
this.credential.ssl||b&&b._ssl)this._useSSL(),this._task._useSSL();this.version=b.currentVersion;this.version||(this.version="capabilities"in b||"drawingInfo"in b||"hasAttachments"in b||"htmlPopupType"in b||"relationships"in b||"timeInfo"in b||"typeIdField"in b||"types"in b?10:9.3);this._collection&&(this._isStream||(this.currentMode=G.MODE_SNAPSHOT,this._mode=new R(this)),this._featureSet=b.featureSet,this._nextId=b.nextObjectId,b=b.layerDefinition);this.geometryType=b.geometryType;"string"!==typeof this.multipatchOption&&
"esriGeometryMultiPatch"===this.geometryType&&(this.multipatchOption="xyFootprint");if(b.hasOwnProperty("capabilities")){var t=this.capabilities=b.capabilities;t&&-1!==t.toLowerCase().indexOf("editing")?this._editable=!0:this._editable=!1}else this._collection||(this._editable=this._fserver);l.isDefined(this._optEditable)?(this._editable=this._optEditable,delete this._optEditable):"esriGeometryMultiPatch"===this.geometryType&&(this._editable=!1);this._json=e.toJson(this._json);this.isEditable()?this._setMaxOffset(null):
this.mode===G.MODE_SNAPSHOT||"esriGeometryPolyline"!==this.geometryType&&"esriGeometryPolygon"!==this.geometryType&&!this.hasXYFootprint()||(this._autoGeneralize=l.isDefined(this._optAutoGen)?this._optAutoGen:this.mode===G.MODE_ONDEMAND||this.mode===G.MODE_AUTO,delete this._optAutoGen);var t=b.effectiveMinScale||b.minScale,g=b.effectiveMaxScale||b.maxScale;!this._hasMin&&t&&this.setMinScale(t);!this._hasMax&&g&&this.setMaxScale(g);this.layerId=b.id;this.name=b.name;this.description=b.description;
this.copyright=b.copyrightText;this.type=b.type;this.displayField=b.displayField;this.defaultDefinitionExpression=b.definitionExpression||(b.isView?b.viewDefinitionQuery:b.definitionQuery);this.fullExtent=new S(b.extent);this.initialExtent=new S(this.fullExtent.toJson());this.fullExtent.spatialReference&&(this.spatialReference=new y(this.fullExtent.spatialReference.toJson()));this.defaultVisibility=b.defaultVisibility;if("esriGeometryPoint"===this.geometryType||"esriGeometryMultipoint"===this.geometryType)this.latticeTiling=
!1;this.hasM=b.hasM||!1;this.hasZ=b.hasZ||!1;this.indexedFields=b.indexedFields;this.maxRecordCount=b.maxRecordCount;this.canModifyLayer=b.canModifyLayer;this.supportsStatistics=b.supportsStatistics;this.supportsAdvancedQueries=this._collection?!1:b.supportsAdvancedQueries;this.supportsCalculate=b.supportsCalculate;this.supportsAttachmentsByUploadId=b.supportsAttachmentsByUploadId;this.supportsCoordinatesQuantization=b.supportsCoordinatesQuantization;this.quantize=this.quantize&&this.supportsCoordinatesQuantization;
this.hasLabels=b.hasLabels;this.canScaleSymbols=b.canScaleSymbols;this.supportsRollbackOnFailureParameter=this.supportsRollbackOnFailure=b.supportsRollbackOnFailure;this.syncCanReturnChanges=b.syncCanReturnChanges;this.isDataVersioned=b.isDataVersioned;this.editFieldsInfo=b.editFieldsInfo;this.ownershipBasedAccessControlForFeatures=b.ownershipBasedAccessControlForFeatures;this.editFieldsInfo&&this.ownershipBasedAccessControlForFeatures&&(this.creatorField=this.editFieldsInfo.creatorField);this.relationships=
b.relationships;this.allowGeometryUpdates=l.isDefined(b.allowGeometryUpdates)?b.allowGeometryUpdates:!0;this.allowUpdateWithoutMValues=!!b.allowUpdateWithoutMValues;this.enableZDefaults=!!b.enableZDefaults;this.zDefault=l.isDefined(b.zDefault)?b.zDefault:null;this.advancedQueryCapabilities=b.advancedQueryCapabilities||{supportsStatistics:this.supportsStatistics,supportsOrderBy:this.supportsAdvancedQueries,supportsDistinct:this.supportsAdvancedQueries};this.url&&(this.advancedQueryCapabilities.supportsPagination=
this.advancedQueryCapabilities.supportsPagination&&(this.reHostedFS.test(this.url)||10.3<this.version));this.queryPagination=this._optQueryPagination&&this.advancedQueryCapabilities.supportsPagination;this.useStandardizedQueries=b.useStandardizedQueries;this.tileMaxRecordCount=b.tileMaxRecordCount;this.standardMaxRecordCount=b.standardMaxRecordCount;this._setMaxOffset(this._maxOffset,!0);this._isTable="Table"===this.type;for(var O=this.fields=[],g=b.fields,t=0;t<g.length;t++)O.push(new ca(g[t]));
if(!this.objectIdField){this.objectIdField=b.objectIdField;if(!this.objectIdField)for(g=b.fields,t=0;t<g.length;t++)if(O=g[t],"esriFieldTypeOID"===O.type){this.objectIdField=O.name;break}this.objectIdField||this._isStream||console.debug("esri.layers.FeatureLayer: "+l.substitute({url:this.url},"objectIdField is not set [url: ${url}]"))}if(!l.isDefined(this._nextId)){g=this.objectIdField;O=-1;if(this._collection&&g)for(var h=(t=this._featureSet)&&t.features,k=h?h.length:0,m,t=0;t<k;t++)m=(m=h[t].attributes)&&
m[g],m>O&&(O=m);this._nextId=O+1}this.globalIdField=b.globalIdField;if(t=this.typeIdField=b.typeIdField)if(t=!this._getField(t)&&this._getField(t,!0))this.typeIdField=t.name;this.visibilityField=b.visibilityField;if(g=b.defaultSymbol)this.defaultSymbol=C.fromJson(g);var n=this.types=[],p=b.types,q,r,O=(t=this.editFieldsInfo)&&t.creatorField,h=t&&t.editorField;m=O||h;k=[];if(p)for(t=0;t<p.length;t++)q=new da(p[t]),r=q.templates,m&&r&&r.length&&(k=k.concat(r)),n.push(q);p=b.templates;q=this.templates=
[];if(p)for(t=0;t<p.length;t++)n=new Q(p[t]),m&&k.push(n),q.push(n);for(t=0;t<k.length;t++)if(m=f.getObject("prototype.attributes",!1,k[t]))O&&delete m[O],h&&delete m[h];if(t=b.timeInfo)this.timeInfo=new T(t),this._startTimeField=t.startTimeField,this._endTimeField=t.endTimeField,this._startTimeField&&this._endTimeField&&(this._twoTimeFields=!0),this._trackIdField?t.trackIdField=this._trackIdField:this._trackIdField=t.trackIdField;this.hasAttachments=!this._collection&&b.hasAttachments?!0:!1;this.htmlPopupType=
b.htmlPopupType;var t=b.drawingInfo,w;(O=t&&t.labelingInfo)&&!this.labelingInfo&&(this.labelingInfo=a.map(O,function(a){return new ba(a)}),this._fixLabelExpr());if(!this.renderer)if(t&&t.renderer){if(w=t.renderer,this.setRenderer(N.fromJson(w)),"classBreaks"===w.type&&this.renderer.setMaxInclusive(!0),!this._collection){var x=w.type,g=[];w=this.renderer;switch(x){case "simple":g.push(w.symbol);break;case "uniqueValue":case "classBreaks":g.push(w.defaultSymbol),g=g.concat(a.map(w.infos,function(a){return a.symbol}))}var g=
a.filter(g,l.isDefined),z=this._url.path+"/images/",A=this._getToken();a.forEach(g,function(a){var b=a.url;b&&(-1===b.search(/https?\:/)&&-1===b.indexOf("data:")&&(a.url=z+b),A&&-1!==a.url.search(/https?\:/)&&(a.url+="?token\x3d"+A))})}}else if(g)p=this.types,0<p.length?(w=new L(this.defaultSymbol,this.typeIdField),a.forEach(p,function(a){w.addValue(a.id,a.symbol)})):w=new F(this.defaultSymbol),this.setRenderer(w);else if(!this._isTable){switch(this.geometryType){case "esriGeometryPoint":case "esriGeometryMultipoint":x=
new v;break;case "esriGeometryPolyline":x=new u;break;case "esriGeometryPolygon":x=new H;break;default:this.hasXYFootprint()&&(x=new H)}this.setRenderer(x?new F(x):null)}x=t&&t.transparency||0;!this.hasOwnProperty("opacity")&&0<x&&(this.opacity=1-x/100);(c("ie")||7<=c("trident")||c("safari"))&&this.isEditable()&&10.02>this.version&&(this._ts=!0);this.statistics=b.statistics;this._fixRendererFields();this._updateRequiredFieldsFromLabelingInfo();this._checkFields();this._updateCaps();var B=function(){null==
this._maxOffset||this._isFractionalOffsetAllowed()||this._setMaxOffset(this._maxOffset);this.loaded=!0;this.setFeatureReduction(this.getFeatureReduction());this.currentMode!==G.MODE_SNAPSHOT&&(this.queryPagination=!1);this.onLoad(this);var a=this._loadCallback;a&&(delete this._loadCallback,a(this))},x=[];this._collection?(t=this._featureSet,this._featureSet=null,this._mode._drawFeatures(new K(t)),this._fcAdded=!0):(x.push(this._forceIdentity()),this._limitPromise&&x.push(this._limitPromise));x.push(this._evalGeometryOperations());
x.length?D(x).then(f.hitch(this,function(){B.call(this)})):B.call(this)}},setShowLabels:function(a){this.showLabels=a;this.onShowLabelsChange()},onShowLabelsChange:function(){},onRendererChange:function(b){this.inherited(arguments);var c=this._map;this._ager=!!(b&&b.observationAger&&b.observationRenderer);b&&"colors"in b&&"blurRadius"in b&&"maxPixelIntensity"in b?"esriGeometryPoint"==this.geometryType&&!this._heatmapManager&&c&&(this._heatmapManager=new W(this),this._heatmapManager.initialize(c)):
this.renderer&&this.renderer.getRendererInfo?a.some(this.renderer.rendererInfos,function(a){return a.renderer&&"colors"in a.renderer&&"blurRadius"in a.renderer})||(this._heatmapManager=null):this._heatmapManager=null;this.timeInfo&&c&&(b&&(b.latestObservationRenderer||b.trackRenderer)?this._trackManager||(this._trackManager=new U(this),this._trackManager.initialize(c),this._childLayer=this._trackManager.container,this._mode._applyTimeFilter()):this._trackManager&&!this._isStream&&(this._trackManager.destroy(),
this._trackManager=null));if(b){var d=[],c=a.filter([b,b.observationRenderer,b.latestObservationRenderer,b.trackRenderer],l.isDefined),e=function(a){return null!=a&&"function"!=typeof a&&a};a.forEach(c,function(a){var b=e(a.attributeField),c=e(a.attributeField2);a=e(a.attributeField3);!1!==b&&d.push(b);!1!==c&&d.push(c);!1!==a&&d.push(a)});this._requiredFields=d}else this._requiredFields=[];this.loaded&&(this._fixRendererFields(),this._checkFields(this._requiredFields),this._collection&&(this._typesDirty=
!0))},setFeatureReduction:function(a){a&&(a=f.mixin({},a),null!=a.clusterSize&&null==a.clusterRadius&&(a.clusterRadius=a.clusterSize),delete a.clusterSize);this.loaded?this._isFeatureReductionSupported(a)?this._featureReduction=a:(this._featureReduction=null,a&&console.log("Clustering is not supported for this layer: "+this.url)):this._featureReduction=a;this._evalFeatureReduction(this._featureReduction)},hasFeatureReduction:function(){return!!this._featureReduction},getFeatureReduction:function(){var a=
this._featureReduction;if(a){var a=f.mixin({},a),b=this._clusterManager;if(b=b&&b.aggregationInfo)a.clusterRadius=b.clusterRadius,a.infoTemplate=b.infoTemplate}return a},isFeatureReductionActive:function(){var a=this._clusterManager;return!!(a&&a.isClusteringEnabled()&&a.isClusteringActive())},isFeatureReductionEnabled:function(){return this._featureReductionEnabled},enableFeatureReduction:function(){this._featureReductionEnabled||(this._featureReductionEnabled=!0,this._evalFeatureReduction(this._featureReduction))},
disableFeatureReduction:function(){this._featureReductionEnabled&&(this._featureReductionEnabled=!1,this._evalFeatureReduction(this._featureReduction))},isFeatureReductionApplied:function(){return this.hasFeatureReduction()&&this.isFeatureReductionEnabled()&&this._canCluster(this.getFeatureReduction())},getAggregateGraphics:function(){return this._clusterManager?this._clusterManager.getAggregateGraphics():[]},getChildGraphics:function(a){return this._clusterManager?this._clusterManager.getFeaturesInCluster(a):
[]},getSingleGraphics:function(){return this._clusterManager?this._clusterManager.getSingleGraphics():[]},getFeatureReductionRenderer:function(){return this.isFeatureReductionActive()?this._clusterManager.getClusterRenderer():null},getFeatureReductionLayer:function(){return this._clusterManager?this._clusterManager.container:null},getFeatureReductionField:function(b){var c,d=this._clusterManager?this._clusterManager.getClusterFields():null;b=b?b.toLowerCase():"";a.some(d,function(a){b===a.name.toLowerCase()&&
(c=a);return!!c});return c},_isFeatureReductionSupported:function(a){return a&&"cluster"===a.type&&"esriGeometryPoint"===this.geometryType&&(this._collection||this._isStream||this._optQueryPagination&&this.advancedQueryCapabilities.supportsPagination)},_isReductionCompatibleRenderer:function(a){a=a&&a.declaredClass||"";a=a.toLowerCase();return-1<a.indexOf("simplerenderer")||-1<a.indexOf("classbreaksrenderer")||-1<a.indexOf("uniquevaluerenderer")},_evalFeatureReduction:function(a){this.loaded&&this.getMap()&&
(a=a||this.getFeatureReduction(),this._evalFetchMode(a),a&&this.isFeatureReductionEnabled()?this._canCluster(a)?this._clusterManager?this._updateClusterManager(a):(this._clusterManager=this._createClusterManager(a),this.onFeatureReductionChange()):(console.log("Clustering is supported only for point layers where map spatial reference is WGS84 or Web Mercator"),this._destroyClusterManager()):this._destroyClusterManager())},_canCluster:function(a){var b=this._map.spatialReference;return this._isFeatureReductionSupported(a)&&
this._isReductionCompatibleRenderer(this.renderer)&&(b.isWebMercator()||4326===b.wkid)},_createClusterManager:function(a){a=new ga({layer:this,aggregationInfo:a});this._clusterHandles=[a.on("renderer-change",f.hitch(this,function(){this.onFeatureReductionRendererChange()}))];a.initialize(this._map);return a},_updateClusterManager:function(a){var b=this._clusterManager;b&&b.setAggregationInfo(a)},_destroyClusterManager:function(b){a.forEach(this._clusterHandles,function(a){a.remove()});this._clusterHandles=
null;this._clusterManager&&(this._clusterManager.destroy(b),this._clusterManager=null,this.onFeatureReductionChange())},redraw:function(){this.inherited(arguments);this._clusterManager&&this._clusterManager.redraw();this._trackManager&&this._trackManager.container&&this._trackManager.container.redraw()},_evalSDRenderer:function(a){this.inherited(arguments);var b=this._getRenderer();this._ager=!!(b&&b.observationAger&&b.observationRenderer);this._trackManager&&this._trackManager.container&&this._trackManager.container.setRenderer(b&&
b.trackRenderer);a&&this._evalFeatureReduction()},_setMap:function(a){var b=this.inherited(arguments),c=this._mode,d=this;c&&a.loaded&&c.initialize(a);this.geometryType&&this.attr("data-geometry-type",this.geometryType.replace(/esriGeometry/i,"").toLowerCase());this._addHandle=this.on("graphic-node-add",function(a){a=a.graphic.attributes;(a=d._selectedFeatures[a&&a[d.objectIdField]])&&a.attr("data-selected","")});return b},_unsetMap:function(a){var b=this._mode;b&&(b.suspend(),b.destroy());this._destroyClusterManager(!1);
this._trackManager&&(this._trackManager.destroy(),this._trackManager=null);r.disconnect(this._zoomConnect);r.disconnect(this._addHandle);this._zoomConnect=this._addHandle=null;this._toggleTime(!1);this.inherited("_unsetMap",arguments)},refresh:function(){this._needsRefresh=!1;var a=this._mode;a&&a.refresh()},hasXYFootprint:function(){return"esriGeometryMultiPatch"===this.geometryType&&"xyFootprint"===this.multipatchOption},getOutFields:function(){return a.filter(this._getOutFields(),function(a){return"*"===
a||!!this._getField(a)},this)},getField:function(a){return this._getField(a,!0)},isOutField:function(b){b=this.getField(b);if(!b)return!1;var c=this.getOutFields();return-1<a.indexOf(c,"*")||-1<a.indexOf(c,b.name)},getFieldLabel:function(a){var b=this.infoTemplate,b=b&&b.getFieldInfo&&b.getFieldInfo(a);a=f.isFunction(a)?null:this.getField(a);var c=b||a,d="";c&&(d=b&&b.label||a&&a.alias||c.name||c.fieldName);return d},getDomain:function(b,c){var d,e,f=c&&c.feature,t=f&&this.typeIdField&&f.attributes&&
f.attributes[this.typeIdField];null!=t&&a.some(this.types,function(a){return a.id==t?((d=a.domains&&a.domains[b])&&"inherited"===d.type&&(d=this._getLayerDomain(b),e=!0),!0):!1},this);e||d||(d=this._getLayerDomain(b));return d},_getLayerDomain:function(b){var c;a.some(this.fields,function(a){a.name===b&&(c=a.domain);return!!c});return c},getType:function(b){var c,d=b&&this.typeIdField&&b.attributes&&b.attributes[this.typeIdField];a.some(this.types,function(a){a.id==d&&(c=a);return!!c});return c},
setEditable:function(a){if(!this._collection)return console.log("FeatureLayer:setEditable - this functionality is not yet supported for layer in a feature service"),this;if(!this.loaded)return this._optEditable=a,this;var b=this._editable;this._editable=a;this._updateCaps();if(b!==a)this.onCapabilitiesChange();return this},getEditCapabilities:function(b){var c={canCreate:!1,canUpdate:!1,canDelete:!1,canUpdateGeometry:!1};if(!this.loaded||!this.isEditable())return c;var d=b&&b.feature;b=b&&b.userId||
this.getUserId();var e=a.map(this.capabilities?this.capabilities.toLowerCase().split(","):[],f.trim),t=(c=-1<a.indexOf(e,"editing"))&&-1<a.indexOf(e,"create"),g=c&&-1<a.indexOf(e,"update"),e=c&&-1<a.indexOf(e,"delete"),h=this.ownershipBasedAccessControlForFeatures,l=this.editFieldsInfo,k=l&&l.creatorField,l=l&&l.realm,d=(d=d&&d.attributes)&&k?d[k]:void 0,m=!!this.userIsAdmin,k=!h||m||!(!h.allowOthersToUpdate&&!h.allowUpdateToOthers),n=!h||m||!(!h.allowOthersToDelete&&!h.allowDeleteToOthers),p=!h||
m||!h.hasOwnProperty("allowAnonymousToUpdate")||h.allowAnonymousToUpdate,h=!h||m||!h.hasOwnProperty("allowAnonymousToDelete")||h.allowAnonymousToDelete;b&&l&&(b=b+"@"+l);if(m||c&&!(t||g||e))t=g=e=!0;c={canCreate:t,canUpdate:g,canDelete:e,canUpdateGeometry:m||this.allowGeometryUpdates};b||(c.canUpdate=c.canUpdate&&p,c.canDelete=c.canDelete&&h);null===d?(c.canUpdate=c.canUpdate&&k,c.canDelete=c.canDelete&&n):""!==d&&d&&b.toLowerCase()!==d.toLowerCase()&&(c.canUpdate=c.canUpdate&&k,c.canDelete=c.canDelete&&
n);return c},getUserId:function(){var a;this.loaded&&(a=this.credential&&this.credential.userId||this.userId||"");return a},setUserIsAdmin:function(a){this.userIsAdmin=a},setEditSummaryCallback:function(a){this.editSummaryCallback=a},getEditSummary:function(a,b,c){c=l.isDefined(c)?c:(new Date).getTime();var d="";c=this.getEditInfo(a,b,c);(b=b&&b.callback||this.editSummaryCallback)&&(c=b(a,c)||"");if(f.isString(c))d=c;else{if(c){a=c.action;b=c.userId;var e=c.timeValue,t=0;a&&t++;b&&t++;l.isDefined(e)&&
t++;1<t&&(d=("edit"===a?"edit":"create")+(b?"User":"")+(l.isDefined(e)?c.displayPattern:""))}d=d&&l.substitute(c,this.i18n.layers.FeatureLayer[d])}return d},getEditInfo:function(a,b,c){if(this.loaded){c=l.isDefined(c)?c:(new Date).getTime();b=b&&b.action||"last";var d=this.editFieldsInfo,e=d&&d.creatorField,f=d&&d.creationDateField,t=d&&d.editorField,d=d&&d.editDateField,t=(a=a&&a.attributes)&&t?a[t]:void 0,d=a&&d?a[d]:null,e=this._getEditData(a&&e?a[e]:void 0,a&&f?a[f]:null,c);c=this._getEditData(t,
d,c);var g;switch(b){case "creation":g=e;break;case "edit":g=c;break;case "last":g=c||e}g&&(g.action=g===c?"edit":"creation");return g}},_getEditData:function(a,b,c){var d,e,f;l.isDefined(b)&&(e=c-b,f=0>e?"Full":6E4>e?"Seconds":12E4>e?"Minute":36E5>e?"Minutes":72E5>e?"Hour":864E5>e?"Hours":6048E5>e?"WeekDay":"Full");if(void 0!==a||f)d=d||{},d.userId=a,f&&(a=w.format,c=new Date(b),d.minutes=Math.floor(e/6E4),d.hours=Math.floor(e/36E5),d.weekDay=a(c,{datePattern:"EEEE",selector:"date"}),d.formattedDate=
a(c,{selector:"date"}),d.formattedTime=a(c,{selector:"time"}),d.displayPattern=f,d.timeValue=b);return d},isEditable:function(){return!(!this._editable&&!this.userIsAdmin)},isQueryable:function(){var b=a.map(this.capabilities?this.capabilities.toLowerCase().split(","):[],f.trim);return this._isStream||this.userIsAdmin||this._collection||-1!==a.indexOf(b,"query")||-1!==a.indexOf(b,"catalog")},setMaxAllowableOffset:function(a){this.isEditable()||this._setMaxOffset(a,!0);return this},getMaxAllowableOffset:function(){var a=
this._quantizationParameters?this._quantizationParameters.tolerance:void 0;return null!=this._maxOffset?this._maxOffset:a},_setMaxOffset:function(a,b){if(null==a)return delete this._maxOffset,delete this._quantizationParameters,this;this.quantize&&this.supportsCoordinatesQuantization?("esriGeometryPolyline"===this.geometryType?this._maxOffset=a:delete this._maxOffset,this._quantizationParameters={mode:"view",originPosition:"upperLeft",tolerance:a,extent:this.fullExtent}):(this._isFractionalOffsetAllowed()&&
b||(a=Math.floor(a)),isNaN(a)||0===a?delete this._maxOffset:this._maxOffset=a,delete this._quantizationParameters);return this},_isFractionalOffsetAllowed:function(){return null==this.version||10.1<=this.version||navigator.languages&&this._isLangWithDot(navigator.languages[0])},_isLangWithDot:function(b){b=(b=b&&b.split("-"))&&b[0]&&b[0].toLowerCase();return-1!==a.indexOf(this._langsWithDot,b)},_langsWithDot:"ar en et fr he ja ko th vi zh".split(" "),setAutoGeneralize:function(a){this.loaded?this.isEditable()||
this.mode===G.MODE_SNAPSHOT||"esriGeometryPolyline"!==this.geometryType&&"esriGeometryPolygon"!==this.geometryType&&!this.hasXYFootprint()||((this._autoGeneralize=a)?(this._autoSnapshot&&(this._prevScale=null),this._updateMaxOffset()):this._setMaxOffset(null)):this._optAutoGen=a;return this},setGDBVersion:function(a){this._collection||a===this.gdbVersion||!a&&!this.gdbVersion||(this.gdbVersion=a,this._task.gdbVersion=a,this._url.query=f.mixin(this._url.query,{gdbVersion:a}),this.loaded&&(this.clearSelection(),
this._map&&this.refresh()),this.onGDBVersionChange());return this},hasAllFeatures:function(){return this._mode?this._mode.hasAllFeatures():!0},setDefinitionExpression:function(a){this._defnExpr=a;(a=this._mode)&&a.propertyChangeHandler(1);return this},getDefinitionExpression:function(){return this._defnExpr},setTimeDefinition:function(a){this._isSnapshotMode()?(this._timeDefn=a,(a=this._mode)&&a.propertyChangeHandler(2)):console.log("FeatureLayer.setTimeDefinition: layer in on-demand or selection mode does not support time definitions. Layer id \x3d "+
this.id+", Layer URL \x3d "+this.url);return this},getTimeDefinition:function(){return this._timeDefn},setTimeOffset:function(a,b){this._timeOffset=a;this._timeOffsetUnits=b;var c=this._mode;c&&c.propertyChangeHandler(0);return this},setUseMapTime:function(a){this.useMapTime=a;this._toggleTime(!this.suspended);(a=this._mode)&&a.propertyChangeHandler(0)},selectFeatures:function(a,b,c,d){b=b||G.SELECTION_NEW;this._hasPartialSelectedFeatures=!1;a=this._getShallowClone(a);var e=this._map,f,g=this,t=z._fixDfd(new k(z._dfdCanceller));
a.outFields=this.getOutFields();a.returnGeometry=!0;a.multipatchOption=this.multipatchOption;e&&(a.outSpatialReference=new y(e.spatialReference.toJson()));if(!this._applyQueryFilters(a,!0))return f={features:[]},this._selectHandler(f,b,c,d,t),t;if(e=this._canDoClientSideQuery(a))t._pendingDfd=x(this._doQuery(a,e)),t._pendingDfd.then(function(a){f={features:a};g._selectHandler(f,b,c,d,t)});else{if(this._collection)return this._resolve([Error("FeatureLayer::selectFeatures - "+this.invalidParams)],null,
d,t,!0),t;if(this.loaded&&!this.isQueryable())return this._resolve([Error("Layer does not support query capability.")],null,d,t,!0),t;var h=this;this._ts&&(a._ts=(new Date).getTime());(t._pendingDfd=this._task.execute(a)).addCallbacks(function(a){h._selectHandler(a,b,c,d,t)},function(a){h._hasPartialSelectedFeatures=!0;h._resolve([a],null,d,t,!0)})}return t},getSelectedFeatures:function(){var a=this._selectedFeatures,b=[],c;for(c in a)a.hasOwnProperty(c)&&b.push(a[c]);return b},clearSelection:function(a){var b=
this._selectedFeatures,c=this._mode,d;for(d in b)b.hasOwnProperty(d)&&(this._unSelectFeatureIIf(d,c),c._removeFeatureIIf(d));this._selectedFeatures={};this._isSelOnly&&c._applyTimeFilter(!0);if(!a)this.onSelectionClear();return this},setSelectionSymbol:function(a){if(this._selectionSymbol=a){var b=this._selectedFeatures,c;for(c in b)b.hasOwnProperty(c)&&b[c].setSymbol(a)}return this},getSelectionSymbol:function(){return this._selectionSymbol},setLabelingInfo:function(a){a?(this.labelingInfo=a,this._fixLabelExpr()):
delete this.labelingInfo;this._collection&&(this._typesDirty=!0);this.onLabelingInfoChange()},_fixLabelExpr:function(){var b=/\[([^\[\]]+)\]/ig,c,d=this,e=function(a,b){var c=d._getField(b,!0);return"["+(c&&c.name||b)+"]"};a.forEach(this.labelingInfo,function(a){if(c=a.labelExpression)a.labelExpression=c.replace(b,e)})},_updateRequiredFieldsFromLabelingInfo:function(){var b=[];a.forEach(this.labelingInfo,function(c){var d=c.labelExpressionInfo;if(c.labelExpression){var e=/[\[\]]/ig;c=c.labelExpression.match(/\[[^\[\]]+\]/ig);
(c=a.map(c,function(a){return a.replace(e,"")}))&&(b=b.concat(c))}if(d){if(d.value){var f=/[\{\}]/ig;c=d.value.match(/\{[^\{\}]+\}/ig);(c=a.map(c,function(a){return a.replace(f,"")}))&&(b=b.concat(c))}d.expression&&(b=b.concat(I.extractFieldNames(d.expression)))}});b=a.map(b,function(a){var b=this.getField(a);return b?b.name:a},this);this._requiredFields&&(this._requiredFields=this._requiredFields.concat(b))},__msigns:[{n:"applyEdits",c:5,a:[{i:0},{i:1}],e:4,f:1}],applyEdits:function(b,c,d,e,g,h){var t=
h.assembly,l=h.dfd;this._applyNormalized(b,t&&t[0]);this._applyNormalized(c,t&&t[1]);this.onBeforeApplyEdits(b,c,d);var k={},m=this.objectIdField,t={f:"json"},n=!1;if(this._collection)h={},h.addResults=b?a.map(b,function(){n=!0;return{objectId:this._nextId++,success:!0}},this):null,h.updateResults=c?a.map(c,function(a){n=!0;var b=a.attributes[m];k[b]=a;return{objectId:b,success:!0}},this):null,h.deleteResults=d?a.map(d,function(a){n=!0;return{objectId:a.attributes[m],success:!0}},this):null,n?this._editHandler(h,
b,k,e,g,l):this._resolve([h.addResults,h.updateResults,h.deleteResults],null,e,l);else{b&&0<b.length&&(t.adds=this._convertFeaturesToJson(b,0,1),n=!0);if(c&&0<c.length){for(h=0;h<c.length;h++){var O=c[h];k[O.attributes[m]]=O}t.updates=this._convertFeaturesToJson(c,0,0,1);n=!0}if(d&&0<d.length){c=[];for(h=0;h<d.length;h++)c.push(d[h].attributes[m]);t.deletes=c.join(",");n=!0}if(n){var p=this;return B({url:this._url.path+"/applyEdits",content:f.mixin(t,this._url.query),callbackParamName:"callback",
load:function(a){p._editHandler(a,b,k,e,g,l)},error:function(a){p._resolve([a],null,g,l,!0)}},{usePost:!0})}this._resolve([],null,e,l)}},queryFeatures:function(a,b,c){return this._query("execute","onQueryFeaturesComplete",a,b,c)},queryRelatedFeatures:function(a,b,c){return this._query("executeRelationshipQuery","onQueryRelatedFeaturesComplete",a,b,c)},queryIds:function(a,b,c){return this._query("executeForIds","onQueryIdsComplete",a,b,c)},queryCount:function(a,b,c){return this._query("executeForCount",
"onQueryCountComplete",a,b,c)},queryExtent:function(a,b,c){return this._query("executeForExtent","onQueryExtentComplete",a,b,c)},queryAttachmentInfos:function(b,c,d){var e=this._url.path+"/"+b+"/attachments",g=new k(z._dfdCanceller),h=this;g._pendingDfd=B({url:e,content:f.mixin({f:"json"},this._url.query),callbackParamName:"callback",load:function(d){d=d.attachmentInfos;var f;a.forEach(d,function(a){f=q.objectToQuery({gdbVersion:h._url.query&&h._url.query.gdbVersion,layer:h._url.query&&h._url.query.layer,
token:h._getToken()});a.url=e+"/"+a.id+(f?"?"+f:"");a.objectId=b});h._resolve([d],"onQueryAttachmentInfosComplete",c,g)},error:function(a){h._resolve([a],null,d,g,!0)}});return g},addAttachment:function(a,b,c,d){return this._sendAttachment("add",a,b,c,d)},updateAttachment:function(a,c,d,e,f){d.appendChild(b.create("input",{type:"hidden",name:"attachmentId",value:c}));return this._sendAttachment("update",a,d,e,f)},deleteAttachments:function(b,c,d,e){var g=this._url.path+"/"+b+"/deleteAttachments",
h=new k(z._dfdCanceller),t=this;c={f:"json",attachmentIds:c.join(",")};h._pendingDfd=B({url:g,content:f.mixin(c,this._url.query),callbackParamName:"callback",load:f.hitch(this,function(c){c=c.deleteAttachmentResults;c=a.map(c,function(a){a=new P(a);a.attachmentId=a.objectId;a.objectId=b;return a});t._resolve([c],"onDeleteAttachmentsComplete",d,h)}),error:function(a){t._resolve([a],null,e,h,!0)}},{usePost:!0});return h},addType:function(b){var c=this.types;if(c){if(a.some(c,function(a){return a.id==
b.id?!0:!1}))return!1;c.push(b)}else this.types=[b];return this._typesDirty=!0},deleteType:function(b){if(this._collection){var c=this.types;if(c){var d=-1;a.some(c,function(a,c){return a.id==b?(d=c,!0):!1});if(-1<d)return this._typesDirty=!0,c.splice(d,1)[0]}}},toJson:function(){var b=this._json;if(b=f.isString(b)?e.fromJson(b):f.clone(b)){var b=b.layerDefinition?b:{layerDefinition:b},c=b.layerDefinition,d=this._collection;if(d&&this._typesDirty){c.types=a.map(this.types||[],function(a){return a.toJson()});
var g=this.renderer,h=this.labelingInfo,l=c.drawingInfo;!g&&!h||l||(l=c.drawingInfo={});l&&g&&-1===g.declaredClass.indexOf("TemporalRenderer")&&(l.renderer=g.toJson());h&&(l.labelingInfo=a.map(h,function(a){return a.toJson()}))}g=null;if(!d||this._fcAdded)g={geometryType:c.geometryType,features:this._convertFeaturesToJson(this.graphics,!0)};b.featureSet=f.mixin({},b.featureSet||{},g);b.featureSet.transform&&(h=b.featureSet.transform,delete b.featureSet.transform,g=new K(b.featureSet),g.quantize(h),
b.featureSet=g.toJson());d&&(b.nextObjectId=this._nextId,c.capabilities=this.capabilities);return b}},onSelectionComplete:function(){},onSelectionClear:function(){},onBeforeApplyEdits:function(){},onEditsComplete:function(){},onQueryFeaturesComplete:function(){},onQueryRelatedFeaturesComplete:function(){},onQueryIdsComplete:function(){},onQueryCountComplete:function(){},onQueryExtentComplete:function(){},onQueryAttachmentInfosComplete:function(){},onAddAttachmentComplete:function(){},onUpdateAttachmentComplete:function(){},
onDeleteAttachmentsComplete:function(){},onCapabilitiesChange:function(){},onGDBVersionChange:function(){},onQueryLimitExceeded:function(){},onLabelingInfoChange:function(){},onFeatureReductionRendererChange:function(){},onFeatureReductionChange:function(){},_evalGeometryOperations:function(){var a=new k;setTimeout(f.hitch(this,function(){this._isGeometryOperationsUsed()?I.enableGeometryOperations().always(function(){a.resolve()}):a.resolve()}),0);return a.promise},_isGeometryOperationsUsed:function(){var b=
this.infoTemplate,c=this.renderer,d=this.labelingInfo;return b&&b.hasGeometryOperations&&b.hasGeometryOperations()||c&&c.hasGeometryOperations&&c.hasGeometryOperations()||a.some(d,function(a){return I.hasGeometryOperations(a.labelExpressionInfo&&a.labelExpressionInfo.expression)})?!0:!1},_forceIdentity:function(){var a=new k,b=this,c,d=this._url&&this._url.path;c=d&&d.toLowerCase().indexOf("/rest/services");var e=this.editFieldsInfo,e=e&&(e.creatorField||e.editorField);(this.userIsAdmin||e)&&!this._getToken()&&
-1<c&&g.id?(c=d.substring(0,c)+"/rest/info",B({url:c,content:{f:"json"},handleAs:"json",callbackParamName:"callback"}).then(function(a){if(a.owningSystemUrl)return g.id.checkSignInStatus(a.owningSystemUrl+"/sharing")}).then(function(a){if(a)return g.id.getCredential(d)}).then(function(a){a&&b._findCredential()}).always(function(){a.resolve()})):a.resolve();return a.promise},_isSnapshotMode:function(){return this._mode?this._mode.isInstanceOf(R):!1},_checkMode:function(a){var b=this.geometryType,c=
this.maxRecordCount;a=(a=a&&a.features&&a.features[0])&&a.attributes&&a.attributes.exceedslimit;this.mode===G.MODE_AUTO&&!this.isEditable()&&0===a&&(this.queryPagination||("esriGeometryPolyline"===b||"esriGeometryPolygon"===b||"esriGeometryMultipoint"===b||this.hasXYFootprint())&&c>=this.maxRecordCountForAuto||"esriGeometryPoint"===b&&c>=this.maxPointCountForAuto)&&(this.currentMode=G.MODE_SNAPSHOT,this._mode=new R(this),this._autoSnapshot=!0)},_evalFetchMode:function(a){this.loaded&&(a&&this.isFeatureReductionEnabled()&&
this._canCluster(a)?this._switchToSnapshotMode():this._switchToNormalMode())},_switchToSnapshotMode:function(){if(null==this._savedMode){var a=this.currentMode;a!==G.MODE_SNAPSHOT&&a!==G.MODE_STREAM&&a!==G.MODE_SELECTION&&(this._savedMode=this.mode,this._mode.suspend(),this._mode.destroy(),this.mode=this.currentMode=G.MODE_SNAPSHOT,this._mode=new R(this),this.queryPagination=this._optQueryPagination&&this.advancedQueryCapabilities.supportsPagination,this.clearSelection(),(a=this.getMap())&&a.loaded&&
(this._mode.initialize(a),this._mode.startup()))}},_switchToNormalMode:function(){if(null!=this._savedMode){this._mode.suspend();this._mode.destroy();this.mode=this._savedMode;this._savedMode=null;this.currentMode=G.MODE_ONDEMAND;this._mode=new V(this);this.queryPagination=!1;this.clearSelection();var a=this.getMap();a&&a.loaded&&(this._mode.initialize(a),this._mode.startup())}},_queryLimit:function(){var a=this,b=new k;this._limitPromise=b.promise;this._limitPromise.then(function(b){a._checkMode(b)});
this._limitPromise.always(function(){a._limitPromise=null});setTimeout(function(){var c=new A,d=new M;d.statisticType="exceedslimit";d.maxPointCount=a.maxPointCountForAuto;d.maxRecordCount=a.maxRecordCountForAuto;d.maxVertexCount=a.maxVertexCountForAuto;d.outStatisticFieldName="exceedslimit";c.outStatistics=[d];a.queryFeatures(c).promise.then(function(a){b.resolve(a)},function(a){b.reject(a)})},0)},_updateCaps:function(){var b=this._editable,c=f.trim(this.capabilities||""),d=a.map(c?c.split(","):
[],f.trim),e=a.map(c?c.toLowerCase().split(","):[],f.trim),c=a.indexOf(e,"editing"),g,e={Create:a.indexOf(e,"create"),Update:a.indexOf(e,"update"),Delete:a.indexOf(e,"delete")};if(b&&-1===c)d.push("Editing");else if(!b&&-1<c){b=[c];for(g in e)-1<e[g]&&b.push(e[g]);b.sort();for(g=b.length-1;0<=g;g--)d.splice(b[g],1)}this.capabilities=d.join(",")},_counter:{value:0},_getUniqueId:function(){return this._counter.value++},onSuspend:function(){this.inherited(arguments);this._toggleTime(!1);var a=this._mode;
a&&a.suspend()},onResume:function(a){this.inherited(arguments);this._toggleTime(!0);var b=this._map,c=this._getRenderer();if(a.firstOccurrence){if(this._fixRendererFields(),this._updateRequiredFieldsFromLabelingInfo(),this._checkFields(),this.clearSelection(),this._evalFeatureReduction(),this.timeInfo&&!this._trackManager&&(this._trackIdField||c&&(c.latestObservationRenderer||c.trackRenderer))&&(this._trackManager=new U(this),this._trackManager.initialize(b),this._childLayer=this._trackManager.container),
c&&"colors"in c&&"blurRadius"in c&&"maxPixelIntensity"in c&&"esriGeometryPoint"==this.geometryType&&!this._heatmapManager&&(this._heatmapManager=new W(this),this._heatmapManager.initialize(b)),this._autoSnapshot&&this._autoGeneralize&&("esriGeometryPolyline"===this.geometryType||"esriGeometryPolygon"===this.geometryType||this.hasXYFootprint())&&!this.isEditable()&&null==this.getMaxAllowableOffset()&&(c=this.generalizeForScale,this._calculatedScale=c=this.maxScale?this.maxScale:this.minScale?Math.min(c,
this.minScale):Math.min(c,Z.getScale(b,this.initialExtent)),this._calcMaxOffset=b.extent.getWidth()/b.width/b.getScale()*c),this._zoomConnect=r.connect(b,"onZoomEnd",this,this._zoomEndHandler),this._updateMaxOffset(),this._needsRefresh=!1,c=this._mode)c._init||c.initialize(b),c.startup()}else this._zoomEndHandler(),this._mode&&this._mode.resume()},_zoomEndHandler:function(){var a=this._map;this._updateMaxOffset();this._prevScale=a.getScale();!this.suspended&&this._needsRefresh&&this.refresh()},_updateMaxOffset:function(){var a=
this._map;a&&a.loaded&&this._autoGeneralize&&(this._autoSnapshot?(a=this.getMaxAllowableOffset(),this._setMaxOffset(this._getMaxOffsetForScale(),!0),this._needsRefresh||(this._needsRefresh=a!=this.getMaxAllowableOffset())):this._setMaxOffset(a.extent.getWidth()/a.width,!a.extent.spatialReference.isWebMercator()))},_getMaxOffsetForScale:function(){if(this._map){var a=this._map.getScale(),b=this._calculatedScale,c=this._calcMaxOffset,d=this._prevScale;return a>=b&&(null==d||d<b)?c:a<b&&(null==d||d>=
b)?null:this.getMaxAllowableOffset()}},_toggleTime:function(a){var b=this._map;a&&this.timeInfo&&this.useMapTime&&b?(this._mapTimeExtent=b.timeExtent,this._timeConnect||(this._timeConnect=r.connect(b,"onTimeExtentChange",this,this._timeChangeHandler))):(this._mapTimeExtent=null,r.disconnect(this._timeConnect),this._timeConnect=null)},_timeChangeHandler:function(a){this._mapTimeExtent=a;(a=this._mode)&&a.propertyChangeHandler(0)},_getOffsettedTE:function(a){var b=this._timeOffset,c=this._timeOffsetUnits;
return a&&b&&c?a.offset(-1*b,c):a},_getTimeOverlap:function(a,b){return a&&b?a.intersection(b):a||b},_getTimeFilter:function(a){var b=this.getTimeDefinition(),c;if(b&&(c=this._getTimeOverlap(b,null),!c))return[!1];if(a){if(a=c?this._getTimeOverlap(a,c):a,!a)return[!1]}else a=c;return[!0,a]},_getAttributeFilter:function(a){var b=this.getDefinitionExpression();return a?b?"("+b+") AND ("+a+")":a:b},_applyQueryFilters:function(a,b){a.where=this._getAttributeFilter(a.where);a.returnGeometry&&null==a.maxAllowableOffset&&
!a.quantizationParameters&&(a.maxAllowableOffset=this._maxOffset,a.quantizationParameters=this._quantizationParameters);b&&this.supportsAdvancedQueries&&(a.orderByFields=a.orderByFields||this.getOrderByFields());if(this.timeInfo){var c=this._getTimeFilter(a.timeExtent);if(c[0])a.timeExtent=c[1];else return!1}return!0},_add:function(a){var b=this._selectionSymbol,c=a.attributes,d=this.visibilityField;b&&this._isSelOnly&&a.setSymbol(b);if(d&&c&&c.hasOwnProperty(d))a[c[d]?"show":"hide"]();return this.add.apply(this,
arguments)},_remove:function(){return this.remove.apply(this,arguments)},_canDoClientSideQuery:function(b){var c=[],d=this._map,e;if((this._collection||!this._isTable&&d)&&!(b.text||b.where&&b.where!==this.getDefinitionExpression()||b.orderByFields&&b.orderByFields.length&&(e=this.getOrderByFields()||[])&&b.orderByFields.join()!==e.join()||b.outStatistics||b.returnDistinctValues)){e=this._isSnapshotMode();var f=this._isSelOnly,g=b.geometry;if(g){if(f||b.spatialRelationship!==A.SPATIAL_REL_INTERSECTS||
"extent"!==g.type||!e&&!d.extent.contains(g))return;c.push(1)}if(d=b.objectIds)if(e)c.push(2);else{var g=d.length,h=this._mode,l=0,k;for(k=0;k<g;k++)h._getFeature(d[k])&&l++;if(l===g)c.push(2);else return}if(this.timeInfo)if(b=b.timeExtent,d=this._mapTimeExtent,e)b&&c.push(3);else if(f){if(b)return}else if(d)if(-1!==a.indexOf(c,2))b&&c.push(3);else if(-1!==a.indexOf(c,1))b==d&&c.push(3);else return;else if(0<c.length)b&&c.push(3);else if(b)return;return 0<c.length?c:null}},_getAbsMid:function(a){return p.toAbsMid?
p.toAbsMid(a):n.id.replace(/\/[^\/]*$/ig,"/")+a},_doQuery:function(b,c,d){var e=[],g=this.objectIdField,h=this,l=new k,m=new k,n=this.graphics;if(-1!==a.indexOf(c,1)){var p=this.spatialIndex||this._map&&this._map.spatialIndex,t,q=b.geometry._normalize(null,!0);null==p&&ia.autoSpatialIndexing?t=(this._map||this).addPlugin(this._getAbsMid("../plugins/spatialIndex")).then(f.hitch(this,f.partial(this._getFromIndex,q,p)),function(a){m.resolve(f.hitch(this,f.partial(this._filterByExtent,n,q)))}):p&&(t=
this._getFromIndex(q,p));t?t.then(function(a){for(var b=0;b<a.length;b++)a[b].results&&(e=e.concat(a[b].results));m.resolve(e)}).otherwise(function(a){m.reject(a)}):m.resolve(this._filterByExtent(n,q))}else m.resolve(n);m.then(function(f){e=f;if(-1!==a.indexOf(c,2)){var k=b.objectIds;e=a.filter(e,function(b){return-1<a.indexOf(k,b.attributes[g])})}-1!==a.indexOf(c,3)&&h.timeInfo&&(f=b.timeExtent,e=h._filterByTime(e,f.startTime,f.endTime).match);d&&(e=a.map(e,function(a){return a.attributes[g]},this));
l.resolve(e)});return l},_getFromIndex:function(b,c){c=c||this.spatialIndex||this._map.spatialIndex;b instanceof Array||(b=[b]);var e=this.id;return d(a.map(b,function(a){return c.intersects(a,e)}))},_filterByExtent:function(a,b){for(var c=[],d=0,e=a.length;d<e;d++){var f=a[d],g=f.geometry;g&&(this.normalization&&b.length?(b[0].intersects(g)||b[1].intersects(g))&&c.push(f):b.intersects(g)&&c.push(f))}return c},_filterByTime:function(a,b,c){var d=this._startTimeField,e=this._endTimeField,f;this._twoTimeFields||
(f=d||e);var g=l.isDefined,h=[],k=[],m,n=a.length,p,t;b=b?b.getTime():-Infinity;c=c?c.getTime():Infinity;if(f)for(m=0;m<n;m++)p=a[m],t=p.attributes,d=t[f],d>=b&&d<=c?h.push(p):k.push(p);else for(m=0;m<n;m++)p=a[m],t=p.attributes,f=t[d],t=t[e],f=g(f)?f:-Infinity,t=g(t)?t:Infinity,f>=b&&f<=c||t>=b&&t<=c||b>=f&&c<=t?h.push(p):k.push(p);return{match:h,noMatch:k}},_getSizeVariables:function(b){return b&&a.filter(b.getVisualVariablesForType("sizeInfo",!1),function(a){return!(!a.field&&!a.valueExpression)})},
_needClientSideSorting:function(b){return this._collection?!(!b||!b.length):a.some(b,function(a){return!!a.valueExpression})},_sortFeatures:function(a){var b=this.renderer,c=this._getSizeVariables(b);if(a&&1<a.length&&this._needClientSideSorting(c)){var d=c[0],e=this;a.sort(function(a,c){a._layer||(a._layer=e);c._layer||(c._layer=e);var f=b._getDataValue(a,d,"sizeInfo",null,e),g=b._getDataValue(c,d,"sizeInfo",null,e);return null==f?-1:null==g?1:g-f})}return a},_resolve:function(a,b,c,d,e){b&&this[b].apply(this,
a);c&&c.apply(null,a);d&&z._resDfd(d,a,e)},_getShallowClone:function(a){var b=new A,c;for(c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b},_query:function(b,c,d,e,f){var g=this,h=this._map,l=new k(z._dfdCanceller),m=d,n,p,q;if("executeRelationshipQuery"!==b){var m=this._getShallowClone(d),t=this.getOutFields();m.outFields||(m.outFields=t);m.outFields&&m.outFields.length&&(p=-1<a.indexOf(t,"*")?!1:!a.every(m.outFields,function(b){return-1<a.indexOf(t,b)}));m.returnGeometry=d.hasOwnProperty("returnGeometry")?
d.returnGeometry:!d.outStatistics;m.returnGeometry&&(m.multipatchOption=this.multipatchOption,null!=m.maxAllowableOffset||m.quantizationParameters)&&(d=null!=m.maxAllowableOffset?m.maxAllowableOffset:m.quantizationParameters.tolerance,null!=d&&d!==this.getMaxAllowableOffset()&&(q=!0));var r;h&&(h=h&&h.spatialReference,(d=m.outSpatialReference)?n=!d.equals(h):m.outSpatialReference=new y(h.toJson()));if(!this._applyQueryFilters(m,"execute"===b&&!m.outStatistics)){switch(b){case "execute":r=new K({features:[]});
break;case "executeForIds":r=[];break;case "executeForCount":r=0;break;case "executeForExtent":r={}}this._resolve([r],c,e,l);return l}if(h="executeForExtent"!==b&&!n&&!p&&!q&&this._canDoClientSideQuery(m))return l._pendingDfd=x(this._doQuery(m,h,"executeForIds"===b||"executeForCount"===b)),l._pendingDfd.then(function(a){switch(b){case "execute":r=new K;r.features=a;break;case "executeForIds":r=a;break;case "executeForCount":r=a.length}g._resolve([r],c,e,l)}),l}if(this._collection)return this._resolve([Error("FeatureLayer::_query - "+
this.invalidParams)],null,f,l,!0),l;if(this.loaded&&!this.isQueryable())return this._resolve([Error("Layer does not support query capability.")],null,f,l,!0),l;this._ts&&(m._ts=(new Date).getTime());(l._pendingDfd=this._task[b](m)).addCallbacks(function(a){var d=!!m.outStatistics||n||p||q;if("execute"===b||"executeRelationshipQuery"===b){var f,h;if("execute"===b)for(f=a.features,h=f.length,--h;0<=h;h--){if(f[h]._layer=g,!d&&!g._isTable){var k=g._mode._getFeature(f[h].attributes[g.objectIdField]);
k&&f.splice(h,1,k)}}else for(k in a)if(a.hasOwnProperty(k))for(f=a[k].features,h=f.length,--h;0<=h;h--)f[h]._layer=g}g._resolve([a],c,e,l)},function(a){g._resolve([a],null,f,l,!0)});return l},_convertFeaturesToJson:function(b,c,d,g){var h=[],l=this._selectionSymbol,k=this.visibilityField,m,n=this.objectIdField;this.loaded&&(d||g)&&(m=a.filter(this.fields,function(a){return!1===a.editable&&(!g||a.name!==n)}));for(d=0;d<b.length;d++){var p=b[d],q={},t=p.geometry,r=p.attributes,u=p.symbol;!t||g&&this.loaded&&
!this.allowGeometryUpdates||(q.geometry=t.toJson());k?(q.attributes=r=f.mixin({},r),r[k]=p.visible?1:0):r&&(q.attributes=f.mixin({},r));q.attributes&&m&&m.length&&a.forEach(m,function(a){delete q.attributes[a.name]});u&&u!==l&&(q.symbol=u.toJson());h.push(q)}return c?h:e.toJson(h)},_selectHandler:function(a,b,c,d,e){var f;switch(b){case G.SELECTION_NEW:this.clearSelection(!0);f=!0;break;case G.SELECTION_ADD:f=!0;break;case G.SELECTION_SUBTRACT:f=!1}d=a.features;var g=this._mode,h=[],l=this.objectIdField,
k,m;if(f)for(f=0;f<d.length;f++)k=d[f],m=k.attributes[l],k=g._addFeatureIIf(m,k),h.push(k),this._selectFeatureIIf(m,k,g);else for(f=0;f<d.length;f++)k=d[f],m=k.attributes[l],this._unSelectFeatureIIf(m,g),m=g._removeFeatureIIf(m),h.push(m||k);this._isSelOnly&&g._applyTimeFilter(!0);this._hasPartialSelectedFeatures=!!a.exceededTransferLimit;this._resolve([h,b,a.exceededTransferLimit?{queryLimitExceeded:!0}:null],"onSelectionComplete",c,e);if(a.exceededTransferLimit)this.onQueryLimitExceeded()},_selectFeatureIIf:function(a,
b,c){var d=this._selectedFeatures,e=d[a];e||(c._incRefCount(a),d[a]=b,this._isTable||(this._setSelectSymbol(b),b.attr("data-selected","")));return e||b},_unSelectFeatureIIf:function(a,b){var c=this._selectedFeatures[a];c&&(b._decRefCount(a),delete this._selectedFeatures[a],this._isTable||(this._setUnSelectSymbol(c),c.attr("data-selected")));return c},_isSelected:function(a){},_setSelectSymbol:function(a){var b=this._selectionSymbol;b&&!this._isSelOnly&&a.setSymbol(b)},_setUnSelectSymbol:function(a){var b=
this._selectionSymbol;b&&!this._isSelOnly&&b===a.symbol&&a.setSymbol(null,!0)},_getOutFields:function(){var b=[this.objectIdField,this.typeIdField,this.creatorField,this._startTimeField,this._endTimeField,this._trackIdField].concat(this._requiredFields).concat(this.dataAttributes),b=a.filter(b,function(b,c,d){return!!b&&a.indexOf(d,b)===c}),c=f.clone(this._outFields);if(c){if(-1!==a.indexOf(c,"*"))return c;a.forEach(b,function(b){-1===a.indexOf(c,b)&&c.push(b)});return c}return b},_checkFields:function(b){var c=
b||this._getOutFields();a.forEach(c,function(a){"*"!==a&&(this._getField(a)||console.debug("esri.layers.FeatureLayer: "+l.substitute({url:this.url,field:a},"unable to find '${field}' field in the layer 'fields' information [url: ${url}]")))},this);b||this._isTable||this._fserver||this._collection||this._isStream||a.some(this.fields,function(a){return a&&"esriFieldTypeGeometry"===a.type?!0:!1})||console.debug("esri.layers.FeatureLayer: "+l.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}]"))},
_fixFieldCase:function(a,b,c){var d=a&&a[b],e;if(d&&!f.isFunction(d)){if(e=!this._getField(d)&&this._getField(d,!0))d=a[b]=e.name;c&&c.push(d)}return d},_fixRendererFields:function(){var b=this.renderer;this._orderBy=null;this._requiredFields=[];if(b&&0<this.fields.length){var c=[],d,b=a.filter([b,b.observationRenderer,b.latestObservationRenderer,b.trackRenderer],l.isDefined),e=[].concat(b);a.forEach(b,function(b){a.forEach(b.rendererInfos,function(a){a.renderer&&e.push(a.renderer)})});a.forEach(e,
function(b){this._fixFieldCase(b,"attributeField",c);this._fixFieldCase(b,"attributeField2",c);this._fixFieldCase(b,"attributeField3",c);this._fixFieldCase(b.rotationInfo,"field",c);(d=this._fixFieldCase(b.sizeInfo,"field",c))&&!this._orderBy&&(this._orderBy=[d+" DESC"]);this._fixFieldCase(b.sizeInfo,"normalizationField",c);this._fixFieldCase(b.colorInfo,"field",c);this._fixFieldCase(b.colorInfo,"normalizationField",c);this._fixFieldCase(b.field,"field",c);this._fixFieldCase(b.opacityInfo,"field",
c);this._fixFieldCase(b.opacityInfo,"normalizationField",c);a.forEach(b.visualVariables,function(a){d=this._fixFieldCase(a,"field",c);"sizeInfo"===a.type&&d&&!this._orderBy&&(this._orderBy=[d+" DESC"]);this._fixFieldCase(a,"normalizationField",c)},this);var e=a.map(b.getFieldsUsedInExpressions(),function(a){var b=this.getField(a);return b?b.name:a},this);c=c.concat(e);this._orderBy||!b.addBreak||f.isFunction(b.attributeField)||!b.backgroundFillSymbol&&!this._hasSizeDiff(b)||(this._orderBy=[b.attributeField+
" DESC"])},this);this._requiredFields=a.filter(c,l.isDefined)}},_hasSizeDiff:function(b){var c=Number.MAX_VALUE,d=-Number.MAX_VALUE,e,f;a.forEach(b.infos,function(a){if(f=a.symbol){e=0;switch(f.type){case "simplemarkersymbol":e=f.size;break;case "picturemarkersymbol":e=(f.width+f.height)/2;break;case "simplelinesymbol":case "cartographiclinesymbol":e=f.width;break;case "simplefillsymbol":case "picturefillsymbol":e=f.outline&&f.outline.width}e&&(c=Math.min(c,e),d=Math.max(d,e))}});return c!==Number.MAX_VALUE&&
d!==-Number.MAX_VALUE&&1<Math.abs(d-c)},getOrderByFields:function(){var b=this.orderByFields||this._orderBy;return this.supportsAdvancedQueries&&b?a.filter(b,function(a){a=a.split(" ")[0];return!!this._getField(a,!0)},this):null},_getField:function(b,c){var d=this.fields;if(!d||0===d.length)return null;var e;c&&(b=b.toLowerCase());a.some(d,function(a){var d=!1;(d=c?a&&a.name.toLowerCase()===b?!0:!1:a&&a.name===b?!0:!1)&&(e=a);return d});return e},_getDateOpts:function(){this._dtOpts||(this._dtOpts=
{properties:a.map(a.filter(this.fields,function(a){return!(!a||"esriFieldTypeDate"!==a.type)}),function(a){return a.name})});return this._dtOpts},_applyNormalized:function(b,c){b&&c&&a.forEach(b,function(a,b){a&&c[b]&&a.setGeometry(c[b])})},_editHandler:function(b,c,d,e,g,h){g=b.addResults;var l=b.updateResults;b=b.deleteResults;var k,m,n,p,q,r=this.objectIdField,t=this._mode,u=this._isTable;k=this.editFieldsInfo;p=this.getOutFields()||[];var v=k&&k.creatorField,w=k&&k.creationDateField,x=k&&k.editorField,
y=k&&k.editDateField;k=k&&k.realm;-1===a.indexOf(p,"*")&&(v&&-1===a.indexOf(p,v)&&(v=null),w&&-1===a.indexOf(p,w)&&(w=null),x&&-1===a.indexOf(p,x)&&(x=null),y&&-1===a.indexOf(p,y)&&(y=null));var A=w||y?(new Date).getTime():null,z=v||x?this.getUserId():void 0;z&&k&&(z=z+"@"+k);if(g){var B=this.globalIdField;for(k=0;k<g.length;k++)g[k]=new P(g[k]),u||(m=g[k],m.success&&(n=m.objectId,p=c[k],(q=p._graphicsLayer)&&q!==this&&q.remove(p),q=p.attributes||{},q[r]=n,n=m.globalId,B&&n&&(q[B]=n),v&&(q[v]=z),
x&&(q[x]=z),w&&(q[w]=A),y&&(q[y]=A),p.setAttributes(q),t._init&&t.drawFeature(p)))}if(l)for(k=0;k<l.length;k++)if(l[k]=new P(l[k]),!u&&(m=l[k],m.success)){n=m.objectId;p=d[n];if(c=t._getFeature(n))c.geometry!==p.geometry&&p.geometry&&c.setGeometry(X.fromJson(p.geometry.toJson())),c.attributes!==p.attributes&&p.attributes&&c.setAttributes(f.mixin(c.attributes,p.attributes)),this._repaint(c,n);p=c||p;q=p.attributes||{};x&&(q[x]=z);y&&(q[y]=A);p.setAttributes(q)}if(b){d=[];for(k=0;k<b.length;k++)if(b[k]=
new P(b[k]),!u&&(m=b[k],m.success&&(n=m.objectId,p=t._getFeature(n))))this._unSelectFeatureIIf(n,t)&&d.push(p),p._count=0,t._removeFeatureIIf(n);if(0<d.length)this.onSelectionComplete(d,G.SELECTION_SUBTRACT)}this._resolve([g,l,b],"onEditsComplete",e,h)},_sendAttachment:function(a,b,c,d,e){var g=this;return B({url:this._url.path+"/"+b+"/"+("add"===a?"addAttachment":"updateAttachment"),form:c,content:f.mixin(this._url.query,{f:"json",token:this._getToken()||void 0}),callbackParamName:"callback.html",
handleAs:"json"}).addCallback(function(c){var e="add"===a?"onAddAttachmentComplete":"onUpdateAttachmentComplete";c=new P(c["add"===a?"addAttachmentResult":"updateAttachmentResult"]);c.attachmentId=c.objectId;c.objectId=b;g._resolve([c],e,d);return c}).addErrback(function(a){g._resolve([a],null,e,null,!0)})},_repaint:function(a,b,c){b=l.isDefined(b)?b:a.attributes[this.objectIdField];b in this._selectedFeatures&&this._selectionSymbol||a.setSymbol(a.symbol,c)},_getKind:function(a){var b=this._trackManager;
return b?b.isLatestObservation(a)?1:0:0}});f.mixin(G,{MODE_SNAPSHOT:0,MODE_ONDEMAND:1,MODE_SELECTION:2,SELECTION_NEW:3,SELECTION_ADD:4,SELECTION_SUBTRACT:5,MODE_AUTO:6,MODE_STREAM:7,POPUP_NONE:"esriServerHTMLPopupTypeNone",POPUP_HTML_TEXT:"esriServerHTMLPopupTypeAsHTMLText",POPUP_URL:"esriServerHTMLPopupTypeAsURL"});Y._createWrappers(G);c("extend-esri")&&f.setObject("layers.FeatureLayer",G,g);return G});