import { normalizeDepartmentObject } from './normalize-department-object';
/**
 * 标准化部门选择器的值
 */
export function normalizeDepartmentValue(value, componentProps) {
    const isMultiple = (componentProps === null || componentProps === void 0 ? void 0 : componentProps.multiple) === true;
    if (isMultiple) {
        // 多选：返回数组
        if (!Array.isArray(value)) {
            return [normalizeDepartmentObject(value)];
        }
        return value.map((item) => normalizeDepartmentObject(item));
    }
    else {
        // 单选：返回单个值
        if (Array.isArray(value)) {
            return value.length > 0 ? normalizeDepartmentObject(value[0]) : undefined;
        }
        return normalizeDepartmentObject(value);
    }
}
