// (C) 2026 GoodData Corporation
export const parametersInitialState = {
    parameters: [],
};
/**
 * Picks a tab's persisted parameter source under the V1 → per-tab migration rule.
 *
 * - If the tab has its own `parameters` (including `[]`) → return it.
 * - Else if every tab's `parameters === undefined` AND root `parameters` is defined → root array.
 * - Else → `undefined`.
 *
 * @internal
 */
export function pickTabParametersSource(tab, allTabs, rootParameters) {
    if (tab.parameters !== undefined) {
        return tab.parameters;
    }
    const everyTabUndefined = allTabs.length > 0 && allTabs.every((other) => other.parameters === undefined);
    return everyTabUndefined ? rootParameters : undefined;
}
