import{j as a}from"./@radix-DAoBbclx.js";import{r as P,T,bU as y,e as w,C as I,o as U,q as _,t as E,s as L,aJ as O,aK as C,aN as A,aO as x,aP as p,bV as D,d as K,a3 as R,aQ as g}from"./index-DnCFURX3.js";import{S as V}from"./scrolling-tabs-list-DDAYAUUP.js";import{a as k}from"./@monaco-editor-Di1Jq_O0.js";import{S as z}from"./chevron-down-DPrYU2vK.js";import{S as B}from"./transform-CoT5Lusb.js";import{L as F,f as M,c as Q}from"./@react-router-BTai9D5g.js";import{K as o,N as $}from"./KeyValue-B_OUMPK3.js";import{z as S}from"./@zod-3snSrKBm.js";function q({connectorName:s,connectorId:e}){return a.jsx(F,{to:P.settings.connectors.detail.configuration(e),children:a.jsxs(T,{color:"yellow",rounded:!1,className:"w-fit gap-0.5",emphasis:"subtle",children:[a.jsx(B,{width:20,height:20,className:"shrink-0 fill-warning-900"}),a.jsx("span",{children:s})]})})}function H({componentId:s}){return a.jsxs("section",{className:"grid grid-cols-1 gap-5 @5xl:grid-cols-2",children:[a.jsx("div",{children:a.jsx(J,{componentId:s})}),a.jsx("div",{children:a.jsx(G,{componentId:s})})]})}function J({componentId:s}){var c,m,b,f,h,j,v,N;const[e,r]=k.useState(!0),i=y(s);if(i.isError)return null;if(i.isPending)return a.jsx(w,{className:"h-[150px] w-full"});const t=i.data,n=(c=t.resources)==null?void 0:c.user,d=(m=t.body)==null?void 0:m.created,u=(b=t.body)==null?void 0:b.updated,l=(f=t.metadata)==null?void 0:f.connector;return a.jsxs(I,{open:e,onOpenChange:r,children:[a.jsx(U,{className:"flex items-center gap-[10px]",children:a.jsxs(_,{className:"flex w-full items-center",children:[a.jsx(z,{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(E,{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(o,{label:"Component Name",value:t.name}),a.jsx(o,{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:L(((h=t.body)==null?void 0:h.logo_url)||""),alt:"Flavor Icon of Component"}),a.jsx("p",{className:"truncate",children:(j=t.body)==null?void 0:j.flavor_name})]})}),a.jsx(o,{label:"Author",value:n?a.jsx(O,{avatarUrl:((v=n.body)==null?void 0:v.avatar_url)??void 0,username:n.name,isServiceAccount:!!((N=n.body)!=null&&N.is_service_account)}):"Not available"}),a.jsx(o,{label:"Service Connector",value:l?a.jsx(q,{connectorName:l.name,connectorId:l.id}):"Not available"}),a.jsx(o,{label:"Updated",value:u?a.jsx(C,{dateString:u}):"Not available"}),a.jsx(o,{label:"Created",value:d?a.jsx(C,{dateString:d}):"Not available"})]})})]})}function G({componentId:s}){var r;const e=y(s);return e.isError?null:e.isPending?a.jsx(w,{className:"h-[150px] w-full"}):a.jsx($,{isInitialOpen:!0,intent:"primary",title:"Configuration",data:(r=e.data.metadata)==null?void 0:r.configuration})}const W=S.object({tab:S.enum(["configuration","stacks","runs"]).optional().default("configuration").catch("configuration")});function X(){const[s]=M(),{tab:e}=W.parse({tab:s.get("tab")||void 0});return e}function ia({componentId:s,isPanel:e,stacksTabContent:r,runsTabContent:i}){const[t,n]=k.useState("configuration"),d=X(),u=Q();function l(c){if(e){n(c);return}const m=new URLSearchParams;m.set("tab",c),u(`?${m.toString()}`)}return a.jsx("div",{className:"p-5",children:a.jsxs(A,{value:e?t:d,onValueChange:l,children:[a.jsxs(V,{children:[a.jsxs(x,{className:"flex items-center gap-2 text-text-md",value:"configuration",children:[a.jsx(p,{icon:D}),a.jsx("span",{children:"Configuration"})]}),a.jsxs(x,{className:"flex items-center gap-2 text-text-md",value:"stacks",children:[a.jsx(p,{icon:K}),a.jsx("span",{children:"Stacks"})]}),a.jsxs(x,{className:"flex items-center gap-2 text-text-md",value:"runs",children:[a.jsx(p,{icon:R}),a.jsx("span",{children:"Runs"})]})]}),a.jsx(g,{className:"m-0 mt-5 border-0 bg-transparent p-0",value:"configuration",children:a.jsx(H,{componentId:s})}),a.jsx(g,{className:"m-0 mt-5 border-0 bg-transparent p-0",value:"stacks",children:r}),a.jsx(g,{className:"m-0 mt-5 border-0 bg-transparent p-0",value:"runs",children:i})]})})}export{ia as S};
