UNPKG

igniteui-angular-gauges

Version:

Ignite UI Angular gauge components.

2,385 lines 83 kB
/*
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 { Control } from "igniteui-angular-core";
import { INotifyPropertyChanged_$type, Base, PropertyChangedEventArgs, runOn, delegateCombine, enumGetBox, Number_$type, String_$type, Array_$type, Point_$type, delegateRemove, fromEn, markType, markDep, typeCast, fromEnum, TypeRegistrar } from "igniteui-angular-core";
import { DoubleAnimator } from "igniteui-angular-core";
import { LinearGaugeFrame } from "./LinearGaugeFrame";
import { LinearGraphScaler } from "./LinearGraphScaler";
import { LinearScaleOrientation_$type } from "./LinearScaleOrientation";
import { DependencyProperty } from "igniteui-angular-core";
import { LinearGraphRangeCollection } from "./LinearGraphRangeCollection";
import { BrushCollection } from "igniteui-angular-core";
import { LinearGraphNeedleShape_$type } from "./LinearGraphNeedleShape";
import { Brush } from "igniteui-angular-core";
import { BindingFormatter } from "igniteui-angular-core";
import { HighlightedValueDisplayMode_$type } from "igniteui-angular-core";
import { StackPool$1 } from "igniteui-angular-core";
import { Path } from "igniteui-angular-core";
import { TextBlock } from "igniteui-angular-core";
import { Rect } from "igniteui-angular-core";
import { List$1 } from "igniteui-angular-core";
import { FormatLinearGraphLabelEventArgs } from "./FormatLinearGraphLabelEventArgs";
import { AlignLinearGraphLabelEventArgs } from "./AlignLinearGraphLabelEventArgs";
import { DoubleValueChangedEventArgs } from "igniteui-angular-core";
import { PolygonUtil } from "igniteui-angular-core";
import { LinearGaugeVisualData } from "./LinearGaugeVisualData";
import { ToolTipInfo } from "./ToolTipInfo";
import { RectData } from "igniteui-angular-core";
import { LinearGraphScaleLabelVisualDataList } from "./LinearGraphScaleLabelVisualDataList";
import { LinearGraphScaleTickmarkVisualDataList } from "./LinearGraphScaleTickmarkVisualDataList";
import { LinearGraphRangeVisualDataList } from "./LinearGraphRangeVisualDataList";
import { LinearNeedleVisualData } from "./LinearNeedleVisualData";
import { LinearGraphRangeVisualData } from "./LinearGraphRangeVisualData";
import { LinearGraphToolTipVisualData } from "./LinearGraphToolTipVisualData";
import { LinearGraphTooltipDataContext } from "./LinearGraphTooltipDataContext";
import { AppearanceHelper } from "igniteui-angular-core";
import { PointData } from "igniteui-angular-core";
import { PathVisualData } from "igniteui-angular-core";
import { GetPointsSettings } from "igniteui-angular-core";
import { LinearGraphRectFrame } from "./LinearGraphRectFrame";
import { Size } from "igniteui-angular-core";
import { Tuple$2 } from "igniteui-angular-core";
import { LinearGraphNeedleParameters } from "./LinearGraphNeedleParameters";
import { LinearGraphNeedleFrame } from "./LinearGraphNeedleFrame";
import { BrushUtil } from "igniteui-angular-core";
import { LinearGraphNeedlePreparer } from "./LinearGraphNeedlePreparer";
import { PathGeometry } from "igniteui-angular-core";
import { PathFigure } from "igniteui-angular-core";
import { LineSegment } from "igniteui-angular-core";
import { DeviceUtils } from "igniteui-angular-core";
import { FontUtil } from "igniteui-angular-core";
import { PropertyMetadata } from "igniteui-angular-core";
import { isNaN_, isInfinity, intDivide, truncate } from "igniteui-angular-core";
import { EventProxy } from "igniteui-angular-core";
import { RenderingContext } from "igniteui-angular-core";
import { Dictionary$2 } from "igniteui-angular-core";
import { CanvasViewRenderer } from "igniteui-angular-core";
import { CanvasGestureDOMEventProxy } from "igniteui-angular-core";
import { LinearGraphScaleLabelVisualData } from "./LinearGraphScaleLabelVisualData";
import { LinearGraphScaleTickmarkVisualData } from "./LinearGraphScaleTickmarkVisualData";
import { SizeData } from "igniteui-angular-core";
import { arrayCopy1 } from "igniteui-angular-core";
import { stringIsNullOrEmpty } from "igniteui-angular-core";
/**
 * @hidden
 */
var XamLinearGauge = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(XamLinearGauge, _super);
    function XamLinearGauge() {
        var _this = _super.call(this) || this;
        _this.propertyChanged = null;
        _this.av = null;
        _this.b0 = 0;
        _this.formatLabel = null;
        _this.alignLabel = null;
        _this.valueChanged = null;
        _this.highlightValueChanged = null;
        _this.ao = null;
        _this.an = null;
        _this.am = null;
        _this.ar = null;
        _this.bx = 0;
        _this.bw = 100;
        _this.a3 = 0;
        _this.aj = null;
        _this.a2 = 0;
        _this.bv = 0.5;
        _this.az = 1;
        _this.bm = false;
        _this.a7 = null;
        _this.a5 = null;
        _this.a4 = null;
        _this.a8 = null;
        _this.a6 = null;
        _this.bt = null;
        _this.ix = null;
        _this.bs = null;
        _this.iw = null;
        _this._view = null;
        _this.iz = null;
        _this.iy = null;
        _this.iv = null;
        _this.bo = new List$1(TextBlock.$, 0);
        _this.br = new List$1(TextBlock.$, 0);
        _this.bq = new List$1(Path.$, 0);
        _this.bp = new List$1(Path.$, 0);
        _this.bc = false;
        _this.bz = NaN;
        _this.by = 1;
        _this.bz = NaN;
        _this.by = 1;
        _this.view = new XamLinearGaugeView(_this);
        _this.view.bc();
        _this.iz = Rect.empty;
        _this.iy = Rect.empty;
        _this.iv = Rect.empty;
        _this.ao = new LinearGaugeFrame();
        _this.an = new LinearGaugeFrame();
        _this.am = new LinearGaugeFrame();
        _this.ranges = new LinearGraphRangeCollection();
        _this.bc = true;
        _this.av = new DoubleAnimator(0, 1, _this.dh);
        var a = _this.av;
        a.propertyChanged = delegateCombine(a.propertyChanged, runOn(_this, _this.fl));
        _this.ab = XamLinearGauge.$;
        _this.a6 = ((function () {
            var $ret = new StackPool$1(Path.$);
            $ret.b = runOn(_this.view, _this.view.bm);
            $ret.c = runOn(_this.view, _this.view.bn);
            $ret.d = runOn(_this.view, _this.view.bo);
            $ret.j = runOn(_this.view, _this.view.cq);
            return $ret;
        })());
        _this.a7 = ((function () {
            var $ret = new StackPool$1(Path.$);
            $ret.b = runOn(_this.view, _this.view.bf);
            $ret.c = runOn(_this.view, _this.view.bg);
            $ret.d = runOn(_this.view, _this.view.bh);
            $ret.j = runOn(_this.view, _this.view.cp);
            return $ret;
        })());
        _this.a5 = ((function () {
            var $ret = new StackPool$1(Path.$);
            $ret.b = runOn(_this.view, _this.view.bf);
            $ret.c = runOn(_this.view, _this.view.bg);
            $ret.d = runOn(_this.view, _this.view.bh);
            $ret.j = runOn(_this.view, _this.view.cp);
            return $ret;
        })());
        _this.a4 = ((function () {
            var $ret = new StackPool$1(TextBlock.$);
            $ret.b = runOn(_this.view, _this.view.a4);
            $ret.c = runOn(_this.view, _this.view.a5);
            $ret.d = runOn(_this.view, _this.view.a6);
            $ret.j = runOn(_this.view, _this.view.b3);
            return $ret;
        })());
        _this.a8 = ((function () {
            var $ret = new StackPool$1(TextBlock.$);
            $ret.b = runOn(_this.view, _this.view.bw);
            $ret.c = runOn(_this.view, _this.view.bx);
            $ret.d = runOn(_this.view, _this.view.by);
            $ret.j = runOn(_this.view, _this.view.b4);
            return $ret;
        })());
        return _this;
    }
    XamLinearGauge.prototype.f2 = function (a) {
        this.f9(a);
    };
    XamLinearGauge.prototype.f9 = function (a) {
        var b = this.propertyChanged;
        if (b != null) {
            b(this, new PropertyChangedEventArgs(a));
        }
    };
    XamLinearGauge.prototype.fl = function (a, b) {
        this.dc = this.av.o;
    };
    Object.defineProperty(XamLinearGauge.prototype, "a9", {
        get: function () {
            return this.av.f();
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(XamLinearGauge.prototype, "dc", {
        get: function () {
            return this.b0;
        },
        set: function (a) {
            var b = this.b0;
            this.b0 = a;
            this.f1("TransitionProgress", b, this.b0);
        },
        enumerable: false,
        configurable: true
    });
    XamLinearGauge.prototype.gl = function () {
        this.b0 = 0;
        this.av.w();
        this.av.v();
    };
    Object.defineProperty(XamLinearGauge.prototype, "bl", {
        get: function () {
            return this.dh > 0;
        },
        enumerable: false,
        configurable: true
    });
    XamLinearGauge.prototype.onDetachedFromUI = function () {
        this.view.bb();
    };
    XamLinearGauge.prototype.onAttachedToUI = function () {
        this.view.a7();
    };
    Object.defineProperty(XamLinearGauge.prototype, "b3", {
        get: function () {
            return this.bx;
        },
        set: function (a) {
            this.bx = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(XamLinearGauge.prototype, "b2", {
        get: function () {
            return this.bw;
        },
        set: function (a) {
            this.bw = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(XamLinearGauge.prototype, "b1", {
        get: function () {
            return this.bv;
        },
        set: function (a) {
            var b = this.bv;
            this.bv = a;
            if (b != this.bv) {
                this.f1("ActualHighlightValueOpacity", b, a);
            }
        },
        enumerable: false,
        configurable: true
    });
    XamLinearGauge.prototype.go = function () {
        this.b1 = isNaN_(this.ca) ? 0.5 : Math.max(0, Math.min(this.ca, 1));
    };
    Object.defineProperty(XamLinearGauge.prototype, "a0", {
        get: function () {
            return this.az;
        },
        set: function (a) {
            this.az = a;
        },
        enumerable: false,
        configurable: true
    });
    XamLinearGauge.prototype.gn = function () {
        if (this.a1 != 1) {
            if (isNaN_(this.b9) || isInfinity(this.b9)) {
                this.a0 = 1;
            }
            else {
                this.a0 = 2;
            }
        }
        else {
            this.a0 = 1;
        }
    };
    XamLinearGauge.prototype.fr = function () {
        this.a2 = 0;
        this.view.cm().an = null;
    };
    XamLinearGauge.prototype.b8 = function (a) {
        var b = 0;
        var c = a.x;
        if (this.as == 1) {
            b = a.y;
            c = this.i2.height;
        }
        return this.ar.k(c - b);
    };
    XamLinearGauge.prototype.bj = function (a) {
        if (this.bt == null) {
            return false;
        }
        return PolygonUtil.b(this.bt, a);
    };
    XamLinearGauge.prototype.ba = function (a) {
        if (this.bs == null) {
            return false;
        }
        return PolygonUtil.b(this.bs, a);
    };
    XamLinearGauge.prototype.needleContainsPoint = function (a, b) {
        if (this.bt == null) {
            return false;
        }
        return b ? this.ix.containsPoint(a) : PolygonUtil.b(this.bt, a);
    };
    XamLinearGauge.prototype.highlightNeedleContainsPoint = function (a, b) {
        if (this.bs == null) {
            return false;
        }
        return b ? this.iw.containsPoint(a) : PolygonUtil.b(this.bs, a);
    };
    XamLinearGauge.prototype.fp = function (a, b) {
        var c = this.b8(a);
        c = Math.max(Math.min(c, this.b2), this.b3);
        var d = this.a3 == 2;
        if (d) {
            if (c != this.b9) {
                this.b9 = c;
            }
        }
        else {
            if (c != this.dd) {
                this.dd = c;
            }
        }
    };
    XamLinearGauge.prototype.at = function () {
        var _this = this;
        var a = new LinearGaugeVisualData();
        a.viewport = new RectData(this.i2.left, this.i2.top, this.i2.width, this.i2.height);
        a.scaleLabels = new LinearGraphScaleLabelVisualDataList();
        a.scaleTickmarks = new LinearGraphScaleTickmarkVisualDataList();
        a.ranges = new LinearGraphRangeVisualDataList();
        a.needle = ((function () {
            var $ret = new LinearNeedleVisualData();
            $ret.value = _this.dd;
            return $ret;
        })());
        a.highlightNeedle = ((function () {
            var $ret = new LinearNeedleVisualData();
            $ret.value = _this.b9;
            return $ret;
        })());
        this.view.az(a);
        var b = this.view.l();
        if (b != null) {
            var c_1 = null;
            switch (b.c) {
                case "range":
                    c_1 = a.ranges._inner[b.b];
                    break;
                case "needle":
                    c_1 = a.needle;
                    break;
            }
            a.toolTip = ((function () {
                var $ret = new LinearGraphToolTipVisualData();
                $ret.item = c_1;
                $ret.itemBrush = AppearanceHelper.b(b.a.brush);
                $ret.outline = AppearanceHelper.b(b.a.outline);
                $ret.thickness = b.a.thickness;
                return $ret;
            })());
        }
        return a;
    };
    XamLinearGauge.prototype.dr = function () {
        var a = this.at();
        a.scaleByViewport();
        return a.serialize();
    };
    XamLinearGauge.prototype.fq = function () {
        this.view.flush();
    };
    XamLinearGauge.prototype.destroy = function () {
        this.provideContainer(null);
    };
    XamLinearGauge.prototype.provideContainer = function (a) {
        this.view.a9(a);
    };
    XamLinearGauge.prototype.onMouseOver = function (a, b, c) {
        if (this.bm) {
            this.gk(a, null);
        }
    };
    XamLinearGauge.prototype.onMouseLeave = function () {
        if (this.bm) {
            this.gk({ $type: Point_$type, x: -10000, y: -10000 }, null);
        }
    };
    XamLinearGauge.prototype.onMouseMove = function (a, b) {
        if (this.a3 != 0) {
            this.fp(a, b);
        }
    };
    XamLinearGauge.prototype.onMouseDown = function (a, b) {
        if (this.bf && this.a3 == 0 && this.needleContainsPoint(a, b)) {
            this.a3 = 1;
        }
        if (this.be && this.a3 == 0 && this.highlightNeedleContainsPoint(a, b)) {
            this.a3 = 2;
        }
    };
    Object.defineProperty(XamLinearGauge.prototype, "bd", {
        get: function () {
            return this.a3 != 0;
        },
        enumerable: false,
        configurable: true
    });
    XamLinearGauge.prototype.onMouseUp = function (a) {
        if (this.a3 != 0) {
            this.a3 = 0;
        }
    };
    XamLinearGauge.prototype.containerResized = function () {
        this.view.ba();
    };
    XamLinearGauge.prototype.gm = function () {
        this.view.bv();
    };
    XamLinearGauge.prototype.gk = function (a, b) {
        var c = this.bt;
        if (c != null && c.count > 0) {
            var d = PolygonUtil.b(c, a);
            if (d == true) {
                this.view.bu(a, b, -1, "needle");
                return;
            }
        }
        for (var e = 0; e < this.bp.count; e++) {
            var f = new PathVisualData(1, "range", this.bp._inner[e]);
            var g = f.getPoints(new GetPointsSettings());
            if (g.count > 0) {
                var h = PolygonUtil.b(this.bu(g._inner[0]), a);
                if (h == true) {
                    this.view.bu(a, b, e, "range");
                    return;
                }
            }
        }
        this.view.a2();
    };
    XamLinearGauge.prototype.ge = function () {
        if (!this.bc) {
            return;
        }
        var a = this.an.c;
        if (this.as == 0) {
            var b = 0;
            for (var c = 0; c < a.c.length; c++) {
                b = Math.max(b, a.c[c]);
            }
            var d = this.i2.height >= b ? this.i2.height - b : this.i2.height;
            this.i1 = new Rect(0, 0, 0, this.i2.width, d);
        }
        else {
            var e = 0;
            for (var f = 0; f < a.f.length; f++) {
                e = Math.max(e, a.f[f]);
            }
            var g = this.i2.width >= e ? this.i2.width - e : this.i2.width;
            this.i1 = new Rect(0, e, 0, g, this.i2.height);
        }
    };
    Object.defineProperty(XamLinearGauge.prototype, "view", {
        get: function () {
            return this._view;
        },
        set: function (a) {
            this._view = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(XamLinearGauge.prototype, "i2", {
        get: function () {
            return this.iz;
        },
        set: function (a) {
            var b = this.iz;
            this.iz = a;
            if (!b.equals1(this.iz)) {
                this.f3(b, this.iz);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(XamLinearGauge.prototype, "i1", {
        get: function () {
            return this.iy;
        },
        set: function (a) {
            this.iy = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(XamLinearGauge.prototype, "i0", {
        get: function () {
            return this.iv;
        },
        set: function (a) {
            this.iv = a;
        },
        enumerable: false,
        configurable: true
    });
    XamLinearGauge.prototype.bh = function () {
        return !isNaN_(this.b3) && !isNaN_(this.b2) && !this.i2.isEmpty && this.view.s();
    };
    XamLinearGauge.prototype.fm = function () {
        if (!this.bh()) {
            return;
        }
        var a = this.c4();
        this.ar = new LinearGraphScaler(this.b3, this.b2, a, a + this.c2(), this.bg);
        if (this.bc) {
            if (this.a9) {
                if (this.av.g) {
                    this.av.t();
                }
                var b = this.ao;
                this.ao = this.am;
                this.am = b;
            }
            else {
                var c = this.ao;
                this.ao = this.an;
                this.an = c;
            }
        }
        else if (this.a9) {
            this.am.d(this.dc, this.ao, this.an);
            this.gf(this.am);
            this.gi(this.am);
            this.gh(this.am, this.am.c.af, true);
            this.gh(this.am, this.am.c.ag, false);
        }
        if (this.bc) {
            this.f5();
            this.ge();
            if (this.a2 == 1) {
                this.a2 = 2;
                this.f7(this.ar.i(this.dd), this.ao.c, false, true);
            }
            else if (this.a2 == 4) {
                if (this.dh > 0) {
                    this.a2 = 5;
                    this.f7(this.ar.i(this.dd), this.an.c, false, true);
                }
                else {
                    this.fr();
                }
            }
            this.f6();
            this.f8();
            this.f4();
        }
        if (this.bc && this.bl) {
            this.gl();
            this.am.d(this.dc, this.ao, this.an);
            this.gf(this.am);
            this.gi(this.am);
            this.gh(this.am, this.am.c.af, true);
            this.gh(this.am, this.am.c.ag, false);
            this.gj(this.am);
            this.gg(this.am);
        }
        else {
            if (this.bc) {
                this.gf(this.an);
                this.gi(this.an);
                this.gh(this.an, this.an.c.af, true);
                this.gh(this.an, this.an.c.ag, false);
                this.gj(this.an);
                this.gg(this.an);
            }
        }
        this.bc = false;
        this.view.as();
    };
    XamLinearGauge.prototype.f8 = function () {
        var a = this.an;
        var b = a.c;
        var c = this.ar;
        var d = this.ci;
        var e = this.i1;
        b.u = this.c5;
        b.r = this.c0;
        b.s = this.c1;
        b.t = this.c3;
        b.m.clear();
        for (var f = 0; f < this.ranges.count; f++) {
            var g = this.ranges._inner[f];
            if (g.j <= this.b3 || g.o > this.b2) {
                continue;
            }
            var h = g.o;
            var i = g.j;
            if (h < this.b3) {
                h = this.b3;
            }
            if (i > this.b2) {
                i = this.b2;
            }
            var j = new LinearGraphRectFrame();
            j.i = g.an != null ? g.an : this.im(f, this.ah);
            j.j = g.ao != null ? g.ao : this.im(f, this.ai);
            j.h = g.p;
            j.g = c.i(h);
            j.d = c.i(i);
            j.e = g.l;
            j.b = g.k;
            j.f = g.n;
            j.c = g.m;
            if (isNaN_(j.e)) {
                j.e = this.cx;
            }
            j.b = g.k;
            if (isNaN_(j.b)) {
                j.b = this.cx;
            }
            j.f = g.n;
            if (isNaN_(j.f)) {
                j.f = this.cy;
            }
            j.c = g.m;
            if (isNaN_(j.c)) {
                j.c = this.cy;
            }
            b.m.add(j);
        }
        b.ab = this.il;
        b.ad = this.it;
        b.x = this.db;
        b.w = this.da;
        b.v = this.c7;
        b.ac = this.io;
        b.q = this.cl;
        b.p = this.ck;
        b.o = this.cj;
        var k = this.cb;
        if (isNaN_(k)) {
            k = (this.b2 - this.b3) / 10;
        }
        if (k == 0) {
            k = this.b2 - this.b3;
        }
        var l = new List$1(Number_$type, 0);
        var m = new List$1(Number_$type, 0);
        if (k > 0) {
            var n = this.b3 + this.c8;
            var o = this.b2 - this.c9;
            var p = 100000;
            var q = Math.abs(o - n) / p;
            if (k >= q) {
                for (var r = n; r <= o || this.bn(r, o, k); r = r + k) {
                    l.add(c.i(r));
                    for (var s = 0; s < d; s++) {
                        var t = (k / (d + 1)) * (s + 1);
                        if (t + r > o) {
                            continue;
                        }
                        m.add(c.i(t + r));
                    }
                }
            }
        }
        if (b.j.length != l.count || b.i.length != m.count) {
            b.j = new Array(l.count);
            b.i = new Array(m.count);
        }
        for (var u = 0; u < l.count; u++) {
            b.j[u] = l._inner[u];
        }
        for (var v = 0; v < m.count; v++) {
            b.i[v] = m._inner[v];
        }
    };
    XamLinearGauge.prototype.i3 = function () {
        var a = this.cb;
        var b = this.cd;
        if (isNaN_(a)) {
            a = (this.b2 - this.b3) / 10;
        }
        if (isNaN_(b)) {
            b = a;
        }
        if (b == 0) {
            b = this.b2 - this.b3;
        }
        var c = new List$1(Number_$type, 0);
        if (b > 0) {
            var d = this.ce + this.b3;
            var e = this.b2 - this.cf;
            var f = 100000;
            var g = Math.abs(e - d) / f;
            if (b >= g) {
                for (var h = d; h <= e || this.bn(h, e, a); h += b) {
                    c.add(h);
                }
            }
        }
        var i = new Array(c.count);
        var j = new Array(c.count);
        var _loop_1 = function (k) {
            var l = c._inner[k];
            if (this_1.formatLabel == null && this_1.aj == null) {
                l = (Math.round(l * 100) / 100);
            }
            var m = l.toString();
            if (this_1.aj != null) {
                m = this_1.aj.i(l);
            }
            var n = new FormatLinearGraphLabelEventArgs();
            n.value = l;
            n.label = m;
            if (this_1.formatLabel != null) {
                this_1.formatLabel(this_1, n);
            }
            m = n.label;
            var o = this_1.view.cr(((function () {
                var $ret = new TextBlock();
                $ret.al = m;
                return $ret;
            })()));
            i[k] = o.width;
            j[k] = o.height;
        };
        var this_1 = this;
        for (var k = 0; k < c.count; k++) {
            _loop_1(k);
        }
        var p = 0;
        var q = 0;
        var r = 1 - this.c0 + this.c5;
        if (this.as == 0) {
            for (var s = 0; s < j.length; s++) {
                q = Math.max(q, j[s]);
            }
            for (var t = 0; t < i.length; t++) {
                p += i[t];
            }
            if (i.length > 0) {
                p += i[0] / 2;
            }
            if (i.length > 1) {
                p += i[i.length - 1] / 2;
            }
            if (i.length > 0) {
                p += (i.length - 1) * 5;
            }
            if (r > 0) {
                p = p / Math.abs(1 - r);
            }
        }
        else {
            for (var u = 0; u < i.length; u++) {
                p = Math.max(p, i[u]);
            }
            for (var v = 0; v < j.length; v++) {
                q += j[v];
            }
            if (j.length > 0) {
                q -= j[0] / 2;
            }
            if (j.length > 1) {
                q -= j[j.length - 1] / 2;
            }
            if (r > 0) {
                q = q / Math.abs(1 - r);
            }
            if (j.length > 0) {
                q += (j.length - 1) * 5;
            }
        }
        return new Size(1, p, q);
    };
    XamLinearGauge.prototype.f5 = function () {
        var a = this.an;
        var b = a.c;
        var c = this.ar;
        var d = this.cb;
        var e = this.cd;
        var f = this.ci;
        if (isNaN_(d)) {
            d = (this.b2 - this.b3) / 10;
        }
        if (isNaN_(e)) {
            e = d;
        }
        if (e == 0) {
            e = this.b2 - this.b3;
        }
        var g = new List$1(Tuple$2.$.specialize(Number_$type, Number_$type), 0);
        if (e > 0) {
            var h = this.ce + this.b3;
            var i = this.b2 - this.cf;
            var j = 100000;
            var k = Math.abs(i - h) / j;
            if (e >= k) {
                for (var l = h; l <= i || this.bn(l, i, e); l = l + e) {
                    g.add(new Tuple$2(Number_$type, Number_$type, l, c.i(l)));
                }
            }
        }
        if (b.d.length != g.count) {
            b.e = new Array(g.count);
            b.d = new Array(g.count);
            b.f = new Array(g.count);
            b.c = new Array(g.count);
            b.g = new Array(g.count);
            b.h = new Array(g.count);
        }
        b.n = this.cc;
        var m = new FormatLinearGraphLabelEventArgs();
        m.actualMinimumValue = this.b3;
        m.actualMaximumValue = this.b2;
        var n = new AlignLinearGraphLabelEventArgs();
        n.actualMinimumValue = this.b3;
        n.actualMaximumValue = this.b2;
        var _loop_2 = function (o) {
            var p = g._inner[o].c;
            if (this_2.formatLabel == null) {
                p = (Math.round(p * 100) / 100);
            }
            var q = (p).toString();
            if (this_2.aj != null) {
                q = this_2.aj.i(p);
            }
            m.value = p;
            n.value = p;
            m.label = q;
            if (this_2.formatLabel != null) {
                this_2.formatLabel(this_2, m);
            }
            q = m.label;
            n.label = q;
            var r = this_2.view.cr(((function () {
                var $ret = new TextBlock();
                $ret.al = q;
                return $ret;
            })()));
            n.width = r.width;
            n.height = r.height;
            if (this_2.as == 0) {
                n.offsetX = -1 * (r.width / 2);
                n.offsetY = -1 * (r.height);
            }
            else {
                n.offsetX = -1 * r.width;
                n.offsetY = -1 * (r.height / 2);
            }
            if (this_2.alignLabel != null) {
                this_2.alignLabel(this_2, n);
            }
            b.f[o] = n.width;
            b.c[o] = n.height;
            b.g[o] = n.offsetX;
            b.h[o] = n.offsetY;
            b.d[o] = q;
            b.e[o] = g._inner[o].d;
        };
        var this_2 = this;
        for (var o = 0; o < g.count; o++) {
            _loop_2(o);
        }
    };
    XamLinearGauge.prototype.bn = function (a, b, c) {
        var d = c / 10000;
        if (isNaN_(d)) {
            d = 1E-05;
        }
        var e = Math.abs(a - b);
        if (e < d) {
            return true;
        }
        return false;
    };
    XamLinearGauge.prototype.f4 = function () {
        var a = this.an;
        var b = a.a;
        b.e = this.ij;
        b.f = this.ik;
        b.c = this.b7;
        b.a = this.b5;
        b.b = this.b6;
    };
    XamLinearGauge.prototype.f6 = function () {
        var a = this.dd;
        if (isNaN_(a)) {
            return;
        }
        var b = !(this.a2 == 0 || this.a2 == 5);
        var c = this.an.c;
        var d = this.ar;
        var e = d.i(a);
        this.f7(e, c, b, false);
        var f = this.b9;
        if (b && !isNaN_(f)) {
            this.f7(d.i(f), c, false, true);
        }
    };
    XamLinearGauge.prototype.f7 = function (a, b, c, d) {
        var e = new LinearGraphNeedleParameters();
        e.c = this.ap;
        e.e = this.bg;
        e.d = this.as;
        e.u = this.cs;
        e.q = this.co;
        e.v = this.ct;
        e.r = this.cp;
        e.t = this.cr;
        e.p = this.cn;
        e.s = this.cq;
        e.w = this.cu;
        e.o = this.cm * 0.5 / this.cz();
        var f = new LinearGraphNeedleFrame();
        var g = this.ip;
        var h = this.iq;
        if (c) {
            g = BrushUtil.s(g, this.b1);
            h = BrushUtil.s(h, this.b1);
        }
        f.r = g;
        f.s = h;
        f.o = this.cv;
        var i = new LinearGraphNeedlePreparer();
        i.b = e;
        i.c(f);
        f.l = -90;
        f.p = a;
        if (d) {
            b.af = f;
        }
        else {
            b.ag = f;
        }
    };
    XamLinearGauge.prototype.im = function (a, b) {
        if (b != null && b.count > 0) {
            return b.item(a % b.count);
        }
        else {
            return null;
        }
    };
    XamLinearGauge.prototype.gj = function (a) {
        var b = this.i1;
        var c = a.c;
        var d = this.a7;
        var e = c.j;
        var f = c.w;
        var g = c.v;
        var h = c.ad;
        var i = c.x;
        var j = this.a5;
        var k = c.i;
        var l = c.p;
        var m = c.o;
        var n = c.ac;
        var o = c.q;
        d.f = true;
        for (var p = 0; p < this.bq.count; p++) {
            d.n(this.bq._inner[p]);
        }
        this.bq.clear();
        var q = this.cz();
        var r = this.df();
        var _loop_3 = function (s) {
            var t = void 0, u = void 0, v, w;
            if (this_3.as == 1) {
                t = b.left + q * f;
                u = r - e[s];
                v = b.left + q * g;
                w = u;
            }
            else {
                t = b.left + e[s];
                u = q * (1 - f);
                v = t;
                w = q * (1 - g);
            }
            var x = d.a();
            var y = new PathGeometry();
            var z = new PathFigure();
            z._startPoint = { $type: Point_$type, x: t, y: u };
            z._segments.add(((function () {
                var $ret = new LineSegment(1);
                $ret.c = { $type: Point_$type, x: v, y: w };
                return $ret;
            })()));
            y.c.add(z);
            x.an = y;
            x._stroke = h;
            x.ad = i;
            this_3.bq.add(x);
        };
        var this_3 = this;
        for (var s = 0; s < e.length; s++) {
            _loop_3(s);
        }
        var _loop_4 = function (aa) {
            var ab = void 0, ac = void 0, ad, ae;
            if (this_4.as == 1) {
                ab = b.left + q * l;
                ac = r - k[aa];
                ad = b.left + q * m;
                ae = ac;
            }
            else {
                ab = k[aa];
                ac = q * (1 - l);
                ad = ab;
                ae = q * (1 - m);
            }
            var af = d.a();
            var ag = new PathGeometry();
            var ah = new PathFigure();
            ah._startPoint = { $type: Point_$type, x: ab, y: ac };
            ah._segments.add(((function () {
                var $ret = new LineSegment(1);
                $ret.c = { $type: Point_$type, x: ad, y: ae };
                return $ret;
            })()));
            ag.c.add(ah);
            af.an = ag;
            af._stroke = n;
            af.ad = o;
            this_4.bq.add(af);
        };
        var this_4 = this;
        for (var aa = 0; aa < k.length; aa++) {
            _loop_4(aa);
        }
        d.f = false;
    };
    XamLinearGauge.prototype.gg = function (a) {
        var b = this.i1;
        var c = a.c;
        var d = c.e;
        var e = c.d;
        var f = c.g;
        var g = c.h;
        var h = c.f;
        var i = c.c;
        var j = c.n;
        var k = this.a4;
        k.f = true;
        for (var l = 0; l < this.bo.count; l++) {
            k.n(this.bo._inner[l]);
        }
        this.bo.clear();
        var m = c.ab;
        var n = this.de();
        var o = this.df();
        for (var p = 0; p < e.length; p++) {
            var q = void 0, r = void 0;
            if (this.as == 1) {
                q = b.left + n * j;
                r = b.top + o - d[p];
            }
            else {
                q = b.left + d[p];
                r = b.top + n * (1 - j);
            }
            var s = k.a();
            s.al = e[p];
            this.view.bt(s, m);
            var t = h[p];
            var u = i[p];
            var v = f[p];
            var w = g[p];
            this.view.bk(s, q + v, r + w);
            this.bo.add(s);
        }
        k.f = false;
    };
    XamLinearGauge.prototype.gi = function (a) {
        var b = a.c;
        var c = this.a6;
        c.f = true;
        for (var d = 0; d < this.bp.count; d++) {
            c.n(this.bp._inner[d]);
        }
        this.bp.clear();
        var e = this.cz();
        var f = this.df();
        var g = this.iu();
        var h = this.view.co();
        if (isNaN_(b.s) || isNaN_(b.t) || isNaN_(b.u) || isNaN_(b.r)) {
            h.an = null;
        }
        else {
            var i = this.c2();
            h.an = b.ae(g, e, i, this.as);
            h._fill = this.ir;
            h._stroke = this.is;
            h.ad = this.c6;
        }
        for (var j = 0; j < b.m.count; j++) {
            var k = b.m._inner[j];
            var l = c.a();
            l.an = k.k(g, e, f, this.as);
            l._fill = k.i;
            l._stroke = k.j;
            l.ad = k.h;
            this.bp.add(l);
        }
        this.view.bs(this.bp);
        c.f = false;
    };
    XamLinearGauge.prototype.gf = function (a) {
        var b = this.i0;
        var c = this.view.cl();
        var d = a.a;
        var e = this.as == 0 ? b.height : b.width;
        var f = this.as == 0 ? b.width : b.height;
        var g = d.g(e, f, this.as);
        c.an = g;
        c._fill = d.e;
        c._stroke = d.f;
        c.ad = d.c;
    };
    XamLinearGauge.prototype.bu = function (a) {
        var b = new List$1(Point_$type, 0);
        for (var c = 0; c < a.count; c++) {
            b.add({ $type: Point_$type, x: a._inner[c].x, y: a._inner[c].y });
        }
        return b;
    };
    XamLinearGauge.prototype.gh = function (a, b, c) {
        if (c) {
            this.bs = null;
            if (this.a2 == 0) {
                return;
            }
        }
        else {
            this.bt = null;
        }
        var d = c ? this.view.cm() : this.view.cn();
        var e = this.dd;
        if (isNaN_(e) || e < this.b3 || e > this.b2) {
            d.an = null;
            return;
        }
        var f = this.cz();
        var g = this.df();
        var h = f;
        var i = b.p;
        var j = 0;
        if (this.as == 1) {
            i = this.i1.left;
            j = g - b.p;
        }
        d.an = b.t(h, i, j);
        d._fill = b.r;
        d._stroke = b.s;
        d.ad = b.o;
        var k = new PathVisualData(1, "needle", d);
        var l = k.getPoints(new GetPointsSettings());
        if (l.count > 0) {
            var m = this.bu(l._inner[0]);
            var n = 1.7976931348623157E+308, o = 1.7976931348623157E+308;
            var p = -1.7976931348623157E+308, q = -1.7976931348623157E+308;
            for (var r = 0; r < m.count; r++) {
                n = m._inner[r].x < n ? m._inner[r].x : n;
                o = m._inner[r].y < o ? m._inner[r].y : o;
                p = m._inner[r].x > p ? m._inner[r].x : p;
                q = m._inner[r].y > q ? m._inner[r].y : q;
            }
            var s = new Rect(2, { $type: Point_$type, x: n, y: o }, { $type: Point_$type, x: p, y: q });
            if (c) {
                this.bs = m;
                this.iw = s;
            }
            else {
                this.bt = m;
                this.ix = s;
            }
        }
    };
    XamLinearGauge.prototype.f3 = function (a, b) {
        this.bc = true;
        this.view.br();
    };
    XamLinearGauge.prototype.fv = function (a, b) {
        this.bc = true;
        this.view.br();
    };
    XamLinearGauge.prototype.cz = function () {
        if (this.as == 0) {
            return this.bi ? this.i2.height : this.i1.height;
        }
        return this.bi ? this.i2.width : this.i1.width;
    };
    XamLinearGauge.prototype.c2 = function () {
        if (this.as == 0) {
            return this.i2.width * (this.c0 - this.c5);
        }
        return this.i2.height * (this.c0 - this.c5);
    };
    XamLinearGauge.prototype.de = function () {
        if (this.as == 0) {
            return this.i2.height;
        }
        return this.i2.width;
    };
    XamLinearGauge.prototype.df = function () {
        if (this.as == 0) {
            return this.i2.width;
        }
        return this.i2.height;
    };
    XamLinearGauge.prototype.c4 = function () {
        var a = this.c5;
        if (this.as == 0) {
            if (this.bg) {
                a = 1 - this.c0;
            }
            return this.i2.left + this.i2.width * a;
        }
        if (this.bg) {
            a = 1 - this.c0;
        }
        return this.i2.top + this.i2.height * a;
    };
    XamLinearGauge.prototype.iu = function () {
        var a = this.i1.left;
        if (this.bi) {
            a = 0;
        }
        var b = this.c5;
        if (this.as == 0) {
            if (this.bg) {
                b = 1 - this.c0;
            }
            return { $type: Point_$type, x: a + this.i1.width * b, y: this.i1.top };
        }
        if (!this.bg) {
            b = 1 - this.c0;
        }
        return { $type: Point_$type, x: a, y: this.i1.top + this.i1.height * b };
    };
    XamLinearGauge.prototype.f1 = function (a, b, c) {
        switch (a) {
            case XamLinearGauge.$$p[0]:
            case XamLinearGauge.$$p[3]:
            case XamLinearGauge.$$p[48]:
            case XamLinearGauge.$$p[52]:
            case XamLinearGauge.$$p[56]:
            case XamLinearGauge.$$p[23]:
            case XamLinearGauge.$$p[29]:
            case XamLinearGauge.$$p[39]:
                this.view.a8(a, b, c);
                break;
            case XamLinearGauge.$$p[43]:
                this.view.bd(b, c);
                break;
            case XamLinearGauge.$$p[46]:
                this.view.be(b, c);
                break;
            case "PixelScalingRatio":
                if (isNaN_(DeviceUtils.a(this.cw))) {
                    this.b4 = 1;
                }
                else {
                    this.b4 = DeviceUtils.a(this.cw);
                }
                break;
            case "ActualPixelScalingRatio":
                this.view.bi();
                break;
        }
        switch (a) {
            case XamLinearGauge.$$p[15]:
            case XamLinearGauge.$$p[16]:
                if (this.d3 != null) {
                    this.aj = new BindingFormatter();
                    this.aj.j = this.d3;
                    this.aj.d = this.ag;
                }
                else {
                    this.aj = null;
                }
                this.bc = true;
                this.view.br();
                break;
            case XamLinearGauge.$$p[64]:
                if (this.valueChanged != null) {
                    this.valueChanged(this, new DoubleValueChangedEventArgs(b, c));
                }
                this.bc = true;
                this.view.br();
                break;
            case XamLinearGauge.$$p[9]:
                {
                    if (this.highlightValueChanged != null) {
                        this.highlightValueChanged(this, new DoubleValueChangedEventArgs(b, c));
                    }
                    var d = this.a0 == 2;
                    this.gn();
                    var e = this.a0 == 2;
                    this.bc = true;
                    if (!d && e) {
                        this.a2 = 1;
                    }
                    else if (d && !e) {
                        this.a2 = 4;
                    }
                    this.view.br();
                    break;
                }
            case XamLinearGauge.$$p[7]:
                {
                    var f = this.a0 == 2;
                    this.gn();
                    var g = this.a0 == 2;
                    this.bc = true;
                    if (!f && g) {
                        this.a2 = 1;
                    }
                    else if (f && !g) {
                        this.a2 = 4;
                    }
                    this.view.br();
                    break;
                }
            case XamLinearGauge.$$p[8]:
                this.go();
                break;
            case "ActualHighlightValueOpacity":
                this.bc = true;
                this.view.br();
                break;
            case XamLinearGauge.$$p[63]:
                this.av.r = this.dh;
                this.view.br();
                break;
            case "TransitionProgress":
                if (this.dc >= 1) {
                    this.av.w();
                    var h = this.an;
                    this.an = this.ao;
                    this.ao = h;
                    this.f5();
                    this.f6();
                    this.f8();
                    this.f4();
                    this.gf(this.an);
                    this.gi(this.an);
                    this.gh(this.an, this.an.c.af, true);
                    this.gh(this.an, this.an.c.ag, false);
                    this.gj(this.an);
                    this.gg(this.an);
                    if (this.a2 == 5) {
                        this.fr();
                        this.view.br();
                        return;
                    }
                    else if (this.a2 == 2) {
                        this.a2 = 3;
                    }
                }
                this.am.d(this.dc, this.ao, this.an);
                this.gf(this.am);
                this.gi(this.am);
                this.gh(this.am, this.am.c.af, true);
                this.gh(this.am, this.am.c.ag, false);
                this.gj(this.am);
                this.gg(this.am);
                this.view.as();
                break;
            case XamLinearGauge.$$p[29]:
            case XamLinearGauge.$$p[34]:
            case XamLinearGauge.$$p[28]:
            case XamLinearGauge.$$p[40]:
            case XamLinearGauge.$$p[31]:
            case XamLinearGauge.$$p[36]:
            case XamLinearGauge.$$p[32]:
            case XamLinearGauge.$$p[37]:
            case XamLinearGauge.$$p[30]:
            case XamLinearGauge.$$p[35]:
            case XamLinearGauge.$$p[33]:
            case XamLinearGauge.$$p[38]:
            case XamLinearGauge.$$p[41]:
            case XamLinearGauge.$$p[39]:
            case XamLinearGauge.$$p[0]:
            case XamLinearGauge.$$p[3]:
            case XamLinearGauge.$$p[4]:
            case XamLinearGauge.$$p[1]:
            case XamLinearGauge.$$p[2]:
            case XamLinearGauge.$$p[48]:
            case XamLinearGauge.$$p[52]:
            case XamLinearGauge.$$p[54]:
            case XamLinearGauge.$$p[50]:
            case XamLinearGauge.$$p[51]:
            case XamLinearGauge.$$p[56]:
            case XamLinearGauge.$$p[23]:
            case XamLinearGauge.$$p[43]:
            case XamLinearGauge.$$p[46]:
            case XamLinearGauge.$$p[21]:
            case XamLinearGauge.$$p[44]:
            case XamLinearGauge.$$p[45]:
            case XamLinearGauge.$$p[10]:
            case XamLinearGauge.$$p[17]:
            case XamLinearGauge.$$p[14]:
            case XamLinearGauge.$$p[18]:
            case XamLinearGauge.$$p[19]:
            case XamLinearGauge.$$p[60]:
            case XamLinearGauge.$$p[61]:
            case XamLinearGauge.$$p[58]:
            case XamLinearGauge.$$p[57]:
            case XamLinearGauge.$$p[59]:
            case XamLinearGauge.$$p[26]:
            case XamLinearGauge.$$p[25]:
            case XamLinearGauge.$$p[24]:
            case XamLinearGauge.$$p[27]:
                this.bc = true;
                this.view.br();
                break;
            case XamLinearGauge.$$p[47]:
                var i = b;
                var j = c;
                if (i != null) {
                    var k = i;
                    k.collectionChanged = delegateRemove(k.collectionChanged, runOn(this, this.gc));
                }
                if (j != null) {
                    var l = j;
                    l.collectionChanged = delegateCombine(l.collectionChanged, runOn(this, this.gc));
                }
                this.bc = true;
                this.view.br();
                break;
            case XamLinearGauge.$$p[42]:
            case XamLinearGauge.$$p[13]:
            case XamLinearGauge.$$p[22]:
            case XamLinearGauge.$$p[20]:
            case XamLinearGauge.$$p[49]:
            case XamLinearGauge.$$p[53]:
                this.b3 = Math.min(this.ch, this.cg);
                this.b2 = Math.max(this.ch, this.cg);
                var m = this.c4();
                this.ar = new LinearGraphScaler(this.b3, this.b2, m, m + this.c2(), this.bg);
                this.bc = true;
                this.view.br();
                break;
            case XamLinearGauge.$$p[5]:
            case XamLinearGauge.$$p[6]:
                this.view.b1();
                this.bc = true;
                this.view.br();
                break;
        }
        this.f2(a);
    };
    XamLinearGauge.prototype.gc = function (a, b) {
        var e_1, _a, e_2, _b;
        if (b.oldItems != null) {
            try {
                for (var _c = __values(fromEn(b.oldItems)), _d = _c.next(); !_d.done; _d = _c.next()) {
                    var c = _d.value;
                    c.propertyChanged = delegateRemove(c.propertyChanged, runOn(this, this.gb));
                }
            }
            catch (e_1_1) {
                e_1 = { error: e_1_1 };
            }
            finally {
                try {
                    if (_d && !_d.done && (_a = _c.return))
                        _a.call(_c);
                }
                finally {
                    if (e_1)
                        throw e_1.error;
                }
            }
        }
        if (b.newItems != null) {
            try {
                for (var _e = __values(fromEn(b.newItems)), _f = _e.next(); !_f.done; _f = _e.next()) {
                    var d = _f.value;
                    d.propertyChanged = delegateCombine(d.propertyChanged, runOn(this, this.gb));
                }
            }
            catch (e_2_1) {
                e_2 = { error: e_2_1 };
            }
            finally {
                try {
                    if (_f && !_f.done && (_b = _e.return))
                        _b.call(_e);
                }
                finally {
                    if (e_2)
                        throw e_2.error;
                }
            }
        }
        this.bc = true;
        this.view.br();
    };
    XamLinearGauge.prototype.gb = function (a, b) {
        this.bc = true;
        this.view.br();
    };
    XamLinearGauge.prototype.fs = function (a, b) {
        this.bc = true;
        this.view.br();
    };
    XamLinearGauge.prototype.refresh = function () {
        this.bc = true;
        this.view.br();
    };
    XamLinearGauge.prototype.ay = function () {
        return FontUtil.toFontInfo(this.view.ah, this.ds);
    };
    Object.defineProperty(XamLinearGauge.prototype, "cw", {
        get: function () {
            return this.bz;
        },
        set: function (a) {
            var b = this.bz;
            this.bz = a;
            this.f1("PixelScalingRatio", b, this.bz);
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(XamLinearGauge.prototype, "b4", {
        get: function () {
            return this.by;
        },
        set: function (a) {
            var b = this.by;
            this.by = a;
            this.f1("ActualPixelScalingRatio", b, this.by);
        },
        enumerable: false,
        configurable: true
    });
    XamLinearGauge.$t = markType(XamLinearGauge, 'XamLinearGauge', Control.$, [INotifyPropertyChanged_$type]);
    XamLinearGauge.$$p = markDep(DependencyProperty, PropertyMetadata, XamLinearGauge, 'f1', ['BackingBrush:ij:gp', [Brush.$, null], 'BackingInnerExtent:b5:gq', [1, 0], 'BackingOuterExtent:b6:gr', [1, 1], 'BackingOutline:ik:gs', [Brush.$, null], 'BackingStrokeThickness:b7:gt', [1, 2], 'FontBrush:il:gu', [Brush.$, null], 'Font:ds:gv', [2, null], 'HighlightValueDisplayMode:a1:gw', [HighlightedValueDisplayMode_$type, enumGetBox(HighlightedValueDisplayMode_$type, 0)], 'HighlightValueOpacity:ca:gx', [1, 0.5], 'HighlightValue:b9:gy', [1, NaN], 'Interval:cb:gz', [1, NaN], 'IsHighlightNeedleDraggingEnabled:be:g0', [0, false], 'IsNeedleDraggingEnabled:bf:g1', [0, false], 'IsScaleInverted:bg:g2', [0, false], 'LabelExtent:cc:g3', [1, 0], 'LabelFormat:d3:g4', [2, null], 'LabelFormatSpecifiers:ag:g5', [Array_$type, null], 'LabelInterval:cd:g6', [1, NaN], 'LabelsPostInitial:ce:g7', [1, 0], 'LabelsPreTerminal:cf:g8', [1, 0], 'MaximumValue:cg:g9', [1, 100], 'MergeViewports:bi:ha', [0, false], 'MinimumValue:ch:hb', [1, 0], 'MinorTickBrush:io:hc', [Brush.$, null], 'MinorTickCount:ci:hd', [1, 4], 'MinorTickEndExtent:cj:he', [1, 0.35], 'MinorTickStartExtent:ck:hf', [1, 0.05], 'MinorTickStrokeThickness:cl:hg', [1, 1], 'NeedleBreadth:cm:hh', [1, 6], 'NeedleBrush:ip:hi', [Brush.$, null], 'NeedleInnerBaseWidth:cn:hj', [1, NaN], 'NeedleInnerExtent:co:hk', [1, NaN], 'NeedleInnerPointExtent:cp:hl', [1, NaN], 'NeedleInnerPointWidth:cq:hm', [1, NaN], 'NeedleName:en:hn', [2, null], 'NeedleOuterBaseWidth:cr:ho', [1, NaN], 'NeedleOuterExtent:cs:hp', [1, NaN], 'NeedleOuterPointExtent:ct:hq', [1, NaN], 'NeedleOuterPointWidth:cu:hr', [1, NaN], 'NeedleOutline:iq:hs', [Brush.$, null], 'NeedleShape:ap:ht', [LinearGraphNeedleShape_$type, enumGetBox(LinearGraphNeedleShape_$type, 3)], 'NeedleStrokeThickness:cv:hu', [1, 1], 'Orientation:as:hv', [LinearScaleOrientation_$type, enumGetBox(LinearScaleOrientation_$type, 0)], 'RangeBrushes:ah:hw', [BrushCollection.$, null], 'RangeInnerExtent:cx:hx', [1, 0.05], 'RangeOuterExtent:cy:hy', [1, 0.65], 'RangeOutlines:ai:hz', [BrushCollection.$, null], 'Ranges::h0', [LinearGraphRangeCollection.$, null], 'ScaleBrush:ir:h1', [Brush.$, null], 'ScaleEndExtent:c0:h2', [1, 0.95], 'ScaleInnerExtent:c1:h3', [1, 0.05], 'ScaleOuterExtent:c3:h4', [1, 0.65], 'ScaleOutline:is:h5', [Brush.$, null], 'ScaleStartExtent:c5:h6', [1, 0.05], 'ScaleStrokeThickness:c6:h7', [1, 1], 'ShowToolTipTimeout:dg:h8', [1, 500], 'TickBrush:it:h9', [Brush.$, null], 'TickEndExtent:c7:ia', [1, 0.65], 'TickStartExtent:da:id', [1, 0.05], 'TickStrokeThickness:db:ie', [1, 2], 'TicksPostInitial:c8:ib', [1, 0], 'TicksPreTerminal:c9:ic', [1, 0], 'ToolTip::ig', [4, null], 'TransitionDuration:dh:ih', [1, 0], 'Value:dd:ii', [1, NaN]]);
    return XamLinearGauge;
}(Control));
export { XamLinearGauge };
/**
 * @hidden
 */
var XamLinearGaugeView = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(XamLinearGaugeView, _super);
    function XamLinearGaugeView(a) {
        var _this = _super.call(this) || this;
        _this.ap = 0;
        _this.ao = 0;
        _this.m = null;
        _this.i = null;
        _this.aj = null;
        _this.p = null;
        _this.ah = null;
        _this.aa = null;
        _this.z = null;
        _this.y = null;
        _this.ab = null;
        _this.cj = null;
        _this.ci = null;
        _this.ck = null;
        _this.ch = null;
        _this.ca = null;
        _this.cb = null;
        _this.b7 = null;
        _this.b8 = null;
        _this.cc = null;
        _this.cd = null;
        _this.ce = null;
        _this.b9 = null;
        _this.c = null;
        _this.d = null;
        _this.e = null;
        _this.f = null;
        _this.q = false;
        _this.v = null;
        _this.a = ["needle", "backing", "scale", "tick", "minortick", "label"];
        _this.u = false;
        _this.t = false;
        _this.ai = null;
        _this.k = null;
        _this.ak = 0;
        _this.am = 0;
        _this.aq = null;
        _this.an = -1;
        _this.cf = null;
        _this.al = 0;
        _this.x = null;
        _this.b6 = ((function () {
            var $ret = new Brush();
            $ret.fill = "black";
            return $ret;
        })());
        _this.r = false;
        _this.n = null;
        _this.b5 = null;
        _this.ac = 0;
        _this.ad = 1;
        _this.m = a;
        _this.v = new Dictionary$2(String_$type, Dictionary$2.$.specialize(String_$type, Brush.$), 0);
        _this.cj = new Path();
        _this.ci = new Path();
        _this.ck = new Path();
        _this.ch = new Path();
        _this.aa = new List$1(Path.$, 0);
        _this.z = new List$1(Path.$, 0);
        _this.y = new List$1(TextBlock.$, 0);
        _this.ab = new List$1(TextBlock.$, 0);
        return _this;
    }
    XamLinearGaugeView.prototype.a3 = function () {
        var a = this.m.cw;
        var b = this.m.b4;
        if (!isNaN_(a) && a != 0) {
            return;
        }
        if (window.devicePixelRatio != undefined && window.devicePixelRatio != b) {
            this.m.b4 = window.devicePixelRatio;
        }
    };
    XamLinearGaugeView.prototype.bc = function () {
        this.k = new LinearGraphTooltipDataContext();
        this.al = this.m.dg;
        this.a3();
    };
    XamLinearGaugeView.prototype.s = function () {
        return true;
    };
    XamLinearGaugeView.prototype.cn = function () {
        return this.cj;
    };
    XamLinearGaugeView.prototype.cm = function () {
        return this.ci;
    };
    XamLinearGaugeView.prototype.co = function () {
        return this.ck;
    };
    XamLinearGaugeView.prototype.cl = function () {
        return this.ch;
    };
    XamLinearGaugeView.prototype.a1 = function () {
        this.q = true;
        var a = ["#778899", "#EBEDEF", "#e0e0e0", "#617583", "rgba(100,107,114,.74)", "rgba(100,107,114,.74)"];
        var b = ["#778899", "#B2B9C0", "#e0e0e0", null, null, null];
        var c = ((function () {
            var $ret = new List$1(Array_$type, 0);
            $ret.add(a);
            $ret.add(b);
            return $ret;
        })());
        this.v.clear();
        var d = this.a.length;
        var _loop_5 = function (e) {
            var f = this_5.a[e];
            var g = "ui-lineargauge-" + f;
            var h = "ui-lineargauge-" + f + "-fill";
            var i = "ui-lineargauge-" + f + "-outline";
            var j;
            if (!((function () { var k = XamLinearGaugeView.w.tryGetValue(h, j); j = k.p1; return k.ret; })())) {
                j = BrushUtil.m(h, g, "background-color", this_5.ah, a[e]);
                XamLinearGaugeView.w.addItem(h, j);
            }
            var k;
            if (!((function () { var l = XamLinearGaugeView.w.tryGetValue(i, k); k = l.p1; return l.ret; })())) {
                k = BrushUtil.m(i, g, "border-top-color", this_5.ah, b[e]);
                XamLinearGaugeView.w.addItem(i, k);
            }
            var l = new Dictionary$2(String_$type, Brush.$, 0);
            l.item("fill", j);
            l.item("outline", k);
            this_5.v.item(this_5.a[e], l);
        };
        var this_5 = this;
        for (var e = 0; e < d; e++) {
            _loop_5(e);
        }
        this.b0();
        if (XamLinearGaugeView.g == null || XamLinearGaugeView.h == null) {
            var m = BrushUtil.i("ui-lineargauge-range-fill-palette-", "ui-lineargauge-range-outline-palette-", "ui-lineargauge-range-palette-", this.ah, XamLinearGaugeView.g, XamLinearGaugeView.h, ["#216E99", "#216E99", "#44acd6", "#44acd6", "#cecece", "#cecece"]);
            XamLinearGaugeView.g = m.p4;
            XamLinearGaugeView.h = m.p5;
        }
        this.c = XamLinearGaugeView.g;
        this.d = XamLinearGaugeView.h;
        if (this.e == null) {
            this.m.ah = this.c;
        }
        if (this.f == null) {
            this.m.ai = this.d;
        }
        this.q = false;
    };
    XamLinearGaugeView.prototype.b0 = function () {
        this.q = true;
        var a = this.a.length;
        for (var b = 0; b < a; b++) {
            var c = this.a[b];
            this.bz(c, this.v.item(c));
        }
        this.q = false;
    };
    XamLinearGaugeView.prototype.bz = function (a, b) {
        var c = b.item("fill");
        var d = b.item("outline");
        switch (a) {
            case "needle":
                if (this.ca == null) {
                    this.m.ip = c;
                }
                if (this.cb == null) {
                    this.m.iq = d;
                }
                break;
            case "scale":
                if (this.cc == null) {
                    this.m.ir = c;
                }
                if (this.cd == null) {
                    this.m.is = d;
                }
                break;
            case "backing":
                if (this.b7 == null) {
                    this.m.ij = c;
                }
                if (this.b8 == null) {
                    this.m.ik = d;
                }
                break;
            case "tick":
                if (this.ce == null) {
                    this.m.it = c;
                }
                break;
            case "minortick":
                if (this.b9 == null) {
                    this.m.io = c;
                }
                break;
            case "label":
                this.b6 = c;
                break;
        }
    };
    XamLinearGaugeView.prototype.a8 = function (a, b, c) {
        var d = b;
        var e = c;
        if (!this.q) {
            switch (a) {
                case XamLinearGauge.$$p[29]:
                    this.ca = e;
                    break;
                case XamLinearGauge.$$p[39]:
                    this.cb = e;
                    break;
                case XamLinearGauge.$$p[0]:
                    this.b7 = e;
                    break;
                case XamLinearGauge.$$p[3]:
                    this.b8 = e;
                    break;
                case XamLinearGauge.$$p[48]:
                    this.cc = e;
                    break;
                case XamLinearGauge.$$p[52]:
                    this.cd = e;
                    break;
                case XamLinearGauge.$$p[56]:
                    this.ce = e;
                    break;
                case XamLinearGauge.$$p[23]:
                    this.b9 = e;
                    break;
            }
            if (e == null) {
                this.b0();
            }
        }
    };
    XamLinearGaugeView.prototype.bd = function (a, b) {
        if (!this.q) {
            this.e = b;
            if (this.e == null) {
                this.m.ah = this.c;
            }
        }
    };
    XamLinearGaugeView.prototype.be = function (a, b) {
        if (!this.q) {
            this.f = b;
            if (this.f == null) {
                this.m.ai = this.d;
            }
        }
    };
    XamLinearGaugeView.prototype.b = function (a, b) {
        this.ah.startCSSQuery();
        for (var c = 0; c < b.length; c++) {
            b[c] = this.ah.getCssDefaultPropertyValue(a, b[c]);
        }
        this.ah.endCSSQuery();
        return b;
    };
    XamLinearGaugeView.prototype.bv = function () {
        this.a1();
        this.b1();
        this.br();
    };
    XamLinearGaugeView.prototype.cg = function (a) {
        var b = CanvasGestureDOMEventProxy.c4(this.ah.rootWrapper);
        return { $type: Point_$type, x: a.x - b.left, y: a.y - b.top };
    };
    XamLinearGaugeView.prototype.bu = function (a, b, c, d) {
        this.cf = a;
        this.an = c;
        this.aq = d;
        this.bq();
        if (this.ah != null) {
            this.am = this.ah.setTimeout(runOn(this, this.b2), this.al);
        }
        else {
            this.am = window.setTimeout(runOn(this, this.b2), this.al);
        }
        this.t = true;
    };
    XamLinearGaugeView.prototype.a2 = function () {
        if (this.t) {
            if (this.ah != null) {
                this.ah.clearTimeout(this.am);
            }
            else {
                window.clearTimeout(this.am);
            }
            this.t = false;
        }
        if (this.u) {
            var a = this.m.toolTip;
            if (this.ah != null) {
                this.ah.clearTimeout(this.ak);
            }
            else {
                window.clearTimeout(this.ak);
            }
            a.hide();
            this.u = false;
            this.k = null;
        }
        this.al = this.m.dg;
    };
    XamLinearGaugeView.prototype.bq = function () {
        if (this.t) {
            if (this.ah != null) {
                this.ah.clearTimeout(this.am);
            }
            else {
                window.clearTimeout(this.am);
            }
        }
        if (this.u) {
            var a = this.m.toolTip;
            if (this.ah != null) {
                this.ah.clearTimeout(this.ak);
            }
            else {
                window.clearTimeout(this.ak);
            }
            a.hide();
            this.u = false;
            this.al = intDivide(this.m.dg, 2);
        }
    };
    XamLinearGaugeView.prototype.b2 = function () {
        var _this = this;
        if (this.t) {
            if (this.ah != null) {
                this.ah.clearTimeout(this.am);
            }
            else {
                window.clearTimeout(this.am);
            }
            this.t = false;
        }
        var a = this.an;
        var b = this.aq;
        var c = this.cf;
        if (this.ah != null) {
            this.ak = this.ah.setTimeout(runOn(this, this.a2), 10 * this.m.dg);
        }
        else {
            this.ak = window.setTimeout(runOn(this, this.a2), 10 * this.m.dg);
        }
        var d = this.m.ranges._inner[a];
        if (this.ai != this.m.toolTip) {
            if (this.ai != null) {
                this.ai.remove();
            }
            this.ai = this.m.toolTip;
            this.ai.setStyleProperty("z-index", "10000");
            this.ai.setStyleProperty("position", "absolute");
            this.ah.append(this.ai);
        }
        this.k = this.j(b, a);
        var context_ = this.k;
        var tooltip_ = this.ai;
        var tooltipType_ = b;
        if (tooltip_.updateToolTip) {
            tooltip_.updateToolTip(context_, tooltipType_);
        }
        ;
        var e = this.ai.findByClass(".ui-tooltip-container");
        if (e != null && e.length > 0) {
            e[0].setAttribute("style", null);
        }
        var f = "ui-simple-default-tooltip-content";
        var g = this.ai.findByClass("." + f);
        if (g != null && g.length > 0) {
            var h = ["border-top-color", "border-top-width", "border-top-style", "border-top-left-radius", "background-color", "padding-top", "font-weight"];
            var i = ["border-color", "border-width", "border-style", "border-radius", "background-color", "padding", "font-weight"];
            var j = ((function () {
                var $ret = new List$1(String_$type, 0);
                $ret.add(_this.k.brush.color.colorString);
                $ret.add("2px");
                $ret.add("solid");
                $ret.add("4px");
                $ret.add("rgba(230, 230, 230, 0.74)");
                $ret.add("4px");
                $ret.add("bold");
                return $ret;
            })());
            var k = new Dictionary$2(String_$type, String_$type, 0);
            var l = new Array(h.length);
            arrayCopy1(h, 0, l, 0, h.length);
            this.b(f, l);
            for (var m = 0; m < l.length; m++) {
                this.ai.setStyleProperty(i[m], (l[m] == null) ? j._inner[m] : l[m]);
            }
        }
        this.ai.setStyleProperty("top", (c.y + 15).toString() + "px").setStyleProperty("left", (c.x + 15).toString() + "px");
        this.ai.show();
        this.u = true;
    };
    XamLinearGaugeView.prototype.j = function (a, b) {
        var c = new LinearGraphTooltipDataContext();
        switch (a) {
            case "range":
                var d = this.m.ranges._inner[b];
                c.item = d;
                c.itemName = d.u;
                c.label = d.u + ": " + d.o.toString() + "-" + d.j.toString();
                var e = d.an;
                var f = d.ao;
                c.brush = e != null ? e : this.m.im(b, this.c);
                c.outline = f != null ? f : this.m.im(b, this.d);
                c.thickness = d.p;
                break;
            case "needle":
                c.item = this.m.dd;
                c.itemName = this.m.en;
                c.label = this.m.en != null ? this.m.en + ": " + this.m.dd.toString() : this.m.dd.toString();
                c.brush = this.m.ip;
                c.outline = this.m.iq;
                c.thickness = this.m.cv;
                break;
        }
        return c;
    };
    XamLinearGaugeView.prototype.a9 = function (a) {
        if (a == null) {
            this.aj = null;
            this.ah = null;
            this.ai = null;
            this.p = null;
            if (this.m.a9) {
                this.m.av.w();
            }
            this.at();
            return;
        }
        var b = a;
        this.ah = b;
        this.m.av.u(this.ah);
        this.ah.rootWrapper.addClass("ui-lineargauge-container");
        this.ad = (isNaN_(this.m.cw) ? this.m.b4 : this.m.cw);
        var c = this.ad;
        var d = Math.round(b.rootWrapper.width());
        var e = Math.round(b.rootWrapper.height());
        var f = d * c;
        var g = e * c;
        this.ah.rootWrapper.setStyleProperty("position", "relative");
        var h = this.ah.createElement("canvas");
        h.setStyleProperty("position", "absolute");
        this.ah.append(h);
        this.ap = f;
        this.ao = g;
        h.setAttribute("width", f.toString());
        h.setAttribute("height", g.toString());
        h.setStyleProperty("width", d.toString() + "px");
        h.setStyleProperty("height", e.toString() + "px");
        h.setStyleProperty("left", "0px");
        h.setStyleProperty("top", "0px");
        this.m.i2 = new Rect(0, 0, 0, d, e);
        this.m.i0 = new Rect(0, 0, 0, d, e);
        this.aj = h;
        var i = this.ah.get2DCanvasContext(this.aj);
        this.p = new RenderingContext(new CanvasViewRenderer(), i);
        this.a1();
        this.b1();
        this.p.ad(this.n);
        this.at();
        if (TypeRegistrar.isRegistered("CanvasGestureDOMEventProxy")) {
            this.i = typeCast(EventProxy.$, TypeRegistrar.create("CanvasGestureDOMEventProxy", this.ah.rootWrapper, this.ah, false));
        }
        if (this.i != null) {
            var j = this.i;
            j.onMouseOver = delegateCombine(j.onMouseOver, runOn(this, this.ay));
            var k = this.i;
            k.onMouseLeave = delegateCombine(k.onMouseLeave, runOn(this, this.ax));
            var l = this.i;
            l.onContactStarted = delegateCombine(l.onContactStarted, runOn(this, this.aw));
            var m = this.i;
            m.onContactMoved = delegateCombine(m.onContactMoved, runOn(this, this.av));
            var n = this.i;
            n.onContactCompleted = delegateCombine(n.onContactCompleted, runOn(this, this.au));
        }
        this.bp();
    };
    XamLinearGaugeView.prototype.au = function (a, b) {
        if (this.m != null) {
            this.m.onMouseUp(a);
        }
    };
    XamLinearGaugeView.prototype.av = function (a, b) {
        if (this.m != null) {
            this.m.onMouseMove(a, b);
        }
    };
    XamLinearGaugeView.prototype.aw = function (a, b) {
        if (this.m != null) {
            this.m.onMouseDown(a, b);
        }
    };
    XamLinearGaugeView.prototype.ay = function (a, b, c) {
        if (this.m != null) {
            this.m.onMouseOver(a, b, c);
        }
    };
    XamLinearGaugeView.prototype.ax = function (a) {
        if (this.m != null) {
            this.m.onMouseLeave();
        }
    };
    XamLinearGaugeView.prototype.at = function () {
        if (this.i != null) {
            var a = this.i;
            a.onMouseOver = delegateRemove(a.onMouseOver, runOn(this, this.ay));
            var b = this.i;
            b.onMouseLeave = delegateRemove(b.onMouseLeave, runOn(this, this.ax));
            var c = this.i;
            c.onContactStarted = delegateRemove(c.onContactStarted, runOn(this, this.aw));
            var d = this.i;
            d.onContactMoved = delegateRemove(d.onContactMoved, runOn(this, this.av));
            var e = this.i;
            e.onContactCompleted = delegateRemove(e.onContactCompleted, runOn(this, this.au));
            this.i.av();
        }
    };
    XamLinearGaugeView.prototype.ba = function () {
        this.a3();
        var a = Math.round(this.ah.rootWrapper.width());
        var b = Math.round(this.ah.rootWrapper.height());
        this.m.i2 = new Rect(0, 0, 0, a, b);
        this.m.i0 = new Rect(0, 0, 0, a, b);
        if (this.i != null) {
            this.i.bl = this.m.i2;
        }
    };
    XamLinearGaugeView.prototype.as = function () {
        this.bp();
    };
    XamLinearGaugeView.prototype.bs = function (a) {
        this.x = a;
    };
    XamLinearGaugeView.prototype.bp = function () {
        var a = this.m.i2.width;
        var b = this.m.i2.height;
        var c = a * this.ad;
        var d = b * this.ad;
        if (this.ap != a || this.ao != b) {
            this.aj.setAttribute("width", c.toString());
            this.aj.setAttribute("height", d.toString());
            this.aj.setStyleProperty("width", a.toString() + "px");
            this.aj.setStyleProperty("height", b.toString() + "px");
            this.ap = truncate(Math.round(c));
            this.ao = truncate(Math.round(d));
        }
        if (this.p.d && this.ad != 1) {
            this.p.aa();
            this.p.ab(this.ad, this.ad);
        }
        this.p.l(this.m.i2.left, this.m.i2.top, this.m.i2.width, this.m.i2.height);
        this.p.t(this.ch);
        this.p.t(this.ck);
        if (this.x != null) {
            for (var e = 0; e < this.x.count; e++) {
                this.p.t(this.x._inner[e]);
            }
        }
        for (var f = 0; f < this.y.count; f++) {
            this.p.ad(this.n);
            this.p.x(this.y._inner[f]);
        }
        for (var g = 0; g < this.z.count; g++) {
            this.p.t(this.z._inner[g]);
        }
        this.p.t(this.cj);
        this.p.t(this.ci);
        if (this.p.d && this.ad != 1) {
            this.p.z();
        }
    };
    XamLinearGaugeView.prototype.b1 = function () {
        if (this.m.ds != null) {
            this.n = this.m.ay();
        }
        else {
            this.n = FontUtil.getFont(this.ah);
        }
        this.ac = this.ae(this.n);
        if (this.m.il == null) {
            var a = this.ah.rootWrapper.getStyleProperty("color");
            if (stringIsNullOrEmpty(a) == false) {
                this.b5 = new Brush();
                this.b5._fill = a;
                this.m.il = this.b5;
            }
        }
        if (this.p != null) {
            this.p.ad(this.n);
        }
    };
    XamLinearGaugeView.prototype.af = function (a) {
        var b = typeCast(TextBlock.$, a);
        if (b != null && b.al != null) {
            return this.p.f(b) + 0;
        }
        return 0;
    };
    XamLinearGaugeView.prototype.cr = function (a) {
        if (isNaN_(this.ac)) {
            this.ac = this.ae(null);
        }
        var b = this.af(a);
        var c = this.ac;
        return new Size(1, b, c);
    };
    XamLinearGaugeView.prototype.bt = function (a, b) {
        if (b != null) {
            a.ao = b;
        }
        else {
            a.ao = this.b6;
        }
    };
    XamLinearGaugeView.prototype.bk = function (a, b, c) {
        a.n = b;
        a.o = c;
    };
    XamLinearGaugeView.prototype.bj = function (a, b) {
    };
    XamLinearGaugeView.prototype.bl = function (a, b) {
    };
    XamLinearGaugeView.prototype.ae = function (a) {
        return FontUtil.getCurrentFontHeight(this.ah, a);
    };
    XamLinearGaugeView.prototype.br = function () {
        if (!this.r) {
            this.r = true;
            window.setTimeout(runOn(this, this.ar), 0);
        }
    };
    XamLinearGaugeView.prototype.ar = function () {
        if (this.r) {
            this.r = false;
            this.m.fm();
        }
    };
    XamLinearGaugeView.prototype.flush = function () {
        if (this.r) {
            this.ar();
        }
    };
    XamLinearGaugeView.prototype.o = function (a, b) {
        return FontUtil.getFontInfo(this.ah, a, b);
    };
    XamLinearGaugeView.prototype.az = function (a) {
        var e_3, _a, e_4, _b, e_5, _c;
        a.scalePath = new PathVisualData(1, "Scale", this.ck);
        a.needlePath = new PathVisualData(1, "Needle", this.cj);
        a.highlightNeedlePath = new PathVisualData(1, "HighlightNeedle", this.ci);
        a.backingPath = new PathVisualData(1, "Backing", this.ch);
        var b = this.n;
        try {
            for (var _d = __values(fromEnum(this.y)), _e = _d.next(); !_e.done; _e = _d.next()) {
                var c = _e.value;
                if (c._visibility == 0) {
                    var d = this.o(c, b);
                    var e = new LinearGraphScaleLabelVisualData();
                    e.labelValue = c.al;
                    e.labelPosition = PointData.b({ $type: Point_$type, x: c.n, y: c.o });
                    e.labelSize = SizeData.b(this.cr(c));
                    e.appearance = AppearanceHelper.c(c, d);
                    a.scaleLabels.add(e);
                }
            }
        }
        catch (e_3_1) {
            e_3 = { error: e_3_1 };
        }
        finally {
            try {
                if (_e && !_e.done && (_a = _d.return))
                    _a.call(_d);
            }
            finally {
                if (e_3)
                    throw e_3.error;
            }
        }
        try {
            for (var _f = __values(fromEnum(this.z)), _g = _f.next(); !_g.done; _g = _f.next()) {
                var f = _g.value;
                if (f._visibility == 0) {
                    var g = new LinearGraphScaleTickmarkVisualData();
                    g.tickPath = new PathVisualData(1, "tickmarks", f);
                    a.scaleTickmarks.add(g);
                }
            }
        }
        catch (e_4_1) {
            e_4 = { error: e_4_1 };
        }
        finally {
            try {
                if (_g && !_g.done && (_b = _f.return))
                    _b.call(_f);
            }
            finally {
                if (e_4)
                    throw e_4.error;
            }
        }
        try {
            for (var _h = __values(fromEnum(this.x)), _j = _h.next(); !_j.done; _j = _h.next()) {
                var h = _j.value;
                if (h._visibility == 0) {
                    var i = new LinearGraphRangeVisualData();
                    var j = new PathVisualData(1, "range", h);
                    i.rangePath = j;
                    a.ranges.add(i);
                }
            }
        }
        catch (e_5_1) {
            e_5 = { error: e_5_1 };
        }
        finally {
            try {
                if (_j && !_j.done && (_c = _h.return))
                    _c.call(_h);
            }
            finally {
                if (e_5)
                    throw e_5.error;
            }
        }
    };
    XamLinearGaugeView.prototype.a7 = function () {
        this.a3();
        if (this.i != null) {
            this.i.at(this.ah.rootWrapper, "");
        }
    };
    XamLinearGaugeView.prototype.bb = function () {
        if (this.i != null && this.ah != null) {
            this.i.bh(this.ah.rootWrapper, "");
        }
    };
    XamLinearGaugeView.prototype.bm = function (a) {
        a._visibility = 0;
    };
    XamLinearGaugeView.prototype.bn = function (a) {
        a._visibility = 1;
    };
    XamLinearGaugeView.prototype.bo = function (a) {
        this.aa.remove(a);
    };
    XamLinearGaugeView.prototype.cq = function () {
        var a = new Path();
        this.aa.add(a);
        return a;
    };
    XamLinearGaugeView.prototype.bw = function (a) {
        a._visibility = 0;
    };
    XamLinearGaugeView.prototype.bx = function (a) {
        a._visibility = 1;
    };
    XamLinearGaugeView.prototype.by = function (a) {
        this.ab.remove(a);
    };
    XamLinearGaugeView.prototype.b4 = function () {
        var a = new TextBlock();
        this.ab.add(a);
        return a;
    };
    XamLinearGaugeView.prototype.bf = function (a) {
        a._visibility = 0;
    };
    XamLinearGaugeView.prototype.bg = function (a) {
        a._visibility = 1;
    };
    XamLinearGaugeView.prototype.bh = function (a) {
        this.z.remove(a);
    };
    XamLinearGaugeView.prototype.cp = function () {
        var a = new Path();
        this.z.add(a);
        return a;
    };
    XamLinearGaugeView.prototype.a4 = function (a) {
        a._visibility = 0;
    };
    XamLinearGaugeView.prototype.a5 = function (a) {
        a._visibility = 1;
    };
    XamLinearGaugeView.prototype.a6 = function (a) {
        this.y.remove(a);
    };
    XamLinearGaugeView.prototype.b3 = function () {
        var a = new TextBlock();
        this.y.add(a);
        return a;
    };
    XamLinearGaugeView.prototype.l = function () {
        var _this = this;
        if (this.k == null) {
            return null;
        }
        return ((function () {
            var $ret = new ToolTipInfo();
            $ret.b = _this.an;
            $ret.d = _this.cf;
            $ret.c = _this.aq;
            $ret.a = _this.k;
            return $ret;
        })());
    };
    XamLinearGaugeView.prototype.bi = function () {
        this.ad = this.m.b4;
    };
    XamLinearGaugeView.$t = markType(XamLinearGaugeView, 'XamLinearGaugeView');
    XamLinearGaugeView.w = new Dictionary$2(String_$type, Brush.$, 0);
    XamLinearGaugeView.g = null;
    XamLinearGaugeView.h = null;
    return XamLinearGaugeView;
}(Base));
export { XamLinearGaugeView };