import { observer } from 'mobx-react-lite';
import { CardComponent } from '../Kanban/Card';
import { ItemActionsState } from '../../state';
import React from 'react';
function _KanbanDragOverlayCardItem(props) {
    const { state, renderItem, actionCell, dataExtension, tags } = props;
    const { activeId } = state.dragAndDropState;
    if (!activeId) {
        return null;
    }
    // Parse the activeId to get stageKey and itemKey
    const [stageKey, itemKey] = activeId.split('-##-');
    if (!stageKey || !itemKey) {
        return null;
    }
    const stageState = state.kanbanStageStates[stageKey];
    if (!stageState) {
        return null;
    }
    const keyedItem = stageState.itemsCollectionState.getKeyedItem(itemKey);
    if (!keyedItem) {
        return null;
    }
    const itemActionsState = new ItemActionsState({
        fade: 'static',
        keyedItem,
        collection: stageState.itemsCollectionState,
        reportBi: state.toolbar.reportBi,
    });
    const cardProps = {
        keyedItem,
        stageKey: stageState.stageKey,
        originalItem: keyedItem.item,
        itemIndex: 0,
        itemActionsState,
        item: {
            ...renderItem?.({
                stage: stageState.stage,
                item: keyedItem.item,
            }),
            key: keyedItem.key,
        },
        actionCell,
        dataExtension,
        tags,
        isDragging: true,
        state,
    };
    return React.createElement(CardComponent, { ...cardProps });
}
export const KanbanDragOverlayCardItem = observer(_KanbanDragOverlayCardItem);
//# sourceMappingURL=KanbanDragOverlayCardItem.js.map