igniteui-react-core
Version:
Ignite UI React Core.
1,314 lines (1,313 loc) • 92.3 kB
JavaScript
/*
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, IEnumerable_$type, fromEnum, typeCast, Date_$type, Boolean_$type, Array_$type, Delegate_$type, runOn, Number_$type, String_$type, EnumUtil, typeGetValue, markType } from "./type";
import { TypeDescriptionContext } from "./TypeDescriptionContext";
import { TypeDescriptionCleanups } from "./TypeDescriptionCleanups";
import { Dictionary$2 } from "./Dictionary$2";
import { List$1 } from "./List$1";
import { ComponentRendererReferenceResolverEventArgs } from "./ComponentRendererReferenceResolverEventArgs";
import { Description } from "./Description";
import { DescriptionTreeNode } from "./DescriptionTreeNode";
import { Queue$1 } from "./Queue$1";
import { DescriptionTreeAction } from "./DescriptionTreeAction";
import { DescriptionRef } from "./DescriptionRef";
import { TypeDescriptionPropretyTransforms } from "./TypeDescriptionPropretyTransforms";
import { DescriptionSerializerBuilder } from "./DescriptionSerializerBuilder";
import { DescriptionSerializer } from "./DescriptionSerializer";
import { DataSourceLocalDataProvider } from "./DataSourceLocalDataProvider";
import { JsonDictionaryParser } from "./JsonDictionaryParser";
import { DescriptionTreeBuilder } from "./DescriptionTreeBuilder";
import { JsonDictionaryObject } from "./JsonDictionaryObject";
import { JsonDictionaryValue } from "./JsonDictionaryValue";
import { JsonDictionaryArray } from "./JsonDictionaryArray";
import { TypeDescriptionMetadata } from "./TypeDescriptionMetadata";
import { DescriptionTreeReconciler } from "./DescriptionTreeReconciler";
import { HashSet$1 } from "./HashSet$1";
import { GlobalAnimationState } from "./GlobalAnimationState";
import { TypeDescriptionWellKnownType_$type } from "./TypeDescriptionWellKnownType";
import { Tuple$2 } from "./Tuple$2";
import { DescriptionRefTargetInfo } from "./DescriptionRefTargetInfo";
import { NotImplementedException } from "./NotImplementedException";
import { truncate } from "./number";
import { ComponentRendererAdapter } from "./ComponentRendererAdapter";
import { stringIsNullOrEmpty, stringStartsWith, stringEndsWith } from "./string";
/**
* @hidden
*/
export let ComponentRenderer = /*@__PURE__*/ (() => {
class ComponentRenderer extends Base {
static get defaultInstance() {
return ComponentRenderer._defaultInstance;
}
static set defaultInstance(a) {
ComponentRenderer._defaultInstance = a;
}
get adapter() {
return this._adapter;
}
set adapter(a) {
this._adapter = a;
}
get context() {
return this._context;
}
set context(a) {
this._context = a;
}
get isProceedOnErrorEnabled() {
return this._isProceedOnErrorEnabled;
}
set isProceedOnErrorEnabled(a) {
this._isProceedOnErrorEnabled = a;
}
constructor() {
super();
this._adapter = null;
this._context = null;
this._isProceedOnErrorEnabled = false;
this.k = null;
this.l = null;
this._preserveKeyOrder = false;
this._allowNullForRemove = false;
this.bf = new List$1(Delegate_$type, 0);
this.bh = new List$1(Delegate_$type, 0);
this.a2 = new Dictionary$2(Base.$, Description.$, 0);
this.a3 = new Dictionary$2(Base.$, Boolean_$type, 0);
this.a4 = new Dictionary$2(Base.$, Boolean_$type, 0);
this.a1 = new Dictionary$2(Base.$, Boolean_$type, 0);
this.az = new Dictionary$2(Base.$, String_$type, 0);
this.a0 = new Dictionary$2(Base.$, Number_$type, 0);
this.ax = new Dictionary$2(Base.$, DescriptionTreeNode.$, 0);
this.a8 = new Dictionary$2(Base.$, ContainerState.$, 0);
this.a5 = new Dictionary$2(Base.$, Queue$1.$.specialize(Queue$1.$.specialize(DescriptionTreeAction.$)), 0);
this.ay = new Dictionary$2(Base.$, List$1.$.specialize(Delegate_$type), 0);
this.aw = new Dictionary$2(Base.$, Boolean_$type, 0);
this.a7 = new Dictionary$2(String_$type, DescriptionRef.$, 0);
this.a9 = new Dictionary$2(String_$type, Base.$, 0);
this.bb = new Dictionary$2(String_$type, Base.$, 0);
this.a6 = new Dictionary$2(Base.$, String_$type, 0);
this.bn = null;
this.bi = new List$1(Delegate_$type, 0);
this.ba = new Dictionary$2(String_$type, List$1.$.specialize(Delegate_$type), 0);
this.be = new List$1(Delegate_$type, 0);
this.bg = new List$1(Delegate_$type, 0);
this.bd = null;
this._shouldNamespaceSystemRefValues = false;
let a = this.j();
this.adapter = a;
let adapter_ = this.adapter;
let b = (adapter_._platform);
if (b == "Igc") {
ComponentRenderer.platform = 4;
}
else if (b == "Igr") {
ComponentRenderer.platform = 2;
}
this.context = new TypeDescriptionContext(this.adapter, ComponentRenderer.platform);
this.k = new TypeDescriptionPropretyTransforms();
this.l = new TypeDescriptionCleanups();
}
j() {
return (new ComponentRendererAdapter());
}
toJson(a) {
let b = new DescriptionSerializerBuilder();
let c = new DescriptionSerializer();
b.f("{");
b.i();
b.f("\"descriptions\": {");
b.i();
let d = true;
for (let e of fromEnum(this.ax.keys)) {
if (d) {
d = false;
}
else {
b.f(",");
}
let f = e;
let g = this.ax.item(e);
let h = "root";
h = a(f);
if (stringIsNullOrEmpty(h)) {
h = "root";
}
b.e("\"" + h + "\"");
b.e(": ");
c.w(this.context, g, b);
}
b.f("");
b.h();
b.e("}");
if (this.bb.count > 0) {
b.e(",");
}
b.f("");
if (this.bb.count > 0) {
d = true;
b.f("refs: {");
b.i();
for (let i of fromEnum(this.bb.keys)) {
if (!this.r(i, this.bb.item(i))) {
continue;
}
if (d) {
d = false;
}
else {
b.f(",");
}
this.ek(b, i, this.bb.item(i));
}
b.f("");
b.h();
b.f("}");
}
b.h();
b.f("}");
return b.toString();
}
ek(a, b, c) {
a.e("\"" + b + "\": ");
this.el(a, c);
}
el(a, b) {
if (this.aa(b)) {
if (typeof b === 'string') {
a.e(b == null ? "null" : "\"" + b.toString() + "\"");
}
else if (typeof b === 'number') {
a.e(b == null ? "null" : b.toString());
}
else if (typeof b === 'number') {
a.e(b == null ? "null" : b.toString());
}
else if (typeof b === 'number') {
a.e(b == null ? "null" : b.toString());
}
else if (typeof b === 'number') {
a.e(b == null ? "null" : b.toString());
}
else if (typeof b === 'number') {
a.e(b == null ? "null" : b.toString());
}
else if (typeof b === 'number') {
a.e(b == null ? "null" : b.toString());
}
else if (typeof b === 'number') {
a.e(b == null ? "null" : b.toString());
}
else if (typeCast(Date_$type, b) !== null) {
let v_ = b;
a.e("\"" + (v_.toJSON()) + "\"");
}
else if (typeCast(Boolean_$type, b) !== null) {
a.e(b == null ? "null" : b.toString().toLowerCase());
}
else {
a.e("null");
}
}
else {
if (b == null) {
a.e("null");
return;
}
if (this.x(b)) {
a.f("[");
a.i();
let c = new DataSourceLocalDataProvider();
c.dataSource = b;
for (let d = 0; d < c.actualCount; d++) {
if (d > 0) {
a.f(",");
}
this.ej(a, c, d);
}
a.f("");
a.h();
a.e("]");
}
else {
let e = [b];
let f = new DataSourceLocalDataProvider();
f.dataSource = e;
this.ej(a, f, 0);
}
}
}
aa(a) {
if (typeof a === 'string') {
return true;
}
if (typeof a === 'number' || typeof a === 'number' || typeof a === 'number' || typeof a === 'number' || typeof a === 'number' || typeof a === 'number' || typeof a === 'number') {
return true;
}
if (typeCast(Date_$type, a) !== null) {
return true;
}
if (typeCast(Boolean_$type, a) !== null) {
return true;
}
return false;
}
x(a) {
if (typeCast(Array_$type, a) !== null) {
return true;
}
if (typeCast(IEnumerable_$type, a) !== null) {
return true;
}
return false;
}
ej(a, b, c) {
a.f("{");
a.i();
let d = b.actualSchema;
for (let e = 0; e < d.propertyNames.length; e++) {
if (e > 0) {
a.f(",");
}
let f = d.propertyNames[e];
if (stringStartsWith(f, "[")) {
f = f.substr(1, f.length - 2);
}
a.e("\"" + f + "\"");
a.e(": ");
let g = b.getItemValue(b.getItemAtIndex(c), d.propertyNames[e]);
switch (d.propertyTypes[e]) {
case 0:
a.e(g == null ? "null" : "\"" + g.toString() + "\"");
break;
case 2:
a.e(g == null ? "null" : "\"" + g.toString() + "\"");
break;
case 10:
case 6:
case 5:
case 1:
case 3:
case 4:
case 7:
a.e(g == null ? "null" : g.toString());
break;
case 8:
let v_ = g;
a.e("\"" + (v_.toJSON()) + "\"");
break;
case 11:
this.el(a, g);
break;
}
}
a.h();
a.f("}");
}
r(a, b) {
if (b == null) {
return true;
}
let v_ = b;
if ((typeof v_ === 'function')) {
return false;
}
return true;
}
createObjectFromJson(a, b) {
let c = new JsonDictionaryParser();
let d = c.parse(a);
let e = new DescriptionSerializer();
let f = false;
let g = e.d(this.context, d, f, null, false);
if (g.result == null) {
return null;
}
let h = DescriptionTreeBuilder.createTree(this.context, g.result);
let i = this.a8.item(b);
if (h.c("Type")) {
let j = h.a("Type").b;
return this.b8(j, h, b, i, true, -1, null);
}
else {
return this.b7(typeCast(JsonDictionaryObject.$, d));
}
}
loadJson(a, b) {
this.dq(a, b, null, false, false, false);
}
loadJsonOverlay(a, b, c) {
this.dq(a, b, c, true, false, true);
}
loadJsonDelta(a, b, c) {
this.dq(a, b, null, true, c, false);
}
get preserveKeyOrder() {
return this._preserveKeyOrder;
}
set preserveKeyOrder(a) {
this._preserveKeyOrder = a;
}
at() {
return false;
}
ds(a) {
}
get allowNullForRemove() {
return this._allowNullForRemove;
}
set allowNullForRemove(a) {
this._allowNullForRemove = a;
}
dq(a, b, c, d, e, f) {
let g = new JsonDictionaryParser();
let h = g.parse(a);
let i = new DescriptionSerializer();
i.h = this.isProceedOnErrorEnabled;
i.g = this.at();
let j = null;
if (typeCast(JsonDictionaryObject.$, h) !== null) {
let k = h;
if (k.g("skipAlterDataCasing")) {
let l = k.item("skipAlterDataCasing");
if (l.value) {
this.ds(true);
}
}
else {
this.ds(false);
}
let m = null;
if (k.g("animationIdleRef") || k.g("hasAnimations")) {
m = "AnimationIdleHandler";
if (k.g("animationIdleRef")) {
m = k.item("animationIdleRef").value;
}
}
let n = 0;
if (k.g("animationIdleTimeout")) {
n = truncate(k.item("animationIdleTimeout").value);
}
if (k.g("descriptions")) {
let o = k.item("descriptions");
if (typeCast(JsonDictionaryObject.$, o) !== null) {
let p = o;
let q = p.e();
for (let r = 0; r < q.length; r++) {
let s = q[r];
let t = p.item(s);
let u = b(s);
if (u == null) {
continue;
}
j = u;
let v = false;
let w = this.bl();
if (w != null) {
v = true;
}
let x = null;
if (this.isProceedOnErrorEnabled) {
try {
x = i.d(this.context, t, v, w, false);
}
catch (y) {
return;
}
}
else {
x = i.d(this.context, t, v, w, false);
}
if (x.result == null && !this.allowNullForRemove) {
continue;
}
if (f) {
if (!this.bc.containsKey(u)) {
let z = null;
if (this.isProceedOnErrorEnabled) {
try {
z = i.d(this.context, t, v, w, true);
}
catch (aa) {
return;
}
}
else {
z = i.d(this.context, t, v, w, true);
}
this.ee(z.result, u, d, true, false, m, n);
m = null;
let ab = c(s);
let ac = this.bc.item(u);
this.dj(this.ax.item(u), ab, ac, u);
}
}
this.ee(x.result, u, d, e, false, m, n);
m = null;
}
}
}
if (k.g("refs") && j != null) {
let ad = k.item("refs");
let ae = this.aj(ad);
if (!ae && typeCast(JsonDictionaryObject.$, ad) !== null) {
let af = ad;
let ag = af.e();
for (let ah = 0; ah < ag.length; ah++) {
let ai = ag[ah];
let aj = af.item(ai);
if (typeCast(JsonDictionaryValue.$, aj) !== null) {
let ak = aj;
this.provideRefValue(j, ai, ak.value);
}
else if (typeCast(JsonDictionaryArray.$, aj) !== null) {
let al = aj;
let am = this.a(al);
this.provideRefValue(j, ai, am);
}
else {
let an = this.b7(aj);
this.provideRefValue(j, ai, an);
}
}
}
}
if (k.g("modules") && j != null) {
let ao = k.item("modules");
this.ag(ao);
}
if (k.g("strings") && j != null) {
let ap = k.item("strings");
this.an(ap);
}
if (k.g("onInit") && j != null) {
let aq = k.item("onInit");
this.ah(aq);
}
if (k.g("onViewInit") && j != null) {
let ar = k.item("onViewInit");
this.ai(ar);
}
}
}
provideRefValueFromJson(a, b, c) {
let d = b;
let e = new JsonDictionaryParser();
let f = e.parse(c);
if (typeCast(JsonDictionaryValue.$, f) !== null) {
let g = f;
this.provideRefValue(a, d, g.value);
}
else if (typeCast(JsonDictionaryArray.$, f) !== null) {
let h = f;
let i = this.a(h);
this.provideRefValue(a, d, i);
}
else {
let j = this.b7(f);
this.provideRefValue(a, d, j);
}
}
addMemberPathTransformer(a) {
this.bf.add(a);
}
removeMemberPathTransformer(a) {
this.bf.remove(a);
}
addReferenceResolver(a) {
this.bh.add(a);
}
removeReferenceResolver(a) {
this.bh.remove(a);
}
e(a) {
if (this.bh.count == 0) {
return null;
}
let b = new ComponentRendererReferenceResolverEventArgs();
for (let c = 0; c < this.bh.count; c++) {
this.bh._inner[c](a, b);
}
return b;
}
bl() {
if (this.bf.count > 0) {
return (a) => {
let b = a;
for (let c = 0; c < this.bf.count; c++) {
b = this.bf._inner[c](b);
}
return b;
};
}
return null;
}
aj(a) {
return false;
}
ag(a) {
return false;
}
an(a) {
return false;
}
ah(a) {
return false;
}
ai(a) {
return false;
}
cy(a, b, c) {
let d = a;
if (c != null) {
d = c.k(b);
}
else {
if (TypeDescriptionMetadata.shouldCamelize(b)) {
d = TypeDescriptionMetadata.camelize(d);
}
}
if (stringEndsWith(d, "Ref")) {
d = d.substr(0, d.length - ("Ref").length);
}
return d;
}
dj(a, b, c, d) {
if (!c.b(b)) {
c.k(d, this.ax.item(d).g, b, this.ax.item(d), runOn(this, this.dx), -1);
}
for (let e of fromEnum(a.f())) {
this.dk(this.cy(e.c, ComponentRenderer.platform, e.a), e.b, b, c, d, a.g);
}
}
dk(a, b, c, d, e, f) {
if (typeCast(DescriptionTreeNode.$, b) !== null) {
let g = b;
let h = this.adapter.getPropertyValue(c, a);
if (!d.b(h) && !d.a(g.g)) {
d.k(e, g.g, h, g, runOn(this, this.dx), f);
}
for (let i of fromEnum(g.f())) {
this.dk(a + "." + this.cy(i.c, ComponentRenderer.platform, i.a), i.b, c, d, e, g.g);
}
}
if (typeCast(Array_$type, b) !== null) {
let j = new Dictionary$2(Number_$type, DescriptionTreeNode.$, 0);
let k = 0;
let l = b.length;
let o = b;
for (let n = 0; n < o.length; n++) {
let m = o[n];
if (typeCast(DescriptionTreeNode.$, m) !== null) {
let p = m;
j.item(k, p);
}
k++;
}
let q = this.adapter.getPropertyValue(c, a);
k = 0;
this.adapter.forPropertyValueItem(c, a, (r) => {
if (j.containsKey(k)) {
let s = j.item(k);
if (!d.b(r) && !d.a(s.g)) {
d.k(e, s.g, r, s, runOn(this, this.dx), f);
}
for (let t of fromEnum(s.f())) {
this.dk(a + "." + t.c, t.b, c, d, e, s.g);
}
}
k++;
});
if (l > 0 && k == 0) {
let r = this.c3(a);
this.adapter.forPropertyValueItem(c, r, (s) => {
if (j.containsKey(k)) {
let t = j.item(k);
if (!d.b(s) && !d.a(t.g)) {
d.k(e, t.g, s, t, runOn(this, this.dx), f);
}
for (let u of fromEnum(t.f())) {
this.dk(r + "." + u.c, u.b, c, d, e, t.g);
}
}
k++;
});
}
}
}
c3(a) {
let b = a.lastIndexOf('.');
let c = null;
let d = a;
if (b > 0) {
c = a.substr(0, b);
d = a.substr(b + 1);
}
d = "actual" + this.c0(d);
if (c != null) {
return c + "." + d;
}
return d;
}
c0(a) {
return a.substr(0, 1).toUpperCase() + a.substr(1);
}
a(a) {
let b = new Array(a.items.length);
for (let c = 0; c < a.items.length; c++) {
let d = this.b7(a.items[c]);
b[c] = d;
}
return b;
}
b7(a) {
if (a == null) {
return null;
}
let b = {};
let dict_ = b;
let c = a.e();
for (let d = 0; d < c.length; d++) {
let key_ = c[d];
if (typeCast(JsonDictionaryObject.$, a.item(key_)) !== null) {
let val_ = this.b7(a.item(key_));
dict_[key_] = val_;
}
else if (typeCast(JsonDictionaryArray.$, a.item(key_)) !== null) {
let val_ = this.a(a.item(key_));
dict_[key_] = val_;
}
else {
let val_ = a.item(key_).value;
dict_[key_] = val_;
}
}
return dict_;
}
get bc() {
return this.a8;
}
cleanup(a, b) {
this.bn = a;
this.ee(null, a, false, false, b, null, 0);
}
render(a, b) {
this.ee(a, b, false, false, false, null, 0);
}
ee(a, b, c, d, e, f, g) {
if (!this.a8.containsKey(b)) {
this.a8.item(b, new ContainerState());
this.a8.item(b).i = b;
}
this.a2.item(b, a);
this.a3.item(b, c);
this.a4.item(b, d);
this.a1.item(b, e);
this.az.item(b, f);
this.a0.item(b, g);
this.dt(b, () => this.ec(b));
}
dt(a, b) {
this.adapter.onUIThread(a, b);
}
ec(a) {
if (this.a2.containsKey(a)) {
let b = this.a3.containsKey(a) ? this.a3.item(a) : false;
let c = this.a4.containsKey(a) ? this.a4.item(a) : false;
let d = this.a2.item(a);
let e = this.az.containsKey(a) ? this.az.item(a) : null;
let f = this.a0.containsKey(a) ? this.a0.item(a) : 0;
this.a2.removeItem(a);
let g = DescriptionTreeBuilder.createTreeWithOptions(this.context, d, this.preserveKeyOrder);
let h = null;
if (this.ax.containsKey(a)) {
h = this.ax.item(a);
}
let i = DescriptionTreeReconciler.c(h, g, b);
if (!c && b) {
g = h.b();
DescriptionTreeReconciler.a(h, i);
let j = h;
h = g;
g = j;
i = DescriptionTreeReconciler.c(h, g, false);
}
if (c) {
let k = DescriptionTreeReconciler.a(h, i);
if (!this.a8.containsKey(a)) {
this.a8.addItem(a, ((() => {
let $ret = new ContainerState();
$ret.i = a;
return $ret;
})()));
}
let l = this.a8.item(a);
if (k.a.count > 0) {
for (let m of fromEnum(k.a)) {
if (l.a(m)) {
let n = l.j(m);
this.dh(a, n, l);
}
}
}
if (k.c.count > 0) {
for (let o of fromEnum(k.c)) {
let p = this.ce(a, l, o);
let q = this.adapter.getPropertyValue(p, o.j);
if (q != null) {
if (!l.b(q)) {
let r = o.g;
if (typeCast(DescriptionTreeNode.$, r) !== null) {
let s = r.g;
l.k(a, s, q, r, runOn(this, this.dx), o.c.g);
}
}
}
}
}
if (k.d.count > 0) {
for (let t of fromEnum(k.d)) {
let u = t.g;
if (u != null) {
if (!l.b(u)) {
let v = t.g;
if (typeCast(DescriptionTreeNode.$, v) !== null) {
let w = v.g;
this.ax.item(a, v);
}
}
}
}
}
if (k.b.count > 0) {
for (let x of fromEnum(k.b)) {
let y = x.c.a(x.j).b;
if (y == null) {
continue;
}
let z = new Dictionary$2(String_$type, DescriptionTreeNode.$, 0);
for (let aa = 0; aa < y.length; aa++) {
let ab = y[aa];
if (typeCast(DescriptionTreeNode.$, ab) !== null) {
let ac = ab;
if (ac.c("Name")) {
z.item(ac.a("Name").b, ac);
}
}
}
if (z.count == 0) {
continue;
}
let ad = this.ce(a, l, x);
let ae = this.adapter.getPropertyValue(ad, x.j);
if (ae != null) {
let af = 0;
this.adapter.forPropertyValueItem(ad, x.j, (ag) => {
if (z.containsKey(this.adapter.getPropertyValue(ag, "Name").toString())) {
if (!l.b(ag)) {
let ah = z.item(this.adapter.getPropertyValue(ag, "Name").toString());
if (typeCast(DescriptionTreeNode.$, ah) !== null) {
let ai = ah.g;
l.k(a, ai, ag, ah, runOn(this, this.dx), x.c.g);
}
}
}
af++;
});
}
}
}
}
else {
this.ax.item(a, g);
}
if (!c) {
if (e != null && this.w(e)) {
let ag = this.bb.item(e);
if (ag != null) {
let ah = GlobalAnimationState.d.i();
if (f > 0) {
GlobalAnimationState.d.n((ai) => ag(ai), ah, f);
}
else {
GlobalAnimationState.d.m(() => ag(false), ah);
}
}
}
this.ed(a, i);
}
if (this.a1.item(a)) {
this.ea(a);
if (this.a8.containsKey(a)) {
this.a8.removeItem(a);
}
}
}
if (this.bn != null) {
if (this.a2.containsKey(this.bn)) {
this.a2.removeItem(this.bn);
}
if (this.a3.containsKey(this.bn)) {
this.a3.removeItem(this.bn);
}
if (this.a4.containsKey(this.bn)) {
this.a4.removeItem(this.bn);
}
if (this.a1.containsKey(this.bn)) {
this.a1.removeItem(this.bn);
}
if (this.ax.containsKey(this.bn)) {
this.ax.removeItem(this.bn);
}
if (this.a5.containsKey(this.bn)) {
this.a5.removeItem(this.bn);
}
if (this.ay.containsKey(this.bn)) {
this.ay.removeItem(this.bn);
}
if (this.aw.containsKey(this.bn)) {
this.aw.removeItem(this.bn);
}
if (this.a0.containsKey(this.bn)) {
this.a0.removeItem(this.bn);
}
if (this.az.containsKey(this.bn)) {
this.az.removeItem(this.bn);
}
this.bn = null;
}
}
getTargetValue(a, b, c) {
let d = this.context.getMetadata(a, this.c0(b));
let e = d.k(ComponentRenderer.platform);
return this.adapter.getPropertyValue(c, e);
}
setTargetValue(a, b, c, d, e) {
let f = this.context.getMetadata(a, this.c0(b));
let g = f.k(ComponentRenderer.platform);
this.adapter.setPropertyValue(c, g, f, d, e, null);
}
executeMethod(a, b, c) {
let d = new JsonDictionaryParser();
let e = d.parse(b);
if (!this.a8.containsKey(a)) {
this.a8.item(a, new ContainerState());
this.a8.item(a).i = a;
}
let f = this.a8.item(a);
let g = new DescriptionSerializer();
g.h = this.isProceedOnErrorEnabled;
g.g = this.at();
let h = this.ax.item(a);
let i = null;
let j = new List$1(Base.$, 0);
let k = new List$1(TypeDescriptionMetadata.$, 0);
if (typeCast(JsonDictionaryObject.$, e) !== null) {
let l = null;
let m = e;
if (m.g("targetRef")) {
l = this.cw(m, "targetRef");
}
let n = null;
if (m.g("methodName")) {
n = this.cw(m, "methodName");
}
if (l != null) {
if (this.a9.containsKey(l)) {
i = this.a9.item(l);
}
}
else {
i = f.j(h.g);
}
if (m.g("args")) {
let o = m.item("args");
for (let p = 0; p < o.items.length; p++) {
let q = o.items[p];
let r = this.h(h, q, g);
let s = null;
if (typeCast(DescriptionTreeNode.$, r.g) !== null && r.g.i == "EmbeddedRef") {
s = this.cg(a, r.g);
}
else {
s = this.cb(r, a, f);
}
if (r.d.knownType == 8 && r.d.specificType == "string") {
s = this.bw(r.d.specificExternalType, s, r.d);
}
j.add1(s);
k.add(r.d);
}
}
let t = null;
if (m.g("return")) {
let u = m.item("return");
let v = this.h(h, u, g);
t = v.d;
}
this.adapter.executeMethod(i, n, j.toArray(), k.toArray(), (w) => {
let x = this.c1(w, t);
c(x);
});
}
}
cg(a, b) {
if (b.i == "EmbeddedRef") {
let c = "uuid";
let d = null;
for (let e = 0; e < b.f().count; e++) {
if (b.f()._inner[e].c == "RefType") {
c = b.f()._inner[e].b;
}
if (b.f()._inner[e].c == "Value") {
d = b.f()._inner[e].b;
}
}
if (d != null) {
for (let f = 0; f < this.be.count; f++) {
let g = this.be._inner[f](a, c, d);
if (g != null) {
return g;
}
}
if (c == "name") {
let h = d;
if (this.a9.containsKey(h)) {
return this.a9.item(h);
}
if (this.bb.containsKey(h)) {
return this.bb.item(h);
}
}
return null;
}
}
return null;
}
static bk(a) {
if (typeCast(Date_$type, a) !== null) {
return a.getTime();
}
if (a == null) {
return 0;
}
return a;
}
c1(a, b) {
let c = new JsonDictionaryObject();
c.item("knownType", ((() => {
let $ret = new JsonDictionaryValue();
$ret.e = 2;
$ret.value = EnumUtil.getName(TypeDescriptionWellKnownType_$type, b.knownType);
return $ret;
})()));
if (b.specificType != null) {
c.item("specificType", ((() => {
let $ret = new JsonDictionaryValue();
$ret.e = 2;
$ret.value = b.specificType;
return $ret;
})()));
}
if (b.specificExternalType != null) {
c.item("specificExternalType", ((() => {
let $ret = new JsonDictionaryValue();
$ret.e = 2;
$ret.value = b.specificExternalType;
return $ret;
})()));
}
if (b.collectionElementType != null) {
c.item("collectionElementType", ((() => {
let $ret = new JsonDictionaryValue();
$ret.e = 2;
$ret.value = b.collectionElementType;
return $ret;
})()));
}
switch (b.knownType) {
case 0: break;
case 1:
c.item("result", ((() => {
let $ret = new JsonDictionaryValue();
$ret.e = 0;
$ret.value = ComponentRenderer.bk(a);
return $ret;
})()));
break;
case 2:
c.item("result", ((() => {
let $ret = new JsonDictionaryValue();
$ret.e = 2;
$ret.value = a != null ? a.toString() : null;
return $ret;
})()));
break;
case 3:
c.item("result", ((() => {
let $ret = new JsonDictionaryValue();
$ret.e = 2;
$ret.value = a != null ? a.toString() : null;
return $ret;
})()));
break;
case 4:
c.item("result", ((() => {
let $ret = new JsonDictionaryValue();
$ret.e = 2;
$ret.value = this.ch(a);
return $ret;
})()));
break;
case 5:
c.item("result", ((() => {
let $ret = new JsonDictionaryValue();
$ret.e = 2;
$ret.value = this.cj(a);
return $ret;
})()));
break;
case 6:
c.item("result", ((() => {
let $ret = new JsonDictionaryValue();
$ret.e = 2;
$ret.value = this.ci(a);
return $ret;
})()));
break;
case 7:
c.item("result", ((() => {
let $ret = new JsonDictionaryValue();
$ret.e = 1;
$ret.value = a;
return $ret;
})()));
break;
case 8: break;
case 9: break;
case 10: break;
case 11:
c.item("result", ((() => {
let $ret = new JsonDictionaryValue();
$ret.e = 2;
$ret.value = this.cm(a);
return $ret;
})()));
break;
case 12:
c.item("result", this.co(a));
break;
case 13: break;
case 14:
c.item("result", ((() => {
let $ret = new JsonDictionaryValue();
$ret.e = 2;
$ret.value = this.cn(a);
return $ret;
})()));
break;
case 15: break;
case 16:
c.item("result", ((() => {
let $ret = new JsonDictionaryValue();
$ret.e = 2;
$ret.value = this.ck(a);
return $ret;
})()));
break;
case 17: break;
case 18: break;
case 19: break;
case 20: break;
case 21:
c.item("result", ((() => {
let $ret = new JsonDictionaryValue();
$ret.e = 2;
$ret.value = this.cp(a);
return $ret;
})()));
break;
case 22: break;
case 23:
c.item("result", ((() => {
let $ret = new JsonDictionaryValue();
$ret.e = 2;
$ret.value = this.cl(a);
return $ret;
})()));
break;
}
return c.b();
}
cl(a) {
return this.adapter.serializeDoubleCollection(a);
}
cp(a) {
return this.adapter.serializeTimespan(a);
}
ck(a) {
return this.adapter.serializeColorCollection(a);
}
cn(a) {
return this.adapter.serializeRect(a);
}
co(a) {
return this.adapter.serializeSize(a);
}
cm(a) {
return this.adapter.serializePoint(a);
}
ci(a) {
return this.adapter.serializeBrushCollection(a);
}
cj(a) {
return this.adapter.serializeColor(a);
}
ch(a) {
return this.adapter.serializeBrush(a);
}
h(a, b, c) {
let d = new DescriptionTreeAction();
d.a = 0;
d.c = a;
d.j = "*argument";
let e = new TypeDescriptionMetadata();
e.propertyName = "*argument";
let f;
let g = this.cw(b, "knownType");
let h = EnumUtil.tryParse$1(TypeDescriptionWellKnownType_$type, g, true, f);
f = h.p2;
e.knownType = f;
e.specificExternalType = this.cw(b, "specificExternalType");
e.specificType = this.cw(b, "specificType");
e.collectionElementType = this.cw(b, "collectionElementType");
d.d = e;
let i = null;
i = this.ca(e, b, c);
d.g = i;
return d;
}
cw(a, b) {
if (typeCast(JsonDictionaryObject.$, a) !== null) {
let c = a;
if (c.g(b)) {
return c.item(b).value != null ? c.item(b).value.toString() : null;
}
}
return null;
}
ca(a, b, c) {
if (typeCast(JsonDictionaryObject.$, b) !== null) {
let d = b;
if (d.g("value")) {
let e = (d.item("value")) != null ? (d.item("value")) : null;
return this.b6(a.knownType, a.specificType, a.specificExternalType, a.collectionElementType, e, c);
}
}
return null;
}
b6(a, b, c, d, e, f) {
if (typeCast(JsonDictionaryObject.$, e) !== null) {
let g = e;
if (g.g("type") || g.g("refType")) {
let h = f.c(this.context, g.b());
if (h != null) {
let i = h.result;
if (i == null) {
return null;
}
return DescriptionTreeBuilder.createTreeWithOptions(this.context, i, this.preserveKeyOrder);
}
return null;
}
else if (a == 11) {
let j = DescriptionSerializer.k(this.context, g);
return DescriptionTreeBuilder.createTreeWithOptions(this.context, j, this.preserveKeyOrder);
}
else if (a == 14) {
let k = DescriptionSerializer.k(this.context, g);
return DescriptionTreeBuilder.createTreeWithOptions(this.context, k, this.preserveKeyOrder);
}
else if (a == 12) {
let l = DescriptionSerializer.k(this.context, g);
return DescriptionTreeBuilder.createTreeWithOptions(this.context, l, this.preserveKeyOrder);
}
}
else if (typeCast(JsonDictionaryArray.$, e) !== null) {
let m = e;
let n = "string";
let o = false;
if (a == 10) {
n = c;
}
if (a == 9) {
o = true;
n = d;
}
let p = new Array(m.items.length);
let q;
let r;
let s;
let t;
let u = this.dm(o, n, b, c, q, r, s, t);
q = u.p4;
r = u.p5;
s = u.p6;
t = u.p7;
if (m.items != null) {
for (let v = 0; v < m.items.length; v++) {
let w = m.items[v];
let x = this.b6(q, r, s, t, w, f);
p[v] = x;
}
}
return p;
}
else if (typeCast(JsonDictionaryValue.$, e) !== null) {
return e.value;
}
return e;
}
dm(a, b, c, d, e, f, g, h) {
if (a) {
e = 8;
f = b;
g = null;
h = null;
return {
p4: e,
p5: f,
p6: g,
p7: h
};
}
let i = c;
if (d != null) {
i = d;
}
h = null;
switch (d) {
case "string":
if (c != null && c != "string") {
e = 8;
f = "string";
g = d;
}
else {
e = 2;
f = null;
g = null;
}
return {
p4: e,
p5: f,
p6: g,
p7: h
};
case "double":
e = 1;
f = "double";
g = "double";