// 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:{"url:widgets/Infographic/setting/dijitsSetting/_dijits/NumberIndicator/MultipleIndicators.html":'\x3cdiv\x3e\r\n    \x3cdiv class\x3d"indicator-add-div top" data-dojo-attach-point\x3d"addIndicator"\x3e\r\n\t\t\x3cdiv data-dojo-attach-point\x3d"topIcon" class\x3d"icon-add-indicator"\x3e\x3c/div\x3e\r\n\t\t\x3cdiv  data-dojo-attach-point\x3d"topBlock" class\x3d"top-mid-block"\x3e\x3c/div\x3e\r\n\t\t\x3cdiv data-dojo-attach-point\x3d"topText" class\x3d"text-add-indicator" title\x3d"${nls.addIndicatorTip}" \x3e${nls.addIndicatorTip}\x3c/div\x3e\r\n    \x3c/div\x3e\r\n    \x3cdiv class\x3d"indicatorDiv" data-dojo-attach-point\x3d"indicatorDiv"\x3e\x3c/div\x3e\r\n\x3c/div\x3e'}});
define("dojo/_base/declare dijit/_WidgetBase dojo/Evented dijit/_TemplatedMixin dijit/_WidgetsInTemplateMixin dojo/text!./MultipleIndicators.html dojo/on dojo/query dojo/mouse dojo/_base/html dojo/_base/lang ./SingleIndicator libs/Sortable dijit/form/Select jimu/dijit/CheckBox".split(" "),function(l,m,n,p,q,r,f,t,k,d,c,u,v){var g=k.enter,h=k.leave;return l([m,n,p,q],{baseClass:"infographic-setting-multiple-indicators",templateString:r,nls:null,constructor:function(){this.inherited(arguments);this.indicators=
[]},postCreate:function(){this.inherited(arguments);this._initEvent();this.setConfig(this.config)},startup:function(){this.inherited(arguments);this.sortableIndicatorNode=v.create(this.indicatorDiv,{handle:".drag-masker",filter:".disable-drag .unvaild",sort:!0,disabled:!1,animation:100,onSort:c.hitch(this,function(){this._onSorted()})});this.setConfig(this.config)},_initEvent:function(){this.own(f(this.topIcon,"click",c.hitch(this,this._onAddIndicatorClicked)));this.own(f(this.topBlock,"click",c.hitch(this,
this._onAddIndicatorClicked)));this.own(f(this.topText,"click",c.hitch(this,this._onAddIndicatorClicked)));this._handleAddIdicatorHoverColor()},_handleAddIdicatorHoverColor:function(){this.own(f(this.topIcon,g,c.hitch(this,function(){d.addClass(this.topIcon,"active");d.addClass(this.topText,"active")})));this.own(f(this.topBlock,g,c.hitch(this,function(){d.addClass(this.topIcon,"active");d.addClass(this.topText,"active")})));this.own(f(this.topText,g,c.hitch(this,function(){d.addClass(this.topIcon,
"active");d.addClass(this.topText,"active")})));this.own(f(this.topIcon,h,c.hitch(this,function(){d.removeClass(this.topIcon,"active");d.removeClass(this.topText,"active")})));this.own(f(this.topBlock,h,c.hitch(this,function(){d.removeClass(this.topIcon,"active");d.removeClass(this.topText,"active")})));this.own(f(this.topText,h,c.hitch(this,function(){d.removeClass(this.topIcon,"active");d.removeClass(this.topText,"active")})))},setConfig:function(a){(this.config=a)&&this._setIndicators()},_getIndicatorIDs:function(){return t(".infographic-setting-single-indicator",
this.indicatorDiv).map(function(a){return d.getAttr(a,"data-id")})},getConfig:function(a){var e=[];this.indicators.forEach(c.hitch(this,function(b){b&&(b=b.getConfig())&&e.push(b)}));return a&&this.indicators.length!==e.length?!1:e},_setIndicators:function(){var a=this.config.indicators;this.clear();a&&a.forEach(c.hitch(this,function(e){this._createIndicator(e)}));this._updateIndicatorBottomLineDisplay()},_reSortIndicatorArray:function(){var a=[];this._getIndicatorIDs().forEach(function(e){this.indicators.some(function(b){return b.uniqueID===
e?(a.push(b),!0):!1})}.bind(this));this.indicators=null;this.indicators=a},_onSorted:function(){this._reSortIndicatorArray();this._updateIndicatorBottomLineDisplay();this._onUpdate()},_onUpdate:function(){this.emit("change")},_updateIndicatorBottomLineDisplay:function(){if(this.indicators&&this.indicators.length){var a=this.indicators.length-1;this.indicators.forEach(c.hitch(this,function(e,b){e&&e.updateBottomLineDisplay(b,a)}))}},_onAddIndicatorClicked:function(a){a.stopPropagation();this._createIndicator()},
_createIndicator:function(a){var e={type:this.type,nls:this.nls,folderUrl:this.folderUrl};a&&(e.config=a);var b=new u(e);b.placeAt(this.indicatorDiv);b.startup();this.own(f(b,"remove",c.hitch(this,function(w){this.indicators=this.indicators.filter(function(x){return x.uniqueID!==w});b.destroy();b=null;this._updateIndicatorBottomLineDisplay()})));this.own(f(b,"change",c.hitch(this,function(){this._onUpdate()})));this.indicators.push(b);this._updateIndicatorBottomLineDisplay()},clear:function(){this.indicators&&
(this.indicators.forEach(c.hitch(this,function(a){a&&(a.destroy(),a=null)})),this.indicators=[])},destroy:function(){this.clear();this.inherited(arguments)}})});