import { isCondition } from '../../types/utils';
import { isConditionTrue } from './condition';
// eslint-disable-next-line import/no-cycle
import { useVariable } from './use-variable';
/* eslint-disable react-hooks/rules-of-hooks */
export function useConditionOrVariable(arg, opts = {}) {
    // Note we assume arg never changes from a condition to a variable so we can use hooks conditionally
    if (isCondition(arg)) {
        const value = useVariable(arg.variable, opts)[0];
        const other = useVariable(arg.other, opts)[0];
        return isConditionTrue(arg.operator, value, other);
    }
    return useVariable(arg, opts)[0];
}
//# sourceMappingURL=condition-or-variable.js.map