/*
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 { __extends, __values } from "tslib";
import { Series } from "./Series";
import { ISupportsFillScale_$type } from "./ISupportsFillScale";
import { DependencyProperty } from "igniteui-angular-core";
import { BrushScale } from "./BrushScale";
import { HighlightingInfo } from "igniteui-angular-core";
import { ShapeItemSearchMode_$type } from "./ShapeItemSearchMode";
import { IEnumerable$1_$type, String_$type, enumGetBox, Number_$type, Point_$type, typeCast, runOn, delegateCombine, fromEnum, Array_$type, markType, markDep } from "igniteui-angular-core";
import { NumericXAxis } from "./NumericXAxis";
import { NumericYAxis } from "./NumericYAxis";
import { List$1 } from "igniteui-angular-core";
import { Rect } from "igniteui-angular-core";
import { StyleShapeEventArgs } from "./StyleShapeEventArgs";
import { FrameworkElement } from "igniteui-angular-core";
import { IFastItemsSource_$type } from "igniteui-angular-core";
import { DataContext } from "igniteui-angular-core";
import { Tuple$2 } from "igniteui-angular-core";
import { ShapeHitRegion } from "./ShapeHitRegion";
import { RectUtil } from "igniteui-angular-core";
import { Tuple$3 } from "igniteui-angular-core";
import { GeometryUtil } from "igniteui-angular-core";
import { AssigningShapeStyleEventArgs } from "./AssigningShapeStyleEventArgs";
import { AssigningShapeMarkerStyleEventArgs } from "./AssigningShapeMarkerStyleEventArgs";
import { SeriesLayerPropertyOverlay } from "./SeriesLayerPropertyOverlay";
import { CustomPaletteBrushScale } from "./CustomPaletteBrushScale";
import { ValueBrushScale } from "./ValueBrushScale";
import { PointCollectionUtil } from "igniteui-angular-core";
import { FlattenedShape } from "./FlattenedShape";
import { SeriesView } from "./SeriesView";
import { Clipper } from "igniteui-angular-core";
import { ScalerParams } from "./ScalerParams";
import { Dictionary$2 } from "igniteui-angular-core";
import { ActualRange } from "./ActualRange";
import { SeriesRenderManager } from "./SeriesRenderManager";
import { PolySimplification } from "igniteui-angular-core";
import { DefaultFlattener } from "./DefaultFlattener";
import { ChartSelection } from "./ChartSelection";
import { AxisRange } from "./AxisRange";
import { Style } from "igniteui-angular-core";
import { PropertyMetadata } from "igniteui-angular-core";
import { boxArray$1 } from "igniteui-angular-core";
import { InvalidOperationException } from "igniteui-angular-core";
import { isNaN_, truncate } from "igniteui-angular-core";
import { FastItemObjectColumn } from "igniteui-angular-core";
import { Path } from "igniteui-angular-core";
import { Pool$1 } from "igniteui-angular-core";
import { PointCollection } from "igniteui-angular-core";
import { PathGeometry } from "igniteui-angular-core";
import { PolyLineSegment } from "igniteui-angular-core";
import { PathFigure } from "igniteui-angular-core";
import { PolygonUtil } from "igniteui-angular-core";
/**
 * @hidden
 */
var ShapeSeriesBase = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(ShapeSeriesBase, _super);
    function ShapeSeriesBase() {
        var _this = _super.call(this) || this;
        _this.x3 = null;
        _this.x8 = false;
        _this.x7 = false;
        _this.x1 = null;
        _this.x2 = null;
        _this.xr = 1;
        _this.xc = null;
        _this.xd = null;
        _this.assigningShapeStyle = null;
        _this.assigningShapeMarkerStyle = null;
        _this.xv = null;
        _this.x4 = null;
        _this.xn = null;
        _this.xp = null;
        _this.yu = 0;
        _this.yq = null;
        _this.w9 = null;
        _this.xb = null;
        _this.xa = null;
        _this.w8 = null;
        _this.aae = null;
        _this.xl = null;
        _this.xx = null;
        _this.xg = null;
        _this.yx = 0;
        _this.styleShape = null;
        _this.xv = new ShapeSeriesRenderManager();
        FastItemObjectColumn.m();
        _this.yx = _this.yw;
        _this.aae = Rect.empty;
        return _this;
    }
    ShapeSeriesBase.prototype.o8 = function () {
        _super.prototype.o8.call(this);
        this.xo = null;
        this.xq = null;
    };
    ShapeSeriesBase.prototype.ai = function () {
        return [this.xo, this.xq];
    };
    ShapeSeriesBase.prototype.ku = function (a, b) {
        var c = this.ni(b);
        if (c == ShapeSeriesBase.$$p[9]) {
            return this.kv(a, b, this.zh);
        }
        return null;
    };
    ShapeSeriesBase.prototype.mi = function (a) {
        var b = this.ni(a);
        if (b == ShapeSeriesBase.$$p[9]) {
            return this.zh;
        }
        return _super.prototype.mi.call(this, a);
    };
    Object.defineProperty(ShapeSeriesBase.prototype, "x5", {
        get: function () {
            return this.x3;
        },
        set: function (a) {
            if (this.x3 != a) {
                var b = this.x5;
                this.x3 = a;
                this.raisePropertyChanged("FillColumn", b, this.x5);
            }
        },
        enumerable: false,
        configurable: true
    });
    ShapeSeriesBase.prototype.get_ff = function () {
        return true;
    };
    ShapeSeriesBase.prototype.get_ef = function () {
        return true;
    };
    ShapeSeriesBase.prototype.xz = function (a, b, c) {
        if (this.dp == null) {
            return null;
        }
        var d = this.wh(b);
        var e = this.xw.df(d, false);
        var f = -1;
        if (e == null) {
            if (a != null) {
                f = this.dp.indexOf(a);
            }
            else {
                return null;
            }
        }
        else if (e.dataContext != null) {
            f = e.dataContext.c;
        }
        if (f == -1) {
            return null;
        }
        var g = new HighlightingInfo();
        g.i = this;
        g.g = f;
        g.f = f;
        g.c = false;
        if (c != null && c.g == g.g && c.f == g.f) {
            return c;
        }
        return g;
    };
    ShapeSeriesBase.prototype.x0 = function (a, b, c) {
        if (this.dp == null) {
            return null;
        }
        var d = this.xw.ch(this.wh(b));
        var e = -1;
        if (d == null) {
            if (a != null) {
                e = this.dp.indexOf(a);
            }
            else {
                return null;
            }
        }
        else {
            e = d.ak;
        }
        if (e == -1) {
            return null;
        }
        var f = new HighlightingInfo();
        f.i = this;
        f.g = e;
        f.f = e;
        f.c = false;
        f.d = true;
        if (c != null && c.g == f.g && c.f == f.f) {
            return c;
        }
        return f;
    };
    Object.defineProperty(ShapeSeriesBase.prototype, "xs", {
        get: function () {
            return this.xr;
        },
        set: function (a) {
            var b = this.xr;
            this.xr = a;
            if (b != this.xr) {
                this.raisePropertyChanged("ActualItemSearchMode", enumGetBox(ShapeItemSearchMode_$type, b), enumGetBox(ShapeItemSearchMode_$type, this.xr));
            }
        },
        enumerable: false,
        configurable: true
    });
    ShapeSeriesBase.prototype.xt = function () {
        if (this.xu != 0) {
            return this.xu;
        }
        return 1;
    };
    ShapeSeriesBase.prototype.it = function (a) {
        switch (this.xs) {
            case 1: return this.zn(a).c;
            case 2: return this.yv(a);
            case 3: return this.yv(a);
        }
        return -1;
    };
    ShapeSeriesBase.prototype.zn = function (a) {
        var b = this.wh(a);
        var c = { $type: Point_$type, x: NaN, y: NaN };
        var d = this.xw.cr;
        if (d == null) {
            return new Tuple$2(Number_$type, Point_$type, -1, c);
        }
        var e = this.xw.ci(b, false, !this.ya);
        if (e != null) {
            c = RectUtil.l(e.d);
            return new Tuple$2(Number_$type, Point_$type, e.b, c);
        }
        var f = b.x;
        var g = b.y;
        if (this.dp == null || this.xo == null || this.xq == null || this.yq == null) {
            return new Tuple$2(Number_$type, Point_$type, -1, c);
        }
        if (this.dp.count > this.y0) {
            return new Tuple$2(Number_$type, Point_$type, -1, c);
        }
        var h = 1.7976931348623157E+308;
        var i = -1;
        for (var j = 0; j < d.count; j++) {
            var k = d._inner[j].d;
            var l = RectUtil.g(k, b);
            if (l < h) {
                h = l;
                i = d._inner[j].b;
                c = RectUtil.l(d._inner[j].d);
            }
        }
        return new Tuple$2(Number_$type, Point_$type, i, c);
    };
    ShapeSeriesBase.prototype.zm = function (a) {
        var b = this.wh(a);
        var c = b.x;
        var d = b.y;
        var e = { $type: Point_$type, x: NaN, y: NaN };
        if (this.dp == null || this.xo == null || this.xq == null || this.yq == null) {
            return new Tuple$3(Number_$type, Point_$type, Point_$type, -1, e, e);
        }
        if (this.dp.count > this.y0) {
            return new Tuple$3(Number_$type, Point_$type, Point_$type, -1, e, e);
        }
        var f = 1.7976931348623157E+308;
        var g = this.xw.cr;
        if (g == null) {
            return new Tuple$3(Number_$type, Point_$type, Point_$type, -1, e, e);
        }
        var h = this.xw.ci(b, false, !this.ya);
        if (h != null) {
            var i = RectUtil.l(h.d);
            var j = this.zl(b, h.a, this.ya);
            return new Tuple$3(Number_$type, Point_$type, Point_$type, h.b, j.d, i);
        }
        for (var k = 0; k < g.count; k++) {
            var l = g._inner[k].d;
            var m = RectUtil.g(l, b);
            var n = (l.width * l.width) + (l.height * l.height) + m;
            if (n <= f) {
                f = n;
            }
        }
        var o = 1.7976931348623157E+308;
        var p = -1;
        for (var q = 0; q < g.count; q++) {
            var r = g._inner[q].d;
            var s = RectUtil.g(r, b);
            if (s < f) {
                var t = this.zl(b, g._inner[q].a, this.ya);
                if (t.c < o) {
                    o = t.c;
                    e = t.d;
                    p = q;
                }
            }
        }
        if (p >= 0) {
            return new Tuple$3(Number_$type, Point_$type, Point_$type, g._inner[p].b, e, RectUtil.l(g._inner[p].d));
        }
        return new Tuple$3(Number_$type, Point_$type, Point_$type, -1, e, e);
    };
    ShapeSeriesBase.prototype.get_ya = function () {
        return true;
    };
    Object.defineProperty(ShapeSeriesBase.prototype, "ya", {
        get: function () {
            return this.get_ya();
        },
        enumerable: false,
        configurable: true
    });
    ShapeSeriesBase.prototype.zl = function (a, b, c) {
        var d = { $type: Point_$type, x: NaN, y: NaN };
        var e = 1.7976931348623157E+308;
        var f = { $type: Point_$type, x: NaN, y: NaN };
        var g = false;
        var h = -1;
        for (var i = 0; i < b.count; i++) {
            var j = b._inner[i];
            if (i >= 1) {
                var k = GeometryUtil.h(a, d, j);
                if (k < e) {
                    e = k;
                    g = true;
                    h = i;
                }
            }
            d = j;
        }
        if (c) {
            var l = b._inner[0];
            var m = GeometryUtil.h(a, d, l);
            if (m < e) {
                e = m;
                var n = GeometryUtil.m(a, d, l);
                f = { $type: Point_$type, x: d.x + (l.x - d.x) * n, y: d.y + (l.y - d.y) * n };
                return new Tuple$2(Number_$type, Point_$type, e, f);
            }
        }
        if (g) {
            var o = b._inner[h - 1];
            var p = b._inner[h];
            var q = GeometryUtil.m(a, o, p);
            f = { $type: Point_$type, x: o.x + (p.x - o.x) * q, y: o.y + (p.y - o.y) * q };
        }
        return new Tuple$2(Number_$type, Point_$type, e, f);
    };
    ShapeSeriesBase.prototype.yv = function (a) {
        return this.zm(a).c;
    };
    ShapeSeriesBase.prototype.wm = function (a, b, c) {
        if (this.xo == null || this.xq == null || this.yq == null) {
            return { $type: Point_$type, x: NaN, y: NaN };
        }
        switch (this.xs) {
            case 1:
                var d = this.zn(a);
                return d.d;
            case 2:
                var e = this.zm(a);
                return e.e;
            case 3:
                var f = this.zm(a);
                return f.d;
        }
        return { $type: Point_$type, x: NaN, y: NaN };
    };
    ShapeSeriesBase.prototype.kr = function (a) {
        var b = this.j7(a);
        if (this.dp != null && b >= 0 && b < this.dp.count) {
            return this.dp.item(b);
        }
        return null;
    };
    ShapeSeriesBase.prototype.xy = function (a, b, c) {
        var d = new HighlightingInfo();
        d.i = this;
        d.g = 0;
        d.f = this.dp.count - 1;
        d.c = true;
        if (c != null && c.g == d.g && c.f == d.f) {
            return c;
        }
        return d;
    };
    ShapeSeriesBase.prototype.dh = function (a, b, c) {
        if (this.ef && this.f0(this.by) && !c) {
            var d = this.xz(a, b, this.x1);
            this.x1 = d;
            return d;
        }
        else {
            var e = this.xy(a, b, this.x1);
            this.x1 = e;
            return e;
        }
    };
    ShapeSeriesBase.prototype.di = function (a, b, c) {
        if (this.f0(this.by) && !c) {
            var d = this.x0(a, b, this.x2);
            this.x2 = d;
            return d;
        }
        else {
            var e = this.xy(a, b, this.x2);
            e.d = true;
            this.x2 = e;
            return e;
        }
    };
    ShapeSeriesBase.prototype.yo = function () {
        return (this.assigningShapeStyle != null && this.x8) || this.d3 || (this.by != 1) || (this.cq != 1) || (this.cp != 1) || (this.x5 != null && this.xk != null);
    };
    ShapeSeriesBase.prototype.yn = function () {
        return (this.assigningShapeMarkerStyle != null && this.x7) || this.d3 || (this.by != 1) || (this.cq != 1) || (this.cp != 1);
    };
    Object.defineProperty(ShapeSeriesBase.prototype, "y8", {
        get: function () {
            return this.c(ShapeSeriesBase.z4);
        },
        set: function (a) {
            this.h(ShapeSeriesBase.z4, a);
        },
        enumerable: false,
        configurable: true
    });
    ShapeSeriesBase.prototype.gc = function () {
        return this.highlightedItemsSource != null || this.y8 != null;
    };
    ShapeSeriesBase.prototype.hu = function () {
        var a = _super.prototype.hu.call(this);
        {
            var b = ((function () {
                var $ret = new SeriesLayerPropertyOverlay();
                $ret.ad = "ShapeMemberPath";
                $ret.p = true;
                $ret.y = "HighlightedShapeMemberPath";
                $ret.q = true;
                return $ret;
            })());
            b.valueResolving = delegateCombine(b.valueResolving, runOn(this, this.zq));
            a.add(b);
        }
        {
            var c = ((function () {
                var $ret = new SeriesLayerPropertyOverlay();
                $ret.r = true;
                $ret.ad = "Brush";
                $ret.p = true;
                $ret.y = "ActualBrush";
                $ret.q = true;
                return $ret;
            })());
            c.valueResolving = delegateCombine(c.valueResolving, runOn(this, this.r8));
            a.add(c);
        }
        {
            var d = ((function () {
                var $ret = new SeriesLayerPropertyOverlay();
                $ret.r = true;
                $ret.ad = "Outline";
                $ret.p = true;
                $ret.y = "ActualOutline";
                $ret.q = true;
                return $ret;
            })());
            d.valueResolving = delegateCombine(d.valueResolving, runOn(this, this.r8));
            a.add(d);
        }
        return a;
    };
    ShapeSeriesBase.prototype.zq = function (a, b) {
        if (this.y8 != null) {
            b.value = this.y8;
            return;
        }
        b.value = this.zh;
    };
    Object.defineProperty(ShapeSeriesBase.prototype, "x6", {
        get: function () {
            return this.x4;
        },
        set: function (a) {
            var b = this.x6 != a;
            if (b) {
                var c = this.x6;
                this.x4 = a;
                this.raisePropertyChanged("ShapeColumn", c, this.x6);
            }
        },
        enumerable: false,
        configurable: true
    });
    ShapeSeriesBase.prototype.yf = function (array_) {
        var a = (Array.isArray(array_));
        return a;
    };
    ShapeSeriesBase.yj = function (a) {
        if (a == null) {
            return true;
        }
        var val_ = a;
        return (val_ == undefined);
    };
    ShapeSeriesBase.prototype.convertToListList = function (a) {
        if (a == null) {
            return null;
        }
        var b = new List$1(List$1.$.specialize(Point_$type), 0);
        var c;
        var curr_;
        var d;
        var e;
        var f = false;
        var g = false;
        for (var h = 0; h < a.length; h++) {
            c = a[h];
            if (c == null) {
                continue;
            }
            var i = new List$1(Point_$type, 0);
            for (var j = 0; j < c.length; j++) {
                curr_ = c[j];
                if (f) {
                    d = (curr_.X);
                    e = (curr_.Y);
                }
                else {
                    d = (curr_.x);
                    e = (curr_.y);
                }
                if (!g) {
                    if ((isNaN_(d) || ShapeSeriesBase.yj(d)) && (isNaN_(e) || ShapeSeriesBase.yj(e))) {
                        d = (curr_.X);
                        e = (curr_.Y);
                        if (!isNaN_(d) && !ShapeSeriesBase.yj(d) && !isNaN_(e) && !ShapeSeriesBase.yj(e)) {
                            g = true;
                            f = true;
                        }
                    }
                    else {
                        g = true;
                    }
                }
                i.add({ $type: Point_$type, x: d, y: e });
            }
            b.add(i);
        }
        return b;
    };
    ShapeSeriesBase.prototype.dn = function (a) {
        if (this.dp != null && this.yf(this.itemsSource) && a != null && a.split('!').length != 2) {
            if (this.coercionMethods == null) {
                this.coercionMethods = {};
            }
            var methods_ = this.coercionMethods;
            methods_.convertToListList = this.convertToListList;
            a += "!convertToListList";
        }
        return _super.prototype.dn.call(this, a);
    };
    ShapeSeriesBase.prototype.rg = function (a, b, c, d) {
        _super.prototype.rg.call(this, a, b, c, d);
        var e = false;
        var f = false;
        switch (b) {
            case ShapeSeriesBase.$$p[5]:
                this.xs = this.xt();
                break;
            case "FastItemsSource":
                var g = typeCast(IFastItemsSource_$type, c);
                if (g != null) {
                    if (this.x5 != null) {
                        g.deregisterColumn(this.x5);
                    }
                    if (this.x6 != null) {
                        g.deregisterColumn(this.x6);
                    }
                    this.x6 = null;
                }
                var h = typeCast(IFastItemsSource_$type, d);
                if (h != null) {
                    if (this.zh != null) {
                        this.x6 = this.dn(this.zh);
                    }
                    if (this.y4 != null) {
                        this.x5 = this.dl(this.y4);
                    }
                }
                e = this.xo != null && !this.xo.d2();
                f = this.xq != null && !this.xq.d2();
                if (e || f) {
                    this.ry(this.gh && c != null);
                }
                break;
            case ShapeSeriesBase.$$p[9]:
                if (this.dp != null) {
                    this.dp.deregisterColumn(this.x6);
                    this.x6 = this.dn(this.zh);
                }
                break;
            case "ShapeColumn":
                this.zy();
                e = this.xo != null && !this.xo.d2();
                f = this.xq != null && !this.xq.d2();
                if (e || f) {
                    this.ry(this.gh && this.d9);
                }
                this.qr();
                break;
            case ShapeSeriesBase.$$p[10]:
            case ShapeSeriesBase.$$p[11]:
                this.xn = this.xo;
                this.xp = this.xq;
                var i = c;
                var j = d;
                this.zz(i);
                this.zr(j);
                if ((j != null && !j.d2()) || (j == null && i != null)) {
                    this.ry(false);
                }
                this.qr();
                break;
            case "ActualResolution":
                this.yu = this.ie;
                this.qr();
                break;
            case "ActualBrush":
                this.ry(false);
                break;
            case ShapeSeriesBase.$$p[8]:
                this.yx = this.yw;
                this.ry(false);
                this.qr();
                break;
            case ShapeSeriesBase.$$p[2]:
            case "ActualThickness":
                this.ry(false);
                this.qr();
                break;
            case ShapeSeriesBase.$$p[4]:
                this.x8 = this.ym();
                this.ry(false);
                break;
            case ShapeSeriesBase.$$p[3]:
                this.x7 = this.yl();
                this.ry(false);
                break;
            case ShapeSeriesBase.$$p[1]:
                if (c != null) {
                    c.o.remove(this);
                    c.x();
                    this.xl = null;
                    this.xx = null;
                }
                if (d != null) {
                    d.o.add(this);
                    d.x();
                    this.xl = typeCast(CustomPaletteBrushScale.$, d);
                    this.xx = typeCast(ValueBrushScale.$, d);
                }
                this.ry(false);
                this.qr();
                break;
            case "FillColumn":
                this.ry(this.gh && this.d9);
                this.qr();
                break;
            case ShapeSeriesBase.$$p[0]:
                if (this.xk != null) {
                    this.xk.x();
                }
                if (this.dp != null) {
                    this.dp.deregisterColumn(this.x5);
                    this.x5 = this.dl(this.y4);
                }
                break;
        }
    };
    ShapeSeriesBase.prototype.ym = function () {
        return this.yi;
    };
    ShapeSeriesBase.prototype.yl = function () {
        return this.yh;
    };
    ShapeSeriesBase.prototype.yc = function (a) {
        if (typeCast(NumericYAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    ShapeSeriesBase.prototype.yb = function (a) {
        if (typeCast(NumericXAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    ShapeSeriesBase.prototype.zy = function () {
        this.yq = null;
        if (this.x6 == null) {
            return;
        }
        this.yq = new List$1(Rect.$, 2, this.x6.count);
        for (var a = 0; a < this.x6.count; a++) {
            this.yq.add(PointCollectionUtil.j(this.x6.item(a)));
        }
    };
    ShapeSeriesBase.prototype.aaf = function (a) {
        if (typeCast(IEnumerable$1_$type.specialize(IEnumerable$1_$type.specialize(Point_$type)), a) !== null) {
            return PointCollectionUtil.h(a);
        }
        else if (typeCast(IEnumerable$1_$type.specialize(Point_$type), a) !== null) {
            return PointCollectionUtil.g(a);
        }
        return Rect.empty;
    };
    ShapeSeriesBase.prototype.ys = function (a, b, c, d, e, f, g) {
        var e_1, _a;
        return this.yt(a, b, c, d, e, f, g);
        if (typeCast(List$1.$.specialize(List$1.$.specialize(Point_$type)), c) !== null) {
            return this.yt(a, b, c, d, e, f, g);
        }
        else if (typeCast(IEnumerable$1_$type.specialize(IEnumerable$1_$type.specialize(Point_$type)), c) !== null) {
            var h = c;
            var i = new List$1(FlattenedShape.$, 0);
            var j = null;
            try {
                for (var _b = __values(fromEnum(h)), _c = _b.next(); !_c.done; _c = _b.next()) {
                    var k = _c.value;
                    j = this.xm(a, b, PointCollectionUtil.b(k), d, e, f, g);
                    if (j == null) {
                        continue;
                    }
                    i.add(j);
                }
            }
            catch (e_1_1) {
                e_1 = { error: e_1_1 };
            }
            finally {
                try {
                    if (_c && !_c.done && (_a = _b.return))
                        _a.call(_b);
                }
                finally {
                    if (e_1)
                        throw e_1.error;
                }
            }
            return i;
        }
        else if (typeCast(IEnumerable$1_$type.specialize(Point_$type), c) !== null) {
            var l = c;
            var m = this.xm(a, b, PointCollectionUtil.b(l), d, e, f, g);
            var n = new List$1(FlattenedShape.$, 0);
            if (m != null) {
                n.add(m);
            }
            return n;
        }
        else {
            throw new InvalidOperationException(1, "Unrecognized data in ShapeColumn");
        }
    };
    ShapeSeriesBase.prototype.get_yg = function () {
        return true;
    };
    Object.defineProperty(ShapeSeriesBase.prototype, "yg", {
        get: function () {
            return this.get_yg();
        },
        enumerable: false,
        configurable: true
    });
    ShapeSeriesBase.prototype.yp = function () {
        return false;
    };
    ShapeSeriesBase.prototype.rz = function (a) {
        this.zx(this.cw);
    };
    ShapeSeriesBase.prototype.rx = function (a, b, c, d, e) {
        _super.prototype.rx.call(this, a, b, c, d, e);
        var f = this.ba.a$j.item(d);
        var g = f;
        f.bd(c);
        if (this.d7(f)) {
            return;
        }
        this.zx(f);
    };
    ShapeSeriesBase.prototype.updateFillScaleGlobals = function () {
        var a = new ActualRange();
        a.b = NaN;
        a.a = NaN;
        if (this.x5 != null) {
            a.b = this.x5.minimum;
            a.a = this.x5.maximum;
        }
        if (this.xk != null) {
            this.xk.z(a.b, a.a);
        }
    };
    ShapeSeriesBase.prototype.zx = function (a) {
        var _this = this;
        if (this.d7(a)) {
            return;
        }
        if (this.xk != null) {
            this.xg = this.xh();
        }
        var b;
        var c;
        var d = a;
        var e = a.getViewInfo(c, b);
        c = e.p0;
        b = e.p1;
        if (c.width < 1 || c.height < 1 || this.x6 == null) {
            return;
        }
        var f = this.xo;
        var g = this.xq;
        var h = this.getEffectiveViewport1(a);
        var i = new ScalerParams(1, b, c, f.df);
        i.c = h;
        var j = new ScalerParams(1, b, c, g.df);
        j.c = h;
        if (!this.gs) {
            d.c7();
            var k = new Rect(0, 0, 0, 0, 0);
            var l = void 0;
            var m = void 0;
            var n = void 0;
            var o = void 0;
            var p = this.x6.count;
            if (this.xb == null || this.xb.length != p) {
                this.xb = new Array(p);
                this.w9 = new Array(p);
                this.xa = new Array(p);
                this.w8 = new Array(p);
            }
            var q = this.xb;
            var r = this.w9;
            var s = this.xa;
            var t = this.w8;
            var u = void 0;
            for (var v = 0; v < p; v++) {
                u = this.yq._inner[v];
                q[v] = u.top;
                r[v] = u.left;
                s[v] = u.right;
                t[v] = u.bottom;
            }
            this.xn.j6(boxArray$1(r), 0, r.length, i);
            this.xn.j6(boxArray$1(s), 0, s.length, i);
            this.xp.j6(boxArray$1(q), 0, q.length, j);
            this.xp.j6(boxArray$1(t), 0, t.length, j);
            d.c8(r, q, s, t);
            var w = this.x6;
            var x = this.dp;
            this.z0(d);
            var y = c.left;
            var z = c.right;
            var aa = c.top;
            var ab = c.bottom;
            var ac = null;
            if (this.aae.isEmpty) {
                ac = null;
            }
            else {
                ac = new Clipper(1, this.aae.left, this.aae.bottom, this.aae.right, this.aae.top, this.yg);
            }
            var ad = this.yp();
            if (ad) {
                d.cp.clear();
            }
            var ae = false;
            var af = true;
            var ag = 0;
            if (this.dc != null) {
                if (this.dc.gl()) {
                    var ah = this.dc.n1(b, i);
                    ae = ah.c;
                    ag = ah.d;
                }
            }
            var ai = void 0;
            for (var aj = 0; aj < p; aj++) {
                n = r[aj];
                l = q[aj];
                m = t[aj];
                o = s[aj];
                k.x = Math.min(n, o);
                k.y = Math.min(l, m);
                k.width = Math.max(n, o) - k.x;
                k.height = Math.max(l, m) - k.y;
                if (k.intersectsWith(c)) {
                    if (k.x < y || k.y < aa || k.x > z || k.y > ab) {
                        ai = ac;
                    }
                    else {
                        ai = null;
                    }
                    var ak = this.ys(a, ai, w.item(aj), i, j, 0, ag);
                    if (ad) {
                        ShapeSeriesBase.zw(d, aj, ak);
                    }
                    d.cv(aj, x.item(aj), k, ak);
                }
                else if (ae) {
                    k.x = k.x + ag;
                    if (k.intersectsWith(c)) {
                        if (k.x < y || k.y < aa || k.x > z || k.y > ab) {
                            ai = ac;
                        }
                        else {
                            ai = null;
                        }
                        var al = this.ys(a, ai, w.item(aj), i, j, ag, ag);
                        if (ad) {
                            ShapeSeriesBase.zw(d, aj, al);
                        }
                        d.cv(aj, x.item(aj), k, al);
                    }
                }
            }
            d.c6();
        }
        var am = this.yo();
        this.xv.az(this, this.yo(), runOn(this, this.xe));
        var an = false;
        var ao = this.xv.b;
        if (ao != null) {
            an = true;
        }
        var ap = a.t;
        var aq = this.fz;
        var ar = d.cn;
        d.c2(function (as) {
            var at = as.dataContext != null ? as.dataContext.item : null;
            var au = as.dataContext != null ? as.dataContext.c : -1;
            d.cz(as, at, am);
            if (an) {
                _this.zt(as, aq, au, _this.x6.count, ap, ar);
            }
            else {
                if (ar) {
                    {
                        _this.xv.a1(as, _this.ic, ar);
                    }
                }
            }
            {
                _this.xv.ad(as, false, false, false, false);
            }
        });
    };
    ShapeSeriesBase.prototype.xh = function () {
        var a = new ActualRange();
        a.b = NaN;
        a.a = NaN;
        if (this.x5 != null) {
            a.b = this.x5.minimum;
            a.a = this.x5.maximum;
        }
        var b = typeCast(ValueBrushScale.$, this.xk);
        if (b != null) {
            b.s();
            if (this.yd && this.xk.o.count > 1) {
                a.b = b.q;
                a.a = b.p;
            }
        }
        return a;
    };
    ShapeSeriesBase.prototype.zt = function (a, b, c, d, e, f) {
        var g = this.by != 1;
        var h = this.cq != 1;
        var i = this.cp != 1;
        this.xv.a0(this.xv.b, c, d, false);
        {
            this.xv.a1(a, this.ic, f);
        }
        var j = this.xv.ax;
        var k = null;
        var l = null;
        var m = null;
        var n = this.dp;
        if (this.x5 != null && this.xk != null) {
            if (j.z >= 0 && j.z < this.x5.count) {
                var o = this.x5.item(j.z);
                var p = this.xg;
                var q = p.b;
                var r = p.a;
                var s = j.aa;
                if (this.xl != null) {
                    s = this.xl.getBrush1(j.z, this.x5.count);
                }
                else if (this.xx != null && this.x5 != null) {
                    var t = this.x5.item(j.z);
                    s = this.xx.getBrushByRange(t, q, r);
                }
                else if (this.xk != null) {
                    s = this.xk.getBrush(j.z);
                }
                j.aa = s;
            }
        }
        if (g && this.dc != null) {
            k = this.dc.d0.getHighlightingInfo(this, n, j.z, j.y, false);
            j.c = k;
        }
        if (h && this.dc != null) {
            l = this.dc.d1.getHighlightingInfo(this, n, j.z, j.y, false);
            if (l == null && this.bo != null) {
                l = this.dc.d1.getHighlightingInfo(this.bo, this.bo.dp, j.z, j.y, false);
            }
            if (l == null && this.bl != null) {
                l = this.dc.d1.getHighlightingInfo(this.bl, this.bl.dp, j.z, j.y, true);
            }
            j.d = l;
        }
        if (i && this.dc != null) {
            m = this.dc.dz.getHighlightingInfo(this, n, j.z, j.y, false);
            j.b = m;
        }
        j.h = e;
        this.zv(j);
        this.xv.z(this, k, l, m, e, g, h, i, false);
    };
    ShapeSeriesBase.prototype.zs = function (a, b, c) {
        var d = this.by != 1;
        var e = this.cq != 1;
        var f = this.cp != 1;
        this.xv.a0(this.xv.d, a, b, true);
        this.xv.aa(this.ic);
        var g = this.xv.aw;
        var h = null;
        var i = null;
        var j = null;
        var k = this.dp;
        var l = null;
        var m = null;
        var n = null;
        if (d && this.dc != null) {
            h = this.dc.d0.getHighlightingInfo(this, k, g.z, g.y, true);
            if (this.dc.d0.isCrossContextHighlight(this)) {
                l = this.dc.d0.getHighlightingInfo(this, k, g.z, g.y, true);
            }
            g.c = h;
        }
        if (e && this.dc != null) {
            i = this.dc.d1.getHighlightingInfo(this, k, g.z, g.y, true);
            if (i == null && this.bo != null) {
                i = this.dc.d1.getHighlightingInfo(this.bo, this.bo.dp, g.z, g.y, true);
            }
            if (this.dc.d1.isCrossContextHighlight(this)) {
                m = this.dc.d1.getHighlightingInfo(this, k, g.z, g.y, true);
            }
            g.d = i;
        }
        if (f && this.dc != null) {
            j = this.dc.dz.getHighlightingInfo(this, k, g.z, g.y, true);
            if (this.dc.dz.isCrossContextHighlight(this)) {
                n = this.dc.dz.getHighlightingInfo(this, k, g.z, g.y, true);
            }
            g.b = i;
        }
        g.h = c;
        this.zu(g);
        this.xv.y(this, h, i, j, c, d, e, f, g.v, this.dc.d0.totalHighWaterMark, g.x, this.dc.d1.totalHighWaterMark, g.t, this.dc.dz.totalHighWaterMark);
    };
    ShapeSeriesBase.prototype.zv = function (a) {
        if (this.assigningShapeStyle != null && this.x8) {
            this.assigningShapeStyle(this, a);
        }
    };
    ShapeSeriesBase.prototype.zu = function (a) {
        if (this.assigningShapeMarkerStyle != null && this.x7) {
            this.assigningShapeMarkerStyle(this, a);
        }
    };
    ShapeSeriesBase.prototype.xe = function (a, b) {
        return this.xf(a, b);
    };
    ShapeSeriesBase.prototype.xf = function (a, b) {
        if (b < a || a < 0 || a > this.x6.count || b < 0 || b > this.x6.count) {
            return null;
        }
        var c = new Array((b - a) + 1);
        for (var d = a; d <= b; d++) {
            var e = d;
            c[d - a] = this.dp.item(d);
        }
        return c;
    };
    ShapeSeriesBase.zw = function (a, b, c) {
        var d = 0;
        var e = null;
        for (var f = 0; f < c.count; f++) {
            var g = c._inner[f];
            var h = g.b.width * g.b.height;
            if (h > d) {
                d = h;
                e = g;
            }
        }
        a.cp.addItem(b, e);
    };
    ShapeSeriesBase.prototype.qh = function () {
        _super.prototype.qh.call(this);
        if (this.xo != null) {
            this.xo.k2();
        }
        if (this.xq != null) {
            this.xq.k2();
        }
    };
    ShapeSeriesBase.prototype.sz = function (a, b) {
        this.ry(false);
    };
    ShapeSeriesBase.prototype.sy = function (a, b) {
        this.ry(false);
    };
    ShapeSeriesBase.prototype.ph = function (a, b, c, d) {
        _super.prototype.ph.call(this, a, b, c, d);
        switch (a) {
            case 3:
                if (d == this.zh) {
                    this.yq._inner[b] = this.aaf(this.x6.item(b));
                }
                break;
            case 1:
                for (var e = b; e < b + c; e++) {
                    this.yq.insert(e, this.aaf(this.x6.item(e)));
                }
                break;
            case 0:
                this.yq.v(b, c);
                break;
            case 2:
                for (var f = b; f < b + c; f++) {
                    this.yq._inner[f] = this.aaf(this.x6.item(f));
                }
                break;
            case 4:
                this.zy();
                break;
        }
        this.ry(false);
    };
    ShapeSeriesBase.prototype.hf = function (a, b, c) {
        var d = true;
        if (!_super.prototype.hf.call(this, a, b, c) || (this.yk && this.x6 == null) || b.isEmpty || a.isEmpty || this.xo == null || this.xq == null || this.xo.b0 == null || this.xq.b0 == null || this.xo.pr == this.xo.pq || this.xq.pr == this.xq.pq || this.x6 == null || this.x6.count == 0 || this.yq == null || this.yq.count == 0 || this.yq.count != this.x6.count) {
            d = false;
        }
        return d;
    };
    ShapeSeriesBase.prototype.get_yk = function () {
        return true;
    };
    Object.defineProperty(ShapeSeriesBase.prototype, "yk", {
        get: function () {
            return this.get_yk();
        },
        enumerable: false,
        configurable: true
    });
    ShapeSeriesBase.prototype.q7 = function (a) {
        _super.prototype.q7.call(this, a);
        this.xw = typeCast(ShapeSeriesViewBase.$, a);
    };
    ShapeSeriesBase.prototype.yt = function (a, b, c, d, e, f, g) {
        var h = new List$1(FlattenedShape.$, 0);
        var i;
        var j = c.count;
        for (var k = 0; k < j; k++) {
            i = c._inner[k];
            var l = this.xm(a, b, i, d, e, f, g);
            if (l == null) {
                continue;
            }
            h.add(l);
        }
        return h;
    };
    ShapeSeriesBase.prototype.xm = function (a, b, c, d, e, f, g) {
        var h = this.zo(c, d, e);
        var i = h.c;
        var j = h.d;
        var k = i.length;
        var l = 1.7976931348623157E+308;
        var m = 1.7976931348623157E+308;
        var n = -1.7976931348623157E+308;
        var o = -1.7976931348623157E+308;
        var p;
        var q;
        if (f != 0) {
            for (var r = 0; r < k; r++) {
                i[r] = i[r] + f;
            }
        }
        for (var s = 0; s < k; s++) {
            p = i[s];
            q = j[s];
            l = p < l ? p : l;
            m = q < m ? q : m;
            n = p > n ? p : n;
            o = q > o ? q : o;
        }
        var t = !(l > this.aae.right || n < this.aae.left || m > this.aae.bottom || o < this.aae.top);
        if (!t && f == 0 && g != 0) {
            if (g != 0) {
                for (var u = 0; u < k; u++) {
                    i[u] = i[u] + g;
                }
            }
            for (var v = 0; v < k; v++) {
                p = i[v];
                q = j[v];
                l = p < l ? p : l;
                m = q < m ? q : m;
                n = p > n ? p : n;
                o = q > o ? q : o;
            }
            t = !(l > this.aae.right || n < this.aae.left || m > this.aae.bottom || o < this.aae.top);
        }
        if (!t) {
            return null;
        }
        var w = b != null && (l < this.aae.left || m < this.aae.top || n > this.aae.right || o > this.aae.bottom);
        var x = new Rect(0, l, m, n - l, o - m);
        if (!a.co(x)) {
            return null;
        }
        l = l < this.aae.left ? this.aae.left : l;
        n = n > this.aae.right ? this.aae.right : n;
        m = m < this.aae.top ? this.aae.top : m;
        o = o > this.aae.bottom ? this.aae.bottom : o;
        var y = PolySimplification.b(h, this.ie);
        var z = new DefaultFlattener().c(h.c, h.d, y, this.yu);
        var aa = z.count;
        if (w) {
            var ab = new List$1(Point_$type, 0);
            b.i = ab;
            for (var ac = 0; ac < aa; ac++) {
                b.j(z._inner[ac]);
            }
            b.i = null;
            z = ab;
        }
        if (z == null || z.count == 0) {
            return null;
        }
        var ad = new FlattenedShape();
        ad.a = z;
        ad.b = new Rect(0, l, m, n - l, o - m);
        ad.c = x;
        return ad;
    };
    ShapeSeriesBase.prototype.zo = function (a, b, c) {
        var d = this.xn;
        var e = this.xp;
        var f = a.count;
        var g = new Array(f);
        var h = new Array(f);
        for (var i = 0; i < f; i++) {
            g[i] = a._inner[i].x;
            h[i] = a._inner[i].y;
        }
        d.j6(boxArray$1(g), 0, g.length, b);
        e.j6(boxArray$1(h), 0, h.length, c);
        return new Tuple$2(Array_$type, Array_$type, g, h);
    };
    ShapeSeriesBase.prototype.z0 = function (a) {
        a.dd();
    };
    ShapeSeriesBase.prototype.pb = function (a, b) {
        _super.prototype.pb.call(this, a, b);
        var c = b;
        c.c0();
    };
    ShapeSeriesBase.prototype.zr = function (a) {
        if (a != null) {
            a.du(this);
        }
    };
    ShapeSeriesBase.prototype.zz = function (a) {
        if (a != null) {
            a.cq(this);
        }
    };
    ShapeSeriesBase.prototype.zp = function (a, b, c) {
        var d = this.cw;
        var e = d.b9;
        var f = this.dc.x1(this.dc.xr(a));
        if (e.width < 1 || e.height < 1 || this.x6 == null) {
            return;
        }
        var g = this.getEffectiveViewport1(d);
        var h = new ScalerParams(0, f, e, this.xo.df, g);
        var i = new ScalerParams(0, f, e, this.xq.df, g);
        d.c7();
        var j = this.x6.count;
        var k = new Array(j);
        var l = new Array(j);
        var m = new Array(j);
        var n = new Array(j);
        var o;
        for (var p = 0; p < j; p++) {
            o = this.yq._inner[p];
            k[p] = o.top;
            l[p] = o.left;
            m[p] = o.right;
            n[p] = o.bottom;
        }
        this.xo.j6(boxArray$1(l), 0, l.length, h);
        this.xo.j6(boxArray$1(m), 0, m.length, h);
        this.xq.j6(boxArray$1(k), 0, k.length, i);
        this.xq.j6(boxArray$1(n), 0, n.length, i);
        d.c8(l, k, m, n);
        d.dd();
        var q = null;
        if (!this.aae.isEmpty) {
            q = new Clipper(1, this.aae.left, this.aae.bottom, this.aae.right, this.aae.top, this.yg);
        }
        var r = false;
        var s = 0;
        if (this.dc != null) {
            if (this.dc.gl()) {
                var t = this.dc.n1(f, h);
                r = t.c;
                s = t.d;
            }
        }
        var u, v, w, x;
        var y = new Rect(0, 0, 0, 0, 0);
        for (var z = 0; z < j; z++) {
            w = l[z];
            u = k[z];
            v = n[z];
            x = m[z];
            y.x = Math.min(w, x);
            y.y = Math.min(u, v);
            y.width = Math.max(w, x) - y.x;
            y.height = Math.max(u, v) - y.y;
            if (r) {
                y.x = y.x + s;
            }
            if (!y.intersectsWith(e)) {
                continue;
            }
            var aa = this.ys(d, q, this.x6.item(z), h, i, s, s);
            if (aa.count <= 0) {
                continue;
            }
            this.x9(b, c, z);
        }
    };
    ShapeSeriesBase.prototype.x9 = function (a, b, c) {
        var _this = this;
        if (b == 7 || b == 6) {
            a.add(((function () {
                var $ret = new ChartSelection();
                $ret.series = _this;
                return $ret;
            })()));
            return false;
        }
        else if (b == 1 || b == 2) {
            a.add(((function () {
                var $ret = new ChartSelection();
                $ret.item = _this.dp.item(c);
                return $ret;
            })()));
            return true;
        }
        else {
            a.add(((function () {
                var $ret = new ChartSelection();
                $ret.item = _this.dp.item(c);
                $ret.series = _this;
                return $ret;
            })()));
            return true;
        }
    };
    ShapeSeriesBase.prototype.a2 = function (a, b) {
        var c = this.xw.df(a, b);
        var d = null;
        if (c != null) {
            d = c.dataContext;
        }
        if (d != null) {
            return d;
        }
        return _super.prototype.a2.call(this, a, b);
    };
    ShapeSeriesBase.prototype.y1 = function (a) {
        return this.dp.item(a);
    };
    ShapeSeriesBase.prototype.get_g8 = function () {
        return true;
    };
    ShapeSeriesBase.prototype.set_g8 = function (a) {
        _super.prototype.set_g8.call(this, a);
    };
    ShapeSeriesBase.prototype.ay = function (a) {
        var e_2, _a, e_3, _b;
        if (typeCast(NumericXAxis.$, a) !== null && this.yq != null) {
            var b = 1.7976931348623157E+308;
            var c = -1.7976931348623157E+308;
            try {
                for (var _c = __values(fromEnum(this.yq)), _d = _c.next(); !_d.done; _d = _c.next()) {
                    var d = _d.value;
                    b = Math.min(b, d.left);
                    c = Math.max(c, d.right);
                }
            }
            catch (e_2_1) {
                e_2 = { error: e_2_1 };
            }
            finally {
                try {
                    if (_d && !_d.done && (_a = _c.return))
                        _a.call(_c);
                }
                finally {
                    if (e_2)
                        throw e_2.error;
                }
            }
            return new AxisRange(b, c);
        }
        if (typeCast(NumericYAxis.$, a) !== null && this.yq != null) {
            var e = 1.7976931348623157E+308;
            var f = -1.7976931348623157E+308;
            try {
                for (var _e = __values(fromEnum(this.yq)), _f = _e.next(); !_f.done; _f = _e.next()) {
                    var g = _f.value;
                    e = Math.min(e, g.top);
                    f = Math.max(f, g.bottom);
                }
            }
            catch (e_3_1) {
                e_3 = { error: e_3_1 };
            }
            finally {
                try {
                    if (_f && !_f.done && (_b = _e.return))
                        _b.call(_e);
                }
                finally {
                    if (e_3)
                        throw e_3.error;
                }
            }
            return new AxisRange(e, f);
        }
        return null;
    };
    ShapeSeriesBase.prototype.get_fy = function () {
        return true;
    };
    ShapeSeriesBase.prototype.get_fm = function () {
        return true;
    };
    Object.defineProperty(ShapeSeriesBase.prototype, "ye", {
        get: function () {
            return this.styleShape != null;
        },
        enumerable: false,
        configurable: true
    });
    ShapeSeriesBase.prototype.aag = function (a, b, c) {
        if (this.styleShape != null) {
            if (this.xw.dm != null && c == this.xw.dm) {
                c = new Style();
                var d = this.xw.dm;
                c.fill = d.fill;
                c.opacity = d.opacity;
                c.stroke = d.stroke;
                c.strokeThickness = d.strokeThickness;
            }
            else {
                if (c != null) {
                    var e = new Style();
                    e.fill = c.fill;
                    e.opacity = c.opacity;
                    e.stroke = c.stroke;
                    e.strokeThickness = c.strokeThickness;
                    c = e;
                }
                else {
                    c = new Style();
                }
            }
            var f = new StyleShapeEventArgs(a, b, c);
            this.styleShape(this, f);
            return f.d();
        }
        return c;
    };
    ShapeSeriesBase.$t = markType(ShapeSeriesBase, 'ShapeSeriesBase', Series.$, [ISupportsFillScale_$type]);
    ShapeSeriesBase.z4 = DependencyProperty.i("HighlightedValueMemberPath", String_$type, ShapeSeriesBase.$, new PropertyMetadata(2, null, function (a, b) { return a.raisePropertyChanged("HighlightedValueMemberPath", b.oldValue, b.newValue); }));
    ShapeSeriesBase.$$p = markDep(DependencyProperty, PropertyMetadata, ShapeSeriesBase, 'raisePropertyChanged', ['FillMemberPath:y4:z1', [2], 'FillScale:xk:z2', [BrushScale.$], 'FillScaleUseGlobalValues:yd:z3', [0, false], 'IsCustomShapeMarkerStyleAllowed:yh:z5', [0, false], 'IsCustomShapeStyleAllowed:yi:z6', [0, false], 'ItemSearchMode:xu:z7', [ShapeItemSearchMode_$type, enumGetBox(ShapeItemSearchMode_$type, 0)], 'ItemSearchPointsThreshold:yz:z8', [1, 10000], 'ItemSearchThreshold:y0:z9', [1, 10000], 'ShapeFilterResolution:yw:aaa', [1, 2], 'ShapeMemberPath:zh:aab', [2, null], 'XAxis:xo:aac', [NumericXAxis.$, null], 'YAxis:xq:aad', [NumericYAxis.$, null]]);
    return ShapeSeriesBase;
}(Series));
export { ShapeSeriesBase };
/**
 * @hidden
 */
var ShapeSeriesRenderManager = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(ShapeSeriesRenderManager, _super);
    function ShapeSeriesRenderManager() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.aw = null;
        _this.ax = null;
        return _this;
    }
    ShapeSeriesRenderManager.prototype.c = function () {
        this.aw = new AssigningShapeMarkerStyleEventArgs();
        return this.aw;
    };
    ShapeSeriesRenderManager.prototype.a = function () {
        this.ax = new AssigningShapeStyleEventArgs();
        return this.ax;
    };
    ShapeSeriesRenderManager.prototype.a1 = function (a, b, c) {
        this.ag = this.ak;
        this.ah = this.al;
        this.m = this.t;
        this.am = this.an;
        this.ao = this.ar;
        this.k = this.r;
        this.l = this.s;
        this.j = this.q;
        if (c) {
            if (a._fill != null) {
                this.ag = a._fill;
            }
            if (a._stroke != null) {
                this.ah = a._stroke;
            }
            if (!isNaN_(a.ad) && (a.y == null || !isNaN_(a.y.strokeThickness))) {
                this.m = a.ad;
            }
        }
        var d = this.b;
        if (d != null) {
            d.aa = this.ag;
            d.ab = this.ah;
            d.ae = this.m;
            d.af = this.am;
            d.ag = this.ao;
            d.ac = this.k;
            d.ad = this.l;
            d.o = this.j;
            d.g = this.f;
            d.k = b;
            d.f = false;
        }
    };
    ShapeSeriesRenderManager.prototype.ay = function (a, b, c) {
        this.w(a, b, c);
    };
    ShapeSeriesRenderManager.prototype.az = function (a, b, c) {
        this.x(a, b, c);
    };
    ShapeSeriesRenderManager.prototype.a0 = function (a, b, c, d) {
        if (b == -1) {
            a.e = false;
            a.z = 0;
            a.y = c - 1;
        }
        else {
            if (d) {
                a.z = b;
                a.y = b;
            }
            else {
                a.e = false;
                a.z = b;
                a.y = b;
            }
        }
    };
    ShapeSeriesRenderManager.$t = markType(ShapeSeriesRenderManager, 'ShapeSeriesRenderManager', SeriesRenderManager.$);
    return ShapeSeriesRenderManager;
}(SeriesRenderManager));
export { ShapeSeriesRenderManager };
/**
 * @hidden
 */
var ShapeSeriesViewBase = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(ShapeSeriesViewBase, _super);
    function ShapeSeriesViewBase(a) {
        var _this = _super.call(this, a) || this;
        _this.cp = null;
        _this.cj = null;
        _this.cq = new List$1(ShapeHitRegion.$, 0);
        _this.cu = 0;
        _this.ct = null;
        _this.cm = null;
        _this.dk = new Path();
        _this.ck = null;
        _this.dl = null;
        _this.ce = null;
        _this.cg = null;
        _this.cf = null;
        _this.cd = null;
        _this.cj = a;
        _this.cm = _this.cl();
        _this.ct = new List$1(Path.$, 0);
        _this.cp = new Dictionary$2(Number_$type, FlattenedShape.$, 0);
        return _this;
    }
    ShapeSeriesViewBase.prototype.ch = function (a) {
        return null;
    };
    Object.defineProperty(ShapeSeriesViewBase.prototype, "cr", {
        get: function () {
            return this.cq;
        },
        enumerable: false,
        configurable: true
    });
    ShapeSeriesViewBase.prototype.cl = function () {
        var _this = this;
        return ((function () {
            var $ret = new Pool$1(FrameworkElement.$);
            $ret.create = runOn(_this, _this.de);
            $ret.activate = runOn(_this, _this.c3);
            $ret.disactivate = runOn(_this, _this.c4);
            $ret.destroy = runOn(_this, _this.c5);
            return $ret;
        })());
    };
    ShapeSeriesViewBase.prototype.co = function (a) {
        return a.width >= this.cj.yx && a.height >= this.cj.yx;
    };
    ShapeSeriesViewBase.cs = function (a) {
        var b = new List$1(PointCollection.$, 0);
        var c;
        var d = a.count;
        for (var e = 0; e < d; e++) {
            c = a._inner[e];
            var f = new PointCollection(1, c.a);
            b.add(f);
        }
        return b;
    };
    Object.defineProperty(ShapeSeriesViewBase.prototype, "cn", {
        get: function () {
            return this.dl != null || this.ck != null || this.cj.ye;
        },
        enumerable: false,
        configurable: true
    });
    ShapeSeriesViewBase.prototype.cv = function (a, b, c, d) {
        if (d != null && d.count > 0) {
            var e = ShapeSeriesViewBase.cs(d);
            c.intersect(this.b9);
            if (!this.co(c)) {
            }
            else {
                var f = this.di(a, e);
                if (f != null) {
                    var g = this.dh(this.cu, b);
                    for (var h = 0; h < d.count; h++) {
                        var i = new ShapeHitRegion();
                        i.d = d._inner[h].b;
                        i.a = d._inner[h].a;
                        i.b = a;
                        i.c = g;
                        this.cq.add(i);
                    }
                    this.cx(g, f);
                    this.cu = this.cu + 1;
                }
            }
        }
    };
    ShapeSeriesViewBase.prototype.dh = function (a, b) {
        var c = this.cm.item(this.cu);
        if (c.dataContext != null) {
            c.dataContext.item = b;
            c.dataContext.c = a;
        }
        return c;
    };
    ShapeSeriesViewBase.cy = function (a, b, c) {
        if (b._fill == null) {
            b._fill = a.f.vj;
        }
        if (b._stroke == null) {
            b._stroke = a.f.vn;
        }
        if (b.y == null) {
            b.ad = a.f.ig;
        }
    };
    ShapeSeriesViewBase.prototype.c2 = function (a) {
        for (var b = 0; b < this.cm.a.count; b++) {
            var c = this.cm.a._inner[b];
            a(c);
        }
    };
    ShapeSeriesViewBase.prototype.cz = function (a, b, c) {
        if (a == null) {
            return;
        }
        this.c1(a, c);
        var d = false;
        if (this.ck != null) {
            var e = this.ck.selectStyle(b, a);
            if (e != null) {
                d = true;
            }
            if (a.y != e) {
                a.y = e;
                this.m.j(a, a.y);
            }
        }
        if (!d) {
            if (a.y != this.dl) {
                a.y = this.dl;
                this.m.j(a, a.y);
            }
        }
        var f = this.cj.aag(b, a, a.y);
        if (a.y != f) {
            a.y = f;
            this.m.j(a, a.y);
        }
    };
    ShapeSeriesViewBase.prototype.c1 = function (a, b) {
    };
    ShapeSeriesViewBase.prototype.cw = function (a, b) {
        var c = truncate(Math.floor(a.left));
        var d = truncate(Math.ceil(a.right));
        var e = truncate(Math.floor(a.top));
        var f = truncate(Math.ceil(a.bottom));
        for (var g = c; g < d; g++) {
            for (var h = e; h < f; h++) {
                this.da(g, h, b);
            }
        }
    };
    ShapeSeriesViewBase.prototype.da = function (a, b, c) {
    };
    ShapeSeriesViewBase.prototype.c7 = function () {
        this.cu = 0;
    };
    ShapeSeriesViewBase.prototype.c6 = function () {
        this.cm.count = this.cu;
        this.a2();
    };
    ShapeSeriesViewBase.prototype.c9 = function (a, b) {
    };
    ShapeSeriesViewBase.prototype.c0 = function () {
        this.cm.count = 0;
        this.a2();
    };
    ShapeSeriesViewBase.prototype.de = function () {
        var a = this.cj;
        var b = ((function () {
            var $ret = new Path();
            $ret.dataContext = ((function () {
                var $ret = new DataContext();
                $ret.series = a;
                return $ret;
            })());
            return $ret;
        })());
        this.ct.add(b);
        return b;
    };
    ShapeSeriesViewBase.prototype.c3 = function (a) {
        a._visibility = 0;
    };
    ShapeSeriesViewBase.prototype.c4 = function (a) {
        a.dataContext.item = null;
        a._visibility = 1;
    };
    ShapeSeriesViewBase.prototype.c5 = function (a) {
        this.ct.remove(a);
    };
    ShapeSeriesViewBase.prototype.dj = function (a, b, c) {
        if (b == null) {
            return null;
        }
        var d = new PathGeometry();
        var e;
        var f = b.count;
        for (var g = 0; g < f; g++) {
            e = b._inner[g];
            if (e.count < 1) {
                continue;
            }
            var h = new PolyLineSegment();
            h._points = e;
            var i = new PathFigure();
            i._isFilled = c;
            i._isClosed = c;
            i._startPoint = e._inner[0];
            i._segments.add(h);
            d.c.add(i);
        }
        return d;
    };
    ShapeSeriesViewBase.prototype.ak = function (a) {
        return this.ct._inner[a];
    };
    ShapeSeriesViewBase.prototype.aj = function (a) {
        var b = this.ct._inner[a];
        this.dk._visibility = b._visibility;
        this.dk.an = b.an;
        var c = this.b4(a);
        this.dk._fill = c;
        this.dk._stroke = c;
        this.dk.ad = this.f.ig + 3;
        return this.dk;
    };
    ShapeSeriesViewBase.prototype.bj = function (a, b) {
        _super.prototype.bj.call(this, a, b);
        for (var c = 0; c < this.ct.count; c++) {
            var d = this.ai(c, b);
            if (d._visibility != 1) {
                a.t(d);
            }
        }
    };
    Object.defineProperty(ShapeSeriesViewBase.prototype, "dm", {
        get: function () {
            return this.dl;
        },
        enumerable: false,
        configurable: true
    });
    ShapeSeriesViewBase.prototype.dc = function (a) {
        this.ck = a;
    };
    ShapeSeriesViewBase.prototype.db = function (a) {
        this.dl = a;
    };
    ShapeSeriesViewBase.prototype.df = function (a, b) {
        return this.dg(a, b, false);
    };
    ShapeSeriesViewBase.prototype.dg = function (a, b, c) {
        var d = this.ci(a, b, c);
        if (d == null) {
            return null;
        }
        return d.c;
    };
    ShapeSeriesViewBase.prototype.ci = function (a, b, c) {
        if (this.cq.count == 0) {
            return null;
        }
        var d = a.x;
        var e = a.y;
        var f = this.cq.count;
        var g = this.cq;
        var h = null;
        for (var i = 0; i < f; i++) {
            h = g._inner[i];
            if (h.a == null || h.a.count == 0) {
                continue;
            }
            if (d >= h.d.left && d <= h.d.right && e >= h.d.top && e <= h.d.bottom) {
                if (c) {
                    var j = this.cj.ig / 2 + this.cj.iw(b);
                    if (GeometryUtil.e(a, h.a._inner[0], h.a, j)) {
                        return h;
                    }
                }
                else {
                    if (PolygonUtil.b(h.a, a)) {
                        return h;
                    }
                }
            }
        }
        return null;
    };
    ShapeSeriesViewBase.prototype.c8 = function (a, b, c, d) {
        this.ce = a;
        this.cg = b;
        this.cf = c;
        this.cd = d;
        this.cq.clear();
    };
    ShapeSeriesViewBase.prototype.dd = function () {
        var _this = this;
        var a = this.b9;
        var b = ((function () {
            var $ret = new Path();
            $ret.y = _this.dl;
            return $ret;
        })());
        b.ad = 1;
        if (this.m != null) {
            this.m.j(b, b.y);
        }
        this.cj.aae = RectUtil.r(a, b.ad);
    };
    ShapeSeriesViewBase.prototype.ax = function (a) {
        _super.prototype.ax.call(this, a);
        if (this.cm.a == null) {
            return;
        }
        for (var b = 0; b < this.cm.a.count; b++) {
            var c = typeCast(Path.$, this.cm.a._inner[b]);
            if (c._visibility != 1) {
                this.f.bc.exportPathData(a, c, "shape" + b, ["Main "]);
            }
        }
    };
    ShapeSeriesViewBase.$t = markType(ShapeSeriesViewBase, 'ShapeSeriesViewBase', SeriesView.$);
    return ShapeSeriesViewBase;
}(SeriesView));
export { ShapeSeriesViewBase };
