/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE  AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE:  you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import { __extends } from "tslib";
import { FinancialSeries } from "./FinancialSeries";
import { ITrendLineSeries_$type } from "./ITrendLineSeries";
import { IndicatorDisplayType_$type } from "./IndicatorDisplayType";
import { DependencyProperty } from "igniteui-angular-core";
import { TrendLineType_$type } from "igniteui-angular-core";
import { Brush } from "igniteui-angular-core";
import { PenLineCap_$type } from "igniteui-angular-core";
import { DoubleCollection } from "igniteui-angular-core";
import { List$1 } from "igniteui-angular-core";
import { AxisRange } from "./AxisRange";
import { CategoryFrame } from "./CategoryFrame";
import { Number_$type, typeCast, enumGetBox, EnumUtil, runOn, markType, markDep } from "igniteui-angular-core";
import { Rect } from "igniteui-angular-core";
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";
import { Path } from "igniteui-angular-core";
import { PropertyMetadata } from "igniteui-angular-core";
import { isNaN_ } from "igniteui-angular-core";
import { PathGeometry } from "igniteui-angular-core";
import { GeometryGroup } from "igniteui-angular-core";
import { Pool$1 } from "igniteui-angular-core";
import { LineGeometry } from "igniteui-angular-core";
import { Defaults } from "./Defaults";
import { Extensions } from "igniteui-angular-core";
import { IndicatorRenderer } from "./IndicatorRenderer";
/**
 * @hidden
 */
var FinancialIndicator = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(FinancialIndicator, _super);
    function FinancialIndicator() {
        var _this = _super.call(this) || this;
        _this._indicatorColumn = null;
        _this.aba = null;
        _this.xk = new CategoryFrame(3);
        _this.xm = new CategoryFrame(3);
        _this.xi = new CategoryFrame(3);
        _this.indicatorColumn = new List$1(Number_$type, 0);
        _this.aba = new AxisRange(-100, 100);
        return _this;
    }
    FinancialIndicator.prototype.get_e9 = function () {
        return true;
    };
    FinancialIndicator.prototype.ct = function () {
        return new FinancialIndicatorView(this);
    };
    FinancialIndicator.prototype.q7 = function (a) {
        _super.prototype.q7.call(this, a);
        this.abb = a;
    };
    FinancialIndicator.prototype.abo = function (a) {
        if (this.xz != null && !this.xz.d2()) {
            this.ry(true);
        }
    };
    FinancialIndicator.prototype.abg = function (a, b, c) {
        if (isNaN_(b.x) || isNaN_(b.y)) {
            return false;
        }
        var d = this.xz;
        var e = 0;
        if (d != null) {
            e = d.gg(d.p5);
        }
        if ((a.y >= e && a.y <= b.y) || (a.y <= e && a.y >= b.y)) {
            return true;
        }
        return false;
    };
    FinancialIndicator.prototype.b3 = function () {
        if (this.b4 == 0) {
            return 1;
        }
        else {
            return _super.prototype.b3.call(this);
        }
    };
    FinancialIndicator.prototype.wx = function (a) {
        if (this.xg == null || this.xz == null) {
            return Rect.empty;
        }
        var b = this.wh(a);
        var c = this.cw.ca;
        var d = this.cw.b9;
        var e = this.getEffectiveViewport1(this.cw);
        var f = new ScalerParams(0, c, d, this.xz.df, e);
        f.b = this.i0();
        var g = this.an(this.xg, this.xi.h, this.zd(this.cw), this.zf(this.cw), 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.xz.ft(this.xz.p5, 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.gx = function (a, b) {
        var c = this.wm(this.wr(a), true, false);
        if (this.abd == 1) {
            if (this.abg(a, c, b)) {
                return true;
            }
        }
        if (this.abd == 1 || this.abd == 0) {
            if (this.gw(a, b)) {
                return true;
            }
        }
        if (this.abd == 2) {
            if (this.g0(a, b)) {
                return true;
            }
        }
        return false;
    };
    FinancialIndicator.prototype.ph = function (a, b, c, d) {
        _super.prototype.ph.call(this, a, b, c, d);
        if (this.xg != null && typeCast(ISortingAxis_$type, this.xg) !== null) {
            this.xg.i$i();
        }
        if (this.abb.cn) {
            this.abb.cl.g$i(a, b, c, d);
        }
        if (d != null && this.ys.containsKey(d)) {
            var e = this.ys.tryGetValue(d, d);
            d = e.p1;
        }
        if (this.xg != null && typeCast(ISortingAxis_$type, this.xg) !== null) {
            a = 4;
            b = 0;
            c = this.dp.count;
        }
        switch (a) {
            case 3:
                if (this.abf(b, c, d)) {
                    this.abq(b, c, d);
                    this.abo(true);
                }
                break;
            case 2:
                if (this.abf(b, this.dp.count - b, d)) {
                    this.abq(b, this.dp.count - b, d);
                    this.abo(true);
                }
                break;
            case 1:
                if (this.abf(b, this.dp.count - b, d)) {
                    var f = new Array(c);
                    for (var g = 0; g < c; g++) {
                        f[g] = 0;
                    }
                    this.indicatorColumn.s(b, f);
                    this.abq(b, this.dp.count - b, d);
                    this.abo(true);
                }
                break;
            case 0:
                if (this.abf(b, this.dp.count - b, d)) {
                    this.indicatorColumn.v(b, c);
                    this.abq(b, this.dp.count - b, d);
                    this.abo(true);
                }
                break;
            case 4:
                if (this.abf(b, this.dp.count - b, d)) {
                    this.indicatorColumn = new List$1(Number_$type, 2, this.dp.count);
                    var h = new Array(c);
                    for (var i = 0; i < c; i++) {
                        h[i] = 0;
                    }
                    this.indicatorColumn.s(0, h);
                    this.abq(b, this.dp.count - b, d);
                    this.abo(true);
                }
                break;
        }
    };
    FinancialIndicator.prototype.get_abc = function () {
        return 0;
    };
    Object.defineProperty(FinancialIndicator.prototype, "abc", {
        get: function () {
            return this.get_abc();
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(FinancialIndicator.prototype, "ab1", {
        get: function () {
            return this.c(FinancialIndicator.abr);
        },
        set: function (a) {
            this.h(FinancialIndicator.abr, a);
        },
        enumerable: false,
        configurable: true
    });
    FinancialIndicator.prototype.abl = function () {
        return -1;
    };
    Object.defineProperty(FinancialIndicator.prototype, "indicatorColumn", {
        get: function () {
            return this._indicatorColumn;
        },
        set: function (a) {
            this._indicatorColumn = a;
        },
        enumerable: false,
        configurable: true
    });
    FinancialIndicator.prototype.rg = function (a, b, c, d) {
        switch (b) {
            case "XAxis":
                this.abb.ct();
                break;
            case "TrendLineType":
                var e = EnumUtil.getEnumValue(TrendLineType_$type, d);
                if (e != 0) {
                    this.abb.cl = CategoryTrendLineManagerFactory.a(this.abb.cl, this.xg, this.s3, this, this.ds);
                }
                break;
        }
        _super.prototype.rg.call(this, a, b, c, d);
        if (this.abb.cn && this.abb.cl.g$e(a, b, c, d)) {
            this.ry(false);
            var f = typeCast(FinancialIndicatorView.$, this.cv);
            if (f != null && f.cn) {
                f.cl.g$e(a, b, c, d);
            }
            this.qr();
        }
        switch (b) {
            case "FastItemsSource":
                if (this.dp != null) {
                    this.indicatorColumn = new List$1(Number_$type, 2, this.dp.count);
                    var g = new Array(this.dp.count);
                    for (var h = 0; h < this.dp.count; h++) {
                        g[h] = 0;
                    }
                    this.indicatorColumn.s(0, g);
                    this.abq(0, this.dp.count, null);
                    if (this.xz != null && !this.xz.d2()) {
                        this.xx.cd.e(this.ie);
                        this.ry(this.gh && c != null);
                    }
                }
                break;
            case "TrendLineBrush":
                this.rm(b);
                break;
            case FinancialIndicator.$$p[0]:
                this.pb(true, this.cw);
                this.sq();
                this.ry(false);
                this.qr();
                break;
            case "OpenColumn":
            case "HighColumn":
            case "LowColumn":
            case "CloseColumn":
            case "VolumeColumn":
                if (this.dp != null) {
                    if (this.indicatorColumn.count != this.dp.count) {
                        this.indicatorColumn = new List$1(Number_$type, 2, this.dp.count);
                        var i = new Array(this.dp.count);
                        for (var j = 0; j < this.dp.count; j++) {
                            i[j] = 0;
                        }
                        this.indicatorColumn.s(0, i);
                    }
                    if (this.abf(0, this.dp.count - 1, b)) {
                        this.abp();
                    }
                }
                break;
            case "XAxis":
                if (this.xg != null && (typeCast(ISortingAxis_$type, this.xg) !== null || typeCast(ISortingAxis_$type, c) !== null)) {
                    this.abp();
                }
                break;
            case "YAxis":
            case FinancialIndicator.$$p[1]:
                this.abp();
                this.qr();
                break;
            case "TrendLineType":
                this.qr();
                break;
        }
    };
    FinancialIndicator.prototype.i8 = function (a, b, c) {
        if (this.indicatorColumn == null) {
            return _super.prototype.i8.call(this, a, b, c);
        }
        var d = this.getEffectiveViewport1(this.cw);
        var e = this.y7(this.cw.ca, this.cw.b9, d);
        var f = new ScalerParams(0, this.cw.ca, this.cw.b9, this.xg.df, d);
        f.c = this.dc.x4;
        return this.ja(this.indicatorColumn, a, this.xg, f, e, runOn(this, this.y6), b, c);
    };
    FinancialIndicator.prototype.ke = function (a, b) {
        if (this.indicatorColumn == null) {
            return _super.prototype.ke.call(this, a, b);
        }
        return this.kf(a, b, this.xg, runOn(this, this.y6), this.indicatorColumn);
    };
    FinancialIndicator.prototype.kc = function (a, b) {
        if (this.indicatorColumn == null) {
            return _super.prototype.kc.call(this, a, b);
        }
        return this.kd(a, b, this.xg, runOn(this, this.y6), this.indicatorColumn);
    };
    FinancialIndicator.prototype.get_he = function () {
        return true;
    };
    FinancialIndicator.prototype.abf = function (a, b, c) {
        if (c == null) {
            return true;
        }
        if (this.abh(a, b).contains(c)) {
            return true;
        }
        return false;
    };
    FinancialIndicator.prototype.abq = function (a, b, c) {
        this.abe(a, b);
    };
    FinancialIndicator.prototype.ay = function (a) {
        if (this.dp == null) {
            return null;
        }
        if (a != null && a == this.xz) {
            return this.aba;
        }
        return null;
    };
    FinancialIndicator.prototype.ge = function (a) {
        var b = this.dp != null ? this.dp.indexOf(a) : -1;
        var c = this.cw.ca;
        c = c.copy();
        var d = this.cw.b9;
        var e = new Rect(0, 0, 0, 1, 1);
        var f = this.wv(this.cw);
        if (b >= 0 && Rect.l_op_Inequality(c, null) && Rect.l_op_Inequality(d, null)) {
            if (this.xg != null) {
                var g = new ScalerParams(0, e, e, this.xg.df, f);
                var h = this.xg.ft(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.xz != null && this.indicatorColumn != null && b < this.indicatorColumn.count) {
                var i = new ScalerParams(0, e, e, this.xz.df, f);
                i.b = this.i0();
                var j = this.xz.ft(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.c4.au(this.dc, c, true);
        }
        return b >= 0;
    };
    FinancialIndicator.prototype.hf = function (a, b, c) {
        var d = _super.prototype.hf.call(this, a, b, c);
        if (this.indicatorColumn == null || this.indicatorColumn.count == 0) {
            d = false;
        }
        return d;
    };
    FinancialIndicator.prototype.aam = function (a, b) {
        var _this = this;
        _super.prototype.aam.call(this, a, b);
        var c = b.ca;
        var d = b.b9;
        var e = this.getEffectiveViewport1(b);
        var f = this.xg;
        var g = this.xz;
        var h = new ScalerParams(0, c, d, f.df, e);
        var i = new ScalerParams(0, c, d, g.df, e);
        i.b = this.i0();
        var j = this.xg.ag();
        var k = j[0];
        var l = j[1];
        a.h.clear();
        a.p.clear();
        a.s.clear();
        var m = 0;
        var n = typeCast(ISortingAxis_$type, this.xg);
        if (n != null && n.i$b.count != this.dp.count) {
            return;
        }
        m = this.y7(c, d, e);
        var o = this.abl();
        if (o == -1) {
            o = this.trendLinePeriod;
        }
        var p = typeCast(FinancialIndicatorView.$, b);
        if (p.cn) {
            p.cl.prepareLineCore(a.s, this.trendLineType, this.indicatorColumn, o, function (q) { return _this.xg.ft(q, h); }, function (q) { return _this.xz.ft(q, i); }, ((function () {
                var $ret = new TrendResolutionParams();
                $ret.e = b.cd.b;
                $ret.f = b.cd.c;
                $ret.g = b.cd.d;
                $ret.a = m;
                $ret.d = _this.ie;
                $ret.i = d;
                $ret.j = c;
                $ret.h = e;
                $ret.b = l;
                $ret.c = k;
                return $ret;
            })()));
        }
        var q = this.xg.fw(2, h) - this.xg.fw(1, h);
        for (var r = b.cd.c; r <= b.cd.d; ++r) {
            var s = void 0;
            if (n == null) {
                s = b.cd.getBucket(r);
            }
            else {
                var t = n.i$b._inner[r];
                var u = n.i$d(t);
                var v = this.indicatorColumn._inner[r];
                var w = v;
                var x = u;
                while (r < b.cd.d) {
                    t = n.i$b._inner[r + 1];
                    x = n.i$d(t);
                    if (x - u > q) {
                        break;
                    }
                    r++;
                    var y = this.indicatorColumn._inner[r];
                    v = Math.min(v, y);
                    w = Math.max(w, y);
                }
                var z = NaN;
                if (!isNaN_(u)) {
                    z = this.xg.ft(u, h);
                }
                s = [z, v, w];
            }
            if (!isNaN_(s[0])) {
                if (this.xg != null && typeCast(ISortingAxis_$type, this.xg) !== null) {
                    s[0] = s[0] + m;
                }
                else {
                    s[0] = f.ft(s[0], h) + m;
                }
                s[1] = g.ft(s[1], i);
                if (b.cd.b > 1 || n != null) {
                    s[2] = g.ft(s[2], i);
                }
                else {
                    s[2] = s[1];
                }
                a.h.add(s);
            }
        }
        return;
    };
    FinancialIndicator.prototype.pb = function (a, b) {
        _super.prototype.pb.call(this, a, b);
        var c = b;
        c.co(a);
        if (c.cn) {
            c.cl.g$h();
        }
    };
    FinancialIndicator.prototype.xq = function () {
        switch (this.abd) {
            case 1: return 1;
            case 2: return 1;
            case 0: return 12;
        }
        return 1;
    };
    FinancialIndicator.prototype.aao = function (a, b) {
        _super.prototype.aao.call(this, a, b);
        var c = typeCast(FinancialIndicatorView.$, b);
        var d = function (e) { return a.h._inner[e][0]; };
        var e = function (f) { return a.h._inner[f][1]; };
        if (c.cn) {
            c.cl.g$h();
            c.cl.g$k(a.s);
        }
        var f = b.b9;
        var g = this.getEffectiveViewport1(b);
        var h = 0;
        var i = this.vj;
        var j = this.aa6;
        if (b.cg(a)) {
            c.co(false);
            if (a.h.count > 0) {
                switch (this.abd) {
                    case 0:
                        var k = CategorySeries.yx(a.h, a.h.count - 1, f, b.ca, false);
                        c.cs(a.h.count, d, e, true, k);
                        break;
                    case 1:
                        if (this.xz != null) {
                            h = this.zb(b);
                        }
                        else {
                            h = 0.5 * (f.top + f.bottom);
                        }
                        var l = CategorySeries.yx(a.h, a.h.count - 1, f, b.ca, false);
                        c.cq(a.h.count, d, e, true, h, l);
                        break;
                    case 2:
                        h = this.zb(b);
                        c.cr(a.h.count, d, e, true, h);
                        break;
                    default: throw new NotImplementedException(0);
                }
            }
            b.ci(a);
        }
        var m = a.h;
        var n = this.dp.count;
        this.xp.a2(this, this.yo(), runOn(this, this.w8), this.zd(b), this.zf(b));
        var o = false;
        var p = this.xp.b;
        if (p != null) {
            o = true;
        }
        this.xp.ak = i;
        this.xp.ag = i;
        if (o) {
            var q = new ScalerParams(0, b.ca, b.b9, this.xg.df, g);
            this.xp.f = false;
            this.aal(m, -1, n, this.xg, q, b.t, -1);
        }
        this.xp.ad(c.da, true, false, true, false);
        this.xp.ad(c.dc, true, false, true, false);
        this.xp.ad(c.db, false, true, false, false);
        c.db._opacity = 0.8 * this.xp.j * this.ia;
        this.xp.ad(c.c9, true, false, false, false);
        this.xp.ak = j;
        this.xp.ag = j;
        if (o) {
            var r = new ScalerParams(0, b.ca, b.b9, this.xg.df, g);
            this.xp.f = true;
            this.aal(m, -1, n, this.xg, r, b.t, -1);
        }
        this.xp.ad(c.c6, true, false, true, false);
        this.xp.ad(c.c8, true, false, true, false);
        this.xp.ad(c.c7, false, true, false, false);
        c.c7._opacity = 0.8 * this.xp.j * this.ia;
        this.xp.ad(c.c5, true, false, false, false);
        c.cu();
    };
    FinancialIndicator.prototype.sp = function () {
        _super.prototype.sp.call(this);
        if (this.index < 0) {
            return;
        }
        if (this.abb.cn) {
            this.abb.cv();
        }
    };
    FinancialIndicator.prototype.abp = function () {
        if (this.abb.cn) {
            this.abb.cl.g$m();
        }
        this.abe(0, this.indicatorColumn.count);
        if (this.xz != null && !this.xz.d2()) {
            this.ry(this.gh && this.d9);
        }
    };
    FinancialIndicator.prototype.p5 = function (a) {
        _super.prototype.p5.call(this, a);
        this.bc.exportTrendlineData(this, a, this.abb.cl.g$n);
    };
    FinancialIndicator.prototype.bf = function (a) {
        if (this.abd == 1 || this.abd == 2) {
            return 3;
        }
        else if (this.abd == 0) {
            return 2;
        }
        return a;
    };
    FinancialIndicator.$t = markType(FinancialIndicator, 'FinancialIndicator', FinancialSeries.$, [ITrendLineSeries_$type]);
    FinancialIndicator.abr = DependencyProperty.i("ActualTrendLineBrush", Brush.$, FinancialIndicator.$, new PropertyMetadata(2, null, function (a, b) { return a.raisePropertyChanged("ActualTrendLineBrush", b.oldValue, b.newValue); }));
    FinancialIndicator.$$p = markDep(DependencyProperty, PropertyMetadata, FinancialIndicator, 'raisePropertyChanged', ['DisplayType:abd:abs', [IndicatorDisplayType_$type, enumGetBox(IndicatorDisplayType_$type, 0)], 'IgnoreFirst:abj:abt', [1, 0], 'TrendLineType::abz', [TrendLineType_$type, enumGetBox(TrendLineType_$type, 0)], 'TrendLineThickness::aby', [1, 1.5], 'TrendLinePeriod::abx', [1, 7], 'TrendLineBrush::abu', [Brush.$, null], 'TrendLineZIndex:abk:ab0', [1, 1001], 'TrendLineDashArray:ab2:abv', [DoubleCollection.$], 'TrendLineDashCap:ab3:abw', [PenLineCap_$type, enumGetBox(PenLineCap_$type, 0)]]);
    return FinancialIndicator;
}(FinancialSeries));
export { FinancialIndicator };
/**
 * @hidden
 */
var FinancialIndicatorBucketCalculator = /** @class */ /*@__PURE__*/ (function (_super) {
    __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.cj.indicatorColumn.count - 1);
        var d = NaN;
        var e = NaN;
        for (var f = b; f <= c; ++f) {
            var g = this.f.cj.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 */ /*@__PURE__*/ (function (_super) {
    __extends(FinancialIndicatorView, _super);
    function FinancialIndicatorView(a) {
        var _this = _super.call(this, a) || this;
        _this.cj = null;
        _this.cm = null;
        _this.da = ((function () {
            var $ret = new Path();
            $ret.an = new PathGeometry();
            return $ret;
        })());
        _this.c6 = ((function () {
            var $ret = new Path();
            $ret.an = new PathGeometry();
            return $ret;
        })());
        _this.db = ((function () {
            var $ret = new Path();
            $ret.an = new PathGeometry();
            return $ret;
        })());
        _this.c7 = ((function () {
            var $ret = new Path();
            $ret.an = new PathGeometry();
            return $ret;
        })());
        _this.dc = ((function () {
            var $ret = new Path();
            $ret.an = new PathGeometry();
            return $ret;
        })());
        _this.c8 = ((function () {
            var $ret = new Path();
            $ret.an = new PathGeometry();
            return $ret;
        })());
        _this.c9 = ((function () {
            var $ret = new Path();
            $ret.an = new GeometryGroup();
            return $ret;
        })());
        _this.c5 = ((function () {
            var $ret = new Path();
            $ret.an = new GeometryGroup();
            return $ret;
        })());
        _this.ck = null;
        _this.c2 = new Path();
        _this.c4 = new Path();
        _this.c3 = new Path();
        _this.c1 = new Path();
        _this.cy = new Path();
        _this.c0 = new Path();
        _this.cz = new Path();
        _this.cx = new Path();
        _this.cj = a;
        _this.cm = ((function () {
            var $ret = new Pool$1(LineGeometry.$);
            $ret.create = runOn(_this, _this.cw);
            $ret.destroy = runOn(_this, _this.cp);
            return $ret;
        })());
        return _this;
    }
    FinancialIndicatorView.prototype.ce = function () {
        return new FinancialIndicatorBucketCalculator(this);
    };
    FinancialIndicatorView.prototype.a4 = function () {
        _super.prototype.a4.call(this);
        if (!this.t) {
            this.cj.aa6 = Defaults.financialSeries_NegativeBrush;
            this.cj.abd = this.cj.abc;
        }
    };
    FinancialIndicatorView.prototype.cw = function () {
        return new LineGeometry();
    };
    FinancialIndicatorView.prototype.cp = function (a) {
    };
    Object.defineProperty(FinancialIndicatorView.prototype, "cl", {
        get: function () {
            if (this.ck == null) {
                this.ck = CategoryTrendLineManagerFactory.a(this.ck, this.f.a0(), this.f.s3, this.f, this.f.ds);
            }
            return this.ck;
        },
        set: function (a) {
            this.ck = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(FinancialIndicatorView.prototype, "cn", {
        get: function () {
            return this.ck != null;
        },
        enumerable: false,
        configurable: true
    });
    FinancialIndicatorView.prototype.co = function (a) {
        Extensions.e(this.da.an);
        Extensions.e(this.db.an);
        Extensions.e(this.dc.an);
        Extensions.e(this.c6.an);
        Extensions.e(this.c7.an);
        Extensions.e(this.c8.an);
        Extensions.d(this.c9.an);
        Extensions.d(this.c5.an);
        if (a) {
            this.cm.count = 0;
        }
        this.a2();
    };
    FinancialIndicatorView.prototype.cu = function () {
    };
    FinancialIndicatorView.prototype.cs = function (a, b, c, d, e) {
        IndicatorRenderer.g(a, b, c, d, this.ca, this.b9, this.da, this.c6, this.cd.b, this.f.ie, e);
        this.a2();
    };
    FinancialIndicatorView.prototype.cq = function (a, b, c, d, e, f) {
        IndicatorRenderer.e(a, b, c, d, this.ca, this.b9, this.da, this.db, this.c6, this.c7, e, this.cd.b, this.f.ie, f);
        this.a2();
    };
    FinancialIndicatorView.prototype.cr = function (a, b, c, d, e) {
        IndicatorRenderer.f(a, b, c, d, this.b9, e, this.cm, this.c9, this.c5);
        this.a2();
    };
    FinancialIndicatorView.prototype.cv = function () {
        this.cj.ab1 = null;
        if (this.cj.trendLineBrush != null) {
            this.cj.ab1 = this.cj.trendLineBrush;
        }
        else {
            this.cj.ab1 = this.cj.vj;
        }
    };
    FinancialIndicatorView.prototype.bq = function () {
        _super.prototype.bq.call(this);
        var a = this.b3();
        this.c2.an = this.da.an;
        this.c4.an = this.dc.an;
        this.c3.an = this.db.an;
        this.c1.an = this.c9.an;
        this.cy.an = this.c6.an;
        this.c0.an = this.c8.an;
        this.cz.an = this.c7.an;
        this.cx.an = this.c5.an;
        this.c2._stroke = a;
        this.c4._stroke = a;
        this.c2.ad = this.f.ig + 3;
        this.c4.ad = this.f.ig + 3;
        this.c3._fill = a;
        this.c3._opacity = 1;
        this.c1._stroke = a;
        this.c1.ad = this.f.ig + 3;
        this.cy._stroke = a;
        this.c0._stroke = a;
        this.cy.ad = this.f.ig + 3;
        this.c0.ad = this.f.ig + 3;
        this.cz._fill = a;
        this.cz._opacity = 1;
        this.cx._stroke = a;
        this.cx.ad = this.f.ig + 3;
    };
    FinancialIndicatorView.prototype.bj = function (a, b) {
        _super.prototype.bj.call(this, a, b);
        if (a.d) {
            if (b) {
                if (this.cj.abd == 2) {
                    a.t(this.c1);
                    a.t(this.cx);
                }
                else {
                    a.t(this.c3);
                    a.t(this.c2);
                    a.t(this.c4);
                    a.t(this.cz);
                    a.t(this.cy);
                    a.t(this.c0);
                }
            }
            else {
                if (this.cj.abd == 2) {
                    a.t(this.c9);
                    a.t(this.c5);
                }
                else {
                    a.t(this.db);
                    a.t(this.da);
                    a.t(this.dc);
                    a.t(this.c7);
                    a.t(this.c6);
                    a.t(this.c8);
                }
            }
        }
    };
    FinancialIndicatorView.prototype.bi = function (a, b) {
        if (a.d) {
            if (this.cj.trendLineType != 0 && !b) {
                var c = this.cl.g$n;
                c.ad = this.cj.trendLineThickness;
                c._stroke = this.cj.ab1;
                c.aj = this.cj.ab3;
                c.ai = this.cj.ab2;
                a.v(c);
            }
        }
        _super.prototype.bi.call(this, a, b);
    };
    FinancialIndicatorView.prototype.ax = function (a) {
        _super.prototype.ax.call(this, a);
        this.f.bc.exportPathData(a, this.c9, "positiveColumnsShape", ["Positive", "Main"]);
        this.f.bc.exportPathData(a, this.c5, "negativeColumnsShape", ["Negative"]);
        this.f.bc.exportPathData(a, this.da, "positive0", ["Positive", "Main"]);
        this.f.bc.exportPathData(a, this.dc, "positive1", ["Positive"]);
        this.f.bc.exportPathData(a, this.db, "positive01", ["PositiveFill"]);
        this.f.bc.exportPathData(a, this.c6, "negative0", ["Negative", "Main"]);
        this.f.bc.exportPathData(a, this.c8, "negative1", ["Negative"]);
        this.f.bc.exportPathData(a, this.c7, "negative01", ["NegativeFill"]);
    };
    FinancialIndicatorView.prototype.ct = function () {
        if (this.cn) {
            this.ck = CategoryTrendLineManagerFactory.a(this.ck, this.f.a0(), this.f.s3, this.f, this.f.ds);
        }
    };
    FinancialIndicatorView.$t = markType(FinancialIndicatorView, 'FinancialIndicatorView', FinancialSeriesView.$);
    return FinancialIndicatorView;
}(FinancialSeriesView));
export { FinancialIndicatorView };
