import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { ExpressionValue } from "../../ExpressionValue";
import { ExpressionValueRenderer } from "../../ExpressionValueRenderer";
import { BracketedDiv, ExpressionPiece } from "../../ExpressionStyles";
import { StringDataDefinition } from "../../../Common/Data/Definitions/StringDataDefinition";
import { BaseLogicExpression } from "../Logic/BaseLogic";
export class StringIsValidEmailExpression extends BaseLogicExpression {
    constructor() {
        super();
        this.__type = "String Is Valid Email";
        this.value1 = ExpressionValue.createExpressionValue(this, "stringValue", new StringDataDefinition());
    }
    render() {
        return (_jsx(_Fragment, { children: _jsxs(ExpressionPiece, { children: ["text.isEmail", _jsx(BracketedDiv, { children: _jsx(ExpressionValueRenderer, { el: this.value1 }, void 0) }, void 0)] }, void 0) }, void 0));
    }
    evaluate(data, testContext) {
        const re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
        return re.test(this.value1.evaluate(data, testContext));
    }
}
//# sourceMappingURL=StringIsValidEmailExpression.js.map