/*
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, __generator, __values } from "tslib";
import { EventArgs, Base, markType, typeCast, Point_$type, String_$type, runOn, Number_$type, enumGetBox, fromEnum, toEnum, Date_$type, markDep, Delegate_$type } from "igniteui-angular-core";
import { IBucketizer_$type } from "./IBucketizer";
import { ArgumentNullException } from "igniteui-angular-core";
import { IFastItemColumn$1_$type } from "igniteui-angular-core";
import { Series } from "./Series";
import { Rect } from "igniteui-angular-core";
import { ScalerParams } from "./ScalerParams";
import { ISortingAxis_$type } from "./ISortingAxis";
import { SeriesView } from "./SeriesView";
import { truncate, intDivide, isInfinity, isNaN_ } from "igniteui-angular-core";
import { IHasCategoryAxis_$type } from "./IHasCategoryAxis";
import { IHasCategoryModePreference_$type } from "./IHasCategoryModePreference";
import { Brush } from "igniteui-angular-core";
import { DependencyProperty } from "igniteui-angular-core";
import { CategoryAxisBase } from "./CategoryAxisBase";
import { NumericYAxis } from "./NumericYAxis";
import { HighlightingInfo } from "./HighlightingInfo";
import { CategoryTransitionInMode_$type } from "./CategoryTransitionInMode";
import { CategoryTransitionSourceFramePreparer } from "./CategoryTransitionSourceFramePreparer";
import { CategoryFrame } from "./CategoryFrame";
import { CategoryMode_$type } from "./CategoryMode";
import { ITimeRangeSelectorAxis_$type } from "./ITimeRangeSelectorAxis";
import { FastReflectionHelper } from "igniteui-angular-core";
import { List$1 } from "igniteui-angular-core";
import { Dictionary$2 } from "igniteui-angular-core";
import { CategorySeriesRenderManager } from "./CategorySeriesRenderManager";
import { IFastItemsSource_$type } from "igniteui-angular-core";
import { FinancialValueList } from "./FinancialValueList";
import { CategoryXAxis } from "./CategoryXAxis";
import { SafeSortedReadOnlyDoubleCollection } from "./SafeSortedReadOnlyDoubleCollection";
import { SafeReadOnlyDoubleCollection } from "./SafeReadOnlyDoubleCollection";
import { SafeEnumerable } from "./SafeEnumerable";
import { CalculatedColumn } from "./CalculatedColumn";
import { TrendCalculators } from "igniteui-angular-core";
import { ColumnSupportingCalculation } from "./ColumnSupportingCalculation";
import { IDateTimeAxis_$type } from "./IDateTimeAxis";
import { PropertyMetadata } from "igniteui-angular-core";
import { stringIsNullOrEmpty } from "igniteui-angular-core";
import { dateToStringFormat } from "igniteui-angular-core";
import { SupportingCalculation$1 } from "./SupportingCalculation$1";
import { SRProvider } from "igniteui-angular-core";
import { Color } from "igniteui-angular-core";
/**
 * @hidden
 */
var FinancialEventArgs = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(FinancialEventArgs, _super);
    function FinancialEventArgs(a, b, c, d, e) {
        var _this = _super.call(this) || this;
        _this._position = 0;
        _this._count = 0;
        _this._dataSource = null;
        _this._supportingCalculations = null;
        _this._basedOn = null;
        _this.position = a;
        _this.count = b;
        _this.dataSource = c;
        _this.supportingCalculations = d;
        if (c != null) {
            c.series = e;
        }
        return _this;
    }
    Object.defineProperty(FinancialEventArgs.prototype, "position", {
        get: function () {
            return this._position;
        },
        set: function (a) {
            this._position = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(FinancialEventArgs.prototype, "count", {
        get: function () {
            return this._count;
        },
        set: function (a) {
            this._count = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(FinancialEventArgs.prototype, "dataSource", {
        get: function () {
            return this._dataSource;
        },
        set: function (a) {
            this._dataSource = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(FinancialEventArgs.prototype, "supportingCalculations", {
        get: function () {
            return this._supportingCalculations;
        },
        set: function (a) {
            this._supportingCalculations = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(FinancialEventArgs.prototype, "basedOn", {
        get: function () {
            return this._basedOn;
        },
        set: function (a) {
            this._basedOn = a;
        },
        enumerable: false,
        configurable: true
    });
    FinancialEventArgs.$t = markType(FinancialEventArgs, 'FinancialEventArgs', EventArgs.$);
    return FinancialEventArgs;
}(EventArgs));
export { FinancialEventArgs };
/**
 * @hidden
 */
var FinancialBucketCalculator = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(FinancialBucketCalculator, _super);
    function FinancialBucketCalculator(a) {
        var _this = _super.call(this) || this;
        _this.a = null;
        _this.c = 0;
        _this.d = 0;
        _this.b = 0;
        if (a == null) {
            throw new ArgumentNullException(0, "view");
        }
        _this.a = a;
        _this.c = -1;
        _this.d = _this.d;
        _this.b = 0;
        return _this;
    }
    FinancialBucketCalculator.prototype.getBucket = function (a) {
        return null;
    };
    FinancialBucketCalculator.prototype.getBucketWithoutUnknowns = function (a) {
        return this.getBucket(a);
    };
    FinancialBucketCalculator.prototype.getErrorBucket = function (a, b) {
        return NaN;
    };
    FinancialBucketCalculator.prototype.getBucketInfo = function (a, b, c, d) {
        a = this.c;
        b = this.d;
        c = this.b;
        d = this.a.bz.fx;
        return {
            p0: a,
            p1: b,
            p2: c,
            p3: d
        };
    };
    FinancialBucketCalculator.prototype.e = function (a) {
        var b = this.a.bv;
        var c = this.a.bu;
        var d = this.a.bu;
        if (this.a.bz != null) {
            d = this.a.bz.getEffectiveViewport1(this.a);
        }
        if (b.isEmpty || c.isEmpty || this.a.bz.qk == null) {
            this.b = 0;
            return;
        }
        var e = (this.a.bz.qk != null) ? this.a.bz.qk.cg : false;
        var f = new ScalerParams(0, b, c, e, d);
        var g = this.a.bz.pz(this.a);
        var h = typeCast(ISortingAxis_$type, this.a.bz.qk);
        if (h == null || h.i$b == null) {
            var i = Math.floor(this.a.bz.qk.el(g.left, f));
            var j = Math.ceil(this.a.bz.qk.el(g.right, f));
            if (this.a.bz.qk.cg) {
                j = Math.ceil(this.a.bz.qk.el(g.left, f));
                i = Math.floor(this.a.bz.qk.el(g.right, f));
            }
            var k = Math.floor((j - i + 1) * a / g.width);
            this.b = truncate(Math.max(1, k));
            this.c = truncate(Math.floor(i / this.b));
            this.d = truncate(Math.ceil(j / this.b));
        }
        else {
            this.c = h.i$e(b, c, d, g);
            this.d = h.i$g(b, c, d, g);
            this.b = 1;
        }
    };
    FinancialBucketCalculator.prototype.cacheValues = function () {
    };
    FinancialBucketCalculator.prototype.unCacheValues = function () {
    };
    FinancialBucketCalculator.$t = markType(FinancialBucketCalculator, 'FinancialBucketCalculator', Base.$, [IBucketizer_$type]);
    return FinancialBucketCalculator;
}(Base));
export { FinancialBucketCalculator };
/**
 * @hidden
 */
var FinancialSeries = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(FinancialSeries, _super);
    function FinancialSeries() {
        var _this = _super.call(this) || this;
        _this.rb = null;
        _this.q9 = null;
        _this.ra = null;
        _this.q8 = null;
        _this.rc = null;
        _this.rl = false;
        _this.assigningCategoryStyle = null;
        _this.qt = null;
        _this.rv = new Dictionary$2(IFastItemColumn$1_$type.specialize(Number_$type), String_$type, 0);
        _this.rw = new Dictionary$2(String_$type, String_$type, 0);
        _this.rk = false;
        _this.q4 = null;
        _this.qo = null;
        _this.qq = null;
        _this.qm = null;
        _this.qw = null;
        _this.typical = null;
        _this.typicalBasedOn = null;
        _this.rj = false;
        _this.r8 = null;
        _this.r6 = null;
        _this.r7 = null;
        _this.r5 = null;
        _this.r9 = null;
        _this.qp = null;
        _this.ql = null;
        _this.qr = 0;
        _this.q5 = null;
        _this.q7 = null;
        _this.qt = new CategorySeriesRenderManager();
        _this.rl = false;
        _this.qw = new CategoryTransitionSourceFramePreparer();
        _this.qp = new CategoryFrame(3);
        _this.ab = FinancialSeries.$;
        _this.qs = 0;
        return _this;
    }
    FinancialSeries.prototype.l4 = function (a) {
        _super.prototype.l4.call(this, a);
        this.q1 = a;
    };
    FinancialSeries.prototype.get_ds = function () {
        return true;
    };
    FinancialSeries.prototype.ag = function () {
        return [this.qk, this.q6];
    };
    FinancialSeries.prototype.h1 = function (a, b) {
        var c = this.jv(b);
        if (c == FinancialSeries.$$p[6]) {
            return this.h2(a, b, this.s0);
        }
        if (c == FinancialSeries.$$p[1]) {
            return this.h2(a, b, this.sr);
        }
        if (c == FinancialSeries.$$p[4]) {
            return this.h2(a, b, this.sw);
        }
        if (c == FinancialSeries.$$p[0]) {
            return this.h2(a, b, this.so);
        }
        if (c == FinancialSeries.$$p[8]) {
            return this.h2(a, b, this.s4);
        }
        return _super.prototype.h1.call(this, a, b);
    };
    FinancialSeries.prototype.sk = function () {
        return 2;
    };
    FinancialSeries.prototype.si = function () {
        return 4;
    };
    FinancialSeries.prototype.ah = function (a) {
        var b = this.aj(this.qk, this.qm.f, this.sh(this.b1), this.sj(this.b1), this.px(a), true);
        if (b == null) {
            return null;
        }
        var c = b[0];
        var d = b[1];
        var e = new Array(1);
        var f = new Array(2);
        var g = this.sk();
        f[0] = { $type: Point_$type, x: c[0], y: c[g] };
        f[1] = { $type: Point_$type, x: d[0], y: d[g] };
        e[0] = f;
        return e;
    };
    FinancialSeries.prototype.ai = function (a) {
        var b = this.aj(this.qk, this.qm.f, this.sh(this.b1), this.sj(this.b1), this.px(a), true);
        if (b == null) {
            return null;
        }
        var c = b[0];
        var d = b[1];
        var e = new Array(1);
        var f = new Array(2);
        f[0] = { $type: Point_$type, x: c[0], y: c[1] };
        f[1] = { $type: Point_$type, x: d[0], y: d[1] };
        e[0] = f;
        return e;
    };
    FinancialSeries.prototype.pf = function () {
        return this.tq;
    };
    FinancialSeries.prototype.pg = function () {
        return this.tq;
    };
    FinancialSeries.prototype.kz = function () {
        _super.prototype.kz.call(this);
        this.qk = null;
        this.q6 = null;
    };
    FinancialSeries.prototype.get_c7 = function () {
        return true;
    };
    FinancialSeries.prototype.get_em = function () {
        return this.q6 != null && this.q6.cg;
    };
    Object.defineProperty(FinancialSeries.prototype, "rg", {
        get: function () {
            return this.rb;
        },
        set: function (a) {
            if (this.rb != a) {
                var b = this.rb;
                this.rb = a;
                this.raisePropertyChanged("OpenColumn", b, this.rb);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(FinancialSeries.prototype, "re", {
        get: function () {
            return this.q9;
        },
        set: function (a) {
            if (this.q9 != a) {
                var b = this.q9;
                this.q9 = a;
                this.raisePropertyChanged("HighColumn", b, this.q9);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(FinancialSeries.prototype, "rf", {
        get: function () {
            return this.ra;
        },
        set: function (a) {
            if (this.ra != a) {
                var b = this.ra;
                this.ra = a;
                this.raisePropertyChanged("LowColumn", b, this.ra);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(FinancialSeries.prototype, "rd", {
        get: function () {
            return this.q8;
        },
        set: function (a) {
            if (this.q8 != a) {
                var b = this.q8;
                this.q8 = a;
                this.raisePropertyChanged("CloseColumn", b, this.q8);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(FinancialSeries.prototype, "ri", {
        get: function () {
            return this.rc;
        },
        set: function (a) {
            if (this.rc != a) {
                var b = this.rc;
                this.rc = a;
                this.raisePropertyChanged("VolumeColumn", b, this.rc);
            }
        },
        enumerable: false,
        configurable: true
    });
    FinancialSeries.prototype.rs = function () {
        return (this.assigningCategoryStyle != null && this.rl) || this.bl != 1;
    };
    FinancialSeries.prototype.tc = function (a) {
        if (this.assigningCategoryStyle != null && this.rl) {
            this.assigningCategoryStyle(this, a);
        }
    };
    FinancialSeries.prototype.ta = function (a, b, c, d, e, f) {
        var g = this.bl != 1;
        this.qt.a3(this.qt.b, d.cm, a, b, c, d, e, f, false);
        this.qt.ab(this.fv);
        var h = this.qt.ay;
        var i = null;
        var j = this.cl;
        if (g && this.ce != null) {
            i = this.ce.a7.getHighlightingInfo(this, j, h.o, h.n, false);
            h.b = i;
        }
        h.f = f;
        this.tc(h);
        this.qt.z(this, i, f, g, b < 0);
    };
    FinancialSeries.prototype.sa = function (a) {
        return this.gb(a, this.qk);
    };
    FinancialSeries.prototype.ho = function (a, b) {
        return this.hp(a, b, this.qk, runOn(this, this.sa), new FinancialValueList(this.rg, this.re, this.rf, this.rd, this.ri));
    };
    FinancialSeries.prototype.hm = function (a, b) {
        return this.hn(a, b, this.qk, runOn(this, this.sa), new FinancialValueList(this.rg, this.re, this.rf, this.rd, this.ri));
    };
    FinancialSeries.prototype.f7 = function (a, b, c, d, e) {
        if (c == null) {
            return Number.POSITIVE_INFINITY;
        }
        var f = this.qk.le;
        return this.f8(a, b, this.qk, d, e, f, runOn(this, this.sa));
    };
    FinancialSeries.prototype.getOffsetValue = function () {
        return this.sb(this.b1.bv, this.b1.bu, this.getEffectiveViewport1(this.b1));
    };
    FinancialSeries.prototype.getCategoryWidth = function () {
        return this.qk.getCategorySize(this.b1.bv, this.b1.bu, this.getEffectiveViewport1(this.b1));
    };
    FinancialSeries.prototype.ps = function (a, b, c) {
        return this.pu(a, b, c, this.sb(this.b1.bv, this.b1.bu, this.getEffectiveViewport1(this.b1)), this.q6, this.qk, null, null, null);
    };
    FinancialSeries.prototype.gn = function (a, b, c) {
        var d = this.getEffectiveViewport1(this.b1);
        var e = this.sb(this.b1.bv, this.b1.bu, d);
        var f = new ScalerParams(0, this.b1.bv, this.b1.bu, this.qk.cg, d);
        return this.gp(new FinancialValueList(this.rg, this.re, this.rf, this.rd, this.ri), a, this.qk, f, e, runOn(this, this.sa), b, c);
    };
    FinancialSeries.prototype.gj = function (a, b, c) {
        var d = this.getEffectiveViewport1(this.b1);
        var e = this.sb(this.b1.bv, this.b1.bu, d);
        var f = new ScalerParams(0, this.b1.bv, this.b1.bu, this.qk.cg, d);
        return this.gp(this.re, a, this.qk, f, e, runOn(this, this.sa), b, c);
    };
    FinancialSeries.prototype.gl = function (a, b, c) {
        var d = this.getEffectiveViewport1(this.b1);
        var e = this.sb(this.b1.bv, this.b1.bu, d);
        var f = new ScalerParams(0, this.b1.bv, this.b1.bu, this.qk.cg, d);
        return this.gp(this.rf, a, this.qk, f, e, runOn(this, this.sa), b, c);
    };
    FinancialSeries.prototype.sc = function (a, b, c) {
        var d = this.getEffectiveViewport1(this.b1);
        var e = this.sb(this.b1.bv, this.b1.bu, d);
        var f = new ScalerParams(0, this.b1.bv, this.b1.bu, this.qk.cg, d);
        return this.gp(this.rd, a, this.qk, f, e, runOn(this, this.sa), b, c);
    };
    FinancialSeries.prototype.sd = function (a, b, c) {
        var d = this.getEffectiveViewport1(this.b1);
        var e = this.sb(this.b1.bv, this.b1.bu, d);
        var f = new ScalerParams(0, this.b1.bv, this.b1.bu, this.qk.cg, d);
        return this.gp(this.rg, a, this.qk, f, e, runOn(this, this.sa), b, c);
    };
    FinancialSeries.prototype.se = function (a, b, c) {
        var d = this.getEffectiveViewport1(this.b1);
        var e = this.sb(this.b1.bv, this.b1.bu, d);
        var f = new ScalerParams(0, this.b1.bv, this.b1.bu, this.qk.cg, d);
        return this.gp(this.ri, a, this.qk, f, e, runOn(this, this.sa), b, c);
    };
    FinancialSeries.prototype.po = function (a, b, c) {
        var _this = this;
        return this.pu(a, b, c, this.sb(this.b1.bv, this.b1.bu, this.getEffectiveViewport1(this.b1)), this.q6, this.qk, runOn(this, this.gj), function (d, e) { return _this.hp(d, e, _this.qk, runOn(_this, _this.sa), _this.re); }, function (d, e) { return _this.hn(d, e, _this.qk, runOn(_this, _this.sa), _this.re); });
    };
    FinancialSeries.prototype.pq = function (a, b, c) {
        var _this = this;
        return this.pu(a, b, c, this.sb(this.b1.bv, this.b1.bu, this.getEffectiveViewport1(this.b1)), this.q6, this.qk, runOn(this, this.gl), function (d, e) { return _this.hp(d, e, _this.qk, runOn(_this, _this.sa), _this.rf); }, function (d, e) { return _this.hn(d, e, _this.qk, runOn(_this, _this.sa), _this.rf); });
    };
    FinancialSeries.prototype.ts = function (a, b, c) {
        var _this = this;
        return this.pu(a, b, c, this.sb(this.b1.bv, this.b1.bu, this.getEffectiveViewport1(this.b1)), this.q6, this.qk, runOn(this, this.sd), function (d, e) { return _this.hp(d, e, _this.qk, runOn(_this, _this.sa), _this.rg); }, function (d, e) { return _this.hn(d, e, _this.qk, runOn(_this, _this.sa), _this.rg); });
    };
    FinancialSeries.prototype.tr = function (a, b, c) {
        var _this = this;
        return this.pu(a, b, c, this.sb(this.b1.bv, this.b1.bu, this.getEffectiveViewport1(this.b1)), this.q6, this.qk, runOn(this, this.sc), function (d, e) { return _this.hp(d, e, _this.qk, runOn(_this, _this.sa), _this.rd); }, function (d, e) { return _this.hn(d, e, _this.qk, runOn(_this, _this.sa), _this.rd); });
    };
    FinancialSeries.prototype.tt = function (a, b, c) {
        var _this = this;
        return this.pu(a, b, c, this.sb(this.b1.bv, this.b1.bu, this.getEffectiveViewport1(this.b1)), this.q6, this.qk, runOn(this, this.se), function (d, e) { return _this.hp(d, e, _this.qk, runOn(_this, _this.sa), _this.ri); }, function (d, e) { return _this.hn(d, e, _this.qk, runOn(_this, _this.sa), _this.ri); });
    };
    FinancialSeries.prototype.lk = function () {
        _super.prototype.lk.call(this);
        if (this.qk != null) {
            this.qk.h7(false);
        }
        if (this.q6 != null) {
            this.q6.h7(false);
        }
    };
    FinancialSeries.prototype.nb = function (a, b) {
        this.q1.bx.e(this.fx);
        this.mn(false);
    };
    FinancialSeries.prototype.na = function (a, b) {
        if (this.e4 && this.g5 < 0.05) {
            this.e5 = true;
        }
        this.q1.bx.e(this.fx);
        this.mn(false);
    };
    FinancialSeries.prototype.rh = function (a, b, c) {
        var d = this.ci(b);
        this.rv.addItem(d, b);
        this.rw.addItem(b, c);
        return d;
    };
    FinancialSeries.prototype.s9 = function (a, b) {
        if (b == null) {
            return;
        }
        a.deregisterColumn(b);
        var c = this.rv.item(b);
        this.rw.removeItem(c);
        this.rv.removeItem(b);
    };
    FinancialSeries.prototype.l9 = function (a, b, c, d) {
        _super.prototype.l9.call(this, a, b, c, d);
        switch (b) {
            case "SyncLink":
                if (this.b9 != null && this.ce != null) {
                    this.q1.bx.e(this.fx);
                    this.mn(false);
                }
                break;
            case "SeriesViewer":
                if (c != null && d == null) {
                    if (this.qk != null) {
                        this.qk.bz(this);
                    }
                    if (this.q6 != null) {
                        this.q6.bz(this);
                    }
                }
                if (c == null && d != null) {
                    if (this.qk != null) {
                        this.qk.cs(this);
                    }
                    if (this.q6 != null) {
                        this.q6.cs(this);
                    }
                }
                this.q1.bx.e(this.fx);
                this.mn(false);
                break;
            case "FastItemsSource":
                this.rk = true;
                if (typeCast(IFastItemsSource_$type, c) != null) {
                    this.s9(typeCast(IFastItemsSource_$type, c), this.rg);
                    this.s9(typeCast(IFastItemsSource_$type, c), this.re);
                    this.s9(typeCast(IFastItemsSource_$type, c), this.rf);
                    this.s9(typeCast(IFastItemsSource_$type, c), this.rd);
                    this.s9(typeCast(IFastItemsSource_$type, c), this.ri);
                    this.rg = null;
                    this.re = null;
                    this.rf = null;
                    this.rd = null;
                    this.ri = null;
                }
                if (typeCast(IFastItemsSource_$type, d) != null) {
                    if (stringIsNullOrEmpty(this.s0) == false) {
                        this.rg = this.rh(typeCast(IFastItemsSource_$type, d), this.s0, "OpenColumn");
                    }
                    if (stringIsNullOrEmpty(this.sr) == false) {
                        this.re = this.rh(typeCast(IFastItemsSource_$type, d), this.sr, "HighColumn");
                    }
                    if (stringIsNullOrEmpty(this.sw) == false) {
                        this.rf = this.rh(typeCast(IFastItemsSource_$type, d), this.sw, "LowColumn");
                    }
                    if (stringIsNullOrEmpty(this.so) == false) {
                        this.rd = this.rh(typeCast(IFastItemsSource_$type, d), this.so, "CloseColumn");
                    }
                    if (stringIsNullOrEmpty(this.s4) == false) {
                        this.ri = this.rh(typeCast(IFastItemsSource_$type, d), this.s4, "VolumeColumn");
                    }
                }
                this.rk = false;
                if (this.q6 != null && !this.q6.c0()) {
                    this.q1.bx.e(this.fx);
                    this.mn(false);
                }
                break;
            case FinancialSeries.$$p[6]:
                if (this.cl != null) {
                    this.s9(this.cl, this.rg);
                    this.rg = this.rh(this.cl, this.s0, "OpenColumn");
                }
                break;
            case "OpenColumn":
                if (this.q6 != null && !this.q6.c0() && !this.rk) {
                    this.q1.bx.e(this.fx);
                    this.mn(false);
                }
                break;
            case FinancialSeries.$$p[1]:
                if (this.cl != null) {
                    this.s9(this.cl, this.re);
                    this.re = this.rh(this.cl, this.sr, "HighColumn");
                }
                break;
            case "HighColumn":
                if (this.q6 != null && !this.q6.c0() && !this.rk) {
                    this.q1.bx.e(this.fx);
                    this.mn(false);
                }
                break;
            case FinancialSeries.$$p[4]:
                if (this.cl != null) {
                    this.s9(this.cl, this.rf);
                    this.rf = this.rh(this.cl, this.sw, "LowColumn");
                }
                break;
            case "LowColumn":
                if (this.q6 != null && !this.q6.c0() && !this.rk) {
                    this.q1.bx.e(this.fx);
                    this.mn(false);
                }
                break;
            case FinancialSeries.$$p[0]:
                if (this.cl != null) {
                    this.s9(this.cl, this.rd);
                    this.rd = this.rh(this.cl, this.so, "CloseColumn");
                }
                break;
            case "CloseColumn":
                if (this.q6 != null && !this.q6.c0() && !this.rk) {
                    this.q1.bx.e(this.fx);
                    this.mn(false);
                }
                this.te();
                break;
            case FinancialSeries.$$p[8]:
                if (this.cl != null) {
                    this.s9(this.cl, this.ri);
                    this.ri = this.rh(this.cl, this.s4, "VolumeColumn");
                }
                break;
            case "VolumeColumn":
                if (this.q6 != null && !this.q6.c0() && !this.rk) {
                    this.q1.bx.e(this.fx);
                    this.mn(false);
                }
                break;
            case FinancialSeries.$$p[9]:
                if (c != null) {
                    c.bz(this);
                }
                if (d != null) {
                    d.cs(this);
                }
                this.q1.bx.e(this.fx);
                this.mn(false);
                this.lu();
                this.q5 = typeCast(ITimeRangeSelectorAxis_$type, this.qk);
                break;
            case FinancialSeries.$$p[10]:
                if (c != null) {
                    c.bz(this);
                }
                if (d != null) {
                    d.cs(this);
                }
                this.q1.bx.e(this.fx);
                if (this.q6 != null) {
                    this.q6.c0();
                }
                {
                    this.mn(false);
                }
                this.lu();
                break;
            case "TransitionProgress":
                this.qq.c(this.g5, this.qo, this.qm);
                if (this.cy(this.b1)) {
                    return;
                }
                if (this.g5 == 1) {
                    this.qm.v();
                    this.td(this.qm, this.q1);
                    if (this.e4) {
                        this.e4 = false;
                        this.k3();
                        this.cf.r = truncate(this.gr());
                        this.cf.b = this.cg;
                    }
                }
                else {
                    this.td(this.qq, this.q1);
                }
                if (this.ce != null) {
                    this.ce.ob(this);
                }
                break;
            case FinancialSeries.$$p[5]:
                this.mn(false);
                break;
            case "IsCustomCategoryStyleAllowed":
                this.rl = this.ro();
                this.mn(false);
                break;
            case "CategoryMode":
                if (this.qk != null) {
                    this.qk.l4(true);
                }
                break;
        }
    };
    FinancialSeries.prototype.rn = function (a) {
        if (typeCast(NumericYAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    FinancialSeries.prototype.rm = function (a) {
        if (typeCast(CategoryXAxis.$, a) !== null || a.cd) {
            return true;
        }
        return false;
    };
    FinancialSeries.prototype.qd = function (a, b, c) {
        if (b < a || a < 0 || a > this.cl.count || b < 0 || b > this.cl.count || c == null) {
            return null;
        }
        var d = new Array((b - a) + 1);
        var e = c.cm;
        var f = null;
        if (e) {
            f = c.i$b;
        }
        for (var g = a; g <= b; g++) {
            var h = g;
            if (e) {
                h = f._inner[h];
            }
            d[g - a] = this.cl.item(g);
        }
        return d;
    };
    FinancialSeries.prototype.sh = function (a) {
        return a.bx.b;
    };
    FinancialSeries.prototype.sj = function (a) {
        return a.bx.c;
    };
    FinancialSeries.prototype.qc = function (a, b) {
        return this.qd(a, b, this.q6);
    };
    FinancialSeries.prototype.get_d0 = function () {
        return true;
    };
    FinancialSeries.prototype.k0 = function () {
        _super.prototype.k0.call(this);
        this.q4 = null;
    };
    FinancialSeries.prototype.ax = function (a, b, c) {
        if (this.c3 && this.ei(this.bl) && !c) {
            var d = this.q3(a, b, this.q4);
            this.q4 = d;
            return d;
        }
        else {
            var e = this.q2(a, b, this.q4);
            this.q4 = e;
            return e;
        }
    };
    FinancialSeries.prototype.sl = function (a) {
        var b = this.qn();
        var c = this.b1.bu;
        var d = this.b1.bv;
        var e = this.qk;
        var f = 0;
        if (e.co) {
            var g = (a.y - d.top) / d.height;
            f = g * c.height + c.top;
        }
        else {
            var h = (a.x - d.left) / d.width;
            f = h * c.width + c.left;
        }
        var i = b.f.count;
        var j = 0;
        for (j = 0; j < i; j++) {
            var k = b.f._inner[j];
            var l = null;
            if (j < i - 1) {
                l = b.f._inner[j + 1];
            }
            if (k[0] <= f && l == null || l[0] >= f) {
                if (l != null) {
                    if (Math.abs(k[0] - f) < Math.abs(l[0] - f)) {
                        return j;
                    }
                    else {
                        return j + 1;
                    }
                }
                else {
                    return j;
                }
            }
        }
        return j;
    };
    FinancialSeries.prototype.q3 = function (a, b, c) {
        var d = this.cl.count;
        var e = this.q1.bx.c;
        var f = this.q1.bx.d;
        var g = this.q1.bx.b;
        var h = this.qk;
        var i = -1;
        var j = -1;
        if (h.cm) {
            var k = this.qn();
            var l = this.sl(b);
            i = l;
            j = l;
        }
        else {
            var m = this.hi(b);
            i = truncate(Math.floor((intDivide(m, g)))) * g;
            j = i + (g - 1);
        }
        if (c != null && c.h == i && c.g == j) {
            return c;
        }
        var n = new HighlightingInfo();
        n.b = this;
        n.h = i;
        n.g = j;
        return n;
    };
    FinancialSeries.prototype.q2 = function (a, b, c) {
        var d = new HighlightingInfo();
        d.b = this;
        d.h = 0;
        d.g = this.cl.count - 1;
        d.d = true;
        if (c != null && c.h == d.h && c.g == d.g) {
            return c;
        }
        return d;
    };
    FinancialSeries.prototype.ro = function () {
        return this.rq;
    };
    FinancialSeries.prototype.f9 = function (a) {
        var b = this.b1.bv;
        var c = this.b1.bu;
        var d = -1;
        if (!b.isEmpty && !c.isEmpty && this.qk != null) {
            var e = this.getEffectiveViewport1(this.b1);
            var f = new ScalerParams(0, b, c, this.qk.cg, e);
            var g = this.pz(this.b1);
            var h = this.qk.el(g.left, f);
            var i = this.qk.el(g.right, f);
            var j = (a.x - b.left) / b.width;
            var k = h + (j * (i - h));
            if (this.qk.categoryMode != 0) {
                k -= 0.5;
            }
            d = k;
        }
        return d;
    };
    FinancialSeries.prototype.hi = function (a) {
        return truncate(Math.round(this.f9(a)));
    };
    FinancialSeries.prototype.get_ec = function () {
        return typeCast(ISortingAxis_$type, this.qk) !== null;
    };
    FinancialSeries.prototype.as = function () {
        return this.qk;
    };
    FinancialSeries.prototype.hk = function (a) {
        var b = this.b1.bv;
        var c = this.b1.bu;
        var d = this.getEffectiveViewport1(this.b1);
        if (b.isEmpty || c.isEmpty) {
            return -1;
        }
        var e = new Rect(0, 0, 0, 1, 1);
        var f = new ScalerParams(0, b, c, this.qk.cg, d);
        var g = typeCast(ISortingAxis_$type, this.qk);
        var h = this.pz(this.b1);
        var i = h.left;
        var j = h.right;
        var k = this.pn(a).x;
        var l = this.qk.el(k, f);
        var m = this.qk.el(i, f);
        var n = this.qk.el(j, f);
        l = Math.max(m, Math.min(n, l));
        var o = g.i$f(l);
        return o;
    };
    FinancialSeries.prototype.hy = function (a) {
        var b = 0;
        if (typeCast(ISortingAxis_$type, this.qk) !== null) {
            b = this.hk(a);
            if (b == -1) {
                return null;
            }
        }
        else {
            b = this.hi(a);
        }
        return b >= 0 && this.cl != null && b < this.cl.count ? this.cl.item(b) : null;
    };
    FinancialSeries.prototype.qn = function () {
        var a = this.qm;
        if (this.cw()) {
            if (this.cf.g) {
                this.cf.t();
            }
            a = this.qq;
        }
        return a;
    };
    FinancialSeries.prototype.sb = function (a, b, c) {
        if (this.qk == null) {
            return 0;
        }
        return this.qk.k4(a, b, c, this.index);
    };
    FinancialSeries.prototype.eu = function () {
        return this.rr;
    };
    FinancialSeries.prototype.qu = function () {
        return 11;
    };
    FinancialSeries.prototype.ca = function () {
        return 3;
    };
    FinancialSeries.prototype.td = function (a, b) {
        this.py = a.aa;
        b.au();
    };
    FinancialSeries.prototype.tb = function (a, b) {
        a.u();
    };
    FinancialSeries.prototype.fd = function (a, b, c) {
        var d = _super.prototype.fd.call(this, a, b, c);
        var e = c;
        if (this.cl == null || this.cl.count == 0 || !c.o() || b.isEmpty || a.isEmpty || this.qk == null || this.q6 == null || e.bx.b < 1 || this.qk.bh == null || this.q6.bh == null || this.q6.lw == this.q6.lv || this.qk.itemsSource == null || this.qk.le < 1) {
            e.bx.b = 0;
            d = false;
        }
        return d;
    };
    FinancialSeries.prototype.getViewInfo = function (a, b) {
        b = this.b1.bv;
        a = this.b1.bu;
        return {
            p0: a,
            p1: b
        };
    };
    FinancialSeries.prototype.sf = function (a) {
        var b = 0;
        var c = a.bv;
        var d = a.bu;
        var e = this.getEffectiveViewport1(this.b1);
        if (!c.isEmpty && !d.isEmpty && this.q6 != null) {
            var f = new ScalerParams(0, c, d, this.q6.cg, e);
            f.b = this.gg();
            b = this.q6.ei(this.q6.l6, f);
        }
        return b;
    };
    FinancialSeries.prototype.k3 = function () {
        _super.prototype.k3.call(this);
        this.qo.v();
        this.qm.v();
        this.qq.v();
    };
    FinancialSeries.prototype.mo = function (a) {
        var _this = this;
        _super.prototype.mo.call(this, a);
        this.q1.bx.e(this.fx);
        if (this.cy(this.b1)) {
            return;
        }
        if (this.ew) {
            if (this.cw()) {
                this.td(this.qq, this.q1);
            }
            else {
                this.td(this.qm, this.q1);
            }
            return;
        }
        if (this.er(a)) {
            var b = this.qo;
            if (this.cw()) {
                if (this.cf.g) {
                    this.cf.t();
                }
                this.qo = this.qq;
                this.qq = b;
            }
            else {
                this.qo = this.qm;
                this.qm = b;
            }
            this.tb(this.qm, this.q1);
            if (this.e6) {
                this.cf.w();
                this.cf.r = truncate(this.gs());
                this.cf.b = this.ch != null ? this.ch : this.cg;
                this.qw.p(this.qo, this.qm, this.isVertical, this.qk, this.q6, this.qv, this.qu(), this.cb, this.ca(), function () { return _this.sf(_this.q1); }, this.q1.bu);
            }
            this.ky();
            this.mw();
            if (this.e6) {
                this.e5 = false;
                this.e4 = true;
            }
        }
        else {
            this.tb(this.qm, this.q1);
            this.td(this.qm, this.q1);
        }
    };
    FinancialSeries.prototype.rt = function (a) {
        var e_1, _a;
        try {
            for (var _b = __values(fromEnum(a)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var b = _c.value;
                switch (b) {
                    case "HighColumn":
                        if (this.re == null) {
                            return false;
                        }
                        break;
                    case "LowColumn":
                        if (this.rf == null) {
                            return false;
                        }
                        break;
                    case "OpenColumn":
                        if (this.rg == null) {
                            return false;
                        }
                        break;
                    case "CloseColumn":
                        if (this.rd == null) {
                            return false;
                        }
                        break;
                    case "VolumeColumn":
                        if (this.ri == null) {
                            return false;
                        }
                        break;
                }
            }
        }
        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;
            }
        }
        return true;
    };
    Object.defineProperty(FinancialSeries.prototype, "ru", {
        get: function () {
            return this.qk != null && typeCast(ISortingAxis_$type, this.qk) !== null;
        },
        enumerable: false,
        configurable: true
    });
    FinancialSeries.prototype.rp = function () {
        return this.typical != null;
    };
    FinancialSeries.prototype.s8 = function (a) {
        this.typical(this, a);
    };
    Object.defineProperty(FinancialSeries.prototype, "r2", {
        get: function () {
            return this.rz();
        },
        enumerable: false,
        configurable: true
    });
    FinancialSeries.prototype._rz = function () {
        var a, b, _a, _b, c, e_2_1, d, e, f, g, h;
        var e_2, _c;
        return __generator(this, function (_d) {
            switch (_d.label) {
                case 0:
                    a = false;
                    if (!this.rp())
                        return [3 /*break*/, 8];
                    b = this.qx(0, this.cl.count);
                    this.s8(new FinancialEventArgs(0, this.cl.count, b, this.qy(b), this));
                    if (!(b.typicalColumn != null))
                        return [3 /*break*/, 8];
                    a = true;
                    _d.label = 1;
                case 1:
                    _d.trys.push([1, 6, 7, 8]);
                    _a = __values(fromEnum(b.typicalColumn)), _b = _a.next();
                    _d.label = 2;
                case 2:
                    if (!!_b.done)
                        return [3 /*break*/, 5];
                    c = _b.value;
                    return [4 /*yield*/, c];
                case 3:
                    _d.sent();
                    _d.label = 4;
                case 4:
                    _b = _a.next();
                    return [3 /*break*/, 2];
                case 5: return [3 /*break*/, 8];
                case 6:
                    e_2_1 = _d.sent();
                    e_2 = { error: e_2_1 };
                    return [3 /*break*/, 8];
                case 7:
                    try {
                        if (_b && !_b.done && (_c = _a.return))
                            _c.call(_a);
                    }
                    finally {
                        if (e_2)
                            throw e_2.error;
                    }
                    return [7 /*endfinally*/];
                case 8:
                    if (!!a)
                        return [3 /*break*/, 17];
                    if (!(this.ru && this.qk.i$b != null))
                        return [3 /*break*/, 13];
                    d = this.cl.count;
                    e = this.qk.i$b;
                    f = 0;
                    _d.label = 9;
                case 9:
                    if (!(f < d))
                        return [3 /*break*/, 12];
                    return [4 /*yield*/, (this.re.item(e.item(f)) + this.rf.item(e.item(f)) + this.rd.item(e.item(f))) / 3];
                case 10:
                    _d.sent();
                    _d.label = 11;
                case 11:
                    ++f;
                    return [3 /*break*/, 9];
                case 12: return [3 /*break*/, 17];
                case 13:
                    g = this.cl.count;
                    h = 0;
                    _d.label = 14;
                case 14:
                    if (!(h < g))
                        return [3 /*break*/, 17];
                    return [4 /*yield*/, (this.re.item(h) + this.rf.item(h) + this.rd.item(h)) / 3];
                case 15:
                    _d.sent();
                    _d.label = 16;
                case 16:
                    ++h;
                    return [3 /*break*/, 14];
                case 17: return [2 /*return*/];
            }
        });
    };
    FinancialSeries.prototype.rz = function () {
        var _this = this;
        return toEnum(function () { return _this._rz(); });
    };
    Object.defineProperty(FinancialSeries.prototype, "r1", {
        get: function () {
            return this.ry();
        },
        enumerable: false,
        configurable: true
    });
    FinancialSeries.prototype._ry = function () {
        var a, b, c, d, e;
        return __generator(this, function (_a) {
            switch (_a.label) {
                case 0:
                    if (!(this.ru && this.qk.i$b != null))
                        return [3 /*break*/, 7];
                    a = this.re.count;
                    b = this.qk.i$b;
                    if (!(a > 0))
                        return [3 /*break*/, 2];
                    return [4 /*yield*/, this.sg(this.re.item(b.item(0)) - this.rf.item(b.item(0)))];
                case 1:
                    _a.sent();
                    _a.label = 2;
                case 2:
                    c = 1;
                    _a.label = 3;
                case 3:
                    if (!(c < a))
                        return [3 /*break*/, 6];
                    return [4 /*yield*/, Math.max(this.sg(this.re.item(b.item(c)) - this.rf.item(b.item(c))), Math.max(this.sg(Math.abs(this.re.item(b.item(c)) - this.rd.item(b.item(c - 1)))), this.sg(Math.abs(this.rf.item(b.item(c)) - this.rd.item(b.item(c - 1))))))];
                case 4:
                    _a.sent();
                    _a.label = 5;
                case 5:
                    ++c;
                    return [3 /*break*/, 3];
                case 6: return [3 /*break*/, 13];
                case 7:
                    d = this.re.count;
                    if (!(d > 0))
                        return [3 /*break*/, 9];
                    return [4 /*yield*/, this.sg(this.re.item(0) - this.rf.item(0))];
                case 8:
                    _a.sent();
                    _a.label = 9;
                case 9:
                    e = 1;
                    _a.label = 10;
                case 10:
                    if (!(e < d))
                        return [3 /*break*/, 13];
                    return [4 /*yield*/, Math.max(this.sg(this.re.item(e) - this.rf.item(e)), Math.max(this.sg(Math.abs(this.re.item(e) - this.rd.item(e - 1))), this.sg(Math.abs(this.rf.item(e) - this.rd.item(e - 1)))))];
                case 11:
                    _a.sent();
                    _a.label = 12;
                case 12:
                    ++e;
                    return [3 /*break*/, 10];
                case 13: return [2 /*return*/];
            }
        });
    };
    FinancialSeries.prototype.ry = function () {
        var _this = this;
        return toEnum(function () { return _this._ry(); });
    };
    Object.defineProperty(FinancialSeries.prototype, "r0", {
        get: function () {
            return this.rx();
        },
        enumerable: false,
        configurable: true
    });
    FinancialSeries.prototype._rx = function () {
        var a, b, c, d, e;
        return __generator(this, function (_a) {
            switch (_a.label) {
                case 0:
                    if (!(this.ru && this.qk.i$b != null))
                        return [3 /*break*/, 7];
                    a = this.rf.count;
                    b = this.qk.i$b;
                    if (!(a > 0))
                        return [3 /*break*/, 2];
                    return [4 /*yield*/, this.sg(this.rf.item(b.item(0)))];
                case 1:
                    _a.sent();
                    _a.label = 2;
                case 2:
                    c = 1;
                    _a.label = 3;
                case 3:
                    if (!(c < a))
                        return [3 /*break*/, 6];
                    return [4 /*yield*/, Math.min(this.sg(this.rf.item(b.item(c))), this.sg(this.rd.item(b.item(c - 1))))];
                case 4:
                    _a.sent();
                    _a.label = 5;
                case 5:
                    c++;
                    return [3 /*break*/, 3];
                case 6: return [3 /*break*/, 13];
                case 7:
                    d = this.rf.count;
                    if (!(d > 0))
                        return [3 /*break*/, 9];
                    return [4 /*yield*/, this.sg(this.rf.item(0))];
                case 8:
                    _a.sent();
                    _a.label = 9;
                case 9:
                    e = 1;
                    _a.label = 10;
                case 10:
                    if (!(e < d))
                        return [3 /*break*/, 13];
                    return [4 /*yield*/, Math.min(this.sg(this.rf.item(e)), this.sg(this.rd.item(e - 1)))];
                case 11:
                    _a.sent();
                    _a.label = 12;
                case 12:
                    e++;
                    return [3 /*break*/, 10];
                case 13: return [2 /*return*/];
            }
        });
    };
    FinancialSeries.prototype.rx = function () {
        var _this = this;
        return toEnum(function () { return _this._rx(); });
    };
    FinancialSeries.prototype.r4 = function (a) {
        if (a == null) {
            return null;
        }
        if (this.ru && this.qk.i$b != null) {
            return new SafeSortedReadOnlyDoubleCollection(0, a, this.qk.i$b);
        }
        return new SafeReadOnlyDoubleCollection(0, a);
    };
    FinancialSeries.prototype.r3 = function () {
        var a = new List$1(String_$type, 0);
        a.add("HighColumn");
        a.add("LowColumn");
        a.add("CloseColumn");
        if (this.typicalBasedOn != null && this.cl != null && !this.rj) {
            this.rj = true;
            var b = this.qx(0, this.cl.count);
            this.rj = false;
            var c = new FinancialEventArgs(0, this.cl.count, b, this.qy(b), this);
            this.typicalBasedOn(this, c);
            if (c.basedOn != null && c.basedOn.count > 0) {
                return c.basedOn;
            }
        }
        return a;
    };
    FinancialSeries.prototype.getOpenColumnAsArray = function () {
        if (this.rg == null) {
            return null;
        }
        if (this.qk != null && typeCast(ISortingAxis_$type, this.qk) !== null) {
            if (this.r8 != null) {
                return this.r8.asArray();
            }
            var a = new List$1(Number_$type, 2, this.rg.count);
            var b = this.qk.i$b;
            var c = this.rg.asArray();
            for (var d = 0; d < b.count; d++) {
                a.add(c[b._inner[d]]);
            }
            this.r8 = a;
            return this.r8.asArray();
        }
        else {
            return this.rg.asArray();
        }
    };
    FinancialSeries.prototype.getHighColumnAsArray = function () {
        if (this.re == null) {
            return null;
        }
        if (this.qk != null && typeCast(ISortingAxis_$type, this.qk) !== null) {
            if (this.r6 != null) {
                return this.r6.asArray();
            }
            var a = new List$1(Number_$type, 2, this.re.count);
            var b = this.qk.i$b;
            var c = this.re.asArray();
            for (var d = 0; d < b.count; d++) {
                a.add(c[b._inner[d]]);
            }
            this.r6 = a;
            return this.r6.asArray();
        }
        else {
            return this.re.asArray();
        }
    };
    FinancialSeries.prototype.getLowColumnAsArray = function () {
        if (this.rf == null) {
            return null;
        }
        if (this.qk != null && typeCast(ISortingAxis_$type, this.qk) !== null) {
            if (this.r7 != null) {
                return this.r7.asArray();
            }
            var a = new List$1(Number_$type, 2, this.rf.count);
            var b = this.qk.i$b;
            var c = this.rf.asArray();
            for (var d = 0; d < b.count; d++) {
                a.add(c[b._inner[d]]);
            }
            this.r7 = a;
            return this.r7.asArray();
        }
        else {
            return this.rf.asArray();
        }
    };
    FinancialSeries.prototype.getCloseColumnAsArray = function () {
        if (this.rd == null) {
            return null;
        }
        if (this.qk != null && typeCast(ISortingAxis_$type, this.qk) !== null) {
            if (this.r5 != null) {
                return this.r5.asArray();
            }
            var a = new List$1(Number_$type, 2, this.rd.count);
            var b = this.qk.i$b;
            var c = this.rd.asArray();
            for (var d = 0; d < b.count; d++) {
                a.add(c[b._inner[d]]);
            }
            this.r5 = a;
            return this.r5.asArray();
        }
        else {
            return this.rd.asArray();
        }
    };
    FinancialSeries.prototype.getVolumeColumnAsArray = function () {
        if (this.ri == null) {
            return null;
        }
        if (this.qk != null && typeCast(ISortingAxis_$type, this.qk) !== null) {
            if (this.r9 != null) {
                return this.r9.asArray();
            }
            var a = new List$1(Number_$type, 2, this.ri.count);
            var b = this.qk.i$b;
            var c = this.ri.asArray();
            for (var d = 0; d < b.count; d++) {
                a.add(c[b._inner[d]]);
            }
            this.r9 = a;
            return this.r9.asArray();
        }
        else {
            return this.ri.asArray();
        }
    };
    FinancialSeries.prototype.k5 = function (a, b, c, d) {
        _super.prototype.k5.call(this, a, b, c, d);
        if (this.qk == null || !(typeCast(ISortingAxis_$type, this.qk) !== null)) {
            return;
        }
        var e = this.qk.i$b;
        switch (a) {
            case 1:
                for (var f = b; f < c; f++) {
                    var g = e._inner[f];
                    if (this.r8 != null) {
                        this.r8.insert(f, this.rg.item(g));
                    }
                    if (this.r6 != null) {
                        this.r6.insert(f, this.re.item(g));
                    }
                    if (this.r7 != null) {
                        this.r7.insert(f, this.rf.item(g));
                    }
                    if (this.r5 != null) {
                        this.r5.insert(f, this.rd.item(g));
                    }
                    if (this.r9 != null) {
                        this.r9.insert(f, this.ri.item(g));
                    }
                }
                break;
            case 0:
                if (this.r8 != null) {
                    this.r8.v(b, c);
                }
                if (this.r6 != null) {
                    this.r6.v(b, c);
                }
                if (this.r7 != null) {
                    this.r7.v(b, c);
                }
                if (this.r5 != null) {
                    this.r5.v(b, c);
                }
                if (this.r9 != null) {
                    this.r9.v(b, c);
                }
                break;
            case 4:
                if (this.r8 != null) {
                    this.r8 = new List$1(Number_$type, 0);
                }
                if (this.r6 != null) {
                    this.r6 = new List$1(Number_$type, 0);
                }
                if (this.r7 != null) {
                    this.r7 = new List$1(Number_$type, 0);
                }
                if (this.r5 != null) {
                    this.r5 = new List$1(Number_$type, 0);
                }
                if (this.r9 != null) {
                    this.r9 = new List$1(Number_$type, 0);
                }
                break;
            case 3:
            case 2:
                for (var h = b; h < c; h++) {
                    var i = e._inner[h];
                    if (this.r8 != null) {
                        this.r8._inner[h] = this.rg.item(i);
                    }
                    if (this.r6 != null) {
                        this.r6._inner[h] = this.re.item(i);
                    }
                    if (this.r7 != null) {
                        this.r7._inner[h] = this.rf.item(i);
                    }
                    if (this.r5 != null) {
                        this.r5._inner[h] = this.rd.item(i);
                    }
                    if (this.r9 != null) {
                        this.r9._inner[h] = this.ri.item(i);
                    }
                }
                break;
        }
        this.te();
        this.m7();
    };
    FinancialSeries.prototype.qx = function (a, b) {
        var _this = this;
        var c = this.r4(this.rg);
        var d = this.r4(this.rd);
        var e = this.r4(this.re);
        var f = this.r4(this.rf);
        var g = this.r4(this.ri);
        var h = ((function () {
            var $ret = new FinancialCalculationDataSource();
            $ret.typicalColumn = new CalculatedColumn(1, new SafeEnumerable(_this.r2), _this.r3());
            $ret.trueRange = new CalculatedColumn(1, new SafeEnumerable(_this.r1), ((function () {
                var $ret = new List$1(String_$type, 0);
                $ret.add("HighColumn");
                $ret.add("LowColumn");
                $ret.add("CloseColumn");
                return $ret;
            })()));
            $ret.trueLow = new CalculatedColumn(1, new SafeEnumerable(_this.r0), ((function () {
                var $ret = new List$1(String_$type, 0);
                $ret.add("LowColumn");
                $ret.add("CloseColumn");
                return $ret;
            })()));
            $ret.openColumn = c;
            $ret.closeColumn = d;
            $ret.highColumn = e;
            $ret.lowColumn = f;
            $ret.volumeColumn = g;
            $ret.calculateFrom = a;
            $ret.calculateCount = b;
            $ret.minimumValue = NaN;
            $ret.maximumValue = NaN;
            $ret.count = _this.cl != null ? _this.cl.count : 0;
            return $ret;
        })());
        return h;
    };
    FinancialSeries.prototype.sg = function (a) {
        if (isInfinity(a) || isNaN_(a)) {
            return 0;
        }
        return a;
    };
    FinancialSeries.prototype.qy = function (a) {
        var _this = this;
        return ((function () {
            var $ret = new FinancialCalculationSupportingCalculations();
            $ret.a = new ColumnSupportingCalculation(1, TrendCalculators.b, new List$1(String_$type, 0));
            $ret.c = new ColumnSupportingCalculation(1, TrendCalculators.e, new List$1(String_$type, 0));
            $ret.d = new ColumnSupportingCalculation(1, TrendCalculators.f, new List$1(String_$type, 0));
            $ret.b = new ColumnSupportingCalculation(1, TrendCalculators.d, new List$1(String_$type, 0));
            $ret.h = new DataSourceSupportingCalculation(1, function (b) { return TrendCalculators.b(b.volumeColumn, b.shortPeriod); }, ((function () {
                var $ret = new List$1(String_$type, 0);
                $ret.add("VolumeColumn");
                return $ret;
            })()));
            $ret.f = new DataSourceSupportingCalculation(1, function (b) { return TrendCalculators.b(b.volumeColumn, b.longPeriod); }, ((function () {
                var $ret = new List$1(String_$type, 0);
                $ret.add("VolumeColumn");
                return $ret;
            })()));
            $ret.g = new DataSourceSupportingCalculation(1, function (b) { return TrendCalculators.b(b.typicalColumn, b.shortPeriod); }, a.typicalColumn.basedOn);
            $ret.e = new DataSourceSupportingCalculation(1, function (b) { return TrendCalculators.b(b.typicalColumn, b.longPeriod); }, a.typicalColumn.basedOn);
            $ret.k = Series.fi;
            $ret.j = Series.fh;
            $ret.i = runOn(_this, _this.sg);
            return $ret;
        })());
    };
    Object.defineProperty(FinancialSeries.prototype, "categoryAxis", {
        get: function () {
            return this.qk;
        },
        enumerable: false,
        configurable: true
    });
    FinancialSeries.prototype.mp = function (a, b) {
        _super.prototype.mp.call(this, a, b);
        if (!this.e3) {
            this.b1.a2(b);
            return;
        }
        var c = typeCast(FinancialSeriesView.$, this.b0);
        this.b1.a2(b);
        c.bx.e(this.fx);
        if (this.cy(this.b0)) {
            return;
        }
        if (!this.ex) {
            this.tb(this.qp, c);
        }
        this.ex = false;
        this.td(this.qp, c);
        this.e3 = false;
    };
    FinancialSeries.prototype.mm = function (a, b, c, d, e) {
        _super.prototype.mm.call(this, a, b, c, d, e);
        var f = this.a7.a$h.item(d);
        var g = f;
        g.bx.e(this.fx);
        f.a1(c);
        if (this.cy(g)) {
            return;
        }
        if (this.ql == null) {
            this.ql = new CategoryFrame(3);
        }
        this.ql.u();
        this.tb(this.ql, g);
        this.td(this.ql, g);
    };
    FinancialSeries.prototype.ao = function (a) {
        if (this.qk == a) {
            return this.q6;
        }
        if (this.q6 == a) {
            return this.qk;
        }
        return null;
    };
    FinancialSeries.prototype.preferredCategoryMode = function (a) {
        var b = typeCast(IDateTimeAxis_$type, this.qk);
        return b != null ? b.preferredCategoryMode(this) : this.qs;
    };
    Object.defineProperty(FinancialSeries.prototype, "qs", {
        get: function () {
            return this.qr;
        },
        set: function (a) {
            var b = this.qs;
            if (a != b) {
                this.qr = a;
                this.raisePropertyChanged("CategoryMode", enumGetBox(CategoryMode_$type, b), enumGetBox(CategoryMode_$type, this.qs));
            }
        },
        enumerable: false,
        configurable: true
    });
    FinancialSeries.prototype.get_d6 = function () {
        return true;
    };
    FinancialSeries.prototype.ms = function (a, b) {
        _super.prototype.ms.call(this, a, b);
        this.tq = a;
    };
    FinancialSeries.prototype.te = function () {
        this.f5 = this.rd == null || this.rd.count == 0 ? NaN : this.rd.item(this.rd.count - 1);
    };
    FinancialSeries.prototype.h0 = function (a) {
        if (this.q5 != null && a != null) {
            if (this.q7 == null || this.q7.propertyName != this.q5.dateTimeMemberPath) {
                this.q7 = new FastReflectionHelper(false, this.q5.dateTimeMemberPath);
            }
            var b = this.q7.getPropertyValue(a);
            if (typeCast(Date_$type, b) !== null) {
                return dateToStringFormat(b, this.q5.itemLabelFormat());
            }
        }
        return _super.prototype.h0.call(this, a);
    };
    FinancialSeries.$t = markType(FinancialSeries, 'FinancialSeries', Series.$, [IHasCategoryAxis_$type, IHasCategoryModePreference_$type]);
    FinancialSeries.$$p = markDep(DependencyProperty, PropertyMetadata, FinancialSeries, 'raisePropertyChanged', ['CloseMemberPath:so:tf', [2, null], 'HighMemberPath:sr:tg', [2, null], 'IsCustomCategoryStyleAllowed:rq:th', [0, false], 'IsTransitionInEnabled:rr:ti', [0, false], 'LowMemberPath:sw:tj', [2, null], 'NegativeBrush:tq:tk', [Brush.$, null], 'OpenMemberPath:s0:tl', [2, null], 'TransitionInMode:qv:tm', [CategoryTransitionInMode_$type, enumGetBox(CategoryTransitionInMode_$type, 0)], 'VolumeMemberPath:s4:tn', [2, null], 'XAxis:qk:to', [CategoryAxisBase.$, null], 'YAxis:q6:tp', [NumericYAxis.$, null]]);
    return FinancialSeries;
}(Series));
export { FinancialSeries };
/**
 * @hidden
 */
var FinancialCalculationSupportingCalculations = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(FinancialCalculationSupportingCalculations, _super);
    function FinancialCalculationSupportingCalculations() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.a = null;
        _this.c = null;
        _this.d = null;
        _this.b = null;
        _this.h = null;
        _this.f = null;
        _this.g = null;
        _this.e = null;
        _this.k = null;
        _this.j = null;
        _this.i = null;
        return _this;
    }
    FinancialCalculationSupportingCalculations.$t = markType(FinancialCalculationSupportingCalculations, 'FinancialCalculationSupportingCalculations');
    return FinancialCalculationSupportingCalculations;
}(Base));
export { FinancialCalculationSupportingCalculations };
/**
 * @hidden
 */
var DataSourceSupportingCalculation = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(DataSourceSupportingCalculation, _super);
    function DataSourceSupportingCalculation(a) {
        var _rest = [];
        for (var _i = 1; _i < arguments.length; _i++) {
            _rest[_i - 1] = arguments[_i];
        }
        var _this = this;
        a = (a == void 0) ? 0 : a;
        switch (a) {
            case 0:
                {
                    var c = _rest[0];
                    _this = _super.call(this, Delegate_$type, 0, c) || this;
                }
                break;
            case 1:
                {
                    var c = _rest[0];
                    var d = _rest[1];
                    _this = _super.call(this, Delegate_$type, 1, c, d) || this;
                }
                break;
        }
        return _this;
    }
    DataSourceSupportingCalculation.$t = markType(DataSourceSupportingCalculation, 'DataSourceSupportingCalculation', SupportingCalculation$1.$.specialize(Delegate_$type));
    return DataSourceSupportingCalculation;
}(SupportingCalculation$1));
export { DataSourceSupportingCalculation };
/**
 * @hidden
 */
var FinancialCalculationDataSource = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(FinancialCalculationDataSource, _super);
    function FinancialCalculationDataSource() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this._openColumn = null;
        _this._closeColumn = null;
        _this._highColumn = null;
        _this._lowColumn = null;
        _this._volumeColumn = null;
        _this._indicatorColumn = null;
        _this._typicalColumn = null;
        _this._trueRange = null;
        _this._trueLow = null;
        _this._period = 0;
        _this._shortPeriod = 0;
        _this._longPeriod = 0;
        _this._count = 0;
        _this._calculateFrom = 0;
        _this._calculateCount = 0;
        _this._multiplier = 0;
        _this._minimumValue = 0;
        _this._maximumValue = 0;
        _this._specifiesRange = false;
        _this._series = null;
        return _this;
    }
    Object.defineProperty(FinancialCalculationDataSource.prototype, "openColumn", {
        get: function () {
            return this._openColumn;
        },
        set: function (a) {
            this._openColumn = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "closeColumn", {
        get: function () {
            return this._closeColumn;
        },
        set: function (a) {
            this._closeColumn = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "highColumn", {
        get: function () {
            return this._highColumn;
        },
        set: function (a) {
            this._highColumn = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "lowColumn", {
        get: function () {
            return this._lowColumn;
        },
        set: function (a) {
            this._lowColumn = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "volumeColumn", {
        get: function () {
            return this._volumeColumn;
        },
        set: function (a) {
            this._volumeColumn = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "indicatorColumn", {
        get: function () {
            return this._indicatorColumn;
        },
        set: function (a) {
            this._indicatorColumn = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "typicalColumn", {
        get: function () {
            return this._typicalColumn;
        },
        set: function (a) {
            this._typicalColumn = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "trueRange", {
        get: function () {
            return this._trueRange;
        },
        set: function (a) {
            this._trueRange = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "trueLow", {
        get: function () {
            return this._trueLow;
        },
        set: function (a) {
            this._trueLow = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "period", {
        get: function () {
            return this._period;
        },
        set: function (a) {
            this._period = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "shortPeriod", {
        get: function () {
            return this._shortPeriod;
        },
        set: function (a) {
            this._shortPeriod = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "longPeriod", {
        get: function () {
            return this._longPeriod;
        },
        set: function (a) {
            this._longPeriod = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "count", {
        get: function () {
            return this._count;
        },
        set: function (a) {
            this._count = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "calculateFrom", {
        get: function () {
            return this._calculateFrom;
        },
        set: function (a) {
            this._calculateFrom = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "calculateCount", {
        get: function () {
            return this._calculateCount;
        },
        set: function (a) {
            this._calculateCount = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "multiplier", {
        get: function () {
            return this._multiplier;
        },
        set: function (a) {
            this._multiplier = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "minimumValue", {
        get: function () {
            return this._minimumValue;
        },
        set: function (a) {
            this._minimumValue = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "maximumValue", {
        get: function () {
            return this._maximumValue;
        },
        set: function (a) {
            this._maximumValue = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "specifiesRange", {
        get: function () {
            return this._specifiesRange;
        },
        set: function (a) {
            this._specifiesRange = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "series", {
        get: function () {
            return this._series;
        },
        set: function (a) {
            this._series = a;
        },
        enumerable: false,
        configurable: true
    });
    FinancialCalculationDataSource.$t = markType(FinancialCalculationDataSource, 'FinancialCalculationDataSource');
    return FinancialCalculationDataSource;
}(Base));
export { FinancialCalculationDataSource };
/**
 * @hidden
 */
var FinancialSeriesView = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(FinancialSeriesView, _super);
    function FinancialSeriesView(a) {
        var _this = _super.call(this, a) || this;
        _this.bz = null;
        _this.bx = null;
        _this.b1 = 0;
        _this.b1 = -1;
        _this.bz = a;
        _this.bx = _this.by();
        return _this;
    }
    FinancialSeriesView.prototype.b0 = function (a) {
        if (this.b1 != a.t) {
            return true;
        }
        return false;
    };
    FinancialSeriesView.prototype.b2 = function (a) {
        this.b1 = a.t;
    };
    FinancialSeriesView.prototype.as = function () {
        _super.prototype.as.call(this);
        if (!this.q) {
        }
    };
    FinancialSeriesView.prototype.getDefaultTooltipTemplate = function () {
        var a = "<div class='ui-chart-default-tooltip-content'>";
        if (this.bz.qk.cd) {
            a += "<span>${itemLabel}</span><br/>";
        }
        else if (this.bz.qk.fz != null) {
            a += "<span>${item." + this.bz.qk.fz + "}</span><br/>";
        }
        a += "<span class='ui-priority-primary'";
        var b = this.e.a7.a$r(this.e);
        if (!stringIsNullOrEmpty(b)) {
            a += " style='color:" + b + "'";
        }
        var c = new SRProvider(this.w);
        var d = c.b1("financialSeries_Open");
        var e = c.b1("financialSeries_High");
        var f = c.b1("financialSeries_Low");
        var g = c.b1("financialSeries_Close");
        d = stringIsNullOrEmpty(d) ? "Open" : d;
        e = stringIsNullOrEmpty(e) ? "High" : e;
        f = stringIsNullOrEmpty(f) ? "Low" : f;
        g = stringIsNullOrEmpty(g) ? "Close" : g;
        a += ">" + this.bz.title + "</span><table><tr><td>" + d + ":</td><td>" + "${item." + this.bz.s0 + "}</td></tr><tr><td>" + e + ":</td><td>" + "${item." + this.bz.sr + "}</td></tr><tr><td>" + f + ":</td><td>" + "${item." + this.bz.sw + "}</td></tr><tr><td>" + g + ":</td><td>" + "${item." + this.bz.so + "}</td></tr>";
        if (!stringIsNullOrEmpty(this.bz.s4)) {
            var h = c.b1("financialSeries_Volume");
            h = stringIsNullOrEmpty(h) ? "Volume" : h;
            a += "<tr><td>" + h + ":</td><td>" + "${item." + this.bz.s4 + "}</td></tr>";
        }
        a += "</table></div>";
        return a;
    };
    FinancialSeriesView.prototype.af = function () {
        var a = new Color();
        a.colorString = "rgba(95,95,95,0.5)";
        this.e.ph = a;
        this.e.g1 = 5;
        this.e.g2 = 2;
        this.e.g3 = 2;
    };
    FinancialSeriesView.$t = markType(FinancialSeriesView, 'FinancialSeriesView', SeriesView.$);
    return FinancialSeriesView;
}(SeriesView));
export { FinancialSeriesView };
