import{j as e,r as N}from"./@radix-Cdvw4jJ8.js";import{r as T,w as C,be as S,g as y,ac as w,ad as k,ae as P,af as L,L as D,G as E,z as j,a4 as I,a5 as O,a6 as g,bf as R,al as U,a7 as x}from"./index-BgEfQ3_G.js";import{S as z}from"./terminal-XFL_4QN-.js";import{S as A}from"./chevron-down-jbbQh82s.js";import{S as B}from"./transform-CeZdrxDZ.js";import{L as F,f as K,c as M}from"./@react-router-DeDfXbUF.js";import{D as v}from"./DisplayDate-8RESqe5H.js";import{K as l,N as V}from"./NestedCollapsible-CMuDIJlp.js";function _({connectorName:s,connectorId:a}){return e.jsx(F,{to:T.settings.connectors.detail.configuration(a),children:e.jsxs(C,{color:"yellow",rounded:!1,className:"w-fit gap-0.5",emphasis:"subtle",children:[e.jsx(B,{width:20,height:20,className:"shrink-0 fill-warning-900"}),e.jsx("span",{children:s})]})})}function $({componentId:s}){return e.jsxs("section",{className:"grid grid-cols-1 gap-5 @5xl:grid-cols-2",children:[e.jsx("div",{children:e.jsx(G,{componentId:s})}),e.jsx("div",{children:e.jsx(H,{componentId:s})})]})}function G({componentId:s}){var c,m,p,f,h,b;const[a,r]=N.useState(!0),o=S(s);if(o.isError)return null;if(o.isPending)return e.jsx(y,{className:"h-[150px] w-full"});const t=o.data,n=(c=t.resources)==null?void 0:c.user,d=(m=t.body)==null?void 0:m.created,u=(p=t.body)==null?void 0:p.updated,i=(f=t.metadata)==null?void 0:f.connector;return e.jsxs(w,{open:a,onOpenChange:r,children:[e.jsx(k,{className:"flex items-center gap-[10px]",children:e.jsxs(P,{className:"flex w-full items-center",children:[e.jsx(A,{className:` ${a?"":"-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(L,{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(((h=t.body)==null?void 0:h.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(E,{username:n.name}):"Not available"}),e.jsx(l,{label:"Service Connector",value:i?e.jsx(_,{connectorName:i.name,connectorId:i.id}):"Not available"}),e.jsx(l,{label:"Updated",value:u?e.jsx(v,{dateString:u}):"Not available"}),e.jsx(l,{label:"Created",value:d?e.jsx(v,{dateString:d}):"Not available"})]})})]})}function H({componentId:s}){var r;const a=S(s);return a.isError?null:a.isPending?e.jsx(y,{className:"h-[150px] w-full"}):e.jsx(V,{isInitialOpen:!0,intent:"primary",title:"Configuration",data:(r=a.data.metadata)==null?void 0:r.configuration})}const Q=j.object({tab:j.enum(["configuration","stacks","runs"]).optional().default("configuration").catch("configuration")});function q(){const[s]=K(),{tab:a}=Q.parse({tab:s.get("tab")||void 0});return a}function te({componentId:s,isPanel:a,stacksTabContent:r,runsTabContent:o}){const[t,n]=N.useState("configuration"),d=q(),u=M();function i(c){if(a){n(c);return}const m=new URLSearchParams;m.set("tab",c),u(`?${m.toString()}`)}return e.jsx("div",{className:"p-5",children:e.jsxs(I,{value:a?t:d,onValueChange:i,children:[e.jsxs(O,{children:[e.jsxs(g,{className:"flex items-center gap-2 text-text-md",value:"configuration",children:[e.jsx(R,{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(g,{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(g,{className:"flex items-center gap-2 text-text-md",value:"runs",children:[e.jsx(z,{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(x,{className:"m-0 mt-5 border-0 bg-transparent p-0",value:"configuration",children:e.jsx($,{componentId:s})}),e.jsx(x,{className:"m-0 mt-5 border-0 bg-transparent p-0",value:"stacks",children:r}),e.jsx(x,{className:"m-0 mt-5 border-0 bg-transparent p-0",value:"runs",children:o})]})})}export{te as S};
