homebridge 2.0.0-alpha.43 → 2.0.0-alpha.45
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/api.d.ts +37 -7
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +30 -4
- package/dist/api.js.map +1 -1
- package/dist/bridgeService.d.ts +5 -16
- package/dist/bridgeService.d.ts.map +1 -1
- package/dist/bridgeService.js +8 -24
- package/dist/bridgeService.js.map +1 -1
- package/dist/childBridgeFork.d.ts +3 -15
- package/dist/childBridgeFork.d.ts.map +1 -1
- package/dist/childBridgeFork.js +46 -181
- package/dist/childBridgeFork.js.map +1 -1
- package/dist/childBridgeService.d.ts +20 -43
- package/dist/childBridgeService.d.ts.map +1 -1
- package/dist/childBridgeService.js +23 -66
- package/dist/childBridgeService.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +1 -3
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/ipcService.d.ts +23 -21
- package/dist/ipcService.d.ts.map +1 -1
- package/dist/ipcService.js +0 -15
- package/dist/ipcService.js.map +1 -1
- package/dist/matter/index.d.ts +1 -1
- package/dist/matter/index.d.ts.map +1 -1
- package/dist/matter/index.js.map +1 -1
- package/dist/matter/matterAccessoryCache.d.ts +73 -0
- package/dist/matter/matterAccessoryCache.d.ts.map +1 -0
- package/dist/matter/matterAccessoryCache.js +168 -0
- package/dist/matter/matterAccessoryCache.js.map +1 -0
- package/dist/matter/matterBehaviors.d.ts +123 -0
- package/dist/matter/matterBehaviors.d.ts.map +1 -0
- package/dist/matter/matterBehaviors.js +582 -0
- package/dist/matter/matterBehaviors.js.map +1 -0
- package/dist/matter/matterConfigValidator.d.ts +0 -1
- package/dist/matter/matterConfigValidator.d.ts.map +1 -1
- package/dist/matter/matterConfigValidator.js +15 -45
- package/dist/matter/matterConfigValidator.js.map +1 -1
- package/dist/matter/matterErrorHandler.d.ts +1 -1
- package/dist/matter/matterErrorHandler.d.ts.map +1 -1
- package/dist/matter/matterErrorHandler.js +35 -22
- package/dist/matter/matterErrorHandler.js.map +1 -1
- package/dist/matter/matterNetworkMonitor.d.ts +3 -0
- package/dist/matter/matterNetworkMonitor.d.ts.map +1 -1
- package/dist/matter/matterNetworkMonitor.js +49 -26
- package/dist/matter/matterNetworkMonitor.js.map +1 -1
- package/dist/matter/matterServer.d.ts +79 -9
- package/dist/matter/matterServer.d.ts.map +1 -1
- package/dist/matter/matterServer.js +491 -111
- package/dist/matter/matterServer.js.map +1 -1
- package/dist/matter/matterSharedTypes.d.ts +36 -16
- package/dist/matter/matterSharedTypes.d.ts.map +1 -1
- package/dist/matter/matterSharedTypes.js +0 -3
- package/dist/matter/matterSharedTypes.js.map +1 -1
- package/dist/matter/matterStorage.d.ts +11 -1
- package/dist/matter/matterStorage.d.ts.map +1 -1
- package/dist/matter/matterStorage.js +12 -2
- package/dist/matter/matterStorage.js.map +1 -1
- package/dist/matter/matterTypes.d.ts +69 -20
- package/dist/matter/matterTypes.d.ts.map +1 -1
- package/dist/matter/matterTypes.js.map +1 -1
- package/dist/matter/matterValidation.d.ts +57 -0
- package/dist/matter/matterValidation.d.ts.map +1 -0
- package/dist/matter/matterValidation.js +97 -0
- package/dist/matter/matterValidation.js.map +1 -0
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +2 -4
- package/dist/plugin.js.map +1 -1
- package/dist/server.d.ts +0 -12
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +97 -280
- package/dist/server.js.map +1 -1
- package/package.json +3 -3
- package/dist/bridgeTypes.d.ts +0 -54
- package/dist/bridgeTypes.d.ts.map +0 -1
- package/dist/bridgeTypes.js +0 -8
- package/dist/bridgeTypes.js.map +0 -1
- package/dist/matter/matterDiagnostics.d.ts +0 -121
- package/dist/matter/matterDiagnostics.d.ts.map +0 -1
- package/dist/matter/matterDiagnostics.js +0 -323
- package/dist/matter/matterDiagnostics.js.map +0 -1
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Matter Accessory Cache
|
|
3
|
+
*
|
|
4
|
+
* Handles persistence of Matter accessories across Homebridge restarts.
|
|
5
|
+
* Similar to HAP's cached accessories, but designed for Matter's simpler API.
|
|
6
|
+
*/
|
|
7
|
+
import * as path from 'node:path';
|
|
8
|
+
import fs from 'fs-extra';
|
|
9
|
+
import { Logger } from '../logger.js';
|
|
10
|
+
const log = Logger.withPrefix('Matter');
|
|
11
|
+
/**
|
|
12
|
+
* Matter Accessory Cache Manager
|
|
13
|
+
*/
|
|
14
|
+
export class MatterAccessoryCache {
|
|
15
|
+
cacheFilePath;
|
|
16
|
+
cachedAccessories = new Map();
|
|
17
|
+
cacheLoaded = false;
|
|
18
|
+
saveInProgress = null;
|
|
19
|
+
constructor(storagePath, bridgeId) {
|
|
20
|
+
this.cacheFilePath = path.join(storagePath, bridgeId, 'accessories.json');
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Load cached accessories from disk
|
|
24
|
+
*/
|
|
25
|
+
async load() {
|
|
26
|
+
if (this.cacheLoaded) {
|
|
27
|
+
return this.cachedAccessories;
|
|
28
|
+
}
|
|
29
|
+
try {
|
|
30
|
+
// Ensure cache file exists
|
|
31
|
+
if (!await fs.pathExists(this.cacheFilePath)) {
|
|
32
|
+
log.info('No cached Matter accessories found (first run)');
|
|
33
|
+
this.cacheLoaded = true;
|
|
34
|
+
return this.cachedAccessories;
|
|
35
|
+
}
|
|
36
|
+
// Read and parse cache file
|
|
37
|
+
const cacheData = await fs.readJson(this.cacheFilePath);
|
|
38
|
+
if (!Array.isArray(cacheData)) {
|
|
39
|
+
log.warn('Invalid Matter accessory cache format, deleting corrupted file');
|
|
40
|
+
await fs.remove(this.cacheFilePath);
|
|
41
|
+
this.cacheLoaded = true;
|
|
42
|
+
return this.cachedAccessories;
|
|
43
|
+
}
|
|
44
|
+
// Load accessories into map
|
|
45
|
+
for (const serialized of cacheData) {
|
|
46
|
+
if (serialized.uuid) {
|
|
47
|
+
this.cachedAccessories.set(serialized.uuid, serialized);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
log.info(`Loaded ${this.cachedAccessories.size} cached Matter accessories`);
|
|
51
|
+
this.cacheLoaded = true;
|
|
52
|
+
return this.cachedAccessories;
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
// If JSON parsing failed (corrupted file), delete it and start fresh
|
|
56
|
+
log.error(`Failed to load Matter accessory cache: ${this.cacheFilePath}: ${error.message}`);
|
|
57
|
+
log.warn('Deleting corrupted cache file and starting fresh');
|
|
58
|
+
try {
|
|
59
|
+
await fs.remove(this.cacheFilePath);
|
|
60
|
+
}
|
|
61
|
+
catch (removeError) {
|
|
62
|
+
log.debug('Could not delete corrupted cache file:', removeError);
|
|
63
|
+
}
|
|
64
|
+
this.cacheLoaded = true;
|
|
65
|
+
return this.cachedAccessories;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Save accessories to cache (serialized to prevent concurrent write conflicts)
|
|
70
|
+
*/
|
|
71
|
+
async save(accessories) {
|
|
72
|
+
// Wait for any in-progress save to complete
|
|
73
|
+
if (this.saveInProgress) {
|
|
74
|
+
await this.saveInProgress;
|
|
75
|
+
}
|
|
76
|
+
// Start new save operation
|
|
77
|
+
this.saveInProgress = this.performSave(accessories);
|
|
78
|
+
try {
|
|
79
|
+
await this.saveInProgress;
|
|
80
|
+
}
|
|
81
|
+
finally {
|
|
82
|
+
this.saveInProgress = null;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Internal save implementation
|
|
87
|
+
*/
|
|
88
|
+
async performSave(accessories) {
|
|
89
|
+
const tempFilePath = `${this.cacheFilePath}.tmp`;
|
|
90
|
+
try {
|
|
91
|
+
// Serialize accessories (strip out functions)
|
|
92
|
+
const serialized = [];
|
|
93
|
+
for (const accessory of accessories.values()) {
|
|
94
|
+
serialized.push(this.serializeAccessory(accessory));
|
|
95
|
+
}
|
|
96
|
+
// Ensure directory exists
|
|
97
|
+
const directory = path.dirname(this.cacheFilePath);
|
|
98
|
+
await fs.ensureDir(directory);
|
|
99
|
+
// Write to temporary file first (atomic write pattern to prevent corruption)
|
|
100
|
+
await fs.writeJson(tempFilePath, serialized, { spaces: 2 });
|
|
101
|
+
// Atomically rename temp file to final location
|
|
102
|
+
// Use rename for true atomic operation on the same filesystem
|
|
103
|
+
await fs.rename(tempFilePath, this.cacheFilePath);
|
|
104
|
+
log.debug(`Saved ${serialized.length} Matter accessories to cache`);
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
log.error(`Failed to save Matter accessory cache: ${error.message}`);
|
|
108
|
+
// Clean up temp file if it exists
|
|
109
|
+
try {
|
|
110
|
+
if (await fs.pathExists(tempFilePath)) {
|
|
111
|
+
await fs.remove(tempFilePath);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
catch (cleanupError) {
|
|
115
|
+
log.debug('Could not clean up temporary cache file:', cleanupError);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Get cached accessory by UUID
|
|
121
|
+
*/
|
|
122
|
+
getCached(uuid) {
|
|
123
|
+
return this.cachedAccessories.get(uuid);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Check if an accessory is cached
|
|
127
|
+
*/
|
|
128
|
+
hasCached(uuid) {
|
|
129
|
+
return this.cachedAccessories.has(uuid);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Remove an accessory from cache
|
|
133
|
+
*/
|
|
134
|
+
removeCached(uuid) {
|
|
135
|
+
this.cachedAccessories.delete(uuid);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Get all cached accessories
|
|
139
|
+
*/
|
|
140
|
+
getAllCached() {
|
|
141
|
+
return new Map(this.cachedAccessories);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Serialize a Matter accessory for storage
|
|
145
|
+
*/
|
|
146
|
+
serializeAccessory(accessory) {
|
|
147
|
+
// Extract device type information
|
|
148
|
+
const deviceType = accessory.deviceType;
|
|
149
|
+
const deviceTypeInfo = {
|
|
150
|
+
name: deviceType?.name,
|
|
151
|
+
code: deviceType?.code,
|
|
152
|
+
};
|
|
153
|
+
return {
|
|
154
|
+
uuid: accessory.uuid,
|
|
155
|
+
displayName: accessory.displayName,
|
|
156
|
+
deviceType: deviceTypeInfo,
|
|
157
|
+
serialNumber: accessory.serialNumber,
|
|
158
|
+
manufacturer: accessory.manufacturer,
|
|
159
|
+
model: accessory.model,
|
|
160
|
+
firmwareRevision: accessory.firmwareRevision,
|
|
161
|
+
hardwareRevision: accessory.hardwareRevision,
|
|
162
|
+
softwareVersion: accessory.softwareVersion,
|
|
163
|
+
context: accessory.context,
|
|
164
|
+
clusters: structuredClone(accessory.clusters),
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=matterAccessoryCache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"matterAccessoryCache.js","sourceRoot":"","sources":["../../src/matter/matterAccessoryCache.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAEjC,OAAO,EAAE,MAAM,UAAU,CAAA;AAEzB,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAErC,MAAM,GAAG,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAA;AA0BvC;;GAEG;AACH,MAAM,OAAO,oBAAoB;IACd,aAAa,CAAQ;IAC9B,iBAAiB,GAA2C,IAAI,GAAG,EAAE,CAAA;IACrE,WAAW,GAAG,KAAK,CAAA;IACnB,cAAc,GAAyB,IAAI,CAAA;IAEnD,YAAY,WAAmB,EA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BAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IACrC,CAAC;IAED;;OAEG;IACH,YAAY;QACV,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;IACxC,CAAC;IAED;;OAEG;IACK,kBAAkB,CAAC,SAA0B;QACnD,kCAAkC;QAClC,MAAM,UAAU,GAAQ,SAAS,CAAC,UAAU,CAAA;QAC5C,MAAM,cAAc,GAAG;YACrB,IAAI,EAAE,UAAU,EAAE,IAAI;YACtB,IAAI,EAAE,UAAU,EAAE,IAAI;SACvB,CAAA;QAED,OAAO;YACL,IAAI,EAAE,SAAS,CAAC,IAAI;YACpB,WAAW,EAAE,SAAS,CAAC,WAAW;YAClC,UAAU,EAAE,cAAc;YAC1B,YAAY,EAAE,SAAS,CAAC,YAAY;YACpC,YAAY,EAAE,SAAS,CAAC,YAAY;YACpC,KAAK,EAAE,SAAS,CAAC,KAAK;YACtB,gBAAgB,EAAE,SAAS,CAAC,gBAAgB;YAC5C,gBAAgB,EAAE,SAAS,CAAC,gBAAgB;YAC5C,eAAe,EAAE,SAAS,CAAC,eAAe;YAC1C,OAAO,EAAE,SAAS,CAAC,OAAO;YAC1B,QAAQ,EAAE,eAAe,CAAC,SAAS,CAAC,QAAQ,CAAC;SAC9C,CAAA;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom Matter Behavior Classes for Homebridge
|
|
3
|
+
*
|
|
4
|
+
* These custom behaviors extend the base Matter.js behaviors and override
|
|
5
|
+
* command methods to allow plugins to inject custom handlers.
|
|
6
|
+
*
|
|
7
|
+
* Note: Only clusters with user-triggered commands need custom behaviors.
|
|
8
|
+
* Read-only clusters (like sensors) don't need custom behaviors since
|
|
9
|
+
* they only report state, they don't receive commands.
|
|
10
|
+
*/
|
|
11
|
+
import type { MatterCommandHandler } from './matterTypes.js';
|
|
12
|
+
import { ColorControlServer, DoorLockServer, IdentifyServer, LevelControlServer, OnOffServer, ThermostatServer, WindowCoveringServer } from '@matter/main/behaviors';
|
|
13
|
+
/**
|
|
14
|
+
* Set the accessories map reference for cache syncing
|
|
15
|
+
*/
|
|
16
|
+
export declare function setAccessoriesMap(map: Map<string, any>): void;
|
|
17
|
+
/**
|
|
18
|
+
* Register a handler for a specific endpoint/cluster/command
|
|
19
|
+
*
|
|
20
|
+
* @param endpointId - Unique endpoint identifier (typically the accessory UUID)
|
|
21
|
+
* @param clusterName - Name of the Matter cluster (e.g., 'onOff', 'levelControl')
|
|
22
|
+
* @param commandName - Name of the command method (e.g., 'on', 'off', 'moveToLevel')
|
|
23
|
+
* @param handler - Callback function to execute when the command is received
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* registerHandler('my-light-uuid', 'onOff', 'on', async () => {
|
|
28
|
+
* console.log('Light turned on!')
|
|
29
|
+
* })
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function registerHandler(endpointId: string, clusterName: string, commandName: string, handler: MatterCommandHandler): void;
|
|
33
|
+
/**
|
|
34
|
+
* Custom OnOff Server that calls plugin handlers
|
|
35
|
+
*/
|
|
36
|
+
export declare class HomebridgeOnOffServer extends OnOffServer {
|
|
37
|
+
on(): any;
|
|
38
|
+
off(): any;
|
|
39
|
+
toggle(): any;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Custom LevelControl Server that calls plugin handlers
|
|
43
|
+
*/
|
|
44
|
+
export declare class HomebridgeLevelControlServer extends LevelControlServer {
|
|
45
|
+
moveToLevel(request: any): any;
|
|
46
|
+
move(request: any): any;
|
|
47
|
+
step(request: any): any;
|
|
48
|
+
stop(request: any): any;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Custom WindowCovering Server that calls plugin handlers
|
|
52
|
+
*/
|
|
53
|
+
export declare class HomebridgeWindowCoveringServer extends WindowCoveringServer {
|
|
54
|
+
upOrOpen(): any;
|
|
55
|
+
downOrClose(): any;
|
|
56
|
+
stopMotion(): any;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Custom DoorLock Server that calls plugin handlers
|
|
60
|
+
*/
|
|
61
|
+
export declare class HomebridgeDoorLockServer extends DoorLockServer {
|
|
62
|
+
lockDoor(): any;
|
|
63
|
+
unlockDoor(): any;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Custom Thermostat Server that calls plugin handlers
|
|
67
|
+
*/
|
|
68
|
+
export declare class HomebridgeThermostatServer extends ThermostatServer {
|
|
69
|
+
setpointRaiseLower(request: any): any;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Custom Identify Server that calls plugin handlers
|
|
73
|
+
*/
|
|
74
|
+
export declare class HomebridgeIdentifyServer extends IdentifyServer {
|
|
75
|
+
identify(request: any): any;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Custom ColorControl Server that calls plugin handlers
|
|
79
|
+
*
|
|
80
|
+
* ColorControl handles color changes for lights (hue, saturation, XY color, color temperature).
|
|
81
|
+
* Plugin developers can override these *Logic methods to handle color changes in their hardware.
|
|
82
|
+
*/
|
|
83
|
+
export declare class HomebridgeColorControlServer extends ColorControlServer {
|
|
84
|
+
/**
|
|
85
|
+
* Called when color temperature is changed
|
|
86
|
+
* @param targetMireds - Target color temperature in mireds (micro reciprocal degrees)
|
|
87
|
+
* @param transitionTime - Transition time in seconds (0 = as fast as possible)
|
|
88
|
+
*/
|
|
89
|
+
moveToColorTemperatureLogic(targetMireds: number, transitionTime: number): any;
|
|
90
|
+
/**
|
|
91
|
+
* Called when hue and saturation are changed together
|
|
92
|
+
* @param targetHue - Target hue value (0-254 for normal hue, 0-65535 for enhanced hue)
|
|
93
|
+
* @param targetSaturation - Target saturation value (0-254)
|
|
94
|
+
* @param transitionTime - Transition time in seconds (0 = as fast as possible)
|
|
95
|
+
*/
|
|
96
|
+
moveToHueAndSaturationLogic(targetHue: number, targetSaturation: number, transitionTime: number): any;
|
|
97
|
+
/**
|
|
98
|
+
* Called when XY color coordinates are changed
|
|
99
|
+
* @param targetX - Target X value (0-65535 representing 0.0-1.0 in CIE color space)
|
|
100
|
+
* @param targetY - Target Y value (0-65535 representing 0.0-1.0 in CIE color space)
|
|
101
|
+
* @param transitionTime - Transition time in seconds (0 = as fast as possible)
|
|
102
|
+
*/
|
|
103
|
+
moveToColorLogic(targetX: number, targetY: number, transitionTime: number): any;
|
|
104
|
+
/**
|
|
105
|
+
* Called when hue is changed individually
|
|
106
|
+
* @param targetHue - Target hue value
|
|
107
|
+
* @param direction - Direction to move (shortest, longest, up, down)
|
|
108
|
+
* @param transitionTime - Transition time in seconds
|
|
109
|
+
* @param isEnhancedHue - Whether this is enhanced hue (16-bit) or normal hue (8-bit)
|
|
110
|
+
*/
|
|
111
|
+
moveToHueLogic(targetHue: number, direction: any, transitionTime: number, isEnhancedHue?: boolean): any;
|
|
112
|
+
/**
|
|
113
|
+
* Called when saturation is changed individually
|
|
114
|
+
* @param targetSaturation - Target saturation value (0-254)
|
|
115
|
+
* @param transitionTime - Transition time in seconds
|
|
116
|
+
*/
|
|
117
|
+
moveToSaturationLogic(targetSaturation: number, transitionTime: number): any;
|
|
118
|
+
/**
|
|
119
|
+
* Called when all color movement should be stopped
|
|
120
|
+
*/
|
|
121
|
+
stopAllColorMovement(): any;
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=matterBehaviors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"matterBehaviors.d.ts","sourceRoot":"","sources":["../../src/matter/matterBehaviors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAE5D,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,WAAW,EACX,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,wBAAwB,CAAA;AAkB/B;;G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