unifi-protect 4.25.0 → 4.27.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/README.md CHANGED
@@ -133,6 +133,6 @@ The final part of the update packet is the data frame. The data frame can be thr
133
133
  This is mostly of interest to the true developer nerds amongst us.
134
134
 
135
135
  [![License](https://img.shields.io/npm/l/unifi-protect?color=%230559C9&logo=open%20source%20initiative&logoColor=%23FFFFFF&style=for-the-badge)](https://github.com/hjdhjd/unifi-protect/blob/main/LICENSE.md)
136
- [![Build Status](https://img.shields.io/github/workflow/status/hjdhjd/unifi-protect/Continuous%20Integration?color=%230559C9&logo=github-actions&logoColor=%23FFFFFF&style=for-the-badge)](https://github.com/hjdhjd/unifi-protect/actions?query=workflow%3A%22Continuous+Integration%22)
136
+ [![Build Status](https://img.shields.io/github/actions/workflow/status/hjdhjd/unifi-protect/ci.yml?branch=main&color=%230559C9&logo=github-actions&logoColor=%23FFFFFF&style=for-the-badge)](https://github.com/hjdhjd/unifi-protect/actions?query=workflow%3A%22Continuous+Integration%22)
137
137
  [![Dependencies](https://img.shields.io/librariesio/release/npm/unifi-protect?color=%230559C9&logo=dependabot&style=for-the-badge)](https://libraries.io/npm/uniti-protect)
138
138
  [![GitHub commits since latest release (by SemVer)](https://img.shields.io/github/commits-since/hjdhjd/unifi-protect/latest?color=%230559C9&logo=github&sort=semver&style=for-the-badge)](https://github.com/hjdhjd/unifi-protect/commits/main)
@@ -1 +1 @@
1
- {"version":3,"file":"protect-api-events.js","sourceRoot":"","sources":["../src/protect-api-events.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAgEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,yDAAyD;AACzD,MAAM,wBAAwB,GAAG,CAAC,CAAC;AAEnC,oCAAoC;AACpC,IAAK,sBAIJ;AAJD,WAAK,sBAAsB;IAEzB,uEAAU,CAAA;IACV,yEAAW,CAAA;AACb,CAAC,EAJI,sBAAsB,KAAtB,sB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5D,IAAG,UAAU,KAAK,SAAS,EAAE,CAAC;YAE5B,OAAO,IAAI,CAAC;QACd,CAAC;QAED,2BAA2B;QAC3B,MAAM,aAAa,GAAG,MAAM,CAAC,SAAS,CAAC,wBAAwB,CAAC,cAAc,CAAqB,CAAC;QAEpG,wGAAwG;QACxG,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,wBAAwB,CAAC,QAAQ,CAAC,CAAC,CAAC;YACnE,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAAC,CAAC;QAE1G,iDAAiD;QACjD,IAAG,SAAS,KAAK,sBAAsB,CAAC,MAAM,EAAE,CAAC;YAE/C,OAAO,CAAC,aAAa,KAAK,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAuB,CAAC,CAAC,CAAC,IAAI,CAAC;QACjH,CAAC;QAED,0CAA0C;QAC1C,QAAO,aAAa,EAAE,CAAC;YAErB,KAAK,gBAAgB,CAAC,IAAI;gBAExB,4CAA4C;gBAC5C,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAS,CAAC;YAEhD,KAAK,gBAAgB,CAAC,MAAM;gBAE1B,OAAO,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YAElC,KAAK,gBAAgB,CAAC,MAAM;gBAE1B,OAAO,OAAO,CAAC;YAEjB;gBAEE,GAAG,CAAC,KAAK,CAAC,sEAAsE,EAAE,aAAa,CAAC,CAAC;gBAEjG,OAAO,IAAI,CAAC;QAChB,CAAC;IACH,CAAC;CACF"}
@@ -6,6 +6,7 @@ import { Readable } from "node:stream";
6
6
  /**
7
7
  * Options for configuring a livestream session.
8
8
  *
9
+ * @property chunkSize - Optionally specify the maximum payload size of each websocket packet. Larger sizes mean lower fragmentation. Defaults to 4096.
9
10
  * @property emitTimestamps - Optionally emit the decode timestamps of frames as timestamp events. This is the same information that appears in `tfdt` boxes.
10
11
  * @property lens - Optionally specify alternate cameras on a Protect device, such as a package camera.
11
12
  * @property segmentLength - Optionally specify the segment length, in milliseconds, of each fMP4 segment. Defaults to 100ms.
@@ -14,6 +15,7 @@ import { Readable } from "node:stream";
14
15
  * Defaults to false.
15
16
  */
16
17
  export interface LivestreamOptions {
18
+ chunkSize: number;
17
19
  emitTimestamps: boolean;
18
20
  lens: number;
19
21
  requestId: string;
@@ -34,14 +36,33 @@ export interface LivestreamOptions {
34
36
  * alternatively listen individually for the initialization segment or regular fMP4 segments if you'd like to distinguish between the two types of segments.
35
37
  *
36
38
  * Those are the basics that gets us up and running.
39
+ *
40
+ * @event close - Emitted when the livestream WebSocket connection has been closed. This event fires after cleanup is complete and the connection is fully
41
+ * terminated.
42
+ * @event codec - Emitted when codec information is received from the controller. The codec string is passed as an argument in the format "codec,container"
43
+ * (e.g., "hev1.1.6.L150,mp4a.40.2"). Only emitted when not using stream mode.
44
+ * @event initsegment - Emitted when an fMP4 initialization segment (FTYP and MOOV boxes) is received. The complete initialization segment Buffer is passed as an
45
+ * argument. Only emitted when not using stream mode.
46
+ * @event mdat - Emitted when an MDAT box (media data) has been received as part of a segment. The MDAT Buffer is passed as an argument. Only emitted when not
47
+ * using stream mode.
48
+ * @event message - Emitted when any complete fMP4 segment is received, whether initialization or regular segment. The complete segment Buffer is passed as an
49
+ * argument. Only emitted when not using stream mode.
50
+ * @event moof - Emitted when a MOOF box (movie fragment metadata) has been received as part of a segment. The MOOF Buffer is passed as an argument. Only emitted
51
+ * when not using stream mode.
52
+ * @event segment - Emitted when a non-initialization fMP4 segment (MOOF/MDAT pair) is fully assembled. The complete segment Buffer is passed as an argument. Only
53
+ * emitted when not using stream mode.
54
+ * @event timestamps - Emitted when decode timestamp information is received from the controller. An array of numbers containing the decode timestamps of frames in the
55
+ * next segment is passed as an argument, mirroring the tfdt box contents.
37
56
  */
38
57
  export declare class ProtectLivestream extends EventEmitter {
39
58
  private _initSegment;
40
59
  private _codec;
41
60
  private _stream;
61
+ private agent;
42
62
  private api;
43
63
  private errorHandler;
44
64
  private heartbeat;
65
+ private initSegmentPromise?;
45
66
  private lastMessage;
46
67
  private log;
47
68
  private messageHandler;
@@ -56,6 +77,13 @@ export declare class ProtectLivestream extends EventEmitter {
56
77
  *
57
78
  * @returns Returns `true` if the livestream has successfully started, `false` otherwise.
58
79
  *
80
+ * @event close - Emitted when the livestream connection terminates for any reason, including manual stops or errors.
81
+ * @event codec - Emitted with the codec information string when received from the controller (stream mode disabled only).
82
+ * @event initsegment - Emitted with the initialization segment Buffer containing FTYP and MOOV boxes (stream mode disabled only).
83
+ * @event message - Emitted with each complete fMP4 segment Buffer, both initialization and regular segments (stream mode disabled only).
84
+ * @event segment - Emitted with each complete non-initialization segment Buffer containing MOOF/MDAT pairs (stream mode disabled only).
85
+ * @event timestamps - Emitted with decode timestamp arrays when extendedVideoMetadata is enabled in options.
86
+ *
59
87
  * @remarks Once a livestream session has started, the following events can be listened for (unless you've specified `useStream` in `options`, in which case only the
60
88
  * `close` event is available):
61
89
  *
@@ -66,14 +94,34 @@ export declare class ProtectLivestream extends EventEmitter {
66
94
  * | `initsegment` | An fMP4 initialization segment has been received. The segment will be passed as an argument to any listeners. |
67
95
  * | `message` | An fMP4 segment has been received. No distinction is made between segment types. The segment will be passed as an argument to any listeners. |
68
96
  * | `segment` | A non-initialization fMP4 segment has been received. The segment will be passed as an argument to any listeners. |
69
- * | `timestamp` | A `BigInt` representing the decode timestamp of frames. It mirrors what is provided in the `tfdt` box in fMP4 segments. |
97
+ * | `timestamps` | An array of numbers containing the decode timestamps of the frames in the next segment. It mirrors what is provided in the `tfdt` box. |
70
98
  */
71
99
  start(cameraId: string, channel: number, options?: Partial<LivestreamOptions>): Promise<boolean>;
72
100
  /**
73
101
  * Stop an fMP4 livestream session from the Protect controller.
74
102
  */
75
103
  stop(): void;
104
+ /**
105
+ * Configure the websocket to populate the prebuffer.
106
+ *
107
+ * @event close - Emitted when the WebSocket connection closes or encounters an error requiring termination.
108
+ *
109
+ * @internal
110
+ */
76
111
  private launchLivestream;
112
+ /**
113
+ * Process fMP4 packets as they arrive over the websocket.
114
+ *
115
+ * @event codec - Emitted when we have received a codec packet.
116
+ * @event initsegment - Emitted when we have received the initialization segment.
117
+ * @event mdat - Emitted at segment end with the accumulated MDAT box data.
118
+ * @event message - Emitted with complete segments (both initialization and regular).
119
+ * @event moof - Emitted at segment end with the accumulated MOOF box data.
120
+ * @event segment - Emitted when we have received a complete non-initialization segment.
121
+ * @event timestamps - Emitted when we have received the decode timestamp arrays (when we have extendedVideoMetadata enabled).
122
+ *
123
+ * @internal
124
+ */
77
125
  private processLivestream;
78
126
  /**
79
127
  * Retrieve the initialization segment that must be at the start of every fMP4 stream.
@@ -73,14 +73,33 @@ var ProtectLiveFrame;
73
73
  * alternatively listen individually for the initialization segment or regular fMP4 segments if you'd like to distinguish between the two types of segments.
74
74
  *
75
75
  * Those are the basics that gets us up and running.
76
+ *
77
+ * @event close - Emitted when the livestream WebSocket connection has been closed. This event fires after cleanup is complete and the connection is fully
78
+ * terminated.
79
+ * @event codec - Emitted when codec information is received from the controller. The codec string is passed as an argument in the format "codec,container"
80
+ * (e.g., "hev1.1.6.L150,mp4a.40.2"). Only emitted when not using stream mode.
81
+ * @event initsegment - Emitted when an fMP4 initialization segment (FTYP and MOOV boxes) is received. The complete initialization segment Buffer is passed as an
82
+ * argument. Only emitted when not using stream mode.
83
+ * @event mdat - Emitted when an MDAT box (media data) has been received as part of a segment. The MDAT Buffer is passed as an argument. Only emitted when not
84
+ * using stream mode.
85
+ * @event message - Emitted when any complete fMP4 segment is received, whether initialization or regular segment. The complete segment Buffer is passed as an
86
+ * argument. Only emitted when not using stream mode.
87
+ * @event moof - Emitted when a MOOF box (movie fragment metadata) has been received as part of a segment. The MOOF Buffer is passed as an argument. Only emitted
88
+ * when not using stream mode.
89
+ * @event segment - Emitted when a non-initialization fMP4 segment (MOOF/MDAT pair) is fully assembled. The complete segment Buffer is passed as an argument. Only
90
+ * emitted when not using stream mode.
91
+ * @event timestamps - Emitted when decode timestamp information is received from the controller. An array of numbers containing the decode timestamps of frames in the
92
+ * next segment is passed as an argument, mirroring the tfdt box contents.
76
93
  */
77
94
  export class ProtectLivestream extends EventEmitter {
78
95
  _initSegment;
79
96
  _codec;
80
97
  _stream;
98
+ agent;
81
99
  api;
82
100
  errorHandler;
83
101
  heartbeat;
102
+ initSegmentPromise;
84
103
  lastMessage;
85
104
  log;
86
105
  messageHandler;
@@ -92,6 +111,7 @@ export class ProtectLivestream extends EventEmitter {
92
111
  this._codec = null;
93
112
  this._initSegment = null;
94
113
  this._stream = null;
114
+ this.agent = null;
95
115
  this.api = api;
96
116
  this.errorHandler = null;
97
117
  this.heartbeat = null;
@@ -109,6 +129,13 @@ export class ProtectLivestream extends EventEmitter {
109
129
  *
110
130
  * @returns Returns `true` if the livestream has successfully started, `false` otherwise.
111
131
  *
132
+ * @event close - Emitted when the livestream connection terminates for any reason, including manual stops or errors.
133
+ * @event codec - Emitted with the codec information string when received from the controller (stream mode disabled only).
134
+ * @event initsegment - Emitted with the initialization segment Buffer containing FTYP and MOOV boxes (stream mode disabled only).
135
+ * @event message - Emitted with each complete fMP4 segment Buffer, both initialization and regular segments (stream mode disabled only).
136
+ * @event segment - Emitted with each complete non-initialization segment Buffer containing MOOF/MDAT pairs (stream mode disabled only).
137
+ * @event timestamps - Emitted with decode timestamp arrays when extendedVideoMetadata is enabled in options.
138
+ *
112
139
  * @remarks Once a livestream session has started, the following events can be listened for (unless you've specified `useStream` in `options`, in which case only the
113
140
  * `close` event is available):
114
141
  *
@@ -119,9 +146,10 @@ export class ProtectLivestream extends EventEmitter {
119
146
  * | `initsegment` | An fMP4 initialization segment has been received. The segment will be passed as an argument to any listeners. |
120
147
  * | `message` | An fMP4 segment has been received. No distinction is made between segment types. The segment will be passed as an argument to any listeners. |
121
148
  * | `segment` | A non-initialization fMP4 segment has been received. The segment will be passed as an argument to any listeners. |
122
- * | `timestamp` | A `BigInt` representing the decode timestamp of frames. It mirrors what is provided in the `tfdt` box in fMP4 segments. |
149
+ * | `timestamps` | An array of numbers containing the decode timestamps of the frames in the next segment. It mirrors what is provided in the `tfdt` box. |
123
150
  */
124
151
  async start(cameraId, channel, options = {}) {
152
+ options.chunkSize ??= 4096;
125
153
  options.emitTimestamps ??= false;
126
154
  options.lens ??= 0;
127
155
  options.requestId ??= cameraId + "-" + channel.toString();
@@ -156,7 +184,13 @@ export class ProtectLivestream extends EventEmitter {
156
184
  // Flag that we are no longer running.
157
185
  this.ws = null;
158
186
  }
159
- // Configure the websocket to populate the prebuffer.
187
+ /**
188
+ * Configure the websocket to populate the prebuffer.
189
+ *
190
+ * @event close - Emitted when the WebSocket connection closes or encounters an error requiring termination.
191
+ *
192
+ * @internal
193
+ */
160
194
  async launchLivestream(cameraId, channel, options) {
161
195
  const logError = (message, ...parameters) => this.log.error(options.requestId + ": " + message, ...parameters);
162
196
  // To ensure there are minimal performance implications to the Protect NVR, enforce a 100ms floor for segment length. Protect happens to default to a 100ms segment
@@ -164,10 +198,11 @@ export class ProtectLivestream extends EventEmitter {
164
198
  if (options.segmentLength < 100) {
165
199
  options.segmentLength = 100;
166
200
  }
167
- // Parameters that can be set for the livestream. We allow the modification of a useful subset of these,
168
- // though not all of them, in order to simplify the API experience and ensure things always work.
201
+ // Parameters that can be set for the livestream. We allow the modification of a useful subset of these, though not all of them, in order to simplify the API
202
+ // experience and ensure things always work.
169
203
  //
170
- // allowPartialGOP: Allow partial groups of pictures. This is necessary for a valid fMP4 stream that can be used in realtime.
204
+ // allowPartialGOP: Allow partial groups of pictures. Protect will start a fragment even if it doesn’t begin on a keyframe. This reduces end-to-end latency
205
+ // at the cost of potentially cutting a GOP in half (i.e. you may see inter-frame artifacts at the very start of some segments).
171
206
  // camera: The camera ID of the camera you are trying to livestream.
172
207
  // channel: The camera channel to use for this livestream.
173
208
  // extendedVideoMetadata: Provide extended metadata in the MOOV box when possible.
@@ -181,7 +216,7 @@ export class ProtectLivestream extends EventEmitter {
181
216
  allowPartialGOP: "",
182
217
  camera: cameraId,
183
218
  channel: channel.toString(),
184
- chunkSize: "4096",
219
+ chunkSize: options.chunkSize.toString(),
185
220
  ...(options.emitTimestamps ? { extendedVideoMetadata: "" } : {}),
186
221
  fragmentDurationMillis: options.segmentLength.toString(),
187
222
  lens: options.lens.toString(),
@@ -199,14 +234,17 @@ export class ProtectLivestream extends EventEmitter {
199
234
  return false;
200
235
  }
201
236
  try {
237
+ // Configure our agent to ensure we don't enable keepalive or HTTP pipelining so we can quickly tear down the connection when needed.
238
+ this.agent = new Agent({
239
+ connect: {
240
+ keepAlive: false,
241
+ rejectUnauthorized: false
242
+ },
243
+ pipelining: 0
244
+ });
202
245
  // Open the livestream WebSocket. We create a new dispatcher here because WebSocket upgrades can only happen over HTTP/1.1 and we've asked for HTTP/2 whenever
203
246
  // possible in our global pool.
204
- this.ws = new WebSocket(wsUrl, { dispatcher: new Agent({ connect: { rejectUnauthorized: false } }) });
205
- if (!this.ws) {
206
- this.ws = null;
207
- logError("unable to connect to the livestream websocket API endpoint.");
208
- return false;
209
- }
247
+ this.ws = new WebSocket(wsUrl, { dispatcher: this.agent });
210
248
  // The user's requested that we use a stream interface instead of an event interface to push complete fMP4 segments.
211
249
  if (options.useStream) {
212
250
  this._stream = new Readable({
@@ -215,7 +253,7 @@ export class ProtectLivestream extends EventEmitter {
215
253
  });
216
254
  }
217
255
  // Start our heartbeat once we've opened the connection.
218
- this.ws?.addEventListener("open", () => {
256
+ this.ws.addEventListener("open", () => {
219
257
  this.lastMessage = Date.now();
220
258
  // Heartbeat the controller. We need this because if we don't heartbeat the controller, it can sometimes just decide not to give us a livestream to work with, or
221
259
  // lockup due to regressions in the controller firmware. This ensures we can never hang waiting on data from the API, especially in a livestream scenario.
@@ -231,8 +269,8 @@ export class ProtectLivestream extends EventEmitter {
231
269
  }
232
270
  if ((Date.now() - this.lastMessage) > PROTECT_API_TIMEOUT) {
233
271
  logError("the livestream API is not responding.");
234
- if ((this.ws?.readyState === WebSocket.CLOSING) || (this.ws?.readyState === WebSocket.OPEN)) {
235
- this.ws?.close();
272
+ if ((this.ws.readyState === WebSocket.CLOSING) || (this.ws.readyState === WebSocket.OPEN)) {
273
+ this.ws.close();
236
274
  }
237
275
  }
238
276
  }, PROTECT_API_TIMEOUT);
@@ -240,7 +278,7 @@ export class ProtectLivestream extends EventEmitter {
240
278
  this.processLivestream();
241
279
  }, { once: true });
242
280
  // Catch any errors and inform the user, if needed.
243
- this.ws?.addEventListener("error", this.errorHandler = (event) => {
281
+ this.ws.addEventListener("error", this.errorHandler = (event) => {
244
282
  const error = event.error;
245
283
  // Ignore timeout errors, but notify the user about anything else.
246
284
  if (error.code !== "ETIMEDOUT") {
@@ -249,13 +287,15 @@ export class ProtectLivestream extends EventEmitter {
249
287
  }
250
288
  this.stop();
251
289
  }, { once: true });
252
- this.ws?.addEventListener("close", () => {
290
+ this.ws.addEventListener("close", async () => {
253
291
  // Clear out our heartbeat since we're closing.
254
292
  if (this.heartbeat) {
255
293
  clearInterval(this.heartbeat);
256
294
  this.heartbeat = null;
257
295
  }
258
296
  this.stop();
297
+ await this.agent?.destroy();
298
+ this.agent = null;
259
299
  this.emit("close");
260
300
  }, { once: true });
261
301
  }
@@ -265,7 +305,19 @@ export class ProtectLivestream extends EventEmitter {
265
305
  }
266
306
  return true;
267
307
  }
268
- // Process fMP4 packets as they arrive over the websocket.
308
+ /**
309
+ * Process fMP4 packets as they arrive over the websocket.
310
+ *
311
+ * @event codec - Emitted when we have received a codec packet.
312
+ * @event initsegment - Emitted when we have received the initialization segment.
313
+ * @event mdat - Emitted at segment end with the accumulated MDAT box data.
314
+ * @event message - Emitted with complete segments (both initialization and regular).
315
+ * @event moof - Emitted at segment end with the accumulated MOOF box data.
316
+ * @event segment - Emitted when we have received a complete non-initialization segment.
317
+ * @event timestamps - Emitted when we have received the decode timestamp arrays (when we have extendedVideoMetadata enabled).
318
+ *
319
+ * @internal
320
+ */
269
321
  processLivestream() {
270
322
  // Check to ensure our websocket is live.
271
323
  if (!this.ws) {
@@ -343,6 +395,7 @@ export class ProtectLivestream extends EventEmitter {
343
395
  const dataStart = offset + 4;
344
396
  const dataEnd = dataStart + length;
345
397
  const data = packet.subarray(dataStart, dataEnd);
398
+ const timestamps = [];
346
399
  // Figure out which data type we've got based on our header, and process it.
347
400
  switch (header) {
348
401
  // We've got audio data. Add it to our current segment.
@@ -394,8 +447,9 @@ export class ProtectLivestream extends EventEmitter {
394
447
  // We've got a timestamp packet. Protect sends over decode timestamps identical to what's in the tfdt box in the segment.
395
448
  case ProtectLiveFrame.TIMESTAMP:
396
449
  for (let offset = 0; offset < data.length; offset += 8) {
397
- this.emit("timestamp", data.readBigUInt64BE(offset));
450
+ timestamps.push(Number(data.readBigUInt64BE(offset)));
398
451
  }
452
+ this.emit("timestamps", timestamps);
399
453
  break;
400
454
  // MDAT box. Add it to the MDAT portion of our segment.
401
455
  case ProtectLiveFrame.MDAT:
@@ -428,9 +482,8 @@ export class ProtectLivestream extends EventEmitter {
428
482
  if (this.initSegment) {
429
483
  return this.initSegment;
430
484
  }
431
- // Wait until the initialization segment is seen and then try again.
432
- await events.once(this, "initsegment");
433
- return this.getInitSegment();
485
+ // Cache a promise that resolves when the initsegment event is emitted. We need to wait until the initialization segment is seen and then return it.
486
+ return this.initSegmentPromise ??= events.once(this, "initsegment").then(() => this.initSegment);
434
487
  }
435
488
  /**
436
489
  * The initialization segment that must be at the start of every fMP4 stream.
@@ -1 +1 @@
1
- {"version":3,"file":"protect-api-livestream.js","sourceRoot":"","sources":["../src/protect-api-livestream.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,uCAAuC;AACvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,sCAAsC;AACtC,OAAO,EAAE,KAAK,EAAsC,SAAS,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