function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } import { invariant } from '@react-dnd/invariant'; var isCallingCanDrag = false; var isCallingIsDragging = false; export var DragSourceMonitorImpl = /*#__PURE__*/ function () { function DragSourceMonitorImpl(manager) { _classCallCheck(this, DragSourceMonitorImpl); this.sourceId = null; this.internalMonitor = manager.getMonitor(); } _createClass(DragSourceMonitorImpl, [{ key: "receiveHandlerId", value: function receiveHandlerId(sourceId) { this.sourceId = sourceId; } }, { key: "getHandlerId", value: function getHandlerId() { return this.sourceId; } }, { key: "canDrag", value: function canDrag() { invariant(!isCallingCanDrag, 'You may not call monitor.canDrag() inside your canDrag() implementation. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor'); try { isCallingCanDrag = true; return this.internalMonitor.canDragSource(this.sourceId); } finally { isCallingCanDrag = false; } } }, { key: "isDragging", value: function isDragging() { if (!this.sourceId) { return false; } invariant(!isCallingIsDragging, 'You may not call monitor.isDragging() inside your isDragging() implementation. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor'); try { isCallingIsDragging = true; return this.internalMonitor.isDraggingSource(this.sourceId); } finally { isCallingIsDragging = false; } } }, { key: "subscribeToStateChange", value: function subscribeToStateChange(listener, options) { return this.internalMonitor.subscribeToStateChange(listener, options); } }, { key: "isDraggingSource", value: function isDraggingSource(sourceId) { return this.internalMonitor.isDraggingSource(sourceId); } }, { key: "isOverTarget", value: function isOverTarget(targetId, options) { return this.internalMonitor.isOverTarget(targetId, options); } }, { key: "getTargetIds", value: function getTargetIds() { return this.internalMonitor.getTargetIds(); } }, { key: "isSourcePublic", value: function isSourcePublic() { return this.internalMonitor.isSourcePublic(); } }, { key: "getSourceId", value: function getSourceId() { return this.internalMonitor.getSourceId(); } }, { key: "subscribeToOffsetChange", value: function subscribeToOffsetChange(listener) { return this.internalMonitor.subscribeToOffsetChange(listener); } }, { key: "canDragSource", value: function canDragSource(sourceId) { return this.internalMonitor.canDragSource(sourceId); } }, { key: "canDropOnTarget", value: function canDropOnTarget(targetId) { return this.internalMonitor.canDropOnTarget(targetId); } }, { key: "getItemType", value: function getItemType() { return this.internalMonitor.getItemType(); } }, { key: "getItem", value: function getItem() { return this.internalMonitor.getItem(); } }, { key: "getDropResult", value: function getDropResult() { return this.internalMonitor.getDropResult(); } }, { key: "didDrop", value: function didDrop() { return this.internalMonitor.didDrop(); } }, { key: "getInitialClientOffset", value: function getInitialClientOffset() { return this.internalMonitor.getInitialClientOffset(); } }, { key: "getInitialSourceClientOffset", value: function getInitialSourceClientOffset() { return this.internalMonitor.getInitialSourceClientOffset(); } }, { key: "getSourceClientOffset", value: function getSourceClientOffset() { return this.internalMonitor.getSourceClientOffset(); } }, { key: "getClientOffset", value: function getClientOffset() { return this.internalMonitor.getClientOffset(); } }, { key: "getDifferenceFromInitialOffset", value: function getDifferenceFromInitialOffset() { return this.internalMonitor.getDifferenceFromInitialOffset(); } }]); return DragSourceMonitorImpl; }();