node-mavlink 1.2.1 → 1.3.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.
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -1
- package/dist/lib/logger.d.ts +2 -1
- package/dist/lib/logger.d.ts.map +1 -0
- package/dist/lib/logger.js +119 -1
- package/dist/lib/mavesp.d.ts +3 -1
- package/dist/lib/mavesp.d.ts.map +1 -0
- package/dist/lib/mavesp.js +101 -1
- package/dist/lib/mavlink.d.ts +14 -12
- package/dist/lib/mavlink.d.ts.map +1 -0
- package/dist/lib/mavlink.js +704 -1
- package/dist/lib/serialization.d.ts +9 -49
- package/dist/lib/serialization.d.ts.map +1 -0
- package/dist/lib/serialization.js +184 -1
- package/dist/lib/utils.d.ts +5 -4
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +77 -1
- package/package.json +11 -9
- package/sanity-check.cjs +8 -0
- package/sanity-check.mjs +8 -0
- package/.vscode/launch.json +0 -19
- package/.vscode/settings.json +0 -3
- package/index.ts +0 -5
- package/jest.config.js +0 -5
- package/lib/logger.ts +0 -128
- package/lib/mavesp.ts +0 -112
- package/lib/mavlink.ts +0 -806
- package/lib/serialization.test.ts +0 -256
- package/lib/serialization.ts +0 -176
- package/lib/utils.ts +0 -75
- package/tests/data.mavlink +0 -0
- package/tests/main.ts +0 -59
- package/tsconfig.json +0 -16
package/dist/index.d.ts
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA"}
|
package/dist/index.js
CHANGED
@@ -1 +1,21 @@
|
|
1
|
-
"use strict";
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
__exportStar(require("mavlink-mappings"), exports);
|
18
|
+
__exportStar(require("./lib/utils"), exports);
|
19
|
+
__exportStar(require("./lib/logger"), exports);
|
20
|
+
__exportStar(require("./lib/mavlink"), exports);
|
21
|
+
__exportStar(require("./lib/mavesp"), exports);
|
package/dist/lib/logger.d.ts
CHANGED
@@ -29,7 +29,7 @@ export declare class Logger {
|
|
29
29
|
* @param event event to react to
|
30
30
|
* @param handler event handler
|
31
31
|
*/
|
32
|
-
static on(event: LoggerEvents, handler: (context: any, level:
|
32
|
+
static on(event: LoggerEvents, handler: (context: any, level: LogLevel, message: string) => void): void;
|
33
33
|
/**
|
34
34
|
* Removes an event handler
|
35
35
|
*
|
@@ -82,3 +82,4 @@ export declare class Logger {
|
|
82
82
|
fatal(...args: any): void;
|
83
83
|
}
|
84
84
|
export {};
|
85
|
+
//# sourceMappingURL=logger.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../lib/logger.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,oBAAY,QAAQ;IAClB,KAAK,IAAQ;IACb,KAAK,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__esModule", { value: true });
|
3
|
+
exports.Logger = exports.LogLevel = void 0;
|
4
|
+
const events_1 = require("events");
|
5
|
+
/**
|
6
|
+
* Level of the log entry
|
7
|
+
*/
|
8
|
+
var LogLevel;
|
9
|
+
(function (LogLevel) {
|
10
|
+
LogLevel[LogLevel["trace"] = 5] = "trace";
|
11
|
+
LogLevel[LogLevel["debug"] = 4] = "debug";
|
12
|
+
LogLevel[LogLevel["info"] = 3] = "info";
|
13
|
+
LogLevel[LogLevel["warn"] = 2] = "warn";
|
14
|
+
LogLevel[LogLevel["error"] = 1] = "error";
|
15
|
+
LogLevel[LogLevel["fatal"] = 0] = "fatal";
|
16
|
+
})(LogLevel = exports.LogLevel || (exports.LogLevel = {}));
|
17
|
+
/**
|
18
|
+
* Simplified interface for logging facilities
|
19
|
+
*/
|
20
|
+
class Logger {
|
21
|
+
static events = new events_1.EventEmitter();
|
22
|
+
static registry = {};
|
23
|
+
/**
|
24
|
+
* Gets a logger by name
|
25
|
+
*
|
26
|
+
* @param context logger context
|
27
|
+
*/
|
28
|
+
static getLogger(context) {
|
29
|
+
let name = '';
|
30
|
+
if (typeof context === 'function')
|
31
|
+
name = context.name;
|
32
|
+
else if (typeof context === 'object')
|
33
|
+
name = context.constructor.name;
|
34
|
+
else if (typeof context === 'string')
|
35
|
+
name = context;
|
36
|
+
else
|
37
|
+
throw new Error(`Do not know how to get logger for ${context} (${typeof context})`);
|
38
|
+
if (!Logger.registry[name])
|
39
|
+
Logger.registry[name] = new Logger(name);
|
40
|
+
return Logger.registry[name];
|
41
|
+
}
|
42
|
+
/**
|
43
|
+
* Binds an event handler
|
44
|
+
*
|
45
|
+
* @param event event to react to
|
46
|
+
* @param handler event handler
|
47
|
+
*/
|
48
|
+
static on(event, handler) {
|
49
|
+
this.events.on(event, handler);
|
50
|
+
}
|
51
|
+
/**
|
52
|
+
* Removes an event handler
|
53
|
+
*
|
54
|
+
* @param event event to react to
|
55
|
+
* @param handler event handler
|
56
|
+
*/
|
57
|
+
static off(event, handler) {
|
58
|
+
this.events.off(event, handler);
|
59
|
+
}
|
60
|
+
context;
|
61
|
+
/**
|
62
|
+
* Constructs a new logger instance
|
63
|
+
*
|
64
|
+
* @param context logger context
|
65
|
+
*/
|
66
|
+
constructor(context) {
|
67
|
+
this.context = context;
|
68
|
+
Logger.events.emit('logger-created', Logger.registry[context]);
|
69
|
+
}
|
70
|
+
/**
|
71
|
+
* Sends a log message if the trace level is enabled for this logger
|
72
|
+
*
|
73
|
+
* @param args parameters for the log entry
|
74
|
+
*/
|
75
|
+
trace(...args) {
|
76
|
+
Logger.events.emit('log', { context: this.context, level: LogLevel.trace, message: args });
|
77
|
+
}
|
78
|
+
/**
|
79
|
+
* Sends a log message if the debug level is enabled for this logger
|
80
|
+
*
|
81
|
+
* @param args parameters for the log entry
|
82
|
+
*/
|
83
|
+
debug(...args) {
|
84
|
+
Logger.events.emit('log', { context: this.context, level: LogLevel.debug, message: args });
|
85
|
+
}
|
86
|
+
/**
|
87
|
+
* Sends a log message if the info level is enabled for this logger
|
88
|
+
*
|
89
|
+
* @param args parameters for the log entry
|
90
|
+
*/
|
91
|
+
info(...args) {
|
92
|
+
Logger.events.emit('log', { context: this.context, level: LogLevel.info, message: args });
|
93
|
+
}
|
94
|
+
/**
|
95
|
+
* Sends a log message if the warn level is enabled for this logger
|
96
|
+
*
|
97
|
+
* @param args parameters for the log entry
|
98
|
+
*/
|
99
|
+
warn(...args) {
|
100
|
+
Logger.events.emit('log', { context: this.context, level: LogLevel.warn, message: args });
|
101
|
+
}
|
102
|
+
/**
|
103
|
+
* Sends a log message if the error level is enabled for this logger
|
104
|
+
*
|
105
|
+
* @param args parameters for the log entry
|
106
|
+
*/
|
107
|
+
error(...args) {
|
108
|
+
Logger.events.emit('log', { context: this.context, level: LogLevel.error, message: args });
|
109
|
+
}
|
110
|
+
/**
|
111
|
+
* Sends a log message if the fatal level is enabled for this logger
|
112
|
+
*
|
113
|
+
* @param args parameters for the log entry
|
114
|
+
*/
|
115
|
+
fatal(...args) {
|
116
|
+
Logger.events.emit('log', { context: this.context, level: LogLevel.fatal, message: args });
|
117
|
+
}
|
118
|
+
}
|
119
|
+
exports.Logger = Logger;
|
package/dist/lib/mavesp.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
/// <reference types="node" />
|
2
|
+
/// <reference types="node" />
|
2
3
|
import { EventEmitter } from 'events';
|
3
4
|
import { uint8_t, MavLinkData } from 'mavlink-mappings';
|
4
5
|
/**
|
@@ -6,7 +7,7 @@ import { uint8_t, MavLinkData } from 'mavlink-mappings';
|
|
6
7
|
*/
|
7
8
|
export declare class MavEsp8266 extends EventEmitter {
|
8
9
|
private input;
|
9
|
-
private socket
|
10
|
+
private socket?;
|
10
11
|
private ip;
|
11
12
|
private sendPort;
|
12
13
|
private seq;
|
@@ -44,3 +45,4 @@ export declare class MavEsp8266 extends EventEmitter {
|
|
44
45
|
private processIncommingUDPData;
|
45
46
|
private processIncommingPacket;
|
46
47
|
}
|
48
|
+
//# sourceMappingURL=mavesp.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"mavesp.d.ts","sourceRoot":"","sources":["../../lib/mavesp.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AAOrC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEvD;;GAEG;AACH,qBAAa,UAAW,SAAQ,YAAY;IAC1C,OAAO,CAAC,KAAK,CAAU;IACvB,OAAO,CAAC,MAAM,CAAC,CAAQ;IACvB,OAAO,CAAC,EAAE,CAAa;IACvB,OAAO,CAAC,QAAQ,CAAgB;IAChC,OAAO,CAAC,GAAG,CAAY;;IAmBvB;;;;;OAKG;IACG,KAAK,CAAC,WAAW,GAAE,MAAc,EAAE,QAAQ,GAAE,MAAc;IAmBjE;;;;;;OAMG;IACH,IAAI,CAAC,GAAG,EAAE,WAAW,EAAE,KAAK,GAAE,OAAgC,EAAE,MAAM,GAAE,OAAiC;IAOzG;;;;;;;OAOG;IACH,UAAU,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,GAAE,OAAW,EAAE,KAAK,GAAE,OAAgC,EAAE,MAAM,GAAE,OAAiC;IAQjJ;;;;OAIG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM;IAIzB,OAAO,CAAC,uBAAuB;IAO/B,OAAO,CAAC,sBAAsB;CAI/B"}
|
package/dist/lib/mavesp.js
CHANGED
@@ -1 +1,101 @@
|
|
1
|
-
"use strict";
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.MavEsp8266 = void 0;
|
4
|
+
const events_1 = require("events");
|
5
|
+
const dgram_1 = require("dgram");
|
6
|
+
const stream_1 = require("stream");
|
7
|
+
const mavlink_1 = require("./mavlink");
|
8
|
+
const mavlink_2 = require("./mavlink");
|
9
|
+
const utils_1 = require("./utils");
|
10
|
+
/**
|
11
|
+
* Encapsulation of communication with MavEsp8266
|
12
|
+
*/
|
13
|
+
class MavEsp8266 extends events_1.EventEmitter {
|
14
|
+
input;
|
15
|
+
socket;
|
16
|
+
ip = '';
|
17
|
+
sendPort = 14555;
|
18
|
+
seq = 0;
|
19
|
+
constructor() {
|
20
|
+
super();
|
21
|
+
this.input = new stream_1.PassThrough();
|
22
|
+
this.processIncommingUDPData = this.processIncommingUDPData.bind(this);
|
23
|
+
this.processIncommingPacket = this.processIncommingPacket.bind(this);
|
24
|
+
// Create the reader as usual by piping the source stream through the splitter
|
25
|
+
// and packet parser
|
26
|
+
const reader = this.input
|
27
|
+
.pipe(new mavlink_1.MavLinkPacketSplitter())
|
28
|
+
.pipe(new mavlink_1.MavLinkPacketParser());
|
29
|
+
reader.on('data', this.processIncommingPacket);
|
30
|
+
}
|
31
|
+
/**
|
32
|
+
* Start communication with the controller via MAVESP2866
|
33
|
+
*
|
34
|
+
* @param receivePort port to receive messages on (default: 14550)
|
35
|
+
* @param sendPort port to send messages to (default: 14555)
|
36
|
+
*/
|
37
|
+
async start(receivePort = 14550, sendPort = 14555) {
|
38
|
+
this.sendPort = sendPort;
|
39
|
+
// Create a UDP socket
|
40
|
+
this.socket = (0, dgram_1.createSocket)({ type: 'udp4', reuseAddr: true });
|
41
|
+
this.socket.on('message', this.processIncommingUDPData);
|
42
|
+
// Start listening on the socket
|
43
|
+
return new Promise((resolve, reject) => {
|
44
|
+
this.socket?.bind(receivePort, () => {
|
45
|
+
// Wait for the first package to be returned to read the ip address
|
46
|
+
// of the controller
|
47
|
+
(0, utils_1.waitFor)(() => this.ip !== '')
|
48
|
+
.then(() => { resolve(this.ip); })
|
49
|
+
.catch(e => { reject(e); });
|
50
|
+
});
|
51
|
+
});
|
52
|
+
}
|
53
|
+
/**
|
54
|
+
* Send a packet
|
55
|
+
*
|
56
|
+
* @param msg message to send
|
57
|
+
* @param sysid system id
|
58
|
+
* @param compid component id
|
59
|
+
*/
|
60
|
+
send(msg, sysid = mavlink_2.MavLinkProtocol.SYS_ID, compid = mavlink_2.MavLinkProtocol.COMP_ID) {
|
61
|
+
const protocol = new mavlink_2.MavLinkProtocolV2(sysid, compid);
|
62
|
+
const buffer = protocol.serialize(msg, this.seq++);
|
63
|
+
this.seq &= 255;
|
64
|
+
this.sendBuffer(buffer);
|
65
|
+
}
|
66
|
+
/**
|
67
|
+
* Send a signed packet
|
68
|
+
*
|
69
|
+
* @param msg message to send
|
70
|
+
* @param sysid system id
|
71
|
+
* @param compid component id
|
72
|
+
* @param linkId link id for the signature
|
73
|
+
*/
|
74
|
+
sendSigned(msg, key, linkId = 1, sysid = mavlink_2.MavLinkProtocol.SYS_ID, compid = mavlink_2.MavLinkProtocol.COMP_ID) {
|
75
|
+
const protocol = new mavlink_2.MavLinkProtocolV2(sysid, compid, mavlink_2.MavLinkProtocolV2.IFLAG_SIGNED);
|
76
|
+
const b1 = protocol.serialize(msg, this.seq++);
|
77
|
+
this.seq &= 255;
|
78
|
+
const b2 = protocol.sign(b1, linkId, key);
|
79
|
+
this.sendBuffer(b2);
|
80
|
+
}
|
81
|
+
/**
|
82
|
+
* Send raw data over the socket. Useful for custom implementation of data sending
|
83
|
+
*
|
84
|
+
* @param buffer buffer to send
|
85
|
+
*/
|
86
|
+
sendBuffer(buffer) {
|
87
|
+
this.socket?.send(buffer, this.sendPort, this.ip);
|
88
|
+
}
|
89
|
+
processIncommingUDPData(buffer, metadata) {
|
90
|
+
// store the remote ip address
|
91
|
+
if (this.ip === '')
|
92
|
+
this.ip = metadata.address;
|
93
|
+
// pass on the data to the input stream
|
94
|
+
this.input.write(buffer);
|
95
|
+
}
|
96
|
+
processIncommingPacket(packet) {
|
97
|
+
// let the user know we received the packet
|
98
|
+
this.emit('data', packet);
|
99
|
+
}
|
100
|
+
}
|
101
|
+
exports.MavEsp8266 = MavEsp8266;
|
package/dist/lib/mavlink.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
/// <reference types="node" />
|
2
|
+
/// <reference types="node" />
|
2
3
|
import { Transform, TransformCallback, Readable, Writable } from 'stream';
|
3
4
|
import { uint8_t, uint16_t } from 'mavlink-mappings';
|
4
5
|
import { MavLinkData, MavLinkDataConstructor } from 'mavlink-mappings';
|
@@ -7,7 +8,7 @@ import { Logger } from './logger';
|
|
7
8
|
* Header definition of the MavLink packet
|
8
9
|
*/
|
9
10
|
export declare class MavLinkPacketHeader {
|
10
|
-
timestamp:
|
11
|
+
timestamp: bigint | null;
|
11
12
|
magic: number;
|
12
13
|
payloadLength: uint8_t;
|
13
14
|
incompatibilityFlags: uint8_t;
|
@@ -38,11 +39,11 @@ export declare abstract class MavLinkProtocol {
|
|
38
39
|
/**
|
39
40
|
* Deserialize packet header
|
40
41
|
*/
|
41
|
-
abstract header(buffer:
|
42
|
+
abstract header(buffer: Buffer, timestamp?: bigint): MavLinkPacketHeader;
|
42
43
|
/**
|
43
44
|
* Deserialize packet checksum
|
44
45
|
*/
|
45
|
-
abstract crc(buffer:
|
46
|
+
abstract crc(buffer: Buffer): uint16_t;
|
46
47
|
/**
|
47
48
|
* Extract payload buffer
|
48
49
|
*
|
@@ -67,7 +68,7 @@ export declare class MavLinkProtocolV1 extends MavLinkProtocol {
|
|
67
68
|
static PAYLOAD_OFFSET: number;
|
68
69
|
constructor(sysid?: uint8_t, compid?: uint8_t);
|
69
70
|
serialize(message: MavLinkData, seq: number): Buffer;
|
70
|
-
header(buffer: Buffer, timestamp?:
|
71
|
+
header(buffer: Buffer, timestamp?: bigint): MavLinkPacketHeader;
|
71
72
|
/**
|
72
73
|
* Deserialize packet checksum
|
73
74
|
*/
|
@@ -101,13 +102,13 @@ export declare class MavLinkProtocolV2 extends MavLinkProtocol {
|
|
101
102
|
*/
|
102
103
|
sign(buffer: Buffer, linkId: number, key: Buffer, timestamp?: number): Buffer;
|
103
104
|
private calculateTruncatedPayloadLength;
|
104
|
-
header(buffer: Buffer, timestamp?:
|
105
|
+
header(buffer: Buffer, timestamp?: bigint): MavLinkPacketHeader;
|
105
106
|
/**
|
106
107
|
* Deserialize packet checksum
|
107
108
|
*/
|
108
109
|
crc(buffer: Buffer): uint16_t;
|
109
110
|
payload(buffer: Buffer): Buffer;
|
110
|
-
signature(buffer: Buffer, header: MavLinkPacketHeader): MavLinkPacketSignature;
|
111
|
+
signature(buffer: Buffer, header: MavLinkPacketHeader): MavLinkPacketSignature | null;
|
111
112
|
}
|
112
113
|
/**
|
113
114
|
* MavLink packet signature definition
|
@@ -177,8 +178,8 @@ export declare class MavLinkPacket {
|
|
177
178
|
readonly payload: Buffer;
|
178
179
|
readonly crc: uint16_t;
|
179
180
|
readonly protocol: MavLinkProtocol;
|
180
|
-
readonly signature: MavLinkPacketSignature;
|
181
|
-
constructor(buffer: Buffer, header?: MavLinkPacketHeader, payload?: Buffer, crc?: uint16_t, protocol?: MavLinkProtocol, signature?: MavLinkPacketSignature);
|
181
|
+
readonly signature: MavLinkPacketSignature | null;
|
182
|
+
constructor(buffer: Buffer, header?: MavLinkPacketHeader, payload?: Buffer, crc?: uint16_t, protocol?: MavLinkProtocol, signature?: MavLinkPacketSignature | null);
|
182
183
|
/**
|
183
184
|
* Debug information about the packet
|
184
185
|
*
|
@@ -205,7 +206,7 @@ export declare class MavLinkPacketSplitter extends Transform {
|
|
205
206
|
* @param onCrcError callback executed if there is a CRC error (mostly for debugging)
|
206
207
|
*/
|
207
208
|
constructor(opts?: {}, onCrcError?: BufferCallback);
|
208
|
-
_transform(chunk: Buffer, encoding:
|
209
|
+
_transform(chunk: Buffer, encoding: string, callback: TransformCallback): void;
|
209
210
|
private findStartOfPacket;
|
210
211
|
private getPacketProtocol;
|
211
212
|
private readPacketLength;
|
@@ -249,9 +250,9 @@ export declare class MavLinkPacketParser extends Transform {
|
|
249
250
|
constructor(opts?: {});
|
250
251
|
private getProtocol;
|
251
252
|
_transform({ buffer, timestamp, ...rest }: {
|
252
|
-
buffer?: Buffer;
|
253
|
-
timestamp?:
|
254
|
-
}, encoding:
|
253
|
+
buffer?: Buffer | undefined;
|
254
|
+
timestamp?: null | undefined;
|
255
|
+
} | undefined, encoding: string, callback: TransformCallback): void;
|
255
256
|
}
|
256
257
|
/**
|
257
258
|
* Creates a MavLink packet stream reader that is reading packets from the given input
|
@@ -282,3 +283,4 @@ export declare function send(stream: Writable, msg: MavLinkData, protocol?: MavL
|
|
282
283
|
*/
|
283
284
|
export declare function sendSigned(stream: Writable, msg: MavLinkData, key: Buffer, linkId?: uint8_t, sysid?: uint8_t, compid?: uint8_t, timestamp?: number): Promise<unknown>;
|
284
285
|
export {};
|
286
|
+
//# sourceMappingURL=mavlink.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"mavlink.d.ts","sourceRoot":"","sources":["../../lib/mavlink.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAEzE,OAAO,EAAE,OAAO,EAAE,QA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