import{r as u,bx as E,u as w,az as A,bI as D,bp as C,eW as P,bo as U,D as k,e0 as q,f as n,gJ as B,bv as H,de as K,U as d,aB as L,gb as N,gc as f,gd as R,ge as z,T as J,q as M,s as l,bK as Q,j as W,by as $}from"./index-C1DmWO_C.js";import{F as V}from"./FeatureGroupForm-DU_uYWp7.js";import"./Anchor-DFXOcnPw.js";import"./useScreenWithScroll-zcr7TMGO.js";import"./schematised-tags.selectors-xn4c-iOu.js";import"./storage-connector-BuEuJyVA.js";import"./AlertForm-CkZ7DISl.js";import"./alertManagerConfig.selectors-B9ELaxCY.js";import"./Project-CpwJZ-CK.js";import"./index-Dub34MAX.js";import"./FileUploaderButton-BtxUzlTS.js";import"./zipObj-D8EtfWld.js";import"./symmetricDifference-B3GPGppJ.js";import"./git-C8OLuEaG.js";import"./NoData-Y_e6mfNf.js";import"./useCopyToClipboard-v9FBn9Nz.js";import"./ServiceAlertList-CzBjm52H.js";import"./index-BnHp_Wzf.js";import"./transformations.selectors-DnzHXZ16.js";import"./LabelsForm-d9ejhXSo.js";import"./randomString-D3iDJlGT.js";import"./project-VxxpMOY0.js";import"./where-C_FV43Y5.js";import"./intersection-BP3rSf7y.js";import"./flip-DcJ5-1Gs.js";import"./isAfter-7Oi83Q9_.js";import"./useUpdateTdOrFvInfoService-BlTBzWj5.js";import"./index-LyaEmxl4.js";import"./SingleSelect-DvF8BLvQ.js";import"./SchematisedTagsForm-Cki5D0WB.js";import"./randomArrayString---X8tfjV.js";import"./sort-BOLIcXtz.js";import"./index-DMOJMCC5.js";import"./StatisticsConfigurationForm-B3NadTLP.js";import"./index-DDgDmsNg.js";import"./NewTransformationPopup-Y5zAhCoA.js";import"./ViewTransformation-CvML2ehg.js";import"./index-DMvrjxdW.js";import"./zoom-CRTJnDeN.js";import"./transform-C0Urpblx.js";import"./string-CFFdVFMV.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 X=()=>{E($.createFeatureGroup);const{id:t,fsId:r}=w(),{data:{id:p}={}}=A(),e=D(),c=C(),{currentData:v,isFetching:b}=P();u.useEffect(()=>{e.schematisedTags.fetch()},[e,t,v,r]);const F=u.useCallback(async(m,a)=>{const{features:o,enabled:j,histograms:G,correlations:I,exactUniqueness:h,timeTravelFormat:y,validationType:S,expectationSuite:Y,...x}=m,i=await e.featureGroups.create({projectId:+t,featureStoreId:+r,data:U(k("type",q.STREAM),n(B("timeTravelFormat"),s=>H("primaryKeys",n(K(d("primary")),L(d("name")))(s.features),s)),{...x,features:N(o),timeTravelFormat:y.toUpperCase(),descStatsEnabled:!!f(o).length,validationType:S[0].toUpperCase(),eventTime:R(o),jobs:[],statisticsConfig:{columns:f(o),correlations:I,enabled:j,histograms:G,exactUniqueness:h}})});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(z.invalidateTags([J.ProjectTags.FeatureGroup])),e.onboarding.checkSection({userId:p,id:g.featuregroup}),e.onboarding.setOpenOnboarding({userId:p,open:!0}),c(M(l.featureGroup.overview,l.project.value,{fgId:i,fsId:r,id:t}))}},[e,r,c,t,p]),T=Q(m=>m.loading.effects.featureGroups.create);return W.jsx(V,{isLoading:b,isDisabled:T,submitHandler:F})},Kt=u.memo(X);export{Kt as default};
