homebridge-unifi-protect 4.4.2 → 5.0.1

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 (47) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +8 -12
  3. package/config.schema.json +30 -9
  4. package/dist/index.js +1 -1
  5. package/dist/protect-accessory.js +145 -2
  6. package/dist/protect-accessory.js.map +1 -1
  7. package/dist/protect-camera.js +56 -162
  8. package/dist/protect-camera.js.map +1 -1
  9. package/dist/protect-doorbell.js +14 -26
  10. package/dist/protect-doorbell.js.map +1 -1
  11. package/dist/protect-ffmpeg.js +24 -5
  12. package/dist/protect-ffmpeg.js.map +1 -1
  13. package/dist/protect-light.js +111 -0
  14. package/dist/protect-light.js.map +1 -0
  15. package/dist/protect-liveviews.js +2 -2
  16. package/dist/protect-liveviews.js.map +1 -1
  17. package/dist/protect-mqtt.js +47 -19
  18. package/dist/protect-mqtt.js.map +1 -1
  19. package/dist/protect-nvr-events.js +205 -61
  20. package/dist/protect-nvr-events.js.map +1 -1
  21. package/dist/protect-nvr-systeminfo.js +174 -0
  22. package/dist/protect-nvr-systeminfo.js.map +1 -0
  23. package/dist/protect-nvr.js +167 -61
  24. package/dist/protect-nvr.js.map +1 -1
  25. package/dist/protect-options.js +7 -0
  26. package/dist/protect-options.js.map +1 -0
  27. package/dist/protect-platform.js +9 -3
  28. package/dist/protect-platform.js.map +1 -1
  29. package/dist/protect-rtp.js +1 -1
  30. package/dist/protect-rtp.js.map +1 -1
  31. package/dist/protect-securitysystem.js +3 -4
  32. package/dist/protect-securitysystem.js.map +1 -1
  33. package/dist/protect-sensor.js +357 -0
  34. package/dist/protect-sensor.js.map +1 -0
  35. package/dist/protect-stream.js +76 -23
  36. package/dist/protect-stream.js.map +1 -1
  37. package/dist/protect-viewer.js +170 -0
  38. package/dist/protect-viewer.js.map +1 -0
  39. package/dist/settings.js +6 -2
  40. package/dist/settings.js.map +1 -1
  41. package/package.json +15 -17
  42. package/dist/protect-api-updates.js +0 -166
  43. package/dist/protect-api-updates.js.map +0 -1
  44. package/dist/protect-api.js +0 -555
  45. package/dist/protect-api.js.map +0 -1
  46. package/dist/protect-types.js +0 -3
  47. package/dist/protect-types.js.map +0 -1
package/LICENSE.md CHANGED
@@ -1,7 +1,7 @@
1
1
  Internet Systems Consortium License
2
2
  ===================================
3
3
 
4
- Copyright (c) `2017-2021`, `HJD https://github.com/hjdhjd`
4
+ Copyright (c) `2017-2022`, `HJD https://github.com/hjdhjd`
5
5
 
6
6
  Permission to use, copy, modify, and/or distribute this software for any purpose
7
7
  with or without fee is hereby granted, provided that the above copyright notice
package/README.md CHANGED
@@ -13,23 +13,25 @@
13
13
  </DIV>
14
14
  </SPAN>
15
15
 
16
- `homebridge-unifi-protect` is a [Homebridge](https://homebridge.io) plugin that provides HomeKit support to the [UniFi Protect](https://unifi-network.ui.com/video-security) device ecosystem. [UniFi Protect](https://unifi-network.ui.com/video-security) is [Ubiquiti's](https://www.ui.com) next-generation video security platform, with rich camera, doorbell, and NVR controller hardware options for you to choose from, as well as an app which you can use to view, configure and manage your video camera and doorbells.
16
+ `homebridge-unifi-protect` is a [Homebridge](https://homebridge.io) plugin that provides HomeKit support to the [UniFi Protect](https://ui.com/camera-security) device ecosystem. [UniFi Protect](https://ui.com/camera-security) is [Ubiquiti's](https://www.ui.com) next-generation video security platform, with rich camera, doorbell, and NVR controller hardware options for you to choose from, as well as an app which you can use to view, configure and manage your video camera and doorbells.
17
17
 
18
18
  ## <A NAME="why"></A>Why Use This Plugin For UniFi Protect Support In HomeKit?
19
19
  This plugin attempts to bridge a gap in the UniFi Protect ecosystem by providing native HomeKit support on par with what you would expect from a first-party of native HomeKit solution. My north star is to create a plugin that *just works* with minimal required configuration by you to get up and running. The goal is to provide as close to a streamlined experience as you would expect from a first-party or native HomeKit solution. For the adventurous, there are more granular options available to enable you to further tailor your experience.
20
20
 
21
21
  What does *just works* mean in practice? It means that this plugin will discover all your supported UniFi Protect devices and make them available in HomeKit. It supports all known UniFi Protect controller configurations (UniFi CloudKey Gen2+, UniFi Dream Machine Pro, and UniFi Protect NVR).
22
22
 
23
- For the more technically inclined - this plugin has continued to pioneer the HomeKit user experience for UniFi Protect by being the ***first*** Homebridge plugin (and first third-party app, to my knowledge) to successfully reverse engineer the UniFi Protect realtime events API that was introduced with UniFi OS. This means that rather than poll the Protect controller every few seconds to catch events, we're able to capture motion and doorbell ring events in realtime, providing an immediate and extremely responsive HomeKit experience, further reducing the potential performance impact to Protect controllers.
23
+ For the more technically inclined - this plugin has continued to pioneer the HomeKit user experience for UniFi Protect by being the ***first*** Homebridge plugin (and first third-party app, to my knowledge) to successfully reverse engineer the UniFi Protect realtime events API that was introduced with UniFi OS. This means that rather than poll the Protect controller every few seconds to catch events, we're able to capture motion and doorbell ring events in realtime, providing an immediate and extremely responsive HomeKit experience, further reducing the potential performance impact to Protect controllers. Since reverse engineering the realtime events API, most of the major open source smart automation projects have benefitted and also incorporated that work.
24
24
 
25
25
  ### Features
26
26
  - ***Easy* configuration - all you need is your UniFi Protect controller IP address, username, and password to get started.** The defaults work for the vast majority of users. When you want more, there are [advanced options](https://github.com/hjdhjd/homebridge-unifi-protect/blob/master/docs/AdvancedOptions.md) you can play with, if you choose.
27
27
 
28
- - **Blazing fast video streaming.** Video streaming from HomeKit will start within in 1-2 seconds for G3-series cameras and 3-4 seconds for G4-series cameras, in most cases. I've spent the time to optimize the video streaming experience to ensure it feels very responsive, and *just works*.
28
+ - **Full HomeKit upport for the UniFi Protect ecosystem.** All generally available UniFi Protect devices are supported, including cameras, doorbells, lights, sensors, and ViewPorts.
29
29
 
30
- - **[Full UniFi Protect G4 Doorbell support.](https://github.com/hjdhjd/homebridge-unifi-protect/blob/master/docs/Doorbell.md).** This plugin provides complete support for [UniFi Protect G4 Doorbells](https://store.ui.com/collections/unifi-protect/products/uvc-g4-doorbell). We support all the features of the doorbell including - doorbell rings, two-way audio, and the use of the onboard LCD screen for messages. Two-way audio has caveats you should be aware of.
30
+ - **Blazing fast video streaming.** Video streaming from HomeKit will start within in 1-2 seconds for cameras, in most cases. I've spent the time to optimize the video streaming experience to ensure it feels very responsive, and *just works*.
31
31
 
32
- - **[Two-way audio support](https://github.com/hjdhjd/homebridge-unifi-protect/blob/master/docs/Doorbell.md#doorbell-twoway) for all UniFi Protect cameras that support it**. Some Protect devices that support two-way audio capabilities include [UniFi Protect G4 Doorbells](https://store.ui.com/collections/unifi-protect/products/uvc-g4-doorbell), the [UniFi Protect G3 Micro](https://store.ui.com/collections/unifi-protect/products/unifi-video-g3-micro), and more. If the Protect device supports two-way audio, that functionality is available to you in HomeKit.
32
+ - **[Full UniFi Protect Doorbell support.](https://github.com/hjdhjd/homebridge-unifi-protect/blob/master/docs/Doorbell.md).** This plugin provides complete support for [UniFi Protect Doorbells](https://store.ui.com/collections/unifi-protect/products/uvc-g4-doorbell). We support all the features of the doorbell including - doorbell rings, two-way audio, and the use of the onboard LCD screen for messages. Two-way audio has caveats you should be aware of.
33
+
34
+ - **[Two-way audio support](https://github.com/hjdhjd/homebridge-unifi-protect/blob/master/docs/Doorbell.md#doorbell-twoway) for all UniFi Protect cameras that support it**. Some Protect devices that support two-way audio capabilities include [UniFi Protect Doorbells](https://store.ui.com/collections/unifi-protect/products/uvc-g4-doorbell), the [UniFi Protect Instant Cameras](https://store.ui.com/collections/unifi-protect/products/unifi-video-g3-micro), and more. If the Protect device supports two-way audio, that functionality is available to you in HomeKit.
33
35
 
34
36
  - **Support for multiple controllers.** This plugin can support multiple UniFi Protect controllers. If you have more than one controller, it's easy to add them to this plugin, and integrate them seamlessly into HomeKit.
35
37
 
@@ -72,13 +74,7 @@ If you are new to Homebridge, please first read the [Homebridge](https://homebri
72
74
 
73
75
  If you have installed the [Homebridge Config UI](https://github.com/oznu/homebridge-config-ui-x), you can intall this plugin by going to the `Plugins` tab and searching for `homebridge-unifi-protect` and installing it.
74
76
 
75
- If you prefer to install `homebridge-unifi-protect` from the command line, you can do so by executing:
76
-
77
- ```sh
78
- sudo npm install --unsafe-perm -g homebridge-unifi-protect
79
- ```
80
-
81
- You will need a working **ffmpeg** installation for `homebridge-unifi-protect` to work correctly. To make installation more convenient, this plugin uses [ffmpeg-for-homebridge](https://www.npmjs.com/package/ffmpeg-for-homebridge) which provides prebuilt versions of ffmpeg for some of the more popular platforms. [Click here](https://github.com/homebridge/ffmpeg-for-homebridge#supported-platforms) for a list of platforms supported by `ffmpeg-for-homebridge`. If you don't find your platform listed, you'll need to install a working version of ffmpeg for yourself, if you want video streaming to work. **Setting up and configuring ffmpeg is beyond the scope of this documentation.**
77
+ **Important:** you will need a working **ffmpeg** installation for `homebridge-unifi-protect` to work correctly. To make installation more convenient, this plugin uses [ffmpeg-for-homebridge](https://www.npmjs.com/package/ffmpeg-for-homebridge) which provides prebuilt versions of ffmpeg for some of the more popular platforms. [Click here](https://github.com/homebridge/ffmpeg-for-homebridge#supported-platforms) for a list of platforms supported by `ffmpeg-for-homebridge`. If you don't find your platform listed, you'll need to install a working version of ffmpeg for yourself, if you want video streaming to work. **Setting up and configuring ffmpeg is beyond the scope of this documentation.**
82
78
 
83
79
  ### Audio
84
80
  Audio on cameras is tricky in the HomeKit world to begin with, and when you throw in some of the specifics of how UniFi Protect works, it gets even more interesting. Some things to keep in mind if you want to use audio with UniFi Protect:
@@ -125,14 +125,6 @@
125
125
  }
126
126
  },
127
127
 
128
- "videoProcessor": {
129
- "type": "string",
130
- "title": "Video Processor",
131
- "required": false,
132
- "placeholder": "e.g. ffmpeg",
133
- "description": "Location of ffmpeg or your preferred video processor. Default: builtin or in your local path."
134
- },
135
-
136
128
  "motionDuration": {
137
129
  "type": "integer",
138
130
  "title": "Motion Event Duration (seconds)",
@@ -143,12 +135,39 @@
143
135
  "description": "Duration of a single motion event. Setting this too low will potentially cause a lot of excess notifications. Default: 10."
144
136
  },
145
137
 
138
+ "ringDuration": {
139
+ "type": "integer",
140
+ "title": "Ring Event Duration (seconds)",
141
+ "required": false,
142
+ "minimum": 4,
143
+ "maximum": 10,
144
+ "placeholder": "e.g. 4",
145
+ "description": "Duration of a single ring event. Default: 4."
146
+ },
147
+
146
148
  "verboseFfmpeg": {
147
149
  "type": "boolean",
148
150
  "title": "Verbose FFmpeg Logging",
149
151
  "required": false,
150
152
  "description": "Enable additional logging for FFmpeg. This will create a lot of logging when video streams are running. Default: false."
153
+ },
154
+
155
+ "videoProcessor": {
156
+ "type": "string",
157
+ "title": "Video Processor",
158
+ "required": false,
159
+ "placeholder": "e.g. ffmpeg",
160
+ "description": "Location of ffmpeg or your preferred video processor. Default: builtin or in your local path."
161
+ },
162
+
163
+ "videoEncoder": {
164
+ "type": "string",
165
+ "title": "Video Encoder",
166
+ "required": false,
167
+ "placeholder": "e.g. h264_omx",
168
+ "description": "FFmpeg video encoder to use for transcoding. Useful for hardware-accelerated video encoding such as on a Raspberry Pi. Default: libx264."
151
169
  }
170
+
152
171
  }
153
172
  },
154
173
 
@@ -260,8 +279,10 @@
260
279
  "description": "These settings should be rarely used or needed by most people. Use these with caution.",
261
280
  "items": [
262
281
  "videoProcessor",
282
+ "videoEncoder",
283
+ "verboseFfmpeg",
263
284
  "motionDuration",
264
- "verboseFfmpeg"
285
+ "ringDuration"
265
286
  ]
266
287
  }
267
288
  ]
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- /* Copyright(C) 2017-2021, HJD (https://github.com/hjdhjd). All rights reserved.
2
+ /* Copyright(C) 2017-2022, HJD (https://github.com/hjdhjd). All rights reserved.
3
3
  *
4
4
  * index.ts: homebridge-unifi-protect plugin registration.
5
5
  */
@@ -1,6 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ProtectAccessory = exports.ProtectBase = void 0;
3
+ exports.ProtectAccessory = exports.ProtectBase = exports.PROTECT_SWITCH_MOTION_TRIGGER = exports.PROTECT_SWITCH_MOTION_SENSOR = exports.PROTECT_SWITCH_DOORBELL_TRIGGER = exports.PROTECT_CONTACT_SENSOR_ALARM_SOUND = exports.PROTECT_CONTACT_SENSOR = exports.PROTECT_CONTACT_MOTION_SMARTDETECT = void 0;
4
+ // Manage our contact sensor types.
5
+ exports.PROTECT_CONTACT_MOTION_SMARTDETECT = "ContactMotionSmartDetect";
6
+ exports.PROTECT_CONTACT_SENSOR = "ContactSensor";
7
+ exports.PROTECT_CONTACT_SENSOR_ALARM_SOUND = "ContactAlarmSound";
8
+ // Manage our switch types.
9
+ exports.PROTECT_SWITCH_DOORBELL_TRIGGER = "DoorbellTrigger";
10
+ exports.PROTECT_SWITCH_MOTION_SENSOR = "MotionSensorSwitch";
11
+ exports.PROTECT_SWITCH_MOTION_TRIGGER = "MotionSensorTrigger";
4
12
  class ProtectBase {
5
13
  // The constructor initializes key variables and calls configureDevice().
6
14
  constructor(nvr) {
@@ -12,6 +20,38 @@ class ProtectBase {
12
20
  this.nvrApi = nvr.nvrApi;
13
21
  this.platform = nvr.platform;
14
22
  }
23
+ // Configure the device device information for HomeKit.
24
+ setInfo(accessory, device) {
25
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
26
+ // If we don't have a device, we're done.
27
+ if (!device) {
28
+ return false;
29
+ }
30
+ // Update the manufacturer information for this device.
31
+ (_a = accessory
32
+ .getService(this.hap.Service.AccessoryInformation)) === null || _a === void 0 ? void 0 : _a.updateCharacteristic(this.hap.Characteristic.Manufacturer, "Ubiquiti Networks");
33
+ // Update the model information for this device.
34
+ if ((_b = device.type) === null || _b === void 0 ? void 0 : _b.length) {
35
+ (_c = accessory
36
+ .getService(this.hap.Service.AccessoryInformation)) === null || _c === void 0 ? void 0 : _c.updateCharacteristic(this.hap.Characteristic.Model, device.type);
37
+ }
38
+ // Update the serial number for this device.
39
+ if ((_d = device.mac) === null || _d === void 0 ? void 0 : _d.length) {
40
+ (_e = accessory
41
+ .getService(this.hap.Service.AccessoryInformation)) === null || _e === void 0 ? void 0 : _e.updateCharacteristic(this.hap.Characteristic.SerialNumber, device.mac);
42
+ }
43
+ // Update the hardware revision for this device, if available.
44
+ if ((_f = device.hardwareRevision) === null || _f === void 0 ? void 0 : _f.length) {
45
+ (_g = accessory
46
+ .getService(this.hap.Service.AccessoryInformation)) === null || _g === void 0 ? void 0 : _g.updateCharacteristic(this.hap.Characteristic.HardwareRevision, device.hardwareRevision);
47
+ }
48
+ // Update the firmware revision for this device.
49
+ if ((_h = device.firmwareVersion) === null || _h === void 0 ? void 0 : _h.length) {
50
+ (_j = accessory
51
+ .getService(this.hap.Service.AccessoryInformation)) === null || _j === void 0 ? void 0 : _j.updateCharacteristic(this.hap.Characteristic.FirmwareRevision, device.firmwareVersion);
52
+ }
53
+ return true;
54
+ }
15
55
  // Utility function to return the fully enumerated name of this camera.
16
56
  name() {
17
57
  return this.nvr.nvrApi.getNvrName();
@@ -28,10 +68,113 @@ class ProtectAccessory extends ProtectBase {
28
68
  // Configure the device.
29
69
  void this.configureDevice();
30
70
  }
71
+ // Configure the device device information for HomeKit.
72
+ configureInfo() {
73
+ return this.setInfo(this.accessory, this.accessory.context.device);
74
+ }
75
+ // Configure the Protect motion sensor for HomeKit.
76
+ configureMotionSensor(isEnabled = true) {
77
+ var _a, _b;
78
+ const accessory = this.accessory;
79
+ const hap = this.hap;
80
+ // Find the motion sensor service, if it exists.
81
+ let motionService = accessory.getService(hap.Service.MotionSensor);
82
+ // Have we disabled motion sensors?
83
+ if (!isEnabled || !((_a = this.nvr) === null || _a === void 0 ? void 0 : _a.optionEnabled(accessory.context.device, "Motion.Sensor"))) {
84
+ if (motionService) {
85
+ accessory.removeService(motionService);
86
+ (_b = this.nvr.mqtt) === null || _b === void 0 ? void 0 : _b.unsubscribe(accessory, "motion/trigger");
87
+ this.log.info("%s: Disabling motion sensor.", this.name());
88
+ }
89
+ return false;
90
+ }
91
+ // The motion sensor has already been configured.
92
+ if (motionService) {
93
+ this.configureMqttMotionTrigger();
94
+ return true;
95
+ }
96
+ // We don't have it, add the motion sensor to the camera.
97
+ motionService = new hap.Service.MotionSensor(accessory.displayName);
98
+ if (!motionService) {
99
+ this.log.error("%s: Unable to add motion sensor.", this.name());
100
+ return false;
101
+ }
102
+ accessory.addService(motionService);
103
+ this.configureMqttMotionTrigger();
104
+ this.log.info("%s: Enabling motion sensor.", this.name());
105
+ return true;
106
+ }
107
+ // Configure a switch to easily activate or deactivate motion sensor detection for HomeKit.
108
+ configureMotionSwitch() {
109
+ var _a, _b, _c;
110
+ // Find the switch service, if it exists.
111
+ let switchService = this.accessory.getServiceById(this.hap.Service.Switch, exports.PROTECT_SWITCH_MOTION_SENSOR);
112
+ // Have we disabled motion sensors or the motion switch? Motion switches are disabled by default.
113
+ if (!((_a = this.nvr) === null || _a === void 0 ? void 0 : _a.optionEnabled(this.accessory.context.device, "Motion.Sensor")) ||
114
+ !((_b = this.nvr) === null || _b === void 0 ? void 0 : _b.optionEnabled(this.accessory.context.device, "Motion.Switch", false))) {
115
+ if (switchService) {
116
+ this.accessory.removeService(switchService);
117
+ }
118
+ // If we disable the switch, make sure we fully reset it's state.
119
+ this.accessory.context.detectMotion = true;
120
+ return false;
121
+ }
122
+ this.log.info("%s: Enabling motion sensor switch.", this.name());
123
+ // Add the switch to the camera, if needed.
124
+ if (!switchService) {
125
+ switchService = new this.hap.Service.Switch(this.accessory.displayName + " Motion Events", exports.PROTECT_SWITCH_MOTION_SENSOR);
126
+ if (!switchService) {
127
+ this.log.error("%s: Unable to add motion sensor switch.", this.name());
128
+ return false;
129
+ }
130
+ this.accessory.addService(switchService);
131
+ }
132
+ // Activate or deactivate motion detection.
133
+ (_c = switchService
134
+ .getCharacteristic(this.hap.Characteristic.On)) === null || _c === void 0 ? void 0 : _c.onGet(() => {
135
+ return this.accessory.context.detectMotion === true;
136
+ }).onSet((value) => {
137
+ if (this.accessory.context.detectMotion !== value) {
138
+ this.log.info("%s: Motion detection %s.", this.name(), (value === true) ? "enabled" : "disabled");
139
+ }
140
+ this.accessory.context.detectMotion = value === true;
141
+ });
142
+ // Initialize the switch.
143
+ switchService.updateCharacteristic(this.hap.Characteristic.On, this.accessory.context.detectMotion);
144
+ return true;
145
+ }
146
+ // Configure MQTT motion triggers.
147
+ configureMqttMotionTrigger() {
148
+ var _a;
149
+ // Trigger a motion event in MQTT, if requested to do so.
150
+ (_a = this.nvr.mqtt) === null || _a === void 0 ? void 0 : _a.subscribe(this.accessory, "motion/trigger", (message) => {
151
+ const value = message.toString();
152
+ // When we get the right message, we trigger the motion event.
153
+ if ((value === null || value === void 0 ? void 0 : value.toLowerCase()) !== "true") {
154
+ return;
155
+ }
156
+ // Trigger the motion event.
157
+ this.nvr.events.motionEventHandler(this.accessory, Date.now());
158
+ this.log.info("%s: Motion event triggered via MQTT.", this.name());
159
+ });
160
+ return true;
161
+ }
162
+ // Utility function for reserved identifiers for switches.
163
+ isReservedName(name) {
164
+ return name === undefined ? false :
165
+ [
166
+ exports.PROTECT_CONTACT_MOTION_SMARTDETECT.toUpperCase(),
167
+ exports.PROTECT_SWITCH_DOORBELL_TRIGGER.toUpperCase(),
168
+ exports.PROTECT_SWITCH_MOTION_SENSOR.toUpperCase(),
169
+ exports.PROTECT_SWITCH_MOTION_TRIGGER.toUpperCase(),
170
+ exports.PROTECT_CONTACT_SENSOR.toUpperCase(),
171
+ exports.PROTECT_CONTACT_SENSOR_ALARM_SOUND.toUpperCase()
172
+ ].includes(name.toUpperCase());
173
+ }
31
174
  // Utility function to return the fully enumerated name of this camera.
32
175
  name() {
33
176
  var _a;
34
- return this.nvr.nvrApi.getFullName((_a = this.accessory.context.camera) !== null && _a !== void 0 ? _a : null);
177
+ return this.nvr.nvrApi.getFullName((_a = this.accessory.context.device) !== null && _a !== void 0 ? _a : null);
35
178
  }
36
179
  }
37
180
  exports.ProtectAccessory = ProtectAccessory;
@@ -1 +1 @@
1
- {"version":3,"file":"protect-accessory.js","sourceRoot":"","sources":["../src/protect-accessory.ts"],"names":[],"mappings":";;;AAoBA,MAAsB,WAAW;IAS/B,yEAAyE;IACzE,YAAY,GAAe;QACzB,IAAI,CAAC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