import{j as e,$ as s,aw as D,bo as P,b9 as T,bg as I,y as a,fk as O,aC as S,aD as A,bw as G,D as N,b as k,dT as r,bq as M,br as V,b1 as w,bs as L,h as _,q as R}from"./index-Cc-6WbPt.js";import{u as U}from"./useScreenWithScroll-zcr7TMGO.js";import{D as W,v as q,K as B,a as K,I as $,A as H,R as X,b as z}from"./validations-BA_PVm35.js";import{M as n,a as l,b as J,c as Q,d as Y,A as Z,P as ee,T as oe,e as se,C as re,f as ie}from"./PythonEnvField-BiGFTxXs.js";import{N as te}from"./NameField-CdFZkwOH.js";import{s as o}from"./styles-HMF4H4tQ.js";import{e as ae}from"./utils-CksRkoB7.js";import"./SingleSelect-BdzfpmLO.js";import"./index-D8ntmGU0.js";import"./useProjectId-hjycL6JQ.js";import"./index-DeWhk8_Z.js";import"./KubernetesProjectEdit-BWf57EkW.js";import"./getDefaultFormValues-DKgoN3yI.js";import"./index-UO3hMyLO.js";const ne=()=>e.jsxs(s,{sx:o.defaultGap,children:[e.jsx(te,{}),e.jsx(W,{})]}),ye=()=>{const{id:d,project:c}=D(),p=U(),m=P(),x=T(),{state:u={}}=I(),[f,g]=a(),[j,F]=a(),[h,v]=a(),[b,{isLoading:i}]=O(),t=S({reValidateMode:"onChange",shouldUnregister:!1,mode:"onChange",resetOptions:{keepDefaultValues:!0},defaultValues:{name:void 0,modelName:void 0,modelFramework:void 0,modelServer:void 0,artifactVersion:void 0,predictor:void 0,transformer:void 0,configFile:void 0,kserve:void 0,kafkaTopicDTO:void 0,inferenceLogging:void 0,modelInput:void 0,predictions:void 0,predictorResources:{cores:[n.cores,l.cores],memory:[n.memory,l.memory],gpus:n.gpus},batchingConfiguration:{batchingEnabled:!1},requestedInstances:void 0,requestedTransformerInstances:0},values:u,resolver:A(q)}),y=async E=>{if(_(t.formState.errors))try{await b({projectId:d,formValues:ae({formValues:E,project:c})}).unwrap(),x(R.project.deployments.list)}catch(C){console.error(C)}};return e.jsxs(G,{...t,children:[i&&e.jsx(N,{}),e.jsxs("form",{onSubmit:t.handleSubmit(y,console.error),style:o.editForm,children:[e.jsx(s,{justifyContent:"center",sx:o.editFormWrapper,children:e.jsxs(s,{flexDirection:"column",sx:o.fieldsWrapper,children:[e.jsx(k,{title:"Create new deployment",children:e.jsxs(s,{flexDirection:"column",sx:o.defaultGap,children:[e.jsx(J,{}),e.jsxs(s,{sx:o.defaultGap,children:[e.jsx(Q,{}),e.jsx(Y,{}),e.jsx(Z,{})]}),e.jsx(ne,{})]})}),e.jsx(r,{title:"Environment configuration",children:e.jsxs(s,{flexDirection:"column",sx:o.defaultGap,children:[e.jsx(B,{}),e.jsx(ee,{isFileExplorerOpen:f,toggleFileExplorerPopup:g}),e.jsx(oe,{isFileExplorerOpen:j,toggleFileExplorerPopup:F}),e.jsx(se,{}),e.jsx(re,{isFileExplorerOpen:h,toggleFileExplorerPopup:v})]})}),e.jsx(r,{title:"Inference logging",children:e.jsxs(s,{flexDirection:"column",sx:o.defaultGap,children:[e.jsx(K,{}),e.jsx($,{})]})}),e.jsx(r,{title:"Advanced configuration",children:e.jsxs(s,{flexDirection:"column",sx:o.defaultGap,children:[e.jsx(ie,{}),e.jsx(H,{})]})}),e.jsx(r,{title:"Resource allocation",children:e.jsx(X,{})}),e.jsx(z,{prefix:[],init:!0})]})}),e.jsx(M,{sx:{maxWidth:`var(${V})`},hasScrollOnScreen:p,mainButton:e.jsx(L,{type:"submit",intent:"primary",disabled:i,isLoading:i,children:"Create new deployment"}),secondaryButton:e.jsx(w,{type:"button",intent:"secondary",onClick:()=>m(-1),children:"Back"})})]})]})};export{ye as Create,ye as default};
