import{j as a,r as b}from"./@radix-AvWw-1nd.js";import{aP as j,S as v,a8 as N,a9 as C,aa as S,ab as y,M as T,_ as w,az as P,z as f,P as k,Q as U,R as g,aQ as D,af as E,N as I,U as x}from"./index-DWoLoYDY.js";import{S as R}from"./chevron-down-A3PXOshS.js";import{K as i,N as z}from"./NestedCollapsible-CE4OF670.js";import{D as h}from"./DisplayDate-C5Aw-Yca.js";import{I as M}from"./InlineAvatar-Bk4QLPTU.js";import{d as O,a as _}from"./@react-router-BUo5vhN4.js";function A({componentId:t}){return a.jsxs("section",{className:"grid grid-cols-1 gap-5 @5xl:grid-cols-2",children:[a.jsx("div",{children:a.jsx(B,{componentId:t})}),a.jsx("div",{children:a.jsx(F,{componentId:t})})]})}function B({componentId:t}){var d,u,n,l,p;const[e,r]=b.useState(!0),s=j(t);if(s.isError)return null;if(s.isPending)return a.jsx(v,{className:"h-[150px] w-full"});const o=(d=s.data.body)==null?void 0:d.user,c=(u=s.data.body)==null?void 0:u.created,m=(n=s.data.body)==null?void 0:n.updated;return a.jsxs(N,{open:e,onOpenChange:r,children:[a.jsx(C,{className:"flex items-center gap-[10px]",children:a.jsxs(S,{className:"flex w-full items-center",children:[a.jsx(R,{className:` ${e?"":"-rotate-90"} mr-2 h-5 w-5 rounded-md fill-neutral-500 transition-transform duration-200 hover:bg-neutral-200`}),"Basic Parameters"]})}),a.jsx(y,{className:"border-t border-theme-border-moderate bg-theme-surface-primary px-5 py-3",children:a.jsxs("dl",{className:"grid grid-cols-1 gap-x-[10px] gap-y-2 md:grid-cols-3 md:gap-y-4",children:[a.jsx(i,{label:"Component Name",value:s.data.name}),a.jsx(i,{label:"Flavor",value:a.jsxs(T,{rounded:!1,className:"w-fit gap-0.5 text-theme-text-primary",color:"grey",emphasis:"minimal",children:[a.jsx("img",{width:20,height:20,src:w(((l=s.data.body)==null?void 0:l.logo_url)||""),alt:"Flavor Icon of Component"}),a.jsx("p",{className:"truncate",children:(p=s.data.body)==null?void 0:p.flavor_name})]})}),a.jsx(i,{label:"Author",value:o?a.jsx(M,{username:P(o)}):"Not available"}),a.jsx(i,{label:"Updated",value:m?a.jsx(h,{dateString:m}):"Not available"}),a.jsx(i,{label:"Created",value:c?a.jsx(h,{dateString:c}):"Not available"})]})})]})}function F({componentId:t}){var r;const e=j(t);return e.isError?null:e.isPending?a.jsx(v,{className:"h-[150px] w-full"}):a.jsx(z,{isInitialOpen:!0,intent:"primary",title:"Configuration",data:(r=e.data.metadata)==null?void 0:r.configuration})}const K=f.object({tab:f.enum(["configuration","stacks","runs"]).optional().default("configuration").catch("configuration")});function L(){const[t]=O(),{tab:e}=K.parse({tab:t.get("tab")||void 0});return e}function W({componentId:t,isPanel:e,stacksTabContent:r,runsTabContent:s}){const[o,c]=b.useState("configuration"),m=L(),d=_();function u(n){if(e){c(n);return}const l=new URLSearchParams;l.set("tab",n),d(`?${l.toString()}`)}return a.jsx("div",{className:"p-5",children:a.jsxs(k,{value:e?o:m,onValueChange:u,children:[a.jsxs(U,{children:[a.jsxs(g,{className:"flex items-center gap-2 text-text-md",value:"configuration",children:[a.jsx(D,{className:"h-5 w-5 shrink-0 fill-theme-text-tertiary group-data-[state=active]/trigger:fill-theme-surface-strong"}),a.jsx("span",{children:"Configuration"})]}),a.jsxs(g,{className:"flex items-center gap-2 text-text-md",value:"stacks",children:[a.jsx(E,{className:"h-5 w-5 fill-theme-text-tertiary group-data-[state=active]/trigger:fill-theme-surface-strong"}),a.jsx("span",{children:"Stacks"})]}),a.jsxs(g,{className:"flex items-center gap-2 text-text-md",value:"runs",children:[a.jsx(I,{className:"h-5 w-5 fill-theme-text-tertiary group-data-[state=active]/trigger:fill-theme-surface-strong"}),a.jsx("span",{children:"Runs"})]})]}),a.jsx(x,{className:"m-0 mt-5 border-0 bg-transparent p-0",value:"configuration",children:a.jsx(A,{componentId:t})}),a.jsx(x,{className:"m-0 mt-5 border-0 bg-transparent p-0",value:"stacks",children:r}),a.jsx(x,{className:"m-0 mt-5 border-0 bg-transparent p-0",value:"runs",children:s})]})})}export{W as S};
