/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE  AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE:  you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import * as tslib_1 from "tslib";
import { BuiltInFunctionBase } from "./BuiltInFunctionBase";
import { ExcelCalcValue } from "./ExcelCalcValue";
import { StringBuilder } from "igniteui-angular-core";
import { markType } from "igniteui-angular-core";
import { stringIsNullOrEmpty } from "igniteui-angular-core";
/**
 * @hidden
 */
var UltraCalcFunctionClean = /** @class */ (function (_super) {
    tslib_1.__extends(UltraCalcFunctionClean, _super);
    function UltraCalcFunctionClean() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    UltraCalcFunctionClean.prototype.evaluate = function (a, b) {
        var c = a.pop();
        if (c.isError) {
            return c;
        }
        var d = c.toString();
        if (!stringIsNullOrEmpty(d)) {
            var e = null;
            var f = false;
            for (var g = 0; g < d.length; g++) {
                var h = d.charAt(g);
                if (h.charCodeAt(0) <= 31) {
                    f = true;
                }
                else {
                    switch (h.charCodeAt(0)) {
                        case 129:
                        case 141:
                        case 143:
                        case 144:
                        case 157:
                            f = true;
                            break;
                        default:
                            f = false;
                            break;
                    }
                }
                if (f) {
                    if (e == null) {
                        e = new StringBuilder(1, d.length - 1);
                        if (g > 0) {
                            e.m(d, 0, g);
                        }
                    }
                }
                else if (e != null) {
                    e.h(h);
                }
            }
            if (e != null) {
                d = e.toString();
            }
        }
        return new ExcelCalcValue(d);
    };
    UltraCalcFunctionClean.prototype.get_maxArgs = function () {
        return 1;
    };
    Object.defineProperty(UltraCalcFunctionClean.prototype, "maxArgs", {
        get: function () {
            return this.get_maxArgs();
        },
        enumerable: true,
        configurable: true
    });
    UltraCalcFunctionClean.prototype.get_minArgs = function () {
        return 1;
    };
    Object.defineProperty(UltraCalcFunctionClean.prototype, "minArgs", {
        get: function () {
            return this.get_minArgs();
        },
        enumerable: true,
        configurable: true
    });
    UltraCalcFunctionClean.prototype.get_name = function () {
        return "clean";
    };
    Object.defineProperty(UltraCalcFunctionClean.prototype, "name", {
        get: function () {
            return this.get_name();
        },
        enumerable: true,
        configurable: true
    });
    UltraCalcFunctionClean.$t = markType(UltraCalcFunctionClean, 'UltraCalcFunctionClean', BuiltInFunctionBase.$);
    return UltraCalcFunctionClean;
}(BuiltInFunctionBase));
export { UltraCalcFunctionClean };
//# sourceMappingURL=UltraCalcFunctionClean.js.map