import{r as u,bx as A,by as E,u as w,ax as C,bI as D,bo as k,g7 as P,bn as U,A as q,ek as H,p as n,gS as L,bu as N,dx as Q,U as d,az as R,g9 as f,ga as z,gb as B,gc as J,Q as K,o as M,q as l,bJ as $,j as V}from"./index-Cc-6WbPt.js";import{F as W}from"./FeatureGroupForm-374cB2XJ.js";import"./Anchor-BpzIF9LH.js";import"./useScreenWithScroll-zcr7TMGO.js";import"./schematised-tags.selectors-WK3AUml0.js";import"./AlertForm-DE_nqBgd.js";import"./alertManagerConfig.selectors-ob2Z93Rq.js";import"./Project-BB6nGAyP.js";import"./complement-BOrTcrWV.js";import"./index-DeWhk8_Z.js";import"./symmetricDifference-FE3v46aY.js";import"./git-BLdzamrJ.js";import"./useCopyToClipboard-CGP_51ct.js";import"./ServiceAlertList-HPDSpEcK.js";import"./index-k6JxR6O9.js";import"./transformations.selectors-DnzHXZ16.js";import"./LabelsForm-De3fpCnG.js";import"./randomString-D3iDJlGT.js";import"./project-BdhY6ntx.js";import"./where-D2rEr8Aa.js";import"./intersection-yjpmw87Y.js";import"./flip-DZcY_k0G.js";import"./isAfter-B5uQtWTU.js";import"./useUpdateTdOrFvInfoService-fnWcny93.js";import"./index-CPqhvInz.js";import"./SingleSelect-BdzfpmLO.js";import"./FeaturesForm-DS-x18mi.js";import"./SchematisedTagsForm-DGEwUJig.js";import"./randomArrayString---X8tfjV.js";import"./sort-BOLIcXtz.js";import"./index-UO3hMyLO.js";import"./StatisticsConfigurationForm-m6pMs7l0.js";import"./index-B586lZFk.js";import"./NewTransformationPopup-BIpDvQan.js";import"./ViewTransformation-yCmGkz_S.js";import"./index-RxMbRJol.js";import"./zoom-A7rKCg-F.js";import"./transform-DZgNhtp2.js";import"./string-CFFdVFMV.js";import"./splitAt-M1OTtC4J.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=()=>{A(E.createFeatureGroup);const{id:t,fsId:r}=w(),{data:{id:p}={}}=C(),e=D(),c=k(),{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:T,histograms:G,correlations:I,exactUniqueness:h,timeTravelFormat:x,validationType:S,expectationSuite:Y,...y}=m,i=await e.featureGroups.create({projectId:+t,featureStoreId:+r,data:U(q("type",H.STREAM),n(L("timeTravelFormat"),s=>N("primaryKeys",n(Q(d("primary")),R(d("name")))(s.features),s)),{...y,features:B(o),timeTravelFormat:x.toUpperCase(),descStatsEnabled:!!f(o).length,validationType:S[0].toUpperCase(),eventTime:z(o),jobs:[],statisticsConfig:{columns:f(o),correlations:I,enabled:T,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(J.invalidateTags([K.ProjectTags.FeatureGroup])),e.onboarding.checkSection({userId:p,id:g.featuregroup}),e.onboarding.setOpenOnboarding({userId:p,open:!0}),c(M(l.project.featureGroup.overview,l.project.value,{fgId:i,fsId:r,id:t}))}},[e,r,c,t,p]),j=$(m=>m.loading.effects.featureGroups.create);return V.jsx(W,{isLoading:b,isDisabled:j,submitHandler:F})},Lt=u.memo(X);export{Lt as default};
