/*
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-react-core/ES5/DependencyProperty";
import { TrendLineType_$type } from "igniteui-react-core/ES5/TrendLineType";
import { Brush } from "igniteui-react-core/ES5/Brush";
import { PenLineCap_$type } from "igniteui-react-core/ES5/PenLineCap";
import { DoubleCollection } from "igniteui-react-core/ES5/DoubleCollection";
import { List$1 } from "igniteui-react-core/ES5/List$1";
import { AxisRange } from "./AxisRange";
import { CategoryFrame } from "./CategoryFrame";
import { Type, Number_$type, typeCast, enumGetBox, EnumUtil, runOn, markType } from "igniteui-react-core/ES5/type";
import { Rect } from "igniteui-react-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-react-core/ES5/NotImplementedException";
import { Path } from "igniteui-react-core/ES5/Path";
import { PropertyMetadata } from "igniteui-react-core/ES5/PropertyMetadata";
import { isNaN_ } from "igniteui-react-core/ES5/number";
import { PathGeometry } from "igniteui-react-core/ES5/PathGeometry";
import { GeometryGroup } from "igniteui-react-core/ES5/GeometryGroup";
import { Pool$1 } from "igniteui-react-core/ES5/Pool$1";
import { LineGeometry } from "igniteui-react-core/ES5/LineGeometry";
import { Extensions } from "igniteui-react-core/ES5/Extensions";
import { IndicatorRenderer } from "./IndicatorRenderer";
var FinancialIndicator = /** @class */ (function (_super) {
    tslib_1.__extends(FinancialIndicator, _super);
    function FinancialIndicator() {
        var _this = _super.call(this) || this;
        _this._indicatorColumn = null;
        _this.o6 = null;
        _this.lz = new CategoryFrame(3);
        _this.l1 = new CategoryFrame(3);
        _this.ly = new CategoryFrame(3);
        _this.indicatorColumn = new List$1(Number_$type, 0);
        _this.o6 = new AxisRange(-100, 100);
        return _this;
    }
    FinancialIndicator.prototype.bf = function () {
        return new FinancialIndicatorView(this);
    };
    FinancialIndicator.prototype.ii = function (a) {
        _super.prototype.ii.call(this, a);
        this.o7 = a;
    };
    FinancialIndicator.prototype.pj = function (a) {
        if (this.mg != null && !this.mg.ck()) {
            this.i1(true);
        }
    };
    FinancialIndicator.prototype.pb = function (a, b, c) {
        if (isNaN_(b.x) || isNaN_(b.y)) {
            return false;
        }
        var d = this.mg;
        var e = 0;
        if (d != null) {
            e = d.d8(d.j6);
        }
        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.li = function (a) {
        if (this.lw == null || this.mg == null) {
            return Rect.empty;
        }
        var b = this.k4(a);
        var c = this.bi.bq;
        var d = this.bi.bp;
        var e = this.getEffectiveViewport1(this.bi);
        var f = new ScalerParams(0, c, d, this.mg.b8, e);
        var g = this.aj(this.lw, this.ly.f, this.nr(this.bi), this.nt(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.mg.dt(this.mg.j6, 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.de = function (a, b) {
        var c = this.k9(this.lc(a), true, false);
        if (this.o8 == 1) {
            if (this.pb(a, c, b)) {
                return true;
            }
        }
        if (this.o8 == 1 || this.o8 == 0) {
            if (this.dd(a, b)) {
                return true;
            }
        }
        if (this.o8 == 2) {
            if (this.dh(a, b)) {
                return true;
            }
        }
        return false;
    };
    FinancialIndicator.prototype.ho = function (a, b, c, d) {
        _super.prototype.ho.call(this, a, b, c, d);
        if (this.lw != null && typeCast(ISortingAxis_$type, this.lw) !== null) {
            this.lw.i$i();
        }
        if (this.o7.b2) {
            this.o7.b0.g$e(a, b, c, d);
        }
        if (d != null && this.m6.containsKey(d)) {
            var e = this.m6.tryGetValue(d, d);
            d = e.p1;
        }
        if (this.lw != null && typeCast(ISortingAxis_$type, this.lw) !== null) {
            a = 4;
            b = 0;
            c = this.bz.count;
        }
        switch (a) {
            case 3:
                if (this.pa(b, c, d)) {
                    this.pl(b, c, d);
                    this.pj(true);
                }
                break;
            case 2:
                if (this.pa(b, this.bz.count - b, d)) {
                    this.pl(b, this.bz.count - b, d);
                    this.pj(true);
                }
                break;
            case 1:
                if (this.pa(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.pl(b, this.bz.count - b, d);
                    this.pj(true);
                }
                break;
            case 0:
                if (this.pa(b, this.bz.count - b, d)) {
                    this.indicatorColumn.v(b, c);
                    this.pl(b, this.bz.count - b, d);
                    this.pj(true);
                }
                break;
            case 4:
                if (this.pa(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.pl(b, this.bz.count - b, d);
                    this.pj(true);
                }
                break;
        }
    };
    Object.defineProperty(FinancialIndicator.prototype, "pw", {
        get: function () {
            return this.c(FinancialIndicator.pm);
        },
        set: function (a) {
            this.h(FinancialIndicator.pm, a);
        },
        enumerable: true,
        configurable: true
    });
    FinancialIndicator.prototype.pg = 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.io = function (a, b, c, d) {
        switch (b) {
            case "XAxis":
                this.o7.b8();
                break;
            case "TrendLineType":
                var e = EnumUtil.getEnumValue(TrendLineType_$type, d);
                if (e != 0) {
                    this.o7.b0 = CategoryTrendLineManagerFactory.a(this.o7.b0, this.lw, this.jl, this, this.b2);
                }
                break;
        }
        _super.prototype.io.call(this, a, b, c, d);
        if (this.o7.b2 && this.o7.b0.g$b(a, b, c, d)) {
            this.i1(false);
            var f = typeCast(FinancialIndicatorView.$, this.bh);
            if (f != null && f.b2) {
                f.b0.g$b(a, b, c, d);
            }
            this.h8();
        }
        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.pl(0, this.bz.count, null);
                    if (this.mg != null && !this.mg.ck()) {
                        this.mc.bs.e(this.eo);
                        this.i1(false);
                    }
                }
                break;
            case "TrendLineBrush":
                this.jc();
                break;
            case FinancialIndicator.$$p[0]:
                this.hl(true, this.bi);
                this.i1(false);
                this.h8();
                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.pa(0, this.bz.count - 1, b)) {
                        this.pk();
                    }
                }
                break;
            case "XAxis":
                if (this.lw != null && (typeCast(ISortingAxis_$type, this.lw) !== null || typeCast(ISortingAxis_$type, c) !== null)) {
                    this.pk();
                }
                break;
            case "YAxis":
            case FinancialIndicator.$$p[1]:
                this.pk();
                this.h8();
                break;
            case "TrendLineType":
                this.h8();
                break;
        }
    };
    FinancialIndicator.prototype.eh = function (a, b, c) {
        if (this.indicatorColumn == null) {
            return _super.prototype.eh.call(this, a, b, c);
        }
        var d = this.getEffectiveViewport1(this.bi);
        var e = this.nl(this.bi.bq, this.bi.bp, d);
        var f = new ScalerParams(0, this.bi.bq, this.bi.bp, this.lw.b8, d);
        f.c = this.bs.mx;
        return this.ej(this.indicatorColumn, a, this.lw, f, e, runOn(this, this.nk), b, c);
    };
    FinancialIndicator.prototype.e8 = function (a, b) {
        if (this.indicatorColumn == null) {
            return _super.prototype.e8.call(this, a, b);
        }
        return this.e9(a, b, this.lw, runOn(this, this.nk), this.indicatorColumn);
    };
    FinancialIndicator.prototype.e6 = function (a, b) {
        if (this.indicatorColumn == null) {
            return _super.prototype.e6.call(this, a, b);
        }
        return this.e7(a, b, this.lw, runOn(this, this.nk), this.indicatorColumn);
    };
    FinancialIndicator.prototype.get_ds = function () {
        return true;
    };
    Object.defineProperty(FinancialIndicator.prototype, "ds", {
        get: function () {
            return this.get_ds();
        },
        enumerable: true,
        configurable: true
    });
    FinancialIndicator.prototype.pa = function (a, b, c) {
        if (c == null) {
            return true;
        }
        if (this.pc(a, b).contains(c)) {
            return true;
        }
        return false;
    };
    FinancialIndicator.prototype.pl = function (a, b, c) {
        this.o9(a, b);
    };
    FinancialIndicator.prototype.an = function (a) {
        if (this.bz == null) {
            return null;
        }
        if (a != null && a == this.mg) {
            return this.o6;
        }
        return null;
    };
    FinancialIndicator.prototype.c6 = function (a) {
        var b = this.bz != null ? this.bz.indexOf(a) : -1;
        var c = this.bi.bq;
        c = c.copy();
        var d = this.bi.bp;
        var e = new Rect(0, 0, 0, 1, 1);
        var f = this.lg(this.bi);
        if (b >= 0 && Rect.l_op_Inequality(c, null) && Rect.l_op_Inequality(d, null)) {
            if (this.lw != null) {
                var g = new ScalerParams(0, e, e, this.lw.b8, f);
                var h = this.lw.dt(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.mg != null && this.indicatorColumn != null && b < this.indicatorColumn.count) {
                var i = new ScalerParams(0, e, e, this.mg.b8, f);
                var j = this.mg.dt(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.dt = function (a, b, c) {
        var d = _super.prototype.dt.call(this, a, b, c);
        if (this.indicatorColumn == null || this.indicatorColumn.count == 0) {
            d = false;
        }
        return d;
    };
    FinancialIndicator.prototype.ol = function (a, b) {
        var _this = this;
        _super.prototype.ol.call(this, a, b);
        var c = b.bq;
        var d = b.bp;
        var e = this.getEffectiveViewport1(b);
        var f = this.lw;
        var g = this.mg;
        var h = new ScalerParams(0, c, d, f.b8, e);
        var i = new ScalerParams(0, c, d, g.b8, e);
        a.f.clear();
        a.m.clear();
        a.p.clear();
        var j = 0;
        var k = typeCast(ISortingAxis_$type, this.lw);
        if (k != null && k.i$b.count != this.bz.count) {
            return;
        }
        j = this.nl(c, d, e);
        var l = this.pg();
        if (l == -1) {
            l = this.trendLinePeriod;
        }
        var m = typeCast(FinancialIndicatorView.$, b);
        if (m.b2) {
            m.b0.prepareLineCore(a.p, this.trendLineType, this.indicatorColumn, l, function (n) { return _this.lw.dt(n, h); }, function (n) { return _this.mg.dt(n, i); }, ((function () {
                var $ret = new TrendResolutionParams();
                $ret.c = b.bs.b;
                $ret.d = b.bs.c;
                $ret.e = b.bs.d;
                $ret.a = j;
                $ret.b = _this.eo;
                $ret.f = d;
                $ret.g = c;
                return $ret;
            })()));
        }
        var n = this.lw.dw(2, h) - this.lw.dw(1, h);
        for (var o = b.bs.c; o <= b.bs.d; ++o) {
            var p = void 0;
            if (k == null) {
                p = b.bs.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.bs.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.lw.dt(r, h);
                }
                p = [w, s, t];
            }
            if (!isNaN_(p[0])) {
                if (this.lw != null && typeCast(ISortingAxis_$type, this.lw) !== null) {
                    p[0] = p[0] + j;
                }
                else {
                    p[0] = f.dt(p[0], h) + j;
                }
                p[1] = g.dt(p[1], i);
                if (b.bs.b > 1 || k != null) {
                    p[2] = g.dt(p[2], i);
                }
                else {
                    p[2] = p[1];
                }
                a.f.add(p);
            }
        }
        return;
    };
    FinancialIndicator.prototype.hl = function (a, b) {
        _super.prototype.hl.call(this, a, b);
        var c = b;
        c.b3(a);
        if (c.b2) {
            c.b0.g$d();
        }
    };
    FinancialIndicator.prototype.l5 = function () {
        switch (this.o8) {
            case 1: return 1;
            case 2: return 1;
            case 0: return 12;
        }
        return 1;
    };
    FinancialIndicator.prototype.on = function (a, b) {
        _super.prototype.on.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.b2) {
            c.b0.g$d();
            c.b0.g$g(a.p);
        }
        var f = b.bp;
        var g = this.getEffectiveViewport1(b);
        var h = 0;
        var i = this.kr;
        var j = this.o0;
        if (b.bv(a)) {
            c.b3(false);
            if (a.f.count > 0) {
                switch (this.o8) {
                    case 0:
                        var k = CategorySeries.mp(a.f, a.f.count - 1, f, b.bq, false);
                        c.b7(a.f.count, d, e, true, k);
                        break;
                    case 1:
                        if (this.mg != null) {
                            h = this.np(b);
                        }
                        else {
                            h = 0.5 * (f.top + f.bottom);
                        }
                        var l = CategorySeries.mp(a.f, a.f.count - 1, f, b.bq, false);
                        c.b5(a.f.count, d, e, true, h, l);
                        break;
                    case 2:
                        h = this.np(b);
                        c.b6(a.f.count, d, e, true, h);
                        break;
                    default: throw new NotImplementedException(0);
                }
            }
            b.bx(a);
        }
        var m = a.f;
        var n = this.bz.count;
        this.l4.x(this, this.m2(), this.lw, runOn(this, this.lo), this.nr(b), this.nt(b));
        var o = false;
        var p = this.l4.c;
        if (p != null) {
            o = true;
        }
        this.l4.al = i;
        this.l4.ah = i;
        if (o) {
            var q = new ScalerParams(0, b.bq, b.bp, this.lw.b8, g);
            this.l4.f = false;
            this.ok(m, -1, n, this.lw, q, b.n);
        }
        this.l4.ae(c.cp, true, false, true, false);
        this.l4.ae(c.cr, true, false, true, false);
        this.l4.ae(c.cq, false, true, false, false);
        c.cq._opacity = 0.8 * this.l4.i * this.d1;
        this.l4.ae(c.co, true, false, false, false);
        this.l4.al = j;
        this.l4.ah = j;
        if (o) {
            var r = new ScalerParams(0, b.bq, b.bp, this.lw.b8, g);
            this.l4.f = true;
            this.ok(m, -1, n, this.lw, r, b.n);
        }
        this.l4.ae(c.cl, true, false, true, false);
        this.l4.ae(c.cn, true, false, true, false);
        this.l4.ae(c.cm, false, true, false, false);
        c.cm._opacity = 0.8 * this.l4.i * this.d1;
        this.l4.ae(c.ck, true, false, false, false);
        c.b9();
    };
    FinancialIndicator.prototype.jc = function () {
        _super.prototype.jc.call(this);
        if (this.fb < 0) {
            return;
        }
        if (this.o7.b2) {
            this.o7.ca();
        }
    };
    FinancialIndicator.prototype.pk = function () {
        if (this.o7.b2) {
            this.o7.b0.g$i();
        }
        this.o9(0, this.indicatorColumn.count);
        if (this.mg != null && !this.mg.ck()) {
            this.i1(false);
        }
    };
    FinancialIndicator.prototype.hu = function (a) {
        _super.prototype.hu.call(this, a);
        this.a2.exportTrendlineData(this, a, this.o7.b0.g$j);
    };
    FinancialIndicator.pm = DependencyProperty.i("ActualTrendLineBrush", Brush.$, FinancialIndicator.$, new PropertyMetadata(2, null, function (a, b) { return a.raisePropertyChanged("ActualTrendLineBrush", b.oldValue, b.newValue); }));
    FinancialIndicator.$t = markType(FinancialIndicator, 'FinancialIndicator', FinancialSeries.$, [ITrendLineSeries_$type]);
    return FinancialIndicator;
}(FinancialSeries));
export { FinancialIndicator };
Type.dep(DependencyProperty, PropertyMetadata, FinancialIndicator, 'raisePropertyChanged', ['DisplayType:o8:pn', [IndicatorDisplayType_$type, enumGetBox(IndicatorDisplayType_$type, 0)], 'IgnoreFirst:pe:po', [1, 0], 'TrendLineType::pu', [TrendLineType_$type, enumGetBox(TrendLineType_$type, 0)], 'TrendLineThickness::pt', [1, 1.5], 'TrendLinePeriod::ps', [1, 7], 'TrendLineBrush::pp', [Brush.$, null], 'TrendLineZIndex:pf:pv', [1, 1001], 'TrendLineDashArray:px:pq', [DoubleCollection.$], 'TrendLineDashCap:py:pr', [PenLineCap_$type, enumGetBox(PenLineCap_$type, 0)]]);
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.by.indicatorColumn.count - 1);
        var d = NaN;
        var e = NaN;
        for (var f = b; f <= c; ++f) {
            var g = this.f.by.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 };
var FinancialIndicatorView = /** @class */ (function (_super) {
    tslib_1.__extends(FinancialIndicatorView, _super);
    function FinancialIndicatorView(a) {
        var _this = _super.call(this, a) || this;
        _this.by = null;
        _this.b1 = null;
        _this.cp = ((function () {
            var $ret = new Path();
            $ret.aj = new PathGeometry();
            return $ret;
        })());
        _this.cl = ((function () {
            var $ret = new Path();
            $ret.aj = new PathGeometry();
            return $ret;
        })());
        _this.cq = ((function () {
            var $ret = new Path();
            $ret.aj = new PathGeometry();
            return $ret;
        })());
        _this.cm = ((function () {
            var $ret = new Path();
            $ret.aj = new PathGeometry();
            return $ret;
        })());
        _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.co = ((function () {
            var $ret = new Path();
            $ret.aj = new GeometryGroup();
            return $ret;
        })());
        _this.ck = ((function () {
            var $ret = new Path();
            $ret.aj = new GeometryGroup();
            return $ret;
        })());
        _this.bz = null;
        _this.ch = new Path();
        _this.cj = new Path();
        _this.ci = new Path();
        _this.cg = new Path();
        _this.cd = new Path();
        _this.cf = new Path();
        _this.ce = new Path();
        _this.cc = new Path();
        _this.by = a;
        _this.b1 = ((function () {
            var $ret = new Pool$1(LineGeometry.$);
            $ret.create = runOn(_this, _this.cb);
            $ret.destroy = runOn(_this, _this.b4);
            return $ret;
        })());
        return _this;
    }
    FinancialIndicatorView.prototype.bt = function () {
        return new FinancialIndicatorBucketCalculator(this);
    };
    FinancialIndicatorView.prototype.ap = function () {
        _super.prototype.ap.call(this);
        if (!this.n) {
            this.bu.o0 = ((function () {
                var $ret = new Brush();
                $ret.fill = "#C62828";
                return $ret;
            })());
            this.bu.es = 2;
        }
    };
    FinancialIndicatorView.prototype.cb = function () {
        return new LineGeometry();
    };
    FinancialIndicatorView.prototype.b4 = function (a) {
    };
    Object.defineProperty(FinancialIndicatorView.prototype, "b0", {
        get: function () {
            if (this.bz == null) {
                this.bz = CategoryTrendLineManagerFactory.a(this.bz, this.e.ap(), this.e.jl, this.e, this.e.b2);
            }
            return this.bz;
        },
        set: function (a) {
            this.bz = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialIndicatorView.prototype, "b2", {
        get: function () {
            return this.bz != null;
        },
        enumerable: true,
        configurable: true
    });
    FinancialIndicatorView.prototype.b3 = function (a) {
        Extensions.e(this.cp.aj);
        Extensions.e(this.cq.aj);
        Extensions.e(this.cr.aj);
        Extensions.e(this.cl.aj);
        Extensions.e(this.cm.aj);
        Extensions.e(this.cn.aj);
        Extensions.d(this.co.aj);
        Extensions.d(this.ck.aj);
        if (a) {
            this.b1.count = 0;
        }
        this.an();
    };
    FinancialIndicatorView.prototype.b9 = function () {
    };
    FinancialIndicatorView.prototype.b7 = function (a, b, c, d, e) {
        IndicatorRenderer.g(a, b, c, d, this.bq, this.bp, this.cp, this.cl, this.bs.b, this.e.eo, e);
        this.an();
    };
    FinancialIndicatorView.prototype.b5 = function (a, b, c, d, e, f) {
        IndicatorRenderer.e(a, b, c, d, this.bq, this.bp, this.cp, this.cq, this.cl, this.cm, e, this.bs.b, this.e.eo, f);
        this.an();
    };
    FinancialIndicatorView.prototype.b6 = function (a, b, c, d, e) {
        IndicatorRenderer.f(a, b, c, d, this.bp, e, this.b1, this.co, this.ck);
        this.an();
    };
    FinancialIndicatorView.prototype.ca = function () {
        this.by.pw = null;
        if (this.by.trendLineBrush != null) {
            this.by.pw = this.by.trendLineBrush;
        }
        else {
            this.by.pw = this.by.kr;
        }
    };
    FinancialIndicatorView.prototype.a9 = function () {
        _super.prototype.a9.call(this);
        var a = this.bk();
        this.ch.aj = this.cp.aj;
        this.cj.aj = this.cr.aj;
        this.ci.aj = this.cq.aj;
        this.cg.aj = this.co.aj;
        this.cd.aj = this.cl.aj;
        this.cf.aj = this.cn.aj;
        this.ce.aj = this.cm.aj;
        this.cc.aj = this.ck.aj;
        this.ch._stroke = a;
        this.cj._stroke = a;
        this.ch.ac = this.e.es + 3;
        this.cj.ac = this.e.es + 3;
        this.ci._fill = a;
        this.ci._opacity = 1;
        this.cg._stroke = a;
        this.cg.ac = this.e.es + 3;
        this.cd._stroke = a;
        this.cf._stroke = a;
        this.cd.ac = this.e.es + 3;
        this.cf.ac = this.e.es + 3;
        this.ce._fill = a;
        this.ce._opacity = 1;
        this.cc._stroke = a;
        this.cc.ac = this.e.es + 3;
    };
    FinancialIndicatorView.prototype.a3 = function (a, b) {
        _super.prototype.a3.call(this, a, b);
        if (a.d) {
            if (b) {
                if (this.by.o8 == 2) {
                    a.s(this.cg);
                    a.s(this.cc);
                }
                else {
                    a.s(this.ci);
                    a.s(this.ch);
                    a.s(this.cj);
                    a.s(this.ce);
                    a.s(this.cd);
                    a.s(this.cf);
                }
            }
            else {
                if (this.by.o8 == 2) {
                    a.s(this.co);
                    a.s(this.ck);
                }
                else {
                    a.s(this.cq);
                    a.s(this.cp);
                    a.s(this.cr);
                    a.s(this.cm);
                    a.s(this.cl);
                    a.s(this.cn);
                }
            }
        }
    };
    FinancialIndicatorView.prototype.a2 = function (a, b) {
        if (a.d) {
            if (this.by.trendLineType != 0 && !b) {
                var c = this.b0.g$j;
                c.ac = this.by.trendLineThickness;
                c._stroke = this.by.pw;
                c.ad = this.by.py;
                c.ai = this.by.px;
                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.co, "positiveColumnsShape", ["Positive", "Main"]);
        this.e.a2.exportPathData(a, this.ck, "negativeColumnsShape", ["Negative"]);
        this.e.a2.exportPathData(a, this.cp, "positive0", ["Positive", "Main"]);
        this.e.a2.exportPathData(a, this.cr, "positive1", ["Positive"]);
        this.e.a2.exportPathData(a, this.cq, "positive01", ["PositiveFill"]);
        this.e.a2.exportPathData(a, this.cl, "negative0", ["Negative", "Main"]);
        this.e.a2.exportPathData(a, this.cn, "negative1", ["Negative"]);
        this.e.a2.exportPathData(a, this.cm, "negative01", ["NegativeFill"]);
    };
    FinancialIndicatorView.prototype.b8 = function () {
        if (this.b2) {
            this.bz = CategoryTrendLineManagerFactory.a(this.bz, this.e.ap(), this.e.jl, this.e, this.e.b2);
        }
    };
    FinancialIndicatorView.$t = markType(FinancialIndicatorView, 'FinancialIndicatorView', FinancialSeriesView.$);
    return FinancialIndicatorView;
}(FinancialSeriesView));
export { FinancialIndicatorView };
/*<BeginStatics Name="Infragistics.Controls.Charts.FinancialIndicator" />*/
/*<EndStatics Name="Infragistics.Controls.Charts.FinancialIndicator" />*/
