chordia-ui 3.7.6 → 3.7.7
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/README.md +25 -0
- package/dist/components/chat.cjs.js +5 -5
- package/dist/components/chat.cjs.js.map +1 -1
- package/dist/components/chat.es.js +624 -415
- package/dist/components/chat.es.js.map +1 -1
- package/dist/components/layout.cjs.js +1 -1
- package/dist/components/layout.cjs.js.map +1 -1
- package/dist/components/layout.es.js +1 -1
- package/dist/components/layout.es.js.map +1 -1
- package/package.json +1 -1
- package/src/components/chat/ChatHistoryPanel.jsx +325 -58
- package/src/components/layout/SplitPane.jsx +1 -1
package/README.md
CHANGED
|
@@ -169,6 +169,31 @@ If your verify API returns:
|
|
|
169
169
|
|
|
170
170
|
set `error` to that message in host state to show it in the UI.
|
|
171
171
|
|
|
172
|
+
## ChatHistoryPanel Integration
|
|
173
|
+
|
|
174
|
+
`ChatHistoryPanel` shows a searchable list of chat threads and exposes optional **inline rename** and **inline delete** behaviors on each thread row. Both behaviors are opt-in — they appear only when the corresponding callback prop is provided.
|
|
175
|
+
|
|
176
|
+
### Props
|
|
177
|
+
|
|
178
|
+
```jsx
|
|
179
|
+
<ChatHistoryPanel
|
|
180
|
+
threads={threads} // [{ id, title, created_at, updated_at, message_count, last_message_preview, pinned, ... }]
|
|
181
|
+
activeThreadId={activeThreadId}
|
|
182
|
+
onSelectThread={(id) => setActive(id)}
|
|
183
|
+
onNewChat={() => createThread()}
|
|
184
|
+
onRenameThread={(id, newTitle) => renameThread(id, newTitle)} // optional — enables inline rename (Pencil icon)
|
|
185
|
+
onDeleteThread={(id) => deleteThread(id)} // optional — enables inline delete (Trash2 icon)
|
|
186
|
+
loading={loading}
|
|
187
|
+
/>
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Inline edit / delete behavior
|
|
191
|
+
|
|
192
|
+
- **Hover a thread row** → `Pencil` and `Trash2` icons (from `lucide-react`) appear, absolutely positioned to the right of the title with a row-colored backdrop so they overlay the title text instead of pushing it. Clicking either icon does **not** select the thread (event propagation is stopped).
|
|
193
|
+
- **Inline rename** (`Pencil`) — replaces the title with an auto-focused input. A `Save` / `Cancel` text row appears below the input. `Enter` saves, `Esc` cancels. Empty/whitespace-only titles are rejected. On save, `onRenameThread(id, trimmedTitle)` is invoked.
|
|
194
|
+
- **Inline delete** (`Trash2`) — shows a compact confirmation row below the title: `Confirm: delete this thread?` + a neutral `Delete` button + a plain `Cancel` link. No modal, no `window.confirm`. On confirm, `onDeleteThread(id)` is invoked.
|
|
195
|
+
- **Backwards compatible** — if `onRenameThread` / `onDeleteThread` are omitted, no hover icons are rendered and the panel behaves identically to before.
|
|
196
|
+
|
|
172
197
|
## Component Categories
|
|
173
198
|
|
|
174
199
|
| Category | Components |
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("react"),v=require("lucide-react"),X=require("../ChatMessage.cjs.js");require("recharts");function Q({phase:y="thinking",toolSteps:I=[],label:C,elapsedMs:M,compact:s=!1}){const R=d=>{if(!d||d<1e3)return null;const l=Math.floor(d/1e3);if(l<60)return`${l}s`;const c=Math.floor(l/60),p=l%60;return p>0?`${c}m ${p}s`:`${c}m`},W=()=>{if(C)return C;switch(y){case"thinking":return"Thinking...";case"tool":return null;case"responding":return"Responding...";default:return"Thinking..."}},h=(d,l)=>{const c=()=>{const b={width:s?"4px":"6px",height:s?"4px":"6px",borderRadius:"50%",display:"inline-block",marginRight:s?"6px":"8px"};switch(d.status){case"active":return e.jsx("span",{style:{...b,backgroundColor:"var(--rail-purple, #9B7AA8)",animation:"pulse 1.2s ease-in-out infinite"}});case"done":return e.jsx("span",{style:{...b,backgroundColor:"var(--text-xfaint, rgba(30,33,37,0.28))"}});case"error":return e.jsx("span",{style:{...b,backgroundColor:"var(--rail-compliance, #C98A5A)"}});default:return e.jsx("span",{style:{...b,backgroundColor:"var(--text-xfaint, rgba(30,33,37,0.28))"}})}},p=()=>{switch(d.status){case"done":return e.jsx("span",{style:{color:"var(--text-faint, rgba(30,33,37,0.36))",fontSize:s?"9px":"var(--text-xs-plus, 10.5px)"},children:"✓"});case"error":return e.jsx("span",{style:{color:"var(--rail-compliance, #C98A5A)",fontSize:s?"9px":"var(--text-xs-plus, 10.5px)"},children:"failed"});default:return null}};return e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:s?"2px":"4px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[c(),e.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:s?"9px":"var(--text-xs-plus, 10.5px)",color:"var(--text-muted)"},children:d.name})]}),p()]},l)},T=()=>e.jsx("div",{style:{width:"100%",height:s?"2px":"3px",backgroundColor:"var(--border-subtle, rgba(52,58,64,0.08))",borderRadius:s?"2px":"3px",overflow:"hidden",position:"relative"},children:e.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,background:"linear-gradient(90deg, transparent 0%, rgba(155,122,168,0.3) 50%, transparent 100%)",animation:"shimmer 2s linear infinite"}})}),g=()=>e.jsx("span",{style:{width:s?"4px":"6px",height:s?"10px":"14px",backgroundColor:"var(--rail-purple, #9B7AA8)",borderRadius:"1px",display:"inline-block",marginLeft:"2px",animation:"cursorBlink 0.8s ease-in-out infinite"}}),z=W(),f=R(M);return e.jsxs("div",{style:{borderLeft:`${s?"3px":"4px"} solid var(--rail-purple, #9B7AA8)`,backgroundColor:"var(--card-assistant, rgba(155,122,168,0.06))",border:"1px solid var(--border-subtle, rgba(52,58,64,0.08))",borderRadius:s?"8px":"10px",padding:s?"8px 10px 8px 12px":"10px 14px 10px 18px"},children:[e.jsx("style",{children:`
|
|
2
2
|
@keyframes shimmer {
|
|
3
3
|
0% { transform: translateX(-100%); }
|
|
4
4
|
100% { transform: translateX(200%); }
|
|
@@ -13,16 +13,16 @@
|
|
|
13
13
|
0%, 100% { opacity: 0; }
|
|
14
14
|
50% { opacity: 1; }
|
|
15
15
|
}
|
|
16
|
-
`}),!
|
|
17
|
-
`);
|
|
16
|
+
`}),!s&&e.jsx("div",{style:{fontSize:"var(--text-xs-plus, 10.5px)",fontWeight:650,textTransform:"uppercase",letterSpacing:"var(--tracking-label, 0.16em)",color:"var(--text-faint, rgba(30,33,37,0.36))",marginBottom:"8px"},children:"AI ASSISTANT"}),y==="thinking"&&e.jsxs("div",{children:[e.jsxs("div",{style:{color:"var(--text-muted)",fontWeight:400,fontSize:s?"11px":"13px",marginBottom:s?"4px":"8px",display:"flex",alignItems:"center",gap:"6px"},children:[z,f&&e.jsx("span",{style:{fontSize:s?"9px":"10px",color:"var(--text-faint, rgba(30,33,37,0.36))",fontFamily:"var(--font-mono, monospace)"},children:f})]}),T()]}),y==="tool"&&e.jsxs("div",{children:[z&&e.jsxs("div",{style:{color:"var(--text-muted)",fontWeight:400,fontSize:s?"11px":"13px",marginBottom:s?"4px":"8px",display:"flex",alignItems:"center",gap:"6px"},children:[z,f&&e.jsx("span",{style:{fontSize:s?"9px":"10px",color:"var(--text-faint, rgba(30,33,37,0.36))",fontFamily:"var(--font-mono, monospace)"},children:f})]}),e.jsx("div",{style:{marginBottom:s?"4px":"8px"},children:I.map((d,l)=>h(d,l))}),T()]}),y==="responding"&&e.jsxs("div",{style:{color:"var(--text-muted)",fontWeight:400,fontSize:s?"11px":"13px",display:"flex",alignItems:"center",gap:"6px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[z,g()]}),f&&e.jsx("span",{style:{fontSize:s?"9px":"10px",color:"var(--text-faint, rgba(30,33,37,0.36))",fontFamily:"var(--font-mono, monospace)"},children:f})]})]})}const G={error:(...y)=>console.warn("toast.error:",...y)};function Z({initialMessages:y=[],onSendMessage:I,onStreamMessage:C,onMessagesChange:M,onCodeBlockClick:s,placeholder:R="Ask a question about this interaction...",title:W="Chat with Chordia"}){const[h,T]=o.useState(y||[]),[g,z]=o.useState(""),[f,d]=o.useState(!1),[l,c]=o.useState(!1),[p,b]=o.useState(null),[D,P]=o.useState("thinking"),[A,r]=o.useState(null),[m,j]=o.useState(0),x=o.useRef(null),F=o.useRef(null),H=o.useRef(null),U=o.useRef(null),B=o.useRef(null),[t,a]=o.useState(!1),[_,k]=o.useState(0);o.useEffect(()=>{var i;(i=x.current)==null||i.scrollIntoView({behavior:"smooth"})},[h,f]),o.useEffect(()=>{F.current&&(F.current.style.height="auto",F.current.style.height=`${Math.min(F.current.scrollHeight,120)}px`)},[g]),o.useEffect(()=>{if(M){const i=[...h];p&&i.push(p),M(i)}},[h,p,M]),o.useEffect(()=>{let i;return f&&A&&(i=setInterval(()=>{if(j(Date.now()-A),B.current){const S=(Date.now()-B.current)/1e3;S>=3?(a(!0),k(Math.floor(S))):a(!1)}},500)),()=>i&&clearInterval(i)},[f,A]);const E=()=>{d(!1),c(!1),b(null),U.current=null,P("thinking"),a(!1),k(0),B.current=null,r(null),j(0),H.current&&(H.current.abort(),H.current=null)},N=i=>{if(i.startsWith("data: ")){const S=i.slice(6);if(S==="[DONE]")return{type:"done"};try{return{type:"data",data:JSON.parse(S)}}catch{return null}}return null},Y=i=>{var L,u;if(!((u=(L=i.choices)==null?void 0:L[0])!=null&&u.delta))return;B.current=Date.now(),a(!1);const S=i.choices[0].delta;if(S.tool_calls||S.tool_results){P("tool");return}S.content!==void 0&&(P("responding"),b(w=>{const O=w||{id:Date.now().toString(),role:"assistant",content:"",timestamp:new Date().toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}),isStreaming:!0},$={...O,content:(O.content||"")+(S.content||"")};return U.current=$,$}))},q=async i=>{const S=i.getReader(),L=new TextDecoder;let u="";try{for(;;){const{done:w,value:O}=await S.read();if(w)break;u+=L.decode(O,{stream:!0});const $=u.split(`
|
|
17
|
+
`);u=$.pop()||"";for(const J of $)if(J.trim()){const V=N(J);if(V){if(V.type==="done")return;V.type==="data"&&Y(V.data)}}}}finally{S.releaseLock()}},n=async()=>{if(!g.trim()||l)return;const i=g.trim(),S={id:Date.now().toString(),role:"user",content:i,timestamp:new Date().toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})},L=[...h,S];T(L),z(""),d(!0),c(!0),P("thinking"),r(Date.now()),B.current=Date.now(),H.current=new AbortController;try{let u;if(C)u=await C(i,L);else if(I)u=await I(i,L);else{setTimeout(()=>{const w={id:(Date.now()+1).toString(),role:"assistant",content:"This is a demonstration response. In a real implementation, this would connect to your LLM backend.",timestamp:new Date().toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})};T(O=>[...O,w]),E()},1e3);return}if(u instanceof ReadableStream)await q(u);else if(u instanceof Response&&u.body)await q(u.body);else if(u&&typeof u.then=="function"){const w=await u;w instanceof ReadableStream?await q(w):w instanceof Response&&w.body&&await q(w.body)}U.current&&T(w=>[...w,{...U.current,isStreaming:!1}])}catch(u){u.name!=="AbortError"&&(G.error("Failed to send message"),console.error("Stream error:",u))}finally{E()}},K=i=>{i.key==="Enter"&&!i.shiftKey&&(i.preventDefault(),n())};return e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",border:"1px solid var(--border, rgba(52,58,64,0.12))",borderRadius:"var(--radius-lg, 12px)",background:"var(--paper-elevated, rgba(255,255,255,0.82))",overflow:"hidden"},children:[W?e.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--border-subtle, rgba(52,58,64,0.08))",background:"var(--paper-elevated, rgba(255,255,255,0.82))"},children:[e.jsx("div",{style:{fontSize:"var(--text-lg, 16px)",fontWeight:720,letterSpacing:"-0.01em",color:"var(--text-strong, rgba(30,33,37,0.92))"},children:W}),e.jsx("div",{style:{fontSize:"var(--text-sm, 11px)",color:"var(--text-muted, rgba(30,33,37,0.56))",marginTop:"2px"},children:"Ask questions, get insights from analyzed interactions"})]}):null,e.jsx("div",{style:{flex:1,minHeight:0,overflowY:"auto",padding:"20px",display:"flex",flexDirection:"column"},children:h.length===0?e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-faint, rgba(30,33,37,0.36))",fontSize:"var(--text-md, 13px)",textAlign:"center",padding:"40px"},children:"No messages yet. Start a conversation by asking a question below."}):e.jsxs(e.Fragment,{children:[h.map(i=>e.jsx(X.ChatMessage,{role:i.role,content:i.content,html:i.html,timestamp:i.timestamp,toolBadges:i.toolBadges,isStreaming:i.isStreaming,onCodeBlockClick:s},i.id)),p&&e.jsx(X.ChatMessage,{role:p.role,content:p.content,timestamp:p.timestamp,isStreaming:!0,onCodeBlockClick:s},p.id),f&&(!p||t)&&e.jsx("div",{style:{marginBottom:"16px"},children:e.jsx(Q,{phase:t?"tool":D,elapsedMs:m,label:t&&_>=30?"Compacting conversation — trimming context to stay sharp...":t&&_>=10?"Running background tasks...":t?"Still working...":void 0})}),e.jsx("div",{ref:x})]})}),e.jsxs("div",{style:{borderTop:"1px solid var(--border-subtle, rgba(52,58,64,0.08))",padding:"16px 20px",background:"var(--paper-elevated, rgba(255,255,255,0.82))"},children:[e.jsxs("div",{style:{display:"flex",gap:"12px",alignItems:"flex-end"},children:[e.jsx("textarea",{ref:F,value:g,onChange:i=>z(i.target.value),onKeyDown:K,placeholder:R,rows:1,disabled:l,style:{flex:1,padding:"10px 14px",fontSize:"var(--text-base, 14px)",lineHeight:1.5,color:"var(--text-strong, rgba(30,33,37,0.92))",background:"rgba(255, 255, 255, 0.95)",border:"1px solid rgba(52, 58, 64, 0.18)",borderRadius:"var(--radius-md, 8px)",resize:"none",outline:"none",transition:"border-color 0.15s ease",fontFamily:"inherit",minHeight:"42px",maxHeight:"120px",opacity:l?.6:1,cursor:l?"not-allowed":"text"},onFocus:i=>{l||(i.target.style.borderColor="rgba(94, 136, 176, 0.35)")},onBlur:i=>{i.target.style.borderColor="rgba(52, 58, 64, 0.18)"}}),e.jsx("button",{onClick:n,disabled:!g.trim()||l,style:{padding:"10px 16px",background:g.trim()&&!l?"var(--Base-Strong, #0B0B0B)":"#ECEEF2",color:g.trim()&&!l?"white":"var(--text-base)",border:"none",borderRadius:"var(--radius-md, 8px)",cursor:g.trim()&&!l?"pointer":"not-allowed",display:"flex",alignItems:"center",gap:"6px",fontSize:"var(--text-md, 13px)",fontWeight:650,transition:"all 0.15s ease",height:"42px"},children:l?e.jsxs(e.Fragment,{children:[e.jsx("style",{children:`
|
|
18
18
|
@keyframes buttonSpin {
|
|
19
19
|
from { transform: rotate(0deg); }
|
|
20
20
|
to { transform: rotate(360deg); }
|
|
21
21
|
}
|
|
22
|
-
`}),e.jsx("div",{style:{width:"14px",height:"14px",border:"2px solid rgba(255, 255, 255, 0.3)",borderTopColor:"white",borderRadius:"50%",animation:"buttonSpin 0.6s linear infinite"}}),"Sending..."]}):e.jsxs(e.Fragment,{children:[e.jsx(j.Send,{size:16}),"Send"]})})]}),e.jsx("div",{style:{fontSize:"var(--text-sm, 11px)",color:"var(--text-faint, rgba(30,33,37,0.36))",marginTop:"8px"},children:"Press Enter to send, Shift+Enter for new line"})]})]})}function ee({threads:u=[],activeThreadId:k,onSelectThread:v,onNewChat:C,loading:n=!1}){const[w,R]=a.useState(""),h=[...u.filter(r=>{if(!w)return!0;const i=w.toLowerCase();return(r.title||"").toLowerCase().includes(i)||(r.last_message_preview||"").toLowerCase().includes(i)})].sort((r,i)=>{if(r.pinned&&!i.pinned)return-1;if(!r.pinned&&i.pinned)return 1;const o=new Date(r.updated_at||r.created_at||0).getTime();return new Date(i.updated_at||i.created_at||0).getTime()-o}),p=r=>{if(!r)return"";const i=new Date(r),l=new Date().getTime()-i.getTime(),d=Math.floor(l/864e5);return d===0?i.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}):d===1?"Yesterday":d<7?i.toLocaleDateString("en-US",{weekday:"short"}):i.toLocaleDateString("en-US",{month:"short",day:"numeric"})};return e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--paper, rgba(255,255,255,0.95))",borderRight:"1px solid var(--border, rgba(52,58,64,0.12))",overflow:"hidden"},children:[e.jsxs("div",{style:{padding:"12px 14px",borderBottom:"1px solid var(--border-subtle, rgba(52,58,64,0.08))",flexShrink:0},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"10px"},children:[e.jsx("div",{style:{fontSize:"13px",fontWeight:650,color:"var(--text-ink, rgba(30,33,37,0.92))"},children:"Threads"}),C&&e.jsx("button",{onClick:C,style:{padding:"4px 10px",fontSize:"11px",fontWeight:600,color:"var(--Base-Strong, #0B0B0B)",background:"#ECEEF2",border:"1px solid var(--border-subtle, rgba(52,58,64,0.08))",borderRadius:"6px",cursor:"pointer",transition:"all 0.15s ease"},onMouseEnter:r=>{r.currentTarget.style.background="#ECEEF2"},onMouseLeave:r=>{r.currentTarget.style.background="rgba(94, 136, 176, 0.08)"},children:"+ New"})]}),e.jsxs("div",{style:{position:"relative"},children:[e.jsx(j.Search,{size:13,style:{position:"absolute",left:"10px",top:"50%",transform:"translateY(-50%)",color:"var(--text-faint, rgba(30,33,37,0.36))",pointerEvents:"none"}}),e.jsx("input",{type:"text",value:w,onChange:r=>R(r.target.value),placeholder:"Search threads...",style:{width:"100%",padding:"7px 10px 7px 32px",fontSize:"12px",color:"var(--text-ink, rgba(30,33,37,0.92))",background:"var(--paper-elevated, rgba(255,255,255,0.82))",border:"1px solid var(--border, rgba(52,58,64,0.12))",borderRadius:"6px",outline:"none",transition:"border-color 0.15s ease",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor="rgba(94, 136, 176, 0.35)"},onBlur:r=>{r.target.style.borderColor="rgba(52, 58, 64, 0.12)"}})]})]}),e.jsx("div",{style:{flex:1,overflowY:"auto",padding:"4px 6px"},children:n?e.jsx("div",{style:{padding:"30px 16px",textAlign:"center",color:"var(--text-faint, rgba(30,33,37,0.36))",fontSize:"12px"},children:"Loading threads..."}):h.length===0?e.jsx("div",{style:{padding:"30px 16px",textAlign:"center",color:"var(--text-faint, rgba(30,33,37,0.36))",fontSize:"12px"},children:w?"No threads found":"No threads yet"}):h.map(r=>{const i=r.id===k;return e.jsxs("div",{onClick:()=>v==null?void 0:v(r.id),style:{padding:"10px 10px",marginBottom:"2px",borderRadius:"6px",background:i?"rgba(94, 136, 176, 0.10)":"transparent",border:i?"1px solid rgba(94, 136, 176, 0.15)":"1px solid transparent",cursor:"pointer",transition:"all 0.12s ease"},onMouseEnter:o=>{i||(o.currentTarget.style.background="rgba(0,0,0,0.03)")},onMouseLeave:o=>{i||(o.currentTarget.style.background="transparent")},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",marginBottom:"4px"},children:[e.jsx(j.MessageSquare,{size:12,style:{color:i?"var(--rail-discovery, #5E88B0)":"var(--text-faint, rgba(30,33,37,0.36))",flexShrink:0}}),e.jsx("div",{style:{flex:1,fontSize:"12px",fontWeight:i?650:550,color:i?"var(--text-ink, rgba(30,33,37,0.92))":"var(--text-base, rgba(30,33,37,0.78))",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r.title||"Untitled thread"}),r.pinned&&e.jsx(j.Pin,{size:10,style:{color:"var(--rail-discovery, #5E88B0)",flexShrink:0}})]}),r.last_message_preview&&e.jsx("div",{style:{fontSize:"11px",color:"var(--text-muted, rgba(30,33,37,0.56))",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginLeft:"18px",marginBottom:"4px"},children:r.last_message_preview}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",marginLeft:"18px",fontSize:"10px",color:"var(--text-faint, rgba(30,33,37,0.36))"},children:[e.jsx(j.Clock,{size:9}),e.jsx("span",{children:p(r.updated_at||r.created_at)}),r.message_count!=null&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsxs("span",{children:[r.message_count," msg",r.message_count!==1?"s":""]})]})]})]},r.id)})})]})}const te={error:(...u)=>console.warn("toast.error:",...u)},re=()=>({userData:{name:"User",email:""}});function ne({sessionTitle:u,messages:k,onSendMessage:v,currentUser:C}){var E;const[n,w]=a.useState(""),[R,S]=a.useState(!1),[h,p]=a.useState(k||[]),[r,i]=a.useState(!1),[o,l]=a.useState(!1),{userData:d}=re(),x=a.useRef(null),m=C||{name:(d==null?void 0:d.name)||"You",initials:((E=d==null?void 0:d.name)==null?void 0:E.split(" ").map(t=>t[0]).join("").toUpperCase())||"YO",color:"#6B7C93"};a.useEffect(()=>{p(k||[])},[k]),a.useEffect(()=>{x.current&&x.current.scrollIntoView({behavior:"smooth"})},[h]);const F=async()=>{if(!n.trim())return;const t=n.trim();w(""),l(!0);const b={id:`temp-${Date.now()}`,author:{name:m.name,role:(d==null?void 0:d.role)||"",initials:m.initials,color:m.color},content:t,timestamp:"Just now",type:"comment",isOptimistic:!0};if(p(T=>[...T,b]),v){try{await v(t),p(T=>T.map(g=>g.id===b.id?{...g,isOptimistic:!1}:g))}catch{p(g=>g.filter(I=>I.id!==b.id)),te.error("Failed to send message")}finally{l(!1)}return}setTimeout(()=>{p(T=>T.map(g=>g.id===b.id?{...g,isOptimistic:!1}:g)),l(!1)},500)},B=t=>{t.key==="Enter"&&!t.shiftKey&&(t.preventDefault(),F())};return e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--paper-elevated, rgba(255,255,255,0.82))",border:"1px solid var(--border, rgba(52,58,64,0.12))",borderRadius:"var(--radius-lg, 12px)",overflow:"hidden"},children:[u&&e.jsxs("div",{style:{padding:"14px 16px",borderBottom:"1px solid var(--border, rgba(52,58,64,0.12))",background:"var(--paper-elevated, rgba(255,255,255,0.82))"},children:[e.jsx("div",{style:{fontSize:"var(--text-md, 13px)",fontWeight:680,color:"var(--text-strong, rgba(30,33,37,0.92))",marginBottom:"3px"},children:"Session Discussion"}),u&&e.jsx("div",{style:{fontSize:"var(--text-sm, 11px)",color:"var(--text-muted, rgba(30,33,37,0.56))",display:"flex",alignItems:"center",gap:"8px"},children:e.jsx("span",{children:u})})]}),e.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"16px",display:"flex",flexDirection:"column",gap:"16px"},children:[r?e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"40px",color:"var(--text-faint, rgba(30,33,37,0.36))"},children:"Loading messages..."}):h.length===0?e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"40px",color:"var(--text-faint, rgba(30,33,37,0.36))"},children:"No messages yet. Start the conversation!"}):h.map(t=>e.jsxs("div",{style:{display:"flex",gap:"12px",opacity:t.type==="system"?.75:1},children:[t.type!=="system"&&e.jsx("div",{style:{width:"32px",height:"32px",borderRadius:"8px",background:t.author.color,color:"white",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"11px",fontWeight:650,flexShrink:0,opacity:.9},children:t.author.initials}),t.type==="system"&&e.jsx("div",{style:{width:"32px",height:"32px",borderRadius:"8px",background:"rgba(30, 33, 37, 0.08)",color:"rgba(30, 33, 37, 0.52)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"11px",fontWeight:650,flexShrink:0},children:e.jsx(j.Clock,{size:14})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"8px",marginBottom:"4px"},children:[e.jsx("span",{style:{fontSize:"var(--text-sm, 11px)",fontWeight:650,color:"var(--text-base, rgba(30,33,37,0.78))"},children:t.author.name}),e.jsx("span",{style:{fontSize:"var(--text-sm, 11px)",color:"var(--text-faint, rgba(30,33,37,0.36))",fontFamily:"var(--font-mono, monospace)"},children:t.timestamp}),t.author.role&&e.jsx("span",{style:{fontSize:"var(--text-xs, 10px)",color:"var(--text-muted, rgba(30,33,37,0.56))",background:"rgba(30, 33, 37, 0.06)",padding:"2px 6px",borderRadius:"4px",textTransform:"uppercase",letterSpacing:"0.04em",fontWeight:600},children:t.author.role}),t.isEdited&&e.jsx("span",{style:{fontSize:"var(--text-xs, 10px)",color:"var(--text-faint, rgba(30,33,37,0.36))",fontStyle:"italic"},children:"(edited)"})]}),e.jsx("div",{style:{fontSize:"var(--text-md, 13px)",color:"var(--text-base, rgba(30,33,37,0.78))",lineHeight:1.5,marginBottom:t.references?"8px":0},children:t.content}),t.references&&t.references.length>0&&e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px",marginTop:"8px"},children:t.references.map((b,T)=>e.jsxs("button",{type:"button",style:{fontSize:"11px",padding:"4px 8px",borderRadius:"6px",border:"1px solid rgba(52, 58, 64, 0.16)",background:"rgba(255, 255, 255, 0.7)",color:b.type==="condition"?"rgba(94, 136, 176, 0.85)":b.type==="observation"?"rgba(107, 123, 147, 0.85)":b.type==="timestamp"?"rgba(184, 156, 106, 0.85)":"rgba(30, 33, 37, 0.65)",cursor:"pointer",display:"inline-flex",alignItems:"center",gap:"4px",transition:"all 0.15s ease",fontWeight:550},onMouseEnter:g=>{g.currentTarget.style.background="rgba(255, 255, 255, 0.95)",g.currentTarget.style.borderColor="rgba(52, 58, 64, 0.24)"},onMouseLeave:g=>{g.currentTarget.style.background="rgba(255, 255, 255, 0.7)",g.currentTarget.style.borderColor="rgba(52, 58, 64, 0.16)"},children:[b.type==="timestamp"&&e.jsx(j.Clock,{size:12}),(b.type==="condition"||b.type==="observation")&&e.jsx(j.Hash,{size:12}),b.label]},T))})]})]},t.id)),e.jsx("div",{ref:x})]}),e.jsxs("div",{style:{padding:"12px",borderTop:"1px solid var(--border, rgba(52,58,64,0.12))",background:"var(--paper-elevated, rgba(255,255,255,0.82))"},children:[e.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"flex-end"},children:[e.jsx("div",{style:{width:"32px",height:"32px",borderRadius:"var(--radius-md, 8px)",background:m.color,color:"white",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"var(--text-sm, 11px)",fontWeight:650,flexShrink:0,opacity:.9},children:m.initials}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"8px"},children:[e.jsx("textarea",{value:n,onChange:t=>w(t.target.value),onKeyDown:B,onFocus:()=>S(!0),onBlur:()=>S(!1),placeholder:"Add a comment...",style:{width:"100%",minHeight:"38px",maxHeight:"120px",padding:"8px 12px",fontSize:"var(--text-md, 13px)",color:"var(--text-base, rgba(30,33,37,0.78))",background:"white",border:`1px solid ${R?"rgba(94, 136, 176, 0.35)":"rgba(52, 58, 64, 0.16)"}`,borderRadius:"var(--radius-md, 8px)",resize:"vertical",outline:"none",transition:"border-color 0.15s ease",fontFamily:"inherit",lineHeight:1.5}}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("div",{style:{display:"flex",gap:"4px"},children:[e.jsx("button",{type:"button",style:{padding:"6px",background:"transparent",border:"none",borderRadius:"6px",color:"rgba(30, 33, 37, 0.52)",cursor:"pointer",display:"flex",alignItems:"center",transition:"all 0.15s ease"},onMouseEnter:t=>{t.currentTarget.style.background="rgba(30, 33, 37, 0.06)",t.currentTarget.style.color="rgba(30, 33, 37, 0.75)"},onMouseLeave:t=>{t.currentTarget.style.background="transparent",t.currentTarget.style.color="rgba(30, 33, 37, 0.52)"},title:"Mention user",children:e.jsx(j.AtSign,{size:16})}),e.jsx("button",{type:"button",style:{padding:"6px",background:"transparent",border:"none",borderRadius:"6px",color:"rgba(30, 33, 37, 0.52)",cursor:"pointer",display:"flex",alignItems:"center",transition:"all 0.15s ease"},onMouseEnter:t=>{t.currentTarget.style.background="rgba(30, 33, 37, 0.06)",t.currentTarget.style.color="rgba(30, 33, 37, 0.75)"},onMouseLeave:t=>{t.currentTarget.style.background="transparent",t.currentTarget.style.color="rgba(30, 33, 37, 0.52)"},title:"Reference condition",children:e.jsx(j.Hash,{size:16})}),e.jsx("button",{type:"button",style:{padding:"6px",background:"transparent",border:"none",borderRadius:"6px",color:"rgba(30, 33, 37, 0.52)",cursor:"pointer",display:"flex",alignItems:"center",transition:"all 0.15s ease"},onMouseEnter:t=>{t.currentTarget.style.background="rgba(30, 33, 37, 0.06)",t.currentTarget.style.color="rgba(30, 33, 37, 0.75)"},onMouseLeave:t=>{t.currentTarget.style.background="transparent",t.currentTarget.style.color="rgba(30, 33, 37, 0.52)"},title:"Attach file",children:e.jsx(j.Paperclip,{size:16})})]}),e.jsx("button",{type:"button",onClick:F,disabled:!n.trim()||o,style:{padding:"6px 12px",background:n.trim()&&!o?"rgba(94, 136, 176, 0.85)":"var(--border-subtle, rgba(52,58,64,0.08))",border:"none",borderRadius:"6px",color:n.trim()&&!o?"white":"var(--text-faint, rgba(30,33,37,0.36))",fontSize:"var(--text-sm, 11px)",fontWeight:600,cursor:n.trim()&&!o?"pointer":"not-allowed",display:"flex",alignItems:"center",gap:"6px",transition:"all 0.15s ease"},onMouseEnter:t=>{n.trim()&&!o&&(t.currentTarget.style.background="rgba(94, 136, 176, 1)")},onMouseLeave:t=>{n.trim()&&!o&&(t.currentTarget.style.background="rgba(94, 136, 176, 0.85)")},children:o?e.jsxs(e.Fragment,{children:[e.jsx("style",{children:`
|
|
22
|
+
`}),e.jsx("div",{style:{width:"14px",height:"14px",border:"2px solid rgba(255, 255, 255, 0.3)",borderTopColor:"white",borderRadius:"50%",animation:"buttonSpin 0.6s linear infinite"}}),"Sending..."]}):e.jsxs(e.Fragment,{children:[e.jsx(v.Send,{size:16}),"Send"]})})]}),e.jsx("div",{style:{fontSize:"var(--text-sm, 11px)",color:"var(--text-faint, rgba(30,33,37,0.36))",marginTop:"8px"},children:"Press Enter to send, Shift+Enter for new line"})]})]})}function ee({threads:y=[],activeThreadId:I,onSelectThread:C,onNewChat:M,onRenameThread:s,onDeleteThread:R,loading:W=!1}){const[h,T]=o.useState(""),[g,z]=o.useState(null),[f,d]=o.useState(null),[l,c]=o.useState(""),[p,b]=o.useState(null),D=o.useRef(null);o.useEffect(()=>{f&&D.current&&(D.current.focus(),D.current.select())},[f]);const A=[...y.filter(t=>{if(!h)return!0;const a=h.toLowerCase();return(t.title||"").toLowerCase().includes(a)||(t.last_message_preview||"").toLowerCase().includes(a)})].sort((t,a)=>{if(t.pinned&&!a.pinned)return-1;if(!t.pinned&&a.pinned)return 1;const _=new Date(t.updated_at||t.created_at||0).getTime();return new Date(a.updated_at||a.created_at||0).getTime()-_}),r=t=>{if(!t)return"";const a=new Date(t),k=new Date().getTime()-a.getTime(),E=Math.floor(k/864e5);return E===0?a.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}):E===1?"Yesterday":E<7?a.toLocaleDateString("en-US",{weekday:"short"}):a.toLocaleDateString("en-US",{month:"short",day:"numeric"})},m=(t,a)=>{t.stopPropagation(),b(null),d(a.id),c(a.title||"")},j=t=>{t&&t.stopPropagation();const a=(l||"").trim();f&&a&&(s==null||s(f,a)),d(null),c("")},x=t=>{t&&t.stopPropagation(),d(null),c("")},F=(t,a)=>{t.stopPropagation(),d(null),b(a.id)},H=t=>{t&&t.stopPropagation(),p&&(R==null||R(p)),b(null)},U=t=>{t&&t.stopPropagation(),b(null)},B={display:"inline-flex",alignItems:"center",justifyContent:"center",width:"22px",height:"22px",padding:0,background:"transparent",border:"none",borderRadius:"4px",cursor:"pointer",color:"var(--text-muted, rgba(30,33,37,0.56))",transition:"all 0.12s ease",flexShrink:0};return e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--paper, rgba(255,255,255,0.95))",borderRight:"1px solid var(--border, rgba(52,58,64,0.12))",overflow:"hidden"},children:[e.jsxs("div",{style:{padding:"12px 14px",borderBottom:"1px solid var(--border-subtle, rgba(52,58,64,0.08))",flexShrink:0},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"10px"},children:[e.jsx("div",{style:{fontSize:"13px",fontWeight:650,color:"var(--text-ink, rgba(30,33,37,0.92))"},children:"Threads"}),M&&e.jsx("button",{onClick:M,style:{padding:"4px 10px",fontSize:"11px",fontWeight:600,color:"var(--Base-Strong, #0B0B0B)",background:"#ECEEF2",border:"1px solid var(--border-subtle, rgba(52,58,64,0.08))",borderRadius:"6px",cursor:"pointer",transition:"all 0.15s ease"},onMouseEnter:t=>{t.currentTarget.style.background="#ECEEF2"},onMouseLeave:t=>{t.currentTarget.style.background="rgba(94, 136, 176, 0.08)"},children:"+ New"})]}),e.jsxs("div",{style:{position:"relative"},children:[e.jsx(v.Search,{size:13,style:{position:"absolute",left:"10px",top:"50%",transform:"translateY(-50%)",color:"var(--text-faint, rgba(30,33,37,0.36))",pointerEvents:"none"}}),e.jsx("input",{type:"text",value:h,onChange:t=>T(t.target.value),placeholder:"Search threads...",style:{width:"100%",padding:"7px 10px 7px 32px",fontSize:"12px",color:"var(--text-ink, rgba(30,33,37,0.92))",background:"var(--paper-elevated, rgba(255,255,255,0.82))",border:"1px solid var(--border, rgba(52,58,64,0.12))",borderRadius:"6px",outline:"none",transition:"border-color 0.15s ease",boxSizing:"border-box"},onFocus:t=>{t.target.style.borderColor="rgba(94, 136, 176, 0.35)"},onBlur:t=>{t.target.style.borderColor="rgba(52, 58, 64, 0.12)"}})]})]}),e.jsx("div",{style:{flex:1,overflowY:"auto",padding:"4px 6px"},children:W?e.jsx("div",{style:{padding:"30px 16px",textAlign:"center",color:"var(--text-faint, rgba(30,33,37,0.36))",fontSize:"12px"},children:"Loading threads..."}):A.length===0?e.jsx("div",{style:{padding:"30px 16px",textAlign:"center",color:"var(--text-faint, rgba(30,33,37,0.36))",fontSize:"12px"},children:h?"No threads found":"No threads yet"}):A.map(t=>{const a=t.id===I,_=g===t.id,k=f===t.id,E=p===t.id,N=typeof s=="function",Y=typeof R=="function",q=(N||Y)&&_&&!k&&!E;return e.jsxs("div",{onClick:()=>{k||E||C==null||C(t.id)},onMouseEnter:n=>{z(t.id),a||(n.currentTarget.style.background="rgba(0,0,0,0.03)")},onMouseLeave:n=>{z(K=>K===t.id?null:K),a||(n.currentTarget.style.background="transparent")},style:{padding:"10px 10px",marginBottom:"2px",borderRadius:"6px",background:a?"rgba(94, 136, 176, 0.10)":"transparent",border:a?"1px solid rgba(94, 136, 176, 0.15)":"1px solid transparent",cursor:k||E?"default":"pointer",transition:"all 0.12s ease"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",marginBottom:"4px"},children:[e.jsx(v.MessageSquare,{size:12,style:{color:a?"var(--rail-discovery, #5E88B0)":"var(--text-faint, rgba(30,33,37,0.36))",flexShrink:0}}),k?e.jsx("input",{ref:D,type:"text",value:l,onChange:n=>c(n.target.value),onClick:n=>n.stopPropagation(),onKeyDown:n=>{n.stopPropagation(),n.key==="Enter"?j(n):n.key==="Escape"&&x(n)},style:{flex:1,minWidth:0,fontSize:"12px",fontWeight:600,color:"var(--text-ink, rgba(30,33,37,0.92))",background:"var(--paper-elevated, #fff)",border:"1px solid rgba(94, 136, 176, 0.45)",borderRadius:"4px",padding:"3px 6px",outline:"none",boxSizing:"border-box"}}):e.jsx("div",{style:{flex:1,minWidth:0,fontSize:"12px",fontWeight:a?650:550,color:a?"var(--text-ink, rgba(30,33,37,0.92))":"var(--text-base, rgba(30,33,37,0.78))",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.title||"Untitled thread"}),!k&&!E&&t.pinned&&e.jsx(v.Pin,{size:10,style:{color:"var(--rail-discovery, #5E88B0)",flexShrink:0}}),k&&e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:"2px",flexShrink:0},children:[e.jsx("button",{type:"button",title:"Save",onClick:j,style:{...B,color:"var(--rail-discovery, #5E88B0)"},onMouseEnter:n=>{n.currentTarget.style.background="rgba(94, 136, 176, 0.12)"},onMouseLeave:n=>{n.currentTarget.style.background="transparent"},children:e.jsx(v.Check,{size:13})}),e.jsx("button",{type:"button",title:"Cancel",onClick:x,style:B,onMouseEnter:n=>{n.currentTarget.style.background="rgba(0,0,0,0.06)"},onMouseLeave:n=>{n.currentTarget.style.background="transparent"},children:e.jsx(v.X,{size:13})})]}),q&&e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:"2px",flexShrink:0},children:[N&&e.jsx("button",{type:"button",title:"Rename",onClick:n=>m(n,t),style:B,onMouseEnter:n=>{n.currentTarget.style.background="rgba(0,0,0,0.06)",n.currentTarget.style.color="var(--text-ink, rgba(30,33,37,0.92))"},onMouseLeave:n=>{n.currentTarget.style.background="transparent",n.currentTarget.style.color="var(--text-muted, rgba(30,33,37,0.56))"},children:e.jsx(v.Pencil,{size:12})}),Y&&e.jsx("button",{type:"button",title:"Delete",onClick:n=>F(n,t),style:B,onMouseEnter:n=>{n.currentTarget.style.background="rgba(220, 53, 69, 0.10)",n.currentTarget.style.color="#DC3545"},onMouseLeave:n=>{n.currentTarget.style.background="transparent",n.currentTarget.style.color="var(--text-muted, rgba(30,33,37,0.56))"},children:e.jsx(v.Trash2,{size:12})})]})]}),E?e.jsxs("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:"8px",marginLeft:"18px",marginTop:"2px"},children:[e.jsx("span",{style:{fontSize:"11px",color:"var(--text-base, rgba(30,33,37,0.78))",fontWeight:500},children:"Confirm: delete this thread?"}),e.jsx("button",{type:"button",onClick:H,style:{padding:"3px 10px",fontSize:"11px",fontWeight:600,color:"var(--text-ink, rgba(30,33,37,0.92))",background:"#ECEEF2",border:"1px solid var(--border-subtle, rgba(52,58,64,0.08))",borderRadius:"5px",cursor:"pointer",transition:"background 0.12s ease"},onMouseEnter:n=>{n.currentTarget.style.background="#E2E5EA"},onMouseLeave:n=>{n.currentTarget.style.background="#ECEEF2"},children:"Yes"}),e.jsx("button",{type:"button",onClick:U,style:{padding:"3px 4px",fontSize:"11px",fontWeight:500,color:"var(--text-muted, rgba(30,33,37,0.56))",background:"transparent",border:"none",cursor:"pointer",transition:"color 0.12s ease"},onMouseEnter:n=>{n.currentTarget.style.color="var(--text-ink, rgba(30,33,37,0.92))"},onMouseLeave:n=>{n.currentTarget.style.color="var(--text-muted, rgba(30,33,37,0.56))"},children:"No"})]}):e.jsxs(e.Fragment,{children:[t.last_message_preview&&!k&&e.jsx("div",{style:{fontSize:"11px",color:"var(--text-muted, rgba(30,33,37,0.56))",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginLeft:"18px",marginBottom:"4px"},children:t.last_message_preview}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",marginLeft:"18px",fontSize:"10px",color:"var(--text-faint, rgba(30,33,37,0.36))"},children:[e.jsx(v.Clock,{size:9}),e.jsx("span",{children:r(t.updated_at||t.created_at)}),t.message_count!=null&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsxs("span",{children:[t.message_count," msg",t.message_count!==1?"s":""]})]})]})]})]},t.id)})})]})}const te={error:(...y)=>console.warn("toast.error:",...y)},re=()=>({userData:{name:"User",email:""}});function ne({sessionTitle:y,messages:I,onSendMessage:C,currentUser:M}){var A;const[s,R]=o.useState(""),[W,h]=o.useState(!1),[T,g]=o.useState(I||[]),[z,f]=o.useState(!1),[d,l]=o.useState(!1),{userData:c}=re(),p=o.useRef(null),b=M||{name:(c==null?void 0:c.name)||"You",initials:((A=c==null?void 0:c.name)==null?void 0:A.split(" ").map(r=>r[0]).join("").toUpperCase())||"YO",color:"#6B7C93"};o.useEffect(()=>{g(I||[])},[I]),o.useEffect(()=>{p.current&&p.current.scrollIntoView({behavior:"smooth"})},[T]);const D=async()=>{if(!s.trim())return;const r=s.trim();R(""),l(!0);const m={id:`temp-${Date.now()}`,author:{name:b.name,role:(c==null?void 0:c.role)||"",initials:b.initials,color:b.color},content:r,timestamp:"Just now",type:"comment",isOptimistic:!0};if(g(j=>[...j,m]),C){try{await C(r),g(j=>j.map(x=>x.id===m.id?{...x,isOptimistic:!1}:x))}catch{g(x=>x.filter(F=>F.id!==m.id)),te.error("Failed to send message")}finally{l(!1)}return}setTimeout(()=>{g(j=>j.map(x=>x.id===m.id?{...x,isOptimistic:!1}:x)),l(!1)},500)},P=r=>{r.key==="Enter"&&!r.shiftKey&&(r.preventDefault(),D())};return e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--paper-elevated, rgba(255,255,255,0.82))",border:"1px solid var(--border, rgba(52,58,64,0.12))",borderRadius:"var(--radius-lg, 12px)",overflow:"hidden"},children:[y&&e.jsxs("div",{style:{padding:"14px 16px",borderBottom:"1px solid var(--border, rgba(52,58,64,0.12))",background:"var(--paper-elevated, rgba(255,255,255,0.82))"},children:[e.jsx("div",{style:{fontSize:"var(--text-md, 13px)",fontWeight:680,color:"var(--text-strong, rgba(30,33,37,0.92))",marginBottom:"3px"},children:"Session Discussion"}),y&&e.jsx("div",{style:{fontSize:"var(--text-sm, 11px)",color:"var(--text-muted, rgba(30,33,37,0.56))",display:"flex",alignItems:"center",gap:"8px"},children:e.jsx("span",{children:y})})]}),e.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"16px",display:"flex",flexDirection:"column",gap:"16px"},children:[z?e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"40px",color:"var(--text-faint, rgba(30,33,37,0.36))"},children:"Loading messages..."}):T.length===0?e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"40px",color:"var(--text-faint, rgba(30,33,37,0.36))"},children:"No messages yet. Start the conversation!"}):T.map(r=>e.jsxs("div",{style:{display:"flex",gap:"12px",opacity:r.type==="system"?.75:1},children:[r.type!=="system"&&e.jsx("div",{style:{width:"32px",height:"32px",borderRadius:"8px",background:r.author.color,color:"white",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"11px",fontWeight:650,flexShrink:0,opacity:.9},children:r.author.initials}),r.type==="system"&&e.jsx("div",{style:{width:"32px",height:"32px",borderRadius:"8px",background:"rgba(30, 33, 37, 0.08)",color:"rgba(30, 33, 37, 0.52)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"11px",fontWeight:650,flexShrink:0},children:e.jsx(v.Clock,{size:14})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"8px",marginBottom:"4px"},children:[e.jsx("span",{style:{fontSize:"var(--text-sm, 11px)",fontWeight:650,color:"var(--text-base, rgba(30,33,37,0.78))"},children:r.author.name}),e.jsx("span",{style:{fontSize:"var(--text-sm, 11px)",color:"var(--text-faint, rgba(30,33,37,0.36))",fontFamily:"var(--font-mono, monospace)"},children:r.timestamp}),r.author.role&&e.jsx("span",{style:{fontSize:"var(--text-xs, 10px)",color:"var(--text-muted, rgba(30,33,37,0.56))",background:"rgba(30, 33, 37, 0.06)",padding:"2px 6px",borderRadius:"4px",textTransform:"uppercase",letterSpacing:"0.04em",fontWeight:600},children:r.author.role}),r.isEdited&&e.jsx("span",{style:{fontSize:"var(--text-xs, 10px)",color:"var(--text-faint, rgba(30,33,37,0.36))",fontStyle:"italic"},children:"(edited)"})]}),e.jsx("div",{style:{fontSize:"var(--text-md, 13px)",color:"var(--text-base, rgba(30,33,37,0.78))",lineHeight:1.5,marginBottom:r.references?"8px":0},children:r.content}),r.references&&r.references.length>0&&e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px",marginTop:"8px"},children:r.references.map((m,j)=>e.jsxs("button",{type:"button",style:{fontSize:"11px",padding:"4px 8px",borderRadius:"6px",border:"1px solid rgba(52, 58, 64, 0.16)",background:"rgba(255, 255, 255, 0.7)",color:m.type==="condition"?"rgba(94, 136, 176, 0.85)":m.type==="observation"?"rgba(107, 123, 147, 0.85)":m.type==="timestamp"?"rgba(184, 156, 106, 0.85)":"rgba(30, 33, 37, 0.65)",cursor:"pointer",display:"inline-flex",alignItems:"center",gap:"4px",transition:"all 0.15s ease",fontWeight:550},onMouseEnter:x=>{x.currentTarget.style.background="rgba(255, 255, 255, 0.95)",x.currentTarget.style.borderColor="rgba(52, 58, 64, 0.24)"},onMouseLeave:x=>{x.currentTarget.style.background="rgba(255, 255, 255, 0.7)",x.currentTarget.style.borderColor="rgba(52, 58, 64, 0.16)"},children:[m.type==="timestamp"&&e.jsx(v.Clock,{size:12}),(m.type==="condition"||m.type==="observation")&&e.jsx(v.Hash,{size:12}),m.label]},j))})]})]},r.id)),e.jsx("div",{ref:p})]}),e.jsxs("div",{style:{padding:"12px",borderTop:"1px solid var(--border, rgba(52,58,64,0.12))",background:"var(--paper-elevated, rgba(255,255,255,0.82))"},children:[e.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"flex-end"},children:[e.jsx("div",{style:{width:"32px",height:"32px",borderRadius:"var(--radius-md, 8px)",background:b.color,color:"white",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"var(--text-sm, 11px)",fontWeight:650,flexShrink:0,opacity:.9},children:b.initials}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"8px"},children:[e.jsx("textarea",{value:s,onChange:r=>R(r.target.value),onKeyDown:P,onFocus:()=>h(!0),onBlur:()=>h(!1),placeholder:"Add a comment...",style:{width:"100%",minHeight:"38px",maxHeight:"120px",padding:"8px 12px",fontSize:"var(--text-md, 13px)",color:"var(--text-base, rgba(30,33,37,0.78))",background:"white",border:`1px solid ${W?"rgba(94, 136, 176, 0.35)":"rgba(52, 58, 64, 0.16)"}`,borderRadius:"var(--radius-md, 8px)",resize:"vertical",outline:"none",transition:"border-color 0.15s ease",fontFamily:"inherit",lineHeight:1.5}}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("div",{style:{display:"flex",gap:"4px"},children:[e.jsx("button",{type:"button",style:{padding:"6px",background:"transparent",border:"none",borderRadius:"6px",color:"rgba(30, 33, 37, 0.52)",cursor:"pointer",display:"flex",alignItems:"center",transition:"all 0.15s ease"},onMouseEnter:r=>{r.currentTarget.style.background="rgba(30, 33, 37, 0.06)",r.currentTarget.style.color="rgba(30, 33, 37, 0.75)"},onMouseLeave:r=>{r.currentTarget.style.background="transparent",r.currentTarget.style.color="rgba(30, 33, 37, 0.52)"},title:"Mention user",children:e.jsx(v.AtSign,{size:16})}),e.jsx("button",{type:"button",style:{padding:"6px",background:"transparent",border:"none",borderRadius:"6px",color:"rgba(30, 33, 37, 0.52)",cursor:"pointer",display:"flex",alignItems:"center",transition:"all 0.15s ease"},onMouseEnter:r=>{r.currentTarget.style.background="rgba(30, 33, 37, 0.06)",r.currentTarget.style.color="rgba(30, 33, 37, 0.75)"},onMouseLeave:r=>{r.currentTarget.style.background="transparent",r.currentTarget.style.color="rgba(30, 33, 37, 0.52)"},title:"Reference condition",children:e.jsx(v.Hash,{size:16})}),e.jsx("button",{type:"button",style:{padding:"6px",background:"transparent",border:"none",borderRadius:"6px",color:"rgba(30, 33, 37, 0.52)",cursor:"pointer",display:"flex",alignItems:"center",transition:"all 0.15s ease"},onMouseEnter:r=>{r.currentTarget.style.background="rgba(30, 33, 37, 0.06)",r.currentTarget.style.color="rgba(30, 33, 37, 0.75)"},onMouseLeave:r=>{r.currentTarget.style.background="transparent",r.currentTarget.style.color="rgba(30, 33, 37, 0.52)"},title:"Attach file",children:e.jsx(v.Paperclip,{size:16})})]}),e.jsx("button",{type:"button",onClick:D,disabled:!s.trim()||d,style:{padding:"6px 12px",background:s.trim()&&!d?"rgba(94, 136, 176, 0.85)":"var(--border-subtle, rgba(52,58,64,0.08))",border:"none",borderRadius:"6px",color:s.trim()&&!d?"white":"var(--text-faint, rgba(30,33,37,0.36))",fontSize:"var(--text-sm, 11px)",fontWeight:600,cursor:s.trim()&&!d?"pointer":"not-allowed",display:"flex",alignItems:"center",gap:"6px",transition:"all 0.15s ease"},onMouseEnter:r=>{s.trim()&&!d&&(r.currentTarget.style.background="rgba(94, 136, 176, 1)")},onMouseLeave:r=>{s.trim()&&!d&&(r.currentTarget.style.background="rgba(94, 136, 176, 0.85)")},children:d?e.jsxs(e.Fragment,{children:[e.jsx("style",{children:`
|
|
23
23
|
@keyframes messageSpin {
|
|
24
24
|
from { transform: rotate(0deg); }
|
|
25
25
|
to { transform: rotate(360deg); }
|
|
26
26
|
}
|
|
27
|
-
`}),e.jsx("div",{style:{width:"14px",height:"14px",border:"2px solid rgba(255, 255, 255, 0.3)",borderTopColor:"white",borderRadius:"50%",animation:"messageSpin 0.6s linear infinite"}}),"Sending..."]}):e.jsxs(e.Fragment,{children:[e.jsx(
|
|
27
|
+
`}),e.jsx("div",{style:{width:"14px",height:"14px",border:"2px solid rgba(255, 255, 255, 0.3)",borderTopColor:"white",borderRadius:"50%",animation:"messageSpin 0.6s linear infinite"}}),"Sending..."]}):e.jsxs(e.Fragment,{children:[e.jsx(v.Send,{size:14}),"Send"]})})]})]})]}),e.jsxs("div",{style:{marginTop:"8px",fontSize:"var(--text-sm, 11px)",color:"var(--text-faint, rgba(30,33,37,0.36))",lineHeight:1.4},children:[e.jsx("strong",{children:"Tip:"})," Use"," ",e.jsx("code",{style:{background:"rgba(30, 33, 37, 0.06)",padding:"2px 4px",borderRadius:"3px",fontFamily:"var(--font-mono, monospace)",fontSize:"var(--text-xs, 10px)"},children:"@"})," ","to mention teammates,"," ",e.jsx("code",{style:{background:"rgba(30, 33, 37, 0.06)",padding:"2px 4px",borderRadius:"3px",fontFamily:"var(--font-mono, monospace)",fontSize:"var(--text-xs, 10px)"},children:"#"})," ","to reference conditions"]})]})]})}exports.ChartRenderer=X.ChartRenderer;exports.ChatMessage=X.ChatMessage;exports.ChatHistoryPanel=ee;exports.ChatInterface=Z;exports.MessageThread=ne;exports.ThinkingIndicator=Q;
|
|
28
28
|
//# sourceMappingURL=chat.cjs.js.map
|