/*
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, IList_$type, NotSupportedException, String_$type, typeCast, Boolean_$type, markType, fromEn, fromEnum, Number_$type, runOn, Array_$type } from "./type";
import { CodeGeneratingRendererResult } from "./CodeGeneratingRendererResult";
import { CodeGeneratingCodeWriter } from "./CodeGeneratingCodeWriter";
import { Stack$1 } from "./Stack$1";
import { CodeGenerationItemBuilderPropertyInfo } from "./CodeGenerationItemBuilderPropertyInfo";
import { List$1 } from "./List$1";
import { TypeDescriptionContext } from "./TypeDescriptionContext";
import { CodeGenerationSpecialValue } from "./CodeGenerationSpecialValue";
import { ColorUtil } from "./ColorUtil";
import { StringBuilder } from "./StringBuilder";
import { CodeGeneratingImportManager } from "./CodeGeneratingImportManager";
import { stringIsNullOrEmpty, stringReplace, stringEndsWith, stringStartsWith, stringContains } from "./string";
import { HashSet$1 } from "./HashSet$1";
import { CodeGeneratingComponentRendererDataEmitter } from "./CodeGeneratingComponentRendererDataEmitter";
import { Dictionary$2 } from "./Dictionary$2";
import { JsonDictionaryObject } from "./JsonDictionaryObject";
import { JsonDictionaryArray } from "./JsonDictionaryArray";
import { ComponentRenderer } from "./ComponentRenderer";
import { TSCodeGeneratingComponentRendererHandlerEmitter } from "./TSCodeGeneratingComponentRendererHandlerEmitter";
import { DotNetCodeGeneratingComponentRendererHandlerEmitter } from "./DotNetCodeGeneratingComponentRendererHandlerEmitter";
import { TSCodeGeneratingComponentRendererModuleEmitter } from "./TSCodeGeneratingComponentRendererModuleEmitter";
import { DotNetCodeGeneratingComponentRendererModuleEmitter } from "./DotNetCodeGeneratingComponentRendererModuleEmitter";
import { CodeGenerationTransformer } from "./CodeGenerationTransformer";
import { LinearGradientBrush } from "./LinearGradientBrush";
import { IComponentRendererAdapter_$type } from "./IComponentRendererAdapter";
/**
 * @hidden
 */
export let CodeGeneratingComponentRendererCodeEmitter = /*@__PURE__*/ (() => {
    class CodeGeneratingComponentRendererCodeEmitter extends Base {
        constructor(a, b) {
            super();
            this.k = null;
            this.i = null;
            this.r = new List$1(CodeGenerationItemBuilderPropertyInfo.$, 0);
            this.d = null;
            this.a = null;
            this.c = null;
            this.b = null;
            this.s = new List$1(String_$type, 0);
            this.v = new Stack$1(String_$type);
            this.t = new Stack$1(String_$type);
            this.u = new Stack$1(Boolean_$type);
            this.ao = null;
            this.k = a;
            this.i = b;
            this.d = new CodeGeneratingCodeWriter(this.k);
            this.a = new CodeGeneratingCodeWriter(this.k);
            this.c = new CodeGeneratingCodeWriter(this.k);
            this.b = new CodeGeneratingCodeWriter(this.k);
        }
        a6(a) {
            this.i.ab(a);
        }
        get j() {
            return this.i;
        }
        get h() {
            return this.d;
        }
        get e() {
            return this.a;
        }
        get g() {
            return this.c;
        }
        get f() {
            return this.b;
        }
        ar(a) {
            this.s.add(a);
        }
        n(a) {
            if (a.b != null && (a.b.knownType == 20 || a.b.knownType == 19 || a.b.knownType == 18)) {
                if (a.a != null) {
                    return true;
                }
            }
            return false;
        }
        get ac() {
            return this.v.d();
        }
        as(a) {
            this.v.h(a);
        }
        a5() {
        }
        a0(a) {
            this.v.e();
        }
        ay(a, b, c, d) {
        }
        az(a, b, c, d) {
            this.ay(a, b, c, d);
        }
        toString() {
            return this.d.toString();
        }
        ak() {
            return "null";
        }
        an(a, b) {
            if (a.b == null) {
                return a.c;
            }
            if (typeCast(CodeGenerationSpecialValue.$, a.c) !== null) {
                a.c = this.w(a);
            }
            switch (a.b.knownType) {
                case 10: return this.ad(a);
                case 7: return a.c ? "true" : "false";
                case 4: return this.y(a);
                case 6:
                    {
                        let c = "";
                        let d = a.c;
                        for (let e = 0; e < d.count; e++) {
                            if (e >= 1) {
                                c += " ";
                            }
                            c += this.x(d.item(e));
                        }
                        return c;
                    }
                    break;
                case 9: throw new NotSupportedException(1, "shouldn't get here");
                case 5: return this.aa(a);
                case 16:
                    {
                        let f = "";
                        let g = a.c;
                        for (let h = 0; h < g.count; h++) {
                            if (h >= 1) {
                                f += " ";
                            }
                            f += this.z(g.item(h));
                        }
                        return f;
                    }
                    break;
                case 20:
                    if (a.a != null) {
                        return this.am(a);
                    }
                    if (a.c == null) {
                        return this.ak();
                    }
                    break;
                case 15: throw new NotSupportedException(1, "need to figure this out");
                case 3: throw new NotSupportedException(1, "need to figure this out");
                case 19:
                    if (a.a != null) {
                        return this.ah(a);
                    }
                    else {
                        return this.ak();
                    }
                    break;
                case 8:
                    if (a.b.specificExternalType == "string") {
                        return this.ag(a);
                    }
                    if (a.a != null) {
                        return this.ai(a);
                    }
                    throw new NotSupportedException(1, "shouldn't get here");
                case 13: throw new NotSupportedException(1, "shouldn't get here");
                case 18:
                    if (a.a != null) {
                        return this.aj(a);
                    }
                    else {
                        return this.ak();
                    }
                    break;
                case 1: return a.c.toString();
                case 11:
                    {
                        let i = a.c;
                        return i.x + ", " + i.y;
                    }
                case 14:
                    {
                        let j = a.c;
                        return j.left + ", " + j.top + ", " + j.width + ", " + j.height;
                    }
                case 12:
                    {
                        let k = a.c;
                        return k.width + ", " + k.height;
                    }
                case 2: return a.c != null ? a.c.toString() : this.ak();
                case 21: return a.c.toString();
                case 17:
                    if (a.c == null) {
                        return "null";
                    }
                    if (typeof a.c === 'string') {
                        return a.c.toString();
                    }
                    return a.c.toString();
                case 0: throw new NotSupportedException(1, "shouldn't get here");
            }
            return "";
        }
        ad(a) {
            return "";
        }
        w(a) {
            return a.c;
        }
        am(a) {
            if (!stringIsNullOrEmpty(a.a.e)) {
                if (a.a.a) {
                    return this.af(a);
                }
                else {
                    return this.al(a);
                }
            }
            return this.ak();
        }
        al(a) {
            return "";
        }
        af(a) {
            return "";
        }
        ai(a) {
            if (!stringIsNullOrEmpty(a.a.e)) {
                return a.a.e;
            }
            return this.ak();
        }
        ag(a) {
            return a.c != null ? a.c.toString() : "";
        }
        aj(a) {
            return this.ah(a);
        }
        ah(a) {
            if (!stringIsNullOrEmpty(a.a.e)) {
                this.a6(a);
                return a.a.e;
            }
            return this.ak();
        }
        get_p() {
            return false;
        }
        get p() {
            return this.get_p();
        }
        aa(a) {
            let b = a.c;
            return ColorUtil.i(b, this.p);
        }
        z(a) {
            let b = a;
            return ColorUtil.i(b, this.p);
        }
        y(a) {
            if (a.c == null) {
                return "";
            }
            let b = a.c;
            return ColorUtil.i(b.color, this.p);
        }
        x(a) {
            if (a == null) {
                return "";
            }
            let b = a;
            return ColorUtil.i(b.color, this.p);
        }
        a4(a) {
            this.t.h(a);
            this.u.h(false);
        }
        a3(a) {
            let b = this.ae(a);
            this.t.h(b);
            this.u.h(true);
        }
        ae(a) {
            let b = stringReplace(stringReplace(a, this.ap, ""), "Component", "");
            b = CodeGeneratingComponentRenderer.dn(b);
            return this.i.s(b);
        }
        a1() {
            this.t.e();
            this.u.e();
        }
        get_ap() {
            return "";
        }
        get ap() {
            return this.get_ap();
        }
        get ab() {
            if (this.t.f > 0) {
                return this.t.d();
            }
            let a = stringReplace(stringReplace(this.ac, this.ap, ""), "Component", "");
            return CodeGeneratingComponentRenderer.dn(a);
        }
        get o() {
            return this.v.f == 1;
        }
        get l() {
            if (this.u.f == 0) {
                return false;
            }
            return this.u.d();
        }
        get m() {
            if (this.t.f > 0) {
                return true;
            }
            return false;
        }
        get_q() {
            return true;
        }
        get q() {
            return this.get_q();
        }
        a2() {
            this.t.e();
        }
        au(a) {
            let b = this.f.toString();
            if (b.length > 0) {
                a.l(b);
            }
        }
        ax(a) {
            let b = this.g.toString();
            if (b.length > 0) {
                a.l(b);
            }
        }
        at(a) {
            let b = this.e.toString();
            if (b.length > 0) {
                a.l(b);
            }
        }
        av(a) {
            if (this.s.count > 0) {
                this.aw(this.s, a);
            }
        }
        aw(a, b) {
        }
    }
    CodeGeneratingComponentRendererCodeEmitter.$t = markType(CodeGeneratingComponentRendererCodeEmitter, 'CodeGeneratingComponentRendererCodeEmitter');
    return CodeGeneratingComponentRendererCodeEmitter;
})();
/**
 * @hidden
 */
export let ReactMarkupCodeGeneratingComponentRendererCodeEmitter = /*@__PURE__*/ (() => {
    class ReactMarkupCodeGeneratingComponentRendererCodeEmitter extends CodeGeneratingComponentRendererCodeEmitter {
        constructor(a, b) {
            super(a, b);
            this.a7 = new HashSet$1(String_$type, 0);
            this.a8 = new HashSet$1(String_$type, 0);
        }
        ad(a) {
            if (a.c == null) {
                return "{null}";
            }
            let b = a.c;
            let c = "[";
            for (let d = 0; d < b.length; d++) {
                if (d > 0) {
                    c += ", ";
                }
                c += "\"" + b[d].toString() + "\"";
            }
            c += "]";
            return c;
        }
        get_p() {
            return true;
        }
        get_ap() {
            return "Igr";
        }
        as(a) {
            super.as(a);
            this.h.k("<" + this.ba(a) + "");
            this.h.h();
            if (!this.a7.contains(this.ab)) {
                this.a7.add_1(this.ab);
                if (!this.a8.contains(this.ac)) {
                    this.a8.add_1(this.ac);
                    this.ar(this.ac);
                }
                this.f.k("private " + CodeGeneratingComponentRenderer.dn(this.ab) + ": " + this.ac);
                if (this.o) {
                    this.f.k("private " + CodeGeneratingComponentRenderer.dn(this.ab) + "Ref(r: " + this.ac + ") {");
                    this.f.h();
                    this.f.k("this." + CodeGeneratingComponentRenderer.dn(this.ab) + " = r;");
                    this.f.k("this.setState({});");
                    this.f.f();
                    this.f.k("}");
                    this.g.k("this." + CodeGeneratingComponentRenderer.dn(this.ab) + "Ref = " + "this." + CodeGeneratingComponentRenderer.dn(this.ab) + "Ref.bind(this);");
                }
            }
        }
        ba(a) {
            if (stringEndsWith(a, "Component")) {
                a = a.substr(0, a.length - ("Component").length);
            }
            return CodeGeneratingComponentRenderer.dp(a);
        }
        a5() {
            if (!this.o && !this.m) {
                let a = this.a9();
                this.h.k("");
                this.h.k("name=\"" + a + "\"");
            }
            this.h.f();
            this.h.k(">");
            this.h.h();
        }
        a9() {
            let a = CodeGeneratingComponentRenderer.dn(stringReplace(stringReplace(this.ac, this.ap, ""), "Component", ""));
            a = this.j.r(a);
            return a;
        }
        ah(a) {
            if (!stringIsNullOrEmpty(a.a.e)) {
                this.a6(a);
                if (!this.a7.contains(a.a.e)) {
                    this.g.k("this." + CodeGeneratingComponentRenderer.dn(a.a.e) + " = " + "this." + CodeGeneratingComponentRenderer.dn(a.a.e) + ".bind(this);");
                }
                return "this." + CodeGeneratingComponentRenderer.dn(a.a.e);
            }
            return this.ak();
        }
        a0(a) {
            this.h.f();
            this.h.k("</" + this.ba(a) + ">");
            super.a0(a);
        }
        ay(a, b, c, d) {
            let e = CodeGeneratingComponentRenderer.dn(b);
            let f = this.an(c, true);
            if (c.b != null && d.h(c.b.owningType, CodeGeneratingComponentRenderer.dp(c.b.propertyName)) && this.n(c)) {
                this.a6(c);
                if (a > 0) {
                    this.h.k("");
                }
                if (c.a == null || c.a.e == null) {
                    this.h.j(e + "Name={null}");
                }
                else {
                    this.h.j(e + "Name=\"" + c.a.e + "\"");
                }
                return;
            }
            if (!(e == "name") || !this.o) {
                let g = (c.b != null && c.b.knownType == 10);
                if (this.n(c) || g) {
                    this.a6(c);
                    f = "{" + f + "}";
                }
                if (a > 0) {
                    this.h.k("");
                }
                this.h.j(e);
                this.h.j("=");
                if (!this.n(c) && !g) {
                    this.h.j("\"");
                }
                this.h.j(f);
                if (!this.n(c) && !g) {
                    this.h.j("\"");
                }
                a++;
            }
            if (e == "name") {
                if (this.o) {
                    if (a > 0) {
                        this.h.k("");
                    }
                    this.h.j("ref={this." + CodeGeneratingComponentRenderer.dn(this.an(c, true)) + "Ref}");
                }
            }
        }
        w(a) {
            let b = a.c;
            switch (b.a) {
                case 3: return b.b;
                case 0: return b.b;
                case 1: return b.b;
                case 2: return b.b;
            }
            return b.b;
        }
        ak() {
            return "null";
        }
        af(a) {
            return "this." + CodeGeneratingComponentRenderer.dn(a.a.e);
        }
        al(a) {
            return "this." + CodeGeneratingComponentRenderer.dn(a.a.e);
        }
        az(a, b, c, d) {
            if (c.b.knownType == 9) {
                let e = typeCast(IList_$type, c.c);
                if (e != null) {
                    for (let f of fromEn(e)) {
                        if (typeCast(CodeGenerationItemBuilder.$, f) !== null) {
                            let g = f;
                            g.p(this, false);
                        }
                    }
                }
            }
            else {
                if (typeCast(CodeGenerationItemBuilder.$, c.c) !== null) {
                    let h = c.c;
                    h.p(this, false);
                }
            }
        }
        aw(a, b) {
            super.aw(a, b);
            for (let c of fromEnum(a)) {
                b.addPackageImport("igniteui-react-" + this.ao, c);
            }
        }
    }
    ReactMarkupCodeGeneratingComponentRendererCodeEmitter.$t = markType(ReactMarkupCodeGeneratingComponentRendererCodeEmitter, 'ReactMarkupCodeGeneratingComponentRendererCodeEmitter', CodeGeneratingComponentRendererCodeEmitter.$);
    return ReactMarkupCodeGeneratingComponentRendererCodeEmitter;
})();
/**
 * @hidden
 */
export let ReactCodeBehindCodeGeneratingComponentRendererCodeEmitter = /*@__PURE__*/ (() => {
    class ReactCodeBehindCodeGeneratingComponentRendererCodeEmitter extends CodeGeneratingComponentRendererCodeEmitter {
        constructor(a, b) {
            super(a, b);
        }
    }
    ReactCodeBehindCodeGeneratingComponentRendererCodeEmitter.$t = markType(ReactCodeBehindCodeGeneratingComponentRendererCodeEmitter, 'ReactCodeBehindCodeGeneratingComponentRendererCodeEmitter', CodeGeneratingComponentRendererCodeEmitter.$);
    return ReactCodeBehindCodeGeneratingComponentRendererCodeEmitter;
})();
/**
 * @hidden
 */
export let WebComponentsMarkupCodeGeneratingComponentRendererCodeEmitter = /*@__PURE__*/ (() => {
    class WebComponentsMarkupCodeGeneratingComponentRendererCodeEmitter extends CodeGeneratingComponentRendererCodeEmitter {
        constructor(a, b) {
            super(a, b);
            this.a9 = 0;
            this.a7 = new HashSet$1(String_$type, 0);
            this.a8 = new HashSet$1(String_$type, 0);
        }
        ad(a) {
            if (a.c == null) {
                return "null";
            }
            let b = a.c;
            let c = "";
            for (let d = 0; d < b.length; d++) {
                if (d > 0) {
                    c += ", ";
                }
                c += b[d];
            }
            return c;
        }
        get_p() {
            return true;
        }
        as(a) {
            super.as(a);
            this.h.k("<" + this.ba(a) + "");
            if (!this.a7.contains(this.ab)) {
                this.a7.add_1(this.ab);
                if (!this.a8.contains(this.ac)) {
                    this.a8.add_1(this.ac);
                    this.ar(this.ac);
                }
                this.f.k("private " + CodeGeneratingComponentRenderer.dn(this.ab) + ": " + this.ac);
                if (!this.m) {
                    if (this.o) {
                        this.g.k("var " + CodeGeneratingComponentRenderer.dn(this.ab) + " = this." + CodeGeneratingComponentRenderer.dn(this.ab) + " = document.querySelector('" + CodeGeneratingComponentRenderer.dq(stringReplace(this.ac, "Component", "")) + "') as " + this.ac + ";");
                    }
                }
                else {
                    this.g.k("var " + CodeGeneratingComponentRenderer.dn(this.ab) + " = this." + CodeGeneratingComponentRenderer.dn(this.ab) + " = document.getElementById('" + this.ab + "') as " + this.ac + ";");
                }
            }
        }
        ba(a) {
            if (stringEndsWith(a, "Component")) {
                a = a.substr(0, a.length - ("Component").length);
            }
            return CodeGeneratingComponentRenderer.dq(a);
        }
        a5() {
            this.h.k(">");
            this.h.h();
        }
        a0(a) {
            this.h.f();
            this.h.k("</" + this.ba(a) + ">");
            super.a0(a);
        }
        get_ap() {
            return "Igc";
        }
        aw(a, b) {
            super.aw(a, b);
            for (let c of fromEnum(a)) {
                b.addPackageImport("igniteui-webcomponents-" + this.ao, c);
            }
        }
        ay(a, b, c, d) {
            let e = CodeGeneratingComponentRenderer.dn(b);
            if (this.n(c)) {
                this.a6(c);
                if (!this.a7.contains(this.ab)) {
                    this.a7.add_1(this.ab);
                    if (!this.a8.contains(this.ac)) {
                        this.a8.add_1(this.ac);
                        this.ar(this.ac);
                    }
                    this.f.k("private " + CodeGeneratingComponentRenderer.dn(this.ab) + ": " + this.ac);
                    if (!this.m) {
                        if (this.o) {
                            this.g.k("var " + CodeGeneratingComponentRenderer.dn(this.ab) + " = this." + CodeGeneratingComponentRenderer.dn(this.ab) + " = document.querySelector('" + CodeGeneratingComponentRenderer.dq(stringReplace(this.ac, "Component", "")) + "') as " + this.ac + ";");
                        }
                    }
                    else {
                        this.g.k("var " + CodeGeneratingComponentRenderer.dn(this.ab) + " = this." + CodeGeneratingComponentRenderer.dn(this.ab) + " = document.getElementById('" + this.ab + "') as " + this.ac + ";");
                    }
                }
                let f = CodeGeneratingComponentRenderer.dn(this.an(c, true));
                let g = f;
                if (g != "null" && !stringStartsWith(g, "this.")) {
                    g = "this." + g;
                }
                this.e.k(CodeGeneratingComponentRenderer.dn(this.ab) + "." + e + " = " + g);
                return;
            }
            if (a > 0) {
                this.h.k("");
            }
            this.h.j(CodeGeneratingComponentRenderer.dq(e));
            this.h.j("=");
            this.h.j("\"");
            this.h.j(this.an(c, true));
            this.h.j("\"");
            if (e == "name") {
                this.h.k("");
                this.h.j("id =\"" + this.an(c, true) + "\"");
            }
        }
        w(a) {
            let b = a.c;
            switch (b.a) {
                case 3: return b.b;
                case 0: return b.b;
                case 1: return b.b;
                case 2: return b.b;
            }
            return b.b;
        }
        ak() {
            return "null";
        }
        af(a) {
            return CodeGeneratingComponentRenderer.dn(a.a.e);
        }
        al(a) {
            return CodeGeneratingComponentRenderer.dn(a.a.e);
        }
        ah(a) {
            if (!stringIsNullOrEmpty(a.a.e)) {
                this.a6(a);
                if (!this.a7.contains(a.a.e)) {
                    this.g.k("this." + CodeGeneratingComponentRenderer.dn(a.a.e) + " = " + "this." + CodeGeneratingComponentRenderer.dn(a.a.e) + ".bind(this);");
                }
                return "this." + CodeGeneratingComponentRenderer.dn(a.a.e);
            }
            return this.ak();
        }
        az(a, b, c, d) {
            if (c.b.knownType == 9) {
                let e = typeCast(IList_$type, c.c);
                if (e != null) {
                    for (let f of fromEn(e)) {
                        if (typeCast(CodeGenerationItemBuilder.$, f) !== null) {
                            let g = f;
                            g.p(this, false);
                        }
                    }
                }
            }
            else {
                if (typeCast(CodeGenerationItemBuilder.$, c.c) !== null) {
                    let h = c.c;
                    h.p(this, false);
                }
            }
        }
    }
    WebComponentsMarkupCodeGeneratingComponentRendererCodeEmitter.$t = markType(WebComponentsMarkupCodeGeneratingComponentRendererCodeEmitter, 'WebComponentsMarkupCodeGeneratingComponentRendererCodeEmitter', CodeGeneratingComponentRendererCodeEmitter.$);
    return WebComponentsMarkupCodeGeneratingComponentRendererCodeEmitter;
})();
/**
 * @hidden
 */
export let WebComponentsCodeBehindCodeGeneratingComponentRendererCodeEmitter = /*@__PURE__*/ (() => {
    class WebComponentsCodeBehindCodeGeneratingComponentRendererCodeEmitter extends CodeGeneratingComponentRendererCodeEmitter {
        constructor(a, b) {
            super(a, b);
        }
    }
    WebComponentsCodeBehindCodeGeneratingComponentRendererCodeEmitter.$t = markType(WebComponentsCodeBehindCodeGeneratingComponentRendererCodeEmitter, 'WebComponentsCodeBehindCodeGeneratingComponentRendererCodeEmitter', CodeGeneratingComponentRendererCodeEmitter.$);
    return WebComponentsCodeBehindCodeGeneratingComponentRendererCodeEmitter;
})();
/**
 * @hidden
 */
export let TSCodeGeneratingComponentRendererDataEmitter = /*@__PURE__*/ (() => {
    class TSCodeGeneratingComponentRendererDataEmitter extends CodeGeneratingComponentRendererDataEmitter {
        constructor(a, b) {
            super(a, b);
            this.ah = new Dictionary$2(CodeGeneratingCodeWriter.$, Number_$type, 0);
        }
        t(a, b = false) {
            a = CodeGeneratingComponentRenderer.dp(a);
            a = stringReplace(a, "-", "_");
            if (b) {
                a += "Item";
            }
            return a;
        }
        s(a) {
            a = stringReplace(a, "-", "_");
            return CodeGeneratingComponentRenderer.dn(a);
        }
        al(a) {
            a = stringReplace(a, "-", "_");
            return "_" + CodeGeneratingComponentRenderer.dn(a);
        }
        get_q() {
            return ".ts";
        }
        ag(a, b, c, d, e) {
            super.ag(a, b, c, d, e);
            let f = this.p(this.t(a, true), this.t(a, false), b, c);
            for (let g of fromEnum(f)) {
                this.y(g, d, e);
            }
            let h = 0;
            if (e == this.k) {
                e.addPackageImport("./" + this.t(a, false), this.t(a, false));
            }
            else {
                e.addPackageImport("./" + this.t(a, false), this.t(a, false));
            }
            d.k("export class " + this.t(a, false) + " extends Array<" + this.t(a, true) + "> {");
            d.h();
            d.k("public constructor() {");
            d.h();
            d.k("super();");
        }
        ac(a) {
            super.ac(a);
            this.g.k("private " + this.al(a) + ": " + this.t(a, false) + " = null;");
            this.g.k("public get " + this.s(a) + "(): " + this.t(a, false) + " {");
            this.g.h();
            this.g.k("if (this." + this.al(a) + " == null)");
            this.g.k("{");
            this.g.h();
            this.g.k("this." + this.al(a) + " = new " + this.t(a, false) + "();");
            this.g.f();
            this.g.k("}");
            this.g.k("return this." + this.al(a) + ";");
            this.g.f();
            this.g.k("}");
            this.g.k("");
        }
        ad(a, b) {
            super.ad(a, b);
            this.g.k("private " + this.al(a) + ": " + this.ai(b.e) + " = " + this.aj(b) + ";");
            this.g.k("public get " + this.s(a) + "(): " + this.ai(b.e) + " {");
            this.g.h();
            this.g.k("return this." + this.al(a) + ";");
            this.g.f();
            this.g.k("}");
            this.g.k("");
        }
        ae(a, b, c, d) {
            super.ae(a, b, c, d);
            this.g.k("private " + this.al(a) + ": " + this.t(a, false) + "Item = null;");
            this.g.k("public get " + this.s(a) + "(): " + this.t(a, false) + "Item {");
            this.g.h();
            this.g.k("if (this." + this.al(a) + " == null)");
            this.g.k("{");
            this.g.h();
            this.g.k("this." + this.al(a) + " = ");
            this.am(this.t(a, true), b, c, d, this.g);
            this.g.k("}");
            this.g.k("return this." + this.al(a) + ";");
            this.g.f();
            this.g.k("}");
            this.g.k("");
        }
        v(a, b) {
            b.addPackageImport("./" + a, a);
            b.addPackageImport("./" + a, a + "Item");
        }
        w(a, b) {
            this.l = CodeGeneratingImportManager.merge(this.l, b);
        }
        y(a, b, c) {
            let d = 0;
            if (c == this.k) {
                c.addPackageImport("./" + a.d, a.d);
            }
            else {
                c.addPackageImport("./" + a.c, a.d);
            }
            b.k("export class " + a.d + " {");
            b.h();
            b.k("public constructor(init: Partial<" + a.d + ">) {");
            b.h();
            b.k("Object.assign(this, init);");
            b.f();
            b.k("}");
            b.k("");
            for (let e = 0; e < a.a.length; e++) {
                let f = a.a[e];
                let g = a.b[e];
                b.k("public " + this.s(f) + ": " + this.ak(a, f, g) + ";");
            }
            b.f();
            b.k("");
            b.k("}");
        }
        ai(a) {
            switch (a) {
                case 1: return "boolean";
                case 0: return "number";
                case 2: return "string";
                case 3: return "any";
            }
            return "any";
        }
        ak(a, b, c) {
            if (c.d) {
                return a.d + "_" + this.s(b) + "[]";
            }
            else if (c.f) {
                return a.d + "_" + this.s(b);
            }
            else {
                switch (c.c) {
                    case 1: return "boolean";
                    case 0: return "number";
                    case 2: return "string";
                    case 3: return "any";
                }
            }
            return "any";
        }
        af(a, b, c, d) {
            super.af(a, b, c, d);
            d.f();
            d.k("}");
            d.f();
            d.k("}");
        }
        u(a, b, c, d, e, f) {
            super.u(a, b, c, d, e, f);
            f.j("this.push(");
            this.am(this.t(a, true), b, c, d, f);
            f.k(");");
        }
        am(a, b, c, d, e) {
            if (d == null) {
                e.j("null");
                return;
            }
            if (typeCast(JsonDictionaryArray.$, d) !== null) {
                let f = d;
                e.k("[");
                e.h();
                if (f.items != null && f.items.length > 0) {
                    for (let g = 0; g < f.items.length; g++) {
                        if (g > 0) {
                            e.k(",");
                        }
                        this.am(a, b, c, f.items[g], e);
                    }
                }
                e.f();
                e.k("]");
            }
            else if (typeCast(JsonDictionaryObject.$, d) !== null) {
                let h = d;
                e.k("new " + a + "(");
                e.k("{");
                e.h();
                for (let i = 0; i < b.length; i++) {
                    let j = b[i];
                    let k = c[i];
                    if (i > 0) {
                        e.k(",");
                    }
                    e.j(this.s(j) + ": ");
                    if (k.d) {
                        let l = a + "_" + this.s(j) + "Item";
                        this.am(l, k.a, k.b, h.item(j), e);
                    }
                    else if (k.f) {
                        let m = a + "_" + this.s(j);
                        this.am(m, k.a, k.b, h.item(j), e);
                    }
                    else {
                        let n = h.item(j);
                        e.j(this.r(k, n));
                    }
                }
                e.k("");
                e.f();
                e.j("})");
            }
        }
        r(a, b) {
            if (b.value == null) {
                return ("null");
            }
            switch (a.c) {
                case 1: return (b.value ? "true" : "false");
                case 0: return (b.value.toString());
                case 2: return ("`" + b.value + "`");
                case 3: return ("null");
            }
            return "";
        }
        aj(a) {
            switch (a.e) {
                case 1: return (a.value ? "true" : "false");
                case 0: return (a.value.toString());
                case 2: return ("`" + a.value + "`");
                case 3: return "null";
            }
            return "";
        }
    }
    TSCodeGeneratingComponentRendererDataEmitter.$t = markType(TSCodeGeneratingComponentRendererDataEmitter, 'TSCodeGeneratingComponentRendererDataEmitter', CodeGeneratingComponentRendererDataEmitter.$);
    return TSCodeGeneratingComponentRendererDataEmitter;
})();
/**
 * @hidden
 */
export let AngularTemplateCodeGeneratingComponentRendererCodeEmitter = /*@__PURE__*/ (() => {
    class AngularTemplateCodeGeneratingComponentRendererCodeEmitter extends CodeGeneratingComponentRendererCodeEmitter {
        constructor(a, b) {
            super(a, b);
        }
        ad(a) {
            if (a.c == null) {
                return "null";
            }
            let b = a.c;
            let c = "";
            for (let d = 0; d < b.length; d++) {
                if (d > 0) {
                    c += ", ";
                }
                c += b[d];
            }
            return c;
        }
        get_p() {
            return true;
        }
        get_ap() {
            return "Igx";
        }
        as(a) {
            super.as(a);
            this.h.k("<" + this.a7(a) + "");
        }
        a7(a) {
            if (stringEndsWith(a, "Component")) {
                a = a.substr(0, a.length - ("Component").length);
            }
            return CodeGeneratingComponentRenderer.dq(a);
        }
        a5() {
            this.h.k(">");
            this.h.h();
        }
        a0(a) {
            this.h.f();
            this.h.k("</" + this.a7(a) + ">");
            super.a0(a);
        }
        ay(a, b, c, d) {
            let e = CodeGeneratingComponentRenderer.dn(b);
            if (this.n(c)) {
                this.a6(c);
                e = "[" + e + "]";
            }
            if (a > 0) {
                this.h.k("");
            }
            this.h.j(e);
            this.h.j("=");
            this.h.j("\"");
            this.h.j(this.an(c, true));
            this.h.j("\"");
            if (e == "name") {
                this.h.k("");
                this.h.j("#" + CodeGeneratingComponentRenderer.dn(this.an(c, true)));
            }
        }
        ah(a) {
            if (!stringIsNullOrEmpty(a.a.e)) {
                this.a6(a);
                return "this." + CodeGeneratingComponentRenderer.dn(a.a.e) + "($event)";
            }
            return this.ak();
        }
        w(a) {
            let b = a.c;
            switch (b.a) {
                case 3: return b.b;
                case 0: return b.b;
                case 1: return b.b;
                case 2: return b.b;
            }
            return b.b;
        }
        ak() {
            return "null";
        }
        af(a) {
            return CodeGeneratingComponentRenderer.dn(a.a.e);
        }
        al(a) {
            return CodeGeneratingComponentRenderer.dn(a.a.e);
        }
        az(a, b, c, d) {
            if (c.b.knownType == 9) {
                let e = typeCast(IList_$type, c.c);
                if (e != null) {
                    for (let f of fromEn(e)) {
                        if (typeCast(CodeGenerationItemBuilder.$, f) !== null) {
                            let g = f;
                            g.p(this, false);
                        }
                    }
                }
            }
            else {
                if (typeCast(CodeGenerationItemBuilder.$, c.c) !== null) {
                    let h = c.c;
                    h.p(this, false);
                }
            }
        }
    }
    AngularTemplateCodeGeneratingComponentRendererCodeEmitter.$t = markType(AngularTemplateCodeGeneratingComponentRendererCodeEmitter, 'AngularTemplateCodeGeneratingComponentRendererCodeEmitter', CodeGeneratingComponentRendererCodeEmitter.$);
    return AngularTemplateCodeGeneratingComponentRendererCodeEmitter;
})();
/**
 * @hidden
 */
export let AngularCodeBehindCodeGeneratingComponentRendererCodeEmitter = /*@__PURE__*/ (() => {
    class AngularCodeBehindCodeGeneratingComponentRendererCodeEmitter extends CodeGeneratingComponentRendererCodeEmitter {
        constructor(a, b) {
            super(a, b);
        }
    }
    AngularCodeBehindCodeGeneratingComponentRendererCodeEmitter.$t = markType(AngularCodeBehindCodeGeneratingComponentRendererCodeEmitter, 'AngularCodeBehindCodeGeneratingComponentRendererCodeEmitter', CodeGeneratingComponentRendererCodeEmitter.$);
    return AngularCodeBehindCodeGeneratingComponentRendererCodeEmitter;
})();
/**
 * @hidden
 */
export let DotNetCodeGeneratingComponentRendererDataEmitter = /*@__PURE__*/ (() => {
    class DotNetCodeGeneratingComponentRendererDataEmitter extends CodeGeneratingComponentRendererDataEmitter {
        constructor(a, b) {
            super(a, b);
            this.ah = false;
        }
        w(a, b) {
            super.w(a, b);
            this.f.k("<Compile Include=\"" + a + ".cs\">");
            this.f.h();
            this.f.k("<SubType>Code</SubType>");
            this.f.f();
            this.f.k("</Compile>");
        }
        aa(a) {
            a.k("using System;");
            a.k("using System.Collections.Generic;");
            if (!this.ah) {
                this.ah = true;
                this.k.addUsing("using Data;");
            }
            a.k("namespace Data");
            a.k("{");
            a.h();
            super.aa(a);
        }
        z(a) {
            a.f();
            a.k("}");
            super.z(a);
        }
        t(a, b = false) {
            a = CodeGeneratingComponentRenderer.dp(a);
            a = stringReplace(a, "-", "_");
            if (b) {
                a += "Item";
            }
            return a;
        }
        s(a) {
            a = stringReplace(a, "-", "_");
            return CodeGeneratingComponentRenderer.dp(a);
        }
        al(a) {
            a = stringReplace(a, "-", "_");
            return "_" + CodeGeneratingComponentRenderer.dn(a);
        }
        ag(a, b, c, d, e) {
            super.ag(a, b, c, d, e);
            let f = this.p(this.t(a, true), this.t(a, false), b, c);
            for (let g of fromEnum(f)) {
                this.y(g, d, e);
            }
            d.k("public class " + this.t(a, false));
            d.h();
            d.k(": List<" + this.t(a, true) + ">");
            d.f();
            d.k("{");
            d.h();
            d.k("public " + this.t(a, false) + "()");
            d.k("{");
            d.h();
        }
        ac(a) {
            super.ac(a);
            this.g.k("private " + this.t(a, false) + " " + this.al(a) + " = null;");
            this.g.k("public " + this.t(a, false) + " " + this.s(a));
            this.g.k("{");
            this.g.h();
            this.g.k("get");
            this.g.k("{");
            this.g.h();
            this.g.k("if (" + this.al(a) + " == null)");
            this.g.k("{");
            this.g.h();
            this.g.k(this.al(a) + " = new " + this.t(a, false) + "();");
            this.g.f();
            this.g.k("}");
            this.g.k("return " + this.al(a) + ";");
            this.g.f();
            this.g.k("}");
            this.g.f();
            this.g.k("}");
            this.g.k("");
        }
        ad(a, b) {
            super.ad(a, b);
            this.g.k("private " + this.ai(b.e) + " " + this.al(a) + " = " + this.aj(b) + ";");
            this.g.k("public " + this.ai(b.e) + " " + this.s(a));
            this.g.k("{");
            this.g.h();
            this.g.k("get");
            this.g.k("{");
            this.g.h();
            this.g.k("return " + this.al(a) + ";");
            this.g.f();
            this.g.k("}");
            this.g.f();
            this.g.k("}");
            this.g.k("");
        }
        ae(a, b, c, d) {
            super.ae(a, b, c, d);
            this.g.k("private " + this.t(a, false) + "Item " + this.al(a) + " = null;");
            this.g.k("public " + this.t(a, false) + "Item " + this.s(a));
            this.g.k("{");
            this.g.h();
            this.g.k("get");
            this.g.k("{");
            this.g.h();
            this.g.k("if (" + this.al(a) + " == null)");
            this.g.k("{");
            this.g.h();
            this.g.k("_" + a + " = ");
            this.am(this.t(a, true), b, c, d, this.g);
            this.g.f();
            this.g.k("}");
            this.g.k("return " + this.al(a) + ";");
            this.g.f();
            this.g.k("}");
            this.g.f();
            this.g.k("}");
            this.g.k("");
        }
        get_q() {
            return ".cs";
        }
        y(a, b, c) {
            b.k("public class " + a.d);
            b.k("{");
            b.h();
            for (let d = 0; d < a.a.length; d++) {
                let e = a.a[d];
                let f = a.b[d];
                b.k("public " + this.ak(a, e, f) + " " + this.s(e) + "{ get; set; }");
            }
            b.f();
            b.k("}");
        }
        ai(a) {
            switch (a) {
                case 1: return "bool";
                case 0: return "double";
                case 2: return "string";
                case 3: return "object";
            }
            return "object";
        }
        ak(a, b, c) {
            if (c.d) {
                return "List<" + a.d + "_" + this.s(b) + "Item>";
            }
            else if (c.f) {
                return a.d + "_" + this.s(b);
            }
            else {
                switch (c.c) {
                    case 1: return "bool";
                    case 0: return "double";
                    case 2: return "string";
                    case 3: return "object";
                }
            }
            return "object";
        }
        af(a, b, c, d) {
            super.af(a, b, c, d);
            d.f();
            d.k("}");
            d.f();
            d.k("}");
        }
        u(a, b, c, d, e, f) {
            super.u(a, b, c, d, e, f);
            f.j("this.Add(");
            this.am(this.t(a, true), b, c, d, f);
            f.k(");");
        }
        am(a, b, c, d, e) {
            if (d == null) {
                e.j("null");
                return;
            }
            if (typeCast(JsonDictionaryArray.$, d) !== null) {
                let f = d;
                e.k("new List<" + a + ">()");
                e.k("{");
                e.h();
                if (f.items != null && f.items.length > 0) {
                    for (let g = 0; g < f.items.length; g++) {
                        if (g > 0) {
                            e.k(",");
                        }
                        this.am(a, b, c, f.items[g], e);
                    }
                }
                e.f();
                e.k("}");
            }
            else if (typeCast(JsonDictionaryObject.$, d) !== null) {
                let h = d;
                e.k("new " + a + "()");
                e.k("{");
                e.h();
                for (let i = 0; i < b.length; i++) {
                    let j = b[i];
                    let k = c[i];
                    if (i > 0) {
                        e.k(",");
                    }
                    e.j(j + " = ");
                    if (k.d) {
                        let l = a + "_" + this.s(j) + "Item";
                        this.am(l, k.a, k.b, h.item(j), e);
                    }
                    else if (k.f) {
                        let m = a + "_" + this.s(j);
                        this.am(m, k.a, k.b, h.item(j), e);
                    }
                    else {
                        let n = h.item(j);
                        e.j(this.r(k, n));
                    }
                }
                e.k("");
                e.f();
                e.j("}");
            }
        }
        r(a, b) {
            switch (a.c) {
                case 1: return (b.value ? "true" : "false");
                case 0: return (b.value.toString());
                case 2: return ("@\"" + stringReplace(b.value, "\"", "\"\"") + "\"");
                case 3: return ("null");
            }
            return "";
        }
        aj(a) {
            switch (a.e) {
                case 1: return (a.value ? "true" : "false");
                case 0: return (a.value.toString());
                case 2: return ("@\"" + stringReplace(a.value, "\"", "\"\"") + "\"");
                case 3: return "null";
            }
            return "";
        }
    }
    DotNetCodeGeneratingComponentRendererDataEmitter.$t = markType(DotNetCodeGeneratingComponentRendererDataEmitter, 'DotNetCodeGeneratingComponentRendererDataEmitter', CodeGeneratingComponentRendererDataEmitter.$);
    return DotNetCodeGeneratingComponentRendererDataEmitter;
})();
/**
 * @hidden
 */
export let WPFXamlCodeGeneratingComponentRendererCodeEmitter = /*@__PURE__*/ (() => {
    class WPFXamlCodeGeneratingComponentRendererCodeEmitter extends CodeGeneratingComponentRendererCodeEmitter {
        constructor(a, b) {
            super(a, b);
        }
        get_q() {
            return false;
        }
        ad(a) {
            if (a.c == null) {
                return "null";
            }
            let b = a.c;
            let c = "";
            for (let d = 0; d < b.length; d++) {
                if (d > 0) {
                    c += ", ";
                }
                c += b[d];
            }
            return c;
        }
        as(a) {
            super.as(a);
            this.h.k("<ig:" + a + "");
        }
        a5() {
            this.h.k(">");
            this.h.h();
        }
        a0(a) {
            this.h.f();
            this.h.k("</ig:" + a + ">");
            super.a0(a);
        }
        ay(a, b, c, d) {
            if (b == "Label" && c.b != null && stringContains(c.b.owningType, "Axis")) {
                if (c.c != null && stringContains(c.c, "{")) {
                    if (a > 0) {
                        this.h.k("");
                    }
                    this.h.j(b);
                    this.h.j("=");
                    this.h.j("\"");
                    this.h.j("{}" + this.an(c, true));
                    this.h.j("\"");
                    return;
                }
            }
            if (a > 0) {
                this.h.k("");
            }
            this.h.j(b);
            this.h.j("=");
            this.h.j("\"");
            this.h.j(this.an(c, true));
            this.h.j("\"");
        }
        w(a) {
            let b = a.c;
            switch (b.a) {
                case 3: return b.b;
                case 0: return b.b;
                case 1: return b.b;
                case 2: return b.b;
            }
            return b.b;
        }
        ak() {
            return "{x:Null}";
        }
        af(a) {
            return "{Binding ElementName=" + a.a.e + "}";
        }
        a7(a) {
            a = stringReplace(a, "-", "_");
            return CodeGeneratingComponentRenderer.dp(a);
        }
        al(a) {
            this.a6(a);
            return "{Binding " + this.a7(a.a.e) + "}";
        }
        az(a, b, c, d) {
            this.h.j("<ig:");
            {
                this.h.j(this.ac);
                this.h.j(".");
            }
            this.h.j(b);
            this.h.k(">");
            this.h.h();
            if (c.b.knownType == 9) {
                let e = typeCast(IList_$type, c.c);
                if (e != null) {
                    for (let f of fromEn(e)) {
                        if (typeCast(CodeGenerationItemBuilder.$, f) !== null) {
                            let g = f;
                            g.p(this, false);
                        }
                    }
                }
            }
            else {
                if (typeCast(CodeGenerationItemBuilder.$, c.c) !== null) {
                    let h = c.c;
                    h.p(this, false);
                }
            }
            this.h.f();
            this.h.j("</ig:");
            {
                this.h.j(this.ac);
                this.h.j(".");
            }
            this.h.j(b);
            this.h.k(">");
        }
        get_ap() {
            return "Xam";
        }
    }
    WPFXamlCodeGeneratingComponentRendererCodeEmitter.$t = markType(WPFXamlCodeGeneratingComponentRendererCodeEmitter, 'WPFXamlCodeGeneratingComponentRendererCodeEmitter', CodeGeneratingComponentRendererCodeEmitter.$);
    return WPFXamlCodeGeneratingComponentRendererCodeEmitter;
})();
/**
 * @hidden
 */
export let WPFCodeBehindCodeGeneratingComponentRendererCodeEmitter = /*@__PURE__*/ (() => {
    class WPFCodeBehindCodeGeneratingComponentRendererCodeEmitter extends CodeGeneratingComponentRendererCodeEmitter {
        constructor(a, b) {
            super(a, b);
        }
        get_q() {
            return false;
        }
    }
    WPFCodeBehindCodeGeneratingComponentRendererCodeEmitter.$t = markType(WPFCodeBehindCodeGeneratingComponentRendererCodeEmitter, 'WPFCodeBehindCodeGeneratingComponentRendererCodeEmitter', CodeGeneratingComponentRendererCodeEmitter.$);
    return WPFCodeBehindCodeGeneratingComponentRendererCodeEmitter;
})();
/**
 * @hidden
 */
export let CodeGeneratingComponentRenderer = /*@__PURE__*/ (() => {
    class CodeGeneratingComponentRenderer extends ComponentRenderer {
        constructor(a, b) {
            super();
            this.dh = null;
            this.di = 0;
            this.dj = null;
            this.dk = null;
            this.dl = null;
            this.dh = b;
            this.di = a;
            ComponentRenderer.platform = CodeGeneratingComponentRenderer.dm(a);
            this.e = new CodeGenerationRendererAdapter(a, this.e);
            this.context = new TypeDescriptionContext(this.e, ComponentRenderer.platform);
            this.g = new CodeGenerationTransformer(a);
        }
        loadCodeJson(a) {
            this.loadJson(a, (b) => ((() => {
                let $ret = new CodeGenerationContainer();
                $ret.id = b;
                return $ret;
            })()));
        }
        static dn(a) {
            if (a == null) {
                return null;
            }
            if (a.length == 1) {
                return a.toLowerCase();
            }
            return a.substr(0, 1).toLowerCase() + a.substr(1);
        }
        static dp(a) {
            if (a == null) {
                return null;
            }
            if (a.length == 1) {
                return a.toUpperCase();
            }
            return a.substr(0, 1).toUpperCase() + a.substr(1);
        }
        static dq(a) {
            if (a == null) {
                return null;
            }
            let b = new List$1(String_$type, 0);
            let c = 0;
            for (let d = 0; d < a.length; d++) {
                let e = a.charAt(d);
                let f = e.toUpperCase();
                let g = e.toLowerCase();
                let h = (c == 0 && b.count > 0);
                let i = (c > 1);
                if (f == e) {
                    if (h) {
                        b.add('-');
                    }
                    c++;
                }
                else if (g == e) {
                    if (i) {
                        b.insert(b.count - 1, '-');
                    }
                    c = 0;
                }
                else {
                    c = 0;
                }
                b.add(g);
            }
            let j = new StringBuilder(0);
            for (let k = 0; k < b.count; k++) {
                j.h(b._inner[k]);
            }
            return j.toString();
        }
        aj() {
            return true;
        }
        y(a) {
            super.y(a);
            this.dj = a;
            return true;
        }
        ad(a) {
            super.ad(a);
            this.dl = a;
            return true;
        }
        z(a) {
            super.z(a);
            this.dk = a;
            return true;
        }
        dc(a, b, c) {
            switch (this.di) {
                case 1: if (b.forceCodeBehind) {
                    return new AngularCodeBehindCodeGeneratingComponentRendererCodeEmitter(b, c);
                }
                else {
                    return new AngularTemplateCodeGeneratingComponentRendererCodeEmitter(b, c);
                }
                case 2: if (b.forceCodeBehind) {
                    return new ReactCodeBehindCodeGeneratingComponentRendererCodeEmitter(b, c);
                }
                else {
                    return new ReactMarkupCodeGeneratingComponentRendererCodeEmitter(b, c);
                }
                case 3: if (b.forceCodeBehind) {
                    return new WebComponentsCodeBehindCodeGeneratingComponentRendererCodeEmitter(b, c);
                }
                else {
                    return new WebComponentsMarkupCodeGeneratingComponentRendererCodeEmitter(b, c);
                }
                case 4: break;
                case 0: if (b.forceCodeBehind) {
                    return new WPFCodeBehindCodeGeneratingComponentRendererCodeEmitter(b, c);
                }
                else {
                    return new WPFXamlCodeGeneratingComponentRendererCodeEmitter(b, c);
                }
            }
            return null;
        }
        dd(a, b) {
            switch (this.di) {
                case 1: return new TSCodeGeneratingComponentRendererDataEmitter(a, b);
                case 2: return new TSCodeGeneratingComponentRendererDataEmitter(a, b);
                case 3: return new TSCodeGeneratingComponentRendererDataEmitter(a, b);
                case 4: break;
                case 0: return new DotNetCodeGeneratingComponentRendererDataEmitter(a, b);
            }
            return null;
        }
        de(a, b) {
            switch (this.di) {
                case 1: return new TSCodeGeneratingComponentRendererHandlerEmitter(a, b, this.di);
                case 2: return new TSCodeGeneratingComponentRendererHandlerEmitter(a, b, this.di);
                case 3: return new TSCodeGeneratingComponentRendererHandlerEmitter(a, b, this.di);
                case 4: break;
                case 0: return new DotNetCodeGeneratingComponentRendererHandlerEmitter(a, b);
            }
            return null;
        }
        df(a, b) {
            switch (this.di) {
                case 1: return new TSCodeGeneratingComponentRendererModuleEmitter(this.di, a, b);
                case 2: return new TSCodeGeneratingComponentRendererModuleEmitter(this.di, a, b);
                case 3: return new TSCodeGeneratingComponentRendererModuleEmitter(this.di, a, b);
                case 4: break;
                case 0: return new DotNetCodeGeneratingComponentRendererModuleEmitter(this.di, a, b);
            }
            return null;
        }
        emitCode(a) {
            let b = new CodeGeneratingRendererResult();
            b.platform = this.di;
            b.generationOptions = this.dh;
            for (let c of fromEnum(this.ay.keys)) {
                let d = c;
                let e = d.id;
                for (let f of fromEnum(d.a)) {
                    if (f.i("Name") != null) {
                        b.trackDescriptionField(e, f.i("Name"));
                    }
                    if (f.i("name") != null) {
                        b.trackDescriptionField(e, f.i("name"));
                    }
                }
            }
            for (let g of fromEnum(this.ay.keys)) {
                let h = g;
                h.c(b, this, this.dh);
            }
            if (this.dj != null) {
                let i = this.df(this.dh, b);
                i.l(this.dj);
            }
            if (this.dl != null) {
                if (typeCast(JsonDictionaryObject.$, this.dl) !== null) {
                    let j = this.dl;
                    let m = j.e();
                    for (let l = 0; l < m.length; l++) {
                        let k = m[l];
                        b.defineString(k, j.item(k).value);
                    }
                }
            }
            {
                let n = this.dd(this.dh, b);
                n.x(this.dk);
            }
            let o = this.de(this.dh, b);
            o.j();
            this.du(b, a);
            return b;
        }
        du(a, b) {
            b.execute(a);
        }
        a3() {
            return runOn(this, this.ds);
        }
        dr(a) {
            a = stringReplace(a, "-", "_");
            switch (this.di) {
                case 1:
                case 2:
                case 3: return CodeGeneratingComponentRenderer.dn(a);
                case 4:
                case 0: return CodeGeneratingComponentRenderer.dp(a);
            }
            return a;
        }
        ds(a) {
            let b = a;
            if (stringStartsWith(a, "{")) {
                if (!stringStartsWith(a, "{[")) {
                    a = a.substr(1, a.length - 2);
                    a = "{" + this.dr(a) + "}";
                    b = a;
                }
            }
            else {
                b = this.dr(a);
            }
            return b;
        }
        static dm(a) {
            switch (a) {
                case 1: return 3;
                case 2: return 2;
                case 3: return 4;
                case 4: return 8;
                case 0: return 0;
            }
            return 0;
        }
    }
    CodeGeneratingComponentRenderer.$t = markType(CodeGeneratingComponentRenderer, 'CodeGeneratingComponentRenderer', ComponentRenderer.$);
    return CodeGeneratingComponentRenderer;
})();
/**
 * @hidden
 */
export let CodeGenerationContainer = /*@__PURE__*/ (() => {
    class CodeGenerationContainer extends Base {
        constructor() {
            super();
            this._id = null;
            this.a = null;
            this.a = new List$1(CodeGenerationItemBuilder.$, 0);
        }
        get id() {
            return this._id;
        }
        set id(a) {
            this._id = a;
        }
        c(a, b, c) {
            let d = new StringBuilder(0);
            let e = new StringBuilder(0);
            let f = new StringBuilder(0);
            let g = new CodeGeneratingImportManager();
            for (let h of fromEnum(this.a)) {
                let i = b.dc(h, c, a);
                h.p(i, true);
                let j = i.toString();
                a.addContainerResult(this.id, j);
                i.au(d);
                i.ax(e);
                i.at(f);
                i.av(g);
            }
            a.addContainerResult("bindingFields", d.toString());
            a.addContainerResult("bindingInit", e.toString());
            a.addContainerResult("bindingCode", f.toString());
            a.addImportResult("bindingImports", g);
        }
    }
    CodeGenerationContainer.$t = markType(CodeGenerationContainer, 'CodeGenerationContainer');
    return CodeGenerationContainer;
})();
/**
 * @hidden
 */
export let CodeGenerationItemBuilder = /*@__PURE__*/ (() => {
    class CodeGenerationItemBuilder extends Base {
        constructor(a, b, c, d) {
            super();
            this.g = new List$1(String_$type, 0);
            this.f = new Dictionary$2(String_$type, CodeGenerationItemBuilderPropertyInfo.$, 0);
            this.c = null;
            this.b = 0;
            this.j = null;
            this.h = null;
            this.b = a;
            this.j = b;
            this.c = c;
            this.h = d;
        }
        a(a) {
            let b = this.c.getMetadata(this.j, a);
            return new CodeGenerationItemBuilder(this.b, this.o(b), this.c, this.h);
        }
        o(a) {
            return a.specificExternalType != null ? a.specificExternalType : a.specificType;
        }
        s(a, b, c, d) {
            if (!this.f.containsKey(a)) {
                this.g.add(a);
            }
            ;
            this.f.item(a, ((() => {
                let $ret = new CodeGenerationItemBuilderPropertyInfo();
                $ret.b = b;
                $ret.c = c;
                $ret.a = d;
                return $ret;
            })()));
        }
        q(a, b, c) {
            let d = null;
            if (!this.f.containsKey(a)) {
                this.g.add(a);
            }
            ;
            if (this.f.containsKey(a)) {
                let e = this.f.item(a);
                d = e.c;
            }
            this.f.item(a, ((() => {
                let $ret = new CodeGenerationItemBuilderPropertyInfo();
                $ret.b = b;
                $ret.c = d;
                $ret.a = c;
                return $ret;
            })()));
        }
        r(a, b) {
            if (this.f.containsKey(a)) {
                this.f.removeItem(a);
            }
        }
        i(a) {
            if (this.f.containsKey(a)) {
                return this.f.item(a).c;
            }
            return null;
        }
        p(a, b) {
            let c = this.m();
            if (b) {
                let d = this.n();
                a.ao = d;
            }
            let e = false;
            let f = false;
            if (this.f.containsKey("Name")) {
                e = true;
                a.a4(this.f.item("Name").c);
            }
            else if (this.f.containsKey("name")) {
                e = true;
                a.a4(this.f.item("name").c);
            }
            else {
                if (this.e(a)) {
                    f = true;
                    a.a3(c);
                    if (a.q) {
                        this.g.add("name");
                        this.f.addItem("name", ((() => {
                            let $ret = new CodeGenerationItemBuilderPropertyInfo();
                            $ret.c = a.ab;
                            return $ret;
                        })()));
                    }
                    else {
                        this.g.add("Name");
                        this.f.addItem("Name", ((() => {
                            let $ret = new CodeGenerationItemBuilderPropertyInfo();
                            $ret.c = a.ab;
                            return $ret;
                        })()));
                    }
                }
            }
            a.as(c);
            let g = 0;
            for (let h of fromEnum(this.g)) {
                let i = this.f.item(h);
                if (i.b == null && h.toLowerCase() == "type") {
                    continue;
                }
                if (this.d(h, i)) {
                    a.ay(g, h, i, this.c);
                    g++;
                }
            }
            a.a5();
            let j = 0;
            for (let k of fromEnum(this.g)) {
                let l = this.f.item(k);
                if (l.b == null && k.toLowerCase() == "type") {
                    continue;
                }
                if (!this.d(k, l)) {
                    a.az(j, k, l, this.c);
                    j++;
                }
            }
            a.a0(c);
            if (e) {
                a.a2();
            }
            else {
                if (f) {
                    a.a1();
                }
            }
        }
        e(a) {
            for (let b of fromEnum(this.g)) {
                let c = this.f.item(b);
                if (a.n(c)) {
                    return true;
                }
            }
            return false;
        }
        d(a, b) {
            if (b.b == null) {
                if (a.toLowerCase() == "name") {
                    return true;
                }
            }
            switch (b.b.knownType) {
                case 10:
                case 7: return true;
                case 4: return b.c == null || !(typeCast(LinearGradientBrush.$, b.c) !== null);
                case 6:
                    return true;
                    break;
                case 9: return false;
                case 5: return true;
                case 16: return true;
                case 20: return true;
                case 15: return false;
                case 3: return true;
                case 19: return true;
                case 8:
                    if (b.b.specificExternalType == "string") {
                        return true;
                    }
                    if (b.a != null) {
                        return true;
                    }
                    return false;
                case 13: return false;
                case 18: return true;
                case 1: return true;
                case 11: return true;
                case 14: return true;
                case 12: return true;
                case 2: return true;
                case 21: return true;
                case 17: return true;
                case 0: return false;
            }
            return false;
        }
        m() {
            if (this.b == 0 || this.b == 4) {
                let a = this.c.getMetadata(this.j, "_qualifiedName");
                if (a != null) {
                    let b = a.specificExternalType;
                    let c = b.lastIndexOf('.');
                    if (c >= 0) {
                        return b.substr(c + 1);
                    }
                    else {
                        return b;
                    }
                }
                return this.j;
            }
            else {
                return this.k + this.j + this.l;
            }
        }
        n() {
            let a = this.c.getMetadata(this.j, "_qualifiedName");
            if (a != null) {
                let b = a.specificExternalType;
                let c = b.split('.');
                if (c.length > 2) {
                    return c[c.length - 2].toLowerCase();
                }
            }
            if (this.j == "Legend" || this.j == "ItemLegend") {
                return "charts";
            }
            return "core";
        }
        get_k() {
            switch (this.b) {
                case 1: return "Igx";
                case 2: return "Igr";
                case 3: return "Igc";
                case 4: return "Ultra";
                case 0: return "Xam";
            }
            return "";
        }
        get k() {
            return this.get_k();
        }
        get_l() {
            switch (this.b) {
                case 1: return "Component";
                case 2: return "";
                case 3: return "Component";
                case 4: return "";
                case 0: return "";
            }
            return "";
        }
        get l() {
            return this.get_l();
        }
    }
    CodeGenerationItemBuilder.$t = markType(CodeGenerationItemBuilder, 'CodeGenerationItemBuilder');
    return CodeGenerationItemBuilder;
})();
/**
 * @hidden
 */
export let CodeGenerationRendererAdapter = /*@__PURE__*/ (() => {
    class CodeGenerationRendererAdapter extends Base {
        constructor(a, b) {
            super();
            this.a = 0;
            this.b = null;
            this.b = b;
            this.a = a;
        }
        createColorCollection(a) {
            let b = new List$1(Base.$, 0);
            for (let c = 0; c < a.length; c++) {
                b.add1(a[c]);
            }
            return b;
        }
        createBrushCollection(a) {
            let b = new List$1(Base.$, 0);
            for (let c = 0; c < a.length; c++) {
                b.add1(a[c]);
            }
            return b;
        }
        createObject(a, b, c) {
            let d = new CodeGenerationItemBuilder(this.a, a, c, b);
            return d;
        }
        coerceToEnum(a, b, c) {
            return c;
        }
        onUIThread(a, b) {
            b();
        }
        setOrUpdateCollectionOnTarget(a, b, c, d, e, f) {
            let g = this.getPropertyValue(e, b);
            if (g == null) {
                let h = new List$1(Base.$, 0);
                let i = f;
                for (let j = 0; j < i.count; j++) {
                    h.add1(i.item(j));
                }
                this.setPropertyValue(e, b, c, h, null, null);
            }
            else {
                let k = f;
                let l = g;
                l.clear();
                for (let m = 0; m < k.count; m++) {
                    l.add(k.item(m));
                }
            }
        }
        c(a) {
            if (a == null) {
                return false;
            }
            return false;
        }
        onPendingRef(a, b, c, d) {
            let e = a;
            e.q(b, c, d);
        }
        setPropertyValue(a, b, c, d, e, f) {
            if (!(typeCast(CodeGenerationItemBuilder.$, a) !== null)) {
                this.b.setPropertyValue(a, b, c, d, e, f);
                return;
            }
            while (stringContains(b, ".")) {
                let g = b.split('.');
                let h = this.getPropertyValue(a, g[0]);
                if (h != null && !this.c(h)) {
                    b = "";
                    for (let i = 1; i < g.length; i++) {
                        if (i > 1) {
                            b += ".";
                        }
                        b += g[i];
                    }
                    a = h;
                }
                else {
                    let j = a;
                    let k = j.a(g[0]);
                    h = k;
                    this.setPropertyValue(a, g[0], c, h, null, f);
                    b = "";
                    for (let l = 1; l < g.length; l++) {
                        if (l > 1) {
                            b += ".";
                        }
                        b += g[l];
                    }
                    a = h;
                }
            }
            let m = a;
            m.s(b, c, d, f);
        }
        getPropertyValue(a, b) {
            while (stringContains(b, ".")) {
                let c = b.split('.');
                let d = this.getPropertyValue(a, c[0]);
                if (d != null) {
                    b = "";
                    for (let e = 1; e < c.length; e++) {
                        if (e > 1) {
                            b += ".";
                        }
                        b += c[e];
                    }
                    a = d;
                }
                else {
                    let f = a;
                    let g = f.a(c[0]);
                    d = g;
                    for (let h = 1; h < c.length; h++) {
                        if (h > 1) {
                            b += ".";
                        }
                        b += c[h];
                    }
                    a = d;
                }
            }
            let i = a;
            return i.i(b);
        }
        getRootObject(a) {
            let b = a;
            let c = b.a.count > 0 ? b.a._inner[0] : null;
            return c;
        }
        clearContainer(a, b, c) {
            let d = a;
            let e = d.a.count > 0 ? d.a._inner[0] : null;
            d.a.clear();
            c(false);
        }
        forPropertyValueItem(a, b, c) {
            let d = this.getPropertyValue(a, b);
            if (typeCast(IList_$type, d) !== null) {
                let e = d;
                for (let f = 0; f < e.count; f++) {
                    c(e.item(f));
                }
            }
            else if (typeCast(Array_$type, d) !== null) {
                let g = d;
                for (let h = 0; h < g.length; h++) {
                    c(g[h]);
                }
            }
        }
        clearCollection(a, b, c) {
            let d = this.getPropertyValue(a, b);
            if (typeCast(IList_$type, d) !== null) {
                d.clear();
            }
            else if (typeCast(Array_$type, d) !== null) {
                this.setPropertyValue(a, b, c, null, d, null);
            }
        }
        addItemToCollection(a, b, c, d, e) {
            let f = this.getPropertyValue(c, a);
            if (typeCast(IList_$type, f) !== null) {
                f.insert(d, e);
            }
            else if (typeCast(Array_$type, f) !== null) {
                let g = f;
                let h = new List$1(Base.$, 0);
                for (let i = 0; i < g.count; i++) {
                    h.add1(g.item(i));
                }
                h.insert1(d, e);
                let j = [g.count + 1];
                for (let k = 0; k < j.length; k++) {
                    j[k] = h._inner[k];
                }
                this.setPropertyValue(c, a, b, j, f, null);
            }
        }
        resetPropertyOnTarget(a, b, c, d) {
            while (stringContains(b, ".")) {
                let e = b.split('.');
                let f = this.getPropertyValue(d, e[0]);
                if (f != null && !this.c(f)) {
                    b = "";
                    for (let g = 1; g < e.length; g++) {
                        if (g > 1) {
                            b += ".";
                        }
                        b += e[g];
                    }
                    d = f;
                }
                else {
                    let h = d;
                    let i = h.a(e[0]);
                    f = i;
                    this.setPropertyValue(d, e[0], c, f, null, null);
                    b = "";
                    for (let j = 1; j < e.length; j++) {
                        if (j > 1) {
                            b += ".";
                        }
                        b += e[j];
                    }
                    d = f;
                }
            }
            let k = d;
            k.r(b, c);
        }
        replaceItemInCollection(a, b, c, d, e) {
            let f = this.getPropertyValue(c, a);
            if (typeCast(IList_$type, f) !== null) {
                f.item(d, e);
            }
            else if (typeCast(Array_$type, f) !== null) {
                let g = f;
                let h = new List$1(Base.$, 0);
                for (let i = 0; i < g.count; i++) {
                    h.add1(g.item(i));
                }
                h._inner[d] = e;
                let j = [g.count + 1];
                for (let k = 0; k < j.length; k++) {
                    j[k] = h._inner[k];
                }
                this.setPropertyValue(c, a, b, j, f, null);
            }
        }
        replaceRootItem(a, b, c, d) {
            let e = this.createObject(b, a, c);
            let f = a;
            let g = f.a.count > 0 ? f.a._inner[0] : null;
            f.a.clear();
            {
                f.a.add(e);
            }
            d(false);
        }
        removeItemFromCollection(a, b, c, d) {
            let e = this.getPropertyValue(c, a);
            if (typeCast(IList_$type, e) !== null) {
                e.removeAt(d);
            }
            else if (typeCast(Array_$type, e) !== null) {
                let f = e;
                let g = new List$1(Base.$, 0);
                for (let h = 0; h < f.count; h++) {
                    g.add1(f.item(h));
                }
                g.removeAt(d);
                let i = [f.count - 1];
                for (let j = 0; j < i.length; j++) {
                    i[j] = g._inner[j];
                }
                this.setPropertyValue(c, a, b, i, e, null);
            }
        }
        removeRootItem(a, b, c) {
            let d = a;
            let e = d.a.count > 0 ? d.a._inner[0] : null;
            d.a.clear();
            c(false);
        }
        flushChanges(a) {
        }
    }
    CodeGenerationRendererAdapter.$t = markType(CodeGenerationRendererAdapter, 'CodeGenerationRendererAdapter', Base.$, [IComponentRendererAdapter_$type]);
    return CodeGenerationRendererAdapter;
})();
