import { useVariablesContext } from "@qorebase/app-component";
import memoize from "fast-memoize";
const formatRegex = /@\[([^*]+?)]\(([^*]+?)\)/gim;
export const getVariableValue = memoize(function getVariableValue(variable, values) {
    const variableId = variable.replace(formatRegex, function (_, display, id) {
        return id;
    });
    const result = values[variableId];
    return typeof result !== "undefined" && result !== null ? result : "";
});
export function useVariable(variable) {
    const { values } = useVariablesContext();
    return getVariableValue(variable, values);
}
//# sourceMappingURL=useVariable.js.map