import{i as e}from"./chunk-B3pr0VN8.js";import{n as t,t as n}from"./jsx-runtime-wTfS3W87.js";var r=e(t(),1),i=n(),a=e=>{let t=String(e.title||`思考过程`).trim()||`思考过程`,n=String(e.stageText||``).trim(),a=typeof e.maxHeight==`number`?e.maxHeight:220,o=typeof e.fontSize==`number`?e.fontSize:10.5,s=typeof e.lineHeight==`number`?e.lineHeight:1.22,c=e.defaultCollapsed!==!1,l=e.autoScroll!==!1,u=e.embedded===!0,d=String(e.collapsedPreview||``).trim(),f=e.showWhenEmpty===!0,p=String(e.emptyText||`Waiting for model thinking...`).trim(),m=e.isStreaming===!0,h=(0,r.useMemo)(()=>!!String(e.thinking||``).trim(),[e.thinking]),[g,_]=(0,r.useState)(c),v=(0,r.useRef)(null);return(0,r.useEffect)(()=>{h&&_(c)},[c,h]),(0,r.useEffect)(()=>{if(!l||g||!h)return;let e=v.current;if(!e)return;let t=setTimeout(()=>{e&&(e.scrollTop=e.scrollHeight)},50);return()=>clearTimeout(t)},[e.thinking,g,l,h]),!h&&!f?null:(0,i.jsxs)(`div`,{className:u?void 0:`he-card`,style:u?{marginTop:0,borderRadius:14,border:`1px solid rgba(148,163,184,0.12)`,background:`rgba(148,163,184,0.04)`,padding:`8px 10px`}:{marginTop:12},children:[(0,i.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:10},children:[(0,i.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:0},children:[(0,i.jsx)(`div`,{className:`he-label`,style:u?{fontSize:11,letterSpacing:.2,color:`var(--text-2)`}:void 0,children:t}),m?(0,i.jsxs)(`span`,{className:`he-thinking-dots`,children:[(0,i.jsx)(`span`,{}),(0,i.jsx)(`span`,{}),(0,i.jsx)(`span`,{})]}):null]}),(0,i.jsx)(`button`,{type:`button`,className:`btn-secondary`,style:u?{padding:`1px 6px`,fontSize:11,minHeight:22,borderRadius:999,borderColor:`rgba(148,163,184,0.14)`,background:`transparent`,color:`var(--text-3)`}:{padding:`2px 8px`,fontSize:12},onClick:()=>_(e=>!e),children:g?`展开`:`折叠`})]}),n?(0,i.jsx)(`div`,{className:`he-muted`,style:u?{marginTop:4,fontSize:10.5}:{marginTop:6},children:n}):null,g&&d?(0,i.jsx)(`div`,{className:`he-muted`,style:u?{marginTop:6,fontSize:11.5,lineHeight:1.45}:{marginTop:8,fontSize:12,lineHeight:1.5},children:d}):null,g?null:(0,i.jsx)(`div`,{ref:v,className:`he-pre`,style:{marginTop:u?8:10,fontSize:o,lineHeight:s,maxHeight:a,overflow:`auto`},children:h?String(e.thinking||``):p})]})};export{a as t};