import{j as e,B as o,ay as F,bp as g,bJ as y,bi as b,w as v,f5 as P,aD as C,aE as D,bw as S,L as E,y as w,dz as r,br as G,bs as V,b4 as A,h as M,f6 as B,s as I}from"./index-C1DmWO_C.js";import{u as L}from"./useScreenWithScroll-zcr7TMGO.js";import{D as N,K as R,T as k,a as K,I as W,A as O,R as T,b as U,v as z}from"./validations-Bg4qD5Hi.js";import{M as J,a as q,b as H,A as Q,P as X,c as Y,d as Z}from"./PythonEnvField-Dwe2UtOV.js";import{N as _}from"./NameField-CLDJRiUL.js";import{s}from"./styles-C5ly0pQK.js";import"./SingleSelect-DvF8BLvQ.js";import"./index-CxmfBMSc.js";import"./useProjectId-Cio5B8Wh.js";import"./KubernetesProjectEdit-O522bxXP.js";import"./index-Dub34MAX.js";import"./FileUploaderButton-BtxUzlTS.js";import"./index-DMOJMCC5.js";import"./cluster-utilization-Ci7AXjmO.js";import"./min-BJfYLHXY.js";const $=()=>e.jsxs(o,{sx:s.defaultGap,children:[e.jsx(_,{}),e.jsx(N,{})]}),je=()=>{const{id:a,project:n}=F(),l=L(),d=g(),c=y(),{state:p={}}=b(),[x,m]=v(),[u,{isLoading:t}]=P(),i=C({reValidateMode:"onChange",shouldUnregister:!1,mode:"onChange",defaultValues:{artifactVersion:null,...p},resolver:D(z)}),j=async f=>{if(M(i.formState.errors))try{await u({projectId:a,formValues:B({formValues:f,project:n})}).unwrap(),c(I.deployments.list)}catch(h){console.error(h)}};return e.jsxs(S,{...i,children:[t&&e.jsx(E,{}),e.jsxs("form",{onSubmit:i.handleSubmit(j,console.error),style:s.editForm,children:[e.jsx(o,{justifyContent:"center",sx:s.editFormWrapper,children:e.jsxs(o,{flexDirection:"column",sx:s.fieldsWrapper,children:[e.jsx(w,{title:"Create new deployment",children:e.jsxs(o,{flexDirection:"column",sx:s.defaultGap,children:[e.jsx(J,{}),e.jsxs(o,{sx:s.defaultGap,children:[e.jsx(q,{}),e.jsx(H,{}),e.jsx(Q,{})]}),e.jsx($,{})]})}),e.jsx(r,{title:"Environment configuration",children:e.jsxs(o,{flexDirection:"column",sx:s.defaultGap,children:[e.jsx(R,{}),e.jsx(X,{isFileExplorerOpen:x,toggleFileExplorerPopup:m}),e.jsx(k,{}),e.jsx(Y,{})]})}),e.jsx(r,{title:"Inference logging",children:e.jsxs(o,{flexDirection:"column",sx:s.defaultGap,children:[e.jsx(K,{}),e.jsx(W,{})]})}),e.jsx(r,{title:"Advanced configuration",children:e.jsxs(o,{flexDirection:"column",sx:s.defaultGap,children:[e.jsx(Z,{}),e.jsx(O,{})]})}),e.jsx(r,{title:"Resource allocation",children:e.jsx(T,{})}),e.jsx(U,{prefix:[],init:!0})]})}),e.jsx(G,{hasScrollOnScreen:l,mainButton:e.jsx(V,{type:"submit",intent:"primary",disabled:t,isLoading:t,children:"Create new deployment"}),secondaryButton:e.jsx(A,{type:"button",intent:"secondary",onClick:()=>d(-1),children:"Back"})})]})]})};export{je as Create,je as default};
