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