@camstack/addon-admin-ui 1.2.436 → 1.2.437
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AddonAssetIcon-BPpbpBRb.js → AddonAssetIcon-C3Ltt0yX.js} +1 -1
- package/dist/assets/Addons-CkBmnKjV.js +4 -0
- package/dist/assets/{AdminPage-Dq8Ikceb.js → AdminPage-B7Z1OWO3.js} +1 -1
- package/dist/assets/{AdminSectionedPage-CMXlVHaE.js → AdminSectionedPage-USP4OV_Y.js} +1 -1
- package/dist/assets/AiProfiles-QWD8PlMr.js +3 -0
- package/dist/assets/{BrokerForm-CTEvkdiJ.js → BrokerForm-BxmxiIRw.js} +1 -1
- package/dist/assets/{Build-BtwPkUNT.js → Build-CXn4HT3p.js} +4 -4
- package/dist/assets/{Calendars-BDEesia0.js → Calendars-DN9ln21d.js} +1 -1
- package/dist/assets/Cluster-tgWdVHND.js +1 -0
- package/dist/assets/ClusterStepModel-BizBdfIU.js +1 -0
- package/dist/assets/{CompositionEditor-thMDSEPc.js → CompositionEditor-GiDCG4Aj.js} +1 -1
- package/dist/assets/{CompositionEditorPage-sur0OoTs.js → CompositionEditorPage-wfYMLlvy.js} +1 -1
- package/dist/assets/{Data-DYZzdYTt.js → Data-CmT5GPx9.js} +2 -2
- package/dist/assets/DeviceDetail-moNYFDGE.js +2 -0
- package/dist/assets/{DeviceDoActionFields-C3Dz4KrE.js → DeviceDoActionFields-C1LG9nW0.js} +1 -1
- package/dist/assets/{Devices-xUTbIFJe.js → Devices-837Dt931.js} +1 -1
- package/dist/assets/{EmbedPlayerPage-DYCZQ47V.js → EmbedPlayerPage-Crrh_6YT.js} +1 -1
- package/dist/assets/{Identity-DRemX8Kt.js → Identity-CNNb8wrU.js} +1 -1
- package/dist/assets/IntegrationDetail-BER_0Zaz.js +1 -0
- package/dist/assets/{IntegrationHub-CKPuIBCW.js → IntegrationHub-BEu0isNR.js} +1 -1
- package/dist/assets/Integrations-CuZucOyR.js +1 -0
- package/dist/assets/{Integrations-D8689xLx.js → Integrations-Sjh868gF.js} +1 -1
- package/dist/assets/Library-B4Nw3n28.js +1 -0
- package/dist/assets/Locations-B7dC2DyF.js +3 -0
- package/dist/assets/{Logs-BCis7K87.js → Logs-4XWMmfpD.js} +1 -1
- package/dist/assets/{MaskShapeCanvas-BDELFcW-.js → MaskShapeCanvas-Bwqusno0.js} +1 -1
- package/dist/assets/{MotionZonesSettings-B4Sz3Hxi.js → MotionZonesSettings-CZbGV_dv.js} +1 -1
- package/dist/assets/{MyAccess-SjNSbZFI.js → MyAccess-TAG05L5N.js} +1 -1
- package/dist/assets/Network-ReY1qUoQ.js +1 -0
- package/dist/assets/{NodeAddonsSettingsPanel-DPOu3bzA.js → NodeAddonsSettingsPanel-DIKEaj5p.js} +1 -1
- package/dist/assets/{Notifications-CdyKO4mW.js → Notifications-CqTEfaZ_.js} +1 -1
- package/dist/assets/{PrivacyMaskSettings-DHIoMgiM.js → PrivacyMaskSettings-CTKUYU5o.js} +1 -1
- package/dist/assets/{Recordings-DaqBEWTR.js → Recordings-EMQC9iqz.js} +1 -1
- package/dist/assets/ScanNetworkModal-DK98Sjd4.js +1 -0
- package/dist/assets/SceneMonitorEditor-CG4pADlP.js +1 -0
- package/dist/assets/SessionsList-B1Ni2lo_.js +2 -0
- package/dist/assets/{Showroom-DNWKiETZ.js → Showroom-BKLoHB4Z.js} +1 -1
- package/dist/assets/System-DEOHPmr3.js +1 -0
- package/dist/assets/{Terminal-CZxQeSQv.js → Terminal-dVu7TTAE.js} +2 -2
- package/dist/assets/{Viewer-DRzTXkJf.js → Viewer-B9mEIKqz.js} +1 -1
- package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-C5raVFJt.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-BX43JXOX.js} +1 -1
- package/dist/assets/{addon-icons-context-PT674I68.js → addon-icons-context-BjcmJD_J.js} +1 -1
- package/dist/assets/{archive-Ciq6-gRM.js → archive-Bcg0gLgY.js} +1 -1
- package/dist/assets/{authed-media-Dj1jG_u8.js → authed-media-Cf82_ejX.js} +1 -1
- package/dist/assets/{bell-off-BSKweN0I.js → bell-off-BnByNJjy.js} +1 -1
- package/dist/assets/{board-model-5GbhsRIK.js → board-model-D8m2YmcS.js} +1 -1
- package/dist/assets/{boxes-Be_6S2Ig.js → boxes-V2c7jrxe.js} +1 -1
- package/dist/assets/circle-slash-B_FzZotu.js +1 -0
- package/dist/assets/client-CUuI767h.js +358 -0
- package/dist/assets/{cloud-upload-B9nCTjv1.js → cloud-upload-aziKggfg.js} +1 -1
- package/dist/assets/crop-DzZyuK_f.js +1 -0
- package/dist/assets/{device-integration-icon-C31xC4qv.js → device-integration-icon-3UfBj_i6.js} +1 -1
- package/dist/assets/device-picker-model-DJj6igTj.js +1 -0
- package/dist/assets/dist-DsAwO6-i.js +358 -0
- package/dist/assets/{dist-B6sP5E_m.js → dist-t-gGaOd0.js} +1 -1
- package/dist/assets/{eraser-BIioNznG.js → eraser-CsYhDDbY.js} +1 -1
- package/dist/assets/{hard-drive-download-B4JsHavv.js → hard-drive-download-CWqd_JKb.js} +1 -1
- package/dist/assets/{history-DjLzg0Rr.js → history-DOf9zSG-.js} +1 -1
- package/dist/assets/{hostInit-BwwyWMg1.js → hostInit-BCqJwB4Y.js} +1 -1
- package/dist/assets/i18n-RHwbGLC0.js +1 -0
- package/dist/assets/icons-BrAHwVJD.js +1 -0
- package/dist/assets/index-CeO2wVZi.js +4 -0
- package/dist/assets/index-M0Q7O5pF.css +2 -0
- package/dist/assets/{key-BMcy7xHz.js → key-D0VHbthb.js} +1 -1
- package/dist/assets/{key-round-C__KHy-x.js → key-round-CasJ848Z.js} +1 -1
- package/dist/assets/{layers-Dbn6yDeS.js → layers-CFb4zoU6.js} +1 -1
- package/dist/assets/{linked-devices-model-D8dKG29p.js → linked-devices-model-DbkbB7KM.js} +1 -1
- package/dist/assets/{list-ordered-CwWFTuog.js → list-ordered-B14sQnH2.js} +1 -1
- package/dist/assets/{location-owned-usage-kz2UtPi1.js → location-owned-usage-C21QUrwl.js} +1 -1
- package/dist/assets/{log-in-D-fa0CNC.js → log-in-UZRiT8Rq.js} +1 -1
- package/dist/assets/{memory-stick-BNvRqOgn.js → memory-stick-l6hXPEuG.js} +1 -1
- package/dist/assets/{message-square-plus-yiE3dC2J.js → message-square-plus-C3grB9GT.js} +1 -1
- package/dist/assets/{mf-entry-bootstrap-0-3d7ac4be.js → mf-entry-bootstrap-0-5e54ea5d.js} +2 -2
- package/dist/assets/{mic-off-Ct9OQSHX.js → mic-off-wol-RBiS.js} +1 -1
- package/dist/assets/{monitor-off-gNZ5sErH.js → monitor-off-BUehkWHc.js} +1 -1
- package/dist/assets/{monitor-smartphone-B9ZL4epZ.js → monitor-smartphone-CCDiXDn-.js} +1 -1
- package/dist/assets/mount-DJj6igTj.js +1 -0
- package/dist/assets/{notification-schedule-field-91fTFul7.js → notification-schedule-field-DiZ-TJBp.js} +1 -1
- package/dist/assets/player-overlays-Db_o1Zm2.js +1 -0
- package/dist/assets/{recycle-CH0GJM3I.js → recycle-BVxTT0po.js} +1 -1
- package/dist/assets/remoteEntry-DSZ__m0a.js +1 -0
- package/dist/assets/{scan-eye-D6obPT9p.js → scan-eye-C5EKCLMY.js} +1 -1
- package/dist/assets/{scissors-BXMmNEgj.js → scissors-DjP6Unuk.js} +1 -1
- package/dist/assets/{search-x-ByAKuo4f.js → search-x-gjRI7PKB.js} +1 -1
- package/dist/assets/{send-CholqiEk.js → send-CV6GWVOX.js} +1 -1
- package/dist/assets/{settings-2-3k9hj27t.js → settings-2--KyzHb5N.js} +1 -1
- package/dist/assets/{speaker-Ca4eeGU9.js → speaker-CnmwOCLp.js} +1 -1
- package/dist/assets/src-CL0G8g2V.js +67 -0
- package/dist/assets/{timer-reset-bq-8RFf6.js → timer-reset-nORqwwje.js} +1 -1
- package/dist/assets/{ungroup-DMrJzuO_.js → ungroup-BQTGGbbf.js} +1 -1
- package/dist/assets/{unlink-CgiLXfCU.js → unlink-669jprEf.js} +1 -1
- package/dist/assets/{usb-BpqC1Eim.js → usb-BT4hzhxS.js} +1 -1
- package/dist/assets/{use-scenes-feed-CtmmYk4L.js → use-scenes-feed-DCExYbbk.js} +1 -1
- package/dist/assets/{use-stationary-objects-DsURgc1b.js → use-stationary-objects-DPwgtmOw.js} +1 -1
- package/dist/assets/useEventInvalidation-DJj6igTj.js +1 -0
- package/dist/assets/{useNodeUrlSelection-nj7EK04j.js → useNodeUrlSelection-ibxCoFYh.js} +1 -1
- package/dist/assets/user-round-NWWWc7PC.js +1 -0
- package/dist/assets/{user-x-CpjXT41_.js → user-x-Drhirj9Y.js} +1 -1
- package/dist/assets/{video-BAANd9N-.js → video-Dzs93Xor.js} +1 -1
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-Bp8_lhik.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-DVRZb8h3.js} +2 -2
- package/dist/index.html +11 -11
- package/dist/server/addon.js +227 -8
- package/package.json +1 -1
- package/dist/assets/Addons-BKpZvzxZ.js +0 -4
- package/dist/assets/AiProfiles-BNa-wvuk.js +0 -3
- package/dist/assets/Cluster-CPOYtnsH.js +0 -1
- package/dist/assets/ClusterStepModel-CD3lGILg.js +0 -1
- package/dist/assets/DeviceDetail-Dfkdbk5S.js +0 -2
- package/dist/assets/IntegrationDetail-CVONA8Vu.js +0 -1
- package/dist/assets/Integrations-RmhoSCir.js +0 -1
- package/dist/assets/Library-bvbXCasj.js +0 -1
- package/dist/assets/Locations-DvnbXzXE.js +0 -3
- package/dist/assets/Network-BvT1oKui.js +0 -1
- package/dist/assets/ScanNetworkModal-C5ek4_xr.js +0 -1
- package/dist/assets/SceneMonitorEditor-BPo9HYQH.js +0 -1
- package/dist/assets/SessionsList-CLdfIlct.js +0 -2
- package/dist/assets/System-BEpuTl2A.js +0 -1
- package/dist/assets/circle-slash-CtNDkZYp.js +0 -1
- package/dist/assets/client-CPwvt_HG.js +0 -358
- package/dist/assets/crop-D5vMVrdf.js +0 -1
- package/dist/assets/device-picker-model-zmV5eDza.js +0 -1
- package/dist/assets/dist-Sy-AM1_J.js +0 -358
- package/dist/assets/i18n-GaxP0h6E.js +0 -1
- package/dist/assets/icons-4P43FpmR.js +0 -1
- package/dist/assets/index-i0Y8_-ur.css +0 -2
- package/dist/assets/index-tgPOSbne.js +0 -4
- package/dist/assets/mount-zmV5eDza.js +0 -1
- package/dist/assets/octagon-alert-CkSZIflH.js +0 -1
- package/dist/assets/player-overlays-CVyuEj4x.js +0 -1
- package/dist/assets/remoteEntry-CEVdKgl-.js +0 -1
- package/dist/assets/src-D7EY8vSW.js +0 -67
- package/dist/assets/useEventInvalidation-zmV5eDza.js +0 -1
- package/dist/assets/user-round-B0EP32hl.js +0 -1
package/dist/server/addon.js
CHANGED
|
@@ -5406,7 +5406,7 @@ var ZodIssueCode = {
|
|
|
5406
5406
|
var ZodFirstPartyTypeKind;
|
|
5407
5407
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5408
5408
|
//#endregion
|
|
5409
|
-
//#region ../types/dist/sleep-
|
|
5409
|
+
//#region ../types/dist/sleep-BOjuyoPC.mjs
|
|
5410
5410
|
/**
|
|
5411
5411
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5412
5412
|
* window to float samples (D455).
|
|
@@ -8372,7 +8372,7 @@ object({
|
|
|
8372
8372
|
params: record(string(), union([string(), number()])).optional()
|
|
8373
8373
|
});
|
|
8374
8374
|
//#endregion
|
|
8375
|
-
//#region ../types/dist/err-msg
|
|
8375
|
+
//#region ../types/dist/err-msg-BXKzRBwg.mjs
|
|
8376
8376
|
var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
8377
8377
|
DeviceType["Camera"] = "camera";
|
|
8378
8378
|
DeviceType["Hub"] = "hub";
|
|
@@ -8464,6 +8464,10 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
|
8464
8464
|
* native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
|
|
8465
8465
|
* integrations sharing the same food/desiccant/hopper surface. */
|
|
8466
8466
|
DeviceType["PetFeeder"] = "pet-feeder";
|
|
8467
|
+
/** Built-in dishwasher — program lifecycle, door / remote-start gates,
|
|
8468
|
+
* salt and rinse-aid levels. Installed with the `dishwasher` cap.
|
|
8469
|
+
* Sources: native Bosch Home Connect, reusable by similar integrations. */
|
|
8470
|
+
DeviceType["Dishwasher"] = "dishwasher";
|
|
8467
8471
|
return DeviceType;
|
|
8468
8472
|
}({});
|
|
8469
8473
|
var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
|
|
@@ -8711,7 +8715,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
|
|
|
8711
8715
|
return DeviceRole;
|
|
8712
8716
|
}({});
|
|
8713
8717
|
//#endregion
|
|
8714
|
-
//#region ../types/dist/composition-
|
|
8718
|
+
//#region ../types/dist/composition-CB6PMT9p.mjs
|
|
8715
8719
|
/**
|
|
8716
8720
|
* The ffmpeg build every CamStack node downloads, per platform and arch.
|
|
8717
8721
|
*
|
|
@@ -13097,8 +13101,13 @@ var AlertSeveritySchema = _enum([
|
|
|
13097
13101
|
"info",
|
|
13098
13102
|
"success",
|
|
13099
13103
|
"warning",
|
|
13100
|
-
"error"
|
|
13104
|
+
"error",
|
|
13105
|
+
"critical"
|
|
13101
13106
|
]);
|
|
13107
|
+
var AlertActionSchema = object({
|
|
13108
|
+
label: string(),
|
|
13109
|
+
href: string().optional()
|
|
13110
|
+
});
|
|
13102
13111
|
var AlertStatusSchema = _enum([
|
|
13103
13112
|
"active",
|
|
13104
13113
|
"in-progress",
|
|
@@ -13116,6 +13125,7 @@ var AlertSchema = object({
|
|
|
13116
13125
|
severity: AlertSeveritySchema,
|
|
13117
13126
|
title: string(),
|
|
13118
13127
|
message: string(),
|
|
13128
|
+
action: AlertActionSchema.optional(),
|
|
13119
13129
|
status: AlertStatusSchema,
|
|
13120
13130
|
progress: number().optional(),
|
|
13121
13131
|
read: boolean(),
|
|
@@ -53050,7 +53060,7 @@ var BatteryStatusSchema = object({
|
|
|
53050
53060
|
*/
|
|
53051
53061
|
binary: boolean().optional()
|
|
53052
53062
|
});
|
|
53053
|
-
DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, method(object({
|
|
53063
|
+
DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat, method(object({
|
|
53054
53064
|
deviceId: number(),
|
|
53055
53065
|
/** Bound on the wait. Sensible range 3000–10000ms. */
|
|
53056
53066
|
timeoutMs: number().int().min(500).max(3e4).default(8e3)
|
|
@@ -53926,6 +53936,98 @@ object({
|
|
|
53926
53936
|
deviceId: number(),
|
|
53927
53937
|
status: DeviceStatusSchema
|
|
53928
53938
|
});
|
|
53939
|
+
/**
|
|
53940
|
+
* Smart-dishwasher cap — program lifecycle, door / remote-start gates,
|
|
53941
|
+
* consumable levels (salt, rinse aid) and common program options.
|
|
53942
|
+
*
|
|
53943
|
+
* Sources: native Bosch Home Connect (`dishwasher` device type). Reusable
|
|
53944
|
+
* by any integration that exposes the same program / option surface.
|
|
53945
|
+
*
|
|
53946
|
+
* `kind: 'poll'` — cloud REST APIs typically have no push channel; the
|
|
53947
|
+
* provider refreshes the slice on an interval and eagerly after commands.
|
|
53948
|
+
*/
|
|
53949
|
+
var DishwasherStateSchema = _enum([
|
|
53950
|
+
"idle",
|
|
53951
|
+
"running",
|
|
53952
|
+
"paused",
|
|
53953
|
+
"finished",
|
|
53954
|
+
"error",
|
|
53955
|
+
"unavailable"
|
|
53956
|
+
]);
|
|
53957
|
+
var DishwasherConsumableLevelSchema = _enum([
|
|
53958
|
+
"ok",
|
|
53959
|
+
"low",
|
|
53960
|
+
"empty"
|
|
53961
|
+
]);
|
|
53962
|
+
object({
|
|
53963
|
+
state: DishwasherStateSchema,
|
|
53964
|
+
/** Active program id/name, or null when none selected / unknown. */
|
|
53965
|
+
program: string().nullable(),
|
|
53966
|
+
/** Program tokens the hardware accepts — drives the UI selector. */
|
|
53967
|
+
availablePrograms: array(string()),
|
|
53968
|
+
/** Minutes remaining on the active cycle, or null when not running. */
|
|
53969
|
+
remainingMinutes: number().int().nonnegative().nullable(),
|
|
53970
|
+
/** Cycle completion 0..100, or null when not applicable. */
|
|
53971
|
+
progressPercent: number().min(0).max(100).nullable(),
|
|
53972
|
+
/** True when the door is reported open. */
|
|
53973
|
+
doorOpen: boolean(),
|
|
53974
|
+
/** True when remote start is allowed (door closed, power on, etc.). */
|
|
53975
|
+
remoteStartAllowed: boolean(),
|
|
53976
|
+
/** Main power / switched-on state. */
|
|
53977
|
+
powerOn: boolean(),
|
|
53978
|
+
saltLevel: DishwasherConsumableLevelSchema.nullable(),
|
|
53979
|
+
rinseAidLevel: DishwasherConsumableLevelSchema.nullable(),
|
|
53980
|
+
halfLoad: boolean(),
|
|
53981
|
+
hygienePlus: boolean(),
|
|
53982
|
+
errorCode: number().nullable(),
|
|
53983
|
+
errorLabel: string().nullable(),
|
|
53984
|
+
lastFetchedAt: number()
|
|
53985
|
+
});
|
|
53986
|
+
DeviceType.Dishwasher, method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
53987
|
+
kind: "mutation",
|
|
53988
|
+
auth: "protected"
|
|
53989
|
+
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
53990
|
+
kind: "mutation",
|
|
53991
|
+
auth: "protected"
|
|
53992
|
+
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
53993
|
+
kind: "mutation",
|
|
53994
|
+
auth: "protected"
|
|
53995
|
+
}), method(object({
|
|
53996
|
+
deviceId: number().int().nonnegative(),
|
|
53997
|
+
program: string().min(1)
|
|
53998
|
+
}), _void(), {
|
|
53999
|
+
kind: "mutation",
|
|
54000
|
+
auth: "protected"
|
|
54001
|
+
}), method(object({
|
|
54002
|
+
deviceId: number().int().nonnegative(),
|
|
54003
|
+
on: boolean()
|
|
54004
|
+
}), _void(), {
|
|
54005
|
+
kind: "mutation",
|
|
54006
|
+
auth: "protected"
|
|
54007
|
+
}), method(object({
|
|
54008
|
+
deviceId: number().int().nonnegative(),
|
|
54009
|
+
on: boolean()
|
|
54010
|
+
}), _void(), {
|
|
54011
|
+
kind: "mutation",
|
|
54012
|
+
auth: "protected"
|
|
54013
|
+
}), method(object({
|
|
54014
|
+
deviceId: number().int().nonnegative(),
|
|
54015
|
+
on: boolean()
|
|
54016
|
+
}), _void(), {
|
|
54017
|
+
kind: "mutation",
|
|
54018
|
+
auth: "protected"
|
|
54019
|
+
}), method(object({
|
|
54020
|
+
deviceId: number().int().nonnegative(),
|
|
54021
|
+
key: string().min(1),
|
|
54022
|
+
value: union([
|
|
54023
|
+
boolean(),
|
|
54024
|
+
string(),
|
|
54025
|
+
number()
|
|
54026
|
+
])
|
|
54027
|
+
}), _void(), {
|
|
54028
|
+
kind: "mutation",
|
|
54029
|
+
auth: "protected"
|
|
54030
|
+
});
|
|
53929
54031
|
object({
|
|
53930
54032
|
/** Ms epoch of the last press. null = never observed since this provider started. */
|
|
53931
54033
|
lastPressedAt: number().nullable(),
|
|
@@ -54491,6 +54593,13 @@ object({
|
|
|
54491
54593
|
lastChangedAt: number()
|
|
54492
54594
|
});
|
|
54493
54595
|
DeviceType.Sensor;
|
|
54596
|
+
object({
|
|
54597
|
+
/** Radiator valve opening 0 (closed) .. 100 (open). Null = not yet known. */
|
|
54598
|
+
position: number().min(0).max(100).nullable(),
|
|
54599
|
+
/** Ms epoch when the slice was last updated (push or poll). */
|
|
54600
|
+
lastFetchedAt: number()
|
|
54601
|
+
});
|
|
54602
|
+
DeviceType.Thermostat;
|
|
54494
54603
|
object({
|
|
54495
54604
|
/** Whether the humidifier is currently on. */
|
|
54496
54605
|
on: boolean(),
|
|
@@ -61557,7 +61666,7 @@ var AccessoryKind = {
|
|
|
61557
61666
|
PrivacyMask: DeviceRole.PrivacyMask
|
|
61558
61667
|
};
|
|
61559
61668
|
AccessoryKind.Siren, AccessoryKind.Floodlight, AccessoryKind.Spotlight, AccessoryKind.PirSensor, AccessoryKind.Chime, AccessoryKind.Autotrack, AccessoryKind.Nightvision, AccessoryKind.PrivacyMask;
|
|
61560
|
-
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;
|
|
61669
|
+
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.Dishwasher;
|
|
61561
61670
|
new Set(Object.values(DeviceType));
|
|
61562
61671
|
Object.freeze({
|
|
61563
61672
|
"accessories.getStatus": {
|
|
@@ -63978,6 +64087,60 @@ Object.freeze({
|
|
|
63978
64087
|
addonId: null,
|
|
63979
64088
|
access: "view"
|
|
63980
64089
|
},
|
|
64090
|
+
"dishwasher.getStatus": {
|
|
64091
|
+
capName: "dishwasher",
|
|
64092
|
+
capScope: "device",
|
|
64093
|
+
addonId: null,
|
|
64094
|
+
access: "view"
|
|
64095
|
+
},
|
|
64096
|
+
"dishwasher.pause": {
|
|
64097
|
+
capName: "dishwasher",
|
|
64098
|
+
capScope: "device",
|
|
64099
|
+
addonId: null,
|
|
64100
|
+
access: "create"
|
|
64101
|
+
},
|
|
64102
|
+
"dishwasher.setHalfLoad": {
|
|
64103
|
+
capName: "dishwasher",
|
|
64104
|
+
capScope: "device",
|
|
64105
|
+
addonId: null,
|
|
64106
|
+
access: "create"
|
|
64107
|
+
},
|
|
64108
|
+
"dishwasher.setHygienePlus": {
|
|
64109
|
+
capName: "dishwasher",
|
|
64110
|
+
capScope: "device",
|
|
64111
|
+
addonId: null,
|
|
64112
|
+
access: "create"
|
|
64113
|
+
},
|
|
64114
|
+
"dishwasher.setOption": {
|
|
64115
|
+
capName: "dishwasher",
|
|
64116
|
+
capScope: "device",
|
|
64117
|
+
addonId: null,
|
|
64118
|
+
access: "create"
|
|
64119
|
+
},
|
|
64120
|
+
"dishwasher.setPower": {
|
|
64121
|
+
capName: "dishwasher",
|
|
64122
|
+
capScope: "device",
|
|
64123
|
+
addonId: null,
|
|
64124
|
+
access: "create"
|
|
64125
|
+
},
|
|
64126
|
+
"dishwasher.setProgram": {
|
|
64127
|
+
capName: "dishwasher",
|
|
64128
|
+
capScope: "device",
|
|
64129
|
+
addonId: null,
|
|
64130
|
+
access: "create"
|
|
64131
|
+
},
|
|
64132
|
+
"dishwasher.start": {
|
|
64133
|
+
capName: "dishwasher",
|
|
64134
|
+
capScope: "device",
|
|
64135
|
+
addonId: null,
|
|
64136
|
+
access: "create"
|
|
64137
|
+
},
|
|
64138
|
+
"dishwasher.stop": {
|
|
64139
|
+
capName: "dishwasher",
|
|
64140
|
+
capScope: "device",
|
|
64141
|
+
addonId: null,
|
|
64142
|
+
access: "create"
|
|
64143
|
+
},
|
|
63981
64144
|
"doorbell.getStatus": {
|
|
63982
64145
|
capName: "doorbell",
|
|
63983
64146
|
capScope: "device",
|
|
@@ -64188,6 +64351,12 @@ Object.freeze({
|
|
|
64188
64351
|
addonId: null,
|
|
64189
64352
|
access: "view"
|
|
64190
64353
|
},
|
|
64354
|
+
"heatingValve.getStatus": {
|
|
64355
|
+
capName: "heating-valve",
|
|
64356
|
+
capScope: "device",
|
|
64357
|
+
addonId: null,
|
|
64358
|
+
access: "view"
|
|
64359
|
+
},
|
|
64191
64360
|
"humidifier.getStatus": {
|
|
64192
64361
|
capName: "humidifier",
|
|
64193
64362
|
capScope: "device",
|
|
@@ -69775,7 +69944,7 @@ Object.freeze({
|
|
|
69775
69944
|
access: "create"
|
|
69776
69945
|
}
|
|
69777
69946
|
});
|
|
69778
|
-
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;
|
|
69947
|
+
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.Dishwasher;
|
|
69779
69948
|
DeviceFeature.BatteryOperated;
|
|
69780
69949
|
Object.freeze({
|
|
69781
69950
|
"accessories.getStatus": [{
|
|
@@ -70599,6 +70768,51 @@ Object.freeze({
|
|
|
70599
70768
|
form: "single",
|
|
70600
70769
|
optional: false
|
|
70601
70770
|
}],
|
|
70771
|
+
"dishwasher.getStatus": [{
|
|
70772
|
+
name: "deviceId",
|
|
70773
|
+
form: "single",
|
|
70774
|
+
optional: false
|
|
70775
|
+
}],
|
|
70776
|
+
"dishwasher.pause": [{
|
|
70777
|
+
name: "deviceId",
|
|
70778
|
+
form: "single",
|
|
70779
|
+
optional: false
|
|
70780
|
+
}],
|
|
70781
|
+
"dishwasher.setHalfLoad": [{
|
|
70782
|
+
name: "deviceId",
|
|
70783
|
+
form: "single",
|
|
70784
|
+
optional: false
|
|
70785
|
+
}],
|
|
70786
|
+
"dishwasher.setHygienePlus": [{
|
|
70787
|
+
name: "deviceId",
|
|
70788
|
+
form: "single",
|
|
70789
|
+
optional: false
|
|
70790
|
+
}],
|
|
70791
|
+
"dishwasher.setOption": [{
|
|
70792
|
+
name: "deviceId",
|
|
70793
|
+
form: "single",
|
|
70794
|
+
optional: false
|
|
70795
|
+
}],
|
|
70796
|
+
"dishwasher.setPower": [{
|
|
70797
|
+
name: "deviceId",
|
|
70798
|
+
form: "single",
|
|
70799
|
+
optional: false
|
|
70800
|
+
}],
|
|
70801
|
+
"dishwasher.setProgram": [{
|
|
70802
|
+
name: "deviceId",
|
|
70803
|
+
form: "single",
|
|
70804
|
+
optional: false
|
|
70805
|
+
}],
|
|
70806
|
+
"dishwasher.start": [{
|
|
70807
|
+
name: "deviceId",
|
|
70808
|
+
form: "single",
|
|
70809
|
+
optional: false
|
|
70810
|
+
}],
|
|
70811
|
+
"dishwasher.stop": [{
|
|
70812
|
+
name: "deviceId",
|
|
70813
|
+
form: "single",
|
|
70814
|
+
optional: false
|
|
70815
|
+
}],
|
|
70602
70816
|
"doorbell.getStatus": [{
|
|
70603
70817
|
name: "deviceId",
|
|
70604
70818
|
form: "single",
|
|
@@ -70668,6 +70882,11 @@ Object.freeze({
|
|
|
70668
70882
|
form: "single",
|
|
70669
70883
|
optional: false
|
|
70670
70884
|
}],
|
|
70885
|
+
"heatingValve.getStatus": [{
|
|
70886
|
+
name: "deviceId",
|
|
70887
|
+
form: "single",
|
|
70888
|
+
optional: false
|
|
70889
|
+
}],
|
|
70671
70890
|
"humidifier.getStatus": [{
|
|
70672
70891
|
name: "deviceId",
|
|
70673
70892
|
form: "single",
|
|
@@ -73578,7 +73797,7 @@ var AdminUIAddon = class extends BaseAddon {
|
|
|
73578
73797
|
capability: adminUiCapability,
|
|
73579
73798
|
provider: {
|
|
73580
73799
|
getStaticDir: async () => ({ staticDir: resolveAdminUiDistDir() }),
|
|
73581
|
-
getVersion: async () => ({ version: "1.2.
|
|
73800
|
+
getVersion: async () => ({ version: "1.2.437" })
|
|
73582
73801
|
}
|
|
73583
73802
|
}];
|
|
73584
73803
|
}
|
package/package.json
CHANGED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{$ as e,B as t,G as n,J as r,L as i,S as a,b as o,o as s,q as c,x as l,z as u}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEHpkaJP.js";import{Hr as d,It as f,Ln as p,Nt as m,On as h,Ot as g,Q as _,ar as v,bi as y,di as b,dn as x,dt as S,en as C,fn as w,gi as ee,ln as T,ri as E,wn as te,yi as ne,yn as D}from"./player-overlays-CVyuEj4x.js";import{Di as re}from"./client-CPwvt_HG.js";import{c as ie}from"./video-BAANd9N-.js";import{t as O}from"./octagon-alert-CkSZIflH.js";import{$n as k,An as ae,Br as oe,Cr as A,Dr as j,Dt as se,Er as ce,Fr as le,Hr as ue,K as de,Lr as M,Mn as fe,Mr as N,Nn as P,Nr as F,On as pe,Or as me,Ot as I,Pn as L,Pr as he,Rr as R,Tr as ge,Un as _e,Ur as z,Wr as B,cr as ve,er as V,jr as H,kn as ye,kr as U,ru as be,ts as W,tt as xe,vu as G,wr as K,xr as Se,xu as Ce,zr as q}from"./src-D7EY8vSW.js";import{t as J}from"./useTranslation-D3Is_4B6.js";import"./mount-zmV5eDza.js";import{$ as Y,X,tt as we}from"./index-tgPOSbne.js";import{t as Z}from"./AdminPage-Dq8Ikceb.js";import{t as Te}from"./NodeAddonsSettingsPanel-DPOu3bzA.js";import{n as Q,t as Ee}from"./useNodeUrlSelection-nj7EK04j.js";function De(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}}e();var Oe={queued:{icon:E,bg:`bg-muted text-foreground-subtle`,labelKey:`addons.addonRowBadge.queued`},updating:{icon:v,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:y,bg:`bg-success/10 text-success`,labelKey:`addons.addonRowBadge.done`},failed:{icon:O,bg:`bg-danger/10 text-danger`,labelKey:`addons.addonRowBadge.failed`}};function ke({item:e}){let{t}=J(),n=Oe[e.status],r=n.icon;return a(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded ${n.bg}`,title:e.error,children:[l(r,{className:`w-2.5 h-2.5 ${n.spin?`animate-spin`:``}`}),t(n.labelKey)]})}var Ae=new Set([`completed`,`failed`,`partially-failed`,`cancelled`]),je=new Set([`done`,`failed`,`skipped`]);function Me(e){return!je.has(e.phase)&&!Ae.has(e.jobState)}function Ne(e,t){let n=new Map,r=[...e].sort((e,t)=>e.createdAtMs-t.createdAtMs);for(let e of r){let r=Ae.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 Pe(){let{data:e}=N({activeOnly:!0},{refetchOnWindowFocus:!1,refetchInterval:e=>(e.state.data?.length??0)>0?3e3:!1}),{map:t}=Ce(re.AddonsJobProgress,e=>e.job.jobId);return n(()=>{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 Ne([...n.values()],Date.now())},[e,t])}var Fe={queued:{icon:E,cls:`bg-muted text-foreground-subtle`,labelKey:`addons.jobProgress.queued`},fetching:{icon:v,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.fetching`,spin:!0},staged:{icon:v,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.staged`,spin:!0},validating:{icon:v,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.validating`,spin:!0},applying:{icon:v,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.applying`,spin:!0},restarting:{icon:v,cls:`bg-amber-500/10 text-amber-600 dark:text-amber-400`,labelKey:`addons.jobProgress.restarting`,spin:!0},applied:{icon:v,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.finalizing`,spin:!0},done:{icon:y,cls:`bg-success/10 text-success`,labelKey:`addons.jobProgress.updated`},failed:{icon:O,cls:`bg-danger/10 text-danger`,labelKey:`addons.jobProgress.failed`},skipped:{icon:C,cls:`bg-muted text-foreground-subtle`,labelKey:`addons.jobProgress.skipped`}};function Ie({progress:e}){let{t}=J(),n=Fe[e.phase],r=n.icon,i=e.error??`${e.packageName}: ${e.fromVersion??`?`} → ${e.toVersion}`;return a(`span`,{"data-testid":`addon-job-progress`,className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded shrink-0 ${n.cls}`,title:i,children:[l(r,{className:`w-2.5 h-2.5 ${n.spin?`animate-spin`:``}`}),t(n.labelKey),a(`span`,{className:`font-mono`,children:[`→ `,e.toVersion]})]})}function Le(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 Re(e){let t=e.version===null?``:` ${e.version}`,n=e.isOnline?``:` (offline: removed when it reconnects)`;return`- ${e.nodeName}${t}${n}`}function ze(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(Re)];return n.length>0&&r.push(`Could not ask: ${n.join(`, `)} — not included.`),r.push(`This cannot be undone.`),r.join(`
|
|
2
|
-
`)}function Be(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 Ve={uninstalled:`uninstalled`,"not-installed":`was not installed`,refused:`REFUSED`,failed:`FAILED`,"pending-reconnect":`offline — removed when it reconnects`};function He(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)}: ${Ve[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 Ue={},We=3e4,Ge=`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 Ke({packageName:e,displayName:t,selectedNode:n,hideNodeAction:r,disabled:i}){let{t:o}=J(),c=s(),u=V(),d=k(),p=H(Ue,{staleTime:We}),m=p.data?.installations??[],h=(p.data?.unreachable??[]).map(e=>e.nodeId),g=Le(m,e),_=e=>g.find(t=>t.nodeId===e)?.nodeName??(e===n.id?n.name:e),v=z({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?o(`addons.addonUninstallControls.uninstalled`,`{{displayName}} uninstalled`,{displayName:t}):o(`addons.addonUninstallControls.notEveryNodeWasCleaned`,`{{displayName}}: not every node was cleaned`,{displayName:t}),message:He(e,_),variant:e.success?`default`:`danger`})},b=async n=>{try{await y(await v.mutateAsync({packageName:e,...n}))}catch(e){await d({title:o(`addons.addonUninstallControls.uninstallFailed`,`Uninstall {{displayName}} failed`,{displayName:t}),message:e instanceof Error?e.message:String(e),variant:`danger`})}},x=async()=>{let e=g.filter(e=>e.nodeId!==n.id);await u({title:o(`addons.addonUninstallControls.uninstallFrom`,`Uninstall {{displayName}} from {{name}}?`,{displayName:t,name:n.name}),message:Be(t,n.name,e),confirmLabel:o(`addons.addonUninstallControls.uninstall`,`Uninstall`),variant:`danger`})&&await b(n.isHub?{}:{nodeId:n.id})},S=async()=>{let n=(await p.refetch()).data;if(n===void 0){await d({title:o(`addons.addonUninstallControls.cannotListTheNodes`,`Cannot list the nodes`),message:o(`addons.addonUninstallControls.theHubDidNotAnswer`,`The hub did not answer which nodes have this package — nothing was removed.`),variant:`danger`});return}let r=Le(n.installations,e);await u({title:o(`addons.addonUninstallControls.uninstallEverywhere`,`Uninstall {{displayName}} everywhere?`,{displayName:t}),message:ze(t,r,n.unreachable.map(e=>e.nodeId)),confirmLabel:o(`addons.addonUninstallControls.uninstallFromNodeS`,`Uninstall from {{length}} node(s)`,{length:r.length}),variant:`danger`})&&await b({everywhere:!0})},C=v.isPending||i===!0;return a(`div`,{className:`flex items-center gap-1.5`,children:[r!==!0&&a(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),x()},disabled:C,className:Ge,title:o(`addons.addonUninstallControls.uninstallFrom2`,`Uninstall from {{name}}`,{name:n.name}),children:[l(f,{className:`h-3 w-3`}),v.isPending?o(`addons.addonUninstallControls.removing`,`Removing...`):o(`addons.addonUninstallControls.uninstall`,`Uninstall`)]}),(g.length>1||r===!0||h.length>0)&&a(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),S()},disabled:C,className:Ge,title:o(`addons.addonUninstallControls.uninstallFromEveryNodeThat`,`Uninstall from every node that has it`),children:[l(ie,{className:`h-3 w-3`}),g.length>0?o(`addons.uninstallControls.everywhereCount`,{count:g.length}):o(`addons.uninstallControls.everywhere`)]})]})}function qe({packageName:e,currentVersion:t,installSource:n,onInstall:r,onClose:i,onSelect:s,selectedVersion:c}){let{t:u}=J(),f=n===`upload`||n===`local`,{data:p,isLoading:m}=j({name:e});return a(`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:[a(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border`,children:[l(`span`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle font-medium`,children:u(`addons.versionPicker.versions`,`Versions`)}),l(`button`,{type:`button`,onClick:i,className:`text-foreground-subtle hover:text-foreground`,children:l(S,{className:`h-3 w-3`})})]}),f&&a(`div`,{className:`flex items-start gap-2 px-3 py-2 border-b border-border bg-cyan-500/10 text-[10px]`,children:[l(g,{className:`h-3 w-3 mt-0.5 text-cyan-500 shrink-0`}),a(`div`,{className:`text-cyan-700 dark:text-cyan-200`,children:[l(`span`,{className:`font-semibold`,children:u(`addons.versionPicker.inPlace`,{kind:n===`upload`?u(`addons.versionPicker.uploadedCopy`,`Uploaded copy`):u(`addons.versionPicker.localCopy`,`Local copy`)})}),` `,l(X,{i18nKey:`addons.versionPicker.reinstall`,values:{version:t},components:{mono:l(`span`,{className:`font-mono`})}})]})]}),m&&a(`div`,{className:`flex items-center justify-center gap-2 py-6 text-[10px] text-foreground-subtle`,children:[l(v,{className:`h-3.5 w-3.5 animate-spin`}),u(`addons.versionPicker.loadingVersions`,`Loading versions...`)]}),p&&l(`div`,{className:`max-h-64 overflow-auto divide-y divide-border`,children:p.map(e=>{let n=e.version===t,i=s!==void 0&&e.version===c,f=/-(alpha|beta|rc|dev|canary|next)/i.test(e.version),p=a(o,{children:[l(`span`,{className:`font-mono flex-1 text-left ${n?`text-primary font-semibold`:f?`text-amber-400`:`text-foreground`}`,children:e.version}),n&&l(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium bg-primary/10 text-primary`,children:u(`common.current`)}),e.distTags.map(e=>l(`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.deprecated&&l(`span`,{className:`text-[9px] text-red-400 line-through`,children:u(`common.deprecated`)}),l(`span`,{className:`text-[9px] text-foreground-subtle shrink-0`,children:new Date(e.publishedAt).toLocaleDateString()})]});return s?a(`button`,{type:`button`,"aria-label":u(`addons.versionPicker.select`,`Select {{version}}`,{version:e.version}),onClick:()=>s(e.version),className:`w-full flex items-center gap-2 px-3 py-2 text-[11px] ${i?`bg-primary/5`:`hover:bg-surface-hover`} transition-colors`,children:[p,i?l(y,{className:`h-3 w-3 text-primary shrink-0`}):l(`span`,{className:`w-3 shrink-0`})]},e.version):a(`div`,{className:`flex items-center gap-2 px-3 py-2 text-[11px] ${n?`bg-primary/5`:`hover:bg-surface-hover`} transition-colors`,children:[p,l(`button`,{type:`button`,onClick:()=>r(e.version),className:`shrink-0 rounded p-0.5 hover:bg-primary/20 text-foreground-subtle hover:text-primary transition-colors`,title:n?u(`addons.versionPicker.reInstallFromNpm`,`Re-install {{version}} from npm`,{version:e.version}):u(`addons.versionPicker.install`,`Install {{version}}`,{version:e.version}),children:l(d,{className:`h-3 w-3`})})]},e.version)})}),p&&p.length===0&&l(`div`,{className:`py-4 text-center text-[10px] text-foreground-subtle`,children:u(`addons.versionPicker.noVersionsFound`,`No versions found`)})]})}e();var Je=`device-export`;function Ye(e){return e.capabilities.some(e=>(typeof e==`string`?e:e.name)===Je)}function Xe(e){return e!==`local`&&e!==`upload`}function Ze({isBundle:e,installSource:t,addonId:n,iconPath:i,color:o}){let[s,c]=r(!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=n&&i?_(`/api/addon-assets/${n}/${i}`):null,m=!!f&&!s;return a(`div`,{className:`relative flex-shrink-0`,children:[l(`div`,{className:`h-8 w-8 rounded-md flex items-center justify-center ${u?``:d}`,style:u,children:m?l(`img`,{src:f,alt:n,className:`h-4 w-4`,onError:()=>c(!0)}):l(e?p:te,{className:`h-3.5 w-3.5`})}),t===`local`&&l(`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`}),Xe(t)&&l(`span`,{className:`absolute -top-1 -left-1 w-4 h-4 rounded bg-[#cb3837] flex items-center justify-center -rotate-12 shadow-sm`,children:l(`svg`,{viewBox:`0 0 780 250`,className:`w-[11px] h-[11px]`,children:l(`path`,{fill:`#fff`,d:`M240 250h100V50h100v200h340V0H0v250z`})})}),t===`upload`&&l(`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:l(g,{className:`h-2.5 w-2.5 text-white`})})]})}function Qe({version:e,availableUpdate:t,selectedVersion:n,isUpdating:r,installSource:i,disabled:o,onUpdate:s,onOpenPicker:c,children:u}){let{t:f}=J();if(r)return a(`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:[l(v,{className:`h-3 w-3 animate-spin`}),f(`addons.addonCard.updating`,`Updating…`)]});if(t){let r=n??t;return a(`div`,{className:`relative inline-flex items-center gap-1 shrink-0`,children:[s&&a(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),s()},disabled:o,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:f(`addons.addonCard.updateTo`,`Update to {{target}}`,{target:r}),children:[l(d,{className:`h-3 w-3`}),f(`addons.addonCard.update`,`Update`)]}),a(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),c()},disabled:o,"aria-label":f(`addons.addonCard.selectVersionToInstall`,`Select version to install`),title:f(`addons.addonCard.installedUpdateAvailableSelectedTap`,`Installed {{version}} — update available. Selected {{target}}; tap to choose another version.`,{version:e,target:r}),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:[l(`span`,{className:`font-normal opacity-70`,children:e}),l(`span`,{className:`font-normal opacity-70`,children:`→`}),r,l(ne,{className:`h-3 w-3`})]}),u]})}return a(`div`,{className:`relative inline-flex items-center gap-1 shrink-0`,children:[a(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),c()},disabled:o,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`,i===`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:f(`addons.addonCard.versionTapToViewAll`,`Version {{version}} — tap to view all versions`,{version:e}),children:[e,l(ne,{className:`h-3 w-3 opacity-50`})]}),u]})}function $e({addonId:e}){let t=s(),{data:n=`inherit`}=K({addonId:e}),r=q({onSuccess:()=>{t.invalidateQueries({queryKey:[[`addons`,`getAddonAutoUpdate`]]})}});return l(`div`,{className:`flex rounded-lg border border-border overflow-hidden text-[10px] font-medium`,children:[`inherit`,`off`,`latest`,`beta`].map(t=>l(`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 et={id:`hub`,name:`Hub`,isHub:!0};function tt({addon:e,agents:n=[],clusterStatus:i,hideVersion:c,availableUpdate:u,onUpdate:d,isUpdating:f,jobProgress:m,bundle:g,bulkItem:_,disabledByBulk:v,isSystem:y,selectedNode:b}){let{t:x}=J(),[C,E]=r(!1),[te,re]=r(!1),[ie,k]=r(!1),[oe,A]=r(null);t(()=>{A(null)},[u]);let j=oe??u,[ce,ue]=r(!1),[de,N]=r(!1),[F,he]=r(`logs`),R=s(),ge=Y(),{manifest:z}=e,B=e.installedOn??[],ve=!g&&!z.protected&&z.removable!==!1,V=!!g,H=g?.displayName??z.name,U=g?.packageName??z.packageName,be=g?.version??z.packageVersion??z.version,W=g?.installSource??e.installSource,G=g?g.bundle?.description??g.addons[0]?.manifest.description:z.description,K=le({onSuccess:()=>{R.invalidateQueries({queryKey:[[`addons`]]})}}),Se=me({onSuccess:()=>{R.invalidateQueries({queryKey:[[`addons`]]}),R.invalidateQueries({queryKey:[[`addonPages`]]}),R.invalidateQueries({queryKey:[[`capabilities`]]}),R.invalidateQueries({queryKey:[[`integrations`]]})}}),Ce=M({onSuccess:()=>{R.invalidateQueries({queryKey:[[`addons`]]}),R.invalidateQueries({queryKey:[[`alerts`]]})}}),q=e.health,X=q?.phase===`failed`&&!q.inGracePeriod,we=X&&q?.nextRetryAt&&!q.retrying,Z=De(e.process);return a(`div`,{className:`rounded-md border bg-surface overflow-hidden ${X?`border-red-500/50`:`border-border`}`,children:[X&&q&&a(`div`,{className:`bg-danger/10 border-b border-danger/30 px-3 py-2 flex items-start gap-2`,children:[l(O,{className:`h-4 w-4 text-danger shrink-0 mt-0.5`}),a(`div`,{className:`flex-1 min-w-0`,children:[l(`div`,{className:`text-xs font-semibold text-danger`,children:x(`addons.addonCard.failedToLoad`,{attempt:q.retryCount})}),l(`div`,{className:`text-[11px] text-foreground mt-0.5 break-words font-mono`,children:q.lastError?.message??x(`addons.addonCard.unknownError`,`Unknown error`)}),we&&q.nextRetryAt&&l(`div`,{className:`text-[10px] text-foreground-subtle mt-1`,children:x(`addons.addonCard.autoRetryAt`,{time:new Date(q.nextRetryAt).toLocaleTimeString()})})]}),a(`button`,{type:`button`,disabled:Ce.isPending||q.retrying,onClick:e=>{e.stopPropagation(),Ce.mutate({packageName:U})},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:x(`addons.addonCard.resetRetryCounterAndForce`,`Reset retry counter and force immediate reload`),children:[l(D,{className:`h-3 w-3 ${Ce.isPending||q.retrying?`animate-spin`:``}`}),x(`addons.addonCard.retryNow`,`Retry now`)]})]}),Z!==null&&a(`div`,{className:`bg-danger/10 border-b border-danger/30 px-3 py-2 flex items-start gap-2`,children:[l(O,{className:`h-4 w-4 text-danger shrink-0 mt-0.5`}),a(`div`,{className:`flex-1 min-w-0`,children:[l(`div`,{className:`text-xs font-semibold text-danger`,children:x(`addons.addonCard.processProblem.${Z.kind}`)}),Z.reason!==void 0&&l(`div`,{className:`text-[11px] text-foreground mt-0.5 break-words font-mono`,children:Z.reason})]})]}),a(`div`,{className:`flex items-start gap-2.5 px-3 py-2`,children:[l(Ze,{isBundle:V||!!z.components&&z.components.length>1,installSource:W,addonId:V?g.addons[0]?.manifest.id:z.id,iconPath:V?g.bundle?.icon??g.addons[0]?.manifest.icon:z.icon,color:V?g.addons[0]?.manifest.color:z.color}),a(`div`,{className:`flex-1 min-w-0`,children:[a(`div`,{className:`flex items-start justify-between gap-2`,children:[l(`span`,{className:`text-xs font-semibold text-foreground truncate min-w-0`,children:H}),!c&&l(Qe,{version:be,availableUpdate:u,...j===void 0?{}:{selectedVersion:j},isUpdating:f,installSource:W,disabled:v,...d&&j!==void 0?{onUpdate:()=>d(j)}:{},onOpenPicker:()=>k(e=>!e),children:ie&&l(qe,{packageName:U,currentVersion:be,...W?{installSource:W}:{},...u!==void 0&&j!==void 0?{selectedVersion:j,onSelect:e=>{A(e),k(!1)}}:{},onInstall:e=>{k(!1),Se.mutate({packageName:U,version:e})},onClose:()=>k(!1)})})]}),a(`div`,{className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 mt-0.5`,children:[U!==H&&l(`span`,{className:`text-[10px] text-foreground-subtle font-mono truncate max-w-full`,children:U}),V&&a(`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:[l(p,{className:`h-3 w-3`}),g.addons.length]}),y&&a(`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:x(`addons.addonCard.systemPackageUpdatingRestartsThe`,`System package — updating restarts the hub`),children:[l(D,{className:`h-3 w-3`}),x(`addons.addonCard.system`,`System`)]}),_!=null&&l(ke,{item:_}),m!=null&&l(Ie,{progress:m})]}),G&&l(`p`,{className:`text-[10px] text-foreground-subtle mt-1 line-clamp-1`,children:G}),!V&&e.process&&a(`div`,{className:`flex flex-wrap items-center gap-1.5 mt-1`,children:[l(`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`?x(`addons.addonCard.forked`):x(`addons.addonCard.inProcess`)}),e.process.pid!=null&&a(`span`,{className:`text-[9px] font-mono text-foreground-subtle`,children:[`PID `,e.process.pid]}),l(`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`:Z===null?`bg-gray-500/15 text-gray-400`:`bg-red-500/15 text-red-400`}`,children:e.process.state})]})]})]}),!V&&a(`div`,{className:`flex items-center gap-1 px-3 py-1 border-t border-border/50 bg-surface-hover/20`,children:[a(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),K.mutate({addonId:z.id})},disabled:K.isPending||v,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:[l(D,{className:`h-3 w-3 ${K.isPending?`animate-spin`:``}`}),x(`addons.addonCard.restart`,`Restart`)]}),a(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),ue(e=>!e)},className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-medium border transition-colors ${ce?`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:[l(w,{className:`h-3 w-3`}),x(`addons.addonCard.logs`,`Logs`)]}),!V&&a(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),N(!0)},className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-medium border transition-colors ${de?`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:[l(T,{className:`h-3 w-3`}),x(`addons.addonCard.settings`,`Settings`)]}),l(`div`,{className:`flex-1`}),ve&&l(Ke,{packageName:z.packageName,displayName:z.name,selectedNode:b??et,disabled:v})]}),i&&i.nodes.length>1&&!V&&a(`div`,{className:`border-t border-border px-3 py-1.5 bg-muted/10`,children:[l(`div`,{className:`text-[10px] font-medium text-foreground-subtle mb-1.5`,children:x(`addons.addonCard.clusterDeployment`,`Cluster Deployment`)}),l(`div`,{className:`space-y-1`,children:i.nodes.map(e=>a(`div`,{className:`flex items-center gap-2 text-[10px]`,children:[l(`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`}`}),l(`span`,{className:`font-medium text-foreground min-w-[60px]`,children:e.name}),l(`span`,{className:`font-mono text-foreground-subtle`,children:e.version}),!e.synced&&e.status!==`offline`&&l(`span`,{className:`text-[9px] px-1 py-0.5 rounded bg-amber-500/10 text-amber-400 border border-amber-500/20`,children:x(`addons.addonCard.outdated`)}),e.status===`offline`&&l(`span`,{className:`text-[9px] px-1 py-0.5 rounded bg-muted text-muted-foreground`,children:x(`common.offline`)}),e.synced&&e.status!==`offline`&&l(`span`,{className:`text-[9px] text-success`,children:x(`common.synced`)})]},e.nodeId))})]}),ce&&!V&&a(`div`,{className:`border-t border-border`,children:[a(`div`,{className:`flex items-center px-3 py-0.5 bg-surface-hover/20 border-b border-border/50`,children:[a(`div`,{className:`flex rounded border border-border overflow-hidden text-[9px]`,children:[l(`button`,{type:`button`,onClick:()=>he(`logs`),className:`px-2 py-0.5 transition-colors ${F===`logs`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:x(`addons.addonCard.logs`,`Logs`)}),l(`button`,{type:`button`,onClick:()=>he(`events`),className:`px-2 py-0.5 border-l border-border transition-colors ${F===`events`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:x(`addons.addonCard.events`,`Events`)})]}),l(`div`,{className:`flex-1`}),l(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),ue(!1)},className:`text-foreground-subtle hover:text-foreground`,children:l(S,{className:`h-3.5 w-3.5`})})]}),F===`logs`&&l(I,{addonId:z.id,maxHeight:`max-h-64`,showFilters:!1}),F===`events`&&l(se,{addonId:z.id,category:`addon.*`,maxHeight:`max-h-64`})]}),V&&a(o,{children:[l(`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:l(C?ee:ne,{className:`h-3.5 w-3.5 text-foreground-subtle`})}),C&&l(`div`,{className:`border-t border-border px-2.5 py-1.5 space-y-1.5`,children:g.addons.map(e=>l(tt,{addon:e,agents:n,hideVersion:!0},e.manifest.id))})]}),de&&!V&&l(pe,{open:!0,onOpenChange:e=>!e&&N(!1),children:a(ae,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,children:[l(P,{children:a(L,{className:`flex items-center gap-2`,children:[l(T,{className:`h-4 w-4 text-primary`}),x(`addons.addonCard.settingsTitle`,{name:H})]})}),a(ye,{className:`space-y-4`,children:[l(`div`,{className:`text-[10px] text-foreground-subtle mb-2`,children:x(`addons.addonCard.clusterWideSettingsOneValue`,`Cluster-wide settings — one value for every node. Per-node settings live under Cluster → the node → Settings.`)}),l(Te,{nodeId:null,addonIds:[z.id],level:`global`,fieldScope:`cluster`,emptyMessage:x(`addons.addonCard.thisAddonExposesNoCluster`,`This addon exposes no cluster-wide settings. Anything it can configure is per-node — open it from Cluster → the node → Settings.`)}),Ye(z)&&a(`div`,{children:[l(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:x(`addons.addonCard.deviceExport`,`Device export`)}),l(xe,{addonId:z.id,onOpenDevice:e=>ge(`/devices/${e}`)})]}),Xe(W)&&a(`div`,{children:[l(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:x(`addons.addonCard.autoUpdate`,`Auto-Update`)}),l($e,{addonId:z.id})]}),z.components&&z.components.length>0&&a(`div`,{children:[l(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:x(`addons.addonCard.components`,{count:z.components.length})}),l(`div`,{className:`flex flex-wrap gap-1`,children:z.components.map(e=>l(`span`,{className:`text-[10px] rounded bg-background border border-border px-1.5 py-0.5 text-foreground-subtle font-mono`,children:e},e))})]}),n.length>=2&&a(`div`,{children:[l(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:x(`addons.addonCard.installedOn`,`Installed on`)}),a(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[B.length===0&&l(`span`,{className:`text-[10px] text-foreground-subtle`,children:x(`addons.addonCard.hubLocal`,`Hub (local)`)}),B.map(e=>l(`span`,{className:`rounded-full bg-surface-hover border border-border px-2 py-0.5 text-[10px] text-foreground-subtle`,children:e},e)),a(`div`,{className:`relative`,children:[a(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),re(e=>!e)},className:`inline-flex items-center gap-1 rounded-full border border-dashed border-border px-2 py-0.5 text-[10px] text-foreground-subtle hover:text-foreground hover:border-primary transition-colors`,title:x(`addons.addonCard.installOnMoreAgents`,`Install on more agents`),children:[l(h,{className:`h-3 w-3`}),x(`addons.addonCard.addAgent`,`Add agent`)]}),te&&a(`div`,{className:`absolute left-0 top-full mt-1 z-10 min-w-[160px] rounded-md border border-border bg-surface shadow-lg overflow-hidden`,children:[n.filter(e=>!e.isHub&&!B.includes(e.name)).map(e=>l(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),re(!1)},className:`w-full text-left px-3 py-1.5 text-[10px] text-foreground hover:bg-surface-hover transition-colors`,children:e.name},e.id)),n.filter(e=>!e.isHub&&!B.includes(e.name)).length===0&&l(`div`,{className:`px-3 py-1.5 text-[10px] text-foreground-subtle`,children:x(`addons.addonCard.noAvailableAgents`,`No available agents`)})]})]})]})]})]}),l(fe,{children:l(_e,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>N(!1),children:x(`common.close`,`Close`)})})]})})]})}e();var nt=`.tgz,.tar.gz,.zip`;function rt({onUploadSuccess:e}){let{t}=J(),[n,s]=r(!1),u=c(null),d=i(async t=>{s(!0);let n=new FormData;n.append(`file`,t);let r=localStorage.getItem(`camstack_admin_token`)??``;try{(await(await fetch(_(`/api/addons/upload`),{method:`POST`,headers:{Authorization:`Bearer ${r}`},body:n})).json()).success&&e()}finally{s(!1)}},[e]);return a(o,{children:[l(`input`,{ref:u,type:`file`,accept:nt,onChange:i(e=>{let t=e.target.files?.[0];t&&d(t),e.target.value=``},[d]),className:`hidden`}),a(`button`,{type:`button`,onClick:()=>u.current?.click(),disabled:n,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:[n?l(v,{className:`w-3.5 h-3.5 animate-spin`}):l(g,{className:`w-3.5 h-3.5`}),n?t(`addons.addonUploadZone.uploading`,`Uploading...`):t(`addons.addonUploadZone.upload`,`Upload`)]})]})}var it=new Set([`@camstack/system`,`@camstack/types`,`@camstack/sdk`,`@camstack/ui-library`,`@camstack/addon-agent-ui`]);function at(e,t){let n=new Map;for(let r of e){if(r.isHub||r.onHub||it.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 ot({selectedNode:e}){let{t}=J(),{data:n}=H(Ue,{staleTime:We});if(n===void 0)return null;let r=at(n.installations,e),i=n.unreachable.filter(t=>e.isHub||t.nodeId===e.id);return r.length===0&&i.length===0?null:a(`div`,{className:`rounded-lg border border-warning/30 bg-warning/5 px-3 py-2.5 space-y-2`,children:[a(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold text-foreground`,children:[l(m,{className:`h-3.5 w-3.5 text-warning`}),e.isHub?t(`addons.nodeOnlyPackagesPanel.installedOnAgentsButNot`,`Installed on agents but not on the hub`):t(`addons.nodeOnlyPackagesPanel.installedOnButNotOn`,`Installed on {{name}} but not on the hub`,{name:e.name})]}),i.length>0&&l(`div`,{className:`text-[10px] text-foreground-subtle`,children:t(`addons.nodeOnlyPackagesPanel.unreachable`,{nodes:i.map(e=>e.nodeId).join(`, `)})}),r.map(t=>a(`div`,{className:`flex items-center justify-between gap-3 flex-wrap rounded-md border border-border bg-surface px-3 py-2`,children:[a(`div`,{className:`min-w-0`,children:[l(`div`,{className:`text-xs font-mono text-foreground break-all`,children:t.packageName}),l(`div`,{className:`text-[10px] text-foreground-subtle`,children:t.rows.map(e=>`${e.nodeName}${e.version===null?``:` ${e.version}`}${e.isOnline?``:` (offline)`}`).join(` · `)})]}),l(Ke,{packageName:t.packageName,displayName:t.packageName,selectedNode:e,hideNodeAction:e.isHub})]},t.packageName))]})}function st({addon:e,installing:t,onInstall:n}){let{t:r}=J();return a(`div`,{className:`flex items-center gap-3 px-3 py-2 hover:bg-surface-hover transition-colors`,children:[l(`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()}),a(`div`,{className:`flex-1 min-w-0`,children:[a(`div`,{className:`flex items-baseline gap-2 min-w-0`,children:[l(`span`,{className:`text-[11px] font-semibold break-words`,children:e.name.replace(/^@camstack\/(addon-)?/,``)}),a(`span`,{className:`text-[10px] text-foreground-subtle shrink-0`,children:[`v`,e.version]})]}),l(`div`,{className:`font-mono text-[9px] text-foreground-subtle/80 truncate`,children:e.name}),e.description&&l(`div`,{className:`text-[10px] text-foreground-subtle truncate`,children:e.description})]}),e.installed?l(ve,{variant:`success`,icon:l(y,{className:`h-3 w-3`}),children:e.installedVersion??r(`system.capabilityCatalog.installed`,`Installed`)}):a(_e,{size:`sm`,onClick:()=>n(e.name),disabled:t,className:`shrink-0`,children:[t?l(v,{className:`h-3 w-3 animate-spin`}):l(d,{className:`h-3 w-3`}),r(`system.capabilityCatalog.install`,`Install`)]})]})}function ct({capability:e,installing:t,onInstall:n}){let{t:r}=J(),{data:i,isPending:o,isError:s}=R({capability:e}),c;if(s)c=l(`div`,{className:`px-3 py-2 text-xs text-danger`,children:r(`system.capabilityCatalog.couldNotSearchTheNpm`,`Could not search the npm catalog right now. Try again in a moment.`)});else if(o||i===void 0)c=a(`div`,{className:`flex items-center gap-2 px-3 py-2 text-xs text-foreground-subtle`,children:[l(v,{className:`h-3 w-3 animate-spin`}),r(`system.capabilityCatalog.searchingTheNpmCatalog`,`Searching the npm catalog…`)]});else{let a=i.filter(e=>!e.installed);c=a.length===0?l(`div`,{className:`px-3 py-2 text-xs text-foreground-subtle`,children:i.length===0?r(`system.capabilityCatalog.noPublishedAddonDeclaresThe`,`No published addon declares the "{{capability}}" capability.`,{capability:e}):r(`system.capabilityCatalog.everyPublishedAddonThatDeclares`,`Every published addon that declares "{{capability}}" is already installed.`,{capability:e})}):l(`div`,{className:`divide-y divide-border`,children:a.map(e=>l(st,{addon:e,installing:t,onInstall:n},e.name))})}return a(`section`,{className:`rounded-md border border-border bg-surface overflow-hidden`,"aria-label":r(`system.capabilityCatalog.availableToInstall`,`Available to install`),children:[l(`h2`,{className:`px-3 py-1.5 text-[10px] uppercase tracking-wide text-foreground-subtle border-b border-border`,children:r(`system.capabilityCatalog.availableToInstall`,`Available to install`)}),c]})}e();function lt(e){return e===`npm`||e===`dev`?e:null}var ut=`rounded-full border border-primary bg-primary/10 px-2 py-0.5 text-[10px] text-foreground`,dt=`rounded-full border border-border px-2 py-0.5 text-[10px] text-foreground-muted hover:bg-surface-hover`,ft=[{seconds:900,label:`15m`},{seconds:3600,label:`1h`},{seconds:21600,label:`6h`},{seconds:43200,label:`12h`},{seconds:86400,label:`24h`}],pt=new Set([`@camstack/system`,`@camstack/types`,`@camstack/sdk`,`@camstack/shm-ring`,`@camstack/ui-library`]);function mt(e){return e!==void 0&&pt.has(e)}var ht={id:`hub`,name:`Hub`,isHub:!0,isOnline:!0};function gt(e,t){let n=e??`hub-only`;return n===`any-node`?!0:n===`hub-only`?t:!t}function _t(e){return e===`local`?`dev`:`npm`}function vt(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 yt(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 bt({addons:e,clusterStatus:o,selectedNode:f,onRefresh:p,isRefreshing:m}){let{t:h}=J(),g=s(),[_,y]=r(``),S=u(_),[C,w]=r(!1),ee=c(null);t(()=>{if(!C)return;let e=e=>{ee.current&&!ee.current.contains(e.target)&&w(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[C]);let{data:T}=F({nodeId:f.id}),E=n(()=>{let e=new Map;for(let t of T??[])e.set(t.name,t.latestVersion);return e},[T]),te=n(()=>(T??[]).filter(e=>!e.isSystem).length,[T]),[ne,re]=r(()=>new Set),[ie,O]=r(()=>new Map),k=i(e=>{re(t=>new Set(t).add(e))},[]),ae=i(e=>{re(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n})},[]),A=i((e,t)=>{O(n=>new Map(n).set(e,t))},[]),j=i(e=>{O(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),se=B({onMutate:e=>{k(e.name),j(e.name)},onSuccess:(e,t)=>{ae(t.name);let n=e;if(n&&n.success===!1){A(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)=>{ae(t.name),A(t.name,e instanceof Error?e.message:String(e))}}),le=Pe(),de=c(new Set);t(()=>{let e=new Set;for(let[t,n]of le)Me(n)&&e.add(t);let t=[...de.current].some(t=>!e.has(t));de.current=e,t&&(g.invalidateQueries({queryKey:[[`addons`]]}),g.invalidateQueries({queryKey:[[`addons`,`listUpdates`]]}))},[le,g]);let{data:M}=ge(void 0),fe=Se({onSuccess:()=>{g.invalidateQueries({queryKey:[[`addons`,`getAutoUpdateSettings`]]})}}),N=oe({onSuccess:()=>{g.invalidateQueries({queryKey:[[`addons`,`getAutoUpdateSettings`]]})}}),{data:P,isFetching:pe}=R({query:S||void 0},{enabled:C}),I=ue(),{data:L}=ce(void 0),he=L?.requestedAt,[_e,z]=r(null),[ve,H]=r(!1);t(()=>{if(L?.kind===`framework-bulk-update`&&L.requestedAt!==_e){z(L.requestedAt),H(!0);let e=window.setTimeout(()=>H(!1),6e3);return()=>window.clearTimeout(e)}},[he,_e,L]),V();let ye=i(async()=>{let e=(T??[]).filter(e=>!e.isSystem);if(e.length!==0){if(!f.isHub){for(let t of e)await se.mutateAsync({name:t.name,version:t.latestVersion,nodeId:f.id});return}await I.mutateAsync({kind:`update`,targets:e.map(e=>({name:e.name,version:e.latestVersion})),nodeIds:[f.id]})}},[T,f.id,f.isHub,I,se]),U=me({onSuccess:()=>{g.invalidateQueries({queryKey:[[`addons`]]}),g.invalidateQueries({queryKey:[[`addonPages`]]}),g.invalidateQueries({queryKey:[[`capabilities`]]}),g.invalidateQueries({queryKey:[[`integrations`]]})}}),[W,xe]=r(`type`),[G,K]=r(()=>typeof window>`u`?`grouped`:window.localStorage.getItem(`camstack.addons.viewMode`)===`flat`?`flat`:`grouped`),Ce=e=>{K(e),typeof window<`u`&&window.localStorage.setItem(`camstack.addons.viewMode`,e)},[q,Y]=we(),X=q.get(`capability`),Z=q.get(`updatable`)===`1`,Te=q.get(`error`)===`1`,Q=lt(q.get(`source`)),Ee=i(e=>{let t=new URLSearchParams(q);e?t.set(`updatable`,`1`):t.delete(`updatable`),Y(t,{replace:!0})},[q,Y]),Oe=i(e=>{let t=new URLSearchParams(q);e?t.set(`error`,`1`):t.delete(`error`),Y(t,{replace:!0})},[q,Y]),ke=i(e=>{let t=new URLSearchParams(q);e===null?t.delete(`source`):t.set(`source`,e),Y(t,{replace:!0})},[q,Y]),Ae=n(()=>e.filter(e=>De(e.process)!==null).length,[e]),je=n(()=>{let t=e.filter(e=>!mt(e.manifest.packageName));return f.isHub||(t=t.filter(e=>gt(e.placement,f.isHub))),X&&(t=t.filter(e=>(e.manifest.capabilities??[]).some(e=>(typeof e==`string`?e:e.name)===X))),Z&&(t=t.filter(e=>{let t=e.manifest.packageName;return t!==void 0&&E.has(t)})),Q!==null&&(t=t.filter(e=>_t(e.installSource)===Q)),Te&&(t=t.filter(e=>De(e.process)!==null)),t},[e,f.isHub,X,Z,Q,Te,E]),Ne=()=>{let e=new URLSearchParams(q);e.delete(`capability`),Y(e,{replace:!0})},Fe=G===`flat`?je:yt(je),Ie=n(()=>{let e=[...Fe];switch(W){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},[Fe,W]);return a(`div`,{className:`space-y-3`,children:[[...ie.entries()].map(([e,t])=>l(`div`,{className:`rounded-md border border-danger/30 bg-danger/5 px-2.5 py-1.5 text-[11px]`,children:a(`div`,{className:`flex items-start justify-between gap-3`,children:[a(`div`,{className:`space-y-0.5`,children:[l(`div`,{className:`font-medium text-danger`,children:h(`systemPage.addons.updateFailed`,{name:e})}),l(`div`,{className:`text-foreground-subtle font-mono`,children:t})]}),l(`button`,{type:`button`,onClick:()=>j(e),className:`text-foreground-subtle hover:text-foreground text-[10px]`,children:h(`common.dismiss`)})]})},e)),a(`div`,{className:`flex items-center gap-x-2 gap-y-1.5 flex-wrap`,children:[a(`div`,{className:`flex items-center gap-1.5`,children:[l(`span`,{className:`text-[10px] text-foreground-subtle`,children:h(`admin.system.addons.sort`,`Sort:`)}),a(`select`,{value:W,onChange:e=>xe(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:[l(`option`,{value:`type`,children:h(`admin.system.addons.bundlesFirst`,`Bundles first`)}),l(`option`,{value:`name`,children:h(`admin.system.addons.name`,`Name`)}),l(`option`,{value:`source`,children:h(`admin.system.addons.installSource`,`Install source`)})]})]}),a(`div`,{className:`flex items-center gap-1.5`,children:[l(`span`,{className:`text-[10px] text-foreground-subtle`,children:h(`admin.system.addons.view`,`View:`)}),l(`div`,{className:`flex rounded-md border border-border overflow-hidden text-[10px] font-medium`,children:[`grouped`,`flat`].map(e=>l(`button`,{type:`button`,onClick:()=>Ce(e),className:`px-2 py-1 transition-colors capitalize ${G===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&&a(`div`,{className:`flex items-center gap-1.5`,children:[l(D,{className:`h-3 w-3 text-foreground-subtle`}),l(`span`,{className:`text-[10px] text-foreground-subtle`,children:h(`admin.system.addons.autoUpdate`,`Auto-Update:`)}),l(`div`,{className:`flex rounded-md border border-border overflow-hidden text-[10px] font-medium`,children:[`off`,`latest`,`beta`].map(e=>l(`button`,{type:`button`,onClick:()=>fe.mutate({channel:e}),disabled:fe.isPending,className:`px-2 py-1 transition-colors capitalize ${M?.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&&a(`div`,{className:`flex items-center gap-1.5`,children:[l(`span`,{className:`text-[10px] text-foreground-subtle`,children:h(`admin.system.addons.checkEvery`,`Check every:`)}),l(`select`,{className:`rounded-md border border-border bg-transparent px-1.5 py-1 text-[10px] font-medium text-foreground-subtle`,value:M?.updateCheckIntervalSeconds??21600,disabled:N.isPending||M===void 0,onChange:e=>{M!==void 0&&N.mutate({channel:M.channel,updateCheckIntervalSeconds:Number(e.target.value)})},children:ft.map(e=>l(`option`,{value:e.seconds,children:e.label},e.seconds))})]}),te>0&&a(`button`,{type:`button`,onClick:()=>void ye(),disabled:I.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:[I.isPending?l(v,{className:`w-3 h-3 animate-spin`}):l(d,{className:`w-3 h-3`}),I.isPending?h(`admin.system.addons.updating`,`Updating…`):h(`admin.system.addons.updateAll`,`Update All ({{nonSystemUpdateCount}})`,{nonSystemUpdateCount:te})]}),a(`button`,{type:`button`,onClick:p,disabled:m||I.isPending,className:`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`,children:[l(D,{className:`w-3 h-3 ${m?`animate-spin`:``}`}),h(`common.refresh`,`Refresh`)]})]}),a(`div`,{className:`flex flex-wrap items-center gap-1.5`,role:`group`,"aria-label":h(`admin.system.addons.filterInstalledAddons`,`Filter installed addons`),children:[l(`span`,{className:`text-[10px] text-foreground-subtle`,children:h(`admin.system.addons.filter`,`Filter:`)}),[{id:`updatable`,label:h(`admin.system.addons.updatable`,`Updatable`),pressed:Z,toggle:()=>Ee(!Z)},{id:`error`,label:h(`admin.system.addons.inError`,`In error ({{count}})`,{count:Ae}),pressed:Te,toggle:()=>Oe(!Te)},{id:`npm`,label:`npm`,pressed:Q===`npm`,toggle:()=>ke(Q===`npm`?null:`npm`)},{id:`dev`,label:h(`admin.system.addons.dev`,`Dev`),pressed:Q===`dev`,toggle:()=>ke(Q===`dev`?null:`dev`)}].map(e=>l(`button`,{type:`button`,"aria-pressed":e.pressed,onClick:e.toggle,className:e.pressed?ut:dt,children:e.label},e.id))]}),a(`div`,{className:`flex flex-col gap-1.5 sm:flex-row sm:items-center sm:gap-2`,children:[a(`div`,{className:`relative flex-1 min-w-0 sm:min-w-[200px]`,ref:ee,children:[l(be,{type:`text`,value:_,onChange:e=>{y(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:I.isPending,leftSlot:l(x,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),rightSlot:pe?l(v,{className:`h-3 w-3 animate-spin`}):void 0}),C&&P&&P.length>0&&a(`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:[P.length>0&&l(`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:P.length})}),P&&P.length>0&&l(`div`,{className:`max-h-72 overflow-auto divide-y divide-border`,children:P.map(e=>l(st,{addon:e,installing:U.isPending,onInstall:e=>U.mutate({packageName:e})},e.name))})]})]}),l(rt,{onUploadSuccess:()=>{g.invalidateQueries({queryKey:[[`addons`]]}),p()}})]}),X&&a(`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:[l(`span`,{className:`text-foreground-subtle`,children:h(`admin.system.addons.filteringByCapability`,`Filtering by capability:`)}),l(`span`,{className:`font-mono text-primary font-semibold`,children:X}),l(`button`,{type:`button`,onClick:Ne,className:`ml-auto text-xs text-foreground-subtle hover:text-foreground underline`,children:h(`admin.system.addons.clear`,`Clear`)})]}),X&&l(ct,{capability:X,installing:U.isPending,onInstall:e=>U.mutate({packageName:e})}),X&&je.length>0&&l(`h2`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:h(`admin.system.addons.installed`,`Installed`)}),ve&&a(`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:[l(b,{className:`w-4 h-4 shrink-0 mt-0.5 text-green-400`}),a(`div`,{children:[l(`div`,{className:`text-[11px] font-semibold text-foreground`,children:h(`admin.system.addons.bulkUpdateCompleted`,`Bulk update completed`)}),l(`div`,{className:`text-[10px] text-foreground-subtle mt-0.5`,children:h(`admin.system.addons.systemPackagesUpdatedHubRestarted`,`System packages updated — hub restarted successfully.`)})]})]}),je.length===0&&l(`div`,{className:`text-xs text-foreground-subtle`,children:e.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})}),l(`div`,{className:`space-y-1.5`,children:Ie.map(e=>{let t=$(e)?e.bundle.packageName:e.manifest.packageName,n=E.get(t),r=$(e)?e.representative:e,i=n?e=>se.mutate({name:t,version:e,nodeId:f.id}):void 0,a=le.get(t)??null,s=a!==null&&Me(a);return l(tt,{addon:r,clusterStatus:o?.[r.manifest.id],bundle:$(e)?e.bundle:void 0,availableUpdate:n,isUpdating:ne.has(t)||s,jobProgress:a,onUpdate:i,disabledByBulk:I.isPending,selectedNode:f},$(e)?t:e.manifest.id)})})]})}function xt(){let{t:e}=J(),n=s(),{data:r}=W(void 0),{nodes:i}=G(),{selection:o,selectNode:u,requestedNodeId:d}=Ee(i.length>0?i:[ht]),f=o.node??ht,p=f.id,m=i.length>0?o.staleNodeId:null,{data:h,isLoading:g,isError:_}=U({nodeId:p}),v=A(),y=he(),b=v.isPending||y.isPending,x=async()=>{await v.mutateAsync({nodeId:p}),await y.mutateAsync(),n.invalidateQueries({queryKey:[[`addons`]]})},S=c(v);S.current=v;let C=c(d??`hub`);t(()=>{S.current.mutate({nodeId:C.current})},[]);let w=(h??[]).map(vt).filter(e=>e!==null);return a(Z,{children:[a(`div`,{className:`flex items-center justify-between gap-2 flex-wrap`,children:[l(de,{selectedNodeId:p,onSelect:u}),a(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[!g&&!_&&l(`span`,{className:`text-[10px] rounded-full bg-primary/10 text-primary px-2 py-0.5 font-medium`,children:e(`systemPage.addons.installedCount`,{count:w.length})}),a(`button`,{type:`button`,onClick:()=>void x(),disabled:b,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:[l(D,{className:`w-3 h-3 ${b?`animate-spin`:``}`}),e(`admin.system.addons.checkForUpdates`,`Check for updates`)]})]})]}),l(Q,{staleNodeId:m,shownNodeName:f.name}),l(ot,{selectedNode:f}),g&&l(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:e(`common.loading`,`Loading…`)}),_&&l(`div`,{className:`text-xs text-danger`,children:e(`admin.system.addons.failedToLoadAddons`,`Failed to load addons`)}),!g&&!_&&l(bt,{addons:w,clusterStatus:r,selectedNode:f,onRefresh:()=>void x(),isRefreshing:b})]})}export{xt as AddonsPage};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{$ as e,B as t,G as n,J as r,L as i,S as a,a as o,b as s,q 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-CEHpkaJP.js";import{D as d,Dn as f,G as p,Hr as m,It as h,Jr as g,Jt as _,Oi as v,On as y,Pn as b,Q as x,Tr as S,Xt as C,Zr as w,ar as T,dn as E,dt as D,kr as ee,ot as O,un as k,wi as A}from"./player-overlays-CVyuEj4x.js";import{Wn as j}from"./client-CPwvt_HG.js";import{t as te}from"./message-square-plus-yiE3dC2J.js";import{t as M}from"./send-CholqiEk.js";import{B as ne,Bn as N,Cn as re,H as P,K as F,Kt as I,Ln as L,Ql as R,Un as z,Wt as B,cr as V,qt as H,ru as U,sn as W,va as G}from"./src-D7EY8vSW.js";import{t as K}from"./i18n-GaxP0h6E.js";import{t as q}from"./useTranslation-D3Is_4B6.js";import"./mount-zmV5eDza.js";import{w as ie}from"./index-tgPOSbne.js";import{t as ae}from"./AdminSectionedPage-CMXlVHaE.js";import{t as J}from"./AdminPage-Dq8Ikceb.js";e();var oe=[`llm`,`listProfiles`],se=[`llm`,`listProfileKinds`],ce=[`llm`,`getDefaults`],Y=[`llm`,`listRuntimeNodes`],le=[`llm`,`listModelCatalog`],ue=[`llm`,`getUsage`],de=[{purpose:`vision`,visionOnly:!0},{purpose:`text`,visionOnly:!1}],fe=new Map(Object.entries({openai:w,anthropic:w,google:w,"openai-compatible":f,"managed-local":g,"apple-foundation":g}));function pe(e){return fe.get(e)??null}function X(e){return typeof e==`string`&&e.length>0?e:void 0}function Z(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 Q(e){return e===!0}function me(e){return{model:e.model,baseUrl:e.baseUrl,apiKey:e.apiKey,supportsVision:e.supportsVision,temperature:e.temperature,topP:e.topP,topK:e.topK,maxTokens:e.maxTokens,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,contextSize:e.runtime?.contextSize,gpuLayers:e.runtime?.gpuLayers,threads:e.runtime?.threads,parallel:e.runtime?.parallel,idleStopMinutes:e.runtime?.idleStopMinutes,batchSize:e.runtime?.batchSize,ubatchSize:e.runtime?.ubatchSize,flashAttention:e.runtime?.flashAttention,mlock:e.runtime?.mlock,noMmap:e.runtime?.noMmap,cacheTypeK:e.runtime?.cacheTypeK,cacheTypeV:e.runtime?.cacheTypeV,extraArgs:ve(e.runtime?.extraArgs??[])}}var he=[`f32`,`f16`,`q8_0`,`q5_1`,`q5_0`,`q4_1`,`q4_0`];function ge(e){return typeof e==`string`&&he.includes(e)?e:void 0}function _e(e){let t=[],n=``,r=null;for(let i of e){if(r!==null){i===r?r=null:n+=i;continue}if(i===`"`||i===`'`){r=i;continue}if(/\s/.test(i)){n!==``&&t.push(n),n=``;continue}n+=i}return n!==``&&t.push(n),t}function ve(e){return e.map(e=>/\s/.test(e)?`"${e}"`:e).join(` `)}var ye=[`--jinja`,`--cont-batching`];function be(e,t,n){let r=Z(e.threads),i=Z(e.batchSize),a=Z(e.ubatchSize),o=ge(e.cacheTypeK),s=ge(e.cacheTypeV);return{nodeId:t,engine:`llama-cpp`,model:n,extraArgs:[..._e(X(e.extraArgs)??``)],contextSize:Z(e.contextSize)??4096,gpuLayers:Z(e.gpuLayers)??0,...r===void 0?{}:{threads:r},parallel:Z(e.parallel)??1,...i===void 0?{}:{batchSize:i},...a===void 0?{}:{ubatchSize:a},flashAttention:Q(e.flashAttention),mlock:Q(e.mlock),noMmap:Q(e.noMmap),...o===void 0?{}:{cacheTypeK:o},...s===void 0?{}:{cacheTypeV:s},autoStart:Q(e.autoStart),idleStopMinutes:Z(e.idleStopMinutes)??30}}function xe(e,t,n,r,i){let a={id:n?.id??crypto.randomUUID(),name:t,kind:e,addonId:`ai`,enabled:n?.enabled??!0,model:X(r.model)??n?.model??``,supportsVision:i?.supportsVision??Q(r.supportsVision),timeoutMs:Z(r.timeoutMs)??j.totalMs,connectTimeoutMs:Z(r.connectTimeoutMs)??j.connectMs,firstTokenTimeoutMs:Z(r.firstTokenTimeoutMs)??j.firstTokenMs,idleTimeoutMs:Z(r.idleTimeoutMs)??j.idleMs,retry:{enabled:Q(r.retryEnabled),maxAttempts:Z(r.retryMaxAttempts)??1},toolsEnabled:Q(r.toolsEnabled)},o=X(r.baseUrl),s=X(r.apiKey),c=Z(r.temperature),l=Z(r.topP),u=Z(r.topK),d=Z(r.maxTokens),f=Z(r.contextLength),p=X(r.systemPrompt);return{...a,...o===void 0?{}:{baseUrl:o},...s===void 0?{}:{apiKey:s},...c===void 0?{}:{temperature:c},...l===void 0?{}:{topP:l},...u===void 0?{}:{topK:u},...d===void 0?{}:{maxTokens:d},...f===void 0?{}:{contextLength:f},...p===void 0?{}:{systemPrompt:p},...i===void 0?{}:{model:i.modelId,runtime:be(r,i.nodeId,i.model)}}}function Se(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 Ce=`apple-system`;function we(e,t,n,r){return{...xe(`apple-foundation`,e,t,n),model:Ce,supportsVision:!1,appleFoundation:{nodeId:r}}}var Te={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 Ee(e){let t=t=>({nodeId:e.nodeId,selectable:!1,labelKey:`ai.appleUnknown`,labelDefault:K.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:K.t(`ai.appleAvailable`),detail:K.t(n.imageInput?`helpers.aiPage.appleDetailImages`:`helpers.aiPage.appleDetailText`,{version:n.osVersion}),tone:`success`};case`unavailable`:{let t=Te[n.reason];return{nodeId:e.nodeId,selectable:!1,labelKey:t.key,labelDefault:K.t(t.key),detail:n.detail,tone:t.tone}}case`unsupported-platform`:return{nodeId:e.nodeId,selectable:!1,labelKey:`ai.appleNotMac`,labelDefault:K.t(`ai.appleNotMac`),detail:n.platform,tone:`default`};case`unknown`:return t(n.error)}}var De=2e3;function $(e){return K.t(`system.aiModelPicker.sizeGb`,{value:(e/1e9).toFixed(2)})}function Oe(e){return e===null?``:e.model.kind===`catalog`?`catalog:${e.model.catalogId}`:e.model.kind===`path`?`node:${e.modelId}`:`custom`}function ke({nodeId:e,value:t,onChange:i}){let{t:s}=q(),c=O(),[d,f]=r(``),[p,h]=r(null),[g,_]=r(!1),v=o({queryKey:le,queryFn:()=>c.trpcClient.llm.listModelCatalog.query({})}),y=o({queryKey:[`llm`,`listNodeModels`,e],queryFn:()=>c.trpcClient.llm.listNodeModels.query({nodeId:e})}),b=l({mutationFn:e=>c.trpcClient.llm.resolveModelRef.mutate(e),onSuccess:e=>{h(e),_(!1),e.ok&&i({model:e.model,modelId:e.label,supportsVision:e.purpose===`vision`})}}),x=l({mutationFn:t=>c.trpcClient.llm.installModel.mutate({nodeId:e,model:t}),onSuccess:()=>{_(!0),y.refetch()}}),S=o({queryKey:Y,enabled:x.isPending,refetchInterval:x.isPending?De:!1,queryFn:()=>c.trpcClient.llm.listRuntimeNodes.query({})}).data?.find(t=>t.nodeId===e)?.status?.download,C=n(()=>{let t=(v.data??[]).map(e=>({value:`catalog:${e.id}`,label:`${e.label} · ${e.quantization} · ${$(e.sizeBytes)}`})),n=(y.data??[]).filter(e=>e.catalogId===void 0&&e.path!==void 0).map(t=>({value:`node:${t.file}`,label:s(`ai.onNode`,`{{file}} · {{size}} · on {{node}}`,{file:t.file,size:$(t.sizeBytes),node:e})})),r=p?.ok===!0?[{value:`custom`,label:`${p.label} · ${$(p.totalBytes)}`}]:[];return[{value:``,label:s(`ai.selectModel`,`Select a model…`)},...t,...n,...r]},[v.data,y.data,p,e,s]),w=e=>{if(e===``){i(null);return}if(e===`custom`){if(p?.ok!==!0)return;i({model:p.model,modelId:p.label,supportsVision:p.purpose===`vision`});return}if(e.startsWith(`catalog:`)){let t=e.slice(8),n=v.data?.find(e=>e.id===t);i({model:{kind:`catalog`,catalogId:t},modelId:t,supportsVision:n?.purpose===`vision`});return}let t=e.slice(5),n=y.data?.find(e=>e.file===t);n?.path!==void 0&&i({model:{kind:`path`,path:n.path},modelId:t,supportsVision:!1})},D=e=>{d.trim()!==``&&b.mutate({ref:d.trim(),...e===void 0?{}:{maxBytes:e}})};return a(`div`,{className:`space-y-2`,children:[a(`div`,{children:[u(`label`,{className:`mb-1 block text-[11px] font-medium text-foreground`,htmlFor:`ai-model`,children:s(`ai.model`,`Model`)}),u(R,{id:`ai-model`,value:Oe(t),options:C,onChange:e=>w(e.target.value)})]}),a(`div`,{className:`rounded-md border border-border bg-surface-subtle px-3 py-2.5`,children:[u(`div`,{className:`mb-1 text-[11px] font-medium text-foreground`,children:s(`ai.hfTitle`,`Add a model from Hugging Face`)}),u(`p`,{className:`mb-2 text-[10px] leading-relaxed text-foreground-subtle`,children:s(`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.`)}),a(`div`,{className:`flex gap-2`,children:[u(U,{value:d,onChange:e=>f(e.target.value),placeholder:s(`system.aiModelPicker.unslothQwen3635bA3b`,`unsloth/Qwen3.6-35B-A3B-GGUF:UD-Q4_K_M`),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),D())}}),a(z,{size:`sm`,variant:`secondary`,type:`button`,disabled:d.trim()===``||b.isPending,onClick:()=>D(),children:[b.isPending?u(T,{className:`h-3.5 w-3.5 animate-spin`}):u(E,{className:`h-3.5 w-3.5`}),s(`ai.hfCheck`,`Check`)]})]}),b.isError&&u(`p`,{className:`mt-2 text-[11px] text-danger`,children:b.error instanceof Error?b.error.message:s(`common.error`,`Error`)}),p?.ok===!1&&a(`div`,{className:`mt-2 rounded-md border border-danger/40 bg-danger/10 px-2.5 py-2`,children:[u(`p`,{className:`text-[11px] text-danger`,children:p.message}),p.candidates!==void 0&&p.candidates.length>0&&u(`div`,{className:`mt-1.5 flex flex-wrap gap-1`,children:p.candidates.map(e=>u(`button`,{type:`button`,className:`rounded border border-border bg-surface px-1.5 py-0.5 text-[10px] text-foreground hover:border-primary/50`,onClick:()=>{let t=`${d.trim().split(`:`)[0]??``}:${e}`;f(t),b.mutate({ref:t})},children:e},e))}),p.requiredBytes!==void 0&&u(z,{size:`sm`,variant:`secondary`,type:`button`,className:`mt-2`,onClick:()=>D(p.requiredBytes),children:s(`ai.hfOverride`,`Install anyway ({{size}})`,{size:$(p.requiredBytes)})})]}),p?.ok===!0&&a(`div`,{className:`mt-2 rounded-md border border-border bg-surface px-2.5 py-2`,children:[a(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[u(`span`,{className:`text-[11px] font-medium text-foreground`,children:p.label}),u(V,{variant:p.purpose===`vision`?`info`:`default`,children:p.purpose}),u(V,{variant:`default`,children:$(p.totalBytes)})]}),p.extraFilenames.length>0&&u(`p`,{className:`mt-1 text-[10px] text-foreground-subtle`,children:s(`ai.hfExtras`,`Also downloads: {{files}}`,{files:p.extraFilenames.join(`, `)})}),a(`div`,{className:`mt-2 flex items-center gap-2`,children:[a(z,{size:`sm`,type:`button`,disabled:x.isPending||g,onClick:()=>x.mutate(p.model),children:[x.isPending?u(T,{className:`h-3.5 w-3.5 animate-spin`}):u(m,{className:`h-3.5 w-3.5`}),g?s(`ai.hfInstalled`,`Downloaded`):s(`ai.hfInstall`,`Download to {{node}}`,{node:e})]}),S!==void 0&&u(`span`,{className:`text-[10px] text-foreground-subtle`,children:S.phase===`verifying`?s(`ai.hfVerifying`,`verifying {{file}}…`,{file:S.file}):s(`ai.hfDownloading`,`{{file}} ({{index}}/{{count}}) — {{done}}{{total}}`,{file:S.file,index:S.fileIndex,count:S.fileCount,done:$(S.downloadedBytes),total:S.totalBytes===void 0?``:` / ${$(S.totalBytes)}`})})]}),x.isError&&u(`p`,{className:`mt-1.5 text-[11px] text-danger`,children:x.error instanceof Error?x.error.message:s(`common.error`,`Error`)})]})]})]})}function Ae({value:e,onChange:t}){let{t:n}=q(),r=O(),i=o({queryKey:Y,queryFn:()=>r.trpcClient.llm.listRuntimeNodes.query({})});return a(`div`,{children:[u(`div`,{className:`mb-1 text-[11px] font-medium text-foreground`,children:n(`ai.appleNode`,`Mac that runs it`)}),i.isPending&&a(`div`,{className:`flex items-center gap-1.5 text-[11px] text-foreground-subtle`,children:[u(T,{className:`h-3.5 w-3.5 animate-spin`}),n(`ai.appleAsking`,`Asking the nodes…`)]}),i.isError&&u(`p`,{className:`text-[11px] text-danger`,children:i.error instanceof Error?i.error.message:n(`ai.runtimesFailed`,`Failed to read runtime nodes`)}),i.isSuccess&&i.data.length===0&&u(`p`,{className:`text-[11px] text-foreground-subtle`,children:n(`ai.noRuntimes`,`No node advertises the llm-runtime capability.`)}),i.isSuccess&&i.data.length>0&&u(`div`,{role:`radiogroup`,className:`space-y-1.5`,children:i.data.map(r=>{let i=Ee(r),o=i.nodeId===e;return a(`button`,{type:`button`,role:`radio`,"aria-checked":o,disabled:!i.selectable&&!o,onClick:()=>t(i.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 ${o?`border-primary bg-primary/10`:`border-border bg-surface hover:bg-surface-hover`}`,children:[a(`span`,{className:`min-w-0`,children:[u(`span`,{className:`block font-medium text-foreground`,children:i.nodeId}),i.detail!==null&&u(`span`,{className:`block truncate text-[10px] text-foreground-subtle`,children:i.detail})]}),u(V,{variant:i.tone,children:n(i.labelKey,i.labelDefault)})]},i.nodeId)})}),u(`p`,{className:`mt-1.5 text-[10px] leading-relaxed text-foreground-subtle`,children:n(`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.`)})]})}e();function je({kind:e,className:t}){let n=pe(e.kind);return n===null?u(`span`,{className:t,children:e.icon}):u(n,{className:t})}function Me({kinds:e,onPick:t,onCancel:r}){let{t:i}=q(),o=n(()=>Se(e),[e]);return u(P,{open:!0,onClose:r,title:i(`ai.chooseKind`,`Choose a profile type`),width:`lg`,testId:`ai-kind-picker`,children:a(`div`,{className:`space-y-4`,children:[o.length===0&&u(`p`,{className:`text-xs text-foreground-subtle`,children:i(`ai.noKinds`,`No AI provider is installed.`)}),o.map(e=>a(`div`,{children:[u(`div`,{className:`mb-1.5 text-[10px] font-semibold uppercase tracking-wider text-foreground-subtle`,children:e.addonId}),u(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-3`,children:e.kinds.map(n=>a(`button`,{type:`button`,onClick:()=>t(n),className:`flex flex-col items-center gap-1.5 rounded-lg border border-border bg-surface px-3 py-3 text-xs transition-colors hover:border-primary/50 hover:bg-surface-hover`,children:[u(je,{kind:n,className:`h-5 w-5 text-foreground-subtle`}),u(`span`,{className:`font-medium text-foreground`,children:n.label})]},`${e.addonId}:${n.kind}`))})]},e.addonId))]})})}function Ne({kind:e,existing:t,onSave:i,onCancel:o,saving:c,error:l}){let{t:d}=q(),f=e.kind===`managed-local`,p=e.kind===`apple-foundation`,[m,h]=r(t?.appleFoundation?.nodeId??null),[g,_]=r(t?.name??e.label),[v,y]=r(()=>t===null?{}:me(t)),[b,x]=r(t?.runtime?.nodeId??`hub`),[S,C]=r(()=>t?.runtime===void 0?null:{model:t.runtime.model,modelId:t.model,supportsVision:t.supportsVision}),w=n(()=>_e(X(v.extraArgs)??``),[v.extraArgs]),E=()=>{if(p){if(m===null)return;i(we(g,t,v,m));return}if(!f){i(xe(e.kind,g,t,v));return}S!==null&&i(xe(e.kind,g,t,v,{nodeId:b,model:S.model,modelId:S.modelId,supportsVision:S.supportsVision}))},D=c||g.trim()===``||f&&S===null||p&&m===null;return u(P,{open:!0,onClose:o,title:t===null?d(`ai.newProfile`,`New {{kind}} profile`,{kind:e.label}):d(`ai.editProfile`,`Edit {{name}}`,{name:t.name}),error:l,width:`lg`,testId:`ai-profile-editor`,footer:a(s,{children:[f&&S===null&&u(V,{variant:`warning`,children:d(`ai.pickModelFirst`,`pick a model`)}),p&&m===null&&u(V,{variant:`warning`,children:d(`ai.pickAppleNodeFirst`,`pick a Mac`)}),a(z,{size:`sm`,type:`button`,disabled:D,onClick:E,children:[c&&u(T,{className:`h-3.5 w-3.5 animate-spin`}),t===null?d(`ai.createProfile`,`Create profile`):d(`ai.saveChanges`,`Save changes`)]})]}),children:a(`div`,{className:`space-y-3`,children:[a(`div`,{children:[u(`label`,{className:`mb-1 block text-[11px] font-medium text-foreground`,htmlFor:`ai-profile-name`,children:d(`ai.name`,`Name`)}),u(U,{id:`ai-profile-name`,value:g,onChange:e=>_(e.target.value),placeholder:e.label})]}),f&&a(s,{children:[u(F,{selectedNodeId:b,onSelect:x,label:d(`ai.runtimeNode`,`Runtime node`),alwaysShow:!0}),u(ke,{nodeId:b,value:S,onChange:C}),a(`div`,{children:[u(`label`,{className:`mb-1 block text-[11px] font-medium text-foreground`,htmlFor:`ai-extra-args`,children:d(`ai.extraArgs`,`Additional llama-server arguments`)}),u(U,{id:`ai-extra-args`,value:X(v.extraArgs)??``,onChange:e=>y({...v,extraArgs:e.target.value}),placeholder:ye.join(` `)}),w.length>0&&u(`div`,{className:`mt-1 flex flex-wrap gap-1`,children:w.map((e,t)=>u(V,{variant:`default`,children:e},`${e}-${String(t)}`))}),u(`p`,{className:`mt-1 text-[10px] leading-relaxed text-foreground-subtle`,children:d(`ai.extraArgsHint`,`Flags this form does not already own. Vision models generally need --jinja; some language-only models do not like it. Context size, GPU layers, parallel slots, flash attention and the KV-cache types are set in the fields below — repeating one here is rejected at start.`)})]})]}),p&&u(Ae,{value:m,onChange:h}),u(re,{schema:e.configSchema,values:v,onChange:y}),t!==null&&u(`p`,{className:`text-[10px] text-foreground-subtle`,children:d(`ai.secretHint`,`A stored API key is never shown. Leave it as-is to keep it; type a new value to replace it.`)})]})})}e();function Pe(e){return[{key:`name`,header:e.t(`ai.colProfile`,`Profile`),render:t=>{let n=e.kindByName.get(t.kind);return a(`span`,{className:`flex items-center gap-2`,children:[u(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-surface`,title:n?.label??t.kind,children:n===void 0?u(`span`,{className:`text-xs text-foreground-subtle`,children:`?`}):u(je,{kind:n,className:`h-4 w-4 text-foreground-subtle`})}),a(`span`,{className:`min-w-0`,children:[u(`span`,{className:`block truncate text-sm font-medium text-foreground`,children:t.name}),e.testResult?.id===t.id&&u(`span`,{className:`block truncate text-[10px] ${e.testResult.ok?`text-success`:`text-danger`}`,children:e.testResult.text})]})]})}},{key:`kind`,header:e.t(`ai.colKind`,`Kind`),nowrap:!0,render:t=>u(`span`,{className:`text-[11px] text-foreground-subtle`,children:e.kindByName.get(t.kind)?.label??t.kind})},{key:`model`,header:e.t(`ai.colModel`,`Model`),render:e=>u(`span`,{className:`text-[11px] text-foreground`,children:e.model})},{key:`vision`,header:e.t(`ai.colVision`,`Vision`),align:`center`,nowrap:!0,render:t=>t.supportsVision?u(V,{variant:`info`,style:`outline`,children:e.t(`ai.vision`,`vision`)}):u(`span`,{className:`text-[11px] text-foreground-subtle`,children:`—`})},{key:`node`,header:e.t(`ai.colNode`,`Node`),nowrap:!0,render:e=>e.runtime===void 0?u(`span`,{className:`text-[11px] text-foreground-subtle`,children:`—`}):u(V,{variant:`default`,children:e.runtime.nodeId})},{key:`enabled`,header:e.t(`ai.colOn`,`On`),align:`center`,nowrap:!0,render:t=>u(W,{checked:t.enabled,onCheckedChange:()=>e.onToggle(t),"aria-label":K.t(`system.aiProfilesTab.toggle`,`toggle {{name}}`,{name:t.name})})},{key:`actions`,header:``,align:`right`,nowrap:!0,render:t=>a(`span`,{className:`flex items-center justify-end gap-1`,children:[u(z,{size:`sm`,variant:`ghost`,type:`button`,onClick:()=>e.onTest(t),title:e.t(`ai.test`,`Test`),children:e.testingId===t.id?u(T,{className:`h-3.5 w-3.5 animate-spin`}):u(M,{className:`h-3.5 w-3.5`})}),u(z,{size:`sm`,variant:`ghost`,type:`button`,disabled:!e.kindByName.has(t.kind),onClick:()=>e.onEdit(t),title:e.t(`common.edit`,`Edit`),children:u(b,{className:`h-3.5 w-3.5`})}),u(z,{size:`sm`,variant:`ghost`,type:`button`,onClick:()=>e.onDelete(t),title:e.t(`common.delete`,`Delete`),children:u(h,{className:`h-3.5 w-3.5 text-danger`})})]})}]}function Fe(){let{t:e}=q(),s=O(),{state:c,openNew:d,openEdit:f,close:p}=ne(),[m,h]=r(null),[g,_]=r(null),[v,b]=r(null),x=o({queryKey:oe,queryFn:()=>s.trpcClient.llm.listProfiles.query({})}),S=o({queryKey:se,queryFn:async()=>(await s.trpcClient.llm.listProfileKinds.query({})).map(e=>({...e,configSchema:e.configSchema}))}),w=()=>{x.refetch()},E=i(()=>{h(null),b(null),p()},[p]);t(()=>{c.mode===`closed`&&h(null)},[c.mode]);let D=l({mutationFn:e=>s.trpcClient.llm.upsertProfile.mutate({profile:e}),onSuccess:()=>{E(),w()},onError:t=>b(t instanceof Error?t.message:e(`ai.saveFailed`,`Save failed`))}),ee=l({mutationFn:e=>s.trpcClient.llm.deleteProfile.mutate({addonId:e.addonId,profileId:e.id}),onSuccess:w}),k=l({mutationFn:e=>s.trpcClient.llm.testProfile.mutate({addonId:e.addonId,profileId:e.id}),onSuccess:(e,t)=>_({id:t.id,ok:e.ok,text:e.ok?K.t(`system.aiProfilesTab.testOk`,{text:e.text,tokens:e.usage.outputTokens,ms:e.latencyMs}):`${e.code}: ${e.message}`})}),A=x.data??[],j=n(()=>S.data??[],[S.data]),te=n(()=>{let e=new Map;for(let t of j)e.set(t.kind,t);return e},[j]),M=c.mode===`edit`?A.find(e=>e.id===c.id)??null:null,re=M===null?null:te.get(M.kind)??null,P=c.mode===`new`&&m===null,F=c.mode===`new`?m:re,L=c.mode===`edit`?M:null,R=F!==null&&(c.mode===`new`||L!==null);return a(J,{embedded:!0,icon:C,title:e(`ai.profilesTitle`,`AI profiles`),subtitle:e(`ai.profilesSubtitle`,`One row = one usable model endpoint. The defaults below decide who answers when a feature names no profile.`),children:[u(`div`,{className:`flex justify-end`,children:a(z,{size:`sm`,type:`button`,onClick:()=>{b(null),h(null),d()},children:[u(y,{className:`h-3.5 w-3.5`}),e(`ai.addProfile`,`Add profile`)]})}),x.isError&&u(N,{title:e(`ai.loadFailed`,`Failed to load profiles`),message:x.error instanceof Error?x.error.message:e(`common.error`,`Error`),onRetry:()=>void x.refetch()}),u(Ie,{profiles:A}),x.isLoading&&u(`div`,{className:`flex items-center justify-center py-16`,children:u(T,{className:`h-6 w-6 animate-spin text-primary`})}),!x.isLoading&&A.length===0&&u(`div`,{className:`py-16 text-center text-xs text-foreground-subtle`,children:e(`ai.noProfiles`,`No AI profiles yet. Click "Add profile" to configure one.`)}),A.length>0&&u(B,{headingId:`ai-profiles-list`,title:e(`ai.profilesList`,`Profiles`),children:u(I,{columns:Pe({kindByName:te,testResult:g,testingId:k.isPending?k.variables?.id??null:null,t:e,onToggle:e=>D.mutate({...e,enabled:!e.enabled,apiKey:`__redacted__`}),onTest:e=>k.mutate(e),onEdit:e=>{te.has(e.kind)&&(b(null),h(null),f(e.id))},onDelete:e=>ee.mutate(e)}),rows:A,rowKey:e=>e.id,minWidthPx:760,bordered:!1,maxBodyHeight:`max-h-[60vh]`})}),P&&u(Me,{kinds:j,onCancel:E,onPick:e=>{b(null),h(e)}}),R&&F!==null&&u(Ne,{kind:F,existing:L,saving:D.isPending,error:v,onSave:e=>D.mutate(e),onCancel:E})]})}function Ie({profiles:e}){let{t}=q(),n=O(),r=o({queryKey:ce,queryFn:()=>n.trpcClient.llm.getDefaults.query({})}),i=l({mutationFn:e=>n.trpcClient.llm.setDefault.mutate({selector:{purpose:e.purpose},profileId:e.profileId}),onSuccess:()=>{r.refetch()}}),s=e=>(r.data??[]).find(t=>`purpose`in t.selector&&t.selector.purpose===e)?.profileId??``,c=e=>e===`vision`?t(`ai.defaultVision`,`Default vision profile`):t(`ai.defaultText`,`Default text profile`);return u(B,{headingId:`ai-profiles-defaults`,title:t(`ai.defaultsTitle`,`Defaults`),children:u(`div`,{className:`${d} grid gap-4 sm:grid-cols-2`,children:de.map(({purpose:n,visionOnly:r})=>{let o=r?e.filter(e=>e.supportsVision):e,l=s(n),d=e.find(e=>e.id===l);return a(`div`,{children:[u(`label`,{className:`mb-1 block text-[11px] font-medium text-foreground`,htmlFor:`llm-default-${n}`,children:c(n)}),u(R,{id:`llm-default-${n}`,"aria-label":c(n),className:`h-7 text-xs`,value:l,onChange:e=>i.mutate({purpose:n,profileId:e.target.value===``?null:e.target.value}),options:[{value:``,label:t(`ai.none`,`None`)},...l!==``&&!o.some(e=>e.id===l)?[{value:l,label:d?.name??l}]:[],...o.map(e=>({value:e.id,label:`${e.name} · ${e.model}`}))]}),l!==``&&d===void 0&&u(`p`,{className:`mt-1 text-[10px] text-danger`,children:t(`ai.defaultMissing`,`This default names a profile that no longer exists.`)}),d!==void 0&&!d.enabled&&u(`p`,{className:`mt-1 text-[10px] text-warning`,children:t(`ai.defaultDisabled`,`This default profile is disabled — callers resolve to no profile.`)}),i.error!=null&&u(`p`,{className:`mt-1 text-[10px] text-danger`,children:String(i.error)})]},n)})})})}e();var Le=5e3;function Re(e){return K.t(`system.aiRuntimes.sizeGb`,{value:(e/1e9).toFixed(1)})}function ze(){let{t:e}=q(),t=O(),r=o({queryKey:Y,refetchInterval:Le,queryFn:()=>t.trpcClient.llm.listRuntimeNodes.query({})}),i=n(()=>[{key:`node`,header:e(`ai.colNode`,`Node`),render:e=>u(`span`,{className:`text-sm font-medium text-foreground`,children:e.nodeId})},{key:`state`,header:e(`ai.colState`,`State`),nowrap:!0,render:t=>a(`span`,{className:`flex items-center gap-1.5`,children:[u(V,{variant:t.reachable?`success`:`danger`,children:t.reachable?t.status?.state??e(`ai.ready`,`ready`):e(`ai.unreachable`,`unreachable`)}),t.status?.downloadProgress!==void 0&&u(V,{variant:`info`,children:`${String(Math.round(t.status.downloadProgress*100))}%`})]})},{key:`model`,header:e(`ai.colModel`,`Model`),render:e=>u(`span`,{className:`text-[11px] text-foreground`,children:e.status?.modelId??`—`})},{key:`disk`,header:e(`ai.colDisk`,`On disk`),align:`right`,nowrap:!0,render:e=>u(`span`,{className:`text-[11px] text-foreground-subtle`,children:e.disk===void 0?`—`:Re(e.disk.modelsBytes)})},{key:`apple`,header:e(`ai.colApple`,`Apple on-device`),render:t=>{let n=Ee(t);return a(`span`,{className:`flex flex-col items-start gap-0.5`,children:[u(V,{variant:n.tone,children:e(n.labelKey,n.labelDefault)}),n.detail!==null&&u(`span`,{className:`text-[10px] text-foreground-subtle`,children:n.detail})]})}},{key:`error`,header:e(`ai.colError`,`Error`),render:e=>e.error===void 0?u(`span`,{className:`text-[11px] text-foreground-subtle`,children:`—`}):u(`span`,{className:`text-[11px] text-danger`,children:e.error})}],[e]),s=r.data??[];return a(J,{embedded:!0,icon:k,title:e(`ai.runtimesTitle`,`Managed runtimes`),subtitle:e(`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.`),children:[r.isError&&u(N,{title:e(`ai.runtimesFailed`,`Failed to read runtime nodes`),message:r.error instanceof Error?r.error.message:e(`common.error`,`Error`),onRetry:()=>void r.refetch()}),s.length===0?u(`div`,{className:`py-16 text-center text-xs text-foreground-subtle`,children:e(`ai.noRuntimes`,`No node advertises the llm-runtime capability.`)}):u(B,{headingId:`ai-runtimes-list`,title:e(`ai.runtimesList`,`Nodes`),children:u(I,{columns:i,rows:s,rowKey:e=>e.nodeId,minWidthPx:760,bordered:!1,maxBodyHeight:H})})]})}var Be=x(`/addon/ai/test-chat`),Ve=x(`/addon/ai/test-chat/chats`),He=6e5;function Ue(e){let t=e.firstTokenTimeoutMs;if(!(typeof t!=`number`||!Number.isFinite(t)||t<=0))return Math.min(Math.round(t),He)}function We(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ge(e){if(!We(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 Ke=[`resolving-image`,`connecting`,`first-token-wait`,`streaming`];function qe(e){let t;try{t=JSON.parse(e)}catch{return null}if(!We(t))return null;switch(t.kind){case`status`:{let e=Ke.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:Ge(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:K.t(`helpers.aiTestChat.providerError`)};default:return null}}async function*Je(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=qe(e);t!==null&&(yield t)}a=r.indexOf(`
|
|
3
|
-
`)}}let e=r.trim();if(e.length>0){let t=qe(e);t!==null&&(yield t)}}finally{t.releaseLock()}}function Ye(e){return e.filter(e=>e.failed!==!0&&e.content.length>0).map(e=>({role:e.role,content:e.content}))}function Xe(e){return e.thumbnailBase64===void 0||e.thumbnailBase64.length===0?null:`data:${e.mimeType};base64,${e.thumbnailBase64}`}function Ze(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 Qe(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 $e(e,t){switch(e){case`resolving-image`:return K.t(`helpers.aiTestChat.phaseImage`);case`connecting`:return K.t(`helpers.aiTestChat.phaseConnecting`);case`first-token-wait`:return t>0?K.t(`helpers.aiTestChat.phaseWaitUpTo`,{seconds:Math.round(t/1e3)}):K.t(`helpers.aiTestChat.phaseWait`);case`streaming`:return K.t(`helpers.aiTestChat.phaseAnswering`)}}e();var et=[`pipelineAnalytics`,`listRecentTracks`,`ai-test`],tt=360*60*1e3,nt=40,rt=160,it={phase:`connecting`,firstTokenTimeoutMs:0,text:``,mediaSent:null};function at(){let{t:e}=q(),s=O(),[l,d]=r(``),[f,p]=r(``),[m,g]=r(``),[y,b]=r([]),[x,S]=r(null),[C,w]=r(`none`),[T,E]=r(`throwaway`),[k,j]=r(null),[ne,re]=r([]),[P,F]=r(null),[I,B]=r(null),V=c(null);t(()=>()=>V.current?.abort(),[]);let H=i(async()=>{let e=await fetch(Ve,{credentials:`same-origin`});e.ok&&re((await e.json()).chats??[])},[]);t(()=>{T===`persistent`&&H()},[T,H]);let W=o({queryKey:oe,queryFn:()=>s.trpcClient.llm.listProfiles.query({})}),G=n(()=>(W.data??[]).filter(e=>e.enabled),[W.data]),K=G.find(e=>e.id===l)??null,ie=I!==null,ae=i(async(t,n)=>{let r=new AbortController;V.current=r,F(null);let i=Ue(K??{});B({...it,firstTokenTimeoutMs:i??0});let a=``,o=null,s,c=null,u=null,d;try{let e=await fetch(Be,{method:`POST`,headers:{"content-type":`application/json`},credentials:`same-origin`,signal:r.signal,body:JSON.stringify({profileId:l,messages:t,...f.trim()===``?{}:{system:f.trim()},...n===void 0?{}:{attachment:n},...i===void 0?{}:{firstTokenTimeoutMs:i},...T===`persistent`?{persist:!0,...k===null?{}:{conversationId:k}}:{}})});if(!e.ok||e.body===null){let t=await e.text().catch(()=>``);throw Error(t.length>0?t:`HTTP ${String(e.status)}`)}for await(let t of Je(e.body))switch(t.kind){case`status`:B(e=>({...e??it,phase:t.phase}));break;case`meta`:o=t.mediaSent,s=t.model,B(e=>({...e??it,firstTokenTimeoutMs:t.firstTokenTimeoutMs,mediaSent:t.mediaSent}));break;case`token`:a+=t.text,B(e=>({...e??it,text:a}));break;case`done`:u={outputTokens:t.outputTokens,latencyMs:t.latencyMs},d=t.conversationId;break;case`error`:c=`${t.code}: ${t.message}`;break}}catch(t){r.signal.aborted||F(t instanceof Error?t.message:e(`common.error`,`Error`))}finally{V.current=null,B(null)}d!==void 0&&(j(d),H());let p=r.signal.aborted&&a.length>0;c===null&&a.length===0&&!p||b(e=>[...e,{id:`a-${String(Date.now())}`,role:`assistant`,content:c??a,...c===null?{}:{failed:!0},...o===null?{}:{attachment:o},...s!==void 0&&c===null?{model:s}:{},...u===null?{}:u}])},[T,k,K,l,H,f,e]),se=i(()=>{let e=m.trim();if(e===``||l===``||ie)return;let t={id:`u-${String(Date.now())}`,role:`user`,content:e,...x===null?{}:{attachmentLabel:x.label,attachmentKind:x.ref.kind}},n=[...y,t];b(n),g(``);let r=x?.ref;S(null),w(`none`),ae(T===`persistent`&&k!==null?[{role:`user`,content:e}]:Ye(n),r)},[T,k,m,x,l,ae,ie,y]),ce=()=>V.current?.abort(),Y=()=>{V.current?.abort(),b([]),S(null),g(``),F(null),B(null),j(null)},le=async e=>{V.current?.abort();let t=await fetch(`${Ve}/${e}`,{credentials:`same-origin`});if(!t.ok)return;let n=await t.json();j(e),b(Ze(n)),B(null),F(null)};return a(J,{embedded:!0,icon:ee,title:e(`ai.testTitle`,`Test chat`),subtitle:e(T===`persistent`?`ai.testSubtitlePersistent`:`ai.testSubtitle`,T===`persistent`?`Conversations are saved for you and can be reopened. Throwaway mode is still available.`:`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.`),children:[u(`div`,{className:`flex justify-end`,children:a(z,{size:`sm`,variant:`secondary`,type:`button`,disabled:y.length===0&&x===null,onClick:Y,children:[u(h,{className:`h-3.5 w-3.5`}),e(`ai.clearChat`,`Clear`)]})}),a(L,{className:`space-y-3 p-4`,children:[a(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[a(`div`,{children:[u(`label`,{className:`mb-1 block text-[11px] font-medium text-foreground`,htmlFor:`ai-test-profile`,children:e(`ai.profile`,`Profile`)}),u(R,{id:`ai-test-profile`,value:l,onChange:e=>d(e.target.value),options:[{value:``,label:e(`ai.selectProfile`,`Select a profile…`)},...G.map(e=>({value:e.id,label:`${e.name} · ${e.model}${e.supportsVision?` · vision`:``}`}))]}),G.length===0&&!W.isLoading&&u(`p`,{className:`mt-1 text-[10px] text-foreground-subtle`,children:e(`ai.noEnabledProfiles`,`No enabled profile. Add one on the Profiles tab.`)})]}),a(`div`,{children:[u(`label`,{className:`mb-1 block text-[11px] font-medium text-foreground`,htmlFor:`ai-test-system`,children:e(`ai.systemPrompt`,`System prompt (optional)`)}),u(U,{id:`ai-test-system`,value:f,onChange:e=>p(e.target.value),placeholder:e(`ai.systemPlaceholder`,`Answer in one short sentence.`)})]})]}),a(`div`,{className:`flex flex-wrap items-center gap-2`,children:[u(z,{size:`sm`,variant:T===`throwaway`?`primary`:`outline`,type:`button`,onClick:()=>{E(`throwaway`),j(null)},children:e(`ai.throwawayMode`,`Throwaway`)}),u(z,{size:`sm`,variant:T===`persistent`?`primary`:`outline`,type:`button`,onClick:()=>E(`persistent`),children:e(`ai.saveConversation`,`Save conversation`)})]}),T===`persistent`&&a(`div`,{className:`space-y-2`,children:[u(`div`,{className:`flex items-center gap-2`,children:a(z,{size:`sm`,variant:`secondary`,type:`button`,onClick:Y,children:[u(te,{className:`h-3.5 w-3.5`}),e(`ai.newChat`,`New chat`)]})}),ne.length>0&&u(`div`,{className:`max-h-36 divide-y divide-border overflow-y-auto rounded-md border border-border`,children:ne.map(e=>u(`button`,{type:`button`,onClick:()=>void le(e.id),className:`flex w-full px-2.5 py-1.5 text-left text-[11px] hover:bg-surface-hover ${e.id===k?`bg-primary/10`:``}`,children:u(`span`,{className:`min-w-0 flex-1 truncate text-foreground`,children:e.title})},e.id))})]}),u(`p`,{className:`text-[10px] text-foreground-subtle`,children:e(`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.`)}),K!==null&&!K.supportsVision&&u(`p`,{className:`text-[10px] text-warning`,children:e(`ai.notVision`,`This profile is not vision-capable — an attached image will be refused before anything is read.`)})]}),P!==null&&u(N,{title:e(`ai.chatFailed`,`The test call failed`),message:P}),u(ot,{turns:y,live:I}),a(L,{className:`space-y-2 p-3`,children:[x!==null&&a(`div`,{className:`flex items-center gap-2 rounded-md border border-border bg-surface px-2.5 py-1.5`,children:[x.ref.kind===`snapshot`?u(A,{className:`h-3.5 w-3.5 text-foreground-subtle`}):u(v,{className:`h-3.5 w-3.5 text-foreground-subtle`}),u(`span`,{className:`min-w-0 flex-1 truncate text-[11px] text-foreground`,children:x.label}),u(z,{size:`sm`,variant:`ghost`,type:`button`,onClick:()=>S(null),children:u(D,{className:`h-3.5 w-3.5`})})]}),a(`div`,{className:`flex flex-wrap items-center gap-2`,children:[a(z,{size:`sm`,variant:C===`snapshot`?`primary`:`outline`,type:`button`,onClick:()=>w(C===`snapshot`?`none`:`snapshot`),children:[u(A,{className:`h-3.5 w-3.5`}),e(`ai.attachSnapshot`,`Camera snapshot`)]}),a(z,{size:`sm`,variant:C===`track`?`primary`:`outline`,type:`button`,onClick:()=>w(C===`track`?`none`:`track`),children:[u(v,{className:`h-3.5 w-3.5`}),e(`ai.attachTrack`,`Recent track`)]})]}),C===`snapshot`&&u(lt,{onPick:t=>{S({ref:{kind:`snapshot`,deviceId:t.id},label:e(`ai.snapshotOf`,`Snapshot of {{name}}`,{name:t.name})}),w(`none`)}}),C===`track`&&u(dt,{onPick:(t,n)=>{S({ref:{kind:`track`,trackId:t.trackId,deviceId:t.deviceId},label:e(`ai.trackOf`,`{{class}} on {{name}}`,{class:t.label??t.className,name:n})}),w(`none`)}}),a(`div`,{className:`flex items-center gap-2`,children:[u(U,{value:m,onChange:e=>g(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),se())},placeholder:e(`ai.messagePlaceholder`,`Ask the model something…`),"aria-label":e(`ai.message`,`Message`)}),ie?a(z,{size:`sm`,variant:`secondary`,type:`button`,onClick:ce,children:[u(_,{className:`h-3.5 w-3.5`}),e(`ai.stop`,`Stop`)]}):a(z,{size:`sm`,type:`button`,disabled:m.trim()===``||l===``,onClick:se,children:[u(M,{className:`h-3.5 w-3.5`}),e(`ai.send`,`Send`)]})]})]})]})}function ot({turns:e,live:t}){let{t:n}=q();return e.length===0&&t===null?u(`div`,{className:`py-12 text-center text-xs text-foreground-subtle`,children:n(`ai.chatEmpty`,`Pick a profile, optionally attach a camera snapshot or a recent track, and send a message. Nothing here is saved.`)}):u(L,{children:a(`div`,{className:`max-h-[50vh] space-y-2 overflow-y-auto p-3`,children:[e.map(e=>u(st,{turn:e},e.id)),t!==null&&a(`div`,{className:`space-y-1`,children:[t.mediaSent!==null&&u(ct,{attachment:t.mediaSent}),t.text.length>0&&u(st,{turn:{id:`live`,role:`assistant`,content:t.text},streaming:!0}),a(`div`,{className:`flex items-center gap-2 text-[11px] text-foreground-subtle`,children:[u(T,{className:`h-3.5 w-3.5 animate-spin`}),$e(t.phase,t.firstTokenTimeoutMs)]})]})]})})}function st({turn:e,streaming:t=!1}){let{t:n}=q(),r=e.role===`user`,i=e.failed===!0?`border-danger/40 bg-danger/10`:`border-border bg-surface`;return u(`div`,{className:`flex ${r?`justify-end`:`justify-start`}`,children:a(`div`,{className:`max-w-[85%] rounded-lg border px-3 py-2 ${r?`border-primary/40 bg-primary/10`:i}`,children:[a(`p`,{className:`whitespace-pre-wrap break-words text-xs text-foreground`,children:[e.content,t&&u(`span`,{className:`ml-0.5 animate-pulse text-primary`,children:`▌`})]}),e.attachment!==void 0&&u(ct,{attachment:e.attachment}),e.attachmentLabel!==void 0&&a(`p`,{className:`mt-1 flex items-center gap-1 text-[10px] text-foreground-subtle`,children:[e.attachmentKind===`track`?u(v,{className:`h-3 w-3`}):u(A,{className:`h-3 w-3`}),e.attachmentLabel]}),e.attachment!==void 0&&a(`p`,{className:`mt-1 flex items-center gap-1 text-[10px] text-foreground-subtle`,children:[e.attachment.kind===`snapshot`?u(A,{className:`h-3 w-3`}):u(v,{className:`h-3 w-3`}),Qe(e.attachment)]}),e.model!==void 0&&u(`p`,{className:`mt-1 text-[10px] text-foreground-subtle`,children:n(`system.aiTestChat.tokMs`,`{{model}} · {{value2}} tok · {{value3}} ms`,{model:e.model,value2:String(e.outputTokens??0),value3:String(e.latencyMs??0)})})]})})}function ct({attachment:e}){let{t}=q(),n=Xe(e);return n===null?null:u(`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 lt({onPick:e}){let{t}=q(),n=G({isCamera:!0,projection:`slim`}),r=(n.data??[]).filter(e=>!e.disabled);return n.isLoading?u(T,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):r.length===0?u(`p`,{className:`text-[11px] text-foreground-subtle`,children:t(`ai.noCameras`,`No camera found.`)}):u(`div`,{className:`grid max-h-56 grid-cols-2 gap-2 overflow-y-auto sm:grid-cols-4`,children:r.map(t=>u(ut,{device:t,onPick:e},t.id))})}function ut({device:e,onPick:t}){let{t:n}=q(),{src:r}=p(e.id,{width:rt});return a(`button`,{type:`button`,onClick:()=>t(e),className:`overflow-hidden rounded-md border border-border bg-surface text-left transition-colors hover:border-primary/50`,children:[u(`span`,{className:`block aspect-video w-full bg-background-elevated`,children:r!==null&&u(`img`,{src:r,alt:``,className:`h-full w-full object-cover`,loading:`lazy`})}),a(`span`,{className:`flex items-center gap-1 px-2 py-1`,children:[!e.online&&u(V,{variant:`warning`,children:n(`common.off`)}),u(`span`,{className:`truncate text-[10px] text-foreground`,children:e.name})]})]})}function dt({onPick:e}){let{t}=q(),r=O(),i=G({isCamera:!0,projection:`slim`}),s=n(()=>(i.data??[]).map(e=>e.id),[i.data]),c=n(()=>{let e=new Map;for(let t of i.data??[])e.set(t.id,t.name);return e},[i.data]),l=o({queryKey:[...et,s.length],enabled:s.length>0,queryFn:()=>r.trpcClient.pipelineAnalytics.listRecentTracks.query({deviceIds:[...s],since:Date.now()-tt,limit:nt,projection:`slim`})});if(i.isLoading||l.isLoading)return u(T,{className:`h-4 w-4 animate-spin text-foreground-subtle`});let d=l.data?.tracks??[];return d.length===0?u(`p`,{className:`text-[11px] text-foreground-subtle`,children:t(`ai.noTracks`,`No track in the last 6 hours.`)}):u(`div`,{className:`max-h-56 divide-y divide-border overflow-y-auto rounded-md border border-border`,children:d.map(t=>a(`button`,{type:`button`,onClick:()=>e(t,c.get(t.deviceId)??String(t.deviceId)),className:`flex w-full items-center gap-2 px-2.5 py-1.5 text-left text-[11px] hover:bg-surface-hover`,children:[u(v,{className:`h-3.5 w-3.5 shrink-0 text-foreground-subtle`}),u(`span`,{className:`min-w-0 flex-1 truncate text-foreground`,children:t.label??t.className}),u(`span`,{className:`shrink-0 text-foreground-subtle`,children:c.get(t.deviceId)??t.deviceId}),u(`span`,{className:`shrink-0 text-foreground-subtle`,children:new Date(t.lastSeen).toLocaleTimeString()})]},t.trackId))})}e();var ft=1440*60*1e3,pt=[1,7,30,90];function mt(){let{t:e}=q(),t=O(),[i,s]=r(7),c=n(()=>{let e=new Date;return e.setHours(0,0,0,0),e.getTime()-(i-1)*ft},[i]),l=o({queryKey:oe,queryFn:()=>t.trpcClient.llm.listProfiles.query({})}),d=o({queryKey:[...ue,i],queryFn:()=>t.trpcClient.llm.getUsage.query({since:c})}),f=n(()=>{let e=new Map;for(let t of l.data??[])e.set(t.id,t.name);return e},[l.data]),p=n(()=>[{key:`day`,header:e(`ai.colDay`,`Day`),nowrap:!0,render:e=>e.day},{key:`consumer`,header:e(`ai.colConsumer`,`Consumer`),nowrap:!0,render:e=>u(`span`,{className:`text-[11px] text-foreground`,children:e.consumer})},{key:`profile`,header:e(`ai.colProfile`,`Profile`),render:e=>u(`span`,{className:`text-[11px] text-foreground`,children:f.get(e.profileId)??e.profileId})},{key:`calls`,header:e(`ai.colCalls`,`Calls`),align:`right`,nowrap:!0,render:e=>String(e.calls)},{key:`okErr`,header:e(`ai.colOkErr`,`OK / err`),align:`right`,nowrap:!0,render:e=>u(`span`,{className:e.errorCalls>0?`text-danger`:void 0,children:`${String(e.okCalls)} / ${String(e.errorCalls)}`})},{key:`tokens`,header:e(`ai.colTokens`,`In / out tok`),align:`right`,nowrap:!0,render:e=>`${String(e.inputTokens)} / ${String(e.outputTokens)}`},{key:`latency`,header:e(`ai.colAvgMs`,`Avg ms`),align:`right`,nowrap:!0,render:e=>String(Math.round(e.avgLatencyMs))}],[f,e]),m=d.data??[];return a(J,{embedded:!0,icon:S,title:e(`ai.usageTitle`,`Usage`),subtitle:e(`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.`),actions:u(`div`,{className:`w-40`,children:u(R,{"aria-label":e(`ai.window`,`Window`),value:String(i),options:pt.map(t=>({value:String(t),label:e(`ai.lastDays`,`Last {{days}} days`,{days:t})})),onChange:e=>s(Number(e.target.value))})}),children:[d.isError&&u(N,{title:e(`ai.usageFailed`,`Failed to read usage`),message:d.error instanceof Error?d.error.message:e(`common.error`,`Error`),onRetry:()=>void d.refetch()}),m.length===0?u(`div`,{className:`py-16 text-center text-xs text-foreground-subtle`,children:e(`ai.noUsage`,`No AI calls in this window.`)}):u(B,{headingId:`ai-usage-list`,title:e(`ai.usageList`,`Rollup`),children:u(I,{columns:p,rows:m,rowKey:e=>`${e.day}|${e.consumer}|${e.profileId}`,minWidthPx:720,bordered:!1,maxBodyHeight:H})})]})}function ht(){let{t:e}=q(),t=ie(`/system/ai`,{t:e,isAdmin:!0})??{icon:C,title:e(`system.ai`,`AI`)};return u(ae,{icon:t.icon,title:t.title,defaultSection:`profiles`,sectionsLabel:`${t.title} sections`,sections:[{id:`profiles`,label:e(`ai.tabProfiles`,`Profiles`),content:u(Fe,{})},{id:`runtimes`,label:e(`ai.tabRuntimes`,`Runtimes`),content:u(ze,{})},{id:`usage`,label:e(`ai.tabUsage`,`Usage`),content:u(mt,{})},{id:`test`,label:e(`ai.tabTest`,`Test`),content:u(at,{})}]})}export{ht as AiProfilesPage,ht as default};
|