import{j as o,r as m}from"./vendor-react-wBh_31cN.js";import{A}from"./animated-progress-BdqEbBYd.js";import{u as N}from"./useNotifier-BCEAoFCf.js";import{R as h,X as E,g as d,r as n}from"./index-BKr2rJhV.js";import{L}from"./label-Dnebucx5.js";import{u as v}from"./useTitle-DQo_L6Ox.js";import{a as O,b as y}from"./index-BeaoFlb1.js";import{t as w}from"./titles-CzjGGAB3.js";import{A as b}from"./constants-CHYRqupQ.js";import{P as F}from"./ProjectForm-Cu_HDb_2.js";import{u as G}from"./vendor-router-D1GqFWiT.js";import"./notifications-x-pTFTQl.js";import"./toast-3g7Fh-a0.js";import"./vendor-redux-CJZrIb6x.js";import"./vendor-utils-OeoE2qq_.js";import"./vendor-icons-BUUmD6ht.js";import"./vendor-radix-BRyWS4bQ.js";import"./vendor-grid-CeFlDWv4.js";import"./index.esm-CAGtek53.js";import"./yup-XkUC3UEH.js";import"./getInputValidation-CUi6Oel7.js";import"./input-H6_qmzms.js";import"./card-DISTA6Ay.js";import"./form-footer-CprMCGDT.js";import"./tooltip-Da8-EbK8.js";import"./utils-DSqkOIhq.js";import"./storage-connector-DQCKY9HZ.js";import"./combobox-CcK1PxyF.js";import"./input-group-Z3Qmt3PL.js";import"./textarea-Co48BFy3.js";import"./vendor-recharts-DmJlpLaF.js";import"./hoverable-link-onkuw0bk.js";import"./getHopsDoc-BWSxyuXn.js";import"./selectors-CMD4o3wq.js";import"./index-DkvW68Om.js";import"./ArrayField-DU-w4GBF.js";import"./icon-button-FETOk6q1.js";import"./radio-group-D7-g0sv3.js";import"./always-CtAmwIxm.js";import"./useCurrentProject-C6qZaZgv.js";import"./useProject-FSnHbCQX.js";import"./confirmation-dialog-DFt7ZgUQ.js";import"./useCopyToClipboard-3DFwhniW.js";import"./fileExplorer-BRS7UOt9.js";import"./useDownload-YBz540B0.js";import"./getPathAndFileName-BId4RGny.js";import"./FileUploaderButton-DXl5ypdF.js";import"./fileUploader-97-Ey7M3.js";import"./index-yLMRwF40.js";import"./file-utils-DSAei-GW.js";import"./converge-BDz-h6lA.js";import"./lensPath-CdufhmA3.js";import"./join-DatdAzSt.js";import"./init-BDcDHUTz.js";import"./ifElse-Blhrcs6_.js";import"./length-DTSUQW_a.js";import"./_isNumber-DRgbAj-F.js";import"./inc-0XPMXBh9.js";import"./add-DCChD-X4.js";import"./append-Bu8TTG0x.js";import"./includes-D04d5Ytc.js";import"./uniq-Cy5NeM3Y.js";import"./uniqBy-qYjau2JN.js";import"./concat-AxOj0lUI.js";import"./useDebounce-BiuGz9t2.js";import"./dumbPluralize-CcxDsNiu.js";import"./utils-JPS97eRI.js";import"./all-DVU-BA5G.js";import"./mergeRight-Cv2eiGXV.js";import"./juxt-BvCFisbd.js";import"./checkbox-DbZXziG0.js";import"./callout-Dd8FkTQe.js";import"./value-76ihWpF6.js";import"./props-gQDi595u.js";import"./zipObj-BpJhvpTB.js";const I=({children:t})=>o.jsxs("div",{className:"flex w-full flex-col items-center",children:[o.jsx(h,{bold:!0,gray:!0,className:"mb-2 text-lg",children:"Building new project"}),o.jsx(L,{className:"mb-5",children:"Project creation"}),t]}),it=()=>{const t=G(),c=N(),{currentData:a,isLoading:S}=O(),[u]=y(),{data:l}=E("trino_enabled"),{data:g}=E("superset_enabled"),[T,p]=m.useState({isProgressing:!1,isSuccess:!1,isError:!1}),f=m.useCallback(r=>{t(d(n.project.prj.view,n.project.value,{id:r}))},[t]),j=m.useCallback(async r=>{p(e=>({...e,isProgressing:!1,isSuccess:!0})),setTimeout(()=>{r?f(r):t(d(n.project.list))},1e3)},[t,f]),x=m.useCallback(async r=>{var e;try{p(s=>({...s,isProgressing:!0,isError:!1}));const i=await u({services:["JOBS","JUPYTER","HIVE","KAFKA","FEATURESTORE","SERVING","AIRFLOW",...l?["TRINO"]:[],...g?["SUPERSET"]:[]],projectName:r.projectName,namespace:r.namespace,description:r.description,featureStoreTopic:r.featureStoreTopic}).unwrap();j(i.data)}catch(i){p(C=>({...C,isProgressing:!1,isError:!0}));const s=(e=i==null?void 0:i.response)==null?void 0:e.data;c.error({title:"Error",content:`${s.errorMsg||""} ${s.usrMsg||""}`})}},[u,j,c,l,g]),{isProgressing:P,isSuccess:R}=T;return v(w.createProject),o.jsx(F,{projectsNames:a==null?void 0:a.map(({projectName:r})=>r),isLoading:S,onSubmit:x,isProgressingSubmit:P,isSuccessSubmit:R,progressElement:o.jsx(I,{children:o.jsx(A,{isAnimating:P,animationDuration:b/100,incrementDuration:b/25})})})};export{it as default};
