// 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:{"url:esri/dijit/geoenrichment/DataBrowser/templates/ShoppingCart.html":'\x3cdiv class\x3d"ShoppingCart" data-dojo-attach-event\x3d"mouseout:_hideListOnLeave"\x3e\r\n    \x3ctable data-dojo-attach-point\x3d"label" class\x3d"Label" data-dojo-attach-event\x3d"click:_toggleList"\x3e\r\n        \x3ctr\x3e\r\n            \x3ctd class\x3d"ShoppingCart_CounterTD"\x3e\r\n                \x3cdiv class\x3d"ShoppingCart_CounterDivLeftBorder"\x3e\x3c/div\x3e\x3cdiv data-dojo-attach-point\x3d"divCounter" class\x3d"ShoppingCart_CounterDiv"\x3e\x3c/div\x3e\x3cdiv class\x3d"ShoppingCart_CounterDivRightBorder"\x3e\x3c/div\x3e\r\n            \x3c/td\x3e\r\n            \x3ctd class\x3d"ShoppingCart_LabelTd"\x3e\r\n                \x3cdiv data-dojo-attach-point\x3d"selectedVariablesLabel"\x3e\x3c/div\x3e\r\n            \x3c/td\x3e\r\n            \x3ctd\x3e\r\n                \x3cdiv class\x3d"ShoppingCartOpener" data-dojo-attach-point\x3d"divShoppingCartOpener"\x3e\x26#x25bc;\x3c/div\x3e\r\n            \x3c/td\x3e\r\n        \x3c/tr\x3e\r\n    \x3c/table\x3e\r\n        \r\n    \x3cdiv data-dojo-attach-point\x3d"divOuter" class\x3d"ShoppingCart_OuterDiv"\x3e\r\n        \x3cdiv data-dojo-attach-point\x3d"divList" class\x3d"ShoppingCart_DivList"\x3e\r\n        \x3c/div\x3e\r\n        \x3cdiv data-dojo-attach-point\x3d"divEmpty" class\x3d"ShoppingCart_DivEmpty"\x3e\r\n            \x3cdiv\x3e${nls.noVariables}\x3c/div\x3e\r\n        \x3c/div\x3e\r\n    \x3c/div\x3e\r\n\x3c/div\x3e'}});
define("esri/dijit/geoenrichment/DataBrowser/ShoppingCart","dojo/_base/lang dojo/_base/window dojo/dom-construct dojo/dom-attr dojo/on dojo/when dojox/mvc/Templated dgrid/List ../../../declare ../utils/TooltipUtil dojo/text!./templates/ShoppingCart.html dojo/i18n!../../../nls/jsapi ./VariableUtil ./VariableToggle".split(" "),function(g,v,f,w,h,m,n,p,q,l,r,k,t,u){k=k.geoenrichment.dijit.ShoppingCart;return q("esri.dijit.geoenrichment.ShoppingCart",n,{nls:k,templateString:r,variables:null,selection:null,
allowToggles:!0,allowMoveButtons:!1,allowEditButtons:!1,_list:null,_content:null,postCreate:function(){this.inherited(arguments);this.selectedVariablesLabel.innerHTML=k.selectedVars.replace(/\s+/g,"\x3cbr/\x3e");this.selection=[];this._content=[];this._list=new p({renderRow:g.hitch(this,this._renderVariable)},this.divList);h(this.divList,"click, touchend",g.hitch(this,this._stopPropagation));this._updateLabel();this.divOuter.style.display="none";var a=this;this.watch("selection",function(){m(a.variables.synchronize(),
g.hitch(a,a._onSelectionChanged))})},_updateLabel:function(){this.divCounter.innerHTML=this._content.length.toString()},_onSelectionChanged:function(){for(var a=[],c=Math.min(this._content.length,this.selection.length),b=0;b<c;b++){var d=this.selection[b],e=this._content[b];if(!e.hash[d])break;e.group.value=d;a.push(e)}c=this.selection.length;for(b=a.length;b<c;b++)d=this.selection[b],e={hash:{}},e.group=t.getToggleGroup(this.variables,d,e.hash),d=e.group.states&&this.allowToggles?e.group.states.ids[0]:
e.group.value,d=this.variables.get(d),e.title=d&&d.alias,a.push(e);this._content=a;this._updateLabel()},_toggleList:function(a){this._stopPropagation(a);"none"===this.divOuter.style.display?this._displayList():this._hideList()},_stopPropagation:function(a){a.stopPropagation&&a.stopPropagation()},_displayList:function(){this.refresh();this.divShoppingCartOpener.innerHTML="\x26#x25b2;";this.divOuter.style.display=""},_hideList:function(){this.divShoppingCartOpener.innerHTML="\x26#x25bc;";this.divOuter.style.display=
"none"},_hideListOnLeave:function(a){if("none"!=this.divOuter.style.display){a=a.relatedTarget;for(var c=!0;a;){if(a===this.label||a===this.divOuter){c=!1;break}a=a.parentNode}this._onMouseLeave(c)}},_onMouseLeave:function(a){a&&this._hideList()},_renderVariable:function(a){var c=f.create("div",{"class":"ShoppingCartRow"}),b=f.create("div",{"class":"ShoppingCartRowCloser ShoppingCartRowFloatEnd"},c);l.setTooltipToNode(b,k.removeVariable);h(b,"click",g.hitch(this,this._onRemove,a));f.create("div",
{"class":"dijitInline ShoppingCartRowSpacer ShoppingCartRowFloatEnd",innerHTML:"\x26nbsp;"},c);this.allowEditButtons&&this._canEditData(a)&&(b=f.create("div",{"class":"ShoppingCartRowEditButton ShoppingCartRowFloatEnd"},c),l.setTooltipToNode(b,k.editVariable),h(b,"click",g.hitch(this,this._onEditData,a)),f.create("div",{"class":"dijitInline ShoppingCartRowSpacer ShoppingCartRowFloatEnd",innerHTML:"\x26nbsp;"},c));a.group.states&&this.allowToggles&&(b=new u(a.group,f.create("div",{"class":"dijitInline ShoppingCartRowFloatEnd"},
c)),h(b,"change",g.hitch(this,this._onToggleChange,b,a)),f.create("div",{"class":"dijitInline ShoppingCartRowSpacer ShoppingCartRowFloatEnd",innerHTML:"\x26nbsp;"},c));if(this.allowMoveButtons){b=f.create("div",{"class":"dijitInline ShoppingCartRowFloatEnd upDownArrowsBlock"},c);if(0<this._content.indexOf(a)){var d=f.create("div",{"class":"dijitInline upArrow"},b);h(d,"click",g.hitch(this,this._onMove,a,!0))}this._content.indexOf(a)<this._content.length-1&&(b=f.create("div",{"class":"dijitInline downArrow"},
b),h(b,"click",g.hitch(this,this._onMove,a,!1)));f.create("div",{"class":"dijitInline ShoppingCartRowSpacer ShoppingCartRowFloatEnd",innerHTML:"\x26nbsp;"},c)}a=this.variables.get(a.group.states&&this.allowToggles?a.group.states.ids[0]:a.group.value);f.create("div",{"class":"TrimWithEllipses ShoppingCartRowLabel",innerHTML:a&&a.alias||""},c);return c},_onRemove:function(a){var c=this.selection.slice();a=this._content.indexOf(a);c.splice(a,1);this._content.splice(a,1);this.set("selection",c);this.refresh()},
_onToggleChange:function(a,c){c.group.value=a.value;var b=this.selection.slice();b[this._content.indexOf(c)]=a.value;this.set("selection",b)},_onMove:function(a,c){var b=this.selection.slice(),d=this._content.indexOf(a),e=b[d];b.splice(d,1);this._content.splice(d,1);b.splice(c?d-1:d+1,0,e);this._content.splice(c?d-1:d+1,0,a);this.set("selection",b);this.refresh()},_canEditData:function(a){return!1},_onEditData:function(a){},refresh:function(){this._list.refresh();this._list.renderArray(this._content);
this._updateLabel();this.divEmpty.style.visibility=this._content.length?"hidden":"visible"}})});