define(function(e,i,t){"use strict";var n,l=e("../util"),o=e("../base"),r=l.prefixStyle("transform"),s=l.prefixStyle("transition"),a="xs-plugin-swipeedit-",f=!1,c=20,d=!1,u=!1,g=(l.vendor?["-",l.vendor,"-transform"].join(""):"transform",1),h=function(e){h.superclass.constructor.call(this),this.userConfig=l.mix({labelSelector:a+"label"},e)};if(l.extend(h,o,{pluginId:"swipeedit",pluginInitializer:function(e){var i=this;i.xscroll=e,i.infinite=i.xscroll.getPlugin("infinite"),i.infinite&&i._bindEvt()},pluginDestructor:function(e){},getTransformX:function(e){if(!e)return"";var i=getComputedStyle(e)[r].match(/[-\d\.*\d*]+/g);return i?i[4]/1:0},_bindEvt:function(){var e=this,i=e.xscroll,t=e.infinite,o=null;t.on("panstart",function(t){u=!1,t.cell&&(o=l.findParentEl(t.target,"._xs_infinite_elements_",i.renderTo),console.log(t.target),o&&(n=e.getTransformX(o),console.log(n),o.style[s]="none",Math.abs(n)>0&&!d&&e.slideRight(t)))}),i.on("pan",function(t){if(o)if(2==t.direction&&e.slideAllExceptRow(t.cell._row),Math.abs(t.deltaY)<10&&Math.abs(t.deltaX)/Math.abs(t.deltaY)>4&&Math.abs(t.deltaX)>c){f=!0,i.userConfig.lockY=!0;var l=n+t.deltaX+c;if(l>0)return;o.style[s]="none",o.style[r]="translateX("+l+"px)"}else f||(i.userConfig.lockY=!1)}),i.on("panend",function(i){if(console.log(i),o){f=!1;var t=e.getTransformX(o);2==i.direction&&Math.abs(i.velocityX)>g?e.slideLeftHandler(i):Math.abs(t)=e.userConfig.width/2&&e.slideLeftHandler(i)}})},slideLeft:function(e){var i=this;i.xscroll;console.log("row:",e)},slideRight:function(e){console.log("slideRight",e)},slideLeftHandler:function(e){var i=this;d=!0,i.slideLeft(e.cell._row)},slideRightHandler:function(e){var i=this;u=!0,d=!0,i.slideRight(e.cell._row)},slideAllExceptRow:function(e){var i=this,t=i.xscroll;for(var n in t.infiniteElementsCache)e==t.infiniteElementsCache[n]._row&&void 0!==e||i.slideRight(t.infiniteElementsCache[n]._row)}}),"object"==typeof t&&t.exports)t.exports=h;else if(window.XScroll&&window.XScroll.Plugins)return XScroll.Plugins.SwipeEdit=h});