@rubytech/create-maxy-code 0.1.495 → 0.1.496
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/payload/platform/plugins/admin/skills/insight/SKILL.md +1 -1
- package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +17 -6
- package/payload/platform/plugins/docs/references/admin-ui.md +16 -5
- package/payload/platform/plugins/memory/references/schema-estate-agent.md +1 -1
- package/payload/platform/scripts/__tests__/account-schema-owned-dirs.test.sh +51 -7
- package/payload/platform/scripts/__tests__/provision-role-stamp.test.sh +4 -1
- package/payload/platform/scripts/lib/account-schema-owned-dirs.py +13 -1
- package/payload/platform/scripts/lib/account-schema-owned-dirs.sh +23 -1
- package/payload/platform/scripts/lib/provision-account-dir.sh +5 -0
- package/payload/server/public/activity.html +5 -5
- package/payload/server/public/assets/{AdminLoginScreens-DgVFsHtd.js → AdminLoginScreens-CFF28MGy.js} +1 -1
- package/payload/server/public/assets/AdminShell-ClIT8c0K.js +2 -0
- package/payload/server/public/assets/{activity-2DL2DwLr.js → activity-CElZcdjR.js} +1 -1
- package/payload/server/public/assets/{admin-COe0dT2U.js → admin-BHiA9_Ks.js} +1 -1
- package/payload/server/public/assets/{bot-CpBuDQlF.js → bot-Q-JmeVT3.js} +1 -1
- package/payload/server/public/assets/{browser-CSApuZrv.js → browser-BrfPJMYF.js} +1 -1
- package/payload/server/public/assets/{calendar-DlvwZnS7.js → calendar-D45S_aal.js} +1 -1
- package/payload/server/public/assets/chat-gy8scQov.js +1 -0
- package/payload/server/public/assets/chevron-down-CdxvexgY.js +1 -0
- package/payload/server/public/assets/chevron-left-D5LLz6ke.js +1 -0
- package/payload/server/public/assets/chevron-right-DzPmwDew.js +1 -0
- package/payload/server/public/assets/data-CUsNHUpu.js +1 -0
- package/payload/server/public/assets/{graph-kaxS9a_7.js → graph-BLO4nVi3.js} +1 -1
- package/payload/server/public/assets/{graph-labels-GgejRtgV.js → graph-labels-ibEi7ggo.js} +1 -1
- package/payload/server/public/assets/{maximize-2-CPq3nwZA.js → maximize-2-CezchDEF.js} +1 -1
- package/payload/server/public/assets/{operator-Cxq9TxaH.js → operator-B-3vkwO8.js} +1 -1
- package/payload/server/public/assets/{page-DBHzC59_.js → page-BL1ko2_-.js} +1 -1
- package/payload/server/public/assets/{page-BE6DkJP9.js → page-BbxoY4QI.js} +1 -1
- package/payload/server/public/assets/{public-jIzvdjt_.js → public-DxfSLhNp.js} +1 -1
- package/payload/server/public/assets/{rotate-ccw-DieZzl10.js → rotate-ccw-CWvGAut4.js} +1 -1
- package/payload/server/public/assets/{tasks-DYyCGz8W.js → tasks-DlXIN3v3.js} +1 -1
- package/payload/server/public/assets/{time-entry-format-CC_9jFuR.js → time-entry-format-VzHwljTv.js} +1 -1
- package/payload/server/public/assets/{triangle-alert-7mQfCQWP.js → triangle-alert-C5BpoPlq.js} +1 -1
- package/payload/server/public/assets/{useCopyFeedback-os7N0yCx.js → useCopyFeedback-h1qT8mpZ.js} +1 -1
- package/payload/server/public/assets/{useSubAccountSwitcher-Bgfqig1V.css → useSubAccountSwitcher-DnfX9Uxe.css} +1 -1
- package/payload/server/public/assets/{useVoiceRecorder-ZFwt5i6d.js → useVoiceRecorder-kqMitFlk.js} +1 -1
- package/payload/server/public/browser.html +4 -4
- package/payload/server/public/calendar.html +6 -6
- package/payload/server/public/chat.html +13 -13
- package/payload/server/public/data.html +10 -10
- package/payload/server/public/graph.html +10 -10
- package/payload/server/public/index.html +15 -15
- package/payload/server/public/operator.html +14 -14
- package/payload/server/public/public.html +13 -13
- package/payload/server/public/tasks.html +6 -6
- package/payload/server/public/assets/AdminShell-BwNqwb4k.js +0 -2
- package/payload/server/public/assets/chat-1SSmFsjd.js +0 -1
- package/payload/server/public/assets/chevron-down-Dnuuw6Q2.js +0 -1
- package/payload/server/public/assets/chevron-left-CC4zmWOr.js +0 -1
- package/payload/server/public/assets/chevron-right-CG_lHTx_.js +0 -1
- package/payload/server/public/assets/data-CJbC_cVy.js +0 -1
- /package/payload/server/public/assets/{useSubAccountSwitcher-Q941cZYV.js → useSubAccountSwitcher-DDStL7Nt.js} +0 -0
package/payload/server/public/assets/{useVoiceRecorder-ZFwt5i6d.js → useVoiceRecorder-kqMitFlk.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/pdf-render-H884L3EI.js","assets/preload-helper-D_sPnjeL.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{o as e}from"./chunk-TPjIAO9U.js";import{N as t,O as n,R as r,U as i,h as a,r as o}from"./useSubAccountSwitcher-Q941cZYV.js";import{n as s,t as c}from"./maximize-2-CPq3nwZA.js";import{n as l,t as u}from"./time-entry-format-CC_9jFuR.js";import{t as d}from"./preload-helper-D_sPnjeL.js";var f=`image/jpeg,image/png,image/gif,image/webp,application/pdf,text/plain,text/markdown,text/csv,text/html,text/calendar,application/zip,application/x-zip-compressed,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.oasis.opendocument.text,text/rtf,application/rtf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,application/vnd.oasis.opendocument.spreadsheet,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.ms-powerpoint,application/vnd.oasis.opendocument.presentation,audio/ogg,audio/opus,audio/mp4,audio/x-m4a,audio/mpeg,audio/webm,audio/wav,video/mp4,.docx,.odt,.rtf,.xlsx,.xls,.ods,.pptx,.ppt,.odp,.opus,.ogg,.m4a,.mp4,.mp3,.wav,.webm`,p=new Set(f.split(`,`).filter(e=>!e.startsWith(`.`))),m=50*1024*1024;function h(e){switch(e){case`expanded`:return!0;case`collapsed`:return!1;default:return}}var g=t(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),_=t(`file-code`,[[`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 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),v=t(`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`}]]),y=t(`mic`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`,key:`1vc78b`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`13`,rx:`3`,key:`s6n7sd`}]]),b=t(`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`}]]),x=t(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),S=t(`reply`,[[`path`,{d:`M20 18v-2a4 4 0 0 0-4-4H4`,key:`5vmcpk`}],[`path`,{d:`m9 17-5-5 5-5`,key:`nvlc11`}]]),C=e(i(),1),w=r();function T({children:e,tail:t=null,repinSignals:n}){let r=(0,C.useRef)(null),i=(0,C.useRef)(null),a=(0,C.useRef)(!0),[o,s]=(0,C.useState)(!0),c=(0,C.useRef)(0),l=(0,C.useRef)(0),u=()=>{let e=r.current;if(!e)return;let t=e.clientHeight,n=e.scrollHeight,i=t!==c.current||n!==l.current;if(c.current=t,l.current=n,i){a.current&&(e.scrollTop=e.scrollHeight);return}let o=n-e.scrollTop-t<=32;a.current=o,s(e=>e===o?e:o)},d=()=>{let e=r.current;e&&(e.scrollTop=e.scrollHeight,l.current=e.scrollHeight,c.current=e.clientHeight,a.current=!0,s(!0))},f=t!=null;return(0,C.useLayoutEffect)(()=>{let e=r.current;e&&a.current&&(e.scrollTop=e.scrollHeight),e&&(l.current=e.scrollHeight,c.current=e.clientHeight)},[...n,f]),(0,C.useLayoutEffect)(()=>{if(typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>u());return r.current&&e.observe(r.current),i.current&&e.observe(i.current),()=>e.disconnect()},[]),(0,w.jsxs)(`div`,{className:`wa-reader`,children:[(0,w.jsx)(`div`,{className:`wa-reader-thread`,ref:r,onScroll:u,children:(0,w.jsxs)(`div`,{className:`wa-thread-scroll`,ref:i,children:[e,t]})}),!o&&(0,w.jsx)(`button`,{type:`button`,className:`wa-jump`,onClick:d,"aria-label":`Jump to latest message`,title:`Jump to latest message`,children:`↓`})]})}var E={auth_expired:`Your session has expired. Please sign in again.`,claude_down:`Claude is currently experiencing an outage. Please try again in a few minutes.`,claude_overloaded:`Claude is overloaded right now. Please try again shortly.`,model_unavailable:`The selected model is currently unavailable. Switch to a different model from the model picker to continue.`,agent_error:`Something went wrong. Please try again.`},D={auth_expired:`I'm not available right now. Please try again later.`,claude_down:`I'm not available right now. Please try again later.`,claude_overloaded:`I'm not available right now. Please try again shortly.`,model_unavailable:`I'm not available right now. Please try again later.`,agent_error:`I'm not available right now. Please try again later.`};function O(e,t=`admin`){return t===`public`?D[e]:E[e]}function k(e){return e===`whatsapp`?` · via WhatsApp`:e===`webchat`?` · via web`:``}var A=56,j=5;function ee(e,t){let n=Math.max(1,Math.floor(e.length/t)),r=[],i=0;for(let a=0;a<t;a++){let t=a*n,o=0,s=0;for(let r=t;r<t+n&&r<e.length;r++)o+=e[r]*e[r],s++;let c=s>0?Math.sqrt(o/s):0;r.push(c),c>i&&(i=c)}return i>0?r.map(e=>e/i):r}function te({src:e,filename:t,onDecodeFail:n,onMediaError:r}){let i=(0,C.useRef)(null),a=(0,C.useRef)(null),o=(0,C.useRef)(!1),[s,c]=(0,C.useState)([]),[d,f]=(0,C.useState)(void 0),[p,m]=(0,C.useState)(!1),[h,g]=(0,C.useState)(0),[_,v]=(0,C.useState)(0);(0,C.useEffect)(()=>{let t=!1,r=null,i=window.AudioContext??window.webkitAudioContext,a=()=>{t||o.current||(o.current=!0,n())};if(!i){a();return}let s=new i;return(async()=>{try{let n=await fetch(e);if(!n.ok)throw Error(`audio fetch ${n.status}`);let i=await n.blob();if(t)return;r=URL.createObjectURL(i),f(r);let a=await s.decodeAudioData(await i.arrayBuffer());if(t)return;c(ee(a.getChannelData(0),A)),Number.isFinite(a.duration)&&a.duration>0&&v(a.duration)}catch{a()}finally{try{s.close()}catch{}}})(),()=>{t=!0,r&&URL.revokeObjectURL(r)}},[e]);let y=()=>{let e=i.current;e&&(p?e.pause():Promise.resolve(e.play()).catch(()=>{}))},b=e=>{let t=i.current;if(!t||!(_>0))return;let n=Math.min(_,Math.max(0,e));t.currentTime=n,g(n)},S=e=>{let t=a.current;if(!t||!(_>0))return;let n=t.getBoundingClientRect();b(Math.min(1,Math.max(0,(e-n.left)/n.width))*_)},T=e=>{S(e.clientX);let t=e=>S(e.clientX),n=()=>{window.removeEventListener(`mousemove`,t),window.removeEventListener(`mouseup`,n)};window.addEventListener(`mousemove`,t),window.addEventListener(`mouseup`,n)},E=e=>{if(!(_>0))return;let t=i.current?.currentTime??0;switch(e.key){case`ArrowRight`:case`ArrowUp`:b(t+j),e.preventDefault();break;case`ArrowLeft`:case`ArrowDown`:b(t-j),e.preventDefault();break;case`Home`:b(0),e.preventDefault();break;case`End`:b(_),e.preventDefault();break;default:break}},D=_>0?Math.min(1,h/_):0,O=Math.round(D*A),k=u(h>0?h:_);return(0,w.jsxs)(`div`,{className:`voice-note`,children:[(0,w.jsx)(`button`,{type:`button`,className:`voice-note-play`,"aria-label":`${p?`Pause`:`Play`} ${t}`,onClick:y,children:p?(0,w.jsx)(x,{size:16,"aria-hidden":!0}):(0,w.jsx)(l,{size:16,"aria-hidden":!0})}),(0,w.jsx)(`div`,{ref:a,className:`voice-note-bars`,role:`slider`,tabIndex:0,"aria-label":`Seek ${t}`,"aria-valuemin":0,"aria-valuemax":Math.round(_),"aria-valuenow":Math.round(h),onMouseDown:T,onKeyDown:E,children:(s.length?s:Array.from({length:A},()=>0)).map((e,t)=>(0,w.jsx)(`span`,{className:`voice-note-bar${t<O?` is-played`:``}`,style:{height:`${Math.max(10,Math.round(e*100))}%`}},t))}),(0,w.jsx)(`span`,{className:`voice-note-time`,children:k}),(0,w.jsx)(`audio`,{ref:i,className:`voice-note-audio`,preload:`metadata`,src:d,"aria-label":t,onPlay:()=>m(!0),onPause:()=>m(!1),onEnded:()=>m(!1),onError:()=>r?.(),onLoadedMetadata:e=>{let t=e.currentTarget.duration;Number.isFinite(t)&&t>0&&v(t)},onTimeUpdate:e=>g(e.currentTarget.currentTime)})]})}var M=/\.(png|jpe?g|gif|webp|svg|bmp)$/i,N=/\.pdf$/i;function ne(e,t){return(t?t.startsWith(`image/`):M.test(e))?`image`:t&&t.startsWith(`audio/`)?`audio`:(t?t===`application/pdf`:N.test(e))?`pdf`:`file`}function P(e,t,n,r){let i=encodeURIComponent(e.path),a=encodeURIComponent(n),o=r?`&disposition=${r}`:``;return e.root===`scratchpad`?`/api/admin/files/download?path=${i}&root=scratchpad&sessionId=${encodeURIComponent(t)}&session_key=${a}${o}`:`/api/admin/files/download?path=${i}&root=data&session_key=${a}${o}`}function F(e,t,n,r){return t===`public`?`/api/public-reader/attachment/${e}?sessionId=${encodeURIComponent(n)}`:`/api/admin/attachment/${e}?session_key=${encodeURIComponent(r)}`}function I(e){if(e<1024)return`${e} B`;let t=e/1024;if(t<1024)return`${t<10?t.toFixed(1):Math.round(t)} KB`;let n=t/1024;return`${n<10?n.toFixed(1):Math.round(n)} MB`}function L({href:e,filename:t,label:n}){return(0,w.jsxs)(`a`,{className:`chat-attachment-chip`,href:e,download:t,children:[(0,w.jsx)(b,{size:14,"aria-hidden":!0}),n]})}function R({href:e,filename:t,className:r,size:i=14,onClick:a}){return(0,w.jsx)(`a`,{className:r,href:e,download:t,"aria-label":`Download ${t}`,onClick:a,children:(0,w.jsx)(n,{size:i,"aria-hidden":!0})})}function re({src:e,filename:t,sizeBytes:n,expandable:r,onFail:i}){let[a,o]=(0,C.useState)(!1),[s,c]=(0,C.useState)(!1),l=n==null?t:`${t} · ${I(n)}`;return s?(0,w.jsx)(L,{href:e,filename:t,label:l}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`span`,{className:`chat-attachment-image-wrap`,children:[(0,w.jsx)(`img`,{className:`chat-attachment-image`,src:e,alt:t,onClick:r?()=>o(!0):void 0,onError:()=>{c(!0),i?.(`fetch`)}}),(0,w.jsx)(R,{href:e,filename:t,className:`chat-attachment-download`})]}),r&&a&&(0,w.jsx)(`div`,{className:`chat-attachment-overlay`,role:`dialog`,"aria-label":t,onClick:()=>o(!1),children:(0,w.jsx)(`img`,{className:`chat-attachment-overlay-image`,src:e,alt:t})})]})}var ie=280,ae=360,oe=16;function z({src:e,filename:t,sizeBytes:n,onFail:r}){let[i,a]=(0,C.useState)(!1),[o,s]=(0,C.useState)(!1),l=(0,C.useRef)(null),u=n==null?t:`${t} · ${I(n)}`;return(0,C.useEffect)(()=>{let t=!1,n=null;return(async()=>{try{let{loadPdf:r,renderPageToFit:i}=await d(async()=>{let{loadPdf:e,renderPageToFit:t}=await import(`./pdf-render-H884L3EI.js`);return{loadPdf:e,renderPageToFit:t}},__vite__mapDeps([0,1])),a=await r(e);n=a;let o=l.current;if(t||!o)return;await i(a,1,o,ie,ae)}catch{t||(s(!0),r?.(`render`))}})(),()=>{t=!0;try{n?.destroy()}catch{}}},[e]),o?(0,w.jsx)(L,{href:e,filename:t,label:u}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{className:`chat-attachment-pdf`,children:[(0,w.jsx)(`canvas`,{ref:l,className:`chat-attachment-pdf-canvas`,"aria-label":t}),(0,w.jsx)(R,{href:e,filename:t,className:`chat-attachment-download`}),(0,w.jsx)(`button`,{type:`button`,className:`chat-attachment-pdf-expand`,"aria-label":`Expand ${t}`,onClick:()=>a(!0),children:(0,w.jsx)(c,{size:14,"aria-hidden":!0})})]}),i&&(0,w.jsx)(se,{src:e,filename:t,label:u,onClose:()=>a(!1),onFail:r})]})}function se({src:e,filename:t,label:n,onClose:r,onFail:i}){let o=(0,C.useRef)(null),s=(0,C.useRef)(null),[c,l]=(0,C.useState)(null),[u,f]=(0,C.useState)(!1);return(0,C.useEffect)(()=>{let t=!1;return(async()=>{try{let{loadPdf:n}=await d(async()=>{let{loadPdf:e}=await import(`./pdf-render-H884L3EI.js`);return{loadPdf:e}},__vite__mapDeps([0,1])),r=await n(e);if(t){try{r.destroy()}catch{}return}s.current=r,l(r.numPages)}catch{t||(f(!0),i?.(`render`))}})(),()=>{t=!0;try{s.current?.destroy()}catch{}}},[e]),(0,C.useEffect)(()=>{if(c==null)return;let e=o.current,t=s.current;if(!e||!t)return;let n=!1;return(async()=>{try{let{renderPageToWidth:r}=await d(async()=>{let{renderPageToWidth:e}=await import(`./pdf-render-H884L3EI.js`);return{renderPageToWidth:e}},__vite__mapDeps([0,1])),i=Array.from(e.querySelectorAll(`canvas.chat-attachment-overlay-page`)),a=Math.max(e.clientWidth-oe*2,1);for(let e=0;e<i.length;e++){if(n)return;await r(t,e+1,i[e],a)}}catch{n||(f(!0),i?.(`render`))}})(),()=>{n=!0}},[c]),(0,w.jsxs)(`div`,{className:`chat-attachment-overlay`,role:`dialog`,"aria-label":t,onClick:r,children:[(0,w.jsx)(`div`,{ref:o,className:`chat-attachment-overlay-pdf`,onClick:e=>e.stopPropagation(),children:u?(0,w.jsx)(L,{href:e,filename:t,label:n}):Array.from({length:c??0},(e,n)=>(0,w.jsx)(`canvas`,{className:`chat-attachment-overlay-page`,"aria-label":`${t} page ${n+1}`},n))}),(0,w.jsx)(R,{href:e,filename:t,className:`chat-attachment-overlay-download`,size:20,onClick:e=>e.stopPropagation()}),(0,w.jsx)(`button`,{type:`button`,className:`chat-attachment-overlay-close`,"aria-label":`Close`,onClick:r,children:(0,w.jsx)(a,{size:20,"aria-hidden":!0})})]})}function ce({src:e,filename:t,onFail:n}){let[r,i]=(0,C.useState)(!1);return r?(0,w.jsx)(`audio`,{className:`chat-attachment-audio`,controls:!0,preload:`metadata`,src:e,"aria-label":t,onError:()=>n?.(`fetch`)}):(0,w.jsx)(te,{src:e,filename:t,onDecodeFail:()=>{i(!0),n?.(`render`)},onMediaError:()=>{i(!0),n?.(`fetch`)}})}function B({filename:e,href:t,mimeType:n,sizeBytes:r,expandable:i,telemetry:a}){let o=ne(e,n);(0,C.useEffect)(()=>{a?.onRender?.({kind:o,mime:n,served:!!t})},[]);let s=a?.onFail?e=>a.onFail({kind:o===`pdf`?`pdf`:o===`audio`?`audio`:`image`,mime:n,reason:e}):void 0;if(o===`image`&&t)return(0,w.jsx)(re,{src:t,filename:e,sizeBytes:r,expandable:i,onFail:s});if(o===`audio`&&t)return(0,w.jsx)(ce,{src:t,filename:e,onFail:s});if(o===`pdf`&&t)return(0,w.jsx)(z,{src:t,filename:e,sizeBytes:r,onFail:s});let c=r==null?e:`${e} · ${I(r)}`;return t?(0,w.jsx)(L,{href:t,filename:e,label:c}):(0,w.jsxs)(`p`,{className:`chat-doc`,children:[(0,w.jsx)(b,{size:14,"aria-hidden":!0,style:{verticalAlign:`text-bottom`}}),` `,c]})}function le(e,t,n,r=`/api/whatsapp-reader/stream`,i=e,a=!0){let[o,s]=(0,C.useState)([]),[c,l]=(0,C.useState)(`open`),[u,d]=(0,C.useState)(null),f=(0,C.useRef)([]);return(0,C.useEffect)(()=>{f.current=o},[o]),(0,C.useEffect)(()=>{s([]),f.current=[],d(null)},[i,t,n,r]),(0,C.useEffect)(()=>{if(l(`open`),!a)return;let i=f.current.slice(),o=i.map(V),c=0,u=i.length>0,p=`${r}?sessionId=${encodeURIComponent(e)}&projectDir=${encodeURIComponent(t)}&session_key=${encodeURIComponent(n)}`,m=new EventSource(p);return m.onopen=()=>{console.info(`[admin-ui] wa-stream onopen sessionId=${e}`),l(`open`)},m.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}if(u){if(c<o.length&&V(t)===o[c]){c+=1;return}u=!1}s(e=>[...e,t])},m.addEventListener(`activity`,e=>{try{d(JSON.parse(e.data))}catch{}}),m.addEventListener(`activity-clear`,()=>d(null)),m.onerror=()=>{m.readyState===2&&(console.error(`[admin-ui] wa-stream onerror readyState=${m.readyState}`),l(`error`))},()=>m.close()},[e,t,n,r,i,a]),{turns:o,status:c,subagentActivity:u}}function V(e){return JSON.stringify(e)}function ue(e,t,n,r=!0){let[i,a]=(0,C.useState)([]),[o,s]=(0,C.useState)(`open`);return(0,C.useEffect)(()=>{if(a([]),s(`open`),!r||!e||!t)return;let i=`/api/whatsapp-reader/store-stream?accountId=${encodeURIComponent(e)}&remoteJid=${encodeURIComponent(t)}&session_key=${encodeURIComponent(n)}`,o=new EventSource(i);return o.onopen=()=>s(`open`),o.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}a(e=>[...e,t])},o.addEventListener(`reaction`,e=>{let t;try{t=JSON.parse(e.data)}catch{return}a(e=>e.map(e=>e.kind===`whatsapp-persisted`&&e.msgKeyId===t.targetMsgKeyId?{...e,reactions:t.reactions}:e))}),o.onerror=()=>{o.readyState===2&&s(`error`)},()=>o.close()},[e,t,n,r]),{turns:i,status:o}}var H=e=>{if(!e)return 1/0;let t=new Date(e).getTime();return Number.isNaN(t)?1/0:t};function de(e,t){let n=[],r=0;return e.forEach((e,t)=>n.push({sort:H(e.ts),sub:1,ins:r++,item:{kind:`turn`,turn:e,idx:t}})),t.forEach(e=>n.push({sort:H(e.ts),sub:0,ins:r++,item:{kind:`directive`,entry:e}})),n.sort((e,t)=>e.sort===t.sort?e.sort===1/0?e.ins-t.ins:e.sub-t.sub||e.ins-t.ins:e.sort<t.sort?-1:1).map(e=>e.item)}function fe(e,t,n=!0){let[r,i]=(0,C.useState)([]);return(0,C.useEffect)(()=>{if(!n||typeof fetch!=`function`)return;let r=!0,a=`/api/whatsapp-reader/directives?sessionId=${encodeURIComponent(e)}&session_key=${encodeURIComponent(t)}`;return fetch(a).then(e=>e.ok?e.json():{entries:[]}).then(e=>{r&&i(Array.isArray(e.entries)?e.entries:[])}).catch(()=>{r&&i([])}),()=>{r=!1}},[e,t,n]),r}var pe=new Set([`operator-inbound`,`operator-typed`,`agent-reply`,`agent-reply-document`,`agent-file`,`agent-error`,`agent-webchat-final`,`whatsapp-persisted`]);function U(e){if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}function W(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}var me=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],he=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function G(e){let t=String(e.getMonth()+1).padStart(2,`0`),n=String(e.getDate()).padStart(2,`0`);return`${e.getFullYear()}-${t}-${n}`}function K(e){if(!e)return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:G(t)}function ge(e,t=new Date){if(!e)return``;let n=new Date(e);if(Number.isNaN(n.getTime()))return``;let r=G(n);if(r===G(t))return`Today`;let i=new Date(t);return i.setDate(i.getDate()-1),r===G(i)?`Yesterday`:`${me[n.getDay()]} ${n.getDate()} ${he[n.getMonth()]} ${n.getFullYear()}`}function q(e){return e.kind===`turn`?e.turn.ts:e.entry.ts}function J({ts:e}){return(0,w.jsx)(`div`,{className:`day-divider`,role:`separator`,children:(0,w.jsx)(`span`,{className:`day-divider-label`,children:ge(e)})})}function Y(){return(0,w.jsx)(`div`,{className:`session-divider`,role:`separator`,children:(0,w.jsx)(`span`,{className:`session-divider-label`,children:`Conversation continued`})})}function X({label:e,ts:t}){return(0,w.jsxs)(`div`,{className:`wa-turn-head`,children:[(0,w.jsx)(`span`,{className:`wa-who`,children:e}),(0,w.jsx)(`time`,{className:`wa-time`,children:U(t)})]})}function _e({turn:e}){let[t,n]=(0,C.useState)(!1),r=e.kind===`tool-result`,i=r?`wa-turn wa-turn-result${e.isError?` is-error`:``}`:`wa-turn wa-turn-tool`,a=r?e.isError?`result (error)`:`result`:`↳ ${e.name}`,o=r?e.text:JSON.stringify(e.input,null,2);return(0,w.jsxs)(`div`,{className:i,children:[(0,w.jsxs)(`button`,{type:`button`,className:`wa-tool-toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[(0,w.jsx)(`span`,{className:`wa-chevron`,children:t?`▾`:`▸`}),(0,w.jsx)(`span`,{className:`wa-who`,children:a}),(0,w.jsx)(`time`,{className:`wa-time`,children:U(e.ts)})]}),t&&(0,w.jsx)(`pre`,{className:`wa-code`,children:o})]})}function Z({entry:e,sessionId:t,sessionKey:n}){let[r,i]=(0,C.useState)(!1),[a,o]=(0,C.useState)(null),s=()=>{let s=!r;if(i(s),s&&a===null&&typeof fetch==`function`){let r=`/api/whatsapp-reader/directive?sessionId=${encodeURIComponent(t)}&name=${encodeURIComponent(e.name)}&session_key=${encodeURIComponent(n)}`;fetch(r).then(e=>e.ok?e.text():`(directive unavailable)`).then(o).catch(()=>o(`(directive unavailable)`))}};return(0,w.jsxs)(`div`,{className:`wa-turn wa-turn-directive`,children:[(0,w.jsxs)(`button`,{type:`button`,className:`wa-tool-toggle`,"aria-expanded":r,onClick:s,children:[(0,w.jsx)(`span`,{className:`wa-chevron`,children:r?`▾`:`▸`}),(0,w.jsxs)(`span`,{className:`wa-who`,children:[`⚙ directive injected (`,e.len,` B)`]}),(0,w.jsx)(`time`,{className:`wa-time`,children:U(e.ts)})]}),r&&(0,w.jsx)(`pre`,{className:`wa-code`,children:a??`Loading…`})]})}function ve(e){return`text`in e&&typeof e.text==`string`?e.text:``}function ye(e,t){let n=(t??``).trim();if(!n)return e;let r=e.toLowerCase(),i=n.toLowerCase(),a=[],o=0,s=0;for(;;){let t=r.indexOf(i,o);if(t===-1){a.push(e.slice(o));break}t>o&&a.push(e.slice(o,t)),a.push((0,w.jsx)(`mark`,{className:`wa-search-hit`,children:e.slice(t,t+i.length)},s++)),o=t+i.length}return a.length===1?a[0]:(0,w.jsx)(w.Fragment,{children:a})}var Q={onRender:({kind:e,mime:t,served:n})=>console.info(`[operator-ui] op=reader-attachment kind=${e} mime=${t??``} served=${n}`),onFail:({kind:e,mime:t,reason:n})=>console.info(`[operator-ui] op=reader-attachment-fail kind=${e} mime=${t??``} reason=${n}`)};function be(e,t,n){switch(e.kind){case`operator-inbound`:return(0,w.jsxs)(`div`,{className:`wa-turn wa-turn-in`,children:[(0,w.jsx)(X,{label:`Operator${k(e.source)}`,ts:e.ts}),e.text&&(0,w.jsx)(`p`,{className:`wa-body`,children:e.text}),e.attachments&&e.attachments.length>0&&(0,w.jsx)(`div`,{className:`chat-attachment-list`,children:e.attachments.map((e,t)=>(0,w.jsx)(B,{expandable:!0,filename:e.filename,mimeType:e.mimeType,sizeBytes:e.sizeBytes,href:F(e.attachmentId,n.audience,n.sessionId,n.sessionKey),telemetry:Q},t))})]},t);case`operator-typed`:return(0,w.jsxs)(`div`,{className:`wa-turn wa-turn-in wa-turn-typed`,children:[(0,w.jsx)(X,{label:`Operator (web)`,ts:e.ts}),(0,w.jsx)(`p`,{className:`wa-body`,children:e.text})]},t);case`agent-text`:return(0,w.jsxs)(`div`,{className:`wa-turn wa-turn-think`,children:[(0,w.jsx)(X,{label:`Agent`,ts:e.ts}),(0,w.jsx)(`p`,{className:`wa-body`,children:e.text})]},t);case`agent-reply`:return(0,w.jsxs)(`div`,{className:`wa-turn wa-turn-out`,children:[(0,w.jsx)(X,{label:`Agent`,ts:e.ts}),(0,w.jsx)(`p`,{className:`wa-body`,children:e.text})]},t);case`agent-reply-document`:return(0,w.jsxs)(`div`,{className:`wa-turn wa-turn-out`,children:[(0,w.jsx)(X,{label:`Agent`,ts:e.ts}),(0,w.jsxs)(`p`,{className:`wa-doc`,children:[(0,w.jsx)(b,{size:14,"aria-hidden":!0,style:{verticalAlign:`text-bottom`}}),` `,`sent document(s): `,e.files.map(W).join(`, `)]}),e.caption&&(0,w.jsx)(`p`,{className:`wa-body`,children:e.caption})]},t);case`agent-file`:return(0,w.jsxs)(`div`,{className:`wa-turn wa-turn-out`,children:[(0,w.jsx)(X,{label:`Agent`,ts:e.ts}),e.files.map((t,r)=>{let i=W(t),a=e.downloads?.[r];return(0,w.jsx)(B,{expandable:!0,filename:i,href:a?P(a,n.sessionId,n.sessionKey,N.test(i)?`inline`:void 0):void 0,telemetry:Q},r)}),e.caption&&(0,w.jsx)(`p`,{className:`wa-body`,children:e.caption})]},t);case`whatsapp-persisted`:{let r=e.origin===`operator-manual`,i=e.fromMe?r?`You`:`Sent`:e.senderName??`Contact`;return(0,w.jsxs)(`div`,{className:`wa-turn ${e.fromMe?`wa-turn-out`:`wa-turn-in`}${r?` wa-op-manual`:``}`,children:[n.onReplyTo&&e.msgKeyId&&(0,w.jsx)(`button`,{type:`button`,className:`wa-bubble-reply`,"aria-label":`Reply to this message`,onClick:()=>n.onReplyTo({msgKeyId:e.msgKeyId,body:e.text,senderName:e.senderName,fromMe:e.fromMe}),children:(0,w.jsx)(S,{size:14})}),n.showCopy&&e.text&&(0,w.jsx)(`button`,{type:`button`,className:`wa-bubble-copy`,"aria-label":`Copy this message`,onClick:()=>{let t=e.text;o(t).then(e=>e?console.info(`[operator-ui] op=wa-copy len=${t.length} ok=true`):console.warn(`[operator-ui] op=wa-copy-fail reason=clipboard-unavailable`))},children:(0,w.jsx)(s,{size:14})}),e.quoted&&(0,w.jsxs)(`div`,{className:`wa-quoted`,children:[(0,w.jsx)(`span`,{className:`wa-quoted-who`,children:e.quoted.fromMe?`You`:e.quoted.sender??`Contact`}),(0,w.jsx)(`span`,{className:`wa-quoted-body`,children:e.quoted.body||`Message`})]}),(0,w.jsx)(X,{label:i,ts:e.ts}),e.text&&(0,w.jsx)(`p`,{className:`wa-body`,children:ye(e.text,n.highlight)}),e.attachments&&e.attachments.length>0&&(0,w.jsx)(`div`,{className:`chat-attachment-list`,children:e.attachments.map((e,t)=>(0,w.jsx)(B,{expandable:!0,filename:e.filename,mimeType:e.mimeType,sizeBytes:e.sizeBytes,href:F(e.attachmentId,n.audience,n.sessionId,n.sessionKey),telemetry:Q},t))}),e.reactions&&e.reactions.length>0&&(0,w.jsx)(`div`,{className:`wa-reactions`,children:e.reactions.map((e,t)=>(0,w.jsx)(`span`,{className:`wa-reaction`,title:e.reactorName??void 0,children:e.emoji},t))}),(0,w.jsxs)(`span`,{className:`wa-bubble-meta`,children:[r&&(0,w.jsx)(`span`,{className:`wa-op-tag`,children:`You`}),(0,w.jsx)(`time`,{className:`wa-bubble-time`,children:U(e.ts)}),e.fromMe&&(0,w.jsx)(g,{size:14,className:`wa-bubble-tick`,"aria-hidden":!0})]})]},t)}case`session-continued`:return(0,w.jsx)(Y,{},t);case`harness-internal`:return null;case`tool-call`:case`tool-result`:return(0,w.jsx)(_e,{turn:e},t);case`agent-error`:return(0,w.jsxs)(`div`,{className:`wa-turn wa-turn-error`,role:`alert`,children:[(0,w.jsx)(X,{label:`Agent`,ts:e.ts}),(0,w.jsx)(`p`,{className:`wa-body wa-error-body`,children:O(e.code,`admin`)}),e.code===`agent_error`&&e.raw&&(0,w.jsx)(`pre`,{className:`wa-code`,children:e.raw})]},t)}}function $(e,t,n,r=`admin`,i,a,o){let s={sessionId:t,sessionKey:n,audience:r,highlight:i,onReplyTo:a,showCopy:o},c=[],l=null;return e.forEach((e,r)=>{let i=q(e),a=K(i);a!==null&&a!==l&&(c.push((0,w.jsx)(J,{ts:i},`day-${r}`)),l=a),c.push(e.kind===`turn`?be(e.turn,r,s):(0,w.jsx)(Z,{entry:e.entry,sessionId:t,sessionKey:n},r))}),c}function xe(e){return e.filter(e=>e.kind===`turn`&&pe.has(e.turn.kind))}var Se=(0,C.memo)(function({sessionId:e,projectDir:t,sessionKey:n,renderItems:r=$,clean:i,onToggleClean:a,forceDeliveredOnly:o=!1,streamEndpoint:s=`/api/whatsapp-reader/stream`,suppressDirectives:c=!1,tail:l=null,resetKey:u,onTurnsChange:d,onActivityChange:f,store:p,search:m,onReplyTo:h}){let g=!!p,_=le(e,t,n,s,u,!g),v=ue(p?.accountId??``,p?.remoteJid??``,n,g),{turns:y,status:b}=g?{turns:v.turns,status:v.status}:{turns:_.turns,status:_.status},x=g?null:_.subagentActivity;(0,C.useEffect)(()=>{f?.(x)},[x,f]),(0,C.useEffect)(()=>{d?.(y.length)},[y.length,d]);let S=de(y,fe(e,n,!c)),E=a==null?!1:!!i,D=o||E?xe(S):S,O=(m??``).trim().toLowerCase(),k=O.length>0,A=k?D.filter(e=>e.kind===`turn`&&ve(e.turn).toLowerCase().includes(O)):D,j=k?D.filter(e=>e.kind===`turn`).length:0;return(0,C.useEffect)(()=>{k&&console.info(`[operator-ui] op=wa-search q=${O} matches=${A.length} ofTurns=${j}`)},[O,k,A.length,j]),(0,w.jsxs)(T,{repinSignals:[y,E,k],tail:l,children:[b===`error`&&(0,w.jsx)(`div`,{className:`wa-reader-error`,children:`Stream disconnected.`}),!k&&y.length===0&&b===`open`&&(0,w.jsx)(`div`,{className:`wa-reader-placeholder`,children:`No messages in this conversation yet.`}),k&&A.length===0&&(0,w.jsxs)(`div`,{className:`wa-reader-placeholder`,children:[`No matches for "`,m,`".`]}),g?$(A,e,n,`admin`,m,h,!0):r(D,e,n)]})});function Ce(e,t){let n=e.split(`;`)[0].trim().toLowerCase();return t.has(n)}var we=[`audio/ogg;codecs=opus`,`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`];function Te(){for(let e of we)if(MediaRecorder.isTypeSupported(e))return e;return``}function Ee(e){return e.split(`;`)[0]}async function De(){return typeof navigator>`u`||!navigator.mediaDevices?.enumerateDevices?[]:(await navigator.mediaDevices.enumerateDevices()).filter(e=>e.kind===`audioinput`)}function Oe(e){let[t,n]=(0,C.useState)(`idle`),[r,i]=(0,C.useState)(0),[a,o]=(0,C.useState)(null),[s,c]=(0,C.useState)(null),l=(0,C.useRef)(null),u=(0,C.useRef)(null),d=(0,C.useRef)([]),f=(0,C.useRef)(``),p=(0,C.useRef)(null),m=(0,C.useRef)(0),h=(0,C.useRef)(0),g=(0,C.useRef)(null),_=(0,C.useRef)(null),v=(0,C.useRef)(0),y=(0,C.useCallback)(()=>{if(p.current&&=(clearInterval(p.current),null),v.current&&=(cancelAnimationFrame(v.current),0),l.current&&l.current.state!==`inactive`)try{l.current.stop()}catch{}l.current=null,d.current=[],u.current&&=(u.current.getTracks().forEach(e=>e.stop()),null),g.current&&(g.current.close().catch(()=>{}),g.current=null,_.current=null),h.current=0,m.current=0},[]);(0,C.useEffect)(()=>y,[y]);let b=(0,C.useCallback)(()=>{m.current=Date.now(),p.current=setInterval(()=>{let e=Date.now()-m.current,t=h.current+e;i(Math.floor(t/1e3))},200)},[]),x=(0,C.useCallback)(()=>{p.current&&=(clearInterval(p.current),null);let e=Date.now()-m.current;h.current+=e},[]),S=(0,C.useCallback)(()=>{let e=_.current;if(!e)return;let t=new Uint8Array(e.frequencyBinCount),n=()=>{e.getByteTimeDomainData(t),o(new Uint8Array(t)),v.current=requestAnimationFrame(n)};n()},[]),w=(0,C.useCallback)(()=>{v.current&&=(cancelAnimationFrame(v.current),0)},[]),T=e?.onResult,E=(0,C.useCallback)(async e=>{if(!(t!==`idle`&&t!==`error`)){if(c(null),typeof window<`u`&&!window.isSecureContext){n(`error`),c(`Voice recording requires a secure connection (HTTPS). Use your tunnel URL for voice notes.`);return}if(typeof navigator>`u`||!navigator.mediaDevices?.getUserMedia){n(`error`),c(`Voice recording is not supported in this browser.`);return}if(typeof MediaRecorder>`u`){n(`error`),c(`Voice recording is not supported in this browser.`);return}try{let t=e?{audio:{deviceId:{exact:e}}}:{audio:!0},r;try{r=await navigator.mediaDevices.getUserMedia(t)}catch(t){let n=t?.name;if(e&&(n===`OverconstrainedError`||n===`NotFoundError`))r=await navigator.mediaDevices.getUserMedia({audio:!0});else throw t}u.current=r;let a=new AudioContext;g.current=a;let s=a.createMediaStreamSource(r),c=a.createAnalyser();c.fftSize=256,s.connect(c),_.current=c;let p=Te();f.current=p;let m=new MediaRecorder(r,p?{mimeType:p}:void 0);l.current=m,d.current=[],m.ondataavailable=e=>{e.data.size>0&&d.current.push(e.data)},r.getAudioTracks()[0]?.addEventListener(`ended`,()=>{y(),n(`idle`),i(0),o(null)}),m.start(1e3),n(`recording`),i(0),b(),S(),T?.({ok:!0})}catch(e){y(),n(`error`),e instanceof DOMException?(T?.({ok:!1,name:e.name,message:e.message}),e.name===`NotAllowedError`?c(`Microphone access was denied. Check your browser permissions to enable voice recording.`):e.name===`NotFoundError`?c(`No microphone found. Connect a microphone to use voice recording.`):e.name===`NotReadableError`?c(`The microphone could not be started even though access was granted. The browser reported: ${e.message} (${e.name}).`):c(`Microphone error (${e.name}): ${e.message}`)):(T?.({ok:!1}),c(`Could not start recording.`))}}},[t,y,b,S,T]),D=(0,C.useCallback)(()=>{let e=l.current;e&&(t===`recording`&&e.state===`recording`?(e.pause(),x(),w(),n(`paused`)):t===`paused`&&e.state===`paused`&&(e.resume(),b(),S(),n(`recording`)))},[t,x,b,S,w]),O=(0,C.useCallback)(()=>{t!==`recording`&&t!==`paused`||(y(),n(`idle`),i(0),o(null))},[t,y]),k=(0,C.useCallback)(async()=>{if(t!==`recording`&&t!==`paused`)return null;let e=l.current;if(!e)return null;let r=t===`recording`?Date.now()-m.current:0;return h.current+r<1e3?(O(),null):(n(`sending`),x(),w(),new Promise(t=>{e.onstop=()=>{let r=f.current||e.mimeType||`audio/webm`,a=new Blob(d.current,{type:Ee(r)});y(),n(`idle`),i(0),o(null),t(a.size>0?a:null)},e.stop()}))},[t,O,x,w,y]);return(0,C.useEffect)(()=>{if(t!==`error`)return;let e=setTimeout(()=>{n(`idle`),c(null)},8e3);return()=>clearTimeout(e)},[t]),{state:t,elapsedSeconds:r,waveform:a,errorMessage:s,start:E,togglePause:D,discard:O,send:k}}export{_ as C,h as D,p as E,v as S,m as T,P as _,Z as a,b,W as c,q as d,B as f,F as g,N as h,J as i,K as l,M as m,Oe as n,Y as o,z as p,Ce as r,Se as s,De as t,U as u,O as v,f as w,y as x,x as y};
|
|
2
|
+
import{o as e}from"./chunk-TPjIAO9U.js";import{N as t,O as n,R as r,U as i,h as a,r as o}from"./useSubAccountSwitcher-DDStL7Nt.js";import{n as s,t as c}from"./maximize-2-CezchDEF.js";import{n as l,t as u}from"./time-entry-format-VzHwljTv.js";import{t as d}from"./preload-helper-D_sPnjeL.js";var f=`image/jpeg,image/png,image/gif,image/webp,application/pdf,text/plain,text/markdown,text/csv,text/html,text/calendar,application/zip,application/x-zip-compressed,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.oasis.opendocument.text,text/rtf,application/rtf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,application/vnd.oasis.opendocument.spreadsheet,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.ms-powerpoint,application/vnd.oasis.opendocument.presentation,audio/ogg,audio/opus,audio/mp4,audio/x-m4a,audio/mpeg,audio/webm,audio/wav,video/mp4,.docx,.odt,.rtf,.xlsx,.xls,.ods,.pptx,.ppt,.odp,.opus,.ogg,.m4a,.mp4,.mp3,.wav,.webm`,p=new Set(f.split(`,`).filter(e=>!e.startsWith(`.`))),m=50*1024*1024;function h(e){switch(e){case`expanded`:return!0;case`collapsed`:return!1;default:return}}var g=t(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),_=t(`file-code`,[[`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 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),v=t(`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`}]]),y=t(`mic`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`,key:`1vc78b`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`13`,rx:`3`,key:`s6n7sd`}]]),b=t(`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`}]]),x=t(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),S=t(`reply`,[[`path`,{d:`M20 18v-2a4 4 0 0 0-4-4H4`,key:`5vmcpk`}],[`path`,{d:`m9 17-5-5 5-5`,key:`nvlc11`}]]),C=e(i(),1),w=r();function T({children:e,tail:t=null,repinSignals:n}){let r=(0,C.useRef)(null),i=(0,C.useRef)(null),a=(0,C.useRef)(!0),[o,s]=(0,C.useState)(!0),c=(0,C.useRef)(0),l=(0,C.useRef)(0),u=()=>{let e=r.current;if(!e)return;let t=e.clientHeight,n=e.scrollHeight,i=t!==c.current||n!==l.current;if(c.current=t,l.current=n,i){a.current&&(e.scrollTop=e.scrollHeight);return}let o=n-e.scrollTop-t<=32;a.current=o,s(e=>e===o?e:o)},d=()=>{let e=r.current;e&&(e.scrollTop=e.scrollHeight,l.current=e.scrollHeight,c.current=e.clientHeight,a.current=!0,s(!0))},f=t!=null;return(0,C.useLayoutEffect)(()=>{let e=r.current;e&&a.current&&(e.scrollTop=e.scrollHeight),e&&(l.current=e.scrollHeight,c.current=e.clientHeight)},[...n,f]),(0,C.useLayoutEffect)(()=>{if(typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>u());return r.current&&e.observe(r.current),i.current&&e.observe(i.current),()=>e.disconnect()},[]),(0,w.jsxs)(`div`,{className:`wa-reader`,children:[(0,w.jsx)(`div`,{className:`wa-reader-thread`,ref:r,onScroll:u,children:(0,w.jsxs)(`div`,{className:`wa-thread-scroll`,ref:i,children:[e,t]})}),!o&&(0,w.jsx)(`button`,{type:`button`,className:`wa-jump`,onClick:d,"aria-label":`Jump to latest message`,title:`Jump to latest message`,children:`↓`})]})}var E={auth_expired:`Your session has expired. Please sign in again.`,claude_down:`Claude is currently experiencing an outage. Please try again in a few minutes.`,claude_overloaded:`Claude is overloaded right now. Please try again shortly.`,model_unavailable:`The selected model is currently unavailable. Switch to a different model from the model picker to continue.`,agent_error:`Something went wrong. Please try again.`},D={auth_expired:`I'm not available right now. Please try again later.`,claude_down:`I'm not available right now. Please try again later.`,claude_overloaded:`I'm not available right now. Please try again shortly.`,model_unavailable:`I'm not available right now. Please try again later.`,agent_error:`I'm not available right now. Please try again later.`};function O(e,t=`admin`){return t===`public`?D[e]:E[e]}function k(e){return e===`whatsapp`?` · via WhatsApp`:e===`webchat`?` · via web`:``}var A=56,j=5;function ee(e,t){let n=Math.max(1,Math.floor(e.length/t)),r=[],i=0;for(let a=0;a<t;a++){let t=a*n,o=0,s=0;for(let r=t;r<t+n&&r<e.length;r++)o+=e[r]*e[r],s++;let c=s>0?Math.sqrt(o/s):0;r.push(c),c>i&&(i=c)}return i>0?r.map(e=>e/i):r}function te({src:e,filename:t,onDecodeFail:n,onMediaError:r}){let i=(0,C.useRef)(null),a=(0,C.useRef)(null),o=(0,C.useRef)(!1),[s,c]=(0,C.useState)([]),[d,f]=(0,C.useState)(void 0),[p,m]=(0,C.useState)(!1),[h,g]=(0,C.useState)(0),[_,v]=(0,C.useState)(0);(0,C.useEffect)(()=>{let t=!1,r=null,i=window.AudioContext??window.webkitAudioContext,a=()=>{t||o.current||(o.current=!0,n())};if(!i){a();return}let s=new i;return(async()=>{try{let n=await fetch(e);if(!n.ok)throw Error(`audio fetch ${n.status}`);let i=await n.blob();if(t)return;r=URL.createObjectURL(i),f(r);let a=await s.decodeAudioData(await i.arrayBuffer());if(t)return;c(ee(a.getChannelData(0),A)),Number.isFinite(a.duration)&&a.duration>0&&v(a.duration)}catch{a()}finally{try{s.close()}catch{}}})(),()=>{t=!0,r&&URL.revokeObjectURL(r)}},[e]);let y=()=>{let e=i.current;e&&(p?e.pause():Promise.resolve(e.play()).catch(()=>{}))},b=e=>{let t=i.current;if(!t||!(_>0))return;let n=Math.min(_,Math.max(0,e));t.currentTime=n,g(n)},S=e=>{let t=a.current;if(!t||!(_>0))return;let n=t.getBoundingClientRect();b(Math.min(1,Math.max(0,(e-n.left)/n.width))*_)},T=e=>{S(e.clientX);let t=e=>S(e.clientX),n=()=>{window.removeEventListener(`mousemove`,t),window.removeEventListener(`mouseup`,n)};window.addEventListener(`mousemove`,t),window.addEventListener(`mouseup`,n)},E=e=>{if(!(_>0))return;let t=i.current?.currentTime??0;switch(e.key){case`ArrowRight`:case`ArrowUp`:b(t+j),e.preventDefault();break;case`ArrowLeft`:case`ArrowDown`:b(t-j),e.preventDefault();break;case`Home`:b(0),e.preventDefault();break;case`End`:b(_),e.preventDefault();break;default:break}},D=_>0?Math.min(1,h/_):0,O=Math.round(D*A),k=u(h>0?h:_);return(0,w.jsxs)(`div`,{className:`voice-note`,children:[(0,w.jsx)(`button`,{type:`button`,className:`voice-note-play`,"aria-label":`${p?`Pause`:`Play`} ${t}`,onClick:y,children:p?(0,w.jsx)(x,{size:16,"aria-hidden":!0}):(0,w.jsx)(l,{size:16,"aria-hidden":!0})}),(0,w.jsx)(`div`,{ref:a,className:`voice-note-bars`,role:`slider`,tabIndex:0,"aria-label":`Seek ${t}`,"aria-valuemin":0,"aria-valuemax":Math.round(_),"aria-valuenow":Math.round(h),onMouseDown:T,onKeyDown:E,children:(s.length?s:Array.from({length:A},()=>0)).map((e,t)=>(0,w.jsx)(`span`,{className:`voice-note-bar${t<O?` is-played`:``}`,style:{height:`${Math.max(10,Math.round(e*100))}%`}},t))}),(0,w.jsx)(`span`,{className:`voice-note-time`,children:k}),(0,w.jsx)(`audio`,{ref:i,className:`voice-note-audio`,preload:`metadata`,src:d,"aria-label":t,onPlay:()=>m(!0),onPause:()=>m(!1),onEnded:()=>m(!1),onError:()=>r?.(),onLoadedMetadata:e=>{let t=e.currentTarget.duration;Number.isFinite(t)&&t>0&&v(t)},onTimeUpdate:e=>g(e.currentTarget.currentTime)})]})}var M=/\.(png|jpe?g|gif|webp|svg|bmp)$/i,N=/\.pdf$/i;function ne(e,t){return(t?t.startsWith(`image/`):M.test(e))?`image`:t&&t.startsWith(`audio/`)?`audio`:(t?t===`application/pdf`:N.test(e))?`pdf`:`file`}function P(e,t,n,r){let i=encodeURIComponent(e.path),a=encodeURIComponent(n),o=r?`&disposition=${r}`:``;return e.root===`scratchpad`?`/api/admin/files/download?path=${i}&root=scratchpad&sessionId=${encodeURIComponent(t)}&session_key=${a}${o}`:`/api/admin/files/download?path=${i}&root=data&session_key=${a}${o}`}function F(e,t,n,r){return t===`public`?`/api/public-reader/attachment/${e}?sessionId=${encodeURIComponent(n)}`:`/api/admin/attachment/${e}?session_key=${encodeURIComponent(r)}`}function I(e){if(e<1024)return`${e} B`;let t=e/1024;if(t<1024)return`${t<10?t.toFixed(1):Math.round(t)} KB`;let n=t/1024;return`${n<10?n.toFixed(1):Math.round(n)} MB`}function L({href:e,filename:t,label:n}){return(0,w.jsxs)(`a`,{className:`chat-attachment-chip`,href:e,download:t,children:[(0,w.jsx)(b,{size:14,"aria-hidden":!0}),n]})}function R({href:e,filename:t,className:r,size:i=14,onClick:a}){return(0,w.jsx)(`a`,{className:r,href:e,download:t,"aria-label":`Download ${t}`,onClick:a,children:(0,w.jsx)(n,{size:i,"aria-hidden":!0})})}function re({src:e,filename:t,sizeBytes:n,expandable:r,onFail:i}){let[a,o]=(0,C.useState)(!1),[s,c]=(0,C.useState)(!1),l=n==null?t:`${t} · ${I(n)}`;return s?(0,w.jsx)(L,{href:e,filename:t,label:l}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`span`,{className:`chat-attachment-image-wrap`,children:[(0,w.jsx)(`img`,{className:`chat-attachment-image`,src:e,alt:t,onClick:r?()=>o(!0):void 0,onError:()=>{c(!0),i?.(`fetch`)}}),(0,w.jsx)(R,{href:e,filename:t,className:`chat-attachment-download`})]}),r&&a&&(0,w.jsx)(`div`,{className:`chat-attachment-overlay`,role:`dialog`,"aria-label":t,onClick:()=>o(!1),children:(0,w.jsx)(`img`,{className:`chat-attachment-overlay-image`,src:e,alt:t})})]})}var ie=280,ae=360,oe=16;function z({src:e,filename:t,sizeBytes:n,onFail:r}){let[i,a]=(0,C.useState)(!1),[o,s]=(0,C.useState)(!1),l=(0,C.useRef)(null),u=n==null?t:`${t} · ${I(n)}`;return(0,C.useEffect)(()=>{let t=!1,n=null;return(async()=>{try{let{loadPdf:r,renderPageToFit:i}=await d(async()=>{let{loadPdf:e,renderPageToFit:t}=await import(`./pdf-render-H884L3EI.js`);return{loadPdf:e,renderPageToFit:t}},__vite__mapDeps([0,1])),a=await r(e);n=a;let o=l.current;if(t||!o)return;await i(a,1,o,ie,ae)}catch{t||(s(!0),r?.(`render`))}})(),()=>{t=!0;try{n?.destroy()}catch{}}},[e]),o?(0,w.jsx)(L,{href:e,filename:t,label:u}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{className:`chat-attachment-pdf`,children:[(0,w.jsx)(`canvas`,{ref:l,className:`chat-attachment-pdf-canvas`,"aria-label":t}),(0,w.jsx)(R,{href:e,filename:t,className:`chat-attachment-download`}),(0,w.jsx)(`button`,{type:`button`,className:`chat-attachment-pdf-expand`,"aria-label":`Expand ${t}`,onClick:()=>a(!0),children:(0,w.jsx)(c,{size:14,"aria-hidden":!0})})]}),i&&(0,w.jsx)(se,{src:e,filename:t,label:u,onClose:()=>a(!1),onFail:r})]})}function se({src:e,filename:t,label:n,onClose:r,onFail:i}){let o=(0,C.useRef)(null),s=(0,C.useRef)(null),[c,l]=(0,C.useState)(null),[u,f]=(0,C.useState)(!1);return(0,C.useEffect)(()=>{let t=!1;return(async()=>{try{let{loadPdf:n}=await d(async()=>{let{loadPdf:e}=await import(`./pdf-render-H884L3EI.js`);return{loadPdf:e}},__vite__mapDeps([0,1])),r=await n(e);if(t){try{r.destroy()}catch{}return}s.current=r,l(r.numPages)}catch{t||(f(!0),i?.(`render`))}})(),()=>{t=!0;try{s.current?.destroy()}catch{}}},[e]),(0,C.useEffect)(()=>{if(c==null)return;let e=o.current,t=s.current;if(!e||!t)return;let n=!1;return(async()=>{try{let{renderPageToWidth:r}=await d(async()=>{let{renderPageToWidth:e}=await import(`./pdf-render-H884L3EI.js`);return{renderPageToWidth:e}},__vite__mapDeps([0,1])),i=Array.from(e.querySelectorAll(`canvas.chat-attachment-overlay-page`)),a=Math.max(e.clientWidth-oe*2,1);for(let e=0;e<i.length;e++){if(n)return;await r(t,e+1,i[e],a)}}catch{n||(f(!0),i?.(`render`))}})(),()=>{n=!0}},[c]),(0,w.jsxs)(`div`,{className:`chat-attachment-overlay`,role:`dialog`,"aria-label":t,onClick:r,children:[(0,w.jsx)(`div`,{ref:o,className:`chat-attachment-overlay-pdf`,onClick:e=>e.stopPropagation(),children:u?(0,w.jsx)(L,{href:e,filename:t,label:n}):Array.from({length:c??0},(e,n)=>(0,w.jsx)(`canvas`,{className:`chat-attachment-overlay-page`,"aria-label":`${t} page ${n+1}`},n))}),(0,w.jsx)(R,{href:e,filename:t,className:`chat-attachment-overlay-download`,size:20,onClick:e=>e.stopPropagation()}),(0,w.jsx)(`button`,{type:`button`,className:`chat-attachment-overlay-close`,"aria-label":`Close`,onClick:r,children:(0,w.jsx)(a,{size:20,"aria-hidden":!0})})]})}function ce({src:e,filename:t,onFail:n}){let[r,i]=(0,C.useState)(!1);return r?(0,w.jsx)(`audio`,{className:`chat-attachment-audio`,controls:!0,preload:`metadata`,src:e,"aria-label":t,onError:()=>n?.(`fetch`)}):(0,w.jsx)(te,{src:e,filename:t,onDecodeFail:()=>{i(!0),n?.(`render`)},onMediaError:()=>{i(!0),n?.(`fetch`)}})}function B({filename:e,href:t,mimeType:n,sizeBytes:r,expandable:i,telemetry:a}){let o=ne(e,n);(0,C.useEffect)(()=>{a?.onRender?.({kind:o,mime:n,served:!!t})},[]);let s=a?.onFail?e=>a.onFail({kind:o===`pdf`?`pdf`:o===`audio`?`audio`:`image`,mime:n,reason:e}):void 0;if(o===`image`&&t)return(0,w.jsx)(re,{src:t,filename:e,sizeBytes:r,expandable:i,onFail:s});if(o===`audio`&&t)return(0,w.jsx)(ce,{src:t,filename:e,onFail:s});if(o===`pdf`&&t)return(0,w.jsx)(z,{src:t,filename:e,sizeBytes:r,onFail:s});let c=r==null?e:`${e} · ${I(r)}`;return t?(0,w.jsx)(L,{href:t,filename:e,label:c}):(0,w.jsxs)(`p`,{className:`chat-doc`,children:[(0,w.jsx)(b,{size:14,"aria-hidden":!0,style:{verticalAlign:`text-bottom`}}),` `,c]})}function le(e,t,n,r=`/api/whatsapp-reader/stream`,i=e,a=!0){let[o,s]=(0,C.useState)([]),[c,l]=(0,C.useState)(`open`),[u,d]=(0,C.useState)(null),f=(0,C.useRef)([]);return(0,C.useEffect)(()=>{f.current=o},[o]),(0,C.useEffect)(()=>{s([]),f.current=[],d(null)},[i,t,n,r]),(0,C.useEffect)(()=>{if(l(`open`),!a)return;let i=f.current.slice(),o=i.map(V),c=0,u=i.length>0,p=`${r}?sessionId=${encodeURIComponent(e)}&projectDir=${encodeURIComponent(t)}&session_key=${encodeURIComponent(n)}`,m=new EventSource(p);return m.onopen=()=>{console.info(`[admin-ui] wa-stream onopen sessionId=${e}`),l(`open`)},m.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}if(u){if(c<o.length&&V(t)===o[c]){c+=1;return}u=!1}s(e=>[...e,t])},m.addEventListener(`activity`,e=>{try{d(JSON.parse(e.data))}catch{}}),m.addEventListener(`activity-clear`,()=>d(null)),m.onerror=()=>{m.readyState===2&&(console.error(`[admin-ui] wa-stream onerror readyState=${m.readyState}`),l(`error`))},()=>m.close()},[e,t,n,r,i,a]),{turns:o,status:c,subagentActivity:u}}function V(e){return JSON.stringify(e)}function ue(e,t,n,r=!0){let[i,a]=(0,C.useState)([]),[o,s]=(0,C.useState)(`open`);return(0,C.useEffect)(()=>{if(a([]),s(`open`),!r||!e||!t)return;let i=`/api/whatsapp-reader/store-stream?accountId=${encodeURIComponent(e)}&remoteJid=${encodeURIComponent(t)}&session_key=${encodeURIComponent(n)}`,o=new EventSource(i);return o.onopen=()=>s(`open`),o.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}a(e=>[...e,t])},o.addEventListener(`reaction`,e=>{let t;try{t=JSON.parse(e.data)}catch{return}a(e=>e.map(e=>e.kind===`whatsapp-persisted`&&e.msgKeyId===t.targetMsgKeyId?{...e,reactions:t.reactions}:e))}),o.onerror=()=>{o.readyState===2&&s(`error`)},()=>o.close()},[e,t,n,r]),{turns:i,status:o}}var H=e=>{if(!e)return 1/0;let t=new Date(e).getTime();return Number.isNaN(t)?1/0:t};function de(e,t){let n=[],r=0;return e.forEach((e,t)=>n.push({sort:H(e.ts),sub:1,ins:r++,item:{kind:`turn`,turn:e,idx:t}})),t.forEach(e=>n.push({sort:H(e.ts),sub:0,ins:r++,item:{kind:`directive`,entry:e}})),n.sort((e,t)=>e.sort===t.sort?e.sort===1/0?e.ins-t.ins:e.sub-t.sub||e.ins-t.ins:e.sort<t.sort?-1:1).map(e=>e.item)}function fe(e,t,n=!0){let[r,i]=(0,C.useState)([]);return(0,C.useEffect)(()=>{if(!n||typeof fetch!=`function`)return;let r=!0,a=`/api/whatsapp-reader/directives?sessionId=${encodeURIComponent(e)}&session_key=${encodeURIComponent(t)}`;return fetch(a).then(e=>e.ok?e.json():{entries:[]}).then(e=>{r&&i(Array.isArray(e.entries)?e.entries:[])}).catch(()=>{r&&i([])}),()=>{r=!1}},[e,t,n]),r}var pe=new Set([`operator-inbound`,`operator-typed`,`agent-reply`,`agent-reply-document`,`agent-file`,`agent-error`,`agent-webchat-final`,`whatsapp-persisted`]);function U(e){if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}function W(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}var me=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],he=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function G(e){let t=String(e.getMonth()+1).padStart(2,`0`),n=String(e.getDate()).padStart(2,`0`);return`${e.getFullYear()}-${t}-${n}`}function K(e){if(!e)return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:G(t)}function ge(e,t=new Date){if(!e)return``;let n=new Date(e);if(Number.isNaN(n.getTime()))return``;let r=G(n);if(r===G(t))return`Today`;let i=new Date(t);return i.setDate(i.getDate()-1),r===G(i)?`Yesterday`:`${me[n.getDay()]} ${n.getDate()} ${he[n.getMonth()]} ${n.getFullYear()}`}function q(e){return e.kind===`turn`?e.turn.ts:e.entry.ts}function J({ts:e}){return(0,w.jsx)(`div`,{className:`day-divider`,role:`separator`,children:(0,w.jsx)(`span`,{className:`day-divider-label`,children:ge(e)})})}function Y(){return(0,w.jsx)(`div`,{className:`session-divider`,role:`separator`,children:(0,w.jsx)(`span`,{className:`session-divider-label`,children:`Conversation continued`})})}function X({label:e,ts:t}){return(0,w.jsxs)(`div`,{className:`wa-turn-head`,children:[(0,w.jsx)(`span`,{className:`wa-who`,children:e}),(0,w.jsx)(`time`,{className:`wa-time`,children:U(t)})]})}function _e({turn:e}){let[t,n]=(0,C.useState)(!1),r=e.kind===`tool-result`,i=r?`wa-turn wa-turn-result${e.isError?` is-error`:``}`:`wa-turn wa-turn-tool`,a=r?e.isError?`result (error)`:`result`:`↳ ${e.name}`,o=r?e.text:JSON.stringify(e.input,null,2);return(0,w.jsxs)(`div`,{className:i,children:[(0,w.jsxs)(`button`,{type:`button`,className:`wa-tool-toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[(0,w.jsx)(`span`,{className:`wa-chevron`,children:t?`▾`:`▸`}),(0,w.jsx)(`span`,{className:`wa-who`,children:a}),(0,w.jsx)(`time`,{className:`wa-time`,children:U(e.ts)})]}),t&&(0,w.jsx)(`pre`,{className:`wa-code`,children:o})]})}function Z({entry:e,sessionId:t,sessionKey:n}){let[r,i]=(0,C.useState)(!1),[a,o]=(0,C.useState)(null),s=()=>{let s=!r;if(i(s),s&&a===null&&typeof fetch==`function`){let r=`/api/whatsapp-reader/directive?sessionId=${encodeURIComponent(t)}&name=${encodeURIComponent(e.name)}&session_key=${encodeURIComponent(n)}`;fetch(r).then(e=>e.ok?e.text():`(directive unavailable)`).then(o).catch(()=>o(`(directive unavailable)`))}};return(0,w.jsxs)(`div`,{className:`wa-turn wa-turn-directive`,children:[(0,w.jsxs)(`button`,{type:`button`,className:`wa-tool-toggle`,"aria-expanded":r,onClick:s,children:[(0,w.jsx)(`span`,{className:`wa-chevron`,children:r?`▾`:`▸`}),(0,w.jsxs)(`span`,{className:`wa-who`,children:[`⚙ directive injected (`,e.len,` B)`]}),(0,w.jsx)(`time`,{className:`wa-time`,children:U(e.ts)})]}),r&&(0,w.jsx)(`pre`,{className:`wa-code`,children:a??`Loading…`})]})}function ve(e){return`text`in e&&typeof e.text==`string`?e.text:``}function ye(e,t){let n=(t??``).trim();if(!n)return e;let r=e.toLowerCase(),i=n.toLowerCase(),a=[],o=0,s=0;for(;;){let t=r.indexOf(i,o);if(t===-1){a.push(e.slice(o));break}t>o&&a.push(e.slice(o,t)),a.push((0,w.jsx)(`mark`,{className:`wa-search-hit`,children:e.slice(t,t+i.length)},s++)),o=t+i.length}return a.length===1?a[0]:(0,w.jsx)(w.Fragment,{children:a})}var Q={onRender:({kind:e,mime:t,served:n})=>console.info(`[operator-ui] op=reader-attachment kind=${e} mime=${t??``} served=${n}`),onFail:({kind:e,mime:t,reason:n})=>console.info(`[operator-ui] op=reader-attachment-fail kind=${e} mime=${t??``} reason=${n}`)};function be(e,t,n){switch(e.kind){case`operator-inbound`:return(0,w.jsxs)(`div`,{className:`wa-turn wa-turn-in`,children:[(0,w.jsx)(X,{label:`Operator${k(e.source)}`,ts:e.ts}),e.text&&(0,w.jsx)(`p`,{className:`wa-body`,children:e.text}),e.attachments&&e.attachments.length>0&&(0,w.jsx)(`div`,{className:`chat-attachment-list`,children:e.attachments.map((e,t)=>(0,w.jsx)(B,{expandable:!0,filename:e.filename,mimeType:e.mimeType,sizeBytes:e.sizeBytes,href:F(e.attachmentId,n.audience,n.sessionId,n.sessionKey),telemetry:Q},t))})]},t);case`operator-typed`:return(0,w.jsxs)(`div`,{className:`wa-turn wa-turn-in wa-turn-typed`,children:[(0,w.jsx)(X,{label:`Operator (web)`,ts:e.ts}),(0,w.jsx)(`p`,{className:`wa-body`,children:e.text})]},t);case`agent-text`:return(0,w.jsxs)(`div`,{className:`wa-turn wa-turn-think`,children:[(0,w.jsx)(X,{label:`Agent`,ts:e.ts}),(0,w.jsx)(`p`,{className:`wa-body`,children:e.text})]},t);case`agent-reply`:return(0,w.jsxs)(`div`,{className:`wa-turn wa-turn-out`,children:[(0,w.jsx)(X,{label:`Agent`,ts:e.ts}),(0,w.jsx)(`p`,{className:`wa-body`,children:e.text})]},t);case`agent-reply-document`:return(0,w.jsxs)(`div`,{className:`wa-turn wa-turn-out`,children:[(0,w.jsx)(X,{label:`Agent`,ts:e.ts}),(0,w.jsxs)(`p`,{className:`wa-doc`,children:[(0,w.jsx)(b,{size:14,"aria-hidden":!0,style:{verticalAlign:`text-bottom`}}),` `,`sent document(s): `,e.files.map(W).join(`, `)]}),e.caption&&(0,w.jsx)(`p`,{className:`wa-body`,children:e.caption})]},t);case`agent-file`:return(0,w.jsxs)(`div`,{className:`wa-turn wa-turn-out`,children:[(0,w.jsx)(X,{label:`Agent`,ts:e.ts}),e.files.map((t,r)=>{let i=W(t),a=e.downloads?.[r];return(0,w.jsx)(B,{expandable:!0,filename:i,href:a?P(a,n.sessionId,n.sessionKey,N.test(i)?`inline`:void 0):void 0,telemetry:Q},r)}),e.caption&&(0,w.jsx)(`p`,{className:`wa-body`,children:e.caption})]},t);case`whatsapp-persisted`:{let r=e.origin===`operator-manual`,i=e.fromMe?r?`You`:`Sent`:e.senderName??`Contact`;return(0,w.jsxs)(`div`,{className:`wa-turn ${e.fromMe?`wa-turn-out`:`wa-turn-in`}${r?` wa-op-manual`:``}`,children:[n.onReplyTo&&e.msgKeyId&&(0,w.jsx)(`button`,{type:`button`,className:`wa-bubble-reply`,"aria-label":`Reply to this message`,onClick:()=>n.onReplyTo({msgKeyId:e.msgKeyId,body:e.text,senderName:e.senderName,fromMe:e.fromMe}),children:(0,w.jsx)(S,{size:14})}),n.showCopy&&e.text&&(0,w.jsx)(`button`,{type:`button`,className:`wa-bubble-copy`,"aria-label":`Copy this message`,onClick:()=>{let t=e.text;o(t).then(e=>e?console.info(`[operator-ui] op=wa-copy len=${t.length} ok=true`):console.warn(`[operator-ui] op=wa-copy-fail reason=clipboard-unavailable`))},children:(0,w.jsx)(s,{size:14})}),e.quoted&&(0,w.jsxs)(`div`,{className:`wa-quoted`,children:[(0,w.jsx)(`span`,{className:`wa-quoted-who`,children:e.quoted.fromMe?`You`:e.quoted.sender??`Contact`}),(0,w.jsx)(`span`,{className:`wa-quoted-body`,children:e.quoted.body||`Message`})]}),(0,w.jsx)(X,{label:i,ts:e.ts}),e.text&&(0,w.jsx)(`p`,{className:`wa-body`,children:ye(e.text,n.highlight)}),e.attachments&&e.attachments.length>0&&(0,w.jsx)(`div`,{className:`chat-attachment-list`,children:e.attachments.map((e,t)=>(0,w.jsx)(B,{expandable:!0,filename:e.filename,mimeType:e.mimeType,sizeBytes:e.sizeBytes,href:F(e.attachmentId,n.audience,n.sessionId,n.sessionKey),telemetry:Q},t))}),e.reactions&&e.reactions.length>0&&(0,w.jsx)(`div`,{className:`wa-reactions`,children:e.reactions.map((e,t)=>(0,w.jsx)(`span`,{className:`wa-reaction`,title:e.reactorName??void 0,children:e.emoji},t))}),(0,w.jsxs)(`span`,{className:`wa-bubble-meta`,children:[r&&(0,w.jsx)(`span`,{className:`wa-op-tag`,children:`You`}),(0,w.jsx)(`time`,{className:`wa-bubble-time`,children:U(e.ts)}),e.fromMe&&(0,w.jsx)(g,{size:14,className:`wa-bubble-tick`,"aria-hidden":!0})]})]},t)}case`session-continued`:return(0,w.jsx)(Y,{},t);case`harness-internal`:return null;case`tool-call`:case`tool-result`:return(0,w.jsx)(_e,{turn:e},t);case`agent-error`:return(0,w.jsxs)(`div`,{className:`wa-turn wa-turn-error`,role:`alert`,children:[(0,w.jsx)(X,{label:`Agent`,ts:e.ts}),(0,w.jsx)(`p`,{className:`wa-body wa-error-body`,children:O(e.code,`admin`)}),e.code===`agent_error`&&e.raw&&(0,w.jsx)(`pre`,{className:`wa-code`,children:e.raw})]},t)}}function $(e,t,n,r=`admin`,i,a,o){let s={sessionId:t,sessionKey:n,audience:r,highlight:i,onReplyTo:a,showCopy:o},c=[],l=null;return e.forEach((e,r)=>{let i=q(e),a=K(i);a!==null&&a!==l&&(c.push((0,w.jsx)(J,{ts:i},`day-${r}`)),l=a),c.push(e.kind===`turn`?be(e.turn,r,s):(0,w.jsx)(Z,{entry:e.entry,sessionId:t,sessionKey:n},r))}),c}function xe(e){return e.filter(e=>e.kind===`turn`&&pe.has(e.turn.kind))}var Se=(0,C.memo)(function({sessionId:e,projectDir:t,sessionKey:n,renderItems:r=$,clean:i,onToggleClean:a,forceDeliveredOnly:o=!1,streamEndpoint:s=`/api/whatsapp-reader/stream`,suppressDirectives:c=!1,tail:l=null,resetKey:u,onTurnsChange:d,onActivityChange:f,store:p,search:m,onReplyTo:h}){let g=!!p,_=le(e,t,n,s,u,!g),v=ue(p?.accountId??``,p?.remoteJid??``,n,g),{turns:y,status:b}=g?{turns:v.turns,status:v.status}:{turns:_.turns,status:_.status},x=g?null:_.subagentActivity;(0,C.useEffect)(()=>{f?.(x)},[x,f]),(0,C.useEffect)(()=>{d?.(y.length)},[y.length,d]);let S=de(y,fe(e,n,!c)),E=a==null?!1:!!i,D=o||E?xe(S):S,O=(m??``).trim().toLowerCase(),k=O.length>0,A=k?D.filter(e=>e.kind===`turn`&&ve(e.turn).toLowerCase().includes(O)):D,j=k?D.filter(e=>e.kind===`turn`).length:0;return(0,C.useEffect)(()=>{k&&console.info(`[operator-ui] op=wa-search q=${O} matches=${A.length} ofTurns=${j}`)},[O,k,A.length,j]),(0,w.jsxs)(T,{repinSignals:[y,E,k],tail:l,children:[b===`error`&&(0,w.jsx)(`div`,{className:`wa-reader-error`,children:`Stream disconnected.`}),!k&&y.length===0&&b===`open`&&(0,w.jsx)(`div`,{className:`wa-reader-placeholder`,children:`No messages in this conversation yet.`}),k&&A.length===0&&(0,w.jsxs)(`div`,{className:`wa-reader-placeholder`,children:[`No matches for "`,m,`".`]}),g?$(A,e,n,`admin`,m,h,!0):r(D,e,n)]})});function Ce(e,t){let n=e.split(`;`)[0].trim().toLowerCase();return t.has(n)}var we=[`audio/ogg;codecs=opus`,`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`];function Te(){for(let e of we)if(MediaRecorder.isTypeSupported(e))return e;return``}function Ee(e){return e.split(`;`)[0]}async function De(){return typeof navigator>`u`||!navigator.mediaDevices?.enumerateDevices?[]:(await navigator.mediaDevices.enumerateDevices()).filter(e=>e.kind===`audioinput`)}function Oe(e){let[t,n]=(0,C.useState)(`idle`),[r,i]=(0,C.useState)(0),[a,o]=(0,C.useState)(null),[s,c]=(0,C.useState)(null),l=(0,C.useRef)(null),u=(0,C.useRef)(null),d=(0,C.useRef)([]),f=(0,C.useRef)(``),p=(0,C.useRef)(null),m=(0,C.useRef)(0),h=(0,C.useRef)(0),g=(0,C.useRef)(null),_=(0,C.useRef)(null),v=(0,C.useRef)(0),y=(0,C.useCallback)(()=>{if(p.current&&=(clearInterval(p.current),null),v.current&&=(cancelAnimationFrame(v.current),0),l.current&&l.current.state!==`inactive`)try{l.current.stop()}catch{}l.current=null,d.current=[],u.current&&=(u.current.getTracks().forEach(e=>e.stop()),null),g.current&&(g.current.close().catch(()=>{}),g.current=null,_.current=null),h.current=0,m.current=0},[]);(0,C.useEffect)(()=>y,[y]);let b=(0,C.useCallback)(()=>{m.current=Date.now(),p.current=setInterval(()=>{let e=Date.now()-m.current,t=h.current+e;i(Math.floor(t/1e3))},200)},[]),x=(0,C.useCallback)(()=>{p.current&&=(clearInterval(p.current),null);let e=Date.now()-m.current;h.current+=e},[]),S=(0,C.useCallback)(()=>{let e=_.current;if(!e)return;let t=new Uint8Array(e.frequencyBinCount),n=()=>{e.getByteTimeDomainData(t),o(new Uint8Array(t)),v.current=requestAnimationFrame(n)};n()},[]),w=(0,C.useCallback)(()=>{v.current&&=(cancelAnimationFrame(v.current),0)},[]),T=e?.onResult,E=(0,C.useCallback)(async e=>{if(!(t!==`idle`&&t!==`error`)){if(c(null),typeof window<`u`&&!window.isSecureContext){n(`error`),c(`Voice recording requires a secure connection (HTTPS). Use your tunnel URL for voice notes.`);return}if(typeof navigator>`u`||!navigator.mediaDevices?.getUserMedia){n(`error`),c(`Voice recording is not supported in this browser.`);return}if(typeof MediaRecorder>`u`){n(`error`),c(`Voice recording is not supported in this browser.`);return}try{let t=e?{audio:{deviceId:{exact:e}}}:{audio:!0},r;try{r=await navigator.mediaDevices.getUserMedia(t)}catch(t){let n=t?.name;if(e&&(n===`OverconstrainedError`||n===`NotFoundError`))r=await navigator.mediaDevices.getUserMedia({audio:!0});else throw t}u.current=r;let a=new AudioContext;g.current=a;let s=a.createMediaStreamSource(r),c=a.createAnalyser();c.fftSize=256,s.connect(c),_.current=c;let p=Te();f.current=p;let m=new MediaRecorder(r,p?{mimeType:p}:void 0);l.current=m,d.current=[],m.ondataavailable=e=>{e.data.size>0&&d.current.push(e.data)},r.getAudioTracks()[0]?.addEventListener(`ended`,()=>{y(),n(`idle`),i(0),o(null)}),m.start(1e3),n(`recording`),i(0),b(),S(),T?.({ok:!0})}catch(e){y(),n(`error`),e instanceof DOMException?(T?.({ok:!1,name:e.name,message:e.message}),e.name===`NotAllowedError`?c(`Microphone access was denied. Check your browser permissions to enable voice recording.`):e.name===`NotFoundError`?c(`No microphone found. Connect a microphone to use voice recording.`):e.name===`NotReadableError`?c(`The microphone could not be started even though access was granted. The browser reported: ${e.message} (${e.name}).`):c(`Microphone error (${e.name}): ${e.message}`)):(T?.({ok:!1}),c(`Could not start recording.`))}}},[t,y,b,S,T]),D=(0,C.useCallback)(()=>{let e=l.current;e&&(t===`recording`&&e.state===`recording`?(e.pause(),x(),w(),n(`paused`)):t===`paused`&&e.state===`paused`&&(e.resume(),b(),S(),n(`recording`)))},[t,x,b,S,w]),O=(0,C.useCallback)(()=>{t!==`recording`&&t!==`paused`||(y(),n(`idle`),i(0),o(null))},[t,y]),k=(0,C.useCallback)(async()=>{if(t!==`recording`&&t!==`paused`)return null;let e=l.current;if(!e)return null;let r=t===`recording`?Date.now()-m.current:0;return h.current+r<1e3?(O(),null):(n(`sending`),x(),w(),new Promise(t=>{e.onstop=()=>{let r=f.current||e.mimeType||`audio/webm`,a=new Blob(d.current,{type:Ee(r)});y(),n(`idle`),i(0),o(null),t(a.size>0?a:null)},e.stop()}))},[t,O,x,w,y]);return(0,C.useEffect)(()=>{if(t!==`error`)return;let e=setTimeout(()=>{n(`idle`),c(null)},8e3);return()=>clearTimeout(e)},[t]),{state:t,elapsedSeconds:r,waveform:a,errorMessage:s,start:E,togglePause:D,discard:O,send:k}}export{_ as C,h as D,p as E,v as S,m as T,P as _,Z as a,b,W as c,q as d,B as f,F as g,N as h,J as i,K as l,M as m,Oe as n,Y as o,z as p,Ce as r,Se as s,De as t,U as u,O as v,f as w,y as x,x as y};
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Browser — Maxy</title>
|
|
7
7
|
<link rel="icon" href="/favicon.ico">
|
|
8
|
-
<script type="module" crossorigin src="/assets/browser-
|
|
8
|
+
<script type="module" crossorigin src="/assets/browser-BrfPJMYF.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/chunk-TPjIAO9U.js">
|
|
10
|
-
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/AdminShell-
|
|
12
|
-
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-
|
|
10
|
+
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-DDStL7Nt.js">
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/AdminShell-ClIT8c0K.js">
|
|
12
|
+
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-DnfX9Uxe.css">
|
|
13
13
|
<link rel="stylesheet" href="/brand-defaults.css">
|
|
14
14
|
</head>
|
|
15
15
|
<body>
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Calendar — Maxy</title>
|
|
7
7
|
<link rel="icon" href="/favicon.ico">
|
|
8
|
-
<script type="module" crossorigin src="/assets/calendar-
|
|
8
|
+
<script type="module" crossorigin src="/assets/calendar-D45S_aal.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/chunk-TPjIAO9U.js">
|
|
10
|
-
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/AdminShell-
|
|
12
|
-
<link rel="modulepreload" crossorigin href="/assets/chevron-left-
|
|
13
|
-
<link rel="modulepreload" crossorigin href="/assets/chevron-right-
|
|
14
|
-
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-
|
|
10
|
+
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-DDStL7Nt.js">
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/AdminShell-ClIT8c0K.js">
|
|
12
|
+
<link rel="modulepreload" crossorigin href="/assets/chevron-left-D5LLz6ke.js">
|
|
13
|
+
<link rel="modulepreload" crossorigin href="/assets/chevron-right-DzPmwDew.js">
|
|
14
|
+
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-DnfX9Uxe.css">
|
|
15
15
|
<link rel="stylesheet" href="/brand-defaults.css">
|
|
16
16
|
</head>
|
|
17
17
|
<body>
|
|
@@ -5,21 +5,21 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Chat — Maxy</title>
|
|
7
7
|
<link rel="icon" href="/favicon.ico">
|
|
8
|
-
<script type="module" crossorigin src="/assets/chat-
|
|
8
|
+
<script type="module" crossorigin src="/assets/chat-gy8scQov.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/chunk-TPjIAO9U.js">
|
|
10
|
-
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/AdminShell-
|
|
10
|
+
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-DDStL7Nt.js">
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/AdminShell-ClIT8c0K.js">
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-D_sPnjeL.js">
|
|
13
|
-
<link rel="modulepreload" crossorigin href="/assets/time-entry-format-
|
|
14
|
-
<link rel="modulepreload" crossorigin href="/assets/maximize-2-
|
|
15
|
-
<link rel="modulepreload" crossorigin href="/assets/useVoiceRecorder-
|
|
16
|
-
<link rel="modulepreload" crossorigin href="/assets/useCopyFeedback-
|
|
17
|
-
<link rel="modulepreload" crossorigin href="/assets/bot-
|
|
18
|
-
<link rel="modulepreload" crossorigin href="/assets/chevron-down-
|
|
19
|
-
<link rel="modulepreload" crossorigin href="/assets/chevron-left-
|
|
20
|
-
<link rel="modulepreload" crossorigin href="/assets/rotate-ccw-
|
|
21
|
-
<link rel="modulepreload" crossorigin href="/assets/page-
|
|
22
|
-
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-
|
|
13
|
+
<link rel="modulepreload" crossorigin href="/assets/time-entry-format-VzHwljTv.js">
|
|
14
|
+
<link rel="modulepreload" crossorigin href="/assets/maximize-2-CezchDEF.js">
|
|
15
|
+
<link rel="modulepreload" crossorigin href="/assets/useVoiceRecorder-kqMitFlk.js">
|
|
16
|
+
<link rel="modulepreload" crossorigin href="/assets/useCopyFeedback-h1qT8mpZ.js">
|
|
17
|
+
<link rel="modulepreload" crossorigin href="/assets/bot-Q-JmeVT3.js">
|
|
18
|
+
<link rel="modulepreload" crossorigin href="/assets/chevron-down-CdxvexgY.js">
|
|
19
|
+
<link rel="modulepreload" crossorigin href="/assets/chevron-left-D5LLz6ke.js">
|
|
20
|
+
<link rel="modulepreload" crossorigin href="/assets/rotate-ccw-CWvGAut4.js">
|
|
21
|
+
<link rel="modulepreload" crossorigin href="/assets/page-BL1ko2_-.js">
|
|
22
|
+
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-DnfX9Uxe.css">
|
|
23
23
|
<link rel="stylesheet" href="/brand-defaults.css">
|
|
24
24
|
</head>
|
|
25
25
|
<body>
|
|
@@ -5,18 +5,18 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Data — Maxy</title>
|
|
7
7
|
<link rel="icon" href="/favicon.ico">
|
|
8
|
-
<script type="module" crossorigin src="/assets/data-
|
|
8
|
+
<script type="module" crossorigin src="/assets/data-CUsNHUpu.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/chunk-TPjIAO9U.js">
|
|
10
|
-
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/graph-labels-
|
|
10
|
+
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-DDStL7Nt.js">
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/graph-labels-ibEi7ggo.js">
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-D_sPnjeL.js">
|
|
13
|
-
<link rel="modulepreload" crossorigin href="/assets/time-entry-format-
|
|
14
|
-
<link rel="modulepreload" crossorigin href="/assets/maximize-2-
|
|
15
|
-
<link rel="modulepreload" crossorigin href="/assets/useVoiceRecorder-
|
|
16
|
-
<link rel="modulepreload" crossorigin href="/assets/chevron-left-
|
|
17
|
-
<link rel="modulepreload" crossorigin href="/assets/triangle-alert-
|
|
18
|
-
<link rel="modulepreload" crossorigin href="/assets/page-
|
|
19
|
-
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-
|
|
13
|
+
<link rel="modulepreload" crossorigin href="/assets/time-entry-format-VzHwljTv.js">
|
|
14
|
+
<link rel="modulepreload" crossorigin href="/assets/maximize-2-CezchDEF.js">
|
|
15
|
+
<link rel="modulepreload" crossorigin href="/assets/useVoiceRecorder-kqMitFlk.js">
|
|
16
|
+
<link rel="modulepreload" crossorigin href="/assets/chevron-left-D5LLz6ke.js">
|
|
17
|
+
<link rel="modulepreload" crossorigin href="/assets/triangle-alert-C5BpoPlq.js">
|
|
18
|
+
<link rel="modulepreload" crossorigin href="/assets/page-BbxoY4QI.js">
|
|
19
|
+
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-DnfX9Uxe.css">
|
|
20
20
|
<link rel="stylesheet" href="/brand-defaults.css">
|
|
21
21
|
</head>
|
|
22
22
|
<body>
|
|
@@ -5,17 +5,17 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Graph — Maxy</title>
|
|
7
7
|
<link rel="icon" href="/favicon.ico">
|
|
8
|
-
<script type="module" crossorigin src="/assets/graph-
|
|
8
|
+
<script type="module" crossorigin src="/assets/graph-BLO4nVi3.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/chunk-TPjIAO9U.js">
|
|
10
|
-
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/graph-labels-
|
|
12
|
-
<link rel="modulepreload" crossorigin href="/assets/AdminShell-
|
|
13
|
-
<link rel="modulepreload" crossorigin href="/assets/useCopyFeedback-
|
|
14
|
-
<link rel="modulepreload" crossorigin href="/assets/chevron-down-
|
|
15
|
-
<link rel="modulepreload" crossorigin href="/assets/chevron-left-
|
|
16
|
-
<link rel="modulepreload" crossorigin href="/assets/maximize-2-
|
|
17
|
-
<link rel="modulepreload" crossorigin href="/assets/rotate-ccw-
|
|
18
|
-
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-
|
|
10
|
+
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-DDStL7Nt.js">
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/graph-labels-ibEi7ggo.js">
|
|
12
|
+
<link rel="modulepreload" crossorigin href="/assets/AdminShell-ClIT8c0K.js">
|
|
13
|
+
<link rel="modulepreload" crossorigin href="/assets/useCopyFeedback-h1qT8mpZ.js">
|
|
14
|
+
<link rel="modulepreload" crossorigin href="/assets/chevron-down-CdxvexgY.js">
|
|
15
|
+
<link rel="modulepreload" crossorigin href="/assets/chevron-left-D5LLz6ke.js">
|
|
16
|
+
<link rel="modulepreload" crossorigin href="/assets/maximize-2-CezchDEF.js">
|
|
17
|
+
<link rel="modulepreload" crossorigin href="/assets/rotate-ccw-CWvGAut4.js">
|
|
18
|
+
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-DnfX9Uxe.css">
|
|
19
19
|
<link rel="stylesheet" href="/brand-defaults.css">
|
|
20
20
|
</head>
|
|
21
21
|
<body>
|
|
@@ -5,23 +5,23 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Maxy</title>
|
|
7
7
|
<link rel="icon" href="/favicon.ico">
|
|
8
|
-
<script type="module" crossorigin src="/assets/admin-
|
|
8
|
+
<script type="module" crossorigin src="/assets/admin-BHiA9_Ks.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/chunk-TPjIAO9U.js">
|
|
10
|
-
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/graph-labels-
|
|
12
|
-
<link rel="modulepreload" crossorigin href="/assets/AdminShell-
|
|
10
|
+
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-DDStL7Nt.js">
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/graph-labels-ibEi7ggo.js">
|
|
12
|
+
<link rel="modulepreload" crossorigin href="/assets/AdminShell-ClIT8c0K.js">
|
|
13
13
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-D_sPnjeL.js">
|
|
14
|
-
<link rel="modulepreload" crossorigin href="/assets/time-entry-format-
|
|
15
|
-
<link rel="modulepreload" crossorigin href="/assets/maximize-2-
|
|
16
|
-
<link rel="modulepreload" crossorigin href="/assets/useVoiceRecorder-
|
|
17
|
-
<link rel="modulepreload" crossorigin href="/assets/AdminLoginScreens-
|
|
18
|
-
<link rel="modulepreload" crossorigin href="/assets/chevron-left-
|
|
19
|
-
<link rel="modulepreload" crossorigin href="/assets/triangle-alert-
|
|
20
|
-
<link rel="modulepreload" crossorigin href="/assets/page-
|
|
21
|
-
<link rel="modulepreload" crossorigin href="/assets/bot-
|
|
22
|
-
<link rel="modulepreload" crossorigin href="/assets/chevron-down-
|
|
23
|
-
<link rel="modulepreload" crossorigin href="/assets/chevron-right-
|
|
24
|
-
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-
|
|
14
|
+
<link rel="modulepreload" crossorigin href="/assets/time-entry-format-VzHwljTv.js">
|
|
15
|
+
<link rel="modulepreload" crossorigin href="/assets/maximize-2-CezchDEF.js">
|
|
16
|
+
<link rel="modulepreload" crossorigin href="/assets/useVoiceRecorder-kqMitFlk.js">
|
|
17
|
+
<link rel="modulepreload" crossorigin href="/assets/AdminLoginScreens-CFF28MGy.js">
|
|
18
|
+
<link rel="modulepreload" crossorigin href="/assets/chevron-left-D5LLz6ke.js">
|
|
19
|
+
<link rel="modulepreload" crossorigin href="/assets/triangle-alert-C5BpoPlq.js">
|
|
20
|
+
<link rel="modulepreload" crossorigin href="/assets/page-BbxoY4QI.js">
|
|
21
|
+
<link rel="modulepreload" crossorigin href="/assets/bot-Q-JmeVT3.js">
|
|
22
|
+
<link rel="modulepreload" crossorigin href="/assets/chevron-down-CdxvexgY.js">
|
|
23
|
+
<link rel="modulepreload" crossorigin href="/assets/chevron-right-DzPmwDew.js">
|
|
24
|
+
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-DnfX9Uxe.css">
|
|
25
25
|
<link rel="stylesheet" crossorigin href="/assets/AdminLoginScreens-CWMpccrR.css">
|
|
26
26
|
<link rel="stylesheet" href="/brand-defaults.css">
|
|
27
27
|
</head>
|
|
@@ -5,22 +5,22 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Operator — Maxy</title>
|
|
7
7
|
<link rel="icon" href="/favicon.ico">
|
|
8
|
-
<script type="module" crossorigin src="/assets/operator-
|
|
8
|
+
<script type="module" crossorigin src="/assets/operator-B-3vkwO8.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/chunk-TPjIAO9U.js">
|
|
10
|
-
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/AdminShell-
|
|
10
|
+
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-DDStL7Nt.js">
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/AdminShell-ClIT8c0K.js">
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-D_sPnjeL.js">
|
|
13
|
-
<link rel="modulepreload" crossorigin href="/assets/time-entry-format-
|
|
14
|
-
<link rel="modulepreload" crossorigin href="/assets/maximize-2-
|
|
15
|
-
<link rel="modulepreload" crossorigin href="/assets/useVoiceRecorder-
|
|
16
|
-
<link rel="modulepreload" crossorigin href="/assets/AdminLoginScreens-
|
|
17
|
-
<link rel="modulepreload" crossorigin href="/assets/useCopyFeedback-
|
|
18
|
-
<link rel="modulepreload" crossorigin href="/assets/bot-
|
|
19
|
-
<link rel="modulepreload" crossorigin href="/assets/chevron-down-
|
|
20
|
-
<link rel="modulepreload" crossorigin href="/assets/chevron-left-
|
|
21
|
-
<link rel="modulepreload" crossorigin href="/assets/rotate-ccw-
|
|
22
|
-
<link rel="modulepreload" crossorigin href="/assets/page-
|
|
23
|
-
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-
|
|
13
|
+
<link rel="modulepreload" crossorigin href="/assets/time-entry-format-VzHwljTv.js">
|
|
14
|
+
<link rel="modulepreload" crossorigin href="/assets/maximize-2-CezchDEF.js">
|
|
15
|
+
<link rel="modulepreload" crossorigin href="/assets/useVoiceRecorder-kqMitFlk.js">
|
|
16
|
+
<link rel="modulepreload" crossorigin href="/assets/AdminLoginScreens-CFF28MGy.js">
|
|
17
|
+
<link rel="modulepreload" crossorigin href="/assets/useCopyFeedback-h1qT8mpZ.js">
|
|
18
|
+
<link rel="modulepreload" crossorigin href="/assets/bot-Q-JmeVT3.js">
|
|
19
|
+
<link rel="modulepreload" crossorigin href="/assets/chevron-down-CdxvexgY.js">
|
|
20
|
+
<link rel="modulepreload" crossorigin href="/assets/chevron-left-D5LLz6ke.js">
|
|
21
|
+
<link rel="modulepreload" crossorigin href="/assets/rotate-ccw-CWvGAut4.js">
|
|
22
|
+
<link rel="modulepreload" crossorigin href="/assets/page-BL1ko2_-.js">
|
|
23
|
+
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-DnfX9Uxe.css">
|
|
24
24
|
<link rel="stylesheet" crossorigin href="/assets/AdminLoginScreens-CWMpccrR.css">
|
|
25
25
|
<link rel="stylesheet" href="/brand-defaults.css">
|
|
26
26
|
</head>
|
|
@@ -5,21 +5,21 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Maxy</title>
|
|
7
7
|
<link rel="icon" href="/favicon.ico">
|
|
8
|
-
<script type="module" crossorigin src="/assets/public-
|
|
8
|
+
<script type="module" crossorigin src="/assets/public-DxfSLhNp.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/chunk-TPjIAO9U.js">
|
|
10
|
-
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/AdminShell-
|
|
10
|
+
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-DDStL7Nt.js">
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/AdminShell-ClIT8c0K.js">
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-D_sPnjeL.js">
|
|
13
|
-
<link rel="modulepreload" crossorigin href="/assets/time-entry-format-
|
|
14
|
-
<link rel="modulepreload" crossorigin href="/assets/maximize-2-
|
|
15
|
-
<link rel="modulepreload" crossorigin href="/assets/useVoiceRecorder-
|
|
16
|
-
<link rel="modulepreload" crossorigin href="/assets/useCopyFeedback-
|
|
17
|
-
<link rel="modulepreload" crossorigin href="/assets/bot-
|
|
18
|
-
<link rel="modulepreload" crossorigin href="/assets/chevron-down-
|
|
19
|
-
<link rel="modulepreload" crossorigin href="/assets/chevron-left-
|
|
20
|
-
<link rel="modulepreload" crossorigin href="/assets/rotate-ccw-
|
|
21
|
-
<link rel="modulepreload" crossorigin href="/assets/page-
|
|
22
|
-
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-
|
|
13
|
+
<link rel="modulepreload" crossorigin href="/assets/time-entry-format-VzHwljTv.js">
|
|
14
|
+
<link rel="modulepreload" crossorigin href="/assets/maximize-2-CezchDEF.js">
|
|
15
|
+
<link rel="modulepreload" crossorigin href="/assets/useVoiceRecorder-kqMitFlk.js">
|
|
16
|
+
<link rel="modulepreload" crossorigin href="/assets/useCopyFeedback-h1qT8mpZ.js">
|
|
17
|
+
<link rel="modulepreload" crossorigin href="/assets/bot-Q-JmeVT3.js">
|
|
18
|
+
<link rel="modulepreload" crossorigin href="/assets/chevron-down-CdxvexgY.js">
|
|
19
|
+
<link rel="modulepreload" crossorigin href="/assets/chevron-left-D5LLz6ke.js">
|
|
20
|
+
<link rel="modulepreload" crossorigin href="/assets/rotate-ccw-CWvGAut4.js">
|
|
21
|
+
<link rel="modulepreload" crossorigin href="/assets/page-BL1ko2_-.js">
|
|
22
|
+
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-DnfX9Uxe.css">
|
|
23
23
|
<link rel="stylesheet" href="/brand-defaults.css">
|
|
24
24
|
</head>
|
|
25
25
|
<body class="public-surface">
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Tasks — Maxy</title>
|
|
7
7
|
<link rel="icon" href="/favicon.ico">
|
|
8
|
-
<script type="module" crossorigin src="/assets/tasks-
|
|
8
|
+
<script type="module" crossorigin src="/assets/tasks-DlXIN3v3.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/chunk-TPjIAO9U.js">
|
|
10
|
-
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/AdminShell-
|
|
12
|
-
<link rel="modulepreload" crossorigin href="/assets/time-entry-format-
|
|
13
|
-
<link rel="modulepreload" crossorigin href="/assets/rotate-ccw-
|
|
14
|
-
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-
|
|
10
|
+
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-DDStL7Nt.js">
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/AdminShell-ClIT8c0K.js">
|
|
12
|
+
<link rel="modulepreload" crossorigin href="/assets/time-entry-format-VzHwljTv.js">
|
|
13
|
+
<link rel="modulepreload" crossorigin href="/assets/rotate-ccw-CWvGAut4.js">
|
|
14
|
+
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-DnfX9Uxe.css">
|
|
15
15
|
<link rel="stylesheet" href="/brand-defaults.css">
|
|
16
16
|
</head>
|
|
17
17
|
<body>
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./chunk-TPjIAO9U.js";import{C as t,D as n,E as r,F as i,H as a,L as o,M as s,N as c,O as l,P as u,R as d,S as f,T as p,U as m,_ as h,a as g,b as _,d as ee,f as te,g as v,h as y,j as b,k as x,m as S,o as ne,r as C,t as re,u as ie,v as ae,w as oe,x as se,y as w}from"./useSubAccountSwitcher-Q941cZYV.js";async function ce(){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 T=d();function le({checked:e,onChange:t,label:n,disabled:r,ariaLabel:i=n}){return(0,T.jsxs)(`label`,{className:`maxy-checkbox${r?` maxy-checkbox--disabled`:``}`,children:[(0,T.jsx)(`input`,{type:`checkbox`,"aria-label":i,checked:e,onChange:e=>t(e.target.checked),disabled:r}),(0,T.jsx)(`span`,{className:`maxy-checkbox__box`,children:`✱`}),n&&(0,T.jsx)(`span`,{className:`maxy-checkbox__label`,children:n})]})}var E=e(m(),1),ue={sm:14,md:16,lg:18},D={sm:30,md:38,lg:46};function O({variant:e=`primary`,size:t=`md`,icon:n,iconPosition:r=`leading`,loading:i=!1,fullWidth:a=!1,disabled:o=!1,type:s=`button`,onClick:c,"aria-label":l,"aria-pressed":u,style:d,className:f,children:p}){let m=[`btn`,`btn--${e}`,t===`md`?``:`btn--${t}`,a?`btn--full`:``,f].filter(Boolean).join(` `),h=ue[t],g={...e===`send`?{width:D[t],height:D[t]}:{},...d},_=Object.keys(g).length>0;return(0,T.jsxs)(`button`,{type:s,className:m,disabled:i||o,onClick:c,"aria-label":l,"aria-pressed":u,style:_?g:void 0,children:[(0,T.jsxs)(`span`,{className:`btn__content`,style:{visibility:i?`hidden`:`visible`},children:[n&&r===`leading`&&(0,T.jsx)(n,{size:h}),p,n&&r===`trailing`&&(0,T.jsx)(n,{size:h})]}),i&&(0,T.jsx)(`span`,{className:`btn__spinner`,children:`✱`})]})}var k=c(`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`}]]),de=c(`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`}]]),fe=c(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),A=c(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),pe=c(`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`}]]),me=c(`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`}]]),j=c(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),he=c(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]);function ge({connected:e,onConnectClaude:t}){return e?(0,T.jsxs)(`span`,{className:`claude-status-pill`,"data-connected":`true`,title:`Claude is connected`,children:[(0,T.jsx)(`img`,{src:`/brand/claude.png`,alt:``,className:`claude-status-pill__mark`}),(0,T.jsx)(`span`,{className:`claude-status-pill__label`,children:`Connected`}),(0,T.jsx)(`span`,{className:`claude-status-pill__dot claude-status-pill__dot--live`,"aria-hidden":`true`})]}):(0,T.jsxs)(`button`,{type:`button`,className:`claude-status-pill claude-status-pill--action`,"data-connected":`false`,onClick:t,title:`Connect Claude`,children:[(0,T.jsx)(`img`,{src:`/brand/claude.png`,alt:``,className:`claude-status-pill__mark`}),(0,T.jsx)(`span`,{className:`claude-status-pill__label`,children:`Connect`}),(0,T.jsx)(`span`,{className:`claude-status-pill__dot claude-status-pill__dot--down`,"aria-hidden":`true`})]})}function _e(e){return e===`/`||e===``?`Dashboard`:e.startsWith(`/chat`)?`Chat`:e.startsWith(`/tasks`)?`Tasks`:e.startsWith(`/data`)?`Data`:e.startsWith(`/calendar`)?`Calendar`:e.startsWith(`/graph`)?`Graph`:e.startsWith(`/activity`)?`Activity`:e.startsWith(`/browser`)?`Browser`:`Dashboard`}function ve({title:e,sidebarOpen:n,onToggleSidebar:r,claudeConnected:i,onConnectClaude:a}){let o=e??_e(typeof window<`u`?window.location.pathname:`/`),s=i!==void 0&&a!==void 0;return(0,T.jsxs)(`header`,{className:`admin-page-header`,children:[(0,T.jsxs)(`button`,{type:`button`,className:`admin-page-header__toggle`,"aria-label":n?`Hide sidebar`:`Show sidebar`,title:n?`Hide sidebar`:`Show sidebar`,"aria-expanded":n,onClick:r,children:[(0,T.jsx)(j,{className:`admin-page-header__toggle-desktop`,size:18,strokeWidth:1.75}),(0,T.jsx)(t,{className:`admin-page-header__toggle-mobile`,size:22,strokeWidth:1.75})]}),(0,T.jsx)(`h1`,{className:`admin-page-header__title`,children:o}),s&&(0,T.jsx)(`div`,{className:`admin-page-header__right`,children:(0,T.jsx)(ge,{connected:i,onConnectClaude:a})})]})}var ye=[{label:`Home`,href:`/`,Icon:p,match:e=>e===`/`||e===``},{label:`Chat`,href:`/chat`,Icon:f,match:e=>e.startsWith(`/chat`)},{label:`Tasks`,href:`/tasks`,Icon:pe,match:e=>e.startsWith(`/tasks`)},{label:`Data`,href:`/data`,Icon:x,match:e=>e.startsWith(`/data`)},{label:`Calendar`,href:`/calendar`,Icon:b,match:e=>e.startsWith(`/calendar`)}];function be(e){let t=ye.find(t=>t.match(e));return t?t.href:`/`}function xe(){let e=be(typeof window<`u`?window.location.pathname:`/`);return(0,T.jsx)(`nav`,{className:`bottom-tab-bar`,"aria-label":`Primary`,children:ye.map(t=>{let n=t.href===e,{Icon:r}=t;return(0,T.jsxs)(`a`,{href:t.href,className:`bottom-tab${n?` is-active`:``}`,"aria-current":n?`page`:void 0,children:[(0,T.jsx)(r,{size:19,strokeWidth:1.75}),(0,T.jsx)(`span`,{className:`bottom-tab__label`,children:t.label})]},t.href)})})}var M=`maxy-shell-side-px`;function Se(){if(typeof window>`u`)return 0;let e=document.querySelector(`.platform > .artefact`)?.getBoundingClientRect();return e&&e.width>0?Math.round(e.width):0}function Ce(e){if(typeof window>`u`)return e;let t=window.innerWidth,n=Math.max(248,t-480-Se());return Math.min(Math.max(e,248),n)}function we(){if(typeof window>`u`)return 264;try{let e=window.localStorage.getItem(M);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 Ce(t)}catch{}return 264}function Te({targetSelector:e=`.platform`}){let t=(0,E.useRef)(null),[n,r]=(0,E.useState)(()=>we()),i=(0,E.useRef)(n);(0,E.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,E.useCallback)(()=>{r(e=>{let t=Ce(e);return t===e?e:t})},[]);(0,E.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(Ce(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(M,String(t))}catch{}console.info(`[admin-ui] sidebar-resize px=${t}`)};window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s)},s=()=>{let e=Ce(264);r(e);try{window.localStorage.removeItem(M)}catch{}console.info(`[admin-ui] sidebar-resize px=${e}`)};return(0,T.jsx)(`div`,{ref:t,className:`side-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize sidebar`,onPointerDown:o,onDoubleClick:s})}var Ee=a();function De(e){return Math.max(14,e/2-386)}function Oe(e){return e.left===0&&e.top===0&&e.width===0&&e.height===0}var ke={position:`fixed`,visibility:`hidden`};function N({anchorRef:e,onClose:t,className:n,role:r,ariaLabel:i,anchorId:a,children:o}){let s=(0,E.useRef)(null),[c,l]=(0,E.useState)(ke),u=(0,E.useRef)(null),d=(0,E.useCallback)(()=>{let t=s.current;if(!t)return;let r=e.current,i=[n,a].filter(Boolean).join(`:`)||`unknown`,o=t.getBoundingClientRect(),c=window.innerWidth,d=window.innerHeight,f=o.width>0&&o.height>0,p=r?r.getBoundingClientRect():null,m=(e,t)=>console.error(`[anchored-popover] op=offscreen id=${i} left=${e} top=${t} w=${o.width} h=${o.height} viewport=${c},${d}`),h=e=>{e!==u.current&&(u.current=e,console.log(e))};if(h(`[anchored-popover] op=anchor id=${i} present=${!!r} rect=${p?`${p.left},${p.top},${p.width},${p.height}`:`none`}`),!p){let e=Math.max(4,c-o.width-De(c)),t=Math.max(4,d-o.height-14);l({position:`fixed`,left:e,top:t,visibility:`visible`}),h(`[anchored-popover] op=placed id=${i} left=${e} top=${t} w=${o.width} h=${o.height} flipped=false clampedLeft=false clampedRight=false`);return}if(f&&Oe(p)){l(ke),m(p.left,p.top);return}let g=p.right-o.width,_=c-o.width-4,ee=!1,te=!1;g>_&&(g=_,ee=!0),g<4&&(g=4,te=!0);let v=d-p.bottom-4,y=p.top-4,b=o.height+8<=v?!1:o.height+8<=y?!0:y>v,x=Math.max(0,b?y:v),S=b?Math.max(4,p.top-Math.min(o.height,x)):p.bottom;l({position:`fixed`,left:g,top:S,maxHeight:x,visibility:`visible`}),h(`[anchored-popover] op=placed id=${i} left=${g} top=${S} w=${o.width} h=${o.height} maxH=${x} flipped=${b} clampedLeft=${te} clampedRight=${ee}`);let ne=Math.min(o.height,x);f&&(g+o.width<=0||g>=c||S+ne<=0||S>=d)&&m(g,S)},[e,a,n]);return(0,E.useLayoutEffect)(()=>{if(d(),typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>d());return s.current&&e.observe(s.current),()=>e.disconnect()},[d]),(0,E.useEffect)(()=>{let n=e=>{e.key===`Escape`&&t()},r=n=>{let r=n.target;e.current?.contains(r)||s.current?.contains(r)||t()},i=n=>{let r=e.current;r&&n.target instanceof Node&&n.target.contains(r)&&t()},a=()=>t();return document.addEventListener(`keydown`,n),document.addEventListener(`pointerdown`,r),window.addEventListener(`scroll`,i,!0),window.addEventListener(`resize`,a),()=>{document.removeEventListener(`keydown`,n),document.removeEventListener(`pointerdown`,r),window.removeEventListener(`scroll`,i,!0),window.removeEventListener(`resize`,a)}},[e,t]),(0,Ee.createPortal)((0,T.jsx)(`div`,{ref:s,className:n,role:r,"aria-label":i,style:c,children:o}),document.body)}function Ae({actions:e,disabled:n}){let[r,i]=(0,E.useState)(!1),[a,o]=(0,E.useState)(null),s=(0,E.useRef)(null),c=(0,E.useCallback)(()=>{i(!1),o(null)},[]);return(0,T.jsxs)(`div`,{className:`conv-actions`,children:[(0,T.jsx)(`button`,{ref:s,type:`button`,className:`conv-action conv-actions-overflow`,onClick:()=>i(e=>!e),disabled:n,"aria-haspopup":`menu`,"aria-expanded":r,"aria-label":`Session actions`,title:`Session actions`,children:(0,T.jsx)(t,{size:12})}),r&&(0,T.jsx)(N,{anchorRef:s,onClose:c,className:`conv-actions-menu`,role:`menu`,children:e.map(e=>e.panel?(0,T.jsxs)(`div`,{className:`conv-actions-menu-disclosure`,children:[(0,T.jsxs)(`button`,{type:`button`,role:`menuitem`,"aria-haspopup":`dialog`,"aria-expanded":a===e.key,disabled:n,onClick:()=>o(t=>t===e.key?null:e.key),children:[e.icon,(0,T.jsx)(`span`,{children:e.menuLabel})]}),a===e.key&&(0,T.jsx)(`div`,{className:`conv-actions-menu-panel`,children:e.panel()})]},e.key):(0,T.jsxs)(`button`,{type:`button`,role:`menuitem`,className:e.danger?`conv-action-danger`:void 0,"aria-busy":e.busy,disabled:n,onClick:t=>{e.onClick?.(t),c()},children:[e.icon,(0,T.jsx)(`span`,{children:e.menuLabel})]},e.key))})]})}var P=`claude-opus-4-8[1m]`,F=`claude-sonnet-5`,je=`claude-haiku-4-5`,I={[P]:`Opus 4.8 (1M context)`,[F]:`Sonnet 5`,[je]:`Haiku 4.5`};function Me(e){return I[e]??e}var Ne=[P,F,je];function L(e){return e.replace(/\[1m\]$/,``)}function Pe(e){return Ne.find(t=>L(t)===L(e))??e}var R=[`default`,`acceptEdits`,`plan`,`auto`,`bypassPermissions`],z=[`low`,`medium`,`high`,`xhigh`];[...R],[...z],[...z];var Fe=[P,F,je],Ie={default:`Ask permissions`,acceptEdits:`Accept edits`,plan:`Plan mode`,auto:`Auto mode`,bypassPermissions:`Bypass permissions`},Le=R.map(e=>({value:e,label:Ie[e]??e})),Re={low:`Low`,medium:`Medium`,high:`High`,xhigh:`Highest`},ze=z.map(e=>({value:e,label:Re[e]??e}));function B(e){if(e){let t=Fe.find(t=>L(t)===L(e));if(t)return t}return P}function Be({row:e,adminFetch:t,onError:n}){let[r,i]=(0,E.useState)(()=>B(e.model)),[a,o]=(0,E.useState)(``),[s,c]=(0,E.useState)(``),[l,u]=(0,E.useState)(!1),d=(0,E.useRef)(!1);(0,E.useEffect)(()=>{i(B(e.model))},[e.model]);let f=async()=>{if(!d.current){d.current=!0,u(!0);try{let i=await t(`/api/admin/session-reseat`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({fromSessionId:e.sessionId,model:r,...a?{permissionMode:a}:{},...s?{effort:s}:{}})});if(!i.ok){n(`Could not reset ${e.title} (status ${i.status})`),console.error(`[admin-ui] dashboard-reseat-failed sessionId=${e.sessionId} status=${i.status}`),d.current=!1,u(!1);return}let o=await i.json().catch(()=>({}));o.target?window.location.assign(o.target):(n(`Reset of ${e.title} returned no target`),d.current=!1,u(!1))}catch(t){n(`Could not reset ${e.title} (network error)`),console.error(`[admin-ui] dashboard-reseat-failed sessionId=${e.sessionId} error=${t instanceof Error?t.message:String(t)}`),d.current=!1,u(!1)}}};return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`label`,{className:`reseat-field`,children:[(0,T.jsx)(`span`,{children:`Model`}),(0,T.jsx)(`select`,{"data-kind":`model`,value:r,disabled:l,onChange:e=>i(e.target.value),children:Fe.map(e=>(0,T.jsx)(`option`,{value:e,children:Me(e)},e))})]}),(0,T.jsxs)(`label`,{className:`reseat-field`,children:[(0,T.jsx)(`span`,{children:`Mode`}),(0,T.jsxs)(`select`,{"data-kind":`mode`,value:a,disabled:l,onChange:e=>o(e.target.value),children:[(0,T.jsx)(`option`,{value:``,children:`Keep current`}),Le.map(e=>(0,T.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]}),(0,T.jsxs)(`label`,{className:`reseat-field`,children:[(0,T.jsx)(`span`,{children:`Effort`}),(0,T.jsxs)(`select`,{"data-kind":`effort`,value:s,disabled:l,onChange:e=>c(e.target.value),children:[(0,T.jsx)(`option`,{value:``,children:`Keep current`}),ze.map(e=>(0,T.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]}),(0,T.jsx)(`button`,{type:`button`,className:`reseat-apply`,disabled:l,"aria-busy":l,onClick:()=>void f(),children:l?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(oe,{size:12,className:`spin`,"aria-hidden":`true`}),`Resetting…`]}):`Reset`})]})}function Ve(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)}function He({target:e,anchorEl:t,onConfirm:n,onCancel:r}){let i=(0,E.useRef)(null);return i.current=t,e?(0,T.jsxs)(N,{anchorRef:i,onClose:r,className:`conv-delete-confirm`,role:`alertdialog`,ariaLabel:`Confirm delete session`,children:[(0,T.jsxs)(`div`,{className:`claude-info-header`,children:[(0,T.jsx)(`span`,{children:`Delete this conversation?`}),(0,T.jsx)(`button`,{className:`claude-info-close`,onClick:r,"aria-label":`Close`,children:`✕`})]}),(0,T.jsxs)(`div`,{className:`claude-info-section`,style:{padding:`12px 14px`,fontSize:`11px`,color:`var(--text-secondary)`},children:[(0,T.jsxs)(`div`,{className:`conv-delete-target`,children:[(0,T.jsx)(`span`,{className:`conv-delete-label`,title:e.title,children:e.title||`Untitled session`}),(0,T.jsx)(`code`,{className:`conv-delete-id`,title:e.sessionId,children:e.sessionId.slice(0,8)})]}),(0,T.jsx)(`div`,{style:{marginTop:`8px`},children:`This permanently removes the transcript. It is not moved to Archive and cannot be recovered.`}),e.live&&(0,T.jsx)(`div`,{style:{marginTop:`8px`},children:`This session is running; deleting stops it first.`})]}),(0,T.jsxs)(`div`,{className:`claude-info-section`,style:{display:`flex`,gap:`8px`,padding:`10px 14px`},children:[(0,T.jsx)(O,{variant:`danger`,size:`sm`,style:{flex:1},onClick:n,children:`Delete`}),(0,T.jsx)(O,{variant:`secondary`,size:`sm`,style:{flex:1},onClick:r,children:`Cancel`})]})]}):null}function Ue({open:e,count:t,liveCount:n,onConfirm:r,onCancel:i}){if(!e)return null;let a=t===1?``:`s`;return(0,T.jsx)(`div`,{className:`claude-info-overlay`,onClick:i,children:(0,T.jsxs)(`div`,{className:`claude-info-modal`,onClick:e=>e.stopPropagation(),role:`alertdialog`,"aria-label":`Confirm delete sessions`,children:[(0,T.jsxs)(`div`,{className:`claude-info-header`,children:[(0,T.jsxs)(`span`,{children:[`Delete `,t,` conversation`,a,`?`]}),(0,T.jsx)(`button`,{className:`claude-info-close`,onClick:i,"aria-label":`Close`,children:`✕`})]}),(0,T.jsxs)(`div`,{className:`claude-info-section`,style:{padding:`12px 14px`,fontSize:`11px`,color:`var(--text-secondary)`},children:[`This permanently removes `,t,` transcript`,a,`. `,t===1?`It is`:`They are`,` not moved to Archive and cannot be recovered.`,n>0&&(0,T.jsxs)(`div`,{style:{marginTop:`8px`},children:[n,` `,n===1?`is`:`are`,` running and will be stopped first.`]})]}),(0,T.jsxs)(`div`,{className:`claude-info-section`,style:{display:`flex`,gap:`8px`,padding:`10px 14px`},children:[(0,T.jsxs)(O,{variant:`danger`,size:`sm`,style:{flex:1},onClick:r,children:[`Delete `,t]}),(0,T.jsx)(O,{variant:`secondary`,size:`sm`,style:{flex:1},onClick:i,children:`Cancel`})]})]})})}var We=`auth-refresh-failed`;function Ge({error:e,onClose:t}){if(!e)return null;let n=e.reason===We,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,T.jsx)(`div`,{className:`claude-info-overlay`,onClick:t,children:(0,T.jsxs)(`div`,{className:`claude-info-modal`,onClick:e=>e.stopPropagation(),role:`alertdialog`,"aria-label":`Session could not be opened`,children:[(0,T.jsxs)(`div`,{className:`claude-info-header`,children:[(0,T.jsx)(`span`,{children:r}),(0,T.jsx)(`button`,{className:`claude-info-close`,onClick:t,"aria-label":`Close`,children:`✕`})]}),(0,T.jsxs)(`div`,{className:`claude-info-section`,style:{padding:`12px 14px`,fontSize:`11px`,color:`var(--text-secondary)`},children:[i,(0,T.jsxs)(`div`,{className:`claude-info-row`,style:{marginTop:`8px`},children:[(0,T.jsx)(`span`,{className:`claude-info-label`,children:`Reason`}),(0,T.jsx)(`span`,{className:`claude-info-value`,children:e.reason})]}),e.sessionId&&(0,T.jsxs)(`div`,{className:`claude-info-row`,children:[(0,T.jsx)(`span`,{className:`claude-info-label`,children:`Session`}),(0,T.jsxs)(`span`,{className:`claude-info-value`,children:[e.sessionId.slice(0,8),`…`]})]})]})]})})}function Ke(e){let{show:t,onClose:n,claudeInfo:r,messages:i,sessionElapsed:a,sessionId:o,cacheKey:s}=e,[c,l]=(0,E.useState)(null);if(!t)return null;let u=i.flatMap(e=>e.events?.filter(e=>e.type===`usage`)??[]),d=u.at(-1),f=d?.peak_request_pct==null?d?.context_window?Math.round((d.input_tokens+d.cache_creation_tokens+d.cache_read_tokens)/d.context_window*100):0:Math.round(d.peak_request_pct*100),p=u.reduce((e,t)=>e+t.input_tokens+t.cache_creation_tokens+t.cache_read_tokens+t.output_tokens,0),m=i.flatMap(e=>e.events?.filter(e=>e.type===`rate_limit`)??[]).at(-1),h=u.reduce((e,t)=>e+(t.total_cost_usd??0),0),g=r?.account?.subscriptionType,_=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,T.jsx)(`div`,{className:`claude-info-overlay`,onClick:n,children:(0,T.jsxs)(`div`,{className:`claude-info-modal`,onClick:e=>e.stopPropagation(),children:[(0,T.jsxs)(`div`,{className:`claude-info-header`,children:[(0,T.jsx)(`img`,{src:`/brand/claude.png`,alt:`Claude`,className:`claude-info-icon`}),(0,T.jsx)(`span`,{children:`Claude Code`}),(0,T.jsx)(`button`,{className:`claude-info-close`,onClick:n,"aria-label":`Close`,children:`✕`})]}),(0,T.jsxs)(`div`,{className:`claude-info-section`,children:[(0,T.jsxs)(`div`,{className:`claude-info-row`,children:[(0,T.jsx)(`span`,{className:`claude-info-label`,children:`Version`}),(0,T.jsx)(`span`,{className:`claude-info-value`,children:r?r.version:`…`})]}),(0,T.jsxs)(`div`,{className:`claude-info-row`,children:[(0,T.jsx)(`span`,{className:`claude-info-label`,children:`Email`}),(0,T.jsx)(`span`,{className:`claude-info-value`,children:r?.account?.email??`…`})]})]}),(g||m||h>0)&&(0,T.jsxs)(`div`,{className:`claude-info-section`,children:[g&&(0,T.jsxs)(`div`,{className:`claude-info-row`,children:[(0,T.jsx)(`span`,{className:`claude-info-label`,children:`Plan`}),(0,T.jsx)(`span`,{className:`claude-info-value`,style:{textTransform:`capitalize`},children:g})]}),m&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`div`,{className:`claude-info-row`,children:[(0,T.jsx)(`span`,{className:`claude-info-label`,children:`Usage`}),(0,T.jsxs)(`span`,{className:`claude-info-value`,children:[Math.round(m.utilization*100),`%`]})]}),(0,T.jsxs)(`div`,{className:`claude-info-row`,children:[(0,T.jsx)(`span`,{className:`claude-info-label`,children:`Resets in`}),(0,T.jsx)(`span`,{className:`claude-info-value`,children:_(m.resetsAt)})]}),m.isUsingOverage&&(0,T.jsxs)(`div`,{className:`claude-info-row`,children:[(0,T.jsx)(`span`,{className:`claude-info-label`,children:`Overage`}),(0,T.jsx)(`span`,{className:`claude-info-value`,children:`Active`})]})]}),h>0&&(0,T.jsxs)(`div`,{className:`claude-info-row`,children:[(0,T.jsx)(`span`,{className:`claude-info-label`,children:`Session cost`}),(0,T.jsxs)(`span`,{className:`claude-info-value`,children:[`$`,h<.01?h.toFixed(4):h.toFixed(2)]})]})]}),(0,T.jsxs)(`div`,{className:`claude-info-section`,children:[(0,T.jsxs)(`div`,{className:`claude-info-row`,children:[(0,T.jsx)(`span`,{className:`claude-info-label`,children:`Model`}),(0,T.jsx)(`span`,{className:`claude-info-value`,children:r?.model??`…`})]}),(0,T.jsxs)(`div`,{className:`claude-info-row`,children:[(0,T.jsx)(`span`,{className:`claude-info-label`,children:`Context used`}),(0,T.jsx)(`span`,{className:`claude-info-value`,children:f>0?`${f}%`:`—`})]}),(0,T.jsxs)(`div`,{className:`claude-info-row`,children:[(0,T.jsx)(`span`,{className:`claude-info-label`,children:`Tokens`}),(0,T.jsx)(`span`,{className:`claude-info-value`,children:p>0?V(p):`—`})]}),(0,T.jsxs)(`div`,{className:`claude-info-row`,children:[(0,T.jsx)(`span`,{className:`claude-info-label`,children:`Session`}),(0,T.jsx)(`span`,{className:`claude-info-value`,children:Ve(a)})]}),(o||s)&&(()=>{let e=o??s??``;return(0,T.jsxs)(`div`,{className:`claude-info-row`,children:[(0,T.jsx)(`span`,{className:`claude-info-label`,children:`Session`}),(0,T.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 C(e)?`copied`:`failed`),setTimeout(()=>l(null),1200)},children:c===`copied`?`copied ✓`:c===`failed`?`copy failed ✕`:`${e.slice(0,8)}…`})]})})()]})]})})}function qe({open:e,onConnect:t,onClose:n}){return e?(0,T.jsx)(`div`,{className:`claude-info-overlay`,onClick:n,children:(0,T.jsxs)(`div`,{className:`claude-info-modal`,onClick:e=>e.stopPropagation(),role:`alertdialog`,"aria-label":`Claude is not connected`,children:[(0,T.jsxs)(`div`,{className:`claude-info-header`,children:[(0,T.jsx)(`span`,{children:`Claude isn’t connected`}),(0,T.jsx)(`button`,{className:`claude-info-close`,onClick:n,"aria-label":`Close`,children:`✕`})]}),(0,T.jsxs)(`div`,{className:`claude-info-section`,style:{padding:`12px 14px`,fontSize:`11px`,color:`var(--text-secondary)`,display:`flex`,flexDirection:`column`,gap:`10px`},children:[(0,T.jsx)(`span`,{children:`This needs Claude, which is currently disconnected. Connect to continue — the rest of the dashboard stays available either way.`}),(0,T.jsxs)(`div`,{style:{display:`flex`,gap:`8px`,alignItems:`center`},children:[(0,T.jsx)(O,{variant:`primary`,size:`sm`,onClick:t,children:`Connect Claude`}),(0,T.jsx)(`button`,{type:`button`,className:`claude-info-close`,style:{fontSize:`11px`},onClick:n,children:`Not now`})]})]})]})}):null}function Je(e){let t=Math.round(e/6e4),n=Math.floor(t/60),r=t%60;return`${n}h ${String(r).padStart(2,`0`)}m`}function H(e){return e.activeMs.thinking+e.activeMs.messaging+e.activeMs.toolUse}function U(e){return e.toLocaleString(`en-GB`)}function Ye(e){return`£${e.toFixed(2)}`}function W(e){let t=[`Day`,`Active`,`Output tokens`,`Input tokens`,`Cache write`,`Cache read`,`Opus 4.8 (GBP)`,`Sonnet 4.6 (GBP)`],n=(e,t)=>[e,Je(H(t)),String(t.tokens.output),String(t.tokens.input),String(t.tokens.cacheWrite),String(t.tokens.cacheRead),t.costGBP.opus.toFixed(2),t.costGBP.sonnet.toFixed(2)];return[t,...e.days.map(e=>n(e.date,e)),n(`TOTAL (${e.days.length} d)`,e.totals)].map(e=>e.join(`,`)).join(`
|
|
2
|
-
`)}function Xe({label:e,d:t,bold:n}){let r=n?`th`:`td`;return(0,T.jsxs)(`tr`,{className:n?`usage-total-row`:void 0,children:[(0,T.jsx)(r,{className:`usage-day`,children:e}),(0,T.jsx)(r,{children:Je(H(t))}),(0,T.jsx)(r,{children:U(t.tokens.output)}),(0,T.jsx)(r,{children:U(t.tokens.input)}),(0,T.jsx)(r,{children:U(t.tokens.cacheWrite)}),(0,T.jsx)(r,{children:U(t.tokens.cacheRead)}),(0,T.jsx)(r,{children:Ye(t.costGBP.opus)}),(0,T.jsx)(r,{children:Ye(t.costGBP.sonnet)})]})}function Ze({show:e,onClose:t,anchorEl:n,sessionId:r,summary:i,loading:a,error:o}){let s=(0,E.useRef)(null);if(s.current=n,!e)return null;let c=!!i&&i.days.length>0;return(0,T.jsxs)(N,{anchorRef:s,onClose:t,className:`usage-popover`,role:`dialog`,ariaLabel:`Session usage and cost`,anchorId:r??void 0,children:[(0,T.jsxs)(`div`,{className:`claude-info-header`,children:[(0,T.jsxs)(`span`,{children:[`Usage & cost`,r?` · ${r.slice(0,8)}`:``]}),c&&(0,T.jsx)(`button`,{className:`usage-download`,onClick:()=>{if(!i)return;let e=new Blob([W(i)],{type:`text/csv;charset=utf-8`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`usage-${r?r.slice(0,8):`session`}.csv`,document.body.appendChild(n),n.click(),n.remove(),URL.revokeObjectURL(t)},"aria-label":`Download as CSV`,title:`Download as CSV`,children:(0,T.jsx)(l,{size:14})}),(0,T.jsx)(`button`,{className:`claude-info-close`,onClick:t,"aria-label":`Close`,children:(0,T.jsx)(y,{size:14})})]}),(0,T.jsxs)(`div`,{className:`claude-info-section usage-body`,children:[a&&(0,T.jsx)(`div`,{className:`usage-note`,children:`Computing usage…`}),!a&&o&&(0,T.jsx)(`div`,{className:`usage-note usage-error`,children:o}),!a&&!o&&i&&i.days.length===0&&(0,T.jsx)(`div`,{className:`usage-note`,children:`No usage recorded for this session yet.`}),!a&&!o&&i&&i.days.length>0&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`div`,{className:`usage-table-scroll`,children:(0,T.jsxs)(`table`,{className:`usage-table`,children:[(0,T.jsx)(`thead`,{children:(0,T.jsxs)(`tr`,{children:[(0,T.jsx)(`th`,{className:`usage-day`,children:`Day`}),(0,T.jsx)(`th`,{children:`Active`}),(0,T.jsx)(`th`,{children:`Output tok`}),(0,T.jsx)(`th`,{children:`Input tok`}),(0,T.jsx)(`th`,{children:`Cache write`}),(0,T.jsx)(`th`,{children:`Cache read`}),(0,T.jsx)(`th`,{children:`Opus 4.8 (£)`}),(0,T.jsx)(`th`,{children:`Sonnet 4.6 (£)`})]})}),(0,T.jsxs)(`tbody`,{children:[i.days.map(e=>(0,T.jsx)(Xe,{label:e.date,d:e},e.date)),(0,T.jsx)(Xe,{label:`TOTAL (${i.days.length} d)`,d:i.totals,bold:!0})]})]})}),(0,T.jsxs)(`div`,{className:`usage-note usage-caveats`,children:[`Prices dated `,i.pricing.opusPriceDate,` · £/$ `,i.pricing.usdPerGbp,` · Sonnet tokenizer factor `,i.pricing.tokenizerFactor,`. Idle human-wait dominates the calendar span; cache-read tokens dominate cost; Sonnet is a tokenizer-adjusted estimate.`]})]})]})]})}var G=`https://claude.ai/code`,Qe=200,$e=[500,1e3,1500,2e3,2500,3e3,3e3];function et(e,t,n){if(e&&n.target)return{kind:`navigate`,url:n.target,sameOrigin:!0};let r=n.slug??n.bridgeSessionId??null;if(e&&r)return{kind:`navigate`,url:`${G}/${r}`,sameOrigin:!1};let i=n.reason||n.error||`status ${t}`;return{kind:`error`,sessionId:n.sessionId??null,reason:i}}function tt(e){if(!e)return``;let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`}):``}function nt(e){let{businessName:t,cacheKey:a,onConnectClaude:c,role:l,userName:d,userAvatar:m,onSelectProjects:ee,onSelectTasks:y,onCloseMobileDrawer:C,collapsed:re,onSelectData:oe,initialDataSurface:ce=!1,onLogout:ue,onDisconnect:D,disconnecting:O,claudeConnected:j=!0,subAccounts:ge,activeAccountId:_e,switchingAccount:ve,onSwitchAccount:ye,refreshAccounts:be,onOpenConversations:xe}=e,M=S(a),Se=(0,E.useCallback)(e=>({key:`reseat`,label:`Reset session ${e.title} (model, mode, effort)`,menuLabel:`Reset`,title:`Reset — move this session onto a chosen model, mode, and effort`,icon:(0,T.jsx)(he,{size:12}),panel:()=>(0,T.jsx)(Be,{row:e,adminFetch:M,onError:e=>F({message:e,failed:!0})})}),[M]),Ce=u.productName,we=t||Ce,Te=typeof d==`string`?d:d===null?`name unavailable`:we,Ee=(Te.trim().charAt(0)||`?`).toUpperCase(),[De,Oe]=(0,E.useState)(ce?`data`:`sessions`),[ke,N]=(0,E.useState)(!1),[P,F]=(0,E.useState)(null),[je,I]=(0,E.useState)(null),[Me,Ne]=(0,E.useState)(!1),[L,Pe]=(0,E.useState)([]),[R]=(0,E.useState)(()=>typeof window>`u`?null:new URLSearchParams(window.location.search).get(`session`)),[z,Fe]=(0,E.useState)(!1),[Ie,Le]=(0,E.useState)(null),[Re,ze]=(0,E.useState)(!1),[B,Ve]=(0,E.useState)(!1),[V,We]=(0,E.useState)(!1),[Ke,Je]=(0,E.useState)(null),[H,U]=(0,E.useState)(new Set),Ye=(0,E.useRef)(new Map),[W,Xe]=(0,E.useState)(!1),[G,nt]=(0,E.useState)(new Set),[rt,K]=(0,E.useState)(!1),[q,ot]=(0,E.useState)(null),[st,ct]=(0,E.useState)(new Set),[lt,ut]=(0,E.useState)(new Set),[J,dt]=(0,E.useState)(new Set),[Y,X]=(0,E.useState)(null),[ft,Z]=(0,E.useState)(``),[pt,mt]=(0,E.useState)(!1),[ht,gt]=(0,E.useState)(null),[_t,vt]=(0,E.useState)(null),[yt,bt]=(0,E.useState)(!1),[xt,St]=(0,E.useState)(null),[Ct,wt]=(0,E.useState)(!1),Tt=(0,E.useRef)(0);(0,E.useEffect)(()=>{if(!P)return;let e=setTimeout(()=>F(null),2500);return()=>clearTimeout(e)},[P]);let Et=R!=null&&L.some(e=>e.sessionId===R);(0,E.useEffect)(()=>{R==null||!z||console.info(`[sidebar-sessions] op=select-highlight session=${R.slice(0,8)} matched=${Et}`)},[R,Et,z]);let Q=(0,E.useCallback)(async()=>{if(!a)return null;let e=++Tt.current;ze(!0),Le(null);try{let t=await M(`/api/admin/sidebar-sessions`);if(!t.ok)throw Error(`status ${t.status}`);let n=await t.json(),r=n.sessions??[];return e===Tt.current?(Pe(r),Je(n.accountId??null),Fe(!0),r):(console.info(`[admin-ui] sidebar-sessions-stale-response-dropped token=${e}`),r)}catch(t){let n=t instanceof Error?t.message:String(t);return e===Tt.current&&Le(`Failed to load sessions: ${n}`),console.error(`[admin-ui] sidebar-sessions fetch failed: ${n}`),null}finally{e===Tt.current&&ze(!1)}},[a,M]);(0,E.useEffect)(()=>{!a||z||Q()},[a,z,Q]),(0,E.useEffect)(()=>{if(!a)return;let e=null;function t(){console.info(`[admin-ui] sidebar-refresh surface=sessions trigger=poll`),Q()}function n(){e===null&&(e=setInterval(t,it))}function r(){e!==null&&(clearInterval(e),e=null)}function i(){document.hidden?r():(t(),n())}return document.hidden||n(),document.addEventListener(`visibilitychange`,i),()=>{r(),document.removeEventListener(`visibilitychange`,i)}},[a,Q]);let Dt=()=>{console.info(`[admin-ui] sidebar-refresh surface=sessions trigger=manual`),Q()},Ot=()=>{Oe(`data`),console.info(`[admin-ui] sidebar-nav surface=data collapsed=${re}`),oe(),C()},$=typeof window<`u`&&window.location?.pathname||`/`,kt=De===`data`,At=e=>{C(),window.location.href=e},jt=[{key:`dashboard`,label:`Dashboard`,icon:(0,T.jsx)(p,{size:17,strokeWidth:1.75}),active:$===`/`&&!kt,onClick:()=>At(`/`)},{key:`chat`,label:`Chat`,icon:(0,T.jsx)(f,{size:17,strokeWidth:1.75}),active:$.startsWith(`/chat`),onClick:()=>At(`/chat`)},{key:`tasks`,label:`Tasks`,icon:(0,T.jsx)(pe,{size:17,strokeWidth:1.75}),active:$.startsWith(`/tasks`),onClick:()=>{y(),C()}},{key:`calendar`,label:`Calendar`,icon:(0,T.jsx)(b,{size:17,strokeWidth:1.75}),active:$.startsWith(`/calendar`),onClick:()=>At(`/calendar`)},{key:`data`,label:`Data`,icon:(0,T.jsx)(x,{size:17,strokeWidth:1.75}),active:kt,onClick:Ot},{key:`container`,label:o().term,icon:(0,T.jsx)(ae,{size:17,strokeWidth:1.75}),active:$.startsWith(`/graph`),onClick:()=>{ee(),C()}},{key:`activity`,label:`Activity`,icon:(0,T.jsx)(s,{size:17,strokeWidth:1.75}),active:$.startsWith(`/activity`),onClick:()=>At(`/activity`)},{key:`browser`,label:`Browser`,icon:(0,T.jsx)(r,{size:17,strokeWidth:1.75}),active:$.startsWith(`/browser`),onClick:()=>At(`/browser`)}],Mt=(0,E.useCallback)(async e=>{if(st.has(e.sessionId))return;ct(t=>{let n=new Set(t);return n.add(e.sessionId),n});let t=window.open(``,`_blank`);try{let n=await M(`/api/admin/session-rc-spawn`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sessionId:e.sessionId,name:e.title||e.sessionId,...e.accountId?{targetAccountId:e.accountId}:{}})}),r=await n.json().catch(()=>({})),i=et(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`?(C(),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}`),I(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}`),I({sessionId:e.sessionId,reason:r})}finally{ct(t=>{let n=new Set(t);return n.delete(e.sessionId),n})}},[M,C,st]),Nt=(0,E.useCallback)(async e=>{let t=e.slice(0,8);for(let n=1;n<=$e.length;n++){await new Promise(e=>setTimeout(e,$e[n-1]));let r=await Q();if(r&&r.some(t=>t.sessionId===e)){console.info(`[admin-ui] sidebar-new-session-converged sessionId=${t} via=retry attempts=${n}`);return}}console.error(`[admin-ui] sidebar-new-session-converge-timeout sessionId=${t}`)},[Q]),Pt=(0,E.useCallback)(async()=>{if(!Ct){wt(!0);try{let e=await M(`/api/admin/session-rc-spawn`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({})}),t=await e.json().catch(()=>({})),n=et(e.ok,e.status,t);console.info(`[admin-ui] sidebar-new-session-spawned status=${e.status} outcome=${n.kind} slug=${t.slug??t.bridgeSessionId??`none`}`),n.kind===`navigate`?n.sameOrigin?window.location.assign(n.url):(window.open(n.url,`_blank`),t.sessionId?Nt(t.sessionId):console.error(`[admin-ui] sidebar-new-session-converge-skipped reason=no-session-id`)):e.status===503||n.reason===`claude-auth-dead`?(console.info(`[admin-ui] op=llm-action-blocked action=spawn reason=claude-disconnected`),Ne(!0)):(console.error(`[admin-ui] sidebar-new-session-failed status=${e.status} reason=${n.reason}`),I(n))}catch(e){let t=e instanceof Error?e.message:String(e);console.error(`[admin-ui] sidebar-new-session-failed error=${t}`),I({sessionId:null,reason:t})}finally{wt(!1)}}},[M,Ct,Nt]),Ft=(0,E.useCallback)((e,t)=>{e.stopPropagation(),ot(t)},[]),It=(0,E.useCallback)(async(e,t)=>{e.stopPropagation(),gt(t),vt(null),St(null),bt(!0);try{let e=await M(`/api/admin/session-usage?sessionId=${encodeURIComponent(t.sessionId)}`),n=await e.json().catch(()=>({}));e.ok?vt(n):St(n.error??`status ${e.status}`)}catch(e){St(e instanceof Error?e.message:String(e))}finally{bt(!1)}},[M]),Lt=(0,E.useCallback)(async(e,t={})=>{let n=t.refresh??!0;if(H.has(e.sessionId))return!1;U(t=>{let n=new Set(t);return n.add(e.sessionId),n});try{let t=await M(`/api/admin/session-delete`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sessionId:e.sessionId})});if(!t.ok){let n=await t.json().catch(()=>({}));return console.error(`[admin-ui] sidebar-session-delete-failed sessionId=${e.sessionId} status=${t.status} error=${n.error??`unknown`}`),F({message:`Delete failed: ${n.error??`status ${t.status}`}`,failed:!0}),!1}let r=await t.json();return console.info(`[admin-ui] sidebar-session-delete sessionId=${e.sessionId} live=${e.live} confirmed=true pidKilled=${r.pidKilled??`?`} deleted=${r.deleted??`?`}`),Pe(t=>t.filter(t=>t.sessionId!==e.sessionId)),n&&Q(),!0}catch(t){let n=t instanceof Error?t.message:String(t);return console.error(`[admin-ui] sidebar-session-delete-failed sessionId=${e.sessionId} error=${n}`),F({message:`Delete failed: ${n}`,failed:!0}),!1}finally{U(t=>{let n=new Set(t);return n.delete(e.sessionId),n})}},[M,H,Q]),Rt=(0,E.useCallback)(e=>{nt(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),zt=(0,E.useCallback)(()=>{Xe(!1),nt(new Set)},[]),Bt=(0,E.useCallback)(async()=>{let e=[...G].map(e=>L.find(t=>t.sessionId===e)).filter(e=>!!e),t=e.filter(e=>e.live).length;console.info(`[admin-ui] sidebar-bulk-delete op=start count=${e.length} live=${t}`);let n=(await Promise.all(e.map(e=>Lt(e,{refresh:!1})))).filter(Boolean).length;console.info(`[admin-ui] sidebar-bulk-delete op=done requested=${e.length} ok=${n} failed=${e.length-n}`),Q(),zt()},[G,L,Lt,Q,zt]),Vt=(0,E.useCallback)(async(e,t)=>{if(e.stopPropagation(),!lt.has(t.sessionId)){ut(e=>{let n=new Set(e);return n.add(t.sessionId),n});try{let e=await M(`/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`}`),F({message:`Stop failed: ${n.error??`status ${e.status}`}`,failed:!0});return}console.info(`[admin-ui] sidebar-session-stop sessionId=${t.sessionId}`),Q()}catch(e){let n=e instanceof Error?e.message:String(e);console.error(`[admin-ui] sidebar-session-stop-failed sessionId=${t.sessionId} error=${n}`),F({message:`Stop failed: ${n}`,failed:!0})}finally{ut(e=>{let n=new Set(e);return n.delete(t.sessionId),n})}}},[M,lt,Q]),Ht=(0,E.useCallback)(async(e,t,n)=>{if(e.stopPropagation(),!J.has(t.sessionId)){dt(e=>{let n=new Set(e);return n.add(t.sessionId),n});try{let e=await M(`/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`}`),F({message:`${n===`archive`?`Archive`:`Unarchive`} failed: ${i}`,failed:!0});return}console.info(`[admin-ui] sidebar-session-archive sessionId=${t.sessionId} mode=${n}`),Q()}catch(e){let r=e instanceof Error?e.message:String(e);console.error(`[admin-ui] sidebar-session-archive-failed sessionId=${t.sessionId} mode=${n} error=${r}`),F({message:`${n===`archive`?`Archive`:`Unarchive`} failed: ${r}`,failed:!0})}finally{dt(e=>{let n=new Set(e);return n.delete(t.sessionId),n})}}},[M,J,Q]),Ut=(0,E.useCallback)(async e=>{let t=ft.trim();if(!t){F({message:`Title can’t be empty`,failed:!0});return}if(t.length>Qe){F({message:`Title too long (max ${Qe})`,failed:!0});return}mt(!0);try{let n=await M(`/api/admin/session-rename`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sessionId:e.sessionId,title:t})});if(!n.ok){let t=await n.json().catch(()=>({})),r=t.reason??t.error??`status ${n.status}`;console.error(`[admin-ui] sidebar-session-rename sessionId=${e.sessionId.slice(0,8)} outcome=rejected reason=${r}`),F({message:`Rename failed: ${r}`,failed:!0});return}console.info(`[admin-ui] sidebar-session-rename sessionId=${e.sessionId.slice(0,8)} outcome=ok`),X(null),Z(``),Q()}catch(t){let n=t instanceof Error?t.message:String(t);console.error(`[admin-ui] sidebar-session-rename sessionId=${e.sessionId.slice(0,8)} outcome=rejected reason=${n}`),F({message:`Rename failed: ${n}`,failed:!0})}finally{mt(!1)}},[M,ft,Q]);return(0,T.jsxs)(`aside`,{className:`side`,children:[(0,T.jsxs)(`div`,{className:`side-brand`,children:[(0,T.jsx)(`img`,{className:`side-brand-icon`,src:i,alt:``,"aria-hidden":`true`}),(0,T.jsxs)(`span`,{className:`side-brand-lockup`,children:[(0,T.jsx)(`span`,{className:`side-brand-business`,children:we}),(0,T.jsx)(`span`,{className:`side-brand-product`,children:u.productName})]})]}),(0,T.jsx)(`nav`,{className:`side-nav`,children:jt.map(e=>(0,T.jsxs)(`button`,{type:`button`,className:`admin-row nav-row${e.active?` active`:``}`,"aria-current":e.active?`page`:void 0,onClick:e.onClick,children:[e.icon,(0,T.jsx)(`span`,{className:`label`,children:e.label}),(0,T.jsx)(`span`,{className:`kbd`})]},e.key))}),(()=>{let e=L.filter(e=>B?!0:!e.isSubagent).filter(e=>V?!0:!e.archived),t=L.some(e=>e.isSubagent),r=L.some(e=>e.archived);return(0,T.jsx)(`div`,{className:`side-sessions`,children:(0,T.jsxs)(`div`,{className:`side-list`,children:[(0,T.jsxs)(`div`,{className:`group-head`,children:[(0,T.jsx)(`span`,{children:`Sessions`}),(0,T.jsxs)(`span`,{className:`group-head-meta`,children:[(0,T.jsx)(`button`,{type:`button`,className:`group-head-select${W?` active`:``}`,"aria-pressed":W,title:W?`Exit select mode`:`Select multiple sessions to delete`,onClick:()=>{Xe(e=>!e),nt(new Set),X(null),Z(``)},children:`Select`}),(0,T.jsx)(`button`,{type:`button`,className:`group-head-refresh`,title:`Refresh sessions`,"aria-label":`Refresh sessions`,onClick:Dt,disabled:Re,children:(0,T.jsx)(w,{size:12,className:Re?`spinning`:void 0})}),(0,T.jsx)(`span`,{children:Re?`…`:String(e.length)}),(0,T.jsxs)(`button`,{type:`button`,className:`admin-btn-cta side-sessions-new`,onClick:Pt,disabled:Ct,"aria-busy":Ct,children:[(0,T.jsx)(_,{size:13}),(0,T.jsx)(`span`,{children:Ct?`Spawning…`:`New session`})]})]})]}),W&&(0,T.jsxs)(`div`,{className:`session-select-bar`,children:[(0,T.jsxs)(`span`,{className:`session-select-count`,children:[G.size,` selected`]}),(0,T.jsxs)(`button`,{type:`button`,className:`session-select-delete`,disabled:G.size===0,onClick:()=>K(!0),children:[`Delete `,G.size]}),(0,T.jsx)(`button`,{type:`button`,className:`session-select-cancel`,onClick:zt,children:`Cancel`})]}),Ke&&(0,T.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,T.jsx)(`code`,{children:Ke})}),(t||r)&&(0,T.jsxs)(`div`,{className:`artefact-filter-chips`,children:[t&&(0,T.jsx)(`button`,{type:`button`,className:`artefact-filter-chip${B?` active`:``}`,"aria-pressed":B,onClick:()=>Ve(e=>!e),title:B?`Hide subagent sessions`:`Show subagent sessions`,children:`Subagents`}),r&&(0,T.jsx)(`button`,{type:`button`,className:`artefact-filter-chip${V?` active`:``}`,"aria-pressed":V,onClick:()=>We(e=>!e),title:V?`Hide archived sessions`:`Show archived sessions`,children:`Archived`})]}),Ie&&(0,T.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:Ie}),z&&!Ie&&e.length===0&&(0,T.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:`No sessions yet`}),e.map(e=>{let t=tt(e.startedAt),r=st.has(e.sessionId),i=H.has(e.sessionId),a=lt.has(e.sessionId),o=J.has(e.sessionId),s=r||i||a||o,c=()=>{window.location.assign(`/chat?session=${e.sessionId}`)},l=[{key:`open`,label:`Resume session ${e.title} in claude.ai/code`,menuLabel:`Resume in claude.ai/code`,title:`Resume in a fresh local Remote Control PTY`,icon:(0,T.jsx)(n,{size:12}),busy:r,onClick:()=>{Mt(e)}},{key:`message`,label:`Open session ${e.title} in admin webchat`,menuLabel:`Open in webchat`,title:`Open in admin webchat (/chat) — sending resumes this session`,icon:(0,T.jsx)(me,{size:12}),onClick:()=>{c()}},{key:`usage`,label:`Usage and cost for session ${e.title}`,menuLabel:`Usage & cost`,title:`Per-day active time, tokens, and estimated GBP cost`,icon:(0,T.jsx)(A,{size:12}),onClick:t=>{It(t,e)}},...e.live?[{key:`stop`,label:`Stop session ${e.title}`,menuLabel:`Stop`,title:`Stop session process (keeps the conversation, can resume later)`,icon:(0,T.jsx)(h,{size:12}),busy:a,onClick:t=>{Vt(t,e)}}]:[],e.archived?{key:`unarchive`,label:`Unarchive session ${e.title}`,menuLabel:`Unarchive`,title:`Unarchive (move back to the active list)`,icon:(0,T.jsx)(k,{size:12}),busy:o,onClick:t=>{Ht(t,e,`unarchive`)}}:{key:`archive`,label:`Archive session ${e.title}`,menuLabel:`Archive`,title:`Archive (hide from the list, keeps the conversation resumable)`,icon:(0,T.jsx)(de,{size:12}),busy:o,onClick:t=>{Ht(t,e,`archive`)}},{key:`rename`,label:`Rename session ${e.title}`,menuLabel:`Rename`,title:`Rename this session`,icon:(0,T.jsx)(se,{size:12}),busy:pt&&Y===e.sessionId,onClick:t=>{t.stopPropagation(),X(e.sessionId),Z(e.personName??e.title)}},{key:`delete`,label:`Delete session ${e.title}`,menuLabel:`Delete`,title:`Delete session (stops the process, removes the conversation)`,icon:(0,T.jsx)(v,{size:12}),danger:!0,busy:i,onClick:t=>{Ft(t,e)}},Se({sessionId:e.sessionId,model:e.model??null,title:e.personName??e.title})],u=e.channel===`whatsapp`?` conv-channel-whatsapp`:e.channel===`telegram`?` conv-channel-telegram`:``,d=e.channel===`whatsapp`||e.channel===`telegram`||e.channel===`webchat`,f=ne.includes(e.channel??``)&&e.senderId&&e.titleSource===`prefix`?g({operatorName:e.personName??null,whatsappName:e.whatsappName??null,senderId:e.senderId,title:e.title}):e.personName??e.title;return(0,T.jsxs)(`div`,{ref:t=>{let n=Ye.current;t?n.set(e.sessionId,t):n.delete(e.sessionId)},className:`conv conv-with-actions${u}${e.sessionId===R?` active`:``}`,children:[(0,T.jsxs)(`div`,{className:`conv-main-static conv-main-clickable`,role:`button`,tabIndex:0,"aria-label":`Open ${f} in webchat`,onClick:()=>{if(Y!==e.sessionId){if(W){Rt(e.sessionId);return}c()}},onKeyDown:t=>{Y!==e.sessionId&&(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),W?Rt(e.sessionId):c())},children:[W&&(0,T.jsx)(`span`,{className:`conv-select-check`,onClick:e=>e.stopPropagation(),children:(0,T.jsx)(le,{checked:G.has(e.sessionId),ariaLabel:`Select ${f}`,onChange:()=>Rt(e.sessionId)})}),(0,T.jsx)(`span`,{className:`conv-live-dot`,"data-live":e.live?`1`:`0`,"aria-label":e.live?`live session`:`ended session`}),(0,T.jsxs)(`span`,{className:`conv-stack`,children:[(0,T.jsxs)(`span`,{className:`conv-name-line`,children:[d&&(0,T.jsx)(ie,{channel:e.channel,size:13}),Y===e.sessionId?(0,T.jsx)(`input`,{className:`conv-name conv-name-edit`,autoFocus:!0,onFocus:e=>e.currentTarget.select(),value:ft,disabled:pt,"aria-label":`New title for session ${e.title}`,onChange:e=>Z(e.target.value),onClick:e=>e.stopPropagation(),onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),Ut(e)):t.key===`Escape`&&(t.preventDefault(),X(null),Z(``))},onBlur:()=>{Y===e.sessionId&&!pt&&(X(null),Z(``))}}):(0,T.jsx)(`span`,{className:`conv-name`,title:f,children:f})]}),(0,T.jsxs)(`span`,{className:`conv-timestamp`,children:[(0,T.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,T.jsxs)(`span`,{children:[` · `,t]})]})]})]}),!W&&(0,T.jsx)(Ae,{actions:l,disabled:s})]},e.sessionId)})]})})})(),(0,T.jsxs)(`div`,{className:`side-foot`,children:[(0,T.jsx)(`div`,{className:`avatar`,children:m?(0,T.jsx)(`img`,{src:m,alt:Te}):Ee}),(0,T.jsxs)(`div`,{className:`who`,children:[(0,T.jsx)(`span`,{className:`name`,children:Te}),(0,T.jsx)(at,{})]}),(0,T.jsx)(`button`,{type:`button`,className:`side-foot-kebab`,"aria-label":`Account menu`,"aria-haspopup":`menu`,"aria-expanded":ke,onClick:()=>N(e=>!e),children:(0,T.jsx)(fe,{size:16})}),ke&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`div`,{className:`side-foot-menu-scrim`,"aria-hidden":`true`,onClick:()=>N(!1)}),(0,T.jsx)(`div`,{className:`side-foot-menu`,role:`menu`,children:(0,T.jsx)(te,{variant:`admin`,onCloseMenu:()=>N(!1),onLogout:ue??(()=>{}),onDisconnect:D,disconnecting:O,claudeConnected:j,onConnectClaude:c,cacheKey:a,subAccounts:ge,activeAccountId:_e,switchingAccount:ve,onSwitchAccount:ye,refreshAccounts:be,onOpenConversations:xe})})]})]}),P&&(0,T.jsx)(`div`,{className:`copy-toast${P.failed?` copy-toast-failed`:``}`,role:`status`,children:P.message}),(0,T.jsx)(Ge,{error:je,onClose:()=>I(null)}),(0,T.jsx)(qe,{open:Me,onConnect:()=>{Ne(!1),c?.()},onClose:()=>Ne(!1)}),(0,T.jsx)(He,{target:q,anchorEl:q?Ye.current.get(q.sessionId)??null:null,onCancel:()=>ot(null),onConfirm:()=>{let e=q;ot(null),e&&Lt(e)}},q?.sessionId??`none`),(0,T.jsx)(Ue,{open:rt,count:G.size,liveCount:L.filter(e=>G.has(e.sessionId)&&e.live).length,onConfirm:()=>{K(!1),Bt()},onCancel:()=>K(!1)}),(0,T.jsx)(Ze,{show:ht!==null,onClose:()=>{gt(null),vt(null),St(null)},anchorEl:ht?Ye.current.get(ht.sessionId)??null:null,sessionId:ht?.sessionId??null,summary:_t,loading:yt,error:xt},ht?.sessionId??`none`)]})}var rt=5e3,it=3e4;function at(){let[e,t]=(0,E.useState)(null);if((0,E.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()},rt))}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=[`system-stats`];return c&&d.push(`system-stats--warn`),l&&d.push(`system-stats--crit`),(0,T.jsxs)(`span`,{className:d.join(` `),role:`status`,"aria-label":`host CPU and RAM`,children:[(0,T.jsxs)(`span`,{className:i?`system-stats__fig system-stats__fig--warn`:`system-stats__fig`,children:[`CPU `,u(n)]}),` · `,(0,T.jsxs)(`span`,{className:o?`system-stats__fig system-stats__fig--warn`:`system-stats__fig`,children:[`RAM `,u(r)]})]})}var K=`admin-sidebar-collapsed`,q=`admin-sidebar-drawer-open`,ot=1080;function st(){if(typeof window>`u`)return!1;let e=null;try{e=window.sessionStorage.getItem(K)}catch{e=null}return e===null?typeof window.matchMedia==`function`?window.matchMedia(`(min-width: 721px) and (max-width: ${ot}px)`).matches:!1:e===`1`}function ct(e){if(!(typeof window>`u`))try{e?window.sessionStorage.setItem(K,`1`):window.sessionStorage.removeItem(K)}catch{}}function lt(){if(typeof window>`u`)return!1;try{return window.sessionStorage.getItem(q)===`1`}catch{return!1}}function ut(e){if(!(typeof window>`u`))try{e?window.sessionStorage.setItem(q,`1`):window.sessionStorage.removeItem(q)}catch{}}function J(e){let[t,n]=(0,E.useState)(()=>typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(e).matches);return(0,E.useEffect)(()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let t=window.matchMedia(e),r=()=>n(t.matches);return r(),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}var dt=720;function Y(e,t){return e===`/`?{via:`in-place`}:{via:`navigate`,href:`/?wa=${encodeURIComponent(t.remoteJid??``)}&acct=${encodeURIComponent(t.accountId??``)}`}}function X(e){return e===`/`?{via:`in-place`}:{via:`navigate`,href:`/?data=1`}}function ft(e,t){if(e!==`/`)return null;let n=new URLSearchParams(t),r=n.get(`wa`),i=n.get(`acct`);return!r||!i?null:{sessionId:``,projectDir:``,title:``,senderId:null,startedAt:``,channel:`whatsapp`,role:`public`,operatorName:null,whatsappName:null,lastMessageAt:null,modelGated:!1,model:null,source:`store`,accountId:i,remoteJid:r}}function Z(e,t){return e===`/`?new URLSearchParams(t).has(`data`):!1}function pt(e,t){return t===`operator`&&e===`chat`||e===`dashboard`?`/`:e===`data`?`/data`:e===`graph`?`/graph`:e===`calendar`?`/calendar`:e===`chat`?`/chat`:e===`activity`?`/activity`:`/browser`}function mt(e){let{cacheKey:t,businessName:n,variant:r=`admin`,onLogout:i,onDisconnect:a,disconnecting:s,claudeConnected:c,onConnectClaude:l,userName:u,userAvatar:d,role:f,onOpenConversations:p,children:m,footer:h}=e,{subAccounts:g,activeAccountId:_,switching:te,switchAccount:v,refreshAccounts:y}=re(t),[b,x]=(0,E.useState)(!0);(0,E.useEffect)(()=>{if(c!==void 0||r!==`admin`)return;let e=!1,t=async()=>{try{let t=await fetch(`/api/health`);if(!t.ok)return;let n=await t.json();e||x(n.auth_status!==`dead`&&n.auth_status!==`missing`)}catch{}};t();let n=setInterval(t,6e4);return()=>{e=!0,clearInterval(n)}},[c,r]);let S=c??b,ne=l??(()=>{window.location.assign(`/?connect=claude`)}),[C,ie]=(0,E.useState)(()=>st()),[ae,oe]=(0,E.useState)(!1),se=(0,E.useRef)(!0);(0,E.useEffect)(()=>{if(se.current){se.current=!1;return}oe(!0);let e=setTimeout(()=>oe(!1),260);return()=>clearTimeout(e)},[C]);let[w,ce]=(0,E.useState)(()=>lt()),le=J(`(max-width: ${dt}px)`),[ue,D]=(0,E.useState)(()=>typeof window>`u`||Z(window.location.pathname,window.location.search)?null:ft(window.location.pathname,window.location.search)),[O,k]=(0,E.useState)(()=>typeof window>`u`?!1:Z(window.location.pathname,window.location.search)),[de]=(0,E.useState)(()=>O),fe=(0,E.useCallback)(e=>{ct(e),ie(e)},[]),A=(0,E.useCallback)(e=>{ut(e),ce(e)},[]);(0,E.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=${C} drawer=${w}`)},[]),(0,E.useEffect)(()=>{typeof window>`u`||!ue||(console.info(`[admin-ui] wa-hydrate route=/ remoteJid=${ue.remoteJid??``}`),window.history.replaceState(null,``,`/`))},[]),(0,E.useEffect)(()=>{typeof window>`u`||!O||(console.info(`[admin-ui] data-hydrate route=/`),window.history.replaceState(null,``,`/`))},[]);let pe=(0,E.useCallback)(e=>{if(k(!1),e===null){D(null);return}let t=typeof window<`u`?window.location.pathname:`/`,n=Y(t,e);console.info(`[admin-ui] wa-open route=${t} via=${n.via} sessionId=${e.sessionId.slice(0,8)}`),n.via===`in-place`?D(e):window.location.href=n.href},[]),me=(0,E.useCallback)(()=>{let e=typeof window<`u`?window.location.pathname:`/`,t=X(e);if(console.info(`[admin-ui] data-open route=${e} via=${t.via}`),t.via===`navigate`){window.location.href=t.href;return}D(null),k(!0)},[]),j=le?w:!C,he=(0,E.useCallback)(()=>{if(!(typeof window>`u`))if(window.matchMedia(`(max-width: ${dt}px)`).matches){let e=w;console.info(`[admin-ui] header-sidebar-toggle from=${e?`open`:`closed`} mode=drawer`),A(!e)}else{let e=C;console.info(`[admin-ui] header-sidebar-toggle from=${e?`closed`:`open`} mode=collapse`),fe(!e)}},[C,w,fe,A]),ge=(0,E.useCallback)(e=>{let t=pt(e,r);console.info(`[admin-ui] header-menu-nav target=${e} dest=${t}`),window.location.href=t},[r]),_e={collapsed:C,mobileDrawerOpen:w,sidebarOpen:j,onToggleSidebar:he,setMobileDrawerOpen:A,selectedWhatsapp:ue,onClearWhatsapp:()=>D(null),onSelectWhatsappConversation:pe,dataOpen:O};return r===`operator`?(0,T.jsxs)(`div`,{className:`admin-shell admin-page admin-shell-root`,children:[(0,T.jsx)(ee,{businessName:n,variant:r,onNavigate:ge,onOpenConversations:p,onToggleSidebar:he,sidebarOpen:j,onLogout:i,onDisconnect:a,disconnecting:s,cacheKey:t,subAccounts:g,activeAccountId:_,switchingAccount:te,onSwitchAccount:v,refreshAccounts:y}),(0,T.jsx)(`div`,{className:`platform platform-operator`,children:typeof m==`function`?m(_e):m}),h]}):(0,T.jsxs)(`div`,{className:`admin-shell admin-page admin-shell-root`,children:[(0,T.jsxs)(`div`,{className:`platform${w?` menu-open`:``}${!le&&C?` sidebar-collapsed`:``}${ae?` sidebar-animating`:``}`,"data-artefact":`closed`,children:[(0,T.jsx)(nt,{businessName:n,cacheKey:t,onConnectClaude:ne,role:f??null,userName:u,userAvatar:d??null,onSelectProjects:()=>{window.location.href=`/graph?label=${o().label}`},onSelectTasks:()=>{window.location.href=`/tasks`},onCloseMobileDrawer:()=>A(!1),collapsed:C,mobileDrawerOpen:w,onSelectData:me,onCloseData:()=>k(!1),initialDataSurface:de,onLogout:i,onDisconnect:a,disconnecting:s,claudeConnected:S,subAccounts:g,activeAccountId:_,switchingAccount:te,onSwitchAccount:v,refreshAccounts:y,onOpenConversations:p}),!le&&(0,T.jsx)(Te,{}),(0,T.jsx)(ve,{sidebarOpen:j,onToggleSidebar:he,claudeConnected:S,onConnectClaude:ne}),typeof m==`function`?m(_e):m]}),w&&(0,T.jsx)(`div`,{className:`sidebar-backdrop menu-open`,"aria-hidden":`true`,onClick:()=>A(!1)}),(0,T.jsx)(xe,{}),h]})}export{O as _,Ke as a,F as c,he as d,pe as f,k as g,de as h,qe as i,Pe as l,fe as m,J as n,je as o,A as p,et as r,P as s,mt as t,Me as u,le as v,ce as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{R as e,V as t}from"./useSubAccountSwitcher-Q941cZYV.js";import"./useVoiceRecorder-ZFwt5i6d.js";import"./AdminShell-BwNqwb4k.js";import{n}from"./page-DBHzC59_.js";import"./useCopyFeedback-os7N0yCx.js";var r=t(),i=e();(0,r.createRoot)(document.getElementById(`root`)).render((0,i.jsx)(n,{}));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{N as e}from"./useSubAccountSwitcher-Q941cZYV.js";var t=e(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{N as e}from"./useSubAccountSwitcher-Q941cZYV.js";var t=e(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{N as e}from"./useSubAccountSwitcher-Q941cZYV.js";var t=e(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]);export{t};
|