import{aM as p,aJ as e,r as j}from"./@ui-core-DKdciH1Z.js";import{C as I}from"./CodeSnippet-Dwuwo3ZI.js";import{b as g}from"./CollapsibleCard-3zV5aMxC.js";import{aa as b,e as c,C as y,o as C,q as v,v as N,a6 as D,r as P}from"./index-D7KLAbvI.js";import{a as S,L as w}from"./@react-router-DaIuhn3X.js";import{D as R}from"./deployment-status-tag-9Q9AOMJF.js";import{K as n}from"./KeyValue-DF0Uxg2V.js";import{a as l}from"./NestedCollapsible-k41ntPyA.js";import{P as E}from"./pipeline-link-DyLNQTVa.js";import{R as Q}from"./RepoBadge-TrmQFNq8.js";import{S as _}from"./stack-info-full-BRoYiry5.js";import{s as O}from"./index-C1wOIU40.js";import"./@reactflow-CJzATMj6.js";import"./@zod-DKyD3xVW.js";import"./@monaco-editor-CSMpaClf.js";import"./eye-off-T0xdenj_.js";import"./eye-0EFEzbgA.js";import"./ComponentIcon-BOKrWHiD.js";import"./bar-chart-square-check-Lt3fLSJ-.js";import"./layout-BRN9AeDt.js";import"./transform-Bq7p9csj.js";import"./constants-Dj_C1ZPH.js";import"./stack-detail-query-IhXZFDdF.js";function k({Component:s}){const{snapshotId:t}=S(),r=p({...b.detail(t),throwOnError:!0});if(r.isPending)return e.jsx(c,{className:"h-[200px] w-full"});if(r.isError)return null;const o=r.data;return e.jsx(s,{snapshot:o})}function F(){return e.jsx(k,{Component:L})}function L({snapshot:s}){const[t,r]=j.useState(!0);if(!s.body?.runnable)return null;const a=`from zenml.client import Client

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