typecomposer 0.0.6 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/core/element/action/CheckBox.d.ts +20 -5
- package/dist/cjs/core/element/action/CheckBox.js +58 -5
- package/dist/cjs/core/element/action/CheckBox.js.map +1 -1
- package/dist/cjs/core/element/action/DropDown.d.ts +40 -0
- package/dist/cjs/core/element/action/DropDown.js +159 -0
- package/dist/cjs/core/element/action/DropDown.js.map +1 -0
- package/dist/cjs/core/element/index.d.ts +3 -4
- package/dist/cjs/core/element/index.js +4 -5
- package/dist/cjs/core/element/index.js.map +1 -1
- package/dist/cjs/core/ref/Ref.d.ts +8 -9
- package/dist/cjs/core/ref/Ref.js +67 -111
- package/dist/cjs/core/ref/Ref.js.map +1 -1
- package/dist/cjs/core/ref/index.d.ts +1 -2
- package/dist/cjs/core/ref/index.js +2 -4
- package/dist/cjs/core/ref/index.js.map +1 -1
- package/dist/cjs/core/router/Router.js +3 -2
- package/dist/cjs/core/router/Router.js.map +1 -1
- package/dist/esm/core/element/action/CheckBox.d.ts +20 -5
- package/dist/esm/core/element/action/CheckBox.js +56 -4
- package/dist/esm/core/element/action/CheckBox.js.map +1 -1
- package/dist/esm/core/element/action/DropDown.d.ts +40 -0
- package/dist/esm/core/element/action/DropDown.js +154 -0
- package/dist/esm/core/element/action/DropDown.js.map +1 -0
- package/dist/esm/core/element/index.d.ts +3 -4
- package/dist/esm/core/element/index.js +4 -5
- package/dist/esm/core/element/index.js.map +1 -1
- package/dist/esm/core/ref/Ref.d.ts +8 -9
- package/dist/esm/core/ref/Ref.js +65 -109
- package/dist/esm/core/ref/Ref.js.map +1 -1
- package/dist/esm/core/ref/index.d.ts +1 -2
- package/dist/esm/core/ref/index.js +1 -2
- package/dist/esm/core/ref/index.js.map +1 -1
- package/dist/esm/core/router/Router.js +3 -2
- package/dist/esm/core/router/Router.js.map +1 -1
- package/package.json +1 -1
- package/styles/style.scss +108 -15
- package/dist/cjs/core/element/action/SelectBox.d.ts +0 -20
- package/dist/cjs/core/element/action/SelectBox.js +0 -77
- package/dist/cjs/core/element/action/SelectBox.js.map +0 -1
- package/dist/cjs/core/element/dropdown/DropdownElement.d.ts +0 -8
- package/dist/cjs/core/element/dropdown/DropdownElement.js +0 -34
- package/dist/cjs/core/element/dropdown/DropdownElement.js.map +0 -1
- package/dist/cjs/core/ref/Ref2.d.ts +0 -19
- package/dist/cjs/core/ref/Ref2.js +0 -65
- package/dist/cjs/core/ref/Ref2.js.map +0 -1
- package/dist/esm/core/element/action/SelectBox.d.ts +0 -20
- package/dist/esm/core/element/action/SelectBox.js +0 -73
- package/dist/esm/core/element/action/SelectBox.js.map +0 -1
- package/dist/esm/core/element/dropdown/DropdownElement.d.ts +0 -8
- package/dist/esm/core/element/dropdown/DropdownElement.js +0 -30
- package/dist/esm/core/element/dropdown/DropdownElement.js.map +0 -1
- package/dist/esm/core/ref/Ref2.d.ts +0 -19
- package/dist/esm/core/ref/Ref2.js +0 -61
- package/dist/esm/core/ref/Ref2.js.map +0 -1
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Ref = void 0;
|
|
4
|
-
class Ref {
|
|
5
|
-
_id = Math.random().toString(36).substr(2, 9);
|
|
6
|
-
_value;
|
|
7
|
-
registry;
|
|
8
|
-
_subscribers = [];
|
|
9
|
-
constructor(value) {
|
|
10
|
-
this._value = value;
|
|
11
|
-
this._value = value;
|
|
12
|
-
this.registry = new FinalizationRegistry((target) => {
|
|
13
|
-
this._subscribers = this._subscribers.filter((subscriber) => subscriber.target != target);
|
|
14
|
-
console.log("registry: ", target);
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
get value() {
|
|
18
|
-
return this._value;
|
|
19
|
-
}
|
|
20
|
-
set value(v) {
|
|
21
|
-
this._value = v;
|
|
22
|
-
this.notify();
|
|
23
|
-
}
|
|
24
|
-
get id() {
|
|
25
|
-
return this._id;
|
|
26
|
-
}
|
|
27
|
-
notify() {
|
|
28
|
-
const remove = [];
|
|
29
|
-
this._subscribers.forEach((subscriber) => {
|
|
30
|
-
if (!this.setValueToSubscriber(subscriber, true))
|
|
31
|
-
remove.push(subscriber);
|
|
32
|
-
});
|
|
33
|
-
this._subscribers = this._subscribers.filter((subscriber) => !remove.includes(subscriber));
|
|
34
|
-
}
|
|
35
|
-
setValueToSubscriber(subscriber, checkContext = false) {
|
|
36
|
-
try {
|
|
37
|
-
const target = subscriber.target?.deref();
|
|
38
|
-
if (target)
|
|
39
|
-
target[subscriber.propertyKey] = this._value;
|
|
40
|
-
else
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
catch (error) {
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
return true;
|
|
47
|
-
}
|
|
48
|
-
subscriber(target, propertyKey) {
|
|
49
|
-
const item = { target: new WeakRef(target), propertyKey };
|
|
50
|
-
if (this.setValueToSubscriber(item)) {
|
|
51
|
-
this._subscribers.push(item);
|
|
52
|
-
this.registry.register(target, item);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
unsubscribe(data) {
|
|
56
|
-
// this._subscribers = this._subscribers.filter(
|
|
57
|
-
// (subscriber) => subscriber != data,
|
|
58
|
-
// );
|
|
59
|
-
}
|
|
60
|
-
toString() {
|
|
61
|
-
return this._value?.toString() || "";
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
exports.Ref = Ref;
|
|
65
|
-
//# sourceMappingURL=Ref2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Ref2.js","sourceRoot":"","sources":["../../../../src/core/ref/Ref2.ts"],"names":[],"mappings":";;;AAMA,MAAa,GAAG;IACN,GAAG,GAAW,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,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C;YACH,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC;YAC1C,IAAI,MAAM;gBAAE,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;;gBACpD,OAAO,KAAK,CAAC;QACpB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,UAAU,CAAC,MAAW,EAAE,WAA4B;QACzD,MAAM,IAAI,GAAG,EAAE,MAAM,EAAE,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;QAC1D,IAAI,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC;YACpC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC7B,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACvC,CAAC;IACH,CAAC;IAEM,WAAW,CAAC,IAAgD;QACjE,gDAAgD;QAChD,wCAAwC;QACxC,KAAK;IACP,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACvC,CAAC;CACF;AAvED,kBAuEC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { DivElement, TextFieldElement, Variant, DataTextFieldElement } from "../..";
|
|
2
|
-
export interface DataSelectBox<T> extends DataTextFieldElement {
|
|
3
|
-
search?: boolean;
|
|
4
|
-
variant?: Variant;
|
|
5
|
-
itemValue?: (e: T) => string;
|
|
6
|
-
}
|
|
7
|
-
export interface SelectBoxItem {
|
|
8
|
-
get value(): string;
|
|
9
|
-
}
|
|
10
|
-
export declare class SelectBox<T = any> extends TextFieldElement {
|
|
11
|
-
private _options;
|
|
12
|
-
private elements;
|
|
13
|
-
private itemValue;
|
|
14
|
-
constructor(optional?: DataSelectBox<T>);
|
|
15
|
-
onInit(): void;
|
|
16
|
-
addItem(item: T): void;
|
|
17
|
-
private filterList;
|
|
18
|
-
filter: (searchTerm: string, value: T) => boolean;
|
|
19
|
-
get options(): DivElement;
|
|
20
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { Component, DivElement, TextFieldElement, } from "../..";
|
|
2
|
-
export class SelectBox extends TextFieldElement {
|
|
3
|
-
_options = new DivElement({ className: "options-container" });
|
|
4
|
-
elements = new Map();
|
|
5
|
-
itemValue = (e) => e;
|
|
6
|
-
constructor(optional) {
|
|
7
|
-
super(optional);
|
|
8
|
-
this.append(this.options);
|
|
9
|
-
this.input.addEventListener("focus", () => {
|
|
10
|
-
if (!this.options.classList.contains("active")) {
|
|
11
|
-
this.options.classList.add("active");
|
|
12
|
-
if (optional?.search)
|
|
13
|
-
this.filterList(this.input.value);
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
this.input.readOnly = !(optional?.search || false);
|
|
17
|
-
if (this.input.readOnly)
|
|
18
|
-
this.input.style.userSelect = "none";
|
|
19
|
-
this.input.addEventListener("input", () => {
|
|
20
|
-
if (optional?.search) {
|
|
21
|
-
this.filterList(this.input.value);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
this.input.addEventListener("blur", () => {
|
|
25
|
-
setTimeout(() => {
|
|
26
|
-
if (this.options.classList.contains("active"))
|
|
27
|
-
this.options.classList.remove("active");
|
|
28
|
-
}, 100);
|
|
29
|
-
});
|
|
30
|
-
if (optional?.itemValue)
|
|
31
|
-
this.itemValue = optional.itemValue;
|
|
32
|
-
// @ts-ignore
|
|
33
|
-
Component.setVariant(this.options, optional?.variant);
|
|
34
|
-
console.log(this.itemValue);
|
|
35
|
-
}
|
|
36
|
-
onInit() {
|
|
37
|
-
this.options.style.marginTop = this.offsetTop + 14 + "px";
|
|
38
|
-
}
|
|
39
|
-
addItem(item) {
|
|
40
|
-
const option = new DivElement({ className: "option" });
|
|
41
|
-
if (item instanceof HTMLElement)
|
|
42
|
-
option.appendChild(item);
|
|
43
|
-
else
|
|
44
|
-
option.innerHTML = item;
|
|
45
|
-
option.addEventListener("click", () => {
|
|
46
|
-
this.input.value = this.itemValue(item);
|
|
47
|
-
this.options.classList.remove("active");
|
|
48
|
-
});
|
|
49
|
-
this.elements.set(option, item);
|
|
50
|
-
this.options.append(option);
|
|
51
|
-
}
|
|
52
|
-
filterList(searchTerm) {
|
|
53
|
-
this.elements.forEach((value, option) => {
|
|
54
|
-
if (this.filter(searchTerm, value)) {
|
|
55
|
-
option.style.display = "block";
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
option.style.display = "none";
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
filter = (searchTerm, value) => {
|
|
63
|
-
return this.itemValue(value)
|
|
64
|
-
.toLowerCase()
|
|
65
|
-
.includes(searchTerm.toLowerCase());
|
|
66
|
-
};
|
|
67
|
-
get options() {
|
|
68
|
-
return this._options;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
// @ts-ignore
|
|
72
|
-
customElements.define("select-box", SelectBox);
|
|
73
|
-
//# sourceMappingURL=SelectBox.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SelectBox.js","sourceRoot":"","sources":["../../../../../src/core/element/action/SelectBox.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAET,UAAU,EAEV,gBAAgB,GAGjB,MAAM,OAAO,CAAC;AAYf,MAAM,OAAO,SAAmB,SAAQ,gBAAgB;IAC9C,QAAQ,GAAG,IAAI,UAAU,CAAC,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC,CAAC;IAC9D,QAAQ,GAAG,IAAI,GAAG,EAAiB,CAAC;IACpC,SAAS,GAAqB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAQ,CAAC;IAEtD,YAAY,QAA2B;QACrC,KAAK,CAAC,QAAQ,CAAC,CAAC;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AAO,GAAG,MAAM,CAAC;YAChC,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,MAAM,GAA8C,CACzD,UAAkB,EAClB,KAAQ,EACR,EAAE;QACF,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;aACzB,WAAW,EAAE;aACb,QAAQ,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC;IACxC,CAAC,CAAC;IAEF,IAAW,OAAO;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF;AACD,aAAa;AACb,cAAc,CAAC,MAAM,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { Component } from "..";
|
|
2
|
-
export class DropdownElement extends Component {
|
|
3
|
-
// @RefComponent({ id: "dropdown-button" })
|
|
4
|
-
// private button!: ButtonElement;
|
|
5
|
-
// @RefComponent({ id: "dropdown-pane" })
|
|
6
|
-
// private pane!: HTMLDivElement;
|
|
7
|
-
// @RefComponent({ id: "dropdown-title" })
|
|
8
|
-
// private dropdownTitle!: H3Element;
|
|
9
|
-
// private titleRef: Ref<string> = new Ref("");
|
|
10
|
-
constructor(optional) {
|
|
11
|
-
super(optional);
|
|
12
|
-
this.addClasName("relative", "inline-block", "text-left");
|
|
13
|
-
}
|
|
14
|
-
onInit() {
|
|
15
|
-
// this.titleRef.value = this.dropdownTitle.innerHTML;
|
|
16
|
-
// this.dropdownTitle.innerHTML = this.titleRef;
|
|
17
|
-
// //"Dropdown";
|
|
18
|
-
// // this.pane.classList.toggle("hidden");
|
|
19
|
-
// // console.log("button: ", this.pane);
|
|
20
|
-
// this.button.onclick = () => {
|
|
21
|
-
// console.log("click");
|
|
22
|
-
// this.titleRef.value = "Dropdown_" + Math.random();
|
|
23
|
-
// // this.pane.classList.toggle("hidden");
|
|
24
|
-
// // this.button.classList.toggle("display");
|
|
25
|
-
// }
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
// @ts-ignore
|
|
29
|
-
customElements.define("dropdown-element", DropdownElement);
|
|
30
|
-
//# sourceMappingURL=DropdownElement.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownElement.js","sourceRoot":"","sources":["../../../../../src/core/element/dropdown/DropdownElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAsB,MAAM,IAAI,CAAC;AAEnD,MAAM,OAAO,eAAgB,SAAQ,SAAS;IAC5C,2CAA2C;IAC3C,kCAAkC;IAClC,yCAAyC;IACzC,iCAAiC;IACjC,0CAA0C;IAC1C,qCAAqC;IAErC,+CAA+C;IAE/C,YACE,QAAiE;QAEjE,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChB,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,cAAc,EAAE,WAAW,CAAC,CAAC;IAC5D,CAAC;IAEM,MAAM;QACX,sDAAsD;QACtD,gDAAgD;QAChD,gBAAgB;QAChB,2CAA2C;QAC3C,yCAAyC;QACzC,gCAAgC;QAChC,4BAA4B;QAC5B,yDAAyD;QACzD,+CAA+C;QAC/C,kDAAkD;QAClD,IAAI;IACN,CAAC;CACF;AACD,aAAa;AACb,cAAc,CAAC,MAAM,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export declare class Ref<T> {
|
|
2
|
-
private _id;
|
|
3
|
-
private _value;
|
|
4
|
-
private registry;
|
|
5
|
-
private _subscribers;
|
|
6
|
-
constructor(value: T);
|
|
7
|
-
get value(): T;
|
|
8
|
-
set value(v: T);
|
|
9
|
-
get id(): string;
|
|
10
|
-
private notify;
|
|
11
|
-
private setValueToSubscriber;
|
|
12
|
-
subscriber(target: any, propertyKey: string | symbol): void;
|
|
13
|
-
unsubscribe(data: {
|
|
14
|
-
ref: any;
|
|
15
|
-
name: string;
|
|
16
|
-
fun?: Function;
|
|
17
|
-
}): void;
|
|
18
|
-
toString(): string;
|
|
19
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
export class Ref {
|
|
2
|
-
_id = Math.random().toString(36).substr(2, 9);
|
|
3
|
-
_value;
|
|
4
|
-
registry;
|
|
5
|
-
_subscribers = [];
|
|
6
|
-
constructor(value) {
|
|
7
|
-
this._value = value;
|
|
8
|
-
this._value = value;
|
|
9
|
-
this.registry = new FinalizationRegistry((target) => {
|
|
10
|
-
this._subscribers = this._subscribers.filter((subscriber) => subscriber.target != target);
|
|
11
|
-
console.log("registry: ", target);
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
get value() {
|
|
15
|
-
return this._value;
|
|
16
|
-
}
|
|
17
|
-
set value(v) {
|
|
18
|
-
this._value = v;
|
|
19
|
-
this.notify();
|
|
20
|
-
}
|
|
21
|
-
get id() {
|
|
22
|
-
return this._id;
|
|
23
|
-
}
|
|
24
|
-
notify() {
|
|
25
|
-
const remove = [];
|
|
26
|
-
this._subscribers.forEach((subscriber) => {
|
|
27
|
-
if (!this.setValueToSubscriber(subscriber, true))
|
|
28
|
-
remove.push(subscriber);
|
|
29
|
-
});
|
|
30
|
-
this._subscribers = this._subscribers.filter((subscriber) => !remove.includes(subscriber));
|
|
31
|
-
}
|
|
32
|
-
setValueToSubscriber(subscriber, checkContext = false) {
|
|
33
|
-
try {
|
|
34
|
-
const target = subscriber.target?.deref();
|
|
35
|
-
if (target)
|
|
36
|
-
target[subscriber.propertyKey] = this._value;
|
|
37
|
-
else
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
catch (error) {
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
return true;
|
|
44
|
-
}
|
|
45
|
-
subscriber(target, propertyKey) {
|
|
46
|
-
const item = { target: new WeakRef(target), propertyKey };
|
|
47
|
-
if (this.setValueToSubscriber(item)) {
|
|
48
|
-
this._subscribers.push(item);
|
|
49
|
-
this.registry.register(target, item);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
unsubscribe(data) {
|
|
53
|
-
// this._subscribers = this._subscribers.filter(
|
|
54
|
-
// (subscriber) => subscriber != data,
|
|
55
|
-
// );
|
|
56
|
-
}
|
|
57
|
-
toString() {
|
|
58
|
-
return this._value?.toString() || "";
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
//# sourceMappingURL=Ref2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Ref2.js","sourceRoot":"","sources":["../../../../src/core/ref/Ref2.ts"],"names":[],"mappings":"AAMA,MAAM,OAAO,GAAG;IACN,GAAG,GAAW,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACtD,MAAM,CAAI;IACV,QAAQ,CAA4B;IACpC,YAAY,GAAkB,EAAE,CAAC;IAEzC,YAAY,KAAQ;QAClB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,QAAQ,GAAG,IAAI,oBAAoB,CAAC,CAAC,MAAoB,EAAE,EAAE;YAChE,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,CAC1C,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,IAAI,MAAM,CAC5C,CAAC;YACF,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;IACL,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,IAAI,KAAK,CAAC,CAAI;QACZ,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAChB,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IAED,IAAI,EAAE;QACJ,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;IAEO,MAAM;QACZ,MAAM,MAAM,G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