@rubytech/create-maxy 1.0.639 → 1.0.640
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 +2 -2
- package/payload/platform/plugins/memory/PLUGIN.md +2 -2
- package/payload/platform/plugins/memory/mcp/dist/index.js +3 -3
- package/payload/platform/plugins/memory/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/graph-prune.d.ts +14 -10
- package/payload/platform/plugins/memory/mcp/dist/lib/graph-prune.d.ts.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/graph-prune.js +27 -58
- package/payload/platform/plugins/memory/mcp/dist/lib/graph-prune.js.map +1 -1
- package/payload/platform/plugins/memory/references/graph-primitives.md +10 -11
- package/payload/server/{chunk-LM5BMENF.js → chunk-B54KBAK4.js} +0 -5
- package/payload/server/package.json +2 -1
- package/payload/server/public/assets/{admin-Cscyi34W.js → admin-jpGCzN83.js} +1 -1
- package/payload/server/public/index.html +1 -1
- package/payload/server/server.js +2148 -15069
- package/payload/server/upgrade-progress-server.js +1 -1
- package/payload/server/index.js +0 -7225
|
@@ -7,10 +7,6 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
7
7
|
var __commonJS = (cb, mod) => function __require() {
|
|
8
8
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
9
|
};
|
|
10
|
-
var __export = (target, all) => {
|
|
11
|
-
for (var name in all)
|
|
12
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
13
|
-
};
|
|
14
10
|
var __copyProps = (to, from, except, desc) => {
|
|
15
11
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
12
|
for (let key of __getOwnPropNames(from))
|
|
@@ -71,7 +67,6 @@ function readProgressLog(path) {
|
|
|
71
67
|
|
|
72
68
|
export {
|
|
73
69
|
__commonJS,
|
|
74
|
-
__export,
|
|
75
70
|
__toESM,
|
|
76
71
|
readProgressLog
|
|
77
72
|
};
|
|
@@ -349,4 +349,4 @@ ${JSON.stringify(u.input,null,2)}`,f=le.get(r),p=o?void 0:f??t;return(0,z.jsx)(s
|
|
|
349
349
|
|
|
350
350
|
---
|
|
351
351
|
|
|
352
|
-
`)}function pE(e){let{selectionMode:t,selectedItems:r,copyToast:o,exitSelection:c,enterSelection:l,copySelected:u,showCopyToast:m,input:h,setInput:g,inputRef:_,pendingFiles:v,setPendingFiles:y,isDragOver:b,attachError:x,fileInputRef:S,addFiles:C,removeFile:w,onDragOver:k,onDragLeave:A,onDrop:M,isStreaming:N,wasPaused:te,messages:re,messageQueueRef:P,setQueue:ie,sendMessage:ae,stopStreaming:oe,disconnecting:se,handleDisconnect:ce,claudeInfo:le,setClaudeInfo:de,setShowClaudeInfo:fe,conversationId:F}=e,[pe,I]=(0,R.useState)(!1),me=(0,R.useRef)(null),[L,he]=(0,R.useState)(!1),ge=(0,R.useRef)(null),_e=(0,R.useRef)(!1),ve=ne(),ye=ve.state===`recording`||ve.state===`paused`||ve.state===`sending`,be=!ye&&!te&&!h.trim()&&v.length===0;async function xe(){let e=await ve.send();if(!e)return;let t=e.type===`audio/ogg`?`.ogg`:e.type===`audio/mp4`?`.m4a`:`.webm`,n=new File([e],`voice-note${t}`,{type:e.type});if(N){ie([...P.current,{text:`[Voice note]`,files:[n],timestamp:Date.now()}]);return}ae(`[Voice note]`,[n])}return(0,R.useEffect)(()=>{t||he(!1)},[t]),(0,R.useEffect)(()=>{if(!L)return;let e=e=>{e.target.closest(`.selection-copy-wrap`)||he(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[L]),(0,R.useEffect)(()=>{if(!pe)return;let e=e=>{if(e.key===`Escape`){I(!1);return}if(e.key===`Tab`&&me.current){let t=me.current.querySelectorAll(`.actions-menu-items button:not([disabled])`);if(t.length===0)return;let n=t[0],r=t[t.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n.focus())}},t=e=>{me.current&&!me.current.contains(e.target)&&I(!1)};return document.addEventListener(`keydown`,e),document.addEventListener(`mousedown`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`mousedown`,t)}},[pe]),t?(0,z.jsx)(`div`,{className:`chat-input-area`,children:(0,z.jsxs)(`div`,{className:`selection-bar`,children:[(0,z.jsxs)(`span`,{className:`selection-count`,children:[r.size,` Selected`]}),(0,z.jsxs)(`div`,{className:`selection-copy-wrap`,children:[(0,z.jsxs)(`button`,{type:`button`,className:`selection-copy`,onPointerDown:()=>{if(L){he(!1);return}_e.current=!1,ge.current=setTimeout(()=>{_e.current=!0,he(!0),ge.current=null},500)},onPointerUp:()=>{ge.current!==null&&(clearTimeout(ge.current),ge.current=null)},onPointerLeave:()=>{ge.current!==null&&(clearTimeout(ge.current),ge.current=null)},onPointerCancel:()=>{ge.current!==null&&(clearTimeout(ge.current),ge.current=null)},onClick:async()=>{_e.current||await u(e=>dE(re,e),(e,t)=>{let[n,r]=[e.slice(0,e.lastIndexOf(`_`)),e.slice(e.lastIndexOf(`_`)+1)],[i,a]=[t.slice(0,t.lastIndexOf(`_`)),t.slice(t.lastIndexOf(`_`)+1)],o=parseInt(n,10)-parseInt(i,10);return o===0?r===`admin`?-1:a===`admin`?1:parseInt(r,10)-parseInt(a,10):o})},children:[(0,z.jsx)(s,{size:18}),(0,z.jsx)(`span`,{children:`Copy`})]}),L&&(0,z.jsx)(`div`,{className:`copy-menu`,children:[[`all`,`All events`],[`text`,`Text messages only`],[`non-text`,`Non-text only`]].map(([e,t])=>(0,z.jsx)(`button`,{type:`button`,className:`copy-menu-item`,onClick:async()=>{let t=fE(re,e);t&&m(await i(t)),c()},children:t},e))})]}),(0,z.jsx)(`button`,{type:`button`,className:`selection-cancel`,onClick:c,children:`Cancel`})]})}):(0,z.jsxs)(`div`,{className:`chat-input-area`,children:[(0,z.jsx)(`input`,{ref:S,type:`file`,multiple:!0,accept:ft,style:{display:`none`},onChange:e=>{e.target.files&&C([...e.target.files]),e.target.value=``}}),v.length>0&&(0,z.jsx)(`div`,{className:`attachment-strip`,children:v.map((e,t)=>(0,z.jsxs)(`div`,{className:`attachment-chip`,children:[e.type.startsWith(`image/`)?(0,z.jsx)(`img`,{src:URL.createObjectURL(e),alt:e.name,className:`attachment-chip-thumb`}):e.type===`application/pdf`?(0,z.jsx)(d,{size:14}):(0,z.jsx)(p,{size:14}),(0,z.jsx)(`span`,{className:`attachment-chip-name`,children:e.name}),(0,z.jsx)(`button`,{type:`button`,className:`attachment-chip-remove`,onClick:()=>w(t),"aria-label":`Remove ${e.name}`,children:`×`})]},t))}),x&&(0,z.jsx)(`p`,{className:`attach-error`,children:x}),ve.state===`error`&&ve.errorMessage&&(0,z.jsxs)(`p`,{className:`voice-error`,role:`alert`,children:[(0,z.jsx)(D,{size:14}),ve.errorMessage]}),(0,z.jsx)(E,{inputRef:_}),ye?(0,z.jsx)(`div`,{className:`chat-form voice-active`,children:(0,z.jsx)(j,{state:ve.state,elapsedSeconds:ve.elapsedSeconds,waveform:ve.waveform,onTogglePause:ve.togglePause,onDiscard:ve.discard,onSend:xe})}):(0,z.jsxs)(`form`,{className:`chat-form${b?` drag-over`:``}`,onSubmit:e=>{e.preventDefault();let t=h.trim()||(te?`continue`:``);if(!(!t&&v.length===0)){if(N){ie([...P.current,{text:t,files:[...v],timestamp:Date.now()}]),g(``),y([]),_.current?.resetHeight();return}ae(t),_.current?.resetHeight()}},onDragOver:k,onDragLeave:A,onDrop:M,onPaste:e=>{let t=e.clipboardData?.items;if(!t)return;let n=[];for(let e of t){if(e.kind!==`file`)continue;let t=e.getAsFile();if(!t)continue;let r=t.type.split(`/`)[1]?.replace(`jpeg`,`jpg`)||`png`;n.push(new File([t],`pasted-image-${Date.now()}.${r}`,{type:t.type}))}n.length>0&&C(n)},children:[(0,z.jsx)(T,{variant:`icon`,type:`button`,onClick:()=>S.current?.click(),"aria-label":`Attach file`,children:(0,z.jsx)(n,{size:14})}),(0,z.jsx)(ee,{ref:_,value:h,onChange:g}),N?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(T,{variant:`send`,type:`button`,onClick:()=>oe(!0),"aria-label":`Pause`,style:{background:`var(--text-secondary)`},children:(0,z.jsx)(O,{size:14})}),(0,z.jsx)(T,{variant:`send`,type:`button`,onClick:()=>oe(!1),"aria-label":`Stop`,style:{background:`var(--danger)`},children:(0,z.jsx)(et,{size:14})})]}):be?(0,z.jsx)(T,{variant:`send`,type:`button`,onClick:ve.start,"aria-label":`Record voice note`,children:(0,z.jsx)(D,{size:14})}):(0,z.jsx)(T,{variant:`send`,type:`submit`,disabled:!h.trim()&&v.length===0&&!te,"aria-label":`Send message`,children:te?(0,z.jsx)(f,{size:14}):(0,z.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,z.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`}),(0,z.jsx)(`polyline`,{points:`12 5 19 12 12 19`})]})})]}),(0,z.jsxs)(`div`,{className:`chat-actions`,ref:me,children:[(0,z.jsx)(`button`,{className:`burger-trigger`,onClick:()=>I(e=>!e),"aria-expanded":pe,"aria-haspopup":`true`,"aria-label":`Actions menu`,children:(0,z.jsx)(Be,{size:16})}),(0,z.jsxs)(`div`,{className:`actions-menu-items${pe?` actions-menu-open`:``}`,children:[(0,z.jsxs)(`button`,{className:`chat-action`,disabled:se,onClick:async()=>{I(!1),await ce()},children:[se?(0,z.jsx)(Ie,{size:14,className:`animate-spin`}):(0,z.jsx)(ue,{size:14}),(0,z.jsx)(`span`,{className:`action-label`,children:se?`Disconnecting...`:`Disconnect Claude`})]}),(0,z.jsxs)(`button`,{className:`chat-action`,disabled:!F,onClick:()=>{if(I(!1),!F){console.debug(`[stream-log-button] disabled reason=no-conversation-id`);return}let e=document.createElement(`a`);e.href=`/api/admin/logs?type=stream&conversationId=${encodeURIComponent(F)}&download=1`,e.click()},title:F?`Download stream log`:`No conversation active — start a message to create a stream log`,children:[(0,z.jsx)(Ye,{size:14}),(0,z.jsx)(`span`,{className:`action-label`,children:`Stream log`})]}),(0,z.jsxs)(`button`,{className:`chat-action`,onClick:()=>{I(!1),l()},title:`Select messages`,children:[(0,z.jsx)(a,{size:14}),(0,z.jsx)(`span`,{className:`action-label`,children:`Select`})]})]}),(0,z.jsxs)(`div`,{className:`powered-by`,onClick:async()=>{if(fe(!0),!le){let e=await fetch(`/api/admin/claude-info`);e.ok&&de(await e.json())}},children:[(0,z.jsx)(`img`,{src:`/brand/claude.png`,alt:`Claude`,className:`powered-by-icon`}),(0,z.jsx)(`span`,{children:`Powered by Claude Code`})]})]})]})}function mE(e){let{show:t,onClose:n,conversationsLoading:r,conversationsError:i,conversationsList:a,setConversationsList:s,sessionKey:c,isStreaming:u,resetConversation:d,setMessages:p,setConversationId:m}=e,[h,g]=(0,R.useState)(null),[_,v]=(0,R.useState)(null),[y,b]=(0,R.useState)(``),[x,S]=(0,R.useState)(!1),C=(0,R.useRef)(null);(0,R.useEffect)(()=>{t||(g(null),v(null),b(``),S(!1))},[t]),(0,R.useEffect)(()=>{_?.phase===`editing`&&(C.current?.focus(),C.current?.select())},[_]);function w(){g(null),v(null),b(``),S(!1)}async function T(e){if(c){w(),g(e),v({phase:`loading`});try{let t=await fetch(`/api/admin/sessions/${encodeURIComponent(e)}/label?session_key=${encodeURIComponent(c)}`,{method:`POST`});if(!t.ok){v({phase:`error`,reason:(await t.json().catch(()=>({}))).error||`Request failed`});return}let n=await t.json();n.label?(v({phase:`editing`}),b(n.label)):v({phase:`error`,reason:`Not enough message content to suggest a name`})}catch(e){console.error(`[admin-modal] label suggestion failed:`,e),v({phase:`error`,reason:e instanceof Error?e.message:String(e)})}}}async function E(e){if(!(!c||!y.trim()||x)){S(!0);try{let t=await fetch(`/api/admin/sessions/${encodeURIComponent(e)}/label`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({label:y.trim(),session_key:c})});if(!t.ok){v({phase:`error`,reason:(await t.json().catch(()=>({}))).error||`Rename failed`}),S(!1);return}s(t=>t.map(t=>t.conversationId===e?{...t,name:y.trim()}:t)),w()}catch(e){console.error(`[admin-modal] label rename failed:`,e),v({phase:`error`,reason:e instanceof Error?e.message:String(e)}),S(!1)}}}return t?(0,z.jsx)(`div`,{className:`claude-info-overlay`,onClick:n,children:(0,z.jsxs)(`div`,{className:`claude-info-modal conversations-modal`,onClick:e=>e.stopPropagation(),children:[(0,z.jsxs)(`div`,{className:`claude-info-header`,children:[(0,z.jsx)(Fe,{size:12}),`Conversations`,(0,z.jsx)(`button`,{className:`claude-info-close`,onClick:n,children:`✕`})]}),(0,z.jsxs)(`div`,{className:`conversations-list`,children:[r&&(0,z.jsxs)(`div`,{className:`conversations-empty`,children:[(0,z.jsx)(Ie,{size:14,className:`spin`}),` Loading…`]}),i&&(0,z.jsx)(`div`,{className:`conversations-empty conversations-error`,children:i}),!r&&!i&&a.length===0&&(0,z.jsx)(`div`,{className:`conversations-empty`,children:`No recent conversations`}),!r&&!i&&a.map(e=>{let t=h===e.conversationId,r=t&&_?.phase===`loading`,i=t&&_?.phase===`editing`,a=t&&_?.phase===`error`;return(0,z.jsxs)(`div`,{className:`conversations-row`,children:[(0,z.jsxs)(`div`,{className:`conversations-row-info`,children:[r&&(0,z.jsxs)(`span`,{className:`conversations-row-name conversations-edit-loading`,children:[(0,z.jsx)(Ie,{size:12,className:`spin`}),` Generating suggestion…`]}),i&&(0,z.jsxs)(`div`,{className:`conversations-edit-inline`,children:[(0,z.jsx)(`input`,{ref:C,type:`text`,className:`conversations-edit-input`,value:y,onChange:e=>b(e.target.value),onKeyDown:t=>{t.key===`Enter`&&y.trim()&&E(e.conversationId),t.key===`Escape`&&w()},maxLength:200}),(0,z.jsx)(`button`,{type:`button`,className:`conversations-action conversations-confirm`,title:`Confirm rename`,disabled:!y.trim()||x,onClick:()=>E(e.conversationId),children:x?(0,z.jsx)(Ie,{size:13,className:`spin`}):(0,z.jsx)(l,{size:13})}),(0,z.jsx)(`button`,{type:`button`,className:`conversations-action conversations-cancel`,title:`Cancel`,onClick:w,children:(0,z.jsx)(at,{size:13})})]}),a&&(0,z.jsxs)(`div`,{className:`conversations-edit-inline`,children:[(0,z.jsx)(`span`,{className:`conversations-edit-error`,children:_.reason}),(0,z.jsx)(`button`,{type:`button`,className:`conversations-action conversations-retry`,title:`Retry`,onClick:()=>T(e.conversationId),children:(0,z.jsx)(Je,{size:13})}),(0,z.jsx)(`button`,{type:`button`,className:`conversations-action conversations-cancel`,title:`Cancel`,onClick:w,children:(0,z.jsx)(at,{size:13})})]}),!t&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`span`,{className:`conversations-row-name`,children:e.name||e.conversationId.slice(0,12)+`…`}),(0,z.jsxs)(`span`,{className:`conversations-row-meta`,children:[(0,z.jsx)(`span`,{className:`conversations-row-id`,children:e.conversationId.slice(0,8)}),(0,z.jsxs)(`span`,{className:`conversations-row-time`,children:[(0,z.jsx)(he,{size:10}),(()=>{try{let t=new Date(e.updatedAt),n=Date.now()-t.getTime();return n<6e4?`just now`:n<36e5?`${Math.floor(n/6e4)}m ago`:n<864e5?`${Math.floor(n/36e5)}h ago`:`${Math.floor(n/864e5)}d ago`}catch{return``}})()]})]})]})]}),(0,z.jsx)(`div`,{className:`conversations-row-actions`,children:!t&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`button`,{type:`button`,className:`conversations-action conversations-rename`,title:`Rename conversation`,onClick:()=>T(e.conversationId),children:(0,z.jsx)(Ke,{size:13})}),(0,z.jsx)(`button`,{type:`button`,className:`conversations-action conversations-play`,title:`Resume conversation`,disabled:u,onClick:()=>{u||!c||(n(),d(),fetch(`/api/admin/sessions/${encodeURIComponent(e.conversationId)}/resume?session_key=${encodeURIComponent(c)}`,{method:`POST`}).then(e=>e.ok?e.json():Promise.reject(Error(`Failed to resume conversation`))).then(e=>{e.conversationId&&m(e.conversationId);let t=(e.messages??[]).map(e=>({role:e.role===`user`?`admin`:`maxy`,content:e.role===`user`?e.content:void 0,events:e.role===`assistant`?[{type:`text`,content:e.content}]:void 0,timestamp:new Date(e.createdAt).getTime()||0,historical:!0}));t.length>0&&p(t)}).catch(e=>{console.error(`[chat] conversation resume failed:`,e),p([{role:`maxy`,events:[{type:`text`,content:`Could not load conversation history.`}],timestamp:Date.now()-1,historical:!0}])}))},children:(0,z.jsx)(f,{size:13})}),(0,z.jsx)(`button`,{type:`button`,className:`conversations-action conversations-delete`,title:`Delete conversation`,onClick:()=>{s(t=>t.filter(t=>t.conversationId!==e.conversationId)),c&&fetch(`/api/admin/sessions/${encodeURIComponent(e.conversationId)}?session_key=${encodeURIComponent(c)}`,{method:`DELETE`}).catch(e=>console.error(`[chat] conversation delete failed:`,e))},children:(0,z.jsx)(o,{size:13})})]})})]},e.conversationId)})]})]})}):null}function hE({src:e,onClose:t}){return e?(0,z.jsxs)(`div`,{className:`attachment-lightbox`,onClick:t,children:[(0,z.jsx)(`button`,{className:`attachment-lightbox-close`,onClick:t,"aria-label":`Close`,children:`×`}),(0,z.jsx)(`img`,{src:e,alt:`Attachment`,onClick:e=>e.stopPropagation()})]}):null}function gE({show:e,onClose:t,onConfirm:n}){return e?(0,z.jsx)(`div`,{className:`claude-info-overlay`,onClick:t,children:(0,z.jsxs)(`div`,{className:`claude-info-modal`,onClick:e=>e.stopPropagation(),children:[(0,z.jsxs)(`div`,{className:`claude-info-header`,children:[(0,z.jsx)(`span`,{children:`Compact conversation?`}),(0,z.jsx)(`button`,{className:`claude-info-close`,onClick:t,"aria-label":`Close`,children:`✕`})]}),(0,z.jsx)(`div`,{className:`claude-info-section`,style:{padding:`12px 14px`,fontSize:`11px`,color:`var(--text-secondary)`},children:`Summarises the conversation history to free up context window space. The session continues with a compressed summary.`}),(0,z.jsxs)(`div`,{className:`claude-info-section`,style:{display:`flex`,gap:`8px`,padding:`10px 14px`},children:[(0,z.jsx)(T,{variant:`secondary`,size:`sm`,style:{background:`var(--accent)`,flex:1},onClick:()=>{t(),n()},children:`Yes, compact`}),(0,z.jsx)(T,{variant:`secondary`,size:`sm`,style:{flex:1},onClick:t,children:`No`})]})]})}):null}function _E(e){let{show:t,onClose:n,claudeInfo:r,messages:i,sessionElapsed:a,conversationId:o,contextModeHint:s,handleContextModeToggle:c}=e;if(!t)return null;let l=i.flatMap(e=>e.events?.filter(e=>e.type===`usage`)??[]),u=l.at(-1),d=u?.peak_request_pct==null?u?.context_window?Math.round((u.input_tokens+u.cache_creation_tokens+u.cache_read_tokens)/u.context_window*100):0:Math.round(u.peak_request_pct*100),f=l.reduce((e,t)=>e+t.input_tokens+t.cache_creation_tokens+t.cache_read_tokens+t.output_tokens,0),p=i.flatMap(e=>e.events?.filter(e=>e.type===`rate_limit`)??[]).at(-1),m=l.reduce((e,t)=>e+(t.total_cost_usd??0),0),h=r?.account?.subscriptionType,g=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,z.jsx)(`div`,{className:`claude-info-overlay`,onClick:n,children:(0,z.jsxs)(`div`,{className:`claude-info-modal`,onClick:e=>e.stopPropagation(),children:[(0,z.jsxs)(`div`,{className:`claude-info-header`,children:[(0,z.jsx)(`img`,{src:`/brand/claude.png`,alt:`Claude`,className:`claude-info-icon`}),(0,z.jsx)(`span`,{children:`Claude Code`}),(0,z.jsx)(`button`,{className:`claude-info-close`,onClick:n,"aria-label":`Close`,children:`✕`})]}),(0,z.jsxs)(`div`,{className:`claude-info-section`,children:[(0,z.jsxs)(`div`,{className:`claude-info-row`,children:[(0,z.jsx)(`span`,{className:`claude-info-label`,children:`Version`}),(0,z.jsx)(`span`,{className:`claude-info-value`,children:r?r.version:`…`})]}),(0,z.jsxs)(`div`,{className:`claude-info-row`,children:[(0,z.jsx)(`span`,{className:`claude-info-label`,children:`Email`}),(0,z.jsx)(`span`,{className:`claude-info-value`,children:r?.account?.email??`…`})]})]}),(h||p||m>0)&&(0,z.jsxs)(`div`,{className:`claude-info-section`,children:[h&&(0,z.jsxs)(`div`,{className:`claude-info-row`,children:[(0,z.jsx)(`span`,{className:`claude-info-label`,children:`Plan`}),(0,z.jsx)(`span`,{className:`claude-info-value`,style:{textTransform:`capitalize`},children:h})]}),p&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`claude-info-row`,children:[(0,z.jsx)(`span`,{className:`claude-info-label`,children:`Usage`}),(0,z.jsxs)(`span`,{className:`claude-info-value`,children:[Math.round(p.utilization*100),`%`]})]}),(0,z.jsxs)(`div`,{className:`claude-info-row`,children:[(0,z.jsx)(`span`,{className:`claude-info-label`,children:`Resets in`}),(0,z.jsx)(`span`,{className:`claude-info-value`,children:g(p.resetsAt)})]}),p.isUsingOverage&&(0,z.jsxs)(`div`,{className:`claude-info-row`,children:[(0,z.jsx)(`span`,{className:`claude-info-label`,children:`Overage`}),(0,z.jsx)(`span`,{className:`claude-info-value`,children:`Active`})]})]}),m>0&&(0,z.jsxs)(`div`,{className:`claude-info-row`,children:[(0,z.jsx)(`span`,{className:`claude-info-label`,children:`Session cost`}),(0,z.jsxs)(`span`,{className:`claude-info-value`,children:[`$`,m<.01?m.toFixed(4):m.toFixed(2)]})]})]}),(0,z.jsxs)(`div`,{className:`claude-info-section`,children:[(0,z.jsxs)(`div`,{className:`claude-info-row`,children:[(0,z.jsx)(`span`,{className:`claude-info-label`,children:`Model`}),(0,z.jsx)(`span`,{className:`claude-info-value`,children:r?.model??`…`})]}),(0,z.jsxs)(`div`,{className:`claude-info-row`,children:[(0,z.jsx)(`span`,{className:`claude-info-label`,children:`Context mode`}),(0,z.jsxs)(`span`,{className:`claude-info-value claude-info-toggle`,role:`button`,tabIndex:0,onClick:c,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),c())},children:[r?.contextMode??`…`,s?` (next turn)`:``]})]}),(0,z.jsxs)(`div`,{className:`claude-info-row`,children:[(0,z.jsx)(`span`,{className:`claude-info-label`,children:`Context used`}),(0,z.jsx)(`span`,{className:`claude-info-value`,children:d>0?`${d}%`:`—`})]}),(0,z.jsxs)(`div`,{className:`claude-info-row`,children:[(0,z.jsx)(`span`,{className:`claude-info-label`,children:`Tokens`}),(0,z.jsx)(`span`,{className:`claude-info-value`,children:f>0?ut(f):`—`})]}),(0,z.jsxs)(`div`,{className:`claude-info-row`,children:[(0,z.jsx)(`span`,{className:`claude-info-label`,children:`Session`}),(0,z.jsx)(`span`,{className:`claude-info-value`,children:lt(a)})]}),o&&(0,z.jsxs)(`div`,{className:`claude-info-row`,children:[(0,z.jsx)(`span`,{className:`claude-info-label`,children:`Conversation`}),(0,z.jsx)(`span`,{className:`claude-info-value`,style:{fontFamily:`monospace`,fontSize:10},children:o.slice(0,8)})]})]})]})})}var vE=2e3,yE=9e5;function bE({show:e,onClose:t,versionInfo:n,sessionKey:r,onUpgradeComplete:i}){let[a,o]=(0,R.useState)(`idle`),[s,c]=(0,R.useState)(null),[l,u]=(0,R.useState)({step:0,total:11,label:``,started:!1,subSteps:[]}),d=(0,R.useRef)(null),f=(0,R.useRef)(null),p=(0,R.useRef)(null),m=(0,R.useRef)(0),h=(0,R.useRef)(null),_=(0,R.useRef)(!1),v=n?.latest??null;(0,R.useEffect)(()=>{p.current&&(p.current.scrollTop=p.current.scrollHeight)},[l.subSteps]);let y=(0,R.useCallback)(()=>{d.current&&=(clearInterval(d.current),null),f.current&&=(clearTimeout(f.current),null)},[]);(0,R.useEffect)(()=>{e||(y(),o(`idle`),c(null),u({step:0,total:11,label:``,started:!1,subSteps:[]}),m.current=0,h.current=null,_.current=!1)},[e,y]),(0,R.useEffect)(()=>y,[y]);let b=a===`success`?100:l.total>0?l.step/l.total*90:0;function x(){let e=0,t=h.current??`/api/admin/version/upgrade/progress`;d.current=setInterval(async()=>{e++;let n=!1;try{let e=await fetch(t);if(e.ok){let t=await e.json();if(m.current=0,t.started&&u(t),t.finished&&(_.current=!0),t.failed){y(),o(`error`),c(`Upgrade failed — check device logs for details.`);return}}else _.current||(m.current++,n=!0,console.warn(`[update] progress poll non-ok status=${e.status} consecutive=${m.current}`))}catch(e){_.current||(m.current++,n=!0,console.warn(`[update] progress poll failed (consecutive=${m.current}):`,e))}if(e%3==0)try{let e=await fetch(`/api/admin/version`);if(e.ok){let t=await e.json();if(v&&t.installed===v){y(),o(`success`),i(),f.current=setTimeout(()=>window.location.reload(),2e3);return}}}catch{o(e=>e===`upgrading`||e===`restarting`?`restarting`:e)}if(n&&m.current>=3){y(),o(`error`),c(`Upgrade monitoring stopped — the progress server exited unexpectedly. Check device logs.`);return}},vE)}async function S(){if(!r){console.warn(`[update] Upgrade blocked: no session key`),o(`error`),c(`Session expired — please log in again`);return}if(!v){console.warn(`[update] Upgrade blocked: no target version`),o(`error`),c(`Version data unavailable — close and try again`);return}o(`upgrading`),c(null),u({step:0,total:11,label:`Starting upgrade…`,started:!1,subSteps:[]}),m.current=0,h.current=null,f.current=setTimeout(()=>{y(),o(`error`),c(`Upgrade timed out. Check device logs for details.`)},yE);try{let e=await(await fetch(`/api/admin/version/upgrade`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({session_key:r})})).json();if(!e.ok){y(),o(`error`),c(e.error||`Upgrade failed`);return}typeof e.progressUrl==`string`&&e.progressUrl&&(h.current=e.progressUrl,console.log(`[update] switched polling to progressUrl=${e.progressUrl}`)),x()}catch(e){console.error(`[update] upgrade request failed:`,e),y(),o(`error`),c(e instanceof Error?e.message:String(e))}}return e?(0,z.jsx)(`div`,{className:`claude-info-overlay`,onClick:()=>{(a===`idle`||a===`success`||a===`error`)&&t()},children:(0,z.jsxs)(`div`,{className:`claude-info-modal update-modal`,onClick:e=>e.stopPropagation(),children:[(0,z.jsxs)(`div`,{className:`claude-info-header`,children:[(0,z.jsx)(xe,{size:12}),`Software Update`,(a===`idle`||a===`success`||a===`error`)&&(0,z.jsx)(`button`,{className:`claude-info-close`,onClick:t,children:`✕`})]}),a===`idle`&&(0,z.jsxs)(`div`,{className:`update-modal-body`,children:[(0,z.jsxs)(`div`,{className:`update-modal-versions`,children:[(0,z.jsxs)(`div`,{className:`claude-info-row`,children:[(0,z.jsx)(`span`,{className:`claude-info-label`,children:`Installed`}),(0,z.jsxs)(`span`,{className:`claude-info-value`,children:[`v`,n?.installed??`…`]})]}),(0,z.jsxs)(`div`,{className:`claude-info-row`,children:[(0,z.jsx)(`span`,{className:`claude-info-label`,children:`Available`}),(0,z.jsxs)(`span`,{className:`claude-info-value update-version-new`,children:[`v`,v??`…`]})]})]}),(0,z.jsx)(`button`,{type:`button`,className:`update-modal-btn`,onClick:S,children:`Upgrade`})]}),(a===`upgrading`||a===`restarting`)&&(0,z.jsx)(`div`,{className:`update-modal-body`,children:(0,z.jsxs)(`div`,{className:`update-modal-progress-wrap`,children:[(0,z.jsx)(`div`,{className:`update-modal-progress-bar`,children:(0,z.jsx)(`div`,{className:`update-modal-progress-fill`,style:{width:`${b}%`}})}),(0,z.jsxs)(`div`,{className:`update-modal-phase`,children:[(0,z.jsx)(Ie,{size:12,className:`spin`}),(0,z.jsxs)(`span`,{className:`update-modal-step-detail`,children:[l.step>0&&l.total>0&&(0,z.jsxs)(`span`,{className:`update-modal-step-count`,children:[l.step,`/`,l.total]}),l.label||(a===`restarting`?`Restarting service…`:`Starting upgrade…`)]})]}),l.subSteps&&l.subSteps.length>0&&(0,z.jsx)(`div`,{ref:p,className:`update-modal-substeps`,children:l.subSteps.map((e,t)=>(0,z.jsx)(`div`,{className:`update-modal-substep-line`,children:e},t))})]})}),a===`success`&&(0,z.jsxs)(`div`,{className:`update-modal-body update-modal-result`,children:[(0,z.jsx)(pe,{size:14,className:`update-success-icon`}),(0,z.jsxs)(`span`,{children:[`Upgraded to v`,v]})]}),a===`error`&&(0,z.jsxs)(`div`,{className:`update-modal-body update-modal-result`,children:[(0,z.jsx)(g,{size:14,className:`update-error-icon`}),(0,z.jsx)(`span`,{children:s})]})]})}):null}function xE({onClose:e}){ct();let[t,n]=(0,R.useState)(!1),r=(0,R.useRef)(null),i=(0,R.useRef)(null),a=(0,R.useCallback)(()=>{i.current&&=(clearInterval(i.current),null),r.current&&!r.current.closed&&r.current.close(),r.current=null,n(!1)},[]),o=(0,R.useCallback)(()=>{let t=`/vnc-popout.html?title=${encodeURIComponent(P.productName)}`,o=window.open(t,`maxy-vnc-overlay-popout`,`width=1024,height=768`);o&&(r.current=o,n(!0),i.current=setInterval(()=>{r.current?.closed&&(a(),e())},500))},[a,e]),s=(0,R.useCallback)(()=>{a(),e()},[a,e]);(0,R.useEffect)(()=>{if(t)return;let e=e=>{e.key===`Escape`&&s()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t,s]),(0,R.useEffect)(()=>()=>a(),[a]);let c=zt({handlePopout:o,disabled:t});return t?(0,z.jsxs)(`div`,{className:`browser-overlay-popout`,children:[(0,z.jsx)(u,{className:`browser-viewer__icon`}),(0,z.jsx)(`span`,{className:`browser-viewer__title`,children:P.productName}),(0,z.jsx)(`span`,{className:`browser-viewer__popout-label`,children:`Popped out`}),(0,z.jsx)(T,{variant:`ghost`,size:`sm`,icon:Ue,onClick:()=>{a()},"aria-label":`Pop back in`}),(0,z.jsx)(T,{variant:`ghost`,size:`sm`,icon:at,onClick:s,"aria-label":`Close`})]}):(0,z.jsxs)(`div`,{className:`browser-viewer-fullscreen`,children:[(0,z.jsxs)(`div`,{className:`browser-viewer-fullscreen__bar`,...c,children:[(0,z.jsx)(u,{className:`browser-viewer__icon`}),(0,z.jsx)(`span`,{className:`browser-viewer-fullscreen__title`,children:P.productName}),(0,z.jsxs)(`div`,{className:`browser-viewer-fullscreen__actions`,children:[(0,z.jsx)(T,{variant:`ghost`,size:`sm`,icon:Se,onClick:o,"aria-label":`Pop out`}),(0,z.jsx)(T,{variant:`ghost`,size:`sm`,icon:at,onClick:s,"aria-label":`Close`})]})]}),(0,z.jsx)(`iframe`,{src:`/vnc-viewer.html`,className:`browser-viewer-fullscreen__iframe`,title:P.productName})]})}function SE(){ct();let e=(0,R.useRef)(null),[t,n]=(0,R.useState)(null),[r,i]=(0,R.useState)(!1),[a,s]=(0,R.useState)(!1),[c,d]=(0,R.useState)(``),[f,p]=(0,R.useState)(!1),[m,h]=(0,R.useState)(null),[g,_]=(0,R.useState)(!1),[v,y]=(0,R.useState)(null),[x,S]=(0,R.useState)(null),[w,T]=(0,R.useState)(!1),[E,D]=(0,R.useState)([]),[O,k]=(0,R.useState)(!1),[A,j]=(0,R.useState)(null),[M,N]=(0,R.useState)(null),[ee,te]=(0,R.useState)(!1),[ne,re]=(0,R.useState)(null),[ae,oe]=(0,R.useState)(!1),[se,ce]=(0,R.useState)(!1),le=(0,R.useRef)(!1),ue=(0,R.useRef)(!1),de=(0,R.useRef)(!1),fe=(0,R.useRef)(null),F=ie(),pe=dt(),I=_t(),me=Et(),L=Tt({sessionKey:I.sessionKey,setSessionKey:I.setSessionKey,setAppState:I.setAppState,setConversationId:I.setConversationId,startElapsedTimer:pe.startElapsedTimer,stopElapsedTimer:pe.stopElapsedTimer,resetTimerState:pe.resetTimerState,pausedElapsedRef:pe.pausedElapsedRef,expandAllDefaultRef:I.expandAllDefaultRef,setExpandAll:I.setExpandAll,getPendingFiles:()=>me.pendingFiles,clearPendingFiles:me.clearFiles,inputRef:e});(0,R.useEffect)(()=>{d(window.location.hostname.startsWith(`admin.`)?window.location.origin.replace(`admin.`,`public.`):window.location.origin)},[]),(0,R.useEffect)(()=>{function e(e){e.key===`Escape`&&(t?n(null):F.selectionMode&&F.exitSelection())}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t,F.selectionMode]),(0,R.useEffect)(()=>{(I.appState===`set-pin`||I.appState===`enter-pin`)&&setTimeout(()=>I.pinInputRef.current?.focus(),100),I.appState===`chat`&&setTimeout(()=>e.current?.focus(),100)},[I.appState,L.greetingGeneration]),(0,R.useEffect)(()=>{if(I.appState!==`chat`)return;history.pushState({maxyChat:!0},``);function e(){console.debug(`[history-guard] popstate absorbed`),history.pushState({maxyChat:!0},``)}return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[I.appState]);let he=(0,R.useRef)(L.greetingGeneration);return(0,R.useEffect)(()=>{L.greetingGeneration!==he.current&&(he.current=L.greetingGeneration,I.onboardingComplete===!1&&(le.current=!1))},[L.greetingGeneration,I.onboardingComplete]),(0,R.useEffect)(()=>{I.appState===`chat`&&I.onboardingComplete===!1&&(le.current||(le.current=!0,L.sendSystemPrompt(`[Begin onboarding.]`)))},[I.appState,I.onboardingComplete,L.greetingGeneration]),(0,R.useEffect)(()=>{if(!f)return;let e=!1;return fetch(`/api/admin/version`).then(e=>e.json()).then(t=>{e||N(t)}).catch(e=>{console.error(`[admin/version] menu-open client fetch failed:`,e)}),()=>{e=!0}},[f]),(0,R.useEffect)(()=>{if(I.appState!==`chat`){ue.current=!1,de.current=!1;return}if(ue.current)return;ue.current=!0;let e=!1;return fetch(`/api/admin/version`).then(e=>e.json()).then(t=>{e||(N(t),!(!t.updateAvailable||de.current)&&(re(t),te(!0),fetch(`/api/admin/version/alert-surfaced`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({installed:t.installed,latest:t.latest})}).catch(e=>{console.error(`[admin/version] alert-surfaced signal failed:`,e)})))}).catch(e=>{console.error(`[admin/version] session-start client fetch failed:`,e)}),()=>{e=!0}},[I.appState]),(0,R.useEffect)(()=>{if(!f){h(null),y(null),S(null),N(null);return}function e(e){fe.current&&!fe.current.contains(e.target)&&p(!1)}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[f]),(0,R.useEffect)(()=>{if(typeof BroadcastChannel>`u`)return;let e=new BroadcastChannel(`platform-onboarding`);return e.onmessage=e=>{e.data?.type===`remote-password-set`&&L.sendMessageRef.current(`I've set the remote password`)},()=>e.close()},[]),I.appState===`loading`?(0,z.jsx)(`div`,{className:`chat-page admin-page`,children:(0,z.jsx)(`header`,{className:`chat-header`,children:(0,z.jsx)(`img`,{src:b,alt:P.productName,className:`chat-logo`})})}):I.appState===`set-pin`?(0,z.jsx)(Ot,{pin:I.pin,setPin:I.setPin,confirmPin:I.confirmPin,setConfirmPin:I.setConfirmPin,showPin:I.showPin,setShowPin:I.setShowPin,pinLoading:I.pinLoading,pinError:I.pinError,pinInputRef:I.pinInputRef,confirmPinInputRef:I.confirmPinInputRef,setPinFormRef:I.setPinFormRef,onSubmit:I.handleSetPin}):I.appState===`onboarding-choice`?(0,z.jsx)(Mt,{setAppState:I.setAppState,setOnboardingComplete:I.setOnboardingComplete}):I.appState===`connect-claude`?(0,z.jsx)(jt,{authPolling:I.authPolling,setAuthPolling:I.setAuthPolling,authLoading:I.authLoading,setAuthLoading:I.setAuthLoading,pinError:I.pinError,setPinError:I.setPinError,setAppState:I.setAppState}):I.appState===`enter-pin`?(0,z.jsx)(kt,{pin:I.pin,setPin:I.setPin,showPin:I.showPin,setShowPin:I.setShowPin,pinLoading:I.pinLoading,pinError:I.pinError,pinInputRef:I.pinInputRef,onSubmit:I.handleLogin,onChangePin:I.handleChangePin}):I.appState===`account-picker`?(0,z.jsx)(At,{accounts:I.accounts,loading:I.accountPickerLoading,error:I.pinError,onSelect:I.handleAccountSelect}):(0,z.jsx)(C,{value:{onShowVnc:()=>oe(!0)},children:(0,z.jsxs)(`div`,{className:`chat-page admin-page`,children:[(0,z.jsxs)(`header`,{className:`chat-header`,children:[(0,z.jsx)(`img`,{src:b,alt:P.productName,className:`chat-logo`}),(!P.logoContainsName||I.businessName)&&(0,z.jsx)(`div`,{children:(0,z.jsx)(`h1`,{className:`chat-tagline`,children:I.businessName||P.productName})}),(0,z.jsxs)(`div`,{className:`chat-burger-wrap`,ref:fe,children:[(0,z.jsx)(`button`,{type:`button`,className:`chat-burger`,onClick:()=>p(e=>!e),"aria-label":`Menu`,"aria-haspopup":`true`,"aria-expanded":f,children:(0,z.jsx)(Be,{size:20})}),f&&(0,z.jsxs)(`div`,{className:`chat-menu`,children:[(0,z.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,onClick:()=>{p(!1),L.startNewConversation()},disabled:L.isStreaming||L.isCompacting,children:[(0,z.jsx)(Ee,{size:14}),` New conversation`]}),(0,z.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,onClick:async()=>{p(!1),T(!0),k(!0),j(null);try{let e=await fetch(`/api/admin/sessions?session_key=${encodeURIComponent(I.sessionKey)}`);if(!e.ok)throw Error(`Failed to load conversations`);D((await e.json()).sessions??[])}catch(e){console.error(`[admin] conversation list failed:`,e),j(e instanceof Error?e.message:String(e))}finally{k(!1)}},children:[(0,z.jsx)(Fe,{size:14}),` Conversations`]}),(0,z.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,onClick:async()=>{if(!(ae||se)){ce(!0),p(!1);try{let e=await(await fetch(`/api/admin/browser/launch`,{method:`POST`})).json().catch(()=>({ok:!1,error:`Invalid response`}));if(!e.ok)throw Error(e.error??`Failed to launch browser`);oe(!0)}catch(e){console.error(`[browser] Launch failed:`,e),alert(e instanceof Error?e.message:`Failed to launch browser`)}finally{ce(!1)}}},disabled:se,children:[(0,z.jsx)(u,{size:14}),` Browser`,se&&(0,z.jsx)(Ie,{size:12,className:`spin`})]}),(0,z.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,onClick:()=>{p(!1),window.location.href=`/data`},children:[(0,z.jsx)(ye,{size:14}),` Data`]}),(0,z.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,onClick:()=>{p(!1),window.open(`/graph`,`_blank`,`noopener,noreferrer`)},children:[(0,z.jsx)(Ze,{size:14}),` Graph`]}),(0,z.jsx)(`div`,{className:`chat-menu-divider`}),(0,z.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,onClick:async()=>{if(m!==null){h(null),S(null);return}_(!0),y(null);try{let e=await fetch(`/api/admin/agents`);if(!e.ok)throw Error(`Failed to load agents`);h((await e.json()).agents??[])}catch(e){console.error(`[admin] agent list failed:`,e),y(e instanceof Error?e.message:String(e))}finally{_(!1)}},children:[(0,z.jsx)(Se,{size:14}),` Public`,g&&(0,z.jsx)(Ie,{size:12,className:`spin`})]}),m!==null&&(0,z.jsxs)(`div`,{className:`chat-menu-agents`,children:[v&&(0,z.jsx)(`span`,{className:`chat-menu-agent-error`,children:v}),m.length===0&&!v&&(0,z.jsx)(`span`,{className:`chat-menu-agent-empty`,children:`No public agents configured`}),m.map(e=>(0,z.jsxs)(`div`,{className:`chat-menu-item chat-menu-agent-item`,children:[(0,z.jsx)(`span`,{className:`agent-status-dot ${e.status}`}),(0,z.jsxs)(`span`,{className:`agent-text`,children:[(0,z.jsx)(`span`,{className:`agent-display-name`,children:e.displayName}),(0,z.jsxs)(`span`,{className:`agent-slug`,children:[`/`,e.slug]})]}),x===e.slug?(0,z.jsxs)(`span`,{className:`agent-actions agent-confirm`,children:[(0,z.jsx)(`button`,{type:`button`,className:`agent-action-btn agent-confirm-yes`,title:`Confirm delete`,onClick:()=>{S(null),h(t=>t?.filter(t=>t.slug!==e.slug)??null),fetch(`/api/admin/agents/${encodeURIComponent(e.slug)}`,{method:`DELETE`}).catch(e=>console.error(`[admin/agents] delete failed:`,e))},children:(0,z.jsx)(l,{size:12})}),(0,z.jsx)(`button`,{type:`button`,className:`agent-action-btn agent-confirm-no`,title:`Cancel`,onClick:()=>S(null),children:(0,z.jsx)(at,{size:12})})]}):(0,z.jsxs)(`span`,{className:`agent-actions`,children:[(0,z.jsx)(`a`,{href:`${c}/${e.slug}`,target:`_blank`,rel:`noopener noreferrer`,className:`agent-action-btn`,title:`Open agent`,onClick:()=>p(!1),children:(0,z.jsx)(Se,{size:12})}),(0,z.jsx)(`button`,{type:`button`,className:`agent-action-btn agent-delete-btn`,title:`Delete agent`,onClick:()=>S(e.slug),children:(0,z.jsx)(o,{size:12})})]})]},e.slug))]}),(0,z.jsx)(`div`,{className:`chat-menu-divider`}),M?.updateAvailable?(0,z.jsxs)(`button`,{type:`button`,className:`chat-menu-version`,onClick:()=>{M.latest&&(re(M),p(!1),te(!0))},children:[(0,z.jsx)(Ae,{size:14}),(0,z.jsxs)(`span`,{className:`version-installed`,children:[`v`,M.installed,(0,z.jsx)(`span`,{className:`version-update-dot`})]})]}):(0,z.jsxs)(`div`,{className:`chat-menu-version chat-menu-version-passive`,children:[(0,z.jsx)(Ae,{size:14}),(0,z.jsxs)(`span`,{className:`version-installed`,children:[M?`v${M.installed}`:`…`,M&&!M.updateAvailable&&(0,z.jsx)(`span`,{className:`version-uptodate-dot`})]})]}),(0,z.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,onClick:()=>{p(!1),I.handleLogout(),L.setMessages([])},children:[(0,z.jsx)(Re,{size:14}),` Log out`]})]})]})]}),(0,z.jsx)(lE,{messages:L.messages,isStreaming:L.isStreaming,elapsedSeconds:pe.elapsedSeconds,sessionTurnStart:pe.sessionTurnStart,expandAll:I.expandAll,setExpandAll:I.setExpandAll,conversationCompacted:L.conversationCompacted,isCompacting:L.isCompacting,setShowCompactConfirm:s,handleComponentSubmit:L.handleComponentSubmit,effectiveSubmitted:L.effectiveSubmitted,selectionMode:F.selectionMode,selectedItems:F.selectedItems,toggleSelectItem:F.toggleSelectItem,sessionKey:I.sessionKey,setLightboxSrc:n,messageQueue:L.messageQueue,messageQueueRef:L.messageQueueRef,setQueue:L.setQueue,sendMessage:L.sendMessage,appState:I.appState,onboardingComplete:I.onboardingComplete}),(0,z.jsx)(uE,{offer:L.topicChangeOffer,onFreshStart:L.handleTopicFreshStart,onContinue:L.handleTopicContinue,disabled:L.isStreaming}),(0,z.jsx)(pE,{selectionMode:F.selectionMode,selectedItems:F.selectedItems,copyToast:F.copyToast||null,exitSelection:F.exitSelection,enterSelection:F.enterSelection,copySelected:F.copySelected,showCopyToast:F.showCopyToast,input:L.input,setInput:L.setInput,inputRef:e,pendingFiles:me.pendingFiles,setPendingFiles:me.setPendingFiles,isDragOver:me.isDragOver,attachError:me.attachError,fileInputRef:me.fileInputRef,addFiles:me.addFiles,removeFile:me.removeFile,onDragOver:me.onDragOver,onDragLeave:me.onDragLeave,onDrop:me.onDrop,isStreaming:L.isStreaming,wasPaused:L.wasPaused,messages:L.messages,messageQueueRef:L.messageQueueRef,setQueue:L.setQueue,sendMessage:L.sendMessage,stopStreaming:L.stopStreaming,disconnecting:I.disconnecting,handleDisconnect:I.handleDisconnect,claudeInfo:I.claudeInfo,setClaudeInfo:I.setClaudeInfo,setShowClaudeInfo:i,conversationId:I.conversationId}),F.copyToast&&(0,z.jsx)(`span`,{className:`copy-toast${F.copyToast===`failed`?` copy-toast-failed`:``}`,children:F.copyToast===`copied`?`Copied`:`Copy failed`}),(0,z.jsx)(mE,{show:w,onClose:()=>T(!1),conversationsLoading:O,conversationsError:A,conversationsList:E,setConversationsList:D,sessionKey:I.sessionKey,isStreaming:L.isStreaming,resetConversation:L.resetConversation,setMessages:L.setMessages,setConversationId:I.setConversationId}),(0,z.jsx)(hE,{src:t,onClose:()=>n(null)}),(0,z.jsx)(gE,{show:a,onClose:()=>s(!1),onConfirm:L.handleCompactNow}),(0,z.jsx)(_E,{show:r,onClose:()=>{i(!1),I.setClaudeInfo(null)},claudeInfo:I.claudeInfo,messages:L.messages,sessionElapsed:pe.sessionElapsed,conversationId:I.conversationId,contextModeHint:I.contextModeHint,handleContextModeToggle:I.handleContextModeToggle}),(0,z.jsx)(bE,{show:ee,onClose:()=>{te(!1),de.current=!0},versionInfo:ne,sessionKey:I.sessionKey,onUpgradeComplete:()=>N(null)}),ae&&(0,z.jsx)(xE,{onClose:()=>oe(!1)})]})})}(0,st.createRoot)(document.getElementById(`root`)).render((0,z.jsx)(SE,{}));
|
|
352
|
+
`)}function pE(e){let{selectionMode:t,selectedItems:r,copyToast:o,exitSelection:c,enterSelection:l,copySelected:u,showCopyToast:m,input:h,setInput:g,inputRef:_,pendingFiles:v,setPendingFiles:y,isDragOver:b,attachError:x,fileInputRef:S,addFiles:C,removeFile:w,onDragOver:k,onDragLeave:A,onDrop:M,isStreaming:N,wasPaused:te,messages:re,messageQueueRef:P,setQueue:ie,sendMessage:ae,stopStreaming:oe,disconnecting:se,handleDisconnect:ce,claudeInfo:le,setClaudeInfo:de,setShowClaudeInfo:fe,conversationId:F}=e,[pe,I]=(0,R.useState)(!1),me=(0,R.useRef)(null),[L,he]=(0,R.useState)(!1),ge=(0,R.useRef)(null),_e=(0,R.useRef)(!1),ve=ne(),ye=ve.state===`recording`||ve.state===`paused`||ve.state===`sending`,be=!ye&&!te&&!h.trim()&&v.length===0;async function xe(){let e=await ve.send();if(!e)return;let t=e.type===`audio/ogg`?`.ogg`:e.type===`audio/mp4`?`.m4a`:`.webm`,n=new File([e],`voice-note${t}`,{type:e.type});if(N){ie([...P.current,{text:`[Voice note]`,files:[n],timestamp:Date.now()}]);return}ae(`[Voice note]`,[n])}return(0,R.useEffect)(()=>{t||he(!1)},[t]),(0,R.useEffect)(()=>{if(!L)return;let e=e=>{e.target.closest(`.selection-copy-wrap`)||he(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[L]),(0,R.useEffect)(()=>{if(!pe)return;let e=e=>{if(e.key===`Escape`){I(!1);return}if(e.key===`Tab`&&me.current){let t=me.current.querySelectorAll(`.actions-menu-items button:not([disabled])`);if(t.length===0)return;let n=t[0],r=t[t.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n.focus())}},t=e=>{me.current&&!me.current.contains(e.target)&&I(!1)};return document.addEventListener(`keydown`,e),document.addEventListener(`mousedown`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`mousedown`,t)}},[pe]),t?(0,z.jsx)(`div`,{className:`chat-input-area`,children:(0,z.jsxs)(`div`,{className:`selection-bar`,children:[(0,z.jsxs)(`span`,{className:`selection-count`,children:[r.size,` Selected`]}),(0,z.jsxs)(`div`,{className:`selection-copy-wrap`,children:[(0,z.jsxs)(`button`,{type:`button`,className:`selection-copy`,onPointerDown:()=>{if(L){he(!1);return}_e.current=!1,ge.current=setTimeout(()=>{_e.current=!0,he(!0),ge.current=null},500)},onPointerUp:()=>{ge.current!==null&&(clearTimeout(ge.current),ge.current=null)},onPointerLeave:()=>{ge.current!==null&&(clearTimeout(ge.current),ge.current=null)},onPointerCancel:()=>{ge.current!==null&&(clearTimeout(ge.current),ge.current=null)},onClick:async()=>{_e.current||await u(e=>dE(re,e),(e,t)=>{let[n,r]=[e.slice(0,e.lastIndexOf(`_`)),e.slice(e.lastIndexOf(`_`)+1)],[i,a]=[t.slice(0,t.lastIndexOf(`_`)),t.slice(t.lastIndexOf(`_`)+1)],o=parseInt(n,10)-parseInt(i,10);return o===0?r===`admin`?-1:a===`admin`?1:parseInt(r,10)-parseInt(a,10):o})},children:[(0,z.jsx)(s,{size:18}),(0,z.jsx)(`span`,{children:`Copy`})]}),L&&(0,z.jsx)(`div`,{className:`copy-menu`,children:[[`all`,`All events`],[`text`,`Text messages only`],[`non-text`,`Non-text only`]].map(([e,t])=>(0,z.jsx)(`button`,{type:`button`,className:`copy-menu-item`,onClick:async()=>{let t=fE(re,e);t&&m(await i(t)),c()},children:t},e))})]}),(0,z.jsx)(`button`,{type:`button`,className:`selection-cancel`,onClick:c,children:`Cancel`})]})}):(0,z.jsxs)(`div`,{className:`chat-input-area`,children:[(0,z.jsx)(`input`,{ref:S,type:`file`,multiple:!0,accept:ft,style:{display:`none`},onChange:e=>{e.target.files&&C([...e.target.files]),e.target.value=``}}),v.length>0&&(0,z.jsx)(`div`,{className:`attachment-strip`,children:v.map((e,t)=>(0,z.jsxs)(`div`,{className:`attachment-chip`,children:[e.type.startsWith(`image/`)?(0,z.jsx)(`img`,{src:URL.createObjectURL(e),alt:e.name,className:`attachment-chip-thumb`}):e.type===`application/pdf`?(0,z.jsx)(d,{size:14}):(0,z.jsx)(p,{size:14}),(0,z.jsx)(`span`,{className:`attachment-chip-name`,children:e.name}),(0,z.jsx)(`button`,{type:`button`,className:`attachment-chip-remove`,onClick:()=>w(t),"aria-label":`Remove ${e.name}`,children:`×`})]},t))}),x&&(0,z.jsx)(`p`,{className:`attach-error`,children:x}),ve.state===`error`&&ve.errorMessage&&(0,z.jsxs)(`p`,{className:`voice-error`,role:`alert`,children:[(0,z.jsx)(D,{size:14}),ve.errorMessage]}),(0,z.jsx)(E,{inputRef:_}),ye?(0,z.jsx)(`div`,{className:`chat-form voice-active`,children:(0,z.jsx)(j,{state:ve.state,elapsedSeconds:ve.elapsedSeconds,waveform:ve.waveform,onTogglePause:ve.togglePause,onDiscard:ve.discard,onSend:xe})}):(0,z.jsxs)(`form`,{className:`chat-form${b?` drag-over`:``}`,onSubmit:e=>{e.preventDefault();let t=h.trim()||(te?`continue`:``);if(!(!t&&v.length===0)){if(N){ie([...P.current,{text:t,files:[...v],timestamp:Date.now()}]),g(``),y([]),_.current?.resetHeight();return}ae(t),_.current?.resetHeight()}},onDragOver:k,onDragLeave:A,onDrop:M,onPaste:e=>{let t=e.clipboardData?.items;if(!t)return;let n=[];for(let e of t){if(e.kind!==`file`)continue;let t=e.getAsFile();if(!t)continue;let r=t.type.split(`/`)[1]?.replace(`jpeg`,`jpg`)||`png`;n.push(new File([t],`pasted-image-${Date.now()}.${r}`,{type:t.type}))}n.length>0&&C(n)},children:[(0,z.jsx)(T,{variant:`icon`,type:`button`,onClick:()=>S.current?.click(),"aria-label":`Attach file`,children:(0,z.jsx)(n,{size:14})}),(0,z.jsx)(ee,{ref:_,value:h,onChange:g}),N?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(T,{variant:`send`,type:`button`,onClick:()=>oe(!0),"aria-label":`Pause`,style:{background:`var(--text-secondary)`},children:(0,z.jsx)(O,{size:14})}),(0,z.jsx)(T,{variant:`send`,type:`button`,onClick:()=>oe(!1),"aria-label":`Stop`,style:{background:`var(--danger)`},children:(0,z.jsx)(et,{size:14})})]}):be?(0,z.jsx)(T,{variant:`send`,type:`button`,onClick:ve.start,"aria-label":`Record voice note`,children:(0,z.jsx)(D,{size:14})}):(0,z.jsx)(T,{variant:`send`,type:`submit`,disabled:!h.trim()&&v.length===0&&!te,"aria-label":`Send message`,children:te?(0,z.jsx)(f,{size:14}):(0,z.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,z.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`}),(0,z.jsx)(`polyline`,{points:`12 5 19 12 12 19`})]})})]}),(0,z.jsxs)(`div`,{className:`chat-actions`,ref:me,children:[(0,z.jsx)(`button`,{className:`burger-trigger`,onClick:()=>I(e=>!e),"aria-expanded":pe,"aria-haspopup":`true`,"aria-label":`Actions menu`,children:(0,z.jsx)(Be,{size:16})}),(0,z.jsxs)(`div`,{className:`actions-menu-items${pe?` actions-menu-open`:``}`,children:[(0,z.jsxs)(`button`,{className:`chat-action`,disabled:se,onClick:async()=>{I(!1),await ce()},children:[se?(0,z.jsx)(Ie,{size:14,className:`animate-spin`}):(0,z.jsx)(ue,{size:14}),(0,z.jsx)(`span`,{className:`action-label`,children:se?`Disconnecting...`:`Disconnect Claude`})]}),(0,z.jsxs)(`button`,{className:`chat-action`,disabled:!F,onClick:()=>{if(I(!1),!F){console.debug(`[stream-log-button] disabled reason=no-conversation-id`);return}let e=document.createElement(`a`);e.href=`/api/admin/logs?type=stream&conversationId=${encodeURIComponent(F)}&download=1`,e.click()},title:F?`Download stream log`:`No conversation active — start a message to create a stream log`,children:[(0,z.jsx)(Ye,{size:14}),(0,z.jsx)(`span`,{className:`action-label`,children:`Stream log`})]}),(0,z.jsxs)(`button`,{className:`chat-action`,onClick:()=>{I(!1),l()},title:`Select messages`,children:[(0,z.jsx)(a,{size:14}),(0,z.jsx)(`span`,{className:`action-label`,children:`Select`})]})]}),(0,z.jsxs)(`div`,{className:`powered-by`,onClick:async()=>{if(fe(!0),!le){let e=await fetch(`/api/admin/claude-info`);e.ok&&de(await e.json())}},children:[(0,z.jsx)(`img`,{src:`/brand/claude.png`,alt:`Claude`,className:`powered-by-icon`}),(0,z.jsx)(`span`,{children:`Powered by Claude Code`})]})]})]})}function mE(e){let{show:t,onClose:n,conversationsLoading:r,conversationsError:i,conversationsList:a,setConversationsList:s,sessionKey:c,isStreaming:u,resetConversation:d,setMessages:p,setConversationId:m}=e,[h,g]=(0,R.useState)(null),[_,v]=(0,R.useState)(null),[y,b]=(0,R.useState)(``),[x,S]=(0,R.useState)(!1),C=(0,R.useRef)(null);(0,R.useEffect)(()=>{t||(g(null),v(null),b(``),S(!1))},[t]),(0,R.useEffect)(()=>{_?.phase===`editing`&&(C.current?.focus(),C.current?.select())},[_]);function w(){g(null),v(null),b(``),S(!1)}async function T(e){if(c){w(),g(e),v({phase:`loading`});try{let t=await fetch(`/api/admin/sessions/${encodeURIComponent(e)}/label?session_key=${encodeURIComponent(c)}`,{method:`POST`});if(!t.ok){v({phase:`error`,reason:(await t.json().catch(()=>({}))).error||`Request failed`});return}let n=await t.json();n.label?(v({phase:`editing`}),b(n.label)):v({phase:`error`,reason:`Not enough message content to suggest a name`})}catch(e){console.error(`[admin-modal] label suggestion failed:`,e),v({phase:`error`,reason:e instanceof Error?e.message:String(e)})}}}async function E(e){if(!(!c||!y.trim()||x)){S(!0);try{let t=await fetch(`/api/admin/sessions/${encodeURIComponent(e)}/label`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({label:y.trim(),session_key:c})});if(!t.ok){v({phase:`error`,reason:(await t.json().catch(()=>({}))).error||`Rename failed`}),S(!1);return}s(t=>t.map(t=>t.conversationId===e?{...t,name:y.trim()}:t)),w()}catch(e){console.error(`[admin-modal] label rename failed:`,e),v({phase:`error`,reason:e instanceof Error?e.message:String(e)}),S(!1)}}}return t?(0,z.jsx)(`div`,{className:`claude-info-overlay`,onClick:n,children:(0,z.jsxs)(`div`,{className:`claude-info-modal conversations-modal`,onClick:e=>e.stopPropagation(),children:[(0,z.jsxs)(`div`,{className:`claude-info-header`,children:[(0,z.jsx)(Fe,{size:12}),`Conversations`,(0,z.jsx)(`button`,{className:`claude-info-close`,onClick:n,children:`✕`})]}),(0,z.jsxs)(`div`,{className:`conversations-list`,children:[r&&(0,z.jsxs)(`div`,{className:`conversations-empty`,children:[(0,z.jsx)(Ie,{size:14,className:`spin`}),` Loading…`]}),i&&(0,z.jsx)(`div`,{className:`conversations-empty conversations-error`,children:i}),!r&&!i&&a.length===0&&(0,z.jsx)(`div`,{className:`conversations-empty`,children:`No recent conversations`}),!r&&!i&&a.map(e=>{let t=h===e.conversationId,r=t&&_?.phase===`loading`,i=t&&_?.phase===`editing`,a=t&&_?.phase===`error`;return(0,z.jsxs)(`div`,{className:`conversations-row`,children:[(0,z.jsxs)(`div`,{className:`conversations-row-info`,children:[r&&(0,z.jsxs)(`span`,{className:`conversations-row-name conversations-edit-loading`,children:[(0,z.jsx)(Ie,{size:12,className:`spin`}),` Generating suggestion…`]}),i&&(0,z.jsxs)(`div`,{className:`conversations-edit-inline`,children:[(0,z.jsx)(`input`,{ref:C,type:`text`,className:`conversations-edit-input`,value:y,onChange:e=>b(e.target.value),onKeyDown:t=>{t.key===`Enter`&&y.trim()&&E(e.conversationId),t.key===`Escape`&&w()},maxLength:200}),(0,z.jsx)(`button`,{type:`button`,className:`conversations-action conversations-confirm`,title:`Confirm rename`,disabled:!y.trim()||x,onClick:()=>E(e.conversationId),children:x?(0,z.jsx)(Ie,{size:13,className:`spin`}):(0,z.jsx)(l,{size:13})}),(0,z.jsx)(`button`,{type:`button`,className:`conversations-action conversations-cancel`,title:`Cancel`,onClick:w,children:(0,z.jsx)(at,{size:13})})]}),a&&(0,z.jsxs)(`div`,{className:`conversations-edit-inline`,children:[(0,z.jsx)(`span`,{className:`conversations-edit-error`,children:_.reason}),(0,z.jsx)(`button`,{type:`button`,className:`conversations-action conversations-retry`,title:`Retry`,onClick:()=>T(e.conversationId),children:(0,z.jsx)(Je,{size:13})}),(0,z.jsx)(`button`,{type:`button`,className:`conversations-action conversations-cancel`,title:`Cancel`,onClick:w,children:(0,z.jsx)(at,{size:13})})]}),!t&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`span`,{className:`conversations-row-name`,children:e.name||e.conversationId.slice(0,12)+`…`}),(0,z.jsxs)(`span`,{className:`conversations-row-meta`,children:[(0,z.jsx)(`span`,{className:`conversations-row-id`,children:e.conversationId.slice(0,8)}),(0,z.jsxs)(`span`,{className:`conversations-row-time`,children:[(0,z.jsx)(he,{size:10}),(()=>{try{let t=new Date(e.updatedAt),n=Date.now()-t.getTime();return n<6e4?`just now`:n<36e5?`${Math.floor(n/6e4)}m ago`:n<864e5?`${Math.floor(n/36e5)}h ago`:`${Math.floor(n/864e5)}d ago`}catch{return``}})()]})]})]})]}),(0,z.jsx)(`div`,{className:`conversations-row-actions`,children:!t&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`button`,{type:`button`,className:`conversations-action conversations-rename`,title:`Rename conversation`,onClick:()=>T(e.conversationId),children:(0,z.jsx)(Ke,{size:13})}),(0,z.jsx)(`button`,{type:`button`,className:`conversations-action conversations-play`,title:`Resume conversation`,disabled:u,onClick:()=>{u||!c||(n(),d(),fetch(`/api/admin/sessions/${encodeURIComponent(e.conversationId)}/resume?session_key=${encodeURIComponent(c)}`,{method:`POST`}).then(e=>e.ok?e.json():Promise.reject(Error(`Failed to resume conversation`))).then(e=>{e.conversationId&&m(e.conversationId);let t=(e.messages??[]).map(e=>({role:e.role===`user`?`admin`:`maxy`,content:e.role===`user`?e.content:void 0,events:e.role===`assistant`?[{type:`text`,content:e.content}]:void 0,timestamp:new Date(e.createdAt).getTime()||0,historical:!0}));t.length>0&&p(t)}).catch(e=>{console.error(`[chat] conversation resume failed:`,e),p([{role:`maxy`,events:[{type:`text`,content:`Could not load conversation history.`}],timestamp:Date.now()-1,historical:!0}])}))},children:(0,z.jsx)(f,{size:13})}),(0,z.jsx)(`button`,{type:`button`,className:`conversations-action conversations-delete`,title:`Delete conversation`,onClick:()=>{s(t=>t.filter(t=>t.conversationId!==e.conversationId)),c&&fetch(`/api/admin/sessions/${encodeURIComponent(e.conversationId)}?session_key=${encodeURIComponent(c)}`,{method:`DELETE`}).catch(e=>console.error(`[chat] conversation delete failed:`,e))},children:(0,z.jsx)(o,{size:13})})]})})]},e.conversationId)})]})]})}):null}function hE({src:e,onClose:t}){return e?(0,z.jsxs)(`div`,{className:`attachment-lightbox`,onClick:t,children:[(0,z.jsx)(`button`,{className:`attachment-lightbox-close`,onClick:t,"aria-label":`Close`,children:`×`}),(0,z.jsx)(`img`,{src:e,alt:`Attachment`,onClick:e=>e.stopPropagation()})]}):null}function gE({show:e,onClose:t,onConfirm:n}){return e?(0,z.jsx)(`div`,{className:`claude-info-overlay`,onClick:t,children:(0,z.jsxs)(`div`,{className:`claude-info-modal`,onClick:e=>e.stopPropagation(),children:[(0,z.jsxs)(`div`,{className:`claude-info-header`,children:[(0,z.jsx)(`span`,{children:`Compact conversation?`}),(0,z.jsx)(`button`,{className:`claude-info-close`,onClick:t,"aria-label":`Close`,children:`✕`})]}),(0,z.jsx)(`div`,{className:`claude-info-section`,style:{padding:`12px 14px`,fontSize:`11px`,color:`var(--text-secondary)`},children:`Summarises the conversation history to free up context window space. The session continues with a compressed summary.`}),(0,z.jsxs)(`div`,{className:`claude-info-section`,style:{display:`flex`,gap:`8px`,padding:`10px 14px`},children:[(0,z.jsx)(T,{variant:`secondary`,size:`sm`,style:{background:`var(--accent)`,flex:1},onClick:()=>{t(),n()},children:`Yes, compact`}),(0,z.jsx)(T,{variant:`secondary`,size:`sm`,style:{flex:1},onClick:t,children:`No`})]})]})}):null}function _E(e){let{show:t,onClose:n,claudeInfo:r,messages:i,sessionElapsed:a,conversationId:o,contextModeHint:s,handleContextModeToggle:c}=e;if(!t)return null;let l=i.flatMap(e=>e.events?.filter(e=>e.type===`usage`)??[]),u=l.at(-1),d=u?.peak_request_pct==null?u?.context_window?Math.round((u.input_tokens+u.cache_creation_tokens+u.cache_read_tokens)/u.context_window*100):0:Math.round(u.peak_request_pct*100),f=l.reduce((e,t)=>e+t.input_tokens+t.cache_creation_tokens+t.cache_read_tokens+t.output_tokens,0),p=i.flatMap(e=>e.events?.filter(e=>e.type===`rate_limit`)??[]).at(-1),m=l.reduce((e,t)=>e+(t.total_cost_usd??0),0),h=r?.account?.subscriptionType,g=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,z.jsx)(`div`,{className:`claude-info-overlay`,onClick:n,children:(0,z.jsxs)(`div`,{className:`claude-info-modal`,onClick:e=>e.stopPropagation(),children:[(0,z.jsxs)(`div`,{className:`claude-info-header`,children:[(0,z.jsx)(`img`,{src:`/brand/claude.png`,alt:`Claude`,className:`claude-info-icon`}),(0,z.jsx)(`span`,{children:`Claude Code`}),(0,z.jsx)(`button`,{className:`claude-info-close`,onClick:n,"aria-label":`Close`,children:`✕`})]}),(0,z.jsxs)(`div`,{className:`claude-info-section`,children:[(0,z.jsxs)(`div`,{className:`claude-info-row`,children:[(0,z.jsx)(`span`,{className:`claude-info-label`,children:`Version`}),(0,z.jsx)(`span`,{className:`claude-info-value`,children:r?r.version:`…`})]}),(0,z.jsxs)(`div`,{className:`claude-info-row`,children:[(0,z.jsx)(`span`,{className:`claude-info-label`,children:`Email`}),(0,z.jsx)(`span`,{className:`claude-info-value`,children:r?.account?.email??`…`})]})]}),(h||p||m>0)&&(0,z.jsxs)(`div`,{className:`claude-info-section`,children:[h&&(0,z.jsxs)(`div`,{className:`claude-info-row`,children:[(0,z.jsx)(`span`,{className:`claude-info-label`,children:`Plan`}),(0,z.jsx)(`span`,{className:`claude-info-value`,style:{textTransform:`capitalize`},children:h})]}),p&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`claude-info-row`,children:[(0,z.jsx)(`span`,{className:`claude-info-label`,children:`Usage`}),(0,z.jsxs)(`span`,{className:`claude-info-value`,children:[Math.round(p.utilization*100),`%`]})]}),(0,z.jsxs)(`div`,{className:`claude-info-row`,children:[(0,z.jsx)(`span`,{className:`claude-info-label`,children:`Resets in`}),(0,z.jsx)(`span`,{className:`claude-info-value`,children:g(p.resetsAt)})]}),p.isUsingOverage&&(0,z.jsxs)(`div`,{className:`claude-info-row`,children:[(0,z.jsx)(`span`,{className:`claude-info-label`,children:`Overage`}),(0,z.jsx)(`span`,{className:`claude-info-value`,children:`Active`})]})]}),m>0&&(0,z.jsxs)(`div`,{className:`claude-info-row`,children:[(0,z.jsx)(`span`,{className:`claude-info-label`,children:`Session cost`}),(0,z.jsxs)(`span`,{className:`claude-info-value`,children:[`$`,m<.01?m.toFixed(4):m.toFixed(2)]})]})]}),(0,z.jsxs)(`div`,{className:`claude-info-section`,children:[(0,z.jsxs)(`div`,{className:`claude-info-row`,children:[(0,z.jsx)(`span`,{className:`claude-info-label`,children:`Model`}),(0,z.jsx)(`span`,{className:`claude-info-value`,children:r?.model??`…`})]}),(0,z.jsxs)(`div`,{className:`claude-info-row`,children:[(0,z.jsx)(`span`,{className:`claude-info-label`,children:`Context mode`}),(0,z.jsxs)(`span`,{className:`claude-info-value claude-info-toggle`,role:`button`,tabIndex:0,onClick:c,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),c())},children:[r?.contextMode??`…`,s?` (next turn)`:``]})]}),(0,z.jsxs)(`div`,{className:`claude-info-row`,children:[(0,z.jsx)(`span`,{className:`claude-info-label`,children:`Context used`}),(0,z.jsx)(`span`,{className:`claude-info-value`,children:d>0?`${d}%`:`—`})]}),(0,z.jsxs)(`div`,{className:`claude-info-row`,children:[(0,z.jsx)(`span`,{className:`claude-info-label`,children:`Tokens`}),(0,z.jsx)(`span`,{className:`claude-info-value`,children:f>0?ut(f):`—`})]}),(0,z.jsxs)(`div`,{className:`claude-info-row`,children:[(0,z.jsx)(`span`,{className:`claude-info-label`,children:`Session`}),(0,z.jsx)(`span`,{className:`claude-info-value`,children:lt(a)})]}),o&&(0,z.jsxs)(`div`,{className:`claude-info-row`,children:[(0,z.jsx)(`span`,{className:`claude-info-label`,children:`Conversation`}),(0,z.jsx)(`span`,{className:`claude-info-value`,style:{fontFamily:`monospace`,fontSize:10},children:o.slice(0,8)})]})]})]})})}var vE=2e3,yE=9e5;function bE({show:e,onClose:t,versionInfo:n,sessionKey:r,onUpgradeComplete:i}){let[a,o]=(0,R.useState)(`idle`),[s,c]=(0,R.useState)(null),[l,u]=(0,R.useState)({step:0,total:11,label:``,started:!1,subSteps:[]}),d=(0,R.useRef)(null),f=(0,R.useRef)(null),p=(0,R.useRef)(null),m=(0,R.useRef)(0),h=(0,R.useRef)(null),_=(0,R.useRef)(!1),v=n?.latest??null;(0,R.useEffect)(()=>{p.current&&(p.current.scrollTop=p.current.scrollHeight)},[l.subSteps]);let y=(0,R.useCallback)(()=>{d.current&&=(clearInterval(d.current),null),f.current&&=(clearTimeout(f.current),null)},[]);(0,R.useEffect)(()=>{e||(y(),o(`idle`),c(null),u({step:0,total:11,label:``,started:!1,subSteps:[]}),m.current=0,h.current=null,_.current=!1)},[e,y]),(0,R.useEffect)(()=>y,[y]);let b=a===`success`?100:l.total>0?l.step/l.total*90:0;function x(){let e=0,t=h.current??`/api/admin/version/upgrade/progress`;d.current=setInterval(async()=>{e++;let n=!1;try{let e=await fetch(t);if(e.ok){let t=await e.json();if(m.current=0,t.started&&u(t),t.finished&&(_.current=!0),t.failed){y(),o(`error`),c(`Upgrade failed — check device logs for details.`);return}}else _.current||(m.current++,n=!0,console.warn(`[update] progress poll non-ok status=${e.status} consecutive=${m.current}`))}catch(e){_.current||(m.current++,n=!0,console.warn(`[update] progress poll failed (consecutive=${m.current}):`,e))}try{let t=await fetch(`/api/admin/version`);if(t.ok){let n=await t.json();if(v&&n.installed===v){console.log(`[update] transitioned to success via version check tick=${e}`),y(),o(`success`),i(),f.current=setTimeout(()=>window.location.reload(),2e3);return}}}catch{o(e=>e===`upgrading`||e===`restarting`?`restarting`:e)}if(n&&m.current>=3){y(),o(`error`),c(`Upgrade monitoring stopped — the progress server exited unexpectedly. Check device logs.`);return}},vE)}async function S(){if(!r){console.warn(`[update] Upgrade blocked: no session key`),o(`error`),c(`Session expired — please log in again`);return}if(!v){console.warn(`[update] Upgrade blocked: no target version`),o(`error`),c(`Version data unavailable — close and try again`);return}o(`upgrading`),c(null),u({step:0,total:11,label:`Starting upgrade…`,started:!1,subSteps:[]}),m.current=0,h.current=null,f.current=setTimeout(()=>{y(),o(`error`),c(`Upgrade timed out. Check device logs for details.`)},yE);try{let e=await(await fetch(`/api/admin/version/upgrade`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({session_key:r})})).json();if(!e.ok){y(),o(`error`),c(e.error||`Upgrade failed`);return}typeof e.progressUrl==`string`&&e.progressUrl&&(h.current=e.progressUrl,console.log(`[update] switched polling to progressUrl=${e.progressUrl}`)),x()}catch(e){console.error(`[update] upgrade request failed:`,e),y(),o(`error`),c(e instanceof Error?e.message:String(e))}}return e?(0,z.jsx)(`div`,{className:`claude-info-overlay`,onClick:()=>{(a===`idle`||a===`success`||a===`error`)&&t()},children:(0,z.jsxs)(`div`,{className:`claude-info-modal update-modal`,onClick:e=>e.stopPropagation(),children:[(0,z.jsxs)(`div`,{className:`claude-info-header`,children:[(0,z.jsx)(xe,{size:12}),`Software Update`,(a===`idle`||a===`success`||a===`error`)&&(0,z.jsx)(`button`,{className:`claude-info-close`,onClick:t,children:`✕`})]}),a===`idle`&&(0,z.jsxs)(`div`,{className:`update-modal-body`,children:[(0,z.jsxs)(`div`,{className:`update-modal-versions`,children:[(0,z.jsxs)(`div`,{className:`claude-info-row`,children:[(0,z.jsx)(`span`,{className:`claude-info-label`,children:`Installed`}),(0,z.jsxs)(`span`,{className:`claude-info-value`,children:[`v`,n?.installed??`…`]})]}),(0,z.jsxs)(`div`,{className:`claude-info-row`,children:[(0,z.jsx)(`span`,{className:`claude-info-label`,children:`Available`}),(0,z.jsxs)(`span`,{className:`claude-info-value update-version-new`,children:[`v`,v??`…`]})]})]}),(0,z.jsx)(`button`,{type:`button`,className:`update-modal-btn`,onClick:S,children:`Upgrade`})]}),(a===`upgrading`||a===`restarting`)&&(0,z.jsx)(`div`,{className:`update-modal-body`,children:(0,z.jsxs)(`div`,{className:`update-modal-progress-wrap`,children:[(0,z.jsx)(`div`,{className:`update-modal-progress-bar`,children:(0,z.jsx)(`div`,{className:`update-modal-progress-fill`,style:{width:`${b}%`}})}),(0,z.jsxs)(`div`,{className:`update-modal-phase`,children:[(0,z.jsx)(Ie,{size:12,className:`spin`}),(0,z.jsxs)(`span`,{className:`update-modal-step-detail`,children:[l.step>0&&l.total>0&&(0,z.jsxs)(`span`,{className:`update-modal-step-count`,children:[l.step,`/`,l.total]}),l.label||(a===`restarting`?`Restarting service…`:`Starting upgrade…`)]})]}),l.subSteps&&l.subSteps.length>0&&(0,z.jsx)(`div`,{ref:p,className:`update-modal-substeps`,children:l.subSteps.map((e,t)=>(0,z.jsx)(`div`,{className:`update-modal-substep-line`,children:e},t))})]})}),a===`success`&&(0,z.jsxs)(`div`,{className:`update-modal-body update-modal-result`,children:[(0,z.jsx)(pe,{size:14,className:`update-success-icon`}),(0,z.jsxs)(`span`,{children:[`Upgraded to v`,v]})]}),a===`error`&&(0,z.jsxs)(`div`,{className:`update-modal-body update-modal-result`,children:[(0,z.jsx)(g,{size:14,className:`update-error-icon`}),(0,z.jsx)(`span`,{children:s})]})]})}):null}function xE({onClose:e}){ct();let[t,n]=(0,R.useState)(!1),r=(0,R.useRef)(null),i=(0,R.useRef)(null),a=(0,R.useCallback)(()=>{i.current&&=(clearInterval(i.current),null),r.current&&!r.current.closed&&r.current.close(),r.current=null,n(!1)},[]),o=(0,R.useCallback)(()=>{let t=`/vnc-popout.html?title=${encodeURIComponent(P.productName)}`,o=window.open(t,`maxy-vnc-overlay-popout`,`width=1024,height=768`);o&&(r.current=o,n(!0),i.current=setInterval(()=>{r.current?.closed&&(a(),e())},500))},[a,e]),s=(0,R.useCallback)(()=>{a(),e()},[a,e]);(0,R.useEffect)(()=>{if(t)return;let e=e=>{e.key===`Escape`&&s()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t,s]),(0,R.useEffect)(()=>()=>a(),[a]);let c=zt({handlePopout:o,disabled:t});return t?(0,z.jsxs)(`div`,{className:`browser-overlay-popout`,children:[(0,z.jsx)(u,{className:`browser-viewer__icon`}),(0,z.jsx)(`span`,{className:`browser-viewer__title`,children:P.productName}),(0,z.jsx)(`span`,{className:`browser-viewer__popout-label`,children:`Popped out`}),(0,z.jsx)(T,{variant:`ghost`,size:`sm`,icon:Ue,onClick:()=>{a()},"aria-label":`Pop back in`}),(0,z.jsx)(T,{variant:`ghost`,size:`sm`,icon:at,onClick:s,"aria-label":`Close`})]}):(0,z.jsxs)(`div`,{className:`browser-viewer-fullscreen`,children:[(0,z.jsxs)(`div`,{className:`browser-viewer-fullscreen__bar`,...c,children:[(0,z.jsx)(u,{className:`browser-viewer__icon`}),(0,z.jsx)(`span`,{className:`browser-viewer-fullscreen__title`,children:P.productName}),(0,z.jsxs)(`div`,{className:`browser-viewer-fullscreen__actions`,children:[(0,z.jsx)(T,{variant:`ghost`,size:`sm`,icon:Se,onClick:o,"aria-label":`Pop out`}),(0,z.jsx)(T,{variant:`ghost`,size:`sm`,icon:at,onClick:s,"aria-label":`Close`})]})]}),(0,z.jsx)(`iframe`,{src:`/vnc-viewer.html`,className:`browser-viewer-fullscreen__iframe`,title:P.productName})]})}function SE(){ct();let e=(0,R.useRef)(null),[t,n]=(0,R.useState)(null),[r,i]=(0,R.useState)(!1),[a,s]=(0,R.useState)(!1),[c,d]=(0,R.useState)(``),[f,p]=(0,R.useState)(!1),[m,h]=(0,R.useState)(null),[g,_]=(0,R.useState)(!1),[v,y]=(0,R.useState)(null),[x,S]=(0,R.useState)(null),[w,T]=(0,R.useState)(!1),[E,D]=(0,R.useState)([]),[O,k]=(0,R.useState)(!1),[A,j]=(0,R.useState)(null),[M,N]=(0,R.useState)(null),[ee,te]=(0,R.useState)(!1),[ne,re]=(0,R.useState)(null),[ae,oe]=(0,R.useState)(!1),[se,ce]=(0,R.useState)(!1),le=(0,R.useRef)(!1),ue=(0,R.useRef)(!1),de=(0,R.useRef)(!1),fe=(0,R.useRef)(null),F=ie(),pe=dt(),I=_t(),me=Et(),L=Tt({sessionKey:I.sessionKey,setSessionKey:I.setSessionKey,setAppState:I.setAppState,setConversationId:I.setConversationId,startElapsedTimer:pe.startElapsedTimer,stopElapsedTimer:pe.stopElapsedTimer,resetTimerState:pe.resetTimerState,pausedElapsedRef:pe.pausedElapsedRef,expandAllDefaultRef:I.expandAllDefaultRef,setExpandAll:I.setExpandAll,getPendingFiles:()=>me.pendingFiles,clearPendingFiles:me.clearFiles,inputRef:e});(0,R.useEffect)(()=>{d(window.location.hostname.startsWith(`admin.`)?window.location.origin.replace(`admin.`,`public.`):window.location.origin)},[]),(0,R.useEffect)(()=>{function e(e){e.key===`Escape`&&(t?n(null):F.selectionMode&&F.exitSelection())}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t,F.selectionMode]),(0,R.useEffect)(()=>{(I.appState===`set-pin`||I.appState===`enter-pin`)&&setTimeout(()=>I.pinInputRef.current?.focus(),100),I.appState===`chat`&&setTimeout(()=>e.current?.focus(),100)},[I.appState,L.greetingGeneration]),(0,R.useEffect)(()=>{if(I.appState!==`chat`)return;history.pushState({maxyChat:!0},``);function e(){console.debug(`[history-guard] popstate absorbed`),history.pushState({maxyChat:!0},``)}return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[I.appState]);let he=(0,R.useRef)(L.greetingGeneration);return(0,R.useEffect)(()=>{L.greetingGeneration!==he.current&&(he.current=L.greetingGeneration,I.onboardingComplete===!1&&(le.current=!1))},[L.greetingGeneration,I.onboardingComplete]),(0,R.useEffect)(()=>{I.appState===`chat`&&I.onboardingComplete===!1&&(le.current||(le.current=!0,L.sendSystemPrompt(`[Begin onboarding.]`)))},[I.appState,I.onboardingComplete,L.greetingGeneration]),(0,R.useEffect)(()=>{if(!f)return;let e=!1;return fetch(`/api/admin/version`).then(e=>e.json()).then(t=>{e||N(t)}).catch(e=>{console.error(`[admin/version] menu-open client fetch failed:`,e)}),()=>{e=!0}},[f]),(0,R.useEffect)(()=>{if(I.appState!==`chat`){ue.current=!1,de.current=!1;return}if(ue.current)return;ue.current=!0;let e=!1;return fetch(`/api/admin/version`).then(e=>e.json()).then(t=>{e||(N(t),!(!t.updateAvailable||de.current)&&(re(t),te(!0),fetch(`/api/admin/version/alert-surfaced`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({installed:t.installed,latest:t.latest})}).catch(e=>{console.error(`[admin/version] alert-surfaced signal failed:`,e)})))}).catch(e=>{console.error(`[admin/version] session-start client fetch failed:`,e)}),()=>{e=!0}},[I.appState]),(0,R.useEffect)(()=>{if(!f){h(null),y(null),S(null),N(null);return}function e(e){fe.current&&!fe.current.contains(e.target)&&p(!1)}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[f]),(0,R.useEffect)(()=>{if(typeof BroadcastChannel>`u`)return;let e=new BroadcastChannel(`platform-onboarding`);return e.onmessage=e=>{e.data?.type===`remote-password-set`&&L.sendMessageRef.current(`I've set the remote password`)},()=>e.close()},[]),I.appState===`loading`?(0,z.jsx)(`div`,{className:`chat-page admin-page`,children:(0,z.jsx)(`header`,{className:`chat-header`,children:(0,z.jsx)(`img`,{src:b,alt:P.productName,className:`chat-logo`})})}):I.appState===`set-pin`?(0,z.jsx)(Ot,{pin:I.pin,setPin:I.setPin,confirmPin:I.confirmPin,setConfirmPin:I.setConfirmPin,showPin:I.showPin,setShowPin:I.setShowPin,pinLoading:I.pinLoading,pinError:I.pinError,pinInputRef:I.pinInputRef,confirmPinInputRef:I.confirmPinInputRef,setPinFormRef:I.setPinFormRef,onSubmit:I.handleSetPin}):I.appState===`onboarding-choice`?(0,z.jsx)(Mt,{setAppState:I.setAppState,setOnboardingComplete:I.setOnboardingComplete}):I.appState===`connect-claude`?(0,z.jsx)(jt,{authPolling:I.authPolling,setAuthPolling:I.setAuthPolling,authLoading:I.authLoading,setAuthLoading:I.setAuthLoading,pinError:I.pinError,setPinError:I.setPinError,setAppState:I.setAppState}):I.appState===`enter-pin`?(0,z.jsx)(kt,{pin:I.pin,setPin:I.setPin,showPin:I.showPin,setShowPin:I.setShowPin,pinLoading:I.pinLoading,pinError:I.pinError,pinInputRef:I.pinInputRef,onSubmit:I.handleLogin,onChangePin:I.handleChangePin}):I.appState===`account-picker`?(0,z.jsx)(At,{accounts:I.accounts,loading:I.accountPickerLoading,error:I.pinError,onSelect:I.handleAccountSelect}):(0,z.jsx)(C,{value:{onShowVnc:()=>oe(!0)},children:(0,z.jsxs)(`div`,{className:`chat-page admin-page`,children:[(0,z.jsxs)(`header`,{className:`chat-header`,children:[(0,z.jsx)(`img`,{src:b,alt:P.productName,className:`chat-logo`}),(!P.logoContainsName||I.businessName)&&(0,z.jsx)(`div`,{children:(0,z.jsx)(`h1`,{className:`chat-tagline`,children:I.businessName||P.productName})}),(0,z.jsxs)(`div`,{className:`chat-burger-wrap`,ref:fe,children:[(0,z.jsx)(`button`,{type:`button`,className:`chat-burger`,onClick:()=>p(e=>!e),"aria-label":`Menu`,"aria-haspopup":`true`,"aria-expanded":f,children:(0,z.jsx)(Be,{size:20})}),f&&(0,z.jsxs)(`div`,{className:`chat-menu`,children:[(0,z.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,onClick:()=>{p(!1),L.startNewConversation()},disabled:L.isStreaming||L.isCompacting,children:[(0,z.jsx)(Ee,{size:14}),` New conversation`]}),(0,z.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,onClick:async()=>{p(!1),T(!0),k(!0),j(null);try{let e=await fetch(`/api/admin/sessions?session_key=${encodeURIComponent(I.sessionKey)}`);if(!e.ok)throw Error(`Failed to load conversations`);D((await e.json()).sessions??[])}catch(e){console.error(`[admin] conversation list failed:`,e),j(e instanceof Error?e.message:String(e))}finally{k(!1)}},children:[(0,z.jsx)(Fe,{size:14}),` Conversations`]}),(0,z.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,onClick:async()=>{if(!(ae||se)){ce(!0),p(!1);try{let e=await(await fetch(`/api/admin/browser/launch`,{method:`POST`})).json().catch(()=>({ok:!1,error:`Invalid response`}));if(!e.ok)throw Error(e.error??`Failed to launch browser`);oe(!0)}catch(e){console.error(`[browser] Launch failed:`,e),alert(e instanceof Error?e.message:`Failed to launch browser`)}finally{ce(!1)}}},disabled:se,children:[(0,z.jsx)(u,{size:14}),` Browser`,se&&(0,z.jsx)(Ie,{size:12,className:`spin`})]}),(0,z.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,onClick:()=>{p(!1),window.location.href=`/data`},children:[(0,z.jsx)(ye,{size:14}),` Data`]}),(0,z.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,onClick:()=>{p(!1),window.open(`/graph`,`_blank`,`noopener,noreferrer`)},children:[(0,z.jsx)(Ze,{size:14}),` Graph`]}),(0,z.jsx)(`div`,{className:`chat-menu-divider`}),(0,z.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,onClick:async()=>{if(m!==null){h(null),S(null);return}_(!0),y(null);try{let e=await fetch(`/api/admin/agents`);if(!e.ok)throw Error(`Failed to load agents`);h((await e.json()).agents??[])}catch(e){console.error(`[admin] agent list failed:`,e),y(e instanceof Error?e.message:String(e))}finally{_(!1)}},children:[(0,z.jsx)(Se,{size:14}),` Public`,g&&(0,z.jsx)(Ie,{size:12,className:`spin`})]}),m!==null&&(0,z.jsxs)(`div`,{className:`chat-menu-agents`,children:[v&&(0,z.jsx)(`span`,{className:`chat-menu-agent-error`,children:v}),m.length===0&&!v&&(0,z.jsx)(`span`,{className:`chat-menu-agent-empty`,children:`No public agents configured`}),m.map(e=>(0,z.jsxs)(`div`,{className:`chat-menu-item chat-menu-agent-item`,children:[(0,z.jsx)(`span`,{className:`agent-status-dot ${e.status}`}),(0,z.jsxs)(`span`,{className:`agent-text`,children:[(0,z.jsx)(`span`,{className:`agent-display-name`,children:e.displayName}),(0,z.jsxs)(`span`,{className:`agent-slug`,children:[`/`,e.slug]})]}),x===e.slug?(0,z.jsxs)(`span`,{className:`agent-actions agent-confirm`,children:[(0,z.jsx)(`button`,{type:`button`,className:`agent-action-btn agent-confirm-yes`,title:`Confirm delete`,onClick:()=>{S(null),h(t=>t?.filter(t=>t.slug!==e.slug)??null),fetch(`/api/admin/agents/${encodeURIComponent(e.slug)}`,{method:`DELETE`}).catch(e=>console.error(`[admin/agents] delete failed:`,e))},children:(0,z.jsx)(l,{size:12})}),(0,z.jsx)(`button`,{type:`button`,className:`agent-action-btn agent-confirm-no`,title:`Cancel`,onClick:()=>S(null),children:(0,z.jsx)(at,{size:12})})]}):(0,z.jsxs)(`span`,{className:`agent-actions`,children:[(0,z.jsx)(`a`,{href:`${c}/${e.slug}`,target:`_blank`,rel:`noopener noreferrer`,className:`agent-action-btn`,title:`Open agent`,onClick:()=>p(!1),children:(0,z.jsx)(Se,{size:12})}),(0,z.jsx)(`button`,{type:`button`,className:`agent-action-btn agent-delete-btn`,title:`Delete agent`,onClick:()=>S(e.slug),children:(0,z.jsx)(o,{size:12})})]})]},e.slug))]}),(0,z.jsx)(`div`,{className:`chat-menu-divider`}),M?.updateAvailable?(0,z.jsxs)(`button`,{type:`button`,className:`chat-menu-version`,onClick:()=>{M.latest&&(re(M),p(!1),te(!0))},children:[(0,z.jsx)(Ae,{size:14}),(0,z.jsxs)(`span`,{className:`version-installed`,children:[`v`,M.installed,(0,z.jsx)(`span`,{className:`version-update-dot`})]})]}):(0,z.jsxs)(`div`,{className:`chat-menu-version chat-menu-version-passive`,children:[(0,z.jsx)(Ae,{size:14}),(0,z.jsxs)(`span`,{className:`version-installed`,children:[M?`v${M.installed}`:`…`,M&&!M.updateAvailable&&(0,z.jsx)(`span`,{className:`version-uptodate-dot`})]})]}),(0,z.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,onClick:()=>{p(!1),I.handleLogout(),L.setMessages([])},children:[(0,z.jsx)(Re,{size:14}),` Log out`]})]})]})]}),(0,z.jsx)(lE,{messages:L.messages,isStreaming:L.isStreaming,elapsedSeconds:pe.elapsedSeconds,sessionTurnStart:pe.sessionTurnStart,expandAll:I.expandAll,setExpandAll:I.setExpandAll,conversationCompacted:L.conversationCompacted,isCompacting:L.isCompacting,setShowCompactConfirm:s,handleComponentSubmit:L.handleComponentSubmit,effectiveSubmitted:L.effectiveSubmitted,selectionMode:F.selectionMode,selectedItems:F.selectedItems,toggleSelectItem:F.toggleSelectItem,sessionKey:I.sessionKey,setLightboxSrc:n,messageQueue:L.messageQueue,messageQueueRef:L.messageQueueRef,setQueue:L.setQueue,sendMessage:L.sendMessage,appState:I.appState,onboardingComplete:I.onboardingComplete}),(0,z.jsx)(uE,{offer:L.topicChangeOffer,onFreshStart:L.handleTopicFreshStart,onContinue:L.handleTopicContinue,disabled:L.isStreaming}),(0,z.jsx)(pE,{selectionMode:F.selectionMode,selectedItems:F.selectedItems,copyToast:F.copyToast||null,exitSelection:F.exitSelection,enterSelection:F.enterSelection,copySelected:F.copySelected,showCopyToast:F.showCopyToast,input:L.input,setInput:L.setInput,inputRef:e,pendingFiles:me.pendingFiles,setPendingFiles:me.setPendingFiles,isDragOver:me.isDragOver,attachError:me.attachError,fileInputRef:me.fileInputRef,addFiles:me.addFiles,removeFile:me.removeFile,onDragOver:me.onDragOver,onDragLeave:me.onDragLeave,onDrop:me.onDrop,isStreaming:L.isStreaming,wasPaused:L.wasPaused,messages:L.messages,messageQueueRef:L.messageQueueRef,setQueue:L.setQueue,sendMessage:L.sendMessage,stopStreaming:L.stopStreaming,disconnecting:I.disconnecting,handleDisconnect:I.handleDisconnect,claudeInfo:I.claudeInfo,setClaudeInfo:I.setClaudeInfo,setShowClaudeInfo:i,conversationId:I.conversationId}),F.copyToast&&(0,z.jsx)(`span`,{className:`copy-toast${F.copyToast===`failed`?` copy-toast-failed`:``}`,children:F.copyToast===`copied`?`Copied`:`Copy failed`}),(0,z.jsx)(mE,{show:w,onClose:()=>T(!1),conversationsLoading:O,conversationsError:A,conversationsList:E,setConversationsList:D,sessionKey:I.sessionKey,isStreaming:L.isStreaming,resetConversation:L.resetConversation,setMessages:L.setMessages,setConversationId:I.setConversationId}),(0,z.jsx)(hE,{src:t,onClose:()=>n(null)}),(0,z.jsx)(gE,{show:a,onClose:()=>s(!1),onConfirm:L.handleCompactNow}),(0,z.jsx)(_E,{show:r,onClose:()=>{i(!1),I.setClaudeInfo(null)},claudeInfo:I.claudeInfo,messages:L.messages,sessionElapsed:pe.sessionElapsed,conversationId:I.conversationId,contextModeHint:I.contextModeHint,handleContextModeToggle:I.handleContextModeToggle}),(0,z.jsx)(bE,{show:ee,onClose:()=>{te(!1),de.current=!0},versionInfo:ne,sessionKey:I.sessionKey,onUpgradeComplete:()=>N(null)}),ae&&(0,z.jsx)(xE,{onClose:()=>oe(!1)})]})})}(0,st.createRoot)(document.getElementById(`root`)).render((0,z.jsx)(SE,{}));
|
|
@@ -5,7 +5,7 @@
|
|
|
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-jpGCzN83.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/chunk-Be6NvmcD.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-rov5CBGT.js">
|
|
11
11
|
<link rel="modulepreload" crossorigin href="/assets/useVoiceRecorder-3Qblv7wH.js">
|