@lacneu/atrium 0.10.16 → 0.10.18
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-C2TDcMit.js → AccessTab-wgwrrOkq.js} +1 -1
- package/dist/assets/{AdvancedFilter-DrUoj1oY.js → AdvancedFilter-CQA9SSeX.js} +1 -1
- package/dist/assets/AgentFilesTab-DpvNcKxY.js +3 -0
- package/dist/assets/{AnomaliesTab-_Jt6y2Sy.js → AnomaliesTab-CsVaUK9r.js} +1 -1
- package/dist/assets/AuditTab-BCGc5fh-.js +1 -0
- package/dist/assets/{BridgeTab-BhxIgO6W.js → BridgeTab-CI5Pr3zt.js} +1 -1
- package/dist/assets/ChatDefaultsTab-C4KGYhV-.js +1 -0
- package/dist/assets/{DataTableShell-BY48g0WO.js → DataTableShell-B62Qv-tB.js} +1 -1
- package/dist/assets/{DetailChips-B_6c_-iY.js → DetailChips-fND9q0WY.js} +1 -1
- package/dist/assets/FeedbacksTab-xd7LisqB.js +1 -0
- package/dist/assets/{FieldLabel-BrnlMFJq.js → FieldLabel-DkIcKewT.js} +1 -1
- package/dist/assets/FilesTab-BzZTNirP.js +1 -0
- package/dist/assets/{FilterBar-Cn4lFaY4.js → FilterBar-CWlA8nZ0.js} +1 -1
- package/dist/assets/GroupsTab-DDGHlCam.js +1 -0
- package/dist/assets/InstancesTab-CENcOK8c.js +1 -0
- package/dist/assets/{IntegrationsTab-CwPWnqkr.js → IntegrationsTab-DSfAaftT.js} +1 -1
- package/dist/assets/{KpiTab-ChPoG2S2.js → KpiTab-Cn6U4E5D.js} +1 -1
- package/dist/assets/PreferencesTab-SI6PHYsQ.js +1 -0
- package/dist/assets/{PromptInjectionsTab-XzEme_aG.js → PromptInjectionsTab-ZwimzgiF.js} +2 -2
- package/dist/assets/RolesTab-Dm9rHjli.js +1 -0
- package/dist/assets/ServiceAccountsTab-Oxuo-aSo.js +1 -0
- package/dist/assets/ThemeShowroom-O_cVLe2-.js +1 -0
- package/dist/assets/{TimeRangePicker-BCumk2bf.js → TimeRangePicker-CXb27Tev.js} +1 -1
- package/dist/assets/TracesTab-CWvJFPjX.js +1 -0
- package/dist/assets/{UsersTab-1qfp9sce.js → UsersTab-Co8sYpJL.js} +1 -1
- package/dist/assets/button-G-_IqZDp.js +1 -0
- package/dist/assets/{card-B4hdn0Qh.js → card-B3VbgixI.js} +1 -1
- package/dist/assets/chevrons-up-down-BlHpdE9v.js +1 -0
- package/dist/assets/{compatView-BLkCb0a4.js → compatView-hfeNAe7g.js} +1 -1
- package/dist/assets/{dispatchErrorInfo-eTOwTxQJ.js → dispatchErrorInfo-DpmUia7q.js} +1 -1
- package/dist/assets/{dist-D2UVxg3M.js → dist--S7AYRAA.js} +1 -1
- package/dist/assets/dist-0Nx0BXy1.js +5 -0
- package/dist/assets/{dist-CEGGJ9VY.js → dist-BDPwn3r0.js} +1 -1
- package/dist/assets/{dist-CfgJ5RDI.js → dist-CgXYe09h.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-CwnBPq8J.js → highlighted-body-OFNGDK62-5MhDiezJ.js} +1 -1
- package/dist/assets/{index-BsbX_-dh.js → index-BmXiVWTf.js} +16 -16
- package/dist/assets/mermaid-GHXKKRXX-CNK1PBuN.js +1 -0
- package/dist/assets/roleDescriptions-I2Mil-DA.js +1 -0
- package/dist/assets/{table-BYj7Kdzy.js → table-xKqB5hyP.js} +1 -1
- package/dist/assets/x-CpLBfKr9.js +1 -0
- package/dist/index.html +7 -7
- package/package.json +1 -1
- package/dist/assets/AgentFilesTab-BrBVC0WC.js +0 -3
- package/dist/assets/AuditTab-C-6Oxrdo.js +0 -1
- package/dist/assets/ChatDefaultsTab-C9JLQe-F.js +0 -1
- package/dist/assets/FeedbacksTab-28fA354v.js +0 -1
- package/dist/assets/FilesTab-Bt_1sxvl.js +0 -1
- package/dist/assets/GroupsTab-DNcRR1QL.js +0 -1
- package/dist/assets/InstancesTab-CJtDMRcA.js +0 -1
- package/dist/assets/PreferencesTab-DD8qntSU.js +0 -1
- package/dist/assets/RolesTab-D1aBj2un.js +0 -1
- package/dist/assets/ServiceAccountsTab-D30Lhilu.js +0 -1
- package/dist/assets/ThemeShowroom-BrXPZ7CL.js +0 -1
- package/dist/assets/TracesTab-DW9c-271.js +0 -1
- package/dist/assets/button-ClzO6iiY.js +0 -1
- package/dist/assets/chevrons-up-down-B3gRA_gV.js +0 -1
- package/dist/assets/dist-Ygn7c4YX.js +0 -5
- package/dist/assets/mermaid-GHXKKRXX-BtlnP6HU.js +0 -1
- package/dist/assets/roleDescriptions-Bjw3U0di.js +0 -1
- package/dist/assets/x-TUhW74Oi.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{D as e}from"./index-BmXiVWTf.js";export{e as Mermaid};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Cd as e,Ed as t,Sd as n,Td as r,wd as i}from"./dist-CgXYe09h.js";var a={pending:t,user:r,admin:i,observer:e,agent:n};function o(e){if(e.builtin){let t=a[e.key];if(t)return t()}return e.description}export{o as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{n}from"./dist-
|
|
1
|
+
import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{n}from"./dist-CgXYe09h.js";e();var r=t();function i({className:e,...t}){return(0,r.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full overflow-x-auto`,children:(0,r.jsx)(`table`,{"data-slot":`table`,className:n(`w-full caption-bottom text-sm`,e),...t})})}function a({className:e,...t}){return(0,r.jsx)(`thead`,{"data-slot":`table-header`,className:n(`[&_tr]:border-b`,e),...t})}function o({className:e,...t}){return(0,r.jsx)(`tbody`,{"data-slot":`table-body`,className:n(`[&_tr:last-child]:border-0`,e),...t})}function s({className:e,...t}){return(0,r.jsx)(`tr`,{"data-slot":`table-row`,className:n(`border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted`,e),...t})}function c({className:e,...t}){return(0,r.jsx)(`th`,{"data-slot":`table-head`,className:n(`h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0`,e),...t})}function l({className:e,...t}){return(0,r.jsx)(`td`,{"data-slot":`table-cell`,className:n(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,e),...t})}export{a,c as i,o as n,s as o,l as r,i as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{uw as e}from"./dist-CgXYe09h.js";var t=e(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);export{t};
|
package/dist/index.html
CHANGED
|
@@ -38,14 +38,14 @@
|
|
|
38
38
|
document.documentElement.dataset.ambiance = a === "off" ? "off" : "on";
|
|
39
39
|
})();
|
|
40
40
|
</script>
|
|
41
|
-
<script type="module" crossorigin src="/assets/index-
|
|
41
|
+
<script type="module" crossorigin src="/assets/index-BmXiVWTf.js"></script>
|
|
42
42
|
<link rel="modulepreload" crossorigin href="/assets/bundle-mjs-C73ZY4La.js">
|
|
43
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-
|
|
44
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-
|
|
45
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-
|
|
46
|
-
<link rel="modulepreload" crossorigin href="/assets/dist
|
|
47
|
-
<link rel="modulepreload" crossorigin href="/assets/x-
|
|
48
|
-
<link rel="modulepreload" crossorigin href="/assets/button-
|
|
43
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-CgXYe09h.js">
|
|
44
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-BDPwn3r0.js">
|
|
45
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-0Nx0BXy1.js">
|
|
46
|
+
<link rel="modulepreload" crossorigin href="/assets/dist--S7AYRAA.js">
|
|
47
|
+
<link rel="modulepreload" crossorigin href="/assets/x-CpLBfKr9.js">
|
|
48
|
+
<link rel="modulepreload" crossorigin href="/assets/button-G-_IqZDp.js">
|
|
49
49
|
<link rel="stylesheet" crossorigin href="/assets/index-BftON7pu.css">
|
|
50
50
|
</head>
|
|
51
51
|
<body>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lacneu/atrium",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.18",
|
|
4
4
|
"description": "Atrium — public, self-hostable, Convex-backed web chat UI for AI agent gateways (OpenClaw today, Hermes next). Ships an origin-agnostic static bundle (Convex URL injected at runtime via /config.json).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,B as i,F as a,FC as o,G as s,Gt as c,H as l,I as u,J as d,K as f,L as p,LC as ee,Ov as m,Q as te,R as h,U as g,Ut as ne,V as _,W as v,X as y,Y as b,Z as x,at as re,ct as S,cw as C,et as ie,fw as w,hw as T,it as E,lt as ae,nt as oe,ot as D,q as O,rt as k,st as A,tt as se,ut as j,z as M}from"./dist-CfgJ5RDI.js";import{t as N}from"./button-ClzO6iiY.js";import{B as P,C as F,F as I,G as L,H as ce,I as le,K as ue,P as de,R as fe,S as R,U as pe,V as me,W as he,_ as z,b as B,j as ge,m as _e,mt as V,ot as H,q as ve,x as U,y as W,z as ye}from"./index-BsbX_-dh.js";import{i as G}from"./compatView-BLkCb0a4.js";/* empty css */var K=t(e(),1),q=2e4,J=6e4;function Y(e){return typeof e!=`number`||e<=0?0:Math.round(e/q*100)}function X(e){return e<=0?0:Math.round(e/J*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 be(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var xe=3;function Se(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<xe&&a.push(e)):t>0&&(i+=t,o.length<xe&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function Ce(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function we(){let e=T(C.me.getMe,{host:H}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),i=T(C.admin.listInstances,e!==void 0&&t?{}:`skip`),[a,s]=(0,K.useState)(null);(0,K.useEffect)(()=>{!t||!i||i.length===0||(!a||!i.some(e=>e.name===a))&&s(i[0].name)},[t,i,a]);let c=T(C.agents.listAgentsForInstance,t&&a?{instanceName:a}:`skip`),l=T(C.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),u=(0,K.useMemo)(()=>{if(e!==void 0){if(t)return a===null||c===void 0?i!==void 0&&i.length===0?[]:void 0:c.agents.map(e=>({instanceName:a,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(l!==void 0)return l.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,a,c,i,l]),[d,f]=(0,K.useState)(null);(0,K.useEffect)(()=>{!u||u.length===0||(!d||!u.some(e=>$(e)===d))&&f($(u[0]))},[u,d]);let p=u?.find(e=>$(e)===d)??null,m=w(C.agentFiles.listAgentFiles),[h,g]=(0,K.useState)({status:`idle`}),_=p?.instanceName??null,v=p?.agentId??null,y=T(C.compat.forInstance,n&&_!==null?{instanceName:_}:`skip`),b=n&&_!==null?z(y,`agentFiles`):null,x=b===null?!1:b===`loading`?null:b.blocked,O=(0,K.useCallback)(async()=>{if(!(_===null||v===null)){g({status:`loading`});try{g({status:`done`,files:(await m({instanceName:_,agentId:v})).files})}catch{g({status:`error`})}}},[m,_,v]);(0,K.useEffect)(()=>{x===!1&&O()},[O,x]);let[M,P]=(0,K.useState)(null),I=ee(),L=(0,K.useMemo)(()=>new Intl.NumberFormat(I,{maximumFractionDigits:0}),[I]);return e===void 0||u===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:j()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(i?.length??0)>1?(0,Q.jsxs)(W,{value:a??``,onValueChange:e=>s(e),children:[(0,Q.jsx)(R,{size:`sm`,"aria-label":ae(),children:(0,Q.jsx)(F,{})}),(0,Q.jsx)(B,{children:(i??[]).map(e=>(0,Q.jsx)(U,{value:e.name,children:e.name},e.name))})]}):null,u.length>0?(0,Q.jsxs)(W,{value:d??``,onValueChange:e=>f(e),children:[(0,Q.jsx)(R,{size:`sm`,"aria-label":S(),children:(0,Q.jsx)(F,{})}),(0,Q.jsx)(B,{children:u.map(e=>(0,Q.jsx)(U,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:A()})]}),p===null?null:b===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):b!==null&&b.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(V,{size:14,"aria-hidden":!0}),` `,G(b.gatewayVersion)]}):h.status===`loading`||h.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):h.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[re(),` `,(0,Q.jsx)(N,{variant:`outline`,size:`sm`,onClick:()=>void O(),children:ne()})]}):h.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:D()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:h.files.map(e=>{let n=Y(e.size),i=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)(_e,{variant:`outline`,children:E()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:k({size:Z(e.size,I)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${i?` 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:oe({pct:L.format(n)})}),i?(0,Q.jsx)(V,{size:14,className:`oc-afiles__warn`,"aria-label":se()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(N,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>P(e),children:t?r():te()})]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:ie({used:Z(be(h.files),I),total:Z(J,I),pct:L.format(X(be(h.files)))})})]}),M&&p?(0,Q.jsx)(Te,{instanceName:p.instanceName,agentId:p.agentId,name:M.name,isAdmin:t,onClose:()=>P(null),onSaved:()=>void O()}):null]})}function Te({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:te,onSaved:re}){let S=w(C.agentFiles.getAgentFile),ie=w(C.agentFiles.setAgentFile),T=ge(),[E,ae]=(0,K.useState)(null),[oe,D]=(0,K.useState)(!1),[k,A]=(0,K.useState)(``),[se,j]=(0,K.useState)(!1),[F,R]=(0,K.useState)(!1),[z,B]=(0,K.useState)(!1),[_e,V]=(0,K.useState)(!1),H=(0,K.useCallback)(async r=>{D(!1);try{let i=await S({instanceName:e,agentId:t,name:n});ae({content:i.content,updatedAtMs:i.updatedAtMs}),r||A(i.content),B(!1)}catch{D(!0)}},[S,e,t,n]);(0,K.useEffect)(()=>{H(!1)},[H]);async function U(){if(E!==null){R(!0),V(!1);try{await ie({instanceName:e,agentId:t,name:n,content:k,baseUpdatedAtMs:E.updatedAtMs??void 0}),T.success(s({name:n})),re(),await H(!1)}catch(e){Ce(e)?B(!0):V(!0)}finally{R(!1)}}}let W=E!==null&&k!==E.content,G=(0,K.useMemo)(()=>E===null?null:Se(E.content,k),[E,k]),J=k.length>q,Y=ee(),X=(0,K.useMemo)(()=>new Intl.NumberFormat(Y),[Y]);return(0,Q.jsx)(de,{open:!0,onOpenChange:e=>!e&&te(),children:(0,Q.jsxs)(I,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(fe,{children:[(0,Q.jsx)(ye,{children:x({name:n})}),(0,Q.jsxs)(le,{children:[y({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,b()]})]})]}),oe?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[g(),` `,(0,Q.jsx)(N,{variant:`outline`,size:`sm`,onClick:()=>void H(!1),children:ne()})]}):E===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:k,readOnly:!r,spellCheck:!1,onChange:e=>A(e.target.value),"aria-label":x({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:d()}),z?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[l(),` `,(0,Q.jsx)(N,{variant:`outline`,size:`sm`,onClick:()=>void H(!0),children:_()})]}):null,_e?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:v()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${J?` is-over`:``}`,children:O({count:X.format(k.length),max:X.format(q)})}),r?(0,Q.jsx)(N,{size:`sm`,disabled:!W||F||z,onClick:()=>j(!0),children:F?c():f()}):null]})]}),(0,Q.jsx)(P,{open:se,onOpenChange:j,children:(0,Q.jsxs)(pe,{children:[(0,Q.jsxs)(ue,{children:[(0,Q.jsx)(ve,{children:i({name:n})}),(0,Q.jsx)(he,{children:M({agent:t})})]}),G?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:h({added:G.added,removed:G.removed})}),G.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:p()}),G.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,G.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:u()}),G.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(L,{children:[(0,Q.jsx)(ce,{children:m()}),(0,Q.jsx)(me,{onClick:()=>void U(),children:a()})]})]})})]})})}export{we as AgentFilesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{_f as r,af as i,cf as a,cw as o,df as s,ff as c,gf as l,hf as u,hw as ee,if as d,lf as f,mf as p,of as m,pf as h,rf as g,sf as _,uf as v}from"./dist-CfgJ5RDI.js";import{n as y}from"./TimeRangePicker-BCumk2bf.js";import{C as b,Ot as x,S,a as C,b as w,i as T,kt as E,o as D,r as O,t as k,x as A,y as j}from"./index-BsbX_-dh.js";import{t as M}from"./FilterBar-Cn4lFaY4.js";import{t as N}from"./AdvancedFilter-DrUoj1oY.js";import{t as P}from"./DataTableShell-BY48g0WO.js";var F=t(e(),1),I=n(),L={kind:`relative`,from:k,to:`now`},R=`__all__`,z=[{value:`action`,label:`action`},{value:`realLabel`,label:`acteur réel`},{value:`targetLabel`,label:`au nom de`},{value:`impersonated`,label:`usurpation`},{value:`resource`,label:`ressource`},{value:`resourceId`,label:`id ressource`}];function B(){let e=E({from:`/settings/audit`}),t=x({from:`/settings/audit`}),n=e.q??``,k=e.action??R,B=e.impersonated??R,V=e.resource??R,H=O(e.from,e.to),U=(0,F.useMemo)(()=>D(e.adv),[e.adv]),{from:W,to:G}=y(H),K=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),q=e=>void t({search:t=>({...t,action:e===R?void 0:e})}),J=e=>void t({search:t=>({...t,impersonated:e===R?void 0:e})}),Y=e=>void t({search:t=>({...t,resource:e===R?void 0:e})}),X=e=>void t({search:t=>({...t,...C(e)})}),Z=e=>void t({search:t=>({...t,adv:T(e)}),replace:!0}),Q=ee(o.admin.listAudit,{filter:{q:n||void 0,from:W,to:G,action:k===R?void 0:k,resource:V===R?void 0:V,impersonated:B===R?void 0:B===`yes`,advanced:U.length>0?U:void 0}}),$=(0,F.useMemo)(()=>{let e=new Set;for(let t of Q??[])e.add(t.action);return[...e].sort()},[Q]),te=(0,F.useMemo)(()=>{let e=new Set;for(let t of Q??[])t.resource&&e.add(t.resource);return[...e].sort()},[Q]),ne=n!==``||k!==R||B!==R||V!==R||U.length>0||H.kind!==`relative`||H.from!==L.from;function re(){t({search:{},replace:!0})}return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[r(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:l()})]}),(0,I.jsxs)(M,{q:n,onQChange:K,searchPlaceholder:u(),timeRange:H,onTimeRangeChange:X,onReset:re,canReset:ne,children:[(0,I.jsxs)(j,{value:k,onValueChange:q,children:[(0,I.jsx)(S,{size:`sm`,className:`w-40`,children:(0,I.jsx)(b,{placeholder:p()})}),(0,I.jsxs)(w,{children:[(0,I.jsx)(A,{value:R,children:h()}),$.map(e=>(0,I.jsx)(A,{value:e,children:e},e))]})]}),(0,I.jsxs)(j,{value:B,onValueChange:J,children:[(0,I.jsx)(S,{size:`sm`,className:`w-40`,children:(0,I.jsx)(b,{})}),(0,I.jsxs)(w,{children:[(0,I.jsx)(A,{value:R,children:c()}),(0,I.jsx)(A,{value:`yes`,children:s()}),(0,I.jsx)(A,{value:`no`,children:v()})]})]}),(0,I.jsxs)(j,{value:V,onValueChange:Y,children:[(0,I.jsx)(S,{size:`sm`,className:`w-40`,children:(0,I.jsx)(b,{placeholder:f()})}),(0,I.jsxs)(w,{children:[(0,I.jsx)(A,{value:R,children:a()}),te.map(e=>(0,I.jsx)(A,{value:e,children:e},e))]})]})]}),(0,I.jsx)(N,{fields:z,seed:U,onChange:Z}),(0,I.jsx)(P,{title:_(),rows:Q,emptyHint:m(),columns:[{header:i(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:p(),cell:e=>e.action,sort:e=>e.action},{header:d(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:g(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:f(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{B as AuditTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{A as r,C as i,Cc as a,D as o,E as s,FC as c,Gt as ee,M as te,N as ne,O as re,Ov as ie,Rt as ae,S as oe,T as l,Ut as u,cw as d,fw as f,hw as p,j as m,k as se,lt as h,w as g,x as _,zt as ce}from"./dist-CfgJ5RDI.js";import{t as v}from"./button-ClzO6iiY.js";import{B as le,C as ue,G as de,H as fe,K as pe,S as me,U as he,V as y,W as b,_ as x,b as S,g as C,j as w,mt as T,q as E,v as D,x as O,y as k}from"./index-BsbX_-dh.js";import{i as A}from"./compatView-BLkCb0a4.js";/* empty css */var j=t(e(),1),M=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function N(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 P=n();function F(){let e=f(d.agentFiles.getChatDefaults),t=f(d.agentFiles.setChatDefaults),n=w(),[F,I]=(0,j.useState)({status:`loading`}),[L,R]=(0,j.useState)({thinkingDefault:null,fastModeDefault:null}),[ge,z]=(0,j.useState)(!1),[B,V]=(0,j.useState)(!1),H=p(d.admin.listInstances,{}),[U,W]=(0,j.useState)(null);(0,j.useEffect)(()=>{!H||H.length===0||(!U||!H.some(e=>e.name===U))&&W(H[0].name)},[H,U]);let G=(H?.length??0)>1,_e=H!==void 0&&H.length===0,ve=p(d.compat.forInstance,U?{instanceName:U}:`skip`),K=U?x(ve,`configDefaults`):`loading`,q=K===`loading`?null:K.blocked,J=(0,j.useMemo)(()=>G&&U?{instanceName:U}:{},[G,U]),Y=(0,j.useRef)(0),X=(0,j.useCallback)(async()=>{let t=++Y.current;I({status:`loading`});try{let n=N(await e(J));if(Y.current!==t)return;I({status:`done`,current:n}),R(n)}catch{if(Y.current!==t)return;I({status:`error`})}},[e,J]);(0,j.useEffect)(()=>{q===!1&&(G&&!U||X())},[X,q,G,U]);let Z=F.status===`done`?F.current:null,Q=Z!==null&&L.thinkingDefault!==null&&L.thinkingDefault!==Z.thinkingDefault,$=Z!==null&&L.fastModeDefault!==null&&L.fastModeDefault!==Z.fastModeDefault,ye=Q||$;async function be(){V(!0);try{await t({...J,...Q?{thinkingDefault:L.thinkingDefault}:{},...$?{fastModeDefault:L.fastModeDefault}:{}}),n.success(s()),await X()}catch(e){n.error(l(),e)}finally{V(!1)}}let xe=(0,j.useMemo)(()=>M.map(e=>({id:e,label:D(e)})),[]),Se=(0,j.useMemo)(()=>[{id:`fast`,label:ce()},{id:`standard`,label:ae()}],[]);return(0,P.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:ne()}),G&&U?(0,P.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,P.jsx)(`span`,{className:`oc-cdefaults__label`,children:h()}),(0,P.jsxs)(k,{value:U,onValueChange:e=>W(e),disabled:B,children:[(0,P.jsx)(me,{size:`sm`,"aria-label":h(),children:(0,P.jsx)(ue,{})}),(0,P.jsx)(S,{children:(H??[]).map(e=>(0,P.jsx)(O,{value:e.name,children:e.name},e.name))})]})]}):null,_e?(0,P.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:a()}):K===`loading`?(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):K.blocked?(0,P.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,P.jsx)(T,{size:14,"aria-hidden":!0}),` `,A(K.gatewayVersion)]}):F.status===`loading`?(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):F.status===`error`?(0,P.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[re(),` `,(0,P.jsx)(v,{variant:`outline`,size:`sm`,onClick:()=>void X(),children:u()})]}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,P.jsx)(`span`,{className:`oc-cdefaults__label`,children:te()}),(0,P.jsx)(C,{options:xe,value:L.thinkingDefault,onChange:e=>R({...L,thinkingDefault:e}),disabled:B}),(0,P.jsx)(`p`,{className:`oc-cdefaults__help`,children:m()})]}),(0,P.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,P.jsx)(`span`,{className:`oc-cdefaults__label`,children:r()}),(0,P.jsx)(C,{options:Se,value:L.fastModeDefault===null?null:L.fastModeDefault?`fast`:`standard`,onChange:e=>R({...L,fastModeDefault:e===`fast`}),disabled:B}),(0,P.jsx)(`p`,{className:`oc-cdefaults__help`,children:se()})]}),(0,P.jsx)(`div`,{className:`oc-cdefaults__actions`,children:(0,P.jsx)(v,{size:`sm`,disabled:!ye||B,onClick:()=>z(!0),children:B?ee():o()})}),(0,P.jsx)(`p`,{className:`oc-cdefaults__note`,children:g()})]}),(0,P.jsx)(le,{open:ge,onOpenChange:z,children:(0,P.jsxs)(he,{children:[(0,P.jsxs)(pe,{children:[(0,P.jsx)(E,{children:i()}),(0,P.jsx)(b,{children:oe()})]}),(0,P.jsxs)(de,{children:[(0,P.jsx)(fe,{children:ie()}),(0,P.jsx)(y,{onClick:()=>void be(),children:_()})]})]})})]})}export{F as ChatDefaultsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$m as r,Ah as i,Bm as a,Ch as o,Dh as s,Eh as c,Fm as l,Gm as u,Hm as d,Im as f,Jm as p,Km as m,Lm as ee,Mh as h,Mm as te,Nh as g,Nm as ne,Oh as _,Pm as re,Qm as ie,Rm as ae,Sh as v,Th as y,Um as b,Vm as x,Wm as S,Xm as C,Ym as w,Zm as T,_h as E,ah as D,bh as O,ch as k,cw as A,dh as j,eh as M,fh as N,gh as P,hh as F,hw as I,ih as L,jh as R,kh as z,lh as B,mh as V,mw as H,nh as U,oh as W,ph as G,qm as K,rh as q,sh as J,th as oe,uh as se,vh as ce,wh as le,xh as ue,yh as de,zm as fe}from"./dist-CfgJ5RDI.js";import{t as pe}from"./button-ClzO6iiY.js";import{M as me}from"./index-BsbX_-dh.js";import{t as he}from"./DataTableShell-BY48g0WO.js";var Y=t(e(),1),X=n(),Z={altered_words:()=>g(),incorrect:()=>h(),incoherence:()=>R(),formatting:()=>i(),latency:()=>z(),api_error:()=>_(),other:()=>s()},Q=e=>Z[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:y()}):e===!1?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:le()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:c()})}function ge({data:e,closeReason:t}){let n=e.snapshot,r=H(A.feedback.respondToFeedback),[i,a]=(0,Y.useState)(e.thread),[s,c]=(0,Y.useState)(``),[l,u]=(0,Y.useState)(!1);async function d(){let t=s.trim();if(!(!t||l)){u(!0);try{await r({feedbackId:e._id,text:t}),a(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),c(``)}finally{u(!1)}}}let f=[];try{f=n.contextJson?JSON.parse(n.contextJson):[]}catch{f=[]}return(0,X.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,X.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,X.jsx)($,{matches:n.displayedMatchesStored,sourceWasOpen:n.clientInfo?.sourceWasOpen??!1}),(0,X.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,n.messageRole,n.isRegeneration?` · ${o()}`:``,n.openclawModel?` · ${n.openclawModel}`:``,n.openclawRuntime?` (${n.openclawRuntime})`:``]})]}),e.comment?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:v()}),(0,X.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,t?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ae()}),(0,X.jsx)(`p`,{className:`oc-fbadmin__comment`,children:t})]}):null,(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ue()}),i.length>0?(0,X.jsx)(`div`,{className:`oc-fbadmin__thread`,children:i.map((e,t)=>(0,X.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,X.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?O():de()}),(0,X.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,X.jsx)(`p`,{className:`oc-fbadmin__meta`,children:ce()}),(0,X.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:E(),value:s,maxLength:2e3,rows:3,onChange:e=>c(e.target.value.slice(0,2e3))}),(0,X.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,X.jsx)(pe,{size:`sm`,onClick:()=>void d(),disabled:!s.trim()||l,children:l?P():F()})})]}),(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:V()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.messageText||G()})]}),n.clientInfo?.sourceWasOpen&&n.displayedText!==void 0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:N()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.displayedText||G()})]}):null,n.promptText?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:j()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.promptText})]}):null,f.length>0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:se({count:n.contextCount??f.length,truncated:n.contextTruncated?B():``})}),(0,X.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:f.map((e,t)=>(0,X.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,X.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,X.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,n.outboxAvailable?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:k()}),(0,X.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[n.outboxText??``,n.outboxStatus?`\n[status: ${n.outboxStatus}]`:``]})]}):null,n.clientInfo?.extensionsDetected&&n.clientInfo.extensionsDetected.length>0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:J()}),(0,X.jsx)(`div`,{className:`oc-fbadmin__row`,children:n.clientInfo.extensionsDetected.map(e=>(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:W()}),(0,X.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[n.clientInfo?.language,n.clientInfo?.timezone,n.clientInfo?.theme?D({theme:n.clientInfo.theme}):null,n.runId?`run ${n.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,n.clientInfo?.plugins&&n.clientInfo.plugins.length>0?(0,X.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[L(),` `,n.clientInfo.plugins.join(`, `),(0,X.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,q()]})]}):null,n.clientInfo?.userAgent?(0,X.jsx)(`span`,{className:`oc-fbadmin__ua`,children:n.clientInfo.userAgent}):null]})]})]})}function _e(){let e=I(A.feedback.listForAdmin,{}),t=H(A.feedback.readSnapshot),n=H(A.feedback.deleteFeedback),i=me(),[o,s]=(0,Y.useState)(null),[c,h]=(0,Y.useState)({});async function g(e){if(o===e._id){s(null);return}if(!c[e._id]){let n=await t({feedbackId:e._id});h(t=>({...t,[e._id]:n}))}s(e._id)}async function _(e){await i({title:re(),description:ne(),confirmLabel:te(),destructive:!0})&&(await n({feedbackId:e._id}),o===e._id&&s(null))}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[U(),` `,(0,X.jsx)(`strong`,{children:oe()}),` `,M()]}),(0,X.jsx)(he,{title:r(),rows:e,emptyHint:ie(),isExpanded:e=>o===e._id&&!!c[e._id],renderExpanded:e=>c[e._id]?(0,X.jsx)(ge,{data:c[e._id],closeReason:e.userCloseReason}):null,columns:[{header:T(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:C(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:w(),cell:e=>e.messageRole===`user`?p():K(),sort:e=>e.messageRole},{header:m(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${u({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:S(),cell:e=>(0,X.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:b(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:d(),cell:e=>e.userClosedAt==null?e.answered?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:x()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:a()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:fe()}),sort:e=>e.userClosedAt==null?+!!e.answered:2}],rowActions:e=>[{label:o===e._id?ee():f(),onSelect:()=>void g(e)},{label:l(),onSelect:()=>void _(e),variant:`destructive`}]})]})}export{_e as FeedbacksTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$S as r,BS as i,FC as ee,FS as te,GS as ne,HS as re,IS as ie,JS as ae,KS as oe,LC as a,LS as o,MS as s,NS as c,Ov as l,PS as se,QS as u,RS as ce,US as le,VS as ue,WS as de,XS as d,YS as fe,ZS as f,aC as pe,cC as me,cw as p,dC as he,eC as m,fC as ge,hw as _e,iC as ve,lC as h,mw as ye,nC as g,oC as _,pC as v,qS as y,rC as b,sC as x,tC as S,uC as C,zS as w}from"./dist-CfgJ5RDI.js";import{t as T}from"./button-ClzO6iiY.js";import{$ as E,B as D,C as O,Ct as k,G as A,H as j,K as M,Q as N,S as P,U as be,V as xe,W as Se,b as F,et as I,ht as Ce,j as we,m as Te,q as Ee,rt as De,wt as L,x as R,y as z,yt as Oe}from"./index-BsbX_-dh.js";import{a as ke,i as B,n as Ae,o as V,r as H,t as je}from"./table-BYj7Kdzy.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return g();case`audio`:return S();case`video`:return m();case`pdf`:return r();case`document`:return u();case`archive`:return f();default:return d()}}function q(){let[e,t]=(0,U.useState)(G),[n,r]=(0,U.useState)(G),[u,d]=(0,U.useState)(G),[f,m]=(0,U.useState)(G),[g,S]=(0,U.useState)(null),q=ye(p.files.softDelete),J=we();function Me(){t(G),r(G),d(G),m(G)}async function Ne(){let e=g;if(S(null),e)try{await q({fileId:e.id}),J.success(w())}catch(e){J.error(ce(),e)}}let Y=_e(p.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:u===G?void 0:u,category:f===G?void 0:f}),X=(0,U.useMemo)(()=>new Intl.DateTimeFormat(a(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(Y===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:ee()});let{files:Z,facets:Q,truncated:Pe,cap:Fe}=Y,$=e!==G||n!==G||u!==G||f!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:v()}),(0,W.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,W.jsxs)(z,{value:e,onValueChange:t,children:[(0,W.jsx)(P,{size:`sm`,"aria-label":ge(),children:(0,W.jsx)(O,{})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(R,{value:G,children:he()}),(0,W.jsx)(R,{value:`inbound`,children:C()}),(0,W.jsx)(R,{value:`outbound`,children:h()})]})]}),(0,W.jsxs)(z,{value:n,onValueChange:r,children:[(0,W.jsx)(P,{size:`sm`,"aria-label":me(),children:(0,W.jsx)(O,{})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(R,{value:G,children:x()}),Q.chats.map(e=>(0,W.jsx)(R,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(z,{value:u,onValueChange:d,children:[(0,W.jsx)(P,{size:`sm`,"aria-label":_(),children:(0,W.jsx)(O,{})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(R,{value:G,children:pe()}),Q.instances.map(e=>(0,W.jsx)(R,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(z,{value:f,onValueChange:m,children:[(0,W.jsx)(P,{size:`sm`,"aria-label":ve(),children:(0,W.jsx)(O,{})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(R,{value:G,children:b()}),Q.categories.map(e=>(0,W.jsx)(R,{value:e,children:K(e)},e))]})]}),$?(0,W.jsxs)(T,{variant:`ghost`,size:`sm`,onClick:Me,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,W.jsx)(Oe,{size:14,"aria-hidden":!0}),re()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?c():se()}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(je,{children:[(0,W.jsx)(ke,{children:(0,W.jsxs)(V,{children:[(0,W.jsx)(B,{children:fe()}),(0,W.jsx)(B,{children:ae()}),(0,W.jsx)(B,{children:y()}),(0,W.jsx)(B,{children:oe()}),(0,W.jsx)(B,{children:ne()}),(0,W.jsx)(B,{className:`text-right`,children:de()})]})}),(0,W.jsx)(Ae,{children:Z.map(e=>(0,W.jsxs)(V,{children:[(0,W.jsx)(H,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:e.filename}),(0,W.jsx)(H,{title:e.mimeType,children:K(e.category)}),(0,W.jsx)(H,{children:(0,W.jsx)(Te,{variant:`secondary`,children:e.direction===`inbound`?C():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:X.format(e.createdAt)}),(0,W.jsx)(H,{className:`text-right`,children:(0,W.jsxs)(N,{children:[(0,W.jsx)(De,{asChild:!0,children:(0,W.jsx)(T,{variant:`ghost`,size:`icon`,"aria-label":ue(),children:(0,W.jsx)(k,{size:16})})}),(0,W.jsxs)(E,{align:`end`,children:[e.url?(0,W.jsx)(I,{asChild:!0,children:(0,W.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(L,{size:14}),le()]})}):(0,W.jsxs)(I,{disabled:!0,children:[(0,W.jsx)(L,{size:14}),te()]}),(0,W.jsxs)(I,{variant:`destructive`,onSelect:()=>S({id:e._id,filename:e.filename}),children:[(0,W.jsx)(Ce,{size:14}),i()]})]})]})})]},e._id))})]}),Pe?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:s({cap:Fe})}):null]}),(0,W.jsx)(D,{open:g!==null,onOpenChange:e=>!e&&S(null),children:(0,W.jsxs)(be,{children:[(0,W.jsxs)(M,{children:[(0,W.jsx)(Ee,{children:o()}),(0,W.jsx)(Se,{children:ie()})]}),(0,W.jsxs)(A,{children:[(0,W.jsx)(j,{children:l()}),(0,W.jsx)(xe,{onClick:()=>void Ne(),children:i()})]})]})})]})}export{q as FilesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$n as r,An as i,Bn as a,Cn as o,Dn as s,En as c,Fn as l,Gn as u,Hn as d,In as f,JC as p,Jn as m,KC as h,Kn as g,Ln as _,Mn as v,Nn as y,On as b,Pn as x,Qn as ee,Rn as te,Sn as S,Tn as ne,Un as re,Vn as ie,Wn as ae,Xn as oe,Yn as C,ZC as w,Zn as se,_n as T,an as E,ar as ce,bn as D,cn as le,cr as O,cw as k,dn as ue,dr as A,er as de,ew as j,fn as M,fr as fe,gn as N,hn as P,hw as F,in as pe,ir as me,jn as he,kn as ge,ln as _e,lr as ve,lw as I,mn as ye,mw as L,n as R,nr as be,on as xe,or as Se,pn as Ce,qC as we,qn as Te,rn as Ee,rr as De,sn as z,sr as Oe,t as ke,tr as Ae,tw as B,un as je,ur as Me,vn as Ne,wn as Pe,xn as Fe,yn as Ie,zn as Le}from"./dist-CfgJ5RDI.js";import{t as Re}from"./dist-CEGGJ9VY.js";import{t as ze}from"./x-TUhW74Oi.js";import{t as V}from"./button-ClzO6iiY.js";import{C as Be,Dt as Ve,F as He,I as Ue,J as H,M as We,O as U,P as Ge,R as Ke,S as qe,_t as W,b as Je,dt as Ye,ft as Xe,gt as G,h as Ze,j as K,m as q,ot as Qe,pt as $e,x as et,y as tt,z as nt}from"./index-BsbX_-dh.js";import{t as rt}from"./FilterBar-Cn4lFaY4.js";import{t as it}from"./DataTableShell-BY48g0WO.js";import{t as J}from"./DetailChips-B_6c_-iY.js";var at=I(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),ot=I(`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`}]]),Y=I(`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`}]]),st=I(`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`}]]),X=t(e(),1),Z=n(),Q=`Tabs`,[ct,lt]=w(Q,[$e]),ut=$e(),[dt,$]=ct(Q),ft=X.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=Re(s),[d,f]=p({prop:r,onChange:i,defaultProp:a??``,caller:Q});return(0,Z.jsx)(dt,{scope:n,baseId:h(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,Z.jsx)(B.div,{dir:u,"data-orientation":o,...l,ref:t})})});ft.displayName=Q;var pt=`TabsList`,mt=X.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=$(pt,n),o=ut(n);return(0,Z.jsx)(Xe,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,Z.jsx)(B.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});mt.displayName=pt;var ht=`TabsTrigger`,gt=X.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=$(ht,n),s=ut(n),c=yt(o.baseId,r),l=bt(o.baseId,r),u=r===o.value;return(0,Z.jsx)(Ye,{asChild:!0,...s,focusable:!i,active:u,children:(0,Z.jsx)(B.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:j(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:j(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:j(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});gt.displayName=ht;var _t=`TabsContent`,vt=X.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=$(_t,n),c=yt(s.baseId,r),l=bt(s.baseId,r),u=r===s.value,d=X.useRef(u);return X.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,Z.jsx)(we,{present:i||u,children:({present:n})=>(0,Z.jsx)(B.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});vt.displayName=_t;function yt(e,t){return`${e}-trigger-${t}`}function bt(e,t){return`${e}-content-${t}`}var xt=ft,St=mt,Ct=gt,wt=vt;function Tt(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 Et(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 Dt(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 Ot(e){switch(e){case`admin`:return y();case`user`:return v();case`pending`:return he();default:return e}}function kt(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 At(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}}function jt({className:e,orientation:t=`horizontal`,...n}){return(0,Z.jsx)(xt,{"data-slot":`tabs`,"data-orientation":t,className:R(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var Mt=ke(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function Nt({className:e,variant:t=`default`,...n}){return(0,Z.jsx)(St,{"data-slot":`tabs-list`,"data-variant":t,className:R(Mt({variant:t}),e),...n})}function Pt({className:e,...t}){return(0,Z.jsx)(Ct,{"data-slot":`tabs-trigger`,className:R(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function Ft({className:e,...t}){return(0,Z.jsx)(wt,{"data-slot":`tabs-content`,className:R(`flex-1 text-sm outline-none`,e),...t})}var It={name:``,description:``};function Lt(){let e=F(k.groups.listGroups,{}),t=F(k.me.getMe,{host:Qe})?.role===`admin`,n=L(k.groups.createGroup),i=L(k.groups.updateGroup),a=L(k.groups.deleteGroup),o=We(),s=K(),[c,l]=(0,X.useState)(!1),[d,f]=(0,X.useState)(null),[p,h]=(0,X.useState)(It),[_,v]=(0,X.useState)(null),[y,b]=(0,X.useState)(``),x=(0,X.useMemo)(()=>{if(!e)return e;let t=y.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,y]);function te(){f(null),h(It),l(!0)}function S(e){f(e),h({name:e.name,description:e.description??``}),l(!0)}async function ne(){try{d?await i({groupId:d._id,name:p.name,description:p.description}):await n({name:p.name,description:p.description||void 0}),h(It),f(null),l(!1)}catch(e){s.error(xe(),e)}}async function re(e){if(await o({title:Te({name:e.name}),description:g(),confirmWord:e.name,confirmLabel:u(),cancelLabel:r(),destructive:!0}))try{await a({groupId:e._id})}catch(e){s.error(E(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:A()}),(0,Z.jsx)(rt,{q:y,onQChange:b,onReset:()=>b(``),canReset:y!==``,searchPlaceholder:me()}),(0,Z.jsx)(it,{title:fe(),rows:x,addLabel:Me(),onAdd:t?te:void 0,emptyHint:ve(),columns:[{header:O(),cell:e=>e.name,sort:e=>e.name},{header:Oe(),cell:e=>(0,Z.jsx)(J,{icon:(0,Z.jsx)(st,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Z.jsx)(Y,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:Se(),cell:e=>(0,Z.jsx)(J,{icon:(0,Z.jsx)(W,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:ce(),cell:e=>(0,Z.jsx)(J,{icon:(0,Z.jsx)(ot,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Z.jsx)(G,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:De(),onSelect:()=>v({groupId:e._id,name:e.name})},...t?[{label:be(),onSelect:()=>S(e)},{label:Ae(),variant:`destructive`,onSelect:()=>void re(e)}]:[]]}),(0,Z.jsx)(Ze,{open:c,onOpenChange:l,title:d?se():ee(),description:oe(),canSubmit:!!p.name.trim(),onSubmit:ne,submitLabel:de(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:C()}),(0,Z.jsx)(H,{value:p.name,onChange:e=>h({...p,name:e.target.value})})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:m()}),(0,Z.jsx)(H,{value:p.description,onChange:e=>h({...p,description:e.target.value})})]})]})}),(0,Z.jsx)(Bt,{groupId:_?.groupId??null,groupName:_?.name??``,open:_!==null,onOpenChange:e=>{e||v(null)}})]})}var Rt=8;function zt({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,Z.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,Z.jsxs)(V,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Z.jsx)(at,{size:14,"aria-hidden":!0}),f()]}),(0,Z.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":x({page:e,pages:t}),children:[e,` / `,t]}),(0,Z.jsxs)(V,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[l(),(0,Z.jsx)(Ve,{size:14,"aria-hidden":!0})]})]})}function Bt({groupId:e,groupName:t,open:n,onOpenChange:r}){let o=F(k.groups.getGroup,n&&e?{groupId:e}:`skip`),s=F(k.groups.listAssignableInstances,n?{}:`skip`),l=F(k.groups.listAssignableUsers,n?{}:`skip`),u=L(k.groups.addMember),f=L(k.groups.removeMember),p=L(k.groups.bulkSetMembers),m=L(k.groups.setGroupManager),h=K(),[g,v]=(0,X.useState)(``),[y,x]=(0,X.useState)(``),[ee,S]=(0,X.useState)(`members`),[oe,C]=(0,X.useState)(1),[w,se]=(0,X.useState)(new Set),T=(0,X.useRef)(null),E=(0,X.useMemo)(()=>new Set((o?.members??[]).map(e=>e.userId)),[o]),ce=(0,X.useMemo)(()=>new Set((o?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[o]),D=o?.viewerIsAdmin===!0,O=(0,X.useMemo)(()=>new Set((o?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[o]);(0,X.useEffect)(()=>{v(``),x(``),S(`members`),C(1),T.current=null},[n,e]),(0,X.useEffect)(()=>{C(1)},[g]),(0,X.useEffect)(()=>{n&&o&&e&&T.current!==e&&(T.current=e,se(new Set((o.members??[]).map(e=>e.userId))))},[n,o,e]);let A=(0,X.useMemo)(()=>l?Tt(l,g,w):[],[l,g,w]);async function de(t,n){if(e)try{n?await f({groupId:e,userId:t}):await u({groupId:e,userId:t})}catch(e){h.error(pe(),e)}}async function j(t,n){if(e)try{await m({groupId:e,userId:t,manager:!n})}catch(e){h.error(le(),e)}}let M=kt(A,e=>E.has(e.userId)),fe=A.filter(e=>E.has(e.userId)).length,N=At(A,oe,Rt);async function P(){if(!e||A.length===0)return;let t=A.map(e=>e.userId);try{await p({groupId:e,userIds:t,member:M!==`all`})}catch(e){h.error(pe(),e)}}return(0,Z.jsx)(Ge,{open:n,onOpenChange:r,children:(0,Z.jsxs)(He,{className:`oc-access`,children:[(0,Z.jsxs)(Ke,{children:[(0,Z.jsx)(nt,{children:ae({name:t})}),(0,Z.jsx)(Ue,{children:re()})]}),(0,Z.jsxs)(jt,{value:ee,onValueChange:S,className:`oc-access__tabs`,children:[(0,Z.jsxs)(Nt,{className:`w-full`,children:[(0,Z.jsxs)(Pt,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(st,{size:13,"aria-hidden":!0}),d(),o?(0,Z.jsx)(q,{variant:`secondary`,className:`oc-access__tabcount`,children:E.size}):null]}),(0,Z.jsxs)(Pt,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(W,{size:13,"aria-hidden":!0}),a(),o?(0,Z.jsx)(q,{variant:`secondary`,className:`oc-access__tabcount`,children:O.size}):null]}),(0,Z.jsxs)(Pt,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(ot,{size:13,"aria-hidden":!0}),Ie(),o?(0,Z.jsx)(q,{variant:`secondary`,className:`oc-access__tabcount`,children:o.chartCount}):null]})]}),(0,Z.jsx)(Ft,{value:`members`,children:l===void 0||o===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:b()}):l.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:c()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(H,{value:g,onChange:e=>v(e.target.value),placeholder:ie(),className:`oc-access__search`}),A.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:te()}):(0,Z.jsxs)(Z.Fragment,{children:[A.length>1?(0,Z.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Z.jsx)(U,{checked:M===`all`?!0:M===`some`?`indeterminate`:!1,onCheckedChange:()=>void P(),"aria-label":_()}),(0,Z.jsx)(`span`,{className:`oc-access__label`,children:_()}),(0,Z.jsxs)(q,{variant:`outline`,className:`oc-access__count`,children:[fe,` / `,A.length]})]}):null,(0,Z.jsx)(`div`,{className:`oc-access__list`,children:N.pageItems.map(e=>{let t=E.has(e.userId),n=Dt(e),r=ce.has(e.userId);return(0,Z.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Z.jsx)(U,{checked:t,onCheckedChange:()=>void de(e.userId,t),"aria-label":i({user:n.primary})}),(0,Z.jsxs)(`span`,{className:`oc-access__who`,children:[(0,Z.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,Z.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,Z.jsx)(q,{variant:`outline`,className:`oc-access__role`,children:Ot(e.role)}),(0,Z.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&D?(0,Z.jsx)(V,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?_e():je(),title:r?_e():je(),onClick:()=>void j(e.userId,r),children:(0,Z.jsx)(Y,{size:15,"aria-hidden":!0})}):t&&r?(0,Z.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":ue(),title:ue(),children:(0,Z.jsx)(Y,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Z.jsx)(zt,{page:N.page,pageCount:N.pageCount,onPage:C})]})]})}),(0,Z.jsx)(Ft,{value:`agents`,children:s===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:b()}):s.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:ne()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(H,{value:y,onChange:e=>x(e.target.value),placeholder:Le(),className:`oc-access__search`}),(0,Z.jsx)(`div`,{className:`oc-access__list`,children:s.map(t=>(0,Z.jsx)(Vt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:O,query:y},`${e}-${t._id}`))})]})}),(0,Z.jsx)(Ft,{value:`charts`,children:(0,Z.jsx)(Ht,{groupId:e})})]})]})})}function Vt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=F(k.groups.listAssignableAgents,{instanceName:t}),c=L(k.groups.assignAgentToGroup),l=L(k.groups.removeAgentFromGroup),u=L(k.groups.bulkSetGroupAgents),d=K(),[f,p]=(0,X.useState)(1);if((0,X.useEffect)(()=>{p(1)},[i]),!e)return null;let m=Et(a?.agents??[],i),h=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&m.length===0)return null;let g=m.filter(e=>e.presentInLastOk!==!1),v=kt(g,e=>r.has(`${t}/${e.agentId}`)),y=At(m,f,Rt);async function b(n,r){try{r?await l({groupId:e,instanceName:t,agentId:n}):await c({groupId:e,instanceName:t,agentId:n})}catch(e){d.error(Ee(),e)}}async function x(){if(g.length===0)return;let n=g.map(e=>e.agentId);try{await u({groupId:e,instanceName:t,agentIds:n,assigned:v!==`all`})}catch(e){d.error(Ee(),e)}}return(0,Z.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Z.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Z.jsx)(W,{size:13,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:t}),(0,Z.jsx)(q,{variant:`outline`,className:`oc-access__kind`,children:n}),h?(0,Z.jsx)(q,{variant:`outline`,className:`oc-access__stale`,children:S()}):null]}),a===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:s()}):m.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:h?o():Pe()}):(0,Z.jsxs)(Z.Fragment,{children:[g.length>1?(0,Z.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Z.jsx)(U,{checked:v===`all`?!0:v===`some`?`indeterminate`:!1,onCheckedChange:()=>void x(),"aria-label":_()}),(0,Z.jsx)(`span`,{className:`oc-access__label`,children:_()})]}):null,y.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1;return(0,Z.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Z.jsx)(U,{checked:i,disabled:a&&!i,onCheckedChange:()=>void b(e.agentId,i),"aria-label":ge({name:e.displayName??e.agentId})}),(0,Z.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,Z.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":D(),title:D(),children:(0,Z.jsx)(G,{size:14,fill:`currentColor`})}):null,a?(0,Z.jsx)(q,{variant:`outline`,className:`oc-access__gone`,children:Fe()}):null]},e.agentId)}),(0,Z.jsx)(zt,{page:y.page,pageCount:y.pageCount,onPage:p})]})]})}function Ht({groupId:e}){let t=F(k.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=L(k.charts.assignChartToGroup),r=L(k.charts.removeChartFromGroup),i=L(k.charts.setGroupDefaultChart),a=L(k.charts.addChartToGroupPool),o=L(k.charts.removeChartFromGroupPool),s=K();if(!e)return null;if(t===void 0)return(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:b()});let{pool:c,addable:l,canManagePool:u}=t;if(c.length===0&&!u)return(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Ne()});async function d(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){s.error(z(),e)}}async function f(t){try{await i({groupId:e,chartKey:t})}catch(e){s.error(z(),e)}}async function p(t){try{await a({groupId:e,chartKey:t})}catch(e){s.error(z(),e)}}async function m(t){try{await o({groupId:e,chartKey:t})}catch(e){s.error(z(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__list`,children:c.map(e=>(0,Z.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Z.jsx)(U,{checked:e.selected,onCheckedChange:()=>void d(e.chartKey,e.selected),"aria-label":ye({name:e.name})}),(0,Z.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,Z.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":Ce(),title:Ce(),children:(0,Z.jsx)(G,{size:14,fill:`currentColor`})}):(0,Z.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void f(e.chartKey),children:M()}):null,u?(0,Z.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":P({name:e.name}),title:P({name:e.name}),onClick:()=>void m(e.chartKey),children:(0,Z.jsx)(ze,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),u?l.length>0?(0,Z.jsxs)(tt,{value:``,onValueChange:e=>void p(e),children:[(0,Z.jsx)(qe,{size:`sm`,className:`oc-access__search`,children:(0,Z.jsx)(Be,{placeholder:N()})}),(0,Z.jsx)(Je,{children:l.map(e=>(0,Z.jsx)(et,{value:e.chartKey,children:e.name},e.chartKey))})]}):c.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:T()}):null:null]})}export{Lt as GroupsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$f as r,$p as i,Af as a,Ap as o,Bf as s,Bp as c,Cf as l,Cp as u,Df as d,Dp as f,Ef as p,Ep as m,Ff as h,Fp as g,Gf as _,Gp as v,Hf as y,Hp as b,If as x,Ip as S,Jf as C,Jp as w,Kf as T,Kp as ee,Lf as E,Lp as te,Mf as ne,Mp as re,Nf as ie,Np as ae,Of as oe,Op as se,Pf as ce,Pp as le,Qf as ue,Qp as de,Rf as fe,Rp as pe,Sf as me,Sp as he,Tf as ge,Tp as _e,Uf as ve,Up as ye,Vf as be,Vp as xe,Wf as D,Wp as O,Xf as Se,Xp as Ce,Yf as we,Yp as Te,Zf as Ee,Zp as De,_p as Oe,ap as ke,bf as Ae,bp as k,cp as je,cw as A,dp as Me,em as Ne,ep as Pe,fp as Fe,fw as j,gp as Ie,gy as M,hp as Le,hw as N,hy as P,im as Re,ip as ze,jf as Be,jp as Ve,kf as He,kp as Ue,lp as We,mp as F,mw as I,nm as Ge,np as Ke,op as qe,pp as Je,qf as Ye,qp as Xe,rm as Ze,rp as Qe,sp as $e,tm as et,tp as tt,up as L,vf as nt,vp as rt,wf as it,wp as at,xf as ot,xp as R,yf as z,yp as st,zf as B,zp as ct}from"./dist-CfgJ5RDI.js";import{t as V}from"./button-ClzO6iiY.js";import{C as lt,F as H,I as U,J as W,M as ut,O as G,P as dt,R as ft,S as pt,X as mt,Y as ht,Z as gt,b as _t,h as vt,j as K,m as q,x as yt,y as bt,z as xt}from"./index-BsbX_-dh.js";import{t as St}from"./DataTableShell-BY48g0WO.js";import{InstanceConfigDialog as Ct}from"./BridgeTab-BhxIgO6W.js";var J=t(e(),1),Y=[`conversational`,`documentary`],wt=new Set(Y),Tt=`conversational`;function Et(e){let t=new Set((e??[]).filter(e=>wt.has(e)));return t.size===0?[Tt]:Y.filter(e=>t.has(e))}var X=n(),Z={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,gatewayVersion:``,gatewayHttpUrl:``},Dt={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Ot(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``}}function kt(){let e=N(A.admin.listInstances,{}),t=N(A.agents.listAllInstanceAgents,{}),n=I(A.admin.upsertInstance),r=I(A.admin.deleteInstance),a=K(),[s,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(Z),[p,m]=(0,J.useState)(null),[h,_]=(0,J.useState)(null),[y,x]=(0,J.useState)(null),[C,T]=(0,J.useState)(null);async function E(){try{await n({instanceId:C??void 0,name:u.name,gatewayUrl:u.gatewayUrl,bridgeUrl:u.bridgeUrl||void 0,displayName:u.displayName||void 0,kind:u.kind,gatewayVersion:u.gatewayVersion||void 0,gatewayHttpUrl:u.gatewayHttpUrl||void 0}),d(Z),T(null),l(!1)}catch(e){a.error(Ge(),e)}}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[et(),(0,X.jsx)(`strong`,{children:Ne()}),i()]}),(0,X.jsx)(St,{title:de(),rows:e,addLabel:De(),onAdd:()=>{T(null),d(Z),l(!0)},emptyHint:Ce(),columns:[{header:Te(),cell:e=>e.name,sort:e=>e.name},{header:w(),cell:e=>(0,X.jsx)(q,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:Xe(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:ee(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:Re(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,X.jsxs)(q,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?z():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:b(),onSelect:()=>{T(e._id),d(Ot(e)),l(!0)}},{label:Ze(),onSelect:()=>m(e.name)},{label:f(),onSelect:()=>x(e)},{label:v(),onSelect:()=>_(e)},{label:O(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:O(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,X.jsx)(vt,{open:s,onOpenChange:l,title:C?xe():ye(),description:ct(),canSubmit:!!(u.name&&u.gatewayUrl),onSubmit:E,submitLabel:pe(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)($,{label:te(),children:[(0,X.jsx)(W,{value:u.name,disabled:C!==null,onChange:e=>d({...u,name:e.target.value})}),C?(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:c()}):null]}),(0,X.jsx)($,{label:S(),children:(0,X.jsxs)(bt,{value:u.kind,onValueChange:e=>d({...u,kind:e}),children:[(0,X.jsx)(pt,{size:`sm`,className:`w-40`,children:(0,X.jsx)(lt,{})}),(0,X.jsxs)(_t,{children:[(0,X.jsx)(yt,{value:`openclaw`,children:`OpenClaw`}),(0,X.jsx)(yt,{value:`hermes`,children:`Hermes`})]})]})}),(0,X.jsx)($,{label:g(),children:(0,X.jsx)(W,{value:u.gatewayUrl,onChange:e=>d({...u,gatewayUrl:e.target.value})})}),(0,X.jsx)($,{label:le(),children:(0,X.jsx)(W,{value:u.bridgeUrl,placeholder:ae(),onChange:e=>d({...u,bridgeUrl:e.target.value})})}),(0,X.jsx)($,{label:re(),children:(0,X.jsx)(W,{value:u.displayName,onChange:e=>d({...u,displayName:e.target.value})})}),(0,X.jsx)($,{label:Ve(),children:(0,X.jsx)(W,{value:u.gatewayVersion,placeholder:o(),onChange:e=>d({...u,gatewayVersion:e.target.value})})}),(0,X.jsx)($,{label:Ue(),children:(0,X.jsx)(W,{value:u.gatewayHttpUrl,placeholder:se(),onChange:e=>d({...u,gatewayHttpUrl:e.target.value})})})]})}),(0,X.jsx)(Rt,{instanceName:p,open:p!==null,onOpenChange:e=>{e||m(null)}}),h?(0,X.jsx)(Ct,{instance:h,onClose:()=>_(null)},h._id):null,y?(0,X.jsx)(At,{instance:y,onClose:()=>x(null)},y._id):null]})}function At({instance:e,onClose:t}){let n=N(A.instanceSecrets.listInstanceSecretStatus,{}),r=Dt[e.kind??`openclaw`],i=(0,J.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,X.jsx)(dt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,X.jsxs)(H,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,X.jsxs)(ft,{children:[(0,X.jsx)(xt,{children:m({instance:e.displayName??e.name})}),(0,X.jsx)(U,{children:_e()})]}),(0,X.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,X.jsx)(Nt,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,X.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,X.jsx)(Mt,{instance:e})}),(0,X.jsx)(jt,{instance:e})]})})}function jt({instance:e}){let t=j(A.instanceSync.forceInstanceSync),n=K(),[i,a]=(0,J.useState)(!1);async function o(){if(!i){a(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(ke());break;case`no_agents`:n.success(Qe());break;case`no_bridge_url`:n.error(Ke());break;case`deploy_misconfigured`:n.error(tt());break;case`unauthorized`:n.error(r());break;case`not_served`:n.error(ue());break;default:n.error(Pe());break}}catch(e){n.error(ze(),e)}finally{a(!1)}}}return(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:Ee()}),(0,X.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,X.jsx)(V,{size:`sm`,variant:`outline`,onClick:()=>void o(),disabled:i,children:i?qe():$e()})})]})}function Mt({instance:e}){let t=N(A.bridgeAuth.listBridgeAuthStatus,{}),n=j(A.bridgeAuth.mintBridgeSecret),r=I(A.bridgeAuth.revokeBridgeSecret),i=K(),[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(null),[l,u]=(0,J.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(D(),e)}finally{o(!1)}}}async function m(){if(!a){o(!0);try{await r({instanceId:e._id}),c(null),i.success(_())}catch(e){i.error(D(),e)}finally{o(!1)}}}async function h(){if(s)try{await navigator.clipboard.writeText(s),u(!0)}catch{}}return(0,X.jsxs)($,{label:Se(),children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:we()}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(q,{variant:f?`outline`:`secondary`,children:f?`${R()} · ${d.prefix}…${d.lastFour}`:k()}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(V,{size:`sm`,onClick:()=>void p(),disabled:a,children:f?Ye():C()}),f?(0,X.jsx)(V,{size:`sm`,variant:`destructive`,onClick:()=>void m(),disabled:a,children:T()}):null]})]}),s?(0,X.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,X.jsx)(`p`,{className:`oc-sa__minted-warning`,children:ve()}),(0,X.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,X.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,X.jsx)(V,{variant:`outline`,size:`sm`,onClick:()=>void h(),children:l?M():P()})]}),(0,X.jsx)(V,{size:`sm`,variant:`ghost`,onClick:()=>{c(null),u(!1)},children:y()})]}):null]})}function Nt({instanceId:e,field:t,updatedAt:n}){let r=j(A.instanceSecrets.setInstanceSecret),i=I(A.instanceSecrets.clearInstanceSecret),a=j(A.deviceIdentity.generateDeviceIdentity),o=K(),[s,c]=(0,J.useState)(``),[l,d]=(0,J.useState)(!1),[f,p]=(0,J.useState)(null),[m,h]=(0,J.useState)(!1),g=n!==null,_=t===`deviceIdentity`,v=t===`token`?at():t===`deviceIdentity`?u():he();async function b(){if(!(!s.trim()||l)){d(!0);try{await r({instanceId:e,field:t,plaintext:s}),c(``),p(null),h(!1),o.success(Le())}catch(e){o.error(F(),e)}finally{d(!1)}}}async function x(){if(!l){d(!0);try{await i({instanceId:e,field:t}),p(null),h(!1),o.success(Je())}catch(e){o.error(F(),e)}finally{d(!1)}}}async function S(){if(!l){d(!0);try{p(await a({instanceId:e})),h(!1),o.success(L())}catch(e){o.error(je(),e)}finally{d(!1)}}}let C=f?`openclaw devices approve ${f.id}`:``;async function w(){if(C)try{await navigator.clipboard.writeText(C),h(!0)}catch{}}return(0,X.jsxs)($,{label:v,children:[_?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:Me()}):null,(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(q,{variant:g?`outline`:`secondary`,children:g?R():k()}),(0,X.jsx)(W,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:s,placeholder:g?rt():st(),onChange:e=>c(e.target.value)}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(V,{size:`sm`,onClick:()=>void b(),disabled:l||s.trim().length===0,children:Oe()}),_?(0,X.jsx)(V,{size:`sm`,variant:`outline`,onClick:()=>void S(),disabled:l,children:Fe()}):null,g?(0,X.jsx)(V,{size:`sm`,variant:`destructive`,onClick:()=>void x(),disabled:l,children:Ie()}):null]})]}),f?(0,X.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,X.jsx)(`p`,{className:`text-sm font-medium`,children:L()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:We()}),(0,X.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,X.jsx)(`code`,{className:`oc-sa__minted-plain`,children:C}),(0,X.jsx)(V,{variant:`outline`,size:`sm`,onClick:()=>void w(),children:m?M():P()})]}),(0,X.jsx)(V,{size:`sm`,variant:`ghost`,onClick:()=>{p(null),h(!1)},children:y()})]}):null]})}var Pt={conversational:ce,documentary:ne},Ft={conversational:ie,documentary:Be},It=e=>(Pt[e]??(()=>e))(),Q=e=>(Ft[e]??(()=>``))();function Lt({agentId:e,types:t,onToggle:n}){return(0,X.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,X.jsx)(`span`,{className:`oc-agentcard__types-label`,children:fe()}),t.map(e=>(0,X.jsx)(q,{variant:`secondary`,className:`oc-agenttype__chip`,title:Q(e),children:It(e)},e)),(0,X.jsxs)(ht,{children:[(0,X.jsx)(gt,{asChild:!0,children:(0,X.jsx)(V,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:E()})}),(0,X.jsxs)(mt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,X.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:x()}),(0,X.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:h()}),(0,X.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:Y.map(r=>{let i=`agtype-${e}-${r}`;return(0,X.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,X.jsx)(G,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,X.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,X.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:It(r)}),(0,X.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Q(r)})]})]},r)})})]})]})]})}function Rt({instanceName:e,open:t,onOpenChange:n}){let r=N(A.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=I(A.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(A.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(A.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),o=I(A.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(A.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(A.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),c=I(A.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(A.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=Et(r);e.setQuery(A.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),u=I(A.agents.removeInstanceAgent),f=ut(),m=K();async function h(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){m.error(B(),e)}}async function g(t){if(e)try{await o({instanceName:e,agentId:t})}catch(e){m.error(B(),e)}}async function _(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await c({instanceName:e,agentId:t,types:i})}catch(e){m.error(B(),e)}}async function v(t,n){if(e&&await f({title:oe({name:n}),description:d(),confirmLabel:p(),destructive:!0}))try{await u({instanceName:e,agentId:t}),m.success(ge())}catch(e){m.error(B(),e)}}return(0,X.jsx)(dt,{open:t,onOpenChange:n,children:(0,X.jsxs)(H,{className:`oc-access`,children:[(0,X.jsxs)(ft,{children:[(0,X.jsx)(xt,{children:be({name:e??``})}),(0,X.jsx)(U,{children:s()})]}),r===void 0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:it()}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?l():r.discovery.lastPollOk?me():ot({error:r.discovery.error??`?`})}),r.agents.length===0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:Ae()}):(0,X.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(e=>{let t=e.presentInLastOk===!1,n=r.defaultAgentId===e.agentId,i=e.displayName??e.agentId,o=e.types??[];return(0,X.jsxs)(`div`,{className:`oc-agentcard`+(e.enabled?``:` oc-agentcard--off`),children:[(0,X.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,X.jsx)(G,{checked:e.enabled,disabled:t,"aria-label":i,onCheckedChange:t=>void h(e.agentId,t===!0)}),(0,X.jsxs)(`span`,{className:`oc-agentcard__name`,title:i,children:[e.emoji?`${e.emoji} `:``,i]}),e.model?(0,X.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,t?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(q,{variant:`outline`,className:`oc-access__gone`,children:nt()}),(0,X.jsx)(V,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void v(e.agentId,i),children:He()})]}):n?(0,X.jsx)(q,{variant:`default`,children:z()}):(0,X.jsx)(V,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!e.enabled,onClick:()=>void g(e.agentId),children:a()})]}),e.enabled?(0,X.jsx)(Lt,{agentId:e.agentId,types:o,onToggle:t=>void _(e.agentId,t,o)}):null]},e.agentId)})})]})]})})}function $({label:e,children:t}){return(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{kt as InstancesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,AC as i,Ab as a,Bb as o,CC as s,DC as c,EC as l,FC as u,Fb as d,Gb as f,Hb as p,Ib as m,Jb as h,Kb as g,Lb as _,Mb as ee,Nb as te,Ob as ne,Pb as re,Qb as ie,Rb as v,Rp as ae,SC as y,TC as oe,Ub as se,Vb as ce,Wb as le,Xb as ue,Yb as de,Zb as b,_C as x,ax as S,bC as C,cw as w,ex as T,gC as E,hC as D,hw as O,ix as k,jb as A,kb as j,mw as M,nx as N,ox as P,qb as F,rx as I,sx as L,tx as R,vC as z,wC as B,xC as V,yC as H,zb as fe}from"./dist-CfgJ5RDI.js";import{t as U}from"./button-ClzO6iiY.js";import{C as pe,J as W,O as G,S as me,b as he,j as ge,k as _e,ot as K,x as q,y as ve}from"./index-BsbX_-dh.js";var J=t(e(),1),Y=[{id:`messages`,label:()=>L()},{id:`composer`,label:()=>P()},{id:`sidebar`,label:()=>S()},{id:`other`,label:()=>k()}],X={showSource:{category:`messages`,label:()=>I(),help:()=>N()},showReport:{category:`messages`,label:()=>R(),help:()=>T()},copyAssistant:{category:`messages`,label:()=>r()},copyUser:{category:`messages`,label:()=>ie()},showDelete:{category:`messages`,label:()=>b()},showTools:{category:`messages`,label:()=>ue(),help:()=>de()},voiceInput:{category:`composer`,label:()=>h(),help:()=>F()},showChatAge:{category:`sidebar`,label:()=>g(),help:()=>f()},showChatProvider:{category:`sidebar`,label:()=>le(),help:()=>se()}};function Z(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function ye(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 be=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showChatProvider`],xe={voiceInput:`voiceInput`};function Se(e){return be.includes(e)}function Q(e){return e===`admin`}function Ce(e){return e===!0?`on`:e===!1?`off`:`inherit`}function we(e){return e===`on`?!0:e===`off`?!1:null}function Te(e){return Se(e)?xe[e]:void 0}var $=n(),Ee={voiceInput:()=>ee()};function De({prefKey:e,ui:t}){let n=M(w.admin.setUiPrefDefault),r=M(w.admin.setFeatureEnabled),i=Te(e),o=i?Ee[e]?.():void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,$.jsx)(`span`,{className:`oc-prefs__gov-label`,children:m()}),(0,$.jsxs)(ve,{value:Ce(t.defaults[e]),onValueChange:t=>void n({key:e,value:we(t)}),children:[(0,$.jsx)(me,{size:`sm`,className:`w-36`,children:(0,$.jsx)(pe,{})}),(0,$.jsxs)(he,{children:[(0,$.jsx)(q,{value:`on`,children:a()}),(0,$.jsx)(q,{value:`off`,children:j()}),(0,$.jsx)(q,{value:`inherit`,children:ne()})]})]}),i?(0,$.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,$.jsx)(G,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":d()}),d()]}):null]}),o?(0,$.jsx)(`span`,{className:`oc-prefs__gov-help`,children:o}):null]})}function Oe(){let[e,t]=(0,J.useState)(``),[n,r]=(0,J.useState)(!1),i=O(w.me.getMe,{host:K}),a=i?.ui,s=Q(i?.role)&&n,c=M(w.me.setUiPref).withOptimisticUpdate(_e),l=(0,J.useMemo)(()=>a?ye(Object.keys(a.effective),e):[],[a,e]);return a?(0,$.jsxs)(`div`,{className:`oc-prefs-panel`,children:[Q(i?.role)?(0,$.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,$.jsx)(G,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":_()}),_()]}):null,s?(0,$.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,$.jsx)(`p`,{children:re()}),(0,$.jsx)(`p`,{children:te()}),(0,$.jsx)(`p`,{children:A()})]}):null,(0,$.jsx)(W,{value:e,onChange:e=>t(e.target.value),placeholder:p(),"aria-label":p(),className:`mb-2`}),l.length===0?(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:ce()}):(0,$.jsx)(`div`,{className:`oc-prefs`,children:l.map(e=>(0,$.jsxs)(`div`,{className:`oc-prefs__group`,children:[(0,$.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],l=a.effective[e],u=a.userOverrides[e]!==void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}${u&&!i?` is-overridden`:``}`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,$.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,$.jsx)(`span`,{className:`oc-prefs__lock`,children:o()}):u?null:(0,$.jsx)(`span`,{className:`oc-prefs__def`,children:fe()})]}),r?(0,$.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,$.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&u?(0,$.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void c({key:e,value:null}),children:v()}):null,(0,$.jsx)(G,{checked:l,disabled:i,onCheckedChange:t=>void c({key:e,value:t===!0}),"aria-label":n})]}),s?(0,$.jsx)(De,{prefKey:e,ui:a}):null]},e)})]},e.id))})]}):(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:u()})}function ke(){let e=O(w.me.getMe,{host:K}),t=M(w.me.setLocale),n=M(w.me.setMyName),r=ge(),a=e?.locale??`default`,o=e?.name??``,[u,d]=(0,J.useState)(null),f=u??o,p=f.trim()!==o.trim();async function m(){try{await n({name:f}),d(null),r.success(s())}catch(e){r.error(y(),e)}}return(0,$.jsxs)(`div`,{className:`oc-appearance`,children:[(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:c()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:l()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[(0,$.jsx)(W,{className:`max-w-xs`,value:f,maxLength:120,placeholder:oe(),onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&p&&(e.preventDefault(),m())}}),(0,$.jsx)(U,{size:`sm`,disabled:!p,onClick:()=>void m(),children:ae()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:B()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:V()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:C()})]}),(0,$.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`,`default`].map(e=>(0,$.jsx)(U,{variant:a===e?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e==="default"?null:e}),children:e===`fr`?E():e===`en`?D():i()},e))}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:H()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:z()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:x()})]}),(0,$.jsx)(Oe,{})]})]})}export{ke as PreferencesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$d as r,Ad as i,Bd as a,Dd as ee,Fd as o,Gd as s,Hd as c,Id as l,Jd as u,Kd as d,Ld as te,Md as ne,Nd as f,Od as p,Pd as m,Qd as h,Rd as g,Ud as _,Vd as v,Wd as y,Xd as b,Yd as x,Zd as S,_d as re,bd as ie,cw as C,ef as w,gd as T,hd as E,hw as D,jd as O,kd as k,md as A,mw as j,nf as M,pd as N,qd as P,tf as F,vd as I,xd as L,yd as R,zd as ae}from"./dist-CfgJ5RDI.js";import{t as z}from"./button-ClzO6iiY.js";import{J as B,M as V,O as H,h as U,j as W,m as G,xt as K}from"./index-BsbX_-dh.js";import{t as q}from"./roleDescriptions-Bjw3U0di.js";var J=t(e(),1),Y=n(),X=[{group:()=>M(),keys:[{key:`traces.read`,label:()=>S()},{key:`traces.read.content`,label:()=>b(),phi:!0},{key:`traces.write`,label:()=>x()}]},{group:()=>F(),keys:[{key:`kpi.read`,label:()=>S()},{key:`kpi.write`,label:()=>x()}]},{group:()=>w(),keys:[{key:`openclaw.query`,label:()=>u()},{key:`anomalies.read`,label:()=>P()},{key:`anomalies.report`,label:()=>d()}]},{group:()=>r(),keys:[{key:`chats.read`,label:()=>S()},{key:`selfheal`,label:()=>y()}]},{group:()=>h(),keys:[{key:`admin.manage`,label:()=>s()}]}],oe=X.flatMap(e=>e.keys.map(e=>e.key));function Z(e){return e.includes(`*`)}var Q={key:``,name:``,description:``};function $(){let e=D(C.apiKeys.listRoles,{}),t=j(C.apiKeys.createRole),n=j(C.apiKeys.ensureRolesSeeded),r=j(C.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(C.apiKeys.listRoles,{});r&&e.setQuery(C.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),s=V(),u=W(),[d,h]=(0,J.useState)(!1),[y,b]=(0,J.useState)(Q),[x,S]=(0,J.useState)(new Set);(0,J.useEffect)(()=>{n({}).catch(e=>{u.error(c(),e)})},[n,u]);let w=e??[];async function M(e,t){if(Z(e.permissions)||x.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];if(!(e.builtin&&!await s({title:v({name:e.name}),description:a(),confirmLabel:ae()}))){S(t=>new Set(t).add(e._id));try{await r({roleId:e._id,permissions:n})}catch(e){u.error(g(),e)}finally{S(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function P(){try{await t({key:y.key,name:y.name,description:y.description||void 0,permissions:[]}),b(Q),h(!1)}catch(e){u.error(te(),e)}}let F=e===void 0,$=!F&&w.length===0;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[l(),` `,(0,Y.jsx)(`code`,{children:`admin`}),` `,o(),` `,(0,Y.jsx)(`code`,{children:`traces.read.content`}),` `,m()]}),(0,Y.jsxs)(`div`,{className:`oc-dt`,children:[(0,Y.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,Y.jsx)(`h2`,{className:`oc-dt__title`,children:f()}),(0,Y.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,Y.jsx)(z,{size:`sm`,onClick:()=>{b(Q),h(!0)},children:ne()})})]}),F?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:O()}):$?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):(0,Y.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,Y.jsxs)(`table`,{className:`oc-matrix`,children:[(0,Y.jsxs)(`thead`,{children:[(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:k()}),X.map(e=>(0,Y.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,Y.jsx)(`tr`,{children:X.flatMap(e=>e.keys.map(e=>(0,Y.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?_({key:e.key}):e.key,children:[e.label(),e.phi?(0,Y.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,Y.jsx)(`tbody`,{children:w.map(e=>{let t=Z(e.permissions),n=x.has(e._id);return(0,Y.jsxs)(`tr`,{children:[(0,Y.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,Y.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,Y.jsx)(`span`,{children:e.name}),(0,Y.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,Y.jsxs)(G,{variant:`outline`,className:`gap-1`,children:[(0,Y.jsx)(K,{}),` `,p()]}):(0,Y.jsx)(G,{variant:`secondary`,children:ee()})]}),q(e)?(0,Y.jsx)(`p`,{className:`oc-matrix__roledesc`,children:q(e)}):null]}),oe.map(r=>(0,Y.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,Y.jsx)(H,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?L():n?ie():r,onCheckedChange:()=>void M(e,r)})},r))]},e.key)})})]})})]}),(0,Y.jsx)(U,{open:d,onOpenChange:h,title:R(),description:I(),canSubmit:!!(y.key&&y.name),onSubmit:P,submitLabel:re(),children:(0,Y.jsxs)(`div`,{className:`oc-form`,children:[(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:T()}),(0,Y.jsx)(B,{value:y.key,placeholder:E(),onChange:e=>b({...y,key:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:A()}),(0,Y.jsx)(B,{value:y.name,onChange:e=>b({...y,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:N()}),(0,Y.jsx)(B,{value:y.description,onChange:e=>b({...y,description:e.target.value})})]})]})})]})}export{$ as RolesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$y as r,Ay as i,By as ee,Cb as te,Cy as a,Db as ne,Dy as o,Eb as re,Ey as s,Fy as ie,Gy as ae,Hy as oe,Iy as se,Jy as ce,Ky as le,Ly as ue,My as de,Ny as fe,Oy as c,Py as pe,Qy as me,Ry as he,Sb as ge,Sy as _e,Tb as ve,Ty as l,Uy as ye,Vy as be,Wy as xe,Xy as Se,Yy as Ce,Zy as we,_b as Te,_y as u,ab as Ee,bb as De,by as d,cb as Oe,cw as f,cy as p,db as ke,dy as m,eb as Ae,fb as je,fw as Me,fy as h,gb as Ne,gy as g,hb as Pe,hw as _,hy as v,ib as Fe,jy as Ie,ky as y,lb as Le,ly as Re,mb as ze,mw as b,my as x,nb as Be,ob as Ve,pb as He,py as S,qy as Ue,rb as We,sb as Ge,sy as C,tb as Ke,ub as qe,uy as w,vb as Je,vy as T,wb as Ye,wy as E,xb as D,xy as O,yb as Xe,yy as k,zy as Ze}from"./dist-CfgJ5RDI.js";import{n as Qe}from"./dist-D2UVxg3M.js";import{i as $e}from"./dist-CEGGJ9VY.js";import{t as A}from"./button-ClzO6iiY.js";import{C as j,Dt as et,F as M,I as N,J as P,L as F,M as tt,Ot as nt,P as I,R as L,S as R,Tt as z,b as B,h as rt,j as it,kt as at,m as V,x as H,y as U,z as W}from"./index-BsbX_-dh.js";import{t as ot}from"./FilterBar-Cn4lFaY4.js";import{t as st}from"./DataTableShell-BY48g0WO.js";import{t as ct}from"./roleDescriptions-Bjw3U0di.js";var G=t(e(),1),K=n(),q=[{value:`never`,label:()=>S(),days:null},{value:`30`,label:()=>h(),days:30},{value:`90`,label:()=>m(),days:90}],lt=720*60*60*1e3,J=`__all__`,Y={name:``,roleKey:``,description:``};function X(){let e=at({from:`/settings/serviceAccounts`}),t=nt({from:`/settings/serviceAccounts`}),n=e.q??``,i=e.status??J,[a,o]=(0,G.useState)(J),s=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),c=e=>void t({search:t=>({...t,status:e===J?void 0:e})}),_e=_(f.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===J?void 0:a,disabled:i===J?void 0:i===`disabled`}}),l=_(f.apiKeys.listKeys,{}),u=_(f.apiKeys.listRoles,{}),d=b(f.apiKeys.createServiceAccount),p=b(f.apiKeys.updateServiceAccount),m=b(f.apiKeys.deleteServiceAccount),h=Me(f.apiKeys.mintApiKey),g=b(f.apiKeys.revokeApiKey),v=tt(),y=it(),Re=n!==``||a!==J||i!==J;function x(){o(J),t({search:{},replace:!0})}let[S,C]=(0,G.useState)(!1),[w,T]=(0,G.useState)(Y),[E,O]=(0,G.useState)(null),[k,Qe]=(0,G.useState)(new Set),[M,N]=(0,G.useState)(null),F=(0,G.useRef)(!1),[I,L]=(0,G.useState)(new Set),[z,W]=(0,G.useState)({}),[lt,X]=(0,G.useState)(null),Z=(0,G.useMemo)(()=>{let e=new Map;for(let t of l??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[l]);function Q(e){Qe(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function ft(){try{E?(await p({serviceAccountId:E,name:w.name,roleKey:w.roleKey,description:w.description}),y.success(ae())):await d({name:w.name,roleKey:w.roleKey,description:w.description||void 0}),T(Y),O(null),C(!1)}catch(e){y.error(E?le():Ue(),e)}}function pt(e){T({name:e.name,roleKey:e.roleKey,description:e.description??``}),O(e._id),C(!0)}async function $(e){if(F.current)return;F.current=!0;let t=z[e._id]??`never`,n=q.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;N(e._id);try{let t=await h({serviceAccountId:e._id,expiresAt:r});X({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){y.error(xe(),e)}finally{F.current=!1,N(null)}}async function mt(e){if(await v({title:ye(),description:(0,K.jsxs)(K.Fragment,{children:[oe(),` `,(0,K.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,be(),` `,(0,K.jsx)(`strong`,{children:ee()}),` `,Ze()]}),confirmWord:e.name,confirmLabel:he(),destructive:!0}))try{await m({serviceAccountId:e._id}),y.success(ue(),e.name)}catch(e){y.error(se(),e)}}async function ht(e){if(await v({title:ie(),description:(0,K.jsxs)(K.Fragment,{children:[pe(),` `,(0,K.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,fe()]}),confirmLabel:de(),destructive:!0})&&!I.has(e._id)){L(t=>new Set(t).add(e._id));try{await g({keyId:e._id})}catch(e){y.error(Ie(),e)}finally{L(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:ne()}),(0,K.jsxs)(ot,{q:n,onQChange:s,searchPlaceholder:re(),onReset:x,canReset:Re,children:[(0,K.jsxs)(U,{value:a,onValueChange:o,children:[(0,K.jsx)(R,{size:`sm`,className:`w-40`,children:(0,K.jsx)(j,{placeholder:ve()})}),(0,K.jsxs)(B,{children:[(0,K.jsx)(H,{value:J,children:Ye()}),(u??[]).map(e=>(0,K.jsx)(H,{value:e.key,children:e.key},e._id))]})]}),(0,K.jsxs)(U,{value:i,onValueChange:c,children:[(0,K.jsx)(R,{size:`sm`,className:`w-36`,children:(0,K.jsx)(j,{})}),(0,K.jsxs)(B,{children:[(0,K.jsx)(H,{value:J,children:te()}),(0,K.jsx)(H,{value:`active`,children:ge()}),(0,K.jsx)(H,{value:`disabled`,children:D()})]})]})]}),(0,K.jsx)(st,{title:De(),rows:_e,addLabel:Xe(),onAdd:()=>{T(Y),O(null),C(!0)},emptyHint:Je(),isExpanded:e=>k.has(e._id),renderExpanded:e=>(0,K.jsx)(ut,{account:e,keys:Z.get(e._id)??[],onRevoke:ht,revoking:I}),rowActions:e=>[{label:ze(),onSelect:()=>pt(e)},{label:Te(),onSelect:()=>void $(e)},{label:k.has(e._id)?Ne():Pe(),onSelect:()=>Q(e._id)},{label:He(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,K.jsx)(A,{variant:`ghost`,size:`icon-sm`,"aria-label":k.has(e._id)?je():ke(),onClick:()=>Q(e._id),children:k.has(e._id)?(0,K.jsx)($e,{}):(0,K.jsx)(et,{})})},{header:qe(),sort:e=>e.name,cell:e=>(0,K.jsxs)(`div`,{className:`flex flex-col`,children:[(0,K.jsx)(`span`,{children:e.name}),e.description?(0,K.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:Le(),sort:e=>e.roleKey,cell:e=>(0,K.jsx)(V,{variant:`secondary`,children:e.roleKey})},{header:Oe(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,K.jsx)(V,{variant:`destructive`,children:D()}):(0,K.jsx)(V,{variant:`outline`,children:ge()})},{header:Ge(),cell:e=>(0,K.jsxs)(U,{value:z[e._id]??`never`,onValueChange:t=>W(n=>({...n,[e._id]:t})),children:[(0,K.jsx)(R,{size:`sm`,className:`w-32`,children:(0,K.jsx)(j,{})}),(0,K.jsx)(B,{children:q.map(e=>(0,K.jsx)(H,{value:e.value,children:e.label()},e.value))})]})},{header:Ve(),sort:e=>(Z.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Z.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,K.jsx)(`span`,{className:`oc-sa__keycount`,children:M===e._id?Ee():Fe({count:t})})}}]}),(0,K.jsx)(rt,{open:S,onOpenChange:e=>{C(e),e||O(null)},title:E?We():Ae(),description:E?Be():r(),canSubmit:!!(w.name&&w.roleKey),onSubmit:ft,submitLabel:E?Ke():me(),children:(0,K.jsxs)(`div`,{className:`oc-form`,children:[(0,K.jsxs)(`label`,{className:`oc-field`,children:[(0,K.jsx)(`span`,{className:`oc-field__label`,children:we()}),(0,K.jsx)(P,{value:w.name,onChange:e=>T({...w,name:e.target.value})})]}),(0,K.jsxs)(`label`,{className:`oc-field`,children:[(0,K.jsx)(`span`,{className:`oc-field__label`,children:Se()}),(0,K.jsxs)(U,{value:w.roleKey||void 0,onValueChange:e=>T({...w,roleKey:e}),children:[(0,K.jsx)(R,{className:`w-full`,children:(0,K.jsx)(j,{placeholder:Ce()})}),(0,K.jsx)(B,{children:(u??[]).map(e=>(0,K.jsxs)(H,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(u??[]).find(e=>e.key===w.roleKey),t=e?ct(e):null;return t?(0,K.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,K.jsxs)(`label`,{className:`oc-field`,children:[(0,K.jsx)(`span`,{className:`oc-field__label`,children:ce()}),(0,K.jsx)(P,{value:w.description,onChange:e=>T({...w,description:e.target.value})})]})]})}),(0,K.jsx)(dt,{minted:lt,onClose:()=>X(null)})]})}function ut({account:e,keys:t,onRevoke:n,revoking:r}){return(0,K.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,K.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[i(),` `,(0,K.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(0,K.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,K.jsx)(`thead`,{children:(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`th`,{children:c()}),(0,K.jsx)(`th`,{children:o()}),(0,K.jsx)(`th`,{children:s()}),(0,K.jsx)(`th`,{children:l()}),(0,K.jsx)(`th`,{children:E()}),(0,K.jsx)(`th`,{children:a()}),(0,K.jsx)(`th`,{})]})}),(0,K.jsx)(`tbody`,{children:t.map(t=>(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`td`,{children:(0,K.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,K.jsx)(`td`,{children:(0,K.jsx)(V,{variant:`secondary`,children:e.roleKey})}),(0,K.jsx)(`td`,{children:Z(t.createdAt)}),(0,K.jsx)(`td`,{className:Q(t.lastUsedAt)?`oc-sa__stale`:``,children:ft(t.lastUsedAt)}),(0,K.jsx)(`td`,{children:pt(t.expiresAt)}),(0,K.jsx)(`td`,{children:$(t)}),(0,K.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,K.jsx)(A,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?_e():O()})})]},t._id))})]})]})}function dt({minted:e,onClose:t}){let[n,r]=(0,G.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,K.jsx)(I,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,K.jsxs)(M,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,K.jsxs)(L,{children:[(0,K.jsx)(W,{children:d()}),(0,K.jsx)(N,{children:k({name:e.accountName})})]}),(0,K.jsx)(`div`,{className:`oc-sa__minted-warning`,children:T()}),(0,K.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,K.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,K.jsxs)(A,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":u(),children:[n?(0,K.jsx)(Qe,{}):(0,K.jsx)(z,{}),n?g():v()]})]}),(0,K.jsx)(F,{children:(0,K.jsx)(A,{onClick:()=>{r(!1),t()},children:x()})})]}):null})}function Z(e){return new Date(e).toLocaleString(`fr-FR`)}function Q(e){return e===null?!1:Date.now()-e>lt}function ft(e){return e===null?w():new Date(e).toLocaleString(`fr-FR`)}function pt(e){return e===null?`—`:new Date(e).toLocaleDateString(`fr-FR`)}function $(e){return e.disabled?(0,K.jsx)(V,{variant:`destructive`,children:Re()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,K.jsx)(V,{variant:`outline`,children:p()}):(0,K.jsx)(V,{variant:`outline`,children:C()})}export{X as ServiceAccountsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$x as r,AS as i,Ax as a,Bx as o,CS as s,Cx as c,DS as l,Dx as u,ES as d,Ex as f,Fx as p,Gx as m,Hx as h,Ix as g,Jx as ee,Kx as te,Lx as ne,MC as re,Mx as ie,NC as ae,Nx as oe,OS as se,Ox as _,Px as ce,Qx as le,Rx as ue,SS as de,Sx as fe,TS as pe,Tx as me,Ux as he,Vx as ge,Wx as _e,Xx as ve,Yx as ye,Zx as be,_S as xe,_x as Se,aS as Ce,bS as v,bx as we,cS as Te,cw as y,cx as Ee,dS as De,dx as Oe,eS as ke,fS as Ae,fw as je,fx as b,gC as Me,gS as Ne,gx as x,hC as Pe,hS as Fe,hw as S,hx as Ie,iS as Le,jC as Re,jx as ze,kS as Be,kx as Ve,lS as He,lw as Ue,lx as We,mS as Ge,mw as C,mx as Ke,n as qe,nS as Je,oS as Ye,pS as Xe,px as Ze,qx as w,rS as Qe,sS as $e,tS as et,uS as tt,ux as nt,vS as rt,vx as it,wS as at,wx as ot,xS as st,xx as ct,yS as lt,yx as ut,zx as dt}from"./dist-CfgJ5RDI.js";import{n as T}from"./dist-D2UVxg3M.js";import{t as ft}from"./TimeRangePicker-BCumk2bf.js";import{t as E}from"./x-TUhW74Oi.js";import{t as D}from"./button-ClzO6iiY.js";import{$ as pt,C as O,Ct as k,J as A,O as j,Q as mt,S as M,at as ht,b as N,et as P,it as gt,m as F,nt as I,ot as L,rt as _t,tt as vt,x as R,y as z}from"./index-BsbX_-dh.js";import{a as yt,i as bt,n as xt,o as St,r as Ct,t as wt}from"./card-B4hdn0Qh.js";import{a as Tt,i as B,n as Et,o as V,r as H,t as Dt}from"./table-BYj7Kdzy.js";import{t as Ot}from"./FilterBar-Cn4lFaY4.js";import{t as kt}from"./AdvancedFilter-DrUoj1oY.js";var U=Ue(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),W=t(e(),1),At=.1,jt=[248,248,248],Mt=[24,24,24];function Nt(e,t,n){let r=t,i=n,a=-1,o=-1;for(let s=0;s<n;s++)for(let n=0;n<t;n++)e[(s*t+n)*4+3]>8&&(n<r&&(r=n),n>a&&(a=n),s<i&&(i=s),s>o&&(o=s));return a<0?null:{x:r,y:i,width:a-r+1,height:o-i+1}}function Pt(e,t,n){let r=t*n;if(r===0)return 0;let i=0;for(let t=3;t<e.length;t+=4)e[t]<=8&&i++;return i/r}function G(e,t,n){return Pt(e,t,n)>=At}function Ft(e,t){for(let n=0;n<e.length;n+=4)e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2]}function It(e){for(let t=0;t<e.length;t+=4)e[t]=255-e[t],e[t+1]=255-e[t+1],e[t+2]=255-e[t+2]}var Lt=12*1024*1024,Rt=480,zt=160,Bt=.92;async function Vt(e,t={}){if(!e.type.startsWith(`image/`))throw Error(ze());if(e.size>Lt)throw Error(a());let{source:n,width:r,height:i,cleanup:o}=await Ht(e);try{let a=e.type===`image/svg+xml`,o=Math.min(Rt/r,zt/i,a?1/0:1),s=Math.max(1,Math.round(r*o)),c=Math.max(1,Math.round(i*o)),l=document.createElement(`canvas`);l.width=s,l.height=c;let d=l.getContext(`2d`);if(!d)throw Error(_());d.imageSmoothingEnabled=!0,d.imageSmoothingQuality=`high`,d.drawImage(n,0,0,s,c);let f=Nt(d.getImageData(0,0,s,c).data,s,c)??{x:0,y:0,width:s,height:c},p=document.createElement(`canvas`);p.width=f.width,p.height=f.height;let m=p.getContext(`2d`);if(!m)throw Error(_());if(m.drawImage(l,f.x,f.y,f.width,f.height,0,0,f.width,f.height),t.variantFor){let e=m.getImageData(0,0,f.width,f.height);G(e.data,f.width,f.height)?Ft(e.data,t.variantFor===`dark`?jt:Mt):It(e.data),m.putImageData(e,0,0)}let h=G(m.getImageData(0,0,f.width,f.height).data,f.width,f.height),g=await q(p,`image/webp`,Bt)??await q(p,`image/png`);if(!g)throw Error(u());return{blob:g,hasAlpha:h}}finally{o()}}async function Ht(e){if(e.type===`image/svg+xml`)return K(e);if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,cleanup:()=>t.close()}}catch{}return K(e)}async function K(e){let t=URL.createObjectURL(e);try{let e=new Image;return e.decoding=`async`,await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(Ve())),e.src=t}),{source:e,width:e.naturalWidth||300,height:e.naturalHeight||150,cleanup:()=>URL.revokeObjectURL(t)}}catch(e){throw URL.revokeObjectURL(t),e}}function q(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var J=n(),Y=`__all__`,X={kind:`relative`,from:`now-24h`,to:`now`},Ut=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function Z({title:e,description:t,children:n}){return(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:e}),t?(0,J.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,J.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function Wt(e){return e===`light`?ae():e===`dark`?re():Re()}var Gt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Kt({tokens:e,mode:t}){let n=e.colors[t];return(0,J.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Gt.map(e=>{let t=n[e];return(0,J.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Q({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a}){return(0,J.jsxs)(`button`,{type:`button`,className:qe(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,J.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,J.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,J.jsx)(T,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,J.jsx)(Kt,{tokens:r,mode:i}):(0,J.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,J.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,J.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]})}function qt({selectedKey:e,resolvedMode:t}){let n=S(y.charts.listMyCharts),r=C(y.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(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:de()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:st()})]}),(0,J.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,J.jsx)(Q,{selected:e===null,title:v(),subtitle:lt(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?rt():n.via===`owner`?xe():Ne({group:n.via.group});return(0,J.jsx)(Q,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void i(n.key)},n.key)})]}),n!==void 0&&n.length===0?(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Fe()}):null]})}function Jt(){let e=C(y.charts.importChart),[t,n]=(0,W.useState)(``),[i,a]=(0,W.useState)(``),[o,s]=(0,W.useState)(null),[c,l]=(0,W.useState)(!1),[u,d]=(0,W.useState)(!1);async function f(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),l(!1);try{a(await t.text())}catch{s(w())}}}async function p(){if(s(null),l(!1),t.trim()===``){s(m());return}let r;try{r=JSON.parse(i)}catch{s(w());return}d(!0);try{await e({name:t.trim(),tokens:r}),l(!0),n(``),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{d(!1)}}return(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:et()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ke()})]}),(0,J.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,J.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,J.jsx)(`span`,{className:`oc-chart-import__label`,children:r()}),(0,J.jsx)(A,{value:t,onChange:e=>n(e.target.value),placeholder:le(),maxLength:60})]}),(0,J.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,J.jsx)(`span`,{className:`oc-chart-import__label`,children:be()}),(0,J.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:i,onChange:e=>a(e.target.value),placeholder:ve(),rows:8,spellCheck:!1})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(D,{variant:`outline`,size:`sm`,asChild:!0,children:(0,J.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,J.jsx)(U,{className:`size-4`}),ye(),(0,J.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void f(e)})]})}),(0,J.jsx)(D,{size:`sm`,disabled:u,onClick:()=>void p(),children:ee()})]}),o?(0,J.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,c?(0,J.jsx)(`p`,{className:`oc-chart-import__ok`,children:te()}):null]})]})}function Yt({chart:e}){let t=je(y.charts.setChartLogo),n=C(y.charts.removeChartLogo),[r,i]=(0,W.useState)(!1),[a,o]=(0,W.useState)(null),s=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function c(n,r,a){if(e.chartId!==void 0){o(null),i(!0);try{let{blob:i,hasAlpha:o}=await Vt(r,a?{variantFor:a}:{}),s=await i.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function l(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await c(e,n)}async function u(t){if(e.chartId!==void 0){o(null),i(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function d(e){let t=s(e===`light`?`dark`:`light`);if(t){o(null),i(!0);try{await c(e,await(await fetch(t)).blob(),e)}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function f({mode:e}){let t=s(e),n=s(e===`light`?`dark`:`light`);return(0,J.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,J.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?ue():ne()}),(0,J.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,J.jsx)(`img`,{src:t,alt:``}):null}),(0,J.jsx)(D,{variant:`outline`,size:`sm`,asChild:!0,children:(0,J.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,J.jsx)(U,{className:`size-4`}),t?p():g(),(0,J.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void l(e,t)})]})}),!t&&n?(0,J.jsx)(D,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:oe()}):null,t?(0,J.jsx)(D,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void u(e),children:ce()}):null]})}return(0,J.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,J.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:dt()}),(0,J.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,J.jsx)(f,{mode:`light`}),(0,J.jsx)(f,{mode:`dark`})]}),r?(0,J.jsx)(`span`,{className:`oc-show__desc`,children:ie()}):null,a?(0,J.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function $({chart:e}){let t=S(y.me.getMe,{host:L}),n=C(y.charts.addChartDomain),r=C(y.charts.removeChartDomain),[i,a]=(0,W.useState)(``),[o,s]=(0,W.useState)(null),[l,u]=(0,W.useState)(!1);if(t?.role!==`admin`)return null;let d=e.domains??[];async function p(){let t=i.trim();if(t!==``){s(null),u(!0);try{await n({chartKey:e.key,domain:t}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{u(!1)}}}async function m(t){s(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,J.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,J.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:f()}),(0,J.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,J.jsx)(`div`,{className:`oc-chart-avail__groups`,children:d.length===0?(0,J.jsx)(`span`,{className:`oc-show__desc`,children:fe()}):d.map(e=>(0,J.jsxs)(F,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,J.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":ct({domain:e}),onClick:()=>void m(e),children:(0,J.jsx)(E,{className:`size-3`})})]},e))}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(A,{value:i,onChange:e=>a(e.target.value),placeholder:ot(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&p()}}),(0,J.jsx)(D,{variant:`outline`,size:`sm`,disabled:l,onClick:()=>void p(),children:c()})]}),(0,J.jsx)(`span`,{className:`oc-show__desc`,children:me()}),o?(0,J.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})]})}function Xt({chart:e}){let t=C(y.charts.updateChart),n=C(y.charts.deleteChart),[r,i]=(0,W.useState)(!1),[a,s]=(0,W.useState)(e.name),[c,l]=(0,W.useState)(()=>JSON.stringify(e.tokens,null,2)),[u,d]=(0,W.useState)(null),[f,p]=(0,W.useState)(!1);function m(){s(e.name),l(JSON.stringify(e.tokens,null,2)),d(null),i(!0)}async function h(){if(e.chartId===void 0)return;d(null);let n;try{n=JSON.parse(c)}catch{d(w());return}p(!0);try{await t({chartId:e.chartId,name:a.trim(),tokens:n}),i(!1)}catch(e){d(e instanceof Error?e.message:String(e))}finally{p(!1)}}async function g(){if(e.chartId!==void 0&&window.confirm(x()))try{await n({chartId:e.chartId})}catch{}}return(0,J.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,J.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,J.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(D,{variant:`outline`,size:`sm`,onClick:m,children:ge()}),(0,J.jsx)(D,{variant:`ghost`,size:`sm`,onClick:()=>void g(),children:o()})]})})]}),r?(0,J.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,J.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,J.jsx)(`span`,{className:`oc-chart-import__label`,children:it()}),(0,J.jsx)(A,{value:a,onChange:e=>s(e.target.value),maxLength:60})]}),(0,J.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,J.jsx)(`span`,{className:`oc-chart-import__label`,children:Se()}),(0,J.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:c,onChange:e=>l(e.target.value),rows:10,spellCheck:!1})]}),u?(0,J.jsx)(`p`,{className:`oc-chart-import__error`,children:u}):null,(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(D,{size:`sm`,disabled:f,onClick:()=>void h(),children:we()}),(0,J.jsx)(D,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:ut()})]})]}):null,(0,J.jsx)(Yt,{chart:e}),(0,J.jsx)($,{chart:e})]})}function Zt(){let e=S(y.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(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:_e()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:he()})]}),e!==void 0&&t.length===0?(0,J.jsx)(`p`,{className:`oc-show__desc`,children:h()}):(0,J.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,J.jsx)(Xt,{chart:e},e.key))})]})}function Qt({chart:e,groups:t}){let n=C(y.charts.addChartToGroupPool),r=C(y.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,o=new Set((a??[]).map(e=>e.groupId)),s=t.filter(e=>!o.has(e._id));async function c(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function l(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,J.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,J.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,J.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,J.jsx)(F,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?$e():e.kind===`custom`&&e.scope===`personal`?b():Te()}),e.isGlobalDefault?(0,J.jsx)(F,{variant:`default`,children:Ye()}):null]}),(0,J.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,J.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Le()}),(a??[]).map(e=>(0,J.jsxs)(F,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,J.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":Je({group:e.name}),onClick:()=>void l(e.groupId),children:(0,J.jsx)(E,{className:`size-3`})})]},e.groupId)),s.length>0?(0,J.jsxs)(z,{value:``,onValueChange:e=>void c(e),children:[(0,J.jsx)(M,{size:`sm`,className:`w-56`,children:(0,J.jsx)(O,{placeholder:Qe()})}),(0,J.jsx)(N,{children:s.map(e=>(0,J.jsx)(R,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,J.jsx)(`span`,{className:`oc-show__desc`,children:Ce()}):null]})]})}function $t({chart:e}){let t=C(y.charts.promoteChartToCommon),n=C(y.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function i(){if(e.chartId!==void 0&&window.confirm(x()))try{await n({chartId:e.chartId})}catch{}}return(0,J.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,J.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,J.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,J.jsx)(F,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?Oe():b()}),e.ownerLabel?(0,J.jsx)(`span`,{className:`oc-show__desc`,children:Ze({owner:e.ownerLabel})}):null]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,J.jsx)(D,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:nt()}):null,(0,J.jsx)(D,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:We()})]})]})}function en({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=C(y.admin.setDefaultThemeMode),a=C(y.admin.setDefaultLocale),o=C(y.charts.setDefaultChart),c=S(y.charts.listChartsAdmin),u=S(y.groups.listGroups,{}),f=e??`system`,p=t??`fr`;return(0,J.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:at()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:s()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h3`,{className:`oc-show__title`,children:Ge()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Xe()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(D,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void o({name:null}),children:v()}),ht.map(e=>(0,J.jsx)(D,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key)),(c??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,J.jsx)(D,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key))]})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h3`,{className:`oc-show__title`,children:Ae()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:De()})]}),(0,J.jsx)(`div`,{className:`oc-chart-avail-list`,children:(c??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,J.jsx)(Qt,{chart:e,groups:u??[]},e.key))})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h3`,{className:`oc-show__title`,children:tt()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:He()})]}),(0,J.jsx)(`div`,{className:`oc-chart-avail-list`,children:(c??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,J.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,J.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,J.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,J.jsx)($,{chart:e})]},e.key))})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h3`,{className:`oc-show__title`,children:Ie()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Ke()})]}),(()=>{let e=(c??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Ee()}):(0,J.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,J.jsx)($t,{chart:e},e.key))})})()]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h3`,{className:`oc-show__title`,children:i()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Be()})]}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,J.jsx)(D,{variant:f===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:Wt(e)},e))})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h3`,{className:`oc-show__title`,children:se()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:l()})]}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`].map(e=>(0,J.jsx)(D,{variant:p===e?`default`:`outline`,size:`sm`,onClick:()=>void a({locale:e}),children:e===`fr`?Me():Pe()},e))}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:d()})]})]})}function tn(){let e=S(y.me.getMe,{host:L}),t=gt(e?.resolvedThemeMode);return(0,J.jsxs)(`div`,{className:`oc-appearance`,children:[(0,J.jsx)(qt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,J.jsx)(Jt,{}),(0,J.jsx)(Zt,{}),e?.role===`admin`?(0,J.jsx)(en,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function nn(){let[e,t]=(0,W.useState)(!0),[n,r]=(0,W.useState)(`per-user`),[i,a]=(0,W.useState)(``),[o,s]=(0,W.useState)(Y),[c,l]=(0,W.useState)(Y),[u,d]=(0,W.useState)(X),f=i!==``||o!==Y||c!==Y;function p(){a(``),s(Y),l(Y),d(X)}return(0,J.jsxs)(`div`,{className:`oc-show`,children:[(0,J.jsx)(tn,{}),(0,J.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,J.jsx)(`summary`,{className:`oc-show__title`,children:pe()}),(0,J.jsxs)(Z,{title:`Buttons`,description:`Variants`,children:[(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(D,{children:`Default`}),(0,J.jsx)(D,{variant:`secondary`,children:`Secondary`}),(0,J.jsx)(D,{variant:`outline`,children:`Outline`}),(0,J.jsx)(D,{variant:`ghost`,children:`Ghost`}),(0,J.jsx)(D,{variant:`destructive`,children:`Destructive`}),(0,J.jsx)(D,{variant:`link`,children:`Link`})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(D,{size:`sm`,children:`Small`}),(0,J.jsx)(D,{children:`Default`}),(0,J.jsx)(D,{size:`lg`,children:`Large`}),(0,J.jsx)(D,{size:`icon`,"aria-label":`more`,children:(0,J.jsx)(k,{})}),(0,J.jsx)(D,{disabled:!0,children:`Disabled`})]})]}),(0,J.jsx)(Z,{title:`Badges`,children:(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(F,{children:`Default`}),(0,J.jsx)(F,{variant:`secondary`,children:`Secondary`}),(0,J.jsx)(F,{variant:`outline`,children:`Outline`}),(0,J.jsx)(F,{variant:`destructive`,children:`Destructive`})]})}),(0,J.jsx)(Z,{title:`Inputs & selection`,children:(0,J.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,J.jsx)(A,{placeholder:`Text input…`}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsxs)(z,{value:n,onValueChange:r,children:[(0,J.jsx)(M,{className:`w-56`,children:(0,J.jsx)(O,{placeholder:`Select…`})}),(0,J.jsxs)(N,{children:[(0,J.jsx)(R,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,J.jsx)(R,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,J.jsxs)(`label`,{className:`oc-show__check`,children:[(0,J.jsx)(j,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,J.jsx)(Z,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,J.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,J.jsxs)(Ot,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,J.jsxs)(z,{value:o,onValueChange:s,children:[(0,J.jsx)(M,{size:`sm`,children:(0,J.jsx)(O,{})}),(0,J.jsxs)(N,{children:[(0,J.jsx)(R,{value:Y,children:`Toutes directions`}),(0,J.jsx)(R,{value:`inbound`,children:`inbound`}),(0,J.jsx)(R,{value:`outbound`,children:`outbound`}),(0,J.jsx)(R,{value:`internal`,children:`internal`})]})]}),(0,J.jsxs)(z,{value:c,onValueChange:l,children:[(0,J.jsx)(M,{size:`sm`,children:(0,J.jsx)(O,{})}),(0,J.jsxs)(N,{children:[(0,J.jsx)(R,{value:Y,children:`Toutes sévérités`}),(0,J.jsx)(R,{value:`info`,children:`info`}),(0,J.jsx)(R,{value:`warn`,children:`warn`}),(0,J.jsx)(R,{value:`critical`,children:`critical`})]})]})]}),(0,J.jsx)(kt,{fields:Ut,onChange:()=>{}}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,J.jsx)(ft,{value:u,onChange:d})]})]})}),(0,J.jsx)(Z,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,J.jsxs)(mt,{children:[(0,J.jsx)(_t,{asChild:!0,children:(0,J.jsx)(D,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,J.jsx)(k,{})})}),(0,J.jsxs)(pt,{align:`start`,children:[(0,J.jsx)(vt,{children:`Actions`}),(0,J.jsx)(I,{}),(0,J.jsx)(P,{children:`Edit`}),(0,J.jsx)(P,{children:`Duplicate`}),(0,J.jsx)(I,{}),(0,J.jsx)(P,{variant:`destructive`,children:`Delete`})]})]})}),(0,J.jsx)(Z,{title:`Card`,children:(0,J.jsxs)(wt,{className:`w-80`,children:[(0,J.jsxs)(yt,{children:[(0,J.jsx)(St,{children:`Instance`}),(0,J.jsx)(Ct,{children:`Non-secret metadata only.`})]}),(0,J.jsx)(xt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,J.jsxs)(bt,{className:`gap-2`,children:[(0,J.jsx)(D,{size:`sm`,children:`Save`}),(0,J.jsx)(D,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,J.jsx)(Z,{title:`Table`,children:(0,J.jsxs)(Dt,{children:[(0,J.jsx)(Tt,{children:(0,J.jsxs)(V,{children:[(0,J.jsx)(B,{className:`w-8`,children:(0,J.jsx)(j,{"aria-label":`select all`})}),(0,J.jsx)(B,{children:`Name`}),(0,J.jsx)(B,{children:`Mode`}),(0,J.jsx)(B,{className:`text-right`,children:`Status`}),(0,J.jsx)(B,{className:`w-8`})]})}),(0,J.jsx)(Et,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,J.jsxs)(V,{children:[(0,J.jsx)(H,{children:(0,J.jsx)(j,{"aria-label":`select ${e.n}`})}),(0,J.jsx)(H,{className:`font-medium`,children:e.n}),(0,J.jsx)(H,{children:(0,J.jsx)(F,{variant:`secondary`,children:e.m})}),(0,J.jsx)(H,{className:`text-right`,children:(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,J.jsx)(T,{className:`size-3.5`}),` `,e.s]})}),(0,J.jsx)(H,{children:(0,J.jsx)(D,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,J.jsx)(k,{})})})]},e.n))})]})}),(0,J.jsx)(Z,{title:`App fragments`,description:`Chat-specific components`,children:(0,J.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,J.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,J.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,J.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,J.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,J.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,J.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,J.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,J.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,J.jsx)(`span`,{className:`oc-run-status__dot`}),(0,J.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{nn as ThemeShowroom};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$g as r,Al as i,Bg as a,Bl as o,Cl as s,Dl as c,El as l,Fl as u,Gg as d,Gl as f,Hg as p,Hl as ee,Il as m,Jg as h,Jl as g,Kg as _,Kl as v,Ll as te,Ml as ne,Nl as re,Ol as ie,Pl as ae,Qg as y,Rl as oe,Sl as se,Tl as ce,Ug as b,Ul as le,Vg as ue,Vl as de,Wg as fe,Wl as pe,Xg as x,Xl as me,Yg as S,Yl as he,Zg as ge,_l as _e,a_ as C,bl as ve,c_ as w,cw as T,e_ as E,fl as D,gl as ye,hl as be,hw as O,i_ as k,jl as xe,kl as Se,l_ as A,ml as j,mw as M,n_ as N,o_ as P,pl as F,qg as I,ql as Ce,r_ as L,s_ as R,t_ as z,u_ as we,vl as Te,wl as Ee,xl as De,yl as Oe,zl as ke}from"./dist-CfgJ5RDI.js";import{n as Ae}from"./dist-D2UVxg3M.js";import{n as je}from"./TimeRangePicker-BCumk2bf.js";import{t as Me}from"./x-TUhW74Oi.js";import{t as B}from"./button-ClzO6iiY.js";import{A as Ne,C as V,F as Pe,I as Fe,Ot as Ie,P as Le,R as Re,S as H,Tt as ze,a as Be,b as U,i as Ve,kt as He,m as W,o as Ue,ot as We,r as Ge,x as G,y as K,z as Ke}from"./index-BsbX_-dh.js";import{t as qe}from"./FilterBar-Cn4lFaY4.js";import{t as Je}from"./AdvancedFilter-DrUoj1oY.js";import{t as Ye}from"./DataTableShell-BY48g0WO.js";var q=t(e(),1),J=n(),Y=e=>e===null?`—`:String(Math.round(e));function Xe(){let e=O(T.me.getMe,{host:We})?.role===`admin`,t=O(T.deliveryTiming.getDeliveryStatus,{}),n=M(T.deliveryTiming.startDeliveryRecord),r=M(T.deliveryTiming.stopDeliveryRecord),i=M(T.deliveryTiming.deleteDeliverySessions),[a,o]=(0,q.useState)(!1),[s,c]=(0,q.useState)(null),[l,u]=(0,q.useState)(new Set),[f,p]=(0,q.useState)(!1),[ee,m]=(0,q.useState)(!1),h=O(T.deliveryTiming.listDeliverySessions,a?{}:`skip`),g=O(T.deliveryTiming.getDeliveryReport,a?{sessionId:s??void 0}:`skip`),_=t?.recording??!1,v=async()=>{p(!0);try{_?await r({}):await n({})}finally{p(!1)}},te=()=>{g&&navigator.clipboard?.writeText(Ne(g)).then(()=>{m(!0),window.setTimeout(()=>m(!1),1200)}).catch(()=>{})},ne=e=>u(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),re=async()=>{let e=[...l];if(e.length!==0){p(!0);try{await i({sessionIds:e}),s!==null&&l.has(s)&&c(null),u(new Set)}finally{p(!1)}}};return(0,J.jsxs)(`section`,{className:`mb-4 flex flex-col gap-3 rounded-lg border border-border p-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold`,children:we()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:A()})]}),e?(0,J.jsx)(B,{variant:_?`destructive`:`default`,size:`sm`,disabled:f||t===void 0,onClick:()=>void v(),children:_?R():w()}):null]}),_?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(W,{variant:`secondary`,children:P()}),t?.startedAt?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:C({time:new Date(t.startedAt).toLocaleTimeString()})}):null]}):null,(0,J.jsx)(`div`,{children:(0,J.jsx)(B,{variant:`outline`,size:`sm`,onClick:()=>o(e=>!e),children:a?L():k()})}),a?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Ze,{sessions:h,selected:s,checked:l,isAdmin:e,onSelect:c,onToggleCheck:ne}),e&&l.size>0?(0,J.jsx)(`div`,{children:(0,J.jsx)(B,{variant:`destructive`,size:`sm`,disabled:f,onClick:()=>void re(),children:d({n:l.size})})}):null,(0,J.jsx)(Qe,{report:g,copied:ee,onCopy:te})]}):null]})}function Ze({sessions:e,selected:t,checked:n,isAdmin:r,onSelect:i,onToggleCheck:a}){return e?e.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}):(0,J.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,J.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:b()}),(0,J.jsx)(`ul`,{className:`flex flex-col`,children:e.map(e=>{let o=t===e.sessionId,s=new Date(e.startedAt).toLocaleString();return(0,J.jsxs)(`li`,{className:`flex items-center gap-2 border-t border-border py-1 text-sm first:border-t-0`,children:[r?(0,J.jsx)(`input`,{type:`checkbox`,"aria-label":`${p()} — ${s}`,checked:n.has(e.sessionId),onChange:()=>a(e.sessionId)}):null,(0,J.jsx)(`button`,{type:`button`,"aria-pressed":o,className:`flex-1 truncate text-left ${o?`font-medium`:`text-muted-foreground`}`,onClick:()=>i(o?null:e.sessionId),children:s}),e.active?(0,J.jsx)(W,{variant:`secondary`,children:ue()}):null]},e.sessionId)})})]}):null}function Qe({report:e,copied:t,onCopy:n}){if(!e)return null;if(e.count===0||e.segments===null)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:N()});let i=e.segments,o=(e,t)=>(0,J.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,J.jsx)(`td`,{className:`py-1`,children:e}),(0,J.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:t.count}),(0,J.jsxs)(`td`,{className:`py-1 text-right tabular-nums`,children:[Y(t.p50),` / `,Y(t.p95),` / `,Y(t.max)]})]});return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.count,` `,a()]}),(0,J.jsxs)(B,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,J.jsx)(Ae,{size:13,"aria-hidden":!0}):(0,J.jsx)(ze,{size:13,"aria-hidden":!0}),t?_():I()]})]}),(0,J.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{className:`text-left text-muted-foreground`,children:[(0,J.jsx)(`th`,{className:`py-1 font-medium`,children:z()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:E()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:r()})]})}),(0,J.jsxs)(`tbody`,{children:[o(y(),i.A),o(ge(),i.B),o(x(),i.C)]})]}),e.truncated?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):null,(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:S()})]})}var $e=[50,100,200,500],X=`all`,Z=`__all__`,et=[`2xx`,`4xx`,`5xx`],tt=[`user`,`service`,`system`],nt=[`inbound`,`outbound`,`internal`],rt={kind:`relative`,from:`now-30d`,to:`now`},it=[{value:`kind`,label:`kind`},{value:`status`,label:`status`},{value:`latencyMs`,label:`latence (ms)`},{value:`principalType`,label:`principal`},{value:`direction`,label:`direction`},{value:`roleKey`,label:`rôle`},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function at(){let e=He({from:`/settings/traces`}),t=Ie({from:`/settings/traces`}),n=e.limit,r=e.kind,a=e.statusClass??Z,d=e.principalType??Z,p=e.direction??Z,h=e.roleKey??Z,_=e.q??``,y=Ge(e.from,e.to),b=(0,q.useMemo)(()=>Ue(e.adv),[e.adv]),{from:ue,to:fe}=je(y),[x,S]=(0,q.useState)(null),[ge,C]=(0,q.useState)(null),w=e=>void t({search:t=>({...t,limit:e})}),E=e=>void t({search:t=>({...t,kind:e})}),D=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),k=e=>void t({search:t=>({...t,statusClass:e===Z?void 0:e})}),A=e=>void t({search:t=>({...t,principalType:e===Z?void 0:e})}),j=e=>void t({search:t=>({...t,direction:e===Z?void 0:e})}),M=e=>void t({search:t=>({...t,roleKey:e===Z?void 0:e})}),N=e=>void t({search:t=>({...t,...Be(e)})}),P=e=>void t({search:t=>({...t,adv:Ve(e)}),replace:!0}),F=O(T.observability.listEvents,{limit:n}),I=O(T.observability.listEvents,{limit:n,kind:r===X?void 0:r,filter:{q:_||void 0,from:ue,to:fe,statusClass:a===Z?void 0:a,principalType:d===Z?void 0:d,direction:p===Z?void 0:p,roleKey:h===Z?void 0:h,advanced:b.length>0?b:void 0}}),L=(0,q.useMemo)(()=>{let e=new Set;for(let t of F??[])e.add(t.kind);return[...e].sort()},[F]),R=(0,q.useMemo)(()=>{let e=new Set;for(let t of F??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[F]),z=_!==``||a!==Z||d!==Z||p!==Z||h!==Z||b.length>0||y.kind!==`relative`||y.from!==rt.from;function we(){t({search:{limit:100,kind:`all`},replace:!0})}let Ae=x?F?.filter(e=>e.correlationId===x):I;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Xe,{}),(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[me(),(0,J.jsx)(`strong`,{children:he()}),g(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:Ce()})]}),(0,J.jsxs)(qe,{q:_,onQChange:D,searchPlaceholder:v(),timeRange:y,onTimeRangeChange:N,onReset:we,canReset:z,children:[(0,J.jsxs)(K,{value:a,onValueChange:k,children:[(0,J.jsx)(H,{size:`sm`,className:`w-32`,children:(0,J.jsx)(V,{placeholder:f()})}),(0,J.jsxs)(U,{children:[(0,J.jsx)(G,{value:Z,children:pe()}),et.map(e=>(0,J.jsx)(G,{value:e,children:e},e))]})]}),(0,J.jsxs)(K,{value:d,onValueChange:A,children:[(0,J.jsx)(H,{size:`sm`,className:`w-32`,children:(0,J.jsx)(V,{placeholder:le()})}),(0,J.jsxs)(U,{children:[(0,J.jsx)(G,{value:Z,children:ee()}),tt.map(e=>(0,J.jsx)(G,{value:e,children:e},e))]})]}),(0,J.jsxs)(K,{value:p,onValueChange:j,children:[(0,J.jsx)(H,{size:`sm`,className:`w-32`,children:(0,J.jsx)(V,{placeholder:de()})}),(0,J.jsxs)(U,{children:[(0,J.jsx)(G,{value:Z,children:o()}),nt.map(e=>(0,J.jsx)(G,{value:e,children:e},e))]})]}),(0,J.jsxs)(K,{value:h,onValueChange:M,children:[(0,J.jsx)(H,{size:`sm`,className:`w-36`,children:(0,J.jsx)(V,{placeholder:ke()})}),(0,J.jsxs)(U,{children:[(0,J.jsx)(G,{value:Z,children:oe()}),R.map(e=>(0,J.jsx)(G,{value:e,children:e},e))]})]}),(0,J.jsxs)(K,{value:r,onValueChange:E,children:[(0,J.jsx)(H,{size:`sm`,className:`w-44`,children:(0,J.jsx)(V,{placeholder:te()})}),(0,J.jsxs)(U,{children:[(0,J.jsx)(G,{value:X,children:m()}),L.map(e=>(0,J.jsx)(G,{value:e,children:e},e))]})]}),(0,J.jsxs)(K,{value:String(n),onValueChange:e=>w(Number(e)),children:[(0,J.jsx)(H,{size:`sm`,className:`w-28`,children:(0,J.jsx)(V,{})}),(0,J.jsx)(U,{children:$e.map(e=>(0,J.jsx)(G,{value:String(e),children:u({count:e})},e))})]})]}),(0,J.jsx)(Je,{fields:it,seed:b,onChange:P}),x?(0,J.jsx)(`div`,{className:`oc-traces__followline`,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>S(null),title:ae(),children:[(0,J.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[re(),(0,J.jsx)(`code`,{children:Q(x)})]}),(0,J.jsx)(Me,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`sr-only`,children:ne()})]})}):null,(0,J.jsx)(Ye,{title:xe(),rows:Ae,emptyHint:x?i():Se(),columns:[{header:ie(),sort:e=>e.at,cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:new Date(e.at).toLocaleString(`fr-FR`)})},{header:c(),sort:e=>e.kind,cell:e=>(0,J.jsx)(W,{variant:`secondary`,children:e.kind})},{header:l(),sort:e=>$(e)??null,cell:e=>{let t=$(e);return t?(0,J.jsxs)(`span`,{className:`oc-traces__fail`,title:t,children:[`✕ `,t]}):(0,J.jsx)(`span`,{className:`oc-traces__ok`,"aria-label":ce(),children:`✓`})}},{header:Ee(),sort:e=>e.direction,cell:e=>e.direction?(0,J.jsx)(W,{variant:`outline`,children:e.direction}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:s(),sort:e=>e.principalType,cell:e=>(0,J.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,J.jsx)(W,{variant:`outline`,children:e.principalType}),e.principalId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:Q(e.principalId)}):null]})},{header:se(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,J.jsx)(W,{variant:`secondary`,children:e.roleKey}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:De(),sort:e=>e.route,cell:e=>e.route?(0,J.jsxs)(`span`,{className:`oc-traces__route`,children:[e.method?(0,J.jsx)(`span`,{className:`oc-traces__method`,children:e.method}):null,(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.route})]}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ve(),sort:e=>e.status,cell:e=>e.status===null?(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,J.jsx)(`span`,{className:`oc-traces__status ${ot(e.status)}`,children:e.status})},{header:Oe(),sort:e=>e.latencyMs,cell:e=>e.latencyMs===null?(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,J.jsxs)(`span`,{className:`oc-traces__mono`,children:[e.latencyMs,` ms`]})},{header:Te(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,J.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:_e(),onClick:()=>S(e.correlationId),children:Q(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ye(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,J.jsx)(B,{variant:`outline`,size:`sm`,onClick:()=>C(e),children:be()}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,J.jsx)(st,{row:ge,onClose:()=>C(null)})]})}function ot(e){return e>=500?`oc-traces__status--5xx`:e>=400?`oc-traces__status--4xx`:e>=200&&e<300?`oc-traces__status--2xx`:`oc-traces__status--other`}function Q(e){return e.length>8?e.slice(0,8):e}function $(e){if(typeof e.status==`number`&&e.status>=400)return String(e.status);if(!e.meta)return null;try{let t=JSON.parse(e.meta);if(e.kind===`openclaw.dispatch`&&t.dispatchStatus===`failed`)return t.errorCode??`failed`;if(e.kind===`assistant.stream`&&t.phase===`finalize`&&(t.streamStatus===`error`||t.streamStatus===`aborted`))return t.streamStatus;if(e.kind===`openclaw.ingest.denied`)return`denied`}catch{}return null}function st({row:e,onClose:t}){let n=(0,q.useMemo)(()=>{if(!e?.meta)return``;try{return JSON.stringify(JSON.parse(e.meta),null,2)}catch{return e.meta}},[e]);return(0,J.jsx)(Le,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,J.jsxs)(Pe,{className:`max-w-lg`,children:[(0,J.jsxs)(Re,{children:[(0,J.jsxs)(Ke,{className:`oc-traces__meta-title`,children:[j(),` `,(0,J.jsx)(`code`,{children:e.kind}),(0,J.jsx)(W,{variant:`outline`,children:F()})]}),(0,J.jsx)(Fe,{children:D()})]}),(0,J.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{at as TracesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{n,rw as r,t as i}from"./dist-CfgJ5RDI.js";e();var a=t(),o=i(`group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/80`,outline:`border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,xs:`h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,icon:`size-8`,"icon-xs":`size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg`,"icon-lg":`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function s({className:e,variant:t=`default`,size:i=`default`,asChild:s=!1,...c}){return(0,a.jsx)(s?r:`button`,{"data-slot":`button`,"data-variant":t,"data-size":i,className:n(o({variant:t,size:i,className:e})),...c})}export{o as n,s as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{lw as e}from"./dist-CfgJ5RDI.js";var t=e(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]);export{t};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{BC as r,GC as i,HC as a,JC as o,KC as s,UC as c,VC as l,WC as u,XC as d,ZC as f,ew as p,iw as m,qC as h,sw as g,tw as _}from"./dist-CfgJ5RDI.js";var v=t(e(),1),y=n(),b=`Dialog`,[x,ee]=f(b),[S,C]=x(b),w=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:c=!0}=e,l=v.useRef(null),u=v.useRef(null),[d,f]=o({prop:r,defaultProp:i??!1,onChange:a,caller:b});return(0,y.jsx)(S,{scope:t,triggerRef:l,contentRef:u,contentId:s(),titleId:s(),descriptionId:s(),open:d,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(e=>!e),[f]),modal:c,children:n})};w.displayName=b;var T=`DialogTrigger`,E=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=C(T,n),a=g(t,i.triggerRef);return(0,y.jsx)(_.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":K(i.open),...r,ref:a,onClick:p(e.onClick,i.onOpenToggle)})});E.displayName=T;var D=`DialogPortal`,[O,k]=x(D,{forceMount:void 0}),A=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=C(D,t);return(0,y.jsx)(O,{scope:t,forceMount:n,children:v.Children.map(r,e=>(0,y.jsx)(h,{present:n||a.open,children:(0,y.jsx)(c,{asChild:!0,container:i,children:e})}))})};A.displayName=D;var j=`DialogOverlay`,M=v.forwardRef((e,t)=>{let n=k(j,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=C(j,e.__scopeDialog);return a.modal?(0,y.jsx)(h,{present:r||a.open,children:(0,y.jsx)(P,{...i,ref:t})}):null});M.displayName=j;var N=m(`DialogOverlay.RemoveScroll`),P=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=C(j,n);return(0,y.jsx)(l,{as:N,allowPinchZoom:!0,shards:[i.contentRef],children:(0,y.jsx)(_.div,{"data-state":K(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),F=`DialogContent`,I=v.forwardRef((e,t)=>{let n=k(F,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=C(F,e.__scopeDialog);return(0,y.jsx)(h,{present:r||a.open,children:a.modal?(0,y.jsx)(L,{...i,ref:t}):(0,y.jsx)(R,{...i,ref:t})})});I.displayName=F;var L=v.forwardRef((e,t)=>{let n=C(F,e.__scopeDialog),i=v.useRef(null),a=g(t,n.contentRef,i);return v.useEffect(()=>{let e=i.current;if(e)return r(e)},[]),(0,y.jsx)(z,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:p(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:p(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:p(e.onFocusOutside,e=>e.preventDefault())})}),R=v.forwardRef((e,t)=>{let n=C(F,e.__scopeDialog),r=v.useRef(!1),i=v.useRef(!1);return(0,y.jsx)(z,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),z=v.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,...c}=e,l=C(F,n),d=v.useRef(null),f=g(t,d);return a(),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(u,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:(0,y.jsx)(i,{role:`dialog`,id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":K(l.open),...c,ref:f,onDismiss:()=>l.onOpenChange(!1)})}),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(X,{titleId:l.titleId}),(0,y.jsx)(Q,{contentRef:d,descriptionId:l.descriptionId})]})]})}),B=`DialogTitle`,V=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=C(B,n);return(0,y.jsx)(_.h2,{id:i.titleId,...r,ref:t})});V.displayName=B;var H=`DialogDescription`,U=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=C(H,n);return(0,y.jsx)(_.p,{id:i.descriptionId,...r,ref:t})});U.displayName=H;var W=`DialogClose`,G=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=C(W,n);return(0,y.jsx)(_.button,{type:`button`,...r,ref:t,onClick:p(e.onClick,()=>i.onOpenChange(!1))})});G.displayName=W;function K(e){return e?`open`:`closed`}var q=`DialogTitleWarning`,[J,Y]=d(q,{contentName:F,titleName:B,docsSlug:`dialog`}),X=({titleId:e})=>{let t=Y(q),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
2
|
-
|
|
3
|
-
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
4
|
-
|
|
5
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return v.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Z=`DialogDescriptionWarning`,Q=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Y(Z).contentName}}.`;return v.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},$=w,te=E,ne=A,re=M,ie=I,ae=V,oe=U,se=G;export{ne as a,te as c,re as i,J as l,ie as n,$ as o,oe as r,ae as s,se as t,ee as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{D as e}from"./index-BsbX_-dh.js";export{e as Mermaid};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Cd as e,Ed as t,Sd as n,Td as r,wd as i}from"./dist-CfgJ5RDI.js";var a={pending:t,user:r,admin:i,observer:e,agent:n};function o(e){if(e.builtin){let t=a[e.key];if(t)return t()}return e.description}export{o as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{lw as e}from"./dist-CfgJ5RDI.js";var t=e(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);export{t};
|