@lacneu/atrium 0.104.0 → 0.104.3
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/AccessTab-D8xdWzT5.js +1 -0
- package/dist/assets/{AdminSettings-BdVeeUB1.js → AdminSettings-CtNcFhMz.js} +1 -1
- package/dist/assets/{AdvancedFilter-B4QfxxEB.js → AdvancedFilter-Cod8SSd6.js} +1 -1
- package/dist/assets/AgentFilesTab-Dfkkm3Fw.js +3 -0
- package/dist/assets/AnomaliesTab-DlZ5M2UC.js +1 -0
- package/dist/assets/AuditTab-Dh6gO6j5.js +1 -0
- package/dist/assets/BridgeTab-Bnu9R5N4.js +1 -0
- package/dist/assets/ChatDefaultsTab-CxmayDqi.js +1 -0
- package/dist/assets/{ConfirmDialog-BmOX8o6F.js → ConfirmDialog-B7k0wvSi.js} +1 -1
- package/dist/assets/{DataTableShell-BTk71L7O.js → DataTableShell-DvtkASQG.js} +1 -1
- package/dist/assets/DeletedChatsTab-CnaK-AH0.js +1 -0
- package/dist/assets/{DetailChips-BU-SQfjj.js → DetailChips-DDAtgnjA.js} +1 -1
- package/dist/assets/EntitySheet-DRzkWKlH.js +1 -0
- package/dist/assets/FeedbacksTab-D4LKaB_2.js +1 -0
- package/dist/assets/{FieldLabel-Wb5bwK7r.js → FieldLabel-imj_Z0rZ.js} +1 -1
- package/dist/assets/FilesTab-D3XWSI2t.js +1 -0
- package/dist/assets/{FilterBar-D2w0wWnm.js → FilterBar-DCCuFxDn.js} +1 -1
- package/dist/assets/GroupsTab-DbayDYbZ.js +1 -0
- package/dist/assets/InstancesTab-031fn2Jt.js +1 -0
- package/dist/assets/IntegrationsTab-1whhDsmk.js +1 -0
- package/dist/assets/KnobRow-D6kXWvVI.js +1 -0
- package/dist/assets/KpiTab-2Vk6EtCf.js +1 -0
- package/dist/assets/PreferencesTab-B5h49bYq.js +1 -0
- package/dist/assets/ProjectPage-BNKL-iOz.js +1 -0
- package/dist/assets/PromptInjectionsTab-Bmn1iSpB.js +4 -0
- package/dist/assets/RolesTab-DHxLatAl.js +1 -0
- package/dist/assets/ScheduledTab-NHSyQ677.js +1 -0
- package/dist/assets/ServiceAccountsTab-CKV8crhK.js +1 -0
- package/dist/assets/SubAgentReportsTab-BWfXOTck.js +1 -0
- package/dist/assets/ThemeShowroom-Do9I3hrR.js +1 -0
- package/dist/assets/{TimeRangePicker-BvcqBpnq.js → TimeRangePicker-BZtw1JkM.js} +1 -1
- package/dist/assets/{TimezoneCombobox-BUC66FuM.js → TimezoneCombobox-CeRN4N3z.js} +1 -1
- package/dist/assets/TracesTab-BNWFPad2.js +1 -0
- package/dist/assets/TrashTab-D5irFeF0.js +1 -0
- package/dist/assets/UsersTab-CHs3CRev.js +1 -0
- package/dist/assets/VoiceTab-DRvjgMdZ.js +1 -0
- package/dist/assets/{alert-dialog-BwvaE8oD.js → alert-dialog-BcJMHbhI.js} +1 -1
- package/dist/assets/{api-jG5Fwsg4.js → api-CWqdeSbN.js} +5 -5
- package/dist/assets/{badge-CSm2xaYH.js → badge-ChMMFtuW.js} +1 -1
- package/dist/assets/{button-sV7hIR3f.js → button-C_rIPtCv.js} +1 -1
- package/dist/assets/{card-i1bbFYFv.js → card-BV8NO76j.js} +1 -1
- package/dist/assets/check-DdmANHSb.js +1 -0
- package/dist/assets/{checkbox-U99HMqP3.js → checkbox-DPxJTQjc.js} +1 -1
- package/dist/assets/chevron-left-ByEQraEh.js +1 -0
- package/dist/assets/chevron-right-DMqzlhWH.js +1 -0
- package/dist/assets/chevron-up-B3KYmtzo.js +1 -0
- package/dist/assets/chevrons-up-down-CITEfz7_.js +1 -0
- package/dist/assets/{compatView-Cqu0P9sx.js → compatView-Cz5KNXa-.js} +1 -1
- package/dist/assets/convexApi-G20_TNBS.js +1 -0
- package/dist/assets/{copy-BIRdG3Nl.js → copy-DbstFM9Q.js} +1 -1
- package/dist/assets/{cronDescribe-D9eP5CDy.js → cronDescribe-CkiSvbCK.js} +1 -1
- package/dist/assets/{deliveryRecorder-DEtCAEff.js → deliveryRecorder-B_kVKMkR.js} +1 -1
- package/dist/assets/{dialog-Bpoyy7pR.js → dialog-CPAskUwF.js} +1 -1
- package/dist/assets/dispatchErrorInfo-7H2cJGwt.js +1 -0
- package/dist/assets/{dist-D7Oplune.js → dist-BjZo0sql.js} +1 -1
- package/dist/assets/{dist-ChYvHRlL.js → dist-Bu9sqVcp.js} +1 -1
- package/dist/assets/{dist-t45SSvfU.js → dist-CYh9BuQS.js} +1 -1
- package/dist/assets/{dist-Bxf4XoMW.js → dist-CzmY6YrA.js} +1 -1
- package/dist/assets/{dist-B9q2nlqC.js → dist-Uf18yR_a.js} +1 -1
- package/dist/assets/{download-DQYw1N-_.js → download-BaebAe6Z.js} +1 -1
- package/dist/assets/{dropdown-menu-yCbwljS-.js → dropdown-menu-BVKVjups.js} +1 -1
- package/dist/assets/{eye-CZuTJsZX.js → eye-LggiM6Z5.js} +1 -1
- package/dist/assets/{format-BQaxlN43.js → format-AQELUhPa.js} +1 -1
- package/dist/assets/{groupManageView-BcbLXWZ4.js → groupManageView-DC3eSLA1.js} +1 -1
- package/dist/assets/index-DLjKxzJ_.css +1 -0
- package/dist/assets/index-Dq26_OeV.js +158 -0
- package/dist/assets/{input-DReDYsos.js → input-CSZu-bVE.js} +1 -1
- package/dist/assets/{list-kKcfLqpz.js → list-obbqPBzD.js} +1 -1
- package/dist/assets/loader-circle-BqKiW3X9.js +1 -0
- package/dist/assets/{lock-DJQnxN_w.js → lock-BlVhOk85.js} +1 -1
- package/dist/assets/{pencil-C_IJUeJn.js → pencil-K7SBkvHL.js} +1 -1
- package/dist/assets/plus-DTL4K-j9.js +1 -0
- package/dist/assets/{popover-BcL-AsC2.js → popover-C-Y_Yoco.js} +1 -1
- package/dist/assets/roleDescriptions-DHny6e80.js +1 -0
- package/dist/assets/rotate-ccw-CvefWwHW.js +1 -0
- package/dist/assets/{search-CGco_tlI.js → search-Dz6sLH0-.js} +1 -1
- package/dist/assets/{select-DGKgMOlh.js → select-CjcMQhwm.js} +1 -1
- package/dist/assets/{server-ClLFUY_D.js → server-DcInl3Nh.js} +1 -1
- package/dist/assets/{speech-DO_eJ8Aq.js → speech-ehUcmGCg.js} +1 -1
- package/dist/assets/{star-B6yMf_Hc.js → star-5ysDlx3k.js} +1 -1
- package/dist/assets/{switch-D-QGMGm7.js → switch--NPD3Vp0.js} +1 -1
- package/dist/assets/{table-CIrFKiPM.js → table-rRR3TpMc.js} +1 -1
- package/dist/assets/{tabs-BWfAdnjK.js → tabs-B8emuY1B.js} +1 -1
- package/dist/assets/toast-C_YfUacM.js +1 -0
- package/dist/assets/{tooltip-CobtYK4c.js → tooltip-Ct0TGxtk.js} +1 -1
- package/dist/assets/{trash-2-UxV-pTWt.js → trash-2-xhtrhYsd.js} +1 -1
- package/dist/assets/trashPage-3suR6eIy.js +1 -0
- package/dist/assets/trashView-CwUC01r_.js +1 -0
- package/dist/assets/{triangle-alert-BMryltpr.js → triangle-alert-DoL9TI6v.js} +1 -1
- package/dist/assets/{usageView-CKi8uUZb.js → usageView-BuRtXekW.js} +1 -1
- package/dist/assets/{useChart-BE4pYQJh.js → useChart-bV4rotdu.js} +1 -1
- package/dist/assets/{useFontScale-DCa0acMC.js → useFontScale-DiSkEM6I.js} +1 -1
- package/dist/assets/{useStartNewChat-BatYRWH7.js → useStartNewChat-8wVLrYnZ.js} +2 -2
- package/dist/assets/{use_paginated_query-imV3AXlW.js → use_paginated_query-CebdO_HQ.js} +1 -1
- package/dist/assets/{users-CBI99oGw.js → users-CRbE186D.js} +1 -1
- package/dist/assets/x-CcIT4ync.js +1 -0
- package/dist/index.html +54 -54
- package/package.json +1 -1
- package/dist/assets/AccessTab-Bk4_F0iH.js +0 -1
- package/dist/assets/AgentFilesTab-Dlm2lBii.js +0 -3
- package/dist/assets/AnomaliesTab-D_QuI8BU.js +0 -1
- package/dist/assets/AuditTab-DOfKzC0D.js +0 -1
- package/dist/assets/BridgeTab-OC_GNU22.js +0 -1
- package/dist/assets/ChatDefaultsTab-BeTKiTFl.js +0 -1
- package/dist/assets/DeletedChatsTab-BCD6pwBJ.js +0 -1
- package/dist/assets/EntitySheet-BXEY6TCb.js +0 -1
- package/dist/assets/FeedbacksTab-Ch0Og-WD.js +0 -1
- package/dist/assets/FilesTab-C6xs9TIo.js +0 -1
- package/dist/assets/GroupsTab-Dktghl12.js +0 -1
- package/dist/assets/InstancesTab-B_jY-L5V.js +0 -1
- package/dist/assets/IntegrationsTab-CA10qkLR.js +0 -1
- package/dist/assets/KnobRow-DsPgcIxU.js +0 -1
- package/dist/assets/KpiTab-DN2VV-KL.js +0 -1
- package/dist/assets/PreferencesTab-DCUtb7jt.js +0 -1
- package/dist/assets/ProjectPage-CZbKzufX.js +0 -1
- package/dist/assets/PromptInjectionsTab-D-qkRO-x.js +0 -4
- package/dist/assets/RolesTab-B-kY1GSh.js +0 -1
- package/dist/assets/ScheduledTab-C3lqr_Wn.js +0 -1
- package/dist/assets/ServiceAccountsTab-4Tcuxr0L.js +0 -1
- package/dist/assets/SubAgentReportsTab-BvaMpkUp.js +0 -1
- package/dist/assets/ThemeShowroom-BNUhcoUx.js +0 -1
- package/dist/assets/TracesTab-CmHSn4oj.js +0 -1
- package/dist/assets/TrashTab-CCNS2Ybn.js +0 -1
- package/dist/assets/UsersTab-B-H2pRkF.js +0 -1
- package/dist/assets/VoiceTab-C4f9SFZl.js +0 -1
- package/dist/assets/check-MG02lA-U.js +0 -1
- package/dist/assets/chevron-left-cmPkj5_M.js +0 -1
- package/dist/assets/chevron-right-DbysoSJS.js +0 -1
- package/dist/assets/chevron-up-DQBDpk9Z.js +0 -1
- package/dist/assets/chevrons-up-down-3woN2nFd.js +0 -1
- package/dist/assets/convexApi-DeaVGrsr.js +0 -1
- package/dist/assets/dispatchErrorInfo-DBq1hdag.js +0 -1
- package/dist/assets/index-CHdY282S.css +0 -1
- package/dist/assets/index-CVhaNoJz.js +0 -158
- package/dist/assets/loader-circle-_HV4tchJ.js +0 -1
- package/dist/assets/plus-A35Qzur2.js +0 -1
- package/dist/assets/roleDescriptions-D-rhX1-Q.js +0 -1
- package/dist/assets/rotate-ccw-XgdDTtI8.js +0 -1
- package/dist/assets/toast-daONdZpX.js +0 -1
- package/dist/assets/trashPage-CFUn9bkp.js +0 -1
- package/dist/assets/trashView-CrjCfgVT.js +0 -1
- package/dist/assets/x-TiVTngrx.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$A as r,AA as i,BA as a,Bj as o,Bv as s,CA as c,DA as l,EA as u,FA as d,Fj as f,Fv as p,GA as m,Gj as ee,Gv as h,HA as g,Hj as te,Hv as _,IA as v,Iv as y,JA as b,Jj as x,Jo as ne,KA as re,Kv as ie,LA as ae,Lv as oe,MA as se,NA as ce,OA as S,Ov as le,PA as ue,Pj as de,Pv as fe,QA as pe,RA as me,Rj as he,Rv as ge,SA as _e,TA as ve,UA as C,Uj as ye,Uv as be,VA as xe,Vj as Se,Vv as w,WA as Ce,Wj as we,Wv as Te,XA as Ee,YA as De,ZA as Oe,_A as ke,_Q as Ae,aj as je,bA as Me,cd as Ne,cj as Pe,dd as Fe,dj as Ie,ej as Le,fd as Re,fj as ze,gA as Be,hA as Ve,hQ as He,hd as Ue,ij as We,jA as Ge,k as T,kA as Ke,ld as qe,lj as Je,mA as E,nj as Ye,oj as Xe,qA as Ze,qj as Qe,rj as $e,sj as et,t as D,tj as tt,ud as nt,uj as rt,vA as it,vQ as O,vc as at,wA as ot,xA as st,yA as ct,zA as lt,zj as ut,zv as dt}from"./api-jG5Fwsg4.js";import{i as ft,n as k,o as pt,r as mt,s as ht}from"./FieldLabel-Wb5bwK7r.js";import{n as gt,t as _t}from"./useNavigate-D3GIoxyW.js";import{r as A}from"./dist-Bxf4XoMW.js";import{t as vt}from"./chevron-right-DbysoSJS.js";import{t as yt}from"./chevron-up-DQBDpk9Z.js";import{t as bt}from"./chevrons-up-down-3woN2nFd.js";import{n as xt,t as St}from"./usageView-CKi8uUZb.js";import{t as Ct}from"./loader-circle-_HV4tchJ.js";import{t as wt}from"./checkbox-U99HMqP3.js";import{t as Tt}from"./server-ClLFUY_D.js";import{t as j}from"./triangle-alert-BMryltpr.js";import{a as M,i as N,n as P,r as F,t as I}from"./select-DGKgMOlh.js";import{n as Et,r as Dt,t as Ot}from"./popover-BcL-AsC2.js";import{i as kt,n as At,r as jt,t as Mt}from"./tabs-BWfAdnjK.js";import{t as L}from"./button-sV7hIR3f.js";import{t as R}from"./input-DReDYsos.js";import"./convexApi-DeaVGrsr.js";import{r as Nt}from"./toast-daONdZpX.js";import{t as z}from"./badge-CSm2xaYH.js";import{a as B,n as Pt}from"./format-BQaxlN43.js";import{a as Ft,n as It,o as Lt,r as Rt,t as zt}from"./dialog-Bpoyy7pR.js";import{t as Bt}from"./appHost-CH3EGcJw.js";import{r as Vt}from"./locales-CPjguROj.js";import{a as Ht,i as V,n as Ut,o as H,r as U,t as Wt}from"./table-CIrFKiPM.js";import{t as Gt}from"./FilterBar-D2w0wWnm.js";import{c as Kt,i as qt,n as Jt,o as Yt,r as Xt,s as W,t as Zt}from"./compatView-Cqu0P9sx.js";import{t as G}from"./dispatchErrorInfo-DBq1hdag.js";var Qt=T(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),$t=T(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),K=t(e(),1);function en(e){return e.filter(e=>e.state===`error`)}function tn(e){return e.reachable&&en(e.targets).length===0}function nn(e){return tn(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function rn(e){return e.state===`error`&&e.lastErrorCode!==null}function an(e){return!!e.lastDownstreamRejectCode}function on(e){return!!e.lastLocalRefusalCode}function sn(e){return rn(e)||an(e)||on(e)}function q(e){return e.kind??`openclaw`}function cn(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function ln(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,q(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(q(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return cn(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>q(e)===r)}))}function J(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var Y=`__all__`,un={q:``,state:Y,instance:Y,version:Y},X={connected:0,error:1,idle:2};function dn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function fn(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function Z(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function pn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`&&t.lastOkAt===null}function mn(e,t,n){switch(e){case`state`:return(X[t.state]??99)-(X[n.state]??99);case`instance`:return Z(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Z(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return W(e,r)??Z(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Z(t.targetLabel,n.targetLabel)}}function hn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=pn(t.key,e),a=pn(t.key,r);return i&&a?0:i?1:a?-1:n*mn(t.key,e,r)})}function gn(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(X[e]??99)-(X[t]??99))}function _n(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>Z(e.label,t.label))}function vn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>W(e,t)??Z(e,t))}var Q=n();function yn({connections:e,displayByInstance:t}){let[n,r]=(0,K.useState)(un),[i,a]=(0,K.useState)(null),o=(0,K.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0)+(e.localRefusalCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null,lastLocalRefusalCode:e.lastLocalRefusalCode??null,lastLocalRefusalAt:e.lastLocalRefusalAt??null})),[e,t]),s=(0,K.useMemo)(()=>gn(o),[o]),d=(0,K.useMemo)(()=>_n(o),[o]),f=(0,K.useMemo)(()=>vn(o),[o]),p=(0,K.useMemo)(()=>hn(fn(o,n),i),[o,n,i]);function m(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:se()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(Gt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:Ke(),onReset:()=>r(un),canReset:dn(n),children:[(0,Q.jsxs)(I,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(N,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(M,{placeholder:l()})}),(0,Q.jsxs)(P,{children:[(0,Q.jsx)(F,{value:Y,children:S()}),s.map(e=>(0,Q.jsx)(F,{value:e,children:xn(e)},e))]})]}),(0,Q.jsxs)(I,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(N,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(M,{placeholder:u()})}),(0,Q.jsxs)(P,{children:[(0,Q.jsx)(F,{value:Y,children:S()}),d.map(e=>(0,Q.jsx)(F,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(I,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(N,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(M,{placeholder:ve()})}),(0,Q.jsxs)(P,{children:[(0,Q.jsx)(F,{value:Y,children:S()}),f.map(e=>(0,Q.jsx)(F,{value:e,children:e},e))]})]})]}),p.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ot()}):(0,Q.jsxs)(Wt,{className:`oc-conn__table`,children:[(0,Q.jsx)(Ht,{children:(0,Q.jsxs)(H,{children:[(0,Q.jsx)($,{label:c(),sortKey:`target`,sort:i,onSort:m}),(0,Q.jsx)($,{label:_e(),sortKey:`state`,sort:i,onSort:m}),(0,Q.jsx)($,{label:st(),sortKey:`instance`,sort:i,onSort:m}),(0,Q.jsx)($,{label:Me(),sortKey:`host`,sort:i,onSort:m}),(0,Q.jsx)($,{label:ct(),sortKey:`version`,sort:i,onSort:m}),(0,Q.jsx)(V,{children:it()}),(0,Q.jsx)($,{label:ke(),sortKey:`lastOk`,sort:i,onSort:m})]})}),(0,Q.jsx)(Ut,{children:p.map(e=>(0,Q.jsx)(bn,{r:e},e._id))})]})]})}function $({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Q.jsx)(V,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Q.jsx)(yt,{size:13,"aria-hidden":!0}):(0,Q.jsx)(A,{size:13,"aria-hidden":!0}):(0,Q.jsx)(bt,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function bn({r:e}){let t=rn(e)?G(e.lastErrorCode):null,n=an(e)?G(e.lastDownstreamRejectCode):null,r=on(e)?G(e.lastLocalRefusalCode):null;return(0,Q.jsxs)(K.Fragment,{children:[(0,Q.jsxs)(H,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Q.jsx)(U,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Q.jsx)(U,{children:(0,Q.jsx)(Sn,{state:e.state})}),(0,Q.jsx)(U,{children:e.instanceLabel?(0,Q.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(U,{children:(0,Q.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Q.jsx)(U,{children:e.gatewayVersion?(0,Q.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(U,{children:(0,Q.jsx)(`span`,{className:`oc-conn__stats`,children:Ge({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Q.jsx)(U,{children:e.lastOkAt?(0,Q.jsx)(`span`,{className:`oc-traces__mono`,children:B(e.lastOkAt)}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),sn(e)?(0,Q.jsx)(H,{className:`oc-conn__detail-row`,children:(0,Q.jsxs)(U,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Q.jsx)(`strong`,{children:t.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${B(e.lastErrorAt)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,r?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[ne({label:r.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastLocalRefusalCode}),e.lastLocalRefusalAt?` · ${B(e.lastLocalRefusalAt)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:r.hint})]}):null,n?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[i({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${B(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function xn(e){return e===`connected`?Be():e===`error`?Ve():E()}function Sn({state:e}){return e===`connected`?(0,Q.jsx)(z,{variant:`secondary`,children:Be()}):e===`error`?(0,Q.jsx)(z,{variant:`destructive`,children:Ve()}):(0,Q.jsx)(z,{variant:`outline`,children:E()})}function Cn(){return O(D.bridgeHealth.getBridgeHealth,{})}function wn(){let e=Cn(),t=O(D.compat.getBridgeCompat,{}),n=O(D.me.getMe,{host:Bt})?.role===`admin`,r=O(D.admin.listInstances,n?{}:`skip`),i=O(D.agents.usageForInstances,n?{}:`skip`),a=_t(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=ln(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=gt({from:`/settings/bridge`}),l=_t({from:`/settings/bridge`}),u=t?.compat??null,d=t===void 0?`loading`:t===null?`nodata`:`ready`,f=u!==null&&Xt(u,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(Tn,{health:e,compat:t,onSeeAnomalies:o}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:pe()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:Oe()}),(0,Q.jsxs)(Wt,{children:[(0,Q.jsx)(Ht,{children:(0,Q.jsxs)(H,{children:[(0,Q.jsx)(V,{children:Re()}),(0,Q.jsx)(V,{children:Fe()}),(0,Q.jsx)(V,{children:nt()}),(0,Q.jsx)(V,{children:qe()}),(0,Q.jsx)(V,{children:Ne()})]})}),(0,Q.jsx)(Ut,{children:i.flatMap(e=>{let t=St(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Q.jsxs)(H,{children:[(0,Q.jsx)(U,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Q.jsx)(U,{children:t.provider}),(0,Q.jsx)(U,{children:t.label}),(0,Q.jsx)(U,{children:(0,Q.jsxs)(z,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Q.jsx)(U,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Q.jsxs)(Mt,{value:s.some(e=>e.key===c)?c:s[0]?.key??`openclaw`,onValueChange:e=>void l({search:{section:e},replace:!0}),children:[(0,Q.jsx)(jt,{className:`w-full`,children:s.map(e=>(0,Q.jsxs)(kt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Tt,{size:13,"aria-hidden":!0}),J(e.key)]},e.key))}),s.map(e=>(0,Q.jsx)(At,{value:e.key,children:(0,Q.jsx)(En,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:u,compatStatus:d,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,f?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:le()}):null]})}function Tn({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,i=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,o=t&&t!==null?(0,Q.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(t.bridgeVersion)}),i?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:Te(),children:[`(`,i,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,be({build:t.buildVersion??`?`})]}):null,` · `,_(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?w():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:C()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:g()});let s=en(e.targets),c=!e.reachable,l=nn(e),u=e.unreachableInstances??[],f=l===`ok`?`ok`:l===`gateways_unreachable`?`warn`:`error`,p=Pt(e.checkedAt),m=e.startedAt==null?null:Pt(e.startedAt);return(0,Q.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${f}`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:l===`ok`?(0,Q.jsx)(xt,{size:22}):c||l===`gateways_unreachable`?(0,Q.jsx)($t,{size:22}):(0,Q.jsx)(j,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:l===`ok`?xe():l===`gateways_unreachable`?ae({count:u.length}):c?a():lt({count:s.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(Qt,{size:12,"aria-hidden":!0}),` `,me({time:p})]}),m?(0,Q.jsx)(`span`,{children:d({time:m})}):null,o]}),l===`gateways_unreachable`?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:v({names:u.join(`, `)})}):null,c?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:G(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Q.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:ue()})]})}function En({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Kt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:Jt(t,e,r)})}let d=Zt(l.map(e=>e.state)),[f,p]=(0,K.useState)(!1);return(0,Q.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Q.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Q.jsx)(Tt,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:J(e)}),d?(0,Q.jsx)(z,{variant:d===`beyond`||d===`defective`||d===`unsupported`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:ie()}),(0,Q.jsx)(On,{providerName:J(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Q.jsx)(Dn,{protocol:o}):null,(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Q.jsx)(A,{size:13,"aria-hidden":!0}):(0,Q.jsx)(vt,{size:13,"aria-hidden":!0}),ce({count:t.length})]}),f?(0,Q.jsx)(yn,{connections:t,displayByInstance:c}):null]})}function Dn({protocol:e}){let[t,n]=(0,K.useState)(!1),r=e.coverage,i=e.drift??[],a=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[Ee(),i.length>0?(0,Q.jsx)(z,{variant:`destructive`,children:b({count:i.length})}):a>0?(0,Q.jsx)(z,{variant:`destructive`,children:Ze()}):(0,Q.jsx)(z,{variant:`secondary`,children:De()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[re({version:e.vendoredVersion}),r?` · `+m({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:at({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):null,i.length>0?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Q.jsx)(A,{size:13,"aria-hidden":!0}):(0,Q.jsx)(vt,{size:13,"aria-hidden":!0}),Ce({count:r.gapList.length})]}),t?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function On({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:s()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:dt()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:Ue({provider:a})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:ge({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:w()}),e?(0,Q.jsx)(Mn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}):(0,Q.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Q.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(e.version)}),(0,Q.jsx)(z,{variant:e.state===`supported`?`secondary`:e.state===`beyond`||e.state===`defective`||e.state===`unsupported`?`destructive`:`outline`,children:qt(e.state)})]},e.instanceName))})]})}function kn({instance:e,onClose:t}){return(0,Q.jsx)(zt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(It,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(Ft,{children:[(0,Q.jsx)(Lt,{children:x({instance:e.displayName??e.name})}),(0,Q.jsx)(Rt,{children:Qe()})]}),(0,Q.jsx)(jn,{instance:e,onClose:t})]})})}function An({label:e,result:t}){return t?t.checked?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Q.jsx)(xt,{"aria-hidden":!0}):(0,Q.jsx)(j,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?Ye():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,tt()]}):null}function jn({instance:e,onClose:t}){let n=Ae(D.admin.upsertInstanceConfig),i=He(D.bridge.validateMediaPaths),a=Nt(),s=Vt(e.config?.contentLocale,void 0),[c,l]=(0,K.useState)(()=>ft(e.config??{},s)),[u,d]=(0,K.useState)(!1),[p,m]=(0,K.useState)(!1),[h,g]=(0,K.useState)(null),_=c.inboundMediaMode===`shared-fs`,v=c.mediaMode===`shared-fs`,y=_||v;async function b(){m(!0),g(null);try{g(await i({instanceName:e.name,inboundMediaMode:c.inboundMediaMode,mediaMode:c.mediaMode}))}catch(e){a.error(Xe(),e)}finally{m(!1)}}async function x(){d(!0);try{let r=e.config??{};await n({instanceId:e._id,config:mt(c,r,s)}),t()}catch(e){a.error(o(),e)}finally{d(!1)}}return(0,Q.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Q.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(k,{label:ee(),help:ut()}),(0,Q.jsxs)(I,{value:c.mediaMode,onValueChange:e=>l({...c,mediaMode:e}),children:[(0,Q.jsx)(N,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(M,{})}),(0,Q.jsx)(P,{children:ht.map(e=>(0,Q.jsx)(F,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(k,{label:we(),help:he()}),(0,Q.jsxs)(I,{value:c.inboundMediaMode,onValueChange:e=>l({...c,inboundMediaMode:e}),children:[(0,Q.jsx)(N,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(M,{})}),(0,Q.jsx)(P,{children:pt.map(e=>(0,Q.jsx)(F,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(k,{label:ye(),help:f()}),(0,Q.jsx)(R,{type:`number`,min:1,max:4096,className:`w-full`,value:c.mediaMaxMb,onChange:e=>l({...c,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),y&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[_&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(k,{label:ze(),help:Ie()}),(0,Q.jsx)(R,{className:`w-full`,spellCheck:!1,value:c.inboundAgentMount,onChange:e=>l({...c,inboundAgentMount:e.target.value})})]}),v&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(k,{label:rt(),help:Je()}),(0,Q.jsx)(R,{className:`w-full`,spellCheck:!1,value:c.outboundAgentMount,onChange:e=>l({...c,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(wt,{checked:c.rehydration,onCheckedChange:e=>l({...c,rehydration:e===!0})}),(0,Q.jsx)(k,{label:te(),help:de()})]}),y&&h!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:h.reachable?!h.inbound&&!h.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(j,{"aria-hidden":!0}),r({reason:h.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(An,{label:We(),result:h.inbound}),(0,Q.jsx)(An,{label:$e(),result:h.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:je()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(j,{"aria-hidden":!0}),Le()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[y&&(0,Q.jsxs)(L,{variant:`outline`,size:`sm`,onClick:()=>void b(),disabled:p,children:[p?(0,Q.jsx)(Ct,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,p?et():Pe()]}),(0,Q.jsx)(L,{size:`sm`,onClick:()=>void x(),disabled:u,children:Se()})]})]})})}function Mn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(Ot,{children:[(0,Q.jsx)(Dt,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?oe():y({count:e.length}),(0,Q.jsx)(A,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(Et,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:p()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(z,{variant:`secondary`,children:e},e))})]})]})}export{wn as BridgeTab,kn as InstanceConfigDialog};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,$m as i,$v as a,An as o,B as s,Cn as c,Dn as l,En as u,F as d,G as f,H as p,I as m,J as h,Jv as g,K as _,Kj as v,L as y,Mn as b,On as x,P as ee,Q as te,Qv as S,R as C,Sn as w,Tn as ne,U as T,V as re,W as E,X as ie,Xv as ae,Y as oe,Yv as D,Z as se,Zv as ce,_Q as O,_n as le,ah as k,bn as ue,ch as de,cn as fe,db as pe,dn as me,eh as he,et as ge,ey as _e,fb as ve,fn as ye,gb as be,gn as xe,hQ as A,hn as Se,ih as Ce,jn as we,jy as Te,k as Ee,kn as De,ln as Oe,md as ke,mn as Ae,nh as je,nt as Me,oh as Ne,pn as Pe,q as Fe,qv as j,rh as Ie,rt as Le,sQ as M,sh as Re,sn as ze,t as N,th as Be,ty as Ve,un as He,vQ as P,vb as F,vn as Ue,wn as We,xn as I,yn as Ge,z as Ke}from"./api-jG5Fwsg4.js";import{t as qe}from"./use_paginated_query-imV3AXlW.js";import{t as Je}from"./loader-circle-_HV4tchJ.js";import{t as Ye}from"./checkbox-U99HMqP3.js";import{t as Xe}from"./plus-A35Qzur2.js";import{t as Ze}from"./triangle-alert-BMryltpr.js";import{a as L,i as R,n as z,r as B,t as V}from"./select-DGKgMOlh.js";import{n as Qe,r as $e,t as et}from"./popover-BcL-AsC2.js";import{t as H}from"./button-sV7hIR3f.js";import{t as U}from"./input-DReDYsos.js";import"./convexApi-DeaVGrsr.js";import{a as tt,t as W}from"./KnobRow-DsPgcIxU.js";import{n as nt}from"./capabilities-CASxhKEd.js";import{a as rt}from"./compatView-Cqu0P9sx.js";/* empty css */import{t as it}from"./switch-D-QGMGm7.js";var at=Ee(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),G=t(e(),1),ot=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function st(e){let t=typeof e==`object`&&e?e:{},n=t.defaults!==null&&typeof t.defaults==`object`?t.defaults:{},r=n.thinkingDefault??t.thinkingDefault,i=n.fastModeDefault??t.fastModeDefault;return{thinkingDefault:typeof r==`string`?r:null,fastModeDefault:typeof i==`boolean`?i:null}}var ct=[`auto`,`hybrid`,`tool`,`off`];function lt(e){switch(e){case`auto`:return De();case`hybrid`:return x();case`tool`:return l();default:return u()}}function K(e){return{injection:e.injection??`auto`,defaultSources:e.defaultSources,...e.config?{config:e.config}:{}}}function ut(e){return typeof e==`string`&&ct.includes(e)}function q(e){return{injection:ut(e.injection)?e.injection:`auto`,sources:e.defaultSources.filter(t=>e.sources.some(e=>e.id===t))}}function dt(e,t){let n=new Set(e);return n.size===new Set(t).size&&t.every(e=>n.has(e))}function ft(e,t,n){let r=n?e.defaultWriteRefused===`scope_refused`?I():pt(e)?me():null:w(),i=q(e),a=t.injection!==i.injection||!dt(t.sources,i.sources),o=new Set(e.sources.map(e=>e.id)),s=t.sources.length>0&&t.sources.length<=16&&t.sources.every(e=>o.has(e));return{readOnlyReason:r,dirty:a,valid:s,invalidReason:s?null:We()}}function pt(e){return(e.contract??1)<2&&e.ownAllowlist===!1}function mt(e,t,n){let r=t.sources.includes(n)?t.sources.filter(e=>e!==n):[...t.sources,n];return{...t,sources:e.sources.map(e=>e.id).filter(e=>r.includes(e))}}function ht(e){return e.ok?null:e.code===`scope_refused`?I():e.code===`stale_default`?ue():e.code===`write_unknown`||e.code===`not_confirmed`?le():e.code===`not_applied`?xe():e.code===`default_too_large`?Oe():e.code===`allowlist_too_large`?He():e.code===`plugin_too_old`?me():e.code===`source_not_allowed`?ye():e.code===`plugin_config_lag`?Pe():e.code===`knowledge_unavailable`&&e.reason===`plugin_absent`?c():Ge({code:e.code})}function gt(e,t){let n=K(e),r=K(t);if(n.injection!==r.injection||!dt(n.defaultSources,r.defaultSources))return!0;let i=n.config,a=r.config;return i===void 0||a===void 0?i!==a:i.injection!==a.injection||!((e,t)=>e===null||t===null?e===t:e.length===t.length&&e.every((e,n)=>e===t[n]))(i.sources,a.sources)}var J=n();function _t({instanceName:e,row:t,supported:n}){let r=A(N.knowledge.setAgentKnowledgeDefault),[i,a]=(0,G.useState)(t),[s,c]=(0,G.useState)(()=>q(t)),[l,u]=(0,G.useState)(`idle`),[d,f]=(0,G.useState)(null),[p,m]=(0,G.useState)(!1),h=e=>{a(e),c(q(e)),f(null)},_=gt(i,t);(0,G.useEffect)(()=>{p&&_&&(m(!1),h(t))},[p,_]);let v=ft(i,s,n),y=v.readOnlyReason===null;async function b(){u(`saving`),f(null);try{let n=ht(await r({instanceName:e,agentId:t.agentId,injection:s.injection,sources:s.sources,expected:K(i)}));f(n),u(n===null?`done`:`idle`),n===null&&m(!0)}catch(e){f(ht({ok:!1,code:String(e?.message??`error`).slice(0,60)})),u(`idle`)}}return(0,J.jsxs)(`div`,{className:`oc-cdefaults__row`,"data-knowledge-agent":t.agentId,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:t.agentId}),(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,J.jsxs)(V,{value:s.injection,onValueChange:e=>{ut(e)&&c({...s,injection:e})},disabled:!y,children:[(0,J.jsx)(R,{className:`oc-cdefaults__select`,"aria-label":o(),children:(0,J.jsx)(L,{})}),(0,J.jsx)(z,{children:ct.map(e=>(0,J.jsx)(B,{value:e,children:lt(e)},e))})]})}),(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:ne()}),t.sources.map(e=>(0,J.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:y?`pointer`:`default`},title:e.description||void 0,children:[(0,J.jsx)(Ye,{checked:s.sources.includes(e.id),onCheckedChange:()=>c(mt(t,s,e.id)),disabled:!y,"aria-label":e.label,"data-knowledge-default-source":e.id}),(0,J.jsx)(`span`,{children:e.label})]},e.id)),_&&!p?(0,J.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[fe(),` `,(0,J.jsx)(H,{variant:`outline`,size:`sm`,onClick:()=>h(t),children:ze()})]}):null,t.overridesAllowed?null:(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:Ue()}),y?(0,J.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,J.jsx)(H,{size:`sm`,disabled:!v.dirty||!v.valid||l===`saving`,onClick:()=>void b(),children:l===`saving`?F():D()})}):(0,J.jsx)(`p`,{className:`oc-cdefaults__note`,children:v.readOnlyReason}),y&&v.dirty&&v.invalidReason!==null?(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:v.invalidReason}):null,l===`done`&&d===null?(0,J.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:g()}):null,d===null?null:(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:d})]})]})}function vt({instanceName:e}){let t=P(N.knowledge.knowledgeAdminInstance,{instanceName:e}),{results:n,status:r,loadMore:i}=qe(N.knowledge.agentKnowledgePage,{instanceName:e},{initialNumItems:50});return t===void 0||t.provider!==`openclaw`||n.length===0&&r!==`CanLoadMore`?null:(0,J.jsxs)(`section`,{className:`oc-cdefaults__row`,"aria-label":b(),children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:b()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:we()}),t.supported?null:(0,J.jsx)(`p`,{className:`oc-cdefaults__note`,children:w()}),n.map(n=>(0,J.jsx)(_t,{instanceName:e,row:n,supported:t.supported},n.agentId)),r===`CanLoadMore`||r===`LoadingMore`?(0,J.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Se({shown:n.length})}),(0,J.jsx)(H,{variant:`outline`,size:`sm`,disabled:r===`LoadingMore`,onClick:()=>i(50),"data-knowledge-load-more":!0,children:Ae()})]}):null]})}function Y(e){return e.displayName??e.agentId}function yt(e){return e.displayName!==null&&e.displayName.toLowerCase()!==e.agentId.toLowerCase()}function X(e){return e.normalize(`NFD`).replace(/\p{Diacritic}/gu,``).toLowerCase().trim()}function bt(e,t){let n=X(t);return n===``||X(Y(e)).includes(n)||X(e.agentId).includes(n)}var xt=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`});function Z(e,t){return xt.compare(Y(e),Y(t))||xt.compare(e.agentId,t.agentId)}function St(e,t){return e.filter(e=>e.showReasoningDefault!==null).sort(Z).map(e=>({agent:e,show:e.showReasoningDefault,sameAsDefault:e.showReasoningDefault===t}))}function Ct(e,t){return wt(e.length)?e.filter(e=>bt(e.agent,t)):[...e]}function wt(e){return e>8}function Q(e,t){let n=e.filter(e=>e.showReasoningDefault===null&&e.presentInLastOk!==!1&&bt(e,t));return[...n.filter(e=>e.enabled).sort(Z),...n.filter(e=>!e.enabled).sort(Z)]}function Tt(e){return!e}function Et(e,t){return t===null?-1:e.findIndex(e=>e.agentId===t)}function Dt(e,t){return t===null?e[0]??null:e.find(e=>e.agentId===t)??null}function Ot(e,t,n){if(n===0)return-1;switch(t){case`ArrowDown`:return e<0?0:Math.min(e+1,n-1);case`ArrowUp`:return e<=0?0:e-1;case`Home`:return 0;case`End`:return n-1;default:return Math.min(e,n-1)}}var $=e=>e?Le():Me();function kt(e,t){return e===null||e.kind!==t.kind?!1:e.kind===`instance`||t.kind===`agent`&&e.agentId===t.agentId}function At({instanceName:e}){let t=P(N.agents.listAgentsForInstance,{instanceName:e}),n=O(N.agents.setInstanceReasoningDefault),i=O(N.agents.setAgentReasoningDefault),[a,o]=(0,G.useState)(null),[c,l]=(0,G.useState)(null),[u,f]=(0,G.useState)(``),[p,g]=(0,G.useState)(``),v=(0,G.useRef)(null),b=(0,G.useId)(),x=t?.showReasoningDefault===!0,S=t?.agents??[],C=(0,G.useMemo)(()=>St(S,x),[S,x]),w=Ct(C,p),ne=Q(S,``).length>0;async function T(e,t,n){o(e),l(null),f(``);try{return await t(),f(n),!0}catch{return l(e),!1}finally{o(t=>t===e?null:t)}}let re=t=>void T({kind:`instance`},()=>n({instanceName:e,show:t}),y({value:$(t)})),E=(t,n,r)=>T({kind:`agent`,agentId:t.agentId},()=>i({instanceName:e,agentId:t.agentId,show:n}),r);async function ae(e){await E(e,null,ee({agent:Y(e)}))&&v.current?.focus()}let D=a!==null;return(0,J.jsxs)(`div`,{className:`oc-cdefaults__row oc-rdefaults`,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:ge()}),(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:r()}),t===void 0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:M()}):S.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:te()}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`oc-rdefaults__default`,children:[(0,J.jsx)(`label`,{htmlFor:b,className:`oc-rdefaults__default-label`,children:se()}),(0,J.jsx)(`span`,{className:`oc-rdefaults__state`,"aria-hidden":!0,children:a?.kind===`instance`?(0,J.jsx)(Je,{size:14,className:`oc-rdefaults__spin`}):$(x)}),(0,J.jsx)(it,{id:b,checked:x,disabled:D,"aria-busy":a?.kind===`instance`,onCheckedChange:re})]}),c?.kind===`instance`?(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:j()}):null,(0,J.jsxs)(`div`,{className:`oc-rdefaults__exhead`,children:[(0,J.jsx)(`span`,{className:`oc-rdefaults__exlabel`,children:ie({count:C.length})}),(0,J.jsx)(jt,{agents:S,instanceDefault:x,disabled:!ne,triggerRef:v,onPick:e=>{let t=Tt(x);E(e,t,m({agent:Y(e),value:$(t)}))}})]}),C.length===0?(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:oe()}):(0,J.jsxs)(J.Fragment,{children:[wt(C.length)?(0,J.jsx)(U,{type:`search`,value:p,onChange:e=>g(e.target.value),placeholder:s(),"aria-label":s(),className:`oc-rdefaults__filter`}):null,w.length===0?(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:Ke()}):(0,J.jsx)(`ul`,{className:`oc-rdefaults__list`,"aria-label":ie({count:C.length}),children:w.map(({agent:e,show:t,sameAsDefault:n})=>{let r=Y(e),i={kind:`agent`,agentId:e.agentId};return(0,J.jsxs)(`li`,{className:`oc-rdefaults__item`,children:[(0,J.jsxs)(`div`,{className:`oc-rdefaults__who`,children:[(0,J.jsx)(`span`,{className:`oc-rdefaults__name`,children:r}),yt(e)?(0,J.jsx)(`span`,{className:`oc-rdefaults__id`,children:e.agentId}):null,n?(0,J.jsx)(`span`,{className:`oc-rdefaults__same`,children:h()}):null]}),(0,J.jsxs)(`div`,{className:`oc-rdefaults__ctl`,children:[kt(a,i)?(0,J.jsx)(Je,{size:14,className:`oc-rdefaults__spin`,"aria-label":F()}):null,(0,J.jsx)(W,{field:`showReasoning`,ariaLabel:Fe({agent:r}),options:[{id:`on`,label:Le()},{id:`off`,label:Me()}],value:t?`on`:`off`,onChange:t=>void E(e,t===`on`,d({agent:r,value:$(t===`on`)})),disabled:D}),(0,J.jsx)(H,{variant:`ghost`,size:`icon`,disabled:D,"aria-label":_({agent:r}),title:_({agent:r}),onClick:()=>void ae(e),children:(0,J.jsx)(at,{"aria-hidden":!0})})]}),kt(c,i)?(0,J.jsx)(`p`,{className:`oc-cdefaults__error oc-rdefaults__rowerror`,role:`alert`,children:j()}):null]},e.agentId)})})]}),c?.kind===`agent`&&!C.some(e=>e.agent.agentId===c.agentId)?(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:j()}):null]}),(0,J.jsx)(`p`,{className:`oc-sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:u})]})}function jt({agents:e,instanceDefault:t,disabled:n,triggerRef:r,onPick:i}){let[a,o]=(0,G.useState)(!1),[s,c]=(0,G.useState)(``),[l,u]=(0,G.useState)(null),d=(0,G.useId)(),m=(0,G.useRef)(null),h=Q(e,s),g=Et(h,l),_=Q(e,``).length===0,v=e=>`${d}-opt-${e}`;function y(){o(!1),c(``),u(null)}function b(e){u(e>=0?h[e].agentId:null),e>=0&&m.current?.querySelector(`#${CSS.escape(v(e))}`)?.scrollIntoView({block:`nearest`})}function x(e){if(e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`Home`||e.key===`End`)e.preventDefault(),b(Ot(g,e.key,h.length));else if(e.key===`Enter`){e.preventDefault();let t=Dt(h,l);t===null?u(null):(y(),i(t))}}return(0,J.jsxs)(et,{open:a,onOpenChange:e=>e?o(!0):y(),children:[(0,J.jsx)($e,{asChild:!0,children:(0,J.jsxs)(H,{ref:r,variant:`outline`,size:`sm`,disabled:n,children:[(0,J.jsx)(Xe,{"aria-hidden":!0}),f()]})}),(0,J.jsxs)(Qe,{align:`end`,className:`oc-rdefaults__pop p-0`,children:[(0,J.jsx)(`p`,{className:`oc-rdefaults__pophint`,children:E({value:$(Tt(t))})}),(0,J.jsx)(U,{autoFocus:!0,type:`search`,role:`combobox`,"aria-expanded":!0,"aria-controls":d,"aria-autocomplete":`list`,"aria-activedescendant":g>=0&&g<h.length?v(g):void 0,"aria-label":T(),placeholder:T(),value:s,onChange:e=>{c(e.target.value),u(null)},onKeyDown:x,className:`oc-rdefaults__search`}),(0,J.jsx)(`div`,{id:d,ref:m,role:`listbox`,"aria-label":f(),className:`oc-rdefaults__options`,children:h.length===0?(0,J.jsx)(`p`,{className:`oc-rdefaults__empty`,children:_?re():p()}):h.map((e,t)=>(0,J.jsxs)(`div`,{id:v(t),role:`option`,"aria-selected":t===g,className:`oc-rdefaults__opt${e.enabled?``:` is-disabled`}${t===g?` is-active`:``}`,onMouseEnter:()=>u(e.agentId),onMouseDown:e=>e.preventDefault(),onClick:()=>{y(),i(e)},children:[(0,J.jsx)(`span`,{className:`oc-rdefaults__name`,children:Y(e)}),yt(e)?(0,J.jsx)(`span`,{className:`oc-rdefaults__id`,children:e.agentId}):null,e.enabled?null:(0,J.jsx)(`span`,{className:`oc-rdefaults__badge`,children:C()})]},e.agentId))})]})]})}function Mt({instance:e}){let t=O(N.admin.upsertInstanceConfig),n=P(N.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[i,a]=(0,G.useState)(r),[o,s]=(0,G.useState)(`idle`);(0,G.useEffect)(()=>{a(r),s(`idle`)},[e._id,r]);let c=`__none__`,l=i!==r;async function u(){s(`saving`);try{let n={...e.config??{}};i===``||i===c?delete n.converterAgentId:n.converterAgentId=i,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}let d=n?.agents??[];return(0,J.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:k()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ce()}),(0,J.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,J.jsxs)(V,{value:i===``?c:i,onValueChange:e=>a(e===c?``:e),children:[(0,J.jsx)(R,{className:`oc-cdefaults__select`,"aria-label":k(),children:(0,J.jsx)(L,{placeholder:Ie()})}),(0,J.jsxs)(z,{children:[(0,J.jsx)(B,{value:c,children:Ie()}),d.map(e=>(0,J.jsx)(B,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,J.jsx)(H,{size:`sm`,disabled:!l||o===`saving`,onClick:()=>void u(),children:o===`saving`?F():D()})]}),o===`done`?(0,J.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:g()}):null,o===`error`?(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:j()}):null]})}function Nt({instance:e}){let t=O(N.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[i,a]=(0,G.useState)(n),[o,s]=(0,G.useState)(r===null?``:String(r)),[c,l]=(0,G.useState)(`idle`);(0,G.useEffect)(()=>{a(n),s(r===null?``:String(r)),l(`idle`)},[e._id,n,r]);let u=o.trim(),d=u===``?null:/^\d+$/.test(u)?Number.parseInt(u,10):NaN,f=!i||d===null||Number.isInteger(d)&&d>=4e3&&d<=6e4,p=i!==n||(d??null)!==r;async function m(){l(`saving`);try{let n={...e.config??{}};n.curationEnabled=i,!i||d===null||Number.isNaN(d)?delete n.curationBudgetChars:n.curationBudgetChars=d,await t({instanceId:e._id,config:n}),l(`done`)}catch{l(`error`)}}return(0,J.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,J.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,J.jsx)(Ye,{checked:i,onCheckedChange:e=>a(e===!0),"aria-label":Ne()}),(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:Ne()})]}),(0,J.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,J.jsx)(U,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:o,onChange:e=>s(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!f,"aria-label":je(),disabled:!i}),(0,J.jsx)(H,{size:`sm`,disabled:!p||!f||c===`saving`,onClick:()=>void m(),children:c===`saving`?F():D()})]}),f?null:(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:Be()}),c===`done`?(0,J.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:g()}):null,c===`error`?(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:j()}):null,(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:he()})]})}function Pt({instance:e}){let t=O(N.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,a]=(0,G.useState)(n===null?``:String(n)),[o,s]=(0,G.useState)(`idle`);(0,G.useEffect)(()=>{a(n===null?``:String(n)),s(`idle`)},[e._id,n]);let c=r.trim(),l=c===``?null:/^\d+$/.test(c)?Number.parseInt(c,10):NaN,u=l===null||Number.isInteger(l)&&l>=1e3&&l<=2e5,d=(l??null)!==n;async function f(){s(`saving`);try{let n={...e.config??{}};l===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=l,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}return(0,J.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:de()}),(0,J.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,J.jsx)(U,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>a(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!u}),(0,J.jsx)(H,{size:`sm`,disabled:!d||!u||o===`saving`,onClick:()=>void f(),children:o===`saving`?F():D()})]}),u?null:(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:i()}),o===`done`?(0,J.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:g()}):null,o===`error`?(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:j()}):null,(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:Re()})]})}function Ft(){let e=A(N.agentFiles.getChatDefaults),[t,n]=(0,G.useState)({status:`loading`}),r=P(N.admin.listInstances,{}),[i,o]=(0,G.useState)(null);(0,G.useEffect)(()=>{!r||r.length===0||(!i||!r.some(e=>e.name===i))&&o(r[0].name)},[r,i]);let s=(r?.length??0)>1,c=r!==void 0&&r.length===0,l=P(N.compat.forInstance,i?{instanceName:i}:`skip`),u=i?nt(l,`configDefaults`):`loading`,d=u===`loading`?null:u.blocked,f=(0,G.useMemo)(()=>s&&i?{instanceName:i}:{},[s,i]),p=(0,G.useRef)(0),m=(0,G.useCallback)(async()=>{let t=++p.current;n({status:`loading`});try{let r=st(await e(f));if(p.current!==t)return;n({status:`done`,current:r})}catch{if(p.current!==t)return;n({status:`error`})}},[e,f]);(0,G.useEffect)(()=>{d===!1&&(s&&!i||m())},[m,d,s,i]);let h=t.status===`done`?t.current:null,g=(0,G.useMemo)(()=>ot.map(e=>({id:e,label:tt(e)})),[]),_=(0,G.useMemo)(()=>[{id:`fast`,label:ve()},{id:`standard`,label:pe()}],[]);return(0,J.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ve()}),s&&i?(0,J.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:Te()}),(0,J.jsxs)(V,{value:i,onValueChange:e=>o(e),children:[(0,J.jsx)(R,{size:`sm`,"aria-label":Te(),children:(0,J.jsx)(L,{})}),(0,J.jsx)(z,{children:(r??[]).map(e=>(0,J.jsx)(B,{value:e.name,children:e.name},e.name))})]})]}):null,c?(0,J.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:v()}):u===`loading`?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:M()}):u.blocked?(0,J.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,J.jsx)(Ze,{size:14,"aria-hidden":!0}),` `,rt(u.gatewayVersion,u.provider)]}):t.status===`loading`?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:M()}):t.status===`error`?(0,J.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[ae(),` `,(0,J.jsx)(H,{variant:`outline`,size:`sm`,onClick:()=>void m(),children:be()})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:_e()}),(0,J.jsx)(W,{field:`thinkingLevel`,options:g,value:h?.thinkingDefault??null,onChange:()=>{},disabled:!0,ariaLabel:_e()}),(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:a()})]}),(0,J.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:S()}),(0,J.jsx)(W,{field:`fastMode`,options:_,value:h===null||h.fastModeDefault===null?null:h.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0,ariaLabel:S()}),(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:ce()})]}),(0,J.jsx)(`p`,{className:`oc-cdefaults__note`,children:ke()})]}),(()=>{let e=r?.find(e=>e.name===(i??r[0]?.name));return e?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Pt,{instance:e}),(0,J.jsx)(Nt,{instance:e}),(0,J.jsx)(Mt,{instance:e}),(0,J.jsx)(At,{instanceName:e.name}),(0,J.jsx)(vt,{instanceName:e.name})]}):null})()]})}export{Ft as ChatDefaultsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{BM as t,_Q as n,aO as r,fO as i,iO as a,pO as o,rO as s,t as c}from"./api-jG5Fwsg4.js";import{t as l}from"./use_paginated_query-imV3AXlW.js";import{t as u}from"./button-sV7hIR3f.js";import"./convexApi-DeaVGrsr.js";import{n as d}from"./ConfirmDialog-BmOX8o6F.js";import{r as f}from"./trashView-CrjCfgVT.js";import{n as p,t as m}from"./trashPage-CFUn9bkp.js";var h=e();function g(){let{results:e,status:g,loadMore:_}=l(c.trash.listMyTrash,{},{initialNumItems:50}),v=f(),y=n(c.trash.restoreChat),b=n(c.trash.purgeChat),x=n(c.trash.emptyTrash),S=d();return(0,h.jsxs)(`div`,{className:`oc-trash__body`,children:[(0,h.jsxs)(`div`,{className:`oc-trash__head`,children:[(0,h.jsx)(`p`,{className:`oc-trash__hint`,children:o({days:v})}),e.length>0?(0,h.jsx)(u,{variant:`destructive`,size:`sm`,onClick:async()=>{await S({title:a(),description:s(),confirmLabel:r(),destructive:!0})&&await x({})},children:r()}):null]}),g===`LoadingFirstPage`?(0,h.jsx)(`p`,{className:`oc-trash__hint`,children:t()}):e.length===0?(0,h.jsx)(`p`,{className:`oc-trash__empty`,children:i()}):(0,h.jsx)(m,{items:e,onRestore:e=>y({chatId:e}),onPurge:e=>b({chatId:e})}),(0,h.jsx)(p,{status:g,loadMore:_})]})}export{g as DeletedChatsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Nf as r,Pf as i,i as a,o,xb as s}from"./api-jG5Fwsg4.js";import{t as c}from"./loader-circle-_HV4tchJ.js";import{t as l}from"./x-TiVTngrx.js";import{a as u,i as d,n as f,o as p,r as m,s as h,t as g}from"./dist-B9q2nlqC.js";import{t as _}from"./button-sV7hIR3f.js";var v=t(e(),1),y=n();function b({...e}){return(0,y.jsx)(p,{"data-slot":`sheet`,...e})}function x({...e}){return(0,y.jsx)(g,{"data-slot":`sheet-close`,...e})}function S({...e}){return(0,y.jsx)(u,{"data-slot":`sheet-portal`,...e})}function C({className:e,...t}){return(0,y.jsx)(d,{"data-slot":`sheet-overlay`,className:o(`fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function w({className:e,overlayClassName:t,children:n,side:r=`right`,showCloseButton:i=!0,returnFocus:c,...u}){let d=a(`dialog`,c);return(0,y.jsxs)(S,{children:[(0,y.jsx)(C,{className:t}),(0,y.jsxs)(f,{"data-slot":`sheet-content`,"data-side":r,className:o(`fixed z-50 flex flex-col gap-4 overflow-y-auto bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:slide-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10`,e),...u,ref:d.ref,onCloseAutoFocus:d.onCloseAutoFocus,children:[n,i&&(0,y.jsx)(g,{"data-slot":`sheet-close`,asChild:!0,children:(0,y.jsxs)(_,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`,children:[(0,y.jsx)(l,{}),(0,y.jsx)(`span`,{className:`sr-only`,children:s()})]})})]})]})}function T({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`sheet-header`,className:o(`flex flex-col gap-0.5 p-4`,e),...t})}function E({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`sheet-footer`,className:o(`mt-auto flex flex-col gap-2 p-4`,e),...t})}function D({className:e,...t}){return(0,y.jsx)(h,{"data-slot":`sheet-title`,className:o(`font-heading text-base font-medium text-foreground`,e),...t})}function O({className:e,...t}){return(0,y.jsx)(m,{"data-slot":`sheet-description`,className:o(`text-sm text-muted-foreground`,e),...t})}function k({open:e,onOpenChange:t,title:n,description:a,children:o,onSubmit:s,submitLabel:l,submitting:u=!1,canSubmit:d=!0}){let[f,p]=(0,v.useState)(!1),m=u||f;async function h(){if(!(!d||m))try{p(!0),await s()}finally{p(!1)}}return(0,y.jsx)(b,{open:e,onOpenChange:t,children:(0,y.jsxs)(w,{side:`right`,className:`oc-entity-sheet sm:max-w-none gap-0 p-0`,children:[(0,y.jsxs)(T,{className:`border-b px-6 py-4`,children:[(0,y.jsx)(D,{children:n}),a?(0,y.jsx)(O,{children:a}):null]}),(0,y.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>{e.preventDefault(),h()},children:[(0,y.jsx)(`div`,{className:`oc-sheet__body flex-1 overflow-y-auto px-6 py-4`,children:o}),(0,y.jsxs)(E,{className:`border-t px-6 py-4`,children:[(0,y.jsxs)(_,{type:`submit`,disabled:!d||m,children:[m?(0,y.jsx)(c,{className:`size-4 animate-spin`}):null,l??i()]}),(0,y.jsx)(_,{type:`button`,variant:`ghost`,onClick:()=>t(!1),children:r()})]})]})]})})}export{O as a,D as c,w as i,b as n,E as o,x as r,T as s,k as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$R as r,AR as i,BR as a,CR as o,Cz as s,DR as c,ER as l,FR as u,GR as d,HR as f,IR as p,JR as m,KR as ee,LR as te,MR as ne,NR as h,OR as g,PR as _,QR as v,RR as re,Sz as y,TR as ie,Tz as b,UR as x,VR as S,WR as C,XR as w,YR as T,ZR as E,_Q as D,_z as O,az as k,bz as A,cz as j,dz as M,ez as N,fz as P,gz as F,hz as I,iz as L,jR as R,kR as z,lz as B,mz as V,nz as H,oz as U,pz as W,qR as G,rm as ae,rz as K,sz as q,t as J,tm as oe,tz as se,uz as ce,vQ as le,vz as ue,wR as de,wz as fe,xz as pe,yz as me,zR as he}from"./api-jG5Fwsg4.js";import{t as ge}from"./button-sV7hIR3f.js";import"./convexApi-DeaVGrsr.js";import{n as _e}from"./format-BQaxlN43.js";import{n as Y}from"./ConfirmDialog-BmOX8o6F.js";import{t as ve}from"./DataTableShell-BTk71L7O.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>b(),incorrect:()=>fe(),incoherence:()=>s(),formatting:()=>y(),latency:()=>pe(),api_error:()=>A(),other:()=>me()},Q=e=>ye[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:O()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:F()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:ue()})}function be({data:e,reference:t,closeReason:n}){let i=e.snapshot,a=D(J.feedback.respondToFeedback),[o,s]=(0,X.useState)(e.thread),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(!1);async function f(){let t=c.trim();if(!(!t||u)){d(!0);try{await a({feedbackId:e._id,text:t}),s(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),l(``)}finally{d(!1)}}}let p=[];try{p=i.contextJson?JSON.parse(i.contextJson):[]}catch{p=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:i.displayedMatchesStored,sourceWasOpen:i.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,i.messageRole,i.isRegeneration?` · ${I()}`:``,i.openclawModel?` · ${i.openclawModel}`:``,i.openclawRuntime?` (${i.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:x(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:V()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,n?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:z()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:n})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:W()}),o.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:o.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Z.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?P():e.authorRole===`agent`?e.authorLabel??ae():M()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:ce()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:B(),value:c,maxLength:2e3,rows:3,onChange:e=>l(e.target.value.slice(0,2e3))}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Z.jsx)(ge,{size:`sm`,onClick:()=>void f(),disabled:!c.trim()||u,children:u?j():q()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:U()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.messageText||k()})]}),i.clientInfo?.sourceWasOpen&&i.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:L()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.displayedText||k()})]}):null,i.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:K()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.promptText})]}):null,p.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:H({count:i.contextCount??p.length,truncated:i.contextTruncated?se():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:p.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,i.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:N()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[i.outboxText??``,i.outboxStatus?`\n[status: ${i.outboxStatus}]`:``]})]}):null,i.clientInfo?.extensionsDetected&&i.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:r()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:i.clientInfo.extensionsDetected.map(e=>(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:v()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[i.clientInfo?.language,i.clientInfo?.timezone,i.clientInfo?.theme?E({theme:i.clientInfo.theme}):null,i.runId?`run ${i.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,i.clientInfo?.plugins&&i.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[w(),` `,i.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,T()]})]}):null,i.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:i.clientInfo.userAgent}):null]})]})]})}function xe(){let e=le(J.feedback.listForAdmin,{}),t=D(J.feedback.readSnapshot),n=D(J.feedback.deleteFeedback),r=Y(),[s,v]=(0,X.useState)(null),[y,b]=(0,X.useState)({});async function x(e){if(s===e._id){v(null);return}if(!y[e._id]){let n=await t({feedbackId:e._id});b(t=>({...t,[e._id]:n}))}v(e._id)}async function w(e){await r({title:ie(),description:de(),confirmLabel:o(),destructive:!0})&&(await n({feedbackId:e._id}),s===e._id&&v(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[m(),` `,(0,Z.jsx)(`strong`,{children:G()}),` `,ee()]}),(0,Z.jsx)(ve,{title:d(),rows:e,emptyHint:C(),isExpanded:e=>s===e._id&&!!y[e._id],renderExpanded:e=>y[e._id]?(0,Z.jsx)(be,{data:y[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:f(),cell:e=>_e(e.at),sort:e=>e.at},{header:S(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:a(),cell:e=>e.messageRole===`user`?he():re(),sort:e=>e.messageRole},{header:te(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${p({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:u(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:_(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:h(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:ne()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:R()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:oe()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:i()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:s===e._id?g():c(),onSelect:()=>void x(e)},{label:l(),onSelect:()=>void w(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$X as ee,CZ as r,DZ as te,EZ as ne,JX as re,OZ as ie,QX as ae,SZ as oe,TZ as i,XX as se,YX as ce,ZX as a,_Q as o,_Z as s,aZ as c,bZ as le,cZ as ue,dZ as l,eZ as de,fZ as u,gU as fe,gZ as d,hZ as f,iZ as pe,lZ as me,mZ as p,nZ as he,oZ as ge,om as _e,pZ as m,qX as ve,rZ as ye,sQ as be,sZ as xe,sm as h,t as g,tZ as _,uQ as v,uZ as y,vQ as b,vZ as x,wZ as S,xZ as C,yZ as w}from"./api-jG5Fwsg4.js";import{c as T,g as E,n as D,r as O,t as k}from"./dropdown-menu-yCbwljS-.js";import{t as A}from"./download-DQYw1N-_.js";import{t as j}from"./checkbox-U99HMqP3.js";import{t as M}from"./rotate-ccw-XgdDTtI8.js";import{t as Se}from"./trash-2-UxV-pTWt.js";import{a as N,i as P,n as F,r as I,t as L}from"./select-DGKgMOlh.js";import{a as Ce,c as we,i as Te,n as Ee,o as De,r as Oe,s as ke,t as Ae}from"./alert-dialog-BwvaE8oD.js";import{t as R}from"./button-sV7hIR3f.js";import"./convexApi-DeaVGrsr.js";import{r as je}from"./toast-daONdZpX.js";import{t as z}from"./badge-CSm2xaYH.js";import{a as Me,i as B,n as Ne,o as V,r as H,t as Pe}from"./table-CIrFKiPM.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return s();case`audio`:return d();case`video`:return f();case`pdf`:return p();case`document`:return m();case`archive`:return u();default:return l()}}function q(){let[e,t]=(0,U.useState)(G),[n,s]=(0,U.useState)(G),[l,u]=(0,U.useState)(G),[d,f]=(0,U.useState)(G),[p,m]=(0,U.useState)(!1),[q,J]=(0,U.useState)(null),Fe=o(g.files.softDelete),Y=je();function Ie(){t(G),s(G),u(G),f(G)}async function Le(){let e=q;if(J(null),e)try{await Fe({fileId:e.id}),Y.success(de())}catch(e){Y.error(ee(),e)}}let X=b(g.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:l===G?void 0:l,category:d===G?void 0:d,includeAutoGenerated:p||void 0}),Re=(0,U.useMemo)(()=>new Intl.DateTimeFormat(v(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:be()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==G||n!==G||l!==G||d!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:ie()}),(0,W.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,W.jsxs)(L,{value:e,onValueChange:t,children:[(0,W.jsx)(P,{size:`sm`,"aria-label":te(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(I,{value:G,children:ne()}),(0,W.jsx)(I,{value:`inbound`,children:i()}),(0,W.jsx)(I,{value:`outbound`,children:S()})]})]}),(0,W.jsxs)(L,{value:n,onValueChange:s,children:[(0,W.jsx)(P,{size:`sm`,"aria-label":r(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(I,{value:G,children:oe()}),Q.chats.map(e=>(0,W.jsx)(I,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(L,{value:l,onValueChange:u,children:[(0,W.jsx)(P,{size:`sm`,"aria-label":C(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(I,{value:G,children:le()}),Q.instances.map(e=>(0,W.jsx)(I,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(L,{value:d,onValueChange:f,children:[(0,W.jsx)(P,{size:`sm`,"aria-label":w(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(I,{value:G,children:x()}),Q.categories.map(e=>(0,W.jsx)(I,{value:e,children:K(e)},e))]})]}),(0,W.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,W.jsx)(j,{checked:p,onCheckedChange:e=>m(e===!0),"aria-label":h()}),(0,W.jsx)(`span`,{children:h()})]}),$?(0,W.jsxs)(R,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,W.jsx)(M,{size:14,"aria-hidden":!0}),ye()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?re():ce()}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(Pe,{children:[(0,W.jsx)(Me,{children:(0,W.jsxs)(V,{children:[(0,W.jsx)(B,{children:y()}),(0,W.jsx)(B,{children:me()}),(0,W.jsx)(B,{children:ue()}),(0,W.jsx)(B,{children:xe()}),(0,W.jsx)(B,{children:ge()}),(0,W.jsx)(B,{className:`text-right`,children:c()})]})}),(0,W.jsx)(Ne,{children:Z.map(e=>(0,W.jsxs)(V,{children:[(0,W.jsxs)(H,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,W.jsx)(z,{variant:`outline`,style:{marginLeft:6},children:_e()}):null]}),(0,W.jsx)(H,{title:e.mimeType,children:K(e.category)}),(0,W.jsx)(H,{children:(0,W.jsx)(z,{variant:`secondary`,children:e.direction===`inbound`?i():S()})}),(0,W.jsx)(H,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,W.jsx)(H,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,W.jsx)(H,{className:`text-right`,children:(0,W.jsxs)(k,{children:[(0,W.jsx)(T,{asChild:!0,children:(0,W.jsx)(R,{variant:`ghost`,size:`icon`,"aria-label":he(),children:(0,W.jsx)(E,{size:16})})}),(0,W.jsxs)(D,{align:`end`,children:[e.url?(0,W.jsx)(O,{asChild:!0,children:(0,W.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(A,{size:14}),pe()]})}):(0,W.jsxs)(O,{disabled:!0,children:[(0,W.jsx)(A,{size:14}),se()]}),(0,W.jsxs)(O,{variant:`destructive`,onSelect:()=>J({id:e._id,filename:e.filename}),children:[(0,W.jsx)(Se,{size:14}),_()]})]})]})})]},e._id))})]}),ze?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:ve({cap:Be})}):null]}),(0,W.jsx)(Ae,{open:q!==null,onOpenChange:e=>!e&&J(null),children:(0,W.jsxs)(Te,{children:[(0,W.jsxs)(ke,{children:[(0,W.jsx)(we,{children:ae()}),(0,W.jsx)(Ce,{children:a()})]}),(0,W.jsxs)(De,{children:[(0,W.jsx)(Oe,{children:fe()}),(0,W.jsx)(Ee,{onClick:()=>void Le(),children:_()})]})]})})]})}export{q as FilesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,$x as i,AS as a,Ax as o,BS as s,Bx as c,CS as l,Cx as u,DS as d,ES as f,FS as p,Fb as m,Fx as h,GS as g,Gb as _,Gx as v,HS as y,Hb as b,Hx as x,IS as S,Ib as C,Ix as w,Jb as T,Jx as E,KS as D,Kb as O,Kx as k,LS as ee,Lx as te,MS as ne,Mx as A,NS as j,Nb as re,Nx as ie,OS as M,PS as ae,Pb as N,Px as oe,Qb as se,Qx as ce,RS as le,Rx as ue,SS as de,Sx as fe,TS as pe,Tx as me,US as he,Ub as ge,Ux as _e,VS as ve,Vx as ye,WS as be,Wb as xe,Wx as Se,Xb as Ce,Xx as we,Yb as Te,Yx as Ee,Zb as De,Zx as Oe,_Q as P,_S as F,_x as ke,aS as Ae,ax as je,bS as Me,bx as Ne,cS as I,cx as Pe,dx as Fe,eS as Ie,ex as Le,fx as Re,gS as ze,gx as Be,hS as Ve,hx as He,iS as Ue,ix as We,jS as Ge,jx as Ke,k as qe,kS as Je,kx as Ye,lS as Xe,lx as Ze,mS as Qe,mx as $e,nS as et,nx as tt,oS as nt,ox as rt,px as it,qb as at,qx as ot,rS as st,rx as ct,sS as lt,sx as ut,t as L,tS as dt,tx as ft,uS as pt,ux as mt,vQ as R,vS as ht,vx as gt,wS as _t,wx as vt,xS as yt,xx as bt,yS as xt,yx as St,zS as Ct,zx as z}from"./api-jG5Fwsg4.js";import{t as wt}from"./chevron-left-cmPkj5_M.js";import{t as Tt}from"./chevron-right-DbysoSJS.js";import{t as B}from"./checkbox-U99HMqP3.js";import{t as V}from"./server-ClLFUY_D.js";import{i as H,n as Et,r as Dt,t as Ot}from"./users-CBI99oGw.js";import{t as U}from"./star-B6yMf_Hc.js";import{t as kt}from"./x-TiVTngrx.js";import{a as At,i as jt,n as Mt,r as Nt,t as Pt}from"./select-DGKgMOlh.js";import{i as Ft,n as It,r as Lt,t as Rt}from"./tabs-BWfAdnjK.js";import{t as W}from"./button-sV7hIR3f.js";import{t as G}from"./input-DReDYsos.js";import"./convexApi-DeaVGrsr.js";import{r as K}from"./toast-daONdZpX.js";import{t as q}from"./badge-CSm2xaYH.js";import{a as zt,n as Bt,o as Vt,r as Ht,t as Ut}from"./dialog-Bpoyy7pR.js";import{t as Wt}from"./appHost-CH3EGcJw.js";import{n as Gt}from"./ConfirmDialog-BmOX8o6F.js";import{t as Kt}from"./EntitySheet-BXEY6TCb.js";import{a as J,c as qt,d as Jt,f as Yt,i as Xt,l as Zt,n as Qt,o as $t,r as en,t as Y,u as tn}from"./groupManageView-BcbLXWZ4.js";import{t as nn}from"./FilterBar-D2w0wWnm.js";import{t as rn}from"./DataTableShell-BTk71L7O.js";import{t as X}from"./DetailChips-BU-SQfjj.js";var an=qe(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),Z=t(e(),1),Q=n(),on={name:``,description:``};function sn(){let e=R(L.groups.listGroups,{}),t=R(L.me.getMe,{host:Wt})?.role===`admin`,n=P(L.groups.createGroup),r=P(L.groups.updateGroup),i=P(L.groups.deleteGroup),o=Gt(),l=K(),[u,m]=(0,Z.useState)(!1),[h,_]=(0,Z.useState)(null),[v,b]=(0,Z.useState)(on),[x,C]=(0,Z.useState)(null),[w,T]=(0,Z.useState)(``),E=(0,Z.useMemo)(()=>{if(!e)return e;let t=w.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t)||e.members.some(e=>e.label.toLowerCase().includes(t))||e.agents.some(e=>e.toLowerCase().includes(t))||e.charts.some(e=>e.name.toLowerCase().includes(t))):e},[e,w]);function O(){_(null),b(on),m(!0)}function k(e){_(e),b({name:e.name,description:e.description??``}),m(!0)}async function te(){try{h?await r({groupId:h._id,name:v.name,description:v.description}):await n({name:v.name,description:v.description||void 0}),b(on),_(null),m(!1)}catch(e){l.error(ye(),e)}}async function A(e){if(await o({title:d({name:e.name}),description:f(),confirmWord:e.name,confirmLabel:pe(),cancelLabel:j(),destructive:!0}))try{await i({groupId:e._id})}catch(e){l.error(c(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:g()}),t?(0,Q.jsx)(pn,{}):null,(0,Q.jsx)(nn,{q:w,onQChange:T,onReset:()=>T(``),canReset:w!==``,searchPlaceholder:le()}),(0,Q.jsx)(rn,{title:D(),rows:E,addLabel:be(),onAdd:t?O:void 0,emptyHint:he(),columns:[{header:y(),cell:e=>e.name,sort:e=>e.name},{header:ve(),cell:e=>(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(X,{icon:(0,Q.jsx)(Ot,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Q.jsx)(H,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),e.pendingInviteCount>0?(0,Q.jsx)(q,{variant:`secondary`,children:Ye({count:String(e.pendingInviteCount)})}):null]}),sort:e=>e.memberCount},{header:s(),cell:e=>(0,Q.jsx)(X,{icon:(0,Q.jsx)(V,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:Ct(),cell:e=>(0,Q.jsx)(X,{icon:(0,Q.jsx)(an,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(U,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:ee(),onSelect:()=>C({groupId:e._id,name:e.name})},...t?[{label:S(),onSelect:()=>k(e)},{label:p(),variant:`destructive`,onSelect:()=>void A(e)}]:[]]}),(0,Q.jsx)(Kt,{open:u,onOpenChange:m,title:h?Ge():ne(),description:a(),canSubmit:!!v.name.trim(),onSubmit:te,submitLabel:ae(),children:(0,Q.jsxs)(`div`,{className:`oc-form`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:Je()}),(0,Q.jsx)(G,{value:v.name,onChange:e=>b({...v,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:M()}),(0,Q.jsx)(G,{value:v.description,onChange:e=>b({...v,description:e.target.value})})]})]})}),(0,Q.jsx)(ln,{groupId:x?.groupId??null,groupName:x?.name??``,open:x!==null,onOpenChange:e=>{e||C(null)}})]})}var $=8;function cn({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,Q.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,Q.jsxs)(W,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Q.jsx)(wt,{size:14,"aria-hidden":!0}),ze()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":Qe({page:e,pages:t}),children:[e,` / `,t]}),(0,Q.jsxs)(W,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[Ve(),(0,Q.jsx)(Tt,{size:14,"aria-hidden":!0})]})]})}function ln({groupId:e,groupName:t,open:n,onOpenChange:r}){let i=R(L.groups.getGroup,n&&e?{groupId:e}:`skip`),a=i?.viewerIsAdmin===!0,o=R(L.groups.listAssignableInstances,n&&e?{groupId:e}:`skip`),s=R(L.groups.listAssignableUsers,n&&a?{}:`skip`),c=P(L.groups.addMember),u=P(L.groups.removeMember),d=P(L.groups.bulkSetMembers),f=P(L.groups.setGroupManager),p=K(),[m,h]=(0,Z.useState)(``),[g,_]=(0,Z.useState)(``),[y,b]=(0,Z.useState)(`members`),[x,S]=(0,Z.useState)(1),[C,w]=(0,Z.useState)(null),[T,E]=(0,Z.useState)(new Set),D=(0,Z.useRef)(null),O=(0,Z.useMemo)(()=>new Set((i?.members??[]).map(e=>e.userId)),[i]),k=(0,Z.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[i]),ee=(0,Z.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.restricted).map(e=>e.userId)),[i]),ne=(0,Z.useMemo)(()=>new Set((i?.agents??[]).map(e=>Y(e.instanceName,e.agentId))),[i]),A=(0,Z.useMemo)(()=>{let e=(i?.agents??[]).find(e=>e.isDefault);return e?Y(e.instanceName,e.agentId):null},[i]);(0,Z.useEffect)(()=>{h(``),_(``),b(`members`),S(1),w(null),D.current=null},[n,e]),(0,Z.useEffect)(()=>{S(1)},[m]),(0,Z.useEffect)(()=>{n&&i&&e&&D.current!==e&&(D.current=e,E(new Set((i.members??[]).map(e=>e.userId))))},[n,i,e]);let j=(0,Z.useMemo)(()=>s?Xt(s,m,T):[],[s,m,T]);async function re(t,n){if(e)try{n?await u({groupId:e,userId:t}):await c({groupId:e,userId:t})}catch(e){p.error(z(),J(e))}}async function ie(t,n){if(e)try{await f({groupId:e,userId:t,manager:!n})}catch(e){p.error(_e(),e)}}let M=Jt(j,e=>O.has(e.userId)),ae=j.filter(e=>O.has(e.userId)).length,N=Zt(j,x,$);async function oe(){if(!e||j.length===0)return;let t=j.map(e=>e.userId);try{await d({groupId:e,userIds:t,member:M!==`all`})}catch(e){p.error(z(),J(e))}}let se=(e,t)=>(0,Q.jsxs)(W,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7`,"aria-label":Ne({user:t}),title:Ne({user:t}),onClick:()=>w({userId:e,label:t}),children:[(0,Q.jsx)(Dt,{size:13,"aria-hidden":!0}),bt()]});return(0,Q.jsx)(Ut,{open:n,onOpenChange:r,children:(0,Q.jsxs)(Bt,{className:`oc-access`,children:[(0,Q.jsxs)(zt,{children:[(0,Q.jsx)(Vt,{children:_t({name:t})}),(0,Q.jsx)(Ht,{children:i&&!a?te():l()})]}),(0,Q.jsxs)(Rt,{value:y,onValueChange:b,className:`oc-access__tabs`,children:[(0,Q.jsxs)(Lt,{className:`w-full`,children:[(0,Q.jsxs)(Ft,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Ot,{size:13,"aria-hidden":!0}),de(),i?(0,Q.jsx)(q,{variant:`secondary`,className:`oc-access__tabcount`,children:O.size}):null]}),(0,Q.jsxs)(Ft,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(V,{size:13,"aria-hidden":!0}),Me(),i?(0,Q.jsx)(q,{variant:`secondary`,className:`oc-access__tabcount`,children:ne.size}):null]}),(0,Q.jsxs)(Ft,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(an,{size:13,"aria-hidden":!0}),Ie(),i?(0,Q.jsx)(q,{variant:`secondary`,className:`oc-access__tabcount`,children:i.chartCount}):null]})]}),(0,Q.jsx)(It,{value:`members`,children:i===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:I()}):a?s===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:I()}):s.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:nt()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:m,onChange:e=>h(e.target.value),placeholder:yt(),className:`oc-access__search`}),j.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ht()}):(0,Q.jsxs)(Q.Fragment,{children:[j.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(B,{checked:M===`all`||M===`some`&&`indeterminate`,onCheckedChange:()=>void oe(),"aria-label":F()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:F()}),(0,Q.jsxs)(q,{variant:`outline`,className:`oc-access__count`,children:[ae,` / `,j.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:N.pageItems.map(e=>{let t=O.has(e.userId),n=Yt(e),r=k.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(B,{checked:t,onCheckedChange:()=>void re(e.userId,t),"aria-label":pt({user:n.primary})}),(0,Q.jsxs)(`span`,{className:`oc-access__who`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,Q.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),t&&ee.has(e.userId)?(0,Q.jsx)(q,{variant:`outline`,className:`oc-access__role`,children:St()}):null,(0,Q.jsx)(q,{variant:`outline`,className:`oc-access__role`,children:tn(e.role)}),t?se(e.userId,n.primary):null,(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t?(0,Q.jsx)(W,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?Se():v(),title:r?Se():v(),onClick:()=>void ie(e.userId,r),children:(0,Q.jsx)(H,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(cn,{page:N.page,pageCount:N.pageCount,onPage:S})]})]}):e?(0,Q.jsx)(un,{groupId:e,members:i.members,agentsButton:se}):null}),(0,Q.jsxs)(It,{value:`agents`,children:[i&&!a?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:mt()}):null,o===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:I()}):o.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Ae()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:g,onChange:e=>_(e.target.value),placeholder:xt(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:o.map(t=>(0,Q.jsx)(fn,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:ne,defaultKey:A,viewerIsAdmin:a,query:g},`${e}-${t._id}`))})]})]}),(0,Q.jsx)(It,{value:`charts`,children:(0,Q.jsx)(mn,{groupId:e})})]}),(0,Q.jsx)(dn,{groupId:e,member:C,onOpenChange:e=>{e||w(null)}})]})})}function un({groupId:e,members:t,agentsButton:n}){let r=R(L.groupInvites.listGroupInviteRequests,{groupId:e}),i=P(L.groupInvites.requestGroupInvite),a=P(L.groups.removeMember),s=Gt(),c=K(),[l,d]=(0,Z.useState)(``),[f,p]=(0,Z.useState)(1),m=Zt(t,f,$);async function g(t){t.preventDefault();let n=l.trim();if(n)try{await i({groupId:e,email:n}),d(``),c.success(A())}catch(e){c.error(Ke(),e)}}async function _(t,n){if(await s({title:me({user:n}),description:u({user:n}),confirmLabel:fe(),cancelLabel:j(),destructive:!0}))try{await a({groupId:e,userId:t})}catch(e){c.error(z(),J(e))}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`form`,{className:`oc-access__invite`,onSubmit:e=>void g(e),children:[(0,Q.jsx)(G,{type:`email`,value:l,onChange:e=>d(e.target.value),placeholder:oe(),"aria-label":w()}),(0,Q.jsxs)(W,{type:`submit`,size:`sm`,disabled:!l.trim(),children:[(0,Q.jsx)(Et,{size:14,"aria-hidden":!0}),ie()]})]}),(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:h()}),t.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:gt()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:m.pageItems.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.label,children:e.label}),e.restricted?(0,Q.jsx)(q,{variant:`outline`,className:`oc-access__role`,children:St()}):null,n(e.userId,e.label),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:e.manager?(0,Q.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":k(),title:k(),children:(0,Q.jsx)(H,{size:15,"aria-hidden":!0})}):null}),(0,Q.jsx)(W,{type:`button`,variant:`ghost`,size:`icon-sm`,disabled:e.manager||e.lastGroup,"aria-label":me({user:e.label}),title:e.manager?vt():e.lastGroup?b():me({user:e.label}),onClick:()=>void _(e.userId,e.label),children:(0,Q.jsx)(kt,{size:14,"aria-hidden":!0})})]},e.userId))}),(0,Q.jsx)(cn,{page:m.page,pageCount:m.pageCount,onPage:p})]}),r!==void 0&&r.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-access__subhead`,children:o()}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:r.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.email,children:e.email}),(0,Q.jsx)(q,{variant:e.status===`pending`?`secondary`:`outline`,className:`oc-access__role`,children:$t(e.status)})]},e._id))})]}):null]})}function dn({groupId:e,member:t,onOpenChange:n}){let r=R(L.groups.getMemberAgentSettings,e&&t?{groupId:e,userId:t.userId}:`skip`),i=P(L.groups.setMemberAgents),a=P(L.groups.setMemberDefaultAgent),o=K();async function s(e){try{await e()}catch(e){o.error(ge(),e)}}let c=r?.agents??[],l=new Map(c.map(e=>[Y(e.instanceName,e.agentId),e])),u=[...l.keys()],d=new Set(c.filter(e=>e.allowed).map(e=>Y(e.instanceName,e.agentId)));function f(n){if(!e||!t||!r)return;let a=qt(u,d,r.restricted,n).map(e=>{let t=l.get(e);return{instanceName:t.instanceName,agentId:t.agentId}});s(()=>i({groupId:e,userId:t.userId,agents:a}))}return(0,Q.jsx)(Ut,{open:t!==null,onOpenChange:n,children:(0,Q.jsxs)(Bt,{className:`oc-access`,children:[(0,Q.jsxs)(zt,{children:[(0,Q.jsx)(Vt,{children:se({user:t?.label??``})}),(0,Q.jsx)(Ht,{children:De()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:I()}):r===null||c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:xe()}):(0,Q.jsxs)(Q.Fragment,{children:[r.settable?null:(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:re()}),r.adminNarrowed?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:C()}):null,r.restrictedByAdmin&&!r.viewerIsAdmin?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:N()}):null,(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,children:r.restricted?Te():Ce()}),r.restricted?(0,Q.jsx)(W,{type:`button`,size:`sm`,variant:`outline`,disabled:!r.settable||r.restrictedByAdmin&&!r.viewerIsAdmin,onClick:()=>e&&t?void s(()=>i({groupId:e,userId:t.userId,agents:null})):void 0,children:T()}):null]}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:c.map(n=>{let i=Y(n.instanceName,n.agentId),o=n.displayName??n.agentId;return(0,Q.jsxs)(`div`,{className:`oc-access__row oc-reveal-host`,children:[(0,Q.jsx)(B,{checked:n.allowed,disabled:!r.settable||r.restrictedByAdmin&&!r.viewerIsAdmin&&!n.allowed,onCheckedChange:()=>f(i),"aria-label":at({name:o})}),(0,Q.jsx)(`span`,{className:`oc-access__label`,title:o,children:o}),n.limitedByAdmin?(0,Q.jsx)(q,{variant:`outline`,className:`oc-access__role`,children:m()}):null,n.state===`deleted`?(0,Q.jsx)(q,{variant:`outline`,className:`oc-access__gone`,children:dt()}):null,n.allowed?n.isMemberDefault?(0,Q.jsx)(W,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__fav`,disabled:!r.settable,"aria-label":O(),title:O(),onClick:()=>e&&t?void s(()=>a({groupId:e,userId:t.userId,agent:null})):void 0,children:(0,Q.jsx)(U,{size:14,fill:`currentColor`})}):(0,Q.jsx)(W,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault oc-reveal oc-hit`,disabled:!r.settable,"aria-label":_(),title:_(),onClick:()=>e&&t?void s(()=>a({groupId:e,userId:t.userId,agent:{instanceName:n.instanceName,agentId:n.agentId}})):void 0,children:(0,Q.jsx)(U,{size:14})}):null]},i)})})]})]})})}function fn({groupId:e,instanceName:t,kind:n,assigned:i,defaultKey:a,viewerIsAdmin:o,query:s}){let c=R(L.groups.listAssignableAgents,e?{instanceName:t,groupId:e}:`skip`),l=P(L.groups.assignAgentToGroup),u=P(L.groups.removeAgentFromGroup),d=P(L.groups.bulkSetGroupAgents),f=P(L.groups.claimAgentForGroup),p=P(L.groups.setGroupDefaultAgent),m=K(),[h,g]=(0,Z.useState)(1);if((0,Z.useEffect)(()=>{g(1)},[s]),!e)return null;let _=en(c?.agents??[],s),v=c?.discovery&&!c.discovery.lastPollOk,y=e=>Qt({assigned:i.has(Y(t,e.agentId)),claimable:e.claimable,reservedForGroup:e.reservedForGroup,enabled:e.enabled,present:e.presentInLastOk!==!1},o),b=_.filter(e=>y(e)!==`claim`),x=_.filter(e=>y(e)===`claim`);if(s.trim()&&_.length===0)return null;let S=b.filter(e=>y(e)===`toggle`&&e.presentInLastOk!==!1&&e.enabled!==!1),C=Jt(S,e=>i.has(Y(t,e.agentId))),w=Zt(b,h,$);async function T(n,r){try{r?await u({groupId:e,instanceName:t,agentId:n}):await l({groupId:e,instanceName:t,agentId:n})}catch(e){m.error(ue(),J(e))}}async function E(){if(S.length===0)return;let n=S.map(e=>e.agentId);try{await d({groupId:e,instanceName:t,agentIds:n,assigned:C!==`all`})}catch(e){m.error(ue(),J(e))}}async function D(n){try{await f({groupId:e,instanceName:t,agentId:n})}catch(e){m.error(je(),e)}}async function O(n){try{await p({groupId:e,agent:n===null?null:{instanceName:t,agentId:n}})}catch(e){m.error(r(),e)}}let k=e=>e.reservedForGroup?(0,Q.jsx)(q,{variant:`outline`,className:`oc-access__role`,children:We()}):e.reserved?(0,Q.jsx)(q,{variant:`outline`,className:`oc-access__role`,children:e.reservedGroupName===null?tt():ct({group:e.reservedGroupName})}):null;return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(V,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(q,{variant:`outline`,className:`oc-access__kind`,children:n}),v?(0,Q.jsx)(q,{variant:`outline`,className:`oc-access__stale`,children:et()}):null]}),c===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:lt()}):_.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:v?st():Ue()}):(0,Q.jsxs)(Q.Fragment,{children:[S.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(B,{checked:C===`all`||C===`some`&&`indeterminate`,onCheckedChange:()=>void E(),"aria-label":F()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:F()})]}):null,w.pageItems.map(e=>{let n=Y(t,e.agentId),r=i.has(n),o=e.presentInLastOk===!1,s=y(e)===`locked`;return(0,Q.jsxs)(`div`,{className:`oc-access__row oc-reveal-host${s?` is-disabled`:``}`,children:[(0,Q.jsx)(B,{checked:r,disabled:s&&!r,onCheckedChange:()=>void T(e.agentId,r),"aria-label":Xe({name:e.displayName??e.agentId})}),(0,Q.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Q.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,k(e),o?(0,Q.jsx)(q,{variant:`outline`,className:`oc-access__gone`,children:dt()}):null,r?a===n?(0,Q.jsx)(W,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__fav`,"aria-label":ft(),title:ft(),onClick:()=>void O(null),children:(0,Q.jsx)(U,{size:14,fill:`currentColor`})}):(0,Q.jsx)(W,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault oc-reveal oc-hit`,"aria-label":Le(),title:Le(),onClick:()=>void O(e.agentId),children:(0,Q.jsx)(U,{size:14})}):null]},e.agentId)}),(0,Q.jsx)(cn,{page:w.page,pageCount:w.pageCount,onPage:g}),x.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-access__subhead`,children:Ze()}),(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Pe()}),x.map(e=>{let t=e.displayName??e.agentId;return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsxs)(`span`,{className:`oc-access__label`,title:t,children:[e.emoji?`${e.emoji} `:``,t]}),e.model?(0,Q.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,(0,Q.jsx)(W,{type:`button`,size:`sm`,variant:`outline`,className:`h-7`,"aria-label":rt({name:t}),onClick:()=>void D(e.agentId),children:ut()})]},e.agentId)})]}):null]})]})}function pn(){let e=R(L.groupInvites.listPendingInviteRequests,{}),t=P(L.groupInvites.decideGroupInvite),n=K();if(e===void 0||e.length===0)return null;async function r(e,r){try{await t({requestId:e,approve:r})}catch(e){n.error(Fe(),e)}}return(0,Q.jsxs)(`section`,{className:`oc-invites`,"aria-label":ke(),children:[(0,Q.jsxs)(`h3`,{className:`oc-invites__title`,children:[(0,Q.jsx)(Et,{size:14,"aria-hidden":!0}),ke(),(0,Q.jsx)(q,{variant:`secondary`,children:e.length})]}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:e.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsxs)(`span`,{className:`oc-access__who`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.email,children:e.email}),(0,Q.jsxs)(`span`,{className:`oc-access__sub`,children:[e.groupName??`?`,` ·`,` `,Be({by:e.requestedBy})]})]}),e.account===`ready`?null:(0,Q.jsx)(q,{variant:`outline`,className:`oc-access__role`,children:e.account===`none`?it():Re()}),(0,Q.jsx)(W,{type:`button`,size:`sm`,variant:`outline`,className:`h-7`,disabled:e.account!==`ready`,onClick:()=>void r(e._id,!0),children:He()}),(0,Q.jsx)(W,{type:`button`,size:`sm`,variant:`ghost`,className:`h-7`,onClick:()=>void r(e._id,!1),children:$e()})]},e._id))})]})}function mn({groupId:e}){let t=R(L.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=P(L.charts.assignChartToGroup),r=P(L.charts.removeChartFromGroup),a=P(L.charts.setGroupDefaultChart),o=P(L.charts.addChartToGroupPool),s=P(L.charts.removeChartFromGroupPool),c=K();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:I()});let{pool:l,addable:u,canManagePool:d}=t;if(l.length===0&&!d)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:i()});async function f(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){c.error(x(),e)}}async function p(t){try{await a({groupId:e,chartKey:t})}catch(e){c.error(x(),e)}}async function m(t){try{await o({groupId:e,chartKey:t})}catch(e){c.error(x(),e)}}async function h(t){try{await s({groupId:e,chartKey:t})}catch(e){c.error(x(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:l.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(B,{checked:e.selected,onCheckedChange:()=>void f(e.chartKey,e.selected),"aria-label":Ee({name:e.name})}),(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":E(),title:E(),children:(0,Q.jsx)(U,{size:14,fill:`currentColor`})}):(0,Q.jsx)(W,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void p(e.chartKey),children:ot()}):null,d?(0,Q.jsx)(W,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":we({name:e.name}),title:we({name:e.name}),onClick:()=>void h(e.chartKey),children:(0,Q.jsx)(kt,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),d?u.length>0?(0,Q.jsxs)(Pt,{value:``,onValueChange:e=>void m(e),children:[(0,Q.jsx)(jt,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(At,{placeholder:Oe()})}),(0,Q.jsx)(Mt,{children:u.map(e=>(0,Q.jsx)(Nt,{value:e.chartKey,children:e.name},e.chartKey))})]}):l.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ce()}):null:null]})}export{sn as GroupsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$I as r,AI as i,AL as a,Ab as o,BI as s,BL as c,Bt as l,CI as u,CL as d,Ch as f,Cr as p,Cs as m,DI as h,DL as g,EI as _,EL as v,Eh as y,FI as b,FL as x,Ft as S,GI as C,GL as ee,HI as w,HL as te,Ht as ne,II as T,IL as re,Ij as ie,It as ae,JI as E,JL as oe,KI as D,KL as se,LI as O,LL as ce,Lj as le,Lt as ue,MI as de,ML as fe,Mb as pe,NI as me,NL as he,OI as ge,OL as _e,PI as ve,PL as ye,Pt as be,QI as xe,RI as Se,RL as Ce,Rt as we,SI as Te,SL as Ee,Sr as De,Ss as Oe,TI as ke,TL as Ae,Th as je,UI as Me,UL as Ne,VI as Pe,VL as Fe,Vt as Ie,WI as Le,WL as Re,XI as ze,YI as Be,YL as Ve,ZI as He,_I as Ue,_L as We,_Q as k,_d as Ge,_r as Ke,_s as qe,aI as Je,aL as Ye,bI as Xe,bL as Ze,br as Qe,bs as $e,cI as et,cL as tt,cs as nt,dG as rt,dI as it,dL as at,ds as ot,eI as st,eL as ct,fI as lt,fL as ut,fs as dt,gI as ft,gL as pt,gr as mt,gs as ht,hI as gt,hL as _t,hQ as A,hr as vt,hs as yt,iI as bt,iL as xt,jI as St,jL as Ct,jb as wt,kL as Tt,lI as Et,lL as Dt,ls as Ot,mI as kt,mL as At,mr as jt,ms as Mt,nI as Nt,nL as Pt,oI as Ft,oL as It,pI as Lt,pL as Rt,ps as zt,qI as Bt,qL as Vt,rI as Ht,rL as Ut,sI as j,sL as Wt,ss as Gt,t as M,tI as Kt,tL as N,uG as P,uI as qt,uL as Jt,us as Yt,vI as Xt,vL as Zt,vQ as F,vd as Qt,vr as $t,vs as en,wI as tn,wL as nn,wh as rn,xI as an,xL as on,xr as sn,xs as cn,yI as ln,yL as un,yd as dn,yr as fn,ys as pn,zI as mn,zL as hn,zt as gn}from"./api-jG5Fwsg4.js";import{a as _n,c as vn}from"./FieldLabel-Wb5bwK7r.js";import{t as yn}from"./checkbox-U99HMqP3.js";import{a as I,i as L,n as R,r as z,t as B}from"./select-DGKgMOlh.js";import{n as bn,r as xn,t as Sn}from"./popover-BcL-AsC2.js";import{t as V}from"./button-sV7hIR3f.js";import{t as H}from"./input-DReDYsos.js";import"./convexApi-DeaVGrsr.js";import{r as U}from"./toast-daONdZpX.js";import{t as W}from"./badge-CSm2xaYH.js";import{a as G,n as K,o as q,r as Cn,t as wn}from"./dialog-Bpoyy7pR.js";import{n as Tn}from"./ConfirmDialog-BmOX8o6F.js";import{t as En}from"./EntitySheet-BXEY6TCb.js";import{a as Dn}from"./groupManageView-BcbLXWZ4.js";import{t as On}from"./DataTableShell-BTk71L7O.js";import{InstanceConfigDialog as kn}from"./BridgeTab-OC_GNU22.js";var J=t(e(),1),Y=[`conversational`,`documentary`,`summarizer`,`curator`],An=new Set(Y),jn=`conversational`;function Mn(e){let t=new Set((e??[]).filter(e=>An.has(e)));return t.size===0?[jn]:Y.filter(e=>t.has(e))}var X=n(),Z={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,authMode:`token`,personScopes:`capped`,identitySource:`canonical`,participantIdentity:`owner`,managePermissionModes:!1,systemIdentity:``,streamTransport:_n,widgetsEnabled:!0,widgetPromptConfirm:!1},Nn={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Pn(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,transport:e.transport??`ws`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,authMode:e.authMode??`token`,personScopes:e.personScopes??`capped`,identitySource:e.identitySource??`canonical`,participantIdentity:e.participantIdentity??`owner`,managePermissionModes:e.managePermissionModes===!0,systemIdentity:e.systemIdentity??``,streamTransport:e.streamTransport??`reactive`,widgetsEnabled:e.config?.widgetsEnabled!==!1,widgetPromptConfirm:e.config?.widgetPromptConfirm===!0}}function Fn(){let e=F(M.admin.listInstances,{}),t=F(M.agents.listAllInstanceAgents,{}),n=k(M.admin.upsertInstance),r=k(M.widgets.setInstanceWidgets),i=k(M.admin.deleteInstance),o=U(),[s,u]=(0,J.useState)(!1),[f,h]=(0,J.useState)(Z),[_,y]=(0,J.useState)(null),[b,C]=(0,J.useState)(null),[w,T]=(0,J.useState)(null),[E,D]=(0,J.useState)(null);async function O(){try{let t=await n({instanceId:E??void 0,name:f.name,gatewayUrl:f.gatewayUrl,bridgeUrl:f.bridgeUrl||void 0,displayName:f.displayName||void 0,kind:f.kind,transport:f.kind===`hermes`?f.transport:void 0,gatewayVersion:f.gatewayVersion||void 0,gatewayHttpUrl:f.gatewayHttpUrl||void 0,...f.kind===`openclaw`?{authMode:f.authMode,personScopes:f.personScopes,identitySource:f.identitySource,participantIdentity:f.participantIdentity,managePermissionModes:f.managePermissionModes,systemIdentity:f.systemIdentity||void 0}:{},streamTransport:f.streamTransport}),i=E===null?null:e?.find(e=>e._id===E),a=i?.config?.widgetsEnabled!==!1,o=i?.config?.widgetPromptConfirm===!0;f.kind===`openclaw`&&(f.widgetsEnabled!==a||f.widgetPromptConfirm!==o)&&await r({instanceId:t,enabled:f.widgetsEnabled,promptConfirm:f.widgetPromptConfirm}),h(Z),D(null),u(!1)}catch(e){o.error(Vt(),e)}}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[se(),(0,X.jsx)(`strong`,{children:ee()}),Re()]}),(0,X.jsx)(On,{title:Ne(),rows:e,addLabel:te(),onAdd:()=>{D(null),h(Z),u(!0)},emptyHint:Fe(),columns:[{header:c(),cell:e=>e.name,sort:e=>e.name},{header:hn(),cell:e=>(0,X.jsx)(W,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:Ce(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:ce(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:Ve(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,X.jsxs)(W,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?j():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:he(),onSelect:()=>{D(e._id),h(Pn(e)),u(!0)}},{label:oe(),onSelect:()=>y(e.name)},{label:Zt(),onSelect:()=>T(e)},{label:re(),onSelect:()=>C(e)},{label:x(),variant:`destructive`,onSelect:()=>void i({instanceId:e._id})}],bulkActions:[{label:x(),variant:`destructive`,onSelect:e=>e.forEach(e=>void i({instanceId:e}))}]}),(0,X.jsx)(En,{open:s,onOpenChange:u,title:E?fe():ye(),description:a(),canSubmit:!!(f.name&&f.gatewayUrl),onSubmit:O,submitLabel:Tt(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)($,{label:_e(),children:[(0,X.jsx)(H,{value:f.name,disabled:E!==null,onChange:e=>h({...f,name:e.target.value})}),E?(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Ct()}):null]}),(0,X.jsx)($,{label:g(),children:(0,X.jsxs)(B,{value:f.kind,onValueChange:e=>h({...f,kind:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`openclaw`,children:`OpenClaw`}),(0,X.jsx)(z,{value:`hermes`,children:`Hermes`})]})]})}),f.kind===`hermes`?(0,X.jsx)($,{label:dn(),children:(0,X.jsxs)(B,{value:f.transport,onValueChange:e=>h({...f,transport:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`ws`,children:Qt()}),(0,X.jsx)(z,{value:`rest`,children:Ge()})]})]})}):null,(0,X.jsx)($,{label:v(),children:(0,X.jsx)(H,{value:f.gatewayUrl,onChange:e=>h({...f,gatewayUrl:e.target.value})})}),(0,X.jsx)($,{label:Ae(),children:(0,X.jsx)(H,{value:f.bridgeUrl,placeholder:nn(),onChange:e=>h({...f,bridgeUrl:e.target.value})})}),(0,X.jsx)($,{label:d(),children:(0,X.jsx)(H,{value:f.displayName,onChange:e=>h({...f,displayName:e.target.value})})}),(0,X.jsxs)($,{label:le(),children:[(0,X.jsxs)(B,{value:f.streamTransport,onValueChange:e=>h({...f,streamTransport:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsx)(R,{children:vn.map(e=>(0,X.jsx)(z,{value:e,children:e},e))})]}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:ie()})]}),(0,X.jsx)($,{label:Ee(),children:(0,X.jsx)(H,{value:f.gatewayVersion,placeholder:on(),onChange:e=>h({...f,gatewayVersion:e.target.value})})}),f.kind===`openclaw`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)($,{label:zt(),children:[(0,X.jsxs)(B,{value:f.authMode,onValueChange:e=>h({...f,authMode:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`token`,children:dt()}),(0,X.jsx)(z,{value:`trusted-proxy`,children:ot()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:f.authMode===`trusted-proxy`?Ot():Yt()})]}),f.authMode===`trusted-proxy`?(0,X.jsxs)($,{label:m(),children:[(0,X.jsxs)(B,{value:f.personScopes,onValueChange:e=>h({...f,personScopes:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`capped`,children:Oe()}),(0,X.jsx)(z,{value:`full`,children:cn()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:f.personScopes===`full`?pn():$e()})]}):null,f.authMode===`trusted-proxy`?(0,X.jsxs)($,{label:en(),children:[(0,X.jsxs)(B,{value:f.identitySource,onValueChange:e=>h({...f,identitySource:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`canonical`,children:qe()}),(0,X.jsx)(z,{value:`email`,children:ht()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:f.identitySource===`email`?Mt():yt()})]}):null,f.authMode===`trusted-proxy`?(0,X.jsxs)($,{label:p(),children:[(0,X.jsxs)(B,{value:f.participantIdentity,onValueChange:e=>h({...f,participantIdentity:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`owner`,children:De()}),(0,X.jsx)(z,{value:`self`,children:sn()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:f.participantIdentity===`self`?jt():Qe()})]}):null,f.kind===`openclaw`?(0,X.jsxs)($,{label:fn(),children:[(0,X.jsxs)(B,{value:f.managePermissionModes?`on`:`off`,onValueChange:e=>h({...f,managePermissionModes:e===`on`}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`off`,children:$t()}),(0,X.jsx)(z,{value:`on`,children:Ke()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:f.managePermissionModes?vt():mt()})]}):null,f.kind===`openclaw`?(0,X.jsxs)($,{label:ne(),children:[(0,X.jsxs)(B,{value:f.widgetsEnabled?`on`:`off`,onValueChange:e=>h({...f,widgetsEnabled:e===`on`}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`on`,children:Ie()}),(0,X.jsx)(z,{value:`off`,children:l()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:f.widgetsEnabled?gn():we()})]}):null,f.kind===`openclaw`&&f.widgetsEnabled?(0,X.jsxs)($,{label:ue(),children:[(0,X.jsxs)(B,{value:f.widgetPromptConfirm?`on`:`off`,onValueChange:e=>h({...f,widgetPromptConfirm:e===`on`}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`off`,children:ae()}),(0,X.jsx)(z,{value:`on`,children:S()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:be()})]}):null,f.authMode===`trusted-proxy`?(0,X.jsx)($,{label:nt(),children:(0,X.jsx)(H,{value:f.systemIdentity,placeholder:Gt(),onChange:e=>h({...f,systemIdentity:e.target.value})})}):null]}):null,(0,X.jsx)($,{label:Ze(),children:(0,X.jsx)(H,{value:f.gatewayHttpUrl,placeholder:un(),onChange:e=>h({...f,gatewayHttpUrl:e.target.value})})})]})}),(0,X.jsx)(Wn,{instanceName:_,open:_!==null,onOpenChange:e=>{e||y(null)}}),b?(0,X.jsx)(kn,{instance:b,onClose:()=>C(null)},b._id):null,w?(0,X.jsx)(In,{instance:w,onClose:()=>T(null)},w._id):null]})}function In({instance:e,onClose:t}){let n=F(M.instanceSecrets.listInstanceSecretStatus,{}),r=Nn[e.kind??`openclaw`],i=(0,J.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,X.jsx)(wn,{open:!0,onOpenChange:e=>!e&&t(),children:(0,X.jsxs)(K,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,X.jsxs)(G,{children:[(0,X.jsx)(q,{children:We({instance:e.displayName??e.name})}),(0,X.jsx)(Cn,{children:pt()})]}),(0,X.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,X.jsx)(zn,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,X.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,X.jsx)(Rn,{instance:e})}),(0,X.jsx)(Ln,{instance:e})]})})}function Ln({instance:e}){let t=A(M.instanceSync.forceInstanceSync),n=U(),[r,i]=(0,J.useState)(!1);async function a(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(ze());break;case`no_agents`:n.success(E());break;case`no_bridge_url`:n.error(Bt());break;case`deploy_misconfigured`:n.error(D());break;case`unauthorized`:n.error(Le());break;case`not_served`:n.error(Me());break;default:n.error(C());break}}catch(e){n.error(Be(),e)}finally{i(!1)}}}return(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:w()}),(0,X.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,X.jsx)(V,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?He():xe()})})]})}function Rn({instance:e}){let t=F(M.bridgeAuth.listBridgeAuthStatus,{}),n=A(M.bridgeAuth.mintBridgeSecret),r=k(M.bridgeAuth.revokeBridgeSecret),i=U(),[a,o]=(0,J.useState)(!1),[c,l]=(0,J.useState)(null),[u,d]=(0,J.useState)(!1),f=(t??[]).find(t=>t.instanceId===e._id),p=f!==void 0;async function m(){if(!a){o(!0);try{let t=await n({instanceId:e._id});l(t.plaintext),d(!1)}catch(e){i.error(b(),e)}finally{o(!1)}}}async function h(){if(!a){o(!0);try{await r({instanceId:e._id}),l(null),i.success(T())}catch(e){i.error(b(),e)}finally{o(!1)}}}async function g(){if(c)try{await navigator.clipboard.writeText(c),d(!0)}catch{}}return(0,X.jsxs)($,{label:Pe(),children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:s()}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(W,{variant:p?`outline`:`secondary`,children:p?`${ut()} · ${f.prefix}…${f.lastFour}`:at()}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(V,{size:`sm`,onClick:()=>void m(),disabled:a,children:p?Se():mn()}),p?(0,X.jsx)(V,{size:`sm`,variant:`destructive`,onClick:()=>void h(),disabled:a,children:O()}):null]})]}),c?(0,X.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,X.jsx)(`p`,{className:`oc-sa__minted-warning`,children:ve()}),(0,X.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,X.jsx)(`code`,{className:`oc-sa__minted-plain`,children:c}),(0,X.jsx)(V,{variant:`outline`,size:`sm`,onClick:()=>void g(),children:u?rt():P()})]}),(0,X.jsx)(V,{size:`sm`,variant:`ghost`,onClick:()=>{l(null),d(!1)},children:me()})]}):null]})}function zn({instanceId:e,field:t,updatedAt:n}){let i=A(M.instanceSecrets.setInstanceSecret),a=k(M.instanceSecrets.clearInstanceSecret),o=A(M.deviceIdentity.generateDeviceIdentity),s=U(),[c,l]=(0,J.useState)(``),[u,d]=(0,J.useState)(!1),[f,p]=(0,J.useState)(null),[m,h]=(0,J.useState)(!1),g=n!==null,_=t===`deviceIdentity`,v=t===`token`?_t():t===`deviceIdentity`?At():Rt();async function y(){if(!(!c.trim()||u)){d(!0);try{await i({instanceId:e,field:t,plaintext:c}),l(``),p(null),h(!1),s.success(It())}catch(e){s.error(Ye(),e)}finally{d(!1)}}}async function b(){if(!u){d(!0);try{await a({instanceId:e,field:t}),p(null),h(!1),s.success(xt())}catch(e){s.error(Ye(),e)}finally{d(!1)}}}async function x(){if(!u){d(!0);try{let t=await o({instanceId:e});p(t),h(!1),s.success(N())}catch(e){s.error(r(),e)}finally{d(!1)}}}let S=f?`openclaw devices approve ${f.id}`:``;async function C(){if(S)try{await navigator.clipboard.writeText(S),h(!0)}catch{}}return(0,X.jsxs)($,{label:v,children:[_?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:Pt()}):null,(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(W,{variant:g?`outline`:`secondary`,children:g?ut():at()}),(0,X.jsx)(H,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:c,placeholder:g?Dt():Jt(),onChange:e=>l(e.target.value)}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(V,{size:`sm`,onClick:()=>void y(),disabled:u||c.trim().length===0,children:tt()}),_?(0,X.jsx)(V,{size:`sm`,variant:`outline`,onClick:()=>void x(),disabled:u,children:Ut()}):null,g?(0,X.jsx)(V,{size:`sm`,variant:`destructive`,onClick:()=>void b(),disabled:u,children:Wt()}):null]})]}),f?(0,X.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,X.jsx)(`p`,{className:`text-sm font-medium`,children:N()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:ct()}),(0,X.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,X.jsx)(`code`,{className:`oc-sa__minted-plain`,children:S}),(0,X.jsx)(V,{variant:`outline`,size:`sm`,onClick:()=>void C(),children:m?rt():P()})]}),(0,X.jsx)(V,{size:`sm`,variant:`ghost`,onClick:()=>{p(null),h(!1)},children:me()})]}):null]})}var Bn={conversational:Te,documentary:Xe,summarizer:y,curator:rn},Vn={conversational:an,documentary:ln,summarizer:je,curator:f},Hn=e=>(Bn[e]??(()=>e))(),Q=e=>(Vn[e]??(()=>``))();function Un({agentId:e,types:t,onToggle:n}){return(0,X.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,X.jsx)(`span`,{className:`oc-agentcard__types-label`,children:_()}),t.map(e=>(0,X.jsx)(W,{variant:`secondary`,className:`oc-agenttype__chip`,title:Q(e),children:(0,X.jsx)(`span`,{className:`oc-agenttype__label`,children:Hn(e)})},e)),(0,X.jsxs)(Sn,{children:[(0,X.jsx)(xn,{asChild:!0,children:(0,X.jsx)(V,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:ke()})}),(0,X.jsxs)(bn,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,X.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:tn()}),(0,X.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:u()}),(0,X.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:Y.map(r=>{let i=`agtype-${e}-${r}`;return(0,X.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,X.jsx)(yn,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,X.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,X.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:Hn(r)}),(0,X.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Q(r)})]})]},r)})})]})]})]})}function Wn({instanceName:e,open:t,onOpenChange:n}){let r=F(M.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),a=k(M.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),s=k(M.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),c=k(M.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=Mn(r);e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),l=k(M.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),u=k(M.agents.removeInstanceAgent),d=k(M.agents.setAgentReservation),f=F(M.groups.listGroupLabels,t?{}:`skip`),p=Tn(),m=U();async function h(t,n){if(e&&await p({title:Ht({name:n}),description:Nt(),confirmLabel:bt()}))try{await d({instanceName:e,agentId:t,groupId:null})}catch(e){m.error(i(),Dn(e))}}async function g(t,n,r){if(!e)return;let a=(f??[]).find(e=>e._id===r)?.name??`?`;if(await p({title:pe({name:n,group:a}),description:wt({group:a}),confirmLabel:o()}))try{await d({instanceName:e,agentId:t,groupId:r})}catch(e){m.error(i(),Dn(e))}}async function _(t,n){if(e)try{await a({instanceName:e,agentId:t,enabled:n})}catch(e){m.error(i(),e)}}async function v(t){if(e)try{await s({instanceName:e,agentId:t})}catch(e){m.error(i(),e)}}async function y(t,n,r){if(!e)return;let a=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await c({instanceName:e,agentId:t,types:a})}catch(e){m.error(i(),e)}}async function b(t,n){if(e&&await p({title:ft({name:n}),description:gt(),confirmLabel:kt(),destructive:!0}))try{await u({instanceName:e,agentId:t}),m.success(Lt())}catch(e){m.error(i(),e)}}return(0,X.jsx)(wn,{open:t,onOpenChange:n,children:(0,X.jsxs)(K,{className:`oc-access`,children:[(0,X.jsxs)(G,{children:[(0,X.jsx)(q,{children:de({name:e??``})}),(0,X.jsx)(Cn,{children:St()})]}),r===void 0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:lt()}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?it():r.discovery.lastPollOk?qt():Et({error:r.discovery.error??`?`})}),r.agents.length===0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:et()}):(0,X.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(t=>{let n=t.presentInLastOk===!1,a=r.defaultAgentId===t.agentId,o=t.displayName??t.agentId,s=t.types??[];return(0,X.jsxs)(`div`,{className:`oc-agentcard`+(t.enabled?``:` oc-agentcard--off`),children:[(0,X.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,X.jsx)(yn,{checked:t.enabled,disabled:n,"aria-label":o,onCheckedChange:e=>void _(t.agentId,e===!0)}),(0,X.jsxs)(`div`,{className:`oc-agentcard__main`,children:[(0,X.jsxs)(`span`,{className:`oc-agentcard__name`,title:o,children:[t.emoji?`${t.emoji} `:``,o]}),t.model?(0,X.jsx)(`span`,{className:`oc-access__model`,children:t.model}):null,t.reserved?(0,X.jsx)(W,{variant:`outline`,children:t.reserved.groupName===null?Je():Ft({group:t.reserved.groupName})}):null,n?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(W,{variant:`outline`,className:`oc-access__gone`,children:st()}),(0,X.jsx)(V,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void b(t.agentId,o),children:Ue()})]}):a?(0,X.jsx)(W,{variant:`default`,children:j()}):(0,X.jsx)(V,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled||t.reserved!==null,onClick:()=>void v(t.agentId),children:Xt()})]})]}),t.reserved?(0,X.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,X.jsx)(V,{size:`sm`,variant:`outline`,className:`h-7`,onClick:()=>void h(t.agentId,o),children:bt()}),(0,X.jsxs)(B,{value:``,onValueChange:e=>void g(t.agentId,o,e),children:[(0,X.jsx)(L,{size:`sm`,className:`h-7`,children:(0,X.jsx)(I,{placeholder:Kt()})}),(0,X.jsx)(R,{children:(f??[]).filter(e=>e._id!==t.reserved?.groupId).map(e=>(0,X.jsx)(z,{value:e._id,children:e.name},e._id))})]})]}):null,t.enabled?(0,X.jsx)(Un,{agentId:t.agentId,types:s,onToggle:e=>void y(t.agentId,e,s)}):null,t.enabled?(0,X.jsx)(Gn,{value:t.description??``,onSave:async n=>{if(e)try{await l({instanceName:e,agentId:t.agentId,description:n})}catch(e){m.error(i(),e)}}}):null]},t.agentId)})})]})]})})}function Gn({value:e,onSave:t}){let[n,r]=(0,J.useState)(e);(0,J.useEffect)(()=>{r(e)},[e]);let i=()=>{n.trim()!==e.trim()&&t(n)};return(0,X.jsx)(H,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:ge(),"aria-label":h(),onChange:e=>r(e.target.value),onBlur:i,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())}})}function $({label:e,children:t}){return(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{Fn as InstancesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Az as r,Bg as i,Bz as a,Dz as o,Fz as s,Gg as c,Hg as l,Iz as u,Kg as d,Lz as f,Mz as p,Nz as m,Oz as h,Pz as g,Rz as _,Ug as v,Vg as y,Wg as b,_Q as x,hQ as S,jz as C,kz as w,qg as T,t as E,vQ as D,zg as O,zz as k}from"./api-jG5Fwsg4.js";import{t as A}from"./checkbox-U99HMqP3.js";import"./select-DGKgMOlh.js";import{t as j}from"./button-sV7hIR3f.js";import{t as M}from"./input-DReDYsos.js";import"./convexApi-DeaVGrsr.js";import{t as N}from"./badge-CSm2xaYH.js";var P=t(e(),1),F=n();function I(){let e=D(E.integrations.status.status,{}),t=x(E.admin.setIntegrationConfig),[n,i]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&i(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:a()});let l=n,v=(e,t,n)=>i({...l,[e]:{...l[e],[t]:n}}),y=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[k(),` `,(0,F.jsx)(`strong`,{children:_()}),` `,f()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(N,{variant:`secondary`,children:u()}):(0,F.jsx)(N,{variant:`outline`,children:s()}):(0,F.jsx)(N,{variant:`outline`,children:g()}),note:m(),children:[(0,F.jsx)(R,{label:C(),children:(0,F.jsx)(M,{value:l.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>v(`langfuse`,`host`,e.target.value),onBlur:()=>y(`langfuse`,{host:l.langfuse.host??``})})}),(0,F.jsx)(z,{label:o(),checked:l.langfuse.enabled??!0,onChange:e=>{v(`langfuse`,`enabled`,e),y(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(N,{variant:`secondary`,children:u()}):(0,F.jsx)(N,{variant:`outline`,children:s()}):(0,F.jsx)(N,{variant:`outline`,children:g()}),note:p(),children:[(0,F.jsx)(R,{label:r(),children:(0,F.jsx)(M,{value:l.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>v(`opik`,`baseUrl`,e.target.value),onBlur:()=>y(`opik`,{baseUrl:l.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:w(),children:(0,F.jsx)(M,{value:l.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||h(),onChange:e=>v(`opik`,`workspace`,e.target.value),onBlur:()=>y(`opik`,{workspace:l.opik.workspace??``})})}),(0,F.jsx)(z,{label:o(),checked:l.opik.enabled??!0,onChange:e=>{v(`opik`,`enabled`,e),y(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(N,{variant:`secondary`,children:u()}):(0,F.jsx)(N,{variant:`outline`,children:s()}):(0,F.jsx)(N,{variant:`outline`,children:T()}),note:d(),children:[(0,F.jsx)(R,{label:c(),children:(0,F.jsx)(M,{value:l.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>v(`otlp`,`endpoint`,e.target.value),onBlur:()=>y(`otlp`,{endpoint:l.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:o(),checked:l.otlp.enabled??!0,onChange:e=>{v(`otlp`,`enabled`,e),y(`otlp`,{enabled:e})}})]})]})}function L({title:e,status:t,note:n,children:r}){return(0,F.jsxs)(`section`,{className:`oc-int__section`,children:[(0,F.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,F.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,F.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function R({label:e,children:t}){return(0,F.jsxs)(`label`,{className:`oc-int__field`,children:[(0,F.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function z({label:e,checked:t,onChange:n}){return(0,F.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,F.jsx)(A,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=S(E.integrations.otlpSecret.setOtlpHeaders),n=x(E.integrations.otlpSecret.clearOtlpHeaders),[r,a]=(0,P.useState)(``),[o,s]=(0,P.useState)(null),[c,u]=(0,P.useState)(!1),d=async()=>{u(!0),s(null);try{await t({headersJson:r}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{u(!1)}};return(0,F.jsxs)(R,{label:b(),children:[(0,F.jsx)(M,{value:r,placeholder:e?v():l(),onChange:e=>a(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(j,{size:`sm`,disabled:c||r.trim().length===0,onClick:()=>void d(),children:y()}),e?(0,F.jsx)(j,{variant:`ghost`,size:`sm`,disabled:c,onClick:()=>void n({}),children:i()}):null]}),o?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:o}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:O()})]})}export{I as IntegrationsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{A as r,Gy as i,Ky as a,M as o,N as s,Qy as c,RW as l,Xy as u,_Q as d,_b as f,bb as p,db as m,fb as h,gb as g,hb as _,it as v,j as y,mb as b,nt as x,pb as ee,qy as S,rt as C,t as w,tt as T,vQ as E,vb as D,yb as O}from"./api-jG5Fwsg4.js";import{t as te}from"./loader-circle-_HV4tchJ.js";import{t as ne}from"./rotate-ccw-XgdDTtI8.js";import"./convexApi-DeaVGrsr.js";import{r as re,t as ie}from"./capabilities-CASxhKEd.js";var k=t(e(),1),A={thinkingLevel:`segmented`,model:`list`,fastMode:`segmented`,showReasoning:`segmented`};function j(e,t){return A[e]===`segmented`&&t<=5?`segmented`:`list`}function M(e,t){return e!=null&&e[t]!==void 0}var N=[`inherit`,`fast`,`standard`];function P(e){return e==null||e.fastMode===void 0?`inherit`:e.fastMode?`fast`:`standard`}function F(e){return e===`inherit`?ee():e===`fast`?h():m()}function I(e){return e===`inherit`?null:e===`fast`}function L(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function R(e){return e.length?e[0].toUpperCase()+e.slice(1):e}var z={off:`Off`,minimal:`Min`,low:`Low`,medium:`Med`,high:`High`,xhigh:`XHigh`};function B(e,t){return z[e]??t}function V(e){return H(e).used}function H(e){if(!e)return{used:null,source:`unknown`};let t=e.contextTokens,n=e=>e==null||t&&e>t?null:e;if(e.estimatedPromptTokens!=null)return{used:e.estimatedPromptTokens,source:`budget_estimate`};let r=n(e.activeTokens);if(r!=null)return{used:r,source:`last_call_usage`};if(e.totalTokensFresh===!1)return{used:null,source:`unknown`};let i=n(e.totalTokens);return i==null?{used:null,source:`unknown`}:{used:i,source:`last_call_usage`}}function U(e){return e?e.promptBudgetBeforeReserve!=null&&e.promptBudgetBeforeReserve>0?e.promptBudgetBeforeReserve:e.contextTokens!=null&&e.contextTokens>0?e.contextTokens:null:null}function W(e){if(!e)return null;if(e.sessionOverfull===!0)return`compaction_failed`;let t=V(e),n=U(e);return t!=null&&n!=null&&t>n?`estimate_exceeds_budget`:null}function G(e){return H(e).source}function K(e,t){return e==null||!t||t<=0?null:Math.round(e/t*100)}function q(e,t){let n=K(e,t);return n===null?null:c({pct:n,used:L(e),total:L(t)})}function J(e){return u({level:e??`full`})}function ae(e,t){let n=typeof e==`number`,r=typeof t==`number`;return n&&r?S({cost:e.toFixed(2),tokens:L(t)}):n?a({cost:e.toFixed(2)}):r?i({tokens:L(t)}):null}function oe(e){let t=e.filter(e=>typeof e==`string`&&e.length>0);return t.length>0?t.join(` · `):null}function se(e,t=5){let n=e?.contextPercent;if(typeof n!=`number`||!Number.isFinite(n))return null;let r=V(e),i=U(e);if(r===null||i===null)return null;let a=K(r,i);if(a===null)return null;let o=Math.abs(n-a);return o<=t?null:{gateway:n,derived:a,delta:o}}function ce(e,t){let n=t?C():x();return e===`agent`?{inheritedLabel:s(),resetLabel:y({value:n})}:e===`instance`?{inheritedLabel:o(),resetLabel:r({value:n})}:{}}function Y(e,t){let n=E(w.compat.forChat,e===null?`skip`:{chatId:e,...t?{routedAgent:t}:{}}),r=n==null?null:n.capabilities;return{can:(0,k.useCallback)(e=>ie(r,e),[r]),resolved:r!==null,loading:n===void 0,gatewayVersion:n?.gatewayVersion??null,provider:n?.provider??null,beyondValidated:n?.versionBeyondValidated===!0}}var X=n();function Z(e){let t=d(w.chats.setSessionKnob),[n,r]=(0,k.useState)(null),[i,a]=(0,k.useState)(null);return{apply:(0,k.useCallback)(async(n,i)=>{r(n),a(null);let o={chatId:e};n===`fastMode`?o.fastMode=i:n===`showReasoning`?o.showReasoning=i:o[n]=i;try{await t(o)}catch{a({field:n,value:i})}finally{r(null)}},[e,t]),pending:n,error:i}}function Q({label:e,overridden:t,onReset:n,pending:r,error:i,onRetry:a,help:o,children:s,resettable:c=!0,inheritedLabel:l,resetLabel:u}){return(0,X.jsxs)(`div`,{className:`oc-spanel__row${t?` is-overridden`:``}`,children:[(0,X.jsxs)(`div`,{className:`oc-spanel__rowhead`,children:[(0,X.jsx)(`span`,{className:`oc-spanel__label`,children:e}),r?(0,X.jsx)(te,{size:13,className:`oc-spanel__spin`,"aria-label":D()}):t?c?(0,X.jsx)(`button`,{type:`button`,className:`oc-spanel__reset`,title:u??O(),"aria-label":u??O(),onClick:n,children:(0,X.jsx)(ne,{size:12,"aria-hidden":!0})}):null:(0,X.jsx)(`span`,{className:`oc-spanel__badge`,children:l??p()})]}),(0,X.jsx)(`div`,{className:`oc-spanel__ctl`,children:s}),o?(0,X.jsx)(`p`,{className:`oc-spanel__help`,children:o}):null,i?(0,X.jsxs)(`p`,{className:`oc-spanel__error`,role:`alert`,children:[f(),(0,X.jsx)(`button`,{type:`button`,className:`oc-spanel__retry`,onClick:a,children:g()})]}):null]})}function le({options:e,value:t,onChange:n,ariaLabel:r,disabled:i}){return(0,X.jsx)(`div`,{className:`oc-spanel__seg`,role:`group`,"aria-label":r,children:e.map(e=>(0,X.jsx)(`button`,{type:`button`,className:`oc-spanel__seg-btn${t===e.id?` is-active`:``}`,"aria-pressed":t===e.id,title:e.title??e.label,"aria-label":e.title??e.label,disabled:i,onClick:()=>{e.id!==t&&n(e.id)},children:e.label},e.id))})}function ue({options:e,value:t,onChange:n,disabled:r,ariaLabel:i}){let a=t===null||e.some(e=>e.id===t);return(0,X.jsxs)(`select`,{className:`oc-spanel__select`,value:t??``,disabled:r,"aria-label":i,onChange:e=>{e.target.value&&e.target.value!==t&&n(e.target.value)},children:[t===null?(0,X.jsx)(`option`,{value:``,disabled:!0,children:`—`}):null,a?null:(0,X.jsx)(`option`,{value:t,children:t}),e.map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.label},e.id))]})}function $({field:e,options:t,value:n,onChange:r,disabled:i,ariaLabel:a}){return j(e,t.length)===`list`?(0,X.jsx)(ue,{options:t,value:n,onChange:r,disabled:i,ariaLabel:a}):(0,X.jsx)(le,{options:t,value:n,onChange:r,disabled:i,ariaLabel:a})}function de({chatId:e,sm:t,settings:n}){let{apply:r,pending:i,error:a}=Z(e),{can:o}=Y(e),s=i!==null,c=(0,k.useCallback)(()=>{a&&r(a.field,a.value)},[r,a]),u=t?.thinkingLevels??[],d=t?.availableModels??[],f=P(n),p=re(o,{hasModels:d.length>0,hasLevels:u.length>0,described:t!==null});return(0,X.jsxs)(X.Fragment,{children:[p.model?(0,X.jsx)(Q,{label:l(),overridden:M(n,`model`),onReset:()=>void r(`model`,null),pending:i===`model`,error:a?.field===`model`,onRetry:c,resettable:p.reset,children:(0,X.jsx)($,{field:`model`,options:d,value:t?.model??null,onChange:e=>void r(`model`,e),disabled:s,ariaLabel:l()})}):null,p.thinking?(0,X.jsx)(Q,{label:_(),overridden:M(n,`thinkingLevel`),onReset:()=>void r(`thinkingLevel`,null),pending:i===`thinkingLevel`,error:a?.field===`thinkingLevel`,onRetry:c,resettable:p.reset,children:(0,X.jsx)($,{field:`thinkingLevel`,ariaLabel:_(),options:u.map(e=>({id:e.id,label:B(e.id,R(e.label)),title:R(e.label)})),value:t?.thinkingLevel??null,onChange:e=>void r(`thinkingLevel`,e),disabled:s})}):null,(0,X.jsx)(fe,{chatId:e,overridden:M(n,`showReasoning`),onApply:e=>void r(`showReasoning`,e),pending:i===`showReasoning`,error:a?.field===`showReasoning`,onRetry:c,disabled:s}),p.speed?(0,X.jsx)(Q,{label:b(),overridden:M(n,`fastMode`),onReset:()=>void r(`fastMode`,null),pending:i===`fastMode`,error:a?.field===`fastMode`,onRetry:c,resettable:p.reset,children:(0,X.jsx)($,{field:`fastMode`,ariaLabel:b(),options:N.map(e=>({id:e,label:F(e)})),value:f,onChange:e=>void r(`fastMode`,I(e)),disabled:s})}):null]})}function fe({chatId:e,overridden:t,onApply:n,pending:r,error:i,onRetry:a,disabled:o}){let s=E(w.messages.getSessionMeta,{chatId:e}),c=s?.showReasoning===!0,{inheritedLabel:l,resetLabel:u}=ce(s?.showReasoningDefaultSource,s?.showReasoningDefault===!0);return(0,X.jsx)(Q,{label:v(),overridden:t,inheritedLabel:l,resetLabel:u,onReset:()=>n(null),pending:r,error:i,onRetry:a,help:T(),children:(0,X.jsx)($,{field:`showReasoning`,ariaLabel:v(),options:[{id:`on`,label:C()},{id:`off`,label:x()}],value:s==null?null:c?`on`:`off`,onChange:e=>n(e===`on`),disabled:o})})}export{R as a,K as c,ae as d,V as f,J as g,M as h,oe as i,se as l,L as m,de as n,q as o,U as p,Y as r,W as s,$ as t,G as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$k as r,BB as i,Bk as a,Gk as o,HB as s,Hk as c,Jk as l,Kk as u,MB as d,NB as f,Qk as p,UB as m,Uk as h,VB as g,Vk as _,Wk as ee,Xk as te,Yk as ne,Zk as v,eA as y,mV as b,qk as x,t as S,vQ as C}from"./api-jG5Fwsg4.js";import{n as w,t as T}from"./useNavigate-D3GIoxyW.js";import"./convexApi-DeaVGrsr.js";import{c as E,n as re,o as ie}from"./searchSchemas-Dm-Qg010.js";import{t as D}from"./appHost-CH3EGcJw.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-i1bbFYFv.js";import{n as N,t as P}from"./TimeRangePicker-BvcqBpnq.js";var F=t(e(),1),I={API_CALLS:`api.calls`,API_ERRORS:`api.errors`,API_LATENCY_AVG_MS:`api.latency.avg_ms`,OPENCLAW_INGEST:`openclaw.ingest`,CHAT_SEND:`chat.send`,ASSISTANT_STREAM_ERRORS:`assistant.stream.errors`,ASSISTANT_ANNOUNCE_ERRORS:`assistant.announce.errors`,CONVEX_PROBE_LATENCY_AVG_MS:`convex.probe.latency.avg_ms`},L=Object.keys(I).length,R=n(),z=15,B=e=>String(Math.round(e));function V(){let e=C(S.me.getMe,{host:D})?.permissions?.includes(`traces.read`)??!1,t=C(S.deliveryTiming.listDeliverySessions,e?{}:`skip`),n=(0,F.useMemo)(()=>t?t.filter(e=>!e.active&&e.rollup!==null&&e.rollup.cP50!==null&&e.rollup.aP50!==null).slice(0,z).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,R.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,R.jsx)(`h2`,{className:`oc-kpi__group-title`,children:b()}),(0,R.jsxs)(M,{children:[(0,R.jsxs)(O,{children:[(0,R.jsx)(A,{children:m()}),(0,R.jsx)(j,{children:g()})]}),(0,R.jsx)(k,{children:n.length<2?(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):(0,R.jsx)(H,{series:n})})]})]})}function H({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),r=Math.max(1,...t,...n),i=t=>6+t*468/(e.length-1),a=e=>74-e*68/r,o=e=>e.map((e,t)=>`${t===0?`M`:`L`}${i(t).toFixed(1)},${a(e).toFixed(1)}`).join(` `),c=e[e.length-1];return(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,R.jsxs)(`span`,{style:{color:`var(--primary)`},children:[d(),` p50 `,B(c.cP50),` `,s()]}),(0,R.jsxs)(`span`,{children:[f(),` p50 `,B(c.aP50),` `,s()]})]}),(0,R.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":m(),children:[(0,R.jsx)(`path`,{d:o(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,R.jsx)(`path`,{d:o(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var U=[{metric:`api.calls`,label:y(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:r(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:p(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:v(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:te(),unit:`/h`,group:`Chat`,isError:!1},{metric:I.ASSISTANT_STREAM_ERRORS,label:ne(),unit:`/h`,group:`Assistant`,isError:!0},{metric:I.ASSISTANT_ANNOUNCE_ERRORS,label:l(),unit:`/h`,group:`Assistant`,isError:!0}],W=L,G=[`API`,`OpenClaw`,`Chat`,`Assistant`],K=1e3,q=36e5;function J(e,t){let n=Math.max(1,Math.ceil((t-e)/q)),r=Math.min(n*W,K);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/W))}}function ae(){let e=w({from:`/settings/kpi`}),t=T({from:`/settings/kpi`}),n=ie(e.from,e.to,re,`now`),r=e=>void t({search:t=>({...t,...E(e)})}),{from:i,to:a}=N(n),{rowLimit:s,buckets:c}=J(i,a),l=C(S.kpi.listKpis,{limit:s,filter:{from:i,to:a}}),d=(0,F.useMemo)(()=>{let e=new Map;for(let t of l??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>c&&e.set(t,n.slice(n.length-c));return e},[l,c]),f=(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`p`,{className:`oc-admin__hint`,children:[x(),` `,(0,R.jsx)(`span`,{className:`oc-filter__window`,children:u()})]}),(0,R.jsx)(Y,{value:n,onChange:r})]});return l===void 0?(0,R.jsxs)(R.Fragment,{children:[f,(0,R.jsx)(V,{}),(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:o()})]}):l.length===0?(0,R.jsxs)(R.Fragment,{children:[f,(0,R.jsx)(V,{}),(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:ee()})]}):(0,R.jsxs)(R.Fragment,{children:[f,(0,R.jsx)(V,{}),G.map(e=>{let t=U.filter(t=>t.group===e);return t.some(e=>(d.get(e.metric)??[]).length>0)?(0,R.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,R.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,R.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,R.jsx)(oe,{config:e,series:d.get(e.metric)??[]},e.metric))})]},e):null})]})}function Y({value:e,onChange:t}){return(0,R.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,R.jsx)(P,{value:e,onChange:t})})}function oe({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,R.jsxs)(M,{size:`sm`,className:`oc-kpi__card`,children:[(0,R.jsxs)(O,{children:[(0,R.jsx)(A,{className:`oc-kpi__card-title`,children:e.label}),(0,R.jsx)(j,{className:`oc-kpi__card-metric`,children:(0,R.jsx)(`code`,{children:e.metric})})]}),(0,R.jsxs)(k,{className:`oc-kpi__card-body`,children:[(0,R.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,R.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,R.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,R.jsx)(ce,{series:t,isError:e.isError,unit:e.unit}),(0,R.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,R.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:h({value:$(n.bucket)})}):(0,R.jsx)(`span`,{className:`oc-kpi__muted`,children:c()}),(0,R.jsx)(`span`,{className:`oc-kpi__muted`,children:_({count:t.length})})]})]})]})}var X=240,Z=48,se=1;function ce({series:e,isError:t,unit:n}){if(e.length===0)return(0,R.jsx)(`div`,{className:`oc-kpi__chart oc-kpi__chart--empty`,"aria-hidden":!0});let r=e.reduce((e,t)=>t.value>e?t.value:e,0),i=X/e.length,o=Math.max(i-se,1);return(0,R.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":a({max:Q(r),unit:n}),children:e.map((e,a)=>{let s=r>0?e.value/r*(Z-1):0,c=a*i,l=Z-s;return(0,R.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:o,height:s,children:(0,R.jsxs)(`title`,{children:[$(e.bucket),` · `,Q(e.value),` `,n]})},e.bucket)})})}function Q(e){return Number.isFinite(e)?Math.abs(e)>=1e3?(e/1e3).toFixed(e%1e3==0?0:1)+`k`:String(e):`0`}function $(e){let t=new Date(`${e}:00:00Z`);return Number.isNaN(t.getTime())?e:`${String(t.getUTCDate()).padStart(2,`0`)}/${String(t.getUTCMonth()+1).padStart(2,`0`)} ${String(t.getUTCHours()).padStart(2,`0`)}h`}export{ae as KpiTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$K as r,$Z as i,AK as a,AZ as o,BK as s,BZ as c,CK as l,DK as u,Dl as d,EK as f,FK as p,FZ as ee,GK as m,GZ as te,HK as h,HZ as ne,IK as g,IZ as re,JK as ie,JZ as ae,KK as oe,KZ as se,LK as ce,LZ as le,MK as _,MZ as ue,NK as de,NZ as fe,OK as pe,Ol as me,PK as he,PZ as v,QK as y,QZ as b,RK as x,RZ as S,Sl as C,TK as w,UK as T,UZ as E,VK as D,VZ as O,WK as k,WZ as A,XK as j,XZ as M,YK as N,YZ as P,ZK as F,ZZ as I,_Q as L,aq as R,cl as ge,cq as _e,dl as ve,eq as ye,fl as be,iq as xe,jK as Se,jZ as Ce,kK as we,kL as Te,ll as Ee,ml as De,nQ as Oe,nq as ke,oq as Ae,pl as je,qK as Me,qZ as Ne,rq as Pe,sQ as Fe,sl as Ie,sq as Le,t as z,tq as Re,ul as ze,vQ as B,wK as Be,zK as Ve,zZ as He}from"./api-jG5Fwsg4.js";import{t as V}from"./checkbox-U99HMqP3.js";import{a as Ue,i as We,n as Ge,r as H,t as Ke}from"./select-DGKgMOlh.js";import{t as U}from"./button-sV7hIR3f.js";import{t as W}from"./input-DReDYsos.js";import"./convexApi-DeaVGrsr.js";import{c as qe,d as Je,r as Ye,t as Xe,u as Ze}from"./useFontScale-DCa0acMC.js";import{r as Qe}from"./toast-daONdZpX.js";import{t as G}from"./badge-CSm2xaYH.js";import{t as K}from"./appHost-CH3EGcJw.js";import{t as $e}from"./localePickerView-C2RmOS86.js";import{t as et}from"./switch-D-QGMGm7.js";import{t as tt}from"./TimezoneCombobox-BUC66FuM.js";var q=t(e(),1),J=[{id:`messages`,label:()=>_e()},{id:`composer`,label:()=>Le()},{id:`sidebar`,label:()=>Ae()},{id:`notifications`,label:()=>T()},{id:`other`,label:()=>R()}],Y={showSource:{category:`messages`,label:()=>xe(),help:()=>Pe()},showReport:{category:`messages`,label:()=>ke(),help:()=>Re()},copyAssistant:{category:`messages`,label:()=>ye()},copyUser:{category:`messages`,label:()=>r()},showDelete:{category:`messages`,label:()=>y()},showTools:{category:`messages`,label:()=>F(),help:()=>j()},voiceInput:{category:`composer`,label:()=>N(),help:()=>ie()},showUsage:{category:`composer`,label:()=>Me(),help:()=>oe()},autoReadAloud:{category:`composer`,label:()=>me(),help:()=>d()},showChatAge:{category:`sidebar`,label:()=>m(),help:()=>k()},notifSound:{category:`notifications`,label:()=>h(),help:()=>D()},notifSystem:{category:`notifications`,label:()=>s(),help:()=>Ve()},replySound:{category:`notifications`,label:()=>x(),help:()=>ce()}};function X(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function nt(e,t){let n=X(t.trim()),r=new Map(J.map(e=>[e.id,e.label()])),i=new Map(J.map(e=>[e.id,[]]));for(let t of e){let e=Y[t],a=e?.category??`other`;n&&!X(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return J.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var rt=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showUsage`,`autoReadAloud`,`notifSound`,`notifSystem`,`replySound`],it={voiceInput:`voiceInput`};function at(e){return rt.includes(e)}function Z(e){return e===`admin`}function Q(e){return e===!0?`on`:e===!1?`off`:`inherit`}function ot(e){return e===`on`||e!==`off`&&null}function st(e){return at(e)?it[e]:void 0}var $=n(),ct={voiceInput:()=>u()};function lt({prefKey:e,ui:t}){let n=L(z.admin.setUiPrefDefault),r=L(z.admin.setFeatureEnabled),i=st(e),o=i?ct[e]?.():void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,$.jsx)(`span`,{className:`oc-prefs__gov-label`,children:Se()}),(0,$.jsxs)(Ke,{value:Q(t.defaults[e]),onValueChange:t=>void n({key:e,value:ot(t)}),children:[(0,$.jsx)(We,{size:`sm`,className:`w-36`,children:(0,$.jsx)(Ue,{})}),(0,$.jsxs)(Ge,{children:[(0,$.jsx)(H,{value:`on`,children:w()}),(0,$.jsx)(H,{value:`off`,children:Be()}),(0,$.jsx)(H,{value:`inherit`,children:l()})]})]}),i?(0,$.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,$.jsx)(V,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":a()}),a()]}):null]}),o?(0,$.jsx)(`span`,{className:`oc-prefs__gov-help`,children:o}):null]})}function ut({current:e,enabled:t}){let n=L(z.me.setDictationShortcut),[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){i(!1);return}let t=Ze(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(o(!0),window.setTimeout(()=>o(!1),1800));return}i(!1),n({shortcut:t})};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[r,n]),(0,$.jsxs)(`div`,{className:`oc-prefs__row${t?``:` is-locked`}`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,$.jsxs)(`span`,{className:`oc-prefs__label`,children:[De(),e?(0,$.jsx)(G,{variant:`secondary`,children:Je(e,qe())}):null]}),(0,$.jsx)(`span`,{className:`oc-prefs__help`,children:a?ve():r?be():je()})]}),(0,$.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[e&&!r?(0,$.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void n({shortcut:null}),children:Ie()}):null,(0,$.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>i(e=>!e),children:r?ge():e?Ee():ze()})]})]})}function dt(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=B(z.me.getMe,{host:K}),a=i?.ui,o=Z(i?.role)&&n,s=L(z.me.setUiPref).withOptimisticUpdate(Ye),c=(0,q.useMemo)(()=>a?nt(Object.keys(a.effective),e):[],[a,e]);return a?(0,$.jsxs)(`div`,{className:`oc-prefs-panel`,children:[Z(i?.role)?(0,$.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,$.jsx)(V,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":_()}),_()]}):null,o?(0,$.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,$.jsx)(`p`,{children:we()}),(0,$.jsx)(`p`,{children:pe()}),(0,$.jsx)(`p`,{children:f()})]}):null,(0,$.jsx)(W,{value:e,onChange:e=>t(e.target.value),placeholder:g(),"aria-label":g(),className:`mb-2`}),c.length===0?(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:p()}):(0,$.jsx)(`div`,{className:`oc-prefs`,children:c.map(e=>(0,$.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,$.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=Y[e],n=t?t.label():e,r=t?.help?.(),i=a.locked[e],c=a.effective[e],l=a.userOverrides[e]!==void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,$.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,$.jsx)(G,{variant:`outline`,children:he()}):l?(0,$.jsx)(G,{variant:`secondary`,children:C()}):null]}),r?(0,$.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,$.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,$.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void s({key:e,value:null}),children:de()}):null,(0,$.jsx)(et,{checked:c,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),s({key:e,value:t})},"aria-label":n})]}),o?(0,$.jsx)(lt,{prefKey:e,ui:a}):null]},e)})]},e.id))}),(0,$.jsx)(ut,{current:i?.dictationShortcut??null,enabled:a.effective.voiceInput===!0})]}):(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:Fe()})}var ft={sm:()=>O(),md:()=>c(),lg:()=>He(),xl:()=>S(),"2xl":()=>le(),"3xl":()=>re()};function pt(){let e=B(z.me.getMe,{host:K}),t=L(z.me.setLocale),n=L(z.me.setTimezone),r=L(z.me.setFontScale).withOptimisticUpdate((e,{scale:t})=>{let n=e.getQuery(z.me.getMe,{host:K});n&&e.setQuery(z.me.getMe,{host:K},{...n,fontScale:t,resolvedFontScale:t??`md`})}),a=L(z.me.setMyName),s=Qe(),c=e?.locale??`default`,l=e?.name??``,[u,d]=(0,q.useState)(null),f=u??l,p=f.trim()!==l.trim();async function m(){try{await a({name:f}),d(null),s.success(P())}catch(e){s.error(ae(),e)}}return(0,$.jsxs)(`div`,{className:`oc-appearance`,children:[(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:i()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:b()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[(0,$.jsx)(W,{className:`max-w-xs`,value:f,maxLength:120,placeholder:I(),onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&p&&(e.preventDefault(),m())}}),(0,$.jsx)(U,{size:`sm`,disabled:!p,onClick:()=>void m(),children:Te()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:M()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:Ne()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:se()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[$e().map(e=>(0,$.jsx)(U,{variant:c===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,$.jsx)(U,{variant:c==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:Oe()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:te()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:ee()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:v()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[(0,$.jsx)(tt,{value:e?.timezone??``,onChange:e=>void n({timezone:e})}),(0,$.jsx)(U,{variant:e?.timezone===null||e?.timezone===void 0?`default`:`outline`,size:`sm`,onClick:()=>void n({timezone:null}),children:fe()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:ue()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:A()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:E()})]}),(0,$.jsx)(`div`,{className:`oc-show__row`,children:Xe.map(t=>(0,$.jsx)(U,{variant:(e?.fontScale??`md`)===t?`default`:`outline`,size:`sm`,onClick:()=>void r({scale:t}),children:ft[t]()},t))}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:ne()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:Ce()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:o()})]}),(0,$.jsx)(dt,{})]})]})}export{pt as PreferencesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$O as r,AO as i,BO as a,CO as o,Ck as s,FO as c,Fs as l,GO as u,HO as d,IO as f,JO as p,KO as m,LO as h,MO as ee,PD as g,PO as _,Ps as v,QO as te,RO as ne,Sk as re,TO as ie,UO as ae,VO as oe,WO as y,XO as se,YO as b,_O as ce,_Q as x,_k as le,bO as S,ck as ue,ek as de,gO as fe,gk as C,hO as pe,ik as me,jO as he,k as w,kO as ge,lT as _e,mO as T,mk as ve,nk as ye,pk as be,qO as xe,sQ as E,sk as Se,t as D,tk as Ce,uQ as we,uk as Te,vO as Ee,vQ as O,xO as k,xk as De,yO as A,zO as Oe}from"./api-jG5Fwsg4.js";import{n as ke,t as j}from"./useNavigate-D3GIoxyW.js";import{A as Ae,B as M,C as N,D as je,E as P,F,G as Me,H as Ne,I,J as Pe,K as Fe,R as Ie,S as L,T as Le,U as Re,V as ze,W as R,_ as Be,a as z,f as B,h as Ve,i as He,j as Ue,m as We,n as Ge,o as Ke,p as V,r as qe,s as H,t as Je,u as Ye,w as Xe,x as Ze,y as Qe,z as $e}from"./useStartNewChat-BatYRWH7.js";import{r as et}from"./dist-Bxf4XoMW.js";import{t as tt}from"./chevron-right-DbysoSJS.js";import{c as nt,g as rt,i as it,n as at,r as U,s as ot,t as st}from"./dropdown-menu-yCbwljS-.js";import{n as ct,t as lt}from"./eye-CZuTJsZX.js";import{t as ut}from"./list-kKcfLqpz.js";import{t as dt}from"./pencil-C_IJUeJn.js";import{t as ft}from"./trash-2-UxV-pTWt.js";import{t as W}from"./button-sV7hIR3f.js";import{t as pt}from"./input-DReDYsos.js";import"./convexApi-DeaVGrsr.js";import{r as mt}from"./toast-daONdZpX.js";import{n as ht,r as gt}from"./ConfirmDialog-BmOX8o6F.js";import{t as _t}from"./EntitySheet-BXEY6TCb.js";import{r as vt,t as yt}from"./measureClone-CHN0WNEY.js";import{r as bt,t as xt}from"./trashView-CrjCfgVT.js";var St=w(`columns-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),Ct=w(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),wt=w(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),G=w(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),K=t(e(),1),q=n();function Tt({className:e}){return(0,q.jsx)(nt,{asChild:!0,children:(0,q.jsx)(W,{variant:`ghost`,size:`icon-xs`,"aria-label":k(),className:e,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,q.jsx)(rt,{})})})}function Et({folderId:e,name:t,color:n,currentParentId:r,className:i,onOpen:a}){let c=x(D.projects.renameProject),l=x(D.projects.setProjectColor),u=x(D.projects.moveProject),d=x(D.projects.deleteProject),f=x(D.projects.createProject),p=ht(),m=bt(),h=gt(),[ee,g]=(0,K.useState)(!1),[_,v]=(0,K.useState)(t),[te,ne]=(0,K.useState)(!1),[ie,ae]=(0,K.useState)(!1),oe=O(D.projects.projectTreeCount,ie?{projectId:e}:`skip`);return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(st,{onOpenChange:e=>e&&ae(!0),children:[(0,q.jsx)(Tt,{className:i}),(0,q.jsxs)(at,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[(0,q.jsxs)(U,{onSelect:()=>a(),children:[(0,q.jsx)(Fe,{}),` `,me()]}),(0,q.jsxs)(U,{onSelect:()=>{v(t),g(!0)},children:[(0,q.jsx)(dt,{}),` `,S()]}),(0,q.jsxs)(U,{onSelect:()=>{requestAnimationFrame(async()=>{let t=await h({title:b(),label:s(),placeholder:re(),confirmLabel:De()});t&&await f({name:t,parentId:e})})},children:[(0,q.jsx)(Me,{}),` `,b()]}),(0,q.jsxs)(U,{onSelect:()=>ne(!0),children:[(0,q.jsx)(Ct,{}),` `,he()]}),(0,q.jsx)(it,{children:ce()}),(0,q.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,q.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void l({projectId:e,color:null}),"aria-label":fe(),children:`✕`}),He.map(t=>(0,q.jsx)(`button`,{className:`oc-colorgrid__dot`+(n===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void l({projectId:e,color:t.value})},t.value))]}),(0,q.jsx)(ot,{}),(0,q.jsxs)(U,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let n=oe?.folders??0,r=oe?.chats??0;await p({title:Se({name:t}),description:xt({folders:n,chats:r,days:m}),confirmWord:o(),confirmLabel:ue(),destructive:!0})&&await d({projectId:e})})},children:[(0,q.jsx)(ft,{}),` `,o()]})]})]}),(0,q.jsx)(_t,{open:ee,onOpenChange:g,title:be(),canSubmit:_.trim().length>0,onSubmit:async()=>{await c({projectId:e,name:_.trim()}),g(!1)},submitLabel:S(),children:(0,q.jsx)(pt,{value:_,onChange:e=>v(e.target.value),autoFocus:!0})}),te?(0,q.jsx)(qe,{open:te,onOpenChange:ne,title:ge(),movingFolderId:e,currentId:r,onPick:t=>void u({projectId:e,parentId:t})}):null]})}function J({chat:e,currentFolderId:t,className:n}){let r=x(D.chats.pinChat),a=x(D.chats.deleteChat),s=x(D.chats.renameChat),c=x(D.chats.setChatSidebar),l=x(D.chats.moveChatToProject),u=ht(),d=bt(),[f,p]=(0,K.useState)(!1),[m,h]=(0,K.useState)(e.title??``),[_,v]=(0,K.useState)(!1);return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(st,{children:[(0,q.jsx)(Tt,{className:n}),(0,q.jsxs)(at,{align:`end`,className:`w-52`,onClick:e=>e.stopPropagation(),children:[(0,q.jsxs)(U,{onSelect:()=>{h(e.title??``),p(!0)},children:[(0,q.jsx)(dt,{}),` `,S()]}),(0,q.jsxs)(U,{onSelect:()=>void r({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,q.jsx)($e,{}):(0,q.jsx)(M,{}),e.pinned?A():Ee()]}),(0,q.jsxs)(U,{onSelect:()=>v(!0),children:[(0,q.jsx)(Ct,{}),` `,ee()]}),e.pinned&&e.inSidebar?null:(0,q.jsxs)(U,{onSelect:()=>void c({chatId:e._id,hidden:e.inSidebar}),children:[e.inSidebar?(0,q.jsx)(ze,{}):(0,q.jsx)(G,{}),e.inSidebar?Ce():ye()]}),(0,q.jsx)(ot,{}),(0,q.jsxs)(U,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await u({title:pe(),description:T({days:d}),confirmLabel:o(),destructive:!0})&&await a({chatId:e._id})})},children:[(0,q.jsx)(ft,{}),` `,o()]})]})]}),(0,q.jsx)(_t,{open:f,onOpenChange:p,title:g(),canSubmit:m.trim().length>0,onSubmit:async()=>{await s({chatId:e._id,title:m.trim()}),p(!1)},submitLabel:S(),children:(0,q.jsx)(pt,{value:m,onChange:e=>h(e.target.value),autoFocus:!0})}),_?(0,q.jsx)(qe,{open:_,onOpenChange:v,title:i(),currentId:t,onPick:t=>void l({chatId:e._id,projectId:t})}):null]})}function Dt(e,t){let n=t.trim().toLowerCase();return n===``?e:e.filter(e=>(e.title??``).toLowerCase().includes(n))}function Ot(e,t,n,r,i){let a=e.map(t),o=a.indexOf(i);if(o<0)return null;let s=a.indexOf(r);if(s>=0){let t=[...e],[r]=t.splice(s,1);t.splice(o,0,r);let i=t[o-1],a=t[o+1];return{prevKey:i===void 0?null:n(i),nextKey:a===void 0?null:n(a)}}let c=e[o-1];return{prevKey:c===void 0?null:n(c),nextKey:n(e[o])}}function kt(e,t){let n=new Map(t.map(e=>[e.chatId,e.lastSeenAt])),r=new Set;for(let t of e){let e=n.get(t._id);e!==void 0&&t.lastAssistantAt!==null&&t.lastAssistantAt>e&&r.add(t._id)}return r}function At(e,t){return{available:e,required:[t]}}function jt(e){return{labels:e===0,moved:e>=2}}var Mt=`oc.projpage.view`;function Nt(){let e=localStorage.getItem(Mt);return e===`cards`||e===`list`?e:`columns`}var Y=e=>`into:${e}`,Pt=e=>`col:${e??`null`}`,Ft=e=>`crumb:${e}`;function It(e){if(e.startsWith(`into:`))return e.slice(5);if(e.startsWith(`crumb:`))return e.slice(6);if(e.startsWith(`col:`)){let t=e.slice(4);return t===`null`?null:t}}function X(){let{projectId:e}=Pe({from:`/project/$projectId`}),t=j(),n=O(D.projects.projectPage,{projectId:e});return(0,q.jsx)(`div`,{className:`oc-projpage`,children:n===void 0?(0,q.jsx)(`p`,{className:`oc-projpage__hint`,children:E()}):n===null?(0,q.jsxs)(`div`,{className:`oc-projpage__notfound`,children:[(0,q.jsx)(`h2`,{children:h()}),(0,q.jsx)(`p`,{className:`oc-projpage__hint`,children:f()}),(0,q.jsx)(W,{variant:`outline`,onClick:()=>void t({to:`/`}),children:c()})]}):(0,q.jsx)(Lt,{page:n})})}function Lt({page:e}){let t=j(),n=ht(),i=bt(),c=gt(),d=mt(),f=x(D.projects.renameProject),p=x(D.projects.setProjectColor),h=x(D.projects.deleteProject),ee=x(D.projects.createProject),g=x(D.projects.moveProject),ae=x(D.projects.setProjectSidebar),C=x(D.chats.moveChatToProject),pe=x(D.chats.reorderChat),me=x(D.projects.reorderProject),w=O(D.projects.projectTreeCount,{projectId:e.project._id}),[T,ye]=(0,K.useState)(Nt),xe=(0,K.useRef)(null),E=(0,K.useRef)(null),Ce=jt(vt(()=>{let e=xe.current,t=E.current;if(e===null||t===null)return null;let n=yt(t,[e=>{e.setAttribute(`data-labels`,`on`),e.setAttribute(`data-moved`,`off`)},e=>{e.setAttribute(`data-labels`,`off`),e.setAttribute(`data-moved`,`off`)}],`oc-projpage__actions--measure`);return{available:e.clientWidth,required:n}},()=>[xe.current],[we(),e.project.sidebarHidden],{hysteresis:24})),Te=Ce.moved,Ee=e=>{localStorage.setItem(Mt,e),ye(e)},k=O(D.projects.folderColumns,T===`columns`?{projectId:e.project._id}:`skip`),A=O(D.projects.projectTreeList,T===`list`?{projectId:e.project._id}:`skip`),{c:M}=ke({from:`/project/$projectId`}),N=O(D.projects.listProjects,{}),P=O(D.chatReads.myBusyChats,{}),I=(0,K.useMemo)(()=>new Set(P??[]),[P]),{byChat:Pe}=Ie(P??null),Fe=O(D.chatReads.myChatReads,{}),ze=(0,K.useMemo)(()=>kt(e.chats,Fe??[]),[e.chats,Fe]),z=(0,K.useRef)(null),B=()=>[z.current],{startNewChat:Ge,picker:$e}=Je(e=>void t({to:`/chat/$chatId`,params:{chatId:e}}),B),et=()=>void Ge({projectId:e.project._id}),tt=async()=>{let t=await c({title:b(),label:s(),placeholder:re(),confirmLabel:De(),returnFocus:B});t&&await ee({name:t,parentId:e.project._id})},[G,Tt]=(0,K.useState)(``),[Et,J]=(0,K.useState)(!1),[At,Y]=(0,K.useState)(e.project.name),[Pt,Ft]=(0,K.useState)(!1),[X,Lt]=(0,K.useState)(``);(0,K.useEffect)(()=>{let e=setTimeout(()=>Lt(G.trim()),180);return()=>clearTimeout(e)},[G]);let Z=O(D.search.searchConversations,X.length>=2?{query:X,projectId:e.project._id}:`skip`),Vt=Le(Xe(Be,{activationConstraint:{distance:4}}),Xe(Qe,{activationConstraint:{delay:250,tolerance:8}})),Q=(0,K.useRef)(!1),Ut=()=>{Q.current=!0,setTimeout(()=>{Q.current=!1},0)},[$,Gt]=(0,K.useState)(null),Kt=t=>{if(t.startsWith(`chat:`)){let n=t.slice(5),r=e.chats.find(e=>e._id===n),i=k?.columns.flatMap(e=>e.chats).find(e=>e._id===n);return{kind:`chat`,label:(r??i)?.title||le()}}if(t.startsWith(`folder:`)){let e=t.slice(7);return{kind:`folder`,label:(N??[]).find(t=>t._id===e)?.name??``}}return null},qt=e=>Gt(Kt(String(e.active.id))),Jt=(0,K.useCallback)(e=>{let t=String(e.active.id).startsWith(`folder:`),n=t=>({...e,droppableContainers:e.droppableContainers.filter(e=>String(e.id).startsWith(t))}),r=L(n(`into:`));if(r.length>0){if(!t)return r;let n=r[0],i=e.droppableRects.get(n.id),a=e.pointerCoordinates?.y;if(i&&a!=null){let e=i.height*.3;if(a>i.top+e&&a<i.top+i.height-e)return r}}let i=L(n(t?`folder:`:`chat:`));if(i.length>0)return i;let a=L(n(`crumb:`));if(a.length>0)return a;let o=L(n(`col:`));return o.length>0?o:Ze(n(t?`folder:`:`chat:`))},[]),Yt=t=>{if(T===`columns`){for(let e of k?.columns??[])if(e.chats.some(e=>e._id===t))return{list:e.chats,folderId:e.folderId};return null}if(T===`list`){let e=A?.chats.find(e=>e._id===t);return e?{list:A.chats.filter(t=>t.folderId===e.folderId),folderId:e.folderId}:null}return e.chats.some(e=>e._id===t)?{list:e.chats,folderId:e.project._id}:null},Xt=t=>{if(T===`columns`){for(let e of k?.columns??[])if(e.folders.some(e=>e._id===t))return{list:e.folders,parentId:e.folderId};return null}if(T===`list`){let e=A?.folders.find(e=>e._id===t);if(!e||!A)return null;let n=e.parentId??A.rootId;return{list:Ue(A.folders,e.parentId),parentId:n}}return e.children.some(e=>e._id===t)?{list:e.children,parentId:e.project._id}:null},Zt=async e=>{Gt(null),Ut();let{active:t,over:n}=e;if(!n)return;let r=String(n.id),i=String(t.id),a=i.startsWith(`chat:`);try{let e=It(r);if(e!==void 0){if(a){let t=i.slice(5);await C({chatId:t,projectId:e})}else{let t=i.slice(7);if(t===e)return;if(!Ae(N??[],t,e)){d.error(se());return}await g({projectId:t,parentId:e})}return}if(a&&r.startsWith(`chat:`)){let e=i.slice(5),t=r.slice(5);if(e===t)return;let n=Yt(t);if(!n)return;n.list.some(t=>t._id===e)||await C({chatId:e,projectId:n.folderId});let a=Ot(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await pe({chatId:e,...a});return}if(!a&&r.startsWith(`folder:`)){let e=i.slice(7),t=r.slice(7);if(e===t)return;let n=Xt(t);if(!n)return;if(!n.list.some(t=>t._id===e)){if(!Ae(N??[],e,n.parentId)){d.error(se());return}await g({projectId:e,parentId:n.parentId})}let a=Ot(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await me({projectId:e,...a});return}}catch{d.error(se())}},[,Qt]=(0,K.useState)(0);(0,K.useEffect)(()=>{let e=window.setInterval(()=>Qt(e=>e+1),6e4);return()=>window.clearInterval(e)},[]);let $t=Date.now(),en=Ke(e.project),tn=Dt(e.chats,G),nn=e.breadcrumb.slice(0,-1),rn=e=>()=>{Q.current||e()};return(0,q.jsx)(F.Provider,{value:Pe,children:(0,q.jsxs)(We,{sensors:Vt,collisionDetection:Jt,onDragStart:qt,onDragEnd:Zt,children:[(0,q.jsxs)(`div`,{className:`oc-projpage__body`,style:{"--proj-hue":en},children:[(0,q.jsxs)(`nav`,{className:`oc-projpage__crumbs`,"aria-label":_(),children:[nn.map(e=>(0,q.jsxs)(`span`,{className:`oc-projpage__crumb`,children:[(0,q.jsx)(Rt,{folderId:e._id,children:(0,q.jsx)(`button`,{type:`button`,className:`oc-projpage__crumblink`,onClick:rn(()=>void t({to:`/project/$projectId`,params:{projectId:e._id}})),children:e.name})}),(0,q.jsx)(`span`,{className:`oc-projpage__crumbsep`,"aria-hidden":!0,children:`›`})]},e._id)),(0,q.jsx)(`span`,{className:`oc-projpage__crumbcur`,children:e.project.name})]}),(0,q.jsxs)(`header`,{ref:xe,className:`oc-projpage__head`,children:[(0,q.jsxs)(`div`,{className:`oc-projpage__titlebox`,children:[(0,q.jsx)(`span`,{className:`oc-projpage__dot`,"aria-hidden":!0}),(0,q.jsx)(`h1`,{className:`oc-projpage__title`,children:e.project.name})]}),e.project.sidebarHidden?(0,q.jsxs)(W,{variant:`ghost`,size:`sm`,className:`oc-projpage__hiddenbadge`,title:l(),onClick:()=>{ae({projectId:e.project._id,hidden:!1})},children:[(0,q.jsx)(ct,{"aria-hidden":!0}),(0,q.jsx)(`span`,{children:v()}),(0,q.jsx)(lt,{"aria-hidden":!0})]}):null,(0,q.jsxs)(`div`,{ref:E,className:`oc-projpage__actions`,"data-labels":Ce.labels?`on`:`off`,"data-moved":Te?`on`:`off`,children:[(0,q.jsxs)(`div`,{className:`oc-projpage__viewtoggle`,role:`group`,"aria-label":de(),children:[(0,q.jsx)(W,{variant:T===`cards`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":de(),title:de(),"aria-pressed":T===`cards`,onClick:()=>Ee(`cards`),children:(0,q.jsx)(wt,{})}),(0,q.jsx)(W,{variant:T===`columns`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":r(),title:r(),"aria-pressed":T===`columns`,onClick:()=>Ee(`columns`),children:(0,q.jsx)(St,{})}),(0,q.jsx)(W,{variant:T===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":te(),title:te(),"aria-pressed":T===`list`,onClick:()=>Ee(`list`),children:(0,q.jsx)(ut,{})})]}),(0,q.jsxs)(W,{variant:`outline`,size:`sm`,className:`oc-projpage__actbtn`,"aria-label":y(),title:y(),onClick:et,children:[(0,q.jsx)(Re,{}),(0,q.jsx)(`span`,{className:`oc-projpage__actlabel`,children:y()})]}),(0,q.jsxs)(W,{variant:`outline`,size:`sm`,className:`oc-projpage__actbtn`,"aria-label":b(),title:b(),onClick:()=>void tt(),children:[(0,q.jsx)(Me,{}),(0,q.jsx)(`span`,{className:`oc-projpage__actlabel`,children:b()})]}),(0,q.jsxs)(st,{children:[(0,q.jsx)(nt,{asChild:!0,children:(0,q.jsx)(W,{ref:z,variant:`ghost`,size:`icon-sm`,"aria-label":ve(),children:(0,q.jsx)(rt,{})})}),(0,q.jsxs)(at,{align:`end`,className:`w-48`,children:[Te?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(U,{onSelect:et,children:[(0,q.jsx)(Re,{}),` `,y()]}),(0,q.jsxs)(U,{onSelect:()=>void tt(),children:[(0,q.jsx)(Me,{}),` `,b()]}),(0,q.jsx)(ot,{})]}):null,(0,q.jsxs)(U,{onSelect:()=>{Y(e.project.name),J(!0)},children:[(0,q.jsx)(dt,{}),` `,S()]}),(0,q.jsxs)(U,{onSelect:()=>Ft(!0),children:[(0,q.jsx)(Ct,{}),` `,he()]}),(0,q.jsx)(it,{children:ce()}),(0,q.jsxs)(`div`,{className:`oc-colorgrid`,children:[(0,q.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void p({projectId:e.project._id,color:null}),"aria-label":fe(),children:`✕`}),He.map(t=>(0,q.jsx)(`button`,{className:`oc-colorgrid__dot`+(e.project.color===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void p({projectId:e.project._id,color:t.value})},t.value))]}),(0,q.jsx)(ot,{}),(0,q.jsxs)(U,{variant:`destructive`,onSelect:()=>{let r=e.project.parentId;requestAnimationFrame(async()=>{let a=w?.folders??0,s=w?.chats??0;await n({title:Se({name:e.project.name}),description:xt({folders:a,chats:s,days:i}),confirmWord:o(),confirmLabel:ue(),destructive:!0})&&(await h({projectId:e.project._id}),t(r===null?{to:`/`}:{to:`/project/$projectId`,params:{projectId:r}}))})},children:[(0,q.jsx)(ft,{}),` `,o()]})]})]})]})]}),T===`columns`?(0,q.jsx)(Wt,{data:k,currentId:e.project._id,busyIds:I,suppressClick:Q,locateChatId:M??null}):T===`list`?(0,q.jsx)(Ht,{data:A,busyIds:I,suppressClick:Q,locateChatId:M??null}):(0,q.jsxs)(q.Fragment,{children:[e.children.length>0?(0,q.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,q.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:m()}),(0,q.jsx)(`div`,{className:`oc-projpage__cards`,children:(0,q.jsx)(H,{items:e.children.map(e=>`folder:${e._id}`),strategy:Ye,children:e.children.map(t=>(0,q.jsx)(zt,{child:t,parentId:e.project._id,now:$t,suppressClick:Q},t._id))})})]}):null,(0,q.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,q.jsxs)(`div`,{className:`oc-projpage__convhead`,children:[(0,q.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:u()}),e.chats.length>0?(0,q.jsx)(pt,{value:G,onChange:e=>Tt(e.target.value),placeholder:oe(),className:`oc-projpage__filter`}):null]}),e.chats.length===0?(0,q.jsx)(`p`,{className:`oc-projpage__hint`,children:e.children.length===0?Oe():ne()}):tn.length===0&&(Z??[]).length===0?(0,q.jsx)(`p`,{className:`oc-projpage__hint`,children:a({term:G.trim()})}):(0,q.jsx)(`ul`,{className:`oc-projpage__chats`,children:(0,q.jsx)(H,{items:tn.map(e=>`chat:${e._id}`),strategy:V,children:tn.map(t=>(0,q.jsx)(Bt,{chat:t,currentFolderId:e.project._id,now:$t,busy:I.has(t._id),unread:ze.has(t._id),locate:t._id===M,suppressClick:Q},t._id))})})]}),X.length>=2&&Z!==void 0?(0,q.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,q.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:ie()}),Z.length===0?(0,q.jsx)(`p`,{className:`oc-projpage__hint`,children:a({term:X})}):(0,q.jsx)(`ul`,{className:`oc-projpage__chats`,children:Z.map(e=>(0,q.jsx)(`li`,{className:`oc-projpage__chatrow`,children:(0,q.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{e.messageId&&X&&je(e.messageId,X),t({to:`/chat/$chatId`,params:{chatId:e.chatId},...e.messageId?{search:{m:e.messageId}}:{}})},children:[(0,q.jsx)(Ne,{size:13,"aria-hidden":!0,className:`oc-projpage__hitico`}),(0,q.jsxs)(`span`,{className:`oc-projpage__hitbody`,children:[(0,q.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||_e()}),e.projectPath&&e.projectPath.length>1?(0,q.jsx)(`span`,{className:`oc-projpage__hitpath`,children:e.projectPath.join(` › `)}):null,e.snippet?(0,q.jsx)(`span`,{className:`oc-projpage__hitsnippet`,children:e.snippet}):null]})]})},`${e.chatId}:${e.messageId??`t`}`))})]}):null]}),(0,q.jsx)(_t,{open:Et,onOpenChange:J,title:be(),canSubmit:At.trim().length>0,onSubmit:async()=>{await f({projectId:e.project._id,name:At.trim()}),J(!1)},submitLabel:S(),children:(0,q.jsx)(pt,{value:At,onChange:e=>Y(e.target.value),autoFocus:!0})}),Pt?(0,q.jsx)(qe,{open:Pt,onOpenChange:Ft,title:ge(),movingFolderId:e.project._id,currentId:e.project.parentId,onPick:t=>void g({projectId:e.project._id,parentId:t})}):null,$e]}),(0,q.jsx)(Ve,{children:$?(0,q.jsxs)(`div`,{className:`oc-projpage__dragghost`,children:[$.kind===`folder`?(0,q.jsx)(R,{size:13,"aria-hidden":!0}):(0,q.jsx)(Ne,{size:13,"aria-hidden":!0}),(0,q.jsx)(`span`,{children:$.label})]}):null})]})})}function Rt({folderId:e,children:t}){let{setNodeRef:n,isOver:r}=N({id:Ft(e)});return(0,q.jsx)(`span`,{ref:n,className:r?`oc-projpage__cdrop is-over`:`oc-projpage__cdrop`,children:t})}function zt({child:e,parentId:t,now:n,suppressClick:r}){let i=j(),a=B({id:`folder:${e._id}`}),o=N({id:Y(e._id)});return(0,q.jsxs)(`div`,{ref:e=>{a.setNodeRef(e),o.setNodeRef(e)},className:`oc-projpage__card oc-reveal-host`+(o.isOver?` is-over`:``)+(a.isDragging?` is-dragging`:``),style:{"--proj-hue":Ke(e),transform:P.Transform.toString(a.transform),transition:a.transition},onClick:()=>{r.current||i({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&i({to:`/project/$projectId`,params:{projectId:e._id}})},...a.listeners,...a.attributes,role:`link`,tabIndex:0,children:[(0,q.jsxs)(`span`,{className:`oc-projpage__cardhead`,children:[(0,q.jsx)(R,{size:15,"aria-hidden":!0,className:`oc-projpage__cardico`}),(0,q.jsx)(`span`,{className:`oc-projpage__cardname`,children:e.name}),(0,q.jsx)(Et,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__cardmenu oc-reveal oc-hit`,onOpen:()=>void i({to:`/project/$projectId`,params:{projectId:e._id}})})]}),(0,q.jsxs)(`span`,{className:`oc-projpage__cardmeta`,children:[e.folderCount>0?ae({count:e.folderCount})+` · `:``,d({count:e.recursiveChatCount})]}),e.lastActivityAt===null?null:(0,q.jsx)(`span`,{className:`oc-projpage__cardage`,children:Ge(e.lastActivityAt,n)})]})}function Z({chat:e}){let t=x(D.chats.setChatSidebar),n=e.inSidebar?Ce():ye();return(0,q.jsx)(W,{variant:`ghost`,size:`icon-xs`,"aria-label":n,title:n,className:`oc-projpage__barbtn oc-hit`+(e.inSidebar?` is-on`:``),disabled:e.pinned&&e.inSidebar,onClick:n=>{n.stopPropagation(),t({chatId:e._id,hidden:e.inSidebar})},children:e.inSidebar?(0,q.jsx)(ze,{}):(0,q.jsx)(G,{})})}function Bt({chat:e,currentFolderId:t,now:n,busy:r,unread:i,locate:a,suppressClick:o}){let s=(0,K.useContext)(F).get(e._id),c=j(),l=z(e.color),u=B({id:`chat:${e._id}`}),d=Vt(a);return(0,q.jsxs)(`li`,{ref:e=>{u.setNodeRef(e),d.current=e},className:`oc-projpage__chatrow oc-reveal-host`+(u.isDragging?` is-dragging`:``)+(a?` is-locate`:``),style:{transform:P.Transform.toString(u.transform),transition:u.transition},children:[(0,q.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{o.current||c({to:`/chat/$chatId`,params:{chatId:e._id}})},...u.listeners,...u.attributes,children:[l?(0,q.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:l}}):(0,q.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,q.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||le()}),e.pinned?(0,q.jsx)(M,{size:12,"aria-hidden":!0,className:`oc-projpage__chatpin`}):null,(0,q.jsx)(`span`,{className:`oc-projpage__chatage`,children:Ge(e.updatedAt,n)}),r?(0,q.jsx)(`span`,{className:I(s,C()).className,title:I(s,C()).label,"aria-label":I(s,C()).label}):null,i&&!r?(0,q.jsx)(`span`,{className:`oc-chatitem__unread`,title:Te(),"aria-label":Te()}):null]}),(0,q.jsx)(Z,{chat:e}),(0,q.jsx)(J,{chat:e,currentFolderId:t,className:`oc-projpage__chatmenu oc-reveal oc-hit`})]})}function Vt(e){let t=(0,K.useRef)(null);return(0,K.useEffect)(()=>{e&&t.current&&t.current.scrollIntoView({block:`center`})},[e]),t}function Ht({data:e,busyIds:t,suppressClick:n,locateChatId:r}){let[i,a]=(0,K.useState)(new Set),o=(0,K.useMemo)(()=>{let t=new Map;for(let n of e?.chats??[]){let e=t.get(n.folderId);e===void 0?t.set(n.folderId,[n]):e.push(n)}return t},[e]);if(e===void 0)return(0,q.jsx)(`p`,{className:`oc-projpage__hint`,children:E()});if(e===null)return null;let s=e=>a(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),c=(a,l)=>{let u=o.get(a??e.rootId)??[],d=Ue(e.folders,a);return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(H,{items:u.map(e=>`chat:${e._id}`),strategy:V,children:u.map(e=>(0,q.jsx)(Ut,{chat:e,depth:l,busy:t.has(e._id),locate:e._id===r,suppressClick:n},e._id))}),(0,q.jsx)(H,{items:d.map(e=>`folder:${e._id}`),strategy:V,children:d.map(t=>(0,q.jsx)(Q,{folder:t,parentId:a??e.rootId,depth:l,folded:i.has(t._id),onToggle:()=>s(t._id),suppressClick:n,children:i.has(t._id)?null:c(t._id,l+1)},t._id))})]})};return(0,q.jsx)(`div`,{className:`oc-projpage__tree`,children:(o.get(e.rootId)??[]).length===0&&Ue(e.folders,null).length===0?(0,q.jsx)(`p`,{className:`oc-projpage__hint`,children:Oe()}):c(null,0)})}function Q({folder:e,parentId:t,depth:n,folded:r,onToggle:i,suppressClick:a,children:o}){let s=j(),c=B({id:`folder:${e._id}`}),l=N({id:Y(e._id)});return(0,q.jsxs)(`div`,{className:`oc-projpage__treegroup`,children:[(0,q.jsxs)(`div`,{ref:e=>{c.setNodeRef(e),l.setNodeRef(e)},className:`oc-projpage__treerow oc-projpage__treerow--folder oc-reveal-host`+(l.isOver?` is-over`:``)+(c.isDragging?` is-dragging`:``),style:{"--tree-depth":n,"--proj-hue":Ke(e),transform:P.Transform.toString(c.transform),transition:c.transition},...c.listeners,...c.attributes,role:`button`,tabIndex:0,onClick:()=>{a.current||s({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&s({to:`/project/$projectId`,params:{projectId:e._id}})},children:[(0,q.jsx)(`button`,{type:`button`,className:`oc-projpage__treechev`,"aria-label":r?p():xe(),"aria-expanded":!r,onClick:e=>{e.stopPropagation(),!a.current&&i()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:r?(0,q.jsx)(tt,{size:13}):(0,q.jsx)(et,{size:13})}),(0,q.jsx)(R,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,q.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,q.jsx)(Et,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__treemenu oc-reveal oc-hit`,onOpen:()=>void s({to:`/project/$projectId`,params:{projectId:e._id}})})]}),o]})}function Ut({chat:e,depth:t,busy:n,locate:r,suppressClick:i}){let a=(0,K.useContext)(F).get(e._id),o=j(),s=B({id:`chat:${e._id}`}),c=Vt(r),l=z(e.color);return(0,q.jsxs)(`div`,{ref:e=>{s.setNodeRef(e),c.current=e},className:`oc-projpage__treerow oc-projpage__treerow--chat oc-reveal-host`+(s.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{"--tree-depth":t,transform:P.Transform.toString(s.transform),transition:s.transition},children:[(0,q.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||o({to:`/chat/$chatId`,params:{chatId:e._id}})},...s.listeners,...s.attributes,children:[l?(0,q.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:l}}):(0,q.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,q.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||le()}),n?(0,q.jsx)(`span`,{className:I(a,``).className,"aria-hidden":!0}):null]}),(0,q.jsx)(J,{chat:e,currentFolderId:e.folderId,className:`oc-projpage__treemenu oc-reveal oc-hit`}),(0,q.jsx)(Z,{chat:e})]})}function Wt({data:e,currentId:t,busyIds:n,suppressClick:r,locateChatId:i}){let a=(0,K.useRef)(null);(0,K.useEffect)(()=>{let e=a.current;e&&(e.scrollLeft=e.scrollWidth)},[e?.columns.length??0,t]);let o=(0,K.useRef)(null),s=(0,K.useRef)(null),c=vt(()=>{let e=o.current,t=s.current;return e===null||t===null?null:At(e.clientWidth,t.getBoundingClientRect().width)},()=>[o.current],[e===void 0],{hysteresis:24})>0;if(e===void 0)return(0,q.jsx)(`p`,{className:`oc-projpage__hint`,children:E()});let l=c?e.columns.slice(-1):e.columns;return(0,q.jsxs)(`div`,{ref:o,className:`oc-projpage__colswrap`,children:[(0,q.jsxs)(`div`,{ref:s,className:`oc-projpage__colprobes`,"aria-hidden":!0,children:[(0,q.jsx)(`div`,{className:`oc-projpage__col`}),(0,q.jsx)(`div`,{className:`oc-projpage__col is-last`})]}),(0,q.jsx)(`div`,{className:`oc-projpage__cols`+(c?` oc-projpage__cols--one`:``),"data-layout":c?`one-level`:`columns`,ref:a,children:l.map(a=>(0,q.jsx)($,{col:a,isLast:a===e.columns[e.columns.length-1],currentId:t,busyIds:n,suppressClick:r,locateChatId:i},a.folderId??`root`))})]})}function $({col:e,isLast:t,currentId:n,busyIds:r,suppressClick:i,locateChatId:a}){let o=j(),s=N({id:Pt(e.folderId)});return(0,q.jsxs)(`div`,{ref:s.setNodeRef,className:`oc-projpage__col`+(s.isOver?` is-over`:``)+(t?` is-last`:``),children:[(0,q.jsx)(H,{items:e.folders.map(e=>`folder:${e._id}`),strategy:V,children:e.folders.map(t=>(0,q.jsx)(Gt,{folder:t,parentId:e.folderId,isCurrent:t._id===n,suppressClick:i,onOpen:()=>void o({to:`/project/$projectId`,params:{projectId:t._id}})},t._id))}),(0,q.jsx)(H,{items:e.chats.map(e=>`chat:${e._id}`),strategy:V,children:e.chats.map(t=>(0,q.jsx)(Kt,{chat:t,folderId:e.folderId,busy:r.has(t._id),locate:t._id===a,suppressClick:i,onOpen:()=>void o({to:`/chat/$chatId`,params:{chatId:t._id}})},t._id))}),e.folders.length===0&&e.chats.length===0?(0,q.jsx)(`p`,{className:`oc-projpage__colempty`,children:ne()}):null]})}function Gt({folder:e,parentId:t,isCurrent:n,suppressClick:r,onOpen:i}){let a=B({id:`folder:${e._id}`}),o=N({id:Y(e._id)});return(0,q.jsxs)(`div`,{ref:e=>{a.setNodeRef(e),o.setNodeRef(e)},className:`oc-projpage__colentry oc-projpage__colentry--folder oc-reveal-host`+(e.selected||n?` is-selected`:``)+(o.isOver?` is-over`:``)+(a.isDragging?` is-dragging`:``),style:{"--proj-hue":Ke(e),transform:P.Transform.toString(a.transform),transition:a.transition},onClick:()=>{r.current||i()},onKeyDown:e=>{e.key===`Enter`&&e.target===e.currentTarget&&i()},...a.listeners,...a.attributes,role:`button`,tabIndex:0,children:[(0,q.jsx)(R,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,q.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,q.jsx)(`span`,{className:`oc-projpage__colchev`,"aria-hidden":!0,children:`›`}),(0,q.jsx)(Et,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__colmenu oc-reveal oc-hit`,onOpen:i})]})}function Kt({chat:e,folderId:t,busy:n,locate:r,suppressClick:i,onOpen:a}){let o=(0,K.useContext)(F).get(e._id),s=B({id:`chat:${e._id}`}),c=Vt(r),l=z(e.color);return(0,q.jsxs)(`div`,{ref:e=>{s.setNodeRef(e),c.current=e},className:`oc-projpage__colentry oc-projpage__colentry--chat oc-reveal-host`+(s.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{transform:P.Transform.toString(s.transform),transition:s.transition},children:[(0,q.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a()},...s.listeners,...s.attributes,children:[l?(0,q.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:l}}):(0,q.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,q.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||le()}),n?(0,q.jsx)(`span`,{className:I(o,``).className,"aria-hidden":!0}):null]}),(0,q.jsx)(J,{chat:e,currentFolderId:t,className:`oc-projpage__colmenu oc-projpage__colmenu--chat oc-reveal oc-hit`}),(0,q.jsx)(Z,{chat:e})]})}export{X as ProjectPage};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ah as r,Aj as i,Ap as a,Bj as o,Cj as s,Dh as c,Dj as l,Dp as u,Ej as d,Mj as f,Nj as p,Oh as m,Oj as h,Op as g,Sd as ee,Sj as te,Tj as ne,Vj as re,_Q as _,_j as v,ap as y,bd as b,bj as x,gj as S,hj as C,ip as ie,jh as ae,jj as oe,js as se,kh as ce,kj as w,kp as T,mj as E,op as D,rp as O,sp as k,t as A,vQ as j,vj as M,wj as N,xd as P,xj as F,yj as I}from"./api-jG5Fwsg4.js";import{i as L,n as R,r as z,t as B}from"./FieldLabel-Wb5bwK7r.js";import{t as V}from"./checkbox-U99HMqP3.js";import{c as H,d as le,l as U,u as W}from"./tooltip-CobtYK4c.js";import{a as G,i as K,n as q,r as J,t as Y}from"./select-DGKgMOlh.js";import{t as X}from"./button-sV7hIR3f.js";import{r as ue}from"./toast-daONdZpX.js";import{t as de}from"./appHost-CH3EGcJw.js";import{r as Z,t as fe}from"./locales-CPjguROj.js";import{t as pe}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=t(e(),1),$=n(),me={media_delivery:{label:h,help:l},documentary_fetch:{label:d,help:ne},inbound_files:{label:N,help:s},history_summary:{label:ae,help:r},file_curation:{label:a,help:k},quote_reply:{label:T,help:g}},he={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
|
|
2
|
-
- gdrive/0f9e8d7c6b5a4321dcba`,files:`- /home/node/.openclaw/media/inbound/rapport.pdf (124800 o, application/pdf)`,previous_summary:`Projet Alpha : budget 40 000 EUR ; choix du serveur en cours.`,new_messages:`Utilisateur : Compare OVH et Scaleway.
|
|
3
|
-
Assistant : Comparaison en cours.`,max_chars:`6000`,file_name:`MEMORY.md`,budget_chars:`20000`,feedback:`Trop de suppressions dans la section des liens, garde-les.`,content:`# Memory index
|
|
4
|
-
- [Fait 1](fait-1.md) - note du projet`,excerpt:`Le classement propose trois dossiers : Clients, Fournisseurs, Interne.`},ge={outboundDir:S,references:C,files:E,previous_summary:ce,new_messages:m,max_chars:c,file_name:D,budget_chars:y,feedback:ie,content:O,excerpt:u};function _e(){let e=j(A.admin.listInstances,{}),[t,n]=(0,Q.useState)(null);if(e===void 0)return(0,$.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,$.jsx)(`div`,{className:`oc-injtab`,children:(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:F()})});let r=e.find(e=>e._id===t)??e[0];return(0,$.jsxs)(`div`,{className:`oc-injtab`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,$.jsx)(R,{label:p(),help:f()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:te()}),(0,$.jsxs)(Y,{value:r._id,onValueChange:e=>n(e),children:[(0,$.jsx)(K,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(G,{})}),(0,$.jsx)(q,{children:e.map(e=>(0,$.jsx)(J,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(ve,{instance:r},r._id)]})}function ve({instance:e}){let t=_(A.admin.upsertInstanceConfig),n=ue(),r=j(A.me.getMe,{host:de}),i=e.config??{},a=Z(e.config?.contentLocale,r?.defaultLocale??void 0),[s,c]=(0,Q.useState)(()=>L(i,a));(0,Q.useEffect)(()=>{c(L(i,a))},[a,e._id]);let[l,u]=(0,Q.useState)(!1),d=s.promptInjections,f=(e,t)=>c({...s,promptInjections:{...d,[e]:{...d[e],...t}}});async function p(){u(!0);try{await t({instanceId:e._id,config:z(s,i,a)})}catch(e){n.error(o(),e)}finally{u(!1)}}async function m(r){let i={...e.config??{}};r==="default"?delete i.contentLocale:i.contentLocale=r;try{await t({instanceId:e._id,config:i})}catch(e){n.error(o(),e)}}let h=e.config?.contentLocale??`default`,g=fe[Z(void 0,r?.defaultLocale??void 0)];return(0,$.jsxs)(`div`,{className:`oc-injtab__body`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__content-locale`,children:[(0,$.jsx)(`span`,{children:ee()}),(0,$.jsxs)(Y,{value:h,onValueChange:e=>void m(e),children:[(0,$.jsx)(K,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(G,{})}),(0,$.jsxs)(q,{children:[(0,$.jsx)(J,{value:`default`,children:b({locale:g})}),pe().map(e=>(0,$.jsx)(J,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:P()})]}),U.map(e=>(0,$.jsx)(ye,{injKey:e,def:H[e],i18n:me[e],row:d[e]??{enabled:!0,template:H[e].defaultTemplate[a]},contentLocale:a,onChange:t=>f(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(X,{size:`sm`,onClick:()=>void p(),disabled:l,children:re()})})]})}function ye({injKey:e,def:t,i18n:n,row:r,contentLocale:a,onChange:o}){let[s,c]=(0,Q.useState)(!1),l=r.template.trim()!==t.defaultTemplate[a],u=t.togglable&&!r.enabled,d=Object.fromEntries(t.placeholders.map(e=>[e,he[e]??`{${e}}`])),f=W(e,r,a),p=f?le(f,d):``;return(0,$.jsxs)(`section`,{className:`oc-injcard`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,$.jsxs)(`label`,{className:`oc-field--row`,children:[(0,$.jsx)(V,{checked:r.enabled,onCheckedChange:e=>o({enabled:e===!0})}),(0,$.jsx)(R,{label:n.label(),help:n.help()})]}):(0,$.jsx)(R,{label:n.label(),help:n.help()}),l&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:i()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:u,rows:8,spellCheck:!1,onChange:e=>o({template:e.target.value})}),(0,$.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:w()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(B,{text:(ge[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(X,{variant:`ghost`,size:`sm`,onClick:()=>c(e=>!e),children:s?I():x()}),l&&(0,$.jsx)(X,{variant:`ghost`,size:`sm`,onClick:()=>o({template:t.defaultTemplate[a]}),children:oe()})]})]}),s&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:p?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:p}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:M()}),t.pluralDefaultTemplate!==void 0&&!u?(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:se()}):null]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:v()})})]})}export{_e as PromptInjectionsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$P as r,AF as i,CF as a,DF as o,EF as s,FF as c,IF as l,JP as u,LF as d,MF as f,NF as p,OF as m,PF as h,QP as ee,RF as g,SF as _,TF as v,XP as y,YP as b,ZP as x,_F as te,_Q as S,bF as ne,cF as re,dF as ie,eF as ae,em as C,fF as w,gF as T,hF as E,jF as D,kF as O,lF as k,mF as A,nF as j,pF as M,t as N,tF as P,uF as F,vF as I,vQ as L,wF as R,xF as oe,yF as z}from"./api-jG5Fwsg4.js";import{t as B}from"./lock-DJQnxN_w.js";import{t as V}from"./checkbox-U99HMqP3.js";import{t as H}from"./button-sV7hIR3f.js";import{t as U}from"./input-DReDYsos.js";import"./convexApi-DeaVGrsr.js";import{r as W}from"./toast-daONdZpX.js";import{t as G}from"./badge-CSm2xaYH.js";import{n as K}from"./ConfirmDialog-BmOX8o6F.js";import{t as q}from"./EntitySheet-BXEY6TCb.js";import{t as J}from"./roleDescriptions-D-rhX1-Q.js";var Y=t(e(),1),X=n(),Z=[{group:()=>g(),keys:[{key:`traces.read`,label:()=>p()},{key:`traces.read.content`,label:()=>f(),phi:!0},{key:`traces.write`,label:()=>D()}]},{group:()=>d(),keys:[{key:`kpi.read`,label:()=>p()},{key:`kpi.write`,label:()=>D()}]},{group:()=>l(),keys:[{key:`openclaw.query`,label:()=>i()},{key:`anomalies.read`,label:()=>O()},{key:`anomalies.report`,label:()=>m()}]},{group:()=>c(),keys:[{key:`chats.read`,label:()=>p()},{key:`selfheal`,label:()=>s()},{key:`media.repair`,label:()=>v()},{key:`feedback.respond`,label:()=>C()}]},{group:()=>h(),keys:[{key:`admin.manage`,label:()=>o()}]}],se=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function ce(){let e=L(N.apiKeys.listRoles,{}),t=S(N.apiKeys.createRole),n=S(N.apiKeys.ensureRolesSeeded),i=S(N.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(N.apiKeys.listRoles,{});r&&e.setQuery(N.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),o=K(),s=W(),[c,l]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)($),[p,m]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{s.error(a(),e)})},[n,s]);let h=e??[];async function g(e,t){if(Q(e.permissions))return;if(e.builtin){await o({title:_({name:e.name}),description:oe(),confirmLabel:ne()});return}if(p.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];m(t=>new Set(t).add(e._id));try{await i({roleId:e._id,permissions:n})}catch(e){s.error(z(),e)}finally{m(t=>{let n=new Set(t);return n.delete(e._id),n})}}async function v(){try{await t({key:d.key,name:d.name,description:d.description||void 0,permissions:[]}),f($),l(!1)}catch(e){s.error(I(),e)}}let C=e===void 0,D=!C&&h.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[te(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,T(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,E()]}),(0,X.jsxs)(`div`,{className:`oc-dt`,children:[(0,X.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,X.jsx)(`h2`,{className:`oc-dt__title`,children:A()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(H,{size:`sm`,onClick:()=>{f($),l(!0)},children:M()})})]}),C?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:w()}):D?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:ie()}):(0,X.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,X.jsxs)(`table`,{className:`oc-matrix`,children:[(0,X.jsxs)(`thead`,{children:[(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:F()}),Z.map(e=>(0,X.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,X.jsx)(`tr`,{children:Z.flatMap(e=>e.keys.map(e=>(0,X.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?R({key:e.key}):e.key,children:[e.label(),e.phi?(0,X.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,X.jsx)(`tbody`,{children:h.map(e=>{let t=Q(e.permissions),n=p.has(e._id);return(0,X.jsxs)(`tr`,{children:[(0,X.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,X.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,X.jsx)(`span`,{children:e.name}),(0,X.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,X.jsxs)(G,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(B,{}),` `,k()]}):(0,X.jsx)(G,{variant:`secondary`,children:re()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),se.map(r=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(V,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?j():n?P():r,onCheckedChange:()=>void g(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(q,{open:c,onOpenChange:l,title:ae(),description:r(),canSubmit:!!(d.key&&d.name),onSubmit:v,submitLabel:ee(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:x()}),(0,X.jsx)(U,{value:d.key,placeholder:y(),onChange:e=>f({...d,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:b()}),(0,X.jsx)(U,{value:d.name,onChange:e=>f({...d,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:u()}),(0,X.jsx)(U,{value:d.description,onChange:e=>f({...d,description:e.target.value})})]})]})})]})}export{ce as RolesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$J as r,$Y as i,AX as a,AY as o,BX as s,BY as c,CY as l,DY as u,EY as d,FJ as f,FX as p,GJ as m,GX as h,GY as g,HJ as _,HX as ee,HY as v,IX as te,IY as y,JJ as ne,KJ as re,LX as ie,LY as ae,MX as oe,NX as se,OY as b,PX as ce,QJ as le,QY as ue,RX as de,RY as fe,SY as pe,TY as me,UJ as he,UX as ge,UY as _e,VJ as ve,VX as ye,VY as be,WJ as xe,WX as Se,WY as Ce,XJ as we,XY as Te,YJ as Ee,ZJ as De,ZY as Oe,_Y as x,bY as ke,cX as Ae,dX as je,eX as Me,eY as Ne,gY as Pe,hQ as S,hY as Fe,iX as Ie,iY as Le,jX as Re,jY as ze,k as Be,kY as C,lX as Ve,mY as He,nX as Ue,nY as We,oX as Ge,qJ as Ke,qY as qe,rX as Je,rY as Ye,sQ as Xe,sX as Ze,t as w,tX as Qe,tY as $e,uQ as T,uX as et,vQ as tt,vY as nt,wY as rt,xY as it,yY as E,zX as at,zY as ot}from"./api-jG5Fwsg4.js";import{t as D}from"./chevron-left-cmPkj5_M.js";import{t as O}from"./chevron-right-DbysoSJS.js";import{t as st}from"./list-kKcfLqpz.js";import{t as ct}from"./loader-circle-_HV4tchJ.js";import{a as lt,i as ut,n as dt,r as ft,t as pt}from"./cronDescribe-D9eP5CDy.js";import{t as mt}from"./pencil-C_IJUeJn.js";import{t as ht}from"./rotate-ccw-XgdDTtI8.js";import{t as gt}from"./trash-2-UxV-pTWt.js";import{a as k,i as A,n as j,r as M,t as N}from"./select-DGKgMOlh.js";import{a as _t,c as vt,i as yt,n as bt,o as xt,r as St,s as Ct,t as wt}from"./alert-dialog-BwvaE8oD.js";import{n as P,r as F,t as Tt}from"./popover-BcL-AsC2.js";import{t as I}from"./button-sV7hIR3f.js";import{t as Et}from"./input-DReDYsos.js";import"./convexApi-DeaVGrsr.js";import{r as Dt}from"./toast-daONdZpX.js";import{t as L}from"./badge-CSm2xaYH.js";import{a as Ot,i as kt,n as At,o as jt,r as Mt,t as Nt}from"./dialog-Bpoyy7pR.js";import{t as Pt}from"./appHost-CH3EGcJw.js";import{r as Ft}from"./measureClone-CHN0WNEY.js";import{a as It,i as R,n as Lt,o as Rt,r as z,t as zt}from"./table-CIrFKiPM.js";import{t as Bt}from"./FilterBar-D2w0wWnm.js";/* empty css */import{t as Vt}from"./useTableLayout-Cmwnuzxb.js";import{a as Ht,c as B,i as V,l as H,n as Ut,o as U,r as Wt,s as W,t as Gt,u as Kt}from"./TimezoneCombobox-BUC66FuM.js";var qt=Be(`calendar-days`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M16 14h.01`,key:`1gbofw`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M16 18h.01`,key:`kzsmim`}]]),Jt=Be(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),G=t(e(),1),K=n();function Yt(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function Xt({value:e,onChange:t}){let n=H(e),r=(0,G.useMemo)(()=>new Date,[]),[i,a]=(0,G.useState)(()=>({year:n?.year??r.getFullYear(),month:n?.month??r.getMonth()})),[s,c]=(0,G.useState)(!1),l=(0,G.useMemo)(()=>Yt(T()),[]),f=(0,G.useMemo)(()=>new Intl.DateTimeFormat(T(),{month:`long`,year:`numeric`}),[]),p=(0,G.useMemo)(()=>new Intl.DateTimeFormat(T(),{dateStyle:`medium`,timeStyle:`short`}),[]),m=B(i.year,i.month),h=n?.hour??9,g=n?.minute??0,_=(e,n,r,i,a)=>t(Kt(e,n,r,i,a)),ee=(e,t,n)=>{a({year:e,month:t}),_(e,t,n,h,g)},v=e=>{let t=new Date(i.year,i.month+e,1);a({year:t.getFullYear(),month:t.getMonth()})},te=n===null?o():p.format(new Date(n.year,n.month,n.day,n.hour,n.minute));return(0,K.jsxs)(Tt,{modal:!0,open:s,onOpenChange:c,children:[(0,K.jsx)(F,{asChild:!0,children:(0,K.jsxs)(`button`,{type:`button`,className:`oc-dtp__trigger`,"aria-label":ze(),children:[(0,K.jsx)(qt,{size:14,"aria-hidden":!0,className:`oc-dtp__icon`}),(0,K.jsx)(`span`,{className:n===null?`oc-dtp__placeholder`:void 0,children:te})]})}),(0,K.jsxs)(P,{align:`start`,className:`oc-dtp__pop`,children:[(0,K.jsxs)(`div`,{className:`oc-dtp__head`,children:[(0,K.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":C(),onClick:()=>v(-1),children:(0,K.jsx)(D,{size:15,"aria-hidden":!0})}),(0,K.jsx)(`span`,{className:`oc-dtp__month`,children:f.format(new Date(i.year,i.month,1))}),(0,K.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":b(),onClick:()=>v(1),children:(0,K.jsx)(O,{size:15,"aria-hidden":!0})})]}),(0,K.jsxs)(`div`,{className:`oc-dtp__grid`,children:[l.map((e,t)=>(0,K.jsx)(`span`,{className:`oc-dtp__wd`,children:e},t)),m.map((e,t)=>{let i=n!==null&&n.year===e.year&&n.month===e.month&&n.day===e.day,a=r.getFullYear()===e.year&&r.getMonth()===e.month&&r.getDate()===e.day;return(0,K.jsx)(`button`,{type:`button`,className:`oc-dtp__day`+(e.inMonth?``:` oc-dtp__day--out`)+(i?` oc-dtp__day--sel`:``)+(a&&!i?` oc-dtp__day--today`:``),onClick:()=>ee(e.year,e.month,e.day),children:e.day},t)})]}),(0,K.jsxs)(`div`,{className:`oc-dtp__time`,children:[(0,K.jsxs)(N,{value:String(h),onValueChange:e=>_(i.year,i.month,n?.day??r.getDate(),Number(e),g),children:[(0,K.jsx)(A,{size:`sm`,"aria-label":u(),children:(0,K.jsx)(k,{})}),(0,K.jsx)(j,{className:`oc-dtp__timeopts`,children:Array.from({length:24},(e,t)=>(0,K.jsx)(M,{value:String(t),children:String(t).padStart(2,`0`)},t))})]}),(0,K.jsx)(`span`,{className:`oc-dtp__colon`,children:`:`}),(0,K.jsxs)(N,{value:String(g),onValueChange:e=>_(i.year,i.month,n?.day??r.getDate(),h,Number(e)),children:[(0,K.jsx)(A,{size:`sm`,"aria-label":d(),children:(0,K.jsx)(k,{})}),(0,K.jsx)(j,{className:`oc-dtp__timeopts`,children:Array.from({length:60},(e,t)=>(0,K.jsx)(M,{value:String(t),children:String(t).padStart(2,`0`)},t))})]})]})]})]})}function Zt(e,t){return{available:e,required:[14*t]}}function Qt(e,t){return e.length===0?null:t===null?e[0]:e.find(e=>e>=t)??e[e.length-1]}function q(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function $t(e,t,n){let r=e=>String(e).padStart(2,`0`);return`${e}-${r(t+1)}-${r(n)}`}function en(e){let t=new Map;for(let n of e){let e=q(n.atMs),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}for(let e of t.values())e.sort((e,t)=>e.atMs-t.atMs);return t}function tn(e,t,n){let r=new Map,i=new Date(t,n+1,0).getDate();for(let a=1;a<=i;a++){let i=e.get($t(t,n,a));i!==void 0&&i.length>0&&r.set(a,i.length)}return r}function nn(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function rn(e,t){let n=(new Date(e,t,1).getDay()+6)%7,r=new Date(e,t,1-n),i=new Date(r.getFullYear(),r.getMonth(),r.getDate()+42);return{startMs:r.getTime(),endMs:i.getTime()}}function an(e){return{startMs:new Date(e,0,1).getTime(),endMs:new Date(e+1,0,1).getTime()}}var J=3;function on({events:e,mode:t,cursor:n,onModeChange:r,onCursorChange:i,onEventClick:a,footnote:o}){let s=T(),c=(0,G.useMemo)(()=>en(e),[e]),l=(0,G.useMemo)(()=>nn(s),[s]),u=(0,G.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`,year:`numeric`}),[s]),d=(0,G.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`}),[s]),f=(0,G.useMemo)(()=>new Intl.DateTimeFormat(s,{hour:`2-digit`,minute:`2-digit`}),[s]),p=(0,G.useMemo)(()=>new Intl.DateTimeFormat(s,{weekday:`long`,day:`numeric`,month:`long`}),[s]),m=new Date,h=(0,G.useRef)(null),g=(0,G.useRef)(null),_=(0,G.useRef)(null),[ee,v]=(0,G.useState)(0),te=Ft(()=>{let e=h.current,t=g.current;return e===null||t===null?null:Zt(e.clientWidth,t.getBoundingClientRect().width)},()=>[h.current],[s],{hysteresis:24}),y=t??(te===0?`month`:`agenda`),ne=e=>{if(y===`year`){i({year:n.year+e,month:n.month});return}let t=new Date(n.year,n.month+e,1);i({year:t.getFullYear(),month:t.getMonth()})},re=y===`year`?String(n.year):u.format(new Date(n.year,n.month,1));return(0,K.jsxs)(`div`,{ref:h,className:`oc-cal`,"data-mode":y,children:[(0,K.jsxs)(`span`,{ref:g,className:`oc-cal__event oc-cal__chipmeasure`,"aria-hidden":!0,children:[(0,K.jsx)(`span`,{className:`oc-cal__evdot`}),(0,K.jsx)(`span`,{className:`oc-cal__evtime`,children:f.format(new Date(2e3,0,1,23,59))})]}),(0,K.jsxs)(`div`,{ref:_,className:`oc-cal__head`,children:[(0,K.jsxs)(`div`,{className:`oc-cal__nav`,children:[(0,K.jsx)(I,{variant:`ghost`,size:`icon-sm`,"aria-label":x(),onClick:()=>ne(-1),children:(0,K.jsx)(D,{})}),(0,K.jsx)(I,{variant:`ghost`,size:`icon-sm`,"aria-label":Pe(),onClick:()=>ne(1),children:(0,K.jsx)(O,{})}),(0,K.jsx)(I,{variant:`ghost`,size:`sm`,onClick:()=>{i({year:m.getFullYear(),month:m.getMonth()}),v(e=>e+1)},children:nt()})]}),(0,K.jsx)(`span`,{className:`oc-cal__title`,children:re}),(0,K.jsxs)(`div`,{className:`oc-cal__modes`,role:`group`,children:[(0,K.jsx)(I,{variant:y===`agenda`?`secondary`:`ghost`,size:`sm`,"aria-pressed":y===`agenda`,onClick:()=>r(`agenda`),children:ke()}),(0,K.jsx)(I,{variant:y===`month`?`secondary`:`ghost`,size:`sm`,"aria-pressed":y===`month`,onClick:()=>r(`month`),children:pe()}),(0,K.jsx)(I,{variant:y===`year`?`secondary`:`ghost`,size:`sm`,"aria-pressed":y===`year`,onClick:()=>r(`year`),children:it()})]})]}),y===`agenda`?(0,K.jsx)(ln,{cursor:n,byDay:c,dayFmt:p,timeFmt:f,now:m,onEventClick:a,anchorKey:`${n.year}-${n.month}-${ee}`,headRef:_}):y===`month`?(0,K.jsx)(un,{cursor:n,byDay:c,weekdays:l,timeFmt:f,now:m,onEventClick:a}):(0,K.jsx)(dn,{year:n.year,byDay:c,monthShortFmt:d,now:m,onOpenMonth:e=>{i({year:n.year,month:e}),r(`month`)}}),o?(0,K.jsx)(`p`,{className:`oc-cal__footnote`,children:o}):null]})}function sn(e){return`cal-event:${e}`}function cn(e=document){let t=e.querySelector(`.oc-cal`);return t===null?[]:[t.querySelector(`.oc-cal__modes [aria-pressed="true"]`)??t.querySelector(`.oc-cal__head button`)]}function Y(e,t){let n=e.parentElement;for(;n!==null;){let e=getComputedStyle(n).overflowY;if((e===`auto`||e===`scroll`)&&n.scrollHeight>n.clientHeight)break;n=n.parentElement}if(n===null)return;let r=n.getBoundingClientRect().top+n.clientTop,i=t?.getBoundingClientRect().height??0;n.scrollTop+=Math.floor(e.getBoundingClientRect().top-r-i)}function ln({cursor:e,byDay:t,dayFmt:n,timeFmt:r,now:i,onEventClick:a,anchorKey:o,headRef:s}){let c=B(e.year,e.month).filter(e=>e.inMonth).map(e=>({c:e,list:t.get($t(e.year,e.month,e.day))??[]})).filter(({list:e})=>e.length>0),l=i.getFullYear()===e.year&&i.getMonth()===e.month?i.getDate():null,u=Qt(c.map(({c:e})=>e.day),l),d=(0,G.useRef)(null),f=(0,G.useRef)(null),p=c.length>0?c[0].c.day:null;return(0,G.useLayoutEffect)(()=>{if(u===null||f.current===o)return;f.current=o;let e=d.current?.querySelector(`[data-day="${u}"]`),t=s.current;e&&(u===p&&t!==null&&e.getBoundingClientRect().top>=t.getBoundingClientRect().bottom||Y(e,t))},[o,u,p,s]),c.length===0?(0,K.jsx)(`p`,{className:`oc-cal__agendaempty`,children:E()}):(0,K.jsx)(`div`,{ref:d,className:`oc-cal__agenda`,children:c.map(({c:e,list:t})=>{let o=i.getFullYear()===e.year&&i.getMonth()===e.month&&i.getDate()===e.day;return(0,K.jsxs)(`section`,{className:`oc-cal__agendaday`,"data-day":e.day,children:[(0,K.jsx)(`h4`,{className:`oc-cal__agendadate`+(o?` oc-cal__agendadate--today`:``),children:n.format(new Date(e.year,e.month,e.day))}),t.map(e=>{let t=(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`oc-cal__evdot`,"aria-hidden":!0}),(0,K.jsx)(`span`,{className:`oc-cal__evtime`,children:r.format(e.atMs)}),(0,K.jsx)(`span`,{className:`oc-cal__evtitle`,children:e.title})]}),n=`oc-cal__agendaitem`+(e.muted?` oc-cal__event--muted`:``)+(e.exact?` oc-cal__event--exact`:``),i=e.color?{"--cal-ev":e.color}:void 0;return a?(0,K.jsx)(I,{type:`button`,variant:`ghost`,"data-focus-key":sn(e.id),className:`${n} h-auto min-h-11 w-full justify-start font-normal`,style:i,onClick:()=>a(e),children:t},e.id):(0,K.jsx)(`div`,{className:n,style:i,children:t},e.id)})]},e.day)})})}function un({cursor:e,byDay:t,weekdays:n,timeFmt:r,now:i,onEventClick:a}){let o=B(e.year,e.month);return(0,K.jsxs)(`div`,{className:`oc-cal__month`,children:[n.map((e,t)=>(0,K.jsx)(`span`,{className:`oc-cal__wd`,children:e},t)),o.map((e,n)=>{let o=t.get($t(e.year,e.month,e.day))??[],s=i.getFullYear()===e.year&&i.getMonth()===e.month&&i.getDate()===e.day;return(0,K.jsxs)(`div`,{className:`oc-cal__day`+(e.inMonth?``:` oc-cal__day--out`)+(s?` oc-cal__day--today`:``),children:[(0,K.jsx)(`span`,{className:`oc-cal__daynum`,children:e.day}),o.slice(0,J).map(e=>(0,K.jsxs)(`button`,{type:`button`,"data-focus-key":sn(e.id),className:`oc-cal__event`+(e.muted?` oc-cal__event--muted`:``)+(e.exact?` oc-cal__event--exact`:``),style:e.color?{"--cal-ev":e.color}:void 0,title:`${r.format(e.atMs)} ${e.title}`,onClick:a?()=>a(e):void 0,children:[(0,K.jsx)(`span`,{className:`oc-cal__evdot`,"aria-hidden":!0}),(0,K.jsx)(`span`,{className:`oc-cal__evtime`,children:r.format(e.atMs)}),(0,K.jsx)(`span`,{className:`oc-cal__evtitle`,children:e.title})]},e.id)),o.length>J?(0,K.jsx)(`span`,{className:`oc-cal__more`,children:Fe({count:o.length-J})}):null]},n)})]})}function dn({year:e,byDay:t,monthShortFmt:n,now:r,onOpenMonth:i}){return(0,K.jsx)(`div`,{className:`oc-cal__year`,children:Array.from({length:12},(a,o)=>{let s=tn(t,e,o),c=B(e,o);return(0,K.jsxs)(`button`,{type:`button`,className:`oc-cal__mini`,onClick:()=>i(o),children:[(0,K.jsx)(`span`,{className:`oc-cal__mininame`,children:n.format(new Date(e,o,1))}),(0,K.jsx)(`span`,{className:`oc-cal__minigrid`,"aria-hidden":!0,children:c.map((e,t)=>{let n=e.inMonth?s.get(e.day)??0:0,i=e.inMonth&&r.getFullYear()===e.year&&r.getMonth()===e.month&&r.getDate()===e.day;return(0,K.jsx)(`span`,{className:`oc-cal__minidot`+(e.inMonth?``:` is-out`)+(n===1?` has-one`:``)+(n>1?` has-many`:``)+(i?` is-today`:``)},t)})})]},o)})})}var fn={h:36e5,min:6e4,s:1e3,ms:1};function pn(e){if(e===null)return null;let t=e.trim(),n=/^every\s+(\d+(?:\.\d+)?)(h|min|s|ms)$/.exec(t);if(n!==null){let e=Number(n[1])*fn[n[2]];return Number.isFinite(e)&&e>0?{kind:`every`,everyMs:e}:null}let r=/^(?:cron\s+)?([\d*,/-]+(?:\s+[\d*,/-]+){4})(?:\s*\(([^)]+)\))?$/.exec(t);if(r!==null)return{kind:`cron`,expr:r[1],tz:r[2]??null};let i=Date.parse(t);return Number.isFinite(i)?{kind:`at`,atMs:i}:null}function X(e,t,n){let r=new Set;for(let i of e.split(`,`)){let e=i,a=1,o=/^(.+)\/(\d{1,3})$/.exec(i);if(o!==null&&(e=o[1],a=Number(o[2]),a<1))return null;let s,c;if(e===`*`)s=t,c=n;else{let r=/^(\d{1,3})(?:-(\d{1,3}))?$/.exec(e);if(r===null||(s=Number(r[1]),c=r[2]===void 0?s:Number(r[2]),r[2]===void 0&&o!==null&&(c=n),s<t||c>n||s>c))return null}for(let e=s;e<=c;e+=a)r.add(e)}return r.size>0?[...r].sort((e,t)=>e-t):null}function Z(e){let t=e.trim().split(/\s+/);if(t.length!==5)return null;let n=X(t[0],0,59),r=X(t[1],0,23),i=X(t[2],1,31),a=X(t[3],1,12),o=X(t[4],0,7);if(!n||!r||!i||!a||!o)return null;let s=new Set(o.map(e=>e%7));return{minutes:n,hours:r,dom:new Set(i),months:new Set(a),dow:s,domRestricted:t[2]!==`*`,dowRestricted:t[4]!==`*`}}var Q=new Map;function mn(e){let t=Q.get(e);if(t!==void 0)return t;let n=null;try{n=new Intl.DateTimeFormat(`en-US`,{timeZone:e,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}catch{n=null}return Q.set(e,n),n}function hn(e,t){if(t!==null){let n=mn(t);if(n!==null){let t={};for(let r of n.formatToParts(e))r.type!==`literal`&&(t[r.type]=Number(r.value));return{y:t.year,mo:t.month-1,d:t.day,h:t.hour===24?0:t.hour,mi:t.minute}}}let n=new Date(e);return{y:n.getFullYear(),mo:n.getMonth(),d:n.getDate(),h:n.getHours(),mi:n.getMinutes()}}function gn(e,t,n,r,i,a){if(a===null||mn(a)===null)return new Date(e,t,n,r,i).getTime();let o=Date.UTC(e,t,n,r,i),s=e=>{let t=hn(e,a);return Date.UTC(t.y,t.mo,t.d,t.h,t.mi)-e},c=s(o),l=o-c,u=s(l);return u!==c&&(l=o-u),l}function _n(e,t,n,r){let i=new Map,a=(e,t)=>{e<n||e>=r||i.set(e,t||(i.get(e)??!1))};if(e?.kind===`at`)a(e.atMs,!0);else if(e?.kind===`every`){if(t!==null){let i=e.everyMs,o=Math.ceil((n-t)/i);for(let e=t+o*i,n=0;e<r&&n<400;e+=i,n++)a(e,e===t)}}else if(e?.kind===`cron`){let t=Z(e.expr);if(t!==null&&t.hours.length*t.minutes.length<=400){let i=0,o=n-864e5;for(;o<r+864e5&&i<400;){let s=hn(o,e.tz);if(t.months.has(s.mo+1)){let o=new Date(Date.UTC(s.y,s.mo,s.d)).getUTCDay(),c=t.dom.has(s.d),l=t.dow.has(o);if(t.domRestricted&&t.dowRestricted?c||l:c&&l)for(let o of t.hours)for(let c of t.minutes){if(i>=400)break;let t=gn(s.y,s.mo,s.d,o,c,e.tz);t>=n&&t<r&&(a(t,!1),i++)}}o=gn(s.y,s.mo,s.d,12,0,e.tz)+864e5}}}return t!==null&&a(t,!0),[...i.entries()].map(([e,t])=>({atMs:e,exact:t})).sort((e,t)=>e.atMs-t.atMs).slice(0,400)}var vn=`crons`;function yn(e,t){return`${e}\u0000${t}`}function bn(e,t,n){let r=[],i=new Map;for(let a of e){let{job:e}=a;if(e.id===null)continue;let o=yn(a.instanceName,e.id);i.set(o,a);let s=U(e)!==`active`,c=_n(s?null:pn(e.schedule),e.nextRunAtMs,t,n);for(let t of c)r.push({id:`${o}:${t.atMs}`,sourceId:vn,itemId:o,atMs:t.atMs,title:e.name??e.id,muted:s,exact:t.exact})}return{events:r,byItemId:i}}var $={minutes:6e4,hours:36e5,days:864e5};function xn(e){return e?.data?.code??`unknown`}function Sn({status:e}){switch(W(e)){case`ok`:return(0,K.jsx)(L,{variant:`secondary`,children:Ce()});case`error`:return(0,K.jsx)(L,{variant:`destructive`,children:v()});case`running`:return(0,K.jsx)(L,{variant:`outline`,children:be()});case`other`:return(0,K.jsx)(L,{variant:`outline`,children:e});case`none`:return(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}}function Cn(){let e=S(w.scheduled.listMyCrons),t=S(w.scheduled.getCronDetail),n=S(w.scheduled.listCronRuns),o=S(w.scheduled.updateCron),u=S(w.scheduled.removeCron),d=S(w.scheduled.runCronNow),b=Dt(),pe=tt(w.me.getMe,{host:Pt})?.timezone,[x,ke]=(0,G.useState)(null),[Pe,Fe]=(0,G.useState)(!1),[ze,Be]=(0,G.useState)(!1),[C,nt]=(0,G.useState)(null),[it,E]=(0,G.useState)(null),[D,O]=(0,G.useState)(null),[P,F]=(0,G.useState)(null),[Tt,Ft]=(0,G.useState)(!1),[B,H]=(0,G.useState)(Ut),[W,Kt]=(0,G.useState)(()=>new URLSearchParams(window.location.search).get(`job`)===null&&localStorage.getItem(`oc.sched.view`)===`calendar`?`calendar`:`list`),Yt=e=>{localStorage.setItem(`oc.sched.view`,e),Kt(e)},[Zt,Qt]=(0,G.useState)(null),[q,$t]=(0,G.useState)(()=>{let e=new Date;return{year:e.getFullYear(),month:e.getMonth()}}),en=(0,G.useMemo)(()=>{let e=[];for(let t of x??[]){if(!t.supported||t.error!==null)continue;let n=t.kind===`openclaw`&&t.manageSupported;for(let r of t.jobs)Ht(r,B)&&e.push({instanceName:t.instanceName,canEdit:n,job:r})}return e},[x,B]),tn=(0,G.useMemo)(()=>Zt===`year`?an(q.year):rn(q.year,q.month),[Zt,q]),nn=(0,G.useMemo)(()=>bn(en,tn.startMs,tn.endMs),[en,tn]),J=(0,G.useRef)(null),sn=e=>{let t=nn.byItemId.get(e.itemId);t===void 0||!t.canEdit||t.job.id===null||(J.current=e.id,gn(t.instanceName,t.job))},Y=(0,G.useCallback)(async()=>{Fe(!0),Be(!1);try{ke(await e({}))}catch{Be(!0)}finally{Fe(!1)}},[e]);(0,G.useEffect)(()=>{Y()},[Y]);let ln=(0,G.useMemo)(()=>new URLSearchParams(window.location.search).get(`job`),[]),un=(0,G.useRef)(null),dn=(0,G.useRef)(null),fn=Vt(dn,[x,B,W,T()]);(0,G.useEffect)(()=>{x!==null&&un.current!==null&&un.current.scrollIntoView({block:`center`})},[x]);let pn=(0,G.useMemo)(()=>new Intl.DateTimeFormat(T(),{dateStyle:`medium`,timeStyle:`short`}),[]),X=async(e,t,n)=>{nt(e);try{await t(),b.success(n),await Y()}catch(e){b.toast({variant:`error`,title:Ie({code:xn(e)})})}finally{nt(null)}},Z=(0,G.useRef)(0),Q=(0,G.useRef)(0),mn=()=>J.current===null?[]:cn(),hn=async(e,t)=>{if(t.id===null)return;let r=++Z.current;O({name:t.name??t.id,entries:null});try{let i=await n({instanceName:e,jobId:t.id,limit:20});if(r!==Z.current)return;O({name:t.name??t.id,entries:i})}catch(e){if(r!==Z.current)return;O(null),b.toast({variant:`error`,title:Ie({code:xn(e)})})}},gn=async(e,n)=>{if(n.id===null)return;let r=++Q.current;F({instanceName:e,jobId:n.id,loading:!0,name:n.name??``,scheduleKind:`cron`,cronExpr:``,tz:``,everyValue:`1`,everyUnit:`hours`,at:``,message:``,hasMessage:!1,scheduleDirty:!1,messageDirty:!1,nameDirty:!1});try{let i=(await t({instanceName:e,jobId:n.id})).job,a=i.scheduleKind===`every`||i.scheduleKind===`at`?i.scheduleKind:`cron`,o=``;if(a===`at`&&i.scheduleExpr!==null){let e=Date.parse(i.scheduleExpr);Number.isFinite(e)&&(o=new Date(e-new Date(e).getTimezoneOffset()*6e4).toISOString().slice(0,16))}let s=`1`,c=`hours`;if(a===`every`&&i.scheduleExpr!==null){let e=Number(i.scheduleExpr);Number.isFinite(e)&&e>0&&(e%$.days===0?(s=String(e/$.days),c=`days`):e%$.hours===0?(s=String(e/$.hours),c=`hours`):(s=String(Math.max(1,Math.round(e/$.minutes))),c=`minutes`))}if(r!==Q.current)return;F(e=>e===null||e.jobId!==n.id?e:{...e,loading:!1,name:i.name??e.name,scheduleKind:a,cronExpr:a===`cron`?i.scheduleExpr??``:``,tz:i.tz??``,everyValue:s,everyUnit:c,at:o,message:i.message??``,hasMessage:i.message!==null&&!i.messageTruncated})}catch(e){if(r!==Q.current)return;F(null),b.toast({variant:`error`,title:Ie({code:xn(e)})})}},_n=async()=>{if(P===null)return;let e={};if(P.nameDirty&&P.name.trim()===``||P.messageDirty&&P.hasMessage&&P.message.trim()===``){b.toast({variant:`error`,title:ve()});return}if(P.nameDirty&&P.name.trim()!==``&&(e.name=P.name.trim()),P.scheduleDirty){if(P.scheduleKind===`cron`&&P.cronExpr.trim()!==``)e.schedule={kind:`cron`,expr:P.cronExpr.trim(),...P.tz.trim()===``?{}:{tz:P.tz.trim()}};else if(P.scheduleKind===`every`){let t=Number(P.everyValue);Number.isFinite(t)&&t>=1&&(e.schedule={kind:`every`,everyMs:Math.round(t*$[P.everyUnit])})}else if(P.scheduleKind===`at`&&P.at!==``){let t=Date.parse(P.at);Number.isFinite(t)&&(e.schedule={kind:`at`,at:new Date(t).toISOString()})}}if(P.scheduleDirty&&e.schedule===void 0){b.toast({variant:`error`,title:_()});return}if(P.messageDirty&&P.hasMessage&&P.message.trim()!==``&&(e.message=P.message.trim()),Object.keys(e).length===0){F(null);return}let t=Q.current;Ft(!0);try{await o({instanceName:P.instanceName,jobId:P.jobId,patch:e}),b.success($e()),t===Q.current&&F(null),await Y()}catch(e){b.toast({variant:`error`,title:Ie({code:xn(e)})})}finally{Ft(!1)}},vn=x?.reduce((e,t)=>e+t.jobs.length,0)??0;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{style:{display:`flex`,flexWrap:`wrap`,alignItems:`flex-start`,gap:8,marginBottom:12},children:[(0,K.jsx)(`p`,{className:`oc-admin__hint`,style:{flex:1,margin:0},children:h()}),(0,K.jsxs)(`div`,{className:`oc-sched__viewtoggle`,role:`group`,"aria-label":me(),children:[(0,K.jsx)(I,{variant:W===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":rt(),title:rt(),"aria-pressed":W===`list`,onClick:()=>Yt(`list`),children:(0,K.jsx)(st,{})}),(0,K.jsx)(I,{variant:W===`calendar`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":l(),title:l(),"aria-pressed":W===`calendar`,onClick:()=>Yt(`calendar`),children:(0,K.jsx)(qt,{})})]}),(0,K.jsxs)(I,{variant:`ghost`,size:`sm`,onClick:()=>void Y(),disabled:Pe,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,K.jsx)(ht,{size:14,"aria-hidden":!0}),Se()]})]}),x!==null&&vn>0?(0,K.jsxs)(Bt,{q:B.q,onQChange:e=>H(t=>({...t,q:e})),searchPlaceholder:ot(),onReset:()=>H(Ut),canReset:Wt(B),children:[(0,K.jsxs)(N,{value:B.state,onValueChange:e=>H(t=>({...t,state:e})),children:[(0,K.jsx)(A,{size:`sm`,className:`w-40`,children:(0,K.jsx)(k,{})}),(0,K.jsxs)(j,{children:[(0,K.jsx)(M,{value:`all`,children:fe()}),(0,K.jsx)(M,{value:`active`,children:Re()}),(0,K.jsx)(M,{value:`paused`,children:oe()}),(0,K.jsx)(M,{value:`auto-disabled`,children:a()})]})]}),(0,K.jsxs)(N,{value:B.result,onValueChange:e=>H(t=>({...t,result:e})),children:[(0,K.jsx)(A,{size:`sm`,className:`w-40`,children:(0,K.jsx)(k,{})}),(0,K.jsxs)(j,{children:[(0,K.jsx)(M,{value:`all`,children:ae()}),(0,K.jsx)(M,{value:`ok`,children:Ce()}),(0,K.jsx)(M,{value:`error`,children:v()}),(0,K.jsx)(M,{value:`running`,children:be()}),(0,K.jsx)(M,{value:`none`,children:c()})]})]})]}):null,x===null?(0,K.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":Pe,children:ze?ge():Xe()}):W===`calendar`?(0,K.jsxs)(K.Fragment,{children:[ze?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:ge()}):null,x.length===0?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:ee()}):(0,K.jsx)(on,{events:nn.events,mode:Zt,cursor:q,onModeChange:Qt,onCursorChange:$t,onEventClick:sn,footnote:He()})]}):(0,K.jsxs)(K.Fragment,{children:[ze?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:ge()}):null,x.length===0?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:ee()}):null,(0,K.jsx)(`div`,{ref:dn,className:`oc-tablefit`,"data-layout":fn,children:x.map(e=>{let t=e.jobs.filter(e=>Ht(e,B)),n=Wt(B)&&e.jobs.length>0&&t.length===0;return(0,K.jsxs)(`section`,{style:{marginBottom:20},children:[x.length>1||e.error||!e.supported?(0,K.jsxs)(`h3`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:`0.85rem`,fontWeight:600,margin:`0 0 6px`},children:[e.instanceName,(0,K.jsx)(L,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:s({code:e.error})}):e.jobs.length===0?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:at()}):n?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(0,K.jsxs)(zt,{children:[(0,K.jsx)(It,{children:(0,K.jsxs)(Rt,{children:[(0,K.jsx)(R,{children:de()}),(0,K.jsx)(R,{children:ie()}),(0,K.jsx)(R,{children:te()}),(0,K.jsx)(R,{children:p()}),(0,K.jsx)(R,{children:ce()}),(0,K.jsx)(R,{children:g()}),(0,K.jsx)(R,{children:Le()})]})}),(0,K.jsx)(Lt,{children:t.map((t,n)=>{let r=`${e.instanceName}:${t.id??n}`,i=C===r,s=e.manageSupported,c=e.kind===`openclaw`&&s;return(0,K.jsxs)(Rt,{ref:t.id!==null&&t.id===ln?un:void 0,"data-state":t.id!==null&&t.id===ln?`selected`:void 0,children:[(0,K.jsx)(z,{className:`oc-dt__lead font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??se()}),(0,K.jsx)(z,{"data-label":ie(),children:(0,K.jsx)(L,{variant:`secondary`,children:t.agentId})}),(0,K.jsxs)(z,{className:`whitespace-nowrap`,"data-label":te(),children:[(0,K.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(()=>{let e=pt(t.schedule),n=e===null?null:dt(e);return n===null?null:(0,K.jsx)(`span`,{className:`text-muted-foreground`,style:{display:`block`,fontSize:`0.78rem`},children:n})})()]}),(0,K.jsx)(z,{className:`whitespace-nowrap text-muted-foreground`,"data-label":p(),children:t.nextRunAtMs===null?`—`:pn.format(t.nextRunAtMs)}),(0,K.jsx)(z,{"data-label":ce(),children:U(t)===`auto-disabled`?(0,K.jsx)(L,{variant:`destructive`,title:`${t.autoDisabledReason??``}${t.autoDisabledAtMs===null?``:` · ${pn.format(t.autoDisabledAtMs)}`}`,children:a()}):U(t)===`active`?(0,K.jsx)(L,{variant:`secondary`,children:Re()}):U(t)===`paused`?(0,K.jsx)(L,{variant:`outline`,children:oe()}):(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,K.jsxs)(z,{"data-label":g(),children:[(0,K.jsx)(Sn,{status:t.lastRunStatus}),t.lastDelivered===!1?(0,K.jsx)(L,{variant:`destructive`,title:t.lastDeliveryError??je(),children:_e()}):null]}),(0,K.jsx)(z,{className:`oc-dt__actionsrow whitespace-nowrap`,children:t.id===null?(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):i?(0,K.jsx)(ct,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,K.jsxs)(`span`,{className:`oc-cronactions`,children:[c?(0,K.jsx)(I,{variant:`ghost`,size:`icon-sm`,title:Ve(),"aria-label":Ve(),disabled:C!==null,onClick:()=>void X(r,async()=>{let n=await d({instanceName:e.instanceName,jobId:t.id});if(n.ran!==!0&&n.runId===null)throw{data:{code:n.reason??`run_not_started`}}},Je()),children:(0,K.jsx)(ft,{size:14,"aria-hidden":!0})}):null,c&&t.enabled!==null?(0,K.jsx)(I,{variant:`ghost`,size:`icon-sm`,title:V(t)===`pause`?Ae():Ze(),"aria-label":V(t)===`pause`?Ae():Ze(),disabled:C!==null,onClick:()=>void X(r,()=>o({instanceName:e.instanceName,jobId:t.id,patch:{enabled:V(t)===`resume`}}),V(t)===`pause`?Ue():Qe()),children:V(t)===`pause`?(0,K.jsx)(lt,{size:14,"aria-hidden":!0}):(0,K.jsx)(ut,{size:14,"aria-hidden":!0})}):null,c?(0,K.jsx)(I,{variant:`ghost`,size:`icon-sm`,title:Ye(),"aria-label":Ye(),disabled:C!==null,onClick:()=>{J.current=null,gn(e.instanceName,t)},children:(0,K.jsx)(mt,{size:14,"aria-hidden":!0})}):null,c?(0,K.jsx)(I,{variant:`ghost`,size:`icon-sm`,title:We(),"aria-label":We(),disabled:C!==null,onClick:()=>void hn(e.instanceName,t),children:(0,K.jsx)(Jt,{size:14,"aria-hidden":!0})}):null,s?(0,K.jsx)(I,{variant:`ghost`,size:`icon-sm`,title:Ge(),"aria-label":Ge(),disabled:C!==null,onClick:()=>E({instanceName:e.instanceName,jobId:t.id,name:t.name??t.id}),children:(0,K.jsx)(gt,{size:14,"aria-hidden":!0})}):null]})})]},t.id??`${e.instanceName}-${n}`)})})]}):(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:ye()})]},e.instanceName)})}),vn>0?(0,K.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:f()}):null]}),(0,K.jsx)(wt,{open:it!==null,onOpenChange:e=>{e||E(null)},children:(0,K.jsxs)(yt,{children:[(0,K.jsxs)(Ct,{children:[(0,K.jsx)(vt,{children:i()}),(0,K.jsx)(_t,{children:ue({name:it?.name??``})})]}),(0,K.jsxs)(xt,{children:[(0,K.jsx)(St,{children:Oe()}),(0,K.jsx)(bt,{onClick:()=>{let e=it;E(null),e!==null&&X(`${e.instanceName}:${e.jobId}`,()=>u({instanceName:e.instanceName,jobId:e.jobId}),Me())},children:Te()})]})]})}),(0,K.jsx)(Nt,{open:D!==null,onOpenChange:e=>{e||(Z.current++,O(null))},children:(0,K.jsxs)(At,{style:{maxWidth:640},children:[(0,K.jsx)(Ot,{children:(0,K.jsx)(jt,{children:Ne({name:D?.name??``})})}),D?.entries===null?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:Xe()}):D!==null&&D.entries.length===0?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):D===null?null:(0,K.jsx)(`div`,{className:`oc-cronpanel__runs`,style:{maxHeight:420,overflowY:`auto`},children:D.entries.map((e,t)=>(0,K.jsxs)(`div`,{className:`oc-cronpanel__run`,children:[(0,K.jsxs)(`div`,{className:`oc-cronpanel__run-head`,children:[(0,K.jsx)(Sn,{status:e.status}),(0,K.jsx)(`span`,{children:typeof(e.runAtMs??e.ts)==`number`?pn.format(e.runAtMs??e.ts):`—`}),typeof e.durationMs==`number`?(0,K.jsxs)(`span`,{className:`oc-cronpanel__run-dur`,children:[Math.round(e.durationMs/1e3),`s`]}):null]}),e.summary===null?null:(0,K.jsx)(`div`,{className:`oc-cronpanel__run-summary`,children:e.summary}),e.error===null?null:(0,K.jsx)(`div`,{className:`oc-cronpanel__run-error`,children:e.error}),e.delivered===!1?(0,K.jsxs)(`div`,{className:`oc-cronpanel__run-undelivered`,children:[qe({channel:e.deliveryChannel??`—`}),e.deliveryError===null?null:(0,K.jsx)(`span`,{className:`oc-cronpanel__plain`,children:e.deliveryError})]}):null]},t))})]})}),(0,K.jsx)(Nt,{open:P!==null,onOpenChange:e=>{e||(Q.current++,F(null))},children:(0,K.jsxs)(At,{className:`oc-cronedit`,returnFocus:mn,children:[(0,K.jsxs)(Ot,{children:[(0,K.jsx)(jt,{children:le()}),(0,K.jsx)(Mt,{children:De()})]}),P===null?null:P.loading?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:Xe()}):(0,K.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,K.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,K.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:de()}),(0,K.jsx)(Et,{value:P.name,maxLength:200,onChange:e=>F({...P,name:e.target.value,nameDirty:!0})})]}),(0,K.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,K.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:we()}),(0,K.jsxs)(N,{value:P.scheduleKind,onValueChange:e=>F({...P,scheduleKind:e,scheduleDirty:!0}),children:[(0,K.jsx)(A,{children:(0,K.jsx)(k,{})}),(0,K.jsxs)(j,{children:[(0,K.jsx)(M,{value:`cron`,children:Ee()}),(0,K.jsx)(M,{value:`every`,children:ne()}),(0,K.jsx)(M,{value:`at`,children:Ke()})]})]}),P.scheduleKind===`cron`?(0,K.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,K.jsx)(Et,{value:P.cronExpr,onChange:e=>F({...P,cronExpr:e.target.value,scheduleDirty:!0}),placeholder:`30 9 * * *`,style:{fontFamily:`var(--font-mono, monospace)`}}),(0,K.jsx)(Gt,{value:P.tz,onChange:e=>F({...P,tz:e,scheduleDirty:!0}),fallbackTz:pe??void 0})]}):P.scheduleKind===`every`?(0,K.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,K.jsx)(Et,{type:`number`,min:1,value:P.everyValue,onChange:e=>F({...P,everyValue:e.target.value,scheduleDirty:!0}),style:{maxWidth:120}}),(0,K.jsxs)(N,{value:P.everyUnit,onValueChange:e=>F({...P,everyUnit:e,scheduleDirty:!0}),children:[(0,K.jsx)(A,{style:{maxWidth:160},children:(0,K.jsx)(k,{})}),(0,K.jsxs)(j,{children:[(0,K.jsx)(M,{value:`minutes`,children:re()}),(0,K.jsx)(M,{value:`hours`,children:m()}),(0,K.jsx)(M,{value:`days`,children:xe()})]})]})]}):(0,K.jsx)(Xt,{value:P.at,onChange:e=>F({...P,at:e,scheduleDirty:!0})})]}),P.hasMessage?(0,K.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,K.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:et()}),(0,K.jsx)(`textarea`,{className:`oc-cronedit__textarea`,rows:4,value:P.message,onChange:e=>F({...P,message:e.target.value,messageDirty:!0})})]}):null]}),(0,K.jsxs)(kt,{children:[(0,K.jsx)(I,{variant:`ghost`,onClick:()=>F(null),children:Oe()}),(0,K.jsxs)(I,{onClick:()=>void _n(),disabled:P===null||P.loading||Tt,children:[Tt?(0,K.jsx)(ct,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):null,he()]})]})]})})]})}export{Cn as ScheduledTab};
|