/*
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 * as tslib_1 from "tslib";
import { INotifyPropertyChanged_$type, PropertyChangedEventArgs, Base, markType, enumGetBox } from "igniteui-react-core/ES5/type";
import { ThumbRangePosition_$type } from "./ThumbRangePosition";
var TrackThumbRange = /** @class */ (function (_super) {
    tslib_1.__extends(TrackThumbRange, _super);
    function TrackThumbRange() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.i = 0;
        _this.j = 0;
        _this.h = 0;
        _this.g = 1;
        _this.d = null;
        _this.c = null;
        _this.a = null;
        _this.propertyChanged = null;
        return _this;
    }
    TrackThumbRange.prototype.t = function (a, b, c) {
        this.u(a, b, c);
        if (this.propertyChanged != null) {
            this.propertyChanged(this, new PropertyChangedEventArgs(a));
        }
    };
    TrackThumbRange.prototype.u = function (a, b, c) {
        this.s();
    };
    TrackThumbRange.prototype.s = function () {
        if (this.b == null) {
            return;
        }
        this.b.trackDirty();
    };
    Object.defineProperty(TrackThumbRange.prototype, "b", {
        get: function () {
            return this.a;
        },
        set: function (a) {
            var b = this.a;
            this.a = a;
            if (b != this.a) {
                this.t("Owner", b, this.a);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(TrackThumbRange.prototype, "n", {
        get: function () {
            return this.i;
        },
        set: function (a) {
            var b = this.i;
            this.i = a;
            if (b != this.i) {
                this.t("Position", b, this.i);
            }
        },
        enumerable: true,
        configurable: true
    });
    TrackThumbRange.prototype.o = function (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;
    };
    TrackThumbRange.prototype.p = function (a) {
        a = this.k(a);
        var b = this.n - this.r / 2;
        this.r += a;
        this.n = b + this.r / 2;
        return a;
    };
    TrackThumbRange.prototype.k = function (a) {
        if (a < 0) {
            var b = this.r + a;
            if (b < this.m) {
                b = this.m;
                a = (b - this.r);
            }
        }
        if (a > 0) {
            var c = this.r + a;
            if (c > this.l) {
                c = this.l;
                a = (c - this.r);
            }
        }
        return a;
    };
    TrackThumbRange.prototype.q = function (a) {
        a = -1 * this.k(a * -1);
        var b = this.n + this.r / 2;
        this.r -= a;
        this.n = b - this.r / 2;
        return a;
    };
    Object.defineProperty(TrackThumbRange.prototype, "r", {
        get: function () {
            return this.j;
        },
        set: function (a) {
            var b = this.j;
            this.j = a;
            if (b != this.j) {
                this.t("Width", b, this.j);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(TrackThumbRange.prototype, "m", {
        get: function () {
            return this.h;
        },
        set: function (a) {
            var b = this.h;
            this.h = a;
            if (b != this.h) {
                this.t("MinWidth", b, this.h);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(TrackThumbRange.prototype, "l", {
        get: function () {
            return this.g;
        },
        set: function (a) {
            var b = this.g;
            this.g = a;
            if (b != this.g) {
                this.t("MaxWidth", b, this.g);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(TrackThumbRange.prototype, "f", {
        get: function () {
            return this.d;
        },
        set: function (a) {
            var b = this.d;
            this.d = a;
            if (b != this.d) {
                this.t("LowerThumb", b, this.d);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(TrackThumbRange.prototype, "e", {
        get: function () {
            return this.c;
        },
        set: function (a) {
            var b = this.c;
            this.c = a;
            if (b != this.c) {
                this.t("HigherThumb", b, this.c);
            }
        },
        enumerable: true,
        configurable: true
    });
    TrackThumbRange.$t = markType(TrackThumbRange, 'TrackThumbRange', Base.$, [INotifyPropertyChanged_$type]);
    return TrackThumbRange;
}(Base));
export { TrackThumbRange };
var TrackThumb = /** @class */ (function (_super) {
    tslib_1.__extends(TrackThumb, _super);
    function TrackThumb() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.g = 0;
        _this.h = 0;
        _this.c = 1;
        _this.e = null;
        _this.a = null;
        _this.propertyChanged = null;
        return _this;
    }
    Object.defineProperty(TrackThumb.prototype, "b", {
        get: function () {
            return this.a;
        },
        set: function (a) {
            var b = this.a;
            this.a = a;
            if (b != this.a) {
                this.m("Owner", b, this.a);
            }
        },
        enumerable: true,
        configurable: true
    });
    TrackThumb.prototype.m = function (a, b, c) {
        this.n(a, b, c);
        if (this.propertyChanged != null) {
            this.propertyChanged(this, new PropertyChangedEventArgs(a));
        }
    };
    TrackThumb.prototype.n = function (a, b, c) {
        this.l();
    };
    TrackThumb.prototype.j = function (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;
    };
    TrackThumb.prototype.l = function () {
        if (this.b == null) {
            return;
        }
        this.b.trackDirty();
    };
    Object.defineProperty(TrackThumb.prototype, "i", {
        get: function () {
            return this.g;
        },
        set: function (a) {
            var b = this.g;
            this.g = a;
            if (b != this.g) {
                this.m("Position", b, this.g);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(TrackThumb.prototype, "k", {
        get: function () {
            return this.h;
        },
        set: function (a) {
            var b = this.h;
            this.h = a;
            if (b != this.h) {
                this.m("Width", b, this.h);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(TrackThumb.prototype, "d", {
        get: function () {
            return this.c;
        },
        set: function (a) {
            var b = this.c;
            this.c = a;
            if (b != this.c) {
                this.m("RangePosition", enumGetBox(ThumbRangePosition_$type, b), enumGetBox(ThumbRangePosition_$type, this.c));
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(TrackThumb.prototype, "f", {
        get: function () {
            return this.e;
        },
        set: function (a) {
            var b = this.e;
            this.e = a;
            if (b != this.e) {
                this.m("Range", b, this.e);
            }
        },
        enumerable: true,
        configurable: true
    });
    TrackThumb.$t = markType(TrackThumb, 'TrackThumb', Base.$, [INotifyPropertyChanged_$type]);
    return TrackThumb;
}(Base));
export { TrackThumb };
