@rubytech/create-maxy-code 0.1.375 → 0.1.376
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/package.json +1 -1
- package/payload/server/{chunk-OBZE2KCK.js → chunk-Y4SHSFGK.js} +6 -0
- package/payload/server/maxy-edge.js +1 -1
- package/payload/server/public/assets/{AdminLoginScreens-3vFueaZy.js → AdminLoginScreens-C-LlR7j1.js} +1 -1
- package/payload/server/public/assets/AdminShell-B7rclo3t.js +1 -0
- package/payload/server/public/assets/{Checkbox-KbEWQEVU.js → Checkbox-C3efsnUI.js} +1 -1
- package/payload/server/public/assets/{admin-Cm1tZXbf.js → admin-DVYD__OE.js} +1 -1
- package/payload/server/public/assets/{browser-C38YYs28.js → browser-CCUgMt_X.js} +1 -1
- package/payload/server/public/assets/{calendar-CCN9px9o.js → calendar-B3jQEPFX.js} +1 -1
- package/payload/server/public/assets/chat-IcD9N2mi.js +1 -0
- package/payload/server/public/assets/{data-D1EXeX7P.js → data-Z84n0KXb.js} +1 -1
- package/payload/server/public/assets/{graph-labels-DYRDEL2l.js → graph-labels-BuKswZHJ.js} +1 -1
- package/payload/server/public/assets/{graph-DGXKuRbL.js → graph-mt6Y1RAt.js} +1 -1
- package/payload/server/public/assets/{operator-Bhtayf9U.js → operator-CDQ6eQ5M.js} +1 -1
- package/payload/server/public/assets/{page-BSMtFFmx.js → page-CjhCRrp2.js} +1 -1
- package/payload/server/public/assets/{public-DO_OqjJa.js → public-CHqiiZCo.js} +1 -1
- package/payload/server/public/assets/{rotate-ccw-DQfsmjLr.js → rotate-ccw-BkFK-J9e.js} +1 -1
- package/payload/server/public/assets/{useSubAccountSwitcher-CSCcvysa.css → useSubAccountSwitcher-Ca1GJeBC.css} +1 -1
- package/payload/server/public/browser.html +4 -4
- package/payload/server/public/calendar.html +4 -4
- package/payload/server/public/chat.html +6 -6
- package/payload/server/public/data.html +4 -4
- package/payload/server/public/graph.html +7 -7
- package/payload/server/public/index.html +6 -6
- package/payload/server/public/operator.html +8 -8
- package/payload/server/public/public.html +6 -6
- package/payload/server/server.js +3 -1
- package/payload/server/public/assets/AdminShell-DvczcTdp.js +0 -1
- package/payload/server/public/assets/chat-fj5J5aKV.js +0 -1
- /package/payload/server/public/assets/{useSubAccountSwitcher-z8xhukFw.js → useSubAccountSwitcher-BCOl64pj.js} +0 -0
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Browser — Maxy</title>
|
|
7
7
|
<link rel="icon" href="/favicon.ico">
|
|
8
|
-
<script type="module" crossorigin src="/assets/browser-
|
|
8
|
+
<script type="module" crossorigin src="/assets/browser-CCUgMt_X.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/chunk-CAM3fms7.js">
|
|
10
|
-
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/AdminShell-
|
|
12
|
-
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-
|
|
10
|
+
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-BCOl64pj.js">
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/AdminShell-B7rclo3t.js">
|
|
12
|
+
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-Ca1GJeBC.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|
|
15
15
|
<div id="root"></div>
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Calendar — Maxy</title>
|
|
7
7
|
<link rel="icon" href="/favicon.ico">
|
|
8
|
-
<script type="module" crossorigin src="/assets/calendar-
|
|
8
|
+
<script type="module" crossorigin src="/assets/calendar-B3jQEPFX.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/chunk-CAM3fms7.js">
|
|
10
|
-
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/AdminShell-
|
|
12
|
-
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-
|
|
10
|
+
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-BCOl64pj.js">
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/AdminShell-B7rclo3t.js">
|
|
12
|
+
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-Ca1GJeBC.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|
|
15
15
|
<div id="root"></div>
|
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Chat — Maxy</title>
|
|
7
7
|
<link rel="icon" href="/favicon.ico">
|
|
8
|
-
<script type="module" crossorigin src="/assets/chat-
|
|
8
|
+
<script type="module" crossorigin src="/assets/chat-IcD9N2mi.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/chunk-CAM3fms7.js">
|
|
10
|
-
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/AdminShell-
|
|
10
|
+
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-BCOl64pj.js">
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/AdminShell-B7rclo3t.js">
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/admin-types-DJoj6VJv.js">
|
|
13
13
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-CQ36nxok.js">
|
|
14
|
-
<link rel="modulepreload" crossorigin href="/assets/rotate-ccw-
|
|
15
|
-
<link rel="modulepreload" crossorigin href="/assets/page-
|
|
16
|
-
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-
|
|
14
|
+
<link rel="modulepreload" crossorigin href="/assets/rotate-ccw-BkFK-J9e.js">
|
|
15
|
+
<link rel="modulepreload" crossorigin href="/assets/page-CjhCRrp2.js">
|
|
16
|
+
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-Ca1GJeBC.css">
|
|
17
17
|
</head>
|
|
18
18
|
<body>
|
|
19
19
|
<div id="root"></div>
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Data — Maxy</title>
|
|
7
7
|
<link rel="icon" href="/favicon.ico">
|
|
8
|
-
<script type="module" crossorigin src="/assets/data-
|
|
8
|
+
<script type="module" crossorigin src="/assets/data-Z84n0KXb.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/chunk-CAM3fms7.js">
|
|
10
|
-
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/graph-labels-
|
|
12
|
-
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-
|
|
10
|
+
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-BCOl64pj.js">
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/graph-labels-BuKswZHJ.js">
|
|
12
|
+
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-Ca1GJeBC.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|
|
15
15
|
<div id="root"></div>
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Graph — Maxy</title>
|
|
7
7
|
<link rel="icon" href="/favicon.ico">
|
|
8
|
-
<script type="module" crossorigin src="/assets/graph-
|
|
8
|
+
<script type="module" crossorigin src="/assets/graph-mt6Y1RAt.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/chunk-CAM3fms7.js">
|
|
10
|
-
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/graph-labels-
|
|
12
|
-
<link rel="modulepreload" crossorigin href="/assets/AdminShell-
|
|
13
|
-
<link rel="modulepreload" crossorigin href="/assets/Checkbox-
|
|
14
|
-
<link rel="modulepreload" crossorigin href="/assets/rotate-ccw-
|
|
15
|
-
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-
|
|
10
|
+
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-BCOl64pj.js">
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/graph-labels-BuKswZHJ.js">
|
|
12
|
+
<link rel="modulepreload" crossorigin href="/assets/AdminShell-B7rclo3t.js">
|
|
13
|
+
<link rel="modulepreload" crossorigin href="/assets/Checkbox-C3efsnUI.js">
|
|
14
|
+
<link rel="modulepreload" crossorigin href="/assets/rotate-ccw-BkFK-J9e.js">
|
|
15
|
+
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-Ca1GJeBC.css">
|
|
16
16
|
</head>
|
|
17
17
|
<body>
|
|
18
18
|
<div id="root"></div>
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Maxy</title>
|
|
7
7
|
<link rel="icon" href="/favicon.ico">
|
|
8
|
-
<script type="module" crossorigin src="/assets/admin-
|
|
8
|
+
<script type="module" crossorigin src="/assets/admin-DVYD__OE.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/chunk-CAM3fms7.js">
|
|
10
|
-
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/AdminShell-
|
|
10
|
+
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-BCOl64pj.js">
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/AdminShell-B7rclo3t.js">
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/admin-types-DJoj6VJv.js">
|
|
13
|
-
<link rel="modulepreload" crossorigin href="/assets/Checkbox-
|
|
14
|
-
<link rel="modulepreload" crossorigin href="/assets/AdminLoginScreens-
|
|
15
|
-
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-
|
|
13
|
+
<link rel="modulepreload" crossorigin href="/assets/Checkbox-C3efsnUI.js">
|
|
14
|
+
<link rel="modulepreload" crossorigin href="/assets/AdminLoginScreens-C-LlR7j1.js">
|
|
15
|
+
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-Ca1GJeBC.css">
|
|
16
16
|
<link rel="stylesheet" crossorigin href="/assets/AdminLoginScreens-CWMpccrR.css">
|
|
17
17
|
<link rel="stylesheet" href="/brand-defaults.css">
|
|
18
18
|
</head>
|
|
@@ -5,17 +5,17 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Operator — Maxy</title>
|
|
7
7
|
<link rel="icon" href="/favicon.ico">
|
|
8
|
-
<script type="module" crossorigin src="/assets/operator-
|
|
8
|
+
<script type="module" crossorigin src="/assets/operator-CDQ6eQ5M.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/chunk-CAM3fms7.js">
|
|
10
|
-
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/AdminShell-
|
|
10
|
+
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-BCOl64pj.js">
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/AdminShell-B7rclo3t.js">
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/admin-types-DJoj6VJv.js">
|
|
13
|
-
<link rel="modulepreload" crossorigin href="/assets/Checkbox-
|
|
14
|
-
<link rel="modulepreload" crossorigin href="/assets/AdminLoginScreens-
|
|
13
|
+
<link rel="modulepreload" crossorigin href="/assets/Checkbox-C3efsnUI.js">
|
|
14
|
+
<link rel="modulepreload" crossorigin href="/assets/AdminLoginScreens-C-LlR7j1.js">
|
|
15
15
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-CQ36nxok.js">
|
|
16
|
-
<link rel="modulepreload" crossorigin href="/assets/rotate-ccw-
|
|
17
|
-
<link rel="modulepreload" crossorigin href="/assets/page-
|
|
18
|
-
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-
|
|
16
|
+
<link rel="modulepreload" crossorigin href="/assets/rotate-ccw-BkFK-J9e.js">
|
|
17
|
+
<link rel="modulepreload" crossorigin href="/assets/page-CjhCRrp2.js">
|
|
18
|
+
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-Ca1GJeBC.css">
|
|
19
19
|
<link rel="stylesheet" crossorigin href="/assets/AdminLoginScreens-CWMpccrR.css">
|
|
20
20
|
</head>
|
|
21
21
|
<body>
|
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Maxy</title>
|
|
7
7
|
<link rel="icon" href="/favicon.ico">
|
|
8
|
-
<script type="module" crossorigin src="/assets/public-
|
|
8
|
+
<script type="module" crossorigin src="/assets/public-CHqiiZCo.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/chunk-CAM3fms7.js">
|
|
10
|
-
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/AdminShell-
|
|
10
|
+
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-BCOl64pj.js">
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/AdminShell-B7rclo3t.js">
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/admin-types-DJoj6VJv.js">
|
|
13
13
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-CQ36nxok.js">
|
|
14
|
-
<link rel="modulepreload" crossorigin href="/assets/rotate-ccw-
|
|
15
|
-
<link rel="modulepreload" crossorigin href="/assets/page-
|
|
16
|
-
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-
|
|
14
|
+
<link rel="modulepreload" crossorigin href="/assets/rotate-ccw-BkFK-J9e.js">
|
|
15
|
+
<link rel="modulepreload" crossorigin href="/assets/page-CjhCRrp2.js">
|
|
16
|
+
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-Ca1GJeBC.css">
|
|
17
17
|
<link rel="stylesheet" href="/brand-defaults.css">
|
|
18
18
|
</head>
|
|
19
19
|
<body class="public-surface">
|
package/payload/server/server.js
CHANGED
|
@@ -87,6 +87,7 @@ import {
|
|
|
87
87
|
resolveCallback,
|
|
88
88
|
resolveClientIp,
|
|
89
89
|
resolveDefaultAgentSlug,
|
|
90
|
+
retagAccountForUser,
|
|
90
91
|
runAdminUserSelfHeal,
|
|
91
92
|
runUserProfileReconcile,
|
|
92
93
|
safeJson,
|
|
@@ -108,7 +109,7 @@ import {
|
|
|
108
109
|
vncLog,
|
|
109
110
|
walkPremiumBundles,
|
|
110
111
|
writeAdminUserAndPerson
|
|
111
|
-
} from "./chunk-
|
|
112
|
+
} from "./chunk-Y4SHSFGK.js";
|
|
112
113
|
import {
|
|
113
114
|
__commonJS,
|
|
114
115
|
__toESM
|
|
@@ -10601,6 +10602,7 @@ app11.post("/switch-account", requireAdminSession, async (c) => {
|
|
|
10601
10602
|
const { userName, avatar } = await resolveUserIdentity(target.accountId, userId);
|
|
10602
10603
|
const payload = await createAdminSession(target.accountId, target.config.thinkingView, userId, userName, operatorRoleFor(target.config, userId), avatar);
|
|
10603
10604
|
unregisterSession(oldCacheKey);
|
|
10605
|
+
retagAccountForUser(userId, target.accountId);
|
|
10604
10606
|
console.log(`[sub-account] op=switch userId=${userId.slice(0, 8)} from=${oldCacheKey.slice(0, 8)} to=${target.accountId.slice(0, 8)}`);
|
|
10605
10607
|
return c.json(payload);
|
|
10606
10608
|
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CAM3fms7.js";import{A as t,B as n,C as r,E as i,G as a,I as o,K as s,L as c,M as l,N as u,O as d,T as f,V as p,_ as m,g as h,j as g,m as ee,n as te,t as ne,v as re,x as _,y as ie}from"./useSubAccountSwitcher-z8xhukFw.js";async function v(){try{let e=await fetch(`/api/onboarding/claude-auth`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`logout`})});return e.ok?(await e.json().catch(()=>({})))?.logged_out===!0:(console.error(`[admin-ui] claude-logout http-status=${e.status}`),!1)}catch(e){return console.error(`[admin-ui] claude-logout fetch failed: ${e instanceof Error?e.message:String(e)}`),!1}}var y=e(s(),1),b=p(),x={sm:14,md:16,lg:18},ae={sm:30,md:38,lg:46};function S({variant:e=`primary`,size:t=`md`,icon:n,iconPosition:r=`leading`,loading:i=!1,fullWidth:a=!1,disabled:o=!1,type:s=`button`,onClick:c,"aria-label":l,style:u,className:d,children:f}){let p=[`btn`,`btn--${e}`,t===`md`?``:`btn--${t}`,a?`btn--full`:``,d].filter(Boolean).join(` `),m=x[t],h={...e===`send`?{width:ae[t],height:ae[t]}:{},...u},g=Object.keys(h).length>0;return(0,b.jsxs)(`button`,{type:s,className:p,disabled:i||o,onClick:c,"aria-label":l,style:g?h:void 0,children:[(0,b.jsxs)(`span`,{className:`btn__content`,style:{visibility:i?`hidden`:`visible`},children:[n&&r===`leading`&&(0,b.jsx)(n,{size:m}),f,n&&r===`trailing`&&(0,b.jsx)(n,{size:m})]}),i&&(0,b.jsx)(`span`,{className:`btn__spinner`,children:`✱`})]})}var oe=o(`archive-restore`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h2`,key:`tvwodi`}],[`path`,{d:`M20 8v11a2 2 0 0 1-2 2h-2`,key:`1gkqxj`}],[`path`,{d:`m9 15 3-3 3 3`,key:`1pd0qc`}],[`path`,{d:`M12 12v9`,key:`192myk`}]]),C=o(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),w=o(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),se=o(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),ce=o(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),T=o(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),le=o(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),E=o(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),D=o(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),ue=o(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),de=o(`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`}]]),O=`maxy-shell-side-px`;function k(){if(typeof window>`u`)return 0;let e=document.querySelector(`.platform > .artefact`)?.getBoundingClientRect();return e&&e.width>0?Math.round(e.width):0}function A(e){if(typeof window>`u`)return e;let t=window.innerWidth,n=Math.max(248,t-480-k());return Math.min(Math.max(e,248),n)}function fe(){if(typeof window>`u`)return 264;try{let e=window.localStorage.getItem(O);if(!e)return 264;let t=parseInt(e,10);if(!Number.isFinite(t))return console.warn(`[admin-ui] sidebar-width-parse-failed stored=${JSON.stringify(e)} fallback=264`),264;if(t>=248)return A(t)}catch{}return 264}function pe({targetSelector:e=`.platform`}){let t=(0,y.useRef)(null),[n,r]=(0,y.useState)(()=>fe()),i=(0,y.useRef)(n);(0,y.useLayoutEffect)(()=>{let t=document.querySelector(e);!t||!(t instanceof HTMLElement)||(t.style.setProperty(`--side-px`,`${n}px`),i.current=n)},[n,e]);let a=(0,y.useCallback)(()=>{r(e=>{let t=A(e);return t===e?e:t})},[]);(0,y.useEffect)(()=>{a(),window.addEventListener(`resize`,a);let t=document.querySelector(e),n=null;return t instanceof HTMLElement&&(n=new MutationObserver(a),n.observe(t,{attributes:!0,attributeFilter:[`data-artefact`,`class`]})),()=>{window.removeEventListener(`resize`,a),n?.disconnect()}},[a,e]);let o=e=>{e.preventDefault();let n=t.current;if(!n)return;n.setPointerCapture(e.pointerId),n.classList.add(`dragging`);let a=!1,o=e=>{a=!0,r(A(Math.round(e.clientX)))},s=()=>{if(n.releasePointerCapture(e.pointerId),n.classList.remove(`dragging`),window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,s),!a)return;let t=i.current;try{window.localStorage.setItem(O,String(t))}catch{}console.info(`[admin-ui] sidebar-resize px=${t}`)};window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s)},s=()=>{let e=A(264);r(e);try{window.localStorage.removeItem(O)}catch{}console.info(`[admin-ui] sidebar-resize px=${e}`)};return(0,b.jsx)(`div`,{ref:t,className:`side-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize sidebar`,onPointerDown:o,onDoubleClick:s})}var j=a();function M({anchorRef:e,onClose:t,className:n,role:r,ariaLabel:i,children:a}){let o=(0,y.useRef)(null),[s,c]=(0,y.useState)({position:`fixed`,visibility:`hidden`}),l=(0,y.useCallback)(()=>{let t=e.current,n=o.current;if(!t||!n)return;let r=t.getBoundingClientRect(),i=n.getBoundingClientRect(),a=r.right-i.width;a<4&&(a=4);let s=window.innerHeight-r.bottom<i.height+8&&r.top>i.height+8?r.top-i.height:r.bottom;c({position:`fixed`,left:a,top:s,visibility:`visible`})},[e]);return(0,y.useLayoutEffect)(()=>{if(l(),typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>l());return o.current&&e.observe(o.current),()=>e.disconnect()},[l]),(0,y.useEffect)(()=>{let n=e=>{e.key===`Escape`&&t()},r=n=>{let r=n.target;e.current?.contains(r)||o.current?.contains(r)||t()},i=n=>{let r=e.current;r&&n.target instanceof Node&&n.target.contains(r)&&t()},a=()=>t();return document.addEventListener(`keydown`,n),document.addEventListener(`pointerdown`,r),window.addEventListener(`scroll`,i,!0),window.addEventListener(`resize`,a),()=>{document.removeEventListener(`keydown`,n),document.removeEventListener(`pointerdown`,r),window.removeEventListener(`scroll`,i,!0),window.removeEventListener(`resize`,a)}},[e,t]),(0,j.createPortal)((0,b.jsx)(`div`,{ref:o,className:n,role:r,"aria-label":i,style:s,children:a}),document.body)}function N({action:e,disabled:t,open:n,onToggle:r,onClose:i}){let a=(0,y.useRef)(null);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`button`,{ref:a,type:`button`,className:`conv-action`,onClick:r,disabled:t,"aria-haspopup":`dialog`,"aria-expanded":n,"aria-label":e.label,title:e.title,children:e.icon}),n&&(0,b.jsx)(M,{anchorRef:a,onClose:i,className:e.panelClassName,role:`dialog`,ariaLabel:e.label,children:e.panel()})]})}function me({actions:e,disabled:t,collapsed:n}){let[r,i]=(0,y.useState)(null),[a,o]=(0,y.useState)(!1),[s,c]=(0,y.useState)(null),u=(0,y.useRef)(null);(0,y.useEffect)(()=>{i(null),o(!1),c(null)},[n]);let d=(0,y.useCallback)(()=>{o(!1),c(null)},[]);return n?(0,b.jsxs)(`div`,{className:`conv-actions`,children:[(0,b.jsx)(`button`,{ref:u,type:`button`,className:`conv-action conv-actions-overflow`,onClick:()=>o(e=>!e),disabled:t,"aria-haspopup":`menu`,"aria-expanded":a,"aria-label":`Session actions`,title:`Session actions`,children:(0,b.jsx)(l,{size:12})}),a&&(0,b.jsx)(M,{anchorRef:u,onClose:d,className:`conv-actions-menu`,role:`menu`,children:e.map(e=>e.panel?(0,b.jsxs)(`div`,{className:`conv-actions-menu-disclosure`,children:[(0,b.jsxs)(`button`,{type:`button`,role:`menuitem`,"aria-haspopup":`dialog`,"aria-expanded":s===e.key,disabled:t,onClick:()=>c(t=>t===e.key?null:e.key),children:[e.icon,(0,b.jsx)(`span`,{children:e.menuLabel})]}),s===e.key&&(0,b.jsx)(`div`,{className:`conv-actions-menu-panel`,children:e.panel()})]},e.key):(0,b.jsxs)(`button`,{type:`button`,role:`menuitem`,className:e.danger?`conv-action-danger`:void 0,"aria-busy":e.busy,disabled:t,onClick:t=>{e.onClick?.(t),d()},children:[e.icon,(0,b.jsx)(`span`,{children:e.menuLabel})]},e.key))})]}):(0,b.jsx)(`div`,{className:`conv-actions`,children:e.map(e=>e.panel?(0,b.jsx)(N,{action:e,disabled:t,open:r===e.key,onToggle:()=>i(t=>t===e.key?null:e.key),onClose:()=>i(null)},e.key):(0,b.jsx)(`button`,{type:`button`,className:e.danger?`conv-action conv-action-danger`:`conv-action`,onClick:e.onClick,disabled:t,"aria-busy":e.busy,"aria-label":e.label,title:e.title,children:e.icon},e.key))})}var P=`claude-opus-4-8[1m]`,F=`claude-sonnet-5`,I=`claude-haiku-4-5`,he={[P]:`Opus 4.8 (1M context)`,[F]:`Sonnet 5`,[I]:`Haiku 4.5`};function L(e){return he[e]??e}var ge=[P,F,I];function R(e){return e.replace(/\[1m\]$/,``)}function _e(e){return ge.find(t=>R(t)===R(e))??e}var z=[`default`,`acceptEdits`,`plan`,`auto`,`bypassPermissions`],ve=[`low`,`medium`,`high`,`xhigh`];[...z],[...ve],[...ve];var B=[P,F,I],V={default:`Ask permissions`,acceptEdits:`Accept edits`,plan:`Plan mode`,auto:`Auto mode`,bypassPermissions:`Bypass permissions`},ye=z.map(e=>({value:e,label:V[e]??e})),H={low:`Low`,medium:`Medium`,high:`High`,xhigh:`Highest`},U=ve.map(e=>({value:e,label:H[e]??e}));function be(e){if(e){let t=B.find(t=>R(t)===R(e));if(t)return t}return P}function xe({row:e,adminFetch:t,onError:n}){let[r,i]=(0,y.useState)(()=>be(e.model)),[a,o]=(0,y.useState)(``),[s,c]=(0,y.useState)(``),[l,u]=(0,y.useState)(!1),f=(0,y.useRef)(!1);(0,y.useEffect)(()=>{i(be(e.model))},[e.model]);let p=async()=>{if(!f.current){f.current=!0,u(!0);try{let i=await t(`/api/admin/session-reseat`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({fromSessionId:e.sessionId,model:r,...a?{permissionMode:a}:{},...s?{effort:s}:{}})});if(!i.ok){n(`Could not reset ${e.title} (status ${i.status})`),console.error(`[admin-ui] dashboard-reseat-failed sessionId=${e.sessionId} status=${i.status}`),f.current=!1,u(!1);return}let o=await i.json().catch(()=>({}));o.target?window.location.assign(o.target):(n(`Reset of ${e.title} returned no target`),f.current=!1,u(!1))}catch(t){n(`Could not reset ${e.title} (network error)`),console.error(`[admin-ui] dashboard-reseat-failed sessionId=${e.sessionId} error=${t instanceof Error?t.message:String(t)}`),f.current=!1,u(!1)}}};return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`label`,{className:`reseat-field`,children:[(0,b.jsx)(`span`,{children:`Model`}),(0,b.jsx)(`select`,{"data-kind":`model`,value:r,disabled:l,onChange:e=>i(e.target.value),children:B.map(e=>(0,b.jsx)(`option`,{value:e,children:L(e)},e))})]}),(0,b.jsxs)(`label`,{className:`reseat-field`,children:[(0,b.jsx)(`span`,{children:`Mode`}),(0,b.jsxs)(`select`,{"data-kind":`mode`,value:a,disabled:l,onChange:e=>o(e.target.value),children:[(0,b.jsx)(`option`,{value:``,children:`Keep current`}),ye.map(e=>(0,b.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]}),(0,b.jsxs)(`label`,{className:`reseat-field`,children:[(0,b.jsx)(`span`,{children:`Effort`}),(0,b.jsxs)(`select`,{"data-kind":`effort`,value:s,disabled:l,onChange:e=>c(e.target.value),children:[(0,b.jsx)(`option`,{value:``,children:`Keep current`}),U.map(e=>(0,b.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]}),(0,b.jsx)(`button`,{type:`button`,className:`reseat-apply`,disabled:l,"aria-busy":l,onClick:()=>void p(),children:l?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(d,{size:12,className:`spin`,"aria-hidden":`true`}),`Resetting…`]}):`Reset`})]})}var Se=[`whatsapp`,`telegram`];function W(e){if(e<60)return`${e}s`;let t=Math.floor(e/60),n=e%60;return n>0?`${t}m ${n}s`:`${t}m`}function Ce(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}async function G(e){if(navigator.clipboard)try{return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select();let n=document.execCommand(`copy`);return document.body.removeChild(t),n}catch{return!1}}function we({target:e,onConfirm:t,onCancel:n}){return e?(0,b.jsx)(`div`,{className:`claude-info-overlay`,onClick:n,children:(0,b.jsxs)(`div`,{className:`claude-info-modal`,onClick:e=>e.stopPropagation(),role:`alertdialog`,"aria-label":`Confirm delete session`,children:[(0,b.jsxs)(`div`,{className:`claude-info-header`,children:[(0,b.jsx)(`span`,{children:`Delete this conversation?`}),(0,b.jsx)(`button`,{className:`claude-info-close`,onClick:n,"aria-label":`Close`,children:`✕`})]}),(0,b.jsxs)(`div`,{className:`claude-info-section`,style:{padding:`12px 14px`,fontSize:`11px`,color:`var(--text-secondary)`},children:[`This permanently removes the transcript. It is not moved to Archive and cannot be recovered.`,e.live&&(0,b.jsx)(`div`,{style:{marginTop:`8px`},children:`This session is running; deleting stops it first.`})]}),(0,b.jsxs)(`div`,{className:`claude-info-section`,style:{display:`flex`,gap:`8px`,padding:`10px 14px`},children:[(0,b.jsx)(S,{variant:`danger`,size:`sm`,style:{flex:1},onClick:t,children:`Delete`}),(0,b.jsx)(S,{variant:`secondary`,size:`sm`,style:{flex:1},onClick:n,children:`Cancel`})]})]})}):null}var Te=`auth-refresh-failed`;function Ee({error:e,onClose:t}){if(!e)return null;let n=e.reason===Te,r=n?`Claude sign-in expired`:`Session didn’t open`,i=n?`Your claude.ai login has expired. Re-authenticate to resume sessions.`:`The session did not bind within 60 seconds, so there is no live conversation to open.`;return(0,b.jsx)(`div`,{className:`claude-info-overlay`,onClick:t,children:(0,b.jsxs)(`div`,{className:`claude-info-modal`,onClick:e=>e.stopPropagation(),role:`alertdialog`,"aria-label":`Session could not be opened`,children:[(0,b.jsxs)(`div`,{className:`claude-info-header`,children:[(0,b.jsx)(`span`,{children:r}),(0,b.jsx)(`button`,{className:`claude-info-close`,onClick:t,"aria-label":`Close`,children:`✕`})]}),(0,b.jsxs)(`div`,{className:`claude-info-section`,style:{padding:`12px 14px`,fontSize:`11px`,color:`var(--text-secondary)`},children:[i,(0,b.jsxs)(`div`,{className:`claude-info-row`,style:{marginTop:`8px`},children:[(0,b.jsx)(`span`,{className:`claude-info-label`,children:`Reason`}),(0,b.jsx)(`span`,{className:`claude-info-value`,children:e.reason})]}),e.sessionId&&(0,b.jsxs)(`div`,{className:`claude-info-row`,children:[(0,b.jsx)(`span`,{className:`claude-info-label`,children:`Session`}),(0,b.jsxs)(`span`,{className:`claude-info-value`,children:[e.sessionId.slice(0,8),`…`]})]})]})]})})}function De(e){let{show:t,onClose:n,claudeInfo:r,messages:i,sessionElapsed:a,sessionId:o,cacheKey:s}=e,[c,l]=(0,y.useState)(null);if(!t)return null;let u=i.flatMap(e=>e.events?.filter(e=>e.type===`usage`)??[]),d=u.at(-1),f=d?.peak_request_pct==null?d?.context_window?Math.round((d.input_tokens+d.cache_creation_tokens+d.cache_read_tokens)/d.context_window*100):0:Math.round(d.peak_request_pct*100),p=u.reduce((e,t)=>e+t.input_tokens+t.cache_creation_tokens+t.cache_read_tokens+t.output_tokens,0),m=i.flatMap(e=>e.events?.filter(e=>e.type===`rate_limit`)??[]).at(-1),h=u.reduce((e,t)=>e+(t.total_cost_usd??0),0),g=r?.account?.subscriptionType,ee=e=>{let t=e*1e3-Date.now();if(t<=0)return`now`;let n=Math.floor(t/36e5),r=Math.floor(t%36e5/6e4);return n>0?`${n}h ${r}m`:`${r}m`};return(0,b.jsx)(`div`,{className:`claude-info-overlay`,onClick:n,children:(0,b.jsxs)(`div`,{className:`claude-info-modal`,onClick:e=>e.stopPropagation(),children:[(0,b.jsxs)(`div`,{className:`claude-info-header`,children:[(0,b.jsx)(`img`,{src:`/brand/claude.png`,alt:`Claude`,className:`claude-info-icon`}),(0,b.jsx)(`span`,{children:`Claude Code`}),(0,b.jsx)(`button`,{className:`claude-info-close`,onClick:n,"aria-label":`Close`,children:`✕`})]}),(0,b.jsxs)(`div`,{className:`claude-info-section`,children:[(0,b.jsxs)(`div`,{className:`claude-info-row`,children:[(0,b.jsx)(`span`,{className:`claude-info-label`,children:`Version`}),(0,b.jsx)(`span`,{className:`claude-info-value`,children:r?r.version:`…`})]}),(0,b.jsxs)(`div`,{className:`claude-info-row`,children:[(0,b.jsx)(`span`,{className:`claude-info-label`,children:`Email`}),(0,b.jsx)(`span`,{className:`claude-info-value`,children:r?.account?.email??`…`})]})]}),(g||m||h>0)&&(0,b.jsxs)(`div`,{className:`claude-info-section`,children:[g&&(0,b.jsxs)(`div`,{className:`claude-info-row`,children:[(0,b.jsx)(`span`,{className:`claude-info-label`,children:`Plan`}),(0,b.jsx)(`span`,{className:`claude-info-value`,style:{textTransform:`capitalize`},children:g})]}),m&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:`claude-info-row`,children:[(0,b.jsx)(`span`,{className:`claude-info-label`,children:`Usage`}),(0,b.jsxs)(`span`,{className:`claude-info-value`,children:[Math.round(m.utilization*100),`%`]})]}),(0,b.jsxs)(`div`,{className:`claude-info-row`,children:[(0,b.jsx)(`span`,{className:`claude-info-label`,children:`Resets in`}),(0,b.jsx)(`span`,{className:`claude-info-value`,children:ee(m.resetsAt)})]}),m.isUsingOverage&&(0,b.jsxs)(`div`,{className:`claude-info-row`,children:[(0,b.jsx)(`span`,{className:`claude-info-label`,children:`Overage`}),(0,b.jsx)(`span`,{className:`claude-info-value`,children:`Active`})]})]}),h>0&&(0,b.jsxs)(`div`,{className:`claude-info-row`,children:[(0,b.jsx)(`span`,{className:`claude-info-label`,children:`Session cost`}),(0,b.jsxs)(`span`,{className:`claude-info-value`,children:[`$`,h<.01?h.toFixed(4):h.toFixed(2)]})]})]}),(0,b.jsxs)(`div`,{className:`claude-info-section`,children:[(0,b.jsxs)(`div`,{className:`claude-info-row`,children:[(0,b.jsx)(`span`,{className:`claude-info-label`,children:`Model`}),(0,b.jsx)(`span`,{className:`claude-info-value`,children:r?.model??`…`})]}),(0,b.jsxs)(`div`,{className:`claude-info-row`,children:[(0,b.jsx)(`span`,{className:`claude-info-label`,children:`Context used`}),(0,b.jsx)(`span`,{className:`claude-info-value`,children:f>0?`${f}%`:`—`})]}),(0,b.jsxs)(`div`,{className:`claude-info-row`,children:[(0,b.jsx)(`span`,{className:`claude-info-label`,children:`Tokens`}),(0,b.jsx)(`span`,{className:`claude-info-value`,children:p>0?Ce(p):`—`})]}),(0,b.jsxs)(`div`,{className:`claude-info-row`,children:[(0,b.jsx)(`span`,{className:`claude-info-label`,children:`Session`}),(0,b.jsx)(`span`,{className:`claude-info-value`,children:W(a)})]}),(o||s)&&(()=>{let e=o??s??``;return(0,b.jsxs)(`div`,{className:`claude-info-row`,children:[(0,b.jsx)(`span`,{className:`claude-info-label`,children:`Session`}),(0,b.jsx)(`button`,{type:`button`,className:`claude-info-value claude-info-id-copy`,title:`${e} (${o?`flushed`:`pre-flush`}) — click to copy`,onClick:async()=>{l(await G(e)?`copied`:`failed`),setTimeout(()=>l(null),1200)},children:c===`copied`?`copied ✓`:c===`failed`?`copy failed ✕`:`${e.slice(0,8)}…`})]})})()]})]})})}var Oe=`https://claude.ai/code`,ke=200,Ae=[500,1e3,1500,2e3,2500,3e3,3e3];function je(e,t,n){if(e&&n.target)return{kind:`navigate`,url:n.target,sameOrigin:!0};let r=n.slug??n.bridgeSessionId??null;if(e&&r)return{kind:`navigate`,url:`${Oe}/${r}`,sameOrigin:!1};let i=n.reason||n.error||`status ${t}`;return{kind:`error`,sessionId:n.sessionId??null,reason:i}}function Me(e){if(!e)return``;let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`}):``}function K(e){let{businessName:a,cacheKey:o,role:s,userName:l,userAvatar:d,onSelectProjects:p,onSelectPeople:te,onSelectTasks:ne,onSelectAgents:ie,onCloseMobileDrawer:v,collapsed:x,selectedWhatsappId:ae,onSelectWhatsappConversation:S,initialWhatsappSurface:O=!1}=e,k=_(o),A=(0,y.useCallback)(e=>({key:`reseat`,label:`Reset session ${e.title} (model, mode, effort)`,menuLabel:`Reset`,title:`Reset — move this session onto a chosen model, mode, and effort`,icon:(0,b.jsx)(D,{size:12}),panelClassName:`reseat-panel`,panel:()=>(0,b.jsx)(xe,{row:e,adminFetch:k,onError:e=>V({message:e,failed:!0})})}),[k]),fe=c.productName,pe=typeof l==`string`?l:l===null?`name unavailable`:a||fe,j=(pe.trim().charAt(0)||`?`).toUpperCase(),[M,N]=(0,y.useState)(O?`whatsapp`:`sessions`),[P,F]=(0,y.useState)([]),[I,he]=(0,y.useState)(!1),[L,ge]=(0,y.useState)(null),[R,_e]=(0,y.useState)(!1),[z,ve]=(0,y.useState)(`file`),[B,V]=(0,y.useState)(null),[ye,H]=(0,y.useState)(null),[U,be]=(0,y.useState)([]),[W,Ce]=(0,y.useState)(!1),[G,Te]=(0,y.useState)(null),[De,Oe]=(0,y.useState)(!1),[K,Ne]=(0,y.useState)(!1),[q,Le]=(0,y.useState)(!1),[Re,ze]=(0,y.useState)(null),[Be,Ve]=(0,y.useState)(new Set),[J,He]=(0,y.useState)(null),[Ue,We]=(0,y.useState)(new Set),[Ge,Ke]=(0,y.useState)(new Set),[qe,Je]=(0,y.useState)(new Set),[Ye,Xe]=(0,y.useState)(null),[Ze,Y]=(0,y.useState)(``),[Qe,$e]=(0,y.useState)(!1),[X,et]=(0,y.useState)(!1),tt=(0,y.useRef)(null),Z=(0,y.useRef)(0),[nt,rt]=(0,y.useState)(0);(0,y.useEffect)(()=>{let e=tt.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(e=>{let t=e[0]?.contentRect.width??0;rt(e=>Math.abs(e-t)<1?e:t)});return t.observe(e),()=>t.disconnect()},[M]);let it=nt>0&&nt<400,[at,ot]=(0,y.useState)([]),[st,ct]=(0,y.useState)(!1),[lt,ut]=(0,y.useState)(null),[dt,ft]=(0,y.useState)(`whatsapp`),pt=(0,y.useCallback)(e=>{if(v(),!o){console.error(`[admin-ui] artefact-download-blocked id=${e.id} reason=no-cache-key`),V({message:`Session not ready — try again`,failed:!0});return}if(!e.downloadPath){console.error(`[admin-ui] artefact-download-blocked id=${e.id} reason=not-downloadable`),V({message:`${e.name} can’t be downloaded`,failed:!0});return}console.info(`[admin-ui] artefact-download id=${e.id} root=${e.downloadRoot??`data`} path=${e.downloadPath}`),ee(o,e.downloadPath,e.downloadRoot??`data`),V({message:`Downloading ${e.name}`,failed:!1})},[o,v]);(0,y.useEffect)(()=>{if(!B)return;let e=setTimeout(()=>V(null),2500);return()=>clearTimeout(e)},[B]);let mt=(0,y.useCallback)(async()=>{if(o){_e(!0),ge(null);try{let e=await k(`/api/admin/sidebar-artefacts`);if(!e.ok)throw Error(`status ${e.status}`);F((await e.json()).artefacts??[]),he(!0)}catch(e){let t=e instanceof Error?e.message:String(e);ge(`Failed to load artefacts: ${t}`),console.error(`[admin-ui] sidebar-artefacts fetch failed: ${t}`)}finally{_e(!1)}}},[o,k]),Q=(0,y.useCallback)(async()=>{if(!o)return null;let e=++Z.current;Oe(!0),Te(null);try{let t=await k(`/api/admin/sidebar-sessions`);if(!t.ok)throw Error(`status ${t.status}`);let n=await t.json(),r=n.sessions??[];return e===Z.current?(be(r),ze(n.accountId??null),Ce(!0),r):(console.info(`[admin-ui] sidebar-sessions-stale-response-dropped token=${e}`),r)}catch(t){let n=t instanceof Error?t.message:String(t);return e===Z.current&&Te(`Failed to load sessions: ${n}`),console.error(`[admin-ui] sidebar-sessions fetch failed: ${n}`),null}finally{e===Z.current&&Oe(!1)}},[o,k]),ht=(0,y.useCallback)(async()=>{if(o){ut(null);try{let e=await k(`/api/whatsapp-reader/conversations`);if(!e.ok)throw Error(`status ${e.status}`);ot((await e.json()).conversations??[]),ct(!0)}catch(e){let t=e instanceof Error?e.message:String(e);ut(`Couldn't load conversations.`),console.error(`[admin-ui] channel-convos fetch failed: ${t}`)}}},[o,k]);(0,y.useEffect)(()=>{!o||W||Q()},[o,W,Q]),(0,y.useEffect)(()=>{if(!o)return;let e=null;return ht(),e=setInterval(()=>{ht()},Pe),()=>{e!==null&&clearInterval(e)}},[o,ht]),(0,y.useEffect)(()=>{if(!o)return;let e=null;function t(){console.info(`[admin-ui] sidebar-refresh surface=sessions trigger=poll`),Q()}function n(){e===null&&(e=setInterval(t,Fe))}function r(){e!==null&&(clearInterval(e),e=null)}function i(){document.hidden?r():(t(),n())}return document.hidden||n(),document.addEventListener(`visibilitychange`,i),()=>{r(),document.removeEventListener(`visibilitychange`,i)}},[o,Q]);let gt=(0,y.useMemo)(()=>{let e=new Map;for(let t of Se)e.set(t,[]);for(let t of at)e.get(t.channel)?.push(t);for(let t of Se)console.info(`[admin-ui] sidebar-nav surface=${t} count=${e.get(t).length}`);return e},[at]),_t={whatsapp:`WhatsApp`,telegram:`Telegram`,webchat:`Webchat`},vt=()=>{S(null),N(`artefacts`),console.info(`[admin-ui] sidebar-nav surface=artefacts count=${I?P.length:0} collapsed=${x}`),mt()},$=1.5,yt=()=>{console.info(`[admin-ui] sidebar-refresh surface=artefacts`),mt()},bt=()=>{S(null),N(`sessions`),console.info(`[admin-ui] sidebar-nav surface=sessions count=${W?U.length:0} collapsed=${x}`),W||Q()},xt=()=>{console.info(`[admin-ui] sidebar-refresh surface=sessions trigger=manual`),Q()},St=e=>{N(`whatsapp`),ft(e),console.info(`[admin-ui] sidebar-nav surface=${e} count=${gt.get(e)?.length??0} collapsed=${x}`)},Ct=(0,y.useCallback)(async e=>{if(Ue.has(e.sessionId))return;We(t=>{let n=new Set(t);return n.add(e.sessionId),n});let t=window.open(``,`_blank`);try{let n=await k(`/api/admin/session-rc-spawn`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sessionId:e.sessionId,name:e.title||e.sessionId,...e.accountId?{targetAccountId:e.accountId}:{}})}),r=await n.json().catch(()=>({})),i=je(n.ok,n.status,{...r,sessionId:r.sessionId??e.sessionId});console.info(`[admin-ui] sidebar-session-resume sessionId=${e.sessionId} status=${n.status} outcome=${i.kind} slug=${r.slug??r.bridgeSessionId??`none`}`),i.kind===`navigate`?(v(),t?t.location.href=i.url:window.open(i.url,`_blank`)):(t?.close(),console.error(`[admin-ui] sidebar-session-resume-failed sessionId=${e.sessionId} status=${n.status} reason=${i.reason}`),H(i))}catch(n){t?.close();let r=n instanceof Error?n.message:String(n);console.error(`[admin-ui] sidebar-session-resume-failed sessionId=${e.sessionId} error=${r}`),H({sessionId:e.sessionId,reason:r})}finally{We(t=>{let n=new Set(t);return n.delete(e.sessionId),n})}},[k,v,Ue]),wt=(0,y.useCallback)(async e=>{let t=e.slice(0,8);for(let n=1;n<=Ae.length;n++){await new Promise(e=>setTimeout(e,Ae[n-1]));let r=await Q();if(r&&r.some(t=>t.sessionId===e)){console.info(`[admin-ui] sidebar-new-session-converged sessionId=${t} via=retry attempts=${n}`);return}}console.error(`[admin-ui] sidebar-new-session-converge-timeout sessionId=${t}`)},[Q]),Tt=(0,y.useCallback)(async()=>{if(!X){et(!0);try{let e=await k(`/api/admin/session-rc-spawn`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({})}),t=await e.json().catch(()=>({})),n=je(e.ok,e.status,t);console.info(`[admin-ui] sidebar-new-session-spawned status=${e.status} outcome=${n.kind} slug=${t.slug??t.bridgeSessionId??`none`}`),n.kind===`navigate`?n.sameOrigin?window.location.assign(n.url):(window.open(n.url,`_blank`),t.sessionId?wt(t.sessionId):console.error(`[admin-ui] sidebar-new-session-converge-skipped reason=no-session-id`)):(console.error(`[admin-ui] sidebar-new-session-failed status=${e.status} reason=${n.reason}`),H(n))}catch(e){let t=e instanceof Error?e.message:String(e);console.error(`[admin-ui] sidebar-new-session-failed error=${t}`),H({sessionId:null,reason:t})}finally{et(!1)}}},[k,X,wt]),Et=(0,y.useCallback)((e,t)=>{e.stopPropagation(),He(t)},[]),Dt=(0,y.useCallback)(async e=>{if(!Be.has(e.sessionId)){Ve(t=>{let n=new Set(t);return n.add(e.sessionId),n});try{let t=await k(`/api/admin/session-delete`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sessionId:e.sessionId})});if(!t.ok){let n=await t.json().catch(()=>({}));console.error(`[admin-ui] sidebar-session-delete-failed sessionId=${e.sessionId} status=${t.status} error=${n.error??`unknown`}`),V({message:`Delete failed: ${n.error??`status ${t.status}`}`,failed:!0});return}let n=await t.json();console.info(`[admin-ui] sidebar-session-delete sessionId=${e.sessionId} live=${e.live} confirmed=true pidKilled=${n.pidKilled??`?`} deleted=${n.deleted??`?`}`),be(t=>t.filter(t=>t.sessionId!==e.sessionId)),Q()}catch(t){let n=t instanceof Error?t.message:String(t);console.error(`[admin-ui] sidebar-session-delete-failed sessionId=${e.sessionId} error=${n}`),V({message:`Delete failed: ${n}`,failed:!0})}finally{Ve(t=>{let n=new Set(t);return n.delete(e.sessionId),n})}}},[k,Be,Q]),Ot=(0,y.useCallback)(async(e,t)=>{if(e.stopPropagation(),!Ge.has(t.sessionId)){Ke(e=>{let n=new Set(e);return n.add(t.sessionId),n});try{let e=await k(`/api/admin/session-stop`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sessionId:t.sessionId})});if(!e.ok){let n=await e.json().catch(()=>({}));console.error(`[admin-ui] sidebar-session-stop-failed sessionId=${t.sessionId} status=${e.status} error=${n.error??`unknown`}`),V({message:`Stop failed: ${n.error??`status ${e.status}`}`,failed:!0});return}console.info(`[admin-ui] sidebar-session-stop sessionId=${t.sessionId}`),Q()}catch(e){let n=e instanceof Error?e.message:String(e);console.error(`[admin-ui] sidebar-session-stop-failed sessionId=${t.sessionId} error=${n}`),V({message:`Stop failed: ${n}`,failed:!0})}finally{Ke(e=>{let n=new Set(e);return n.delete(t.sessionId),n})}}},[k,Ge,Q]),kt=(0,y.useCallback)(async(e,t,n)=>{if(e.stopPropagation(),!qe.has(t.sessionId)){Je(e=>{let n=new Set(e);return n.add(t.sessionId),n});try{let e=await k(`/api/admin/session-archive`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sessionId:t.sessionId,mode:n})});if(!e.ok){let r=await e.json().catch(()=>({})),i=r.detail??r.error??`status ${e.status}`;console.error(`[admin-ui] sidebar-session-archive-failed sessionId=${t.sessionId} mode=${n} status=${e.status} error=${r.error??`unknown`}`),V({message:`${n===`archive`?`Archive`:`Unarchive`} failed: ${i}`,failed:!0});return}console.info(`[admin-ui] sidebar-session-archive sessionId=${t.sessionId} mode=${n}`),Q()}catch(e){let r=e instanceof Error?e.message:String(e);console.error(`[admin-ui] sidebar-session-archive-failed sessionId=${t.sessionId} mode=${n} error=${r}`),V({message:`${n===`archive`?`Archive`:`Unarchive`} failed: ${r}`,failed:!0})}finally{Je(e=>{let n=new Set(e);return n.delete(t.sessionId),n})}}},[k,qe,Q]),At=(0,y.useCallback)(async e=>{let t=Ze.trim();if(!t){V({message:`Title can’t be empty`,failed:!0});return}if(t.length>ke){V({message:`Title too long (max ${ke})`,failed:!0});return}$e(!0);try{let n=await k(`/api/admin/session-rename`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sessionId:e.sessionId,title:t})});if(!n.ok){let t=await n.json().catch(()=>({})),r=t.reason??t.error??`status ${n.status}`;console.error(`[admin-ui] sidebar-session-rename sessionId=${e.sessionId.slice(0,8)} outcome=rejected reason=${r}`),V({message:`Rename failed: ${r}`,failed:!0});return}console.info(`[admin-ui] sidebar-session-rename sessionId=${e.sessionId.slice(0,8)} outcome=ok`),Xe(null),Y(``),Q()}catch(t){let n=t instanceof Error?t.message:String(t);console.error(`[admin-ui] sidebar-session-rename sessionId=${e.sessionId.slice(0,8)} outcome=rejected reason=${n}`),V({message:`Rename failed: ${n}`,failed:!0})}finally{$e(!1)}},[k,Ze,Q]);return(0,b.jsxs)(`aside`,{className:`side`,children:[(0,b.jsx)(`div`,{className:`side-new-session-row`,children:(0,b.jsxs)(`button`,{type:`button`,className:`side-new-session`,onClick:Tt,disabled:X,"aria-busy":X,children:[(0,b.jsx)(E,{size:14}),(0,b.jsx)(`span`,{children:X?`Spawning…`:`New session`})]})}),(0,b.jsxs)(`nav`,{className:`side-nav`,children:[(0,b.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=people`),te(),v()},children:[(0,b.jsx)(de,{size:20,strokeWidth:$}),(0,b.jsx)(`span`,{className:`label`,children:`People`}),(0,b.jsx)(`span`,{className:`kbd`})]}),(0,b.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=agents`),ie(),v()},children:[(0,b.jsx)(w,{size:20,strokeWidth:$}),(0,b.jsx)(`span`,{className:`label`,children:`Agents`}),(0,b.jsx)(`span`,{className:`kbd`})]}),(0,b.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=projects`),p(),v()},children:[(0,b.jsx)(se,{size:20,strokeWidth:$}),(0,b.jsx)(`span`,{className:`label`,children:n().term}),(0,b.jsx)(`span`,{className:`kbd`})]}),(0,b.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=tasks`),ne(),v()},children:[(0,b.jsx)(T,{size:20,strokeWidth:$}),(0,b.jsx)(`span`,{className:`label`,children:`Tasks`}),(0,b.jsx)(`span`,{className:`kbd`})]}),(0,b.jsxs)(`button`,{type:`button`,className:`nav-row${M===`artefacts`?` active`:``}`,onClick:vt,children:[(0,b.jsx)(t,{size:20,strokeWidth:$}),(0,b.jsx)(`span`,{className:`label`,children:`Artefacts`}),(0,b.jsx)(`span`,{className:`kbd`})]}),(0,b.jsxs)(`button`,{type:`button`,className:`nav-row${M===`sessions`?` active`:``}`,onClick:bt,children:[(0,b.jsx)(ce,{size:20,strokeWidth:$}),(0,b.jsx)(`span`,{className:`label`,children:`Sessions`}),(0,b.jsx)(`span`,{className:`kbd`})]}),st&&Se.filter(e=>gt.get(e).length>0).map(e=>(0,b.jsxs)(`button`,{type:`button`,className:`nav-row${M===`whatsapp`&&dt===e?` active`:``}`,onClick:()=>St(e),children:[(0,b.jsx)(m,{channel:e,size:16}),(0,b.jsx)(`span`,{className:`label`,children:_t[e]}),(0,b.jsx)(`span`,{className:`kbd`})]},e)),lt&&(0,b.jsx)(`div`,{className:`nav-row`,style:{color:`var(--text-tertiary)`,cursor:`default`},"aria-disabled":`true`,children:(0,b.jsx)(`span`,{className:`label`,children:lt})})]}),M===`artefacts`&&(0,b.jsxs)(`div`,{className:`side-list`,children:[(0,b.jsxs)(`div`,{className:`group-head`,children:[(0,b.jsx)(`span`,{children:`Artefacts`}),(0,b.jsxs)(`span`,{className:`group-head-meta`,children:[(0,b.jsx)(`button`,{type:`button`,className:`group-head-refresh`,title:`Refresh artefacts`,"aria-label":`Refresh artefacts`,onClick:yt,disabled:R,children:(0,b.jsx)(f,{size:12,className:R?`spinning`:void 0})}),(0,b.jsx)(`span`,{children:R?`…`:String(P.length)})]})]}),L&&(0,b.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:L}),I&&!L&&P.length>0&&(()=>{let e=P.filter(e=>e.kind===`agent-template`).length,t=P.length-e;return(0,b.jsx)(`div`,{className:`artefact-filter-chips`,children:[{key:`all`,label:`All`,count:P.length},{key:`agent`,label:`Agents`,count:e},{key:`file`,label:`Files`,count:t}].map(e=>(0,b.jsxs)(`button`,{type:`button`,className:`artefact-filter-chip${z===e.key?` active`:``}`,onClick:()=>ve(e.key),disabled:e.count===0&&e.key!==`all`,children:[e.label,(0,b.jsx)(`span`,{className:`artefact-filter-chip-count`,children:e.count})]},e.key))})})(),I&&!L&&P.length===0&&(0,b.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:`No artefacts yet`}),P.filter(e=>z===`all`?!0:z===`agent`?e.kind===`agent-template`:e.kind!==`agent-template`).map(e=>{let n=e.kind===`agent-template`,r=n?w:t,i=Me(e.updatedAt),a=e.downloadPath!==null;return(0,b.jsxs)(`button`,{type:`button`,className:`conv`,onClick:()=>pt(e),disabled:!a,style:a?void 0:{cursor:`default`},title:a?`Download ${e.name}`:`${e.name} can’t be downloaded`,children:[(0,b.jsx)(r,{size:14,className:`conv-icon`,"data-kind":n?`agent`:`file`,"aria-label":n?`agent template`:`file`}),(0,b.jsxs)(`span`,{className:`conv-stack`,children:[(0,b.jsx)(`span`,{className:`conv-name-line`,children:(0,b.jsx)(`span`,{className:`conv-name`,children:e.name})}),i&&(0,b.jsx)(`span`,{className:`conv-timestamp`,children:i})]}),a&&(0,b.jsx)(u,{size:12,className:`conv-rc-icon`,"aria-hidden":`true`})]},e.id)})]}),M===`sessions`&&(()=>{let e=U.filter(e=>K?!0:!e.isSubagent).filter(e=>q?!0:!e.archived),t=U.some(e=>e.isSubagent),n=U.some(e=>e.archived);return(0,b.jsxs)(`div`,{className:`side-list`,ref:tt,children:[(0,b.jsxs)(`div`,{className:`group-head`,children:[(0,b.jsx)(`span`,{children:`Sessions`}),(0,b.jsxs)(`span`,{className:`group-head-meta`,children:[(0,b.jsx)(`button`,{type:`button`,className:`group-head-refresh`,title:`Refresh sessions`,"aria-label":`Refresh sessions`,onClick:xt,disabled:De,children:(0,b.jsx)(f,{size:12,className:De?`spinning`:void 0})}),(0,b.jsx)(`span`,{children:De?`…`:String(e.length)})]})]}),Re&&(0,b.jsx)(`div`,{className:`side-account-id`,title:`This install's accountId. The first 8 characters match the truncated UUID label on the live Remote Control daemon entry in claude.ai/code.`,children:(0,b.jsx)(`code`,{children:Re})}),(t||n)&&(0,b.jsxs)(`div`,{className:`artefact-filter-chips`,children:[t&&(0,b.jsx)(`button`,{type:`button`,className:`artefact-filter-chip${K?` active`:``}`,"aria-pressed":K,onClick:()=>Ne(e=>!e),title:K?`Hide subagent sessions`:`Show subagent sessions`,children:`Subagents`}),n&&(0,b.jsx)(`button`,{type:`button`,className:`artefact-filter-chip${q?` active`:``}`,"aria-pressed":q,onClick:()=>Le(e=>!e),title:q?`Hide archived sessions`:`Show archived sessions`,children:`Archived`})]}),G&&(0,b.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:G}),W&&!G&&e.length===0&&(0,b.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:`No sessions yet`}),e.map(e=>{let t=Me(e.startedAt),n=Ue.has(e.sessionId),a=Be.has(e.sessionId),o=Ge.has(e.sessionId),s=qe.has(e.sessionId),c=n||a||o||s,l=[{key:`open`,label:`Resume session ${e.title} in claude.ai/code`,menuLabel:`Resume in claude.ai/code`,title:`Resume in a fresh local Remote Control PTY`,icon:(0,b.jsx)(g,{size:12}),busy:n,onClick:()=>{Ct(e)}},{key:`message`,label:`Open session ${e.title} in admin webchat`,menuLabel:`Open in webchat`,title:`Open in admin webchat (/chat) — sending resumes this session`,icon:(0,b.jsx)(le,{size:12}),onClick:()=>{window.location.assign(`/chat?session=${e.sessionId}`)}},...e.live?[{key:`stop`,label:`Stop session ${e.title}`,menuLabel:`Stop`,title:`Stop session process (keeps the conversation, can resume later)`,icon:(0,b.jsx)(ue,{size:12}),busy:o,onClick:t=>{Ot(t,e)}}]:[],e.archived?{key:`unarchive`,label:`Unarchive session ${e.title}`,menuLabel:`Unarchive`,title:`Unarchive (move back to the active list)`,icon:(0,b.jsx)(oe,{size:12}),busy:s,onClick:t=>{kt(t,e,`unarchive`)}}:{key:`archive`,label:`Archive session ${e.title}`,menuLabel:`Archive`,title:`Archive (hide from the list, keeps the conversation resumable)`,icon:(0,b.jsx)(C,{size:12}),busy:s,onClick:t=>{kt(t,e,`archive`)}},{key:`rename`,label:`Rename session ${e.title}`,menuLabel:`Rename`,title:`Rename this session`,icon:(0,b.jsx)(i,{size:12}),busy:Qe&&Ye===e.sessionId,onClick:t=>{t.stopPropagation(),Xe(e.sessionId),Y(e.personName??e.title)}},{key:`delete`,label:`Delete session ${e.title}`,menuLabel:`Delete`,title:`Delete session (stops the process, removes the conversation)`,icon:(0,b.jsx)(r,{size:12}),danger:!0,busy:a,onClick:t=>{Et(t,e)}},A({sessionId:e.sessionId,model:e.model??null,title:e.personName??e.title})];return(0,b.jsxs)(`div`,{className:`conv conv-with-actions`,children:[(0,b.jsxs)(`div`,{className:`conv-main-static`,children:[(0,b.jsx)(`span`,{className:`conv-live-dot`,"data-live":e.live?`1`:`0`,"aria-label":e.live?`live session`:`ended session`}),(0,b.jsxs)(`span`,{className:`conv-stack`,children:[(0,b.jsxs)(`span`,{className:`conv-name-line`,children:[e.channel&&(0,b.jsx)(re,{channel:e.channel,size:13}),Ye===e.sessionId?(0,b.jsx)(`input`,{className:`conv-name conv-name-edit`,autoFocus:!0,value:Ze,disabled:Qe,"aria-label":`New title for session ${e.title}`,onChange:e=>Y(e.target.value),onClick:e=>e.stopPropagation(),onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),At(e)):t.key===`Escape`&&(t.preventDefault(),Xe(null),Y(``))},onBlur:()=>{Ye===e.sessionId&&!Qe&&(Xe(null),Y(``))}}):(0,b.jsx)(`span`,{className:`conv-name`,title:e.personName??e.title,children:e.personName??e.title})]}),(0,b.jsxs)(`span`,{className:`conv-timestamp`,children:[(0,b.jsx)(`code`,{className:`conv-session-id`,title:`First 8 characters of this session's id — distinguishes rows with identical auto-titles. The resume/delete buttons act on the full id.`,children:e.sessionId.slice(0,8)}),t&&(0,b.jsxs)(`span`,{children:[` · `,t]})]})]})]}),(0,b.jsx)(me,{actions:l,disabled:c,collapsed:it})]},e.sessionId)})]})})(),M===`whatsapp`&&(0,b.jsxs)(`div`,{className:`side-list`,children:[(0,b.jsxs)(`div`,{className:`group-head`,children:[(0,b.jsx)(`span`,{children:_t[dt]}),(0,b.jsxs)(`span`,{className:`group-head-meta`,children:[(0,b.jsx)(`button`,{type:`button`,className:`group-head-refresh`,title:`Refresh conversations`,"aria-label":`Refresh conversations`,onClick:()=>{ht()},children:(0,b.jsx)(f,{size:12})}),(0,b.jsx)(`span`,{children:String(gt.get(dt).length)})]})]}),gt.get(dt).map(e=>{let t=Me(e.lastMessageAt);return(0,b.jsxs)(`div`,{className:`conv conv-with-actions${ae===e.sessionId?` active`:``}`,children:[(0,b.jsxs)(`button`,{type:`button`,className:`conv-main-static conv-main-btn`,onClick:()=>{S(e),v()},title:e.title,children:[(0,b.jsx)(m,{channel:e.channel,size:14}),(0,b.jsxs)(`span`,{className:`conv-stack`,children:[(0,b.jsxs)(`span`,{className:`conv-name-line`,children:[(0,b.jsx)(`span`,{className:`conv-name`,children:h(e)}),e.role===`public`&&(0,b.jsx)(`span`,{className:`conv-tag conv-tag-public`,children:`Public`})]}),t&&(0,b.jsx)(`span`,{className:`conv-timestamp`,children:t})]})]}),(0,b.jsx)(me,{actions:[A({sessionId:e.sessionId,model:e.model,title:e.title})],disabled:!1,collapsed:it})]},e.sessionId)})]}),(0,b.jsx)(Ie,{}),(0,b.jsxs)(`div`,{className:`side-foot`,children:[(0,b.jsx)(`div`,{className:`avatar`,children:d?(0,b.jsx)(`img`,{src:d,alt:pe}):j}),(0,b.jsxs)(`div`,{className:`who`,children:[(0,b.jsx)(`span`,{className:`name`,children:pe}),(0,b.jsx)(`span`,{className:`role`,children:s??`operator`})]})]}),B&&(0,b.jsx)(`div`,{className:`copy-toast${B.failed?` copy-toast-failed`:``}`,role:`status`,children:B.message}),(0,b.jsx)(Ee,{error:ye,onClose:()=>H(null)}),(0,b.jsx)(we,{target:J,onCancel:()=>He(null),onConfirm:()=>{let e=J;He(null),e&&Dt(e)}})]})}var Ne=5e3,Pe=3e4,Fe=3e4;function Ie(){let[e,t]=(0,y.useState)(null);if((0,y.useEffect)(()=>{let e=!1,n=null;async function r(){try{let n=await fetch(`/api/admin/system-stats`);if(!n.ok){console.error(`[admin-ui] system-stats-fetch-failed status=${n.status}`);return}let r=await n.json();e||t(r)}catch(e){console.error(`[admin-ui] system-stats-fetch-failed reason=${e instanceof Error?e.message:String(e)}`)}}function i(){n===null&&(r(),n=setInterval(()=>{r()},Ne))}function a(){n!==null&&(clearInterval(n),n=null)}function o(){document.hidden?a():i()}return document.hidden||i(),document.addEventListener(`visibilitychange`,o),()=>{e=!0,a(),document.removeEventListener(`visibilitychange`,o)}},[]),!e||e.platform===`darwin`)return null;let n=e.cpuPct,r=e.memUsedPct,i=n!==null&&n>=.9,a=n!==null&&n>=.98,o=r!==null&&r>=.9,s=r!==null&&r>=.98,c=i||o,l=a||s,u=e=>e===null?`—`:`${Math.round(e*100)}%`,d=e=>{if(e===null)return{width:`0%`,background:`var(--text-tertiary)`};let t=Math.min(1,Math.max(0,e)),n=Math.round(140*(1-t));return{width:`${Math.round(t*100)}%`,background:`hsl(${n}, 65%, 45%)`}},f=[`system-stats`];return c&&f.push(`system-stats--warn`),l&&f.push(`system-stats--crit`),(0,b.jsxs)(`div`,{className:f.join(` `),role:`status`,"aria-label":`host CPU and RAM`,children:[(0,b.jsxs)(`div`,{className:`system-stats__metric`,children:[(0,b.jsxs)(`span`,{className:i?`system-stats__fig system-stats__fig--warn`:`system-stats__fig`,children:[`CPU `,u(n)]}),(0,b.jsx)(`div`,{className:`system-stats__bar`,children:(0,b.jsx)(`div`,{className:`system-stats__bar-fill`,style:d(n)})})]}),(0,b.jsxs)(`div`,{className:`system-stats__metric`,children:[(0,b.jsxs)(`span`,{className:o?`system-stats__fig system-stats__fig--warn`:`system-stats__fig`,children:[`RAM `,u(r)]}),(0,b.jsx)(`div`,{className:`system-stats__bar`,children:(0,b.jsx)(`div`,{className:`system-stats__bar-fill`,style:d(r)})})]})]})}var q=`admin-sidebar-collapsed`,Le=`admin-sidebar-drawer-open`;function Re(){if(typeof window>`u`)return!1;try{return window.sessionStorage.getItem(q)===`1`}catch{return!1}}function ze(e){if(!(typeof window>`u`))try{e?window.sessionStorage.setItem(q,`1`):window.sessionStorage.removeItem(q)}catch{}}function Be(){if(typeof window>`u`)return!1;try{return window.sessionStorage.getItem(Le)===`1`}catch{return!1}}function Ve(e){if(!(typeof window>`u`))try{e?window.sessionStorage.setItem(Le,`1`):window.sessionStorage.removeItem(Le)}catch{}}var J=720;function He(e,t){return e===`/`?{via:`in-place`}:{via:`navigate`,href:`/?wa=${encodeURIComponent(t.sessionId)}&projectDir=${encodeURIComponent(t.projectDir)}`}}function Ue(e,t){if(e!==`/`)return null;let n=new URLSearchParams(t),r=n.get(`wa`),i=n.get(`projectDir`);return!r||!i?null:{sessionId:r,projectDir:i,title:``,senderId:null,startedAt:``,channel:`whatsapp`,role:`admin`,operatorName:null,whatsappName:null,lastMessageAt:null,modelGated:!1,model:null,rowType:`session`}}function We(e,t){return t===`operator`&&e===`chat`||e===`dashboard`?`/`:e===`data`?`/data`:e===`graph`?`/graph`:e===`calendar`?`/calendar`:e===`chat`?`/chat`:`/browser`}function Ge(e){let{cacheKey:t,businessName:r,conversationLabel:i,variant:a=`admin`,onLogout:o,onDisconnect:s,disconnecting:c,userName:l,userAvatar:u,role:d,onOpenConversations:f,children:p,footer:m}=e,{subAccounts:h,activeAccountId:g,switching:ee,switchAccount:re}=ne(t),[_,v]=(0,y.useState)(()=>Re()),[x,ae]=(0,y.useState)(()=>Be()),[S,oe]=(0,y.useState)(()=>typeof window<`u`&&window.matchMedia(`(max-width: ${J}px)`).matches),[C,w]=(0,y.useState)(()=>typeof window>`u`?null:Ue(window.location.pathname,window.location.search)),[se]=(0,y.useState)(()=>C!==null);(0,y.useEffect)(()=>{if(typeof window>`u`)return;let e=window.matchMedia(`(max-width: ${J}px)`),t=e=>oe(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let ce=(0,y.useCallback)(e=>{ze(e),v(e)},[]),T=(0,y.useCallback)(e=>{Ve(e),ae(e)},[]);(0,y.useEffect)(()=>{if(typeof window>`u`)return;let e=window.location?.pathname??``;console.info(`[admin-ui] shell-mount route=${e} variant=${a} sidebar=${a===`operator`?`none`:`present`} collapsed=${_} drawer=${x}`)},[]),(0,y.useEffect)(()=>{typeof window>`u`||!C||(console.info(`[admin-ui] wa-hydrate route=/ sessionId=${C.sessionId.slice(0,8)}`),window.history.replaceState(null,``,`/`))},[]);let le=(0,y.useCallback)(e=>{if(e===null){w(null);return}let t=typeof window<`u`?window.location.pathname:`/`,n=He(t,e);console.info(`[admin-ui] wa-open route=${t} via=${n.via} sessionId=${e.sessionId.slice(0,8)}`),n.via===`in-place`?w(e):window.location.href=n.href},[]),E=S?x:!_,D=(0,y.useCallback)(()=>{if(!(typeof window>`u`))if(window.matchMedia(`(max-width: ${J}px)`).matches){let e=x;console.info(`[admin-ui] header-sidebar-toggle from=${e?`open`:`closed`} mode=drawer`),T(!e)}else{let e=_;console.info(`[admin-ui] header-sidebar-toggle from=${e?`closed`:`open`} mode=collapse`),ce(!e)}},[_,x,ce,T]),ue=(0,y.useCallback)(e=>{let t=We(e,a);console.info(`[admin-ui] header-menu-nav target=${e} dest=${t}`),window.location.href=t},[a]),[de,O]=(0,y.useState)(`chat`),[k,A]=(0,y.useState)([]);(0,y.useEffect)(()=>{if(a!==`operator`||!t)return;let e=!1;return fetch(`/api/whatsapp-reader/conversations?session_key=${encodeURIComponent(t)}&includePersistedOnly=1`).then(e=>e.ok?e.json():{conversations:[]}).then(t=>{e||A(t.conversations??[])}).catch(()=>{}),()=>{e=!0}},[a,t]);let fe=(0,y.useMemo)(()=>[...new Set(k.map(e=>e.channel))],[k]),j={collapsed:_,mobileDrawerOpen:x,sidebarOpen:E,onToggleSidebar:D,setMobileDrawerOpen:T,selectedWhatsapp:C,onClearWhatsapp:()=>w(null)};return a===`operator`?(0,b.jsxs)(`div`,{className:`admin-shell admin-page admin-shell-root`,children:[(0,b.jsx)(ie,{businessName:r,conversationLabel:i,variant:a,onNavigate:ue,conversationsCount:k.length,conversationsChannels:fe,onOpenConversations:()=>O(`conversations`),onToggleSidebar:D,sidebarOpen:E,onLogout:o,onDisconnect:s,disconnecting:c,cacheKey:t}),(0,b.jsx)(`div`,{className:`platform platform-operator`,children:de===`conversations`?(0,b.jsx)(te,{conversations:k,sessionKey:t??``,onBack:()=>O(`chat`)}):typeof p==`function`?p(j):p}),m]}):(0,b.jsxs)(`div`,{className:`admin-shell admin-page admin-shell-root`,children:[(0,b.jsx)(ie,{businessName:r,conversationLabel:i,variant:a,onNavigate:ue,onOpenConversations:f,onToggleSidebar:D,sidebarOpen:E,onLogout:o,onDisconnect:s,disconnecting:c,cacheKey:t,subAccounts:h,activeAccountId:g,switchingAccount:ee,onSwitchAccount:re}),(0,b.jsxs)(`div`,{className:`platform${x?` menu-open`:``}${_?` sidebar-collapsed`:``}`,"data-artefact":`closed`,children:[(0,b.jsx)(K,{businessName:r,cacheKey:t,role:d??null,userName:l,userAvatar:u??null,onSelectProjects:()=>{window.location.href=`/graph?label=${n().label}`},onSelectPeople:()=>{window.location.href=`/graph?label=Person`},onSelectTasks:()=>{window.location.href=`/graph?label=Task`},onSelectAgents:()=>{window.location.href=`/graph?label=Agent`},onCloseMobileDrawer:()=>T(!1),collapsed:_,mobileDrawerOpen:x,selectedWhatsappId:C?.sessionId??null,onSelectWhatsappConversation:le,initialWhatsappSurface:se}),!S&&(0,b.jsx)(pe,{}),typeof p==`function`?p(j):p]}),x&&(0,b.jsx)(`div`,{className:`sidebar-backdrop menu-open`,"aria-hidden":`true`,onClick:()=>T(!1)}),m]})}export{oe as _,I as a,_e as c,ue as d,D as f,C as g,w as h,G as i,L as l,T as m,je as n,P as o,E as p,De as r,F as s,Ge as t,de as u,S as v,v as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{V as e,W as t}from"./useSubAccountSwitcher-z8xhukFw.js";import"./admin-types-DJoj6VJv.js";import"./AdminShell-DvczcTdp.js";import{n}from"./page-BSMtFFmx.js";var r=t(),i=e();(0,r.createRoot)(document.getElementById(`root`)).render((0,i.jsx)(n,{}));
|
|
File without changes
|