"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function prop(key, meta) {
    return function (target, propertyKey, descriptor) {
    };
}
var default_1 = (function () {
    function default_1() {
    }
    default_1.process = function () {
        var leftValue = engine.findVariable('left', args, props);
        var rightValue = engine.findVariable('right', args, props);
        var operator = engine.findVariable('operator', args, props);
        var result;
        if (operator === 'exist') {
            result = !!leftValue;
        }
        else {
            switch (props.type) {
                case 'string':
                    leftValue = '"' + leftValue + '"';
                    rightValue = '"' + rightValue + '"';
                    break;
                case 'number':
                    leftValue = typeof leftValue === 'number' ? leftValue : parseFloat(leftValue);
                    rightValue = typeof rightValue === 'number' ? rightValue : parseFloat(rightValue);
                    break;
                case 'boolean':
                    leftValue = typeof leftValue === 'boolean' ? leftValue :
                        (leftValue === 'true' ? true :
                            (leftValue === 'false' ? false : !!leftValue));
                    rightValue = typeof rightValue === 'boolean' ? rightValue :
                        (rightValue === 'true' ? true :
                            (rightValue === 'false' ? false : !!rightValue));
                    break;
            }
            var func = new Function('return ' + leftValue + operator + rightValue);
            result = func();
        }
        next(result ? 'true' : 'false');
    };
    __decorate([
        prop('left', { "alias": "左值", "type": "dynamic", "default": "" })
    ], default_1, "process", null);
    return default_1;
}());
exports.default = default_1;
