@lacneu/atrium 0.71.4 → 0.71.5
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-WBvcqgGb.js → AccessTab-B_hOZpp8.js} +1 -1
- package/dist/assets/{AdvancedFilter-_ukq88Xr.js → AdvancedFilter-CHrlsf4a.js} +1 -1
- package/dist/assets/AgentFilesTab-BkKEuRDd.js +3 -0
- package/dist/assets/AnomaliesTab-u9-3K-lF.js +1 -0
- package/dist/assets/AuditTab-CYmqDWNR.js +1 -0
- package/dist/assets/BridgeTab-C0rgWnuo.js +1 -0
- package/dist/assets/{ChatDefaultsTab-BMko0qfD.js → ChatDefaultsTab-DHxEQm0M.js} +1 -1
- package/dist/assets/{DataTableShell-Cfa_aSH0.js → DataTableShell-D04EM9Zp.js} +1 -1
- package/dist/assets/{DetailChips-B89G7ZGY.js → DetailChips-DYBZDMW5.js} +1 -1
- package/dist/assets/FeedbacksTab-hmGYgwlb.js +1 -0
- package/dist/assets/{FieldLabel-BFUi4eFy.js → FieldLabel-DXrZ-jZW.js} +1 -1
- package/dist/assets/FilesTab-BcrhL8PB.js +1 -0
- package/dist/assets/{FilterBar-Cq7zCsPB.js → FilterBar-McDCuaLr.js} +1 -1
- package/dist/assets/GroupsTab-D0IitvKz.js +1 -0
- package/dist/assets/InstancesTab-B6Pv9uOt.js +1 -0
- package/dist/assets/{IntegrationsTab-BaT3OPXg.js → IntegrationsTab-CwqGvBbR.js} +1 -1
- package/dist/assets/{KpiTab-DdH9BGMB.js → KpiTab-Ct-kkiQm.js} +1 -1
- package/dist/assets/PreferencesTab-D4bQt-DS.js +1 -0
- package/dist/assets/ProjectPage-Ba6YWHAH.js +1 -0
- package/dist/assets/{PromptInjectionsTab-CXXeq11I.js → PromptInjectionsTab-Cq0cq9bR.js} +2 -2
- package/dist/assets/RolesTab-C36Tft_N.js +1 -0
- package/dist/assets/ScheduledTab-CqKvdh3Q.js +1 -0
- package/dist/assets/ServiceAccountsTab-C33Dtnvs.js +1 -0
- package/dist/assets/{SubAgentReportsTab-DXuwwyUm.js → SubAgentReportsTab-BZZgz35X.js} +1 -1
- package/dist/assets/ThemeShowroom-pi2gvnOQ.js +1 -0
- package/dist/assets/{TimeRangePicker-BicJg8jQ.js → TimeRangePicker-4lLXkwg_.js} +1 -1
- package/dist/assets/{TimezoneCombobox-DyM6DN5I.js → TimezoneCombobox-JMlCoWmN.js} +1 -1
- package/dist/assets/TracesTab-CaBG2F9P.js +1 -0
- package/dist/assets/UsersTab-oIR5XnzZ.js +1 -0
- package/dist/assets/VoiceTab-BWquWQ-G.js +1 -0
- package/dist/assets/{api-DFyVOofy.js → api-BilJV3v_.js} +5 -5
- package/dist/assets/{button-DDBwZ_Mu.js → button-9dv2rCon.js} +1 -1
- package/dist/assets/{card-CAZUQg1D.js → card-Bm7W459T.js} +1 -1
- package/dist/assets/check-CqOJd5HV.js +1 -0
- package/dist/assets/chevron-up-pWi7u_A_.js +1 -0
- package/dist/assets/chevrons-up-down-CWR38QEI.js +1 -0
- package/dist/assets/{compatView-NlPlAvmy.js → compatView-CrO1qBCx.js} +1 -1
- package/dist/assets/{dispatchErrorInfo-DfCVCZSt.js → dispatchErrorInfo-Bb8p70Cg.js} +1 -1
- package/dist/assets/{dist-gUiqdn71.js → dist-B5ZuNyna.js} +1 -1
- package/dist/assets/{dist-DLnag5PM.js → dist-BAdv_1OK.js} +1 -1
- package/dist/assets/{dist-CdtcfM9Y.js → dist-CqrxhZ9M.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-CZ5yehqj.js → highlighted-body-OFNGDK62-Btb9KJq1.js} +1 -1
- package/dist/assets/{index-CdwUN8wX.js → index-DU-gHWXa.js} +25 -25
- package/dist/assets/{list-CPeCfmaD.js → list-D6QNuEgi.js} +1 -1
- package/dist/assets/mermaid-GHXKKRXX-B3_VFkZ8.js +1 -0
- package/dist/assets/{pdf-BSXkfPxt.js → pdf-CFmOMsHJ.js} +1 -1
- package/dist/assets/roleDescriptions-BpMhqxQ8.js +1 -0
- package/dist/assets/{table-BALPzgDJ.js → table-Clk0vmat.js} +1 -1
- package/dist/assets/{tabs-DGqgx6SK.js → tabs-Cb9Sl0jx.js} +1 -1
- package/dist/assets/x-CzNvcA7I.js +1 -0
- package/dist/index.html +9 -9
- package/package.json +1 -1
- package/dist/assets/AgentFilesTab-B3CNii1R.js +0 -3
- package/dist/assets/AnomaliesTab-CIq_ZRlZ.js +0 -1
- package/dist/assets/AuditTab-C-eA6aXN.js +0 -1
- package/dist/assets/BridgeTab-CE2kLkwT.js +0 -1
- package/dist/assets/FeedbacksTab-BUnDZOVK.js +0 -1
- package/dist/assets/FilesTab-PvC5WpBF.js +0 -1
- package/dist/assets/GroupsTab-CvlA8MZR.js +0 -1
- package/dist/assets/InstancesTab-DZykopmt.js +0 -1
- package/dist/assets/PreferencesTab-BRgonUG-.js +0 -1
- package/dist/assets/ProjectPage-BKzkLoY6.js +0 -1
- package/dist/assets/RolesTab-Co9HpgoJ.js +0 -1
- package/dist/assets/ScheduledTab-DKUTMnxG.js +0 -1
- package/dist/assets/ServiceAccountsTab-DDomx0Ie.js +0 -1
- package/dist/assets/ThemeShowroom-cWot6Lco.js +0 -1
- package/dist/assets/TracesTab-DC4oWXzp.js +0 -1
- package/dist/assets/UsersTab-DtHsd09F.js +0 -1
- package/dist/assets/VoiceTab-Bho-0sIJ.js +0 -1
- package/dist/assets/check-BUS8MQm3.js +0 -1
- package/dist/assets/chevron-up-DQnmq9g9.js +0 -1
- package/dist/assets/chevrons-up-down-DK_8wrsF.js +0 -1
- package/dist/assets/mermaid-GHXKKRXX-LsfJaHDu.js +0 -1
- package/dist/assets/roleDescriptions-gemjs-mM.js +0 -1
- package/dist/assets/x-CZZGanJv.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$f as r,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$f as r,FR as i,Jf as a,Qf as o,WR as s,Xf as c,Yf as l,Zf as u,ap as d,ep as f,ip as p,np as m,op as h,qf as g,rp as _,sp as v,t as y,tp as b}from"./api-BilJV3v_.js";import{$ as x,Et as S,Q as C,X as w,Z as T,et as E}from"./index-DU-gHWXa.js";var D=t(e(),1);function O(e){return e===`user`?u():e===`all`?c():l({group:e.group})}function k(e){return e===`common`?a():e===`owner`?g():l({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=s(y.admin.listUsers,{}),[t,n]=(0,D.useState)(``),a=s(y.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:v()}),(0,A.jsxs)(w,{value:t,onValueChange:n,children:[(0,A.jsx)(x,{size:`sm`,"aria-label":h(),children:(0,A.jsx)(E,{placeholder:h()})}),(0,A.jsx)(T,{children:(e??[]).map(e=>(0,A.jsx)(C,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):a===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):(0,A.jsxs)(`div`,{className:`oc-introspect`,children:[(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:p()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:a.user.label}),(0,A.jsx)(S,{variant:`secondary`,children:a.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:_()}),a.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:a.groups.map(e=>(0,A.jsx)(S,{variant:`secondary`,children:e.name},e.groupId))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:m()}),a.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:a.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(S,{variant:`default`,children:o()}):null,(0,A.jsx)(S,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(S,{variant:`secondary`,children:e.state})]},`${e.instanceName} ${e.agentId}`))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:b()}),a.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:a.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(S,{variant:`outline`,children:k(e.via)})]},e.key))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:f()}),a.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:a.permissions.map(e=>(0,A.jsx)(S,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ch as r,Sh as i,bh as a,vh as o,wh as s,xh as c,yh as l}from"./api-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ch as r,Sh as i,bh as a,vh as o,wh as s,xh as c,yh as l}from"./api-BilJV3v_.js";import{r as u}from"./dist-CqrxhZ9M.js";import{t as d}from"./x-CzNvcA7I.js";import{t as f}from"./button-9dv2rCon.js";import{$ as p,Q as m,X as h,Z as g,et as _,jt as v,ln as y}from"./index-DU-gHWXa.js";import{r as b}from"./TimeRangePicker-4lLXkwg_.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:s()},{value:`gt`,label:`>`},{value:`gte`,label:`≥`},{value:`lt`,label:`<`},{value:`lte`,label:`≤`}],w=1;function T(){return{id:w++,field:``,op:`eq`,value:``}}function E(e){return e.map(e=>({id:w++,field:e.field,op:e.op,value:String(e.value)}))}function D({fields:e,seed:t,onChange:n}){let s=(0,x.useRef)(t),w=!!(s.current&&s.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(s.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:b(e.value)})))}function M(e,t){let n=k.map(n=>n.id===e?{...n,...t}:n);A(n),j(n)}function N(){A(e=>[...e,T()])}function P(e){let t=k.filter(t=>t.id!==e);A(t),j(t)}let F=k.filter(e=>e.field!==``&&e.value!==``).length;return(0,S.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":D,onClick:()=>O(e=>!e),children:[(0,S.jsx)(u,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),r(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(h,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(p,{size:`sm`,className:`w-40`,children:(0,S.jsx)(_,{placeholder:c()})}),(0,S.jsx)(g,{children:e.map(e=>(0,S.jsx)(m,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(h,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(p,{size:`sm`,className:`w-28`,children:(0,S.jsx)(_,{})}),(0,S.jsx)(g,{children:C.map(e=>(0,S.jsx)(m,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(v,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:a()}),(0,S.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":l(),onClick:()=>P(t.id),children:(0,S.jsx)(d,{})})]},t.id))}),(0,S.jsxs)(f,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(y,{}),o()]})]}):null]})}export{D as t};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Aa as r,Au as i,Ca as a,Cd as o,Cu as s,Da as c,Du as l,Ea as u,Eu as d,FR as f,Fu as p,Gi as m,Iu as h,Ji as g,Ki as _,LR as v,Lu as y,Ma as b,Mu as x,Nu as S,O as C,Oa as w,Ou as T,Pu as ee,Ru as te,Sa as E,Su as D,Ta as O,Td as k,Tu as A,UR as j,VA as M,VR as N,WR as P,Wi as F,Xi as I,Yi as L,_a as R,_u as z,ba as B,bu as V,du as ne,fa as H,fu as U,ga as W,gu as G,ha as re,hu as ie,ja as K,ju as ae,ka as oe,ku as se,ma as q,mu as ce,pa as le,pu as ue,qi as de,t as J,uu as fe,va as pe,vu as me,wa as he,wu as ge,xa as _e,xu as ve,ya as ye,yu as be,zu as xe}from"./api-BilJV3v_.js";import{t as Y}from"./button-9dv2rCon.js";import{$ as Se,B as Ce,Ct as we,Dt as Te,Et as Ee,Q as De,St as Oe,Tt as ke,X as Ae,Z as je,at as Me,bt as Ne,et as Pe,nt as Fe,ot as Ie,q as Le,rn as Re,rt as ze,tt as Be,vt as Ve,wt as He,xt as Ue,yt as We}from"./index-DU-gHWXa.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{i as qe}from"./compatView-CrO1qBCx.js";/* empty css */var X=t(e(),1),Je=2e4,Ye=6e4;function Xe(e){return typeof e!=`number`||e<=0?0:Math.round(e/Je*100)}function Ze(e){return e<=0?0:Math.round(e/Ye*100)}function Z(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function Qe(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var $e=3;function et(e,t){let n=new Map;for(let t of e.split(`
|
|
2
|
+
`))n.set(t,(n.get(t)??0)+1);for(let e of t.split(`
|
|
3
|
+
`))n.set(e,(n.get(e)??0)-1);let r=0,i=0,a=[],o=[];for(let[e,t]of n)t<0?(r+=-t,a.length<$e&&a.push(e)):t>0&&(i+=t,o.length<$e&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function tt(e){return(e instanceof Error?e.message:String(e)).includes(`DASHBOARD_NOT_DEPLOYED`)}function nt(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function rt(){let e=P(J.me.getMe,{host:Le}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=P(J.admin.listInstances,e!==void 0&&t?{}:`skip`),[a,s]=(0,X.useState)(null);(0,X.useEffect)(()=>{!t||!r||r.length===0||(!a||!r.some(e=>e.name===a))&&s(r[0].name)},[t,r,a]);let u=P(J.agents.listAgentsForInstance,t&&a?{instanceName:a}:`skip`),d=P(J.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),m=(0,X.useMemo)(()=>{if(e!==void 0){if(t)return a===null||u===void 0?r!==void 0&&r.length===0?[]:void 0:u.agents.map(e=>({instanceName:a,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(d!==void 0)return d.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,a,u,r,d]),[g,_]=(0,X.useState)(null);(0,X.useEffect)(()=>{!m||m.length===0||(!g||!m.some(e=>$(e)===g))&&_($(m[0]))},[m,g]);let b=m?.find(e=>$(e)===g)??null,E=N(J.agentFiles.listAgentFiles),[D,O]=(0,X.useState)({status:`idle`}),k=b?.instanceName??null,A=b?.agentId??null,j=P(J.compat.forInstance,n&&k!==null?{instanceName:k}:`skip`),M=n&&k!==null?Ce(j,`agentFiles`):null,F=M===null?!1:M===`loading`?null:M.blocked,I=(0,X.useCallback)(async()=>{if(!(k===null||A===null)){O({status:`loading`});try{O({status:`done`,files:(await E({instanceName:k,agentId:A})).files})}catch(e){O({status:`error`,dashboardAbsent:tt(e)})}}},[E,k,A]);(0,X.useEffect)(()=>{F===!1&&I()},[I,F]);let[L,R]=(0,X.useState)(null),z=P(J.agentFileCuration.listCurations,t&&k!==null&&A!==null?{instanceName:k,agentId:A}:`skip`),B=P(J.agentFileCuration.curationSettings,t&&k!==null?{instanceName:k}:`skip`),V=N(J.agentFileCuration.requestCuration),[ne,H]=(0,X.useState)(null),[U,W]=(0,X.useState)(null),{toast:G}=Te(),re=(0,X.useMemo)(()=>{let e=new Map;for(let t of z??[])e.has(t.name)||e.set(t.name,t);return e},[z]),ie=(0,X.useCallback)(async e=>{if(!(k===null||A===null)){H(e);try{let t=await V({instanceName:k,agentId:A,name:e,trigger:`manual`});t.ok?G({title:oe(),variant:`success`}):G({title:w({reason:t.reason??`unknown`}),variant:`error`})}catch{G({title:c(),variant:`error`})}finally{H(null)}}},[V,k,A,G]),K=v(),q=(0,X.useMemo)(()=>new Intl.NumberFormat(K,{maximumFractionDigits:0}),[K]);return e===void 0||m===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:xe()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(Ae,{value:a??``,onValueChange:e=>s(e),children:[(0,Q.jsx)(Se,{size:`sm`,"aria-label":te(),children:(0,Q.jsx)(Pe,{})}),(0,Q.jsx)(je,{children:(r??[]).map(e=>(0,Q.jsx)(De,{value:e.name,children:e.name},e.name))})]}):null,m.length>0?(0,Q.jsxs)(Ae,{value:g??``,onValueChange:e=>_(e),children:[(0,Q.jsx)(Se,{size:`sm`,"aria-label":y(),children:(0,Q.jsx)(Pe,{})}),(0,Q.jsx)(je,{children:m.map(e=>(0,Q.jsx)(De,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:h()})]}),b===null?null:M===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):M!==null&&M.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(Re,{size:14,"aria-hidden":!0}),` `,qe(M.gatewayVersion,M.provider)]}):D.status===`loading`||D.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):D.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[D.dashboardAbsent?C():ee(),` `,!D.dashboardAbsent&&(0,Q.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>void I(),children:o()})]}):D.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:D.files.map(e=>{let n=Xe(e.size),r=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(Ee,{variant:`outline`,children:S()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:x({size:Z(e.size,K)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${r?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:ae({pct:q.format(n)})}),r?(0,Q.jsx)(Re,{size:14,className:`oc-afiles__warn`,"aria-label":i()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(Y,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>R(e),children:t?T():l()}),t&&!e.missing?(0,Q.jsx)(it,{curatable:Ke.includes(e.name),size:e.size??0,budget:B?.budgetChars??null,enabled:B?.enabled??!1,curation:re.get(e.name)??null,inFlight:ne===e.name,onCurate:()=>void ie(e.name),onReview:e=>W(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:se({used:Z(Qe(D.files),K),total:Z(Ye,K),pct:q.format(Ze(Qe(D.files)))})})]}),L&&b?(0,Q.jsx)(at,{instanceName:b.instanceName,agentId:b.agentId,name:L.name,isAdmin:t,onClose:()=>R(null),onSaved:()=>void I()}):null,U?(0,Q.jsx)(ot,{curationId:U,onClose:()=>W(null),onApplied:()=>{W(null),I()}}):null]})}function it({curatable:e,size:t,budget:n,enabled:i,curation:a,inFlight:o,onCurate:s,onReview:c}){return a?.status===`proposed`?(0,Q.jsx)(Y,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>c(a._id),children:K()}):o||a?.status===`dispatched`||a?.status===`applying`?(0,Q.jsx)(Ee,{variant:`outline`,className:`oc-afiles__curate-status`,children:r()}):e&&i&&n!==null&&Ge(t,n)?(0,Q.jsx)(Y,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:s,children:b()}):null}function at({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:a}){let c=N(J.agentFiles.getAgentFile),l=N(J.agentFiles.setAgentFile),u=Te(),[p,m]=(0,X.useState)(null),[h,g]=(0,X.useState)(!1),[_,y]=(0,X.useState)(``),[b,x]=(0,X.useState)(!1),[S,C]=(0,X.useState)(!1),[w,T]=(0,X.useState)(!1),[ee,te]=(0,X.useState)(!1),E=(0,X.useCallback)(async r=>{g(!1);try{let i=await c({instanceName:e,agentId:t,name:n});m({content:i.content,updatedAtMs:i.updatedAtMs}),r||y(i.content),T(!1)}catch{g(!0)}},[c,e,t,n]);(0,X.useEffect)(()=>{E(!1)},[E]);async function O(){if(p!==null){C(!0),te(!1);try{await l({instanceName:e,agentId:t,name:n,content:_,baseUpdatedAtMs:p.updatedAtMs??void 0}),u.success(V({name:n})),a(),await E(!1)}catch(e){nt(e)?T(!0):te(!0)}finally{C(!1)}}}let j=p!==null&&_!==p.content,P=(0,X.useMemo)(()=>p===null?null:et(p.content,_),[p,_]),F=_.length>Je,I=v(),L=(0,X.useMemo)(()=>new Intl.NumberFormat(I),[I]);return(0,Q.jsx)(Be,{open:!0,onOpenChange:e=>!e&&i(),children:(0,Q.jsxs)(Fe,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Me,{children:[(0,Q.jsx)(Ie,{children:d({name:n})}),(0,Q.jsxs)(ze,{children:[A({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,ge()]})]})]}),h?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[me(),` `,(0,Q.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>void E(!1),children:o()})]}):p===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:_,readOnly:!r,spellCheck:!1,onChange:e=>y(e.target.value),"aria-label":d({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:s()}),w?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[z(),` `,(0,Q.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>void E(!0),children:G()})]}):null,ee?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:be()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${F?` is-over`:``}`,children:D({count:L.format(_.length),max:L.format(Je)})}),r?(0,Q.jsx)(Y,{size:`sm`,disabled:!j||S||w,onClick:()=>x(!0),children:S?k():ve()}):null]})]}),(0,Q.jsx)(Ve,{open:b,onOpenChange:x,children:(0,Q.jsxs)(Ue,{children:[(0,Q.jsxs)(He,{children:[(0,Q.jsx)(ke,{children:ie({name:n})}),(0,Q.jsx)(Oe,{children:ce({agent:t})})]}),P?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:ue({added:P.added,removed:P.removed})}),P.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:U()}),P.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,P.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:ne()}),P.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(we,{children:[(0,Q.jsx)(Ne,{children:M()}),(0,Q.jsx)(We,{onClick:()=>void O(),children:fe()})]})]})})]})})}function ot({curationId:e,onClose:t,onApplied:n}){let r=P(J.agentFileCuration.getProposal,{curationId:e}),i=N(J.agentFileCuration.approveCuration),o=j(J.agentFileCuration.rejectCuration),{toast:s}=Te(),[l,d]=(0,X.useState)(null),[p,h]=(0,X.useState)(!1),[y,b]=(0,X.useState)(``),x=v(),S=(0,X.useMemo)(()=>r?et(r.beforeContent,r.proposedContent):null,[r]);async function C(){d(`approve`);try{let t=await i({curationId:e});t.ok?(s({title:u(),variant:`success`}),n()):s({title:t.reason===`conflict`?he():a({reason:t.reason??`unknown`}),variant:`error`})}catch{s({title:c(),variant:`error`})}finally{d(null)}}async function w(n){d(`reject`);try{let r=y.trim();(await o({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?s({title:n?m():O(),variant:`success`}):s({title:B(),variant:`error`}),t()}catch{s({title:c(),variant:`error`})}finally{d(null)}}return(0,Q.jsx)(Be,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Fe,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Me,{children:[(0,Q.jsx)(Ie,{children:r?E({name:r.name}):f()}),(0,Q.jsx)(ze,{children:_e()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:B()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[ye({before:Z(r.beforeSize,x),after:Z(r.proposedSize,x)}),r.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(Re,{size:13,"aria-hidden":!0}),` `,pe()]}):null]}),S?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:R({added:S.added,removed:S.removed})}):null,r.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:F({feedback:r.feedback})}):null,S&&S.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:H()}),(0,Q.jsx)(`ul`,{children:S.sampleRemoved.map((e,t)=>(0,Q.jsx)(`li`,{children:e||`\xA0`},t))})]}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__review-panes oc-afiles__review-panes--2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:le()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:W()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.proposedContent})]})]})]}),p?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:I()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:L(),value:y,onChange:e=>b(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(Y,{variant:`ghost`,onClick:()=>h(!1),disabled:l!==null,children:g()}),(0,Q.jsx)(Y,{variant:`outline`,onClick:()=>void w(!1),disabled:l!==null,children:l===`reject`?k():de()}),(0,Q.jsx)(Y,{variant:`default`,onClick:()=>void w(!0),disabled:l!==null,children:l===`reject`?k():_()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(Y,{variant:`outline`,onClick:()=>h(!0),disabled:l!==null||r==null,children:re()}),(0,Q.jsx)(Y,{variant:`default`,onClick:()=>void C(),disabled:l!==null||r==null,children:l===`approve`?k():q()})]})]})})}export{rt as AgentFilesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$S as r,AS as i,BS as ee,CS as a,DS as te,ES as ne,FS as re,GS as ie,HS as ae,IS as o,JS as oe,KS as se,LS as ce,MS as s,NS as c,OS as l,PS as u,QS as d,RS as le,SS as f,TS as ue,UR as de,US as fe,VS as p,WR as m,WS as pe,XS as me,YS as he,ZS as ge,_S as h,aC as _e,bS as g,cC as _,eC as ve,gS as v,hS as y,iC as ye,jS as be,kS as xe,lC as b,nC as x,oC as S,qS as C,rC as w,sC as T,t as E,tC as D,uC as O,vS as k,wS as A,xS as j,yS as M,zS as Se}from"./api-BilJV3v_.js";import{$ as N,Dt as Ce,Et as P,Fn as we,Pn as F,Q as I,U as Te,X as L,Z as R,at as z,ct as B,et as V,i as Ee,nt as H,o as De,ot as U,q as Oe,tt as W}from"./index-DU-gHWXa.js";import{n as ke}from"./TimeRangePicker-4lLXkwg_.js";import{t as Ae}from"./FilterBar-McDCuaLr.js";import{t as je}from"./DataTableShell-D04EM9Zp.js";import{t as G}from"./dispatchErrorInfo-Bb8p70Cg.js";var K=t(e(),1),q=n(),J=`__all__`,Me=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Ne(e){return e===`open`?O():e===`acknowledged`?b():_()}var Pe=[`info`,`warn`,`critical`],Fe=[`detector`,`agent`,`user`],Ie={kind:`relative`,from:`now-30d`,to:`now`},Le=200,Y=`all`;function X(){let e=we({from:`/settings/anomalies`}),t=F({from:`/settings/anomalies`}),n=e.q??``,f=e.status===Y?J:e.status,h=e.severity??J,g=e.kind??J,[_,v]=(0,K.useState)(J),y=Ee(e.from,e.to),{from:b,to:O}=ke(y),k=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),j=e=>void t({search:t=>({...t,status:e===J?Y:e})}),M=e=>void t({search:t=>({...t,severity:e===J?void 0:e})}),z=e=>void t({search:t=>({...t,kind:e===J?void 0:e})}),H=e=>void t({search:t=>({...t,...De(e)})}),U=Te(),W=Ce(),G=de(E.anomalies.resolveAnomaly),X=(m(E.me.getMe,{host:Oe})?.permissions??[]).includes(`admin.manage`),Z=m(E.anomalies.listAnomalies,{limit:Le,filter:{q:n||void 0,from:b,to:O,anomalyStatus:f===J?void 0:f,severity:h===J?void 0:h,source:_===J?void 0:_,kind:g===J?void 0:g}}),Q=(0,K.useMemo)(()=>{let e=new Set;for(let t of Z??[])e.add(t.kind);return[...e].sort()},[Z]),He=n!==``||f!==`open`||h!==J||_!==J||g!==J||y.kind!==`relative`||y.from!==Ie.from;function Ue(){v(J),t({search:{status:`open`},replace:!0})}async function We(e){if(await U({title:T(),description:(0,q.jsxs)(q.Fragment,{children:[S(),` `,(0,q.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,_e(),` `,(0,q.jsx)(`strong`,{children:ye()}),`.`,` `,w()]}),confirmLabel:x()}))try{await G({anomalyId:e._id,status:`resolved`}),W.success(D(),e.kind)}catch(e){W.error(ve(),e)}}async function Ge(e){try{await G({anomalyId:e._id,status:`acknowledged`}),W.success(r(),e.kind)}catch(e){W.error(d(),e)}}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`p`,{className:`oc-admin__hint`,children:[ge(),` `,(0,q.jsx)(`strong`,{children:me()}),` `,he(),` `,(0,q.jsx)(`strong`,{children:oe()}),` `,C(),` `,(0,q.jsx)(`strong`,{children:se()}),` `,ie(),` `,(0,q.jsx)(`span`,{className:`oc-filter__window`,children:pe()})]}),(0,q.jsxs)(Ae,{q:n,onQChange:k,searchPlaceholder:fe(),timeRange:y,onTimeRangeChange:H,onReset:Ue,canReset:He,children:[(0,q.jsxs)(L,{value:f,onValueChange:j,children:[(0,q.jsx)(N,{size:`sm`,className:`w-36`,children:(0,q.jsx)(V,{})}),(0,q.jsxs)(R,{children:[(0,q.jsx)(I,{value:J,children:ae()}),Me.map(e=>(0,q.jsx)(I,{value:e.value,children:Ne(e.value)},e.value))]})]}),(0,q.jsxs)(L,{value:h,onValueChange:M,children:[(0,q.jsx)(N,{size:`sm`,className:`w-36`,children:(0,q.jsx)(V,{placeholder:p()})}),(0,q.jsxs)(R,{children:[(0,q.jsx)(I,{value:J,children:ce()}),Pe.map(e=>(0,q.jsx)(I,{value:e,children:e},e))]})]}),(0,q.jsxs)(L,{value:_,onValueChange:v,children:[(0,q.jsx)(N,{size:`sm`,className:`w-32`,children:(0,q.jsx)(V,{placeholder:o()})}),(0,q.jsxs)(R,{children:[(0,q.jsx)(I,{value:J,children:re()}),Fe.map(e=>(0,q.jsx)(I,{value:e,children:e},e))]})]}),(0,q.jsxs)(L,{value:g,onValueChange:z,children:[(0,q.jsx)(N,{size:`sm`,className:`w-36`,children:(0,q.jsx)(V,{placeholder:u()})}),(0,q.jsxs)(R,{children:[(0,q.jsx)(I,{value:J,children:c()}),Q.map(e=>(0,q.jsx)(I,{value:e,children:e},e))]})]})]}),(0,q.jsx)(je,{title:s(),rows:Z,emptyHint:f===`open`?be():i(),rowActions:e=>X&&e.status===`open`?[{label:xe(),onSelect:()=>void We(e)},{label:l(),onSelect:()=>void Ge(e)}]:[],columns:[{header:te(),cell:e=>(0,q.jsx)(`span`,{className:`oc-traces__time`,children:B(e.at)}),sort:e=>e.at},{header:u(),cell:e=>(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:ee(),cell:e=>e.occurrenceCount!==null&&e.occurrenceCount>1?(0,q.jsx)(`span`,{className:`oc-traces__time`,title:e.firstAt===null?void 0:le({when:B(e.firstAt)}),children:Se({count:String(e.occurrenceCount)})}):(0,q.jsx)(`span`,{className:`oc-traces__time`,children:`—`}),sort:e=>e.occurrenceCount??0},{header:p(),cell:e=>(0,q.jsx)(ze,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:ne(),cell:e=>(0,q.jsx)(Be,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:o(),cell:e=>(0,q.jsx)(P,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:ue(),cell:e=>(0,q.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,q.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,q.jsx)(Re,{row:e})]}),sort:e=>e.message},{header:A(),cell:e=>(0,q.jsx)($,{row:e}),sort:e=>e.evidence??null},{header:a(),cell:e=>e.correlationId?(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:Ve(e.correlationId)}):(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function Z(e){if(e.kind!==`openclaw.dispatch_failures`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}function Q(e){if(e.kind!==`subagent.failure`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{failedCount:t.failedCount,totalCount:t.totalCount,errorCategories:t.errorCategories}}catch{return{}}}function $({row:e}){let t=F();if(e.kind===`subagent.failure`){let n=Q(e);return(0,q.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,q.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,f()]}):null]})}let n=Z(e);if(!n.dominantCode)return(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`});let r=G(n.dominantCode),i=n.sampleCorrelationId;return(0,q.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,q.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,q.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,q.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:i,limit:100}}),children:[`↗ `,f()]}):null]})}function Re({row:e}){let[t,n]=(0,K.useState)(!1),r=m(E.anomalies.getAnomalyAttachments,t?{anomalyId:e._id}:`skip`);return!e.attachments||e.attachments.length===0?null:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>n(!0),children:[j(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,q.jsx)(W,{open:t,onOpenChange:n,children:(0,q.jsxs)(H,{className:`oc-anomaly__attachments-dialog`,children:[(0,q.jsx)(z,{children:(0,q.jsx)(U,{children:g()})}),r===void 0?(0,q.jsx)(`p`,{className:`oc-traces__muted`,children:M()}):r.length===0?(0,q.jsx)(`p`,{className:`oc-traces__muted`,children:k()}):(0,q.jsx)(`div`,{className:`oc-anomaly__attachments`,children:r.map(e=>(0,q.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,q.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,q.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function ze({severity:e}){return(0,q.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function Be({status:e}){return e===`open`?(0,q.jsx)(P,{variant:`destructive`,children:h()}):e===`acknowledged`?(0,q.jsx)(P,{variant:`secondary`,children:v()}):(0,q.jsx)(P,{variant:`outline`,children:y()})}function Ve(e){return e.length>8?e.slice(0,8):e}export{X as AnomaliesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Gr as r,Hr as i,Kr as a,Ur as o,Vr as s,WR as c,Wr as l,aw as u,cw as d,dw as f,fw as p,hw as m,iw as h,lw as g,mw as _,nw as v,ow as y,pw as b,rw as x,sw as S,t as C,tw as w,uw as T}from"./api-BilJV3v_.js";import{$ as E,Fn as D,Pn as O,Q as k,X as A,Z as j,a as M,ct as N,et as P,i as F,n as I,o as L,s as R}from"./index-DU-gHWXa.js";import{n as ee}from"./TimeRangePicker-4lLXkwg_.js";import{t as z}from"./FilterBar-McDCuaLr.js";import{t as B}from"./AdvancedFilter-CHrlsf4a.js";import{t as V}from"./DataTableShell-D04EM9Zp.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:I,to:`now`},G=`__all__`,K=[{value:`action`,label:a()},{value:`realLabel`,label:r()},{value:`targetLabel`,label:l()},{value:`impersonated`,label:o()},{value:`resource`,label:i()},{value:`resourceId`,label:s()}];function q(){let e=D({from:`/settings/audit`}),t=O({from:`/settings/audit`}),n=e.q??``,r=e.action??G,i=e.impersonated??G,a=e.resource??G,o=F(e.from,e.to),s=(0,H.useMemo)(()=>R(e.adv),[e.adv]),{from:l,to:I}=ee(o),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,action:e===G?void 0:e})}),Y=e=>void t({search:t=>({...t,impersonated:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,resource:e===G?void 0:e})}),Z=e=>void t({search:t=>({...t,...L(e)})}),Q=e=>void t({search:t=>({...t,adv:M(e)}),replace:!0}),$=c(C.admin.listAudit,{filter:{q:n||void 0,from:l,to:I,action:r===G?void 0:r,resource:a===G?void 0:a,impersonated:i===G?void 0:i===`yes`,advanced:s.length>0?s:void 0}}),te=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.action);return[...e].sort()},[$]),ne=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])t.resource&&e.add(t.resource);return[...e].sort()},[$]),re=n!==``||r!==G||i!==G||a!==G||s.length>0||o.kind!==`relative`||o.from!==W.from;function ie(){t({search:{},replace:!0})}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`oc-admin__hint`,children:[m(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:_()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:b(),timeRange:o,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(A,{value:r,onValueChange:J,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{placeholder:p()})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(k,{value:G,children:f()}),te.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]}),(0,U.jsxs)(A,{value:i,onValueChange:Y,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(k,{value:G,children:T()}),(0,U.jsx)(k,{value:`yes`,children:g()}),(0,U.jsx)(k,{value:`no`,children:d()})]})]}),(0,U.jsxs)(A,{value:a,onValueChange:X,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{placeholder:S()})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(k,{value:G,children:y()}),ne.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:s,onChange:Q}),(0,U.jsx)(V,{title:u(),rows:$,emptyHint:h(),columns:[{header:x(),cell:e=>N(e.at),sort:e=>e.at},{header:p(),cell:e=>e.action,sort:e=>e.action},{header:v(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:w(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:S(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{q as AuditTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$l as r,$v as i,Ay as a,Bv as o,Cy as s,D as c,Dy as l,Ey as u,Fy as d,Gl as f,Gv as p,Hl as m,Hv as h,Jl as g,Jv as _,Kl as v,Kv as y,Ll as b,Lv as x,My as ee,Ny as te,Oy as ne,Py as re,Ql as ie,Qv as S,Rv as ae,Sy as oe,Ty as se,UR as ce,Ul as le,Uv as ue,VR as de,Vl as fe,Vv as pe,WR as C,Wl as me,Wv as he,Xl as ge,Xv as _e,Yl as ve,Yv as ye,Zl as be,Zv as w,_b as xe,_y as Se,ay as Ce,by as we,cb as Te,cy as Ee,db as De,dr as Oe,dy as ke,ey as Ae,fb as je,fr as Me,fy as Ne,gb as Pe,gr as Fe,gy as Ie,hy as Le,ib as Re,iy as ze,jy as Be,k as Ve,ky as He,lb as Ue,lr as We,ly as Ge,mb as Ke,my as qe,ny as Je,oy as Ye,pb as Xe,pr as Ze,py as Qe,ql as $e,qv as et,rb as tt,ry as nt,sb as rt,sy as it,t as T,ty as at,ub as ot,ur as st,uy as ct,vy as lt,wy as ut,xy as dt,yy as ft,zv as E}from"./api-BilJV3v_.js";import{r as D}from"./dist-CqrxhZ9M.js";import{t as pt}from"./chevron-up-pWi7u_A_.js";import{t as mt}from"./chevrons-up-down-CWR38QEI.js";import{i as ht,n as O,o as gt,r as _t,s as vt}from"./FieldLabel-DXrZ-jZW.js";import{i as yt,n as bt,r as xt,t as St}from"./tabs-Cb9Sl0jx.js";import{t as Ct}from"./button-9dv2rCon.js";import{$ as k,An as A,Bt as wt,Dt as Tt,Et as j,F as Et,Fn as Dt,Pn as Ot,Q as M,Rt as kt,X as N,Z as P,at as At,bn as jt,ct as Mt,et as F,jn as I,jt as L,lt as R,nt as Nt,on as z,ot as Pt,q as Ft,rn as B,rt as It,tt as Lt,ut as Rt,zt}from"./index-DU-gHWXa.js";import{r as Bt}from"./locales-CPjguROj.js";import{a as V,i as H,n as Vt,o as U,r as W,t as Ht}from"./table-Clk0vmat.js";import{t as Ut}from"./FilterBar-McDCuaLr.js";import{a as Wt,n as Gt,o as Kt,r as qt,s as Jt,t as Yt}from"./compatView-CrO1qBCx.js";import{t as G}from"./dispatchErrorInfo-Bb8p70Cg.js";var Xt=c(`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`}]]),Zt=c(`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 Qt(e){return e.filter(e=>e.state===`error`)}function $t(e){return e.reachable&&Qt(e.targets).length===0}function en(e){return $t(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function tn(e){return e.state===`error`&&e.lastErrorCode!==null}function nn(e){return!!e.lastDownstreamRejectCode}function q(e){return e.kind??`openclaw`}function rn(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function an(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 rn(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__`,on={q:``,state:Y,instance:Y,version:Y},X={connected:0,error:1,idle:2};function sn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function cn(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 ln(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function un(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 Kt(e,r)??Z(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Z(t.targetLabel,n.targetLabel)}}function dn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=ln(t.key,e),a=ln(t.key,r);return i&&a?0:i?1:a?-1:n*un(t.key,e,r)})}function fn(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 pn(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 mn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Kt(e,t)??Z(e,t))}var Q=n();function hn({connections:e,displayByInstance:t}){let[n,r]=(0,K.useState)(on),[i,a]=(0,K.useState)(null),s=(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),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null})),[e,t]),c=(0,K.useMemo)(()=>fn(s),[s]),l=(0,K.useMemo)(()=>pn(s),[s]),u=(0,K.useMemo)(()=>mn(s),[s]),d=(0,K.useMemo)(()=>dn(cn(s,n),i),[s,n,i]);function f(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:at()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(Ut,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:S(),onReset:()=>r(on),canReset:sn(n),children:[(0,Q.jsxs)(N,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(k,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(F,{placeholder:_e()})}),(0,Q.jsxs)(P,{children:[(0,Q.jsx)(M,{value:Y,children:w()}),c.map(e=>(0,Q.jsx)(M,{value:e,children:_n(e)},e))]})]}),(0,Q.jsxs)(N,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(k,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(F,{placeholder:ye()})}),(0,Q.jsxs)(P,{children:[(0,Q.jsx)(M,{value:Y,children:w()}),l.map(e=>(0,Q.jsx)(M,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(N,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(k,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(F,{placeholder:_()})}),(0,Q.jsxs)(P,{children:[(0,Q.jsx)(M,{value:Y,children:w()}),u.map(e=>(0,Q.jsx)(M,{value:e,children:e},e))]})]})]}),d.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:et()}):(0,Q.jsxs)(Ht,{className:`oc-conn__table`,children:[(0,Q.jsx)(V,{children:(0,Q.jsxs)(U,{children:[(0,Q.jsx)($,{label:y(),sortKey:`target`,sort:i,onSort:f}),(0,Q.jsx)($,{label:p(),sortKey:`state`,sort:i,onSort:f}),(0,Q.jsx)($,{label:he(),sortKey:`instance`,sort:i,onSort:f}),(0,Q.jsx)($,{label:ue(),sortKey:`host`,sort:i,onSort:f}),(0,Q.jsx)($,{label:h(),sortKey:`version`,sort:i,onSort:f}),(0,Q.jsx)(H,{children:pe()}),(0,Q.jsx)($,{label:o(),sortKey:`lastOk`,sort:i,onSort:f})]})}),(0,Q.jsx)(Vt,{children:d.map(e=>(0,Q.jsx)(gn,{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)(H,{"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)(pt,{size:13,"aria-hidden":!0}):(0,Q.jsx)(D,{size:13,"aria-hidden":!0}):(0,Q.jsx)(mt,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function gn({r:e}){let t=tn(e)?G(e.lastErrorCode):null,n=nn(e)?G(e.lastDownstreamRejectCode):null;return(0,Q.jsxs)(K.Fragment,{children:[(0,Q.jsxs)(U,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Q.jsx)(W,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Q.jsx)(W,{children:(0,Q.jsx)(vn,{state:e.state})}),(0,Q.jsx)(W,{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)(W,{children:(0,Q.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Q.jsx)(W,{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)(W,{children:(0,Q.jsx)(`span`,{className:`oc-conn__stats`,children:Ae({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Q.jsx)(W,{children:e.lastOkAt?(0,Q.jsx)(`span`,{className:`oc-traces__mono`,children:R(e.lastOkAt)}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Q.jsx)(U,{className:`oc-conn__detail-row`,children:(0,Q.jsxs)(W,{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?` · ${R(e.lastErrorAt)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.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?` · ${R(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function _n(e){return e===`connected`?E():e===`error`?ae():x()}function vn({state:e}){return e===`connected`?(0,Q.jsx)(j,{variant:`secondary`,children:E()}):e===`error`?(0,Q.jsx)(j,{variant:`destructive`,children:ae()}):(0,Q.jsx)(j,{variant:`outline`,children:x()})}function yn(){return C(T.bridgeHealth.getBridgeHealth,{})}function bn(){let e=yn(),t=C(T.compat.getBridgeCompat,{}),n=C(T.me.getMe,{host:Ft})?.role===`admin`,r=C(T.admin.listInstances,n?{}:`skip`),i=C(T.agents.usageForInstances,n?{}:`skip`),a=Ot(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=an(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=Dt({from:`/settings/bridge`}),l=Ot({from:`/settings/bridge`}),u=t?.compat??null,d=t===void 0?`loading`:t===null?`nodata`:`ready`,f=u!==null&&Gt(u,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(xn,{health:e,compat:t,onSeeAnomalies:o}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:dt()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:we()}),(0,Q.jsxs)(Ht,{children:[(0,Q.jsx)(V,{children:(0,Q.jsxs)(U,{children:[(0,Q.jsx)(H,{children:Ze()}),(0,Q.jsx)(H,{children:Me()}),(0,Q.jsx)(H,{children:Oe()}),(0,Q.jsx)(H,{children:st()}),(0,Q.jsx)(H,{children:We()})]})}),(0,Q.jsx)(Vt,{children:i.flatMap(e=>{let t=Et(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Q.jsxs)(U,{children:[(0,Q.jsx)(W,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Q.jsx)(W,{children:t.provider}),(0,Q.jsx)(W,{children:t.label}),(0,Q.jsx)(W,{children:(0,Q.jsxs)(j,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Q.jsx)(W,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Q.jsxs)(St,{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)(xt,{className:`w-full`,children:s.map(e=>(0,Q.jsxs)(yt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(z,{size:13,"aria-hidden":!0}),J(e.key)]},e.key))}),s.map(e=>(0,Q.jsx)(bt,{value:e.key,children:(0,Q.jsx)(Sn,{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:b()}):null]})}function xn({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,a=t&&t!==null?(0,Q.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:Wt(t.bridgeVersion)}),i?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:be(),children:[`(`,i,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,ge({build:t.buildVersion??`?`})]}):null,` · `,ve(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?g():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ne()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:ke()});let o=Qt(e.targets),s=!e.reachable,c=en(e),l=e.unreachableInstances??[],u=c===`ok`?`ok`:c===`gateways_unreachable`?`warn`:`error`,d=Mt(e.checkedAt),f=e.startedAt==null?null:Mt(e.startedAt);return(0,Q.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${u}`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:c===`ok`?(0,Q.jsx)(A,{size:22}):s||c===`gateways_unreachable`?(0,Q.jsx)(Zt,{size:22}):(0,Q.jsx)(B,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:c===`ok`?ct():c===`gateways_unreachable`?Ye({count:l.length}):s?Ge():Ee({count:o.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(Xt,{size:12,"aria-hidden":!0}),` `,it({time:d})]}),f?(0,Q.jsx)(`span`,{children:ze({time:f})}):null,a]}),c===`gateways_unreachable`?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:Ce({names:l.join(`, `)})}):null,s?(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:nt()})]})}function Sn({providerKey:e,connections:t,instances:n,manifest:i,compatStatus:a,compatReachable:o,protocol:s}){let c=i?Jt(i,e):null,l=new Map;for(let e of n)l.set(e.name,e.displayName??e.name);let u=[],d=new Set;for(let n of t){if(!n.instanceName||d.has(n.instanceName))continue;d.add(n.instanceName);let t=n.gatewayVersion??null;u.push({instanceName:n.instanceName,displayName:l.get(n.instanceName)??n.instanceName,version:t,state:Yt(t,e,i)})}let f=u.map(e=>e.state),p=f.includes(`beyond`)?`beyond`:f.length>0&&f.every(e=>e===`supported`)?`supported`:null,[m,h]=(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)(z,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:J(e)}),p?(0,Q.jsx)(j,{variant:p===`beyond`?`destructive`:`secondary`,children:qt(p)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:r()}),(0,Q.jsx)(wn,{providerName:J(e),support:c,compatStatus:a,compatReachable:o,manifest:i,instanceRows:u}),s?(0,Q.jsx)(Cn,{protocol:s}):null,(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":m,onClick:()=>h(e=>!e),children:[m?(0,Q.jsx)(D,{size:13,"aria-hidden":!0}):(0,Q.jsx)(I,{size:13,"aria-hidden":!0}),Je({count:t.length})]}),m?(0,Q.jsx)(hn,{connections:t,displayByInstance:l}):null]})}function Cn({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:[ft(),i.length>0?(0,Q.jsx)(j,{variant:`destructive`,children:Se({count:i.length})}):a>0?(0,Q.jsx)(j,{variant:`destructive`,children:Ie()}):(0,Q.jsx)(j,{variant:`secondary`,children:lt()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[Le({version:e.vendoredVersion}),r?` · `+qe({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ve({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)(D,{size:13,"aria-hidden":!0}):(0,Q.jsx)(I,{size:13,"aria-hidden":!0}),Qe({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 wn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ne()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ie()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:$e()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:Fe({provider:a})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:f({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:g()}),e?(0,Q.jsx)(On,{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:Wt(e.version)}),(0,Q.jsx)(j,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:qt(e.state)})]},e.instanceName))})]})}function Tn({instance:e,onClose:t}){return(0,Q.jsx)(Lt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(Nt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(At,{children:[(0,Q.jsx)(Pt,{children:xe({instance:e.displayName??e.name})}),(0,Q.jsx)(It,{children:Pe()})]}),(0,Q.jsx)(Dn,{instance:e,onClose:t})]})})}function En({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)(A,{"aria-hidden":!0}):(0,Q.jsx)(B,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?se():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,ut()]}):null}function Dn({instance:e,onClose:t}){let n=ce(T.admin.upsertInstanceConfig),r=de(T.bridge.validateMediaPaths),i=Tt(),o=Bt(e.config?.contentLocale,void 0),[c,f]=(0,K.useState)(()=>ht(e.config??{},o)),[p,m]=(0,K.useState)(!1),[h,g]=(0,K.useState)(!1),[_,v]=(0,K.useState)(null),y=c.inboundMediaMode===`shared-fs`,b=c.mediaMode===`shared-fs`,x=y||b;async function ie(){g(!0),v(null);try{v(await r({instanceName:e.name,inboundMediaMode:c.inboundMediaMode,mediaMode:c.mediaMode}))}catch(e){i.error(He(),e)}finally{g(!1)}}async function S(){m(!0);try{let r=e.config??{};await n({instanceId:e._id,config:_t(c,r,o)}),t()}catch(e){i.error(Ue(),e)}finally{m(!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)(O,{label:Ke(),help:Te()}),(0,Q.jsxs)(N,{value:c.mediaMode,onValueChange:e=>f({...c,mediaMode:e}),children:[(0,Q.jsx)(k,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(F,{})}),(0,Q.jsx)(P,{children:vt.map(e=>(0,Q.jsx)(M,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(O,{label:Xe(),help:rt()}),(0,Q.jsxs)(N,{value:c.inboundMediaMode,onValueChange:e=>f({...c,inboundMediaMode:e}),children:[(0,Q.jsx)(k,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(F,{})}),(0,Q.jsx)(P,{children:gt.map(e=>(0,Q.jsx)(M,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(O,{label:je(),help:Re()}),(0,Q.jsx)(L,{type:`number`,min:1,max:4096,className:`w-full`,value:c.mediaMaxMb,onChange:e=>f({...c,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),x&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[y&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(O,{label:d(),help:re()}),(0,Q.jsx)(L,{className:`w-full`,spellCheck:!1,value:c.inboundAgentMount,onChange:e=>f({...c,inboundAgentMount:e.target.value})})]}),b&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(O,{label:te(),help:ee()}),(0,Q.jsx)(L,{className:`w-full`,spellCheck:!1,value:c.outboundAgentMount,onChange:e=>f({...c,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(Rt,{checked:c.rehydration,onCheckedChange:e=>f({...c,rehydration:e===!0})}),(0,Q.jsx)(O,{label:De(),help:tt()})]}),x&&_!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:_.reachable?!_.inbound&&!_.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(B,{"aria-hidden":!0}),oe({reason:_.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(En,{label:l(),result:_.inbound}),(0,Q.jsx)(En,{label:u(),result:_.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ne()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(B,{"aria-hidden":!0}),s()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[x&&(0,Q.jsxs)(Ct,{variant:`outline`,size:`sm`,onClick:()=>void ie(),disabled:h,children:[h?(0,Q.jsx)(jt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,h?a():Be()]}),(0,Q.jsx)(Ct,{size:`sm`,onClick:()=>void S(),disabled:p,children:ot()})]})]})})}function On({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(kt,{children:[(0,Q.jsx)(wt,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?me():le({count:e.length}),(0,Q.jsx)(D,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(zt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:m()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(j,{variant:`secondary`,children:e},e))})]})]})}export{bn as BridgeTab,Tn as InstanceConfigDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ao as r,Cd as i,Co as a,Do as o,Eo as s,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ao as r,Cd as i,Co as a,Do as o,Eo as s,FR as c,Mo as l,Oo as u,Ru as d,Td as f,To as p,UR as m,VR as h,WR as g,au as _,cu as v,eu as y,hb as b,hr as x,iu as S,jo as C,ko as w,nu as T,ou as E,ru as D,su as O,t as k,tu as A,vd as j,wo as M,yd as N}from"./api-BilJV3v_.js";import{t as P}from"./button-9dv2rCon.js";import{$ as F,B as I,M as L,N as R,Q as z,X as B,Z as V,et as H,jt as U,rn as W,ut as G}from"./index-DU-gHWXa.js";import{i as K}from"./compatView-CrO1qBCx.js";/* empty css */var q=t(e(),1),J=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function Y(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 X=n();function Z({instance:e}){let t=m(k.admin.upsertInstanceConfig),n=g(k.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[i,a]=(0,q.useState)(r),[s,c]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{a(r),c(`idle`)},[e._id,r]);let l=`__none__`,d=i!==r;async function p(){c(`saving`);try{let n={...e.config??{}};i===``||i===l?delete n.converterAgentId:n.converterAgentId=i,await t({instanceId:e._id,config:n}),c(`done`)}catch{c(`error`)}}let h=n?.agents??[];return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:w()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:u()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsxs)(B,{value:i===``?l:i,onValueChange:e=>a(e===l?``:e),children:[(0,X.jsx)(F,{className:`oc-cdefaults__select`,"aria-label":w(),children:(0,X.jsx)(H,{placeholder:o()})}),(0,X.jsxs)(V,{children:[(0,X.jsx)(z,{value:l,children:o()}),h.map(e=>(0,X.jsx)(z,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,X.jsx)(P,{size:`sm`,disabled:!d||s===`saving`,onClick:()=>void p(),children:s===`saving`?f():T()})]}),s===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:A()}):null,s===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:y()}):null]})}function Q({instance:e}){let t=m(k.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,i=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[a,o]=(0,q.useState)(n),[c,l]=(0,q.useState)(i===null?``:String(i)),[u,d]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{o(n),l(i===null?``:String(i)),d(`idle`)},[e._id,n,i]);let h=c.trim(),g=h===``?null:/^\d+$/.test(h)?Number.parseInt(h,10):NaN,_=!a||g===null||Number.isInteger(g)&&g>=4e3&&g<=6e4,v=a!==n||(g??null)!==i;async function b(){d(`saving`);try{let n={...e.config??{}};n.curationEnabled=a,!a||g===null||Number.isNaN(g)?delete n.curationBudgetChars:n.curationBudgetChars=g,await t({instanceId:e._id,config:n}),d(`done`)}catch{d(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,X.jsx)(G,{checked:a,onCheckedChange:e=>o(e===!0),"aria-label":r()}),(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:r()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(U,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:c,onChange:e=>l(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!_,"aria-label":s(),disabled:!a}),(0,X.jsx)(P,{size:`sm`,disabled:!v||!_||u===`saving`,onClick:()=>void b(),children:u===`saving`?f():T()})]}),_?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:p()}),u===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:A()}):null,u===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:y()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:M()})]})}function $({instance:e}){let t=m(k.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,q.useState)(n===null?``:String(n)),[o,s]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{i(n===null?``:String(n)),s(`idle`)},[e._id,n]);let c=r.trim(),u=c===``?null:/^\d+$/.test(c)?Number.parseInt(c,10):NaN,d=u===null||Number.isInteger(u)&&u>=1e3&&u<=2e5,p=(u??null)!==n;async function h(){s(`saving`);try{let n={...e.config??{}};u===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=u,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:l()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(U,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!d}),(0,X.jsx)(P,{size:`sm`,disabled:!p||!d||o===`saving`,onClick:()=>void h(),children:o===`saving`?f():T()})]}),d?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:a()}),o===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:A()}):null,o===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:y()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:C()})]})}function ee(){let e=h(k.agentFiles.getChatDefaults),[t,n]=(0,q.useState)({status:`loading`}),r=g(k.admin.listInstances,{}),[a,o]=(0,q.useState)(null);(0,q.useEffect)(()=>{!r||r.length===0||(!a||!r.some(e=>e.name===a))&&o(r[0].name)},[r,a]);let s=(r?.length??0)>1,l=r!==void 0&&r.length===0,u=g(k.compat.forInstance,a?{instanceName:a}:`skip`),f=a?I(u,`configDefaults`):`loading`,p=f===`loading`?null:f.blocked,m=(0,q.useMemo)(()=>s&&a?{instanceName:a}:{},[s,a]),y=(0,q.useRef)(0),C=(0,q.useCallback)(async()=>{let t=++y.current;n({status:`loading`});try{let r=Y(await e(m));if(y.current!==t)return;n({status:`done`,current:r})}catch{if(y.current!==t)return;n({status:`error`})}},[e,m]);(0,q.useEffect)(()=>{p===!1&&(s&&!a||C())},[C,p,s,a]);let w=t.status===`done`?t.current:null,T=(0,q.useMemo)(()=>J.map(e=>({id:e,label:R(e)})),[]),A=(0,q.useMemo)(()=>[{id:`fast`,label:N()},{id:`standard`,label:j()}],[]);return(0,X.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:v()}),s&&a?(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:d()}),(0,X.jsxs)(B,{value:a,onValueChange:e=>o(e),children:[(0,X.jsx)(F,{size:`sm`,"aria-label":d(),children:(0,X.jsx)(H,{})}),(0,X.jsx)(V,{children:(r??[]).map(e=>(0,X.jsx)(z,{value:e.name,children:e.name},e.name))})]})]}):null,l?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:b()}):f===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):f.blocked?(0,X.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,X.jsx)(W,{size:14,"aria-hidden":!0}),` `,K(f.gatewayVersion,f.provider)]}):t.status===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):t.status===`error`?(0,X.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[D(),` `,(0,X.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void C(),children:i()})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:O()}),(0,X.jsx)(L,{options:T,value:w?.thinkingDefault??null,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:E()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:_()}),(0,X.jsx)(L,{options:A,value:w===null||w.fastModeDefault===null?null:w.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:S()})]}),(0,X.jsx)(`p`,{className:`oc-cdefaults__note`,children:x()})]}),(()=>{let e=r?.find(e=>e.name===(a??r[0]?.name));return e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{instance:e}),(0,X.jsx)(Q,{instance:e}),(0,X.jsx)(Z,{instance:e})]}):null})()]})}export{ee as ChatDefaultsTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Am as r,Fm as i,Im as a,Mm as o,Nm as s,Pm as c,jm as l}from"./api-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Am as r,Fm as i,Im as a,Mm as o,Nm as s,Pm as c,jm as l}from"./api-BilJV3v_.js";import{r as u}from"./dist-CqrxhZ9M.js";import{t as d}from"./chevron-up-pWi7u_A_.js";import{t as f}from"./chevrons-up-down-CWR38QEI.js";import{t as p}from"./button-9dv2rCon.js";import{En as m,It as h,Lt as g,Mt as _,Nt as v,Pt as y,in as b,ln as x,ut as S}from"./index-DU-gHWXa.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-Clk0vmat.js";var k=t(e(),1);function A(e,t){return typeof e==`number`&&typeof t==`number`?e-t:typeof e==`boolean`&&typeof t==`boolean`?!!e-+!!t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:`base`})}function j(e,t,n){return[...e].sort((e,r)=>{let i=t(e),a=t(r),o=i==null,s=a==null;if(o||s)return o&&s?0:o?1:-1;let c=A(i,a);return n===`asc`?c:-c})}var M=n();function N({title:e,rows:t,columns:n,rowActions:A,onAdd:N,addLabel:P=a(),bulkActions:F,emptyHint:I=i(),isExpanded:L,renderExpanded:R}){let[z,B]=(0,k.useState)(new Set),[V,H]=(0,k.useState)(null),U=t??[],W=V?n[V.index]:void 0,G=V&&W?.sort?j(U,W.sort,V.dir):U;function K(e){H(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let q=+!!F+n.length+ +!!A,J=U.length>0&&z.size===U.length,Y=z.size>0&&!J;function X(){B(J?new Set:new Set(U.map(e=>e._id)))}function Z(e){B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,M.jsxs)(`div`,{className:`oc-dt`,children:[(0,M.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,M.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,M.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[z.size>0&&F?F.map(e=>(0,M.jsxs)(p,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(b,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(p,{size:`sm`,onClick:N,children:[(0,M.jsx)(x,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):U.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:I}):(0,M.jsxs)(O,{children:[(0,M.jsx)(C,{children:(0,M.jsxs)(E,{children:[F?(0,M.jsx)(w,{className:`w-8`,children:(0,M.jsx)(S,{"aria-label":s(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":r({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(d,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(f,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,M.jsx)(w,{className:e.className,children:e.header},e.header)}),A?(0,M.jsx)(w,{className:`w-8`}):null]})}),(0,M.jsx)(T,{children:G.map(e=>{let t=A?.(e)??[],r=L?.(e)??!1;return(0,M.jsxs)(k.Fragment,{children:[(0,M.jsxs)(E,{className:`group/row`,children:[F?(0,M.jsx)(D,{children:(0,M.jsx)(S,{"aria-label":o(),checked:z.has(e._id),onCheckedChange:()=>Z(e._id)})}):null,n.map(t=>(0,M.jsx)(D,{className:t.className,children:t.cell(e)},t.header)),A?(0,M.jsx)(D,{children:t.length>0?(0,M.jsxs)(_,{children:[(0,M.jsx)(g,{asChild:!0,children:(0,M.jsx)(p,{variant:`ghost`,size:`icon-sm`,"aria-label":l(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(m,{})})}),(0,M.jsx)(v,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(h,{}):null,(0,M.jsx)(y,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),r&&R?(0,M.jsx)(E,{className:`oc-dt__expansion`,children:(0,M.jsx)(D,{colSpan:q,className:`oc-dt__expansion-cell`,children:R(e)})}):null]},e._id)})})]})]})}export{N as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{Et as t}from"./index-
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{Et as t}from"./index-DU-gHWXa.js";var n=e();function r({icon:e,total:r,items:i}){if(r===0)return(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip oc-group-chip--empty gap-1`,children:[e,`0`]});let a=r-i.length;return(0,n.jsxs)(`div`,{className:`oc-group-detail`,children:[i.map((e,r)=>(0,n.jsxs)(t,{variant:e.highlight?`secondary`:`outline`,className:`oc-group-chip gap-1`,title:e.label,children:[e.marker,(0,n.jsx)(`span`,{className:`oc-group-chip__txt`,children:e.label})]},r)),a>0?(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip`,children:[`+`,a]}):null]})}export{r as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$E as r,AD as i,BE as a,CD as o,DD as s,ED as c,FD as l,FE as u,GE as d,HE as f,IE as p,Ia as m,JE as ee,KE as h,LE as g,MD as _,ND as te,NE as ne,OD as re,PD as ie,PE as ae,QE as v,RE as y,Ra as b,SD as x,TD as S,UE as C,UR as w,VE as T,WE as E,WR as D,XE as O,YE as k,ZE as A,_D as j,aD as M,bD as N,cD as P,dD as F,eD as I,fD as L,gD as R,hD as z,iD as B,jD as V,kD as oe,lD as H,mD as U,nD as W,oD as G,pD as K,qE as q,rD as se,sD as ce,t as J,tD as le,uD as ue,vD as de,wD as fe,xD as pe,yD as me,zE as he}from"./api-BilJV3v_.js";import{t as ge}from"./button-9dv2rCon.js";import{U as _e,ct as Y}from"./index-DU-gHWXa.js";import{t as ve}from"./DataTableShell-D04EM9Zp.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>l(),incorrect:()=>ie(),incoherence:()=>te(),formatting:()=>_(),latency:()=>V(),api_error:()=>i(),other:()=>oe()},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:s()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:c()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:re()})}function be({data:e,reference:t,closeReason:n}){let i=e.snapshot,a=w(J.feedback.respondToFeedback),[s,c]=(0,X.useState)(e.thread),[l,u]=(0,X.useState)(``),[d,f]=(0,X.useState)(!1);async function p(){let t=l.trim();if(!(!t||d)){f(!0);try{await a({feedbackId:e._id,text:t}),c(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),u(``)}finally{f(!1)}}}let m=[];try{m=i.contextJson?JSON.parse(i.contextJson):[]}catch{m=[]}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?` · ${S()}`:``,i.openclawModel?` · ${i.openclawModel}`:``,i.openclawRuntime?` (${i.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:r(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:fe()}),(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:he()}),(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:o()}),s.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:s.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`?x():e.authorRole===`agent`?e.authorLabel??b():pe()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:N()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:me(),value:l,maxLength:2e3,rows:3,onChange:e=>u(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 p(),disabled:!l.trim()||d,children:d?de():j()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:R()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.messageText||z()})]}),i.clientInfo?.sourceWasOpen&&i.displayedText!==void 0?(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.displayedText||z()})]}):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,m.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:L({count:i.contextCount??m.length,truncated:i.contextTruncated?F():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:m.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:ue()}),(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:H()}),(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:P()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[i.clientInfo?.language,i.clientInfo?.timezone,i.clientInfo?.theme?ce({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:[G(),` `,i.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,M()]})]}):null,i.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:i.clientInfo.userAgent}):null]})]})]})}function xe(){let e=D(J.feedback.listForAdmin,{}),t=w(J.feedback.readSnapshot),n=w(J.feedback.deleteFeedback),r=_e(),[i,o]=(0,X.useState)(null),[s,c]=(0,X.useState)({});async function l(e){if(i===e._id){o(null);return}if(!s[e._id]){let n=await t({feedbackId:e._id});c(t=>({...t,[e._id]:n}))}o(e._id)}async function _(e){await r({title:u(),description:ae(),confirmLabel:ne(),destructive:!0})&&(await n({feedbackId:e._id}),i===e._id&&o(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[B(),` `,(0,Z.jsx)(`strong`,{children:se()}),` `,W()]}),(0,Z.jsx)(ve,{title:le(),rows:e,emptyHint:I(),isExpanded:e=>i===e._id&&!!s[e._id],renderExpanded:e=>s[e._id]?(0,Z.jsx)(be,{data:s[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:v(),cell:e=>Y(e.at),sort:e=>e.at},{header:A(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:O(),cell:e=>e.messageRole===`user`?k():ee(),sort:e=>e.messageRole},{header:q(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${h({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:d(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:E(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:C(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:f()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:T()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:m()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:a()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:i===e._id?y():g(),onSelect:()=>void l(e)},{label:p(),onSelect:()=>void _(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{D as t,
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{D as t,ZR as n}from"./api-BilJV3v_.js";import{I as r,L as i,R as a,z as o}from"./index-DU-gHWXa.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.js";var s=t(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),c={media_delivery:{key:`media_delivery`,appliedIn:`bridge`,togglable:!0,placeholders:[`outboundDir`],defaultTemplate:{fr:`[LIVRAISON]
|
|
2
2
|
Pour qu'un fichier que tu génères soit téléchargeable par l'utilisateur dans ce webchat : écris-le sous {outboundDir}/ puis ajoute, dans ta réponse finale, une ligne dédiée EXACTEMENT au format MEDIA:<chemin absolu du fichier>. N'utilise PAS de lien markdown vers un chemin local — il ne serait pas cliquable.`,en:`[DELIVERY]
|
|
3
3
|
To make a file you generate downloadable by the user in this webchat: write it under {outboundDir}/ then add, in your final reply, a dedicated line EXACTLY in the format MEDIA:<absolute file path>. Do NOT use a markdown link to a local path — it would not be clickable.`}},documentary_fetch:{key:`documentary_fetch`,appliedIn:`convex`,togglable:!0,placeholders:[`references`],defaultTemplate:{fr:`Fournis les fichiers source téléchargeables correspondant EXACTEMENT à ces références de documents (un fichier par référence, nommé d'après la référence). Réponds uniquement avec les fichiers, sans commentaire :
|
|
4
4
|
{references}`,en:`Provide the downloadable source files matching EXACTLY these document references (one file per reference, named after the reference). Reply only with the files, no commentary:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$L as r,AL as ee,BL as i,CL as te,DL as a,EL as ne,FL as re,FR as ie,GL as o,HL as s,Ha as c,IL as l,JL as u,KL as d,LL as f,LR as p,ML as m,NL as ae,OL as oe,PL as se,QL as h,RL as ce,SL as le,TL as ue,UL as g,UR as de,VA as fe,VL as _,Va as pe,WL as v,WR as me,XL as he,YL as ge,ZL as _e,eR as ve,jL as ye,kL as y,nR as b,qL as x,t as S,tR as C,wL as w,xL as T,zL as E}from"./api-BilJV3v_.js";import{t as D}from"./button-9dv2rCon.js";import{$ as O,Ct as k,Dn as A,Dt as j,En as M,Et as N,Lt as P,Mt as be,Nt as xe,Pt as F,Q as I,St as Se,Tt as Ce,X as L,Z as R,bt as we,cn as Te,et as z,in as Ee,ut as De,vt as Oe,wt as ke,xt as Ae,yt as je}from"./index-DU-gHWXa.js";import{a as Me,i as B,n as Ne,o as V,r as H,t as Pe}from"./table-Clk0vmat.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return o();case`audio`:return v();case`video`:return g();case`pdf`:return s();case`document`:return _();case`archive`:return i();default:return E()}}function q(){let[e,t]=(0,U.useState)(G),[n,i]=(0,U.useState)(G),[o,s]=(0,U.useState)(G),[g,_]=(0,U.useState)(G),[v,E]=(0,U.useState)(!1),[q,J]=(0,U.useState)(null),Fe=de(S.files.softDelete),Y=j();function Ie(){t(G),i(G),s(G),_(G)}async function Le(){let e=q;if(J(null),e)try{await Fe({fileId:e.id}),Y.success(oe())}catch(e){Y.error(a(),e)}}let X=me(S.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:o===G?void 0:o,category:g===G?void 0:g,includeAutoGenerated:v||void 0}),Re=(0,U.useMemo)(()=>new Intl.DateTimeFormat(p(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:ie()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==G||n!==G||o!==G||g!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:b()}),(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)(O,{size:`sm`,"aria-label":C(),children:(0,W.jsx)(z,{})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(I,{value:G,children:ve()}),(0,W.jsx)(I,{value:`inbound`,children:r()}),(0,W.jsx)(I,{value:`outbound`,children:h()})]})]}),(0,W.jsxs)(L,{value:n,onValueChange:i,children:[(0,W.jsx)(O,{size:`sm`,"aria-label":_e(),children:(0,W.jsx)(z,{})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(I,{value:G,children:he()}),Q.chats.map(e=>(0,W.jsx)(I,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(L,{value:o,onValueChange:s,children:[(0,W.jsx)(O,{size:`sm`,"aria-label":ge(),children:(0,W.jsx)(z,{})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(I,{value:G,children:u()}),Q.instances.map(e=>(0,W.jsx)(I,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(L,{value:g,onValueChange:_,children:[(0,W.jsx)(O,{size:`sm`,"aria-label":x(),children:(0,W.jsx)(z,{})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(I,{value:G,children:d()}),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)(De,{checked:v,onCheckedChange:e=>E(e===!0),"aria-label":c()}),(0,W.jsx)(`span`,{children:c()})]}),$?(0,W.jsxs)(D,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,W.jsx)(Te,{size:14,"aria-hidden":!0}),ye()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?le():te()}):(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:ce()}),(0,W.jsx)(B,{children:f()}),(0,W.jsx)(B,{children:l()}),(0,W.jsx)(B,{children:re()}),(0,W.jsx)(B,{children:se()}),(0,W.jsx)(B,{className:`text-right`,children:ae()})]})}),(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)(N,{variant:`outline`,style:{marginLeft:6},children:pe()}):null]}),(0,W.jsx)(H,{title:e.mimeType,children:K(e.category)}),(0,W.jsx)(H,{children:(0,W.jsx)(N,{variant:`secondary`,children:e.direction===`inbound`?r():h()})}),(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)(be,{children:[(0,W.jsx)(P,{asChild:!0,children:(0,W.jsx)(D,{variant:`ghost`,size:`icon`,"aria-label":ee(),children:(0,W.jsx)(M,{size:16})})}),(0,W.jsxs)(xe,{align:`end`,children:[e.url?(0,W.jsx)(F,{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}),m()]})}):(0,W.jsxs)(F,{disabled:!0,children:[(0,W.jsx)(A,{size:14}),w()]}),(0,W.jsxs)(F,{variant:`destructive`,onSelect:()=>J({id:e._id,filename:e.filename}),children:[(0,W.jsx)(Ee,{size:14}),y()]})]})]})})]},e._id))})]}),ze?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:T({cap:Be})}):null]}),(0,W.jsx)(Oe,{open:q!==null,onOpenChange:e=>!e&&J(null),children:(0,W.jsxs)(Ae,{children:[(0,W.jsxs)(ke,{children:[(0,W.jsx)(Ce,{children:ne()}),(0,W.jsx)(Se,{children:ue()})]}),(0,W.jsxs)(k,{children:[(0,W.jsx)(we,{children:fe()}),(0,W.jsx)(je,{onClick:()=>void Le(),children:y()})]})]})})]})}export{q as FilesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Lm as r,Rm as i}from"./api-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Lm as r,Rm as i}from"./api-BilJV3v_.js";import{t as a}from"./button-9dv2rCon.js";import{cn as o,jt as s,sn as c}from"./index-DU-gHWXa.js";import{t as l}from"./TimeRangePicker-4lLXkwg_.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=i(),children:p,timeRange:m,onTimeRangeChange:h,onReset:g,canReset:_=!0}){let[v,y]=(0,u.useState)(e);(0,u.useEffect)(()=>{y(e)},[e]);let b=(0,u.useRef)(null);function x(e){y(e),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>t(e),f)}(0,u.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);function S(){b.current!==null&&window.clearTimeout(b.current),g()}return(0,d.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,d.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,d.jsx)(c,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(s,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(l,{value:m,onChange:h}):null,(0,d.jsxs)(a,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(o,{}),r()]})]})}export{p as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$d as r,Af as i,Bd as a,Bf as o,Cf as s,D as c,Df as l,Ef as u,Ff as d,Gd as f,Gf as p,Hd as m,Hf as h,If as g,Jd as _,Kd as v,Kf as ee,Ld as y,Lf as b,Mf as te,Nf as x,Of as S,Pf as ne,Qd as C,Rd as w,Rf as T,Sf as E,Tf as re,UR as D,Ud as O,Uf as ie,Vd as k,Vf as A,WR as j,Wd as M,Wf as ae,Xd as N,Yd as P,Zd as F,_f as I,af as oe,bf as se,cf as L,df as R,ef as z,ff as ce,gf as le,hf as ue,if as de,jf as fe,kf as pe,lf as me,mf as he,nf as ge,of as _e,pf as ve,qd as ye,rf as be,sf as xe,t as B,tf as Se,uf as Ce,vf as we,wf as Te,xf as Ee,yf as De,zd as Oe,zf as ke}from"./api-BilJV3v_.js";import{t as Ae}from"./x-CzNvcA7I.js";import{i as V,n as H,r as je,t as Me}from"./tabs-Cb9Sl0jx.js";import{t as U}from"./button-9dv2rCon.js";import{$ as Ne,Dt as W,Et as G,Mn as Pe,Q as Fe,U as Ie,X as Le,Z as Re,_ as ze,an as K,at as Be,et as Ve,jn as He,jt as q,nt as Ue,on as J,ot as We,q as Ge,rt as Ke,tt as qe,ut as Y}from"./index-DU-gHWXa.js";import{t as Je}from"./FilterBar-McDCuaLr.js";import{t as Ye}from"./DataTableShell-D04EM9Zp.js";import{t as X}from"./DetailChips-DYBZDMW5.js";var Xe=c(`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=c(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Ze=c(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),Q=t(e(),1);function Qe(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function $e(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function et(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function tt(e){switch(e){case`admin`:return ve();case`user`:return ce();case`pending`:return R();default:return e}}function nt(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function rt(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}var $=n(),it={name:``,description:``};function at(){let e=j(B.groups.listGroups,{}),t=j(B.me.getMe,{host:Ge})?.role===`admin`,n=D(B.groups.createGroup),r=D(B.groups.updateGroup),s=D(B.groups.deleteGroup),c=Ie(),f=W(),[m,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(it),[E,O]=(0,Q.useState)(null),[k,M]=(0,Q.useState)(``),N=(0,Q.useMemo)(()=>{if(!e)return e;let t=k.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,k]);function P(){y(null),w(it),_(!0)}function F(e){y(e),w({name:e.name,description:e.description??``}),_(!0)}async function I(){try{v?await r({groupId:v._id,name:C.name,description:C.description}):await n({name:C.name,description:C.description||void 0}),w(it),y(null),_(!1)}catch(e){f.error(a(),e)}}async function oe(e){if(await c({title:l({name:e.name}),description:u(),confirmWord:e.name,confirmLabel:re(),cancelLabel:x(),destructive:!0}))try{await s({groupId:e._id})}catch(e){f.error(Oe(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:p()}),(0,$.jsx)(Je,{q:k,onQChange:M,onReset:()=>M(``),canReset:k!==``,searchPlaceholder:T()}),(0,$.jsx)(Ye,{title:ee(),rows:N,addLabel:ae(),onAdd:t?P:void 0,emptyHint:ie(),columns:[{header:h(),cell:e=>e.name,sort:e=>e.name},{header:A(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(Ze,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,$.jsx)(Z,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:o(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(J,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:ke(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(Xe,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,$.jsx)(K,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:b(),onSelect:()=>O({groupId:e._id,name:e.name})},...t?[{label:g(),onSelect:()=>F(e)},{label:d(),variant:`destructive`,onSelect:()=>void oe(e)}]:[]]}),(0,$.jsx)(ze,{open:m,onOpenChange:_,title:v?fe():te(),description:i(),canSubmit:!!C.name.trim(),onSubmit:I,submitLabel:ne(),children:(0,$.jsxs)(`div`,{className:`oc-form`,children:[(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:pe()}),(0,$.jsx)(q,{value:C.name,onChange:e=>w({...C,name:e.target.value})})]}),(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:S()}),(0,$.jsx)(q,{value:C.description,onChange:e=>w({...C,description:e.target.value})})]})]})}),(0,$.jsx)(ct,{groupId:E?.groupId??null,groupName:E?.name??``,open:E!==null,onOpenChange:e=>{e||O(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,$.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,$.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,$.jsx)(Pe,{size:14,"aria-hidden":!0}),le()]}),(0,$.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":he({page:e,pages:t}),children:[e,` / `,t]}),(0,$.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[ue(),(0,$.jsx)(He,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:i}){let a=j(B.groups.getGroup,n&&e?{groupId:e}:`skip`),o=j(B.groups.listAssignableInstances,n?{}:`skip`),c=j(B.groups.listAssignableUsers,n?{}:`skip`),l=D(B.groups.addMember),u=D(B.groups.removeMember),d=D(B.groups.bulkSetMembers),p=D(B.groups.setGroupManager),h=W(),[g,_]=(0,Q.useState)(``),[v,ee]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(`members`),[te,x]=(0,Q.useState)(1),[S,ne]=(0,Q.useState)(new Set),C=(0,Q.useRef)(null),T=(0,Q.useMemo)(()=>new Set((a?.members??[]).map(e=>e.userId)),[a]),re=(0,Q.useMemo)(()=>new Set((a?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[a]),ie=a?.viewerIsAdmin===!0,k=(0,Q.useMemo)(()=>new Set((a?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[a]);(0,Q.useEffect)(()=>{_(``),ee(``),b(`members`),x(1),C.current=null},[n,e]),(0,Q.useEffect)(()=>{x(1)},[g]),(0,Q.useEffect)(()=>{n&&a&&e&&C.current!==e&&(C.current=e,ne(new Set((a.members??[]).map(e=>e.userId))))},[n,a,e]);let A=(0,Q.useMemo)(()=>c?Qe(c,g,S):[],[c,g,S]);async function ae(t,n){if(e)try{n?await u({groupId:e,userId:t}):await l({groupId:e,userId:t})}catch(e){h.error(w(),e)}}async function N(t,n){if(e)try{await p({groupId:e,userId:t,manager:!n})}catch(e){h.error(m(),e)}}let P=nt(A,e=>T.has(e.userId)),F=A.filter(e=>T.has(e.userId)).length,R=rt(A,te,ot);async function z(){if(!e||A.length===0)return;let t=A.map(e=>e.userId);try{await d({groupId:e,userIds:t,member:P!==`all`})}catch(e){h.error(w(),e)}}return(0,$.jsx)(qe,{open:n,onOpenChange:i,children:(0,$.jsxs)(Ue,{className:`oc-access`,children:[(0,$.jsxs)(Be,{children:[(0,$.jsx)(We,{children:Te({name:t})}),(0,$.jsx)(Ke,{children:s()})]}),(0,$.jsxs)(Me,{value:y,onValueChange:b,className:`oc-access__tabs`,children:[(0,$.jsxs)(je,{className:`w-full`,children:[(0,$.jsxs)(V,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Ze,{size:13,"aria-hidden":!0}),E(),a?(0,$.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:T.size}):null]}),(0,$.jsxs)(V,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(J,{size:13,"aria-hidden":!0}),se(),a?(0,$.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:k.size}):null]}),(0,$.jsxs)(V,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Xe,{size:13,"aria-hidden":!0}),r(),a?(0,$.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:a.chartCount}):null]})]}),(0,$.jsx)(H,{value:`members`,children:c===void 0||a===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:L()}):c.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:_e()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{value:g,onChange:e=>_(e.target.value),placeholder:Ee(),className:`oc-access__search`}),A.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:we()}):(0,$.jsxs)($.Fragment,{children:[A.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(Y,{checked:P===`all`?!0:P===`some`?`indeterminate`:!1,onCheckedChange:()=>void z(),"aria-label":I()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:I()}),(0,$.jsxs)(G,{variant:`outline`,className:`oc-access__count`,children:[F,` / `,A.length]})]}):null,(0,$.jsx)(`div`,{className:`oc-access__list`,children:R.pageItems.map(e=>{let t=T.has(e.userId),n=et(e),r=re.has(e.userId);return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(Y,{checked:t,onCheckedChange:()=>void ae(e.userId,t),"aria-label":Ce({user:n.primary})}),(0,$.jsxs)(`span`,{className:`oc-access__who`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,$.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,$.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:tt(e.role)}),(0,$.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&ie?(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?O():M(),title:r?O():M(),onClick:()=>void N(e.userId,r),children:(0,$.jsx)(Z,{size:15,"aria-hidden":!0})}):t&&r?(0,$.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":f(),title:f(),children:(0,$.jsx)(Z,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,$.jsx)(st,{page:R.page,pageCount:R.pageCount,onPage:x})]})]})}),(0,$.jsx)(H,{value:`agents`,children:o===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:L()}):o.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:oe()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{value:v,onChange:e=>ee(e.target.value),placeholder:De(),className:`oc-access__search`}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:o.map(t=>(0,$.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:k,query:v},`${e}-${t._id}`))})]})}),(0,$.jsx)(H,{value:`charts`,children:(0,$.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=j(B.groups.listAssignableAgents,{instanceName:t}),o=D(B.groups.assignAgentToGroup),s=D(B.groups.removeAgentFromGroup),c=D(B.groups.bulkSetGroupAgents),l=W(),[u,d]=(0,Q.useState)(1);if((0,Q.useEffect)(()=>{d(1)},[i]),!e)return null;let f=$e(a?.agents??[],i),p=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&f.length===0)return null;let m=f.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),h=nt(m,e=>r.has(`${t}/${e.agentId}`)),g=rt(f,u,ot);async function _(n,r){try{r?await s({groupId:e,instanceName:t,agentId:n}):await o({groupId:e,instanceName:t,agentId:n})}catch(e){l.error(y(),e)}}async function v(){if(m.length===0)return;let n=m.map(e=>e.agentId);try{await c({groupId:e,instanceName:t,agentIds:n,assigned:h!==`all`})}catch(e){l.error(y(),e)}}return(0,$.jsxs)(`div`,{className:`oc-access__group`,children:[(0,$.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,$.jsx)(J,{size:13,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:t}),(0,$.jsx)(G,{variant:`outline`,className:`oc-access__kind`,children:n}),p?(0,$.jsx)(G,{variant:`outline`,className:`oc-access__stale`,children:ge()}):null]}),a===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:xe()}):f.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:p?be():de()}):(0,$.jsxs)($.Fragment,{children:[m.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(Y,{checked:h===`all`?!0:h===`some`?`indeterminate`:!1,onCheckedChange:()=>void v(),"aria-label":I()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:I()})]}):null,g.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1,o=!e.enabled;return(0,$.jsxs)(`div`,{className:`oc-access__row${o?` is-disabled`:``}`,children:[(0,$.jsx)(Y,{checked:i,disabled:(a||o)&&!i,onCheckedChange:()=>void _(e.agentId,i),"aria-label":me({name:e.displayName??e.agentId})}),(0,$.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,$.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,$.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":z(),title:z(),children:(0,$.jsx)(K,{size:14,fill:`currentColor`})}):null,a?(0,$.jsx)(G,{variant:`outline`,className:`oc-access__gone`,children:Se()}):null]},e.agentId)}),(0,$.jsx)(st,{page:g.page,pageCount:g.pageCount,onPage:d})]})]})}function ut({groupId:e}){let t=j(B.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=D(B.charts.assignChartToGroup),r=D(B.charts.removeChartFromGroup),i=D(B.charts.setGroupDefaultChart),a=D(B.charts.addChartToGroupPool),o=D(B.charts.removeChartFromGroupPool),s=W();if(!e)return null;if(t===void 0)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:L()});let{pool:c,addable:l,canManagePool:u}=t;if(c.length===0&&!u)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:C()});async function d(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){s.error(k(),e)}}async function f(t){try{await i({groupId:e,chartKey:t})}catch(e){s.error(k(),e)}}async function p(t){try{await a({groupId:e,chartKey:t})}catch(e){s.error(k(),e)}}async function m(t){try{await o({groupId:e,chartKey:t})}catch(e){s.error(k(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-access__list`,children:c.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(Y,{checked:e.selected,onCheckedChange:()=>void d(e.chartKey,e.selected),"aria-label":_({name:e.name})}),(0,$.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,$.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":ye(),title:ye(),children:(0,$.jsx)(K,{size:14,fill:`currentColor`})}):(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void f(e.chartKey),children:v()}):null,u?(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":P({name:e.name}),title:P({name:e.name}),onClick:()=>void m(e.chartKey),children:(0,$.jsx)(Ae,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),u?l.length>0?(0,$.jsxs)(Le,{value:``,onValueChange:e=>void p(e),children:[(0,$.jsx)(Ne,{size:`sm`,className:`oc-access__search`,children:(0,$.jsx)(Ve,{placeholder:N()})}),(0,$.jsx)(Re,{children:l.map(e=>(0,$.jsx)(Fe,{value:e.chartKey,children:e.name},e.chartKey))})]}):c.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:F()}):null:null]})}export{at as GroupsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$T as r,$w as i,AT as a,Aw as o,BT as s,Bw as c,CT as l,Cw as u,DT as d,Dw as f,ET as p,Ew as m,FT as h,Fw as g,GT as _,Gw as v,HT as ee,Hj as y,Hw as b,IT as x,Iw as S,JT as C,Jo as w,Jw as te,KT as ne,Kw as re,LT as ie,Lw as ae,MT as oe,Mw as se,NT as ce,Nw as le,OT as ue,Ow as de,PT as fe,Pw as pe,QT as me,Qw as he,RT as ge,Rw as _e,ST as T,Sw as ve,TT as ye,Tw as be,UR as E,UT as xe,Uj as Se,Uw as Ce,VR as D,VT as we,Vw as Te,WR as O,WT as Ee,Ww as De,XT as Oe,Xo as ke,Xw as Ae,YT as je,Yo as Me,Yw as Ne,ZT as Pe,Zw as Fe,_T as Ie,_w as k,aE as Le,aT as Re,ab as ze,bT as Be,br as Ve,bw as He,cT as Ue,dT as A,eE as We,eT as Ge,fT as Ke,gT as qe,gw as Je,hT as j,iE as Ye,iT as Xe,jT as Ze,jw as Qe,kT as $e,kw as et,lT as tt,mT as nt,nE as rt,nT as it,oT as at,ob as ot,pT as st,qT as ct,qo as lt,qw as ut,rE as dt,rT as ft,sT as pt,t as M,tE as mt,tT as ht,uT as gt,vT as _t,vr as vt,vw as yt,wT as bt,ww as xt,xT as N,xw as St,yT as Ct,yr as wt,yw as Tt,zT as Et}from"./api-BilJV3v_.js";import{a as Dt,c as Ot}from"./FieldLabel-DXrZ-jZW.js";import{t as P}from"./button-9dv2rCon.js";import{$ as F,Bt as kt,Dt as I,Et as L,Q as R,Rt as At,U as jt,X as z,Z as B,_ as Mt,at as V,et as H,jt as U,nt as W,ot as G,rt as K,tt as q,ut as J,zt as Nt}from"./index-DU-gHWXa.js";import{t as Pt}from"./DataTableShell-D04EM9Zp.js";import{InstanceConfigDialog as Ft}from"./BridgeTab-C0rgWnuo.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],It=new Set(X),Lt=`conversational`;function Rt(e){let t=new Set((e??[]).filter(e=>It.has(e)));return t.size===0?[Lt]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,streamTransport:Dt},zt={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Bt(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??``,streamTransport:e.streamTransport??`reactive`}}function Vt(){let e=O(M.admin.listInstances,{}),t=O(M.agents.listAllInstanceAgents,{}),n=E(M.admin.upsertInstance),i=E(M.admin.deleteInstance),o=I(),[c,l]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(Q),[f,p]=(0,Y.useState)(null),[m,g]=(0,Y.useState)(null),[v,y]=(0,Y.useState)(null),[b,S]=(0,Y.useState)(null);async function w(){try{await n({instanceId:b??void 0,name:u.name,gatewayUrl:u.gatewayUrl,bridgeUrl:u.bridgeUrl||void 0,displayName:u.displayName||void 0,kind:u.kind,transport:u.kind===`hermes`?u.transport:void 0,gatewayVersion:u.gatewayVersion||void 0,gatewayHttpUrl:u.gatewayHttpUrl||void 0,streamTransport:u.streamTransport}),d(Q),S(null),l(!1)}catch(e){o.error(dt(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[rt(),(0,Z.jsx)(`strong`,{children:mt()}),We()]}),(0,Z.jsx)(Pt,{title:r(),rows:e,addLabel:me(),onAdd:()=>{S(null),d(Q),l(!0)},emptyHint:Pe(),columns:[{header:Oe(),cell:e=>e.name,sort:e=>e.name},{header:je(),cell:e=>(0,Z.jsx)(L,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:C(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:ct(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:Le(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,Z.jsxs)(L,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?k():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:xe(),onSelect:()=>{S(e._id),d(Bt(e)),l(!0)}},{label:Ye(),onSelect:()=>p(e.name)},{label:ue(),onSelect:()=>y(e)},{label:ne(),onSelect:()=>g(e)},{label:_(),variant:`destructive`,onSelect:()=>void i({instanceId:e._id})}],bulkActions:[{label:_(),variant:`destructive`,onSelect:e=>e.forEach(e=>void i({instanceId:e}))}]}),(0,Z.jsx)(Mt,{open:c,onOpenChange:l,title:b?ee():Ee(),description:s(),canSubmit:!!(u.name&&u.gatewayUrl),onSubmit:w,submitLabel:Et(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:ge(),children:[(0,Z.jsx)(U,{value:u.name,disabled:b!==null,onChange:e=>d({...u,name:e.target.value})}),b?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:we()}):null]}),(0,Z.jsx)($,{label:ie(),children:(0,Z.jsxs)(z,{value:u.kind,onValueChange:e=>d({...u,kind:e}),children:[(0,Z.jsx)(F,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(H,{})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(R,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(R,{value:`hermes`,children:`Hermes`})]})]})}),u.kind===`hermes`?(0,Z.jsx)($,{label:Ve(),children:(0,Z.jsxs)(z,{value:u.transport,onValueChange:e=>d({...u,transport:e}),children:[(0,Z.jsx)(F,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(H,{})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(R,{value:`ws`,children:wt()}),(0,Z.jsx)(R,{value:`rest`,children:vt()})]})]})}):null,(0,Z.jsx)($,{label:x(),children:(0,Z.jsx)(U,{value:u.gatewayUrl,onChange:e=>d({...u,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:h(),children:(0,Z.jsx)(U,{value:u.bridgeUrl,placeholder:fe(),onChange:e=>d({...u,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:ce(),children:(0,Z.jsx)(U,{value:u.displayName,onChange:e=>d({...u,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:ot(),children:[(0,Z.jsxs)(z,{value:u.streamTransport,onValueChange:e=>d({...u,streamTransport:e}),children:[(0,Z.jsx)(F,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(H,{})}),(0,Z.jsx)(B,{children:Ot.map(e=>(0,Z.jsx)(R,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:ze()})]}),(0,Z.jsx)($,{label:oe(),children:(0,Z.jsx)(U,{value:u.gatewayVersion,placeholder:Ze(),onChange:e=>d({...u,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:a(),children:(0,Z.jsx)(U,{value:u.gatewayHttpUrl,placeholder:$e(),onChange:e=>d({...u,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Zt,{instanceName:f,open:f!==null,onOpenChange:e=>{e||p(null)}}),m?(0,Z.jsx)(Ft,{instance:m,onClose:()=>g(null)},m._id):null,v?(0,Z.jsx)(Ht,{instance:v,onClose:()=>y(null)},v._id):null]})}function Ht({instance:e,onClose:t}){let n=O(M.instanceSecrets.listInstanceSecretStatus,{}),r=zt[e.kind??`openclaw`],i=(0,Y.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,Z.jsx)(q,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(W,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(V,{children:[(0,Z.jsx)(G,{children:d({instance:e.displayName??e.name})}),(0,Z.jsx)(K,{children:p()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Gt,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Wt,{instance:e})}),(0,Z.jsx)(Ut,{instance:e})]})})}function Ut({instance:e}){let t=D(M.instanceSync.forceInstanceSync),n=I(),[r,a]=(0,Y.useState)(!1);async function o(){if(!r){a(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(at());break;case`no_agents`:n.success(Xe());break;case`no_bridge_url`:n.error(ft());break;case`deploy_misconfigured`:n.error(it());break;case`unauthorized`:n.error(Ge());break;case`not_served`:n.error(i());break;default:n.error(ht());break}}catch(e){n.error(Re(),e)}finally{a(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:he()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>void o(),disabled:r,children:r?pt():Ue()})})]})}function Wt({instance:e}){let t=O(M.bridgeAuth.listBridgeAuthStatus,{}),n=D(M.bridgeAuth.mintBridgeSecret),r=E(M.bridgeAuth.revokeBridgeSecret),i=I(),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(null),[l,u]=(0,Y.useState)(!1),d=(t??[]).find(t=>t.instanceId===e._id),f=d!==void 0;async function p(){if(!a){o(!0);try{c((await n({instanceId:e._id})).plaintext),u(!1)}catch(e){i.error(v(),e)}finally{o(!1)}}}async function m(){if(!a){o(!0);try{await r({instanceId:e._id}),c(null),i.success(re())}catch(e){i.error(v(),e)}finally{o(!1)}}}async function h(){if(s)try{await navigator.clipboard.writeText(s),u(!0)}catch{}}return(0,Z.jsxs)($,{label:Fe(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ae()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(L,{variant:f?`outline`:`secondary`,children:f?`${T()} · ${d.prefix}…${d.lastFour}`:N()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(P,{size:`sm`,onClick:()=>void p(),disabled:a,children:f?te():Ne()}),f?(0,Z.jsx)(P,{size:`sm`,variant:`destructive`,onClick:()=>void m(),disabled:a,children:ut()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:De()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,Z.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void h(),children:l?Se():y()})]}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>{c(null),u(!1)},children:Ce()})]}):null]})}function Gt({instanceId:e,field:t,updatedAt:n}){let r=D(M.instanceSecrets.setInstanceSecret),i=E(M.instanceSecrets.clearInstanceSecret),a=D(M.deviceIdentity.generateDeviceIdentity),o=I(),[s,c]=(0,Y.useState)(``),[u,d]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(!1),g=n!==null,_=t===`deviceIdentity`,v=t===`token`?ye():t===`deviceIdentity`?bt():l();async function ee(){if(!(!s.trim()||u)){d(!0);try{await r({instanceId:e,field:t,plaintext:s}),c(``),p(null),h(!1),o.success(qe())}catch(e){o.error(j(),e)}finally{d(!1)}}}async function b(){if(!u){d(!0);try{await i({instanceId:e,field:t}),p(null),h(!1),o.success(nt())}catch(e){o.error(j(),e)}finally{d(!1)}}}async function x(){if(!u){d(!0);try{p(await a({instanceId:e})),h(!1),o.success(A())}catch(e){o.error(tt(),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,Z.jsxs)($,{label:v,children:[_?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ke()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(L,{variant:g?`outline`:`secondary`,children:g?T():N()}),(0,Z.jsx)(U,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:s,placeholder:g?Ct():Be(),onChange:e=>c(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(P,{size:`sm`,onClick:()=>void ee(),disabled:u||s.trim().length===0,children:_t()}),_?(0,Z.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>void x(),disabled:u,children:st()}):null,g?(0,Z.jsx)(P,{size:`sm`,variant:`destructive`,onClick:()=>void b(),disabled:u,children:Ie()}):null]})]}),f?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:A()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:gt()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:S}),(0,Z.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void C(),children:m?Se():y()})]}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>{p(null),h(!1)},children:Ce()})]}):null]})}var Kt={conversational:se,documentary:o,summarizer:ke,curator:w},qt={conversational:Qe,documentary:et,summarizer:Me,curator:lt},Jt=e=>(Kt[e]??(()=>e))(),Yt=e=>(qt[e]??(()=>``))();function Xt({agentId:e,types:t,onToggle:n}){return(0,Z.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,Z.jsx)(`span`,{className:`oc-agentcard__types-label`,children:S()}),t.map(e=>(0,Z.jsx)(L,{variant:`secondary`,className:`oc-agenttype__chip`,title:Yt(e),children:Jt(e)},e)),(0,Z.jsxs)(At,{children:[(0,Z.jsx)(kt,{asChild:!0,children:(0,Z.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:g()})}),(0,Z.jsxs)(Nt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:pe()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:le()}),(0,Z.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:X.map(r=>{let i=`agtype-${e}-${r}`;return(0,Z.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,Z.jsx)(J,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,Z.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:Jt(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Yt(r)})]})]},r)})})]})]})]})}function Zt({instanceName:e,open:t,onOpenChange:n}){let r=O(M.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=E(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)})}),a=E(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})}),o=E(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=Rt(r);e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),s=E(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)})}),l=E(M.agents.removeInstanceAgent),d=jt(),p=I();async function h(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){p.error(c(),e)}}async function g(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){p.error(c(),e)}}async function _(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await o({instanceName:e,agentId:t,types:i})}catch(e){p.error(c(),e)}}async function v(t,n){if(e&&await d({title:m({name:n}),description:be(),confirmLabel:xt(),destructive:!0}))try{await l({instanceName:e,agentId:t}),p.success(u())}catch(e){p.error(c(),e)}}return(0,Z.jsx)(q,{open:t,onOpenChange:n,children:(0,Z.jsxs)(W,{className:`oc-access`,children:[(0,Z.jsxs)(V,{children:[(0,Z.jsx)(G,{children:b({name:e??``})}),(0,Z.jsx)(K,{children:Te()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:ve()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?St():r.discovery.lastPollOk?He():Tt({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:yt()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(t=>{let n=t.presentInLastOk===!1,i=r.defaultAgentId===t.agentId,a=t.displayName??t.agentId,o=t.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(t.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(J,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void h(t.agentId,e===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:a,children:[t.emoji?`${t.emoji} `:``,a]}),t.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:t.model}):null,n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(L,{variant:`outline`,className:`oc-access__gone`,children:Je()}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void v(t.agentId,a),children:f()})]}):i?(0,Z.jsx)(L,{variant:`default`,children:k()}):(0,Z.jsx)(P,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled,onClick:()=>void g(t.agentId),children:de()})]}),t.enabled?(0,Z.jsx)(Xt,{agentId:t.agentId,types:o,onToggle:e=>void _(t.agentId,e,o)}):null,t.enabled?(0,Z.jsx)(Qt,{value:t.description??``,onSave:async n=>{if(e)try{await s({instanceName:e,agentId:t.agentId,description:n})}catch(e){p.error(c(),e)}}}):null]},t.agentId)})})]})]})})}function Qt({value:e,onSave:t}){let[n,r]=(0,Y.useState)(e);(0,Y.useEffect)(()=>{r(e)},[e]);let i=()=>{n.trim()!==e.trim()&&t(n)};return(0,Z.jsx)(U,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:_e(),"aria-label":ae(),onChange:e=>r(e.target.value),onBlur:i,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())}})}function $({label:e,children:t}){return(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{Vt as InstancesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{BD as r,GD as i,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{BD as r,GD as i,HD as a,JD as o,KD as s,LD as c,RD as l,UD as u,UR as d,VD as f,VR as p,WD as m,WR as h,XD as g,YD as _,_c as v,dc as y,fc as b,gc as x,hc as S,lc as C,mc as w,pc as T,qD as E,t as D,uc as O,zD as k}from"./api-BilJV3v_.js";import{t as A}from"./button-9dv2rCon.js";import{Et as j,jt as M,ut as N}from"./index-DU-gHWXa.js";var P=t(e(),1),F=n();function I(){let e=h(D.integrations.status.status,{}),t=d(D.admin.setIntegrationConfig),[n,p]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&p(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:g()});let y=n,b=(e,t,n)=>p({...y,[e]:{...y[e],[t]:n}}),C=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[_(),` `,(0,F.jsx)(`strong`,{children:o()}),` `,E()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(j,{variant:`secondary`,children:s()}):(0,F.jsx)(j,{variant:`outline`,children:i()}):(0,F.jsx)(j,{variant:`outline`,children:m()}),note:u(),children:[(0,F.jsx)(R,{label:f(),children:(0,F.jsx)(M,{value:y.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>b(`langfuse`,`host`,e.target.value),onBlur:()=>C(`langfuse`,{host:y.langfuse.host??``})})}),(0,F.jsx)(z,{label:c(),checked:y.langfuse.enabled??!0,onChange:e=>{b(`langfuse`,`enabled`,e),C(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(j,{variant:`secondary`,children:s()}):(0,F.jsx)(j,{variant:`outline`,children:i()}):(0,F.jsx)(j,{variant:`outline`,children:m()}),note:a(),children:[(0,F.jsx)(R,{label:r(),children:(0,F.jsx)(M,{value:y.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>b(`opik`,`baseUrl`,e.target.value),onBlur:()=>C(`opik`,{baseUrl:y.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:k(),children:(0,F.jsx)(M,{value:y.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||l(),onChange:e=>b(`opik`,`workspace`,e.target.value),onBlur:()=>C(`opik`,{workspace:y.opik.workspace??``})})}),(0,F.jsx)(z,{label:c(),checked:y.opik.enabled??!0,onChange:e=>{b(`opik`,`enabled`,e),C(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(j,{variant:`secondary`,children:s()}):(0,F.jsx)(j,{variant:`outline`,children:i()}):(0,F.jsx)(j,{variant:`outline`,children:v()}),note:x(),children:[(0,F.jsx)(R,{label:S(),children:(0,F.jsx)(M,{value:y.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>b(`otlp`,`endpoint`,e.target.value),onBlur:()=>C(`otlp`,{endpoint:y.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:c(),checked:y.otlp.enabled??!0,onChange:e=>{b(`otlp`,`enabled`,e),C(`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)(N,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=p(D.integrations.otlpSecret.setOtlpHeaders),n=d(D.integrations.otlpSecret.clearOtlpHeaders),[r,i]=(0,P.useState)(``),[a,o]=(0,P.useState)(null),[s,c]=(0,P.useState)(!1),l=async()=>{c(!0),o(null);try{await t({headersJson:r}),i(``)}catch(e){o(e instanceof Error?e.message:String(e))}finally{c(!1)}};return(0,F.jsxs)(R,{label:w(),children:[(0,F.jsx)(M,{value:r,placeholder:e?T():b(),onChange:e=>i(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:s||r.trim().length===0,onClick:()=>void l(),children:y()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:s,onClick:()=>void n({}),children:O()}):null]}),a?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:a}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:C()})]})}export{I as IntegrationsTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AO as r,CO as i,Cv as a,MO as o,NO as s,SO as c,Sv as l,WR as u,_v as d,bv as f,dv as p,fv as m,gv as h,hv as g,ik as _,jO as v,mv as y,pv as b,t as x,uv as S,vv as C,xv as w,yv as T}from"./api-BilJV3v_.js";import{Fn as ee,Pn as te,i as ne,o as re,q as E,r as D}from"./index-DU-gHWXa.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-Bm7W459T.js";import{n as N,t as P}from"./TimeRangePicker-4lLXkwg_.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=u(x.me.getMe,{host:E})?.permissions?.includes(`traces.read`)??!1,t=u(x.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,L).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:_()}),(0,I.jsxs)(M,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{children:s()}),(0,I.jsx)(j,{children:v()})]}),(0,I.jsx)(k,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,I.jsx)(B,{series:n})})]})]})}function B({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),r=Math.max(1,...t,...n),a=t=>6+t*468/(e.length-1),l=e=>74-e*68/r,u=e=>e.map((e,t)=>`${t===0?`M`:`L`}${a(t).toFixed(1)},${l(e).toFixed(1)}`).join(` `),d=e[e.length-1];return(0,I.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,I.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,I.jsxs)(`span`,{style:{color:`var(--primary)`},children:[c(),` p50 `,R(d.cP50),` `,o()]}),(0,I.jsxs)(`span`,{children:[i(),` p50 `,R(d.aP50),` `,o()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":s(),children:[(0,I.jsx)(`path`,{d:u(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,I.jsx)(`path`,{d:u(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var V=[{metric:`api.calls`,label:a(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:l(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:w(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:f(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:T(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:C(),unit:`/h`,group:`Assistant`,isError:!0}],H=V.length,U=[`API`,`OpenClaw`,`Chat`,`Assistant`],W=1e3,G=36e5;function K(e,t){let n=Math.max(1,Math.ceil((t-e)/G)),r=Math.min(n*H,W);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/H))}}function q(){let e=ee({from:`/settings/kpi`}),t=te({from:`/settings/kpi`}),n=ne(e.from,e.to,D,`now`),r=e=>void t({search:t=>({...t,...re(e)})}),{from:i,to:a}=N(n),{rowLimit:o,buckets:s}=K(i,a),c=u(x.kpi.listKpis,{limit:o,filter:{from:i,to:a}}),l=(0,F.useMemo)(()=>{let e=new Map;for(let t of c??[]){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>s&&e.set(t,n.slice(n.length-s));return e},[c,s]),f=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[d(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:h()})]}),(0,I.jsx)(J,{value:n,onChange:r})]});return c===void 0?(0,I.jsxs)(I.Fragment,{children:[f,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:g()})]}):c.length===0?(0,I.jsxs)(I.Fragment,{children:[f,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:y()})]}):(0,I.jsxs)(I.Fragment,{children:[f,(0,I.jsx)(z,{}),U.map(e=>{let t=V.filter(t=>t.group===e);return t.some(e=>(l.get(e.metric)??[]).length>0)?(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,I.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,I.jsx)(Y,{config:e,series:l.get(e.metric)??[]},e.metric))})]},e):null})]})}function J({value:e,onChange:t}){return(0,I.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,I.jsx)(P,{value:e,onChange:t})})}function Y({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,I.jsxs)(M,{size:`sm`,className:`oc-kpi__card`,children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{className:`oc-kpi__card-title`,children:e.label}),(0,I.jsx)(j,{className:`oc-kpi__card-metric`,children:(0,I.jsx)(`code`,{children:e.metric})})]}),(0,I.jsxs)(k,{className:`oc-kpi__card-body`,children:[(0,I.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,I.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,I.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,I.jsx)(ae,{series:t,isError:e.isError,unit:e.unit}),(0,I.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,I.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:b({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:m()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:p({count:t.length})})]})]})]})}var X=240,Z=48,ie=1;function ae({series:e,isError:t,unit:n}){if(e.length===0)return(0,I.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,a=Math.max(i-ie,1);return(0,I.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":S({max:Q(r),unit:n}),children:e.map((e,o)=>{let s=r>0?e.value/r*(Z-1):0,c=o*i,l=Z-s;return(0,I.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,I.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{q as KpiTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AN as r,AR as i,BN as a,CN as o,CR as s,Ct as c,DN as l,DR as ee,EN as u,ER as te,FN as d,FR as f,IN as p,LN as m,Lt as h,MN as ne,Mt as re,NN as ie,ON as ae,PN as oe,RN as se,Rt as ce,SN as le,SR as ue,St as de,TN as fe,TR as pe,UR as g,WR as _,_N as me,_R as he,_t as ge,aN as _e,aR as v,bN as y,bR as b,bt as x,cN as S,cR as C,dN as w,dR as T,fN as E,fR as D,gN as O,gR as k,hN as A,hR as j,iN as M,iR as N,jN as P,kN as F,lN as I,lR as ve,mN as L,mR as ye,nN as be,oN as xe,oR as Se,pN as Ce,pR as we,r as R,rN as Te,sN as Ee,sR as De,t as z,tN as Oe,uN as B,uR as ke,vN as Ae,vR as je,vt as Me,wN as Ne,wR as Pe,wt as Fe,xN as Ie,xR as Le,xt as Re,yN as ze,yR as Be,yt as Ve,zN as He,zT as Ue}from"./api-BilJV3v_.js";import{t as V}from"./button-9dv2rCon.js";import{$ as We,At as Ge,Dt as Ke,Et as H,Ot as qe,Q as U,V as Je,X as Ye,Z as Xe,et as Ze,jt as W,kt as Qe,q as G,t as $e,ut as K}from"./index-DU-gHWXa.js";import{t as et}from"./localePickerView-C2RmOS86.js";import{t as tt}from"./TimezoneCombobox-JMlCoWmN.js";var q=t(e(),1),J=n();function nt({className:e,checked:t,onCheckedChange:n,disabled:r,...i}){return(0,J.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"data-state":t?`checked`:`unchecked`,disabled:r,onClick:()=>n(!t),className:R(`peer inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors outline-none`,`focus-visible:ring-2 focus-visible:ring-ring/50`,`disabled:cursor-not-allowed disabled:opacity-50`,t?`bg-primary`:`bg-input`,e),...i,children:(0,J.jsx)(`span`,{className:R(`pointer-events-none block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-[18px]`:`translate-x-[2px]`)})})}var Y=[{id:`messages`,label:()=>a()},{id:`composer`,label:()=>He()},{id:`sidebar`,label:()=>se()},{id:`notifications`,label:()=>Ie()},{id:`other`,label:()=>m()}],X={showSource:{category:`messages`,label:()=>p(),help:()=>d()},showReport:{category:`messages`,label:()=>oe(),help:()=>ie()},copyAssistant:{category:`messages`,label:()=>ne()},copyUser:{category:`messages`,label:()=>P()},showDelete:{category:`messages`,label:()=>r()},showTools:{category:`messages`,label:()=>F(),help:()=>ae()},voiceInput:{category:`composer`,label:()=>l(),help:()=>u()},showUsage:{category:`composer`,label:()=>fe(),help:()=>Ne()},autoReadAloud:{category:`composer`,label:()=>ce(),help:()=>h()},showChatAge:{category:`sidebar`,label:()=>o(),help:()=>le()},notifSound:{category:`notifications`,label:()=>y(),help:()=>ze()},notifSystem:{category:`notifications`,label:()=>Ae(),help:()=>me()},replySound:{category:`notifications`,label:()=>O(),help:()=>A()}};function Z(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function Q(e,t){let n=Z(t.trim()),r=new Map(Y.map(e=>[e.id,e.label()])),i=new Map(Y.map(e=>[e.id,[]]));for(let t of e){let e=X[t],a=e?.category??`other`;n&&!Z(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return Y.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 $(e){return e===`admin`}function ot(e){return e===!0?`on`:e===!1?`off`:`inherit`}function st(e){return e===`on`?!0:e===`off`?!1:null}function ct(e){return at(e)?it[e]:void 0}var lt={voiceInput:()=>_e()};function ut({prefKey:e,ui:t}){let n=g(z.admin.setUiPrefDefault),r=g(z.admin.setFeatureEnabled),i=ct(e),a=i?lt[e]?.():void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,J.jsx)(`span`,{className:`oc-prefs__gov-label`,children:I()}),(0,J.jsxs)(Ye,{value:ot(t.defaults[e]),onValueChange:t=>void n({key:e,value:st(t)}),children:[(0,J.jsx)(We,{size:`sm`,className:`w-36`,children:(0,J.jsx)(Ze,{})}),(0,J.jsxs)(Xe,{children:[(0,J.jsx)(U,{value:`on`,children:Te()}),(0,J.jsx)(U,{value:`off`,children:be()}),(0,J.jsx)(U,{value:`inherit`,children:Oe()})]})]}),i?(0,J.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,J.jsx)(K,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":S()}),S()]}):null]}),a?(0,J.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function dt({current:e,enabled:t}){let n=g(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=Qe(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,J.jsxs)(`div`,{className:`oc-prefs__row${t?``:` is-locked`}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[Fe(),e?(0,J.jsx)(H,{variant:`secondary`,children:Ge(e,qe())}):null]}),(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:a?Re():r?de():c()})]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[e&&!r?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void n({shortcut:null}),children:ge()}):null,(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>i(e=>!e),children:r?Me():e?Ve():x()})]})]})}function ft(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=_(z.me.getMe,{host:G}),a=i?.ui,o=$(i?.role)&&n,s=g(z.me.setUiPref).withOptimisticUpdate(Je),c=(0,q.useMemo)(()=>a?Q(Object.keys(a.effective),e):[],[a,e]);return a?(0,J.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(i?.role)?(0,J.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,J.jsx)(K,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":B()}),B()]}):null,o?(0,J.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,J.jsx)(`p`,{children:Ee()}),(0,J.jsx)(`p`,{children:xe()}),(0,J.jsx)(`p`,{children:M()})]}):null,(0,J.jsx)(W,{value:e,onChange:e=>t(e.target.value),placeholder:L(),"aria-label":L(),className:`mb-2`}),c.length===0?(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:Ce()}):(0,J.jsx)(`div`,{className:`oc-prefs`,children:c.map(e=>(0,J.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,J.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=X[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,J.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,J.jsx)(H,{variant:`outline`,children:E()}):l?(0,J.jsx)(H,{variant:`secondary`,children:re()}):null]}),r?(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void s({key:e,value:null}),children:w()}):null,(0,J.jsx)(nt,{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,J.jsx)(ut,{prefKey:e,ui:a}):null]},e)})]},e.id))}),(0,J.jsx)(dt,{current:i?.dictationShortcut??null,enabled:a.effective.voiceInput===!0})]}):(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:f()})}var pt={sm:()=>j(),md:()=>ye(),lg:()=>we(),xl:()=>D(),"2xl":()=>T(),"3xl":()=>ke()};function mt(){let e=_(z.me.getMe,{host:G}),t=g(z.me.setLocale),n=g(z.me.setTimezone),r=g(z.me.setFontScale).withOptimisticUpdate((e,{scale:t})=>{let n=e.getQuery(z.me.getMe,{host:G});n&&e.setQuery(z.me.getMe,{host:G},{...n,fontScale:t,resolvedFontScale:t??`md`})}),a=g(z.me.setMyName),o=Ke(),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),o.success(s())}catch(e){o.error(ue(),e)}}return(0,J.jsxs)(`div`,{className:`oc-appearance`,children:[(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:ee()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:te()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(W,{className:`max-w-xs`,value:f,maxLength:120,placeholder:pe(),onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&p&&(e.preventDefault(),m())}}),(0,J.jsx)(V,{size:`sm`,disabled:!p,onClick:()=>void m(),children:Ue()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Pe()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:Le()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:b()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[et().map(e=>(0,J.jsx)(V,{variant:c===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,J.jsx)(V,{variant:c==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:i()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Be()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:ve()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:C()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(tt,{value:e?.timezone??``,onChange:e=>void n({timezone:e})}),(0,J.jsx)(V,{variant:e?.timezone===null||e?.timezone===void 0?`default`:`outline`,size:`sm`,onClick:()=>void n({timezone:null}),children:De()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Se()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:je()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:he()})]}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:$e.map(t=>(0,J.jsx)(V,{variant:(e?.fontScale??`md`)===t?`default`:`outline`,size:`sm`,onClick:()=>void r({scale:t}),children:pt[t]()},t))}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:k()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:v()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:N()})]}),(0,J.jsx)(ft,{})]})]})}export{mt as PreferencesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$g as r,$m as i,A_ as a,B_ as o,Bg as s,C_ as c,D as l,E_ as u,FR as d,G_ as f,Gg as p,Hg as ee,Jg as te,K_ as m,L_ as h,Lg as g,M_ as ne,O_ as re,P_ as ie,R_ as ae,S_ as _,T_ as v,UR as y,Ug as b,V_ as x,Vg as oe,WR as S,Wg as C,Yg as se,__ as w,a_ as ce,b_ as T,c_ as le,d_ as ue,e_ as E,f_ as D,g_ as de,h_ as fe,i_ as pe,j_ as me,k_ as he,l_ as ge,m_ as _e,n_ as O,o_ as k,p_ as A,q_ as ve,qg as j,s_ as ye,t as M,t_ as be,u_ as xe,v_ as N,w_ as Se,y_ as Ce,zg as we}from"./api-BilJV3v_.js";import{r as Te}from"./dist-CqrxhZ9M.js";import{t as Ee}from"./list-D6QNuEgi.js";import{t as P}from"./button-9dv2rCon.js";import{A as De,C as Oe,Cn as ke,D as F,Dt as Ae,E as je,En as Me,Fn as Ne,Ft as Pe,In as Fe,It as Ie,J as Le,Lt as Re,Mt as ze,Nt as Be,O as I,P as Ve,Pn as L,Pt as R,S as He,Sn as z,T as Ue,U as We,W as Ge,Y as Ke,_ as qe,_n as Je,b as B,d as Ye,dn as Xe,f as Ze,fn as V,g as H,h as U,hn as W,in as Qe,j as G,jn as $e,jt as K,k as et,m as tt,p as nt,pn as rt,v as q,vn as it,w as at,wn as J,x as Y,y as ot}from"./index-DU-gHWXa.js";var st=l(`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=l(`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`}]]),lt=l(`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`}]]),ut=l(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),X=t(e(),1),Z=n();function Q({className:e}){return(0,Z.jsx)(Re,{asChild:!0,children:(0,Z.jsx)(P,{variant:`ghost`,size:`icon-xs`,"aria-label":p(),className:e,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,Z.jsx)(Me,{})})})}function dt({folderId:e,name:t,color:n,currentParentId:i,className:o,onOpen:c}){let l=y(M.projects.renameProject),u=y(M.projects.setProjectColor),d=y(M.projects.moveProject),p=y(M.projects.deleteProject),ee=y(M.projects.createProject),g=We(),ie=Ge(),[ae,_]=(0,X.useState)(!1),[v,b]=(0,X.useState)(t),[x,se]=(0,X.useState)(!1),[w,ce]=(0,X.useState)(!1),T=S(M.projects.projectTreeCount,w?{projectId:e}:`skip`);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(ze,{onOpenChange:e=>e&&ce(!0),children:[(0,Z.jsx)(Q,{className:o}),(0,Z.jsxs)(Be,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(R,{onSelect:()=>c(),children:[(0,Z.jsx)(J,{}),` `,re()]}),(0,Z.jsxs)(R,{onSelect:()=>{b(t),_(!0)},children:[(0,Z.jsx)(rt,{}),` `,C()]}),(0,Z.jsxs)(R,{onSelect:()=>{requestAnimationFrame(async()=>{let t=await ie({title:Ce(),label:ve(),placeholder:m(),confirmLabel:f()});t&&await ee({name:t,parentId:e})})},children:[(0,Z.jsx)(ke,{}),` `,Ce()]}),(0,Z.jsxs)(R,{onSelect:()=>se(!0),children:[(0,Z.jsx)(ct,{}),` `,be()]}),(0,Z.jsx)(Pe,{children:oe()}),(0,Z.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void u({projectId:e,color:null}),"aria-label":s(),children:`✕`}),tt.map(t=>(0,Z.jsx)(`button`,{className:`oc-colorgrid__dot`+(n===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void u({projectId:e,color:t.value})},t.value))]}),(0,Z.jsx)(Ie,{}),(0,Z.jsxs)(R,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let n=T?.folders??0,r=T?.chats??0;await g({title:me({name:t}),description:n>0?he({folders:n,chats:r}):r>0?a({count:r}):te(),confirmWord:j(),confirmLabel:ne(),destructive:!0})&&await p({projectId:e})})},children:[(0,Z.jsx)(Qe,{}),` `,j()]})]})]}),(0,Z.jsx)(qe,{open:ae,onOpenChange:_,title:h(),canSubmit:v.trim().length>0,onSubmit:async()=>{await l({projectId:e,name:v.trim()}),_(!1)},submitLabel:C(),children:(0,Z.jsx)(K,{value:v,onChange:e=>b(e.target.value),autoFocus:!0})}),x?(0,Z.jsx)(nt,{open:x,onOpenChange:se,title:r(),movingFolderId:e,currentId:i,onPick:t=>void d({projectId:e,parentId:t})}):null]})}function $({chat:e,currentFolderId:t,className:n}){let r=y(M.chats.pinChat),i=y(M.chats.deleteChat),a=y(M.chats.renameChat),o=y(M.chats.setChatSidebar),s=y(M.chats.moveChatToProject),c=We(),[l,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(e.title??``),[m,h]=(0,X.useState)(!1);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(ze,{children:[(0,Z.jsx)(Q,{className:n}),(0,Z.jsxs)(Be,{align:`end`,className:`w-52`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(R,{onSelect:()=>{p(e.title??``),d(!0)},children:[(0,Z.jsx)(rt,{}),` `,C()]}),(0,Z.jsxs)(R,{onSelect:()=>void r({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,Z.jsx)(Xe,{}):(0,Z.jsx)(V,{}),e.pinned?b():ee()]}),(0,Z.jsxs)(R,{onSelect:()=>h(!0),children:[(0,Z.jsx)(ct,{}),` `,O()]}),e.pinned&&e.inSidebar?null:(0,Z.jsxs)(R,{onSelect:()=>void o({chatId:e._id,hidden:e.inSidebar}),children:[e.inSidebar?(0,Z.jsx)(W,{}):(0,Z.jsx)(ut,{}),e.inSidebar?v():u()]}),(0,Z.jsx)(Ie,{}),(0,Z.jsxs)(R,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await c({title:we(),description:te(),confirmLabel:j(),destructive:!0})&&await i({chatId:e._id})})},children:[(0,Z.jsx)(Qe,{}),` `,j()]})]})]}),(0,Z.jsx)(qe,{open:l,onOpenChange:d,title:g(),canSubmit:f.trim().length>0,onSubmit:async()=>{await a({chatId:e._id,title:f.trim()}),d(!1)},submitLabel:C(),children:(0,Z.jsx)(K,{value:f,onChange:e=>p(e.target.value),autoFocus:!0})}),m?(0,Z.jsx)(nt,{open:m,onOpenChange:h,title:E(),currentId:t,onPick:t=>void s({chatId:e._id,projectId:t})}):null]})}function ft(e,t){let n=t.trim().toLowerCase();return n===``?e:e.filter(e=>(e.title??``).toLowerCase().includes(n))}function pt(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 mt(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}var ht=`oc.projpage.view`;function gt(){let e=localStorage.getItem(ht);return e===`cards`||e===`list`?e:`columns`}var _t=e=>`into:${e}`,vt=e=>`col:${e??`null`}`,yt=e=>`crumb:${e}`;function bt(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 xt(){let{projectId:e}=Fe({from:`/project/$projectId`}),t=L(),n=S(M.projects.projectPage,{projectId:e});return(0,Z.jsx)(`div`,{className:`oc-projpage`,children:n===void 0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:d()}):n===null?(0,Z.jsxs)(`div`,{className:`oc-projpage__notfound`,children:[(0,Z.jsx)(`h2`,{children:ye()}),(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:k()}),(0,Z.jsx)(P,{variant:`outline`,onClick:()=>void t({to:`/`}),children:ce()})]}):(0,Z.jsx)(St,{page:n})})}function St({page:e}){let t=L(),n=We(),o=Ge(),l=Ae(),u=y(M.projects.renameProject),d=y(M.projects.setProjectColor),p=y(M.projects.deleteProject),ee=y(M.projects.createProject),g=y(M.projects.moveProject),re=y(M.chats.moveChatToProject),ie=y(M.chats.reorderChat),v=y(M.projects.reorderProject),b=S(M.projects.projectTreeCount,{projectId:e.project._id}),[w,ce]=(0,X.useState)(gt),E=e=>{localStorage.setItem(ht,e),ce(e)},D=S(M.projects.folderColumns,w===`columns`?{projectId:e.project._id}:`skip`),O=S(M.projects.projectTreeList,w===`list`?{projectId:e.project._id}:`skip`),{c:k}=Ne({from:`/project/$projectId`}),A=S(M.projects.listProjects,{}),ye=S(M.chatReads.myBusyChats,{}),N=(0,X.useMemo)(()=>new Set(ye??[]),[ye]),we=S(M.chatReads.myChatReads,{}),Te=(0,X.useMemo)(()=>mt(e.chats,we??[]),[e.chats,we]),{startNewChat:Fe,picker:I}=Ye(e=>void t({to:`/chat/$chatId`,params:{chatId:e}})),[B,Xe]=(0,X.useState)(``),[Ze,V]=(0,X.useState)(!1),[U,W]=(0,X.useState)(e.project.name),[G,$e]=(0,X.useState)(!1),[J,ut]=(0,X.useState)(``);(0,X.useEffect)(()=>{let e=setTimeout(()=>ut(B.trim()),180);return()=>clearTimeout(e)},[B]);let Q=S(M.search.searchConversations,J.length>=2?{query:J,projectId:e.project._id}:`skip`),dt=De(et(at,{activationConstraint:{distance:4}}),et(Ue,{activationConstraint:{delay:250,tolerance:8}})),$=(0,X.useRef)(!1),_t=()=>{$.current=!0,setTimeout(()=>{$.current=!1},0)},[vt,yt]=(0,X.useState)(null),xt=t=>{if(t.startsWith(`chat:`)){let n=t.slice(5),r=e.chats.find(e=>e._id===n),i=D?.columns.flatMap(e=>e.chats).find(e=>e._id===n);return{kind:`chat`,label:(r??i)?.title||x()}}if(t.startsWith(`folder:`)){let e=t.slice(7);return{kind:`folder`,label:(A??[]).find(t=>t._id===e)?.name??``}}return null},St=e=>yt(xt(String(e.active.id))),Tt=(0,X.useCallback)(e=>{let t=String(e.active.id).startsWith(`folder:`),n=t=>({...e,droppableContainers:e.droppableContainers.filter(e=>String(e.id).startsWith(t))}),r=F(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=F(n(t?`folder:`:`chat:`));if(i.length>0)return i;let a=F(n(`crumb:`));if(a.length>0)return a;let o=F(n(`col:`));return o.length>0?o:je(n(t?`folder:`:`chat:`))},[]),Dt=t=>{if(w===`columns`){for(let e of D?.columns??[])if(e.chats.some(e=>e._id===t))return{list:e.chats,folderId:e.folderId};return null}if(w===`list`){let e=O?.chats.find(e=>e._id===t);return e?{list:O.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},kt=t=>{if(w===`columns`){for(let e of D?.columns??[])if(e.folders.some(e=>e._id===t))return{list:e.folders,parentId:e.folderId};return null}if(w===`list`){let e=O?.folders.find(e=>e._id===t);if(!e||!O)return null;let n=e.parentId??O.rootId;return{list:Ke(O.folders,e.parentId),parentId:n}}return e.children.some(e=>e._id===t)?{list:e.children,parentId:e.project._id}:null},At=async e=>{yt(null),_t();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=bt(r);if(e!==void 0){if(a)await re({chatId:i.slice(5),projectId:e});else{let t=i.slice(7);if(t===e)return;if(!Le(A??[],t,e)){l.error(T());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=Dt(t);if(!n)return;n.list.some(t=>t._id===e)||await re({chatId:e,projectId:n.folderId});let a=pt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await ie({chatId:e,...a});return}if(!a&&r.startsWith(`folder:`)){let e=i.slice(7),t=r.slice(7);if(e===t)return;let n=kt(t);if(!n)return;if(!n.list.some(t=>t._id===e)){if(!Le(A??[],e,n.parentId)){l.error(T());return}await g({projectId:e,parentId:n.parentId})}let a=pt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await v({projectId:e,...a});return}}catch{l.error(T())}},[,Mt]=(0,X.useState)(0);(0,X.useEffect)(()=>{let e=window.setInterval(()=>Mt(e=>e+1),6e4);return()=>window.clearInterval(e)},[]);let Nt=Date.now(),Pt=H(e.project),Ft=ft(e.chats,B),It=e.breadcrumb.slice(0,-1),Lt=e=>()=>{$.current||e()};return(0,Z.jsxs)(He,{sensors:dt,collisionDetection:Tt,onDragStart:St,onDragEnd:At,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__body`,style:{"--proj-hue":Pt},children:[(0,Z.jsxs)(`nav`,{className:`oc-projpage__crumbs`,"aria-label":pe(),children:[It.map(e=>(0,Z.jsxs)(`span`,{className:`oc-projpage__crumb`,children:[(0,Z.jsx)(Ct,{folderId:e._id,children:(0,Z.jsx)(`button`,{type:`button`,className:`oc-projpage__crumblink`,onClick:Lt(()=>void t({to:`/project/$projectId`,params:{projectId:e._id}})),children:e.name})}),(0,Z.jsx)(`span`,{className:`oc-projpage__crumbsep`,"aria-hidden":!0,children:`›`})]},e._id)),(0,Z.jsx)(`span`,{className:`oc-projpage__crumbcur`,children:e.project.name})]}),(0,Z.jsxs)(`header`,{className:`oc-projpage__head`,children:[(0,Z.jsx)(`span`,{className:`oc-projpage__dot`,"aria-hidden":!0}),(0,Z.jsx)(`h1`,{className:`oc-projpage__title`,children:e.project.name}),(0,Z.jsxs)(`div`,{className:`oc-projpage__actions`,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__viewtoggle`,role:`group`,"aria-label":Se(),children:[(0,Z.jsx)(P,{variant:w===`cards`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":Se(),title:Se(),"aria-pressed":w===`cards`,onClick:()=>E(`cards`),children:(0,Z.jsx)(lt,{})}),(0,Z.jsx)(P,{variant:w===`columns`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":c(),title:c(),"aria-pressed":w===`columns`,onClick:()=>E(`columns`),children:(0,Z.jsx)(st,{})}),(0,Z.jsx)(P,{variant:w===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":_(),title:_(),"aria-pressed":w===`list`,onClick:()=>E(`list`),children:(0,Z.jsx)(Ee,{})})]}),(0,Z.jsxs)(P,{variant:`outline`,size:`sm`,onClick:()=>void Fe({projectId:e.project._id}),children:[(0,Z.jsx)(it,{}),_e()]}),(0,Z.jsxs)(P,{variant:`outline`,size:`sm`,onClick:async()=>{let t=await o({title:Ce(),label:ve(),placeholder:m(),confirmLabel:f()});t&&await ee({name:t,parentId:e.project._id})},children:[(0,Z.jsx)(ke,{}),Ce()]}),(0,Z.jsxs)(ze,{children:[(0,Z.jsx)(Re,{asChild:!0,children:(0,Z.jsx)(P,{variant:`ghost`,size:`icon-sm`,"aria-label":ae(),children:(0,Z.jsx)(Me,{})})}),(0,Z.jsxs)(Be,{align:`end`,className:`w-48`,children:[(0,Z.jsxs)(R,{onSelect:()=>{W(e.project.name),V(!0)},children:[(0,Z.jsx)(rt,{}),` `,C()]}),(0,Z.jsxs)(R,{onSelect:()=>$e(!0),children:[(0,Z.jsx)(ct,{}),` `,be()]}),(0,Z.jsx)(Pe,{children:oe()}),(0,Z.jsxs)(`div`,{className:`oc-colorgrid`,children:[(0,Z.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void d({projectId:e.project._id,color:null}),"aria-label":s(),children:`✕`}),tt.map(t=>(0,Z.jsx)(`button`,{className:`oc-colorgrid__dot`+(e.project.color===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void d({projectId:e.project._id,color:t.value})},t.value))]}),(0,Z.jsx)(Ie,{}),(0,Z.jsxs)(R,{variant:`destructive`,onSelect:()=>{let r=e.project.parentId;requestAnimationFrame(async()=>{let i=b?.folders??0,o=b?.chats??0;await n({title:me({name:e.project.name}),description:i>0?he({folders:i,chats:o}):o>0?a({count:o}):te(),confirmWord:j(),confirmLabel:ne(),destructive:!0})&&(await p({projectId:e.project._id}),t(r===null?{to:`/`}:{to:`/project/$projectId`,params:{projectId:r}}))})},children:[(0,Z.jsx)(Qe,{}),` `,j()]})]})]})]})]}),w===`columns`?(0,Z.jsx)(jt,{data:D,currentId:e.project._id,busyIds:N,suppressClick:$,locateChatId:k??null}):w===`list`?(0,Z.jsx)(Ot,{data:O,busyIds:N,suppressClick:$,locateChatId:k??null}):(0,Z.jsxs)(Z.Fragment,{children:[e.children.length>0?(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:de()}),(0,Z.jsx)(`div`,{className:`oc-projpage__cards`,children:(0,Z.jsx)(q,{items:e.children.map(e=>`folder:${e._id}`),strategy:ot,children:e.children.map(t=>(0,Z.jsx)(wt,{child:t,parentId:e.project._id,now:Nt,suppressClick:$},t._id))})})]}):null,(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__convhead`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:fe()}),e.chats.length>0?(0,Z.jsx)(K,{value:B,onChange:e=>Xe(e.target.value),placeholder:ue(),className:`oc-projpage__filter`}):null]}),e.chats.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:e.children.length===0?ge():le()}):Ft.length===0&&(Q??[]).length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:xe({term:B.trim()})}):(0,Z.jsx)(`ul`,{className:`oc-projpage__chats`,children:(0,Z.jsx)(q,{items:Ft.map(e=>`chat:${e._id}`),strategy:Y,children:Ft.map(t=>(0,Z.jsx)(Et,{chat:t,currentFolderId:e.project._id,now:Nt,busy:N.has(t._id),unread:Te.has(t._id),locate:t._id===k,suppressClick:$},t._id))})})]}),J.length>=2&&Q!==void 0?(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:se()}),Q.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:xe({term:J})}):(0,Z.jsx)(`ul`,{className:`oc-projpage__chats`,children:Q.map(e=>(0,Z.jsx)(`li`,{className:`oc-projpage__chatrow`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{e.messageId&&J&&Ve(e.messageId,J),t({to:`/chat/$chatId`,params:{chatId:e.chatId},...e.messageId?{search:{m:e.messageId}}:{}})},children:[(0,Z.jsx)(Je,{size:13,"aria-hidden":!0,className:`oc-projpage__hitico`}),(0,Z.jsxs)(`span`,{className:`oc-projpage__hitbody`,children:[(0,Z.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||i()}),e.projectPath&&e.projectPath.length>1?(0,Z.jsx)(`span`,{className:`oc-projpage__hitpath`,children:e.projectPath.join(` › `)}):null,e.snippet?(0,Z.jsx)(`span`,{className:`oc-projpage__hitsnippet`,children:e.snippet}):null]})]})},`${e.chatId}:${e.messageId??`t`}`))})]}):null]}),(0,Z.jsx)(qe,{open:Ze,onOpenChange:V,title:h(),canSubmit:U.trim().length>0,onSubmit:async()=>{await u({projectId:e.project._id,name:U.trim()}),V(!1)},submitLabel:C(),children:(0,Z.jsx)(K,{value:U,onChange:e=>W(e.target.value),autoFocus:!0})}),G?(0,Z.jsx)(nt,{open:G,onOpenChange:$e,title:r(),movingFolderId:e.project._id,currentId:e.project.parentId,onPick:t=>void g({projectId:e.project._id,parentId:t})}):null,I]}),(0,Z.jsx)(Oe,{children:vt?(0,Z.jsxs)(`div`,{className:`oc-projpage__dragghost`,children:[vt.kind===`folder`?(0,Z.jsx)(z,{size:13,"aria-hidden":!0}):(0,Z.jsx)(Je,{size:13,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:vt.label})]}):null})]})}function Ct({folderId:e,children:t}){let{setNodeRef:n,isOver:r}=I({id:yt(e)});return(0,Z.jsx)(`span`,{ref:n,className:r?`oc-projpage__cdrop is-over`:`oc-projpage__cdrop`,children:t})}function wt({child:e,parentId:t,now:n,suppressClick:r}){let i=L(),a=B({id:`folder:${e._id}`}),o=I({id:_t(e._id)});return(0,Z.jsxs)(`div`,{ref:e=>{a.setNodeRef(e),o.setNodeRef(e)},className:`oc-projpage__card`+(o.isOver?` is-over`:``)+(a.isDragging?` is-dragging`:``),style:{"--proj-hue":H(e),transform:G.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,Z.jsxs)(`span`,{className:`oc-projpage__cardhead`,children:[(0,Z.jsx)(z,{size:15,"aria-hidden":!0,className:`oc-projpage__cardico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__cardname`,children:e.name}),(0,Z.jsx)(dt,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__cardmenu`,onOpen:()=>void i({to:`/project/$projectId`,params:{projectId:e._id}})})]}),(0,Z.jsxs)(`span`,{className:`oc-projpage__cardmeta`,children:[e.folderCount>0?A({count:e.folderCount})+` · `:``,D({count:e.recursiveChatCount})]}),e.lastActivityAt===null?null:(0,Z.jsx)(`span`,{className:`oc-projpage__cardage`,children:Ze(e.lastActivityAt,n)})]})}function Tt({chat:e}){let t=y(M.chats.setChatSidebar),n=e.inSidebar?v():u();return(0,Z.jsx)(P,{variant:`ghost`,size:`icon-xs`,"aria-label":n,title:n,className:`oc-projpage__barbtn`+(e.inSidebar?` is-on`:``),disabled:e.pinned&&e.inSidebar,onClick:n=>{n.stopPropagation(),t({chatId:e._id,hidden:e.inSidebar})},children:e.inSidebar?(0,Z.jsx)(W,{}):(0,Z.jsx)(ut,{})})}function Et({chat:e,currentFolderId:t,now:n,busy:r,unread:i,locate:a,suppressClick:s}){let c=L(),l=U(e.color),u=B({id:`chat:${e._id}`}),d=Dt(a);return(0,Z.jsxs)(`li`,{ref:e=>{u.setNodeRef(e),d.current=e},className:`oc-projpage__chatrow`+(u.isDragging?` is-dragging`:``)+(a?` is-locate`:``),style:{transform:G.Transform.toString(u.transform),transition:u.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{s.current||c({to:`/chat/$chatId`,params:{chatId:e._id}})},...u.listeners,...u.attributes,children:[l?(0,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:l}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||x()}),e.pinned?(0,Z.jsx)(V,{size:12,"aria-hidden":!0,className:`oc-projpage__chatpin`}):null,(0,Z.jsx)(`span`,{className:`oc-projpage__chatage`,children:Ze(e.updatedAt,n)}),r?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,title:o(),"aria-label":o()}):null,i&&!r?(0,Z.jsx)(`span`,{className:`oc-chatitem__unread`,title:ie(),"aria-label":ie()}):null]}),(0,Z.jsx)(Tt,{chat:e}),(0,Z.jsx)($,{chat:e,currentFolderId:t,className:`oc-projpage__chatmenu`})]})}function Dt(e){let t=(0,X.useRef)(null);return(0,X.useEffect)(()=>{e&&t.current&&t.current.scrollIntoView({block:`center`})},[e]),t}function Ot({data:e,busyIds:t,suppressClick:n,locateChatId:r}){let[i,a]=(0,X.useState)(new Set),o=(0,X.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,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:d()});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=Ke(e.folders,a);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(q,{items:u.map(e=>`chat:${e._id}`),strategy:Y,children:u.map(e=>(0,Z.jsx)(At,{chat:e,depth:l,busy:t.has(e._id),locate:e._id===r,suppressClick:n},e._id))}),(0,Z.jsx)(q,{items:d.map(e=>`folder:${e._id}`),strategy:Y,children:d.map(t=>(0,Z.jsx)(kt,{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,Z.jsx)(`div`,{className:`oc-projpage__tree`,children:(o.get(e.rootId)??[]).length===0&&Ke(e.folders,null).length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:ge()}):c(null,0)})}function kt({folder:e,parentId:t,depth:n,folded:r,onToggle:i,suppressClick:a,children:o}){let s=L(),c=B({id:`folder:${e._id}`}),l=I({id:_t(e._id)});return(0,Z.jsxs)(`div`,{className:`oc-projpage__treegroup`,children:[(0,Z.jsxs)(`div`,{ref:e=>{c.setNodeRef(e),l.setNodeRef(e)},className:`oc-projpage__treerow oc-projpage__treerow--folder`+(l.isOver?` is-over`:``)+(c.isDragging?` is-dragging`:``),style:{"--tree-depth":n,"--proj-hue":H(e),transform:G.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,Z.jsx)(`button`,{type:`button`,className:`oc-projpage__treechev`,"aria-label":r?N():w(),"aria-expanded":!r,onClick:e=>{e.stopPropagation(),!a.current&&i()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:r?(0,Z.jsx)($e,{size:13}):(0,Z.jsx)(Te,{size:13})}),(0,Z.jsx)(z,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,Z.jsx)(dt,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__treemenu`,onOpen:()=>void s({to:`/project/$projectId`,params:{projectId:e._id}})})]}),o]})}function At({chat:e,depth:t,busy:n,locate:r,suppressClick:i}){let a=L(),o=B({id:`chat:${e._id}`}),s=Dt(r),c=U(e.color);return(0,Z.jsxs)(`div`,{ref:e=>{o.setNodeRef(e),s.current=e},className:`oc-projpage__treerow oc-projpage__treerow--chat`+(o.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{"--tree-depth":t,transform:G.Transform.toString(o.transform),transition:o.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a({to:`/chat/$chatId`,params:{chatId:e._id}})},...o.listeners,...o.attributes,children:[c?(0,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||x()}),n?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,"aria-hidden":!0}):null]}),(0,Z.jsx)($,{chat:e,currentFolderId:e.folderId,className:`oc-projpage__treemenu`}),(0,Z.jsx)(Tt,{chat:e})]})}function jt({data:e,currentId:t,busyIds:n,suppressClick:r,locateChatId:i}){let a=(0,X.useRef)(null);return(0,X.useEffect)(()=>{let e=a.current;e&&(e.scrollLeft=e.scrollWidth)},[e?.columns.length??0,t]),e===void 0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:d()}):(0,Z.jsx)(`div`,{className:`oc-projpage__cols`,ref:a,children:e.columns.map((a,o)=>(0,Z.jsx)(Mt,{col:a,isLast:o===e.columns.length-1,currentId:t,busyIds:n,suppressClick:r,locateChatId:i},a.folderId??`root`))})}function Mt({col:e,isLast:t,currentId:n,busyIds:r,suppressClick:i,locateChatId:a}){let o=L(),s=I({id:vt(e.folderId)});return(0,Z.jsxs)(`div`,{ref:s.setNodeRef,className:`oc-projpage__col`+(s.isOver?` is-over`:``)+(t?` is-last`:``),children:[(0,Z.jsx)(q,{items:e.folders.map(e=>`folder:${e._id}`),strategy:Y,children:e.folders.map(t=>(0,Z.jsx)(Nt,{folder:t,parentId:e.folderId,isCurrent:t._id===n,suppressClick:i,onOpen:()=>void o({to:`/project/$projectId`,params:{projectId:t._id}})},t._id))}),(0,Z.jsx)(q,{items:e.chats.map(e=>`chat:${e._id}`),strategy:Y,children:e.chats.map(t=>(0,Z.jsx)(Pt,{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,Z.jsx)(`p`,{className:`oc-projpage__colempty`,children:le()}):null]})}function Nt({folder:e,parentId:t,isCurrent:n,suppressClick:r,onOpen:i}){let a=B({id:`folder:${e._id}`}),o=I({id:_t(e._id)});return(0,Z.jsxs)(`div`,{ref:e=>{a.setNodeRef(e),o.setNodeRef(e)},className:`oc-projpage__colentry oc-projpage__colentry--folder`+(e.selected||n?` is-selected`:``)+(o.isOver?` is-over`:``)+(a.isDragging?` is-dragging`:``),style:{"--proj-hue":H(e),transform:G.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,Z.jsx)(z,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,Z.jsx)(`span`,{className:`oc-projpage__colchev`,"aria-hidden":!0,children:`›`}),(0,Z.jsx)(dt,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__colmenu`,onOpen:i})]})}function Pt({chat:e,folderId:t,busy:n,locate:r,suppressClick:i,onOpen:a}){let o=B({id:`chat:${e._id}`}),s=Dt(r),c=U(e.color);return(0,Z.jsxs)(`div`,{ref:e=>{o.setNodeRef(e),s.current=e},className:`oc-projpage__colentry oc-projpage__colentry--chat`+(o.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{transform:G.Transform.toString(o.transform),transition:o.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a()},...o.listeners,...o.attributes,children:[c?(0,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||x()}),n?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,"aria-hidden":!0}):null]}),(0,Z.jsx)($,{chat:e,currentFolderId:t,className:`oc-projpage__colmenu oc-projpage__colmenu--chat`}),(0,Z.jsx)(Tt,{chat:e})]})}export{xt as ProjectPage};
|