@device-management-toolkit/ui-toolkit-angular 11.1.9 → 12.0.0

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.
@@ -1,128 +1,232 @@
1
- import * as i0 from '@angular/core';
2
- import { inject, DestroyRef, output, input, effect, Component } from '@angular/core';
3
- import { Protocol, AMTRedirector, AMTIDER } from '@device-management-toolkit/ui-toolkit/core';
4
-
5
- class IDERComponent {
6
- constructor() {
7
- this.destroyRef = inject(DestroyRef);
8
- this.deviceState = 0;
9
- this.deviceStatus = output();
10
- this.iderData = output();
11
- this.deviceConnection = input(false, ...(ngDevMode ? [{ debugName: "deviceConnection" }] : /* istanbul ignore next */ []));
12
- this.cdrom = input(null, ...(ngDevMode ? [{ debugName: "cdrom" }] : /* istanbul ignore next */ []));
13
- this.floppy = input(null, ...(ngDevMode ? [{ debugName: "floppy" }] : /* istanbul ignore next */ []));
14
- this.mpsServer = input('', ...(ngDevMode ? [{ debugName: "mpsServer" }] : /* istanbul ignore next */ []));
15
- this.authToken = input('', ...(ngDevMode ? [{ debugName: "authToken" }] : /* istanbul ignore next */ []));
16
- this.deviceId = input('', ...(ngDevMode ? [{ debugName: "deviceId" }] : /* istanbul ignore next */ []));
17
- this.onConnectionStateChange = (redirector, state) => {
18
- this.deviceStatus.emit(state);
19
- };
20
- // React to deviceConnection changes
21
- effect(() => {
22
- const connected = this.deviceConnection();
23
- if (connected) {
24
- if (this.redirector == null) {
25
- this.init();
26
- }
27
- }
28
- else {
29
- this.stopIder();
30
- }
31
- });
32
- }
33
- init() {
34
- this.instantiate();
35
- setTimeout(() => {
36
- this.startIder();
37
- }, 4000);
38
- }
39
- startIder() {
40
- if (this.redirector != null) {
41
- this.redirector.start(WebSocket);
42
- }
43
- }
44
- instantiate() {
45
- const config = {
46
- mode: 'ider',
47
- protocol: Protocol.IDER,
48
- fr: new FileReader(),
49
- host: this.deviceId(),
50
- port: 16994,
51
- user: '',
52
- pass: '',
53
- tls: 0,
54
- tls1only: 0,
55
- authToken: this.authToken(),
56
- server: this.mpsServer()
57
- };
58
- this.redirector = new AMTRedirector(config);
59
- this.ider = new AMTIDER(this.redirector, this.cdrom(), this.floppy());
60
- this.redirector.onNewState = this.ider.stateChange.bind(this.ider);
61
- this.redirector.onStateChanged = this.onConnectionStateChange.bind(this);
62
- this.redirector.onProcessData = this.ider.processData.bind(this.ider);
63
- this.ider.sectorStats = this.iderSectorStats.bind(this);
64
- }
65
- iderSectorStats(mode, dev, total, start, len) {
66
- if (this.ider == null) {
67
- return;
68
- }
69
- if (mode === 1) {
70
- if (dev === 0) {
71
- // Floppy
72
- this.ider.floppyRead += len * 512;
73
- }
74
- else {
75
- // CD-ROM
76
- this.ider.cdromRead += len * 2048;
77
- }
78
- }
79
- else {
80
- if (dev === 0) {
81
- // Floppy
82
- this.ider.floppyWrite += len * 512;
83
- }
84
- else {
85
- // CD-ROM
86
- this.ider.cdromWrite += len * 2048;
87
- }
88
- }
89
- this.iderData.emit({
90
- floppyRead: this.ider.floppyRead,
91
- cdromRead: this.ider.cdromRead,
92
- floppyWrite: this.ider.floppyWrite,
93
- cdromWrite: this.ider.cdromWrite
94
- });
95
- }
96
- stopIder() {
97
- if (this.redirector != null) {
98
- this.redirector.stop();
99
- this.cleanup();
100
- }
101
- }
102
- cleanup() {
103
- this.redirector = null;
104
- this.ider = null;
105
- }
106
- ngOnDestroy() {
107
- if (this.ider != null) {
108
- this.ider.stop();
109
- }
110
- }
111
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: IDERComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
112
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.23", type: IDERComponent, isStandalone: true, selector: "amt-ider", inputs: { deviceConnection: { classPropertyName: "deviceConnection", publicName: "deviceConnection", isSignal: true, isRequired: false, transformFunction: null }, cdrom: { classPropertyName: "cdrom", publicName: "cdrom", isSignal: true, isRequired: false, transformFunction: null }, floppy: { classPropertyName: "floppy", publicName: "floppy", isSignal: true, isRequired: false, transformFunction: null }, mpsServer: { classPropertyName: "mpsServer", publicName: "mpsServer", isSignal: true, isRequired: false, transformFunction: null }, authToken: { classPropertyName: "authToken", publicName: "authToken", isSignal: true, isRequired: false, transformFunction: null }, deviceId: { classPropertyName: "deviceId", publicName: "deviceId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { deviceStatus: "deviceStatus", iderData: "iderData" }, ngImport: i0, template: '', isInline: true }); }
113
- }
114
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: IDERComponent, decorators: [{
115
- type: Component,
116
- args: [{ selector: 'amt-ider', template: '' }]
117
- }], ctorParameters: () => [], propDecorators: { deviceStatus: [{ type: i0.Output, args: ["deviceStatus"] }], iderData: [{ type: i0.Output, args: ["iderData"] }], deviceConnection: [{ type: i0.Input, args: [{ isSignal: true, alias: "deviceConnection", required: false }] }], cdrom: [{ type: i0.Input, args: [{ isSignal: true, alias: "cdrom", required: false }] }], floppy: [{ type: i0.Input, args: [{ isSignal: true, alias: "floppy", required: false }] }], mpsServer: [{ type: i0.Input, args: [{ isSignal: true, alias: "mpsServer", required: false }] }], authToken: [{ type: i0.Input, args: [{ isSignal: true, alias: "authToken", required: false }] }], deviceId: [{ type: i0.Input, args: [{ isSignal: true, alias: "deviceId", required: false }] }] } });
118
-
119
- /*
120
- * Public API Surface of ider
121
- */
122
-
123
- /**
124
- * Generated bundle index. Do not edit.
125
- */
126
-
1
+ import * as i0 from "@angular/core";
2
+ import { Component, DestroyRef, effect, inject, input, output, signal } from "@angular/core";
3
+ import { AMTIDER, AMTRedirector, Protocol } from "@device-management-toolkit/ui-toolkit/core";
4
+ var IDERComponent = class IDERComponent {
5
+ constructor() {
6
+ this.destroyRef = inject(DestroyRef);
7
+ this.redirector = null;
8
+ this.ider = null;
9
+ this.data = null;
10
+ this._deviceState = signal(0, ...ngDevMode ? [{ debugName: "_deviceState" }] : /* istanbul ignore next */ []);
11
+ this.deviceState = this._deviceState.asReadonly();
12
+ this.deviceStatus = output();
13
+ this.iderData = output();
14
+ this.deviceConnection = input(false, ...ngDevMode ? [{ debugName: "deviceConnection" }] : /* istanbul ignore next */ []);
15
+ this.cdrom = input(null, ...ngDevMode ? [{ debugName: "cdrom" }] : /* istanbul ignore next */ []);
16
+ this.floppy = input(null, ...ngDevMode ? [{ debugName: "floppy" }] : /* istanbul ignore next */ []);
17
+ this.mpsServer = input("", ...ngDevMode ? [{ debugName: "mpsServer" }] : /* istanbul ignore next */ []);
18
+ this.authToken = input("", ...ngDevMode ? [{ debugName: "authToken" }] : /* istanbul ignore next */ []);
19
+ this.deviceId = input("", ...ngDevMode ? [{ debugName: "deviceId" }] : /* istanbul ignore next */ []);
20
+ this.onConnectionStateChange = (redirector, state) => {
21
+ this.deviceStatus.emit(state);
22
+ this._deviceState.set(state);
23
+ };
24
+ effect(() => {
25
+ if (this.deviceConnection()) {
26
+ if (this.redirector == null) this.init();
27
+ } else this.stopIder();
28
+ });
29
+ }
30
+ init() {
31
+ this.instantiate();
32
+ setTimeout(() => {
33
+ this.startIder();
34
+ }, 4e3);
35
+ }
36
+ startIder() {
37
+ if (this.redirector != null) this.redirector.start(WebSocket);
38
+ }
39
+ instantiate() {
40
+ const config = {
41
+ mode: "ider",
42
+ protocol: Protocol.IDER,
43
+ fr: new FileReader(),
44
+ host: this.deviceId(),
45
+ port: 16994,
46
+ user: "",
47
+ pass: "",
48
+ tls: 0,
49
+ tls1only: 0,
50
+ authToken: this.authToken(),
51
+ server: this.mpsServer()
52
+ };
53
+ this.redirector = new AMTRedirector(config);
54
+ this.ider = new AMTIDER(this.redirector, this.cdrom(), this.floppy());
55
+ this.redirector.onNewState = this.ider.stateChange.bind(this.ider);
56
+ this.redirector.onStateChanged = this.onConnectionStateChange.bind(this);
57
+ this.redirector.onProcessData = this.ider.processData.bind(this.ider);
58
+ this.ider.sectorStats = this.iderSectorStats.bind(this);
59
+ }
60
+ iderSectorStats(mode, dev, total, start, len) {
61
+ if (this.ider == null) return;
62
+ if (mode === 1) {
63
+ if (dev === 0) this.ider.floppyRead += len * 512;
64
+ else this.ider.cdromRead += len * 2048;
65
+ } else if (dev === 0) this.ider.floppyWrite += len * 512;
66
+ else this.ider.cdromWrite += len * 2048;
67
+ this.iderData.emit({
68
+ floppyRead: this.ider.floppyRead,
69
+ cdromRead: this.ider.cdromRead,
70
+ floppyWrite: this.ider.floppyWrite,
71
+ cdromWrite: this.ider.cdromWrite
72
+ });
73
+ }
74
+ stopIder() {
75
+ if (this.redirector != null) {
76
+ this.redirector.stop();
77
+ this.cleanup();
78
+ }
79
+ }
80
+ cleanup() {
81
+ this.redirector = null;
82
+ this.ider = null;
83
+ }
84
+ ngOnDestroy() {
85
+ if (this.ider != null) this.ider.stop();
86
+ }
87
+ static {
88
+ this.ɵfac = i0.ɵɵngDeclareFactory({
89
+ minVersion: "12.0.0",
90
+ version: "22.2.2",
91
+ ngImport: i0,
92
+ type: IDERComponent,
93
+ deps: [],
94
+ target: i0.ɵɵFactoryTarget.Component
95
+ });
96
+ }
97
+ static {
98
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
99
+ minVersion: "17.1.0",
100
+ version: "22.2.2",
101
+ type: IDERComponent,
102
+ isStandalone: true,
103
+ selector: "amt-ider",
104
+ inputs: {
105
+ deviceConnection: {
106
+ classPropertyName: "deviceConnection",
107
+ publicName: "deviceConnection",
108
+ isSignal: true,
109
+ isRequired: false,
110
+ transformFunction: null
111
+ },
112
+ cdrom: {
113
+ classPropertyName: "cdrom",
114
+ publicName: "cdrom",
115
+ isSignal: true,
116
+ isRequired: false,
117
+ transformFunction: null
118
+ },
119
+ floppy: {
120
+ classPropertyName: "floppy",
121
+ publicName: "floppy",
122
+ isSignal: true,
123
+ isRequired: false,
124
+ transformFunction: null
125
+ },
126
+ mpsServer: {
127
+ classPropertyName: "mpsServer",
128
+ publicName: "mpsServer",
129
+ isSignal: true,
130
+ isRequired: false,
131
+ transformFunction: null
132
+ },
133
+ authToken: {
134
+ classPropertyName: "authToken",
135
+ publicName: "authToken",
136
+ isSignal: true,
137
+ isRequired: false,
138
+ transformFunction: null
139
+ },
140
+ deviceId: {
141
+ classPropertyName: "deviceId",
142
+ publicName: "deviceId",
143
+ isSignal: true,
144
+ isRequired: false,
145
+ transformFunction: null
146
+ }
147
+ },
148
+ outputs: {
149
+ deviceStatus: "deviceStatus",
150
+ iderData: "iderData"
151
+ },
152
+ ngImport: i0,
153
+ template: "",
154
+ isInline: true
155
+ });
156
+ }
157
+ };
158
+ i0.ɵɵngDeclareClassMetadata({
159
+ minVersion: "12.0.0",
160
+ version: "22.2.2",
161
+ ngImport: i0,
162
+ type: IDERComponent,
163
+ decorators: [{
164
+ type: Component,
165
+ args: [{
166
+ selector: "amt-ider",
167
+ template: ""
168
+ }]
169
+ }],
170
+ ctorParameters: () => [],
171
+ propDecorators: {
172
+ deviceStatus: [{
173
+ type: i0.Output,
174
+ args: ["deviceStatus"]
175
+ }],
176
+ iderData: [{
177
+ type: i0.Output,
178
+ args: ["iderData"]
179
+ }],
180
+ deviceConnection: [{
181
+ type: i0.Input,
182
+ args: [{
183
+ isSignal: true,
184
+ alias: "deviceConnection",
185
+ required: false
186
+ }]
187
+ }],
188
+ cdrom: [{
189
+ type: i0.Input,
190
+ args: [{
191
+ isSignal: true,
192
+ alias: "cdrom",
193
+ required: false
194
+ }]
195
+ }],
196
+ floppy: [{
197
+ type: i0.Input,
198
+ args: [{
199
+ isSignal: true,
200
+ alias: "floppy",
201
+ required: false
202
+ }]
203
+ }],
204
+ mpsServer: [{
205
+ type: i0.Input,
206
+ args: [{
207
+ isSignal: true,
208
+ alias: "mpsServer",
209
+ required: false
210
+ }]
211
+ }],
212
+ authToken: [{
213
+ type: i0.Input,
214
+ args: [{
215
+ isSignal: true,
216
+ alias: "authToken",
217
+ required: false
218
+ }]
219
+ }],
220
+ deviceId: [{
221
+ type: i0.Input,
222
+ args: [{
223
+ isSignal: true,
224
+ alias: "deviceId",
225
+ required: false
226
+ }]
227
+ }]
228
+ }
229
+ });
127
230
  export { IDERComponent };
128
- //# sourceMappingURL=device-management-toolkit-ui-toolkit-angular-ider.mjs.map
231
+
232
+ //# sourceMappingURL=device-management-toolkit-ui-toolkit-angular-ider.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"device-management-toolkit-ui-toolkit-angular-ider.mjs","sources":["../../ider/src/ider.component.ts","../../ider/src/public_api.ts","../../ider/src/device-management-toolkit-ui-toolkit-angular-ider.ts"],"sourcesContent":["import { Component, OnDestroy, input, output, inject, DestroyRef, effect } from '@angular/core'\nimport { AMTRedirector, Protocol, AMTIDER, RedirectorConfig } from '@device-management-toolkit/ui-toolkit/core'\n\nexport interface IDERData {\n floppyRead: number\n floppyWrite: number\n cdromRead: number\n cdromWrite: number\n}\n\n@Component({\n selector: 'amt-ider',\n template: '',\n styles: []\n})\nexport class IDERComponent implements OnDestroy {\n private readonly destroyRef = inject(DestroyRef)\n\n redirector: AMTRedirector | null\n ider: AMTIDER | null\n data: IDERData | null\n deviceState = 0\n\n readonly deviceStatus = output<number>()\n readonly iderData = output<IDERData>()\n\n readonly deviceConnection = input<boolean>(false)\n public readonly cdrom = input<File | null>(null)\n public readonly floppy = input<File | null>(null)\n public mpsServer = input('')\n public authToken = input('')\n public deviceId = input('')\n\n constructor() {\n // React to deviceConnection changes\n effect(() => {\n const connected = this.deviceConnection()\n if (connected) {\n if (this.redirector == null) {\n this.init()\n }\n } else {\n this.stopIder()\n }\n })\n }\n\n init(): void {\n this.instantiate()\n setTimeout(() => {\n this.startIder()\n }, 4000)\n }\n\n startIder(): void {\n if (this.redirector != null) {\n this.redirector.start(WebSocket)\n }\n }\n\n instantiate(): void {\n const config: RedirectorConfig = {\n mode: 'ider',\n protocol: Protocol.IDER,\n fr: new FileReader(),\n host: this.deviceId(),\n port: 16994,\n user: '',\n pass: '',\n tls: 0,\n tls1only: 0,\n authToken: this.authToken(),\n server: this.mpsServer()\n }\n this.redirector = new AMTRedirector(config)\n this.ider = new AMTIDER(this.redirector, this.cdrom(), this.floppy())\n this.redirector.onNewState = this.ider.stateChange.bind(this.ider)\n this.redirector.onStateChanged = this.onConnectionStateChange.bind(this)\n this.redirector.onProcessData = this.ider.processData.bind(this.ider)\n this.ider.sectorStats = this.iderSectorStats.bind(this)\n }\n\n iderSectorStats(mode: number, dev: number, total: number, start: number, len: number): void {\n if (this.ider == null) {\n return\n }\n if (mode === 1) {\n if (dev === 0) {\n // Floppy\n this.ider.floppyRead += len * 512\n } else {\n // CD-ROM\n this.ider.cdromRead += len * 2048\n }\n } else {\n if (dev === 0) {\n // Floppy\n this.ider.floppyWrite += len * 512\n } else {\n // CD-ROM\n this.ider.cdromWrite += len * 2048\n }\n }\n this.iderData.emit({\n floppyRead: this.ider.floppyRead,\n cdromRead: this.ider.cdromRead,\n floppyWrite: this.ider.floppyWrite,\n cdromWrite: this.ider.cdromWrite\n })\n }\n\n onConnectionStateChange = (redirector: any, state: number): any => {\n this.deviceStatus.emit(state)\n }\n\n stopIder(): void {\n if (this.redirector != null) {\n this.redirector.stop()\n this.cleanup()\n }\n }\n\n cleanup(): void {\n this.redirector = null\n this.ider = null\n }\n\n ngOnDestroy(): void {\n if (this.ider != null) {\n this.ider.stop()\n }\n }\n}\n","/*\n * Public API Surface of ider\n */\n\nexport * from './ider.component'\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;MAea,aAAa,CAAA;AAkBxB,IAAA,WAAA,GAAA;AAjBiB,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;QAKhD,IAAA,CAAA,WAAW,GAAG,CAAC;QAEN,IAAA,CAAA,YAAY,GAAG,MAAM,EAAU;QAC/B,IAAA,CAAA,QAAQ,GAAG,MAAM,EAAY;AAE7B,QAAA,IAAA,CAAA,gBAAgB,GAAG,KAAK,CAAU,KAAK,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ALzB,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,UAAU,YACV,EAAE,EAAA;;;ACZd;;AAEG;;ACFH;;AAEG;;;;"}
1
+ {"version":3,"file":"device-management-toolkit-ui-toolkit-angular-ider.mjs","names":[],"sources":["../../ider/src/ider.component.ts"],"sourcesContent":["import { Component, OnDestroy, input, output, inject, DestroyRef, effect, signal } from '@angular/core'\nimport { AMTRedirector, Protocol, AMTIDER, RedirectorConfig } from '@device-management-toolkit/ui-toolkit/core'\n\nexport interface IDERData {\n floppyRead: number\n floppyWrite: number\n cdromRead: number\n cdromWrite: number\n}\n\n@Component({\n selector: 'amt-ider',\n template: '',\n styles: []\n})\nexport class IDERComponent implements OnDestroy {\n private readonly destroyRef = inject(DestroyRef)\n\n redirector: AMTRedirector | null = null\n ider: AMTIDER | null = null\n data: IDERData | null = null\n private readonly _deviceState = signal(0)\n readonly deviceState = this._deviceState.asReadonly()\n\n readonly deviceStatus = output<number>()\n readonly iderData = output<IDERData>()\n\n readonly deviceConnection = input<boolean>(false)\n public readonly cdrom = input<File | null>(null)\n public readonly floppy = input<File | null>(null)\n public mpsServer = input('')\n public authToken = input('')\n public deviceId = input('')\n\n constructor() {\n // React to deviceConnection changes\n effect(() => {\n const connected = this.deviceConnection()\n if (connected) {\n if (this.redirector == null) {\n this.init()\n }\n } else {\n this.stopIder()\n }\n })\n }\n\n init(): void {\n this.instantiate()\n setTimeout(() => {\n this.startIder()\n }, 4000)\n }\n\n startIder(): void {\n if (this.redirector != null) {\n this.redirector.start(WebSocket)\n }\n }\n\n instantiate(): void {\n const config: RedirectorConfig = {\n mode: 'ider',\n protocol: Protocol.IDER,\n fr: new FileReader(),\n host: this.deviceId(),\n port: 16994,\n user: '',\n pass: '',\n tls: 0,\n tls1only: 0,\n authToken: this.authToken(),\n server: this.mpsServer()\n }\n this.redirector = new AMTRedirector(config)\n this.ider = new AMTIDER(this.redirector, this.cdrom(), this.floppy())\n this.redirector.onNewState = this.ider.stateChange.bind(this.ider)\n this.redirector.onStateChanged = this.onConnectionStateChange.bind(this)\n this.redirector.onProcessData = this.ider.processData.bind(this.ider)\n this.ider.sectorStats = this.iderSectorStats.bind(this)\n }\n\n iderSectorStats(mode: number, dev: number, total: number, start: number, len: number): void {\n if (this.ider == null) {\n return\n }\n if (mode === 1) {\n if (dev === 0) {\n // Floppy\n this.ider.floppyRead += len * 512\n } else {\n // CD-ROM\n this.ider.cdromRead += len * 2048\n }\n } else {\n if (dev === 0) {\n // Floppy\n this.ider.floppyWrite += len * 512\n } else {\n // CD-ROM\n this.ider.cdromWrite += len * 2048\n }\n }\n this.iderData.emit({\n floppyRead: this.ider.floppyRead,\n cdromRead: this.ider.cdromRead,\n floppyWrite: this.ider.floppyWrite,\n cdromWrite: this.ider.cdromWrite\n })\n }\n\n onConnectionStateChange = (redirector: any, state: number): any => {\n this.deviceStatus.emit(state)\n this._deviceState.set(state)\n }\n\n stopIder(): void {\n if (this.redirector != null) {\n this.redirector.stop()\n this.cleanup()\n }\n }\n\n cleanup(): void {\n this.redirector = null\n this.ider = null\n }\n\n ngOnDestroy(): void {\n if (this.ider != null) {\n this.ider.stop()\n }\n }\n}\n"],"mappings":";;;AAeA,IAAa,gBAAb,MAAa,cAAa;CAmBxB,cAAA;EAlBiB,KAAA,aAAa,OAAO,UAAU;EAE/C,KAAA,aAAmC;EACnC,KAAA,OAAuB;EACvB,KAAA,OAAwB;EACP,KAAA,eAAe,OAAO,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,eAAA,CAAA,+BAAA,CAAA,CAAA;EAChC,KAAA,cAAc,KAAK,aAAa,WAAU;EAE1C,KAAA,eAAe,OAAM;EACrB,KAAA,WAAW,OAAM;EAEjB,KAAA,mBAAmB,MAAe,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,mBAAA,CAAA,+BAAA,CAAA,CAAA;EACjC,KAAA,QAAQ,MAAmB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+B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