import{i as r}from"./_virtual___federation_fn_import-DB-0B1B_.js";import{j as e}from"./jsx-runtime-u17CrQMm.js";import{a as P}from"./zod-DVFqTTZn.js";import{A as y}from"./app-content-layout-DtOvx2eV.js";import{A as g}from"./app-header-bar-ChGnmayX.js";import{R as k}from"./backend-COAjTRTh.js";const{createBackendAppSchema:L}=await r("@baseplate-dev/project-builder-lib"),{useBlockUnsavedChangesNavigate:w,useDefinitionSchema:D,useProjectDefinition:B,useResettableForm:N}=await r("@baseplate-dev/project-builder-lib/web"),{FormActionBar:C,InputFieldController:l,SectionList:E,SectionListSection:p,SectionListSectionContent:d,SectionListSectionDescription:m,SectionListSectionHeader:u,SectionListSectionTitle:x,SwitchFieldController:F}=await r("@baseplate-dev/ui-components");function I(){const{saveDefinitionWithFeedback:b,definition:f}=B(),{app:h,backendDefinition:s}=k.useLoaderData(),j=D(L),a=N({resolver:P(j),values:s}),{control:n,handleSubmit:v,reset:S,setError:A}=a,c=v(o=>{if(o.devPort){const i=f.apps.find(t=>t.id!==s.id&&t.devPort===o.devPort);if(i){A("devPort",{type:"manual",message:`Port ${o.devPort} is already used by app "${i.name}"`});return}}return b(i=>{i.apps=i.apps.map(t=>t.id===s.id?o:t)})});return w({control:n,reset:S,onSubmit:c}),e.jsx(y,{header:e.jsx(g,{app:h}),children:e.jsxs("form",{className:"w-full max-w-7xl space-y-4 px-4",onSubmit:c,children:[e.jsxs(E,{children:[e.jsxs(p,{children:[e.jsxs(u,{children:[e.jsx(x,{children:"General"}),e.jsx(m,{children:"Basic configuration for your backend application."})]}),e.jsxs(d,{className:"space-y-6",children:[e.jsx(l,{label:"Name",control:n,name:"name"}),e.jsx(l,{label:"Development Port",control:n,name:"devPort",type:"number",registerOptions:{valueAsNumber:!0},description:"Port number for the development server (e.g., 5001)"})]})]}),e.jsxs(p,{children:[e.jsxs(u,{children:[e.jsx(x,{children:"Configuration"}),e.jsx(m,{children:"Enable or disable external services and features for your backend application."})]}),e.jsx(d,{children:e.jsx("div",{className:"space-y-4",children:e.jsx(F,{control:n,name:"enableAxios",label:"Axios",description:"Enable Axios for HTTP requests"})})})]})]}),e.jsx(C,{form:a})]})})}export{I as component};
//# sourceMappingURL=backend-BJh4paqy.js.map
