/*
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-react-core";
import { TrendLineType_$type } from "igniteui-react-core";
import { Brush } from "igniteui-react-core";
import { PenLineCap_$type } from "igniteui-react-core";
import { DoubleCollection } from "igniteui-react-core";
import { List$1 } from "igniteui-react-core";
import { AxisRange } from "./AxisRange";
import { CategoryFrame } from "./CategoryFrame";
import { Number_$type, typeCast, enumGetBox, EnumUtil, runOn, markType, markDep } from "igniteui-react-core";
import { Rect } from "igniteui-react-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-react-core";
import { Path } from "igniteui-react-core";
import { PropertyMetadata } from "igniteui-react-core";
import { isNaN_ } from "igniteui-react-core";
import { Pool$1 } from "igniteui-react-core";
import { LineGeometry } from "igniteui-react-core";
import { PathGeometry } from "igniteui-react-core";
import { GeometryGroup } from "igniteui-react-core";
import { Defaults } from "./Defaults";
import { Extensions } from "igniteui-react-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.x3 = null;
        _this.ud = new CategoryFrame(3);
        _this.uf = new CategoryFrame(3);
        _this.ub = new CategoryFrame(3);
        _this.indicatorColumn = new List$1(Number_$type, 0);
        _this.x3 = new AxisRange(-100, 100);
        return _this;
    }
    FinancialIndicator.prototype.get_el = function () {
        return true;
    };
    FinancialIndicator.prototype.cg = function () {
        return new FinancialIndicatorView(this);
    };
    FinancialIndicator.prototype.o0 = function (a) {
        _super.prototype.o0.call(this, a);
        this.x4 = a;
    };
    FinancialIndicator.prototype.yh = function (a) {
        if (this.uv != null && !this.uv.c1()) {
            this.pp(true);
        }
    };
    FinancialIndicator.prototype.x9 = function (a, b, c) {
        if (isNaN_(b.x) || isNaN_(b.y)) {
            return false;
        }
        var d = this.uv;
        var e = 0;
        if (d != null) {
            e = d.e4(d.l7);
        }
        if ((a.y >= e && a.y <= b.y) || (a.y <= e && a.y >= b.y)) {
            return true;
        }
        return false;
    };
    FinancialIndicator.prototype.bx = function () {
        if (this.by == 0) {
            return 1;
        }
        else {
            return _super.prototype.bx.call(this);
        }
    };
    FinancialIndicator.prototype.ts = function (a) {
        if (this.t9 == null || this.uv == null) {
            return Rect.empty;
        }
        var b = this.tc(a);
        var c = this.cj.by;
        var d = this.cj.bx;
        var e = this.getEffectiveViewport1(this.cj);
        var f = new ScalerParams(0, c, d, this.uv.ch, e);
        f.b = this.h2();
        var g = this.aj(this.t9, this.ub.f, this.v6(this.cj), this.v8(this.cj), 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.uv.ej(this.uv.l7, 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.f4 = function (a, b) {
        var c = this.th(this.tm(a), true, false);
        if (this.x6 == 1) {
            if (this.x9(a, c, b)) {
                return true;
            }
        }
        if (this.x6 == 1 || this.x6 == 0) {
            if (this.f3(a, b)) {
                return true;
            }
        }
        if (this.x6 == 2) {
            if (this.f7(a, b)) {
                return true;
            }
        }
        return false;
    };
    FinancialIndicator.prototype.no = function (a, b, c, d) {
        _super.prototype.no.call(this, a, b, c, d);
        if (this.t9 != null && typeCast(ISortingAxis_$type, this.t9) !== null) {
            this.t9.i$i();
        }
        if (this.x4.ca) {
            this.x4.b8.g$e(a, b, c, d);
        }
        if (d != null && this.vl.containsKey(d)) {
            var e = this.vl.tryGetValue(d, d);
            d = e.p1;
        }
        if (this.t9 != null && typeCast(ISortingAxis_$type, this.t9) !== null) {
            a = 4;
            b = 0;
            c = this.c6.count;
        }
        switch (a) {
            case 3:
                if (this.x8(b, c, d)) {
                    this.yj(b, c, d);
                    this.yh(true);
                }
                break;
            case 2:
                if (this.x8(b, this.c6.count - b, d)) {
                    this.yj(b, this.c6.count - b, d);
                    this.yh(true);
                }
                break;
            case 1:
                if (this.x8(b, this.c6.count - b, d)) {
                    var f = new Array(c);
                    for (var g = 0; g < c; g++) {
                        f[g] = 0;
                    }
                    this.indicatorColumn.s(b, f);
                    this.yj(b, this.c6.count - b, d);
                    this.yh(true);
                }
                break;
            case 0:
                if (this.x8(b, this.c6.count - b, d)) {
                    this.indicatorColumn.v(b, c);
                    this.yj(b, this.c6.count - b, d);
                    this.yh(true);
                }
                break;
            case 4:
                if (this.x8(b, this.c6.count - b, d)) {
                    this.indicatorColumn = new List$1(Number_$type, 2, this.c6.count);
                    var h = new Array(c);
                    for (var i = 0; i < c; i++) {
                        h[i] = 0;
                    }
                    this.indicatorColumn.s(0, h);
                    this.yj(b, this.c6.count - b, d);
                    this.yh(true);
                }
                break;
        }
    };
    FinancialIndicator.prototype.get_x5 = function () {
        return 0;
    };
    Object.defineProperty(FinancialIndicator.prototype, "x5", {
        get: function () {
            return this.get_x5();
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(FinancialIndicator.prototype, "yu", {
        get: function () {
            return this.c(FinancialIndicator.yk);
        },
        set: function (a) {
            this.h(FinancialIndicator.yk, a);
        },
        enumerable: false,
        configurable: true
    });
    FinancialIndicator.prototype.ye = 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.o8 = function (a, b, c, d) {
        switch (b) {
            case "XAxis":
                this.x4.cg();
                break;
            case "TrendLineType":
                var e = EnumUtil.getEnumValue(TrendLineType_$type, d);
                if (e != 0) {
                    this.x4.b8 = CategoryTrendLineManagerFactory.a(this.x4.b8, this.t9, this.qr, this, this.c9);
                }
                break;
        }
        _super.prototype.o8.call(this, a, b, c, d);
        if (this.x4.ca && this.x4.b8.g$b(a, b, c, d)) {
            this.pp(false);
            var f = typeCast(FinancialIndicatorView.$, this.ci);
            if (f != null && f.ca) {
                f.b8.g$b(a, b, c, d);
            }
            this.ol();
        }
        switch (b) {
            case "FastItemsSource":
                if (this.c6 != null) {
                    this.indicatorColumn = new List$1(Number_$type, 2, this.c6.count);
                    var g = new Array(this.c6.count);
                    for (var h = 0; h < this.c6.count; h++) {
                        g[h] = 0;
                    }
                    this.indicatorColumn.s(0, g);
                    this.yj(0, this.c6.count, null);
                    if (this.uv != null && !this.uv.c1()) {
                        this.uq.b0.e(this.hj);
                        this.pp(this.fq && c != null);
                    }
                }
                break;
            case "TrendLineBrush":
                this.pe(b);
                break;
            case FinancialIndicator.$$p[0]:
                this.nj(true, this.cj);
                this.qe();
                this.pp(false);
                this.ol();
                break;
            case "OpenColumn":
            case "HighColumn":
            case "LowColumn":
            case "CloseColumn":
            case "VolumeColumn":
                if (this.c6 != null) {
                    if (this.indicatorColumn.count != this.c6.count) {
                        this.indicatorColumn = new List$1(Number_$type, 2, this.c6.count);
                        var i = new Array(this.c6.count);
                        for (var j = 0; j < this.c6.count; j++) {
                            i[j] = 0;
                        }
                        this.indicatorColumn.s(0, i);
                    }
                    if (this.x8(0, this.c6.count - 1, b)) {
                        this.yi();
                    }
                }
                break;
            case "XAxis":
                if (this.t9 != null && (typeCast(ISortingAxis_$type, this.t9) !== null || typeCast(ISortingAxis_$type, c) !== null)) {
                    this.yi();
                }
                break;
            case "YAxis":
            case FinancialIndicator.$$p[1]:
                this.yi();
                this.ol();
                break;
            case "TrendLineType":
                this.ol();
                break;
        }
    };
    FinancialIndicator.prototype.h9 = function (a, b, c) {
        if (this.indicatorColumn == null) {
            return _super.prototype.h9.call(this, a, b, c);
        }
        var d = this.getEffectiveViewport1(this.cj);
        var e = this.v0(this.cj.by, this.cj.bx, d);
        var f = new ScalerParams(0, this.cj.by, this.cj.bx, this.t9.ch, d);
        f.c = this.cy.t2;
        return this.ib(this.indicatorColumn, a, this.t9, f, e, runOn(this, this.vz), b, c);
    };
    FinancialIndicator.prototype.jf = function (a, b) {
        if (this.indicatorColumn == null) {
            return _super.prototype.jf.call(this, a, b);
        }
        return this.jg(a, b, this.t9, runOn(this, this.vz), this.indicatorColumn);
    };
    FinancialIndicator.prototype.jd = function (a, b) {
        if (this.indicatorColumn == null) {
            return _super.prototype.jd.call(this, a, b);
        }
        return this.je(a, b, this.t9, runOn(this, this.vz), this.indicatorColumn);
    };
    FinancialIndicator.prototype.get_gk = function () {
        return true;
    };
    FinancialIndicator.prototype.x8 = function (a, b, c) {
        if (c == null) {
            return true;
        }
        if (this.ya(a, b).contains(c)) {
            return true;
        }
        return false;
    };
    FinancialIndicator.prototype.yj = function (a, b, c) {
        this.x7(a, b);
    };
    FinancialIndicator.prototype.aq = function (a) {
        if (this.c6 == null) {
            return null;
        }
        if (a != null && a == this.uv) {
            return this.x3;
        }
        return null;
    };
    FinancialIndicator.prototype.fo = function (a) {
        var b = this.c6 != null ? this.c6.indexOf(a) : -1;
        var c = this.cj.by;
        c = c.copy();
        var d = this.cj.bx;
        var e = new Rect(0, 0, 0, 1, 1);
        var f = this.tq(this.cj);
        if (b >= 0 && Rect.l_op_Inequality(c, null) && Rect.l_op_Inequality(d, null)) {
            if (this.t9 != null) {
                var g = new ScalerParams(0, e, e, this.t9.ch, f);
                var h = this.t9.ej(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.uv != null && this.indicatorColumn != null && b < this.indicatorColumn.count) {
                var i = new ScalerParams(0, e, e, this.uv.ch, f);
                i.b = this.h2();
                var j = this.uv.ej(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.cr.au(this.cy, c, true);
        }
        return b >= 0;
    };
    FinancialIndicator.prototype.gl = function (a, b, c) {
        var d = _super.prototype.gl.call(this, a, b, c);
        if (this.indicatorColumn == null || this.indicatorColumn.count == 0) {
            d = false;
        }
        return d;
    };
    FinancialIndicator.prototype.xf = function (a, b) {
        var _this = this;
        _super.prototype.xf.call(this, a, b);
        var c = b.by;
        var d = b.bx;
        var e = this.getEffectiveViewport1(b);
        var f = this.t9;
        var g = this.uv;
        var h = new ScalerParams(0, c, d, f.ch, e);
        var i = new ScalerParams(0, c, d, g.ch, e);
        i.b = this.h2();
        var j = this.t9.ag();
        var k = j[0];
        var l = j[1];
        a.f.clear();
        a.m.clear();
        a.p.clear();
        var m = 0;
        var n = typeCast(ISortingAxis_$type, this.t9);
        if (n != null && n.i$b.count != this.c6.count) {
            return;
        }
        m = this.v0(c, d, e);
        var o = this.ye();
        if (o == -1) {
            o = this.trendLinePeriod;
        }
        var p = typeCast(FinancialIndicatorView.$, b);
        if (p.ca) {
            p.b8.prepareLineCore(a.p, this.trendLineType, this.indicatorColumn, o, function (q) { return _this.t9.ej(q, h); }, function (q) { return _this.uv.ej(q, i); }, ((function () {
                var $ret = new TrendResolutionParams();
                $ret.e = b.b0.b;
                $ret.f = b.b0.c;
                $ret.g = b.b0.d;
                $ret.a = m;
                $ret.d = _this.hj;
                $ret.h = d;
                $ret.i = c;
                $ret.b = l;
                $ret.c = k;
                return $ret;
            })()));
        }
        var q = this.t9.em(2, h) - this.t9.em(1, h);
        for (var r = b.b0.c; r <= b.b0.d; ++r) {
            var s = void 0;
            if (n == null) {
                s = b.b0.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.b0.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.t9.ej(u, h);
                }
                s = [z, v, w];
            }
            if (!isNaN_(s[0])) {
                if (this.t9 != null && typeCast(ISortingAxis_$type, this.t9) !== null) {
                    s[0] = s[0] + m;
                }
                else {
                    s[0] = f.ej(s[0], h) + m;
                }
                s[1] = g.ej(s[1], i);
                if (b.b0.b > 1 || n != null) {
                    s[2] = g.ej(s[2], i);
                }
                else {
                    s[2] = s[1];
                }
                a.f.add(s);
            }
        }
        return;
    };
    FinancialIndicator.prototype.nj = function (a, b) {
        _super.prototype.nj.call(this, a, b);
        var c = b;
        c.cb(a);
        if (c.ca) {
            c.b8.g$d();
        }
    };
    FinancialIndicator.prototype.uj = function () {
        switch (this.x6) {
            case 1: return 1;
            case 2: return 1;
            case 0: return 12;
        }
        return 1;
    };
    FinancialIndicator.prototype.xh = function (a, b) {
        _super.prototype.xh.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.ca) {
            c.b8.g$d();
            c.b8.g$g(a.p);
        }
        var f = b.bx;
        var g = this.getEffectiveViewport1(b);
        var h = 0;
        var i = this.ss;
        var j = this.xz;
        if (b.b3(a)) {
            c.cb(false);
            if (a.f.count > 0) {
                switch (this.x6) {
                    case 0:
                        var k = CategorySeries.vg(a.f, a.f.count - 1, f, b.by, false);
                        c.cf(a.f.count, d, e, true, k);
                        break;
                    case 1:
                        if (this.uv != null) {
                            h = this.v4(b);
                        }
                        else {
                            h = 0.5 * (f.top + f.bottom);
                        }
                        var l = CategorySeries.vg(a.f, a.f.count - 1, f, b.by, false);
                        c.cd(a.f.count, d, e, true, h, l);
                        break;
                    case 2:
                        h = this.v4(b);
                        c.ce(a.f.count, d, e, true, h);
                        break;
                    default: throw new NotImplementedException(0);
                }
            }
            b.b5(a);
        }
        var m = a.f;
        var n = this.c6.count;
        this.ui.a2(this, this.vh(), runOn(this, this.t1), this.v6(b), this.v8(b));
        var o = false;
        var p = this.ui.b;
        if (p != null) {
            o = true;
        }
        this.ui.ak = i;
        this.ui.ag = i;
        if (o) {
            var q = new ScalerParams(0, b.by, b.bx, this.t9.ch, g);
            this.ui.f = false;
            this.xe(m, -1, n, this.t9, q, b.q);
        }
        this.ui.ad(c.cx, true, false, true, false);
        this.ui.ad(c.cz, true, false, true, false);
        this.ui.ad(c.cy, false, true, false, false);
        c.cy._opacity = 0.8 * this.ui.j * this.hf;
        this.ui.ad(c.cw, true, false, false, false);
        this.ui.ak = j;
        this.ui.ag = j;
        if (o) {
            var r = new ScalerParams(0, b.by, b.bx, this.t9.ch, g);
            this.ui.f = true;
            this.xe(m, -1, n, this.t9, r, b.q);
        }
        this.ui.ad(c.ct, true, false, true, false);
        this.ui.ad(c.cv, true, false, true, false);
        this.ui.ad(c.cu, false, true, false, false);
        c.cu._opacity = 0.8 * this.ui.j * this.hf;
        this.ui.ad(c.cs, true, false, false, false);
        c.ch();
    };
    FinancialIndicator.prototype.qd = function () {
        _super.prototype.qd.call(this);
        if (this.index < 0) {
            return;
        }
        if (this.x4.ca) {
            this.x4.ci();
        }
    };
    FinancialIndicator.prototype.yi = function () {
        if (this.x4.ca) {
            this.x4.b8.g$i();
        }
        this.x7(0, this.indicatorColumn.count);
        if (this.uv != null && !this.uv.c1()) {
            this.pp(this.fq && this.dn);
        }
    };
    FinancialIndicator.prototype.n1 = function (a) {
        _super.prototype.n1.call(this, a);
        this.a9.exportTrendlineData(this, a, this.x4.b8.g$j);
    };
    FinancialIndicator.prototype.bb = function (a) {
        if (this.x6 == 1 || this.x6 == 2) {
            return 3;
        }
        else if (this.x6 == 0) {
            return 2;
        }
        return a;
    };
    FinancialIndicator.$t = markType(FinancialIndicator, 'FinancialIndicator', FinancialSeries.$, [ITrendLineSeries_$type]);
    FinancialIndicator.yk = 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:x6:yl', [IndicatorDisplayType_$type, enumGetBox(IndicatorDisplayType_$type, 0)], 'IgnoreFirst:yc:ym', [1, 0], 'TrendLineType::ys', [TrendLineType_$type, enumGetBox(TrendLineType_$type, 0)], 'TrendLineThickness::yr', [1, 1.5], 'TrendLinePeriod::yq', [1, 7], 'TrendLineBrush::yn', [Brush.$, null], 'TrendLineZIndex:yd:yt', [1, 1001], 'TrendLineDashArray:yv:yo', [DoubleCollection.$], 'TrendLineDashCap:yw:yp', [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.b6.indicatorColumn.count - 1);
        var d = NaN;
        var e = NaN;
        for (var f = b; f <= c; ++f) {
            var g = this.f.b6.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.b6 = null;
        _this.b9 = null;
        _this.cx = ((function () {
            var $ret = new Path();
            $ret.an = new PathGeometry();
            return $ret;
        })());
        _this.ct = ((function () {
            var $ret = new Path();
            $ret.an = new PathGeometry();
            return $ret;
        })());
        _this.cy = ((function () {
            var $ret = new Path();
            $ret.an = new PathGeometry();
            return $ret;
        })());
        _this.cu = ((function () {
            var $ret = new Path();
            $ret.an = new PathGeometry();
            return $ret;
        })());
        _this.cz = ((function () {
            var $ret = new Path();
            $ret.an = new PathGeometry();
            return $ret;
        })());
        _this.cv = ((function () {
            var $ret = new Path();
            $ret.an = new PathGeometry();
            return $ret;
        })());
        _this.cw = ((function () {
            var $ret = new Path();
            $ret.an = new GeometryGroup();
            return $ret;
        })());
        _this.cs = ((function () {
            var $ret = new Path();
            $ret.an = new GeometryGroup();
            return $ret;
        })());
        _this.b7 = null;
        _this.cp = new Path();
        _this.cr = new Path();
        _this.cq = new Path();
        _this.co = new Path();
        _this.cl = new Path();
        _this.cn = new Path();
        _this.cm = new Path();
        _this.ck = new Path();
        _this.b6 = a;
        _this.b9 = ((function () {
            var $ret = new Pool$1(LineGeometry.$);
            $ret.create = runOn(_this, _this.cj);
            $ret.destroy = runOn(_this, _this.cc);
            return $ret;
        })());
        return _this;
    }
    FinancialIndicatorView.prototype.b1 = function () {
        return new FinancialIndicatorBucketCalculator(this);
    };
    FinancialIndicatorView.prototype.au = function () {
        _super.prototype.au.call(this);
        if (!this.q) {
            this.b6.xz = Defaults.ah;
            this.b6.x6 = this.b6.x5;
        }
    };
    FinancialIndicatorView.prototype.cj = function () {
        return new LineGeometry();
    };
    FinancialIndicatorView.prototype.cc = function (a) {
    };
    Object.defineProperty(FinancialIndicatorView.prototype, "b8", {
        get: function () {
            if (this.b7 == null) {
                this.b7 = CategoryTrendLineManagerFactory.a(this.b7, this.e.as(), this.e.qr, this.e, this.e.c9);
            }
            return this.b7;
        },
        set: function (a) {
            this.b7 = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(FinancialIndicatorView.prototype, "ca", {
        get: function () {
            return this.b7 != null;
        },
        enumerable: false,
        configurable: true
    });
    FinancialIndicatorView.prototype.cb = function (a) {
        Extensions.e(this.cx.an);
        Extensions.e(this.cy.an);
        Extensions.e(this.cz.an);
        Extensions.e(this.ct.an);
        Extensions.e(this.cu.an);
        Extensions.e(this.cv.an);
        Extensions.d(this.cw.an);
        Extensions.d(this.cs.an);
        if (a) {
            this.b9.count = 0;
        }
        this.as();
    };
    FinancialIndicatorView.prototype.ch = function () {
    };
    FinancialIndicatorView.prototype.cf = function (a, b, c, d, e) {
        IndicatorRenderer.g(a, b, c, d, this.by, this.bx, this.cx, this.ct, this.b0.b, this.e.hj, e);
        this.as();
    };
    FinancialIndicatorView.prototype.cd = function (a, b, c, d, e, f) {
        IndicatorRenderer.e(a, b, c, d, this.by, this.bx, this.cx, this.cy, this.ct, this.cu, e, this.b0.b, this.e.hj, f);
        this.as();
    };
    FinancialIndicatorView.prototype.ce = function (a, b, c, d, e) {
        IndicatorRenderer.f(a, b, c, d, this.bx, e, this.b9, this.cw, this.cs);
        this.as();
    };
    FinancialIndicatorView.prototype.ci = function () {
        this.b6.yu = null;
        if (this.b6.trendLineBrush != null) {
            this.b6.yu = this.b6.trendLineBrush;
        }
        else {
            this.b6.yu = this.b6.ss;
        }
    };
    FinancialIndicatorView.prototype.be = function () {
        _super.prototype.be.call(this);
        var a = this.br();
        this.cp.an = this.cx.an;
        this.cr.an = this.cz.an;
        this.cq.an = this.cy.an;
        this.co.an = this.cw.an;
        this.cl.an = this.ct.an;
        this.cn.an = this.cv.an;
        this.cm.an = this.cu.an;
        this.ck.an = this.cs.an;
        this.cp._stroke = a;
        this.cr._stroke = a;
        this.cp.ad = this.e.hk + 3;
        this.cr.ad = this.e.hk + 3;
        this.cq._fill = a;
        this.cq._opacity = 1;
        this.co._stroke = a;
        this.co.ad = this.e.hk + 3;
        this.cl._stroke = a;
        this.cn._stroke = a;
        this.cl.ad = this.e.hk + 3;
        this.cn.ad = this.e.hk + 3;
        this.cm._fill = a;
        this.cm._opacity = 1;
        this.ck._stroke = a;
        this.ck.ad = this.e.hk + 3;
    };
    FinancialIndicatorView.prototype.a8 = function (a, b) {
        _super.prototype.a8.call(this, a, b);
        if (a.d) {
            if (b) {
                if (this.b6.x6 == 2) {
                    a.t(this.co);
                    a.t(this.ck);
                }
                else {
                    a.t(this.cq);
                    a.t(this.cp);
                    a.t(this.cr);
                    a.t(this.cm);
                    a.t(this.cl);
                    a.t(this.cn);
                }
            }
            else {
                if (this.b6.x6 == 2) {
                    a.t(this.cw);
                    a.t(this.cs);
                }
                else {
                    a.t(this.cy);
                    a.t(this.cx);
                    a.t(this.cz);
                    a.t(this.cu);
                    a.t(this.ct);
                    a.t(this.cv);
                }
            }
        }
    };
    FinancialIndicatorView.prototype.a7 = function (a, b) {
        if (a.d) {
            if (this.b6.trendLineType != 0 && !b) {
                var c = this.b8.g$j;
                c.ad = this.b6.trendLineThickness;
                c._stroke = this.b6.yu;
                c.aj = this.b6.yw;
                c.ai = this.b6.yv;
                a.v(c);
            }
        }
        _super.prototype.a7.call(this, a, b);
    };
    FinancialIndicatorView.prototype.an = function (a) {
        _super.prototype.an.call(this, a);
        this.e.a9.exportPathData(a, this.cw, "positiveColumnsShape", ["Positive", "Main"]);
        this.e.a9.exportPathData(a, this.cs, "negativeColumnsShape", ["Negative"]);
        this.e.a9.exportPathData(a, this.cx, "positive0", ["Positive", "Main"]);
        this.e.a9.exportPathData(a, this.cz, "positive1", ["Positive"]);
        this.e.a9.exportPathData(a, this.cy, "positive01", ["PositiveFill"]);
        this.e.a9.exportPathData(a, this.ct, "negative0", ["Negative", "Main"]);
        this.e.a9.exportPathData(a, this.cv, "negative1", ["Negative"]);
        this.e.a9.exportPathData(a, this.cu, "negative01", ["NegativeFill"]);
    };
    FinancialIndicatorView.prototype.cg = function () {
        if (this.ca) {
            this.b7 = CategoryTrendLineManagerFactory.a(this.b7, this.e.as(), this.e.qr, this.e, this.e.c9);
        }
    };
    FinancialIndicatorView.$t = markType(FinancialIndicatorView, 'FinancialIndicatorView', FinancialSeriesView.$);
    return FinancialIndicatorView;
}(FinancialSeriesView));
export { FinancialIndicatorView };
