/*
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 { AnnotationLayer } from "./AnnotationLayer";
import { ValueLayerValueMode_$type } from "./ValueLayerValueMode";
import { DependencyProperty } from "igniteui-angular-core";
import { Brush } from "igniteui-angular-core";
import { Series } from "./Series";
import { Axis } from "./Axis";
import { enumGetBox, Delegate_$type, Number_$type, typeCast, fromEnum, Point_$type, markType, markDep, runOn } from "igniteui-angular-core";
import { Thickness } from "igniteui-angular-core";
import { Visibility_$type } from "igniteui-angular-core";
import { OverlayTextLocation_$type } from "./OverlayTextLocation";
import { AnnotationAppearanceMode_$type } from "./AnnotationAppearanceMode";
import { OverlayTextUtil } from "./OverlayTextUtil";
import { ValueLayerFrame } from "./ValueLayerFrame";
import { List$1 } from "igniteui-angular-core";
import { Dictionary$2 } from "igniteui-angular-core";
import { Pool$1 } from "igniteui-angular-core";
import { AxisAnnotation } from "./AxisAnnotation";
import { DataLegendSeriesContext } from "igniteui-angular-core";
import { DataLegendSeriesValueInfo } from "igniteui-angular-core";
import { AxisAnnotationFrameManager } from "./AxisAnnotationFrameManager";
import { DoubleCollection } from "igniteui-angular-core";
import { DeviceUtils } from "igniteui-angular-core";
import { OverlayTextUpdatingEventArgs } from "./OverlayTextUpdatingEventArgs";
import { OverlayTextInfo } from "./OverlayTextInfo";
import { AnnotationLayerView } from "./AnnotationLayerView";
import { TextBlock } from "igniteui-angular-core";
import { Rectangle } from "igniteui-angular-core";
import { Rect } from "igniteui-angular-core";
import { Tuple$2 } from "igniteui-angular-core";
import { Path } from "igniteui-angular-core";
import { PathGeometry } from "igniteui-angular-core";
import { PathFigure } from "igniteui-angular-core";
import { LineSegment } from "igniteui-angular-core";
import { BrushUtil } from "igniteui-angular-core";
import { PropertyMetadata } from "igniteui-angular-core";
import { isNaN_ } from "igniteui-angular-core";
import { stringIsNullOrEmpty } from "igniteui-angular-core";
import { Defaults } from "./Defaults";
import { TranslateTransform } from "igniteui-angular-core";
import { LineGeometry } from "igniteui-angular-core";
/**
 * @hidden
 */
export let ValueLayer = /*@__PURE__*/ (() => {
    class ValueLayer extends AnnotationLayer {
        constructor() {
            super();
            this.aau = null;
            this.aaf = [NaN, NaN];
            this.aao = null;
            this.aap = null;
            this.afg = null;
            this.stylingOverlayText = null;
            this.aa5 = null;
            this.aa4 = null;
            let a = new ValueLayerFrame();
            let b = new ValueLayerFrame();
            let c = new ValueLayerFrame();
            let d = this.kh / 1000;
            this.xm = a;
            this.xl = b;
            this.xn = c;
            this.ab = ValueLayer.$;
            this.aau = OverlayTextUtil.c();
        }
        bk() {
            return new ValueLayer();
        }
        get_ev() {
            return true;
        }
        ct() {
            return new ValueLayerView(this);
        }
        q7(a) {
            super.q7(a);
            this.aat = a;
        }
        gv(a) {
            if (this.aaq == null) {
                return true;
            }
            if (this.aaq == a) {
                return true;
            }
            return false;
        }
        get afi() {
            return new Thickness(1, this.abi, this.abk, this.abj, this.abh);
        }
        get afj() {
            return new Thickness(1, this.abo, this.abq, this.abp, this.abn);
        }
        get aav() {
            return this.aau;
        }
        set aav(a) {
            let b = this.aau;
            if (OverlayTextUtil.q(a)) {
                a = OverlayTextUtil.c();
            }
            this.aau = a;
            if (b != this.aau) {
                this.raisePropertyChanged("OverlayTextStyle", b, this.aau);
            }
        }
        mh() {
            return "Value Layer";
        }
        get_isSummarizationSupported() {
            return false;
        }
        i8(a, b, c) {
            if (isNaN_(this.aaf[0]) && isNaN_(this.aaf[1])) {
                return super.i8(a, b, c);
            }
            if (!isNaN_(this.aaf[0])) {
                return this.aaf[0];
            }
            return this.aaf[1];
        }
        getDataLegendSeriesContextAt(a, b) {
            if (isNaN_(this.aaf[0]) || isNaN_(this.aaf[1])) {
                return super.getDataLegendSeriesContextAt(a, b);
            }
            if (this.aaq == null) {
                let c = new DataLegendSeriesValueInfo();
                c.l = this.aaf[0];
                c.a = 0;
                c.q = "Value";
                c.r = "Value";
                c.s = "";
                let d = new DataLegendSeriesValueInfo();
                d.l = this.aaf[1];
                d.a = 0;
                d.q = "Value";
                d.r = "Value";
                d.s = "";
                let e = new DataLegendSeriesContext();
                e.e = ((() => {
                    let $ret = new List$1(DataLegendSeriesValueInfo.$, 0);
                    $ret.add(c);
                    $ret.add(d);
                    return $ret;
                })());
                e.h = this.mh();
                return e;
            }
            let f = this.aaq.getDataLegendSeriesContextAt(a, b);
            let g = typeCast(DataLegendSeriesContext.$, f);
            if (g == null || g.e == null) {
                return super.getDataLegendSeriesContextAt(a, b);
            }
            if (g.e.count == 0) {
                g.e._inner[0].l = isNaN_(this.aaf[0]) ? this.aaf[1] : this.aaf[0];
            }
            else {
                g.e._inner[0].l = this.aaf[0];
                g.e._inner[1].l = this.aaf[1];
            }
            return g;
        }
        y1(a, b) {
            if (this.aaq == null || this.aaq == a) {
                if (!this.a1.c) {
                    this.ry(b);
                }
            }
        }
        y3(a, b) {
            super.y3(a, b);
            let c = a;
            let d = this.aa3;
            let e = this.aa2;
            c.af.clear();
            c.ag.clear();
            c.ae.clear();
            c.ah.clear();
            AxisAnnotationFrameManager.b(c);
            this.aaf = [NaN, NaN];
            this.aao = null;
            this.aap = null;
            this.aat.cu();
            let f = this.aar();
            if (this.xs(this.aaq)) {
                let g = this.aaq.aq(f);
                this.aaf = g;
                this.adg(c, d, e, this.aaq);
            }
            else {
                if (f == 5 || f == 4 || f == 6) {
                    let h = null;
                    let i = null;
                    let j = [NaN, NaN];
                    let k = 0;
                    for (let l of fromEnum(this.dc.series)) {
                        if (!this.xs(l)) {
                            continue;
                        }
                        let m = l.ai();
                        for (let o = 0; o < m.length; o++) {
                            let n = m[o];
                            if (!this.aax(n)) {
                                continue;
                            }
                            let p = n.dq ? 1 : 0;
                            let q = j[p];
                            let r = null;
                            if (f == 5) {
                                let s = l.jb(2, n);
                                if (!isNaN_(s) && (s > q || isNaN_(q))) {
                                    r = l;
                                }
                                q = !isNaN_(q) ? Math.max(s, q) : s;
                            }
                            else if (f == 4) {
                                let t = l.jb(1, n);
                                if (!isNaN_(t) && (t < q || isNaN_(q))) {
                                    r = l;
                                }
                                q = !isNaN_(q) ? Math.min(t, q) : t;
                            }
                            else if (f == 6) {
                                let u = l.jb(3, n);
                                r = l;
                                q = !isNaN_(q) ? q + u : u;
                            }
                            if (n.dq) {
                                i = r != null ? r : i;
                            }
                            else {
                                h = r != null ? r : h;
                            }
                            j[p] = q;
                        }
                        k++;
                    }
                    if (f == 6) {
                        j[0] = !isNaN_(j[0]) ? j[0] / k : NaN;
                        j[1] = !isNaN_(j[1]) ? j[1] / k : NaN;
                    }
                    if (h != null && !isNaN_(j[0])) {
                        let v = h.wq(j);
                        this.adj(h, { $type: Point_$type, x: v.x, y: NaN }, c, d, e);
                    }
                    if (i != null && !isNaN_(j[1])) {
                        let w = i.wq(j);
                        this.adj(i, { $type: Point_$type, x: NaN, y: w.y }, c, d, e);
                    }
                    this.aaf = j;
                    this.aao = h;
                    this.aap = i;
                }
                else {
                    for (let x of fromEnum(this.dc.series)) {
                        this.adg(c, d, e, x);
                    }
                }
            }
        }
        adg(a, b, c, d) {
            if (this.xs(d)) {
                this.adi(d, a, b, c);
            }
            if (d.isStacked) {
                d.p9((e) => {
                    if (this.xs(e)) {
                        this.adi(e, a, b, c);
                    }
                    if (e.ei) {
                        e.p7((f) => {
                            if (this.xs(f)) {
                                this.adi(f, a, b, c);
                            }
                            return true;
                        });
                    }
                    return true;
                });
            }
            if (d.ei) {
                d.p7((e) => {
                    if (this.xs(e)) {
                        this.adi(e, a, b, c);
                    }
                    return true;
                });
            }
        }
        xs(a) {
            if (!super.xs(a)) {
                return false;
            }
            return true;
        }
        aax(a) {
            if (!a.dh) {
                return false;
            }
            if (this.aaj != null && this.aaj != a) {
                return false;
            }
            return true;
        }
        qv() {
            super.qv();
            if (!this.a1.c && !this.d4()) {
                return;
            }
            if (this.d4()) {
                this.adk(this.xn, false);
            }
            else {
                this.adk(this.xl, false);
            }
        }
        aar() {
            if (this.aas == 0) {
                return 2;
            }
            return this.aas;
        }
        xc() {
            return 3;
        }
        xz() {
            return 0.3;
        }
        x2() {
            return -0.4;
        }
        x1() {
            return 0.5;
        }
        z4() {
            return this.w9 == 3 ? this.afh() : null;
        }
        z5() {
            return this.xa == 3 ? this.afh() : null;
        }
        afh() {
            if (this.afg == null) {
                this.afg = new DoubleCollection();
                this.afg.add(DeviceUtils.g(5));
                this.afg.add(DeviceUtils.g(5));
            }
            return this.afg;
        }
        adh() {
            if (OverlayTextUtil.q(this.aau)) {
                this.aau = OverlayTextUtil.c();
            }
            else if (OverlayTextUtil.k(this.aau)) {
                this.aau = this.cw.l(this.aau.fontString);
            }
        }
        adj(a, b, c, d, e) {
            let f = false;
            let g = this.ae4;
            if (g == null) {
                g = a.vj;
                f = true;
            }
            let h = false;
            let i = this.afa;
            if (i == null) {
                if (this.ae4 != null) {
                    i = this.ae4;
                }
                else {
                    i = a.vj;
                    h = true;
                }
            }
            let j = false;
            let k = this.afd;
            if (k == null) {
                if (this.ae4 != null) {
                    k = this.ae4;
                }
                else {
                    k = a.vj;
                    j = true;
                }
            }
            let l = g;
            let m = g;
            let n = i;
            let o = k;
            if (this.ae5 != null) {
                l = this.ae5;
            }
            else if (f) {
                switch (this.w9) {
                    case 1:
                        l = this.aat.ck(l, this.xw);
                        break;
                    case 2:
                        l = this.aat.cm(l, this.xw);
                        break;
                    case 4:
                        l = this.aat.cl(l, this.xw);
                        break;
                }
            }
            if (this.ae9 != null) {
                m = this.ae9;
            }
            else if (f) {
                switch (this.xa) {
                    case 1:
                        m = this.aat.ck(m, this.xy);
                        break;
                    case 2:
                        m = this.aat.cm(m, this.xy);
                        break;
                    case 4:
                        m = this.aat.cl(m, this.xy);
                        break;
                }
            }
            if (h) {
                switch (this.xa) {
                    case 1:
                        n = this.aat.ck(n, this.xy);
                        break;
                    case 2:
                        n = this.aat.cm(n, this.xy);
                        break;
                }
            }
            if (j) {
                switch (this.w9) {
                    case 1:
                        o = this.aat.ck(o, this.xw);
                        break;
                    case 2:
                        o = this.aat.cm(o, this.xw);
                        break;
                }
            }
            c.ae.add(l);
            c.ah.add(m);
            c.af.add(b.y);
            c.ag.add(b.x);
            let p = isNaN_(b.x);
            let q = p ? b.y : b.x;
            this.adh();
            let r = this.aav;
            let s = OverlayTextUtil.o(r, this.aa1);
            let t = this.aam;
            if (t == 18) {
                s = false;
            }
            if (s && !stringIsNullOrEmpty(this.aby)) {
                let u = this.ae8;
                if (u == null && this.aa0) {
                    u = g;
                }
                let v = this.ae6;
                if (v == null && this.aay) {
                    v = g;
                }
                let w = this.ae7;
                if (w == null && this.aaz) {
                    w = g;
                }
                let x = new OverlayTextUpdatingEventArgs();
                x.textLocation = this.aam;
                x.textAngle = this.aa6;
                x.textVisible = this.aa1;
                x.textContent = this.aby;
                x.textColorMode = this.aai;
                x.textColorShift = this.abb;
                x.textColor = u;
                x.backgroundMode = this.aag;
                x.backgroundShift = this.aa7;
                x.background = v;
                x.borderMode = this.aah;
                x.borderShift = this.aa9;
                x.borderStroke = w;
                x.borderRadius = this.aa8;
                x.borderThickness = this.aba;
                x.shapeBrush = g;
                x.shapeOutline = g;
                x.f = p;
                x.horizontalMargin = this.abc;
                x.verticalPadding = this.abf;
                x.verticalMargin = this.abe;
                x.horizontalPadding = this.abd;
                if (this.stylingOverlayText != null) {
                    this.stylingOverlayText(this, x);
                }
                OverlayTextUtil.ad(x);
                let y = OverlayTextInfo.d(x);
                if (y.textVisible && !y.h) {
                    this.aat.cq.count += 1;
                    this.aat.cp.count += 1;
                    let z = this.aat.cq.count - 1;
                    y.f = r;
                    y.ad = this.cw.cc(y.textContent, y.f);
                    y.u = this.aat.cq.item(z);
                    y.ac = this.aat.cp.item(z);
                    if (y.g) {
                        let aa = this.dc.xe({ $type: Point_$type, x: 0, y: NaN });
                        let ab = this.dc.xe({ $type: Point_$type, x: 1, y: NaN });
                        let ac = ab.x - aa.x;
                        y.ab = new Rect(0, aa.x, q, ac, 1);
                    }
                    else {
                        let ad = this.dc.xe({ $type: Point_$type, x: NaN, y: 0 });
                        let ae = this.dc.xe({ $type: Point_$type, x: NaN, y: 1 });
                        let af = ae.y - ad.y;
                        y.ab = new Rect(0, q, ad.y, 1, af);
                    }
                    OverlayTextUtil.ac(y);
                    this.cw.av(y.u, y.f);
                    this.cw.aw(y.u, y.f);
                }
            }
            if (this.aaw) {
                AxisAnnotationFrameManager.c(c, b, a, this.dc, this.getEffectiveViewport(), g, n, this.abg, this.afc, this.afb, this.afi, this.abl, o, this.abm, this.aff, this.afe, this.afj, this.abr, this.afl == 0, this.afk == 0);
            }
        }
        adi(a, b, c, d) {
            let e = { $type: Point_$type, x: NaN, y: NaN };
            let f = this.aar();
            switch (f) {
                case 5:
                    e = a.wp(2);
                    break;
                case 4:
                    e = a.wp(1);
                    break;
                case 6:
                    e = a.wp(3);
                    break;
                default:
                    e = a.wp(f);
                    break;
            }
            let i = a.ai();
            for (let h = 0; h < i.length; h++) {
                let g = i[h];
                if (!this.aax(g)) {
                    continue;
                }
                if (g.dq) {
                    this.adj(a, { $type: Point_$type, x: NaN, y: e.y }, b, c, d);
                }
                else {
                    this.adj(a, { $type: Point_$type, x: e.x, y: NaN }, b, c, d);
                }
            }
        }
        adk(a, b) {
            let c = false;
            if (this.aa4 == null) {
                c = true;
                this.aa5 = new List$1(Axis.$, 0);
                this.aa4 = new Dictionary$2(Axis.$, Pool$1.$.specialize(AxisAnnotation.$), 0);
            }
            AxisAnnotationFrameManager.d(this, a, c, this.aa4, this.aa5, b, this.abs, this.abt, this.aak, this.aal);
        }
        adf(a, b, c, d, e) {
            let f = a.item(b);
            b++;
            if (e) {
                f._stroke = d.ah._inner[c];
                f._fill = d.ah._inner[c];
            }
            else {
                f._stroke = d.ae._inner[c];
                f._fill = d.ae._inner[c];
            }
            f.ad = this.ig;
            f.ai = e ? this.z2 : this.z1;
            f.am = this.wf;
            f.al = this.we;
            f.ak = this.we;
            f.aj = this.wd;
            f.ac = this.jk;
            return new Tuple$2(Path.$, Number_$type, f, b);
        }
        y6(a, b) {
            super.y6(a, b);
            let c = this.aat.co;
            let d = a;
            let e = d.af.count;
            let f = 0;
            let g = b.b9.left;
            let h = b.b9.right;
            let i = b.b9.top;
            let j = b.b9.bottom;
            let k = this.afl == 0;
            let l = this.afk == 0;
            for (let m = 0; m < e; m++) {
                let n = Math.floor(d.af._inner[m]);
                let o = Math.floor(d.ag._inner[m]);
                let p = null;
                if (k) {
                    if (!isNaN_(o)) {
                        let q = this.adf(c, f, m, d, true);
                        p = q.c;
                        f = q.d;
                        let r = new PathGeometry();
                        let s = new PathFigure();
                        s._startPoint = { $type: Point_$type, x: o, y: i };
                        let t = new LineSegment(1);
                        t.c = { $type: Point_$type, x: o, y: j };
                        s._segments.add(t);
                        r.c.add(s);
                        p.an = r;
                    }
                }
                if (l) {
                    if (!isNaN_(n)) {
                        let u = this.adf(c, f, m, d, false);
                        p = u.c;
                        f = u.d;
                        let v = new PathGeometry();
                        let w = new PathFigure();
                        w._startPoint = { $type: Point_$type, x: g, y: n };
                        let x = new LineSegment(1);
                        x.c = { $type: Point_$type, x: h, y: n };
                        w._segments.add(x);
                        v.c.add(w);
                        p.an = v;
                    }
                }
            }
            c.count = f;
            if (this.d4()) {
                this.adk(this.xn, true);
            }
            else {
                this.adk(this.xl, false);
            }
        }
        gb() {
            return true;
        }
        rg(a, b, c, d) {
            super.rg(a, b, c, d);
            switch (b) {
                case "SeriesViewer":
                    if (d == null) {
                        if (this.aa4 != null && this.aa4.count > 0) {
                            let e;
                            if (this.d4()) {
                                e = this.xn;
                            }
                            else {
                                e = this.xl;
                            }
                            AxisAnnotationFrameManager.b(e);
                            AxisAnnotationFrameManager.d(this, e, true, this.aa4, this.aa5, true, this.abs, this.abt, this.aak, this.aal);
                        }
                    }
                    break;
                case ValueLayer.$$p[2]:
                    this.ry(true);
                    break;
                case ValueLayer.$$p[32]:
                    this.ry(true);
                    break;
                case ValueLayer.$$p[28]:
                case "Visibility":
                    this.ry(true);
                    break;
                case ValueLayer.$$p[3]:
                case ValueLayer.$$p[34]:
                case ValueLayer.$$p[33]:
                case ValueLayer.$$p[37]:
                case ValueLayer.$$p[39]:
                case ValueLayer.$$p[41]:
                case ValueLayer.$$p[40]:
                case ValueLayer.$$p[38]:
                case ValueLayer.$$p[42]:
                case ValueLayer.$$p[43]:
                case ValueLayer.$$p[45]:
                case ValueLayer.$$p[48]:
                case ValueLayer.$$p[50]:
                case ValueLayer.$$p[52]:
                case ValueLayer.$$p[51]:
                case ValueLayer.$$p[49]:
                case ValueLayer.$$p[53]:
                case ValueLayer.$$p[54]:
                case ValueLayer.$$p[1]:
                case ValueLayer.$$p[31]:
                case ValueLayer.$$p[29]:
                    this.ry(true);
                    break;
                case "Brush":
                case ValueLayer.$$p[30]:
                    if (this.vp != null) {
                        this.ae4 = this.vp;
                    }
                    else {
                        switch (this.aas) {
                            case 6:
                                this.ae4 = BrushUtil.j(255, 248, 173, 118);
                                break;
                            case 4:
                                this.ae4 = BrushUtil.j(255, 246, 93, 80);
                                break;
                            case 5:
                                this.ae4 = BrushUtil.j(255, 99, 208, 0);
                                break;
                            default:
                                this.ae4 = this.aaq != null ? this.aaq.vj : null;
                                break;
                        }
                    }
                    this.ry(true);
                    break;
                case ValueLayer.$$p[22]:
                case ValueLayer.$$p[25]:
                case ValueLayer.$$p[21]:
                case ValueLayer.$$p[4]:
                case ValueLayer.$$p[17]:
                case ValueLayer.$$p[15]:
                case ValueLayer.$$p[16]:
                case ValueLayer.$$p[18]:
                case ValueLayer.$$p[7]:
                case ValueLayer.$$p[5]:
                case ValueLayer.$$p[6]:
                case ValueLayer.$$p[8]:
                case ValueLayer.$$p[10]:
                case ValueLayer.$$p[11]:
                case ValueLayer.$$p[13]:
                case ValueLayer.$$p[9]:
                case ValueLayer.$$p[12]:
                case ValueLayer.$$p[14]:
                case ValueLayer.$$p[19]:
                case ValueLayer.$$p[20]:
                case ValueLayer.$$p[24]:
                case ValueLayer.$$p[23]:
                    this.ry(true);
                    break;
            }
        }
        pb(a, b) {
            super.pb(a, b);
            if (a) {
                AxisAnnotationFrameManager.b(this.xl);
                this.adk(this.xl, false);
            }
        }
    }
    ValueLayer.$t = markType(ValueLayer, 'ValueLayer', AnnotationLayer.$);
    ValueLayer.$$p = markDep(DependencyProperty, PropertyMetadata, ValueLayer, 'raisePropertyChanged', ['ActualValueLayerBrush:ae4:adl', [Brush.$, null], 'HorizontalLineStroke:ae5:adm', [Brush.$, null], 'HorizontalLineVisibility:afk:adn', [Visibility_$type, enumGetBox(Visibility_$type, 0)], 'IsAxisAnnotationEnabled:aaw:ado', [0, false], 'OverlayTextAngle:aa6:adp', [1, NaN], 'OverlayTextBackgroundMatchLayer:aay:adq', [0, false], 'OverlayTextBackgroundMode:aag:adr', [AnnotationAppearanceMode_$type, enumGetBox(AnnotationAppearanceMode_$type, 0)], 'OverlayTextBackground:ae6:ads', [Brush.$, null], 'OverlayTextBackgroundShift:aa7:adt', [1, NaN], 'OverlayTextBorderColor:ae7:adu', [Brush.$, null], 'OverlayTextBorderMatchLayer:aaz:adv', [0, false], 'OverlayTextBorderMode:aah:adw', [AnnotationAppearanceMode_$type, enumGetBox(AnnotationAppearanceMode_$type, 0)], 'OverlayTextBorderRadius:aa8:adx', [1, NaN], 'OverlayTextBorderShift:aa9:ady', [1, NaN], 'OverlayTextBorderThickness:aba:adz', [1, 1], 'OverlayTextColorMatchLayer:aa0:ad0', [0, true], 'OverlayTextColorMode:aai:ad1', [AnnotationAppearanceMode_$type, enumGetBox(AnnotationAppearanceMode_$type, 0)], 'OverlayTextColor:ae8:ad2', [Brush.$, null], 'OverlayTextColorShift:abb:ad3', [1, NaN], 'OverlayTextHorizontalMargin:abc:ad4', [1, NaN], 'OverlayTextHorizontalPadding:abd:ad5', [1, NaN], 'OverlayTextLocation:aam:ad6', [OverlayTextLocation_$type, enumGetBox(OverlayTextLocation_$type, 0)], 'OverlayText:aby:ad7', [2, null], 'OverlayTextVerticalMargin:abe:ad8', [1, NaN], 'OverlayTextVerticalPadding:abf:ad9', [1, NaN], 'OverlayTextVisible:aa1:aea', [0, true], 'SkipUnknownValues:aa2:aeb', [0, true], 'TargetAxis:aaj:aec', [Axis.$, null], 'TargetSeries:aaq:aed', [Series.$, null], 'UseInterpolation:aa3:aee', [0, true], 'ValueMode:aas:aef', [ValueLayerValueMode_$type, enumGetBox(ValueLayerValueMode_$type, 2)], 'VerticalLineStroke:ae9:aeg', [Brush.$, null], 'VerticalLineVisibility:afl:aeh', [Visibility_$type, enumGetBox(Visibility_$type, 0)], 'XAxisAnnotationBackgroundCornerRadius:abg:aei', [1, DeviceUtils.g(3)], 'XAxisAnnotationBackground:afa:aej', [Brush.$, null], 'XAxisAnnotationFormatLabel:aak:aek', [Delegate_$type], 'XAxisAnnotationInterpolatedValuePrecision:abs:ael', [1, -1], 'XAxisAnnotationOutline:afb:aem', [Brush.$, null], 'XAxisAnnotationPaddingBottom:abh:aen', [1, NaN], 'XAxisAnnotationPaddingLeft:abi:aeo', [1, NaN], 'XAxisAnnotationPaddingRight:abj:aep', [1, NaN], 'XAxisAnnotationPaddingTop:abk:aeq', [1, NaN], 'XAxisAnnotationStrokeThickness:abl:aer', [1, NaN], 'XAxisAnnotationTextColor:afc:aes', [Brush.$, null], 'YAxisAnnotationBackgroundCornerRadius:abm:aet', [1, DeviceUtils.g(3)], 'YAxisAnnotationBackground:afd:aeu', [Brush.$, null], 'YAxisAnnotationFormatLabel:aal:aev', [Delegate_$type], 'YAxisAnnotationInterpolatedValuePrecision:abt:aew', [1, -1], 'YAxisAnnotationOutline:afe:aex', [Brush.$, null], 'YAxisAnnotationPaddingBottom:abn:aey', [1, NaN], 'YAxisAnnotationPaddingLeft:abo:aez', [1, NaN], 'YAxisAnnotationPaddingRight:abp:ae0', [1, NaN], 'YAxisAnnotationPaddingTop:abq:ae1', [1, NaN], 'YAxisAnnotationStrokeThickness:abr:ae2', [1, NaN], 'YAxisAnnotationTextColor:aff:ae3', [Brush.$, null]]);
    return ValueLayer;
})();
/**
 * @hidden
 */
export let ValueLayerView = /*@__PURE__*/ (() => {
    class ValueLayerView extends AnnotationLayerView {
        constructor(a) {
            super(a);
            this.cn = null;
            this.co = null;
            this.ct = null;
            this.cs = null;
            this.cq = null;
            this.cr = null;
            this.cp = null;
            this.cn = a;
            this.ct = new List$1(Path.$, 0);
        }
        cu() {
            OverlayTextUtil.u(this.cq);
            OverlayTextUtil.v(this.cs);
            this.cp.clear();
            this.cr.clear();
            this.cq.count = 0;
            this.cp.count = 0;
        }
        a4() {
            super.a4();
            this.co = ((() => {
                let $ret = new Pool$1(Path.$);
                $ret.create = runOn(this, this.c6);
                $ret.activate = runOn(this, this.cv);
                $ret.disactivate = runOn(this, this.cx);
                $ret.destroy = runOn(this, this.cw);
                return $ret;
            })());
            this.cs = new List$1(TextBlock.$, 0);
            this.cq = ((() => {
                let $ret = new Pool$1(TextBlock.$);
                $ret.create = runOn(this, this.c5);
                $ret.activate = runOn(this, this.c1);
                $ret.disactivate = runOn(this, this.c3);
                $ret.destroy = runOn(this, this.c2);
                return $ret;
            })());
            this.cr = new List$1(Rectangle.$, 0);
            this.cp = ((() => {
                let $ret = new Pool$1(Rectangle.$);
                $ret.create = runOn(this, this.c7);
                $ret.activate = runOn(this, this.cy);
                $ret.disactivate = runOn(this, this.c0);
                $ret.destroy = runOn(this, this.cz);
                return $ret;
            })());
            this.cn.jt = Defaults.crosshairLineThickness;
        }
        c5() {
            let a = new TextBlock();
            this.cs.add(a);
            return a;
        }
        c2(a) {
            if (this.cs.contains(a)) {
                this.cs.remove(a);
            }
        }
        c1(a) {
            a._visibility = 0;
            a.s = 0;
        }
        c3(a) {
            a._visibility = 1;
        }
        c7() {
            let a = new Rectangle();
            this.cr.add(a);
            return a;
        }
        cz(a) {
            a.dataContext = null;
            if (this.cr.contains(a)) {
                this.cr.remove(a);
            }
        }
        cy(a) {
            a._visibility = 0;
        }
        c0(a) {
            a._visibility = 1;
        }
        c6() {
            let a = new Path();
            a.j = new TranslateTransform();
            this.ct.add(a);
            return a;
        }
        cv(a) {
            a._visibility = 0;
        }
        cx(a) {
            a._visibility = 1;
        }
        cw(a) {
            this.ct.remove(a);
        }
        c4(a, b, c, d) {
            if (a.an == null || a.an.c.x != d || a.an.d.x != c) {
                let e = ((() => {
                    let $ret = new LineGeometry();
                    $ret.d = { $type: Point_$type, x: c, y: b };
                    $ret.c = { $type: Point_$type, x: d, y: b };
                    return $ret;
                })());
                a.an = e;
            }
        }
        bj(a, b) {
            super.bj(a, b);
            if (a.d && !b) {
                for (let c = 0; c < this.ct.count; c++) {
                    let d = this.ct._inner[c];
                    if (d._visibility == 0) {
                        a.t(d);
                    }
                }
                for (let e = 0; e < this.cp.count; e++) {
                    let f = this.cp.item(e);
                    if (f._visibility == 0) {
                        a.w(f);
                    }
                }
                for (let g = 0; g < this.cq.count; g++) {
                    let h = this.cq.item(g);
                    a.ae(h.dataContext);
                    a.x(h);
                }
            }
        }
        ax(a) {
            super.ax(a);
            for (let b = 0; b < this.ct.count; b++) {
                this.f.bc.exportPathData(a, this.ct._inner[b], "crosshairLine", ["Main", "Crosshair"]);
            }
        }
    }
    ValueLayerView.$t = markType(ValueLayerView, 'ValueLayerView', AnnotationLayerView.$);
    return ValueLayerView;
})();
