import{j as a,r as T}from"./@radix-3bj3otF9.js";import{r as P,T as y,bP as w,e as k,C as I,q as U,t as _,v as E,s as L,a9 as R,aa as C,z as S,aQ as A,aR as D,aS as x,aT as p,bQ as O,d as Q,a2 as z,aU as g}from"./index-1REJ-mbf.js";import{S as B}from"./chevron-down-smmnLxYI.js";import{S as F}from"./transform-CRpCHU_K.js";import{L as K,f as M,c as V}from"./@react-router-Ct_TgVUW.js";import{K as o,N as $}from"./KeyValue-ULVVsU7P.js";function q({connectorName:s,connectorId:e}){return a.jsx(K,{to:P.settings.connectors.detail.configuration(e),children:a.jsxs(y,{color:"yellow",rounded:!1,className:"w-fit gap-0.5",emphasis:"subtle",children:[a.jsx(F,{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(G,{componentId:s})}),a.jsx("div",{children:a.jsx(J,{componentId:s})})]})}function G({componentId:s}){var c,d,b,h,f,j,v,N;const[e,n]=T.useState(!0),l=w(s);if(l.isError)return null;if(l.isPending)return a.jsx(k,{className:"h-[150px] w-full"});const t=l.data,r=(c=t.resources)==null?void 0:c.user,m=(d=t.body)==null?void 0:d.created,u=(b=t.body)==null?void 0:b.updated,i=(h=t.metadata)==null?void 0:h.connector;return a.jsxs(I,{open:e,onOpenChange:n,children:[a.jsx(U,{className:"flex items-center gap-[10px]",children:a.jsxs(_,{className:"flex w-full items-center",children:[a.jsx(B,{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(y,{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(((f=t.body)==null?void 0:f.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:r?a.jsx(R,{avatarUrl:((v=r.body)==null?void 0:v.avatar_url)??void 0,username:r.name,isServiceAccount:!!((N=r.body)!=null&&N.is_service_account)}):"Not available"}),a.jsx(o,{label:"Service Connector",value:i?a.jsx(q,{connectorName:i.name,connectorId:i.id}):"Not available"}),a.jsx(o,{label:"Updated",value:u?a.jsx(C,{dateString:u}):"Not available"}),a.jsx(o,{label:"Created",value:m?a.jsx(C,{dateString:m}):"Not available"})]})})]})}function J({componentId:s}){var n;const e=w(s);return e.isError?null:e.isPending?a.jsx(k,{className:"h-[150px] w-full"}):a.jsx($,{isInitialOpen:!0,intent:"primary",title:"Configuration",data:(n=e.data.metadata)==null?void 0:n.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 na({componentId:s,isPanel:e,stacksTabContent:n,runsTabContent:l}){const[t,r]=T.useState("configuration"),m=X(),u=V();function i(c){if(e){r(c);return}const d=new URLSearchParams;d.set("tab",c),u(`?${d.toString()}`)}return a.jsx("div",{className:"p-5",children:a.jsxs(A,{value:e?t:m,onValueChange:i,children:[a.jsxs(D,{children:[a.jsxs(x,{className:"flex items-center gap-2 text-text-md",value:"configuration",children:[a.jsx(p,{icon:O}),a.jsx("span",{children:"Configuration"})]}),a.jsxs(x,{className:"flex items-center gap-2 text-text-md",value:"stacks",children:[a.jsx(p,{icon:Q}),a.jsx("span",{children:"Stacks"})]}),a.jsxs(x,{className:"flex items-center gap-2 text-text-md",value:"runs",children:[a.jsx(p,{icon:z}),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:n}),a.jsx(g,{className:"m-0 mt-5 border-0 bg-transparent p-0",value:"runs",children:l})]})})}export{na as S};
