/*
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 { FinancialSeries } from "./FinancialSeries";
import { ITrendLineSeries_$type } from "./ITrendLineSeries";
import { IndicatorDisplayType_$type } from "./IndicatorDisplayType";
import { DependencyProperty } from "igniteui-angular-core/ES5/DependencyProperty";
import { TrendLineType_$type } from "igniteui-angular-core/ES5/TrendLineType";
import { Brush } from "igniteui-angular-core/ES5/Brush";
import { PenLineCap_$type } from "igniteui-angular-core/ES5/PenLineCap";
import { DoubleCollection } from "igniteui-angular-core/ES5/DoubleCollection";
import { List$1 } from "igniteui-angular-core/ES5/List$1";
import { AxisRange } from "./AxisRange";
import { CategoryFrame } from "./CategoryFrame";
import { Type, Number_$type, typeCast, enumGetBox, EnumUtil, runOn, markType } from "igniteui-angular-core/ES5/type";
import { Rect } from "igniteui-angular-core/ES5/Rect";
import { ScalerParams } from "./ScalerParams";
import { ISortingAxis_$type } from "./ISortingAxis";
import { CategoryTrendLineManagerFactory } from "./CategoryTrendLineManagerFactory";
import { FinancialSeriesView } from "./FinancialSeriesView";
import { FinancialBucketCalculator } from "./FinancialBucketCalculator";
import { TrendResolutionParams } from "./TrendResolutionParams";
import { CategorySeries } from "./CategorySeries";
import { NotImplementedException } from "igniteui-angular-core/ES5/NotImplementedException";
import { Path } from "igniteui-angular-core/ES5/Path";
import { PropertyMetadata } from "igniteui-angular-core/ES5/PropertyMetadata";
import { isNaN_ } from "igniteui-angular-core/ES5/number";
import { PathGeometry } from "igniteui-angular-core/ES5/PathGeometry";
import { GeometryGroup } from "igniteui-angular-core/ES5/GeometryGroup";
import { Pool$1 } from "igniteui-angular-core/ES5/Pool$1";
import { LineGeometry } from "igniteui-angular-core/ES5/LineGeometry";
import { Extensions } from "igniteui-angular-core/ES5/Extensions";
import { IndicatorRenderer } from "./IndicatorRenderer";
/**
 * @hidden
 */
var FinancialIndicator = /** @class */ (function (_super) {
    tslib_1.__extends(FinancialIndicator, _super);
    function FinancialIndicator() {
        var _this = _super.call(this) || this;
        _this._indicatorColumn = null;
        _this.ph = null;
        _this.ma = new CategoryFrame(3);
        _this.mc = new CategoryFrame(3);
        _this.l9 = new CategoryFrame(3);
        _this.indicatorColumn = new List$1(Number_$type, 0);
        _this.ph = new AxisRange(-100, 100);
        return _this;
    }
    FinancialIndicator.prototype.bf = function () {
        return new FinancialIndicatorView(this);
    };
    FinancialIndicator.prototype.it = function (a) {
        _super.prototype.it.call(this, a);
        this.pi = a;
    };
    FinancialIndicator.prototype.pu = function (a) {
        if (this.ms != null && !this.ms.ck()) {
            this.jc(true);
        }
    };
    FinancialIndicator.prototype.pm = function (a, b, c) {
        if (isNaN_(b.x) || isNaN_(b.y)) {
            return false;
        }
        var d = this.ms;
        var e = 0;
        if (d != null) {
            e = d.ea(d.kd);
        }
        if ((a.y >= e && a.y <= b.y) || (a.y <= e && a.y >= b.y)) {
            return true;
        }
        return false;
    };
    FinancialIndicator.prototype.bd = function () {
        if (this.be == 0) {
            return 1;
        }
        else {
            return _super.prototype.bd.call(this);
        }
    };
    FinancialIndicator.prototype.lt = function (a) {
        if (this.l7 == null || this.ms == null) {
            return Rect.empty;
        }
        var b = this.lf(a);
        var c = this.bi.bs;
        var d = this.bi.br;
        var e = this.getEffectiveViewport1(this.bi);
        var f = new ScalerParams(0, c, d, this.ms.b8, e);
        f.b = this.eh();
        var g = this.aj(this.l7, this.l9.f, this.n4(this.bi), this.n6(this.bi), a, true);
        if (g == null) {
            return Rect.empty;
        }
        var h = g[0];
        var i = g[1];
        var j = Math.abs(b.x - h[0]);
        var k = Math.abs(b.x - i[0]);
        var l = this.ms.dv(this.ms.kd, f);
        var m = 1;
        if (j < k) {
            var n = h[0] - 0.5 * m;
            var o = h[1];
            var p = l;
            return new Rect(0, n, Math.min(o, p), m, Math.max(o, p) - Math.min(o, p));
        }
        else {
            var q = i[0] - 0.5 * m;
            var r = i[1];
            var s = l;
            return new Rect(0, q, Math.min(r, s), m, Math.max(r, s) - Math.min(r, s));
        }
    };
    FinancialIndicator.prototype.dh = function (a, b) {
        var c = this.lk(this.ln(a), true, false);
        if (this.pj == 1) {
            if (this.pm(a, c, b)) {
                return true;
            }
        }
        if (this.pj == 1 || this.pj == 0) {
            if (this.dg(a, b)) {
                return true;
            }
        }
        if (this.pj == 2) {
            if (this.dk(a, b)) {
                return true;
            }
        }
        return false;
    };
    FinancialIndicator.prototype.hy = function (a, b, c, d) {
        _super.prototype.hy.call(this, a, b, c, d);
        if (this.l7 != null && typeCast(ISortingAxis_$type, this.l7) !== null) {
            this.l7.i$i();
        }
        if (this.pi.b4) {
            this.pi.b2.g$e(a, b, c, d);
        }
        if (d != null && this.nj.containsKey(d)) {
            var e = this.nj.tryGetValue(d, d);
            d = e.p1;
        }
        if (this.l7 != null && typeCast(ISortingAxis_$type, this.l7) !== null) {
            a = 4;
            b = 0;
            c = this.bz.count;
        }
        switch (a) {
            case 3:
                if (this.pl(b, c, d)) {
                    this.pw(b, c, d);
                    this.pu(true);
                }
                break;
            case 2:
                if (this.pl(b, this.bz.count - b, d)) {
                    this.pw(b, this.bz.count - b, d);
                    this.pu(true);
                }
                break;
            case 1:
                if (this.pl(b, this.bz.count - b, d)) {
                    var f = new Array(c);
                    for (var g = 0; g < c; g++) {
                        f[g] = 0;
                    }
                    this.indicatorColumn.s(b, f);
                    this.pw(b, this.bz.count - b, d);
                    this.pu(true);
                }
                break;
            case 0:
                if (this.pl(b, this.bz.count - b, d)) {
                    this.indicatorColumn.v(b, c);
                    this.pw(b, this.bz.count - b, d);
                    this.pu(true);
                }
                break;
            case 4:
                if (this.pl(b, this.bz.count - b, d)) {
                    this.indicatorColumn = new List$1(Number_$type, 2, this.bz.count);
                    var h = new Array(c);
                    for (var i = 0; i < c; i++) {
                        h[i] = 0;
                    }
                    this.indicatorColumn.s(0, h);
                    this.pw(b, this.bz.count - b, d);
                    this.pu(true);
                }
                break;
        }
    };
    Object.defineProperty(FinancialIndicator.prototype, "p7", {
        get: function () {
            return this.c(FinancialIndicator.px);
        },
        set: function (a) {
            this.h(FinancialIndicator.px, a);
        },
        enumerable: true,
        configurable: true
    });
    FinancialIndicator.prototype.pr = function () {
        return -1;
    };
    Object.defineProperty(FinancialIndicator.prototype, "indicatorColumn", {
        get: function () {
            return this._indicatorColumn;
        },
        set: function (a) {
            this._indicatorColumn = a;
        },
        enumerable: true,
        configurable: true
    });
    FinancialIndicator.prototype.iy = function (a, b, c, d) {
        switch (b) {
            case "XAxis":
                this.pi.ca();
                break;
            case "TrendLineType":
                var e = EnumUtil.getEnumValue(TrendLineType_$type, d);
                if (e != 0) {
                    this.pi.b2 = CategoryTrendLineManagerFactory.a(this.pi.b2, this.l7, this.jw, this, this.b2);
                }
                break;
        }
        _super.prototype.iy.call(this, a, b, c, d);
        if (this.pi.b4 && this.pi.b2.g$b(a, b, c, d)) {
            this.jc(false);
            var f = typeCast(FinancialIndicatorView.$, this.bh);
            if (f != null && f.b4) {
                f.b2.g$b(a, b, c, d);
            }
            this.ij();
        }
        switch (b) {
            case "FastItemsSource":
                if (this.bz != null) {
                    this.indicatorColumn = new List$1(Number_$type, 2, this.bz.count);
                    var g = new Array(this.bz.count);
                    for (var h = 0; h < this.bz.count; h++) {
                        g[h] = 0;
                    }
                    this.indicatorColumn.s(0, g);
                    this.pw(0, this.bz.count, null);
                    if (this.ms != null && !this.ms.ck()) {
                        this.mn.bu.e(this.eu);
                        this.jc(false);
                    }
                }
                break;
            case "TrendLineBrush":
                this.jn();
                break;
            case FinancialIndicator.$$p[0]:
                this.hv(true, this.bi);
                this.jc(false);
                this.ij();
                break;
            case "OpenColumn":
            case "HighColumn":
            case "LowColumn":
            case "CloseColumn":
            case "VolumeColumn":
                if (this.bz != null) {
                    if (this.indicatorColumn.count != this.bz.count) {
                        this.indicatorColumn = new List$1(Number_$type, 2, this.bz.count);
                        var i = new Array(this.bz.count);
                        for (var j = 0; j < this.bz.count; j++) {
                            i[j] = 0;
                        }
                        this.indicatorColumn.s(0, i);
                    }
                    if (this.pl(0, this.bz.count - 1, b)) {
                        this.pv();
                    }
                }
                break;
            case "XAxis":
                if (this.l7 != null && (typeCast(ISortingAxis_$type, this.l7) !== null || typeCast(ISortingAxis_$type, c) !== null)) {
                    this.pv();
                }
                break;
            case "YAxis":
            case FinancialIndicator.$$p[1]:
                this.pv();
                this.ij();
                break;
            case "TrendLineType":
                this.ij();
                break;
        }
    };
    FinancialIndicator.prototype.en = function (a, b, c) {
        if (this.indicatorColumn == null) {
            return _super.prototype.en.call(this, a, b, c);
        }
        var d = this.getEffectiveViewport1(this.bi);
        var e = this.ny(this.bi.bs, this.bi.br, d);
        var f = new ScalerParams(0, this.bi.bs, this.bi.br, this.l7.b8, d);
        f.c = this.bs.m3;
        return this.ep(this.indicatorColumn, a, this.l7, f, e, runOn(this, this.nx), b, c);
    };
    FinancialIndicator.prototype.fe = function (a, b) {
        if (this.indicatorColumn == null) {
            return _super.prototype.fe.call(this, a, b);
        }
        return this.ff(a, b, this.l7, runOn(this, this.nx), this.indicatorColumn);
    };
    FinancialIndicator.prototype.fc = function (a, b) {
        if (this.indicatorColumn == null) {
            return _super.prototype.fc.call(this, a, b);
        }
        return this.fd(a, b, this.l7, runOn(this, this.nx), this.indicatorColumn);
    };
    FinancialIndicator.prototype.get_dv = function () {
        return true;
    };
    FinancialIndicator.prototype.pl = function (a, b, c) {
        if (c == null) {
            return true;
        }
        if (this.pn(a, b).contains(c)) {
            return true;
        }
        return false;
    };
    FinancialIndicator.prototype.pw = function (a, b, c) {
        this.pk(a, b);
    };
    FinancialIndicator.prototype.an = function (a) {
        if (this.bz == null) {
            return null;
        }
        if (a != null && a == this.ms) {
            return this.ph;
        }
        return null;
    };
    FinancialIndicator.prototype.c9 = function (a) {
        var b = this.bz != null ? this.bz.indexOf(a) : -1;
        var c = this.bi.bs;
        c = c.copy();
        var d = this.bi.br;
        var e = new Rect(0, 0, 0, 1, 1);
        var f = this.lr(this.bi);
        if (b >= 0 && Rect.l_op_Inequality(c, null) && Rect.l_op_Inequality(d, null)) {
            if (this.l7 != null) {
                var g = new ScalerParams(0, e, e, this.l7.b8, f);
                var h = this.l7.dv(b, g);
                if (h < c.left + 0.1 * c.width) {
                    h = h + 0.4 * c.width;
                }
                if (h > c.right - 0.1 * c.width) {
                    h = h - 0.4 * c.width;
                }
                c.x = h - 0.5 * c.width;
            }
            if (this.ms != null && this.indicatorColumn != null && b < this.indicatorColumn.count) {
                var i = new ScalerParams(0, e, e, this.ms.b8, f);
                i.b = this.eh();
                var j = this.ms.dv(this.indicatorColumn._inner[b], i);
                if (j < c.top + 0.1 * c.height) {
                    j = j + 0.4 * c.height;
                }
                if (j > c.bottom - 0.1 * c.height) {
                    j = j - 0.4 * c.height;
                }
                c.y = j - 0.5 * c.height;
            }
            this.bn.ap(this.bs, c, true);
        }
        return b >= 0;
    };
    FinancialIndicator.prototype.dw = function (a, b, c) {
        var d = _super.prototype.dw.call(this, a, b, c);
        if (this.indicatorColumn == null || this.indicatorColumn.count == 0) {
            d = false;
        }
        return d;
    };
    FinancialIndicator.prototype.oy = function (a, b) {
        var _this = this;
        _super.prototype.oy.call(this, a, b);
        var c = b.bs;
        var d = b.br;
        var e = this.getEffectiveViewport1(b);
        var f = this.l7;
        var g = this.ms;
        var h = new ScalerParams(0, c, d, f.b8, e);
        var i = new ScalerParams(0, c, d, g.b8, e);
        i.b = this.eh();
        a.f.clear();
        a.m.clear();
        a.p.clear();
        var j = 0;
        var k = typeCast(ISortingAxis_$type, this.l7);
        if (k != null && k.i$b.count != this.bz.count) {
            return;
        }
        j = this.ny(c, d, e);
        var l = this.pr();
        if (l == -1) {
            l = this.trendLinePeriod;
        }
        var m = typeCast(FinancialIndicatorView.$, b);
        if (m.b4) {
            m.b2.prepareLineCore(a.p, this.trendLineType, this.indicatorColumn, l, function (n) { return _this.l7.dv(n, h); }, function (n) { return _this.ms.dv(n, i); }, ((function () {
                var $ret = new TrendResolutionParams();
                $ret.c = b.bu.b;
                $ret.d = b.bu.c;
                $ret.e = b.bu.d;
                $ret.a = j;
                $ret.b = _this.eu;
                $ret.f = d;
                $ret.g = c;
                return $ret;
            })()));
        }
        var n = this.l7.dy(2, h) - this.l7.dy(1, h);
        for (var o = b.bu.c; o <= b.bu.d; ++o) {
            var p = void 0;
            if (k == null) {
                p = b.bu.getBucket(o);
            }
            else {
                var q = k.i$b._inner[o];
                var r = k.i$d(q);
                var s = this.indicatorColumn._inner[o];
                var t = s;
                var u = r;
                while (o < b.bu.d) {
                    q = k.i$b._inner[o + 1];
                    u = k.i$d(q);
                    if (u - r > n) {
                        break;
                    }
                    o++;
                    var v = this.indicatorColumn._inner[o];
                    s = Math.min(s, v);
                    t = Math.max(t, v);
                }
                var w = NaN;
                if (!isNaN_(r)) {
                    w = this.l7.dv(r, h);
                }
                p = [w, s, t];
            }
            if (!isNaN_(p[0])) {
                if (this.l7 != null && typeCast(ISortingAxis_$type, this.l7) !== null) {
                    p[0] = p[0] + j;
                }
                else {
                    p[0] = f.dv(p[0], h) + j;
                }
                p[1] = g.dv(p[1], i);
                if (b.bu.b > 1 || k != null) {
                    p[2] = g.dv(p[2], i);
                }
                else {
                    p[2] = p[1];
                }
                a.f.add(p);
            }
        }
        return;
    };
    FinancialIndicator.prototype.hv = function (a, b) {
        _super.prototype.hv.call(this, a, b);
        var c = b;
        c.b5(a);
        if (c.b4) {
            c.b2.g$d();
        }
    };
    FinancialIndicator.prototype.mg = function () {
        switch (this.pj) {
            case 1: return 1;
            case 2: return 1;
            case 0: return 12;
        }
        return 1;
    };
    FinancialIndicator.prototype.o0 = function (a, b) {
        _super.prototype.o0.call(this, a, b);
        var c = typeCast(FinancialIndicatorView.$, b);
        var d = function (e) { return a.f._inner[e][0]; };
        var e = function (f) { return a.f._inner[f][1]; };
        if (c.b4) {
            c.b2.g$d();
            c.b2.g$g(a.p);
        }
        var f = b.br;
        var g = this.getEffectiveViewport1(b);
        var h = 0;
        var i = this.k2;
        var j = this.pd;
        if (b.bx(a)) {
            c.b5(false);
            if (a.f.count > 0) {
                switch (this.pj) {
                    case 0:
                        var k = CategorySeries.m0(a.f, a.f.count - 1, f, b.bs, false);
                        c.b9(a.f.count, d, e, true, k);
                        break;
                    case 1:
                        if (this.ms != null) {
                            h = this.n2(b);
                        }
                        else {
                            h = 0.5 * (f.top + f.bottom);
                        }
                        var l = CategorySeries.m0(a.f, a.f.count - 1, f, b.bs, false);
                        c.b7(a.f.count, d, e, true, h, l);
                        break;
                    case 2:
                        h = this.n2(b);
                        c.b8(a.f.count, d, e, true, h);
                        break;
                    default: throw new NotImplementedException(0);
                }
            }
            b.bz(a);
        }
        var m = a.f;
        var n = this.bz.count;
        this.mf.x(this, this.nf(), this.l7, runOn(this, this.lz), this.n4(b), this.n6(b));
        var o = false;
        var p = this.mf.c;
        if (p != null) {
            o = true;
        }
        this.mf.al = i;
        this.mf.ah = i;
        if (o) {
            var q = new ScalerParams(0, b.bs, b.br, this.l7.b8, g);
            this.mf.f = false;
            this.ox(m, -1, n, this.l7, q, b.n);
        }
        this.mf.ae(c.cr, true, false, true, false);
        this.mf.ae(c.ct, true, false, true, false);
        this.mf.ae(c.cs, false, true, false, false);
        c.cs._opacity = 0.8 * this.mf.i * this.d6;
        this.mf.ae(c.cq, true, false, false, false);
        this.mf.al = j;
        this.mf.ah = j;
        if (o) {
            var r = new ScalerParams(0, b.bs, b.br, this.l7.b8, g);
            this.mf.f = true;
            this.ox(m, -1, n, this.l7, r, b.n);
        }
        this.mf.ae(c.cn, true, false, true, false);
        this.mf.ae(c.cp, true, false, true, false);
        this.mf.ae(c.co, false, true, false, false);
        c.co._opacity = 0.8 * this.mf.i * this.d6;
        this.mf.ae(c.cm, true, false, false, false);
        c.cb();
    };
    FinancialIndicator.prototype.jn = function () {
        _super.prototype.jn.call(this);
        if (this.fh < 0) {
            return;
        }
        if (this.pi.b4) {
            this.pi.cc();
        }
    };
    FinancialIndicator.prototype.pv = function () {
        if (this.pi.b4) {
            this.pi.b2.g$i();
        }
        this.pk(0, this.indicatorColumn.count);
        if (this.ms != null && !this.ms.ck()) {
            this.jc(false);
        }
    };
    FinancialIndicator.prototype.h4 = function (a) {
        _super.prototype.h4.call(this, a);
        this.a2.exportTrendlineData(this, a, this.pi.b2.g$j);
    };
    FinancialIndicator.$t = markType(FinancialIndicator, 'FinancialIndicator', FinancialSeries.$, [ITrendLineSeries_$type]);
    FinancialIndicator.px = DependencyProperty.i("ActualTrendLineBrush", Brush.$, FinancialIndicator.$, new PropertyMetadata(2, null, function (a, b) { return a.raisePropertyChanged("ActualTrendLineBrush", b.oldValue, b.newValue); }));
    return FinancialIndicator;
}(FinancialSeries));
export { FinancialIndicator };
Type.dep(DependencyProperty, PropertyMetadata, FinancialIndicator, 'raisePropertyChanged', ['DisplayType:pj:py', [IndicatorDisplayType_$type, enumGetBox(IndicatorDisplayType_$type, 0)], 'IgnoreFirst:pp:pz', [1, 0], 'TrendLineType::p5', [TrendLineType_$type, enumGetBox(TrendLineType_$type, 0)], 'TrendLineThickness::p4', [1, 1.5], 'TrendLinePeriod::p3', [1, 7], 'TrendLineBrush::p0', [Brush.$, null], 'TrendLineZIndex:pq:p6', [1, 1001], 'TrendLineDashArray:p8:p1', [DoubleCollection.$], 'TrendLineDashCap:p9:p2', [PenLineCap_$type, enumGetBox(PenLineCap_$type, 0)]]);
/**
 * @hidden
 */
var FinancialIndicatorBucketCalculator = /** @class */ (function (_super) {
    tslib_1.__extends(FinancialIndicatorBucketCalculator, _super);
    function FinancialIndicatorBucketCalculator(a) {
        var _this = _super.call(this, a) || this;
        _this.f = null;
        _this.f = a;
        return _this;
    }
    FinancialIndicatorBucketCalculator.prototype.getBucket = function (a) {
        var b = a * this.b;
        var c = Math.min(b + this.b - 1, this.f.b0.indicatorColumn.count - 1);
        var d = NaN;
        var e = NaN;
        for (var f = b; f <= c; ++f) {
            var g = this.f.b0.indicatorColumn._inner[f];
            if (!isNaN_(d)) {
                if (!isNaN_(g)) {
                    d = Math.min(d, g);
                    e = Math.max(e, g);
                }
            }
            else {
                d = g;
                e = g;
            }
        }
        if (!isNaN_(d)) {
            return [0.5 * (b + c), d, e];
        }
        return [NaN, NaN, NaN];
    };
    FinancialIndicatorBucketCalculator.$t = markType(FinancialIndicatorBucketCalculator, 'FinancialIndicatorBucketCalculator', FinancialBucketCalculator.$);
    return FinancialIndicatorBucketCalculator;
}(FinancialBucketCalculator));
export { FinancialIndicatorBucketCalculator };
/**
 * @hidden
 */
var FinancialIndicatorView = /** @class */ (function (_super) {
    tslib_1.__extends(FinancialIndicatorView, _super);
    function FinancialIndicatorView(a) {
        var _this = _super.call(this, a) || this;
        _this.b0 = null;
        _this.b3 = null;
        _this.cr = ((function () {
            var $ret = new Path();
            $ret.aj = new PathGeometry();
            return $ret;
        })());
        _this.cn = ((function () {
            var $ret = new Path();
            $ret.aj = new PathGeometry();
            return $ret;
        })());
        _this.cs = ((function () {
            var $ret = new Path();
            $ret.aj = new PathGeometry();
            return $ret;
        })());
        _this.co = ((function () {
            var $ret = new Path();
            $ret.aj = new PathGeometry();
            return $ret;
        })());
        _this.ct = ((function () {
            var $ret = new Path();
            $ret.aj = new PathGeometry();
            return $ret;
        })());
        _this.cp = ((function () {
            var $ret = new Path();
            $ret.aj = new PathGeometry();
            return $ret;
        })());
        _this.cq = ((function () {
            var $ret = new Path();
            $ret.aj = new GeometryGroup();
            return $ret;
        })());
        _this.cm = ((function () {
            var $ret = new Path();
            $ret.aj = new GeometryGroup();
            return $ret;
        })());
        _this.b1 = null;
        _this.cj = new Path();
        _this.cl = new Path();
        _this.ck = new Path();
        _this.ci = new Path();
        _this.cf = new Path();
        _this.ch = new Path();
        _this.cg = new Path();
        _this.ce = new Path();
        _this.b0 = a;
        _this.b3 = ((function () {
            var $ret = new Pool$1(LineGeometry.$);
            $ret.create = runOn(_this, _this.cd);
            $ret.destroy = runOn(_this, _this.b6);
            return $ret;
        })());
        return _this;
    }
    FinancialIndicatorView.prototype.bv = function () {
        return new FinancialIndicatorBucketCalculator(this);
    };
    FinancialIndicatorView.prototype.ap = function () {
        _super.prototype.ap.call(this);
        if (!this.n) {
            this.bw.pd = ((function () {
                var $ret = new Brush();
                $ret.fill = "#C62828";
                return $ret;
            })());
            this.bw.ey = 2;
        }
    };
    FinancialIndicatorView.prototype.cd = function () {
        return new LineGeometry();
    };
    FinancialIndicatorView.prototype.b6 = function (a) {
    };
    Object.defineProperty(FinancialIndicatorView.prototype, "b2", {
        get: function () {
            if (this.b1 == null) {
                this.b1 = CategoryTrendLineManagerFactory.a(this.b1, this.e.ap(), this.e.jw, this.e, this.e.b2);
            }
            return this.b1;
        },
        set: function (a) {
            this.b1 = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialIndicatorView.prototype, "b4", {
        get: function () {
            return this.b1 != null;
        },
        enumerable: true,
        configurable: true
    });
    FinancialIndicatorView.prototype.b5 = function (a) {
        Extensions.e(this.cr.aj);
        Extensions.e(this.cs.aj);
        Extensions.e(this.ct.aj);
        Extensions.e(this.cn.aj);
        Extensions.e(this.co.aj);
        Extensions.e(this.cp.aj);
        Extensions.d(this.cq.aj);
        Extensions.d(this.cm.aj);
        if (a) {
            this.b3.count = 0;
        }
        this.an();
    };
    FinancialIndicatorView.prototype.cb = function () {
    };
    FinancialIndicatorView.prototype.b9 = function (a, b, c, d, e) {
        IndicatorRenderer.g(a, b, c, d, this.bs, this.br, this.cr, this.cn, this.bu.b, this.e.eu, e);
        this.an();
    };
    FinancialIndicatorView.prototype.b7 = function (a, b, c, d, e, f) {
        IndicatorRenderer.e(a, b, c, d, this.bs, this.br, this.cr, this.cs, this.cn, this.co, e, this.bu.b, this.e.eu, f);
        this.an();
    };
    FinancialIndicatorView.prototype.b8 = function (a, b, c, d, e) {
        IndicatorRenderer.f(a, b, c, d, this.br, e, this.b3, this.cq, this.cm);
        this.an();
    };
    FinancialIndicatorView.prototype.cc = function () {
        this.b0.p7 = null;
        if (this.b0.trendLineBrush != null) {
            this.b0.p7 = this.b0.trendLineBrush;
        }
        else {
            this.b0.p7 = this.b0.k2;
        }
    };
    FinancialIndicatorView.prototype.a9 = function () {
        _super.prototype.a9.call(this);
        var a = this.bl();
        this.cj.aj = this.cr.aj;
        this.cl.aj = this.ct.aj;
        this.ck.aj = this.cs.aj;
        this.ci.aj = this.cq.aj;
        this.cf.aj = this.cn.aj;
        this.ch.aj = this.cp.aj;
        this.cg.aj = this.co.aj;
        this.ce.aj = this.cm.aj;
        this.cj._stroke = a;
        this.cl._stroke = a;
        this.cj.ac = this.e.ey + 3;
        this.cl.ac = this.e.ey + 3;
        this.ck._fill = a;
        this.ck._opacity = 1;
        this.ci._stroke = a;
        this.ci.ac = this.e.ey + 3;
        this.cf._stroke = a;
        this.ch._stroke = a;
        this.cf.ac = this.e.ey + 3;
        this.ch.ac = this.e.ey + 3;
        this.cg._fill = a;
        this.cg._opacity = 1;
        this.ce._stroke = a;
        this.ce.ac = this.e.ey + 3;
    };
    FinancialIndicatorView.prototype.a3 = function (a, b) {
        _super.prototype.a3.call(this, a, b);
        if (a.d) {
            if (b) {
                if (this.b0.pj == 2) {
                    a.s(this.ci);
                    a.s(this.ce);
                }
                else {
                    a.s(this.ck);
                    a.s(this.cj);
                    a.s(this.cl);
                    a.s(this.cg);
                    a.s(this.cf);
                    a.s(this.ch);
                }
            }
            else {
                if (this.b0.pj == 2) {
                    a.s(this.cq);
                    a.s(this.cm);
                }
                else {
                    a.s(this.cs);
                    a.s(this.cr);
                    a.s(this.ct);
                    a.s(this.co);
                    a.s(this.cn);
                    a.s(this.cp);
                }
            }
        }
    };
    FinancialIndicatorView.prototype.a2 = function (a, b) {
        if (a.d) {
            if (this.b0.trendLineType != 0 && !b) {
                var c = this.b2.g$j;
                c.ac = this.b0.trendLineThickness;
                c._stroke = this.b0.p7;
                c.ad = this.b0.p9;
                c.ai = this.b0.p8;
                a.u(c);
            }
        }
        _super.prototype.a2.call(this, a, b);
    };
    FinancialIndicatorView.prototype.ai = function (a) {
        _super.prototype.ai.call(this, a);
        this.e.a2.exportPathData(a, this.cq, "positiveColumnsShape", ["Positive", "Main"]);
        this.e.a2.exportPathData(a, this.cm, "negativeColumnsShape", ["Negative"]);
        this.e.a2.exportPathData(a, this.cr, "positive0", ["Positive", "Main"]);
        this.e.a2.exportPathData(a, this.ct, "positive1", ["Positive"]);
        this.e.a2.exportPathData(a, this.cs, "positive01", ["PositiveFill"]);
        this.e.a2.exportPathData(a, this.cn, "negative0", ["Negative", "Main"]);
        this.e.a2.exportPathData(a, this.cp, "negative1", ["Negative"]);
        this.e.a2.exportPathData(a, this.co, "negative01", ["NegativeFill"]);
    };
    FinancialIndicatorView.prototype.ca = function () {
        if (this.b4) {
            this.b1 = CategoryTrendLineManagerFactory.a(this.b1, this.e.ap(), this.e.jw, this.e, this.e.b2);
        }
    };
    FinancialIndicatorView.$t = markType(FinancialIndicatorView, 'FinancialIndicatorView', FinancialSeriesView.$);
    return FinancialIndicatorView;
}(FinancialSeriesView));
export { FinancialIndicatorView };
//# sourceMappingURL=FinancialIndicator_combined.js.map