@camstack/addon-pipeline 1.1.41 → 1.1.43
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/audio-analyzer/index.js +1 -1
- package/dist/audio-analyzer/index.mjs +1 -1
- package/dist/detection-pipeline/index.js +10 -7
- package/dist/detection-pipeline/index.mjs +10 -7
- package/dist/{dist-v6cKLmU3.mjs → dist-GFd8M6KO.mjs} +9 -1
- package/dist/{dist-BJTPkJFw.js → dist-NvwN60Fq.js} +9 -1
- package/dist/{frame-handle-plane-BP8YV4sF.js → frame-handle-plane-B3Fxww8H.js} +1 -1
- package/dist/{frame-handle-plane-DKAXTtfn.mjs → frame-handle-plane-E_AsR77T.mjs} +1 -1
- package/dist/motion-wasm/index.js +1 -1
- package/dist/motion-wasm/index.mjs +1 -1
- package/dist/pipeline-runner/index.js +47 -9
- package/dist/pipeline-runner/index.mjs +47 -9
- package/dist/recorder/index.js +19 -12
- package/dist/recorder/index.mjs +19 -12
- package/dist/session-decode/decode-worker-child.js +341 -28
- package/dist/session-decode/decode-worker-child.mjs +341 -28
- package/dist/stream-broker/{_virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-C2l0kmD4.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-CeielP5P.mjs} +3 -3
- package/dist/stream-broker/{hostInit-DHaCRMjM.mjs → hostInit-DmjqskOR.mjs} +3 -3
- package/dist/stream-broker/index.js +96 -63
- package/dist/stream-broker/index.mjs +96 -63
- package/dist/stream-broker/remoteEntry.js +1 -1
- package/embed-dist/assets/{MaskShapeCanvas-DI4BY7W2-B6fza7ic.js → MaskShapeCanvas-DI4BY7W2-CEsPjwzT.js} +1 -1
- package/embed-dist/assets/{MotionZonesSettings-NcxxQN8r-Cy-4iTog.js → MotionZonesSettings-NcxxQN8r-D43fIRgB.js} +1 -1
- package/embed-dist/assets/{PrivacyMaskSettings-APgPLF7p-CYX33lJb.js → PrivacyMaskSettings-APgPLF7p-C3wJxG8V.js} +1 -1
- package/embed-dist/assets/{index-BPkayx9u.js → index-CX-rILhw.js} +4 -4
- package/embed-dist/index.html +1 -1
- package/package.json +1 -1
|
@@ -3,8 +3,8 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_model_download_service_C_IHWnXx = require("../model-download-service-C-IHWnXx-DxM2DSns.js");
|
|
6
|
-
const require_dist = require("../dist-
|
|
7
|
-
const require_frame_handle_plane = require("../frame-handle-plane-
|
|
6
|
+
const require_dist = require("../dist-NvwN60Fq.js");
|
|
7
|
+
const require_frame_handle_plane = require("../frame-handle-plane-B3Fxww8H.js");
|
|
8
8
|
let node_crypto = require("node:crypto");
|
|
9
9
|
node_crypto = require_model_download_service_C_IHWnXx.__toESM(node_crypto);
|
|
10
10
|
let node_child_process = require("node:child_process");
|
|
@@ -11875,10 +11875,13 @@ var TranscodePipelineManager = class {
|
|
|
11875
11875
|
const sourceRes = sourceStream.resolution;
|
|
11876
11876
|
const resMatchesTarget = input.targetResolution === void 0 || sourceRes !== void 0 && sourceRes.width === input.targetResolution.width && sourceRes.height === input.targetResolution.height;
|
|
11877
11877
|
if (input.video === "copy" || sourceCodec !== null && videoTargetToCodec(input.video) === sourceCodec && wantedAudio === "copy" && outputArgs.length === 0 && resMatchesTarget) {
|
|
11878
|
-
if (sourceCodec === null) this.logger.warn("copy-passthrough requested but source codec is unknown — reporting H264", {
|
|
11879
|
-
deviceId: input.deviceId,
|
|
11880
|
-
|
|
11881
|
-
|
|
11878
|
+
if (sourceCodec === null) this.logger.warn("copy-passthrough requested but source codec is unknown — reporting H264", {
|
|
11879
|
+
tags: { deviceId: input.deviceId },
|
|
11880
|
+
meta: {
|
|
11881
|
+
deviceId: input.deviceId,
|
|
11882
|
+
camStreamId: sourceStream.camStreamId
|
|
11883
|
+
}
|
|
11884
|
+
});
|
|
11882
11885
|
const passVideoCodec = sourceCodec ?? "H264";
|
|
11883
11886
|
const url = this.resolveSourceUrl(input.deviceId, sourceStream.camStreamId);
|
|
11884
11887
|
const key = pipelineKeyFor(input.deviceId, sourceStream.camStreamId, "copy", wantedAudio, outResolution, outputArgs, false);
|
|
@@ -11967,13 +11970,16 @@ var TranscodePipelineManager = class {
|
|
|
11967
11970
|
releaseTimer: null
|
|
11968
11971
|
};
|
|
11969
11972
|
this.entries.set(opts.key, entry);
|
|
11970
|
-
this.logger.info("Transcode pipeline started", {
|
|
11971
|
-
|
|
11972
|
-
|
|
11973
|
-
|
|
11974
|
-
|
|
11975
|
-
|
|
11976
|
-
|
|
11973
|
+
this.logger.info("Transcode pipeline started", {
|
|
11974
|
+
tags: { deviceId: opts.deviceId },
|
|
11975
|
+
meta: {
|
|
11976
|
+
key: opts.key,
|
|
11977
|
+
encoder,
|
|
11978
|
+
decodeHwAccel,
|
|
11979
|
+
sourceUrl,
|
|
11980
|
+
url
|
|
11981
|
+
}
|
|
11982
|
+
});
|
|
11977
11983
|
return source;
|
|
11978
11984
|
}
|
|
11979
11985
|
firstPublished(deviceId) {
|
|
@@ -14506,10 +14512,13 @@ var StreamBrokerManager = class {
|
|
|
14506
14512
|
const key = `${cam.deviceId}:${cam.camStreamId}`;
|
|
14507
14513
|
if (!this.sourceParserFellBackWarned.has(key)) {
|
|
14508
14514
|
this.sourceParserFellBackWarned.add(key);
|
|
14509
|
-
this.logger.warn("source parser native-udp requested but not yet implemented — falling back to native-tcp", {
|
|
14510
|
-
deviceId: cam.deviceId,
|
|
14511
|
-
|
|
14512
|
-
|
|
14515
|
+
this.logger.warn("source parser native-udp requested but not yet implemented — falling back to native-tcp", {
|
|
14516
|
+
tags: { deviceId: cam.deviceId },
|
|
14517
|
+
meta: {
|
|
14518
|
+
deviceId: cam.deviceId,
|
|
14519
|
+
camStreamId: cam.camStreamId
|
|
14520
|
+
}
|
|
14521
|
+
});
|
|
14513
14522
|
}
|
|
14514
14523
|
}
|
|
14515
14524
|
if (resolved.engine !== "ffmpeg") return {};
|
|
@@ -14725,7 +14734,7 @@ var StreamBrokerManager = class {
|
|
|
14725
14734
|
if (!broker) return;
|
|
14726
14735
|
if (this.derivedFeeders.has(brokerId)) return;
|
|
14727
14736
|
const controller = new DerivedFeederController({
|
|
14728
|
-
logger: this.logger.child(`derived-feeder:${camStreamId}`),
|
|
14737
|
+
logger: this.logger.child(`derived-feeder:${camStreamId}`).withTags({ deviceId }),
|
|
14729
14738
|
spawn: (onTeardown) => this.spawnDerivedFeeder(deviceId, camStreamId, source, encodeProfile, broker, onTeardown)
|
|
14730
14739
|
});
|
|
14731
14740
|
const unsubscribe = broker.onDemandChange((active) => controller.onDemand(active));
|
|
@@ -14776,21 +14785,27 @@ var StreamBrokerManager = class {
|
|
|
14776
14785
|
const feeder = new DerivedStreamFeeder({
|
|
14777
14786
|
ffmpegPath: this.ffmpegConfig.binaryPath,
|
|
14778
14787
|
args,
|
|
14779
|
-
logger: this.logger.child(`derived-ffmpeg:${camStreamId}`)
|
|
14788
|
+
logger: this.logger.child(`derived-ffmpeg:${camStreamId}`).withTags({ deviceId })
|
|
14780
14789
|
}, {
|
|
14781
14790
|
onEncodedPacket: (packet) => broker.pushEncodedPacket(packet),
|
|
14782
14791
|
onAudioInfo: (info) => broker.pushAudioInfo(info),
|
|
14783
14792
|
onPlaying: () => {
|
|
14784
|
-
this.logger.info("derived feeder streaming", {
|
|
14785
|
-
|
|
14786
|
-
|
|
14787
|
-
|
|
14793
|
+
this.logger.info("derived feeder streaming", {
|
|
14794
|
+
tags: { deviceId },
|
|
14795
|
+
meta: {
|
|
14796
|
+
camStreamId,
|
|
14797
|
+
loopbackUrl
|
|
14798
|
+
}
|
|
14799
|
+
});
|
|
14788
14800
|
},
|
|
14789
14801
|
onError: (error) => {
|
|
14790
|
-
this.logger.warn("derived feeder error", {
|
|
14791
|
-
|
|
14792
|
-
|
|
14793
|
-
|
|
14802
|
+
this.logger.warn("derived feeder error", {
|
|
14803
|
+
tags: { deviceId },
|
|
14804
|
+
meta: {
|
|
14805
|
+
camStreamId,
|
|
14806
|
+
error: error.message
|
|
14807
|
+
}
|
|
14808
|
+
});
|
|
14794
14809
|
},
|
|
14795
14810
|
onTeardown
|
|
14796
14811
|
});
|
|
@@ -16937,10 +16952,13 @@ var BrokerWebrtcServer = class {
|
|
|
16937
16952
|
const entry = this.sessions.get(sessionId);
|
|
16938
16953
|
if (!entry) return;
|
|
16939
16954
|
await entry.session.addIceCandidate(candidate).catch((err) => {
|
|
16940
|
-
this.logger.warn("addIceCandidate threw", {
|
|
16941
|
-
|
|
16942
|
-
|
|
16943
|
-
|
|
16955
|
+
this.logger.warn("addIceCandidate threw", {
|
|
16956
|
+
tags: { deviceId: deviceIdFromBrokerId(entry.brokerId) },
|
|
16957
|
+
meta: {
|
|
16958
|
+
sessionId,
|
|
16959
|
+
error: require_dist.errMsg(err)
|
|
16960
|
+
}
|
|
16961
|
+
});
|
|
16944
16962
|
});
|
|
16945
16963
|
}
|
|
16946
16964
|
/** Trickle ICE — the server's gathered candidates for a session (poll). */
|
|
@@ -16957,10 +16975,13 @@ var BrokerWebrtcServer = class {
|
|
|
16957
16975
|
if (!entry) return;
|
|
16958
16976
|
this.cleanupSession(sessionId);
|
|
16959
16977
|
await entry.session.close().catch(() => {});
|
|
16960
|
-
this.logger.info("WebRTC session closed", {
|
|
16961
|
-
|
|
16962
|
-
|
|
16963
|
-
|
|
16978
|
+
this.logger.info("WebRTC session closed", {
|
|
16979
|
+
tags: { deviceId: deviceIdFromBrokerId(entry.brokerId) },
|
|
16980
|
+
meta: {
|
|
16981
|
+
sessionId,
|
|
16982
|
+
deviceId: deviceIdFromBrokerId(entry.brokerId)
|
|
16983
|
+
}
|
|
16984
|
+
});
|
|
16964
16985
|
}
|
|
16965
16986
|
async stop() {
|
|
16966
16987
|
if (this.stopped) return;
|
|
@@ -17061,13 +17082,16 @@ var BrokerWebrtcServer = class {
|
|
|
17061
17082
|
target: { kind: "adaptive" },
|
|
17062
17083
|
epoch
|
|
17063
17084
|
};
|
|
17064
|
-
this.logger.info("adaptive: scheduling renegotiation", {
|
|
17065
|
-
|
|
17066
|
-
|
|
17067
|
-
|
|
17068
|
-
|
|
17069
|
-
|
|
17070
|
-
|
|
17085
|
+
this.logger.info("adaptive: scheduling renegotiation", {
|
|
17086
|
+
tags: { deviceId },
|
|
17087
|
+
meta: {
|
|
17088
|
+
sessionId,
|
|
17089
|
+
deviceId,
|
|
17090
|
+
tier,
|
|
17091
|
+
forceTranscodeDown,
|
|
17092
|
+
epoch
|
|
17093
|
+
}
|
|
17094
|
+
});
|
|
17071
17095
|
}
|
|
17072
17096
|
cleanupSession(sessionId) {
|
|
17073
17097
|
const entry = this.sessions.get(sessionId);
|
|
@@ -17301,10 +17325,13 @@ var CameraStreamsProvider = class {
|
|
|
17301
17325
|
async pickStream(input) {
|
|
17302
17326
|
const streams = await this.manager.getCameraStreamsForDevice(input.deviceId);
|
|
17303
17327
|
if (streams.length === 0) {
|
|
17304
|
-
this.manager.getLogger?.()?.info("camera-streams: pickStream — no streams for device", {
|
|
17305
|
-
deviceId: input.deviceId,
|
|
17306
|
-
|
|
17307
|
-
|
|
17328
|
+
this.manager.getLogger?.()?.info("camera-streams: pickStream — no streams for device", {
|
|
17329
|
+
tags: { deviceId: input.deviceId },
|
|
17330
|
+
meta: {
|
|
17331
|
+
deviceId: input.deviceId,
|
|
17332
|
+
requirements: input.requirements
|
|
17333
|
+
}
|
|
17334
|
+
});
|
|
17308
17335
|
return null;
|
|
17309
17336
|
}
|
|
17310
17337
|
const requirements = input.requirements;
|
|
@@ -17321,15 +17348,18 @@ var CameraStreamsProvider = class {
|
|
|
17321
17348
|
return true;
|
|
17322
17349
|
});
|
|
17323
17350
|
if (candidates.length === 0) {
|
|
17324
|
-
this.manager.getLogger?.()?.info("camera-streams: pickStream — no matching candidates", {
|
|
17325
|
-
deviceId: input.deviceId,
|
|
17326
|
-
|
|
17327
|
-
|
|
17328
|
-
|
|
17329
|
-
|
|
17330
|
-
|
|
17331
|
-
|
|
17332
|
-
|
|
17351
|
+
this.manager.getLogger?.()?.info("camera-streams: pickStream — no matching candidates", {
|
|
17352
|
+
tags: { deviceId: input.deviceId },
|
|
17353
|
+
meta: {
|
|
17354
|
+
deviceId: input.deviceId,
|
|
17355
|
+
requirements: input.requirements,
|
|
17356
|
+
streams: streams.map((s) => ({
|
|
17357
|
+
camStreamId: s.camStreamId,
|
|
17358
|
+
codec: s.codec,
|
|
17359
|
+
resolution: s.resolution
|
|
17360
|
+
}))
|
|
17361
|
+
}
|
|
17362
|
+
});
|
|
17333
17363
|
return null;
|
|
17334
17364
|
}
|
|
17335
17365
|
const requireSibling = requirements.requireSiblingCodec ?? [];
|
|
@@ -17338,14 +17368,17 @@ var CameraStreamsProvider = class {
|
|
|
17338
17368
|
if (s.camStreamId.startsWith("derived:")) return false;
|
|
17339
17369
|
return codecMatches(s.codec, requireSibling);
|
|
17340
17370
|
})) {
|
|
17341
|
-
this.manager.getLogger?.()?.info("camera-streams: pickStream — no sibling codec, skipping bypass", {
|
|
17342
|
-
deviceId: input.deviceId,
|
|
17343
|
-
|
|
17344
|
-
|
|
17345
|
-
|
|
17346
|
-
|
|
17347
|
-
|
|
17348
|
-
|
|
17371
|
+
this.manager.getLogger?.()?.info("camera-streams: pickStream — no sibling codec, skipping bypass", {
|
|
17372
|
+
tags: { deviceId: input.deviceId },
|
|
17373
|
+
meta: {
|
|
17374
|
+
deviceId: input.deviceId,
|
|
17375
|
+
requireSibling,
|
|
17376
|
+
streams: streams.map((s) => ({
|
|
17377
|
+
camStreamId: s.camStreamId,
|
|
17378
|
+
codec: s.codec
|
|
17379
|
+
}))
|
|
17380
|
+
}
|
|
17381
|
+
});
|
|
17349
17382
|
return null;
|
|
17350
17383
|
}
|
|
17351
17384
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __require } from "../chunk-BdkLduGY.mjs";
|
|
2
|
-
import { $ as discriminatedUnion, B as DeviceType, D as nodePin, F as webrtcSessionCapability, G as makeSourceBrokerId, H as createEvent, I as errMsg, L as BaseAddon, N as streamBrokerCapability, Q as boolean, R as CAM_PROFILE_ORDER, V as EventCategory, W as makeProfileBrokerId, X as _enum, Z as array, at as string, c as EncodeProfileSchema, d as RingBuffer, g as cameraStreamsCapability, it as record, nt as number, ot as union, p as addonWidgetsSourceCapability, q as parseProfileBrokerId, rt as object, tt as literal, w as maskUrlCredentials, z as DeviceFeature } from "../dist-
|
|
3
|
-
import { n as DecoderSessionProxy, t as FrameHandlePlane } from "../frame-handle-plane-
|
|
2
|
+
import { $ as discriminatedUnion, B as DeviceType, D as nodePin, F as webrtcSessionCapability, G as makeSourceBrokerId, H as createEvent, I as errMsg, L as BaseAddon, N as streamBrokerCapability, Q as boolean, R as CAM_PROFILE_ORDER, V as EventCategory, W as makeProfileBrokerId, X as _enum, Z as array, at as string, c as EncodeProfileSchema, d as RingBuffer, g as cameraStreamsCapability, it as record, nt as number, ot as union, p as addonWidgetsSourceCapability, q as parseProfileBrokerId, rt as object, tt as literal, w as maskUrlCredentials, z as DeviceFeature } from "../dist-GFd8M6KO.mjs";
|
|
3
|
+
import { n as DecoderSessionProxy, t as FrameHandlePlane } from "../frame-handle-plane-E_AsR77T.mjs";
|
|
4
4
|
import { t as createFileDataPlaneHandler } from "../model-download-service-C-IHWnXx-BPy6aoAx.mjs";
|
|
5
5
|
import { createRequire } from "node:module";
|
|
6
6
|
import * as crypto$1 from "node:crypto";
|
|
@@ -11871,10 +11871,13 @@ var TranscodePipelineManager = class {
|
|
|
11871
11871
|
const sourceRes = sourceStream.resolution;
|
|
11872
11872
|
const resMatchesTarget = input.targetResolution === void 0 || sourceRes !== void 0 && sourceRes.width === input.targetResolution.width && sourceRes.height === input.targetResolution.height;
|
|
11873
11873
|
if (input.video === "copy" || sourceCodec !== null && videoTargetToCodec(input.video) === sourceCodec && wantedAudio === "copy" && outputArgs.length === 0 && resMatchesTarget) {
|
|
11874
|
-
if (sourceCodec === null) this.logger.warn("copy-passthrough requested but source codec is unknown — reporting H264", {
|
|
11875
|
-
deviceId: input.deviceId,
|
|
11876
|
-
|
|
11877
|
-
|
|
11874
|
+
if (sourceCodec === null) this.logger.warn("copy-passthrough requested but source codec is unknown — reporting H264", {
|
|
11875
|
+
tags: { deviceId: input.deviceId },
|
|
11876
|
+
meta: {
|
|
11877
|
+
deviceId: input.deviceId,
|
|
11878
|
+
camStreamId: sourceStream.camStreamId
|
|
11879
|
+
}
|
|
11880
|
+
});
|
|
11878
11881
|
const passVideoCodec = sourceCodec ?? "H264";
|
|
11879
11882
|
const url = this.resolveSourceUrl(input.deviceId, sourceStream.camStreamId);
|
|
11880
11883
|
const key = pipelineKeyFor(input.deviceId, sourceStream.camStreamId, "copy", wantedAudio, outResolution, outputArgs, false);
|
|
@@ -11963,13 +11966,16 @@ var TranscodePipelineManager = class {
|
|
|
11963
11966
|
releaseTimer: null
|
|
11964
11967
|
};
|
|
11965
11968
|
this.entries.set(opts.key, entry);
|
|
11966
|
-
this.logger.info("Transcode pipeline started", {
|
|
11967
|
-
|
|
11968
|
-
|
|
11969
|
-
|
|
11970
|
-
|
|
11971
|
-
|
|
11972
|
-
|
|
11969
|
+
this.logger.info("Transcode pipeline started", {
|
|
11970
|
+
tags: { deviceId: opts.deviceId },
|
|
11971
|
+
meta: {
|
|
11972
|
+
key: opts.key,
|
|
11973
|
+
encoder,
|
|
11974
|
+
decodeHwAccel,
|
|
11975
|
+
sourceUrl,
|
|
11976
|
+
url
|
|
11977
|
+
}
|
|
11978
|
+
});
|
|
11973
11979
|
return source;
|
|
11974
11980
|
}
|
|
11975
11981
|
firstPublished(deviceId) {
|
|
@@ -14502,10 +14508,13 @@ var StreamBrokerManager = class {
|
|
|
14502
14508
|
const key = `${cam.deviceId}:${cam.camStreamId}`;
|
|
14503
14509
|
if (!this.sourceParserFellBackWarned.has(key)) {
|
|
14504
14510
|
this.sourceParserFellBackWarned.add(key);
|
|
14505
|
-
this.logger.warn("source parser native-udp requested but not yet implemented — falling back to native-tcp", {
|
|
14506
|
-
deviceId: cam.deviceId,
|
|
14507
|
-
|
|
14508
|
-
|
|
14511
|
+
this.logger.warn("source parser native-udp requested but not yet implemented — falling back to native-tcp", {
|
|
14512
|
+
tags: { deviceId: cam.deviceId },
|
|
14513
|
+
meta: {
|
|
14514
|
+
deviceId: cam.deviceId,
|
|
14515
|
+
camStreamId: cam.camStreamId
|
|
14516
|
+
}
|
|
14517
|
+
});
|
|
14509
14518
|
}
|
|
14510
14519
|
}
|
|
14511
14520
|
if (resolved.engine !== "ffmpeg") return {};
|
|
@@ -14721,7 +14730,7 @@ var StreamBrokerManager = class {
|
|
|
14721
14730
|
if (!broker) return;
|
|
14722
14731
|
if (this.derivedFeeders.has(brokerId)) return;
|
|
14723
14732
|
const controller = new DerivedFeederController({
|
|
14724
|
-
logger: this.logger.child(`derived-feeder:${camStreamId}`),
|
|
14733
|
+
logger: this.logger.child(`derived-feeder:${camStreamId}`).withTags({ deviceId }),
|
|
14725
14734
|
spawn: (onTeardown) => this.spawnDerivedFeeder(deviceId, camStreamId, source, encodeProfile, broker, onTeardown)
|
|
14726
14735
|
});
|
|
14727
14736
|
const unsubscribe = broker.onDemandChange((active) => controller.onDemand(active));
|
|
@@ -14772,21 +14781,27 @@ var StreamBrokerManager = class {
|
|
|
14772
14781
|
const feeder = new DerivedStreamFeeder({
|
|
14773
14782
|
ffmpegPath: this.ffmpegConfig.binaryPath,
|
|
14774
14783
|
args,
|
|
14775
|
-
logger: this.logger.child(`derived-ffmpeg:${camStreamId}`)
|
|
14784
|
+
logger: this.logger.child(`derived-ffmpeg:${camStreamId}`).withTags({ deviceId })
|
|
14776
14785
|
}, {
|
|
14777
14786
|
onEncodedPacket: (packet) => broker.pushEncodedPacket(packet),
|
|
14778
14787
|
onAudioInfo: (info) => broker.pushAudioInfo(info),
|
|
14779
14788
|
onPlaying: () => {
|
|
14780
|
-
this.logger.info("derived feeder streaming", {
|
|
14781
|
-
|
|
14782
|
-
|
|
14783
|
-
|
|
14789
|
+
this.logger.info("derived feeder streaming", {
|
|
14790
|
+
tags: { deviceId },
|
|
14791
|
+
meta: {
|
|
14792
|
+
camStreamId,
|
|
14793
|
+
loopbackUrl
|
|
14794
|
+
}
|
|
14795
|
+
});
|
|
14784
14796
|
},
|
|
14785
14797
|
onError: (error) => {
|
|
14786
|
-
this.logger.warn("derived feeder error", {
|
|
14787
|
-
|
|
14788
|
-
|
|
14789
|
-
|
|
14798
|
+
this.logger.warn("derived feeder error", {
|
|
14799
|
+
tags: { deviceId },
|
|
14800
|
+
meta: {
|
|
14801
|
+
camStreamId,
|
|
14802
|
+
error: error.message
|
|
14803
|
+
}
|
|
14804
|
+
});
|
|
14790
14805
|
},
|
|
14791
14806
|
onTeardown
|
|
14792
14807
|
});
|
|
@@ -16933,10 +16948,13 @@ var BrokerWebrtcServer = class {
|
|
|
16933
16948
|
const entry = this.sessions.get(sessionId);
|
|
16934
16949
|
if (!entry) return;
|
|
16935
16950
|
await entry.session.addIceCandidate(candidate).catch((err) => {
|
|
16936
|
-
this.logger.warn("addIceCandidate threw", {
|
|
16937
|
-
|
|
16938
|
-
|
|
16939
|
-
|
|
16951
|
+
this.logger.warn("addIceCandidate threw", {
|
|
16952
|
+
tags: { deviceId: deviceIdFromBrokerId(entry.brokerId) },
|
|
16953
|
+
meta: {
|
|
16954
|
+
sessionId,
|
|
16955
|
+
error: errMsg(err)
|
|
16956
|
+
}
|
|
16957
|
+
});
|
|
16940
16958
|
});
|
|
16941
16959
|
}
|
|
16942
16960
|
/** Trickle ICE — the server's gathered candidates for a session (poll). */
|
|
@@ -16953,10 +16971,13 @@ var BrokerWebrtcServer = class {
|
|
|
16953
16971
|
if (!entry) return;
|
|
16954
16972
|
this.cleanupSession(sessionId);
|
|
16955
16973
|
await entry.session.close().catch(() => {});
|
|
16956
|
-
this.logger.info("WebRTC session closed", {
|
|
16957
|
-
|
|
16958
|
-
|
|
16959
|
-
|
|
16974
|
+
this.logger.info("WebRTC session closed", {
|
|
16975
|
+
tags: { deviceId: deviceIdFromBrokerId(entry.brokerId) },
|
|
16976
|
+
meta: {
|
|
16977
|
+
sessionId,
|
|
16978
|
+
deviceId: deviceIdFromBrokerId(entry.brokerId)
|
|
16979
|
+
}
|
|
16980
|
+
});
|
|
16960
16981
|
}
|
|
16961
16982
|
async stop() {
|
|
16962
16983
|
if (this.stopped) return;
|
|
@@ -17057,13 +17078,16 @@ var BrokerWebrtcServer = class {
|
|
|
17057
17078
|
target: { kind: "adaptive" },
|
|
17058
17079
|
epoch
|
|
17059
17080
|
};
|
|
17060
|
-
this.logger.info("adaptive: scheduling renegotiation", {
|
|
17061
|
-
|
|
17062
|
-
|
|
17063
|
-
|
|
17064
|
-
|
|
17065
|
-
|
|
17066
|
-
|
|
17081
|
+
this.logger.info("adaptive: scheduling renegotiation", {
|
|
17082
|
+
tags: { deviceId },
|
|
17083
|
+
meta: {
|
|
17084
|
+
sessionId,
|
|
17085
|
+
deviceId,
|
|
17086
|
+
tier,
|
|
17087
|
+
forceTranscodeDown,
|
|
17088
|
+
epoch
|
|
17089
|
+
}
|
|
17090
|
+
});
|
|
17067
17091
|
}
|
|
17068
17092
|
cleanupSession(sessionId) {
|
|
17069
17093
|
const entry = this.sessions.get(sessionId);
|
|
@@ -17297,10 +17321,13 @@ var CameraStreamsProvider = class {
|
|
|
17297
17321
|
async pickStream(input) {
|
|
17298
17322
|
const streams = await this.manager.getCameraStreamsForDevice(input.deviceId);
|
|
17299
17323
|
if (streams.length === 0) {
|
|
17300
|
-
this.manager.getLogger?.()?.info("camera-streams: pickStream — no streams for device", {
|
|
17301
|
-
deviceId: input.deviceId,
|
|
17302
|
-
|
|
17303
|
-
|
|
17324
|
+
this.manager.getLogger?.()?.info("camera-streams: pickStream — no streams for device", {
|
|
17325
|
+
tags: { deviceId: input.deviceId },
|
|
17326
|
+
meta: {
|
|
17327
|
+
deviceId: input.deviceId,
|
|
17328
|
+
requirements: input.requirements
|
|
17329
|
+
}
|
|
17330
|
+
});
|
|
17304
17331
|
return null;
|
|
17305
17332
|
}
|
|
17306
17333
|
const requirements = input.requirements;
|
|
@@ -17317,15 +17344,18 @@ var CameraStreamsProvider = class {
|
|
|
17317
17344
|
return true;
|
|
17318
17345
|
});
|
|
17319
17346
|
if (candidates.length === 0) {
|
|
17320
|
-
this.manager.getLogger?.()?.info("camera-streams: pickStream — no matching candidates", {
|
|
17321
|
-
deviceId: input.deviceId,
|
|
17322
|
-
|
|
17323
|
-
|
|
17324
|
-
|
|
17325
|
-
|
|
17326
|
-
|
|
17327
|
-
|
|
17328
|
-
|
|
17347
|
+
this.manager.getLogger?.()?.info("camera-streams: pickStream — no matching candidates", {
|
|
17348
|
+
tags: { deviceId: input.deviceId },
|
|
17349
|
+
meta: {
|
|
17350
|
+
deviceId: input.deviceId,
|
|
17351
|
+
requirements: input.requirements,
|
|
17352
|
+
streams: streams.map((s) => ({
|
|
17353
|
+
camStreamId: s.camStreamId,
|
|
17354
|
+
codec: s.codec,
|
|
17355
|
+
resolution: s.resolution
|
|
17356
|
+
}))
|
|
17357
|
+
}
|
|
17358
|
+
});
|
|
17329
17359
|
return null;
|
|
17330
17360
|
}
|
|
17331
17361
|
const requireSibling = requirements.requireSiblingCodec ?? [];
|
|
@@ -17334,14 +17364,17 @@ var CameraStreamsProvider = class {
|
|
|
17334
17364
|
if (s.camStreamId.startsWith("derived:")) return false;
|
|
17335
17365
|
return codecMatches(s.codec, requireSibling);
|
|
17336
17366
|
})) {
|
|
17337
|
-
this.manager.getLogger?.()?.info("camera-streams: pickStream — no sibling codec, skipping bypass", {
|
|
17338
|
-
deviceId: input.deviceId,
|
|
17339
|
-
|
|
17340
|
-
|
|
17341
|
-
|
|
17342
|
-
|
|
17343
|
-
|
|
17344
|
-
|
|
17367
|
+
this.manager.getLogger?.()?.info("camera-streams: pickStream — no sibling codec, skipping bypass", {
|
|
17368
|
+
tags: { deviceId: input.deviceId },
|
|
17369
|
+
meta: {
|
|
17370
|
+
deviceId: input.deviceId,
|
|
17371
|
+
requireSibling,
|
|
17372
|
+
streams: streams.map((s) => ({
|
|
17373
|
+
camStreamId: s.camStreamId,
|
|
17374
|
+
codec: s.codec
|
|
17375
|
+
}))
|
|
17376
|
+
}
|
|
17377
|
+
});
|
|
17345
17378
|
return null;
|
|
17346
17379
|
}
|
|
17347
17380
|
}
|
|
@@ -30,7 +30,7 @@ async function d(e) {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
async function f() {
|
|
33
|
-
return l ||= d(() => import("./_virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-
|
|
33
|
+
return l ||= d(() => import("./_virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-CeielP5P.mjs")).catch((e) => {
|
|
34
34
|
throw l = void 0, e;
|
|
35
35
|
}), l;
|
|
36
36
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d as e,f as t,g as n,h as r,m as i,p as a}from"./index-
|
|
1
|
+
import{d as e,f as t,g as n,h as r,m as i,p as a}from"./index-CX-rILhw.js";var o=n(t()),s=n(e(),1),c=Math.PI/180;function l(){return typeof window<`u`&&({}.toString.call(window)===`[object Window]`||{}.toString.call(window)===`[object global]`)}var u=typeof global<`u`?global:typeof window<`u`?window:typeof WorkerGlobalScope<`u`?self:{},d={_global:u,version:`10.3.0`,isBrowser:l(),isUnminified:/param/.test(function(e){}.toString()),dblClickWindow:400,getAngle(e){return d.angleDeg?e*c:e},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,_renderBackend:`web`,legacyTextRendering:!1,pixelRatio:typeof window<`u`&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return d.DD.isDragging},isTransforming(){return d.Transformer?.isTransforming()??!1},isDragReady(){return!!d.DD.node},releaseCanvasOnDestroy:!0,document:u.document,_injectGlobal(e){u.Konva!==void 0&&console.error(`Several Konva instances detected. It is not recommended to use multiple Konva instances in the same environment.`),u.Konva=e}},f=e=>{d[e.prototype.getClassName()]=e};d._injectGlobal(d);var p=`Konva.js unsupported environment.
|
|
2
2
|
|
|
3
3
|
Looks like you are trying to use Konva.js in Node.js environment. because "document" object is undefined.
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,c as t,d as n,f as r,g as i,l as a,o,r as s,s as c,u as l}from"./index-
|
|
1
|
+
import{a as e,c as t,d as n,f as r,g as i,l as a,o,r as s,s as c,u as l}from"./index-CX-rILhw.js";import{MaskShapeCanvas as u}from"./MaskShapeCanvas-DI4BY7W2-CEsPjwzT.js";var d=i(r(),1),f=i(n(),1),p=o(`grid-2x2`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]),m=110,h=`motion-zones`,g=0,_=[1,2,3],v=1,y=`rounded-md border border-border bg-surface px-2 py-1 text-[11px] font-medium text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors`,b=`rounded-md border border-primary/50 bg-primary/15 px-2.5 py-1 text-[11px] font-medium text-primary hover:bg-primary/25 disabled:opacity-40 transition-colors`;function x(e,t,n){let r=t*n,i=Array.from({length:r});for(let t=0;t<r;t+=1)i[t]=e[t]===!0;return i}function S(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function C(e,t){return Math.ceil(e/t)}function w(e,t,n){return Math.min(n-1,Math.floor((e+.5)/t*n))}function T(e,t,n,r){let i=C(t,r),a=C(n,r),o=Array.from({length:i*a},()=>!1);for(let r=0;r<n;r+=1){let s=w(r,n,a);for(let n=0;n<t;n+=1)e[r*t+n]===!0&&(o[s*i+w(n,t,i)]=!0)}return o}function E(e,t,n,r){let i=C(t,r),a=C(n,r),o=Array.from({length:t*n},()=>!1);for(let r=0;r<n;r+=1){let s=w(r,n,a);for(let n=0;n<t;n+=1)o[r*t+n]=e[s*i+w(n,t,i)]===!0}return o}function D({deviceId:n}){let r=t(l().trpcClient,n),[i,o]=(0,d.useState)(null),[w,D]=(0,d.useState)(!1),[O,k]=(0,d.useState)(null),[A,j]=(0,d.useState)(null),[M,N]=(0,d.useState)(v),[P,F]=(0,d.useState)(!1),[I,L]=(0,d.useState)(!1),R=(0,d.useRef)(!1);(0,d.useEffect)(()=>{if(!r)return;let e=!1;return R.current=!1,o(null),D(!1),k(null),j(null),N(v),L(!1),(async()=>{try{let t=await r.motionZones?.getOptions({});if(e)return;if(!t)throw Error(`device proxy not ready`);if(o(t),R.current)return;let n=await r.motionZones?.getStatus({});if(e)return;if(!n)throw Error(`device proxy not ready`);R.current=!0;let i=n.regions.find(e=>e.shape.kind===`grid`),a=x(i?i.shape.cells:[],t.grid.width,t.grid.height);j(a),k(T(a,t.grid.width,t.grid.height,v))}catch(t){if(e)return;c(t)?D(!0):console.error(`Motion Zones load failed`,t)}})(),()=>{e=!0}},[r]);let z=i?i.grid.width:0,B=i?i.grid.height:0,V=C(z,M),H=C(B,M),U=(0,d.useMemo)(()=>O&&i?E(O,z,B,M):null,[O,i,z,B,M]),W=(0,d.useMemo)(()=>U!==null&&A!==null&&!S(U,A),[U,A]),G=(0,d.useMemo)(()=>U?U.reduce((e,t)=>t?e+1:e,0):0,[U]),K=z*B,q=V*H,J=(0,d.useCallback)(e=>{q>0&&k(Array.from({length:q},()=>e))},[q]),Y=(0,d.useCallback)(()=>{k(e=>e&&e.map(e=>!e))},[]),X=(0,d.useCallback)(()=>{A&&i&&k(T(A,z,B,M))},[A,i,z,B,M]),Z=(0,d.useCallback)(e=>{e===M||!i||k(t=>{if(!t)return N(e),t;let n=T(E(t,z,B,M),z,B,e);return N(e),n})},[M,i,z,B]),Q=(0,d.useMemo)(()=>i&&O?[{id:g,shape:{kind:`grid`,gridWidth:V,gridHeight:H,cells:[...O]}}]:[],[i,O,V,H]),$=(0,d.useCallback)((e,t)=>{t.kind===`grid`&&k(t.cells)},[]),ee=(0,d.useCallback)(async()=>{if(!(!r||!O||!i)){F(!0);try{let e=E(O,i.grid.width,i.grid.height,M),t={kind:`grid`,gridWidth:i.grid.width,gridHeight:i.grid.height,cells:e};await r.motionZones?.setZone({patch:{regions:[{id:g,enabled:!0,shape:t}]}});let n=await r.motionZones?.getStatus({});if(n){let e=n.regions.find(e=>e.shape.kind===`grid`),t=x(e?e.shape.cells:[],i.grid.width,i.grid.height);j(t),k(T(t,i.grid.width,i.grid.height,M))}}catch(e){console.error(`Motion Zones save failed`,e)}finally{F(!1)}}},[r,O,i,M]);a((0,d.useMemo)(()=>I&&!w&&i&&O?{id:h,order:m,node:(0,f.jsx)(u,{transparent:!0,items:Q,supportedShapes:[`grid`],grid:{width:V,height:H},selectedId:g,onSelect:()=>{},onShapeChange:$,onDrawComplete:()=>{},drawingKind:null})}:null,[I,w,i,O,Q,$,V,H]));let te=!w&&i!==null&&O!==null;return r?(0,f.jsx)(e,{title:`Motion Zones`,icon:(0,f.jsx)(p,{className:`h-3.5 w-3.5 text-foreground-subtle`}),children:(0,f.jsx)(`div`,{className:`flex flex-col gap-3`,children:w?(0,f.jsx)(`p`,{className:`${s} leading-relaxed`,children:`This camera doesn't expose an on-board motion zones grid.`}):te?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`p`,{className:`${s} leading-relaxed`,children:[`Toggle `,(0,f.jsx)(`strong`,{className:`text-foreground`,children:`Edit grid`}),` to paint the region directly on the live frame, then `,(0,f.jsx)(`strong`,{className:`text-foreground`,children:`Save`}),` to push the mask to the camera. Pick a bigger`,` `,(0,f.jsx)(`strong`,{className:`text-foreground`,children:`Cell size`}),` for quicker, broad-stroke painting — it's resampled to the camera's native `,i.grid.width,`×`,i.grid.height,` grid on save (×1 is the finest).`]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,f.jsx)(`button`,{type:`button`,onClick:()=>L(e=>!e),disabled:P,"aria-pressed":I,className:I?b:y,children:I?`Done editing`:`Edit grid`}),(0,f.jsx)(`button`,{type:`button`,onClick:()=>J(!0),disabled:P,className:y,children:`All on`}),(0,f.jsx)(`button`,{type:`button`,onClick:()=>J(!1),disabled:P,className:y,children:`All off`}),(0,f.jsx)(`button`,{type:`button`,onClick:Y,disabled:P,className:y,children:`Invert`}),(0,f.jsxs)(`div`,{className:`flex items-center gap-1 ml-1`,role:`group`,"aria-label":`Cell size`,children:[(0,f.jsx)(`span`,{className:`${s} mr-0.5`,children:`Cell size`}),_.map(e=>(0,f.jsxs)(`button`,{type:`button`,onClick:()=>Z(e),disabled:P,"aria-pressed":M===e,title:e===1?`Camera grid ${z}×${B} (finest)`:`${C(z,e)}×${C(B,e)} painting grid · cells ×${e} bigger`,className:M===e?b:y,children:[`×`,e]},e))]}),(0,f.jsxs)(`span`,{className:`${s} ml-1 tabular-nums`,children:[G,` / `,K,` cells · `,i.grid.width,`×`,i.grid.height,M===1?``:` · paint ${V}×${H}`]}),(0,f.jsx)(`span`,{className:`flex-1`}),(0,f.jsx)(`button`,{type:`button`,onClick:X,disabled:P||!W,className:`rounded-md border border-border bg-surface px-2 py-1 text-[11px] text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors`,children:`Revert`}),(0,f.jsx)(`button`,{type:`button`,onClick:()=>void ee(),disabled:P||!W,className:b,children:P?`Saving…`:`Save`})]})]}):(0,f.jsx)(`p`,{className:`${s} leading-relaxed`,children:`Loading the camera's grid…`})})}):null}export{D as MotionZonesSettings};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,c as t,d as n,f as r,g as i,i as a,l as o,n as s,o as c,r as l,s as u,t as d,u as ee}from"./index-
|
|
1
|
+
import{a as e,c as t,d as n,f as r,g as i,i as a,l as o,n as s,o as c,r as l,s as u,t as d,u as ee}from"./index-CX-rILhw.js";import{MaskShapeCanvas as te}from"./MaskShapeCanvas-DI4BY7W2-CEsPjwzT.js";var f=i(r(),1),p=i(n(),1),m=c(`hexagon`,[[`path`,{d:`M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z`,key:`yt0hxn`}]]),h=120,g=`privacy-mask`,_=`rounded-md border border-border bg-surface px-2 py-1 text-[11px] font-medium text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors`,v=`rounded-md border border-primary/50 bg-primary/15 px-2.5 py-1 text-[11px] font-medium text-primary hover:bg-primary/25 disabled:opacity-40 transition-colors`;function y(e){return e.kind===`rect`||e.kind===`polygon`?e:null}function b(e){let t=new Set(e.map(e=>e.id)),n=0;for(;t.has(n);)n+=1;return n}function x(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(JSON.stringify(e[n])!==JSON.stringify(t[n]))return!1;return!0}function S({deviceId:n}){let r=t(ee().trpcClient,n),[i,c]=(0,f.useState)(null),[S,C]=(0,f.useState)(!1),[w,T]=(0,f.useState)(null),[E,D]=(0,f.useState)(null),[O,k]=(0,f.useState)(!1),[A,j]=(0,f.useState)(!1),[M,N]=(0,f.useState)(null),[P,F]=(0,f.useState)(null),I=(0,f.useRef)(!1);(0,f.useEffect)(()=>{if(!r)return;let e=!1;return I.current=!1,c(null),C(!1),T(null),D(null),j(!1),N(null),F(null),(async()=>{try{let t=await r.privacyMask?.getOptions({});if(e)return;if(!t)throw Error(`device proxy not ready`);if(c(t),I.current)return;let n=await r.privacyMask?.getStatus({});if(e)return;if(!n)throw Error(`device proxy not ready`);I.current=!0;let i={enabled:n.enabled,regions:n.regions};D(i),T(i)}catch(t){if(e)return;u(t)?C(!0):console.error(`Privacy Mask load failed`,t)}})(),()=>{e=!0}},[r]);let L=(0,f.useMemo)(()=>w!==null&&E!==null&&(w.enabled!==E.enabled||!x(w.regions,E.regions)),[w,E]),R=w?w.regions.length:0,z=i?i.maxRegions:0,B=(0,f.useRef)(0);(0,f.useEffect)(()=>{B.current=z},[z]);let V=z>0&&R>=z,H=(0,f.useCallback)(()=>{T(e=>e&&{...e,enabled:!e.enabled})},[]),U=(0,f.useCallback)(e=>{N(typeof e==`number`?e:null)},[]),W=(0,f.useMemo)(()=>w?w.regions.map(e=>({id:e.id,shape:e.shape,enabled:e.enabled,label:`Zone ${String(e.id)}`})):[],[w]),G=(0,f.useCallback)((e,t)=>{let n=y(t);n&&T(t=>t&&{...t,regions:t.regions.map(t=>t.id===e?{...t,shape:n}:t)})},[]),K=(0,f.useCallback)(e=>{let t=y(e);t&&(F(null),T(e=>{if(!e)return e;let n=B.current;if(n>0&&e.regions.length>=n)return e;let r=b(e.regions),i={id:r,enabled:!0,shape:t};return N(r),{...e,regions:[...e.regions,i]}}))},[]),q=(0,f.useCallback)(e=>{j(!0),N(null),F(e)},[]),J=(0,f.useCallback)(e=>{j(!0),F(null),N(e)},[]),Y=(0,f.useCallback)(e=>{N(t=>t===e?null:t),T(t=>t&&{...t,regions:t.regions.filter(t=>t.id!==e)})},[]),X=(0,f.useCallback)(()=>{F(null),N(null),E&&T({enabled:E.enabled,regions:E.regions})},[E]),Z=(0,f.useCallback)(async()=>{if(!(!r||!w)){k(!0);try{await r.privacyMask?.setMask({patch:{enabled:w.enabled,regions:[...w.regions]}});let e=await r.privacyMask?.getStatus({});if(e){let t={enabled:e.enabled,regions:e.regions};D(t),T(t)}}catch(e){console.error(`Privacy Mask save failed`,e)}finally{k(!1)}}},[r,w]),ne=(0,f.useCallback)(()=>{j(e=>(e&&(F(null),N(null)),!e))},[]),Q=i?.supportedShapes??[];o((0,f.useMemo)(()=>A&&!S&&i&&w?{id:g,order:h,node:(0,p.jsx)(te,{transparent:!0,items:W,supportedShapes:Q,polygonVertices:i.polygonVertices,selectedId:M,onSelect:U,onShapeChange:G,onDrawComplete:K,drawingKind:P})}:null,[A,S,i,w,W,Q,M,U,G,K,P]));let re=i?.supportedShapes.includes(`rect`)??!1,ie=i?.supportedShapes.includes(`polygon`)??!1,$=i!==null&&(i.maxRegions<=0||i.supportedShapes.length===0),ae=!S&&!$&&i!==null&&w!==null;return r?(0,p.jsx)(e,{title:`Privacy Mask`,icon:(0,p.jsx)(d,{className:`h-3.5 w-3.5 text-foreground-subtle`}),children:(0,p.jsx)(`div`,{className:`flex flex-col gap-3`,children:S||$?(0,p.jsx)(`p`,{className:`${l} leading-relaxed`,children:`This camera doesn't support an on-board privacy mask.`}):ae?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`p`,{className:`${l} leading-relaxed`,children:[`Toggle `,(0,p.jsx)(`strong`,{className:`text-foreground`,children:`Edit mask`}),` to draw blanked-out zones on the live frame, then `,(0,p.jsx)(`strong`,{className:`text-foreground`,children:`Save`}),` to push them to the camera. Drag a rectangle to move, its corner to resize; drag polygon vertices, click an edge midpoint to add one, or right-click a vertex to remove it.`]}),(0,p.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,p.jsx)(`button`,{type:`button`,onClick:ne,disabled:O,"aria-pressed":A,className:A?v:_,children:A?`Done editing`:`Edit mask`}),(0,p.jsx)(`button`,{type:`button`,onClick:H,disabled:O,"aria-pressed":w.enabled,className:w.enabled?v:_,children:w.enabled?`Mask on`:`Mask off`}),re&&(0,p.jsx)(`button`,{type:`button`,onClick:()=>q(`rect`),disabled:O||V,"aria-pressed":P===`rect`,className:P===`rect`?v:_,title:V?`Maximum zones reached`:`Add a rectangle zone`,children:`+ Rect`}),ie&&(0,p.jsx)(`button`,{type:`button`,onClick:()=>q(`polygon`),disabled:O||V,"aria-pressed":P===`polygon`,className:P===`polygon`?v:_,title:V?`Maximum zones reached`:`Add a polygon zone`,children:`+ Polygon`}),(0,p.jsxs)(`span`,{className:`${l} ml-1 tabular-nums`,children:[R,` / `,z,` zones`]}),(0,p.jsx)(`span`,{className:`flex-1`}),(0,p.jsx)(`button`,{type:`button`,onClick:X,disabled:O||!L,className:`rounded-md border border-border bg-surface px-2 py-1 text-[11px] text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors`,children:`Revert`}),(0,p.jsx)(`button`,{type:`button`,onClick:()=>void Z(),disabled:O||!L,className:v,children:O?`Saving…`:`Save`})]}),R>0?(0,p.jsx)(`div`,{className:`flex flex-col gap-1`,children:w.regions.map(e=>{let t=M===e.id,n=e.shape.kind===`polygon`?m:s;return(0,p.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border px-2 py-1 transition-colors ${t?`border-primary/50 bg-primary/10`:`border-border bg-surface`}`,children:[(0,p.jsxs)(`button`,{type:`button`,onClick:()=>J(e.id),disabled:O,className:`flex flex-1 items-center gap-2 text-left text-[11px] font-medium text-foreground-subtle hover:text-foreground disabled:opacity-40 transition-colors`,children:[(0,p.jsx)(n,{className:`h-3.5 w-3.5 shrink-0`}),(0,p.jsxs)(`span`,{children:[`Zone `,e.id]}),(0,p.jsx)(`span`,{className:`text-foreground-faint capitalize`,children:e.shape.kind})]}),(0,p.jsx)(`button`,{type:`button`,onClick:()=>Y(e.id),disabled:O,"aria-label":`Delete zone ${String(e.id)}`,title:`Delete zone`,className:`inline-flex h-6 w-6 items-center justify-center rounded border border-border bg-surface text-foreground-subtle hover:border-red-400/40 hover:bg-red-500/10 hover:text-red-400 disabled:opacity-40 transition-colors`,children:(0,p.jsx)(a,{className:`h-3.5 w-3.5`})})]},e.id)})}):null]}):(0,p.jsx)(`p`,{className:`${l} leading-relaxed`,children:`Loading the camera's privacy mask…`})})}):null}export{S as PrivacyMaskSettings};
|