import{aq as i,aG as u,r as c,j as l,Q as f,aH as N,ca as k,fV as t,fT as h,fS as d}from"./index-ea7817a2.js";import{s as p}from"./utils-8f90da1d.js";const V=()=>{const{register:m,formState:{errors:n},setValue:e}=i(),[r,o]=u({name:["name","modelName"]});return c.useEffect(()=>{!r&&o&&e("name",o==null?void 0:o.replace(/[^a-zA-Z0-9]/g,"")),!o&&r&&e("name","")},[o,e]),l.jsx(f,{sx:n.name?p.errorText:{},children:l.jsx(N,{...m("name"),label:"Name",placeholder:"name"})})},w=()=>{const{control:m,formState:{errors:n},setValue:e}=i(),{state:r={}}=k(),o=u({name:"modelServer"}),S=a=>{const s=a.replace("_","-");return s[0]+s.slice(1).toLowerCase()},x=c.useMemo(()=>Object.keys(t).filter(a=>a!==t.PYTHON).map(a=>({key:a,label:S(a)})).concat({key:t.PYTHON,label:"Custom (python)"}),[]);c.useEffect(()=>{o&&!(r!=null&&r.modelName)&&e("modelName","",{shouldValidate:!0})},[o,e,r==null?void 0:r.modelName]);const F=a=>{const s=a===t.TENSORFLOW?d.TENSORFLOW_SERVING:d.PYTHON;e("modelServer",s),e("modelName","",{shouldValidate:!0}),e("modelVersion",""),e("artifactVersion","")};return l.jsx(f,{sx:n.modelServer?p.errorText:{},children:l.jsx(h,{required:!0,name:"modelFramework",label:"Framework",placeholder:"pick a framework",control:m,options:x,onSelectionChange:F})})};export{w as M,V as N};
