import{s as e}from"./chunk-Bj-mKKzh.js";import{fr as t}from"./app-server-manager-signals-Yn0WSnoY.js";import{n,t as r}from"./jsx-runtime-CiQ1k8xo.js";import{t as i}from"./clsx-BcPLHiun.js";import{lt as a}from"./vscode-api-DjORcpSo.js";import{o}from"./lib-MoKmYgcO.js";import{t as s}from"./chevron-AEenlp4G.js";import{t as c}from"./markdown-cYFj0Hke.js";var l=a(),u=e(n(),1),d=r(),f=`""`,p=8;function m(e){let t=(0,l.c)(7),{background:n,className:r,children:a,overflow:o}=e,s=n===void 0?`subtle`:n,c=o===void 0?`clip`:o,u=s===`normal`?`bg-token-main-surface-primary`:`bg-token-foreground/5`,f=c===`auto`?`overflow-auto`:`overflow-clip`,p;t[0]!==r||t[1]!==u||t[2]!==f?(p=i(`relative rounded-lg`,u,f,r),t[0]=r,t[1]=u,t[2]=f,t[3]=p):p=t[3];let m;return t[4]!==a||t[5]!==p?(m=(0,d.jsx)(`div`,{className:p,children:a}),t[4]=a,t[5]=p,t[6]=m):m=t[6],m}function h(e){let n=(0,l.c)(14),{enableMetadataPreview:r,markdown:i,conversationId:a,cwd:o,hideCodeBlocks:s,isStreaming:u}=e,f=r===void 0?!1:r,p=a===void 0?null:a,m=o===void 0?null:o,h=u===void 0?!1:u,_;n[0]!==f||n[1]!==i?(_=f?t(i):null,n[0]=f,n[1]=i,n[2]=_):_=n[2];let v=_,y=v?.body??i,b;n[3]===v?b=n[4]:(b=v!=null&&v.entries.length>0?(0,d.jsx)(g,{entries:v.entries}):null,n[3]=v,n[4]=b);let x;n[5]!==p||n[6]!==m||n[7]!==s||n[8]!==h||n[9]!==y?(x=(0,d.jsx)(c,{className:`text-size-chat`,conversationId:p,hideCodeBlocks:s,isStreaming:h,cwd:m,children:y}),n[5]=p,n[6]=m,n[7]=s,n[8]=h,n[9]=y,n[10]=x):x=n[10];let S;return n[11]!==b||n[12]!==x?(S=(0,d.jsxs)(`div`,{className:`px-4 py-3`,children:[b,x]}),n[11]=b,n[12]=x,n[13]=S):S=n[13],S}function g(e){let t=(0,l.c)(13),{entries:n}=e,[r,a]=(0,u.useState)(!1),c=n.length>p,f;t[0]!==n||t[1]!==r||t[2]!==c?(f=c&&!r?n.slice(0,p):n,t[0]=n,t[1]=r,t[2]=c,t[3]=f):f=t[3];let m=f,h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,d.jsx)(`div`,{className:`mb-2 font-medium text-token-text-secondary`,children:(0,d.jsx)(o,{id:`markdown.metadata.title`,defaultMessage:`Metadata`,description:`Title for rendered Markdown file metadata`})}),t[4]=h):h=t[4];let g;t[5]===m?g=t[6]:(g=(0,d.jsx)(v,{entries:m}),t[5]=m,t[6]=g);let y;t[7]!==r||t[8]!==c?(y=c?(0,d.jsxs)(`button`,{type:`button`,"aria-expanded":r,className:`mt-1.5 inline-flex cursor-interaction items-center gap-1 text-token-text-secondary hover:text-token-text-primary`,onClick:()=>{a(_)},children:[(0,d.jsx)(`span`,{children:r?(0,d.jsx)(o,{id:`markdown.metadata.showLess`,defaultMessage:`Show less`,description:`Disclosure control shown when a Markdown metadata preview can collapse additional fields`}):(0,d.jsx)(o,{id:`markdown.metadata.showMore`,defaultMessage:`Show more`,description:`Disclosure control shown when a Markdown metadata preview hides additional fields`})}),(0,d.jsx)(s,{className:i(`icon-2xs transition-transform`,r?`rotate-180`:`rotate-0`)})]}):null,t[7]=r,t[8]=c,t[9]=y):y=t[9];let b;return t[10]!==g||t[11]!==y?(b=(0,d.jsxs)(`div`,{className:`mb-3 rounded-md border border-token-border/60 bg-token-foreground/5 px-3 py-2 text-xs`,children:[h,g,y]}),t[10]=g,t[11]=y,t[12]=b):b=t[12],b}function _(e){return!e}function v(e){let t=(0,l.c)(7),{className:n,entries:r}=e,a;t[0]===n?a=t[1]:(a=i(`grid grid-cols-[minmax(0,8rem)_minmax(0,1fr)] gap-x-3 gap-y-1.5`,n),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=r.map(y),t[2]=r,t[3]=o);let s;return t[4]!==a||t[5]!==o?(s=(0,d.jsx)(`dl`,{className:a,children:o}),t[4]=a,t[5]=o,t[6]=s):s=t[6],s}function y(e,t){return(0,d.jsxs)(`div`,{className:`contents`,children:[(0,d.jsx)(`dt`,{className:`truncate font-mono text-token-text-secondary`,title:e.key,children:e.key}),(0,d.jsx)(`dd`,{className:`min-w-0 text-token-text-primary`,children:(0,d.jsx)(b,{value:e.value})})]},`${e.key}-${t}`)}function b(e){let t=(0,l.c)(6),{value:n}=e;if(Array.isArray(n)){let e;t[0]===n?e=t[1]:(e=n.map(x),t[0]=n,t[1]=e);let r;return t[2]===e?r=t[3]:(r=(0,d.jsx)(`span`,{className:`flex min-w-0 flex-wrap gap-1`,children:e}),t[2]=e,t[3]=r),r}let r=n.length===0?f:n,i;return t[4]===r?i=t[5]:(i=(0,d.jsx)(`span`,{className:`font-mono break-words`,children:r}),t[4]=r,t[5]=i),i}function x(e,t){return(0,d.jsx)(`span`,{className:`max-w-full rounded-sm bg-token-foreground/10 px-1.5 py-0.5 font-mono break-words`,children:e.length===0?f:e},`${e}-${t}`)}export{h as n,m as t};
//# sourceMappingURL=markdown-surface-xOhZ3DLi.js.map