@rubytech/create-maxy-code 0.1.304 → 0.1.305

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.
Files changed (31) hide show
  1. package/package.json +1 -1
  2. package/payload/server/public/assets/{AdminLoginScreens-BXKCagZn.js → AdminLoginScreens-Cw882rmm.js} +1 -1
  3. package/payload/server/public/assets/AdminShell-DpWl1uoY.js +1 -0
  4. package/payload/server/public/assets/{Checkbox-BHmeAgrw.js → Checkbox-DAWZItdK.js} +1 -1
  5. package/payload/server/public/assets/{Transcript-DPDJitcb.js → Transcript-DbK2YA3K.js} +1 -1
  6. package/payload/server/public/assets/{admin-DHLuBUtk.js → admin-nQRdn79w.js} +1 -1
  7. package/payload/server/public/assets/audio-attachment-mime-j2VvxEtx.js +30 -0
  8. package/payload/server/public/assets/{browser-DgtLMsM1.js → browser-CHWZDCXt.js} +1 -1
  9. package/payload/server/public/assets/chat-BBK6ulFy.js +1 -0
  10. package/payload/server/public/assets/{data-C317FUk4.js → data-33mdnHv8.js} +1 -1
  11. package/payload/server/public/assets/{file-download-DXFcVkh6.js → file-download-P_qlMCg5.js} +1 -1
  12. package/payload/server/public/assets/{graph-CHf_9bmD.js → graph-Uaa5heM5.js} +2 -2
  13. package/payload/server/public/assets/{graph-labels-BbiX-sz-.js → graph-labels-rG63rHvl.js} +1 -1
  14. package/payload/server/public/assets/{jsx-runtime-BkXvvpkS.css → jsx-runtime-DZkld3Wk.css} +1 -1
  15. package/payload/server/public/assets/operator-CiDwt5I9.js +1 -0
  16. package/payload/server/public/assets/page-BvkaS_tu.js +1 -0
  17. package/payload/server/public/assets/{public-D3G4tgFu.js → public-DBXfM02B.js} +3 -3
  18. package/payload/server/public/assets/{useSelectionMode-DcgaoBP6.js → useSelectionMode-Dky-Stnf.js} +1 -1
  19. package/payload/server/public/browser.html +6 -6
  20. package/payload/server/public/chat.html +9 -9
  21. package/payload/server/public/data.html +5 -5
  22. package/payload/server/public/graph.html +8 -8
  23. package/payload/server/public/index.html +9 -9
  24. package/payload/server/public/operator.html +11 -11
  25. package/payload/server/public/public.html +6 -6
  26. package/payload/server/public/assets/AdminShell-CxKd_V3O.js +0 -1
  27. package/payload/server/public/assets/audio-attachment-mime-BxI3Kl4_.js +0 -30
  28. package/payload/server/public/assets/chat-Ib78Kdhg.js +0 -1
  29. package/payload/server/public/assets/operator-BJ5tN5vl.js +0 -1
  30. package/payload/server/public/assets/page-CjuqiMAQ.js +0 -1
  31. /package/payload/server/public/assets/{jsx-runtime-BabLCDgS.js → jsx-runtime-sFVKdwlP.js} +0 -0
@@ -0,0 +1 @@
1
+ import{o as e}from"./chunk-Pqm5yXtL.js";import{a as t,i as n,t as r}from"./jsx-runtime-sFVKdwlP.js";import"./file-download-P_qlMCg5.js";import{n as i,t as a}from"./AdminLoginScreens-Cw882rmm.js";import"./AdminShell-DpWl1uoY.js";import{t as o}from"./page-BvkaS_tu.js";import"./audio-attachment-mime-j2VvxEtx.js";import"./useSelectionMode-Dky-Stnf.js";import"./Checkbox-DAWZItdK.js";import"./Transcript-DbK2YA3K.js";var s=n(),c=e(t(),1),l=r();function u(){let e=i(`operator`),t=(0,c.useRef)(null);return(0,c.useEffect)(()=>{e.appState!==`chat`&&t.current!==e.appState&&(t.current=e.appState,console.info(`[operator-ui] op=auth-gate state=${e.appState}`))},[e.appState]),e.appState===`chat`?(0,l.jsx)(o,{variant:`operator`}):(0,l.jsx)(a,{auth:e})}(0,s.createRoot)(document.getElementById(`root`)).render((0,l.jsx)(u,{}));
@@ -0,0 +1 @@
1
+ import{o as e}from"./chunk-Pqm5yXtL.js";import{a as t,r as n,t as r}from"./jsx-runtime-sFVKdwlP.js";import{n as i,o as a}from"./file-download-P_qlMCg5.js";import{a as o,d as s,l as c,o as l,r as u,t as d,u as f}from"./AdminShell-DpWl1uoY.js";import{a as ee,f as p,i as m,n as h,o as te,p as g,r as ne,s as _,t as re}from"./audio-attachment-mime-j2VvxEtx.js";import{l as ie}from"./useSelectionMode-Dky-Stnf.js";import{i as v,n as ae,r as y,t as b}from"./Transcript-DbK2YA3K.js";var oe=n(`calendar-clock`,[[`path`,{d:`M16 14v2.2l1.6 1`,key:`fo4ql5`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),x=n(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),se=n(`corner-down-left`,[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]),ce=n(`graduation-cap`,[[`path`,{d:`M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z`,key:`j76jl0`}],[`path`,{d:`M22 10v6`,key:`1lu8f3`}],[`path`,{d:`M6 12.5V16a6 3 0 0 0 12 0v-3.5`,key:`1r8lef`}]]),le=n(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),S=`claude-fable-5[1m]`,C=`claude-opus-4-8[1m]`,w=`claude-sonnet-4-6`,T=`claude-haiku-4-5`,E={[S]:`Fable 5 (1M context)`,[C]:`Opus 4.8 (1M context)`,[w]:`Sonnet 4.6`,[T]:`Haiku 4.5`};function ue(e){return E[e]??e}var D=e(t(),1),O=r();function k({turns:e}){let[t,n]=(0,D.useState)(!1),r=e.filter(e=>e.kind===`tool-call`).length,i=r>0?`Used ${r} tool${r===1?``:`s`}`:`${e.length} tool result${e.length===1?``:`s`}`;return(0,O.jsxs)(`div`,{className:`chat-toolrun`,children:[(0,O.jsxs)(`button`,{type:`button`,className:`chat-toolrun-toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[(0,O.jsx)(`span`,{className:`wa-chevron`,children:t?`▾`:`▸`}),(0,O.jsx)(`span`,{className:`chat-toolrun-label`,children:i})]}),t&&e.map((e,t)=>(0,O.jsxs)(`div`,{className:`chat-toolrun-item`,children:[(0,O.jsx)(`span`,{className:`chat-toolrun-name`,children:e.kind===`tool-call`?`↳ ${e.name}`:e.isError?`result (error)`:`result`}),(0,O.jsx)(`pre`,{className:`wa-code`,children:e.kind===`tool-call`?JSON.stringify(e.input,null,2):e.text})]},t))]})}function A(e,t){switch(e.kind){case`operator-inbound`:case`operator-typed`:return(0,O.jsxs)(`div`,{className:`chat-turn-op`,children:[e.kind===`operator-inbound`&&e.source&&(0,O.jsx)(`span`,{className:`chat-via`,children:v(e.source).replace(` · `,``)}),(0,O.jsx)(`p`,{className:`chat-op-body`,children:e.text})]},t);case`agent-text`:case`agent-reply`:return(0,O.jsx)(`div`,{className:`chat-prose`,children:(0,O.jsx)(m,{content:e.text})},t);case`agent-reply-document`:return(0,O.jsxs)(`div`,{className:`chat-prose`,children:[(0,O.jsxs)(`p`,{className:`chat-doc`,children:[`📎 sent document(s): `,e.files.map(y).join(`, `)]}),e.caption&&(0,O.jsx)(m,{content:e.caption})]},t)}}function de(e,t,n){let r=[],i=[],a=()=>{i.length!==0&&(r.push((0,O.jsx)(k,{turns:i},`run-${r.length}`)),i=[])};return e.forEach((e,o)=>{if(e.kind===`turn`&&(e.turn.kind===`tool-call`||e.turn.kind===`tool-result`)){i.push(e.turn);return}a(),e.kind===`directive`?r.push((0,O.jsx)(b,{entry:e.entry,sessionId:t,sessionKey:n},o)):r.push(A(e.turn,o))}),a(),r}var j=[S,C,w,T],M=[`low`,`medium`,`high`,`xhigh`],N={low:`Low`,medium:`Medium`,high:`High`,xhigh:`Highest`},P=[{value:`default`,label:`Ask permissions`},{value:`acceptEdits`,label:`Accept edits`},{value:`plan`,label:`Plan mode`},{value:`auto`,label:`Auto mode`},{value:`bypassPermissions`,label:`Bypass permissions`}],fe=Object.fromEntries(P.map(e=>[e.value,e.label])),pe=2500;function F(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{weekday:`short`,day:`numeric`,month:`short`,hour:`2-digit`,minute:`2-digit`})}function me({cacheKey:e,userName:t}){let[n,r]=(0,D.useState)(null);(0,D.useEffect)(()=>{let t=!1;return fetch(`/api/webchat/greeting?session_key=${encodeURIComponent(e)}`).then(async e=>{let n=await e.json();if(!t){if(!e.ok||n.ok!==!0){console.warn(`[admin-ui] greeting-unavailable status=${e.status} ok=${String(n.ok)}`);return}r({events:n.events,tasks:n.tasks,specialists:n.specialists??[]})}}).catch(e=>{t||console.warn(`[admin-ui] greeting-unavailable error=${e instanceof Error?e.message:String(e)}`)}),()=>{t=!0}},[e]);let i=t?.trim().split(/\s+/)[0],a=n?n.tasks.total-n.tasks.items.length:0;return(0,O.jsxs)(`div`,{className:`webchat-greeting`,children:[(0,O.jsx)(`h2`,{className:`webchat-greeting-head`,children:i?`What's up next, ${i}?`:`What's up next?`}),n&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`section`,{className:`webchat-greeting-section`,"data-kind":`events`,children:[(0,O.jsxs)(`h3`,{className:`webchat-greeting-label`,children:[(0,O.jsx)(oe,{size:14}),` Upcoming schedule`]}),n.events.length===0?(0,O.jsx)(`p`,{className:`webchat-greeting-none`,children:`Nothing scheduled`}):n.events.map(e=>(0,O.jsxs)(`div`,{className:`webchat-greeting-row`,children:[(0,O.jsx)(`span`,{className:`webchat-greeting-name`,children:e.name}),(0,O.jsx)(`span`,{className:`webchat-greeting-when`,children:F(e.at)})]},e.eventId))]}),(0,O.jsxs)(`section`,{className:`webchat-greeting-section`,"data-kind":`tasks`,children:[(0,O.jsxs)(`h3`,{className:`webchat-greeting-label`,children:[(0,O.jsx)(l,{size:14}),` Outstanding tasks`]}),n.tasks.items.length===0?(0,O.jsx)(`p`,{className:`webchat-greeting-none`,children:`No open tasks`}):(0,O.jsxs)(O.Fragment,{children:[n.tasks.items.map(e=>(0,O.jsxs)(`div`,{className:`webchat-greeting-row`,children:[(0,O.jsx)(`span`,{className:`webchat-greeting-name`,children:e.name}),(0,O.jsx)(`span`,{className:`webchat-greeting-status`,children:e.status})]},e.taskId)),a>0&&(0,O.jsxs)(`p`,{className:`webchat-greeting-more`,children:[`+`,a,` more`]})]})]}),(0,O.jsxs)(`section`,{className:`webchat-greeting-section`,"data-kind":`specialists`,children:[(0,O.jsxs)(`h3`,{className:`webchat-greeting-label`,children:[(0,O.jsx)(u,{size:14}),` Your specialists`]}),n.specialists.length===0?(0,O.jsx)(`p`,{className:`webchat-greeting-none`,children:`No specialists installed`}):n.specialists.map((e,t)=>(0,O.jsxs)(`div`,{className:`webchat-greeting-row webchat-greeting-row-stacked`,children:[(0,O.jsx)(`span`,{className:`webchat-greeting-name`,children:e.name}),e.summary&&(0,O.jsx)(`span`,{className:`webchat-greeting-summary`,children:e.summary})]},`${t}-${e.name}`))]})]})]})}function he({kind:e,label:t,icon:n,options:r,selected:i,disabled:a,onPick:o}){let[s,l]=(0,D.useState)(!1);return(0,O.jsxs)(`div`,{className:`webchat-picker`,children:[(0,O.jsx)(`button`,{type:`button`,className:`webchat-control webchat-picker-trigger`,"data-kind":e,disabled:a,"aria-haspopup":`listbox`,"aria-expanded":s,"aria-label":i?`${t}: ${i}`:t,title:`${t} — ${i??t} (applies to new sessions)`,onClick:()=>l(e=>!e),children:n}),s&&(0,O.jsx)(`div`,{className:`webchat-picker-panel`,role:`listbox`,children:r.map(t=>(0,O.jsxs)(`button`,{type:`button`,className:`webchat-picker-option`,"data-kind":e,"data-value":t.value,role:`option`,"aria-checked":t.value===i||t.label===i,onClick:()=>{o(t.value),l(!1)},children:[(0,O.jsx)(c,{size:12,className:`webchat-picker-check`}),t.label]},t.value))})]})}function ge({icon:e,value:t,index:n,disabled:r,onPick:i}){let[a,o]=(0,D.useState)(!1),s=N[t]??`Medium`;return(0,O.jsxs)(`div`,{className:`webchat-picker`,children:[(0,O.jsx)(`button`,{type:`button`,className:`webchat-control webchat-picker-trigger`,"data-kind":`effort`,disabled:r,"aria-haspopup":`dialog`,"aria-expanded":a,"aria-label":`Thinking effort: ${s}`,title:`Thinking — ${s} (Faster ↔ Smarter, applies to new sessions)`,onClick:()=>o(e=>!e),children:e}),a&&(0,O.jsxs)(`div`,{className:`webchat-picker-panel webchat-effort-panel`,role:`dialog`,"aria-label":`Effort for new sessions`,children:[(0,O.jsxs)(`div`,{className:`webchat-effort-head`,children:[(0,O.jsxs)(`span`,{className:`webchat-effort-title`,children:[`Effort `,(0,O.jsx)(`strong`,{children:s})]}),(0,O.jsx)(`span`,{className:`webchat-effort-help`,title:`Higher effort spends more time reasoning before each reply.`,children:(0,O.jsx)(x,{size:13})})]}),(0,O.jsxs)(`div`,{className:`webchat-effort-ends`,children:[(0,O.jsx)(`span`,{children:`Faster`}),(0,O.jsx)(`span`,{children:`Smarter`})]}),(0,O.jsxs)(`div`,{className:`webchat-effort-track`,children:[(0,O.jsx)(`span`,{className:`webchat-effort-dots`,"aria-hidden":`true`,children:M.map((e,t)=>(0,O.jsx)(`span`,{className:`webchat-effort-dot`,"data-max":t===M.length-1},e))}),(0,O.jsx)(`input`,{type:`range`,className:`webchat-effort-slider`,"data-kind":`effort`,min:0,max:M.length-1,step:1,value:n,disabled:r,"aria-label":`Effort for new sessions`,onChange:e=>i(M[Number(e.target.value)])})]})]})]})}function _e({cacheKey:e,userName:t,targetSessionId:n,variant:r=`admin`}){let[i,s]=(0,D.useState)(null),[c,l]=(0,D.useState)(``),[u,d]=(0,D.useState)(!1),[m,v]=(0,D.useState)([]),[y,b]=(0,D.useState)(null),[oe,x]=(0,D.useState)(!1),S=(0,D.useRef)(null),C=()=>Math.round((typeof window>`u`?900:window.innerHeight)/3),[w,T]=(0,D.useState)(null),E=(0,D.useRef)(null),k=(0,D.useRef)(null),A=(0,D.useCallback)(e=>{let t=k.current;t&&T(Math.min(C(),Math.max(44,t.startH+(t.startY-e.clientY))))},[]),N=(0,D.useCallback)(()=>{k.current=null,window.removeEventListener(`pointermove`,A),window.removeEventListener(`pointerup`,N)},[A]),F=(0,D.useCallback)(e=>{k.current={startY:e.clientY,startH:E.current?.offsetHeight??44},window.addEventListener(`pointermove`,A),window.addEventListener(`pointerup`,N),e.preventDefault()},[A,N]),_e=(0,D.useCallback)(e=>{let t=w??E.current?.offsetHeight??44;e.key===`ArrowUp`?(e.preventDefault(),T(Math.min(C(),t+24))):e.key===`ArrowDown`&&(e.preventDefault(),T(Math.max(44,t-24)))},[w]),I=(0,D.useCallback)(e=>{b(null);let t=e.find(e=>!re(e.type,_));if(t){b(`Unsupported file type: "${t.type}". Supported: images, PDF, plain text, markdown, CSV, calendar, voice notes.`);return}let n=e.find(e=>e.size>te);if(n){b(`"${n.name}" exceeds the 50 MB limit.`);return}v(t=>[...t,...e].slice(0,5))},[]),L=(0,D.useMemo)(()=>m.map(e=>e.type.startsWith(`image/`)?URL.createObjectURL(e):null),[m]);(0,D.useEffect)(()=>()=>{for(let e of L)e&&URL.revokeObjectURL(e)},[L]);let R=h(),z=R.state===`recording`||R.state===`paused`||R.state===`sending`,ve=(0,D.useCallback)(async()=>{let t=await R.send();if(!t)return;let r=t.type===`audio/ogg`?`.ogg`:t.type===`audio/mp4`?`.m4a`:`.webm`,i=new File([t],`voice-note${r}`,{type:t.type});if(u){v(e=>[...e,i].slice(0,5));return}d(!0);let a=new FormData;a.append(`text`,``),a.append(`attachments`,i),n&&a.append(`session`,n);try{let t=await fetch(`/api/webchat/send?session_key=${encodeURIComponent(e)}`,{method:`POST`,body:a});t.ok||(console.error(`[admin-ui] webchat-send-failed kind=voice status=${t.status}`),v(e=>[...e,i].slice(0,5)),b(`Voice note failed to send. The recording is attached — press send to retry.`))}catch(e){console.error(`[admin-ui] webchat-send-failed kind=voice error=${e instanceof Error?e.message:String(e)}`),v(e=>[...e,i].slice(0,5)),b(`Voice note failed to send. The recording is attached — press send to retry.`)}finally{d(!1)}},[R,e,n,u]),B=(0,D.useRef)(!1);(0,D.useEffect)(()=>(B.current=!1,()=>{B.current=!0}),[]);let V=(0,D.useRef)(!1),H=(0,D.useCallback)(async()=>{if(V.current)return null;V.current=!0;try{let t=`session_key=${encodeURIComponent(e)}${n?`&session=${encodeURIComponent(n)}`:``}`,r=await fetch(`/api/webchat/session?${t}`);if(!r.ok)return null;let i=await r.json();return B.current||s(i),i}catch{return null}finally{V.current=!1}},[e,n]);(0,D.useEffect)(()=>{H();let e=setInterval(()=>{H()},pe);return()=>clearInterval(e)},[H]);let U=(0,D.useCallback)(async()=>{let t=c.trim();if(!(!t&&m.length===0||u)){d(!0);try{let r;if(m.length>0){let i=new FormData;i.append(`text`,t);for(let e of m)i.append(`attachments`,e);n&&i.append(`session`,n),r=await fetch(`/api/webchat/send?session_key=${encodeURIComponent(e)}`,{method:`POST`,body:i})}else r=await fetch(`/api/webchat/send?session_key=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(n?{text:t,session:n}:{text:t})});r.ok?(l(``),v([]),b(null)):r.status===409?console.error(`[admin-ui] webchat-send-refused reason=channel-conflict`):console.error(`[admin-ui] webchat-send-failed status=${r.status}`)}catch(e){console.error(`[admin-ui] webchat-send-failed error=${e instanceof Error?e.message:String(e)}`)}finally{d(!1)}}},[c,u,e,m,n]),ye=(0,D.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),U())},[U]),W=n?i?.channelBinding??null:null,be=(0,D.useRef)(!1);(0,D.useEffect)(()=>{!n||be.current||!i||(be.current=!0,console.warn(`[admin-ui] chat-session-target sessionId=${n} jsonl=${i.projectDir?`found`:`missing`} known=${i.known===!0}`))},[i,n]);let xe=(0,D.useRef)(!1);(0,D.useEffect)(()=>{n||xe.current||!i?.sessionId||(xe.current=!0,console.info(`[admin-ui] chat-session-resolve sessionId=${i.sessionId.slice(0,8)} source=canonical`))},[i,n]);let G=i?i.effectivePermissionMode??i.permissionMode??null:null,K=i?.model??null,Se=i?.activity===`busy`,[q,Ce]=(0,D.useState)(null),[J,we]=(0,D.useState)(null),[Y,Te]=(0,D.useState)(null),[Ee,X]=(0,D.useState)(null),Z=(0,D.useCallback)(async(t,n)=>{let r=t===`model`?Ce:t===`effort`?we:Te;r(n),X(null);try{let i=await fetch(`/api/webchat/settings?session_key=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({op:t,value:n})});i.ok||(r(null),X(`Could not save ${t} (status ${i.status})`),console.error(`[admin-ui] webchat-settings-failed op=${t} status=${i.status}`))}catch(e){r(null),X(`Could not save ${t} (network error)`),console.error(`[admin-ui] webchat-settings-failed op=${t} error=${e instanceof Error?e.message:String(e)}`)}},[e]);(0,D.useEffect)(()=>{q!==null&&i?.leverModel===q&&Ce(null),J!==null&&i?.leverEffort===J&&we(null),Y!==null&&i?.leverMode===Y&&Te(null)},[i,q,J,Y]);let Q=q??i?.leverModel??K??``,De=J??i?.leverEffort??``,$=Y??i?.leverMode??G??null,Oe=Math.max(0,M.indexOf(De||`medium`)),ke=Q&&!j.includes(Q)?[...j,Q]:j,Ae=(0,D.useRef)(!1);return(0,D.useEffect)(()=>{Ae.current||i?.projectDir&&i.activity==null&&G==null&&K==null&&(Ae.current=!0,console.warn(`[admin-ui] composer-indicators-unavailable sessionId=${i.sessionId} (manager meta unreadable or pre-activity)`))},[i,G,K]),(0,O.jsxs)(`div`,{className:`webchat-page`,children:[i?.projectDir?(0,O.jsx)(ae,{sessionId:i.sessionId,projectDir:i.projectDir,sessionKey:e,renderItems:de,cleanViewToggle:r===`admin`,forceDeliveredOnly:r===`operator`},i.sessionId):i?!n||i.known?(0,O.jsx)(me,{cacheKey:e,userName:t}):(0,O.jsx)(`div`,{className:`webchat-greeting`,children:(0,O.jsx)(`p`,{className:`webchat-greeting-none`,children:`No transcript found for this session.`})}):null,(0,O.jsx)(`div`,{className:`webchat-composer`,children:(0,O.jsxs)(`div`,{className:`webchat-composer-box${oe?` drag-over`:``}`,onDragOver:e=>{e.preventDefault(),x(!0)},onDragLeave:()=>x(!1),onDrop:e=>{e.preventDefault(),x(!1),I([...e.dataTransfer.files])},children:[(0,O.jsx)(`input`,{ref:S,type:`file`,multiple:!0,accept:ee,style:{display:`none`},onChange:e=>{e.target.files&&I([...e.target.files]),e.target.value=``}}),!z&&(0,O.jsx)(`div`,{className:`webchat-resize-handle`,role:`separator`,"aria-orientation":`horizontal`,"aria-label":`Resize input — drag up to enlarge`,tabIndex:0,onPointerDown:F,onKeyDown:_e}),m.length>0&&(0,O.jsx)(`div`,{className:`attachment-strip`,children:m.map((e,t)=>(0,O.jsxs)(`div`,{className:`attachment-chip`,children:[L[t]?(0,O.jsx)(`img`,{src:L[t],alt:e.name,className:`attachment-chip-thumb`}):e.type.startsWith(`audio/`)?(0,O.jsx)(p,{size:14}):e.type===`application/pdf`?(0,O.jsx)(ie,{size:14}):(0,O.jsx)(g,{size:14}),(0,O.jsx)(`span`,{className:`attachment-chip-name`,children:e.name}),(0,O.jsx)(`button`,{type:`button`,className:`attachment-chip-remove`,onClick:()=>v(e=>e.filter((e,n)=>n!==t)),"aria-label":`Remove ${e.name}`,children:`×`})]},t))}),y&&(0,O.jsx)(`p`,{className:`attach-error`,children:y}),R.state===`error`&&R.errorMessage&&(0,O.jsxs)(`p`,{className:`voice-error`,role:`alert`,children:[(0,O.jsx)(p,{size:14}),R.errorMessage]}),z?(0,O.jsx)(`div`,{className:`webchat-input-row voice-active`,children:(0,O.jsx)(ne,{state:R.state,elapsedSeconds:R.elapsedSeconds,waveform:R.waveform,onTogglePause:R.togglePause,onDiscard:R.discard,onSend:()=>void ve()})}):(0,O.jsxs)(`div`,{className:`webchat-input-row`,children:[(0,O.jsx)(`textarea`,{ref:E,className:`webchat-input`,value:c,placeholder:`Message your agent…`,rows:2,style:w==null?void 0:{height:`${w}px`},disabled:W!==null,onChange:e=>l(e.target.value),onKeyDown:ye,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&&I(n)}}),(0,O.jsx)(`button`,{type:`button`,className:`webchat-send`,onClick:()=>void U(),disabled:u||c.trim().length===0&&m.length===0||W!==null,"aria-label":`Send`,title:`Send`,children:(0,O.jsx)(se,{size:16})})]}),W!==null&&(0,O.jsxs)(`p`,{className:`webchat-conflict-hint`,children:[`This session is bound to the `,W,` channel — message it there. The transcript stays readable here.`]}),(0,O.jsxs)(`div`,{className:`webchat-controls`,children:[(0,O.jsxs)(`div`,{className:`webchat-controls-left`,children:[(0,O.jsx)(`button`,{type:`button`,className:`webchat-control`,onClick:()=>S.current?.click(),disabled:W!==null,title:`Attach files`,"aria-label":`Attach`,children:(0,O.jsx)(o,{size:14})}),(0,O.jsx)(`button`,{type:`button`,className:`webchat-control`,onClick:R.start,disabled:z||W!==null,title:`Record voice note`,"aria-label":`Voice input`,children:(0,O.jsx)(p,{size:14})})]}),(0,O.jsxs)(`div`,{className:`webchat-controls-right`,children:[Ee&&(0,O.jsx)(`span`,{className:`webchat-settings-error`,role:`alert`,children:Ee}),Se&&(0,O.jsx)(a,{size:14,className:`spin webchat-busy`,"aria-label":`Agent is working`}),$&&(0,O.jsx)(he,{kind:`mode`,label:`Permission mode`,icon:(0,O.jsx)(le,{size:14}),options:P,selected:fe[$]??$,disabled:W!==null,onPick:e=>void Z(`mode`,e)}),(0,O.jsx)(he,{kind:`model`,label:`Model`,icon:(0,O.jsx)(f,{size:14}),options:ke.map(e=>({value:e,label:ue(e)})),selected:Q?ue(Q):null,disabled:W!==null,onPick:e=>void Z(`model`,e)}),(0,O.jsx)(ge,{icon:(0,O.jsx)(ce,{size:14}),value:De,index:Oe,disabled:W!==null,onPick:e=>void Z(`effort`,e)})]})]})]})})]})}function I({variant:e=`admin`}){let[t,n]=(0,D.useState)(null),[r]=(0,D.useState)(()=>{if(e===`operator`)return null;try{return new URLSearchParams(window.location.search).get(`session`)}catch{return null}}),[o,c]=(0,D.useState)(!1),[l,u]=(0,D.useState)(void 0),[f,ee]=(0,D.useState)(null),[p,m]=(0,D.useState)(void 0),[h,te]=(0,D.useState)(null),[g,ne]=(0,D.useState)(null);(0,D.useEffect)(()=>{let e=!1,t=null;try{t=sessionStorage.getItem(`maxy-admin-session-key`)}catch{}if(!t){n(null),c(!0);return}return fetch(`/api/admin/session?session_key=${encodeURIComponent(t)}`).then(async r=>{if(!e){if(r.status===401){try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`;return}if(r.ok)try{let e=await r.json();typeof e.businessName==`string`&&u(e.businessName),e.sessionId!==void 0&&ee(e.sessionId??null),ne(e.role??null),m(e.userName===void 0?null:e.userName),te(e.avatar??null)}catch{}n(t),c(!0)}}).catch(()=>{e||(n(t),c(!0))}),()=>{e=!0}},[]);let _=(0,D.useRef)(!1);(0,D.useEffect)(()=>{e!==`operator`||!o||!t||_.current||(_.current=!0,console.info(`[operator-ui] op=mount surface=chat sessionId=${(f??``).slice(0,8)}`))},[e,o,t,f]);let re=(0,D.useCallback)(()=>{try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`},[]),[ie,v]=(0,D.useState)(!1),ae=(0,D.useCallback)(async()=>{v(!0);try{let e=await s();if(e){try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`}return e}finally{v(!1)}},[]);return o?t?(0,O.jsx)(i,{cacheKey:t,surface:`chat`,onSessionExpired:({code:e,path:t})=>{console.warn(`[admin-auth] outcome=session-expired-redirect code=${e} path=${t} surface=chat`);try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`},children:(0,O.jsx)(d,{cacheKey:t,businessName:l,variant:e,sessionId:f,onLogout:re,onDisconnect:ae,disconnecting:ie,userName:p,userAvatar:h,role:g,children:(0,O.jsx)(_e,{cacheKey:t,userName:p??null,targetSessionId:r,variant:e})})}):(0,O.jsx)(`div`,{className:`data-page`,children:(0,O.jsxs)(`div`,{className:`data-empty`,children:[(0,O.jsx)(`p`,{children:`You are not signed in.`}),(0,O.jsxs)(`p`,{children:[`Open the `,(0,O.jsx)(`a`,{href:`/`,className:`data-link`,children:`main admin page`}),` and log in, then return here.`]})]})}):(0,O.jsx)(`div`,{className:`data-page`,children:(0,O.jsxs)(`div`,{className:`data-loading`,children:[(0,O.jsx)(a,{size:18,className:`spin`}),` Loading…`]})})}function L(){return(0,O.jsx)(I,{})}export{L as n,I as t};
@@ -1,6 +1,6 @@
1
- import{o as e}from"./chunk-Pqm5yXtL.js";import{a as t,i as n,r,t as i}from"./jsx-runtime-BabLCDgS.js";import{a,c as o,d as s,f as c,i as l,l as u,m as d,n as f,o as p,p as m,r as h,s as g,t as _,u as v}from"./audio-attachment-mime-BxI3Kl4_.js";import{a as y,c as b,i as x,l as S,n as C,o as w,r as T,t as E}from"./useSelectionMode-DcgaoBP6.js";import{t as D}from"./Checkbox-BHmeAgrw.js";var O=r(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),k=r(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),A=r(`square-check-big`,[[`path`,{d:`M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344`,key:`2acyp4`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),j=r(`square-plus`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]]),M=n(),N=e(t(),1);function P(){let[e,t]=(0,N.useState)(null),[n,r]=(0,N.useState)(null),[i,a]=(0,N.useState)(`loading`),[c,l]=(0,N.useState)(``),[d,f]=(0,N.useState)(null),[p,m]=(0,N.useState)(null),[h,g]=(0,N.useState)(!1),[_,y]=(0,N.useState)(null),b=(0,N.useMemo)(()=>o(),[]),x=(0,N.useMemo)(()=>u(),[]),[S,C]=(0,N.useState)(null),w=(0,N.useRef)(b||``),T=(0,N.useRef)(null),E=(0,N.useRef)(null),D=(0,N.useRef)(!1),O=(0,N.useRef)(null),[k,A]=(0,N.useState)(`request-link`),[j,M]=(0,N.useState)(null),P=(0,N.useRef)(null),F=(0,N.useRef)(null);(0,N.useEffect)(()=>{try{let e=sessionStorage.getItem(`maxy_session`);e&&(F.current=e)}catch{}},[]);let I=(0,N.useCallback)(e=>{T.current=e,t(e);try{sessionStorage.setItem(`maxy_session`,e)}catch{}a(`chat`)},[]),L=(0,N.useCallback)(()=>{T.current=null;try{sessionStorage.removeItem(`maxy_session`)}catch{}t(null),a(`auth-required`),A(`request-link`)},[]),R=(0,N.useCallback)(async e=>{A(`verifying`);try{let t=w.current,n=await fetch(`/api/access/verify-token`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:e,agentSlug:t})});if(window.history.replaceState({},``,window.location.pathname),n.ok){let e=await n.json().catch(()=>({}));return e?.displayName&&M({displayName:e.displayName,contactValue:``,expiresAt:null,status:`active`}),!0}return A(`verify-failed`),!1}catch{return A(`verify-failed`),!1}},[]),z=(0,N.useCallback)(async()=>{if(T.current)return T.current;if(E.current)return E.current;let e=(async()=>{try{let e=F.current,n=await fetch(`/api/session`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({session_id:v(),...b?{agent:b}:{},...x?{group_slug:x}:{},...e?{session_key:e}:{}})});if(!n.ok){let e=await n.json().catch(()=>({error:``}));return s&&console.error(`[session] POST /api/session failed: ${n.status} ${n.statusText}`,e),n.status===404?r(e.error||`Agent not found`):n.status===503&&r(e.error||`Service unavailable`),null}let i=await n.json();if(i.auth_required){i.agent_id&&(w.current=i.agent_id),l(i.displayName||``),i.agentImage&&f(i.agentImage),i.agentImageShape&&m(i.agentImageShape),i.showAgentName&&g(i.showAgentName),i.branding&&y(i.branding),a(`auth-required`);let e=new URLSearchParams(window.location.search).get(`token`);return e?await R(e)&&window.location.reload():A(`request-link`),null}T.current=i.session_key,t(i.session_key),i.displayName&&l(i.displayName),i.agentImage&&f(i.agentImage),i.agentImageShape&&m(i.agentImageShape),i.showAgentName&&g(i.showAgentName),i.branding&&y(i.branding),a(`chat`),i.resumed&&i.messages&&(D.current=!0,O.current=i.messages),i.group&&C({groupSlug:i.groupSlug,groupName:i.groupName,participants:i.participants??[]});try{sessionStorage.setItem(`maxy_session`,i.session_key)}catch{}return i.session_key}catch(e){return s&&console.error(`[session] fetch /api/session threw:`,e),r(`Unable to connect. Please check your connection and try again.`),null}finally{E.current=null}})();return E.current=e,e},[b,x,R]);return{sessionId:e,cacheKeyRef:T,sessionError:n,pageState:i,setPageState:a,agentDisplayName:c,agentImage:d,agentImageShape:p,showAgentName:h,agentSlug:b,branding:_,resolvedSlugRef:w,ensureSession:z,startNewSession:(0,N.useCallback)(async()=>{T.current=null,E.current=null,F.current=null,D.current=!1,O.current=null,t(null),r(null);try{sessionStorage.removeItem(`maxy_session`)}catch{}await z()},[z]),enterChat:I,enterGate:L,resumedRef:D,resumeMessagesRef:O,gateState:k,setGateState:A,grantInfo:j,setGrantInfo:M,gateCacheKeyRef:P,groupContext:S,groupSlug:x}}async function*F(e){let t=e.body?.getReader();if(!t)throw Error(`No response stream`);let n=new TextDecoder,r=``;try{for(;;){let{done:e,value:i}=await t.read();if(e)break;r+=n.decode(i,{stream:!0});let a=r.split(`
2
- `);r=a.pop();for(let e of a){if(!e.startsWith(`data: `))continue;let t=e.slice(6);if(t===`[DONE]`)continue;let n;try{n=JSON.parse(t)}catch{continue}yield n}}}finally{t.cancel()}}function I({cacheKeyRef:e,ensureSession:t,sessionError:n,pageState:r,inputRef:i,agentSlug:a}){let[o,c]=(0,N.useState)([]),[l,u]=(0,N.useState)(!1),d=(0,N.useRef)(!1),f=e=>{d.current=e,u(e)},p=(0,N.useCallback)(async(o,l)=>{let u=l?.hidden??!1,p=l?.files??[];if(!o&&p.length===0||d.current)return!1;f(!0);let m=p.map(e=>({filename:e.name,mimeType:e.type})),h={role:`visitor`,content:l?.displayContent??o,attachments:m.length>0?m:void 0,timestamp:Date.now(),hidden:u},g;c(e=>{let t=[...e,h,{role:`maxy`,content:``,timestamp:Date.now()}];return g=t.length-1,t});try{let n=await t();if(!n)throw Error(`session`);let r=e=>{if(p.length>0){let t=new FormData;t.append(`message`,o),t.append(`session_key`,e),a&&t.append(`agent`,a);for(let e of p)t.append(`attachments`,e);return{body:t,headers:{}}}return{body:JSON.stringify({message:o,session_key:e,...a?{agent:a}:{}}),headers:{"Content-Type":`application/json`}}},{body:i,headers:l}=r(n),u=await fetch(`/api/chat`,{method:`POST`,headers:l,body:i});if(u.status===401){e.current=null;try{sessionStorage.removeItem(`maxy_session`)}catch{}s&&console.warn(`[session-expired] stale key cleared, retrying with fresh session`);let n=await t();if(!n)throw Error(`session`);({body:i,headers:l}=r(n)),u=await fetch(`/api/chat`,{method:`POST`,headers:l,body:i})}if(!u.ok){let e=await u.json().catch(()=>({}));throw Error(e.error||`Something went wrong`)}let d=``,f=``,m=()=>{f&&(d+=f,f=``,c(e=>{let t=[...e];return t[g]={...t[g],content:d},t}))},h=setInterval(m,60);try{for await(let e of F(u)){if(e.error)throw Object.assign(Error(e.error),{fromSSE:!0});e.text&&(f+=e.text),e.type===`component`&&(m(),c(t=>{let n=[...t],r={...n[g]},i=[...r.components||[]];return i.push({name:e.name,data:e.data,submitted:!1}),n[g]={...r,components:i},n}))}}finally{clearInterval(h),m()}return!0}catch(e){if(s&&console.error(`[chat] sendMessage failed:`,e),r===`auth-required`)return!1;let t=e instanceof Error?e.message:String(e),i=e instanceof Error&&e.fromSSE;return c(e=>{let r=[...e];return r[g]={...r[g],content:i?t:t===`session`?n??`I'm having trouble connecting right now. Try refreshing the page.`:`Sorry, I hit a snag. Try again in a moment.`},r}),!1}finally{f(!1),r===`chat`&&i.current?.focus()}},[e,t,n,r,i,a]);return{messages:o,setMessages:c,isStreaming:l,sendMessage:p,handleComponentSubmit:(0,N.useCallback)((e,t,n)=>{c(n=>{let r=[...n],i={...r[e]},a=[...i.components||[]];return a[t]={...a[t],submitted:!0},r[e]={...i,components:a},r}),p(n,{hidden:!0})},[p])}}function L({cacheKeyRef:e,groupSlug:t,isStreaming:n,setMessages:r}){let i=(0,N.useRef)(new Date().toISOString()),a=(0,N.useRef)(!0);(0,N.useEffect)(()=>{let e=()=>{a.current=document.visibilityState===`visible`};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]);let o=(0,N.useCallback)(async()=>{let n=e.current;if(!(!n||!t))try{let e=await fetch(`/api/group/messages?session_key=${encodeURIComponent(n)}&since=${encodeURIComponent(i.current)}`);if(!e.ok)return;let t=await e.json();if(!t.messages||t.messages.length===0)return;let a=t.messages[t.messages.length-1];a.timestamp&&(i.current=new Date(a.timestamp).toISOString()),r(e=>{let n=new Set(e.filter(e=>e.messageId).map(e=>e.messageId)),r=t.messages.filter(e=>!n.has(e.messageId)).map(e=>({role:e.role,content:e.content,timestamp:e.timestamp,senderName:e.senderName??void 0,senderVisitorId:e.senderVisitorId??void 0,messageId:e.messageId}));if(r.length===0)return e;let i=[...e,...r];return i.sort((e,t)=>e.timestamp-t.timestamp),i})}catch(e){console.error(`[group-poll] failed: ${e instanceof Error?e.message:String(e)}`)}},[e,t,r]);(0,N.useEffect)(()=>{if(!t)return;let e,r=!1;function i(){if(r)return;let t=a.current?3e3:3e4;e=setTimeout(async()=>{n||await o(),i()},t)}return i(),()=>{r=!0,clearTimeout(e)}},[t,n,o])}var R=i();function z({gateState:e,setGateState:t,grantInfo:n,resolvedSlugRef:r}){let[i,a]=(0,N.useState)(``),[o,s]=(0,N.useState)(!1),[c,l]=(0,N.useState)(null);async function u(e){e.preventDefault();let n=i.trim().toLowerCase();if(!n){l(`Enter the email you were invited on.`);return}s(!0),l(null);try{let e=await fetch(`/api/access/request-magic-link`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({contactValue:n,agentSlug:r.current})});if(e.status===429){l((await e.json().catch(()=>({})))?.error||`Too many requests. Try again later.`);return}t(`request-sent`)}catch{l(`Could not reach the server. Check your connection and try again.`)}finally{s(!1)}}return(0,R.jsxs)(`div`,{className:`access-gate`,children:[e===`verifying`&&(0,R.jsxs)(`div`,{className:`access-gate-message`,children:[(0,R.jsx)(`h2`,{children:`Verifying your link…`}),(0,R.jsx)(`p`,{children:`This takes a moment.`})]}),e===`verify-failed`&&(0,R.jsxs)(`div`,{className:`access-gate-message`,children:[(0,R.jsx)(`h2`,{children:`That link did not work`}),(0,R.jsx)(`p`,{children:`It may have expired, already been used, or been for a different agent. You can request a fresh one below.`}),(0,R.jsx)(b,{onClick:()=>{t(`request-link`),l(null)},children:`Request a new link`})]}),e===`request-link`&&(0,R.jsxs)(`form`,{className:`access-gate-form`,onSubmit:u,children:[(0,R.jsx)(`h2`,{children:n?.displayName?`Welcome back, ${n.displayName}`:`Sign in`}),(0,R.jsx)(`p`,{children:`Enter the email you were invited on and we will send you a fresh link.`}),(0,R.jsx)(`label`,{htmlFor:`access-email`,children:`Email`}),(0,R.jsx)(`input`,{id:`access-email`,type:`email`,inputMode:`email`,autoComplete:`email`,value:i,onChange:e=>a(e.target.value),disabled:o}),c&&(0,R.jsx)(`p`,{className:`access-gate-error`,children:c}),(0,R.jsx)(b,{type:`submit`,disabled:o||!i.trim(),children:o?`Sending…`:`Send me a link`})]}),e===`request-sent`&&(0,R.jsxs)(`div`,{className:`access-gate-message`,children:[(0,R.jsx)(`h2`,{children:`Check your email`}),(0,R.jsx)(`p`,{children:`If that address is on the invite list, a fresh link is on the way. It expires in 15 minutes.`}),(0,R.jsx)(b,{onClick:()=>{t(`request-link`),a(``),l(null)},children:`Try a different email`})]})]})}function B(e){let t=new Date(e),n=new Date,r=String(t.getHours()).padStart(2,`0`),i=String(t.getMinutes()).padStart(2,`0`),a=String(t.getSeconds()).padStart(2,`0`);return t.toDateString()===n.toDateString()?`${r}:${i}:${a}`:`${String(t.getDate()).padStart(2,`0`)}-${String(t.getMonth()+1).padStart(2,`0`)}-${t.getFullYear()} ${r}:${i}:${a}`}function ee({messages:e,isStreaming:t,sessionError:n,selectionMode:r,selectedItems:i,toggleSelectItem:a,remainingSuggestions:o,onSuggestionClick:s,isAtBottom:c,setIsAtBottom:u,isGroup:f,sessionId:p}){let[h,g]=(0,N.useState)(new Set),[_,v]=(0,N.useState)(new Set),y=(0,N.useRef)(null),x=(0,N.useRef)(null),C=(0,N.useRef)(null),w=(0,N.useRef)(!1),T=(0,N.useRef)(!1),E=(0,N.useRef)(!1),O=(0,N.useRef)(0),k=(0,N.useRef)(!1),A=(0,N.useRef)(new Map);k.current=t,(0,N.useEffect)(()=>{t&&!w.current&&c&&(T.current=!0)},[t,c]),(0,N.useEffect)(()=>{if(!T.current&&!c){w.current=t,E.current=!1;return}if(w.current&&!t&&C.current&&x.current){let e=C.current;if(e.offsetHeight>x.current.clientHeight){T.current=!1,E.current=!0,e.scrollIntoView({behavior:`smooth`,block:`start`}),w.current=t;return}}(c||T.current)&&!E.current&&y.current?.scrollIntoView({behavior:`smooth`}),w.current&&!t&&(T.current=!1),w.current=t},[e,c,t]),(0,N.useEffect)(()=>{let e=x.current;if(!e)return;let t=()=>{let t=e.scrollTop;k.current&&t<O.current&&(T.current=!1),O.current=t,u(e.scrollHeight-e.scrollTop-e.clientHeight<80)};return e.addEventListener(`scroll`,t,{passive:!0}),t(),()=>e.removeEventListener(`scroll`,t)},[u]),(0,N.useEffect)(()=>{function e(){v(e=>{let t=new Set;return A.current.forEach((n,r)=>{n.isConnected&&(h.has(r)?e.has(r)&&t.add(r):n.scrollHeight>n.clientHeight+2&&t.add(r))}),e.size===t.size&&[...e].every(e=>t.has(e))?e:t})}e();let t=new ResizeObserver(e);return A.current.forEach(e=>t.observe(e)),()=>t.disconnect()},[e.length,h]);let j=[...e].sort((e,t)=>e.timestamp-t.timestamp);(0,N.useEffect)(()=>{r&&console.log(`[selection] entered`,{sessionId:p??`unknown`,order:j.map(e=>({ts:e.timestamp,role:e.role,id:e.messageId}))})},[r]);let M=j.reduce((e,t,n)=>t.role===`maxy`&&!t.hidden?n:e,-1);return(0,R.jsxs)(`div`,{className:`chat-messages-wrap`,children:[r&&(0,R.jsx)(`div`,{className:`selection-overlay-band`}),(0,R.jsxs)(`div`,{className:`chat-messages`,ref:x,children:[n&&e.length===0&&(0,R.jsx)(`div`,{className:`session-error`,children:(0,R.jsx)(`p`,{children:n})}),j.map((e,n)=>{if(e.hidden)return null;let o=t&&n===j.length-1,s=`${e.timestamp}_${e.role}`,c=i.has(s);return(0,R.jsxs)(`div`,{ref:n===M?C:void 0,className:`message ${e.role}${c?` selected`:``}`,children:[r&&!o&&(0,R.jsx)(`div`,{className:`message-select-check`,children:(0,R.jsx)(D,{checked:c,onChange:()=>a(s)})}),(0,R.jsxs)(`div`,{className:`bubble`,children:[f&&e.role===`visitor`&&e.senderName&&(0,R.jsx)(`span`,{className:`bubble-sender`,children:e.senderName}),e.role===`visitor`&&e.content?(()=>{let t=h.has(n),r=_.has(n);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{ref:e=>{e?A.current.set(n,e):A.current.delete(n)},className:t?`bubble-content`:`bubble-content clamped${r?` overflowing`:``}`,children:e.content}),r&&(0,R.jsx)(`div`,{className:`bubble-expand`,children:(0,R.jsx)(b,{variant:`icon`,className:t?`expanded`:``,onClick:()=>g(e=>{let t=new Set(e);return t.has(n)?t.delete(n):t.add(n),t}),"aria-label":t?`Collapse message`:`Expand message`,children:(0,R.jsx)(d,{size:14})})})]})})():e.content?(0,R.jsx)(l,{content:e.content,timestamp:B(e.timestamp)}):(0,R.jsxs)(`span`,{className:`typing-indicator`,children:[(0,R.jsx)(`span`,{className:`typing-dot`}),(0,R.jsx)(`span`,{className:`typing-dot`}),(0,R.jsx)(`span`,{className:`typing-dot`})]}),e.attachments&&e.attachments.length>0&&(0,R.jsx)(`div`,{className:`message-attachments`,children:e.attachments.map((e,t)=>(0,R.jsxs)(`span`,{className:`message-attachment-chip no-action`,children:[e.mimeType===`application/pdf`?(0,R.jsx)(S,{size:12}):e.mimeType.startsWith(`text/`)?(0,R.jsx)(m,{size:12}):null,(0,R.jsx)(`span`,{children:e.filename})]},t))}),e.role===`visitor`&&(0,R.jsx)(`span`,{className:`message-timestamp`,children:B(e.timestamp)})]})]},n)}),!t&&o.length>0&&(0,R.jsx)(`div`,{className:`chat-suggestions`,children:o.map(e=>(0,R.jsx)(b,{variant:`suggestion`,onClick:()=>s(e),children:e},e))}),(0,R.jsx)(`div`,{ref:y})]}),!c&&(0,R.jsx)(`button`,{className:`scroll-to-bottom`,onClick:()=>y.current?.scrollIntoView({behavior:`smooth`}),"aria-label":`Scroll to bottom`,children:(0,R.jsx)(d,{size:18})})]})}function te({selectedItems:e,messages:t,isStreaming:n,copySelected:r,selectAll:i,exitSelection:a,showCopyToast:o}){let[s,c]=(0,N.useState)(!1),l=(0,N.useRef)(null),u=(0,N.useRef)(!1);function d(e){let n=e.lastIndexOf(`_`),r=e.slice(0,n),i=e.slice(n+1),a=parseInt(r,10);return t.find(e=>e.timestamp===a&&e.role===i)?.content??``}function f(e,t){return parseInt(e.slice(0,e.lastIndexOf(`_`)),10)-parseInt(t.slice(0,t.lastIndexOf(`_`)),10)}function p(){let e=[...t].sort((e,t)=>e.timestamp-t.timestamp),n=[];for(let t of e){if(t.hidden||!t.content)continue;let e=t.role===`visitor`?`Visitor`:`Maxy`;n.push(`${e}:\n${t.content}`)}return n.join(`
1
+ import{o as e}from"./chunk-Pqm5yXtL.js";import{a as t,i as n,r,t as i}from"./jsx-runtime-sFVKdwlP.js";import{a,c as o,d as s,f as c,i as l,l as u,n as d,o as f,p,r as m,s as h,t as g,u as _}from"./audio-attachment-mime-j2VvxEtx.js";import{a as v,c as y,i as b,l as x,n as S,o as C,r as w,t as T}from"./useSelectionMode-Dky-Stnf.js";import{t as E}from"./Checkbox-DAWZItdK.js";var D=r(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),O=r(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),k=r(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),A=r(`square-check-big`,[[`path`,{d:`M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344`,key:`2acyp4`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),j=r(`square-plus`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]]),M=n(),N=e(t(),1);function P(){let[e,t]=(0,N.useState)(null),[n,r]=(0,N.useState)(null),[i,a]=(0,N.useState)(`loading`),[c,l]=(0,N.useState)(``),[d,f]=(0,N.useState)(null),[p,m]=(0,N.useState)(null),[h,g]=(0,N.useState)(!1),[v,y]=(0,N.useState)(null),b=(0,N.useMemo)(()=>o(),[]),x=(0,N.useMemo)(()=>u(),[]),[S,C]=(0,N.useState)(null),w=(0,N.useRef)(b||``),T=(0,N.useRef)(null),E=(0,N.useRef)(null),D=(0,N.useRef)(!1),O=(0,N.useRef)(null),[k,A]=(0,N.useState)(`request-link`),[j,M]=(0,N.useState)(null),P=(0,N.useRef)(null),F=(0,N.useRef)(null);(0,N.useEffect)(()=>{try{let e=sessionStorage.getItem(`maxy_session`);e&&(F.current=e)}catch{}},[]);let I=(0,N.useCallback)(e=>{T.current=e,t(e);try{sessionStorage.setItem(`maxy_session`,e)}catch{}a(`chat`)},[]),L=(0,N.useCallback)(()=>{T.current=null;try{sessionStorage.removeItem(`maxy_session`)}catch{}t(null),a(`auth-required`),A(`request-link`)},[]),R=(0,N.useCallback)(async e=>{A(`verifying`);try{let t=w.current,n=await fetch(`/api/access/verify-token`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:e,agentSlug:t})});if(window.history.replaceState({},``,window.location.pathname),n.ok){let e=await n.json().catch(()=>({}));return e?.displayName&&M({displayName:e.displayName,contactValue:``,expiresAt:null,status:`active`}),!0}return A(`verify-failed`),!1}catch{return A(`verify-failed`),!1}},[]),z=(0,N.useCallback)(async()=>{if(T.current)return T.current;if(E.current)return E.current;let e=(async()=>{try{let e=F.current,n=await fetch(`/api/session`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({session_id:_(),...b?{agent:b}:{},...x?{group_slug:x}:{},...e?{session_key:e}:{}})});if(!n.ok){let e=await n.json().catch(()=>({error:``}));return s&&console.error(`[session] POST /api/session failed: ${n.status} ${n.statusText}`,e),n.status===404?r(e.error||`Agent not found`):n.status===503&&r(e.error||`Service unavailable`),null}let i=await n.json();if(i.auth_required){i.agent_id&&(w.current=i.agent_id),l(i.displayName||``),i.agentImage&&f(i.agentImage),i.agentImageShape&&m(i.agentImageShape),i.showAgentName&&g(i.showAgentName),i.branding&&y(i.branding),a(`auth-required`);let e=new URLSearchParams(window.location.search).get(`token`);return e?await R(e)&&window.location.reload():A(`request-link`),null}T.current=i.session_key,t(i.session_key),i.displayName&&l(i.displayName),i.agentImage&&f(i.agentImage),i.agentImageShape&&m(i.agentImageShape),i.showAgentName&&g(i.showAgentName),i.branding&&y(i.branding),a(`chat`),i.resumed&&i.messages&&(D.current=!0,O.current=i.messages),i.group&&C({groupSlug:i.groupSlug,groupName:i.groupName,participants:i.participants??[]});try{sessionStorage.setItem(`maxy_session`,i.session_key)}catch{}return i.session_key}catch(e){return s&&console.error(`[session] fetch /api/session threw:`,e),r(`Unable to connect. Please check your connection and try again.`),null}finally{E.current=null}})();return E.current=e,e},[b,x,R]);return{sessionId:e,cacheKeyRef:T,sessionError:n,pageState:i,setPageState:a,agentDisplayName:c,agentImage:d,agentImageShape:p,showAgentName:h,agentSlug:b,branding:v,resolvedSlugRef:w,ensureSession:z,startNewSession:(0,N.useCallback)(async()=>{T.current=null,E.current=null,F.current=null,D.current=!1,O.current=null,t(null),r(null);try{sessionStorage.removeItem(`maxy_session`)}catch{}await z()},[z]),enterChat:I,enterGate:L,resumedRef:D,resumeMessagesRef:O,gateState:k,setGateState:A,grantInfo:j,setGrantInfo:M,gateCacheKeyRef:P,groupContext:S,groupSlug:x}}async function*F(e){let t=e.body?.getReader();if(!t)throw Error(`No response stream`);let n=new TextDecoder,r=``;try{for(;;){let{done:e,value:i}=await t.read();if(e)break;r+=n.decode(i,{stream:!0});let a=r.split(`
2
+ `);r=a.pop();for(let e of a){if(!e.startsWith(`data: `))continue;let t=e.slice(6);if(t===`[DONE]`)continue;let n;try{n=JSON.parse(t)}catch{continue}yield n}}}finally{t.cancel()}}function I({cacheKeyRef:e,ensureSession:t,sessionError:n,pageState:r,inputRef:i,agentSlug:a}){let[o,c]=(0,N.useState)([]),[l,u]=(0,N.useState)(!1),d=(0,N.useRef)(!1),f=e=>{d.current=e,u(e)},p=(0,N.useCallback)(async(o,l)=>{let u=l?.hidden??!1,p=l?.files??[];if(!o&&p.length===0||d.current)return!1;f(!0);let m=p.map(e=>({filename:e.name,mimeType:e.type})),h={role:`visitor`,content:l?.displayContent??o,attachments:m.length>0?m:void 0,timestamp:Date.now(),hidden:u},g;c(e=>{let t=[...e,h,{role:`maxy`,content:``,timestamp:Date.now()}];return g=t.length-1,t});try{let n=await t();if(!n)throw Error(`session`);let r=e=>{if(p.length>0){let t=new FormData;t.append(`message`,o),t.append(`session_key`,e),a&&t.append(`agent`,a);for(let e of p)t.append(`attachments`,e);return{body:t,headers:{}}}return{body:JSON.stringify({message:o,session_key:e,...a?{agent:a}:{}}),headers:{"Content-Type":`application/json`}}},{body:i,headers:l}=r(n),u=await fetch(`/api/chat`,{method:`POST`,headers:l,body:i});if(u.status===401){e.current=null;try{sessionStorage.removeItem(`maxy_session`)}catch{}s&&console.warn(`[session-expired] stale key cleared, retrying with fresh session`);let n=await t();if(!n)throw Error(`session`);({body:i,headers:l}=r(n)),u=await fetch(`/api/chat`,{method:`POST`,headers:l,body:i})}if(!u.ok){let e=await u.json().catch(()=>({}));throw Error(e.error||`Something went wrong`)}let d=``,f=``,m=()=>{f&&(d+=f,f=``,c(e=>{let t=[...e];return t[g]={...t[g],content:d},t}))},h=setInterval(m,60);try{for await(let e of F(u)){if(e.error)throw Object.assign(Error(e.error),{fromSSE:!0});e.text&&(f+=e.text),e.type===`component`&&(m(),c(t=>{let n=[...t],r={...n[g]},i=[...r.components||[]];return i.push({name:e.name,data:e.data,submitted:!1}),n[g]={...r,components:i},n}))}}finally{clearInterval(h),m()}return!0}catch(e){if(s&&console.error(`[chat] sendMessage failed:`,e),r===`auth-required`)return!1;let t=e instanceof Error?e.message:String(e),i=e instanceof Error&&e.fromSSE;return c(e=>{let r=[...e];return r[g]={...r[g],content:i?t:t===`session`?n??`I'm having trouble connecting right now. Try refreshing the page.`:`Sorry, I hit a snag. Try again in a moment.`},r}),!1}finally{f(!1),r===`chat`&&i.current?.focus()}},[e,t,n,r,i,a]);return{messages:o,setMessages:c,isStreaming:l,sendMessage:p,handleComponentSubmit:(0,N.useCallback)((e,t,n)=>{c(n=>{let r=[...n],i={...r[e]},a=[...i.components||[]];return a[t]={...a[t],submitted:!0},r[e]={...i,components:a},r}),p(n,{hidden:!0})},[p])}}function L({cacheKeyRef:e,groupSlug:t,isStreaming:n,setMessages:r}){let i=(0,N.useRef)(new Date().toISOString()),a=(0,N.useRef)(!0);(0,N.useEffect)(()=>{let e=()=>{a.current=document.visibilityState===`visible`};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]);let o=(0,N.useCallback)(async()=>{let n=e.current;if(!(!n||!t))try{let e=await fetch(`/api/group/messages?session_key=${encodeURIComponent(n)}&since=${encodeURIComponent(i.current)}`);if(!e.ok)return;let t=await e.json();if(!t.messages||t.messages.length===0)return;let a=t.messages[t.messages.length-1];a.timestamp&&(i.current=new Date(a.timestamp).toISOString()),r(e=>{let n=new Set(e.filter(e=>e.messageId).map(e=>e.messageId)),r=t.messages.filter(e=>!n.has(e.messageId)).map(e=>({role:e.role,content:e.content,timestamp:e.timestamp,senderName:e.senderName??void 0,senderVisitorId:e.senderVisitorId??void 0,messageId:e.messageId}));if(r.length===0)return e;let i=[...e,...r];return i.sort((e,t)=>e.timestamp-t.timestamp),i})}catch(e){console.error(`[group-poll] failed: ${e instanceof Error?e.message:String(e)}`)}},[e,t,r]);(0,N.useEffect)(()=>{if(!t)return;let e,r=!1;function i(){if(r)return;let t=a.current?3e3:3e4;e=setTimeout(async()=>{n||await o(),i()},t)}return i(),()=>{r=!0,clearTimeout(e)}},[t,n,o])}var R=i();function z({gateState:e,setGateState:t,grantInfo:n,resolvedSlugRef:r}){let[i,a]=(0,N.useState)(``),[o,s]=(0,N.useState)(!1),[c,l]=(0,N.useState)(null);async function u(e){e.preventDefault();let n=i.trim().toLowerCase();if(!n){l(`Enter the email you were invited on.`);return}s(!0),l(null);try{let e=await fetch(`/api/access/request-magic-link`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({contactValue:n,agentSlug:r.current})});if(e.status===429){l((await e.json().catch(()=>({})))?.error||`Too many requests. Try again later.`);return}t(`request-sent`)}catch{l(`Could not reach the server. Check your connection and try again.`)}finally{s(!1)}}return(0,R.jsxs)(`div`,{className:`access-gate`,children:[e===`verifying`&&(0,R.jsxs)(`div`,{className:`access-gate-message`,children:[(0,R.jsx)(`h2`,{children:`Verifying your link…`}),(0,R.jsx)(`p`,{children:`This takes a moment.`})]}),e===`verify-failed`&&(0,R.jsxs)(`div`,{className:`access-gate-message`,children:[(0,R.jsx)(`h2`,{children:`That link did not work`}),(0,R.jsx)(`p`,{children:`It may have expired, already been used, or been for a different agent. You can request a fresh one below.`}),(0,R.jsx)(y,{onClick:()=>{t(`request-link`),l(null)},children:`Request a new link`})]}),e===`request-link`&&(0,R.jsxs)(`form`,{className:`access-gate-form`,onSubmit:u,children:[(0,R.jsx)(`h2`,{children:n?.displayName?`Welcome back, ${n.displayName}`:`Sign in`}),(0,R.jsx)(`p`,{children:`Enter the email you were invited on and we will send you a fresh link.`}),(0,R.jsx)(`label`,{htmlFor:`access-email`,children:`Email`}),(0,R.jsx)(`input`,{id:`access-email`,type:`email`,inputMode:`email`,autoComplete:`email`,value:i,onChange:e=>a(e.target.value),disabled:o}),c&&(0,R.jsx)(`p`,{className:`access-gate-error`,children:c}),(0,R.jsx)(y,{type:`submit`,disabled:o||!i.trim(),children:o?`Sending…`:`Send me a link`})]}),e===`request-sent`&&(0,R.jsxs)(`div`,{className:`access-gate-message`,children:[(0,R.jsx)(`h2`,{children:`Check your email`}),(0,R.jsx)(`p`,{children:`If that address is on the invite list, a fresh link is on the way. It expires in 15 minutes.`}),(0,R.jsx)(y,{onClick:()=>{t(`request-link`),a(``),l(null)},children:`Try a different email`})]})]})}function B(e){let t=new Date(e),n=new Date,r=String(t.getHours()).padStart(2,`0`),i=String(t.getMinutes()).padStart(2,`0`),a=String(t.getSeconds()).padStart(2,`0`);return t.toDateString()===n.toDateString()?`${r}:${i}:${a}`:`${String(t.getDate()).padStart(2,`0`)}-${String(t.getMonth()+1).padStart(2,`0`)}-${t.getFullYear()} ${r}:${i}:${a}`}function ee({messages:e,isStreaming:t,sessionError:n,selectionMode:r,selectedItems:i,toggleSelectItem:a,remainingSuggestions:o,onSuggestionClick:s,isAtBottom:c,setIsAtBottom:u,isGroup:d,sessionId:f}){let[m,h]=(0,N.useState)(new Set),[g,_]=(0,N.useState)(new Set),v=(0,N.useRef)(null),b=(0,N.useRef)(null),S=(0,N.useRef)(null),C=(0,N.useRef)(!1),w=(0,N.useRef)(!1),T=(0,N.useRef)(!1),O=(0,N.useRef)(0),k=(0,N.useRef)(!1),A=(0,N.useRef)(new Map);k.current=t,(0,N.useEffect)(()=>{t&&!C.current&&c&&(w.current=!0)},[t,c]),(0,N.useEffect)(()=>{if(!w.current&&!c){C.current=t,T.current=!1;return}if(C.current&&!t&&S.current&&b.current){let e=S.current;if(e.offsetHeight>b.current.clientHeight){w.current=!1,T.current=!0,e.scrollIntoView({behavior:`smooth`,block:`start`}),C.current=t;return}}(c||w.current)&&!T.current&&v.current?.scrollIntoView({behavior:`smooth`}),C.current&&!t&&(w.current=!1),C.current=t},[e,c,t]),(0,N.useEffect)(()=>{let e=b.current;if(!e)return;let t=()=>{let t=e.scrollTop;k.current&&t<O.current&&(w.current=!1),O.current=t,u(e.scrollHeight-e.scrollTop-e.clientHeight<80)};return e.addEventListener(`scroll`,t,{passive:!0}),t(),()=>e.removeEventListener(`scroll`,t)},[u]),(0,N.useEffect)(()=>{function e(){_(e=>{let t=new Set;return A.current.forEach((n,r)=>{n.isConnected&&(m.has(r)?e.has(r)&&t.add(r):n.scrollHeight>n.clientHeight+2&&t.add(r))}),e.size===t.size&&[...e].every(e=>t.has(e))?e:t})}e();let t=new ResizeObserver(e);return A.current.forEach(e=>t.observe(e)),()=>t.disconnect()},[e.length,m]);let j=[...e].sort((e,t)=>e.timestamp-t.timestamp);(0,N.useEffect)(()=>{r&&console.log(`[selection] entered`,{sessionId:f??`unknown`,order:j.map(e=>({ts:e.timestamp,role:e.role,id:e.messageId}))})},[r]);let M=j.reduce((e,t,n)=>t.role===`maxy`&&!t.hidden?n:e,-1);return(0,R.jsxs)(`div`,{className:`chat-messages-wrap`,children:[r&&(0,R.jsx)(`div`,{className:`selection-overlay-band`}),(0,R.jsxs)(`div`,{className:`chat-messages`,ref:b,children:[n&&e.length===0&&(0,R.jsx)(`div`,{className:`session-error`,children:(0,R.jsx)(`p`,{children:n})}),j.map((e,n)=>{if(e.hidden)return null;let o=t&&n===j.length-1,s=`${e.timestamp}_${e.role}`,c=i.has(s);return(0,R.jsxs)(`div`,{ref:n===M?S:void 0,className:`message ${e.role}${c?` selected`:``}`,children:[r&&!o&&(0,R.jsx)(`div`,{className:`message-select-check`,children:(0,R.jsx)(E,{checked:c,onChange:()=>a(s)})}),(0,R.jsxs)(`div`,{className:`bubble`,children:[d&&e.role===`visitor`&&e.senderName&&(0,R.jsx)(`span`,{className:`bubble-sender`,children:e.senderName}),e.role===`visitor`&&e.content?(()=>{let t=m.has(n),r=g.has(n);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{ref:e=>{e?A.current.set(n,e):A.current.delete(n)},className:t?`bubble-content`:`bubble-content clamped${r?` overflowing`:``}`,children:e.content}),r&&(0,R.jsx)(`div`,{className:`bubble-expand`,children:(0,R.jsx)(y,{variant:`icon`,className:t?`expanded`:``,onClick:()=>h(e=>{let t=new Set(e);return t.has(n)?t.delete(n):t.add(n),t}),"aria-label":t?`Collapse message`:`Expand message`,children:(0,R.jsx)(D,{size:14})})})]})})():e.content?(0,R.jsx)(l,{content:e.content,timestamp:B(e.timestamp)}):(0,R.jsxs)(`span`,{className:`typing-indicator`,children:[(0,R.jsx)(`span`,{className:`typing-dot`}),(0,R.jsx)(`span`,{className:`typing-dot`}),(0,R.jsx)(`span`,{className:`typing-dot`})]}),e.attachments&&e.attachments.length>0&&(0,R.jsx)(`div`,{className:`message-attachments`,children:e.attachments.map((e,t)=>(0,R.jsxs)(`span`,{className:`message-attachment-chip no-action`,children:[e.mimeType===`application/pdf`?(0,R.jsx)(x,{size:12}):e.mimeType.startsWith(`text/`)?(0,R.jsx)(p,{size:12}):null,(0,R.jsx)(`span`,{children:e.filename})]},t))}),e.role===`visitor`&&(0,R.jsx)(`span`,{className:`message-timestamp`,children:B(e.timestamp)})]})]},n)}),!t&&o.length>0&&(0,R.jsx)(`div`,{className:`chat-suggestions`,children:o.map(e=>(0,R.jsx)(y,{variant:`suggestion`,onClick:()=>s(e),children:e},e))}),(0,R.jsx)(`div`,{ref:v})]}),!c&&(0,R.jsx)(`button`,{className:`scroll-to-bottom`,onClick:()=>v.current?.scrollIntoView({behavior:`smooth`}),"aria-label":`Scroll to bottom`,children:(0,R.jsx)(D,{size:18})})]})}function te({selectedItems:e,messages:t,isStreaming:n,copySelected:r,selectAll:i,exitSelection:a,showCopyToast:o}){let[s,c]=(0,N.useState)(!1),l=(0,N.useRef)(null),u=(0,N.useRef)(!1);function d(e){let n=e.lastIndexOf(`_`),r=e.slice(0,n),i=e.slice(n+1),a=parseInt(r,10);return t.find(e=>e.timestamp===a&&e.role===i)?.content??``}function f(e,t){return parseInt(e.slice(0,e.lastIndexOf(`_`)),10)-parseInt(t.slice(0,t.lastIndexOf(`_`)),10)}function p(){let e=[...t].sort((e,t)=>e.timestamp-t.timestamp),n=[];for(let t of e){if(t.hidden||!t.content)continue;let e=t.role===`visitor`?`Visitor`:`Maxy`;n.push(`${e}:\n${t.content}`)}return n.join(`
3
3
 
4
4
  ---
5
5
 
6
- `)}N.useEffect(()=>{if(!s)return;let e=e=>{e.target.closest(`.selection-copy-wrap`)||c(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[s]);function m(){l.current!==null&&(clearTimeout(l.current),l.current=null)}let h=[...t].sort((e,t)=>e.timestamp-t.timestamp),g=h.reduce((e,t,r)=>(t.hidden||n&&r===h.length-1||e.push(`${t.timestamp}_${t.role}`),e),[]),_=g.length>0&&g.every(t=>e.has(t));return(0,R.jsx)(`div`,{className:`chat-input-area`,children:(0,R.jsxs)(`div`,{className:`selection-bar`,children:[(0,R.jsxs)(`div`,{className:`selection-bar-left`,children:[(0,R.jsxs)(`button`,{type:`button`,className:`selection-select-all`,onClick:()=>i(g),disabled:g.length===0,"aria-label":_?`Deselect all`:`Select all`,title:_?`Deselect all`:`Select all`,children:[(0,R.jsx)(A,{size:16}),(0,R.jsx)(`span`,{children:_?`Deselect all`:`Select all`})]}),(0,R.jsxs)(`span`,{className:`selection-count`,children:[e.size,` Selected`]})]}),(0,R.jsxs)(`div`,{className:`selection-copy-wrap`,children:[(0,R.jsxs)(`button`,{type:`button`,className:`selection-copy`,onPointerDown:()=>{if(s){c(!1);return}u.current=!1,l.current=setTimeout(()=>{u.current=!0,c(!0),l.current=null},500)},onPointerUp:m,onPointerLeave:m,onPointerCancel:m,onClick:async()=>{u.current||await r(d,f)},children:[(0,R.jsx)(O,{size:18}),(0,R.jsx)(`span`,{children:`Copy`})]}),s&&(0,R.jsx)(`div`,{className:`copy-menu`,children:(0,R.jsx)(`button`,{type:`button`,className:`copy-menu-item`,onClick:async()=>{let e=p();e&&o(await E(e)),a()},children:`Copy all`})})]}),(0,R.jsx)(`button`,{type:`button`,className:`selection-cancel`,onClick:a,children:`Cancel`})]})})}var V=44,H=(0,N.forwardRef)(function({value:e,onChange:t,placeholder:n,disabled:r},i){let a=(0,N.useRef)(null),o=(0,N.useRef)(!1),s=(0,N.useCallback)((e,t)=>{let n=e.closest(`.chat-form`);n&&(n.dataset.expanded=t>V?`true`:``)},[]),c=(0,N.useCallback)(e=>{if(o.current)return;let t=window.innerHeight*.75;e.style.height=`auto`;let n=Math.min(e.scrollHeight,t);e.style.height=`${n}px`,e.style.overflowY=e.scrollHeight>t?`auto`:`hidden`,s(e,n)},[s]);return(0,N.useImperativeHandle)(i,()=>({focus(){a.current?.focus()},resetHeight(){if(!a.current)return;o.current=!1,a.current.style.height=``,a.current.style.overflowY=``;let e=a.current.closest(`.chat-form`);e&&(e.dataset.expanded=``)},getOffsetHeight(){return a.current?.offsetHeight??36},setHeight(e){a.current&&(o.current=!0,a.current.style.height=`${e}px`,s(a.current,e))}})),(0,R.jsx)(`textarea`,{ref:a,className:`chat-input`,rows:1,value:e,onChange:e=>{t(e.target.value),c(e.target)},onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),e.currentTarget.closest(`form`)?.requestSubmit())},placeholder:n,disabled:r,"aria-label":n||`Type a message...`})});function U({inputRef:e}){let t=(0,N.useRef)(null);function n(n){e.current&&(n.preventDefault(),n.target.setPointerCapture(n.pointerId),t.current={startY:n.clientY,startH:e.current.getOffsetHeight()})}function r(n){if(!t.current||!e.current)return;let r=t.current.startY-n.clientY,i=window.innerHeight*.75,a=Math.max(36,Math.min(i,t.current.startH+r));e.current.setHeight(a)}function i(){t.current=null}return(0,R.jsx)(`div`,{className:`chat-resize-handle`,onPointerDown:n,onPointerMove:r,onPointerUp:i,"aria-label":`Resize input`,children:(0,R.jsx)(`div`,{className:`chat-resize-handle-bar`})})}function ne({input:e,setInput:t,placeholder:n,isStreaming:r,pendingFiles:i,setPendingFiles:o,attachError:s,setAttachError:l,isDragOver:u,setIsDragOver:d,inputRef:v,onSubmit:y,onSendVoiceNote:x}){let C=(0,N.useRef)(null),w=f(),T=w.state===`recording`||w.state===`paused`||w.state===`sending`,E=!T&&!r&&!e.trim()&&i.length===0;async function D(){let e=await w.send();if(!e)return;let t=e.type===`audio/ogg`?`.ogg`:e.type===`audio/mp4`?`.m4a`:`.webm`;x(new File([e],`voice-note${t}`,{type:e.type}))}function O(e){l(null);let t=e.find(e=>!_(e.type,g));if(t){l(`Unsupported file type: "${t.type}". Supported: images, PDF, plain text, markdown, CSV, calendar, voice notes.`);return}let n=e.find(e=>e.size>p);if(n){l(`"${n.name}" exceeds the 50 MB limit.`);return}o(t=>[...t,...e].slice(0,5))}function A(e){e.preventDefault(),d(!0)}function j(){d(!1)}function M(e){e.preventDefault(),d(!1),O([...e.dataTransfer.files])}return(0,R.jsxs)(`div`,{className:`chat-input-area`,children:[(0,R.jsx)(`input`,{ref:C,type:`file`,multiple:!0,accept:a,style:{display:`none`},onChange:e=>{e.target.files&&O([...e.target.files]),e.target.value=``}}),i.length>0&&(0,R.jsx)(`div`,{className:`attachment-strip`,children:i.map((e,t)=>(0,R.jsxs)(`div`,{className:`attachment-chip`,children:[e.type.startsWith(`image/`)?(0,R.jsx)(`img`,{src:URL.createObjectURL(e),alt:e.name,className:`attachment-chip-thumb`}):e.type.startsWith(`audio/`)?(0,R.jsx)(c,{size:14}):e.type===`application/pdf`?(0,R.jsx)(S,{size:14}):(0,R.jsx)(m,{size:14}),(0,R.jsx)(`span`,{className:`attachment-chip-name`,children:e.name}),(0,R.jsx)(`button`,{type:`button`,className:`attachment-chip-remove`,onClick:()=>o(e=>e.filter((e,n)=>n!==t)),"aria-label":`Remove ${e.name}`,children:`×`})]},t))}),s&&(0,R.jsx)(`p`,{className:`attach-error`,children:s}),w.state===`error`&&w.errorMessage&&(0,R.jsxs)(`p`,{className:`voice-error`,role:`alert`,children:[(0,R.jsx)(c,{size:14}),w.errorMessage]}),(0,R.jsx)(U,{inputRef:v}),T?(0,R.jsx)(`div`,{className:`chat-form voice-active`,children:(0,R.jsx)(h,{state:w.state,elapsedSeconds:w.elapsedSeconds,waveform:w.waveform,onTogglePause:w.togglePause,onDiscard:w.discard,onSend:D})}):(0,R.jsxs)(`form`,{className:`chat-form${u?` drag-over`:``}`,onSubmit:y,onDragOver:A,onDragLeave:j,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&&O(n)},children:[(0,R.jsx)(b,{variant:`icon`,type:`button`,onClick:()=>C.current?.click(),disabled:r,"aria-label":`Attach file`,children:(0,R.jsx)(k,{size:14})}),(0,R.jsx)(H,{ref:v,value:e,onChange:t,placeholder:n}),E?(0,R.jsx)(b,{variant:`send`,type:`button`,onClick:w.start,disabled:r,"aria-label":`Record voice note`,children:(0,R.jsx)(c,{size:14})}):(0,R.jsx)(b,{variant:`send`,type:`submit`,disabled:r||!e.trim()&&i.length===0,"aria-label":`Send message`,children:(0,R.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`}),(0,R.jsx)(`polyline`,{points:`12 5 19 12 12 19`})]})})]})]})}var W=[];function G(){let[e,t]=(0,N.useState)(``),[n,r]=(0,N.useState)([]),[i,a]=(0,N.useState)(!1),[o,s]=(0,N.useState)(null),[c,l]=(0,N.useState)(W),[u,d]=(0,N.useState)(!0),f=(0,N.useRef)(null),{selectionMode:p,selectedItems:m,copyToast:h,exitSelection:g,enterSelection:_,toggleSelectItem:v,selectAll:b,copySelected:S,showCopyToast:E}=C(),D=P(),{sessionId:O,cacheKeyRef:k,sessionError:M,pageState:F,agentDisplayName:B,agentImage:V,agentImageShape:H,showAgentName:U,branding:G,agentSlug:re,ensureSession:K,startNewSession:ie,resumedRef:ae,resumeMessagesRef:q,groupContext:J,groupSlug:oe}=D,{messages:Y,setMessages:X,isStreaming:Z,sendMessage:Q}=I({cacheKeyRef:k,ensureSession:K,sessionError:M,pageState:F,inputRef:f,agentSlug:re});L({cacheKeyRef:k,groupSlug:oe,isStreaming:Z,setMessages:X}),(0,N.useEffect)(()=>{let e=!1;return(async()=>{let t=await K();if(!e&&t&&ae.current&&q.current&&q.current.length>0){let e=q.current.map(e=>({role:e.role,content:e.content,timestamp:e.timestamp}));e.sort((e,t)=>e.timestamp-t.timestamp),X(e),q.current=null}})(),()=>{e=!0}},[]),(0,N.useEffect)(()=>{F===`chat`&&f.current?.focus()},[F]),(0,N.useEffect)(()=>{if(F!==`chat`)return;history.pushState({maxyChat:!0},``);function e(){history.pushState({maxyChat:!0},``)}return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[F]),(0,N.useEffect)(()=>{if(!G)return;let e=document.body;if(G.primaryColor&&(e.style.setProperty(`--sage`,G.primaryColor),e.style.setProperty(`--sage-hover`,G.primaryColor),e.style.setProperty(`--sage-subtle`,G.primaryColor+`14`),e.style.setProperty(`--sage-glow`,G.primaryColor+`26`)),document.title=G.name,G.primaryColor){let e=document.querySelector(`meta[name="theme-color"]`);e||(e=document.createElement(`meta`),e.name=`theme-color`,document.head.appendChild(e)),e.content=G.primaryColor}if(G.faviconUrl){let e=document.querySelector(`link[rel="icon"]`);e||(e=document.createElement(`link`),e.rel=`icon`,document.head.appendChild(e)),e.href=G.faviconUrl}},[G]),(0,N.useEffect)(()=>{function e(e){e.key===`Escape`&&p&&g()}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[p,g]);function se(){Z||(X([]),l(W),ie())}function $(e){if(!e&&n.length===0||Z)return;X(e=>e.map(e=>e.components?.some(e=>!e.submitted)?{...e,components:e.components.map(e=>e.submitted?e:{...e,submitted:!0})}:e)),l(t=>t.filter(t=>t!==e)),d(!0);let i=[...n];t(``),r([]),s(null),Q(e,{files:i})}function ce(t){t.preventDefault(),$(e.trim()),f.current?.resetHeight()}let le=G?.name||B||T.productName,ue=J?void 0:`Chat with ${le}.`;return(0,R.jsxs)(`div`,{className:`chat-page`,children:[(0,R.jsxs)(`header`,{className:`chat-header`,children:[(0,R.jsx)(`img`,{src:V||G?.logoUrl||w,alt:G?.name||T.productName,className:`chat-logo${V&&H===`circle`?` chat-logo--circle`:``}${V&&H===`rounded`?` chat-logo--rounded`:``}`,onError:e=>{e.target.src=G?.logoUrl||w}}),(0,R.jsxs)(`div`,{className:`chat-header-text`,children:[U!==`none`&&(0,R.jsx)(`h1`,{className:`chat-tagline`,children:J?.groupName||U&&B||G?.name||T.productName}),(0,R.jsx)(`p`,{className:`chat-intro`,children:J?`${J.participants.length} participants`:G?.tagline||``}),(0,R.jsx)(`p`,{className:`chat-ai-indicator`,children:`AI assistant`})]}),F===`chat`&&!p&&(0,R.jsxs)(`div`,{className:`chat-header-actions`,children:[(0,R.jsx)(`button`,{className:`chat-header-action`,onClick:se,disabled:Z,title:`New conversation`,"aria-label":`New conversation`,children:(0,R.jsx)(j,{size:16})}),(0,R.jsx)(`button`,{className:`chat-header-action`,onClick:_,title:`Select messages`,"aria-label":`Select messages`,children:(0,R.jsx)(A,{size:16})})]})]}),F===`loading`&&(0,R.jsx)(`div`,{className:`gate-wrap`,children:(0,R.jsx)(`div`,{className:`gate-loading`,children:(0,R.jsx)(`span`,{className:`spinner`})})}),F===`auth-required`&&(0,R.jsx)(z,{gateState:D.gateState,setGateState:D.setGateState,grantInfo:D.grantInfo,resolvedSlugRef:D.resolvedSlugRef}),F===`chat`&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(ee,{messages:Y,isStreaming:Z,sessionError:M,selectionMode:p,selectedItems:m,toggleSelectItem:v,remainingSuggestions:c,onSuggestionClick:$,isAtBottom:u,setIsAtBottom:d,isGroup:!!J,sessionId:O}),p?(0,R.jsx)(te,{selectedItems:m,messages:Y,isStreaming:Z,copySelected:S,selectAll:b,exitSelection:g,showCopyToast:E}):(0,R.jsx)(ne,{input:e,setInput:t,placeholder:ue,isStreaming:Z,pendingFiles:n,setPendingFiles:r,attachError:o,setAttachError:s,isDragOver:i,setIsDragOver:a,inputRef:f,onSubmit:ce,onSendVoiceNote:async e=>{t(``),r([]),s(null),await Q(``,{files:[e],displayContent:`[Voice note]`})||r(t=>[...t,e])}})]}),h&&(0,R.jsx)(`span`,{className:`copy-toast${h===`failed`?` copy-toast-failed`:``}`,children:h===`copied`?`Copied`:`Copy failed`}),(0,R.jsxs)(`footer`,{className:`chat-footer`,children:[(0,R.jsxs)(`a`,{href:y,children:[x,` `,`↗`]}),O&&(0,R.jsxs)(`span`,{style:{opacity:.35,fontSize:`10px`,fontFamily:`monospace`,marginLeft:`1rem`},children:[`Conversation · `,O.slice(0,8)]})]})]})}(0,M.createRoot)(document.getElementById(`root`)).render((0,R.jsx)(G,{}));
6
+ `)}N.useEffect(()=>{if(!s)return;let e=e=>{e.target.closest(`.selection-copy-wrap`)||c(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[s]);function m(){l.current!==null&&(clearTimeout(l.current),l.current=null)}let h=[...t].sort((e,t)=>e.timestamp-t.timestamp),g=h.reduce((e,t,r)=>(t.hidden||n&&r===h.length-1||e.push(`${t.timestamp}_${t.role}`),e),[]),_=g.length>0&&g.every(t=>e.has(t));return(0,R.jsx)(`div`,{className:`chat-input-area`,children:(0,R.jsxs)(`div`,{className:`selection-bar`,children:[(0,R.jsxs)(`div`,{className:`selection-bar-left`,children:[(0,R.jsxs)(`button`,{type:`button`,className:`selection-select-all`,onClick:()=>i(g),disabled:g.length===0,"aria-label":_?`Deselect all`:`Select all`,title:_?`Deselect all`:`Select all`,children:[(0,R.jsx)(A,{size:16}),(0,R.jsx)(`span`,{children:_?`Deselect all`:`Select all`})]}),(0,R.jsxs)(`span`,{className:`selection-count`,children:[e.size,` Selected`]})]}),(0,R.jsxs)(`div`,{className:`selection-copy-wrap`,children:[(0,R.jsxs)(`button`,{type:`button`,className:`selection-copy`,onPointerDown:()=>{if(s){c(!1);return}u.current=!1,l.current=setTimeout(()=>{u.current=!0,c(!0),l.current=null},500)},onPointerUp:m,onPointerLeave:m,onPointerCancel:m,onClick:async()=>{u.current||await r(d,f)},children:[(0,R.jsx)(O,{size:18}),(0,R.jsx)(`span`,{children:`Copy`})]}),s&&(0,R.jsx)(`div`,{className:`copy-menu`,children:(0,R.jsx)(`button`,{type:`button`,className:`copy-menu-item`,onClick:async()=>{let e=p();e&&o(await T(e)),a()},children:`Copy all`})})]}),(0,R.jsx)(`button`,{type:`button`,className:`selection-cancel`,onClick:a,children:`Cancel`})]})})}var V=44,H=(0,N.forwardRef)(function({value:e,onChange:t,placeholder:n,disabled:r},i){let a=(0,N.useRef)(null),o=(0,N.useRef)(!1),s=(0,N.useCallback)((e,t)=>{let n=e.closest(`.chat-form`);n&&(n.dataset.expanded=t>V?`true`:``)},[]),c=(0,N.useCallback)(e=>{if(o.current)return;let t=window.innerHeight*.75;e.style.height=`auto`;let n=Math.min(e.scrollHeight,t);e.style.height=`${n}px`,e.style.overflowY=e.scrollHeight>t?`auto`:`hidden`,s(e,n)},[s]);return(0,N.useImperativeHandle)(i,()=>({focus(){a.current?.focus()},resetHeight(){if(!a.current)return;o.current=!1,a.current.style.height=``,a.current.style.overflowY=``;let e=a.current.closest(`.chat-form`);e&&(e.dataset.expanded=``)},getOffsetHeight(){return a.current?.offsetHeight??36},setHeight(e){a.current&&(o.current=!0,a.current.style.height=`${e}px`,s(a.current,e))}})),(0,R.jsx)(`textarea`,{ref:a,className:`chat-input`,rows:1,value:e,onChange:e=>{t(e.target.value),c(e.target)},onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),e.currentTarget.closest(`form`)?.requestSubmit())},placeholder:n,disabled:r,"aria-label":n||`Type a message...`})});function U({inputRef:e}){let t=(0,N.useRef)(null);function n(n){e.current&&(n.preventDefault(),n.target.setPointerCapture(n.pointerId),t.current={startY:n.clientY,startH:e.current.getOffsetHeight()})}function r(n){if(!t.current||!e.current)return;let r=t.current.startY-n.clientY,i=window.innerHeight*.75,a=Math.max(36,Math.min(i,t.current.startH+r));e.current.setHeight(a)}function i(){t.current=null}return(0,R.jsx)(`div`,{className:`chat-resize-handle`,onPointerDown:n,onPointerMove:r,onPointerUp:i,"aria-label":`Resize input`,children:(0,R.jsx)(`div`,{className:`chat-resize-handle-bar`})})}function ne({input:e,setInput:t,placeholder:n,isStreaming:r,pendingFiles:i,setPendingFiles:o,attachError:s,setAttachError:l,isDragOver:u,setIsDragOver:_,inputRef:v,onSubmit:b,onSendVoiceNote:S}){let C=(0,N.useRef)(null),w=d(),T=w.state===`recording`||w.state===`paused`||w.state===`sending`,E=!T&&!r&&!e.trim()&&i.length===0;async function D(){let e=await w.send();if(!e)return;let t=e.type===`audio/ogg`?`.ogg`:e.type===`audio/mp4`?`.m4a`:`.webm`;S(new File([e],`voice-note${t}`,{type:e.type}))}function O(e){l(null);let t=e.find(e=>!g(e.type,h));if(t){l(`Unsupported file type: "${t.type}". Supported: images, PDF, plain text, markdown, CSV, calendar, voice notes.`);return}let n=e.find(e=>e.size>f);if(n){l(`"${n.name}" exceeds the 50 MB limit.`);return}o(t=>[...t,...e].slice(0,5))}function A(e){e.preventDefault(),_(!0)}function j(){_(!1)}function M(e){e.preventDefault(),_(!1),O([...e.dataTransfer.files])}return(0,R.jsxs)(`div`,{className:`chat-input-area`,children:[(0,R.jsx)(`input`,{ref:C,type:`file`,multiple:!0,accept:a,style:{display:`none`},onChange:e=>{e.target.files&&O([...e.target.files]),e.target.value=``}}),i.length>0&&(0,R.jsx)(`div`,{className:`attachment-strip`,children:i.map((e,t)=>(0,R.jsxs)(`div`,{className:`attachment-chip`,children:[e.type.startsWith(`image/`)?(0,R.jsx)(`img`,{src:URL.createObjectURL(e),alt:e.name,className:`attachment-chip-thumb`}):e.type.startsWith(`audio/`)?(0,R.jsx)(c,{size:14}):e.type===`application/pdf`?(0,R.jsx)(x,{size:14}):(0,R.jsx)(p,{size:14}),(0,R.jsx)(`span`,{className:`attachment-chip-name`,children:e.name}),(0,R.jsx)(`button`,{type:`button`,className:`attachment-chip-remove`,onClick:()=>o(e=>e.filter((e,n)=>n!==t)),"aria-label":`Remove ${e.name}`,children:`×`})]},t))}),s&&(0,R.jsx)(`p`,{className:`attach-error`,children:s}),w.state===`error`&&w.errorMessage&&(0,R.jsxs)(`p`,{className:`voice-error`,role:`alert`,children:[(0,R.jsx)(c,{size:14}),w.errorMessage]}),(0,R.jsx)(U,{inputRef:v}),T?(0,R.jsx)(`div`,{className:`chat-form voice-active`,children:(0,R.jsx)(m,{state:w.state,elapsedSeconds:w.elapsedSeconds,waveform:w.waveform,onTogglePause:w.togglePause,onDiscard:w.discard,onSend:D})}):(0,R.jsxs)(`form`,{className:`chat-form${u?` drag-over`:``}`,onSubmit:b,onDragOver:A,onDragLeave:j,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&&O(n)},children:[(0,R.jsx)(y,{variant:`icon`,type:`button`,onClick:()=>C.current?.click(),disabled:r,"aria-label":`Attach file`,children:(0,R.jsx)(k,{size:14})}),(0,R.jsx)(H,{ref:v,value:e,onChange:t,placeholder:n}),E?(0,R.jsx)(y,{variant:`send`,type:`button`,onClick:w.start,disabled:r,"aria-label":`Record voice note`,children:(0,R.jsx)(c,{size:14})}):(0,R.jsx)(y,{variant:`send`,type:`submit`,disabled:r||!e.trim()&&i.length===0,"aria-label":`Send message`,children:(0,R.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`}),(0,R.jsx)(`polyline`,{points:`12 5 19 12 12 19`})]})})]})]})}var W=[];function G(){let[e,t]=(0,N.useState)(``),[n,r]=(0,N.useState)([]),[i,a]=(0,N.useState)(!1),[o,s]=(0,N.useState)(null),[c,l]=(0,N.useState)(W),[u,d]=(0,N.useState)(!0),f=(0,N.useRef)(null),{selectionMode:p,selectedItems:m,copyToast:h,exitSelection:g,enterSelection:_,toggleSelectItem:y,selectAll:x,copySelected:T,showCopyToast:E}=S(),D=P(),{sessionId:O,cacheKeyRef:k,sessionError:M,pageState:F,agentDisplayName:B,agentImage:V,agentImageShape:H,showAgentName:U,branding:G,agentSlug:re,ensureSession:K,startNewSession:ie,resumedRef:ae,resumeMessagesRef:q,groupContext:J,groupSlug:oe}=D,{messages:Y,setMessages:X,isStreaming:Z,sendMessage:Q}=I({cacheKeyRef:k,ensureSession:K,sessionError:M,pageState:F,inputRef:f,agentSlug:re});L({cacheKeyRef:k,groupSlug:oe,isStreaming:Z,setMessages:X}),(0,N.useEffect)(()=>{let e=!1;return(async()=>{let t=await K();if(!e&&t&&ae.current&&q.current&&q.current.length>0){let e=q.current.map(e=>({role:e.role,content:e.content,timestamp:e.timestamp}));e.sort((e,t)=>e.timestamp-t.timestamp),X(e),q.current=null}})(),()=>{e=!0}},[]),(0,N.useEffect)(()=>{F===`chat`&&f.current?.focus()},[F]),(0,N.useEffect)(()=>{if(F!==`chat`)return;history.pushState({maxyChat:!0},``);function e(){history.pushState({maxyChat:!0},``)}return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[F]),(0,N.useEffect)(()=>{if(!G)return;let e=document.body;if(G.primaryColor&&(e.style.setProperty(`--sage`,G.primaryColor),e.style.setProperty(`--sage-hover`,G.primaryColor),e.style.setProperty(`--sage-subtle`,G.primaryColor+`14`),e.style.setProperty(`--sage-glow`,G.primaryColor+`26`)),document.title=G.name,G.primaryColor){let e=document.querySelector(`meta[name="theme-color"]`);e||(e=document.createElement(`meta`),e.name=`theme-color`,document.head.appendChild(e)),e.content=G.primaryColor}if(G.faviconUrl){let e=document.querySelector(`link[rel="icon"]`);e||(e=document.createElement(`link`),e.rel=`icon`,document.head.appendChild(e)),e.href=G.faviconUrl}},[G]),(0,N.useEffect)(()=>{function e(e){e.key===`Escape`&&p&&g()}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[p,g]);function se(){Z||(X([]),l(W),ie())}function $(e){if(!e&&n.length===0||Z)return;X(e=>e.map(e=>e.components?.some(e=>!e.submitted)?{...e,components:e.components.map(e=>e.submitted?e:{...e,submitted:!0})}:e)),l(t=>t.filter(t=>t!==e)),d(!0);let i=[...n];t(``),r([]),s(null),Q(e,{files:i})}function ce(t){t.preventDefault(),$(e.trim()),f.current?.resetHeight()}let le=G?.name||B||w.productName,ue=J?void 0:`Chat with ${le}.`;return(0,R.jsxs)(`div`,{className:`chat-page`,children:[(0,R.jsxs)(`header`,{className:`chat-header`,children:[(0,R.jsx)(`img`,{src:V||G?.logoUrl||C,alt:G?.name||w.productName,className:`chat-logo${V&&H===`circle`?` chat-logo--circle`:``}${V&&H===`rounded`?` chat-logo--rounded`:``}`,onError:e=>{e.target.src=G?.logoUrl||C}}),(0,R.jsxs)(`div`,{className:`chat-header-text`,children:[U!==`none`&&(0,R.jsx)(`h1`,{className:`chat-tagline`,children:J?.groupName||U&&B||G?.name||w.productName}),(0,R.jsx)(`p`,{className:`chat-intro`,children:J?`${J.participants.length} participants`:G?.tagline||``}),(0,R.jsx)(`p`,{className:`chat-ai-indicator`,children:`AI assistant`})]}),F===`chat`&&!p&&(0,R.jsxs)(`div`,{className:`chat-header-actions`,children:[(0,R.jsx)(`button`,{className:`chat-header-action`,onClick:se,disabled:Z,title:`New conversation`,"aria-label":`New conversation`,children:(0,R.jsx)(j,{size:16})}),(0,R.jsx)(`button`,{className:`chat-header-action`,onClick:_,title:`Select messages`,"aria-label":`Select messages`,children:(0,R.jsx)(A,{size:16})})]})]}),F===`loading`&&(0,R.jsx)(`div`,{className:`gate-wrap`,children:(0,R.jsx)(`div`,{className:`gate-loading`,children:(0,R.jsx)(`span`,{className:`spinner`})})}),F===`auth-required`&&(0,R.jsx)(z,{gateState:D.gateState,setGateState:D.setGateState,grantInfo:D.grantInfo,resolvedSlugRef:D.resolvedSlugRef}),F===`chat`&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(ee,{messages:Y,isStreaming:Z,sessionError:M,selectionMode:p,selectedItems:m,toggleSelectItem:y,remainingSuggestions:c,onSuggestionClick:$,isAtBottom:u,setIsAtBottom:d,isGroup:!!J,sessionId:O}),p?(0,R.jsx)(te,{selectedItems:m,messages:Y,isStreaming:Z,copySelected:T,selectAll:x,exitSelection:g,showCopyToast:E}):(0,R.jsx)(ne,{input:e,setInput:t,placeholder:ue,isStreaming:Z,pendingFiles:n,setPendingFiles:r,attachError:o,setAttachError:s,isDragOver:i,setIsDragOver:a,inputRef:f,onSubmit:ce,onSendVoiceNote:async e=>{t(``),r([]),s(null),await Q(``,{files:[e],displayContent:`[Voice note]`})||r(t=>[...t,e])}})]}),h&&(0,R.jsx)(`span`,{className:`copy-toast${h===`failed`?` copy-toast-failed`:``}`,children:h===`copied`?`Copied`:`Copy failed`}),(0,R.jsxs)(`footer`,{className:`chat-footer`,children:[(0,R.jsxs)(`a`,{href:v,children:[b,` `,`↗`]}),O&&(0,R.jsxs)(`span`,{style:{opacity:.35,fontSize:`10px`,fontFamily:`monospace`,marginLeft:`1rem`},children:[`Conversation · `,O.slice(0,8)]})]})]})}(0,M.createRoot)(document.getElementById(`root`)).render((0,R.jsx)(G,{}));
@@ -1,4 +1,4 @@
1
- import{o as e}from"./chunk-Pqm5yXtL.js";import{a as t,r as n,t as r}from"./jsx-runtime-BabLCDgS.js";var i=n(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),a=e(t(),1),o=r(),s={sm:14,md:16,lg:18},c={sm:30,md:38,lg:46};function l({variant:e=`primary`,size:t=`md`,icon:n,iconPosition:r=`leading`,loading:i=!1,fullWidth:a=!1,disabled:l=!1,type:u=`button`,onClick:d,"aria-label":f,style:p,className:m,children:h}){let g=[`btn`,`btn--${e}`,t===`md`?``:`btn--${t}`,a?`btn--full`:``,m].filter(Boolean).join(` `),_=s[t],v={...e===`send`?{width:c[t],height:c[t]}:{},...p},y=Object.keys(v).length>0;return(0,o.jsxs)(`button`,{type:u,className:g,disabled:i||l,onClick:d,"aria-label":f,style:y?v:void 0,children:[(0,o.jsxs)(`span`,{className:`btn__content`,style:{visibility:i?`hidden`:`visible`},children:[n&&r===`leading`&&(0,o.jsx)(n,{size:_}),h,n&&r===`trailing`&&(0,o.jsx)(n,{size:_})]}),i&&(0,o.jsx)(`span`,{className:`btn__spinner`,children:`✱`})]})}var u=typeof window<`u`&&window.__BRAND__||{productName:`Maxy`,hostname:`maxy`,marketingUrl:`https://getmaxy.com`,logo:`/brand/maxy-monochrome.png`,icon:`/brand/maxy-monochrome.png`,logoContainsName:!1},d=u.logo,f=u.icon,p=u.marketingUrl,m=u.marketingUrl.replace(/^https?:\/\//,``).replace(/\/$/,``);async function h(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 g(){let[e,t]=(0,a.useState)(!1),[n,r]=(0,a.useState)(new Set),[i,o]=(0,a.useState)(!1),s=(0,a.useRef)(null);(0,a.useEffect)(()=>()=>{s.current!==null&&clearTimeout(s.current)},[]);let c=(0,a.useCallback)(()=>{t(!0),r(new Set)},[]),l=(0,a.useCallback)(()=>{t(!1),r(new Set)},[]),u=(0,a.useCallback)(e=>{r(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),d=(0,a.useCallback)(e=>{e.length!==0&&r(t=>e.every(e=>t.has(e))?new Set:new Set(e))},[]),f=(0,a.useCallback)(()=>{s.current!==null&&(clearTimeout(s.current),s.current=null)},[]),p=(0,a.useCallback)(e=>({onPointerDown:()=>{s.current=setTimeout(()=>{t(!0),r(new Set([e])),s.current=null},500)},onPointerUp:f,onPointerLeave:f,onPointerCancel:f}),[f]),m=(0,a.useCallback)(e=>{o(e?`copied`:`failed`),setTimeout(()=>o(!1),1500)},[]);return{selectionMode:e,selectedItems:n,copyToast:i,longPressProps:p,enterSelection:c,exitSelection:l,toggleSelectItem:u,selectAll:d,copySelected:(0,a.useCallback)(async(e,t)=>{let r=[...n].sort(t).map(t=>e(t)).filter(Boolean);r.length>0&&m(await h(r.join(`
1
+ import{o as e}from"./chunk-Pqm5yXtL.js";import{a as t,r as n,t as r}from"./jsx-runtime-sFVKdwlP.js";var i=n(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),a=e(t(),1),o=r(),s={sm:14,md:16,lg:18},c={sm:30,md:38,lg:46};function l({variant:e=`primary`,size:t=`md`,icon:n,iconPosition:r=`leading`,loading:i=!1,fullWidth:a=!1,disabled:l=!1,type:u=`button`,onClick:d,"aria-label":f,style:p,className:m,children:h}){let g=[`btn`,`btn--${e}`,t===`md`?``:`btn--${t}`,a?`btn--full`:``,m].filter(Boolean).join(` `),_=s[t],v={...e===`send`?{width:c[t],height:c[t]}:{},...p},y=Object.keys(v).length>0;return(0,o.jsxs)(`button`,{type:u,className:g,disabled:i||l,onClick:d,"aria-label":f,style:y?v:void 0,children:[(0,o.jsxs)(`span`,{className:`btn__content`,style:{visibility:i?`hidden`:`visible`},children:[n&&r===`leading`&&(0,o.jsx)(n,{size:_}),h,n&&r===`trailing`&&(0,o.jsx)(n,{size:_})]}),i&&(0,o.jsx)(`span`,{className:`btn__spinner`,children:`✱`})]})}var u=typeof window<`u`&&window.__BRAND__||{productName:`Maxy`,hostname:`maxy`,marketingUrl:`https://getmaxy.com`,logo:`/brand/maxy-monochrome.png`,icon:`/brand/maxy-monochrome.png`,logoContainsName:!1},d=u.logo,f=u.icon,p=u.marketingUrl,m=u.marketingUrl.replace(/^https?:\/\//,``).replace(/\/$/,``);async function h(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 g(){let[e,t]=(0,a.useState)(!1),[n,r]=(0,a.useState)(new Set),[i,o]=(0,a.useState)(!1),s=(0,a.useRef)(null);(0,a.useEffect)(()=>()=>{s.current!==null&&clearTimeout(s.current)},[]);let c=(0,a.useCallback)(()=>{t(!0),r(new Set)},[]),l=(0,a.useCallback)(()=>{t(!1),r(new Set)},[]),u=(0,a.useCallback)(e=>{r(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),d=(0,a.useCallback)(e=>{e.length!==0&&r(t=>e.every(e=>t.has(e))?new Set:new Set(e))},[]),f=(0,a.useCallback)(()=>{s.current!==null&&(clearTimeout(s.current),s.current=null)},[]),p=(0,a.useCallback)(e=>({onPointerDown:()=>{s.current=setTimeout(()=>{t(!0),r(new Set([e])),s.current=null},500)},onPointerUp:f,onPointerLeave:f,onPointerCancel:f}),[f]),m=(0,a.useCallback)(e=>{o(e?`copied`:`failed`),setTimeout(()=>o(!1),1500)},[]);return{selectionMode:e,selectedItems:n,copyToast:i,longPressProps:p,enterSelection:c,exitSelection:l,toggleSelectItem:u,selectAll:d,copySelected:(0,a.useCallback)(async(e,t)=>{let r=[...n].sort(t).map(t=>e(t)).filter(Boolean);r.length>0&&m(await h(r.join(`
2
2
 
3
3
  ---
4
4
 
@@ -5,13 +5,13 @@
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-DgtLMsM1.js"></script>
8
+ <script type="module" crossorigin src="/assets/browser-CHWZDCXt.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/chunk-Pqm5yXtL.js">
10
- <link rel="modulepreload" crossorigin href="/assets/jsx-runtime-BabLCDgS.js">
11
- <link rel="modulepreload" crossorigin href="/assets/useSelectionMode-DcgaoBP6.js">
12
- <link rel="modulepreload" crossorigin href="/assets/file-download-DXFcVkh6.js">
13
- <link rel="modulepreload" crossorigin href="/assets/AdminShell-CxKd_V3O.js">
14
- <link rel="stylesheet" crossorigin href="/assets/jsx-runtime-BkXvvpkS.css">
10
+ <link rel="modulepreload" crossorigin href="/assets/jsx-runtime-sFVKdwlP.js">
11
+ <link rel="modulepreload" crossorigin href="/assets/useSelectionMode-Dky-Stnf.js">
12
+ <link rel="modulepreload" crossorigin href="/assets/file-download-P_qlMCg5.js">
13
+ <link rel="modulepreload" crossorigin href="/assets/AdminShell-DpWl1uoY.js">
14
+ <link rel="stylesheet" crossorigin href="/assets/jsx-runtime-DZkld3Wk.css">
15
15
  <link rel="stylesheet" crossorigin href="/assets/file-download-qc_xy7Az.css">
16
16
  </head>
17
17
  <body>
@@ -5,17 +5,17 @@
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-Ib78Kdhg.js"></script>
8
+ <script type="module" crossorigin src="/assets/chat-BBK6ulFy.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/chunk-Pqm5yXtL.js">
10
- <link rel="modulepreload" crossorigin href="/assets/jsx-runtime-BabLCDgS.js">
11
- <link rel="modulepreload" crossorigin href="/assets/useSelectionMode-DcgaoBP6.js">
12
- <link rel="modulepreload" crossorigin href="/assets/file-download-DXFcVkh6.js">
13
- <link rel="modulepreload" crossorigin href="/assets/AdminShell-CxKd_V3O.js">
10
+ <link rel="modulepreload" crossorigin href="/assets/jsx-runtime-sFVKdwlP.js">
11
+ <link rel="modulepreload" crossorigin href="/assets/useSelectionMode-Dky-Stnf.js">
12
+ <link rel="modulepreload" crossorigin href="/assets/file-download-P_qlMCg5.js">
13
+ <link rel="modulepreload" crossorigin href="/assets/AdminShell-DpWl1uoY.js">
14
14
  <link rel="modulepreload" crossorigin href="/assets/preload-helper-B_l5jfgx.js">
15
- <link rel="modulepreload" crossorigin href="/assets/audio-attachment-mime-BxI3Kl4_.js">
16
- <link rel="modulepreload" crossorigin href="/assets/Transcript-DPDJitcb.js">
17
- <link rel="modulepreload" crossorigin href="/assets/page-CjuqiMAQ.js">
18
- <link rel="stylesheet" crossorigin href="/assets/jsx-runtime-BkXvvpkS.css">
15
+ <link rel="modulepreload" crossorigin href="/assets/audio-attachment-mime-j2VvxEtx.js">
16
+ <link rel="modulepreload" crossorigin href="/assets/Transcript-DbK2YA3K.js">
17
+ <link rel="modulepreload" crossorigin href="/assets/page-BvkaS_tu.js">
18
+ <link rel="stylesheet" crossorigin href="/assets/jsx-runtime-DZkld3Wk.css">
19
19
  <link rel="stylesheet" crossorigin href="/assets/file-download-qc_xy7Az.css">
20
20
  </head>
21
21
  <body>
@@ -5,12 +5,12 @@
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-C317FUk4.js"></script>
8
+ <script type="module" crossorigin src="/assets/data-33mdnHv8.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/chunk-Pqm5yXtL.js">
10
- <link rel="modulepreload" crossorigin href="/assets/jsx-runtime-BabLCDgS.js">
11
- <link rel="modulepreload" crossorigin href="/assets/graph-labels-BbiX-sz-.js">
12
- <link rel="modulepreload" crossorigin href="/assets/file-download-DXFcVkh6.js">
13
- <link rel="stylesheet" crossorigin href="/assets/jsx-runtime-BkXvvpkS.css">
10
+ <link rel="modulepreload" crossorigin href="/assets/jsx-runtime-sFVKdwlP.js">
11
+ <link rel="modulepreload" crossorigin href="/assets/graph-labels-rG63rHvl.js">
12
+ <link rel="modulepreload" crossorigin href="/assets/file-download-P_qlMCg5.js">
13
+ <link rel="stylesheet" crossorigin href="/assets/jsx-runtime-DZkld3Wk.css">
14
14
  <link rel="stylesheet" crossorigin href="/assets/file-download-qc_xy7Az.css">
15
15
  </head>
16
16
  <body>
@@ -5,15 +5,15 @@
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-CHf_9bmD.js"></script>
8
+ <script type="module" crossorigin src="/assets/graph-Uaa5heM5.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/chunk-Pqm5yXtL.js">
10
- <link rel="modulepreload" crossorigin href="/assets/jsx-runtime-BabLCDgS.js">
11
- <link rel="modulepreload" crossorigin href="/assets/graph-labels-BbiX-sz-.js">
12
- <link rel="modulepreload" crossorigin href="/assets/useSelectionMode-DcgaoBP6.js">
13
- <link rel="modulepreload" crossorigin href="/assets/file-download-DXFcVkh6.js">
14
- <link rel="modulepreload" crossorigin href="/assets/AdminShell-CxKd_V3O.js">
15
- <link rel="modulepreload" crossorigin href="/assets/Checkbox-BHmeAgrw.js">
16
- <link rel="stylesheet" crossorigin href="/assets/jsx-runtime-BkXvvpkS.css">
10
+ <link rel="modulepreload" crossorigin href="/assets/jsx-runtime-sFVKdwlP.js">
11
+ <link rel="modulepreload" crossorigin href="/assets/graph-labels-rG63rHvl.js">
12
+ <link rel="modulepreload" crossorigin href="/assets/useSelectionMode-Dky-Stnf.js">
13
+ <link rel="modulepreload" crossorigin href="/assets/file-download-P_qlMCg5.js">
14
+ <link rel="modulepreload" crossorigin href="/assets/AdminShell-DpWl1uoY.js">
15
+ <link rel="modulepreload" crossorigin href="/assets/Checkbox-DAWZItdK.js">
16
+ <link rel="stylesheet" crossorigin href="/assets/jsx-runtime-DZkld3Wk.css">
17
17
  <link rel="stylesheet" crossorigin href="/assets/file-download-qc_xy7Az.css">
18
18
  </head>
19
19
  <body>
@@ -5,16 +5,16 @@
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-DHLuBUtk.js"></script>
8
+ <script type="module" crossorigin src="/assets/admin-nQRdn79w.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/chunk-Pqm5yXtL.js">
10
- <link rel="modulepreload" crossorigin href="/assets/jsx-runtime-BabLCDgS.js">
11
- <link rel="modulepreload" crossorigin href="/assets/useSelectionMode-DcgaoBP6.js">
12
- <link rel="modulepreload" crossorigin href="/assets/file-download-DXFcVkh6.js">
13
- <link rel="modulepreload" crossorigin href="/assets/AdminShell-CxKd_V3O.js">
14
- <link rel="modulepreload" crossorigin href="/assets/Checkbox-BHmeAgrw.js">
15
- <link rel="modulepreload" crossorigin href="/assets/AdminLoginScreens-BXKCagZn.js">
16
- <link rel="modulepreload" crossorigin href="/assets/Transcript-DPDJitcb.js">
17
- <link rel="stylesheet" crossorigin href="/assets/jsx-runtime-BkXvvpkS.css">
10
+ <link rel="modulepreload" crossorigin href="/assets/jsx-runtime-sFVKdwlP.js">
11
+ <link rel="modulepreload" crossorigin href="/assets/useSelectionMode-Dky-Stnf.js">
12
+ <link rel="modulepreload" crossorigin href="/assets/file-download-P_qlMCg5.js">
13
+ <link rel="modulepreload" crossorigin href="/assets/AdminShell-DpWl1uoY.js">
14
+ <link rel="modulepreload" crossorigin href="/assets/Checkbox-DAWZItdK.js">
15
+ <link rel="modulepreload" crossorigin href="/assets/AdminLoginScreens-Cw882rmm.js">
16
+ <link rel="modulepreload" crossorigin href="/assets/Transcript-DbK2YA3K.js">
17
+ <link rel="stylesheet" crossorigin href="/assets/jsx-runtime-DZkld3Wk.css">
18
18
  <link rel="stylesheet" crossorigin href="/assets/AdminLoginScreens-CWMpccrR.css">
19
19
  <link rel="stylesheet" crossorigin href="/assets/file-download-qc_xy7Az.css">
20
20
  <link rel="stylesheet" href="/brand-defaults.css">
@@ -5,19 +5,19 @@
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-BJ5tN5vl.js"></script>
8
+ <script type="module" crossorigin src="/assets/operator-CiDwt5I9.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/chunk-Pqm5yXtL.js">
10
- <link rel="modulepreload" crossorigin href="/assets/jsx-runtime-BabLCDgS.js">
11
- <link rel="modulepreload" crossorigin href="/assets/useSelectionMode-DcgaoBP6.js">
12
- <link rel="modulepreload" crossorigin href="/assets/file-download-DXFcVkh6.js">
13
- <link rel="modulepreload" crossorigin href="/assets/AdminShell-CxKd_V3O.js">
10
+ <link rel="modulepreload" crossorigin href="/assets/jsx-runtime-sFVKdwlP.js">
11
+ <link rel="modulepreload" crossorigin href="/assets/useSelectionMode-Dky-Stnf.js">
12
+ <link rel="modulepreload" crossorigin href="/assets/file-download-P_qlMCg5.js">
13
+ <link rel="modulepreload" crossorigin href="/assets/AdminShell-DpWl1uoY.js">
14
14
  <link rel="modulepreload" crossorigin href="/assets/preload-helper-B_l5jfgx.js">
15
- <link rel="modulepreload" crossorigin href="/assets/audio-attachment-mime-BxI3Kl4_.js">
16
- <link rel="modulepreload" crossorigin href="/assets/Transcript-DPDJitcb.js">
17
- <link rel="modulepreload" crossorigin href="/assets/page-CjuqiMAQ.js">
18
- <link rel="modulepreload" crossorigin href="/assets/Checkbox-BHmeAgrw.js">
19
- <link rel="modulepreload" crossorigin href="/assets/AdminLoginScreens-BXKCagZn.js">
20
- <link rel="stylesheet" crossorigin href="/assets/jsx-runtime-BkXvvpkS.css">
15
+ <link rel="modulepreload" crossorigin href="/assets/audio-attachment-mime-j2VvxEtx.js">
16
+ <link rel="modulepreload" crossorigin href="/assets/Transcript-DbK2YA3K.js">
17
+ <link rel="modulepreload" crossorigin href="/assets/page-BvkaS_tu.js">
18
+ <link rel="modulepreload" crossorigin href="/assets/Checkbox-DAWZItdK.js">
19
+ <link rel="modulepreload" crossorigin href="/assets/AdminLoginScreens-Cw882rmm.js">
20
+ <link rel="stylesheet" crossorigin href="/assets/jsx-runtime-DZkld3Wk.css">
21
21
  <link rel="stylesheet" crossorigin href="/assets/file-download-qc_xy7Az.css">
22
22
  <link rel="stylesheet" crossorigin href="/assets/AdminLoginScreens-CWMpccrR.css">
23
23
  </head>
@@ -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/public-D3G4tgFu.js"></script>
8
+ <script type="module" crossorigin src="/assets/public-DBXfM02B.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/chunk-Pqm5yXtL.js">
10
- <link rel="modulepreload" crossorigin href="/assets/jsx-runtime-BabLCDgS.js">
11
- <link rel="modulepreload" crossorigin href="/assets/useSelectionMode-DcgaoBP6.js">
12
- <link rel="modulepreload" crossorigin href="/assets/Checkbox-BHmeAgrw.js">
10
+ <link rel="modulepreload" crossorigin href="/assets/jsx-runtime-sFVKdwlP.js">
11
+ <link rel="modulepreload" crossorigin href="/assets/useSelectionMode-Dky-Stnf.js">
12
+ <link rel="modulepreload" crossorigin href="/assets/Checkbox-DAWZItdK.js">
13
13
  <link rel="modulepreload" crossorigin href="/assets/preload-helper-B_l5jfgx.js">
14
- <link rel="modulepreload" crossorigin href="/assets/audio-attachment-mime-BxI3Kl4_.js">
15
- <link rel="stylesheet" crossorigin href="/assets/jsx-runtime-BkXvvpkS.css">
14
+ <link rel="modulepreload" crossorigin href="/assets/audio-attachment-mime-j2VvxEtx.js">
15
+ <link rel="stylesheet" crossorigin href="/assets/jsx-runtime-DZkld3Wk.css">
16
16
  <link rel="stylesheet" crossorigin href="/assets/public-vnj7OhQj.css">
17
17
  <link rel="stylesheet" href="/brand-defaults.css">
18
18
  </head>
@@ -1 +0,0 @@
1
- import{o as e}from"./chunk-Pqm5yXtL.js";import{a as t,n,r,t as i}from"./jsx-runtime-BabLCDgS.js";import{a,i as o,o as s,r as c,s as l,t as u}from"./file-download-DXFcVkh6.js";import{l as d,o as f,r as p,t as m}from"./useSelectionMode-DcgaoBP6.js";async function h(){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 g=r(`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`}]]),_=r(`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`}]]),v=r(`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`}]]),y=r(`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`}]]),b=r(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),x=r(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),S=r(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),C=r(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),w=r(`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=r(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),E=r(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),D=r(`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`}]]),ee=r(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),O=r(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),te=r(`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`}]]),ne=r(`panel-right-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m10 15-3-3 3-3`,key:`1pgupc`}]]),k=r(`panel-right`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),A=r(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),re=r(`share-2`,[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]),ie=r(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),j=r(`unplug`,[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]),M=r(`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`}]]),N=e(t(),1),P=i();function F(e){let{businessName:t,variant:r=`admin`,onNavigate:i,onToggleSidebar:a,sidebarOpen:l,onLogout:u,onDisconnect:d,disconnecting:m}=e,[h,g]=(0,N.useState)(!1),_=(0,N.useRef)(null),v=(0,N.useRef)(null),y=c(null),[w,D]=(0,N.useState)(null),[te,A]=(0,N.useState)(!1),[ie,M]=(0,N.useState)(null),[F,I]=(0,N.useState)(null),[ae,L]=(0,N.useState)(!1),[oe,R]=(0,N.useState)(null),[z,se]=(0,N.useState)(null),[ce,B]=(0,N.useState)(``);(0,N.useEffect)(()=>{B(window.location.hostname.startsWith(`admin.`)?window.location.origin.replace(`admin.`,`public.`):window.location.origin)},[]),(0,N.useEffect)(()=>{if(!h)return;let e=e=>{_.current&&!_.current.contains(e.target)&&g(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[h]),(0,N.useEffect)(()=>{if(!h)return;let e=e=>{e.key===`Escape`&&g(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[h]),(0,N.useEffect)(()=>{h&&v.current?.focus()},[h]),(0,N.useEffect)(()=>{if(!h||r!==`admin`)return;let e=!1;return y(`/api/admin/version`).then(e=>e.json()).then(t=>{e||se(t)}).catch(e=>{console.error(`[admin/version] menu-open client fetch failed:`,e)}),()=>{e=!0}},[h,r,y]);let V=(0,N.useCallback)(()=>{g(e=>{let t=!e;return t&&console.info(`[admin-ui] header-menu-open`),t})},[]),H=(0,N.useCallback)(e=>{g(!1),i(e)},[i]),le=(0,N.useCallback)(async()=>{if(w!==null){D(null),I(null);return}A(!0),M(null);try{let e=await y(`/api/admin/agents`);if(!e.ok)throw Error(`Failed to load agents`);D((await e.json()).agents??[])}catch(e){console.error(`[admin/agents] list failed:`,e),M(e instanceof Error?e.message:String(e)),D([])}finally{A(!1)}},[w,y]),ue=(0,N.useCallback)(e=>{I(null),D(t=>t?.filter(t=>t.slug!==e)??null),y(`/api/admin/agents/${encodeURIComponent(e)}`,{method:`DELETE`}).catch(e=>console.error(`[admin/agents] delete failed:`,e))},[y]),U=(0,N.useCallback)(()=>{g(!1),u()},[u]),de=(0,N.useCallback)(async()=>{R(null),await d()?(L(!1),g(!1)):R(`Disconnect failed — credentials still present. Try again.`)},[d]),fe=t||p.productName;return(0,P.jsxs)(`header`,{className:`admin-header`,children:[r===`admin`&&(0,P.jsx)(`button`,{type:`button`,className:`admin-sidebar-toggle`,"aria-label":l?`Hide sidebar`:`Show sidebar`,title:l?`Hide sidebar`:`Show sidebar`,"aria-expanded":l,onClick:a,children:l?(0,P.jsx)(ne,{size:20,strokeWidth:1.5}):(0,P.jsx)(k,{size:20,strokeWidth:1.5})}),(0,P.jsxs)(`div`,{className:`chat-header-label`,children:[(0,P.jsx)(`span`,{className:`chat-logo-btn`,"aria-hidden":`true`,children:(0,P.jsx)(`img`,{src:f,alt:``,className:`chat-logo`})}),(0,P.jsx)(`h1`,{className:`chat-tagline`,children:fe})]}),(0,P.jsxs)(`div`,{className:`chat-burger-wrap`,ref:_,children:[(0,P.jsx)(`button`,{type:`button`,className:`admin-burger`,onClick:V,"aria-label":`Menu`,"aria-haspopup":`true`,"aria-expanded":h,children:(0,P.jsx)(O,{size:20})}),h&&(0,P.jsxs)(`div`,{className:`admin-menu`,role:`menu`,children:[r===`admin`&&(0,P.jsxs)(`button`,{ref:v,type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:()=>H(`dashboard`),children:[(0,P.jsx)(E,{size:14}),` Dashboard`]}),r===`operator`&&(0,P.jsxs)(`button`,{ref:v,type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:()=>H(`chat`),children:[(0,P.jsx)(`img`,{src:`/brand/claude.png`,alt:``,className:`chat-menu-claude-icon`}),` Chat`]}),(0,P.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:()=>H(`data`),children:[(0,P.jsx)(x,{size:14}),` Data`]}),r===`admin`&&(0,P.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:()=>H(`graph`),children:[(0,P.jsx)(re,{size:14}),` Graph`]}),r===`admin`&&(0,P.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:()=>H(`browser`),children:[(0,P.jsx)(C,{size:14}),` Browser`]}),r===`admin`&&(0,P.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:()=>H(`chat`),children:[(0,P.jsx)(`img`,{src:`/brand/claude.png`,alt:``,className:`chat-menu-claude-icon`}),` Chat`]}),r===`admin`&&(0,P.jsx)(`div`,{className:`chat-menu-divider`}),r===`admin`&&(0,P.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:le,children:[(0,P.jsx)(S,{size:14}),` Public`,te&&(0,P.jsx)(s,{size:12,className:`spin`})]}),r===`admin`&&w!==null&&(0,P.jsxs)(`div`,{className:`chat-menu-agents`,children:[ie&&(0,P.jsx)(`span`,{className:`chat-menu-agent-error`,children:ie}),w.length===0&&!ie&&(0,P.jsx)(`span`,{className:`chat-menu-agent-empty`,children:`No public agents configured`}),w.map(e=>(0,P.jsxs)(`div`,{className:`chat-menu-item chat-menu-agent-item`,children:[(0,P.jsx)(`span`,{className:`agent-status-dot ${e.status}`}),(0,P.jsxs)(`span`,{className:`agent-text`,children:[(0,P.jsx)(`span`,{className:`agent-display-name`,children:e.displayName}),(0,P.jsxs)(`span`,{className:`agent-slug`,children:[`/`,e.slug]})]}),F===e.slug?(0,P.jsxs)(`span`,{className:`agent-actions agent-confirm`,children:[(0,P.jsx)(`button`,{type:`button`,className:`agent-action-btn agent-confirm-yes`,title:`Confirm delete`,onClick:()=>ue(e.slug),children:(0,P.jsx)(b,{size:12})}),(0,P.jsx)(`button`,{type:`button`,className:`agent-action-btn agent-confirm-no`,title:`Cancel`,onClick:()=>I(null),children:(0,P.jsx)(o,{size:12})})]}):(0,P.jsxs)(`span`,{className:`agent-actions`,children:[(0,P.jsx)(`a`,{href:`${ce}/${e.slug}`,target:`_blank`,rel:`noopener noreferrer`,className:`agent-action-btn`,title:`Open agent`,onClick:()=>g(!1),children:(0,P.jsx)(S,{size:12})}),(0,P.jsx)(`button`,{type:`button`,className:`agent-action-btn agent-delete-btn`,title:`Delete agent`,onClick:()=>I(e.slug),children:(0,P.jsx)(n,{size:12})})]})]},e.slug))]}),r===`admin`&&(0,P.jsx)(`div`,{className:`chat-menu-divider`}),r===`admin`&&(0,P.jsxs)(`div`,{className:`chat-menu-version chat-menu-version-passive`,children:[(0,P.jsx)(T,{size:14}),(0,P.jsxs)(`span`,{className:`version-installed`,children:[z?`v${z.installed}`:`…`,z&&!z.updateAvailable&&(0,P.jsx)(`span`,{className:`version-uptodate-dot`}),z?.updateAvailable&&(0,P.jsx)(`span`,{className:`version-update-dot`})]})]}),r===`admin`&&(ae?(0,P.jsxs)(`div`,{className:`chat-menu-item chat-menu-disconnect`,children:[(0,P.jsx)(`span`,{children:`Disconnect Claude account?`}),(0,P.jsxs)(`span`,{className:`agent-actions agent-confirm`,children:[(0,P.jsx)(`button`,{type:`button`,className:`agent-action-btn agent-confirm-yes`,title:`Confirm disconnect`,disabled:m,onClick:de,children:m?(0,P.jsx)(s,{size:12,className:`spin`}):(0,P.jsx)(b,{size:12})}),(0,P.jsx)(`button`,{type:`button`,className:`agent-action-btn agent-confirm-no`,title:`Cancel disconnect`,disabled:m,onClick:()=>{L(!1),R(null)},children:(0,P.jsx)(o,{size:12})})]})]}):(0,P.jsxs)(`button`,{type:`button`,className:`chat-menu-item chat-menu-disconnect`,role:`menuitem`,onClick:()=>{R(null),L(!0)},children:[(0,P.jsx)(j,{size:14}),` Disconnect Claude account`]})),r===`admin`&&oe&&(0,P.jsx)(`span`,{className:`chat-menu-agent-error`,children:oe}),(0,P.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:U,children:[(0,P.jsx)(ee,{size:14}),` Log out`]})]})]})]})}var I=`maxy-shell-side-px`;function ae(){if(typeof window>`u`)return 0;let e=document.querySelector(`.platform > .artefact`)?.getBoundingClientRect();return e&&e.width>0?Math.round(e.width):0}function L(e){if(typeof window>`u`)return e;let t=window.innerWidth,n=Math.max(248,t-480-ae());return Math.min(Math.max(e,248),n)}function oe(){if(typeof window>`u`)return 264;try{let e=window.localStorage.getItem(I);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 L(t)}catch{}return 264}function R({targetSelector:e=`.platform`}){let t=(0,N.useRef)(null),[n,r]=(0,N.useState)(()=>oe()),i=(0,N.useRef)(n);(0,N.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,N.useCallback)(()=>{r(e=>{let t=L(e);return t===e?e:t})},[]);(0,N.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(L(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(I,String(t))}catch{}console.info(`[admin-ui] sidebar-resize px=${t}`)};window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s)},s=()=>{let e=L(264);r(e);try{window.localStorage.removeItem(I)}catch{}console.info(`[admin-ui] sidebar-resize px=${e}`)};return(0,P.jsx)(`div`,{ref:t,className:`side-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize sidebar`,onPointerDown:o,onDoubleClick:s})}var z={whatsapp:{fill:`#25D366`,label:`WhatsApp`,path:`M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.71.306 1.263.489 1.694.625.712.227 1.36.195 1.872.118.571-.085 1.758-.719 2.006-1.413.247-.694.247-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.885-9.885 9.885M20.52 3.449C18.24 1.245 15.24.044 12.045.044 5.463.044.103 5.404.1 11.99c0 2.096.546 4.142 1.588 5.945L0 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.585 0 11.946-5.36 11.949-11.946 0-3.193-1.24-6.19-3.495-8.445`},telegram:{fill:`#229ED9`,label:`Telegram`,path:`M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z`}};function se({channel:e,size:t=16}){let n=z[e];return(0,P.jsx)(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:n.fill,role:`img`,"aria-label":n.label,className:`channel-icon`,children:(0,P.jsx)(`path`,{d:n.path})})}var ce=[`whatsapp`,`telegram`];function B(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 V(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}var H=`auth-refresh-failed`;function le({error:e,onClose:t}){if(!e)return null;let n=e.reason===H,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,P.jsx)(`div`,{className:`claude-info-overlay`,onClick:t,children:(0,P.jsxs)(`div`,{className:`claude-info-modal`,onClick:e=>e.stopPropagation(),role:`alertdialog`,"aria-label":`Session could not be opened`,children:[(0,P.jsxs)(`div`,{className:`claude-info-header`,children:[(0,P.jsx)(`span`,{children:r}),(0,P.jsx)(`button`,{className:`claude-info-close`,onClick:t,"aria-label":`Close`,children:`✕`})]}),(0,P.jsxs)(`div`,{className:`claude-info-section`,style:{padding:`12px 14px`,fontSize:`11px`,color:`var(--text-secondary)`},children:[i,(0,P.jsxs)(`div`,{className:`claude-info-row`,style:{marginTop:`8px`},children:[(0,P.jsx)(`span`,{className:`claude-info-label`,children:`Reason`}),(0,P.jsx)(`span`,{className:`claude-info-value`,children:e.reason})]}),e.sessionId&&(0,P.jsxs)(`div`,{className:`claude-info-row`,children:[(0,P.jsx)(`span`,{className:`claude-info-label`,children:`Session`}),(0,P.jsxs)(`span`,{className:`claude-info-value`,children:[e.sessionId.slice(0,8),`…`]})]})]})]})})}function ue(e){let{show:t,onClose:n,claudeInfo:r,messages:i,sessionElapsed:a,sessionId:o,cacheKey:s}=e,[c,l]=(0,N.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),h=i.flatMap(e=>e.events?.filter(e=>e.type===`rate_limit`)??[]).at(-1),g=u.reduce((e,t)=>e+(t.total_cost_usd??0),0),_=r?.account?.subscriptionType,v=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,P.jsx)(`div`,{className:`claude-info-overlay`,onClick:n,children:(0,P.jsxs)(`div`,{className:`claude-info-modal`,onClick:e=>e.stopPropagation(),children:[(0,P.jsxs)(`div`,{className:`claude-info-header`,children:[(0,P.jsx)(`img`,{src:`/brand/claude.png`,alt:`Claude`,className:`claude-info-icon`}),(0,P.jsx)(`span`,{children:`Claude Code`}),(0,P.jsx)(`button`,{className:`claude-info-close`,onClick:n,"aria-label":`Close`,children:`✕`})]}),(0,P.jsxs)(`div`,{className:`claude-info-section`,children:[(0,P.jsxs)(`div`,{className:`claude-info-row`,children:[(0,P.jsx)(`span`,{className:`claude-info-label`,children:`Version`}),(0,P.jsx)(`span`,{className:`claude-info-value`,children:r?r.version:`…`})]}),(0,P.jsxs)(`div`,{className:`claude-info-row`,children:[(0,P.jsx)(`span`,{className:`claude-info-label`,children:`Email`}),(0,P.jsx)(`span`,{className:`claude-info-value`,children:r?.account?.email??`…`})]})]}),(_||h||g>0)&&(0,P.jsxs)(`div`,{className:`claude-info-section`,children:[_&&(0,P.jsxs)(`div`,{className:`claude-info-row`,children:[(0,P.jsx)(`span`,{className:`claude-info-label`,children:`Plan`}),(0,P.jsx)(`span`,{className:`claude-info-value`,style:{textTransform:`capitalize`},children:_})]}),h&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`claude-info-row`,children:[(0,P.jsx)(`span`,{className:`claude-info-label`,children:`Usage`}),(0,P.jsxs)(`span`,{className:`claude-info-value`,children:[Math.round(h.utilization*100),`%`]})]}),(0,P.jsxs)(`div`,{className:`claude-info-row`,children:[(0,P.jsx)(`span`,{className:`claude-info-label`,children:`Resets in`}),(0,P.jsx)(`span`,{className:`claude-info-value`,children:v(h.resetsAt)})]}),h.isUsingOverage&&(0,P.jsxs)(`div`,{className:`claude-info-row`,children:[(0,P.jsx)(`span`,{className:`claude-info-label`,children:`Overage`}),(0,P.jsx)(`span`,{className:`claude-info-value`,children:`Active`})]})]}),g>0&&(0,P.jsxs)(`div`,{className:`claude-info-row`,children:[(0,P.jsx)(`span`,{className:`claude-info-label`,children:`Session cost`}),(0,P.jsxs)(`span`,{className:`claude-info-value`,children:[`$`,g<.01?g.toFixed(4):g.toFixed(2)]})]})]}),(0,P.jsxs)(`div`,{className:`claude-info-section`,children:[(0,P.jsxs)(`div`,{className:`claude-info-row`,children:[(0,P.jsx)(`span`,{className:`claude-info-label`,children:`Model`}),(0,P.jsx)(`span`,{className:`claude-info-value`,children:r?.model??`…`})]}),(0,P.jsxs)(`div`,{className:`claude-info-row`,children:[(0,P.jsx)(`span`,{className:`claude-info-label`,children:`Context used`}),(0,P.jsx)(`span`,{className:`claude-info-value`,children:f>0?`${f}%`:`—`})]}),(0,P.jsxs)(`div`,{className:`claude-info-row`,children:[(0,P.jsx)(`span`,{className:`claude-info-label`,children:`Tokens`}),(0,P.jsx)(`span`,{className:`claude-info-value`,children:p>0?V(p):`—`})]}),(0,P.jsxs)(`div`,{className:`claude-info-row`,children:[(0,P.jsx)(`span`,{className:`claude-info-label`,children:`Session`}),(0,P.jsx)(`span`,{className:`claude-info-value`,children:B(a)})]}),(o||s)&&(()=>{let e=o??s??``;return(0,P.jsxs)(`div`,{className:`claude-info-row`,children:[(0,P.jsx)(`span`,{className:`claude-info-label`,children:`Session`}),(0,P.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 m(e)?`copied`:`failed`),setTimeout(()=>l(null),1200)},children:c===`copied`?`copied ✓`:c===`failed`?`copy failed ✕`:`${e.slice(0,8)}…`})]})})()]})]})})}var U=`https://claude.ai/code`,de=[500,1e3,1500,2e3,2500,3e3,3e3];function fe(e,t,n){if(e&&n.target)return{kind:`navigate`,url:n.target};let r=n.slug??n.bridgeSessionId??null;if(e&&r)return{kind:`navigate`,url:`${U}/${r}`};let i=n.reason||n.error||`status ${t}`;return{kind:`error`,sessionId:n.sessionId??null,reason:i}}function pe(e){if(!e)return``;let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`}):``}function W(e){let{businessName:t,cacheKey:r,role:i,userName:o,userAvatar:s,onSelectProjects:f,onSelectPeople:m,onSelectTasks:h,onSelectAgents:b,onCloseMobileDrawer:x,collapsed:C,selectedWhatsappId:T,onSelectWhatsappConversation:E,initialWhatsappSurface:ee=!1}=e,O=c(r),ne=p.productName,k=typeof o==`string`?o:o===null?`name unavailable`:t||ne,re=(k.trim().charAt(0)||`?`).toUpperCase(),[j,F]=(0,N.useState)(ee?`whatsapp`:`sessions`),[I,ae]=(0,N.useState)([]),[L,oe]=(0,N.useState)(!1),[R,z]=(0,N.useState)(null),[B,V]=(0,N.useState)(!1),[H,ue]=(0,N.useState)(`file`),[U,W]=(0,N.useState)(null),[me,G]=(0,N.useState)(null),[K,_e]=(0,N.useState)([]),[q,ve]=(0,N.useState)(!1),[J,Y]=(0,N.useState)(null),[ye,be]=(0,N.useState)(!1),[xe,Se]=(0,N.useState)(!1),[Ce,we]=(0,N.useState)(!1),[Te,Ee]=(0,N.useState)(null),[De,Oe]=(0,N.useState)(new Set),[ke,Ae]=(0,N.useState)(new Set),[je,Me]=(0,N.useState)(new Set),[Ne,Pe]=(0,N.useState)(new Set),[X,Fe]=(0,N.useState)(!1),[Ie,Le]=(0,N.useState)([]),[Re,ze]=(0,N.useState)(!1),[Be,Ve]=(0,N.useState)(null),[He,Ue]=(0,N.useState)(`whatsapp`),We=(0,N.useCallback)(e=>{if(x(),!r){console.error(`[admin-ui] artefact-download-blocked id=${e.id} reason=no-cache-key`),W({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`),W({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}`),u(r,e.downloadPath,e.downloadRoot??`data`),W({message:`Downloading ${e.name}`,failed:!1})},[r,x]);(0,N.useEffect)(()=>{if(!U)return;let e=setTimeout(()=>W(null),2500);return()=>clearTimeout(e)},[U]);let Ge=(0,N.useCallback)(async()=>{if(r){V(!0),z(null);try{let e=await O(`/api/admin/sidebar-artefacts`);if(!e.ok)throw Error(`status ${e.status}`);ae((await e.json()).artefacts??[]),oe(!0)}catch(e){let t=e instanceof Error?e.message:String(e);z(`Failed to load artefacts: ${t}`),console.error(`[admin-ui] sidebar-artefacts fetch failed: ${t}`)}finally{V(!1)}}},[r,O]),Z=(0,N.useCallback)(async()=>{if(!r)return null;be(!0),Y(null);try{let e=await O(`/api/admin/sidebar-sessions`);if(!e.ok)throw Error(`status ${e.status}`);let t=await e.json(),n=t.sessions??[];return _e(n),Ee(t.accountId??null),ve(!0),n}catch(e){let t=e instanceof Error?e.message:String(e);return Y(`Failed to load sessions: ${t}`),console.error(`[admin-ui] sidebar-sessions fetch failed: ${t}`),null}finally{be(!1)}},[r,O]),Q=(0,N.useCallback)(async()=>{if(r){Ve(null);try{let e=await O(`/api/whatsapp-reader/conversations`);if(!e.ok)throw Error(`status ${e.status}`);Le((await e.json()).conversations??[]),ze(!0)}catch(e){let t=e instanceof Error?e.message:String(e);Ve(`Couldn't load conversations.`),console.error(`[admin-ui] channel-convos fetch failed: ${t}`)}}},[r,O]);(0,N.useEffect)(()=>{!r||q||Z()},[r,q,Z]),(0,N.useEffect)(()=>{if(!r)return;let e=null;return Q(),e=setInterval(()=>{Q()},he),()=>{e!==null&&clearInterval(e)}},[r,Q]);let Ke=(0,N.useMemo)(()=>{let e=new Map;for(let t of ce)e.set(t,[]);for(let t of Ie)e.get(t.channel)?.push(t);for(let t of ce)console.info(`[admin-ui] sidebar-nav surface=${t} count=${e.get(t).length}`);return e},[Ie]),qe={whatsapp:`WhatsApp`,telegram:`Telegram`},Je=()=>{E(null),F(`artefacts`),console.info(`[admin-ui] sidebar-nav surface=artefacts count=${L?I.length:0} collapsed=${C}`),Ge()},$=1.5,Ye=()=>{console.info(`[admin-ui] sidebar-refresh surface=artefacts`),Ge()},Xe=()=>{E(null),F(`sessions`),console.info(`[admin-ui] sidebar-nav surface=sessions count=${q?K.length:0} collapsed=${C}`),q||Z()},Ze=()=>{console.info(`[admin-ui] sidebar-refresh surface=sessions`),Z()},Qe=e=>{F(`whatsapp`),Ue(e),console.info(`[admin-ui] sidebar-nav surface=${e} count=${Ke.get(e)?.length??0} collapsed=${C}`)},$e=(0,N.useCallback)(async e=>{if(e.resumable===!1||ke.has(e.sessionId))return;Ae(t=>{let n=new Set(t);return n.add(e.sessionId),n});let t=window.open(``,`_blank`);try{let n=await O(`/api/admin/session-rc-spawn`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sessionId:e.sessionId,name:e.title||e.sessionId})}),r=await n.json().catch(()=>({})),i=fe(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`?(x(),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}`),G(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}`),G({sessionId:e.sessionId,reason:r})}finally{Ae(t=>{let n=new Set(t);return n.delete(e.sessionId),n})}},[O,x,ke]),et=(0,N.useCallback)(async e=>{let t=e.slice(0,8);for(let n=1;n<=de.length;n++){await new Promise(e=>setTimeout(e,de[n-1]));let r=await Z();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}`)},[Z]),tt=(0,N.useCallback)(async()=>{if(X)return;Fe(!0);let e=window.open(``,`_blank`);try{let t=await O(`/api/admin/session-rc-spawn`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({})}),n=await t.json().catch(()=>({})),r=fe(t.ok,t.status,n);console.info(`[admin-ui] sidebar-new-session-spawned status=${t.status} outcome=${r.kind} slug=${n.slug??n.bridgeSessionId??`none`}`),r.kind===`navigate`?(e?e.location.href=r.url:window.open(r.url,`_blank`),n.sessionId?et(n.sessionId):console.error(`[admin-ui] sidebar-new-session-converge-skipped reason=no-session-id`)):(e?.close(),console.error(`[admin-ui] sidebar-new-session-failed status=${t.status} reason=${r.reason}`),G(r))}catch(t){e?.close();let n=t instanceof Error?t.message:String(t);console.error(`[admin-ui] sidebar-new-session-failed error=${n}`),G({sessionId:null,reason:n})}finally{Fe(!1)}},[O,X,et]),nt=(0,N.useCallback)(async(e,t)=>{if(e.stopPropagation(),!De.has(t.sessionId)){Oe(e=>{let n=new Set(e);return n.add(t.sessionId),n});try{let e=await O(`/api/admin/session-delete`,{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-delete-failed sessionId=${t.sessionId} status=${e.status} error=${n.error??`unknown`}`),W({message:`Delete failed: ${n.error??`status ${e.status}`}`,failed:!0});return}let n=await e.json();console.info(`[admin-ui] sidebar-session-delete sessionId=${t.sessionId} pidKilled=${n.pidKilled??`?`} deleted=${n.deleted??`?`}`),_e(e=>e.filter(e=>e.sessionId!==t.sessionId)),Z()}catch(e){let n=e instanceof Error?e.message:String(e);console.error(`[admin-ui] sidebar-session-delete-failed sessionId=${t.sessionId} error=${n}`),W({message:`Delete failed: ${n}`,failed:!0})}finally{Oe(e=>{let n=new Set(e);return n.delete(t.sessionId),n})}}},[O,De,Z]),rt=(0,N.useCallback)(async(e,t)=>{if(e.stopPropagation(),!je.has(t.sessionId)){Me(e=>{let n=new Set(e);return n.add(t.sessionId),n});try{let e=await O(`/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`}`),W({message:`Stop failed: ${n.error??`status ${e.status}`}`,failed:!0});return}console.info(`[admin-ui] sidebar-session-stop sessionId=${t.sessionId}`),Z()}catch(e){let n=e instanceof Error?e.message:String(e);console.error(`[admin-ui] sidebar-session-stop-failed sessionId=${t.sessionId} error=${n}`),W({message:`Stop failed: ${n}`,failed:!0})}finally{Me(e=>{let n=new Set(e);return n.delete(t.sessionId),n})}}},[O,je,Z]),it=(0,N.useCallback)(async(e,t,n)=>{if(e.stopPropagation(),!Ne.has(t.sessionId)){Pe(e=>{let n=new Set(e);return n.add(t.sessionId),n});try{let e=await O(`/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`}`),W({message:`${n===`archive`?`Archive`:`Unarchive`} failed: ${i}`,failed:!0});return}console.info(`[admin-ui] sidebar-session-archive sessionId=${t.sessionId} mode=${n}`),Z()}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}`),W({message:`${n===`archive`?`Archive`:`Unarchive`} failed: ${r}`,failed:!0})}finally{Pe(e=>{let n=new Set(e);return n.delete(t.sessionId),n})}}},[O,Ne,Z]);return(0,P.jsxs)(`aside`,{className:`side`,children:[(0,P.jsx)(`div`,{className:`side-new-session-row`,children:(0,P.jsxs)(`button`,{type:`button`,className:`side-new-session`,onClick:tt,disabled:X,"aria-busy":X,children:[(0,P.jsx)(A,{size:14}),(0,P.jsx)(`span`,{children:X?`Spawning…`:`New session`})]})}),(0,P.jsxs)(`nav`,{className:`side-nav`,children:[(0,P.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=people`),m(),x()},children:[(0,P.jsx)(M,{size:20,strokeWidth:$}),(0,P.jsx)(`span`,{className:`label`,children:`People`}),(0,P.jsx)(`span`,{className:`kbd`})]}),(0,P.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=agents`),b(),x()},children:[(0,P.jsx)(v,{size:20,strokeWidth:$}),(0,P.jsx)(`span`,{className:`label`,children:`Agents`}),(0,P.jsx)(`span`,{className:`kbd`})]}),(0,P.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=projects`),f(),x()},children:[(0,P.jsx)(y,{size:20,strokeWidth:$}),(0,P.jsx)(`span`,{className:`label`,children:`Projects`}),(0,P.jsx)(`span`,{className:`kbd`})]}),(0,P.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=tasks`),h(),x()},children:[(0,P.jsx)(D,{size:20,strokeWidth:$}),(0,P.jsx)(`span`,{className:`label`,children:`Tasks`}),(0,P.jsx)(`span`,{className:`kbd`})]}),(0,P.jsxs)(`button`,{type:`button`,className:`nav-row${j===`artefacts`?` active`:``}`,onClick:Je,children:[(0,P.jsx)(d,{size:20,strokeWidth:$}),(0,P.jsx)(`span`,{className:`label`,children:`Artefacts`}),(0,P.jsx)(`span`,{className:`kbd`})]}),(0,P.jsxs)(`button`,{type:`button`,className:`nav-row${j===`sessions`?` active`:``}`,onClick:Xe,children:[(0,P.jsx)(w,{size:20,strokeWidth:$}),(0,P.jsx)(`span`,{className:`label`,children:`Sessions`}),(0,P.jsx)(`span`,{className:`kbd`})]}),Re&&ce.filter(e=>Ke.get(e).length>0).map(e=>(0,P.jsxs)(`button`,{type:`button`,className:`nav-row${j===`whatsapp`&&He===e?` active`:``}`,onClick:()=>Qe(e),children:[(0,P.jsx)(se,{channel:e,size:16}),(0,P.jsx)(`span`,{className:`label`,children:qe[e]}),(0,P.jsx)(`span`,{className:`kbd`})]},e)),Be&&(0,P.jsx)(`div`,{className:`nav-row`,style:{color:`var(--text-tertiary)`,cursor:`default`},"aria-disabled":`true`,children:(0,P.jsx)(`span`,{className:`label`,children:Be})})]}),j===`artefacts`&&(0,P.jsxs)(`div`,{className:`side-list`,children:[(0,P.jsxs)(`div`,{className:`group-head`,children:[(0,P.jsx)(`span`,{children:`Artefacts`}),(0,P.jsxs)(`span`,{className:`group-head-meta`,children:[(0,P.jsx)(`button`,{type:`button`,className:`group-head-refresh`,title:`Refresh artefacts`,"aria-label":`Refresh artefacts`,onClick:Ye,disabled:B,children:(0,P.jsx)(a,{size:12,className:B?`spinning`:void 0})}),(0,P.jsx)(`span`,{children:B?`…`:String(I.length)})]})]}),R&&(0,P.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:R}),L&&!R&&I.length>0&&(()=>{let e=I.filter(e=>e.kind===`agent-template`).length,t=I.length-e;return(0,P.jsx)(`div`,{className:`artefact-filter-chips`,children:[{key:`all`,label:`All`,count:I.length},{key:`agent`,label:`Agents`,count:e},{key:`file`,label:`Files`,count:t}].map(e=>(0,P.jsxs)(`button`,{type:`button`,className:`artefact-filter-chip${H===e.key?` active`:``}`,onClick:()=>ue(e.key),disabled:e.count===0&&e.key!==`all`,children:[e.label,(0,P.jsx)(`span`,{className:`artefact-filter-chip-count`,children:e.count})]},e.key))})})(),L&&!R&&I.length===0&&(0,P.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:`No artefacts yet`}),I.filter(e=>H===`all`?!0:H===`agent`?e.kind===`agent-template`:e.kind!==`agent-template`).map(e=>{let t=e.kind===`agent-template`,n=t?v:d,r=pe(e.updatedAt),i=e.downloadPath!==null;return(0,P.jsxs)(`button`,{type:`button`,className:`conv`,onClick:()=>We(e),disabled:!i,style:i?void 0:{cursor:`default`},title:i?`Download ${e.name}`:`${e.name} can’t be downloaded`,children:[(0,P.jsx)(n,{size:14,className:`conv-icon`,"data-kind":t?`agent`:`file`,"aria-label":t?`agent template`:`file`}),(0,P.jsxs)(`span`,{className:`conv-stack`,children:[(0,P.jsx)(`span`,{className:`conv-name-line`,children:(0,P.jsx)(`span`,{className:`conv-name`,children:e.name})}),r&&(0,P.jsx)(`span`,{className:`conv-timestamp`,children:r})]}),i&&(0,P.jsx)(l,{size:12,className:`conv-rc-icon`,"aria-hidden":`true`})]},e.id)})]}),j===`sessions`&&(()=>{let e=K.filter(e=>xe?!0:!e.isSubagent).filter(e=>Ce?!0:!e.archived),t=K.some(e=>e.isSubagent),r=K.some(e=>e.archived);return(0,P.jsxs)(`div`,{className:`side-list`,children:[(0,P.jsxs)(`div`,{className:`group-head`,children:[(0,P.jsx)(`span`,{children:`Sessions`}),(0,P.jsxs)(`span`,{className:`group-head-meta`,children:[(0,P.jsx)(`button`,{type:`button`,className:`group-head-refresh`,title:`Refresh sessions`,"aria-label":`Refresh sessions`,onClick:Ze,disabled:ye,children:(0,P.jsx)(a,{size:12,className:ye?`spinning`:void 0})}),(0,P.jsx)(`span`,{children:ye?`…`:String(e.length)})]})]}),Te&&(0,P.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,P.jsx)(`code`,{children:Te})}),(t||r)&&(0,P.jsxs)(`div`,{className:`artefact-filter-chips`,children:[t&&(0,P.jsx)(`button`,{type:`button`,className:`artefact-filter-chip${xe?` active`:``}`,onClick:()=>Se(e=>!e),title:xe?`Hide subagent sessions`:`Show subagent sessions`,children:`Subagents`}),r&&(0,P.jsx)(`button`,{type:`button`,className:`artefact-filter-chip${Ce?` active`:``}`,onClick:()=>we(e=>!e),title:Ce?`Hide archived sessions`:`Show archived sessions`,children:`Archived`})]}),J&&(0,P.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:J}),q&&!J&&e.length===0&&(0,P.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:`No sessions yet`}),e.map(e=>{let t=pe(e.startedAt),r=ke.has(e.sessionId),i=De.has(e.sessionId),a=je.has(e.sessionId),o=Ne.has(e.sessionId);return(0,P.jsxs)(`div`,{className:`conv conv-with-actions`,children:[(0,P.jsxs)(`div`,{className:`conv-main-static`,children:[(0,P.jsx)(`span`,{className:`conv-live-dot`,"data-live":e.live?`1`:`0`,"aria-label":e.live?`live session`:`ended session`}),(0,P.jsxs)(`span`,{className:`conv-stack`,children:[(0,P.jsx)(`span`,{className:`conv-name-line`,children:(0,P.jsx)(`span`,{className:`conv-name`,title:e.title,children:e.title})}),(0,P.jsxs)(`span`,{className:`conv-timestamp`,children:[(0,P.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,P.jsxs)(`span`,{children:[` · `,t]})]})]})]}),(0,P.jsxs)(`div`,{className:`conv-actions`,children:[e.resumable===!1?(0,P.jsx)(`span`,{className:`conv-ephemeral`,title:`Public webchat session — ephemeral, not resumable`,"aria-label":`Ephemeral public session (not resumable)`,children:(0,P.jsx)(w,{size:12})}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`button`,{type:`button`,className:`conv-action`,onClick:()=>{$e(e)},disabled:r||i||a||o,"aria-busy":r,"aria-label":`Resume session ${e.title} in claude.ai/code`,title:`Resume in a fresh local Remote Control PTY`,children:(0,P.jsx)(S,{size:12})}),(0,P.jsx)(`button`,{type:`button`,className:`conv-action`,onClick:()=>{window.location.assign(`/chat?session=${e.sessionId}`)},disabled:r||i||a||o,"aria-label":`Open session ${e.title} in admin webchat`,title:`Open in admin webchat (/chat) — sending resumes this session`,children:(0,P.jsx)(te,{size:12})})]}),e.live?(0,P.jsx)(`button`,{type:`button`,className:`conv-action`,onClick:t=>{rt(t,e)},disabled:r||i||a||o,"aria-busy":a,"aria-label":`Stop session ${e.title}`,title:`Stop session process (keeps the conversation, can resume later)`,children:(0,P.jsx)(ie,{size:12})}):null,e.archived?(0,P.jsx)(`button`,{type:`button`,className:`conv-action`,onClick:t=>{it(t,e,`unarchive`)},disabled:r||i||a||o,"aria-busy":o,"aria-label":`Unarchive session ${e.title}`,title:`Unarchive (move back to the active list)`,children:(0,P.jsx)(g,{size:12})}):(0,P.jsx)(`button`,{type:`button`,className:`conv-action`,onClick:t=>{it(t,e,`archive`)},disabled:r||i||a||o,"aria-busy":o,"aria-label":`Archive session ${e.title}`,title:`Archive (hide from the list, keeps the conversation resumable)`,children:(0,P.jsx)(_,{size:12})}),(0,P.jsx)(`button`,{type:`button`,className:`conv-action conv-action-danger`,onClick:t=>{nt(t,e)},disabled:r||i||a||o,"aria-busy":i,"aria-label":`Delete session ${e.title}`,title:`Delete session (stops the process, removes the conversation)`,children:(0,P.jsx)(n,{size:12})})]})]},e.sessionId)})]})})(),j===`whatsapp`&&(0,P.jsxs)(`div`,{className:`side-list`,children:[(0,P.jsxs)(`div`,{className:`group-head`,children:[(0,P.jsx)(`span`,{children:qe[He]}),(0,P.jsxs)(`span`,{className:`group-head-meta`,children:[(0,P.jsx)(`button`,{type:`button`,className:`group-head-refresh`,title:`Refresh conversations`,"aria-label":`Refresh conversations`,onClick:()=>{Q()},children:(0,P.jsx)(a,{size:12})}),(0,P.jsx)(`span`,{children:String(Ke.get(He).length)})]})]}),Ke.get(He).map(e=>{let t=pe(e.lastMessageAt);return(0,P.jsxs)(`button`,{type:`button`,className:`conv${T===e.sessionId?` active`:``}`,onClick:()=>{E(e),x()},title:e.title,children:[(0,P.jsx)(se,{channel:e.channel,size:14}),(0,P.jsxs)(`span`,{className:`conv-stack`,children:[(0,P.jsx)(`span`,{className:`conv-name-line`,children:(0,P.jsx)(`span`,{className:`conv-name`,children:e.operatorName??e.whatsappName??e.senderId??e.title})}),t&&(0,P.jsx)(`span`,{className:`conv-timestamp`,children:t})]})]},e.sessionId)})]}),(0,P.jsx)(ge,{}),(0,P.jsxs)(`div`,{className:`side-foot`,children:[(0,P.jsx)(`div`,{className:`avatar`,children:s?(0,P.jsx)(`img`,{src:s,alt:k}):re}),(0,P.jsxs)(`div`,{className:`who`,children:[(0,P.jsx)(`span`,{className:`name`,children:k}),(0,P.jsx)(`span`,{className:`role`,children:i??`operator`})]})]}),U&&(0,P.jsx)(`div`,{className:`copy-toast${U.failed?` copy-toast-failed`:``}`,role:`status`,children:U.message}),(0,P.jsx)(le,{error:me,onClose:()=>G(null)})]})}var me=5e3,he=3e4;function ge(){let[e,t]=(0,N.useState)(null);if((0,N.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()},me))}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,P.jsxs)(`div`,{className:f.join(` `),role:`status`,"aria-label":`host CPU and RAM`,children:[(0,P.jsxs)(`div`,{className:`system-stats__metric`,children:[(0,P.jsxs)(`span`,{className:i?`system-stats__fig system-stats__fig--warn`:`system-stats__fig`,children:[`CPU `,u(n)]}),(0,P.jsx)(`div`,{className:`system-stats__bar`,children:(0,P.jsx)(`div`,{className:`system-stats__bar-fill`,style:d(n)})})]}),(0,P.jsxs)(`div`,{className:`system-stats__metric`,children:[(0,P.jsxs)(`span`,{className:o?`system-stats__fig system-stats__fig--warn`:`system-stats__fig`,children:[`RAM `,u(r)]}),(0,P.jsx)(`div`,{className:`system-stats__bar`,children:(0,P.jsx)(`div`,{className:`system-stats__bar-fill`,style:d(r)})})]})]})}var G=`admin-sidebar-collapsed`,K=`admin-sidebar-drawer-open`;function _e(){if(typeof window>`u`)return!1;try{return window.sessionStorage.getItem(G)===`1`}catch{return!1}}function q(e){if(!(typeof window>`u`))try{e?window.sessionStorage.setItem(G,`1`):window.sessionStorage.removeItem(G)}catch{}}function ve(){if(typeof window>`u`)return!1;try{return window.sessionStorage.getItem(K)===`1`}catch{return!1}}function J(e){if(!(typeof window>`u`))try{e?window.sessionStorage.setItem(K,`1`):window.sessionStorage.removeItem(K)}catch{}}var Y=720;function ye(e,t){return e===`/`?{via:`in-place`}:{via:`navigate`,href:`/?wa=${encodeURIComponent(t.sessionId)}&projectDir=${encodeURIComponent(t.projectDir)}`}}function be(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`,operatorName:null,whatsappName:null,lastMessageAt:null}}function xe(e,t){return t===`operator`&&e===`chat`||e===`dashboard`?`/`:e===`data`?`/data`:e===`graph`?`/graph`:e===`chat`?`/chat`:`/browser`}function Se(e){let{cacheKey:t,businessName:n,variant:r=`admin`,onLogout:i,onDisconnect:a,disconnecting:o,userName:s,userAvatar:c,role:l,children:u,footer:d}=e,[f,p]=(0,N.useState)(()=>_e()),[m,h]=(0,N.useState)(()=>ve()),[g,_]=(0,N.useState)(()=>typeof window<`u`&&window.matchMedia(`(max-width: ${Y}px)`).matches),[v,y]=(0,N.useState)(()=>typeof window>`u`?null:be(window.location.pathname,window.location.search)),[b]=(0,N.useState)(()=>v!==null);(0,N.useEffect)(()=>{if(typeof window>`u`)return;let e=window.matchMedia(`(max-width: ${Y}px)`),t=e=>_(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let x=(0,N.useCallback)(e=>{q(e),p(e)},[]),S=(0,N.useCallback)(e=>{J(e),h(e)},[]);(0,N.useEffect)(()=>{if(typeof window>`u`)return;let e=window.location?.pathname??``;console.info(`[admin-ui] shell-mount route=${e} variant=${r} sidebar=${r===`operator`?`none`:`present`} collapsed=${f} drawer=${m}`)},[]),(0,N.useEffect)(()=>{typeof window>`u`||!v||(console.info(`[admin-ui] wa-hydrate route=/ sessionId=${v.sessionId.slice(0,8)}`),window.history.replaceState(null,``,`/`))},[]);let C=(0,N.useCallback)(e=>{if(e===null){y(null);return}let t=typeof window<`u`?window.location.pathname:`/`,n=ye(t,e);console.info(`[admin-ui] wa-open route=${t} via=${n.via} sessionId=${e.sessionId.slice(0,8)}`),n.via===`in-place`?y(e):window.location.href=n.href},[]),w=g?m:!f,T=(0,N.useCallback)(()=>{if(!(typeof window>`u`))if(window.matchMedia(`(max-width: ${Y}px)`).matches){let e=m;console.info(`[admin-ui] header-sidebar-toggle from=${e?`open`:`closed`} mode=drawer`),S(!e)}else{let e=f;console.info(`[admin-ui] header-sidebar-toggle from=${e?`closed`:`open`} mode=collapse`),x(!e)}},[f,m,x,S]),E=(0,N.useCallback)(e=>{let t=xe(e,r);console.info(`[admin-ui] header-menu-nav target=${e} dest=${t}`),window.location.href=t},[r]),D={collapsed:f,mobileDrawerOpen:m,sidebarOpen:w,onToggleSidebar:T,setMobileDrawerOpen:S,selectedWhatsapp:v,onClearWhatsapp:()=>y(null)};return r===`operator`?(0,P.jsxs)(`div`,{className:`admin-shell admin-page admin-shell-root`,children:[(0,P.jsx)(F,{businessName:n,variant:r,onNavigate:E,onToggleSidebar:T,sidebarOpen:w,onLogout:i,onDisconnect:a,disconnecting:o}),(0,P.jsx)(`div`,{className:`platform platform-operator`,children:typeof u==`function`?u(D):u}),d]}):(0,P.jsxs)(`div`,{className:`admin-shell admin-page admin-shell-root`,children:[(0,P.jsx)(F,{businessName:n,variant:r,onNavigate:E,onToggleSidebar:T,sidebarOpen:w,onLogout:i,onDisconnect:a,disconnecting:o}),(0,P.jsxs)(`div`,{className:`platform${m?` menu-open`:``}${f?` sidebar-collapsed`:``}`,"data-artefact":`closed`,children:[(0,P.jsx)(W,{businessName:n,cacheKey:t,role:l??null,userName:s,userAvatar:c??null,onSelectProjects:()=>{window.location.href=`/graph?label=Project`},onSelectPeople:()=>{window.location.href=`/graph?label=Person`},onSelectTasks:()=>{window.location.href=`/graph?label=Task`},onSelectAgents:()=>{window.location.href=`/graph?label=Agent`},onCloseMobileDrawer:()=>S(!1),collapsed:f,mobileDrawerOpen:m,selectedWhatsappId:v?.sessionId??null,onSelectWhatsappConversation:C,initialWhatsappSurface:b}),!g&&(0,P.jsx)(R,{}),typeof u==`function`?u(D):u]}),m&&(0,P.jsx)(`div`,{className:`sidebar-backdrop menu-open`,"aria-hidden":`true`,onClick:()=>S(!1)}),d]})}export{A as a,S as c,re as i,b as l,ue as n,D as o,M as r,C as s,Se as t,h as u};