/*
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 { Axis } from "./Axis";
import { DependencyProperty } from "igniteui-angular-core";
import { DataToolTipLayerGroupingMode_$type } from "igniteui-angular-core";
import { Series } from "./Series";
import { Rect } from "igniteui-angular-core";
import { Base, enumGetBox, EnumUtil, fromEnum, typeCast, String_$type, typeGetValue, Point_$type, Array_$type, markType, markDep, runOn, TypeRegistrar } from "igniteui-angular-core";
import { Size } from "igniteui-angular-core";
import { RectUtil } from "igniteui-angular-core";
import { DataTooltipGroupedPositionX_$type } from "igniteui-angular-core";
import { DataTooltipGroupedPositionY_$type } from "igniteui-angular-core";
import { DataAbbreviationMode_$type } from "igniteui-angular-core";
import { DataLegendValueMode_$type } from "igniteui-angular-core";
import { Thickness } from "igniteui-angular-core";
import { Brush } from "igniteui-angular-core";
import { DataLegendHeaderDateMode_$type } from "igniteui-angular-core";
import { DataLegendHeaderTimeMode_$type } from "igniteui-angular-core";
import { DataLegendSummaryType_$type } from "igniteui-angular-core";
import { LegendItemBadgeShape_$type } from "igniteui-angular-core";
import { DataLegendUnitsMode_$type } from "igniteui-angular-core";
import { DataLegendLabelMode_$type } from "igniteui-angular-core";
import { DataToolTipLayerFrame } from "./DataToolTipLayerFrame";
import { Dictionary$2 } from "igniteui-angular-core";
import { List$1 } from "igniteui-angular-core";
import { Pool$1 } from "igniteui-angular-core";
import { DataToolTipSeriesInfo } from "./DataToolTipSeriesInfo";
import { DataContext } from "igniteui-angular-core";
import { DataTooltipCollisionInfo } from "./DataTooltipCollisionInfo";
import { DeviceUtils } from "igniteui-angular-core";
import { HashSet$1 } from "igniteui-angular-core";
import { PropertyMetadata } from "igniteui-angular-core";
import { isNaN_ } from "igniteui-angular-core";
import { stringEmpty } from "igniteui-angular-core";
import { AnnotationLayerView } from "./AnnotationLayerView";
import { PointerTooltip } from "./PointerTooltip";
import { IOnDemandRender_$type } from "igniteui-angular-core";
/**
 * @hidden
 */
export let DataToolTipLayer = /*@__PURE__*/ (() => {
    class DataToolTipLayer extends AnnotationLayer {
        constructor() {
            super();
            this.t0 = 1;
            this.u2 = new Dictionary$2(String_$type, Base.$, 0);
            this.u3 = new List$1(String_$type, 0);
            this.ts = 8;
            this.tw = 11;
            this.uf = null;
            this.t7 = null;
            this.ua = null;
            this.uc = null;
            this.t9 = null;
            this.ub = null;
            this.ue = null;
            this.ud = null;
            this.t8 = null;
            let a = new DataToolTipLayerFrame();
            let b = new DataToolTipLayerFrame();
            let c = new DataToolTipLayerFrame();
            this.qq = a;
            this.qp = b;
            this.qr = c;
            this.ab = DataToolTipLayer.$;
        }
        get_dc() {
            return true;
        }
        by() {
            return new DataToolTipLayerView(this);
        }
        l4(a) {
            super.l4(a);
            this.t4 = a;
        }
        get_dn() {
            return true;
        }
        get t1() {
            return this.t0;
        }
        set t1(a) {
            let b = this.t0;
            this.t0 = a;
            if (b != this.t0) {
                this.raisePropertyChanged("ActualGroupingMode", enumGetBox(DataToolTipLayerGroupingMode_$type, b), enumGetBox(DataToolTipLayerGroupingMode_$type, this.t0));
            }
        }
        t3() {
            let a = true;
            let b = true;
            let c = true;
            let d = true;
            if (this.t2 != 0) {
                return this.t2;
            }
            let e = this.tj();
            if (e != null) {
                for (let f of fromEnum(e.da())) {
                    if (!f.dd && !f.ef) {
                        a = false;
                    }
                    if (!f.dd && !f.d9) {
                        b = false;
                    }
                    if (!f.dd && !f.eg) {
                        c = false;
                    }
                    if (!f.dd && !f.ed) {
                        d = false;
                    }
                }
            }
            if (a || b || c || d) {
                return 2;
            }
            return 1;
        }
        l9(a, b, c, d) {
            super.l9(a, b, c, d);
            switch (b) {
                case DataToolTipLayer.$$p[37]:
                    this.mn(true);
                    break;
                case DataToolTipLayer.$$p[44]:
                    this.mn(true);
                    break;
                case DataToolTipLayer.$$p[8]:
                    this.t1 = this.t3();
                    break;
                case "ActualGroupingMode":
                    this.mn(true);
                    break;
                case DataToolTipLayer.$$p[6]:
                    this.tt = this.tv();
                    break;
                case DataToolTipLayer.$$p[7]:
                    this.tx = this.tz();
                    break;
                case "SeriesViewer":
                    this.t4.ci();
                    break;
                case DataToolTipLayer.$$p[26]:
                case DataToolTipLayer.$$p[20]:
                case DataToolTipLayer.$$p[5]:
                case DataToolTipLayer.$$p[19]:
                case DataToolTipLayer.$$p[4]:
                case DataToolTipLayer.$$p[45]:
                case DataToolTipLayer.$$p[47]:
                case DataToolTipLayer.$$p[48]:
                case DataToolTipLayer.$$p[49]:
                case DataToolTipLayer.$$p[46]:
                case DataToolTipLayer.$$p[52]:
                case DataToolTipLayer.$$p[51]:
                case DataToolTipLayer.$$p[50]:
                case DataToolTipLayer.$$p[53]:
                case DataToolTipLayer.$$p[54]:
                case DataToolTipLayer.$$p[58]:
                case DataToolTipLayer.$$p[57]:
                case DataToolTipLayer.$$p[56]:
                case DataToolTipLayer.$$p[55]:
                case "ValueTextStyle":
                case DataToolTipLayer.$$p[12]:
                case DataToolTipLayer.$$p[11]:
                case DataToolTipLayer.$$p[9]:
                case DataToolTipLayer.$$p[10]:
                case DataToolTipLayer.$$p[13]:
                case DataToolTipLayer.$$p[18]:
                case DataToolTipLayer.$$p[16]:
                case DataToolTipLayer.$$p[17]:
                case DataToolTipLayer.$$p[14]:
                case DataToolTipLayer.$$p[15]:
                case "HeaderTextStyle":
                case DataToolTipLayer.$$p[30]:
                case "SummaryTitleTextStyle":
                case DataToolTipLayer.$$p[33]:
                case DataToolTipLayer.$$p[32]:
                case DataToolTipLayer.$$p[31]:
                case DataToolTipLayer.$$p[29]:
                case DataToolTipLayer.$$p[36]:
                case "SummaryValueTextStyle":
                case DataToolTipLayer.$$p[28]:
                case DataToolTipLayer.$$p[27]:
                case "SummaryLabelTextStyle":
                case DataToolTipLayer.$$p[35]:
                case DataToolTipLayer.$$p[34]:
                case "SummaryUnitsTextStyle":
                case DataToolTipLayer.$$p[0]:
                case DataToolTipLayer.$$p[1]:
                case DataToolTipLayer.$$p[40]:
                case DataToolTipLayer.$$p[43]:
                case DataToolTipLayer.$$p[41]:
                case DataToolTipLayer.$$p[42]:
                case "UnitsTextStyle":
                case DataToolTipLayer.$$p[39]:
                case DataToolTipLayer.$$p[38]:
                case "TitleTextStyle":
                case DataToolTipLayer.$$p[21]:
                case DataToolTipLayer.$$p[22]:
                case DataToolTipLayer.$$p[23]:
                case "LabelTextStyle":
                    this.yk(b, c, d);
                    break;
            }
        }
        yk(a, b, c) {
            if (!this.u2.containsKey(a)) {
                this.u3.add(a);
                this.u2.addItem(a, c);
            }
            else {
                this.u2.item(a, c);
            }
            this.mn(true);
        }
        yo(a, b) {
            switch (a) {
                case DataToolTipLayer.$$p[8]:
                    this.t2 = EnumUtil.getEnumValue(DataToolTipLayerGroupingMode_$type, b);
                    break;
                case DataToolTipLayer.$$p[24]:
                    this.u7 = b;
                    break;
                case DataToolTipLayer.$$p[25]:
                    this.u8 = b;
                    break;
                case DataToolTipLayer.$$p[2]:
                    this.u5 = b;
                    break;
                case DataToolTipLayer.$$p[3]:
                    this.u6 = b;
                    break;
                case DataToolTipLayer.$$p[6]:
                    this.tu = EnumUtil.getEnumValue(DataTooltipGroupedPositionX_$type, b);
                    break;
                case DataToolTipLayer.$$p[7]:
                    this.ty = EnumUtil.getEnumValue(DataTooltipGroupedPositionY_$type, b);
                    break;
                case DataToolTipLayer.$$p[26]:
                    this.ux = b;
                    break;
                case DataToolTipLayer.$$p[20]:
                    this.th = b;
                    break;
                case DataToolTipLayer.$$p[5]:
                    this.tc = b;
                    break;
                case DataToolTipLayer.$$p[19]:
                    this.tg = b;
                    break;
                case DataToolTipLayer.$$p[4]:
                    this.tb = b;
                    break;
                case DataToolTipLayer.$$p[45]:
                    this.tl = EnumUtil.getEnumValue(DataAbbreviationMode_$type, b);
                    break;
                case DataToolTipLayer.$$p[47]:
                    this.v7 = typeGetValue(b);
                    break;
                case DataToolTipLayer.$$p[48]:
                    this.v8 = typeGetValue(b);
                    break;
                case DataToolTipLayer.$$p[49]:
                    this.tr = EnumUtil.getEnumValue(DataLegendValueMode_$type, b);
                    break;
                case DataToolTipLayer.$$p[46]:
                    this.x2 = b;
                    break;
                case DataToolTipLayer.$$p[52]:
                    this.uz = b;
                    break;
                case DataToolTipLayer.$$p[51]:
                    this.x8 = b;
                    break;
                case DataToolTipLayer.$$p[50]:
                    this.ti = b;
                    break;
                case DataToolTipLayer.$$p[53]:
                    this.aaz = b;
                    break;
                case DataToolTipLayer.$$p[54]:
                    this.u0 = b;
                    break;
                case DataToolTipLayer.$$p[58]:
                    this.yh = b;
                    break;
                case DataToolTipLayer.$$p[57]:
                    this.u1 = b;
                    break;
                case DataToolTipLayer.$$p[56]:
                    this.aa0 = b;
                    break;
                case DataToolTipLayer.$$p[55]:
                    this.aak = b;
                    break;
                case "ValueTextStyle":
                    this.uo = b;
                    break;
                case DataToolTipLayer.$$p[12]:
                    this.wq = b;
                    break;
                case DataToolTipLayer.$$p[11]:
                    this.tf = b;
                    break;
                case DataToolTipLayer.$$p[9]:
                    this.wm = b;
                    break;
                case DataToolTipLayer.$$p[10]:
                    this.tm = EnumUtil.getEnumValue(DataLegendHeaderDateMode_$type, b);
                    break;
                case DataToolTipLayer.$$p[13]:
                    this.tn = EnumUtil.getEnumValue(DataLegendHeaderTimeMode_$type, b);
                    break;
                case DataToolTipLayer.$$p[18]:
                    this.wv = b;
                    break;
                case DataToolTipLayer.$$p[16]:
                    this.aac = b;
                    break;
                case DataToolTipLayer.$$p[17]:
                    this.aat = b;
                    break;
                case DataToolTipLayer.$$p[14]:
                    this.aas = b;
                    break;
                case DataToolTipLayer.$$p[15]:
                    this.uq = b;
                    break;
                case "HeaderTextStyle":
                    this.ug = b;
                    break;
                case DataToolTipLayer.$$p[30]:
                    this.aaf = b;
                    break;
                case "SummaryTitleTextStyle":
                    this.uj = b;
                    break;
                case DataToolTipLayer.$$p[33]:
                    this.tp = EnumUtil.getEnumValue(DataLegendSummaryType_$type, b);
                    break;
                case DataToolTipLayer.$$p[32]:
                    this.xe = b;
                    break;
                case DataToolTipLayer.$$p[31]:
                    this.aaw = b;
                    break;
                case DataToolTipLayer.$$p[29]:
                    this.aav = b;
                    break;
                case DataToolTipLayer.$$p[36]:
                    this.aah = b;
                    break;
                case "SummaryValueTextStyle":
                    this.ul = b;
                    break;
                case DataToolTipLayer.$$p[28]:
                    this.w9 = b;
                    break;
                case DataToolTipLayer.$$p[27]:
                    this.aae = b;
                    break;
                case "SummaryLabelTextStyle":
                    this.ui = b;
                    break;
                case DataToolTipLayer.$$p[35]:
                    this.xk = b;
                    break;
                case DataToolTipLayer.$$p[34]:
                    this.aag = b;
                    break;
                case "SummaryUnitsTextStyle":
                    this.uk = b;
                    break;
                case DataToolTipLayer.$$p[0]:
                    this.aar = b;
                    break;
                case DataToolTipLayer.$$p[1]:
                    this.t6 = EnumUtil.getEnumValue(LegendItemBadgeShape_$type, b);
                    break;
                case DataToolTipLayer.$$p[40]:
                    this.tq = EnumUtil.getEnumValue(DataLegendUnitsMode_$type, b);
                    break;
                case DataToolTipLayer.$$p[43]:
                    this.xv = b;
                    break;
                case DataToolTipLayer.$$p[41]:
                    this.aaj = b;
                    break;
                case DataToolTipLayer.$$p[42]:
                    this.aay = b;
                    break;
                case "UnitsTextStyle":
                    this.un = b;
                    break;
                case DataToolTipLayer.$$p[39]:
                    this.aax = b;
                    break;
                case DataToolTipLayer.$$p[38]:
                    this.aai = b;
                    break;
                case "TitleTextStyle":
                    this.um = b;
                    break;
                case DataToolTipLayer.$$p[21]:
                    this.to = EnumUtil.getEnumValue(DataLegendLabelMode_$type, b);
                    break;
                case DataToolTipLayer.$$p[22]:
                    this.aad = b;
                    break;
                case DataToolTipLayer.$$p[23]:
                    this.aau = b;
                    break;
                case "LabelTextStyle":
                    this.uh = b;
                    break;
            }
        }
        yl(a) {
            for (let b = 0; b < this.u3.count; b++) {
                let c = this.u3._inner[b];
                a.updatePropertyByName(c, this.u2.item(c));
            }
        }
        r2(a, b) {
            {
                if (!this.at.c) {
                    this.mn(b);
                }
            }
        }
        r3(a, b) {
            if (!this.at.c) {
                this.mn(b);
            }
        }
        r5(a, b) {
            super.r5(a, b);
            this.t0 = this.t3();
            let c = a;
            let d = this.t4.b6;
            let e = this.uy;
            let f = false;
            c.m.clear();
            c.i.clear();
            c.l.clear();
            c.g.clear();
            c.f.clear();
            c.k.clear();
            c.j.clear();
            c.h.clear();
            if (isNaN_(this.s8.x) && isNaN_(this.s8.y)) {
                d.count = 0;
                return;
            }
            {
                if (this.t1 == 2) {
                    let g = 0;
                    {
                        for (let h of fromEnum(this.ce.series)) {
                            if (this.qw(h)) {
                                this.yn(h, c, e, f, g);
                                g++;
                            }
                            if (h.isStacked) {
                                h.lf((i) => {
                                    if (this.qw(i)) {
                                        this.yn(i, c, e, f, g);
                                        g++;
                                    }
                                    return true;
                                });
                            }
                        }
                        this.yj(c);
                    }
                    d.count = g;
                }
                else {
                    let i = this.tj();
                    let j = this.u4(i);
                    let k = this.t5(i, j, e);
                    this.ym(k, c, e);
                }
            }
        }
        u4(a) {
            let b = new List$1(Series.$, 0);
            if (a == null) {
                return b;
            }
            for (let c of fromEnum(a.dd)) {
                b.add(c);
            }
            return b;
        }
        tj() {
            if (this.tk != null) {
                return this.tk;
            }
            if (this.ce == null) {
                return null;
            }
            for (let a of fromEnum(this.ce.series)) {
                if (a.dj) {
                    let b = a.as();
                    if (b != null && b.cn()) {
                        return b;
                    }
                }
            }
            for (let c of fromEnum(this.ce.series)) {
                if (!c.dj) {
                    let d = c.ag();
                    let e = d != null && d.length > 0 ? d[0] : null;
                    if (e != null && e.cn()) {
                        return e;
                    }
                }
            }
            return null;
        }
        t5(a, b, c) {
            let d = 1.7976931348623157E+308;
            let e = -1.7976931348623157E+308;
            let f = new List$1(DataContext.$, 0);
            let g = new List$1(Base.$, 0);
            let h = false;
            let i = true;
            let j = { $type: Point_$type, x: NaN, y: NaN };
            let k = 0;
            let l = 0;
            for (let m = 0; m < b.count; m++) {
                let n = b.item(m);
                k = n.ce.l;
                l = n.ce.m;
                if (n.dj) {
                    let o = n;
                    let p = new List$1(Series.$, 0);
                    if (o.isStacked) {
                        o.lf((q) => {
                            p.add(q);
                            return true;
                        });
                    }
                    else {
                        p.add(o);
                    }
                    for (let q = 0; q < p.count; q++) {
                        let r = p._inner[q];
                        let s = p._inner[q];
                        if (!r.categoryAxis.cn()) {
                            continue;
                        }
                        if (i) {
                            h = s.isVertical;
                        }
                        else {
                            if (h != s.isVertical) {
                                continue;
                            }
                        }
                        let t = this.ry(s);
                        if (!t.c) {
                            continue;
                        }
                        j = s.pn(t.d);
                        let u = s.ps(t.d, c, false);
                        if (h) {
                            if (!isNaN_(u.y)) {
                                d = Math.min(d, u.y);
                                e = Math.max(e, u.y);
                            }
                        }
                        else {
                            if (!isNaN_(u.x)) {
                                d = Math.min(d, u.x);
                                e = Math.max(e, u.x);
                            }
                        }
                    }
                }
                else {
                    let v = n.ag();
                    for (let w = 0; w < v.length; w++) {
                        if (!v[w].cn()) {
                            continue;
                        }
                    }
                    let x = n.ps(this.s8, c, false);
                    j = n.pn(this.s8);
                    if (h) {
                        if (!isNaN_(x.y)) {
                            d = Math.min(d, x.y);
                            e = Math.max(e, x.y);
                        }
                    }
                    else {
                        if (!isNaN_(x.x)) {
                            d = Math.min(d, x.x);
                            e = Math.max(e, x.x);
                        }
                    }
                }
                let y = null;
                let z = n.hy(this.s8);
                if (n.dp && z != null) {
                    y = n.av(z);
                }
                else {
                    y = new DataContext();
                    y.item = z;
                    y.series = n;
                }
                f.add(y);
            }
            let aa = 0;
            let ab = 0;
            if (h) {
                ab = (d + e) / 2;
                aa = this.p7.right;
                if (!isNaN_(j.x)) {
                    aa = j.x;
                }
                if (ab < 0 || ab > this.p7.bottom) {
                    ab = NaN;
                }
            }
            else {
                aa = (d + e) / 2;
                if (!isNaN_(j.y)) {
                    ab = j.y;
                }
                if (aa < 0 || aa > this.p7.right) {
                    aa = NaN;
                }
            }
            let ac = new DataToolTipSeriesInfo();
            ac.f = { $type: Point_$type, x: aa, y: ab };
            ac.e = { $type: Point_$type, x: j.x, y: j.y };
            ac.b = f;
            ac.a = h;
            return ac;
        }
        li() {
            this.s8 = { $type: Point_$type, x: NaN, y: NaN };
            this.mn(false);
            this.t4.cg(false);
        }
        lj() {
            this.s8 = { $type: Point_$type, x: NaN, y: NaN };
            this.mn(false);
            this.t4.cg(true);
        }
        get aao() {
            let a = RectUtil.n(this.b1.bu);
            let b = new Size(1, this.b1.bu.width, this.b1.bu.height);
            return new Rect(3, a, b);
        }
        get aan() {
            let a = RectUtil.n(this.b1.bu);
            let b = new Size(1, this.b1.bu.width, this.b1.bu.height);
            return new Rect(3, this.t4.cj(a), b);
        }
        get aam() {
            let a = new Rect(0, 0, 0, this.ce.m, this.ce.l);
            let b = RectUtil.n(a);
            let c = new Size(1, a.width, a.height);
            return new Rect(3, this.t4.cj(b), c);
        }
        get aaq() {
            let a = { $type: Point_$type, x: 0, y: 0 };
            return new Rect(3, a, this.t4.co());
        }
        aap() {
            return this.aao;
        }
        uu(a, b, c) {
            if (Rect.l_op_Equality(a, Rect.empty)) {
                return false;
            }
            let d = a.top;
            return c < d;
        }
        ur(a, b, c, d) {
            if (Rect.l_op_Equality(a, Rect.empty)) {
                return false;
            }
            let e = a.bottom;
            return c + d.height >= e;
        }
        us(a, b, c) {
            if (Rect.l_op_Equality(a, Rect.empty)) {
                return false;
            }
            let d = a.left;
            return c < d;
        }
        ut(a, b, c, d) {
            if (Rect.l_op_Equality(a, Rect.empty)) {
                return false;
            }
            let e = a.right;
            return c + d.width > e;
        }
        vx(a, b) {
            return a.top + b;
        }
        vv(a, b, c) {
            return a.bottom - c.height - b;
        }
        vw(a, b) {
            return ((a.bottom + a.top) / 2) - (b.height / 2);
        }
        v6(a, b, c, d, e) {
            let f = c.y - d.height - b;
            return f;
        }
        v4(a, b, c, d, e) {
            let f = c.y + b;
            return f;
        }
        v5(a, b, c, d, e) {
            let f = c.y - (d.height / 2);
            return f;
        }
        v0(a, b, c, d, e) {
            let f = c.y - d.height;
            f = f - b;
            return f;
        }
        vy(a, b, c, d, e) {
            let f = c.y;
            f = f + b;
            return f;
        }
        vz(a, b, c, d, e) {
            let f = c.y - (d.height / 2);
            return f;
        }
        vg(a, b) {
            return a.left + b;
        }
        vi(a, b, c) {
            return (a.right - (c.width)) - b;
        }
        vh(a, b, c) {
            return ((a.right + a.left) / 2) - (c.width / 2) + b;
        }
        vp(a, b, c, d, e) {
            let f = (c.x - d.width) - b;
            return f;
        }
        vr(a, b, c, d, e) {
            let f = c.x + b;
            return f;
        }
        vq(a, b, c, d, e) {
            let f = (c.x - (d.width / 2));
            f = f + b;
            return f;
        }
        vm(a, b, c, d, e) {
            let f = c.x - d.width;
            f = f - b;
            return f;
        }
        vo(a, b, c, d, e) {
            let f = c.x;
            f = f + b;
            return f;
        }
        vn(a, b, c, d, e) {
            let f = c.x - (d.width / 2);
            f = f + b;
            return f;
        }
        vc(a, b, c, d, e, f, g, h) {
            switch (a) {
                case 1:
                    {
                        return this.v0(e, b, h, f, true);
                    }
                case 2:
                    {
                        return this.vy(e, b, h, f, true);
                    }
                case 3:
                    {
                        return this.vz(e, b, h, f, true);
                    }
                case 5: return this.v1(e, c, b, h, f);
                case 6: return this.v2(e, c, b, h, f);
                case 4: return this.v3(e, c, b, h, f);
                case 8: return this.vs(e, c, b, h, f);
                case 9: return this.vt(e, c, b, h, f);
                case 7: return this.vu(e, c, b, h, f);
                case 13: return this.vx(d, b);
                case 14: return this.vv(d, b, f);
                case 15: return this.vw(d, f);
                case 10: return this.v6(e, b, g, f, true);
                case 12: return this.v5(e, b, g, f, true);
                case 11:
                default: return this.v4(e, b, g, f, true);
            }
        }
        vj(a, b, c, d, e) {
            let f = d.x;
            f = f + b / 2;
            f = f - e.width;
            f = f - c;
            return f;
        }
        vk(a, b, c, d, e) {
            let f = d.x;
            f = f + b / 2;
            f = f - e.width / 2;
            f = f + c;
            return f;
        }
        vl(a, b, c, d, e) {
            let f = d.x;
            f = f + b / 2;
            f = f + c;
            return f;
        }
        vd(a, b, c, d, e) {
            let f = d.x;
            f = f - b / 2;
            f = f - e.width;
            f = f - c;
            return f;
        }
        ve(a, b, c, d, e) {
            let f = d.x;
            f = f - b / 2;
            f = f - e.width / 2;
            f = f + c;
            return f;
        }
        vf(a, b, c, d, e) {
            let f = d.x;
            f = f - b / 2;
            f = f + c;
            return f;
        }
        vu(a, b, c, d, e) {
            let f = d.y;
            f = f + b / 2;
            f = f - e.height;
            f = f - c;
            return f;
        }
        vt(a, b, c, d, e) {
            let f = d.y;
            f = f + b / 2;
            f = f - e.height / 2;
            f = f + c;
            return f;
        }
        vs(a, b, c, d, e) {
            let f = d.y;
            f = f + b / 2;
            f = f + c;
            return f;
        }
        v3(a, b, c, d, e) {
            let f = d.y;
            f = f - b / 2;
            f = f - e.height;
            f = f - c;
            return f;
        }
        v2(a, b, c, d, e) {
            let f = d.y;
            f = f - b / 2;
            f = f - e.height / 2;
            f = f + c;
            return f;
        }
        v1(a, b, c, d, e) {
            let f = d.y;
            f = f - b / 2;
            f = f + c;
            return f;
        }
        vb(a, b, c, d, e, f, g, h) {
            switch (a) {
                case 10: return this.vp(e, b, g, f, true);
                case 11: return this.vr(e, b, g, f, true);
                case 12: return this.vq(e, b, g, f, true);
                case 13: return this.vg(d, b);
                case 14: return this.vi(e, b, f);
                case 15: return this.vh(e, b, f);
                case 5: return this.vf(e, c, b, h, f);
                case 6: return this.ve(e, c, b, h, f);
                case 4: return this.vd(e, c, b, h, f);
                case 8: return this.vl(e, c, b, h, f);
                case 9: return this.vk(e, c, b, h, f);
                case 7: return this.vj(e, c, b, h, f);
                case 1:
                    {
                        return this.vm(e, b, h, f, true);
                    }
                case 3:
                    {
                        return this.vn(e, b, h, f, true);
                    }
                case 2:
                default:
                    {
                        return this.vo(e, b, h, f, true);
                    }
            }
        }
        aal(a, b, c, d) {
            let e = this.tt;
            let f = this.tx;
            let g = this.tj();
            let h = 0;
            if (g != null && g.ca && this.ce != null) {
                h = g.getCategorySize(this.ce.ta, this.p7, this.getEffectiveViewport());
                if (g.categoryMode == 0) {
                    h = 0;
                }
            }
            let i = this.u9(e);
            let j = this.va(f);
            let k = this.vb(e, i, h, this.aao, a, b, c, d);
            let l = this.vc(f, j, h, this.aao, a, b, c, d);
            let m = this.uv(a, i, k, b);
            let n = this.uw(a, j, l, b);
            if (!m) {
                let o = this.td(e);
                let p = 0;
                while (!m && p < o.length) {
                    e = o[p];
                    i = this.u9(e);
                    k = this.vb(e, i, h, this.aao, a, b, c, d);
                    m = this.uv(a, i, k, b);
                    p++;
                }
            }
            if (!n) {
                let q = this.te(f);
                let r = 0;
                while (!n && r < q.length) {
                    f = q[r];
                    j = this.va(f);
                    l = this.vc(f, j, h, this.aao, a, b, c, d);
                    n = this.uw(a, j, l, b);
                    r++;
                }
            }
            return { $type: Point_$type, x: k, y: l };
        }
        va(a) {
            if (!isNaN_(this.u8)) {
                return this.u8;
            }
            switch (a) {
                case 1: return this.u6;
                case 2: return this.u6;
                case 3: return 0;
                case 4: return this.u6;
                case 5: return this.u6;
                case 6: return this.u6;
                case 7: return this.u6;
                case 8: return this.u6;
                case 9: return 0;
                case 10: return this.u6;
                case 11: return this.u6;
                case 12: return 0;
                case 13: return this.u6;
                case 14: return this.u6;
                case 15: return 0;
            }
            return this.u6;
        }
        u9(a) {
            if (!isNaN_(this.u7)) {
                return this.u7;
            }
            switch (a) {
                case 4: return this.u5;
                case 6: return 0;
                case 5: return this.u5;
                case 13: return this.u5;
                case 15: return 0;
                case 14: return this.u5;
                case 7: return this.u5;
                case 9: return 0;
                case 8: return this.u5;
                case 1: return this.u5;
                case 3: return 0;
                case 2: return this.u5;
                case 10: return this.u5;
                case 12: return 0;
                case 11: return this.u5;
            }
            return this.u5;
        }
        te(a) {
            let b = [a];
            switch (a) {
                case 1:
                    b = [2, 3];
                    break;
                case 2:
                    b = [1, 3];
                    break;
                case 3:
                    b = [1, 2];
                    break;
                case 4:
                    b = [8, 7, 3];
                    break;
                case 5:
                    b = [7, 8, 3];
                    break;
                case 6:
                    b = [9, 8, 4, 3];
                    break;
                case 7:
                    b = [5, 4, 2];
                    break;
                case 8:
                    b = [4, 5, 3];
                    break;
                case 9:
                    b = [6, 4, 8, 3];
                    break;
                case 10:
                    b = [11, 12];
                    break;
                case 11:
                    b = [10, 12];
                    break;
                case 12:
                    b = [10, 11];
                    break;
                case 13: break;
                case 14: break;
                case 15: break;
            }
            return b;
        }
        td(a) {
            let b = [a];
            switch (a) {
                case 1:
                    b = [2, 3];
                    break;
                case 2:
                    b = [1, 3];
                    break;
                case 3:
                    b = [1, 2];
                    break;
                case 4:
                    b = [8, 7, 3];
                    break;
                case 5:
                    b = [7, 8, 1];
                    break;
                case 6:
                    b = [9, 8, 4, 3];
                    break;
                case 7:
                    b = [5, 4, 2];
                    break;
                case 8:
                    b = [4, 5, 3];
                    break;
                case 9:
                    b = [6, 4, 8, 3];
                    break;
                case 10:
                    b = [11, 12];
                    break;
                case 11:
                    b = [10, 12];
                    break;
                case 12:
                    b = [10, 11];
                    break;
                case 13: break;
                case 14: break;
                case 15: break;
            }
            return b;
        }
        uv(a, b, c, d) {
            return !(this.us(a, b, c) || this.ut(a, b, c, d));
        }
        uw(a, b, c, d) {
            return !(this.uu(a, b, c) || this.ur(a, b, c, d));
        }
        yj(a) {
            let b = new List$1(DataTooltipCollisionInfo.$, 0);
            for (let c = 0; c < a.f.count; c++) {
                let d = new DataTooltipCollisionInfo();
                d.d = c;
                d.e = { $type: Point_$type, x: a.f._inner[c], y: a.g._inner[c] };
                d.c = a.k._inner[c];
                d.a = a.j._inner[c];
                d.b = a.m._inner[c];
                if (isNaN_(d.e.x) || isNaN_(d.e.y)) {
                    continue;
                }
                b.add(d);
            }
            b.aa((e, f) => {
                if (e.e.y < f.e.y) {
                    return -1;
                }
                if (e.e.y > f.e.y) {
                    return 1;
                }
                if (e.b < f.b) {
                    return -1;
                }
                if (e.b > f.b) {
                    return 1;
                }
                return 0;
            });
            let e = this.up(b);
            if (!e) {
                return;
            }
            for (let f = 0; f < b.count - 1; f++) {
                let g = b._inner[f];
                let h = b._inner[f + 1];
                let i = new Rect(0, g.e.x, g.e.y, g.c, g.a);
                let j = new Rect(0, h.e.x, h.e.y, h.c, h.a);
                if (i.intersectsWith(j) || i.top > j.bottom) {
                    h.e = { $type: Point_$type, x: h.e.x, y: i.bottom + 1 };
                }
            }
            if (b._inner[b.count - 1].e.y + b._inner[b.count - 1].a > this.b1.bu.height) {
                b._inner[b.count - 1].e = { $type: Point_$type, x: b._inner[b.count - 1].e.x, y: b._inner[b.count - 1].e.y - ((b._inner[b.count - 1].e.y + b._inner[b.count - 1].a) - this.b1.bu.height) };
            }
            for (let k = b.count - 1; k >= 1; k--) {
                let l = b._inner[k];
                let m = b._inner[k - 1];
                let n = new Rect(0, l.e.x, l.e.y, l.c, l.a);
                let o = new Rect(0, m.e.x, m.e.y, m.c, m.a);
                if (n.intersectsWith(o) || n.top < o.bottom) {
                    m.e = { $type: Point_$type, x: m.e.x, y: n.top - (o.height + 1) };
                }
            }
            for (let p = 0; p < b.count; p++) {
                let q = b._inner[p].d;
                let r = b._inner[p];
                a.f._inner[q] = r.e.x;
                a.g._inner[q] = r.e.y;
            }
        }
        up(a) {
            if (a.count <= 1) {
                return false;
            }
            let b = this.b1.bu;
            for (let c = 0; c < a.count - 1; c++) {
                let d = a._inner[c];
                let e = a._inner[c + 1];
                let f = new Rect(0, d.e.x, d.e.y, d.c, d.a);
                let g = new Rect(0, e.e.x, e.e.y, e.c, e.a);
                if (f.intersectsWith(g)) {
                    return true;
                }
            }
            return false;
        }
        yn(a, b, c, d, e) {
            let f = this.ry(a);
            if (!f.c) {
                return;
            }
            let g = a.ps(f.d, c, d);
            let h = this.t4.b6;
            let i = this.s8;
            if (!c) {
                i = this.px(g);
            }
            let j = a.hy(i);
            let k = h.item(e);
            let l = this.b1.bu;
            let m = this.t4.b5(k);
            if (!Base.equalsStatic(m.target, this.ce)) {
                m.target = this.ce;
            }
            m.includedSeries = [a.dataLegendKey];
            this.yl(m);
            m.targetCursorPositionX = this.s8.x;
            m.targetCursorPositionY = this.s8.y;
            if (!this.t4.b8(k, a)) {
                return;
            }
            let n = this.t4.cn(k);
            b.i.add1(k);
            let o = g.x;
            let p = g.x;
            p = Math.max(p, l.left);
            p = Math.min(p, l.right);
            b.l.add(p);
            let q = g.y;
            q = Math.max(q, l.top);
            q = Math.min(q, l.bottom);
            b.m.add(q);
            let r = DeviceUtils.g(10);
            let s = g.x + r;
            if (s + n.width > l.right) {
                s = (o - n.width) - r;
            }
            if (s < l.left) {
                s = l.left;
            }
            b.f.add(s);
            let t = (g.y - n.height) - r;
            if (t + n.height > l.bottom) {
                t = (l.bottom - n.height) - r;
            }
            if (t < l.top) {
                t = l.top;
            }
            b.g.add(t);
            b.k.add(n.width);
            b.j.add(n.height);
            let u = this.o5;
            if (u == null) {
                u = this.o9;
            }
            if (u == null) {
                u = a.o5;
            }
            b.h.add(u);
        }
        ym(a, b, c) {
            this.ts = this.tv();
            this.tw = this.tz();
            let d = a.f;
            let e = a.e;
            let f = 0;
            let g = this.t4.b6.item(0);
            this.t4.b8(g, null);
            let h = this.t4.b5(g);
            if (!Base.equalsStatic(h.target, this.ce)) {
                h.target = this.ce;
            }
            let i = new List$1(String_$type, 0);
            let j = this.tj();
            if (j != null) {
                for (let k of fromEnum(j.da())) {
                    if (k.isStacked) {
                        k.lf((l) => {
                            i.add(l.dataLegendKey);
                            return true;
                        });
                    }
                    else {
                        i.add(k.dataLegendKey);
                    }
                }
                h.includedSeries = i.toArray();
            }
            else {
                h.includedSeries = null;
            }
            this.yl(h);
            h.targetCursorPositionX = this.s8.x;
            h.targetCursorPositionY = this.s8.y;
            let l = this.t4.cn(g);
            let m = 0;
            let n = 0;
            let o = 0;
            let p = 0;
            let q = false;
            let r = false;
            o = d.x;
            p = d.y;
            let s = this.b1.bu;
            let t = this.t4.co();
            let u = this.aap();
            let v = this.aal(u, l, e, d);
            let w = v.x;
            let x = v.y;
            {
            }
            b.l.add(w);
            b.m.add(x);
            b.f.add(w);
            b.g.add(x);
            b.k.add(l.width);
            b.j.add(l.height);
            b.i.add1(g);
            let y = null;
            b.h.add(y);
            this.t4.b6.count = 1;
        }
        v9(a) {
            return a.toolTip;
        }
        r8(a, b) {
            super.r8(a, b);
            let c = a;
            let d = c.m.count;
            let e = b.bu.left;
            let f = b.bu.right;
            let g = b.bu.top;
            let h = b.bu.bottom;
            for (let i = 0; i < d; i++) {
                if (isNaN_(c.l._inner[i]) || isNaN_(c.m._inner[i]) || isNaN_(c.f._inner[i]) || isNaN_(c.g._inner[i])) {
                    this.t4.cf(c.i._inner[i]);
                    continue;
                }
                let j = c.f._inner[i];
                let k = c.g._inner[i];
                let l = c.k._inner[i];
                let m = c.j._inner[i];
                let n = false;
                if (n) {
                    this.t4.cf(c.i._inner[i]);
                    continue;
                }
                let o = c.i._inner[i];
                let p = Math.min(c.f._inner[i], c.l._inner[i]);
                let q = Math.min(c.g._inner[i], c.m._inner[i]);
                let r = c.l._inner[i] - c.f._inner[i];
                let s = c.m._inner[i] - c.g._inner[i];
                if (o != null) {
                    this.t4.ch(o, p, q, r, s);
                }
            }
        }
        ep() {
            return true;
        }
        get tt() {
            return this.ts;
        }
        set tt(a) {
            let b = this.ts;
            this.ts = a;
            if (b != this.ts) {
                this.raisePropertyChanged("ActualGroupedPositionModeX", enumGetBox(DataTooltipGroupedPositionX_$type, b), enumGetBox(DataTooltipGroupedPositionX_$type, this.ts));
            }
        }
        tv() {
            if (this.ce == null) {
                return 2;
            }
            let a = false;
            let b = false;
            let c = false;
            let d = false;
            let e = this.tj();
            if (e == null) {
                return 2;
            }
            for (let f of fromEnum(e.dd)) {
                if (f.dk) {
                    a = true;
                }
                if (f.isVertical) {
                    b = true;
                }
                if (f.d9) {
                    c = true;
                }
                if (f.ef) {
                    d = true;
                }
            }
            let g = ((() => {
                let $ret = new HashSet$1(DataTooltipGroupedPositionX_$type, 0);
                $ret.add_1(1);
                $ret.add_1(2);
                $ret.add_1(3);
                $ret.add_1(4);
                $ret.add_1(5);
                $ret.add_1(6);
                $ret.add_1(7);
                $ret.add_1(8);
                $ret.add_1(9);
                return $ret;
            })());
            let h = g.contains(this.tu);
            if (this.tu != 0) {
                if (h && b) {
                    return 11;
                }
                return this.tu;
            }
            if (c || d) {
                return 11;
            }
            if (b) {
                return 11;
            }
            if (a) {
                return 8;
            }
            return 8;
        }
        get tx() {
            return this.tw;
        }
        set tx(a) {
            let b = this.tw;
            this.tw = a;
            if (b != this.tw) {
                this.raisePropertyChanged("ActualPositionModeY", enumGetBox(DataTooltipGroupedPositionY_$type, b), enumGetBox(DataTooltipGroupedPositionY_$type, this.tw));
            }
        }
        tz() {
            if (this.ce == null) {
                return 11;
            }
            let a = false;
            let b = false;
            let c = false;
            let d = this.tj();
            if (d == null) {
                return 11;
            }
            for (let e of fromEnum(d.da())) {
                if (e.isVertical) {
                    a = true;
                }
                if (e.d9) {
                    b = true;
                }
                if (e.ef) {
                    c = true;
                }
            }
            let f = ((() => {
                let $ret = new HashSet$1(DataTooltipGroupedPositionY_$type, 0);
                $ret.add_1(1);
                $ret.add_1(2);
                $ret.add_1(3);
                $ret.add_1(4);
                $ret.add_1(5);
                $ret.add_1(6);
                $ret.add_1(7);
                $ret.add_1(8);
                $ret.add_1(9);
                return $ret;
            })());
            let g = f.contains(this.ty);
            if (this.ty != 0) {
                if (g && !a) {
                    return 11;
                }
                return this.ty;
            }
            if (b || c) {
                return 11;
            }
            if (a) {
                return 8;
            }
            if (!a) {
                return 11;
            }
            return 11;
        }
        get uo() {
            return this.uf;
        }
        set uo(a) {
            let b = this.uf;
            this.uf = a;
            if (b != this.uf) {
                this.raisePropertyChanged("ValueTextStyle", b, this.uf);
            }
        }
        get ug() {
            return this.t7;
        }
        set ug(a) {
            let b = this.t7;
            this.t7 = a;
            if (b != this.t7) {
                this.raisePropertyChanged("HeaderTextStyle", b, this.t7);
            }
        }
        get uj() {
            return this.ua;
        }
        set uj(a) {
            let b = this.ua;
            this.ua = a;
            if (b != this.ua) {
                this.raisePropertyChanged("SummaryTitleTextStyle", b, this.ua);
            }
        }
        get ul() {
            return this.uc;
        }
        set ul(a) {
            let b = this.uc;
            this.uc = a;
            if (b != this.uc) {
                this.raisePropertyChanged("SummaryValueTextStyle", b, this.uc);
            }
        }
        get ui() {
            return this.t9;
        }
        set ui(a) {
            let b = this.t9;
            this.t9 = a;
            if (b != this.t9) {
                this.raisePropertyChanged("SummaryLabelTextStyle", b, this.t9);
            }
        }
        get uk() {
            return this.ub;
        }
        set uk(a) {
            let b = this.ub;
            this.ub = a;
            if (b != this.ub) {
                this.raisePropertyChanged("SummaryUnitsTextStyle", b, this.ub);
            }
        }
        get un() {
            return this.ue;
        }
        set un(a) {
            let b = this.ue;
            this.ue = a;
            if (b != this.ue) {
                this.raisePropertyChanged("UnitsTextStyle", b, this.ue);
            }
        }
        get um() {
            return this.ud;
        }
        set um(a) {
            let b = this.ud;
            this.ud = a;
            if (b != this.ud) {
                this.raisePropertyChanged("TitleTextStyle", b, this.ud);
            }
        }
        get uh() {
            return this.t8;
        }
        set uh(a) {
            let b = this.t8;
            this.t8 = a;
            if (b != this.t8) {
                this.raisePropertyChanged("LabelTextStyle", b, this.t8);
            }
        }
    }
    DataToolTipLayer.$t = markType(DataToolTipLayer, 'DataToolTipLayer', AnnotationLayer.$);
    DataToolTipLayer.$$p = markDep(DependencyProperty, PropertyMetadata, DataToolTipLayer, 'raisePropertyChanged', ['BadgeMargin:aar:yp', [Thickness.$, new Thickness(1, 0, 0, 0, 0)], 'BadgeShape:t6:yq', [LegendItemBadgeShape_$type, enumGetBox(LegendItemBadgeShape_$type, 0)], 'DefaultPositionOffsetX:u5:yr', [1, DeviceUtils.g(10)], 'DefaultPositionOffsetY:u6:ys', [1, DeviceUtils.g(10)], 'ExcludedColumns:tb:yt', [Array_$type, null], 'ExcludedSeries:tc:yu', [Array_$type, null], 'GroupedPositionModeX:tu:yv', [DataTooltipGroupedPositionX_$type, enumGetBox(DataTooltipGroupedPositionX_$type, 0)], 'GroupedPositionModeY:ty:yw', [DataTooltipGroupedPositionY_$type, enumGetBox(DataTooltipGroupedPositionY_$type, 0)], 'GroupingMode:t2:yx', [DataToolTipLayerGroupingMode_$type, enumGetBox(DataToolTipLayerGroupingMode_$type, 0)], 'HeaderFormatCulture:wm:yy', [2, stringEmpty()], 'HeaderFormatDate:tm:yz', [DataLegendHeaderDateMode_$type, enumGetBox(DataLegendHeaderDateMode_$type, 0)], 'HeaderFormatSpecifiers:tf:y0', [Array_$type, null], 'HeaderFormatString:wq:y1', [2, null], 'HeaderFormatTime:tn:y2', [DataLegendHeaderTimeMode_$type, enumGetBox(DataLegendHeaderTimeMode_$type, 0)], 'HeaderRowMargin:aas:y3', [Thickness.$, new Thickness(0, 5)], 'HeaderRowVisible:uq:y4', [0, true], 'HeaderTextColor:aac:y5', [Brush.$, null], 'HeaderTextMargin:aat:y6', [Thickness.$, new Thickness(1, 2, 0, 0, 0)], 'HeaderText:wv:y7', [2, null], 'IncludedColumns:tg:y8', [Array_$type, null], 'IncludedSeries:th:y9', [Array_$type, null], 'LabelDisplayMode:to:za', [DataLegendLabelMode_$type, enumGetBox(DataLegendLabelMode_$type, 0)], 'LabelTextColor:aad:zb', [Brush.$, null], 'LabelTextMargin:aau:zc', [Thickness.$, new Thickness(1, 8, 0, 0, 0)], 'PositionOffsetX:u7:zd', [1, NaN], 'PositionOffsetY:u8:ze', [1, NaN], 'ShouldUpdateWhenSeriesDataChanges:ux:zf', [0, true], 'SummaryLabelTextColor:aae:zg', [Brush.$, null], 'SummaryLabelText:w9:zh', [2, null], 'SummaryRowMargin:aav:zi', [Thickness.$, new Thickness(0, 5)], 'SummaryTitleTextColor:aaf:zj', [Brush.$, null], 'SummaryTitleTextMargin:aaw:zk', [Thickness.$, new Thickness(1, 2, 0, 0, 0)], 'SummaryTitleText:xe:zl', [2, null], 'SummaryType:tp:zm', [DataLegendSummaryType_$type, enumGetBox(DataLegendSummaryType_$type, 0)], 'SummaryUnitsTextColor:aag:zn', [Brush.$, null], 'SummaryUnitsText:xk:zo', [2, null], 'SummaryValueTextColor:aah:zp', [Brush.$, null], 'TargetAxis:tk:zq', [Axis.$, null], 'TitleTextColor:aai:zr', [Brush.$, null], 'TitleTextMargin:aax:zs', [Thickness.$, new Thickness(1, 0, 0, 0, 0)], 'UnitsDisplayMode:tq:zt', [DataLegendUnitsMode_$type, enumGetBox(DataLegendUnitsMode_$type, 0)], 'UnitsTextColor:aaj:zu', [Brush.$, null], 'UnitsTextMargin:aay:zv', [Thickness.$, new Thickness(1, 0, 0, 0, 0)], 'UnitsText:xv:zw', [2, null], 'UseInterpolation:uy:zx', [0, false], 'ValueFormatAbbreviation:tl:zy', [DataAbbreviationMode_$type, enumGetBox(DataAbbreviationMode_$type, 0)], 'ValueFormatCulture:x2:zz', [2, stringEmpty()], 'ValueFormatMaxFractions:v7:z0', [1, -1], 'ValueFormatMinFractions:v8:z1', [1, -1], 'ValueFormatMode:tr:z2', [DataLegendValueMode_$type, enumGetBox(DataLegendValueMode_$type, 0)], 'ValueFormatSpecifiers:ti:z3', [Array_$type, null], 'ValueFormatString:x8:z4', [2, null], 'ValueFormatUseGrouping:uz:z5', [0, true], 'ValueRowMargin:aaz:z6', [Thickness.$, new Thickness(0, 5)], 'ValueRowVisible:u0:z7', [0, true], 'ValueTextColor:aak:z8', [Brush.$, null], 'ValueTextMargin:aa0:z9', [Thickness.$, new Thickness(1, 2, 0, 2, 0)], 'ValueTextUseSeriesColors:u1:aaa', [0, false], 'ValueTextWhenMissingData:yh:aab', [2, "N/A"]]);
    return DataToolTipLayer;
})();
/**
 * @hidden
 */
export let DataToolTipLayerView = /*@__PURE__*/ (() => {
    class DataToolTipLayerView extends AnnotationLayerView {
        constructor(a) {
            super(a);
            this.b6 = null;
            this.b9 = null;
            this.b4 = null;
            this.b7 = false;
            this._htmlTest = null;
            this.b4 = a;
            this.htmlTest = /^[^<]*(<[\w\W]+>)[^>]*$/;
            this.b9 = new List$1(PointerTooltip.$, 0);
        }
        aj() {
            super.aj();
            for (let a = 0; a < this.b6.a.count; a++) {
                this.b6.a._inner[a].br();
            }
            for (let b = 0; b < this.b6.b.count; b++) {
                this.b6.b._inner[b].br();
            }
            this.b6.clear();
        }
        ca() {
            let a = new PointerTooltip();
            a.bw(this.e.he);
            a._visibility = 1;
            a.ap = this.e.ce.cu.k;
            let b = null;
            if (TypeRegistrar.isRegistered("XamDataLegend")) {
                b = TypeRegistrar.create("XamDataLegend");
            }
            b.pixelScalingRatio = 1;
            if (this.e.ce != null) {
                let c = this.e.ce.cu.j.ae.createElement("div");
                let ren_ = this.e.ce.cu.j.ae.getSubRenderer(c);
                let len_ = b;
                len_.provideContainer(ren_);
            }
            a.ai = typeCast(IOnDemandRender_$type, b);
            a.ai.shouldOnDemandRender = true;
            this.b9.add(a);
            return a;
        }
        cc(a) {
            let b = a;
        }
        ce(a) {
            let b = a;
            b._visibility = 1;
        }
        cd(a) {
            let b = a;
            b.bz();
            b.content = null;
            this.b9.remove1(a);
        }
        as() {
            super.as();
            this.b6 = ((() => {
                let $ret = new Pool$1(Base.$);
                $ret.create = runOn(this, this.ca);
                $ret.activate = runOn(this, this.cc);
                $ret.disactivate = runOn(this, this.ce);
                $ret.destroy = runOn(this, this.cd);
                return $ret;
            })());
        }
        get htmlTest() {
            return this._htmlTest;
        }
        set htmlTest(a) {
            this._htmlTest = a;
        }
        b8(a, b) {
            let c = a;
            let d = c.ai;
            return true;
        }
        cn(a) {
            let b = a;
            let c = new Size(1, Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY);
            b.cy = 1;
            let d = b.cx(new Size(1, Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY));
            b.cy = 0;
            return d;
        }
        cm() {
            if (this.e.ce != null) {
                let a = this.e.ce.s3();
                let b = this.e.ce.cu.a8;
                let c = this.e.ce.cu.a7;
                return new Rect(0, 0, 0, b, c);
            }
            return Rect.empty;
        }
        cl() {
            if (this.e.ce != null) {
                let a = this.e.ce.s3();
                let b = this.e.ce.cu.a8;
                let c = this.e.ce.cu.a7;
                return new Rect(0, 0, 0, b, c);
            }
            return Rect.empty;
        }
        ck() {
            let a = 0;
            let b = 0;
            if (this.e.ce != null) {
                let c = this.e.ce.s3();
                a += c.x;
                b += c.y;
                let d = this.e.ce.cu.a8;
                let e = this.e.ce.cu.a7;
                return new Rect(0, a, b, d, e);
            }
            return Rect.empty;
        }
        cj(a) {
            let b = 0;
            let c = 0;
            if (this.e.ce != null) {
                let d = this.e.ce.s3();
                b += d.x;
                c += d.y;
            }
            return { $type: Point_$type, x: b + a.x, y: c + a.y };
        }
        ch(a, b, c, d, e) {
            let f = null;
            if (this.e.ce != null) {
                f = this.e.ce.cu.j.i();
            }
            let g = a;
            if (g == null) {
                return;
            }
            if (d == 0 && e == 0) {
                g.cy = 1;
            }
            else {
                g.cy = 0;
            }
            g.aq = f;
            g.cs = { $type: Point_$type, x: d, y: e };
            g._visibility = 0;
            g.n = b;
            g.o = c;
        }
        co() {
            let a = (window.innerWidth);
            let b = (window.innerHeight);
            return new Size(1, a, b);
        }
        cf(a) {
            if (a != null) {
                let b = a;
                b._visibility = 1;
            }
        }
        ci() {
            if (this.e.ce == null) {
                this.cg(true);
            }
        }
        a6(a, b) {
            super.a6(a, b);
            if (b) {
                return;
            }
            let c = 0;
            let d = 0;
            let e = this.e.ce;
            if (e != null) {
                let f = e.cu.j.b7();
                c += f.x;
                d += f.y;
            }
            for (let g = 0; g < this.b9.count; g++) {
                this.b9._inner[g].by(this.b9._inner[g].n + c, this.b9._inner[g].o + d);
            }
        }
        al(a) {
            super.al(a);
            for (let b = 0; b < this.b9.count; b++) {
                let c = this.b9._inner[b];
                let d = 0;
                let e = 0;
                if (this.e.ce != null) {
                    let f = this.e.ce.s3();
                    d += f.x;
                    e += f.y;
                }
                let g = c.a5();
                let h = c.n - d;
                let i = c.o - e;
                let j = c.ai;
                let k = null;
                if (j != null) {
                    k = j.exportVisualData();
                }
                this.e.a9.addPointerTooltipWithDataLegend(a, g, h, i, k);
            }
        }
        b5(a) {
            let b = a;
            return b.ai;
        }
        cg(a) {
            this.aq();
            for (let b = 0; b < this.b9.count; b++) {
                this.cf(this.b9._inner[b]);
                if (a) {
                    this.b9._inner[b].bs();
                }
            }
        }
    }
    DataToolTipLayerView.$t = markType(DataToolTipLayerView, 'DataToolTipLayerView', AnnotationLayerView.$);
    return DataToolTipLayerView;
})();
