/*
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 { FinancialSeries } from "./FinancialSeries";
import { ITrendLineSeries_$type } from "./ITrendLineSeries";
import { TrendLineType_$type } from "igniteui-react-core/ES2015/TrendLineType";
import { DependencyProperty } from "igniteui-react-core/ES2015/DependencyProperty";
import { Brush } from "igniteui-react-core/ES2015/Brush";
import { PenLineCap_$type } from "igniteui-react-core/ES2015/PenLineCap";
import { DoubleCollection } from "igniteui-react-core/ES2015/DoubleCollection";
import { PriceDisplayType_$type } from "./PriceDisplayType";
import { Type, enumGetBox, EnumUtil, typeCast, fromEnum, runOn, Point_$type, markType } from "igniteui-react-core/ES2015/type";
import { CategoryFrame } from "./CategoryFrame";
import { ISortingAxis_$type } from "./ISortingAxis";
import { FinancialSeriesView } from "./FinancialSeriesView";
import { Rect } from "igniteui-react-core/ES2015/Rect";
import { List$1 } from "igniteui-react-core/ES2015/List$1";
import { RectUtil } from "igniteui-react-core/ES2015/RectUtil";
import { CategoryTrendLineManagerFactory } from "./CategoryTrendLineManagerFactory";
import { AxisRange } from "./AxisRange";
import { ScalerParams } from "./ScalerParams";
import { TrendResolutionParams } from "./TrendResolutionParams";
import { Pool$1 } from "igniteui-react-core/ES2015/Pool$1";
import { Path } from "igniteui-react-core/ES2015/Path";
import { PathGeometry } from "igniteui-react-core/ES2015/PathGeometry";
import { PathFigure } from "igniteui-react-core/ES2015/PathFigure";
import { LineSegment } from "igniteui-react-core/ES2015/LineSegment";
import { GeometryGroup } from "igniteui-react-core/ES2015/GeometryGroup";
import { LineGeometry } from "igniteui-react-core/ES2015/LineGeometry";
import { RectangleGeometry } from "igniteui-react-core/ES2015/RectangleGeometry";
import { PropertyMetadata } from "igniteui-react-core/ES2015/PropertyMetadata";
import { truncate, isNaN_ } from "igniteui-react-core/ES2015/number";
import { boxArray$1 } from "igniteui-react-core/ES2015/array";
import { FinancialPriceBucketCalculator } from "./FinancialPriceBucketCalculator";
import { Extensions } from "igniteui-react-core/ES2015/Extensions";
export class FinancialPriceSeries extends FinancialSeries {
    constructor() {
        super();
        this.ab = FinancialPriceSeries.$;
        this.lz = new CategoryFrame(5);
        this.l1 = new CategoryFrame(5);
        this.ly = new CategoryFrame(5);
    }
    bf() {
        return new FinancialPriceSeriesView(this);
    }
    ii(a) {
        super.ii(a);
        this.o7 = a;
    }
    get pr() {
        return this.c(FinancialPriceSeries.ph);
    }
    set pr(a) {
        this.h(FinancialPriceSeries.ph, a);
    }
    ho(a, b, c, d) {
        super.ho(a, b, c, d);
        if (this.lw != null && typeCast(ISortingAxis_$type, this.lw) !== null) {
            this.lw.i$i();
        }
        this.o7.bs.e(this.eo);
        if (this.o7.b2) {
            this.o7.b0.g$e(a, b, c, d);
        }
        if (this.mg != null) {
            this.mg.ck();
        }
        this.i1(true);
    }
    bd() {
        if (this.be == 0) {
            return 1;
        }
        else {
            return super.bd();
        }
    }
    li(a) {
        if (this.ly == null || this.ly.f.count == 0) {
            return Rect.empty;
        }
        let b = this.k4(a);
        let c = this.bi.bq;
        let d = this.bi.bp;
        let e = this.getEffectiveViewport1(this.bi);
        let f = this.aj(this.lw, this.ly.f, this.nr(this.bi), this.nt(this.bi), a, true);
        let g = f[0];
        let h = f[1];
        let i = Math.abs(b.x - g[0]);
        let j = Math.abs(b.x - h[0]);
        let k = this.o9(this.mc, e);
        k = Math.max(k, 3);
        let l = (k - 1) / 2;
        if (i < j) {
            let m = g[0] - l;
            let n = g[0];
            let o = g[0] + l;
            let p = g[1];
            let q = g[2];
            let r = g[3];
            let s = g[4];
            let t = Math.min(Math.min(Math.min(p, q), r), s);
            let u = Math.max(Math.max(Math.max(p, q), r), s);
            return new Rect(0, m, t, Math.abs(o - m), u - t);
        }
        else {
            let v = h[0] - l;
            let w = h[0];
            let x = h[0] + l;
            let y = h[1];
            let z = h[2];
            let aa = h[3];
            let ab = h[4];
            let ac = Math.min(Math.min(Math.min(y, z), aa), ab);
            let ad = Math.max(Math.max(Math.max(y, z), aa), ab);
            return new Rect(0, v, ac, Math.abs(x - v), ad - ac);
        }
    }
    o6(a, b) {
        let c = a[0] - b;
        let d = a[0];
        let e = a[0] + b;
        let f = a[1];
        let g = a[2];
        let h = a[3];
        let i = a[4];
        let j = Math.min(Math.min(Math.min(f, g), h), i);
        let k = Math.max(Math.max(Math.max(f, g), h), i);
        let l = Math.min(g, h);
        let m = Math.max(g, h);
        let n = Math.min(f, i);
        let o = Math.max(f, i);
        if (this.o8 == 1) {
            let p = new Array(3);
            let q = new Rect(0, c, f, b, 0);
            let r = new Rect(0, d, i, b, 0);
            let s = new Rect(0, d, l, 0, m - l);
            p[0] = q;
            p[1] = r;
            p[2] = s;
            return p;
        }
        else {
            let t = new Array(2);
            let u = new Rect(0, d, l, 0, m - l);
            let v = new Rect(0, c, n, b * 2, o - n);
            t[0] = u;
            t[1] = v;
            return t;
        }
    }
    ak(a) {
        let b = new List$1(Rect.$, 0);
        let c = this.k4(a);
        let d = this.bi.bq;
        let e = this.bi.bp;
        let f = this.getEffectiveViewport1(this.bi);
        let g = this.aj(this.lw, this.ly.f, this.nr(this.bi), this.nt(this.bi), a, true);
        let h = g[0];
        let i = g[1];
        let j = Math.abs(c.x - h[0]);
        let k = Math.abs(c.x - i[0]);
        let l = this.o9(this.mc, f);
        l = Math.max(l, 3);
        let m = (l - 1) / 2;
        if (j < k) {
            return this.o6(h, m);
        }
        else {
            return this.o6(i, m);
        }
    }
    de(a, b) {
        if (this.dh(a, b)) {
            return true;
        }
        return false;
    }
    dh(a, b) {
        let c = this.lj(a);
        if (c.isEmpty) {
            return false;
        }
        let d = RectUtil.r(c, (this.es / 2) + this.d9(b));
        if (d.containsPoint(a)) {
            let e = this.al(a);
            if (e != null) {
                for (let f = 0; f < e.length; f++) {
                    let g = e[f];
                    let h = RectUtil.r(g, (this.es / 2) + this.d9(b));
                    if (h.containsPoint(a)) {
                        return true;
                    }
                }
            }
        }
        return false;
    }
    io(a, b, c, d) {
        switch (b) {
            case FinancialSeries.$$p[9]:
                this.o7.b8();
                break;
            case "TrendLineType":
                let 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.io(a, b, c, d);
        if (this.o7.b2 && this.o7.b0 != null && this.o7.b0.g$b(a, b, c, d)) {
            this.i1(false);
            this.h8();
        }
        switch (b) {
            case FinancialPriceSeries.$$p[0]:
                if (this.jl != null) {
                    this.pg();
                    this.ly.w();
                    this.on(this.ly, this.o7);
                }
                this.h8();
                break;
            case "TrendLineBrush":
                this.jc();
                break;
            case "TrendLineType":
                this.h8();
                break;
            case FinancialSeries.$$p[5]:
            case FinancialPriceSeries.$$p[1]:
                this.ik();
                break;
        }
    }
    pg() {
        this.o7.cc();
        if (this.bh != null) {
            this.bh.cc();
        }
    }
    an(a) {
        if (a != null && a == this.mg && this.mm != null && !isNaN_(this.mm.minimum) && this.mk != null && !isNaN_(this.mk.maximum)) {
            return new AxisRange(this.mm.minimum, this.mk.maximum);
        }
        return null;
    }
    ao() {
        if (this.mm == null || this.mk == null) {
            return null;
        }
        let a = new ScalerParams(0, this.bs.mk, this.bs.mx, this.lw.b8, this.getEffectiveViewport());
        let b = (this.lw.dw(this.bs.mx.left, a));
        let c = (this.lw.dw(this.bs.mx.right, a));
        let d = null;
        if (this.lw.cc) {
            d = this.lw;
            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.mm.count - 1, b));
        c = Math.max(0, Math.min(this.mm.count - 1, c));
        let e = 1.7976931348623157E+308;
        let f = -1.7976931348623157E+308;
        for (let g = truncate(b); g <= truncate(c); g++) {
            let h = g;
            if (d != null) {
                h = d.i$b._inner[g];
            }
            e = Math.min(e, this.mm.item(h));
            f = Math.max(f, this.mk.item(h));
        }
        return new AxisRange(e, f);
    }
    ec() {
        return this.mo == null || this.mo.count == 0 ? NaN : this.mo.item(0);
    }
    c6(a) {
        let b = this.bz != null ? this.bz.indexOf(a) : -1;
        let c = this.bi.bq;
        c = c.copy();
        let d = this.bi.bp;
        let e = new Rect(0, 0, 0, 1, 1);
        let f = this.lg(this.bi);
        if (b >= 0 && Rect.l_op_Inequality(c, null) && Rect.l_op_Inequality(d, null)) {
            if (this.lw != null) {
                let g = new ScalerParams(0, e, e, this.lw.b8, f);
                let 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.mm != null && this.mk != null && b < this.mm.count && b < this.mk.count) {
                let i = new ScalerParams(0, e, e, this.mg.b8, f);
                let j = this.mg.dt(this.mm.item(b), i);
                let k = this.mg.dt(this.mk.item(b), i);
                if (!isNaN_(j) && !isNaN_(k)) {
                    let 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;
    }
    dt(a, b, c) {
        let d = super.dt(a, b, c);
        if (this.mo == null || this.mi == null || this.mk == null || this.mm == null) {
            d = false;
        }
        return d;
    }
    ol(a, b) {
        super.ol(a, b);
        let c = b.bq;
        let d = b.bp;
        let e = this.getEffectiveViewport1(b);
        let f = this.lw;
        let g = this.mg;
        let h = new ScalerParams(0, c, d, f.b8, e);
        let i = ((() => {
            let $ret = new ScalerParams(0, c, d, g.b8, e);
            $ret.b = this.ec();
            return $ret;
        })());
        a.f.clear();
        a.m.clear();
        a.p.clear();
        let j = 0;
        let k = typeCast(ISortingAxis_$type, this.lw);
        if (k != null && (k.i$b == null || k.i$b.count != this.bz.count)) {
            return;
        }
        j = this.nl(c, d, e);
        let l = typeCast(FinancialPriceSeriesView.$, b);
        if (this.trendLineType != 0) {
            let m = new Array(this.bz.count);
            let n = 0;
            for (let o of fromEnum(this.nc)) {
                m[n] = o;
                n++;
            }
            if (this.o7.b2) {
                this.o7.b0.prepareLineCore(a.p, this.trendLineType, boxArray$1(m), this.trendLinePeriod, (p) => this.lw.dt(p, h), (p) => this.mg.dt(p, i), ((() => {
                    let $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;
                    return $ret;
                })()));
            }
        }
        let p = this.lw.dw(2, h) - this.lw.dw(1, h);
        for (let q = b.bs.c; q <= b.bs.d; ++q) {
            let r;
            if (k == null) {
                r = b.bs.getBucket(q);
            }
            else {
                let s = k.i$b._inner[q];
                let t = k.i$d(s);
                let u = this.mo.item(s);
                let v = this.mk.item(s);
                let w = this.mm.item(s);
                let x = this.mi.item(s);
                let y = u;
                let z = v;
                let aa = w;
                let ab = x;
                let ac = t;
                while (q < b.bs.d) {
                    s = k.i$b._inner[q + 1];
                    ac = k.i$d(s);
                    if (ac - t > p * this.eo) {
                        break;
                    }
                    q++;
                    z = Math.max(z, this.mk.item(s));
                    aa = Math.min(aa, this.mm.item(s));
                    ab = this.mi.item(s);
                }
                let ad = NaN;
                if (!isNaN_(t)) {
                    ad = this.lw.dt(t, h);
                }
                r = [ad, y, z, aa, ab];
            }
            if (!isNaN_(r[0])) {
                if (this.lw != null && typeCast(ISortingAxis_$type, this.lw) !== null) {
                    r[0] = r[0] + j;
                }
                else {
                    r[0] = f.dt(r[0], h) + j;
                }
                r[1] = g.dt(r[1], i);
                r[2] = g.dt(r[2], i);
                r[3] = g.dt(r[3], i);
                r[4] = g.dt(r[4], i);
                a.f.add(r);
            }
        }
        return;
    }
    hl(a, b) {
        super.hl(a, b);
        let c = typeCast(FinancialPriceSeriesView.$, b);
        c.b6();
        if (a) {
            c.b1.count = 0;
        }
        if (c.b2 && c.b0 != null) {
            c.b0.g$d();
        }
    }
    get_my() {
        return true;
    }
    get my() {
        return this.get_my();
    }
    on(a, b) {
        super.on(a, b);
        if (this.lw == null || this.mg == null) {
            return;
        }
        let c = false;
        if (b.bv(a)) {
            c = true;
            b.bx(a);
        }
        this.l4.x(this, this.m2(), this.lw, runOn(this, this.lo), this.nr(b), this.nt(b));
        let d = false;
        let e = this.l4.c;
        if (e != null) {
            d = true;
        }
        let f = typeCast(FinancialPriceSeriesView.$, b);
        f.b5();
        f.b3 = false;
        if (f.b2) {
            f.b0.g$d();
        }
        if (this.trendLineType != 0) {
            f.b0.g$g(a.p);
        }
        if (d) {
            this.pf(a, b, c);
        }
        else {
            f.b1.count = 0;
            this.pe(a, b);
        }
    }
    eb() {
        let a = this.getEffectiveViewport1(this.bi);
        return this.o9(this.mc, a);
    }
    pf(a, b, c) {
        let d = this.o8;
        let e = this.getEffectiveViewport1(b);
        let f = this.o9(b, e);
        let g = (f - 1) / 2;
        let h = typeCast(FinancialPriceSeriesView.$, b);
        h.b3 = true;
        let i = a.f;
        let j = 0;
        let k = this.bz.count;
        let l = this.lw;
        let m = new ScalerParams(0, b.bq, b.bp, l.b8, e);
        let n = this.kr;
        let o = this.o0;
        if (o == null) {
            o = n;
        }
        let p = this.ks;
        let q = this.ps;
        if (q == null) {
            q = p;
        }
        for (let r = 0; r < i.count; ++r) {
            let s = i._inner[r][0] - g;
            let t = i._inner[r][0];
            let u = i._inner[r][0] + g;
            let v = i._inner[r][1];
            let w = i._inner[r][2];
            let x = i._inner[r][3];
            let y = i._inner[r][4];
            if (isNaN_(v) || isNaN_(w) || isNaN_(x) || isNaN_(y)) {
                continue;
            }
            let z = h.b1.item(j);
            j++;
            let aa = v < y;
            let ab = new PathGeometry();
            if (c) {
                switch (d) {
                    case 0:
                        if (aa) {
                            let ac = v;
                            v = y;
                            y = ac;
                        }
                        let ad = new PathFigure();
                        ad._startPoint = { $type: Point_$type, x: t, y: x };
                        ad._segments.add(((() => {
                            let $ret = new LineSegment(1);
                            $ret.c = { $type: Point_$type, x: t, y: v };
                            return $ret;
                        })()));
                        let ae = new PathFigure();
                        ae._startPoint = { $type: Point_$type, x: s, y: y };
                        ae._segments.add(((() => {
                            let $ret = new LineSegment(1);
                            $ret.c = { $type: Point_$type, x: u, y: y };
                            return $ret;
                        })()));
                        ae._segments.add(((() => {
                            let $ret = new LineSegment(1);
                            $ret.c = { $type: Point_$type, x: u, y: v };
                            return $ret;
                        })()));
                        ae._segments.add(((() => {
                            let $ret = new LineSegment(1);
                            $ret.c = { $type: Point_$type, x: s, y: v };
                            return $ret;
                        })()));
                        ae._segments.add(((() => {
                            let $ret = new LineSegment(1);
                            $ret.c = { $type: Point_$type, x: s, y: y };
                            return $ret;
                        })()));
                        let af = new PathFigure();
                        af._startPoint = { $type: Point_$type, x: t, y: y };
                        af._segments.add(((() => {
                            let $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:
                        let ag = new PathFigure();
                        ag._startPoint = { $type: Point_$type, x: s, y: v };
                        ag._segments.add(((() => {
                            let $ret = new LineSegment(1);
                            $ret.c = { $type: Point_$type, x: t, y: v };
                            return $ret;
                        })()));
                        let ah = new PathFigure();
                        ah._startPoint = { $type: Point_$type, x: t, y: x };
                        ah._segments.add(((() => {
                            let $ret = new LineSegment(1);
                            $ret.c = { $type: Point_$type, x: t, y: w };
                            return $ret;
                        })()));
                        let ai = new PathFigure();
                        ai._startPoint = { $type: Point_$type, x: t, y: y };
                        ai._segments.add(((() => {
                            let $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.l4.al = o;
                this.l4.ah = o;
                this.l4.am = this.l4.ai = q;
                this.l4.f = true;
            }
            else {
                this.l4.al = n;
                this.l4.ah = n;
                this.l4.am = this.l4.ai = p;
                this.l4.f = false;
            }
            this.ok(i, r, k, l, m, b.n);
            if (d == 1) {
                this.l4.ae(z, true, false, false, false);
            }
            else {
                this.l4.ae(z, false, false, false, false);
            }
            if (c) {
                z.aj = ab;
            }
        }
        h.b1.count = j;
        h.b7();
    }
    o9(a, b) {
        let c = this.lw.jj(a.bq, a.bp, b);
        c = Math.max(c, this.eo * 0.9);
        c = Math.max(c, 3);
        return c;
    }
    pe(a, b) {
        let c = this.o8;
        let d = this.getEffectiveViewport1(b);
        let e = this.o9(b, d);
        let f = (e - 1) / 2;
        let g = typeCast(FinancialPriceSeriesView.$, b);
        let h = g.cf();
        let i = g.ce();
        let j = a.f;
        for (let k = 0; k < j.count; ++k) {
            let l = j._inner[k][0] - f;
            let m = j._inner[k][0];
            let n = j._inner[k][0] + f;
            let o = j._inner[k][1];
            let p = j._inner[k][2];
            let q = j._inner[k][3];
            let r = j._inner[k][4];
            if (isNaN_(o) || isNaN_(p) || isNaN_(q) || isNaN_(r)) {
                continue;
            }
            let s = o < r;
            let t = s ? i : h;
            switch (c) {
                case 0:
                    if (s) {
                        let u = o;
                        o = r;
                        r = u;
                    }
                    t.c.add(((() => {
                        let $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(((() => {
                        let $ret = new RectangleGeometry();
                        $ret.d = new Rect(0, l, r, n - l, o - r);
                        return $ret;
                    })()));
                    t.c.add(((() => {
                        let $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(((() => {
                        let $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(((() => {
                        let $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(((() => {
                        let $ret = new LineGeometry();
                        $ret.c = { $type: Point_$type, x: m, y: r };
                        $ret.b = { $type: Point_$type, x: n, y: r };
                        return $ret;
                    })()));
                    break;
            }
        }
    }
    fm(a, b) {
        if (this.o7.b2 && a == this.o7.b0.g$j) {
            return null;
        }
        return super.fm(a, b);
    }
    jc() {
        super.jc();
        if (this.fb < 0) {
            return;
        }
        this.o7.cd();
    }
    hu(a) {
        super.hu(a);
        if (this.o7.b2) {
            this.a2.exportTrendlineData(this, a, this.o7.b0.g$j);
        }
    }
    i6(a, b) {
        super.i6(a, b);
        this.ps = b;
    }
}
FinancialPriceSeries.ph = DependencyProperty.i("ActualTrendLineBrush", Brush.$, FinancialPriceSeries.$, new PropertyMetadata(2, null, (a, b) => a.raisePropertyChanged("ActualTrendLineBrush", b.oldValue, b.newValue)));
FinancialPriceSeries.$t = markType(FinancialPriceSeries, 'FinancialPriceSeries', FinancialSeries.$, [ITrendLineSeries_$type]);
Type.dep(DependencyProperty, PropertyMetadata, FinancialPriceSeries, 'raisePropertyChanged', ['DisplayType:o8:pi', [PriceDisplayType_$type, enumGetBox(PriceDisplayType_$type, 0)], 'NegativeOutline:ps:pj', [Brush.$, null], 'TrendLineType::pp', [TrendLineType_$type, enumGetBox(TrendLineType_$type, 0)], 'TrendLineThickness::po', [1, 1.5], 'TrendLinePeriod::pn', [1, 7], 'TrendLineBrush::pk', [Brush.$, null], 'TrendLineZIndex:pb:pq', [1, 1001], 'TrendLineDashArray:pt:pl', [DoubleCollection.$], 'TrendLineDashCap:pu:pm', [PenLineCap_$type, enumGetBox(PenLineCap_$type, 0)]]);
export class FinancialPriceSeriesView extends FinancialSeriesView {
    constructor(a) {
        super(a);
        this.by = null;
        this.b1 = null;
        this.b4 = null;
        this.ci = ((() => {
            let $ret = new Path();
            $ret.aj = new GeometryGroup();
            return $ret;
        })());
        this.ch = ((() => {
            let $ret = new Path();
            $ret.aj = new GeometryGroup();
            return $ret;
        })());
        this.bz = null;
        this.cg = new Path();
        this.b3 = false;
        this.by = a;
        this.b4 = new List$1(Path.$, 0);
        this.b1 = ((() => {
            let $ret = new Pool$1(Path.$);
            $ret.create = runOn(this, this.cj);
            $ret.activate = runOn(this, this.b9);
            $ret.disactivate = runOn(this, this.cb);
            $ret.destroy = runOn(this, this.ca);
            return $ret;
        })());
    }
    cj() {
        let a = new Path();
        this.b4.add(a);
        a._visibility = 1;
        return a;
    }
    b9(a) {
        a._visibility = 0;
    }
    cb(a) {
        a._visibility = 1;
    }
    ca(a) {
        this.b4.remove(a);
    }
    bt() {
        return new FinancialPriceBucketCalculator(this);
    }
    ap() {
        super.ap();
        if (!this.n) {
            this.bu.o0 = ((() => {
                let $ret = new Brush();
                $ret.fill = "#C62828";
                return $ret;
            })());
            this.by.ps = this.bu.o0;
            this.bu.eo = 5;
            this.bu.es = 1;
        }
    }
    get b0() {
        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 b0(a) {
        this.bz = a;
    }
    get b2() {
        return this.bz != null;
    }
    cc() {
        if (this.by.o8 == 1) {
            this.ci._stroke = this.e.kr;
        }
        else {
            this.ci._stroke = this.e.ks;
        }
        if (this.by.o8 == 1) {
            this.ch._stroke = this.bu.o0;
        }
        else {
            this.ch._stroke = this.by.ps;
        }
    }
    b6() {
        this.an();
        this.b1.count = 0;
        this.b5();
    }
    b5() {
        let a = typeCast(GeometryGroup.$, this.ci.aj);
        let b = typeCast(GeometryGroup.$, this.ch.aj);
        Extensions.d(a);
        Extensions.d(b);
    }
    cf() {
        this.an();
        return typeCast(GeometryGroup.$, this.ci.aj);
    }
    ce() {
        this.an();
        return typeCast(GeometryGroup.$, this.ch.aj);
    }
    cd() {
        this.by.pr = null;
        if (this.by.trendLineBrush != null) {
            this.by.pr = this.by.trendLineBrush;
        }
        else {
            this.by.pr = this.by.kr;
        }
    }
    a8() {
        super.a8();
        this.ci.ac = this.e.es;
        this.ci.ai = this.e.kz;
        this.ci.ad = this.e.k0;
        if (this.by.o8 == 1) {
            this.ci._stroke = this.e.kr;
        }
        else {
            this.ci._stroke = this.e.ks;
            this.ci._fill = this.e.kr;
        }
        this.ch.ac = this.e.es;
        this.ch.ai = this.e.kz;
        this.ch.ad = this.e.k0;
        if (this.by.o8 == 1) {
            this.ch._stroke = this.bu.o0;
        }
        else {
            this.ch._stroke = this.by.ps;
            this.ch._fill = this.bu.o0;
        }
    }
    a9() {
        super.a9();
        let a = this.bk();
        this.ci.ac = this.e.es + 3;
        if (this.by.o8 == 1) {
            this.ci._stroke = a;
        }
        else {
            this.ci._stroke = a;
            this.ci._fill = a;
        }
        this.ch.ac = this.e.es + 3;
        if (this.by.o8 == 1) {
            this.ch._stroke = a;
        }
        else {
            this.ch._stroke = a;
            this.ch._fill = a;
        }
    }
    z(a) {
        return this.b4._inner[a];
    }
    y(a) {
        let b = this.b4._inner[a];
        this.cg._visibility = b._visibility;
        this.cg.aj = b.aj;
        let c = this.bl(a);
        this.cg._fill = c;
        this.cg._stroke = c;
        this.cg.ac = this.e.es + 3;
        return this.cg;
    }
    a3(a, b) {
        super.a3(a, b);
        if (a.d) {
            if (this.b3) {
                for (let c = 0; c < this.b4.count; c++) {
                    let d = this.x(c, b);
                    if (d._visibility == 0) {
                        a.s(d);
                    }
                }
            }
            else {
                a.s(this.ci);
                a.s(this.ch);
            }
        }
    }
    a2(a, b) {
        if (a.d) {
            if (this.by.trendLineType != 0 && !b) {
                let c = this.b0.g$j;
                c.ac = this.by.trendLineThickness;
                c._stroke = this.by.pr;
                c.ai = this.by.pt;
                c.ad = this.by.pu;
                a.u(c);
            }
        }
        super.a2(a, b);
    }
    ai(a) {
        super.ai(a);
        this.e.a2.exportPathData(a, this.ci, "positivePathShape", ["Positive", "Main"]);
        this.e.a2.exportPathData(a, this.ch, "negativePathShape", ["Negative"]);
    }
    b7() {
        this.an();
    }
    b8() {
        if (this.b2) {
            this.bz = CategoryTrendLineManagerFactory.a(this.bz, this.e.ap(), this.e.jl, this.e, this.e.b2);
        }
    }
}
FinancialPriceSeriesView.$t = markType(FinancialPriceSeriesView, 'FinancialPriceSeriesView', FinancialSeriesView.$);
/*<BeginStatics Name="Infragistics.Controls.Charts.FinancialPriceSeries" />*/
/*<EndStatics Name="Infragistics.Controls.Charts.FinancialPriceSeries" />*/
