/*
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 { Series } from "./Series";
import { IHasCategoryModePreference_$type } from "./IHasCategoryModePreference";
import { Axis } from "./Axis";
import { DependencyProperty } from "igniteui-react-core";
import { CategoryAxisBase } from "./CategoryAxisBase";
import { Point_$type, typeCast, Delegate_$type, markType, markDep } from "igniteui-react-core";
import { Brush } from "igniteui-react-core";
import { Thickness } from "igniteui-react-core";
import { AxisAnnotationFrame } from "./AxisAnnotationFrame";
import { List$1 } from "igniteui-react-core";
import { Dictionary$2 } from "igniteui-react-core";
import { Pool$1 } from "igniteui-react-core";
import { AxisAnnotation } from "./AxisAnnotation";
import { SeriesView } from "./SeriesView";
import { NotImplementedException } from "igniteui-react-core";
import { AxisRange } from "./AxisRange";
import { NumericAxisBase } from "./NumericAxisBase";
import { ScalerParams } from "./ScalerParams";
import { CategoryXAxis } from "./CategoryXAxis";
import { AxisAnnotationFrameManager } from "./AxisAnnotationFrameManager";
import { PropertyMetadata } from "igniteui-react-core";
import { isNaN_, isInfinity } from "igniteui-react-core";
import { stringFormat } from "igniteui-react-core";
import { Path } from "igniteui-react-core";
/**
 * @hidden
 */
export let ValueOverlay = /*@__PURE__*/ (() => {
    class ValueOverlay extends Series {
        constructor() {
            super();
            this.mq = 0;
            this.mr = 0;
            this.mn = 0;
            this.mb = null;
            this.mh = null;
            this.mg = null;
            this.ab = ValueOverlay.$;
        }
        en(a, b, c) {
            return this.ms;
        }
        mo(a, b) {
            let c = Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2));
            let d = Math.acos((a.x - b.x) / c);
            if ((a.y - b.y) < 0) {
                d = (2 * Math.PI) - d;
            }
            return d;
        }
        lv(a, b, c) {
            if (this.ma == null) {
                return { $type: Point_$type, x: NaN, y: NaN };
            }
            let d = this.mp();
            let e = NaN;
            let f = NaN;
            let g = NaN;
            let h = { $type: Point_$type, x: 0.5, y: 0.5 };
            let i = NaN;
            switch (this.ma.a1) {
                case 2:
                    i = Math.sqrt(Math.pow(a.x - h.x, 2) + Math.pow(a.y - h.y, 2));
                    g = d;
                    e = h.x + Math.cos(g) * i;
                    f = h.y + Math.sin(g) * i;
                    f = this.bi.br.top + this.bi.br.height * (f - this.bi.bs.top) / this.bi.bs.height;
                    e = this.bi.br.left + this.bi.br.width * (e - this.bi.bs.left) / this.bi.bs.width;
                    break;
                case 0:
                    e = d;
                    f = a.y;
                    f = this.bi.br.top + this.bi.br.height * (f - this.bi.bs.top) / this.bi.bs.height;
                    break;
                case 1:
                    f = d;
                    e = a.x;
                    e = this.bi.br.left + this.bi.br.width * (e - this.bi.bs.left) / this.bi.bs.width;
                    break;
                case 3:
                    g = this.mo(a, h);
                    i = d;
                    e = h.x + Math.cos(g) * i;
                    f = h.y + Math.sin(g) * i;
                    f = this.bi.br.top + this.bi.br.height * (f - this.bi.bs.top) / this.bi.bs.height;
                    e = this.bi.br.left + this.bi.br.width * (e - this.bi.bs.left) / this.bi.bs.width;
                    break;
            }
            return { $type: Point_$type, x: e, y: f };
        }
        e8(a) {
            throw new NotImplementedException(0);
        }
        fp(a) {
            return this;
        }
        c9(a) {
            return false;
        }
        an(a) {
            let b = typeCast(NumericAxisBase.$, a);
            let c = this.ms;
            if (isNaN_(c) || isInfinity(c)) {
                return null;
            }
            return new AxisRange(c, c);
        }
        jm(a) {
            this.h3(true, this.bi);
            if (!this.mf()) {
                if (this.mb != null) {
                    this.na(NaN, this.ca());
                }
                return;
            }
            if (this.da(a)) {
                if (this.ca()) {
                    if (this.bt.g) {
                        this.bt.t();
                    }
                    let b = this.mq;
                    this.mq = this.mr;
                    this.mr = b;
                }
                else {
                    this.mq = this.mn;
                }
                this.mn = this.mp();
                this.jt();
            }
            else {
                this.mn = this.mp();
                this.m9(this.mn, this.md);
            }
        }
        mp() {
            let a, b;
            let c = this.getViewInfo(b, a);
            b = c.p0;
            a = c.p1;
            let d = this.getEffectiveViewport1(this.bi);
            let e = new ScalerParams(0, a, b, this.ma.ca, d);
            return this.ma.dy(this.ms, e);
        }
        m9(a, b) {
            if (this.ma == null) {
                return;
            }
            let c = typeCast(CategoryAxisBase.$, this.ma);
            if (c != null && !c.b7) {
                if (this.ms > c.j8 - 1) {
                    return;
                }
                if (c.categoryMode == 2) {
                    let d = this.getEffectiveViewport1(b);
                    let e = 0.5 * c.getCategorySize(b.bs, b.br, d);
                    let f = false;
                    if (c.ch && !c.ca) {
                        f = true;
                    }
                    if (typeCast(CategoryXAxis.$, c) !== null && c.ca) {
                        f = true;
                    }
                    if (f) {
                        e = -e;
                    }
                    a += e;
                }
            }
            let g = typeCast(NumericAxisBase.$, this.ma);
            if (g != null) {
                if (this.ms < g.kc || this.ms > g.kb) {
                    return;
                }
                if (g.j2 && this.ms < 0) {
                    return;
                }
            }
            let h;
            switch (this.ma.a1) {
                case 2:
                case 3:
                    h = this.ma.i1(a, b.bs, b.br, this.getEffectiveViewport1(b), this.l0(b));
                    break;
                default:
                    h = this.ma.i1(a, b.bs, b.br);
                    break;
            }
            if (h != null) {
                b.bv(h);
            }
            this.na(a, this.ca());
        }
        dw(a, b, c) {
            let d = true;
            d = super.dw(a, b, c);
            if (!c.l() || b.isEmpty || a.isEmpty || this.ma == null || this.ma.bh == null) {
                d = false;
            }
            return d;
        }
        j1(a, b) {
            this.jl(false);
        }
        j0(a, b) {
            this.jl(false);
        }
        h6(a, b, c, d) {
            throw new NotImplementedException(0);
        }
        i7(a, b, c, d) {
            super.i7(a, b, c, d);
            switch (b) {
                case ValueOverlay.$$p[10]:
                    if (c != null) {
                        c.bx(this);
                    }
                    if (d != null) {
                        d.ck(this);
                    }
                    this.jl(false);
                    this.it();
                    break;
                case "TransitionProgress":
                    this.mr = this.mq + this.ez * (this.mn - this.mq);
                    if (this.cc(this.bi)) {
                        return;
                    }
                    if (this.ez == 1) {
                        this.m9(this.mn, this.md);
                    }
                    else {
                        this.m9(this.mr, this.md);
                    }
                    if (this.bs != null) {
                        this.bs.ko(this);
                    }
                    break;
                case ValueOverlay.$$p[12]:
                    let e = typeCast(NumericAxisBase.$, this.ma);
                    if (e != null) {
                        e.cn();
                    }
                    this.jl(true);
                    this.iu();
                    break;
                case ValueOverlay.$$p[11]:
                case ValueOverlay.$$p[9]:
                case ValueOverlay.$$p[0]:
                case ValueOverlay.$$p[2]:
                case ValueOverlay.$$p[3]:
                case ValueOverlay.$$p[8]:
                case ValueOverlay.$$p[4]:
                case ValueOverlay.$$p[5]:
                case ValueOverlay.$$p[6]:
                case ValueOverlay.$$p[7]:
                    this.jl(true);
                    break;
            }
        }
        ik() {
            super.ik();
            if (this.ma != null) {
                this.ma.hb(false);
            }
        }
        h3(a, b) {
            super.h3(a, b);
            let c = b;
            c.bu();
        }
        mf() {
            if (this.ma == null || this.ma.bh == null || isNaN_(this.ms) || this._visibility == 1) {
                return false;
            }
            let a = typeCast(CategoryAxisBase.$, this.ma);
            if (a != null && a.j8 == 0) {
                return false;
            }
            return true;
        }
        preferredCategoryMode(a) {
            return 0;
        }
        get categoryAxis() {
            return typeCast(CategoryAxisBase.$, this.ma);
        }
        bf() {
            return new ValueOverlayView(this);
        }
        i2(a) {
            super.i2(a);
            this.md = typeCast(ValueOverlayView.$, a);
        }
        jn(a, b) {
            super.jn(a, b);
            if (!this.dl) {
                this.bi.az(b);
                return;
            }
            this.bi.az(b);
            if (this.cc(this.bh) || !this.mf()) {
                return;
            }
            let c = this.getEffectiveViewport1(this.bi);
            let d = this.ma.dy(this.ms, new ScalerParams(0, this.bh.bs, a, this.ma.ca, c));
            this.m9(d, typeCast(ValueOverlayView.$, this.bh));
            this.dl = false;
        }
        getOffsetValue() {
            return 0;
        }
        getCategoryWidth() {
            return 0;
        }
        get nr() {
            return new Thickness(1, this.mj, this.ml, this.mk, this.mi);
        }
        ag() {
            return [this.ma];
        }
        na(a, b) {
            if (isNaN_(a)) {
                if (this.mb != null) {
                    AxisAnnotationFrameManager.b(this.mb);
                    AxisAnnotationFrameManager.d(this, this.mb, true, this.mg, this.mh, b, this.mt, this.mt, this.mc, this.mc);
                }
                return;
            }
            let c = false;
            if (this.mg == null) {
                c = true;
                this.mh = new List$1(Axis.$, 0);
                this.mg = new Dictionary$2(Axis.$, Pool$1.$.specialize(AxisAnnotation.$), 0);
            }
            this.mb = new AxisAnnotationFrame();
            let d = this.lb;
            if (d == null) {
                d = this.ld;
            }
            let e = this.ma.ch;
            AxisAnnotationFrameManager.c(this.mb, { $type: Point_$type, x: a, y: a }, this, this.bs, this.getEffectiveViewport(), d, this.no, this.nq, this.np, this.nr, this.mm, this.no, this.nq, this.np, this.nr, this.mm, !e && this.me, e && this.me);
            AxisAnnotationFrameManager.d(this, this.mb, c, this.mg, this.mh, b, this.mt, this.mt, this.mc, this.mc);
        }
        get_c6() {
            return true;
        }
        m5(a) {
            if (this.ma != null) {
                return this.ma.fl(a);
            }
            return null;
        }
        get m7() {
            let a = this.m5(this.ms);
            return a != null ? a : stringFormat("{0:0.##}", this.ms);
        }
    }
    ValueOverlay.$t = /*@__PURE__*/ markType(ValueOverlay, 'ValueOverlay', Series.$, [IHasCategoryModePreference_$type]);
    ValueOverlay.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, ValueOverlay, 'raisePropertyChanged', ['AxisAnnotationBackground:no:nb', [Brush.$, null], 'AxisAnnotationFormatLabel:mc:nc', [Delegate_$type], 'AxisAnnotationInterpolatedValuePrecision:mt:nd', [1, -1], 'AxisAnnotationOutline:np:ne', [Brush.$, null], 'AxisAnnotationPaddingBottom:mi:nf', [1, NaN], 'AxisAnnotationPaddingLeft:mj:ng', [1, NaN], 'AxisAnnotationPaddingRight:mk:nh', [1, NaN], 'AxisAnnotationPaddingTop:ml:ni', [1, NaN], 'AxisAnnotationStrokeThickness:mm:nj', [1, NaN], 'AxisAnnotationTextColor:nq:nk', [Brush.$, null], 'Axis:ma:nl', [Axis.$, null], 'IsAxisAnnotationEnabled:me:nm', [0, false], 'Value:ms:nn', [1, 0]]);
    return ValueOverlay;
})();
/**
 * @hidden
 */
export let ValueOverlayView = /*@__PURE__*/ (() => {
    class ValueOverlayView extends SeriesView {
        constructor(a) {
            super(a);
            this.bw = null;
            this.bw = new Path();
        }
        a8() {
            super.a8();
            this.bw._stroke = this.e.lb;
            this.bw.ac = this.e.ey;
            this.bw.ai = this.e.ll;
            this.bw.ad = this.e.lm;
        }
        a9() {
            super.a9();
            let a = this.bl();
            this.bw._stroke = a;
            this.bw.ac = this.e.ey + 3;
            this.bw._stroke = a;
            this.bw.ac = this.e.ey + 3;
        }
        bv(a) {
            this.bw.ak = a;
            this.an();
        }
        bu() {
            this.bw.ak = null;
            this.an();
        }
        a3(a, b) {
            super.a3(a, b);
            if (a.d) {
                a.s(this.bw);
            }
        }
        ai(a) {
            super.ai(a);
            this.e.a2.exportPathData(a, this.bw, "ValueOverlayPath", []);
        }
    }
    ValueOverlayView.$t = /*@__PURE__*/ markType(ValueOverlayView, 'ValueOverlayView', SeriesView.$);
    return ValueOverlayView;
})();
//# sourceMappingURL=ValueOverlay_combined.js.map
