/*
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 { Base, runOn, markType } from "./type";
import { VersionQueueHelper } from "./VersionQueueHelper";
/**
 * @hidden
 */
export let GlobalAnimationState = /*@__PURE__*/ (() => {
    class GlobalAnimationState extends Base {
        constructor() {
            super();
            this.h = 0;
            this.a = null;
            this.f = false;
            this.e = new VersionQueueHelper();
        }
        static get d() {
            if (GlobalAnimationState.c == null) {
                GlobalAnimationState.c = new GlobalAnimationState();
            }
            return GlobalAnimationState.c;
        }
        p(a) {
            this.a = a;
            this.e.l(a);
        }
        b() {
            if (this.a != null) {
                return this.a;
            }
            return null;
        }
        l() {
            this.h++;
        }
        k() {
            if (this.h > 0) {
                this.h--;
            }
            if (this.h <= 0) {
                this.h = 0;
                this.o();
            }
        }
        o() {
            if (this.f) {
                return;
            }
            let a = this.b();
            if (a == null) {
                this.e.h();
                return;
            }
            a.executeDelayed(runOn(this, this.j), 0);
            this.f = true;
        }
        j() {
            if (this.h <= 0) {
                this.h = 0;
                this.e.h();
            }
            this.f = false;
        }
        m(a, b) {
            this.e.j(a, b);
        }
        n(a, b, c) {
            this.e.k(a, b, c);
        }
        i() {
            return this.e.f();
        }
        g() {
            return this.h > 0;
        }
    }
    GlobalAnimationState.$t = markType(GlobalAnimationState, 'GlobalAnimationState');
    GlobalAnimationState.c = null;
    return GlobalAnimationState;
})();
