import { createStore } from "./chunk-WOQNBAGN.js"; import { require_jsx_runtime } from "./chunk-NIAJZ5MX.js"; import { require_react } from "./chunk-MADUDGYZ.js"; import { __commonJS, __toESM } from "./chunk-PLDDJCW6.js"; // node_modules/fast-deep-equal/index.js var require_fast_deep_equal = __commonJS({ "node_modules/fast-deep-equal/index.js"(exports, module) { "use strict"; module.exports = function equal2(a, b) { if (a === b) return true; if (a && b && typeof a == "object" && typeof b == "object") { if (a.constructor !== b.constructor) return false; var length, i, keys; if (Array.isArray(a)) { length = a.length; if (length != b.length) return false; for (i = length; i-- !== 0; ) if (!equal2(a[i], b[i])) return false; return true; } if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); keys = Object.keys(a); length = keys.length; if (length !== Object.keys(b).length) return false; for (i = length; i-- !== 0; ) if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; for (i = length; i-- !== 0; ) { var key = keys[i]; if (!equal2(a[key], b[key])) return false; } return true; } return a !== a && b !== b; }; } }); // node_modules/react-dnd/dist/core/DndProvider.js var import_jsx_runtime = __toESM(require_jsx_runtime(), 1); // node_modules/@react-dnd/invariant/dist/index.js function invariant(condition, format, ...args) { if (isProduction()) { if (format === void 0) { throw new Error("invariant requires an error message argument"); } } if (!condition) { let error; if (format === void 0) { error = new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings."); } else { let argIndex = 0; error = new Error(format.replace(/%s/g, function() { return args[argIndex++]; })); error.name = "Invariant Violation"; } error.framesToPop = 1; throw error; } } function isProduction() { return typeof process !== "undefined" && false; } // node_modules/dnd-core/dist/utils/js_utils.js function get(obj, path, defaultValue) { return path.split(".").reduce( (a, c) => a && a[c] ? a[c] : defaultValue || null, obj ); } function without(items, item) { return items.filter( (i) => i !== item ); } function isObject(input) { return typeof input === "object"; } function xor(itemsA, itemsB) { const map = /* @__PURE__ */ new Map(); const insertItem = (item) => { map.set(item, map.has(item) ? map.get(item) + 1 : 1); }; itemsA.forEach(insertItem); itemsB.forEach(insertItem); const result = []; map.forEach((count, key) => { if (count === 1) { result.push(key); } }); return result; } function intersection(itemsA, itemsB) { return itemsA.filter( (t) => itemsB.indexOf(t) > -1 ); } // node_modules/dnd-core/dist/actions/dragDrop/types.js var INIT_COORDS = "dnd-core/INIT_COORDS"; var BEGIN_DRAG = "dnd-core/BEGIN_DRAG"; var PUBLISH_DRAG_SOURCE = "dnd-core/PUBLISH_DRAG_SOURCE"; var HOVER = "dnd-core/HOVER"; var DROP = "dnd-core/DROP"; var END_DRAG = "dnd-core/END_DRAG"; // node_modules/dnd-core/dist/actions/dragDrop/local/setClientOffset.js function setClientOffset(clientOffset, sourceClientOffset) { return { type: INIT_COORDS, payload: { sourceClientOffset: sourceClientOffset || null, clientOffset: clientOffset || null } }; } // node_modules/dnd-core/dist/actions/dragDrop/beginDrag.js var ResetCoordinatesAction = { type: INIT_COORDS, payload: { clientOffset: null, sourceClientOffset: null } }; function createBeginDrag(manager) { return function beginDrag(sourceIds = [], options = { publishSource: true }) { const { publishSource = true, clientOffset, getSourceClientOffset: getSourceClientOffset2 } = options; const monitor = manager.getMonitor(); const registry = manager.getRegistry(); manager.dispatch(setClientOffset(clientOffset)); verifyInvariants(sourceIds, monitor, registry); const sourceId = getDraggableSource(sourceIds, monitor); if (sourceId == null) { manager.dispatch(ResetCoordinatesAction); return; } let sourceClientOffset = null; if (clientOffset) { if (!getSourceClientOffset2) { throw new Error("getSourceClientOffset must be defined"); } verifyGetSourceClientOffsetIsFunction(getSourceClientOffset2); sourceClientOffset = getSourceClientOffset2(sourceId); } manager.dispatch(setClientOffset(clientOffset, sourceClientOffset)); const source = registry.getSource(sourceId); const item = source.beginDrag(monitor, sourceId); if (item == null) { return void 0; } verifyItemIsObject(item); registry.pinSource(sourceId); const itemType = registry.getSourceType(sourceId); return { type: BEGIN_DRAG, payload: { itemType, item, sourceId, clientOffset: clientOffset || null, sourceClientOffset: sourceClientOffset || null, isSourcePublic: !!publishSource } }; }; } function verifyInvariants(sourceIds, monitor, registry) { invariant(!monitor.isDragging(), "Cannot call beginDrag while dragging."); sourceIds.forEach(function(sourceId) { invariant(registry.getSource(sourceId), "Expected sourceIds to be registered."); }); } function verifyGetSourceClientOffsetIsFunction(getSourceClientOffset2) { invariant(typeof getSourceClientOffset2 === "function", "When clientOffset is provided, getSourceClientOffset must be a function."); } function verifyItemIsObject(item) { invariant(isObject(item), "Item must be an object."); } function getDraggableSource(sourceIds, monitor) { let sourceId = null; for (let i = sourceIds.length - 1; i >= 0; i--) { if (monitor.canDragSource(sourceIds[i])) { sourceId = sourceIds[i]; break; } } return sourceId; } // node_modules/dnd-core/dist/actions/dragDrop/drop.js function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function(key) { _defineProperty(target, key, source[key]); }); } return target; } function createDrop(manager) { return function drop(options = {}) { const monitor = manager.getMonitor(); const registry = manager.getRegistry(); verifyInvariants2(monitor); const targetIds = getDroppableTargets(monitor); targetIds.forEach((targetId, index) => { const dropResult = determineDropResult(targetId, index, registry, monitor); const action = { type: DROP, payload: { dropResult: _objectSpread({}, options, dropResult) } }; manager.dispatch(action); }); }; } function verifyInvariants2(monitor) { invariant(monitor.isDragging(), "Cannot call drop while not dragging."); invariant(!monitor.didDrop(), "Cannot call drop twice during one drag operation."); } function determineDropResult(targetId, index, registry, monitor) { const target = registry.getTarget(targetId); let dropResult = target ? target.drop(monitor, targetId) : void 0; verifyDropResultType(dropResult); if (typeof dropResult === "undefined") { dropResult = index === 0 ? {} : monitor.getDropResult(); } return dropResult; } function verifyDropResultType(dropResult) { invariant(typeof dropResult === "undefined" || isObject(dropResult), "Drop result must either be an object or undefined."); } function getDroppableTargets(monitor) { const targetIds = monitor.getTargetIds().filter(monitor.canDropOnTarget, monitor); targetIds.reverse(); return targetIds; } // node_modules/dnd-core/dist/actions/dragDrop/endDrag.js function createEndDrag(manager) { return function endDrag() { const monitor = manager.getMonitor(); const registry = manager.getRegistry(); verifyIsDragging(monitor); const sourceId = monitor.getSourceId(); if (sourceId != null) { const source = registry.getSource(sourceId, true); source.endDrag(monitor, sourceId); registry.unpinSource(); } return { type: END_DRAG }; }; } function verifyIsDragging(monitor) { invariant(monitor.isDragging(), "Cannot call endDrag while not dragging."); } // node_modules/dnd-core/dist/utils/matchesType.js function matchesType(targetType, draggedItemType) { if (draggedItemType === null) { return targetType === null; } return Array.isArray(targetType) ? targetType.some( (t) => t === draggedItemType ) : targetType === draggedItemType; } // node_modules/dnd-core/dist/actions/dragDrop/hover.js function createHover(manager) { return function hover(targetIdsArg, { clientOffset } = {}) { verifyTargetIdsIsArray(targetIdsArg); const targetIds = targetIdsArg.slice(0); const monitor = manager.getMonitor(); const registry = manager.getRegistry(); const draggedItemType = monitor.getItemType(); removeNonMatchingTargetIds(targetIds, registry, draggedItemType); checkInvariants(targetIds, monitor, registry); hoverAllTargets(targetIds, monitor, registry); return { type: HOVER, payload: { targetIds, clientOffset: clientOffset || null } }; }; } function verifyTargetIdsIsArray(targetIdsArg) { invariant(Array.isArray(targetIdsArg), "Expected targetIds to be an array."); } function checkInvariants(targetIds, monitor, registry) { invariant(monitor.isDragging(), "Cannot call hover while not dragging."); invariant(!monitor.didDrop(), "Cannot call hover after drop."); for (let i = 0; i < targetIds.length; i++) { const targetId = targetIds[i]; invariant(targetIds.lastIndexOf(targetId) === i, "Expected targetIds to be unique in the passed array."); const target = registry.getTarget(targetId); invariant(target, "Expected targetIds to be registered."); } } function removeNonMatchingTargetIds(targetIds, registry, draggedItemType) { for (let i = targetIds.length - 1; i >= 0; i--) { const targetId = targetIds[i]; const targetType = registry.getTargetType(targetId); if (!matchesType(targetType, draggedItemType)) { targetIds.splice(i, 1); } } } function hoverAllTargets(targetIds, monitor, registry) { targetIds.forEach(function(targetId) { const target = registry.getTarget(targetId); target.hover(monitor, targetId); }); } // node_modules/dnd-core/dist/actions/dragDrop/publishDragSource.js function createPublishDragSource(manager) { return function publishDragSource() { const monitor = manager.getMonitor(); if (monitor.isDragging()) { return { type: PUBLISH_DRAG_SOURCE }; } return; }; } // node_modules/dnd-core/dist/actions/dragDrop/index.js function createDragDropActions(manager) { return { beginDrag: createBeginDrag(manager), publishDragSource: createPublishDragSource(manager), hover: createHover(manager), drop: createDrop(manager), endDrag: createEndDrag(manager) }; } // node_modules/dnd-core/dist/classes/DragDropManagerImpl.js var DragDropManagerImpl = class { receiveBackend(backend) { this.backend = backend; } getMonitor() { return this.monitor; } getBackend() { return this.backend; } getRegistry() { return this.monitor.registry; } getActions() { const manager = this; const { dispatch } = this.store; function bindActionCreator(actionCreator) { return (...args) => { const action = actionCreator.apply(manager, args); if (typeof action !== "undefined") { dispatch(action); } }; } const actions = createDragDropActions(this); return Object.keys(actions).reduce((boundActions, key) => { const action = actions[key]; boundActions[key] = bindActionCreator(action); return boundActions; }, {}); } dispatch(action) { this.store.dispatch(action); } constructor(store, monitor) { this.isSetUp = false; this.handleRefCountChange = () => { const shouldSetUp = this.store.getState().refCount > 0; if (this.backend) { if (shouldSetUp && !this.isSetUp) { this.backend.setup(); this.isSetUp = true; } else if (!shouldSetUp && this.isSetUp) { this.backend.teardown(); this.isSetUp = false; } } }; this.store = store; this.monitor = monitor; store.subscribe(this.handleRefCountChange); } }; // node_modules/dnd-core/dist/utils/coords.js function add(a, b) { return { x: a.x + b.x, y: a.y + b.y }; } function subtract(a, b) { return { x: a.x - b.x, y: a.y - b.y }; } function getSourceClientOffset(state) { const { clientOffset, initialClientOffset, initialSourceClientOffset } = state; if (!clientOffset || !initialClientOffset || !initialSourceClientOffset) { return null; } return subtract(add(clientOffset, initialSourceClientOffset), initialClientOffset); } function getDifferenceFromInitialOffset(state) { const { clientOffset, initialClientOffset } = state; if (!clientOffset || !initialClientOffset) { return null; } return subtract(clientOffset, initialClientOffset); } // node_modules/dnd-core/dist/utils/dirtiness.js var NONE = []; var ALL = []; NONE.__IS_NONE__ = true; ALL.__IS_ALL__ = true; function areDirty(dirtyIds, handlerIds) { if (dirtyIds === NONE) { return false; } if (dirtyIds === ALL || typeof handlerIds === "undefined") { return true; } const commonIds = intersection(handlerIds, dirtyIds); return commonIds.length > 0; } // node_modules/dnd-core/dist/classes/DragDropMonitorImpl.js var DragDropMonitorImpl = class { subscribeToStateChange(listener, options = {}) { const { handlerIds } = options; invariant(typeof listener === "function", "listener must be a function."); invariant(typeof handlerIds === "undefined" || Array.isArray(handlerIds), "handlerIds, when specified, must be an array of strings."); let prevStateId = this.store.getState().stateId; const handleChange = () => { const state = this.store.getState(); const currentStateId = state.stateId; try { const canSkipListener = currentStateId === prevStateId || currentStateId === prevStateId + 1 && !areDirty(state.dirtyHandlerIds, handlerIds); if (!canSkipListener) { listener(); } } finally { prevStateId = currentStateId; } }; return this.store.subscribe(handleChange); } subscribeToOffsetChange(listener) { invariant(typeof listener === "function", "listener must be a function."); let previousState = this.store.getState().dragOffset; const handleChange = () => { const nextState = this.store.getState().dragOffset; if (nextState === previousState) { return; } previousState = nextState; listener(); }; return this.store.subscribe(handleChange); } canDragSource(sourceId) { if (!sourceId) { return false; } const source = this.registry.getSource(sourceId); invariant(source, `Expected to find a valid source. sourceId=${sourceId}`); if (this.isDragging()) { return false; } return source.canDrag(this, sourceId); } canDropOnTarget(targetId) { if (!targetId) { return false; } const target = this.registry.getTarget(targetId); invariant(target, `Expected to find a valid target. targetId=${targetId}`); if (!this.isDragging() || this.didDrop()) { return false; } const targetType = this.registry.getTargetType(targetId); const draggedItemType = this.getItemType(); return matchesType(targetType, draggedItemType) && target.canDrop(this, targetId); } isDragging() { return Boolean(this.getItemType()); } isDraggingSource(sourceId) { if (!sourceId) { return false; } const source = this.registry.getSource(sourceId, true); invariant(source, `Expected to find a valid source. sourceId=${sourceId}`); if (!this.isDragging() || !this.isSourcePublic()) { return false; } const sourceType = this.registry.getSourceType(sourceId); const draggedItemType = this.getItemType(); if (sourceType !== draggedItemType) { return false; } return source.isDragging(this, sourceId); } isOverTarget(targetId, options = { shallow: false }) { if (!targetId) { return false; } const { shallow } = options; if (!this.isDragging()) { return false; } const targetType = this.registry.getTargetType(targetId); const draggedItemType = this.getItemType(); if (draggedItemType && !matchesType(targetType, draggedItemType)) { return false; } const targetIds = this.getTargetIds(); if (!targetIds.length) { return false; } const index = targetIds.indexOf(targetId); if (shallow) { return index === targetIds.length - 1; } else { return index > -1; } } getItemType() { return this.store.getState().dragOperation.itemType; } getItem() { return this.store.getState().dragOperation.item; } getSourceId() { return this.store.getState().dragOperation.sourceId; } getTargetIds() { return this.store.getState().dragOperation.targetIds; } getDropResult() { return this.store.getState().dragOperation.dropResult; } didDrop() { return this.store.getState().dragOperation.didDrop; } isSourcePublic() { return Boolean(this.store.getState().dragOperation.isSourcePublic); } getInitialClientOffset() { return this.store.getState().dragOffset.initialClientOffset; } getInitialSourceClientOffset() { return this.store.getState().dragOffset.initialSourceClientOffset; } getClientOffset() { return this.store.getState().dragOffset.clientOffset; } getSourceClientOffset() { return getSourceClientOffset(this.store.getState().dragOffset); } getDifferenceFromInitialOffset() { return getDifferenceFromInitialOffset(this.store.getState().dragOffset); } constructor(store, registry) { this.store = store; this.registry = registry; } }; // node_modules/@react-dnd/asap/dist/makeRequestCall.js var scope = typeof global !== "undefined" ? global : self; var BrowserMutationObserver = scope.MutationObserver || scope.WebKitMutationObserver; function makeRequestCallFromTimer(callback) { return function requestCall() { const timeoutHandle = setTimeout(handleTimer, 0); const intervalHandle = setInterval(handleTimer, 50); function handleTimer() { clearTimeout(timeoutHandle); clearInterval(intervalHandle); callback(); } }; } function makeRequestCallFromMutationObserver(callback) { let toggle = 1; const observer = new BrowserMutationObserver(callback); const node = document.createTextNode(""); observer.observe(node, { characterData: true }); return function requestCall() { toggle = -toggle; node.data = toggle; }; } var makeRequestCall = typeof BrowserMutationObserver === "function" ? ( // reliably everywhere they are implemented. // They are implemented in all modern browsers. // // - Android 4-4.3 // - Chrome 26-34 // - Firefox 14-29 // - Internet Explorer 11 // - iPad Safari 6-7.1 // - iPhone Safari 7-7.1 // - Safari 6-7 makeRequestCallFromMutationObserver ) : ( // task queue, are implemented in Internet Explorer 10, Safari 5.0-1, and Opera // 11-12, and in web workers in many engines. // Although message channels yield to any queued rendering and IO tasks, they // would be better than imposing the 4ms delay of timers. // However, they do not work reliably in Internet Explorer or Safari. // Internet Explorer 10 is the only browser that has setImmediate but does // not have MutationObservers. // Although setImmediate yields to the browser's renderer, it would be // preferrable to falling back to setTimeout since it does not have // the minimum 4ms penalty. // Unfortunately there appears to be a bug in Internet Explorer 10 Mobile (and // Desktop to a lesser extent) that renders both setImmediate and // MessageChannel useless for the purposes of ASAP. // https://github.com/kriskowal/q/issues/396 // Timers are implemented universally. // We fall back to timers in workers in most engines, and in foreground // contexts in the following browsers. // However, note that even this simple case requires nuances to operate in a // broad spectrum of browsers. // // - Firefox 3-13 // - Internet Explorer 6-9 // - iPad Safari 4.3 // - Lynx 2.8.7 makeRequestCallFromTimer ); // node_modules/@react-dnd/asap/dist/AsapQueue.js var AsapQueue = class { // Use the fastest means possible to execute a task in its own turn, with // priority over other events including IO, animation, reflow, and redraw // events in browsers. // // An exception thrown by a task will permanently interrupt the processing of // subsequent tasks. The higher level `asap` function ensures that if an // exception is thrown by a task, that the task queue will continue flushing as // soon as possible, but if you use `rawAsap` directly, you are responsible to // either ensure that no exceptions are thrown from your task, or to manually // call `rawAsap.requestFlush` if an exception is thrown. enqueueTask(task) { const { queue: q, requestFlush } = this; if (!q.length) { requestFlush(); this.flushing = true; } q[q.length] = task; } constructor() { this.queue = []; this.pendingErrors = []; this.flushing = false; this.index = 0; this.capacity = 1024; this.flush = () => { const { queue: q } = this; while (this.index < q.length) { const currentIndex = this.index; this.index++; q[currentIndex].call(); if (this.index > this.capacity) { for (let scan = 0, newLength = q.length - this.index; scan < newLength; scan++) { q[scan] = q[scan + this.index]; } q.length -= this.index; this.index = 0; } } q.length = 0; this.index = 0; this.flushing = false; }; this.registerPendingError = (err) => { this.pendingErrors.push(err); this.requestErrorThrow(); }; this.requestFlush = makeRequestCall(this.flush); this.requestErrorThrow = makeRequestCallFromTimer(() => { if (this.pendingErrors.length) { throw this.pendingErrors.shift(); } }); } }; // node_modules/@react-dnd/asap/dist/RawTask.js var RawTask = class { call() { try { this.task && this.task(); } catch (error) { this.onError(error); } finally { this.task = null; this.release(this); } } constructor(onError, release) { this.onError = onError; this.release = release; this.task = null; } }; // node_modules/@react-dnd/asap/dist/TaskFactory.js var TaskFactory = class { create(task) { const tasks = this.freeTasks; const t1 = tasks.length ? tasks.pop() : new RawTask( this.onError, (t) => tasks[tasks.length] = t ); t1.task = task; return t1; } constructor(onError) { this.onError = onError; this.freeTasks = []; } }; // node_modules/@react-dnd/asap/dist/asap.js var asapQueue = new AsapQueue(); var taskFactory = new TaskFactory(asapQueue.registerPendingError); function asap(task) { asapQueue.enqueueTask(taskFactory.create(task)); } // node_modules/dnd-core/dist/actions/registry.js var ADD_SOURCE = "dnd-core/ADD_SOURCE"; var ADD_TARGET = "dnd-core/ADD_TARGET"; var REMOVE_SOURCE = "dnd-core/REMOVE_SOURCE"; var REMOVE_TARGET = "dnd-core/REMOVE_TARGET"; function addSource(sourceId) { return { type: ADD_SOURCE, payload: { sourceId } }; } function addTarget(targetId) { return { type: ADD_TARGET, payload: { targetId } }; } function removeSource(sourceId) { return { type: REMOVE_SOURCE, payload: { sourceId } }; } function removeTarget(targetId) { return { type: REMOVE_TARGET, payload: { targetId } }; } // node_modules/dnd-core/dist/contracts.js function validateSourceContract(source) { invariant(typeof source.canDrag === "function", "Expected canDrag to be a function."); invariant(typeof source.beginDrag === "function", "Expected beginDrag to be a function."); invariant(typeof source.endDrag === "function", "Expected endDrag to be a function."); } function validateTargetContract(target) { invariant(typeof target.canDrop === "function", "Expected canDrop to be a function."); invariant(typeof target.hover === "function", "Expected hover to be a function."); invariant(typeof target.drop === "function", "Expected beginDrag to be a function."); } function validateType(type, allowArray) { if (allowArray && Array.isArray(type)) { type.forEach( (t) => validateType(t, false) ); return; } invariant(typeof type === "string" || typeof type === "symbol", allowArray ? "Type can only be a string, a symbol, or an array of either." : "Type can only be a string or a symbol."); } // node_modules/dnd-core/dist/interfaces.js var HandlerRole; (function(HandlerRole2) { HandlerRole2["SOURCE"] = "SOURCE"; HandlerRole2["TARGET"] = "TARGET"; })(HandlerRole || (HandlerRole = {})); // node_modules/dnd-core/dist/utils/getNextUniqueId.js var nextUniqueId = 0; function getNextUniqueId() { return nextUniqueId++; } // node_modules/dnd-core/dist/classes/HandlerRegistryImpl.js function getNextHandlerId(role) { const id = getNextUniqueId().toString(); switch (role) { case HandlerRole.SOURCE: return `S${id}`; case HandlerRole.TARGET: return `T${id}`; default: throw new Error(`Unknown Handler Role: ${role}`); } } function parseRoleFromHandlerId(handlerId) { switch (handlerId[0]) { case "S": return HandlerRole.SOURCE; case "T": return HandlerRole.TARGET; default: throw new Error(`Cannot parse handler ID: ${handlerId}`); } } function mapContainsValue(map, searchValue) { const entries = map.entries(); let isDone = false; do { const { done, value: [, value] } = entries.next(); if (value === searchValue) { return true; } isDone = !!done; } while (!isDone); return false; } var HandlerRegistryImpl = class { addSource(type, source) { validateType(type); validateSourceContract(source); const sourceId = this.addHandler(HandlerRole.SOURCE, type, source); this.store.dispatch(addSource(sourceId)); return sourceId; } addTarget(type, target) { validateType(type, true); validateTargetContract(target); const targetId = this.addHandler(HandlerRole.TARGET, type, target); this.store.dispatch(addTarget(targetId)); return targetId; } containsHandler(handler) { return mapContainsValue(this.dragSources, handler) || mapContainsValue(this.dropTargets, handler); } getSource(sourceId, includePinned = false) { invariant(this.isSourceId(sourceId), "Expected a valid source ID."); const isPinned = includePinned && sourceId === this.pinnedSourceId; const source = isPinned ? this.pinnedSource : this.dragSources.get(sourceId); return source; } getTarget(targetId) { invariant(this.isTargetId(targetId), "Expected a valid target ID."); return this.dropTargets.get(targetId); } getSourceType(sourceId) { invariant(this.isSourceId(sourceId), "Expected a valid source ID."); return this.types.get(sourceId); } getTargetType(targetId) { invariant(this.isTargetId(targetId), "Expected a valid target ID."); return this.types.get(targetId); } isSourceId(handlerId) { const role = parseRoleFromHandlerId(handlerId); return role === HandlerRole.SOURCE; } isTargetId(handlerId) { const role = parseRoleFromHandlerId(handlerId); return role === HandlerRole.TARGET; } removeSource(sourceId) { invariant(this.getSource(sourceId), "Expected an existing source."); this.store.dispatch(removeSource(sourceId)); asap(() => { this.dragSources.delete(sourceId); this.types.delete(sourceId); }); } removeTarget(targetId) { invariant(this.getTarget(targetId), "Expected an existing target."); this.store.dispatch(removeTarget(targetId)); this.dropTargets.delete(targetId); this.types.delete(targetId); } pinSource(sourceId) { const source = this.getSource(sourceId); invariant(source, "Expected an existing source."); this.pinnedSourceId = sourceId; this.pinnedSource = source; } unpinSource() { invariant(this.pinnedSource, "No source is pinned at the time."); this.pinnedSourceId = null; this.pinnedSource = null; } addHandler(role, type, handler) { const id = getNextHandlerId(role); this.types.set(id, type); if (role === HandlerRole.SOURCE) { this.dragSources.set(id, handler); } else if (role === HandlerRole.TARGET) { this.dropTargets.set(id, handler); } return id; } constructor(store) { this.types = /* @__PURE__ */ new Map(); this.dragSources = /* @__PURE__ */ new Map(); this.dropTargets = /* @__PURE__ */ new Map(); this.pinnedSourceId = null; this.pinnedSource = null; this.store = store; } }; // node_modules/dnd-core/dist/utils/equality.js var strictEquality = (a, b) => a === b; function areCoordsEqual(offsetA, offsetB) { if (!offsetA && !offsetB) { return true; } else if (!offsetA || !offsetB) { return false; } else { return offsetA.x === offsetB.x && offsetA.y === offsetB.y; } } function areArraysEqual(a, b, isEqual = strictEquality) { if (a.length !== b.length) { return false; } for (let i = 0; i < a.length; ++i) { if (!isEqual(a[i], b[i])) { return false; } } return true; } // node_modules/dnd-core/dist/reducers/dirtyHandlerIds.js function reduce(_state = NONE, action) { switch (action.type) { case HOVER: break; case ADD_SOURCE: case ADD_TARGET: case REMOVE_TARGET: case REMOVE_SOURCE: return NONE; case BEGIN_DRAG: case PUBLISH_DRAG_SOURCE: case END_DRAG: case DROP: default: return ALL; } const { targetIds = [], prevTargetIds = [] } = action.payload; const result = xor(targetIds, prevTargetIds); const didChange = result.length > 0 || !areArraysEqual(targetIds, prevTargetIds); if (!didChange) { return NONE; } const prevInnermostTargetId = prevTargetIds[prevTargetIds.length - 1]; const innermostTargetId = targetIds[targetIds.length - 1]; if (prevInnermostTargetId !== innermostTargetId) { if (prevInnermostTargetId) { result.push(prevInnermostTargetId); } if (innermostTargetId) { result.push(innermostTargetId); } } return result; } // node_modules/dnd-core/dist/reducers/dragOffset.js function _defineProperty2(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _objectSpread2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function(key) { _defineProperty2(target, key, source[key]); }); } return target; } var initialState = { initialSourceClientOffset: null, initialClientOffset: null, clientOffset: null }; function reduce2(state = initialState, action) { const { payload } = action; switch (action.type) { case INIT_COORDS: case BEGIN_DRAG: return { initialSourceClientOffset: payload.sourceClientOffset, initialClientOffset: payload.clientOffset, clientOffset: payload.clientOffset }; case HOVER: if (areCoordsEqual(state.clientOffset, payload.clientOffset)) { return state; } return _objectSpread2({}, state, { clientOffset: payload.clientOffset }); case END_DRAG: case DROP: return initialState; default: return state; } } // node_modules/dnd-core/dist/reducers/dragOperation.js function _defineProperty3(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _objectSpread3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function(key) { _defineProperty3(target, key, source[key]); }); } return target; } var initialState2 = { itemType: null, item: null, sourceId: null, targetIds: [], dropResult: null, didDrop: false, isSourcePublic: null }; function reduce3(state = initialState2, action) { const { payload } = action; switch (action.type) { case BEGIN_DRAG: return _objectSpread3({}, state, { itemType: payload.itemType, item: payload.item, sourceId: payload.sourceId, isSourcePublic: payload.isSourcePublic, dropResult: null, didDrop: false }); case PUBLISH_DRAG_SOURCE: return _objectSpread3({}, state, { isSourcePublic: true }); case HOVER: return _objectSpread3({}, state, { targetIds: payload.targetIds }); case REMOVE_TARGET: if (state.targetIds.indexOf(payload.targetId) === -1) { return state; } return _objectSpread3({}, state, { targetIds: without(state.targetIds, payload.targetId) }); case DROP: return _objectSpread3({}, state, { dropResult: payload.dropResult, didDrop: true, targetIds: [] }); case END_DRAG: return _objectSpread3({}, state, { itemType: null, item: null, sourceId: null, dropResult: null, didDrop: false, isSourcePublic: null, targetIds: [] }); default: return state; } } // node_modules/dnd-core/dist/reducers/refCount.js function reduce4(state = 0, action) { switch (action.type) { case ADD_SOURCE: case ADD_TARGET: return state + 1; case REMOVE_SOURCE: case REMOVE_TARGET: return state - 1; default: return state; } } // node_modules/dnd-core/dist/reducers/stateId.js function reduce5(state = 0) { return state + 1; } // node_modules/dnd-core/dist/reducers/index.js function _defineProperty4(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _objectSpread4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function(key) { _defineProperty4(target, key, source[key]); }); } return target; } function reduce6(state = {}, action) { return { dirtyHandlerIds: reduce(state.dirtyHandlerIds, { type: action.type, payload: _objectSpread4({}, action.payload, { prevTargetIds: get(state, "dragOperation.targetIds", []) }) }), dragOffset: reduce2(state.dragOffset, action), refCount: reduce4(state.refCount, action), dragOperation: reduce3(state.dragOperation, action), stateId: reduce5(state.stateId) }; } // node_modules/dnd-core/dist/createDragDropManager.js function createDragDropManager(backendFactory, globalContext = void 0, backendOptions = {}, debugMode = false) { const store = makeStoreInstance(debugMode); const monitor = new DragDropMonitorImpl(store, new HandlerRegistryImpl(store)); const manager = new DragDropManagerImpl(store, monitor); const backend = backendFactory(manager, globalContext, backendOptions); manager.receiveBackend(backend); return manager; } function makeStoreInstance(debugMode) { const reduxDevTools = typeof window !== "undefined" && window.__REDUX_DEVTOOLS_EXTENSION__; return createStore(reduce6, debugMode && reduxDevTools && reduxDevTools({ name: "dnd-core", instanceId: "dnd-core" })); } // node_modules/react-dnd/dist/core/DndProvider.js var import_react2 = __toESM(require_react(), 1); // node_modules/react-dnd/dist/core/DndContext.js var import_react = __toESM(require_react(), 1); var DndContext = (0, import_react.createContext)({ dragDropManager: void 0 }); // node_modules/react-dnd/dist/core/DndProvider.js function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } var refCount = 0; var INSTANCE_SYM = Symbol.for("__REACT_DND_CONTEXT_INSTANCE__"); var DndProvider = (0, import_react2.memo)(function DndProvider2(_param) { var { children } = _param, props = _objectWithoutProperties(_param, [ "children" ]); const [manager, isGlobalInstance] = getDndContextValue(props); (0, import_react2.useEffect)(() => { if (isGlobalInstance) { const context = getGlobalContext(); ++refCount; return () => { if (--refCount === 0) { context[INSTANCE_SYM] = null; } }; } return; }, []); return (0, import_jsx_runtime.jsx)(DndContext.Provider, { value: manager, children }); }); function getDndContextValue(props) { if ("manager" in props) { const manager2 = { dragDropManager: props.manager }; return [ manager2, false ]; } const manager = createSingletonDndContext(props.backend, props.context, props.options, props.debugMode); const isGlobalInstance = !props.context; return [ manager, isGlobalInstance ]; } function createSingletonDndContext(backend, context = getGlobalContext(), options, debugMode) { const ctx = context; if (!ctx[INSTANCE_SYM]) { ctx[INSTANCE_SYM] = { dragDropManager: createDragDropManager(backend, context, options, debugMode) }; } return ctx[INSTANCE_SYM]; } function getGlobalContext() { return typeof global !== "undefined" ? global : window; } // node_modules/react-dnd/dist/core/DragPreviewImage.js var import_react3 = __toESM(require_react(), 1); var DragPreviewImage = (0, import_react3.memo)(function DragPreviewImage2({ connect, src }) { (0, import_react3.useEffect)(() => { if (typeof Image === "undefined") return; let connected = false; const img = new Image(); img.src = src; img.onload = () => { connect(img); connected = true; }; return () => { if (connected) { connect(null); } }; }); return null; }); // node_modules/react-dnd/dist/hooks/useCollector.js var import_fast_deep_equal = __toESM(require_fast_deep_equal(), 1); var import_react5 = __toESM(require_react(), 1); // node_modules/react-dnd/dist/hooks/useIsomorphicLayoutEffect.js var import_react4 = __toESM(require_react(), 1); var useIsomorphicLayoutEffect = typeof window !== "undefined" ? import_react4.useLayoutEffect : import_react4.useEffect; // node_modules/react-dnd/dist/hooks/useCollector.js function useCollector(monitor, collect, onUpdate) { const [collected, setCollected] = (0, import_react5.useState)( () => collect(monitor) ); const updateCollected = (0, import_react5.useCallback)(() => { const nextValue = collect(monitor); if (!(0, import_fast_deep_equal.default)(collected, nextValue)) { setCollected(nextValue); if (onUpdate) { onUpdate(); } } }, [ collected, monitor, onUpdate ]); useIsomorphicLayoutEffect(updateCollected); return [ collected, updateCollected ]; } // node_modules/react-dnd/dist/hooks/useMonitorOutput.js function useMonitorOutput(monitor, collect, onCollect) { const [collected, updateCollected] = useCollector(monitor, collect, onCollect); useIsomorphicLayoutEffect(function subscribeToMonitorStateChange() { const handlerId = monitor.getHandlerId(); if (handlerId == null) { return; } return monitor.subscribeToStateChange(updateCollected, { handlerIds: [ handlerId ] }); }, [ monitor, updateCollected ]); return collected; } // node_modules/react-dnd/dist/hooks/useCollectedProps.js function useCollectedProps(collector, monitor, connector) { return useMonitorOutput( monitor, collector || (() => ({})), () => connector.reconnect() ); } // node_modules/react-dnd/dist/hooks/useOptionalFactory.js var import_react6 = __toESM(require_react(), 1); function useOptionalFactory(arg, deps) { const memoDeps = [ ...deps || [] ]; if (deps == null && typeof arg !== "function") { memoDeps.push(arg); } return (0, import_react6.useMemo)(() => { return typeof arg === "function" ? arg() : arg; }, memoDeps); } // node_modules/react-dnd/dist/hooks/useDrag/connectors.js var import_react7 = __toESM(require_react(), 1); function useConnectDragSource(connector) { return (0, import_react7.useMemo)( () => connector.hooks.dragSource(), [ connector ] ); } function useConnectDragPreview(connector) { return (0, import_react7.useMemo)( () => connector.hooks.dragPreview(), [ connector ] ); } // node_modules/react-dnd/dist/hooks/useDrag/useDragSourceConnector.js var import_react10 = __toESM(require_react(), 1); // node_modules/react-dnd/dist/internals/DragSourceMonitorImpl.js var isCallingCanDrag = false; var isCallingIsDragging = false; var DragSourceMonitorImpl = class { receiveHandlerId(sourceId) { this.sourceId = sourceId; } getHandlerId() { return this.sourceId; } 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; } } 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; } } subscribeToStateChange(listener, options) { return this.internalMonitor.subscribeToStateChange(listener, options); } isDraggingSource(sourceId) { return this.internalMonitor.isDraggingSource(sourceId); } isOverTarget(targetId, options) { return this.internalMonitor.isOverTarget(targetId, options); } getTargetIds() { return this.internalMonitor.getTargetIds(); } isSourcePublic() { return this.internalMonitor.isSourcePublic(); } getSourceId() { return this.internalMonitor.getSourceId(); } subscribeToOffsetChange(listener) { return this.internalMonitor.subscribeToOffsetChange(listener); } canDragSource(sourceId) { return this.internalMonitor.canDragSource(sourceId); } canDropOnTarget(targetId) { return this.internalMonitor.canDropOnTarget(targetId); } getItemType() { return this.internalMonitor.getItemType(); } getItem() { return this.internalMonitor.getItem(); } getDropResult() { return this.internalMonitor.getDropResult(); } didDrop() { return this.internalMonitor.didDrop(); } getInitialClientOffset() { return this.internalMonitor.getInitialClientOffset(); } getInitialSourceClientOffset() { return this.internalMonitor.getInitialSourceClientOffset(); } getSourceClientOffset() { return this.internalMonitor.getSourceClientOffset(); } getClientOffset() { return this.internalMonitor.getClientOffset(); } getDifferenceFromInitialOffset() { return this.internalMonitor.getDifferenceFromInitialOffset(); } constructor(manager) { this.sourceId = null; this.internalMonitor = manager.getMonitor(); } }; // node_modules/react-dnd/dist/internals/DropTargetMonitorImpl.js var isCallingCanDrop = false; var DropTargetMonitorImpl = class { receiveHandlerId(targetId) { this.targetId = targetId; } getHandlerId() { return this.targetId; } subscribeToStateChange(listener, options) { return this.internalMonitor.subscribeToStateChange(listener, options); } canDrop() { if (!this.targetId) { return false; } invariant(!isCallingCanDrop, "You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor"); try { isCallingCanDrop = true; return this.internalMonitor.canDropOnTarget(this.targetId); } finally { isCallingCanDrop = false; } } isOver(options) { if (!this.targetId) { return false; } return this.internalMonitor.isOverTarget(this.targetId, options); } getItemType() { return this.internalMonitor.getItemType(); } getItem() { return this.internalMonitor.getItem(); } getDropResult() { return this.internalMonitor.getDropResult(); } didDrop() { return this.internalMonitor.didDrop(); } getInitialClientOffset() { return this.internalMonitor.getInitialClientOffset(); } getInitialSourceClientOffset() { return this.internalMonitor.getInitialSourceClientOffset(); } getSourceClientOffset() { return this.internalMonitor.getSourceClientOffset(); } getClientOffset() { return this.internalMonitor.getClientOffset(); } getDifferenceFromInitialOffset() { return this.internalMonitor.getDifferenceFromInitialOffset(); } constructor(manager) { this.targetId = null; this.internalMonitor = manager.getMonitor(); } }; // node_modules/react-dnd/dist/internals/registration.js function registerTarget(type, target, manager) { const registry = manager.getRegistry(); const targetId = registry.addTarget(type, target); return [ targetId, () => registry.removeTarget(targetId) ]; } function registerSource(type, source, manager) { const registry = manager.getRegistry(); const sourceId = registry.addSource(type, source); return [ sourceId, () => registry.removeSource(sourceId) ]; } // node_modules/@react-dnd/shallowequal/dist/index.js function shallowEqual(objA, objB, compare, compareContext) { let compareResult = compare ? compare.call(compareContext, objA, objB) : void 0; if (compareResult !== void 0) { return !!compareResult; } if (objA === objB) { return true; } if (typeof objA !== "object" || !objA || typeof objB !== "object" || !objB) { return false; } const keysA = Object.keys(objA); const keysB = Object.keys(objB); if (keysA.length !== keysB.length) { return false; } const bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB); for (let idx = 0; idx < keysA.length; idx++) { const key = keysA[idx]; if (!bHasOwnProperty(key)) { return false; } const valueA = objA[key]; const valueB = objB[key]; compareResult = compare ? compare.call(compareContext, valueA, valueB, key) : void 0; if (compareResult === false || compareResult === void 0 && valueA !== valueB) { return false; } } return true; } // node_modules/react-dnd/dist/internals/isRef.js function isRef(obj) { return ( // eslint-disable-next-line no-prototype-builtins obj !== null && typeof obj === "object" && Object.prototype.hasOwnProperty.call(obj, "current") ); } // node_modules/react-dnd/dist/internals/wrapConnectorHooks.js var import_react8 = __toESM(require_react(), 1); function throwIfCompositeComponentElement(element) { if (typeof element.type === "string") { return; } const displayName = element.type.displayName || element.type.name || "the component"; throw new Error(`Only native element nodes can now be passed to React DnD connectors.You can either wrap ${displayName} into a
, or turn it into a drag source or a drop target itself.`); } function wrapHookToRecognizeElement(hook) { return (elementOrNode = null, options = null) => { if (!(0, import_react8.isValidElement)(elementOrNode)) { const node = elementOrNode; hook(node, options); return node; } const element = elementOrNode; throwIfCompositeComponentElement(element); const ref = options ? (node) => hook(node, options) : hook; return cloneWithRef(element, ref); }; } function wrapConnectorHooks(hooks) { const wrappedHooks = {}; Object.keys(hooks).forEach((key) => { const hook = hooks[key]; if (key.endsWith("Ref")) { wrappedHooks[key] = hooks[key]; } else { const wrappedHook = wrapHookToRecognizeElement(hook); wrappedHooks[key] = () => wrappedHook; } }); return wrappedHooks; } function setRef(ref, node) { if (typeof ref === "function") { ref(node); } else { ref.current = node; } } function cloneWithRef(element, newRef) { const previousRef = element.ref; invariant(typeof previousRef !== "string", "Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a or
. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"); if (!previousRef) { return (0, import_react8.cloneElement)(element, { ref: newRef }); } else { return (0, import_react8.cloneElement)(element, { ref: (node) => { setRef(previousRef, node); setRef(newRef, node); } }); } } // node_modules/react-dnd/dist/internals/SourceConnector.js var SourceConnector = class { receiveHandlerId(newHandlerId) { if (this.handlerId === newHandlerId) { return; } this.handlerId = newHandlerId; this.reconnect(); } get connectTarget() { return this.dragSource; } get dragSourceOptions() { return this.dragSourceOptionsInternal; } set dragSourceOptions(options) { this.dragSourceOptionsInternal = options; } get dragPreviewOptions() { return this.dragPreviewOptionsInternal; } set dragPreviewOptions(options) { this.dragPreviewOptionsInternal = options; } reconnect() { const didChange = this.reconnectDragSource(); this.reconnectDragPreview(didChange); } reconnectDragSource() { const dragSource = this.dragSource; const didChange = this.didHandlerIdChange() || this.didConnectedDragSourceChange() || this.didDragSourceOptionsChange(); if (didChange) { this.disconnectDragSource(); } if (!this.handlerId) { return didChange; } if (!dragSource) { this.lastConnectedDragSource = dragSource; return didChange; } if (didChange) { this.lastConnectedHandlerId = this.handlerId; this.lastConnectedDragSource = dragSource; this.lastConnectedDragSourceOptions = this.dragSourceOptions; this.dragSourceUnsubscribe = this.backend.connectDragSource(this.handlerId, dragSource, this.dragSourceOptions); } return didChange; } reconnectDragPreview(forceDidChange = false) { const dragPreview = this.dragPreview; const didChange = forceDidChange || this.didHandlerIdChange() || this.didConnectedDragPreviewChange() || this.didDragPreviewOptionsChange(); if (didChange) { this.disconnectDragPreview(); } if (!this.handlerId) { return; } if (!dragPreview) { this.lastConnectedDragPreview = dragPreview; return; } if (didChange) { this.lastConnectedHandlerId = this.handlerId; this.lastConnectedDragPreview = dragPreview; this.lastConnectedDragPreviewOptions = this.dragPreviewOptions; this.dragPreviewUnsubscribe = this.backend.connectDragPreview(this.handlerId, dragPreview, this.dragPreviewOptions); } } didHandlerIdChange() { return this.lastConnectedHandlerId !== this.handlerId; } didConnectedDragSourceChange() { return this.lastConnectedDragSource !== this.dragSource; } didConnectedDragPreviewChange() { return this.lastConnectedDragPreview !== this.dragPreview; } didDragSourceOptionsChange() { return !shallowEqual(this.lastConnectedDragSourceOptions, this.dragSourceOptions); } didDragPreviewOptionsChange() { return !shallowEqual(this.lastConnectedDragPreviewOptions, this.dragPreviewOptions); } disconnectDragSource() { if (this.dragSourceUnsubscribe) { this.dragSourceUnsubscribe(); this.dragSourceUnsubscribe = void 0; } } disconnectDragPreview() { if (this.dragPreviewUnsubscribe) { this.dragPreviewUnsubscribe(); this.dragPreviewUnsubscribe = void 0; this.dragPreviewNode = null; this.dragPreviewRef = null; } } get dragSource() { return this.dragSourceNode || this.dragSourceRef && this.dragSourceRef.current; } get dragPreview() { return this.dragPreviewNode || this.dragPreviewRef && this.dragPreviewRef.current; } clearDragSource() { this.dragSourceNode = null; this.dragSourceRef = null; } clearDragPreview() { this.dragPreviewNode = null; this.dragPreviewRef = null; } constructor(backend) { this.hooks = wrapConnectorHooks({ dragSource: (node, options) => { this.clearDragSource(); this.dragSourceOptions = options || null; if (isRef(node)) { this.dragSourceRef = node; } else { this.dragSourceNode = node; } this.reconnectDragSource(); }, dragPreview: (node, options) => { this.clearDragPreview(); this.dragPreviewOptions = options || null; if (isRef(node)) { this.dragPreviewRef = node; } else { this.dragPreviewNode = node; } this.reconnectDragPreview(); } }); this.handlerId = null; this.dragSourceRef = null; this.dragSourceOptionsInternal = null; this.dragPreviewRef = null; this.dragPreviewOptionsInternal = null; this.lastConnectedHandlerId = null; this.lastConnectedDragSource = null; this.lastConnectedDragSourceOptions = null; this.lastConnectedDragPreview = null; this.lastConnectedDragPreviewOptions = null; this.backend = backend; } }; // node_modules/react-dnd/dist/internals/TargetConnector.js var TargetConnector = class { get connectTarget() { return this.dropTarget; } reconnect() { const didChange = this.didHandlerIdChange() || this.didDropTargetChange() || this.didOptionsChange(); if (didChange) { this.disconnectDropTarget(); } const dropTarget = this.dropTarget; if (!this.handlerId) { return; } if (!dropTarget) { this.lastConnectedDropTarget = dropTarget; return; } if (didChange) { this.lastConnectedHandlerId = this.handlerId; this.lastConnectedDropTarget = dropTarget; this.lastConnectedDropTargetOptions = this.dropTargetOptions; this.unsubscribeDropTarget = this.backend.connectDropTarget(this.handlerId, dropTarget, this.dropTargetOptions); } } receiveHandlerId(newHandlerId) { if (newHandlerId === this.handlerId) { return; } this.handlerId = newHandlerId; this.reconnect(); } get dropTargetOptions() { return this.dropTargetOptionsInternal; } set dropTargetOptions(options) { this.dropTargetOptionsInternal = options; } didHandlerIdChange() { return this.lastConnectedHandlerId !== this.handlerId; } didDropTargetChange() { return this.lastConnectedDropTarget !== this.dropTarget; } didOptionsChange() { return !shallowEqual(this.lastConnectedDropTargetOptions, this.dropTargetOptions); } disconnectDropTarget() { if (this.unsubscribeDropTarget) { this.unsubscribeDropTarget(); this.unsubscribeDropTarget = void 0; } } get dropTarget() { return this.dropTargetNode || this.dropTargetRef && this.dropTargetRef.current; } clearDropTarget() { this.dropTargetRef = null; this.dropTargetNode = null; } constructor(backend) { this.hooks = wrapConnectorHooks({ dropTarget: (node, options) => { this.clearDropTarget(); this.dropTargetOptions = options; if (isRef(node)) { this.dropTargetRef = node; } else { this.dropTargetNode = node; } this.reconnect(); } }); this.handlerId = null; this.dropTargetRef = null; this.dropTargetOptionsInternal = null; this.lastConnectedHandlerId = null; this.lastConnectedDropTarget = null; this.lastConnectedDropTargetOptions = null; this.backend = backend; } }; // node_modules/react-dnd/dist/hooks/useDragDropManager.js var import_react9 = __toESM(require_react(), 1); function useDragDropManager() { const { dragDropManager } = (0, import_react9.useContext)(DndContext); invariant(dragDropManager != null, "Expected drag drop context"); return dragDropManager; } // node_modules/react-dnd/dist/hooks/useDrag/useDragSourceConnector.js function useDragSourceConnector(dragSourceOptions, dragPreviewOptions) { const manager = useDragDropManager(); const connector = (0, import_react10.useMemo)( () => new SourceConnector(manager.getBackend()), [ manager ] ); useIsomorphicLayoutEffect(() => { connector.dragSourceOptions = dragSourceOptions || null; connector.reconnect(); return () => connector.disconnectDragSource(); }, [ connector, dragSourceOptions ]); useIsomorphicLayoutEffect(() => { connector.dragPreviewOptions = dragPreviewOptions || null; connector.reconnect(); return () => connector.disconnectDragPreview(); }, [ connector, dragPreviewOptions ]); return connector; } // node_modules/react-dnd/dist/hooks/useDrag/useDragSourceMonitor.js var import_react11 = __toESM(require_react(), 1); function useDragSourceMonitor() { const manager = useDragDropManager(); return (0, import_react11.useMemo)( () => new DragSourceMonitorImpl(manager), [ manager ] ); } // node_modules/react-dnd/dist/hooks/useDrag/useDragSource.js var import_react12 = __toESM(require_react(), 1); // node_modules/react-dnd/dist/hooks/useDrag/DragSourceImpl.js var DragSourceImpl = class { beginDrag() { const spec = this.spec; const monitor = this.monitor; let result = null; if (typeof spec.item === "object") { result = spec.item; } else if (typeof spec.item === "function") { result = spec.item(monitor); } else { result = {}; } return result !== null && result !== void 0 ? result : null; } canDrag() { const spec = this.spec; const monitor = this.monitor; if (typeof spec.canDrag === "boolean") { return spec.canDrag; } else if (typeof spec.canDrag === "function") { return spec.canDrag(monitor); } else { return true; } } isDragging(globalMonitor, target) { const spec = this.spec; const monitor = this.monitor; const { isDragging } = spec; return isDragging ? isDragging(monitor) : target === globalMonitor.getSourceId(); } endDrag() { const spec = this.spec; const monitor = this.monitor; const connector = this.connector; const { end } = spec; if (end) { end(monitor.getItem(), monitor); } connector.reconnect(); } constructor(spec, monitor, connector) { this.spec = spec; this.monitor = monitor; this.connector = connector; } }; // node_modules/react-dnd/dist/hooks/useDrag/useDragSource.js function useDragSource(spec, monitor, connector) { const handler = (0, import_react12.useMemo)( () => new DragSourceImpl(spec, monitor, connector), [ monitor, connector ] ); (0, import_react12.useEffect)(() => { handler.spec = spec; }, [ spec ]); return handler; } // node_modules/react-dnd/dist/hooks/useDrag/useDragType.js var import_react13 = __toESM(require_react(), 1); function useDragType(spec) { return (0, import_react13.useMemo)(() => { const result = spec.type; invariant(result != null, "spec.type must be defined"); return result; }, [ spec ]); } // node_modules/react-dnd/dist/hooks/useDrag/useRegisteredDragSource.js function useRegisteredDragSource(spec, monitor, connector) { const manager = useDragDropManager(); const handler = useDragSource(spec, monitor, connector); const itemType = useDragType(spec); useIsomorphicLayoutEffect(function registerDragSource() { if (itemType != null) { const [handlerId, unregister] = registerSource(itemType, handler, manager); monitor.receiveHandlerId(handlerId); connector.receiveHandlerId(handlerId); return unregister; } return; }, [ manager, monitor, connector, handler, itemType ]); } // node_modules/react-dnd/dist/hooks/useDrag/useDrag.js function useDrag(specArg, deps) { const spec = useOptionalFactory(specArg, deps); invariant(!spec.begin, `useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)`); const monitor = useDragSourceMonitor(); const connector = useDragSourceConnector(spec.options, spec.previewOptions); useRegisteredDragSource(spec, monitor, connector); return [ useCollectedProps(spec.collect, monitor, connector), useConnectDragSource(connector), useConnectDragPreview(connector) ]; } // node_modules/react-dnd/dist/hooks/useDragLayer.js var import_react14 = __toESM(require_react(), 1); function useDragLayer(collect) { const dragDropManager = useDragDropManager(); const monitor = dragDropManager.getMonitor(); const [collected, updateCollected] = useCollector(monitor, collect); (0, import_react14.useEffect)( () => monitor.subscribeToOffsetChange(updateCollected) ); (0, import_react14.useEffect)( () => monitor.subscribeToStateChange(updateCollected) ); return collected; } // node_modules/react-dnd/dist/hooks/useDrop/connectors.js var import_react15 = __toESM(require_react(), 1); function useConnectDropTarget(connector) { return (0, import_react15.useMemo)( () => connector.hooks.dropTarget(), [ connector ] ); } // node_modules/react-dnd/dist/hooks/useDrop/useDropTargetConnector.js var import_react16 = __toESM(require_react(), 1); function useDropTargetConnector(options) { const manager = useDragDropManager(); const connector = (0, import_react16.useMemo)( () => new TargetConnector(manager.getBackend()), [ manager ] ); useIsomorphicLayoutEffect(() => { connector.dropTargetOptions = options || null; connector.reconnect(); return () => connector.disconnectDropTarget(); }, [ options ]); return connector; } // node_modules/react-dnd/dist/hooks/useDrop/useDropTargetMonitor.js var import_react17 = __toESM(require_react(), 1); function useDropTargetMonitor() { const manager = useDragDropManager(); return (0, import_react17.useMemo)( () => new DropTargetMonitorImpl(manager), [ manager ] ); } // node_modules/react-dnd/dist/hooks/useDrop/useAccept.js var import_react18 = __toESM(require_react(), 1); function useAccept(spec) { const { accept } = spec; return (0, import_react18.useMemo)(() => { invariant(spec.accept != null, "accept must be defined"); return Array.isArray(accept) ? accept : [ accept ]; }, [ accept ]); } // node_modules/react-dnd/dist/hooks/useDrop/useDropTarget.js var import_react19 = __toESM(require_react(), 1); // node_modules/react-dnd/dist/hooks/useDrop/DropTargetImpl.js var DropTargetImpl = class { canDrop() { const spec = this.spec; const monitor = this.monitor; return spec.canDrop ? spec.canDrop(monitor.getItem(), monitor) : true; } hover() { const spec = this.spec; const monitor = this.monitor; if (spec.hover) { spec.hover(monitor.getItem(), monitor); } } drop() { const spec = this.spec; const monitor = this.monitor; if (spec.drop) { return spec.drop(monitor.getItem(), monitor); } return; } constructor(spec, monitor) { this.spec = spec; this.monitor = monitor; } }; // node_modules/react-dnd/dist/hooks/useDrop/useDropTarget.js function useDropTarget(spec, monitor) { const dropTarget = (0, import_react19.useMemo)( () => new DropTargetImpl(spec, monitor), [ monitor ] ); (0, import_react19.useEffect)(() => { dropTarget.spec = spec; }, [ spec ]); return dropTarget; } // node_modules/react-dnd/dist/hooks/useDrop/useRegisteredDropTarget.js function useRegisteredDropTarget(spec, monitor, connector) { const manager = useDragDropManager(); const dropTarget = useDropTarget(spec, monitor); const accept = useAccept(spec); useIsomorphicLayoutEffect(function registerDropTarget() { const [handlerId, unregister] = registerTarget(accept, dropTarget, manager); monitor.receiveHandlerId(handlerId); connector.receiveHandlerId(handlerId); return unregister; }, [ manager, monitor, dropTarget, connector, accept.map( (a) => a.toString() ).join("|") ]); } // node_modules/react-dnd/dist/hooks/useDrop/useDrop.js function useDrop(specArg, deps) { const spec = useOptionalFactory(specArg, deps); const monitor = useDropTargetMonitor(); const connector = useDropTargetConnector(spec.options); useRegisteredDropTarget(spec, monitor, connector); return [ useCollectedProps(spec.collect, monitor, connector), useConnectDropTarget(connector) ]; } export { DndProvider, useDrag, useDragLayer, useDrop }; //# sourceMappingURL=chunk-S3HPKOXW.js.map