@riddix/hamh 2.1.0-alpha.744 → 2.1.0-alpha.745
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/backend/cli.js
CHANGED
|
@@ -56188,8 +56188,16 @@ var init_SoftwareVersionCertificationStatus = __esm({
|
|
|
56188
56188
|
});
|
|
56189
56189
|
|
|
56190
56190
|
// ../../node_modules/.pnpm/@matter+types@0.17.2/node_modules/@matter/types/dist/esm/globals/StreamUsage.js
|
|
56191
|
+
var StreamUsage;
|
|
56191
56192
|
var init_StreamUsage = __esm({
|
|
56192
56193
|
"../../node_modules/.pnpm/@matter+types@0.17.2/node_modules/@matter/types/dist/esm/globals/StreamUsage.js"() {
|
|
56194
|
+
StreamUsage = /* @__PURE__ */ ((StreamUsage2) => {
|
|
56195
|
+
StreamUsage2[StreamUsage2["Internal"] = 0] = "Internal";
|
|
56196
|
+
StreamUsage2[StreamUsage2["Recording"] = 1] = "Recording";
|
|
56197
|
+
StreamUsage2[StreamUsage2["Analysis"] = 2] = "Analysis";
|
|
56198
|
+
StreamUsage2[StreamUsage2["LiveView"] = 3] = "LiveView";
|
|
56199
|
+
return StreamUsage2;
|
|
56200
|
+
})(StreamUsage || {});
|
|
56193
56201
|
}
|
|
56194
56202
|
});
|
|
56195
56203
|
|
|
@@ -134356,6 +134364,7 @@ var CameraDeviceDefinition = MutableEndpoint({
|
|
|
134356
134364
|
behaviors: SupportedBehaviors(CameraRequirements.server.mandatory.WebRtcTransportProvider)
|
|
134357
134365
|
});
|
|
134358
134366
|
Object.freeze(CameraDeviceDefinition);
|
|
134367
|
+
var CameraDevice = CameraDeviceDefinition;
|
|
134359
134368
|
|
|
134360
134369
|
// ../../node_modules/.pnpm/@matter+types@0.17.2/node_modules/@matter/types/dist/esm/clusters/content-app-observer.js
|
|
134361
134370
|
init_ClusterType();
|
|
@@ -162021,6 +162030,463 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
162021
162030
|
}
|
|
162022
162031
|
};
|
|
162023
162032
|
|
|
162033
|
+
// src/plugins/builtin/camera/camera-plugin.ts
|
|
162034
|
+
init_esm();
|
|
162035
|
+
|
|
162036
|
+
// src/plugins/builtin/camera/camera-endpoint.ts
|
|
162037
|
+
init_esm3();
|
|
162038
|
+
|
|
162039
|
+
// src/plugins/builtin/camera/av-stream-server.ts
|
|
162040
|
+
var Base3 = CameraAvStreamManagementServer.with("Video", "Audio", "Snapshot");
|
|
162041
|
+
var CameraAvStreamServer = class extends Base3 {
|
|
162042
|
+
setStreamPriorities(request) {
|
|
162043
|
+
this.state.streamUsagePriorities = request.streamPriorities;
|
|
162044
|
+
}
|
|
162045
|
+
videoStreamAllocate(request) {
|
|
162046
|
+
const videoStreamId = this.state.nextVideoStreamId++;
|
|
162047
|
+
this.state.allocatedVideoStreams = [
|
|
162048
|
+
...this.state.allocatedVideoStreams,
|
|
162049
|
+
{
|
|
162050
|
+
videoStreamId,
|
|
162051
|
+
streamUsage: request.streamUsage,
|
|
162052
|
+
videoCodec: request.videoCodec,
|
|
162053
|
+
minFrameRate: request.minFrameRate,
|
|
162054
|
+
maxFrameRate: request.maxFrameRate,
|
|
162055
|
+
minResolution: request.minResolution,
|
|
162056
|
+
maxResolution: request.maxResolution,
|
|
162057
|
+
minBitRate: request.minBitRate,
|
|
162058
|
+
maxBitRate: request.maxBitRate,
|
|
162059
|
+
keyFrameInterval: request.keyFrameInterval,
|
|
162060
|
+
watermarkEnabled: request.watermarkEnabled,
|
|
162061
|
+
osdEnabled: request.osdEnabled,
|
|
162062
|
+
referenceCount: 1
|
|
162063
|
+
}
|
|
162064
|
+
];
|
|
162065
|
+
return { videoStreamId };
|
|
162066
|
+
}
|
|
162067
|
+
videoStreamDeallocate(request) {
|
|
162068
|
+
this.state.allocatedVideoStreams = this.state.allocatedVideoStreams.filter(
|
|
162069
|
+
(s) => s.videoStreamId !== request.videoStreamId
|
|
162070
|
+
);
|
|
162071
|
+
}
|
|
162072
|
+
audioStreamAllocate(request) {
|
|
162073
|
+
const audioStreamId = this.state.nextAudioStreamId++;
|
|
162074
|
+
this.state.allocatedAudioStreams = [
|
|
162075
|
+
...this.state.allocatedAudioStreams,
|
|
162076
|
+
{
|
|
162077
|
+
audioStreamId,
|
|
162078
|
+
streamUsage: request.streamUsage,
|
|
162079
|
+
audioCodec: request.audioCodec,
|
|
162080
|
+
channelCount: request.channelCount,
|
|
162081
|
+
sampleRate: request.sampleRate,
|
|
162082
|
+
bitRate: request.bitRate,
|
|
162083
|
+
bitDepth: request.bitDepth,
|
|
162084
|
+
referenceCount: 1
|
|
162085
|
+
}
|
|
162086
|
+
];
|
|
162087
|
+
return { audioStreamId };
|
|
162088
|
+
}
|
|
162089
|
+
audioStreamDeallocate(request) {
|
|
162090
|
+
this.state.allocatedAudioStreams = this.state.allocatedAudioStreams.filter(
|
|
162091
|
+
(s) => s.audioStreamId !== request.audioStreamId
|
|
162092
|
+
);
|
|
162093
|
+
}
|
|
162094
|
+
snapshotStreamAllocate(request) {
|
|
162095
|
+
const snapshotStreamId = this.state.nextSnapshotStreamId++;
|
|
162096
|
+
this.state.allocatedSnapshotStreams = [
|
|
162097
|
+
...this.state.allocatedSnapshotStreams,
|
|
162098
|
+
{
|
|
162099
|
+
snapshotStreamId,
|
|
162100
|
+
imageCodec: request.imageCodec,
|
|
162101
|
+
frameRate: request.maxFrameRate,
|
|
162102
|
+
minResolution: request.minResolution,
|
|
162103
|
+
maxResolution: request.maxResolution,
|
|
162104
|
+
quality: request.quality,
|
|
162105
|
+
referenceCount: 1,
|
|
162106
|
+
encodedPixels: false,
|
|
162107
|
+
hardwareEncoder: false
|
|
162108
|
+
}
|
|
162109
|
+
];
|
|
162110
|
+
return { snapshotStreamId };
|
|
162111
|
+
}
|
|
162112
|
+
snapshotStreamDeallocate(request) {
|
|
162113
|
+
this.state.allocatedSnapshotStreams = this.state.allocatedSnapshotStreams.filter(
|
|
162114
|
+
(s) => s.snapshotStreamId !== request.snapshotStreamId
|
|
162115
|
+
);
|
|
162116
|
+
}
|
|
162117
|
+
async captureSnapshot(request) {
|
|
162118
|
+
const data = await this.state.bridge.snapshot(this.state.entityId);
|
|
162119
|
+
return {
|
|
162120
|
+
data,
|
|
162121
|
+
imageCodec: CameraAvStreamManagement3.ImageCodec.Jpeg,
|
|
162122
|
+
resolution: request.requestedResolution
|
|
162123
|
+
};
|
|
162124
|
+
}
|
|
162125
|
+
};
|
|
162126
|
+
((CameraAvStreamServer2) => {
|
|
162127
|
+
class State extends Base3.State {
|
|
162128
|
+
bridge;
|
|
162129
|
+
entityId;
|
|
162130
|
+
nextVideoStreamId = 1;
|
|
162131
|
+
nextAudioStreamId = 1;
|
|
162132
|
+
nextSnapshotStreamId = 1;
|
|
162133
|
+
}
|
|
162134
|
+
CameraAvStreamServer2.State = State;
|
|
162135
|
+
})(CameraAvStreamServer || (CameraAvStreamServer = {}));
|
|
162136
|
+
|
|
162137
|
+
// src/plugins/builtin/camera/webrtc-provider-server.ts
|
|
162138
|
+
init_esm7();
|
|
162139
|
+
init_esm3();
|
|
162140
|
+
var CameraWebRtcProviderServer = class extends WebRtcTransportProviderServer {
|
|
162141
|
+
solicitOffer(request) {
|
|
162142
|
+
const id = this.state.nextSessionId++;
|
|
162143
|
+
this.trackSession(id, request.streamUsage, request.originatingEndpointId);
|
|
162144
|
+
void this.state.bridge.startSession(id, this.state.entityId).catch(() => {
|
|
162145
|
+
});
|
|
162146
|
+
return { webRtcSessionId: id, deferredOffer: true };
|
|
162147
|
+
}
|
|
162148
|
+
async provideOffer(request) {
|
|
162149
|
+
const id = request.webRtcSessionId ?? this.state.nextSessionId++;
|
|
162150
|
+
if (request.webRtcSessionId == null) {
|
|
162151
|
+
this.trackSession(
|
|
162152
|
+
id,
|
|
162153
|
+
request.streamUsage ?? StreamUsage.LiveView,
|
|
162154
|
+
request.originatingEndpointId ?? EndpointNumber(0)
|
|
162155
|
+
);
|
|
162156
|
+
}
|
|
162157
|
+
const answerSdp = await this.state.bridge.acceptControllerOffer(
|
|
162158
|
+
id,
|
|
162159
|
+
this.state.entityId,
|
|
162160
|
+
request.sdp
|
|
162161
|
+
);
|
|
162162
|
+
void answerSdp;
|
|
162163
|
+
return { webRtcSessionId: id };
|
|
162164
|
+
}
|
|
162165
|
+
provideAnswer(request) {
|
|
162166
|
+
return this.state.bridge.acceptControllerAnswer(
|
|
162167
|
+
request.webRtcSessionId,
|
|
162168
|
+
request.sdp
|
|
162169
|
+
);
|
|
162170
|
+
}
|
|
162171
|
+
async provideIceCandidates(request) {
|
|
162172
|
+
for (const c of request.iceCandidates) {
|
|
162173
|
+
await this.state.bridge.addControllerIceCandidate(
|
|
162174
|
+
request.webRtcSessionId,
|
|
162175
|
+
c.candidate,
|
|
162176
|
+
c.sdpMid
|
|
162177
|
+
);
|
|
162178
|
+
}
|
|
162179
|
+
}
|
|
162180
|
+
async endSession(request) {
|
|
162181
|
+
await this.state.bridge.endSession(request.webRtcSessionId);
|
|
162182
|
+
this.state.currentSessions = this.state.currentSessions.filter(
|
|
162183
|
+
(s) => s.id !== request.webRtcSessionId
|
|
162184
|
+
);
|
|
162185
|
+
}
|
|
162186
|
+
trackSession(id, streamUsage, peerEndpointId) {
|
|
162187
|
+
const session = this.context.session;
|
|
162188
|
+
this.state.currentSessions = [
|
|
162189
|
+
...this.state.currentSessions,
|
|
162190
|
+
{
|
|
162191
|
+
id,
|
|
162192
|
+
peerNodeId: session?.peerNodeId ?? NodeId(0),
|
|
162193
|
+
peerEndpointId,
|
|
162194
|
+
streamUsage,
|
|
162195
|
+
metadataEnabled: false,
|
|
162196
|
+
fabricIndex: session?.associatedFabric?.fabricIndex ?? FabricIndex3(0)
|
|
162197
|
+
}
|
|
162198
|
+
];
|
|
162199
|
+
}
|
|
162200
|
+
};
|
|
162201
|
+
((CameraWebRtcProviderServer2) => {
|
|
162202
|
+
class State extends WebRtcTransportProviderServer.State {
|
|
162203
|
+
bridge;
|
|
162204
|
+
entityId;
|
|
162205
|
+
nextSessionId = 1;
|
|
162206
|
+
}
|
|
162207
|
+
CameraWebRtcProviderServer2.State = State;
|
|
162208
|
+
})(CameraWebRtcProviderServer || (CameraWebRtcProviderServer = {}));
|
|
162209
|
+
|
|
162210
|
+
// src/plugins/builtin/camera/camera-endpoint.ts
|
|
162211
|
+
function createCameraEndpointType(bridge, entityId) {
|
|
162212
|
+
return CameraDevice.with(
|
|
162213
|
+
CameraAvStreamServer,
|
|
162214
|
+
CameraWebRtcProviderServer
|
|
162215
|
+
).set({
|
|
162216
|
+
webRtcTransportProvider: {
|
|
162217
|
+
bridge,
|
|
162218
|
+
entityId,
|
|
162219
|
+
currentSessions: [],
|
|
162220
|
+
nextSessionId: 1
|
|
162221
|
+
},
|
|
162222
|
+
cameraAvStreamManagement: {
|
|
162223
|
+
bridge,
|
|
162224
|
+
entityId,
|
|
162225
|
+
supportedStreamUsages: [StreamUsage.LiveView],
|
|
162226
|
+
streamUsagePriorities: [StreamUsage.LiveView],
|
|
162227
|
+
allocatedVideoStreams: [],
|
|
162228
|
+
allocatedAudioStreams: [],
|
|
162229
|
+
allocatedSnapshotStreams: [],
|
|
162230
|
+
maxConcurrentEncoders: 1,
|
|
162231
|
+
maxEncodedPixelRate: 3840 * 2160 * 30,
|
|
162232
|
+
maxNetworkBandwidth: 2e4,
|
|
162233
|
+
currentFrameRate: 0,
|
|
162234
|
+
nextVideoStreamId: 1,
|
|
162235
|
+
nextAudioStreamId: 1,
|
|
162236
|
+
nextSnapshotStreamId: 1
|
|
162237
|
+
}
|
|
162238
|
+
});
|
|
162239
|
+
}
|
|
162240
|
+
|
|
162241
|
+
// src/plugins/builtin/camera/webrtc-bridge.ts
|
|
162242
|
+
import {
|
|
162243
|
+
createConnection as createConnection3,
|
|
162244
|
+
createLongLivedTokenAuth as createLongLivedTokenAuth2
|
|
162245
|
+
} from "home-assistant-js-websocket";
|
|
162246
|
+
import { RTCPeerConnection } from "werift";
|
|
162247
|
+
var WebRtcBridge = class {
|
|
162248
|
+
constructor(config11) {
|
|
162249
|
+
this.config = config11;
|
|
162250
|
+
}
|
|
162251
|
+
config;
|
|
162252
|
+
connection;
|
|
162253
|
+
sessions = /* @__PURE__ */ new Map();
|
|
162254
|
+
async ha() {
|
|
162255
|
+
if (this.connection) return this.connection;
|
|
162256
|
+
const auth = createLongLivedTokenAuth2(
|
|
162257
|
+
this.config.haUrl,
|
|
162258
|
+
this.config.haToken
|
|
162259
|
+
);
|
|
162260
|
+
this.connection = await createConnection3({ auth });
|
|
162261
|
+
return this.connection;
|
|
162262
|
+
}
|
|
162263
|
+
// We offer to the controller; it answers. Pulls HA media first, then forwards.
|
|
162264
|
+
async startSession(matterSessionId, entityId) {
|
|
162265
|
+
const haPeer = new RTCPeerConnection();
|
|
162266
|
+
const controllerPeer = new RTCPeerConnection();
|
|
162267
|
+
haPeer.onTrack.subscribe((track) => {
|
|
162268
|
+
const transceiver = controllerPeer.addTransceiver(
|
|
162269
|
+
track.kind,
|
|
162270
|
+
{ direction: "sendonly" }
|
|
162271
|
+
);
|
|
162272
|
+
track.onReceiveRtp.subscribe((rtp) => transceiver.sender.sendRtp(rtp));
|
|
162273
|
+
});
|
|
162274
|
+
haPeer.addTransceiver("video", { direction: "recvonly" });
|
|
162275
|
+
haPeer.addTransceiver("audio", { direction: "recvonly" });
|
|
162276
|
+
const haOffer = await haPeer.createOffer();
|
|
162277
|
+
await haPeer.setLocalDescription(haOffer);
|
|
162278
|
+
const haAnswer = await this.requestHaWebRtc(entityId, haOffer.sdp);
|
|
162279
|
+
await haPeer.setRemoteDescription({ type: "answer", sdp: haAnswer });
|
|
162280
|
+
const controllerOffer = await controllerPeer.createOffer();
|
|
162281
|
+
await controllerPeer.setLocalDescription(controllerOffer);
|
|
162282
|
+
const iceCandidates = [];
|
|
162283
|
+
controllerPeer.onIceCandidate.subscribe((c) => {
|
|
162284
|
+
if (c?.candidate)
|
|
162285
|
+
iceCandidates.push({
|
|
162286
|
+
candidate: c.candidate,
|
|
162287
|
+
sdpMid: c.sdpMid ?? null
|
|
162288
|
+
});
|
|
162289
|
+
});
|
|
162290
|
+
this.sessions.set(matterSessionId, {
|
|
162291
|
+
entityId,
|
|
162292
|
+
haPeer,
|
|
162293
|
+
controllerPeer
|
|
162294
|
+
});
|
|
162295
|
+
return { sdp: controllerOffer.sdp, iceCandidates };
|
|
162296
|
+
}
|
|
162297
|
+
// ProvideOffer flow: controller sent its offer. Pull HA media, answer it.
|
|
162298
|
+
// Returning the answer to the controller is the unverified Requestor path.
|
|
162299
|
+
async acceptControllerOffer(matterSessionId, entityId, controllerOfferSdp) {
|
|
162300
|
+
const haPeer = new RTCPeerConnection();
|
|
162301
|
+
const controllerPeer = new RTCPeerConnection();
|
|
162302
|
+
haPeer.onTrack.subscribe((track) => {
|
|
162303
|
+
const transceiver = controllerPeer.addTransceiver(track.kind, {
|
|
162304
|
+
direction: "sendonly"
|
|
162305
|
+
});
|
|
162306
|
+
track.onReceiveRtp.subscribe((rtp) => transceiver.sender.sendRtp(rtp));
|
|
162307
|
+
});
|
|
162308
|
+
this.sessions.set(matterSessionId, { entityId, haPeer, controllerPeer });
|
|
162309
|
+
haPeer.addTransceiver("video", { direction: "recvonly" });
|
|
162310
|
+
haPeer.addTransceiver("audio", { direction: "recvonly" });
|
|
162311
|
+
const haOffer = await haPeer.createOffer();
|
|
162312
|
+
await haPeer.setLocalDescription(haOffer);
|
|
162313
|
+
const haAnswer = await this.requestHaWebRtc(entityId, haOffer.sdp);
|
|
162314
|
+
await haPeer.setRemoteDescription({ type: "answer", sdp: haAnswer });
|
|
162315
|
+
await controllerPeer.setRemoteDescription({
|
|
162316
|
+
type: "offer",
|
|
162317
|
+
sdp: controllerOfferSdp
|
|
162318
|
+
});
|
|
162319
|
+
const answer = await controllerPeer.createAnswer();
|
|
162320
|
+
await controllerPeer.setLocalDescription(answer);
|
|
162321
|
+
return answer.sdp;
|
|
162322
|
+
}
|
|
162323
|
+
/** Apply the Matter controller's SDP answer to the controller peer. */
|
|
162324
|
+
async acceptControllerAnswer(matterSessionId, sdp) {
|
|
162325
|
+
const session = this.sessions.get(matterSessionId);
|
|
162326
|
+
if (!session) return;
|
|
162327
|
+
await session.controllerPeer.setRemoteDescription({ type: "answer", sdp });
|
|
162328
|
+
}
|
|
162329
|
+
/** Add a remote ICE candidate from the Matter controller. */
|
|
162330
|
+
async addControllerIceCandidate(matterSessionId, candidate, sdpMid) {
|
|
162331
|
+
const session = this.sessions.get(matterSessionId);
|
|
162332
|
+
if (!session) return;
|
|
162333
|
+
await session.controllerPeer.addIceCandidate({
|
|
162334
|
+
candidate,
|
|
162335
|
+
sdpMid: sdpMid ?? void 0
|
|
162336
|
+
});
|
|
162337
|
+
}
|
|
162338
|
+
async endSession(matterSessionId) {
|
|
162339
|
+
const session = this.sessions.get(matterSessionId);
|
|
162340
|
+
if (!session) return;
|
|
162341
|
+
this.sessions.delete(matterSessionId);
|
|
162342
|
+
await session.haPeer.close();
|
|
162343
|
+
await session.controllerPeer.close();
|
|
162344
|
+
if (session.haSessionId) {
|
|
162345
|
+
try {
|
|
162346
|
+
const conn = await this.ha();
|
|
162347
|
+
await conn.sendMessagePromise({
|
|
162348
|
+
type: "camera/webrtc/candidate",
|
|
162349
|
+
entity_id: session.entityId,
|
|
162350
|
+
session_id: session.haSessionId,
|
|
162351
|
+
candidate: { candidate: "" }
|
|
162352
|
+
});
|
|
162353
|
+
} catch {
|
|
162354
|
+
}
|
|
162355
|
+
}
|
|
162356
|
+
}
|
|
162357
|
+
// Grab a still JPEG via HA's camera proxy (for CaptureSnapshot).
|
|
162358
|
+
async snapshot(entityId) {
|
|
162359
|
+
const url2 = `${this.config.haUrl}/api/camera_proxy/${entityId}`;
|
|
162360
|
+
const res = await fetch(url2, {
|
|
162361
|
+
headers: { Authorization: `Bearer ${this.config.haToken}` }
|
|
162362
|
+
});
|
|
162363
|
+
if (!res.ok) {
|
|
162364
|
+
throw new Error(`HA camera_proxy ${entityId}: ${res.status}`);
|
|
162365
|
+
}
|
|
162366
|
+
return new Uint8Array(await res.arrayBuffer());
|
|
162367
|
+
}
|
|
162368
|
+
async close() {
|
|
162369
|
+
for (const id of [...this.sessions.keys()]) {
|
|
162370
|
+
await this.endSession(id);
|
|
162371
|
+
}
|
|
162372
|
+
this.connection?.close();
|
|
162373
|
+
this.connection = void 0;
|
|
162374
|
+
}
|
|
162375
|
+
// Offer to HA's WebRTC, resolve on the first answer event off the same sub.
|
|
162376
|
+
async requestHaWebRtc(entityId, offerSdp) {
|
|
162377
|
+
const conn = await this.ha();
|
|
162378
|
+
return new Promise((resolve11, reject) => {
|
|
162379
|
+
let settled = false;
|
|
162380
|
+
conn.subscribeMessage(
|
|
162381
|
+
(msg) => {
|
|
162382
|
+
if (msg.type === "answer" && msg.answer && !settled) {
|
|
162383
|
+
settled = true;
|
|
162384
|
+
const session = [...this.sessions.values()].find(
|
|
162385
|
+
(s) => s.entityId === entityId
|
|
162386
|
+
);
|
|
162387
|
+
if (session && msg.session_id) {
|
|
162388
|
+
session.haSessionId = msg.session_id;
|
|
162389
|
+
}
|
|
162390
|
+
resolve11(msg.answer);
|
|
162391
|
+
}
|
|
162392
|
+
},
|
|
162393
|
+
{ type: "camera/webrtc/offer", entity_id: entityId, offer: offerSdp }
|
|
162394
|
+
).catch(reject);
|
|
162395
|
+
});
|
|
162396
|
+
}
|
|
162397
|
+
};
|
|
162398
|
+
|
|
162399
|
+
// src/plugins/builtin/camera/camera-plugin.ts
|
|
162400
|
+
var CONFIG_KEY = "config";
|
|
162401
|
+
var CameraPlugin = class {
|
|
162402
|
+
name = "camera";
|
|
162403
|
+
version = "0.1.0";
|
|
162404
|
+
log = Logger.get("CameraPlugin");
|
|
162405
|
+
context;
|
|
162406
|
+
bridge;
|
|
162407
|
+
deviceIds = [];
|
|
162408
|
+
config;
|
|
162409
|
+
constructor(config11 = {}) {
|
|
162410
|
+
this.config = config11;
|
|
162411
|
+
}
|
|
162412
|
+
async onStart(context) {
|
|
162413
|
+
this.context = context;
|
|
162414
|
+
const stored = await context.storage.get(CONFIG_KEY);
|
|
162415
|
+
this.config = { ...this.config, ...stored ?? {} };
|
|
162416
|
+
await this.apply();
|
|
162417
|
+
}
|
|
162418
|
+
async onConfigChanged(config11) {
|
|
162419
|
+
this.config = config11;
|
|
162420
|
+
await this.context?.storage.set(CONFIG_KEY, this.config);
|
|
162421
|
+
await this.apply();
|
|
162422
|
+
}
|
|
162423
|
+
async onShutdown() {
|
|
162424
|
+
await this.teardown();
|
|
162425
|
+
}
|
|
162426
|
+
getConfigSchema() {
|
|
162427
|
+
return {
|
|
162428
|
+
title: "Camera",
|
|
162429
|
+
description: "Expose Home Assistant cameras as Matter cameras.",
|
|
162430
|
+
properties: {
|
|
162431
|
+
haUrl: {
|
|
162432
|
+
type: "string",
|
|
162433
|
+
title: "Home Assistant URL",
|
|
162434
|
+
description: "e.g. http://homeassistant.local:8123",
|
|
162435
|
+
required: true
|
|
162436
|
+
},
|
|
162437
|
+
haToken: {
|
|
162438
|
+
type: "string",
|
|
162439
|
+
title: "Long-lived access token",
|
|
162440
|
+
required: true
|
|
162441
|
+
},
|
|
162442
|
+
cameras: {
|
|
162443
|
+
type: "string",
|
|
162444
|
+
title: "Camera entity ids (comma-separated)",
|
|
162445
|
+
description: "e.g. camera.front,camera.garage"
|
|
162446
|
+
}
|
|
162447
|
+
}
|
|
162448
|
+
};
|
|
162449
|
+
}
|
|
162450
|
+
// (Re)build all camera endpoints from the current config.
|
|
162451
|
+
async apply() {
|
|
162452
|
+
const context = this.context;
|
|
162453
|
+
if (!context) return;
|
|
162454
|
+
await this.teardown();
|
|
162455
|
+
const { haUrl, haToken, cameras } = this.config;
|
|
162456
|
+
if (!haUrl || !haToken) {
|
|
162457
|
+
this.log.info("haUrl and haToken not set, no cameras exposed");
|
|
162458
|
+
return;
|
|
162459
|
+
}
|
|
162460
|
+
const entityIds = (cameras ?? "").split(",").map((s) => s.trim()).filter(Boolean);
|
|
162461
|
+
if (entityIds.length === 0) {
|
|
162462
|
+
this.log.info("no camera entity ids configured");
|
|
162463
|
+
return;
|
|
162464
|
+
}
|
|
162465
|
+
this.bridge = new WebRtcBridge({ haUrl, haToken });
|
|
162466
|
+
for (const entityId of entityIds) {
|
|
162467
|
+
const id = entityId.replace(/\./g, "_");
|
|
162468
|
+
await context.registerDevice({
|
|
162469
|
+
id,
|
|
162470
|
+
name: entityId,
|
|
162471
|
+
endpointType: createCameraEndpointType(this.bridge, entityId),
|
|
162472
|
+
clusters: []
|
|
162473
|
+
});
|
|
162474
|
+
this.deviceIds.push(id);
|
|
162475
|
+
}
|
|
162476
|
+
this.log.info(`Exposed ${this.deviceIds.length} camera(s)`);
|
|
162477
|
+
}
|
|
162478
|
+
async teardown() {
|
|
162479
|
+
for (const id of this.deviceIds) {
|
|
162480
|
+
await this.context?.unregisterDevice(id).catch(() => {
|
|
162481
|
+
});
|
|
162482
|
+
}
|
|
162483
|
+
this.deviceIds = [];
|
|
162484
|
+
await this.bridge?.close().catch(() => {
|
|
162485
|
+
});
|
|
162486
|
+
this.bridge = void 0;
|
|
162487
|
+
}
|
|
162488
|
+
};
|
|
162489
|
+
|
|
162024
162490
|
// src/services/bridges/bridge-endpoint-manager.ts
|
|
162025
162491
|
init_diagnostic_event_bus();
|
|
162026
162492
|
|
|
@@ -162450,10 +162916,21 @@ var BridgeEndpointManager = class extends Service {
|
|
|
162450
162916
|
}
|
|
162451
162917
|
async startPlugins() {
|
|
162452
162918
|
if (!this.pluginManager) return;
|
|
162919
|
+
await this.registerBuiltInPlugins();
|
|
162453
162920
|
await this.loadRegisteredPlugins();
|
|
162454
162921
|
await this.pluginManager.startAll();
|
|
162455
162922
|
await this.pluginManager.configureAll();
|
|
162456
162923
|
}
|
|
162924
|
+
// Built-in plugins ship inside the backend bundle, so they share the same
|
|
162925
|
+
// matter.js instance and can hand over live EndpointTypes.
|
|
162926
|
+
async registerBuiltInPlugins() {
|
|
162927
|
+
if (!this.pluginManager) return;
|
|
162928
|
+
try {
|
|
162929
|
+
await this.pluginManager.registerBuiltIn(new CameraPlugin());
|
|
162930
|
+
} catch (e) {
|
|
162931
|
+
this.log.warn("Failed to register built-in camera plugin:", e);
|
|
162932
|
+
}
|
|
162933
|
+
}
|
|
162457
162934
|
async loadRegisteredPlugins() {
|
|
162458
162935
|
if (!this.pluginManager || !this.pluginRegistry || !this.pluginInstaller)
|
|
162459
162936
|
return;
|
|
@@ -466,4 +466,4 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
|
|
|
466
466
|
To pick up a draggable item, press the space bar.
|
|
467
467
|
While dragging, use the arrow keys to move the item.
|
|
468
468
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
469
|
-
`},g2e={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function _2e(e){let{announcements:t=g2e,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=h2e}=e,{announce:a,announcement:o}=d2e(),s=p9(`DndLiveRegion`),[c,l]=(0,C.useState)(!1);if((0,C.useEffect)(()=>{l(!0)},[]),p2e((0,C.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=C.createElement(C.Fragment,null,C.createElement(l2e,{id:r,value:i.draggable}),C.createElement(u2e,{id:s,announcement:o}));return n?(0,ba.createPortal)(u,n):u}var y9;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(y9||={});function b9(){}function v2e(e,t){return(0,C.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function y2e(){var e=[...arguments];return(0,C.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var x9=Object.freeze({x:0,y:0});function b2e(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function x2e(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function S2e(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function C2e(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function w2e(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function T2e(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var E2e=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=T2e(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=b2e(T2e(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(x2e)},D2e=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=C2e(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=C2e(r),o=i.reduce((e,t,r)=>e+b2e(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(x2e)};function O2e(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var k2e=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=O2e(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(S2e)};function A2e(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function j2e(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:x9}function M2e(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var N2e=M2e(1);function P2e(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function F2e(e,t,n){let r=P2e(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var I2e={ignoreTransform:!1};function S9(e,t){t===void 0&&(t=I2e);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=n9(e).getComputedStyle(e);t&&(n=F2e(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function L2e(e){return S9(e,{ignoreTransform:!0})}function R2e(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function z2e(e,t){return t===void 0&&(t=n9(e).getComputedStyle(e)),t.position===`fixed`}function B2e(e,t){t===void 0&&(t=n9(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function C9(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(r9(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!i9(i)||t2e(i)||n.includes(i))return n;let a=n9(e).getComputedStyle(i);return i!==e&&B2e(i,a)&&n.push(i),z2e(i,a)?n:r(i.parentNode)}return e?r(e):n}function V2e(e){let[t]=C9(e,1);return t??null}function w9(e){return!$7||!e?null:e9(e)?e:t9(e)?r9(e)||e===a9(e).scrollingElement?window:i9(e)?e:null:null}function H2e(e){return e9(e)?e.scrollX:e.scrollLeft}function U2e(e){return e9(e)?e.scrollY:e.scrollTop}function T9(e){return{x:H2e(e),y:U2e(e)}}var E9;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(E9||={});function W2e(e){return!$7||!e?!1:e===document.scrollingElement}function G2e(e){let t={x:0,y:0},n=W2e(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var K2e={x:.2,y:.2};function q2e(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=K2e);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=G2e(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=E9.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=E9.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=E9.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=E9.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function J2e(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function Y2e(e){return e.reduce((e,t)=>m9(e,T9(t)),x9)}function X2e(e){return e.reduce((e,t)=>e+H2e(t),0)}function Z2e(e){return e.reduce((e,t)=>e+U2e(t),0)}function Q2e(e,t){if(t===void 0&&(t=S9),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);V2e(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var $2e=[[`x`,[`left`,`right`],X2e],[`y`,[`top`,`bottom`],Z2e]],D9=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=C9(t),r=Y2e(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of $2e)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,`rect`,{enumerable:!1})}},O9=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function e4e(e){let{EventTarget:t}=n9(e);return e instanceof t?e:a9(e)}function k9(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var A9;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(A9||={});function t4e(e){e.preventDefault()}function n4e(e){e.stopPropagation()}var j9;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(j9||={});var r4e={start:[j9.Space,j9.Enter],cancel:[j9.Esc],end:[j9.Space,j9.Enter,j9.Tab]},i4e=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case j9.Right:return{...n,x:n.x+25};case j9.Left:return{...n,x:n.x-25};case j9.Down:return{...n,y:n.y+25};case j9.Up:return{...n,y:n.y-25}}},M9=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new O9(a9(t)),this.windowListeners=new O9(n9(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(A9.Resize,this.handleCancel),this.windowListeners.add(A9.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(A9.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&Q2e(n),t(x9)}handleKeyDown(e){if(g9(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=r4e,coordinateGetter:a=i4e,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:x9;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=h9(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=G2e(n),p=J2e(n),m={x:Math.min(i===j9.Right?p.right-p.width/2:p.right,Math.max(i===j9.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===j9.Down?p.bottom-p.height/2:p.bottom,Math.max(i===j9.Down?p.top:p.top+p.height/2,u.y))},h=i===j9.Right&&!s||i===j9.Left&&!c,g=i===j9.Down&&!l||i===j9.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===j9.Right&&e<=d.x||i===j9.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===j9.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===j9.Down&&e<=d.y||i===j9.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===j9.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,m9(h9(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};M9.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=r4e,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function a4e(e){return!!(e&&`distance`in e)}function o4e(e){return!!(e&&`delay`in e)}var N9=class{constructor(e,t,n){n===void 0&&(n=e4e(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=a9(i),this.documentListeners=new O9(this.document),this.listeners=new O9(n),this.windowListeners=new O9(n9(i)),this.initialCoordinates=_9(r)??x9,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(A9.Resize,this.handleCancel),this.windowListeners.add(A9.DragStart,t4e),this.windowListeners.add(A9.VisibilityChange,this.handleCancel),this.windowListeners.add(A9.ContextMenu,t4e),this.documentListeners.add(A9.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(o4e(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(a4e(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(A9.Click,n4e,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(A9.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=_9(e)??x9,s=h9(n,o);if(!t&&a){if(a4e(a)){if(a.tolerance!=null&&k9(s,a.tolerance))return this.handleCancel();if(k9(s,a.distance))return this.handleStart()}if(o4e(a)&&k9(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===j9.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},s4e={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},P9=class extends N9{constructor(e){let{event:t}=e,n=a9(t.target);super(e,s4e,n)}};P9.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var c4e={move:{name:`mousemove`},end:{name:`mouseup`}},l4e;(function(e){e[e.RightClick=2]=`RightClick`})(l4e||={});var u4e=class extends N9{constructor(e){super(e,c4e,a9(e.event.target))}};u4e.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===l4e.RightClick?!1:(r?.({event:n}),!0)}}];var F9={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},d4e=class extends N9{constructor(e){super(e,F9)}static setup(){return window.addEventListener(F9.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(F9.move.name,e)};function e(){}}};d4e.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var I9;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(I9||={});var L9;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(L9||={});function f4e(e){let{acceleration:t,activator:n=I9.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=L9.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=m4e({delta:d,disabled:!a}),[m,h]=n2e(),g=(0,C.useRef)({x:0,y:0}),_=(0,C.useRef)({x:0,y:0}),v=(0,C.useMemo)(()=>{switch(n){case I9.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case I9.DraggableRect:return i}},[n,i,c]),y=(0,C.useRef)(null),b=(0,C.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,C.useMemo)(()=>s===L9.TreeOrder?[...l].reverse():l,[s,l]);(0,C.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of x){if(r?.(e)===!1)continue;let n=u[l.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=q2e(e,n,v,t,f);for(let e of[`x`,`y`])p[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0){h(),y.current=e,m(b,o),g.current=a,_.current=i;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,x,u,JSON.stringify(f)])}var p4e={x:{[E9.Backward]:!1,[E9.Forward]:!1},y:{[E9.Backward]:!1,[E9.Forward]:!1}};function m4e(e){let{delta:t,disabled:n}=e,r=d9(t);return l9(e=>{if(n||!r||!e)return p4e;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[E9.Backward]:e.x[E9.Backward]||i.x===-1,[E9.Forward]:e.x[E9.Forward]||i.x===1},y:{[E9.Backward]:e.y[E9.Backward]||i.y===-1,[E9.Forward]:e.y[E9.Forward]||i.y===1}}},[n,t,r])}function h4e(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return l9(e=>t==null?null:r??e??null,[r,t])}function g4e(e,t){return(0,C.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var R9;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(R9||={});var _4e;(function(e){e.Optimized=`optimized`})(_4e||={});var v4e=new Map;function y4e(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,C.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,C.useRef)(e),d=g(),f=c9(d),p=(0,C.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,C.useRef)(null),h=l9(t=>{if(d&&!n)return v4e;if(!t||t===v4e||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new D9(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,C.useEffect)(()=>{u.current=e},[e]),(0,C.useEffect)(()=>{d||p()},[n,d]),(0,C.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,C.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case R9.Always:return!1;case R9.BeforeDragging:return n;default:return!n}}}function b4e(e,t){return l9(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function x4e(e,t){return b4e(e,t)}function S4e(e){let{callback:t,disabled:n}=e,r=s9(t),i=(0,C.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,C.useEffect)(()=>()=>i?.disconnect(),[i]),i}function z9(e){let{callback:t,disabled:n}=e,r=s9(t),i=(0,C.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,C.useEffect)(()=>()=>i?.disconnect(),[i]),i}function C4e(e){return new D9(S9(e),e)}function w4e(e,t,n){t===void 0&&(t=C4e);let[r,i]=(0,C.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=S4e({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=z9({callback:a});return o9(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function T4e(e){return j2e(e,b4e(e))}var E4e=[];function D4e(e){let t=(0,C.useRef)(e),n=l9(n=>e?n&&n!==E4e&&e&&t.current&&e.parentNode===t.current.parentNode?n:C9(e):E4e,[e]);return(0,C.useEffect)(()=>{t.current=e},[e]),n}function O4e(e){let[t,n]=(0,C.useState)(null),r=(0,C.useRef)(e),i=(0,C.useCallback)(e=>{let t=w9(e.target);t&&n(e=>e?(e.set(t,T9(t)),new Map(e)):null)},[]);return(0,C.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=w9(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,T9(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{w9(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,C.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>m9(e,t),x9):Y2e(e):x9,[e,t])}function k4e(e,t){t===void 0&&(t=[]);let n=(0,C.useRef)(null);return(0,C.useEffect)(()=>{n.current=null},t),(0,C.useEffect)(()=>{let t=e!==x9;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?h9(e,n.current):x9}function A4e(e){(0,C.useEffect)(()=>{if(!$7)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function j4e(e,t){return(0,C.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function M4e(e){return(0,C.useMemo)(()=>e?R2e(e):null,[e])}var N4e=[];function P4e(e,t){t===void 0&&(t=S9);let[n]=e,r=M4e(n?n9(n):null),[i,a]=(0,C.useState)(N4e);function o(){a(()=>e.length?e.map(e=>W2e(e)?r:new D9(t(e),e)):N4e)}let s=z9({callback:o});return o9(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function F4e(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return i9(t)?t:e}function I4e(e){let{measure:t}=e,[n,r]=(0,C.useState)(null),i=z9({callback:(0,C.useCallback)(e=>{for(let{target:n}of e)if(i9(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=u9((0,C.useCallback)(e=>{let n=F4e(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,C.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var L4e=[{sensor:P9,options:{}},{sensor:M9,options:{}}],R4e={current:{}},B9={draggable:{measure:L2e},droppable:{measure:L2e,strategy:R9.WhileDragging,frequency:_4e.Optimized},dragOverlay:{measure:S9}},V9=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},z4e={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new V9,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:b9},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:B9,measureDroppableContainers:b9,windowRect:null,measuringScheduled:!1},B4e={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:b9,draggableNodes:new Map,over:null,measureDroppableContainers:b9},H9=(0,C.createContext)(B4e),V4e=(0,C.createContext)(z4e);function H4e(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new V9}}}function U4e(e,t){switch(t.type){case y9.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case y9.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case y9.DragEnd:case y9.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case y9.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new V9(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case y9.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new V9(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case y9.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new V9(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function W4e(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,C.useContext)(H9),a=d9(r),o=d9(n?.id);return(0,C.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!g9(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=s2e(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function G4e(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function K4e(e){return(0,C.useMemo)(()=>({draggable:{...B9.draggable,...e?.draggable},droppable:{...B9.droppable,...e?.droppable},dragOverlay:{...B9.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function q4e(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,C.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;o9(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=j2e(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=V2e(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var J4e=(0,C.createContext)({...x9,scaleX:1,scaleY:1}),U9;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(U9||={});var Y4e=(0,C.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=L4e,collisionDetection:o=k2e,measuring:s,modifiers:c,...l}=e,[u,d]=(0,C.useReducer)(U4e,void 0,H4e),[f,p]=m2e(),[m,h]=(0,C.useState)(U9.Uninitialized),g=m===U9.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,C.useRef)({initial:null,translated:null}),w=(0,C.useMemo)(()=>_==null?null:{id:_,data:x?.data??R4e,rect:S},[_,x]),T=(0,C.useRef)(null),[E,D]=(0,C.useState)(null),[O,k]=(0,C.useState)(null),A=c9(l,Object.values(l)),j=p9(`DndDescribedBy`,t),M=(0,C.useMemo)(()=>b.getEnabled(),[b]),N=K4e(s),{droppableRects:P,measureDroppableContainers:F,measuringScheduled:I}=y4e(M,{dragging:g,dependencies:[y.x,y.y],config:N.droppable}),L=h4e(v,_),R=(0,C.useMemo)(()=>O?_9(O):null,[O]),ee=Ee(),z=x4e(L,N.draggable.measure);q4e({activeNode:_==null?null:v.get(_),config:ee.layoutShiftCompensation,initialRect:z,measure:N.draggable.measure});let te=w4e(L,N.draggable.measure,z),B=w4e(L?L.parentElement:null),V=(0,C.useRef)({activatorEvent:null,active:null,activeNode:L,collisionRect:null,collisions:null,droppableRects:P,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ne=b.getNodeFor(V.current.over?.id),re=I4e({measure:N.dragOverlay.measure}),ie=re.nodeRef.current??L,ae=g?re.rect??te:null,oe=!!(re.nodeRef.current&&re.rect),se=T4e(oe?null:te),ce=M4e(ie?n9(ie):null),le=D4e(g?ne??L:null),ue=P4e(le),de=G4e(c,{transform:{x:y.x-se.x,y:y.y-se.y,scaleX:1,scaleY:1},activatorEvent:O,active:w,activeNodeRect:te,containerNodeRect:B,draggingNodeRect:ae,over:V.current.over,overlayNodeRect:re.rect,scrollableAncestors:le,scrollableAncestorRects:ue,windowRect:ce}),fe=R?m9(R,y):null,pe=O4e(le),H=k4e(pe),me=k4e(pe,[te]),he=m9(de,H),U=ae?N2e(ae,de):null,ge=w&&U?o({active:w,collisionRect:U,droppableRects:P,droppableContainers:M,pointerCoordinates:fe}):null,_e=w2e(ge,`id`),[ve,ye]=(0,C.useState)(null),be=A2e(oe?de:m9(de,me),ve?.rect??null,te),xe=(0,C.useRef)(null),Se=(0,C.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(T.current==null)return;let i=v.get(T.current);if(!i)return;let a=e.nativeEvent;xe.current=new n({active:T.current,activeNode:i,event:a,options:r,context:V,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=A.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=A.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=T.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=A.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:S}};(0,ba.unstable_batchedUpdates)(()=>{r?.(i),h(U9.Initializing),d({type:y9.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),D(xe.current),k(a)})},onMove(e){d({type:y9.DragMove,coordinates:e})},onEnd:o(y9.DragEnd),onCancel:o(y9.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=V.current,o=null;if(t&&i){let{cancelDrop:s}=A.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===y9.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=y9.DragCancel)}T.current=null,(0,ba.unstable_batchedUpdates)(()=>{d({type:e}),h(U9.Uninitialized),ye(null),D(null),k(null),xe.current=null;let t=e===y9.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=A.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),Ce=g4e(a,(0,C.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(T.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},T.current=r,Se(n,t))},[v,Se]));A4e(a),o9(()=>{te&&m===U9.Initializing&&h(U9.Initialized)},[te,m]),(0,C.useEffect)(()=>{let{onDragMove:e}=A.current,{active:t,activatorEvent:n,collisions:r,over:i}=V.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:he.x,y:he.y},over:i};(0,ba.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[he.x,he.y]),(0,C.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=V.current;if(!e||T.current==null||!t||!i)return;let{onDragOver:a}=A.current,o=r.get(_e),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,ba.unstable_batchedUpdates)(()=>{ye(s),a?.(c),f({type:`onDragOver`,event:c})})},[_e]),o9(()=>{V.current={activatorEvent:O,active:w,activeNode:L,collisionRect:U,collisions:ge,droppableRects:P,draggableNodes:v,draggingNode:ie,draggingNodeRect:ae,droppableContainers:b,over:ve,scrollableAncestors:le,scrollAdjustedTranslate:he},S.current={initial:ae,translated:U}},[w,L,ge,U,v,ie,ae,P,b,ve,le,he]),f4e({...ee,delta:y,draggingRect:U,pointerCoordinates:fe,scrollableAncestors:le,scrollableAncestorRects:ue});let we=(0,C.useMemo)(()=>({active:w,activeNode:L,activeNodeRect:te,activatorEvent:O,collisions:ge,containerNodeRect:B,dragOverlay:re,draggableNodes:v,droppableContainers:b,droppableRects:P,over:ve,measureDroppableContainers:F,scrollableAncestors:le,scrollableAncestorRects:ue,measuringConfiguration:N,measuringScheduled:I,windowRect:ce}),[w,L,te,O,ge,B,re,v,b,P,ve,F,le,ue,N,I,ce]),Te=(0,C.useMemo)(()=>({activatorEvent:O,activators:Ce,active:w,activeNodeRect:te,ariaDescribedById:{draggable:j},dispatch:d,draggableNodes:v,over:ve,measureDroppableContainers:F}),[O,Ce,w,te,d,j,v,ve,F]);return C.createElement(f2e.Provider,{value:p},C.createElement(H9.Provider,{value:Te},C.createElement(V4e.Provider,{value:we},C.createElement(J4e.Provider,{value:be},i)),C.createElement(W4e,{disabled:n?.restoreFocus===!1})),C.createElement(_2e,{...n,hiddenTextDescribedById:j}));function Ee(){let e=E?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),X4e=(0,C.createContext)(null),Z4e=`button`,Q4e=`Draggable`;function $4e(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=p9(Q4e),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,C.useContext)(H9),{role:p=Z4e,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,C.useContext)(g?J4e:X4e),[v,y]=u9(),[b,x]=u9(),S=j4e(o,t),w=c9(n);return o9(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:w}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,C.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===Z4e?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:S,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function e3e(){return(0,C.useContext)(V4e)}var t3e=`Droppable`,n3e={timeout:25};function r3e(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=p9(t3e),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,C.useContext)(H9),u=(0,C.useRef)({disabled:n}),d=(0,C.useRef)(!1),f=(0,C.useRef)(null),p=(0,C.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...n3e,...i},_=c9(h??r),v=z9({callback:(0,C.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=u9((0,C.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=c9(t);return(0,C.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,C.useEffect)(()=>(s({type:y9.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:y9.UnregisterDroppable,key:a,id:r})),[r]),(0,C.useEffect)(()=>{n!==u.current.disabled&&(s({type:y9.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function W9(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function i3e(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function G9(e){return e!==null&&e>=0}function a3e(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function o3e(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var s3e=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=W9(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},K9={scaleX:1,scaleY:1},c3e=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...K9}:null}let s=l3e(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...K9}:r<t&&r>=a?{x:0,y:o.height+s,...K9}:{x:0,y:0,...K9}};function l3e(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var u3e=`Sortable`,d3e=C.createContext({activeIndex:-1,containerId:u3e,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:s3e,disabled:{draggable:!1,droppable:!1}});function f3e(e){let{children:t,id:n,items:r,strategy:i=s3e,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=e3e(),d=p9(u3e,n),f=s.rect!==null,p=(0,C.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,C.useRef)(p),v=!a3e(p,_.current),y=g!==-1&&h===-1||v,b=o3e(a);o9(()=>{v&&m&&u(p)},[v,p,m,u]),(0,C.useEffect)(()=>{_.current=p},[p]);let x=(0,C.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:i3e(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return C.createElement(d3e.Provider,{value:x},t)}var p3e=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return W9(n,r,i).indexOf(t)},m3e=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},h3e={duration:200,easing:`ease`},g3e=`transform`,_3e=v9.Transition.toString({property:g3e,duration:0,easing:`linear`}),v3e={roleDescription:`sortable`};function y3e(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,C.useState)(null),s=(0,C.useRef)(n);return o9(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=S9(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,C.useEffect)(()=>{a&&o(null)},[a]),a}function b3e(e){let{animateLayoutChanges:t=m3e,attributes:n,disabled:r,data:i,getNewIndex:a=p3e,id:o,strategy:s,resizeObserverConfig:c,transition:l=h3e}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,C.useContext)(d3e),y=x3e(r,p),b=u.indexOf(o),x=(0,C.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),S=(0,C.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:w,node:T,isOver:E,setNodeRef:D}=r3e({id:o,data:x,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...c}}),{active:O,activatorEvent:k,activeNodeRect:A,attributes:j,setNodeRef:M,listeners:N,isDragging:P,over:F,setActivatorNodeRef:I,transform:L}=$4e({id:o,data:x,attributes:{...v3e,...n},disabled:y.draggable}),R=e2e(D,M),ee=!!O,z=ee&&!m&&G9(f)&&G9(g),te=!_&&P,B=z?(te&&z?L:null)??(s??v)({rects:h,activeNodeRect:A,activeIndex:f,overIndex:g,index:b}):null,V=G9(f)&&G9(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,ne=O?.id,re=(0,C.useRef)({activeId:ne,items:u,newIndex:V,containerId:d}),ie=u!==re.current.items,ae=t({active:O,containerId:d,isDragging:P,isSorting:ee,id:o,index:b,items:u,newIndex:re.current.newIndex,previousItems:re.current.items,previousContainerId:re.current.containerId,transition:l,wasDragging:re.current.activeId!=null}),oe=y3e({disabled:!ae,index:b,node:T,rect:w});return(0,C.useEffect)(()=>{ee&&re.current.newIndex!==V&&(re.current.newIndex=V),d!==re.current.containerId&&(re.current.containerId=d),u!==re.current.items&&(re.current.items=u)},[ee,V,d,u]),(0,C.useEffect)(()=>{if(ne===re.current.activeId)return;if(ne!=null&&re.current.activeId==null){re.current.activeId=ne;return}let e=setTimeout(()=>{re.current.activeId=ne},50);return()=>clearTimeout(e)},[ne]),{active:O,activeIndex:f,attributes:j,data:x,rect:w,index:b,newIndex:V,items:u,isOver:E,isSorting:ee,isDragging:P,listeners:N,node:T,overIndex:g,over:F,setNodeRef:R,setActivatorNodeRef:I,setDroppableNodeRef:D,setDraggableNodeRef:M,transform:oe??B,transition:se()};function se(){if(oe||ie&&re.current.newIndex===b)return _3e;if(!(te&&!g9(k)||!l)&&(ee||ae))return v9.Transition.toString({...l,property:g3e})}}function x3e(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function q9(e){if(!e)return!1;let t=e.data.current;return!!(t&&`sortable`in t&&typeof t.sortable==`object`&&`containerId`in t.sortable&&`items`in t.sortable&&`index`in t.sortable)}var S3e=[j9.Down,j9.Right,j9.Up,j9.Left],C3e=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(S3e.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case j9.Down:r.top<a.top&&t.push(n);break;case j9.Up:r.top>a.top&&t.push(n);break;case j9.Left:r.left>a.left&&t.push(n);break;case j9.Right:r.left<a.left&&t.push(n);break}});let c=D2e({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=w2e(c,`id`);if(l===o?.id&&c.length>1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=C9(c).some((e,t)=>s[t]!==e),i=w3e(e,t),a=T3e(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:h9(u,l)}}}};function w3e(e,t){return!q9(e)||!q9(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function T3e(e,t){return!q9(e)||!q9(t)||!w3e(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}var E3e=({bridge:e,index:t})=>{let{attributes:n,listeners:r,setNodeRef:i,transform:a,transition:o,isDragging:s}=b3e({id:e.id}),[c,l]=(0,C.useState)(!1);return(0,C.useEffect)(()=>{DE(e.id).then(l)},[e.id]),(0,W.jsx)(vv,{ref:i,style:{transform:v9.Transform.toString(a),transition:o,opacity:s?.5:1},variant:`outlined`,sx:{cursor:`grab`,"&:active":{cursor:`grabbing`},bgcolor:s?`action.selected`:`background.paper`,width:`fit-content`},children:(0,W.jsxs)(xv,{sx:{display:`flex`,alignItems:`center`,gap:1.5,py:1,"&:last-child":{pb:1}},children:[(0,W.jsx)(Z,{...n,...r,sx:{display:`flex`,alignItems:`center`,color:`text.secondary`},children:(0,W.jsx)(khe,{})}),(0,W.jsx)(kv,{label:t+1,size:`small`,color:`primary`,sx:{minWidth:32,fontWeight:`bold`}}),c?(0,W.jsx)(Z,{component:`img`,src:OE(e.id),alt:e.name,sx:{width:40,height:40,borderRadius:`50%`,objectFit:`cover`,boxShadow:2}}):(0,W.jsx)(Db,{sx:{bgcolor:PE(e),width:40,height:40,boxShadow:2},children:(0,W.jsx)(NE(e),{sx:{fontSize:24}})}),(0,W.jsxs)(Z,{sx:{flex:1},children:[(0,W.jsx)(Q,{variant:`subtitle1`,fontWeight:500,children:e.name}),(0,W.jsxs)(Q,{variant:`caption`,color:`text.secondary`,children:[`Port: `,e.port,` • Priority: `,e.priority??100]})]})]})})},D3e=()=>{let{t:e}=hs(),t=Xv(),{content:n,isLoading:r}=VT(),i=Kme(),[a,o]=(0,C.useState)([]),[s,c]=(0,C.useState)(!1);(0,C.useEffect)(()=>{n&&(o([...n].sort((e,t)=>(e.priority??100)-(t.priority??100))),c(!1))},[n]);let l=y2e(v2e(P9),v2e(M9,{coordinateGetter:C3e})),u=(0,C.useCallback)(e=>{let{active:t,over:n}=e;n&&t.id!==n.id&&(o(e=>W9(e,e.findIndex(e=>e.id===t.id),e.findIndex(e=>e.id===n.id))),c(!0))},[]),d=(0,C.useCallback)(async()=>{let n=a.map((e,t)=>({id:e.id,priority:(t+1)*10}));try{await i(n),t.show({message:e(`startup.saveSuccess`),severity:`success`}),c(!1)}catch(n){t.show({message:n instanceof Error?n.message:e(`startup.saveFailed`),severity:`error`})}},[a,i,t,e]),f=(0,C.useMemo)(()=>a.map(e=>e.id),[a]);return r?(0,W.jsxs)(Q,{children:[e(`common.loading`),`...`]}):(0,W.jsxs)(Gv,{spacing:3,children:[(0,W.jsx)(Yv,{items:[{name:e(`nav.bridges`),to:Y9.bridges},{name:e(`startup.title`),to:Y9.startup}]}),(0,W.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:2,children:[(0,W.jsx)(pv,{color:`primary`,fontSize:`large`}),(0,W.jsxs)(Z,{children:[(0,W.jsx)(Q,{variant:`h5`,fontWeight:600,children:e(`startup.title`)}),(0,W.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:e(`startup.description`)})]})]}),s&&(0,W.jsx)(Kh,{severity:`info`,action:(0,W.jsx)(_v,{color:`inherit`,size:`small`,startIcon:(0,W.jsx)(_E,{}),onClick:d,children:e(`startup.saveChanges`)}),children:e(`startup.unsavedChanges`)}),(0,W.jsx)(Y4e,{sensors:l,collisionDetection:E2e,onDragEnd:u,children:(0,W.jsx)(f3e,{items:f,strategy:c3e,children:(0,W.jsx)(Gv,{spacing:1,children:a.map((e,t)=>(0,W.jsx)(E3e,{bridge:e,index:t},e.id))})})}),a.length===0&&(0,W.jsx)(Q,{color:`text.secondary`,textAlign:`center`,py:4,children:e(`startup.noBridges`)}),s&&a.length>0&&(0,W.jsx)(Z,{display:`flex`,justifyContent:`flex-end`,children:(0,W.jsx)(_v,{variant:`contained`,startIcon:(0,W.jsx)(_E,{}),onClick:d,children:e(`startup.saveOrder`)})})]})},J9=`https://riddix.github.io/home-assistant-matter-hub`,Y9={dashboard:`/`,bridges:`/bridges`,bridge:e=>`/bridges/${e}`,createBridge:`/bridges/create`,areaSetup:`/bridges/area-setup`,editBridge:e=>`/bridges/${e}/edit`,devices:`/devices`,standaloneDevices:`/standalone-devices`,networkMap:`/network-map`,health:`/health`,labels:`/labels`,lockCredentials:`/lock-credentials`,plugins:`/plugins`,settings:`/settings`,startup:`/startup`,githubRepository:`https://github.com/riddix/home-assistant-matter-hub/`,documentation:J9,support:`${J9}/support`,faq:{multiFabric:`${J9}/connect-multiple-fabrics`,bridgeConfig:`${J9}/bridge-configuration`}},O3e=[{path:``,element:(0,W.jsx)(Sre,{}),children:[{path:``,element:(0,W.jsx)(Xge,{})},{path:Y9.bridges,element:(0,W.jsx)(Wge,{})},{path:Y9.createBridge,element:(0,W.jsx)(Mqe,{})},{path:Y9.areaSetup,element:(0,W.jsx)(xae,{})},{path:Y9.bridge(`:bridgeId`),element:(0,W.jsx)(che,{})},{path:Y9.editBridge(`:bridgeId`),element:(0,W.jsx)(Nqe,{})},{path:Y9.devices,element:(0,W.jsx)(m_e,{})},{path:Y9.standaloneDevices,element:(0,W.jsx)($0e,{})},{path:Y9.networkMap,element:(0,W.jsx)(_0e,{})},{path:Y9.health,element:(0,W.jsx)(Qqe,{})},{path:Y9.labels,element:(0,W.jsx)(nJe,{})},{path:Y9.lockCredentials,element:(0,W.jsx)(cJe,{})},{path:Y9.plugins,element:(0,W.jsx)(U0e,{})},{path:Y9.settings,element:(0,W.jsx)(J0e,{})},{path:Y9.startup,element:(0,W.jsx)(D3e,{})},{path:`*`,element:(0,W.jsx)(lJe,{})}]}],k3e=A_({items:{isInitialized:!1,isLoading:!1}},e=>{e.addCase(W_.pending,e=>{e.items.isLoading=!0}).addCase(W_.rejected,(e,t)=>{e.items.isInitialized=!0,e.items.isLoading=!1,e.items.content=void 0,e.items.error=t.error}).addCase(W_.fulfilled,(e,t)=>{e.items.isInitialized=!0,e.items.isLoading=!1,e.items.content=t.payload,e.items.error=void 0}).addCase(G_.fulfilled,(e,t)=>{e.items.content?.push(t.payload)}).addCase(q_.fulfilled,(e,t)=>{let n=e.items.content?.findIndex(e=>e.id===t.payload.id)??-1;n!==-1&&(e.items.content[n]=t.payload)}).addCase(J_.fulfilled,(e,t)=>{let n=e.items.content?.findIndex(e=>e.id===t.payload.id)??-1;n!==-1&&(e.items.content[n]=t.payload)}).addCase(K_.fulfilled,(e,t)=>{if(e.items.content){let n=e.items.content.findIndex(e=>e.id===t.meta.arg);n!==-1&&e.items.content.splice(n,1)}}).addCase(Y_,(e,t)=>{e.items.isInitialized=!0,e.items.isLoading=!1,e.items.content=t.payload,e.items.error=void 0}).addCase(X_,(e,t)=>{if(e.items.content){let n=e.items.content.findIndex(e=>e.id===t.payload.id);n===-1?e.items.content.push(t.payload):e.items.content[n]=t.payload}})}),A3e=A_({byBridge:{}},e=>{e.addCase(KT.pending,(e,t)=>{e.byBridge[t.meta.arg]=X9(e.byBridge[t.meta.arg],t)}).addCase(KT.rejected,(e,t)=>{e.byBridge[t.meta.arg]=X9(e.byBridge[t.meta.arg],t)}).addCase(KT.fulfilled,(e,t)=>{e.byBridge[t.meta.arg]=X9(e.byBridge[t.meta.arg],t)})}),X9=A_({isInitialized:!1,isLoading:!1,content:void 0,error:void 0},e=>{e.addCase(KT.pending,e=>{e.isLoading=!0}).addCase(KT.rejected,(e,t)=>{e.isInitialized=!0,e.isLoading=!1,e.content=void 0,e.error=t.error}).addCase(KT.fulfilled,(e,t)=>{e.isInitialized=!0,e.isLoading=!1,e.content=t.payload,e.error=void 0})}),j3e=Yne({reducer:{bridges:k3e,devices:A3e}}),Z9=vp({createStyledComponent:J(`div`,{name:`MuiContainer`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[`maxWidth${Y(String(n.maxWidth))}`],n.fixed&&t.fixed,n.disableGutters&&t.disableGutters]}}),useThemeProps:e=>jm({props:e,name:`MuiContainer`})});function M3e(e){return zd(`MuiToolbar`,e)}K(`MuiToolbar`,[`root`,`gutters`,`regular`,`dense`]);var N3e=e=>{let{classes:t,disableGutters:n,variant:r}=e;return pp({root:[`root`,!n&&`gutters`,r]},M3e,t)},P3e=J(`div`,{name:`MuiToolbar`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,!n.disableGutters&&t.gutters,t[n.variant]]}})(Lm(({theme:e})=>({position:`relative`,display:`flex`,alignItems:`center`,variants:[{props:({ownerState:e})=>!e.disableGutters,style:{paddingLeft:e.spacing(2),paddingRight:e.spacing(2),[e.breakpoints.up(`sm`)]:{paddingLeft:e.spacing(3),paddingRight:e.spacing(3)}}},{props:{variant:`dense`},style:{minHeight:48}},{props:{variant:`regular`},style:e.mixins.toolbar}]}))),F3e=C.forwardRef(function(e,t){let n=jm({props:e,name:`MuiToolbar`}),{className:r,component:i=`div`,disableGutters:a=!1,variant:o=`regular`,...s}=n,c={...n,component:i,disableGutters:a,variant:o};return(0,W.jsx)(P3e,{as:i,className:G(N3e(c).root,r),ref:t,ownerState:c,...s})}),I3e=class extends C.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error(`ErrorBoundary caught:`,e,t.componentStack)}render(){return this.state.hasError?(0,W.jsxs)(Z,{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,minHeight:`60vh`,gap:2,p:4,children:[(0,W.jsx)(yb,{color:`error`,sx:{fontSize:64}}),(0,W.jsx)(Q,{variant:`h5`,fontWeight:600,children:Is.t(`errorBoundary.title`)}),(0,W.jsx)(Q,{variant:`body2`,color:`text.secondary`,textAlign:`center`,maxWidth:480,children:this.state.error?.message??Is.t(`errorBoundary.fallbackMessage`)}),(0,W.jsx)(_v,{variant:`contained`,onClick:()=>{this.setState({hasError:!1,error:null}),window.location.reload()},children:Is.t(`errorBoundary.reload`)})]}):this.props.children}};function L3e(e){return zd(`MuiFab`,e)}var R3e=K(`MuiFab`,[`root`,`primary`,`secondary`,`extended`,`circular`,`focusVisible`,`disabled`,`colorInherit`,`sizeSmall`,`sizeMedium`,`sizeLarge`,`info`,`error`,`warning`,`success`]),z3e=e=>{let{color:t,variant:n,classes:r,size:i}=e,a=pp({root:[`root`,n,`size${Y(i)}`,t===`inherit`?`colorInherit`:t]},L3e,r);return{...r,...a}},B3e=J(Ih,{name:`MuiFab`,slot:`Root`,shouldForwardProp:e=>km(e)||e===`classes`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[n.variant],t[`size${Y(n.size)}`],n.color===`inherit`&&t.colorInherit,t[Y(n.size)],t[n.color]]}})(Lm(({theme:e})=>({...e.typography.button,minHeight:36,transition:e.transitions.create([`background-color`,`box-shadow`,`border-color`],{duration:e.transitions.duration.short}),borderRadius:`50%`,padding:0,minWidth:0,width:56,height:56,zIndex:(e.vars||e).zIndex.fab,boxShadow:(e.vars||e).shadows[6],"&:active":{boxShadow:(e.vars||e).shadows[12]},color:e.vars?e.vars.palette.grey[900]:e.palette.getContrastText?.(e.palette.grey[300]),backgroundColor:(e.vars||e).palette.grey[300],"&:hover":{backgroundColor:(e.vars||e).palette.grey.A100,"@media (hover: none)":{backgroundColor:(e.vars||e).palette.grey[300]},textDecoration:`none`},[`&.${R3e.focusVisible}`]:{boxShadow:(e.vars||e).shadows[6]},variants:[{props:{size:`small`},style:{width:40,height:40}},{props:{size:`medium`},style:{width:48,height:48}},{props:{variant:`extended`},style:{borderRadius:48/2,padding:`0 16px`,width:`auto`,minHeight:`auto`,minWidth:48,height:48}},{props:{variant:`extended`,size:`small`},style:{width:`auto`,padding:`0 8px`,borderRadius:34/2,minWidth:34,height:34}},{props:{variant:`extended`,size:`medium`},style:{width:`auto`,padding:`0 16px`,borderRadius:40/2,minWidth:40,height:40}},{props:{color:`inherit`},style:{color:`inherit`}}]})),Lm(({theme:e})=>({variants:[...Object.entries(e.palette).filter(Km([`dark`,`contrastText`])).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].contrastText,backgroundColor:(e.vars||e).palette[t].main,"&:hover":{backgroundColor:(e.vars||e).palette[t].dark,"@media (hover: none)":{backgroundColor:(e.vars||e).palette[t].main}}}}))]})),Lm(({theme:e})=>({[`&.${R3e.disabled}`]:{color:(e.vars||e).palette.action.disabled,boxShadow:(e.vars||e).shadows[0],backgroundColor:(e.vars||e).palette.action.disabledBackground}}))),V3e=C.forwardRef(function(e,t){let n=jm({props:e,name:`MuiFab`}),{children:r,className:i,color:a=`default`,component:o=`button`,disabled:s=!1,disableFocusRipple:c=!1,focusVisibleClassName:l,size:u=`large`,variant:d=`circular`,...f}=n,p={...n,color:a,component:o,disabled:s,disableFocusRipple:c,size:u,variant:d},m=z3e(p);return(0,W.jsx)(B3e,{className:G(m.root,i),component:o,disabled:s,focusRipple:!c,focusVisibleClassName:G(m.focusVisible,l),ownerState:p,ref:t,...f,classes:m,children:r})}),H3e=[{code:`en`,flag:`🇬🇧`,name:`English`},{code:`de`,flag:`🇩🇪`,name:`Deutsch`},{code:`fr`,flag:`🇫🇷`,name:`Français`},{code:`es`,flag:`🇪🇸`,name:`Español`},{code:`it`,flag:`🇮🇹`,name:`Italiano`},{code:`hu`,flag:`🇭🇺`,name:`Magyar`},{code:`zh`,flag:`🇨🇳`,name:`中文`},{code:`zh-TW`,flag:`🇹🇼`,name:`繁體中文`},{code:`ja`,flag:`🇯🇵`,name:`日本語`},{code:`th`,flag:`🇹🇭`,name:`ไทย`},{code:`sv`,flag:`🇸🇪`,name:`Svenska`},{code:`tr`,flag:`🇹🇷`,name:`Türkçe`},{code:`ru`,flag:`🇷🇺`,name:`Русский`}],U3e=`hamh-custom-languages`;function W3e(){try{let e=localStorage.getItem(U3e);return e?JSON.parse(e).map(e=>({code:e.code,flag:`🌐`,name:e.name})):[]}catch{return[]}}var G3e=`https://github.com/RiDDiX/home-assistant-matter-hub/issues/new?labels=translation&title=Translation+improvement`;function K3e(){let{t:e,i18n:t}=hs(),[n,r]=(0,C.useState)(!1),i=(0,C.useRef)(null),a=(0,C.useMemo)(()=>[...H3e,...W3e()],[]),o=t.language??`en`,s=a.some(e=>e.code===o)?o:o.split(`-`)[0]??`en`,c=(0,C.useCallback)(()=>{r(e=>!e)},[]),l=(0,C.useCallback)(e=>{t.changeLanguage(e),r(!1)},[t]);return(0,W.jsx)(Yh,{onClickAway:(0,C.useCallback)(()=>{r(!1)},[]),children:(0,W.jsxs)(Z,{children:[(0,W.jsx)(V3e,{ref:i,size:`small`,color:`primary`,onClick:c,"aria-label":`Change language`,sx:{position:`fixed`,bottom:24,right:24,zIndex:1300},children:(0,W.jsx)(Ihe,{})}),(0,W.jsx)(cb,{open:n,anchorEl:i.current,placement:`top-end`,transition:!0,sx:{zIndex:1300},children:({TransitionProps:t})=>(0,W.jsx)(Pb,{...t,timeout:200,children:(0,W.jsxs)(qm,{elevation:8,sx:{mb:1,py:.5,minWidth:160,borderRadius:2,overflow:`hidden`},children:[a.map(e=>(0,W.jsxs)(Z,{onClick:()=>l(e.code),sx:{display:`flex`,alignItems:`center`,gap:1.5,px:2,py:1,cursor:`pointer`,bgcolor:s===e.code?`action.selected`:`transparent`,"&:hover":{bgcolor:`action.hover`},transition:`background-color 0.15s`},children:[(0,W.jsx)(Q,{sx:{fontSize:`1.4rem`,lineHeight:1,userSelect:`none`},children:e.flag}),(0,W.jsx)(Q,{variant:`body2`,fontWeight:s===e.code?600:400,children:e.name})]},e.code)),(0,W.jsx)(Kb,{}),(0,W.jsxs)(Z,{sx:{display:`flex`,alignItems:`flex-start`,gap:.75,px:2,py:1},children:[(0,W.jsx)(Zv,{sx:{fontSize:14,mt:.25,color:`text.secondary`}}),(0,W.jsxs)(Q,{variant:`caption`,color:`text.secondary`,sx:{lineHeight:1.4},children:[e(`languageSwitcher.disclaimer`),` `,(0,W.jsx)(Jv,{href:G3e,target:`_blank`,rel:`noopener`,sx:{fontSize:`inherit`},children:e(`languageSwitcher.contribute`)})]})]})]})})})]})})}var q3e={name:`home-assistant-matter-hub`,description:``,version:`2.1.0-alpha.744`,private:!1,type:`module`,bin:{"home-assistant-matter-hub":`./dist/backend/cli.js`},author:{name:`riddix`,url:`https://github.com/riddix`},keywords:[`home-assistant`,`homeassistant`,`home`,`assistant`,`apple home`,`google home`,`apple`,`google`,`alexa`,`matter`,`matter.js`,`matterjs`,`project-chip`,`smart`,`smarthome`,`smart-home`],bugs:{url:`https://github.com/riddix/home-assistant-matter-hub/issues`},license:`Apache-2.0`,repository:`github:riddix/home-assistant-matter-hub`,scripts:{cleanup:`npx rimraf node_modules dist pack LICENSE README.md`,build:`node build.js`,bundle:`pnpm pack --out package.tgz`,postbuild:`pnpm run bundle`,test:`vitest run`,prestart:`pnpm run build`,start:`dotenvx run -f ../../.env -- ./dist/backend/cli.js start`},dependencies:{"@matter/main":`0.17.2`,"@matter/nodejs":`0.17.2`,"@matter/general":`0.17.2`,ajv:`8.18.0`,archiver:`7.0.1`,color:`5.0.3`,debounce:`3.0.0`,express:`5.2.1`,"express-basic-auth":`1.2.1`,"express-ip-access-control":`1.1.3`,"home-assistant-js-websocket":`9.6.0`,"lodash-es":`4.18.1`,multer:`2.1.1`,nocache:`4.0.0`,unzipper:`0.12.3`,ws:`8.21.0`,yargs:`18.0.0`},devDependencies:{"@home-assistant-matter-hub/backend":`workspace:*`,"@home-assistant-matter-hub/frontend":`workspace:*`,"@home-assistant-matter-hub/common":`workspace:*`,"@types/lodash-es":`^4.17.12`},overrides:{minimatch:`9.0.7`,"path-to-regexp":`^8.4.0`,glob:`^13.0.0`},nx:{targets:{start:{cache:!1,dependsOn:[`build`]},pack:{cache:!0,dependsOn:[`build`],outputs:[`{projectRoot}/pack`]},build:{inputs:[`^default`,`default`,`{workspaceRoot}/README.md`,`{workspaceRoot}/LICENSE`],outputs:[`{projectRoot}/dist`,`{projectRoot}/README.md`,`{projectRoot}/LICENSE`]}}}};function J3e(){let e=`2.1.0-alpha.744`,[t,n]=(0,C.useState)(null);(0,C.useEffect)(()=>{fetch(`api/health`).then(e=>e.ok?e.json():null).then(e=>{e?.version&&n(e.version)}).catch(()=>{})},[]);let r=(0,C.useMemo)(()=>!t||e===`0.0.0-dev`?!1:e!==t,[t]);return(0,C.useMemo)(()=>({name:q3e.name,version:t??e,frontendVersion:e,backendVersion:t,versionMismatch:r}),[t,r])}var Y3e=()=>{let{t:e}=hs(),t=[{name:e(`footer.github`),url:Y9.githubRepository},{name:e(`footer.documentation`),url:Y9.documentation},{name:e(`footer.support`),url:Y9.support}];return(0,W.jsxs)(Z9,{sx:{mt:16,mb:4},children:[(0,W.jsx)(Kb,{sx:{mt:4,mb:4}}),(0,W.jsx)(Rv,{container:!0,spacing:2,justifyContent:`center`,children:t.map((e,t)=>(0,W.jsx)(Rv,{size:{xs:12,sm:`auto`},children:(0,W.jsx)(_v,{fullWidth:!0,size:`small`,variant:`outlined`,component:Jv,href:e.url,target:`_blank`,children:e.name})},t.toString()))})]})};function X3e(e){return zd(`MuiAppBar`,e)}K(`MuiAppBar`,[`root`,`positionFixed`,`positionAbsolute`,`positionSticky`,`positionStatic`,`positionRelative`,`colorDefault`,`colorPrimary`,`colorSecondary`,`colorInherit`,`colorTransparent`,`colorError`,`colorInfo`,`colorSuccess`,`colorWarning`]);var Z3e=e=>{let{color:t,position:n,classes:r}=e;return pp({root:[`root`,`color${Y(t)}`,`position${Y(n)}`]},X3e,r)},Q3e=(e,t)=>e?`${e.replace(`)`,``)}, ${t})`:t,$3e=J(qm,{name:`MuiAppBar`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[`position${Y(n.position)}`],t[`color${Y(n.color)}`]]}})(Lm(({theme:e})=>({display:`flex`,flexDirection:`column`,width:`100%`,boxSizing:`border-box`,flexShrink:0,variants:[{props:{position:`fixed`},style:{position:`fixed`,zIndex:(e.vars||e).zIndex.appBar,top:0,left:`auto`,right:0,"@media print":{position:`absolute`}}},{props:{position:`absolute`},style:{position:`absolute`,zIndex:(e.vars||e).zIndex.appBar,top:0,left:`auto`,right:0}},{props:{position:`sticky`},style:{position:`sticky`,zIndex:(e.vars||e).zIndex.appBar,top:0,left:`auto`,right:0}},{props:{position:`static`},style:{position:`static`}},{props:{position:`relative`},style:{position:`relative`}},{props:{color:`inherit`},style:{"--AppBar-color":`inherit`,color:`var(--AppBar-color)`}},{props:{color:`default`},style:{"--AppBar-background":e.vars?e.vars.palette.AppBar.defaultBg:e.palette.grey[100],"--AppBar-color":e.vars?e.vars.palette.text.primary:e.palette.getContrastText(e.palette.grey[100]),...e.applyStyles(`dark`,{"--AppBar-background":e.vars?e.vars.palette.AppBar.defaultBg:e.palette.grey[900],"--AppBar-color":e.vars?e.vars.palette.text.primary:e.palette.getContrastText(e.palette.grey[900])})}},...Object.entries(e.palette).filter(Km([`contrastText`])).map(([t])=>({props:{color:t},style:{"--AppBar-background":(e.vars??e).palette[t].main,"--AppBar-color":(e.vars??e).palette[t].contrastText}})),{props:e=>e.enableColorOnDark===!0&&![`inherit`,`transparent`].includes(e.color),style:{backgroundColor:`var(--AppBar-background)`,color:`var(--AppBar-color)`}},{props:e=>e.enableColorOnDark===!1&&![`inherit`,`transparent`].includes(e.color),style:{backgroundColor:`var(--AppBar-background)`,color:`var(--AppBar-color)`,...e.applyStyles(`dark`,{backgroundColor:e.vars?Q3e(e.vars.palette.AppBar.darkBg,`var(--AppBar-background)`):null,color:e.vars?Q3e(e.vars.palette.AppBar.darkColor,`var(--AppBar-color)`):null})}},{props:{color:`transparent`},style:{"--AppBar-background":`transparent`,"--AppBar-color":`inherit`,backgroundColor:`var(--AppBar-background)`,color:`var(--AppBar-color)`,...e.applyStyles(`dark`,{backgroundImage:`none`})}}]}))),e6e=C.forwardRef(function(e,t){let n=jm({props:e,name:`MuiAppBar`}),{className:r,color:i=`primary`,enableColorOnDark:a=!1,position:o=`fixed`,...s}=n,c={...n,color:i,position:o,enableColorOnDark:a};return(0,W.jsx)($3e,{square:!0,component:`header`,ownerState:c,elevation:4,className:G(Z3e(c).root,r,o===`fixed`&&`mui-fixed`),ref:t,...s})}),t6e={visibility:`hidden`};function n6e(e,t,n){let r=n&&n.getBoundingClientRect(),i=rh(t),a=t.style.transform,o=t.style.transition;t.style.transition=``,t.style.transform=``;let s=t.getBoundingClientRect(),c=i.getComputedStyle(t).getPropertyValue(`transform`);t.style.transform=a,t.style.transition=o;let l=0,u=0;if(c&&c!==`none`&&typeof c==`string`){let e=c.split(`(`)[1].split(`)`)[0].split(`,`);l=parseInt(e[4],10),u=parseInt(e[5],10)}return e===`left`?r?`translateX(${r.right+l-s.left}px)`:`translateX(${i.innerWidth+l-s.left}px)`:e===`right`?r?`translateX(-${s.right-r.left-l}px)`:`translateX(-${s.left+s.width-l}px)`:e===`up`?r?`translateY(${r.bottom+u-s.top}px)`:`translateY(${i.innerHeight+u-s.top}px)`:r?`translateY(-${s.top-r.top+s.height-u}px)`:`translateY(-${s.top+s.height-u}px)`}function r6e(e){return typeof e==`function`?e():e}function Q9(e,t,n){let r=n6e(e,t,r6e(n));r&&(t.style.transform=r)}var i6e=C.forwardRef(function(e,t){let n=Em(),r={enter:n.transitions.easing.easeOut,exit:n.transitions.easing.sharp},i={enter:n.transitions.duration.enteringScreen,exit:n.transitions.duration.leavingScreen},{addEndListener:a,appear:o=!0,children:s,container:c,direction:l=`down`,easing:u=r,in:d,onEnter:f,onEntered:p,onEntering:m,onExit:h,onExited:g,onExiting:_,style:v,timeout:y=i,...b}=e,x=C.useRef(null),S=dh(qh(s),x,t),w=Zh(x,(e,t)=>{Q9(l,e,c),Xh(e),f&&f(e,t)}),T=Zh(x,(e,t)=>{let r=$h({timeout:y,style:v,easing:u},{mode:`enter`});e.style.transition=n.transitions.create(`transform`,r),e.style.transform=`none`,m&&m(e,t)}),E=Zh(x,p),D=Zh(x,_),O=Zh(x,e=>{let t=$h({timeout:y,style:v,easing:u},{mode:`exit`});e.style.transition=n.transitions.create(`transform`,t),Q9(l,e,c),h&&h(e)}),k=Zh(x,e=>{e.style.transition=``,g&&g(e)}),A=e=>{a&&a(x.current,e)},j=C.useCallback(()=>{x.current&&Q9(l,x.current,c)},[l,c]);return C.useEffect(()=>{if(d||l===`down`||l===`right`)return;let e=Qm(()=>{x.current&&Q9(l,x.current,c)}),t=rh(x.current);return t.addEventListener(`resize`,e),()=>{e.clear(),t.removeEventListener(`resize`,e)}},[l,d,c]),C.useEffect(()=>{d||j()},[d,j]),(0,W.jsx)(Dh,{nodeRef:x,onEnter:w,onEntered:E,onEntering:T,onExit:O,onExited:k,onExiting:D,addEndListener:A,appear:o,in:d,timeout:y,...b,children:(e,{ownerState:t,...n})=>{let r;return r=e===`exited`&&!d?v||s.props.style?{visibility:`hidden`,...v,...s.props.style}:t6e:v&&s.props.style?{...v,...s.props.style}:v||s.props.style,C.cloneElement(s,{ref:S,style:r,...n})}})});function a6e(e){return zd(`MuiDrawer`,e)}K(`MuiDrawer`,[`root`,`docked`,`paper`,`anchorLeft`,`anchorRight`,`anchorTop`,`anchorBottom`,`paperAnchorLeft`,`paperAnchorRight`,`paperAnchorTop`,`paperAnchorBottom`,`paperAnchorDockedLeft`,`paperAnchorDockedRight`,`paperAnchorDockedTop`,`paperAnchorDockedBottom`,`modal`]);var o6e=(e,t)=>{let{ownerState:n}=e;return[t.root,(n.variant===`permanent`||n.variant===`persistent`)&&t.docked,n.variant===`temporary`&&t.modal]},s6e=e=>{let{classes:t,anchor:n,variant:r}=e;return pp({root:[`root`,`anchor${Y(n)}`],docked:[(r===`permanent`||r===`persistent`)&&`docked`],modal:[`modal`],paper:[`paper`,`paperAnchor${Y(n)}`,r!==`temporary`&&`paperAnchorDocked${Y(n)}`]},a6e,t)},c6e=J(Rb,{name:`MuiDrawer`,slot:`Root`,overridesResolver:o6e})(Lm(({theme:e})=>({zIndex:(e.vars||e).zIndex.drawer}))),l6e=J(`div`,{shouldForwardProp:km,name:`MuiDrawer`,slot:`Docked`,skipVariantsResolver:!1,overridesResolver:o6e})({flex:`0 0 auto`}),u6e=J(qm,{name:`MuiDrawer`,slot:`Paper`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.paper,t[`paperAnchor${Y(n.anchor)}`],n.variant!==`temporary`&&t[`paperAnchorDocked${Y(n.anchor)}`]]}})(Lm(({theme:e})=>({overflowY:`auto`,display:`flex`,flexDirection:`column`,height:`100%`,flex:`1 0 auto`,zIndex:(e.vars||e).zIndex.drawer,WebkitOverflowScrolling:`touch`,position:`fixed`,top:0,outline:0,variants:[{props:{anchor:`left`},style:{left:0}},{props:{anchor:`top`},style:{top:0,left:0,right:0,height:`auto`,maxHeight:`100%`}},{props:{anchor:`right`},style:{right:0}},{props:{anchor:`bottom`},style:{top:`auto`,left:0,bottom:0,right:0,height:`auto`,maxHeight:`100%`}},{props:({ownerState:e})=>e.anchor===`left`&&e.variant!==`temporary`,style:{borderRight:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:e})=>e.anchor===`top`&&e.variant!==`temporary`,style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:e})=>e.anchor===`right`&&e.variant!==`temporary`,style:{borderLeft:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:e})=>e.anchor===`bottom`&&e.variant!==`temporary`,style:{borderTop:`1px solid ${(e.vars||e).palette.divider}`}}]}))),d6e={left:`right`,right:`left`,top:`down`,bottom:`up`};function f6e(e){return[`left`,`right`].includes(e)}function p6e({direction:e},t){return e===`rtl`&&f6e(t)?d6e[t]:t}var m6e=C.forwardRef(function(e,t){let n=jm({props:e,name:`MuiDrawer`}),r=Em(),i=Mf(),a={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{anchor:o=`left`,BackdropProps:s,children:c,className:l,elevation:u=16,hideBackdrop:d=!1,ModalProps:{BackdropProps:f,...p}={},onClose:m,open:h=!1,PaperProps:g={},SlideProps:_,TransitionComponent:v,transitionDuration:y=a,variant:b=`temporary`,slots:x={},slotProps:S={},...w}=n,T=C.useRef(!1);C.useEffect(()=>{T.current=!0},[]);let E=p6e({direction:i?`rtl`:`ltr`},o),D=o,O={...n,anchor:D,elevation:u,open:h,variant:b,...w},k=s6e(O),A={slots:{transition:v,...x},slotProps:{paper:g,transition:_,...S,backdrop:fh(S.backdrop||{...s,...f},{transitionDuration:y})}},[j,M]=Gm(`root`,{ref:t,elementType:c6e,className:G(k.root,k.modal,l),shouldForwardComponentProp:!0,ownerState:O,externalForwardedProps:{...A,...w,...p},additionalProps:{open:h,onClose:m,hideBackdrop:d,slots:{backdrop:A.slots.backdrop},slotProps:{backdrop:A.slotProps.backdrop}}}),[N,P]=Gm(`paper`,{elementType:u6e,shouldForwardComponentProp:!0,className:G(k.paper,g.className),ownerState:O,externalForwardedProps:A,additionalProps:{elevation:b===`temporary`?u:0,square:!0,...b===`temporary`&&{role:`dialog`,"aria-modal":`true`}}}),[F,I]=Gm(`docked`,{elementType:l6e,ref:t,className:G(k.root,k.docked,l),ownerState:O,externalForwardedProps:A,additionalProps:w}),[L,R]=Gm(`transition`,{elementType:i6e,ownerState:O,externalForwardedProps:A,additionalProps:{in:h,direction:d6e[E],timeout:y,appear:T.current}}),ee=(0,W.jsx)(N,{...P,children:c});if(b===`permanent`)return(0,W.jsx)(F,{...I,children:ee});let z=(0,W.jsx)(L,{...R,children:ee});return b===`persistent`?(0,W.jsx)(F,{...I,children:z}):(0,W.jsx)(j,{...M,children:z})}),h6e=sf({themeId:Tm}),g6e={error:Tx,warn:Qv,info:xb,debug:$T},_6e=({open:e,onClose:t})=>{let{t:n}=hs(),r=Em(),i=(0,C.useMemo)(()=>({error:r.palette.error.main,warn:r.palette.warning.main,info:r.palette.info.main,debug:r.palette.secondary.main}),[r]),[a,o]=(0,C.useState)([]),[s,c]=(0,C.useState)(!0),[l,u]=(0,C.useState)(`error,warn,info`.split(`,`)),[d,f]=(0,C.useState)(``),[p,m]=(0,C.useState)(!0),h=(0,C.useCallback)(async()=>{try{let e=new URLSearchParams({level:l.join(`,`),limit:`500`,...d&&{search:d}}),t=await fetch(`api/logs?${e}`);t.ok&&o((await t.json()).entries)}catch(e){console.error(`Failed to fetch logs:`,e)}finally{c(!1)}},[l,d]);(0,C.useEffect)(()=>{e&&h()},[e,h]),(0,C.useEffect)(()=>{if(!p||!e)return;let t=setInterval(h,5e3);return()=>clearInterval(t)},[p,e,h]);let g=e=>{u(Array.isArray(e.target.value)?e.target.value:[e.target.value])},_=e=>{f(e.target.value)},v=async()=>{try{await fetch(`api/logs`,{method:`DELETE`}),o([])}catch(e){console.error(`Failed to clear logs:`,e)}},y=e=>(0,W.jsx)(g6e[e]||xb,{sx:{fontSize:16,color:i[e]}});return(0,W.jsxs)(Vb,{open:e,onClose:t,maxWidth:`lg`,fullWidth:!0,children:[(0,W.jsxs)(Wb,{sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,W.jsx)($T,{}),n(`logs.title`),(0,W.jsx)(Z,{sx:{flexGrow:1}}),(0,W.jsx)(mb,{title:n(`logs.autoRefresh`),children:(0,W.jsx)(kv,{label:p?`Auto`:`Manual`,color:p?`success`:`default`,size:`small`,onClick:()=>m(!p),sx:{cursor:`pointer`}})}),(0,W.jsx)(Uh,{onClick:t,children:(0,W.jsx)(tE,{})})]}),(0,W.jsxs)(Ub,{children:[(0,W.jsx)(Gv,{spacing:2,sx:{mb:2},children:(0,W.jsxs)(Gv,{direction:`row`,spacing:2,alignItems:`center`,children:[(0,W.jsxs)(Mv,{size:`small`,sx:{minWidth:200},children:[(0,W.jsx)(Hx,{children:n(`logs.logLevel`)}),(0,W.jsxs)(wS,{value:l,label:n(`logs.logLevel`),onChange:g,multiple:!0,renderValue:e=>(0,W.jsx)(Z,{sx:{display:`flex`,flexWrap:`wrap`,gap:.5},children:(Array.isArray(e)?e:[e]).map(e=>(0,W.jsx)(kv,{label:e.toUpperCase(),size:`small`,sx:{backgroundColor:i[e],color:`white`}},e))}),children:[(0,W.jsx)(TS,{value:`error`,children:n(`logs.error`)}),(0,W.jsx)(TS,{value:`warn`,children:n(`logs.warning`)}),(0,W.jsx)(TS,{value:`info`,children:n(`logs.info`)}),(0,W.jsx)(TS,{value:`debug`,children:n(`logs.debug`)})]})]}),(0,W.jsx)(OS,{size:`small`,placeholder:n(`logs.searchPlaceholder`),value:d,onChange:_,sx:{flexGrow:1}}),(0,W.jsx)(_v,{variant:`outlined`,onClick:h,children:n(`common.refresh`)}),(0,W.jsx)(_v,{variant:`outlined`,color:`error`,onClick:v,children:n(`common.delete`)})]})}),(0,W.jsx)(Z,{sx:{height:400,overflow:`auto`,backgroundColor:`background.paper`,border:1,borderColor:`divider`,borderRadius:1,p:1},children:s?(0,W.jsx)(Z,{sx:{display:`flex`,justifyContent:`center`,p:4},children:(0,W.jsxs)(Q,{children:[n(`common.loading`),`...`]})}):a.length===0?(0,W.jsx)(Z,{sx:{display:`flex`,justifyContent:`center`,p:4},children:(0,W.jsx)(Q,{color:`text.secondary`,children:n(`logs.noResults`)})}):(0,W.jsx)(Gv,{spacing:1,children:a.map((e,t)=>(0,W.jsxs)(Z,{sx:{p:1,borderRadius:1,backgroundColor:`action.hover`,fontFamily:`monospace`,fontSize:`0.875rem`,wordBreak:`break-all`},children:[(0,W.jsxs)(Z,{sx:{display:`flex`,alignItems:`center`,gap:1,mb:.5},children:[y(e.level),(0,W.jsx)(Q,{variant:`caption`,color:`text.secondary`,children:new Date(e.timestamp).toLocaleString()}),(0,W.jsx)(kv,{label:e.level.toUpperCase(),size:`small`,sx:{backgroundColor:i[e.level],color:r.palette.getContrastText(i[e.level]??r.palette.grey[500]),fontSize:`0.7rem`,height:20}})]}),(0,W.jsx)(Q,{sx:{ml:3},children:e.message}),e.context&&(0,W.jsx)(Q,{sx:{ml:3,color:`text.secondary`,fontSize:`0.8rem`},children:JSON.stringify(e.context,null,2)})]},`${e.timestamp}-${e.level}-${t}`))})})]}),(0,W.jsx)(Hb,{children:(0,W.jsx)(_v,{onClick:t,children:n(`common.close`)})})]})};function v6e(){let{t:e}=hs(),{isConnected:t}=ev(),[n,r]=(0,C.useState)(null),[i,a]=(0,C.useState)(!1);(0,C.useEffect)(()=>{let e=async()=>{try{let e=await fetch(`api/health`);e.ok?(r(await e.json()),a(!1)):a(!0)}catch{a(!0)}};e();let t=setInterval(e,3e4);return()=>clearInterval(t)},[]);let o=e=>{let t=Math.floor(e/3600),n=Math.floor(e%3600/60);return t>0?`${t}h ${n}m`:`${n}m`},s=n?.status===`healthy`&&!i,c=n?.services?.bridges,l=c&&c.total>0&&c.running===c.total,u=c&&c.total===0,d=n?(0,W.jsxs)(Z,{sx:{p:.5},children:[(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`strong`,{children:[e(`health.version`),`:`]}),` `,n.version??e(`status.unknown`)]}),(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`strong`,{children:[e(`health.uptime`),`:`]}),` `,o(n.uptime??0)]}),n.services?.bridges&&(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`strong`,{children:[e(`nav.bridges`),`:`]}),` `,n.services.bridges.running??0,`/`,n.services.bridges.total??0,` `,e(`common.running`).toLowerCase(),(n.services.bridges.stopped??0)>0&&` (${n.services.bridges.stopped} ${e(`common.stopped`).toLowerCase()})`]}),n.services?.homeAssistant&&(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`strong`,{children:[e(`health.homeAssistant`),`:`]}),` `,n.services.homeAssistant.connected?e(`health.connected`):e(`health.disconnected`)]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`strong`,{children:`WebSocket:`}),` `,e(t?`health.connected`:`health.disconnected`)]})]}):e(`status.loadingHealth`);return(0,W.jsx)(mb,{title:d,arrow:!0,children:(0,W.jsx)(kv,{icon:i||!s?(0,W.jsx)(Tx,{fontSize:`small`}):l?(0,W.jsx)(fv,{fontSize:`small`}):(0,W.jsx)(wb,{fontSize:`small`}),label:e(i?`status.error`:s?t?u?`status.noBridges`:l?`common.online`:`common.starting`:`common.offline`:`status.unhealthy`),color:i||!s?`error`:!l||!t?`warning`:`success`,size:`small`,variant:`filled`,sx:{borderRadius:1,fontWeight:600,"& .MuiChip-icon":{color:`inherit`}}})})}var y6e=e=>(0,W.jsx)(`svg`,{viewBox:`0 0 91 89`,xmlSpace:`preserve`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,W.jsxs)(`g`,{style:{display:`inline`},children:[(0,W.jsx)(`path`,{style:{fill:`#18bcf2`,fillOpacity:1,strokeWidth:.266194},d:`m 49.149143,1.473171 38.513568,38.536435 c 0,0 1.248354,1.186052 2.207681,3.092371 0.959329,1.906323 1.10864,4.600698 1.10864,4.600698 v 36.786372 c 0,0 -0.01549,1.748506 -1.49842,3.050572 -1.482931,1.302064 -3.333077,1.362947 -3.333077,1.362947 l -81.325658,7.7e-5 c 0,0 -1.7523855,-0.0091 -3.17112,-1.352526 C -0.07808495,85.913164 0.05953025,84.487808 0.05953025,84.487808 V 47.704546 c 0,0 -0.0018381,-2.218618 0.95921785,-4.315832 0.9610554,-2.097209 2.3010618,-3.355005 2.3010618,-3.355005 L 41.545959,1.4719546 c 0,0 1.465224,-1.46837077 3.753488,-1.46837077 2.288268,0 3.849696,1.46958717 3.849696,1.46958717 z`}),(0,W.jsx)(`path`,{style:{fill:`#ffffff`,fillOpacity:1,strokeWidth:.175841},d:`m 31.689717,32.051124 c 2.813363,2.331095 6.157331,3.89845 9.721813,4.556421 V 17.180647 l 3.873694,-2.282955 3.870527,2.282955 V 36.60772 c 3.565364,-0.658847 6.910387,-2.226204 9.725159,-4.556417 l 7.032345,4.154609 c -11.437354,11.557779 -29.852321,11.557779 -41.290025,0 z m 8.546732,49.60988 C 44.314996,65.760441 35.09933,49.470196 19.574984,45.139543 v 8.312381 c 3.383916,1.32244 6.386113,3.496288 8.728705,6.320026 L 11.83076,69.485301 v 4.56907 l 3.873697,2.270836 16.469936,-9.713534 c 1.224356,3.48294 1.56683,7.225375 0.996449,10.879778 z M 70.977694,45.139543 c -15.515726,4.34014 -24.72189,20.626696 -20.643519,36.521461 l 7.047658,-4.15742 c -0.569325,-3.654411 -0.2265,-7.3965 0.996449,-10.87979 l 16.457611,9.701233 3.870711,-2.283125 v -4.55677 L 62.233673,59.77195 c 2.342772,-2.822684 5.34497,-4.996533 8.728708,-6.320026 z`})]})}),b6e=e=>{let t=J3e();return(0,W.jsxs)(Z,{component:ta,to:Y9.dashboard,sx:{display:`flex`,alignItems:`center`,justifyContent:e.large?`flex-start`:`center`,flexGrow:1,textDecoration:`none`,color:`inherit`},children:[(0,W.jsx)(y6e,{style:{height:`40px`}}),(0,W.jsx)(Q,{variant:`inherit`,component:`span`,sx:{mr:1,ml:1},children:t.name.split(`-`).map(Y).join(`-`)}),e.large&&(0,W.jsx)(Q,{variant:`caption`,component:`span`,children:t.version})]})},x6e=()=>{let e=h6e(`(min-width:600px)`),{mode:t,setMode:n}=Im(),[r,i]=(0,C.useState)(!1),[a,o]=(0,C.useState)(!1),s=Cr(),c=br(),l=e=>e?e===`/`?c.pathname===`/`:c.pathname.startsWith(e):!1,u=()=>{n(t===`dark`?`light`:`dark`)},{t:d}=hs(),f=[{label:d(`dashboard.title`),icon:(0,W.jsx)(oE,{}),to:Y9.dashboard},{label:d(`nav.bridges`),icon:(0,W.jsx)(sE,{}),to:Y9.bridges},{label:d(`nav.devices`),icon:(0,W.jsx)(_b,{}),to:Y9.devices},{label:d(`nav.standaloneDevices`,`Standalone Devices`),icon:(0,W.jsx)(Khe,{}),to:Y9.standaloneDevices},{label:d(`nav.networkMap`),icon:(0,W.jsx)(JT,{}),to:Y9.networkMap},{label:d(`nav.startupOrder`),icon:(0,W.jsx)(pv,{}),to:Y9.startup},{label:d(`nav.lockCredentials`),icon:(0,W.jsx)(kT,{}),to:Y9.lockCredentials},{label:d(`nav.filterReference`),icon:(0,W.jsx)(cE,{}),to:Y9.labels},{label:`Plugins`,icon:(0,W.jsx)(iE,{}),to:Y9.plugins},{label:d(`nav.settings`),icon:(0,W.jsx)(RT,{}),to:Y9.settings},{label:d(t===`dark`?`nav.lightMode`:`nav.darkMode`),icon:t===`dark`?(0,W.jsx)(zhe,{}):(0,W.jsx)(Ehe,{}),onClick:u},{label:d(`nav.systemLogs`),icon:(0,W.jsx)($T,{}),onClick:()=>i(!0)},{label:d(`nav.health`),icon:(0,W.jsx)(jx,{}),to:Y9.health}],p=e=>{o(!1),e.onClick?e.onClick():e.to&&s(e.to)};return(0,W.jsxs)(Z,{children:[(0,W.jsx)(e6e,{sx:{height:`72px`},children:(0,W.jsx)(F3e,{sx:{paddingLeft:`0 !important`,paddingRight:`0 !important`},children:(0,W.jsxs)(Z9,{sx:{padding:2,height:`100%`,display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,W.jsx)(b6e,{large:e}),e?(0,W.jsxs)(Z,{sx:{display:`flex`,alignItems:`center`,gap:1},children:[f.map(e=>e.to?(0,W.jsx)(mb,{title:e.label,children:(0,W.jsx)(Uh,{component:ta,to:e.to,sx:{color:`inherit`,bgcolor:l(e.to)?`rgba(255,255,255,0.15)`:`transparent`,borderRadius:1},children:e.icon})},e.label):(0,W.jsx)(mb,{title:e.label,children:(0,W.jsx)(Uh,{onClick:e.onClick,sx:{color:`inherit`},children:e.icon})},e.label)),(0,W.jsx)(v6e,{})]}):(0,W.jsxs)(Z,{sx:{display:`flex`,alignItems:`center`,gap:.5},children:[(0,W.jsx)(v6e,{}),(0,W.jsx)(Uh,{onClick:()=>o(!0),sx:{color:`inherit`},children:(0,W.jsx)(Bhe,{})})]})]})})}),(0,W.jsx)(m6e,{anchor:`right`,open:a,onClose:()=>o(!1),children:(0,W.jsx)(ny,{sx:{width:250},children:f.map(e=>(0,W.jsxs)(Rae,{selected:l(e.to),onClick:()=>p(e),children:[(0,W.jsx)(sy,{children:e.icon}),(0,W.jsx)(ly,{primary:e.label})]},e.label))})}),(0,W.jsx)(_6e,{open:r,onClose:()=>i(!1)})]})},S6e=()=>{let{versionMismatch:e,frontendVersion:t,backendVersion:n}=J3e(),{isConnected:r}=ev();return(0,W.jsxs)(Z,{children:[(0,W.jsx)(x6e,{}),(0,W.jsx)(F3e,{}),e&&(0,W.jsxs)(Kh,{severity:`warning`,variant:`filled`,sx:{borderRadius:0},action:(0,W.jsx)(_v,{color:`inherit`,size:`small`,onClick:()=>window.location.reload(),children:`Reload`}),children:[`Version mismatch: frontend `,t,`, backend `,n,`. Please reload to get the latest UI.`]}),!r&&(0,W.jsx)(Kh,{severity:`error`,variant:`filled`,sx:{borderRadius:0},children:`Connection lost, data may be outdated. Reconnecting…`}),(0,W.jsx)(Z9,{sx:{p:2},children:(0,W.jsx)(I3e,{children:(0,W.jsx)(si,{})})}),(0,W.jsx)(Y3e,{}),(0,W.jsx)(K3e,{})]})},C6e=Cm({colorSchemes:{light:{palette:{primary:{main:`#1976d2`,light:`#42a5f5`,dark:`#1565c0`},secondary:{main:`#9c27b0`,light:`#ba68c8`,dark:`#7b1fa2`},background:{default:`#f5f5f5`,paper:`#ffffff`}}},dark:{palette:{primary:{main:`#90caf9`,light:`#e3f2fd`,dark:`#42a5f5`},secondary:{main:`#ce93d8`,light:`#f3e5f5`,dark:`#ab47bc`},background:{default:`#121212`,paper:`#1e1e1e`}}}},typography:{fontFamily:`"Roboto", "Helvetica", "Arial", sans-serif`,h1:{fontSize:`2.5rem`,fontWeight:500},h2:{fontSize:`2rem`,fontWeight:500},h3:{fontSize:`1.75rem`,fontWeight:500},h4:{fontSize:`1.5rem`,fontWeight:500},h5:{fontSize:`1.25rem`,fontWeight:500},h6:{fontSize:`1rem`,fontWeight:500}},shape:{borderRadius:8},components:{MuiCard:{styleOverrides:{root:{transition:`transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out`,"&:hover":{transform:`translateY(-2px)`,boxShadow:`0 4px 20px rgba(0,0,0,0.12)`}}}},MuiButton:{styleOverrides:{root:{textTransform:`none`,fontWeight:500}}},MuiChip:{styleOverrides:{root:{fontWeight:500}}},MuiAppBar:{styleOverrides:{root:{backgroundImage:`none`}}}}}),$9=document.getElementsByTagName(`base`)[0]?.href?.replace(/\/$/,``);$9?.startsWith(`http`)&&($9=new URL($9).pathname);var w6e=Xi([{path:`/`,element:(0,W.jsx)(S6e,{}),children:O3e}],{basename:$9});(0,S.createRoot)(document.getElementById(`root`)).render((0,W.jsx)(C.StrictMode,{children:(0,W.jsx)(L,{store:j3e,children:(0,W.jsxs)(Gee,{theme:C6e,children:[(0,W.jsx)(zee,{}),(0,W.jsx)(Dm,{styles:{".rjsf-field-array > .MuiFormControl-root > .MuiPaper-root > .MuiBox-root > .MuiGrid-root > .MuiGrid-root:has(> .MuiBox-root > .MuiPaper-root > .MuiBox-root > .rjsf-field)":{overflow:`initial !important`,flexGrow:1}}}),(0,W.jsx)(xre,{children:(0,W.jsx)(sne,{children:(0,W.jsx)(xa,{router:w6e})})})]})})}));
|
|
469
|
+
`},g2e={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function _2e(e){let{announcements:t=g2e,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=h2e}=e,{announce:a,announcement:o}=d2e(),s=p9(`DndLiveRegion`),[c,l]=(0,C.useState)(!1);if((0,C.useEffect)(()=>{l(!0)},[]),p2e((0,C.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=C.createElement(C.Fragment,null,C.createElement(l2e,{id:r,value:i.draggable}),C.createElement(u2e,{id:s,announcement:o}));return n?(0,ba.createPortal)(u,n):u}var y9;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(y9||={});function b9(){}function v2e(e,t){return(0,C.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function y2e(){var e=[...arguments];return(0,C.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var x9=Object.freeze({x:0,y:0});function b2e(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function x2e(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function S2e(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function C2e(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function w2e(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function T2e(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var E2e=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=T2e(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=b2e(T2e(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(x2e)},D2e=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=C2e(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=C2e(r),o=i.reduce((e,t,r)=>e+b2e(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(x2e)};function O2e(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var k2e=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=O2e(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(S2e)};function A2e(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function j2e(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:x9}function M2e(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var N2e=M2e(1);function P2e(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function F2e(e,t,n){let r=P2e(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var I2e={ignoreTransform:!1};function S9(e,t){t===void 0&&(t=I2e);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=n9(e).getComputedStyle(e);t&&(n=F2e(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function L2e(e){return S9(e,{ignoreTransform:!0})}function R2e(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function z2e(e,t){return t===void 0&&(t=n9(e).getComputedStyle(e)),t.position===`fixed`}function B2e(e,t){t===void 0&&(t=n9(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function C9(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(r9(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!i9(i)||t2e(i)||n.includes(i))return n;let a=n9(e).getComputedStyle(i);return i!==e&&B2e(i,a)&&n.push(i),z2e(i,a)?n:r(i.parentNode)}return e?r(e):n}function V2e(e){let[t]=C9(e,1);return t??null}function w9(e){return!$7||!e?null:e9(e)?e:t9(e)?r9(e)||e===a9(e).scrollingElement?window:i9(e)?e:null:null}function H2e(e){return e9(e)?e.scrollX:e.scrollLeft}function U2e(e){return e9(e)?e.scrollY:e.scrollTop}function T9(e){return{x:H2e(e),y:U2e(e)}}var E9;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(E9||={});function W2e(e){return!$7||!e?!1:e===document.scrollingElement}function G2e(e){let t={x:0,y:0},n=W2e(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var K2e={x:.2,y:.2};function q2e(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=K2e);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=G2e(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=E9.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=E9.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=E9.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=E9.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function J2e(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function Y2e(e){return e.reduce((e,t)=>m9(e,T9(t)),x9)}function X2e(e){return e.reduce((e,t)=>e+H2e(t),0)}function Z2e(e){return e.reduce((e,t)=>e+U2e(t),0)}function Q2e(e,t){if(t===void 0&&(t=S9),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);V2e(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var $2e=[[`x`,[`left`,`right`],X2e],[`y`,[`top`,`bottom`],Z2e]],D9=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=C9(t),r=Y2e(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of $2e)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,`rect`,{enumerable:!1})}},O9=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function e4e(e){let{EventTarget:t}=n9(e);return e instanceof t?e:a9(e)}function k9(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var A9;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(A9||={});function t4e(e){e.preventDefault()}function n4e(e){e.stopPropagation()}var j9;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(j9||={});var r4e={start:[j9.Space,j9.Enter],cancel:[j9.Esc],end:[j9.Space,j9.Enter,j9.Tab]},i4e=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case j9.Right:return{...n,x:n.x+25};case j9.Left:return{...n,x:n.x-25};case j9.Down:return{...n,y:n.y+25};case j9.Up:return{...n,y:n.y-25}}},M9=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new O9(a9(t)),this.windowListeners=new O9(n9(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(A9.Resize,this.handleCancel),this.windowListeners.add(A9.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(A9.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&Q2e(n),t(x9)}handleKeyDown(e){if(g9(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=r4e,coordinateGetter:a=i4e,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:x9;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=h9(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=G2e(n),p=J2e(n),m={x:Math.min(i===j9.Right?p.right-p.width/2:p.right,Math.max(i===j9.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===j9.Down?p.bottom-p.height/2:p.bottom,Math.max(i===j9.Down?p.top:p.top+p.height/2,u.y))},h=i===j9.Right&&!s||i===j9.Left&&!c,g=i===j9.Down&&!l||i===j9.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===j9.Right&&e<=d.x||i===j9.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===j9.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===j9.Down&&e<=d.y||i===j9.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===j9.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,m9(h9(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};M9.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=r4e,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function a4e(e){return!!(e&&`distance`in e)}function o4e(e){return!!(e&&`delay`in e)}var N9=class{constructor(e,t,n){n===void 0&&(n=e4e(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=a9(i),this.documentListeners=new O9(this.document),this.listeners=new O9(n),this.windowListeners=new O9(n9(i)),this.initialCoordinates=_9(r)??x9,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(A9.Resize,this.handleCancel),this.windowListeners.add(A9.DragStart,t4e),this.windowListeners.add(A9.VisibilityChange,this.handleCancel),this.windowListeners.add(A9.ContextMenu,t4e),this.documentListeners.add(A9.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(o4e(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(a4e(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(A9.Click,n4e,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(A9.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=_9(e)??x9,s=h9(n,o);if(!t&&a){if(a4e(a)){if(a.tolerance!=null&&k9(s,a.tolerance))return this.handleCancel();if(k9(s,a.distance))return this.handleStart()}if(o4e(a)&&k9(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===j9.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},s4e={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},P9=class extends N9{constructor(e){let{event:t}=e,n=a9(t.target);super(e,s4e,n)}};P9.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var c4e={move:{name:`mousemove`},end:{name:`mouseup`}},l4e;(function(e){e[e.RightClick=2]=`RightClick`})(l4e||={});var u4e=class extends N9{constructor(e){super(e,c4e,a9(e.event.target))}};u4e.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===l4e.RightClick?!1:(r?.({event:n}),!0)}}];var F9={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},d4e=class extends N9{constructor(e){super(e,F9)}static setup(){return window.addEventListener(F9.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(F9.move.name,e)};function e(){}}};d4e.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var I9;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(I9||={});var L9;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(L9||={});function f4e(e){let{acceleration:t,activator:n=I9.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=L9.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=m4e({delta:d,disabled:!a}),[m,h]=n2e(),g=(0,C.useRef)({x:0,y:0}),_=(0,C.useRef)({x:0,y:0}),v=(0,C.useMemo)(()=>{switch(n){case I9.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case I9.DraggableRect:return i}},[n,i,c]),y=(0,C.useRef)(null),b=(0,C.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,C.useMemo)(()=>s===L9.TreeOrder?[...l].reverse():l,[s,l]);(0,C.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of x){if(r?.(e)===!1)continue;let n=u[l.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=q2e(e,n,v,t,f);for(let e of[`x`,`y`])p[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0){h(),y.current=e,m(b,o),g.current=a,_.current=i;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,x,u,JSON.stringify(f)])}var p4e={x:{[E9.Backward]:!1,[E9.Forward]:!1},y:{[E9.Backward]:!1,[E9.Forward]:!1}};function m4e(e){let{delta:t,disabled:n}=e,r=d9(t);return l9(e=>{if(n||!r||!e)return p4e;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[E9.Backward]:e.x[E9.Backward]||i.x===-1,[E9.Forward]:e.x[E9.Forward]||i.x===1},y:{[E9.Backward]:e.y[E9.Backward]||i.y===-1,[E9.Forward]:e.y[E9.Forward]||i.y===1}}},[n,t,r])}function h4e(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return l9(e=>t==null?null:r??e??null,[r,t])}function g4e(e,t){return(0,C.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var R9;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(R9||={});var _4e;(function(e){e.Optimized=`optimized`})(_4e||={});var v4e=new Map;function y4e(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,C.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,C.useRef)(e),d=g(),f=c9(d),p=(0,C.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,C.useRef)(null),h=l9(t=>{if(d&&!n)return v4e;if(!t||t===v4e||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new D9(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,C.useEffect)(()=>{u.current=e},[e]),(0,C.useEffect)(()=>{d||p()},[n,d]),(0,C.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,C.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case R9.Always:return!1;case R9.BeforeDragging:return n;default:return!n}}}function b4e(e,t){return l9(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function x4e(e,t){return b4e(e,t)}function S4e(e){let{callback:t,disabled:n}=e,r=s9(t),i=(0,C.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,C.useEffect)(()=>()=>i?.disconnect(),[i]),i}function z9(e){let{callback:t,disabled:n}=e,r=s9(t),i=(0,C.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,C.useEffect)(()=>()=>i?.disconnect(),[i]),i}function C4e(e){return new D9(S9(e),e)}function w4e(e,t,n){t===void 0&&(t=C4e);let[r,i]=(0,C.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=S4e({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=z9({callback:a});return o9(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function T4e(e){return j2e(e,b4e(e))}var E4e=[];function D4e(e){let t=(0,C.useRef)(e),n=l9(n=>e?n&&n!==E4e&&e&&t.current&&e.parentNode===t.current.parentNode?n:C9(e):E4e,[e]);return(0,C.useEffect)(()=>{t.current=e},[e]),n}function O4e(e){let[t,n]=(0,C.useState)(null),r=(0,C.useRef)(e),i=(0,C.useCallback)(e=>{let t=w9(e.target);t&&n(e=>e?(e.set(t,T9(t)),new Map(e)):null)},[]);return(0,C.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=w9(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,T9(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{w9(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,C.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>m9(e,t),x9):Y2e(e):x9,[e,t])}function k4e(e,t){t===void 0&&(t=[]);let n=(0,C.useRef)(null);return(0,C.useEffect)(()=>{n.current=null},t),(0,C.useEffect)(()=>{let t=e!==x9;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?h9(e,n.current):x9}function A4e(e){(0,C.useEffect)(()=>{if(!$7)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function j4e(e,t){return(0,C.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function M4e(e){return(0,C.useMemo)(()=>e?R2e(e):null,[e])}var N4e=[];function P4e(e,t){t===void 0&&(t=S9);let[n]=e,r=M4e(n?n9(n):null),[i,a]=(0,C.useState)(N4e);function o(){a(()=>e.length?e.map(e=>W2e(e)?r:new D9(t(e),e)):N4e)}let s=z9({callback:o});return o9(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function F4e(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return i9(t)?t:e}function I4e(e){let{measure:t}=e,[n,r]=(0,C.useState)(null),i=z9({callback:(0,C.useCallback)(e=>{for(let{target:n}of e)if(i9(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=u9((0,C.useCallback)(e=>{let n=F4e(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,C.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var L4e=[{sensor:P9,options:{}},{sensor:M9,options:{}}],R4e={current:{}},B9={draggable:{measure:L2e},droppable:{measure:L2e,strategy:R9.WhileDragging,frequency:_4e.Optimized},dragOverlay:{measure:S9}},V9=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},z4e={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new V9,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:b9},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:B9,measureDroppableContainers:b9,windowRect:null,measuringScheduled:!1},B4e={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:b9,draggableNodes:new Map,over:null,measureDroppableContainers:b9},H9=(0,C.createContext)(B4e),V4e=(0,C.createContext)(z4e);function H4e(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new V9}}}function U4e(e,t){switch(t.type){case y9.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case y9.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case y9.DragEnd:case y9.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case y9.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new V9(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case y9.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new V9(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case y9.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new V9(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function W4e(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,C.useContext)(H9),a=d9(r),o=d9(n?.id);return(0,C.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!g9(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=s2e(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function G4e(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function K4e(e){return(0,C.useMemo)(()=>({draggable:{...B9.draggable,...e?.draggable},droppable:{...B9.droppable,...e?.droppable},dragOverlay:{...B9.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function q4e(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,C.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;o9(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=j2e(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=V2e(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var J4e=(0,C.createContext)({...x9,scaleX:1,scaleY:1}),U9;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(U9||={});var Y4e=(0,C.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=L4e,collisionDetection:o=k2e,measuring:s,modifiers:c,...l}=e,[u,d]=(0,C.useReducer)(U4e,void 0,H4e),[f,p]=m2e(),[m,h]=(0,C.useState)(U9.Uninitialized),g=m===U9.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,C.useRef)({initial:null,translated:null}),w=(0,C.useMemo)(()=>_==null?null:{id:_,data:x?.data??R4e,rect:S},[_,x]),T=(0,C.useRef)(null),[E,D]=(0,C.useState)(null),[O,k]=(0,C.useState)(null),A=c9(l,Object.values(l)),j=p9(`DndDescribedBy`,t),M=(0,C.useMemo)(()=>b.getEnabled(),[b]),N=K4e(s),{droppableRects:P,measureDroppableContainers:F,measuringScheduled:I}=y4e(M,{dragging:g,dependencies:[y.x,y.y],config:N.droppable}),L=h4e(v,_),R=(0,C.useMemo)(()=>O?_9(O):null,[O]),ee=Ee(),z=x4e(L,N.draggable.measure);q4e({activeNode:_==null?null:v.get(_),config:ee.layoutShiftCompensation,initialRect:z,measure:N.draggable.measure});let te=w4e(L,N.draggable.measure,z),B=w4e(L?L.parentElement:null),V=(0,C.useRef)({activatorEvent:null,active:null,activeNode:L,collisionRect:null,collisions:null,droppableRects:P,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ne=b.getNodeFor(V.current.over?.id),re=I4e({measure:N.dragOverlay.measure}),ie=re.nodeRef.current??L,ae=g?re.rect??te:null,oe=!!(re.nodeRef.current&&re.rect),se=T4e(oe?null:te),ce=M4e(ie?n9(ie):null),le=D4e(g?ne??L:null),ue=P4e(le),de=G4e(c,{transform:{x:y.x-se.x,y:y.y-se.y,scaleX:1,scaleY:1},activatorEvent:O,active:w,activeNodeRect:te,containerNodeRect:B,draggingNodeRect:ae,over:V.current.over,overlayNodeRect:re.rect,scrollableAncestors:le,scrollableAncestorRects:ue,windowRect:ce}),fe=R?m9(R,y):null,pe=O4e(le),H=k4e(pe),me=k4e(pe,[te]),he=m9(de,H),U=ae?N2e(ae,de):null,ge=w&&U?o({active:w,collisionRect:U,droppableRects:P,droppableContainers:M,pointerCoordinates:fe}):null,_e=w2e(ge,`id`),[ve,ye]=(0,C.useState)(null),be=A2e(oe?de:m9(de,me),ve?.rect??null,te),xe=(0,C.useRef)(null),Se=(0,C.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(T.current==null)return;let i=v.get(T.current);if(!i)return;let a=e.nativeEvent;xe.current=new n({active:T.current,activeNode:i,event:a,options:r,context:V,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=A.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=A.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=T.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=A.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:S}};(0,ba.unstable_batchedUpdates)(()=>{r?.(i),h(U9.Initializing),d({type:y9.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),D(xe.current),k(a)})},onMove(e){d({type:y9.DragMove,coordinates:e})},onEnd:o(y9.DragEnd),onCancel:o(y9.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=V.current,o=null;if(t&&i){let{cancelDrop:s}=A.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===y9.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=y9.DragCancel)}T.current=null,(0,ba.unstable_batchedUpdates)(()=>{d({type:e}),h(U9.Uninitialized),ye(null),D(null),k(null),xe.current=null;let t=e===y9.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=A.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),Ce=g4e(a,(0,C.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(T.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},T.current=r,Se(n,t))},[v,Se]));A4e(a),o9(()=>{te&&m===U9.Initializing&&h(U9.Initialized)},[te,m]),(0,C.useEffect)(()=>{let{onDragMove:e}=A.current,{active:t,activatorEvent:n,collisions:r,over:i}=V.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:he.x,y:he.y},over:i};(0,ba.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[he.x,he.y]),(0,C.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=V.current;if(!e||T.current==null||!t||!i)return;let{onDragOver:a}=A.current,o=r.get(_e),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,ba.unstable_batchedUpdates)(()=>{ye(s),a?.(c),f({type:`onDragOver`,event:c})})},[_e]),o9(()=>{V.current={activatorEvent:O,active:w,activeNode:L,collisionRect:U,collisions:ge,droppableRects:P,draggableNodes:v,draggingNode:ie,draggingNodeRect:ae,droppableContainers:b,over:ve,scrollableAncestors:le,scrollAdjustedTranslate:he},S.current={initial:ae,translated:U}},[w,L,ge,U,v,ie,ae,P,b,ve,le,he]),f4e({...ee,delta:y,draggingRect:U,pointerCoordinates:fe,scrollableAncestors:le,scrollableAncestorRects:ue});let we=(0,C.useMemo)(()=>({active:w,activeNode:L,activeNodeRect:te,activatorEvent:O,collisions:ge,containerNodeRect:B,dragOverlay:re,draggableNodes:v,droppableContainers:b,droppableRects:P,over:ve,measureDroppableContainers:F,scrollableAncestors:le,scrollableAncestorRects:ue,measuringConfiguration:N,measuringScheduled:I,windowRect:ce}),[w,L,te,O,ge,B,re,v,b,P,ve,F,le,ue,N,I,ce]),Te=(0,C.useMemo)(()=>({activatorEvent:O,activators:Ce,active:w,activeNodeRect:te,ariaDescribedById:{draggable:j},dispatch:d,draggableNodes:v,over:ve,measureDroppableContainers:F}),[O,Ce,w,te,d,j,v,ve,F]);return C.createElement(f2e.Provider,{value:p},C.createElement(H9.Provider,{value:Te},C.createElement(V4e.Provider,{value:we},C.createElement(J4e.Provider,{value:be},i)),C.createElement(W4e,{disabled:n?.restoreFocus===!1})),C.createElement(_2e,{...n,hiddenTextDescribedById:j}));function Ee(){let e=E?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),X4e=(0,C.createContext)(null),Z4e=`button`,Q4e=`Draggable`;function $4e(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=p9(Q4e),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,C.useContext)(H9),{role:p=Z4e,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,C.useContext)(g?J4e:X4e),[v,y]=u9(),[b,x]=u9(),S=j4e(o,t),w=c9(n);return o9(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:w}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,C.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===Z4e?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:S,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function e3e(){return(0,C.useContext)(V4e)}var t3e=`Droppable`,n3e={timeout:25};function r3e(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=p9(t3e),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,C.useContext)(H9),u=(0,C.useRef)({disabled:n}),d=(0,C.useRef)(!1),f=(0,C.useRef)(null),p=(0,C.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...n3e,...i},_=c9(h??r),v=z9({callback:(0,C.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=u9((0,C.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=c9(t);return(0,C.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,C.useEffect)(()=>(s({type:y9.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:y9.UnregisterDroppable,key:a,id:r})),[r]),(0,C.useEffect)(()=>{n!==u.current.disabled&&(s({type:y9.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function W9(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function i3e(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function G9(e){return e!==null&&e>=0}function a3e(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function o3e(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var s3e=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=W9(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},K9={scaleX:1,scaleY:1},c3e=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...K9}:null}let s=l3e(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...K9}:r<t&&r>=a?{x:0,y:o.height+s,...K9}:{x:0,y:0,...K9}};function l3e(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var u3e=`Sortable`,d3e=C.createContext({activeIndex:-1,containerId:u3e,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:s3e,disabled:{draggable:!1,droppable:!1}});function f3e(e){let{children:t,id:n,items:r,strategy:i=s3e,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=e3e(),d=p9(u3e,n),f=s.rect!==null,p=(0,C.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,C.useRef)(p),v=!a3e(p,_.current),y=g!==-1&&h===-1||v,b=o3e(a);o9(()=>{v&&m&&u(p)},[v,p,m,u]),(0,C.useEffect)(()=>{_.current=p},[p]);let x=(0,C.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:i3e(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return C.createElement(d3e.Provider,{value:x},t)}var p3e=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return W9(n,r,i).indexOf(t)},m3e=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},h3e={duration:200,easing:`ease`},g3e=`transform`,_3e=v9.Transition.toString({property:g3e,duration:0,easing:`linear`}),v3e={roleDescription:`sortable`};function y3e(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,C.useState)(null),s=(0,C.useRef)(n);return o9(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=S9(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,C.useEffect)(()=>{a&&o(null)},[a]),a}function b3e(e){let{animateLayoutChanges:t=m3e,attributes:n,disabled:r,data:i,getNewIndex:a=p3e,id:o,strategy:s,resizeObserverConfig:c,transition:l=h3e}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,C.useContext)(d3e),y=x3e(r,p),b=u.indexOf(o),x=(0,C.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),S=(0,C.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:w,node:T,isOver:E,setNodeRef:D}=r3e({id:o,data:x,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...c}}),{active:O,activatorEvent:k,activeNodeRect:A,attributes:j,setNodeRef:M,listeners:N,isDragging:P,over:F,setActivatorNodeRef:I,transform:L}=$4e({id:o,data:x,attributes:{...v3e,...n},disabled:y.draggable}),R=e2e(D,M),ee=!!O,z=ee&&!m&&G9(f)&&G9(g),te=!_&&P,B=z?(te&&z?L:null)??(s??v)({rects:h,activeNodeRect:A,activeIndex:f,overIndex:g,index:b}):null,V=G9(f)&&G9(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,ne=O?.id,re=(0,C.useRef)({activeId:ne,items:u,newIndex:V,containerId:d}),ie=u!==re.current.items,ae=t({active:O,containerId:d,isDragging:P,isSorting:ee,id:o,index:b,items:u,newIndex:re.current.newIndex,previousItems:re.current.items,previousContainerId:re.current.containerId,transition:l,wasDragging:re.current.activeId!=null}),oe=y3e({disabled:!ae,index:b,node:T,rect:w});return(0,C.useEffect)(()=>{ee&&re.current.newIndex!==V&&(re.current.newIndex=V),d!==re.current.containerId&&(re.current.containerId=d),u!==re.current.items&&(re.current.items=u)},[ee,V,d,u]),(0,C.useEffect)(()=>{if(ne===re.current.activeId)return;if(ne!=null&&re.current.activeId==null){re.current.activeId=ne;return}let e=setTimeout(()=>{re.current.activeId=ne},50);return()=>clearTimeout(e)},[ne]),{active:O,activeIndex:f,attributes:j,data:x,rect:w,index:b,newIndex:V,items:u,isOver:E,isSorting:ee,isDragging:P,listeners:N,node:T,overIndex:g,over:F,setNodeRef:R,setActivatorNodeRef:I,setDroppableNodeRef:D,setDraggableNodeRef:M,transform:oe??B,transition:se()};function se(){if(oe||ie&&re.current.newIndex===b)return _3e;if(!(te&&!g9(k)||!l)&&(ee||ae))return v9.Transition.toString({...l,property:g3e})}}function x3e(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function q9(e){if(!e)return!1;let t=e.data.current;return!!(t&&`sortable`in t&&typeof t.sortable==`object`&&`containerId`in t.sortable&&`items`in t.sortable&&`index`in t.sortable)}var S3e=[j9.Down,j9.Right,j9.Up,j9.Left],C3e=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(S3e.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case j9.Down:r.top<a.top&&t.push(n);break;case j9.Up:r.top>a.top&&t.push(n);break;case j9.Left:r.left>a.left&&t.push(n);break;case j9.Right:r.left<a.left&&t.push(n);break}});let c=D2e({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=w2e(c,`id`);if(l===o?.id&&c.length>1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=C9(c).some((e,t)=>s[t]!==e),i=w3e(e,t),a=T3e(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:h9(u,l)}}}};function w3e(e,t){return!q9(e)||!q9(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function T3e(e,t){return!q9(e)||!q9(t)||!w3e(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}var E3e=({bridge:e,index:t})=>{let{attributes:n,listeners:r,setNodeRef:i,transform:a,transition:o,isDragging:s}=b3e({id:e.id}),[c,l]=(0,C.useState)(!1);return(0,C.useEffect)(()=>{DE(e.id).then(l)},[e.id]),(0,W.jsx)(vv,{ref:i,style:{transform:v9.Transform.toString(a),transition:o,opacity:s?.5:1},variant:`outlined`,sx:{cursor:`grab`,"&:active":{cursor:`grabbing`},bgcolor:s?`action.selected`:`background.paper`,width:`fit-content`},children:(0,W.jsxs)(xv,{sx:{display:`flex`,alignItems:`center`,gap:1.5,py:1,"&:last-child":{pb:1}},children:[(0,W.jsx)(Z,{...n,...r,sx:{display:`flex`,alignItems:`center`,color:`text.secondary`},children:(0,W.jsx)(khe,{})}),(0,W.jsx)(kv,{label:t+1,size:`small`,color:`primary`,sx:{minWidth:32,fontWeight:`bold`}}),c?(0,W.jsx)(Z,{component:`img`,src:OE(e.id),alt:e.name,sx:{width:40,height:40,borderRadius:`50%`,objectFit:`cover`,boxShadow:2}}):(0,W.jsx)(Db,{sx:{bgcolor:PE(e),width:40,height:40,boxShadow:2},children:(0,W.jsx)(NE(e),{sx:{fontSize:24}})}),(0,W.jsxs)(Z,{sx:{flex:1},children:[(0,W.jsx)(Q,{variant:`subtitle1`,fontWeight:500,children:e.name}),(0,W.jsxs)(Q,{variant:`caption`,color:`text.secondary`,children:[`Port: `,e.port,` • Priority: `,e.priority??100]})]})]})})},D3e=()=>{let{t:e}=hs(),t=Xv(),{content:n,isLoading:r}=VT(),i=Kme(),[a,o]=(0,C.useState)([]),[s,c]=(0,C.useState)(!1);(0,C.useEffect)(()=>{n&&(o([...n].sort((e,t)=>(e.priority??100)-(t.priority??100))),c(!1))},[n]);let l=y2e(v2e(P9),v2e(M9,{coordinateGetter:C3e})),u=(0,C.useCallback)(e=>{let{active:t,over:n}=e;n&&t.id!==n.id&&(o(e=>W9(e,e.findIndex(e=>e.id===t.id),e.findIndex(e=>e.id===n.id))),c(!0))},[]),d=(0,C.useCallback)(async()=>{let n=a.map((e,t)=>({id:e.id,priority:(t+1)*10}));try{await i(n),t.show({message:e(`startup.saveSuccess`),severity:`success`}),c(!1)}catch(n){t.show({message:n instanceof Error?n.message:e(`startup.saveFailed`),severity:`error`})}},[a,i,t,e]),f=(0,C.useMemo)(()=>a.map(e=>e.id),[a]);return r?(0,W.jsxs)(Q,{children:[e(`common.loading`),`...`]}):(0,W.jsxs)(Gv,{spacing:3,children:[(0,W.jsx)(Yv,{items:[{name:e(`nav.bridges`),to:Y9.bridges},{name:e(`startup.title`),to:Y9.startup}]}),(0,W.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:2,children:[(0,W.jsx)(pv,{color:`primary`,fontSize:`large`}),(0,W.jsxs)(Z,{children:[(0,W.jsx)(Q,{variant:`h5`,fontWeight:600,children:e(`startup.title`)}),(0,W.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:e(`startup.description`)})]})]}),s&&(0,W.jsx)(Kh,{severity:`info`,action:(0,W.jsx)(_v,{color:`inherit`,size:`small`,startIcon:(0,W.jsx)(_E,{}),onClick:d,children:e(`startup.saveChanges`)}),children:e(`startup.unsavedChanges`)}),(0,W.jsx)(Y4e,{sensors:l,collisionDetection:E2e,onDragEnd:u,children:(0,W.jsx)(f3e,{items:f,strategy:c3e,children:(0,W.jsx)(Gv,{spacing:1,children:a.map((e,t)=>(0,W.jsx)(E3e,{bridge:e,index:t},e.id))})})}),a.length===0&&(0,W.jsx)(Q,{color:`text.secondary`,textAlign:`center`,py:4,children:e(`startup.noBridges`)}),s&&a.length>0&&(0,W.jsx)(Z,{display:`flex`,justifyContent:`flex-end`,children:(0,W.jsx)(_v,{variant:`contained`,startIcon:(0,W.jsx)(_E,{}),onClick:d,children:e(`startup.saveOrder`)})})]})},J9=`https://riddix.github.io/home-assistant-matter-hub`,Y9={dashboard:`/`,bridges:`/bridges`,bridge:e=>`/bridges/${e}`,createBridge:`/bridges/create`,areaSetup:`/bridges/area-setup`,editBridge:e=>`/bridges/${e}/edit`,devices:`/devices`,standaloneDevices:`/standalone-devices`,networkMap:`/network-map`,health:`/health`,labels:`/labels`,lockCredentials:`/lock-credentials`,plugins:`/plugins`,settings:`/settings`,startup:`/startup`,githubRepository:`https://github.com/riddix/home-assistant-matter-hub/`,documentation:J9,support:`${J9}/support`,faq:{multiFabric:`${J9}/connect-multiple-fabrics`,bridgeConfig:`${J9}/bridge-configuration`}},O3e=[{path:``,element:(0,W.jsx)(Sre,{}),children:[{path:``,element:(0,W.jsx)(Xge,{})},{path:Y9.bridges,element:(0,W.jsx)(Wge,{})},{path:Y9.createBridge,element:(0,W.jsx)(Mqe,{})},{path:Y9.areaSetup,element:(0,W.jsx)(xae,{})},{path:Y9.bridge(`:bridgeId`),element:(0,W.jsx)(che,{})},{path:Y9.editBridge(`:bridgeId`),element:(0,W.jsx)(Nqe,{})},{path:Y9.devices,element:(0,W.jsx)(m_e,{})},{path:Y9.standaloneDevices,element:(0,W.jsx)($0e,{})},{path:Y9.networkMap,element:(0,W.jsx)(_0e,{})},{path:Y9.health,element:(0,W.jsx)(Qqe,{})},{path:Y9.labels,element:(0,W.jsx)(nJe,{})},{path:Y9.lockCredentials,element:(0,W.jsx)(cJe,{})},{path:Y9.plugins,element:(0,W.jsx)(U0e,{})},{path:Y9.settings,element:(0,W.jsx)(J0e,{})},{path:Y9.startup,element:(0,W.jsx)(D3e,{})},{path:`*`,element:(0,W.jsx)(lJe,{})}]}],k3e=A_({items:{isInitialized:!1,isLoading:!1}},e=>{e.addCase(W_.pending,e=>{e.items.isLoading=!0}).addCase(W_.rejected,(e,t)=>{e.items.isInitialized=!0,e.items.isLoading=!1,e.items.content=void 0,e.items.error=t.error}).addCase(W_.fulfilled,(e,t)=>{e.items.isInitialized=!0,e.items.isLoading=!1,e.items.content=t.payload,e.items.error=void 0}).addCase(G_.fulfilled,(e,t)=>{e.items.content?.push(t.payload)}).addCase(q_.fulfilled,(e,t)=>{let n=e.items.content?.findIndex(e=>e.id===t.payload.id)??-1;n!==-1&&(e.items.content[n]=t.payload)}).addCase(J_.fulfilled,(e,t)=>{let n=e.items.content?.findIndex(e=>e.id===t.payload.id)??-1;n!==-1&&(e.items.content[n]=t.payload)}).addCase(K_.fulfilled,(e,t)=>{if(e.items.content){let n=e.items.content.findIndex(e=>e.id===t.meta.arg);n!==-1&&e.items.content.splice(n,1)}}).addCase(Y_,(e,t)=>{e.items.isInitialized=!0,e.items.isLoading=!1,e.items.content=t.payload,e.items.error=void 0}).addCase(X_,(e,t)=>{if(e.items.content){let n=e.items.content.findIndex(e=>e.id===t.payload.id);n===-1?e.items.content.push(t.payload):e.items.content[n]=t.payload}})}),A3e=A_({byBridge:{}},e=>{e.addCase(KT.pending,(e,t)=>{e.byBridge[t.meta.arg]=X9(e.byBridge[t.meta.arg],t)}).addCase(KT.rejected,(e,t)=>{e.byBridge[t.meta.arg]=X9(e.byBridge[t.meta.arg],t)}).addCase(KT.fulfilled,(e,t)=>{e.byBridge[t.meta.arg]=X9(e.byBridge[t.meta.arg],t)})}),X9=A_({isInitialized:!1,isLoading:!1,content:void 0,error:void 0},e=>{e.addCase(KT.pending,e=>{e.isLoading=!0}).addCase(KT.rejected,(e,t)=>{e.isInitialized=!0,e.isLoading=!1,e.content=void 0,e.error=t.error}).addCase(KT.fulfilled,(e,t)=>{e.isInitialized=!0,e.isLoading=!1,e.content=t.payload,e.error=void 0})}),j3e=Yne({reducer:{bridges:k3e,devices:A3e}}),Z9=vp({createStyledComponent:J(`div`,{name:`MuiContainer`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[`maxWidth${Y(String(n.maxWidth))}`],n.fixed&&t.fixed,n.disableGutters&&t.disableGutters]}}),useThemeProps:e=>jm({props:e,name:`MuiContainer`})});function M3e(e){return zd(`MuiToolbar`,e)}K(`MuiToolbar`,[`root`,`gutters`,`regular`,`dense`]);var N3e=e=>{let{classes:t,disableGutters:n,variant:r}=e;return pp({root:[`root`,!n&&`gutters`,r]},M3e,t)},P3e=J(`div`,{name:`MuiToolbar`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,!n.disableGutters&&t.gutters,t[n.variant]]}})(Lm(({theme:e})=>({position:`relative`,display:`flex`,alignItems:`center`,variants:[{props:({ownerState:e})=>!e.disableGutters,style:{paddingLeft:e.spacing(2),paddingRight:e.spacing(2),[e.breakpoints.up(`sm`)]:{paddingLeft:e.spacing(3),paddingRight:e.spacing(3)}}},{props:{variant:`dense`},style:{minHeight:48}},{props:{variant:`regular`},style:e.mixins.toolbar}]}))),F3e=C.forwardRef(function(e,t){let n=jm({props:e,name:`MuiToolbar`}),{className:r,component:i=`div`,disableGutters:a=!1,variant:o=`regular`,...s}=n,c={...n,component:i,disableGutters:a,variant:o};return(0,W.jsx)(P3e,{as:i,className:G(N3e(c).root,r),ref:t,ownerState:c,...s})}),I3e=class extends C.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error(`ErrorBoundary caught:`,e,t.componentStack)}render(){return this.state.hasError?(0,W.jsxs)(Z,{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,minHeight:`60vh`,gap:2,p:4,children:[(0,W.jsx)(yb,{color:`error`,sx:{fontSize:64}}),(0,W.jsx)(Q,{variant:`h5`,fontWeight:600,children:Is.t(`errorBoundary.title`)}),(0,W.jsx)(Q,{variant:`body2`,color:`text.secondary`,textAlign:`center`,maxWidth:480,children:this.state.error?.message??Is.t(`errorBoundary.fallbackMessage`)}),(0,W.jsx)(_v,{variant:`contained`,onClick:()=>{this.setState({hasError:!1,error:null}),window.location.reload()},children:Is.t(`errorBoundary.reload`)})]}):this.props.children}};function L3e(e){return zd(`MuiFab`,e)}var R3e=K(`MuiFab`,[`root`,`primary`,`secondary`,`extended`,`circular`,`focusVisible`,`disabled`,`colorInherit`,`sizeSmall`,`sizeMedium`,`sizeLarge`,`info`,`error`,`warning`,`success`]),z3e=e=>{let{color:t,variant:n,classes:r,size:i}=e,a=pp({root:[`root`,n,`size${Y(i)}`,t===`inherit`?`colorInherit`:t]},L3e,r);return{...r,...a}},B3e=J(Ih,{name:`MuiFab`,slot:`Root`,shouldForwardProp:e=>km(e)||e===`classes`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[n.variant],t[`size${Y(n.size)}`],n.color===`inherit`&&t.colorInherit,t[Y(n.size)],t[n.color]]}})(Lm(({theme:e})=>({...e.typography.button,minHeight:36,transition:e.transitions.create([`background-color`,`box-shadow`,`border-color`],{duration:e.transitions.duration.short}),borderRadius:`50%`,padding:0,minWidth:0,width:56,height:56,zIndex:(e.vars||e).zIndex.fab,boxShadow:(e.vars||e).shadows[6],"&:active":{boxShadow:(e.vars||e).shadows[12]},color:e.vars?e.vars.palette.grey[900]:e.palette.getContrastText?.(e.palette.grey[300]),backgroundColor:(e.vars||e).palette.grey[300],"&:hover":{backgroundColor:(e.vars||e).palette.grey.A100,"@media (hover: none)":{backgroundColor:(e.vars||e).palette.grey[300]},textDecoration:`none`},[`&.${R3e.focusVisible}`]:{boxShadow:(e.vars||e).shadows[6]},variants:[{props:{size:`small`},style:{width:40,height:40}},{props:{size:`medium`},style:{width:48,height:48}},{props:{variant:`extended`},style:{borderRadius:48/2,padding:`0 16px`,width:`auto`,minHeight:`auto`,minWidth:48,height:48}},{props:{variant:`extended`,size:`small`},style:{width:`auto`,padding:`0 8px`,borderRadius:34/2,minWidth:34,height:34}},{props:{variant:`extended`,size:`medium`},style:{width:`auto`,padding:`0 16px`,borderRadius:40/2,minWidth:40,height:40}},{props:{color:`inherit`},style:{color:`inherit`}}]})),Lm(({theme:e})=>({variants:[...Object.entries(e.palette).filter(Km([`dark`,`contrastText`])).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].contrastText,backgroundColor:(e.vars||e).palette[t].main,"&:hover":{backgroundColor:(e.vars||e).palette[t].dark,"@media (hover: none)":{backgroundColor:(e.vars||e).palette[t].main}}}}))]})),Lm(({theme:e})=>({[`&.${R3e.disabled}`]:{color:(e.vars||e).palette.action.disabled,boxShadow:(e.vars||e).shadows[0],backgroundColor:(e.vars||e).palette.action.disabledBackground}}))),V3e=C.forwardRef(function(e,t){let n=jm({props:e,name:`MuiFab`}),{children:r,className:i,color:a=`default`,component:o=`button`,disabled:s=!1,disableFocusRipple:c=!1,focusVisibleClassName:l,size:u=`large`,variant:d=`circular`,...f}=n,p={...n,color:a,component:o,disabled:s,disableFocusRipple:c,size:u,variant:d},m=z3e(p);return(0,W.jsx)(B3e,{className:G(m.root,i),component:o,disabled:s,focusRipple:!c,focusVisibleClassName:G(m.focusVisible,l),ownerState:p,ref:t,...f,classes:m,children:r})}),H3e=[{code:`en`,flag:`🇬🇧`,name:`English`},{code:`de`,flag:`🇩🇪`,name:`Deutsch`},{code:`fr`,flag:`🇫🇷`,name:`Français`},{code:`es`,flag:`🇪🇸`,name:`Español`},{code:`it`,flag:`🇮🇹`,name:`Italiano`},{code:`hu`,flag:`🇭🇺`,name:`Magyar`},{code:`zh`,flag:`🇨🇳`,name:`中文`},{code:`zh-TW`,flag:`🇹🇼`,name:`繁體中文`},{code:`ja`,flag:`🇯🇵`,name:`日本語`},{code:`th`,flag:`🇹🇭`,name:`ไทย`},{code:`sv`,flag:`🇸🇪`,name:`Svenska`},{code:`tr`,flag:`🇹🇷`,name:`Türkçe`},{code:`ru`,flag:`🇷🇺`,name:`Русский`}],U3e=`hamh-custom-languages`;function W3e(){try{let e=localStorage.getItem(U3e);return e?JSON.parse(e).map(e=>({code:e.code,flag:`🌐`,name:e.name})):[]}catch{return[]}}var G3e=`https://github.com/RiDDiX/home-assistant-matter-hub/issues/new?labels=translation&title=Translation+improvement`;function K3e(){let{t:e,i18n:t}=hs(),[n,r]=(0,C.useState)(!1),i=(0,C.useRef)(null),a=(0,C.useMemo)(()=>[...H3e,...W3e()],[]),o=t.language??`en`,s=a.some(e=>e.code===o)?o:o.split(`-`)[0]??`en`,c=(0,C.useCallback)(()=>{r(e=>!e)},[]),l=(0,C.useCallback)(e=>{t.changeLanguage(e),r(!1)},[t]);return(0,W.jsx)(Yh,{onClickAway:(0,C.useCallback)(()=>{r(!1)},[]),children:(0,W.jsxs)(Z,{children:[(0,W.jsx)(V3e,{ref:i,size:`small`,color:`primary`,onClick:c,"aria-label":`Change language`,sx:{position:`fixed`,bottom:24,right:24,zIndex:1300},children:(0,W.jsx)(Ihe,{})}),(0,W.jsx)(cb,{open:n,anchorEl:i.current,placement:`top-end`,transition:!0,sx:{zIndex:1300},children:({TransitionProps:t})=>(0,W.jsx)(Pb,{...t,timeout:200,children:(0,W.jsxs)(qm,{elevation:8,sx:{mb:1,py:.5,minWidth:160,borderRadius:2,overflow:`hidden`},children:[a.map(e=>(0,W.jsxs)(Z,{onClick:()=>l(e.code),sx:{display:`flex`,alignItems:`center`,gap:1.5,px:2,py:1,cursor:`pointer`,bgcolor:s===e.code?`action.selected`:`transparent`,"&:hover":{bgcolor:`action.hover`},transition:`background-color 0.15s`},children:[(0,W.jsx)(Q,{sx:{fontSize:`1.4rem`,lineHeight:1,userSelect:`none`},children:e.flag}),(0,W.jsx)(Q,{variant:`body2`,fontWeight:s===e.code?600:400,children:e.name})]},e.code)),(0,W.jsx)(Kb,{}),(0,W.jsxs)(Z,{sx:{display:`flex`,alignItems:`flex-start`,gap:.75,px:2,py:1},children:[(0,W.jsx)(Zv,{sx:{fontSize:14,mt:.25,color:`text.secondary`}}),(0,W.jsxs)(Q,{variant:`caption`,color:`text.secondary`,sx:{lineHeight:1.4},children:[e(`languageSwitcher.disclaimer`),` `,(0,W.jsx)(Jv,{href:G3e,target:`_blank`,rel:`noopener`,sx:{fontSize:`inherit`},children:e(`languageSwitcher.contribute`)})]})]})]})})})]})})}var q3e={name:`home-assistant-matter-hub`,description:``,version:`2.1.0-alpha.745`,private:!1,type:`module`,bin:{"home-assistant-matter-hub":`./dist/backend/cli.js`},author:{name:`riddix`,url:`https://github.com/riddix`},keywords:[`home-assistant`,`homeassistant`,`home`,`assistant`,`apple home`,`google home`,`apple`,`google`,`alexa`,`matter`,`matter.js`,`matterjs`,`project-chip`,`smart`,`smarthome`,`smart-home`],bugs:{url:`https://github.com/riddix/home-assistant-matter-hub/issues`},license:`Apache-2.0`,repository:`github:riddix/home-assistant-matter-hub`,scripts:{cleanup:`npx rimraf node_modules dist pack LICENSE README.md`,build:`node build.js`,bundle:`pnpm pack --out package.tgz`,postbuild:`pnpm run bundle`,test:`vitest run`,prestart:`pnpm run build`,start:`dotenvx run -f ../../.env -- ./dist/backend/cli.js start`},dependencies:{"@matter/main":`0.17.2`,"@matter/nodejs":`0.17.2`,"@matter/general":`0.17.2`,"@matter/types":`0.17.2`,ajv:`8.18.0`,archiver:`7.0.1`,color:`5.0.3`,debounce:`3.0.0`,express:`5.2.1`,"express-basic-auth":`1.2.1`,"express-ip-access-control":`1.1.3`,"home-assistant-js-websocket":`9.6.0`,"lodash-es":`4.18.1`,multer:`2.1.1`,nocache:`4.0.0`,unzipper:`0.12.3`,werift:`0.22.4`,ws:`8.21.0`,yargs:`18.0.0`},devDependencies:{"@home-assistant-matter-hub/backend":`workspace:*`,"@home-assistant-matter-hub/frontend":`workspace:*`,"@home-assistant-matter-hub/common":`workspace:*`,"@types/lodash-es":`^4.17.12`},overrides:{minimatch:`9.0.7`,"path-to-regexp":`^8.4.0`,glob:`^13.0.0`},nx:{targets:{start:{cache:!1,dependsOn:[`build`]},pack:{cache:!0,dependsOn:[`build`],outputs:[`{projectRoot}/pack`]},build:{inputs:[`^default`,`default`,`{workspaceRoot}/README.md`,`{workspaceRoot}/LICENSE`],outputs:[`{projectRoot}/dist`,`{projectRoot}/README.md`,`{projectRoot}/LICENSE`]}}}};function J3e(){let e=`2.1.0-alpha.745`,[t,n]=(0,C.useState)(null);(0,C.useEffect)(()=>{fetch(`api/health`).then(e=>e.ok?e.json():null).then(e=>{e?.version&&n(e.version)}).catch(()=>{})},[]);let r=(0,C.useMemo)(()=>!t||e===`0.0.0-dev`?!1:e!==t,[t]);return(0,C.useMemo)(()=>({name:q3e.name,version:t??e,frontendVersion:e,backendVersion:t,versionMismatch:r}),[t,r])}var Y3e=()=>{let{t:e}=hs(),t=[{name:e(`footer.github`),url:Y9.githubRepository},{name:e(`footer.documentation`),url:Y9.documentation},{name:e(`footer.support`),url:Y9.support}];return(0,W.jsxs)(Z9,{sx:{mt:16,mb:4},children:[(0,W.jsx)(Kb,{sx:{mt:4,mb:4}}),(0,W.jsx)(Rv,{container:!0,spacing:2,justifyContent:`center`,children:t.map((e,t)=>(0,W.jsx)(Rv,{size:{xs:12,sm:`auto`},children:(0,W.jsx)(_v,{fullWidth:!0,size:`small`,variant:`outlined`,component:Jv,href:e.url,target:`_blank`,children:e.name})},t.toString()))})]})};function X3e(e){return zd(`MuiAppBar`,e)}K(`MuiAppBar`,[`root`,`positionFixed`,`positionAbsolute`,`positionSticky`,`positionStatic`,`positionRelative`,`colorDefault`,`colorPrimary`,`colorSecondary`,`colorInherit`,`colorTransparent`,`colorError`,`colorInfo`,`colorSuccess`,`colorWarning`]);var Z3e=e=>{let{color:t,position:n,classes:r}=e;return pp({root:[`root`,`color${Y(t)}`,`position${Y(n)}`]},X3e,r)},Q3e=(e,t)=>e?`${e.replace(`)`,``)}, ${t})`:t,$3e=J(qm,{name:`MuiAppBar`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[`position${Y(n.position)}`],t[`color${Y(n.color)}`]]}})(Lm(({theme:e})=>({display:`flex`,flexDirection:`column`,width:`100%`,boxSizing:`border-box`,flexShrink:0,variants:[{props:{position:`fixed`},style:{position:`fixed`,zIndex:(e.vars||e).zIndex.appBar,top:0,left:`auto`,right:0,"@media print":{position:`absolute`}}},{props:{position:`absolute`},style:{position:`absolute`,zIndex:(e.vars||e).zIndex.appBar,top:0,left:`auto`,right:0}},{props:{position:`sticky`},style:{position:`sticky`,zIndex:(e.vars||e).zIndex.appBar,top:0,left:`auto`,right:0}},{props:{position:`static`},style:{position:`static`}},{props:{position:`relative`},style:{position:`relative`}},{props:{color:`inherit`},style:{"--AppBar-color":`inherit`,color:`var(--AppBar-color)`}},{props:{color:`default`},style:{"--AppBar-background":e.vars?e.vars.palette.AppBar.defaultBg:e.palette.grey[100],"--AppBar-color":e.vars?e.vars.palette.text.primary:e.palette.getContrastText(e.palette.grey[100]),...e.applyStyles(`dark`,{"--AppBar-background":e.vars?e.vars.palette.AppBar.defaultBg:e.palette.grey[900],"--AppBar-color":e.vars?e.vars.palette.text.primary:e.palette.getContrastText(e.palette.grey[900])})}},...Object.entries(e.palette).filter(Km([`contrastText`])).map(([t])=>({props:{color:t},style:{"--AppBar-background":(e.vars??e).palette[t].main,"--AppBar-color":(e.vars??e).palette[t].contrastText}})),{props:e=>e.enableColorOnDark===!0&&![`inherit`,`transparent`].includes(e.color),style:{backgroundColor:`var(--AppBar-background)`,color:`var(--AppBar-color)`}},{props:e=>e.enableColorOnDark===!1&&![`inherit`,`transparent`].includes(e.color),style:{backgroundColor:`var(--AppBar-background)`,color:`var(--AppBar-color)`,...e.applyStyles(`dark`,{backgroundColor:e.vars?Q3e(e.vars.palette.AppBar.darkBg,`var(--AppBar-background)`):null,color:e.vars?Q3e(e.vars.palette.AppBar.darkColor,`var(--AppBar-color)`):null})}},{props:{color:`transparent`},style:{"--AppBar-background":`transparent`,"--AppBar-color":`inherit`,backgroundColor:`var(--AppBar-background)`,color:`var(--AppBar-color)`,...e.applyStyles(`dark`,{backgroundImage:`none`})}}]}))),e6e=C.forwardRef(function(e,t){let n=jm({props:e,name:`MuiAppBar`}),{className:r,color:i=`primary`,enableColorOnDark:a=!1,position:o=`fixed`,...s}=n,c={...n,color:i,position:o,enableColorOnDark:a};return(0,W.jsx)($3e,{square:!0,component:`header`,ownerState:c,elevation:4,className:G(Z3e(c).root,r,o===`fixed`&&`mui-fixed`),ref:t,...s})}),t6e={visibility:`hidden`};function n6e(e,t,n){let r=n&&n.getBoundingClientRect(),i=rh(t),a=t.style.transform,o=t.style.transition;t.style.transition=``,t.style.transform=``;let s=t.getBoundingClientRect(),c=i.getComputedStyle(t).getPropertyValue(`transform`);t.style.transform=a,t.style.transition=o;let l=0,u=0;if(c&&c!==`none`&&typeof c==`string`){let e=c.split(`(`)[1].split(`)`)[0].split(`,`);l=parseInt(e[4],10),u=parseInt(e[5],10)}return e===`left`?r?`translateX(${r.right+l-s.left}px)`:`translateX(${i.innerWidth+l-s.left}px)`:e===`right`?r?`translateX(-${s.right-r.left-l}px)`:`translateX(-${s.left+s.width-l}px)`:e===`up`?r?`translateY(${r.bottom+u-s.top}px)`:`translateY(${i.innerHeight+u-s.top}px)`:r?`translateY(-${s.top-r.top+s.height-u}px)`:`translateY(-${s.top+s.height-u}px)`}function r6e(e){return typeof e==`function`?e():e}function Q9(e,t,n){let r=n6e(e,t,r6e(n));r&&(t.style.transform=r)}var i6e=C.forwardRef(function(e,t){let n=Em(),r={enter:n.transitions.easing.easeOut,exit:n.transitions.easing.sharp},i={enter:n.transitions.duration.enteringScreen,exit:n.transitions.duration.leavingScreen},{addEndListener:a,appear:o=!0,children:s,container:c,direction:l=`down`,easing:u=r,in:d,onEnter:f,onEntered:p,onEntering:m,onExit:h,onExited:g,onExiting:_,style:v,timeout:y=i,...b}=e,x=C.useRef(null),S=dh(qh(s),x,t),w=Zh(x,(e,t)=>{Q9(l,e,c),Xh(e),f&&f(e,t)}),T=Zh(x,(e,t)=>{let r=$h({timeout:y,style:v,easing:u},{mode:`enter`});e.style.transition=n.transitions.create(`transform`,r),e.style.transform=`none`,m&&m(e,t)}),E=Zh(x,p),D=Zh(x,_),O=Zh(x,e=>{let t=$h({timeout:y,style:v,easing:u},{mode:`exit`});e.style.transition=n.transitions.create(`transform`,t),Q9(l,e,c),h&&h(e)}),k=Zh(x,e=>{e.style.transition=``,g&&g(e)}),A=e=>{a&&a(x.current,e)},j=C.useCallback(()=>{x.current&&Q9(l,x.current,c)},[l,c]);return C.useEffect(()=>{if(d||l===`down`||l===`right`)return;let e=Qm(()=>{x.current&&Q9(l,x.current,c)}),t=rh(x.current);return t.addEventListener(`resize`,e),()=>{e.clear(),t.removeEventListener(`resize`,e)}},[l,d,c]),C.useEffect(()=>{d||j()},[d,j]),(0,W.jsx)(Dh,{nodeRef:x,onEnter:w,onEntered:E,onEntering:T,onExit:O,onExited:k,onExiting:D,addEndListener:A,appear:o,in:d,timeout:y,...b,children:(e,{ownerState:t,...n})=>{let r;return r=e===`exited`&&!d?v||s.props.style?{visibility:`hidden`,...v,...s.props.style}:t6e:v&&s.props.style?{...v,...s.props.style}:v||s.props.style,C.cloneElement(s,{ref:S,style:r,...n})}})});function a6e(e){return zd(`MuiDrawer`,e)}K(`MuiDrawer`,[`root`,`docked`,`paper`,`anchorLeft`,`anchorRight`,`anchorTop`,`anchorBottom`,`paperAnchorLeft`,`paperAnchorRight`,`paperAnchorTop`,`paperAnchorBottom`,`paperAnchorDockedLeft`,`paperAnchorDockedRight`,`paperAnchorDockedTop`,`paperAnchorDockedBottom`,`modal`]);var o6e=(e,t)=>{let{ownerState:n}=e;return[t.root,(n.variant===`permanent`||n.variant===`persistent`)&&t.docked,n.variant===`temporary`&&t.modal]},s6e=e=>{let{classes:t,anchor:n,variant:r}=e;return pp({root:[`root`,`anchor${Y(n)}`],docked:[(r===`permanent`||r===`persistent`)&&`docked`],modal:[`modal`],paper:[`paper`,`paperAnchor${Y(n)}`,r!==`temporary`&&`paperAnchorDocked${Y(n)}`]},a6e,t)},c6e=J(Rb,{name:`MuiDrawer`,slot:`Root`,overridesResolver:o6e})(Lm(({theme:e})=>({zIndex:(e.vars||e).zIndex.drawer}))),l6e=J(`div`,{shouldForwardProp:km,name:`MuiDrawer`,slot:`Docked`,skipVariantsResolver:!1,overridesResolver:o6e})({flex:`0 0 auto`}),u6e=J(qm,{name:`MuiDrawer`,slot:`Paper`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.paper,t[`paperAnchor${Y(n.anchor)}`],n.variant!==`temporary`&&t[`paperAnchorDocked${Y(n.anchor)}`]]}})(Lm(({theme:e})=>({overflowY:`auto`,display:`flex`,flexDirection:`column`,height:`100%`,flex:`1 0 auto`,zIndex:(e.vars||e).zIndex.drawer,WebkitOverflowScrolling:`touch`,position:`fixed`,top:0,outline:0,variants:[{props:{anchor:`left`},style:{left:0}},{props:{anchor:`top`},style:{top:0,left:0,right:0,height:`auto`,maxHeight:`100%`}},{props:{anchor:`right`},style:{right:0}},{props:{anchor:`bottom`},style:{top:`auto`,left:0,bottom:0,right:0,height:`auto`,maxHeight:`100%`}},{props:({ownerState:e})=>e.anchor===`left`&&e.variant!==`temporary`,style:{borderRight:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:e})=>e.anchor===`top`&&e.variant!==`temporary`,style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:e})=>e.anchor===`right`&&e.variant!==`temporary`,style:{borderLeft:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:e})=>e.anchor===`bottom`&&e.variant!==`temporary`,style:{borderTop:`1px solid ${(e.vars||e).palette.divider}`}}]}))),d6e={left:`right`,right:`left`,top:`down`,bottom:`up`};function f6e(e){return[`left`,`right`].includes(e)}function p6e({direction:e},t){return e===`rtl`&&f6e(t)?d6e[t]:t}var m6e=C.forwardRef(function(e,t){let n=jm({props:e,name:`MuiDrawer`}),r=Em(),i=Mf(),a={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{anchor:o=`left`,BackdropProps:s,children:c,className:l,elevation:u=16,hideBackdrop:d=!1,ModalProps:{BackdropProps:f,...p}={},onClose:m,open:h=!1,PaperProps:g={},SlideProps:_,TransitionComponent:v,transitionDuration:y=a,variant:b=`temporary`,slots:x={},slotProps:S={},...w}=n,T=C.useRef(!1);C.useEffect(()=>{T.current=!0},[]);let E=p6e({direction:i?`rtl`:`ltr`},o),D=o,O={...n,anchor:D,elevation:u,open:h,variant:b,...w},k=s6e(O),A={slots:{transition:v,...x},slotProps:{paper:g,transition:_,...S,backdrop:fh(S.backdrop||{...s,...f},{transitionDuration:y})}},[j,M]=Gm(`root`,{ref:t,elementType:c6e,className:G(k.root,k.modal,l),shouldForwardComponentProp:!0,ownerState:O,externalForwardedProps:{...A,...w,...p},additionalProps:{open:h,onClose:m,hideBackdrop:d,slots:{backdrop:A.slots.backdrop},slotProps:{backdrop:A.slotProps.backdrop}}}),[N,P]=Gm(`paper`,{elementType:u6e,shouldForwardComponentProp:!0,className:G(k.paper,g.className),ownerState:O,externalForwardedProps:A,additionalProps:{elevation:b===`temporary`?u:0,square:!0,...b===`temporary`&&{role:`dialog`,"aria-modal":`true`}}}),[F,I]=Gm(`docked`,{elementType:l6e,ref:t,className:G(k.root,k.docked,l),ownerState:O,externalForwardedProps:A,additionalProps:w}),[L,R]=Gm(`transition`,{elementType:i6e,ownerState:O,externalForwardedProps:A,additionalProps:{in:h,direction:d6e[E],timeout:y,appear:T.current}}),ee=(0,W.jsx)(N,{...P,children:c});if(b===`permanent`)return(0,W.jsx)(F,{...I,children:ee});let z=(0,W.jsx)(L,{...R,children:ee});return b===`persistent`?(0,W.jsx)(F,{...I,children:z}):(0,W.jsx)(j,{...M,children:z})}),h6e=sf({themeId:Tm}),g6e={error:Tx,warn:Qv,info:xb,debug:$T},_6e=({open:e,onClose:t})=>{let{t:n}=hs(),r=Em(),i=(0,C.useMemo)(()=>({error:r.palette.error.main,warn:r.palette.warning.main,info:r.palette.info.main,debug:r.palette.secondary.main}),[r]),[a,o]=(0,C.useState)([]),[s,c]=(0,C.useState)(!0),[l,u]=(0,C.useState)(`error,warn,info`.split(`,`)),[d,f]=(0,C.useState)(``),[p,m]=(0,C.useState)(!0),h=(0,C.useCallback)(async()=>{try{let e=new URLSearchParams({level:l.join(`,`),limit:`500`,...d&&{search:d}}),t=await fetch(`api/logs?${e}`);t.ok&&o((await t.json()).entries)}catch(e){console.error(`Failed to fetch logs:`,e)}finally{c(!1)}},[l,d]);(0,C.useEffect)(()=>{e&&h()},[e,h]),(0,C.useEffect)(()=>{if(!p||!e)return;let t=setInterval(h,5e3);return()=>clearInterval(t)},[p,e,h]);let g=e=>{u(Array.isArray(e.target.value)?e.target.value:[e.target.value])},_=e=>{f(e.target.value)},v=async()=>{try{await fetch(`api/logs`,{method:`DELETE`}),o([])}catch(e){console.error(`Failed to clear logs:`,e)}},y=e=>(0,W.jsx)(g6e[e]||xb,{sx:{fontSize:16,color:i[e]}});return(0,W.jsxs)(Vb,{open:e,onClose:t,maxWidth:`lg`,fullWidth:!0,children:[(0,W.jsxs)(Wb,{sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,W.jsx)($T,{}),n(`logs.title`),(0,W.jsx)(Z,{sx:{flexGrow:1}}),(0,W.jsx)(mb,{title:n(`logs.autoRefresh`),children:(0,W.jsx)(kv,{label:p?`Auto`:`Manual`,color:p?`success`:`default`,size:`small`,onClick:()=>m(!p),sx:{cursor:`pointer`}})}),(0,W.jsx)(Uh,{onClick:t,children:(0,W.jsx)(tE,{})})]}),(0,W.jsxs)(Ub,{children:[(0,W.jsx)(Gv,{spacing:2,sx:{mb:2},children:(0,W.jsxs)(Gv,{direction:`row`,spacing:2,alignItems:`center`,children:[(0,W.jsxs)(Mv,{size:`small`,sx:{minWidth:200},children:[(0,W.jsx)(Hx,{children:n(`logs.logLevel`)}),(0,W.jsxs)(wS,{value:l,label:n(`logs.logLevel`),onChange:g,multiple:!0,renderValue:e=>(0,W.jsx)(Z,{sx:{display:`flex`,flexWrap:`wrap`,gap:.5},children:(Array.isArray(e)?e:[e]).map(e=>(0,W.jsx)(kv,{label:e.toUpperCase(),size:`small`,sx:{backgroundColor:i[e],color:`white`}},e))}),children:[(0,W.jsx)(TS,{value:`error`,children:n(`logs.error`)}),(0,W.jsx)(TS,{value:`warn`,children:n(`logs.warning`)}),(0,W.jsx)(TS,{value:`info`,children:n(`logs.info`)}),(0,W.jsx)(TS,{value:`debug`,children:n(`logs.debug`)})]})]}),(0,W.jsx)(OS,{size:`small`,placeholder:n(`logs.searchPlaceholder`),value:d,onChange:_,sx:{flexGrow:1}}),(0,W.jsx)(_v,{variant:`outlined`,onClick:h,children:n(`common.refresh`)}),(0,W.jsx)(_v,{variant:`outlined`,color:`error`,onClick:v,children:n(`common.delete`)})]})}),(0,W.jsx)(Z,{sx:{height:400,overflow:`auto`,backgroundColor:`background.paper`,border:1,borderColor:`divider`,borderRadius:1,p:1},children:s?(0,W.jsx)(Z,{sx:{display:`flex`,justifyContent:`center`,p:4},children:(0,W.jsxs)(Q,{children:[n(`common.loading`),`...`]})}):a.length===0?(0,W.jsx)(Z,{sx:{display:`flex`,justifyContent:`center`,p:4},children:(0,W.jsx)(Q,{color:`text.secondary`,children:n(`logs.noResults`)})}):(0,W.jsx)(Gv,{spacing:1,children:a.map((e,t)=>(0,W.jsxs)(Z,{sx:{p:1,borderRadius:1,backgroundColor:`action.hover`,fontFamily:`monospace`,fontSize:`0.875rem`,wordBreak:`break-all`},children:[(0,W.jsxs)(Z,{sx:{display:`flex`,alignItems:`center`,gap:1,mb:.5},children:[y(e.level),(0,W.jsx)(Q,{variant:`caption`,color:`text.secondary`,children:new Date(e.timestamp).toLocaleString()}),(0,W.jsx)(kv,{label:e.level.toUpperCase(),size:`small`,sx:{backgroundColor:i[e.level],color:r.palette.getContrastText(i[e.level]??r.palette.grey[500]),fontSize:`0.7rem`,height:20}})]}),(0,W.jsx)(Q,{sx:{ml:3},children:e.message}),e.context&&(0,W.jsx)(Q,{sx:{ml:3,color:`text.secondary`,fontSize:`0.8rem`},children:JSON.stringify(e.context,null,2)})]},`${e.timestamp}-${e.level}-${t}`))})})]}),(0,W.jsx)(Hb,{children:(0,W.jsx)(_v,{onClick:t,children:n(`common.close`)})})]})};function v6e(){let{t:e}=hs(),{isConnected:t}=ev(),[n,r]=(0,C.useState)(null),[i,a]=(0,C.useState)(!1);(0,C.useEffect)(()=>{let e=async()=>{try{let e=await fetch(`api/health`);e.ok?(r(await e.json()),a(!1)):a(!0)}catch{a(!0)}};e();let t=setInterval(e,3e4);return()=>clearInterval(t)},[]);let o=e=>{let t=Math.floor(e/3600),n=Math.floor(e%3600/60);return t>0?`${t}h ${n}m`:`${n}m`},s=n?.status===`healthy`&&!i,c=n?.services?.bridges,l=c&&c.total>0&&c.running===c.total,u=c&&c.total===0,d=n?(0,W.jsxs)(Z,{sx:{p:.5},children:[(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`strong`,{children:[e(`health.version`),`:`]}),` `,n.version??e(`status.unknown`)]}),(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`strong`,{children:[e(`health.uptime`),`:`]}),` `,o(n.uptime??0)]}),n.services?.bridges&&(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`strong`,{children:[e(`nav.bridges`),`:`]}),` `,n.services.bridges.running??0,`/`,n.services.bridges.total??0,` `,e(`common.running`).toLowerCase(),(n.services.bridges.stopped??0)>0&&` (${n.services.bridges.stopped} ${e(`common.stopped`).toLowerCase()})`]}),n.services?.homeAssistant&&(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`strong`,{children:[e(`health.homeAssistant`),`:`]}),` `,n.services.homeAssistant.connected?e(`health.connected`):e(`health.disconnected`)]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`strong`,{children:`WebSocket:`}),` `,e(t?`health.connected`:`health.disconnected`)]})]}):e(`status.loadingHealth`);return(0,W.jsx)(mb,{title:d,arrow:!0,children:(0,W.jsx)(kv,{icon:i||!s?(0,W.jsx)(Tx,{fontSize:`small`}):l?(0,W.jsx)(fv,{fontSize:`small`}):(0,W.jsx)(wb,{fontSize:`small`}),label:e(i?`status.error`:s?t?u?`status.noBridges`:l?`common.online`:`common.starting`:`common.offline`:`status.unhealthy`),color:i||!s?`error`:!l||!t?`warning`:`success`,size:`small`,variant:`filled`,sx:{borderRadius:1,fontWeight:600,"& .MuiChip-icon":{color:`inherit`}}})})}var y6e=e=>(0,W.jsx)(`svg`,{viewBox:`0 0 91 89`,xmlSpace:`preserve`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,W.jsxs)(`g`,{style:{display:`inline`},children:[(0,W.jsx)(`path`,{style:{fill:`#18bcf2`,fillOpacity:1,strokeWidth:.266194},d:`m 49.149143,1.473171 38.513568,38.536435 c 0,0 1.248354,1.186052 2.207681,3.092371 0.959329,1.906323 1.10864,4.600698 1.10864,4.600698 v 36.786372 c 0,0 -0.01549,1.748506 -1.49842,3.050572 -1.482931,1.302064 -3.333077,1.362947 -3.333077,1.362947 l -81.325658,7.7e-5 c 0,0 -1.7523855,-0.0091 -3.17112,-1.352526 C -0.07808495,85.913164 0.05953025,84.487808 0.05953025,84.487808 V 47.704546 c 0,0 -0.0018381,-2.218618 0.95921785,-4.315832 0.9610554,-2.097209 2.3010618,-3.355005 2.3010618,-3.355005 L 41.545959,1.4719546 c 0,0 1.465224,-1.46837077 3.753488,-1.46837077 2.288268,0 3.849696,1.46958717 3.849696,1.46958717 z`}),(0,W.jsx)(`path`,{style:{fill:`#ffffff`,fillOpacity:1,strokeWidth:.175841},d:`m 31.689717,32.051124 c 2.813363,2.331095 6.157331,3.89845 9.721813,4.556421 V 17.180647 l 3.873694,-2.282955 3.870527,2.282955 V 36.60772 c 3.565364,-0.658847 6.910387,-2.226204 9.725159,-4.556417 l 7.032345,4.154609 c -11.437354,11.557779 -29.852321,11.557779 -41.290025,0 z m 8.546732,49.60988 C 44.314996,65.760441 35.09933,49.470196 19.574984,45.139543 v 8.312381 c 3.383916,1.32244 6.386113,3.496288 8.728705,6.320026 L 11.83076,69.485301 v 4.56907 l 3.873697,2.270836 16.469936,-9.713534 c 1.224356,3.48294 1.56683,7.225375 0.996449,10.879778 z M 70.977694,45.139543 c -15.515726,4.34014 -24.72189,20.626696 -20.643519,36.521461 l 7.047658,-4.15742 c -0.569325,-3.654411 -0.2265,-7.3965 0.996449,-10.87979 l 16.457611,9.701233 3.870711,-2.283125 v -4.55677 L 62.233673,59.77195 c 2.342772,-2.822684 5.34497,-4.996533 8.728708,-6.320026 z`})]})}),b6e=e=>{let t=J3e();return(0,W.jsxs)(Z,{component:ta,to:Y9.dashboard,sx:{display:`flex`,alignItems:`center`,justifyContent:e.large?`flex-start`:`center`,flexGrow:1,textDecoration:`none`,color:`inherit`},children:[(0,W.jsx)(y6e,{style:{height:`40px`}}),(0,W.jsx)(Q,{variant:`inherit`,component:`span`,sx:{mr:1,ml:1},children:t.name.split(`-`).map(Y).join(`-`)}),e.large&&(0,W.jsx)(Q,{variant:`caption`,component:`span`,children:t.version})]})},x6e=()=>{let e=h6e(`(min-width:600px)`),{mode:t,setMode:n}=Im(),[r,i]=(0,C.useState)(!1),[a,o]=(0,C.useState)(!1),s=Cr(),c=br(),l=e=>e?e===`/`?c.pathname===`/`:c.pathname.startsWith(e):!1,u=()=>{n(t===`dark`?`light`:`dark`)},{t:d}=hs(),f=[{label:d(`dashboard.title`),icon:(0,W.jsx)(oE,{}),to:Y9.dashboard},{label:d(`nav.bridges`),icon:(0,W.jsx)(sE,{}),to:Y9.bridges},{label:d(`nav.devices`),icon:(0,W.jsx)(_b,{}),to:Y9.devices},{label:d(`nav.standaloneDevices`,`Standalone Devices`),icon:(0,W.jsx)(Khe,{}),to:Y9.standaloneDevices},{label:d(`nav.networkMap`),icon:(0,W.jsx)(JT,{}),to:Y9.networkMap},{label:d(`nav.startupOrder`),icon:(0,W.jsx)(pv,{}),to:Y9.startup},{label:d(`nav.lockCredentials`),icon:(0,W.jsx)(kT,{}),to:Y9.lockCredentials},{label:d(`nav.filterReference`),icon:(0,W.jsx)(cE,{}),to:Y9.labels},{label:`Plugins`,icon:(0,W.jsx)(iE,{}),to:Y9.plugins},{label:d(`nav.settings`),icon:(0,W.jsx)(RT,{}),to:Y9.settings},{label:d(t===`dark`?`nav.lightMode`:`nav.darkMode`),icon:t===`dark`?(0,W.jsx)(zhe,{}):(0,W.jsx)(Ehe,{}),onClick:u},{label:d(`nav.systemLogs`),icon:(0,W.jsx)($T,{}),onClick:()=>i(!0)},{label:d(`nav.health`),icon:(0,W.jsx)(jx,{}),to:Y9.health}],p=e=>{o(!1),e.onClick?e.onClick():e.to&&s(e.to)};return(0,W.jsxs)(Z,{children:[(0,W.jsx)(e6e,{sx:{height:`72px`},children:(0,W.jsx)(F3e,{sx:{paddingLeft:`0 !important`,paddingRight:`0 !important`},children:(0,W.jsxs)(Z9,{sx:{padding:2,height:`100%`,display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,W.jsx)(b6e,{large:e}),e?(0,W.jsxs)(Z,{sx:{display:`flex`,alignItems:`center`,gap:1},children:[f.map(e=>e.to?(0,W.jsx)(mb,{title:e.label,children:(0,W.jsx)(Uh,{component:ta,to:e.to,sx:{color:`inherit`,bgcolor:l(e.to)?`rgba(255,255,255,0.15)`:`transparent`,borderRadius:1},children:e.icon})},e.label):(0,W.jsx)(mb,{title:e.label,children:(0,W.jsx)(Uh,{onClick:e.onClick,sx:{color:`inherit`},children:e.icon})},e.label)),(0,W.jsx)(v6e,{})]}):(0,W.jsxs)(Z,{sx:{display:`flex`,alignItems:`center`,gap:.5},children:[(0,W.jsx)(v6e,{}),(0,W.jsx)(Uh,{onClick:()=>o(!0),sx:{color:`inherit`},children:(0,W.jsx)(Bhe,{})})]})]})})}),(0,W.jsx)(m6e,{anchor:`right`,open:a,onClose:()=>o(!1),children:(0,W.jsx)(ny,{sx:{width:250},children:f.map(e=>(0,W.jsxs)(Rae,{selected:l(e.to),onClick:()=>p(e),children:[(0,W.jsx)(sy,{children:e.icon}),(0,W.jsx)(ly,{primary:e.label})]},e.label))})}),(0,W.jsx)(_6e,{open:r,onClose:()=>i(!1)})]})},S6e=()=>{let{versionMismatch:e,frontendVersion:t,backendVersion:n}=J3e(),{isConnected:r}=ev();return(0,W.jsxs)(Z,{children:[(0,W.jsx)(x6e,{}),(0,W.jsx)(F3e,{}),e&&(0,W.jsxs)(Kh,{severity:`warning`,variant:`filled`,sx:{borderRadius:0},action:(0,W.jsx)(_v,{color:`inherit`,size:`small`,onClick:()=>window.location.reload(),children:`Reload`}),children:[`Version mismatch: frontend `,t,`, backend `,n,`. Please reload to get the latest UI.`]}),!r&&(0,W.jsx)(Kh,{severity:`error`,variant:`filled`,sx:{borderRadius:0},children:`Connection lost, data may be outdated. Reconnecting…`}),(0,W.jsx)(Z9,{sx:{p:2},children:(0,W.jsx)(I3e,{children:(0,W.jsx)(si,{})})}),(0,W.jsx)(Y3e,{}),(0,W.jsx)(K3e,{})]})},C6e=Cm({colorSchemes:{light:{palette:{primary:{main:`#1976d2`,light:`#42a5f5`,dark:`#1565c0`},secondary:{main:`#9c27b0`,light:`#ba68c8`,dark:`#7b1fa2`},background:{default:`#f5f5f5`,paper:`#ffffff`}}},dark:{palette:{primary:{main:`#90caf9`,light:`#e3f2fd`,dark:`#42a5f5`},secondary:{main:`#ce93d8`,light:`#f3e5f5`,dark:`#ab47bc`},background:{default:`#121212`,paper:`#1e1e1e`}}}},typography:{fontFamily:`"Roboto", "Helvetica", "Arial", sans-serif`,h1:{fontSize:`2.5rem`,fontWeight:500},h2:{fontSize:`2rem`,fontWeight:500},h3:{fontSize:`1.75rem`,fontWeight:500},h4:{fontSize:`1.5rem`,fontWeight:500},h5:{fontSize:`1.25rem`,fontWeight:500},h6:{fontSize:`1rem`,fontWeight:500}},shape:{borderRadius:8},components:{MuiCard:{styleOverrides:{root:{transition:`transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out`,"&:hover":{transform:`translateY(-2px)`,boxShadow:`0 4px 20px rgba(0,0,0,0.12)`}}}},MuiButton:{styleOverrides:{root:{textTransform:`none`,fontWeight:500}}},MuiChip:{styleOverrides:{root:{fontWeight:500}}},MuiAppBar:{styleOverrides:{root:{backgroundImage:`none`}}}}}),$9=document.getElementsByTagName(`base`)[0]?.href?.replace(/\/$/,``);$9?.startsWith(`http`)&&($9=new URL($9).pathname);var w6e=Xi([{path:`/`,element:(0,W.jsx)(S6e,{}),children:O3e}],{basename:$9});(0,S.createRoot)(document.getElementById(`root`)).render((0,W.jsx)(C.StrictMode,{children:(0,W.jsx)(L,{store:j3e,children:(0,W.jsxs)(Gee,{theme:C6e,children:[(0,W.jsx)(zee,{}),(0,W.jsx)(Dm,{styles:{".rjsf-field-array > .MuiFormControl-root > .MuiPaper-root > .MuiBox-root > .MuiGrid-root > .MuiGrid-root:has(> .MuiBox-root > .MuiPaper-root > .MuiBox-root > .rjsf-field)":{overflow:`initial !important`,flexGrow:1}}}),(0,W.jsx)(xre,{children:(0,W.jsx)(sne,{children:(0,W.jsx)(xa,{router:w6e})})})]})})}));
|
package/dist/frontend/index.html
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<!-- BASE -->
|
|
9
9
|
<base href="/" />
|
|
10
10
|
<!-- /BASE -->
|
|
11
|
-
<script type="module" crossorigin src="./assets/index-
|
|
11
|
+
<script type="module" crossorigin src="./assets/index-CVvWfWnr.js"></script>
|
|
12
12
|
<link rel="stylesheet" crossorigin href="./assets/index-G-pxPqsB.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riddix/hamh",
|
|
3
3
|
"description": "",
|
|
4
|
-
"version": "2.1.0-alpha.
|
|
4
|
+
"version": "2.1.0-alpha.745",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"@matter/main": "0.17.2",
|
|
39
39
|
"@matter/nodejs": "0.17.2",
|
|
40
40
|
"@matter/general": "0.17.2",
|
|
41
|
+
"@matter/types": "0.17.2",
|
|
41
42
|
"ajv": "8.18.0",
|
|
42
43
|
"archiver": "7.0.1",
|
|
43
44
|
"color": "5.0.3",
|
|
@@ -50,14 +51,15 @@
|
|
|
50
51
|
"multer": "2.1.1",
|
|
51
52
|
"nocache": "4.0.0",
|
|
52
53
|
"unzipper": "0.12.3",
|
|
54
|
+
"werift": "0.22.4",
|
|
53
55
|
"ws": "8.21.0",
|
|
54
56
|
"yargs": "18.0.0"
|
|
55
57
|
},
|
|
56
58
|
"devDependencies": {
|
|
57
59
|
"@types/lodash-es": "^4.17.12",
|
|
58
|
-
"@home-assistant-matter-hub/backend": "2.1.0-alpha.
|
|
59
|
-
"@home-assistant-matter-hub/
|
|
60
|
-
"@home-assistant-matter-hub/
|
|
60
|
+
"@home-assistant-matter-hub/backend": "2.1.0-alpha.745",
|
|
61
|
+
"@home-assistant-matter-hub/frontend": "2.1.0-alpha.745",
|
|
62
|
+
"@home-assistant-matter-hub/common": "2.1.0-alpha.745"
|
|
61
63
|
},
|
|
62
64
|
"overrides": {
|
|
63
65
|
"minimatch": "9.0.7",
|