import{r as u,bG as w,bH as D,u as E,au as A,bW as C,bx as P,ha as k,bw as U,D as H,ei as R,p as n,hT as q,bD as L,dR as N,Q as d,ay as Q,hc as f,hd as B,he as K,hf as M,O as W,t as X,x as l,bX as _,j as z}from"./index-Cox3ZWL0.js";import{F as J}from"./FeatureGroupForm-CMwv6NRr.js";import"./defineProperty-Bl0iR0r2.js";import"./useScreenWithScroll-zcr7TMGO.js";import"./AlertForm-BH8pll6k.js";import"./alertManagerConfig.selectors-D5v0uPxO.js";import"./Project-CBPFwDml.js";import"./HumanizedCronExpression-CCEBWMyY.js";import"./index-CvEisYn5.js";import"./form-_K_-Blw_.js";import"./symmetricDifference-DM6mun8f.js";import"./index-uwkRD1BL.js";import"./git-BLdzamrJ.js";import"./useCopyToClipboard-C9cjFU4I.js";import"./ServiceAlertList-VvuXq15t.js";import"./index-C7Rz9Es-.js";import"./transformations.selectors-DnzHXZ16.js";import"./LabelsForm-CDQk1WBi.js";import"./randomString-D3iDJlGT.js";import"./where-DECGm9Wq.js";import"./project-BhVxAOrV.js";import"./intersection-C3XIpYC0.js";import"./flip-N5Tfpc8q.js";import"./isAfter-CRLObozV.js";import"./useUpdateTdOrFvInfoService-aQ3jOLSd.js";import"./index-D1fzXta0.js";import"./SingleSelect-BT2eGsJi.js";import"./FeaturesForm-DNoDFZp2.js";import"./TagsForm-ChKTdobu.js";import"./randomArrayString---X8tfjV.js";import"./sort-BOLIcXtz.js";import"./index-DlTLF62i.js";import"./StatisticsConfigurationForm-jfWNbK4M.js";import"./index-DwNWquSM.js";import"./NewTransformationPopup-C-9V38GZ.js";import"./ViewTransformation-BRTp5-6i.js";import"./index-Ck37e_Tb.js";import"./zoom-D5h43YeK.js";import"./transform-C2GfmqNu.js";import"./string-cKWu9XK9.js";import"./splitAt-B2oa5W04.js";import"./index-Dnj59z1-.js";var g=(t=>(t.job="job",t.start="start",t.fgStats="fgStats",t.newProject="newProject",t.experiments="experiments",t.featuregroup="featuregroup",t))(g||{});const V=()=>{w(D.createFeatureGroup);const{id:t,fsId:r}=E(),{data:{id:p}={}}=A(),e=C(),c=P(),{currentData:h,isFetching:v}=k();u.useEffect(()=>{e.schematisedTags.fetch()},[e,t,h,r]);const b=u.useCallback(async(m,a)=>{const{features:o,enabled:T,histograms:j,correlations:G,exactUniqueness:I,timeTravelFormat:x,validationType:y,expectationSuite:Y,...S}=m,i=await e.featureGroups.create({projectId:+t,featureStoreId:+r,data:U(H("type",R.STREAM),n(q("timeTravelFormat"),s=>L("primaryKeys",n(N(d("primary")),Q(d("name")))(s.features),s)),{...S,features:K(o),timeTravelFormat:x.toUpperCase(),descStatsEnabled:!!f(o).length,validationType:y[0].toUpperCase(),eventTime:B(o),jobs:[],statisticsConfig:{columns:f(o),correlations:G,enabled:T,histograms:j,exactUniqueness:I}})});if(i){if(a&&a.length>1){const s={items:a};await e.validationAlert.createBulk({projectId:+t,featureStoreId:+r,featureGroupId:i,validationAlert:s})}else a&&a.length===1&&await e.validationAlert.create({projectId:+t,featureStoreId:+r,featureGroupId:i,validationAlert:a[0]});e(M.invalidateTags([W.ProjectTags.FeatureGroup])),e.onboarding.checkSection({userId:p,id:g.featuregroup}),e.onboarding.setOpenOnboarding({userId:p,open:!0}),c(X(l.project.featureGroup.overview,l.project.value,{fgId:i,fsId:r,id:t}))}},[e,r,c,t,p]),F=_(m=>m.loading.effects.featureGroups.create);return z.jsx(J,{isLoading:v,isDisabled:F,submitHandler:b})},Nt=u.memo(V);export{Nt as default};
