/*
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 { EventArgs, Base, Type, markType, typeCast, Point_$type, String_$type, runOn, Number_$type, enumGetBox, fromEnum, toEnum, Date_$type, Delegate_$type } from "igniteui-react-core/ES5/type";
import { IBucketizer_$type } from "./IBucketizer";
import { ArgumentNullException } from "igniteui-react-core/ES5/ArgumentNullException";
import { IFastItemColumn$1_$type } from "igniteui-react-core/ES5/IFastItemColumn$1";
import { Series } from "./Series";
import { Rect } from "igniteui-react-core/ES5/Rect";
import { ScalerParams } from "./ScalerParams";
import { ISortingAxis_$type } from "./ISortingAxis";
import { SeriesView } from "./SeriesView";
import { truncate, intDivide, isInfinity, isNaN_ } from "igniteui-react-core/ES5/number";
import { IHasCategoryAxis_$type } from "./IHasCategoryAxis";
import { IHasCategoryModePreference_$type } from "./IHasCategoryModePreference";
import { Brush } from "igniteui-react-core/ES5/Brush";
import { DependencyProperty } from "igniteui-react-core/ES5/DependencyProperty";
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-react-core/ES5/FastReflectionHelper";
import { List$1 } from "igniteui-react-core/ES5/List$1";
import { Dictionary$2 } from "igniteui-react-core/ES5/Dictionary$2";
import { CategorySeriesRenderManager } from "./CategorySeriesRenderManager";
import { IFastItemsSource_$type } from "igniteui-react-core/ES5/IFastItemsSource";
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-react-core/ES5/TrendCalculators";
import { ColumnSupportingCalculation } from "./ColumnSupportingCalculation";
import { IDateTimeAxis_$type } from "./IDateTimeAxis";
import { PropertyMetadata } from "igniteui-react-core/ES5/PropertyMetadata";
import { stringIsNullOrEmpty } from "igniteui-react-core/ES5/string";
import { dateToStringFormat } from "igniteui-react-core/ES5/dateExtended";
import { SupportingCalculation$1 } from "./SupportingCalculation$1";
import { SRProvider } from "igniteui-react-core/ES5/SRProvider";
import { Color } from "igniteui-react-core/ES5/Color";
/**
 * @hidden
 */
var FinancialEventArgs = /** @class */ (function (_super) {
    tslib_1.__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: true,
        configurable: true
    });
    Object.defineProperty(FinancialEventArgs.prototype, "count", {
        get: function () {
            return this._count;
        },
        set: function (a) {
            this._count = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialEventArgs.prototype, "dataSource", {
        get: function () {
            return this._dataSource;
        },
        set: function (a) {
            this._dataSource = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialEventArgs.prototype, "supportingCalculations", {
        get: function () {
            return this._supportingCalculations;
        },
        set: function (a) {
            this._supportingCalculations = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialEventArgs.prototype, "basedOn", {
        get: function () {
            return this._basedOn;
        },
        set: function (a) {
            this._basedOn = a;
        },
        enumerable: true,
        configurable: true
    });
    FinancialEventArgs.$t = markType(FinancialEventArgs, 'FinancialEventArgs', EventArgs.$);
    return FinancialEventArgs;
}(EventArgs));
export { FinancialEventArgs };
/**
 * @hidden
 */
var FinancialBucketCalculator = /** @class */ (function (_super) {
    tslib_1.__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.bw.er;
        return {
            p0: a,
            p1: b,
            p2: c,
            p3: d
        };
    };
    FinancialBucketCalculator.prototype.e = function (a) {
        var b = this.a.bs;
        var c = this.a.br;
        var d = this.a.br;
        if (this.a.bw != null) {
            d = this.a.bw.getEffectiveViewport1(this.a);
        }
        if (b.isEmpty || c.isEmpty || this.a.bw.l1 == null) {
            this.b = 0;
            return;
        }
        var e = (this.a.bw.l1 != null) ? this.a.bw.l1.b8 : false;
        var f = new ScalerParams(0, b, c, e, d);
        var g = this.a.bw.lj(this.a);
        var h = typeCast(ISortingAxis_$type, this.a.bw.l1);
        if (h == null || h.i$b == null) {
            var i = Math.floor(this.a.bw.l1.dw(g.left, f));
            var j = Math.ceil(this.a.bw.l1.dw(g.right, f));
            if (this.a.bw.l1.b8) {
                j = Math.ceil(this.a.bw.l1.dw(g.left, f));
                i = Math.floor(this.a.bw.l1.dw(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 */ (function (_super) {
    tslib_1.__extends(FinancialSeries, _super);
    function FinancialSeries() {
        var _this = _super.call(this) || this;
        _this.mu = null;
        _this.mq = null;
        _this.ms = null;
        _this.mo = null;
        _this.mx = null;
        _this.m1 = false;
        _this.assigningCategoryStyle = null;
        _this.l9 = null;
        _this.nc = new Dictionary$2(IFastItemColumn$1_$type.specialize(Number_$type), String_$type, 0);
        _this.nd = new Dictionary$2(String_$type, String_$type, 0);
        _this.m0 = false;
        _this.mk = null;
        _this.l4 = null;
        _this.l6 = null;
        _this.l3 = null;
        _this.mc = null;
        _this.typical = null;
        _this.typicalBasedOn = null;
        _this.mz = false;
        _this.np = null;
        _this.nn = null;
        _this.no = null;
        _this.nm = null;
        _this.nq = null;
        _this.l5 = null;
        _this.l2 = null;
        _this.l7 = 0;
        _this.ml = null;
        _this.mn = null;
        _this.l9 = new CategorySeriesRenderManager();
        _this.m1 = false;
        _this.mc = new CategoryTransitionSourceFramePreparer();
        _this.l5 = new CategoryFrame(3);
        _this.ab = FinancialSeries.$;
        _this.l8 = 0;
        return _this;
    }
    FinancialSeries.prototype.im = function (a) {
        _super.prototype.im.call(this, a);
        this.mh = a;
    };
    FinancialSeries.prototype.get_cr = function () {
        return true;
    };
    FinancialSeries.prototype.ag = function () {
        return [this.l1, this.mm];
    };
    FinancialSeries.prototype.n1 = function () {
        return 2;
    };
    FinancialSeries.prototype.nz = function () {
        return 4;
    };
    FinancialSeries.prototype.ah = function (a) {
        var b = this.aj(this.l1, this.l3.f, this.ny(this.bi), this.n0(this.bi), this.lh(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.n1();
        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.l1, this.l3.f, this.ny(this.bi), this.n0(this.bi), this.lh(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.k2 = function () {
        return this.o7;
    };
    FinancialSeries.prototype.hn = function () {
        _super.prototype.hn.call(this);
        this.l1 = null;
        this.mm = null;
    };
    Object.defineProperty(FinancialSeries.prototype, "mv", {
        get: function () {
            return this.mu;
        },
        set: function (a) {
            if (this.mu != a) {
                var b = this.mu;
                this.mu = a;
                this.raisePropertyChanged("OpenColumn", b, this.mu);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialSeries.prototype, "mr", {
        get: function () {
            return this.mq;
        },
        set: function (a) {
            if (this.mq != a) {
                var b = this.mq;
                this.mq = a;
                this.raisePropertyChanged("HighColumn", b, this.mq);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialSeries.prototype, "mt", {
        get: function () {
            return this.ms;
        },
        set: function (a) {
            if (this.ms != a) {
                var b = this.ms;
                this.ms = a;
                this.raisePropertyChanged("LowColumn", b, this.ms);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialSeries.prototype, "mp", {
        get: function () {
            return this.mo;
        },
        set: function (a) {
            if (this.mo != a) {
                var b = this.mo;
                this.mo = a;
                this.raisePropertyChanged("CloseColumn", b, this.mo);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialSeries.prototype, "my", {
        get: function () {
            return this.mx;
        },
        set: function (a) {
            if (this.mx != a) {
                var b = this.mx;
                this.mx = a;
                this.raisePropertyChanged("VolumeColumn", b, this.mx);
            }
        },
        enumerable: true,
        configurable: true
    });
    FinancialSeries.prototype.m9 = function () {
        return (this.assigningCategoryStyle != null && this.m1) || this.cu;
    };
    FinancialSeries.prototype.ot = function (a) {
        if (this.assigningCategoryStyle != null && this.m1) {
            this.assigningCategoryStyle(this, a);
        }
    };
    FinancialSeries.prototype.or = function (a, b, c, d, e, f) {
        var g = this.b9;
        this.l9.ac(a, b, c, d, e, f, g);
        var h = this.l9.c;
        var i = null;
        var j = this.bz;
        if (g && this.bs != null) {
            i = this.bs.az.getHighlightingInfo(this, j, d, h.m, h.l, false);
            h.b = i;
        }
        h.f = f;
        this.ot(h);
        this.l9.aa(i, f, g);
    };
    FinancialSeries.prototype.nr = function (a) {
        return this.ea(a, this.l1);
    };
    FinancialSeries.prototype.fb = function (a, b) {
        return this.fc(a, b, this.l1, runOn(this, this.nr), new FinancialValueList(this.mv, this.mr, this.mt, this.mp, this.my));
    };
    FinancialSeries.prototype.e9 = function (a, b) {
        return this.fa(a, b, this.l1, runOn(this, this.nr), new FinancialValueList(this.mv, this.mr, this.mt, this.mp, this.my));
    };
    FinancialSeries.prototype.d6 = function (a, b, c, d, e) {
        if (c == null) {
            return Number.POSITIVE_INFINITY;
        }
        var f = this.l1.jr;
        return this.d7(a, b, this.l1, d, e, f, runOn(this, this.nr));
    };
    FinancialSeries.prototype.getOffsetValue = function () {
        return this.ns(this.bi.bs, this.bi.br, this.getEffectiveViewport1(this.bi));
    };
    FinancialSeries.prototype.getCategoryWidth = function () {
        return this.l1.getCategorySize(this.bi.bs, this.bi.br, this.getEffectiveViewport1(this.bi));
    };
    FinancialSeries.prototype.le = function (a, b, c) {
        return this.lg(a, b, c, this.ns(this.bi.bs, this.bi.br, this.getEffectiveViewport1(this.bi)), this.mm, this.l1, null, null, null);
    };
    FinancialSeries.prototype.ek = function (a, b, c) {
        var d = this.getEffectiveViewport1(this.bi);
        var e = this.ns(this.bi.bs, this.bi.br, d);
        var f = new ScalerParams(0, this.bi.bs, this.bi.br, this.l1.b8, d);
        return this.em(new FinancialValueList(this.mv, this.mr, this.mt, this.mp, this.my), a, this.l1, f, e, runOn(this, this.nr), b, c);
    };
    FinancialSeries.prototype.eg = function (a, b, c) {
        var d = this.getEffectiveViewport1(this.bi);
        var e = this.ns(this.bi.bs, this.bi.br, d);
        var f = new ScalerParams(0, this.bi.bs, this.bi.br, this.l1.b8, d);
        return this.em(this.mr, a, this.l1, f, e, runOn(this, this.nr), b, c);
    };
    FinancialSeries.prototype.ei = function (a, b, c) {
        var d = this.getEffectiveViewport1(this.bi);
        var e = this.ns(this.bi.bs, this.bi.br, d);
        var f = new ScalerParams(0, this.bi.bs, this.bi.br, this.l1.b8, d);
        return this.em(this.mt, a, this.l1, f, e, runOn(this, this.nr), b, c);
    };
    FinancialSeries.prototype.nt = function (a, b, c) {
        var d = this.getEffectiveViewport1(this.bi);
        var e = this.ns(this.bi.bs, this.bi.br, d);
        var f = new ScalerParams(0, this.bi.bs, this.bi.br, this.l1.b8, d);
        return this.em(this.mp, a, this.l1, f, e, runOn(this, this.nr), b, c);
    };
    FinancialSeries.prototype.nu = function (a, b, c) {
        var d = this.getEffectiveViewport1(this.bi);
        var e = this.ns(this.bi.bs, this.bi.br, d);
        var f = new ScalerParams(0, this.bi.bs, this.bi.br, this.l1.b8, d);
        return this.em(this.mv, a, this.l1, f, e, runOn(this, this.nr), b, c);
    };
    FinancialSeries.prototype.nv = function (a, b, c) {
        var d = this.getEffectiveViewport1(this.bi);
        var e = this.ns(this.bi.bs, this.bi.br, d);
        var f = new ScalerParams(0, this.bi.bs, this.bi.br, this.l1.b8, d);
        return this.em(this.my, a, this.l1, f, e, runOn(this, this.nr), b, c);
    };
    FinancialSeries.prototype.la = function (a, b, c) {
        var _this = this;
        return this.lg(a, b, c, this.ns(this.bi.bs, this.bi.br, this.getEffectiveViewport1(this.bi)), this.mm, this.l1, runOn(this, this.eg), function (d, e) { return _this.fc(d, e, _this.l1, runOn(_this, _this.nr), _this.mr); }, function (d, e) { return _this.fa(d, e, _this.l1, runOn(_this, _this.nr), _this.mr); });
    };
    FinancialSeries.prototype.lc = function (a, b, c) {
        var _this = this;
        return this.lg(a, b, c, this.ns(this.bi.bs, this.bi.br, this.getEffectiveViewport1(this.bi)), this.mm, this.l1, runOn(this, this.ei), function (d, e) { return _this.fc(d, e, _this.l1, runOn(_this, _this.nr), _this.mt); }, function (d, e) { return _this.fa(d, e, _this.l1, runOn(_this, _this.nr), _this.mt); });
    };
    FinancialSeries.prototype.o9 = function (a, b, c) {
        var _this = this;
        return this.lg(a, b, c, this.ns(this.bi.bs, this.bi.br, this.getEffectiveViewport1(this.bi)), this.mm, this.l1, runOn(this, this.nu), function (d, e) { return _this.fc(d, e, _this.l1, runOn(_this, _this.nr), _this.mv); }, function (d, e) { return _this.fa(d, e, _this.l1, runOn(_this, _this.nr), _this.mv); });
    };
    FinancialSeries.prototype.o8 = function (a, b, c) {
        var _this = this;
        return this.lg(a, b, c, this.ns(this.bi.bs, this.bi.br, this.getEffectiveViewport1(this.bi)), this.mm, this.l1, runOn(this, this.nt), function (d, e) { return _this.fc(d, e, _this.l1, runOn(_this, _this.nr), _this.mp); }, function (d, e) { return _this.fa(d, e, _this.l1, runOn(_this, _this.nr), _this.mp); });
    };
    FinancialSeries.prototype.pa = function (a, b, c) {
        var _this = this;
        return this.lg(a, b, c, this.ns(this.bi.bs, this.bi.br, this.getEffectiveViewport1(this.bi)), this.mm, this.l1, runOn(this, this.nv), function (d, e) { return _this.fc(d, e, _this.l1, runOn(_this, _this.nr), _this.my); }, function (d, e) { return _this.fa(d, e, _this.l1, runOn(_this, _this.nr), _this.my); });
    };
    FinancialSeries.prototype.h4 = function () {
        _super.prototype.h4.call(this);
        if (this.l1 != null) {
            this.l1.g0(false);
        }
        if (this.mm != null) {
            this.mm.g0(false);
        }
    };
    FinancialSeries.prototype.jm = function (a, b) {
        this.mh.bu.e(this.er);
        this.i6(false);
    };
    FinancialSeries.prototype.jl = function (a, b) {
        if (this.dl && this.ew < 0.05) {
            this.dm = true;
        }
        this.mh.bu.e(this.er);
        this.i6(false);
    };
    FinancialSeries.prototype.mw = function (a, b, c) {
        var d = this.bw(b);
        this.nc.addItem(d, b);
        this.nd.addItem(b, c);
        return d;
    };
    FinancialSeries.prototype.oq = function (a, b) {
        if (b == null) {
            return;
        }
        a.deregisterColumn(b);
        var c = this.nc.item(b);
        this.nd.removeItem(c);
        this.nc.removeItem(b);
    };
    FinancialSeries.prototype.is = function (a, b, c, d) {
        _super.prototype.is.call(this, a, b, c, d);
        switch (b) {
            case "SyncLink":
                if (this.bn != null && this.bs != null) {
                    this.mh.bu.e(this.er);
                    this.i6(false);
                }
                break;
            case "SeriesViewer":
                if (c != null && d == null) {
                    if (this.l1 != null) {
                        this.l1.bv(this);
                    }
                    if (this.mm != null) {
                        this.mm.bv(this);
                    }
                }
                if (c == null && d != null) {
                    if (this.l1 != null) {
                        this.l1.ch(this);
                    }
                    if (this.mm != null) {
                        this.mm.ch(this);
                    }
                }
                this.mh.bu.e(this.er);
                this.i6(false);
                break;
            case "FastItemsSource":
                this.m0 = true;
                if (typeCast(IFastItemsSource_$type, c) != null) {
                    this.oq(typeCast(IFastItemsSource_$type, c), this.mv);
                    this.oq(typeCast(IFastItemsSource_$type, c), this.mr);
                    this.oq(typeCast(IFastItemsSource_$type, c), this.mt);
                    this.oq(typeCast(IFastItemsSource_$type, c), this.mp);
                    this.oq(typeCast(IFastItemsSource_$type, c), this.my);
                    this.mv = null;
                    this.mr = null;
                    this.mt = null;
                    this.mp = null;
                    this.my = null;
                }
                if (typeCast(IFastItemsSource_$type, d) != null) {
                    if (stringIsNullOrEmpty(this.oh) == false) {
                        this.mv = this.mw(typeCast(IFastItemsSource_$type, d), this.oh, "OpenColumn");
                    }
                    if (stringIsNullOrEmpty(this.n8) == false) {
                        this.mr = this.mw(typeCast(IFastItemsSource_$type, d), this.n8, "HighColumn");
                    }
                    if (stringIsNullOrEmpty(this.od) == false) {
                        this.mt = this.mw(typeCast(IFastItemsSource_$type, d), this.od, "LowColumn");
                    }
                    if (stringIsNullOrEmpty(this.n5) == false) {
                        this.mp = this.mw(typeCast(IFastItemsSource_$type, d), this.n5, "CloseColumn");
                    }
                    if (stringIsNullOrEmpty(this.ol) == false) {
                        this.my = this.mw(typeCast(IFastItemsSource_$type, d), this.ol, "VolumeColumn");
                    }
                }
                this.m0 = false;
                if (this.mm != null && !this.mm.ck()) {
                    this.mh.bu.e(this.er);
                    this.i6(false);
                }
                break;
            case FinancialSeries.$$p[6]:
                if (this.bz != null) {
                    this.oq(this.bz, this.mv);
                    this.mv = this.mw(this.bz, this.oh, "OpenColumn");
                }
                break;
            case "OpenColumn":
                if (this.mm != null && !this.mm.ck() && !this.m0) {
                    this.mh.bu.e(this.er);
                    this.i6(false);
                }
                break;
            case FinancialSeries.$$p[1]:
                if (this.bz != null) {
                    this.oq(this.bz, this.mr);
                    this.mr = this.mw(this.bz, this.n8, "HighColumn");
                }
                break;
            case "HighColumn":
                if (this.mm != null && !this.mm.ck() && !this.m0) {
                    this.mh.bu.e(this.er);
                    this.i6(false);
                }
                break;
            case FinancialSeries.$$p[4]:
                if (this.bz != null) {
                    this.oq(this.bz, this.mt);
                    this.mt = this.mw(this.bz, this.od, "LowColumn");
                }
                break;
            case "LowColumn":
                if (this.mm != null && !this.mm.ck() && !this.m0) {
                    this.mh.bu.e(this.er);
                    this.i6(false);
                }
                break;
            case FinancialSeries.$$p[0]:
                if (this.bz != null) {
                    this.oq(this.bz, this.mp);
                    this.mp = this.mw(this.bz, this.n5, "CloseColumn");
                }
                break;
            case "CloseColumn":
                if (this.mm != null && !this.mm.ck() && !this.m0) {
                    this.mh.bu.e(this.er);
                    this.i6(false);
                }
                this.ov();
                break;
            case FinancialSeries.$$p[8]:
                if (this.bz != null) {
                    this.oq(this.bz, this.my);
                    this.my = this.mw(this.bz, this.ol, "VolumeColumn");
                }
                break;
            case "VolumeColumn":
                if (this.mm != null && !this.mm.ck() && !this.m0) {
                    this.mh.bu.e(this.er);
                    this.i6(false);
                }
                break;
            case FinancialSeries.$$p[9]:
                if (c != null) {
                    c.bv(this);
                }
                if (d != null) {
                    d.ch(this);
                }
                this.mh.bu.e(this.er);
                this.i6(false);
                this.ic();
                this.ml = typeCast(ITimeRangeSelectorAxis_$type, this.l1);
                break;
            case FinancialSeries.$$p[10]:
                if (c != null) {
                    c.bv(this);
                }
                if (d != null) {
                    d.ch(this);
                }
                this.mh.bu.e(this.er);
                if (this.mm != null) {
                    this.mm.ck();
                }
                {
                    this.i6(false);
                }
                this.ic();
                break;
            case "TransitionProgress":
                this.l6.c(this.ew, this.l4, this.l3);
                if (this.cc(this.bi)) {
                    return;
                }
                if (this.ew == 1) {
                    this.l3.v();
                    this.ou(this.l3, this.mh);
                    if (this.dl) {
                        this.dl = false;
                        this.hq();
                        this.bt.r = truncate(this.en());
                        this.bt.b = this.bu;
                    }
                }
                else {
                    this.ou(this.l6, this.mh);
                }
                if (this.bs != null) {
                    this.bs.jj(this);
                }
                break;
            case FinancialSeries.$$p[5]:
                this.i6(false);
                break;
            case "IsCustomCategoryStyleAllowed":
                this.m1 = this.m4();
                this.i6(false);
                break;
            case "CategoryMode":
                if (this.l1 != null) {
                    this.l1.kg(true);
                }
                break;
        }
    };
    FinancialSeries.prototype.m3 = function (a) {
        if (typeCast(NumericYAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    FinancialSeries.prototype.m2 = function (a) {
        if (typeCast(CategoryXAxis.$, a) !== null || a.b5) {
            return true;
        }
        return false;
    };
    FinancialSeries.prototype.lu = function (a, b, c) {
        if (b < a || a < 0 || a > this.bz.count || b < 0 || b > this.bz.count || c == null) {
            return null;
        }
        var d = new Array((b - a) + 1);
        var e = c.cc;
        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.bz.item(g);
        }
        return d;
    };
    FinancialSeries.prototype.ny = function (a) {
        return a.bu.b;
    };
    FinancialSeries.prototype.n0 = function (a) {
        return a.bu.c;
    };
    FinancialSeries.prototype.lt = function (a, b) {
        return this.lu(a, b, this.mm);
    };
    FinancialSeries.prototype.get_m5 = function () {
        return false;
    };
    Object.defineProperty(FinancialSeries.prototype, "m5", {
        get: function () {
            return this.get_m5();
        },
        enumerable: true,
        configurable: true
    });
    FinancialSeries.prototype.get_cv = function () {
        return true;
    };
    FinancialSeries.prototype.at = function (a, b) {
        if (this.m5) {
            var c = this.mj(a, b, this.mk);
            this.mk = c;
            return c;
        }
        else {
            var d = this.mi(a, b, this.mk);
            this.mk = d;
            return d;
        }
    };
    FinancialSeries.prototype.n2 = function (a) {
        var b = this.l3;
        if (this.ca()) {
            b = this.l6;
        }
        var c = this.bi.br;
        var d = this.bi.bs;
        var e = this.l1;
        var f = 0;
        if (e.ce) {
            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.mj = function (a, b, c) {
        var d = this.bz.count;
        var e = this.mh.bu.c;
        var f = this.mh.bu.d;
        var g = this.mh.bu.b;
        var h = this.l1;
        var i = -1;
        var j = -1;
        if (h.cc) {
            var k = this.l3;
            if (this.ca()) {
                k = this.l6;
            }
            var l = this.n2(b);
            i = l;
            j = l;
        }
        else {
            var m = this.e5(b);
            i = truncate(Math.floor((intDivide(m, g)))) * g;
            j = i + (g - 1);
        }
        if (c != null && c.f == i && c.e == j) {
            return c;
        }
        var n = new HighlightingInfo();
        n.b = this;
        n.f = i;
        n.e = j;
        return n;
    };
    FinancialSeries.prototype.mi = function (a, b, c) {
        var d = new HighlightingInfo();
        d.b = this;
        d.f = 0;
        d.e = this.bz.count - 1;
        if (c != null && c.f == d.f && c.e == d.e) {
            return c;
        }
        return d;
    };
    FinancialSeries.prototype.m4 = function () {
        return this.m7;
    };
    FinancialSeries.prototype.d8 = function (a) {
        var b = this.bi.bs;
        var c = this.bi.br;
        var d = -1;
        if (!b.isEmpty && !c.isEmpty && this.l1 != null) {
            var e = this.getEffectiveViewport1(this.bi);
            var f = new ScalerParams(0, b, c, this.l1.b8, e);
            var g = this.lj(this.bi);
            var h = this.l1.dw(g.left, f);
            var i = this.l1.dw(g.right, f);
            var j = (a.x - b.left) / b.width;
            var k = h + (j * (i - h));
            if (this.l1.categoryMode != 0) {
                k -= 0.5;
            }
            d = k;
        }
        return d;
    };
    FinancialSeries.prototype.e5 = function (a) {
        return truncate(Math.round(this.d8(a)));
    };
    FinancialSeries.prototype.get_c1 = function () {
        return typeCast(ISortingAxis_$type, this.l1) !== null;
    };
    FinancialSeries.prototype.ap = function () {
        return this.l1;
    };
    FinancialSeries.prototype.e7 = function (a) {
        var b = this.bi.bs;
        var c = this.bi.br;
        var d = this.getEffectiveViewport1(this.bi);
        if (b.isEmpty || c.isEmpty) {
            return -1;
        }
        var e = new Rect(0, 0, 0, 1, 1);
        var f = new ScalerParams(0, b, c, this.l1.b8, d);
        var g = typeCast(ISortingAxis_$type, this.l1);
        var h = this.lj(this.bi);
        var i = h.left;
        var j = h.right;
        var k = this.k9(a).x;
        var l = this.l1.dw(k, f);
        var m = this.l1.dw(i, f);
        var n = this.l1.dw(j, f);
        l = Math.max(m, Math.min(n, l));
        var o = g.i$f(l);
        return o;
    };
    FinancialSeries.prototype.fm = function (a) {
        var b = 0;
        if (typeCast(ISortingAxis_$type, this.l1) !== null) {
            b = this.e7(a);
            if (b == -1) {
                return null;
            }
        }
        else {
            b = this.e5(a);
        }
        return b >= 0 && this.bz != null && b < this.bz.count ? this.bz.item(b) : null;
    };
    FinancialSeries.prototype.ns = function (a, b, c) {
        if (this.l1 == null) {
            return 0;
        }
        return this.l1.jl(a, b, c, this.fe);
    };
    FinancialSeries.prototype.db = function () {
        return this.m8;
    };
    FinancialSeries.prototype.ma = function () {
        return 11;
    };
    FinancialSeries.prototype.bo = function () {
        return 3;
    };
    FinancialSeries.prototype.ou = function (a, b) {
        this.li = a.aa;
        b.ar();
    };
    FinancialSeries.prototype.os = function (a, b) {
        a.u();
    };
    FinancialSeries.prototype.dv = function (a, b, c) {
        var d = _super.prototype.dv.call(this, a, b, c);
        var e = c;
        if (this.bz == null || this.bz.count == 0 || !c.l() || b.isEmpty || a.isEmpty || this.l1 == null || this.mm == null || e.bu.b < 1 || this.l1.bf == null || this.mm.bf == null || this.mm.jx == this.mm.jw || this.l1.itemsSource == null || this.l1.jr < 1) {
            e.bu.b = 0;
            d = false;
        }
        return d;
    };
    FinancialSeries.prototype.getViewInfo = function (a, b) {
        b = this.bi.bs;
        a = this.bi.br;
        return {
            p0: a,
            p1: b
        };
    };
    FinancialSeries.prototype.nw = function (a) {
        var b = 0;
        var c = a.bs;
        var d = a.br;
        var e = this.getEffectiveViewport1(this.bi);
        if (!c.isEmpty && !d.isEmpty && this.mm != null) {
            var f = new ScalerParams(0, c, d, this.mm.b8, e);
            f.b = this.ee();
            b = this.mm.dt(this.mm.j7, f);
        }
        return b;
    };
    FinancialSeries.prototype.hq = function () {
        _super.prototype.hq.call(this);
        this.l4.v();
        this.l3.v();
        this.l6.v();
    };
    FinancialSeries.prototype.i7 = function (a) {
        var _this = this;
        _super.prototype.i7.call(this, a);
        this.mh.bu.e(this.er);
        if (this.cc(this.bi)) {
            return;
        }
        if (this.dd) {
            if (this.ca()) {
                this.ou(this.l6, this.mh);
            }
            else {
                this.ou(this.l3, this.mh);
            }
            return;
        }
        if (this.c9(a)) {
            var b = this.l4;
            if (this.ca()) {
                if (this.bt.g) {
                    this.bt.t();
                }
                this.l4 = this.l6;
                this.l6 = b;
            }
            else {
                this.l4 = this.l3;
                this.l3 = b;
            }
            this.os(this.l3, this.mh);
            if (this.dn) {
                this.bt.w();
                this.bt.r = truncate(this.eo());
                this.bt.b = this.bv != null ? this.bv : this.bu;
                this.mc.p(this.l4, this.l3, this.isVertical, this.l1, this.mm, this.mb, this.ma(), this.bp, this.bo(), function () { return _this.nw(_this.mh); }, this.mh.br);
            }
            this.hm();
            this.je();
            if (this.dn) {
                this.dm = false;
                this.dl = true;
            }
        }
        else {
            this.os(this.l3, this.mh);
            this.ou(this.l3, this.mh);
        }
    };
    FinancialSeries.prototype.na = function (a) {
        var e_1, _a;
        try {
            for (var _b = tslib_1.__values(fromEnum(a)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var b = _c.value;
                switch (b) {
                    case "HighColumn":
                        if (this.mr == null) {
                            return false;
                        }
                        break;
                    case "LowColumn":
                        if (this.mt == null) {
                            return false;
                        }
                        break;
                    case "OpenColumn":
                        if (this.mv == null) {
                            return false;
                        }
                        break;
                    case "CloseColumn":
                        if (this.mp == null) {
                            return false;
                        }
                        break;
                    case "VolumeColumn":
                        if (this.my == 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, "nb", {
        get: function () {
            return this.l1 != null && typeCast(ISortingAxis_$type, this.l1) !== null;
        },
        enumerable: true,
        configurable: true
    });
    FinancialSeries.prototype.m6 = function () {
        return this.typical != null;
    };
    FinancialSeries.prototype.op = function (a) {
        this.typical(this, a);
    };
    Object.defineProperty(FinancialSeries.prototype, "nj", {
        get: function () {
            return this.ng();
        },
        enumerable: true,
        configurable: true
    });
    FinancialSeries.prototype._ng = function () {
        var e_2, _a, a, b, _b, _c, c, e_2_1, d, e, f, g, h;
        return tslib_1.__generator(this, function (_d) {
            switch (_d.label) {
                case 0:
                    a = false;
                    if (!this.m6()) return [3 /*break*/, 8];
                    b = this.md(0, this.bz.count);
                    this.op(new FinancialEventArgs(0, this.bz.count, b, this.me(b), this));
                    if (!(b.typicalColumn != null)) return [3 /*break*/, 8];
                    a = true;
                    _d.label = 1;
                case 1:
                    _d.trys.push([1, 6, 7, 8]);
                    _b = tslib_1.__values(fromEnum(b.typicalColumn)), _c = _b.next();
                    _d.label = 2;
                case 2:
                    if (!!_c.done) return [3 /*break*/, 5];
                    c = _c.value;
                    return [4 /*yield*/, c];
                case 3:
                    _d.sent();
                    _d.label = 4;
                case 4:
                    _c = _b.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 (_c && !_c.done && (_a = _b.return)) _a.call(_b);
                    }
                    finally { if (e_2) throw e_2.error; }
                    return [7 /*endfinally*/];
                case 8:
                    if (!!a) return [3 /*break*/, 17];
                    if (!(this.nb && this.l1.i$b != null)) return [3 /*break*/, 13];
                    d = this.bz.count;
                    e = this.l1.i$b;
                    f = 0;
                    _d.label = 9;
                case 9:
                    if (!(f < d)) return [3 /*break*/, 12];
                    return [4 /*yield*/, (this.mr.item(e.item(f)) + this.mt.item(e.item(f)) + this.mp.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.bz.count;
                    h = 0;
                    _d.label = 14;
                case 14:
                    if (!(h < g)) return [3 /*break*/, 17];
                    return [4 /*yield*/, (this.mr.item(h) + this.mt.item(h) + this.mp.item(h)) / 3];
                case 15:
                    _d.sent();
                    _d.label = 16;
                case 16:
                    ++h;
                    return [3 /*break*/, 14];
                case 17: return [2 /*return*/];
            }
        });
    };
    FinancialSeries.prototype.ng = function () {
        var _this = this;
        return toEnum(function () { return _this._ng(); });
    };
    Object.defineProperty(FinancialSeries.prototype, "ni", {
        get: function () {
            return this.nf();
        },
        enumerable: true,
        configurable: true
    });
    FinancialSeries.prototype._nf = function () {
        var a, b, c, d, e;
        return tslib_1.__generator(this, function (_a) {
            switch (_a.label) {
                case 0:
                    if (!(this.nb && this.l1.i$b != null)) return [3 /*break*/, 7];
                    a = this.mr.count;
                    b = this.l1.i$b;
                    if (!(a > 0)) return [3 /*break*/, 2];
                    return [4 /*yield*/, this.nx(this.mr.item(b.item(0)) - this.mt.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.nx(this.mr.item(b.item(c)) - this.mt.item(b.item(c))), Math.max(this.nx(Math.abs(this.mr.item(b.item(c)) - this.mp.item(b.item(c - 1)))), this.nx(Math.abs(this.mt.item(b.item(c)) - this.mp.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.mr.count;
                    if (!(d > 0)) return [3 /*break*/, 9];
                    return [4 /*yield*/, this.nx(this.mr.item(0) - this.mt.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.nx(this.mr.item(e) - this.mt.item(e)), Math.max(this.nx(Math.abs(this.mr.item(e) - this.mp.item(e - 1))), this.nx(Math.abs(this.mt.item(e) - this.mp.item(e - 1)))))];
                case 11:
                    _a.sent();
                    _a.label = 12;
                case 12:
                    ++e;
                    return [3 /*break*/, 10];
                case 13: return [2 /*return*/];
            }
        });
    };
    FinancialSeries.prototype.nf = function () {
        var _this = this;
        return toEnum(function () { return _this._nf(); });
    };
    Object.defineProperty(FinancialSeries.prototype, "nh", {
        get: function () {
            return this.ne();
        },
        enumerable: true,
        configurable: true
    });
    FinancialSeries.prototype._ne = function () {
        var a, b, c, d, e;
        return tslib_1.__generator(this, function (_a) {
            switch (_a.label) {
                case 0:
                    if (!(this.nb && this.l1.i$b != null)) return [3 /*break*/, 7];
                    a = this.mt.count;
                    b = this.l1.i$b;
                    if (!(a > 0)) return [3 /*break*/, 2];
                    return [4 /*yield*/, this.nx(this.mt.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.nx(this.mt.item(b.item(c))), this.nx(this.mp.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.mt.count;
                    if (!(d > 0)) return [3 /*break*/, 9];
                    return [4 /*yield*/, this.nx(this.mt.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.nx(this.mt.item(e)), this.nx(this.mp.item(e - 1)))];
                case 11:
                    _a.sent();
                    _a.label = 12;
                case 12:
                    e++;
                    return [3 /*break*/, 10];
                case 13: return [2 /*return*/];
            }
        });
    };
    FinancialSeries.prototype.ne = function () {
        var _this = this;
        return toEnum(function () { return _this._ne(); });
    };
    FinancialSeries.prototype.nl = function (a) {
        if (a == null) {
            return null;
        }
        if (this.nb && this.l1.i$b != null) {
            return new SafeSortedReadOnlyDoubleCollection(0, a, this.l1.i$b);
        }
        return new SafeReadOnlyDoubleCollection(0, a);
    };
    FinancialSeries.prototype.nk = function () {
        var a = new List$1(String_$type, 0);
        a.add("HighColumn");
        a.add("LowColumn");
        a.add("CloseColumn");
        if (this.typicalBasedOn != null && this.bz != null && !this.mz) {
            this.mz = true;
            var b = this.md(0, this.bz.count);
            this.mz = false;
            var c = new FinancialEventArgs(0, this.bz.count, b, this.me(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.mv == null) {
            return null;
        }
        if (this.l1 != null && typeCast(ISortingAxis_$type, this.l1) !== null) {
            if (this.np != null) {
                return this.np.asArray();
            }
            var a = new List$1(Number_$type, 2, this.mv.count);
            var b = this.l1.i$b;
            var c = this.mv.asArray();
            for (var d = 0; d < b.count; d++) {
                a.add(c[b._inner[d]]);
            }
            this.np = a;
            return this.np.asArray();
        }
        else {
            return this.mv.asArray();
        }
    };
    FinancialSeries.prototype.getHighColumnAsArray = function () {
        if (this.mr == null) {
            return null;
        }
        if (this.l1 != null && typeCast(ISortingAxis_$type, this.l1) !== null) {
            if (this.nn != null) {
                return this.nn.asArray();
            }
            var a = new List$1(Number_$type, 2, this.mr.count);
            var b = this.l1.i$b;
            var c = this.mr.asArray();
            for (var d = 0; d < b.count; d++) {
                a.add(c[b._inner[d]]);
            }
            this.nn = a;
            return this.nn.asArray();
        }
        else {
            return this.mr.asArray();
        }
    };
    FinancialSeries.prototype.getLowColumnAsArray = function () {
        if (this.mt == null) {
            return null;
        }
        if (this.l1 != null && typeCast(ISortingAxis_$type, this.l1) !== null) {
            if (this.no != null) {
                return this.no.asArray();
            }
            var a = new List$1(Number_$type, 2, this.mt.count);
            var b = this.l1.i$b;
            var c = this.mt.asArray();
            for (var d = 0; d < b.count; d++) {
                a.add(c[b._inner[d]]);
            }
            this.no = a;
            return this.no.asArray();
        }
        else {
            return this.mt.asArray();
        }
    };
    FinancialSeries.prototype.getCloseColumnAsArray = function () {
        if (this.mp == null) {
            return null;
        }
        if (this.l1 != null && typeCast(ISortingAxis_$type, this.l1) !== null) {
            if (this.nm != null) {
                return this.nm.asArray();
            }
            var a = new List$1(Number_$type, 2, this.mp.count);
            var b = this.l1.i$b;
            var c = this.mp.asArray();
            for (var d = 0; d < b.count; d++) {
                a.add(c[b._inner[d]]);
            }
            this.nm = a;
            return this.nm.asArray();
        }
        else {
            return this.mp.asArray();
        }
    };
    FinancialSeries.prototype.getVolumeColumnAsArray = function () {
        if (this.my == null) {
            return null;
        }
        if (this.l1 != null && typeCast(ISortingAxis_$type, this.l1) !== null) {
            if (this.nq != null) {
                return this.nq.asArray();
            }
            var a = new List$1(Number_$type, 2, this.my.count);
            var b = this.l1.i$b;
            var c = this.my.asArray();
            for (var d = 0; d < b.count; d++) {
                a.add(c[b._inner[d]]);
            }
            this.nq = a;
            return this.nq.asArray();
        }
        else {
            return this.my.asArray();
        }
    };
    FinancialSeries.prototype.hs = function (a, b, c, d) {
        _super.prototype.hs.call(this, a, b, c, d);
        if (this.l1 == null || !(typeCast(ISortingAxis_$type, this.l1) !== null)) {
            return;
        }
        var e = this.l1.i$b;
        switch (a) {
            case 1:
                for (var f = b; f < c; f++) {
                    var g = e._inner[f];
                    if (this.np != null) {
                        this.np.insert(f, this.mv.item(g));
                    }
                    if (this.nn != null) {
                        this.nn.insert(f, this.mr.item(g));
                    }
                    if (this.no != null) {
                        this.no.insert(f, this.mt.item(g));
                    }
                    if (this.nm != null) {
                        this.nm.insert(f, this.mp.item(g));
                    }
                    if (this.nq != null) {
                        this.nq.insert(f, this.my.item(g));
                    }
                }
                break;
            case 0:
                if (this.np != null) {
                    this.np.v(b, c);
                }
                if (this.nn != null) {
                    this.nn.v(b, c);
                }
                if (this.no != null) {
                    this.no.v(b, c);
                }
                if (this.nm != null) {
                    this.nm.v(b, c);
                }
                if (this.nq != null) {
                    this.nq.v(b, c);
                }
                break;
            case 4:
                if (this.np != null) {
                    this.np = new List$1(Number_$type, 0);
                }
                if (this.nn != null) {
                    this.nn = new List$1(Number_$type, 0);
                }
                if (this.no != null) {
                    this.no = new List$1(Number_$type, 0);
                }
                if (this.nm != null) {
                    this.nm = new List$1(Number_$type, 0);
                }
                if (this.nq != null) {
                    this.nq = 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.np != null) {
                        this.np._inner[h] = this.mv.item(i);
                    }
                    if (this.nn != null) {
                        this.nn._inner[h] = this.mr.item(i);
                    }
                    if (this.no != null) {
                        this.no._inner[h] = this.mt.item(i);
                    }
                    if (this.nm != null) {
                        this.nm._inner[h] = this.mp.item(i);
                    }
                    if (this.nq != null) {
                        this.nq._inner[h] = this.my.item(i);
                    }
                }
                break;
        }
        this.ov();
        this.jj();
    };
    FinancialSeries.prototype.md = function (a, b) {
        var _this = this;
        var c = this.nl(this.mv);
        var d = this.nl(this.mp);
        var e = this.nl(this.mr);
        var f = this.nl(this.mt);
        var g = this.nl(this.my);
        var h = ((function () {
            var $ret = new FinancialCalculationDataSource();
            $ret.typicalColumn = new CalculatedColumn(1, new SafeEnumerable(_this.nj), _this.nk());
            $ret.trueRange = new CalculatedColumn(1, new SafeEnumerable(_this.ni), ((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.nh), ((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.bz != null ? _this.bz.count : 0;
            return $ret;
        })());
        return h;
    };
    FinancialSeries.prototype.nx = function (a) {
        if (isInfinity(a) || isNaN_(a)) {
            return 0;
        }
        return a;
    };
    FinancialSeries.prototype.me = 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.dy;
            $ret.j = Series.dx;
            $ret.i = runOn(_this, _this.nx);
            return $ret;
        })());
    };
    Object.defineProperty(FinancialSeries.prototype, "categoryAxis", {
        get: function () {
            return this.l1;
        },
        enumerable: true,
        configurable: true
    });
    FinancialSeries.prototype.i8 = function (a, b) {
        _super.prototype.i8.call(this, a, b);
        if (!this.dk) {
            this.bi.az(b);
            return;
        }
        var c = typeCast(FinancialSeriesView.$, this.bh);
        this.bi.az(b);
        c.bu.e(this.er);
        if (this.cc(this.bh)) {
            return;
        }
        if (!this.de) {
            this.os(this.l5, c);
        }
        this.de = false;
        this.ou(this.l5, c);
        this.dk = false;
    };
    FinancialSeries.prototype.i5 = function (a, b, c, d, e) {
        _super.prototype.i5.call(this, a, b, c, d, e);
        var f = this.a0.a$h.item(d);
        var g = f;
        g.bu.e(this.er);
        f.ay(c);
        if (this.cc(g)) {
            return;
        }
        if (this.l2 == null) {
            this.l2 = new CategoryFrame(3);
        }
        this.l2.u();
        this.os(this.l2, g);
        this.ou(this.l2, g);
    };
    FinancialSeries.prototype.am = function (a) {
        if (this.l1 == a) {
            return this.mm;
        }
        if (this.mm == a) {
            return this.l1;
        }
        return null;
    };
    FinancialSeries.prototype.preferredCategoryMode = function (a) {
        var b = typeCast(IDateTimeAxis_$type, this.l1);
        return b != null ? b.preferredCategoryMode(this) : this.l8;
    };
    Object.defineProperty(FinancialSeries.prototype, "l8", {
        get: function () {
            return this.l7;
        },
        set: function (a) {
            var b = this.l8;
            if (a != b) {
                this.l7 = a;
                this.raisePropertyChanged("CategoryMode", enumGetBox(CategoryMode_$type, b), enumGetBox(CategoryMode_$type, this.l8));
            }
        },
        enumerable: true,
        configurable: true
    });
    FinancialSeries.prototype.get_cz = function () {
        return true;
    };
    FinancialSeries.prototype.jb = function (a, b) {
        _super.prototype.jb.call(this, a, b);
        this.o7 = a;
    };
    FinancialSeries.prototype.ov = function () {
        this.d5 = this.mp == null || this.mp.count == 0 ? NaN : this.mp.item(this.mp.count - 1);
    };
    FinancialSeries.prototype.fo = function (a) {
        if (this.ml != null && a != null) {
            if (this.mn == null || this.mn.f != this.ml.dateTimeMemberPath) {
                this.mn = new FastReflectionHelper(false, this.ml.dateTimeMemberPath);
            }
            var b = this.mn.d(a);
            if (typeCast(Date_$type, b) !== null) {
                return dateToStringFormat(b, this.ml.itemLabelFormat());
            }
        }
        return _super.prototype.fo.call(this, a);
    };
    FinancialSeries.$t = markType(FinancialSeries, 'FinancialSeries', Series.$, [IHasCategoryAxis_$type, IHasCategoryModePreference_$type]);
    return FinancialSeries;
}(Series));
export { FinancialSeries };
Type.dep(DependencyProperty, PropertyMetadata, FinancialSeries, 'raisePropertyChanged', ['CloseMemberPath:n5:ow', [2, null], 'HighMemberPath:n8:ox', [2, null], 'IsCustomCategoryStyleAllowed:m7:oy', [0, false], 'IsTransitionInEnabled:m8:oz', [0, false], 'LowMemberPath:od:o0', [2, null], 'NegativeBrush:o7:o1', [Brush.$, null], 'OpenMemberPath:oh:o2', [2, null], 'TransitionInMode:mb:o3', [CategoryTransitionInMode_$type, enumGetBox(CategoryTransitionInMode_$type, 0)], 'VolumeMemberPath:ol:o4', [2, null], 'XAxis:l1:o5', [CategoryAxisBase.$, null], 'YAxis:mm:o6', [NumericYAxis.$, null]]);
/**
 * @hidden
 */
var FinancialCalculationSupportingCalculations = /** @class */ (function (_super) {
    tslib_1.__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 */ (function (_super) {
    tslib_1.__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 */ (function (_super) {
    tslib_1.__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: true,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "closeColumn", {
        get: function () {
            return this._closeColumn;
        },
        set: function (a) {
            this._closeColumn = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "highColumn", {
        get: function () {
            return this._highColumn;
        },
        set: function (a) {
            this._highColumn = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "lowColumn", {
        get: function () {
            return this._lowColumn;
        },
        set: function (a) {
            this._lowColumn = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "volumeColumn", {
        get: function () {
            return this._volumeColumn;
        },
        set: function (a) {
            this._volumeColumn = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "indicatorColumn", {
        get: function () {
            return this._indicatorColumn;
        },
        set: function (a) {
            this._indicatorColumn = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "typicalColumn", {
        get: function () {
            return this._typicalColumn;
        },
        set: function (a) {
            this._typicalColumn = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "trueRange", {
        get: function () {
            return this._trueRange;
        },
        set: function (a) {
            this._trueRange = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "trueLow", {
        get: function () {
            return this._trueLow;
        },
        set: function (a) {
            this._trueLow = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "period", {
        get: function () {
            return this._period;
        },
        set: function (a) {
            this._period = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "shortPeriod", {
        get: function () {
            return this._shortPeriod;
        },
        set: function (a) {
            this._shortPeriod = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "longPeriod", {
        get: function () {
            return this._longPeriod;
        },
        set: function (a) {
            this._longPeriod = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "count", {
        get: function () {
            return this._count;
        },
        set: function (a) {
            this._count = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "calculateFrom", {
        get: function () {
            return this._calculateFrom;
        },
        set: function (a) {
            this._calculateFrom = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "calculateCount", {
        get: function () {
            return this._calculateCount;
        },
        set: function (a) {
            this._calculateCount = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "multiplier", {
        get: function () {
            return this._multiplier;
        },
        set: function (a) {
            this._multiplier = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "minimumValue", {
        get: function () {
            return this._minimumValue;
        },
        set: function (a) {
            this._minimumValue = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "maximumValue", {
        get: function () {
            return this._maximumValue;
        },
        set: function (a) {
            this._maximumValue = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "specifiesRange", {
        get: function () {
            return this._specifiesRange;
        },
        set: function (a) {
            this._specifiesRange = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "series", {
        get: function () {
            return this._series;
        },
        set: function (a) {
            this._series = a;
        },
        enumerable: true,
        configurable: true
    });
    FinancialCalculationDataSource.$t = markType(FinancialCalculationDataSource, 'FinancialCalculationDataSource');
    return FinancialCalculationDataSource;
}(Base));
export { FinancialCalculationDataSource };
/**
 * @hidden
 */
var FinancialSeriesView = /** @class */ (function (_super) {
    tslib_1.__extends(FinancialSeriesView, _super);
    function FinancialSeriesView(a) {
        var _this = _super.call(this, a) || this;
        _this.bw = null;
        _this.bu = null;
        _this.by = 0;
        _this.by = -1;
        _this.bw = a;
        _this.bu = _this.bv();
        return _this;
    }
    FinancialSeriesView.prototype.bx = function (a) {
        if (this.by != a.t) {
            return true;
        }
        return false;
    };
    FinancialSeriesView.prototype.bz = function (a) {
        this.by = a.t;
    };
    FinancialSeriesView.prototype.ap = function () {
        _super.prototype.ap.call(this);
        if (!this.n) {
            this.e.bj = 6;
        }
    };
    FinancialSeriesView.prototype.getDefaultTooltipTemplate = function () {
        var a = "<div class='ui-chart-default-tooltip-content'>";
        if (this.bw.l1.b5) {
            a += "<span>${itemLabel}</span><br/>";
        }
        else if (this.bw.l1.e2 != null) {
            a += "<span>${item." + this.bw.l1.e2 + "}</span><br/>";
        }
        a += "<span class='ui-priority-primary'";
        var b = this.e.a0.a$q(this.e);
        if (!stringIsNullOrEmpty(b)) {
            a += " style='color:" + b + "'";
        }
        var c = new SRProvider(this.t);
        var d = c.al("financialSeries_Open");
        var e = c.al("financialSeries_High");
        var f = c.al("financialSeries_Low");
        var g = c.al("financialSeries_Close");
        d = stringIsNullOrEmpty(d) ? "Open" : d;
        e = stringIsNullOrEmpty(e) ? "High" : e;
        f = stringIsNullOrEmpty(f) ? "Low" : f;
        g = stringIsNullOrEmpty(g) ? "Close" : g;
        a += ">" + this.bw.fs + "</span><table><tr><td>" + d + ":</td><td>" + "${item." + this.bw.oh + "}</td></tr><tr><td>" + e + ":</td><td>" + "${item." + this.bw.n8 + "}</td></tr><tr><td>" + f + ":</td><td>" + "${item." + this.bw.od + "}</td></tr><tr><td>" + g + ":</td><td>" + "${item." + this.bw.n5 + "}</td></tr>";
        if (!stringIsNullOrEmpty(this.bw.ol)) {
            var h = c.al("financialSeries_Volume");
            h = stringIsNullOrEmpty(h) ? "Volume" : h;
            a += "<tr><td>" + h + ":</td><td>" + "${item." + this.bw.ol + "}</td></tr>";
        }
        a += "</table></div>";
        return a;
    };
    FinancialSeriesView.prototype.ac = function () {
        var a = new Color();
        a.colorString = "rgba(95,95,95,0.5)";
        this.e.k3 = a;
        this.e.es = 5;
        this.e.et = 2;
        this.e.eu = 2;
    };
    FinancialSeriesView.$t = markType(FinancialSeriesView, 'FinancialSeriesView', SeriesView.$);
    return FinancialSeriesView;
}(SeriesView));
export { FinancialSeriesView };
