@riddix/hamh 2.1.0-alpha.818 → 2.1.0-alpha.820

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.
@@ -109726,9 +109726,9 @@ function inspectEndpoint(endpoint, properties, behindAggregator = false) {
109726
109726
  properties.supportsEthernet = true;
109727
109727
  }
109728
109728
  }
109729
- const networkInterfaces4 = endpoint.maybeStateOf(GeneralDiagnosticsClient)?.networkInterfaces;
109730
- if (networkInterfaces4 !== void 0) {
109731
- for (const { type, isOperational } of networkInterfaces4) {
109729
+ const networkInterfaces6 = endpoint.maybeStateOf(GeneralDiagnosticsClient)?.networkInterfaces;
109730
+ if (networkInterfaces6 !== void 0) {
109731
+ for (const { type, isOperational } of networkInterfaces6) {
109732
109732
  if (type === GeneralDiagnostics3.InterfaceType.WiFi) {
109733
109733
  properties.wifiActive = (properties.wifiActive ?? false) || isOperational;
109734
109734
  } else if (type === GeneralDiagnostics3.InterfaceType.Ethernet) {
@@ -136312,8 +136312,8 @@ function systemApi(version2) {
136312
136312
  }
136313
136313
  function getNetworkInterfaces2() {
136314
136314
  const interfaces = [];
136315
- const networkInterfaces4 = os4.networkInterfaces();
136316
- for (const [name, ifaceList] of Object.entries(networkInterfaces4)) {
136315
+ const networkInterfaces6 = os4.networkInterfaces();
136316
+ for (const [name, ifaceList] of Object.entries(networkInterfaces6)) {
136317
136317
  if (!ifaceList) continue;
136318
136318
  for (const iface of ifaceList) {
136319
136319
  const family = String(iface.family);
@@ -153370,6 +153370,104 @@ function dropUndefined(obj) {
153370
153370
  return result;
153371
153371
  }
153372
153372
 
153373
+ // src/plugins/builtin/camera/camera-tcp-requirement.ts
153374
+ import { readFileSync as readFileSync6 } from "node:fs";
153375
+
153376
+ // src/plugins/plugin-storage.ts
153377
+ init_esm();
153378
+ import * as fs9 from "node:fs";
153379
+ import * as path11 from "node:path";
153380
+ var logger194 = Logger.get("PluginStorage");
153381
+ var SAVE_DEBOUNCE_MS = 500;
153382
+ function pluginStorageFilePath(storageDir, bridgeId, pluginName) {
153383
+ const safe = (s) => s.replace(/[^a-zA-Z0-9_-]/g, "_");
153384
+ return path11.join(
153385
+ storageDir,
153386
+ `plugin-${safe(bridgeId)}-${safe(pluginName)}.json`
153387
+ );
153388
+ }
153389
+ var FilePluginStorage = class {
153390
+ data = {};
153391
+ dirty = false;
153392
+ filePath;
153393
+ saveTimer;
153394
+ constructor(storageDir, bridgeId, pluginName) {
153395
+ this.filePath = pluginStorageFilePath(storageDir, bridgeId, pluginName);
153396
+ this.load();
153397
+ }
153398
+ async get(key, defaultValue) {
153399
+ const value = this.data[key];
153400
+ return value ?? defaultValue;
153401
+ }
153402
+ async set(key, value) {
153403
+ this.data[key] = value;
153404
+ this.dirty = true;
153405
+ this.scheduleSave();
153406
+ }
153407
+ async delete(key) {
153408
+ delete this.data[key];
153409
+ this.dirty = true;
153410
+ this.scheduleSave();
153411
+ }
153412
+ async keys() {
153413
+ return Object.keys(this.data);
153414
+ }
153415
+ load() {
153416
+ try {
153417
+ if (fs9.existsSync(this.filePath)) {
153418
+ const raw = fs9.readFileSync(this.filePath, "utf-8");
153419
+ this.data = JSON.parse(raw);
153420
+ }
153421
+ } catch (e) {
153422
+ logger194.warn(`Failed to load plugin storage from ${this.filePath}:`, e);
153423
+ this.data = {};
153424
+ }
153425
+ }
153426
+ scheduleSave() {
153427
+ if (this.saveTimer) clearTimeout(this.saveTimer);
153428
+ this.saveTimer = setTimeout(() => this.save(), SAVE_DEBOUNCE_MS);
153429
+ }
153430
+ save() {
153431
+ if (!this.dirty) return;
153432
+ if (this.saveTimer) {
153433
+ clearTimeout(this.saveTimer);
153434
+ this.saveTimer = void 0;
153435
+ }
153436
+ try {
153437
+ const dir = path11.dirname(this.filePath);
153438
+ if (!fs9.existsSync(dir)) {
153439
+ fs9.mkdirSync(dir, { recursive: true });
153440
+ }
153441
+ fs9.writeFileSync(this.filePath, JSON.stringify(this.data, null, 2));
153442
+ this.dirty = false;
153443
+ } catch (e) {
153444
+ logger194.warn(`Failed to save plugin storage to ${this.filePath}:`, e);
153445
+ }
153446
+ }
153447
+ flush() {
153448
+ this.save();
153449
+ }
153450
+ };
153451
+
153452
+ // src/plugins/builtin/camera/camera-tcp-requirement.ts
153453
+ var CAMERA_TCP_CONFIG = { incoming: true, outgoing: false };
153454
+ function parseCameraList(cameras) {
153455
+ if (typeof cameras !== "string") return [];
153456
+ return cameras.split(",").map((s) => s.trim()).filter(Boolean);
153457
+ }
153458
+ function bridgeNeedsTcpForCameras(storageDir, bridgeId) {
153459
+ try {
153460
+ const raw = readFileSync6(
153461
+ pluginStorageFilePath(storageDir, bridgeId, "camera"),
153462
+ "utf-8"
153463
+ );
153464
+ const json = JSON.parse(raw);
153465
+ return parseCameraList(json.config?.cameras).length > 0;
153466
+ } catch {
153467
+ return false;
153468
+ }
153469
+ }
153470
+
153373
153471
  // src/plugins/plugin-manager.ts
153374
153472
  init_esm();
153375
153473
  import * as fs10 from "node:fs";
@@ -153671,7 +153769,7 @@ init_esm4();
153671
153769
  init_esm3();
153672
153770
  init_access_control();
153673
153771
  init_groupcast();
153674
- var logger194 = Logger.get("GroupcastServer");
153772
+ var logger195 = Logger.get("GroupcastServer");
153675
153773
  var UNMAPPED_KEYSET_ID = 65535;
153676
153774
  var GROUPCAST_IS_PROVISIONAL = true;
153677
153775
  var GroupcastServer = class extends GroupcastBehavior {
@@ -154088,7 +154186,7 @@ var GroupcastServer = class extends GroupcastBehavior {
154088
154186
  if (hasMembership) continue;
154089
154187
  const fabricGroups = gkmState.groupTable.filter((g) => g.fabricIndex === fi);
154090
154188
  if (fabricGroups.length === 0) continue;
154091
- logger194.info(`Migrating ${fabricGroups.length} legacy group(s) for fabric ${fi} to Groupcast`);
154189
+ logger195.info(`Migrating ${fabricGroups.length} legacy group(s) for fabric ${fi} to Groupcast`);
154092
154190
  const newEntries = fabricGroups.map((group) => {
154093
154191
  const keyMapping = gkmState.groupKeyMap.find((m) => m.fabricIndex === fi && m.groupId === group.groupId);
154094
154192
  const mcastAddrPolicy = this.features.perGroup ? Groupcast3.MulticastAddrPolicy.PerGroup : Groupcast3.MulticastAddrPolicy.IanaAddr;
@@ -154110,7 +154208,7 @@ var GroupcastServer = class extends GroupcastBehavior {
154110
154208
  }
154111
154209
  if (migrated) {
154112
154210
  this.#updateUsedMcastAddrCount();
154113
- logger194.info("Groupcast migration complete");
154211
+ logger195.info("Groupcast migration complete");
154114
154212
  }
154115
154213
  }
154116
154214
  async [Symbol.asyncDispose]() {
@@ -154586,7 +154684,7 @@ var IdentifyServer2 = class extends IdentifyServer {
154586
154684
  // src/matter/endpoints/validate-endpoint-type.ts
154587
154685
  init_esm();
154588
154686
  init_esm7();
154589
- var logger195 = Logger.get("EndpointValidation");
154687
+ var logger196 = Logger.get("EndpointValidation");
154590
154688
  function toCamelCase(name) {
154591
154689
  return name.charAt(0).toLowerCase() + name.slice(1);
154592
154690
  }
@@ -154616,12 +154714,12 @@ function validateEndpointType(endpointType, entityId) {
154616
154714
  }
154617
154715
  const prefix = entityId ? `[${entityId}] ` : "";
154618
154716
  if (missingMandatory.length > 0) {
154619
- logger195.warn(
154717
+ logger196.warn(
154620
154718
  `${prefix}${deviceTypeModel.name} (0x${endpointType.deviceType.toString(16)}): missing mandatory clusters: ${missingMandatory.join(", ")}`
154621
154719
  );
154622
154720
  }
154623
154721
  if (availableOptional.length > 0) {
154624
- logger195.debug(
154722
+ logger196.debug(
154625
154723
  `${prefix}${deviceTypeModel.name} (0x${endpointType.deviceType.toString(16)}): optional clusters not used: ${availableOptional.join(", ")}`
154626
154724
  );
154627
154725
  }
@@ -154745,7 +154843,7 @@ var BridgeDataProvider = class extends Service {
154745
154843
 
154746
154844
  // src/utils/apply-patch-state.ts
154747
154845
  init_esm();
154748
- var logger196 = Logger.get("ApplyPatchState");
154846
+ var logger197 = Logger.get("ApplyPatchState");
154749
154847
  function applyPatchState(state, patch, options) {
154750
154848
  return applyPatch(state, patch, options?.force);
154751
154849
  }
@@ -154772,23 +154870,23 @@ function applyPatch(state, patch, force = false) {
154772
154870
  if (errorMessage.includes(
154773
154871
  "Endpoint storage inaccessible because endpoint is not a node and is not owned by another endpoint"
154774
154872
  )) {
154775
- logger196.debug(
154873
+ logger197.debug(
154776
154874
  `Suppressed endpoint storage error, patch not applied: ${JSON.stringify(actualPatch)}`
154777
154875
  );
154778
154876
  return actualPatch;
154779
154877
  }
154780
154878
  if (errorMessage.includes("synchronous-transaction-conflict")) {
154781
- logger196.warn(
154879
+ logger197.warn(
154782
154880
  `Transaction conflict, state update DROPPED: ${JSON.stringify(actualPatch)}`
154783
154881
  );
154784
154882
  return actualPatch;
154785
154883
  }
154786
154884
  failedKeys.push(key);
154787
- logger196.warn(`Failed to set property '${key}': ${errorMessage}`);
154885
+ logger197.warn(`Failed to set property '${key}': ${errorMessage}`);
154788
154886
  }
154789
154887
  }
154790
154888
  if (failedKeys.length > 0) {
154791
- logger196.warn(
154889
+ logger197.warn(
154792
154890
  `${failedKeys.length} properties failed to update: [${failedKeys.join(", ")}]`
154793
154891
  );
154794
154892
  }
@@ -154858,7 +154956,7 @@ function truncate(maxLength, value) {
154858
154956
  }
154859
154957
 
154860
154958
  // src/plugins/plugin-device-factory.ts
154861
- var logger197 = Logger.get("PluginDeviceFactory");
154959
+ var logger198 = Logger.get("PluginDeviceFactory");
154862
154960
  var deviceTypeMap = {
154863
154961
  on_off_light: () => OnOffLightDevice.with(
154864
154962
  IdentifyServer2,
@@ -154964,7 +155062,7 @@ var deviceTypeMap = {
154964
155062
  function createPluginEndpointType(deviceType) {
154965
155063
  const factory = deviceTypeMap[deviceType];
154966
155064
  if (!factory) {
154967
- logger197.warn(`Unsupported plugin device type: "${deviceType}"`);
155065
+ logger198.warn(`Unsupported plugin device type: "${deviceType}"`);
154968
155066
  return void 0;
154969
155067
  }
154970
155068
  const endpoint = factory();
@@ -154975,79 +155073,6 @@ function getSupportedPluginDeviceTypes() {
154975
155073
  return Object.keys(deviceTypeMap);
154976
155074
  }
154977
155075
 
154978
- // src/plugins/plugin-storage.ts
154979
- init_esm();
154980
- import * as fs9 from "node:fs";
154981
- import * as path11 from "node:path";
154982
- var logger198 = Logger.get("PluginStorage");
154983
- var SAVE_DEBOUNCE_MS = 500;
154984
- var FilePluginStorage = class {
154985
- data = {};
154986
- dirty = false;
154987
- filePath;
154988
- saveTimer;
154989
- constructor(storageDir, bridgeId, pluginName) {
154990
- const safe = (s) => s.replace(/[^a-zA-Z0-9_-]/g, "_");
154991
- this.filePath = path11.join(
154992
- storageDir,
154993
- `plugin-${safe(bridgeId)}-${safe(pluginName)}.json`
154994
- );
154995
- this.load();
154996
- }
154997
- async get(key, defaultValue) {
154998
- const value = this.data[key];
154999
- return value ?? defaultValue;
155000
- }
155001
- async set(key, value) {
155002
- this.data[key] = value;
155003
- this.dirty = true;
155004
- this.scheduleSave();
155005
- }
155006
- async delete(key) {
155007
- delete this.data[key];
155008
- this.dirty = true;
155009
- this.scheduleSave();
155010
- }
155011
- async keys() {
155012
- return Object.keys(this.data);
155013
- }
155014
- load() {
155015
- try {
155016
- if (fs9.existsSync(this.filePath)) {
155017
- const raw = fs9.readFileSync(this.filePath, "utf-8");
155018
- this.data = JSON.parse(raw);
155019
- }
155020
- } catch (e) {
155021
- logger198.warn(`Failed to load plugin storage from ${this.filePath}:`, e);
155022
- this.data = {};
155023
- }
155024
- }
155025
- scheduleSave() {
155026
- if (this.saveTimer) clearTimeout(this.saveTimer);
155027
- this.saveTimer = setTimeout(() => this.save(), SAVE_DEBOUNCE_MS);
155028
- }
155029
- save() {
155030
- if (!this.dirty) return;
155031
- if (this.saveTimer) {
155032
- clearTimeout(this.saveTimer);
155033
- this.saveTimer = void 0;
155034
- }
155035
- try {
155036
- const dir = path11.dirname(this.filePath);
155037
- if (!fs9.existsSync(dir)) {
155038
- fs9.mkdirSync(dir, { recursive: true });
155039
- }
155040
- fs9.writeFileSync(this.filePath, JSON.stringify(this.data, null, 2));
155041
- this.dirty = false;
155042
- } catch (e) {
155043
- logger198.warn(`Failed to save plugin storage to ${this.filePath}:`, e);
155044
- }
155045
- }
155046
- flush() {
155047
- this.save();
155048
- }
155049
- };
155050
-
155051
155076
  // src/plugins/safe-plugin-runner.ts
155052
155077
  init_esm();
155053
155078
  var logger199 = Logger.get("SafePluginRunner");
@@ -155505,6 +155530,8 @@ var PluginManager = class {
155505
155530
 
155506
155531
  // src/services/bridges/bridge.ts
155507
155532
  init_dist();
155533
+ init_esm7();
155534
+ import * as os9 from "node:os";
155508
155535
 
155509
155536
  // src/utils/json/create-bridge-server-config.ts
155510
155537
  import crypto5 from "node:crypto";
@@ -155761,13 +155788,14 @@ var SecondaryNetworkInterfaceEndpointDefinition = MutableEndpoint({
155761
155788
  Object.freeze(SecondaryNetworkInterfaceEndpointDefinition);
155762
155789
 
155763
155790
  // src/utils/json/create-bridge-server-config.ts
155764
- function createBridgeServerConfig(data) {
155791
+ function createBridgeServerConfig(data, options) {
155765
155792
  return {
155766
155793
  type: ServerNode.RootEndpoint,
155767
155794
  id: data.id,
155768
155795
  network: {
155769
155796
  port: data.port,
155770
- subscriptionOptions: matterSubscriptionOptions()
155797
+ subscriptionOptions: matterSubscriptionOptions(),
155798
+ ...options?.tcp ? { tcp: options.tcp } : {}
155771
155799
  },
155772
155800
  productDescription: {
155773
155801
  name: data.name,
@@ -155798,8 +155826,8 @@ function createBridgeServerConfig(data) {
155798
155826
 
155799
155827
  // src/matter/endpoints/bridge-server-node.ts
155800
155828
  var BridgeServerNode = class extends ServerNode {
155801
- constructor(env, bridgeData, aggregator) {
155802
- const config11 = createBridgeServerConfig(bridgeData);
155829
+ constructor(env, bridgeData, aggregator, options) {
155830
+ const config11 = createBridgeServerConfig(bridgeData, options);
155803
155831
  super({
155804
155832
  ...config11,
155805
155833
  environment: env,
@@ -155812,6 +155840,49 @@ var BridgeServerNode = class extends ServerNode {
155812
155840
  }
155813
155841
  };
155814
155842
 
155843
+ // src/matter/mdns-address-watch.ts
155844
+ function collectAdvertisedAddresses(interfaces, netInterface, stripGlobalIpv6, ipv4Enabled = true) {
155845
+ const names = netInterface ? [netInterface] : Object.keys(interfaces);
155846
+ const out = /* @__PURE__ */ new Set();
155847
+ for (const name of names) {
155848
+ const addrs = interfaces[name];
155849
+ if (!addrs) continue;
155850
+ const usable = addrs.filter((a) => !a.internal);
155851
+ const ipv4 = ipv4Enabled ? usable.filter((a) => a.family === "IPv4").map((a) => a.address) : [];
155852
+ let ipv6 = usable.filter((a) => a.family === "IPv6").map((a) => a.address);
155853
+ if (stripGlobalIpv6) {
155854
+ ipv6 = filterAdvertisedIpv6(ipv6);
155855
+ }
155856
+ for (const a of ipv4) out.add(a);
155857
+ for (const a of ipv6) out.add(a);
155858
+ }
155859
+ return [...out].sort();
155860
+ }
155861
+ function advertisedAddressesChanged(prev, curr) {
155862
+ if (prev.length !== curr.length) return true;
155863
+ const seen = new Set(prev);
155864
+ for (const a of curr) {
155865
+ if (!seen.has(a)) return true;
155866
+ }
155867
+ return false;
155868
+ }
155869
+ async function runMdnsAddressWatchTick(deps) {
155870
+ const next = collectAdvertisedAddresses(
155871
+ deps.readInterfaces(),
155872
+ deps.netInterface,
155873
+ deps.stripGlobalIpv6,
155874
+ deps.ipv4Enabled
155875
+ );
155876
+ if (!advertisedAddressesChanged(deps.currentSnapshot, next)) {
155877
+ return deps.currentSnapshot;
155878
+ }
155879
+ deps.onChange?.(deps.currentSnapshot, next);
155880
+ for (const fabric of deps.fabrics()) {
155881
+ await deps.refresh(fabric);
155882
+ }
155883
+ return next;
155884
+ }
155885
+
155815
155886
  // src/utils/ensure-commissioning-config.ts
155816
155887
  var ServerNodeConfigProvider = class extends CommissioningConfigProvider {
155817
155888
  #node;
@@ -155894,15 +155965,18 @@ function deadSessionTimeoutMs(flags2) {
155894
155965
  return flags2?.fastSessionRecovery ? FAST_DEAD_SESSION_TIMEOUT_MS : DEAD_SESSION_TIMEOUT_MS;
155895
155966
  }
155896
155967
  var SHUTDOWN_SESSION_CLOSE_TIMEOUT_MS = 2500;
155968
+ var MDNS_ADDRESS_CHECK_INTERVAL_MS = 6e4;
155897
155969
  var Bridge = class {
155898
- constructor(env, logger245, dataProvider, endpointManager) {
155970
+ constructor(env, logger245, dataProvider, endpointManager, serverOptions) {
155899
155971
  this.dataProvider = dataProvider;
155900
155972
  this.endpointManager = endpointManager;
155973
+ this.serverOptions = serverOptions;
155901
155974
  this.log = logger245.get(`Bridge / ${dataProvider.id}`);
155902
155975
  this.server = new BridgeServerNode(
155903
155976
  env,
155904
155977
  this.dataProvider,
155905
- this.endpointManager.root
155978
+ this.endpointManager.root,
155979
+ this.serverOptions
155906
155980
  );
155907
155981
  const { basicInformation } = this.dataProvider;
155908
155982
  this.log.debugCtx("Root bridge BasicInformation configured", {
@@ -155917,6 +155991,7 @@ var Bridge = class {
155917
155991
  }
155918
155992
  dataProvider;
155919
155993
  endpointManager;
155994
+ serverOptions;
155920
155995
  log;
155921
155996
  server;
155922
155997
  status = {
@@ -155935,6 +156010,14 @@ var Bridge = class {
155935
156010
  sessionStartedAt = /* @__PURE__ */ new Map();
155936
156011
  rotationTimer = null;
155937
156012
  maxSessionAgeMs = 0;
156013
+ // Watches the advertised interface addresses so a dynamic ISP IPv6 prefix
156014
+ // change forces a fresh operational announcement (#415).
156015
+ mdnsAddressTimer = null;
156016
+ advertisedAddressSnapshot = [];
156017
+ // Skip a tick while the previous one is still awaiting refresh, so a slow
156018
+ // refreshOperationalAdvertisement can't overlap and re-announce off a stale
156019
+ // snapshot.
156020
+ mdnsCheckInFlight = false;
155938
156021
  // Serialize concurrent lifecycle calls so auto-recovery and a manual
155939
156022
  // restartBridge can't race past each other's Starting/Stopping states.
155940
156023
  startInFlight;
@@ -156059,7 +156142,44 @@ var Bridge = class {
156059
156142
  return this.endpointManager.getPluginConfigSchema(pluginName);
156060
156143
  }
156061
156144
  async updatePluginConfig(pluginName, config11) {
156062
- return this.endpointManager.updatePluginConfig(pluginName, config11);
156145
+ const result = await this.endpointManager.updatePluginConfig(
156146
+ pluginName,
156147
+ config11
156148
+ );
156149
+ if (result && pluginName === "camera") {
156150
+ await this.applyCameraTcp(config11);
156151
+ }
156152
+ return result;
156153
+ }
156154
+ // #419: cameras need Matter over TCP because the WebRTC offer exceeds the UDP
156155
+ // message size. Match the bridge listener to the saved camera list. Changing
156156
+ // network config takes effect on (re)start, so bounce the bridge if running.
156157
+ async applyCameraTcp(config11) {
156158
+ const want = parseCameraList(config11.cameras).length > 0;
156159
+ const have = !!this.server.state.network.tcp;
156160
+ if (want === have) {
156161
+ return;
156162
+ }
156163
+ this.log.info(
156164
+ want ? "cameras configured, enabling matter over tcp (#419)" : "no cameras left, disabling matter over tcp (#419)"
156165
+ );
156166
+ const running = this.status.code === BridgeStatus.Running;
156167
+ if (running) {
156168
+ await this.stop();
156169
+ }
156170
+ try {
156171
+ await this.server.set({
156172
+ network: { tcp: want ? CAMERA_TCP_CONFIG : void 0 }
156173
+ });
156174
+ } catch (e) {
156175
+ this.log.warn(
156176
+ "Could not apply tcp live, restart matterhub to apply it:",
156177
+ e
156178
+ );
156179
+ }
156180
+ if (running) {
156181
+ await this.start();
156182
+ }
156063
156183
  }
156064
156184
  async initialize() {
156065
156185
  await this.server.construction.ready.then();
@@ -156123,6 +156243,7 @@ var Bridge = class {
156123
156243
  this.wireSessionDiagnostics();
156124
156244
  this.wireFabricWarnings();
156125
156245
  this.startSessionRotation();
156246
+ this.startMdnsAddressWatch();
156126
156247
  logMemoryUsage(this.log, "bridge running");
156127
156248
  diagnosticEventBus.emit("bridge_started", `Bridge started`, {
156128
156249
  bridgeId: this.id,
@@ -156483,6 +156604,7 @@ ${e?.toString()}`);
156483
156604
  }
156484
156605
  this.staleSessionTimers.clear();
156485
156606
  this.stopSessionRotation();
156607
+ this.stopMdnsAddressWatch();
156486
156608
  this.sessionStartedAt.clear();
156487
156609
  }
156488
156610
  // Warn at the fabric-added event when Alexa pairs on a non-5540 port. Alexa
@@ -156547,6 +156669,70 @@ ${e?.toString()}`);
156547
156669
  this.rotationTimer = null;
156548
156670
  }
156549
156671
  }
156672
+ // Poll the interface addresses mDNS advertises and re-announce when they
156673
+ // change. matter.js caches the operational records at first announcement, so
156674
+ // a dynamic ISP IPv6 prefix change keeps advertising the dead global address
156675
+ // until a restart (#415). refreshOperationalAdvertisement re-runs the lookup.
156676
+ startMdnsAddressWatch() {
156677
+ this.stopMdnsAddressWatch();
156678
+ const { netInterface, stripGlobalIpv6, ipv4Enabled } = this.readMdnsWatchSettings();
156679
+ this.advertisedAddressSnapshot = collectAdvertisedAddresses(
156680
+ os9.networkInterfaces(),
156681
+ netInterface,
156682
+ stripGlobalIpv6,
156683
+ ipv4Enabled
156684
+ );
156685
+ this.mdnsAddressTimer = setInterval(() => {
156686
+ if (this.mdnsCheckInFlight) return;
156687
+ this.mdnsCheckInFlight = true;
156688
+ this.checkAdvertisedAddresses().catch((e) => {
156689
+ this.log.warn("mDNS address check failed:", e);
156690
+ }).finally(() => {
156691
+ this.mdnsCheckInFlight = false;
156692
+ });
156693
+ }, MDNS_ADDRESS_CHECK_INTERVAL_MS);
156694
+ }
156695
+ stopMdnsAddressWatch() {
156696
+ if (this.mdnsAddressTimer) {
156697
+ clearInterval(this.mdnsAddressTimer);
156698
+ this.mdnsAddressTimer = null;
156699
+ }
156700
+ }
156701
+ // Read the mDNS settings the shared setup applied. MdnsService lives on the
156702
+ // root env and stripGlobalIpv6 swaps in a FilteredNetwork, so both are
156703
+ // visible from the bridge env.
156704
+ readMdnsWatchSettings() {
156705
+ try {
156706
+ const mdns2 = this.server.env.get(MdnsService);
156707
+ const stripGlobalIpv6 = this.server.env.get(Network) instanceof FilteredNetwork;
156708
+ return {
156709
+ netInterface: mdns2.limitedToNetInterface,
156710
+ stripGlobalIpv6,
156711
+ ipv4Enabled: mdns2.enableIpv4
156712
+ };
156713
+ } catch {
156714
+ return { stripGlobalIpv6: false, ipv4Enabled: true };
156715
+ }
156716
+ }
156717
+ async checkAdvertisedAddresses() {
156718
+ const { netInterface, stripGlobalIpv6, ipv4Enabled } = this.readMdnsWatchSettings();
156719
+ const advertiser = this.server.env.get(DeviceAdvertiser);
156720
+ const fabrics = this.server.env.get(FabricManager);
156721
+ this.advertisedAddressSnapshot = await runMdnsAddressWatchTick({
156722
+ readInterfaces: () => os9.networkInterfaces(),
156723
+ netInterface,
156724
+ stripGlobalIpv6,
156725
+ ipv4Enabled,
156726
+ currentSnapshot: this.advertisedAddressSnapshot,
156727
+ fabrics: () => fabrics.fabrics,
156728
+ refresh: (fabric) => advertiser.refreshOperationalAdvertisement(fabric),
156729
+ onChange: (prev, curr) => {
156730
+ this.log.warn(
156731
+ `Advertised address set changed (${prev.length} -> ${curr.length} addresses), re-announcing operational mDNS (#415)`
156732
+ );
156733
+ }
156734
+ });
156735
+ }
156550
156736
  // Resolve the rotation max age. Bridge config wins, then the env var. An
156551
156737
  // aggregator bridge holds many devices on one controller session, so
156552
156738
  // rotating it re-subscribes them all at once. Rotation is therefore opt-in
@@ -170991,7 +171177,7 @@ var CameraPlugin = class {
170991
171177
  this.log.info("no Home Assistant connection, no cameras exposed");
170992
171178
  return;
170993
171179
  }
170994
- const entityIds = (cameras ?? "").split(",").map((s) => s.trim()).filter(Boolean);
171180
+ const entityIds = parseCameraList(cameras);
170995
171181
  if (entityIds.length === 0) {
170996
171182
  this.log.info("no camera entity ids configured");
170997
171183
  return;
@@ -172689,10 +172875,13 @@ function hashAreaId(areaId) {
172689
172875
 
172690
172876
  // src/services/bridges/server-mode-bridge.ts
172691
172877
  init_dist();
172878
+ init_esm7();
172879
+ import * as os10 from "node:os";
172692
172880
  init_diagnostic_event_bus();
172693
172881
  var AUTO_FORCE_SYNC_INTERVAL_MS2 = 9e4;
172694
172882
  var DEAD_SESSION_TIMEOUT_MS2 = 6e4;
172695
172883
  var SHUTDOWN_SESSION_CLOSE_TIMEOUT_MS2 = 2500;
172884
+ var MDNS_ADDRESS_CHECK_INTERVAL_MS2 = 6e4;
172696
172885
  function makeWarmStartState(state, now = (/* @__PURE__ */ new Date()).toISOString()) {
172697
172886
  return { ...state, last_updated: now };
172698
172887
  }
@@ -172722,6 +172911,14 @@ var ServerModeBridge = class {
172722
172911
  sessionStartedAt = /* @__PURE__ */ new Map();
172723
172912
  rotationTimer = null;
172724
172913
  maxSessionAgeMs = 0;
172914
+ // Watches the advertised interface addresses so a dynamic ISP IPv6 prefix
172915
+ // change forces a fresh operational announcement (#415).
172916
+ mdnsAddressTimer = null;
172917
+ advertisedAddressSnapshot = [];
172918
+ // Skip a tick while the previous one is still awaiting refresh, so a slow
172919
+ // refreshOperationalAdvertisement can't overlap and re-announce off a stale
172920
+ // snapshot.
172921
+ mdnsCheckInFlight = false;
172725
172922
  // Tracks the last synced state JSON per entity to avoid pushing unchanged states.
172726
172923
  lastSyncedStates = /* @__PURE__ */ new Map();
172727
172924
  // Session lifecycle diagnostic handlers (non-destructive, logging only).
@@ -172861,6 +173058,7 @@ var ServerModeBridge = class {
172861
173058
  this.wireSessionDiagnostics();
172862
173059
  this.wireFabricWarnings();
172863
173060
  this.startSessionRotation();
173061
+ this.startMdnsAddressWatch();
172864
173062
  this.scheduleWarmStart();
172865
173063
  logMemoryUsage(this.log, "server mode bridge running");
172866
173064
  this.log.info("Server mode bridge started");
@@ -172877,6 +173075,7 @@ ${e?.toString()}`);
172877
173075
  }
172878
173076
  async stop(code = BridgeStatus.Stopped, reason = "Manually stopped") {
172879
173077
  this.stopSessionRotation();
173078
+ this.stopMdnsAddressWatch();
172880
173079
  this.unwireSessionDiagnostics();
172881
173080
  this.unwireFabricWarnings();
172882
173081
  this.cancelWarmStart();
@@ -173271,6 +173470,70 @@ ${e?.toString()}`);
173271
173470
  this.rotationTimer = null;
173272
173471
  }
173273
173472
  }
173473
+ // Poll the interface addresses mDNS advertises and re-announce when they
173474
+ // change. matter.js caches the operational records at first announcement, so
173475
+ // a dynamic ISP IPv6 prefix change keeps advertising the dead global address
173476
+ // until a restart (#415). refreshOperationalAdvertisement re-runs the lookup.
173477
+ startMdnsAddressWatch() {
173478
+ this.stopMdnsAddressWatch();
173479
+ const { netInterface, stripGlobalIpv6, ipv4Enabled } = this.readMdnsWatchSettings();
173480
+ this.advertisedAddressSnapshot = collectAdvertisedAddresses(
173481
+ os10.networkInterfaces(),
173482
+ netInterface,
173483
+ stripGlobalIpv6,
173484
+ ipv4Enabled
173485
+ );
173486
+ this.mdnsAddressTimer = setInterval(() => {
173487
+ if (this.mdnsCheckInFlight) return;
173488
+ this.mdnsCheckInFlight = true;
173489
+ this.checkAdvertisedAddresses().catch((e) => {
173490
+ this.log.warn("mDNS address check failed:", e);
173491
+ }).finally(() => {
173492
+ this.mdnsCheckInFlight = false;
173493
+ });
173494
+ }, MDNS_ADDRESS_CHECK_INTERVAL_MS2);
173495
+ }
173496
+ stopMdnsAddressWatch() {
173497
+ if (this.mdnsAddressTimer) {
173498
+ clearInterval(this.mdnsAddressTimer);
173499
+ this.mdnsAddressTimer = null;
173500
+ }
173501
+ }
173502
+ // Read the mDNS settings the shared setup applied. MdnsService lives on the
173503
+ // root env and stripGlobalIpv6 swaps in a FilteredNetwork, so both are
173504
+ // visible from the bridge env.
173505
+ readMdnsWatchSettings() {
173506
+ try {
173507
+ const mdns2 = this.server.env.get(MdnsService);
173508
+ const stripGlobalIpv6 = this.server.env.get(Network) instanceof FilteredNetwork;
173509
+ return {
173510
+ netInterface: mdns2.limitedToNetInterface,
173511
+ stripGlobalIpv6,
173512
+ ipv4Enabled: mdns2.enableIpv4
173513
+ };
173514
+ } catch {
173515
+ return { stripGlobalIpv6: false, ipv4Enabled: true };
173516
+ }
173517
+ }
173518
+ async checkAdvertisedAddresses() {
173519
+ const { netInterface, stripGlobalIpv6, ipv4Enabled } = this.readMdnsWatchSettings();
173520
+ const advertiser = this.server.env.get(DeviceAdvertiser);
173521
+ const fabrics = this.server.env.get(FabricManager);
173522
+ this.advertisedAddressSnapshot = await runMdnsAddressWatchTick({
173523
+ readInterfaces: () => os10.networkInterfaces(),
173524
+ netInterface,
173525
+ stripGlobalIpv6,
173526
+ ipv4Enabled,
173527
+ currentSnapshot: this.advertisedAddressSnapshot,
173528
+ fabrics: () => fabrics.fabrics,
173529
+ refresh: (fabric) => advertiser.refreshOperationalAdvertisement(fabric),
173530
+ onChange: (prev, curr) => {
173531
+ this.log.warn(
173532
+ `Advertised address set changed (${prev.length} -> ${curr.length} addresses), re-announcing operational mDNS (#415)`
173533
+ );
173534
+ }
173535
+ });
173536
+ }
173274
173537
  // Resolve session rotation max age. Bridge config wins, then env var,
173275
173538
  // then built-in default. 0 disables, otherwise clamped to range.
173276
173539
  readSessionMaxAgeHours() {
@@ -174167,6 +174430,11 @@ var BridgeEnvironmentFactory = class extends BridgeFactory {
174167
174430
  initialData,
174168
174431
  this.storageLocation
174169
174432
  );
174433
+ const loggerService = env.get(LoggerService);
174434
+ const tcp = this.storageLocation && bridgeNeedsTcpForCameras(this.storageLocation, initialData.id) ? CAMERA_TCP_CONFIG : void 0;
174435
+ if (tcp) {
174436
+ loggerService.get("BridgeEnvironmentFactory").info("matter over tcp enabled, cameras configured (#419)");
174437
+ }
174170
174438
  class BridgeWithEnvironment extends Bridge {
174171
174439
  async dispose() {
174172
174440
  await super.dispose();
@@ -174175,9 +174443,10 @@ var BridgeEnvironmentFactory = class extends BridgeFactory {
174175
174443
  }
174176
174444
  const bridge = new BridgeWithEnvironment(
174177
174445
  env,
174178
- env.get(LoggerService),
174446
+ loggerService,
174179
174447
  await env.load(BridgeDataProvider),
174180
- await env.load(BridgeEndpointManager)
174448
+ await env.load(BridgeEndpointManager),
174449
+ tcp ? { tcp } : void 0
174181
174450
  );
174182
174451
  await bridge.initialize();
174183
174452
  return bridge;
@@ -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
- `},B2e={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 V2e(e){let{announcements:t=B2e,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=z2e}=e,{announce:a,announcement:o}=F2e(),s=f9(`DndLiveRegion`),[c,l]=(0,C.useState)(!1);if((0,C.useEffect)(()=>{l(!0)},[]),L2e((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(N2e,{id:r,value:i.draggable}),C.createElement(P2e,{id:s,announcement:o}));return n?(0,ka.createPortal)(u,n):u}var v9;(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`})(v9||={});function y9(){}function H2e(e,t){return(0,C.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function U2e(){var e=[...arguments];return(0,C.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var b9=Object.freeze({x:0,y:0});function W2e(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function G2e(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function K2e(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function q2e(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 J2e(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function Y2e(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 X2e=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=Y2e(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=W2e(Y2e(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(G2e)},Z2e=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=q2e(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=q2e(r),o=i.reduce((e,t,r)=>e+W2e(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(G2e)};function Q2e(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 $2e=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=Q2e(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(K2e)};function e4e(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function t4e(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:b9}function n4e(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 r4e=n4e(1);function i4e(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 a4e(e,t,n){let r=i4e(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 o4e={ignoreTransform:!1};function x9(e,t){t===void 0&&(t=o4e);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=t9(e).getComputedStyle(e);t&&(n=a4e(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 s4e(e){return x9(e,{ignoreTransform:!0})}function c4e(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function l4e(e,t){return t===void 0&&(t=t9(e).getComputedStyle(e)),t.position===`fixed`}function u4e(e,t){t===void 0&&(t=t9(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 S9(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(n9(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!r9(i)||T2e(i)||n.includes(i))return n;let a=t9(e).getComputedStyle(i);return i!==e&&u4e(i,a)&&n.push(i),l4e(i,a)?n:r(i.parentNode)}return e?r(e):n}function d4e(e){let[t]=S9(e,1);return t??null}function C9(e){return!Q7||!e?null:$7(e)?e:e9(e)?n9(e)||e===i9(e).scrollingElement?window:r9(e)?e:null:null}function f4e(e){return $7(e)?e.scrollX:e.scrollLeft}function p4e(e){return $7(e)?e.scrollY:e.scrollTop}function w9(e){return{x:f4e(e),y:p4e(e)}}var T9;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(T9||={});function m4e(e){return!Q7||!e?!1:e===document.scrollingElement}function h4e(e){let t={x:0,y:0},n=m4e(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 g4e={x:.2,y:.2};function _4e(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=g4e);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=h4e(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=T9.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=T9.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=T9.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=T9.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function v4e(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 y4e(e){return e.reduce((e,t)=>p9(e,w9(t)),b9)}function b4e(e){return e.reduce((e,t)=>e+f4e(t),0)}function x4e(e){return e.reduce((e,t)=>e+p4e(t),0)}function S4e(e,t){if(t===void 0&&(t=x9),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);d4e(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var C4e=[[`x`,[`left`,`right`],b4e],[`y`,[`top`,`bottom`],x4e]],E9=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=S9(t),r=y4e(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of C4e)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})}},D9=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 w4e(e){let{EventTarget:t}=t9(e);return e instanceof t?e:i9(e)}function O9(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 k9;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(k9||={});function T4e(e){e.preventDefault()}function E4e(e){e.stopPropagation()}var A9;(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`})(A9||={});var D4e={start:[A9.Space,A9.Enter],cancel:[A9.Esc],end:[A9.Space,A9.Enter,A9.Tab]},O4e=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case A9.Right:return{...n,x:n.x+25};case A9.Left:return{...n,x:n.x-25};case A9.Down:return{...n,y:n.y+25};case A9.Up:return{...n,y:n.y-25}}},j9=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 D9(i9(t)),this.windowListeners=new D9(t9(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(k9.Resize,this.handleCancel),this.windowListeners.add(k9.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(k9.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&S4e(n),t(b9)}handleKeyDown(e){if(h9(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=D4e,coordinateGetter:a=O4e,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}:b9;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=m9(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}=h4e(n),p=v4e(n),m={x:Math.min(i===A9.Right?p.right-p.width/2:p.right,Math.max(i===A9.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===A9.Down?p.bottom-p.height/2:p.bottom,Math.max(i===A9.Down?p.top:p.top+p.height/2,u.y))},h=i===A9.Right&&!s||i===A9.Left&&!c,g=i===A9.Down&&!l||i===A9.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===A9.Right&&e<=d.x||i===A9.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===A9.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===A9.Down&&e<=d.y||i===A9.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===A9.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,p9(m9(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()}};j9.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=D4e,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 k4e(e){return!!(e&&`distance`in e)}function A4e(e){return!!(e&&`delay`in e)}var M9=class{constructor(e,t,n){n===void 0&&(n=w4e(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=i9(i),this.documentListeners=new D9(this.document),this.listeners=new D9(n),this.windowListeners=new D9(t9(i)),this.initialCoordinates=g9(r)??b9,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(k9.Resize,this.handleCancel),this.windowListeners.add(k9.DragStart,T4e),this.windowListeners.add(k9.VisibilityChange,this.handleCancel),this.windowListeners.add(k9.ContextMenu,T4e),this.documentListeners.add(k9.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(A4e(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(k4e(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(k9.Click,E4e,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(k9.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=g9(e)??b9,s=m9(n,o);if(!t&&a){if(k4e(a)){if(a.tolerance!=null&&O9(s,a.tolerance))return this.handleCancel();if(O9(s,a.distance))return this.handleStart()}if(A4e(a)&&O9(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===A9.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},j4e={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},N9=class extends M9{constructor(e){let{event:t}=e,n=i9(t.target);super(e,j4e,n)}};N9.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 M4e={move:{name:`mousemove`},end:{name:`mouseup`}},N4e;(function(e){e[e.RightClick=2]=`RightClick`})(N4e||={});var P4e=class extends M9{constructor(e){super(e,M4e,i9(e.event.target))}};P4e.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===N4e.RightClick?!1:(r?.({event:n}),!0)}}];var P9={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},F4e=class extends M9{constructor(e){super(e,P9)}static setup(){return window.addEventListener(P9.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(P9.move.name,e)};function e(){}}};F4e.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 F9;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(F9||={});var I9;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(I9||={});function I4e(e){let{acceleration:t,activator:n=F9.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=I9.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=R4e({delta:d,disabled:!a}),[m,h]=E2e(),g=(0,C.useRef)({x:0,y:0}),_=(0,C.useRef)({x:0,y:0}),v=(0,C.useMemo)(()=>{switch(n){case F9.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case F9.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===I9.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}=_4e(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 L4e={x:{[T9.Backward]:!1,[T9.Forward]:!1},y:{[T9.Backward]:!1,[T9.Forward]:!1}};function R4e(e){let{delta:t,disabled:n}=e,r=u9(t);return c9(e=>{if(n||!r||!e)return L4e;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[T9.Backward]:e.x[T9.Backward]||i.x===-1,[T9.Forward]:e.x[T9.Forward]||i.x===1},y:{[T9.Backward]:e.y[T9.Backward]||i.y===-1,[T9.Forward]:e.y[T9.Forward]||i.y===1}}},[n,t,r])}function z4e(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return c9(e=>t==null?null:r??e??null,[r,t])}function B4e(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 L9;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(L9||={});var V4e;(function(e){e.Optimized=`optimized`})(V4e||={});var H4e=new Map;function U4e(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=s9(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=c9(t=>{if(d&&!n)return H4e;if(!t||t===H4e||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 E9(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 L9.Always:return!1;case L9.BeforeDragging:return n;default:return!n}}}function W4e(e,t){return c9(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function G4e(e,t){return W4e(e,t)}function K4e(e){let{callback:t,disabled:n}=e,r=o9(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 R9(e){let{callback:t,disabled:n}=e,r=o9(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 q4e(e){return new E9(x9(e),e)}function J4e(e,t,n){t===void 0&&(t=q4e);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=K4e({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=R9({callback:a});return a9(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function Y4e(e){return t4e(e,W4e(e))}var X4e=[];function Z4e(e){let t=(0,C.useRef)(e),n=c9(n=>e?n&&n!==X4e&&e&&t.current&&e.parentNode===t.current.parentNode?n:S9(e):X4e,[e]);return(0,C.useEffect)(()=>{t.current=e},[e]),n}function Q4e(e){let[t,n]=(0,C.useState)(null),r=(0,C.useRef)(e),i=(0,C.useCallback)(e=>{let t=C9(e.target);t&&n(e=>e?(e.set(t,w9(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=C9(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,w9(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=>{C9(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,C.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>p9(e,t),b9):y4e(e):b9,[e,t])}function $4e(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!==b9;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?m9(e,n.current):b9}function e3e(e){(0,C.useEffect)(()=>{if(!Q7)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 t3e(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 n3e(e){return(0,C.useMemo)(()=>e?c4e(e):null,[e])}var r3e=[];function i3e(e,t){t===void 0&&(t=x9);let[n]=e,r=n3e(n?t9(n):null),[i,a]=(0,C.useState)(r3e);function o(){a(()=>e.length?e.map(e=>m4e(e)?r:new E9(t(e),e)):r3e)}let s=R9({callback:o});return a9(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function a3e(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return r9(t)?t:e}function o3e(e){let{measure:t}=e,[n,r]=(0,C.useState)(null),i=R9({callback:(0,C.useCallback)(e=>{for(let{target:n}of e)if(r9(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=l9((0,C.useCallback)(e=>{let n=a3e(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 s3e=[{sensor:N9,options:{}},{sensor:j9,options:{}}],c3e={current:{}},z9={draggable:{measure:s4e},droppable:{measure:s4e,strategy:L9.WhileDragging,frequency:V4e.Optimized},dragOverlay:{measure:x9}},B9=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}},l3e={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new B9,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:y9},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:z9,measureDroppableContainers:y9,windowRect:null,measuringScheduled:!1},u3e={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:y9,draggableNodes:new Map,over:null,measureDroppableContainers:y9},V9=(0,C.createContext)(u3e),d3e=(0,C.createContext)(l3e);function f3e(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new B9}}}function p3e(e,t){switch(t.type){case v9.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case v9.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 v9.DragEnd:case v9.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case v9.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new B9(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case v9.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 B9(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case v9.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new B9(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function m3e(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,C.useContext)(V9),a=u9(r),o=u9(n?.id);return(0,C.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!h9(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=j2e(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function h3e(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function g3e(e){return(0,C.useMemo)(()=>({draggable:{...z9.draggable,...e?.draggable},droppable:{...z9.droppable,...e?.droppable},dragOverlay:{...z9.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function _3e(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;a9(()=>{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=t4e(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=d4e(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var v3e=(0,C.createContext)({...b9,scaleX:1,scaleY:1}),H9;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(H9||={});var y3e=(0,C.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=s3e,collisionDetection:o=$2e,measuring:s,modifiers:c,...l}=e,[u,d]=(0,C.useReducer)(p3e,void 0,f3e),[f,p]=R2e(),[m,h]=(0,C.useState)(H9.Uninitialized),g=m===H9.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??c3e,rect:S},[_,x]),T=(0,C.useRef)(null),[E,D]=(0,C.useState)(null),[O,k]=(0,C.useState)(null),A=s9(l,Object.values(l)),j=f9(`DndDescribedBy`,t),M=(0,C.useMemo)(()=>b.getEnabled(),[b]),N=g3e(s),{droppableRects:P,measureDroppableContainers:F,measuringScheduled:I}=U4e(M,{dragging:g,dependencies:[y.x,y.y],config:N.droppable}),L=z4e(v,_),R=(0,C.useMemo)(()=>O?g9(O):null,[O]),ee=Te(),z=G4e(L,N.draggable.measure);_3e({activeNode:_==null?null:v.get(_),config:ee.layoutShiftCompensation,initialRect:z,measure:N.draggable.measure});let te=J4e(L,N.draggable.measure,z),B=J4e(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=o3e({measure:N.dragOverlay.measure}),ie=re.nodeRef.current??L,ae=g?re.rect??te:null,oe=!!(re.nodeRef.current&&re.rect),se=Y4e(oe?null:te),ce=n3e(ie?t9(ie):null),le=Z4e(g?ne??L:null),ue=i3e(le),H=h3e(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}),de=R?p9(R,y):null,fe=Q4e(le),U=$4e(fe),pe=$4e(fe,[te]),me=p9(H,U),W=ae?r4e(ae,H):null,he=w&&W?o({active:w,collisionRect:W,droppableRects:P,droppableContainers:M,pointerCoordinates:de}):null,ge=J2e(he,`id`),[_e,ve]=(0,C.useState)(null),ye=e4e(oe?H:p9(H,pe),_e?.rect??null,te),be=(0,C.useRef)(null),xe=(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;be.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,ka.unstable_batchedUpdates)(()=>{r?.(i),h(H9.Initializing),d({type:v9.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),D(be.current),k(a)})},onMove(e){d({type:v9.DragMove,coordinates:e})},onEnd:o(v9.DragEnd),onCancel:o(v9.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===v9.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=v9.DragCancel)}T.current=null,(0,ka.unstable_batchedUpdates)(()=>{d({type:e}),h(H9.Uninitialized),ve(null),D(null),k(null),be.current=null;let t=e===v9.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=A.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),Se=B4e(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,xe(n,t))},[v,xe]));e3e(a),a9(()=>{te&&m===H9.Initializing&&h(H9.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:me.x,y:me.y},over:i};(0,ka.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[me.x,me.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(ge),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,ka.unstable_batchedUpdates)(()=>{ve(s),a?.(c),f({type:`onDragOver`,event:c})})},[ge]),a9(()=>{V.current={activatorEvent:O,active:w,activeNode:L,collisionRect:W,collisions:he,droppableRects:P,draggableNodes:v,draggingNode:ie,draggingNodeRect:ae,droppableContainers:b,over:_e,scrollableAncestors:le,scrollAdjustedTranslate:me},S.current={initial:ae,translated:W}},[w,L,he,W,v,ie,ae,P,b,_e,le,me]),I4e({...ee,delta:y,draggingRect:W,pointerCoordinates:de,scrollableAncestors:le,scrollableAncestorRects:ue});let Ce=(0,C.useMemo)(()=>({active:w,activeNode:L,activeNodeRect:te,activatorEvent:O,collisions:he,containerNodeRect:B,dragOverlay:re,draggableNodes:v,droppableContainers:b,droppableRects:P,over:_e,measureDroppableContainers:F,scrollableAncestors:le,scrollableAncestorRects:ue,measuringConfiguration:N,measuringScheduled:I,windowRect:ce}),[w,L,te,O,he,B,re,v,b,P,_e,F,le,ue,N,I,ce]),we=(0,C.useMemo)(()=>({activatorEvent:O,activators:Se,active:w,activeNodeRect:te,ariaDescribedById:{draggable:j},dispatch:d,draggableNodes:v,over:_e,measureDroppableContainers:F}),[O,Se,w,te,d,j,v,_e,F]);return C.createElement(I2e.Provider,{value:p},C.createElement(V9.Provider,{value:we},C.createElement(d3e.Provider,{value:Ce},C.createElement(v3e.Provider,{value:ye},i)),C.createElement(m3e,{disabled:n?.restoreFocus===!1})),C.createElement(V2e,{...n,hiddenTextDescribedById:j}));function Te(){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}}}),b3e=(0,C.createContext)(null),x3e=`button`,S3e=`Draggable`;function C3e(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=f9(S3e),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,C.useContext)(V9),{role:p=x3e,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,C.useContext)(g?v3e:b3e),[v,y]=l9(),[b,x]=l9(),S=t3e(o,t),w=s9(n);return a9(()=>(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===x3e?!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 w3e(){return(0,C.useContext)(d3e)}var T3e=`Droppable`,E3e={timeout:25};function D3e(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=f9(T3e),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,C.useContext)(V9),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}={...E3e,...i},_=s9(h??r),v=R9({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]=l9((0,C.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=s9(t);return(0,C.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,C.useEffect)(()=>(s({type:v9.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:v9.UnregisterDroppable,key:a,id:r})),[r]),(0,C.useEffect)(()=>{n!==u.current.disabled&&(s({type:v9.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 U9(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function O3e(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function W9(e){return e!==null&&e>=0}function k3e(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 A3e(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var j3e=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=U9(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}},G9={scaleX:1,scaleY:1},M3e=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,...G9}:null}let s=N3e(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...G9}:r<t&&r>=a?{x:0,y:o.height+s,...G9}:{x:0,y:0,...G9}};function N3e(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 P3e=`Sortable`,F3e=C.createContext({activeIndex:-1,containerId:P3e,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:j3e,disabled:{draggable:!1,droppable:!1}});function I3e(e){let{children:t,id:n,items:r,strategy:i=j3e,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=w3e(),d=f9(P3e,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=!k3e(p,_.current),y=g!==-1&&h===-1||v,b=A3e(a);a9(()=>{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:O3e(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return C.createElement(F3e.Provider,{value:x},t)}var L3e=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return U9(n,r,i).indexOf(t)},R3e=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},z3e={duration:200,easing:`ease`},B3e=`transform`,V3e=_9.Transition.toString({property:B3e,duration:0,easing:`linear`}),H3e={roleDescription:`sortable`};function U3e(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,C.useState)(null),s=(0,C.useRef)(n);return a9(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=x9(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 W3e(e){let{animateLayoutChanges:t=R3e,attributes:n,disabled:r,data:i,getNewIndex:a=L3e,id:o,strategy:s,resizeObserverConfig:c,transition:l=z3e}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,C.useContext)(F3e),y=G3e(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}=D3e({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}=C3e({id:o,data:x,attributes:{...H3e,...n},disabled:y.draggable}),R=w2e(D,M),ee=!!O,z=ee&&!m&&W9(f)&&W9(g),te=!_&&P,B=z?(te&&z?L:null)??(s??v)({rects:h,activeNodeRect:A,activeIndex:f,overIndex:g,index:b}):null,V=W9(f)&&W9(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=U3e({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 V3e;if(!(te&&!h9(k)||!l)&&(ee||ae))return _9.Transition.toString({...l,property:B3e})}}function G3e(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function K9(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 K3e=[A9.Down,A9.Right,A9.Up,A9.Left],q3e=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(K3e.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 A9.Down:r.top<a.top&&t.push(n);break;case A9.Up:r.top>a.top&&t.push(n);break;case A9.Left:r.left>a.left&&t.push(n);break;case A9.Right:r.left<a.left&&t.push(n);break}});let c=Z2e({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=J2e(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=S9(c).some((e,t)=>s[t]!==e),i=J3e(e,t),a=Y3e(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:m9(u,l)}}}};function J3e(e,t){return!K9(e)||!K9(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Y3e(e,t){return!K9(e)||!K9(t)||!J3e(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}var X3e=({bridge:e,index:t})=>{let{attributes:n,listeners:r,setNodeRef:i,transform:a,transition:o,isDragging:s}=W3e({id:e.id}),[c,l]=(0,C.useState)(!1);return(0,C.useEffect)(()=>{CE(e.id).then(l)},[e.id]),(0,G.jsx)(hv,{ref:i,style:{transform:_9.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,G.jsxs)(vv,{sx:{display:`flex`,alignItems:`center`,gap:1.5,py:1,"&:last-child":{pb:1}},children:[(0,G.jsx)(Z,{...n,...r,sx:{display:`flex`,alignItems:`center`,color:`text.secondary`},children:(0,G.jsx)(Yhe,{})}),(0,G.jsx)(Ev,{label:t+1,size:`small`,color:`primary`,sx:{minWidth:32,fontWeight:`bold`}}),c?(0,G.jsx)(Z,{component:`img`,src:wE(e.id),alt:e.name,sx:{width:40,height:40,borderRadius:`50%`,objectFit:`cover`,boxShadow:2}}):(0,G.jsx)(wb,{sx:{bgcolor:AE(e),width:40,height:40,boxShadow:2},children:(0,G.jsx)(kE(e),{sx:{fontSize:24}})}),(0,G.jsxs)(Z,{sx:{flex:1},children:[(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:500,children:e.name}),(0,G.jsxs)(Q,{variant:`caption`,color:`text.secondary`,children:[`Port: `,e.port,` • Priority: `,e.priority??100]})]})]})})},Z3e=()=>{let{t:e}=ws(),t=qv(),{content:n,isLoading:r}=LT(),i=fhe(),[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=U2e(H2e(N9),H2e(j9,{coordinateGetter:q3e})),u=(0,C.useCallback)(e=>{let{active:t,over:n}=e;n&&t.id!==n.id&&(o(e=>U9(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,G.jsxs)(Q,{children:[e(`common.loading`),`...`]}):(0,G.jsxs)(Hv,{spacing:3,children:[(0,G.jsx)(Kv,{items:[{name:e(`nav.bridges`),to:J9.bridges},{name:e(`startup.title`),to:J9.startup}]}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:2,children:[(0,G.jsx)(uv,{color:`primary`,fontSize:`large`}),(0,G.jsxs)(Z,{children:[(0,G.jsx)(Q,{variant:`h5`,fontWeight:600,children:e(`startup.title`)}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:e(`startup.description`)})]})]}),s&&(0,G.jsx)(Uh,{severity:`info`,action:(0,G.jsx)(mv,{color:`inherit`,size:`small`,startIcon:(0,G.jsx)(pE,{}),onClick:d,children:e(`startup.saveChanges`)}),children:e(`startup.unsavedChanges`)}),(0,G.jsx)(y3e,{sensors:l,collisionDetection:X2e,onDragEnd:u,children:(0,G.jsx)(I3e,{items:f,strategy:M3e,children:(0,G.jsx)(Hv,{spacing:1,children:a.map((e,t)=>(0,G.jsx)(X3e,{bridge:e,index:t},e.id))})})}),a.length===0&&(0,G.jsx)(Q,{color:`text.secondary`,textAlign:`center`,py:4,children:e(`startup.noBridges`)}),s&&a.length>0&&(0,G.jsx)(Z,{display:`flex`,justifyContent:`flex-end`,children:(0,G.jsx)(mv,{variant:`contained`,startIcon:(0,G.jsx)(pE,{}),onClick:d,children:e(`startup.saveOrder`)})})]})},q9=`https://riddix.github.io/home-assistant-matter-hub`,J9={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:q9,support:`${q9}/support`,faq:{multiFabric:`${q9}/connect-multiple-fabrics`,bridgeConfig:`${q9}/bridge-configuration`}},Q3e=[{path:``,element:(0,G.jsx)(Ire,{}),children:[{path:``,element:(0,G.jsx)(g_e,{})},{path:J9.bridges,element:(0,G.jsx)(u_e,{})},{path:J9.createBridge,element:(0,G.jsx)($qe,{})},{path:J9.areaSetup,element:(0,G.jsx)(Lae,{})},{path:J9.bridge(`:bridgeId`),element:(0,G.jsx)(Ohe,{})},{path:J9.editBridge(`:bridgeId`),element:(0,G.jsx)(eJe,{})},{path:J9.devices,element:(0,G.jsx)(F_e,{})},{path:J9.standaloneDevices,element:(0,G.jsx)(C2e,{})},{path:J9.networkMap,element:(0,G.jsx)(I0e,{})},{path:J9.health,element:(0,G.jsx)(SJe,{})},{path:J9.labels,element:(0,G.jsx)(EJe,{})},{path:J9.lockCredentials,element:(0,G.jsx)(MJe,{})},{path:J9.plugins,element:(0,G.jsx)(c2e,{})},{path:J9.settings,element:(0,G.jsx)(v2e,{})},{path:J9.startup,element:(0,G.jsx)(Z3e,{})},{path:`*`,element:(0,G.jsx)(NJe,{})}]}],$3e=D_({items:{isInitialized:!1,isLoading:!1}},e=>{e.addCase(V_.pending,e=>{e.items.isLoading=!0}).addCase(V_.rejected,(e,t)=>{e.items.isInitialized=!0,e.items.isLoading=!1,e.items.content=void 0,e.items.error=t.error}).addCase(V_.fulfilled,(e,t)=>{e.items.isInitialized=!0,e.items.isLoading=!1,e.items.content=t.payload,e.items.error=void 0}).addCase(H_.fulfilled,(e,t)=>{e.items.content?.push(t.payload)}).addCase(W_.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(G_.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(U_.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(K_,(e,t)=>{e.items.isInitialized=!0,e.items.isLoading=!1,e.items.content=t.payload,e.items.error=void 0}).addCase(q_,(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}})}),e6e=D_({byBridge:{}},e=>{e.addCase(HT.pending,(e,t)=>{e.byBridge[t.meta.arg]=Y9(e.byBridge[t.meta.arg],t)}).addCase(HT.rejected,(e,t)=>{e.byBridge[t.meta.arg]=Y9(e.byBridge[t.meta.arg],t)}).addCase(HT.fulfilled,(e,t)=>{e.byBridge[t.meta.arg]=Y9(e.byBridge[t.meta.arg],t)})}),Y9=D_({isInitialized:!1,isLoading:!1,content:void 0,error:void 0},e=>{e.addCase(HT.pending,e=>{e.isLoading=!0}).addCase(HT.rejected,(e,t)=>{e.isInitialized=!0,e.isLoading=!1,e.content=void 0,e.error=t.error}).addCase(HT.fulfilled,(e,t)=>{e.isInitialized=!0,e.isLoading=!1,e.content=t.payload,e.error=void 0})}),t6e=lre({reducer:{bridges:$3e,devices:e6e}}),X9=Op({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=>km({props:e,name:`MuiContainer`})});function n6e(e){return Jd(`MuiToolbar`,e)}Yd(`MuiToolbar`,[`root`,`gutters`,`regular`,`dense`]);var r6e=e=>{let{classes:t,disableGutters:n,variant:r}=e;return Cp({root:[`root`,!n&&`gutters`,r]},n6e,t)},i6e=J(`div`,{name:`MuiToolbar`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,!n.disableGutters&&t.gutters,t[n.variant]]}})(Fm(({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}]}))),a6e=C.forwardRef(function(e,t){let n=km({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,G.jsx)(i6e,{as:i,className:K(r6e(c).root,r),ref:t,ownerState:c,...s})}),o6e=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,G.jsxs)(Z,{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,minHeight:`60vh`,gap:2,p:4,children:[(0,G.jsx)(gb,{color:`error`,sx:{fontSize:64}}),(0,G.jsx)(Q,{variant:`h5`,fontWeight:600,children:Gs.t(`errorBoundary.title`)}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,textAlign:`center`,maxWidth:480,children:this.state.error?.message??Gs.t(`errorBoundary.fallbackMessage`)}),(0,G.jsx)(mv,{variant:`contained`,onClick:()=>{this.setState({hasError:!1,error:null}),window.location.reload()},children:Gs.t(`errorBoundary.reload`)})]}):this.props.children}};function s6e(e){return Jd(`MuiFab`,e)}var c6e=Yd(`MuiFab`,[`root`,`primary`,`secondary`,`extended`,`circular`,`focusVisible`,`disabled`,`colorInherit`,`sizeSmall`,`sizeMedium`,`sizeLarge`,`info`,`error`,`warning`,`success`]),l6e=e=>{let{color:t,variant:n,classes:r,size:i}=e,a=Cp({root:[`root`,n,`size${Y(i)}`,t===`inherit`?`colorInherit`:t]},s6e,r);return{...r,...a}},u6e=J(Nh,{name:`MuiFab`,slot:`Root`,shouldForwardProp:e=>Dm(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]]}})(Fm(({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`},[`&.${c6e.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`}}]})),Fm(({theme:e})=>({variants:[...Object.entries(e.palette).filter(Um([`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}}}}))]})),Fm(({theme:e})=>({[`&.${c6e.disabled}`]:{color:(e.vars||e).palette.action.disabled,boxShadow:(e.vars||e).shadows[0],backgroundColor:(e.vars||e).palette.action.disabledBackground}}))),d6e=C.forwardRef(function(e,t){let n=km({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=l6e(p);return(0,G.jsx)(u6e,{className:K(m.root,i),component:o,disabled:s,focusRipple:!c,focusVisibleClassName:K(m.focusVisible,l),ownerState:p,ref:t,...f,classes:m,children:r})}),f6e=[{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:`Русский`}],p6e=`hamh-custom-languages`;function m6e(){try{let e=localStorage.getItem(p6e);return e?JSON.parse(e).map(e=>({code:e.code,flag:`🌐`,name:e.name})):[]}catch{return[]}}var h6e=`https://github.com/RiDDiX/home-assistant-matter-hub/issues/new?labels=translation&title=Translation+improvement`;function g6e(){let{t:e,i18n:t}=ws(),[n,r]=(0,C.useState)(!1),i=(0,C.useRef)(null),a=(0,C.useMemo)(()=>[...f6e,...m6e()],[]),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,G.jsx)(Kh,{onClickAway:(0,C.useCallback)(()=>{r(!1)},[]),children:(0,G.jsxs)(Z,{children:[(0,G.jsx)(d6e,{ref:i,size:`small`,color:`primary`,onClick:c,"aria-label":`Change language`,sx:{position:`fixed`,bottom:24,right:24,zIndex:1300},children:(0,G.jsx)(nge,{})}),(0,G.jsx)(ab,{open:n,anchorEl:i.current,placement:`top-end`,transition:!0,sx:{zIndex:1300},children:({TransitionProps:t})=>(0,G.jsx)(jb,{...t,timeout:200,children:(0,G.jsxs)(Wm,{elevation:8,sx:{mb:1,py:.5,minWidth:160,borderRadius:2,overflow:`hidden`},children:[a.map(e=>(0,G.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,G.jsx)(Q,{sx:{fontSize:`1.4rem`,lineHeight:1,userSelect:`none`},children:e.flag}),(0,G.jsx)(Q,{variant:`body2`,fontWeight:s===e.code?600:400,children:e.name})]},e.code)),(0,G.jsx)(Ub,{}),(0,G.jsxs)(Z,{sx:{display:`flex`,alignItems:`flex-start`,gap:.75,px:2,py:1},children:[(0,G.jsx)(Jv,{sx:{fontSize:14,mt:.25,color:`text.secondary`}}),(0,G.jsxs)(Q,{variant:`caption`,color:`text.secondary`,sx:{lineHeight:1.4},children:[e(`languageSwitcher.disclaimer`),` `,(0,G.jsx)(Gv,{href:h6e,target:`_blank`,rel:`noopener`,sx:{fontSize:`inherit`},children:e(`languageSwitcher.contribute`)})]})]})]})})})]})})}var _6e={name:`home-assistant-matter-hub`,description:``,version:`2.1.0-alpha.818`,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.5`,"@matter/nodejs":`0.17.5`,"@matter/general":`0.17.5`,"@matter/types":`0.17.5`,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.2.0`,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 v6e(){let e=`2.1.0-alpha.818`,[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!==t:!1,[t]);return(0,C.useMemo)(()=>({name:_6e.name,version:t??e,frontendVersion:e,backendVersion:t,versionMismatch:r}),[t,r])}var y6e=()=>{let{t:e}=ws(),t=[{name:e(`footer.github`),url:J9.githubRepository},{name:e(`footer.documentation`),url:J9.documentation},{name:e(`footer.support`),url:J9.support}];return(0,G.jsxs)(X9,{sx:{mt:16,mb:4},children:[(0,G.jsx)(Ub,{sx:{mt:4,mb:4}}),(0,G.jsx)(Fv,{container:!0,spacing:2,justifyContent:`center`,children:t.map((e,t)=>(0,G.jsx)(Fv,{size:{xs:12,sm:`auto`},children:(0,G.jsx)(mv,{fullWidth:!0,size:`small`,variant:`outlined`,component:Gv,href:e.url,target:`_blank`,children:e.name})},t.toString()))})]})};function b6e(e){return Jd(`MuiAppBar`,e)}Yd(`MuiAppBar`,[`root`,`positionFixed`,`positionAbsolute`,`positionSticky`,`positionStatic`,`positionRelative`,`colorDefault`,`colorPrimary`,`colorSecondary`,`colorInherit`,`colorTransparent`,`colorError`,`colorInfo`,`colorSuccess`,`colorWarning`]);var x6e=e=>{let{color:t,position:n,classes:r}=e;return Cp({root:[`root`,`color${Y(t)}`,`position${Y(n)}`]},b6e,r)},S6e=(e,t)=>e?`${e.replace(`)`,``)}, ${t})`:t,C6e=J(Wm,{name:`MuiAppBar`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[`position${Y(n.position)}`],t[`color${Y(n.color)}`]]}})(Fm(({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(Um([`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?S6e(e.vars.palette.AppBar.darkBg,`var(--AppBar-background)`):null,color:e.vars?S6e(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`})}}]}))),w6e=C.forwardRef(function(e,t){let n=km({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,G.jsx)(C6e,{square:!0,component:`header`,ownerState:c,elevation:4,className:K(x6e(c).root,r,o===`fixed`&&`mui-fixed`),ref:t,...s})}),T6e={visibility:`hidden`};function E6e(e,t,n){let r=n&&n.getBoundingClientRect(),i=eh(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 D6e(e){return typeof e==`function`?e():e}function Z9(e,t,n){let r=E6e(e,t,D6e(n));r&&(t.style.transform=r)}var O6e=C.forwardRef(function(e,t){let n=wm(),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=ch(Wh(s),x,t),w=Jh(x,(e,t)=>{Z9(l,e,c),qh(e),f&&f(e,t)}),T=Jh(x,(e,t)=>{let r=Xh({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=Jh(x,p),D=Jh(x,_),O=Jh(x,e=>{let t=Xh({timeout:y,style:v,easing:u},{mode:`exit`});e.style.transition=n.transitions.create(`transform`,t),Z9(l,e,c),h&&h(e)}),k=Jh(x,e=>{e.style.transition=``,g&&g(e)}),A=e=>{a&&a(x.current,e)},j=C.useCallback(()=>{x.current&&Z9(l,x.current,c)},[l,c]);return C.useEffect(()=>{if(d||l===`down`||l===`right`)return;let e=Ym(()=>{x.current&&Z9(l,x.current,c)}),t=eh(x.current);return t.addEventListener(`resize`,e),()=>{e.clear(),t.removeEventListener(`resize`,e)}},[l,d,c]),C.useEffect(()=>{d||j()},[d,j]),(0,G.jsx)(wh,{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 k6e(e){return Jd(`MuiDrawer`,e)}Yd(`MuiDrawer`,[`root`,`docked`,`paper`,`anchorLeft`,`anchorRight`,`anchorTop`,`anchorBottom`,`paperAnchorLeft`,`paperAnchorRight`,`paperAnchorTop`,`paperAnchorBottom`,`paperAnchorDockedLeft`,`paperAnchorDockedRight`,`paperAnchorDockedTop`,`paperAnchorDockedBottom`,`modal`]);var A6e=(e,t)=>{let{ownerState:n}=e;return[t.root,(n.variant===`permanent`||n.variant===`persistent`)&&t.docked,n.variant===`temporary`&&t.modal]},j6e=e=>{let{classes:t,anchor:n,variant:r}=e;return Cp({root:[`root`,`anchor${Y(n)}`],docked:[(r===`permanent`||r===`persistent`)&&`docked`],modal:[`modal`],paper:[`paper`,`paperAnchor${Y(n)}`,r!==`temporary`&&`paperAnchorDocked${Y(n)}`]},k6e,t)},M6e=J(Fb,{name:`MuiDrawer`,slot:`Root`,overridesResolver:A6e})(Fm(({theme:e})=>({zIndex:(e.vars||e).zIndex.drawer}))),N6e=J(`div`,{shouldForwardProp:Dm,name:`MuiDrawer`,slot:`Docked`,skipVariantsResolver:!1,overridesResolver:A6e})({flex:`0 0 auto`}),P6e=J(Wm,{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)}`]]}})(Fm(({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}`}}]}))),F6e={left:`right`,right:`left`,top:`down`,bottom:`up`};function I6e(e){return[`left`,`right`].includes(e)}function L6e({direction:e},t){return e===`rtl`&&I6e(t)?F6e[t]:t}var R6e=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiDrawer`}),r=wm(),i=Uf(),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=L6e({direction:i?`rtl`:`ltr`},o),D=o,O={...n,anchor:D,elevation:u,open:h,variant:b,...w},k=j6e(O),A={slots:{transition:v,...x},slotProps:{paper:g,transition:_,...S,backdrop:lh(S.backdrop||{...s,...f},{transitionDuration:y})}},[j,M]=Hm(`root`,{ref:t,elementType:M6e,className:K(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]=Hm(`paper`,{elementType:P6e,shouldForwardComponentProp:!0,className:K(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]=Hm(`docked`,{elementType:N6e,ref:t,className:K(k.root,k.docked,l),ownerState:O,externalForwardedProps:A,additionalProps:w}),[L,R]=Hm(`transition`,{elementType:O6e,ownerState:O,externalForwardedProps:A,additionalProps:{in:h,direction:F6e[E],timeout:y,appear:T.current}}),ee=(0,G.jsx)(N,{...P,children:c});if(b===`permanent`)return(0,G.jsx)(F,{...I,children:ee});let z=(0,G.jsx)(L,{...R,children:ee});return b===`persistent`?(0,G.jsx)(F,{...I,children:z}):(0,G.jsx)(j,{...M,children:z})}),z6e=_f({themeId:Cm}),B6e={error:Cx,warn:Yv,info:vb,debug:YT},V6e=({open:e,onClose:t})=>{let{t:n}=ws(),r=wm(),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,G.jsx)(B6e[e]||vb,{sx:{fontSize:16,color:i[e]}});return(0,G.jsxs)(Rb,{open:e,onClose:t,maxWidth:`lg`,fullWidth:!0,children:[(0,G.jsxs)(Vb,{sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,G.jsx)(YT,{}),n(`logs.title`),(0,G.jsx)(Z,{sx:{flexGrow:1}}),(0,G.jsx)(db,{title:n(`logs.autoRefresh`),children:(0,G.jsx)(Ev,{label:p?`Auto`:`Manual`,color:p?`success`:`default`,size:`small`,onClick:()=>m(!p),sx:{cursor:`pointer`}})}),(0,G.jsx)(Bh,{onClick:t,children:(0,G.jsx)(ZT,{})})]}),(0,G.jsxs)(Bb,{children:[(0,G.jsx)(Hv,{spacing:2,sx:{mb:2},children:(0,G.jsxs)(Hv,{direction:`row`,spacing:2,alignItems:`center`,children:[(0,G.jsxs)(kv,{size:`small`,sx:{minWidth:200},children:[(0,G.jsx)(Bx,{children:n(`logs.logLevel`)}),(0,G.jsxs)(SS,{value:l,label:n(`logs.logLevel`),onChange:g,multiple:!0,renderValue:e=>(0,G.jsx)(Z,{sx:{display:`flex`,flexWrap:`wrap`,gap:.5},children:(Array.isArray(e)?e:[e]).map(e=>(0,G.jsx)(Ev,{label:e.toUpperCase(),size:`small`,sx:{backgroundColor:i[e],color:`white`}},e))}),children:[(0,G.jsx)(CS,{value:`error`,children:n(`logs.error`)}),(0,G.jsx)(CS,{value:`warn`,children:n(`logs.warning`)}),(0,G.jsx)(CS,{value:`info`,children:n(`logs.info`)}),(0,G.jsx)(CS,{value:`debug`,children:n(`logs.debug`)})]})]}),(0,G.jsx)(ES,{size:`small`,placeholder:n(`logs.searchPlaceholder`),value:d,onChange:_,sx:{flexGrow:1}}),(0,G.jsx)(mv,{variant:`outlined`,onClick:h,children:n(`common.refresh`)}),(0,G.jsx)(mv,{variant:`outlined`,color:`error`,onClick:v,children:n(`common.delete`)})]})}),(0,G.jsx)(Z,{sx:{height:400,overflow:`auto`,backgroundColor:`background.paper`,border:1,borderColor:`divider`,borderRadius:1,p:1},children:s?(0,G.jsx)(Z,{sx:{display:`flex`,justifyContent:`center`,p:4},children:(0,G.jsxs)(Q,{children:[n(`common.loading`),`...`]})}):a.length===0?(0,G.jsx)(Z,{sx:{display:`flex`,justifyContent:`center`,p:4},children:(0,G.jsx)(Q,{color:`text.secondary`,children:n(`logs.noResults`)})}):(0,G.jsx)(Hv,{spacing:1,children:a.map((e,t)=>(0,G.jsxs)(Z,{sx:{p:1,borderRadius:1,backgroundColor:`action.hover`,fontFamily:`monospace`,fontSize:`0.875rem`,wordBreak:`break-all`},children:[(0,G.jsxs)(Z,{sx:{display:`flex`,alignItems:`center`,gap:1,mb:.5},children:[y(e.level),(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,children:new Date(e.timestamp).toLocaleString()}),(0,G.jsx)(Ev,{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,G.jsx)(Q,{sx:{ml:3},children:e.message}),e.context&&(0,G.jsx)(Q,{sx:{ml:3,color:`text.secondary`,fontSize:`0.8rem`},children:JSON.stringify(e.context,null,2)})]},`${e.timestamp}-${e.level}-${t}`))})})]}),(0,G.jsx)(zb,{children:(0,G.jsx)(mv,{onClick:t,children:n(`common.close`)})})]})};function Q9(){let{t:e}=ws(),{isConnected:t}=Z_(),[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,G.jsxs)(Z,{sx:{p:.5},children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`strong`,{children:[e(`health.version`),`:`]}),` `,n.version??e(`status.unknown`)]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`strong`,{children:[e(`health.uptime`),`:`]}),` `,o(n.uptime??0)]}),n.services?.bridges&&(0,G.jsxs)(`div`,{children:[(0,G.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,G.jsxs)(`div`,{children:[(0,G.jsxs)(`strong`,{children:[e(`health.homeAssistant`),`:`]}),` `,n.services.homeAssistant.connected?e(`health.connected`):e(`health.disconnected`)]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:`WebSocket:`}),` `,e(t?`health.connected`:`health.disconnected`)]})]}):e(`status.loadingHealth`);return(0,G.jsx)(db,{title:d,arrow:!0,children:(0,G.jsx)(Ev,{icon:i||!s?(0,G.jsx)(Cx,{fontSize:`small`}):l?(0,G.jsx)(lv,{fontSize:`small`}):(0,G.jsx)(xb,{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 H6e=e=>(0,G.jsx)(`svg`,{viewBox:`0 0 91 89`,xmlSpace:`preserve`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,G.jsxs)(`g`,{style:{display:`inline`},children:[(0,G.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,G.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`})]})}),U6e=e=>{let t=v6e();return(0,G.jsxs)(Z,{component:ua,to:J9.dashboard,sx:{display:`flex`,alignItems:`center`,justifyContent:e.large?`flex-start`:`center`,flexGrow:1,textDecoration:`none`,color:`inherit`},children:[(0,G.jsx)(H6e,{style:{height:`40px`}}),(0,G.jsx)(Q,{variant:`inherit`,component:`span`,sx:{mr:1,ml:1},children:t.name.split(`-`).map(Y).join(`-`)}),e.large&&(0,G.jsx)(Q,{variant:`caption`,component:`span`,children:t.version})]})},W6e=()=>{let e=z6e(`(min-width:600px)`),{mode:t,setMode:n}=Pm(),[r,i]=(0,C.useState)(!1),[a,o]=(0,C.useState)(!1),s=Nr(),c=Ar(),l=e=>e?e===`/`?c.pathname===`/`:c.pathname.startsWith(e):!1,u=()=>{n(t===`dark`?`light`:`dark`)},{t:d}=ws(),f=[{label:d(`dashboard.title`),icon:(0,G.jsx)(nE,{}),to:J9.dashboard},{label:d(`nav.bridges`),icon:(0,G.jsx)(rE,{}),to:J9.bridges},{label:d(`nav.devices`),icon:(0,G.jsx)(mb,{}),to:J9.devices},{label:d(`nav.standaloneDevices`,`Standalone Devices`),icon:(0,G.jsx)(fge,{}),to:J9.standaloneDevices},{label:d(`nav.networkMap`),icon:(0,G.jsx)(WT,{}),to:J9.networkMap},{label:d(`nav.startupOrder`),icon:(0,G.jsx)(uv,{}),to:J9.startup},{label:d(`nav.lockCredentials`),icon:(0,G.jsx)(ET,{}),to:J9.lockCredentials},{label:d(`nav.filterReference`),icon:(0,G.jsx)(iE,{}),to:J9.labels},{label:`Plugins`,icon:(0,G.jsx)(eE,{}),to:J9.plugins},{label:d(`nav.settings`),icon:(0,G.jsx)(PT,{}),to:J9.settings},{label:d(t===`dark`?`nav.lightMode`:`nav.darkMode`),icon:t===`dark`?(0,G.jsx)(age,{}):(0,G.jsx)(Khe,{}),onClick:u},{label:d(`nav.systemLogs`),icon:(0,G.jsx)(YT,{}),onClick:()=>i(!0)},{label:d(`nav.health`),icon:(0,G.jsx)(kx,{}),to:J9.health}],p=e=>{o(!1),e.onClick?e.onClick():e.to&&s(e.to)};return(0,G.jsxs)(Z,{children:[(0,G.jsx)(w6e,{sx:{height:`72px`},children:(0,G.jsx)(a6e,{sx:{paddingLeft:`0 !important`,paddingRight:`0 !important`},children:(0,G.jsxs)(X9,{sx:{padding:2,height:`100%`,display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,G.jsx)(U6e,{large:e}),e?(0,G.jsxs)(Z,{sx:{display:`flex`,alignItems:`center`,gap:1},children:[f.map(e=>e.to?(0,G.jsx)(db,{title:e.label,children:(0,G.jsx)(Bh,{component:ua,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,G.jsx)(db,{title:e.label,children:(0,G.jsx)(Bh,{onClick:e.onClick,sx:{color:`inherit`},children:e.icon})},e.label)),(0,G.jsx)(Q9,{})]}):(0,G.jsxs)(Z,{sx:{display:`flex`,alignItems:`center`,gap:.5},children:[(0,G.jsx)(Q9,{}),(0,G.jsx)(Bh,{onClick:()=>o(!0),sx:{color:`inherit`},children:(0,G.jsx)(oge,{})})]})]})})}),(0,G.jsx)(R6e,{anchor:`right`,open:a,onClose:()=>o(!1),children:(0,G.jsx)($v,{sx:{width:250},children:f.map(e=>(0,G.jsxs)(eoe,{selected:l(e.to),onClick:()=>p(e),children:[(0,G.jsx)(iy,{children:e.icon}),(0,G.jsx)(oy,{primary:e.label})]},e.label))})}),(0,G.jsx)(V6e,{open:r,onClose:()=>i(!1)})]})},G6e=()=>{let{versionMismatch:e,frontendVersion:t,backendVersion:n}=v6e(),{isConnected:r}=Z_();return(0,G.jsxs)(Z,{children:[(0,G.jsx)(W6e,{}),(0,G.jsx)(a6e,{}),e&&(0,G.jsxs)(Uh,{severity:`warning`,variant:`filled`,sx:{borderRadius:0},action:(0,G.jsx)(mv,{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,G.jsx)(Uh,{severity:`error`,variant:`filled`,sx:{borderRadius:0},children:`Connection lost, data may be outdated. Reconnecting…`}),(0,G.jsx)(X9,{sx:{p:2},children:(0,G.jsx)(o6e,{children:(0,G.jsx)(_i,{})})}),(0,G.jsx)(y6e,{}),(0,G.jsx)(g6e,{})]})},K6e=xm({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 q6e=oa([{path:`/`,element:(0,G.jsx)(G6e,{}),children:Q3e}],{basename:$9});(0,S.createRoot)(document.getElementById(`root`)).render((0,G.jsx)(C.StrictMode,{children:(0,G.jsx)(L,{store:t6e,children:(0,G.jsxs)(ite,{theme:K6e,children:[(0,G.jsx)(Qee,{}),(0,G.jsx)(Tm,{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,G.jsx)(Fre,{children:(0,G.jsx)(xne,{children:(0,G.jsx)(Aa,{router:q6e})})})]})})}));
469
+ `},B2e={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 V2e(e){let{announcements:t=B2e,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=z2e}=e,{announce:a,announcement:o}=F2e(),s=f9(`DndLiveRegion`),[c,l]=(0,C.useState)(!1);if((0,C.useEffect)(()=>{l(!0)},[]),L2e((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(N2e,{id:r,value:i.draggable}),C.createElement(P2e,{id:s,announcement:o}));return n?(0,ka.createPortal)(u,n):u}var v9;(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`})(v9||={});function y9(){}function H2e(e,t){return(0,C.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function U2e(){var e=[...arguments];return(0,C.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var b9=Object.freeze({x:0,y:0});function W2e(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function G2e(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function K2e(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function q2e(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 J2e(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function Y2e(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 X2e=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=Y2e(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=W2e(Y2e(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(G2e)},Z2e=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=q2e(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=q2e(r),o=i.reduce((e,t,r)=>e+W2e(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(G2e)};function Q2e(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 $2e=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=Q2e(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(K2e)};function e4e(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function t4e(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:b9}function n4e(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 r4e=n4e(1);function i4e(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 a4e(e,t,n){let r=i4e(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 o4e={ignoreTransform:!1};function x9(e,t){t===void 0&&(t=o4e);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=t9(e).getComputedStyle(e);t&&(n=a4e(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 s4e(e){return x9(e,{ignoreTransform:!0})}function c4e(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function l4e(e,t){return t===void 0&&(t=t9(e).getComputedStyle(e)),t.position===`fixed`}function u4e(e,t){t===void 0&&(t=t9(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 S9(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(n9(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!r9(i)||T2e(i)||n.includes(i))return n;let a=t9(e).getComputedStyle(i);return i!==e&&u4e(i,a)&&n.push(i),l4e(i,a)?n:r(i.parentNode)}return e?r(e):n}function d4e(e){let[t]=S9(e,1);return t??null}function C9(e){return!Q7||!e?null:$7(e)?e:e9(e)?n9(e)||e===i9(e).scrollingElement?window:r9(e)?e:null:null}function f4e(e){return $7(e)?e.scrollX:e.scrollLeft}function p4e(e){return $7(e)?e.scrollY:e.scrollTop}function w9(e){return{x:f4e(e),y:p4e(e)}}var T9;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(T9||={});function m4e(e){return!Q7||!e?!1:e===document.scrollingElement}function h4e(e){let t={x:0,y:0},n=m4e(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 g4e={x:.2,y:.2};function _4e(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=g4e);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=h4e(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=T9.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=T9.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=T9.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=T9.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function v4e(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 y4e(e){return e.reduce((e,t)=>p9(e,w9(t)),b9)}function b4e(e){return e.reduce((e,t)=>e+f4e(t),0)}function x4e(e){return e.reduce((e,t)=>e+p4e(t),0)}function S4e(e,t){if(t===void 0&&(t=x9),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);d4e(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var C4e=[[`x`,[`left`,`right`],b4e],[`y`,[`top`,`bottom`],x4e]],E9=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=S9(t),r=y4e(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of C4e)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})}},D9=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 w4e(e){let{EventTarget:t}=t9(e);return e instanceof t?e:i9(e)}function O9(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 k9;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(k9||={});function T4e(e){e.preventDefault()}function E4e(e){e.stopPropagation()}var A9;(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`})(A9||={});var D4e={start:[A9.Space,A9.Enter],cancel:[A9.Esc],end:[A9.Space,A9.Enter,A9.Tab]},O4e=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case A9.Right:return{...n,x:n.x+25};case A9.Left:return{...n,x:n.x-25};case A9.Down:return{...n,y:n.y+25};case A9.Up:return{...n,y:n.y-25}}},j9=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 D9(i9(t)),this.windowListeners=new D9(t9(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(k9.Resize,this.handleCancel),this.windowListeners.add(k9.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(k9.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&S4e(n),t(b9)}handleKeyDown(e){if(h9(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=D4e,coordinateGetter:a=O4e,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}:b9;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=m9(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}=h4e(n),p=v4e(n),m={x:Math.min(i===A9.Right?p.right-p.width/2:p.right,Math.max(i===A9.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===A9.Down?p.bottom-p.height/2:p.bottom,Math.max(i===A9.Down?p.top:p.top+p.height/2,u.y))},h=i===A9.Right&&!s||i===A9.Left&&!c,g=i===A9.Down&&!l||i===A9.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===A9.Right&&e<=d.x||i===A9.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===A9.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===A9.Down&&e<=d.y||i===A9.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===A9.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,p9(m9(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()}};j9.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=D4e,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 k4e(e){return!!(e&&`distance`in e)}function A4e(e){return!!(e&&`delay`in e)}var M9=class{constructor(e,t,n){n===void 0&&(n=w4e(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=i9(i),this.documentListeners=new D9(this.document),this.listeners=new D9(n),this.windowListeners=new D9(t9(i)),this.initialCoordinates=g9(r)??b9,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(k9.Resize,this.handleCancel),this.windowListeners.add(k9.DragStart,T4e),this.windowListeners.add(k9.VisibilityChange,this.handleCancel),this.windowListeners.add(k9.ContextMenu,T4e),this.documentListeners.add(k9.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(A4e(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(k4e(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(k9.Click,E4e,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(k9.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=g9(e)??b9,s=m9(n,o);if(!t&&a){if(k4e(a)){if(a.tolerance!=null&&O9(s,a.tolerance))return this.handleCancel();if(O9(s,a.distance))return this.handleStart()}if(A4e(a)&&O9(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===A9.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},j4e={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},N9=class extends M9{constructor(e){let{event:t}=e,n=i9(t.target);super(e,j4e,n)}};N9.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 M4e={move:{name:`mousemove`},end:{name:`mouseup`}},N4e;(function(e){e[e.RightClick=2]=`RightClick`})(N4e||={});var P4e=class extends M9{constructor(e){super(e,M4e,i9(e.event.target))}};P4e.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===N4e.RightClick?!1:(r?.({event:n}),!0)}}];var P9={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},F4e=class extends M9{constructor(e){super(e,P9)}static setup(){return window.addEventListener(P9.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(P9.move.name,e)};function e(){}}};F4e.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 F9;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(F9||={});var I9;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(I9||={});function I4e(e){let{acceleration:t,activator:n=F9.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=I9.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=R4e({delta:d,disabled:!a}),[m,h]=E2e(),g=(0,C.useRef)({x:0,y:0}),_=(0,C.useRef)({x:0,y:0}),v=(0,C.useMemo)(()=>{switch(n){case F9.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case F9.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===I9.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}=_4e(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 L4e={x:{[T9.Backward]:!1,[T9.Forward]:!1},y:{[T9.Backward]:!1,[T9.Forward]:!1}};function R4e(e){let{delta:t,disabled:n}=e,r=u9(t);return c9(e=>{if(n||!r||!e)return L4e;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[T9.Backward]:e.x[T9.Backward]||i.x===-1,[T9.Forward]:e.x[T9.Forward]||i.x===1},y:{[T9.Backward]:e.y[T9.Backward]||i.y===-1,[T9.Forward]:e.y[T9.Forward]||i.y===1}}},[n,t,r])}function z4e(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return c9(e=>t==null?null:r??e??null,[r,t])}function B4e(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 L9;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(L9||={});var V4e;(function(e){e.Optimized=`optimized`})(V4e||={});var H4e=new Map;function U4e(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=s9(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=c9(t=>{if(d&&!n)return H4e;if(!t||t===H4e||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 E9(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 L9.Always:return!1;case L9.BeforeDragging:return n;default:return!n}}}function W4e(e,t){return c9(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function G4e(e,t){return W4e(e,t)}function K4e(e){let{callback:t,disabled:n}=e,r=o9(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 R9(e){let{callback:t,disabled:n}=e,r=o9(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 q4e(e){return new E9(x9(e),e)}function J4e(e,t,n){t===void 0&&(t=q4e);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=K4e({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=R9({callback:a});return a9(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function Y4e(e){return t4e(e,W4e(e))}var X4e=[];function Z4e(e){let t=(0,C.useRef)(e),n=c9(n=>e?n&&n!==X4e&&e&&t.current&&e.parentNode===t.current.parentNode?n:S9(e):X4e,[e]);return(0,C.useEffect)(()=>{t.current=e},[e]),n}function Q4e(e){let[t,n]=(0,C.useState)(null),r=(0,C.useRef)(e),i=(0,C.useCallback)(e=>{let t=C9(e.target);t&&n(e=>e?(e.set(t,w9(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=C9(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,w9(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=>{C9(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,C.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>p9(e,t),b9):y4e(e):b9,[e,t])}function $4e(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!==b9;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?m9(e,n.current):b9}function e3e(e){(0,C.useEffect)(()=>{if(!Q7)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 t3e(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 n3e(e){return(0,C.useMemo)(()=>e?c4e(e):null,[e])}var r3e=[];function i3e(e,t){t===void 0&&(t=x9);let[n]=e,r=n3e(n?t9(n):null),[i,a]=(0,C.useState)(r3e);function o(){a(()=>e.length?e.map(e=>m4e(e)?r:new E9(t(e),e)):r3e)}let s=R9({callback:o});return a9(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function a3e(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return r9(t)?t:e}function o3e(e){let{measure:t}=e,[n,r]=(0,C.useState)(null),i=R9({callback:(0,C.useCallback)(e=>{for(let{target:n}of e)if(r9(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=l9((0,C.useCallback)(e=>{let n=a3e(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 s3e=[{sensor:N9,options:{}},{sensor:j9,options:{}}],c3e={current:{}},z9={draggable:{measure:s4e},droppable:{measure:s4e,strategy:L9.WhileDragging,frequency:V4e.Optimized},dragOverlay:{measure:x9}},B9=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}},l3e={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new B9,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:y9},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:z9,measureDroppableContainers:y9,windowRect:null,measuringScheduled:!1},u3e={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:y9,draggableNodes:new Map,over:null,measureDroppableContainers:y9},V9=(0,C.createContext)(u3e),d3e=(0,C.createContext)(l3e);function f3e(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new B9}}}function p3e(e,t){switch(t.type){case v9.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case v9.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 v9.DragEnd:case v9.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case v9.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new B9(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case v9.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 B9(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case v9.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new B9(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function m3e(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,C.useContext)(V9),a=u9(r),o=u9(n?.id);return(0,C.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!h9(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=j2e(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function h3e(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function g3e(e){return(0,C.useMemo)(()=>({draggable:{...z9.draggable,...e?.draggable},droppable:{...z9.droppable,...e?.droppable},dragOverlay:{...z9.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function _3e(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;a9(()=>{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=t4e(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=d4e(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var v3e=(0,C.createContext)({...b9,scaleX:1,scaleY:1}),H9;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(H9||={});var y3e=(0,C.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=s3e,collisionDetection:o=$2e,measuring:s,modifiers:c,...l}=e,[u,d]=(0,C.useReducer)(p3e,void 0,f3e),[f,p]=R2e(),[m,h]=(0,C.useState)(H9.Uninitialized),g=m===H9.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??c3e,rect:S},[_,x]),T=(0,C.useRef)(null),[E,D]=(0,C.useState)(null),[O,k]=(0,C.useState)(null),A=s9(l,Object.values(l)),j=f9(`DndDescribedBy`,t),M=(0,C.useMemo)(()=>b.getEnabled(),[b]),N=g3e(s),{droppableRects:P,measureDroppableContainers:F,measuringScheduled:I}=U4e(M,{dragging:g,dependencies:[y.x,y.y],config:N.droppable}),L=z4e(v,_),R=(0,C.useMemo)(()=>O?g9(O):null,[O]),ee=Te(),z=G4e(L,N.draggable.measure);_3e({activeNode:_==null?null:v.get(_),config:ee.layoutShiftCompensation,initialRect:z,measure:N.draggable.measure});let te=J4e(L,N.draggable.measure,z),B=J4e(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=o3e({measure:N.dragOverlay.measure}),ie=re.nodeRef.current??L,ae=g?re.rect??te:null,oe=!!(re.nodeRef.current&&re.rect),se=Y4e(oe?null:te),ce=n3e(ie?t9(ie):null),le=Z4e(g?ne??L:null),ue=i3e(le),H=h3e(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}),de=R?p9(R,y):null,fe=Q4e(le),U=$4e(fe),pe=$4e(fe,[te]),me=p9(H,U),W=ae?r4e(ae,H):null,he=w&&W?o({active:w,collisionRect:W,droppableRects:P,droppableContainers:M,pointerCoordinates:de}):null,ge=J2e(he,`id`),[_e,ve]=(0,C.useState)(null),ye=e4e(oe?H:p9(H,pe),_e?.rect??null,te),be=(0,C.useRef)(null),xe=(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;be.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,ka.unstable_batchedUpdates)(()=>{r?.(i),h(H9.Initializing),d({type:v9.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),D(be.current),k(a)})},onMove(e){d({type:v9.DragMove,coordinates:e})},onEnd:o(v9.DragEnd),onCancel:o(v9.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===v9.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=v9.DragCancel)}T.current=null,(0,ka.unstable_batchedUpdates)(()=>{d({type:e}),h(H9.Uninitialized),ve(null),D(null),k(null),be.current=null;let t=e===v9.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=A.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),Se=B4e(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,xe(n,t))},[v,xe]));e3e(a),a9(()=>{te&&m===H9.Initializing&&h(H9.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:me.x,y:me.y},over:i};(0,ka.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[me.x,me.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(ge),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,ka.unstable_batchedUpdates)(()=>{ve(s),a?.(c),f({type:`onDragOver`,event:c})})},[ge]),a9(()=>{V.current={activatorEvent:O,active:w,activeNode:L,collisionRect:W,collisions:he,droppableRects:P,draggableNodes:v,draggingNode:ie,draggingNodeRect:ae,droppableContainers:b,over:_e,scrollableAncestors:le,scrollAdjustedTranslate:me},S.current={initial:ae,translated:W}},[w,L,he,W,v,ie,ae,P,b,_e,le,me]),I4e({...ee,delta:y,draggingRect:W,pointerCoordinates:de,scrollableAncestors:le,scrollableAncestorRects:ue});let Ce=(0,C.useMemo)(()=>({active:w,activeNode:L,activeNodeRect:te,activatorEvent:O,collisions:he,containerNodeRect:B,dragOverlay:re,draggableNodes:v,droppableContainers:b,droppableRects:P,over:_e,measureDroppableContainers:F,scrollableAncestors:le,scrollableAncestorRects:ue,measuringConfiguration:N,measuringScheduled:I,windowRect:ce}),[w,L,te,O,he,B,re,v,b,P,_e,F,le,ue,N,I,ce]),we=(0,C.useMemo)(()=>({activatorEvent:O,activators:Se,active:w,activeNodeRect:te,ariaDescribedById:{draggable:j},dispatch:d,draggableNodes:v,over:_e,measureDroppableContainers:F}),[O,Se,w,te,d,j,v,_e,F]);return C.createElement(I2e.Provider,{value:p},C.createElement(V9.Provider,{value:we},C.createElement(d3e.Provider,{value:Ce},C.createElement(v3e.Provider,{value:ye},i)),C.createElement(m3e,{disabled:n?.restoreFocus===!1})),C.createElement(V2e,{...n,hiddenTextDescribedById:j}));function Te(){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}}}),b3e=(0,C.createContext)(null),x3e=`button`,S3e=`Draggable`;function C3e(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=f9(S3e),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,C.useContext)(V9),{role:p=x3e,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,C.useContext)(g?v3e:b3e),[v,y]=l9(),[b,x]=l9(),S=t3e(o,t),w=s9(n);return a9(()=>(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===x3e?!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 w3e(){return(0,C.useContext)(d3e)}var T3e=`Droppable`,E3e={timeout:25};function D3e(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=f9(T3e),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,C.useContext)(V9),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}={...E3e,...i},_=s9(h??r),v=R9({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]=l9((0,C.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=s9(t);return(0,C.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,C.useEffect)(()=>(s({type:v9.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:v9.UnregisterDroppable,key:a,id:r})),[r]),(0,C.useEffect)(()=>{n!==u.current.disabled&&(s({type:v9.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 U9(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function O3e(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function W9(e){return e!==null&&e>=0}function k3e(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 A3e(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var j3e=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=U9(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}},G9={scaleX:1,scaleY:1},M3e=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,...G9}:null}let s=N3e(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...G9}:r<t&&r>=a?{x:0,y:o.height+s,...G9}:{x:0,y:0,...G9}};function N3e(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 P3e=`Sortable`,F3e=C.createContext({activeIndex:-1,containerId:P3e,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:j3e,disabled:{draggable:!1,droppable:!1}});function I3e(e){let{children:t,id:n,items:r,strategy:i=j3e,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=w3e(),d=f9(P3e,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=!k3e(p,_.current),y=g!==-1&&h===-1||v,b=A3e(a);a9(()=>{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:O3e(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return C.createElement(F3e.Provider,{value:x},t)}var L3e=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return U9(n,r,i).indexOf(t)},R3e=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},z3e={duration:200,easing:`ease`},B3e=`transform`,V3e=_9.Transition.toString({property:B3e,duration:0,easing:`linear`}),H3e={roleDescription:`sortable`};function U3e(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,C.useState)(null),s=(0,C.useRef)(n);return a9(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=x9(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 W3e(e){let{animateLayoutChanges:t=R3e,attributes:n,disabled:r,data:i,getNewIndex:a=L3e,id:o,strategy:s,resizeObserverConfig:c,transition:l=z3e}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,C.useContext)(F3e),y=G3e(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}=D3e({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}=C3e({id:o,data:x,attributes:{...H3e,...n},disabled:y.draggable}),R=w2e(D,M),ee=!!O,z=ee&&!m&&W9(f)&&W9(g),te=!_&&P,B=z?(te&&z?L:null)??(s??v)({rects:h,activeNodeRect:A,activeIndex:f,overIndex:g,index:b}):null,V=W9(f)&&W9(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=U3e({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 V3e;if(!(te&&!h9(k)||!l)&&(ee||ae))return _9.Transition.toString({...l,property:B3e})}}function G3e(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function K9(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 K3e=[A9.Down,A9.Right,A9.Up,A9.Left],q3e=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(K3e.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 A9.Down:r.top<a.top&&t.push(n);break;case A9.Up:r.top>a.top&&t.push(n);break;case A9.Left:r.left>a.left&&t.push(n);break;case A9.Right:r.left<a.left&&t.push(n);break}});let c=Z2e({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=J2e(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=S9(c).some((e,t)=>s[t]!==e),i=J3e(e,t),a=Y3e(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:m9(u,l)}}}};function J3e(e,t){return!K9(e)||!K9(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Y3e(e,t){return!K9(e)||!K9(t)||!J3e(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}var X3e=({bridge:e,index:t})=>{let{attributes:n,listeners:r,setNodeRef:i,transform:a,transition:o,isDragging:s}=W3e({id:e.id}),[c,l]=(0,C.useState)(!1);return(0,C.useEffect)(()=>{CE(e.id).then(l)},[e.id]),(0,G.jsx)(hv,{ref:i,style:{transform:_9.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,G.jsxs)(vv,{sx:{display:`flex`,alignItems:`center`,gap:1.5,py:1,"&:last-child":{pb:1}},children:[(0,G.jsx)(Z,{...n,...r,sx:{display:`flex`,alignItems:`center`,color:`text.secondary`},children:(0,G.jsx)(Yhe,{})}),(0,G.jsx)(Ev,{label:t+1,size:`small`,color:`primary`,sx:{minWidth:32,fontWeight:`bold`}}),c?(0,G.jsx)(Z,{component:`img`,src:wE(e.id),alt:e.name,sx:{width:40,height:40,borderRadius:`50%`,objectFit:`cover`,boxShadow:2}}):(0,G.jsx)(wb,{sx:{bgcolor:AE(e),width:40,height:40,boxShadow:2},children:(0,G.jsx)(kE(e),{sx:{fontSize:24}})}),(0,G.jsxs)(Z,{sx:{flex:1},children:[(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:500,children:e.name}),(0,G.jsxs)(Q,{variant:`caption`,color:`text.secondary`,children:[`Port: `,e.port,` • Priority: `,e.priority??100]})]})]})})},Z3e=()=>{let{t:e}=ws(),t=qv(),{content:n,isLoading:r}=LT(),i=fhe(),[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=U2e(H2e(N9),H2e(j9,{coordinateGetter:q3e})),u=(0,C.useCallback)(e=>{let{active:t,over:n}=e;n&&t.id!==n.id&&(o(e=>U9(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,G.jsxs)(Q,{children:[e(`common.loading`),`...`]}):(0,G.jsxs)(Hv,{spacing:3,children:[(0,G.jsx)(Kv,{items:[{name:e(`nav.bridges`),to:J9.bridges},{name:e(`startup.title`),to:J9.startup}]}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:2,children:[(0,G.jsx)(uv,{color:`primary`,fontSize:`large`}),(0,G.jsxs)(Z,{children:[(0,G.jsx)(Q,{variant:`h5`,fontWeight:600,children:e(`startup.title`)}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:e(`startup.description`)})]})]}),s&&(0,G.jsx)(Uh,{severity:`info`,action:(0,G.jsx)(mv,{color:`inherit`,size:`small`,startIcon:(0,G.jsx)(pE,{}),onClick:d,children:e(`startup.saveChanges`)}),children:e(`startup.unsavedChanges`)}),(0,G.jsx)(y3e,{sensors:l,collisionDetection:X2e,onDragEnd:u,children:(0,G.jsx)(I3e,{items:f,strategy:M3e,children:(0,G.jsx)(Hv,{spacing:1,children:a.map((e,t)=>(0,G.jsx)(X3e,{bridge:e,index:t},e.id))})})}),a.length===0&&(0,G.jsx)(Q,{color:`text.secondary`,textAlign:`center`,py:4,children:e(`startup.noBridges`)}),s&&a.length>0&&(0,G.jsx)(Z,{display:`flex`,justifyContent:`flex-end`,children:(0,G.jsx)(mv,{variant:`contained`,startIcon:(0,G.jsx)(pE,{}),onClick:d,children:e(`startup.saveOrder`)})})]})},q9=`https://riddix.github.io/home-assistant-matter-hub`,J9={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:q9,support:`${q9}/support`,faq:{multiFabric:`${q9}/connect-multiple-fabrics`,bridgeConfig:`${q9}/bridge-configuration`}},Q3e=[{path:``,element:(0,G.jsx)(Ire,{}),children:[{path:``,element:(0,G.jsx)(g_e,{})},{path:J9.bridges,element:(0,G.jsx)(u_e,{})},{path:J9.createBridge,element:(0,G.jsx)($qe,{})},{path:J9.areaSetup,element:(0,G.jsx)(Lae,{})},{path:J9.bridge(`:bridgeId`),element:(0,G.jsx)(Ohe,{})},{path:J9.editBridge(`:bridgeId`),element:(0,G.jsx)(eJe,{})},{path:J9.devices,element:(0,G.jsx)(F_e,{})},{path:J9.standaloneDevices,element:(0,G.jsx)(C2e,{})},{path:J9.networkMap,element:(0,G.jsx)(I0e,{})},{path:J9.health,element:(0,G.jsx)(SJe,{})},{path:J9.labels,element:(0,G.jsx)(EJe,{})},{path:J9.lockCredentials,element:(0,G.jsx)(MJe,{})},{path:J9.plugins,element:(0,G.jsx)(c2e,{})},{path:J9.settings,element:(0,G.jsx)(v2e,{})},{path:J9.startup,element:(0,G.jsx)(Z3e,{})},{path:`*`,element:(0,G.jsx)(NJe,{})}]}],$3e=D_({items:{isInitialized:!1,isLoading:!1}},e=>{e.addCase(V_.pending,e=>{e.items.isLoading=!0}).addCase(V_.rejected,(e,t)=>{e.items.isInitialized=!0,e.items.isLoading=!1,e.items.content=void 0,e.items.error=t.error}).addCase(V_.fulfilled,(e,t)=>{e.items.isInitialized=!0,e.items.isLoading=!1,e.items.content=t.payload,e.items.error=void 0}).addCase(H_.fulfilled,(e,t)=>{e.items.content?.push(t.payload)}).addCase(W_.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(G_.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(U_.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(K_,(e,t)=>{e.items.isInitialized=!0,e.items.isLoading=!1,e.items.content=t.payload,e.items.error=void 0}).addCase(q_,(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}})}),e6e=D_({byBridge:{}},e=>{e.addCase(HT.pending,(e,t)=>{e.byBridge[t.meta.arg]=Y9(e.byBridge[t.meta.arg],t)}).addCase(HT.rejected,(e,t)=>{e.byBridge[t.meta.arg]=Y9(e.byBridge[t.meta.arg],t)}).addCase(HT.fulfilled,(e,t)=>{e.byBridge[t.meta.arg]=Y9(e.byBridge[t.meta.arg],t)})}),Y9=D_({isInitialized:!1,isLoading:!1,content:void 0,error:void 0},e=>{e.addCase(HT.pending,e=>{e.isLoading=!0}).addCase(HT.rejected,(e,t)=>{e.isInitialized=!0,e.isLoading=!1,e.content=void 0,e.error=t.error}).addCase(HT.fulfilled,(e,t)=>{e.isInitialized=!0,e.isLoading=!1,e.content=t.payload,e.error=void 0})}),t6e=lre({reducer:{bridges:$3e,devices:e6e}}),X9=Op({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=>km({props:e,name:`MuiContainer`})});function n6e(e){return Jd(`MuiToolbar`,e)}Yd(`MuiToolbar`,[`root`,`gutters`,`regular`,`dense`]);var r6e=e=>{let{classes:t,disableGutters:n,variant:r}=e;return Cp({root:[`root`,!n&&`gutters`,r]},n6e,t)},i6e=J(`div`,{name:`MuiToolbar`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,!n.disableGutters&&t.gutters,t[n.variant]]}})(Fm(({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}]}))),a6e=C.forwardRef(function(e,t){let n=km({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,G.jsx)(i6e,{as:i,className:K(r6e(c).root,r),ref:t,ownerState:c,...s})}),o6e=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,G.jsxs)(Z,{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,minHeight:`60vh`,gap:2,p:4,children:[(0,G.jsx)(gb,{color:`error`,sx:{fontSize:64}}),(0,G.jsx)(Q,{variant:`h5`,fontWeight:600,children:Gs.t(`errorBoundary.title`)}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,textAlign:`center`,maxWidth:480,children:this.state.error?.message??Gs.t(`errorBoundary.fallbackMessage`)}),(0,G.jsx)(mv,{variant:`contained`,onClick:()=>{this.setState({hasError:!1,error:null}),window.location.reload()},children:Gs.t(`errorBoundary.reload`)})]}):this.props.children}};function s6e(e){return Jd(`MuiFab`,e)}var c6e=Yd(`MuiFab`,[`root`,`primary`,`secondary`,`extended`,`circular`,`focusVisible`,`disabled`,`colorInherit`,`sizeSmall`,`sizeMedium`,`sizeLarge`,`info`,`error`,`warning`,`success`]),l6e=e=>{let{color:t,variant:n,classes:r,size:i}=e,a=Cp({root:[`root`,n,`size${Y(i)}`,t===`inherit`?`colorInherit`:t]},s6e,r);return{...r,...a}},u6e=J(Nh,{name:`MuiFab`,slot:`Root`,shouldForwardProp:e=>Dm(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]]}})(Fm(({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`},[`&.${c6e.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`}}]})),Fm(({theme:e})=>({variants:[...Object.entries(e.palette).filter(Um([`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}}}}))]})),Fm(({theme:e})=>({[`&.${c6e.disabled}`]:{color:(e.vars||e).palette.action.disabled,boxShadow:(e.vars||e).shadows[0],backgroundColor:(e.vars||e).palette.action.disabledBackground}}))),d6e=C.forwardRef(function(e,t){let n=km({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=l6e(p);return(0,G.jsx)(u6e,{className:K(m.root,i),component:o,disabled:s,focusRipple:!c,focusVisibleClassName:K(m.focusVisible,l),ownerState:p,ref:t,...f,classes:m,children:r})}),f6e=[{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:`Русский`}],p6e=`hamh-custom-languages`;function m6e(){try{let e=localStorage.getItem(p6e);return e?JSON.parse(e).map(e=>({code:e.code,flag:`🌐`,name:e.name})):[]}catch{return[]}}var h6e=`https://github.com/RiDDiX/home-assistant-matter-hub/issues/new?labels=translation&title=Translation+improvement`;function g6e(){let{t:e,i18n:t}=ws(),[n,r]=(0,C.useState)(!1),i=(0,C.useRef)(null),a=(0,C.useMemo)(()=>[...f6e,...m6e()],[]),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,G.jsx)(Kh,{onClickAway:(0,C.useCallback)(()=>{r(!1)},[]),children:(0,G.jsxs)(Z,{children:[(0,G.jsx)(d6e,{ref:i,size:`small`,color:`primary`,onClick:c,"aria-label":`Change language`,sx:{position:`fixed`,bottom:24,right:24,zIndex:1300},children:(0,G.jsx)(nge,{})}),(0,G.jsx)(ab,{open:n,anchorEl:i.current,placement:`top-end`,transition:!0,sx:{zIndex:1300},children:({TransitionProps:t})=>(0,G.jsx)(jb,{...t,timeout:200,children:(0,G.jsxs)(Wm,{elevation:8,sx:{mb:1,py:.5,minWidth:160,borderRadius:2,overflow:`hidden`},children:[a.map(e=>(0,G.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,G.jsx)(Q,{sx:{fontSize:`1.4rem`,lineHeight:1,userSelect:`none`},children:e.flag}),(0,G.jsx)(Q,{variant:`body2`,fontWeight:s===e.code?600:400,children:e.name})]},e.code)),(0,G.jsx)(Ub,{}),(0,G.jsxs)(Z,{sx:{display:`flex`,alignItems:`flex-start`,gap:.75,px:2,py:1},children:[(0,G.jsx)(Jv,{sx:{fontSize:14,mt:.25,color:`text.secondary`}}),(0,G.jsxs)(Q,{variant:`caption`,color:`text.secondary`,sx:{lineHeight:1.4},children:[e(`languageSwitcher.disclaimer`),` `,(0,G.jsx)(Gv,{href:h6e,target:`_blank`,rel:`noopener`,sx:{fontSize:`inherit`},children:e(`languageSwitcher.contribute`)})]})]})]})})})]})})}var _6e={name:`home-assistant-matter-hub`,description:``,version:`2.1.0-alpha.820`,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.5`,"@matter/nodejs":`0.17.5`,"@matter/general":`0.17.5`,"@matter/types":`0.17.5`,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.2.0`,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 v6e(){let e=`2.1.0-alpha.820`,[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!==t:!1,[t]);return(0,C.useMemo)(()=>({name:_6e.name,version:t??e,frontendVersion:e,backendVersion:t,versionMismatch:r}),[t,r])}var y6e=()=>{let{t:e}=ws(),t=[{name:e(`footer.github`),url:J9.githubRepository},{name:e(`footer.documentation`),url:J9.documentation},{name:e(`footer.support`),url:J9.support}];return(0,G.jsxs)(X9,{sx:{mt:16,mb:4},children:[(0,G.jsx)(Ub,{sx:{mt:4,mb:4}}),(0,G.jsx)(Fv,{container:!0,spacing:2,justifyContent:`center`,children:t.map((e,t)=>(0,G.jsx)(Fv,{size:{xs:12,sm:`auto`},children:(0,G.jsx)(mv,{fullWidth:!0,size:`small`,variant:`outlined`,component:Gv,href:e.url,target:`_blank`,children:e.name})},t.toString()))})]})};function b6e(e){return Jd(`MuiAppBar`,e)}Yd(`MuiAppBar`,[`root`,`positionFixed`,`positionAbsolute`,`positionSticky`,`positionStatic`,`positionRelative`,`colorDefault`,`colorPrimary`,`colorSecondary`,`colorInherit`,`colorTransparent`,`colorError`,`colorInfo`,`colorSuccess`,`colorWarning`]);var x6e=e=>{let{color:t,position:n,classes:r}=e;return Cp({root:[`root`,`color${Y(t)}`,`position${Y(n)}`]},b6e,r)},S6e=(e,t)=>e?`${e.replace(`)`,``)}, ${t})`:t,C6e=J(Wm,{name:`MuiAppBar`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[`position${Y(n.position)}`],t[`color${Y(n.color)}`]]}})(Fm(({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(Um([`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?S6e(e.vars.palette.AppBar.darkBg,`var(--AppBar-background)`):null,color:e.vars?S6e(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`})}}]}))),w6e=C.forwardRef(function(e,t){let n=km({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,G.jsx)(C6e,{square:!0,component:`header`,ownerState:c,elevation:4,className:K(x6e(c).root,r,o===`fixed`&&`mui-fixed`),ref:t,...s})}),T6e={visibility:`hidden`};function E6e(e,t,n){let r=n&&n.getBoundingClientRect(),i=eh(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 D6e(e){return typeof e==`function`?e():e}function Z9(e,t,n){let r=E6e(e,t,D6e(n));r&&(t.style.transform=r)}var O6e=C.forwardRef(function(e,t){let n=wm(),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=ch(Wh(s),x,t),w=Jh(x,(e,t)=>{Z9(l,e,c),qh(e),f&&f(e,t)}),T=Jh(x,(e,t)=>{let r=Xh({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=Jh(x,p),D=Jh(x,_),O=Jh(x,e=>{let t=Xh({timeout:y,style:v,easing:u},{mode:`exit`});e.style.transition=n.transitions.create(`transform`,t),Z9(l,e,c),h&&h(e)}),k=Jh(x,e=>{e.style.transition=``,g&&g(e)}),A=e=>{a&&a(x.current,e)},j=C.useCallback(()=>{x.current&&Z9(l,x.current,c)},[l,c]);return C.useEffect(()=>{if(d||l===`down`||l===`right`)return;let e=Ym(()=>{x.current&&Z9(l,x.current,c)}),t=eh(x.current);return t.addEventListener(`resize`,e),()=>{e.clear(),t.removeEventListener(`resize`,e)}},[l,d,c]),C.useEffect(()=>{d||j()},[d,j]),(0,G.jsx)(wh,{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 k6e(e){return Jd(`MuiDrawer`,e)}Yd(`MuiDrawer`,[`root`,`docked`,`paper`,`anchorLeft`,`anchorRight`,`anchorTop`,`anchorBottom`,`paperAnchorLeft`,`paperAnchorRight`,`paperAnchorTop`,`paperAnchorBottom`,`paperAnchorDockedLeft`,`paperAnchorDockedRight`,`paperAnchorDockedTop`,`paperAnchorDockedBottom`,`modal`]);var A6e=(e,t)=>{let{ownerState:n}=e;return[t.root,(n.variant===`permanent`||n.variant===`persistent`)&&t.docked,n.variant===`temporary`&&t.modal]},j6e=e=>{let{classes:t,anchor:n,variant:r}=e;return Cp({root:[`root`,`anchor${Y(n)}`],docked:[(r===`permanent`||r===`persistent`)&&`docked`],modal:[`modal`],paper:[`paper`,`paperAnchor${Y(n)}`,r!==`temporary`&&`paperAnchorDocked${Y(n)}`]},k6e,t)},M6e=J(Fb,{name:`MuiDrawer`,slot:`Root`,overridesResolver:A6e})(Fm(({theme:e})=>({zIndex:(e.vars||e).zIndex.drawer}))),N6e=J(`div`,{shouldForwardProp:Dm,name:`MuiDrawer`,slot:`Docked`,skipVariantsResolver:!1,overridesResolver:A6e})({flex:`0 0 auto`}),P6e=J(Wm,{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)}`]]}})(Fm(({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}`}}]}))),F6e={left:`right`,right:`left`,top:`down`,bottom:`up`};function I6e(e){return[`left`,`right`].includes(e)}function L6e({direction:e},t){return e===`rtl`&&I6e(t)?F6e[t]:t}var R6e=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiDrawer`}),r=wm(),i=Uf(),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=L6e({direction:i?`rtl`:`ltr`},o),D=o,O={...n,anchor:D,elevation:u,open:h,variant:b,...w},k=j6e(O),A={slots:{transition:v,...x},slotProps:{paper:g,transition:_,...S,backdrop:lh(S.backdrop||{...s,...f},{transitionDuration:y})}},[j,M]=Hm(`root`,{ref:t,elementType:M6e,className:K(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]=Hm(`paper`,{elementType:P6e,shouldForwardComponentProp:!0,className:K(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]=Hm(`docked`,{elementType:N6e,ref:t,className:K(k.root,k.docked,l),ownerState:O,externalForwardedProps:A,additionalProps:w}),[L,R]=Hm(`transition`,{elementType:O6e,ownerState:O,externalForwardedProps:A,additionalProps:{in:h,direction:F6e[E],timeout:y,appear:T.current}}),ee=(0,G.jsx)(N,{...P,children:c});if(b===`permanent`)return(0,G.jsx)(F,{...I,children:ee});let z=(0,G.jsx)(L,{...R,children:ee});return b===`persistent`?(0,G.jsx)(F,{...I,children:z}):(0,G.jsx)(j,{...M,children:z})}),z6e=_f({themeId:Cm}),B6e={error:Cx,warn:Yv,info:vb,debug:YT},V6e=({open:e,onClose:t})=>{let{t:n}=ws(),r=wm(),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,G.jsx)(B6e[e]||vb,{sx:{fontSize:16,color:i[e]}});return(0,G.jsxs)(Rb,{open:e,onClose:t,maxWidth:`lg`,fullWidth:!0,children:[(0,G.jsxs)(Vb,{sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,G.jsx)(YT,{}),n(`logs.title`),(0,G.jsx)(Z,{sx:{flexGrow:1}}),(0,G.jsx)(db,{title:n(`logs.autoRefresh`),children:(0,G.jsx)(Ev,{label:p?`Auto`:`Manual`,color:p?`success`:`default`,size:`small`,onClick:()=>m(!p),sx:{cursor:`pointer`}})}),(0,G.jsx)(Bh,{onClick:t,children:(0,G.jsx)(ZT,{})})]}),(0,G.jsxs)(Bb,{children:[(0,G.jsx)(Hv,{spacing:2,sx:{mb:2},children:(0,G.jsxs)(Hv,{direction:`row`,spacing:2,alignItems:`center`,children:[(0,G.jsxs)(kv,{size:`small`,sx:{minWidth:200},children:[(0,G.jsx)(Bx,{children:n(`logs.logLevel`)}),(0,G.jsxs)(SS,{value:l,label:n(`logs.logLevel`),onChange:g,multiple:!0,renderValue:e=>(0,G.jsx)(Z,{sx:{display:`flex`,flexWrap:`wrap`,gap:.5},children:(Array.isArray(e)?e:[e]).map(e=>(0,G.jsx)(Ev,{label:e.toUpperCase(),size:`small`,sx:{backgroundColor:i[e],color:`white`}},e))}),children:[(0,G.jsx)(CS,{value:`error`,children:n(`logs.error`)}),(0,G.jsx)(CS,{value:`warn`,children:n(`logs.warning`)}),(0,G.jsx)(CS,{value:`info`,children:n(`logs.info`)}),(0,G.jsx)(CS,{value:`debug`,children:n(`logs.debug`)})]})]}),(0,G.jsx)(ES,{size:`small`,placeholder:n(`logs.searchPlaceholder`),value:d,onChange:_,sx:{flexGrow:1}}),(0,G.jsx)(mv,{variant:`outlined`,onClick:h,children:n(`common.refresh`)}),(0,G.jsx)(mv,{variant:`outlined`,color:`error`,onClick:v,children:n(`common.delete`)})]})}),(0,G.jsx)(Z,{sx:{height:400,overflow:`auto`,backgroundColor:`background.paper`,border:1,borderColor:`divider`,borderRadius:1,p:1},children:s?(0,G.jsx)(Z,{sx:{display:`flex`,justifyContent:`center`,p:4},children:(0,G.jsxs)(Q,{children:[n(`common.loading`),`...`]})}):a.length===0?(0,G.jsx)(Z,{sx:{display:`flex`,justifyContent:`center`,p:4},children:(0,G.jsx)(Q,{color:`text.secondary`,children:n(`logs.noResults`)})}):(0,G.jsx)(Hv,{spacing:1,children:a.map((e,t)=>(0,G.jsxs)(Z,{sx:{p:1,borderRadius:1,backgroundColor:`action.hover`,fontFamily:`monospace`,fontSize:`0.875rem`,wordBreak:`break-all`},children:[(0,G.jsxs)(Z,{sx:{display:`flex`,alignItems:`center`,gap:1,mb:.5},children:[y(e.level),(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,children:new Date(e.timestamp).toLocaleString()}),(0,G.jsx)(Ev,{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,G.jsx)(Q,{sx:{ml:3},children:e.message}),e.context&&(0,G.jsx)(Q,{sx:{ml:3,color:`text.secondary`,fontSize:`0.8rem`},children:JSON.stringify(e.context,null,2)})]},`${e.timestamp}-${e.level}-${t}`))})})]}),(0,G.jsx)(zb,{children:(0,G.jsx)(mv,{onClick:t,children:n(`common.close`)})})]})};function Q9(){let{t:e}=ws(),{isConnected:t}=Z_(),[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,G.jsxs)(Z,{sx:{p:.5},children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`strong`,{children:[e(`health.version`),`:`]}),` `,n.version??e(`status.unknown`)]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`strong`,{children:[e(`health.uptime`),`:`]}),` `,o(n.uptime??0)]}),n.services?.bridges&&(0,G.jsxs)(`div`,{children:[(0,G.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,G.jsxs)(`div`,{children:[(0,G.jsxs)(`strong`,{children:[e(`health.homeAssistant`),`:`]}),` `,n.services.homeAssistant.connected?e(`health.connected`):e(`health.disconnected`)]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:`WebSocket:`}),` `,e(t?`health.connected`:`health.disconnected`)]})]}):e(`status.loadingHealth`);return(0,G.jsx)(db,{title:d,arrow:!0,children:(0,G.jsx)(Ev,{icon:i||!s?(0,G.jsx)(Cx,{fontSize:`small`}):l?(0,G.jsx)(lv,{fontSize:`small`}):(0,G.jsx)(xb,{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 H6e=e=>(0,G.jsx)(`svg`,{viewBox:`0 0 91 89`,xmlSpace:`preserve`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,G.jsxs)(`g`,{style:{display:`inline`},children:[(0,G.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,G.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`})]})}),U6e=e=>{let t=v6e();return(0,G.jsxs)(Z,{component:ua,to:J9.dashboard,sx:{display:`flex`,alignItems:`center`,justifyContent:e.large?`flex-start`:`center`,flexGrow:1,textDecoration:`none`,color:`inherit`},children:[(0,G.jsx)(H6e,{style:{height:`40px`}}),(0,G.jsx)(Q,{variant:`inherit`,component:`span`,sx:{mr:1,ml:1},children:t.name.split(`-`).map(Y).join(`-`)}),e.large&&(0,G.jsx)(Q,{variant:`caption`,component:`span`,children:t.version})]})},W6e=()=>{let e=z6e(`(min-width:600px)`),{mode:t,setMode:n}=Pm(),[r,i]=(0,C.useState)(!1),[a,o]=(0,C.useState)(!1),s=Nr(),c=Ar(),l=e=>e?e===`/`?c.pathname===`/`:c.pathname.startsWith(e):!1,u=()=>{n(t===`dark`?`light`:`dark`)},{t:d}=ws(),f=[{label:d(`dashboard.title`),icon:(0,G.jsx)(nE,{}),to:J9.dashboard},{label:d(`nav.bridges`),icon:(0,G.jsx)(rE,{}),to:J9.bridges},{label:d(`nav.devices`),icon:(0,G.jsx)(mb,{}),to:J9.devices},{label:d(`nav.standaloneDevices`,`Standalone Devices`),icon:(0,G.jsx)(fge,{}),to:J9.standaloneDevices},{label:d(`nav.networkMap`),icon:(0,G.jsx)(WT,{}),to:J9.networkMap},{label:d(`nav.startupOrder`),icon:(0,G.jsx)(uv,{}),to:J9.startup},{label:d(`nav.lockCredentials`),icon:(0,G.jsx)(ET,{}),to:J9.lockCredentials},{label:d(`nav.filterReference`),icon:(0,G.jsx)(iE,{}),to:J9.labels},{label:`Plugins`,icon:(0,G.jsx)(eE,{}),to:J9.plugins},{label:d(`nav.settings`),icon:(0,G.jsx)(PT,{}),to:J9.settings},{label:d(t===`dark`?`nav.lightMode`:`nav.darkMode`),icon:t===`dark`?(0,G.jsx)(age,{}):(0,G.jsx)(Khe,{}),onClick:u},{label:d(`nav.systemLogs`),icon:(0,G.jsx)(YT,{}),onClick:()=>i(!0)},{label:d(`nav.health`),icon:(0,G.jsx)(kx,{}),to:J9.health}],p=e=>{o(!1),e.onClick?e.onClick():e.to&&s(e.to)};return(0,G.jsxs)(Z,{children:[(0,G.jsx)(w6e,{sx:{height:`72px`},children:(0,G.jsx)(a6e,{sx:{paddingLeft:`0 !important`,paddingRight:`0 !important`},children:(0,G.jsxs)(X9,{sx:{padding:2,height:`100%`,display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,G.jsx)(U6e,{large:e}),e?(0,G.jsxs)(Z,{sx:{display:`flex`,alignItems:`center`,gap:1},children:[f.map(e=>e.to?(0,G.jsx)(db,{title:e.label,children:(0,G.jsx)(Bh,{component:ua,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,G.jsx)(db,{title:e.label,children:(0,G.jsx)(Bh,{onClick:e.onClick,sx:{color:`inherit`},children:e.icon})},e.label)),(0,G.jsx)(Q9,{})]}):(0,G.jsxs)(Z,{sx:{display:`flex`,alignItems:`center`,gap:.5},children:[(0,G.jsx)(Q9,{}),(0,G.jsx)(Bh,{onClick:()=>o(!0),sx:{color:`inherit`},children:(0,G.jsx)(oge,{})})]})]})})}),(0,G.jsx)(R6e,{anchor:`right`,open:a,onClose:()=>o(!1),children:(0,G.jsx)($v,{sx:{width:250},children:f.map(e=>(0,G.jsxs)(eoe,{selected:l(e.to),onClick:()=>p(e),children:[(0,G.jsx)(iy,{children:e.icon}),(0,G.jsx)(oy,{primary:e.label})]},e.label))})}),(0,G.jsx)(V6e,{open:r,onClose:()=>i(!1)})]})},G6e=()=>{let{versionMismatch:e,frontendVersion:t,backendVersion:n}=v6e(),{isConnected:r}=Z_();return(0,G.jsxs)(Z,{children:[(0,G.jsx)(W6e,{}),(0,G.jsx)(a6e,{}),e&&(0,G.jsxs)(Uh,{severity:`warning`,variant:`filled`,sx:{borderRadius:0},action:(0,G.jsx)(mv,{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,G.jsx)(Uh,{severity:`error`,variant:`filled`,sx:{borderRadius:0},children:`Connection lost, data may be outdated. Reconnecting…`}),(0,G.jsx)(X9,{sx:{p:2},children:(0,G.jsx)(o6e,{children:(0,G.jsx)(_i,{})})}),(0,G.jsx)(y6e,{}),(0,G.jsx)(g6e,{})]})},K6e=xm({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 q6e=oa([{path:`/`,element:(0,G.jsx)(G6e,{}),children:Q3e}],{basename:$9});(0,S.createRoot)(document.getElementById(`root`)).render((0,G.jsx)(C.StrictMode,{children:(0,G.jsx)(L,{store:t6e,children:(0,G.jsxs)(ite,{theme:K6e,children:[(0,G.jsx)(Qee,{}),(0,G.jsx)(Tm,{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,G.jsx)(Fre,{children:(0,G.jsx)(xne,{children:(0,G.jsx)(Aa,{router:q6e})})})]})})}));
@@ -8,7 +8,7 @@
8
8
  <!-- BASE -->
9
9
  <base href="/" />
10
10
  <!-- /BASE -->
11
- <script type="module" crossorigin src="./assets/index-k9wg59yx.js"></script>
11
+ <script type="module" crossorigin src="./assets/index-CwvtXv2o.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.818",
4
+ "version": "2.1.0-alpha.820",
5
5
  "private": false,
6
6
  "type": "module",
7
7
  "bin": {
@@ -57,9 +57,9 @@
57
57
  },
58
58
  "devDependencies": {
59
59
  "@types/lodash-es": "^4.17.12",
60
- "@home-assistant-matter-hub/backend": "2.1.0-alpha.818",
61
- "@home-assistant-matter-hub/common": "2.1.0-alpha.818",
62
- "@home-assistant-matter-hub/frontend": "2.1.0-alpha.818"
60
+ "@home-assistant-matter-hub/frontend": "2.1.0-alpha.820",
61
+ "@home-assistant-matter-hub/backend": "2.1.0-alpha.820",
62
+ "@home-assistant-matter-hub/common": "2.1.0-alpha.820"
63
63
  },
64
64
  "overrides": {
65
65
  "minimatch": "9.0.7",