!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.ReactDrag=t()}}(function(){return function t(e,n,r){function o(s,i){if(!n[s]){if(!e[s]){var p="function"==typeof require&&require;if(!i&&p)return p(s,!0);if(a)return a(s,!0);var f=new Error("Cannot find module '"+s+"'");throw f.code="MODULE_NOT_FOUND",f}var u=n[s]={exports:{}};e[s][0].call(u.exports,function(t){var n=e[s][1][t];return o(n?n:t)},u,u.exports,t,e,n,r)}return n[s].exports}for(var a="function"==typeof require&&require,s=0;s<r.length;s++)o(r[s]);return o}({1:[function(t,e,n){(function(t){"use strict";function n(){for(var t="",e=0;e<arguments.length;e++){var r=arguments[e];if(r){var o=typeof r;if("string"===o||"number"===o)t+=" "+r;else if(Array.isArray(r))t+=" "+n.apply(null,r);else if("object"===o)for(var a in r)r.hasOwnProperty(a)&&r[a]&&(t+=" "+a)}}return t.substr(1)}function r(t){return{position:{top:t.state.pageY,left:t.state.pageX}}}function o(t){return"both"===t.props.axis||"y"===t.props.axis}function a(t){return"both"===t.props.axis||"x"===t.props.axis}function s(t){return"function"==typeof t||"[object Function]"===Object.prototype.toString.call(t)}function i(t,e){for(var n=0,r=t.length,o=null;r>n;n+=1)if(o=t[n],e.apply(e,[o,n,t]))return o}function p(t,e){var n=i(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(e){return s(t[e])});return t[n].call(t,e)}function f(t){var e=t.touches&&t.touches[0]||t;return{pageX:e.pageX,pageY:e.pageY}}function u(t,e,n,r){if(n){"string"!=typeof n&&"parent"!==n.toLowerCase()&&"object"!=typeof n&&console.warn('Bound should either "parent" or an object');var o=r.parentNode,a=n.top||0,s=n.left||0,i=n.right||o.offsetWidth,p=n.bottom||o.offsetHeight;t=Math.min(t,i-r.offsetWidth),e=Math.min(e,p-r.offsetHeight),t=Math.max(s,t),e=Math.max(a,e)}return{pageX:t,pageY:e}}function h(t,e,n){t&&(t.attachEvent?t.attachEvent("on"+e,n):t.addEventListener?t.addEventListener(e,n,!0):t["on"+e]=n)}function d(t,e,n){t&&(t.detachEvent?t.detachEvent("on"+e,n):t.removeEventListener?t.removeEventListener(e,n,!0):t["on"+e]=null)}var c="undefined"!=typeof window?window.React:"undefined"!=typeof t?t.React:null,l=("undefined"!=typeof window?window.ReactDOM:"undefined"!=typeof t?t.ReactDOM:null).findDOMNode,g=function(){},y=n;if("undefined"==typeof window)var v=!1;else{var v="ontouchstart"in window||"onmsgesturechange"in window;try{document.createEvent("TouchEvent")}catch(w){v=!1}}var m=function(){var t={touch:{start:"touchstart",move:"touchmove",end:"touchend"},mouse:{start:"mousedown",move:"mousemove",end:"mouseup"}};return t[v?"touch":"mouse"]}(),D=c.createClass({displayName:"Draggable",propTypes:{axis:c.PropTypes.oneOf(["both","x","y"]),handle:c.PropTypes.string,cancel:c.PropTypes.string,grid:c.PropTypes.arrayOf(c.PropTypes.number),start:c.PropTypes.object,onStart:c.PropTypes.func,onDrag:c.PropTypes.func,onStop:c.PropTypes.func,onMouseDown:c.PropTypes.func,bound:c.PropTypes.any},componentWillUnmount:function(){d(window,m.move,this.handleDrag),d(window,m.end,this.handleDragEnd)},getDefaultProps:function(){return{axis:"both",handle:null,cancel:null,grid:null,bound:!1,start:{x:0,y:0},onStart:g,onDrag:g,onStop:g,onMouseDown:g}},getInitialState:function(){return{dragging:!1,startX:0,startY:0,offsetX:0,offsetY:0,pageX:this.props.start.x,pageY:this.props.start.y}},handleDragStart:function(t){this.props.onMouseDown(t);var e=l(this);if(!(this.props.handle&&!p(t.target,this.props.handle)||this.props.cancel&&p(t.target,this.props.cancel))){var n=f(t);this.setState({dragging:!0,offsetX:parseInt(n.pageX,10),offsetY:parseInt(n.pageY,10),startX:parseInt(e.style.left,10)||0,startY:parseInt(e.style.top,10)||0}),this.props.onStart(t,r(this)),h(window,m.move,this.handleDrag),h(window,m.end,this.handleDragEnd)}},handleDragEnd:function(t){this.state.dragging&&(this.setState({dragging:!1}),this.props.onStop(t,r(this)),d(window,m.move,this.handleDrag),d(window,m.end,this.handleDragEnd))},handleDrag:function(t){var e=f(t),n=this.state.startX+(e.pageX-this.state.offsetX),o=this.state.startY+(e.pageY-this.state.offsetY),a=u(n,o,this.props.bound,l(this));if(n=a.pageX,o=a.pageY,Array.isArray(this.props.grid)){var s=n<parseInt(this.state.pageX,10)?-1:1,i=o<parseInt(this.state.pageY,10)?-1:1;n=Math.abs(n-parseInt(this.state.pageX,10))>=this.props.grid[0]?parseInt(this.state.pageX,10)+this.props.grid[0]*s:this.state.pageX,o=Math.abs(o-parseInt(this.state.pageY,10))>=this.props.grid[1]?parseInt(this.state.pageY,10)+this.props.grid[1]*i:this.state.pageY}this.setState({pageX:n,pageY:o}),this.props.onDrag(t,r(this)),t.preventDefault()},render:function(){var t={top:o(this)?this.state.pageY:this.state.startY,left:a(this)?this.state.pageX:this.state.startX},e=y({"react-drag":!0,"react-drag-dragging":this.state.dragging}),n=this.props.children.props.className;return n&&(e=n+" "+e),c.cloneElement(c.Children.only(this.props.children),{style:t,className:e,onMouseDown:this.handleDragStart,onTouchStart:function(t){return t.preventDefault(),this.handleDragStart.apply(this,arguments)}.bind(this),onMouseUp:this.handleDragEnd,onTouchEnd:this.handleDragEnd})}});e.exports=D}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)});