/*
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 { __extends, __values } from "tslib";
import { DependencyObject } from "igniteui-react-core";
import { INotifyPropertyChanged_$type, PropertyChangedEventArgs, delegateCombine, typeCast, fromEnum, markType, markDep } from "igniteui-react-core";
import { List$1 } from "igniteui-react-core";
import { Series } from "./Series";
import { DependencyProperty } from "igniteui-react-core";
import { PropertyUpdatedEventArgs } from "igniteui-react-core";
import { ISupportsSizeScale_$type } from "./ISupportsSizeScale";
import { PropertyMetadata } from "igniteui-react-core";
import { isNaN_, isInfinity } from "igniteui-react-core";
/**
 * @hidden
 */
var SizeScale = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(SizeScale, _super);
    function SizeScale() {
        var _this = _super.call(this) || this;
        _this._globalMinimum = 0;
        _this._globalMaximum = 0;
        _this.l = null;
        _this.propertyChanged = null;
        _this.propertyUpdated = null;
        _this.globalMinimum = NaN;
        _this.globalMaximum = NaN;
        _this.l = new List$1(Series.$, 0);
        _this.propertyUpdated = delegateCombine(_this.propertyUpdated, function (a, b) { return _this.y(a, b.propertyName, b.oldValue, b.newValue); });
        return _this;
    }
    Object.defineProperty(SizeScale.prototype, "globalMinimum", {
        get: function () {
            return this._globalMinimum;
        },
        set: function (a) {
            this._globalMinimum = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(SizeScale.prototype, "globalMaximum", {
        get: function () {
            return this._globalMaximum;
        },
        set: function (a) {
            this._globalMaximum = a;
        },
        enumerable: false,
        configurable: true
    });
    SizeScale.prototype.getCurrentGlobalMinimum = function () {
        return this.globalMinimum;
    };
    SizeScale.prototype.getCurrentGlobalMaximum = function () {
        return this.globalMaximum;
    };
    SizeScale.prototype.x = function () {
        var e_1, _a;
        if (isNaN_(this.globalMinimum) || isNaN_(this.globalMaximum)) {
            try {
                for (var _b = __values(fromEnum(this.l)), _c = _b.next(); !_c.done; _c = _b.next()) {
                    var a = _c.value;
                    if (typeCast(ISupportsSizeScale_$type, a) !== null) {
                        a.updateSizeScaleGlobals();
                    }
                }
            }
            catch (e_1_1) {
                e_1 = { error: e_1_1 };
            }
            finally {
                try {
                    if (_c && !_c.done && (_a = _b.return))
                        _a.call(_b);
                }
                finally {
                    if (e_1)
                        throw e_1.error;
                }
            }
        }
    };
    SizeScale.prototype.ab = function (a, b) {
        if (!isNaN_(a) && !isInfinity(a)) {
            if (isNaN_(this.globalMinimum)) {
                this.globalMinimum = a;
            }
            else {
                this.globalMinimum = Math.min(a, this.globalMinimum);
            }
        }
        if (!isNaN_(b) && !isInfinity(b)) {
            if (isNaN_(this.globalMaximum)) {
                this.globalMaximum = b;
            }
            else {
                this.globalMaximum = Math.max(b, this.globalMaximum);
            }
        }
    };
    SizeScale.prototype.aa = function () {
        this.globalMinimum = NaN;
        this.globalMaximum = NaN;
    };
    SizeScale.prototype.z = function (a, b, c) {
        if (this.propertyChanged != null) {
            this.propertyChanged(this, new PropertyChangedEventArgs(a));
        }
        if (this.propertyUpdated != null) {
            this.propertyUpdated(this, new PropertyUpdatedEventArgs(a, b, c));
        }
    };
    SizeScale.prototype.y = function (a, b, c, d) {
        var e_2, _a;
        try {
            for (var _b = __values(fromEnum(this.l)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var e = _c.value;
                e.pr(false);
                if (e.cv != null) {
                    e.om();
                    e.ol();
                }
            }
        }
        catch (e_2_1) {
            e_2 = { error: e_2_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_2)
                    throw e_2.error;
            }
        }
    };
    SizeScale.$t = markType(SizeScale, 'SizeScale', DependencyObject.$, [INotifyPropertyChanged_$type]);
    SizeScale.$$p = markDep(DependencyProperty, PropertyMetadata, SizeScale, 'z', ['IsLogarithmic', [0, false], 'LogarithmBase', [1, 10], 'MaximumValue', [1, NaN], 'MinimumValue', [1, NaN]]);
    return SizeScale;
}(DependencyObject));
export { SizeScale };
