@trillboards/edge-sdk 0.2.243 → 0.2.245

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.
Files changed (82) hide show
  1. package/deploy/windows/build-windows.ps1 +17 -1
  2. package/deploy/windows/ci/test-alert-window-field.ps1 +28 -6
  3. package/deploy/windows/ci/test-detector-looks-field.ps1 +31 -7
  4. package/deploy/windows/ci/test-private-live-view-staging.ps1 +43 -0
  5. package/deploy/windows/ci/test-stop-existing-processes.ps1 +58 -0
  6. package/deploy/windows/e2e/test-headless-principal.ps1 +24 -2
  7. package/deploy/windows/stage-private-live-view.ps1 +59 -0
  8. package/deploy/windows/stop-existing.ps1 +6 -5
  9. package/deploy/windows/stop-local-ai.ps1 +4 -0
  10. package/dist/AlertClips.d.ts +8 -1
  11. package/dist/AlertClips.d.ts.map +1 -1
  12. package/dist/AlertClips.js +29 -3
  13. package/dist/AlertClips.js.map +1 -1
  14. package/dist/CctvLiveViewCoordinator.d.ts +123 -0
  15. package/dist/CctvLiveViewCoordinator.d.ts.map +1 -0
  16. package/dist/CctvLiveViewCoordinator.js +393 -0
  17. package/dist/CctvLiveViewCoordinator.js.map +1 -0
  18. package/dist/ChannelProber.d.ts +15 -0
  19. package/dist/ChannelProber.d.ts.map +1 -1
  20. package/dist/ChannelProber.js +61 -0
  21. package/dist/ChannelProber.js.map +1 -1
  22. package/dist/ConnectorStatusClient.d.ts +9 -1
  23. package/dist/ConnectorStatusClient.d.ts.map +1 -1
  24. package/dist/ConnectorStatusClient.js +3 -0
  25. package/dist/ConnectorStatusClient.js.map +1 -1
  26. package/dist/EdgeAgent.js +1 -1
  27. package/dist/LiveViewControlHttp.d.ts +10 -0
  28. package/dist/LiveViewControlHttp.d.ts.map +1 -0
  29. package/dist/LiveViewControlHttp.js +84 -0
  30. package/dist/LiveViewControlHttp.js.map +1 -0
  31. package/dist/LiveViewOwnedSenderScope.d.ts +38 -0
  32. package/dist/LiveViewOwnedSenderScope.d.ts.map +1 -0
  33. package/dist/LiveViewOwnedSenderScope.js +88 -0
  34. package/dist/LiveViewOwnedSenderScope.js.map +1 -0
  35. package/dist/LiveViewProducerSignaling.d.ts +37 -0
  36. package/dist/LiveViewProducerSignaling.d.ts.map +1 -0
  37. package/dist/LiveViewProducerSignaling.js +97 -0
  38. package/dist/LiveViewProducerSignaling.js.map +1 -0
  39. package/dist/LiveViewRelayBootstrap.d.ts +26 -0
  40. package/dist/LiveViewRelayBootstrap.d.ts.map +1 -0
  41. package/dist/LiveViewRelayBootstrap.js +85 -0
  42. package/dist/LiveViewRelayBootstrap.js.map +1 -0
  43. package/dist/MainStreamRing.d.ts +246 -0
  44. package/dist/MainStreamRing.d.ts.map +1 -0
  45. package/dist/MainStreamRing.js +436 -0
  46. package/dist/MainStreamRing.js.map +1 -0
  47. package/dist/SensingProfileClient.d.ts +20 -0
  48. package/dist/SensingProfileClient.d.ts.map +1 -1
  49. package/dist/SensingProfileClient.js +10 -1
  50. package/dist/SensingProfileClient.js.map +1 -1
  51. package/dist/VideoSegmentUploader.d.ts +45 -1
  52. package/dist/VideoSegmentUploader.d.ts.map +1 -1
  53. package/dist/VideoSegmentUploader.js +112 -19
  54. package/dist/VideoSegmentUploader.js.map +1 -1
  55. package/dist/autoSense.d.ts +5 -0
  56. package/dist/autoSense.d.ts.map +1 -1
  57. package/dist/autoSense.js +55 -2
  58. package/dist/autoSense.js.map +1 -1
  59. package/dist/cli.d.ts.map +1 -1
  60. package/dist/cli.js +2 -0
  61. package/dist/cli.js.map +1 -1
  62. package/dist/connectorUpdate.d.ts +9 -0
  63. package/dist/connectorUpdate.d.ts.map +1 -1
  64. package/dist/connectorUpdate.js +22 -13
  65. package/dist/connectorUpdate.js.map +1 -1
  66. package/dist/diagnose.d.ts +1 -1
  67. package/dist/diagnose.js +1 -1
  68. package/dist/index.d.ts +2 -0
  69. package/dist/index.d.ts.map +1 -1
  70. package/dist/index.js +6 -1
  71. package/dist/index.js.map +1 -1
  72. package/dist/localSensing.d.ts.map +1 -1
  73. package/dist/localSensing.js +3 -0
  74. package/dist/localSensing.js.map +1 -1
  75. package/dist/sensingRunMode.d.ts +1 -0
  76. package/dist/sensingRunMode.d.ts.map +1 -1
  77. package/dist/sensingRunMode.js.map +1 -1
  78. package/dist/windowsLiveView.d.ts +57 -0
  79. package/dist/windowsLiveView.d.ts.map +1 -0
  80. package/dist/windowsLiveView.js +180 -0
  81. package/dist/windowsLiveView.js.map +1 -0
  82. package/package.json +2 -2
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LiveViewOwnedSenderScope = void 0;
4
+ /** One admitted scope. Both resource containers must exist before either can acquire. */
5
+ class LiveViewOwnedSenderScope {
6
+ constructor(child, sender, leaseAllowed, packetAllowed, releaseAdmission) {
7
+ this.child = child;
8
+ this.sender = sender;
9
+ this.leaseAllowed = leaseAllowed;
10
+ this.packetAllowed = packetAllowed;
11
+ this.releaseAdmission = releaseAdmission;
12
+ this.fenced = false;
13
+ this.fenceFailed = false;
14
+ this.startup = null;
15
+ this.cleanup = null;
16
+ }
17
+ assertLease() {
18
+ if (!this.leaseAllowed() || this.fenced)
19
+ throw new Error('Live-view sender lease ended.');
20
+ }
21
+ setDeadline(deadlineMs, clockGeneration, requestStartMs) {
22
+ this.assertLease();
23
+ this.child.setDeadline(deadlineMs, clockGeneration, requestStartMs);
24
+ }
25
+ activate() {
26
+ this.assertLease();
27
+ this.child.activate?.();
28
+ }
29
+ start() {
30
+ if (this.startup)
31
+ return this.startup;
32
+ this.startup = Promise.resolve().then(async () => {
33
+ this.assertLease();
34
+ await this.child.start();
35
+ this.assertLease();
36
+ await this.sender.start();
37
+ this.assertLease();
38
+ });
39
+ return this.startup;
40
+ }
41
+ fence() {
42
+ if (this.fenced)
43
+ return;
44
+ this.fenced = true;
45
+ try {
46
+ try {
47
+ this.child.fence();
48
+ }
49
+ finally {
50
+ this.sender.fence();
51
+ }
52
+ }
53
+ catch (error) {
54
+ this.fenceFailed = true;
55
+ throw error;
56
+ }
57
+ }
58
+ release() {
59
+ if (this.cleanup)
60
+ return this.cleanup;
61
+ this.cleanup = Promise.resolve().then(async () => {
62
+ try {
63
+ this.fence();
64
+ }
65
+ catch { /* Still attempt both exact joins. */ }
66
+ const [child, sender] = await Promise.allSettled([
67
+ Promise.resolve().then(() => this.child.release()),
68
+ Promise.resolve().then(() => this.sender.release()),
69
+ this.startup,
70
+ ]);
71
+ if (child.status === 'rejected')
72
+ throw child.reason;
73
+ if (sender.status === 'rejected')
74
+ throw sender.reason;
75
+ if (this.fenceFailed)
76
+ throw new Error('Live-view sender fence failed.');
77
+ await this.releaseAdmission();
78
+ });
79
+ return this.cleanup;
80
+ }
81
+ async submitH264(bytes, timestamp) {
82
+ if (!this.packetAllowed() || this.fenced)
83
+ throw new Error('Live-view media is unavailable.');
84
+ return this.sender.submitH264(bytes, timestamp);
85
+ }
86
+ }
87
+ exports.LiveViewOwnedSenderScope = LiveViewOwnedSenderScope;
88
+ //# sourceMappingURL=LiveViewOwnedSenderScope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LiveViewOwnedSenderScope.js","sourceRoot":"","sources":["../src/LiveViewOwnedSenderScope.ts"],"names":[],"mappings":";;;AAoBA,yFAAyF;AACzF,MAAa,wBAAwB;IAMnC,YAA6B,KAAyB,EAAmB,MAAiC,EACvF,YAA2B,EAAmB,aAA4B,EAC1E,gBAA4C;QAFlC,UAAK,GAAL,KAAK,CAAoB;QAAmB,WAAM,GAAN,MAAM,CAA2B;QACvF,iBAAY,GAAZ,YAAY,CAAe;QAAmB,kBAAa,GAAb,aAAa,CAAe;QAC1E,qBAAgB,GAAhB,gBAAgB,CAA4B;QAPvD,WAAM,GAAG,KAAK,CAAC;QACf,gBAAW,GAAG,KAAK,CAAC;QACpB,YAAO,GAAyB,IAAI,CAAC;QACrC,YAAO,GAAyB,IAAI,CAAC;IAIqB,CAAC;IAE3D,WAAW;QACjB,IAAI,CAAC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,SAAS,CAAC,CAAC;IAClD,CAAC;CACF;AApED,4DAoEC"}
@@ -0,0 +1,37 @@
1
+ import type { LiveViewClockSample } from './CctvLiveViewCoordinator';
2
+ interface SignalMessage {
3
+ sequence: number;
4
+ kind: 'offer' | 'answer' | 'ice' | 'endOfCandidates';
5
+ payload: unknown;
6
+ }
7
+ interface SignalPage {
8
+ version: 1;
9
+ sessionId: string;
10
+ negotiationId: string | null;
11
+ status: 'waiting_offer' | 'negotiating';
12
+ pollAfterMs: number;
13
+ messages: SignalMessage[];
14
+ nextSequence: number;
15
+ }
16
+ export interface LiveViewProducerSignaling {
17
+ read(negotiationId: string | null, afterSequence: number): Promise<SignalPage>;
18
+ write(message: Omit<SignalMessage, 'kind'> & {
19
+ negotiationId: string;
20
+ kind: Exclude<SignalMessage['kind'], 'offer'>;
21
+ }): Promise<{
22
+ acknowledgedSequence: number;
23
+ idempotent: boolean;
24
+ }>;
25
+ }
26
+ /** One bound producer. Signaling does not publish or extend the viewing lease. */
27
+ export declare function createLiveViewProducerSignaling(options: {
28
+ apiBaseUrl: string;
29
+ connectorKey: string;
30
+ sessionId: string;
31
+ producerInstanceId: string;
32
+ clock(): LiveViewClockSample;
33
+ leaseAllowed(): boolean;
34
+ signal: AbortSignal;
35
+ }): LiveViewProducerSignaling;
36
+ export {};
37
+ //# sourceMappingURL=LiveViewProducerSignaling.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LiveViewProducerSignaling.d.ts","sourceRoot":"","sources":["../src/LiveViewProducerSignaling.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAIrE,UAAU,aAAa;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,iBAAiB,CAAC;IACrD,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,UAAU,UAAU;IAClB,OAAO,EAAE,CAAC,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,MAAM,EAAE,eAAe,GAAG,aAAa,CAAC;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,yBAAyB;IACxC,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC/E,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,GAAG;QAC3C,aAAa,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;KACtE,GAAG,OAAO,CAAC;QAAE,oBAAoB,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CACpE;AAaD,kFAAkF;AAClF,wBAAgB,+BAA+B,CAAC,OAAO,EAAE;IACvD,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,KAAK,IAAI,mBAAmB,CAAC;IAC7B,YAAY,IAAI,OAAO,CAAC;IACxB,MAAM,EAAE,WAAW,CAAC;CACrB,GAAG,yBAAyB,CAqE5B"}
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createLiveViewProducerSignaling = createLiveViewProducerSignaling;
4
+ const LiveViewControlHttp_1 = require("./LiveViewControlHttp");
5
+ const LiveViewRelayBootstrap_1 = require("./LiveViewRelayBootstrap");
6
+ const uuid = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;
7
+ const validSequence = (value) => Number.isSafeInteger(value) && value >= 0 && value <= 66;
8
+ function refused() {
9
+ throw new Error('Live-view signaling was refused.');
10
+ }
11
+ function object(value) {
12
+ return value !== null && typeof value === 'object' && !Array.isArray(value);
13
+ }
14
+ /** One bound producer. Signaling does not publish or extend the viewing lease. */
15
+ function createLiveViewProducerSignaling(options) {
16
+ const { sessionId, producerInstanceId, connectorKey, signal, clock, leaseAllowed } = options;
17
+ if (!uuid.test(sessionId) || !uuid.test(producerInstanceId) || !connectorKey || connectorKey.length > 1024 ||
18
+ !/^[\x21-\x7e]+$/.test(connectorKey))
19
+ refused();
20
+ const endpoint = (0, LiveViewRelayBootstrap_1.liveViewProducerEndpoint)(options.apiBaseUrl, '/sessions/' + sessionId + '/signals');
21
+ const headers = { authorization: 'Bearer ' + connectorKey };
22
+ let running = false;
23
+ async function exchange(method, target, payload) {
24
+ if (running || signal.aborted || !leaseAllowed())
25
+ refused();
26
+ running = true;
27
+ try {
28
+ const send = (0, LiveViewControlHttp_1.createLiveViewJsonExchange)(target, clock, { method, headers, maxBytes: 512 * 1024 });
29
+ const startedAt = clock();
30
+ const envelope = await send(payload, { startedAt, signal });
31
+ if (signal.aborted || !leaseAllowed() || !object(envelope) || envelope.success !== true ||
32
+ !object(envelope.signaling))
33
+ refused();
34
+ const result = envelope.signaling;
35
+ const { negotiationId, status, pollAfterMs } = result;
36
+ if (result.version !== 1 || result.sessionId !== sessionId ||
37
+ (status === 'waiting_offer' ? negotiationId !== null :
38
+ status !== 'negotiating' || typeof negotiationId !== 'string' || !uuid.test(negotiationId)) ||
39
+ typeof pollAfterMs !== 'number' || !Number.isSafeInteger(pollAfterMs) || pollAfterMs < 1000 ||
40
+ pollAfterMs > 10000)
41
+ refused();
42
+ return result;
43
+ }
44
+ catch {
45
+ refused();
46
+ }
47
+ finally {
48
+ running = false;
49
+ }
50
+ }
51
+ return {
52
+ async read(negotiationId, afterSequence) {
53
+ if (!validSequence(afterSequence) || (negotiationId === null ? afterSequence !== 0 : !uuid.test(negotiationId)))
54
+ refused();
55
+ const target = new URL(endpoint.href);
56
+ target.searchParams.set('producerInstanceId', producerInstanceId);
57
+ if (negotiationId !== null)
58
+ target.searchParams.set('negotiationId', negotiationId);
59
+ target.searchParams.set('afterSequence', String(afterSequence));
60
+ const result = await exchange('GET', target, undefined);
61
+ const { status, pollAfterMs } = result;
62
+ if ((negotiationId !== null && result.negotiationId !== negotiationId) || !Array.isArray(result.messages) ||
63
+ result.messages.length > 16 || (status === 'waiting_offer' && result.messages.length !== 0))
64
+ refused();
65
+ const messages = [];
66
+ let nextSequence = afterSequence;
67
+ for (const message of result.messages) {
68
+ nextSequence++;
69
+ if (!object(message) || nextSequence > 66 || message.sequence !== nextSequence ||
70
+ !Object.prototype.hasOwnProperty.call(message, 'payload'))
71
+ refused();
72
+ const { kind, payload } = message;
73
+ if (kind !== 'offer' && kind !== 'ice' && kind !== 'endOfCandidates')
74
+ refused();
75
+ if ((nextSequence === 1) !== (kind === 'offer') || (kind === 'ice' && nextSequence > 65) ||
76
+ (kind === 'endOfCandidates' && (payload !== null || messages.length + 1 !== result.messages.length)))
77
+ refused();
78
+ messages.push({ sequence: nextSequence, kind, payload });
79
+ }
80
+ if (result.nextSequence !== nextSequence)
81
+ refused();
82
+ return { version: 1, sessionId, negotiationId: result.negotiationId, status, pollAfterMs, messages, nextSequence };
83
+ },
84
+ async write({ negotiationId, kind, payload, sequence }) {
85
+ if (!uuid.test(negotiationId) || !validSequence(sequence) || sequence === 0 ||
86
+ (sequence === 1 ? kind !== 'answer' : kind !== 'ice' && kind !== 'endOfCandidates') ||
87
+ (kind === 'ice' && sequence > 65) || (kind === 'endOfCandidates' && payload !== null))
88
+ refused();
89
+ const result = await exchange('POST', endpoint, { version: 1, producerInstanceId, negotiationId, sequence, kind, payload });
90
+ if (result.negotiationId !== negotiationId || result.acknowledgedSequence !== sequence ||
91
+ typeof result.idempotent !== 'boolean')
92
+ refused();
93
+ return { acknowledgedSequence: sequence, idempotent: result.idempotent };
94
+ },
95
+ };
96
+ }
97
+ //# sourceMappingURL=LiveViewProducerSignaling.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LiveViewProducerSignaling.js","sourceRoot":"","sources":["../src/LiveViewProducerSignaling.ts"],"names":[],"mappings":";;AAuCA,0EA6EC;AAnHD,+DAAmE;AACnE,qEAAoE;AAyBpE,MAAM,IAAI,GAAG,gEAAgE,CAAC;AAC9E,MAAM,aAAa,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;AAElG,SAAS,OAAO;IACd,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;AACtD,CAAC;AAED,SAAS,MAAM,CAAC,KAAc;IAC5B,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,kFAAkF;AAClF,SAAgB,+BAA+B,CAAC,OAQ/C;IACC,MAAM,EAAE,SAAS,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;IAC7F,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,YAAY,IAAI,YAAY,CAAC,MAAM,GAAG,IAAI;QACxG,CAAC,gBAAgB,CAAC,IAAI,CAAC,YAAY,CAAC;QAAE,OAAO,EAAE,CAAC;IAClD,MAAM,QAAQ,GAAG,IAAA,iDAAwB,EAAC,OAAO,CAAC,UAAU,EAAE,YAAY,GAAG,SAAS,GAAG,UAAU,CAAC,CAAC;IACrG,MAAM,OAAO,GAAG,EAAE,aAAa,EAAE,SAAS,GAAG,YAAY,EAAE,CAAC;IAC5D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AK,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE;YACpD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,QAAQ,KAAK,CAAC;gBACzE,CAAC,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,iBAAiB,CAAC;gBACnF,CAAC,IAAI,KAAK,KAAK,IAAI,QAAQ,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,iBAAiB,IAAI,OAAO,KAAK,IAAI,CAAC;gBAAE,OAAO,EAAE,CAAC;YACnG,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,kBAAkB,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;YAC5H,IAAI,MAAM,CAAC,aAAa,KAAK,aAAa,IAAI,MAAM,CAAC,oBAAoB,KAAK,QAAQ;gBACpF,OAAO,MAAM,CAAC,UAAU,KAAK,SAAS;gBAAE,OAAO,EAAE,CAAC;YACpD,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC;QAC3E,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,26 @@
1
+ import type { LiveViewClockSample } from './CctvLiveViewCoordinator';
2
+ interface RelayServer {
3
+ urls: string[];
4
+ username: string;
5
+ credential: string;
6
+ }
7
+ export interface LiveViewRelayConnection {
8
+ iceTransportPolicy: 'relay';
9
+ iceServers: RelayServer[];
10
+ validUntilMs: number;
11
+ clockGeneration: string;
12
+ }
13
+ interface BootstrapOptions {
14
+ apiBaseUrl: string;
15
+ connectorKey: string;
16
+ sessionId: string;
17
+ producerInstanceId: string;
18
+ clock(): LiveViewClockSample;
19
+ leaseAllowed(): boolean;
20
+ signal: AbortSignal;
21
+ }
22
+ export declare function liveViewProducerEndpoint(apiBaseUrl: string, suffix?: string): URL;
23
+ /** A producer can mint once per intent. Cache refusals as well as success. */
24
+ export declare function createLiveViewRelayBootstrap(options: BootstrapOptions): () => Promise<LiveViewRelayConnection>;
25
+ export {};
26
+ //# sourceMappingURL=LiveViewRelayBootstrap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LiveViewRelayBootstrap.d.ts","sourceRoot":"","sources":["../src/LiveViewRelayBootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAGrE,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,uBAAuB;IACtC,kBAAkB,EAAE,OAAO,CAAC;IAC5B,UAAU,EAAE,WAAW,EAAE,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,UAAU,gBAAgB;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,KAAK,IAAI,mBAAmB,CAAC;IAC7B,YAAY,IAAI,OAAO,CAAC;IACxB,MAAM,EAAE,WAAW,CAAC;CACrB;AAKD,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,SAAK,GAAG,GAAG,CAK7E;AAoDD,8EAA8E;AAC9E,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,OAAO,CAAC,uBAAuB,CAAC,CAa9G"}
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.liveViewProducerEndpoint = liveViewProducerEndpoint;
4
+ exports.createLiveViewRelayBootstrap = createLiveViewRelayBootstrap;
5
+ const LiveViewControlHttp_1 = require("./LiveViewControlHttp");
6
+ const sessionPath = '/v2/earner/cameras/live-view/control';
7
+ const uuid = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;
8
+ function liveViewProducerEndpoint(apiBaseUrl, suffix = '') {
9
+ const url = new URL(apiBaseUrl);
10
+ if (url.username || url.password || url.search || url.hash)
11
+ throw new Error('Invalid live-view API address.');
12
+ url.pathname = url.pathname.replace(/\/+$/, '') + sessionPath + suffix;
13
+ return url;
14
+ }
15
+ function object(value) {
16
+ return value !== null && typeof value === 'object' && !Array.isArray(value);
17
+ }
18
+ function exactKeys(value, fields) {
19
+ return Object.keys(value).length === fields.length && fields.every(field => Object.prototype.hasOwnProperty.call(value, field));
20
+ }
21
+ function invalid() {
22
+ throw new Error('Live-view relay bootstrap was refused.');
23
+ }
24
+ function secret(value) {
25
+ if (typeof value !== 'string' || !value || /[\x00-\x1f\x7f]/.test(value))
26
+ return false;
27
+ const bytes = Buffer.from(value);
28
+ return bytes.length <= 1024 && bytes.toString() === value;
29
+ }
30
+ function relayUrl(value) {
31
+ if (typeof value !== 'string' || value.length > 512)
32
+ return false;
33
+ const parts = /^turns?:([a-z0-9.-]+|\[[0-9a-f:]+\])(?::([0-9]{1,5}))?(?:\?transport=(udp|tcp))?$/i.exec(value);
34
+ return !!parts && (!parts[2] || (Number(parts[2]) > 0 && Number(parts[2]) <= 65535));
35
+ }
36
+ function relayServer(value) {
37
+ if (!object(value) || !exactKeys(value, ['urls', 'username', 'credential']))
38
+ invalid();
39
+ const { urls, username, credential } = value;
40
+ if (!Array.isArray(urls) || !urls.length || urls.length > 4 || !urls.every(relayUrl) ||
41
+ !secret(username) || !secret(credential))
42
+ invalid();
43
+ return { urls: [...urls], username, credential };
44
+ }
45
+ function decode(value, sessionId, started, now) {
46
+ if (!object(value) || value.success !== true || !object(value.connection))
47
+ invalid();
48
+ const connection = value.connection;
49
+ if (!exactKeys(connection, ['version', 'sessionId', 'role', 'iceTransportPolicy', 'iceServers', 'credentialValidForMs', 'reopenAfterMs']) ||
50
+ connection.version !== 1 || connection.sessionId !== sessionId ||
51
+ connection.role !== 'producer' || connection.iceTransportPolicy !== 'relay')
52
+ invalid();
53
+ const { credentialValidForMs, reopenAfterMs, iceServers } = connection;
54
+ if (typeof credentialValidForMs !== 'number' || !Number.isSafeInteger(credentialValidForMs) ||
55
+ typeof reopenAfterMs !== 'number' || !Number.isSafeInteger(reopenAfterMs) || reopenAfterMs <= 0 ||
56
+ reopenAfterMs > credentialValidForMs || credentialValidForMs > 2147483647 ||
57
+ !Array.isArray(iceServers) || !iceServers.length || iceServers.length > 4)
58
+ invalid();
59
+ const validUntilMs = started.elapsedMs + reopenAfterMs;
60
+ if (!now.certain || now.generation !== started.generation ||
61
+ !Number.isFinite(now.elapsedMs) || now.elapsedMs < started.elapsedMs ||
62
+ !Number.isFinite(validUntilMs) || now.elapsedMs >= validUntilMs)
63
+ invalid();
64
+ return { iceTransportPolicy: 'relay', iceServers: iceServers.map(relayServer), validUntilMs, clockGeneration: started.generation };
65
+ }
66
+ /** A producer can mint once per intent. Cache refusals as well as success. */
67
+ function createLiveViewRelayBootstrap(options) {
68
+ if (!uuid.test(options.sessionId) || !uuid.test(options.producerInstanceId) || !secret(options.connectorKey))
69
+ invalid();
70
+ const endpoint = liveViewProducerEndpoint(options.apiBaseUrl, '/sessions/' + options.sessionId + '/connection-bootstrap');
71
+ const post = (0, LiveViewControlHttp_1.createLiveViewJsonPost)(endpoint, options.clock, { authorization: 'Bearer ' + options.connectorKey });
72
+ let attempt;
73
+ return () => attempt ?? (attempt = (async () => {
74
+ if (!options.leaseAllowed() || options.signal.aborted)
75
+ invalid();
76
+ const startedAt = options.clock();
77
+ if (!startedAt.certain || !Number.isFinite(startedAt.elapsedMs) || startedAt.elapsedMs < 0)
78
+ invalid();
79
+ const response = await post({ producerInstanceId: options.producerInstanceId }, { startedAt, signal: options.signal });
80
+ if (!options.leaseAllowed() || options.signal.aborted)
81
+ invalid();
82
+ return decode(response, options.sessionId, startedAt, options.clock());
83
+ })());
84
+ }
85
+ //# sourceMappingURL=LiveViewRelayBootstrap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LiveViewRelayBootstrap.js","sourceRoot":"","sources":["../src/LiveViewRelayBootstrap.ts"],"names":[],"mappings":";;AA6BA,4DAKC;AAqDD,oEAaC;AAnGD,+DAA+D;AAyB/D,MAAM,WAAW,GAAG,sCAAsC,CAAC;AAC3D,MAAM,IAAI,GAAG,gEAAgE,CAAC;AAE9E,SAAgB,wBAAwB,CAAC,UAAkB,EAAE,MAAM,GAAG,EAAE;IACtE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC;IAChC,IAAI,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IAC9G,GAAG,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,WAAW,GAAG,MAAM,CAAC;IACvE,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,MAAM,CAAC,KAAc;IAC5B,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,SAAS,CAAC,KAA8B,EAAE,MAAyB;IAC1E,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,M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AAC,OAAO,KAAP,OAAO,GAAK,CAAC,KAAK,IAAI,EAAE;QACnC,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,OAAO,CAAC,MAAM,CAAC,OAAO;YAAE,OAAO,EAAE,CAAC;QACjE,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;QAClC,IAAI,CAAC,SAAS,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC,SAAS,GAAG,CAAC;YAAE,OAAO,EAAE,CAAC;QACtG,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,EAAE,kBAAkB,EAAE,OAAO,CAAC,kBAAkB,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QACvH,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,OAAO,CAAC,MAAM,CAAC,OAAO;YAAE,OAAO,EAAE,CAAC;QACjE,OAAO,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;IACzE,CAAC,CAAC,EAAE,CAAA,CAAC;AACP,CAAC"}
@@ -0,0 +1,246 @@
1
+ import { EventEmitter } from 'events';
2
+ /**
3
+ * MainStreamRing — one camera's MAIN stream for its local ring: the per-camera
4
+ * knob, the bounded probe, the recorder, and what the status beacon reports.
5
+ *
6
+ * The knob is `sense_camera_settings.ring_stream`, served in the camera's
7
+ * `video` knobs as `ringStream`:
8
+ *
9
+ * sub (or absent) today's behaviour: the feed's substream session records the ring;
10
+ * probe probe the main stream and report it; nothing else changes;
11
+ * main probe, then record the MAIN stream into the camera's ring.
12
+ *
13
+ * THE MAIN URL NEVER LEAVES THE PC. It is derived here from the feed's
14
+ * configured substream URL by the brand rules (`ChannelProber
15
+ * .deriveMainStreamUrl`); a URL no rule steps is `unsupported` and nothing
16
+ * happens. The status beacon carries what was measured, never the URL.
17
+ *
18
+ * THE PROBE (`edge-platform-rtsp` `probeMainStream`): ~5 s of the main stream's
19
+ * packets, copied, under a hard 25-s bound, inside the recorder's single
20
+ * main-stream slot (one main-stream session per recorder host at a time, the
21
+ * recorder's own included). It runs once when the knob first appears (a change
22
+ * from `sub`), then at most daily. A refusal (`nvr_busy`: the recorder's session
23
+ * cap), an auth failure, a timeout or an unsupported URL is REPORTED, never
24
+ * retried in a loop: the next attempt is the next day's, or the knob changing
25
+ * again. The one exception is a probe this connector refused itself because it
26
+ * already holds the recorder's main-stream slot for another camera
27
+ * (`session_limit`): nothing reached the recorder, and the 5-minute knob poll
28
+ * asks again.
29
+ *
30
+ * THE RECORDER: a `MainStreamSession` with a `MainStreamRingOutput` handing each
31
+ * closed segment to the feed's provider (`adoptSegment`), so the ring is the
32
+ * same `<dir>/closed/` the alert-window cut, the uploader and the buffer report
33
+ * already read. While the main stream is RUNNING the feed's own session records
34
+ * nothing (`ringActive`): one ring per camera. Until then, and whenever the
35
+ * recorder is backing off or was shed, the feed records exactly as it does
36
+ * today, so a main stream that fails never costs a camera its ring. While the
37
+ * recorder runs, its own measurements are the probe's (no second pull).
38
+ */
39
+ export type RingStreamKnob = 'sub' | 'probe' | 'main';
40
+ export type MainStreamProbeState =
41
+ /** The knob appeared; the probe has not answered yet. */
42
+ 'pending' | 'ok'
43
+ /** No main URL could be derived from the feed's URL (or this install cannot record a main stream). */
44
+ | 'unsupported'
45
+ /** This connector already holds the recorder's main-stream slot for another camera; asked again at the next poll. */
46
+ | 'session_limit'
47
+ /** The recorder refused the session: its concurrent-session cap (RTSP 453/455). */
48
+ | 'nvr_busy'
49
+ /** The recorder rejected the login, or denied the stream. */
50
+ | 'auth'
51
+ /** No packet within the bound. */
52
+ | 'timeout' | 'unreachable'
53
+ /** The derived main path does not exist on this recorder. */
54
+ | 'bad_path' | 'error';
55
+ export type MainStreamRecordingState =
56
+ /** The knob is not `main`. */
57
+ 'off'
58
+ /** The probe has not passed yet (see the probe state). */
59
+ | 'waiting'
60
+ /** The session is starting; the feed's own ring keeps recording. */
61
+ | 'starting'
62
+ /** Main-stream segments are going into the ring. */
63
+ | 'recording'
64
+ /** The session ended; retrying after a doubling delay. The feed's own ring records meanwhile. */
65
+ | 'backoff'
66
+ /** No room on the recorder for the session right now (or it was shed for a feed). */
67
+ | 'session_limit'
68
+ /** The probe did not pass, or the recorder refused the session: not retried until the next probe. */
69
+ | 'refused'
70
+ /** No main URL, or a main stream the index cannot hold (not H.264 or HEVC). */
71
+ | 'unsupported';
72
+ /** The connector-status beacon's `mainStream` block, per camera. */
73
+ export interface MainStreamReport {
74
+ probeState: MainStreamProbeState;
75
+ /** When the facts below were measured (this PC's clock), ISO-8601. */
76
+ probedAt: string | null;
77
+ width: number | null;
78
+ height: number | null;
79
+ codec: string | null;
80
+ fps: number | null;
81
+ bitrateBps: number | null;
82
+ recording: MainStreamRecordingState;
83
+ }
84
+ /** At most one probe a day per camera, unless the knob appears again. */
85
+ export declare const MAIN_STREAM_PROBE_INTERVAL_MS: number;
86
+ /**
87
+ * After the recorder's own session is refused, the first re-probe waits this
88
+ * long and each failed one doubles it, up to the daily probe. A path that
89
+ * vanished under a recording session (the recorder rebooting, a channel
90
+ * flapping) costs minutes of main-stream footage, not a day; a recorder that
91
+ * keeps refusing is asked about seven times in the first day, then daily —
92
+ * never more than 2 failed logins an hour, under every NVR lock-out threshold.
93
+ */
94
+ export declare const MAIN_STREAM_READMIT_BASE_MS: number;
95
+ /** What this module needs of a probe result (edge-platform-rtsp `MainStreamProbeResult`). */
96
+ interface ProbeResultLike {
97
+ stream: {
98
+ codec: string;
99
+ width: number | null;
100
+ height: number | null;
101
+ fps: number | null;
102
+ } | null;
103
+ packets: number;
104
+ fps: number | null;
105
+ bitrateBps: number | null;
106
+ timedOut: boolean;
107
+ inputOpened: boolean;
108
+ stderr: string;
109
+ }
110
+ interface SessionLike {
111
+ addOutput(output: unknown): void;
112
+ start(): void;
113
+ refresh(): void;
114
+ stop(): Promise<void>;
115
+ getState(): string;
116
+ getStats(): {
117
+ input: {
118
+ codec: string;
119
+ width: number | null;
120
+ height: number | null;
121
+ fps: number | null;
122
+ } | null;
123
+ };
124
+ on(event: string, listener: (...args: any[]) => void): unknown;
125
+ }
126
+ interface RingOutputLike {
127
+ setRecording(config: {
128
+ dir: string;
129
+ segmentSeconds: number;
130
+ label: string | null;
131
+ enabled: boolean;
132
+ codec?: string | null;
133
+ } | null): void;
134
+ getStats(): {
135
+ state: string;
136
+ measuredBytesPerSec: number | null;
137
+ };
138
+ }
139
+ /** The slice of edge-platform-rtsp this module uses, loaded at runtime (an older package has none of it). */
140
+ export interface RtspMainStreamModule {
141
+ MainStreamSession: new (config: {
142
+ rtspUrl: string;
143
+ transport?: 'tcp' | 'udp';
144
+ ffmpegPath?: string;
145
+ onLog?: (level: 'info' | 'warn', message: string) => void;
146
+ }) => SessionLike;
147
+ MainStreamRingOutput: new (options: {
148
+ sink: unknown;
149
+ }) => RingOutputLike;
150
+ probeMainStream(options: {
151
+ rtspUrl: string;
152
+ transport?: 'tcp' | 'udp';
153
+ ffmpegPath?: string;
154
+ }): Promise<ProbeResultLike>;
155
+ acquireMainStreamSlot(streamUrl: string): (() => void) | null;
156
+ }
157
+ /** The ring the recorder fills: the feed's provider (edge-platform-rtsp RTSPStreamCameraProvider). */
158
+ export interface MainStreamRingSinkLike {
159
+ adoptSegment(input: unknown): unknown;
160
+ }
161
+ export interface MainStreamRingOptions {
162
+ /** The feed's video directory: `<dir>/closed/` is the ring. */
163
+ dir: string;
164
+ feedName: string;
165
+ /** The feed's configured (substream) URL. Null: unsupported. */
166
+ rtspUrl: string | null;
167
+ transport?: 'tcp' | 'udp';
168
+ ffmpegPath?: string;
169
+ /** The feed's provider. Without `adoptSegment` (an older package) the camera is unsupported. */
170
+ sink: MainStreamRingSinkLike | null;
171
+ now?: () => number;
172
+ log?: (level: 'info' | 'warn', message: string) => void;
173
+ /** Test seam; default `require('@trillboards/edge-platform-rtsp')`. */
174
+ rtsp?: RtspMainStreamModule | null;
175
+ }
176
+ /** The probe state a failed probe's ffmpeg output names (ChannelProber's own classes). */
177
+ export declare function probeStateFor(result: ProbeResultLike): MainStreamProbeState;
178
+ export declare class MainStreamRing extends EventEmitter {
179
+ private readonly dir;
180
+ private readonly feedName;
181
+ private readonly mainUrl;
182
+ private readonly urlKey;
183
+ private readonly transport;
184
+ private readonly ffmpegPath?;
185
+ private readonly sink;
186
+ private readonly now;
187
+ private readonly log;
188
+ private readonly rtsp;
189
+ private knob;
190
+ private probe;
191
+ /**
192
+ * Failed main-stream attempts since the recorder's own session was refused
193
+ * (0: none). Sets the re-probe gap; back to 0 once the recorder delivers.
194
+ */
195
+ private readmits;
196
+ private probing;
197
+ private session;
198
+ private ring;
199
+ private ringConfig;
200
+ private stopped;
201
+ /** What 'change' last announced: whether the main stream was wanted, and whether it ran. */
202
+ private announced;
203
+ constructor(options: MainStreamRingOptions);
204
+ /** The server's knob, on every answer (and the persisted one at start). Idempotent. */
205
+ setKnob(raw: unknown): void;
206
+ /** The 5-minute knob poll: a probe that came due (daily, or a refused recorder's re-probe), or one this connector refused itself. */
207
+ check(): void;
208
+ /** The main stream should record the ring: the knob says main and the probe passed. */
209
+ wantsRing(): boolean;
210
+ /** The main stream IS recording the ring now: the feed's own session must record nothing. */
211
+ ringActive(): boolean;
212
+ /** What the main stream records while it is wanted (the recorder's per-mode ring config), or null. */
213
+ record(config: {
214
+ dir: string;
215
+ segmentSeconds: number;
216
+ ringSeconds?: number;
217
+ label?: string | null;
218
+ enabled?: boolean;
219
+ } | null): void;
220
+ /** Bytes per second of the main-stream segments closed, or null. */
221
+ bytesPerSecond(): number | null;
222
+ /** The beacon's block: whenever the knob asks for the main stream, or a probe result is held. */
223
+ report(): MainStreamReport | null;
224
+ stop(): Promise<void>;
225
+ /** Daily; after the recorder's session was refused, 15 min doubling per failed attempt, up to daily. */
226
+ private probeIntervalMs;
227
+ private recordingState;
228
+ /** Start, refresh or stop the recorder to match the knob, the probe and the ring config; announce a change. */
229
+ private reconcile;
230
+ /**
231
+ * Tell the recorder when the main stream starts or stops being WANTED (an
232
+ * `off` camera's ring becomes a local buffer of it) and when it starts or
233
+ * stops RUNNING (the ring changes hands).
234
+ */
235
+ private announce;
236
+ private buildSession;
237
+ /** While the recorder holds the main stream, its own measurements are the probe's. */
238
+ private refreshFromRecorder;
239
+ private emptyProbe;
240
+ private runProbe;
241
+ private setProbe;
242
+ private persist;
243
+ private loadState;
244
+ }
245
+ export {};
246
+ //# sourceMappingURL=MainStreamRing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MainStreamRing.d.ts","sourceRoot":"","sources":["../src/MainStreamRing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAOtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,CAAC;AAEtD,MAAM,MAAM,oBAAoB;AAC9B,yDAAyD;AACvD,SAAS,GACT,IAAI;AACN,sGAAsG;GACpG,aAAa;AACf,qHAAqH;GACnH,eAAe;AACjB,mFAAmF;GACjF,UAAU;AACZ,6DAA6D;GAC3D,MAAM;AACR,kCAAkC;GAChC,SAAS,GACT,aAAa;AACf,6DAA6D;GAC3D,UAAU,GACV,OAAO,CAAC;AAEZ,MAAM,MAAM,wBAAwB;AAClC,8BAA8B;AAC5B,KAAK;AACP,0DAA0D;GACxD,SAAS;AACX,oEAAoE;GAClE,UAAU;AACZ,oDAAoD;GAClD,WAAW;AACb,iGAAiG;GAC/F,SAAS;AACX,qFAAqF;GACnF,eAAe;AACjB,qGAAqG;GACnG,SAAS;AACX,+EAA+E;GAC7E,aAAa,CAAC;AAElB,oEAAoE;AACpE,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,oBAAoB,CAAC;IACjC,sEAAsE;IACtE,QAAQ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