import{j as e}from"./@radix-DAoBbclx.js";import{C as O}from"./CodeSnippet-j6SUjNoa.js";import{b as S}from"./CollapsibleCard-CehR97tz.js";import{ai as k,e as d,C as I,o as D,q as P,t as w,a1 as F,r as L}from"./index-DnCFURX3.js";import{a as E}from"./@monaco-editor-Di1Jq_O0.js";import{b as m}from"./@tanstack-2852wz5w.js";import{a as Q,L as R}from"./@react-router-BTai9D5g.js";import{D as T}from"./deployment-status-tag-DXByBKnK.js";import{K as p,a as c}from"./KeyValue-B_OUMPK3.js";import{P as z}from"./pipeline-link-n7S1rP3v.js";import{R as B}from"./RepoBadge-UojwJo4J.js";import{S as K}from"./stack-info-full-D9-Nct8G.js";import{s as W}from"./index-DPy_6htP.js";import"./@elkjs-CmhuJAjY.js";import"./chevron-down-DPrYU2vK.js";import"./@reactflow-CLotj7HR.js";import"./@zod-3snSrKBm.js";import"./eye-C2BdTq-f.js";import"./ComponentIcon-BOGF3ktm.js";import"./bar-chart-square-check-CVLivjI6.js";import"./layout-BtXy9gkl.js";import"./transform-CoT5Lusb.js";import"./constants-BUlqx9qT.js";import"./stack-detail-query-CIp7lmsE.js";function _({Component:s}){const{snapshotId:r}=Q(),o=m({...k.detail(r),throwOnError:!0});if(o.isPending)return e.jsx(d,{className:"h-[200px] w-full"});if(o.isError)return null;const a=o.data;return e.jsx(s,{snapshot:a})}function q(){return e.jsx(_,{Component:A})}function A({snapshot:s}){var t;const[r,o]=E.useState(!0);if(!((t=s.body)==null?void 0:t.runnable))return null;const i=`from zenml.client import Client

Client().trigger_pipeline(snapshot_name_or_id="${s.id}")`;return e.jsxs(I,{open:r,onOpenChange:o,children:[e.jsx(D,{className:"flex items-center gap-[10px]",children:e.jsxs(P,{className:"flex w-full gap-2",children:[e.jsx(S,{open:r}),e.jsx("span",{children:"Code"})]})}),e.jsxs(w,{className:"border-t border-theme-border-moderate bg-theme-surface-primary px-5 py-3",children:[e.jsx("p",{className:"mb-2",children:"Run the snapshot"}),e.jsx(O,{fullWidth:!0,highlightCode:!0,wrap:!0,code:i})]})]})}function H(){return e.jsx(_,{Component:V})}function V({snapshot:s}){var f,g,b,C,y,v,N;const[r,o]=E.useState(!0),a=s.id,n=(f=s.resources)==null?void 0:f.pipeline.name,i=(g=s.resources)==null?void 0:g.pipeline.id,t=(b=s.resources)==null?void 0:b.code_reference,u=(C=t==null?void 0:t.body)==null?void 0:C.code_repository.id,x=(y=t==null?void 0:t.body)==null?void 0:y.commit,l=(v=s.resources)==null?void 0:v.deployment,h=l==null?void 0:l.id,j=(N=l==null?void 0:l.body)==null?void 0:N.status;return e.jsxs(I,{open:r,onOpenChange:o,children:[e.jsx(D,{className:"flex h-9 items-center gap-[10px]",children:e.jsxs(P,{className:"flex w-full gap-2",children:[e.jsx(S,{open:r}),"Details"]})}),e.jsx(w,{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(p,{label:"Id",value:e.jsxs("div",{className:"group/copybutton flex items-center gap-0.5",children:[a,e.jsx(F,{copyText:a})]})}),e.jsx(p,{label:"Pipeline",value:n&&i?e.jsx(z,{pipelineId:i,pipelineName:n}):e.jsx(c,{})}),e.jsx(p,{label:"Deployment",value:h&&j?e.jsx(R,{to:L.projects.deployments.detail.overview(h),children:e.jsx(T,{size:"sm",status:j})}):e.jsx(c,{})}),e.jsx(p,{label:"Repository/Commit",value:u&&x?e.jsx(B,{repositoryId:u,commit:x}):e.jsx(c,{})})]})})]})}function $(){var n,i,t;const{snapshotId:s}=Q(),r=m({...k.detail(s)}),o=(t=(i=(n=r.data)==null?void 0:n.resources)==null?void 0:i.stack)==null?void 0:t.id,a=m({...W.stackDetail(o??""),enabled:!!o});return r.isPending?e.jsx(d,{className:"h-[300px] w-full"}):r.isError?e.jsx("div",{children:"Failed to load snapshot."}):o?a.isPending?e.jsx(d,{className:"h-[300px] w-full"}):a.isError?e.jsx("div",{children:"Failed to load stack."}):e.jsx(K,{stack:a.data,objectConfig:{}}):e.jsx("div",{children:"Stack not available for this snapshot."})}function fe(){return e.jsxs("div",{className:"grid grid-cols-1 gap-5 lg:grid-cols-2",children:[e.jsxs("div",{className:"space-y-5",children:[e.jsx(H,{}),e.jsx(q,{})]}),e.jsx("div",{children:e.jsx($,{})})]})}export{fe as default};
