//>>built
define("dojox/widget/Selection",["dojo/_base/declare","dojo/_base/array","dojo/sniff","dojo/_base/lang","dojo/Stateful"],function(l,k,m,n,p){return l("dojox.widget.Selection",p,{constructor:function(){this.selectedItems=[]},selectionMode:"single",_setSelectionModeAttr:function(a){"none"!=a&&"single"!=a&&"multiple"!=a&&(a="single");a!=this.selectionMode&&(this.selectionMode=a,"none"==a?this.set("selectedItems",null):"single"==a&&this.set("selectedItem",this.selectedItem))},selectedItem:null,_setSelectedItemAttr:function(a){this.selectedItem!=
a&&(this._set("selectedItem",a),this.set("selectedItems",a?[a]:null))},selectedItems:null,_setSelectedItemsAttr:function(a){var b=this.selectedItems;this.selectedItems=a;this.selectedItem=null;null!=b&&0<b.length&&this.updateRenderers(b,!0);this.selectedItems&&0<this.selectedItems.length&&(this.selectedItem=this.selectedItems[0],this.updateRenderers(this.selectedItems,!0))},_getSelectedItemsAttr:function(){return null==this.selectedItems?[]:this.selectedItems.concat()},isItemSelected:function(a){return null==
this.selectedItems||0==this.selectedItems.length?!1:k.some(this.selectedItems,n.hitch(this,function(b){return this.getIdentity(b)==this.getIdentity(a)}))},getIdentity:function(a){},setItemSelected:function(a,b){if("none"!=this.selectionMode&&null!=a){var c=this.get("selectedItems");if("single"==this.selectionMode)b?this.set("selectedItem",a):this.isItemSelected(a)&&this.set("selectedItems",null);else if(b)this.isItemSelected(a)||(null==c?c=[a]:c.unshift(a),this.set("selectedItems",c));else{var d=
k.filter(c,function(f){return f.id!=a.id});null!=d&&d.length!=c.length&&this.set("selectedItems",d)}}},selectFromEvent:function(a,b,c,d){if("none"==this.selectionMode)return!1;var f=this.get("selectedItem"),g=b?this.isItemSelected(b):!1,h=m("mac")?a.metaKey:a.ctrlKey;if(null==b){if(!h&&null!=this.selectedItem){this.set("selectedItem",null);var e=!0}}else"multiple"==this.selectionMode?(h?this.setItemSelected(b,!g):this.set("selectedItem",b),e=!0):h?(this.set("selectedItem",g?null:b),e=!0):g||(this.set("selectedItem",
b),e=!0);d&&e&&this.dispatchChange(f,this.get("selectedItem"),c,a);return e},dispatchChange:function(a,b,c,d){this.onChange({oldValue:a,newValue:b,renderer:c,triggerEvent:d})},onChange:function(){}})});