import{o as e}from"./rolldown-runtime-iuO8RvI4.js";import{Ei as s,Mi as i,ki as t}from"./vendor-frame-CwiylG4Y.js";import{nn as a}from"./vendor-all-2-BJdkbLSj.js";import{S as n}from"./shared-frame-DbQbH4Yr.js";import{Po as o,ro as l}from"./shared-4-6CEyRAHb.js";import{Rr as r,zr as d}from"./shared-7-VxUxSmVa.js";import{Lt as c}from"./shared-12-kUZ_jZyi.js";var m=e(i()),x=t(),p=(0,m.memo)(({file:e,isLoading:i,hideFileName:t,hideCopyButton:p,hideDescriptionHeading:f,omitStructuredHooksFrontmatter:h,leadingActions:j})=>{const{copyToClipboard:g,didCopy:u}=o(),[v,w]=(0,m.useState)("normal"),y=e?.path||"",b=y.split("/").pop()||"",{fileMimeType:N,fileSyntax:C,displayFileType:F,showViewToggle:M,isTextContent:T}=l(y),k=(0,m.useCallback)(async()=>{"string"==typeof e?.content&&await g(e.content)},[g,e?.content]);if(i)return(0,x.jsxs)("div",{"aria-busy":"true",className:s("flex flex-col flex-1 min-h-0 gap-3",t&&"p-5 font-base"),children:[(0,x.jsx)(n,{width:"45%",height:"1.25em",className:"mb-1"}),(0,x.jsx)(n,{width:"100%"}),(0,x.jsx)(n,{width:"95%"}),(0,x.jsx)(n,{width:"100%"}),(0,x.jsx)(n,{width:"60%"})]});if(!e)return null;if(e.contentsOmitted){const s=void 0!==e.size?(e.size/1048576).toFixed(1):void 0;return(0,x.jsxs)("div",{className:"flex flex-1 flex-col min-h-0",children:[!t&&(0,x.jsx)("div",{className:"flex items-center justify-between pb-2",children:(0,x.jsx)("span",{className:"font-base text-text-500",children:b})}),t&&j&&(0,x.jsx)("div",{className:"flex items-center gap-sm px-4 pt-3 min-w-0",children:j}),(0,x.jsx)("div",{className:"flex flex-1 items-center justify-center text-text-400",children:s?(0,x.jsx)(a,{defaultMessage:"{sizeMb} MB \u2014 too large to preview",id:"CcdMgiliKQ",values:{sizeMb:s}}):(0,x.jsx)(a,{defaultMessage:"File is too large to preview",id:"nVfvltfEIc"})})]})}const z=T&&(M||!p)&&(p?M&&(0,x.jsx)(r,{viewing:v,onViewingChange:w}):(0,x.jsx)(c,{viewing:v,onViewingChange:w,onCopy:k,didCopy:u,showToggle:M,inline:!0}));return(0,x.jsxs)("div",{className:"relative flex flex-1 flex-col min-h-0",children:[!t&&(0,x.jsxs)("div",{className:"flex items-center justify-between pb-2",children:[(0,x.jsx)("span",{className:"font-base text-text-500",children:b}),z]}),t&&j&&(0,x.jsxs)("div",{className:"flex items-center justify-between gap-sm px-4 pt-3",children:[(0,x.jsx)("div",{className:"flex items-center gap-sm min-w-0",children:j}),z&&(0,x.jsx)("div",{className:"shrink-0",children:z})]}),t&&!j&&z&&(0,x.jsx)("div",{className:"absolute top-3 right-3 z-[1] rounded-md bg-surface-1",children:z}),(0,x.jsx)("div",{className:s("flex-1 min-h-0",t&&("code"===F?"font-base":"p-5")),children:(0,x.jsx)(d,{content:e.content,displayFileType:F,language:C,viewing:v,fileName:b,mimeType:N,noAutoScroll:!0,compact:!0,proseInset:t,scrollFade:!0,typography:t?"inherit":void 0,hideDescriptionHeading:f,omitStructuredHooksFrontmatter:h})})]})});export{p as t};