1import{a as p,u as x,j as e}from"./vendor-query-CCETC0x4.js";import{I as h}from"./vendor-icons-fxG_YF2E.js";import{a as u}from"./index-C2SdAryg.js";import{m as r}from"./vendor-motion-DCZIN_Xc.js";import"./vendor-router-By49MWeJ.js";import"./vendor-avataaars-CGBvmKME.js";const f={width:512,height:512,body:'<path fill="currentColor" d="M304 48a48 48 0 1 0-96 0a48 48 0 1 0 96 0zm0 416a48 48 0 1 0-96 0a48 48 0 1 0 96 0zM48 304a48 48 0 1 0 0-96a48 48 0 1 0 0 96zm464-48a48 48 0 1 0-96 0a48 48 0 1 0 96 0zM142.9 437A48 48 0 1 0 75 369.1a48 48 0 1 0 67.9 67.9zm0-294.2A48 48 0 1 0 75 75a48 48 0 1 0 67.9 67.9zM369.1 437a48 48 0 1 0 67.9-67.9a48 48 0 1 0-67.9 67.9z"/>'},b=()=>{const[s,n]=p.useState("dependencies"),{data:a,isLoading:o,isError:c}=x({queryKey:["package-json"],queryFn:u});if(o)return e.jsx("div",{className:"h-full flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(h,{icon:f,className:"w-8 h-8 animate-spin mx-auto mb-4 text-terminal-text"}),e.jsx("p",{className:"text-terminal-text font-pixel",children:"Loading dependencies..."}),e.jsx("p",{className:"text-muted-foreground text-sm mt-2",children:"(API might take a moment to wake up)"})]})});if(c)return e.jsx("div",{className:"h-full flex items-center justify-center",children:e.jsx("p",{className:"text-destructive font-pixel",children:"Failed to load dependencies. API might be sleeping."})});const d=a?.dependencies??{},l=a?.devDependencies??{},i=s==="dependencies"?d:l,m=Object.keys(i).length===0;return e.jsxs("div",{className:"h-full bg-terminal-bg p-4 overflow-auto",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("h3",{className:"font-pixel text-terminal-text mb-2",children:"Packages from my projects"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:["dependencies","devDependencies"].map(t=>e.jsx(r.button,{whileHover:{scale:1.05},whileTap:{scale:.95},onClick:()=>n(t),className:`px-3 py-1 font-pixel text-xs border transition-colors ${s===t?"bg-primary text-primary-foreground border-primary":"bg-window-header text-window-header-foreground border-window-border hover:bg-primary/20"}`,children:t==="dependencies"?"Production":"Development"},t))})]}),e.jsx(r.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"mt-4",children:m?e.jsx("p",{className:"text-muted-foreground font-pixel text-sm",children:"No packages in this list."}):e.jsx("pre",{className:"text-terminal-text text-sm overflow-auto",children:e.jsx("code",{children:JSON.stringify(i,null,2)})})})]})};export{b as PackageJsonViewer};
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.