import { jsx as _jsx } from "react/jsx-runtime";
import { useContext, useMemo, useState } from 'react';
import { InfiniteTreeListContext } from '../../../InfiniteTreeListContext';
import { TreeListItemContext, } from '../TreeListItemContext';
export const TreeListItemContextProvider = ({ item, children, onToggle, }) => {
    const [disabledReason, setDisabledReason] = useState();
    const { disabledIdList } = useContext(InfiniteTreeListContext);
    const isDisabled = useMemo(() => {
        return item.meta.path.some((id) => disabledIdList.has(id));
    }, [item.path, disabledIdList]);
    return (_jsx(TreeListItemContext.Provider, { value: {
            item,
            onToggle,
            isDisabled,
            disabledReason,
            setDisabledReason,
        }, children: children }));
};
