// 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:{"dojo/DeferredList":function(){define(["./_base/kernel","./_base/Deferred","./_base/array"],function(q,k,f){q.DeferredList=function(t,n,b,r,u){var v=[];k.call(this);var g=this;0!==t.length||n||this.resolve([0,[]]);var p=0;f.forEach(t,function(d,l){function z(e,a){v[l]=[e,a];p++;p===t.length&&g.resolve(v)}d.then(function(e){n?g.resolve([l,e]):z(!0,e)},function(e){b?g.reject(e):z(!1,e);if(r)return null;throw e;})})};q.DeferredList.prototype=new k;q.DeferredList.prototype.gatherResults=
function(k){k=new q.DeferredList(k,!1,!0,!1);k.addCallback(function(k){var b=[];f.forEach(k,function(r){b.push(r[1])});return b});return k};return q.DeferredList})},"esri/dijit/PopupTemplate":function(){define("dojo/_base/declare dojo/_base/lang dojo/has dojo/dom-construct ../kernel ../InfoTemplate ../PopupInfo ./PopupRenderer".split(" "),function(q,k,f,t,n,b,r,u){q=q([b,r],{declaredClass:"esri.dijit.PopupTemplate","-chains-":{constructor:"manual"},chartTheme:null,constructor:function(b,g){k.mixin(this,
g);this.initialize(b,g)},getTitle:function(b){var g;this.info&&(g=this.titleHasRelatedFields?"":this._getPopupValues(b,null,!0).title);return g||""},getContent:function(b){return this.info?(new u({template:this,graphic:b,chartTheme:this.chartTheme},t.create("div"))).domNode:""}});f("extend-esri")&&k.setObject("dijit.PopupTemplate",q,n);return q})},"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(q,k,f,t,n,b,r,u,v,g,p,d,l,z,e,a,c,m,D,x,C){q=q(null,{declaredClass:"esri.PopupInfo",_reExprField:/^\s*expression\//i,_exprPrefix:"expression/",_relatedFieldPrefix:"relationships/",initialize:function(a,c){if(a){k.mixin(this,c);this.info=a;this.title=this.getTitle;this.content=this.getContent;this._exprCache=this._compileExpressions(this.info.expressionInfos);var h=this._fieldLabels={},e=this._fieldsMap={};this.info.fieldInfos&&f.forEach(this.info.fieldInfos,function(a){var c=a.fieldName.toLowerCase(),
A=this._isExpressionField(c)?this.getExpressionInfo(c):null;h[c]=A?A.title:a.label;e[c]=a},this);this.titleHasRelatedFields=!(!this.info.title||-1===this.info.title.indexOf("{"+this._relatedFieldPrefix))}},toJson:function(){return t.fromJson(t.toJson(this.info))},getTitle:function(){},getContent:function(){},getFieldInfo:function(a){var c;f.some(this.info&&this.info.fieldInfos,function(h){h.fieldName===a&&(c=h);return!!c});return c},getExpressionInfo:function(a){if(this._isExpressionField(a)){a=a.replace(this._reExprField,
"");a=a.toLowerCase();var c;f.some(this.info.expressionInfos,function(h){h.name.toLowerCase()===a&&(c=h);return!!c});return c}},hasGeometryOperations:function(){return f.some(this.info.expressionInfos,function(a){return D.hasGeometryOperations(a.expression)})},getComponents:function(a){var c=this.info,h={};c.fieldInfos&&(c=f.filter(c.fieldInfos,function(a){return-1!==a.fieldName.indexOf(this._relatedFieldPrefix)},this))&&0<c.length&&(h.relatedInfo=this._getRelatedRecords({graphic:a,fieldsInfo:c}));
this._needFullResolutionFeature(a)&&(h.fullResolutionFeature=this._getFullResolutionFeature(a));return z(h).then(k.hitch(this,function(h){return this._getPopupValues(a,h.fullResolutionFeature)}))},getAttachments:function(a){var c=a.getSourceLayer();a=a.attributes;if(this.info.showAttachments&&c&&c.hasAttachments&&c.objectIdField&&(a=a&&a[c.objectIdField]))return c.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 c=a.getSourceLayer(),h=c.objectIdField;a=(a=a.attributes)&&h&&a[h];if(null==a)return null;var y=new e;y.objectIds=[a];y.maxAllowableOffset=0;y.outFields=[h];return c.queryFeatures(y).then(function(a){return a.features&&a.features[0]})},_isExpressionField:function(a){return this._reExprField.test(a)},_compileExpressions:function(a){var c={};f.forEach(a,function(a){var h=
a.returnType&&a.returnType.toLowerCase();c[a.name]=x.createAttributeCache({valueExpression:a.expression},"number"!==h)});return c},_fetchAttributes:function(a,c){var h=k.clone(a.attributes)||{},e=c&&c.geometry,A=this._exprPrefix,d=this._exprCache;f.forEach(this.info.expressionInfos,function(c){var y=A+c.name;c=(c=d[c.name])?a._getDataValue(c.attributeInfo,c,D,null,e):null;"string"===typeof c&&(c=g.encode(c));h[y]=c});return h},_getPopupValues:function(a,c,h){var e=this.info,A=a.getSourceLayer(),d=
this._fetchAttributes(a,c),m=k.clone(d);c=e.fieldInfos;var w="",b="",B,l,g,D,x,r=A&&A._getDateOpts&&A._getDateOpts().properties,r=r&&r.slice(0),z={dateFormat:{properties:r,formatter:"DateFormat"+this._insertOffset(this._dateFormats.shortDateShortTime)}};if(this._relatedInfo)for(D in this._relatedInfo)if(this._relatedInfo.hasOwnProperty(D)){var u=this._relatedInfo[D],C=this._relatedLayersInfo[D];u&&(f.forEach(u.relatedFeatures,function(a){for(x in a.attributes)if(a.attributes.hasOwnProperty(x)&&"esriRelCardinalityOneToOne"===
C.relation.cardinality){var h=this._toRelatedFieldName([C.relation.id,x]);d[h]=m[h]=a.attributes[x]}},this),f.forEach(u.relatedStatsFeatures,function(a){for(x in a.attributes)if(a.attributes.hasOwnProperty(x)){var h=this._toRelatedFieldName([C.relation.id,x]);d[h]=m[h]=a.attributes[x]}},this))}c&&f.forEach(c,function(a){l=a.fieldName;var h=this._getLayerFieldInfo(A,l);h&&(l=a.fieldName=h.name);m[l]=this._formatValue(m[l],l,z);r&&a.format&&a.format.dateFormat&&(a=f.indexOf(r,l),-1<a&&r.splice(a,1))},
this);if(A){D=A.types;var n=(u=A.typeIdField)&&d[u];for(l in d)if(d.hasOwnProperty(l)&&-1===l.indexOf(this._relatedFieldPrefix)&&(g=d[l],p.isDefined(g))){var v=this._getDomainName(A,a,D,n,l,g);p.isDefined(v)?m[l]=v:l===u&&(v=this._getTypeName(A,a,g),p.isDefined(v)&&(m[l]=v))}}e.title&&(w=this._processFieldsInLinks(this._fixTokens(e.title,A),d),w=k.trim(p.substitute(m,w,z)||""));if(h)return{title:w};e.description&&(b=this._processFieldsInLinks(this._fixTokens(e.description,A),d),b=k.trim(p.substitute(m,
b,z)||""));c&&(B=[],f.forEach(c,function(a){(l=a.fieldName)&&a.visible&&B.push([this._fieldLabels[l.toLowerCase()]||l,p.substitute(m,"${"+l+"}",z)||""])},this));var t,q;e.mediaInfos&&(t=[],f.forEach(e.mediaInfos,function(a){q=0;g=a.value;switch(a.type){case "image":var h=g.sourceURL,h=h&&k.trim(p.substitute(d,this._fixTokens(h,A)));q=!!h;break;case "piechart":case "linechart":case "columnchart":case "barchart":var c,h=g.normalizeField;g.fields=f.map(g.fields,function(a){return(c=this._getLayerFieldInfo(A,
a))?c.name:a},this);h&&(c=this._getLayerFieldInfo(A,h),g.normalizeField=c?c.name:h);q=f.some(g.fields,function(a){return p.isDefined(d[a])||-1!==a.indexOf(this._relatedFieldPrefix)&&this._relatedInfo},this);break;default:return}if(q){a=k.clone(a);g=a.value;var h=a.title?this._processFieldsInLinks(this._fixTokens(a.title,A),d):"",e=a.caption?this._processFieldsInLinks(this._fixTokens(a.caption,A),d):"";a.title=h?k.trim(p.substitute(m,h,z)||""):"";a.caption=e?k.trim(p.substitute(m,e,z)||""):"";if("image"===
a.type)g.sourceURL=p.substitute(d,this._fixTokens(g.sourceURL,A)),g.linkURL&&(g.linkURL=k.trim(p.substitute(d,this._fixTokens(g.linkURL,A))||""));else{var y,w;f.forEach(g.fields,function(a,h){if(-1!==a.indexOf(this._relatedFieldPrefix))w=this._getRelatedChartInfos(a,g,d,z),w instanceof Array?g.fields=w:g.fields[h]=w;else{var c=d[a],c=void 0===c?null:c;y=d[g.normalizeField]||0;c&&y&&(c/=y);g.fields[h]={y:c,tooltip:(this._fieldLabels[a.toLowerCase()]||a)+":\x3cbr/\x3e"+this._formatValue(c,a,z,!!y)}}},
this)}t.push(a)}},this));return{title:w,description:b,hasDescription:!!e.description,fields:B&&B.length?B:null,mediaInfos:t&&t.length?t:null,formatted:m,editSummary:A&&A.getEditSummary?A.getEditSummary(a):""}},_getRelatedChartInfos:function(a,c,h,e){var A,d,m,y,b,w;A=[];w=this._fromRelatedFieldName(a);b=w[0];d=this._relatedInfo[b];b=this._relatedLayersInfo[b];d&&f.forEach(d.relatedFeatures,function(d){d=d.attributes;var b,G;for(G in d)if(d.hasOwnProperty(G)&&G===w[1]){b={};y=d[G];c.normalizeField&&
(m=-1!==c.normalizeField.indexOf(this._relatedFieldPrefix)?d[this._fromRelatedFieldName(c.normalizeField)[1]]:h[c.normalizeField]);y&&m&&(y/=m);if(c.tooltipField)if(-1!==c.tooltipField.indexOf(this._relatedFieldPrefix)){var l=this._fromRelatedFieldName(c.tooltipField)[1],B=p.isDefined(d[l])?d[l]:l;b.tooltip=B+":\x3cbr/\x3e"+this._formatValue(y,l,e,!!m)}else b.tooltip=(this._fieldLabels[a.toLowerCase()]||a)+":\x3cbr/\x3e"+this._formatValue(y,c.tooltipField,e,!!m);else b.tooltip=y;b.y=y;A.push(b)}},
this);return"esriRelCardinalityOneToMany"===b.relation.cardinality||"esriRelCardinalityManyToMany"===b.relation.cardinality?A:A[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,c){var h=this;return a.replace(/(\{([^\{\r\n]+)\})/g,function(a,e,d){a=
h._getLayerFieldInfo(c,d);return"$"+(a?"{"+a.name+"}":e)})},_encodeAttributes:function(a){a=k.clone(a)||{};var c,h;for(c in a)(h=a[c])&&"string"===typeof h&&(h=encodeURIComponent(h).replace(/\'/g,"\x26apos;"),a[c]=h);return a},_processFieldsInLinks:function(a,c){var h=this._encodeAttributes(c),h=k.hitch(this,this._addValuesToHref,c,h);a&&(a=a.replace(this._reHref,h).replace(this._reHrefApos,h));return a},_addValuesToHref:function(a,c,h,e){e=e&&k.trim(e);h=p.substitute(e&&0===e.indexOf("${")?a:c,h);
this._reEmptyHref.test(h)?h='href\x3d"about:blank"':this._reEmptyHrefApos.test(h)&&(h="href\x3d'about:blank'");return h},_getLayerFieldInfo:function(a,c){return a&&a.getField?a.getField(c):null},_formatValue:function(a,c,h,e){var d=this._fieldsMap[c.toLowerCase()],m=d&&d.format;c=-1!==f.indexOf(h.dateFormat.properties,c);var b="number"===typeof a&&!c&&(!m||!m.dateFormat);if(!p.isDefined(a)||!d||!p.isDefined(m))return b?this._forceLTR(a):a;var y="",d=[],w=m.hasOwnProperty("places")||m.hasOwnProperty("digitSeparator"),
l=m.hasOwnProperty("digitSeparator")?m.digitSeparator:!0;if(w&&!c)y="NumberFormat",d.push("places: "+(p.isDefined(m.places)&&(!e||0<m.places)?Number(m.places):"Infinity")),d.length&&(y+="("+d.join(",")+")");else if(m.dateFormat)y="DateFormat"+this._insertOffset(this._dateFormats[m.dateFormat]||this._dateFormats.shortDateShortTime);else return b?this._forceLTR(a):a;var g=this._applyFormatting(a,y,h);w&&-1<a.constructor.toString().indexOf("Array")&&(g="",f.forEach(a,k.hitch(this,function(a,c){c&&(g+=
" ");g+=this._applyFormatting(a,y,h)})));w&&!l&&C.group&&(g=g.replace(new RegExp("\\"+C.group,"g"),""));c&&(g='\x3cspan class\x3d"esriDateValue"\x3e'+g+"\x3c/span\x3e");return b?this._forceLTR(g):g},_applyFormatting:function(a,c,h){return p.substitute({myKey:a},"${myKey:"+c+"}",h)||""},_forceLTR:function(a){var c=u("ie");return c&&10>=c?a:"\x3cspan class\x3d'esriNumericValue'\x3e"+a+"\x3c/span\x3e"},_insertOffset:function(a){a&&(a=p.isDefined(this.utcOffset)?a.replace(/\)\s*$/,", utcOffset:"+this.utcOffset+
")"):a);return a},_getDomainName:function(a,c,h,e,d,m){return(a=a.getDomain&&a.getDomain(d,{feature:c}))&&a.codedValues?a.getName(m):null},_getTypeName:function(a,c,h){return(a=a.getType&&a.getType(c))&&a.name},_getRelatedRecords:function(a){var c=a.graphic,h;this._relatedLayersInfoPromise||(this._relatedLayersInfoPromise=this._getRelatedLayersInfo(a).then(k.hitch(this,function(a){for(h in a)a.hasOwnProperty(h)&&a[h]&&(this._relatedLayersInfo[h].relatedLayerInfo=a[h])})));return this._relatedLayersInfoPromise.then(k.hitch(this,
function(){return this._queryRelatedLayers(c)})).then(k.hitch(this,function(a){this._setRelatedRecords(c,a);return a}))},_getRelatedLayersInfo:function(a){var c=a.fieldsInfo,h,e,d={};h=a.graphic.getSourceLayer();this._relatedLayersInfo||(this._relatedLayersInfo={});f.forEach(c,function(a){var c,e,d,A;c=this._fromRelatedFieldName(a.fieldName);e=c[0];c=c[1];e&&(!this._relatedLayersInfo[e]&&h&&h.relationships&&(f.some(h.relationships,function(a){if(a.id==e)return A=a,!0}),A&&(this._relatedLayersInfo[e]=
{relation:A,relatedFields:[],outStatistics:[]})),this._relatedLayersInfo[e]&&(this._relatedLayersInfo[e].relatedFields.push(c),a.statisticType&&(d=new m,d.statisticType=a.statisticType,d.onStatisticField=c,d.outStatisticFieldName=c,this._relatedLayersInfo[e].outStatistics.push(d))))},this);for(e in this._relatedLayersInfo)this._relatedLayersInfo.hasOwnProperty(e)&&this._relatedLayersInfo[e]&&(a=this._relatedLayersInfo[e].relation,a=h.url.replace(/[0-9]+$/,a.relatedTableId),this._relatedLayersInfo[e].relatedLayerUrl=
a,d[e]=l({url:a,content:{f:"json"},callbackParamName:"callback"}));return v(d)},_queryRelatedLayers:function(a){var c={},h;for(h in this._relatedLayersInfo)this._relatedLayersInfo.hasOwnProperty(h)&&(c[h]=this._queryRelatedLayer({graphic:a,relatedInfo:this._relatedLayersInfo[h]}));return v(c)},_queryRelatedLayer:function(c){var d,h,m,A,b,l,g,D,x,p,z,B,u;d=c.graphic;h=d.getSourceLayer();m=h.url.match(/[0-9]+$/g)[0];z=c.relatedInfo;p=z.relatedLayerInfo;B=z.relatedLayerUrl;c=z.relation;f.some(p.relationships,
function(a){if(a.relatedTableId===parseInt(m,10))return A=a,!0},this);A&&(b=new e,f.some(p.fields,function(a){if(a.name===A.keyField)return D=-1!==f.indexOf(["esriFieldTypeSmallInteger","esriFieldTypeInteger","esriFieldTypeSingle","esriFieldTypeDouble"],a.type)?"number":"string",!0}),A.relationshipTableId&&A.keyFieldInRelationshipTable?(u=new r,this._queryRelatedRecords(d,A).then(k.hitch(this,function(c){var m;(m=c[d.attributes[h.objectIdField]])?(c=f.map(m.features,function(a){return a.attributes[p.objectIdField]},
this),z.outStatistics&&0<z.outStatistics.length&&p.supportsStatistics&&(x=new e,x.objectIds=c,x.outFields=b.outFields,x.outStatistics=z.outStatistics),x&&(l=new a(B),l.execute(x).then(k.hitch(this,function(a){var c=[];c.push(m);c.push(a);u.resolve(c)})))):u.resolve()}))):(g="string"===D?A.keyField+"\x3d'"+d.attributes[c.keyField]+"'":A.keyField+"\x3d"+d.attributes[c.keyField],b.where=g,b.outFields=z.relatedFields,z.outStatistics&&0<z.outStatistics.length&&p.supportsStatistics&&(x=new e,x.where=b.where,
x.outFields=b.outFields,x.outStatistics=z.outStatistics),l=new a(B),g=[],g.push(l.execute(b)),x&&g.push(l.execute(x))));return g?v(g):u?u.promise:void 0},_setRelatedRecords:function(a,c){this._relatedInfo=[];for(var h in c)if(c.hasOwnProperty(h)&&c[h]){var e=c[h];this._relatedInfo[h]={};this._relatedInfo[h].relatedFeatures=e[0].features;p.isDefined(e[1])&&(this._relatedInfo[h].relatedStatsFeatures=e[1].features)}},_handlerErrorResponse:function(a,c){a.reject(c)},_fromRelatedFieldName:function(a){var c=
[];-1!==a.indexOf(this._relatedFieldPrefix)&&(a=a.split("/"),c=a.slice(1));return c},_toRelatedFieldName:function(a){var c="";a&&0<a.length&&(c=this._relatedFieldPrefix+a[0]+"/"+a[1]);return c},_queryRelatedRecords:function(a,e){var h=a.getSourceLayer(),d=new c;d.outFields=["*"];d.relationshipId=e.id;d.objectIds=[a.attributes[h.objectIdField]];return h.queryRelatedFeatures(d)}});b("extend-esri")&&(d.PopupInfo=d.PopupInfoTemplate=q);return q})},"dojox/html/entities":function(){define(["dojo/_base/lang"],
function(q){var k=q.getObject("dojox.html.entities",!0),f=function(f,b){var r,u;if(b._encCache&&b._encCache.regexp&&b._encCache.mapper&&b.length==b._encCache.length)r=b._encCache.mapper,u=b._encCache.regexp;else{r={};u=["["];var k;for(k=0;k<b.length;k++)r[b[k][0]]="\x26"+b[k][1]+";",u.push(b[k][0]);u.push("]");u=new RegExp(u.join(""),"g");b._encCache={mapper:r,regexp:u,length:b.length}}return f=f.replace(u,function(b){return r[b]})},t=function(f,b){var r,u;if(b._decCache&&b._decCache.regexp&&b._decCache.mapper&&
b.length==b._decCache.length)r=b._decCache.mapper,u=b._decCache.regexp;else{r={};u=["("];var k;for(k=0;k<b.length;k++){var g="\x26"+b[k][1]+";";k&&u.push("|");r[g]=b[k][0];u.push(g)}u.push(")");u=new RegExp(u.join(""),"g");b._decCache={mapper:r,regexp:u,length:b.length}}return f=f.replace(u,function(b){return r[b]})};k.html=[["\x26","amp"],['"',"quot"],["\x3c","lt"],["\x3e","gt"],["\u00a0","nbsp"]];k.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"]];k.encode=function(n,b){n&&(b?
n=f(n,b):(n=f(n,k.html),n=f(n,k.latin)));return n};k.decode=function(f,b){f&&(b?f=t(f,b):(f=t(f,k.html),f=t(f,k.latin)));return f};return k})},"esri/promiseList":function(){define(["dojo/_base/array","dojo/Deferred","dojo/when"],function(q,k,f){var t=q.forEach;return function(n){function b(b,e){v[e]=b;d.progress([b,e]);0===--l&&d.resolve(v)}var r,u;n instanceof Array?u=n:n&&"object"===typeof n&&(r=n);var v,g=[];if(r){u=[];for(var p in r)Object.hasOwnProperty.call(r,p)&&(g.push(p),u.push(r[p]));v=
{}}else u&&(v=[]);if(!u||!u.length)return(new k).resolve(v);var d=new k;d.promise.always(function(){v=g=null});var l=u.length;t(u,function(l,e){r||g.push(e);f(l,function(a){d.isFulfilled()||b(a,g[e])},function(a){d.isFulfilled()||b(a,g[e])})});return d.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(q,k,f,t,n,b,r,u,v,g,p,d,l){q=q(d,{declaredClass:"esri.tasks.QueryTask",_eventMap:{complete:["featureSet"],"execute-for-count-complete":["count"],"execute-for-ids-complete":["objectIds"],"execute-relationship-query-complete":["featureSets"]},constructor:function(d,e){this._handler=k.hitch(this,this._handler);this._relationshipQueryHandler=k.hitch(this,this._relationshipQueryHandler);this._executeForIdsHandler=k.hitch(this,this._executeForIdsHandler);this._countHandler=k.hitch(this,this._countHandler);
this._extentHandler=k.hitch(this,this._extentHandler);this.source=e&&e.source;this.gdbVersion=e&&e.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(d,e,a,c,m){c=m.assembly;d=this._encode(k.mixin({},this._url.query,{f:"json"},d.toJson(c&&c[0])));var b=this._handler,l=this._errorHandler;this.source&&(c={source:this.source.toJson()},d.layer=n.toJson(c));this.gdbVersion&&(d.gdbVersion=this.gdbVersion);return u({url:this._url.path+"/query",content:d,callbackParamName:"callback",load:function(c,d){b(c,d,e,a,m.dfd)},error:function(c){l(c,a,m.dfd)}},this.requestOptions)},executeRelationshipQuery:function(d,
e,a){d=this._encode(k.mixin({},this._url.query,{f:"json"},d.toJson()));var c=this._relationshipQueryHandler,m=this._errorHandler;this.gdbVersion&&(d.gdbVersion=this.gdbVersion);var b=new t(v._dfdCanceller);b._pendingDfd=u({url:this._url.path+"/queryRelatedRecords",content:d,callbackParamName:"callback",load:function(d,m){c(d,m,e,a,b)},error:function(c){m(c,a,b)}},this.requestOptions);return b},executeForIds:function(d,e,a,c){var m=c.assembly;d=this._encode(k.mixin({},this._url.query,{f:"json",returnIdsOnly:!0},
d.toJson(m&&m[0])));var b=this._executeForIdsHandler,l=this._errorHandler;this.source&&(m={source:this.source.toJson()},d.layer=n.toJson(m));this.gdbVersion&&(d.gdbVersion=this.gdbVersion);return u({url:this._url.path+"/query",content:d,callbackParamName:"callback",load:function(d,m){b(d,m,e,a,c.dfd)},error:function(d){l(d,a,c.dfd)}},this.requestOptions)},executeForCount:function(d,e,a,c){var m=c.assembly;d=this._encode(k.mixin({},this._url.query,{f:"json",returnIdsOnly:!0,returnCountOnly:!0},d.toJson(m&&
m[0])));var b=this._countHandler,l=this._errorHandler;this.source&&(m={source:this.source.toJson()},d.layer=n.toJson(m));this.gdbVersion&&(d.gdbVersion=this.gdbVersion);return u({url:this._url.path+"/query",content:d,callbackParamName:"callback",load:function(d,m){b(d,m,e,a,c.dfd)},error:function(d){l(d,a,c.dfd)}},this.requestOptions)},executeForExtent:function(d,e,a,c){var m=c.assembly;d=this._encode(k.mixin({},this._url.query,{f:"json",returnExtentOnly:!0,returnCountOnly:!0},d.toJson(m&&m[0])));
var b=this._extentHandler,l=this._errorHandler;this.source&&(m={source:this.source.toJson()},d.layer=n.toJson(m));this.gdbVersion&&(d.gdbVersion=this.gdbVersion);return u({url:this._url.path+"/query",content:d,callbackParamName:"callback",load:function(d,m){b(d,m,e,a,c.dfd)},error:function(d){l(d,a,c.dfd)}},this.requestOptions)},_handler:function(d,e,a,c,m){try{var b=new l(d);this._successHandler([b],"onComplete",a,m)}catch(x){this._errorHandler(x,c,m)}},_relationshipQueryHandler:function(d,e,a,c,
m){try{var b=d.geometryType,g=d.spatialReference,p={};f.forEach(d.relatedRecordGroups,function(a){var c={};c.geometryType=b;c.spatialReference=g;c.features=a.relatedRecords;c=new l(c);if(null!=a.objectId)p[a.objectId]=c;else for(var h in a)a.hasOwnProperty(h)&&"relatedRecords"!==h&&(p[a[h]]=c)});this._successHandler([p],"onExecuteRelationshipQueryComplete",a,m)}catch(B){this._errorHandler(B,c,m)}},_executeForIdsHandler:function(d,e,a,c,m){try{this._successHandler([d.objectIds],"onExecuteForIdsComplete",
a,m)}catch(D){this._errorHandler(D,c,m)}},_countHandler:function(d,e,a,c,m){try{var b,l=d.features,g=d.objectIds;if(g)b=g.length;else{if(l)throw Error("Unable to perform query. Please check your parameters.");b=d.count}this._successHandler([b],"onExecuteForCountComplete",a,m)}catch(B){this._errorHandler(B,c,m)}},_extentHandler:function(d,e,a,c,b){try{d.extent&&(d.extent=new g(d.extent)),this._successHandler([d],"onExecuteForExtentComplete",a,b)}catch(D){this._errorHandler(D,c,b)}}});p._createWrappers(q);
b("extend-esri")&&k.setObject("tasks.QueryTask",q,r);return q})},"esri/tasks/Task":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/json dojo/has ../kernel ../deferredUtils ../urlUtils ../Evented".split(" "),function(q,k,f,t,n,b,r,u){q=q(u,{declaredClass:"esri.tasks._Task",_eventMap:{error:["error"],complete:["result"]},constructor:function(b,g){b&&k.isString(b)&&(this._url=r.urlToObject(this.url=b));g&&g.requestOptions&&(this.requestOptions=g.requestOptions);this.normalization=!0;
this._errorHandler=k.hitch(this,this._errorHandler);this.registerConnectEvents()},_useSSL:function(){var b=this._url,g=/^http:/i;this.url&&(this.url=this.url.replace(g,"https:"));b&&b.path&&(b.path=b.path.replace(g,"https:"))},_encode:function(b,g,p){var d,l,r={},e,a;for(e in b)if("declaredClass"!==e&&(d=b[e],l=typeof d,null!==d&&void 0!==d&&"function"!==l))if(k.isArray(d))for(r[e]=[],a=d.length,l=0;l<a;l++)r[e][l]=this._encode(d[l]);else"object"===l?d.toJson&&(l=d.toJson(p&&p[e]),"esri.tasks.FeatureSet"===
d.declaredClass&&l.spatialReference&&(l.sr=l.spatialReference,delete l.spatialReference),r[e]=g?l:f.toJson(l)):r[e]=d;return r},_successHandler:function(r,g,p,d){g&&this[g].apply(this,r);p&&p.apply(null,r);d&&b._resDfd(d,r)},_errorHandler:function(b,g,p){this.onError(b);g&&g(b);p&&p.errback(b)},setNormalization:function(b){this.normalization=b},onError:function(){}});t("extend-esri")&&(n.Task=q);return q})},"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(q,k,f,t,n,b,r,u,v,g,p){q=q(null,{declaredClass:"esri.tasks.FeatureSet",constructor:function(d){if(d){k.mixin(this,d);var b=this.features,z=d.spatialReference,e=g.getGeometryType(d.geometryType),z=this.spatialReference=new u(z);this.geometryType=d.geometryType;d.fields&&(this.fields=d.fields);f.forEach(b,function(a,c){var d=a.geometry&&a.geometry.spatialReference;b[c]=new r(e&&a.geometry?new e(a.geometry):null,a.symbol&&p.fromJson(a.symbol),a.attributes);b[c].geometry&&!d&&b[c].geometry.setSpatialReference(z)});
this._hydrate()}else this.features=[]},displayFieldName:null,geometryType:null,spatialReference:null,fieldAliases:null,toJson:function(d){var l={};this.displayFieldName&&(l.displayFieldName=this.displayFieldName);this.fields&&(l.fields=this.fields);this.spatialReference?l.spatialReference=this.spatialReference.toJson():this.features[0]&&this.features[0].geometry&&(l.spatialReference=this.features[0].geometry.spatialReference.toJson());this.features[0]&&(this.features[0].geometry&&(l.geometryType=
g.getJsonType(this.features[0].geometry)),l.features=v._encodeGraphics(this.features,d));l.geometryType=l.geometryType||this.geometryType;l.exceededTransferLimit=this.exceededTransferLimit;l.transform=this.transform;return b.fixJson(l)},_hydrate:function(){var d=this.transform,b=this.geometryType;if(d&&b)for(var g=this.features,e=d.translate[0],a=d.translate[1],c=d.scale[0],m=d.scale[1],p=function(a,c,d){if("esriGeometryPoint"===a)return function(a){a.x=c(a.x);a.y=d(a.y)};if("esriGeometryPolyline"===
a||"esriGeometryPolygon"===a)return function(a){a=a.rings||a.paths;var h,e,b,m,l,g,w,p;h=0;for(e=a.length;h<e;h++)for(l=a[h],b=0,m=l.length;b<m;b++)g=l[b],0<b?(w+=g[0],p+=g[1]):(w=g[0],p=g[1]),g[0]=c(w),g[1]=d(p)};if("esriGeometryEnvelope"===a)return function(a){a.xmin=c(a.xmin);a.ymin=d(a.ymin);a.xmax=c(a.xmax);a.ymax=d(a.ymax)};if("esriGeometryMultipoint"===a)return function(a){a=a.points;var h,e,b,m,l;h=0;for(e=a.length;h<e;h++)b=a[h],0<h?(m+=b[0],l+=b[1]):(m=b[0],l=b[1]),b[0]=c(m),b[1]=d(l)}}(b,
function(a){return a*c+e},function(c){return a-c*m}),d=0,b=g.length;d<b;d++)g[d].geometry&&p(g[d].geometry);this.transform=null},quantize:function(d){if(!this.geometryType)return this.transform=null,this;var b=d.translate[0],g=d.translate[1],e=d.scale[0],a=d.scale[1],c=this.features,m=function(a,c,h){var d,e,b,m,l,g,p=[];d=0;for(e=a.length;d<e;d++)if(b=a[d],0<d){if(g=c(b[0]),b=h(b[1]),g!==m||b!==l)p.push([g-m,b-l]),m=g,l=b}else m=c(b[0]),l=h(b[1]),p.push([m,l]);return 0<p.length?p:null},p=function(a,
c,h){if("esriGeometryPoint"===a)return function(a){a.x=c(a.x);a.y=h(a.y);return a};if("esriGeometryPolyline"===a||"esriGeometryPolygon"===a)return function(a){var d,b,e,l,g;e=a.rings||a.paths;g=[];d=0;for(b=e.length;d<b;d++)l=e[d],(l=m(l,c,h))&&g.push(l);return 0<g.length?(a.rings?a.rings=g:a.paths=g,a):null};if("esriGeometryMultipoint"===a)return function(a){var d;d=m(a.points,c,h);return 0<d.length?(a.points=d,a):null};if("esriGeometryEnvelope"===a)return function(a){return a}}(this.geometryType,
function(a){return Math.round((a-b)/e)},function(c){return Math.round((g-c)/a)}),r,f;r=0;for(f=c.length;r<f;r++)c[r].geometry&&(p(c[r].geometry)||c[r].setGeometry(null));this.transform=d;return this}});t("extend-esri")&&k.setObject("tasks.FeatureSet",q,n);return q})},"esri/tasks/RelationshipQuery":function(){define(["dojo/_base/declare","dojo/_base/lang","dojo/_base/json","dojo/has","../kernel"],function(q,k,f,t,n){q=q(null,{declaredClass:"esri.tasks.RelationshipQuery",definitionExpression:"",relationshipId:null,
returnGeometry:!1,objectIds:null,outSpatialReference:null,outFields:null,toJson:function(){var b={definitionExpression:this.definitionExpression,relationshipId:this.relationshipId,returnGeometry:this.returnGeometry,maxAllowableOffset:this.maxAllowableOffset,geometryPrecision:this.geometryPrecision},r=this.objectIds,u=this.outFields,k=this.outSpatialReference;r&&(b.objectIds=r.join(","));u&&(b.outFields=u.join(","));k&&(b.outSR=k.wkid||f.toJson(k.toJson()));b._ts=this._ts;return b}});t("extend-esri")&&
k.setObject("tasks.RelationshipQuery",q,n);return q})},"esri/tasks/StatisticDefinition":function(){define(["dojo/_base/declare","dojo/_base/lang","dojo/has","../kernel"],function(q,k,f,t){q=q(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}}});f("extend-esri")&&
k.setObject("tasks.StatisticDefinition",q,t);return q})},"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(q,k,f,t,n,b,r,u,v,g,p,d,l,z,e,a,c,m,D,x,C){var B=
0,w=C.widgets.popup,h=C.widgets.templatePicker;k=k([x,e,a],{declaredClass:"esri.dijit._PopupRenderer",constructor:function(){this._nls=t.mixin({},w)},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(h.loading);this._contentDfd=this.template.getComponents(this.graphic).then(t.hitch(this,this._handleComponentsSuccess)).otherwise(t.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 a=this._mediaInfos,c=a.length,d=this.domNode,h=this._prevMedia,e=this._nextMedia;if(1<c){var m=0,l=0;n.forEach(a,function(a){"image"===a.type?m++:-1!==a.type.indexOf("chart")&&l++});m&&(g.set(this._imageCount,"innerHTML",m),b.query(".summary .image",
d).removeClass("hidden"));l&&(g.set(this._chartCount,"innerHTML",l),b.query(".summary .chart",d).removeClass("hidden"))}else b.query(".summary",d).addClass("hidden"),p.add(h,"hidden"),p.add(e,"hidden");a=this._mediaPtr;0===a?p.add(h,"hidden"):p.remove(h,"hidden");a===c-1?p.add(e,"hidden"):p.remove(e,"hidden");this._destroyFrame()},_displayMedia:function(){var a=this._mediaInfos[this._mediaPtr],c=a.title,d=a.caption,h=b.query(".mediaSection .hzLine",this.domNode)[0];g.set(this._mediaTitle,"innerHTML",
c);p[c?"remove":"add"](this._mediaTitle,"hidden");g.set(this._mediaCaption,"innerHTML",d);p[d?"remove":"add"](this._mediaCaption,"hidden");p[c&&d?"remove":"add"](h,"hidden");this._rid=null;if("image"===a.type)this._showImage(a);else{var e=this,c=["dojox/charting/Chart2D","dojox/charting/action2d/Tooltip"],d=a.value.theme||this.chartTheme;t.isString(d)&&(d=d.replace(/\./gi,"/"),-1===d.indexOf("/")&&(d="dojox/charting/themes/"+d));d||(d="./Rainbow");c.push(d);try{var m=this._rid=B++;q(c,function(c,
d,h){m===e._rid&&(e._rid=null,e._showChart(a.type,a.value,c,d,h))})}catch(I){console.log("PopupRenderer: error loading modules")}}},_preventNewTab:function(a){return(a=a&&t.trim(a).toLowerCase())&&(0===a.indexOf("mailto:")||0===a.indexOf("tel:"))},_showImage:function(a){p.add(this._mediaFrame,"image");var c=l.get(this._gallery,"height"),h=a.value,e;h.linkURL&&(e=d.create("a",{href:h.linkURL,target:this._preventNewTab(h.linkURL)?"":"_blank"},this._mediaFrame));h=a.refreshInterval?this._addURLParameter(h.sourceURL,
"timestamp",Date.now()):h.sourceURL;d.create("img",{className:"esriPopupMediaImage",src:h},e||this._mediaFrame);var m=b.query(".esriPopupMediaImage",this._mediaFrame)[0];this._imageLoadHandle=f.connect(m,"onload",this,function(){this._clearImageHandles();this._imageLoaded(m,c);this._initImageRefresh(a)})},_addURLParameter:function(a,c,d){var h=-1===a.indexOf("?")?"?":"\x26";return a+h+c+"\x3d"+d},_initImageRefresh:function(a){if(a.refreshInterval){var c=6E4*a.refreshInterval;this._imageRefreshHandle=
setTimeout(t.hitch(this,function(){this._destroyFrame();this._showImage(a)}),c)}},_clearImageHandles:function(){f.disconnect(this._imageLoadHandle);this._imageLoadHandle=null;clearTimeout(this._imageRefreshHandle);this._imageRefreshHandle=null},_showChart:function(a,c,h,e,b){p.remove(this._mediaFrame,"image");h=this._chart=new h(d.create("div",{"class":"chart"},this._mediaFrame),{margins:{l:4,t:4,r:4,b:4}});b&&h.setTheme(b);switch(a){case "piechart":h.addPlot("default",{type:"Pie",labels:!1});h.addSeries("Series A",
c.fields);break;case "linechart":h.addPlot("default",{type:"Markers"});h.addAxis("x",{min:0,majorTicks:!1,minorTicks:!1,majorLabels:!1,minorLabels:!1});h.addAxis("y",{includeZero:!0,vertical:!0,fixUpper:"minor"});n.forEach(c.fields,function(a,c){a.x=c+1});h.addSeries("Series A",c.fields);break;case "columnchart":h.addPlot("default",{type:"Columns",gap:3});h.addAxis("y",{includeZero:!0,vertical:!0,fixUpper:"minor"});h.addSeries("Series A",c.fields);break;case "barchart":h.addPlot("default",{type:"Bars",
gap:3}),h.addAxis("x",{includeZero:!0,fixUpper:"minor",minorLabels:!1}),h.addAxis("y",{vertical:!0,majorTicks:!1,minorTicks:!1,majorLabels:!1,minorLabels:!1}),h.addSeries("Series A",c.fields)}this._action=new e(h);h.render()},_destroyFrame:function(){this._rid=null;this._clearImageHandles();this._chart&&(this._chart.destroy(),this._chart=null);this._action&&(this._action.destroy(),this._action=null);g.set(this._mediaFrame,"innerHTML","")},_imageLoaded:function(a,c){var h=a.height;h<c&&l.set(a,"marginTop",
Math.round((c-h)/2)+"px")},_attListHandler:function(a,c){if(a===this._attachmentsDfd){this._attachmentsDfd=null;var h="";c instanceof Error||!c||!c.length||n.forEach(c,function(a){h+="\x3cli\x3e";h+="\x3ca href\x3d'"+D.addProxy(a.url)+"' target\x3d'_blank'\x3e"+(a.name||"[No name]")+"\x3c/a\x3e";h+="\x3c/li\x3e"});g.set(this._attachmentsList,"innerHTML",h||"\x3cli\x3e"+this._nls.NLS_noAttach+"\x3c/li\x3e")}},_supportedURIInfos:[{pattern:/^\s*(https?:\/\/([^\s]+))\s*$/i,label:w.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:w.NLS_openLinkInApp},{pattern:/^\s*(arcgis-collector:\/\/([^\s]+))\s*$/i,appName:"Collector",label:w.NLS_openLinkInApp},{pattern:/^\s*(arcgis-explorer:\/\/([^\s]+))\s*$/i,appName:"Explorer",label:w.NLS_openLinkInApp},{pattern:/^\s*(arcgis-navigator:\/\/([^\s]+))\s*$/i,appName:"Navigator",label:w.NLS_openLinkInApp},{pattern:/^\s*(arcgis-survey123:\/\/([^\s]+))\s*$/i,
appName:"Survey123",label:w.NLS_openLinkInApp},{pattern:/^\s*(arcgis-trek2there:\/\/([^\s]+))\s*$/i,appName:"Trek2There",label:w.NLS_openLinkInApp},{pattern:/^\s*(arcgis-workforce:\/\/([^\s]+))\s*$/i,appName:"Workforce",label:w.NLS_openLinkInApp},{pattern:/^\s*(iform:\/\/([^\s]+))\s*$/i,appName:"iForm",label:w.NLS_openLinkInApp},{pattern:/^\s*(flow:\/\/([^\s]+))\s*$/i,appName:"FlowFinity",label:w.NLS_openLinkInApp},{pattern:/^\s*(lfmobile:\/\/([^\s]+))\s*$/i,appName:"Laserfische",label:w.NLS_openLinkInApp},
{pattern:/^\s*(mspbi:\/\/([^\s]+))\s*$/i,appName:"Microsoft Power BI",label:w.NLS_openLinkInApp}],_findURIInfo:function(a){var c;n.some(this._supportedURIInfos,function(h){h.pattern.test(a)&&(c=h);return!!c});return c},_createLinkIfURI:function(a){var c=this._findURIInfo(a);if(c){var h=a.match(c.pattern);return a.replace(c.pattern,"\x3ca target\x3d'_blank' href\x3d'$1' title\x3d'$1'\x3e"+m.substitute({appName:c.appName,hierPart:h&&h[2]},c.label)+"\x3c/a\x3e")}return a},_showStatus:function(a){g.set(this._status,
"innerHTML",a);p.remove(this._status,"hidden");b.query(".mainSection",this.domNode).addClass("hidden")},_hideStatus:function(){g.set(this._status,"innerHTML","");p.add(this._status,"hidden");b.query(".mainSection",this.domNode).removeClass("hidden")},_handleComponentsSuccess:function(a){if(a){this._hideStatus();var c=this.showTitle?a.title:"",h=a.description,d=a.fields,e=a.mediaInfos,m=this.domNode,l=this._nls,r=this,f=this.template,y=this.graphic;this._prevMedia.title=l.NLS_prevMedia;this._nextMedia.title=
l.NLS_nextMedia;g.set(this._title,"innerHTML",c);c||p.add(this._title,"hidden");!a.hasDescription&&d&&(h="",n.forEach(d,function(a){h+="\x3ctr valign\x3d'top'\x3e";h+="\x3ctd class\x3d'attrName'\x3e"+z.encode(a[0])+"\x3c/td\x3e";h+="\x3ctd class\x3d'attrValue'\x3e"+this._createLinkIfURI(a[1])+"\x3c/td\x3e";h+="\x3c/tr\x3e"},this),h&&(h="\x3ctable class\x3d'attrTable' cellpadding\x3d'0px' cellspacing\x3d'0px'\x3e"+h+"\x3c/table\x3e"));g.set(this._description,"innerHTML",h);h||p.add(this._description,
"hidden");b.query("a",this._description).forEach(function(a){r._preventNewTab(a.href)?"_blank"===a.target&&g.remove(a,"target"):g.set(a,"target","_blank")});c&&h?b.query(".mainSection .hzLine",m).removeClass("hidden"):c||h?b.query(".mainSection .hzLine",m).addClass("hidden"):b.query(".mainSection",m).addClass("hidden");if(c=this._attachmentsDfd=f.getAttachments(y))c.addBoth(t.hitch(this,this._attListHandler,c)),g.set(this._attachmentsList,"innerHTML","\x3cli\x3e"+l.NLS_searching+"...\x3c/li\x3e"),
b.query(".attachmentsSection",m).removeClass("hidden");e&&e.length&&(b.query(".mediaSection",m).removeClass("hidden"),v.setSelectable(this._mediaFrame,!1),this._mediaInfos=e,this._mediaPtr=0,this._updateUI(),this._displayMedia());a.editSummary&&(g.set(this._editSummary,"innerHTML",a.editSummary),e&&e.length&&p.remove(this._mediaBreak,"hidden"),p.remove(this._editSummarySection,"hidden"));this.emit("content-update")}else this._showStatus(w.NLS_noInfo)},_handleComponentsError:function(a){a&&"cancel"===
a.dojoType||(console.log("PopupRenderer: error loading template",a),this._showStatus(w.NLS_noInfo))}});r("extend-esri")&&t.setObject("dijit._PopupRenderer",k,c);return k})},"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(q,k,f,t,n,b,r,u,v,g,p,d,l){function z(){}function e(a){return function(c,
d,e,b){return c&&"string"==typeof d&&c[d]==z?c.on(d.substring(2).toLowerCase(),r.hitch(e,b)):a.apply(f,arguments)}}q.around(f,"connect",e);b.connect&&q.around(b,"connect",e);q=t("dijit._Widget",[p,d,l],{onClick:z,onDblClick:z,onKeyDown:z,onKeyPress:z,onKeyUp:z,onMouseDown:z,onMouseMove:z,onMouseOut:z,onMouseOver:z,onMouseLeave:z,onMouseEnter:z,onMouseUp:z,constructor:function(a){this._toConnect={};for(var c in a)this[c]===z&&(this._toConnect[c.replace(/^on/,"").toLowerCase()]=a[c],delete a[c])},postCreate:function(){this.inherited(arguments);
for(var a in this._toConnect)this.on(a,this._toConnect[a]);delete this._toConnect},on:function(a,c){return this[this._onMap(a)]===z?f.connect(this.domNode,a.toLowerCase(),this,c):this.inherited(arguments)},_setFocusedAttr:function(a){this._focused=a;this._set("focused",a)},setAttribute:function(a,c){b.deprecated(this.declaredClass+"::setAttribute(attr, value) is deprecated. Use set() instead.","","2.0");this.set(a,c)},attr:function(a,c){return 2<=arguments.length||"object"===typeof a?this.set.apply(this,
arguments):this.get(a)},getDescendants:function(){b.deprecated(this.declaredClass+"::getDescendants() is deprecated. Use getChildren() instead.","","2.0");return this.containerNode?u("[widgetId]",this.containerNode).map(g.byNode):[]},_onShow:function(){this.onShow()},onShow:function(){},onHide:function(){},onClose:function(){return!0}});n("dijit-legacy-requires")&&v(0,function(){require(["dijit/_base"])});return q})},"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(q,k,f,t,n,b,r,u,v,g,p,d,l,z,e,a,c,m,D,x,C,B,w){function h(a){return function(c){u[c?"set":"remove"](this.domNode,a,c);this._set(a,c)}}l.add("dijit-legacy-requires",!z.isAsync);l.add("dojo-bidi",!1);l("dijit-legacy-requires")&&c(0,function(){q(["dijit/_base/manager"])});var y={};t=b("dijit._WidgetBase",[m,C],{id:"",_setIdAttr:"domNode",lang:"",_setLangAttr:h("lang"),dir:"",_setDirAttr:h("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:t.blankGif||q.toUrl("dojo/resources/blank.gif"),textDir:"",_introspect:function(){var a=this.constructor;if(!a._setterAttrs){var c=a.prototype,h=a._setterAttrs=[],a=a._onMap={},d;for(d in c.attributeMap)h.push(d);for(d in c)/^on/.test(d)&&(a[d.substring(2).toLowerCase()]=d),/^_set[A-Z](.*)Attr$/.test(d)&&(d=d.charAt(4).toLowerCase()+
d.substr(5,d.length-9),c.attributeMap&&d in c.attributeMap||h.push(d))}},postscript:function(a,c){this.create(a,c)},create:function(a,c){this._introspect();this.srcNodeRef=r.byId(c);this._connects=[];this._supportingWidgets=[];this.srcNodeRef&&this.srcNodeRef.id&&"string"==typeof this.srcNodeRef.id&&(this.id=this.srcNodeRef.id);a&&(this.params=a,e.mixin(this,a));this.postMixInProperties();this.id||(this.id=w.getUniqueId(this.declaredClass.replace(/\./g,"_")),this.params&&delete this.params.id);this.ownerDocument=
this.ownerDocument||(this.srcNodeRef?this.srcNodeRef.ownerDocument:document);this.ownerDocumentBody=x.body(this.ownerDocument);w.add(this);this.buildRendering();var h;if(this.domNode){this._applyAttributes();var d=this.srcNodeRef;d&&d.parentNode&&this.domNode!==d&&(d.parentNode.replaceChild(this.domNode,d),h=!0);this.domNode.setAttribute("widgetId",this.id)}this.postCreate();h&&delete this.srcNodeRef;this._created=!0},_applyAttributes:function(){var a={},c;for(c in this.params||{})a[c]=this._get(c);
k.forEach(this.constructor._setterAttrs,function(c){if(!(c in a)){var h=this._get(c);h&&this.set(c,h)}},this);for(c in a)this.set(c,a[c])},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(k.map(a,function(a){return a+"Rtl"})));v.add(this.domNode,a)}},postCreate:function(){},startup:function(){this._started||(this._started=
!0,k.forEach(this.getChildren(),function(a){a._started||a._destroyed||!e.isFunction(a.startup)||(a.startup(),a._started=!0)}))},destroyRecursive:function(a){this._beingDestroyed=!0;this.destroyDescendants(a);this.destroy(a)},destroy:function(a){function c(c){c.destroyRecursive?c.destroyRecursive(a):c.destroy&&c.destroy(a)}this._beingDestroyed=!0;this.uninitialize();k.forEach(this._connects,e.hitch(this,"disconnect"));k.forEach(this._supportingWidgets,c);this.domNode&&k.forEach(w.findWidgets(this.domNode,
this.containerNode),c);this.destroyRendering(a);w.remove(this.id);this._destroyed=!0},destroyRendering:function(a){this.bgIframe&&(this.bgIframe.destroy(a),delete this.bgIframe);this.domNode&&(a?u.remove(this.domNode,"widgetId"):g.destroy(this.domNode),delete this.domNode);this.srcNodeRef&&(a||g.destroy(this.srcNodeRef),delete this.srcNodeRef)},destroyDescendants:function(a){k.forEach(this.getChildren(),function(c){c.destroyRecursive&&c.destroyRecursive(a)})},uninitialize:function(){return!1},_setStyleAttr:function(a){var c=
this.domNode;e.isObject(a)?d.set(c,a):c.style.cssText=c.style.cssText?c.style.cssText+("; "+a):a;this._set("style",a)},_attrToDom:function(a,c,h){h=3<=arguments.length?h:this.attributeMap[a];k.forEach(e.isArray(h)?h:[h],function(h){var d=this[h.node||h||"domNode"];switch(h.type||"attribute"){case "attribute":e.isFunction(c)&&(c=e.hitch(this,c));h=h.attribute?h.attribute:/^on[A-Z][a-zA-Z]*$/.test(a)?a.toLowerCase():a;d.tagName?u.set(d,h,c):d.set(h,c);break;case "innerText":d.innerHTML="";d.appendChild(this.ownerDocument.createTextNode(c));
break;case "innerHTML":d.innerHTML=c;break;case "class":v.replace(d,c,this[a]);break;case "toggleClass":v.toggle(d,h.className||a,c)}},this)},get:function(a){var c=this._getAttrNames(a);return this[c.g]?this[c.g]():this._get(a)},set:function(a,c){if("object"===typeof a){for(var h in a)this.set(h,a[h]);return this}h=this._getAttrNames(a);var d=this[h.s];if(e.isFunction(d))var b=d.apply(this,Array.prototype.slice.call(arguments,1));else{var d=this.focusNode&&!e.isFunction(this.focusNode)?"focusNode":
"domNode",m=this[d]&&this[d].tagName,l;if((l=m)&&!(l=y[m])){l=this[d];var g={},p;for(p in l)g[p.toLowerCase()]=!0;l=y[m]=g}p=l;h=a in this.attributeMap?this.attributeMap[a]:h.s in this?this[h.s]:p&&h.l in p&&"function"!=typeof c||/^aria-|^data-|^role$/.test(a)?d:null;null!=h&&this._attrToDom(a,c,h);this._set(a,c)}return b||this},_attrPairNames:{},_getAttrNames:function(a){var c=this._attrPairNames;if(c[a])return c[a];var h=a.replace(/^[a-z]|-[a-zA-Z]/g,function(a){return a.charAt(a.length-1).toUpperCase()});
return c[a]={n:a+"Node",s:"_set"+h+"Attr",g:"_get"+h+"Attr",l:h.toLowerCase()}},_set:function(a,c){var h=this[a];this[a]=c;!this._created||h===c||h!==h&&c!==c||(this._watchCallbacks&&this._watchCallbacks(a,h,c),this.emit("attrmodified-"+a,{detail:{prevValue:h,newValue:c}}))},_get:function(a){return this[a]},emit:function(c,h,d){h=h||{};void 0===h.bubbles&&(h.bubbles=!0);void 0===h.cancelable&&(h.cancelable=!0);h.detail||(h.detail={});h.detail.widget=this;var e,b=this["on"+c];b&&(e=b.apply(this,d?
d:[h]));this._started&&!this._beingDestroyed&&a.emit(this.domNode,c.toLowerCase(),h);return e},on:function(c,h){var d=this._onMap(c);return d?f.after(this,d,h,!0):this.own(a(this.domNode,c,h))[0]},_onMap:function(a){var c=this.constructor,h=c._onMap;if(!h){var h=c._onMap={},d;for(d in c.prototype)/^on/.test(d)&&(h[d.replace(/^on/,"").toLowerCase()]=d)}return h["string"==typeof a&&a.toLowerCase()]},toString:function(){return"[Widget "+this.declaredClass+", "+(this.id||"NO ID")+"]"},getChildren:function(){return this.containerNode?
w.findWidgets(this.containerNode):[]},getParent:function(){return w.getEnclosingWidget(this.domNode.parentNode)},connect:function(a,c,h){return this.own(n.connect(a,c,this,h))[0]},disconnect:function(a){a.remove()},subscribe:function(a,c){return this.own(D.subscribe(a,e.hitch(this,c)))[0]},unsubscribe:function(a){a.remove()},isLeftToRight:function(){return this.dir?"ltr"==this.dir.toLowerCase():p.isBodyLtr(this.ownerDocument)},isFocusable:function(){return this.focus&&"none"!=d.get(this.domNode,"display")},
placeAt:function(a,c){var h=!a.tagName&&w.byId(a);!h||!h.addChild||c&&"number"!==typeof c?(h=h&&"domNode"in h?h.containerNode&&!/after|before|replace/.test(c||"")?h.containerNode:h.domNode:r.byId(a,this.ownerDocument),g.place(this.domNode,h,c),!this._started&&(this.getParent()||{})._started&&this.startup()):h.addChild(this,c);return this},defer:function(a,c){var h=setTimeout(e.hitch(this,function(){h&&(h=null,this._destroyed||e.hitch(this,a)())}),c||0);return{remove:function(){h&&(clearTimeout(h),
h=null);return null}}}});l("dojo-bidi")&&t.extend(B);return t})},"dijit/Destroyable":function(){define(["dojo/_base/array","dojo/aspect","dojo/_base/declare"],function(q,k,f){return f("dijit.Destroyable",null,{destroy:function(f){this._destroyed=!0},own:function(){var f=["destroyRecursive","destroy","remove"];q.forEach(arguments,function(n){function b(){u.remove();q.forEach(t,function(b){b.remove()})}var r,u=k.before(this,"destroy",function(b){n[r](b)}),t=[];n.then?(r="cancel",n.then(b,b)):q.forEach(f,
function(g){"function"===typeof n[g]&&(r||(r=g),t.push(k.after(n,g,b,!0)))})},this);return arguments}})})},"dijit/_OnDijitClickMixin":function(){define("dojo/on dojo/_base/array dojo/keys dojo/_base/declare dojo/has ./a11yclick".split(" "),function(q,k,f,t,n,b){q=t("dijit._OnDijitClickMixin",null,{connect:function(r,f,k){return this.inherited(arguments,[r,"ondijitclick"==f?b:f,k])}});q.a11yclick=b;return q})},"dijit/_FocusMixin":function(){define(["./focus","./_WidgetBase","dojo/_base/declare","dojo/_base/lang"],
function(q,k,f,t){t.extend(k,{focused:!1,onFocus:function(){},onBlur:function(){},_onFocus:function(){this.onFocus()},_onBlur:function(){this.onBlur()}});return f("dijit._FocusMixin",null,{_focusManager:q})})},"dijit/hccss":function(){define(["dojo/dom-class","dojo/hccss","dojo/domReady","dojo/_base/window"],function(q,k,f,t){f(function(){k("highcontrast")&&q.add(t.body(),"dijit_a11y")});return k})},"dojo/hccss":function(){define("require ./_base/config ./dom-class ./dom-style ./has ./domReady ./_base/window".split(" "),
function(q,k,f,t,n,b,r){n.add("highcontrast",function(){var b=r.doc.createElement("div");try{b.style.cssText='border: 1px solid; border-color:red green; position: absolute; height: 5px; top: -999px;background-image: url("'+(k.blankGif||q.toUrl("./resources/blank.gif"))+'");';r.body().appendChild(b);var f=t.getComputedStyle(b),g=f.backgroundImage;return f.borderTopColor==f.borderRightColor||g&&("none"==g||"url(invalid-url:)"==g)}catch(p){return console.warn("hccss: exception detecting high-contrast mode, document is likely hidden: "+
p.toString()),!1}finally{8>=n("ie")?b.outerHTML="":r.body().removeChild(b)}});b(function(){n("highcontrast")&&f.add(r.body(),"dj_a11y")});return n})},"dijit/_Templated":function(){define("./_WidgetBase ./_TemplatedMixin ./_WidgetsInTemplateMixin dojo/_base/array dojo/_base/declare dojo/_base/lang dojo/_base/kernel".split(" "),function(q,k,f,t,n,b,r){b.extend(q,{waiRole:"",waiState:""});return n("dijit._Templated",[k,f],{constructor:function(){r.deprecated(this.declaredClass+": dijit._Templated deprecated, use dijit._TemplatedMixin and if necessary dijit._WidgetsInTemplateMixin",
"","2.0")},_processNode:function(b,f){var g=this.inherited(arguments),p=f(b,"waiRole");p&&b.setAttribute("role",p);(p=f(b,"waiState"))&&t.forEach(p.split(/\s*,\s*/),function(d){-1!=d.indexOf("-")&&(d=d.split("-"),b.setAttribute("aria-"+d[0],d[1]))});return g}})})},"dijit/_TemplatedMixin":function(){define("dojo/cache dojo/_base/declare dojo/dom-construct dojo/_base/lang dojo/on dojo/sniff dojo/string ./_AttachMixin".split(" "),function(q,k,f,t,n,b,r,u){var v=k("dijit._TemplatedMixin",u,{templateString:null,
templatePath:null,_skipNodeCache:!1,searchContainerNode:!0,_stringRepl:function(b){var g=this.declaredClass,d=this;return r.substitute(b,this,function(b,p){"!"==p.charAt(0)&&(b=t.getObject(p.substr(1),!1,d));if("undefined"==typeof b)throw Error(g+" template:"+p);return null==b?"":"!"==p.charAt(0)?b:this._escapeValue(""+b)},this)},_escapeValue:function(b){return b.replace(/["'<>&]/g,function(b){return{"\x26":"\x26amp;","\x3c":"\x26lt;","\x3e":"\x26gt;",'"':"\x26quot;","'":"\x26#x27;"}[b]})},buildRendering:function(){if(!this._rendered){this.templateString||
(this.templateString=q(this.templatePath,{sanitize:!0}));var b=v.getCachedTemplate(this.templateString,this._skipNodeCache,this.ownerDocument),p;if(t.isString(b)){if(p=f.toDom(this._stringRepl(b),this.ownerDocument),1!=p.nodeType)throw Error("Invalid template: "+b);}else p=b.cloneNode(!0);this.domNode=p}this.inherited(arguments);this._rendered||this._fillContent(this.srcNodeRef);this._rendered=!0},_fillContent:function(b){var g=this.containerNode;if(b&&g)for(;b.hasChildNodes();)g.appendChild(b.firstChild)}});
v._templateCache={};v.getCachedTemplate=function(b,p,d){var l=v._templateCache,g=b,e=l[g];if(e){try{if(!e.ownerDocument||e.ownerDocument==(d||document))return e}catch(a){}f.destroy(e)}b=r.trim(b);if(p||b.match(/\$\{([^\}]+)\}/g))return l[g]=b;p=f.toDom(b,d);if(1!=p.nodeType)throw Error("Invalid template: "+b);return l[g]=p};b("ie")&&n(window,"unload",function(){var b=v._templateCache,p;for(p in b){var d=b[p];"object"==typeof d&&f.destroy(d);delete b[p]}});return v})},"dojo/cache":function(){define(["./_base/kernel",
"./text"],function(q){return q.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(q,k,f,t,n,b,r,u,v){var g=n.delegate(u,{mouseenter:b.enter,mouseleave:b.leave,keypress:f._keypress}),p;f=t("dijit._AttachMixin",null,{constructor:function(){this._attachPoints=[];this._attachEvents=[]},buildRendering:function(){this.inherited(arguments);this._attachTemplateNodes(this.domNode);
this._beforeFillContent()},_beforeFillContent:function(){},_attachTemplateNodes:function(d){for(var b=d;;)if(1==b.nodeType&&(this._processTemplateNode(b,function(d,b){return d.getAttribute(b)},this._attach)||this.searchContainerNode)&&b.firstChild)b=b.firstChild;else{if(b==d)break;for(;!b.nextSibling;)if(b=b.parentNode,b==d)return;b=b.nextSibling}},_processTemplateNode:function(d,b,g){var e=!0,a=this.attachScope||this,c=b(d,"dojoAttachPoint")||b(d,"data-dojo-attach-point");if(c)for(var m=c.split(/\s*,\s*/);c=
m.shift();)n.isArray(a[c])?a[c].push(d):a[c]=d,e="containerNode"!=c,this._attachPoints.push(c);if(b=b(d,"dojoAttachEvent")||b(d,"data-dojo-attach-event"))for(c=b.split(/\s*,\s*/),m=n.trim;b=c.shift();)if(b){var l=null;-1!=b.indexOf(":")?(l=b.split(":"),b=m(l[0]),l=m(l[1])):b=m(b);l||(l=b);this._attachEvents.push(g(d,b,n.hitch(a,l)))}return e},_attach:function(d,b,f){b=b.replace(/^on/,"").toLowerCase();b="dijitclick"==b?p||(p=q("./a11yclick")):g[b]||b;return r(d,b,f)},_detachTemplateNodes:function(){var d=
this.attachScope||this;k.forEach(this._attachPoints,function(b){delete d[b]});this._attachPoints=[];k.forEach(this._attachEvents,function(d){d.remove()});this._attachEvents=[]},destroyRendering:function(){this._detachTemplateNodes();this.inherited(arguments)}});n.extend(v,{dojoAttachEvent:"",dojoAttachPoint:""});return f})},"dijit/_WidgetsInTemplateMixin":function(){define(["dojo/_base/array","dojo/aspect","dojo/_base/declare","dojo/_base/lang","dojo/parser"],function(q,k,f,t,n){return f("dijit._WidgetsInTemplateMixin",
null,{_earlyTemplatedStartup:!1,contextRequire:null,_beforeFillContent:function(){if(/dojoType|data-dojo-type/i.test(this.domNode.innerHTML)){var b=this.domNode;this.containerNode&&!this.searchContainerNode&&(this.containerNode.stopParser=!0);n.parse(b,{noStart:!this._earlyTemplatedStartup,template:!0,inherited:{dir:this.dir,lang:this.lang,textDir:this.textDir},propsThis:this,contextRequire:this.contextRequire,scope:"dojo"}).then(t.hitch(this,function(b){this._startupWidgets=b;for(var f=0;f<b.length;f++)this._processTemplateNode(b[f],
function(b,g){return b[g]},function(b,g,p){return g in b?b.connect(b,g,p):b.on(g,p,!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(b,f,k){return f(b,"dojoType")||f(b,"data-dojo-type")?
!0:this.inherited(arguments)},startup:function(){q.forEach(this._startupWidgets,function(b){b&&!b._started&&b.startup&&b.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(q,k,f,t,n,b,r,u,v,g,p,d,l,z,e,a){function c(a){return eval("("+a+")")}function m(a){var c=
a._nameCaseMap,h=a.prototype;if(!c||c._extendCnt<x){var c=a._nameCaseMap={},d;for(d in h)"_"!==d.charAt(0)&&(c[d.toLowerCase()]=d);c._extendCnt=x}return c}function D(a,c){c||(c=q);var h=c._dojoParserCtorMap||(c._dojoParserCtorMap={}),d=a.join();if(!h[d]){for(var b=[],e=0,m=a.length;e<m;e++){var g=a[e];b[b.length]=h[g]=h[g]||f.getObject(g)||~g.indexOf("/")&&c(g)}e=b.shift();h[d]=b.length?e.createSubclass?e.createSubclass(b):e.extend.apply(e,b):e}return h[d]}new Date("X");var x=0;v.after(f,"extend",
function(){x++},!0);var C={_clearCache:function(){x++;_ctorMap={}},_functionFromScript:function(a,c){var h="",d="",b=a.getAttribute(c+"args")||a.getAttribute("args"),e=a.getAttribute("with"),b=(b||"").split(/\s*,\s*/);e&&e.length&&t.forEach(e.split(/\s*,\s*/),function(a){h+="with("+a+"){";d+="}"});return new Function(b,h+a.innerHTML+d)},instantiate:function(a,c,h){c=c||{};h=h||{};var d=(h.scope||k._scopeName)+"Type",b="data-"+(h.scope||k._scopeName)+"-",e=b+"type",m=b+"mixins",g=[];t.forEach(a,function(a){var h=
d in c?c[d]:a.getAttribute(e)||a.getAttribute(d);if(h){var b=a.getAttribute(m),h=b?[h].concat(b.split(/\s*,\s*/)):[h];g.push({node:a,types:h})}});return this._instantiate(g,c,h)},_instantiate:function(a,c,h,d){function b(a){c._started||h.noStart||t.forEach(a,function(a){"function"!==typeof a.startup||a._started||a.startup()});return a}a=t.map(a,function(a){var d=a.ctor||D(a.types,h.contextRequire);if(!d)throw Error("Unable to resolve constructor for: '"+a.types.join()+"'");return this.construct(d,
a.node,c,h,a.scripts,a.inherited)},this);return d?g(a).then(b):b(a)},construct:function(a,d,h,b,g,r){function x(a){q&&f.setObject(q,a);for(n=0;n<N.length;n++)v[N[n].advice||"after"](a,N[n].method,f.hitch(a,N[n].func),!0);for(n=0;n<U.length;n++)U[n].call(a);for(n=0;n<V.length;n++)a.watch(V[n].prop,V[n].func);for(n=0;n<W.length;n++)e(a,W[n].event,W[n].func);return a}var D=a&&a.prototype;b=b||{};var y={};b.defaults&&f.mixin(y,b.defaults);r&&f.mixin(y,r);var w;l("dom-attributes-explicit")?w=d.attributes:
l("dom-attributes-specified-flag")?w=t.filter(d.attributes,function(a){return a.specified}):(r=(/^input$|^img$/i.test(d.nodeName)?d:d.cloneNode(!1)).outerHTML.replace(/=[^\s"']+|="[^"]*"|='[^']*'/g,"").replace(/^\s*<[a-zA-Z0-9]*\s*/,"").replace(/\s*>.*$/,""),w=t.map(r.split(/\s+/),function(a){var c=a.toLowerCase();return{name:a,value:"LI"==d.nodeName&&"value"==a||"enctype"==c?d.getAttribute(c):d.getAttributeNode(c).value}}));var A=b.scope||k._scopeName;r="data-"+A+"-";var C={};"dojo"!==A&&(C[r+"props"]=
"data-dojo-props",C[r+"type"]="data-dojo-type",C[r+"mixins"]="data-dojo-mixins",C[A+"type"]="dojotype",C[r+"id"]="data-dojo-id");for(var n=0,B,A=[],q,G;B=w[n++];){var L=B.name,R=L.toLowerCase();B=B.value;switch(C[R]||R){case "data-dojo-type":case "dojotype":case "data-dojo-mixins":break;case "data-dojo-props":G=B;break;case "data-dojo-id":case "jsid":q=B;break;case "data-dojo-attach-point":case "dojoattachpoint":y.dojoAttachPoint=B;break;case "data-dojo-attach-event":case "dojoattachevent":y.dojoAttachEvent=
B;break;case "class":y["class"]=d.className;break;case "style":y.style=d.style&&d.style.cssText;break;default:if(L in D||(L=m(a)[R]||L),L in D)switch(typeof D[L]){case "string":y[L]=B;break;case "number":y[L]=B.length?Number(B):NaN;break;case "boolean":y[L]="false"!=B.toLowerCase();break;case "function":""===B||-1!=B.search(/[^\w\.]+/i)?y[L]=new Function(B):y[L]=f.getObject(B,!1)||new Function(B);A.push(L);break;default:R=D[L],y[L]=R&&"length"in R?B?B.split(/\s*,\s*/):[]:R instanceof Date?""==B?new Date(""):
"now"==B?new Date:p.fromISOString(B):R instanceof u?k.baseUrl+B:c(B)}else y[L]=B}}for(w=0;w<A.length;w++)C=A[w].toLowerCase(),d.removeAttribute(C),d[C]=null;if(G)try{G=c.call(b.propsThis,"{"+G+"}"),f.mixin(y,G)}catch(T){throw Error(T.toString()+" in data-dojo-props\x3d'"+G+"'");}f.mixin(y,h);g||(g=a&&(a._noScript||D._noScript)?[]:z("\x3e script[type^\x3d'dojo/']",d));var N=[],U=[],V=[],W=[];if(g)for(n=0;n<g.length;n++)C=g[n],d.removeChild(C),h=C.getAttribute(r+"event")||C.getAttribute("event"),b=
C.getAttribute(r+"prop"),G=C.getAttribute(r+"method"),A=C.getAttribute(r+"advice"),w=C.getAttribute("type"),C=this._functionFromScript(C,r),h?"dojo/connect"==w?N.push({method:h,func:C}):"dojo/on"==w?W.push({event:h,func:C}):y[h]=C:"dojo/aspect"==w?N.push({method:G,advice:A,func:C}):"dojo/watch"==w?V.push({prop:b,func:C}):U.push(C);a=(g=a.markupFactory||D.markupFactory)?g(y,d,a):new a(y,d);return a.then?a.then(x):x(a)},scan:function(a,c){function h(a){if(!a.inherited){a.inherited={};var c=a.node,d=
h(a.parent),c={dir:c.getAttribute("dir")||d.dir,lang:c.getAttribute("lang")||d.lang,textDir:c.getAttribute(r)||d.textDir},b;for(b in c)c[b]&&(a.inherited[b]=c[b])}return a.inherited}var b=[],e=[],m={},g=(c.scope||k._scopeName)+"Type",p="data-"+(c.scope||k._scopeName)+"-",f=p+"type",r=p+"textdir",p=p+"mixins",x=a.firstChild,w=c.inherited;if(!w){var u=function(a,c){return a.getAttribute&&a.getAttribute(c)||a.parentNode&&u(a.parentNode,c)},w={dir:u(a,"dir"),lang:u(a,"lang"),textDir:u(a,r)},C;for(C in w)w[C]||
delete w[C]}for(var w={inherited:w},n,B;;)if(x)if(1!=x.nodeType)x=x.nextSibling;else if(n&&"script"==x.nodeName.toLowerCase())(z=x.getAttribute("type"))&&/^dojo\/\w/i.test(z)&&n.push(x),x=x.nextSibling;else if(B)x=x.nextSibling;else{var z=x.getAttribute(f)||x.getAttribute(g);C=x.firstChild;if(z||C&&(3!=C.nodeType||C.nextSibling)){B=null;if(z){var v=x.getAttribute(p);n=v?[z].concat(v.split(/\s*,\s*/)):[z];try{B=D(n,c.contextRequire)}catch(U){}B||t.forEach(n,function(a){~a.indexOf("/")&&!m[a]&&(m[a]=
!0,e[e.length]=a)});v=B&&!B.prototype._noScript?[]:null;w={types:n,ctor:B,parent:w,node:x,scripts:v};w.inherited=h(w);b.push(w)}else w={node:x,scripts:n,parent:w};n=v;B=x.stopParser||B&&B.prototype.stopParser&&!c.template;x=C}else x=x.nextSibling}else{if(!w||!w.node)break;x=w.node.nextSibling;B=!1;w=w.parent;n=w.scripts}var N=new d;e.length?(l("dojo-debug-messages")&&console.warn("WARNING: Modules being Auto-Required: "+e.join(", ")),(c.contextRequire||q)(e,function(){N.resolve(t.filter(b,function(a){if(!a.ctor)try{a.ctor=
D(a.types,c.contextRequire)}catch(T){}for(var h=a.parent;h&&!h.types;)h=h.parent;var d=a.ctor&&a.ctor.prototype;a.instantiateChildren=!(d&&d.stopParser&&!c.template);a.instantiate=!h||h.instantiate&&h.instantiateChildren;return a.instantiate}))})):N.resolve(b);return N.promise},_require:function(a,b){var h=c("{"+a.innerHTML+"}"),e=[],m=[],g=new d,l=b&&b.contextRequire||q,p;for(p in h)e.push(p),m.push(h[p]);l(m,function(){for(var a=0;a<e.length;a++)f.setObject(e[a],arguments[a]);g.resolve(arguments)});
return g.promise},_scanAmd:function(a,c){var h=new d,b=h.promise;h.resolve(!0);var e=this;z("script[type\x3d'dojo/require']",a).forEach(function(a){b=b.then(function(){return e._require(a,c)});a.parentNode.removeChild(a)});return b},parse:function(a,c){!a||"string"==typeof a||"nodeType"in a||(c=a,a=c.rootNode);var h=a?b.byId(a):r.body();c=c||{};var d=c.template?{template:!0}:{},e=[],m=this,g=this._scanAmd(h,c).then(function(){return m.scan(h,c)}).then(function(a){return m._instantiate(a,d,c,!0)}).then(function(a){return e=
e.concat(a)}).otherwise(function(a){console.error("dojo/parser::parse() error",a);throw a;});f.mixin(e,g);return e}};k.parser=C;n.parseOnLoad&&a(100,C,"parse");return C})},"dojo/date/stamp":function(){define(["../_base/lang","../_base/array"],function(q,k){var f={};q.setObject("dojo.date.stamp",f);f.fromISOString=function(t,n){f._isoRegExp||(f._isoRegExp=/^(?:(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(.\d+)?)?((?:[+-](\d{2}):(\d{2}))|Z)?)?$/);var b=f._isoRegExp.exec(t),r=null;
if(b){b.shift();b[1]&&b[1]--;b[6]&&(b[6]*=1E3);n&&(n=new Date(n),k.forEach(k.map("FullYear Month Date Hours Minutes Seconds Milliseconds".split(" "),function(b){return n["get"+b]()}),function(g,p){b[p]=b[p]||g}));r=new Date(b[0]||1970,b[1]||0,b[2]||1,b[3]||0,b[4]||0,b[5]||0,b[6]||0);100>b[0]&&r.setFullYear(b[0]||1970);var u=0,v=b[7]&&b[7].charAt(0);"Z"!=v&&(u=60*(b[8]||0)+(Number(b[9])||0),"-"!=v&&(u*=-1));v&&(u-=r.getTimezoneOffset());u&&r.setTime(r.getTime()+6E4*u)}return r};f.toISOString=function(f,
k){var b=function(b){return 10>b?"0"+b:b};k=k||{};var r=[],u=k.zulu?"getUTC":"get",n="";"time"!=k.selector&&(n=f[u+"FullYear"](),n=["0000".substr((n+"").length)+n,b(f[u+"Month"]()+1),b(f[u+"Date"]())].join("-"));r.push(n);if("date"!=k.selector){n=[b(f[u+"Hours"]()),b(f[u+"Minutes"]()),b(f[u+"Seconds"]())].join(":");u=f[u+"Milliseconds"]();k.milliseconds&&(n+="."+(100>u?"0":"")+b(u));if(k.zulu)n+="Z";else if("time"!=k.selector)var u=f.getTimezoneOffset(),g=Math.abs(u),n=n+((0<u?"-":"+")+b(Math.floor(g/
60))+":"+b(g%60));r.push(n)}return r.join("T")};return f})},"esri/dijit/_EventedWidget":function(){define("dojo/_base/declare dojo/_base/lang dojo/aspect dojo/on ../Evented dijit/_WidgetBase".split(" "),function(q,k,f,t,n,b){return q([b,n],{_onMap:function(b){var f=this.constructor._onMap,r;f&&f.FINAL||(delete this.constructor._onMap,f=this.registerConnectEvents(),f.FINAL=!0);b=b.toLowerCase();f[b]?r=this[f[b].method]:(b=this._onCamelCase(b),this[b]&&(r=b));return r},on:function(b,f){var r=this._onMap(b),
g=b.replace(/\-/g,""),p="on"+g in this.domNode;return r||!p?this.inherited(arguments):this.own(t(this.domNode,g,f))[0]},emit:function(b,f,n){var g,p,d,l=b.toLowerCase(),r=this.constructor._onMap||this.registerConnectEvents();p=this[this._onMap(l)];f=f||{};f.target||(f.target=this);p&&r&&r[l]&&(this._onObj2Arr(function(){g=Array.prototype.slice.call(arguments)},r[l].argKeys)(f),d=k.mixin({},arguments),d[2]=g,d[0]=r[l].name.replace(/^on/,""));return this.inherited(d||arguments)}})})},"esri/tasks/GeometryService":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/_base/json dojo/_base/Deferred dojo/has ../kernel ../request ../deferredUtils ./Task ../geometry/Extent ../geometry/Polyline ../geometry/Polygon ../geometry/Multipoint ../geometry/jsonUtils".split(" "),
function(q,k,f,t,n,b,r,u,v,g,p,d,l,z,e){q=q(g,{declaredClass:"esri.tasks.GeometryService",_eventMap:{"areas-and-lengths-complete":["result"],"auto-complete-complete":["geometries"],"buffer-complete":["geometries"],"convex-hull-complete":["geometry"],"cut-complete":["result"],"densify-complete":["geometries"],"difference-complete":["geometries"],"distance-complete":["distance"],"generalize-complete":["geometries"],"intersect-complete":["geometries"],"label-points-complete":["geometries"],"lengths-complete":["result"],
"offset-complete":["geometries"],"project-complete":["geometries"],"relation-complete":["relations"],"reshape-complete":["geometry"],"simplify-complete":["geometries"],"trim-extend-complete":["geometries"],"union-complete":["geometry"]},constructor:function(a){a=k.hitch;this._projectHandler=a(this,this._projectHandler);this._simplifyHandler=a(this,this._simplifyHandler);this._bufferHandler=a(this,this._bufferHandler);this._areasAndLengthsHandler=a(this,this._areasAndLengthsHandler);this._lengthsHandler=
a(this,this._lengthsHandler);this._labelPointsHandler=a(this,this._labelPointsHandler);this._relationHandler=a(this,this._relationHandler);this._convexHullHandler=a(this,this._convexHullHandler);this._unionHandler=a(this,this._unionHandler);this._autoCompleteHandler=a(this,this._autoCompleteHandler);this._reshapeHandler=a(this,this._reshapeHandler);this._cutHandler=a(this,this._cutHandler);this._intersectHandler=a(this,this._intersectHandler);this._differenceHandler=a(this,this._differenceHandler);
this._trimExtendHandler=a(this,this._trimExtendHandler);this._densifyHandler=a(this,this._densifyHandler);this._generalizeHandler=a(this,this._densifyHandler);this._offsetHandler=a(this,this._offsetHandler);this._distanceHandler=a(this,this._distanceHandler);this._toGeoCoordinateHandler=a(this,this._toGeoCoordinateHandler);this._fromGeoCoordinateHandler=a(this,this._fromGeoCoordinateHandler);this.registerConnectEvents()},_encodeGeometries:function(a){var c=[],d,b=a.length;for(d=0;d<b;d++)c.push(a[d].toJson());
return{geometryType:e.getJsonType(a[0]),geometries:c}},_decodeGeometries:function(a,c,d){var b=e.getGeometryType(c);a=a.geometries;var m=[],g={spatialReference:d.toJson()},l=k.mixin;f.forEach(a,function(a,c){m[c]=new b(l(a,g))});return m},_toProjectGeometry:function(a){var c=a.spatialReference.toJson();return a instanceof p?new l({rings:[[[a.xmin,a.ymin],[a.xmin,a.ymax],[a.xmax,a.ymax],[a.xmax,a.ymin],[a.xmin,a.ymin]]],spatialReference:c}):new d({paths:[[].concat(a.points)],spatialReference:c})},
_fromProjectedGeometry:function(a,c,d){return"esriGeometryEnvelope"===c?(a=a.rings[0],new p(a[0][0],a[0][1],a[2][0],a[2][1],d)):new z({points:a.paths[0],spatialReference:d.toJson()})},project:function(a,c,d,b){var m=k.mixin({},this._url.query,{f:"json"}),g;a.geometries?(b=d,d=c,c=a.outSR,g=a.geometries[0],m=k.mixin(m,a.toJson())):(g=a[0],m=k.mixin(m,{outSR:c.wkid||t.toJson(c.toJson()),inSR:g.spatialReference.wkid||t.toJson(g.spatialReference.toJson()),geometries:t.toJson(this._encodeGeometries(a))}));
var l=e.getJsonType(g),f=this._projectHandler,h=this._errorHandler,p=new n(v._dfdCanceller);p._pendingDfd=u({url:this._url.path+"/project",content:m,callbackParamName:"callback",load:function(a,h){f(a,h,l,c,d,b,p)},error:function(a){h(a,b,p)}});return p},_projectHandler:function(a,c,d,b,e,g,l){try{var m=this._decodeGeometries(a,d,b);this._successHandler([m],"onProjectComplete",e,l)}catch(h){this._errorHandler(h,g,l)}},onProjectComplete:function(){},simplify:function(a,c,d){var b=a[0].spatialReference,
m=k.mixin({},this._url.query,{f:"json",sr:b.wkid?b.wkid:t.toJson(b.toJson()),geometries:t.toJson(this._encodeGeometries(a))}),g=e.getJsonType(a[0]),l=this._simplifyHandler,f=this._errorHandler,h=new n(v._dfdCanceller);h._pendingDfd=u({url:this._url.path+"/simplify",content:m,callbackParamName:"callback",load:function(a,e){l(a,e,g,b,c,d,h)},error:function(a){f(a,d,h)}});return h},_simplifyHandler:function(a,c,d,b,e,g,l){try{var m=this._decodeGeometries(a,d,b);this._successHandler([m],"onSimplifyComplete",
e,l)}catch(h){this._errorHandler(h,g,l)}},onSimplifyComplete:function(){},convexHull:function(a,c,d){var b=a[0].spatialReference;a=k.mixin({},this._url.query,{f:"json",sr:t.toJson(b.toJson()),geometries:t.toJson(this._encodeGeometries(a))});var e=this._convexHullHandler,m=this._errorHandler,g=new n(v._dfdCanceller);g._pendingDfd=u({url:this._url.path+"/convexHull",content:a,callbackParamName:"callback",load:function(a,h){e(a,h,b,c,d,g)},error:function(a){m(a,d,g)}});return g},_convexHullHandler:function(a,
c,d,b,g,l){try{var m=e.fromJson(a.geometry).setSpatialReference(d);this._successHandler([m],"onConvexHullComplete",b,l)}catch(w){this._errorHandler(w,g,l)}},onConvexHullComplete:function(){},union:function(a,c,d){var b=a[0].spatialReference;a=k.mixin({},this._url.query,{f:"json",sr:t.toJson(b.toJson()),geometries:t.toJson(this._encodeGeometries(a))});var e=this._unionHandler,m=this._errorHandler,g=new n(v._dfdCanceller);g._pendingDfd=u({url:this._url.path+"/union",content:a,callbackParamName:"callback",
load:function(a,h){e(a,h,b,c,d,g)},error:function(a){m(a,d,g)}});return g},_unionHandler:function(a,c,d,b,g,l){try{var m=e.fromJson(a.geometry).setSpatialReference(d);this._successHandler([m],"onUnionComplete",b,l)}catch(w){this._errorHandler(w,g,l)}},onUnionComplete:function(){},autoComplete:function(a,c,d,b){var e=a[0].spatialReference;a=k.mixin({},this._url.query,{f:"json",sr:t.toJson(e.toJson()),polygons:t.toJson(this._encodeGeometries(a).geometries),polylines:t.toJson(this._encodeGeometries(c).geometries)});
var m=this._autoCompleteHandler,g=this._errorHandler,l=new n(v._dfdCanceller);l._pendingDfd=u({url:this._url.path+"/autoComplete",content:a,callbackParamName:"callback",load:function(a,c){m(a,c,e,d,b,l)},error:function(a){g(a,b,l)}});return l},_autoCompleteHandler:function(a,c,d,b,e,g){try{var m=a.geometries;a=[];var f,h=m.length;for(f=0;f<h;f++)a[f]=new l({spatialReference:d,rings:m[f].rings});this._successHandler([a],"onAutoCompleteComplete",b,g)}catch(y){this._errorHandler(y,e,g)}},onAutoCompleteComplete:function(){},
reshape:function(a,c,d,b){var m=a.spatialReference;a=k.mixin({},this._url.query,{f:"json",sr:t.toJson(m.toJson()),target:t.toJson({geometryType:e.getJsonType(a),geometry:a.toJson()}),reshaper:t.toJson(c.toJson())});var g=this._reshapeHandler,l=this._errorHandler,f=new n(v._dfdCanceller);f._pendingDfd=u({url:this._url.path+"/reshape",content:a,callbackParamName:"callback",load:function(a,c){g(a,c,m,d,b,f)},error:function(a){l(a,b,f)}});return f},_reshapeHandler:function(a,c,d,b,g,l){try{var m=e.fromJson(a.geometry).setSpatialReference(d);
this._successHandler([m],"onReshapeComplete",b,l)}catch(w){this._errorHandler(w,g,l)}},onReshapeComplete:function(){},cut:function(a,c,d,b){var m=a[0].spatialReference,g=f.map(a,function(a){return a.toJson()});a=k.mixin({},this._url.query,{f:"json",sr:t.toJson(m.toJson()),target:t.toJson({geometryType:e.getJsonType(a[0]),geometries:g}),cutter:t.toJson(c.toJson())});var l=this._cutHandler,p=this._errorHandler,h=new n(v._dfdCanceller);h._pendingDfd=u({url:this._url.path+"/cut",content:a,callbackParamName:"callback",
load:function(a,c){l(a,c,m,d,b,h)},error:function(a){p(a,b,h)}});return h},_cutHandler:function(a,c,d,b,g,l){try{var m=a.geometries,p={};p.cutIndexes=a.cutIndexes;p.geometries=[];f.forEach(m,function(a){p.geometries.push(e.fromJson(a).setSpatialReference(d))});this._successHandler([p],"onCutComplete",b,l)}catch(h){this._errorHandler(h,g,l)}},onCutComplete:function(){},intersect:function(a,c,d,b){var m=a[0].spatialReference;a=k.mixin({},this._url.query,{f:"json",sr:t.toJson(m.toJson()),geometries:t.toJson(this._encodeGeometries(a)),
geometry:t.toJson({geometryType:e.getJsonType(c),geometry:c.toJson()})});var g=this._intersectHandler,l=this._errorHandler,f=new n(v._dfdCanceller);f._pendingDfd=u({url:this._url.path+"/intersect",content:a,callbackParamName:"callback",load:function(a,c){g(a,c,m,d,b,f)},error:function(a){l(a,b,f)}});return f},_intersectHandler:function(a,c,d,b,g,l){try{var m=[];f.forEach(a.geometries,function(a){m.push(e.fromJson(a).setSpatialReference(d))});this._successHandler([m],"onIntersectComplete",b,l)}catch(w){this._errorHandler(w,
g,l)}},onIntersectComplete:function(){},difference:function(a,c,d,b){var m=a[0].spatialReference;a=k.mixin({},this._url.query,{f:"json",sr:t.toJson(m.toJson()),geometries:t.toJson(this._encodeGeometries(a)),geometry:t.toJson({geometryType:e.getJsonType(c),geometry:c.toJson()})});var g=this._differenceHandler,l=this._errorHandler,f=new n(v._dfdCanceller);f._pendingDfd=u({url:this._url.path+"/difference",content:a,callbackParamName:"callback",load:function(a,c){g(a,c,m,d,b,f)},error:function(a){l(a,
b,f)}});return f},_differenceHandler:function(a,c,d,b,g,l){try{var m=[];f.forEach(a.geometries,function(a){m.push(e.fromJson(a).setSpatialReference(d))});this._successHandler([m],"onDifferenceComplete",b,l)}catch(w){this._errorHandler(w,g,l)}},onDifferenceComplete:function(){},buffer:function(a,c,d){var b=k.mixin({},this._url.query,{f:"json"},a.toJson()),e=a.outSpatialReference||a.geometries[0].spatialReference,m=this._bufferHandler,g=this._errorHandler,l=new n(v._dfdCanceller);l._pendingDfd=u({url:this._url.path+
"/buffer",content:b,callbackParamName:"callback",load:function(a,b){m(a,b,e,c,d,l)},error:function(a){g(a,d,l)}});return l},_bufferHandler:function(a,c,d,b,e,g){try{var m=a.geometries;a=[];var f,h=m.length;for(f=0;f<h;f++)a[f]=new l({spatialReference:d,rings:m[f].rings});this._successHandler([a],"onBufferComplete",b,g)}catch(y){this._errorHandler(y,e,g)}},onBufferComplete:function(){},areasAndLengths:function(a,c,d){a=k.mixin({},this._url.query,{f:"json"},a.toJson());var b=this._areasAndLengthsHandler,
e=this._errorHandler,m=new n(v._dfdCanceller);m._pendingDfd=u({url:this._url.path+"/areasAndLengths",content:a,callbackParamName:"callback",load:function(a,e){b(a,e,c,d,m)},error:function(a){e(a,d,m)}});return m},_areasAndLengthsHandler:function(a,c,d,b,e){try{this._successHandler([a],"onAreasAndLengthsComplete",d,e)}catch(C){this._errorHandler(C,b,e)}},onAreasAndLengthsComplete:function(){},lengths:function(a,c,d){a=k.mixin({},this._url.query,{f:"json"},a.toJson());var b=this._lengthsHandler,e=this._errorHandler,
m=new n(v._dfdCanceller);m._pendingDfd=u({url:this._url.path+"/lengths",content:a,callbackParamName:"callback",load:function(a,e){b(a,e,c,d,m)},error:function(a){e(a,d,m)}});return m},_lengthsHandler:function(a,c,d,b,e){try{this._successHandler([a],"onLengthsComplete",d,e)}catch(C){this._errorHandler(C,b,e)}},onLengthsComplete:function(){},labelPoints:function(a,c,d){var b=f.map(a,function(a){return a.toJson()}),e=a[0].spatialReference,b=k.mixin({},this._url.query,{f:"json",sr:e.wkid?e.wkid:t.toJson(e.toJson()),
polygons:t.toJson(b)}),m=this._labelPointsHandler,g=this._errorHandler,l=new n(v._dfdCanceller);l._pendingDfd=u({url:this._url.path+"/labelPoints",content:b,callbackParamName:"callback",load:function(b,g){m(b,g,a,e,c,d,l)},error:function(a){g(a,d,l)}});return l},_labelPointsHandler:function(a,c,d,b,g,l,p){try{var m=[];f.forEach(a.labelPoints,function(a){m.push(e.fromJson(a).setSpatialReference(b))});this._successHandler([m],"onLabelPointsComplete",g,p)}catch(h){this._errorHandler(h,l,p)}},onLabelPointsComplete:function(){},
relation:function(a,c,d){a=k.mixin({},this._url.query,{f:"json"},a.toJson());var b=this._relationHandler,e=this._errorHandler,m=new n(v._dfdCanceller);m._pendingDfd=u({url:this._url.path+"/relation",content:a,callbackParamName:"callback",load:function(a,e){b(a,e,c,d,m)},error:function(a){e(a,d,m)}});return m},_relationHandler:function(a,c,d,b,e){try{this._successHandler([a.relations],"onRelationComplete",d,e)}catch(C){this._errorHandler(C,b,e)}},onRelationComplete:function(){},trimExtend:function(a,
c,d){var b=k.mixin({},this._url.query,{f:"json"},a.toJson()),e=a.sr,m=this._trimExtendHandler,g=this._errorHandler,l=new n(v._dfdCanceller);l._pendingDfd=u({url:this._url.path+"/trimExtend",content:b,callbackParamName:"callback",load:function(a,b){m(a,b,e,c,d,l)},error:function(a){g(a,d,l)}});return l},_trimExtendHandler:function(a,c,b,e,g,l){try{var m=a.geometries;a=[];var f,h=m.length;for(f=0;f<h;f++)a[f]=new d({spatialReference:b,paths:m[f].paths});this._successHandler([a],"onTrimExtendComplete",
e,l)}catch(y){this._errorHandler(y,g,l)}},onTrimExtendComplete:function(){},densify:function(a,c,d){var b=k.mixin({},this._url.query,{f:"json"},a.toJson()),e=a.geometries[0].spatialReference,m=this._densifyHandler,g=this._errorHandler,l=new n(v._dfdCanceller);l._pendingDfd=u({url:this._url.path+"/densify",content:b,callbackParamName:"callback",load:function(a,b){m(a,b,e,c,d,l)},error:function(a){g(a,d,l)}});return l},_densifyHandler:function(a,c,d,b,g,l){try{var m=[];f.forEach(a.geometries,function(a){m.push(e.fromJson(a).setSpatialReference(d))});
this._successHandler([m],"onDensifyComplete",b,l)}catch(w){this._errorHandler(w,g,l)}},onDensifyComplete:function(){},generalize:function(a,c,d){var b=k.mixin({},this._url.query,{f:"json"},a.toJson()),e=a.geometries[0].spatialReference,m=this._generalizeHandler,g=this._errorHandler,l=new n(v._dfdCanceller);l._pendingDfd=u({url:this._url.path+"/generalize",content:b,callbackParamName:"callback",load:function(a,b){m(a,b,e,c,d,l)},error:function(a){g(a,d,l)}});return l},_generalizeHandler:function(a,
c,d,b,g,l){try{var m=[];f.forEach(a.geometries,function(a){m.push(e.fromJson(a).setSpatialReference(d))});this._successHandler([m],"onGeneralizeComplete",b,l)}catch(w){this._errorHandler(w,g,l)}},onGeneralizeComplete:function(){},offset:function(a,c,d){var b=k.mixin({},this._url.query,{f:"json"},a.toJson()),e=a.geometries[0].spatialReference,m=this._offsetHandler,g=this._errorHandler,l=new n(v._dfdCanceller);l._pendingDfd=u({url:this._url.path+"/offset",content:b,callbackParamName:"callback",load:function(a,
b){m(a,b,e,c,d,l)},error:function(a){g(a,d,l)}});return l},_offsetHandler:function(a,c,d,b,g,l){try{var m=[];f.forEach(a.geometries,function(a){m.push(e.fromJson(a).setSpatialReference(d))});this._successHandler([m],"onOffsetComplete",b,l)}catch(w){this._errorHandler(w,g,l)}},onOffsetComplete:function(){},distance:function(a,c,d){var b=k.mixin({},this._url.query,{f:"json"},a.toJson()),e=a.geometry1.spatialReference,m=this._distanceHandler,g=this._errorHandler,l=new n(v._dfdCanceller);l._pendingDfd=
u({url:this._url.path+"/distance",content:b,callbackParamName:"callback",load:function(a,b){m(a,b,e,c,d,l)},error:function(a){g(a,d,l)}});return l},_distanceHandler:function(a,c,d,b,e,g){try{a=a&&a.distance,this._successHandler([a],"onDistanceComplete",b,g)}catch(B){this._errorHandler(B,e,g)}},onDistanceComplete:function(){},toGeoCoordinateString:function(a,c,d){var b={};k.isObject(a.sr)?b.sr=a.sr.wkid||t.toJson(a.sr.toJson()):b.sr=a.sr;b.coordinates=t.toJson(a.coordinates);b.conversionType=a.conversionType||
"MGRS";b.conversionMode=a.conversionMode;b.numOfDigits=a.numOfDigits;b.rounding=a.rounding;b.addSpaces=a.addSpaces;a=k.mixin({},this._url.query,{f:"json"},b);var e=this._toGeoCoordinateHandler,m=this._errorHandler,g=new n(v._dfdCanceller);g._pendingDfd=u({url:this._url.path+"/toGeoCoordinateString",content:a,callbackParamName:"callback",load:function(a,b){e(a,b,c,d,g)},error:function(a){m(a,d,g)}});return g},_toGeoCoordinateHandler:function(a,c,b,d,e){try{this._successHandler([a.strings],"onToGeoCoordinateStringComplete",
b,e)}catch(C){this._errorHandler(C,d,e)}},onToGeoCoordinateStringComplete:function(){},fromGeoCoordinateString:function(a,c,b){var d={};k.isObject(a.sr)?d.sr=a.sr.wkid||t.toJson(a.sr.toJson()):d.sr=a.sr;d.strings=t.toJson(a.strings);d.conversionType=a.conversionType||"MGRS";d.conversionMode=a.conversionMode;a=k.mixin({},this._url.query,{f:"json"},d);var e=this._fromGeoCoordinateHandler,g=this._errorHandler,m=new n(v._dfdCanceller);m._pendingDfd=u({url:this._url.path+"/fromGeoCoordinateString",content:a,
callbackParamName:"callback",load:function(a,d){e(a,d,c,b,m)},error:function(a){g(a,b,m)}});return m},_fromGeoCoordinateHandler:function(a,c,b,d,e){try{this._successHandler([a.coordinates],"onToGeoCoordinateStringComplete",b,e)}catch(C){this._errorHandler(C,d,e)}},onFromGeoCoordinateStringComplete:function(){}});k.mixin(q,{UNIT_METER:9001,UNIT_GERMAN_METER:9031,UNIT_FOOT:9002,UNIT_SURVEY_FOOT:9003,UNIT_CLARKE_FOOT:9005,UNIT_FATHOM:9014,UNIT_NAUTICAL_MILE:9030,UNIT_SURVEY_CHAIN:9033,UNIT_SURVEY_LINK:9034,
UNIT_SURVEY_MILE:9035,UNIT_KILOMETER:9036,UNIT_CLARKE_YARD:9037,UNIT_CLARKE_CHAIN:9038,UNIT_CLARKE_LINK:9039,UNIT_SEARS_YARD:9040,UNIT_SEARS_FOOT:9041,UNIT_SEARS_CHAIN:9042,UNIT_SEARS_LINK:9043,UNIT_BENOIT_1895A_YARD:9050,UNIT_BENOIT_1895A_FOOT:9051,UNIT_BENOIT_1895A_CHAIN:9052,UNIT_BENOIT_1895A_LINK:9053,UNIT_BENOIT_1895B_YARD:9060,UNIT_BENOIT_1895B_FOOT:9061,UNIT_BENOIT_1895B_CHAIN:9062,UNIT_BENOIT_1895B_LINK:9063,UNIT_INDIAN_FOOT:9080,UNIT_INDIAN_1937_FOOT:9081,UNIT_INDIAN_1962_FOOT:9082,UNIT_INDIAN_1975_FOOT:9083,
UNIT_INDIAN_YARD:9084,UNIT_INDIAN_1937_YARD:9085,UNIT_INDIAN_1962_YARD:9086,UNIT_INDIAN_1975_YARD:9087,UNIT_FOOT_1865:9070,UNIT_RADIAN:9101,UNIT_DEGREE:9102,UNIT_ARCMINUTE:9103,UNIT_ARCSECOND:9104,UNIT_GRAD:9105,UNIT_GON:9106,UNIT_MICRORADIAN:9109,UNIT_ARCMINUTE_CENTESIMAL:9112,UNIT_ARCSECOND_CENTESIMAL:9113,UNIT_MIL6400:9114,UNIT_BRITISH_1936_FOOT:9095,UNIT_GOLDCOAST_FOOT:9094,UNIT_INTERNATIONAL_CHAIN:109003,UNIT_INTERNATIONAL_LINK:109004,UNIT_INTERNATIONAL_YARD:109001,UNIT_STATUTE_MILE:9093,UNIT_SURVEY_YARD:109002,
UNIT_50KILOMETER_LENGTH:109030,UNIT_150KILOMETER_LENGTH:109031,UNIT_DECIMETER:109005,UNIT_CENTIMETER:109006,UNIT_MILLIMETER:109007,UNIT_INTERNATIONAL_INCH:109008,UNIT_US_SURVEY_INCH:109009,UNIT_INTERNATIONAL_ROD:109010,UNIT_US_SURVEY_ROD:109011,UNIT_US_NAUTICAL_MILE:109012,UNIT_UK_NAUTICAL_MILE:109013,UNIT_SQUARE_INCHES:"esriSquareInches",UNIT_SQUARE_FEET:"esriSquareFeet",UNIT_SQUARE_YARDS:"esriSquareYards",UNIT_ACRES:"esriAcres",UNIT_SQUARE_MILES:"esriSquareMiles",UNIT_SQUARE_MILLIMETERS:"esriSquareMillimeters",
UNIT_SQUARE_CENTIMETERS:"esriSquareCentimeters",UNIT_SQUARE_DECIMETERS:"esriSquareDecimeters",UNIT_SQUARE_METERS:"esriSquareMeters",UNIT_ARES:"esriAres",UNIT_HECTARES:"esriHectares",UNIT_SQUARE_KILOMETERS:"esriSquareKilometers"});b("extend-esri")&&k.setObject("tasks.GeometryService",q,r);return q})},"esri/layers/FeatureLayer":function(){define("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(q,k,f,t,n,b,r,u,v,g,p,d,l,z,e,a,c,m,D,x,C,B,w,h,y,A,G,H,K,P,I,aa,S,ha,ba,la,ca,L,R,N,U,V,W,T,ma,O,da,ia,oa,na,ea,ja,pa){var ka=D.defaults,E=f(R,{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,c){this._preventInit||this._initFeatureLayer(a,c)},_initFeatureLayer:function(a,b){this.i18n=pa;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 d=c.isDefined(b.mode)?b.mode:
E.MODE_ONDEMAND;this._isStream&&(d=E.MODE_STREAM);this.mode=d;switch(d){case E.MODE_SNAPSHOT:this.currentMode=E.MODE_SNAPSHOT;this._mode=new O(this);break;case E.MODE_ONDEMAND:case E.MODE_AUTO:this.currentMode=E.MODE_ONDEMAND;this._tileWidth=b.tileWidth||512;this._tileHeight=b.tileHeight||512;this._mode=new da(this);this.latticeTiling=b.latticeTiling;break;case E.MODE_SELECTION:this.currentMode=E.MODE_SELECTION;this._mode=new ia(this);this._isSelOnly=!0;break;case E.MODE_STREAM:this.currentMode=E.MODE_STREAM,
this._mode=new oa(this),this._isStream=!0}this._initLayer=n.hitch(this,this._initLayer);this._selectHandler=n.hitch(this,this._selectHandler);this._editable=!1;if(n.isObject(a)&&a.layerDefinition)return this._collection=!0,this.mode=this._isStream?E.MODE_STREAM:E.MODE_SNAPSHOT,this._isStream||this._outFields||(this._outFields=["*"]),this._initLayer(a),this;this._task=new I(this.url,{source:this.source,gdbVersion:this.gdbVersion});d=this._url.path;this._fserver=!1;-1!==d.search(/\/FeatureServer\//i)&&
(this._fserver=!0);this.mode===E.MODE_AUTO&&this.reHostedFS.test(this.url)&&this._queryLimit();var h=b.resourceInfo;h?this._initLayer(h):(this.source&&(h={source:this.source.toJson()},this._url.query=n.mixin(this._url.query,{layer:r.toJson(h)})),this.gdbVersion&&(this._url.query=n.mixin(this._url.query,{gdbVersion:this.gdbVersion})),m({url:d,content:n.mixin({f:"json"},this._url.query),callbackParamName:"callback",load:this._initLayer,error:this._errorHandler}));this.registerConnectEvents()},_initLayer:function(a,
d){if(a||d){this._json=a;this._findCredential();if(this.credential&&this.credential.ssl||a&&a._ssl)this._useSSL(),this._task._useSSL();this.version=a.currentVersion;this.version||(this.version="capabilities"in a||"drawingInfo"in a||"hasAttachments"in a||"htmlPopupType"in a||"relationships"in a||"timeInfo"in a||"typeIdField"in a||"types"in a?10:9.3);this._collection&&(this._isStream||(this.currentMode=E.MODE_SNAPSHOT,this._mode=new O(this)),this._featureSet=a.featureSet,this._nextId=a.nextObjectId,
a=a.layerDefinition);this.geometryType=a.geometryType;"string"!==typeof this.multipatchOption&&"esriGeometryMultiPatch"===this.geometryType&&(this.multipatchOption="xyFootprint");if(a.hasOwnProperty("capabilities")){var e=this.capabilities=a.capabilities;e&&-1!==e.toLowerCase().indexOf("editing")?this._editable=!0:this._editable=!1}else this._collection||(this._editable=this._fserver);c.isDefined(this._optEditable)?(this._editable=this._optEditable,delete this._optEditable):"esriGeometryMultiPatch"===
this.geometryType&&(this._editable=!1);this._json=r.toJson(this._json);this.isEditable()?this._setMaxOffset(null):this.mode===E.MODE_SNAPSHOT||"esriGeometryPolyline"!==this.geometryType&&"esriGeometryPolygon"!==this.geometryType&&!this.hasXYFootprint()||(this._autoGeneralize=c.isDefined(this._optAutoGen)?this._optAutoGen:this.mode===E.MODE_ONDEMAND||this.mode===E.MODE_AUTO,delete this._optAutoGen);var e=a.effectiveMinScale||a.minScale,F=a.effectiveMaxScale||a.maxScale;!this._hasMin&&e&&this.setMinScale(e);
!this._hasMax&&F&&this.setMaxScale(F);this.layerId=a.id;this.name=a.name;this.description=a.description;this.copyright=a.copyrightText;this.type=a.type;this.displayField=a.displayField;this.defaultDefinitionExpression=a.definitionExpression||(a.isView?a.viewDefinitionQuery:a.definitionQuery);this.fullExtent=new ba(a.extent);this.initialExtent=new ba(this.fullExtent.toJson());this.fullExtent.spatialReference&&(this.spatialReference=new B(this.fullExtent.spatialReference.toJson()));this.defaultVisibility=
a.defaultVisibility;if("esriGeometryPoint"===this.geometryType||"esriGeometryMultipoint"===this.geometryType)this.latticeTiling=!1;this.hasM=a.hasM||!1;this.hasZ=a.hasZ||!1;this.indexedFields=a.indexedFields;this.maxRecordCount=a.maxRecordCount;this.canModifyLayer=a.canModifyLayer;this.supportsStatistics=a.supportsStatistics;this.supportsAdvancedQueries=this._collection?!1:a.supportsAdvancedQueries;this.supportsCalculate=a.supportsCalculate;this.supportsAttachmentsByUploadId=a.supportsAttachmentsByUploadId;
this.supportsCoordinatesQuantization=a.supportsCoordinatesQuantization;this.quantize=this.quantize&&this.supportsCoordinatesQuantization;this.hasLabels=a.hasLabels;this.canScaleSymbols=a.canScaleSymbols;this.supportsRollbackOnFailureParameter=this.supportsRollbackOnFailure=a.supportsRollbackOnFailure;this.syncCanReturnChanges=a.syncCanReturnChanges;this.isDataVersioned=a.isDataVersioned;this.editFieldsInfo=a.editFieldsInfo;this.ownershipBasedAccessControlForFeatures=a.ownershipBasedAccessControlForFeatures;
this.editFieldsInfo&&this.ownershipBasedAccessControlForFeatures&&(this.creatorField=this.editFieldsInfo.creatorField);this.relationships=a.relationships;this.allowGeometryUpdates=c.isDefined(a.allowGeometryUpdates)?a.allowGeometryUpdates:!0;this.allowUpdateWithoutMValues=!!a.allowUpdateWithoutMValues;this.enableZDefaults=!!a.enableZDefaults;this.zDefault=c.isDefined(a.zDefault)?a.zDefault:null;this.advancedQueryCapabilities=a.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=a.useStandardizedQueries;this.tileMaxRecordCount=a.tileMaxRecordCount;this.standardMaxRecordCount=a.standardMaxRecordCount;
this._setMaxOffset(this._maxOffset,!0);this._isTable="Table"===this.type;for(var m=this.fields=[],F=a.fields,e=0;e<F.length;e++)m.push(new N(F[e]));if(!this.objectIdField){this.objectIdField=a.objectIdField;if(!this.objectIdField)for(F=a.fields,e=0;e<F.length;e++)if(m=F[e],"esriFieldTypeOID"===m.type){this.objectIdField=m.name;break}this.objectIdField||this._isStream||console.debug("esri.layers.FeatureLayer: "+c.substitute({url:this.url},"objectIdField is not set [url: ${url}]"))}if(!c.isDefined(this._nextId)){F=
this.objectIdField;m=-1;if(this._collection&&F)for(var l=(e=this._featureSet)&&e.features,f=l?l.length:0,Q,e=0;e<f;e++)Q=(Q=l[e].attributes)&&Q[F],Q>m&&(m=Q);this._nextId=m+1}this.globalIdField=a.globalIdField;if(e=this.typeIdField=a.typeIdField)if(e=!this._getField(e)&&this._getField(e,!0))this.typeIdField=e.name;this.visibilityField=a.visibilityField;if(F=a.defaultSymbol)this.defaultSymbol=A.fromJson(F);var p=this.types=[],k=a.types,u,z,m=(e=this.editFieldsInfo)&&e.creatorField,l=e&&e.editorField;
Q=m||l;f=[];if(k)for(e=0;e<k.length;e++)u=new V(k[e]),z=u.templates,Q&&z&&z.length&&(f=f.concat(z)),p.push(u);k=a.templates;u=this.templates=[];if(k)for(e=0;e<k.length;e++)p=new W(k[e]),Q&&f.push(p),u.push(p);for(e=0;e<f.length;e++)if(Q=n.getObject("prototype.attributes",!1,f[e]))m&&delete Q[m],l&&delete Q[l];if(e=a.timeInfo)this.timeInfo=new U(e),this._startTimeField=e.startTimeField,this._endTimeField=e.endTimeField,this._startTimeField&&this._endTimeField&&(this._twoTimeFields=!0),this._trackIdField?
e.trackIdField=this._trackIdField:this._trackIdField=e.trackIdField;this.hasAttachments=!this._collection&&a.hasAttachments?!0:!1;this.htmlPopupType=a.htmlPopupType;var e=a.drawingInfo,x;(m=e&&e.labelingInfo)&&!this.labelingInfo&&(this.labelingInfo=b.map(m,function(a){return new ma(a)}),this._fixLabelExpr());if(!this.renderer)if(e&&e.renderer){if(x=e.renderer,this.setRenderer(K.fromJson(x)),"classBreaks"===x.type&&this.renderer.setMaxInclusive(!0),!this._collection){var t=x.type,F=[];x=this.renderer;
switch(t){case "simple":F.push(x.symbol);break;case "uniqueValue":case "classBreaks":F.push(x.defaultSymbol),F=F.concat(b.map(x.infos,function(a){return a.symbol}))}var F=b.filter(F,c.isDefined),I=this._url.path+"/images/",q=this._getToken();b.forEach(F,function(a){var c=a.url;c&&(-1===c.search(/https?\:/)&&-1===c.indexOf("data:")&&(a.url=I+c),q&&-1!==a.url.search(/https?\:/)&&(a.url+="?token\x3d"+q))})}}else if(F)k=this.types,0<k.length?(x=new H(this.defaultSymbol,this.typeIdField),b.forEach(k,function(a){x.addValue(a.id,
a.symbol)})):x=new G(this.defaultSymbol),this.setRenderer(x);else if(!this._isTable){switch(this.geometryType){case "esriGeometryPoint":case "esriGeometryMultipoint":t=new w;break;case "esriGeometryPolyline":t=new h;break;case "esriGeometryPolygon":t=new y;break;default:this.hasXYFootprint()&&(t=new y)}this.setRenderer(t?new G(t):null)}t=e&&e.transparency||0;!this.hasOwnProperty("opacity")&&0<t&&(this.opacity=1-t/100);(g("ie")||7<=g("trident")||g("safari"))&&this.isEditable()&&10.02>this.version&&
(this._ts=!0);this.statistics=a.statistics;this._fixRendererFields();this._updateRequiredFieldsFromLabelingInfo();this._checkFields();this._updateCaps();var P=function(){null==this._maxOffset||this._isFractionalOffsetAllowed()||this._setMaxOffset(this._maxOffset);this.loaded=!0;this.setFeatureReduction(this.getFeatureReduction());this.currentMode!==E.MODE_SNAPSHOT&&(this.queryPagination=!1);this.onLoad(this);var a=this._loadCallback;a&&(delete this._loadCallback,a(this))},t=[];this._collection?(e=
this._featureSet,this._featureSet=null,this._mode._drawFeatures(new S(e)),this._fcAdded=!0):(t.push(this._forceIdentity()),this._limitPromise&&t.push(this._limitPromise));t.push(this._evalGeometryOperations());t.length?C(t).then(n.hitch(this,function(){P.call(this)})):P.call(this)}},setShowLabels:function(a){this.showLabels=a;this.onShowLabelsChange()},onShowLabelsChange:function(){},onRendererChange:function(a){this.inherited(arguments);var d=this._map;this._ager=!!(a&&a.observationAger&&a.observationRenderer);
a&&"colors"in a&&"blurRadius"in a&&"maxPixelIntensity"in a?"esriGeometryPoint"==this.geometryType&&!this._heatmapManager&&d&&(this._heatmapManager=new ea(this),this._heatmapManager.initialize(d)):this.renderer&&this.renderer.getRendererInfo?b.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&&d&&(a&&(a.latestObservationRenderer||a.trackRenderer)?this._trackManager||
(this._trackManager=new na(this),this._trackManager.initialize(d),this._childLayer=this._trackManager.container,this._mode._applyTimeFilter()):this._trackManager&&!this._isStream&&(this._trackManager.destroy(),this._trackManager=null));if(a){var e=[],d=b.filter([a,a.observationRenderer,a.latestObservationRenderer,a.trackRenderer],c.isDefined),h=function(a){return null!=a&&"function"!=typeof a&&a};b.forEach(d,function(a){var c=h(a.attributeField),b=h(a.attributeField2);a=h(a.attributeField3);!1!==
c&&e.push(c);!1!==b&&e.push(b);!1!==a&&e.push(a)});this._requiredFields=e}else this._requiredFields=[];this.loaded&&(this._fixRendererFields(),this._checkFields(this._requiredFields),this._collection&&(this._typesDirty=!0))},setFeatureReduction:function(a){a&&(a=n.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=n.mixin({},a),c=this._clusterManager;if(c=c&&c.aggregationInfo)a.clusterRadius=c.clusterRadius,a.infoTemplate=c.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(a){var c,
d=this._clusterManager?this._clusterManager.getClusterFields():null;a=a?a.toLowerCase():"";b.some(d,function(b){a===b.name.toLowerCase()&&(c=b);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 c=this._map.spatialReference;return this._isFeatureReductionSupported(a)&&this._isReductionCompatibleRenderer(this.renderer)&&(c.isWebMercator()||4326===c.wkid)},_createClusterManager:function(a){a=new ja({layer:this,aggregationInfo:a});this._clusterHandles=[a.on("renderer-change",n.hitch(this,function(){this.onFeatureReductionRendererChange()}))];a.initialize(this._map);return a},_updateClusterManager:function(a){var c=this._clusterManager;
c&&c.setAggregationInfo(a)},_destroyClusterManager:function(a){b.forEach(this._clusterHandles,function(a){a.remove()});this._clusterHandles=null;this._clusterManager&&(this._clusterManager.destroy(a),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 c=
this._getRenderer();this._ager=!!(c&&c.observationAger&&c.observationRenderer);this._trackManager&&this._trackManager.container&&this._trackManager.container.setRenderer(c&&c.trackRenderer);a&&this._evalFeatureReduction()},_setMap:function(a){var c=this.inherited(arguments),b=this._mode,d=this;b&&a.loaded&&b.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 c},_unsetMap:function(a){var c=this._mode;c&&(c.suspend(),c.destroy());this._destroyClusterManager(!1);this._trackManager&&(this._trackManager.destroy(),this._trackManager=null);t.disconnect(this._zoomConnect);t.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 b.filter(this._getOutFields(),function(a){return"*"===a||!!this._getField(a)},this)},getField:function(a){return this._getField(a,!0)},isOutField:function(a){a=this.getField(a);if(!a)return!1;var c=this.getOutFields();return-1<b.indexOf(c,"*")||-1<b.indexOf(c,a.name)},getFieldLabel:function(a){var c=this.infoTemplate,c=c&&c.getFieldInfo&&c.getFieldInfo(a);a=n.isFunction(a)?null:this.getField(a);var b=c||a,d="";
b&&(d=c&&c.label||a&&a.alias||b.name||b.fieldName);return d},getDomain:function(a,c){var d,e,h=c&&c.feature,m=h&&this.typeIdField&&h.attributes&&h.attributes[this.typeIdField];null!=m&&b.some(this.types,function(c){return c.id==m?((d=c.domains&&c.domains[a])&&"inherited"===d.type&&(d=this._getLayerDomain(a),e=!0),!0):!1},this);e||d||(d=this._getLayerDomain(a));return d},_getLayerDomain:function(a){var c;b.some(this.fields,function(b){b.name===a&&(c=b.domain);return!!c});return c},getType:function(a){var c,
d=a&&this.typeIdField&&a.attributes&&a.attributes[this.typeIdField];b.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 c=this._editable;this._editable=a;this._updateCaps();if(c!==a)this.onCapabilitiesChange();return this},getEditCapabilities:function(a){var c={canCreate:!1,
canUpdate:!1,canDelete:!1,canUpdateGeometry:!1};if(!this.loaded||!this.isEditable())return c;var d=a&&a.feature;a=a&&a.userId||this.getUserId();var e=b.map(this.capabilities?this.capabilities.toLowerCase().split(","):[],n.trim),h=(c=-1<b.indexOf(e,"editing"))&&-1<b.indexOf(e,"create"),m=c&&-1<b.indexOf(e,"update"),e=c&&-1<b.indexOf(e,"delete"),g=this.ownershipBasedAccessControlForFeatures,l=this.editFieldsInfo,F=l&&l.creatorField,l=l&&l.realm,d=(d=d&&d.attributes)&&F?d[F]:void 0,f=!!this.userIsAdmin,
F=!g||f||!(!g.allowOthersToUpdate&&!g.allowUpdateToOthers),p=!g||f||!(!g.allowOthersToDelete&&!g.allowDeleteToOthers),r=!g||f||!g.hasOwnProperty("allowAnonymousToUpdate")||g.allowAnonymousToUpdate,g=!g||f||!g.hasOwnProperty("allowAnonymousToDelete")||g.allowAnonymousToDelete;a&&l&&(a=a+"@"+l);if(f||c&&!(h||m||e))h=m=e=!0;c={canCreate:h,canUpdate:m,canDelete:e,canUpdateGeometry:f||this.allowGeometryUpdates};a||(c.canUpdate=c.canUpdate&&r,c.canDelete=c.canDelete&&g);null===d?(c.canUpdate=c.canUpdate&&
F,c.canDelete=c.canDelete&&p):""!==d&&d&&a.toLowerCase()!==d.toLowerCase()&&(c.canUpdate=c.canUpdate&&F,c.canDelete=c.canDelete&&p);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,d){d=c.isDefined(d)?d:(new Date).getTime();var e="";d=this.getEditInfo(a,b,d);(b=b&&b.callback||this.editSummaryCallback)&&
(d=b(a,d)||"");if(n.isString(d))e=d;else{if(d){a=d.action;b=d.userId;var h=d.timeValue,m=0;a&&m++;b&&m++;c.isDefined(h)&&m++;1<m&&(e=("edit"===a?"edit":"create")+(b?"User":"")+(c.isDefined(h)?d.displayPattern:""))}e=e&&c.substitute(d,this.i18n.layers.FeatureLayer[e])}return e},getEditInfo:function(a,b,d){if(this.loaded){d=c.isDefined(d)?d:(new Date).getTime();b=b&&b.action||"last";var e=this.editFieldsInfo,h=e&&e.creatorField,m=e&&e.creationDateField,g=e&&e.editorField,e=e&&e.editDateField,g=(a=a&&
a.attributes)&&g?a[g]:void 0,e=a&&e?a[e]:null,h=this._getEditData(a&&h?a[h]:void 0,a&&m?a[m]:null,d);d=this._getEditData(g,e,d);var l;switch(b){case "creation":l=h;break;case "edit":l=d;break;case "last":l=d||h}l&&(l.action=l===d?"edit":"creation");return l}},_getEditData:function(a,b,d){var e,h,m;c.isDefined(b)&&(h=d-b,m=0>h?"Full":6E4>h?"Seconds":12E4>h?"Minute":36E5>h?"Minutes":72E5>h?"Hour":864E5>h?"Hours":6048E5>h?"WeekDay":"Full");if(void 0!==a||m)e=e||{},e.userId=a,m&&(a=v.format,d=new Date(b),
e.minutes=Math.floor(h/6E4),e.hours=Math.floor(h/36E5),e.weekDay=a(d,{datePattern:"EEEE",selector:"date"}),e.formattedDate=a(d,{selector:"date"}),e.formattedTime=a(d,{selector:"time"}),e.displayPattern=m,e.timeValue=b);return e},isEditable:function(){return!(!this._editable&&!this.userIsAdmin)},isQueryable:function(){var a=b.map(this.capabilities?this.capabilities.toLowerCase().split(","):[],n.trim);return this._isStream||this.userIsAdmin||this._collection||-1!==b.indexOf(a,"query")||-1!==b.indexOf(a,
"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,c){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()&&c||(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(a){a=(a=a&&a.split("-"))&&a[0]&&a[0].toLowerCase();return-1!==
b.indexOf(this._langsWithDot,a)},_langsWithDot:"ar en et fr he ja ko th vi zh".split(" "),setAutoGeneralize:function(a){this.loaded?this.isEditable()||this.mode===E.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=n.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,c){this._timeOffset=a;this._timeOffsetUnits=c;var b=this._mode;b&&b.propertyChangeHandler(0);return this},setUseMapTime:function(a){this.useMapTime=a;this._toggleTime(!this.suspended);
(a=this._mode)&&a.propertyChangeHandler(0)},selectFeatures:function(a,c,b,d){c=c||E.SELECTION_NEW;this._hasPartialSelectedFeatures=!1;a=this._getShallowClone(a);var e=this._map,h,m=this,g=x._fixDfd(new u(x._dfdCanceller));a.outFields=this.getOutFields();a.returnGeometry=!0;a.multipatchOption=this.multipatchOption;e&&(a.outSpatialReference=new B(e.spatialReference.toJson()));if(!this._applyQueryFilters(a,!0))return h={features:[]},this._selectHandler(h,c,b,d,g),g;if(e=this._canDoClientSideQuery(a))g._pendingDfd=
z(this._doQuery(a,e)),g._pendingDfd.then(function(a){h={features:a};m._selectHandler(h,c,b,d,g)});else{if(this._collection)return this._resolve([Error("FeatureLayer::selectFeatures - "+this.invalidParams)],null,d,g,!0),g;if(this.loaded&&!this.isQueryable())return this._resolve([Error("Layer does not support query capability.")],null,d,g,!0),g;var l=this;this._ts&&(a._ts=(new Date).getTime());(g._pendingDfd=this._task.execute(a)).addCallbacks(function(a){l._selectHandler(a,c,b,d,g)},function(a){l._hasPartialSelectedFeatures=
!0;l._resolve([a],null,d,g,!0)})}return g},getSelectedFeatures:function(){var a=this._selectedFeatures,c=[],b;for(b in a)a.hasOwnProperty(b)&&c.push(a[b]);return c},clearSelection:function(a){var c=this._selectedFeatures,b=this._mode,d;for(d in c)c.hasOwnProperty(d)&&(this._unSelectFeatureIIf(d,b),b._removeFeatureIIf(d));this._selectedFeatures={};this._isSelOnly&&b._applyTimeFilter(!0);if(!a)this.onSelectionClear();return this},setSelectionSymbol:function(a){if(this._selectionSymbol=a){var c=this._selectedFeatures,
b;for(b in c)c.hasOwnProperty(b)&&c[b].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 a=/\[([^\[\]]+)\]/ig,c,d=this,e=function(a,c){var b=d._getField(c,!0);return"["+(b&&b.name||c)+"]"};b.forEach(this.labelingInfo,function(b){if(c=b.labelExpression)b.labelExpression=
c.replace(a,e)})},_updateRequiredFieldsFromLabelingInfo:function(){var a=[];b.forEach(this.labelingInfo,function(c){var d=c.labelExpressionInfo;if(c.labelExpression){var e=/[\[\]]/ig;c=c.labelExpression.match(/\[[^\[\]]+\]/ig);(c=b.map(c,function(a){return a.replace(e,"")}))&&(a=a.concat(c))}if(d){if(d.value){var h=/[\{\}]/ig;c=d.value.match(/\{[^\{\}]+\}/ig);(c=b.map(c,function(a){return a.replace(h,"")}))&&(a=a.concat(c))}d.expression&&(a=a.concat(P.extractFieldNames(d.expression)))}});a=b.map(a,
function(a){var c=this.getField(a);return c?c.name:a},this);this._requiredFields&&(this._requiredFields=this._requiredFields.concat(a))},__msigns:[{n:"applyEdits",c:5,a:[{i:0},{i:1}],e:4,f:1}],applyEdits:function(a,c,d,e,h,g){var l=g.assembly,f=g.dfd;this._applyNormalized(a,l&&l[0]);this._applyNormalized(c,l&&l[1]);this.onBeforeApplyEdits(a,c,d);var p={},F=this.objectIdField,l={f:"json"},r=!1;if(this._collection)g={},g.addResults=a?b.map(a,function(){r=!0;return{objectId:this._nextId++,success:!0}},
this):null,g.updateResults=c?b.map(c,function(a){r=!0;var c=a.attributes[F];p[c]=a;return{objectId:c,success:!0}},this):null,g.deleteResults=d?b.map(d,function(a){r=!0;return{objectId:a.attributes[F],success:!0}},this):null,r?this._editHandler(g,a,p,e,h,f):this._resolve([g.addResults,g.updateResults,g.deleteResults],null,e,f);else{a&&0<a.length&&(l.adds=this._convertFeaturesToJson(a,0,1),r=!0);if(c&&0<c.length){for(g=0;g<c.length;g++){var k=c[g];p[k.attributes[F]]=k}l.updates=this._convertFeaturesToJson(c,
0,0,1);r=!0}if(d&&0<d.length){c=[];for(g=0;g<d.length;g++)c.push(d[g].attributes[F]);l.deletes=c.join(",");r=!0}if(r){var u=this;return m({url:this._url.path+"/applyEdits",content:n.mixin(l,this._url.query),callbackParamName:"callback",load:function(c){u._editHandler(c,a,p,e,h,f)},error:function(a){u._resolve([a],null,h,f,!0)}},{usePost:!0})}this._resolve([],null,e,f)}},queryFeatures:function(a,c,b){return this._query("execute","onQueryFeaturesComplete",a,c,b)},queryRelatedFeatures:function(a,c,b){return this._query("executeRelationshipQuery",
"onQueryRelatedFeaturesComplete",a,c,b)},queryIds:function(a,c,b){return this._query("executeForIds","onQueryIdsComplete",a,c,b)},queryCount:function(a,c,b){return this._query("executeForCount","onQueryCountComplete",a,c,b)},queryExtent:function(a,c,b){return this._query("executeForExtent","onQueryExtentComplete",a,c,b)},queryAttachmentInfos:function(a,c,d){var e=this._url.path+"/"+a+"/attachments",h=new u(x._dfdCanceller),g=this;h._pendingDfd=m({url:e,content:n.mixin({f:"json"},this._url.query),
callbackParamName:"callback",load:function(d){d=d.attachmentInfos;var m;b.forEach(d,function(c){m=p.objectToQuery({gdbVersion:g._url.query&&g._url.query.gdbVersion,layer:g._url.query&&g._url.query.layer,token:g._getToken()});c.url=e+"/"+c.id+(m?"?"+m:"");c.objectId=a});g._resolve([d],"onQueryAttachmentInfosComplete",c,h)},error:function(a){g._resolve([a],null,d,h,!0)}});return h},addAttachment:function(a,c,b,d){return this._sendAttachment("add",a,c,b,d)},updateAttachment:function(a,c,b,e,h){b.appendChild(d.create("input",
{type:"hidden",name:"attachmentId",value:c}));return this._sendAttachment("update",a,b,e,h)},deleteAttachments:function(a,c,d,e){var h=this._url.path+"/"+a+"/deleteAttachments",g=new u(x._dfdCanceller),l=this;c={f:"json",attachmentIds:c.join(",")};g._pendingDfd=m({url:h,content:n.mixin(c,this._url.query),callbackParamName:"callback",load:n.hitch(this,function(c){c=c.deleteAttachmentResults;c=b.map(c,function(c){c=new T(c);c.attachmentId=c.objectId;c.objectId=a;return c});l._resolve([c],"onDeleteAttachmentsComplete",
d,g)}),error:function(a){l._resolve([a],null,e,g,!0)}},{usePost:!0});return g},addType:function(a){var c=this.types;if(c){if(b.some(c,function(c){return c.id==a.id?!0:!1}))return!1;c.push(a)}else this.types=[a];return this._typesDirty=!0},deleteType:function(a){if(this._collection){var c=this.types;if(c){var d=-1;b.some(c,function(c,b){return c.id==a?(d=b,!0):!1});if(-1<d)return this._typesDirty=!0,c.splice(d,1)[0]}}},toJson:function(){var a=this._json;if(a=n.isString(a)?r.fromJson(a):n.clone(a)){var a=
a.layerDefinition?a:{layerDefinition:a},c=a.layerDefinition,d=this._collection;if(d&&this._typesDirty){c.types=b.map(this.types||[],function(a){return a.toJson()});var e=this.renderer,h=this.labelingInfo,g=c.drawingInfo;!e&&!h||g||(g=c.drawingInfo={});g&&e&&-1===e.declaredClass.indexOf("TemporalRenderer")&&(g.renderer=e.toJson());h&&(g.labelingInfo=b.map(h,function(a){return a.toJson()}))}e=null;if(!d||this._fcAdded)e={geometryType:c.geometryType,features:this._convertFeaturesToJson(this.graphics,
!0)};a.featureSet=n.mixin({},a.featureSet||{},e);a.featureSet.transform&&(h=a.featureSet.transform,delete a.featureSet.transform,e=new S(a.featureSet),e.quantize(h),a.featureSet=e.toJson());d&&(a.nextObjectId=this._nextId,c.capabilities=this.capabilities);return a}},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 u;setTimeout(n.hitch(this,
function(){this._isGeometryOperationsUsed()?P.enableGeometryOperations().always(function(){a.resolve()}):a.resolve()}),0);return a.promise},_isGeometryOperationsUsed:function(){var a=this.infoTemplate,c=this.renderer,d=this.labelingInfo;return a&&a.hasGeometryOperations&&a.hasGeometryOperations()||c&&c.hasGeometryOperations&&c.hasGeometryOperations()||b.some(d,function(a){return P.hasGeometryOperations(a.labelExpressionInfo&&a.labelExpressionInfo.expression)})?!0:!1},_forceIdentity:function(){var c=
new u,d=this,b,e=this._url&&this._url.path;b=e&&e.toLowerCase().indexOf("/rest/services");var h=this.editFieldsInfo,h=h&&(h.creatorField||h.editorField);(this.userIsAdmin||h)&&!this._getToken()&&-1<b&&a.id?(b=e.substring(0,b)+"/rest/info",m({url:b,content:{f:"json"},handleAs:"json",callbackParamName:"callback"}).then(function(c){if(c.owningSystemUrl)return a.id.checkSignInStatus(c.owningSystemUrl+"/sharing")}).then(function(c){if(c)return a.id.getCredential(e)}).then(function(a){a&&d._findCredential()}).always(function(){c.resolve()})):
c.resolve();return c.promise},_isSnapshotMode:function(){return this._mode?this._mode.isInstanceOf(O):!1},_checkMode:function(a){var c=this.geometryType,b=this.maxRecordCount;a=(a=a&&a.features&&a.features[0])&&a.attributes&&a.attributes.exceedslimit;this.mode===E.MODE_AUTO&&!this.isEditable()&&0===a&&(this.queryPagination||("esriGeometryPolyline"===c||"esriGeometryPolygon"===c||"esriGeometryMultipoint"===c||this.hasXYFootprint())&&b>=this.maxRecordCountForAuto||"esriGeometryPoint"===c&&b>=this.maxPointCountForAuto)&&
(this.currentMode=E.MODE_SNAPSHOT,this._mode=new O(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!==E.MODE_SNAPSHOT&&a!==E.MODE_STREAM&&a!==E.MODE_SELECTION&&(this._savedMode=this.mode,this._mode.suspend(),this._mode.destroy(),this.mode=this.currentMode=E.MODE_SNAPSHOT,this._mode=
new O(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=E.MODE_ONDEMAND;this._mode=new da(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,c=new u;this._limitPromise=c.promise;this._limitPromise.then(function(c){a._checkMode(c)});this._limitPromise.always(function(){a._limitPromise=null});setTimeout(function(){var b=new aa,d=new ha;d.statisticType="exceedslimit";d.maxPointCount=a.maxPointCountForAuto;d.maxRecordCount=a.maxRecordCountForAuto;d.maxVertexCount=a.maxVertexCountForAuto;d.outStatisticFieldName="exceedslimit";b.outStatistics=[d];a.queryFeatures(b).promise.then(function(a){c.resolve(a)},
function(a){c.reject(a)})},0)},_updateCaps:function(){var a=this._editable,c=n.trim(this.capabilities||""),d=b.map(c?c.split(","):[],n.trim),e=b.map(c?c.toLowerCase().split(","):[],n.trim),c=b.indexOf(e,"editing"),h,e={Create:b.indexOf(e,"create"),Update:b.indexOf(e,"update"),Delete:b.indexOf(e,"delete")};if(a&&-1===c)d.push("Editing");else if(!a&&-1<c){a=[c];for(h in e)-1<e[h]&&a.push(e[h]);a.sort();for(h=a.length-1;0<=h;h--)d.splice(a[h],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 c=this._map,d=this._getRenderer();if(a.firstOccurrence){if(this._fixRendererFields(),this._updateRequiredFieldsFromLabelingInfo(),this._checkFields(),this.clearSelection(),this._evalFeatureReduction(),this.timeInfo&&!this._trackManager&&(this._trackIdField||d&&(d.latestObservationRenderer||d.trackRenderer))&&(this._trackManager=
new na(this),this._trackManager.initialize(c),this._childLayer=this._trackManager.container),d&&"colors"in d&&"blurRadius"in d&&"maxPixelIntensity"in d&&"esriGeometryPoint"==this.geometryType&&!this._heatmapManager&&(this._heatmapManager=new ea(this),this._heatmapManager.initialize(c)),this._autoSnapshot&&this._autoGeneralize&&("esriGeometryPolyline"===this.geometryType||"esriGeometryPolygon"===this.geometryType||this.hasXYFootprint())&&!this.isEditable()&&null==this.getMaxAllowableOffset()&&(d=this.generalizeForScale,
this._calculatedScale=d=this.maxScale?this.maxScale:this.minScale?Math.min(d,this.minScale):Math.min(d,L.getScale(c,this.initialExtent)),this._calcMaxOffset=c.extent.getWidth()/c.width/c.getScale()*d),this._zoomConnect=t.connect(c,"onZoomEnd",this,this._zoomEndHandler),this._updateMaxOffset(),this._needsRefresh=!1,d=this._mode)d._init||d.initialize(c),d.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(),c=this._calculatedScale,
d=this._calcMaxOffset,b=this._prevScale;return a>=c&&(null==b||b<c)?d:a<c&&(null==b||b>=c)?null:this.getMaxAllowableOffset()}},_toggleTime:function(a){var c=this._map;a&&this.timeInfo&&this.useMapTime&&c?(this._mapTimeExtent=c.timeExtent,this._timeConnect||(this._timeConnect=t.connect(c,"onTimeExtentChange",this,this._timeChangeHandler))):(this._mapTimeExtent=null,t.disconnect(this._timeConnect),this._timeConnect=null)},_timeChangeHandler:function(a){this._mapTimeExtent=a;(a=this._mode)&&a.propertyChangeHandler(0)},
_getOffsettedTE:function(a){var c=this._timeOffset,d=this._timeOffsetUnits;return a&&c&&d?a.offset(-1*c,d):a},_getTimeOverlap:function(a,c){return a&&c?a.intersection(c):a||c},_getTimeFilter:function(a){var c=this.getTimeDefinition(),d;if(c&&(d=this._getTimeOverlap(c,null),!d))return[!1];if(a){if(a=d?this._getTimeOverlap(a,d):a,!a)return[!1]}else a=d;return[!0,a]},_getAttributeFilter:function(a){var c=this.getDefinitionExpression();return a?c?"("+c+") AND ("+a+")":a:c},_applyQueryFilters:function(a,
c){a.where=this._getAttributeFilter(a.where);a.returnGeometry&&null==a.maxAllowableOffset&&!a.quantizationParameters&&(a.maxAllowableOffset=this._maxOffset,a.quantizationParameters=this._quantizationParameters);c&&this.supportsAdvancedQueries&&(a.orderByFields=a.orderByFields||this.getOrderByFields());if(this.timeInfo){var d=this._getTimeFilter(a.timeExtent);if(d[0])a.timeExtent=d[1];else return!1}return!0},_add:function(a){var c=this._selectionSymbol,d=a.attributes,b=this.visibilityField;c&&this._isSelOnly&&
a.setSymbol(c);if(b&&d&&d.hasOwnProperty(b))a[d[b]?"show":"hide"]();return this.add.apply(this,arguments)},_remove:function(){return this.remove.apply(this,arguments)},_canDoClientSideQuery:function(a){var c=[],d=this._map,e;if((this._collection||!this._isTable&&d)&&!(a.text||a.where&&a.where!==this.getDefinitionExpression()||a.orderByFields&&a.orderByFields.length&&(e=this.getOrderByFields()||[])&&a.orderByFields.join()!==e.join()||a.outStatistics||a.returnDistinctValues)){e=this._isSnapshotMode();
var h=this._isSelOnly,g=a.geometry;if(g){if(h||a.spatialRelationship!==aa.SPATIAL_REL_INTERSECTS||"extent"!==g.type||!e&&!d.extent.contains(g))return;c.push(1)}if(d=a.objectIds)if(e)c.push(2);else{var g=d.length,m=this._mode,l=0,f;for(f=0;f<g;f++)m._getFeature(d[f])&&l++;if(l===g)c.push(2);else return}if(this.timeInfo)if(a=a.timeExtent,d=this._mapTimeExtent,e)a&&c.push(3);else if(h){if(a)return}else if(d)if(-1!==b.indexOf(c,2))a&&c.push(3);else if(-1!==b.indexOf(c,1))a==d&&c.push(3);else return;else if(0<
c.length)a&&c.push(3);else if(a)return;return 0<c.length?c:null}},_getAbsMid:function(a){return q.toAbsMid?q.toAbsMid(a):k.id.replace(/\/[^\/]*$/ig,"/")+a},_doQuery:function(a,c,d){var e=[],h=this.objectIdField,g=this,m=new u,l=new u,f=this.graphics;if(-1!==b.indexOf(c,1)){var p=this.spatialIndex||this._map&&this._map.spatialIndex,r,k=a.geometry._normalize(null,!0);null==p&&ka.autoSpatialIndexing?r=(this._map||this).addPlugin(this._getAbsMid("../plugins/spatialIndex")).then(n.hitch(this,n.partial(this._getFromIndex,
k,p)),function(a){l.resolve(n.hitch(this,n.partial(this._filterByExtent,f,k)))}):p&&(r=this._getFromIndex(k,p));r?r.then(function(a){for(var c=0;c<a.length;c++)a[c].results&&(e=e.concat(a[c].results));l.resolve(e)}).otherwise(function(a){l.reject(a)}):l.resolve(this._filterByExtent(f,k))}else l.resolve(f);l.then(function(l){e=l;if(-1!==b.indexOf(c,2)){var f=a.objectIds;e=b.filter(e,function(a){return-1<b.indexOf(f,a.attributes[h])})}-1!==b.indexOf(c,3)&&g.timeInfo&&(l=a.timeExtent,e=g._filterByTime(e,
l.startTime,l.endTime).match);d&&(e=b.map(e,function(a){return a.attributes[h]},this));m.resolve(e)});return m},_getFromIndex:function(a,c){c=c||this.spatialIndex||this._map.spatialIndex;a instanceof Array||(a=[a]);var d=this.id;return e(b.map(a,function(a){return c.intersects(a,d)}))},_filterByExtent:function(a,c){for(var d=[],b=0,e=a.length;b<e;b++){var h=a[b],g=h.geometry;g&&(this.normalization&&c.length?(c[0].intersects(g)||c[1].intersects(g))&&d.push(h):c.intersects(g)&&d.push(h))}return d},
_filterByTime:function(a,d,b){var e=this._startTimeField,h=this._endTimeField,g;this._twoTimeFields||(g=e||h);var m=c.isDefined,l=[],f=[],p,r=a.length,k,u;d=d?d.getTime():-Infinity;b=b?b.getTime():Infinity;if(g)for(p=0;p<r;p++)k=a[p],u=k.attributes,e=u[g],e>=d&&e<=b?l.push(k):f.push(k);else for(p=0;p<r;p++)k=a[p],u=k.attributes,g=u[e],u=u[h],g=m(g)?g:-Infinity,u=m(u)?u:Infinity,g>=d&&g<=b||u>=d&&u<=b||d>=g&&b<=u?l.push(k):f.push(k);return{match:l,noMatch:f}},_getSizeVariables:function(a){return a&&
b.filter(a.getVisualVariablesForType("sizeInfo",!1),function(a){return!(!a.field&&!a.valueExpression)})},_needClientSideSorting:function(a){return this._collection?!(!a||!a.length):b.some(a,function(a){return!!a.valueExpression})},_sortFeatures:function(a){var c=this.renderer,d=this._getSizeVariables(c);if(a&&1<a.length&&this._needClientSideSorting(d)){var b=d[0],e=this;a.sort(function(a,d){a._layer||(a._layer=e);d._layer||(d._layer=e);var h=c._getDataValue(a,b,"sizeInfo",null,e),g=c._getDataValue(d,
b,"sizeInfo",null,e);return null==h?-1:null==g?1:g-h})}return a},_resolve:function(a,c,d,b,e){c&&this[c].apply(this,a);d&&d.apply(null,a);b&&x._resDfd(b,a,e)},_getShallowClone:function(a){var c=new aa,d;for(d in a)a.hasOwnProperty(d)&&(c[d]=a[d]);return c},_query:function(a,c,d,e,h){var g=this,m=this._map,l=new u(x._dfdCanceller),f=d,p,r,k;if("executeRelationshipQuery"!==a){var f=this._getShallowClone(d),n=this.getOutFields();f.outFields||(f.outFields=n);f.outFields&&f.outFields.length&&(r=-1<b.indexOf(n,
"*")?!1:!b.every(f.outFields,function(a){return-1<b.indexOf(n,a)}));f.returnGeometry=d.hasOwnProperty("returnGeometry")?d.returnGeometry:!d.outStatistics;f.returnGeometry&&(f.multipatchOption=this.multipatchOption,null!=f.maxAllowableOffset||f.quantizationParameters)&&(d=null!=f.maxAllowableOffset?f.maxAllowableOffset:f.quantizationParameters.tolerance,null!=d&&d!==this.getMaxAllowableOffset()&&(k=!0));var y;m&&(m=m&&m.spatialReference,(d=f.outSpatialReference)?p=!d.equals(m):f.outSpatialReference=
new B(m.toJson()));if(!this._applyQueryFilters(f,"execute"===a&&!f.outStatistics)){switch(a){case "execute":y=new S({features:[]});break;case "executeForIds":y=[];break;case "executeForCount":y=0;break;case "executeForExtent":y={}}this._resolve([y],c,e,l);return l}if(m="executeForExtent"!==a&&!p&&!r&&!k&&this._canDoClientSideQuery(f))return l._pendingDfd=z(this._doQuery(f,m,"executeForIds"===a||"executeForCount"===a)),l._pendingDfd.then(function(d){switch(a){case "execute":y=new S;y.features=d;break;
case "executeForIds":y=d;break;case "executeForCount":y=d.length}g._resolve([y],c,e,l)}),l}if(this._collection)return this._resolve([Error("FeatureLayer::_query - "+this.invalidParams)],null,h,l,!0),l;if(this.loaded&&!this.isQueryable())return this._resolve([Error("Layer does not support query capability.")],null,h,l,!0),l;this._ts&&(f._ts=(new Date).getTime());(l._pendingDfd=this._task[a](f)).addCallbacks(function(d){var b=!!f.outStatistics||p||r||k;if("execute"===a||"executeRelationshipQuery"===
a){var h,m;if("execute"===a)for(h=d.features,m=h.length,--m;0<=m;m--){if(h[m]._layer=g,!b&&!g._isTable){var u=g._mode._getFeature(h[m].attributes[g.objectIdField]);u&&h.splice(m,1,u)}}else for(u in d)if(d.hasOwnProperty(u))for(h=d[u].features,m=h.length,--m;0<=m;m--)h[m]._layer=g}g._resolve([d],c,e,l)},function(a){g._resolve([a],null,h,l,!0)});return l},_convertFeaturesToJson:function(a,c,d,e){var h=[],g=this._selectionSymbol,m=this.visibilityField,l,f=this.objectIdField;this.loaded&&(d||e)&&(l=b.filter(this.fields,
function(a){return!1===a.editable&&(!e||a.name!==f)}));for(d=0;d<a.length;d++){var p=a[d],k={},u=p.geometry,y=p.attributes,z=p.symbol;!u||e&&this.loaded&&!this.allowGeometryUpdates||(k.geometry=u.toJson());m?(k.attributes=y=n.mixin({},y),y[m]=p.visible?1:0):y&&(k.attributes=n.mixin({},y));k.attributes&&l&&l.length&&b.forEach(l,function(a){delete k.attributes[a.name]});z&&z!==g&&(k.symbol=z.toJson());h.push(k)}return c?h:r.toJson(h)},_selectHandler:function(a,c,d,b,e){var h;switch(c){case E.SELECTION_NEW:this.clearSelection(!0);
h=!0;break;case E.SELECTION_ADD:h=!0;break;case E.SELECTION_SUBTRACT:h=!1}b=a.features;var g=this._mode,m=[],l=this.objectIdField,f,p;if(h)for(h=0;h<b.length;h++)f=b[h],p=f.attributes[l],f=g._addFeatureIIf(p,f),m.push(f),this._selectFeatureIIf(p,f,g);else for(h=0;h<b.length;h++)f=b[h],p=f.attributes[l],this._unSelectFeatureIIf(p,g),p=g._removeFeatureIIf(p),m.push(p||f);this._isSelOnly&&g._applyTimeFilter(!0);this._hasPartialSelectedFeatures=!!a.exceededTransferLimit;this._resolve([m,c,a.exceededTransferLimit?
{queryLimitExceeded:!0}:null],"onSelectionComplete",d,e);if(a.exceededTransferLimit)this.onQueryLimitExceeded()},_selectFeatureIIf:function(a,c,d){var b=this._selectedFeatures,e=b[a];e||(d._incRefCount(a),b[a]=c,this._isTable||(this._setSelectSymbol(c),c.attr("data-selected","")));return e||c},_unSelectFeatureIIf:function(a,c){var d=this._selectedFeatures[a];d&&(c._decRefCount(a),delete this._selectedFeatures[a],this._isTable||(this._setUnSelectSymbol(d),d.attr("data-selected")));return d},_isSelected:function(a){},
_setSelectSymbol:function(a){var c=this._selectionSymbol;c&&!this._isSelOnly&&a.setSymbol(c)},_setUnSelectSymbol:function(a){var c=this._selectionSymbol;c&&!this._isSelOnly&&c===a.symbol&&a.setSymbol(null,!0)},_getOutFields:function(){var a=[this.objectIdField,this.typeIdField,this.creatorField,this._startTimeField,this._endTimeField,this._trackIdField].concat(this._requiredFields).concat(this.dataAttributes),a=b.filter(a,function(a,c,d){return!!a&&b.indexOf(d,a)===c}),c=n.clone(this._outFields);
if(c){if(-1!==b.indexOf(c,"*"))return c;b.forEach(a,function(a){-1===b.indexOf(c,a)&&c.push(a)});return c}return a},_checkFields:function(a){var d=a||this._getOutFields();b.forEach(d,function(a){"*"!==a&&(this._getField(a)||console.debug("esri.layers.FeatureLayer: "+c.substitute({url:this.url,field:a},"unable to find '${field}' field in the layer 'fields' information [url: ${url}]")))},this);a||this._isTable||this._fserver||this._collection||this._isStream||b.some(this.fields,function(a){return a&&
"esriFieldTypeGeometry"===a.type?!0:!1})||console.debug("esri.layers.FeatureLayer: "+c.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,c,d){var b=a&&a[c],e;if(b&&!n.isFunction(b)){if(e=!this._getField(b)&&this._getField(b,!0))b=a[c]=e.name;d&&d.push(b)}return b},_fixRendererFields:function(){var a=this.renderer;this._orderBy=
null;this._requiredFields=[];if(a&&0<this.fields.length){var d=[],e,a=b.filter([a,a.observationRenderer,a.latestObservationRenderer,a.trackRenderer],c.isDefined),h=[].concat(a);b.forEach(a,function(a){b.forEach(a.rendererInfos,function(a){a.renderer&&h.push(a.renderer)})});b.forEach(h,function(a){this._fixFieldCase(a,"attributeField",d);this._fixFieldCase(a,"attributeField2",d);this._fixFieldCase(a,"attributeField3",d);this._fixFieldCase(a.rotationInfo,"field",d);(e=this._fixFieldCase(a.sizeInfo,
"field",d))&&!this._orderBy&&(this._orderBy=[e+" DESC"]);this._fixFieldCase(a.sizeInfo,"normalizationField",d);this._fixFieldCase(a.colorInfo,"field",d);this._fixFieldCase(a.colorInfo,"normalizationField",d);this._fixFieldCase(a.field,"field",d);this._fixFieldCase(a.opacityInfo,"field",d);this._fixFieldCase(a.opacityInfo,"normalizationField",d);b.forEach(a.visualVariables,function(a){e=this._fixFieldCase(a,"field",d);"sizeInfo"===a.type&&e&&!this._orderBy&&(this._orderBy=[e+" DESC"]);this._fixFieldCase(a,
"normalizationField",d)},this);var c=b.map(a.getFieldsUsedInExpressions(),function(a){var c=this.getField(a);return c?c.name:a},this);d=d.concat(c);this._orderBy||!a.addBreak||n.isFunction(a.attributeField)||!a.backgroundFillSymbol&&!this._hasSizeDiff(a)||(this._orderBy=[a.attributeField+" DESC"])},this);this._requiredFields=b.filter(d,c.isDefined)}},_hasSizeDiff:function(a){var c=Number.MAX_VALUE,d=-Number.MAX_VALUE,e,h;b.forEach(a.infos,function(a){if(h=a.symbol){e=0;switch(h.type){case "simplemarkersymbol":e=
h.size;break;case "picturemarkersymbol":e=(h.width+h.height)/2;break;case "simplelinesymbol":case "cartographiclinesymbol":e=h.width;break;case "simplefillsymbol":case "picturefillsymbol":e=h.outline&&h.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 a=this.orderByFields||this._orderBy;return this.supportsAdvancedQueries&&a?b.filter(a,function(a){a=a.split(" ")[0];return!!this._getField(a,!0)},
this):null},_getField:function(a,c){var d=this.fields;if(!d||0===d.length)return null;var e;c&&(a=a.toLowerCase());b.some(d,function(d){var b=!1;(b=c?d&&d.name.toLowerCase()===a?!0:!1:d&&d.name===a?!0:!1)&&(e=d);return b});return e},_getDateOpts:function(){this._dtOpts||(this._dtOpts={properties:b.map(b.filter(this.fields,function(a){return!(!a||"esriFieldTypeDate"!==a.type)}),function(a){return a.name})});return this._dtOpts},_applyNormalized:function(a,c){a&&c&&b.forEach(a,function(a,d){a&&c[d]&&
a.setGeometry(c[d])})},_editHandler:function(a,c,d,e,h,g){h=a.addResults;var m=a.updateResults;a=a.deleteResults;var l,f,p,r,k,u=this.objectIdField,y=this._mode,z=this._isTable;l=this.editFieldsInfo;r=this.getOutFields()||[];var x=l&&l.creatorField,t=l&&l.creationDateField,A=l&&l.editorField,I=l&&l.editDateField;l=l&&l.realm;-1===b.indexOf(r,"*")&&(x&&-1===b.indexOf(r,x)&&(x=null),t&&-1===b.indexOf(r,t)&&(t=null),A&&-1===b.indexOf(r,A)&&(A=null),I&&-1===b.indexOf(r,I)&&(I=null));var q=t||I?(new Date).getTime():
null,P=x||A?this.getUserId():void 0;P&&l&&(P=P+"@"+l);if(h){var D=this.globalIdField;for(l=0;l<h.length;l++)h[l]=new T(h[l]),z||(f=h[l],f.success&&(p=f.objectId,r=c[l],(k=r._graphicsLayer)&&k!==this&&k.remove(r),k=r.attributes||{},k[u]=p,p=f.globalId,D&&p&&(k[D]=p),x&&(k[x]=P),A&&(k[A]=P),t&&(k[t]=q),I&&(k[I]=q),r.setAttributes(k),y._init&&y.drawFeature(r)))}if(m)for(l=0;l<m.length;l++)if(m[l]=new T(m[l]),!z&&(f=m[l],f.success)){p=f.objectId;r=d[p];if(c=y._getFeature(p))c.geometry!==r.geometry&&r.geometry&&
c.setGeometry(la.fromJson(r.geometry.toJson())),c.attributes!==r.attributes&&r.attributes&&c.setAttributes(n.mixin(c.attributes,r.attributes)),this._repaint(c,p);r=c||r;k=r.attributes||{};A&&(k[A]=P);I&&(k[I]=q);r.setAttributes(k)}if(a){d=[];for(l=0;l<a.length;l++)if(a[l]=new T(a[l]),!z&&(f=a[l],f.success&&(p=f.objectId,r=y._getFeature(p))))this._unSelectFeatureIIf(p,y)&&d.push(r),r._count=0,y._removeFeatureIIf(p);if(0<d.length)this.onSelectionComplete(d,E.SELECTION_SUBTRACT)}this._resolve([h,m,a],
"onEditsComplete",e,g)},_sendAttachment:function(a,c,d,b,e){var h=this;return m({url:this._url.path+"/"+c+"/"+("add"===a?"addAttachment":"updateAttachment"),form:d,content:n.mixin(this._url.query,{f:"json",token:this._getToken()||void 0}),callbackParamName:"callback.html",handleAs:"json"}).addCallback(function(d){var e="add"===a?"onAddAttachmentComplete":"onUpdateAttachmentComplete";d=new T(d["add"===a?"addAttachmentResult":"updateAttachmentResult"]);d.attachmentId=d.objectId;d.objectId=c;h._resolve([d],
e,b);return d}).addErrback(function(a){h._resolve([a],null,e,null,!0)})},_repaint:function(a,d,b){d=c.isDefined(d)?d:a.attributes[this.objectIdField];d in this._selectedFeatures&&this._selectionSymbol||a.setSymbol(a.symbol,b)},_getKind:function(a){var c=this._trackManager;return c?c.isLatestObservation(a)?1:0:0}});n.mixin(E,{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"});ca._createWrappers(E);g("extend-esri")&&n.setObject("layers.FeatureLayer",E,a);return E})},"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(q,k,f,t,n,b,r,u,v,g,p){q=q(null,{declaredClass:"esri.layers.FeatureType",constructor:function(d){if(d&&k.isObject(d)){this.id=d.id;this.name=
d.name;var b=d.symbol;b&&(this.symbol=r.fromJson(b));var b=d.domains,f,e=this.domains={};for(f in b)if(b.hasOwnProperty(f)){var a=b[f];switch(a.type){case "range":e[f]=new u(a);break;case "codedValue":e[f]=new v(a);break;case "inherited":e[f]=new g(a)}}if(f=d.templates)for(b=this.templates=[],d=0;d<f.length;d++)b.push(new p(f[d]))}},toJson:function(){var d={id:this.id,name:this.name,symbol:this.symbol&&this.symbol.toJson()},g,p=this.domains,e=this.templates,a=b.fixJson;if(p){var c=d.domains={};for(g in p)p.hasOwnProperty(g)&&
(c[g]=p[g]&&p[g].toJson());a(c)}e&&(d.templates=f.map(e,function(a){return a.toJson()}));return a(d)}});t("extend-esri")&&k.setObject("layers.FeatureType",q,n);return q})},"esri/layers/FeatureTemplate":function(){define("dojo/_base/declare dojo/_base/lang dojo/has ../kernel ../lang ../graphic".split(" "),function(q,k,f,t,n,b){q=q(null,{declaredClass:"esri.layers.FeatureTemplate",constructor:function(f){f&&k.isObject(f)&&(this.name=f.name,this.description=f.description,this.drawingTool=f.drawingTool,
this.thumbnail=f.thumbnail,f=f.prototype,this.prototype=new b(f.geometry,null,f.attributes))},toJson:function(){return n.fixJson({name:this.name,description:this.description,drawingTool:this.drawingTool,thumbnail:n.fixJson(k.clone(this.thumbnail)),prototype:this.prototype&&this.prototype.toJson()})}});k.mixin(q,{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"});f("extend-esri")&&k.setObject("layers.FeatureTemplate",
q,t);return q})},"esri/layers/FeatureEditResult":function(){define(["dojo/_base/declare","dojo/_base/lang","dojo/has","../kernel"],function(q,k,f,t){q=q(null,{declaredClass:"esri.layers.FeatureEditResult",constructor:function(f){f&&k.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))}});f("extend-esri")&&k.setObject("layers.FeatureEditResult",q,t);return q})},"esri/layers/SnapshotMode":function(){define("dojo/_base/declare dojo/_base/lang dojo/has ../kernel ../SpatialReference ../srUtils ../tasks/query ./RenderMode ./support/ParallelSnapshot".split(" "),
function(q,k,f,t,n,b,r,u,v){q=q([u],{declaredClass:"esri.layers._SnapshotMode",maxFeatures:5E4,constructor:function(b){this.featureLayer=b;this._featureMap={};this._hasPartialFeatures=!1;this._drawFeatures=k.hitch(this,this._drawFeatures);this._queryErrorHandler=k.hitch(this,this._queryErrorHandler);this._handleSuccess=k.hitch(this,this._handleSuccess);this._handleError=k.hitch(this,this._handleError);this._handleProgress=k.hitch(this,this._handleProgress)},startup:function(){if(!this._started){this.inherited(arguments);
var b=this.featureLayer,f=b.advancedQueryCapabilities,d=b.reHostedFS.test(b.url);this.pagination=b.queryPagination&&null!=b.maxRecordCount;this._tileQueriesAllowed=d&&f&&f.supportsQueryWithResultType&&b.isFeatureReductionApplied();d&&this.pagination&&(this._parallelSnapshot=new v({layer:b,mode:this,queryTask:b._task}));b._collection?this._applyTimeFilter():this._fetchAll()}},propertyChangeHandler:function(b){this._init&&(b?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(b){var g=b.attributes[this.featureLayer.objectIdField];this._addFeatureIIf(g,b);this._incRefCount(g)},resume:function(){this.propertyChangeHandler(0)},refresh:function(){var b=this.featureLayer;b._collection?(b._fireUpdateStart(),b._refresh(!0),b._fireUpdateEnd()):
this._fetchAll()},hasAllFeatures:function(){return!this._hasPartialFeatures},_fetchAll:function(){var b=this.featureLayer;b._collection||b.suspended||!b.isQueryable()||(b._fireUpdateStart(),this._clearIIf(),this._hasPartialFeatures=!1,this._parallelSnapshot?this._parallelSnapshot.fetch(this._createQuery()).then(this._handleSuccess,this._handleError,this._handleProgress):this._sendRequest())},_handleSuccess:function(b){this._hasPartialFeatures=b.hasPartialFeatures;this.featureLayer._fireUpdateEnd(null)},
_handleError:function(b){this._queryErrorHandler(b)},_handleProgress:function(b){b.isError?this.featureLayer._errorHandler(b.error):this._addFeatures(b.features)},_sendRequest:function(b){var g=this.featureLayer,d=this._createQuery();this.pagination&&(this._start=d.start=null==b?0:b,d.num=g.maxRecordCount);this._pendingRequest&&this._cancelPendingRequest(this._pendingRequest);this._pendingRequest=g._task.execute(d,this._drawFeatures,this._queryErrorHandler)},_drawFeatures:function(b){this._pendingRequest=
null;var g=this.featureLayer,d=b.exceededTransferLimit,l=d&&!g._collection;b=this._checkMaxLimit(b.features);var f=b.maxLimitReached;this._addFeatures(b.features);this.pagination&&l&&!f||(this._hasPartialFeatures=!!d,g._fireUpdateEnd(null,d?{queryLimitExceeded:!0}:null));l&&(this.pagination&&!f&&this._sendRequest(this._start+g.maxRecordCount),g.onQueryLimitExceeded())},_queryErrorHandler:function(b){this._pendingRequest=null;this._hasPartialFeatures=!0;var g=this.featureLayer;g._errorHandler(b);g._fireUpdateEnd(b)},
_checkMaxLimit:function(b){var g=b?b.length:0,d=this.featureLayer.graphics.length+g,l=d>=this.maxFeatures;if(l){var f=d-this.maxFeatures;f&&b.splice(g-f,f)}return{maxLimitReached:l,featuresDiscarded:d>this.maxFeatures,features:b}},_createQuery:function(){var g=this.featureLayer,f=new r;f.outFields=g.getOutFields();f.where=g.getDefinitionExpression()||"1\x3d1";f.returnGeometry=!0;f.outSpatialReference=b.createSpatialReference(this.map.spatialReference.toJson());f.timeExtent=g.getTimeDefinition();f.maxAllowableOffset=
g._maxOffset;f.quantizationParameters=g._quantizationParameters;f.orderByFields=g.supportsAdvancedQueries?g.getOrderByFields():null;f.multipatchOption=g.multipatchOption;g._ts&&(f._ts=(new Date).getTime());this._tileQueriesAllowed&&(f.resultType="tile");return f},_addFeatures:function(b){var g=this.featureLayer,d=g.objectIdField,l=b.length,f=g._selectedFeatures,e=g.mode===g.constructor.MODE_AUTO,a,c,m;g._fireUpdateStart();g._sortFeatures(b);for(g=0;g<l;g++)c=b[g],m=c.attributes[d],a=this._addFeatureIIf(m,
c),this._incRefCount(m),e&&a!==c&&f[m]&&(a.setGeometry(c.geometry),a.setAttributes(c.attributes));this._applyTimeFilter(!0)}});f("extend-esri")&&k.setObject("layers._SnapshotMode",q,t);return q})},"esri/layers/RenderMode":function(){define(["dojo/_base/declare","dojo/_base/lang","dojo/_base/array","dojo/has","../kernel"],function(q,k,f,t,n){q=q(null,{declaredClass:"esri.layers._RenderMode",initialize:function(b){this.map=b;this._init=!0},startup:function(){this._started=!0},propertyChangeHandler:function(b){},
destroy:function(){this._init=this._started=!1},drawFeature:function(b){},suspend:function(){},resume:function(){},refresh:function(){},hasAllFeatures:function(){return!0},_incRefCount:function(b){(b=this._featureMap[b])&&b._count++},_decRefCount:function(b){(b=this._featureMap[b])&&b._count--},_getFeature:function(b){return this._featureMap[b]},_addFeatureIIf:function(b,f){var r=this._featureMap,k=r[b],g=this.featureLayer;k||(r[b]=f,g._add(f),f._count=0);return k||f},_removeFeatureIIf:function(b){var f=
this._featureMap[b],k=this.featureLayer;if(f){if(f._count)return;delete this._featureMap[b];k._remove(f)}return f},_clearIIf:function(){var b;b=this.featureLayer;var f=b.graphics,k=b._selectedFeatures,n=b.getSelectedFeatures().length,g=b.objectIdField;if(n)for(b=f.length-1;0<=b;b--){var n=f[b],p=n.attributes[g];p in k?n._count=1:(n._count=0,this._removeFeatureIIf(p))}else b.clear(),this._featureMap={}},_cancelPendingRequest:function(b){if(b)try{b.cancel()}catch(r){}},_toggleVisibility:function(b){var f=
this.featureLayer,k=f.graphics,n=b?"show":"hide",g,p=k.length;b=b&&f._ager;for(g=0;g<p;g++){var d=k[g];d[n]();b&&f._repaint(d)}},_applyTimeFilter:function(b){var k=this.featureLayer;if(k.timeInfo&&!k.suspended){b||k._fireUpdateStart();var u=k._trackManager;u&&u.clearTracks();var n=k.getTimeDefinition(),g=k._getOffsettedTE(k._mapTimeExtent);g?(g=k._getTimeOverlap(n,g))?(n=k._filterByTime(k.graphics,g.startTime,g.endTime),u&&u.addFeatures(n.match),f.forEach(n.match,function(b){var d=b._shape;b.visible||
(b.show(),(d=b._shape)&&d._moveToFront());k._ager&&d&&k._repaint(b)}),f.forEach(n.noMatch,function(b){b.visible&&b.hide()})):this._toggleVisibility(!1):(u&&u.addFeatures(k.graphics),this._toggleVisibility(!0));u&&(u.moveLatestToFront(),u.drawTracks());b||k._fireUpdateEnd()}}});t("extend-esri")&&k.setObject("layers._RenderMode",q,n);return q})},"esri/layers/support/ParallelSnapshot":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/has dojo/Deferred ../../kernel".split(" "),
function(q,k,f,t,n,b){q=q(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(b){k.mixin(this,b);this._requests={};this._maxPage=Math.ceil(this.mode.maxFeatures/this.layer.maxRecordCount)},destroy:function(){this.cancel()},fetch:function(b){var f=new n;this.cancel(!0);this._query=b;this._fetchDfd=f;this._sendRequests();return f.promise},
cancel:function(b){this._cancelPendingRequests(b);this._reset()},_reset:function(){this._startPage=this._lastPage=null;this._requests={}},_sendRequests:function(b){var f=this._query,r=this.queryTask,g=this._requests,p=this.layer.maxRecordCount,d;b=null==b?1:b;d=b+this.batchSize-1;d>this._maxPage&&(d=this._maxPage);if(!(b>d))for(this._startPage=b,this._lastPage=d;b<=d;b++)f.start=(b-1)*p,f.num=p,g[b]=r.execute(f),g[b].then(k.hitch(this,this._handleSuccess,b)).otherwise(k.hitch(this,this._handleError,
b))},_evalNextBatch:function(b){b===this._lastPage&&this._sendRequests(this._lastPage+1)},_handleSuccess:function(b,f){f.exceededTransferLimit||this._cancelLaterRequests(b,!0);var k=this.mode._checkMaxLimit(f.features);this._fetchDfd.progress({features:k.features,isError:!1});k.maxLimitReached?((k=k.featuresDiscarded||this._hasRejectedRequests())||(k=!!this._getResult(this._getLastSuccessfulRequest()).exceededTransferLimit),this._resolveFetch(k)):(f.exceededTransferLimit&&this._evalNextBatch(b),this._evalResolution())},
_handleError:function(b,f){var k=this._requests;k&&k[b]&&(1===b?this._rejectFetch(f):(this._evalNextBatch(b),this._fetchDfd.progress({error:f,isError:!0}),this._evalResolution()))},_evalResolution:function(){this._hasPendingRequests()||this._resolveFetch(this._hasRejectedRequests())},_resolveFetch:function(b){this.cancel(!0);this._fetchDfd.resolve({hasPartialFeatures:b})},_rejectFetch:function(b){this.cancel(!0);this._fetchDfd.reject(b)},_getResult:function(b){return b&&b.dfd.results[0]},_hasPendingRequests:function(){return!!this._getPendingRequests().length},
_getPendingRequests:function(){var b=this._requests,f,k=[];for(f in b){var g=b[f];g.isFulfilled()||k.push({pageId:Number(f),dfd:g})}return k},_getLastSuccessfulRequest:function(){var b=this._getResolvedRequests(),k=-Infinity,n,b=f.filter(b,function(b){return!!this._getResult(b).features.length||1===b.pageId},this);f.forEach(b,function(b){b.pageId>k&&(k=b.pageId,n=b)});return n},_getResolvedRequests:function(){var b=this._requests,f,k=[];for(f in b){var g=b[f];g.isResolved()&&k.push({pageId:Number(f),
dfd:g})}return k},_hasRejectedRequests:function(){var b=this._getRejectedRequests(),k=this._getLastSuccessfulRequest(),n=this._getResult(k);n&&!n.exceededTransferLimit&&(b=f.filter(b,function(b){return b.pageId<=k.pageId}));return!!b.length},_getRejectedRequests:function(){var b=this._requests,f,k=[];for(f in b){var g=b[f];g.isRejected()&&k.push({pageId:Number(f),dfd:g})}return k},_cancelPendingRequests:function(b){this._cancelRequests(this._getPendingRequests(),b)},_cancelLaterRequests:function(b,
k){var r=f.filter(this._getPendingRequests(),function(g){return g.pageId>b});this._cancelRequests(r,k)},_cancelRequests:function(b,k){var r=this.mode,g=this._requests;f.forEach(b,function(b){k&&delete g[b.pageId];r._cancelPendingRequest(b.dfd)})}});t("extend-esri")&&k.setObject("layers.support.ParallelSnapshot",q,b);return q})},"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(q,k,f,t,n,b,r,u,v,g){q=q([v],{declaredClass:"esri.layers._OnDemandMode",constructor:function(b){this.featureLayer=b;this._featureMap={};this._hasPartialFeatures=!1;this._queryErrorHandler=f.hitch(this,this._queryErrorHandler)},initialize:function(b){this.inherited(arguments);var d=this.featureLayer,l=d._srInfo;this._gridLayer=new g(new r(l?l.valid[0]:b.extent.xmin,l?l.valid[1]:b.extent.ymax,b.spatialReference),{width:d._tileWidth,height:d._tileHeight},{width:b.width,height:b.height},l);this._cellMap=
{};this._gridLayer.setResolution(b.extent)},startup:function(){this._started||(this.inherited(arguments),this._ioQueue=[],this.featureLayer.suspended||(this._zoomHandler(),this._enableConnectors()))},propertyChangeHandler:function(b){this._init&&(2>b?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(b){var d=b.geometry,g=[];if(d){var g=this._gridLayer.getCellsInExtent("point"===d.type?{xmin:d.x,ymin:d.y,xmax:d.x,ymax:d.y}:d.getExtent(),!1).cells,d=this._cellMap,f,e,a=b.attributes[this.featureLayer.objectIdField],c,m,k;for(f=0;f<g.length;f++)e=g[f],c=e.latticeID,m=e.row,k=e.col,c?e=d[c]=d[c]||e:(d[m]=d[m]||{},e=d[m][k]=d[m][k]||e),e.features=e.features||[],e.features.push(b),this._addFeatureIIf(a,b),this._incRefCount(a)}},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 b=!1,d=this._getCurrentCells(),g;for(g=0;g<d.length;g++)if(d[g].hasPartialFeatures){b=!0;break}return!b},_enableConnectors:function(){var b=this.map;this._zoomConnect=k.connect(b,"onZoomEnd",this,this._zoomHandler);this._panConnect=k.connect(b,"onPanEnd",this,this._panHandler);this._resizeConnect=
k.connect(b,"onResize",this,this._panHandler)},_disableConnectors:function(){k.disconnect(this._zoomConnect);k.disconnect(this._panConnect);k.disconnect(this._resizeConnect)},_zoomHandler:function(){this._processIOQueue(!0);var b=this.featureLayer,d=this.map;!b.suspended&&b.isQueryable()&&(b._fireUpdateStart(),this._clearIIf(),this._hasPartialFeatures=!1,(b=b._trackManager)&&b.clearTracks(),this._cellMap={},this._gridLayer.setResolution(d.extent),this._sendRequest())},_panHandler:function(b){if(this.featureLayer.isQueryable()){this.featureLayer._fireUpdateStart();
var d=this.featureLayer._resized;b=d?b:null;d&&this._gridLayer.setMapState(b,this.map.width,this.map.height);this._sendRequest(b)}},_sendRequest:function(b){this._exceeds=!1;var d=this.featureLayer,g=this.map;b=b||g.extent;g=this._gridLayer.getCellsInExtent(b,d.latticeTiling).cells;if(!d.isEditable())var f=this._cellMap,g=t.filter(g,function(a){if(a.lattice){if(f[a.latticeID])return!1}else if(f[a.row]&&f[a.row][a.col])return!1;return!0});var e=d.getOutFields(),a=d.getDefinitionExpression(),c=d._getOffsettedTE(d._mapTimeExtent),
m=d.supportsAdvancedQueries?d.getOrderByFields():null,k=this._ioQueue,p,r=this,n=this._drawFeatures,q,h;this._pending=this._pending||0;for(p=0;p<g.length;p++){q=g[p];h=new u;h.geometry=q.extent||q.lattice;h.outFields=e;h.where=a;d.latticeTiling&&q.extent&&(h.spatialRelationship=u.SPATIAL_REL_CONTAINS);h.returnGeometry=!0;h.timeExtent=c;d._ts&&(h._ts=(new Date).getTime());h.orderByFields=m;h.multipatchOption=d.multipatchOption;h.maxAllowableOffset=d._maxOffset;h.quantizationParameters=d._quantizationParameters;
var y=d.advancedQueryCapabilities;y&&y.supportsQueryWithResultType&&(h.resultType="tile");this._pending++;k.push(d._task.execute(h,function(){var a=q;return function(c){n.apply(r,[c,a])}}.call(this),this._queryErrorHandler))}this._removeOldCells(b);this._endCheck()},_drawFeatures:function(b,d){d.hasPartialFeatures=!!b.exceededTransferLimit;this._exceeds=this._exceeds||b.exceededTransferLimit;this._finalizeIO();var g=this.featureLayer,f=this.map.extent,e=d.extent,a=d.row,c=d.col,m=g.objectIdField,
k=b.features,p=this._gridLayer,r=this._cellMap,n=d.latticeID,u=n?r[n]:r[a]&&r[a][c];if(d.resolution==p._resolution&&(n?n===p.getLatticeID(f):p.intersects(e,f)))if(u)g._sortFeatures(k),this._updateCell(u,k);else for(g._sortFeatures(k),d.features=k,n?r[n]=d:(r[a]=r[a]||{},r[a][c]=d),f=k.length,g=0;g<f;g++)e=k[g],a=e.attributes[m],this._addFeatureIIf(a,e),this._incRefCount(a);else u&&this._removeCell(a,c,n);this._endCheck()},_queryErrorHandler:function(b){this._finalizeIO();this._hasPartialFeatures=
!0;this.featureLayer._errorHandler(b);this._endCheck(!0)},_finalizeIO:function(){this._pending--},_endCheck:function(b){if(0===this._pending){this._processIOQueue();var d=this.featureLayer,g=d._trackManager;g&&(g.clearTracks(),g.addFeatures(d.graphics),d._ager&&t.forEach(d.graphics,function(b){b._shape&&d._repaint(b)}),g.moveLatestToFront(),g.drawTracks());this.featureLayer._fireUpdateEnd(b&&Error("FeatureLayer: an error occurred while updating the layer"),this._exceeds?{queryLimitExceeded:!0}:null);
if(this._exceeds)d.onQueryLimitExceeded()}},_processIOQueue:function(b){this._ioQueue=t.filter(this._ioQueue,function(b){return-1<b.fired?!1:!0});b&&t.forEach(this._ioQueue,this._cancelPendingRequest)},_getCurrentCells:function(b){var d=[];b=b||this._cellMap;for(var g in b)if(b.hasOwnProperty(g)){var f=b[g];f&&(f.hasOwnProperty("row")||f.hasOwnProperty("latticeID")?d.push(f):"object"===typeof f&&d.push.apply(d,this._getCurrentCells(f)))}return d},_removeOldCells:function(b){var d=this._cellMap,g=
this._gridLayer,f,e;for(f in d)if(d[f]){var a=d[f],c=a.latticeID,m=0,k=0;if(c)m++,c!==g.getLatticeID(b)&&(this._removeCell(null,null,c),k++);else for(e in a)a[e]&&(m++,g.intersects(a[e].extent,b)||(this._removeCell(f,e),k++));k===m&&delete d[f]}},_updateCell:function(b,d){var g=this.featureLayer,f=g.objectIdField,g=g._selectedFeatures,e,a=d.length;b.features=b.features||[];for(e=0;e<a;e++){var c=d[e],m=c.attributes[f],k=this._addFeatureIIf(m,c);k===c?(this._incRefCount(m),b.features.push(k)):m in
g||(k.setGeometry(c.geometry),k.setAttributes(c.attributes))}},_removeCell:function(b,d,g){var f=this._cellMap,e=this.featureLayer,a=e.objectIdField,c=g?f[g]:f[b]&&f[b][d];if(c)for(g?delete f[g]:delete f[b][d],b=c.features,d=0;d<b.length;d++)g=b[d].attributes[a],this._decRefCount(g),g in e._selectedFeatures||this._removeFeatureIIf(g)}});n("extend-esri")&&f.setObject("layers._OnDemandMode",q,b);return q})},"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(q,k,f,t,n,b,r,u,v){q=q(null,{declaredClass:"esri.layers._GridLayout",constructor:function(b,f,d,l){this.origin=b;this.cellWidth=f.width;this.cellHeight=f.height;this.mapWidth=d.width;this.mapHeight=d.height;this.srInfo=l},setResolution:function(b){this._resolution=(b.xmax-b.xmin)/this.mapWidth;this.srInfo&&(b=Math.round(Math.round(2*this.srInfo.valid[1]/this._resolution)/this.cellWidth),this._frameStats=[b,0,b-1])},setMapState:function(b,f,d){this.mapWidth=f;this.mapHeight=d;this.setResolution(b)},
getCellCoordinates:function(b){var g=this._resolution,d=this.origin;return{row:Math.floor((d.y-b.y)/(this.cellHeight*g)),col:Math.floor((b.x-d.x)/(this.cellWidth*g))}},normalize:function(b){var f=this._frameStats;if(f){var d=f[0],g=f[1],f=f[2];b<g?(b%=d,b=b<g?b+d:b):b>f&&(b%=d)}return b},intersects:function(b,k){var d=this.srInfo;return d?f.some(k._getParts(d),function(d){return b.intersects(d.extent)}):b.intersects(k)},getCellExtent:function(b,f){var d=this._resolution,g=this.origin,k=this.cellWidth,
e=this.cellHeight;return new r(f*k*d+g.x,g.y-(b+1)*e*d,(f+1)*k*d+g.x,g.y-b*e*d,v.createSpatialReference(g.spatialReference.toJson()))},getLatticeID:function(b){var f=this.getCellCoordinates({x:b.xmin,y:b.ymax}),d=this.getCellCoordinates({x:b.xmax,y:b.ymin});b=f.row;var g=d.row,f=this.normalize(f.col),d=this.normalize(d.col);return b+"_"+g+"_"+f+"_"+d},sorter:function(b,f){return b<f?-1:1},getCellsInExtent:function(b,k){var d=this.getCellCoordinates({x:b.xmin,y:b.ymax}),g=this.getCellCoordinates({x:b.xmax,
y:b.ymin}),r=d.row,e=g.row,d=d.col,g=g.col,a=[],c,m,n,p=[],t=[],q,w,h,y,A=[];for(c=r;c<=e;c++)for(m=d;m<=g;m++)n=this.normalize(m),b=this.getCellExtent(c,n),f.some(a,function(a){return a.row===c&&a.col===n})||a.push({row:c,col:n,extent:b,resolution:this._resolution}),k&&(p.push(b.xmin,b.xmax),t.push(b.ymin,b.ymax));d=this.normalize(d);g=this.normalize(g);p.sort(this.sorter);t.sort(this.sorter);m=p.length;for(c=m-1;0<=c;c--)c<m-1&&p[c]===p[c+1]&&p.splice(c,1);m=t.length;for(c=m-1;0<=c;c--)c<m-1&&t[c]===
t[c+1]&&t.splice(c,1);if(p.length&&t.length){q=p[0];w=p[p.length-1];h=t[0];y=t[t.length-1];m=p.length;for(c=0;c<m;c++)A.push([[p[c],y],[p[c],h]]);m=t.length;for(c=0;c<m;c++)A.push([[q,t[c]],[w,t[c]]]);p=new u({paths:A,spatialReference:this.origin.spatialReference.toJson()});a.push({latticeID:r+"_"+e+"_"+d+"_"+g,lattice:p,resolution:this._resolution})}return{minRow:r,maxRow:e,minCol:d,maxCol:g,cells:a}}});t("extend-esri")&&k.setObject("layers._GridLayout",q,n);return q})},"esri/layers/SelectionMode":function(){define(["dojo/_base/declare",
"dojo/_base/lang","dojo/has","../kernel","./RenderMode"],function(q,k,f,t,n){q=q([n],{declaredClass:"esri.layers._SelectionMode",constructor:function(b){this.featureLayer=b;this._featureMap={}},propertyChangeHandler:function(b){this._init&&0===b&&this._applyTimeFilter()},resume:function(){this.propertyChangeHandler(0)},hasAllFeatures:function(){return!this.featureLayer._hasPartialSelectedFeatures}});f("extend-esri")&&k.setObject("layers._SelectionMode",q,t);return q})},"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(q,k,f,t,n,b,r,u,v,g,p){q=q([p],{declaredClass:"esri.layers._StreamMode",constructor:function(b,f){this.featureLayer=b;this._featureMap={};this._setRefreshRate();this._drawBuffer={adds:[],updates:[]};this._timeoutId=null;this._flushDrawBuffer=k.hitch(this,this._flushDrawBuffer);this._featuresByTime={};this._lastEndTimeCheck=null;this._maxFeatureAge=0;b.purgeOptions&&b.purgeOptions.age&&"number"===typeof b.purgeOptions.age&&(this._maxFeatureAge=1E3*Math.ceil(60*b.purgeOptions.age));this._drawFeatures=
k.hitch(this,this._drawFeatures);this._queryErrorHandler=k.hitch(this,this._queryErrorHandler)},startup:function(){this._started||this.inherited(arguments)},propertyChangeHandler:function(b){this._init&&(0===b?this._applyTimeFilter():3===b?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(b){var d=this.featureLayer,f=d.objectIdField;this._timeoutId||(this._timeoutId=setTimeout(this._flushDrawBuffer,this._refreshRate));d._joinField&&this._getFeature(b.attributes[f])?this._drawBuffer.updates.push({oid:b.attributes[f],updates:b}):this._drawBuffer.adds.push(b)},resume:function(){this.propertyChangeHandler(0)},refresh:function(){this._pendingRequest&&this._cancelPendingRequest(this._pendingRequest);var b=this.featureLayer;b&&(b._relatedUrl||b._keepLatestUrl?
(b._fireUpdateStart(),b._refreshing=!0,b.disconnect(),b.clear(),b._relatedQueried=!1,b._keepLatestQueried=!1,b.connect()):(b._fireUpdateStart(),b.clear(),b._fireUpdateEnd()))},_drawFeatures:function(b,f){var d=this.featureLayer;d._create(b.features||[]);d._fireUpdateEnd(null,f)},_applyTimeFilter:function(b){this.inherited(arguments);this._redrawAllTracks()},_removeFeatures:function(b){var d=this.featureLayer,g=d.objectIdField;b&&f.forEach(b,function(b){b=b.attributes[g];d._unSelectFeatureIIf(b,this);
this._decRefCount(b);this._removeFeatureIIf(b)},this)},_addFeatures:function(b){var d=this.featureLayer,g=d._endTimeField,e=d._startTimeField,a,c,m,k=[],r=[],n=[];a=d._trackManager;c=d.objectIdField;if(a)for(m in b=a.addFeatures(b),b)b.hasOwnProperty(m)&&(k.push(m),b[m].adds&&(r=r.concat(b[m].adds)),b[m].deletes&&(n=n.concat(b[m].deletes)));else r=b;f.forEach(r,function(a){var b=a.attributes[c],d;d=g&&a.attributes[g];!d&&this._maxFeatureAge&&(d=e&&a.attributes[e]?a.attributes[e]+this._maxFeatureAge:
Date.now()+this._maxFeatureAge);d&&(d=1E3*Math.ceil(d/1E3),this._featuresByTime[d]?this._featuresByTime[d].push(b):this._featuresByTime[d]=[b]);this._addFeatureIIf(b,a);this._incRefCount(b)},this);n.length&&this._removeFeatures(n);a&&a.refreshTracks(k)},_updateFeatures:function(b){var d=this.featureLayer,g,e,a=[];g=d._trackManager;e=d._trackIdField;f.forEach(b,function(b){var c=b.updates;b=this._getFeature(b.oid);var f;if(b){c.geometry&&b.setGeometry(c.geometry);c=c.attributes||{};for(f in c)c.hasOwnProperty(f)&&
(b.attributes[f]=c[f]);b.setAttributes(b.attributes);b.visible=this._checkFeatureTimeIntersects(b);g&&b.attributes[e]?a.push(b.attributes[e]):d._repaint(b,null,!0)}},this);a.length&&g.refreshTracks(a)},_redrawAllTracks:function(){var b=this.featureLayer._trackManager,f;b&&(f=b.trimTracks())&&0<f.length&&(this._removeFeatures(f),b.refreshTracks())},_flushDrawBuffer:function(){clearTimeout(this._timeoutId);var b=this._drawBuffer,f=b.adds.splice(0,b.adds.length),g=b.updates.splice(0,b.updates.length),
b=this.featureLayer;if(!b)return!1;b.updating||b._fireUpdateStart();this._addFeatures(f);this._updateFeatures(g);(f=this._getExpiredFeatures())&&f.length&&(this._removeFeatures(f),b._trackManager&&b._trackManager.removeFeatures(f));b._purge();b._fireUpdateEnd();this._timeoutId=null},_clearDrawBuffer:function(){var b=this._timeoutId,f=this._drawBuffer,g=f.adds,f=f.updates;b&&clearTimeout(b);g.splice(0,g.length);f.splice(0,f.length);this._timeoutId=null},_clearTimeBin:function(){this._featuresByTime=
{};this._lastEndTimeCheck=1E3*Math.ceil(Date.now()/1E3)},_clearFeatureMap:function(){this._featureMap={}},_setRefreshRate:function(b){b=b||0===b?b:200;0>b&&(b=200);this._refreshRate=b},_checkFeatureTimeIntersects:function(b){var d=this.featureLayer,f=d.getMap();return(f=f?f.timeExtent:null)&&d.timeInfo&&(d.timeInfo.startTimeField||d.timeInfo.endTimeField)?0<d._filterByTime([b],f.startTime,f.endTime).match.length:!0},_fetchArchive:function(b){var d=new t,f=this.featureLayer,e,a,c,m,k;this._pendingRequest&&
this._cancelPendingRequest(this._pendingRequest);f._fireUpdateStart();b&&this.map?(b=new v(b),e=new u,a=this.map,c=f.getFilter()||{},m=c.where||"1\x3d1",k=c.geometry?g.fromJson(c.geometry):null,c=c.outFields?c.outFields.split(","):["*"],e.geometry=k,e.where=m,e.outFields=c,e.returnGeometry=!0,e.outSpatialReference=new r(a.spatialReference.toJson()),this._pendingRequest=b.execute(e).then(function(a){this._pendingRequest=null;var b=this._fixFieldNameCasing(f,a);a.features=b;this._drawFeatures(a);f._fireUpdateEnd();
d.resolve()}.bind(this)).otherwise(function(a){this._pendingRequest=null;f._errorHandler(a);f._fireUpdateEnd(a);d.reject(a)}.bind(this))):d.resolve();return d.promise},_queryErrorHandler:function(b){var d=this.featureLayer;d._errorHandler(b);d._fireUpdateEnd(b)},_fixFieldNameCasing:function(b,f){var d=f.features||[],e=f.fields;if(!e||!d.length)return d;for(var e=this._mapFieldNameDifferences(b.fields,e),a=[],c,g,l=0,k=f.features.length;l<k;l++)c=d[l],g=this._swizzleResponseAttributes(c.attributes,
e),a.push({geometry:c.geometry,attributes:g});return a},_mapFieldNameDifferences:function(b,f){var d=[],e={},a,c;a=0;for(c=f.length;a<c;a++)d.push(f[a].name);a=0;for(c=b.length;a<c;a++){var g=b[a].name,l=this._checkForStreamFieldName(g,d);l&&(e[l]=g)}return e},_checkForStreamFieldName:function(b,f){for(var d=b.toLowerCase(),e,a=0,c=f.length;a<c;a++)if(f[a].toLowerCase()===d){e=f[a];break}return e},_swizzleResponseAttributes:function(b,f){var d={},e;for(e in b)if(b.hasOwnProperty(e)){var a=b[e];f.hasOwnProperty(e)?
d[f[e]]=a:d[e]=a}return d},_getExpiredFeatures:function(){var b,g,k,e=[],a=[];if(!this.featureLayer._endTimeField&&!this._maxFeatureAge)return a;b=1E3*Math.floor(this._lastEndTimeCheck/1E3);this._lastEndTimeCheck=g=1E3*Math.ceil(Date.now()/1E3);if(b&&b!==g)for(k=this._featuresByTime;b<=g;b+=1E3)k[b]&&(e=e.concat(k[b]),delete k[b]);f.forEach(e,function(b){(b=this._getFeature(b))&&a.push(b)},this);return a}});n("extend-esri")&&k.setObject("layers._StreamMode",q,b);return q})},"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(q,k,f,t,n,b,r,u,v,g){var p=-1!==b.renderer.toLowerCase().indexOf("canvas");q=q(null,{declaredClass:"esri.layers._TrackManager",constructor:function(b){this.layer=b;this.trackMap={};this.trackLineMap={}},initialize:function(b){this.map=b;var d=this.layer,f=d._getRenderer(),f=f&&f.trackRenderer;if("esriGeometryPoint"===d.geometryType){var e=this.container=new g._GraphicsLayer({id:d.id+"_tracks",_child:!0,visible:d.visible,minScale:d.minScale,maxScale:d.maxScale});e.loaded=!0;e.onLoad(e);e._setMap(b,
d._div);if(!p){b=e._div.getNode();var a=d._div.getNode();b&&a&&n.place(b,a,"first")}e.setRenderer(f);d.on("visibility-change",k.hitch(this,function(a){this.container.setVisibility(a.visible);this.container.evaluateSuspension()}));d.on("scale-range-change",k.hitch(this,function(){this.container.setScaleRange(this.layer.minScale,this.layer.maxScale)}))}},addFeatures:function(b){var d=this.trackMap,g=this.layer,e=g._trackIdField,a=[];f.forEach(b,function(b){var c=b.attributes[e];(d[c]=d[c]||[]).push(b);
-1===f.indexOf(a,c)&&a.push(c)});var c=g._startTimeField,m=g.objectIdField,k=function(a,b){var d=a.attributes[c],e=b.attributes[c];return d===e?a.attributes[m]<b.attributes[m]?-1:1:d<e?-1:1};f.forEach(a,function(a){d[a].sort(k)})},trimTracks:function(b){function d(b){for(b=g[b]||[];b.length>e;)a.push(b.shift())}var g=this.trackMap,e=this.layer.maximumTrackPoints||0,a=[],c;if(!e)return a;if(b)f.forEach(b,function(a){d(a)});else for(c in g)g.hasOwnProperty(c)&&d(c);return a},drawTracks:function(b){function d(b){var d=
a[b],f,k,h;k=g.trackLineMap[b];e.remove(k);delete g.trackLineMap[b];k=null;if(!d||2>d.length)return!1;k=[];for(f=d.length-1;0<=f;f--)(h=d[f].geometry)&&k.push([h.x,h.y]);d={};d[m]=b;1<k.length&&(k=new u(new v({paths:[k],spatialReference:c}),null,d),e.add(k),g.trackLineMap[b]=k)}var g=this,e=this.container,a,c,m,k;if(e)if(a=this.trackMap,c=this.map.spatialReference,m=this.layer._trackIdField,b)f.forEach(b,function(a){d(a)});else for(k in a)a.hasOwnProperty(k)&&d(k)},refreshTracks:function(b){function d(b){var d,
f;g.drawTracks([b]);if(c&&c.latestObservationRenderer)for(b=e[b]||[],d=b.length,f=0;f<d;f++)a._repaint(b[f],null,!0)}var g=this,e=this.trackMap,a=this.layer,c=a._getRenderer(),m;if(b)f.forEach(b,function(a){d(a)});else for(m in e)e.hasOwnProperty(m)&&d(m);this.moveLatestToFront()},moveLatestToFront:function(b){f.forEach(this.getLatestObservations(b),function(b){var d=b._shape;d&&d._moveToFront();this._repaint(b,null,!0)},this.layer)},getLatestObservations:function(b){function d(b){b=a[b];return b[b.length-
1]}var g=[],e=this.layer._getRenderer(),a=this.trackMap,c;if(!e.latestObservationRenderer)return g;if(b)f.forEach(b,function(a){g.push(d(a))});else for(c in a)a.hasOwnProperty(c)&&g.push(d(c));return g},clearTracks:function(b){var d=this.getLatestObservations(b),g=this.container,e;b?f.forEach(b,function(a){delete this.trackMap[a];g&&(e=this.trackLineMap[a],g.remove(e),delete this.trackLineMap[a])},this):(this.trackMap={},this.trackLineMap={},g&&g.clear());f.forEach(d,function(a){this._repaint(a,null,
!0)},this.layer)},isLatestObservation:function(b){var d=this.trackMap[b.attributes[this.layer._trackIdField]];return d?d[d.length-1]===b:!1},destroy:function(){var b=this.container;b&&(b.clear(),b._unsetMap(this.map,this.layer._div));this.map=this.layer=this.trackMap=this.container=null}});t("extend-esri")&&k.setObject("layers._TrackManager",q,r);return q})},"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(q,k,f,t,n,b,r,u,v,g,p,d,l){function z(){}function e(a){var b=a.layer;return{geometry:a.geometry,attributes:a.attributes,getLayer:function(){return b}}}q=q(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 e=this;this.heatmapRenderer=
d instanceof p?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);n(["../workers/heatmapCalculator"],function(a){e._calculator=new a(k.mixin({width:e.map.width,height:e.map.height},e._getOptions()));e._setupRenderer();e.heatmapRenderer.getStats=a.calculateStats;e.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 p;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,e=this;b._originalDraw=b._draw;b._draw=z;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=e._getImageBySourceId(e.sourceLayer.id))&&a.hide()}));a.push(b.on("resume",function(a){(a=e._getImageBySourceId(e.sourceLayer.id))&&a.show()}));a.push(f.after(b,"redraw",this._setupDraw));a.push(d.on("layer-remove",function(a){a.layer==b&&((a=e._getImageBySourceId(e.sourceLayer.id))&&e.imageLayer.removeImage(a),e._removeRenderer({target:b}))}));b._collection&&a.push(b.on("graphic-add",
function(a){e._reprojectFeature(a.graphic);e._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)&&t.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(p)&&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=v.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,b=this.map,f=this.heatmapRenderer,l=this.map.extent,r=this.map.width,n=this.map.height,p=this._calculator,u=this,h=function(c){c=u._getScreenPoints(c.features,b,a);c=p.calculateImageData(k.mixin({screenPoints:c,mapinfo:{extent:[l.xmin,l.ymin,l.xmax,l.ymax],resolution:b.getResolution()},width:r,height:n},u._getOptions()));c=f.getSymbol(e({geometry:b.extent,attributes:{size:[r,n],imageData:c},layer:a}));c=new g({extent:b.extent,
href:c.url,opacity:0,sourceId:a.id});u._swapMapImages(c,u._getImageBySourceId(a.id));a.suspended&&c.hide()},y={geometry:b.extent,timeExtent:a.useMapTime?b.timeExtent:void 0,spatialRelationship:d.SPATIAL_REL_INTERSECTS};null!=a._canDoClientSideQuery(y)?a.queryFeatures(y,h):h({features:a.graphics})},_getScreenPoints:function(a,b,d){var c=[],e=a.length,f=0,g=0,m,h=new u(b.extent.xmin,b.extent.ymax,b.spatialReference),k=b.toScreen(h),l=k.x,k=k.y,r=b.getResolution(),n;for((g=b.extent.getCacheValue("_parts"))&&
(n=t.map(g,function(a){return d._intersects(b,a.extent)[0]}));e--;)g=a[e],g.geometry&&(m={x:Math.ceil((g.geometry.x-h.x)/r+l),y:Math.floor((h.y-g.geometry.y)/r-k),attributes:g.attributes},n&&(g=1<n.length&&m.x<-n[0]?n[1]:n[0],m.x+=g),c[f++]=m);return c},_getImageBySourceId:function(a){var b=this.imageLayer.getImages(),b=t.filter(b,function(b){return b.sourceId==a});if(b.length)return b[b.length-1]},_swapMapImages:function(a,b){function c(){d.removeImage(b)}var d=this.imageLayer,e=this.sourceLayer.opacity;
d.addImage(a);l.anim(a._node,{opacity:e},null,null,function(){a.opacity=e});null!=b&&l.anim(b._node,{opacity:0},null,null,c)},_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}});r("extend-esri")&&k.setObject("layers.HeatmapManager",q,b);return q})},"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(q,k,f,t,n,b,r,u,v,g,p,d,l,z,e,a,c,m,D){var x=D.layers.clusters,C=D.widgets.popup,B=x.numFeatures,w=Math.pow(2,53)-1;q=q(b,{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?k.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 e._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 c({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",k.hitch(this,function(){this._applyRenderer();this._initClusterUpdates()})),a.on("load-error",k.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(),c=this._compareStatInfos(this._statisticInfos,b.statisticInfos);c&&(this._statisticInfos=b.statisticInfos,this._clusterGenerator&&(this._clusterGenerator.setStatisticInfos(f.map(this._statisticInfos,function(a){return{attributeInfo:a.attributeInfo,statisticType:a.statisticType}})),a&&f.forEach(a.graphics,function(a){this._applyClusterAttributes(a,
a.getAggregationInfo())},this)));this._renderer=b.renderer;this._applyFields();this._applyInfoTemplate(!!c&&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 l(null,"cluster_count");b.addBreak({minValue:-w,maxValue:w,symbol:a?new a.constructor(a.toJson()):new z(k.clone(this.defaults.markerSymbol))});return b},_createClusterRenderer:function(a){if(!this._isSupportedRenderer(a))return this._getDefaultClusterRenderer();var b,c=[];if(this._isSimpleRenderer(a))b=this._createContinuousCountRenderer(a.symbol);else{b=new a.constructor(a.toJson());var d=this._getRendererAttributeInfo(a),
e;this._isCBRenderer(b)?(e=m.getClusterField(d,"avg"),c.push(this._getStatInfo(d,"avg")),b.normalizationType=null,b.normalizationField=null,b.normalizationTotal=null):this._isUVRenderer(b)&&(e=m.getClusterField(d,"type"),c.push(this._getStatInfo(d,"type")));b.attributeField=e;b.setValueExpression(null);b.valueExpressionTitle=null;b.setVisualVariables(null);this._setRendererTitle(b,a)}a=this._getSupportedVariables(a);d=this._createClusterVariables(a.allVars,c);b.setVisualVariables(d);a.sizeVars.length||
this._isCBSizeRenderer(b)||this._addSizeByCountVariable(b);return{renderer:b,statisticInfos:c}},_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 c=Infinity,d=-Infinity;f.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}c=Math.min(c,b);d=Math.max(d,b)}});return Infinity!==c&&-Infinity!==
d&&c!==d},_getRendererAttributeInfo:function(a){var b=a.attributeField,c=b?this.layer.getField(b):null;return{field:b,attributeType:c&&"esriFieldTypeDate"===c.type?"date":null,rotationType:null,valueExpression:a.valueExpression,valueExpressionTitle:a.valueExpressionTitle,normalizationField:a.normalizationField}},_setRendererTitle:function(a,b){a.legendOptions=k.clone(b.legendOptions);a.legendOptions&&a.legendOptions.title||(a.legendOptions=a.legendOptions||{},a.legendOptions.title=d.getRendererTitle(b,
this.layer))},_getSupportedVariables:function(a){var b=a.getVisualVariablesForType("colorInfo",!1)||[],c=a.getVisualVariablesForType("sizeInfo",!1)||[],d=a.getVisualVariablesForType("opacityInfo",!1)||[];a=a.getVisualVariablesForType("rotationInfo",!1)||[];b=f.filter(b,this._variableFilter);c=f.filter(c,this._variableFilter);d=f.filter(d,this._variableFilter);a=f.filter(a,this._variableFilter);return{sizeVars:c,allVars:b.concat(c).concat(d).concat(a)}},_variableFilter:function(a){return"function"!==
typeof a.field},_createClusterVariables:function(a,b){return f.map(a,function(a){return this._createVarForAvg(a,b)},this)},_createVarForAvg:function(a,b){var c=k.clone(a),d=this._getVariableAttributeInfo(a);c.field=m.getClusterField(d,"avg");c.normalizationField=null;c.valueExpression=null;c.valueExpressionTitle=null;d=this._getStatInfo(d,"avg");this._addStatInfo(b,d);this._setVariableTitle(c,a);return c},_getVariableAttributeInfo:function(a){var b="rotationInfo"===a.type,c=b?"angle":null,b=b?a.rotationType:
null,d=a.legendOptions&&a.legendOptions.title,e=a.field,f=e?this.layer.getField(e):null;f&&"esriFieldTypeDate"===f.type&&(c="date");return{field:e,attributeType:c,rotationType:b,valueExpression:a.valueExpression,valueExpressionTitle:a.valueExpressionTitle||a.valueExpression&&d,normalizationField:a.normalizationField}},_setVariableTitle:function(a,b){a.legendOptions&&a.legendOptions.title||(a.legendOptions=a.legendOptions||{},a.legendOptions.title=d.getVisualVariableTitle(b,this.layer))},_getStatInfo:function(a,
b){return{statisticHash:m.getStatisticHash(a,b),attributeInfo:a,statisticType:b}},_addStatInfo:function(a,b){var c=this._findStatInfo(a,b);c?c.attributeInfo.valueExpressionTitle||(c.attributeInfo.valueExpressionTitle=b.attributeInfo.valueExpressionTitle):a.push(b)},_findStatInfo:function(a,b){var c;f.some(a,function(a){a.statisticHash===b.statisticHash&&(c=a);return!!c});return c},_compareStatInfos:function(a,b){var c=f.filter(a,function(a){return!this._findStatInfo(b,a)},this),d=f.filter(b,function(b){return!this._findStatInfo(a,
b)},this);return d.length||c.length?{added:d,removed:c}:null},_addSizeByCountVariable:function(a){var b=this._createSizeByCountVariable();b&&this._addVariable(a,b)},_getSizeByCountVariable:function(a){a=a.getVisualVariablesForType("sizeInfo",!1)||[];return f.filter(a,function(a){return"cluster_count"===a.field})[0]},_updateSizeByCountVariable:function(){var a=this._renderer,b=this._getSizeByCountVariable(a);if(b){var c=this._createSizeByCountVariable();c&&this._replaceVariable(a,b,c)}},_createSizeByCountVariable:function(){var a=
this._clusterGenerator,b;if(a){b=a.getCurrentLodStats();var c=a.getNumFeatures(),a=a.clusters,d=b.min,e=b.max;1===b.count&&d===c||1===a.length&&a[0].count===c?(d=1,e=c):d&&d===e&&(e=2*d);b={type:"sizeInfo",field:"cluster_count",valueUnit:"unknown",minSize:12,maxSize:50,minDataValue:d,maxDataValue:e,legendOptions:{title:B}}}return b},_addVariable:function(a,b){var c=a.visualVariables||[];c.push(b);a.setVisualVariables(c)},_replaceVariable:function(a,b,c){var d=a.visualVariables;b=f.indexOf(d,b);-1<
b&&d.splice(b,1);d.push(c);a.setVisualVariables(d)},_getFields:function(b){var c=[new a({name:"cluster_count",type:"esriFieldTypeInteger"})];f.forEach(b,function(b){var d=b.statisticType;b=b.attributeInfo;var e;"avg"===d?e="date"===b.attributeType?"esriFieldTypeDate":"esriFieldTypeDouble":"type"===d&&(e=b.field?this.layer.getField(b.field).type:"esriFieldTypeString");c.push(new a({name:m.getClusterField(b,d),type:e}))},this);return c},_createInfoTemplate:function(){var a=this._statisticInfos,b=this._renderer,
c=[{fieldName:"cluster_count",label:B,visible:!0,format:{digitSeparator:!0,places:0}}],d=[],e=[u.substitute({count:"{cluster_count}"},x.countSummary)],g=this._isUVRenderer(b)?b.infos:[];f.forEach(a,function(a){var b,f,h=a.statisticType,k=a.attributeInfo,l=m.getClusterField(k,h),n=this._getFieldLabel(a);"avg"===h?(b={fieldName:l,label:n,visible:!0,format:"date"===k.attributeType?{dateFormat:"shortDateShortTime"}:{digitSeparator:!0,places:1}},f=this._getFieldSummary(a,l)):"type"===h&&(f="expression/"+
l,b={fieldName:f,visible:!0},d.push({name:l,title:n,returnType:"string",expression:this._getExpression(g,l)}),f=this._getFieldSummary(a,f));b&&c.push(b);f&&e.push(f)},this);return new p({fieldInfos:c,expressionInfos:d,description:e.join("\x3cbr/\x3e\x3cbr/\x3e")})},_updateInfoTemplate:function(a){var b=a.toJson(),c=this._isUVRenderer(this._renderer)?this._renderer.infos:[];f.forEach(this._statisticInfos,function(a){var d=a.statisticType;a=m.getClusterField(a.attributeInfo,d);"type"===d&&(d=this._findExpressionInfo(a,
b))&&(d.expression=this._getExpression(c,a))},this);return new p(b)},_findExpressionInfo:function(a,b){var c;f.some(b.expressionInfos,function(b){b.name===a&&(c=b);return!!c});return c},_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(x.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 f.map(a,function(a){return'{"value": "'+String(a.value)+'","label": "'+this._escapeDoubleQuotes(String(a.label))+'"}'},this)},_getFieldLabel:function(a){var b=a.statisticType,c=a.attributeInfo,d=c.field;a=c.normalizationField;var e="",f;"avg"===b?f=a?x.avgNormFieldLabel:x.avgFieldLabel:"type"===b&&(f=x.predominantFieldLabel);f&&(b=c.valueExpression?c.valueExpressionTitle:this.layer.getFieldLabel(d),a=a&&this.layer.getFieldLabel(a),e=u.substitute({fieldLabel:b||"",normFieldLabel:a||
""},f));return e},_getFieldSummary:function(a,b){var c=a.statisticType,d=a.attributeInfo,e=d.field,f=d.normalizationField,g="",h;"avg"===c?h=f?x.avgNormFieldSummary:x.avgFieldSummary:"type"===c&&(h=x.predominantFieldSummary);h&&(c=d.valueExpression?d.valueExpressionTitle:this.layer.getFieldLabel(e),f=f&&this.layer.getFieldLabel(f),g=u.substitute({fieldLabel:c||"",normFieldLabel:f||"",fieldValue:"{"+b+"}"},h));return g},_removeFromPopup:function(a){var b=this._map.infoWindow,c=b.features;if(c&&c.length){var d=
f.filter(c,function(b){return b.getLayer()!==a});d.length<c.length&&(d.length?b.setFeatures(d):(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 c=b.clusterFillSymbol;c&&(c=new c.constructor(c.toJson()));c=new r(a,c);this._map.graphics.add(c);
this._clusterBoundary=c},_removeClusterBoundary:function(){this._map.graphics.remove(this._clusterBoundary);this._clusterBoundary=null},_createBrowseFeaturesAction:function(){return this._map.infoWindow.addActions([{title:C.NLS_browseFeatures,className:"browseFeatures",callback:k.hitch(this,function(a){a.preventDefault();a=this._map.infoWindow;var b=a.getSelectedFeature(),c=b.getChildGraphics(),d=a.getCurrentAnchor();a.setFeatures(c,{anchor:d});if(c=g.graphicsExtent(c))this._addClusterBoundary(c,
a),a.show(this._getPopupLocation(c,d));this._popupClusterGraphic=b})}])[0]},_getPopupLocation:function(a,b){var c=a.getCenter();b=b.toLowerCase();-1<b.indexOf("top")?c.update(c.x,a.ymax):-1<b.indexOf("bottom")?c.update(c.x,a.ymin):-1<b.indexOf("left")?c.update(a.xmin,c.y):c.update(a.xmax,c.y);return c},_createViewSummaryAction:function(){return this._map.infoWindow.addActions([{title:C.NLS_viewSummary,className:"viewSummary",callback:k.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",k.hitch(this,function(a){a.mapLevelChange&&this._updateSizeVariable();this._updateClusterGraphics()})),this._clusterGenerator.on("index-complete",k.hitch(this,function(){this._updateSizeVariable()})))},_updateClusterGraphics:function(){this._hideSingleGraphics();
var a=[],b=[];f.forEach(this._clusterGenerator.clusters,function(c){var d=new r(c.centroid);d.setAggregationSourceLayer(this.layer);d.setAggregationInfo(c);this._applyClusterAttributes(d,c);1===c.count?(c=this._getSingleGraphic(d),b.push(c)):a.push(d)},this);this._showSingleGraphics(b);this._addGraphics(a)},_addGraphics:function(a){var b=this.container;b.clear();f.forEach(a,function(a){b.add(a)})},_getSingleGraphic:function(a){var b=this._clusterGenerator.getCell(a.getAggregationInfo().primary).features[0],
c=this.layer.renderer,c=c&&c.getSymbol(b),d=this._getSizeByCountVariable(this._renderer);c&&d&&(a=d?this._renderer.getSize(a,{sizeInfo:d,shape:c.style,resolution:this._map.getResolutionInMeters(),scale:this._map.getScale()}):null,b.setSize(a));return b},_showSingleGraphics:function(a){f.forEach(a,this._showSingleGraphic);this._singleGraphics=a},_hideSingleGraphics:function(){f.forEach(this._singleGraphics,function(a){a.setSize(null);this._hideSingleGraphic(a)},this);this._singleGraphics=null},_clearSingleGraphics:function(){f.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",k.hitch(this,
function(a){this.container.setVisibility(a.visible)})),a.on("scale-range-change",k.hitch(this,function(){this.container.setScaleRange(this.layer.minScale,this.layer.maxScale)})),a.on("renderer-change",k.hitch(this,function(){this._applyRenderer()})),a.on("info-template-change",k.hitch(this,function(){this._applyInfoTemplate()})))},_createMapEventListeners:function(){this._eventHandles.push(this._map.on("zoom-start",k.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",k.hitch(this,function(){this._resetClusterNavPartial();var a=this._map.infoWindow.getSelectedFeature(),b=a&&a.getLayer();if(b){var c;b===this.container?(this._removeClusterBoundary(),c=this._createBrowseFeaturesAction()):b===this.layer&&a._suspended?(c=this._createViewSummaryAction(),
this._popupSingleGraphic=a,this._showSingleGraphic(a)):this._removeClusterBoundary();this._popupActions=c?[c]:null}})),a.on("clear-features",k.hitch(this,function(a){this._resetClusterNav();a.isIntermediate||this._removeClusterBoundary()})),a.on("hide",k.hitch(this,function(){this._popupSingleGraphic&&this._popupSingleGraphic.hide();this._clusterBoundary&&this._clusterBoundary.hide()})),a.on("show",k.hitch(this,function(){this._popupSingleGraphic&&this._popupSingleGraphic.show();this._clusterBoundary&&
this._clusterBoundary.show()})))},_destroyEventListeners:function(){f.forEach(this._eventHandles,function(a){a.remove()})}});t("extend-esri")&&k.setObject("layers.clustering.ClusterManager",q,n);return q})},"esri/dijit/Legend/utils":function(){define(["dojo/_base/lang","../../lang","dojo/i18n!../../nls/jsapi"],function(q,k,f){var t=f.widgets.legend;return{getVisualVariableTitle:function(f,b){var r,n=f.field,v=f.normalizationField,g=!1,p=!1,d=!1,l,n=q.isFunction(n)?null:n,v=q.isFunction(v)?null:v;
if(f.legendOptions&&f.legendOptions.title)r=f.legendOptions.title;else if(f.valueExpressionTitle)r=f.valueExpressionTitle;else{if(b.renderer&&b.renderer.authoringInfo&&b.renderer.authoringInfo.visualVariables){var z=b.renderer.authoringInfo.visualVariables;for(l=0;l<z.length;l++){var e=z[l];if("colorInfo"===e.type&&"ratio"===e.style){g=!0;break}else if("colorInfo"===e.type&&"percent"===e.style){p=!0;break}else if("colorInfo"===e.type&&"percentTotal"===e.style){d=!0;break}}}(g=d&&"showRatioPercentTotal"||
p&&"showRatioPercent"||g&&"showRatio"||v&&"showNormField"||n&&"showField"||null)&&(r=k.substitute({field:n&&b.getFieldLabel(n),normField:v&&b.getFieldLabel(v)},t[g]))}return r},getRendererTitle:function(f,b){var r;if(f){var n,v,g;"esri.renderer.ClassBreaksRenderer"===f.declaredClass&&(n=f.attributeField,v=f.normalizationField,g="percent-of-total"===f.normalizationType);n=q.isFunction(n)?null:n;v=q.isFunction(v)?null:v;f.legendOptions&&f.legendOptions.title?r=f.legendOptions.title:f.valueExpressionTitle?
r=f.valueExpressionTitle:(g=v&&"showNormField"||(g?"showNormPct":null)||n&&"showField"||null)&&(r=k.substitute({field:n&&b.getFieldLabel(n),normField:v&&b.getFieldLabel(v)},t[g]))}return r}}})},"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(q,k,f,t,n,b,r,u,v,g,p,d,l,z){k=k(b,{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(b){this._update=f.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=b.map;this.layer=b.layer;this.setLod(b.lod);this.setTolerance(b.tolerance);this.setClusterMode(b.clusterMode);
this.setClusterRadius(b.clusterRadius);this.setSortEnabled(b.sortEnabled);this.setFilterEnabled(b.filterEnabled);this.setBufferEnabled(b.bufferEnabled);this.setUpdateEnabled(b.updateEnabled);this.setStatisticInfos(b.statisticInfos);this._load();this.loaded?this._startup():this._eventHandles.push(this.on("load",f.hitch(this,this._startup)))},destroy:function(b){this._displayFeatures(!0,b);t.forEach(this._eventHandles,function(a){a.remove()});p.clearTimeout(this._updateHandle);this._cellIndex=this._globalIndex=
this._eventHandles=this._updateHandle=this.map=this.layer=this.clusters=null},setLod:function(b){var a=this.lod;this.lod=b||this.defaults.lod;a!==this.lod&&this.update()},setTolerance:function(b){var a=this.tolerance;this.tolerance=b||this.defaults.tolerance;a!==this.tolerance&&this.update()},setClusterMode:function(b){var a=this.clusterMode;this.clusterMode=b||this.defaults.clusterMode;this._evalClusterParams();a!==this.clusterMode&&this.update()},setClusterRadius:function(b){var a=this.clusterRadius;
this.clusterRadius=null!=b?b:this.defaults.clusterRadius;this._evalClusterParams();a!==this.clusterRadius&&this.update()},setSortEnabled:function(b){var a=this.sortEnabled;this.sortEnabled=null!=b?!!b:this.defaults.sortEnabled;a!==this.sortEnabled&&this.update()},setFilterEnabled:function(b){var a=this.filterEnabled;this.filterEnabled=null!=b?!!b:this.defaults.filterEnabled;a!==this.filterEnabled&&this.update()},setBufferEnabled:function(b){var a=this.bufferEnabled;this.bufferEnabled=null!=b?!!b:
this.defaults.bufferEnabled;a!==this.bufferEnabled&&this.update()},setUpdateEnabled:function(b){var a=this.updateEnabled;(this.updateEnabled=null!=b?!!b:this.defaults.updateEnabled)&&a!==this.updateEnabled&&(this._mapLevelChange=!0,this.update())},setStatisticInfos:function(b){this.statisticInfos=b||[];this.loaded&&this._applyStatInfos(this.statisticInfos)},update:function(){this.loaded&&null==this._updateHandle&&(this._updateHandle=p.setTimeout(this._update,p.priority.HIGH))},isUpdateScheduled:function(){return null!=
this._updateHandle},getCell:function(b){return this._cellIndex[b.length][b]},getCluster:function(b){var a;t.some(this.clusters,function(c){-1<t.indexOf(c.geohashes,b)&&(a=c);return!!a});return a},getCellsInCluster:function(b){var a=[];t.forEach(b&&b.geohashes,function(b){(b=this.getCell(b))&&a.push(b)},this);return a},getFeaturesInCluster:function(b){var a=[];b=this.getCellsInCluster(b);t.forEach(b,function(b){Array.prototype.push.apply(a,b.features)});return a},getCurrentLodStats:function(){var b=
this._globalIndex.lodStats;return b&&b[this.lod]},getNumFeatures:function(){return this._globalIndex.numFeatures},getFullExtent:function(){var b=this._globalIndex.fullExtent;return b&&Infinity!==b.xmin?new u(b):null},_load:function(){this._displayFeatures(!1);this._checkLoadStatus();this.map.loaded||this._eventHandles.push(this.map.on("load",f.hitch(this,this._checkLoadStatus)));this.layer.loaded||this._eventHandles.push(this.layer.on("load",f.hitch(this,this._checkLoadStatus)))},_checkLoadStatus:function(){if(this.map.loaded&&
this.layer.loaded){var b;if("esriGeometryPoint"!==this.layer.geometryType)b=Error("GeohashAggregation is supported only for points");else{var a=this.map.spatialReference;a.isWebMercator()||4326===a.wkid||(b=Error("GeohashAggregation is supported only when map spatial reference is WGS84 or WebMercator"))}b?(this.loadError=b,this.emit("load-error",{error:b})):(this.loaded=!0,this.emit("load"))}},_startup:function(){this._evalUpdateStatus();this._processFeatures();this._processExtentChange();this._eventHandles.push(this.layer.on("update-end",
f.hitch(this,this._processFeatures)),this.layer.on("edits-complete",f.hitch(this,this._processFeatures)),this.layer.on("graphics-clear",f.hitch(this,this._processFeatures)),this.layer.on("suspend",f.hitch(this,this._evalUpdateStatus)),this.layer.on("resume",f.hitch(this,this._evalUpdateStatus)),this.map.on("extent-change",f.hitch(this,this._processExtentChange)))},_processFeatures:function(){this._indexFeatures();this.update()},_evalUpdateStatus:function(){this.setUpdateEnabled(!this.layer.suspended)},
_processExtentChange:function(b){this._mapLevelChange=!(!b||!b.levelChange);this._evalClusterParams();this.update()},_update:function(){this._updateHandle=null;if(this.updateEnabled){this.emit("update-start");if(this.clustersEnabled){var b=this.map.geographicExtent;if(b){var a=this._getIntersectingCells(b),b=this._getClusters(a.cells,b);this.clusters=b.clusters;this._applyStatInfosToClusters();var a=a.profile,b=b.profile,c=a.total+b.total;a.total=this._getElapsedTime(a.total);b.total=this._getElapsedTime(b.total);
var d=this._perfProfile.lastUpdate={};d.cells=a;d.clusters=b;d.total=this._getElapsedTime(c)}}else this.clusters=[],this._perfProfile.lastUpdate=null;a=this._mapLevelChange;this._mapLevelChange=!1;this.emit("update-end",{levelChange:this._levelChange,mapLevelChange:a})}},_displayFeatures:function(b,a){var c=this.layer,d=!b;c.suspendGraphics(d);!1!==a&&(d?c.clearNodes():c.redraw())},_indexFeatures:function(){var b=this._getTime();this._initializeIndexing();var a=0,c=this._globalIndex.fullExtent;t.forEach(this.layer.graphics,
function(b){if(b.visible){var d=b.geometry,e=this._getLngLat(d),f;e&&(f=d.getCacheValue("_geohash"),void 0===f&&(f=l.pointToGeohash(e),d.setCacheValue("_geohash",f||null)));f&&(this._addGeohashToIndex(f,b,e),a++,this._updateExtent(c,e))}},this);this._applyStatInfosToIndex();this._globalIndex.numFeatures=a;for(var d=this._globalIndex.lodStats,f=1;f<=this._maxGeohashLength;f++)d[f]=this._getLODStats(f,a);this._perfProfile.lastIndex.total=this._getElapsedTime(b,this._getTime());this._perfProfile.lastIndex.numFeatures=
a;this.emit("index-complete")},_initializeIndexing:function(){this._globalIndex={numFeatures:0,fullExtent:{xmin:Infinity,ymin:Infinity,xmax:-Infinity,ymax:-Infinity},lodStats:{}};for(var b=this._cellIndex=[],a=1;a<=this._maxGeohashLength;a++)b[a]={}},_getLngLat:function(b){if(b){var a=b.getLongitude();b=b.getLatitude();b=null!=a&&null!=b?{x:a,y:b}:null}return b},_addGeohashToIndex:function(b,a,c){for(var d=this._cellIndex,e="",f=0;f<this._maxGeohashLength;f++){var e=e+b[f],g=d[e.length],k=g[e];k||
(k=g[e]={count:0,centroid:{x:null,y:null},extent:{xmin:Infinity,ymin:Infinity,xmax:-Infinity,ymax:-Infinity},features:[],geohash:e,statistics:null});this._updateItem(k,1,c,!0);k.features.push(a)}},_getLODStats:function(b,a){var c=this._cellIndex[b],d=0,e=Infinity,f=-Infinity,g=null,k;for(k in c){var l=c[k];d++;l.count<e&&(e=l.count);l.count>f&&(f=l.count)}0<d&&(g=Number((a/d).toFixed(2)));return{lod:b,count:d,min:Infinity===e?null:e,max:-Infinity===f?null:f,avg:g}},_evalClusterParams:function(){if(this.loaded&&
"auto"===this.clusterMode){var b=this._getClusterParams(this.map.getResolutionInMeters(),this.clusterRadius,this._minClusterRadius);this._levelChange=this.lod!==b.lod;this.lod=b.lod;this.tolerance=b.tolerance}},_getClusterParams:function(b,a,c){a<c&&(a=c);b=Math.ceil(b*a);a=this._getClosestLODRange(b).max;do c=this._getCellSize(a),(c=b>=this._cellSizeScaleFactor*c||1===c)||(a+=1);while(!c);c=b/this._getCellSize(a);return{lod:a,tolerance:b,multiplier:Number(c.toFixed(2))}},_getClosestLODRange:function(b){for(var a,
c=this._maxGeohashLength;1<=c;c--)if(this._getCellSize(c)>=b){a=c;break}null==a&&(a=1);b=a+1;b>this._maxGeohashLength&&(b=this._maxGeohashLength);return{min:a,max:b}},_getCellSize:function(b){b=l.getCellSizeInMeters(b);return Math.ceil(Math.min(b.width,b.height))},_sorter:function(b,a){var c=b.centroid,d=a.centroid;return b.count>a.count?-1:b.count<a.count?1:c.x>d.x?-1:c.x<d.x?1:0},_getIntersectingCells:function(b){var a=this._getTime();b=b.expand(this._extentScaleFactor);var c=l.getIntersecting(b,
this.lod,this.bufferEnabled?this.tolerance:0);b=this._getTime();var d=[],e=this.tolerance,f=this.sortEnabled;t.forEach(c,function(a){(a=this.getCell(a))&&d.push(a)},this);e&&f&&d.sort(this._sorter);c=this._getTime();return{cells:d,profile:{findCells:this._getElapsedTime(a,b),scanAndSortCells:this._getElapsedTime(b,c),total:c-a}}},_getClusters:function(b,a){var c=this._getTime(),d=[],e={},f={findCells:0};t.forEach(b,function(a,b){var c=this._createCluster(a,e,f);c&&d.push(c)},this);this._markIntersecting(d,
a);this.filterEnabled&&(d=this._getIntersectingClusters(d));var g=this._getTime();return{clusters:d,profile:{findCellsInCluster:this._getElapsedTime(f.findCells),total:g-c}}},_markIntersecting:function(b,a){var c=a.normalize();t.forEach(b,function(a){var b=a.centroid.x,d=a.centroid.y;a.isIntersecting=t.some(c,function(a){return b>=a.xmin&&b<=a.xmax&&d>=a.ymin&&d<=a.ymax})})},_getIntersectingClusters:function(b){return t.filter(b,function(a){return a.isIntersecting})},_createCluster:function(b,a,c){if(!a[b.geohash]){var d=
[{cell:b,distance:0}];if(this.tolerance){var e=this._getTime(),f=l.getNeighborsWithinDistance(b.centroid,this.lod,this.tolerance);c.findCells+=this._getTime()-e;t.forEach(f,function(a){if(a!==b.geohash&&(a=this.getCell(a))){var c=this._calculateDistance(b.centroid,a.centroid);c<=this.tolerance&&d.push({cell:a,distance:c})}},this)}return this._mergeCells(d,a)}},_calculateDistance:function(b,a){return v.getLength(l.geographicToWebMercator(b),l.geographicToWebMercator(a))},_mergeCells:function(b,a){var c=
this._initializeCluster({},b[0].cell.geohash);t.forEach(b,function(b){var d=b.cell,e=d.geohash;b=b.distance;var f=a[e];if(f)if(b<f.distance)this._removeCellFromCluster(e,a);else return;a[e]={cluster:c,distance:b};this._updateItem(c,d.count,d.centroid);c.geohashes.push(e)},this);return c},_removeCellFromCluster:function(b,a){var c=a[b].cluster;delete a[b];var d=t.indexOf(c.geohashes,b);-1<d&&c.geohashes.splice(d,1);this._reevaluateCluster(c)},_reevaluateCluster:function(b){var a=b.geohashes;b=this._initializeCluster(b,
b.primary);t.forEach(a,function(a){var c=this.getCell(a);c&&(this._updateItem(b,c.count,c.centroid),b.geohashes.push(a))},this)},_initializeCluster:function(b,a){b.count=0;b.centroid=new r(null,null);b.geohashes=[];b.primary=a;b.statistics=null;return b},_applyStatInfos:function(b){b=this._getValidStatInfos(b);this._applyStatInfosToIndex(b);this._applyStatInfosToClusters(b)},_getValidStatInfos:function(b){var a=[];t.forEach(b,function(b){var c=b.attributeInfo;b=b.statisticType;var f="angle"===c.attributeType;
if(z.isSupportedStatisticType(b)&&(!f||"avg"===b)){var e="arithmetic"===c.rotationType;a.push({attributeCache:d.createAttributeCache(c,"type"===b),identifier:z.getStatisticId(c,b),statFunctions:z.getStatisticFunctions(b),isAngular:f,isDate:"date"===c.attributeType,isArithmetic:e})}});return a},_applyStatInfosToIndex:function(b){b=b||this._getValidStatInfos(this.statisticInfos);var a=this._cellIndex;if(a)for(var c=1;c<=this._maxGeohashLength;c++){var d=a[c],f;for(f in d)this._applyStatInfosToCell(d[f],
b)}},_applyStatInfosToCell:function(b,a){var c=this._initializeStats(b,a);t.forEach(b.features,function(b){this._calcFeatureStats(b,a,c)},this);this._summarizeStats(b,c,a)},_calcFeatureStats:function(b,a,c){b.attributes&&t.forEach(a,function(a){var d=c[a.identifier],f=a.attributeCache,f=f?b._getDataValue(f.attributeInfo,f,g):null;a.statFunctions.updateCellStat(d,f,a)})},_applyStatInfosToClusters:function(b){b=b||this._getValidStatInfos(this.statisticInfos);var a=this._clusterFieldPrefix;t.forEach(this.clusters,
function(c){var d=this._initializeStats(c,b);t.forEach(this.getCellsInCluster(c),function(a){this._calcCellStats(a,b,d)},this);this._summarizeStats(c,d,b,a);c.attributes[a+"id"]=c.primary},this)},_calcCellStats:function(b,a,c){var d=b.statistics;t.forEach(a,function(a){var b=a.identifier;a.statFunctions.updateClusterStat(c[b],d[b],a)})},_initializeStats:function(b,a){var c=b.statistics={};t.forEach(a,function(a){c[a.identifier]=a.statFunctions.initialize(a)});return c},_summarizeStats:function(b,
a,c,d){var f=b.attributes={};d=d||"";f[d+"count"]=b.count;t.forEach(c,function(b){var c=this._getStatFieldName(b,d);f[c]=b.statFunctions.summarize(a[b.identifier],b)},this)},_getStatFieldName:function(b,a){return(a||"")+b.identifier},_updateItem:function(b,a,c,d){var f=c.y,e=b.centroid,g=b.count;e.x=(g*e.x+a*c.x)/(g+a);e.y=(g*e.y+a*f)/(g+a);b.count+=a;d&&this._updateExtent(b.extent,c)},_updateExtent:function(b,a){var c=a.x,d=a.y;c<b.xmin&&(b.xmin=c);c>b.xmax&&(b.xmax=c);d<b.ymin&&(b.ymin=d);d>b.ymax&&
(b.ymax=d)},_getTime:function(){return window.performance?window.performance.now():(new Date).getTime()},_getElapsedTime:function(b,a){var c,d;d=null!=b&&null!=a?a-b:b;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}});q("extend-esri")&&f.setObject("layers.clustering.GeohashAggregation",k,n);return k})},"esri/core/timerUtils":function(){define([],function(){function q(b){var f,k=b.length;for(f=0;f<k;f++)b[f]()}var k={LOW:1,
HIGH:2},f,t={};t[k.LOW]=[];t[k.HIGH]=[];var n=function(){clearTimeout(f);f=null;var b=t[k.HIGH];t[k.HIGH]=[];q(b);b=t[k.LOW];t[k.LOW]=[];q(b)};return{priority:k,callbackQueue:t,setTimeout:function(b,k){var r=[k,t[k].push(b)-1];f||(f=setTimeout(n,0));return r},clearTimeout:function(b){b&&t[b[0]].splice(b[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(q,k,f,t,n,b,r,u,v){function g(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 p(a){var b=a.spatialReference,c=!(!b||!b.isWebMercator()),d;b&&4326===b.wkid?d=new r(a.toJson()):c&&(d=v.webMercatorToGeographic(a,!0));return d}function d(a,c){c.x=b.prototype._normalizeX(a.x,u.prototype._info[4326]);c.y=a.y;return c}function l(a){a=H.decimals[a].toString(2);return k.pad(a,
H.bitsPerBase32Char,"0")}function z(a,b){var c;b=b.slice();b.splice(1,0,0);for(var d=b[0],f=b[2],e=0;e<a.length;e++)Number(a[e])?b[0]=b[1]:b[2]=b[1],c=b[1]=(b[0]+b[2])/2,d=b[0],f=b[2];return{value:c,min:d,max:f}}function e(a,b,c){var d=[];b=b.slice();b.splice(1,0,0);for(var f=b[0],e=b[2],g=0;g<c;g++)a>=b[1]?(b[0]=b[1],f=1):(b[2]=b[1],f=0),b[1]=(b[0]+b[2])/2,d.push(f),f=b[0],e=b[2];return{value:d.join(""),min:f,max:e}}function a(a){var b=a*H.bitsPerBase32Char;0===b%2?a=b/=2:(a=(b+1)/2,b-=a);return{lon:a,
lat:b}}function c(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 H.base32[b]}function m(a,b){var c={x:a.xmin,y:a.ymax},d={x:a.xmax,y:a.ymin},f={x:a.xmax,y:a.ymax};return{sw:K.pointToGeohash({x:a.xmin,y:a.ymin},b),nw:K.pointToGeohash(c,b),se:K.pointToGeohash(d,b),ne:K.pointToGeohash(f,b)}}function D(a,b,c,d,f){var e=a;do f[e]||(f[e]=!0,d.push(e)),(a=e===b)||(e=G(e,c));while(!a)}function x(a,b,c,d){var f=m(a,b);a=[];D(f.sw,f.nw,"n",a,{});
b=[];D(f.se,f.ne,"n",b,{});for(f=0;f<a.length;f++)D(a[f],b[f],"e",c,d)}function C(a){return t.filter(a,function(a){return 180===a.xmax?!0:!1})[0]}function B(a){return t.filter(a,function(a){return-180===a.xmin?!0:!1})[0]}function w(a,b,c,d){var f=K.geographicToWebMercator(a);a={x:f.x-b,y:f.y-b};b=K.webMercatorToGeographic({x:f.x+b,y:f.y+b},!0);a=K.webMercatorToGeographic(a,!0);return new r(null!=c?c:a.x,a.y,null!=d?d:b.x,b.y)}function h(a,b,c,d){var f;a=m(a,b);var e,g;"min"===d?g=180:"max"===d&&(e=
-180);var h=e;d=g;f=K.geohashToCell(a.sw).extent;b=K.geohashToCell(a.ne).extent;a=null!=h?h:f.xmin;f=f.ymin;d=null!=d?d:b.xmax;b=b.ymax;a=w({x:a,y:f},c,e,g);c=w({x:d,y:b},c,e,g);return new r(a.xmin,a.ymin,c.xmax,c.ymax)}function y(a,b,c){var d=a,f=0;do f++,(a=d===b)||(d=G(d,c));while(!a);return f}function A(a,b){var c=m(a,b),d=y(c.nw,c.ne,"e");return{rows:y(c.nw,c.sw,"s"),cols:d}}function G(a,b){var c=a.length%2,d=a.slice(-1),f=H.decimals[d],e=a.slice(0,-1);-1!=H.borders[b][c].indexOf(d)&&e&&(e=G(e,
b));return e+H.neighbors[b][c][f]}var H={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]};H.neighbors.n[0]="14365h7k9dcfesgujnmqp0r2twvyx8zb";H.neighbors.s[0]="p0r21436x8zb9dcf5h7kjnmqesgutwvy";H.neighbors.e[0]="238967debc01fg45kmstqrwxuvhjyznp";H.neighbors.w[0]="bc01fg45238967deuvhjyznpkmstqrwx";H.borders.n[0]="prxz";H.borders.s[0]="028b";H.borders.e[0]="bcfguvyz";H.borders.w[0]="0145hjnp";var K={geographicToWebMercator:function(a){a=b.lngLatToXY(a.x,a.y);return{x:a[0],y:a[1]}},webMercatorToGeographic:function(a,c){var d=b.xyToLngLat(a.x,a.y,c);return{x:d[0],
y:d[1]}},geohashToCell:function(a){for(var b=[],c=0;c<a.length;c++)b.push(l(a[c]));for(var b=b.join(""),c=[],d=[],f=0;f<b.length;f++)0===f%2?c.push(b[f]):d.push(b[f]);c=c.join("");d=d.join("");c=[c,d];b=z(c[0],H.longitudeRange);c=z(c[1],H.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(b,f){var h,k,l;f=f||H.maxGeohashLength;var m=g(b);if(m){m=d(m,m);h=a(f);l=e(m.x,H.longitudeRange,h.lon);var n=e(m.y,H.latitudeRange,
h.lat);h=l.value;k=n.value;l={xmin:l.min,xmax:l.max,ymin:n.min,ymax:n.max};for(var n=[],r=Math.ceil((h.length+k.length)/H.bitsPerBase32Char),p=0,t=0,u=0;u<r*H.bitsPerBase32Char;u++){var q=0===u%2?h[p++]:k[t++];null==q&&(q=0);n.push(q)}h=n.join("");k=H.bitsPerBase32Char;n=h.length/k;r=[];for(p=0;p<n;p++)t=h.substr(p*k,k),r.push(c(t));h=r.join("");return{point:m,extent:l,geohash:h}}},geohashToPoint:function(a){return K.geohashToCell(a).point},pointToGeohash:function(a,b){var c=K.pointToCell(a,b);return c&&
c.geohash},getCells:function(a){return t.map(a,function(a){return K.geohashToCell(a)})},getCellSize:function(b){var c=H.longitudeRange,d=H.latitudeRange,c=Math.abs(c[1]-c[0]),d=Math.abs(d[1]-d[0]);b=a(b||1);return{width:c/Math.pow(2,b.lon),height:d/Math.pow(2,b.lat)}},getCellSizeInMeters:function(a){a=K.getCellSize(a);var b=v.metersPerDegree;a.width*=b;a.height*=b;return a},getIntersecting:function(a,b,c){b=b||1;c=c||0;var d=[],f=p(a);if(f){c&&(f=K.expandExtent(a,b,c));a=f.normalize();var e={};t.forEach(a,
function(a){x(a,b,d,e)})}return d},countIntersecting:function(a,b,c){b=b||1;c=c||0;var f=0,e=p(a);if(e){c&&(e=K.expandExtent(a,b,c));a=e.normalize();if(2===a.length){f=C(a);e=B(a);c=A(f,b);var g=A(e,b);a=c.rows;c=c.cols+g.cols;f={x:f.xmin,y:f.ymax};e={x:e.xmax,y:e.ymax};f=d(f,{});e=d(e,{});f=K.pointToGeohash(f,b);b=K.pointToGeohash(e,b);f===b&&c--;b={rows:a,cols:c}}else b=A(a[0],b);f=b.cols*b.rows}return f},getChildren:function(a){a=a||"";var b=[],c;for(c in H.decimals)b.push(a+c);return b},getNeighbors:function(a){var b=
G(a,"n"),c=G(a,"s");return[b,G(b,"e"),G(b,"w"),c,G(c,"e"),G(c,"w"),G(a,"e"),G(a,"w")]},getExtentFromDistance:function(a,b){b=b||1E3;var c,d=g(a);d&&(c=w(d,b));return c},expandExtent:function(a,b,c){b=b||1;c=c||0;if(a=p(a)){if(c){a=a.normalize();if(2===a.length){var d=c;c=C(a);a=B(a);c=h(c,b,d,"min");a=h(a,b,d,"max");360<=c.getWidth()+a.getWidth()?(b=-180,a=180):(b=c.xmin,a=a.xmax);return new r(b,c.ymin,a,c.ymax)}return h(a[0],b,c)}return a}},getNeighborsWithinDistance:function(a,b,c){c=c||1E3;b=b||
1;var d=[];if(a=g(a)){c=w(a,c).normalize();var f={};t.forEach(c,function(a){x(a,b,d,f)})}return d}};q("extend-esri")&&f.setObject("layers.clustering.geohashUtils",K,n);return K})},"esri/layers/clustering/statUtils":function(){define(["dojo/_base/lang","../support/attributeUtils"],function(q,k){function f(b){return"number"===typeof b&&!isNaN(b)&&Infinity!==b&&-Infinity!==b}var t={sum:{initialize:function(){return{count:0,sum:null}},updateCellStat:function(b,k){f(k)&&(b.count++,b.sum+=k)},updateClusterStat:function(b,
f){f.count&&(b.count+=f.count,b.sum+=f.sum)},summarize:function(b){return b.sum}},avg:{initialize:function(b){return{count:0,sum:null,avg:null,sum_cosine:null,sum_sine:null}},updateCellStat:function(b,k,n){f(k)&&(b.count++,n.isAngular?(n.isArithmetic||(k=-1*k+90),b.sum_cosine+=Math.cos(k*Math.PI/180),b.sum_sine+=Math.sin(k*Math.PI/180)):b.sum+=k)},updateClusterStat:function(b,f,k){f.count&&(b.count+=f.count,k.isAngular?(b.sum_cosine+=f.sum_cosine,b.sum_sine+=f.sum_sine):b.sum+=f.sum)},summarize:function(b,
f){if(0<b.count){var k=b.count;f.isAngular?(k=180*Math.atan2(b.sum_sine/k,b.sum_cosine/k)/Math.PI,f.isArithmetic||(k=-1*(k-90)),b.avg=0>k?k+360:k):(b.avg=b.sum/k,f.isDate&&(b.avg=Math.ceil(b.avg)))}return b.avg}},type:{initialize:function(){return{uvInfos:{}}},updateCellStat:function(b,f){if(null==f||""===f||"string"===typeof f&&""===q.trim(f))f=null;var k=b.uvInfos;null==k[f]?k[f]={count:1,value:f}:k[f].count++},updateClusterStat:function(b,f){var k=b.uvInfos,n=f.uvInfos,g;for(g in n){var p=n[g];
null==k[g]?k[g]={count:p.count,value:p.value}:k[g].count+=p.count}},summarize:function(b){b=b.uvInfos;var f,k=-Infinity,n;for(f in b){var g=b[f];g.count>k?(k=g.count,n=g.value):g.count===k&&(n=null)}return n}}},n={isSupportedStatisticType:function(b){return t.hasOwnProperty(b)},getStatisticFunctions:function(b){return t[b]},getStatisticId:function(b,f){var n=k.getAttributeIdSource(b),n=n&&k.getAttributeId(n)||b.field;return f+"_"+n},getClusterField:function(b,f){return"cluster_"+n.getStatisticId(b,
f)},getStatisticHash:function(b,f){var k=[n.getStatisticId(b,f)];b.attributeType&&k.push(b.attributeType.toLowerCase());b.rotationType&&k.push(b.rotationType.toLowerCase());return k.join("_")}};return n})},"*noref":1}});
define("esri/arcgis/utils","require dojo/_base/lang dojo/_base/array dojo/_base/connect dojo/_base/Deferred dojo/_base/json dojo/_base/url dojo/on dojo/DeferredList dojo/dom-construct dojo/sniff dojox/gfx/_base ../kernel ../config ../Color ../lang ../request ../SpatialReference ../map ../urlUtils ../geometry/ScreenPoint ../geometry/Extent ../geometry/webMercatorUtils ../symbols/jsonUtils ../renderers/jsonUtils ../dijit/PopupTemplate ../dijit/Popup ../tasks/query ../tasks/GeometryService ../layers/ArcGISTiledMapServiceLayer ../layers/FeatureLayer dojo/i18n!../nls/jsapi".split(" "),function(q,
k,f,t,n,b,r,u,v,g,p,d,l,z,e,a,c,m,D,x,C,B,w,h,y,A,G,H,K,P,I,aa){function S(a){return c({url:M.arcgisUrl+"/"+a.itemId+"/data",content:{f:"json"},callbackParamName:"callback"},{disableIdentityLookup:!0,_preLookup:!0})}function ha(a,b){var d={f:"json"};b&&(d.token=b);return c({url:a,content:d,callbackParamName:"callback"},{disableIdentityLookup:!0})}function ba(b){!b.layerDefinition||b.layerDefinition.drawingInfo&&b.layerDefinition.drawingInfo.labelingInfo||(b.showLabels=!1);b.itemProperties.layerDefinition&&
(b.layerDefinition?(b.layerDefinition.drawingInfo||(b.layerDefinition.drawingInfo=b.itemProperties.layerDefinition.drawingInfo),a.isDefined(b.layerDefinition.definitionExpression)||(b.layerDefinition.definitionExpression=b.itemProperties.layerDefinition.definitionExpression),a.isDefined(b.layerDefinition.minScale)||(b.layerDefinition.minScale=b.itemProperties.layerDefinition.minScale),a.isDefined(b.layerDefinition.maxScale)||(b.layerDefinition.maxScale=b.itemProperties.layerDefinition.maxScale)):
b.layerDefinition=b.itemProperties.layerDefinition);!b.itemProperties.popupInfo||b.popupInfo||b.disablePopup||(b.popupInfo=b.itemProperties.popupInfo);a.isDefined(b.itemProperties.showLabels)&&!a.isDefined(b.showLabels)&&(b.showLabels=b.itemProperties.showLabels);a.isDefined(b.itemProperties.showLegend)&&!a.isDefined(b.showLegend)&&(b.showLegend=b.itemProperties.showLegend);a.isDefined(b.itemProperties.refreshInterval)&&!a.isDefined(b.refreshInterval)&&(b.refreshInterval=b.itemProperties.refreshInterval)}
function la(b){ba(b);b.itemProperties.layerDefinition&&b.layerDefinition&&(!a.isDefined(b.layerDefinition.maximumTrackPoints)&&a.isDefined(b.itemProperties.layerDefinition.maximumTrackPoints)&&(b.layerDefinition.maximumTrackPoints=b.itemProperties.layerDefinition.maximumTrackPoints),!b.layerDefinition.definitionGeometry&&b.itemProperties.layerDefinition.definitionGeometry&&(b.layerDefinition.definitionGeometry=b.itemProperties.layerDefinition.definitionGeometry));b.itemProperties.purgeOptions&&!b.purgeOptions&&
(b.purgeOptions=b.itemProperties.purgeOptions)}function ca(b,c){var d=new n,e=b.itemData,g=[],h=[];f.forEach(e.operationalLayers,function(b){if(b.itemId&&!b.type){var c=b.url.toLowerCase();-1<c.indexOf("/featureserver")||-1<c.indexOf("/mapserver/")?(h.push(b),g.push(S(b))):-1<c.indexOf("/mapserver")&&-1===c.indexOf("/mapserver/")&&(!b.layers||!a.isDefined(b.minScale)&&!a.isDefined(b.maxScale))?(h.push(b),g.push(S(b))):-1<c.indexOf("/imageserver")&&!a.isDefined(b.minScale)&&!a.isDefined(b.maxScale)?
(h.push(b),g.push(S(b))):-1<c.indexOf("/streamserver")&&(h.push(b),g.push(S(b)))}});e.baseMap&&e.baseMap.baseMapLayers&&f.forEach(e.baseMap.baseMapLayers,function(a){a.itemId&&"VectorTileLayer"!==a.layerType&&(h.push(a),g.push(S(a)))});if(0<g.length){var J={};(new v(g)).addCallback(function(c){f.forEach(h,function(b,d){var e=c[d][1];if(e&&!(e instanceof Error)&&(J[b.itemId]=e,!b.type)){var g=b.url.toLowerCase();(-1<g.indexOf("/featureserver")||-1<g.indexOf("/mapserver/"))&&e.layers?f.forEach(e.layers,
function(a){var c="/featureserver/"+a.id;(c=g.match(c+"$")==c)||(c="/mapserver/"+a.id,c=g.match(c+"$")==c);c&&(b.itemProperties=a,ba(b))}):-1<g.indexOf("/streamserver")?(b.itemProperties=e,la(b)):-1<g.indexOf("/mapserver")?(e.layers&&!b.layers&&(b.layers=e.layers),a.isDefined(e.minScale)&&!a.isDefined(b.minScale)&&(b.minScale=e.minScale),a.isDefined(e.maxScale)&&!a.isDefined(b.maxScale)&&(b.maxScale=e.maxScale),a.isDefined(e.refreshInterval)&&!a.isDefined(b.refreshInterval)&&(b.refreshInterval=e.refreshInterval),
e.visibleLayers&&!b.visibleLayers&&(b.visibleLayers=e.visibleLayers)):-1<g.indexOf("/imageserver")&&(a.isDefined(e.minScale)&&!a.isDefined(b.minScale)&&(b.minScale=e.minScale),a.isDefined(e.maxScale)&&!a.isDefined(b.maxScale)&&(b.maxScale=e.maxScale),a.isDefined(e.refreshInterval)&&!a.isDefined(b.refreshInterval)&&(b.refreshInterval=e.refreshInterval),!e.popupInfo||b.popupInfo||b.disablePopup||(b.popupInfo=e.popupInfo),e.renderingRule&&!b.renderingRule&&(b.renderingRule=e.renderingRule,e.renderingRule.functionName&&
(b.renderingRule.rasterFunction=e.renderingRule.functionName)),e.bandIds&&!b.bandIds&&(b.bandIds=e.bandIds),e.mosaicRule&&!b.mosaicRule&&(b.mosaicRule=e.mosaicRule),e.format&&!b.format&&(b.format=e.format),a.isDefined(e.compressionQuality)&&!a.isDefined(b.compressionQuality)&&(b.compressionQuality=e.compressionQuality),!e.layerDefinition||!e.layerDefinition.definitionExpression||a.isDefined(b.layerDefinition)&&a.isDefined(b.layerDefinition.definitionExpression)||(b.layerDefinition=b.layerDefinition||
{},b.layerDefinition.definitionExpression=e.layerDefinition.definitionExpression))}});b.relatedItemsData=J;d.callback(b)})}else d.callback(b);return d}function L(a,b){var c=new n,d=a.itemData,f=d.baseMap.baseMapLayers[0];if("BingMapsAerial"===f.type||"BingMapsRoad"===f.type||"BingMapsHybrid"===f.type)if(f.portalUrl&&l.id)delete b.bingMapsKey,l.id.checkSignInStatus(x.urlToObject(M.arcgisUrl).path).then(k.hitch(null,function(a,b,c,d,e){ha(f.portalUrl,e.token).then(k.hitch(null,N,a,b,c,d),k.hitch(null,
U,a,b,c,d))},a,b,d,c),k.hitch(null,function(a,b,c,d,e){ha(f.portalUrl).then(k.hitch(null,N,a,b,c,d),k.hitch(null,U,a,b,c,d))},a,b,d,c));else if(b.bingMapsKey){var e=new X({bingMapsKey:b.bingMapsKey,mapStyle:X.MAP_STYLE_AERIAL});t.connect(e,"onLoad",k.hitch(this,function(){c.callback([a,b])}));t.connect(e,"onError",function(e){delete b.bingMapsKey;a.itemData=V(d);f=a.itemData.baseMap.baseMapLayers[0];f.errors=[];f.errors.push({message:"The owner of the application has not provided a valid Bing Key for the Bing Map it includes. Switching to Esri layers."});
c.callback([a,b])})}else a.itemData=V(d),f=a.itemData.baseMap.baseMapLayers[0],f.errors=[],f.errors.push({message:"The owner of the application has not provided a Bing Key for the Bing Map it includes. Switching to Esri layers."}),c.callback([a,b]);else c.callback([a,b]);return c}function R(a){var b=new n,c,d;a=a.itemData;var f=a.baseMap&&a.baseMap.baseMapLayers;if(ua&&!ua.supported())for(a=0;a<f.length;a++){var e=f[a];if(!e.isReference){"VectorTileLayer"===e.layerType&&(c=e.itemId,d=a);break}}c?
xa(c,!1).addBoth(function(a){var c=/^https?:\/\/basemaps(dev)?\.arcgis\.com\/arcgis\/rest\/services\/World_Basemap\/VectorTileServer/i;a&&a.item&&c.test(a.item.url)&&(f[d]={id:"FB_"+e.id,layerType:"ArcGISTiledMapServiceLayer",opacity:"opacity"in e?e.opacity:1,visibility:"visibility"in e?e.visibility:!0,url:"https://services.arcgisonline.com/arcgis/rest/services/World_Street_Map/MapServer"});b.resolve()}):b.resolve();return b}function N(a,b,c,d,f){f.bingKey?(b.bingMapsKey=f.bingKey,f=new X({bingMapsKey:b.bingMapsKey,
mapStyle:X.MAP_STYLE_AERIAL}),t.connect(f,"onLoad",k.hitch(this,function(){d.callback([a,b])})),t.connect(f,"onError",function(f){delete b.bingMapsKey;a.itemData=V(c);f=a.itemData.baseMap.baseMapLayers[0];f.errors=[];f.errors.push({message:"The owner of the map has not provided a valid Bing Key for the Bing Map it includes. Switching to Esri layers."});d.callback([a,b])})):U(a,b,c,d)}function U(a,b,c,d){delete b.bingMapsKey;a.itemData=V(c);c=a.itemData.baseMap.baseMapLayers[0];c.errors=[];c.errors.push({message:"The owner of the map has not provided a Bing Key for the Bing Map it includes. Switching to Esri layers."});
d.callback([a,b])}function V(a){a.baseMap="BingMapsAerial"===a.baseMap.baseMapLayers[0].type?{title:"Imagery",baseMapLayers:[{id:"World_Imagery_2017",visibility:!0,opacity:1,url:"https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"}]}:"BingMapsRoad"===a.baseMap.baseMapLayers[0].type?{title:"Streets",baseMapLayers:[{id:"World_Street_Map_8421",opacity:1,visibility:!0,url:"https://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"}]}:{title:"Imagery with Labels",
baseMapLayers:[{id:"World_Imagery_6611",opacity:1,visibility:!0,url:"https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"},{id:"World_Boundaries_and_Places_1145",isReference:!0,opacity:1,visibility:!0,url:"https://services.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer"}]};return a}function W(b,c,d,e){var g=b.dynamicLayerInfos||b.layerInfos,h=c.layers;if(h&&g)if(e.usePopupManager){var k;f.forEach(g,function(a){var b=a.id;if(!a.subLayerIds)for(a=
0;a<h.length;a++){var c=h[a];if(c.id===b&&c.popupInfo){k||(k={});k[b]={infoTemplate:new d(c.popupInfo),layerUrl:c.layerUrl};break}}});k&&b.setInfoTemplates(k)}else{var J=[],l=[],m=[],n=[],p=[],r=[];f.forEach(g,function(c){var d=c.id;if(!c.subLayerIds&&-1!==f.indexOf(b.visibleLayers,d))for(c=0;c<h.length;c++){var e=h[c];if(e.id===d){l.push(d);J.push(e.popupInfo);m.push(e.layerUrl||"");e.layerDefinition&&e.layerDefinition.definitionExpression?n.push(e.layerDefinition.definitionExpression):n.push("");
p.push(a.isDefined(e.minScale)?e.minScale:null);r.push(a.isDefined(e.maxScale)?e.maxScale:null);break}}});J.length&&(b.__popups=J,b.__popupIds=l,b.__popupUrls=m,b.__popupWhereClauses=n,b.__popupMinScales=p,b.__popupMaxScales=r,b.__resourceInfo=c.resourceInfo)}}function T(a){if(!a)return!1;var b=(new r(M.arcgisUrl)).authority;return-1!==a.indexOf(".arcgis.com/")||-1!==a.indexOf(b)}function ma(a){return a?-1!==a.indexOf("/services.arcgisonline.com/")||-1!==a.indexOf("/server.arcgisonline.com/"):!1}
function O(a){"https:"===location.protocol&&(T(a)||ma(a))&&(a=a.replace("http:","https:"));return a}function da(a,b,c){var d=[],e;a.displayLevels||(d=f.map(a.resourceInfo.tileInfo.lods,function(a){return a.level}));a.exclusionAreas&&(e=k.clone(a.exclusionAreas),e=f.map(e,function(a){a.geometry=new B(a.geometry);return a}));d=new P(O(a.url),{resourceInfo:a.resourceInfo,opacity:a.opacity,visible:a.visibility,displayLevels:a.displayLevels||d,id:a.id,minScale:a.minScale,maxScale:a.maxScale,refreshInterval:a.refreshInterval,
exclusionAreas:e});c.ignorePopups||W(d,a,b,c);return d}function ia(a,b){if(!a||!b||0===b.length)return[];var c=","+b+",",d=[],f,e=",";for(f=0;f<a.length;f++)if(null!==a[f].subLayerIds){if(-1===c.indexOf(","+a[f].id+",")||-1<e.indexOf(","+a[f].id+","))e+=a[f].subLayerIds.toString()+","}else-1<c.indexOf(","+a[f].id+",")&&-1===e.indexOf(","+a[f].id+",")&&d.push(a[f].id);return d}function oa(a,b,c){var d=new Ka;d.format="png24";a.resourceInfo&&a.resourceInfo.supportedImageFormatTypes&&-1<a.resourceInfo.supportedImageFormatTypes.indexOf("PNG32")&&
(d.format="png32");var d=new La(O(a.url),{resourceInfo:a.resourceInfo,opacity:a.opacity,visible:a.visibility,id:a.id,imageParameters:d,minScale:a.minScale,maxScale:a.maxScale,refreshInterval:a.refreshInterval}),e=a.visibleLayers;if(!a.visibleLayers){var g="";f.forEach(d.layerInfos,function(a){a.defaultVisibility&&(g+=(0<g.length?",":"")+a.id)});e=g}if(a.layers&&0<a.layers.length){var h=[],J=[],l,m=[],n,p;f.forEach(a.layers,function(b){var c=b.layerDefinition;c&&c.definitionExpression&&(h[b.id]=c.definitionExpression);
if(c&&c.source){l=null;p=c.source;if("mapLayer"===p.type){var d=f.filter(a.resourceInfo.layers,function(a){return a.id===p.mapLayerId});d.length&&(l=k.mixin(d[0],b))}else l=k.mixin({},b);l&&(l.source=p,delete l.popupInfo,l=new Ma(l),a.visibleLayers&&(d="string"==typeof a.visibleLayers?a.visibleLayers.split(","):a.visibleLayers,-1<f.indexOf(d,b.id)?l.defaultVisibility=!0:l.defaultVisibility=!1),J.push(l))}c&&null!=c.transparency&&(d=c.drawingInfo||{},null==d.transparency&&(d.transparency=c.transparency,
c.drawingInfo=d));c&&c.source&&c.drawingInfo&&(n=new Na(c.drawingInfo),m[b.id]=n)},this);0<h.length&&d.setLayerDefinitions(h);0<J.length?(d.setDynamicLayerInfos(J,!0),0<m.length&&d.setLayerDrawingOptions(m,!0)):(e=ia(d.layerInfos,e),d.setVisibleLayers(e))}else e=ia(d.layerInfos,e),d.setVisibleLayers(e);c.ignorePopups||W(d,a,b,c);return d}function na(b,c,d){var f=new Oa;f.bandIds=b.bandIds;null!=b.format&&(f.format=b.format,null!=b.compressionQuality&&(f.compressionQuality=b.compressionQuality));if(b.renderingRule&&
b.renderingRule.rasterFunction){var e=new Pa(b.renderingRule);f.renderingRule=e}b.mosaicRule&&(e=new Qa(b.mosaicRule),f.mosaicRule=e);a.isDefined(b.noData)&&(f.noData=b.noData);a.isDefined(b.noDataInterpretation)&&(f.noDataInterpretation=b.noDataInterpretation);a.isDefined(b.interpolation)&&(f.interpolation=b.interpolation);e=b.layerType?"ArcGISImageServiceVectorLayer"===b.layerType:!1;a.isDefined(b.layerType)||(e=b.resourceInfo.hasMultidimensions&&("esriImageServiceDataTypeVector-UV"===b.resourceInfo.serviceDataType||
"esriImageServiceDataTypeVector-MagDir"===b.resourceInfo.serviceDataType));f={resourceInfo:b.resourceInfo,opacity:b.opacity,visible:b.visibility,id:b.id,imageServiceParameters:f,minScale:b.minScale,maxScale:b.maxScale,refreshInterval:b.refreshInterval};f=e?new Ra(O(b.url),f):new Sa(O(b.url),f);b.layerDefinition&&(b.layerDefinition.drawingInfo&&b.layerDefinition.drawingInfo.renderer&&(e=y.fromJson(b.layerDefinition.drawingInfo.renderer),f.setRenderer(e)),b.layerDefinition.definitionExpression&&f.setDefinitionExpression(b.layerDefinition.definitionExpression,
!0));!d.ignorePopups&&b.popupInfo&&f.setInfoTemplate(new c(b.popupInfo));return f}function ea(b,c,d){var e=[102113,102100,3857],g=d||new m(c[0].layerObject.fullExtent.spatialReference),h=new m(b.resourceInfo.fullExtent.spatialReference);return g.wkt==h.wkt&&(g.wkid==h.wkid||a.isDefined(g.latestWkid)&&g.latestWkid==h.wkid||a.isDefined(h.latestWkid)&&g.wkid==h.latestWkid||a.isDefined(g.latestWkid)&&g.latestWkid==h.latestWkid)||g.wkid&&h.wkid&&f.some(e,function(a){return a===h.wkid})&&f.some(e,function(a){return a===
g.wkid})?!0:!1}function ja(a,b,c){if(!b[0].layerObject.tileInfo)return!1;a=a.resourceInfo.tileInfo;b=b[0].layerObject.tileInfo;c=c.width>c.height?c.width:c.height;for(var d=!1,f=!1,e=0;e<a.lods.length;e++){for(var g=a.lods[e].scale/a.dpi,h=0;h<b.lods.length;h++){var k=b.lods[h].scale/b.dpi;if(Math.abs(k-g)/k<1/c)if(d){f=!0;break}else d=!0}if(f)break}return f||d&&(1===a.lods.length||1===b.lods.length)?!0:!1}function pa(c,e,g,n,p,r){var q,J,Z=g._clazz;if("OpenStreetMap"===c.type)q=new Ta({id:c.id,opacity:c.opacity,
visible:null!==c.visibility&&void 0!==c.visibility?c.visibility:!0});else if("WFS"===c.type)n={customParameters:c.wfsInfo.customParameters,geometryType:c.layerDefinition.geometryType,id:c.id,labelingInfo:c.layerDefinition.drawingInfo.labelingInfo,maxFeatures:c.wfsInfo.maxFeatures,mode:c.mode,name:c.wfsInfo.name,showLabels:!0,swapXY:c.wfsInfo.swapXY,title:c.title,url:c.url,version:c.wfsInfo.version,visible:c.visibility,wkid:c.layerDefinition.spatialReference.wkid},q=new Ua,q.fromJson(n,function(){a.isDefined(c.opacity)&&
q.setOpacity(c.opacity);a.isDefined(c.visibility)&&q.setVisibility(c.visibility);(c.minScale||c.maxScale)&&q.setScaleRange(c.minScale,c.maxScale);q.renderer=y.fromJson(c.layerDefinition.drawingInfo.renderer);!g.ignorePopups&&c.popupInfo&&q.setInfoTemplate(new Z(c.popupInfo));q.emit("fromJsonComplete")});else if("WMS"===c.type){var fa=[],Ja=[];f.forEach(c.layers,function(a){Ja.push(new Va({name:a.name,title:a.title,legendURL:a.legendURL,queryable:a.queryable,showPopup:a.showPopup}));fa.push(a.name)},
this);c.visibleLayers&&(fa=c.visibleLayers);n=new B(c.extent[0][0],c.extent[0][1],c.extent[1][0],c.extent[1][1],new m({wkid:4326}));n={customLayerParameters:c.customLayerParameters,customParameters:c.customParameters,extent:n,layerInfos:Ja,version:c.version,maxWidth:c.maxWidth,maxHeight:c.maxHeight,featureInfoFormat:c.featureInfoFormat,getFeatureInfoURL:c.featureInfoUrl,getMapURL:c.mapUrl,spatialReferences:c.spatialReferences,title:c.title,copyright:c.copyright,minScale:c.minScale||0,maxScale:c.maxScale||
0,format:c.format};q=new Wa(c.url,{id:c.id,visibleLayers:fa,format:"png",transparent:c.firstLayer?!1:!0,opacity:c.opacity,visible:null!==c.visibility?c.visibility:!0,resourceInfo:n,refreshInterval:c.refreshInterval});q.spatialReference.wkid=n.spatialReferences[0]}else if("KML"===c.type){J=c.url;if(l.id){var ga=l.id.findCredential(x.urlToObject(M.arcgisUrl).path);ga&&(e=M.arcgisUrl.substring(M.arcgisUrl.indexOf("//")+2,M.arcgisUrl.indexOf("/",M.arcgisUrl.indexOf("//")+3)),p=e.split("."),p=p[p.length-
2]+"."+p[p.length-1],r=J.indexOf(p),-1<r&&(J="https://"+e+J.substring(r+p.length),J+="?token\x3d"+ga.token))}q=new Xa(J,{id:c.id,visible:null!==c.visibility?c.visibility:!0,outSR:n,refreshInterval:c.refreshInterval});t.connect(q,"onLoad",function(){(c.opacity||0===c.opacity)&&q.setOpacity(c.opacity);a.isDefined(c.minScale)&&a.isDefined(c.maxScale)&&q.setScaleRange(c.minScale,c.maxScale);c.visibleFolders&&f.forEach(q.folders,function(a){-1<f.indexOf(c.visibleFolders,a.id)?q.setFolderVisibility(a,!0):
q.setFolderVisibility(a,!1)},this)})}else if("WebTiledLayer"===c.type){if(q=new Ya(c.templateUrl,{id:c.id,visible:null!==c.visibility?c.visibility:!0,opacity:c.opacity,copyright:c.copyright,fullExtent:c.fullExtent&&new B(c.fullExtent),initialExtent:c.fullExtent&&new B(c.fullExtent),subDomains:c.subDomains,tileInfo:c.tileInfo?new Za(c.tileInfo):null,refreshInterval:c.refreshInterval,wmtsInfo:c.wmtsInfo}),a.isDefined(c.minScale)||a.isDefined(c.maxScale))q.loaded?q.setScaleRange(c.minScale,c.maxScale):
t.connect(q,"onLoad",function(){q.setScaleRange(c.minScale,c.maxScale)})}else if("GeoRSS"===c.type)q=new $a(c.url,{id:c.id,opacity:c.opacity,outSpatialReference:n,refreshInterval:c.refreshInterval}),t.connect(q,"onLoad",function(){!1===c.visibility&&q.hide();a.isDefined(c.minScale)&&a.isDefined(c.maxScale)&&q.setScaleRange(c.minScale,c.maxScale);var b=q.getFeatureLayers();f.forEach(b,function(a){c.pointSymbol&&"esriGeometryPoint"===a.geometryType?(a.renderer.symbol=h.fromJson(c.pointSymbol),1===b.length&&
(q.pointSymbol=h.fromJson(c.pointSymbol))):c.lineSymbol&&"esriGeometryPolyline"===a.geometryType?(a.renderer.symbol=h.fromJson(c.lineSymbol),1===b.length&&(q.polylineSymbol=h.fromJson(c.lineSymbol))):c.polygonSymbol&&"esriGeometryPolygon"===a.geometryType&&(a.renderer.symbol=h.fromJson(c.polygonSymbol),1===b.length&&(q.polygonSymbol=h.fromJson(c.polygonSymbol)))})});else if("CSV"==c.type&&c.url)n={layerDefinition:c.layerDefinition,columnDelimiter:c.columnDelimiter,id:c.id?c.id:null,visible:null!==
c.visibility?c.visibility:!0,opacity:c.opacity,refreshInterval:c.refreshInterval},c.locationInfo&&(n.latitudeFieldName=c.locationInfo.latitudeFieldName,n.longitudeFieldName=c.locationInfo.longitudeFieldName),g.ignorePopups||(n.infoTemplate=new A(c.popupInfo?c.popupInfo:ab.generateDefaultPopupInfo(c))),q=new bb(c.url,n);else if("VectorTileLayer"===c.layerType&&c.styleUrl)q=new ua(c.styleUrl,{id:c.id,minScale:c.minScale,maxScale:c.maxScale,opacity:c.opacity,visible:c.visibility});else if(c.layerDefinition&&
!c.url)n=b.fromJson(b.toJson(c)),delete n.id,delete n.opacity,delete n.visibility,q=new I(n,{id:c.id,opacity:c.opacity,visible:c.visibility,outFields:["*"],autoGeneralize:!0}),!g.ignorePopups&&n.popupInfo&&q.setInfoTemplate(new Z(n.popupInfo)),Q(q);else if("BingMapsAerial"===c.type||"BingMapsRoad"===c.type||"BingMapsHybrid"===c.type)g.bingMapsKey?(n=X.MAP_STYLE_AERIAL_WITH_LABELS,"BingMapsAerial"===c.type?n=X.MAP_STYLE_AERIAL:"BingMapsRoad"===c.type&&(n=X.MAP_STYLE_ROAD),q=new X({bingMapsKey:g.bingMapsKey,
mapStyle:n,opacity:c.opacity,id:c.id}),t.connect(q,"onError",k.hitch(this,function(a){a.errors=a.errors||[];a.errors.push({message:"This application does not have a valid Bing Key for the Bing layer that is included in this map. [type:"+a.type+"]"})},c))):(c.errors=c.errors||[],c.errors.push({message:"This application does not provide a Bing Key for the Bing layer that is included in this map. [type:"+c.type+"]"}));else if(c.resourceInfo&&c.resourceInfo.mapName)q=!0===c.resourceInfo.singleFusedMapCache&&
(c.baseMapLayer||ea(c,e,n)&&ja(c,p,r))?da(c,Z,g):oa(c,Z,g);else if(c.resourceInfo&&c.resourceInfo.pixelSizeX)q=!0===c.resourceInfo.singleFusedMapCache&&(c.baseMapLayer||ea(c,e,n)&&ja(c,p,r))?da(c,Z,g):na(c,Z,g);else if(c.resourceInfo&&"Feature Layer"===c.resourceInfo.type){c.capabilities&&(c.resourceInfo.capabilities=c.capabilities);var wa;!1===g.editable?wa=!1:g.privileges&&-1===f.indexOf(g.privileges,"features:user:edit")&&l.id&&l.id.findCredential(c.url)&&(wa=!1);q=new I(O(c.url),{resourceInfo:c.resourceInfo,
opacity:c.opacity,visible:c.visibility,id:c.id,mode:c.mode===I.MODE_SELECTION?I.MODE_SELECTION:I.MODE_AUTO,editable:wa,outFields:["*"],autoGeneralize:!0,refreshInterval:c.refreshInterval});!g.ignorePopups&&c.popupInfo&&q.setInfoTemplate(new Z(c.popupInfo));c.layerDefinition&&(c.layerDefinition.drawingInfo&&c.layerDefinition.drawingInfo.renderer&&(n=y.fromJson(c.layerDefinition.drawingInfo.renderer),n.isMaxInclusive=!0,q.setRenderer(n)),c.layerDefinition.drawingInfo&&c.layerDefinition.drawingInfo.labelingInfo&&
(n=f.map(c.layerDefinition.drawingInfo.labelingInfo,function(a){return new cb(a)}),q.setLabelingInfo(n)),c.layerDefinition.definitionExpression&&q.setDefinitionExpression(c.layerDefinition.definitionExpression),a.isDefined(c.layerDefinition.minScale)&&q.setMinScale(c.layerDefinition.minScale),a.isDefined(c.layerDefinition.maxScale)&&q.setMaxScale(c.layerDefinition.maxScale));Q(q)}else c.resourceInfo&&c.resourceInfo.streamUrls&&(n={resourceInfo:c.resourceInfo,opacity:c.opacity,visible:c.visibility,
id:c.id},c.layerDefinition&&(ga=c.layerDefinition.drawingInfo,c.layerDefinition.definitionGeometry&&(J=J||{},J.geometry=c.layerDefinition.definitionGeometry),a.isDefined(c.layerDefinition.definitionExpression)&&(J=J||{},J.where=c.layerDefinition.definitionExpression),a.isDefined(c.layerDefinition.maximumTrackPoints)&&(n.maximumTrackPoints=c.layerDefinition.maximumTrackPoints)),J&&(n.filter=J),c.purgeOptions&&(n.purgeOptions=c.purgeOptions),q=new db(O(c.url),n),ga&&ga.renderer&&(n=ga.renderer,q.setRenderer(y.fromJson(n))),
!g.ignorePopups&&c.popupInfo&&q.setInfoTemplate(new Z(c.popupInfo)),c.layerDefinition&&(a.isDefined(c.layerDefinition.minScale)&&q.setMinScale(c.layerDefinition.minScale),a.isDefined(c.layerDefinition.maxScale)&&q.setMaxScale(c.layerDefinition.maxScale)),u.once(q,"error",function(a){c.errors.push({message:"Error loading stream layer. Check websocket url"})}));q&&(q.arcgisProps={title:c.title},c.baseMapLayer&&(c.isReference?(q.attr("data-reference",!0),q._basemapGalleryLayerType="reference"):q._basemapGalleryLayerType=
"basemap"),q instanceof I&&c.layerDefinition&&c.layerDefinition.featureReduction&&"cluster"===c.layerDefinition.featureReduction.type&&(n=c.layerDefinition.featureReduction,n.clusterSize&&(n.clusterSize=d.pt2px(n.clusterSize)),n.clusterRadius&&(n.clusterRadius=d.pt2px(n.clusterRadius)),n.popupInfo&&(n.infoTemplate=new A(n.popupInfo),delete n.popupInfo),q.setFeatureReduction(n)));return q}function ka(a,b,c,d,e){f.forEach(a,function(f){f.layerObject=pa(f,a,b,c,d,e)});var g=f.filter(a,function(a){return!a.isReference}),
h=f.filter(a,function(a){return!!a.isReference});return a=g.concat(h)}function E(a){var b=null;a=a[0];a.url&&!a.type?a.resourceInfo.spatialReference&&(b=new m,a.resourceInfo.spatialReference.wkid&&(b.wkid=a.resourceInfo.spatialReference.wkid),a.resourceInfo.spatialReference.wkt&&(b.wkt=a.resourceInfo.spatialReference.wkt)):a.type&&(-1<a.type.indexOf("BingMaps")||"OpenStreetMap"==a.type?b=new m({wkid:102100}):"WMS"==a.type&&(b=new m({wkid:a.spatialReferences[0]})));return b}function F(a,b,c,d,e,g,
h,k){f.forEach(b,function(b){b.url&&!b.type&&(b.resourceInfo=a[b.deferredsPos][1],delete b.deferredsPos)});g=g||E(b);b=ka(b,c,g,h,k);e.callback(b);return e}function Q(a){!window.CanvasRenderingContext2D&&a.renderer&&"esri.renderer.HeatmapRenderer"===a.renderer.declaredClass&&a.setRenderer(y.fromJson({type:"simple",symbol:{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"}}}))}
function ya(a,b){var d=O(a);return c({url:d,content:{f:"json"},callbackParamName:"callback",error:function(a,c){a.message=a.message?a.message+(" [url:"+d+"]"):"[url:"+d+"]";b.push(a);z.defaults.io.errorHandler(a,c)}})}function za(a){var b=M.arcgisUrl+"/"+a.itemId+"/data";return c({url:b,content:{f:"json"},callbackParamName:"callback",error:function(c,d){c.message=c.message?c.message+(" [url:"+b+"]"):"[url:"+b+"]";a.errors=a.errors||[];a.errors.push(c);z.defaults.io.errorHandler(c,d)}})}function Aa(c,
d,e){var g=new n;if(!(e.featureCollection&&e.featureCollection.layers||e.layers))return console.log("Invalid Feature Collection item data [item id: "+c.itemId+"]: ",e),c.errors=c.errors||[],c.errors.push({message:"Invalid Feature Collection item data. [item id: "+c.itemId+"]"}),g.errback(),g;e.layers&&(e.featureCollection={layers:e.layers},delete e.layers,a.isDefined(e.showLegend)&&(e.featureCollection.showLegend=e.showLegend,delete e.showLegend));Ba(c,e.featureCollection,d).then(function(d){e.featureCollection=
d;c.featureCollection&&c.featureCollection.layers?f.forEach(e.featureCollection.layers,function(d,f){var e=c.featureCollection.layers[f];e.popupInfo||e.layerDefinition?e.layerDefinition?(a.isDefined(e.layerDefinition.minScale)&&a.isDefined(e.layerDefinition.maxScale)&&(e.layerDefinition.minScale!==d.layerDefinition.minScale||e.layerDefinition.maxScale!==d.layerDefinition.maxScale)&&(delete d.layerDefinition.minScale,delete d.layerDefinition.maxScale),e.layerDefinition.drawingInfo&&b.toJson(e.layerDefinition.drawingInfo)!==
b.toJson(d.layerDefinition.drawingInfo)&&delete d.layerDefinition.drawingInfo,e.layerDefinition.showLegend!==d.layerDefinition.showLegend&&delete d.layerDefinition.showLegend,e.layerDefinition=k.mixin(e.layerDefinition,d.layerDefinition)):e.layerDefinition=d.layerDefinition:(e.popupInfo=d.popupInfo,e.layerDefinition=d.layerDefinition);e.featureSet=d.featureSet;e.nextObjectId=d.nextObjectId}):(c.featureCollection=c.featureCollection||{},c.featureCollection=k.mixin(c.featureCollection,e.featureCollection));
g.callback(c)});return g}function Ba(b,c,d){var e=new n;q(["./csv"],function(g){var h=[];f.forEach(c.layers,function(a){a.featureSet&&a.featureSet.features&&a.featureSet.features.length&&a.featureSet.features[0].geometry&&a.featureSet.features[0].geometry.spatialReference&&(a.deferredsPos=h.length,h.push(g.projectFeatureCollection(a,d,a.featureSet.features[0].geometry.spatialReference)))});(new v(h)).addCallback(function(){f.forEach(c.layers,function(c){a.isDefined(c.deferredsPos)&&(h[c.deferredsPos].results&&
h[c.deferredsPos].results.length?c=h[c.deferredsPos].results[0]:(console.log("Errors projecting feature collection. ["+b.title+" - "+c.layerDefinition.name+"]"),c.errors=c.errors||[],c.errors.push({message:"Errors projecting feature collection. ["+b.title+" - "+c.layerDefinition.name+"]"})),delete c.deferredsPos)});e.callback(c)})});return e}function qa(a,b,c,d,e){var g=new n,h=new n,l=[],m;f.forEach(a.operationalLayers,function(a){a.itemId&&"Feature Collection"==a.type&&l.push(za(a).then(k.hitch(null,
Aa,a,c)))});0===l.length?Ca(a,b,c,d,h,e):(m=new v(l),m.addCallback(function(f){Ca(a,b,c,d,h,e)}));h.then(function(a){l=[];f.forEach(a,function(a){var b;a=a.layerObject;a instanceof I&&!a.loaded&&!a.loadError?(b=new n,u.once(a,"load, error",function(){b.callback(a)}),l.push(b)):a&&"esri.layers.WFSLayer"===a.declaredClass&&!a.loadError&&(b=new n,u.once(a,"fromJsonComplete, error",function(c){b.callback(a)}),l.push(b))});if(l.length){var b=new n;m=new v(l);m.addCallback(function(){b.callback(a)});return b.promise}return a}).then(function(a){var b=
[];f.forEach(a,function(a){var c=a.layerObject;c instanceof I?c.loaded&&c.labelingInfo&&(a.showLabels||c._collection)&&b.push(c):c&&"esri.layers.WFSLayer"===c.declaredClass&&c.loaded&&c.labelingInfo&&b.push(c)});b.length?q(["../layers/LabelLayer"],function(c){var d=new c;f.forEach(b,function(a){d.addFeatureLayer(a)});a.push({layerObject:d});g.callback(a)}):g.callback(a)});return g}function Ca(a,b,c,d,e,g){var h=[],k=[],l=[];f.forEach(a.operationalLayers,function(a,b){if(a.featureCollection&&a.featureCollection.layers){var c=
a.featureCollection.layers.length;f.forEach(a.featureCollection.layers,function(d,e){var g=!0;a.visibleLayers&&-1==f.indexOf(a.visibleLayers,e)&&(g=!1);d.visibility=a.visibility&&g;d.opacity=a.opacity;d.id=(a.id||"operational"+b)+"_"+e;a.title&&(d.title=1!==c&&d.layerDefinition.name&&a.title!==d.layerDefinition.name?a.title+" - "+d.layerDefinition.name:a.title);l.push(d)},this)}else l.push(a)});f.forEach(a.baseMap.baseMapLayers,function(a,b){a.baseMapLayer=!0;a.id=a.id||"base"+b;h.push(a)});f.forEach(l,
function(a,b){a.id=a.id||"operational"+b;h.push(a)});f.forEach(h,function(a){a.url&&!a.type&&(a.deferredsPos=k.length,a.errors=a.errors||[],k.push(ya(a.url,a.errors)))});0===k.length?(c=c||E(h),h=ka(h,b,c,d,g),e.callback(h)):(new v(k)).addCallback(function(a){F(a,h,b,k,e,c,d,g)});return e}function ra(a,b,c,d){var e=a.minScale,g=a.maxScale;if(10.1>=c.version&&b)for(a=b.length-1;0<=a;a--){if(b[a].id==d)if(0==e&&0<b[a].minScale?e=b[a].minScale:0<e&&0==b[a].minScale?e=c.minScale:0<e&&0<b[a].minScale&&
(e=Math.min(e,b[a].minScale)),g=Math.max(c.maxScale||0,b[a].maxScale||0),c.setScaleRange(e,g),-1<b[a].parentLayerId)d=b[a].parentLayerId;else break}else 10.1<c.version&&(f.forEach(a.layerInfos,function(a){a.id==d&&(0==e&&0<a.minScale?e=a.minScale:0<e&&0==a.minScale||0<e&&0<a.minScale&&(e=Math.min(e,a.minScale)),g=Math.max(g||0,a.maxScale||0))}),c.setScaleRange(e,g))}function sa(b,c,d,e){var g=b.url,h=b.__popupIds,l=b.__popupUrls,m=b.__popupWhereClauses,n=b.__popupMinScales,p=b.__popupMaxScales,r=
b.__resourceInfo,q=[];f.forEach(b.__popups,function(e,k){if(e){var u,v=[];f.forEach(e.fieldInfos,function(a){"shape"!==a.fieldName.toLowerCase()&&v.push(a.fieldName)});if(b.dynamicLayerInfos&&0<b.dynamicLayerInfos.length){var w=f.filter(b.dynamicLayerInfos,function(a){return h[k]==a.id})[0].source;u=new I(g+"/dynamicLayer",{id:b.id+"_"+h[k],source:w,outFields:v,mode:I.MODE_SELECTION,infoTemplate:e&&new d(e),drawMode:!1,visible:b.visible,autoGeneralize:!0});var x=function(d,f){0<m[d].length&&f.setDefinitionExpression(m[d]);
if(a.isDefined(n[d])||a.isDefined(p[d]))if(a.isDefined(b.minScale)||a.isDefined(b.maxScale)){var e=b.minScale,g=b.maxScale;0==e&&0<n[d]?e=n[d]:0<e&&0==n[d]||0<e&&0<n[d]&&(e=Math.min(e,n[d]));g=Math.max(g||0,p[d]||0);f.setScaleRange(e,g)}else f.setScaleRange(n[d],p[d]);else ra(b,c||r.layers,f,h[d])};u.loaded?x(k,u):t.connect(u,"onLoad",function(a){x(k,u)})}else{var y=null,fa=g+"/"+h[k];if(l[k].length)fa=l[k];else if(c)for(w=0;w<c.length;w++)if(c[w].id===h[k]){y=c[w];break}u=new I(O(fa),{id:b.id+"_"+
h[k],outFields:v,mode:I.MODE_SELECTION,infoTemplate:e&&new d(e),drawMode:!1,visible:b.visible,resourceInfo:y,autoGeneralize:!0});u.loaded?(0<m[k].length&&u.setDefinitionExpression(m[k]),ra(b,c||r.layers,u,h[k])):t.connect(u,"onLoad",function(a){0<m[k].length&&u.setDefinitionExpression(m[k]);ra(b,c||r.layers,a,h[k])})}q.push(u)}});0<q.length&&(t.connect(b,"onVisibilityChange",k.hitch(this,function(a,b){f.forEach(a,function(a){b?a.show():a.hide()})},q)),t.connect(e,"onLayerRemove",k.hitch(this,function(a,
b,c){a.id===c.id&&f.forEach(b,function(a){e.removeLayer(a)})},b,q)));delete b.__popups;delete b.__popupIds;delete b.__popupUrls;delete b.__popupWhereClauses;delete b.__popupMinScales;delete b.__popupMaxScales;delete b.__resourceInfo;return q}function Da(a){return c({url:O(a.url+"/layers"),content:{f:"json"},callbackParamName:"callback",error:function(){}})}function Ea(a,b,c){var d=[];f.forEach(a,function(a){var b=a.__popups;b&&1<b.length&&10<=a.version&&(a.__deferredsPos=d.length,d.push(Da(a)))});
var e=[];0<d.length?(new v(d)).addCallback(function(d){f.forEach(a,function(a){a.__popups&&0<a.__popups.length&&(a.__deferredsPos||0===a.__deferredsPos?(e=e.concat(sa(a,d[a.__deferredsPos][1].layers,c,b)),delete a.__deferredsPos):e=e.concat(sa(a,null,c,b)))});b.addLayers(e)}):(f.forEach(a,function(a){a.__popups&&0<a.__popups.length&&(e=e.concat(sa(a,null,c,b)))}),b.addLayers(e))}function Fa(a){f.forEach(a,function(a){var b=a.layer;b.toJson&&(a=b.toJson(),a.featureSet&&b.name&&-1<b.name.indexOf("Text")&&
f.forEach(a.featureSet.features,function(a,c){if(a.attributes.TEXT){var d=b.graphics[c];d.symbol.setText(a.attributes.TEXT);a.symbol.horizontalAlignment&&(d.symbol.align=a.symbol.horizontalAlignment);d.setSymbol(d.symbol);d.setAttributes(a.attributes)}},this))})}function Ga(a){var b=6;f.forEach(a,function(a){if(a=a.renderer)"esri.renderer.SimpleRenderer"===a.declaredClass?((a=a.symbol)&&a.xoffset&&(b=Math.max(b,Math.abs(a.xoffset))),a&&a.yoffset&&(b=Math.max(b,Math.abs(a.yoffset)))):"esri.renderer.UniqueValueRenderer"!==
a.declaredClass&&"esri.renderer.ClassBreaksRenderer"!==a.declaredClass||f.forEach(a.infos,function(a){(a=a.symbol)&&a.xoffset&&(b=Math.max(b,Math.abs(a.xoffset)));a&&a.yoffset&&(b=Math.max(b,Math.abs(a.yoffset)))})});return b}function va(a){var b=this,c=b.infoWindow,d=a.graphic;if(b.loaded){c.hide();c.clearFeatures();var e=[];f.forEach(b.graphicsLayerIds,function(a){(a=b.getLayer(a))&&a instanceof I&&a.loaded&&a.visible&&(a.clearSelection(),a.infoTemplate&&!a.suspended&&e.push(a))});f.forEach(b.layerIds,
function(a){(a=b.getLayer(a))&&-1!==a.declaredClass.indexOf("ArcGISImageServiceLayer")&&a.loaded&&a.visible&&a.infoTemplate&&e.push(a)});d=d&&d.getInfoTemplate()?d:null;if(e.length||d){var g=Ga(e),h=a.screenPoint,k=b.toMap(new C(h.x-g,h.y+g)),g=b.toMap(new C(h.x+g,h.y-g)),l=new B(k.x,k.y,g.x,g.y,b.spatialReference),m=new H;m.geometry=l;m.timeExtent=b.timeExtent;var p=!0,k=f.map(e,function(b){b=b&&b.isFeatureReductionActive&&b.isFeatureReductionActive()?b.getFeatureReductionLayer():b;var c;if(-1!==
b.declaredClass.indexOf("ArcGISImageServiceLayer"))m.geometry=a.mapPoint,p=!1,c=b.queryVisibleRasters(m,{rasterAttributeTableFieldPrefix:"Raster.",returnDomainValues:!0}),c.addCallback(function(){return b.getVisibleRasters()});else if("function"===typeof b.selectFeatures)c=b.selectFeatures(m),c.addCallback(function(){return b.getSelectedFeatures()});else{c=new n;var d=f.filter(b.graphics,function(a){return a&&a.visible&&l.intersects(a.geometry)});c.resolve(d)}return c});d&&(g=new n,g.callback([d]),
k.splice(0,0,g));if(!f.some(k,function(a){return-1===a.fired})){var q=d?1:0;f.forEach(e,function(a){q=-1!==a.declaredClass.indexOf("ArcGISImageServiceLayer")?q+a.getVisibleRasters().length:q+a.getSelectedFeatures().length});if(!q)return}c.setFeatures(k);c.show(a.mapPoint,{closestFirst:p})}}}function fb(b,c){var d=c.mapOptions||{},e;d.infoWindow||(e=new G({visibleWhenEmpty:!1},g.create("div")),d.infoWindow=e);a.isDefined(d.showInfoWindowOnClick)||c.usePopupManager||(d.showInfoWindowOnClick=!1);d=new D(b,
d);t.connect(d,"onLayersAddResult",Fa);return d}function Y(a,b,c,d,e,g){var h,k,l,m;d.map?(h=d.map,k=d.clickEventHandle,l=d.clickEventListener,m=d.errors):(h=fb(d,e),e.ignorePopups||e.disableClickBehavior||e.usePopupManager||(k=t.connect(h,"onClick",va),l=va));h.addLayers(a);e.ignorePopups||e.usePopupManager||Ea(a,h,e._clazz);var n=m||[];f.forEach(b,function(a){a.errors&&(n=n.concat(a.errors))},this);h.loaded?g.callback({map:h,itemInfo:c,errors:n,clickEventHandle:k,clickEventListener:l}):t.connect(h,
"onLoad",function(){g.callback({map:h,itemInfo:c,errors:n,clickEventHandle:k,clickEventListener:l})})}function ta(a,b,c,d,e){var g=[];f.forEach(e,function(a){k.isArray(a.layerObject)?f.forEach(a.layerObject,function(a){g.push(a)}):g.push(a.layerObject)});if("BingMapsAerial"===e[0].type||"BingMapsRoad"===e[0].type||"BingMapsHybrid"===e[0].type)var h=setInterval(function(){if(e[0].layerObject&&e[0].layerObject.loaded)clearInterval(h),Ha(a,b,c,d,e,g);else if(e[0].errors){clearInterval(h);var f="";e[0].errors&&
e[0].errors.length&&(f=" ("+e[0].errors[0].message+")");d.errback(Error(aa.arcgis.utils.baseLayerError+f))}},10);else if(!g[0]&&e[0].baseMapLayer){var l="";e[0].errors&&e[0].errors.length&&(l=" ("+e[0].errors[0].message+")");d.errback(Error(aa.arcgis.utils.baseLayerError+l))}else Ha(a,b,c,d,e,g)}function Ha(b,c,d,g,h,k){try{var l=d.mapOptions||{};d.mapOptions=l;var n=b.item,p=b.itemData;!l.backgroundColor&&p.background&&p.background.color&&null!=p.background.color[0]&&(l.backgroundColor=e.toDojoColor(p.background.color));
k=f.filter(k,a.isDefined);if(n)if(n.extent&&n.extent.length)if(l.extent)Y(k,h,b,c,d,g);else{var q=new B(n.extent[0][0],n.extent[0][1],n.extent[1][0],n.extent[1][1],new m({wkid:4326})),r=k[0].spatialReference;4326===r.wkid?(l.extent=q,Y(k,h,b,c,d,g)):102100===r.wkid||102113===r.wkid||3857===r.wkid?(q.xmin=Math.max(q.xmin,-180),q.xmax=Math.min(q.xmax,180),q.ymin=Math.max(q.ymin,-89.99),q.ymax=Math.min(q.ymax,89.99),l.extent=w.geographicToWebMercator(q),Y(k,h,b,c,d,g)):d.geometryServiceURL||z.defaults.geometryService?
(d.geometryServiceURL?new K(d.geometryServiceURL):z.defaults.geometryService).project([q],r,function(a){a=a[0];l.extent=l.extent||a;Y(k,h,b,c,d,g)},function(){Y(k,h,b,c,d,g)}):g.errback(Error(aa.arcgis.utils.geometryServiceError))}else Y(k,h,b,c,d,g);else Y(k,h,b,c,d,g)}catch(ib){g.errback(ib)}}function gb(a){var b=[];f.forEach(a.operationalLayers,function(a){a.featureCollection?b.push({featureCollection:a.featureCollection,visibility:a.visibility,title:a.title}):a.layerObject&&b.push({layer:a.layerObject,
visibility:a.visibility,title:a.title})});return b}function Ia(a){var b=[],c=a.baseMap.baseMapLayers;a.operationalLayers&&(c=c.concat(a.operationalLayers));f.forEach(c,function(a){var c={};if(a.featureCollection&&"CSV"!==a.type)!0===a.featureCollection.showLegend&&f.forEach(a.featureCollection.layers,function(d){if(!1!==d.showLegend){var e=d.layerObject.renderer;c={layer:d.layerObject,title:a.title,defaultSymbol:e&&e.defaultSymbol&&e.defaultLabel?!0:!1};1<a.featureCollection.layers.length&&(c.title+=
" - "+d.layerDefinition.name);b.push(c)}});else if(a.baseMapLayer&&!0===a.showLegend&&a.layerObject||!a.baseMapLayer&&!1!==a.showLegend&&a.layerObject&&!(a.layerObject instanceof I&&a.layerObject.mode===I.MODE_SELECTION)){var d=a.layerObject.renderer,e=a.layerObject.declaredClass,d=!d||d&&d.defaultSymbol&&d.defaultLabel?!0:!1;if(10.1>a.layerObject.version&&("esri.layers.ArcGISDynamicMapServiceLayer"===e||"esri.layers.ArcGISTiledMapServiceLayer"===e)||"esri.layers.ArcGISImageServiceLayer"===e)d=!0;
c={layer:a.layerObject,title:a.title,defaultSymbol:d};a.layers&&(e=f.map(f.filter(a.layers,function(a){return!1===a.showLegend}),function(a){return a.id}),e.length&&(c.hideLayers=e));b.push(c)}});return b}function hb(a,b){function c(a,b){f.forEach(a,function(a,c){switch(a){case "../layers/ArcGISDynamicMapServiceLayer":La=b[c];break;case "../layers/ArcGISImageServiceLayer":Sa=b[c];break;case "../layers/ArcGISImageServiceVectorLayer":Ra=b[c];break;case "./csv":ab=b[c];break;case "../layers/CSVLayer":bb=
b[c];break;case "../layers/DynamicLayerInfo":Ma=b[c];break;case "../layers/GeoRSSLayer":$a=b[c];break;case "../layers/ImageParameters":Ka=b[c];break;case "../layers/ImageServiceParameters":Oa=b[c];break;case "../layers/KMLLayer":Xa=b[c];break;case "../layers/LabelClass":cb=b[c];break;case "../layers/LayerDrawingOptions":Na=b[c];break;case "../layers/MosaicRule":Qa=b[c];break;case "../layers/OpenStreetMapLayer":Ta=b[c];break;case "../layers/RasterFunction":Pa=b[c];break;case "../layers/StreamLayer":db=
b[c];break;case "../layers/TileInfo":Za=b[c];break;case "../layers/VectorTileLayer":ua=b[c];break;case "../virtualearth/VETiledLayer":X=b[c];break;case "../layers/WebTiledLayer":Ya=b[c];break;case "../layers/WFSLayer":Ua=b[c];break;case "../layers/WMSLayer":Wa=b[c];break;case "../layers/WMSLayerInfo":Va=b[c]}})}var d=new n,e=a.itemData,g=[];e.baseMap&&e.baseMap.baseMapLayers&&(g=g.concat(e.baseMap.baseMapLayers));e.operationalLayers&&(g=g.concat(e.operationalLayers));for(var e=f.map(g,function(a){return a&&
a.layerType}),h=[],k=[],g=!1,l=0;l<e.length;l++){switch(e[l]){case "ArcGISFeatureLayer":-1===f.indexOf(h,"../layers/LabelClass")&&h.push("../layers/LabelClass");break;case "ArcGISImageServiceLayer":case "ArcGISTiledImageServiceLayer":-1===f.indexOf(h,"../layers/ArcGISImageServiceLayer")&&(h.push("../layers/ArcGISImageServiceLayer"),k.push("../layers/ImageServiceParameters"),k.push("../layers/MosaicRule"),k.push("../layers/RasterFunction"));break;case "ArcGISImageServiceVectorLayer":-1===f.indexOf(h,
"../layers/ArcGISImageServiceVectorLayer")&&(h.push("../layers/ArcGISImageServiceVectorLayer"),k.push("../layers/ImageServiceParameters"),k.push("../layers/MosaicRule"),k.push("../layers/RasterFunction"));break;case "ArcGISMapServiceLayer":case "ArcGISTiledMapServiceLayer":-1===f.indexOf(h,"../layers/ArcGISDynamicMapServiceLayer")&&(h.push("../layers/ArcGISDynamicMapServiceLayer"),k.push("../layers/DynamicLayerInfo"),k.push("../layers/ImageParameters"),k.push("../layers/LayerDrawingOptions"));break;
case "ArcGISStreamLayer":-1===f.indexOf(h,"../layers/StreamLayer")&&h.push("../layers/StreamLayer");break;case "BingMapsAerial":case "BingMapsHybrid":case "BingMapsRoad":-1===f.indexOf(h,"../virtualearth/VETiledLayer")&&h.push("../virtualearth/VETiledLayer");break;case "CSV":-1===f.indexOf(h,"../layers/CSVLayer")&&(h.push("../layers/CSVLayer"),k.push("./csv"));break;case "GeoRSS":-1===f.indexOf(h,"../layers/GeoRSSLayer")&&h.push("../layers/GeoRSSLayer");break;case "KML":-1===f.indexOf(h,"../layers/KMLLayer")&&
h.push("../layers/KMLLayer");break;case "OpenStreetMap":-1===f.indexOf(h,"../layers/OpenStreetMapLayer")&&h.push("../layers/OpenStreetMapLayer");break;case "VectorTileLayer":-1===f.indexOf(h,"../layers/VectorTileLayer")&&h.push("../layers/VectorTileLayer");break;case "WebTiledLayer":-1===f.indexOf(h,"../layers/WebTiledLayer")&&(h.push("../layers/WebTiledLayer"),k.push("../layers/TileInfo"));break;case "WFS":-1===f.indexOf(h,"../layers/WFSLayer")&&h.push("../layers/WFSLayer");break;case "WMS":-1===
f.indexOf(h,"../layers/WMSLayer")&&(h.push("../layers/WMSLayer"),k.push("../layers/WMSLayerInfo"));break;default:g=!0}if(g)break}g&&(h=jb,k=kb);h.length?q(h,function(){c(h,arguments);k.length?q(k,function(){c(k,arguments);d.resolve()}):d.resolve()}):d.resolve();return d}function eb(a,b,c,d){var e=d.itemData;e.baseMap&&e.baseMap.baseMapLayers&&e.baseMap.baseMapLayers.length&&(e.baseMap.baseMapLayers[0].firstLayer=!0);var g=b.layerMixins,h=g&&g.length;if(h){var l=function(a){for(var b=0;b<h;b++){var c=
g[b];if(c.mixin)if(c.hasOwnProperty("id")){if(a.id===c.id){k.mixin(a,c.mixin);break}}else if(a.url===c.url){k.mixin(a,c.mixin);break}}};f.forEach(e.baseMap&&e.baseMap.baseMapLayers,l);f.forEach(e.operationalLayers,l)}hb(d,b).then(function(){return R(d,b)}).then(function(){return L(d,b)}).then(function(b){var d=b[0],e=b[1];if(d.itemData.operationalLayers&&0!==d.itemData.operationalLayers.length){var g=new n,h=d.itemData.baseMap.baseMapLayers.slice(),l=f.filter(d.itemData.baseMap.baseMapLayers,function(a){return!a.isReference});
b={item:d.item,itemData:{baseMap:{baseMapLayers:l}}};d.itemData.baseMap.baseMapLayers=f.filter(d.itemData.baseMap.baseMapLayers,function(a){return a.isReference});ca(b,e).addCallback(function(b){qa(b.itemData,e).addCallback(k.hitch(null,ta,b,a,e,g))});g.then(function(a){ca(d,e).addCallback(function(b){qa(b.itemData,e,a.map.spatialReference,l,a.map).addCallback(function(d){b.itemData.baseMap.baseMapLayers=h;ta(b,a,e,c,d)})})},k.hitch(c,c.errback))}else ca(d,e).addCallback(function(b){qa(b.itemData,
e).addCallback(k.hitch(null,ta,b,a,e,c))})})}function xa(a,b){"undefined"===typeof b&&(b=!0);M._arcgisUrl&&0<M._arcgisUrl.length&&(M.arcgisUrl=M._arcgisUrl);var d=M.arcgisUrl+"/"+a,e={},f=new n;c({url:d,content:{f:"json"},callbackParamName:"callback",load:function(a){e.item=a;b?c({url:d+"/data",content:{f:"json"},callbackParamName:"callback",load:function(a){e.itemData=a;f.callback(e)},error:function(a){f.errback(a)}}):f.callback(e)},error:function(a){f.errback(a)}});return f}var M,La,Sa,Ra,ab,bb,
Ma,$a,Ka,Oa,Xa,cb,Na,Qa,Ta,Pa,db,Za,ua,X,Ya,Ua,Wa,Va,jb="../layers/ArcGISDynamicMapServiceLayer ../layers/ArcGISImageServiceLayer ../layers/ArcGISImageServiceVectorLayer ../layers/CSVLayer ../layers/GeoRSSLayer ../layers/KMLLayer ../layers/LabelClass ../layers/OpenStreetMapLayer ../layers/StreamLayer ../layers/VectorTileLayer ../virtualearth/VETiledLayer ../layers/WebTiledLayer ../layers/WFSLayer ../layers/WMSLayer".split(" "),kb="./csv ../layers/DynamicLayerInfo ../layers/ImageParameters ../layers/ImageServiceParameters ../layers/LayerDrawingOptions ../layers/MosaicRule ../layers/RasterFunction ../layers/TileInfo ../layers/WMSLayerInfo".split(" ");
M={arcgisUrl:x.getProtocolForWebResource()+"//www.arcgis.com/sharing/rest/content/items",getItem:xa,createMap:function(a,b,c){var d=new n;c=c||{};var e=c.infoTemplateClass;c._clazz=e&&(k.isObject(e)?e:k.getObject(e))||A;k.isString(a)?xa(a).addCallback(k.hitch(null,eb,b,c,d)).addErrback(k.hitch(d,d.errback)):eb(b,c,d,a);return d},getLayerList:function(a){return a&&a.itemInfo&&a.itemInfo.itemData?gb(a.itemInfo.itemData):[]},getLegendLayers:function(a){return a&&a.itemInfo&&a.itemInfo.itemData?Ia(a.itemInfo.itemData):
[]},_arcgisUrl:null,_getItemProps:ca,_getItemData:S,_getBingKey:ha,_portalUrlResponse:N,_portalUrlFailure:U,_processFSItemProperties:ba,_processSSItemProperties:la,_getLayers:qa,_preBuildLayerObjects:F,_buildLayerObjects:ka,_preCreateMap:ta,_getMapSR:E,_createMap:Y,_addSelectionLayers:Ea,_createSelectionFeatureLayers:sa,_getServiceInfo:ya,_getFeatureCollectionItem:za,_mergeFeatureCollectionItem:Aa,_projectFeatureCollection:Ba,_getLayersInfo:Da,_initLayer:pa,_loadAsCached:da,_loadAsDynamic:oa,_processPopups:W,
_onLayersAddResult:Fa,_sameSpatialReferenceAsBasemap:ea,_sameTilingSchemeAsBasemap:ja,_showPopup:va,_calculateClickTolerance:Ga,_getVisibleFeatureLayers:ia,_updateLayerScaleInfo:ra,_checkUrl:O,_isHostedService:T,_isAgolService:ma,_getLegendLayers:Ia};k.setObject("arcgis.utils",M,l);return M});