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-C6OVXshM.js";import{F as J}from"./FeatureGroupForm-BAKkjZK1.js";import"./defineProperty-C28biA2x.js";import"./useScreenWithScroll-zcr7TMGO.js";import"./AlertForm-B4xAdNle.js";import"./alertManagerConfig.selectors-DfRN6QT6.js";import"./Project-CZXtYPe0.js";import"./HumanizedCronExpression-B7-e7zEg.js";import"./index-D-ycbDlq.js";import"./form-DrxIax0x.js";import"./symmetricDifference-BYGiWULO.js";import"./index-Cgrh9eC0.js";import"./git-BLdzamrJ.js";import"./useCopyToClipboard-CRR-Czhi.js";import"./ServiceAlertList-DAoM0sfu.js";import"./index-DAXcl1uf.js";import"./transformations.selectors-DnzHXZ16.js";import"./LabelsForm-BZnaLOm5.js";import"./randomString-D3iDJlGT.js";import"./where-CFVFdHWR.js";import"./project-Wd1niWJn.js";import"./intersection-BuJ96q65.js";import"./flip-FKUpVyRf.js";import"./isAfter-DWWIHVdQ.js";import"./useUpdateTdOrFvInfoService-CcnrN7pN.js";import"./index-B3N5in7A.js";import"./SingleSelect-7lunYcLR.js";import"./FeaturesForm-rBTLk3bq.js";import"./TagsForm-D7spoAiU.js";import"./randomArrayString---X8tfjV.js";import"./sort-BOLIcXtz.js";import"./index-Clp3wC8S.js";import"./StatisticsConfigurationForm-N6hmNKZ0.js";import"./index-D1PgvL_o.js";import"./NewTransformationPopup-B7opmGAq.js";import"./ViewTransformation--1ki1Z2h.js";import"./index-H5LhWHal.js";import"./zoom-D5h43YeK.js";import"./transform-C2GfmqNu.js";import"./string-cKWu9XK9.js";import"./splitAt-BgORvuSN.js";import"./index-B71lCevS.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};
