// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://@sbaseurl@/jsapi/jsapi/esri/copyright.txt and http://www.arcgis.com/apps/webappbuilder/copyright.txt for details.

//>>built
require({cache:{"widgets/Summary/ClusterLayer":function(){define("dojo/_base/declare dojo/_base/array dojo/_base/Color esri/layers/GraphicsLayer esri/graphic esri/geometry/geometryEngine esri/geometry/Extent esri/geometry/Point esri/symbols/SimpleMarkerSymbol esri/symbols/SimpleLineSymbol esri/symbols/Font esri/symbols/TextSymbol".split(" "),function(m,g,h,e,q,l,G,D,u,I,K,t){return m("ClusterLayer",[e],{constructor:function(k){this.name=k.id;this.displayOnPan=k.displayOnPan||!1;this._map=k.map;this.clusterSize=
k.clusterSize||100;this.color=k.color||"#ff0000";this.countField=k.countField;this._features=[];try{this.setFeatures(k.features)}catch(p){console.log(p)}this.loaded=!0;this.onLoad(this)},setFeatures:function(k){this._map&&this._map.infoWindow.isShowing&&this._map.infoWindow.hide();this._features=k;this._clusterFeatures()},setColor:function(k){this.color=k;this._clusterFeatures()},_clusterFeatures:function(){this.clear();var k=this._features;if(0<k.length){var p=this.clusterSize,z=[],x=this._map.spatialReference,
v=this._map.extent,w=v.normalize();1<w.length&&(v=l.union(w).getExtent());w=new D(v.xmin,v.ymax,x);var A=Math.ceil(this._map.height/p),B=Math.ceil(this._map.width/p),y=v.getWidth()/this._map.width*p;p*=v.getHeight()/this._map.height;for(v=0;v<A;v++)for(var J=0;J<B;J++){var E=w.x+y*J,C=w.y-p*v;C=new G(E,C-p,E+y,C,x);E=[];for(var F in k){var a=k[F];C.contains(a.geometry)&&E.push(a)}0<E.length&&(C=this._getClusterCenter(E),z.push({center:C,graphics:E}))}for(var b in z)k=z[b],x=this._getClusterCount(k),
w=k.graphics,A=x.toString(),B=19*A.length,y=this._getSymbolColor(),p=new I(I.STYLE_NULL,new h(0,0,0,0),0),F=new u(u.STYLE_CIRCLE,1.6*B,p,new h([y[0],y[1],y[2],.4])),B=new u(u.STYLE_CIRCLE,B,p,new h([y[0],y[1],y[2],.8])),y=new K,y.family="Arial",y.size="12px",A=new t(A,y,"#ffffff"),A.setOffset(0,-4),w={Count:x,Data:w},1<x?(this.add(new q(k.center,F,w)),this.add(new q(k.center,B,w)),this.add(new q(k.center,A,w))):(k=k.graphics[0].geometry,this.add(new q(k,B,w)),this.add(new q(k,A,w)))}},_getSymbolColor:function(){var k=
h.fromString(this.color),p=h.fromString("#000000");return h.blendColors(k,p,.1).toRgb()},_getClusterCount:function(k){for(var p=0,z=0;z<k.graphics.length;z++){var x=k.graphics[z];p=this.countField&&x.attributes[this.countField]?p+x.attributes[this.countField]:p+1}return p},_getClusterCenter:function(k){var p=0,z=0,x=k.length;g.forEach(k,function(v){p+=v.geometry.x;z+=v.geometry.y},this);return new D(p/x,z/x,k[0].geometry.spatialReference)}})})},"widgets/Summary/c":function(){define(function(){function m(g,
h){this.wrapper=g;this.wrapperId=g.id;this.timeoutTimerId=this.intervalTimerId=null;this.isAnimating=!1;this.animationProgress=this.animationStep=0;this.beforeAnimation=[];this.afterAnimation=[];this.digitsNumber=h.digitsNumber||6;this.direction=h.direction||m.ScrollDirection.Mixed;this.value=h.value||"";this.characterSet=h.characterSet||m.DefaultCharacterSets.allCharacters;this.characterNumber=this.characterSet.length;this.animationDuration=h.animationDuration||50;g=["wrapper","left","inner","right",
"marker"];this.extraClassName={};for(var e=0;e<g.length;e++)this.extraClassName[g[e]]=h.extraClassName?"string"===typeof h.extraClassName?h.extraClassName:h.extraClassName[g[e]]||"":"";this.onLoad=h.onLoad||null;this.onValueChanged=h.onValueChanged||null;var q=this;this.imageLoadCounter=0;this.charsImage=new Image;this.charsImage.onload=function(){q.finishLoading()};this.charsImage.src=h.charsImageUrl;this.markerImage=new Image;this.markerImage.onload=function(){q.finishLoading()};this.markerImage.src=
h.markerImageUrl}m.DefaultCharacterSets={numericUp:"0123456789",numericDown:"9876543210",alphabeticUp:" ABCDEFGHIJKLMNOPQRSTUVWXYZ",alphabeticDown:"ZYXWVUTSRQPONMLKJIHGFEDCBA ",alphanumericUp:"0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ",alphanumericDown:"9876543210ZYXWVUTSRQPONMLKJIHGFEDCBA ",calculator:"0123456789.,+-*/\x3d ",qwertyKeybord:" QWERTYUIOPASDFGHJKLZXCVBNM1234567890-\x3d[]\\;',./~`!@#$%^\x26*()_+{}|:\"\x3c\x3e?",allCharacters:" ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-\x3d[]\\;',./~`!@#$%^\x26*()_+{}|:\"\x3c\x3e?"};
m.ScrollDirection={Downwards:-1,Mixed:0,Upwards:1};m.prototype.finishLoading=function(){this.imageLoadCounter++;if(2===this.imageLoadCounter&&this.charsImage.width&&this.markerImage.width){this.digitWidth=this.charsImage.width;this.digitHeight=Math.ceil(this.charsImage.height/this.characterNumber);this.offsetHeight=(this.markerImage.height-this.digitHeight)/2;this.makrer=document.createElement("DIV");this.makrer.className="counter_marker"+(this.extraClassName.marker?" ":"")+this.extraClassName.marker;
this.makrer.style.backgroundImage="url('"+this.markerImage.src+"')";this.makrer.style.width=this.digitWidth*this.digitsNumber+this.digitsNumber+"px";this.makrer.style.height=this.markerImage.height+"px";this.wrapper.className=this.wrapper.className+(this.extraClassName.marker?" ":"")+this.extraClassName.marker;this.wrapper.style.width=this.makrer.style.width;this.wrapper.style.height=this.makrer.style.height;this.wrapper.appendChild(this.makrer);var g=0,h=0;for(g=0;g<this.digitsNumber;g++){var e=
document.createElement("DIV");e.id=this.wrapperId+"_"+g;e.className="counter_character";e.className=0===g?e.className+(" counter_character_left"+(this.extraClassName.left?" ":"")+this.extraClassName.left):g===this.digitsNumber-1?e.className+(" counter_character_right"+(this.extraClassName.right?" ":"")+this.extraClassName.right):e.className+(" counter_character_inner"+(this.extraClassName.inner?" ":"")+this.extraClassName.inner);e.style.backgroundImage="url('"+this.charsImage.src+"')";e.style.width=
this.digitWidth+"px";e.style.height=this.markerImage.height+"px";e.style.top=-this.markerImage.height+"px";this.wrapper.appendChild(e);h+=m._parseInt(m._elementCurrentStyle(e,"margin-left"));h+=m._parseInt(m._elementCurrentStyle(e,"margin-right"));h+=m._parseInt(m._elementCurrentStyle(e,"border-left-width"));h+=m._parseInt(m._elementCurrentStyle(e,"border-right-width"));h+=this.digitWidth}this.makrer.style.width=h+"px";this.wrapper.style.width=h+"px";if(null!==this.onLoad)this.onLoad();this.setValue(this.value,
100)}};m.prototype.animate=function(g){this.animationProgress=g?1:this.animationProgress+this.animationStep;1<=this.animationProgress&&(this.animationProgress=1,this.timeoutTimerId&&clearTimeout(this.timeoutTimerId),this.intervalTimerId&&clearTimeout(this.intervalTimerId),this.isAnimating=!1,this.intervalTimerId=this.timeoutTimerId=null);g=0;var h=this.wrapper.id+"_";for(g=0;g<this.beforeAnimation.length;g++){var e=m._getDijitById(this,h+(this.digitsNumber-g-1));if(e){var q=0;q=1>this.animationProgress?
this.beforeAnimation[g]+(this.afterAnimation[g]-this.beforeAnimation[g])*this.animationProgress:this.afterAnimation[g];e.style.backgroundPosition="0px "+m._parseInt(q)+"px"}}};m.prototype.setValue=function(g,h){if(2===this.imageLoadCounter&&this.charsImage.width&&this.markerImage.width){this.timeoutTimerId&&clearTimeout(this.timeoutTimerId);this.intervalTimerId&&clearTimeout(this.intervalTimerId);var e=0,q=this.wrapper.id+"_";this.beforeAnimation=[];this.afterAnimation=[];for(e=this.digitsNumber-
1;0<=e;e--){var l=m._getDijitById(this,q+(this.digitsNumber-e-1));this.beforeAnimation[e]=Number(l.style.backgroundPosition.substr(4).replace("px",""))}var G=this.value.toString?this.value.toString():String(this.value),D=g.toString?g.toString():String(g);for(e=this.digitsNumber-1;0<=e;e--){l=m._getDijitById(this,q+(this.digitsNumber-e-1));l=-1;0<=G.length-e-1&&(l=G.charAt(G.length-e-1).toUpperCase(),l=this.characterSet.indexOf(l));-1===l&&(l=this.characterSet.indexOf(" "));-1===l&&(l=this.characterSet.indexOf("0"));
-1===l&&(l=0);var u=-1;0<=D.length-e-1&&(u=D.charAt(D.length-e-1).toUpperCase(),u=this.characterSet.indexOf(u));-1===u&&(u=this.characterSet.indexOf(" "));-1===u&&(u=this.characterSet.indexOf("0"));-1===u&&(u=0);this.afterAnimation[e]=Math.round(-this.digitHeight*u+this.offsetHeight);0===this.direction?Math.abs(l-u)>this.characterNumber/2&&(this.beforeAnimation[e]=u<l?this.beforeAnimation[e]+this.digitHeight*this.characterNumber:this.beforeAnimation[e]-this.digitHeight*this.characterNumber):-1===
this.direction?this.beforeAnimation[e]>this.afterAnimation[e]&&(this.beforeAnimation[e]-=this.digitHeight*this.characterNumber):1===this.direction&&this.beforeAnimation[e]<this.afterAnimation[e]&&(this.beforeAnimation[e]+=this.digitHeight*this.characterNumber)}this.value=g;if(null!==this.onValueChanged)this.onValueChanged();h&&0<parseInt(h,10)||(h=1E3);this.isAnimating=!0;g=this.animationDuration;this.animationStep=g/h;this.animationProgress=0;var I=this;h>g&&(this.intervalTimerId=setInterval(function(){I.animate(!1)},
g));this.timeoutTimerId=setTimeout(function(){I.animate(!0)},h)}else if(this.value=g,null!==this.onValueChanged)this.onValueChanged()};m._parseInt=function(g){g=parseInt(g,10);isNaN(g)&&(g=0);return g};m._elementCurrentStyle=function(g,h){if(g.currentStyle){var e=0,q="",l=!1;for(e=0;e<h.length;e++)!h.charAt(e)||"-"===h.charAt(e)&&"-"===h.charAt(e).toString()?l=!0:(q=h.charAt(e).toString?q+(l?h.charAt(e).toString().toUpperCase():h.charAt(e).toString()):q+(l?h.charAt(e).toUpperCase():h.charAt(e)),l=
!1);return g.currentStyle[q]}return getComputedStyle(g,null).getPropertyValue(h)};m._getDijitById=function(g,h){g=g.wrapper.childNodes;for(var e=0;e<g.length;e++){var q=g[e];if(q.id===h)return q}return null};return m})},"widgets/Summary/_build-generate_module":function(){define(["dojo/text!./Widget.html","dojo/text!./css/style.css","dojo/i18n!./nls/strings"],function(){})},"url:widgets/Summary/Widget.html":'\x3cdiv\x3e\r\n  \x3cdiv class\x3d"panelBottom"\x3e\r\n    \x3c!-- Panel Main --\x3e\r\n    \x3cdiv id\x3d"panelMain"\x3e\r\n      \x3c!-- Panel Container --\x3e\r\n      \x3cdiv id\x3d"panelContainer" data-dojo-attach-point\x3d"containerNode"\x3e\r\n        \x3cdiv id\x3d"panel0" class\x3d"col" data-dojo-attach-point\x3d"panel0Node"\x3e\r\n          \x3cdiv id\x3d"title0" class\x3d"titleCounter" data-dojo-attach-point\x3d"title0Node"\x3e\x3c/div\x3e\r\n          \x3cdiv id\x3d"counter0" class\x3d"counter" data-dojo-attach-point\x3d"counter0Node"\x3e\x3c/div\x3e\r\n          \x3cdiv id\x3d"units0" class\x3d"units" data-dojo-attach-point\x3d"units0Node"\x3e\x3c/div\x3e\r\n        \x3c/div\x3e\r\n        \x3cdiv id\x3d"panel1" class\x3d"col line" data-dojo-attach-point\x3d"panel1Node"\x3e\r\n          \x3cdiv id\x3d"title1" class\x3d"titleCounter" data-dojo-attach-point\x3d"title1Node"\x3e\x3c/div\x3e\r\n          \x3cdiv id\x3d"counter1" class\x3d"counter" data-dojo-attach-point\x3d"counter1Node"\x3e\x3c/div\x3e\r\n          \x3cdiv id\x3d"units1" class\x3d"units" data-dojo-attach-point\x3d"units1Node"\x3e\x3c/div\x3e\r\n        \x3c/div\x3e\r\n        \x3cdiv id\x3d"panel2" class\x3d"col line" data-dojo-attach-point\x3d"panel2Node"\x3e\r\n          \x3cdiv id\x3d"title2" class\x3d"titleCounter" data-dojo-attach-point\x3d"title2Node"\x3e\x3c/div\x3e\r\n          \x3cdiv id\x3d"counter2" class\x3d"counter" data-dojo-attach-point\x3d"counter2Node"\x3e\x3c/div\x3e\r\n          \x3cdiv id\x3d"units2" class\x3d"units" data-dojo-attach-point\x3d"units2Node"\x3e\x3c/div\x3e\r\n        \x3c/div\x3e\r\n        \x3cdiv id\x3d"panel3" class\x3d"col line" data-dojo-attach-point\x3d"panel3Node"\x3e\r\n          \x3cdiv id\x3d"title3" class\x3d"titleCounter" data-dojo-attach-point\x3d"title3Node"\x3e\x3c/div\x3e\r\n          \x3cdiv id\x3d"counter3" class\x3d"counter" data-dojo-attach-point\x3d"counter3Node"\x3e\x3c/div\x3e\r\n          \x3cdiv id\x3d"units3" class\x3d"units" data-dojo-attach-point\x3d"units3Node"\x3e\x3c/div\x3e\r\n        \x3c/div\x3e\r\n      \x3c/div\x3e\r\n    \x3c/div\x3e\r\n    \x3c!-- Panel Nav --\x3e\r\n    \x3cdiv id\x3d"panelNav"\x3e\r\n      \x3cul class\x3d"navigation" data-dojo-attach-point\x3d"pagesListNode"\x3e\x3c/ul\x3e\r\n    \x3c/div\x3e\r\n    \x3c!-- Panel Message --\x3e\r\n    \x3cdiv id\x3d"panelMessage" data-dojo-attach-point\x3d"messageNode"\x3e\r\n      \x3cspan id\x3d"msgText" data-dojo-attach-point\x3d"messageTextNode"\x3e\x3c/span\x3e\r\n    \x3c/div\x3e\r\n    \x3c!-- Panel Footer --\x3e\r\n    \x3cdiv id\x3d"panelFooter" data-dojo-attach-point\x3d"footerNode" class\x3d"jimu-main-background"\x3e\r\n      \x3cdiv id\x3d"panelLabel" data-dojo-attach-point\x3d"labelNode"\x3e\x3c/div\x3e\r\n      \x3cdiv id\x3d"panelClose" data-dojo-attach-event\x3d"onclick:_close"\x3e\x3c/div\x3e\r\n      \x3cdiv id\x3d"panelFooterContent" data-dojo-attach-point\x3d"footerContentNode"\x3e\r\n        \x3cspan id\x3d"labelFilter"\x3e${nls.filter}\x3c/span\x3e\r\n        \x3cdiv id\x3d"panelFilter"\x3e\r\n          \x3cselect id\x3d"selFilter" data-dojo-attach-point\x3d"filterNode"\x3e\x3c/select\x3e\r\n        \x3c/div\x3e\r\n      \x3c/div\x3e\r\n    \x3c/div\x3e\r\n  \x3c/div\x3e\r\n\x3c/div\x3e\r\n',
"url:widgets/Summary/css/style.css":".jimu-widget-summary {color: #ffffff !important; background-color: #4c4c4c; left: 0px !important; right: 0px !important; bottom: 0px; height: 140px !important; display: block;}.jimu-widget-summary .panelBottom {position: absolute; width: 100%; height: 140px; left: 0px; top: 0px; text-align: center; padding: 0px;}.jimu-widget-summary #panelMessage {position: absolute; top: 0px; text-align: center; width: 100%; height: 40px; line-height: 40px; display: none;}.jimu-widget-summary #panelMain {position: absolute; width: 100%; height: 80px; left: 0px; top: 0px; text-align: center; padding: 0px;}.jimu-widget-summary #panelContainer {margin: auto; width: 100%; max-width: 880px; height: 80px; overflow: hidden; padding-top: 0px;}.jimu-widget-summary .col {position: relative; width: 219px; height: 80px; padding: 0px; margin-top: 10px; margin-bottom: 0px; display: none; text-align: center; float: left;}.jimu-rtl .jimu-widget-summary .col {float: right;}.jimu-widget-summary .line {border-left: 1px solid #ffffff; border-left: 1px solid rgba(255, 255, 255, 0.5);}.jimu-rtl .jimu-widget-summary .line {border-left: none; border-right: 1px solid #ffffff; border-right: 1px solid rgba(255, 255, 255, 0.5);}.jimu-widget-summary .titleCounter {position: absolute; top: 0px; left: 10px; right: 10px; height: 15px; font-weight: bold; line-height: 15px; letter-spacing: 1px; text-align: right; display: block; overflow: hidden;}.jimu-widget-summary .counter {position: absolute; top: 20px; left: 7px; width: 204px; height: 40px; display: block;}.jimu-widget-summary .units {position: absolute; bottom: 0px; left: 10px; right: 109px; height: 15px; font-weight: normal; line-height: 15px; letter-spacing: 1px; text-align: right; display: block;}.jimu-widget-summary .counter_character {display: inline; float: left; position: relative; margin-left: 0px; margin-right: 0px;}.jimu-widget-summary .counter_character_left {margin-left: 0px; margin-right: 0px;}.jimu-widget-summary .counter_character_inner {margin-left: 0px; margin-right: 0px;}.jimu-widget-summary .counter_character_right {margin-left: 0px; margin-right: 0px;}.jimu-widget-summary .counter_marker {position: relative; z-index: 10;}.jimu-widget-summary #panelNav {position: absolute; width: 100%; height: 20px; left: 0px; bottom: 40px; padding: 0px; line-height: 20px;}.jimu-widget-summary .navigation {list-style-type: none; width: 60px; height: 20px; margin: auto; padding: 0px;}.jimu-widget-summary .navigation li {width: 20px; height: 20px; float: left; background: url(images/dot.png);}.jimu-rtl .jimu-widget-summary .navigation li {float: right;}.jimu-widget-summary .navigation li:hover {background: url(images/doton.png);}.jimu-widget-summary .navigation li.active {background: url(images/doton.png);}.jimu-widget-summary #panelFooter {position: absolute; bottom: 0px; left: 0px; right: 0px; height: 40px; line-height: 40px; background-color: #3d3d3d; background-color: rgba(0, 0, 0, 0.2); border-bottom: 1px solid #353535; border-bottom: 1px solid rgba(0, 0, 0, 0.3);}.jimu-widget-summary #panelLabel {position: absolute; height: 40px; line-height: 40px; padding: 0 0 0 10px; text-align: left; display: block; font-size: 16px;}.jimu-rtl .jimu-widget-summary #panelLabel {text-align: right; padding: 0 10px 0;}.jimu-widget-summary #panelClose {position: absolute; left: auto; right: 0px; width: 24px; height: 40px; line-height: 40px; text-align: center; display: block; cursor: pointer; background-image: url('images/x.png'); background-repeat: no-repeat; background-position: center center; background-size: 18px;}.jimu-rtl .jimu-widget-summary #panelClose {position: absolute; left: 0px; right: auto;}.jimu-widget-summary #panelFooterContent {position: absolute; left: auto; right: 24px; height: 40px; line-height: 40px; text-align: right; display: none;}.jimu-rtl .jimu-widget-summary #panelFooterContent {position: absolute; left: 24px; right: auto; text-align: left;}.jimu-widget-summary #panelFilter {float: right; position: relative; margin: 5px 10px 5px 10px; width: 200px; height: 30px; overflow: hidden; background-color: #353535; background-color: rgba(0, 0, 0, 0.3); z-index: 2; border-radius: 4px;}.jimu-rtl .jimu-widget-summary #panelFilter {float: left;}#labelFilter {display: inline-block;}.jimu-widget-summary #selFilter {position: absolute; left: 0px; top: 0px; margin: 0px; color: #ffffff; outline: transparent; background: transparent; width: 200px; padding: 0px 0px 0px 5px; font-size: 14px; line-height: 1; border: none; border-radius: 0; height: 30px;}.jimu-widget-summary option {background-color: #ffffff; color: #000000;}@media only screen and (max-width: 500px) {#panelLabel {display: none !important;} #labelFilter {display: none !important;}}",
"*now":function(m){m(['dojo/i18n!*preload*widgets/Summary/nls/Widget*["ar","bs","ca","cs","da","de","en","el","es","et","fi","fr","he","hr","hu","id","it","ja","ko","lt","lv","nb","nl","pl","pt-br","pt-pt","ro","ru","sk","sl","sr","sv","th","tr","zh-cn","uk","vi","zh-hk","zh-tw","ROOT"]'])},"*noref":1}});
define("dojo/_base/declare jimu/BaseWidget jimu/LayerInfos/LayerInfos jimu/utils dojo/dom dojo/dom-style dojo/dom-class dojo/dom-construct dojo/dom-geometry dojo/_base/event dojo/_base/html dojo/_base/lang dojo/_base/array dojo/_base/xhr dojo/query esri/geometry/geometryEngine esri/graphic esri/layers/FeatureLayer esri/tasks/query dojo/number esri/tasks/StatisticDefinition ./ClusterLayer esri/graphicsUtils dojo/on widgets/Summary/c".split(" "),function(m,g,h,e,q,l,G,D,u,I,K,t,k,p,z,x,v,w,A,B,y,J,
E,C,F){return m([g],{baseClass:"jimu-widget-summary",name:"Summary",clusterLayer:null,counter0:null,counter1:null,counter2:null,counter3:null,fieldCount:0,pageCount:0,page:0,visCount:4,summaryIds:[],summaryFeatures:[],filterExpr:null,postCreate:function(){this.inherited(arguments);this.config.summaryLayer?(this.showFeatureCount=this.config.showFeatureCount,this.featureCountLabel=this.config.featureCountLabel,this.displayCluster=this.config.displayCluster,this.filterField=this.config.summaryLayer.filterField):
this._showMessage(this.nls.missingSummaryLayerInConfig)},startup:function(){this.inherited(arguments);this._updateUI();this._loadCounters();""!==this.filterField&&l.set(this.footerContentNode,"display","block");var a=new J({id:this.label,displayOnPan:!0,map:this.map,clusterSize:120,color:"#6e6e6e",countField:null,features:[]});this.map.addLayer(a);this.clusterLayer=a;this.own(C(this.clusterLayer,"click",t.hitch(this,this._clusterClick)));this.labelNode.innerHTML=e.sanitizeHTML(this.label?this.label:
"");this._getStyleColor(null);this._watchLayerFilters();this.opLayers=this.map.itemInfo.itemData.operationalLayers;this._processOperationalLayers();this.own(C(this.filterNode,"change",t.hitch(this,this._setFilter)))},destroy:function(){this.clusterLayer&&this.map.removeLayer(this.clusterLayer);this._stopRefresh();this.inherited(arguments)},onOpen:function(){this.inherited(arguments);this._updateLayerVisibility();this._appyFilter(!0);this._summarize();this._startRefresh()},onClose:function(){this._updateLayerVisibility();
this._appyFilter(!1);this._stopRefresh();this.inherited(arguments)},resize:function(){"closed"!==this.state&&(this.inherited(arguments),this.resizeTimer&&(clearTimeout(this.resizeTimer),this.resizeTimer=null),this.resizeTimer=setTimeout(t.hitch(this,this._loadPages),600))},onAppConfigChanged:function(a,b,c){switch(b){case "styleChange":this._updateUI(c)}},_updateUI:function(a){this._getStyleColor(a)},setPosition:function(a,b){if("BoxTheme"===this.appConfig.theme.name||"DartTheme"===this.appConfig.theme.name||
"LaunchpadTheme"===this.appConfig.theme.name)this.inherited(arguments);else{this.position={left:"0px",right:"0px",bottom:"0px",height:"140px"};var c=e.getPositionStyle(this.position);c.position="absolute";b=this.map.id;K.place(this.domNode,b);K.setStyle(this.domNode,c);this.started&&this.resize();"TabTheme"===this.appConfig.theme.name&&(c=this.widgetManager.getControllerWidgets()[0],this.widgetManager.minimizeWidget(c.id))}},_getStyleColor:function(a){var b=this.appConfig.theme.name,c=this.appConfig.theme.styles[0];
a&&(c=a);p.get({url:"./themes/"+b+"/manifest.json",handleAs:"json",load:t.hitch(this,function(d){d=d.styles;for(var f=0;f<d.length;f++){var r=d[f];r.name===c&&(l.set(this.footerNode,"background-color",r.styleColor),this.clusterLayer.setColor(r.styleColor))}})})},_clusterClick:function(a){var b=a.graphic,c=this.nls.features+": "+b.attributes.Count;b=this._summarizeAttributes(b.attributes.Data);for(var d="",f=0;f<this.fieldCount;f++)if(0!==f||this.config.showFeatureCount)d+=this.aliases[f]+": "+b[f]+
"\x3cbr/\x3e\x3cbr/\x3e";this.map.infoWindow.setTitle(c);this.map.infoWindow.setContent(d);this.map.infoWindow.show(a.mapPoint);I.stop(a)},_loadCounters:function(){var a={digitsNumber:17,direction:F.ScrollDirection.Upwards,characterSet:"0123456789.,- ",charsImageUrl:"widgets/Summary/images/c.png",markerImageUrl:"widgets/Summary/images/m.png"};this.counter0=new F(this.counter0Node,a);this.counter0.value=0;this.counter1=new F(this.counter1Node,a);this.counter1.value=0;this.counter2=new F(this.counter2Node,
a);this.counter2.value=0;this.counter3=new F(this.counter3Node,a);this.counter3.value=0},_watchLayerFilters:function(){this.map.itemId&&h.getInstance(this.map,this.map.itemInfo).then(t.hitch(this,function(a){this.layerInfosObj=a;C(this.layerInfosObj,"layerInfosFilterChanged",t.hitch(this,this._layerFilterChanged))}))},_layerFilterChanged:function(a){k.forEach(a,t.hitch(this,function(b){this.config.summaryLayer.id===b.id&&this._summarize()}))},_processOperationalLayers:function(){if(this.opLayers){var a=
this.config.summaryLayer.id;""!==a?k.some(this.opLayers,t.hitch(this,function(b){if("ArcGISFeatureLayer"===b.layerType){if(b.layerObject&&b.id===a){var c=[];k.forEach(this.config.summaryLayer.fields,function(d){c.push(d.field)});this.targetLayer=b.layerObject;this.opLayer=new w(b.layerObject.url,{outFields:c,infoTemplate:b.layerObject.infoTemplate});this._setLayer();return!0}if(b.featureCollection)for(;0<b.featureCollection.layers.length;)return b=b.featureCollection.layers[0].layerObject,b.id===
a&&(this.opLayer=this.targetLayer=b,this.opLayerIsFeatureCollection=!0),this._setLayer(),!0}})):this._showMessage(this.nls.missingSummaryLayerInConfig)}else this._showMessage(this.nls.missingLayerInWebMap)},_setLayer:function(){this.map.infoWindow.isShowing&&this.map.infoWindow.hide();this._closeMessage();this.targetLayerVisibility=this.targetLayer.visible?!0:!1;this.own(C(this.map,"extent-change",t.hitch(this,this._summarize)));this._configureFields();this._populateFilterValues();this._loadPages();
"esriGeometryPoint"===this.opLayer.geometryType&&this.displayCluster&&this.clusterLayer.setVisibility(!0)},_configureFields:function(){if(this.config.summaryLayer&&this.config.summaryLayer.fields){var a=[this.featureCountLabel],b=[];k.forEach(this.config.summaryLayer.fields,t.hitch(this,function(c){b.push(c);var d=c.label;0===d.length&&(d=this._getFieldAlias(c.field));a.push(d)}));this.fields=[{field:"",type:"COUNT",label:this.featureCountLabel}].concat(b);this.aliases=a;this.fieldCount=this.fields.length}},
_populateFilterValues:function(){var a=this.filterField;if(a){var b=[],c=this._getFilterField(a);if(c&&c.domain&&"codedValue"===c.domain.type){c=c.domain.codedValues;for(var d=0;d<c.length;d++){var f=c[d];b.push({value:f.code,label:f.name})}this._populateOptions(b)}else if(this.opLayerIsFeatureCollection){var r={};k.forEach(this.opLayer.graphics,function(n){n=n.attributes[a];r[n]||(r[n]=!0,b.push({value:n,label:n}))});b.sort(function(n,H){return n.value<H.value?-1:n.value>H.value?1:0});this._populateOptions(b)}else c=
new A,c.returnGeometry=!1,c.returnDistinctValues=!0,c.where="1\x3d1",c.outFields=[a],c.orderByFields=[a],this.opLayer.queryFeatures(c,t.hitch(this,function(n){for(var H=0;H<n.features.length;H++){var L=n.features[H].attributes[a];null!==L&&b.push({value:L,label:L})}this._populateOptions(b)}))}},_getFilterField:function(a){var b;k.some(this.targetLayer.fields,function(c){if(c.name===a)return b=c,!0});return b},_getFieldAlias:function(a){if(this.opLayer.infoTemplate)for(var b=this.opLayer.infoTemplate.info.fieldInfos,
c=0;c<b.length;c++){var d=b[c];if(d.fieldName===a)return d.label}return a},_loadPages:function(){if(this.fields)try{var a=u.getContentBox(this.containerNode).w;this.visCount=Math.floor(a/220);var b=this.fieldCount=this.fields.length;this.config.showFeatureCount||--b;this.pageCount=Math.ceil(b/this.visCount);var c=this.pagesListNode;c.innerHTML="";if(1<this.pageCount)for(l.set(c,"width",20*this.pageCount+"px"),a=0;a<this.pageCount;a++){var d=D.create("li",{id:"pageSum"+a},c);this.own(C(d,"click",t.hitch(this,
this._setPage,a)))}this.page=0;this._setPage(0)}catch(f){console.log(f)}},_setPage:function(a){var b=z("\x3e li",this.pagesListNode);k.forEach(b,function(d){d.id==="pageSum"+a?G.add(d,"active"):G.remove(d,"active")});this.page=a;b=z("\x3e div",this.containerNode);var c=0;k.forEach(b,function(d){c<this.visCount?l.set(d,"display","block"):l.set(d,"display","none");c+=1});this._updateCounters()},_summarize:function(){this.sumTimer&&(clearTimeout(this.sumTimer),this.sumTimer=null);this.sumTimer=setTimeout(t.hitch(this,
this._summarizeFeatures),900)},_summarizeFeatures:function(){this.summaryIds=[];this.summaryFeatures=[];if(this.opLayer){var a=this.map.extent,b=a.normalize();1<b.length&&(a=x.union(b).getExtent());if(this.opLayerIsFeatureCollection){b=[];var c=this.filterField;if(c){var d=this.filterNode;d=d.options[d.selectedIndex].value}for(var f=0;f<this.opLayer.graphics.length;f++){var r=this.opLayer.graphics[f];a.intersects(r.geometry)&&(c?(r.attributes[c].toString()===d||""===d)&&b.push(r):b.push(r))}this.summaryFeatures=
b;this.displayCluster&&"esriGeometryPoint"===this.targetLayer.geometryType&&this.clusterLayer.setFeatures(b);this.sumData=this._summarizeAttributes(b);this._updateCounters()}else this._queryFeatures(a)}},_queryFeatures:function(a){this.summaryIds=[];this.summaryFeatures=[];var b=new A;b.geometry=a;var c=this.config.summaryLayer.id,d="";this.layerInfosObj.traversal(function(f){if(c===f.id&&f.getFilter())return d=f.getFilter(),!0});b.where=d;this.defQuery&&(this.defQuery.cancel("new"),this.defQuery=
null);this.defQuery=this.opLayer.queryIds(b,t.hitch(this,function(f){this.summaryIds=f;0<this.summaryIds.length?this._queryFeaturesByIds(!0):(this.clusterLayer.setFeatures([]),this.sumData=this._summarizeAttributes(this.summaryFeatures),this._updateCounters())}))},_queryFeaturesByIds:function(a){a&&(this.summaryFeatures=[]);var b=this.opLayer.maxRecordCount||1E3;a=this.summaryIds.slice(0,b);this.summaryIds.splice(0,b);b=new A;b.outSpatialReference=this.map.spatialReference;b.returnGeometry=this.displayCluster&&
"esriGeometryPoint"===this.targetLayer.geometryType?!0:!1;b.objectIds=a;this.opLayer.queryFeatures(b,t.hitch(this,function(c){this.summaryFeatures=this.summaryFeatures.concat(c.features);this.displayCluster&&"esriGeometryPoint"===this.targetLayer.geometryType&&this.clusterLayer.setFeatures(this.summaryFeatures);this.sumData=this._summarizeAttributes(this.summaryFeatures);this._updateCounters();0<this.summaryIds.length&&setTimeout(t.hitch(this,this._queryFeaturesByIds),500)}))},_showMessage:function(a){l.set(this.containerNode,
"display","none");this.messageTextNode.innerHTML=e.sanitizeHTML(a?a:"");l.set(this.messageNode,"display","block")},_summarizeAttributes:function(a){var b=[];k.forEach(this.fields,t.hitch(this,function(c){var d=c.field.replace(/^\s+|\s+$/g,"");"SUM"===c.type?b.push(this._calculateSum(a,d)):"AVG"===c.type?b.push(this._calculateAvg(a,d)):"MAX"===c.type?b.push(this._calculateMax(a,d)):"MIN"===c.type?b.push(this._calculateMin(a,d)):"COUNT"===c.type&&b.push(a.length)}));return b},_calculateSum:function(a,
b){for(var c=0,d=0;d<a.length;d++){var f=a[d].attributes[b];isNaN(f)&&(f=0);c+=f}return c},_calculateAvg:function(a,b){for(var c=a.length,d=0,f=0,r=0;r<a.length;r++){var n=a[r].attributes[b];isNaN(n)&&(n=0);d+=n}1<c&&(f=d/c);return f},_calculateMax:function(a,b){for(var c=0,d=0;d<a.length;d++){var f=a[d].attributes[b];isNaN(f)&&(f=0);0===d?c=f:f>c&&(c=f)}return c},_calculateMin:function(a,b){for(var c=0,d=0;d<a.length;d++){var f=a[d].attributes[b];isNaN(f)&&(f=0);0===d?c=f:f<c&&(c=f)}return c},_updateCounters:function(){for(var a=
this.visCount,b=0;b<a;b++){var c=this.page*a+b;this.config.showFeatureCount||(c+=1);var d=this["panel"+b+"Node"];c<this.fieldCount?(l.set(d,"display","block"),this.sumData&&this._updateCounter(b,c)):l.set(d,"display","none")}},_updateCounter:function(a,b){var c=this.sumData[b],d=c,f="";1E13<=c&&(d=Math.floor(10*c/1E12)/10,f="TRILLIONS");c=this["counter"+a];d=this._formatNumber(d);null!==c&&null!==d&&c.setValue(d);this["title"+a+"Node"].innerHTML=e.sanitizeHTML(this.aliases[b]?this.aliases[b]:"");
this["units"+a+"Node"].innerHTML=f},_formatNumber:function(a){if(-100<a&&100>a){var b=B.round(100*a)/100;a=B.format(b,{places:2});0===a%1&&(a=B.format(b,{places:0}))}else b=B.round(a),a=B.format(b,{places:0});return a},_closeMessage:function(){l.set(this.messageNode,"display","none");l.set(this.containerNode,"display","block")},_populateOptions:function(a){if(0<a.length){var b=this.filterNode;null===b&&console.log("Filter search drop down not configured");D.create("option",{value:"",innerHTML:this.nls.all},
b);for(var c=0;c<a.length;c++){var d=a[c],f=d.label;D.create("option",{value:d.value,innerHTML:e.sanitizeHTML(f?f:"")},b)}}},_setFilter:function(){var a=this.filterNode,b=this.filterField,c=a.options[a.selectedIndex].value,d;if(this.opLayerIsFeatureCollection){var f=[];k.forEach(this.opLayer.graphics,function(n){if(n.attributes[b].toString()===c||""===c){var H=new v(n.geometry,n.symbol,n.attributes);n.show();f.push(H)}else n.hide()});0<f.length&&((d=E.graphicsExtent(f))?this.map.setExtent(d.expand(2)):
0<f.length&&this.map.centerAt(f[0].geometry))}else{var r=this._getFilterField(b);a=b+" \x3d "+c;r&&"esriFieldTypeString"===r.type&&(a=b+" \x3d '"+c+"'");""===c&&(a="1\x3d1");this.filterExpr=a;this.opLayer.setDefinitionExpression(a);this.targetLayer.setDefinitionExpression(a);a&&(r=new A,r.returnGeometry=!0,r.where=a,r.outSpatialReference=this.map.spatialReference,this.opLayer.queryFeatures(r,t.hitch(this,function(n){d=E.graphicsExtent(n.features);this.map.setExtent(d.expand(1.5))})))}},_appyFilter:function(a){this.filterExpr&&
(a?(this.opLayer.setDefinitionExpression(this.filterExpr),this.targetLayer.setDefinitionExpression(this.filterExpr)):(this.opLayer.setDefinitionExpression("1\x3d1"),this.targetLayer.setDefinitionExpression("1\x3d1")))},_close:function(){this.widgetManager.closeWidget(this.id)},_updateLayerVisibility:function(){this.targetLayer&&("closed"===this.state?(this.displayCluster&&"esriGeometryPoint"===this.targetLayer.geometryType&&this.targetLayer.setVisibility(this.targetLayerVisibility),this.clusterLayer&&
this.clusterLayer.setVisibility(!1)):(this.displayCluster&&"esriGeometryPoint"===this.targetLayer.geometryType&&this.targetLayer.setVisibility(!1),this.clusterLayer&&this.clusterLayer.setVisibility(!0)))},_stopRefresh:function(){this.interval&&(clearInterval(this.interval),this.interval=null)},_startRefresh:function(){this._stopRefresh();if(this.config.refreshInterval){var a=6E4*this.config.refreshInterval;this.interval=setInterval(t.hitch(this,this._summarize),a)}}})});