@camstack/addon-admin-ui 1.2.525 → 1.2.526

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/assets/{AddonAssetIcon-DwYI7EBR.js → AddonAssetIcon-Bk09xHqf.js} +1 -1
  3. package/dist/assets/Addons-BwXNg54C.js +5 -0
  4. package/dist/assets/{AdminPage-BVK_kyJp.js → AdminPage-CYSYefaL.js} +1 -1
  5. package/dist/assets/{AdminSectionedPage-Bu-9skyU.js → AdminSectionedPage-B4MRvqE8.js} +1 -1
  6. package/dist/assets/AiProfiles-CRZH6xR0.js +3 -0
  7. package/dist/assets/BrokerEditorDialog-D9rZCGl9.js +1 -0
  8. package/dist/assets/Build-BJaqr-_Y.js +40 -0
  9. package/dist/assets/{Calendars-NM9x_lTF.js → Calendars-D4ed6Nqc.js} +1 -1
  10. package/dist/assets/{Cluster-C104ZPJk.js → Cluster-Dkt_tVUy.js} +1 -1
  11. package/dist/assets/{ComposedDeviceEditDialog-3vtEogq6.js → ComposedDeviceEditDialog-DJ5mqI6C.js} +1 -1
  12. package/dist/assets/{CompositionBlockEditor-DYg72AlP.js → CompositionBlockEditor-BEondavu.js} +2 -2
  13. package/dist/assets/{CompositionEditorPage-D1auHftj.js → CompositionEditorPage-4rHclFIA.js} +1 -1
  14. package/dist/assets/{Data-D4jDqmcs.js → Data-pZe3A7Va.js} +2 -2
  15. package/dist/assets/DeviceDetail-3jKJ80IC.js +2 -0
  16. package/dist/assets/{DeviceDoActionFields-CLlHGMoV.js → DeviceDoActionFields-1jte2ge2.js} +1 -1
  17. package/dist/assets/{Devices-mrHggHWa.js → Devices-Bq4yRli5.js} +1 -1
  18. package/dist/assets/{EmbedPlayerPage-HIM7BXTf.js → EmbedPlayerPage-DlIQigBi.js} +1 -1
  19. package/dist/assets/{History-9T3cw528.js → History-DTt-NAMR.js} +1 -1
  20. package/dist/assets/{Identity-vSPkTQS9.js → Identity-C3GHYP7_.js} +1 -1
  21. package/dist/assets/IntegrationDetail-EOwq3jVG.js +1 -0
  22. package/dist/assets/{IntegrationHub-BLWPwX2F.js → IntegrationHub-8GCewFBs.js} +1 -1
  23. package/dist/assets/Integrations-BocurtE0.js +1 -0
  24. package/dist/assets/Integrations-Bt3Im7Mh.js +1 -0
  25. package/dist/assets/Library-DTn9Nkjs.js +1 -0
  26. package/dist/assets/Locations-chgnzdWz.js +3 -0
  27. package/dist/assets/{Logs-BNUawZoE.js → Logs-BxTfJ-wk.js} +1 -1
  28. package/dist/assets/{MaskShapeCanvas-BxH91O-B.js → MaskShapeCanvas-DBEbXuH2.js} +1 -1
  29. package/dist/assets/{MotionZonesSettings-DZKfaecb.js → MotionZonesSettings-D3Xxjf5N.js} +1 -1
  30. package/dist/assets/{MyAccess-BxcRYFsj.js → MyAccess-BTEJNJtS.js} +1 -1
  31. package/dist/assets/Network-plYS78UN.js +1 -0
  32. package/dist/assets/{NodeAddonsSettingsPanel-BcI9AigA.js → NodeAddonsSettingsPanel-Do_I93Mx.js} +1 -1
  33. package/dist/assets/Notifications-mslnotOB.js +1 -0
  34. package/dist/assets/Pipeline-Cjj8XOuS.js +1 -0
  35. package/dist/assets/{PrivacyMaskSettings-C1-GOEuN.js → PrivacyMaskSettings-CswE6pks.js} +1 -1
  36. package/dist/assets/{Recordings-BPIJtEGz.js → Recordings-BpB53ln_.js} +1 -1
  37. package/dist/assets/{RemoteGrid-BZbW8PeH.js → RemoteGrid-BjtzHkpg.js} +1 -1
  38. package/dist/assets/{ScanNetworkModal-BQ5OlzZX.js → ScanNetworkModal-BR3tzZcL.js} +1 -1
  39. package/dist/assets/{SceneMonitorEditor-C71RV5fL.js → SceneMonitorEditor-C2X6jZvS.js} +1 -1
  40. package/dist/assets/SessionsList-BOjlUhj5.js +2 -0
  41. package/dist/assets/{Showroom-Pcaz2yKE.js → Showroom-CHwcC6p6.js} +1 -1
  42. package/dist/assets/System-CiZ0xcyP.js +1 -0
  43. package/dist/assets/{Templates-ABoqOu9o.js → Templates-tilFwunF.js} +1 -1
  44. package/dist/assets/{Terminal-uL0eTf8i.js → Terminal-DiMnsE8i.js} +2 -2
  45. package/dist/assets/{Viewer-BzqHL8lA.js → Viewer-BwirleAM.js} +1 -1
  46. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-Dbqn5c5X.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-w6FCrjgB.js} +1 -1
  47. package/dist/assets/{addon-icons-context-CzyObK2t.js → addon-icons-context-CHk3ePjj.js} +1 -1
  48. package/dist/assets/{archive-CDziWnvV.js → archive-BU_eXxQC.js} +1 -1
  49. package/dist/assets/{assignment-candidates-a6kHcvux.js → assignment-candidates-B4bOK7k8.js} +1 -1
  50. package/dist/assets/{authed-media-BcO83va1.js → authed-media-BYuQnqbF.js} +1 -1
  51. package/dist/assets/{bell-off-O7zrX-Mc.js → bell-off-DCQedZIx.js} +1 -1
  52. package/dist/assets/{board-model-sARab1AV.js → board-model-t0EX_kXW.js} +1 -1
  53. package/dist/assets/{boxes-svitF8K8.js → boxes-BZMO9uMf.js} +1 -1
  54. package/dist/assets/circle-slash-DFl97Cbx.js +1 -0
  55. package/dist/assets/client-F3l12jEi.js +674 -0
  56. package/dist/assets/{cloud-upload-B_uHg9Qk.js → cloud-upload-CApwQ18P.js} +1 -1
  57. package/dist/assets/crop-gfwPOF8e.js +1 -0
  58. package/dist/assets/{device-integration-icon-Bi5qhaK0.js → device-integration-icon-CXG5v8dp.js} +1 -1
  59. package/dist/assets/device-picker-model-Fpx4y0MY.js +1 -0
  60. package/dist/assets/dist-B2m_6_7g.js +674 -0
  61. package/dist/assets/{dist-C5kry-nn.js → dist-Hz1nnJDv.js} +1 -1
  62. package/dist/assets/{file-up-BnEcmi9q.js → file-up-cso0QIDs.js} +1 -1
  63. package/dist/assets/{format-DGQA45Ye.js → format-Csy9sDox.js} +1 -1
  64. package/dist/assets/{grip-vertical-DcUn4qSJ.js → grip-vertical-DqjjXK1h.js} +1 -1
  65. package/dist/assets/{hard-drive-download-CkT0au9p.js → hard-drive-download-D-ykdsm5.js} +1 -1
  66. package/dist/assets/{hostInit-Dc7Z_glr.js → hostInit-CTFssGi8.js} +1 -1
  67. package/dist/assets/i18n-BH0PY6IL.js +1 -0
  68. package/dist/assets/icons-B9uR9qKs.js +1 -0
  69. package/dist/assets/index-CQ7TjSgs.js +4 -0
  70. package/dist/assets/{key-vQtBGf1l.js → key-C_dbeH7F.js} +1 -1
  71. package/dist/assets/{key-round-CFwVAamk.js → key-round-CPg0Y5qN.js} +1 -1
  72. package/dist/assets/{layers-C-B3EC65.js → layers-Cb-ro1vb.js} +1 -1
  73. package/dist/assets/{linked-devices-model-DUYPy_9l.js → linked-devices-model-ZCUJsj_d.js} +1 -1
  74. package/dist/assets/{list-ordered-C_tb_5Gb.js → list-ordered-V6P5uujF.js} +1 -1
  75. package/dist/assets/{location-owned-usage-caVqSKq8.js → location-owned-usage-C6DcC3IT.js} +1 -1
  76. package/dist/assets/{log-in-D1R8-3xg.js → log-in-Cxvw8rxc.js} +1 -1
  77. package/dist/assets/{memory-stick-DTKZNNzT.js → memory-stick-Mm_iVwSZ.js} +1 -1
  78. package/dist/assets/{message-square-plus-_8_Z4yYf.js → message-square-plus-Bfam15lf.js} +1 -1
  79. package/dist/assets/{mf-entry-bootstrap-0-c9e86d7a.js → mf-entry-bootstrap-0-019f9c14.js} +2 -2
  80. package/dist/assets/{mic-off-S8b79RhQ.js → mic-off-CeSZf8K2.js} +1 -1
  81. package/dist/assets/{monitor-off-DktfIub5.js → monitor-off-U-RK64kw.js} +1 -1
  82. package/dist/assets/{monitor-smartphone-DiJ0euAC.js → monitor-smartphone-DezRerVw.js} +1 -1
  83. package/dist/assets/mount-Fpx4y0MY.js +1 -0
  84. package/dist/assets/{player-overlays-DyWZd37T.js → player-overlays-DgedyCX9.js} +1 -1
  85. package/dist/assets/{recycle-uEKrRpl_.js → recycle-Dkb1d-SV.js} +1 -1
  86. package/dist/assets/remoteEntry-DpkkaSO3.js +1 -0
  87. package/dist/assets/{ruler-Cf92fzAd.js → ruler-DzpBI-EP.js} +1 -1
  88. package/dist/assets/{scan-eye-_8TdtNzb.js → scan-eye-BmLTXsIf.js} +1 -1
  89. package/dist/assets/{scissors-B9AK1nLy.js → scissors-lBRCylhQ.js} +1 -1
  90. package/dist/assets/{search-x-CVEVpLBV.js → search-x-BRhrXpKx.js} +1 -1
  91. package/dist/assets/{send-CBO9g-_U.js → send-DVJoNc0-.js} +1 -1
  92. package/dist/assets/{settings-2-BSjF3kN4.js → settings-2-D6sp_FTm.js} +1 -1
  93. package/dist/assets/{shapes-BsX-8xUL.js → shapes-CQn3wvpk.js} +1 -1
  94. package/dist/assets/{sigma-veVH6AL2.js → sigma-CKK8bLRa.js} +1 -1
  95. package/dist/assets/speaker-BYorOPbN.js +1 -0
  96. package/dist/assets/src-B0EA_4Ed.js +67 -0
  97. package/dist/assets/{step-inspector-model-BW-W62sj.js → step-inspector-model-DEfajBM3.js} +1 -1
  98. package/dist/assets/{table-2-DfmXeNvT.js → table-2-BPB4V5Fg.js} +1 -1
  99. package/dist/assets/{timer-reset-D9i5HPty.js → timer-reset-Cu_VSXbl.js} +1 -1
  100. package/dist/assets/{unlink-Dsy3yrQn.js → unlink-BcrHT0zX.js} +1 -1
  101. package/dist/assets/{usb-taNjM8Y4.js → usb-DhXPqJtn.js} +1 -1
  102. package/dist/assets/{use-device-bound-caps-Dy9z5ssE.js → use-device-bound-caps-K47AcsQ5.js} +1 -1
  103. package/dist/assets/{use-scenes-feed-BMJYnt2p.js → use-scenes-feed-DQrMGL5E.js} +1 -1
  104. package/dist/assets/{use-stationary-objects-DKZYbXwz.js → use-stationary-objects-yu-O0RPa.js} +1 -1
  105. package/dist/assets/useEventInvalidation-Fpx4y0MY.js +1 -0
  106. package/dist/assets/{useNodeUrlSelection-BbrmxDID.js → useNodeUrlSelection-BuraZwll.js} +1 -1
  107. package/dist/assets/user-round-D6wDvac9.js +1 -0
  108. package/dist/assets/{user-x-LhbJK13A.js → user-x-DRSOzwTr.js} +1 -1
  109. package/dist/assets/{variable-BnqMYwWo.js → variable-cv0ONmJ-.js} +1 -1
  110. package/dist/assets/{video-BiqduAcp.js → video-5IaJhdjU.js} +1 -1
  111. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-_PsSzHuE.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-BtgDin-X.js} +2 -2
  112. package/dist/index.html +9 -9
  113. package/dist/server/addon.js +27 -8
  114. package/package.json +1 -1
  115. package/dist/assets/Addons-D5S6sTN7.js +0 -5
  116. package/dist/assets/AiProfiles-BJhboAC6.js +0 -3
  117. package/dist/assets/BrokerEditorDialog-DsKGCg9y.js +0 -1
  118. package/dist/assets/Build-5sZQPjWb.js +0 -40
  119. package/dist/assets/DeviceDetail-8sreVV-i.js +0 -2
  120. package/dist/assets/IntegrationDetail-DwipvGcz.js +0 -1
  121. package/dist/assets/Integrations-9y5oqDxP.js +0 -1
  122. package/dist/assets/Integrations-ZJ4_tnkn.js +0 -1
  123. package/dist/assets/Library-Cdfp5QPG.js +0 -1
  124. package/dist/assets/Locations-BNiiWGXW.js +0 -3
  125. package/dist/assets/Network-7hIzFAXX.js +0 -1
  126. package/dist/assets/Notifications-dUvsPqSL.js +0 -1
  127. package/dist/assets/Pipeline-Bu7x636X.js +0 -1
  128. package/dist/assets/SessionsList-BF7BLjjI.js +0 -2
  129. package/dist/assets/System-BVsN5xi0.js +0 -1
  130. package/dist/assets/circle-slash-CORBdt2Z.js +0 -1
  131. package/dist/assets/client-DdGu3rlb.js +0 -674
  132. package/dist/assets/crop-AXhcNsdd.js +0 -1
  133. package/dist/assets/device-picker-model-DhYiPHjb.js +0 -1
  134. package/dist/assets/dist-CE4Thp2G.js +0 -674
  135. package/dist/assets/i18n-C-H4BlYV.js +0 -1
  136. package/dist/assets/icons-C7_2EHkF.js +0 -1
  137. package/dist/assets/index-CyYfrxyQ.js +0 -4
  138. package/dist/assets/mount-DhYiPHjb.js +0 -1
  139. package/dist/assets/remoteEntry-C0WZ_Eg2.js +0 -1
  140. package/dist/assets/speaker-JfimpXfG.js +0 -1
  141. package/dist/assets/src-DF4f-P3R.js +0 -67
  142. package/dist/assets/useEventInvalidation-DhYiPHjb.js +0 -1
  143. package/dist/assets/user-round-BioYT2Ju.js +0 -1
@@ -10583,7 +10583,7 @@ object({
10583
10583
  params: record(string(), union([string(), number()])).optional()
10584
10584
  });
10585
10585
  //#endregion
10586
- //#region ../types/dist/err-msg-DWXWc0Di.mjs
10586
+ //#region ../types/dist/err-msg-BD5buxvT.mjs
10587
10587
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
10588
10588
  DeviceType["Camera"] = "camera";
10589
10589
  DeviceType["Hub"] = "hub";
@@ -10689,6 +10689,12 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
10689
10689
  DeviceType["Washer"] = "washer";
10690
10690
  /** Tumble dryer. Same plug-built running surface as {@link Washer}. */
10691
10691
  DeviceType["Dryer"] = "dryer";
10692
+ /** The physical bridge box of a vendor ecosystem (Velux KLF-200, and later
10693
+ * other radio-to-IP bridges). It carries the box's own facts (firmware,
10694
+ * address, connection state) and the actions the box really supports
10695
+ * (`reboot`, `device-admin-link`). Products are NOT its children — they are
10696
+ * adopted beside it — and its connection settings stay on the integration. */
10697
+ DeviceType["Gateway"] = "gateway";
10692
10698
  return DeviceType;
10693
10699
  }({});
10694
10700
  var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
@@ -10939,7 +10945,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
10939
10945
  return DeviceRole;
10940
10946
  }({});
10941
10947
  //#endregion
10942
- //#region ../types/dist/composition-kSuOifuG.mjs
10948
+ //#region ../types/dist/composition-C7WdThmP.mjs
10943
10949
  /**
10944
10950
  * The ffmpeg build every CamStack node downloads, per platform and arch.
10945
10951
  *
@@ -18496,8 +18502,21 @@ var BrokerProviderInfoSchema = object({
18496
18502
  * (`{ sessionId }`) drops the session. The dialog that edits a broker
18497
18503
  * offers it as the default path; the fields the session fills are
18498
18504
  * marked `filledBySignIn` in the kind's settings schema.
18505
+ *
18506
+ * `methods` lists the ways the session can sign in, recommended first:
18507
+ * `'device-code'` adds `POST {basePath}/code/start` (body: the form's
18508
+ * settings) answering `{ sessionId, userCode, verificationUrl,
18509
+ * expiresAt }` — the operator types `userCode` at `verificationUrl` on
18510
+ * any device, and the same `status` / `commit` / `cancel` routes follow
18511
+ * (status then carries `method`, `userCode`, `verificationUrl`,
18512
+ * `expiresAt` and the phases `'awaiting-code'` / `'expired'`);
18513
+ * `'proxy'` is the `{basePath}/start` flow above. Absent means
18514
+ * `['proxy']`.
18499
18515
  */
18500
- signIn: object({ basePath: string().min(1) }).optional()
18516
+ signIn: object({
18517
+ basePath: string().min(1),
18518
+ methods: array(_enum(["device-code", "proxy"])).optional()
18519
+ }).optional()
18501
18520
  }))
18502
18521
  });
18503
18522
  var ListInputSchema = object({
@@ -63749,7 +63768,7 @@ object({
63749
63768
  });
63750
63769
  Object.values(DeviceType);
63751
63770
  DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.PetFeeder;
63752
- DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
63771
+ DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, DeviceType.Gateway, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
63753
63772
  kind: "mutation",
63754
63773
  auth: "admin"
63755
63774
  });
@@ -67607,7 +67626,7 @@ discriminatedUnion("kind", [object({
67607
67626
  })]);
67608
67627
  DeviceFeature.FanSpeed, DeviceFeature.FanPreset, DeviceFeature.FanDirection, DeviceFeature.FanOscillating, DeviceFeature.CoverPositionable, DeviceFeature.CoverTilt, DeviceFeature.ValvePositionable, DeviceFeature.MediaPlayerVolume, DeviceFeature.ClimateFanMode;
67609
67628
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
67610
- DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat, DeviceType.EventEmitter, DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Camera, DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.PetFeeder;
67629
+ DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat, DeviceType.EventEmitter, DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Gateway, DeviceType.Camera, DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.PetFeeder;
67611
67630
  String.raw`rose\(active(\d+), changed(\d+), (\d+(?:\.\d+)?)\)`;
67612
67631
  DeviceRole.BinarySensor, DeviceRole.MotionSensor;
67613
67632
  new Set(CAP_NAMES);
@@ -67660,7 +67679,7 @@ var AccessoryKind = {
67660
67679
  PrivacyMask: DeviceRole.PrivacyMask
67661
67680
  };
67662
67681
  AccessoryKind.Siren, AccessoryKind.Floodlight, AccessoryKind.Spotlight, AccessoryKind.PirSensor, AccessoryKind.Chime, AccessoryKind.Autotrack, AccessoryKind.Nightvision, AccessoryKind.PrivacyMask;
67663
- DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Camera, DeviceType.Hub, DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer;
67682
+ DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Camera, DeviceType.Hub, DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Gateway;
67664
67683
  new Set(Object.values(DeviceType));
67665
67684
  Object.freeze({
67666
67685
  "accessories.getStatus": {
@@ -81717,7 +81736,7 @@ function projectAction(cap, action) {
81717
81736
  };
81718
81737
  }
81719
81738
  Object.entries(CAP_VOCABULARY_BY_NAME).flatMap(([cap, entry]) => entry.scope === "device" ? (entry.actions ?? []).map((a) => projectAction(cap, a)) : []);
81720
- DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer;
81739
+ DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Gateway;
81721
81740
  DeviceFeature.BatteryOperated;
81722
81741
  DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher;
81723
81742
  var HA_AS = "a power sensor (device_class power). Home Assistant has no laundry domain. running-state stays unexported until a null reading can be published as unavailable.";
@@ -85974,7 +85993,7 @@ var AdminUIAddon = class extends BaseAddon {
85974
85993
  capability: adminUiCapability,
85975
85994
  provider: {
85976
85995
  getStaticDir: async () => ({ staticDir: resolveAdminUiDistDir() }),
85977
- getVersion: async () => ({ version: "1.2.525" })
85996
+ getVersion: async () => ({ version: "1.2.526" })
85978
85997
  }
85979
85998
  }];
85980
85999
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-admin-ui",
3
- "version": "1.2.525",
3
+ "version": "1.2.526",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Admin UI — Vite frontend build and server-side addon",
@@ -1,5 +0,0 @@
1
- import{B as e,C as t,J as n,K as r,R as i,S as a,V as o,Y as s,et as c,o as l,x as u}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{En as d,Ht as f,Oi as p,Pt as m,Q as h,Ti as g,Wn as _,Zr as v,bi as y,fi as b,fr as x,gn as S,gt as C,jn as w,ki as T,ot as E,sn as D,st as O,vn as ee,yn as te,zt as ne}from"./player-overlays-DyWZd37T.js";import{Go as k}from"./client-DdGu3rlb.js";import{i as A,u as re}from"./video-BiqduAcp.js";import{$i as ie,Ad as ae,Bi as j,Cr as oe,Ct as M,Fd as se,Fi as N,Gi as P,Hi as F,Ii as I,Ji as ce,Jn as L,Ki as le,Kn as R,Li as ue,Mt as de,Ni as z,Qi as B,Ri as fe,Tc as V,Tr as pe,Vi as me,Wi as H,Xi as he,Yn as U,Zi as W,br as ge,cn as _e,di as ve,if as G,na as ye,qi as be,qn as xe,ra as Se,ri as K,sn as Ce,ta as we,tf as Te,wr as Ee,xr as De,yr as Oe,zi as q}from"./src-DF4f-P3R.js";import{t as J}from"./useTranslation-BJr-n0es.js";import"./mount-DhYiPHjb.js";import{_r as Y,pr as X,yr as ke}from"./index-CyYfrxyQ.js";import{t as Ae}from"./AdminPage-BVK_kyJp.js";import{t as je}from"./NodeAddonsSettingsPanel-BcI9AigA.js";import{t as Me}from"./framework-packages-B7oma9J4.js";import{n as Z,t as Ne}from"./useNodeUrlSelection-BbrmxDID.js";function Pe(e){if(e===void 0)return null;switch(e.state){case`failed`:case`refused`:case`missing`:case`crashed`:return{kind:e.state,...e.reason===void 0?{}:{reason:e.reason}};default:return null}}c();var Fe={queued:{icon:b,bg:`bg-muted text-foreground-subtle`,labelKey:`addons.addonRowBadge.queued`},updating:{icon:x,bg:`bg-primary/10 text-primary`,labelKey:`addons.addonRowBadge.updating`,spin:!0},"done-pending-restart":{icon:d,bg:`bg-amber-500/10 text-amber-700`,labelKey:`addons.addonRowBadge.pendingRestart`},done:{icon:T,bg:`bg-success/10 text-success`,labelKey:`addons.addonRowBadge.done`},failed:{icon:A,bg:`bg-danger/10 text-danger`,labelKey:`addons.addonRowBadge.failed`}};function Ie({item:e}){let{t:n}=J(),r=Fe[e.status],i=r.icon;return t(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded ${r.bg}`,title:e.error,children:[a(i,{className:`w-2.5 h-2.5 ${r.spin?`animate-spin`:``}`}),n(r.labelKey)]})}var Le=new Set([`completed`,`failed`,`partially-failed`,`cancelled`]),Q=new Set([`done`,`failed`,`skipped`]);function Re(e){return!Q.has(e.phase)&&!Le.has(e.jobState)}function ze(e,t){let n=new Map,r=[...e].sort((e,t)=>e.createdAtMs-t.createdAtMs);for(let e of r){let r=Le.has(e.state);for(let i of e.tasks)r&&i.finishedAtMs!==null&&t-i.finishedAtMs>6e4||n.set(i.packageName,{jobId:e.jobId,packageName:i.packageName,phase:i.phase,fromVersion:i.fromVersion,toVersion:i.toVersion,error:i.error,jobState:e.state,finishedAtMs:i.finishedAtMs})}return n}function Be(){let{data:e}=P({activeOnly:!0},{refetchOnWindowFocus:!1,refetchInterval:e=>(e.state.data?.length??0)>0?3e3:!1}),{map:t}=G(k.AddonsJobProgress,e=>e.job.jobId);return r(()=>{let n=new Map;for(let t of e??[])n.set(t.jobId,t);for(let[e,r]of t)n.set(e,r.job);return ze([...n.values()],Date.now())},[e,t])}var Ve={queued:{icon:b,cls:`bg-muted text-foreground-subtle`,labelKey:`addons.jobProgress.queued`},fetching:{icon:x,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.fetching`,spin:!0},staged:{icon:x,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.staged`,spin:!0},validating:{icon:x,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.validating`,spin:!0},applying:{icon:x,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.applying`,spin:!0},restarting:{icon:x,cls:`bg-amber-500/10 text-amber-600 dark:text-amber-400`,labelKey:`addons.jobProgress.restarting`,spin:!0},applied:{icon:x,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.finalizing`,spin:!0},done:{icon:T,cls:`bg-success/10 text-success`,labelKey:`addons.jobProgress.updated`},failed:{icon:A,cls:`bg-danger/10 text-danger`,labelKey:`addons.jobProgress.failed`},skipped:{icon:D,cls:`bg-muted text-foreground-subtle`,labelKey:`addons.jobProgress.skipped`}};function He({progress:e}){let{t:n}=J(),r=Ve[e.phase],i=r.icon,o=e.error??`${e.packageName}: ${e.fromVersion??`?`} → ${e.toVersion}`;return t(`span`,{"data-testid":`addon-job-progress`,className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded shrink-0 ${r.cls}`,title:o,children:[a(i,{className:`w-2.5 h-2.5 ${r.spin?`animate-spin`:``}`}),n(r.labelKey),t(`span`,{className:`font-mono`,children:[`→ `,e.toVersion]})]})}function Ue(e,t){return e.filter(e=>e.packageName===t).slice().sort((e,t)=>e.isHub===t.isHub?e.nodeName.localeCompare(t.nodeName):e.isHub?-1:1)}function We(e){let t=e.version===null?``:` ${e.version}`,n=e.isOnline?``:` (offline: removed when it reconnects)`;return`- ${e.nodeName}${t}${n}`}function Ge(e,t,n){let r=[`${e} will be uninstalled from ${t.length} node(s). Its runners stop, its capabilities are deregistered and its code is deleted:`,...t.map(We)];return n.length>0&&r.push(`Could not ask: ${n.join(`, `)} — not included.`),r.push(`This cannot be undone.`),r.join(`
2
- `)}function Ke(e,t,n){let r=[`${e} will be uninstalled from ${t}: its runners stop and its code is deleted.`];return n.length>0&&r.push(`It stays installed on: ${n.map(e=>e.nodeName).join(`, `)}. Use "Everywhere" to remove it from every node.`),r.push(`This cannot be undone.`),r.join(`
3
- `)}var qe={uninstalled:`uninstalled`,"not-installed":`was not installed`,refused:`REFUSED`,failed:`FAILED`,"pending-reconnect":`offline — removed when it reconnects`};function Je(e,t){let n=[];for(let r of e.results){let e=r.runnersStopped.length>0?` (stopped ${r.runnersStopped.join(`, `)})`:``;n.push(`${t(r.nodeId)}: ${qe[r.outcome]}${e}`),r.error!==void 0&&n.push(` ${r.error}`);for(let e of r.warnings)n.push(` ${e}`)}return n.join(`
4
- `)}var Ye={},Xe=3e4,Ze=`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border border-border text-foreground-subtle hover:text-red-400 hover:border-red-500/30 hover:bg-red-500/10 disabled:opacity-50 transition-colors`;function Qe({packageName:e,displayName:n,selectedNode:r,hideNodeAction:i,disabled:o}){let{t:s}=J(),c=l(),u=O(),d=E(),p=H(Ye,{staleTime:Xe}),m=p.data?.installations??[],h=(p.data?.unreachable??[]).map(e=>e.nodeId),g=Ue(m,e),_=e=>g.find(t=>t.nodeId===e)?.nodeName??(e===r.id?r.name:e),v=ye({onSettled:()=>{c.invalidateQueries({queryKey:[[`addons`]]}),c.invalidateQueries({queryKey:[[`addonPages`]]}),c.invalidateQueries({queryKey:[[`capabilities`]]}),c.invalidateQueries({queryKey:[[`nodes`]]})}}),y=async e=>{await d({title:e.success?s(`addons.addonUninstallControls.uninstalled`,`{{displayName}} uninstalled`,{displayName:n}):s(`addons.addonUninstallControls.notEveryNodeWasCleaned`,`{{displayName}}: not every node was cleaned`,{displayName:n}),message:Je(e,_),variant:e.success?`default`:`danger`})},b=async t=>{try{await y(await v.mutateAsync({packageName:e,...t}))}catch(e){await d({title:s(`addons.addonUninstallControls.uninstallFailed`,`Uninstall {{displayName}} failed`,{displayName:n}),message:e instanceof Error?e.message:String(e),variant:`danger`})}},x=async()=>{let e=g.filter(e=>e.nodeId!==r.id);await u({title:s(`addons.addonUninstallControls.uninstallFrom`,`Uninstall {{displayName}} from {{name}}?`,{displayName:n,name:r.name}),message:Ke(n,r.name,e),confirmLabel:s(`addons.addonUninstallControls.uninstall`,`Uninstall`),variant:`danger`})&&await b(r.isHub?{}:{nodeId:r.id})},S=async()=>{let t=(await p.refetch()).data;if(t===void 0){await d({title:s(`addons.addonUninstallControls.cannotListTheNodes`,`Cannot list the nodes`),message:s(`addons.addonUninstallControls.theHubDidNotAnswer`,`The hub did not answer which nodes have this package — nothing was removed.`),variant:`danger`});return}let r=Ue(t.installations,e);await u({title:s(`addons.addonUninstallControls.uninstallEverywhere`,`Uninstall {{displayName}} everywhere?`,{displayName:n}),message:Ge(n,r,t.unreachable.map(e=>e.nodeId)),confirmLabel:s(`addons.addonUninstallControls.uninstallFromNodeS`,`Uninstall from {{length}} node(s)`,{length:r.length}),variant:`danger`})&&await b({everywhere:!0})},C=v.isPending||o===!0;return t(`div`,{className:`flex items-center gap-1.5`,children:[i!==!0&&t(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),x()},disabled:C,className:Ze,title:s(`addons.addonUninstallControls.uninstallFrom2`,`Uninstall from {{name}}`,{name:r.name}),children:[a(f,{className:`h-3 w-3`}),v.isPending?s(`addons.addonUninstallControls.removing`,`Removing...`):s(`addons.addonUninstallControls.uninstall`,`Uninstall`)]}),(g.length>1||i===!0||h.length>0)&&t(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),S()},disabled:C,className:Ze,title:s(`addons.addonUninstallControls.uninstallFromEveryNodeThat`,`Uninstall from every node that has it`),children:[a(re,{className:`h-3 w-3`}),g.length>0?s(`addons.uninstallControls.everywhereCount`,{count:g.length}):s(`addons.uninstallControls.everywhere`)]})]})}function $e(e){return typeof e.deprecated==`string`&&e.deprecated.length>0}function et(e,t){return t?e:e.filter(e=>e.distTags.includes(`latest`)||!$e(e))}function tt(e){return e.length-et(e,!1).length}c();function nt({packageName:e,currentVersion:n,installSource:r,onInstall:i,onClose:o,onSelect:c,selectedVersion:l}){let{t:d}=J(),f=r===`upload`||r===`local`,[p,h]=s(!1),{data:g,isLoading:_,isError:y}=j({name:e}),b=g?et(g,p):[],S=g?tt(g):0;return t(`div`,{className:`fixed z-50 w-72 rounded-lg border border-border bg-surface shadow-xl overflow-hidden`,style:{top:`auto`,bottom:`auto`},ref:e=>{if(!e)return;let t=e.parentElement?.getBoundingClientRect();if(!t)return;let n=window.innerHeight-t.bottom,r=t.top;n<280&&r>n?(e.style.bottom=`${window.innerHeight-t.top+4}px`,e.style.top=`auto`):(e.style.top=`${t.bottom+4}px`,e.style.bottom=`auto`),e.style.right=`${window.innerWidth-t.right}px`},onClick:e=>e.stopPropagation(),children:[t(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border`,children:[a(`span`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle font-medium`,children:d(`addons.versionPicker.versions`,`Versions`)}),a(`button`,{type:`button`,onClick:o,className:`text-foreground-subtle hover:text-foreground`,children:a(C,{className:`h-3 w-3`})})]}),f&&t(`div`,{className:`flex items-start gap-2 px-3 py-2 border-b border-border bg-cyan-500/10 text-[10px]`,children:[a(m,{className:`h-3 w-3 mt-0.5 text-cyan-500 shrink-0`}),t(`div`,{className:`text-cyan-700 dark:text-cyan-200`,children:[a(`span`,{className:`font-semibold`,children:d(`addons.versionPicker.inPlace`,{kind:r===`upload`?d(`addons.versionPicker.uploadedCopy`,`Uploaded copy`):d(`addons.versionPicker.localCopy`,`Local copy`)})}),` `,a(X,{i18nKey:`addons.versionPicker.reinstall`,values:{version:n},components:{mono:a(`span`,{className:`font-mono`})}})]})]}),_&&t(`div`,{className:`flex items-center justify-center gap-2 py-6 text-[10px] text-foreground-subtle`,children:[a(x,{className:`h-3.5 w-3.5 animate-spin`}),d(`addons.versionPicker.loadingVersions`,`Loading versions...`)]}),y&&a(`div`,{className:`px-3 py-4 text-center text-[10px] text-danger`,children:d(`addons.versionPicker.registryError`,`Could not load versions from the registry.`)}),b.length>0&&a(`div`,{className:`max-h-64 overflow-auto divide-y divide-border`,children:b.map(e=>{let r=e.version===n,o=c!==void 0&&e.version===l,s=/-(alpha|beta|rc|dev|canary|next)/i.test(e.version),f=t(u,{children:[a(`span`,{className:`font-mono flex-1 text-left ${r?`text-primary font-semibold`:s?`text-amber-400`:`text-foreground`}`,children:e.version}),r&&a(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium bg-primary/10 text-primary`,children:d(`common.current`)}),e.distTags.map(e=>a(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium ${e===`latest`?`bg-emerald-500/15 text-emerald-400`:e===`beta`?`bg-amber-500/15 text-amber-400`:`bg-gray-500/15 text-gray-400`}`,children:e},e)),$e(e)&&a(`span`,{className:`text-[9px] text-red-400 line-through`,children:d(`common.deprecated`)}),a(`span`,{className:`text-[9px] text-foreground-subtle shrink-0`,children:new Date(e.publishedAt).toLocaleDateString()})]});return c?t(`button`,{type:`button`,"aria-label":d(`addons.versionPicker.select`,`Select {{version}}`,{version:e.version}),onClick:()=>c(e.version),className:`w-full flex items-center gap-2 px-3 py-2 text-[11px] ${o?`bg-primary/5`:`hover:bg-surface-hover`} transition-colors`,children:[f,o?a(T,{className:`h-3 w-3 text-primary shrink-0`}):a(`span`,{className:`w-3 shrink-0`})]},e.version):t(`div`,{className:`flex items-center gap-2 px-3 py-2 text-[11px] ${r?`bg-primary/5`:`hover:bg-surface-hover`} transition-colors`,children:[f,a(`button`,{type:`button`,onClick:()=>i(e.version),className:`shrink-0 rounded p-0.5 hover:bg-primary/20 text-foreground-subtle hover:text-primary transition-colors`,title:r?d(`addons.versionPicker.reInstallFromNpm`,`Re-install {{version}} from npm`,{version:e.version}):d(`addons.versionPicker.install`,`Install {{version}}`,{version:e.version}),children:a(v,{className:`h-3 w-3`})})]},e.version)})}),!_&&!y&&g&&g.length===0&&a(`div`,{className:`py-4 text-center text-[10px] text-foreground-subtle`,children:d(`addons.versionPicker.noVersionsFound`,`No versions found`)}),S>0&&a(K,{type:`button`,variant:`ghost`,size:`sm`,className:`h-auto w-full justify-start rounded-none border-t border-border px-3 py-2 text-left text-[10px] font-normal text-foreground-subtle`,onClick:()=>h(e=>!e),children:p?d(`addons.versionPicker.hideOlder`,`Hide older versions`):d(`addons.versionPicker.showOlder`,`Show older versions ({{count}})`,{count:S})})]})}c();var rt=`device-export`;function it(e){return e.capabilities.some(e=>(typeof e==`string`?e:e.name)===rt)}function at(e){return e!==`local`&&e!==`upload`}function ot({isBundle:e,installSource:n,addonId:r,iconPath:i,color:o}){let[c,l]=s(!1),u=o?{backgroundColor:`${o.startsWith(`#`)?o:`#${o}`}26`}:void 0,d=e?`bg-indigo-500/20 text-indigo-700 dark:text-indigo-300`:`bg-purple-500/20 text-purple-700 dark:text-purple-300`,f=r&&i?h(`/api/addon-assets/${r}/${i}`):null,p=!!f&&!c;return t(`div`,{className:`relative flex-shrink-0`,children:[a(`div`,{className:`h-8 w-8 rounded-md flex items-center justify-center ${u?``:d}`,style:u,children:p?a(`img`,{src:f,alt:r,className:`h-4 w-4`,onError:()=>l(!0)}):a(e?_:w,{className:`h-3.5 w-3.5`})}),n===`local`&&a(`span`,{className:`absolute -top-1.5 -left-1.5 text-[7px] font-bold leading-none bg-orange-500 text-white px-1 py-0.5 rounded -rotate-12 shadow-sm`,children:`DEV`}),at(n)&&a(`span`,{className:`absolute -top-1 -left-1 w-4 h-4 rounded bg-[#cb3837] flex items-center justify-center -rotate-12 shadow-sm`,children:a(`svg`,{viewBox:`0 0 780 250`,className:`w-[11px] h-[11px]`,children:a(`path`,{fill:`#fff`,d:`M240 250h100V50h100v200h340V0H0v250z`})})}),n===`upload`&&a(`span`,{className:`absolute -top-1.5 -left-1.5 flex items-center justify-center h-4 w-4 rounded bg-cyan-500 -rotate-12 shadow-sm`,children:a(m,{className:`h-2.5 w-2.5 text-white`})})]})}function st({version:e,availableUpdate:n,selectedVersion:r,isUpdating:i,installSource:o,disabled:s,onUpdate:c,onOpenPicker:l,children:u}){let{t:d}=J();if(i)return t(`span`,{className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-medium border border-blue-500/30 bg-blue-500/10 text-blue-400 shrink-0`,children:[a(x,{className:`h-3 w-3 animate-spin`}),d(`addons.addonCard.updating`,`Updating…`)]});if(n){let i=r??n;return t(`div`,{className:`relative inline-flex items-center gap-1 shrink-0`,children:[c&&t(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),c()},disabled:s,className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-semibold border border-blue-500/30 bg-blue-500/10 text-blue-400 hover:bg-blue-500/20 disabled:opacity-50 disabled:cursor-not-allowed transition-colors`,title:d(`addons.addonCard.updateTo`,`Update to {{target}}`,{target:i}),children:[a(v,{className:`h-3 w-3`}),d(`addons.addonCard.update`,`Update`)]}),t(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),l()},disabled:s,"aria-label":d(`addons.addonCard.selectVersionToInstall`,`Select version to install`),title:d(`addons.addonCard.installedUpdateAvailableSelectedTap`,`Installed {{version}} — update available. Selected {{target}}; tap to choose another version.`,{version:e,target:i}),className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-bold font-mono border border-amber-500/40 bg-amber-500/15 text-amber-500 hover:bg-amber-500/25 animate-pulse disabled:opacity-50 disabled:cursor-not-allowed transition-colors`,children:[a(`span`,{className:`font-normal opacity-70`,children:e}),a(`span`,{className:`font-normal opacity-70`,children:`→`}),i,a(p,{className:`h-3 w-3`})]}),u]})}return t(`div`,{className:`relative inline-flex items-center gap-1 shrink-0`,children:[t(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),l()},disabled:s,className:[`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-bold font-mono border transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,o===`local`?`border-orange-500/30 bg-orange-500/10 text-orange-400 hover:bg-orange-500/20`:`border-emerald-500/30 bg-emerald-500/10 text-emerald-400 hover:bg-emerald-500/20`].join(` `),title:d(`addons.addonCard.versionTapToViewAll`,`Version {{version}} — tap to view all versions`,{version:e}),children:[e,a(p,{className:`h-3 w-3 opacity-50`})]}),u]})}function ct({addonId:e}){let t=l(),{data:n=`inherit`}=I({addonId:e}),r=B({onSuccess:()=>{t.invalidateQueries({queryKey:[[`addons`,`getAddonAutoUpdate`]]})}});return a(`div`,{className:`flex rounded-lg border border-border overflow-hidden text-[10px] font-medium`,children:[`inherit`,`off`,`latest`,`beta`].map(t=>a(`button`,{type:`button`,onClick:n=>{n.stopPropagation(),r.mutate({addonId:e,channel:t})},disabled:r.isPending,className:`px-2.5 py-1 transition-colors capitalize ${n===t?t===`inherit`?`bg-gray-700/50 text-gray-700 dark:text-gray-300`:t===`off`?`bg-gray-700 text-gray-700 dark:text-gray-300`:t===`latest`?`bg-blue-500/20 text-blue-400`:`bg-amber-500/20 text-amber-400`:`bg-transparent text-foreground-subtle hover:bg-surface-hover`} ${t===`inherit`?``:`border-l border-border`}`,children:t},t))})}var lt={id:`hub`,name:`Hub`,isHub:!0};function ut({addon:e,clusterStatus:n,hideVersion:r,availableUpdate:i,onUpdate:c,isUpdating:f,jobProgress:m,bundle:h,bulkItem:v,disabledByBulk:y,isSystem:b,selectedNode:x}){let{t:w}=J(),[T,E]=s(!1),[D,O]=s(!1),[ee,ne]=s(null);o(()=>{ne(null)},[i]);let k=ee??i,[re,ie]=s(!1),[ae,j]=s(!1),[M,se]=s(`logs`),N=l(),P=Y(),{manifest:F}=e,I=!h&&!F.protected&&F.removable!==!1,L=!!h,le=h?.displayName??F.name,R=h?.packageName??F.packageName,ue=h?.version??F.packageVersion??F.version,z=h?.installSource??e.installSource,B=h?h.bundle?.description??h.addons[0]?.manifest.description:F.description,fe=ce({onSuccess:()=>{N.invalidateQueries({queryKey:[[`addons`]]})}}),V=me({onSuccess:()=>{N.invalidateQueries({queryKey:[[`addons`]]}),N.invalidateQueries({queryKey:[[`addonPages`]]}),N.invalidateQueries({queryKey:[[`capabilities`]]}),N.invalidateQueries({queryKey:[[`integrations`]]})}}),H=he({onSuccess:()=>{N.invalidateQueries({queryKey:[[`addons`]]}),N.invalidateQueries({queryKey:[[`alerts`]]})}}),U=e.health,W=U?.phase===`failed`&&!U.inGracePeriod,ve=W&&U?.nextRetryAt&&!U.retrying,G=Pe(e.process);return t(`div`,{className:`rounded-md border bg-surface overflow-hidden ${W?`border-red-500/50`:`border-border`}`,children:[W&&U&&t(`div`,{className:`bg-danger/10 border-b border-danger/30 px-3 py-2 flex items-start gap-2`,children:[a(A,{className:`h-4 w-4 text-danger shrink-0 mt-0.5`}),t(`div`,{className:`flex-1 min-w-0`,children:[a(`div`,{className:`text-xs font-semibold text-danger`,children:w(`addons.addonCard.failedToLoad`,{attempt:U.retryCount})}),a(`div`,{className:`text-[11px] text-foreground mt-0.5 break-words font-mono`,children:U.lastError?.message??w(`addons.addonCard.unknownError`,`Unknown error`)}),ve&&U.nextRetryAt&&a(`div`,{className:`text-[10px] text-foreground-subtle mt-1`,children:w(`addons.addonCard.autoRetryAt`,{time:new Date(U.nextRetryAt).toLocaleTimeString()})})]}),t(`button`,{type:`button`,disabled:H.isPending||U.retrying,onClick:e=>{e.stopPropagation(),H.mutate({packageName:R})},className:`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1 text-[11px] font-semibold border border-red-400/40 bg-red-400/10 text-red-700 dark:text-red-300 hover:bg-red-400/20 disabled:opacity-50 disabled:cursor-not-allowed transition-colors shrink-0`,title:w(`addons.addonCard.resetRetryCounterAndForce`,`Reset retry counter and force immediate reload`),children:[a(d,{className:`h-3 w-3 ${H.isPending||U.retrying?`animate-spin`:``}`}),w(`addons.addonCard.retryNow`,`Retry now`)]})]}),G!==null&&t(`div`,{className:`bg-danger/10 border-b border-danger/30 px-3 py-2 flex items-start gap-2`,children:[a(A,{className:`h-4 w-4 text-danger shrink-0 mt-0.5`}),t(`div`,{className:`flex-1 min-w-0`,children:[a(`div`,{className:`text-xs font-semibold text-danger`,children:w(`addons.addonCard.processProblem.${G.kind}`)}),G.reason!==void 0&&a(`div`,{className:`text-[11px] text-foreground mt-0.5 break-words font-mono`,children:G.reason})]})]}),t(`div`,{className:`flex items-start gap-2.5 px-3 py-2`,children:[a(ot,{isBundle:L||!!F.components&&F.components.length>1,installSource:z,addonId:L?h.addons[0]?.manifest.id:F.id,iconPath:L?h.bundle?.icon??h.addons[0]?.manifest.icon:F.icon,color:L?h.addons[0]?.manifest.color:F.color}),t(`div`,{className:`flex-1 min-w-0`,children:[t(`div`,{className:`flex items-start justify-between gap-2`,children:[a(`span`,{className:`text-xs font-semibold text-foreground truncate min-w-0`,children:le}),!r&&a(st,{version:ue,availableUpdate:i,...k===void 0?{}:{selectedVersion:k},isUpdating:f,installSource:z,disabled:y,...c&&k!==void 0?{onUpdate:()=>c(k)}:{},onOpenPicker:()=>O(e=>!e),children:D&&a(nt,{packageName:R,currentVersion:ue,...z?{installSource:z}:{},...i!==void 0&&k!==void 0?{selectedVersion:k,onSelect:e=>{ne(e),O(!1)}}:{},onInstall:e=>{O(!1),V.mutate({packageName:R,version:e})},onClose:()=>O(!1)})})]}),t(`div`,{className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 mt-0.5`,children:[R!==le&&a(`span`,{className:`text-[10px] text-foreground-subtle font-mono truncate max-w-full`,children:R}),L&&t(`span`,{className:`text-[10px] rounded-full bg-primary/10 text-primary px-2 py-0.5 font-medium shrink-0 inline-flex items-center gap-1`,children:[a(_,{className:`h-3 w-3`}),h.addons.length]}),b&&t(`span`,{className:`text-[10px] rounded-full bg-amber-500/15 text-amber-700 dark:text-amber-300 px-2 py-0.5 font-medium shrink-0 inline-flex items-center gap-1`,title:w(`addons.addonCard.systemPackageUpdatingRestartsThe`,`System package — updating restarts the hub`),children:[a(d,{className:`h-3 w-3`}),w(`addons.addonCard.system`,`System`)]}),v!=null&&a(Ie,{item:v}),m!=null&&a(He,{progress:m})]}),B&&a(`p`,{className:`text-[10px] text-foreground-subtle mt-1 line-clamp-1`,children:B}),!L&&e.process&&t(`div`,{className:`flex flex-wrap items-center gap-1.5 mt-1`,children:[a(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium ${e.process.mode===`forked`?`bg-blue-500/15 text-blue-400`:`bg-gray-500/15 text-gray-400`}`,children:e.process.mode===`forked`?w(`addons.addonCard.forked`):w(`addons.addonCard.inProcess`)}),e.process.pid!=null&&t(`span`,{className:`text-[9px] font-mono text-foreground-subtle`,children:[`PID `,e.process.pid]}),a(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium ${e.process.state===`running`?`bg-emerald-500/15 text-emerald-400`:G===null?`bg-gray-500/15 text-gray-400`:`bg-red-500/15 text-red-400`}`,children:e.process.state})]})]})]}),!L&&t(`div`,{className:`flex items-center gap-1 px-3 py-1 border-t border-border/50 bg-surface-hover/20`,children:[t(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),fe.mutate({addonId:F.id})},disabled:fe.isPending||y,className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-medium border border-border text-foreground-subtle hover:text-blue-400 hover:border-blue-500/30 hover:bg-blue-500/10 disabled:opacity-50 transition-colors`,children:[a(d,{className:`h-3 w-3 ${fe.isPending?`animate-spin`:``}`}),w(`addons.addonCard.restart`,`Restart`)]}),t(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),ie(e=>!e)},className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-medium border transition-colors ${re?`border-primary/30 bg-primary/10 text-primary`:`border-border text-foreground-subtle hover:text-foreground hover:border-primary/30 hover:bg-primary/10`}`,children:[a(te,{className:`h-3 w-3`}),w(`addons.addonCard.logs`,`Logs`)]}),!L&&t(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),j(!0)},className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-medium border transition-colors ${ae?`border-primary/30 bg-primary/10 text-primary`:`border-border text-foreground-subtle hover:text-foreground hover:border-primary/30 hover:bg-primary/10`}`,children:[a(S,{className:`h-3 w-3`}),w(`addons.addonCard.settings`,`Settings`)]}),a(`div`,{className:`flex-1`}),I&&a(Qe,{packageName:F.packageName,displayName:F.name,selectedNode:x??lt,disabled:y})]}),n&&n.nodes.length>1&&!L&&t(`div`,{className:`border-t border-border px-3 py-1.5 bg-muted/10`,children:[a(`div`,{className:`text-[10px] font-medium text-foreground-subtle mb-1.5`,children:w(`addons.addonCard.clusterDeployment`,`Cluster Deployment`)}),a(`div`,{className:`space-y-1`,children:n.nodes.map(e=>t(`div`,{className:`flex items-center gap-2 text-[10px]`,children:[a(`div`,{className:`h-1.5 w-1.5 rounded-full shrink-0 ${e.status===`offline`?`bg-muted-foreground/30`:e.synced?`bg-success`:`bg-amber-500`}`}),a(`span`,{className:`font-medium text-foreground min-w-[60px]`,children:e.name}),a(`span`,{className:`font-mono text-foreground-subtle`,children:e.version}),!e.synced&&e.status!==`offline`&&a(`span`,{className:`text-[9px] px-1 py-0.5 rounded bg-amber-500/10 text-amber-400 border border-amber-500/20`,children:w(`addons.addonCard.outdated`)}),e.status===`offline`&&a(`span`,{className:`text-[9px] px-1 py-0.5 rounded bg-muted text-muted-foreground`,children:w(`common.offline`)}),e.synced&&e.status!==`offline`&&a(`span`,{className:`text-[9px] text-success`,children:w(`common.synced`)})]},e.nodeId))})]}),re&&!L&&t(`div`,{className:`border-t border-border`,children:[t(`div`,{className:`flex items-center px-3 py-0.5 bg-surface-hover/20 border-b border-border/50`,children:[t(`div`,{className:`flex rounded border border-border overflow-hidden text-[9px]`,children:[a(`button`,{type:`button`,onClick:()=>se(`logs`),className:`px-2 py-0.5 transition-colors ${M===`logs`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:w(`addons.addonCard.logs`,`Logs`)}),a(`button`,{type:`button`,onClick:()=>se(`events`),className:`px-2 py-0.5 border-l border-border transition-colors ${M===`events`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:w(`addons.addonCard.events`,`Events`)})]}),a(`div`,{className:`flex-1`}),a(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),ie(!1)},className:`text-foreground-subtle hover:text-foreground`,children:a(C,{className:`h-3.5 w-3.5`})})]}),M===`logs`&&a(_e,{addonId:F.id,maxHeight:`max-h-64`,showFilters:!1}),M===`events`&&a(Ce,{addonId:F.id,category:`addon.*`,maxHeight:`max-h-64`})]}),L&&t(u,{children:[a(`button`,{type:`button`,onClick:()=>E(e=>!e),className:`w-full flex items-center justify-center border-t border-border py-1 hover:bg-surface-hover/50 transition-colors`,children:a(T?g:p,{className:`h-3.5 w-3.5 text-foreground-subtle`})}),T&&a(`div`,{className:`border-t border-border px-2.5 py-1.5 space-y-1.5`,children:h.addons.map(e=>a(ut,{addon:e,hideVersion:!0},e.manifest.id))})]}),ae&&!L&&a(Oe,{open:!0,onOpenChange:e=>!e&&j(!1),children:t(De,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,children:[a(Ee,{children:t(pe,{className:`flex items-center gap-2`,children:[a(S,{className:`h-4 w-4 text-primary`}),w(`addons.addonCard.settingsTitle`,{name:le})]})}),t(ge,{className:`space-y-4`,children:[a(`div`,{className:`text-[10px] text-foreground-subtle mb-2`,children:w(`addons.addonCard.clusterWideSettingsOneValue`,`Cluster-wide settings — one value for every node. Per-node settings live under Cluster → the node → Settings.`)}),a(je,{nodeId:null,addonIds:[F.id],level:`global`,fieldScope:`cluster`,emptyMessage:w(`addons.addonCard.thisAddonExposesNoCluster`,`This addon exposes no cluster-wide settings. Anything it can configure is per-node — open it from Cluster → the node → Settings.`)}),it(F)&&t(`div`,{children:[a(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:w(`addons.addonCard.deviceExport`,`Device export`)}),a(de,{addonId:F.id,onOpenDevice:e=>P(`/devices/${e}`)})]}),at(z)&&t(`div`,{children:[a(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:w(`addons.addonCard.autoUpdate`,`Auto-Update`)}),a(ct,{addonId:F.id})]}),F.components&&F.components.length>0&&t(`div`,{children:[a(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:w(`addons.addonCard.components`,{count:F.components.length})}),a(`div`,{className:`flex flex-wrap gap-1`,children:F.components.map(e=>a(`span`,{className:`text-[10px] rounded bg-background border border-border px-1.5 py-0.5 text-foreground-subtle font-mono`,children:e},e))})]})]}),a(oe,{children:a(K,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>j(!1),children:w(`common.close`,`Close`)})})]})})]})}c();var dt=`.tgz,.tar.gz,.zip`;function ft({onUploadSuccess:e}){let{t:r}=J(),[o,c]=s(!1),l=n(null),d=i(async t=>{c(!0);let n=new FormData;n.append(`file`,t);let r=localStorage.getItem(`camstack_admin_token`)??``;try{(await(await fetch(h(`/api/addons/upload`),{method:`POST`,headers:{Authorization:`Bearer ${r}`},body:n})).json()).success&&e()}finally{c(!1)}},[e]);return t(u,{children:[a(`input`,{ref:l,type:`file`,accept:dt,onChange:i(e=>{let t=e.target.files?.[0];t&&d(t),e.target.value=``},[d]),className:`hidden`}),t(`button`,{type:`button`,onClick:()=>l.current?.click(),disabled:o,className:`flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-md bg-surface hover:bg-surface-hover border border-border disabled:opacity-50 transition-colors`,children:[o?a(x,{className:`w-3.5 h-3.5 animate-spin`}):a(m,{className:`w-3.5 h-3.5`}),o?r(`addons.addonUploadZone.uploading`,`Uploading...`):r(`addons.addonUploadZone.upload`,`Upload`)]})]})}var pt=/```[^\n]*\n([\s\S]*?)```/g;function mt(e){let t=[],n=0;for(let r of e.matchAll(pt)){let i=r.index??0;i>n&&t.push({kind:`text`,body:e.slice(n,i)}),t.push({kind:`code`,body:r[1]??``}),n=i+r[0].length}return n<e.length&&t.push({kind:`text`,body:e.slice(n)}),t}function ht(e){let t=e.trim();return t.startsWith(`https://`)||t.startsWith(`http://`)?t:null}function gt(e,t){let n=[],r=/(\*\*[^*]+\*\*|`[^`]+`|\[[^\]]+\]\([^)]+\))/g,i=0,o=0;for(let s of e.matchAll(r)){let r=s.index??0;r>i&&n.push(e.slice(i,r));let c=s[0],l=`${t}-${o}`;if(o+=1,c.startsWith(`**`))n.push(a(`strong`,{children:c.slice(2,-2)},l));else if(c.startsWith("`"))n.push(a(`code`,{className:`font-mono text-[0.9em]`,children:c.slice(1,-1)},l));else{let e=/^\[([^\]]+)\]\(([^)]+)\)$/.exec(c),t=e?.[1]??c,r=e?ht(e[2]??``):null;n.push(r?a(`a`,{href:r,target:`_blank`,rel:`noreferrer noopener`,className:`text-primary underline`,children:t},l):a(`span`,{children:t},l))}i=r+c.length}return i<e.length&&n.push(e.slice(i)),n}function _t(e,t){let n=e.split(`
5
- `),r=[],i=[],o=[],s=0,c=()=>{if(i.length===0)return;let e=i.join(` `).trim();i=[],e.length!==0&&(r.push(a(`p`,{className:`mb-2 last:mb-0`,children:gt(e,`${t}-p-${s}`)},`${t}-p-${s}`)),s+=1)},l=()=>{if(o.length===0)return;let e=o;o=[],r.push(a(`ul`,{className:`mb-2 list-disc pl-4 last:mb-0`,children:e.map((e,n)=>a(`li`,{children:gt(e,`${t}-li-${s}-${n}`)},`${t}-li-${s}-${n}`))},`${t}-ul-${s}`)),s+=1};for(let e of n){let n=/^(#{1,3})\s+(.*)$/.exec(e),u=/^\s*[-*]\s+(.*)$/.exec(e);if(n){c(),l();let e=n[1]?.length??1,i=gt(n[2]??``,`${t}-h-${s}`),o=e===1?`text-sm font-semibold mb-2`:`text-xs font-semibold mb-1.5 mt-2`;r.push(a(e===1?`h3`:`h4`,{className:o,children:i},`${t}-h-${s}`)),s+=1;continue}if(u){c(),o=[...o,u[1]??``];continue}if(e.trim().length===0){c(),l();continue}l(),i=[...i,e.trim()]}return c(),l(),r}function vt({markdown:e}){return a(`div`,{className:`text-xs text-foreground leading-relaxed`,children:mt(e).map((e,t)=>e.kind===`code`?a(`pre`,{className:`mb-2 overflow-auto rounded-md bg-surface-hover p-2 font-mono text-[10px] last:mb-0`,children:e.body.replace(/\n$/,``)},`code-${t}`):a(`div`,{children:_t(e.body,`b${t}`)},`text-${t}`))})}c();function yt(e){return e.replace(/^@camstack\/(addon-)?/,``)}function bt(e,t,n){let r=et(e,n);return r.some(e=>e.version===t)?r:[{version:t,distTags:[],deprecated:void 0},...r]}function xt({pending:e,failed:n,body:r,missing:i}){let{t:o}=J();return e?t(`div`,{className:`flex items-center gap-2 py-6 text-xs text-foreground-subtle`,children:[a(x,{className:`h-3.5 w-3.5 animate-spin`}),o(`addons.installDialog.loadingDocument`,`Loading…`)]}):n||r===void 0?a(`p`,{className:`py-4 text-xs text-danger`,children:o(`addons.installDialog.couldNotLoadDocument`,`Could not load this file from the registry.`)}):r.status===`ok`&&r.markdown!==void 0?a(vt,{markdown:r.markdown}):r.status===`error`?a(`p`,{className:`py-4 text-xs text-danger`,children:o(`addons.installDialog.documentError`,`Could not load this file. {{message}}`,{message:r.message??``})}):a(`p`,{className:`py-4 text-xs text-foreground-subtle`,children:i})}function St({target:e,installing:n,installError:r,onClose:i,onInstall:o}){let{t:c}=J(),[l,u]=s(e.version),[d,f]=s(!1),p=j({name:e.name}),m=q({name:e.name,version:l}),h=p.data??[],g=tt(h),_=bt(h,l,d),v=m.data;return a(Oe,{open:!0,onOpenChange:e=>!e&&i(),children:t(De,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,children:[a(Ee,{children:a(pe,{children:c(`addons.installDialog.title`,`Install {{name}}`,{name:yt(e.name)})})}),t(ge,{className:`space-y-3`,children:[a(`p`,{className:`font-mono text-[10px] text-foreground-subtle`,children:e.name}),e.description.length>0&&a(`p`,{className:`text-xs text-foreground`,children:e.description}),t(`div`,{className:`space-y-1.5`,children:[a(`span`,{className:`text-[10px] text-foreground-subtle`,children:c(`addons.installDialog.version`,`Version`)}),a(ae,{"aria-label":c(`addons.installDialog.version`,`Version`),value:l,options:_.map(e=>({value:e.version,label:$e(e)?c(`addons.installDialog.deprecatedVersion`,`{{version}} (deprecated)`,{version:e.version}):e.version})),onChange:e=>u(e.target.value)}),p.isError&&a(`p`,{className:`text-[10px] text-danger`,children:c(`addons.versionPicker.registryError`,`Could not load versions from the registry.`)}),g>0&&a(K,{type:`button`,variant:`ghost`,size:`sm`,className:`h-auto justify-start px-0 text-[10px] font-normal text-foreground-subtle underline`,onClick:()=>f(e=>!e),children:d?c(`addons.versionPicker.hideOlder`,`Hide older versions`):c(`addons.versionPicker.showOlder`,`Show older versions ({{count}})`,{count:g})})]}),t(R,{defaultValue:`readme`,children:[t(L,{children:[a(U,{value:`readme`,children:c(`addons.installDialog.readme`,`README`)}),a(U,{value:`changelog`,children:c(`addons.installDialog.changelog`,`CHANGELOG`)})]}),a(xe,{value:`readme`,children:a(`div`,{className:`max-h-80 overflow-auto rounded-md border border-border bg-background p-3`,children:a(xt,{pending:m.isPending,failed:m.isError,body:v?.readme,missing:c(`addons.installDialog.missingReadme`,`This package has no README.`)})})}),a(xe,{value:`changelog`,children:a(`div`,{className:`max-h-80 overflow-auto rounded-md border border-border bg-background p-3`,children:a(xt,{pending:m.isPending,failed:m.isError,body:v?.changelog,missing:c(`addons.installDialog.missingChangelog`,`This package has no CHANGELOG.`)})})})]}),r!=null&&r.length>0&&a(`p`,{className:`text-xs text-danger`,children:r})]}),t(oe,{children:[a(K,{type:`button`,variant:`outline`,size:`sm`,onClick:i,children:c(`common.cancel`,`Cancel`)}),a(K,{type:`button`,size:`sm`,disabled:n||l.length===0,onClick:()=>o(e.name,l),children:n?a(x,{className:`h-3.5 w-3.5 animate-spin`}):c(`addons.installDialog.install`,`Install`)})]})]})})}var Ct=new Set([`@camstack/system`,`@camstack/types`,`@camstack/sdk`,`@camstack/ui-library`,`@camstack/addon-agent-ui`]);function wt(e,t){let n=new Map;for(let r of e){if(r.isHub||r.onHub||Ct.has(r.packageName)||!t.isHub&&r.nodeId!==t.id)continue;let e=n.get(r.packageName)??[];e.push(r),n.set(r.packageName,e)}return[...n].map(([e,t])=>({packageName:e,rows:t})).sort((e,t)=>e.packageName.localeCompare(t.packageName))}function Tt({selectedNode:e}){let{t:n}=J(),{data:r}=H(Ye,{staleTime:Xe});if(r===void 0)return null;let i=wt(r.installations,e),o=r.unreachable.filter(t=>e.isHub||t.nodeId===e.id);return i.length===0&&o.length===0?null:t(`div`,{className:`rounded-lg border border-warning/30 bg-warning/5 px-3 py-2.5 space-y-2`,children:[t(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold text-foreground`,children:[a(ne,{className:`h-3.5 w-3.5 text-warning`}),e.isHub?n(`addons.nodeOnlyPackagesPanel.installedOnAgentsButNot`,`Installed on agents but not on the hub`):n(`addons.nodeOnlyPackagesPanel.installedOnButNotOn`,`Installed on {{name}} but not on the hub`,{name:e.name})]}),o.length>0&&a(`div`,{className:`text-[10px] text-foreground-subtle`,children:n(`addons.nodeOnlyPackagesPanel.unreachable`,{nodes:o.map(e=>e.nodeId).join(`, `)})}),i.map(n=>t(`div`,{className:`flex items-center justify-between gap-3 flex-wrap rounded-md border border-border bg-surface px-3 py-2`,children:[t(`div`,{className:`min-w-0`,children:[a(`div`,{className:`text-xs font-mono text-foreground break-all`,children:n.packageName}),a(`div`,{className:`text-[10px] text-foreground-subtle`,children:n.rows.map(e=>`${e.nodeName}${e.version===null?``:` ${e.version}`}${e.isOnline?``:` (offline)`}`).join(` · `)})]}),a(Qe,{packageName:n.packageName,displayName:n.packageName,selectedNode:e,hideNodeAction:e.isHub})]},n.packageName))]})}function Et({addon:e,installing:n,onInstall:r}){let{t:i}=J();return t(`div`,{className:`flex items-center gap-3 px-3 py-2 hover:bg-surface-hover transition-colors`,children:[a(`div`,{className:`w-6 h-6 rounded-md bg-primary/10 flex items-center justify-center text-primary text-[9px] font-bold shrink-0`,children:e.name.replace(`@camstack/addon-`,``).charAt(0).toUpperCase()}),t(`div`,{className:`flex-1 min-w-0`,children:[t(`div`,{className:`flex items-baseline gap-2 min-w-0`,children:[a(`span`,{className:`text-[11px] font-semibold break-words`,children:e.name.replace(/^@camstack\/(addon-)?/,``)}),t(`span`,{className:`text-[10px] text-foreground-subtle shrink-0`,children:[`v`,e.version]})]}),a(`div`,{className:`font-mono text-[9px] text-foreground-subtle/80 truncate`,children:e.name}),e.description&&a(`div`,{className:`text-[10px] text-foreground-subtle truncate`,children:e.description})]}),e.installed?a(ve,{variant:`success`,icon:a(T,{className:`h-3 w-3`}),children:e.installedVersion??i(`system.capabilityCatalog.installed`,`Installed`)}):t(K,{size:`sm`,onClick:()=>r(e),disabled:n,className:`shrink-0`,children:[n?a(x,{className:`h-3 w-3 animate-spin`}):a(v,{className:`h-3 w-3`}),i(`system.capabilityCatalog.install`,`Install`)]})]})}function Dt({capability:e,installing:n,onInstall:r}){let{t:i}=J(),{data:o,isPending:s,isError:c}=W({capability:e}),l;if(c)l=a(`div`,{className:`px-3 py-2 text-xs text-danger`,children:i(`system.capabilityCatalog.couldNotSearchTheNpm`,`Could not search the npm catalog right now. Try again in a moment.`)});else if(s||o===void 0)l=t(`div`,{className:`flex items-center gap-2 px-3 py-2 text-xs text-foreground-subtle`,children:[a(x,{className:`h-3 w-3 animate-spin`}),i(`system.capabilityCatalog.searchingTheNpmCatalog`,`Searching the npm catalog…`)]});else{let t=o.filter(e=>!e.installed);l=t.length===0?a(`div`,{className:`px-3 py-2 text-xs text-foreground-subtle`,children:o.length===0?i(`system.capabilityCatalog.noPublishedAddonDeclaresThe`,`No published addon declares the "{{capability}}" capability.`,{capability:e}):i(`system.capabilityCatalog.everyPublishedAddonThatDeclares`,`Every published addon that declares "{{capability}}" is already installed.`,{capability:e})}):a(`div`,{className:`divide-y divide-border`,children:t.map(e=>a(Et,{addon:e,installing:n,onInstall:r},e.name))})}return t(`section`,{className:`rounded-md border border-border bg-surface overflow-hidden`,"aria-label":i(`system.capabilityCatalog.availableToInstall`,`Available to install`),children:[a(`h2`,{className:`px-3 py-1.5 text-[10px] uppercase tracking-wide text-foreground-subtle border-b border-border`,children:i(`system.capabilityCatalog.availableToInstall`,`Available to install`)}),l]})}c();function Ot(e){return e===`npm`||e===`dev`?e:null}var kt=`rounded-full border border-primary bg-primary/10 px-2 py-0.5 text-[10px] text-foreground`,At=`rounded-full border border-border px-2 py-0.5 text-[10px] text-foreground-muted hover:bg-surface-hover`,jt=[{seconds:900,label:`15m`},{seconds:3600,label:`1h`},{seconds:21600,label:`6h`},{seconds:43200,label:`12h`},{seconds:86400,label:`24h`}],Mt={id:`hub`,name:`Hub`,isHub:!0,isOnline:!0};function Nt(e,t){let n=e??`hub-only`;return n===`any-node`?!0:n===`hub-only`?t:!t}function Pt(e){return e===`local`?`dev`:`npm`}function Ft(e){let t=e;if(!t?.manifest)return null;let n={...t.manifest,name:t.manifest.name??t.manifest.id,version:t.manifest.version??`0.0.0`,capabilities:t.manifest.capabilities??[]},r=t.process,i=r?{pid:r.pid,mode:r.mode===`forked`?`forked`:`in-process`,state:r.state??`unknown`,...r.reason===void 0?{}:{reason:r.reason}}:void 0,a=t.health,o=t.declaration?.execution,s=t.manifest.execution,c=o?.placement??s?.placement;return{manifest:n,enabled:!0,source:t.source,installSource:t.installSource,installedOn:[],...i?{process:i}:{},hasBackup:t.hasBackup,...a?{health:a}:{},...c?{placement:c}:{}}}function It(e){let t=new Map,n=[];for(let r of e){let e=r.manifest.packageName;if(!e){n.push(r);continue}let i=t.get(e);if(i)i.addons.push(r);else{let n=r.manifest.bundle,i={packageName:e,displayName:n?.displayName??r.manifest.packageDisplayName??r.manifest.name,version:r.manifest.packageVersion,addons:[r],...r.installSource===void 0?{}:{installSource:r.installSource},...n===void 0?{}:{bundle:n}};t.set(e,i)}}let r=[];for(let e of t.values())e.bundle!==void 0||e.addons.length>=2?r.push({bundle:e,representative:e.addons[0]}):r.push(e.addons[0]);return r.push(...n),r}function $(e){return`bundle`in e}function Lt({addons:c,clusterStatus:u,selectedNode:f,onRefresh:p,listPhase:m}){let{t:h}=J(),g=l(),[_,b]=s(``),S=e(_),[C,w]=s(!1),T=n(null);o(()=>{if(!C)return;let e=e=>{T.current&&!T.current.contains(e.target)&&w(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[C]);let{data:E}=le({nodeId:f.id}),D=r(()=>{let e=new Map;for(let t of E??[])e.set(t.name,t.latestVersion);return e},[E]),te=r(()=>(E??[]).filter(e=>!e.isSystem).length,[E]),[ne,k]=s(()=>new Set),[A,re]=s(()=>new Map),ae=i(e=>{k(t=>new Set(t).add(e))},[]),j=i(e=>{k(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n})},[]),oe=i((e,t)=>{re(n=>new Map(n).set(e,t))},[]),M=i(e=>{re(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),N=Se({onMutate:e=>{ae(e.name),M(e.name)},onSuccess:(e,t)=>{j(t.name);let n=e;if(n&&n.success===!1){oe(t.name,n.error??`Update failed (no error message returned by server)`);return}g.invalidateQueries({queryKey:[[`addons`]]}),g.invalidateQueries({queryKey:[[`addons`,`listUpdates`]]})},onError:(e,t)=>{j(t.name),oe(t.name,e instanceof Error?e.message:String(e))}}),P=Be(),F=n(new Set);o(()=>{let e=new Set;for(let[t,n]of P)Re(n)&&e.add(t);let t=[...F.current].some(t=>!e.has(t));F.current=e,t&&(g.invalidateQueries({queryKey:[[`addons`]]}),g.invalidateQueries({queryKey:[[`addons`,`listUpdates`]]}))},[P,g]);let{data:I}=ue(void 0),ce=z({onSuccess:()=>{g.invalidateQueries({queryKey:[[`addons`,`getAutoUpdateSettings`]]})}}),L=ie({onSuccess:()=>{g.invalidateQueries({queryKey:[[`addons`,`getAutoUpdateSettings`]]})}}),{data:R,isFetching:de}=W({query:S||void 0},{enabled:C}),B=we(),{data:V}=fe(void 0),pe=V?.requestedAt,[H,he]=s(null),[U,ge]=s(!1);o(()=>{if(V?.kind===`framework-bulk-update`&&V.requestedAt!==H){he(V.requestedAt),ge(!0);let e=window.setTimeout(()=>ge(!1),6e3);return()=>window.clearTimeout(e)}},[pe,H,V]),O();let _e=i(async()=>{let e=(E??[]).filter(e=>!e.isSystem);if(e.length!==0){if(!f.isHub){for(let t of e)await N.mutateAsync({name:t.name,version:t.latestVersion,nodeId:f.id});return}await B.mutateAsync({kind:`update`,targets:e.map(e=>({name:e.name,version:e.latestVersion})),nodeIds:[f.id]})}},[E,f.id,f.isHub,B,N]),[ve,G]=s(null),[ye,be]=s(null),xe=e=>{be(null),G(e)},K=me({onSuccess:()=>{G(null),be(null),g.invalidateQueries({queryKey:[[`addons`]]}),g.invalidateQueries({queryKey:[[`addonPages`]]}),g.invalidateQueries({queryKey:[[`capabilities`]]}),g.invalidateQueries({queryKey:[[`integrations`]]})},onError:e=>{be(e instanceof Error?e.message:`Install failed`)}}),[Ce,Te]=s(`type`),[Ee,De]=s(()=>typeof window>`u`?`grouped`:window.localStorage.getItem(`camstack.addons.viewMode`)===`flat`?`flat`:`grouped`),Oe=e=>{De(e),typeof window<`u`&&window.localStorage.setItem(`camstack.addons.viewMode`,e)},[q,Y]=ke(),X=q.get(`capability`),Ae=q.get(`updatable`)===`1`,je=q.get(`error`)===`1`,Z=Ot(q.get(`source`)),Ne=i(e=>{let t=new URLSearchParams(q);e?t.set(`updatable`,`1`):t.delete(`updatable`),Y(t,{replace:!0})},[q,Y]),Fe=i(e=>{let t=new URLSearchParams(q);e?t.set(`error`,`1`):t.delete(`error`),Y(t,{replace:!0})},[q,Y]),Ie=i(e=>{let t=new URLSearchParams(q);e===null?t.delete(`source`):t.set(`source`,e),Y(t,{replace:!0})},[q,Y]),Le=r(()=>c.filter(e=>Pe(e.process)!==null).length,[c]),Q=r(()=>{let e=c.filter(e=>!Me(e.manifest.packageName));return f.isHub||(e=e.filter(e=>Nt(e.placement,f.isHub))),X&&(e=e.filter(e=>(e.manifest.capabilities??[]).some(e=>(typeof e==`string`?e:e.name)===X))),Ae&&(e=e.filter(e=>{let t=e.manifest.packageName;return t!==void 0&&D.has(t)})),Z!==null&&(e=e.filter(e=>Pt(e.installSource)===Z)),je&&(e=e.filter(e=>Pe(e.process)!==null)),e},[c,f.isHub,X,Ae,Z,je,D]),ze=()=>{let e=new URLSearchParams(q);e.delete(`capability`),Y(e,{replace:!0})},Ve=Ee===`flat`?Q:It(Q),He=r(()=>{let e=[...Ve];switch(Ce){case`type`:e.sort((e,t)=>{let n=+!$(e),r=+!$(t);if(n!==r)return n-r;let i=$(e)?e.bundle.displayName:e.manifest.name,a=$(t)?t.bundle.displayName:t.manifest.name;return i.localeCompare(a)});break;case`name`:e.sort((e,t)=>{let n=$(e)?e.bundle.displayName:e.manifest.name,r=$(t)?t.bundle.displayName:t.manifest.name;return n.localeCompare(r)});break;case`source`:e.sort((e,t)=>{let n=$(e)?e.bundle.installSource??``:e.installSource??``,r=$(t)?t.bundle.installSource??``:t.installSource??``;return n.localeCompare(r)});break}return e},[Ve,Ce]);return t(`div`,{className:`space-y-3`,children:[[...A.entries()].map(([e,n])=>a(`div`,{className:`rounded-md border border-danger/30 bg-danger/5 px-2.5 py-1.5 text-[11px]`,children:t(`div`,{className:`flex items-start justify-between gap-3`,children:[t(`div`,{className:`space-y-0.5`,children:[a(`div`,{className:`font-medium text-danger`,children:h(`systemPage.addons.updateFailed`,{name:e})}),a(`div`,{className:`text-foreground-subtle font-mono`,children:n})]}),a(`button`,{type:`button`,onClick:()=>M(e),className:`text-foreground-subtle hover:text-foreground text-[10px]`,children:h(`common.dismiss`)})]})},e)),t(`div`,{className:`flex items-center gap-x-2 gap-y-1.5 flex-wrap`,children:[t(`div`,{className:`flex items-center gap-1.5`,children:[a(`span`,{className:`text-[10px] text-foreground-subtle`,children:h(`admin.system.addons.sort`,`Sort:`)}),t(`select`,{value:Ce,onChange:e=>Te(e.target.value),className:`rounded-md border border-border bg-surface px-2 py-1 text-[11px] text-foreground focus:outline-none focus:border-primary/50`,children:[a(`option`,{value:`type`,children:h(`admin.system.addons.bundlesFirst`,`Bundles first`)}),a(`option`,{value:`name`,children:h(`admin.system.addons.name`,`Name`)}),a(`option`,{value:`source`,children:h(`admin.system.addons.installSource`,`Install source`)})]})]}),t(`div`,{className:`flex items-center gap-1.5`,children:[a(`span`,{className:`text-[10px] text-foreground-subtle`,children:h(`admin.system.addons.view`,`View:`)}),a(`div`,{className:`flex rounded-md border border-border overflow-hidden text-[10px] font-medium`,children:[`grouped`,`flat`].map(e=>a(`button`,{type:`button`,onClick:()=>Oe(e),className:`px-2 py-1 transition-colors capitalize ${Ee===e?`bg-primary/10 text-primary`:`bg-transparent text-foreground-subtle hover:bg-surface-hover`}`,title:e===`grouped`?h(`admin.system.addons.groupMultiAddonPackagesInto`,`Group multi-addon packages into a bundle card`):h(`admin.system.addons.showEveryAddonAsIts`,`Show every addon as its own card`),children:e},e))})]}),f.isHub&&t(`div`,{className:`flex items-center gap-1.5`,children:[a(d,{className:`h-3 w-3 text-foreground-subtle`}),a(`span`,{className:`text-[10px] text-foreground-subtle`,children:h(`admin.system.addons.autoUpdate`,`Auto-Update:`)}),a(`div`,{className:`flex rounded-md border border-border overflow-hidden text-[10px] font-medium`,children:[`off`,`latest`,`beta`].map(e=>a(`button`,{type:`button`,onClick:()=>ce.mutate({channel:e}),disabled:ce.isPending,className:`px-2 py-1 transition-colors capitalize ${I?.channel===e?e===`off`?`bg-gray-700 text-gray-200`:e===`latest`?`bg-blue-500/20 text-blue-400`:`bg-amber-500/20 text-amber-400`:`bg-transparent text-foreground-subtle hover:bg-surface-hover`} ${e===`off`?``:`border-l border-border`}`,children:e},e))})]}),f.isHub&&t(`div`,{className:`flex items-center gap-1.5`,children:[a(`span`,{className:`text-[10px] text-foreground-subtle`,children:h(`admin.system.addons.checkEvery`,`Check every:`)}),a(`select`,{className:`rounded-md border border-border bg-transparent px-1.5 py-1 text-[10px] font-medium text-foreground-subtle`,value:I?.updateCheckIntervalSeconds??21600,disabled:L.isPending||I===void 0,onChange:e=>{I!==void 0&&L.mutate({channel:I.channel,updateCheckIntervalSeconds:Number(e.target.value)})},children:jt.map(e=>a(`option`,{value:e.seconds,children:e.label},e.seconds))})]}),te>0&&t(`button`,{type:`button`,onClick:()=>void _e(),disabled:B.isPending,className:`flex items-center gap-1 px-2 py-1 text-[11px] rounded-md bg-blue-500/10 text-blue-400 hover:bg-blue-500/20 border border-blue-500/30 disabled:opacity-50 transition-colors font-medium`,children:[B.isPending?a(x,{className:`w-3 h-3 animate-spin`}):a(v,{className:`w-3 h-3`}),B.isPending?h(`admin.system.addons.updating`,`Updating…`):h(`admin.system.addons.updateAll`,`Update All ({{nonSystemUpdateCount}})`,{nonSystemUpdateCount:te})]})]}),t(`div`,{className:`flex flex-wrap items-center gap-1.5`,role:`group`,"aria-label":h(`admin.system.addons.filterInstalledAddons`,`Filter installed addons`),children:[a(`span`,{className:`text-[10px] text-foreground-subtle`,children:h(`admin.system.addons.filter`,`Filter:`)}),[{id:`updatable`,label:h(`admin.system.addons.updatable`,`Updatable`),pressed:Ae,toggle:()=>Ne(!Ae)},{id:`error`,label:h(`admin.system.addons.inError`,`In error ({{count}})`,{count:Le}),pressed:je,toggle:()=>Fe(!je)},{id:`npm`,label:`npm`,pressed:Z===`npm`,toggle:()=>Ie(Z===`npm`?null:`npm`)},{id:`dev`,label:h(`admin.system.addons.dev`,`Dev`),pressed:Z===`dev`,toggle:()=>Ie(Z===`dev`?null:`dev`)}].map(e=>a(`button`,{type:`button`,"aria-pressed":e.pressed,onClick:e.toggle,className:e.pressed?kt:At,children:e.label},e.id))]}),t(`div`,{className:`flex flex-col gap-1.5 sm:flex-row sm:items-center sm:gap-2`,children:[t(`div`,{className:`relative flex-1 min-w-0 sm:min-w-[200px]`,ref:T,children:[a(se,{type:`text`,searchHotkey:!0,value:_,onChange:e=>{b(e.target.value),w(!0)},onFocus:()=>w(!0),placeholder:h(`admin.system.addons.searchAddonsOnNpm`,`Search addons on npm...`),"aria-label":h(`admin.system.addons.searchAddonsOnNpm2`,`Search addons on npm`),disabled:B.isPending,leftSlot:a(ee,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),rightSlot:de?a(x,{className:`h-3 w-3 animate-spin`}):void 0}),C&&R&&R.length>0&&t(`div`,{className:`absolute left-0 right-0 top-full mt-1 z-40 rounded-md border border-border bg-surface shadow-xl overflow-hidden`,children:[R.length>0&&a(`div`,{className:`px-3 py-1.5 text-[10px] uppercase tracking-wide text-foreground-subtle border-b border-border`,children:h(`systemPage.addons.npmResults`,{count:R.length})}),R&&R.length>0&&a(`div`,{className:`max-h-72 overflow-auto divide-y divide-border`,children:R.map(e=>a(Et,{addon:e,installing:K.isPending,onInstall:e=>xe({name:e.name,version:e.version,description:e.description})},e.name))})]})]}),a(ft,{onUploadSuccess:()=>{g.invalidateQueries({queryKey:[[`addons`]]}),p()}})]}),X&&t(`div`,{className:`flex items-center gap-2 px-2.5 py-1.5 rounded-md bg-primary/10 border border-primary/30 text-xs`,children:[a(`span`,{className:`text-foreground-subtle`,children:h(`admin.system.addons.filteringByCapability`,`Filtering by capability:`)}),a(`span`,{className:`font-mono text-primary font-semibold`,children:X}),a(`button`,{type:`button`,onClick:ze,className:`ml-auto text-xs text-foreground-subtle hover:text-foreground underline`,children:h(`admin.system.addons.clear`,`Clear`)})]}),X&&a(Dt,{capability:X,installing:K.isPending,onInstall:e=>xe({name:e.name,version:e.version,description:e.description})}),X&&Q.length>0&&a(`h2`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:h(`admin.system.addons.installed`,`Installed`)}),U&&t(`div`,{className:`fixed top-[calc(env(safe-area-inset-top)+1rem)] right-[calc(env(safe-area-inset-right)+1rem)] z-50 flex items-start gap-2 px-3 py-2.5 rounded-md border border-green-500/30 bg-green-500/10 shadow-lg backdrop-blur-sm max-w-sm pointer-events-auto`,children:[a(y,{className:`w-4 h-4 shrink-0 mt-0.5 text-green-400`}),t(`div`,{children:[a(`div`,{className:`text-[11px] font-semibold text-foreground`,children:h(`admin.system.addons.bulkUpdateCompleted`,`Bulk update completed`)}),a(`div`,{className:`text-[10px] text-foreground-subtle mt-0.5`,children:h(`admin.system.addons.systemPackagesUpdatedHubRestarted`,`System packages updated — hub restarted successfully.`)})]})]}),m===`pending`&&t(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[a(x,{className:`h-3 w-3 animate-spin`}),h(`admin.system.addons.loadingInstalled`,`Loading installed addons…`)]}),m===`error`&&a(`div`,{className:`text-xs text-danger`,children:h(`admin.system.addons.failedToLoadAddons`,`Failed to load addons`)}),m===`ready`&&Q.length===0&&a(`div`,{className:`text-xs text-foreground-subtle`,children:c.length===0?h(`admin.system.addons.noAddonsInstalled`,`No addons installed`):X?h(`admin.system.addons.noInstalledAddonDeclaresThe`,`No installed addon declares the "{{capabilityFilter}}" capability. Any addon you can install appears under "Available to install" above.`,{capabilityFilter:X}):h(`admin.system.addons.noAddonsCompatibleWithPlacement`,`No addons compatible with {{name}} (placement filter active)`,{name:f.name})}),a(`div`,{className:`space-y-1.5`,children:m===`ready`&&He.map(e=>{let t=$(e)?e.bundle.packageName:e.manifest.packageName,n=D.get(t),r=$(e)?e.representative:e,i=n?e=>N.mutate({name:t,version:e,nodeId:f.id}):void 0,o=P.get(t)??null,s=o!==null&&Re(o);return a(ut,{addon:r,clusterStatus:u?.[r.manifest.id],bundle:$(e)?e.bundle:void 0,availableUpdate:n,isUpdating:ne.has(t)||s,jobProgress:o,onUpdate:i,disabledByBulk:B.isPending,selectedNode:f},$(e)?t:e.manifest.id)})}),ve!==null&&a(St,{target:ve,installing:K.isPending,installError:ye,onClose:()=>G(null),onInstall:(e,t)=>K.mutate({packageName:e,version:t})})]})}function Rt(){let{t:e}=J(),r=l(),{data:i}=V(void 0),{nodes:s}=Te(),{selection:c,selectNode:u,requestedNodeId:f}=Ne(s.length>0?s:[Mt]),p=c.node??Mt,m=p.id,h=s.length>0?c.staleNodeId:null,{data:g,isLoading:_,isError:v}=F({nodeId:m}),y=N(),b=be(),x=y.isPending||b.isPending,S=async()=>{await y.mutateAsync({nodeId:m}),await b.mutateAsync(),r.invalidateQueries({queryKey:[[`addons`]]})},C=n(y);C.current=y;let w=n(f??`hub`);o(()=>{C.current.mutate({nodeId:w.current})},[]);let T=(g??[]).map(Ft).filter(e=>e!==null);return t(Ae,{children:[t(`div`,{className:`flex items-center justify-between gap-2 flex-wrap`,children:[a(M,{selectedNodeId:m,onSelect:u}),t(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[!_&&!v&&a(`span`,{className:`text-[10px] rounded-full bg-primary/10 text-primary px-2 py-0.5 font-medium`,children:e(`systemPage.addons.installedCount`,{count:T.length})}),t(`button`,{type:`button`,onClick:()=>void S(),disabled:x,className:`inline-flex items-center gap-1 px-2 py-1 text-[11px] rounded-md bg-surface hover:bg-surface-hover border border-border disabled:opacity-50 transition-colors`,title:e(`admin.system.addons.reFetchAddonsCheckNpm`,`Re-fetch addons + check npm for new versions`),children:[a(d,{className:`w-3 h-3 ${x?`animate-spin`:``}`}),e(`admin.system.addons.checkForUpdates`,`Check for updates`)]})]})]}),a(Z,{staleNodeId:h,shownNodeName:p.name}),a(Tt,{selectedNode:p}),a(Lt,{addons:T,clusterStatus:i,selectedNode:p,onRefresh:()=>void S(),listPhase:_?`pending`:v?`error`:`ready`})]})}export{Rt as AddonsPage};
@@ -1,3 +0,0 @@
1
- import{C as e,J as t,K as n,R as r,S as i,V as a,Y as o,a as s,et as c,t as l,x as u}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{D as d,En as f,Fn as p,G as m,Ht as h,L as g,Pi as _,Pn as v,Pr as y,Q as b,Ri as x,Vn as S,Zr as C,_n as w,dt as T,fr as E,gt as D,oi as O,ra as k,ri as A,rn as j,st as M,tn as N,vn as P,zi as F}from"./player-overlays-DyWZd37T.js";import{Ho as ee,ai as I,ii as L,oi as R}from"./client-DdGu3rlb.js";import{n as z,t as B}from"./send-CBO9g-_U.js";import{t as te}from"./message-square-plus-_8_Z4yYf.js";import{Ad as ne,An as V,Et as H,Fd as re,Fo as U,Fr as W,Id as ie,Ir as G,Nr as K,On as q,Pr as J,Qn as ae,Tt as oe,Ur as se,Xn as ce,_t as le,ct as ue,di as Y,jn as de,mr as fe,or as pe,ri as X,yt as me}from"./src-DF4f-P3R.js";import{t as Z}from"./i18n-C-H4BlYV.js";import{t as Q}from"./useTranslation-BJr-n0es.js";import"./mount-DhYiPHjb.js";import{T as he,yr as ge}from"./index-CyYfrxyQ.js";import{t as _e}from"./AdminSectionedPage-Bu-9skyU.js";import{t as ve}from"./AdminPage-BVK_kyJp.js";c();var ye=`__redacted__`,be=[`llm`,`listProfiles`],xe=[`llm`,`listProfileKinds`],Se=[`llm`,`getDefaults`],Ce=[`llm`,`listRuntimeNodes`],we=[`llm`,`listModelCatalog`],Te=[`llm`,`getUsage`],Ee=[{purpose:`vision`,visionOnly:!0},{purpose:`text`,visionOnly:!1}],De=new Map([[`cloud`,O],[`plug`,v],[`cpu`,A],[`server`,w],[`sparkles`,j]]);function Oe(e){return De.get(e)??F}function ke(e){return typeof e==`string`&&e.length>0?e:void 0}function Ae(e){if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e==`string`&&e.trim()!==``){let t=Number(e);return Number.isFinite(t)?t:void 0}}function je(e){return e===!0}function Me(e){let t=new Map;for(let n of e){let e=t.get(n.addonId)??[];e.push(n),t.set(n.addonId,e)}return[...t.entries()].map(([e,t])=>({addonId:e,kinds:t}))}var Ne={deviceNotEligible:{key:`ai.appleNotEligible`,tone:`default`},appleIntelligenceNotEnabled:{key:`ai.appleIntelligenceOff`,tone:`warning`},modelNotReady:{key:`ai.appleModelNotReady`,tone:`warning`},osTooOld:{key:`ai.appleOsTooOld`,tone:`default`},helperMissing:{key:`ai.appleHelperMissing`,tone:`danger`},helperCrashed:{key:`ai.appleHelperCrashed`,tone:`danger`}};function Pe(e){let t=t=>({nodeId:e.nodeId,selectable:!1,labelKey:`ai.appleUnknown`,labelDefault:Z.t(`ai.appleUnknown`),detail:t,tone:`default`});if(!e.reachable)return t(e.error??null);let n=e.apple;if(n===void 0)return t(null);switch(n.state){case`available`:return{nodeId:e.nodeId,selectable:!0,labelKey:`ai.appleAvailable`,labelDefault:Z.t(`ai.appleAvailable`),detail:Z.t(n.imageInput?`helpers.aiPage.appleDetailImages`:`helpers.aiPage.appleDetailText`,{version:n.osVersion}),tone:`success`};case`unavailable`:{let t=Ne[n.reason];return{nodeId:e.nodeId,selectable:!1,labelKey:t.key,labelDefault:Z.t(t.key),detail:n.detail,tone:t.tone}}case`unsupported-platform`:return{nodeId:e.nodeId,selectable:!1,labelKey:`ai.appleNotMac`,labelDefault:Z.t(`ai.appleNotMac`),detail:n.platform,tone:`default`};case`unknown`:return t(n.error)}}var Fe={ready:`success`,downloading:`info`,starting:`info`,stopped:`danger`,crashed:`danger`,failed:`danger`},Ie={ready:`ai.stateReady`,downloading:`ai.stateDownloading`,starting:`ai.stateStarting`,stopped:`ai.stateStopped`,crashed:`ai.stateCrashed`,failed:`ai.stateFailed`};function Le(e){return e.reachable?e.status===void 0?`ai.stateReady`:Ie[e.status.state]:`ai.unreachable`}function Re(e){return e.reachable?e.status===void 0?`success`:Fe[e.status.state]:`danger`}function ze(e){if(!e.reachable)return[];let t=[],n=e.apple;if(n?.state===`available`)t.push({id:`apple`,labelKey:`ai.featureApple`,tone:`success`,detail:Pe(e).detail}),n.imageInput&&t.push({id:`apple-images`,labelKey:`ai.featureAppleImages`,tone:`success`,detail:null});else if(n?.state===`unavailable`){let n=Pe(e);t.push({id:`apple`,labelKey:`ai.featureApple`,tone:n.tone,detail:n.labelDefault})}let r=e.status?.vramBytes;return r!==void 0&&r>0&&t.push({id:`gpu`,labelKey:`ai.featureGpu`,tone:`info`,detail:null}),t}var Be=`default`;function Ve(e){let t=L.shape.reasoningEffort.safeParse(e);return t.success?t.data:void 0}function He(){return{temperature:[{type:`slider`,key:`temperature`,label:Z.t(`helpers.aiProfileForm.temperature`),min:0,max:2,step:.1,showValue:!0,showStepper:!0,nullable:!0,nullLabel:`Provider default`,description:Z.t(`helpers.aiProfileForm.temperatureHint`)}],topP:[{type:`slider`,key:`topP`,label:Z.t(`helpers.aiProfileForm.topP`),min:0,max:1,step:.05,showValue:!0,showStepper:!0,nullable:!0,nullLabel:`Provider default`}],topK:[{type:`number`,key:`topK`,label:Z.t(`helpers.aiProfileForm.topK`),min:1}],maxTokens:[{type:`number`,key:`maxTokens`,label:Z.t(`helpers.aiProfileForm.maxTokens`),min:1}],reasoningEffort:[{type:`select`,key:`reasoningEffort`,label:Z.t(`helpers.aiProfileForm.reasoningEffort`),default:Be,options:[{value:Be,label:Z.t(`helpers.aiProfileForm.reasoningDefault`)},{value:`off`,label:Z.t(`helpers.aiProfileForm.reasoningOff`)},{value:`low`,label:Z.t(`helpers.aiProfileForm.reasoningLow`)},{value:`medium`,label:Z.t(`helpers.aiProfileForm.reasoningMedium`)},{value:`high`,label:Z.t(`helpers.aiProfileForm.reasoningHigh`)}],description:Z.t(`helpers.aiProfileForm.reasoningEffortHint`)}],contextLength:[{type:`number`,key:`contextLength`,label:Z.t(`helpers.aiProfileForm.contextLength`),min:512,unit:`tokens`,description:Z.t(`helpers.aiProfileForm.contextLengthHint`)}],systemPrompt:[{type:`textarea`,key:`systemPrompt`,label:Z.t(`helpers.aiProfileForm.systemPrompt`),rows:4,maxLength:4e3,span:2,description:Z.t(`helpers.aiProfileForm.systemPromptHint`)}],timeoutMs:[{type:`number`,key:`timeoutMs`,label:Z.t(`helpers.aiProfileForm.timeoutTotal`),min:1e3,default:R.totalMs,unit:`ms`,description:Z.t(`helpers.aiProfileForm.timeoutTotalHint`)}],connectTimeoutMs:[{type:`number`,key:`connectTimeoutMs`,label:Z.t(`helpers.aiProfileForm.timeoutConnect`),min:500,default:R.connectMs,unit:`ms`,description:Z.t(`helpers.aiProfileForm.timeoutConnectHint`)}],firstTokenTimeoutMs:[{type:`number`,key:`firstTokenTimeoutMs`,label:Z.t(`helpers.aiProfileForm.timeoutFirstToken`),min:1e3,default:R.firstTokenMs,unit:`ms`,description:Z.t(`helpers.aiProfileForm.timeoutFirstTokenHint`)}],idleTimeoutMs:[{type:`number`,key:`idleTimeoutMs`,label:Z.t(`helpers.aiProfileForm.timeoutIdle`),min:1e3,default:R.idleMs,unit:`ms`,description:Z.t(`helpers.aiProfileForm.timeoutIdleHint`)}],retry:[{type:`boolean`,key:`retryEnabled`,label:Z.t(`helpers.aiProfileForm.retry`),description:Z.t(`helpers.aiProfileForm.retryHint`)},{type:`number`,key:`retryMaxAttempts`,label:Z.t(`helpers.aiProfileForm.retryMaxAttempts`),min:1,max:5,default:1,showWhen:{field:`retryEnabled`,equals:!0}}],toolsEnabled:[{type:`boolean`,key:`toolsEnabled`,label:Z.t(`helpers.aiProfileForm.toolsEnabled`),description:Z.t(`helpers.aiProfileForm.toolsEnabledHint`)}]}}var Ue=[`temperature`,`topP`,`topK`,`maxTokens`,`reasoningEffort`,`contextLength`,`systemPrompt`],We=[`timeoutMs`,`connectTimeoutMs`,`firstTokenTimeoutMs`,`idleTimeoutMs`,`retry`,`toolsEnabled`];function Ge(e,t){let n=He();return t.filter(t=>e.includes(t)).flatMap(e=>n[e])}function Ke(e){let t=Ge(e,Ue);return t.length===0?null:{sections:[{id:`generation`,title:Z.t(`helpers.aiProfileForm.generation`),fields:t}]}}function qe(e){let t=Ge(e,We);return t.length===0?null:{sections:[{id:`bounds`,title:Z.t(`helpers.aiProfileForm.bounds`),fields:t}]}}function Je(e){return e===null?{}:{temperature:e.temperature,topP:e.topP,topK:e.topK,maxTokens:e.maxTokens,reasoningEffort:e.reasoningEffort??Be,contextLength:e.contextLength,systemPrompt:e.systemPrompt,timeoutMs:e.timeoutMs,connectTimeoutMs:e.connectTimeoutMs,firstTokenTimeoutMs:e.firstTokenTimeoutMs,idleTimeoutMs:e.idleTimeoutMs,retryEnabled:e.retry.enabled,retryMaxAttempts:e.retry.maxAttempts,toolsEnabled:e.toolsEnabled}}function Ye(e,t){return{...e.features,...t?.features}}function Xe(e,t){return t===null?e.modelCatalog===`static`?e.staticModels??[]:[]:t}function Ze(e,t,n){let r=e.profileFields,i=n.common,a=(e,t,n)=>r.includes(e)?Ae(i[e])??t:n??t,o=e=>r.includes(e)?Ae(i[e]):t?.[e],s=o(`temperature`),c=o(`topP`),l=o(`topK`),u=o(`maxTokens`),d=o(`contextLength`),f=r.includes(`reasoningEffort`)?Ve(i.reasoningEffort):t?.reasoningEffort,p=r.includes(`systemPrompt`)?ke(i.systemPrompt):t?.systemPrompt;return{id:t?.id??crypto.randomUUID(),name:n.name,kind:e.kind,addonId:e.addonId.length>0?e.addonId:`ai`,enabled:t?.enabled??!0,model:n.model,supportsVision:n.supportsVision,timeoutMs:a(`timeoutMs`,R.totalMs,t?.timeoutMs),connectTimeoutMs:a(`connectTimeoutMs`,R.connectMs,t?.connectTimeoutMs),firstTokenTimeoutMs:a(`firstTokenTimeoutMs`,R.firstTokenMs,t?.firstTokenTimeoutMs),idleTimeoutMs:a(`idleTimeoutMs`,R.idleMs,t?.idleTimeoutMs),retry:r.includes(`retry`)?{enabled:je(i.retryEnabled),maxAttempts:Ae(i.retryMaxAttempts)??1}:t?.retry??{enabled:!1,maxAttempts:1},toolsEnabled:r.includes(`toolsEnabled`)?je(i.toolsEnabled):t?.toolsEnabled??!1,...s===void 0?{}:{temperature:s},...c===void 0?{}:{topP:c},...l===void 0?{}:{topK:l},...u===void 0?{}:{maxTokens:u},...f===void 0?{}:{reasoningEffort:f},...d===void 0?{}:{contextLength:d},...p===void 0?{}:{systemPrompt:p},providerConfig:n.providerConfig}}var Qe=2e3;function $(e){return Z.t(`system.aiModelPicker.sizeGb`,{value:(e/1e9).toFixed(2)})}function $e(e){return e===null?``:e.model.kind===`catalog`?`catalog:${e.model.catalogId}`:e.model.kind===`path`?`node:${e.modelId}`:`custom`}function et({nodeId:t,value:r,onChange:a}){let{t:c}=Q(),u=T(),[d,f]=o(``),[p,m]=o(null),[h,g]=o(!1),_=s({queryKey:we,queryFn:()=>u.trpcClient.llm.listModelCatalog.query({})}),v=s({queryKey:[`llm`,`listNodeModels`,t],queryFn:()=>u.trpcClient.llm.listNodeModels.query({nodeId:t})}),y=l({mutationFn:e=>u.trpcClient.llm.resolveModelRef.mutate(e),onSuccess:e=>{m(e),g(!1),e.ok&&a({model:e.model,modelId:e.label,supportsVision:e.purpose===`vision`})}}),b=l({mutationFn:e=>u.trpcClient.llm.installModel.mutate({nodeId:t,model:e}),onSuccess:()=>{g(!0),v.refetch()}}),x=s({queryKey:Ce,enabled:b.isPending,refetchInterval:b.isPending?Qe:!1,queryFn:()=>u.trpcClient.llm.listRuntimeNodes.query({})}).data?.find(e=>e.nodeId===t)?.status?.download,S=n(()=>{let e=(_.data??[]).map(e=>({value:`catalog:${e.id}`,label:`${e.label} · ${e.quantization} · ${$(e.sizeBytes)}`})),n=(v.data??[]).filter(e=>e.catalogId===void 0&&e.path!==void 0).map(e=>({value:`node:${e.file}`,label:c(`ai.onNode`,`{{file}} · {{size}} · on {{node}}`,{file:e.file,size:$(e.sizeBytes),node:t})})),r=p?.ok===!0?[{value:`custom`,label:`${p.label} · ${$(p.totalBytes)}`}]:[];return[{value:``,label:c(`ai.selectModel`,`Select a model…`)},...e,...n,...r]},[_.data,v.data,p,t,c]),w=e=>{if(e===``){a(null);return}if(e===`custom`){if(p?.ok!==!0)return;a({model:p.model,modelId:p.label,supportsVision:p.purpose===`vision`});return}if(e.startsWith(`catalog:`)){let t=e.slice(8),n=_.data?.find(e=>e.id===t);a({model:{kind:`catalog`,catalogId:t},modelId:t,supportsVision:n?.purpose===`vision`});return}let t=e.slice(5),n=v.data?.find(e=>e.file===t);n?.path!==void 0&&a({model:{kind:`path`,path:n.path},modelId:t,supportsVision:!1})},D=e=>{d.trim()!==``&&y.mutate({ref:d.trim(),...e===void 0?{}:{maxBytes:e}})};return e(`div`,{className:`space-y-3`,children:[i(H,{label:c(`ai.model`,`Model`),required:!0,children:i(ne,{id:`ai-model`,"aria-label":c(`ai.model`,`Model`),value:$e(r),options:S,onChange:e=>w(e.target.value)})}),i(H,{label:c(`ai.hfTitle`,`Add a model from Hugging Face`),description:c(`ai.hfHint`,`Paste a GGUF file URL, or type org/repo — add :QUANT (e.g. unsloth/Qwen3.6-35B-A3B-GGUF:UD-Q4_K_M) when the repo publishes more than one quantization.`),children:e(`div`,{className:`flex gap-2`,children:[i(re,{"aria-label":c(`ai.hfTitle`,`Add a model from Hugging Face`),value:d,onChange:e=>f(e.target.value),placeholder:c(`system.aiModelPicker.unslothQwen3635bA3b`,`unsloth/Qwen3.6-35B-A3B-GGUF:UD-Q4_K_M`),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),D())}}),e(X,{size:`sm`,variant:`secondary`,type:`button`,disabled:d.trim()===``||y.isPending,onClick:()=>D(),children:[y.isPending?i(E,{className:`h-3.5 w-3.5 animate-spin`}):i(P,{className:`h-3.5 w-3.5`}),c(`ai.hfCheck`,`Check`)]})]})}),y.isError&&i(K,{message:y.error instanceof Error?y.error.message:c(`common.error`,`Error`)}),p?.ok===!1&&i(K,{message:p.message,action:e(`div`,{className:`flex flex-wrap items-center gap-1`,children:[(p.candidates??[]).map(e=>i(X,{size:`sm`,variant:`outline`,type:`button`,onClick:()=>{let t=`${d.trim().split(`:`)[0]??``}:${e}`;f(t),y.mutate({ref:t})},children:e},e)),p.requiredBytes!==void 0&&i(X,{size:`sm`,variant:`secondary`,type:`button`,onClick:()=>D(p.requiredBytes),children:c(`ai.hfOverride`,`Install anyway ({{size}})`,{size:$(p.requiredBytes)})})]})}),p?.ok===!0&&e(`div`,{className:`space-y-2 rounded-md border border-border bg-surface p-2.5`,children:[e(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[i(`span`,{className:`text-[11px] font-medium text-foreground`,children:p.label}),i(Y,{variant:p.purpose===`vision`?`info`:`default`,children:p.purpose}),i(Y,{variant:`default`,children:$(p.totalBytes)})]}),p.extraFilenames.length>0&&i(`p`,{className:`text-[10px] text-foreground-subtle`,children:c(`ai.hfExtras`,`Also downloads: {{files}}`,{files:p.extraFilenames.join(`, `)})}),e(`div`,{className:`flex items-center gap-2`,children:[e(X,{size:`sm`,type:`button`,disabled:b.isPending||h,onClick:()=>b.mutate(p.model),children:[b.isPending?i(E,{className:`h-3.5 w-3.5 animate-spin`}):i(C,{className:`h-3.5 w-3.5`}),h?c(`ai.hfInstalled`,`Downloaded`):c(`ai.hfInstall`,`Download to {{node}}`,{node:t})]}),x!==void 0&&i(`span`,{className:`text-[10px] text-foreground-subtle`,children:x.phase===`verifying`?c(`ai.hfVerifying`,`verifying {{file}}…`,{file:x.file}):c(`ai.hfDownloading`,`{{file}} ({{index}}/{{count}}) — {{done}}{{total}}`,{file:x.file,index:x.fileIndex,count:x.fileCount,done:$(x.downloadedBytes),total:x.totalBytes===void 0?``:` / ${$(x.totalBytes)}`})})]}),b.isError&&i(K,{message:b.error instanceof Error?b.error.message:c(`common.error`,`Error`)})]})]})}function tt({value:t,onChange:n}){let{t:r}=Q(),a=T(),o=s({queryKey:Ce,queryFn:()=>a.trpcClient.llm.listRuntimeNodes.query({})});return e(`div`,{children:[i(`div`,{className:`mb-1 text-[11px] font-medium text-foreground`,children:r(`ai.appleNode`,`Mac that runs it`)}),o.isPending&&e(`div`,{className:`flex items-center gap-1.5 text-[11px] text-foreground-subtle`,children:[i(E,{className:`h-3.5 w-3.5 animate-spin`}),r(`ai.appleAsking`,`Asking the nodes…`)]}),o.isError&&i(`p`,{className:`text-[11px] text-danger`,children:o.error instanceof Error?o.error.message:r(`ai.runtimesFailed`,`Failed to read runtime nodes`)}),o.isSuccess&&o.data.length===0&&i(`p`,{className:`text-[11px] text-foreground-subtle`,children:r(`ai.noRuntimes`,`No node advertises the llm-runtime capability.`)}),o.isSuccess&&o.data.length>0&&i(`div`,{role:`radiogroup`,className:`space-y-1.5`,children:o.data.map(a=>{let o=Pe(a),s=o.nodeId===t;return e(`button`,{type:`button`,role:`radio`,"aria-checked":s,disabled:!o.selectable&&!s,onClick:()=>n(o.nodeId),className:`flex w-full items-center justify-between gap-2 rounded-md border px-3 py-2 text-left text-xs transition-colors disabled:cursor-not-allowed disabled:opacity-60 ${s?`border-primary bg-primary/10`:`border-border bg-surface hover:bg-surface-hover`}`,children:[e(`span`,{className:`min-w-0`,children:[i(`span`,{className:`block font-medium text-foreground`,children:o.nodeId}),o.detail!==null&&i(`span`,{className:`block truncate text-[10px] text-foreground-subtle`,children:o.detail})]}),i(Y,{variant:o.tone,children:r(o.labelKey,o.labelDefault)})]},o.nodeId)})}),i(`p`,{className:`mt-1.5 text-[10px] leading-relaxed text-foreground-subtle`,children:r(`ai.appleHint`,`Text only for now — notification titles and summaries. Apple refuses prompts framed as surveillance; when it does, the next profile in the chain answers instead.`)})]})}function nt(e,t){let n=e[t];return typeof n==`string`&&n.length>0?n:null}function rt({providerConfig:e,onProviderConfigChange:t}){return i(tt,{value:nt(e,`nodeId`),onChange:n=>t({...e,nodeId:n})})}function it({providerConfig:e,onProviderConfigChange:t,model:n,onModelChange:r}){let a=I.safeParse(e.model),o=a.success?{model:a.data,modelId:n.id,supportsVision:n.supportsVision}:null;return i(et,{nodeId:nt(e,`nodeId`)??`hub`,value:o,onChange:n=>{if(n===null){let{model:n,...i}=e;t(i),r({id:``,supportsVision:!1});return}t({...e,model:n.model}),r({id:n.modelId,supportsVision:n.supportsVision})}})}var at=new Map([[`ai/apple-node`,rt],[`ai/managed-model`,it]]);function ot(e){return at.get(e)??null}c();function st({kind:e,className:t}){return i(Oe(e.icon),{className:t,"aria-hidden":!0})}function ct({kinds:e,onPick:t,onCancel:r}){let{t:a}=Q(),o=n(()=>Me(e),[e]),s=n(()=>new Map(e.map(e=>[`${e.addonId}:${e.kind}`,e])),[e]);return i(me,{open:!0,onClose:r,title:a(`ai.chooseKind`,`Choose a profile type`),width:`lg`,testId:`ai-kind-picker`,children:i(oe,{emptyMessage:a(`ai.noKinds`,`No AI provider is installed.`),onPick:e=>{let n=s.get(e);n!==void 0&&t(n)},groups:o.map(e=>({id:e.addonId,label:e.addonId,tiles:e.kinds.map(t=>({key:`${e.addonId}:${t.kind}`,label:t.label,testId:`ai-kind-${t.kind}`,icon:i(st,{kind:t,className:`h-5 w-5 text-foreground-subtle`})}))}))})})}function lt(e){return(e?.sections??[]).flatMap(e=>e.fields)}function ut(...e){let t={};for(let n of e)for(let e of lt(n))`default`in e&&e.default!==void 0&&(t[e.key]=e.default);return t}function dt(e){return e==null?!1:typeof e==`string`?e.trim().length>0:!0}function ft(e,t){return lt(e).filter(e=>`required`in e&&e.required===!0&&!dt(t[e.key])).map(e=>`label`in e&&typeof e.label==`string`?e.label:e.key)}var pt={auth:{key:`ai.listAuth`,fallback:`Credentials refused`},network:{key:`ai.listNetwork`,fallback:`Endpoint unreachable`},unsupported:{key:`ai.listUnsupported`,fallback:`No model list`},invalid:{key:`ai.listInvalid`,fallback:`Connection incomplete`}};function mt(e,t){if(t!==null)return{id:t.model,supportsVision:t.supportsVision};let n=e.modelCatalog===`static`&&e.staticModels?.length===1?e.staticModels?.[0]:void 0;return{id:n?.id??``,supportsVision:Ye(e,n).vision}}function ht({kind:t,existing:r,onSave:s,onCancel:c,onChangeKind:p,saving:m,error:h}){let{t:_}=Q(),v=T(),[y,b]=o(r?.name??t.label),[x,S]=o(()=>r===null?ut(t.connectionSchema,t.advancedSchema):{...r.providerConfig}),[C,w]=o(()=>Je(r)),[D,O]=o(()=>mt(t,r)),[A,j]=o(!1),M=t.providerWidgets??[],N=M.filter(e=>e.placement===`connection`),P=M.find(e=>e.placement===`model`)??null,F=n(()=>[...ee(t.connectionSchema)].some(e=>r?.providerConfig[e]===ye),[r,t.connectionSchema]),I=l({mutationFn:()=>v.trpcClient.llm.listModels.mutate({addonId:t.addonId,kind:t.kind,connection:x,...r===null?{}:{profileId:r.id}}),onSuccess:e=>{e.ok&&O(n=>{let r=e.models.find(e=>e.id===n.id);return r===void 0?n:{id:n.id,supportsVision:Ye(t,r).vision}})}}),L=Xe(t,I.data?.ok===!0?I.data.models:null),R=L.find(e=>e.id===D.id),z=Ye(t,R),B=Ke(t.profileFields),te=qe(t.profileFields),V=ft(t.connectionSchema,x),U=M.some(e=>(e.requires??[]).some(e=>!dt(x[e]))),W=t.modelCatalog===`fetch`&&P===null,ie=lt(t.connectionSchema).length>0||N.length>0,G=r!==null&&W&&V.length===0;a(()=>{G&&I.mutate()},[]);let J=e=>{O({id:e,supportsVision:Ye(t,L.find(t=>t.id===e)).vision})},ae=m||y.trim()===``||D.id.trim()===``||V.length>0||U,oe=()=>{s(Ze(t,r,{name:y.trim(),model:D.id.trim(),supportsVision:t.visionEditable?D.supportsVision:!1,common:C,providerConfig:x}))},se=r===null?_(`ai.newProfile`,`New {{kind}} profile`,{kind:t.label}):_(`ai.editProfile`,`Edit {{name}}`,{name:r.name}),le=e=>{let n=ot(e);return n===null?i(K,{variant:`warning`,message:_(`ai.unknownWidget`,`This provider needs an editor part this build does not have ({{id}}).`,{id:e})}):i(n,{descriptor:t,providerConfig:x,onProviderConfigChange:S,model:D,onModelChange:O},e)};return i(me,{open:!0,onClose:c,title:se,error:h,width:`lg`,testId:`ai-profile-editor`,footer:e(u,{children:[V.length>0&&i(Y,{variant:`warning`,children:_(`ai.missingRequired`,`required: {{fields}}`,{fields:V.join(`, `)})}),V.length===0&&U&&i(Y,{variant:`warning`,children:_(`ai.completeProvider`,`complete the provider settings`)}),V.length===0&&!U&&D.id.trim()===``&&i(Y,{variant:`warning`,children:_(`ai.pickModelFirst`,`pick a model`)}),e(X,{size:`sm`,type:`button`,disabled:ae,onClick:oe,children:[m&&i(E,{className:`h-3.5 w-3.5 animate-spin`}),r===null?_(`ai.createProfile`,`Create profile`):_(`ai.saveChanges`,`Save changes`)]})]}),children:e(`div`,{className:g,children:[e(`div`,{className:`flex flex-wrap items-center gap-2`,"data-testid":`ai-editor-provider`,children:[i(st,{kind:t,className:`h-4 w-4 text-foreground-subtle`}),i(`span`,{className:`text-xs font-medium text-foreground`,children:t.label}),i(Y,{variant:`neutral`,children:t.addonId}),p!==void 0&&e(X,{size:`sm`,variant:`ghost`,type:`button`,onClick:p,children:[i(k,{className:`h-3.5 w-3.5`}),_(`ai.changeKind`,`Change type`)]})]}),i(H,{label:_(`ai.name`,`Name`),required:!0,children:i(re,{id:`ai-profile-name`,"aria-label":_(`ai.name`,`Name`),value:y,onChange:e=>b(e.target.value),placeholder:t.label})}),ie&&i(q,{headingId:`ai-editor-connection`,title:_(`ai.sectionConnection`,`Connection`),actions:W?e(X,{size:`sm`,variant:`secondary`,type:`button`,disabled:I.isPending,onClick:()=>I.mutate(),"data-testid":`ai-verify-models`,children:[I.isPending?i(E,{className:`h-3.5 w-3.5 animate-spin`}):i(f,{className:`h-3.5 w-3.5`}),_(`ai.verifyModels`,`Verify & load models`)]}):void 0,children:e(`div`,{className:`p-2 sm:p-3 lg:p-4 space-y-3`,children:[lt(t.connectionSchema).length>0&&i(fe,{bare:!0,schema:t.connectionSchema,values:x,onChange:S}),N.map(e=>le(e.id)),F&&i(`p`,{className:`text-[10px] text-foreground-subtle`,children:_(`ai.secretHint`,`A stored API key is never shown. Leave it as-is to keep it; type a new value to replace it.`)}),I.data?.ok===!0&&i(Y,{variant:`success`,"data-testid":`ai-models-found`,children:_(`ai.modelsFound`,`{{count}} models found`,{count:I.data.models.length})}),I.data?.ok===!1&&i(K,{title:_(pt[I.data.code]?.key??`ai.listNetwork`,pt[I.data.code]?.fallback??`Endpoint unreachable`),message:I.data.message}),I.isError&&i(K,{message:I.error instanceof Error?I.error.message:_(`common.error`,`Error`)})]})}),i(q,{headingId:`ai-editor-model`,title:_(`ai.sectionModel`,`Model`),children:e(`div`,{className:`${d} space-y-3`,children:[P===null?e(u,{children:[L.length>0&&i(ne,{id:`ai-model-pick`,"aria-label":_(`ai.selectModel`,`Select a model…`),value:R===void 0?``:R.id,options:[{value:``,label:_(`ai.selectModel`,`Select a model…`)},...L.map(e=>({value:e.id,label:e.label??e.id}))],onChange:e=>{e.target.value!==``&&J(e.target.value)}}),i(H,{label:_(`ai.customModel`,`Model id`),description:_(`ai.customModelHint`,`Pick one from the list, or type any model id the provider accepts.`),required:!0,children:i(re,{id:`ai-model-id`,"aria-label":_(`ai.customModel`,`Model id`),value:D.id,onChange:e=>{let n=L.find(t=>t.id===e.target.value);O(n===void 0?{...D,id:e.target.value}:{id:e.target.value,supportsVision:Ye(t,n).vision})},placeholder:L[0]?.id??`model-id`})})]}):le(P.id),e(`div`,{className:`flex flex-wrap items-center gap-1.5`,"data-testid":`ai-model-features`,children:[(D.supportsVision||!t.visionEditable&&z.vision)&&i(Y,{variant:`info`,children:_(`ai.featureVision`,`vision`)}),z.tools&&i(Y,{variant:`neutral`,children:_(`ai.featureTools`,`tools`)}),z.streaming&&i(Y,{variant:`neutral`,children:_(`ai.featureStreaming`,`streaming`)})]}),t.visionEditable&&i(H,{orientation:`horizontal`,label:_(`ai.supportsVision`,`Supports vision`),description:_(`ai.supportsVisionHint`,`A vision call against a text-only profile is refused, never downgraded.`),children:i(ce,{checked:D.supportsVision,onCheckedChange:e=>O({...D,supportsVision:e}),"aria-label":_(`ai.supportsVision`,`Supports vision`)})})]})}),B!==null&&i(q,{headingId:`ai-editor-generation`,title:_(`ai.sectionGeneration`,`Generation`),children:i(`div`,{className:`p-2 sm:p-3 lg:p-4`,children:i(fe,{bare:!0,schema:B,values:C,onChange:w})})}),(te!==null||t.advancedSchema!==void 0)&&i(pe,{expanded:A,onExpandedChange:j,header:i(`span`,{className:`text-[11px] font-semibold uppercase tracking-wider text-foreground-subtle`,children:_(`ai.sectionAdvanced`,`Advanced`)}),children:e(`div`,{className:`p-2 sm:p-3 lg:p-4 space-y-3`,children:[te!==null&&i(fe,{bare:!0,schema:te,values:C,onChange:w}),t.advancedSchema!==void 0&&i(fe,{bare:!0,schema:t.advancedSchema,values:x,onChange:S})]})})]})})}c();function gt(t){return[{key:`name`,header:t.t(`ai.colProfile`,`Profile`),render:n=>{let r=t.kindByName.get(n.kind);return e(`span`,{className:`flex items-center gap-2`,children:[i(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-surface`,title:r?.label??n.kind,children:r===void 0?i(`span`,{className:`text-xs text-foreground-subtle`,children:`?`}):i(st,{kind:r,className:`h-4 w-4 text-foreground-subtle`})}),e(`span`,{className:`min-w-0`,children:[i(`span`,{className:`block truncate font-medium text-foreground`,children:n.name}),t.testResult?.id===n.id&&i(`span`,{className:`block truncate ${t.testResult.ok?`text-success`:`text-danger`}`,children:t.testResult.text})]})]})}},{key:`kind`,header:t.t(`ai.colKind`,`Kind`),nowrap:!0,render:e=>i(`span`,{className:`text-foreground-muted`,children:t.kindByName.get(e.kind)?.label??e.kind})},{key:`model`,header:t.t(`ai.colModel`,`Model`),render:e=>i(`span`,{className:`text-foreground`,children:e.model})},{key:`vision`,header:t.t(`ai.colVision`,`Vision`),align:`center`,nowrap:!0,render:e=>e.supportsVision?i(Y,{variant:`info`,style:`outline`,children:t.t(`ai.vision`,`vision`)}):i(`span`,{className:`text-foreground-subtle`,children:`—`})},{key:`node`,header:t.t(`ai.colNode`,`Node`),nowrap:!0,render:e=>typeof e.providerConfig.nodeId==`string`?i(Y,{variant:`default`,children:e.providerConfig.nodeId}):i(`span`,{className:`text-foreground-subtle`,children:`—`})},{key:`enabled`,header:t.t(`ai.colOn`,`On`),align:`center`,nowrap:!0,render:e=>i(ce,{checked:e.enabled,onCheckedChange:()=>t.onToggle(e),"aria-label":Z.t(`system.aiProfilesTab.toggle`,`toggle {{name}}`,{name:e.name})})},{key:`actions`,header:``,align:`right`,nowrap:!0,render:n=>e(`span`,{className:`flex items-center justify-end gap-1`,children:[i(X,{size:`sm`,variant:`ghost`,type:`button`,onClick:()=>t.onTest(n),"aria-label":t.t(`ai.test`,`Test`),title:t.t(`ai.test`,`Test`),children:t.testingId===n.id?i(E,{className:`h-3.5 w-3.5 animate-spin`}):i(B,{className:`h-3.5 w-3.5`})}),i(X,{size:`sm`,variant:`ghost`,type:`button`,disabled:!t.kindByName.has(n.kind),onClick:()=>t.onEdit(n),"aria-label":t.t(`common.edit`,`Edit`),title:t.t(`common.edit`,`Edit`),children:i(S,{className:`h-3.5 w-3.5`})}),i(X,{size:`sm`,variant:`ghost`,type:`button`,onClick:()=>t.onDelete(n),"aria-label":t.t(`common.delete`,`Delete`),title:t.t(`common.delete`,`Delete`),children:i(h,{className:`h-3.5 w-3.5 text-danger`})})]})}]}function _t(){let{t}=Q(),c=T(),{state:u,openEdit:f,close:p}=le(),m=M(),[h,_]=o(null),[v,y]=o(null),[b,x]=o(null),S=s({queryKey:be,queryFn:()=>c.trpcClient.llm.listProfiles.query({})}),C=s({queryKey:xe,queryFn:async()=>(await c.trpcClient.llm.listProfileKinds.query({})).map(({connectionSchema:e,advancedSchema:t,...n})=>({...n,connectionSchema:e,...t===void 0?{}:{advancedSchema:t}}))}),w=()=>{S.refetch()},E=r(()=>{_(null),x(null),p()},[p]);a(()=>{u.mode===`closed`&&_(null)},[u.mode]);let D=l({mutationFn:e=>c.trpcClient.llm.upsertProfile.mutate({profile:e}),onSuccess:()=>{E(),w()},onError:e=>x(e instanceof Error?e.message:t(`ai.saveFailed`,`Save failed`))}),O=l({mutationFn:e=>c.trpcClient.llm.deleteProfile.mutate({addonId:e.addonId,profileId:e.id}),onSuccess:w}),k=l({mutationFn:e=>c.trpcClient.llm.testProfile.mutate({addonId:e.addonId,profileId:e.id}),onSuccess:(e,t)=>y({id:t.id,ok:e.ok,text:e.ok?Z.t(`system.aiProfilesTab.testOk`,{text:e.text,tokens:e.usage.outputTokens,ms:e.latencyMs}):`${e.code}: ${e.message}`})}),A=S.data??[],N=n(()=>C.data??[],[C.data]),P=n(()=>{let e=new Map;for(let t of N)e.set(t.kind,t);return e},[N]),F=u.mode===`edit`?A.find(e=>e.id===u.id)??null:null,ee=F===null?null:P.get(F.kind)??null,I=u.mode===`new`&&h===null,L=u.mode===`new`?h:ee,R=u.mode===`edit`?F:null,z=L!==null&&(u.mode===`new`||R!==null),B=async e=>{await m({title:t(`ai.deleteProfileTitle`,`Delete profile?`),message:t(`ai.deleteProfileMessage`,`Delete "{{name}}". Features that name it will no longer get an answer from it.`,{name:e.name}),confirmLabel:t(`common.delete`,`Delete`),variant:`danger`})&&O.mutate(e)};return e(`div`,{className:g,children:[i(vt,{profiles:A}),i(q,{headingId:`ai-profiles-list`,title:t(`ai.profilesList`,`Profiles`),children:S.isPending?e(`div`,{className:`${d} space-y-2`,"data-testid":`ai-profiles-loading`,children:[i(G,{className:`h-8 w-full`}),i(G,{className:`h-8 w-full`}),i(G,{className:`h-8 w-full`})]}):S.isError?i(`div`,{className:d,children:i(K,{title:t(`ai.loadFailed`,`Failed to load profiles`),message:S.error instanceof Error?S.error.message:t(`common.error`,`Error`),onRetry:()=>void S.refetch()})}):A.length===0?i(J,{icon:j,title:t(`ai.noProfilesTitle`,`No AI profiles yet`),description:t(`ai.noProfiles`,`No AI profiles yet. Click "Add profile" to configure one.`)}):i(V,{columns:gt({kindByName:P,testResult:v,testingId:k.isPending?k.variables?.id??null:null,t,onToggle:e=>D.mutate({...e,enabled:!e.enabled}),onTest:e=>k.mutate(e),onEdit:e=>{P.has(e.kind)&&(x(null),_(null),f(e.id))},onDelete:e=>void B(e)}),rows:A,rowKey:e=>e.id,minWidthPx:760,bordered:!1,maxBodyHeight:de})}),I&&i(ct,{kinds:N,onCancel:E,onPick:e=>{x(null),_(e)}}),z&&L!==null&&i(ht,{kind:L,existing:R,saving:D.isPending,error:b,onSave:e=>D.mutate(e),onCancel:E,...u.mode===`new`?{onChangeKind:()=>{x(null),_(null)}}:{}})]})}function vt({profiles:t}){let{t:n}=Q(),r=T(),a=s({queryKey:Se,queryFn:()=>r.trpcClient.llm.getDefaults.query({})}),o=l({mutationFn:e=>r.trpcClient.llm.setDefault.mutate({selector:{purpose:e.purpose},profileId:e.profileId}),onSuccess:()=>{a.refetch()}}),c=e=>(a.data??[]).find(t=>`purpose`in t.selector&&t.selector.purpose===e)?.profileId??``,u=e=>e===`vision`?n(`ai.defaultVision`,`Default vision profile`):n(`ai.defaultText`,`Default text profile`);return i(q,{headingId:`ai-profiles-defaults`,title:n(`ai.defaultsTitle`,`Defaults`),children:i(`div`,{className:`${d} grid gap-4 sm:grid-cols-2`,children:Ee.map(({purpose:r,visionOnly:a})=>{let s=a?t.filter(e=>e.supportsVision):t,l=c(r),d=t.find(e=>e.id===l);return e(`div`,{children:[i(ae,{className:`mb-1 block`,htmlFor:`llm-default-${r}`,children:u(r)}),i(ne,{id:`llm-default-${r}`,"aria-label":u(r),value:l,onChange:e=>o.mutate({purpose:r,profileId:e.target.value===``?null:e.target.value}),options:[{value:``,label:n(`ai.none`,`None`)},...l!==``&&!s.some(e=>e.id===l)?[{value:l,label:d?.name??l}]:[],...s.map(e=>({value:e.id,label:`${e.name} · ${e.model}`}))]}),l!==``&&d===void 0&&i(`p`,{className:`mt-1 text-xs text-danger`,children:n(`ai.defaultMissing`,`This default names a profile that no longer exists.`)}),d!==void 0&&!d.enabled&&i(`p`,{className:`mt-1 text-xs text-warning`,children:n(`ai.defaultDisabled`,`This default profile is disabled — callers resolve to no profile.`)}),o.error!=null&&i(`p`,{className:`mt-1 text-xs text-danger`,children:String(o.error)})]},r)})})})}c();var yt=5e3;function bt(e){return Z.t(`system.aiRuntimes.sizeGb`,{value:(e/1e9).toFixed(1)})}function xt(){let{t}=Q(),r=T(),a=s({queryKey:Ce,refetchInterval:yt,queryFn:()=>r.trpcClient.llm.listRuntimeNodes.query({})}),o=n(()=>[{key:`node`,header:t(`ai.colNode`,`Node`),render:e=>i(`span`,{className:`font-medium text-foreground`,children:e.nodeId})},{key:`state`,header:t(`ai.colState`,`State`),nowrap:!0,render:n=>e(`span`,{className:`flex items-center gap-1.5`,children:[i(Y,{variant:Re(n),children:t(Le(n))}),n.status?.downloadProgress!==void 0&&i(Y,{variant:`info`,children:`${String(Math.round(n.status.downloadProgress*100))}%`})]})},{key:`model`,header:t(`ai.colModel`,`Model`),render:e=>i(`span`,{className:`text-foreground`,children:e.status?.modelId??`—`})},{key:`disk`,header:t(`ai.colDisk`,`On disk`),align:`right`,nowrap:!0,render:e=>i(`span`,{className:`tabular-nums text-foreground-muted`,children:e.disk===void 0?`—`:bt(e.disk.modelsBytes)})},{key:`features`,header:t(`ai.colFeature`,`Feature`),render:n=>{let r=ze(n);if(r.length===0)return i(`span`,{className:`text-foreground-subtle`,children:`—`});let a=r.flatMap(e=>e.detail===null?[]:[e.detail]);return e(`span`,{className:`flex flex-col items-start gap-0.5`,children:[i(`span`,{className:`flex flex-wrap gap-1`,children:r.map(e=>i(Y,{variant:e.tone,children:t(e.labelKey)},e.id))}),a.length>0&&i(`span`,{className:`text-foreground-subtle`,children:a.join(` · `)})]})}},{key:`error`,header:t(`ai.colError`,`Error`),render:e=>e.error===void 0?i(`span`,{className:`text-foreground-subtle`,children:`—`}):i(`span`,{className:`text-danger`,children:e.error})}],[t]),c=a.data??[];return i(q,{headingId:`ai-runtimes-list`,title:t(`ai.runtimesList`,`Nodes`),children:a.isPending?e(`div`,{className:`${d} space-y-2`,"data-testid":`ai-runtimes-loading`,children:[i(G,{className:`h-8 w-full`}),i(G,{className:`h-8 w-full`})]}):a.isError?i(`div`,{className:d,children:i(K,{title:t(`ai.runtimesFailed`,`Failed to read runtime nodes`),message:a.error instanceof Error?a.error.message:t(`common.error`,`Error`),onRetry:()=>void a.refetch()})}):c.length===0?i(J,{icon:w,title:t(`ai.noRuntimesTitle`,`No runtime nodes`),description:t(`ai.noRuntimes`,`No node advertises the llm-runtime capability.`)}):i(V,{columns:o,rows:c,rowKey:e=>e.nodeId,minWidthPx:760,bordered:!1,maxBodyHeight:de})})}var St=b(`/addon/ai/test-chat`),Ct=b(`/addon/ai/test-chat/chats`),wt=6e5;function Tt(e){let t=e.firstTokenTimeoutMs;if(!(typeof t!=`number`||!Number.isFinite(t)||t<=0))return Math.min(Math.round(t),wt)}function Et(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Dt(e){if(!Et(e))return null;let t=e.kind;return t!==`snapshot`&&t!==`track`||typeof e.mimeType!=`string`||typeof e.sizeBytes!=`number`?null:{kind:t,mimeType:e.mimeType,sizeBytes:e.sizeBytes,...typeof e.mediaKind==`string`?{mediaKind:e.mediaKind}:{},...typeof e.capturedAt==`number`?{capturedAt:e.capturedAt}:{},...typeof e.thumbnailBase64==`string`?{thumbnailBase64:e.thumbnailBase64}:{}}}var Ot=[`resolving-image`,`connecting`,`first-token-wait`,`streaming`];function kt(e){let t;try{t=JSON.parse(e)}catch{return null}if(!Et(t))return null;switch(t.kind){case`status`:{let e=Ot.find(e=>e===t.phase);return e===void 0?null:{kind:`status`,phase:e}}case`meta`:return typeof t.profileName!=`string`||typeof t.model!=`string`?null:{kind:`meta`,profileName:t.profileName,model:t.model,mediaSent:Dt(t.mediaSent),streamed:t.streamed===!0,firstTokenTimeoutMs:typeof t.firstTokenTimeoutMs==`number`?t.firstTokenTimeoutMs:0};case`token`:return typeof t.text==`string`?{kind:`token`,text:t.text}:null;case`done`:return{kind:`done`,inputTokens:typeof t.inputTokens==`number`?t.inputTokens:0,outputTokens:typeof t.outputTokens==`number`?t.outputTokens:0,latencyMs:typeof t.latencyMs==`number`?t.latencyMs:0,truncated:t.truncated===!0,...typeof t.conversationId==`string`?{conversationId:t.conversationId}:{}};case`error`:return{kind:`error`,code:typeof t.code==`string`?t.code:`adapter-error`,message:typeof t.message==`string`?t.message:Z.t(`helpers.aiTestChat.providerError`)};default:return null}}async function*At(e){let t=e.getReader(),n=new TextDecoder,r=``;try{for(;;){let{done:e,value:i}=await t.read();if(e)break;r+=n.decode(i,{stream:!0});let a=r.indexOf(`
2
- `);for(;a>=0;){let e=r.slice(0,a).trim();if(r=r.slice(a+1),e.length>0){let t=kt(e);t!==null&&(yield t)}a=r.indexOf(`
3
- `)}}let e=r.trim();if(e.length>0){let t=kt(e);t!==null&&(yield t)}}finally{t.releaseLock()}}function jt(e){return e.filter(e=>e.failed!==!0&&e.content.length>0).map(e=>({role:e.role,content:e.content}))}function Mt(e){return e.thumbnailBase64===void 0||e.thumbnailBase64.length===0?null:`data:${e.mimeType};base64,${e.thumbnailBase64}`}function Nt(e){return e.messages.map((t,n)=>{let r=t.mediaSent??void 0;return{id:`${e.id}-${String(n)}`,role:t.role,content:t.content,...t.attachment===void 0?{}:{attachmentRef:t.attachment,attachmentKind:t.attachment.kind},...r===void 0?{}:{attachment:r}}})}function Pt(e){let t=e.sizeBytes<1024*1024?`${(e.sizeBytes/1024).toFixed(0)} KB`:`${(e.sizeBytes/(1024*1024)).toFixed(1)} MB`,n=[e.kind===`snapshot`?`camera snapshot`:`track best-shot`,t];return e.mediaKind!==void 0&&n.push(e.mediaKind),e.capturedAt!==void 0&&n.push(new Date(e.capturedAt).toLocaleTimeString()),n.join(` · `)}function Ft(e,t){switch(e){case`resolving-image`:return Z.t(`helpers.aiTestChat.phaseImage`);case`connecting`:return Z.t(`helpers.aiTestChat.phaseConnecting`);case`first-token-wait`:return t>0?Z.t(`helpers.aiTestChat.phaseWaitUpTo`,{seconds:Math.round(t/1e3)}):Z.t(`helpers.aiTestChat.phaseWait`);case`streaming`:return Z.t(`helpers.aiTestChat.phaseAnswering`)}}c();var It=[`pipelineAnalytics`,`listRecentTracks`,`ai-test`],Lt=360*60*1e3,Rt=40,zt=160,Bt={phase:`connecting`,firstTokenTimeoutMs:0,text:``,mediaSent:null};function Vt(){let{t:c}=Q(),l=T(),[u,f]=o(``),[p,m]=o(``),[v,y]=o(``),[b,S]=o([]),[C,w]=o(null),[E,O]=o(`none`),[k,A]=o(`throwaway`),[j,M]=o(null),[P,F]=o([]),[ee,I]=o(null),[L,R]=o(null),z=t(null);a(()=>()=>z.current?.abort(),[]);let V=r(async()=>{let e=await fetch(Ct,{credentials:`same-origin`});e.ok&&F((await e.json()).chats??[])},[]);a(()=>{k===`persistent`&&V()},[k,V]);let H=s({queryKey:be,queryFn:()=>l.trpcClient.llm.listProfiles.query({})}),U=n(()=>(H.data??[]).filter(e=>e.enabled),[H.data]),W=U.find(e=>e.id===u)??null,G=L!==null,J=r(async(e,t)=>{let n=new AbortController;z.current=n,I(null);let r=Tt(W??{});R({...Bt,firstTokenTimeoutMs:r??0});let i=``,a=null,o,s=null,l=null,d;try{let c=await fetch(St,{method:`POST`,headers:{"content-type":`application/json`},credentials:`same-origin`,signal:n.signal,body:JSON.stringify({profileId:u,messages:e,...p.trim()===``?{}:{system:p.trim()},...t===void 0?{}:{attachment:t},...r===void 0?{}:{firstTokenTimeoutMs:r},...k===`persistent`?{persist:!0,...j===null?{}:{conversationId:j}}:{}})});if(!c.ok||c.body===null){let e=await c.text().catch(()=>``);throw Error(e.length>0?e:`HTTP ${String(c.status)}`)}for await(let e of At(c.body))switch(e.kind){case`status`:R(t=>({...t??Bt,phase:e.phase}));break;case`meta`:a=e.mediaSent,o=e.model,R(t=>({...t??Bt,firstTokenTimeoutMs:e.firstTokenTimeoutMs,mediaSent:e.mediaSent}));break;case`token`:i+=e.text,R(e=>({...e??Bt,text:i}));break;case`done`:l={outputTokens:e.outputTokens,latencyMs:e.latencyMs},d=e.conversationId;break;case`error`:s=`${e.code}: ${e.message}`;break}}catch(e){n.signal.aborted||I(e instanceof Error?e.message:c(`common.error`,`Error`))}finally{z.current=null,R(null)}d!==void 0&&(M(d),V());let f=n.signal.aborted&&i.length>0;s===null&&i.length===0&&!f||S(e=>[...e,{id:`a-${String(Date.now())}`,role:`assistant`,content:s??i,...s===null?{}:{failed:!0},...a===null?{}:{attachment:a},...o!==void 0&&s===null?{model:o}:{},...l===null?{}:l}])},[k,j,W,u,V,p,c]),oe=r(()=>{let e=v.trim();if(e===``||u===``||G)return;let t={id:`u-${String(Date.now())}`,role:`user`,content:e,...C===null?{}:{attachmentLabel:C.label,attachmentKind:C.ref.kind}},n=[...b,t];S(n),y(``);let r=C?.ref;w(null),O(`none`),J(k===`persistent`&&j!==null?[{role:`user`,content:e}]:jt(n),r)},[k,j,v,C,u,J,G,b]),se=()=>z.current?.abort(),ce=()=>{z.current?.abort(),S([]),w(null),y(``),I(null),R(null),M(null)},le=async e=>{z.current?.abort();let t=await fetch(`${Ct}/${e}`,{credentials:`same-origin`});if(!t.ok)return;let n=await t.json();M(e),S(Nt(n)),R(null),I(null)};return e(`div`,{className:g,children:[i(q,{headingId:`ai-test-setup`,title:c(`ai.testSetup`,`Setup`),children:e(`div`,{className:`${d} space-y-3`,children:[e(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[e(`div`,{children:[i(ae,{className:`mb-1 block`,htmlFor:`ai-test-profile`,children:c(`ai.profile`,`Profile`)}),i(ne,{id:`ai-test-profile`,value:u,onChange:e=>f(e.target.value),options:[{value:``,label:c(`ai.selectProfile`,`Select a profile…`)},...U.map(e=>({value:e.id,label:`${e.name} · ${e.model}${e.supportsVision?` · vision`:``}`}))]}),U.length===0&&!H.isLoading&&i(`p`,{className:`mt-1 text-xs text-foreground-subtle`,children:c(`ai.noEnabledProfiles`,`No enabled profile. Add one on the Profiles tab.`)})]}),e(`div`,{children:[i(ae,{className:`mb-1 block`,htmlFor:`ai-test-system`,children:c(`ai.systemPrompt`,`System prompt (optional)`)}),i(re,{id:`ai-test-system`,value:p,onChange:e=>m(e.target.value),placeholder:c(`ai.systemPlaceholder`,`Answer in one short sentence.`)})]})]}),i(ue,{label:c(`ai.chatMode`,`Conversation mode`),value:k,options:[{value:`throwaway`,label:c(`ai.throwawayMode`,`Throwaway`)},{value:`persistent`,label:c(`ai.saveConversation`,`Save conversation`)}],onChange:e=>{A(e),e===`throwaway`&&M(null)}}),k===`persistent`&&e(`div`,{className:`space-y-2`,children:[i(`p`,{className:`text-xs text-foreground-subtle`,children:c(`ai.testSubtitlePersistent`,`Conversations are saved for you and can be reopened. Throwaway mode is still available.`)}),e(X,{size:`sm`,variant:`secondary`,type:`button`,onClick:ce,children:[i(te,{className:`h-3.5 w-3.5`}),c(`ai.newChat`,`New chat`)]}),P.length>0&&i(`div`,{className:`max-h-36 divide-y divide-border overflow-y-auto rounded-md border border-border`,children:P.map(e=>i(`button`,{type:`button`,onClick:()=>void le(e.id),className:`flex w-full px-2.5 py-1.5 text-left text-xs hover:bg-surface-hover ${e.id===j?`bg-primary/10`:``}`,children:i(`span`,{className:`min-w-0 flex-1 truncate text-foreground`,children:e.title})},e.id))})]}),i(`p`,{className:`text-xs text-foreground-subtle`,children:c(`ai.streamNote`,`The answer streams as the model produces it. A cold model can take a while to load — the status line says which phase it is in.`)}),W!==null&&!W.supportsVision&&i(`p`,{className:`text-xs text-warning`,children:c(`ai.notVision`,`This profile is not vision-capable — an attached image will be refused before anything is read.`)})]})}),ee!==null&&i(K,{title:c(`ai.chatFailed`,`The test call failed`),message:ee}),e(q,{headingId:`ai-test-conversation`,title:c(`ai.testConversation`,`Conversation`),actions:e(X,{size:`sm`,variant:`ghost`,type:`button`,disabled:b.length===0&&C===null,onClick:ce,children:[i(h,{className:`h-3.5 w-3.5`}),c(`ai.clearChat`,`Clear`)]}),children:[i(Ht,{turns:b,live:L}),e(`div`,{className:`${d} space-y-2 border-t border-border`,children:[C!==null&&e(`div`,{className:`flex items-center gap-2 rounded-md border border-border bg-background px-2.5 py-1.5`,children:[C.ref.kind===`snapshot`?i(_,{className:`h-3.5 w-3.5 text-foreground-subtle`}):i(x,{className:`h-3.5 w-3.5 text-foreground-subtle`}),i(`span`,{className:`min-w-0 flex-1 truncate text-xs text-foreground`,children:C.label}),i(ie,{size:`sm`,variant:`ghost`,type:`button`,icon:D,"aria-label":c(`ai.removeAttachment`,`Remove attachment`),onClick:()=>w(null)})]}),e(`div`,{className:`flex flex-wrap items-center gap-2`,children:[e(X,{size:`sm`,variant:E===`snapshot`?`primary`:`outline`,type:`button`,onClick:()=>O(E===`snapshot`?`none`:`snapshot`),children:[i(_,{className:`h-3.5 w-3.5`}),c(`ai.attachSnapshot`,`Camera snapshot`)]}),e(X,{size:`sm`,variant:E===`track`?`primary`:`outline`,type:`button`,onClick:()=>O(E===`track`?`none`:`track`),children:[i(x,{className:`h-3.5 w-3.5`}),c(`ai.attachTrack`,`Recent track`)]})]}),E===`snapshot`&&i(Gt,{onPick:(e,t)=>{w({ref:{kind:`snapshot`,deviceId:e.id},label:c(`ai.snapshotOf`,`Snapshot of {{name}}`,{name:t})}),O(`none`)}}),E===`track`&&i(qt,{onPick:(e,t)=>{w({ref:{kind:`track`,trackId:e.trackId,deviceId:e.deviceId},label:c(`ai.trackOf`,`{{class}} on {{name}}`,{class:e.label??e.className,name:t})}),O(`none`)}}),e(`div`,{className:`flex items-center gap-2`,children:[i(re,{value:v,onChange:e=>y(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),oe())},placeholder:c(`ai.messagePlaceholder`,`Ask the model something…`),"aria-label":c(`ai.message`,`Message`)}),G?e(X,{size:`sm`,variant:`secondary`,type:`button`,onClick:se,children:[i(N,{className:`h-3.5 w-3.5`}),c(`ai.stop`,`Stop`)]}):e(X,{size:`sm`,type:`button`,disabled:v.trim()===``||u===``,onClick:oe,children:[i(B,{className:`h-3.5 w-3.5`}),c(`ai.send`,`Send`)]})]})]})]})]})}function Ht({turns:t,live:n}){let{t:r}=Q();return t.length===0&&n===null?i(J,{icon:z,title:r(`ai.chatEmptyTitle`,`No messages yet`),description:r(`ai.chatEmpty`,`Pick a profile, optionally attach a camera snapshot or a recent track, and send a message. Nothing here is saved.`)}):e(`div`,{className:`max-h-[50vh] space-y-2 overflow-y-auto ${d}`,children:[t.map(e=>i(Ut,{turn:e},e.id)),n!==null&&e(`div`,{className:`space-y-1`,children:[n.mediaSent!==null&&i(Wt,{attachment:n.mediaSent}),n.text.length>0&&i(Ut,{turn:{id:`live`,role:`assistant`,content:n.text},streaming:!0}),e(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[i(E,{className:`h-3.5 w-3.5 animate-spin`}),Ft(n.phase,n.firstTokenTimeoutMs)]})]})]})}function Ut({turn:t,streaming:n=!1}){let{t:r}=Q(),a=t.role===`user`,o=t.failed===!0?`border-danger/40 bg-danger/10`:`border-border bg-surface`;return i(`div`,{className:`flex ${a?`justify-end`:`justify-start`}`,children:e(`div`,{className:`max-w-[85%] rounded-lg border px-3 py-2 ${a?`border-primary/40 bg-primary/10`:o}`,children:[e(`p`,{className:`whitespace-pre-wrap break-words text-xs text-foreground`,children:[t.content,n&&i(`span`,{className:`ml-0.5 animate-pulse text-primary`,children:`▌`})]}),t.attachment!==void 0&&i(Wt,{attachment:t.attachment}),t.attachmentLabel!==void 0&&e(`p`,{className:`mt-1 flex items-center gap-1 text-[10px] text-foreground-subtle`,children:[t.attachmentKind===`track`?i(x,{className:`h-3 w-3`}):i(_,{className:`h-3 w-3`}),t.attachmentLabel]}),t.attachment!==void 0&&e(`p`,{className:`mt-1 flex items-center gap-1 text-[10px] text-foreground-subtle`,children:[t.attachment.kind===`snapshot`?i(_,{className:`h-3 w-3`}):i(x,{className:`h-3 w-3`}),Pt(t.attachment)]}),t.model!==void 0&&i(`p`,{className:`mt-1 text-[10px] text-foreground-subtle`,children:r(`system.aiTestChat.tokMs`,`{{model}} · {{value2}} tok · {{value3}} ms`,{model:t.model,value2:String(t.outputTokens??0),value3:String(t.latencyMs??0)})})]})})}function Wt({attachment:e}){let{t}=Q(),n=Mt(e);return n===null?null:i(`img`,{src:n,alt:t(`system.aiTestChat.sentToTheModel`,`sent to the model`),className:`mt-1 max-h-32 rounded-md border border-border object-contain`})}function Gt({onPick:e}){let{t}=Q(),n=U({isCamera:!0,projection:`slim`}),r=(n.data??[]).filter(e=>!e.disabled);return n.isLoading?i(E,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):r.length===0?i(`p`,{className:`text-[11px] text-foreground-subtle`,children:t(`ai.noCameras`,`No camera found.`)}):i(`div`,{className:`grid max-h-56 grid-cols-2 gap-2 overflow-y-auto sm:grid-cols-4`,children:r.map(t=>i(Kt,{device:t,onPick:e},t.id))})}function Kt({device:t,onPick:n}){let{t:r}=Q(),a=se(t,`compact`),{src:o}=m(t.id,{width:zt});return e(`button`,{type:`button`,onClick:()=>n(t,a),className:`overflow-hidden rounded-md border border-border bg-surface text-left transition-colors hover:border-primary/50`,children:[i(`span`,{className:`block aspect-video w-full bg-background-elevated`,children:o!==null&&i(`img`,{src:o,alt:``,className:`h-full w-full object-cover`,loading:`lazy`})}),e(`span`,{className:`flex items-center gap-1 px-2 py-1`,children:[!t.online&&i(Y,{variant:`warning`,children:r(`common.off`)}),i(`span`,{className:`truncate text-[10px] text-foreground`,children:a})]})]})}function qt({onPick:t}){let{t:r}=Q(),a=T(),o=U({isCamera:!0,projection:`slim`}),c=n(()=>(o.data??[]).map(e=>e.id),[o.data]),l=n(()=>{let e=new Map;for(let t of o.data??[])e.set(t.id,t.name);return e},[o.data]),u=s({queryKey:[...It,c.length],enabled:c.length>0,queryFn:()=>a.trpcClient.pipelineAnalytics.listRecentTracks.query({deviceIds:[...c],since:Date.now()-Lt,limit:Rt,projection:`slim`})});if(o.isLoading||u.isLoading)return i(E,{className:`h-4 w-4 animate-spin text-foreground-subtle`});let d=u.data?.tracks??[];return d.length===0?i(`p`,{className:`text-[11px] text-foreground-subtle`,children:r(`ai.noTracks`,`No track in the last 6 hours.`)}):i(`div`,{className:`max-h-56 divide-y divide-border overflow-y-auto rounded-md border border-border`,children:d.map(n=>e(`button`,{type:`button`,onClick:()=>t(n,l.get(n.deviceId)??String(n.deviceId)),className:`flex w-full items-center gap-2 px-2.5 py-1.5 text-left text-[11px] hover:bg-surface-hover`,children:[i(x,{className:`h-3.5 w-3.5 shrink-0 text-foreground-subtle`}),i(`span`,{className:`min-w-0 flex-1 truncate text-foreground`,children:n.label??n.className}),i(`span`,{className:`shrink-0 text-foreground-subtle`,children:l.get(n.deviceId)??n.deviceId}),i(`span`,{className:`shrink-0 text-foreground-subtle`,children:new Date(n.lastSeen).toLocaleTimeString()})]},n.trackId))})}c();var Jt=1440*60*1e3,Yt=[1,7,30,90];function Xt(){let{t}=Q(),r=T(),[a,c]=o(7),l=n(()=>{let e=new Date;return e.setHours(0,0,0,0),e.getTime()-(a-1)*Jt},[a]),u=s({queryKey:be,queryFn:()=>r.trpcClient.llm.listProfiles.query({})}),f=s({queryKey:[...Te,a],queryFn:()=>r.trpcClient.llm.getUsage.query({since:l})}),p=n(()=>{let e=new Map;for(let t of u.data??[])e.set(t.id,t.name);return e},[u.data]),m=n(()=>[{key:`day`,header:t(`ai.colDay`,`Day`),nowrap:!0,render:e=>i(`span`,{className:`tabular-nums`,children:e.day})},{key:`consumer`,header:t(`ai.colConsumer`,`Consumer`),nowrap:!0,render:e=>i(`span`,{className:`text-foreground`,children:e.consumer})},{key:`profile`,header:t(`ai.colProfile`,`Profile`),render:e=>i(`span`,{className:`text-foreground`,children:p.get(e.profileId)??e.profileId})},{key:`calls`,header:t(`ai.colCalls`,`Calls`),align:`right`,nowrap:!0,render:e=>i(`span`,{className:`tabular-nums`,children:String(e.calls)})},{key:`okErr`,header:t(`ai.colOkErr`,`OK / err`),align:`right`,nowrap:!0,render:e=>i(`span`,{className:`tabular-nums ${e.errorCalls>0?`text-danger`:``}`,children:`${String(e.okCalls)} / ${String(e.errorCalls)}`})},{key:`tokens`,header:t(`ai.colTokens`,`In / out tok`),align:`right`,nowrap:!0,render:e=>i(`span`,{className:`tabular-nums`,children:`${String(e.inputTokens)} / ${String(e.outputTokens)}`})},{key:`latency`,header:t(`ai.colAvgMs`,`Avg ms`),align:`right`,nowrap:!0,render:e=>i(`span`,{className:`tabular-nums`,children:String(Math.round(e.avgLatencyMs))})}],[p,t]),h=f.data??[],g=i(`div`,{className:`w-36`,children:i(ne,{"aria-label":t(`ai.window`,`Window`),value:String(a),options:Yt.map(e=>({value:String(e),label:t(`ai.lastDays`,`Last {{days}} days`,{days:e})})),onChange:e=>c(Number(e.target.value))})});return i(q,{headingId:`ai-usage-list`,title:t(`ai.usageList`,`Rollup`),actions:g,children:f.isPending?e(`div`,{className:`${d} space-y-2`,"data-testid":`ai-usage-loading`,children:[i(G,{className:`h-8 w-full`}),i(G,{className:`h-8 w-full`}),i(G,{className:`h-8 w-full`})]}):f.isError?i(`div`,{className:d,children:i(K,{title:t(`ai.usageFailed`,`Failed to read usage`),message:f.error instanceof Error?f.error.message:t(`common.error`,`Error`),onRetry:()=>void f.refetch()})}):h.length===0?i(J,{icon:y,title:t(`ai.noUsage`,`No AI calls in this window.`)}):i(V,{columns:m,rows:h,rowKey:e=>`${e.day}|${e.consumer}|${e.profileId}`,minWidthPx:720,bordered:!1,maxBodyHeight:de})})}var Zt=`llm`,Qt=[`profiles`,`runtimes`,`usage`,`test`],$t=[`new`,`edit`];function en(e){return Qt.some(t=>t===e)}function tn(){let{t}=Q(),n=W(Zt),[r]=ge(),{openNew:a}=le(),o=he(`/system/ai`,{t,isAdmin:!0})??{icon:j,title:t(`system.ai`,`AI`)};if(n!==`present`)return i(ve,{icon:o.icon,title:o.title,children:i(nn,{presence:n})});let s=r.get(`tab`),c=en(s)?s:`profiles`,l={profiles:t(`ai.profilesSubtitle`,`One row = one usable model endpoint. The defaults below decide who answers when a feature names no profile.`),runtimes:t(`ai.runtimesSubtitle`,`Nodes advertising the llm-runtime capability: what each has loaded, what it is downloading, and how much model data sits on its disk.`),usage:t(`ai.usageSubtitle`,`Server-side rollup per day, consumer and profile — never raw call rows. Errors are counted, so a profile that always fails is visible here before a feature reports it.`),test:t(`ai.testSubtitle`,`A throwaway conversation with one profile. Attach a live camera snapshot or a recent track to check the model can actually read a picture. Nothing is saved — only the usage row.`)},u=c===`profiles`?e(X,{size:`sm`,type:`button`,"data-testid":`ai-add-profile`,onClick:a,children:[i(p,{className:`h-3.5 w-3.5`}),t(`ai.addProfile`,`Add profile`)]}):void 0;return i(_e,{icon:o.icon,title:o.title,subtitle:l[c],actions:u,defaultSection:`profiles`,sectionsLabel:`${o.title} sections`,sections:[{id:`profiles`,label:t(`ai.tabProfiles`,`Profiles`),content:i(_t,{}),ownedParams:$t},{id:`runtimes`,label:t(`ai.tabRuntimes`,`Runtimes`),content:i(xt,{})},{id:`usage`,label:t(`ai.tabUsage`,`Usage`),content:i(Xt,{})},{id:`test`,label:t(`ai.tabTest`,`Test`),content:i(Vt,{})}]})}function nn({presence:t}){let{t:n}=Q();return t===`pending`?e(`div`,{className:`space-y-3`,"data-testid":`ai-presence-pending`,children:[i(G,{className:`h-8 w-64`}),i(G,{className:`h-40 w-full`})]}):t===`unknown`?i(K,{title:n(`ai.presenceUnknownTitle`,`Could not check whether AI is installed`),message:n(`ai.presenceUnknown`,`The hub did not answer the capability check. Reload the page to try again.`)}):i(J,{icon:j,title:n(`ai.absentTitle`,`AI is not installed`),description:n(`ai.absentDescription`,`Install the AI addon from System → Addons to add model profiles.`)})}export{tn as AiProfilesPage,tn as default};
@@ -1 +0,0 @@
1
- import{C as e,J as t,K as n,R as r,S as i,V as a,Y as o,et as s,o as c,x as l}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Kr as u,Q as d,fr as f}from"./player-overlays-DyWZd37T.js";import{Fo as p}from"./client-DdGu3rlb.js";import{t as m}from"./log-in-D1R8-3xg.js";import{Da as h,Ia as g,Ma as _,Na as v,Nr as y,Oa as b,Ra as x,Sr as S,Tr as C,br as w,gr as T,ka as E,ri as D,wr as O,xr as k,yr as A}from"./src-DF4f-P3R.js";import{t as j}from"./i18n-C-H4BlYV.js";import{t as M}from"./useTranslation-BJr-n0es.js";import"./mount-DhYiPHjb.js";import{L as N,g as ee,pr as P}from"./index-CyYfrxyQ.js";s();function F(e,t){let n=e=>e.map(e=>e.type===`group`?{...e,fields:n(e.fields)}:e.type===`sub-tabs`?{...e,tabs:e.tabs.map(e=>({...e,fields:n(e.fields)}))}:e.type===`info`&&typeof e.content==`string`?{...e,content:e.content.split(`{{brokerId}}`).join(t)}:e);return{...e,sections:e.sections.map(e=>({...e,fields:n(e.fields)}))}}var te=`broker-advanced`;function I(e){return`key`in e&&typeof e.key==`string`&&`label`in e}function L(e){let t=new Set;for(let n of e){if(!I(n))continue;let e=n.showWhen;if(e===void 0)continue;let r=Array.isArray(e)?e:[e];for(let e of r)typeof e==`object`&&e&&`field`in e&&typeof e.field==`string`&&t.add(e.field)}return t}function ne(e,t,n){return!I(e)||e.showWhen!==void 0||t.has(e.key)?!1:n&&e.filledBySignIn===!0?!0:e.default!==void 0||e.defaultByCountry!==void 0}function re(e,t){let n=[],r=[];for(let i of e.sections){let e=L(i.fields),a=[];for(let r of i.fields)ne(r,e,t.hasSignIn)?n.push(r):a.push(r);if(a.length>0)r.push({...i,fields:a});else if(i.description!==void 0){let{description:e,...t}=i;r.push({...t,fields:[{type:`info`,key:`${i.id}-note`,label:``,content:e}]})}}return n.length>0&&r.push({id:te,title:t.advancedTitle,style:`accordion`,defaultCollapsed:!0,columns:1,fields:n}),{...e,sections:r}}function ie(e){if(e===void 0)return null;let t=/[-_]([A-Za-z]{2})(?:[-_]|$)/.exec(e);return t?.[1]===void 0?null:t[1].toUpperCase()}function ae(e,t,n){if(e===void 0||t===null)return{};let r={};for(let i of e.sections)for(let e of i.fields){if(!I(e)||n[e.key]!==void 0)continue;let i=e.defaultByCountry;i!==void 0&&t in i&&(r[e.key]=i[t])}return r}var oe=[`starting`,`awaiting-login`,`captured`,`error`,`cancelled`];function R(e){return typeof e==`object`&&!!e}function se(e){return R(e)&&typeof e.sessionId==`string`&&typeof e.loginUrl==`string`}function ce(e){return R(e)&&typeof e.sessionId==`string`&&typeof e.phase==`string`&&oe.includes(e.phase)}function le(e){return R(e)&&typeof e.brokerId==`string`}function z(){return{"Content-Type":`application/json`,Authorization:`Bearer ${localStorage.getItem(`camstack_admin_token`)??``}`}}async function B(e,t){try{return await e.json()}catch{throw Error(`${t} failed: HTTP ${e.status}`)}}function V(e){let t=R(e)&&typeof e.error==`string`?e.error:`Unknown error`;return Error(t)}async function H(e,t,n){let r=await fetch(d(e),{method:`POST`,headers:z(),body:JSON.stringify(t)}),i=await B(r,`Sign-in ${e.split(`/`).pop()??`request`}`);if(!r.ok)throw V(i);if(!n(i))throw Error(`Unexpected response from server`);return i}function ue(e,t){return H(`${e}/start`,t,se)}async function de(e,t){let n=new URLSearchParams({sessionId:t}),r=await fetch(d(`${e}/status?${n.toString()}`),{headers:{Authorization:z().Authorization??``}}),i=await B(r,`Sign-in status`);if(!r.ok)throw V(i);if(!ce(i))throw Error(`Unexpected status response from server`);return i}function fe(e,t){return H(`${e}/commit`,{...t},le)}async function pe(e,t){try{await fetch(d(`${e}/cancel`),{method:`POST`,headers:z(),body:JSON.stringify({sessionId:t})})}catch{}}var me=2e3;function he(e){return e.startsWith(`/`)&&!e.startsWith(`//`)?new URL(e,window.location.origin).toString():e}function ge({basePath:n,name:s,brokerId:c,getSettings:d,disabled:p,onSignedIn:h}){let{t:g}=M(),[_,v]=o({kind:`idle`}),b=t(!0),x=t(null),S=t(null),C=r(()=>{S.current!==null&&clearInterval(S.current),S.current=null},[]),w=r(()=>{C();let e=x.current;x.current=null,e!==null&&pe(n,e)},[n,C]);a(()=>(b.current=!0,()=>{b.current=!1,w()}),[w]);let T=r(e=>{C(),b.current&&v({kind:`error`,message:e})},[C]),E=r(async e=>{C(),b.current&&v({kind:`committing`});try{let t=await fe(n,{sessionId:e,name:s,...c===void 0?{}:{brokerId:c}});x.current=null,b.current&&h(t.brokerId)}catch(e){T(e instanceof Error?e.message:String(e))}},[n,c,T,s,h,C]),O=r(e=>{C(),S.current=setInterval(()=>{(async()=>{try{let t=await de(n,e);if(t.phase===`captured`)return void await E(e);if(t.phase===`error`)return T(t.error??g(`brokers.signIn.proxyError`));if(t.phase===`cancelled`){C(),b.current&&v({kind:`idle`});return}b.current&&v({kind:`waiting`,loginUrl:t.loginUrl,ready:t.phase===`awaiting-login`})}catch{}})()},me)},[n,E,T,C,g]),k=async()=>{w(),v({kind:`starting`});try{let e=await ue(n,d());x.current=e.sessionId,v({kind:`waiting`,loginUrl:e.loginUrl,ready:!1}),O(e.sessionId)}catch(e){T(e instanceof Error?e.message:String(e))}};return _.kind===`idle`||_.kind===`error`?e(`div`,{className:`space-y-2`,children:[_.kind===`error`&&i(y,{message:_.message}),i(`p`,{className:`text-xs text-foreground-muted`,children:g(`brokers.signIn.intro`)}),e(D,{variant:`primary`,size:`sm`,disabled:p===!0||s.trim().length===0,onClick:()=>void k(),children:[i(m,{className:`h-3.5 w-3.5`}),` `,_.kind===`error`?g(`common.retry`):g(`brokers.signIn.start`)]})]}):_.kind===`starting`||_.kind===`committing`?e(`div`,{className:`flex items-center gap-2 rounded-lg border border-border bg-surface px-3 py-3 text-xs text-foreground-subtle`,children:[i(f,{className:`h-4 w-4 animate-spin flex-shrink-0`}),_.kind===`starting`?g(`brokers.signIn.starting`):g(`brokers.signIn.saving`)]}):e(`div`,{className:`space-y-2 rounded-lg border border-border bg-surface p-3`,children:[_.ready?e(l,{children:[i(`p`,{className:`text-xs font-semibold text-foreground`,children:g(`brokers.signIn.openLink`)}),i(`p`,{className:`text-[11px] text-foreground-subtle`,children:g(`brokers.signIn.afterLogin`)}),e(D,{variant:`primary`,size:`sm`,onClick:()=>window.open(he(_.loginUrl),`_blank`,`noopener,noreferrer`),children:[i(u,{className:`h-3.5 w-3.5`}),` `,g(`brokers.signIn.openLoginPage`)]})]}):e(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[i(f,{className:`h-4 w-4 animate-spin flex-shrink-0`}),g(`brokers.signIn.waitingForProxy`)]}),e(`div`,{className:`flex items-center justify-between gap-2 pt-1`,children:[e(`span`,{className:`flex items-center gap-2 text-[11px] text-foreground-subtle`,children:[i(f,{className:`h-3 w-3 animate-spin`}),` `,g(`brokers.signIn.waitingForLogin`)]}),i(D,{variant:`outline`,size:`sm`,onClick:()=>{w(),v({kind:`idle`})},children:g(`brokers.signIn.cancel`)})]})]})}s();function U(e,t){if(!e)return t;let n=new Set;for(let r of e.sections){let e=r.fields;for(let r of e)!(`key`in r)||typeof r.key!=`string`||T(r,t,e)&&n.add(r.key)}let r={};for(let[e,i]of Object.entries(t))n.has(e)&&(r[e]=i);return r}function W({kind:t,addonId:r,brokerId:s,initialValues:c,onSubmit:l,onCancel:u,submitLabel:d,disabled:m,signIn:h}){let{t:g}=M(),[_,v]=o(c??{}),[y,b]=o(null),S=E({kind:t,...r===void 0?{}:{addonId:r}}),C=n(()=>{let e=S.data;if(e&&typeof e==`object`&&`sections`in e&&Array.isArray(e.sections)){let t=e;return re(p(s===void 0?t:F(t,s),_),{hasSignIn:h!==void 0,advancedTitle:g(`brokers.brokerForm.advanced`)})}},[S.data,s,_,h!==void 0,g]);a(()=>{c!==void 0&&v(c)},[c]);let w=ie(typeof navigator>`u`?void 0:navigator.language);a(()=>{if(c!==void 0)return;let e=ae(C,w,_);Object.keys(e).length>0&&v(t=>({...e,...t}))},[C,w,c,_]);let T=x(),O=async()=>{b(null);let e=U(C,_);try{let n=await T.mutateAsync({kind:t,settings:e,...r===void 0?{}:{addonId:r}});b(n.ok?{ok:!0}:{ok:!1,error:n.error})}catch(e){b({ok:!1,error:e instanceof Error?e.message:String(e)})}},k=()=>{let{_calendarCatalog:e,...t}=U(C,_);l(t)},A=()=>{let e=new Set;for(let t of C?.sections??[])for(let n of t.fields)I(n)&&n.filledBySignIn===!0&&e.add(n.key);let t=U(C,_);return Object.fromEntries(Object.entries(t).filter(([t])=>!e.has(t)))};return e(`div`,{className:`space-y-3`,children:[h!==void 0&&i(ge,{basePath:h.basePath,name:h.name,...h.brokerId===void 0?{}:{brokerId:h.brokerId},getSettings:A,disabled:m===!0,onSignedIn:h.onSignedIn}),S.isLoading&&e(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[i(f,{className:`h-3.5 w-3.5 animate-spin`}),` `,g(`brokers.brokerForm.loadingSchema`)]}),C&&i(N,{schema:C,values:_,onChange:v}),S.isError&&e(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px]`,children:[g(`brokers.brokerForm.failedToLoadSettingsSchema`,`Failed to load settings schema:`),` `,S.error instanceof Error?S.error.message:g(`brokers.brokerForm.unknownError`,`Unknown error`)]}),!C&&!S.isLoading&&!S.isError&&i(`div`,{className:`rounded border border-warning/30 bg-warning/10 px-3 py-2 text-[11px] text-warning`,children:i(P,{i18nKey:`brokers.brokerForm.noSchema`,values:{kind:t},components:{code:i(`code`,{className:`font-mono`})}})}),y&&i(`div`,{className:`rounded border px-3 py-2 text-[11px] ${y.ok?`border-success/30 bg-success/5 text-success`:`border-danger/30 bg-danger/5 text-danger`}`,children:y.ok?g(`brokers.brokerForm.connectionOk`,`Connection OK.`):g(`brokers.brokerForm.testFailed`,`Test failed: {{value1}}`,{value1:y.error??`unknown error`})}),e(`div`,{className:`flex items-center justify-between gap-2 pt-1`,children:[i(D,{variant:`outline`,size:`sm`,onClick:u,children:g(`common.cancel`,`Cancel`)}),e(`div`,{className:`flex items-center gap-2`,children:[i(D,{variant:`outline`,size:`sm`,onClick:()=>{O()},disabled:T.isPending||!C,children:T.isPending?g(`brokers.brokerForm.testing`,`Testing…`):g(`brokers.brokerForm.testConnection`,`Test connection`)}),i(D,{variant:h===void 0?`primary`:`outline`,size:`sm`,onClick:k,disabled:!C||m,children:d??g(`common.save`,`Save`)})]})]})]})}s();function G(e){return e===void 0?``:`${e.addonId??``}::${e.kind}`}function K(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&typeof e.id==`string`):[]}function _e(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&typeof e.addonId==`string`&&Array.isArray(e.kinds)):[]}function q(e){return typeof e==`string`&&e.length>0?e:void 0}function ve(e){let t=new Map;for(let n of e.providers)if(!(e.addonId!==void 0&&n.addonId!==e.addonId))for(let r of n.kinds){if(e.kind!==void 0&&r.kind!==e.kind)continue;let i=q(r.interactiveConnectPath),a=q(r.interactiveDisconnectPath),o=q(r.signIn?.basePath);t.set(`${n.addonId}::${r.kind}`,{addonId:n.addonId,kind:r.kind,label:r.label,...i===void 0?{}:{interactiveConnectPath:i},...a===void 0?{}:{interactiveDisconnectPath:a},...o===void 0?{}:{signInBasePath:o}})}for(let n of e.brokers)e.kind!==void 0&&n.kind!==e.kind||[...t.values()].some(e=>e.kind===n.kind)||t.set(`::${n.kind}`,{kind:n.kind,label:n.kind});return[...t.values()]}function J(e){let t=v(),r=_(e.kind===void 0?{}:{kind:e.kind});return{options:n(()=>ve({providers:_e(t.data),brokers:K(r.data).filter(t=>e.addonId===void 0||t.addonId===e.addonId),...e.addonId===void 0?{}:{addonId:e.addonId},...e.kind===void 0?{}:{kind:e.kind}}),[t.data,r.data,e.addonId,e.kind]),isLoading:t.isLoading===!0}}var Y=`kind`,X=`name`,Z=`restore`,Q=`restoreId`;function ye(e,t={allowRestore:!0}){let n=[];return e.length>1&&n.push({type:`select`,key:Y,label:j.t(`helpers.brokerIdentitySchema.kind`),options:e.map(e=>({value:e.key,label:e.label}))}),n.push({type:`text`,key:X,label:j.t(`helpers.brokerIdentitySchema.name`),placeholder:j.t(`helpers.brokerIdentitySchema.namePlaceholder`),required:!0}),t.allowRestore&&n.push({type:`boolean`,key:Z,label:j.t(`helpers.brokerIdentitySchema.restore`),description:j.t(`helpers.brokerIdentitySchema.restoreHint`)},{type:`text`,key:Q,label:j.t(`helpers.brokerIdentitySchema.originalId`),placeholder:`ha_004`,required:!0,showWhen:{field:Z,equals:!0}}),{sections:[{id:`broker-identity`,title:j.t(`helpers.brokerIdentitySchema.title`),columns:1,fields:n}]}}function be(e){let t=t=>{let n=e[t];return typeof n==`string`?n.trim():``},n=t(Y);if(n===``)return{ok:!1,problem:`Pick a kind.`};let r=t(X);if(r===``)return{ok:!1,problem:`Enter a name before saving.`};if(e.restore!==!0)return{ok:!0,identity:{kindKey:n,name:r,restoreId:null}};let i=t(Q);return i===``?{ok:!1,problem:`Enter the original id, or turn restore off to create a new broker.`}:{ok:!0,identity:{kindKey:n,name:r,restoreId:i}}}s();function $({title:t,subtitle:n,onClose:r,children:a}){return i(A,{open:!0,onOpenChange:e=>!e&&r(),children:e(k,{width:`md`,placement:`sheet-on-mobile`,scroll:`body`,children:[e(O,{children:[i(C,{children:t}),n&&i(S,{children:n})]}),i(w,{className:`space-y-3 pr-1`,children:a})]})})}function xe(e,t){let n=new Set(t.map(e=>e.trim().toLowerCase()));if(!n.has(e.toLowerCase()))return e;for(let t=2;;t++){let r=`${e} ${t}`;if(!n.has(r.toLowerCase()))return r}}function Se(e){return e.broker===void 0?i(Ce,{...e}):i(we,{...e,broker:e.broker})}function Ce({kind:r,addonId:s,onClose:u,onSaved:d}){let{t:p}=M(),m=c(),{options:g,isLoading:v}=J({...s===void 0?{}:{addonId:s},...r===void 0?{}:{kind:r}}),b=_({}),x=n(()=>K(b.data).map(e=>e.name),[b.data]),[S,C]=o({[X]:``,[Z]:!1,[Q]:``}),[w,T]=o(null),E=g.find(e=>G(e)===S.kind)??g[0],D=G(E),O=E===void 0?``:xe(E.label,x),k=t(``);a(()=>{D!==``&&C(e=>{let t=typeof e.name==`string`?e[X]:``,n=t===``||t===k.current;k.current=O;let r=n?O:t;return e.kind===D&&t===r?e:{...e,[Y]:D,[X]:r}})},[D,O]);let A=n(()=>ye(g.map(e=>({key:G(e),label:e.label})),{allowRestore:E?.signInBasePath===void 0}),[g,E?.signInBasePath]),j=e=>{m.invalidateQueries({queryKey:[[`broker`,`list`]]}),d(e)},P=h({onSuccess:e=>{let t=typeof e==`object`&&e&&typeof e.id==`string`?e.id:null,n=E?.interactiveConnectPath;t!==null&&n!==void 0&&ee(n,t,()=>{m.invalidateQueries({queryKey:[[`broker`,`list`]]})}),t!==null&&j(t)}}),F=be(S),te=F.ok?F.identity.name:``,I=e=>{if(E!==void 0){if(!F.ok){T(F.problem);return}T(null),P.mutate({kind:E.kind,name:F.identity.name,settings:e,...F.identity.restoreId===null?{}:{id:F.identity.restoreId},...E.addonId===void 0?{}:{addonId:E.addonId}})}},L=P.isPending;return i($,{title:p(`brokers.editor.createTitle`),subtitle:p(`brokers.editor.createSubtitle`),onClose:L?()=>{}:u,children:v&&g.length===0?e(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[i(f,{className:`h-3.5 w-3.5 animate-spin`}),` `,p(`brokers.editor.loadingKinds`)]}):E===void 0?i(y,{message:p(`brokers.editor.noProvider`)}):e(l,{children:[i(N,{schema:A,values:S,onChange:C}),w!==null&&i(y,{message:w}),P.isError&&i(y,{message:P.error instanceof Error?P.error.message:String(P.error)}),i(W,{kind:E.kind,...E.addonId===void 0?{}:{addonId:E.addonId},onSubmit:I,onCancel:u,submitLabel:p(L?`brokers.editor.creating`:`brokers.editor.create`),disabled:L,...E.signInBasePath===void 0?{}:{signIn:{basePath:E.signInBasePath,name:te,onSignedIn:j}}},D)]})})}function we({broker:t,onClose:r,onSaved:a}){let{t:o}=M(),s=c(),{options:l}=J({addonId:t.addonId,kind:t.kind}),u=l.find(e=>e.kind===t.kind)?.signInBasePath,d=b({id:t.id,addonId:t.addonId}),p=g({onSuccess:()=>{s.invalidateQueries({queryKey:[[`broker`,`list`]]}),s.invalidateQueries({queryKey:[[`broker`,`getSettings`],{input:{id:t.id,addonId:t.addonId}}]}),a(t.id)}}),m=n(()=>{let e=d.data;return e&&typeof e==`object`?{...e}:{}},[d.data]),h=p.isPending;return i($,{title:o(`brokers.brokerManager.edit`,`Edit {{name}}`,{name:t.name}),subtitle:`${t.kind} · ${t.id}`,onClose:h?()=>{}:r,children:d.isLoading?e(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[i(f,{className:`h-3.5 w-3.5 animate-spin`}),` `,o(`brokers.brokerManager.loadingSettings`)]}):d.isError?e(`div`,{className:`space-y-3`,children:[i(y,{message:o(`brokers.brokerManager.loadSettingsFailed`,{message:d.error instanceof Error?d.error.message:o(`common.unknownError`)})}),i(`div`,{className:`flex justify-end`,children:i(D,{variant:`outline`,size:`sm`,onClick:r,children:o(`common.close`,`Close`)})})]}):e(`div`,{className:`space-y-3`,children:[p.isError&&i(y,{message:p.error instanceof Error?p.error.message:String(p.error)}),i(W,{kind:t.kind,addonId:t.addonId,brokerId:t.id,initialValues:m,onSubmit:e=>p.mutate({id:t.id,settings:e,addonId:t.addonId}),onCancel:r,submitLabel:h?o(`brokers.brokerManager.saving`):o(`common.save`,`Save`),disabled:h,...u===void 0?{}:{signIn:{basePath:u,name:t.name,brokerId:t.id,onSignedIn:e=>{s.invalidateQueries({queryKey:[[`broker`,`list`]]}),a(e)}}}})]})})}export{K as n,J as r,Se as t};