/*
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 { TrendLineType_$type } from "igniteui-angular-core/ES5/TrendLineType";
import { DependencyProperty } from "igniteui-angular-core/ES5/DependencyProperty";
import { Brush } from "igniteui-angular-core/ES5/Brush";
import { PenLineCap_$type } from "igniteui-angular-core/ES5/PenLineCap";
import { DoubleCollection } from "igniteui-angular-core/ES5/DoubleCollection";
import { PriceDisplayType_$type } from "./PriceDisplayType";
import { Type, enumGetBox, EnumUtil, typeCast, fromEnum, runOn, Point_$type, markType } from "igniteui-angular-core/ES5/type";
import { CategoryFrame } from "./CategoryFrame";
import { ISortingAxis_$type } from "./ISortingAxis";
import { FinancialSeriesView } from "./FinancialSeriesView";
import { Series } from "./Series";
import { Rect } from "igniteui-angular-core/ES5/Rect";
import { List$1 } from "igniteui-angular-core/ES5/List$1";
import { RectUtil } from "igniteui-angular-core/ES5/RectUtil";
import { CategoryTrendLineManagerFactory } from "./CategoryTrendLineManagerFactory";
import { AxisRange } from "./AxisRange";
import { ScalerParams } from "./ScalerParams";
import { TrendResolutionParams } from "./TrendResolutionParams";
import { Pool$1 } from "igniteui-angular-core/ES5/Pool$1";
import { Path } from "igniteui-angular-core/ES5/Path";
import { PathGeometry } from "igniteui-angular-core/ES5/PathGeometry";
import { PathFigure } from "igniteui-angular-core/ES5/PathFigure";
import { LineSegment } from "igniteui-angular-core/ES5/LineSegment";
import { GeometryGroup } from "igniteui-angular-core/ES5/GeometryGroup";
import { LineGeometry } from "igniteui-angular-core/ES5/LineGeometry";
import { RectangleGeometry } from "igniteui-angular-core/ES5/RectangleGeometry";
import { PropertyMetadata } from "igniteui-angular-core/ES5/PropertyMetadata";
import { truncate, isNaN_ } from "igniteui-angular-core/ES5/number";
import { boxArray$1 } from "igniteui-angular-core/ES5/array";
import { FinancialPriceBucketCalculator } from "./FinancialPriceBucketCalculator";
import { Extensions } from "igniteui-angular-core/ES5/Extensions";
/**
 * @hidden
 */
var FinancialPriceSeries = /** @class */ (function (_super) {
    tslib_1.__extends(FinancialPriceSeries, _super);
    function FinancialPriceSeries() {
        var _this = _super.call(this) || this;
        _this.ab = FinancialPriceSeries.$;
        _this.l3 = new CategoryFrame(5);
        _this.l5 = new CategoryFrame(5);
        _this.l2 = new CategoryFrame(5);
        return _this;
    }
    FinancialPriceSeries.prototype.bf = function () {
        return new FinancialPriceSeriesView(this);
    };
    FinancialPriceSeries.prototype.im = function (a) {
        _super.prototype.im.call(this, a);
        this.pb = a;
    };
    Object.defineProperty(FinancialPriceSeries.prototype, "pv", {
        get: function () {
            return this.c(FinancialPriceSeries.pl);
        },
        set: function (a) {
            this.h(FinancialPriceSeries.pl, a);
        },
        enumerable: true,
        configurable: true
    });
    FinancialPriceSeries.prototype.hs = function (a, b, c, d) {
        _super.prototype.hs.call(this, a, b, c, d);
        if (this.l0 != null && typeCast(ISortingAxis_$type, this.l0) !== null) {
            this.l0.i$i();
        }
        this.pb.bu.e(this.er);
        if (this.pb.b4) {
            this.pb.b2.g$e(a, b, c, d);
        }
        if (this.ml != null) {
            this.ml.ck();
        }
        this.i5(true);
    };
    FinancialPriceSeries.prototype.bd = function () {
        if (this.be == 0) {
            return 1;
        }
        else {
            return _super.prototype.bd.call(this);
        }
    };
    FinancialPriceSeries.prototype.lm = function (a) {
        if (this.l2 == null || this.l2.f.count == 0) {
            return Rect.empty;
        }
        var b = this.k8(a);
        var c = this.bi.bs;
        var d = this.bi.br;
        var e = this.getEffectiveViewport1(this.bi);
        var f = this.aj(this.l0, this.l2.f, this.nx(this.bi), this.nz(this.bi), a, true);
        var g = f[0];
        var h = f[1];
        var i = Math.abs(b.x - g[0]);
        var j = Math.abs(b.x - h[0]);
        var k = this.pd(this.mg, e);
        k = Math.max(k, 3);
        var l = (k - 1) / 2;
        if (i < j) {
            var m = g[0] - l;
            var n = g[0];
            var o = g[0] + l;
            var p = g[1];
            var q = g[2];
            var r = g[3];
            var s = g[4];
            var t = Math.min(Math.min(Math.min(p, q), r), s);
            var u = Math.max(Math.max(Math.max(p, q), r), s);
            return new Rect(0, m, t, Math.abs(o - m), u - t);
        }
        else {
            var v = h[0] - l;
            var w = h[0];
            var x = h[0] + l;
            var y = h[1];
            var z = h[2];
            var aa = h[3];
            var ab = h[4];
            var ac = Math.min(Math.min(Math.min(y, z), aa), ab);
            var ad = Math.max(Math.max(Math.max(y, z), aa), ab);
            return new Rect(0, v, ac, Math.abs(x - v), ad - ac);
        }
    };
    FinancialPriceSeries.prototype.pa = function (a, b) {
        var c = a[0] - b;
        var d = a[0];
        var e = a[0] + b;
        var f = a[1];
        var g = a[2];
        var h = a[3];
        var i = a[4];
        var j = Math.min(Math.min(Math.min(f, g), h), i);
        var k = Math.max(Math.max(Math.max(f, g), h), i);
        var l = Math.min(g, h);
        var m = Math.max(g, h);
        var n = Math.min(f, i);
        var o = Math.max(f, i);
        if (this.pc == 1) {
            var p = new Array(3);
            var q = new Rect(0, c, f, b, 0);
            var r = new Rect(0, d, i, b, 0);
            var s = new Rect(0, d, l, 0, m - l);
            p[0] = q;
            p[1] = r;
            p[2] = s;
            return p;
        }
        else {
            var t = new Array(2);
            var u = new Rect(0, d, l, 0, m - l);
            var v = new Rect(0, c, n, b * 2, o - n);
            t[0] = u;
            t[1] = v;
            return t;
        }
    };
    FinancialPriceSeries.prototype.ak = function (a) {
        var b = new List$1(Rect.$, 0);
        var c = this.k8(a);
        var d = this.bi.bs;
        var e = this.bi.br;
        var f = this.getEffectiveViewport1(this.bi);
        var g = this.aj(this.l0, this.l2.f, this.nx(this.bi), this.nz(this.bi), a, true);
        var h = g[0];
        var i = g[1];
        var j = Math.abs(c.x - h[0]);
        var k = Math.abs(c.x - i[0]);
        var l = this.pd(this.mg, f);
        l = Math.max(l, 3);
        var m = (l - 1) / 2;
        if (j < k) {
            return this.pa(h, m);
        }
        else {
            return this.pa(i, m);
        }
    };
    FinancialPriceSeries.prototype.dg = function (a, b) {
        if (this.dj(a, b)) {
            return true;
        }
        return false;
    };
    FinancialPriceSeries.prototype.dj = function (a, b) {
        var c = this.ln(a);
        if (c.isEmpty) {
            return false;
        }
        var d = RectUtil.r(c, (this.ev / 2) + this.eb(b));
        if (d.containsPoint(a)) {
            var e = this.al(a);
            if (e != null) {
                for (var f = 0; f < e.length; f++) {
                    var g = e[f];
                    var h = RectUtil.r(g, (this.ev / 2) + this.eb(b));
                    if (h.containsPoint(a)) {
                        return true;
                    }
                }
            }
        }
        return false;
    };
    FinancialPriceSeries.prototype.is = function (a, b, c, d) {
        switch (b) {
            case FinancialSeries.$$p[9]:
                this.pb.ca();
                break;
            case "TrendLineType":
                var e = EnumUtil.getEnumValue(TrendLineType_$type, d);
                if (e != 0) {
                    this.pb.b2 = CategoryTrendLineManagerFactory.a(this.pb.b2, this.l0, this.jp, this, this.b2);
                }
                break;
        }
        _super.prototype.is.call(this, a, b, c, d);
        if (this.pb.b4 && this.pb.b2 != null && this.pb.b2.g$b(a, b, c, d)) {
            this.i5(false);
            this.ic();
        }
        switch (b) {
            case FinancialPriceSeries.$$p[0]:
                if (this.jp != null) {
                    this.pk();
                    this.l2.w();
                    this.ot(this.l2, this.pb);
                }
                this.ic();
                break;
            case "TrendLineBrush":
                this.jg();
                break;
            case "TrendLineType":
                this.ic();
                break;
            case FinancialSeries.$$p[5]:
            case FinancialPriceSeries.$$p[1]:
                this.ip();
                break;
        }
    };
    FinancialPriceSeries.prototype.pk = function () {
        this.pb.ce();
        if (this.bh != null) {
            this.bh.ce();
        }
    };
    FinancialPriceSeries.prototype.an = function (a) {
        if (a != null && a == this.ml && this.ms != null && !isNaN_(this.ms.minimum) && this.mq != null && !isNaN_(this.mq.maximum)) {
            return new AxisRange(this.ms.minimum, this.mq.maximum);
        }
        return null;
    };
    FinancialPriceSeries.prototype.ao = function () {
        if (this.ms == null || this.mq == null) {
            return null;
        }
        var a = new ScalerParams(0, this.bs.mq, this.bs.m3, this.l0.b8, this.getEffectiveViewport());
        var b = (this.l0.dw(this.bs.m3.left, a));
        var c = (this.l0.dw(this.bs.m3.right, a));
        var d = null;
        if (this.l0.cc) {
            d = this.l0;
            b = d.i$f(b);
            c = d.i$f(c);
        }
        else {
            b = Math.floor(b);
            c = Math.ceil(c);
        }
        b = Math.max(0, Math.min(this.ms.count - 1, b));
        c = Math.max(0, Math.min(this.ms.count - 1, c));
        var e = 1.7976931348623157E+308;
        var f = -1.7976931348623157E+308;
        for (var g = truncate(b); g <= truncate(c); g++) {
            var h = g;
            if (d != null) {
                h = d.i$b._inner[g];
            }
            e = Math.min(e, this.ms.item(h));
            f = Math.max(f, this.mq.item(h));
        }
        return new AxisRange(e, f);
    };
    FinancialPriceSeries.prototype.ee = function () {
        return Series.ef(this.mu, typeCast(ISortingAxis_$type, this.l0));
    };
    FinancialPriceSeries.prototype.c8 = function (a) {
        var b = this.bz != null ? this.bz.indexOf(a) : -1;
        var c = this.bi.bs;
        c = c.copy();
        var d = this.bi.br;
        var e = new Rect(0, 0, 0, 1, 1);
        var f = this.lk(this.bi);
        if (b >= 0 && Rect.l_op_Inequality(c, null) && Rect.l_op_Inequality(d, null)) {
            if (this.l0 != null) {
                var g = new ScalerParams(0, e, e, this.l0.b8, f);
                var h = this.l0.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.ml != null && this.ms != null && this.mq != null && b < this.ms.count && b < this.mq.count) {
                var i = new ScalerParams(0, e, e, this.ml.b8, f);
                i.b = this.ee();
                var j = this.ml.dt(this.ms.item(b), i);
                var k = this.ml.dt(this.mq.item(b), i);
                if (!isNaN_(j) && !isNaN_(k)) {
                    var l = Math.abs(j - k);
                    if (c.height < l) {
                        c.height = l;
                        c.y = Math.min(j, k);
                    }
                    else {
                        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;
    };
    FinancialPriceSeries.prototype.dv = function (a, b, c) {
        var d = _super.prototype.dv.call(this, a, b, c);
        if (this.mu == null || this.mo == null || this.mq == null || this.ms == null) {
            d = false;
        }
        return d;
    };
    FinancialPriceSeries.prototype.or = function (a, b) {
        var _this = this;
        var e_1, _a;
        _super.prototype.or.call(this, a, b);
        var c = b.bs;
        var d = b.br;
        var e = this.getEffectiveViewport1(b);
        var f = this.l0;
        var g = this.ml;
        var h = new ScalerParams(0, c, d, f.b8, e);
        var i = ((function () {
            var $ret = new ScalerParams(0, c, d, g.b8, e);
            $ret.b = _this.ee();
            return $ret;
        })());
        a.f.clear();
        a.m.clear();
        a.p.clear();
        var j = 0;
        var k = typeCast(ISortingAxis_$type, this.l0);
        if (k != null && (k.i$b == null || k.i$b.count != this.bz.count)) {
            return;
        }
        j = this.nr(c, d, e);
        var l = typeCast(FinancialPriceSeriesView.$, b);
        var m = this.er;
        if (this.trendLineType != 0) {
            var n = new Array(this.bz.count);
            var o = 0;
            try {
                for (var _b = tslib_1.__values(fromEnum(this.ni)), _c = _b.next(); !_c.done; _c = _b.next()) {
                    var p = _c.value;
                    n[o] = p;
                    o++;
                }
            }
            catch (e_1_1) { e_1 = { error: e_1_1 }; }
            finally {
                try {
                    if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
                }
                finally { if (e_1) throw e_1.error; }
            }
            if (this.pb.b4) {
                this.pb.b2.prepareLineCore(a.p, this.trendLineType, boxArray$1(n), this.trendLinePeriod, function (q) { return _this.l0.dt(q, h); }, function (q) { return _this.ml.dt(q, i); }, ((function () {
                    var $ret = new TrendResolutionParams();
                    $ret.c = b.bu.b;
                    $ret.d = b.bu.c;
                    $ret.e = b.bu.d;
                    $ret.a = j;
                    $ret.b = m;
                    $ret.f = d;
                    return $ret;
                })()));
            }
        }
        var q = this.l0.dw(2, h) - this.l0.dw(1, h);
        for (var r = b.bu.c; r <= b.bu.d; ++r) {
            var s = void 0;
            if (k == null) {
                s = b.bu.getBucket(r);
            }
            else {
                var t = k.i$b._inner[r];
                var u = k.i$d(t);
                var v = this.mu.item(t);
                var w = this.mq.item(t);
                var x = this.ms.item(t);
                var y = this.mo.item(t);
                var z = v;
                var aa = w;
                var ab = x;
                var ac = y;
                var ad = u;
                while (r < b.bu.d) {
                    t = k.i$b._inner[r + 1];
                    ad = k.i$d(t);
                    if (ad - u > q * m) {
                        break;
                    }
                    r++;
                    aa = Math.max(aa, this.mq.item(t));
                    ab = Math.min(ab, this.ms.item(t));
                    ac = this.mo.item(t);
                }
                var ae = NaN;
                if (!isNaN_(u)) {
                    ae = this.l0.dt(u, h);
                }
                s = [ae, z, aa, ab, ac];
            }
            if (!isNaN_(s[0])) {
                if (k != null) {
                    s[0] = s[0] + j;
                }
                else {
                    s[0] = f.dt(s[0], h) + j;
                }
                s[1] = g.dt(s[1], i);
                s[2] = g.dt(s[2], i);
                s[3] = g.dt(s[3], i);
                s[4] = g.dt(s[4], i);
                a.f.add(s);
            }
        }
        return;
    };
    FinancialPriceSeries.prototype.hp = function (a, b) {
        _super.prototype.hp.call(this, a, b);
        var c = typeCast(FinancialPriceSeriesView.$, b);
        c.b8();
        if (a) {
            c.b3.count = 0;
        }
        if (c.b4 && c.b2 != null) {
            c.b2.g$d();
        }
    };
    FinancialPriceSeries.prototype.get_m4 = function () {
        return true;
    };
    FinancialPriceSeries.prototype.ot = function (a, b) {
        _super.prototype.ot.call(this, a, b);
        if (this.l0 == null || this.ml == null) {
            return;
        }
        var c = false;
        if (b.bx(a)) {
            c = true;
            b.bz(a);
        }
        this.l8.x(this, this.m8(), this.l0, runOn(this, this.ls), this.nx(b), this.nz(b));
        var d = false;
        var e = this.l8.c;
        if (e != null) {
            d = true;
        }
        var f = typeCast(FinancialPriceSeriesView.$, b);
        f.b7();
        f.b5 = false;
        if (f.b4) {
            f.b2.g$d();
        }
        if (this.trendLineType != 0) {
            f.b2.g$g(a.p);
        }
        if (d) {
            this.pj(a, b, c);
        }
        else {
            f.b3.count = 0;
            this.pi(a, b);
        }
    };
    FinancialPriceSeries.prototype.ed = function () {
        var a = this.getEffectiveViewport1(this.bi);
        return this.pd(this.mg, a);
    };
    FinancialPriceSeries.prototype.pj = function (a, b, c) {
        var d = this.pc;
        var e = this.getEffectiveViewport1(b);
        var f = this.pd(b, e);
        var g = (f - 1) / 2;
        var h = typeCast(FinancialPriceSeriesView.$, b);
        h.b5 = true;
        var i = a.f;
        var j = 0;
        var k = this.bz.count;
        var l = this.l0;
        var m = new ScalerParams(0, b.bs, b.br, l.b8, e);
        var n = this.kv;
        var o = this.o6;
        if (o == null) {
            o = n;
        }
        var p = this.kw;
        var q = this.pw;
        if (q == null) {
            q = p;
        }
        var _loop_1 = function (r) {
            var s = i._inner[r][0] - g;
            var t = i._inner[r][0];
            var u = i._inner[r][0] + g;
            var v = i._inner[r][1];
            var w = i._inner[r][2];
            var x = i._inner[r][3];
            var y = i._inner[r][4];
            if (isNaN_(v) || isNaN_(w) || isNaN_(x) || isNaN_(y)) {
                return "continue";
            }
            var z = h.b3.item(j);
            j++;
            var aa = v < y;
            var ab = new PathGeometry();
            if (c) {
                switch (d) {
                    case 0:
                        if (aa) {
                            var ac = v;
                            v = y;
                            y = ac;
                        }
                        var ad = new PathFigure();
                        ad._startPoint = { $type: Point_$type, x: t, y: x };
                        ad._segments.add(((function () {
                            var $ret = new LineSegment(1);
                            $ret.c = { $type: Point_$type, x: t, y: v };
                            return $ret;
                        })()));
                        var ae = new PathFigure();
                        ae._startPoint = { $type: Point_$type, x: s, y: y };
                        ae._segments.add(((function () {
                            var $ret = new LineSegment(1);
                            $ret.c = { $type: Point_$type, x: u, y: y };
                            return $ret;
                        })()));
                        ae._segments.add(((function () {
                            var $ret = new LineSegment(1);
                            $ret.c = { $type: Point_$type, x: u, y: v };
                            return $ret;
                        })()));
                        ae._segments.add(((function () {
                            var $ret = new LineSegment(1);
                            $ret.c = { $type: Point_$type, x: s, y: v };
                            return $ret;
                        })()));
                        ae._segments.add(((function () {
                            var $ret = new LineSegment(1);
                            $ret.c = { $type: Point_$type, x: s, y: y };
                            return $ret;
                        })()));
                        var af = new PathFigure();
                        af._startPoint = { $type: Point_$type, x: t, y: y };
                        af._segments.add(((function () {
                            var $ret = new LineSegment(1);
                            $ret.c = { $type: Point_$type, x: t, y: w };
                            return $ret;
                        })()));
                        ab.b.add(ad);
                        ab.b.add(ae);
                        ab.b.add(af);
                        break;
                    case 1:
                        var ag = new PathFigure();
                        ag._startPoint = { $type: Point_$type, x: s, y: v };
                        ag._segments.add(((function () {
                            var $ret = new LineSegment(1);
                            $ret.c = { $type: Point_$type, x: t, y: v };
                            return $ret;
                        })()));
                        var ah = new PathFigure();
                        ah._startPoint = { $type: Point_$type, x: t, y: x };
                        ah._segments.add(((function () {
                            var $ret = new LineSegment(1);
                            $ret.c = { $type: Point_$type, x: t, y: w };
                            return $ret;
                        })()));
                        var ai = new PathFigure();
                        ai._startPoint = { $type: Point_$type, x: t, y: y };
                        ai._segments.add(((function () {
                            var $ret = new LineSegment(1);
                            $ret.c = { $type: Point_$type, x: u, y: y };
                            return $ret;
                        })()));
                        ab.b.add(ag);
                        ab.b.add(ah);
                        ab.b.add(ai);
                        break;
                }
            }
            if (aa) {
                this_1.l8.al = o;
                this_1.l8.ah = o;
                this_1.l8.am = this_1.l8.ai = q;
                this_1.l8.f = true;
            }
            else {
                this_1.l8.al = n;
                this_1.l8.ah = n;
                this_1.l8.am = this_1.l8.ai = p;
                this_1.l8.f = false;
            }
            this_1.oq(i, r, k, l, m, b.n);
            if (d == 1) {
                this_1.l8.ae(z, true, false, false, false);
            }
            else {
                this_1.l8.ae(z, false, false, false, false);
            }
            if (c) {
                z.aj = ab;
            }
        };
        var this_1 = this;
        for (var r = 0; r < i.count; ++r) {
            _loop_1(r);
        }
        h.b3.count = j;
        h.b9();
    };
    FinancialPriceSeries.prototype.pd = function (a, b) {
        var c = this.l0.jk(a.bs, a.br, b);
        c = Math.max(c, this.er * 0.9);
        c = Math.max(c, 3);
        return c;
    };
    FinancialPriceSeries.prototype.pi = function (a, b) {
        var c = this.pc;
        var d = this.getEffectiveViewport1(b);
        var e = this.pd(b, d);
        var f = (e - 1) / 2;
        var g = typeCast(FinancialPriceSeriesView.$, b);
        var h = g.ch();
        var i = g.cg();
        var j = a.f;
        var _loop_2 = function (k) {
            var l = j._inner[k][0] - f;
            var m = j._inner[k][0];
            var n = j._inner[k][0] + f;
            var o = j._inner[k][1];
            var p = j._inner[k][2];
            var q = j._inner[k][3];
            var r = j._inner[k][4];
            if (isNaN_(o) || isNaN_(p) || isNaN_(q) || isNaN_(r)) {
                return "continue";
            }
            var s = o < r;
            var t = s ? i : h;
            switch (c) {
                case 0:
                    if (s) {
                        var u = o;
                        o = r;
                        r = u;
                    }
                    t.c.add(((function () {
                        var $ret = new LineGeometry();
                        $ret.c = { $type: Point_$type, x: m, y: q };
                        $ret.b = { $type: Point_$type, x: m, y: o };
                        return $ret;
                    })()));
                    t.c.add(((function () {
                        var $ret = new RectangleGeometry();
                        $ret.d = new Rect(0, l, r, n - l, o - r);
                        return $ret;
                    })()));
                    t.c.add(((function () {
                        var $ret = new LineGeometry();
                        $ret.c = { $type: Point_$type, x: m, y: r };
                        $ret.b = { $type: Point_$type, x: m, y: p };
                        return $ret;
                    })()));
                    break;
                case 1:
                    t.c.add(((function () {
                        var $ret = new LineGeometry();
                        $ret.c = { $type: Point_$type, x: l, y: o };
                        $ret.b = { $type: Point_$type, x: m, y: o };
                        return $ret;
                    })()));
                    t.c.add(((function () {
                        var $ret = new LineGeometry();
                        $ret.c = { $type: Point_$type, x: m, y: q };
                        $ret.b = { $type: Point_$type, x: m, y: p };
                        return $ret;
                    })()));
                    t.c.add(((function () {
                        var $ret = new LineGeometry();
                        $ret.c = { $type: Point_$type, x: m, y: r };
                        $ret.b = { $type: Point_$type, x: n, y: r };
                        return $ret;
                    })()));
                    break;
            }
        };
        for (var k = 0; k < j.count; ++k) {
            _loop_2(k);
        }
    };
    FinancialPriceSeries.prototype.fq = function (a, b) {
        if (this.pb.b4 && a == this.pb.b2.g$j) {
            return null;
        }
        return _super.prototype.fq.call(this, a, b);
    };
    FinancialPriceSeries.prototype.jg = function () {
        _super.prototype.jg.call(this);
        if (this.fe < 0) {
            return;
        }
        this.pb.cf();
    };
    FinancialPriceSeries.prototype.hy = function (a) {
        _super.prototype.hy.call(this, a);
        if (this.pb.b4) {
            this.a2.exportTrendlineData(this, a, this.pb.b2.g$j);
        }
    };
    FinancialPriceSeries.prototype.ja = function (a, b) {
        _super.prototype.ja.call(this, a, b);
        this.pw = b;
    };
    FinancialPriceSeries.$t = markType(FinancialPriceSeries, 'FinancialPriceSeries', FinancialSeries.$, [ITrendLineSeries_$type]);
    FinancialPriceSeries.pl = DependencyProperty.i("ActualTrendLineBrush", Brush.$, FinancialPriceSeries.$, new PropertyMetadata(2, null, function (a, b) { return a.raisePropertyChanged("ActualTrendLineBrush", b.oldValue, b.newValue); }));
    return FinancialPriceSeries;
}(FinancialSeries));
export { FinancialPriceSeries };
Type.dep(DependencyProperty, PropertyMetadata, FinancialPriceSeries, 'raisePropertyChanged', ['DisplayType:pc:pm', [PriceDisplayType_$type, enumGetBox(PriceDisplayType_$type, 0)], 'NegativeOutline:pw:pn', [Brush.$, null], 'TrendLineType::pt', [TrendLineType_$type, enumGetBox(TrendLineType_$type, 0)], 'TrendLineThickness::ps', [1, 1.5], 'TrendLinePeriod::pr', [1, 7], 'TrendLineBrush::po', [Brush.$, null], 'TrendLineZIndex:pf:pu', [1, 1001], 'TrendLineDashArray:px:pp', [DoubleCollection.$], 'TrendLineDashCap:py:pq', [PenLineCap_$type, enumGetBox(PenLineCap_$type, 0)]]);
/**
 * @hidden
 */
var FinancialPriceSeriesView = /** @class */ (function (_super) {
    tslib_1.__extends(FinancialPriceSeriesView, _super);
    function FinancialPriceSeriesView(a) {
        var _this = _super.call(this, a) || this;
        _this.b0 = null;
        _this.b3 = null;
        _this.b6 = null;
        _this.ck = ((function () {
            var $ret = new Path();
            $ret.aj = new GeometryGroup();
            return $ret;
        })());
        _this.cj = ((function () {
            var $ret = new Path();
            $ret.aj = new GeometryGroup();
            return $ret;
        })());
        _this.b1 = null;
        _this.ci = new Path();
        _this.b5 = false;
        _this.b0 = a;
        _this.b6 = new List$1(Path.$, 0);
        _this.b3 = ((function () {
            var $ret = new Pool$1(Path.$);
            $ret.create = runOn(_this, _this.cl);
            $ret.activate = runOn(_this, _this.cb);
            $ret.disactivate = runOn(_this, _this.cd);
            $ret.destroy = runOn(_this, _this.cc);
            return $ret;
        })());
        return _this;
    }
    FinancialPriceSeriesView.prototype.cl = function () {
        var a = new Path();
        this.b6.add(a);
        a._visibility = 1;
        return a;
    };
    FinancialPriceSeriesView.prototype.cb = function (a) {
        a._visibility = 0;
    };
    FinancialPriceSeriesView.prototype.cd = function (a) {
        a._visibility = 1;
    };
    FinancialPriceSeriesView.prototype.cc = function (a) {
        this.b6.remove(a);
    };
    FinancialPriceSeriesView.prototype.bv = function () {
        return new FinancialPriceBucketCalculator(this);
    };
    FinancialPriceSeriesView.prototype.ap = function () {
        _super.prototype.ap.call(this);
        if (!this.n) {
            this.bw.o6 = ((function () {
                var $ret = new Brush();
                $ret.fill = "#C62828";
                return $ret;
            })());
            this.b0.pw = this.bw.o6;
            this.bw.er = 5;
            this.bw.ev = 1;
        }
    };
    Object.defineProperty(FinancialPriceSeriesView.prototype, "b2", {
        get: function () {
            if (this.b1 == null) {
                this.b1 = CategoryTrendLineManagerFactory.a(this.b1, this.e.ap(), this.e.jp, this.e, this.e.b2);
            }
            return this.b1;
        },
        set: function (a) {
            this.b1 = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialPriceSeriesView.prototype, "b4", {
        get: function () {
            return this.b1 != null;
        },
        enumerable: true,
        configurable: true
    });
    FinancialPriceSeriesView.prototype.ce = function () {
        if (this.b0.pc == 1) {
            this.ck._stroke = this.e.kv;
        }
        else {
            this.ck._stroke = this.e.kw;
        }
        if (this.b0.pc == 1) {
            this.cj._stroke = this.bw.o6;
        }
        else {
            this.cj._stroke = this.b0.pw;
        }
    };
    FinancialPriceSeriesView.prototype.b8 = function () {
        this.an();
        this.b3.count = 0;
        this.b7();
    };
    FinancialPriceSeriesView.prototype.b7 = function () {
        var a = typeCast(GeometryGroup.$, this.ck.aj);
        var b = typeCast(GeometryGroup.$, this.cj.aj);
        Extensions.d(a);
        Extensions.d(b);
    };
    FinancialPriceSeriesView.prototype.ch = function () {
        this.an();
        return typeCast(GeometryGroup.$, this.ck.aj);
    };
    FinancialPriceSeriesView.prototype.cg = function () {
        this.an();
        return typeCast(GeometryGroup.$, this.cj.aj);
    };
    FinancialPriceSeriesView.prototype.cf = function () {
        this.b0.pv = null;
        if (this.b0.trendLineBrush != null) {
            this.b0.pv = this.b0.trendLineBrush;
        }
        else {
            this.b0.pv = this.b0.kv;
        }
    };
    FinancialPriceSeriesView.prototype.a8 = function () {
        _super.prototype.a8.call(this);
        this.ck.ac = this.e.ev;
        this.ck.ai = this.e.k3;
        this.ck.ad = this.e.k4;
        if (this.b0.pc == 1) {
            this.ck._stroke = this.e.kv;
        }
        else {
            this.ck._stroke = this.e.kw;
            this.ck._fill = this.e.kv;
        }
        this.cj.ac = this.e.ev;
        this.cj.ai = this.e.k3;
        this.cj.ad = this.e.k4;
        if (this.b0.pc == 1) {
            this.cj._stroke = this.bw.o6;
        }
        else {
            this.cj._stroke = this.b0.pw;
            this.cj._fill = this.bw.o6;
        }
    };
    FinancialPriceSeriesView.prototype.a9 = function () {
        _super.prototype.a9.call(this);
        var a = this.bl();
        this.ck.ac = this.e.ev + 3;
        if (this.b0.pc == 1) {
            this.ck._stroke = a;
        }
        else {
            this.ck._stroke = a;
            this.ck._fill = a;
        }
        this.cj.ac = this.e.ev + 3;
        if (this.b0.pc == 1) {
            this.cj._stroke = a;
        }
        else {
            this.cj._stroke = a;
            this.cj._fill = a;
        }
    };
    FinancialPriceSeriesView.prototype.z = function (a) {
        return this.b6._inner[a];
    };
    FinancialPriceSeriesView.prototype.y = function (a) {
        var b = this.b6._inner[a];
        this.ci._visibility = b._visibility;
        this.ci.aj = b.aj;
        var c = this.bm(a);
        this.ci._fill = c;
        this.ci._stroke = c;
        this.ci.ac = this.e.ev + 3;
        return this.ci;
    };
    FinancialPriceSeriesView.prototype.a3 = function (a, b) {
        _super.prototype.a3.call(this, a, b);
        if (a.d) {
            if (this.b5) {
                for (var c = 0; c < this.b6.count; c++) {
                    var d = this.x(c, b);
                    if (d._visibility == 0) {
                        a.s(d);
                    }
                }
            }
            else {
                a.s(this.ck);
                a.s(this.cj);
            }
        }
    };
    FinancialPriceSeriesView.prototype.a2 = function (a, b) {
        if (a.d) {
            if (this.b0.trendLineType != 0 && !b) {
                var c = this.b2.g$j;
                c.ac = this.b0.trendLineThickness;
                c._stroke = this.b0.pv;
                c.ai = this.b0.px;
                c.ad = this.b0.py;
                a.u(c);
            }
        }
        _super.prototype.a2.call(this, a, b);
    };
    FinancialPriceSeriesView.prototype.ai = function (a) {
        _super.prototype.ai.call(this, a);
        this.e.a2.exportPathData(a, this.ck, "positivePathShape", ["Positive", "Main"]);
        this.e.a2.exportPathData(a, this.cj, "negativePathShape", ["Negative"]);
    };
    FinancialPriceSeriesView.prototype.b9 = function () {
        this.an();
    };
    FinancialPriceSeriesView.prototype.ca = function () {
        if (this.b4) {
            this.b1 = CategoryTrendLineManagerFactory.a(this.b1, this.e.ap(), this.e.jp, this.e, this.e.b2);
        }
    };
    FinancialPriceSeriesView.$t = markType(FinancialPriceSeriesView, 'FinancialPriceSeriesView', FinancialSeriesView.$);
    return FinancialPriceSeriesView;
}(FinancialSeriesView));
export { FinancialPriceSeriesView };
//# sourceMappingURL=FinancialPriceSeries_combined.js.map