1import{n as e,o as t}from"./rolldown-runtime-CMxvf4Kt.js";import{F as n,G as r,L as i,U as a}from"../vendor/vendor-data-runtime-nLFaCKB0.js";import{O as o,tt as s}from"../vendor/vendor-ai-runtime-DrDK77gy.js";import{Ao as c,aa as l,ca as u,g as d,jo as f,nt as p}from"./app-const-BzFqCjOv.js";import{Fn as m,Oo as h,bo as ee,rn as g,vo as _}from"./ScrollArea-CdDxdn_v.js";import{I as te,Ji as ne,br as v,ir as re,n as y,oi as ie,qn as ae}from"./es-D7HWafs1.js";import{n as oe,xn as se}from"./es-D3_QMuVV.js";import{Up as ce,et as b}from"../vendor/vendor-icons-BXJMWD35.js";import{O as x,_ as le,n as S,r as C,v as ue,w as de,x as fe}from"./base-ui-Bi3Dz7GG.js";import{a as pe,ht as me,n as he,o as ge}from"./agent-Dh3-_0ai.js";import{n as _e,t as ve}from"./topic-BNd-QL8r.js";import{o as ye,t as be}from"./client-CZ_nGfzL.js";import{_t as w,at as xe,ct as Se,ft as T,gt as E,ht as Ce,it as we,lt as D,mt as Te,nt as Ee,ot as De,pt as Oe,rt as O,st as ke,tt as Ae,ut as k}from"./ErrorContent-DH2cR0nE.js";import{To as A,wo as j}from"./index-Doip7UYu.js";import{a as je,i as Me,r as Ne,t as Pe}from"./useScreenshot-_pwB6Gve.js";var M,N,P,Fe,Ie=e((()=>{y(),S(),a(),M=t(f()),n(),N=t(c()),P=(0,M.memo)(({defaultValue:e,description:t,onSave:n})=>{let{t:r}=i(`common`),{close:a}=fe(),[o,s]=(0,M.useState)(e),[c,l]=(0,M.useState)(!1),u=(0,M.useRef)(null);(0,M.useEffect)(()=>{queueMicrotask(()=>{u.current?.focus({cursor:`all`})})},[]);let d=(0,M.useCallback)(async()=>{if(c)return;let t=o.trim();if(!t||t===e){a();return}l(!0);try{await n(t),a()}finally{l(!1)}},[a,e,c,n,o]);return(0,N.jsxs)(_,{gap:20,children:[t?(0,N.jsx)(m,{style:{marginTop:-8},type:`secondary`,children:t}):null,(0,N.jsx)(ie,{ref:u,value:o,onChange:e=>s(e.target.value),onPressEnter:d}),(0,N.jsxs)(_,{horizontal:!0,gap:8,justify:`flex-end`,children:[(0,N.jsx)(x,{disabled:c,onClick:a,children:r(`cancel`)}),(0,N.jsx)(x,{loading:c,type:`primary`,onClick:d,children:r(`save`)})]})]})}),P.displayName=`RenameModalContent`,Fe=({defaultValue:e,description:t,onSave:n,title:i})=>ue({content:(0,N.jsx)(P,{defaultValue:e,description:t,onSave:n}),footer:null,maskClosable:!0,styles:{header:{borderBottom:`none`}},title:i??r(`rename`,{ns:`common`}),width:`min(90vw, 480px)`})})),F,I,Le,Re=e((()=>{y(),S(),F=t(f()),n(),I=t(c()),Le=(0,F.memo)(({description:e,onChange:t,showRemoveFiles:n,defaultRemoveFiles:r=!0})=>{let{t:a}=i(`topic`),[o,s]=(0,F.useState)(r);return(0,I.jsxs)(_,{gap:12,children:[e??a(`actions.confirmRemoveTopic`),n&&(0,I.jsx)(de,{checked:o,onChange:e=>{s(e),t(e)},children:a(`actions.confirmRemoveTopicFiles`)})]})})})),ze,Be,Ve,He=e((()=>{S(),a(),ve(),Re(),ze=t(c()),Be=500,Ve=async({content:e,okText:t,onConfirm:n,title:i,topicIds:a})=>{let o=!0,s;try{let e=new Promise(e=>{s=setTimeout(()=>e(!0),Be)});o=await Promise.race([_e.hasTopicFiles(a),e])}catch(e){console.error(`[confirmRemoveTopic]`,e)}finally{s!==void 0&&clearTimeout(s)}let c={removeFiles:!0};le({cancelText:r(`cancel`,{ns:`common`}),content:(0,ze.jsx)(Le,{description:e,showRemoveFiles:o,onChange:e=>{c.removeFiles=e}}),okButtonProps:{danger:!0},okText:t??r(`actions.removeTopic`,{ns:`topic`}),onOk:async()=>{await n(c.removeFiles)},title:i??r(`actions.confirmRemoveTopicTitle`,{ns:`topic`})})}})),L,R,z,Ue,We=e((()=>{y(),S(),b(),L=t(f()),n(),u(),xe(),j(),Me(),he(),ge(),E(),D(),Ee(),we(),R=t(c()),z={imageType:Pe.JPG,widthMode:O.Wide,withBackground:!1,withFooter:!0,withPluginInfo:!1,withSystemRole:!1},Ue=(0,L.memo)(()=>{let e=pe(me.currentAgentTitle),[t,n]=(0,L.useState)(z),{t:r}=i([`chat`,`common`]),{context:a,dbMessages:o}=w(),{loading:s,onDownload:c,title:u}=je({imageType:t.imageType,title:e??void 0}),{loading:d,onCopy:f}=De(),p=[{children:(0,R.jsx)(C,{items:[{key:O.Wide,label:r(`shareModal.widthMode.wide`)},{key:O.Narrow,label:r(`shareModal.widthMode.narrow`)}]}),label:r(`shareModal.widthMode.label`),layout:`horizontal`,minWidth:void 0,name:`widthMode`,valuePropName:`activeKey`},{children:(0,R.jsx)(g,{}),label:r(`shareModal.withSystemRole`),layout:`horizontal`,minWidth:void 0,name:`withSystemRole`,valuePropName:`checked`},{children:(0,R.jsx)(g,{}),label:r(`shareModal.withFooter`),layout:`horizontal`,minWidth:void 0,name:`withFooter`,valuePropName:`checked`},{children:(0,R.jsx)(C,{items:Ne}),label:r(`shareModal.imageType`),layout:`horizontal`,minWidth:void 0,name:`imageType`,valuePropName:`activeKey`}],m=A(),h=(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(x,{block:!0,icon:ce,loading:d,size:m?void 0:`large`,type:`primary`,onClick:()=>f(),children:r(`copy`,{ns:`common`})}),(0,R.jsx)(x,{block:!0,loading:s,size:m?void 0:`large`,onClick:c,children:r(`shareModal.download`)})]});return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(_,{className:k.body,gap:16,horizontal:!m,children:[(0,R.jsx)(Ae,{context:a,messages:o,title:u,...t}),(0,R.jsxs)(_,{className:k.sidebar,gap:12,children:[(0,R.jsx)(v,{initialValues:z,items:p,itemsType:`flat`,onValuesChange:(e,t)=>
1n(t),...l}),!m&&h]})]}),m&&(0,R.jsx)(_,{horizontal:!0,className:k.footer,gap:8,children:h})]})})})),Ge,Ke=e((()=>{o(),p(),Ge=({topic:e,messages:t,systemRole:n,withSystemRole:r})=>{let i=t.filter(e=>e.content!==`...`).map(e=>s({content:e.content,createdAt:new Date(e.createdAt).toISOString(),error:e.error,id:e.id,model:e.model,parentId:e.parentId,provider:e.provider,role:e.role,updatedAt:new Date(e.updatedAt).toISOString(),plugin:e.plugin,pluginError:e.pluginError,pluginIntervention:e.pluginIntervention,pluginState:e.pluginState,tool_call_id:e.tool_call_id,tools:e.tools,metadata:e.metadata,reasoning:e.reasoning,search:e.search,traceId:e.traceId}));if(r&&n){let e=new Date().toISOString();i.unshift({content:n,createdAt:e,id:`system-role`,role:`system`,updatedAt:e})}return s({version:`2.0`,title:e?.title,messages:i,exportedAt:new Date().toISOString()})}})),qe,Je=e((()=>{p(),qe=({messages:e,withSystemRole:t,includeTool:n,systemRole:r})=>{let i=e.filter(e=>e.content!==`...`).filter(e=>n?!0:e.role!==`tool`).map(e=>({content:e.content.trim(),role:e.role,tool_call_id:n&&e.tool_call_id?e.tool_call_id:void 0,tools:n&&e.tools?e.tools:void 0}));return t&&r?[{content:r,role:`system`},...i]:i}})),Ye,B,Xe,Ze=e((()=>{y(),ee(),Ye=t(f()),D(),B=t(c()),Xe=(0,Ye.memo)(({content:e})=>(0,B.jsx)(`div`,{className:h(T.preview,T.previewWide),style:{padding:16},children:(0,B.jsx)(re,{wrap:!0,language:`json`,variant:`borderless`,style:{fontSize:12},children:e})}))})),V,H,U,Qe,$e=e((()=>{d(),be(),y(),S(),oe(),b(),V=t(f()),n(),j(),E(),D(),Ke(),Je(),Ze(),H=t(c()),U={exportMode:`full`,includeTool:!0,withSystemRole:!0},Qe=(0,V.memo)(()=>{let[e,t]=(0,V.useState)(U),{t:n}=i([`chat`,`common`]),{message:r}=se.useApp(),a=(0,V.useMemo)(()=>[{key:`full`,label:n(`shareModal.exportMode.full`)},{key:`simple`,label:n(`shareModal.exportMode.simple`)}],[n]),o=[{children:(0,H.jsx)(C,{activeKey:e.exportMode,items:a,styles:{list:{display:`flex`,width:`100%`},tab:{flex:1}},onChange:e=>t(t=>({...t,exportMode:e}))}),label:n(`shareModal.exportMode.label`),layout:`vertical`,minWidth:void 0,name:`exportMode`},{children:(0,H.jsx)(g,{}),label:n(`shareModal.withSystemRole`),layout:`horizontal`,minWidth:void 0,name:`withSystemRole`,valuePropName:`checked`}],{dbMessages:s,systemRole:c,title:u,topic:d}=w(),f=e.exportMode===`simple`?qe({...e,includeTool:!0,messages:s,systemRole:c??``}):Ge({...e,includeTool:!0,messages:s,systemRole:c??``,topic:d??void 0}),p=JSON.stringify(f,null,2),m=A(),h=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(x,{block:!0,icon:ce,size:m?void 0:`large`,type:`primary`,onClick:async()=>{await ne(p),r.success(n(`copySuccess`,{ns:`common`}))},children:n(`copy`,{ns:`common`})}),(0,H.jsx)(x,{block:!0,size:m?void 0:`large`,onClick:()=>{ye(p,`${u}.json`)},children:n(`shareModal.downloadFile`)})]});return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(_,{className:k.body,gap:16,horizontal:!m,children:[(0,H.jsx)(Xe,{content:p}),(0,H.jsxs)(_,{className:k.sidebar,gap:12,children:[(0,H.jsx)(v,{initialValues:U,items:o,itemsType:`flat`,onValuesChange:(e,n)=>t(n),...l}),!m&&h]})]}),m&&(0,H.jsx)(_,{horizontal:!0,className:k.footer,gap:8,children:h})]})})})),et,W,tt,nt=e((()=>{y(),ee(),et=t(f()),D(),W=t(c()),tt=(0,et.memo)(({content:e})=>(0,W.jsx)(`div`,{className:h(T.preview,T.previewWide),style:{padding:12},children:(0,W.jsx)(te,{variant:`chat`,children:e})}))})),G,K,q,rt,it=e((()=>{d(),be(),y(),S(),oe(),b(),G=t(f()),n(),j(),E(),D(),nt(),Te(),K=t(c()),q={includeTool:!0,includeUser:!0,withRole:!0,withSystemRole:!1},rt=(0,G.memo)(()=>{let[e,t]=(0,G.useState)(q),{t:n}=i([`chat`,`common`]),{message:r}=se.useApp(),a=[{children:(0,K.jsx)(g,{}),label:n(`shareModal.withSystemRole`),layout:`horizontal`,minWidth:void 0,name:`withSystemRole`,valuePropName:`checked`},{children:(0,K.jsx)(g,{}),label:n(`shareModal.withRole`),layout:`horizontal`,minWidth:void 0,name:`withRole`,valuePropName:`checked`},{children:(0,K.jsx)(g,{}),label:n(`shareModal.includeUser`),layout:`horizontal`,minWidth:void 0,name:`includeUser`,valuePropName:`checked`},{children:(0,K.jsx)(g,{}),label:n(`shareModal.includeTool`),layout:`horizontal`,minWidth:void 0,name:`includeTool`,valuePropName:`checked`}],{displayMessages:o,systemRole:s,title:c}=w(),u=Oe({...e,messages:o,systemRole:s??``,title:c}).replaceAll(` 2 3 4`,` 5`),d=A(),f=(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(x,{block:!0,icon:ce,size:d?void 0:`large`,type:`primary`,onClick:async()=>{await ne(u),r.success(n(`copySuccess`,{ns:`common`}))},children:n(`copy`,{ns:`common`})}),(0,K.jsx)(x,{block:!0,size:d?void 0:`large`,onClick:()=>{ye(u,`${c}.md`)},children:n(`shareModal.downloadFile`)})]});return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(_,{className:k.body,gap:16,horizontal:!d,children:[(0,K.jsx)(tt,{content:u}),(0,K.jsxs)(_,{className:k.sidebar,gap:12,children:[(0,K.jsx)(v,{initialValues:q,items:a,itemsType:`flat`,onValuesChange:(e,n)=>t(n),...l}),!d&&f]})]}),d&&(0,K.jsx)(_,{horizontal:!0,className:k.footer,gap:8,children:f})]})})})),J,Y,X,Z,Q=e((()=>{y(),S(),a(),J=t(f()),n(),j(),E(),We(),$e(),Se(),it(),Y=t(c()),X=(0,J.memo)(()=>{let[e,t]=(0,J.useState)(`screenshot`),{t:n}=i(`chat`),r=A(),{dbMessages:a,isLoading:o}=w(),s=(0,J.useMemo)(()=>[{key:`screenshot`,label:n(`shareModal.screenshot`)},{key:`text`,label:n(`shareModal.text`)},{key:`pdf`,label:n(`shareModal.pdf`)},{key:`json`,label:`JSON`}],[n]);return(0,Y.jsxs)(_,{gap:r?8:24,height:`100%`,style:{overflow:`hidden`,position:`relative`},children:[(0,Y.jsx)(C,{activeKey:e,items:s,variant:`rounded`,styles:{list:{display:`flex`,width:`100%`},tab:{flex:1}},onChange:e=>t(e)}),o&&a.length===0?(0,Y.jsx)(_,{gap:12,paddingBlock:8,children:(0,Y.jsx)(ae,{active:!0,paragraph:{rows:8}})}):(0,Y.jsxs)(Y.Fragment,{children:[e===`screenshot`&&(0,Y.jsx)(Ue,{mobile:r}),e===`text`&&(0,Y.jsx)(rt,{}),e===`pdf`&&(0,Y.jsx)(ke,{}
5),e===`json`&&(0,Y.jsx)(Qe,{})]})]})}),X.displayName=`ShareModalContent`,Z=({afterClose:e,context:t}={})=>ue({content:(0,Y.jsx)(Ce,{context:t,children:(0,Y.jsx)(X,{})}),footer:null,maskClosable:!0,onOpenChangeComplete:t=>{t||e?.()},styles:{content:{height:`min(80vh, 800px)`}},title:r(`shareModal.title`,{ns:`chat`}),width:`min(90vw, 1024px)`})})),$,at,ot=e((()=>{$=t(f()),Q(),at=({context:e,open:t,setOpen:n}={})=>{let r=(0,$.useRef)(null),i=(0,$.useCallback)(()=>{r.current?.close(),r.current=null},[]),a=(0,$.useCallback)(()=>r.current?r.current:(n?.(!0),r.current=Z({afterClose:()=>{r.current=null,n?.(!1)},context:e}),r.current),[e,n]);return(0,$.useEffect)(()=>{if(t!==void 0){if(t){a();return}i()}},[i,t,a]),{closeShareModal:i,openShareModal:a}}})),st=e((()=>{Q(),ot()}));export{Z as a,Ie as c,Q as i,Fe as l,ot as n,Ve as o,at as r,He as s,st as t};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.