const AI_CONDITION_EXPRESSION_REGEX = /^ai\("(.+)"\)$/;
const AGGREGATE_CONDITION_EXPRESSION_REGEX = /^(all|any)\((.+)\)$/;
export function parseAiConditionExpression(value) {
    const match = value.match(AI_CONDITION_EXPRESSION_REGEX);
    if (!match?.[1]) {
        return undefined;
    }
    return { text: match[1] };
}
export function isAiConditionExpression(value) {
    return parseAiConditionExpression(value) !== undefined;
}
export function parseAggregateConditionExpression(value) {
    const match = value.match(AGGREGATE_CONDITION_EXPRESSION_REGEX);
    if (!match?.[1] || !match[2]) {
        return undefined;
    }
    return {
        type: match[1],
        argsText: match[2],
    };
}
export function isAggregateConditionExpression(value) {
    return parseAggregateConditionExpression(value) !== undefined;
}
//# sourceMappingURL=workflow-condition-expression.js.map