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