@shapediver/viewer.session-engine.session-engine 3.14.7 → 3.14.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/implementation/OutputLoader.d.ts.map +1 -1
- package/dist/implementation/OutputLoader.js +19 -0
- package/dist/implementation/OutputLoader.js.map +1 -1
- package/dist/implementation/SessionEngine.d.ts.map +1 -1
- package/dist/implementation/SessionEngine.js +5 -8
- package/dist/implementation/SessionEngine.js.map +1 -1
- package/dist/implementation/SessionEngineCore.d.ts +119 -0
- package/dist/implementation/SessionEngineCore.d.ts.map +1 -0
- package/dist/implementation/SessionEngineCore.js +367 -0
- package/dist/implementation/SessionEngineCore.js.map +1 -0
- package/dist/implementation/SessionEngineFacade.d.ts +106 -0
- package/dist/implementation/SessionEngineFacade.d.ts.map +1 -0
- package/dist/implementation/SessionEngineFacade.js +191 -0
- package/dist/implementation/SessionEngineFacade.js.map +1 -0
- package/dist/implementation/managers/CustomizationManager.d.ts +67 -0
- package/dist/implementation/managers/CustomizationManager.d.ts.map +1 -0
- package/dist/implementation/managers/CustomizationManager.js +324 -0
- package/dist/implementation/managers/CustomizationManager.js.map +1 -0
- package/dist/implementation/managers/ExportManager.d.ts +75 -0
- package/dist/implementation/managers/ExportManager.d.ts.map +1 -0
- package/dist/implementation/managers/ExportManager.js +213 -0
- package/dist/implementation/managers/ExportManager.js.map +1 -0
- package/dist/implementation/managers/FileUploadManager.d.ts +74 -0
- package/dist/implementation/managers/FileUploadManager.d.ts.map +1 -0
- package/dist/implementation/managers/FileUploadManager.js +221 -0
- package/dist/implementation/managers/FileUploadManager.js.map +1 -0
- package/dist/implementation/managers/ModelStateManager.d.ts +54 -0
- package/dist/implementation/managers/ModelStateManager.d.ts.map +1 -0
- package/dist/implementation/managers/ModelStateManager.js +177 -0
- package/dist/implementation/managers/ModelStateManager.js.map +1 -0
- package/dist/implementation/managers/OutputManager.d.ts +99 -0
- package/dist/implementation/managers/OutputManager.d.ts.map +1 -0
- package/dist/implementation/managers/OutputManager.js +418 -0
- package/dist/implementation/managers/OutputManager.js.map +1 -0
- package/dist/implementation/managers/ParameterManager.d.ts +75 -0
- package/dist/implementation/managers/ParameterManager.d.ts.map +1 -0
- package/dist/implementation/managers/ParameterManager.js +235 -0
- package/dist/implementation/managers/ParameterManager.js.map +1 -0
- package/dist/implementation/managers/SettingsManager.d.ts +80 -0
- package/dist/implementation/managers/SettingsManager.d.ts.map +1 -0
- package/dist/implementation/managers/SettingsManager.js +502 -0
- package/dist/implementation/managers/SettingsManager.js.map +1 -0
- package/dist/implementation/managers/UtilsManager.d.ts +127 -0
- package/dist/implementation/managers/UtilsManager.d.ts.map +1 -0
- package/dist/implementation/managers/UtilsManager.js +410 -0
- package/dist/implementation/managers/UtilsManager.js.map +1 -0
- package/package.json +8 -8
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ParameterManager = void 0;
|
|
13
|
+
const viewer_shared_node_tree_1 = require("@shapediver/viewer.shared.node-tree");
|
|
14
|
+
const viewer_shared_services_1 = require("@shapediver/viewer.shared.services");
|
|
15
|
+
const viewer_shared_types_1 = require("@shapediver/viewer.shared.types");
|
|
16
|
+
const DrawingParameter_1 = require("../dto/DrawingParameter");
|
|
17
|
+
const FileParameter_1 = require("../dto/FileParameter");
|
|
18
|
+
const Parameter_1 = require("../dto/Parameter");
|
|
19
|
+
/**
|
|
20
|
+
* Manager responsible for parameters.
|
|
21
|
+
*
|
|
22
|
+
* The manager is created by the SessionEngineCore and can be accessed
|
|
23
|
+
* via the `parameterManager` property.
|
|
24
|
+
*/
|
|
25
|
+
class ParameterManager {
|
|
26
|
+
constructor(sessionEngineCore) {
|
|
27
|
+
this._logger = viewer_shared_services_1.Logger.instance;
|
|
28
|
+
this._parameterValues = {};
|
|
29
|
+
this._parameters = {};
|
|
30
|
+
this._parameterHistory = [];
|
|
31
|
+
this._parameterHistoryCall = false;
|
|
32
|
+
this._parameterHistoryForward = [];
|
|
33
|
+
this._sessionEngineCore = sessionEngineCore;
|
|
34
|
+
}
|
|
35
|
+
get ignoreUnknownParams() {
|
|
36
|
+
return this._ignoreUnknownParams;
|
|
37
|
+
}
|
|
38
|
+
set ignoreUnknownParams(value) {
|
|
39
|
+
this._ignoreUnknownParams = value;
|
|
40
|
+
}
|
|
41
|
+
get parameterHistory() {
|
|
42
|
+
return this._parameterHistory;
|
|
43
|
+
}
|
|
44
|
+
get parameterHistoryCall() {
|
|
45
|
+
return this._parameterHistoryCall;
|
|
46
|
+
}
|
|
47
|
+
set parameterHistoryForward(value) {
|
|
48
|
+
this._parameterHistoryForward = value;
|
|
49
|
+
}
|
|
50
|
+
get parameterValues() {
|
|
51
|
+
return this._parameterValues;
|
|
52
|
+
}
|
|
53
|
+
get parameters() {
|
|
54
|
+
return this._parameters;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Checks whether it is possible to go back in the parameter history.
|
|
58
|
+
*
|
|
59
|
+
* @returns True if it is possible to go back, false otherwise.
|
|
60
|
+
*/
|
|
61
|
+
canGoBack() {
|
|
62
|
+
// the first entry is always the one from the init call
|
|
63
|
+
// all additional entries can be undone
|
|
64
|
+
return this._parameterHistory.length > 1;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Checks whether it is possible to go forward in the parameter history.
|
|
68
|
+
*
|
|
69
|
+
* @returns True if it is possible to go forward, false otherwise.
|
|
70
|
+
*/
|
|
71
|
+
canGoForward() {
|
|
72
|
+
return this._parameterHistoryForward.length > 0;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Creates parameters from the session engine's response DTO.
|
|
76
|
+
*
|
|
77
|
+
* @param initialParameters
|
|
78
|
+
* @returns
|
|
79
|
+
*/
|
|
80
|
+
createParametersFromDto(initialParameters) {
|
|
81
|
+
if (!this._sessionEngineCore.responseDto)
|
|
82
|
+
return;
|
|
83
|
+
const parameterSet = {};
|
|
84
|
+
for (const parameterId in this._sessionEngineCore.responseDto
|
|
85
|
+
.parameters) {
|
|
86
|
+
if (this.parameters[parameterId])
|
|
87
|
+
continue;
|
|
88
|
+
this._sessionEngineCore.responseDto.parameters[parameterId].id =
|
|
89
|
+
parameterId;
|
|
90
|
+
switch (true) {
|
|
91
|
+
case this._sessionEngineCore.responseDto.parameters[parameterId]
|
|
92
|
+
.type === viewer_shared_types_1.PARAMETER_TYPE.BOOL:
|
|
93
|
+
this.parameters[parameterId] = new Parameter_1.Parameter(this._sessionEngineCore.responseDto.parameters[parameterId], this._sessionEngineCore, this);
|
|
94
|
+
break;
|
|
95
|
+
case this._sessionEngineCore.responseDto.parameters[parameterId]
|
|
96
|
+
.type === viewer_shared_types_1.PARAMETER_TYPE.COLOR:
|
|
97
|
+
this.parameters[parameterId] = new Parameter_1.Parameter(this._sessionEngineCore.responseDto.parameters[parameterId], this._sessionEngineCore, this);
|
|
98
|
+
break;
|
|
99
|
+
case this._sessionEngineCore.responseDto.parameters[parameterId]
|
|
100
|
+
.type === viewer_shared_types_1.PARAMETER_TYPE.FILE:
|
|
101
|
+
this.parameters[parameterId] = new FileParameter_1.FileParameter(this._sessionEngineCore.responseDto.parameters[parameterId], this._sessionEngineCore, this);
|
|
102
|
+
break;
|
|
103
|
+
case this._sessionEngineCore.responseDto.parameters[parameterId]
|
|
104
|
+
.type === viewer_shared_types_1.PARAMETER_TYPE.EVEN ||
|
|
105
|
+
this._sessionEngineCore.responseDto.parameters[parameterId]
|
|
106
|
+
.type === viewer_shared_types_1.PARAMETER_TYPE.FLOAT ||
|
|
107
|
+
this._sessionEngineCore.responseDto.parameters[parameterId]
|
|
108
|
+
.type === viewer_shared_types_1.PARAMETER_TYPE.INT ||
|
|
109
|
+
this._sessionEngineCore.responseDto.parameters[parameterId]
|
|
110
|
+
.type === viewer_shared_types_1.PARAMETER_TYPE.ODD:
|
|
111
|
+
this.parameters[parameterId] = new Parameter_1.Parameter(this._sessionEngineCore.responseDto.parameters[parameterId], this._sessionEngineCore, this);
|
|
112
|
+
break;
|
|
113
|
+
case this._sessionEngineCore.responseDto.parameters[parameterId]
|
|
114
|
+
.type === viewer_shared_types_1.PARAMETER_TYPE.INTERACTION:
|
|
115
|
+
this.parameters[parameterId] =
|
|
116
|
+
this._sessionEngineCore.utilsManager.createInteractionParameter(this._sessionEngineCore.responseDto.parameters[parameterId]);
|
|
117
|
+
break;
|
|
118
|
+
case this._sessionEngineCore.responseDto.parameters[parameterId]
|
|
119
|
+
.type === viewer_shared_types_1.PARAMETER_TYPE.DRAWING:
|
|
120
|
+
this.parameters[parameterId] = new DrawingParameter_1.DrawingParameter(this._sessionEngineCore.responseDto.parameters[parameterId], this._sessionEngineCore, this);
|
|
121
|
+
break;
|
|
122
|
+
default:
|
|
123
|
+
this.parameters[parameterId] = new Parameter_1.Parameter(this._sessionEngineCore.responseDto.parameters[parameterId], this._sessionEngineCore, this);
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
// we don't have to do larger restrictions for this as the backend would have already thrown an error if the values were not correct
|
|
127
|
+
if (initialParameters) {
|
|
128
|
+
let hasInitialValue = false;
|
|
129
|
+
// check if the id is within the initial parameters
|
|
130
|
+
if (initialParameters[parameterId] !== undefined) {
|
|
131
|
+
this.parameters[parameterId].value =
|
|
132
|
+
initialParameters[parameterId];
|
|
133
|
+
hasInitialValue = true;
|
|
134
|
+
}
|
|
135
|
+
// check if the name is within the initial parameters
|
|
136
|
+
else if (initialParameters[this.parameters[parameterId].name] !==
|
|
137
|
+
undefined) {
|
|
138
|
+
this.parameters[parameterId].value =
|
|
139
|
+
initialParameters[this.parameters[parameterId].name];
|
|
140
|
+
hasInitialValue = true;
|
|
141
|
+
}
|
|
142
|
+
// check if the displayname is within the initial parameters
|
|
143
|
+
else if (this.parameters[parameterId].displayname &&
|
|
144
|
+
initialParameters[this.parameters[parameterId].displayname] !== undefined) {
|
|
145
|
+
this.parameters[parameterId].value =
|
|
146
|
+
initialParameters[this.parameters[parameterId].displayname];
|
|
147
|
+
hasInitialValue = true;
|
|
148
|
+
}
|
|
149
|
+
// if there is an initial value, we try to cast it to the correct type
|
|
150
|
+
// we only do this for bool and number types, as the other types are either string or have their own parsing
|
|
151
|
+
if (hasInitialValue) {
|
|
152
|
+
if (this.parameters[parameterId].type ===
|
|
153
|
+
viewer_shared_types_1.PARAMETER_TYPE.BOOL) {
|
|
154
|
+
// cast to boolean
|
|
155
|
+
this.parameters[parameterId].value = Boolean(this.parameters[parameterId].value);
|
|
156
|
+
}
|
|
157
|
+
else if (this.parameters[parameterId].type ===
|
|
158
|
+
viewer_shared_types_1.PARAMETER_TYPE.INT ||
|
|
159
|
+
this.parameters[parameterId].type ===
|
|
160
|
+
viewer_shared_types_1.PARAMETER_TYPE.FLOAT ||
|
|
161
|
+
this.parameters[parameterId].type ===
|
|
162
|
+
viewer_shared_types_1.PARAMETER_TYPE.EVEN ||
|
|
163
|
+
this.parameters[parameterId].type === viewer_shared_types_1.PARAMETER_TYPE.ODD) {
|
|
164
|
+
// cast to number
|
|
165
|
+
this.parameters[parameterId].value = Number(this.parameters[parameterId].value);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
parameterSet[parameterId] = {
|
|
170
|
+
value: this.parameters[parameterId].value,
|
|
171
|
+
valueString: this.parameters[parameterId].stringify(),
|
|
172
|
+
};
|
|
173
|
+
if (!this._sessionEngineCore.initialized)
|
|
174
|
+
this.parameterValues[parameterId] =
|
|
175
|
+
parameterSet[parameterId].valueString;
|
|
176
|
+
}
|
|
177
|
+
// store the initialization as the first parameter set in the history
|
|
178
|
+
if (!this._sessionEngineCore.initialized)
|
|
179
|
+
this.parameterHistory.push(parameterSet);
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Goes one step back in the parameter history and applies the parameter values.
|
|
183
|
+
*
|
|
184
|
+
* @returns The tree node returned by the customization function.
|
|
185
|
+
*/
|
|
186
|
+
goBack() {
|
|
187
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
188
|
+
if (!this.canGoBack()) {
|
|
189
|
+
this._logger.debug(`Session(${this._sessionEngineCore.id}).goBack: Cannot go further back.`);
|
|
190
|
+
return new viewer_shared_node_tree_1.TreeNode();
|
|
191
|
+
}
|
|
192
|
+
// get the current parameter set and store it in the forward history later on
|
|
193
|
+
const currentParameterSet = this._parameterHistory.pop();
|
|
194
|
+
// adjust the parameters according to the last parameter set
|
|
195
|
+
const lastParameterSet = this._parameterHistory[this._parameterHistory.length - 1];
|
|
196
|
+
for (const parameterId in lastParameterSet)
|
|
197
|
+
this.parameters[parameterId].value =
|
|
198
|
+
lastParameterSet[parameterId].value;
|
|
199
|
+
// call the customization function with the parameterHistoryCall value set to true
|
|
200
|
+
this._parameterHistoryCall = true;
|
|
201
|
+
const node = yield this._sessionEngineCore.customizationManager.customize();
|
|
202
|
+
this._parameterHistoryCall = false;
|
|
203
|
+
// add the current (not anymore current) parameter set to the forward history
|
|
204
|
+
this._parameterHistoryForward.push(currentParameterSet);
|
|
205
|
+
return node;
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Goes one step forward in the parameter history and applies the parameter values.
|
|
210
|
+
*
|
|
211
|
+
* @returns The tree node returned by the customization function.
|
|
212
|
+
*/
|
|
213
|
+
goForward() {
|
|
214
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
215
|
+
if (!this.canGoForward()) {
|
|
216
|
+
this._logger.debug(`Session(${this._sessionEngineCore.id}).goForward: Cannot go further forward.`);
|
|
217
|
+
return new viewer_shared_node_tree_1.TreeNode();
|
|
218
|
+
}
|
|
219
|
+
// get the last undone parameter set and apply the values to the parameters
|
|
220
|
+
const lastParameterSet = this._parameterHistoryForward.pop();
|
|
221
|
+
for (const parameterId in lastParameterSet)
|
|
222
|
+
this.parameters[parameterId].value =
|
|
223
|
+
lastParameterSet[parameterId].value;
|
|
224
|
+
// call the customization function with the parameterHistoryCall value set to true
|
|
225
|
+
this._parameterHistoryCall = true;
|
|
226
|
+
const node = yield this._sessionEngineCore.customizationManager.customize();
|
|
227
|
+
this._parameterHistoryCall = false;
|
|
228
|
+
// add the current parameter set to the history
|
|
229
|
+
this._parameterHistory.push(lastParameterSet);
|
|
230
|
+
return node;
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
exports.ParameterManager = ParameterManager;
|
|
235
|
+
//# sourceMappingURL=ParameterManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParameterManager.js","sourceRoot":"","sources":["../../../src/implementation/managers/ParameterManager.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iFAAwE;AACxE,+EAA0D;AAC1D,yEAA+D;AAK/D,8DAAyD;AACzD,wDAAmD;AACnD,gDAA2C;AAG3C;;;;;GAKG;AACH,MAAa,gBAAgB;IAqB5B,YAAY,iBAAoC;QApB/B,YAAO,GAAG,+BAAM,CAAC,QAAQ,CAAC;QAC1B,qBAAgB,GAA4B,EAAE,CAAC;QAC/C,gBAAW,GAAyC,EAAE,CAAC;QAIhE,sBAAiB,GAKnB,EAAE,CAAC;QACD,0BAAqB,GAAG,KAAK,CAAC;QAC9B,6BAAwB,GAK1B,EAAE,CAAC;QAGR,IAAI,CAAC,kBAAkB,GAAG,iBAAiB,CA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9C,OAAO,IAAI,CAAC;QACb,CAAC;KAAA;CACD;AAnUD,4CAmUC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { ResBase } from "@shapediver/sdk.geometry-api-sdk-v2";
|
|
2
|
+
import { SettingsEngine } from "@shapediver/viewer.shared.services";
|
|
3
|
+
import { ISettingsSections } from "@shapediver/viewer.shared.types";
|
|
4
|
+
import { SessionEngineCore } from "../SessionEngineCore";
|
|
5
|
+
/**
|
|
6
|
+
* Manager responsible for settings.
|
|
7
|
+
*
|
|
8
|
+
* The manager is created by the SessionEngineCore and can be accessed
|
|
9
|
+
* via the `settingsManager` property.
|
|
10
|
+
*/
|
|
11
|
+
export declare class SettingsManager {
|
|
12
|
+
private readonly _logger;
|
|
13
|
+
private readonly _sessionEngineCore;
|
|
14
|
+
private readonly _settingsEngine;
|
|
15
|
+
private _viewerSettings?;
|
|
16
|
+
private _viewerSettingsVersion;
|
|
17
|
+
private _viewerSettingsVersionBackend;
|
|
18
|
+
constructor(sessionEngineCore: SessionEngineCore);
|
|
19
|
+
get hasStoredSettings(): boolean;
|
|
20
|
+
get settingsEngine(): SettingsEngine;
|
|
21
|
+
get viewerSettings(): object | undefined;
|
|
22
|
+
set viewerSettings(value: object | undefined);
|
|
23
|
+
set viewerSettingsVersionBackend(value: string);
|
|
24
|
+
/**
|
|
25
|
+
* Apply settings from the response to the session engine.
|
|
26
|
+
*/
|
|
27
|
+
applySettings(response: ResBase, sections?: ISettingsSections): void;
|
|
28
|
+
/**
|
|
29
|
+
* Reset settings to the default values from the model.
|
|
30
|
+
*
|
|
31
|
+
* @param sections Sections to reset
|
|
32
|
+
*/
|
|
33
|
+
resetSettings(sections?: ISettingsSections): void;
|
|
34
|
+
/**
|
|
35
|
+
* Save the default parameter values
|
|
36
|
+
*/
|
|
37
|
+
saveDefaultParameterValues(): Promise<boolean>;
|
|
38
|
+
/**
|
|
39
|
+
* Save the default parameter values
|
|
40
|
+
*
|
|
41
|
+
* @param retry
|
|
42
|
+
* @returns
|
|
43
|
+
*/
|
|
44
|
+
saveDefaultParameters(retry?: boolean): Promise<boolean>;
|
|
45
|
+
/**
|
|
46
|
+
* Save the parameter properties for displayname, order, tooltip and hidden
|
|
47
|
+
*
|
|
48
|
+
* @param parameters
|
|
49
|
+
* @param retry
|
|
50
|
+
* @returns
|
|
51
|
+
*/
|
|
52
|
+
saveParameterProperties(parameters: {
|
|
53
|
+
[key: string]: {
|
|
54
|
+
displayname: string;
|
|
55
|
+
hidden: boolean;
|
|
56
|
+
order: number;
|
|
57
|
+
tooltip: string;
|
|
58
|
+
};
|
|
59
|
+
}, retry?: boolean): Promise<boolean>;
|
|
60
|
+
/**
|
|
61
|
+
* Save the viewer settings
|
|
62
|
+
*
|
|
63
|
+
* @param json
|
|
64
|
+
* @param retry
|
|
65
|
+
* @returns
|
|
66
|
+
*/
|
|
67
|
+
saveSettings(json: unknown, retry?: boolean): Promise<boolean>;
|
|
68
|
+
/**
|
|
69
|
+
* Save UI related properties for parameters, exports and outputs
|
|
70
|
+
*
|
|
71
|
+
* @param saveInSettings Whether to save the properties in the settings as well
|
|
72
|
+
* @returns
|
|
73
|
+
*/
|
|
74
|
+
saveUiProperties(saveInSettings?: boolean): Promise<boolean>;
|
|
75
|
+
/**
|
|
76
|
+
* Save the session settings for parameters and exports
|
|
77
|
+
*/
|
|
78
|
+
private saveSessionSettings;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=SettingsManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SettingsManager.d.ts","sourceRoot":"","sources":["../../../src/implementation/managers/SettingsManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,OAAO,EACP,MAAM,qCAAqC,CAAC;AAQ7C,OAAO,EAEN,cAAc,EAGd,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAC,iBAAiB,EAAC,MAAM,iCAAiC,CAAC;AAGlE,OAAO,EAAC,iBAAiB,EAAC,MAAM,sBAAsB,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