//>>built
define("dgrid/CellSelection",["dojo/_base/declare","./Selection","dojo/on","put-selector/put","dojo/has"],function(_1,_2,_3,_4,_5){return _1("dgrid.CellSelection",_2,{selectionDelegate:".dgrid-cell",select:function(_6,_7,_8){var i,id;if(_8===undefined){_8=true;}if(typeof _6!="object"||!("element" in _6)){_6=this.cell(_6);}else{if(!_6.row){for(id in _8){this.select(this.cell(_6.id,id),null,_8[id]);}return;}}if(this.allowSelect(_6)){var _9=this.selection,_a=_6.row.id,_b=_9[_a];if(!_6.column){for(i in this.columns){this.select(this.cell(_a,i),null,_8);}return;}var _c=_b&&_b[_6.column.id];if(_8===null){_8=!_c;}var _d=_6.element;_b=_b||{};_b[_6.column.id]=_8;this.selection[_a]=_b;var _e=false;for(i in _b){if(_b[i]===true){_e=true;break;}}if(!_e){delete this.selection[_a];}if(_d){if(_8){_4(_d,".dgrid-selected.ui-state-active");}else{_4(_d,"!dgrid-selected!ui-state-active");}}if(_8!=_c&&_d){this._selectionEventQueue(_8,"cells").push(_6);}if(_7){if(!_7.element){_7=this.cell(_7);}var _f=_7.element;var _10=_6.element;var _11=(_f&&(_f.compareDocumentPosition?_f.compareDocumentPosition(_10)==2:_f.sourceIndex>_10.sourceIndex))?"nextSibling":"previousSibling";var _12=_6.column.id,_13=_7.column.id,_14,_15=[];for(id in this.columns){if(_14){_15.push(id);}if(id==_12&&(_12=_15)||id==_13&&(_13=_15)){_15.push(id);if(_14||(_12==_15&&id==_13)){break;}_14=true;}}var row=_6.row,_16=row.element;_f=_7.row.element;do{for(i=0;i<_15.length;i++){_6=this.cell(_16,_15[i]);this.select(_6);}if(_16==_f){break;}}while((_16=_6.row.element[_11]));}}},isSelected:function(_17,_18){if(!_17){return false;}if(!_17.element){_17=this.cell(_17,_18);}return this.selection[_17.row.id]&&!!this.selection[_17.row.id][_17.column.id];},clearSelection:function(_19){_19=false;this.inherited(arguments);}});});