import{r as h,Y as g,f as C,q as a,s as r,ai as o,ah as y,L as x,a3 as k,c2 as b}from"./index-c51caa49.js";import{C as d,D as O,d as T,c as _,a as N,q as m}from"./PrivateIndicator-3ba4829d.js";import{f as u,c as w}from"./chat-service-5449e6a5.js";import{E as z}from"./EyeFilled-7123e83b.js";var A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z"}}]},name:"clock-circle",theme:"outlined"};const E=A;var L=function(t,c){return h.createElement(g,C({},t,{ref:c,icon:E}))};const P=h.forwardRef(L),j=({chats:i,onChatDeleted:t,size:c="medium",mode:p="manage"})=>{const v=async e=>{await w.deleteChat(e),t==null||t()};return a("div",{className:`chat-list-container ${c}`,children:i.map(e=>{var s,l,n;return a(d,{className:"d-flex flex-column",size:"small",actions:[a("span",{children:a("a",{href:`/chats/${e.id}`,target:"_blank",children:p==="manage"?r("span",{children:[a(o,{})," Continue"]}):r("span",{children:[a(z,{})," View"]})})}),t?r(T,{title:"Delete this chat",description:"Are you sure to delete this chat?",onConfirm:()=>v(e.id),okText:"Yes",cancelText:"No",children:[a(O,{})," Delete"]}):void 0].filter(f=>f),children:a(d.Meta,{avatar:a("img",{alt:"",className:"bot-avatar",src:y(((s=e.characters)==null?void 0:s.avatar)||"")}),title:r(x,{to:(l=e.characters)!=null&&l.name?_(e.character_id,e.characters.name):"#",children:[a(N,{isPublic:e.is_public})," ",((n=e.characters)==null?void 0:n.name)||"Private bot"]}),description:r("div",{children:[e.summary?e.characters?a(k,{title:u(e.summary,"you",e.characters.name),children:r("p",{children:["Summary:"," ",m(u(e.summary,"you",e.characters.name),{length:150})]})}):a("p",{children:"This character is private or removed. You can still continue your chat."}):a("p",{children:m(e.characters?e.characters.description:"This character is private or removed. You can still continue your chat.",{length:150})}),r("p",{className:"mb-2",children:[a(P,{})," ",b(e.updated_at)," ago",a("br",{})," ",a(o,{})," ",e.chat_count," messages"]})]})})},e.id)})})};export{j as C};