@wavemaker/app-rn-runtime 11.4.0-next.25701 → 11.4.0-next.25703
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.
- app-rn-runtime/components/advanced/carousel/carousel.styles.js.map +1 -1
- app-rn-runtime/components/basic/anchor/anchor.styles.js.map +1 -1
- app-rn-runtime/components/basic/button/button.component.js.map +1 -1
- app-rn-runtime/components/basic/buttongroup/buttongroup.component.js.map +1 -1
- app-rn-runtime/components/basic/buttongroup/buttongroup.styles.js.map +1 -1
- app-rn-runtime/components/basic/custom/custom.component.js.map +1 -1
- app-rn-runtime/components/basic/icon/icon.component.js.map +1 -1
- app-rn-runtime/components/basic/label/label.component.js.map +1 -1
- app-rn-runtime/components/basic/label/label.styles.js.map +1 -1
- app-rn-runtime/components/basic/picture/picture.component.js.map +1 -1
- app-rn-runtime/components/basic/picture/picture.styles.js.map +1 -1
- app-rn-runtime/components/container/container.component.js.map +1 -1
- app-rn-runtime/components/container/linearlayout/linearlayout.component.js +0 -1
- app-rn-runtime/components/container/linearlayout/linearlayout.component.js.map +1 -1
- app-rn-runtime/components/container/linearlayout/linearlayoutitem/linearlayoutitem.component.js +2 -2
- app-rn-runtime/components/container/linearlayout/linearlayoutitem/linearlayoutitem.component.js.map +1 -1
- app-rn-runtime/components/data/card/card.styles.js.map +1 -1
- app-rn-runtime/components/data/form/form-action/form-action.component.js +0 -1
- app-rn-runtime/components/data/form/form-action/form-action.component.js.map +1 -1
- app-rn-runtime/components/data/form/form-action/form-action.props.js +1 -3
- app-rn-runtime/components/data/form/form-action/form-action.props.js.map +1 -1
- app-rn-runtime/components/data/form/form-field/form-field.component.js +0 -21
- app-rn-runtime/components/data/form/form-field/form-field.component.js.map +1 -1
- app-rn-runtime/components/data/form/form-field/form-field.props.js +0 -8
- app-rn-runtime/components/data/form/form-field/form-field.props.js.map +1 -1
- app-rn-runtime/components/data/form/form.component.js +1 -92
- app-rn-runtime/components/data/form/form.component.js.map +1 -1
- app-rn-runtime/components/data/form/form.props.js +0 -2
- app-rn-runtime/components/data/form/form.props.js.map +1 -1
- app-rn-runtime/components/data/form/form.styles.js +0 -6
- app-rn-runtime/components/data/form/form.styles.js.map +1 -1
- app-rn-runtime/components/data/list/list.styles.js.map +1 -1
- app-rn-runtime/components/dialogs/alertdialog/alertdialog.styles.js.map +1 -1
- app-rn-runtime/components/input/baseinput/baseinput.component.js +2 -2
- app-rn-runtime/components/input/baseinput/baseinput.component.js.map +1 -1
- app-rn-runtime/components/input/checkbox/checkbox.styles.js.map +1 -1
- app-rn-runtime/components/input/checkboxset/checkboxset.styles.js.map +1 -1
- app-rn-runtime/components/input/epoch/base-datetime.component.js.map +1 -1
- app-rn-runtime/components/input/epoch/datetime/datetime.styles.js.map +1 -1
- app-rn-runtime/components/input/radioset/radioset.styles.js.map +1 -1
- app-rn-runtime/components/input/text/text.styles.js.map +1 -1
- app-rn-runtime/components/input/textarea/textarea.styles.js.map +1 -1
- app-rn-runtime/components/navigation/appnavbar/appnavbar.styles.js.map +1 -1
- app-rn-runtime/components/navigation/menu/menu.component.js.map +1 -1
- app-rn-runtime/components/navigation/menu/menu.styles.js.map +1 -1
- app-rn-runtime/components/navigation/popover/popover.styles.js.map +1 -1
- app-rn-runtime/core/formatters.js.map +1 -1
- app-rn-runtime/core/utils.js +0 -4
- app-rn-runtime/core/utils.js.map +1 -1
- app-rn-runtime/package.json +38 -38
- app-rn-runtime/runtime/base-fragment.component.js +0 -13
- app-rn-runtime/runtime/base-fragment.component.js.map +1 -1
- app-rn-runtime/runtime/base-prefab.component.js +2 -4
- app-rn-runtime/runtime/base-prefab.component.js.map +1 -1
- app-rn-runtime/runtime/watcher.js +1 -3
- app-rn-runtime/runtime/watcher.js.map +1 -1
- app-rn-runtime/styles/theme.js +2 -4
- app-rn-runtime/styles/theme.js.map +1 -1
- app-rn-runtime/styles/theme.variables.js +1 -3
- app-rn-runtime/styles/theme.variables.js.map +1 -1
- app-rn-runtime/variables/http.service.js +2 -6
- app-rn-runtime/variables/http.service.js.map +1 -1
- app-rn-runtime/variables/service-variable.js +1 -6
- app-rn-runtime/variables/service-variable.js.map +1 -1
- app-rn-runtime/variables/utils/variable.utils.js.map +1 -1
- app-rn-runtime/components/data/liveform/liveform.component.js +0 -102
- app-rn-runtime/components/data/liveform/liveform.component.js.map +0 -1
- app-rn-runtime/variables/live-variable.js +0 -115
- app-rn-runtime/variables/live-variable.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["BaseComponentState","forEach","isEmpty","some","get","WmForm","WmFormState","constructor","arguments","_defineProperty","Live_Operations","INSERT","UPDATE","DELETE","READ","WmLiveForm","findOperationType","operation","isPrimary","primaryKey","state","props","formdata","length","value","handleSubmit","event","preventDefault","formData","dataoutput","formdataoutput","operationType","validateFieldsOnSubmit","onBeforesubmit","invokeEventCallback","proxy","formSubmit","inputFields","data","onResultCb","error","response","status","formSuccess","onSuccess","postmessage","toggleMessage","onError","errormessage"],"sources":["liveform.component.tsx"],"sourcesContent":["import { BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\nimport { forEach, isEmpty, some, get } from 'lodash';\n\nimport WmFormProps from '../form/form.props';\nimport WmForm from '@wavemaker/app-rn-runtime/components/data/form/form.component';\n\nexport class WmFormState extends BaseComponentState<WmFormProps> {\n isValid = false;\n type: 'success' | 'warning' | 'error' | 'info' | 'loading' | undefined = 'success';\n message: string = '';\n showInlineMsg: boolean = false;\n}\nconst Live_Operations = {\n INSERT : 'insert',\n UPDATE : 'update',\n DELETE : 'delete',\n READ : 'read'\n}\n\nexport default class WmLiveForm extends WmForm {\n\n findOperationType() {\n let operation;\n let isPrimary = false;\n // const sourceOperation = this.form.datasource && this.form.datasource.execute(DataSource.Operation.GET_OPERATION_TYPE);\n // if (sourceOperation && sourceOperation !== 'read') {\n // return sourceOperation;\n // }\n /*If OperationType is not set then based on the formdata object return the operation type,\n this case occurs only if the form is outside a livegrid*/\n /*If the formdata object has primary key value then return update else insert*/\n if (this.primaryKey && !isEmpty(this.state.props.formdata)) {\n /*If only one column is primary key*/\n if (this.primaryKey.length === 1) {\n if (this.state.props.formdata[this.primaryKey[0]]) {\n operation = Live_Operations.UPDATE;\n }\n /*If only no column is primary key*/\n } else if (this.primaryKey.length === 0) {\n forEach(this.state.props.formdata, (value) => {\n if (value) {\n isPrimary = true;\n }\n });\n if (isPrimary) {\n operation = Live_Operations.UPDATE;\n }\n /*If multiple columns are primary key*/\n } else {\n // @ts-ignore\n isPrimary = some(this.primaryKey, (primaryKey: any) => {\n if (this.state.props.formdata[primaryKey]) {\n return true;\n }\n });\n if (isPrimary) {\n operation = Live_Operations.UPDATE;\n }\n }\n }\n return operation || Live_Operations.INSERT;\n }\n\n // @ts-ignore\n handleSubmit(event?: any) {\n event?.preventDefault();\n const formData = this.state.props.dataoutput || this.formdataoutput;\n const operationType = this.findOperationType();\n\n if (!this.validateFieldsOnSubmit()) {\n return false;\n }\n if (this.props.onBeforesubmit) {\n this.invokeEventCallback('onBeforesubmit', [ null, this.proxy, formData ]);\n }\n if (this.props.formSubmit) {\n this.props.formSubmit({inputFields: formData}, operationType, ((data: any) => {\n this.invokeEventCallback('onSubmit', [ null, this.proxy, formData ]);\n this.onResultCb(get(data, 'params'), 'success');\n }), ((error: any) => {\n this.invokeEventCallback('onSubmit', [ null, this.proxy, formData ]);\n this.onResultCb(error, '');\n }));\n } else {\n this.invokeEventCallback('onSubmit', [ null, this.proxy, formData ]);\n }\n }\n\n onResultCb(response: any, status: string, event?: any) {\n this.invokeEventCallback('onResult', [ null, this.proxy, response ]);\n if (status) {\n this.invokeEventCallback('onSuccess', [ null, this.proxy, response ]);\n this.props.formSuccess && this.props.formSuccess();\n !this.props.onSuccess && this.state.props.postmessage && this.toggleMessage('success', this.state.props.postmessage);\n } else {\n this.invokeEventCallback('onError', [ null, this.proxy, response ]);\n !this.props.onError && this.toggleMessage('error', this.state.props.errormessage || get(response, 'message') || response);\n }\n }\n\n}\n"],"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,QAAQ,CAAC;IAC3H;EACF;AAEF"}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
4
|
-
import { isEqual, isUndefined, isFunction, forEach, isEmpty } from 'lodash';
|
|
5
|
-
import { LiveVariable as _LiveVariable } from '@wavemaker/variables/src/model/variable/live-variable';
|
|
6
|
-
import httpService from '@wavemaker/app-rn-runtime/variables/http.service';
|
|
7
|
-
import injector from '@wavemaker/app-rn-runtime/core/injector';
|
|
8
|
-
import { deepCopy } from '@wavemaker/app-rn-runtime/core/utils';
|
|
9
|
-
import Formatters from '@wavemaker/app-rn-runtime/core/formatters';
|
|
10
|
-
var _LiveVariableEvents = /*#__PURE__*/function (_LiveVariableEvents) {
|
|
11
|
-
_LiveVariableEvents["BEFORE_INVOKE"] = "beforeInvoke";
|
|
12
|
-
return _LiveVariableEvents;
|
|
13
|
-
}(_LiveVariableEvents || {});
|
|
14
|
-
export class LiveVariable extends _LiveVariable {
|
|
15
|
-
constructor(config) {
|
|
16
|
-
const variableConfig = {
|
|
17
|
-
name: config.name,
|
|
18
|
-
dataSet: config.paramProvider(),
|
|
19
|
-
inputFields: config.paramProvider(),
|
|
20
|
-
filterExpressions: config.filterExpressions,
|
|
21
|
-
filterFields: config.paramProvider(),
|
|
22
|
-
isList: config.isList,
|
|
23
|
-
maxResults: config.maxResults,
|
|
24
|
-
_context: config._context,
|
|
25
|
-
operation: config.operation,
|
|
26
|
-
type: config.type,
|
|
27
|
-
autoUpdate: config.autoUpdate,
|
|
28
|
-
liveSource: config.liveSource,
|
|
29
|
-
orderBy: config.orderBy,
|
|
30
|
-
category: config.category,
|
|
31
|
-
properties: config.properties,
|
|
32
|
-
propertiesMap: config.propertiesMap,
|
|
33
|
-
tableName: config.tableName,
|
|
34
|
-
tableType: config.tableType,
|
|
35
|
-
relatedTables: config.relatedTables,
|
|
36
|
-
httpClientService: httpService,
|
|
37
|
-
onSuccess: (context, args) => {
|
|
38
|
-
return config.onSuccess && config.onSuccess(args.variable, args.data, args.options);
|
|
39
|
-
},
|
|
40
|
-
onCanUpdate: (context, args) => {
|
|
41
|
-
return config.onCanUpdate && config.onCanUpdate(args.variable, args.data, args.options);
|
|
42
|
-
},
|
|
43
|
-
onBeforeUpdate: (context, args) => {
|
|
44
|
-
return config.onBeforeUpdate && config.onBeforeUpdate(args.variable, args.dataFilter || args.inputData, args.options);
|
|
45
|
-
},
|
|
46
|
-
onResult: (context, args) => {
|
|
47
|
-
return config.onResult && config.onResult(args.variable, args.data, args.options);
|
|
48
|
-
},
|
|
49
|
-
onBeforeDatasetReady: (context, args) => {
|
|
50
|
-
return config.onBeforeDatasetReady && config.onBeforeDatasetReady(args.variable, args.data, args.options);
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
if (config.onError) {
|
|
54
|
-
variableConfig.onError = (context, args) => {
|
|
55
|
-
return config.onError && config.onError(args.variable, args.data, args.options);
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
super(variableConfig);
|
|
59
|
-
this.config = config;
|
|
60
|
-
_defineProperty(this, "params", {});
|
|
61
|
-
_defineProperty(this, "filters", {});
|
|
62
|
-
_defineProperty(this, "appConfig", injector.get('APP_CONFIG'));
|
|
63
|
-
this.dateFormatter = Formatters.get('toDate');
|
|
64
|
-
this.init();
|
|
65
|
-
}
|
|
66
|
-
setFilterExpValue(filter) {
|
|
67
|
-
var _this$filterExpressio;
|
|
68
|
-
(_this$filterExpressio = this.filterExpressions) === null || _this$filterExpressio === void 0 ? void 0 : _this$filterExpressio.rules.forEach(r => {
|
|
69
|
-
r.value = filter[r.target];
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
invokeOnParamChange() {
|
|
73
|
-
const last = this.params;
|
|
74
|
-
const latest = this.config.paramProvider();
|
|
75
|
-
if (this.config.operation === 'read') {
|
|
76
|
-
const lastFilter = this.filters;
|
|
77
|
-
const latestFilter = this.config.filterProvider && this.config.filterProvider();
|
|
78
|
-
if (!isEqual(lastFilter, latestFilter)) {
|
|
79
|
-
this.setFilterExpValue(latestFilter);
|
|
80
|
-
if (this.autoUpdate && !isEmpty(latestFilter) && isFunction(this.update)) {
|
|
81
|
-
this.filters = latestFilter;
|
|
82
|
-
this.invoke();
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
if (!isEqual(last, latest)) {
|
|
87
|
-
if (this.config.operation === 'read') {
|
|
88
|
-
forEach(latest, (val, key) => {
|
|
89
|
-
this.filterFields[key] = {
|
|
90
|
-
'value': val
|
|
91
|
-
};
|
|
92
|
-
});
|
|
93
|
-
} else {
|
|
94
|
-
this.inputFields = latest;
|
|
95
|
-
}
|
|
96
|
-
/* if auto-update set for the variable with read operation only, get its data */
|
|
97
|
-
// @ts-ignore
|
|
98
|
-
if (this.autoUpdate && !isUndefined(latest) && isFunction(this[this.config.operation + 'Record'])) {
|
|
99
|
-
this.invoke();
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
return Promise.resolve(this);
|
|
103
|
-
}
|
|
104
|
-
listRecords(options, onSuccess, onError) {
|
|
105
|
-
this.filters = this.config.filterProvider && this.config.filterProvider();
|
|
106
|
-
if (options) {
|
|
107
|
-
this.filters = deepCopy({}, this.filters, options.filterFields ? options.filterFields : options);
|
|
108
|
-
}
|
|
109
|
-
options = options || {};
|
|
110
|
-
options.filterFields = this.filters;
|
|
111
|
-
this.setFilterExpValue(this.filters);
|
|
112
|
-
return super.listRecords(options, onSuccess, onError);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
//# sourceMappingURL=live-variable.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["isEqual","isUndefined","isFunction","forEach","isEmpty","LiveVariable","_LiveVariable","httpService","injector","deepCopy","Formatters","_LiveVariableEvents","constructor","config","variableConfig","name","dataSet","paramProvider","inputFields","filterExpressions","filterFields","isList","maxResults","_context","operation","type","autoUpdate","liveSource","orderBy","category","properties","propertiesMap","tableName","tableType","relatedTables","httpClientService","onSuccess","context","args","variable","data","options","onCanUpdate","onBeforeUpdate","dataFilter","inputData","onResult","onBeforeDatasetReady","onError","_defineProperty","get","dateFormatter","init","setFilterExpValue","filter","_this$filterExpressio","rules","r","value","target","invokeOnParamChange","last","params","latest","lastFilter","filters","latestFilter","filterProvider","update","invoke","val","key","Promise","resolve","listRecords"],"sources":["live-variable.ts"],"sourcesContent":["import { VariableConfig, VariableEvents } from './base-variable';\nimport { isEqual, isUndefined, isFunction, forEach, isEmpty } from 'lodash';\nimport AppConfig from '@wavemaker/app-rn-runtime/core/AppConfig';\nimport { LiveVariable as _LiveVariable } from '@wavemaker/variables/src/model/variable/live-variable';\nimport httpService from '@wavemaker/app-rn-runtime/variables/http.service';\nimport injector from '@wavemaker/app-rn-runtime/core/injector';\nimport { deepCopy } from '@wavemaker/app-rn-runtime/core/utils';\nimport Formatters from '@wavemaker/app-rn-runtime/core/formatters';\n\nexport interface LiveVariableConfig extends VariableConfig {\n baseUrl: string;\n maxResults: number;\n _context: any;\n onCanUpdate: any;\n onBeforeUpdate: any;\n onResult: any;\n onBeforeDatasetReady: any;\n inFlightBehavior: string;\n type: string;\n autoUpdate: boolean;\n orderBy: string;\n category: string;\n liveSource: string;\n propertiesMap: any;\n properties: any;\n tableName: string;\n tableType: string;\n relatedTables: any;\n filterExpressions: any;\n filterProvider: any;\n}\n\nenum _LiveVariableEvents {\n BEFORE_INVOKE = 'beforeInvoke'\n}\nexport type LiveVariableEvents = _LiveVariableEvents | VariableEvents;\n\nexport class LiveVariable extends _LiveVariable {\n params: any = {};\n filters: any = {};\n public appConfig = injector.get<AppConfig>('APP_CONFIG');\n\n constructor(public config: LiveVariableConfig) {\n const variableConfig: any = {\n name: config.name,\n dataSet: config.paramProvider(),\n inputFields: config.paramProvider(),\n filterExpressions: config.filterExpressions,\n filterFields: config.paramProvider(),\n isList: config.isList,\n maxResults: config.maxResults,\n _context: config._context,\n operation: config.operation,\n type: config.type,\n autoUpdate: config.autoUpdate,\n liveSource: config.liveSource,\n orderBy: config.orderBy,\n category: config.category,\n properties: config.properties,\n propertiesMap: config.propertiesMap,\n tableName: config.tableName,\n tableType: config.tableType,\n relatedTables: config.relatedTables,\n httpClientService: httpService,\n onSuccess: (context: any, args: any) => {\n return config.onSuccess && config.onSuccess(args.variable, args.data, args.options);\n },\n onCanUpdate: (context: any, args: any) => {\n return config.onCanUpdate && config.onCanUpdate(args.variable, args.data, args.options);\n },\n onBeforeUpdate: (context: any, args: any) => {\n return config.onBeforeUpdate && config.onBeforeUpdate(args.variable, args.dataFilter || args.inputData, args.options);\n },\n onResult: (context: any, args: any) => {\n return config.onResult && config.onResult(args.variable, args.data, args.options);\n },\n onBeforeDatasetReady: (context: any, args: any) => {\n return config.onBeforeDatasetReady && config.onBeforeDatasetReady(args.variable, args.data, args.options);\n }\n }\n if (config.onError) {\n variableConfig.onError = (context: any, args: any) => {\n return config.onError && config.onError(args.variable, args.data, args.options);\n };\n }\n super(variableConfig);\n this.dateFormatter = Formatters.get('toDate');\n this.init();\n }\n\n setFilterExpValue(filter: any) {\n this.filterExpressions?.rules.forEach((r: any) => {\n r.value = filter[r.target];\n });\n }\n\n invokeOnParamChange() {\n const last = this.params;\n const latest = this.config.paramProvider();\n if (this.config.operation === 'read') {\n const lastFilter = this.filters;\n const latestFilter = this.config.filterProvider && this.config.filterProvider();\n if (!isEqual(lastFilter, latestFilter)) {\n this.setFilterExpValue(latestFilter);\n if (this.autoUpdate && !isEmpty(latestFilter) && isFunction(this.update)) {\n this.filters = latestFilter;\n this.invoke();\n }\n }\n }\n if (!isEqual(last, latest)) {\n if (this.config.operation === 'read') {\n forEach(latest, (val: any, key: any) => {\n this.filterFields[key] = {\n 'value': val\n };\n });\n } else {\n this.inputFields = latest;\n }\n /* if auto-update set for the variable with read operation only, get its data */\n // @ts-ignore\n if (this.autoUpdate && !isUndefined(latest) && isFunction(this[this.config.operation + 'Record'])) {\n this.invoke();\n }\n }\n return Promise.resolve(this);\n }\n\n listRecords(options? : any, onSuccess?: Function, onError?: Function) {\n this.filters = this.config.filterProvider && this.config.filterProvider();\n if (options) {\n this.filters = deepCopy({} as any, this.filters, options.filterFields ? options.filterFields : options);\n }\n options = options || {};\n options.filterFields = this.filters;\n this.setFilterExpValue(this.filters);\n return super.listRecords(options, onSuccess, onError);\n }\n\n}\n"],"mappings":";;;AACA,SAASA,OAAO,EAAEC,WAAW,EAAEC,UAAU,EAAEC,OAAO,EAAEC,OAAO,QAAQ,QAAQ;AAE3E,SAASC,YAAY,IAAIC,aAAa,QAAQ,uDAAuD;AACrG,OAAOC,WAAW,MAAM,kDAAkD;AAC1E,OAAOC,QAAQ,MAAM,yCAAyC;AAC9D,SAASC,QAAQ,QAAQ,sCAAsC;AAC/D,OAAOC,UAAU,MAAM,2CAA2C;AAAC,IAyB9DC,mBAAmB,0BAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAA,OAAnBA,mBAAmB;AAAA,EAAnBA,mBAAmB;AAKxB,OAAO,MAAMN,YAAY,SAASC,aAAa,CAAC;EAK9CM,WAAWA,CAAQC,MAA0B,EAAE;IAC7C,MAAMC,cAAmB,GAAG;MAC1BC,IAAI,EAAEF,MAAM,CAACE,IAAI;MACjBC,OAAO,EAAEH,MAAM,CAACI,aAAa,CAAC,CAAC;MAC/BC,WAAW,EAAEL,MAAM,CAACI,aAAa,CAAC,CAAC;MACnCE,iBAAiB,EAAEN,MAAM,CAACM,iB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