/*
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, Type, enumGetBox, EnumUtil, markType } from "./type";
import { BaseControlTheme_$type } from "./BaseControlTheme";
import { NativeUICursor_$type } from "./NativeUICursor";
import { Visibility_$type } from "./Visibility";
import { INativeUIElementFactory_$type } from "./INativeUIElementFactory";
import { List$1 } from "./List$1";
import { NativeUI } from "./NativeUI";
/**
 * @hidden
 */
export let INativeUIElementBridge_$type = new Type(null, 'INativeUIElementBridge');
/**
 * @hidden
 */
export let INativeUIContainerBridge_$type = new Type(null, 'INativeUIContainerBridge', null, [INativeUIElementBridge_$type]);
/**
 * @hidden
 */
export let NativeUIComponent = /*@__PURE__*/ (() => {
    class NativeUIComponent extends Base {
        constructor() {
            super(...arguments);
            this.j = null;
            this.am = null;
            this.d = null;
            this.al = null;
            this.p = null;
            this.r = null;
            this.l = null;
            this.m = null;
        }
        ax() {
            if (this.j != null) {
                this.j.bl(this);
            }
        }
        bb(a) {
            return this.d.getDesiredSize(this.al, a);
        }
        ba() {
            return this.d.getBoundingRect(this.al);
        }
        t(a) {
            return this.d.contains(this.al, a);
        }
        aw() {
            this.d.focus(this.al);
        }
        get_e() {
            return 8;
        }
        get e() {
            return this.get_e();
        }
        get ak() {
            return this.d.getMethodTarget(this.al);
        }
        static ap(a) {
            if (!NativeUIComponent.v.contains(a)) {
                NativeUIComponent.v.add(a);
            }
        }
        static a(a, b) {
            let c = new List$1(INativeUIElementFactory_$type, 0);
            let d = new List$1(INativeUIElementFactory_$type, 0);
            for (let e = 0; e < a.length; e++) {
                let f = a[e];
                let g = b[e];
                for (let h = 0; h < NativeUIComponent.v.count; h++) {
                    if (NativeUIComponent.v._inner[h].flavor == g) {
                        d.add(NativeUIComponent.v._inner[h]);
                    }
                }
                for (let i = 0; i < d.count; i++) {
                    if (d._inner[i].supportsComponent(f)) {
                        c.add(d._inner[i]);
                        break;
                    }
                }
                if (c.count - 1 == e) {
                    d.clear();
                    continue;
                }
                for (let j = 0; j < NativeUIComponent.v.count; j++) {
                    if (NativeUIComponent.v._inner[j].supportsComponent(f)) {
                        c.add(NativeUIComponent.v._inner[j]);
                        break;
                    }
                }
                if (c.count - 1 != e) {
                    c.add(null);
                }
                d.clear();
            }
            return c.toArray();
        }
        static aq(a, b, c, d) {
            let e = NativeUIComponent.a([b], [c]);
            if (e.length > 0 && e[0] != null) {
                e[0].createComponent(a, b, d);
            }
        }
        static ar(a, b, c) {
            NativeUIComponent.aq(a, b, 0, c);
        }
        static as(a, b, c, d) {
            let e = 0;
            let f = new Array(b.length);
            let g = NativeUIComponent.a(b, c);
            for (let h = 0; h < g.length; h++) {
                let i = g[h];
                let j = b[h];
                if (i != null) {
                    i.createComponent(a, j, (k) => {
                        f[h] = k;
                        e++;
                        if (e == b.length) {
                            d(f);
                        }
                    });
                }
                else {
                    f[h] = null;
                    e++;
                    if (e == b.length) {
                        d(f);
                    }
                }
            }
        }
        static at(a, b, c) {
            let d = new Array(b.length);
            for (let e = 0; e < d.length; e++) {
                d[e] = 0;
            }
            NativeUIComponent.as(a, b, d, c);
        }
        static au(a, b, c, d) {
            let e = NativeUIComponent.a([b], [c]);
            if (e.length > 0 && e[0] != null) {
                e[0].createComponentSync(a, b, d);
            }
        }
        static av(a, b, c) {
            NativeUIComponent.au(a, b, 0, c);
        }
        aj(a) {
            return this.d.getTargetForProperty(a, this.al);
        }
        ag(a) {
            let b = this.aj(a);
            return NativeUI.k(a, b);
        }
        a2(a, b) {
            let c = this.aj(a);
            NativeUI.ae(a, c, b);
        }
        ae(a) {
            let b = this.ai(a);
            return this.af(b, a);
        }
        a0(a, b) {
            let c = this.ai(a);
            this.a1(c, a, b);
        }
        an(a, b) {
            let c = this.ah(a);
            this.ao(c, this, a, b);
        }
        ao(a, b, c, d) {
            this.d.addHandler(a, b, c, d);
        }
        ay(a, b) {
            let c = this.ah(a);
            this.az(c, this, a, b);
        }
        az(a, b, c, d) {
            this.d.removeHandler(a, b, c, d);
        }
        af(a, b) {
            return this.d.getValue(a, b);
        }
        a1(a, b, c) {
            this.d.setValue(a, b, c);
        }
        ai(a) {
            let b = this.al;
            b = this.d.getTargetForBuildInProperty(b, a);
            return b;
        }
        ah(a) {
            let b = this.al;
            b = this.d.getTargetForBuildInEvent(b, a);
            return b;
        }
        get ad() {
            return this.ag(9);
        }
        set ad(a) {
            this.a2(9, a);
        }
        get x() {
            return this.ag(10);
        }
        set x(a) {
            this.a2(10, a);
        }
        get z() {
            return this.ag(1);
        }
        set z(a) {
            this.a2(1, a);
        }
        get c() {
            let a = this.ae(18);
            return EnumUtil.getEnumValue(BaseControlTheme_$type, a);
        }
        set c(a) {
            this.a0(18, enumGetBox(BaseControlTheme_$type, a));
        }
        get a4() {
            return this.ag(2);
        }
        set a4(a) {
            this.a2(2, a);
        }
        get a5() {
            return this.ag(3);
        }
        set a5(a) {
            this.a2(3, a);
        }
        get bc() {
            return this.ag(4);
        }
        set bc(a) {
            this.a2(4, a);
        }
        get a3() {
            return this.ag(5);
        }
        set a3(a) {
            this.a2(5, a);
        }
        get be() {
            return this.ag(6);
        }
        set be(a) {
            this.a2(6, a);
        }
        get a6() {
            return this.ag(7);
        }
        set a6(a) {
            this.a2(7, a);
        }
        get w() {
            return this.ag(8);
        }
        set w(a) {
            this.a2(8, a);
        }
        get y() {
            return this.ag(11);
        }
        set y(a) {
            this.a2(11, a);
        }
        get ac() {
            return this.ag(12);
        }
        set ac(a) {
            this.a2(12, a);
        }
        get bd() {
            return this.ag(13);
        }
        set bd(a) {
            this.a2(13, a);
        }
        get a9() {
            return this.ag(14);
        }
        set a9(a) {
            this.a2(14, a);
        }
        get a8() {
            return this.ag(15);
        }
        set a8(a) {
            this.a2(15, a);
        }
        get a7() {
            return this.ag(16);
        }
        set a7(a) {
            this.a2(16, a);
        }
        get ab() {
            return this.ag(17);
        }
        set ab(a) {
            this.a2(17, a);
        }
        get b() {
            return this.ag(18);
        }
        set b(a) {
            this.a2(18, a);
        }
        get aa() {
            return this.ag(19);
        }
        set aa(a) {
            this.a2(19, a);
        }
        get f() {
            return this.d.getHorizontalAlignment(this.al);
        }
        set f(a) {
            this.d.setHorizontalAlignment(this.al, a);
        }
        get h() {
            return this.d.getVerticalAlignment(this.al);
        }
        set h(a) {
            this.d.setVerticalAlignment(this.al, a);
        }
        get g() {
            return this.d.getHorizontalContentAlignment(this.al);
        }
        set g(a) {
            this.d.setHorizontalContentAlignment(this.al, a);
        }
        get i() {
            return this.d.getVerticalContentAlignment(this.al);
        }
        set i(a) {
            this.d.setVerticalContentAlignment(this.al, a);
        }
        get k() {
            return EnumUtil.getEnumValue(NativeUICursor_$type, this.ag(20));
        }
        set k(a) {
            this.a2(20, enumGetBox(NativeUICursor_$type, a));
        }
        get_u() {
            return this.ag(21);
        }
        set_u(a) {
            this.a2(21, a);
        }
        get u() {
            return this.get_u();
        }
        set u(a) {
            this.set_u(a);
        }
        get bf() {
            return EnumUtil.getEnumValue(Visibility_$type, this.ag(24));
        }
        set bf(a) {
            this.a2(24, enumGetBox(Visibility_$type, a));
        }
        get q() {
            return this.p;
        }
        set q(a) {
            let b = this.p;
            this.p = a;
            if (this.p != null) {
                this.an(7, this.p);
            }
            else {
                this.ay(7, b);
            }
        }
        get s() {
            return this.r;
        }
        set s(a) {
            let b = this.r;
            this.r = a;
            if (this.r != null) {
                this.an(8, this.r);
            }
            else {
                this.ay(8, b);
            }
        }
        get n() {
            return this.l;
        }
        set n(a) {
            let b = this.l;
            this.l = a;
            if (this.l != null) {
                this.an(12, this.l);
            }
            else {
                this.ay(12, b);
            }
        }
        get o() {
            return this.m;
        }
        set o(a) {
            let b = this.m;
            this.m = a;
            if (this.m != null) {
                this.an(13, this.m);
            }
            else {
                this.ay(13, b);
            }
        }
    }
    NativeUIComponent.$t = markType(NativeUIComponent, 'NativeUIComponent');
    NativeUIComponent.v = new List$1(INativeUIElementFactory_$type, 0);
    return NativeUIComponent;
})();
/**
 * @hidden
 */
export let NativeUIContainer = /*@__PURE__*/ (() => {
    class NativeUIContainer extends NativeUIComponent {
        get bi() {
            return this.bg.getChildrenCount(this.ak);
        }
        get bg() {
            return this.d;
        }
        bh(a) {
            return this.bg.getChildAt(this.ak, a);
        }
        bm(a) {
            let b = this.bh(a);
            if (b != null) {
                b.j = null;
            }
            this.bg.removeChildAt(this.ak, a);
        }
        bj(a) {
            a.j = this;
            this.bg.addChild(this.ak, a);
        }
        bk(a, b) {
            b.j = this;
            this.bg.insertChild(this.ak, a, b);
        }
        bl(a) {
            a.j = null;
            this.bg.removeChild(this.ak, a);
        }
    }
    NativeUIContainer.$t = markType(NativeUIContainer, 'NativeUIContainer', NativeUIComponent.$);
    return NativeUIContainer;
})();
