import { useCallback } from "react";
export function useAgentAssignedSkillsSync(input) {
    const { setAgent } = input;
    return useCallback((latestSkillIds) => {
        setAgent((prev) => {
            if (!prev)
                return prev;
            const prevIds = Array.isArray(prev.assignedSkillIds)
                ? prev.assignedSkillIds
                : [];
            if (prevIds.length === latestSkillIds.length &&
                prevIds.every((id, index) => id === latestSkillIds[index])) {
                return prev;
            }
            return { ...prev, assignedSkillIds: latestSkillIds };
        });
    }, [setAgent]);
}
//# sourceMappingURL=useAgentAssignedSkillsSync.js.map