/*
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 { INotifyPropertyChanged_$type, PropertyChangedEventArgs, Base, markType, enumGetBox } from "igniteui-react-core/ES2015/type";
import { ThumbRangePosition_$type } from "./ThumbRangePosition";
export class TrackThumbRange extends Base {
    constructor() {
        super(...arguments);
        this.i = 0;
        this.j = 0;
        this.h = 0;
        this.g = 1;
        this.d = null;
        this.c = null;
        this.a = null;
        this.propertyChanged = null;
    }
    t(a, b, c) {
        this.u(a, b, c);
        if (this.propertyChanged != null) {
            this.propertyChanged(this, new PropertyChangedEventArgs(a));
        }
    }
    u(a, b, c) {
        this.s();
    }
    s() {
        if (this.b == null) {
            return;
        }
        this.b.trackDirty();
    }
    get b() {
        return this.a;
    }
    set b(a) {
        let b = this.a;
        this.a = a;
        if (b != this.a) {
            this.t("Owner", b, this.a);
        }
    }
    get n() {
        return this.i;
    }
    set n(a) {
        let b = this.i;
        this.i = a;
        if (b != this.i) {
            this.t("Position", b, this.i);
        }
    }
    o(a) {
        if (a > 0 && this.n + (this.r / 2) + a > 1) {
            a = 1 - (this.n + (this.r / 2));
        }
        if (a < 0 && (this.n - (this.r / 2)) + a < 0) {
            a = (this.n - (this.r / 2)) * -1;
        }
        this.f.i += a;
        this.e.i += a;
        this.n += a;
        return a;
    }
    p(a) {
        a = this.k(a);
        let b = this.n - this.r / 2;
        this.r += a;
        this.n = b + this.r / 2;
        return a;
    }
    k(a) {
        if (a < 0) {
            let b = this.r + a;
            if (b < this.m) {
                b = this.m;
                a = (b - this.r);
            }
        }
        if (a > 0) {
            let c = this.r + a;
            if (c > this.l) {
                c = this.l;
                a = (c - this.r);
            }
        }
        return a;
    }
    q(a) {
        a = -1 * this.k(a * -1);
        let b = this.n + this.r / 2;
        this.r -= a;
        this.n = b - this.r / 2;
        return a;
    }
    get r() {
        return this.j;
    }
    set r(a) {
        let b = this.j;
        this.j = a;
        if (b != this.j) {
            this.t("Width", b, this.j);
        }
    }
    get m() {
        return this.h;
    }
    set m(a) {
        let b = this.h;
        this.h = a;
        if (b != this.h) {
            this.t("MinWidth", b, this.h);
        }
    }
    get l() {
        return this.g;
    }
    set l(a) {
        let b = this.g;
        this.g = a;
        if (b != this.g) {
            this.t("MaxWidth", b, this.g);
        }
    }
    get f() {
        return this.d;
    }
    set f(a) {
        let b = this.d;
        this.d = a;
        if (b != this.d) {
            this.t("LowerThumb", b, this.d);
        }
    }
    get e() {
        return this.c;
    }
    set e(a) {
        let b = this.c;
        this.c = a;
        if (b != this.c) {
            this.t("HigherThumb", b, this.c);
        }
    }
}
TrackThumbRange.$t = markType(TrackThumbRange, 'TrackThumbRange', Base.$, [INotifyPropertyChanged_$type]);
export class TrackThumb extends Base {
    constructor() {
        super(...arguments);
        this.g = 0;
        this.h = 0;
        this.c = 1;
        this.e = null;
        this.a = null;
        this.propertyChanged = null;
    }
    get b() {
        return this.a;
    }
    set b(a) {
        let b = this.a;
        this.a = a;
        if (b != this.a) {
            this.m("Owner", b, this.a);
        }
    }
    m(a, b, c) {
        this.n(a, b, c);
        if (this.propertyChanged != null) {
            this.propertyChanged(this, new PropertyChangedEventArgs(a));
        }
    }
    n(a, b, c) {
        this.l();
    }
    j(a) {
        if (this.i + a > 1) {
            a = 1 - this.i;
        }
        if (this.i + a < 0) {
            a = -this.i;
        }
        if (this.f != null) {
            if (this.d == 0) {
                a = this.f.q(a);
            }
            else {
                a = this.f.p(a);
            }
        }
        this.i += a;
        return a;
    }
    l() {
        if (this.b == null) {
            return;
        }
        this.b.trackDirty();
    }
    get i() {
        return this.g;
    }
    set i(a) {
        let b = this.g;
        this.g = a;
        if (b != this.g) {
            this.m("Position", b, this.g);
        }
    }
    get k() {
        return this.h;
    }
    set k(a) {
        let b = this.h;
        this.h = a;
        if (b != this.h) {
            this.m("Width", b, this.h);
        }
    }
    get d() {
        return this.c;
    }
    set d(a) {
        let b = this.c;
        this.c = a;
        if (b != this.c) {
            this.m("RangePosition", enumGetBox(ThumbRangePosition_$type, b), enumGetBox(ThumbRangePosition_$type, this.c));
        }
    }
    get f() {
        return this.e;
    }
    set f(a) {
        let b = this.e;
        this.e = a;
        if (b != this.e) {
            this.m("Range", b, this.e);
        }
    }
}
TrackThumb.$t = markType(TrackThumb, 'TrackThumb', Base.$, [INotifyPropertyChanged_$type]);
